From 0401ec4286f37929d1d298527c05f5351850bf8a Mon Sep 17 00:00:00 2001 From: Haozhe Date: Mon, 10 Aug 2026 11:09:23 +0800 Subject: [PATCH 01/50] refactor(agent-core-v2): extract btw into a features/btw Feature unit (#2724) - move session/btw to features/btw, mirroring the plan feature layout - contribute ISessionBtwService at Session scope through BtwFeature (contributeService) instead of a static registerScopedService call - keep the package root exports unchanged; move the test to test/features/btw --- .../src/{session => features}/btw/btw.ts | 0 .../src/features/btw/btwFeature.ts | 26 +++++++++++++++++++ .../{session => features}/btw/btwService.ts | 22 +++++----------- packages/agent-core-v2/src/index.ts | 5 ++-- .../{session => features}/btw/btw.test.ts | 8 +++--- 5 files changed, 39 insertions(+), 22 deletions(-) rename packages/agent-core-v2/src/{session => features}/btw/btw.ts (100%) create mode 100644 packages/agent-core-v2/src/features/btw/btwFeature.ts rename packages/agent-core-v2/src/{session => features}/btw/btwService.ts (73%) rename packages/agent-core-v2/test/{session => features}/btw/btw.test.ts (97%) diff --git a/packages/agent-core-v2/src/session/btw/btw.ts b/packages/agent-core-v2/src/features/btw/btw.ts similarity index 100% rename from packages/agent-core-v2/src/session/btw/btw.ts rename to packages/agent-core-v2/src/features/btw/btw.ts diff --git a/packages/agent-core-v2/src/features/btw/btwFeature.ts b/packages/agent-core-v2/src/features/btw/btwFeature.ts new file mode 100644 index 00000000000..c47d509f424 --- /dev/null +++ b/packages/agent-core-v2/src/features/btw/btwFeature.ts @@ -0,0 +1,26 @@ +/** + * `btw` domain — `BtwFeature`: the side-question ("by the way") capability + * assembled as one App-scope Feature unit. + * + * Contributes the per-Session `ISessionBtwService` through the `features` + * base-class seams; retracting the unit withdraws it across the scope tree. + * Registered into the feature table at import. + */ + +import { LifecycleScope } from '#/app/scopes'; +import { Feature } from '#/features/feature'; +import { registerFeature } from '#/features/featureRegistry'; + +import { ISessionBtwService } from './btw'; +import { SessionBtwService } from './btwService'; + +export class BtwFeature extends Feature { + static override readonly name = 'btw'; + + constructor() { + super(); + this.contributeService(LifecycleScope.Session, ISessionBtwService, SessionBtwService); + } +} + +registerFeature(BtwFeature); diff --git a/packages/agent-core-v2/src/session/btw/btwService.ts b/packages/agent-core-v2/src/features/btw/btwService.ts similarity index 73% rename from packages/agent-core-v2/src/session/btw/btwService.ts rename to packages/agent-core-v2/src/features/btw/btwService.ts index 0b81d2cd7cf..74f45a0d1e5 100644 --- a/packages/agent-core-v2/src/session/btw/btwService.ts +++ b/packages/agent-core-v2/src/features/btw/btwService.ts @@ -5,16 +5,14 @@ * `IAgentLifecycleService.fork`, then disables tool calls via an * `onBeforeExecuteTool` veto listener (blocks every tool call with the * `toolApproval.formatDenyMessage`-formatted TOOL_CALL_DISABLED_MESSAGE) and - * appends the side-channel system reminder. Bound at Session scope — - * `fork('main')` is a session-level operation, so the service injects the - * session's `IAgentLifecycleService` directly rather than resolving it through - * the main agent's accessor. Callers materialize the main agent first; - * forking a missing source throws. + * appends the side-channel system reminder. Contributed at Session scope by + * `BtwFeature` (`features/btw/btwFeature`) — `fork('main')` is a + * session-level operation, so the service injects the session's + * `IAgentLifecycleService` directly rather than resolving it through the main + * agent's accessor. Callers materialize the main agent first; forking a + * missing source throws. */ -import { LifecycleScope } from '#/app/scopes'; - -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { IAgentSystemReminderService } from '#/agent/systemReminder/systemReminder'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; import { denyToolExecution } from '#/agent/toolExecutor/beforeToolExecuteEvent'; @@ -50,11 +48,3 @@ export class SessionBtwService implements ISessionBtwService { return child.id; } } - -registerScopedService( - LifecycleScope.Session, - ISessionBtwService, - SessionBtwService, - ScopeActivation.OnScopeCreated, - 'session-btw', -); diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index df9feb7ea2a..6d910fcaba4 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -289,6 +289,9 @@ export * from '#/app/flag/flagService'; export * from '#/agent/activityView/activityView'; import '#/agent/activityView/activityViewService'; +export * from '#/features/btw/btw'; +export * from '#/features/btw/btwService'; +import '#/features/btw/btwFeature'; import '#/features/plan/profile/plan'; export * from '#/features/plan/tools/enter-plan-mode/enter-plan-mode'; import '#/features/plan/tools/enter-plan-mode/enterPlanModeTool'; @@ -625,8 +628,6 @@ export * from '#/agent/rpc/prompt-metadata'; export * from '#/agent/scopeContext/scopeContext'; export * from '#/agent/stepRetry/stepRetry'; export * from '#/agent/stepRetry/stepRetryService'; -export * from '#/session/btw/btw'; -export * from '#/session/btw/btwService'; export * from '#/session/sessionInit/sessionInit'; export * from '#/session/sessionInit/sessionInitService'; export * from '#/session/sessionInit/profile/init'; diff --git a/packages/agent-core-v2/test/session/btw/btw.test.ts b/packages/agent-core-v2/test/features/btw/btw.test.ts similarity index 97% rename from packages/agent-core-v2/test/session/btw/btw.test.ts rename to packages/agent-core-v2/test/features/btw/btw.test.ts index 049d49a114e..2e3fc9d9f0b 100644 --- a/packages/agent-core-v2/test/session/btw/btw.test.ts +++ b/packages/agent-core-v2/test/features/btw/btw.test.ts @@ -6,14 +6,14 @@ import { TestInstantiationService } from '#/_base/di/test'; import { IAgentSystemReminderService } from '#/agent/systemReminder/systemReminder'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; import { IAgentToolExecutorService } from '#/agent/toolExecutor/toolExecutor'; -import type { ToolCall } from '#/kosong/contract/message'; -import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import { ISessionBtwService, SIDE_QUESTION_SYSTEM_REMINDER, TOOL_CALL_DISABLED_MESSAGE, -} from '#/session/btw/btw'; -import { SessionBtwService } from '#/session/btw/btwService'; +} from '#/features/btw/btw'; +import { SessionBtwService } from '#/features/btw/btwService'; +import type { ToolCall } from '#/kosong/contract/message'; +import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import { stubToolExecutorEvents, type ToolExecutorEventStubs } from '../../agent/toolExecutor/stubs'; From 2acf22f66e15361d9804d9014d58ad68a9383caf Mon Sep 17 00:00:00 2001 From: Haozhe Date: Tue, 11 Aug 2026 12:31:47 +0800 Subject: [PATCH 02/50] refactor(agent-core-v2): invert sessionLifecycle/MCP dependency via lifecycle event (#2803) - add onWillCreateSession to ISessionLifecycleService: a synchronous participation event fired before a session's services activate, exposing a session-domain facade (readSeed / contributeSeed / onSessionDispose) - workspaceMcp subscribes and activates ephemeral-server overlays itself: the configs travel as the new ISessionEphemeralMcpServers session seed, the stdio cwd is read from ISessionContext, the merged ISessionMcpHandle is contributed over the seed adapter's workspace projection, and the overlay shutdown is attached to the session's teardown - sessionLifecycle drops its IWorkspaceMcpService dependency, the overlay tracking map, handle-dispose wrapping, and the dispose backstop - rename ScopeOptions.extra to seeds and ScopeOptions.assemble to configureContainer --- packages/agent-core-v2/AGENTS.md | 4 +- packages/agent-core-v2/src/_base/di/scope.ts | 22 +-- packages/agent-core-v2/src/_base/di/test.ts | 6 +- .../src/app/bootstrap/bootstrap.ts | 2 +- .../workspaceLifecycleService.ts | 2 +- .../agentLifecycle/agentLifecycleService.ts | 2 +- .../src/session/mcp/ephemeralMcpServers.ts | 28 +++ .../sessionSeed/sessionSeedAdapters.ts | 20 +- .../sessionLifecycle/sessionLifecycle.ts | 27 +++ .../sessionLifecycleService.ts | 90 ++++----- .../workspace/workspaceMcp/workspaceMcp.ts | 6 +- .../workspaceMcp/workspaceMcpService.ts | 30 ++- .../test/_base/di/scope-tree.test.ts | 4 +- .../toolActivationService.test.ts | 6 +- .../test/app/gateway/gateway.test.ts | 1 + .../app/sessionExport/sessionExport.test.ts | 1 + packages/agent-core-v2/test/harness/agent.ts | 6 +- .../sessionSeed/sessionSeedAdapters.test.ts | 8 +- .../sessionLifecycle/sessionLifecycle.test.ts | 183 +++++++++--------- .../workspaceMcp/initialization.test.ts | 7 + .../workspaceMcp/workspaceMcp.test.ts | 88 ++++++++- 21 files changed, 347 insertions(+), 196 deletions(-) create mode 100644 packages/agent-core-v2/src/session/mcp/ephemeralMcpServers.ts diff --git a/packages/agent-core-v2/AGENTS.md b/packages/agent-core-v2/AGENTS.md index edb4c14c5a7..d7509008ce7 100644 --- a/packages/agent-core-v2/AGENTS.md +++ b/packages/agent-core-v2/AGENTS.md @@ -4,7 +4,7 @@ ## Scopes -Four `LifecycleScope` tiers — `App` / `Workspace` / `Session` / `Agent` (string-valued, declared in `src/app/scopes.ts` — the DI kernel in `src/_base/di/scope.ts` only knows opaque `ScopeKind` strings plus the order installed by `setScopeTopology`). The `workspace/` domain owns the Workspace tier: the App-scope `workspaceLifecycle` holds the live handler registry (one handler per workspaceId, create-or-get + join, never closed), and each handler's `sessionLifecycle` owns the session lifecycle (create/resume/fork/close/delete) as its child scopes. Workspace-scope services (`workspaceSkillCatalog` / `workspaceAgentProfileLoader` / `workspaceInstructions` / `workspaceMcp` / `workspaceDirs` / `workspaceFs` / `workspaceFsWatch` / `workspaceProcess` / `workspaceGit` / `workspaceToolPolicy` / `workspaceTrust`) hold the handler-shared resources — loaded once at handler materialization, then refreshed by fs watch — and sessions consume them through session-domain seed contracts with change events (`session/mcp`, `session/workspaceInfo`, `session/sessionSkillCatalog` data, …), projected by five seed-adapter units (`src/session/sessionSeed/sessionSeedAdapters.ts`): each adapter `@ref`-observes its workspace upstream, live-reads through getters, re-fires `onDidChange` when the backing generation switches, and provides the seed token synchronously through the session scope's `ScopeOptions.assemble` hook before session services activate (a host without the workspace layer keeps the scope's default `extra` registration; the inline seeds stay plain `extra`). `workspaceMcp` is pure connection orchestration over the scope-agnostic `mcpCore` layer; the effective server set is owned by `workspaceMcpConfig` (mcp.json files + plugin contributions, fs-watch refreshed), and MCP persistence — the `[mcp]` config section plus OAuth credentials — lives in `app/mcpConfig`, the same wrapper shape as `kosongConfig` over kosong. `workspaceDirs` is backed by `.kimi-code/local.toml`; `workspaceToolPolicy` is the os-level tool veto. A session created with `CreateSessionOptions.mcpServers` additionally gets ephemeral per-session MCP servers: `workspaceMcp.sessionOverlay` builds a session-owned manager for them (never persisted, invisible to the handler's other sessions, not gated by `workspaceTrust`), the session's `ISessionMcpHandle` seed carries a `session/mcp` `MergedMcpConnectionView` over the shared manager and the overlay (an ephemeral name shadows a workspace server for that session), and `sessionLifecycle` shuts the overlay down when the session handle disposes (backstopped by the lifecycle service's own dispose for teardown paths that bypass the handle wrapper). Agent profiles follow the Contribution / Registry / Catalog extension point instead of a workspace catalog: the `workspaceAgentProfileLoader` domain owns agent-file discovery end to end (parse / roots / SYSTEM.md / explicit runtime files) and its Workspace-scope loaders (`workspace` / `user` / `plugin` / `extra` / `explicit`) contribute `AgentProfileContribution` records to the collection via `this.provide`, tagged with the handler's `workspaceId`; the App-scope `IAgentProfileRegistry` is a fold over that collection (same-(sourceId, workspaceKey) later records shadow earlier ones, provider death withdraws; the App-scope `builtinAgentProfileLoader` contributes the code-defined profiles through an owned helper unit), and each Session-scope `sessionAgentProfileCatalog` projects the registry into the merged read view directly (name-level dedup + the builtin-override rule in the projection) — its seed carries only the workspace key. `workspaceTrust` records the per-workspace trust marker (persisted under the home, keyed by `encodeWorkDirKey(root)`); while untrusted, `workspaceMcpConfig` skips the project-level MCP config files (`.mcp.json`, `.kimi-code/mcp.json`). The trust state flips through kap-server's `GET|POST /workspaces/{id}/trust` + `POST /workspaces/{id}/untrust` routes. The old App-level session-lifecycle facade and `ISessionMcpService` / `ISessionFsService` are gone — compose `sessionIndex` → `workspaceLifecycle.handlerFor` → the handler instead. +Four `LifecycleScope` tiers — `App` / `Workspace` / `Session` / `Agent` (string-valued, declared in `src/app/scopes.ts` — the DI kernel in `src/_base/di/scope.ts` only knows opaque `ScopeKind` strings plus the order installed by `setScopeTopology`). The `workspace/` domain owns the Workspace tier: the App-scope `workspaceLifecycle` holds the live handler registry (one handler per workspaceId, create-or-get + join, never closed), and each handler's `sessionLifecycle` owns the session lifecycle (create/resume/fork/close/delete) as its child scopes. Workspace-scope services (`workspaceSkillCatalog` / `workspaceAgentProfileLoader` / `workspaceInstructions` / `workspaceMcp` / `workspaceDirs` / `workspaceFs` / `workspaceFsWatch` / `workspaceProcess` / `workspaceGit` / `workspaceToolPolicy` / `workspaceTrust`) hold the handler-shared resources — loaded once at handler materialization, then refreshed by fs watch — and sessions consume them through session-domain seed contracts with change events (`session/mcp`, `session/workspaceInfo`, `session/sessionSkillCatalog` data, …), projected by five seed-adapter units (`src/session/sessionSeed/sessionSeedAdapters.ts`): each adapter `@ref`-observes its workspace upstream, live-reads through getters, re-fires `onDidChange` when the backing generation switches, and provides the seed token synchronously through the session scope's `ScopeOptions.configureContainer` hook before session services activate (a host without the workspace layer keeps the scope's default `extra` registration; the inline seeds stay plain `extra`). The same `configureContainer` window also fires `sessionLifecycle.onWillCreateSession` — a synchronous participation event whose surface speaks the session domain's own vocabulary (`readSeed` / `contributeSeed` / `onSessionDispose`), so Workspace-scope participants contribute session-scoped resources without the lifecycle depending on them or on kernel mechanics: `workspaceMcp` uses it to activate a session's ephemeral-server overlay (the configs travel as the `ISessionEphemeralMcpServers` session seed), contributing the merged `ISessionMcpHandle` over the adapter's workspace projection and attaching the overlay's shutdown to the session's teardown. `workspaceMcp` is pure connection orchestration over the scope-agnostic `mcpCore` layer; the effective server set is owned by `workspaceMcpConfig` (mcp.json files + plugin contributions, fs-watch refreshed), and MCP persistence — the `[mcp]` config section plus OAuth credentials — lives in `app/mcpConfig`, the same wrapper shape as `kosongConfig` over kosong. `workspaceDirs` is backed by `.kimi-code/local.toml`; `workspaceToolPolicy` is the os-level tool veto. A session created with `CreateSessionOptions.mcpServers` additionally gets ephemeral per-session MCP servers: `workspaceMcp.sessionOverlay` builds a session-owned manager for them (never persisted, invisible to the handler's other sessions, not gated by `workspaceTrust`), the session's `ISessionMcpHandle` seed carries a `session/mcp` `MergedMcpConnectionView` over the shared manager and the overlay (an ephemeral name shadows a workspace server for that session), and `sessionLifecycle` shuts the overlay down when the session handle disposes (backstopped by the lifecycle service's own dispose for teardown paths that bypass the handle wrapper). Agent profiles follow the Contribution / Registry / Catalog extension point instead of a workspace catalog: the `workspaceAgentProfileLoader` domain owns agent-file discovery end to end (parse / roots / SYSTEM.md / explicit runtime files) and its Workspace-scope loaders (`workspace` / `user` / `plugin` / `extra` / `explicit`) contribute `AgentProfileContribution` records to the collection via `this.provide`, tagged with the handler's `workspaceId`; the App-scope `IAgentProfileRegistry` is a fold over that collection (same-(sourceId, workspaceKey) later records shadow earlier ones, provider death withdraws; the App-scope `builtinAgentProfileLoader` contributes the code-defined profiles through an owned helper unit), and each Session-scope `sessionAgentProfileCatalog` projects the registry into the merged read view directly (name-level dedup + the builtin-override rule in the projection) — its seed carries only the workspace key. `workspaceTrust` records the per-workspace trust marker (persisted under the home, keyed by `encodeWorkDirKey(root)`); while untrusted, `workspaceMcpConfig` skips the project-level MCP config files (`.mcp.json`, `.kimi-code/mcp.json`). The trust state flips through kap-server's `GET|POST /workspaces/{id}/trust` + `POST /workspaces/{id}/untrust` routes. The old App-level session-lifecycle facade and `ISessionMcpService` / `ISessionFsService` are gone — compose `sessionIndex` → `workspaceLifecycle.handlerFor` → the handler instead. ## Units and contribution points (L3) @@ -13,7 +13,7 @@ The DI kernel (`src/_base/di/`) owns the unit layer on top of the scoped registr - `service.ts` — `Service`: the unit base class (extends `Disposable`). Capabilities live on `this` (`provide` / `effect` / `on` / `get` / `ref`, plus `name` / `state` / `config`). Two-phase construction: inside the ctor `provide`/`on`/`effect` buffer (writes only — `get`/`ref` throw, dependencies are constructor parameters); the kernel binds the runtime after `Reflect.construct` and flushes in writing order; a manually `new`ed instance throws on every capability call. Services whose own members collide with the `Service` vocabulary keep `extends Disposable` with a NOTE comment — still full DI units (cascade/ledger do not require `Service`). - `fiber.ts` — the `Fiber` capability interface (not a DI token), `FiberHandle` (thenable / `state` / `uid` / `update` / `dispose`), `ServiceRecipe` (class / arrow function / `{apply}`), the `FiberState` five-state machine, and `ScopeUnits(kind)` — the materialization collection token, one per scope kind. - `collection.ts` — `collection(name)` contribution tokens. Contribute with `this.provide(token, value)`; a fold declares the token as a constructor parameter and receives a `CollectionView` (`items` / `records` / incremental `onDidChange`). Records are visible to the provider's ancestors and descendants (never sibling subtrees); provider death withdraws. Collection edges enter the graph for introspection but never join a cascade contagion set. -- `scopeUnits.ts` — the kernel fold: every scope-creation point (`createScopedChildHandle` / `Scope.createApp` / `Scope.createChild`) runs `watchScopeUnits(container, kind)` before eager activation, materializing each visible `ScopeUnits(kind)` record's recipe as a unit inside the new scope (disposal hangs on the record provider's book — provider death tears the materialized units down across the tree). `ScopeOptions.assemble` runs at the same point (the session seed adapters use it). +- `scopeUnits.ts` — the kernel fold: every scope-creation point (`createScopedChildHandle` / `Scope.createApp` / `Scope.createChild`) runs `watchScopeUnits(container, kind)` before eager activation, materializing each visible `ScopeUnits(kind)` record's recipe as a unit inside the new scope (disposal hangs on the record provider's book — provider death tears the materialized units down across the tree). `ScopeOptions.configureContainer` runs at the same point (the session seed adapters use it). - `instantiation.ts` — the `@ref(IX)` decorator factory (`LiveRef`: `current` live read + `onDidChange` availability event; observation creates no binding and no graph edge) and `ScopeActivation`. - `src/app/feature/` — `IFeatureManager` (App scope): runtime unit assembly (`provideUnit` / `unprovideUnit` / `updateUnit`) and introspection (`units()` / `onDidChangeUnits`); managed units hang on the manager's own book. External package management stays with `IPluginService`. The `features` assembly (`src/features/featureAssemblyService.ts`) drains the module-level feature table through it. diff --git a/packages/agent-core-v2/src/_base/di/scope.ts b/packages/agent-core-v2/src/_base/di/scope.ts index 6d4d7272f3e..ced7a35f999 100644 --- a/packages/agent-core-v2/src/_base/di/scope.ts +++ b/packages/agent-core-v2/src/_base/di/scope.ts @@ -84,8 +84,8 @@ export type ScopeSeed = ReadonlyArray< export interface ScopeOptions { readonly id?: string; - readonly extra?: ScopeSeed; - readonly assemble?: (container: InstantiationService) => void; + readonly seeds?: ScopeSeed; + readonly configureContainer?: (container: InstantiationService) => void; } export interface IScopeHandle { @@ -100,10 +100,10 @@ export type IWorkspaceScopeHandle = IScopeHandle<'workspace'>; export type ISessionScopeHandle = IScopeHandle<'session'>; export type IAgentScopeHandle = IScopeHandle<'agent'>; -function buildCollection(extra?: ScopeSeed): ServiceCollection { +function buildCollection(seeds?: ScopeSeed): ServiceCollection { const collection = new ServiceCollection(); - if (extra) { - for (const [id, value] of extra) { + if (seeds) { + for (const [id, value] of seeds) { collection.set(id, value); } } @@ -137,12 +137,12 @@ export function createScopedChildHandle( id: string, options: ScopeOptions = {}, ): IScopeHandle { - const collection = buildCollection(options.extra); + const collection = buildCollection(options.seeds); const child = parent.createChild(collection); (child as InstantiationService).debugLabel = id; try { watchScopeUnits(child as InstantiationService, kind); - options.assemble?.(child as InstantiationService); + options.configureContainer?.(child as InstantiationService); provideScopeServices(child, kind, collection); } catch (error) { child.dispose(); @@ -189,12 +189,12 @@ export class Scope implements IDisposable { static createApp(options: ScopeOptions = {}): Scope { const kind: ScopeKind = 'app'; - const collection = buildCollection(options.extra); + const collection = buildCollection(options.seeds); const instantiation = new InstantiationService(collection, true); instantiation.debugLabel = options.id ?? 'app'; try { watchScopeUnits(instantiation, kind); - options.assemble?.(instantiation); + options.configureContainer?.(instantiation); provideScopeServices(instantiation, kind, collection); } catch (error) { instantiation.dispose(); @@ -223,12 +223,12 @@ export class Scope implements IDisposable { if (this.children.has(id)) { throw new Error(`Scope '${this.id}' already has a child with id '${id}'`); } - const collection = buildCollection(options.extra); + const collection = buildCollection(options.seeds); const childInstantiation = this.instantiation.createChild(collection); (childInstantiation as InstantiationService).debugLabel = id; try { watchScopeUnits(childInstantiation as InstantiationService, kind); - options.assemble?.(childInstantiation as InstantiationService); + options.configureContainer?.(childInstantiation as InstantiationService); provideScopeServices(childInstantiation, kind, collection); } catch (error) { childInstantiation.dispose(); diff --git a/packages/agent-core-v2/src/_base/di/test.ts b/packages/agent-core-v2/src/_base/di/test.ts index 11b332889d4..d861e71151a 100644 --- a/packages/agent-core-v2/src/_base/di/test.ts +++ b/packages/agent-core-v2/src/_base/di/test.ts @@ -23,14 +23,14 @@ export interface ScopedTestHost { } export function createScopedTestHost(appStubs: ScopeSeed = []): ScopedTestHost { - const app = createAppScope({ extra: appStubs }); + const app = createAppScope({ seeds: appStubs }); return { app, child(kind, id, stubs = []) { - return app.createChild(kind, id, { extra: stubs }); + return app.createChild(kind, id, { seeds: stubs }); }, childOf(parent, kind, id, stubs = []) { - return parent.createChild(kind, id, { extra: stubs }); + return parent.createChild(kind, id, { seeds: stubs }); }, dispose() { app.dispose(); diff --git a/packages/agent-core-v2/src/app/bootstrap/bootstrap.ts b/packages/agent-core-v2/src/app/bootstrap/bootstrap.ts index b80c1a00a02..f80aff2e1b9 100644 --- a/packages/agent-core-v2/src/app/bootstrap/bootstrap.ts +++ b/packages/agent-core-v2/src/app/bootstrap/bootstrap.ts @@ -155,7 +155,7 @@ export interface BootstrapResult { export function bootstrap(input: BootstrapInput, extraSeeds: ScopeSeed = []): BootstrapResult { const options = resolveBootstrapOptions(input); const app = createAppScope({ - extra: [...bootstrapSeed(input), ...storageSeed(options), ...skillSeed(), ...extraSeeds], + seeds: [...bootstrapSeed(input), ...storageSeed(options), ...skillSeed(), ...extraSeeds], }); return { app }; } diff --git a/packages/agent-core-v2/src/app/workspaceLifecycle/workspaceLifecycleService.ts b/packages/agent-core-v2/src/app/workspaceLifecycle/workspaceLifecycleService.ts index d9e082d4d26..16f7f72703b 100644 --- a/packages/agent-core-v2/src/app/workspaceLifecycle/workspaceLifecycleService.ts +++ b/packages/agent-core-v2/src/app/workspaceLifecycle/workspaceLifecycleService.ts @@ -134,7 +134,7 @@ export class WorkspaceLifecycleService extends Service implements IWorkspaceLife this.instantiation, LifecycleScope.Workspace, workspaceId, - { extra: workspaceContextSeed(ctx) }, + { seeds: workspaceContextSeed(ctx) }, ) as IWorkspaceScopeHandle; this.live.set(workspaceId, handle); this._onDidMaterializeHandler.fire(handle); diff --git a/packages/agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts b/packages/agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts index 6c7a0d6efe9..4ccbbdd6f55 100644 --- a/packages/agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts +++ b/packages/agent-core-v2/src/session/agentLifecycle/agentLifecycleService.ts @@ -151,7 +151,7 @@ export class AgentLifecycleService extends Disposable implements IAgentLifecycle LifecycleScope.Agent, agentId, { - extra: [ + seeds: [ [IAgentScopeContext, makeAgentScopeContext({ agentId, agentScope })], [ITelemetryService, this.telemetry.withContext({ agent_id: agentId })], ], diff --git a/packages/agent-core-v2/src/session/mcp/ephemeralMcpServers.ts b/packages/agent-core-v2/src/session/mcp/ephemeralMcpServers.ts new file mode 100644 index 00000000000..018adf7acfc --- /dev/null +++ b/packages/agent-core-v2/src/session/mcp/ephemeralMcpServers.ts @@ -0,0 +1,28 @@ +/** + * `mcp` domain — seeded ephemeral per-session MCP server configs. + * + * Defines `ISessionEphemeralMcpServers`, the pure-data injection contract + * carrying the session's ephemeral (caller-injected, never persisted) MCP + * server configs, copied verbatim from the session's creation options + * (`CreateSessionOptions.mcpServers` / `ResumeSessionOptions.mcpServers`). + * Always seeded into the Session scope by the session lifecycle (an empty + * record for ordinary sessions), so consumers can resolve it + * unconditionally. The contract carries no IO of its own — connecting the + * servers and projecting the resulting session handle is the + * Workspace-side MCP domain's concern, activated through the session + * lifecycle's `onWillCreateSession` event. Session-scoped. + */ + +import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; +import type { ScopeSeed } from '#/_base/di/scope'; +import type { McpServerConfig } from '#/mcpCore/config-schema'; + +export const ISessionEphemeralMcpServers: ServiceIdentifier< + Readonly> +> = createDecorator>>('sessionEphemeralMcpServers'); + +export function sessionEphemeralMcpServersSeed( + servers: Readonly>, +): ScopeSeed { + return [[ISessionEphemeralMcpServers as ServiceIdentifier, servers]]; +} diff --git a/packages/agent-core-v2/src/session/sessionSeed/sessionSeedAdapters.ts b/packages/agent-core-v2/src/session/sessionSeed/sessionSeedAdapters.ts index f0b15d7fbca..bd1c7968d55 100644 --- a/packages/agent-core-v2/src/session/sessionSeed/sessionSeedAdapters.ts +++ b/packages/agent-core-v2/src/session/sessionSeed/sessionSeedAdapters.ts @@ -23,14 +23,15 @@ * untouched. * * The units carry no DI token of their own: the session - * assembly point constructs them explicitly (`assembleSessionSeedAdapters`, - * the `assemble` hook of `createScopedChildHandle`) and anchors their + * assembly point constructs them explicitly (`installSessionSeedAdapters`, + * the `configureContainer` hook of `createScopedChildHandle`) and anchors their * disposal into the session container's ledger. Observation (`@ref`) is * data-flow semantics — an upstream rebuild re-fires `onDidChange` instead * of cascading this adapter down. A session created with ephemeral - * `mcpServers` passes its merged overlay handle as `sessionMcpHandle`: the - * MCP adapter is skipped and the overlay handle is provided directly (fixed - * at creation, like the pre-adapter inline seed). + * `mcpServers` (the `ISessionEphemeralMcpServers` seed) gets its + * `ISessionMcpHandle` from the `workspaceMcp` participant of the session + * lifecycle's `onWillCreateSession` event instead: its contribution lands + * after this adapter's provide and replaces the workspace projection. */ import type { ServiceClassRecipe } from '#/_base/di/fiber'; @@ -262,15 +263,8 @@ const SESSION_SEED_ADAPTERS: readonly ServiceClassRecipe[] = [ SessionToolPolicyGateAdapter, ]; -export function assembleSessionSeedAdapters( - container: InstantiationService, - sessionMcpHandle?: ISessionMcpHandle, -): void { +export function installSessionSeedAdapters(container: InstantiationService): void { for (const recipe of SESSION_SEED_ADAPTERS) { - if (recipe === SessionMcpHandleAdapter && sessionMcpHandle !== undefined) { - container.provide(ISessionMcpHandle, sessionMcpHandle); - continue; - } const adapter = container.fiberHost.constructService(recipe, undefined) as Partial; container.anchorKernelEntry(() => { adapter.dispose?.(); diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts index 017612c37a9..6808b46786d 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts @@ -14,6 +14,11 @@ * workspace and fork never crosses handlers. Announces lifecycle transitions * through `onDidCreateSession` / `onDidCloseSession` / `onDidArchiveSession` * / `onDidForkSession`; the ordered hook slots are per-session seeds. + * Workspace-scope services that must participate in a session's creation + * (read its seeded facts, contribute a session seed, attach teardown to its + * lifetime) subscribe to `onWillCreateSession` — the participation surface + * speaks the session domain's own vocabulary, so the lifecycle depends on + * neither its participants nor the DI kernel's assembly mechanics. * Workspace-scoped — one instance per materialized handler. */ @@ -94,9 +99,31 @@ export interface SessionForkedEvent { readonly handle: ISessionScopeHandle; } +/** + * Participation surface of `onWillCreateSession` — the business-lifecycle + * moment "a session is being created", fired synchronously before the new + * session's services activate (the `will` half of `onDidCreateSession`; + * resume and fork are creations too). Workspace-scope participants step + * into the creation through the session domain's own vocabulary — read the + * session's seeded facts (`readSeed`), contribute or replace a session seed + * (`contributeSeed`; a seed already projected by the workspace seed + * adapters is replaced), and attach teardown work to the session's lifetime + * (`onSessionDispose` — runs with the session's teardown on every path: + * close, archive, delete, a failed create, workspace teardown). The event + * carries only facts the lifecycle itself owns; anything a participant + * needs beyond them travels as a session-domain seed. + */ +export interface SessionWillCreateEvent { + readonly sessionId: string; + readSeed(id: ServiceIdentifier): T; + contributeSeed(id: ServiceIdentifier, value: T): void; + onSessionDispose(dispose: () => void): void; +} + export interface ISessionLifecycleService { readonly _serviceBrand: undefined; + readonly onWillCreateSession: Event; readonly onDidCreateSession: Event; readonly onDidCloseSession: Event; readonly onDidArchiveSession: Event; diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts index fb196abcaca..2eecd65f38d 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts @@ -25,7 +25,7 @@ * watching and connecting all live on the Workspace-scope services; session * consumers read the seeds and refresh off their change events. The five * workspace-projection seeds are provided by the seed-adapter units - * assembled with the scope (`assembleSessionSeedAdapters`), not by `extra`. + * installed with the scope (`installSessionSeedAdapters`), not by `extra`. * Materializes the session's initial metadata on * creation. Bound at Workspace scope. * Persisted sessions are discovered through the session-index read model. @@ -53,11 +53,13 @@ * returns — it connects fire-and-forget at Workspace scope, and the seeded * handle's `ready` promise lets the agent's LLM steps wait on it instead * (see `AgentMcpService`). A session created with ephemeral `mcpServers` - * additionally gets a session overlay from `workspaceMcp` (session-owned - * connections, seeded as a merged view, shut down when the session handle - * disposes — with a backstop in the service's own dispose for teardown - * paths that bypass the handle wrapper), likewise connected in the - * background. + * gets them seeded verbatim (`ISessionEphemeralMcpServers`); connecting + * them is the MCP domain's own concern — `workspaceMcp` subscribes to this + * service's `onWillCreateSession`, reads the session's seeds through the + * event's session-domain surface (`readSeed` / `contributeSeed` / + * `onSessionDispose`), contributes its session overlay handle, and attaches + * the overlay's shutdown to the session's teardown, so this service never + * depends on MCP. * The session-level services whose subscriptions * must exist before the first agent / turn (external hooks, cron, the * secondary-model startup warning) opt into `OnScopeCreated` activation. @@ -104,8 +106,9 @@ import { IAgentLifecycleService, MAIN_AGENT_ID } from '#/session/agentLifecycle/ import { ensureMainAgent } from '#/session/agentLifecycle/mainAgent'; import { labelsFromAgentMeta } from '#/session/agentLifecycle/subagentMetadata'; import { ISessionContext, sessionContextSeed } from '#/session/sessionContext/sessionContext'; +import { sessionEphemeralMcpServersSeed } from '#/session/mcp/ephemeralMcpServers'; import { sessionAgentProfileCatalogSeed } from '#/session/sessionAgentProfileCatalog/agentProfileCatalogSeed'; -import { assembleSessionSeedAdapters } from '#/session/sessionSeed/sessionSeedAdapters'; +import { installSessionSeedAdapters } from '#/session/sessionSeed/sessionSeedAdapters'; import { ISessionLifecycleHooks, sessionLifecycleHooksSeed, @@ -134,10 +137,6 @@ import { IWorkspaceAgentProfileLoader, } from '#/workspace/workspaceAgentProfileLoader/workspaceAgentProfileLoader'; import { IWorkspaceDirs } from '#/workspace/workspaceDirs/workspaceDirs'; -import { - IWorkspaceMcpService, - type ISessionMcpOverlay, -} from '#/workspace/workspaceMcp/workspaceMcp'; import { agentScopeOf, sessionDirOf, sessionScopeOf } from './internal/addressing'; import { @@ -150,6 +149,7 @@ import { type SessionCreatedEvent, type SessionForkedEvent, type SessionWillCloseEvent, + type SessionWillCreateEvent, ISessionLifecycleService, } from './sessionLifecycle'; @@ -161,6 +161,11 @@ type MaterializeSessionOptions = Omit & { export class SessionLifecycleService extends Disposable implements ISessionLifecycleService { declare readonly _serviceBrand: undefined; private readonly sessions = new Map(); + private readonly _onWillCreateSession = this._register( + new Emitter(), + ); + readonly onWillCreateSession: Event = + this._onWillCreateSession.event; private readonly _onDidCreateSession = this._register(new Emitter()); readonly onDidCreateSession: Event = this._onDidCreateSession.event; private readonly _onDidCloseSession = this._register(new Emitter()); @@ -170,14 +175,6 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec private readonly _onDidForkSession = this._register(new Emitter()); readonly onDidForkSession: Event = this._onDidForkSession.event; private readonly resuming = new Map>(); - /** - * Live per-session MCP overlays keyed by session id. The session handle's - * dispose removes its overlay here before shutting it down, so whatever - * remains at service teardown (the DI container disposes session scopes - * directly, bypassing the handle wrapper) is shut down from the - * service's own dispose instead — no overlay outlives the lifecycle. - */ - private readonly liveOverlays = new Map(); constructor( @IInstantiationService private readonly instantiation: IInstantiationService, @@ -203,21 +200,10 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec private readonly userAgentProfileLoader: IUserAgentProfileLoader, @IPluginAgentProfileLoader private readonly pluginAgentProfileLoader: IPluginAgentProfileLoader, - @IWorkspaceMcpService private readonly mcp: IWorkspaceMcpService, @IWorkspaceDirs private readonly workspaceDirs: IWorkspaceDirs, @ISessionProcessRunner private readonly processRunner: ISessionProcessRunner, ) { super(); - this._register({ - dispose: () => { - // Service teardown (e.g. workspace/root scope disposal) bypasses the - // per-session handle wrappers — shut down every overlay still live. - for (const overlay of this.liveOverlays.values()) { - void overlay.shutdown(); - } - this.liveOverlays.clear(); - }, - }); } private get workspaceId(): string { @@ -278,19 +264,12 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec 'onWillCloseSession', ]); await this.hostEnv.ready; - const mcpOverlay = - opts.mcpServers !== undefined && Object.keys(opts.mcpServers).length > 0 - ? this.mcp.sessionOverlay(opts.mcpServers, { stdioCwd: opts.workDir }) - : undefined; - if (mcpOverlay !== undefined) { - this.liveOverlays.set(opts.sessionId, mcpOverlay); - } - const scopeHandle = createScopedChildHandle( + const handle = createScopedChildHandle( this.instantiation, LifecycleScope.Session, opts.sessionId, { - extra: [ + seeds: [ ...sessionContextSeed(ctx), ...sessionLifecycleHooksSeed(hooks), [ITelemetryService, this.telemetry.withContext({ sessionId: opts.sessionId })], @@ -299,25 +278,26 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec workspaceKey: workspaceId, }), [ISessionProcessRunner, this.processRunner], + ...sessionEphemeralMcpServersSeed(opts.mcpServers ?? {}), ], - assemble: (container) => assembleSessionSeedAdapters(container, mcpOverlay?.handle), + configureContainer: (container) => { + installSessionSeedAdapters(container); + // The will-create moment is a business-lifecycle event; the DI + // container behind the participation surface stays this service's + // implementation detail. + this._onWillCreateSession.fire({ + sessionId: opts.sessionId, + readSeed: (id) => container.invokeFunction((accessor) => accessor.get(id)), + contributeSeed: (id, value) => { + container.provide(id, value); + }, + onSessionDispose: (dispose) => { + container.anchorKernelEntry(dispose, 'sessionLifecycle:willCreateParticipant'); + }, + }); + }, }, ) as ISessionScopeHandle; - const handle: ISessionScopeHandle = - mcpOverlay === undefined - ? scopeHandle - : { - ...scopeHandle, - dispose: () => { - // Delete-then-shutdown is atomic (single-threaded): the service - // teardown path only shuts down overlays still in the map, so a - // handle dispose and a service dispose can never double-shutdown. - if (this.liveOverlays.delete(opts.sessionId)) { - void mcpOverlay.shutdown(); - } - scopeHandle.dispose(); - }, - }; try { await handle.accessor.get(ISessionMetadata).ready; await handle.accessor.get(ISessionToolPolicy).ready; diff --git a/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcp.ts b/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcp.ts index 220e3eac57e..a95695a63c8 100644 --- a/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcp.ts +++ b/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcp.ts @@ -11,8 +11,10 @@ * (`sessionOverlay()`): a session-owned manager for those servers — never * persisted, never part of the config domain's effective set, invisible to * the handler's other sessions — presented to the session through a merged - * view, and released by the caller (`shutdown()`) when the session scope - * tears down. Ephemeral servers are a caller-explicit injection channel + * view. The service activates overlays itself from the session lifecycle's + * `onWillCreateSession` event (keyed by the `ISessionEphemeralMcpServers` + * seed) and attaches each overlay's `shutdown()` to the session's teardown. + * Ephemeral servers are a caller-explicit injection channel * (like the user-level `mcp.json`), so they are not gated by workspace * trust — only the project-level config files are. Bound at Workspace scope. */ diff --git a/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts b/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts index 6253a9bf4dd..efd515b62e1 100644 --- a/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts +++ b/packages/agent-core-v2/src/workspace/workspaceMcp/workspaceMcpService.ts @@ -21,8 +21,15 @@ * overlays (`sessionOverlay`): a session-owned manager for a session's * ephemeral (caller-injected, never persisted) servers — baseline members * by construction — presented through a - * `MergedMcpConnectionView` over the shared manager and shut down by the - * session lifecycle when the session scope tears down. An overlay handle's + * `MergedMcpConnectionView` over the shared manager. Overlay activation is + * event-driven: this service subscribes to the session lifecycle's + * `onWillCreateSession`, and a session created with an + * `ISessionEphemeralMcpServers` seed gets its overlay created there — the + * merged handle contributed as the session's `ISessionMcpHandle` (replacing + * the seed adapter's workspace projection), the overlay's shutdown attached + * to the session's teardown, so the session lifecycle never depends on MCP. + * The overlay's stdio cwd is read from the session's own `ISessionContext`. + * An overlay handle's * baseline still freezes on the workspace manager's initial load — never on * the overlay's own connect — so a slow ephemeral connect cannot reopen the * window for mid-session workspace additions. @@ -52,9 +59,12 @@ import { McpOAuthService } from '#/mcpCore/oauth/service'; import { IAgentIdentity } from '#/app/agentIdentity/agentIdentity'; import { IMcpOAuthStore } from '#/app/mcpConfig/oauthStore'; import { ITelemetryService } from '#/app/telemetry/telemetry'; +import { ISessionEphemeralMcpServers } from '#/session/mcp/ephemeralMcpServers'; import { MergedMcpConnectionView } from '#/session/mcp/mergedConnectionView'; -import type { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; +import { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { IWorkspaceContext } from '#/workspace/workspaceContext/workspaceContext'; +import { ISessionLifecycleService } from '#/workspace/sessionLifecycle/sessionLifecycle'; import { IWorkspaceMcpConfigService, type McpServersChange, @@ -83,6 +93,7 @@ export class WorkspaceMcpService extends Service implements IWorkspaceMcpService @ILogService private readonly log: ILogService, @ITelemetryService private readonly telemetry: ITelemetryService, @IAgentIdentity private readonly identity: IAgentIdentity, + @ISessionLifecycleService sessionLifecycle: ISessionLifecycleService, ) { super(); this.stdioCwd = workspace.cwd; @@ -103,6 +114,19 @@ export class WorkspaceMcpService extends Service implements IWorkspaceMcpService this.scheduleApply(change); }), ); + this._register( + sessionLifecycle.onWillCreateSession((event) => { + const servers = event.readSeed(ISessionEphemeralMcpServers); + if (Object.keys(servers).length === 0) return; + const overlay = this.sessionOverlay(servers, { + stdioCwd: event.readSeed(ISessionContext).cwd, + }); + event.contributeSeed(ISessionMcpHandle, overlay.handle); + event.onSessionDispose(() => { + void overlay.shutdown(); + }); + }), + ); this.ready = this.initialize().catch((error: unknown) => { this.log.error('mcp initial load failed', { error }); }); diff --git a/packages/agent-core-v2/test/_base/di/scope-tree.test.ts b/packages/agent-core-v2/test/_base/di/scope-tree.test.ts index 6e9290863e3..77c5b06d36d 100644 --- a/packages/agent-core-v2/test/_base/di/scope-tree.test.ts +++ b/packages/agent-core-v2/test/_base/di/scope-tree.test.ts @@ -159,7 +159,7 @@ describe('Scope tree', () => { app.dispose(); }); - it('extra seed injects a context token resolvable from that scope', () => { + it('seeds inject a context token resolvable from that scope', () => { interface ISessionContext { sessionId: string; } @@ -168,7 +168,7 @@ describe('Scope tree', () => { const app = createAppScope(); const session = app.createChild(LifecycleScope.Session, 's1', { - extra: [[ISessionContext as ServiceIdentifier, { sessionId: 's1' }]], + seeds: [[ISessionContext as ServiceIdentifier, { sessionId: 's1' }]], }); expect(session.accessor.get(ISessionContext).sessionId).toBe('s1'); expect(() => app.accessor.get(ISessionContext)).toThrow(); diff --git a/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts b/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts index ea7f41e7f5a..932b978ab97 100644 --- a/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts +++ b/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts @@ -351,7 +351,7 @@ describe('AgentToolActivationService', () => { function createScopeTree(agentExtra: ScopeSeed = []) { const app = createAppScope(); const session = app.createChild(LifecycleScope.Session, 'session', { - extra: [ + seeds: [ [ ISessionToolPolicyGate, { @@ -365,7 +365,7 @@ describe('AgentToolActivationService', () => { ], }); const agent = session.createChild(LifecycleScope.Agent, 'agent', { - extra: agentSeeds(agentExtra), + seeds: agentSeeds(agentExtra), }); return { app, session, agent }; } @@ -382,7 +382,7 @@ describe('AgentToolActivationService', () => { expect(registry.resolve('Beta')).toBeInstanceOf(BetaTool); const agent2 = session.createChild(LifecycleScope.Agent, 'agent-2', { - extra: agentSeeds(), + seeds: agentSeeds(), }); await agent2.accessor.get(IAgentToolActivationService).activate(); expect(agent2.accessor.get(IAgentToolRegistryService).resolve('Alpha')).toBeInstanceOf( diff --git a/packages/agent-core-v2/test/app/gateway/gateway.test.ts b/packages/agent-core-v2/test/app/gateway/gateway.test.ts index 2a3926cbca8..373beb8be5c 100644 --- a/packages/agent-core-v2/test/app/gateway/gateway.test.ts +++ b/packages/agent-core-v2/test/app/gateway/gateway.test.ts @@ -91,6 +91,7 @@ describe('RestGateway', () => { const sessionLifecycle: ISessionLifecycleService = { _serviceBrand: undefined, + onWillCreateSession: () => ({ dispose: () => {} }), onDidCreateSession: () => ({ dispose: () => {} }), onDidCloseSession: () => ({ dispose: () => {} }), onDidArchiveSession: () => ({ dispose: () => {} }), diff --git a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts index 34a49c143bb..2e2c9fd03e6 100644 --- a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts +++ b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts @@ -916,6 +916,7 @@ function registerSessionExportServices( ISessionLifecycleService, { _serviceBrand: undefined, + onWillCreateSession: noopEvent, onDidCreateSession: noopEvent, onDidCloseSession: noopEvent, onDidArchiveSession: noopEvent, diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index 7ea62b7c039..96c26962e27 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -1126,7 +1126,7 @@ export class AgentTestContext { this.serviceOverrides, 'app', ); - this.root = createAppScope({ extra: appSeeds }); + this.root = createAppScope({ seeds: appSeeds }); const initialConfig = this.root.accessor.get(IConfigService); this.root.accessor @@ -1149,7 +1149,7 @@ export class AgentTestContext { .withContext({ agent_id: agentId }); const sessionScope = `${bootstrap.scope('sessions')}/${workspaceId}/${sessionId}`; this.session = this.root.createChild(LifecycleScope.Session, sessionId, { - extra: collectScopeSeed( + seeds: collectScopeSeed( [ (reg) => { reg.defineInstance(ISessionContext, { @@ -1235,7 +1235,7 @@ export class AgentTestContext { const workspace = this.session.accessor.get(ISessionWorkspaceContext); this.agent = this.session.createChild(LifecycleScope.Agent, agentId, { - extra: collectScopeSeed( + seeds: collectScopeSeed( [ (reg) => { reg.defineDescriptor( diff --git a/packages/agent-core-v2/test/session/sessionSeed/sessionSeedAdapters.test.ts b/packages/agent-core-v2/test/session/sessionSeed/sessionSeedAdapters.test.ts index a899aa5f0df..5dcc44e398e 100644 --- a/packages/agent-core-v2/test/session/sessionSeed/sessionSeedAdapters.test.ts +++ b/packages/agent-core-v2/test/session/sessionSeed/sessionSeedAdapters.test.ts @@ -2,7 +2,7 @@ * sessionSeed adapters — unit tests over the real scope tree. * * Each adapter observes its workspace upstream through `@ref` and provides - * the Session-scope seed token during the scope's `assemble` hook. Covered + * the Session-scope seed token during the scope's `configureContainer` hook. Covered * per adapter: live reads across an upstream generation swap (getters never * serve a stale closure), `onDidChange` forwarding from the current backing * projection, the re-fire on upstream availability change (switch backing @@ -27,7 +27,7 @@ import type { SkillCatalog } from '#/app/skillCatalog/types'; import type { McpConnectionManager } from '#/mcpCore/connection-manager'; import { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; import { ISessionInstructionsProvider } from '#/session/sessionInstructions/instructionsProvider'; -import { assembleSessionSeedAdapters } from '#/session/sessionSeed/sessionSeedAdapters'; +import { installSessionSeedAdapters } from '#/session/sessionSeed/sessionSeedAdapters'; import { ISessionSkillCatalogData } from '#/session/sessionSkillCatalog/skillCatalogData'; import { ISessionToolPolicyGate } from '#/session/sessionToolPolicyGate/sessionToolPolicyGate'; import { NoopSessionToolPolicyGate } from '#/session/sessionToolPolicyGate/sessionToolPolicyGateService'; @@ -234,10 +234,10 @@ describe('sessionSeed adapters', () => { function buildSession(workspaceStubs: ScopeSeed): { workspace: Scope; session: Scope } { host = createScopedTestHost(); const workspace = host.app.createChild(LifecycleScope.Workspace, 'ws', { - extra: workspaceStubs, + seeds: workspaceStubs, }); const session = workspace.createChild(LifecycleScope.Session, 's1', { - assemble: assembleSessionSeedAdapters, + configureContainer: installSessionSeedAdapters, }); return { workspace, session }; } diff --git a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts index eb024c0ebe4..a848c9521b0 100644 --- a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts +++ b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts @@ -28,6 +28,7 @@ import { MAIN_AGENT_ID, } from '#/session/agentLifecycle/agentLifecycle'; import type { McpConnectionManager } from '#/mcpCore/connection-manager'; +import type { McpServerConfig } from '#/mcpCore/config-schema'; import { IWorkspaceSkillCatalog } from '#/workspace/workspaceSkillCatalog/workspaceSkillCatalog'; import { IWorkspaceAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoader/workspaceAgentProfileLoader'; import { IExtraAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoader/extraAgentProfileLoader'; @@ -37,7 +38,7 @@ import { IPluginAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoad import { IWorkspaceDirs } from '#/workspace/workspaceDirs/workspaceDirs'; import { WorkspaceDirsService } from '#/workspace/workspaceDirs/workspaceDirsService'; import { IWorkspaceInstructionsService } from '#/workspace/workspaceInstructions/workspaceInstructions'; -import { IWorkspaceMcpService, type ISessionMcpOverlay } from '#/workspace/workspaceMcp/workspaceMcp'; +import { IWorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcp'; import { IAgentPlanService } from '#/features/plan/plan'; import { ISessionCronService } from '#/session/cron/sessionCronService'; import { ISessionSecondaryModelWarningService } from '#/session/subagent/secondaryModelWarning'; @@ -75,6 +76,7 @@ import { WorkspaceStateService } from '#/workspace/state/workspaceStateService'; import { IWorkspaceService, type Workspace } from '#/app/workspace/workspace'; import { encodeWorkDirKey } from '#/_base/utils/workdir-slug'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionEphemeralMcpServers } from '#/session/mcp/ephemeralMcpServers'; import { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import { Error2, ErrorCodes } from '#/errors'; @@ -1172,148 +1174,147 @@ describe('SessionLifecycleService', () => { resolveMcpReady?.(); }); - function overlayStub(ready: Promise = Promise.resolve()) { - const handle: ISessionMcpHandle = { + it('create with mcpServers fires the will-create event with the ephemeral servers seed and applies participant contributions', async () => { + const mcpServers = { eph: { transport: 'stdio' as const, command: 'node' } }; + const contributed: ISessionMcpHandle = { _serviceBrand: undefined, - ready, + ready: Promise.resolve(), connectionManager: {} as unknown as McpConnectionManager, isBaselineServer: () => true, }; - const shutdown = vi.fn(() => Promise.resolve()); - const sessionOverlay = vi.fn( - (..._args: Parameters): ISessionMcpOverlay => ({ - handle, - shutdown, - }), - ); - return { sessionOverlay, handle, shutdown }; - } - - it('create with mcpServers seeds the session overlay handle and shuts the overlay down on close', async () => { - const { sessionOverlay, handle: overlayHandle, shutdown } = overlayStub(); - const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), - ]); - const mcpServers = { eph: { transport: 'stdio' as const, command: 'node' } }; + const seen: Array<{ + sessionId: string; + servers: Readonly>; + cwd: string; + }> = []; + const svc = await build(); + svc.onWillCreateSession((event) => { + const servers = event.readSeed(ISessionEphemeralMcpServers); + const cwd = event.readSeed(ISessionContext).cwd; + seen.push({ sessionId: event.sessionId, servers, cwd }); + if (Object.keys(servers).length > 0) { + event.contributeSeed(ISessionMcpHandle, contributed); + } + }); const handle = await svc.create({ sessionId: 's1', workDir: '/tmp/proj', mcpServers }); - expect(sessionOverlay).toHaveBeenCalledWith(mcpServers, { stdioCwd: '/tmp/proj' }); - expect(handle.accessor.get(ISessionMcpHandle)).toBe(overlayHandle); - - await svc.close('s1'); - expect(shutdown).toHaveBeenCalledTimes(1); + expect(seen).toEqual([{ sessionId: 's1', servers: mcpServers, cwd: '/tmp/proj' }]); + expect(handle.accessor.get(ISessionMcpHandle)).toBe(contributed); }); - it('resume with mcpServers seeds the session overlay handle on the re-materialized session', async () => { - const { sessionOverlay, handle: overlayHandle } = overlayStub(); + it('resume with mcpServers fires the will-create event for the re-materialized session', async () => { + const mcpServers = { eph: { transport: 'stdio' as const, command: 'node' } }; + const seen: Array>> = []; const svc = await build([ stubPair(ISessionIndex, sessionIndexWithSummary('s1', '/tmp/proj', 'wd_stub')), stubPair(IAgentLifecycleService, agentLifecycleWithMainStub()), - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), ]); - const mcpServers = { eph: { transport: 'stdio' as const, command: 'node' } }; + svc.onWillCreateSession((event) => { + seen.push(event.readSeed(ISessionEphemeralMcpServers)); + }); const handle = await svc.resume('s1', { mcpServers }); - expect(sessionOverlay).toHaveBeenCalledWith(mcpServers, { stdioCwd: '/tmp/proj' }); - expect(handle?.accessor.get(ISessionMcpHandle)).toBe(overlayHandle); + expect(handle).toBeDefined(); + expect(seen).toEqual([mcpServers]); }); - it('returns from create without waiting for the session MCP overlay readiness', async () => { - let resolveOverlayReady: (() => void) | undefined; - const overlayReady = new Promise((resolve) => { - resolveOverlayReady = resolve; + it('returns from create without waiting on a participant-provided session MCP handle', async () => { + let resolveReady: (() => void) | undefined; + const ready = new Promise((resolve) => { + resolveReady = resolve; }); - const { sessionOverlay } = overlayStub(overlayReady); - const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), - ]); - - // Create resolves while the overlay's initial connect is still pending; - // the seeded handle carries the readiness promise so the agent's LLM - // steps can wait on it instead. - const handle = await svc.create({ - sessionId: 's1', - workDir: '/tmp/proj', - mcpServers: { eph: { transport: 'stdio', command: 'node' } }, + const contributed: ISessionMcpHandle = { + _serviceBrand: undefined, + ready, + connectionManager: {} as unknown as McpConnectionManager, + isBaselineServer: () => true, + }; + const svc = await build(); + svc.onWillCreateSession((event) => { + event.contributeSeed(ISessionMcpHandle, contributed); }); - expect(handle.accessor.get(ISessionMcpHandle).ready).toBe(overlayReady); - resolveOverlayReady?.(); + // Create resolves while the contributed handle's readiness is still + // pending; the seeded handle carries the readiness promise so the agent's + // LLM steps can wait on it instead. + const handle = await svc.create({ sessionId: 's1', workDir: '/tmp/proj' }); + expect(handle.accessor.get(ISessionMcpHandle).ready).toBe(ready); + + resolveReady?.(); }); - it('shuts the session MCP overlay down when create fails after materialization', async () => { - const { sessionOverlay, shutdown } = overlayStub(); + it('runs participant-attached teardown when create fails after materialization', async () => { + const onTeardown = vi.fn(); const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), stubPair(IAgentLifecycleService, { ...agentLifecycleStub(), create: () => Promise.reject(new Error('Unknown agent profile')), }), ]); + svc.onWillCreateSession((event) => { + event.onSessionDispose(onTeardown); + }); await expect( svc.create({ sessionId: 's1', workDir: '/tmp/proj', mainAgentBinding: { profile: 'missing', model: 'mock' }, - mcpServers: { eph: { transport: 'stdio', command: 'node' } }, }), ).rejects.toThrow('Unknown agent profile'); - expect(shutdown).toHaveBeenCalledTimes(1); + expect(onTeardown).toHaveBeenCalledTimes(1); expect(svc.get('s1')).toBeUndefined(); }); - it('shuts the session MCP overlay down when the service is disposed with the session still live', async () => { - const { sessionOverlay, shutdown } = overlayStub(); - const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), - ]); - await svc.create({ - sessionId: 's1', - workDir: '/tmp/proj', - mcpServers: { eph: { transport: 'stdio' as const, command: 'node' } }, + it('runs participant-attached teardown on close, exactly once across close and host disposal', async () => { + const onTeardown = vi.fn(); + const svc = await build(); + svc.onWillCreateSession((event) => { + event.onSessionDispose(onTeardown); }); + await svc.create({ sessionId: 's1', workDir: '/tmp/proj' }); - // No close: app/workspace teardown disposes the service directly, and the - // DI container disposes session scopes without going through the - // overlay-aware handle wrapper. - (svc as unknown as { dispose(): void }).dispose(); - expect(shutdown).toHaveBeenCalledTimes(1); + await svc.close('s1'); + expect(onTeardown).toHaveBeenCalledTimes(1); + + // Host teardown disposes the workspace (and therefore session) container + // directly; the attached teardown has already run and must not run again. + host?.dispose(); + await Promise.resolve(); + expect(onTeardown).toHaveBeenCalledTimes(1); }); - it('does not double-shutdown the overlay when close and service disposal both run', async () => { - const { sessionOverlay, shutdown } = overlayStub(); - const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), - ]); - await svc.create({ - sessionId: 's1', - workDir: '/tmp/proj', - mcpServers: { eph: { transport: 'stdio' as const, command: 'node' } }, + it('runs participant-attached teardown when the host is disposed with the session still live', async () => { + const onTeardown = vi.fn(); + const svc = await build(); + svc.onWillCreateSession((event) => { + event.onSessionDispose(onTeardown); }); + await svc.create({ sessionId: 's1', workDir: '/tmp/proj' }); - await svc.close('s1'); - (svc as unknown as { dispose(): void }).dispose(); - expect(shutdown).toHaveBeenCalledTimes(1); + // No close: app/workspace teardown disposes the session scope directly, + // and the attached teardown runs with it. + host?.dispose(); + await Promise.resolve(); + expect(onTeardown).toHaveBeenCalledTimes(1); }); - it('create without mcpServers keeps the shared workspace handle and builds no overlay', async () => { - const sessionOverlay = vi.fn( - (..._args: Parameters): ISessionMcpOverlay => { - throw new Error('unexpected overlay'); - }, - ); - const svc = await build([ - stubPair(IWorkspaceMcpService, { ...workspaceMcpServiceStub(), sessionOverlay }), - ]); + it('create without mcpServers fires the will-create event with an empty ephemeral seed and keeps the workspace handle', async () => { + const svc = await build(); + const seen: Array>> = []; + svc.onWillCreateSession((event) => { + seen.push(event.readSeed(ISessionEphemeralMcpServers)); + }); const handle = await svc.create({ sessionId: 's1', workDir: '/tmp/proj' }); - expect(sessionOverlay).not.toHaveBeenCalled(); - expect(handle.id).toBe('s1'); + expect(seen).toEqual([{}]); + // No participant contributed a handle: the session reads the workspace + // projection provided by the seed adapter. + expect(handle.accessor.get(ISessionMcpHandle).isBaselineServer('any')).toBe(true); await svc.close('s1'); }); diff --git a/packages/agent-core-v2/test/workspace/workspaceMcp/initialization.test.ts b/packages/agent-core-v2/test/workspace/workspaceMcp/initialization.test.ts index c00aa152b2d..0e20593f80e 100644 --- a/packages/agent-core-v2/test/workspace/workspaceMcp/initialization.test.ts +++ b/packages/agent-core-v2/test/workspace/workspaceMcp/initialization.test.ts @@ -37,6 +37,10 @@ import { } from '#/os/interface/hostFsWatch'; import { IWorkspaceContext } from '#/workspace/workspaceContext/workspaceContext'; import { IWorkspaceTrust } from '#/workspace/workspaceTrust/workspaceTrust'; +import { + ISessionLifecycleService, + type SessionWillCreateEvent, +} from '#/workspace/sessionLifecycle/sessionLifecycle'; import { IWorkspaceMcpConfigService } from '#/workspace/workspaceMcpConfig/workspaceMcpConfig'; import { WorkspaceMcpConfigService } from '#/workspace/workspaceMcpConfig/workspaceMcpConfigService'; import { IWorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcp'; @@ -104,6 +108,9 @@ describe('Workspace MCP initialization', () => { onDidChange: Event.None as IWorkspaceTrust['onDidChange'], }); reg.define(IWorkspaceMcpConfigService, WorkspaceMcpConfigService); + reg.definePartialInstance(ISessionLifecycleService, { + onWillCreateSession: Event.None as Event, + }); registerAgentIdentityStub(reg); reg.define(IWorkspaceMcpService, WorkspaceMcpService); }, diff --git a/packages/agent-core-v2/test/workspace/workspaceMcp/workspaceMcp.test.ts b/packages/agent-core-v2/test/workspace/workspaceMcp/workspaceMcp.test.ts index 0815fdd811b..cf41af00e42 100644 --- a/packages/agent-core-v2/test/workspace/workspaceMcp/workspaceMcp.test.ts +++ b/packages/agent-core-v2/test/workspace/workspaceMcp/workspaceMcp.test.ts @@ -18,20 +18,28 @@ import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vite import { DisposableStore } from '#/_base/di/lifecycle'; import { createServices } from '#/_base/di/test'; +import type { ServiceIdentifier } from '#/_base/di/instantiation'; import { Emitter } from '#/_base/event'; import { ILogService } from '#/_base/log/log'; import { McpConnectionManager } from '#/mcpCore/connection-manager'; import type { McpServerConfig } from '#/mcpCore/config-schema'; +import { ISessionEphemeralMcpServers } from '#/session/mcp/ephemeralMcpServers'; import { MergedMcpConnectionView } from '#/session/mcp/mergedConnectionView'; +import { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; +import { ISessionContext, makeSessionContext } from '#/session/sessionContext/sessionContext'; import { IMcpOAuthStore } from '#/app/mcpConfig/oauthStore'; import { ITelemetryService, noopTelemetryService } from '#/app/telemetry/telemetry'; import { IWorkspaceContext } from '#/workspace/workspaceContext/workspaceContext'; +import { + ISessionLifecycleService, + type SessionWillCreateEvent, +} from '#/workspace/sessionLifecycle/sessionLifecycle'; import { IWorkspaceMcpConfigService, type McpServersChange, type McpTunables, } from '#/workspace/workspaceMcpConfig/workspaceMcpConfig'; -import { IWorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcp'; +import { IWorkspaceMcpService, type ISessionMcpOverlay } from '#/workspace/workspaceMcp/workspaceMcp'; import { WorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcpService'; import { stubLog } from '../../_base/log/stubs'; @@ -49,6 +57,7 @@ describe('WorkspaceMcpService', () => { let tunablesValue: McpTunables; let tunablesFn: Mock<() => McpTunables>; let configChanges: Emitter; + let assemblyEvents: Emitter; let manager: InstanceType | undefined; beforeEach(() => { @@ -58,6 +67,7 @@ describe('WorkspaceMcpService', () => { tunablesValue = {}; tunablesFn = vi.fn(() => tunablesValue); configChanges = new Emitter(); + assemblyEvents = disposables.add(new Emitter()); manager = undefined; }); @@ -87,6 +97,9 @@ describe('WorkspaceMcpService', () => { reg.definePartialInstance(IMcpOAuthStore, createMemoryMcpOAuthStore()); reg.defineInstance(ILogService, stubLog()); reg.defineInstance(ITelemetryService, noopTelemetryService); + reg.definePartialInstance(ISessionLifecycleService, { + onWillCreateSession: assemblyEvents.event, + }); registerAgentIdentityStub(reg); reg.define(IWorkspaceMcpService, WorkspaceMcpService); }, @@ -295,6 +308,79 @@ describe('WorkspaceMcpService', () => { expect(view.get('eph')).toBeUndefined(); expect(view.get('base')?.status).toBe('connected'); }, 20000); + + describe('session overlay activation (onWillCreateSession)', () => { + function willCreateEvent(servers: Record, sessionCwd: string) { + const seeds = new Map([ + [ISessionEphemeralMcpServers, servers], + [ + ISessionContext, + makeSessionContext({ + sessionId: 's1', + workspaceId: 'ws', + sessionDir: join(cwd, 's1'), + sessionScope: 'ws/s1', + cwd: sessionCwd, + }), + ], + ]); + const contributed = new Map(); + const disposers: Array<() => void> = []; + const event: SessionWillCreateEvent = { + sessionId: 's1', + readSeed: (id: ServiceIdentifier): T => seeds.get(id) as T, + contributeSeed: (id, value) => { + contributed.set(id, value); + }, + onSessionDispose: (dispose) => { + disposers.push(dispose); + }, + }; + return { event, contributed, disposers }; + } + + it('creates the overlay from the will-create event, contributes the merged handle, and shuts it down with the session', async () => { + const service = createService(); + manager = service.connectionManager(); + await service.ready; + + // A real, spawnable session cwd distinct from the workspace root. + const sessionCwd = mkdtempSync(join(tmpdir(), 'kimi-session-mcp-cwd-')); + const servers = { eph: stdioServer() }; + const sessionOverlay = vi.spyOn(service, 'sessionOverlay'); + const { event, contributed, disposers } = willCreateEvent(servers, sessionCwd); + assemblyEvents.fire(event); + + // The ephemeral servers come from the session seed and the stdio cwd + // from the session's own context — the lifecycle event carries neither. + expect(sessionOverlay).toHaveBeenCalledWith(servers, { stdioCwd: sessionCwd }); + const overlay = sessionOverlay.mock.results[0]?.value as ISessionMcpOverlay; + expect(contributed.get(ISessionMcpHandle)).toBe(overlay.handle); + await overlay.handle.ready; + expect(overlay.handle.connectionManager.get('eph')?.status).toBe('connected'); + + const shutdown = vi.spyOn(overlay, 'shutdown'); + expect(disposers).toHaveLength(1); + disposers[0]!(); + expect(shutdown).toHaveBeenCalledTimes(1); + await shutdown.mock.results[0]?.value; + await rm(sessionCwd, { recursive: true, force: true }); + }, 20000); + + it('ignores a session created without ephemeral servers', async () => { + const service = createService(); + manager = service.connectionManager(); + await service.ready; + + const sessionOverlay = vi.spyOn(service, 'sessionOverlay'); + const { event, contributed, disposers } = willCreateEvent({}, cwd); + assemblyEvents.fire(event); + + expect(sessionOverlay).not.toHaveBeenCalled(); + expect(contributed.size).toBe(0); + expect(disposers).toHaveLength(0); + }); + }); }); describe('MergedMcpConnectionView', () => { From 71ff2a0fffb2ebf399194436ef2d4b599c9988ad Mon Sep 17 00:00:00 2001 From: Haozhe Date: Tue, 11 Aug 2026 12:53:52 +0800 Subject: [PATCH 03/50] fix(kimi-code): close pre-trust-gate bare command resolution on Windows (#2695) On Windows, cmd.exe / CreateProcess resolve a bare command name from the current directory before PATH. Several startup-path child processes ran before the workspace trust prompt, so a binary planted in an untrusted workspace (stty.exe, npm.cmd, fd.exe) could execute before the user confirmed trust. - skip the POSIX-only stty save/restore entirely on win32 - defer fd detection from the KimiTUI field initializer to startBackgroundFdAutocomplete(), which runs after the trust gate - add resolveCommandPath(): resolve commands through PATH (PATHEXT-aware on win32) to an absolute path and refuse hits inside the cwd - route update-preflight package-manager spawns and the npm global-prefix probe through it - run the workspace trust prompt before the migration branch as well, closing the blind spot where a pending ~/.kimi migration skipped it - document the no-bare-command-before-trust-gate rule in apps/kimi-code/AGENTS.md --- .../windows-bare-command-binary-planting.md | 5 + apps/kimi-code/AGENTS.md | 1 + apps/kimi-code/src/cli/run-shell.ts | 27 ++-- apps/kimi-code/src/cli/update/preflight.ts | 32 +++- apps/kimi-code/src/cli/update/source.ts | 14 +- apps/kimi-code/src/tui/kimi-tui.ts | 28 +++- .../src/utils/process/resolve-command.ts | 79 ++++++++++ apps/kimi-code/test/cli/run-shell.test.ts | 20 ++- .../test/cli/update/preflight.test.ts | 74 ++++++++- apps/kimi-code/test/cli/update/source.test.ts | 22 ++- .../test/tui/kimi-tui-startup.test.ts | 73 +++++++++ .../utils/process/resolve-command.test.ts | 147 ++++++++++++++++++ 12 files changed, 498 insertions(+), 24 deletions(-) create mode 100644 .changeset/windows-bare-command-binary-planting.md create mode 100644 apps/kimi-code/src/utils/process/resolve-command.ts create mode 100644 apps/kimi-code/test/utils/process/resolve-command.test.ts diff --git a/.changeset/windows-bare-command-binary-planting.md b/.changeset/windows-bare-command-binary-planting.md new file mode 100644 index 00000000000..6c29f6026fd --- /dev/null +++ b/.changeset/windows-bare-command-binary-planting.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix a Windows binary-planting risk: child processes spawned by bare command name before the workspace trust prompt (stty, fd detection, package-manager update installs) could resolve to a malicious executable placed in the current directory. These commands are now skipped on Windows, deferred until after the trust prompt, or resolved to an absolute PATH location with hits inside the current directory refused. diff --git a/apps/kimi-code/AGENTS.md b/apps/kimi-code/AGENTS.md index 11184d9588d..857dc09e930 100644 --- a/apps/kimi-code/AGENTS.md +++ b/apps/kimi-code/AGENTS.md @@ -65,6 +65,7 @@ The theme apply/switch mechanics live in the `write-tui` skill. The following ru ## General Coding Requirements +- The startup path before the workspace trust gate (`KimiTUI.start()` -> `maybeRunWorkspaceTrustPrompt()`) must not spawn child processes by bare command name — on Windows, cmd.exe / CreateProcess resolve them from the current directory first, so a binary planted in an untrusted workspace would run before the user confirms trust. When an external command is unavoidable, resolve it with `resolveCommandPath` from `src/utils/process/resolve-command.ts`, which returns an absolute PATH hit and refuses matches inside the cwd. - For optional object properties, pass `undefined` directly — do not use conditional spread. - Optional object properties do not need to additionally allow `undefined` in the type. - Internal methods with only a single parameter should not be turned into options objects just for stylistic uniformity. diff --git a/apps/kimi-code/src/cli/run-shell.ts b/apps/kimi-code/src/cli/run-shell.ts index 3d6c741cebd..d7a13cb7567 100644 --- a/apps/kimi-code/src/cli/run-shell.ts +++ b/apps/kimi-code/src/cli/run-shell.ts @@ -155,17 +155,22 @@ export async function runShell( }; let savedStty: string | undefined; - try { - // stty operates on the terminal behind stdin, so stdin must be the TTY — - // piping /dev/null (ignore) makes stty fail with "not a tty". - const saved = execSync('stty -g', { - encoding: 'utf8', - stdio: ['inherit', 'pipe', 'ignore'], - }); - savedStty = typeof saved === 'string' ? saved.trim() : undefined; - execSync('stty -ixon', { stdio: ['inherit', 'ignore', 'ignore'] }); - } catch { - /* ignore */ + // stty is a POSIX command and never works on Windows; skip it there instead + // of relying on the catch — a bare command name would resolve a planted + // `stty.exe` from the current directory before the workspace trust gate. + if (process.platform !== 'win32') { + try { + // stty operates on the terminal behind stdin, so stdin must be the TTY — + // piping /dev/null (ignore) makes stty fail with "not a tty". + const saved = execSync('stty -g', { + encoding: 'utf8', + stdio: ['inherit', 'pipe', 'ignore'], + }); + savedStty = typeof saved === 'string' ? saved.trim() : undefined; + execSync('stty -ixon', { stdio: ['inherit', 'ignore', 'ignore'] }); + } catch { + /* ignore */ + } } const restoreStty = (): void => { if (savedStty === undefined) return; diff --git a/apps/kimi-code/src/cli/update/preflight.ts b/apps/kimi-code/src/cli/update/preflight.ts index 098899035c6..5bcad7c9bfc 100644 --- a/apps/kimi-code/src/cli/update/preflight.ts +++ b/apps/kimi-code/src/cli/update/preflight.ts @@ -9,6 +9,7 @@ import { NATIVE_INSTALL_COMMAND_WIN, } from '#/constant/app'; import { loadTuiConfig } from '#/tui/config'; +import { resolveCommandPath } from '#/utils/process/resolve-command'; import { readUpdateCache } from './cache'; import { tryAcquireUpdateInstallLock } from './install-lock'; @@ -142,6 +143,21 @@ function formatErrorMessage(error: unknown): string { return error instanceof Error ? error.message : String(error); } +/** + * Resolve a spawn target from `spawnForSource` to an absolute executable path + * via PATH, refusing hits inside the current working directory: the update + * preflight runs before the workspace trust gate, so a package-manager binary + * planted in an untrusted workspace must never be executed. On win32 the + * resolved path is quoted because the spawn goes through cmd.exe (shell: + * true) and paths like `C:\Program Files\...` would otherwise split. Returns + * undefined when the command cannot be safely resolved. + */ +function resolveSpawnCommand(cmd: string, platform: NodeJS.Platform): string | undefined { + const resolved = resolveCommandPath(cmd); + if (resolved === undefined) return undefined; + return platform === 'win32' ? `"${resolved}"` : resolved; +} + const THIRD_PARTY_SOURCE_NOTE = '\nNote: Third-party sources may lag behind the official release.\n' + `For the latest updates, use the official installer: ${KIMI_CODE_OFFICIAL_INSTALL_URL}\n`; @@ -493,12 +509,16 @@ export async function installUpdate( platform: NodeJS.Platform, ): Promise { const { cmd, args } = spawnForSource(source, version, platform); + const resolvedCmd = resolveSpawnCommand(cmd, platform); + if (resolvedCmd === undefined) { + throw new Error(`${cmd} was not found in PATH; cannot install the update`); + } await new Promise((resolve, reject) => { // Windows package managers (npm/pnpm/yarn) are .cmd shims. Since the // CVE-2024-27980 fix, Node throws EINVAL when spawning a .cmd/.bat without // a shell, so run through the shell on win32. The version is a validated // semver and the package name is a constant, so args are shell-safe. - const child = spawn(cmd, [...args], { + const child = spawn(resolvedCmd, [...args], { stdio: 'inherit', shell: platform === 'win32' ? true : undefined, }); @@ -609,7 +629,15 @@ async function startBackgroundInstall( }); }; - const child = spawn(cmd, [...args], { + const resolvedCmd = resolveSpawnCommand(cmd, platform); + if (resolvedCmd === undefined) { + // The package manager cannot be resolved to an absolute path outside + // the cwd — record a normal install failure instead of spawning a bare + // command name that Windows would resolve into the untrusted workspace. + finish(false); + return; + } + const child = spawn(resolvedCmd, [...args], { detached: true, stdio: 'ignore', shell: platform === 'win32' ? true : undefined, diff --git a/apps/kimi-code/src/cli/update/source.ts b/apps/kimi-code/src/cli/update/source.ts index 7d6904b673b..464e3231864 100644 --- a/apps/kimi-code/src/cli/update/source.ts +++ b/apps/kimi-code/src/cli/update/source.ts @@ -4,6 +4,7 @@ import { createRequire } from 'node:module'; import { join, resolve } from 'node:path'; import { getHostPackageRoot } from '#/cli/version'; +import { resolveCommandPath } from '#/utils/process/resolve-command'; import { NPM_PACKAGE_NAME, type InstallSource } from './types'; @@ -76,6 +77,17 @@ function npmCommand(platform: NodeJS.Platform): string { return platform === 'win32' ? 'npm.cmd' : 'npm'; } +// The install-source detection runs before the workspace trust gate, so the +// npm binary must be resolved through PATH to an absolute path — a bare name +// would let cmd.exe pick up an `npm.cmd` planted in the current directory. +function npmGlobalPrefix(platform: NodeJS.Platform): Promise { + const resolved = resolveCommandPath(npmCommand(platform)); + if (resolved === undefined) { + return Promise.reject(new Error('npm was not found in PATH')); + } + return execFileText(resolved, ['prefix', '-g']).then((text) => text.trim()); +} + function execFileText(command: string, args: readonly string[]): Promise { return new Promise((resolveOutput, reject) => { execFile(command, [...args], { encoding: 'utf-8' }, (error, stdout) => { @@ -140,7 +152,7 @@ export async function detectInstallSource( getPackageRoot: deps.getPackageRoot ?? getHostPackageRoot, getGlobalPrefix: deps.getGlobalPrefix ?? - (() => execFileText(npmCommand(platform), ['prefix', '-g']).then((text) => text.trim())), + (() => npmGlobalPrefix(platform)), detectNative: deps.detectNative ?? detectNativeInstall, platform, }; diff --git a/apps/kimi-code/src/tui/kimi-tui.ts b/apps/kimi-code/src/tui/kimi-tui.ts index 7c118e57a3d..c1254bce89c 100644 --- a/apps/kimi-code/src/tui/kimi-tui.ts +++ b/apps/kimi-code/src/tui/kimi-tui.ts @@ -327,7 +327,10 @@ export class KimiTUI { private pluginCommands: readonly KimiSlashCommand[] = []; readonly pluginCommandMap = new Map(); private readonly imageStore = new ImageAttachmentStore(); - private fdPath: string | null = detectFdPath(); + // Detected lazily in startBackgroundFdAutocomplete() — detection spawns + // `fd --version`, which must not happen before the workspace trust gate: + // on Windows a bare command name resolves into the (untrusted) cwd first. + private fdPath: string | null = null; private fdDownloadStarted = false; sessionEventUnsubscribe: (() => void) | undefined; cancelInFlight: (() => void) | undefined; @@ -586,9 +589,19 @@ export class KimiTUI { this.registerSignalHandlers(); // Outer try rolls back signal listeners on startup failure. try { + // The workspace trust gate must run before anything else in startup — + // including the migration branch: a workspace that needs migration is + // not implicitly trusted, and later startup steps spawn child processes. + startupTrace('trustPrompt:begin'); + const trustPromptStartedLoop = await this.maybeRunWorkspaceTrustPrompt(); + startupTrace('trustPrompt:end'); + if (this.migrationPlan !== null) { // Migration needs the event loop running first (pi-tui component). - this.startEventLoop(); + // When the trust prompt already started it, starting it again would + // re-run pi-tui's terminal.start() — stacking a second Kitty + // keyboard-protocol push and duplicate stdin listeners. + if (!trustPromptStartedLoop) this.startEventLoop(); try { const migrationResult = await this.runMigrationScreen(this.migrationPlan); if (this.migrateOnly) { @@ -609,9 +622,6 @@ export class KimiTUI { return; } - startupTrace('trustPrompt:begin'); - const trustPromptStartedLoop = await this.maybeRunWorkspaceTrustPrompt(); - startupTrace('trustPrompt:end'); startupTrace('initMainTui:begin'); const shouldReplayHistory = await this.initMainTui(); startupTrace('initMainTui:end'); @@ -724,9 +734,15 @@ export class KimiTUI { } private startBackgroundFdAutocomplete(): void { - if (this.fdPath !== null || this.fdDownloadStarted) return; + if (this.fdDownloadStarted) return; this.fdDownloadStarted = true; + this.fdPath = detectFdPath(); + if (this.fdPath !== null) { + this.setupAutocomplete(); + return; + } + void ensureFdPath() .then((fdPath) => { if (fdPath === null) return; diff --git a/apps/kimi-code/src/utils/process/resolve-command.ts b/apps/kimi-code/src/utils/process/resolve-command.ts new file mode 100644 index 00000000000..721342e601a --- /dev/null +++ b/apps/kimi-code/src/utils/process/resolve-command.ts @@ -0,0 +1,79 @@ +import { accessSync, constants, statSync } from 'node:fs'; +import { isAbsolute, join, relative, resolve } from 'node:path'; + +// cmd.exe / CreateProcess search the current directory before PATH, so on +// Windows a bare command name can execute a binary planted in the workspace +// the user just opened (binary planting). Resolving through PATH ourselves — +// and refusing any hit inside the cwd — keeps that from happening before the +// workspace trust gate has run. + +const DEFAULT_WIN32_PATHEXT = ['.COM', '.EXE', '.BAT', '.CMD']; + +function pathExtensions(platform: NodeJS.Platform, env: NodeJS.ProcessEnv): readonly string[] { + if (platform !== 'win32') return ['']; + const raw = env['PATHEXT']; + if (raw === undefined || raw.trim().length === 0) return DEFAULT_WIN32_PATHEXT; + return raw + .split(';') + .map((ext) => ext.trim()) + .filter((ext) => ext.length > 0); +} + +function candidateNames(command: string, extensions: readonly string[]): readonly string[] { + if (extensions.length === 1 && extensions[0] === '') return [command]; + const lower = command.toLowerCase(); + // An explicitly suffixed name (npm.cmd) is tried as-is first, like cmd.exe. + if (extensions.some((ext) => lower.endsWith(ext.toLowerCase()))) { + return [command, ...extensions.map((ext) => command + ext)]; + } + return extensions.map((ext) => command + ext); +} + +function isExecutableFile(candidate: string, platform: NodeJS.Platform): boolean { + try { + if (!statSync(candidate).isFile()) return false; + // Windows has no executable bit; file existence is enough there. + if (platform !== 'win32') accessSync(candidate, constants.X_OK); + return true; + } catch { + return false; + } +} + +function isInsideCwd(candidate: string, cwd: string, platform: NodeJS.Platform): boolean { + let resolvedCandidate = resolve(candidate); + let resolvedCwd = resolve(cwd); + if (platform === 'win32') { + resolvedCandidate = resolvedCandidate.toLowerCase(); + resolvedCwd = resolvedCwd.toLowerCase(); + } + const rel = relative(resolvedCwd, resolvedCandidate); + return rel !== '' && !rel.startsWith('..') && !isAbsolute(rel); +} + +/** + * Resolve a bare command name to an absolute executable path by searching + * PATH (PATHEXT-aware on Windows). Returns undefined when the command is not + * found — or when the only hit lives inside `cwd`, since executing that would + * run whatever a malicious workspace planted there. + */ +export function resolveCommandPath(command: string, cwd: string = process.cwd()): string | undefined { + const platform = process.platform; + const env = process.env; + const extensions = pathExtensions(platform, env); + const names = candidateNames(command, extensions); + const pathValue = env['PATH'] ?? ''; + const separator = platform === 'win32' ? ';' : ':'; + for (const dir of pathValue.split(separator)) { + // An empty PATH entry means the current directory on POSIX — anything it + // could produce would be rejected by the cwd check anyway, so skip it. + if (dir === '') continue; + for (const name of names) { + const candidate = join(dir, name); + if (!isExecutableFile(candidate, platform)) continue; + if (isInsideCwd(candidate, cwd, platform)) return undefined; + return resolve(candidate); + } + } + return undefined; +} diff --git a/apps/kimi-code/test/cli/run-shell.test.ts b/apps/kimi-code/test/cli/run-shell.test.ts index c4e95c1d1b5..35a0966592b 100644 --- a/apps/kimi-code/test/cli/run-shell.test.ts +++ b/apps/kimi-code/test/cli/run-shell.test.ts @@ -297,7 +297,13 @@ describe('runShell', () => { expect(mocks.harnessEnsureConfigFile.mock.invocationCallOrder[0]).toBeLessThan( mocks.harnessGetConfig.mock.invocationCallOrder[0]!, ); - expect(execSync).toHaveBeenCalledWith('stty -ixon', { stdio: ['inherit', 'ignore', 'ignore'] }); + // stty is POSIX-only; on Windows the save/restore block is skipped + // entirely (a bare `stty` name would resolve into the untrusted cwd). + if (process.platform !== 'win32') { + expect(execSync).toHaveBeenCalledWith('stty -ixon', { stdio: ['inherit', 'ignore', 'ignore'] }); + } else { + expect(execSync).not.toHaveBeenCalled(); + } expect(mocks.kimiTuiConstructor).toHaveBeenCalledTimes(1); expect(mocks.createKimiDeviceId).toHaveBeenCalledWith( '/tmp/kimi-code-test-home', @@ -339,6 +345,18 @@ describe('runShell', () => { }); }); + it('never runs stty on Windows, where it would resolve into the untrusted cwd', async () => { + stubTuiStartup(); + const originalPlatform = process.platform; + Object.defineProperty(process, 'platform', { value: 'win32' }); + try { + await runShell(minimalCliOptions, '1.2.3-test'); + expect(execSync).not.toHaveBeenCalled(); + } finally { + Object.defineProperty(process, 'platform', { value: originalPlatform }); + } + }); + it('resolves the --agent profile into the TUI startup input', async () => { mocks.loadTuiConfig.mockResolvedValue({ theme: 'dark', diff --git a/apps/kimi-code/test/cli/update/preflight.test.ts b/apps/kimi-code/test/cli/update/preflight.test.ts index 2f7439f51b7..3382d622eb0 100644 --- a/apps/kimi-code/test/cli/update/preflight.test.ts +++ b/apps/kimi-code/test/cli/update/preflight.test.ts @@ -37,6 +37,13 @@ const mocks = vi.hoisted(() => ({ resolveUpdateDeviceId: vi.fn(), appendRolloutDecisionLog: vi.fn(), spawn: vi.fn(), + // Identity by default: resolution is covered by resolve-command.test.ts; + // here we only care which command string reaches spawn(). + resolveCommandPath: vi.fn((cmd: string) => cmd as string | undefined), +})); + +vi.mock('#/utils/process/resolve-command', () => ({ + resolveCommandPath: mocks.resolveCommandPath, })); vi.mock('../../../src/cli/update/cache', () => ({ @@ -240,6 +247,7 @@ describe('runUpdatePreflight', () => { filePath: '/tmp/kimi-update-install.lock', release: vi.fn().mockResolvedValue(undefined), }); + mocks.resolveCommandPath.mockImplementation((cmd: string) => cmd); }); afterEach(() => { vi.clearAllMocks(); vi.unstubAllEnvs(); }); @@ -437,7 +445,8 @@ describe('runUpdatePreflight', () => { const { options } = captureOutput(); await runUpdatePreflight('0.4.0', options); expect(mocks.spawn).toHaveBeenCalledWith( - 'pnpm.cmd', + // Resolved to an absolute path and quoted for the cmd.exe shell. + '"pnpm.cmd"', ['add', '-g', '@moonshot-ai/kimi-code@0.5.0'], { stdio: 'inherit', shell: true }, ); @@ -570,6 +579,66 @@ describe('runUpdatePreflight', () => { expect(stdout.join('')).not.toContain('Updated @moonshot-ai/kimi-code'); }); + it('spawns the resolved absolute path instead of the bare command name', async () => { + disableAutoInstall(); + mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.refreshUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.detectInstallSource.mockResolvedValue('npm-global'); + mocks.promptForInstallChoice.mockResolvedValue('install'); + mocks.resolveCommandPath.mockReturnValue('/usr/local/bin/npm'); + mockSpawnExit(0); + const { options } = captureOutput(); + + await expect(runUpdatePreflight('0.4.0', options)).resolves.toBe('exit'); + + expect(mocks.resolveCommandPath).toHaveBeenCalledWith('npm'); + expect(mocks.spawn).toHaveBeenCalledWith( + '/usr/local/bin/npm', + ['install', '-g', '@moonshot-ai/kimi-code@0.5.0'], + { stdio: 'inherit' }, + ); + }); + + it('warns and continues without spawning when the package manager cannot be resolved', async () => { + disableAutoInstall(); + mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.refreshUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.detectInstallSource.mockResolvedValue('npm-global'); + mocks.promptForInstallChoice.mockResolvedValue('install'); + // Only resolvable inside the cwd (or missing entirely): refuse to run it. + mocks.resolveCommandPath.mockReturnValue(undefined); + const { stdout, stderr, options } = captureOutput(); + + await expect(runUpdatePreflight('0.4.0', options)).resolves.toBe('continue'); + + expect(mocks.spawn).not.toHaveBeenCalled(); + expect(stderr.join('')).toContain('warning: failed to install'); + expect(stdout.join('')).not.toContain('Updated @moonshot-ai/kimi-code'); + }); + + it('records a background install failure without spawning when the package manager cannot be resolved', async () => { + mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.readUpdateInstallState.mockResolvedValue(installState()); + mocks.refreshUpdateCache.mockResolvedValue(cacheWith('0.5.0')); + mocks.detectInstallSource.mockResolvedValue('npm-global'); + mocks.resolveCommandPath.mockReturnValue(undefined); + const { stderr, options } = captureOutput(); + + await expect(runUpdatePreflight('0.4.0', options)).resolves.toBe('continue'); + await flushBackgroundInstall(); + + expect(mocks.spawn).not.toHaveBeenCalled(); + expect(stderr.join('')).toBe(''); + expect(writeUpdateInstallState).toHaveBeenLastCalledWith(expect.objectContaining({ + active: null, + lastFailure: expect.objectContaining({ + version: '0.5.0', + attempts: 1, + }), + lastSuccess: null, + })); + }); + it('starts an automatic update in the background by default', async () => { mocks.readUpdateCache.mockResolvedValue(cacheWith('0.5.0')); mocks.readUpdateInstallState.mockResolvedValue(installState()); @@ -619,7 +688,8 @@ describe('runUpdatePreflight', () => { const { options } = captureOutput(); await expect(runUpdatePreflight('0.4.0', options)).resolves.toBe('continue'); expect(mocks.spawn).toHaveBeenCalledWith( - 'npm.cmd', + // Resolved to an absolute path and quoted for the cmd.exe shell. + '"npm.cmd"', ['install', '-g', '@moonshot-ai/kimi-code@0.5.0'], { detached: true, stdio: 'ignore', shell: true, windowsHide: true }, ); diff --git a/apps/kimi-code/test/cli/update/source.test.ts b/apps/kimi-code/test/cli/update/source.test.ts index dd88d32c3c9..babe509a206 100644 --- a/apps/kimi-code/test/cli/update/source.test.ts +++ b/apps/kimi-code/test/cli/update/source.test.ts @@ -1,10 +1,15 @@ -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi } from 'vitest'; import { classifyByPathHeuristic, classifyInstallSource, detectInstallSource, } from '#/cli/update/source'; +import { resolveCommandPath } from '#/utils/process/resolve-command'; + +vi.mock('#/utils/process/resolve-command', () => ({ + resolveCommandPath: vi.fn(), +})); describe('classifyByPathHeuristic', () => { it('returns null for an npm-style global path (handled by classifyInstallSource)', () => { @@ -176,4 +181,19 @@ describe('detectInstallSource', () => { }), ).resolves.toBe('unsupported'); }); + + it('returns unsupported when npm cannot be resolved outside the cwd', async () => { + // The default prefix lookup spawns npm; when it can only be found inside + // the current directory (or not at all), detection must degrade to + // 'unsupported' rather than run a planted binary. + vi.mocked(resolveCommandPath).mockReturnValue(undefined); + await expect( + detectInstallSource({ + getPackageRoot: () => '/Users/me/dev/@moonshot-ai/kimi-code', + detectNative: () => false, + platform: 'darwin', + }), + ).resolves.toBe('unsupported'); + expect(resolveCommandPath).toHaveBeenCalledWith('npm'); + }); }); diff --git a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts index fe816442b64..2e76c044029 100644 --- a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts +++ b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts @@ -1941,6 +1941,79 @@ describe('KimiTUI startup', () => { expect(driver.terminalFocusTrackingDispose).toBeUndefined(); }); + it('checks workspace trust before entering the migration screen', async () => { + // The migration branch used to skip the trust gate entirely: a workspace + // with legacy ~/.kimi data went straight to the migration screen, and + // later startup steps spawned child processes in an untrusted directory. + const getWorkspaceTrustInfo = vi.fn(async () => ({ + trusted: true, + gatedMcpServers: [] as string[], + })); + const harness = makeHarness(makeSession(), { getWorkspaceTrustInfo }); + const driver = makeDriver(harness, { + ...makeStartupInput(), + migrationPlan: MIGRATION_PLAN, + migrateOnly: true, + engineV2: true, + }) as unknown as MigrateExitDriver; + vi.spyOn(driver.state.ui, 'start').mockImplementation(() => {}); + vi.spyOn(driver.state.ui, 'stop').mockImplementation(() => {}); + vi.spyOn(driver.state.terminal, 'write').mockImplementation(() => {}); + const migrationSpy = vi + .spyOn(driver, 'runMigrationScreen') + .mockResolvedValue({ decision: 'later' }); + const onExit = vi.fn(async () => {}); + driver.onExit = onExit; + + await driver.start(); + + expect(getWorkspaceTrustInfo).toHaveBeenCalledWith('/tmp/proj-a'); + expect(getWorkspaceTrustInfo.mock.invocationCallOrder[0]!).toBeLessThan( + migrationSpy.mock.invocationCallOrder[0]!, + ); + expect(onExit).toHaveBeenCalledWith(0); + }); + + it('prompts for workspace trust before migrating an untrusted workspace', async () => { + const getWorkspaceTrustInfo = vi.fn(async () => ({ + trusted: false, + gatedMcpServers: [] as string[], + })); + const trustWorkspace = vi.fn(async () => {}); + const harness = makeHarness(makeSession(), { getWorkspaceTrustInfo, trustWorkspace }); + const driver = makeDriver(harness, { + ...makeStartupInput(), + migrationPlan: MIGRATION_PLAN, + migrateOnly: true, + engineV2: true, + }) as unknown as MigrateExitDriver & { + mountEditorReplacement(panel: { handleInput(data: string): void }): void; + }; + vi.spyOn(driver.state.ui, 'start').mockImplementation(() => {}); + vi.spyOn(driver.state.ui, 'stop').mockImplementation(() => {}); + vi.spyOn(driver.state.terminal, 'write').mockImplementation(() => {}); + const migrationSpy = vi + .spyOn(driver, 'runMigrationScreen') + .mockResolvedValue({ decision: 'later' }); + const mountSpy = vi.spyOn(driver, 'mountEditorReplacement'); + const onExit = vi.fn(async () => {}); + driver.onExit = onExit; + + const startPromise = driver.start(); + await vi.waitFor(() => { + expect(mountSpy).toHaveBeenCalled(); + }); + // Choose the default "Trust this folder" option with Enter. + mountSpy.mock.calls[0]![0].handleInput('\r'); + await startPromise; + + expect(trustWorkspace).toHaveBeenCalledWith('/tmp/proj-a'); + expect(getWorkspaceTrustInfo.mock.invocationCallOrder[0]!).toBeLessThan( + migrationSpy.mock.invocationCallOrder[0]!, + ); + expect(onExit).toHaveBeenCalledWith(0); + }); + it('keeps non-login startup session errors fatal', async () => { const harness = makeHarness(makeSession(), { createSession: vi.fn(async () => { diff --git a/apps/kimi-code/test/utils/process/resolve-command.test.ts b/apps/kimi-code/test/utils/process/resolve-command.test.ts new file mode 100644 index 00000000000..8c836b45ff3 --- /dev/null +++ b/apps/kimi-code/test/utils/process/resolve-command.test.ts @@ -0,0 +1,147 @@ +import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; +import { join } from 'node:path'; + +import { afterEach, describe, expect, it } from 'vitest'; + +import { resolveCommandPath } from '#/utils/process/resolve-command'; + +const originalEnv = { ...process.env }; +const originalPlatform = process.platform; +let tempDirs: string[] = []; + +afterEach(() => { + for (const dir of tempDirs) { + rmSync(dir, { recursive: true, force: true }); + } + tempDirs = []; + process.env = { ...originalEnv }; + Object.defineProperty(process, 'platform', { value: originalPlatform }); +}); + +function makeTempDir(prefix: string): string { + const dir = mkdtempSync(join(tmpdir(), prefix)); + tempDirs.push(dir); + return dir; +} + +function mockPlatform(platform: NodeJS.Platform): void { + Object.defineProperty(process, 'platform', { value: platform }); +} + +describe('resolveCommandPath (posix)', () => { + // Executable-bit checks only work on a posix host. + it.skipIf(process.platform === 'win32')('resolves an executable from PATH to an absolute path', () => { + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + const tool = join(bin, 'mytool'); + writeFileSync(tool, '#!/bin/sh\nexit 0\n'); + chmodSync(tool, 0o755); + process.env['PATH'] = bin; + + expect(resolveCommandPath('mytool', cwd)).toBe(tool); + }); + + it.skipIf(process.platform === 'win32')('ignores PATH files without the executable bit', () => { + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + writeFileSync(join(bin, 'mytool'), '#!/bin/sh\nexit 0\n'); + chmodSync(join(bin, 'mytool'), 0o644); + process.env['PATH'] = bin; + + expect(resolveCommandPath('mytool', cwd)).toBeUndefined(); + }); + + it.skipIf(process.platform === 'win32')('refuses a hit inside the current working directory', () => { + const cwd = makeTempDir('kimi-resolve-cwd-'); + const tool = join(cwd, 'mytool'); + writeFileSync(tool, '#!/bin/sh\nexit 0\n'); + chmodSync(tool, 0o755); + // The cwd itself sits on PATH (e.g. a `.` entry) — the planted binary + // must be rejected, not executed. + process.env['PATH'] = cwd; + + expect(resolveCommandPath('mytool', cwd)).toBeUndefined(); + }); + + it.skipIf(process.platform === 'win32')('refuses a hit from a relative PATH entry landing in the cwd', () => { + const cwd = makeTempDir('kimi-resolve-cwd-'); + const tool = join(cwd, 'mytool'); + writeFileSync(tool, '#!/bin/sh\nexit 0\n'); + chmodSync(tool, 0o755); + process.env['PATH'] = '.'; + + expect(resolveCommandPath('mytool', cwd)).toBeUndefined(); + }); + + it.skipIf(process.platform === 'win32')('refuses a hit in a subdirectory of the cwd', () => { + const cwd = makeTempDir('kimi-resolve-cwd-'); + const nested = join(cwd, 'bin'); + mkdirSync(nested); + const tool = join(nested, 'mytool'); + writeFileSync(tool, '#!/bin/sh\nexit 0\n'); + chmodSync(tool, 0o755); + process.env['PATH'] = nested; + + expect(resolveCommandPath('mytool', cwd)).toBeUndefined(); + }); + + it('returns undefined when the command is not on PATH', () => { + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + process.env['PATH'] = bin; + + expect(resolveCommandPath('definitely-not-a-real-command', cwd)).toBeUndefined(); + }); +}); + +describe('resolveCommandPath (win32)', () => { + it('resolves a bare name through PATHEXT', () => { + mockPlatform('win32'); + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + // Windows is case-insensitive, so the resolved name carries the PATHEXT + // casing; match it here so the test also passes on case-insensitive + // posix filesystems. + const shim = join(bin, 'npm.CMD'); + writeFileSync(shim, '@echo off\r\n'); + process.env['PATH'] = bin; + process.env['PATHEXT'] = '.COM;.EXE;.BAT;.CMD'; + + expect(resolveCommandPath('npm', cwd)).toBe(shim); + }); + + it('tries an explicitly suffixed name as-is', () => { + mockPlatform('win32'); + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + const shim = join(bin, 'npm.cmd'); + writeFileSync(shim, '@echo off\r\n'); + process.env['PATH'] = bin; + process.env['PATHEXT'] = '.COM;.EXE;.BAT;.CMD'; + + expect(resolveCommandPath('npm.cmd', cwd)).toBe(shim); + }); + + it('falls back to the default PATHEXT when the variable is unset', () => { + mockPlatform('win32'); + const bin = makeTempDir('kimi-resolve-bin-'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + const shim = join(bin, 'bun.EXE'); + writeFileSync(shim, 'MZ'); + process.env['PATH'] = bin; + delete process.env['PATHEXT']; + + expect(resolveCommandPath('bun', cwd)).toBe(shim); + }); + + it('refuses a hit inside the current working directory', () => { + mockPlatform('win32'); + const cwd = makeTempDir('kimi-resolve-cwd-'); + writeFileSync(join(cwd, 'npm.cmd'), '@echo off\r\n'); + process.env['PATH'] = cwd; + process.env['PATHEXT'] = '.COM;.EXE;.BAT;.CMD'; + + expect(resolveCommandPath('npm', cwd)).toBeUndefined(); + }); +}); From e7028171244789aff58f93da80d477ce3afc939a Mon Sep 17 00:00:00 2001 From: Haozhe Date: Tue, 11 Aug 2026 14:40:15 +0800 Subject: [PATCH 04/50] fix(agent-core-v2): degrade idle-session steer to turn launch like v1 (#2723) - return the enqueue-launched turn instead of rejecting with prompt.not_found when no prompt is pending at steer time - report steer as queued when a manual compaction holds the context - sync title/lastPrompt metadata on main-agent steer, matching v1 - update the v1-v2 parity test to assert converged behavior --- .changeset/steer-goal-turn-boundary.md | 5 +++ .../agent-core-v2/src/agent/rpc/rpcService.ts | 31 ++++++++++++++++--- packages/node-sdk/src/sdk-rpc-client-v2.ts | 10 +++--- packages/node-sdk/test/v1-v2-parity.test.ts | 18 +++++------ 4 files changed, 44 insertions(+), 20 deletions(-) create mode 100644 .changeset/steer-goal-turn-boundary.md diff --git a/.changeset/steer-goal-turn-boundary.md b/.changeset/steer-goal-turn-boundary.md new file mode 100644 index 00000000000..cfbb8a24249 --- /dev/null +++ b/.changeset/steer-goal-turn-boundary.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix a spurious "Failed to steer" error when sending a message while a goal run is between turns. diff --git a/packages/agent-core-v2/src/agent/rpc/rpcService.ts b/packages/agent-core-v2/src/agent/rpc/rpcService.ts index f3d089ab76f..87e8005acb0 100644 --- a/packages/agent-core-v2/src/agent/rpc/rpcService.ts +++ b/packages/agent-core-v2/src/agent/rpc/rpcService.ts @@ -6,7 +6,7 @@ import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting' import { IAgentFullCompactionService } from '#/agent/fullCompaction/fullCompaction'; import { IEventBus } from '#/app/event/eventBus'; import { IEventService } from '#/app/event/event'; -import { ErrorCodes, Error2 } from '#/errors'; +import { ErrorCodes, Error2, isError2 } from '#/errors'; import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; import { @@ -112,14 +112,37 @@ export class AgentRPCService implements IAgentRPCService { async steer(payload: SteerPayload): Promise { this.telemetry.track2('input_steer', { parts: payload.input.length }); + if (this.scopeContext.agentId === MAIN_AGENT_ID) { + // A steer is user input like a prompt — and can even launch the + // session's first turn (e.g. goal mode) — so keep title/lastPrompt in + // sync the same way, matching v1. + await this.updatePromptMetadata(promptMetadataTextFromPayload(payload)); + } const queued = await this.promptService.enqueue({ message: { role: 'user', content: [...payload.input], toolCalls: [], } }); - const [steered] = await this.promptService.steer([queued.id]); - const turn = await steered?.launched; - return turn === undefined ? undefined : { turn_id: turn.id }; + if (queued.state !== 'pending') { + // No active prompt at enqueue time, so the enqueue itself already + // launched this input as its own turn (idle session, or a goal-turn + // boundary where the previous turn just ended) — v1's + // steer-degrades-to-launch end state. Return that turn instead of + // rejecting on a steer-by-id that can never find the record pending. + const turn = await queued.launched; + return turn === undefined ? undefined : { turn_id: turn.id }; + } + try { + const [steered] = await this.promptService.steer([queued.id]); + const turn = await steered?.launched; + return turn === undefined ? undefined : { turn_id: turn.id }; + } catch (error) { + // Pending but nothing active to steer into (a manual compaction holds + // the context): the message stays queued and launches once compaction + // finishes, so report it as queued rather than failing the steer. + if (isError2(error) && error.code === ErrorCodes.PROMPT_NOT_FOUND) return undefined; + throw error; + } } cancel({ turnId }: CancelPayload): void { diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index d723c41063a..e95bcee56fd 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -1621,12 +1621,10 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } /** - * Facade (`agentRPCService.steer`). Mid-turn steers match v1 (the input - * joins the running turn). The idle-session case diverges by design and is - * pinned in the parity tests: v1 launches a fresh turn off a steer and - * updates title/lastPrompt like a prompt; v2's enqueue launches the turn - * first, so the follow-up `steer()` finds nothing pending and rejects with - * `prompt.not_found` — and the v2 RPC path never touches the metadata. + * Facade (`agentRPCService.steer`). Matches v1 on both paths: mid-turn + * steers join the running turn, and an idle-session steer degrades to + * launching a fresh turn (the enqueue launches it directly) while + * title/lastPrompt are updated like a prompt's. */ override async steer(input: SessionPromptRpcInput): Promise { const agent = await this.agentFacade(input.sessionId); diff --git a/packages/node-sdk/test/v1-v2-parity.test.ts b/packages/node-sdk/test/v1-v2-parity.test.ts index 961f7f3bf1e..cbfa98f4982 100644 --- a/packages/node-sdk/test/v1-v2-parity.test.ts +++ b/packages/node-sdk/test/v1-v2-parity.test.ts @@ -2427,28 +2427,26 @@ describe('v1↔v2 agent interaction parity', () => { } }); - it('steer on an idle session: v1 launches a turn, v2 rejects prompt.not_found (pinned)', async () => { + it('steer on an idle session: both engines launch a turn and update metadata', async () => { const restoreEnv = scrubConfigEnv(); const pair = await makeSessionParityPair(); try { await createOnBoth(pair, { id: 'session_parity_agent_steer' }); const input = { sessionId: 'session_parity_agent_steer' } as const; - // Pinned divergence: v1 treats an idle steer like a prompt — it - // launches a fresh turn and updates title/lastPrompt. v2's steer RPC - // enqueues first (which itself launches the turn), so the follow-up - // steer step finds no pending prompt and rejects with prompt.not_found; - // the v2 path never touches the metadata. + // v1 treats an idle steer like a prompt — it launches a fresh turn and + // updates title/lastPrompt. v2's steer RPC enqueues first (which itself + // launches the turn) and converges on the same end state: the launched + // turn is returned instead of rejecting, and the metadata is updated. await pair.v1.steer({ ...input, input: [{ type: 'text', text: 'steer text' }] }); - await expect( - pair.v2.steer({ ...input, input: [{ type: 'text', text: 'steer text' }] }), - ).rejects.toMatchObject({ code: 'prompt.not_found' }); + await pair.v2.steer({ ...input, input: [{ type: 'text', text: 'steer text' }] }); const [v1List, v2List] = await Promise.all([ pair.v1.listSessions(), pair.v2.listSessions(), ]); expect(v1List[0]?.title).toBe('steer text'); expect(v1List[0]?.lastPrompt).toBe('steer text'); - expect(v2List[0]?.lastPrompt).not.toBe('steer text'); + expect(v2List[0]?.title).toBe('steer text'); + expect(v2List[0]?.lastPrompt).toBe('steer text'); await settleTurns(); } finally { await closeSessionPair(pair); From 860354976ef2909eb9a6a7c11c56f8b021564ac0 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Tue, 11 Aug 2026 14:55:08 +0800 Subject: [PATCH 05/50] feat(agent-core-v2): add event-subscription introspection (#2806) - name Emitters and surface their subscriptions as on: ledger labels through a named EventSubscription class and IDisposableDebugLabel - add IDebugEventsService.subscriptions(), merging unit-book entries with per-bus listener counts, contributed at App scope by the new debugEvents feature - kap-server debug dispatcher falls back to the global decorator registry so runtime-contributed services stay callable - kimi-inspect: add an Events panel to the DI view --- apps/kimi-inspect/AGENTS.md | 2 +- .../src/components/DiInspectionView.tsx | 29 +++- .../src/components/di/DiEventsPanel.tsx | 146 ++++++++++++++++++ .../src/_base/di/instantiation.ts | 4 + .../agent-core-v2/src/_base/di/lifecycle.ts | 8 + packages/agent-core-v2/src/_base/event.ts | 46 ++++-- .../src/app/event/eventBusService.ts | 12 +- .../src/app/event/eventService.ts | 6 +- .../src/features/debugEvents/debugEvents.ts | 48 ++++++ .../debugEvents/debugEventsFeature.ts | 31 ++++ .../debugEvents/debugEventsService.ts | 120 ++++++++++++++ packages/agent-core-v2/src/index.ts | 3 + .../agent-core-v2/test/_base/event.test.ts | 38 +++++ .../agent-core-v2/test/debug/debug.test.ts | 61 +++++++- .../features/debugEvents/debugEvents.test.ts | 64 ++++++++ packages/kap-server/AGENTS.md | 2 +- .../src/transport/channelRegistry.ts | 8 +- .../src/transport/serviceDispatcherRoutes.ts | 3 +- packages/kap-server/test/rpc.test.ts | 23 +++ 19 files changed, 631 insertions(+), 23 deletions(-) create mode 100644 apps/kimi-inspect/src/components/di/DiEventsPanel.tsx create mode 100644 packages/agent-core-v2/src/features/debugEvents/debugEvents.ts create mode 100644 packages/agent-core-v2/src/features/debugEvents/debugEventsFeature.ts create mode 100644 packages/agent-core-v2/src/features/debugEvents/debugEventsService.ts create mode 100644 packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts diff --git a/apps/kimi-inspect/AGENTS.md b/apps/kimi-inspect/AGENTS.md index 23e74caf956..2cafed50110 100644 --- a/apps/kimi-inspect/AGENTS.md +++ b/apps/kimi-inspect/AGENTS.md @@ -10,7 +10,7 @@ A left icon rail (`src/components/NavRail.tsx`) switches top-level views: - **Global message search** (`src/components/SearchView.tsx`) — cross-session full-text search over `POST /api/v1/search`, cursor-paged via a manual Load more; an exact-match checkbox maps to the API's `mode: 'literal'` substring search, which ignores sort and orders newest-first; a `live`/`index` badge on the results shows which server route served them (in-memory session transcript vs the persisted index). - **Model Catalog** (`src/components/ModelCatalogView.tsx`) — every Provider with its Models and the default marker, via `IModelCatalog` / `IModelService` channel proxies. Expanding a Model opens the model inspector inside that view: provider/model config layers plus the resolved runtime view with per-value provenance (config / override / builtin / env / synthesized), served on demand by `IModelCatalog.inspect` — the same resolution pass the runtime's `get` serves, traced via `ResolutionTraceCollector` and assembled by `kosong/model/inspection.ts`. - **App Services** (`src/components/AppServicesView.tsx`) — the app-scope Service reflection, full width, joined by the **Workspace Services** view (`src/components/WorkspaceServicesView.tsx`) — the workspace-scope counterpart with a left sidebar directory browser (`src/components/WorkspaceDirBrowser.tsx` — server-side fs browsing over the App-scope `IHostFolderBrowser`, marking entries that are registered workspaces with their `IWorkspaceTrust` trust state, and registering a picked folder on demand via `IWorkspaceService.createOrTouch`), its proxies riding the `/workspace/:id` route, which materializes the handler on demand via `IWorkspaceLifecycleService.handlerFor`. -- **DI view** (`src/components/DiInspectionView.tsx`) — the engine's Service × Effect × DI debug surface over the App-scope `IDebugLedgerService` / `IDebugGraphService` / `IDebugCascadeService`: the unit tree = ledger tree with unprovide / update / dispose triggers, the dependency DAG as a hand-rolled SVG, the cascade history, and the waiting area; the four panels poll on a short interval and refresh eagerly off the global `event.di.unit_changed` WS frame via `src/activity/di.ts`, which invalidates the `['di']` react-query prefix. +- **DI view** (`src/components/DiInspectionView.tsx`) — the engine's Service × Effect × DI debug surface over the App-scope `IDebugLedgerService` / `IDebugGraphService` / `IDebugEventsService` / `IDebugCascadeService`: the unit tree = ledger tree with unprovide / update / dispose triggers, the dependency DAG as Miller columns (`di/DiGraphPanel.tsx`), the event-subscription ledger (unit-book `on:` entries + per-bus listener counts, `di/DiEventsPanel.tsx`), the cascade history, and the waiting area; the five panels poll on a short interval and refresh eagerly off the global `event.di.unit_changed` WS frame via `src/activity/di.ts`, which invalidates the `['di']` react-query prefix. The **Agent scope** stays in the Chat view's right dock (`src/components/RightPanel.tsx`) across two tabs: diff --git a/apps/kimi-inspect/src/components/DiInspectionView.tsx b/apps/kimi-inspect/src/components/DiInspectionView.tsx index bd1f78476e4..93001b1b708 100644 --- a/apps/kimi-inspect/src/components/DiInspectionView.tsx +++ b/apps/kimi-inspect/src/components/DiInspectionView.tsx @@ -12,12 +12,16 @@ * with that service's direct dependencies; rows carry path-scoped * relation bars (one per path ancestor with a direct edge) and a * path-root background highlight; + * - Events: event subscriptions (`IDebugEventsService.subscriptions`) — + * unit-book ledger entries labeled `on:` / + * `disposable:EventSubscription` per scope, plus per-bus listener counts + * as the fallback side (`di/DiEventsPanel.tsx`); * - Cascade: the cross-scope cascade history rings * (`IDebugCascadeService.history`), newest first; * - Pending: the waiting area + sticky failures per scope * (`IDebugCascadeService.pending`), with an `update` retry per failure. * - * All four panels poll on a short interval and refresh eagerly when the + * All five panels poll on a short interval and refresh eagerly when the * global `event.di.unit_changed` WS frame fires (`useDiQueryInvalidation` * invalidates the `['di']` query prefix). */ @@ -30,6 +34,10 @@ import { type DebugPendingGroup, } from '@moonshot-ai/agent-core-v2/debug/debugCascade'; import { IDebugGraphService, type DebugGraph } from '@moonshot-ai/agent-core-v2/debug/debugGraph'; +import { + IDebugEventsService, + type DebugEventSubscriptions, +} from '@moonshot-ai/agent-core-v2/features/debugEvents/debugEvents'; import { IDebugLedgerService, type DebugLedgerNode, @@ -42,13 +50,15 @@ import { useDiQueryInvalidation } from '../activity/di'; import type { InspectClient } from '../channel'; import { useConnection } from '../connection'; import { ActionButton, Badge, ErrorLine } from '../ui'; +import { DiEventsPanel } from './di/DiEventsPanel'; import { DiGraphPanel } from './di/DiGraphPanel'; -type DiPanel = 'units' | 'graph' | 'cascade' | 'pending'; +type DiPanel = 'units' | 'graph' | 'events' | 'cascade' | 'pending'; const PANELS: readonly { id: DiPanel; title: string }[] = [ { id: 'units', title: 'Units' }, { id: 'graph', title: 'Deps' }, + { id: 'events', title: 'Events' }, { id: 'cascade', title: 'Cascade' }, { id: 'pending', title: 'Pending' }, ]; @@ -86,6 +96,8 @@ export function DiInspectionView() { ) : panel === 'graph' ? ( + ) : panel === 'events' ? ( + ) : panel === 'cascade' ? ( ) : ( @@ -384,6 +396,19 @@ function GraphPanel() { return ; } +// --------------------------------------------------------------------------- +// Events panel — event subscriptions; rendering lives in di/DiEventsPanel.tsx +// --------------------------------------------------------------------------- + +function EventsPanel() { + const query = useDiQuery('events', (klient) => + klient.core(IDebugEventsService).subscriptions(), + ); + const gate = panelGate(query); + if (gate !== null) return gate; + return ; +} + // --------------------------------------------------------------------------- // Cascade panel — the cross-scope cascade history rings, newest first // --------------------------------------------------------------------------- diff --git a/apps/kimi-inspect/src/components/di/DiEventsPanel.tsx b/apps/kimi-inspect/src/components/di/DiEventsPanel.tsx new file mode 100644 index 00000000000..790dc6f389a --- /dev/null +++ b/apps/kimi-inspect/src/components/di/DiEventsPanel.tsx @@ -0,0 +1,146 @@ +/** + * DI Events panel — event-subscription introspection + * (`IDebugEventsService.subscriptions`), two merged sides: + * + * - Subscriptions: the unit-book side — every materialized unit's ledger + * entries labeled as an event subscription (`on:` from a named + * Emitter or the fiber `on` capability, `disposable:EventSubscription` + * from an unnamed one), grouped by scope path; + * - Bus listeners: the emitter-side fallback — per-`IEventBus` listener + * counts (`*` = the full stream) plus the global `IEventService` count, + * which also cover subscriptions never registered on a unit book. + * + * Pure React + Tailwind. + */ +import type { + DebugEventBusSnapshot, + DebugEventSubscription, + DebugEventSubscriptions, +} from '@moonshot-ai/agent-core-v2/features/debugEvents/debugEvents'; + +import { Badge } from '../../ui'; + +const KIND_TONES: Record = { + disposer: 'neutral', + effect: 'sky', + ledger: 'violet', +}; + +export function DiEventsPanel({ data }: { data: DebugEventSubscriptions }) { + const groups = groupByScope(data.subscriptions); + return ( +
+
+ subscriptions ({data.subscriptions.length}) +
+ {groups.length === 0 ? ( +
+ no event subscriptions on any unit book +
+ ) : ( + groups.map(([scopePath, subs]) => ( +
+
+ {scopePath} + {subs.length} +
+
+ {subs.map((sub, i) => ( +
+ + {sub.unit} + + {sub.uid !== undefined ? ( + #{sub.uid} + ) : null} + + {sub.label} + + + {sub.kind} + +
+ ))} +
+
+ )) + )} +
+ bus listeners +
+ {data.buses.length === 0 && data.globalListeners === undefined ? ( +
no materialized event buses
+ ) : ( +
+ {data.globalListeners !== undefined ? ( + + ) : null} + {data.buses.flatMap((bus) => busRows(bus))} +
+ )} +
+ ); +} + +function groupByScope( + subs: readonly DebugEventSubscription[], +): [string, DebugEventSubscription[]][] { + const map = new Map(); + for (const sub of subs) { + const group = map.get(sub.scopePath) ?? []; + group.push(sub); + map.set(sub.scopePath, group); + } + return [...map.entries()]; +} + +function busRows(bus: DebugEventBusSnapshot) { + const rows = [ + , + ]; + for (const type of Object.keys(bus.perType).toSorted()) { + rows.push( + , + ); + } + return rows; +} + +function BusRow({ + scopePath, + type, + count, +}: { + scopePath: string; + type: string; + count: number; +}) { + return ( +
+ + {scopePath} + + + {type} + + {count} +
+ ); +} diff --git a/packages/agent-core-v2/src/_base/di/instantiation.ts b/packages/agent-core-v2/src/_base/di/instantiation.ts index f059ea7a5fc..370dad62ff3 100644 --- a/packages/agent-core-v2/src/_base/di/instantiation.ts +++ b/packages/agent-core-v2/src/_base/di/instantiation.ts @@ -130,6 +130,10 @@ export function createDecorator(name: string): ServiceIdentifier { return id; } +export function lookupServiceDecorator(name: string): ServiceIdentifier | undefined { + return _util.serviceIds.get(name); +} + const SERVICE_IDENTIFIER_MARK = Symbol('serviceIdentifier'); export function isServiceIdentifier(thing: unknown): thing is ServiceIdentifier { diff --git a/packages/agent-core-v2/src/_base/di/lifecycle.ts b/packages/agent-core-v2/src/_base/di/lifecycle.ts index 5ae86e22e3c..4cb5dc5d147 100644 --- a/packages/agent-core-v2/src/_base/di/lifecycle.ts +++ b/packages/agent-core-v2/src/_base/di/lifecycle.ts @@ -5,7 +5,15 @@ import { onUnexpectedError } from '../errors/unexpectedError'; import { Ledger, type LedgerEntry } from '../lifecycle/ledger'; +export interface IDisposableDebugLabel { + readonly debugLabel?: string; +} + function disposableLabel(d: IDisposable): string { + const debugLabel = (d as IDisposableDebugLabel).debugLabel; + if (typeof debugLabel === 'string' && debugLabel.length > 0) { + return debugLabel; + } return `disposable:${d.constructor?.name ?? 'anonymous'}`; } diff --git a/packages/agent-core-v2/src/_base/event.ts b/packages/agent-core-v2/src/_base/event.ts index 802fe467416..35b0559ccd0 100644 --- a/packages/agent-core-v2/src/_base/event.ts +++ b/packages/agent-core-v2/src/_base/event.ts @@ -4,7 +4,9 @@ * `onWill` events whose listeners register work via `waitUntil`), the * `handleVetos` helper (for `onBefore*` veto events whose listeners answer * with `veto(value, id)`), and event combinators (`once` / `map` / `filter` - * / `any`). + * / `any`). `Emitter` accepts an optional debug name that its + * `EventSubscription` carries as an `on:` ledger label, so event + * subscriptions stay identifiable in unit-book introspection. */ import { onUnexpectedError, safelyCallListener } from './errors/unexpectedError'; @@ -13,6 +15,7 @@ import { DisposableStore, combinedDisposable, type IDisposable, + type IDisposableDebugLabel, } from './di/lifecycle'; import { LinkedList } from './di/util/linkedList'; @@ -29,11 +32,31 @@ interface ListenerEntry { thisArg: unknown; } +export class EventSubscription implements IDisposable, IDisposableDebugLabel { + readonly debugLabel: string | undefined; + private _removed = false; + + constructor( + debugName: string | undefined, + private readonly _remove: () => void, + ) { + this.debugLabel = debugName === undefined ? undefined : `on:${debugName}`; + } + + dispose(): void { + if (this._removed) return; + this._removed = true; + this._remove(); + } +} + export class Emitter { protected _listeners: Set> | undefined; private _disposed = false; private _event: Event | undefined; + constructor(public readonly debugName?: string) {} + get event(): Event { this._event ??= (listener, thisArg, disposables) => { if (this._disposed) { @@ -43,17 +66,12 @@ export class Emitter { const entry: ListenerEntry = { listener, thisArg }; this._listeners.add(entry); - let removed = false; - const subscription: IDisposable = { - dispose: () => { - if (removed) return; - removed = true; - if (this._disposed) { - return; - } - this._listeners?.delete(entry); - }, - }; + const subscription = new EventSubscription(this.debugName, () => { + if (this._disposed) { + return; + } + this._listeners?.delete(entry); + }); if (disposables !== undefined) { if (disposables instanceof DisposableStore) { @@ -67,6 +85,10 @@ export class Emitter { return this._event; } + get listenerCount(): number { + return this._listeners?.size ?? 0; + } + fire(value: T): void { if (this._disposed || this._listeners === undefined) { return; diff --git a/packages/agent-core-v2/src/app/event/eventBusService.ts b/packages/agent-core-v2/src/app/event/eventBusService.ts index 959d31fdd2d..a9e6b26d1f1 100644 --- a/packages/agent-core-v2/src/app/event/eventBusService.ts +++ b/packages/agent-core-v2/src/app/event/eventBusService.ts @@ -21,7 +21,7 @@ import { type DomainEvent, type DomainEventMap, IEventBus } from './eventBus'; export class EventBusService extends Service implements IEventBus { declare readonly _serviceBrand: undefined; - private readonly allEmitter = this._register(new Emitter()); + private readonly allEmitter = this._register(new Emitter('*')); private readonly perType = new Map>(); publish(event: DomainEvent): void { @@ -29,6 +29,14 @@ export class EventBusService extends Service implements IEventBus { this.perType.get(event.type)?.fire(event); } + listenerCounts(): { all: number; perType: Record } { + const perType: Record = {}; + for (const [type, emitter] of this.perType) { + perType[String(type)] = emitter.listenerCount; + } + return { all: this.allEmitter.listenerCount, perType }; + } + subscribe(handler: (event: DomainEvent) => void): IDisposable; subscribe( type: K, @@ -44,7 +52,7 @@ export class EventBusService extends Service implements IEventBus { const type = typeOrHandler; let emitter = this.perType.get(type); if (emitter === undefined) { - emitter = this._register(new Emitter()); + emitter = this._register(new Emitter(String(type))); this.perType.set(type, emitter); } return emitter.event(handler as unknown as (event: DomainEvent) => void); diff --git a/packages/agent-core-v2/src/app/event/eventService.ts b/packages/agent-core-v2/src/app/event/eventService.ts index beafdbc8ca9..062a51e3e7a 100644 --- a/packages/agent-core-v2/src/app/event/eventService.ts +++ b/packages/agent-core-v2/src/app/event/eventService.ts @@ -16,9 +16,13 @@ import { type DomainEvent, IEventService } from './event'; export class EventService extends Service implements IEventService { declare readonly _serviceBrand: undefined; - private readonly emitter = this._register(new Emitter()); + private readonly emitter = this._register(new Emitter('publish')); readonly onDidPublish: Event = this.emitter.event; + get listenerCount(): number { + return this.emitter.listenerCount; + } + publish(event: DomainEvent): void { this.emitter.fire(event); } diff --git a/packages/agent-core-v2/src/features/debugEvents/debugEvents.ts b/packages/agent-core-v2/src/features/debugEvents/debugEvents.ts new file mode 100644 index 00000000000..698c42b3552 --- /dev/null +++ b/packages/agent-core-v2/src/features/debugEvents/debugEvents.ts @@ -0,0 +1,48 @@ +/** + * `debugEvents` domain — `IDebugEventsService`: event-subscription + * introspection. + * + * Public contract. `subscriptions()` merges two sides: the precise unit-book + * side (every materialized unit's ledger entries whose label marks an event + * subscription — `on:` from a named `Emitter` or the fiber `on` + * capability, `disposable:EventSubscription` from an unnamed emitter) and the + * emitter-side fallback (listener counts of every materialized `IEventBus` + * instance and the global `IEventService`), which also covers subscriptions + * the caller never registered on a unit book. Unmaterialized on-demand units + * and anonymous fiber units are not enumerable and are simply absent. + * Contributed at App scope through `DebugEventsFeature` — reachable over the + * debug RPC surface by decorator name, but absent from the static scoped + * registry (`GET /api/v1/debug/channels`). All payloads are JSON-serializable + * wire data. + */ + +import { createDecorator } from '#/_base/di/instantiation'; +import type { LedgerEntryInfo } from '#/_base/lifecycle/ledger'; + +export interface DebugEventSubscription { + readonly scopePath: string; + readonly unit: string; + readonly uid?: number; + readonly label: string; + readonly kind: LedgerEntryInfo['kind']; +} + +export interface DebugEventBusSnapshot { + readonly scopePath: string; + readonly all: number; + readonly perType: Record; +} + +export interface DebugEventSubscriptions { + readonly subscriptions: DebugEventSubscription[]; + readonly buses: DebugEventBusSnapshot[]; + readonly globalListeners?: number; +} + +export interface IDebugEventsService { + readonly _serviceBrand: undefined; + + subscriptions(): DebugEventSubscriptions; +} + +export const IDebugEventsService = createDecorator('debugEventsService'); diff --git a/packages/agent-core-v2/src/features/debugEvents/debugEventsFeature.ts b/packages/agent-core-v2/src/features/debugEvents/debugEventsFeature.ts new file mode 100644 index 00000000000..f5ab880bb3f --- /dev/null +++ b/packages/agent-core-v2/src/features/debugEvents/debugEventsFeature.ts @@ -0,0 +1,31 @@ +/** + * `debugEvents` domain — `DebugEventsFeature`: the event-subscription + * introspection capability assembled as one App-scope Feature unit. + * + * Contributes the App-scope `IDebugEventsService` (OnDemand) through the + * `features` base-class seam; retracting the unit withdraws the service + * across the scope tree. The service is intentionally absent from the static + * scoped registry — the debug RPC dispatcher reaches it by decorator-name + * fallback. Registered into the feature table at import. + */ + +import { ScopeActivation } from '#/_base/di/instantiation'; +import { LifecycleScope } from '#/app/scopes'; +import { Feature } from '#/features/feature'; +import { registerFeature } from '#/features/featureRegistry'; + +import { IDebugEventsService } from './debugEvents'; +import { DebugEventsService } from './debugEventsService'; + +export class DebugEventsFeature extends Feature { + static override readonly name = 'debugEvents'; + + constructor() { + super(); + this.contributeService(LifecycleScope.App, IDebugEventsService, DebugEventsService, { + activation: ScopeActivation.OnDemand, + }); + } +} + +registerFeature(DebugEventsFeature); diff --git a/packages/agent-core-v2/src/features/debugEvents/debugEventsService.ts b/packages/agent-core-v2/src/features/debugEvents/debugEventsService.ts new file mode 100644 index 00000000000..08bdc74a3aa --- /dev/null +++ b/packages/agent-core-v2/src/features/debugEvents/debugEventsService.ts @@ -0,0 +1,120 @@ +/** + * `debugEvents` domain — `IDebugEventsService` implementation. + * + * Read-only introspection over the kernel's debug accessors (`children` / + * `servicesSnapshot` / `fiberHost.materializedInstance` / unit-book + * `ledger.entries`), plus listener counters on the `event` domain's bus + * implementations; no kernel state is mutated. Instances resolve up the parent + * chain, so each is attributed to the first container that reaches it and + * deduplicated by identity; unmaterialized on-demand units read as `undefined` + * and are skipped. Contributed at App scope through `DebugEventsFeature`; the + * injected container is the tree root. + */ + +import { IInstantiationService } from '#/_base/di/instantiation'; +import type { InstantiationService } from '#/_base/di/instantiationService'; +import type { LedgerEntryInfo } from '#/_base/lifecycle/ledger'; +import { IEventService } from '#/app/event/event'; +import { IEventBus } from '#/app/event/eventBus'; +import { walkScopeContainers } from '#/debug/scopeTree'; + +import { + IDebugEventsService, + type DebugEventBusSnapshot, + type DebugEventSubscription, + type DebugEventSubscriptions, +} from './debugEvents'; + +interface UnitBookOwner { + readonly unitBook: { entries(): LedgerEntryInfo[] }; +} + +interface BusCountSource { + listenerCounts(): { all: number; perType: Record }; +} + +interface GlobalCountSource { + readonly listenerCount: number; +} + +export class DebugEventsService implements IDebugEventsService { + declare readonly _serviceBrand: undefined; + + private readonly root: InstantiationService; + + constructor(@IInstantiationService instantiation: IInstantiationService) { + this.root = instantiation as InstantiationService; + } + + subscriptions(): DebugEventSubscriptions { + const subscriptions: DebugEventSubscription[] = []; + const buses: DebugEventBusSnapshot[] = []; + const seenUnits = new Set(); + const seenBuses = new Set(); + for (const info of walkScopeContainers(this.root)) { + for (const registration of info.container.servicesSnapshot()) { + const id = info.container.findIdentifier(registration.token); + if (id === undefined) { + continue; + } + const instance: unknown = info.container.fiberHost.materializedInstance(id); + if (typeof instance !== 'object' || instance === null || seenUnits.has(instance)) { + continue; + } + seenUnits.add(instance); + if ('unitBook' in instance) { + collectEventEntries((instance as UnitBookOwner).unitBook.entries(), subscriptions, { + scopePath: info.path, + unit: registration.token, + uid: registration.uid, + }); + } + } + const bus: unknown = info.container.fiberHost.materializedInstance(IEventBus); + if (isBusCountSource(bus) && !seenBuses.has(bus)) { + seenBuses.add(bus); + buses.push({ scopePath: info.path, ...bus.listenerCounts() }); + } + } + const globalEvents: unknown = this.root.fiberHost.materializedInstance(IEventService); + const globalListeners = isGlobalCountSource(globalEvents) + ? globalEvents.listenerCount + : undefined; + return { subscriptions, buses, globalListeners }; + } +} + +function collectEventEntries( + entries: readonly LedgerEntryInfo[], + out: DebugEventSubscription[], + base: { scopePath: string; unit: string; uid?: number }, +): void { + for (const entry of entries) { + if (isEventSubscriptionLabel(entry.label)) { + out.push({ ...base, label: entry.label, kind: entry.kind }); + } + if (entry.children !== undefined) { + collectEventEntries(entry.children, out, base); + } + } +} + +function isEventSubscriptionLabel(label: string): boolean { + return label.startsWith('on:') || label === 'disposable:EventSubscription'; +} + +function isBusCountSource(value: unknown): value is BusCountSource { + return ( + typeof value === 'object' && + value !== null && + typeof (value as BusCountSource).listenerCounts === 'function' + ); +} + +function isGlobalCountSource(value: unknown): value is GlobalCountSource { + return ( + typeof value === 'object' && + value !== null && + typeof (value as GlobalCountSource).listenerCount === 'number' + ); +} diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 6d910fcaba4..e41a76d8f31 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -302,6 +302,9 @@ export * from '#/features/plan/plan'; export * from '#/features/plan/planOps'; export * from '#/features/plan/planService'; import '#/features/plan/planFeature'; +export * from '#/features/debugEvents/debugEvents'; +export * from '#/features/debugEvents/debugEventsService'; +import '#/features/debugEvents/debugEventsFeature'; export * from '#/agent/tools/goal/create-goal/create-goal'; import '#/agent/tools/goal/create-goal/createGoalTool'; export * from '#/agent/tools/goal/get-goal/get-goal'; diff --git a/packages/agent-core-v2/test/_base/event.test.ts b/packages/agent-core-v2/test/_base/event.test.ts index 08d175c254b..8078a2e7be3 100644 --- a/packages/agent-core-v2/test/_base/event.test.ts +++ b/packages/agent-core-v2/test/_base/event.test.ts @@ -168,6 +168,44 @@ describe('Event.None', () => { }); }); +describe('Emitter debug name / EventSubscription ledger labels', () => { + it('named emitter subscriptions land on the store ledger as on:', () => { + const emitter = new Emitter('test.event'); + const store = new DisposableStore(); + + emitter.event(() => undefined, undefined, store); + + expect(store.ledger.entries().map((entry) => entry.label)).toContain('on:test.event'); + store.dispose(); + emitter.dispose(); + }); + + it('unnamed emitter subscriptions fall back to disposable:EventSubscription', () => { + const emitter = new Emitter(); + const store = new DisposableStore(); + + emitter.event(() => undefined, undefined, store); + + expect(store.ledger.entries().map((entry) => entry.label)).toContain( + 'disposable:EventSubscription', + ); + store.dispose(); + emitter.dispose(); + }); + + it('listenerCount tracks subscribe and dispose', () => { + const emitter = new Emitter(); + expect(emitter.listenerCount).toBe(0); + + const subscription = emitter.event(() => undefined); + expect(emitter.listenerCount).toBe(1); + + subscription.dispose(); + expect(emitter.listenerCount).toBe(0); + emitter.dispose(); + }); +}); + describe('Event.once', () => { it('delivers exactly once then auto-disposes', () => { const emitter = new Emitter(); diff --git a/packages/agent-core-v2/test/debug/debug.test.ts b/packages/agent-core-v2/test/debug/debug.test.ts index 1af5c8de357..89a2414a413 100644 --- a/packages/agent-core-v2/test/debug/debug.test.ts +++ b/packages/agent-core-v2/test/debug/debug.test.ts @@ -7,11 +7,21 @@ import { InstantiationService } from '#/_base/di/instantiationService'; import { Service } from '#/_base/di/service'; import { ServiceCollection } from '#/_base/di/serviceCollection'; import { Emitter } from '#/_base/event'; -import type { DomainEvent, IEventService } from '#/app/event/event'; +import { type DomainEvent, IEventService } from '#/app/event/event'; +import { EventService } from '#/app/event/eventService'; +import { IEventBus } from '#/app/event/eventBus'; +import { EventBusService } from '#/app/event/eventBusService'; import { DI_UNIT_CHANGED_EVENT } from '#/debug/debugCascade'; import { DebugCascadeService } from '#/debug/debugCascadeService'; import { DebugGraphService } from '#/debug/debugGraphService'; import { DebugLedgerService } from '#/debug/debugLedgerService'; +import { DebugEventsService } from '#/features/debugEvents/debugEventsService'; + +declare module '#/app/event/eventBus' { + interface DomainEventMap { + 'debug.test': { v: number }; + } +} interface IRoot { @@ -74,6 +84,14 @@ class FakeEventService implements IEventService { } } +class BusSubscriber extends Service { + constructor(@IEventBus bus: IEventBus) { + super(); + this._register(bus.subscribe('debug.test', () => undefined)); + } +} +const IBusSubscriber = createDecorator('debug-bus-subscriber'); + function makeTree(): { app: InstantiationService; ws: InstantiationService } { const app = new InstantiationService(new ServiceCollection(), true); app.debugLabel = 'app'; @@ -272,3 +290,44 @@ describe('debug domain — IDebugCascadeService', () => { app.dispose(); }); }); + +describe('debug domain — IDebugEventsService', () => { + it('subscriptions() merges unit-book labels and bus listener counts, deduped across containers', () => { + const { app } = makeTree(); + app.provide(IEventBus, new SyncDescriptor(EventBusService)); + app.provide(IBusSubscriber, new SyncDescriptor(BusSubscriber)); + app.invokeFunction((a) => a.get(IBusSubscriber)); + const bus = app.invokeFunction((a) => a.get(IEventBus)); + bus.subscribe('debug.test', () => undefined); + bus.subscribe(() => undefined); + + const result = new DebugEventsService(app).subscriptions(); + + const entry = result.subscriptions.find((s) => s.unit === 'debug-bus-subscriber'); + expect(entry).toMatchObject({ + scopePath: 'app', + label: 'on:debug.test', + kind: 'disposer', + uid: expect.any(Number), + }); + expect(result.buses).toEqual([ + { scopePath: 'app', all: 1, perType: { 'debug.test': 2 } }, + ]); + expect(() => JSON.stringify(result)).not.toThrow(); + app.dispose(); + }); + + it('skips unmaterialized units and reports the global event service listener count', () => { + const { app } = makeTree(); + app.provide(IBusSubscriber, new SyncDescriptor(BusSubscriber)); + app.provide(IEventService, new SyncDescriptor(EventService)); + const events = app.invokeFunction((a) => a.get(IEventService)); + events.subscribe(() => undefined); + + const result = new DebugEventsService(app).subscriptions(); + + expect(result.subscriptions.find((s) => s.unit === 'debug-bus-subscriber')).toBeUndefined(); + expect(result.globalListeners).toBe(1); + app.dispose(); + }); +}); diff --git a/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts b/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts new file mode 100644 index 00000000000..e4899897871 --- /dev/null +++ b/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts @@ -0,0 +1,64 @@ +import { beforeEach, describe, expect, it } from 'vitest'; + +import { ScopeActivation } from '#/_base/di/instantiation'; +import { + _clearScopedRegistryForTests, + getScopedServiceDescriptors, + registerScopedService, +} from '#/_base/di/scope'; +import { createScopedTestHost } from '#/_base/di/test'; +import { IFeatureManager } from '#/app/feature/featureManager'; +import { FeatureManagerService } from '#/app/feature/featureManagerService'; +import { LifecycleScope } from '#/app/scopes'; +import { IFeatureAssemblyService } from '#/features/featureAssembly'; +import { FeatureAssemblyService } from '#/features/featureAssemblyService'; +import { _clearFeatureRecipesForTests, registerFeature } from '#/features/featureRegistry'; + +import { IDebugEventsService } from '#/features/debugEvents/debugEvents'; +import { DebugEventsFeature } from '#/features/debugEvents/debugEventsFeature'; + +describe('DebugEventsFeature — App-scope introspection service', () => { + beforeEach(() => { + _clearScopedRegistryForTests(); + _clearFeatureRecipesForTests(); + registerScopedService( + LifecycleScope.App, + IFeatureManager, + FeatureManagerService, + ScopeActivation.OnScopeCreated, + 'feature', + ); + registerScopedService( + LifecycleScope.App, + IFeatureAssemblyService, + FeatureAssemblyService, + ScopeActivation.OnScopeCreated, + 'features', + ); + registerFeature(DebugEventsFeature); + }); + + it('contributes IDebugEventsService at App scope outside the static scoped registry', async () => { + expect( + getScopedServiceDescriptors(LifecycleScope.App).some( + (entry) => entry.id.toString() === 'debugEventsService', + ), + ).toBe(false); + + const host = createScopedTestHost(); + const manager = host.app.accessor.get(IFeatureManager); + expect(manager.units().map((unit) => unit.name)).toContain('debugEvents'); + + const result = host.app.accessor.get(IDebugEventsService).subscriptions(); + expect(result).toMatchObject({ + subscriptions: expect.any(Array), + buses: expect.any(Array), + }); + + await manager.unprovideUnit('debugEvents'); + await host.app.instantiation.cascade.whenIdle(); + await new Promise((resolve) => setTimeout(resolve, 0)); + expect(() => host.app.accessor.get(IDebugEventsService)).toThrow(); + host.dispose(); + }); +}); diff --git a/packages/kap-server/AGENTS.md b/packages/kap-server/AGENTS.md index 131c15f2c10..c743d7b06f3 100644 --- a/packages/kap-server/AGENTS.md +++ b/packages/kap-server/AGENTS.md @@ -5,7 +5,7 @@ The Kimi Code server, backed by the DI × Scope agent engine (`@moonshot-ai/agen ## Routes - Session create/resume/fork routes compose `ISessionIndex` → `IWorkspaceLifecycleService.handlerFor` → the handler's `ISessionLifecycleService`, and the fs routes resolve session → handler → the Workspace-scope fs services. One exception: `fs:search` also accepts a workspace reference (registered id or absolute root) in the `{session_id}` slot, so a not-yet-created draft session's `@` file mention resolves the workspace handler directly; the first-class session-less form is `POST /api/v1/workspace/fs:search` (the workspace reference travels in the body). -- The RPC surface is `/api/v1/debug/*` — a reflection dispatcher over the ENTIRE scoped DI registry (every Service callable, no whitelist, Workspace scope addressable alongside App/Session/Agent; `src/transport/registerDebugRoutes.ts` + `serviceDispatcherRoutes.ts`), mounted only with `--debug-endpoints` on a loopback bind and gated by the global bearer auth; repo dev scripts pass the flag. +- The RPC surface is `/api/v1/debug/*` — a reflection dispatcher over the ENTIRE scoped DI registry (every Service callable, no whitelist, Workspace scope addressable alongside App/Session/Agent; `src/transport/registerDebugRoutes.ts` + `serviceDispatcherRoutes.ts`), mounted only with `--debug-endpoints` on a loopback bind and gated by the global bearer auth; repo dev scripts pass the flag. Lookup falls back to the global decorator registry, so runtime-contributed Services that bypass the static scoped registry (e.g. a Feature's `contributeService`) stay callable even though `GET /channels` does not list them. ## `/api/v2` surface diff --git a/packages/kap-server/src/transport/channelRegistry.ts b/packages/kap-server/src/transport/channelRegistry.ts index 2bf20314cdc..48f84530c7e 100644 --- a/packages/kap-server/src/transport/channelRegistry.ts +++ b/packages/kap-server/src/transport/channelRegistry.ts @@ -1,6 +1,9 @@ /** * `/api/v1/debug` channel registry — the set of Services exposed over the - * wire, which is simply the ENTIRE scoped DI registry (no whitelist). + * wire: the ENTIRE scoped DI registry (no whitelist), plus any Service + * resolvable by decorator name as a fallback, so runtime-contributed units + * (Feature `contributeService`, which bypasses the static scoped registry) + * stay callable. * * In VS Code's `registerChannel` model a Service is registered once, keyed by * its decorator id (the public channel name), and from then on all of its @@ -13,6 +16,7 @@ import { Disposable, getScopedServiceDescriptors, LifecycleScope, + lookupServiceDecorator, } from '@moonshot-ai/agent-core-v2'; import type { ScopedEntry, ServiceIdentifier } from '@moonshot-ai/agent-core-v2'; @@ -83,7 +87,7 @@ function scopedServiceNameIndex(): Map> { /** Resolve a wire name to its `ServiceIdentifier` anywhere in the DI registry. */ export function resolveAnyScopedServiceId(name: string): ServiceIdentifier | undefined { - return scopedServiceNameIndex().get(name); + return scopedServiceNameIndex().get(name) ?? lookupServiceDecorator(name); } /** diff --git a/packages/kap-server/src/transport/serviceDispatcherRoutes.ts b/packages/kap-server/src/transport/serviceDispatcherRoutes.ts index 81163cb7a65..4a17799131b 100644 --- a/packages/kap-server/src/transport/serviceDispatcherRoutes.ts +++ b/packages/kap-server/src/transport/serviceDispatcherRoutes.ts @@ -3,7 +3,8 @@ * * Mounts the reflection dispatcher under `basePath`: the routes mirror the * scope tree; all share one handler. `:service` is a decorator id (channel - * name) resolved against the scoped DI registry; `:method` is invoked by + * name) resolved against the scoped DI registry, then the global decorator + * registry (runtime-contributed Services); `:method` is invoked by * reflection. Reads use `GET`, writes use `POST`. * * GET|POST {basePath}/:service/:method diff --git a/packages/kap-server/test/rpc.test.ts b/packages/kap-server/test/rpc.test.ts index 88f6107afd6..b0154f31888 100644 --- a/packages/kap-server/test/rpc.test.ts +++ b/packages/kap-server/test/rpc.test.ts @@ -9,6 +9,7 @@ import { IAgentRPCService, IAgentShellCommandService, IAppendLogStore, + IDebugEventsService, IEventService, IPluginService, ISessionIndex, @@ -187,6 +188,28 @@ describe('server-v2 /api/v1/debug RPC', () => { expect(meta?.methods.map((m) => m.name)).not.toContain('dispose'); }); + it('reaches a runtime-contributed Service absent from /channels (decorator-name fallback)', async () => { + // IDebugEventsService comes from DebugEventsFeature's contributeService, + // which bypasses the static scoped registry: /channels omits it, but the + // dispatcher still resolves it through the global decorator registry. + const channels = await call( + 'GET', + '/api/v1/debug/channels', + ); + expect(channels.body.data.some((c) => c.name === String(IDebugEventsService))).toBe(false); + + const { status, body } = await call<{ + subscriptions: unknown[]; + buses: unknown[]; + globalListeners?: number; + }>('GET', rpc('core', IDebugEventsService, 'subscriptions')); + expect(status).toBe(200); + expect(body.code).toBe(0); + expect(Array.isArray(body.data.subscriptions)).toBe(true); + expect(Array.isArray(body.data.buses)).toBe(true); + expect(typeof body.data.globalListeners).toBe('number'); + }); + it('lists sessions via GET', async () => { const { body } = await call<{ items: unknown[]; has_more: boolean }>( 'GET', From 64abebc95a13b066fefc4f96b062824ea5ec996b Mon Sep 17 00:00:00 2001 From: HydrogenE7 Date: Tue, 11 Aug 2026 19:55:13 +0800 Subject: [PATCH 06/50] fix(apps/kimi-code): allow deselecting Other option in multi-select question dialog (#2810) --- .changeset/fix-multi-select-other-deselect.md | 5 +++ .../tui/components/dialogs/question-dialog.ts | 6 ++++ .../dialogs/question-dialog.test.ts | 36 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 .changeset/fix-multi-select-other-deselect.md diff --git a/.changeset/fix-multi-select-other-deselect.md b/.changeset/fix-multi-select-other-deselect.md new file mode 100644 index 00000000000..6db9703fe8e --- /dev/null +++ b/.changeset/fix-multi-select-other-deselect.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix multi-select "Other" options so they can be deselected after being committed. diff --git a/apps/kimi-code/src/tui/components/dialogs/question-dialog.ts b/apps/kimi-code/src/tui/components/dialogs/question-dialog.ts index 6764b88d8f3..68187349c13 100644 --- a/apps/kimi-code/src/tui/components/dialogs/question-dialog.ts +++ b/apps/kimi-code/src/tui/components/dialogs/question-dialog.ts @@ -299,6 +299,12 @@ export class QuestionDialogComponent extends Container implements Focusable { this.reviewMessage = undefined; if (this.isOtherOption(questionIdx, optionIdx)) { + if (question.multi_select && this.multiSelections[questionIdx]?.has(optionIdx)) { + this.multiSelections[questionIdx].delete(optionIdx); + this.lastAnswerMethod = method; + this.updateAnswer(questionIdx); + return; + } this.enterOtherInput(questionIdx); return; } diff --git a/apps/kimi-code/test/tui/components/dialogs/question-dialog.test.ts b/apps/kimi-code/test/tui/components/dialogs/question-dialog.test.ts index 812ac0d94b1..322d10e9135 100644 --- a/apps/kimi-code/test/tui/components/dialogs/question-dialog.test.ts +++ b/apps/kimi-code/test/tui/components/dialogs/question-dialog.test.ts @@ -394,6 +394,42 @@ describe('QuestionDialogComponent', () => { expect(out).toContain('Mushroom'); }); + it('multi-select Other can be toggled off after it is committed', () => { + const pending = makePending([ + { + question: 'Pick toppings?', + multi_select: true, + options: [{ label: 'Cheese' }, { label: 'Pepperoni' }], + }, + ]); + const { dialog, collected } = makeDialog(pending); + + // Select Other and commit a custom value. + dialog.handleInput('3'); + dialog.handleInput('M'); + dialog.handleInput('u'); + dialog.handleInput('s'); + dialog.handleInput('h'); + dialog.handleInput('r'); + dialog.handleInput('o'); + dialog.handleInput('o'); + dialog.handleInput('m'); + dialog.handleInput('\r'); + + // Toggle it off using the same key. + dialog.handleInput('3'); + // Select a preset option to confirm the answer still builds correctly. + dialog.handleInput('1'); + dialog.handleInput('\t'); + + const review = strip(dialog.render(80).join('\n')); + expect(review).toContain('Cheese'); + expect(review).not.toContain('Mushroom'); + + dialog.handleInput('1'); + expect(collected).toEqual([['Cheese']]); + }); + it('escape dismisses with empty answers array', () => { const pending = makePending([ { From 158c81d7055587d582ca424f9b913426fca42559 Mon Sep 17 00:00:00 2001 From: HydrogenE7 Date: Tue, 11 Aug 2026 21:13:08 +0800 Subject: [PATCH 07/50] fix: surface a readable error when Git Bash is missing on Windows (#2814) * fix: surface a readable error when Git Bash is missing on Windows * fix(agent-core-v2): translate probe rejection into HostProcessError for ready awaiters - HostEnvironmentService.ready now rejects with the translated HostProcessError(shell.git_bash_not_found) instead of the raw ProbeShellNotFoundError, matching what sync field reads throw and what SDKRpcClientV2.ensureConfigFile() surfaces, while an internal no-op handler keeps the rejection from becoming an unhandledRejection. - Replace the Windows-gated probe-failure tests with vi.mock-stubbed deterministic suites that run identically on any platform. - Move the ProbeShellNotFoundError explanation into the environmentProbe file header per the package comment convention. * fix(agent-core-v2): narrow probe error to Error to satisfy only-throw-error lint * fix(agent-core-v2): preserve probe error as cause when translating to HostProcessError * fix(agent-core-v2): keep checked paths out of the public probe error message * fix(node-sdk): gate the host-environment wait in ensureConfigFile to Windows The missing-Git-Bash failure is Windows-only, and IHostEnvironment.ready also covers the login-shell PATH enrichment, which spawns the user's login shell with a 5s timeout. Awaiting it on POSIX coupled config-only commands (kimi provider list/remove, export, ...) to the user's shell profile for no benefit. --------- Co-authored-by: liruifengv --- .changeset/fix-windows-missing-git-bash.md | 5 ++ .../src/_base/execEnv/environmentProbe.ts | 24 +++++-- .../node-local/hostEnvironmentService.ts | 37 +++++++++- .../src/os/interface/hostProcess.ts | 1 + .../_base/execEnv/environmentProbe.test.ts | 17 +++++ .../node-local/hostEnvironmentService.test.ts | 72 +++++++++++++++++++ packages/node-sdk/src/sdk-rpc-client-v2.ts | 7 ++ .../node-sdk/test/sdk-rpc-client-v2.test.ts | 72 ++++++++++++++++++- 8 files changed, 226 insertions(+), 9 deletions(-) create mode 100644 .changeset/fix-windows-missing-git-bash.md create mode 100644 packages/agent-core-v2/test/os/backends/node-local/hostEnvironmentService.test.ts diff --git a/.changeset/fix-windows-missing-git-bash.md b/.changeset/fix-windows-missing-git-bash.md new file mode 100644 index 00000000000..256ec5aa781 --- /dev/null +++ b/.changeset/fix-windows-missing-git-bash.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Show a clear error message on Windows when Git for Windows is not installed, instead of exiting silently. diff --git a/packages/agent-core-v2/src/_base/execEnv/environmentProbe.ts b/packages/agent-core-v2/src/_base/execEnv/environmentProbe.ts index 3e4d03d9784..a9c4e5ffc8e 100644 --- a/packages/agent-core-v2/src/_base/execEnv/environmentProbe.ts +++ b/packages/agent-core-v2/src/_base/execEnv/environmentProbe.ts @@ -7,9 +7,12 @@ * same suite runs identically on any host OS. `probeHostEnvironmentFromNode()` * bundles the Node defaults for production callers and memoises the promise. * - * On Windows the probe expects bash from Git for Windows or MSYS2. If it - * cannot be located the function throws a plain `Error` with the checked paths - * in the message. Set `KIMI_SHELL_PATH` to override. + * On Windows the probe expects bash from Git for Windows or MSYS2. If no + * shell can be located the function throws `ProbeShellNotFoundError`, a + * distinct type carrying the checked paths (`checked`) with an install hint + * in its message, so the DI boundary can tell a missing shell apart from + * other probe errors and translate it into a coded error. Set + * `KIMI_SHELL_PATH` to override. * * Kept as a pure helper with no DI dependencies. */ @@ -24,6 +27,16 @@ export type OsKind = string; export type ShellName = 'bash' | 'sh'; export type PathClass = 'posix' | 'win32'; +export class ProbeShellNotFoundError extends Error { + readonly checked: readonly string[]; + + constructor(message: string, checked: readonly string[]) { + super(message); + this.name = 'ProbeShellNotFoundError'; + this.checked = checked; + } +} + export interface HostEnvironmentInfo { readonly osKind: OsKind; readonly osArch: string; @@ -181,8 +194,9 @@ async function locateWindowsGitBash(deps: HostEnvironmentProbeDeps): Promise; constructor() { @@ -35,10 +45,20 @@ export class HostEnvironmentService implements IHostEnvironment { this._info = info; }), applyLoginShellPathFromNode(), - ]).then(() => {}); + ]) + .then(() => {}) + .catch((error: unknown) => { + const translated = this.toHostProcessError(error); + this._probeError = translated; + throw translated; + }); + this.ready.catch(() => {}); } private require(field: keyof HostEnvironmentInfo): never | HostEnvironmentInfo[typeof field] { + if (this._probeError !== undefined) { + throw this._probeError; + } if (this._info === undefined) { throw new BugIndicatingError( `IHostEnvironment.${field} accessed before ready — await IHostEnvironment.ready first (composition root should do so before creating a Session scope).`, @@ -47,6 +67,17 @@ export class HostEnvironmentService implements IHostEnvironment { return this._info[field]; } + private toHostProcessError(error: unknown): Error { + if (error instanceof ProbeShellNotFoundError) { + return new HostProcessError( + OsProcessErrors.codes.SHELL_GIT_BASH_NOT_FOUND, + error.message, + { details: { checkedPaths: error.checked }, cause: error }, + ); + } + return error instanceof Error ? error : new Error(String(error)); + } + get osKind(): OsKind { return this.require('osKind') as OsKind; } diff --git a/packages/agent-core-v2/src/os/interface/hostProcess.ts b/packages/agent-core-v2/src/os/interface/hostProcess.ts index 20242ab82fd..d81aaee464e 100644 --- a/packages/agent-core-v2/src/os/interface/hostProcess.ts +++ b/packages/agent-core-v2/src/os/interface/hostProcess.ts @@ -82,6 +82,7 @@ registerErrorDomain(OsProcessErrors); export const HostProcessErrorCode = { SpawnFailed: OsProcessErrors.codes.OS_PROCESS_SPAWN_FAILED, KillFailed: OsProcessErrors.codes.OS_PROCESS_KILL_FAILED, + ShellGitBashNotFound: OsProcessErrors.codes.SHELL_GIT_BASH_NOT_FOUND, } as const; export type HostProcessErrorCode = (typeof HostProcessErrorCode)[keyof typeof HostProcessErrorCode]; diff --git a/packages/agent-core-v2/test/_base/execEnv/environmentProbe.test.ts b/packages/agent-core-v2/test/_base/execEnv/environmentProbe.test.ts index 9e084a0ebc5..7cc4b7f2252 100644 --- a/packages/agent-core-v2/test/_base/execEnv/environmentProbe.test.ts +++ b/packages/agent-core-v2/test/_base/execEnv/environmentProbe.test.ts @@ -20,6 +20,7 @@ import { describe, expect, it } from 'vitest'; import { probeHostEnvironment, + ProbeShellNotFoundError, type HostEnvironmentProbeDeps, } from '#/_base/execEnv/environmentProbe'; @@ -96,4 +97,20 @@ describe('probeHostEnvironment', () => { expect(env.shellName).toBe('bash'); expect(env.shellPath).toBe('C:\\msys64\\usr\\bin\\bash.exe'); }); + + it('throws ProbeShellNotFoundError when Git Bash is missing on Windows', async () => { + const rejected: unknown = await probeHostEnvironment( + stubDeps({ + platform: 'win32', + env: { PATH: 'C:\\Windows\\System32' }, + existingPaths: [], + }), + ).catch((error: unknown) => error); + + expect(rejected).toBeInstanceOf(ProbeShellNotFoundError); + const probeError = rejected as ProbeShellNotFoundError; + expect(probeError.message).toContain('https://gitforwindows.org/'); + expect(probeError.message).not.toContain('Checked:'); + expect(probeError.checked.length).toBeGreaterThan(0); + }); }); diff --git a/packages/agent-core-v2/test/os/backends/node-local/hostEnvironmentService.test.ts b/packages/agent-core-v2/test/os/backends/node-local/hostEnvironmentService.test.ts new file mode 100644 index 00000000000..4215819450c --- /dev/null +++ b/packages/agent-core-v2/test/os/backends/node-local/hostEnvironmentService.test.ts @@ -0,0 +1,72 @@ +/** + * HostEnvironmentService — shell-probe error handling. + * + * Stubs the host-environment probe to fail the way a Windows host without Git + * Bash does, so the suite runs identically on any platform. Pins the failure + * contract: `ready` rejects with the translated `HostProcessError` + * (`shell.git_bash_not_found`), sync field reads after a failed probe throw + * the same coded error, and the rejection never surfaces as an + * unhandledRejection while the App scope is being constructed (vitest fails + * the file on any unhandled rejection). + */ + +import { describe, expect, it, vi } from 'vitest'; + +import { ProbeShellNotFoundError } from '#/_base/execEnv/environmentProbe'; +import { HostEnvironmentService } from '#/os/backends/node-local/hostEnvironmentService'; +import { HostProcessError, OsProcessErrors } from '#/os/interface/hostProcess'; + +vi.mock('#/_base/execEnv/environmentProbe', async (importOriginal) => { + const actual = await importOriginal(); + return { + ...actual, + probeHostEnvironmentFromNode: () => + Promise.reject( + new actual.ProbeShellNotFoundError('Git Bash missing (stubbed)', [ + 'C:\\Program Files\\Git\\bin\\bash.exe', + ]), + ), + }; +}); + +vi.mock('#/_base/execEnv/loginShellPath', () => ({ + applyLoginShellPathFromNode: () => Promise.resolve(), +})); + +describe('HostEnvironmentService', () => { + it('rejects ready with the translated HostProcessError when the probe fails', async () => { + const service = new HostEnvironmentService(); + + await expect(service.ready).rejects.toBeInstanceOf(HostProcessError); + await expect(service.ready).rejects.toMatchObject({ + code: OsProcessErrors.codes.SHELL_GIT_BASH_NOT_FOUND, + }); + }); + + it('preserves the probe error as cause and checked paths as details', async () => { + const service = new HostEnvironmentService(); + + const rejected: unknown = await service.ready.catch((error: unknown) => error); + + expect(rejected).toBeInstanceOf(HostProcessError); + const hostError = rejected as HostProcessError; + expect(hostError.details).toEqual({ checkedPaths: ['C:\\Program Files\\Git\\bin\\bash.exe'] }); + expect(hostError.cause).toBeInstanceOf(ProbeShellNotFoundError); + }); + + it('does not surface the ready rejection as an unhandledRejection', async () => { + const service = new HostEnvironmentService(); + + await new Promise((resolve) => setTimeout(resolve, 0)); + + await expect(service.ready).rejects.toBeInstanceOf(HostProcessError); + }); + + it('throws HostProcessError when reading fields after a failed probe', async () => { + const service = new HostEnvironmentService(); + await service.ready.catch(() => {}); + + expect(() => service.shellPath).toThrow(HostProcessError); + expect(() => service.osKind).toThrow(HostProcessError); + }); +}); diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index e95bcee56fd..2969b42b93e 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -482,6 +482,13 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { async ensureConfigFile(): Promise { await ensureConfigFile(this.configPath); + // Surface a missing Git Bash early, before the TUI starts. The wait is + // Windows-only: the failure cannot happen on POSIX, and `ready` also + // covers the login-shell PATH enrichment, which spawns the user's login + // shell (5s timeout) — config-only commands must not block on that. + if (process.platform === 'win32') { + await this.app.accessor.get(IHostEnvironment).ready; + } } async close(): Promise { diff --git a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts index 5c6bad93a4b..f99266eb007 100644 --- a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts +++ b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts @@ -11,7 +11,7 @@ import { mkdir, mkdtemp, readdir, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; -import { afterEach, describe, expect, it } from 'vitest'; +import { afterEach, describe, expect, it, vi } from 'vitest'; import { createKimiHarnessV2, @@ -26,7 +26,9 @@ import { foldAgentWireReplay } from '#/v2/resume-replay'; import { drainQueryStoreDisposals, drainSessionIndexMirror, + HostProcessError, IHostRequestHeaders, + OsProcessErrors, } from '@moonshot-ai/agent-core-v2'; import { McpOAuthService } from '../../agent-core/src/mcp/oauth/service'; @@ -35,6 +37,25 @@ import { TEST_IDENTITY } from './test-identity'; import { startMcpAuthStatusServer } from './mcp-auth-status-server'; import { recordingTelemetry, type TelemetryRecord } from './telemetry'; +const hostEnvProbe = vi.hoisted(() => ({ failWithMissingShell: false })); + +vi.mock('@moonshot-ai/agent-core-v2/_base/execEnv/environmentProbe', async (importOriginal) => { + const actual = await importOriginal< + typeof import('@moonshot-ai/agent-core-v2/_base/execEnv/environmentProbe') + >(); + return { + ...actual, + probeHostEnvironmentFromNode: () => + hostEnvProbe.failWithMissingShell + ? Promise.reject( + new actual.ProbeShellNotFoundError('Git Bash missing (stubbed)', [ + 'C:\\Program Files\\Git\\bin\\bash.exe', + ]), + ) + : actual.probeHostEnvironmentFromNode(), + }; +}); + const tempDirs: string[] = []; afterEach(async () => { @@ -47,6 +68,16 @@ afterEach(async () => { } }); +function stubProcessPlatform(platform: NodeJS.Platform): () => void { + const descriptor = Object.getOwnPropertyDescriptor(process, 'platform'); + Object.defineProperty(process, 'platform', { value: platform, configurable: true }); + return () => { + if (descriptor !== undefined) { + Object.defineProperty(process, 'platform', descriptor); + } + }; +} + async function makeHarness(): Promise<{ harness: KimiHarness; homeDir: string }> { const homeDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-')); tempDirs.push(homeDir); @@ -147,6 +178,45 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { } }); + it('surfaces a missing Git Bash probe failure during ensureConfigFile on Windows', async () => { + hostEnvProbe.failWithMissingShell = true; + const restorePlatform = stubProcessPlatform('win32'); + try { + const homeDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-')); + tempDirs.push(homeDir); + const harness = createKimiHarnessV2({ homeDir, identity: TEST_IDENTITY }); + try { + await expect(harness.ensureConfigFile()).rejects.toBeInstanceOf(HostProcessError); + await expect(harness.ensureConfigFile()).rejects.toMatchObject({ + code: OsProcessErrors.codes.SHELL_GIT_BASH_NOT_FOUND, + }); + } finally { + await harness.close(); + } + } finally { + hostEnvProbe.failWithMissingShell = false; + restorePlatform(); + } + }); + + it('does not block ensureConfigFile on the host environment probe on POSIX', async () => { + hostEnvProbe.failWithMissingShell = true; + const restorePlatform = stubProcessPlatform('darwin'); + try { + const homeDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-')); + tempDirs.push(homeDir); + const harness = createKimiHarnessV2({ homeDir, identity: TEST_IDENTITY }); + try { + await expect(harness.ensureConfigFile()).resolves.toBeUndefined(); + } finally { + await harness.close(); + } + } finally { + hostEnvProbe.failWithMissingShell = false; + restorePlatform(); + } + }); + it('serves getExperimentalFeatures from the v2 engine', async () => { const { harness } = await makeHarness(); try { From ad12ad8a140d24051d93ec98a4a6921ab33723ff Mon Sep 17 00:00:00 2001 From: liruifengv Date: Tue, 11 Aug 2026 21:32:39 +0800 Subject: [PATCH 08/50] feat(kimi-code): show live background agent activity in the /tasks panel (#2816) * feat(kimi-code): show live background agent activity in the /tasks panel Background agents (run_in_background or Ctrl+B) showed no run details: the /tasks panel only had static metadata, and its output view stays "[no output captured]" until completion because agent tasks capture output only once at the end. Tee child-agent events into a bounded in-memory per-agent activity store segmented by the engine's own turn.step.started events (recent 10 steps, bounded text/output tails). The /tasks preview pane now shows a live activity preview for agent tasks, and Enter/O opens a full-screen detail view rendering step-grouped Markdown text and per-tool results through the main transcript's renderers, with Ctrl+O to expand. Agent tasks without an in-memory record (e.g. lost after resume) fall back to the captured-output view. * feat(kimi-code): retain 20 recent steps in the background agent activity view * fix(kimi-code): cap the streaming-args buffer in the subagent activity store * chore(kimi-code): simplify the background agent activity changeset * fix(kimi-code): drop activity records of foreground-only subagents at terminal state * fix(kimi-code): cap retained tool argument strings in the subagent activity store * test(acp-server): retry temp-dir cleanup to deflake ENOTEMPTY on CI * fix(kimi-code): tighten subagent activity store lifecycle edges - drop delta-only arg buffers when their step is evicted - keep records of spawn-time background agents even when the task sync lags - mark records terminal on background.task.terminated for stopped agents that never emit subagent.failed * fix(kimi-code): release leftover arg buffers when an activity record turns terminal * fix(kimi-code): prune foreground-only activity records when the main turn ends --- .changeset/background-agent-activity-view.md | 5 + .../dialogs/agent-activity-viewer.ts | 434 ++++++++++++++++++ .../components/dialogs/task-output-viewer.ts | 4 +- .../src/tui/components/messages/tool-call.ts | 2 +- apps/kimi-code/src/tui/constant/rendering.ts | 12 + .../tui/controllers/session-event-handler.ts | 19 + .../controllers/subagent-activity-store.ts | 347 ++++++++++++++ .../tui/controllers/subagent-event-handler.ts | 43 ++ .../src/tui/controllers/tasks-browser.ts | 119 ++++- .../dialogs/agent-activity-viewer.test.ts | 315 +++++++++++++ ...sion-event-handler-background-task.test.ts | 220 +++++++++ .../subagent-activity-store.test.ts | 294 ++++++++++++ apps/kimi-code/test/tui/tasks-browser.test.ts | 126 ++++- packages/acp-server/test/acp-fs.test.ts | 2 +- packages/acp-server/test/close.test.ts | 2 +- packages/acp-server/test/config.test.ts | 2 +- packages/acp-server/test/convert.test.ts | 2 +- packages/acp-server/test/e2e-turn.test.ts | 8 +- packages/acp-server/test/initialize.test.ts | 6 +- packages/acp-server/test/lifecycle.test.ts | 2 +- packages/acp-server/test/skills.test.ts | 2 +- 21 files changed, 1947 insertions(+), 19 deletions(-) create mode 100644 .changeset/background-agent-activity-view.md create mode 100644 apps/kimi-code/src/tui/components/dialogs/agent-activity-viewer.ts create mode 100644 apps/kimi-code/src/tui/controllers/subagent-activity-store.ts create mode 100644 apps/kimi-code/test/tui/components/dialogs/agent-activity-viewer.test.ts create mode 100644 apps/kimi-code/test/tui/controllers/session-event-handler-background-task.test.ts create mode 100644 apps/kimi-code/test/tui/controllers/subagent-activity-store.test.ts diff --git a/.changeset/background-agent-activity-view.md b/.changeset/background-agent-activity-view.md new file mode 100644 index 00000000000..84bae7e688a --- /dev/null +++ b/.changeset/background-agent-activity-view.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": minor +--- + +Show the live work progress of background subagents in the `/tasks` panel. diff --git a/apps/kimi-code/src/tui/components/dialogs/agent-activity-viewer.ts b/apps/kimi-code/src/tui/components/dialogs/agent-activity-viewer.ts new file mode 100644 index 00000000000..6a58d9ffd5b --- /dev/null +++ b/apps/kimi-code/src/tui/components/dialogs/agent-activity-viewer.ts @@ -0,0 +1,434 @@ +/** + * AgentActivityViewer — full-screen detail view for a background agent task. + * + * Same full-screen skeleton as `TaskOutputViewer` (header / scrolling body / + * footer, tail-follow), but the body is assembled from the in-memory + * `SubagentActivityRecord` instead of the task's captured output: recent + * steps with their assistant text (Markdown, same as the main transcript) + * and tool calls rendered through the main-flow result renderers + * (`pickResultRenderer` / `pickChip` / `extractKeyArgument`). `ToolCallComponent` + * itself is not reused — it is a live, event-driven component, while this + * view renders a snapshot. + * + * Ctrl+O toggles a global expand of every tool result (same semantics as the + * main transcript's `toolOutputExpanded`), capped by what the store retained. + */ + +import { + Container, + Key, + matchesKey, + type Focusable, + type Terminal, + truncateToWidth, + visibleWidth, +} from '@moonshot-ai/pi-tui'; +import type { BackgroundTaskInfo } from '@moonshot-ai/kimi-code-sdk'; + +import { MESSAGE_INDENT } from '#/tui/constant/rendering'; +import { STATUS_BULLET } from '#/tui/constant/symbols'; +import type { + SubagentActivityRecord, + SubToolCallActivity, +} from '#/tui/controllers/subagent-activity-store'; +import { currentTheme } from '#/tui/theme'; +import type { ToolCallBlockData } from '#/tui/types'; +import { printableChar } from '#/tui/utils/printable-key'; +import { AssistantMessageComponent } from '../messages/assistant-message'; +import { extractKeyArgument } from '../messages/tool-call'; +import { pickChip } from '../messages/tool-renderers/chip'; +import { pickResultRenderer } from '../messages/tool-renderers/registry'; +import { STATUS_LABEL, statusColor } from './task-output-viewer'; + +const ELLIPSIS = '…'; + +export interface AgentActivityViewerProps { + readonly taskId: string; + readonly info: BackgroundTaskInfo | undefined; + readonly record: SubagentActivityRecord | undefined; + readonly onClose: () => void; +} + +function padToWidth(line: string, width: number): string { + const w = visibleWidth(line); + if (w === width) return line; + if (w > width) return truncateToWidth(line, width, ELLIPSIS); + return line + ' '.repeat(width - w); +} + +function fitExactly(line: string, width: number): string { + let s = line; + if (visibleWidth(s) > width) s = truncateToWidth(s, width, ELLIPSIS); + return padToWidth(s, width); +} + +export class AgentActivityViewer extends Container implements Focusable { + focused = false; + + private props: AgentActivityViewerProps; + private readonly terminal: Terminal; + private expanded = false; + /** Index of the topmost visible body line. */ + private scrollTop = 0; + /** Stick to the bottom on updates until the user scrolls away. */ + private followTail = true; + private lines: string[] = []; + private lastCacheKey = ''; + + constructor(props: AgentActivityViewerProps, terminal: Terminal) { + super(); + this.props = props; + this.terminal = terminal; + } + + setProps(next: AgentActivityViewerProps): void { + this.props = next; + this.invalidate(); + } + + override invalidate(): void { + // Theme switches arrive as a tree-wide invalidate; the styled body lines + // are cached, so drop the cache here to pick up the new palette. + this.lastCacheKey = ''; + super.invalidate(); + } + + // ── input ────────────────────────────────────────────────────────── + + handleInput(data: string): void { + const visible = this.viewableRows(); + const k = printableChar(data); + + if (matchesKey(data, Key.escape) || k === 'q' || k === 'Q') { + this.props.onClose(); + return; + } + if (matchesKey(data, Key.ctrl('o'))) { + this.expanded = !this.expanded; + this.lastCacheKey = ''; + this.invalidate(); + return; + } + if (matchesKey(data, Key.up) || k === 'k') { + this.scrollBy(-1); + return; + } + if (matchesKey(data, Key.down) || k === 'j') { + this.scrollBy(1); + return; + } + if ( + matchesKey(data, Key.pageUp) || + matchesKey(data, Key.ctrl('u')) || + k === ' ' || + data === '\u0002' /* C-b */ + ) { + this.scrollBy(-Math.max(1, visible - 1)); + return; + } + if ( + matchesKey(data, Key.pageDown) || + matchesKey(data, Key.ctrl('d')) || + data === '\u0006' /* C-f */ + ) { + this.scrollBy(Math.max(1, visible - 1)); + return; + } + if (matchesKey(data, Key.home) || k === 'g') { + this.scrollTo(0); + return; + } + if (matchesKey(data, Key.end) || k === 'G') { + this.scrollTo(this.maxScroll()); + return; + } + } + + private scrollBy(delta: number): void { + this.scrollTo(this.scrollTop + delta); + } + + private scrollTo(target: number): void { + this.scrollTop = Math.max(0, Math.min(target, this.maxScroll())); + this.followTail = this.scrollTop >= this.maxScroll(); + this.invalidate(); + } + + private maxScroll(): number { + return Math.max(0, this.lines.length - this.viewableRows()); + } + + /** Content rows inside the body frame: total rows minus header(1) + + * footer(1) + top border(1) + bottom border(1). */ + private viewableRows(): number { + return Math.max(1, this.terminal.rows - 4); + } + + // ── body assembly ────────────────────────────────────────────────── + + private cacheKey(innerWidth: number): string { + const record = this.props.record; + return [ + String(innerWidth), + this.expanded ? 'x' : 'c', + record?.agentId ?? '', + String(record?.version ?? -1), + ].join('|'); + } + + private buildLines(innerWidth: number): string[] { + const record = this.props.record; + if (record === undefined) { + return [currentTheme.dim(`${MESSAGE_INDENT}[no activity recorded]`)]; + } + + const out: string[] = []; + for (const step of record.steps) { + out.push(currentTheme.dim(`── step ${String(step.step)} ──`)); + if (step.retrying !== undefined) { + out.push(currentTheme.fg('warning', `${MESSAGE_INDENT}↻ ${step.retrying}`)); + } + if (step.textTail.trim().length > 0) { + const message = new AssistantMessageComponent(); + message.updateContent(step.textTail); + out.push(...message.render(innerWidth)); + } + for (const call of step.toolCalls) { + out.push(this.buildToolCallHeader(call)); + out.push(...this.renderToolCallBody(call, innerWidth)); + } + out.push(''); + } + + if (record.error !== undefined && record.error.length > 0) { + out.push(currentTheme.fg('error', 'Failed')); + const message = new AssistantMessageComponent(); + message.updateContent(record.error); + out.push(...message.render(innerWidth)); + } else if (record.resultSummary !== undefined && record.resultSummary.length > 0) { + out.push(currentTheme.boldFg('primary', 'Result')); + const message = new AssistantMessageComponent(); + message.updateContent(record.resultSummary); + out.push(...message.render(innerWidth)); + } + + if (out.length === 0) { + out.push(currentTheme.dim(`${MESSAGE_INDENT}Waiting for activity…`)); + } + return out; + } + + /** Same shape as the main flow's generic header (`tool-call.ts` + * `buildHeader`): bullet + verb + name + key argument + chip. Custom + * per-tool label wording (e.g. "Ran a command") is intentionally not + * mirrored — the per-tool *body* renderers carry the specialization. */ + private buildToolCallHeader(call: SubToolCallActivity): string { + let bullet: string; + if (call.status === 'error') { + bullet = currentTheme.fg('error', '✗ '); + } else if (call.status === 'done') { + bullet = currentTheme.fg('success', STATUS_BULLET); + } else { + bullet = currentTheme.fg('text', STATUS_BULLET); + } + const verb = call.status === 'running' ? 'Using' : 'Used'; + const name = currentTheme.boldFg('primary', call.name); + const keyArg = extractKeyArgument(call.name, call.args); + const argStr = keyArg === null || keyArg.length === 0 ? '' : currentTheme.dim(` (${keyArg})`); + + let chipStr = ''; + if (call.result !== undefined) { + const provider = pickChip(call.name); + const text = provider?.(this.toToolCallBlockData(call), call.result) ?? ''; + if (text.length > 0) { + chipStr = + call.result.is_error === true + ? currentTheme.fg('error', ` · ${text}`) + : currentTheme.dim(` · ${text}`); + } + } + return `${bullet}${verb} ${name}${argStr}${chipStr}`; + } + + private renderToolCallBody(call: SubToolCallActivity, innerWidth: number): string[] { + if (call.result === undefined) { + return call.liveOutputTail === undefined || call.liveOutputTail.length === 0 + ? [] + : [currentTheme.dim(`${MESSAGE_INDENT}│ ${call.liveOutputTail}`)]; + } + // The store caps retained output, which cannot survive as a parseable + // media envelope (base64) — show a marker instead of dumping the blob. + if (call.name === 'ReadMediaFile' && call.result.is_error !== true) { + return [currentTheme.dim(`${MESSAGE_INDENT}[media output omitted]`)]; + } + const components = pickResultRenderer(call.name)( + this.toToolCallBlockData(call), + call.result, + { expanded: this.expanded }, + ); + const out: string[] = []; + for (const component of components) { + out.push(...component.render(innerWidth)); + } + return out; + } + + private toToolCallBlockData(call: SubToolCallActivity): ToolCallBlockData { + return { id: call.id, name: call.name, args: call.args }; + } + + // ── render ───────────────────────────────────────────────────────── + + override render(width: number): string[] { + const rows = Math.max(3, this.terminal.rows); + const bodyHeight = rows - 2; + const innerWidth = Math.max(1, width - 4); + + const key = this.cacheKey(innerWidth); + if (key !== this.lastCacheKey) { + this.lines = this.buildLines(innerWidth); + this.lastCacheKey = key; + } + if (this.followTail) this.scrollTop = this.maxScroll(); + + const header = this.renderHeader(width); + const body = this.renderBody(width, bodyHeight); + const footer = this.renderFooter(width, bodyHeight); + + const out: string[] = [header]; + for (const line of body) out.push(line); + out.push(footer); + return out; + } + + private renderHeader(width: number): string { + const title = currentTheme.boldFg('primary', ' Agent activity '); + const record = this.props.record; + const info = this.props.info; + const segments: string[] = []; + + if (record !== undefined) { + const label = + record.description !== undefined && record.description.length > 0 + ? `${record.agentName} › ${record.description}` + : record.agentName; + segments.push(currentTheme.boldFg('text', label)); + } else { + segments.push(currentTheme.boldFg('text', this.props.taskId)); + } + if (info !== undefined) { + segments.push(currentTheme.fg(statusColor(info.status), STATUS_LABEL[info.status])); + } + if (record !== undefined && record.steps.length > 0) { + const from = record.steps[0]!.step; + const to = record.steps.at(-1)!.step; + let range = `step ${String(from)}–${String(to)} / ${String(record.totalSteps)}`; + if (record.totalSteps > record.steps.length) range += ' · earlier steps discarded'; + segments.push(currentTheme.fg('textMuted', range)); + } + + const composed = title + segments.join(' '); + return fitExactly(composed, width); + } + + private renderBody(width: number, bodyHeight: number): string[] { + const innerWidth = Math.max(1, width - 4); + + const max = this.maxScroll(); + if (this.scrollTop > max) this.scrollTop = max; + if (this.scrollTop < 0) this.scrollTop = 0; + + const viewRows = Math.max(1, bodyHeight - 2); + const top = currentTheme.fg('primary', '┌' + '─'.repeat(Math.max(0, width - 2)) + '┐'); + const bottom = currentTheme.fg('primary', '└' + '─'.repeat(Math.max(0, width - 2)) + '┘'); + + const out: string[] = [top]; + for (let i = 0; i < viewRows; i++) { + const lineIndex = this.scrollTop + i; + const raw = this.lines[lineIndex] ?? ''; + const inner = fitExactly(raw, innerWidth); + out.push(currentTheme.fg('primary', '│ ') + inner + currentTheme.fg('primary', ' │')); + } + out.push(bottom); + return out; + } + + private renderFooter(width: number, bodyHeight: number): string { + const key = (text: string): string => currentTheme.boldFg('primary', text); + const dim = (text: string): string => currentTheme.fg('textMuted', text); + + const total = this.lines.length; + const viewRows = Math.max(1, bodyHeight - 2); + const maxScroll = Math.max(0, total - viewRows); + const percent = + maxScroll === 0 ? 100 : Math.round((this.scrollTop / maxScroll) * 100); + const lineFrom = total === 0 ? 0 : this.scrollTop + 1; + const lineTo = Math.min(total, this.scrollTop + viewRows); + + const position = currentTheme.fg( + 'textMuted', + ` ${String(lineFrom)}-${String(lineTo)} / ${String(total)} (${String(percent)}%) `, + ); + const keys = + `${key('↑↓')} ${dim('line')} ` + + `${key('PgUp/PgDn')} ${dim('page')} ` + + `${key('g/G')} ${dim('top/bot')} ` + + `${key('Ctrl+O')} ${dim(this.expanded ? 'collapse' : 'expand')} ` + + `${key('Q/Esc')} ${dim('cancel')}`; + const left = ` ${keys}`; + const leftW = visibleWidth(left); + const rightW = visibleWidth(position); + if (leftW + 2 + rightW <= width) { + return left + ' '.repeat(width - leftW - rightW) + position; + } + return fitExactly(left, width); + } +} + +/** + * Plain-text preview of a record for the tasks browser's Preview frame (the + * frame styles whole lines itself, so this stays ANSI-free). The frame shows + * the tail of the string, so the full retained activity is returned. + */ +export function formatSubagentActivityPreview(record: SubagentActivityRecord): string { + const lines: string[] = []; + for (const step of record.steps) { + lines.push(`── step ${String(step.step)} ──`); + if (step.retrying !== undefined) lines.push(`${MESSAGE_INDENT}↻ ${step.retrying}`); + if (step.textTail.trim().length > 0) lines.push(...step.textTail.trimEnd().split('\n')); + for (const call of step.toolCalls) { + lines.push(formatPreviewToolCall(call)); + if ( + call.result === undefined && + call.liveOutputTail !== undefined && + call.liveOutputTail.length > 0 + ) { + lines.push(`${MESSAGE_INDENT}│ ${call.liveOutputTail}`); + } + } + } + if (record.error !== undefined && record.error.length > 0) { + lines.push('Failed:', ...record.error.trimEnd().split('\n')); + } else if (record.resultSummary !== undefined && record.resultSummary.length > 0) { + lines.push('Result:', ...record.resultSummary.trimEnd().split('\n')); + } + if (lines.length === 0) { + return record.status === 'running' ? 'Waiting for activity…' : ''; + } + return lines.join('\n'); +} + +function formatPreviewToolCall(call: SubToolCallActivity): string { + const mark = call.status === 'done' ? '✓' : call.status === 'error' ? '✗' : '●'; + const verb = call.status === 'running' ? 'Using' : 'Used'; + const keyArg = extractKeyArgument(call.name, call.args); + const argStr = keyArg === null || keyArg.length === 0 ? '' : ` (${keyArg})`; + + let chip = ''; + if (call.result !== undefined) { + const callData: ToolCallBlockData = { id: call.id, name: call.name, args: call.args }; + const text = pickChip(call.name)?.(callData, call.result) ?? ''; + if (text.length > 0) chip = ` · ${text}`; + } + return `${mark} ${verb} ${call.name}${argStr}${chip}`; +} diff --git a/apps/kimi-code/src/tui/components/dialogs/task-output-viewer.ts b/apps/kimi-code/src/tui/components/dialogs/task-output-viewer.ts index c0f647f67c9..4a463671cb5 100644 --- a/apps/kimi-code/src/tui/components/dialogs/task-output-viewer.ts +++ b/apps/kimi-code/src/tui/components/dialogs/task-output-viewer.ts @@ -32,7 +32,7 @@ export interface TaskOutputViewerProps { readonly onClose: () => void; } -const STATUS_LABEL: Record = { +export const STATUS_LABEL: Record = { running: 'running', completed: 'completed', failed: 'failed', @@ -41,7 +41,7 @@ const STATUS_LABEL: Record = { lost: 'lost', }; -function statusColor(status: BackgroundTaskStatus): 'success' | 'textMuted' | 'error' { +export function statusColor(status: BackgroundTaskStatus): 'success' | 'textMuted' | 'error' { switch (status) { case 'running': return 'success'; diff --git a/apps/kimi-code/src/tui/components/messages/tool-call.ts b/apps/kimi-code/src/tui/components/messages/tool-call.ts index 3a30649e8ba..050a9a2456f 100644 --- a/apps/kimi-code/src/tui/components/messages/tool-call.ts +++ b/apps/kimi-code/src/tui/components/messages/tool-call.ts @@ -412,7 +412,7 @@ function formatKeyArgument( return truncateArgValue(key, displayValue); } -function extractKeyArgument( +export function extractKeyArgument( toolName: string, args: Record, workspaceDir?: string, diff --git a/apps/kimi-code/src/tui/constant/rendering.ts b/apps/kimi-code/src/tui/constant/rendering.ts index baf8de08336..a6a1c6b7d4b 100644 --- a/apps/kimi-code/src/tui/constant/rendering.ts +++ b/apps/kimi-code/src/tui/constant/rendering.ts @@ -12,6 +12,18 @@ export const RESULT_PREVIEW_LINES = 3; export const THINKING_PREVIEW_LINES = 2; export const COMMAND_PREVIEW_LINES = 10; +// Retention caps for the subagent activity store (background-agent detail +// view): only the most recent steps are kept, older steps are discarded +// whole, and per-step text / per-call output keep bounded tails. +export const MAX_SUBAGENT_ACTIVITY_STEPS = 20; +export const SUBAGENT_STEP_TEXT_TAIL_CHARS = 4000; +export const SUBAGENT_TOOL_OUTPUT_MAX_CHARS = 8000; +// Cap on individual string argument values kept in a record (Write/Edit +// carry whole-file contents). Only header summaries and the Edit/Write line +// chips read args, so long values are truncated; chips become approximate +// beyond the cap. +export const SUBAGENT_ARG_STRING_MAX_CHARS = 16 * 1024; + // Animation frames are shared by the login/update loaders and live thinking. export const BRAILLE_SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']; export const BRAILLE_SPINNER_INTERVAL_MS = 80; diff --git a/apps/kimi-code/src/tui/controllers/session-event-handler.ts b/apps/kimi-code/src/tui/controllers/session-event-handler.ts index 0eff25feb1f..3735465089a 100644 --- a/apps/kimi-code/src/tui/controllers/session-event-handler.ts +++ b/apps/kimi-code/src/tui/controllers/session-event-handler.ts @@ -357,6 +357,10 @@ export class SessionEventHandler { if (event.reason === 'cancelled') { this.markActiveAgentSwarmsCancelled(); } + // Aborted foreground subagents emit no completed/failed lifecycle event + // (v2 suppresses it for aborts), so their activity records would linger + // until the session reset — prune them when the owning turn ends. + this.subAgentEventHandler.dropForegroundOnlyActivityRecords(); if (event.reason === 'failed' && event.error?.code === 'provider.filtered') { this.host.showStatus('Turn stopped: provider safety policy blocked the response.', 'error'); } @@ -1144,6 +1148,21 @@ export class SessionEventHandler { description: info.description, status: info.status, }); + // Stopped / timed-out agents terminate without a `subagent.failed` + // event — mark the activity record here so the detail view does not + // stay "running" forever. `subagent.completed` carries the result + // summary and may land after this, so only fill still-running records. + const agentId = info.agentId; + if (agentId !== undefined) { + const record = this.subAgentEventHandler.activityStore.get(agentId); + if (record !== undefined && record.status === 'running') { + if (info.status === 'completed') { + this.subAgentEventHandler.activityStore.markCompleted(agentId); + } else { + this.subAgentEventHandler.activityStore.markFailed(agentId); + } + } + } } if (!this.backgroundTaskTranscriptedTerminal.has(info.taskId)) { if (info.kind === 'process' || info.kind === 'question') { diff --git a/apps/kimi-code/src/tui/controllers/subagent-activity-store.ts b/apps/kimi-code/src/tui/controllers/subagent-activity-store.ts new file mode 100644 index 00000000000..a612ece5b74 --- /dev/null +++ b/apps/kimi-code/src/tui/controllers/subagent-activity-store.ts @@ -0,0 +1,347 @@ +/** + * SubagentActivityStore — per-agent activity records feeding the background + * agent detail view (AgentActivityViewer). + * + * Child-agent events arrive at `SubAgentEventHandler.routeChildAgentEvent` + * regardless of foreground/background state, but are dropped there when the + * parent tool card is gone (Ctrl+B) or never existed (run_in_background). + * This store tees those events into a bounded per-agent fold so the tasks + * browser can show what a background agent is actually doing. + * + * Retention: only the most recent `MAX_SUBAGENT_ACTIVITY_STEPS` steps are + * kept (older steps are discarded whole — a step is the core loop's natural + * "one model response + tool execution" unit, bounded by the core's own + * `turn.step.started` events). Per-step assistant text keeps a trailing + * window; per-call result output is capped. Everything lives in memory and + * is released on session switch (`clear`). + * + * Pure logic — no TUI state, no components — so it is unit-testable. + */ + +import type { Event } from '@moonshot-ai/kimi-code-sdk'; + +import { + MAX_SUBAGENT_ACTIVITY_STEPS, + SUBAGENT_ARG_STRING_MAX_CHARS, + SUBAGENT_STEP_TEXT_TAIL_CHARS, + SUBAGENT_TOOL_OUTPUT_MAX_CHARS, +} from '#/tui/constant/rendering'; +import type { ToolResultBlockData } from '../types'; +import { + argsRecord, + appendStreamingArgsPreview, + parseStreamingArgs, + serializeToolResultOutput, +} from '../utils/event-payload'; + +/** A single tool call inside a step, shaped so the viewer can feed the + * main-flow renderers (`ToolCallBlockData` / `ToolResultBlockData`). */ +export interface SubToolCallActivity { + readonly id: string; + name: string; + args: Record; + status: 'running' | 'done' | 'error'; + readonly startedAt: number; + durationMs?: number; + result?: ToolResultBlockData; + /** Last line of stdout/stderr live progress, while the call is running. */ + liveOutputTail?: string; +} + +/** One step = one core loop iteration (`turn.step.started` … next start). */ +export interface SubagentStepActivity { + readonly step: number; + /** Assistant text of this step, trailing window only. */ + textTail: string; + readonly toolCalls: SubToolCallActivity[]; + retrying?: string; +} + +export interface SubagentActivityRecord { + readonly agentId: string; + readonly agentName: string; + readonly description?: string; + readonly parentToolCallId: string; + model?: string; + effort?: string; + readonly steps: SubagentStepActivity[]; + /** Count of real `turn.step.started` events seen (monotonic). */ + totalSteps: number; + status: 'running' | 'completed' | 'failed'; + resultSummary?: string; + error?: string; + /** Bumped on every mutation; the viewer caches its render against this. */ + version: number; +} + +export interface SubagentActivitySpawn { + readonly agentId: string; + readonly agentName: string; + readonly description?: string; + readonly parentToolCallId: string; + readonly model?: string; + readonly effort?: string; +} + +const LIVE_OUTPUT_TAIL_CHARS = 200; + +function tail(text: string, maxChars: number): string { + return text.length <= maxChars ? text : text.slice(text.length - maxChars); +} + +/** Truncate long string argument values before they are retained — Write and + * Edit carry whole-file contents in args, which would otherwise dwarf every + * other retention cap. Only header summaries (`extractKeyArgument`) and the + * Edit/Write line chips read args, so truncation is display-safe; those + * chips simply become approximate beyond the cap. Shallow on purpose: the + * tools that matter have flat argument records. */ +function capArgStrings(args: Record): Record { + let capped: Record | undefined; + for (const [key, value] of Object.entries(args)) { + if (typeof value !== 'string' || value.length <= SUBAGENT_ARG_STRING_MAX_CHARS) continue; + capped ??= { ...args }; + capped[key] = `${value.slice(0, SUBAGENT_ARG_STRING_MAX_CHARS)}…`; + } + return capped ?? args; +} + +export class SubagentActivityStore { + private readonly records = new Map(); + /** Raw streaming-arguments buffer per in-flight tool call (from deltas). */ + private readonly streamingArgs = new Map(); + + ensureRecord(spawn: SubagentActivitySpawn): SubagentActivityRecord { + const existing = this.records.get(spawn.agentId); + if (existing !== undefined) { + // A resumed subagent re-spawns under the same id: keep the accumulated + // steps and flip the record back to running. + existing.status = 'running'; + existing.resultSummary = undefined; + existing.error = undefined; + return existing; + } + const record: SubagentActivityRecord = { + agentId: spawn.agentId, + agentName: spawn.agentName, + description: spawn.description, + parentToolCallId: spawn.parentToolCallId, + model: spawn.model, + effort: spawn.effort, + steps: [], + totalSteps: 0, + status: 'running', + version: 0, + }; + this.records.set(spawn.agentId, record); + return record; + } + + get(agentId: string): SubagentActivityRecord | undefined { + return this.records.get(agentId); + } + + agentIds(): readonly string[] { + return [...this.records.keys()]; + } + + applyEvent(event: Event): void { + switch (event.type) { + case 'turn.step.started': { + const record = this.recordFor(event.agentId); + record.steps.push({ step: event.step, textTail: '', toolCalls: [] }); + record.totalSteps += 1; + while (record.steps.length > MAX_SUBAGENT_ACTIVITY_STEPS) { + const evicted = record.steps.shift(); + if (evicted === undefined) break; + // A call truncated before started/result only ever produced deltas; + // its arg buffer is keyed by id, so evicting the only step that + // referenced it must drop the buffer entry too. + for (const call of evicted.toolCalls) { + this.streamingArgs.delete(this.streamKey(record.agentId, call.id)); + } + } + this.bump(record); + return; + } + case 'assistant.delta': { + const record = this.recordFor(event.agentId); + const step = this.currentStep(record); + step.textTail = tail(step.textTail + event.delta, SUBAGENT_STEP_TEXT_TAIL_CHARS); + this.bump(record); + return; + } + case 'tool.call.started': { + const record = this.recordFor(event.agentId); + const existing = this.findToolCall(record, event.toolCallId); + const args = capArgStrings(argsRecord(event.args)); + if (existing === undefined) { + this.currentStep(record).toolCalls.push({ + id: event.toolCallId, + name: event.name, + args, + status: 'running', + startedAt: Date.now(), + }); + } else { + // Authoritative full args arrive with the start; replace the + // best-effort record assembled from streaming deltas. + existing.name = event.name; + existing.args = args; + } + this.streamingArgs.delete(this.streamKey(event.agentId, event.toolCallId)); + this.bump(record); + return; + } + case 'tool.call.delta': { + const record = this.recordFor(event.agentId); + const key = this.streamKey(event.agentId, event.toolCallId); + // parseStreamingArgs only reads the preview window, so keep the raw + // buffer capped at the same size — an uncapped buffer would outgrow + // the store's retention caps on large Write/Edit argument streams. + const buffered = appendStreamingArgsPreview( + this.streamingArgs.get(key), + event.argumentsPart, + ); + this.streamingArgs.set(key, buffered); + let call = this.findToolCall(record, event.toolCallId); + if (call === undefined) { + call = { + id: event.toolCallId, + name: event.name ?? '', + args: {}, + status: 'running', + startedAt: Date.now(), + }; + this.currentStep(record).toolCalls.push(call); + } + if (call.name.length === 0 && event.name !== undefined) call.name = event.name; + call.args = capArgStrings(parseStreamingArgs(buffered)); + this.bump(record); + return; + } + case 'tool.progress': { + if (event.update.kind !== 'stdout' && event.update.kind !== 'stderr') return; + const text = event.update.text; + if (text === undefined || text.trim().length === 0) return; + const record = this.records.get(event.agentId); + const call = record === undefined ? undefined : this.findToolCall(record, event.toolCallId); + if (record === undefined || call === undefined) return; + const lines = text.trimEnd().split('\n'); + call.liveOutputTail = tail(lines.at(-1) ?? '', LIVE_OUTPUT_TAIL_CHARS); + this.bump(record); + return; + } + case 'tool.result': { + const record = this.records.get(event.agentId); + const call = record === undefined ? undefined : this.findToolCall(record, event.toolCallId); + if (record === undefined || call === undefined) return; + let output = serializeToolResultOutput(event.output); + if (output.length > SUBAGENT_TOOL_OUTPUT_MAX_CHARS) { + output = `${output.slice(0, SUBAGENT_TOOL_OUTPUT_MAX_CHARS)}\n… [output truncated to ${String(SUBAGENT_TOOL_OUTPUT_MAX_CHARS)} chars]`; + } + call.result = { + tool_call_id: call.id, + output, + is_error: event.isError, + synthetic: event.synthetic, + }; + call.status = event.isError === true ? 'error' : 'done'; + call.durationMs = Date.now() - call.startedAt; + call.liveOutputTail = undefined; + this.streamingArgs.delete(this.streamKey(event.agentId, event.toolCallId)); + this.bump(record); + return; + } + case 'turn.step.retrying': { + const record = this.recordFor(event.agentId); + const step = this.currentStep(record); + step.retrying = `retrying · attempt ${String(event.nextAttempt)}/${String(event.maxAttempts)} (${event.errorName})`; + this.bump(record); + return; + } + default: + return; + } + } + + markCompleted(agentId: string, resultSummary?: string): void { + const record = this.records.get(agentId); + if (record === undefined) return; + record.status = 'completed'; + record.resultSummary = resultSummary; + this.dropStreamingBuffers(agentId); + this.bump(record); + } + + markFailed(agentId: string, error?: string): void { + const record = this.records.get(agentId); + if (record === undefined) return; + record.status = 'failed'; + record.error = error; + this.dropStreamingBuffers(agentId); + this.bump(record); + } + + clear(): void { + this.records.clear(); + this.streamingArgs.clear(); + } + + /** Drop one agent's record and its in-flight arg buffers. Used when a + * foreground-only subagent (never backgrounded, so it can never appear in + * /tasks) reaches a terminal state — its record would otherwise stay + * resident until the session reset. */ + drop(agentId: string): void { + this.records.delete(agentId); + this.dropStreamingBuffers(agentId); + } + + /** No more deltas arrive once the record is terminal, so any buffer left + * by a call truncated before started/result can be released here. */ + private dropStreamingBuffers(agentId: string): void { + const prefix = `${agentId}:`; + for (const key of this.streamingArgs.keys()) { + if (key.startsWith(prefix)) this.streamingArgs.delete(key); + } + } + + /** Get-or-create: events can arrive for agents this process never saw a + * spawn for (e.g. switching back to a session whose background agents are + * still running) — keep their activity rather than dropping it. */ + private recordFor(agentId: string): SubagentActivityRecord { + return ( + this.records.get(agentId) ?? + this.ensureRecord({ agentId, agentName: agentId, parentToolCallId: '' }) + ); + } + + /** Latest step, creating a synthetic one when content arrives ahead of any + * `turn.step.started` (same mid-flight case as `recordFor`). */ + private currentStep(record: SubagentActivityRecord): SubagentStepActivity { + let step = record.steps.at(-1); + if (step === undefined) { + step = { step: 0, textTail: '', toolCalls: [] }; + record.steps.push(step); + } + return step; + } + + private findToolCall( + record: SubagentActivityRecord, + toolCallId: string, + ): SubToolCallActivity | undefined { + for (let i = record.steps.length - 1; i >= 0; i--) { + const call = record.steps[i]!.toolCalls.find((c) => c.id === toolCallId); + if (call !== undefined) return call; + } + return undefined; + } + + private streamKey(agentId: string, toolCallId: string): string { + return `${agentId}:${toolCallId}`; + } + + private bump(record: SubagentActivityRecord): void { + record.version += 1; + } +} diff --git a/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts b/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts index d8acc0cabbb..6bbf7b3bef3 100644 --- a/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts +++ b/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts @@ -22,6 +22,7 @@ import { argsRecord, serializeToolResultOutput } from '../utils/event-payload'; import { formatHookResultPlain } from '../utils/hook-result-format'; import { nextTranscriptId } from '../utils/transcript-id'; import type { SessionEventHost } from './session-event-handler'; +import { SubagentActivityStore } from './subagent-activity-store'; export interface SubagentInfo { readonly parentToolCallId: string; @@ -56,6 +57,8 @@ export class SubAgentEventHandler { readonly subagentInfo: Map = new Map(); private readonly agentSwarmProgress: Map = new Map(); backgroundAgentMetadata: Map = new Map(); + /** Bounded per-agent activity fold feeding the background-agent detail view. */ + readonly activityStore = new SubagentActivityStore(); constructor( private readonly host: SessionEventHost, @@ -65,6 +68,7 @@ export class SubAgentEventHandler { resetRuntimeState(): void { this.subagentInfo.clear(); this.backgroundAgentMetadata.clear(); + this.activityStore.clear(); this.clearAgentSwarmProgress(); } @@ -75,6 +79,11 @@ export class SubAgentEventHandler { if (childAgentId === MAIN_AGENT_ID) return false; if (this.host.btwPanelController.routeEvent(event)) return true; + // Tee every child-agent event into the activity store before the routing + // below swallows events whose parent card is gone (Ctrl+B) or never + // existed (run_in_background) — that data is the background detail view. + this.activityStore.applyEvent(event); + const info = this.subagentInfo.get(childAgentId); if (info === undefined || info.parentToolCallId.length === 0) return true; @@ -283,6 +292,8 @@ export class SubAgentEventHandler { private handleSubagentCompleted( event: SubagentLifecycleEventOf<'subagent.completed'>, ): void { + this.activityStore.markCompleted(event.subagentId, event.resultSummary); + this.pruneForegroundOnlyRecord(event.subagentId); const backgroundMeta = this.backgroundAgentMetadata.get(event.subagentId); if (backgroundMeta !== undefined) { const taskId = this.findAgentTaskId( @@ -312,6 +323,8 @@ export class SubAgentEventHandler { private handleSubagentFailed( event: SubagentLifecycleEventOf<'subagent.failed'>, ): void { + this.activityStore.markFailed(event.subagentId, event.error); + this.pruneForegroundOnlyRecord(event.subagentId); const backgroundMeta = this.backgroundAgentMetadata.get(event.subagentId); if (backgroundMeta !== undefined) { const taskId = this.findAgentTaskId( @@ -367,6 +380,28 @@ export class SubAgentEventHandler { return match; } + /** A subagent that never became a background task (foreground-only) can + * never appear in /tasks, so its activity record is dropped at terminal + * state — otherwise records would pile up for the rest of the session. */ + private pruneForegroundOnlyRecord(subagentId: string): void { + // A spawn-time background agent keeps its record even when the + // background.task.started sync has not landed yet (short-lived agents). + if (this.backgroundAgentMetadata.has(subagentId)) return; + for (const info of this.deps.backgroundTasks.values()) { + if (info.kind === 'agent' && info.agentId === subagentId) return; + } + this.activityStore.drop(subagentId); + } + + /** Drop every foreground-only record. Called when the main turn ends: any + * foreground subagent of the turn is over at that point, and an aborted + * one emits no `subagent.completed`/`subagent.failed` to prune it. */ + dropForegroundOnlyActivityRecords(): void { + for (const agentId of this.activityStore.agentIds()) { + this.pruneForegroundOnlyRecord(agentId); + } + } + private buildBackgroundAgentMetadata( event: SubagentLifecycleEventOf<'subagent.spawned'>, ): BackgroundAgentMetadata { @@ -409,6 +444,14 @@ export class SubAgentEventHandler { runInBackground: event.runInBackground, swarmIndex: event.swarmIndex, }); + this.activityStore.ensureRecord({ + agentId: event.subagentId, + agentName: event.subagentName, + description: event.description, + parentToolCallId: event.parentToolCallId, + model: this.spawnedModelDisplay(event), + effort: this.subagentEffortDisplay(event.thinkingEffort), + }); } private handleForegroundSubagentSpawned( diff --git a/apps/kimi-code/src/tui/controllers/tasks-browser.ts b/apps/kimi-code/src/tui/controllers/tasks-browser.ts index 6994b13b869..187d4619e81 100644 --- a/apps/kimi-code/src/tui/controllers/tasks-browser.ts +++ b/apps/kimi-code/src/tui/controllers/tasks-browser.ts @@ -1,10 +1,13 @@ import type { BackgroundTaskInfo, Session } from '@moonshot-ai/kimi-code-sdk'; import type { Component, ProcessTerminal, TUI } from '@moonshot-ai/pi-tui'; +import { AgentActivityViewer, formatSubagentActivityPreview } from '../components/dialogs/agent-activity-viewer'; import { TaskOutputViewer } from '../components/dialogs/task-output-viewer'; import { TasksBrowserApp, type TasksFilter } from '../components/dialogs/tasks-browser'; import type { Theme } from '#/tui/theme'; import type { CustomEditor } from '../components/editor/custom-editor'; +import type { SessionEventHandler } from './session-event-handler'; +import type { SubagentActivityRecord } from './subagent-activity-store'; export interface TasksBrowserHost { readonly state: { @@ -15,6 +18,7 @@ export interface TasksBrowserHost { readonly editor: CustomEditor; }; readonly backgroundTasks: ReadonlyMap; + readonly sessionEventHandler: SessionEventHandler; readonly session: Session | undefined; showError(msg: string): void; setTasksBrowser(value: TasksBrowserState | undefined): void; @@ -33,7 +37,7 @@ export type TasksBrowserState = { pollTimer: NodeJS.Timeout | undefined; viewer: | { - component: TaskOutputViewer; + component: TaskOutputViewer | AgentActivityViewer; savedChildren: readonly Component[]; taskId: string; output: string; @@ -140,6 +144,8 @@ export class TasksBrowserController { const browser = state.tasksBrowser; const viewer = browser?.viewer; if (browser === undefined || viewer === undefined) return; + // The agent activity viewer refreshes from the local store, not the RPC. + if (viewer.component instanceof AgentActivityViewer) return; const session = this.host.session; if (session === undefined) return; @@ -214,9 +220,26 @@ export class TasksBrowserController { return; } if (state.tasksBrowser !== browser) return; + this.syncAgentPreview(); this.pushProps(tasks); } + /** Agent tasks capture output only on completion, so while one is selected + * the Preview frame is fed from the in-memory activity store instead. */ + private syncAgentPreview(): void { + const browser = this.host.state.tasksBrowser; + const selectedTaskId = browser?.selectedTaskId; + if (browser === undefined || selectedTaskId === undefined) return; + const info = this.host.backgroundTasks.get(selectedTaskId); + if (info?.kind !== 'agent' || info.agentId === undefined) return; + const record = this.host.sessionEventHandler.subAgentEventHandler.activityStore.get( + info.agentId, + ); + if (record === undefined) return; + browser.tailOutput = formatSubagentActivityPreview(record); + browser.tailLoading = false; + } + private pushProps(tasks: readonly BackgroundTaskInfo[]): void { const browser = this.host.state.tasksBrowser; if (browser === undefined) return; @@ -317,6 +340,20 @@ export class TasksBrowserController { if (browser === undefined) return; if (browser.viewer !== undefined) return; + // Agent tasks get the activity detail view when this process holds a + // record for the agent; otherwise (e.g. a `lost` task after resume) fall + // through to the captured-output viewer. + const info = this.host.backgroundTasks.get(taskId); + if (info !== undefined && info.kind === 'agent' && info.agentId !== undefined) { + const record = this.host.sessionEventHandler.subAgentEventHandler.activityStore.get( + info.agentId, + ); + if (record !== undefined) { + this.openAgentActivityViewer(taskId, info, record); + return; + } + } + const session = this.host.session; if (session === undefined) { this.flash('No active session.'); @@ -334,7 +371,6 @@ export class TasksBrowserController { const current = state.tasksBrowser; if (current === undefined || current !== browser) return; - const info = this.host.backgroundTasks.get(taskId); const viewer = new TaskOutputViewer( { taskId, @@ -367,11 +403,90 @@ export class TasksBrowserController { }; } + private openAgentActivityViewer( + taskId: string, + info: BackgroundTaskInfo, + record: SubagentActivityRecord, + ): void { + const { state } = this.host; + const browser = state.tasksBrowser; + if (browser === undefined || browser.viewer !== undefined) return; + + const viewer = new AgentActivityViewer( + { + taskId, + info, + record, + onClose: () => { + this.closeOutputViewer(); + }, + }, + state.terminal, + ); + + const savedBrowserChildren = [...state.ui.children]; + state.ui.clear(); + state.ui.addChild(viewer); + state.ui.setFocus(viewer); + state.ui.requestRender(true); + + // The activity store is in-memory — refreshing is a local read, no RPC. + const pollTimer = setInterval(() => { + this.refreshAgentActivityViewer(); + }, 1000); + + browser.viewer = { + component: viewer, + savedChildren: savedBrowserChildren, + taskId, + output: '', + refreshId: 0, + pollTimer, + }; + } + + private refreshAgentActivityViewer(): void { + const { state } = this.host; + const viewer = state.tasksBrowser?.viewer; + if (viewer === undefined || !(viewer.component instanceof AgentActivityViewer)) return; + + const info = this.host.backgroundTasks.get(viewer.taskId); + const agentId = info?.kind === 'agent' ? info.agentId : undefined; + const record = + agentId === undefined + ? undefined + : this.host.sessionEventHandler.subAgentEventHandler.activityStore.get(agentId); + viewer.component.setProps({ + taskId: viewer.taskId, + info, + record, + onClose: () => { + this.closeOutputViewer(); + }, + }); + state.ui.requestRender(); + } + private loadTail(taskId: string): void { const { state } = this.host; const browser = state.tasksBrowser; if (browser === undefined) return; + // Agent tasks capture output only on completion — serve the preview from + // the in-memory activity store instead of the RPC when a record exists. + const info = this.host.backgroundTasks.get(taskId); + if (info !== undefined && info.kind === 'agent' && info.agentId !== undefined) { + const record = this.host.sessionEventHandler.subAgentEventHandler.activityStore.get( + info.agentId, + ); + if (record !== undefined) { + browser.tailOutput = formatSubagentActivityPreview(record); + browser.tailLoading = false; + this.repaint(); + return; + } + } + const session = this.host.session; if (session === undefined) { browser.tailLoading = false; diff --git a/apps/kimi-code/test/tui/components/dialogs/agent-activity-viewer.test.ts b/apps/kimi-code/test/tui/components/dialogs/agent-activity-viewer.test.ts new file mode 100644 index 00000000000..a6908b919f5 --- /dev/null +++ b/apps/kimi-code/test/tui/components/dialogs/agent-activity-viewer.test.ts @@ -0,0 +1,315 @@ +import type { Terminal } from '@moonshot-ai/pi-tui'; +import type { BackgroundTaskInfo } from '@moonshot-ai/kimi-code-sdk'; +import { describe, expect, it, vi } from 'vitest'; + +import { AgentActivityViewer, formatSubagentActivityPreview } from '#/tui/components/dialogs/agent-activity-viewer'; +import type { SubagentActivityRecord } from '#/tui/controllers/subagent-activity-store'; + +const ANSI_SGR = /\[[0-9;]*m/g; +function strip(text: string): string { + return text.replaceAll(ANSI_SGR, ''); +} + +/** Kitty CSI-u form of Ctrl+O (codepoint 111, modifier 1+4). */ +const CTRL_O = '\u001B[111;5u'; + +/** Minimal Terminal stub — only `rows` is read by the component. */ +function fakeTerminal(rows: number, columns = 120): Terminal { + return { + start: () => {}, + stop: () => {}, + drainInput: () => Promise.resolve(), + write: () => {}, + get columns() { + return columns; + }, + get rows() { + return rows; + }, + get kittyProtocolActive() { + return false; + }, + moveBy: () => {}, + hideCursor: () => {}, + showCursor: () => {}, + clearLine: () => {}, + clearFromCursor: () => {}, + clearScreen: () => {}, + setTitle: () => {}, + setProgress: () => {}, + }; +} + +function agentTask(overrides: Record = {}): BackgroundTaskInfo { + return { + taskId: 'agent-task-1', + kind: 'agent', + agentId: 'agent-1', + description: 'find things', + status: 'running', + startedAt: Date.now() - 60_000, + endedAt: null, + ...overrides, + } as BackgroundTaskInfo; +} + +function record(overrides: Partial = {}): SubagentActivityRecord { + return { + agentId: 'agent-1', + agentName: 'explore', + description: 'find things', + parentToolCallId: 'tc-1', + steps: [], + totalSteps: 0, + status: 'running', + version: 1, + ...overrides, + }; +} + +function makeViewer( + props: Partial[0]> & { + record?: SubagentActivityRecord; + } = {}, + rows = 20, + columns = 80, +): AgentActivityViewer { + return new AgentActivityViewer( + { + taskId: 'agent-task-1', + info: agentTask(), + record: props.record, + onClose: vi.fn(), + ...props, + }, + fakeTerminal(rows, columns), + ); +} + +function renderPlain(viewer: AgentActivityViewer, width = 80): string { + return strip(viewer.render(width).join('\n')); +} + +describe('AgentActivityViewer', () => { + it('fills exactly terminal.rows lines', () => { + const viewer = makeViewer({}, 20); + expect(viewer.render(80).length).toBe(20); + }); + + it('shows agent label, status and step range in the header', () => { + const viewer = makeViewer({ + record: record({ + steps: [ + { step: 8, textTail: '', toolCalls: [] }, + { step: 9, textTail: '', toolCalls: [] }, + ], + totalSteps: 12, + }), + }); + const text = renderPlain(viewer, 120); + expect(text).toContain('Agent activity'); + expect(text).toContain('explore › find things'); + expect(text).toContain('running'); + expect(text).toContain('step 8–9 / 12'); + expect(text).toContain('earlier steps discarded'); + }); + + it('renders steps with tool call headers and result renderer output', () => { + const viewer = makeViewer({ + record: record({ + steps: [ + { + step: 0, + textTail: 'Looking for the event bus definition.', + toolCalls: [ + { + id: 't1', + name: 'Grep', + args: { pattern: 'IEventBus' }, + status: 'done', + startedAt: 0, + result: { + tool_call_id: 't1', + output: 'src/a.ts:1:IEventBus\nsrc/b.ts:2:IEventBus', + is_error: false, + }, + }, + ], + }, + ], + totalSteps: 1, + }), + }); + const text = renderPlain(viewer); + expect(text).toContain('── step 0 ──'); + expect(text).toContain('Looking for the event bus definition.'); + expect(text).toContain('Used Grep (IEventBus) · 2 matches'); + // grep glance renderer: path samples below the header (`path:line` form) + expect(text).toContain('src/a.ts:1, src/b.ts:2'); + }); + + it('collapses long output by default and expands it with ctrl+o', () => { + const longOutput = Array.from({ length: 10 }, (_, i) => `line ${String(i + 1)}`).join('\n'); + const makeRecord = (): SubagentActivityRecord => + record({ + steps: [ + { + step: 0, + textTail: '', + toolCalls: [ + { + id: 't1', + name: 'Bash', + args: { command: 'ls' }, + status: 'done', + startedAt: 0, + result: { tool_call_id: 't1', output: longOutput, is_error: false }, + }, + ], + }, + ], + totalSteps: 1, + }); + + const collapsed = makeViewer({ record: makeRecord() }); + const collapsedText = renderPlain(collapsed); + expect(collapsedText).toContain('ctrl+o to expand'); + expect(collapsedText).not.toContain('line 10'); + + collapsed.handleInput(CTRL_O); + const expandedText = renderPlain(collapsed); + expect(expandedText).toContain('line 10'); + }); + + it('opens pinned to the latest activity and keeps scroll position when the user scrolled up', () => { + const steps = Array.from({ length: 8 }, (_, i) => ({ + step: i, + textTail: `step ${String(i)} text`, + toolCalls: [], + })); + const rec = record({ steps, totalSteps: 8 }); + const viewer = makeViewer({ record: rec }, 12); + + // Initial render follows the tail: the last step is visible. + expect(renderPlain(viewer)).toContain('step 7 text'); + + // User scrolls to the top, then new activity arrives (version bump): + // the view must stay where the user parked it. + viewer.handleInput('g'); + expect(renderPlain(viewer)).toContain('step 0 text'); + rec.steps.push({ step: 8, textTail: 'step 8 text', toolCalls: [] }); + rec.version += 1; + viewer.setProps({ taskId: 'agent-task-1', info: agentTask(), record: rec, onClose: vi.fn() }); + const after = renderPlain(viewer); + expect(after).toContain('step 0 text'); + expect(after).not.toContain('step 8 text'); + }); + + it('shows an explicit empty state when no record exists', () => { + const viewer = makeViewer({ record: undefined }); + expect(renderPlain(viewer)).toContain('[no activity recorded]'); + }); + + it('renders the terminal result summary section', () => { + const viewer = makeViewer({ + info: agentTask({ status: 'completed' }), + record: record({ status: 'completed', resultSummary: 'Found 3 call sites.' }), + }); + const text = renderPlain(viewer); + expect(text).toContain('completed'); + expect(text).toContain('Result'); + expect(text).toContain('Found 3 call sites.'); + }); + + it('closes on q and escape', () => { + const onClose = vi.fn(); + const viewer = makeViewer({ record: record(), onClose }); + viewer.handleInput('q'); + expect(onClose).toHaveBeenCalledTimes(1); + viewer.handleInput('\u001B'); + expect(onClose).toHaveBeenCalledTimes(2); + }); +}); + +describe('formatSubagentActivityPreview', () => { + it('renders steps, tool calls and the terminal result as plain text', () => { + const text = formatSubagentActivityPreview( + record({ + status: 'completed', + resultSummary: 'Found 3 call sites.', + totalSteps: 1, + steps: [ + { + step: 0, + textTail: 'Looking around.', + toolCalls: [ + { + id: 't1', + name: 'Grep', + args: { pattern: 'IEventBus' }, + status: 'done', + startedAt: 0, + result: { + tool_call_id: 't1', + output: 'src/a.ts:1:IEventBus\nsrc/b.ts:2:IEventBus', + is_error: false, + }, + }, + { + id: 't2', + name: 'Read', + args: { path: '/repo/src/a.ts' }, + status: 'running', + startedAt: 0, + liveOutputTail: 'reading…', + }, + ], + }, + ], + }), + ); + expect(text).toContain('── step 0 ──'); + expect(text).toContain('Looking around.'); + expect(text).toContain('✓ Used Grep (IEventBus) · 2 matches'); + expect(text).toContain('● Using Read (/repo/src/a.ts)'); + expect(text).toContain('│ reading…'); // live tail for the in-flight call + expect(text).toContain('Result:'); + expect(text).toContain('Found 3 call sites.'); + // The preview frame styles whole lines itself — the preview stays ANSI-free. + expect(text).not.toMatch(/\[[0-9;]*m/); + }); + + it('shows the live output tail for a running call', () => { + const text = formatSubagentActivityPreview( + record({ + totalSteps: 1, + steps: [ + { + step: 0, + textTail: '', + toolCalls: [ + { + id: 't1', + name: 'Bash', + args: { command: 'pnpm test' }, + status: 'running', + startedAt: 0, + liveOutputTail: '42 passing', + }, + ], + }, + ], + }), + ); + expect(text).toContain('● Using Bash (pnpm test)'); + expect(text).toContain('│ 42 passing'); + }); + + it('returns a waiting placeholder for a fresh running record', () => { + expect(formatSubagentActivityPreview(record())).toBe('Waiting for activity…'); + }); + + it('returns an empty string for a terminal record without any activity', () => { + expect(formatSubagentActivityPreview(record({ status: 'failed' }))).toBe(''); + }); +}); diff --git a/apps/kimi-code/test/tui/controllers/session-event-handler-background-task.test.ts b/apps/kimi-code/test/tui/controllers/session-event-handler-background-task.test.ts new file mode 100644 index 00000000000..0c5588e46b4 --- /dev/null +++ b/apps/kimi-code/test/tui/controllers/session-event-handler-background-task.test.ts @@ -0,0 +1,220 @@ +import type { Event } from '@moonshot-ai/kimi-code-sdk'; +import { describe, expect, it, vi } from 'vitest'; + +import { SessionEventHandler } from '#/tui/controllers/session-event-handler'; +import { + SubAgentEventHandler, + type SubagentLifecycleEvent, +} from '#/tui/controllers/subagent-event-handler'; +import { getBuiltInPalette } from '#/tui/theme'; + +function makeStreamingUIStub() { + return { + getToolComponent: vi.fn(() => undefined), + getActiveToolCall: vi.fn(() => undefined), + onToolCallStart: vi.fn(), + getTurnContext: vi.fn(() => ({ turnId: 1, step: 0 })), + removeToolComponentIfInactive: vi.fn(), + applyBackgroundTaskTerminalStatus: vi.fn(), + markSubagentBackgrounded: vi.fn(), + setTurnId: vi.fn(), + flushNow: vi.fn(), + setTodoList: vi.fn(), + resetToolUi: vi.fn(), + finalizeTurn: vi.fn(), + }; +} + +function makeSubagentHandler() { + const backgroundTasks = new Map(); + const host = { + state: { + appState: { availableModels: {} }, + ui: { requestRender: vi.fn() }, + transcriptContainer: { addChild: vi.fn() }, + }, + streamingUI: makeStreamingUIStub(), + appendTranscriptEntry: vi.fn(), + btwPanelController: { routeEvent: vi.fn(() => false) }, + updateActivityPane: vi.fn(), + }; + const handler = new SubAgentEventHandler(host as never, { + backgroundTasks, + backgroundTaskTranscriptedTerminal: new Set(), + syncBackgroundAgentBadge: vi.fn(), + }); + return { handler, backgroundTasks }; +} + +function spawnEvent(subagentId: string, runInBackground: boolean): SubagentLifecycleEvent { + return { + sessionId: 's1', + agentId: 'main', + type: 'subagent.spawned', + subagentId, + subagentName: 'explore', + parentToolCallId: `tc-${subagentId}`, + description: `task ${subagentId}`, + runInBackground, + } as unknown as SubagentLifecycleEvent; +} + +function completedEvent(subagentId: string): SubagentLifecycleEvent { + return { + sessionId: 's1', + agentId: 'main', + type: 'subagent.completed', + subagentId, + parentToolCallId: `tc-${subagentId}`, + resultSummary: 'done', + } as unknown as SubagentLifecycleEvent; +} + +describe('SubAgentEventHandler — activity record pruning', () => { + it('drops the record of a foreground-only subagent at terminal state', () => { + const { handler } = makeSubagentHandler(); + handler.handleLifecycleEvent(spawnEvent('a1', false)); + handler.activityStore.applyEvent({ + sessionId: 's1', + agentId: 'a1', + type: 'turn.step.started', + turnId: 1, + step: 0, + } as Event); + expect(handler.activityStore.get('a1')).toBeDefined(); + + handler.handleLifecycleEvent(completedEvent('a1')); + + expect(handler.activityStore.get('a1')).toBeUndefined(); + }); + + it('keeps the record of a spawn-time background agent even before the task syncs', () => { + const { handler } = makeSubagentHandler(); + handler.handleLifecycleEvent(spawnEvent('a2', true)); + handler.activityStore.applyEvent({ + sessionId: 's1', + agentId: 'a2', + type: 'turn.step.started', + turnId: 1, + step: 0, + } as Event); + + // No background.task.started has populated the task map yet. + handler.handleLifecycleEvent(completedEvent('a2')); + + const record = handler.activityStore.get('a2'); + expect(record?.status).toBe('completed'); + expect(record?.resultSummary).toBe('done'); + }); +}); + +function makeSessionEventHost() { + const host = { + state: { + appState: { + sessionId: 's1', + workDir: '/tmp/wd', + streamingPhase: 'idle', + availableModels: {}, + }, + queuedMessages: [], + queuedMessageDispatchPending: false, + theme: { palette: getBuiltInPalette('dark') }, + toolOutputExpanded: false, + todoPanel: { getTodos: vi.fn(() => []) }, + transcriptContainer: { addChild: vi.fn() }, + tasksBrowser: undefined, + footer: { setBackgroundCounts: vi.fn() }, + ui: { requestRender: vi.fn() }, + }, + session: { id: 's1' }, + aborted: false, + sessionEventUnsubscribe: undefined, + streamingUI: makeStreamingUIStub(), + requireSession: vi.fn(), + setAppState: vi.fn(), + patchLivePane: vi.fn(), + resetLivePane: vi.fn(), + showError: vi.fn(), + showStatus: vi.fn(), + showNotice: vi.fn(), + track: vi.fn(), + recordSessionActivity: vi.fn(), + noteStepUsage: vi.fn(), + noteCompactionFinished: vi.fn(), + mountEditorReplacement: vi.fn(), + restoreEditor: vi.fn(), + restoreInputText: vi.fn(), + appendTranscriptEntry: vi.fn(), + sendNormalUserInput: vi.fn(), + sendQueuedMessage: vi.fn(), + shiftQueuedMessage: vi.fn(), + btwPanelController: { routeEvent: vi.fn(() => false) }, + tasksBrowserController: { repaint: vi.fn(), refreshOutputViewer: vi.fn() }, + }; + return host as never; +} + +describe('SessionEventHandler — background.task.terminated', () => { + function terminatedEvent(agentId: string, status: string): Event { + return { + sessionId: 's1', + agentId: 'main', + type: 'background.task.terminated', + info: { + taskId: `task-${agentId}`, + kind: 'agent', + agentId, + description: 'bg task', + status, + startedAt: 0, + endedAt: 1, + }, + } as unknown as Event; + } + + it('marks a still-running record failed when an agent is stopped without subagent.failed', () => { + const handler = new SessionEventHandler(makeSessionEventHost()); + handler.subAgentEventHandler.activityStore.ensureRecord({ + agentId: 'agent-9', + agentName: 'explore', + parentToolCallId: 'tc-9', + }); + + handler.handleEvent(terminatedEvent('agent-9', 'killed'), vi.fn()); + + expect(handler.subAgentEventHandler.activityStore.get('agent-9')?.status).toBe('failed'); + }); + + it('does not overwrite a record that already reached terminal state with a summary', () => { + const handler = new SessionEventHandler(makeSessionEventHost()); + const store = handler.subAgentEventHandler.activityStore; + store.ensureRecord({ agentId: 'agent-8', agentName: 'explore', parentToolCallId: 'tc-8' }); + store.markCompleted('agent-8', 'final summary'); + + handler.handleEvent(terminatedEvent('agent-8', 'completed'), vi.fn()); + + const record = store.get('agent-8'); + expect(record?.status).toBe('completed'); + expect(record?.resultSummary).toBe('final summary'); + }); + + it('drops foreground-only records when the main turn ends (aborted subagents emit no lifecycle event)', () => { + const handler = new SessionEventHandler(makeSessionEventHost()); + const store = handler.subAgentEventHandler.activityStore; + store.ensureRecord({ agentId: 'agent-7', agentName: 'explore', parentToolCallId: 'tc-7' }); + + handler.handleEvent( + { + sessionId: 's1', + agentId: 'main', + type: 'turn.ended', + turnId: 1, + reason: 'cancelled', + } as Event, + vi.fn(), + ); + + expect(store.get('agent-7')).toBeUndefined(); + }); +}); diff --git a/apps/kimi-code/test/tui/controllers/subagent-activity-store.test.ts b/apps/kimi-code/test/tui/controllers/subagent-activity-store.test.ts new file mode 100644 index 00000000000..d7c73f2a78a --- /dev/null +++ b/apps/kimi-code/test/tui/controllers/subagent-activity-store.test.ts @@ -0,0 +1,294 @@ +import type { Event } from '@moonshot-ai/kimi-code-sdk'; +import { describe, expect, it } from 'vitest'; + +import { + MAX_SUBAGENT_ACTIVITY_STEPS, + SUBAGENT_ARG_STRING_MAX_CHARS, + SUBAGENT_STEP_TEXT_TAIL_CHARS, + SUBAGENT_TOOL_OUTPUT_MAX_CHARS, +} from '#/tui/constant/rendering'; +import { STREAMING_ARGS_PREVIEW_MAX_CHARS } from '#/tui/constant/streaming'; +import { + SubagentActivityStore, + type SubagentActivitySpawn, +} from '#/tui/controllers/subagent-activity-store'; + +function ev(partial: Record): Event { + return { sessionId: 's1', agentId: 'agent-1', ...partial } as unknown as Event; +} + +function spawn(overrides: Partial = {}): SubagentActivitySpawn { + return { + agentId: 'agent-1', + agentName: 'explore', + description: 'find things', + parentToolCallId: 'tc-1', + model: 'K3', + effort: 'high', + ...overrides, + }; +} + +describe('SubagentActivityStore', () => { + it('folds a full step lifecycle (text + tool call + result)', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 0 })); + store.applyEvent(ev({ type: 'assistant.delta', turnId: 1, delta: 'Hello ' })); + store.applyEvent(ev({ type: 'assistant.delta', turnId: 1, delta: 'world' })); + store.applyEvent( + ev({ type: 'tool.call.started', turnId: 1, toolCallId: 't1', name: 'Grep', args: { pattern: 'foo' } }), + ); + store.applyEvent( + ev({ type: 'tool.progress', turnId: 1, toolCallId: 't1', update: { kind: 'stdout', text: 'line1\nline2\n' } }), + ); + store.applyEvent( + ev({ type: 'tool.result', turnId: 1, toolCallId: 't1', output: 'a\nb\nc', isError: false }), + ); + + const record = store.get('agent-1'); + expect(record?.agentName).toBe('explore'); + expect(record?.steps).toHaveLength(1); + expect(record?.totalSteps).toBe(1); + expect(record?.steps[0]?.textTail).toBe('Hello world'); + const call = record?.steps[0]?.toolCalls[0]; + expect(call?.name).toBe('Grep'); + expect(call?.args).toEqual({ pattern: 'foo' }); + expect(call?.status).toBe('done'); + expect(call?.result?.output).toBe('a\nb\nc'); + expect(call?.result?.is_error).toBe(false); + expect(call?.liveOutputTail).toBeUndefined(); + expect(call?.durationMs).toBeGreaterThanOrEqual(0); + expect(record?.version).toBeGreaterThan(0); + }); + + it('creates a call from streaming deltas and replaces args on start', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent( + ev({ type: 'tool.call.delta', turnId: 1, toolCallId: 't1', name: 'Bash', argumentsPart: '{"command":"ls' }), + ); + store.applyEvent( + ev({ type: 'tool.call.delta', turnId: 1, toolCallId: 't1', argumentsPart: ' -la"}' }), + ); + + let record = store.get('agent-1'); + // No step event yet — a synthetic step holds the in-flight call. + expect(record?.steps).toHaveLength(1); + expect(record?.steps[0]?.toolCalls[0]?.args).toEqual({ command: 'ls -la' }); + + store.applyEvent( + ev({ + type: 'tool.call.started', + turnId: 1, + toolCallId: 't1', + name: 'Bash', + args: { command: 'ls -la', timeout: 5 }, + }), + ); + record = store.get('agent-1'); + expect(record?.steps[0]?.toolCalls[0]?.args).toEqual({ command: 'ls -la', timeout: 5 }); + }); + + it('evicts whole steps beyond the cap while totalSteps keeps counting', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + for (let i = 0; i < MAX_SUBAGENT_ACTIVITY_STEPS + 2; i++) { + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: i })); + } + const record = store.get('agent-1'); + expect(record?.steps).toHaveLength(MAX_SUBAGENT_ACTIVITY_STEPS); + expect(record?.totalSteps).toBe(MAX_SUBAGENT_ACTIVITY_STEPS + 2); + expect(record?.steps[0]?.step).toBe(2); + }); + + it('keeps only the tail of long assistant text', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 0 })); + store.applyEvent( + ev({ + type: 'assistant.delta', + turnId: 1, + delta: 'x'.repeat(SUBAGENT_STEP_TEXT_TAIL_CHARS) + 'y'.repeat(100), + }), + ); + const step = store.get('agent-1')?.steps[0]; + expect(step?.textTail).toHaveLength(SUBAGENT_STEP_TEXT_TAIL_CHARS); + expect(step?.textTail.endsWith('y'.repeat(100))).toBe(true); + }); + + it('caps tool output and appends a truncation sentinel', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 0 })); + store.applyEvent( + ev({ type: 'tool.call.started', turnId: 1, toolCallId: 't1', name: 'Bash', args: {} }), + ); + store.applyEvent( + ev({ + type: 'tool.result', + turnId: 1, + toolCallId: 't1', + output: 'y'.repeat(SUBAGENT_TOOL_OUTPUT_MAX_CHARS + 100), + }), + ); + const call = store.get('agent-1')?.steps[0]?.toolCalls[0]; + expect(call?.result?.output.startsWith('yyy')).toBe(true); + expect(call?.result?.output).toContain('[output truncated'); + expect(call?.result?.output.length).toBeLessThan(SUBAGENT_TOOL_OUTPUT_MAX_CHARS + 120); + }); + + it('marks the current step on retry without opening a new one', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 0 })); + store.applyEvent( + ev({ + type: 'turn.step.retrying', + turnId: 1, + step: 0, + nextAttempt: 2, + maxAttempts: 5, + errorName: 'RateLimitError', + }), + ); + let record = store.get('agent-1'); + expect(record?.steps).toHaveLength(1); + expect(record?.steps[0]?.retrying).toContain('2/5'); + + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 1 })); + record = store.get('agent-1'); + expect(record?.steps[1]?.retrying).toBeUndefined(); + }); + + it('implicitly creates a record for events from an unseen agent', () => { + const store = new SubagentActivityStore(); + store.applyEvent(ev({ type: 'assistant.delta', turnId: 1, delta: 'hi' })); + const record = store.get('agent-1'); + expect(record?.agentName).toBe('agent-1'); + expect(record?.steps[0]?.textTail).toBe('hi'); + }); + + it('drops results for unknown agents instead of creating records', () => { + const store = new SubagentActivityStore(); + store.applyEvent(ev({ type: 'tool.result', turnId: 1, toolCallId: 't1', output: 'x' })); + expect(store.get('agent-1')).toBeUndefined(); + }); + + it('caps the raw streaming-args buffer at the preview window', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent( + ev({ + type: 'tool.call.delta', + turnId: 1, + toolCallId: 't1', + name: 'Write', + argumentsPart: 'x'.repeat(STREAMING_ARGS_PREVIEW_MAX_CHARS + 1000), + }), + ); + const buffers = ( + store as unknown as { streamingArgs: Map } + ).streamingArgs; + expect(buffers.get('agent-1:t1')?.length).toBeLessThanOrEqual(STREAMING_ARGS_PREVIEW_MAX_CHARS); + }); + + it('tracks terminal state and resets it on respawn', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.markCompleted('agent-1', 'done summary'); + let record = store.get('agent-1'); + expect(record?.status).toBe('completed'); + expect(record?.resultSummary).toBe('done summary'); + + store.ensureRecord(spawn()); + record = store.get('agent-1'); + expect(record?.status).toBe('running'); + expect(record?.resultSummary).toBeUndefined(); + + store.markFailed('agent-1', 'boom'); + record = store.get('agent-1'); + expect(record?.status).toBe('failed'); + expect(record?.error).toBe('boom'); + }); + + it('clear() releases all records', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: 0 })); + store.clear(); + expect(store.get('agent-1')).toBeUndefined(); + }); + + it('drop() removes one record along with its streaming buffers', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.ensureRecord(spawn({ agentId: 'agent-2', agentName: 'general' })); + store.applyEvent( + ev({ type: 'tool.call.delta', turnId: 1, toolCallId: 't1', name: 'Write', argumentsPart: '{"path":"a"}' }), + ); + + store.drop('agent-1'); + + expect(store.get('agent-1')).toBeUndefined(); + expect(store.get('agent-2')).toBeDefined(); + const buffers = ( + store as unknown as { streamingArgs: Map } + ).streamingArgs; + expect([...buffers.keys()].every((key) => !key.startsWith('agent-1:'))).toBe(true); + }); + + it('caps long string argument values retained in a record', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent( + ev({ + type: 'tool.call.started', + turnId: 1, + toolCallId: 't1', + name: 'Write', + args: { path: 'a.ts', content: 'c'.repeat(SUBAGENT_ARG_STRING_MAX_CHARS + 500) }, + }), + ); + const call = store.get('agent-1')?.steps[0]?.toolCalls[0]; + expect(typeof call?.args['content']).toBe('string'); + expect((call?.args['content'] as string).length).toBeLessThanOrEqual( + SUBAGENT_ARG_STRING_MAX_CHARS + 1, + ); + expect(call?.args['path']).toBe('a.ts'); + }); + + it('drops delta-only arg buffers when their step is evicted', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + // A call truncated before started/result only ever produced deltas. + store.applyEvent( + ev({ type: 'tool.call.delta', turnId: 1, toolCallId: 't-trunc', name: 'Write', argumentsPart: '{"path":"a"' }), + ); + const buffers = ( + store as unknown as { streamingArgs: Map } + ).streamingArgs; + expect(buffers.has('agent-1:t-trunc')).toBe(true); + + for (let i = 0; i < MAX_SUBAGENT_ACTIVITY_STEPS; i++) { + store.applyEvent(ev({ type: 'turn.step.started', turnId: 1, step: i })); + } + expect(buffers.has('agent-1:t-trunc')).toBe(false); + }); + + it('drops leftover arg buffers when the record turns terminal', () => { + const store = new SubagentActivityStore(); + store.ensureRecord(spawn()); + store.applyEvent( + ev({ type: 'tool.call.delta', turnId: 1, toolCallId: 't-trunc', name: 'Write', argumentsPart: '{"path":"a"' }), + ); + const buffers = ( + store as unknown as { streamingArgs: Map } + ).streamingArgs; + expect(buffers.has('agent-1:t-trunc')).toBe(true); + + store.markCompleted('agent-1', 'done'); + expect(buffers.has('agent-1:t-trunc')).toBe(false); + }); +}); diff --git a/apps/kimi-code/test/tui/tasks-browser.test.ts b/apps/kimi-code/test/tui/tasks-browser.test.ts index 331389a56aa..7d5a54c3bff 100644 --- a/apps/kimi-code/test/tui/tasks-browser.test.ts +++ b/apps/kimi-code/test/tui/tasks-browser.test.ts @@ -1,5 +1,5 @@ import type { Terminal } from '@moonshot-ai/pi-tui'; -import type { BackgroundTaskInfo, BackgroundTaskStatus } from '@moonshot-ai/kimi-code-sdk'; +import type { BackgroundTaskInfo, BackgroundTaskStatus, Event } from '@moonshot-ai/kimi-code-sdk'; import { describe, expect, it, vi } from 'vitest'; import { @@ -7,6 +7,10 @@ import { type TasksBrowserProps, type TasksFilter, } from '@/tui/components/dialogs/tasks-browser'; +import { AgentActivityViewer } from '@/tui/components/dialogs/agent-activity-viewer'; +import { TaskOutputViewer } from '@/tui/components/dialogs/task-output-viewer'; +import { SubagentActivityStore } from '@/tui/controllers/subagent-activity-store'; +import { TasksBrowserController } from '@/tui/controllers/tasks-browser'; import { darkColors } from '@/tui/theme/colors'; const ANSI_SGR = /\[[0-9;]*m/g; @@ -539,3 +543,123 @@ describe('TasksBrowserApp — setProps', () => { } }); }); + +describe('TasksBrowserController — opening an agent task', () => { + function makeControllerHost(tasks: BackgroundTaskInfo[], store: SubagentActivityStore) { + const ui = { + children: [] as unknown[], + clear() { + this.children = []; + }, + addChild(child: unknown) { + this.children.push(child); + }, + setFocus: () => {}, + requestRender: () => {}, + }; + const state = { + tasksBrowser: undefined as unknown, + terminal: fakeTerminal(30), + ui, + editor: {}, + }; + const host = { + state, + backgroundTasks: new Map(tasks.map((t) => [t.taskId, t])), + sessionEventHandler: { subAgentEventHandler: { activityStore: store } }, + session: { + listBackgroundTasks: async () => tasks, + getBackgroundTaskOutput: async () => 'captured output', + }, + showError: vi.fn(), + setTasksBrowser(value: unknown) { + state.tasksBrowser = value; + }, + }; + return { host, state }; + } + + function agentTaskInfo(store: SubagentActivityStore | null): BackgroundTaskInfo { + const info = task({ + taskId: 'agent-task-1', + kind: 'agent', + agentId: 'agent-1', + status: 'running', + } as Partial); + if (store !== null) { + store.ensureRecord({ agentId: 'agent-1', agentName: 'explore', parentToolCallId: 'tc-1' }); + } + return info; + } + + async function openSelectedViewer(controller: TasksBrowserController, taskId: string) { + await ( + controller as unknown as { handleOpenOutput(taskId: string): Promise } + ).handleOpenOutput(taskId); + } + + it('opens the activity viewer when a record exists for the agent', async () => { + const store = new SubagentActivityStore(); + const { host, state } = makeControllerHost([agentTaskInfo(store)], store); + const controller = new TasksBrowserController(host as never); + await controller.show(); + + await openSelectedViewer(controller, 'agent-task-1'); + + const viewer = (state.tasksBrowser as { viewer: { component: unknown } }).viewer; + expect(viewer.component).toBeInstanceOf(AgentActivityViewer); + controller.close(); + }); + + it('falls back to the output viewer when no record exists', async () => { + const store = new SubagentActivityStore(); + const { host, state } = makeControllerHost([agentTaskInfo(null)], store); + const controller = new TasksBrowserController(host as never); + await controller.show(); + + await openSelectedViewer(controller, 'agent-task-1'); + + const viewer = (state.tasksBrowser as { viewer: { component: unknown } }).viewer; + expect(viewer.component).toBeInstanceOf(TaskOutputViewer); + controller.close(); + }); + + it('feeds the preview pane from the activity store for agent tasks', async () => { + const store = new SubagentActivityStore(); + store.ensureRecord({ agentId: 'agent-1', agentName: 'explore', parentToolCallId: 'tc-1' }); + store.applyEvent({ + sessionId: 's1', + agentId: 'agent-1', + type: 'turn.step.started', + turnId: 1, + step: 0, + } as Event); + store.applyEvent({ + sessionId: 's1', + agentId: 'agent-1', + type: 'tool.call.started', + turnId: 1, + toolCallId: 't1', + name: 'Grep', + args: { pattern: 'foo' }, + } as Event); + store.applyEvent({ + sessionId: 's1', + agentId: 'agent-1', + type: 'tool.result', + turnId: 1, + toolCallId: 't1', + output: 'src/a.ts:1:foo\nsrc/b.ts:2:foo', + isError: false, + } as Event); + + const { host, state } = makeControllerHost([agentTaskInfo(null)], store); + const controller = new TasksBrowserController(host as never); + await controller.show(); + + const browser = state.tasksBrowser as { tailOutput?: string }; + expect(browser.tailOutput).toContain('── step 0 ──'); + expect(browser.tailOutput).toContain('✓ Used Grep (foo) · 2 matches'); + controller.close(); + }); +}); diff --git a/packages/acp-server/test/acp-fs.test.ts b/packages/acp-server/test/acp-fs.test.ts index 1d6c75d2b82..3f7a1ec931d 100644 --- a/packages/acp-server/test/acp-fs.test.ts +++ b/packages/acp-server/test/acp-fs.test.ts @@ -51,7 +51,7 @@ describe('AcpHostFileSystem', () => { afterEach(async () => { if (tempDir !== undefined) { - await rm(tempDir, { recursive: true, force: true }); + await rm(tempDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); tempDir = undefined; } }); diff --git a/packages/acp-server/test/close.test.ts b/packages/acp-server/test/close.test.ts index bc79f66dfa6..21a2bde25e1 100644 --- a/packages/acp-server/test/close.test.ts +++ b/packages/acp-server/test/close.test.ts @@ -16,7 +16,7 @@ describe('acp-server session/close', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); diff --git a/packages/acp-server/test/config.test.ts b/packages/acp-server/test/config.test.ts index fa0d690dff0..2b6e14e84ca 100644 --- a/packages/acp-server/test/config.test.ts +++ b/packages/acp-server/test/config.test.ts @@ -35,7 +35,7 @@ describe('acp-server config surface', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); diff --git a/packages/acp-server/test/convert.test.ts b/packages/acp-server/test/convert.test.ts index 05ac5698346..fe34f16627d 100644 --- a/packages/acp-server/test/convert.test.ts +++ b/packages/acp-server/test/convert.test.ts @@ -93,7 +93,7 @@ describe('compressPromptImageParts', () => { const trash: string[] = []; afterEach(async () => { - await Promise.all(trash.splice(0).map((dir) => rm(dir, { recursive: true, force: true }))); + await Promise.all(trash.splice(0).map((dir) => rm(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }))); }); async function tempOriginalsDir(): Promise { diff --git a/packages/acp-server/test/e2e-turn.test.ts b/packages/acp-server/test/e2e-turn.test.ts index ec1f5686e94..b14a327e457 100644 --- a/packages/acp-server/test/e2e-turn.test.ts +++ b/packages/acp-server/test/e2e-turn.test.ts @@ -39,7 +39,7 @@ describe('acp-server real prompt turn (scripted LLM)', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); @@ -562,7 +562,7 @@ describe('acp-server prompt error hygiene', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); @@ -609,7 +609,7 @@ describe('acp-server builtin slash commands (local execution, no LLM turn)', () client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); @@ -826,7 +826,7 @@ describe('acp-server terminal reverse-RPC (clientCapabilities.terminal)', () => client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); diff --git a/packages/acp-server/test/initialize.test.ts b/packages/acp-server/test/initialize.test.ts index 9a6e82b4dbc..1254db30bd4 100644 --- a/packages/acp-server/test/initialize.test.ts +++ b/packages/acp-server/test/initialize.test.ts @@ -92,7 +92,7 @@ describe('acp-server initialize handshake', () => { toAgent.end(); toClient.end(); } finally { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } }, 30_000, @@ -125,7 +125,7 @@ describe('acp-server initialize handshake', () => { toAgent.end(); toClient.end(); } finally { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } }, 30_000, @@ -176,7 +176,7 @@ describe('acp-server initialize handshake', () => { toAgent.end(); toClient.end(); } finally { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); } }, 30_000, diff --git a/packages/acp-server/test/lifecycle.test.ts b/packages/acp-server/test/lifecycle.test.ts index edc6507c186..f6e910fd738 100644 --- a/packages/acp-server/test/lifecycle.test.ts +++ b/packages/acp-server/test/lifecycle.test.ts @@ -73,7 +73,7 @@ describe('acp-server session lifecycle', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); diff --git a/packages/acp-server/test/skills.test.ts b/packages/acp-server/test/skills.test.ts index 3b26cd1b0df..0d89d350e52 100644 --- a/packages/acp-server/test/skills.test.ts +++ b/packages/acp-server/test/skills.test.ts @@ -84,7 +84,7 @@ describe('acp-server skills / available commands', () => { client = undefined; } if (homeDir !== undefined) { - await rm(homeDir, { recursive: true, force: true }); + await rm(homeDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 }); homeDir = undefined; } }); From 911d41b0f6aa83ef08b2ee5fe8d055218c0951b2 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Tue, 11 Aug 2026 21:37:00 +0800 Subject: [PATCH 09/50] chore(changesets): simplify pending CLI changelog entries (#2823) --- .changeset/calm-mcp-auth-probe.md | 2 +- .changeset/compaction-token-full-request-basis.md | 2 +- .changeset/fix-tui-startup-freeze.md | 2 +- .changeset/isolate-session-profile-catalogs.md | 2 +- .changeset/windows-bare-command-binary-planting.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.changeset/calm-mcp-auth-probe.md b/.changeset/calm-mcp-auth-probe.md index 989a0b6ddda..383f06df581 100644 --- a/.changeset/calm-mcp-auth-probe.md +++ b/.changeset/calm-mcp-auth-probe.md @@ -3,4 +3,4 @@ "@moonshot-ai/kimi-code-sdk": patch --- -Detect MCP servers that require OAuth by reusing the existing connection-time authorization check. +Detect MCP servers that require OAuth without needing `auth: "oauth"` in the config. diff --git a/.changeset/compaction-token-full-request-basis.md b/.changeset/compaction-token-full-request-basis.md index 39b1b23d18d..ccc80462f00 100644 --- a/.changeset/compaction-token-full-request-basis.md +++ b/.changeset/compaction-token-full-request-basis.md @@ -2,4 +2,4 @@ "@moonshot-ai/kimi-code": patch --- -Fix the token counts reported after compaction reading far below the real context size: the before/after stats and the context gauge now include the system prompt and tool definitions, matching the numbers shown while the session runs. +Fix the token counts reported after compaction reading far below the real context size; they now match the numbers shown while the session runs. diff --git a/.changeset/fix-tui-startup-freeze.md b/.changeset/fix-tui-startup-freeze.md index 71991eb225b..ac7b102608e 100644 --- a/.changeset/fix-tui-startup-freeze.md +++ b/.changeset/fix-tui-startup-freeze.md @@ -2,4 +2,4 @@ "@moonshot-ai/kimi-code": patch --- -Fix multi-second typing and rendering freezes at startup or while idle when a large search index loads, replays, or rebuilds. +Fix multi-second freezes at startup or while idle when a large search index loads, replays, or rebuilds. diff --git a/.changeset/isolate-session-profile-catalogs.md b/.changeset/isolate-session-profile-catalogs.md index fa8483dacd1..7f82d2ccbdf 100644 --- a/.changeset/isolate-session-profile-catalogs.md +++ b/.changeset/isolate-session-profile-catalogs.md @@ -2,4 +2,4 @@ "@moonshot-ai/kimi-code": patch --- -Prevent one session's subagent tool projection from changing builtin profiles in later sessions. +Fix subagent tool changes in one session leaking into builtin profiles in later sessions. diff --git a/.changeset/windows-bare-command-binary-planting.md b/.changeset/windows-bare-command-binary-planting.md index 6c29f6026fd..d4652ae77f9 100644 --- a/.changeset/windows-bare-command-binary-planting.md +++ b/.changeset/windows-bare-command-binary-planting.md @@ -2,4 +2,4 @@ "@moonshot-ai/kimi-code": patch --- -Fix a Windows binary-planting risk: child processes spawned by bare command name before the workspace trust prompt (stty, fd detection, package-manager update installs) could resolve to a malicious executable placed in the current directory. These commands are now skipped on Windows, deferred until after the trust prompt, or resolved to an absolute PATH location with hits inside the current directory refused. +Fix a Windows security risk where commands launched before the workspace trust prompt could run a malicious executable placed in the current folder. From 619564dcf9ee10a3cfbf7ecbc764c6b9b63fc91b Mon Sep 17 00:00:00 2001 From: qer Date: Wed, 12 Aug 2026 00:28:03 +0800 Subject: [PATCH 10/50] fix(kap-server): add WebSocket heartbeat to survive proxy idle timeouts (#2813) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The v1 WS connection had no keepalive: by design it stayed open until the client disconnected, which only holds for direct connections. Behind a reverse proxy or gateway with an idle timeout (30s defaults are common), any quiet stretch — e.g. waiting on a slow model response — got the connection killed, surfacing as a recurring 'Realtime connection error' in the web UI. Send an application-level ping every 10s and advertise heartbeat_ms in server_hello (the schema and all shipped clients already answer pong). Application-level rather than protocol-level ping because browser JS cannot observe the latter, and the client's stale-socket detector keys on incoming message frames. Any inbound frame refreshes liveness; after two silent cycles the connection is presumed half-open and closed with 1001 so dead peers get reaped instead of leaking. --- .changeset/ws-heartbeat-keepalive.md | 5 + .../kap-server/src/protocol/ws-control.ts | 5 +- .../src/transport/ws/v1/protocol.ts | 12 ++ .../src/transport/ws/v1/registerWsV1.ts | 3 + .../src/transport/ws/v1/wsConnectionV1.ts | 56 ++++++++- .../kap-server/test/wsConnectionV1.test.ts | 110 ++++++++++++++++++ 6 files changed, 185 insertions(+), 6 deletions(-) create mode 100644 .changeset/ws-heartbeat-keepalive.md diff --git a/.changeset/ws-heartbeat-keepalive.md b/.changeset/ws-heartbeat-keepalive.md new file mode 100644 index 00000000000..cd18b42ff60 --- /dev/null +++ b/.changeset/ws-heartbeat-keepalive.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix the web UI repeatedly losing its realtime connection every ~30 seconds when the server runs behind a reverse proxy or gateway with an idle connection timeout; the server now sends a WebSocket heartbeat and only closes connections that stop responding entirely. diff --git a/packages/kap-server/src/protocol/ws-control.ts b/packages/kap-server/src/protocol/ws-control.ts index 4fef9de57a8..536a1dccfe0 100644 --- a/packages/kap-server/src/protocol/ws-control.ts +++ b/packages/kap-server/src/protocol/ws-control.ts @@ -77,8 +77,9 @@ export const serverHelloPayloadSchema = z.object({ ws_connection_id: z.string(), protocol_version: z.number().int().positive(), /** - * Legacy servers advertise their ping interval here. kap-server dropped the - * server-initiated heartbeat and omits this field — clients must treat it as + * Server heartbeat interval. kap-server sends an application-level `ping` + * at this cadence and closes the connection after two silent cycles; older + * servers omit the field and send no heartbeat, so clients must treat it as * advisory and not require it. */ heartbeat_ms: z.number().int().positive().optional(), diff --git a/packages/kap-server/src/transport/ws/v1/protocol.ts b/packages/kap-server/src/transport/ws/v1/protocol.ts index 2363ee89207..b86c4ddab4c 100644 --- a/packages/kap-server/src/transport/ws/v1/protocol.ts +++ b/packages/kap-server/src/transport/ws/v1/protocol.ts @@ -9,6 +9,8 @@ export interface ServerHelloPayload { ws_connection_id: string; protocol_version: number; + /** Server heartbeat cadence — a `ping` frame arrives at least this often. */ + heartbeat_ms: number; max_event_buffer_size: number; capabilities: { event_batching: boolean; @@ -26,6 +28,16 @@ export function buildServerHello(payload: ServerHelloPayload): ServerHelloFrame return { type: 'server_hello', timestamp: new Date().toISOString(), payload }; } +export interface PingFrame { + type: 'ping'; + timestamp: string; + payload: { nonce: string }; +} + +export function buildPing(nonce: string): PingFrame { + return { type: 'ping', timestamp: new Date().toISOString(), payload: { nonce } }; +} + export interface AckFrame

{ type: 'ack'; id: string; diff --git a/packages/kap-server/src/transport/ws/v1/registerWsV1.ts b/packages/kap-server/src/transport/ws/v1/registerWsV1.ts index a6b39c10814..c4cc6580b19 100644 --- a/packages/kap-server/src/transport/ws/v1/registerWsV1.ts +++ b/packages/kap-server/src/transport/ws/v1/registerWsV1.ts @@ -32,6 +32,8 @@ export interface RegisterWsV1Options { readonly flushIntervalMs?: number; readonly maxBatchSize?: number; readonly highWaterMarkBytes?: number; + /** Heartbeat ping cadence override — tests inject small values. */ + readonly heartbeatIntervalMs?: number; } export function registerWsV1(core: Scope, opts: RegisterWsV1Options): WebSocketServer { @@ -53,6 +55,7 @@ export function registerWsV1(core: Scope, opts: RegisterWsV1Options): WebSocketS flushIntervalMs: opts.flushIntervalMs, maxBatchSize: opts.maxBatchSize, highWaterMarkBytes: opts.highWaterMarkBytes, + heartbeatIntervalMs: opts.heartbeatIntervalMs, }); socket.on('close', () => registry.remove(conn.id)); }); diff --git a/packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts b/packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts index 2545faf5b8b..38d8af3b627 100644 --- a/packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts +++ b/packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts @@ -12,10 +12,16 @@ * them to the same shared attach path (`attachSession`). Transcript grade * subscriptions are a separate concern carried ONLY by `subscribe_v2`. * - * The server never initiates a disconnect: unlike v1's `WsConnection` - * (`packages/server/src/ws/connection.ts`) there is no ping/pong heartbeat — - * a connection stays open until the client closes it or the process shuts - * down. + * Heartbeat: the server sends an application-level `ping` frame every + * {@link DEFAULT_HEARTBEAT_INTERVAL_MS} (advertised as `heartbeat_ms` in + * `server_hello`). Protocol-level WS ping/pong is NOT used because browser + * clients cannot observe it from JS — an application-level frame is what + * feeds the client's stale-socket detector. Any inbound frame (a `pong`, + * but also ordinary control traffic) proves the peer is alive; after two + * full silent cycles the connection is presumed half-open (laptop asleep, + * network silently gone) and closed with 1001. Besides liveness this keeps + * intermediaries (reverse proxies with ~30s idle timeouts) from dropping + * idle connections. */ import { @@ -39,6 +45,7 @@ import { } from './sessionEventJournal'; import { buildAck, + buildPing, buildResyncRequired, buildServerHello, } from './protocol'; @@ -54,6 +61,15 @@ import { FsWatchBridge } from './fsWatchBridge'; const DEFAULT_MAX_BUFFER_SIZE = 1000; +/** + * Application-level heartbeat cadence. 10s keeps connections alive through + * intermediaries with ~30s idle timeouts (3x headroom) and bounds how long a + * half-open connection goes unnoticed. + */ +const DEFAULT_HEARTBEAT_INTERVAL_MS = 10_000; +/** Close the connection once no inbound frame has arrived for this many cycles. */ +const HEARTBEAT_MISS_LIMIT = 2; + /** Per-session subscription state held by the connection (see `TargetSubscription`). */ type SessionSubscription = TargetSubscription; @@ -96,6 +112,8 @@ export interface WsConnectionV1Options { readonly maxBatchSize?: number; /** `socket.bufferedAmount` above which flushing is deferred (backpressure). */ readonly highWaterMarkBytes?: number; + /** Heartbeat ping cadence; advertised as `heartbeat_ms` in `server_hello`. */ + readonly heartbeatIntervalMs?: number; } export class WsConnectionV1 implements BroadcastTarget { @@ -112,6 +130,7 @@ export class WsConnectionV1 implements BroadcastTarget { private readonly flushIntervalMs: number; private readonly maxBatchSize: number; private readonly highWaterMarkBytes: number; + private readonly heartbeatIntervalMs: number; private readonly logger?: JournalLogger; private closed = false; @@ -134,6 +153,10 @@ export class WsConnectionV1 implements BroadcastTarget { /** Epoch ms when the current backpressure deferral started; caps the wait. */ private backpressureSince?: number; + private heartbeatTimer?: ReturnType; + /** Epoch ms of the most recent inbound frame — any frame proves the peer is alive. */ + private lastInboundAt = Date.now(); + constructor(opts: WsConnectionV1Options) { this.id = `conn_${ulid()}`; this.connectedAt = new Date().toISOString(); @@ -148,6 +171,7 @@ export class WsConnectionV1 implements BroadcastTarget { this.flushIntervalMs = opts.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS; this.maxBatchSize = opts.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE; this.highWaterMarkBytes = opts.highWaterMarkBytes ?? DEFAULT_HIGH_WATER_MARK_BYTES; + this.heartbeatIntervalMs = opts.heartbeatIntervalMs ?? DEFAULT_HEARTBEAT_INTERVAL_MS; this.socket.on('message', (data: RawData) => this.onMessage(data)); this.socket.on('close', () => this.onClose()); @@ -162,10 +186,15 @@ export class WsConnectionV1 implements BroadcastTarget { buildServerHello({ ws_connection_id: this.id, protocol_version: WS_PROTOCOL_VERSION, + heartbeat_ms: this.heartbeatIntervalMs, max_event_buffer_size: this.maxBufferSize, capabilities: { event_batching: false, compression: false }, }), ); + this.heartbeatTimer = setInterval(() => { + this.onHeartbeat(); + }, this.heartbeatIntervalMs); + this.heartbeatTimer.unref?.(); } get hasClientHello(): boolean { @@ -191,8 +220,13 @@ export class WsConnectionV1 implements BroadcastTarget { return; // non-JSON frame — drop } if (typeof frame?.type !== 'string') return; + // Any well-formed inbound frame — pongs included — proves the peer is alive. + this.lastInboundAt = Date.now(); switch (frame.type) { + case 'pong': + // Heartbeat reply; the liveness timestamp above is all it needs to do. + return; case 'client_hello': this.enqueueControl(() => this.onClientHello(frame)); return; @@ -227,6 +261,19 @@ export class WsConnectionV1 implements BroadcastTarget { }); } + /** + * Heartbeat tick: reap first, ping second. A peer silent for two full cycles + * (no pong, no control traffic at all) is half-open — close it rather than + * ping a dead pipe. The close also fires the client's reconnect path. + */ + private onHeartbeat(): void { + if (Date.now() - this.lastInboundAt >= this.heartbeatIntervalMs * HEARTBEAT_MISS_LIMIT) { + this.close(1001, 'heartbeat timeout'); + return; + } + this.sendImmediateFrame(buildPing(ulid())); + } + private async onClientHello(frame: InboundFrame): Promise { if (!(await this.authorize(frame))) return; this.gotClientHello = true; @@ -616,6 +663,7 @@ export class WsConnectionV1 implements BroadcastTarget { this.closed = true; if (this.flushTimer !== undefined) clearTimeout(this.flushTimer); if (this.backpressureRetryTimer !== undefined) clearTimeout(this.backpressureRetryTimer); + if (this.heartbeatTimer !== undefined) clearInterval(this.heartbeatTimer); this.outbound = []; this.broadcaster.removeGlobalTarget(this); for (const sid of this.subscriptions.keys()) this.broadcaster.unsubscribe(sid, this); diff --git a/packages/kap-server/test/wsConnectionV1.test.ts b/packages/kap-server/test/wsConnectionV1.test.ts index 1dd1707b77c..0b0c8a5b98a 100644 --- a/packages/kap-server/test/wsConnectionV1.test.ts +++ b/packages/kap-server/test/wsConnectionV1.test.ts @@ -765,6 +765,116 @@ describe('WsConnectionV1 outbound buffer', () => { }); }); +// --------------------------------------------------------------------------- +// WsConnectionV1 — heartbeat +// --------------------------------------------------------------------------- + +describe('WsConnectionV1 heartbeat', () => { + beforeEach(() => { + vi.useFakeTimers(); + }); + afterEach(() => { + vi.useRealTimers(); + }); + + function sentTypes(socket: FakeSocket): string[] { + return socket.frames().map((f) => (f as { type: string }).type); + } + + function sentPings(socket: FakeSocket): Array<{ type: string; payload: { nonce: string } }> { + return socket.frames() as Array<{ type: string; payload: { nonce: string } }>; + } + + it('advertises the heartbeat interval in server_hello', () => { + const socket = new FakeSocket(); + const conn = makeConn(socket, { heartbeatIntervalMs: 10 }); + const hello = socket.frames()[0] as { type: string; payload: { heartbeat_ms?: number } }; + expect(hello.type).toBe('server_hello'); + expect(hello.payload.heartbeat_ms).toBe(10); + conn.close(); + }); + + it('defaults to a 10s heartbeat interval', () => { + const socket = new FakeSocket(); + const conn = makeConn(socket); + const hello = socket.frames()[0] as { payload: { heartbeat_ms?: number } }; + expect(hello.payload.heartbeat_ms).toBe(10_000); + conn.close(); + }); + + it('sends a ping every interval while the peer keeps answering', () => { + const socket = new FakeSocket(); + const conn = makeConn(socket, { heartbeatIntervalMs: 10 }); + socket.sent = []; + + for (let i = 0; i < 3; i++) { + vi.advanceTimersByTime(10); + expect(sentTypes(socket)).toHaveLength(i + 1); + socket.emit('message', JSON.stringify({ type: 'pong', payload: { nonce: 'n' } })); + } + + const pings = sentPings(socket); + expect(pings.every((f) => f.type === 'ping')).toBe(true); + expect(typeof pings[0]!.payload.nonce).toBe('string'); + expect(new Set(pings.map((f) => f.payload.nonce)).size).toBe(3); + expect(socket.closeCalls).toHaveLength(0); + conn.close(); + }); + + it('reaps the connection after two silent cycles', () => { + const socket = new FakeSocket(); + const conn = makeConn(socket, { heartbeatIntervalMs: 10 }); + socket.sent = []; + + vi.advanceTimersByTime(10); + expect(sentTypes(socket)).toEqual(['ping']); + expect(socket.closeCalls).toHaveLength(0); + + // Second silent cycle: the tick closes instead of pinging again. + vi.advanceTimersByTime(10); + expect(socket.closeCalls).toEqual([{ code: 1001, reason: 'heartbeat timeout' }]); + expect(sentTypes(socket)).toEqual(['ping']); + + // The heartbeat stops with the connection. + vi.advanceTimersByTime(100); + expect(sentTypes(socket)).toEqual(['ping']); + expect(socket.closeCalls).toHaveLength(1); + }); + + it('treats any inbound frame — not just pong — as proof of life', () => { + const socket = new FakeSocket(); + const conn = makeConn(socket, { heartbeatIntervalMs: 10 }); + socket.sent = []; + + // t=10: ping. t=15: an unknown control frame still resets the window. + vi.advanceTimersByTime(15); + socket.emit('message', JSON.stringify({ type: 'some_future_frame', payload: {} })); + + // t=20 (silence 5) and t=30 (silence 15): pings, no reap. + vi.advanceTimersByTime(20); + expect(sentTypes(socket)).toEqual(['ping', 'ping', 'ping']); + expect(socket.closeCalls).toHaveLength(0); + + // t=40: silence 25 ≥ 2 cycles — reaped. + vi.advanceTimersByTime(5); + expect(socket.closeCalls).toEqual([{ code: 1001, reason: 'heartbeat timeout' }]); + }); + + it('stops heartbeating once the socket closes on its own', () => { + const socket = new FakeSocket(); + makeConn(socket, { heartbeatIntervalMs: 10 }); + socket.sent = []; + + vi.advanceTimersByTime(10); + expect(sentTypes(socket)).toEqual(['ping']); + + socket.terminate(); + vi.advanceTimersByTime(100); + expect(sentTypes(socket)).toEqual(['ping']); + expect(socket.closeCalls).toHaveLength(0); + }); +}); + // --------------------------------------------------------------------------- // WsConnectionV1 — global-event registration lifecycle // --------------------------------------------------------------------------- From e5be39164b1b47d0b721aad49c41fdf4ec61a7c5 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Wed, 12 Aug 2026 10:51:57 +0800 Subject: [PATCH 11/50] fix(kimi-code): resolve footer git status commands through PATH (#2838) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The footer git status cache spawns git (and gh for PR lookup) on the startup path, before the workspace trust prompt. On Windows, a bare command name lets cmd.exe resolve a git.exe planted in the workspace before the user confirms trust — a gap left by #2695. Resolve git once at cache creation and gh per lookup with resolveCommandPath(), which returns an absolute PATH hit and refuses matches inside the workspace; when resolution fails the cache reports no repository instead of spawning anything. --- .../git-status-resolved-command-path.md | 5 ++ apps/kimi-code/src/utils/git/git-status.ts | 44 +++++++++++----- .../test/utils/git/git-status.test.ts | 52 ++++++++++++++++++- 3 files changed, 86 insertions(+), 15 deletions(-) create mode 100644 .changeset/git-status-resolved-command-path.md diff --git a/.changeset/git-status-resolved-command-path.md b/.changeset/git-status-resolved-command-path.md new file mode 100644 index 00000000000..bd0b34cde6d --- /dev/null +++ b/.changeset/git-status-resolved-command-path.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Close a Windows binary-planting gap in the footer git status: the git and gh commands used for the branch/dirty badge are now resolved to an absolute PATH location, so an executable planted in an untrusted workspace can no longer run before the workspace trust prompt. diff --git a/apps/kimi-code/src/utils/git/git-status.ts b/apps/kimi-code/src/utils/git/git-status.ts index c77256f01f4..56b7f0af69f 100644 --- a/apps/kimi-code/src/utils/git/git-status.ts +++ b/apps/kimi-code/src/utils/git/git-status.ts @@ -9,6 +9,8 @@ import { execFile, spawnSync } from 'node:child_process'; +import { resolveCommandPath } from '#/utils/process/resolve-command'; + const BRANCH_TTL_MS = 5_000; const STATUS_TTL_MS = 15_000; const PULL_REQUEST_TTL_MS = 60_000; @@ -67,7 +69,11 @@ export function createGitStatusCache( workDir: string, options: GitStatusCacheOptions = {}, ): GitStatusCache { - const isRepo = detectGitRepo(workDir); + // This cache is constructed before the workspace trust gate, so the git + // binary must be resolved through PATH to an absolute path — a bare name + // would let cmd.exe pick up a `git.exe` planted in the workspace. + const git = resolveCommandPath('git', workDir); + const isRepo = git !== undefined && detectGitRepo(git, workDir); let branch: BranchState = { value: null, fetchedAt: 0 }; let status: StatusState = { dirty: false, @@ -87,16 +93,16 @@ export function createGitStatusCache( return { getStatus: () => { - if (!isRepo) return null; + if (!isRepo || git === undefined) return null; const now = Date.now(); if (now - branch.fetchedAt >= BRANCH_TTL_MS) { - branch = { value: readBranch(workDir), fetchedAt: now }; + branch = { value: readBranch(git, workDir), fetchedAt: now }; } if (branch.value === null) return null; if (now - status.fetchedAt >= STATUS_TTL_MS) { - status = { ...readStatus(workDir), fetchedAt: now }; + status = { ...readStatus(git, workDir), fetchedAt: now }; } refreshPullRequestIfNeeded(branch.value, now); @@ -143,9 +149,9 @@ export function createGitStatusCache( } } -function detectGitRepo(workDir: string): boolean { +function detectGitRepo(git: string, workDir: string): boolean { try { - const result = spawnSync('git', ['-C', workDir, 'rev-parse', '--is-inside-work-tree'], { + const result = spawnSync(git, ['-C', workDir, 'rev-parse', '--is-inside-work-tree'], { encoding: 'utf8', timeout: SPAWN_TIMEOUT_MS, }); @@ -155,9 +161,9 @@ function detectGitRepo(workDir: string): boolean { } } -function readBranch(workDir: string): string | null { +function readBranch(git: string, workDir: string): string | null { try { - const result = spawnSync('git', ['-C', workDir, 'branch', '--show-current'], { + const result = spawnSync(git, ['-C', workDir, 'branch', '--show-current'], { encoding: 'utf8', timeout: SPAWN_TIMEOUT_MS, }); @@ -169,7 +175,10 @@ function readBranch(workDir: string): string | null { } } -function readStatus(workDir: string): { +function readStatus( + git: string, + workDir: string, +): { dirty: boolean; ahead: number; behind: number; @@ -177,7 +186,7 @@ function readStatus(workDir: string): { diffDeleted: number; } { try { - const result = spawnSync('git', ['-C', workDir, 'status', '--porcelain', '-b'], { + const result = spawnSync(git, ['-C', workDir, 'status', '--porcelain', '-b'], { encoding: 'utf8', timeout: SPAWN_TIMEOUT_MS, maxBuffer: 4 * 1024 * 1024, @@ -200,7 +209,7 @@ function readStatus(workDir: string): { dirty = true; } } - const diff = dirty ? readDiffStats(workDir) : { added: 0, deleted: 0 }; + const diff = dirty ? readDiffStats(git, workDir) : { added: 0, deleted: 0 }; return { dirty, ahead, @@ -213,9 +222,9 @@ function readStatus(workDir: string): { } } -function readDiffStats(workDir: string): { added: number; deleted: number } { +function readDiffStats(git: string, workDir: string): { added: number; deleted: number } { try { - const result = spawnSync('git', ['-C', workDir, 'diff', '--numstat', 'HEAD', '--'], { + const result = spawnSync(git, ['-C', workDir, 'diff', '--numstat', 'HEAD', '--'], { encoding: 'utf8', timeout: SPAWN_TIMEOUT_MS, maxBuffer: 4 * 1024 * 1024, @@ -244,9 +253,16 @@ function parseDiffNumstatCount(value: string | undefined): number { function readPullRequest(workDir: string): Promise { return new Promise((resolve) => { + // Resolve gh through PATH as well — this runs with cwd = workDir, where a + // planted `gh.exe` would otherwise be picked up by cmd.exe on Windows. + const gh = resolveCommandPath('gh', workDir); + if (gh === undefined) { + resolve(null); + return; + } try { execFile( - 'gh', + gh, ['pr', 'view', '--json', 'number,url'], { cwd: workDir, diff --git a/apps/kimi-code/test/utils/git/git-status.test.ts b/apps/kimi-code/test/utils/git/git-status.test.ts index 951816fd220..962bd8aa19c 100644 --- a/apps/kimi-code/test/utils/git/git-status.test.ts +++ b/apps/kimi-code/test/utils/git/git-status.test.ts @@ -1,9 +1,10 @@ /* eslint-disable import/first -- vi.mock setup must run before the imports it stubs out. */ -import { afterEach, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; const mocks = vi.hoisted(() => ({ spawnSync: vi.fn(), execFile: vi.fn(), + resolveCommandPath: vi.fn(), })); vi.mock('node:child_process', () => ({ @@ -11,8 +12,16 @@ vi.mock('node:child_process', () => ({ spawnSync: mocks.spawnSync, })); +vi.mock('#/utils/process/resolve-command', () => ({ + resolveCommandPath: mocks.resolveCommandPath, +})); + import { createGitStatusCache, formatGitBadge } from '#/utils/git/git-status'; +beforeEach(() => { + mocks.resolveCommandPath.mockImplementation((command: string) => `/usr/bin/${command}`); +}); + afterEach(() => { vi.useRealTimers(); vi.clearAllMocks(); @@ -200,6 +209,47 @@ describe('git status cache', () => { }); }); + it('returns null without spawning when git cannot be resolved to a safe path', () => { + mocks.resolveCommandPath.mockReturnValue(undefined); + expect(createGitStatusCache('/tmp/repo').getStatus()).toBeNull(); + expect(mocks.spawnSync).not.toHaveBeenCalled(); + expect(mocks.execFile).not.toHaveBeenCalled(); + }); + + it('spawns git and gh through their resolved absolute paths', async () => { + mocks.execFile.mockImplementation( + ( + _cmd: string, + _args: string[], + _options: unknown, + callback: (error: Error | null, stdout: string, stderr: string) => void, + ) => { + callback(new Error('no pull request'), '', ''); + }, + ); + mocks.spawnSync.mockImplementation((_cmd: string, args: string[]) => { + if (args.includes('rev-parse')) return { status: 0, stdout: 'true\n' }; + if (args.includes('branch')) return { status: 0, stdout: 'main\n' }; + if (args.includes('status')) return { status: 0, stdout: '## main...origin/main\n' }; + return { status: 1, stdout: '' }; + }); + + const cache = createGitStatusCache('/tmp/repo'); + expect(cache.getStatus()).not.toBeNull(); + await Promise.resolve(); + + expect(mocks.resolveCommandPath).toHaveBeenCalledWith('git', '/tmp/repo'); + for (const call of mocks.spawnSync.mock.calls) { + expect(call[0]).toBe('/usr/bin/git'); + } + expect(mocks.execFile).toHaveBeenCalledWith( + '/usr/bin/gh', + expect.any(Array), + expect.anything(), + expect.any(Function), + ); + }); + it('returns null when the working directory is not a git repo and formats badges', () => { mocks.spawnSync.mockReturnValue({ status: 1, stdout: '' }); expect(createGitStatusCache('/tmp/not-a-repo').getStatus()).toBeNull(); From 3c9e3b297cf5286c761159c1b4d642c478fd394d Mon Sep 17 00:00:00 2001 From: liruifengv Date: Wed, 12 Aug 2026 11:21:43 +0800 Subject: [PATCH 12/50] feat(kimi-code): paginate the session picker list (#2826) * feat(kimi-code): paginate the session picker list The /sessions picker and kimi -r used to materialize the full session list before showing anything, which gets slow with hundreds of sessions. - node-sdk: add listSessionsPage (limit/before -> items + nextCursor); the v2 engine pages through the session index (draining past entries whose workDir is unrecoverable), the v1 engine answers one full page - TUI: open the picker on the first page, fetch the next page when the cursor reaches the fetched end, and drain remaining pages in the background once a search query is typed so search still covers all sessions - kimi -r now fetches a one-item page for the latest session * chore: simplify session picker changeset * fix(kimi-code): join in-flight page fetch in session search drain A query typed while a scroll-triggered page fetch was still running stopped the background drain at the loadingMore early return, leaving the search covering only the pages fetched so far. fetchMoreSessions now optionally joins the in-flight fetch and continues with the next page; scroll triggers still drop when busy. --- .changeset/sdk-list-sessions-page.md | 5 + .changeset/session-picker-pagination.md | 5 + .../tui/components/dialogs/session-picker.ts | 72 +++++++- apps/kimi-code/src/tui/constant/kimi-tui.ts | 3 + apps/kimi-code/src/tui/kimi-tui.ts | 152 +++++++++++++---- apps/kimi-code/src/tui/tui-state.ts | 6 + .../src/tui/utils/searchable-list.ts | 11 +- .../components/dialogs/session-picker.test.ts | 160 ++++++++++++++++++ .../test/tui/kimi-tui-message-flow.test.ts | 19 ++- .../test/tui/kimi-tui-startup.test.ts | 140 ++++++++++++++- .../test/tui/utils/searchable-list.test.ts | 20 +++ packages/node-sdk/src/kimi-harness.ts | 10 ++ packages/node-sdk/src/rpc.ts | 12 ++ packages/node-sdk/src/sdk-rpc-client-v2.ts | 112 ++++++++---- packages/node-sdk/src/types.ts | 14 ++ packages/node-sdk/test/list-sessions.test.ts | 133 +++++++++++++++ 16 files changed, 802 insertions(+), 72 deletions(-) create mode 100644 .changeset/sdk-list-sessions-page.md create mode 100644 .changeset/session-picker-pagination.md diff --git a/.changeset/sdk-list-sessions-page.md b/.changeset/sdk-list-sessions-page.md new file mode 100644 index 00000000000..39227f49331 --- /dev/null +++ b/.changeset/sdk-list-sessions-page.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code-sdk": minor +--- + +Add `listSessionsPage` for keyset-paged session listing (`limit` / `before`, returns `nextCursor`). The v2 engine pages through the session index; the v1 engine keeps answering with a single full page. diff --git a/.changeset/session-picker-pagination.md b/.changeset/session-picker-pagination.md new file mode 100644 index 00000000000..83ec5e0d851 --- /dev/null +++ b/.changeset/session-picker-pagination.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Page the /sessions picker list so it opens fast with large session counts. diff --git a/apps/kimi-code/src/tui/components/dialogs/session-picker.ts b/apps/kimi-code/src/tui/components/dialogs/session-picker.ts index c8bd9017b5a..75c86687ffc 100644 --- a/apps/kimi-code/src/tui/components/dialogs/session-picker.ts +++ b/apps/kimi-code/src/tui/components/dialogs/session-picker.ts @@ -89,6 +89,8 @@ export class SessionPickerComponent extends Container implements Focusable { private visibleCount: number; private scope: 'cwd' | 'all'; private loading: boolean; + private hasMore: boolean; + private loadingMore: boolean; private list: SearchableList; focused = false; @@ -106,6 +108,14 @@ export class SessionPickerComponent extends Container implements Focusable { onCtrlD?: () => void; onToggleScope?: (selectedSessionId: string) => void; maxVisibleSessions?: number; + /** More pages exist on the backend (keyset paging). */ + hasMore?: boolean; + /** A follow-up page fetch is in flight. */ + loadingMore?: boolean; + /** Fired when the cursor reaches the end of every row fetched so far. */ + onLoadMore?: () => void; + /** Fired when a search query becomes active while pages remain unfetched. */ + onSearchDrain?: () => void; }) { super(); this.sessions = opts.sessions; @@ -117,6 +127,10 @@ export class SessionPickerComponent extends Container implements Focusable { this.onToggleScope = opts.onToggleScope; this.maxVisibleSessions = opts.maxVisibleSessions ?? 4; this.pageSize = Math.max(1, opts.pageSize ?? 50); + this.hasMore = opts.hasMore ?? false; + this.loadingMore = opts.loadingMore ?? false; + this.onLoadMore = opts.onLoadMore; + this.onSearchDrain = opts.onSearchDrain; const initialIndex = this.resolveInitialSelectedIndex(opts.initialSelectedSessionId); this.list = new SearchableList({ items: this.sessions, @@ -133,6 +147,26 @@ export class SessionPickerComponent extends Container implements Focusable { private readonly onCtrlC?: () => void; private readonly onCtrlD?: () => void; + private readonly onLoadMore?: () => void; + private readonly onSearchDrain?: () => void; + + /** Appends a freshly fetched page, keeping the cursor and active query. */ + appendSessions(rows: SessionRow[]): void { + this.sessions = [...this.sessions, ...rows]; + this.list.setItems(this.sessions); + // Rows arriving while a query is active must become visible without + // waiting for the next keypress; only grow, never shrink the window. + this.visibleCount = Math.max( + this.visibleCount, + Math.min(this.list.view().items.length, this.pageSize), + ); + } + + /** Updates the backend-paging facts after an in-flight fetch settles. */ + setPaging(hasMore: boolean, loadingMore: boolean): void { + this.hasMore = hasMore; + this.loadingMore = loadingMore; + } private resolveInitialSelectedIndex(initialSelectedSessionId: string | undefined): number { if (initialSelectedSessionId === undefined) return 0; @@ -152,6 +186,11 @@ export class SessionPickerComponent extends Container implements Focusable { const view = this.list.view(); if (view.query !== previousQuery) { this.visibleCount = Math.min(view.items.length, this.pageSize); + // A fresh query only searches the pages fetched so far; ask the host to + // drain the rest in the background so search covers every session. + if (view.query.length > 0 && previousQuery.length === 0 && this.hasMore) { + this.onSearchDrain?.(); + } return; } @@ -159,6 +198,15 @@ export class SessionPickerComponent extends Container implements Focusable { if (view.selectedIndex >= loadedCount - 1 && loadedCount < view.items.length) { this.visibleCount = Math.min(view.items.length, this.visibleCount + this.pageSize); } + // The cursor reached the end of everything fetched: pull the next page. + if ( + this.hasMore && + !this.loadingMore && + view.items.length > 0 && + view.selectedIndex >= view.items.length - 1 + ) { + this.onLoadMore?.(); + } } handleInput(data: string): void { @@ -287,15 +335,29 @@ export class SessionPickerComponent extends Container implements Focusable { } const filteredCount = view.items.length; - if (loadedSessions.length > visibleSessions.length || view.query.length > 0) { + if ( + loadedSessions.length > visibleSessions.length || + view.query.length > 0 || + this.hasMore || + this.loadingMore + ) { lines.push(''); + const moreSuffix = this.loadingMore + ? ' · loading more…' + : this.hasMore + ? view.query.length > 0 + ? ' · searching all…' + : ' · scroll for more' + : ''; const totalSuffix = view.query.length > 0 ? `${String(loadedSessions.length)} loaded / ${String(filteredCount)} matches` - : loadedSessions.length === this.sessions.length - ? `${String(loadedSessions.length)} sessions` - : `${String(loadedSessions.length)} loaded / ${String(this.sessions.length)} sessions`; - const footer = `Showing ${String(visibleStart + 1)}-${String(visibleStart + visibleSessions.length)} of ${totalSuffix}`; + : this.hasMore || this.loadingMore + ? `${String(loadedSessions.length)} loaded` + : loadedSessions.length === this.sessions.length + ? `${String(loadedSessions.length)} sessions` + : `${String(loadedSessions.length)} loaded / ${String(this.sessions.length)} sessions`; + const footer = `Showing ${String(visibleStart + 1)}-${String(visibleStart + visibleSessions.length)} of ${totalSuffix}${moreSuffix}`; lines.push(currentTheme.fg('textMuted', truncateToWidth(footer, width, ELLIPSIS))); } diff --git a/apps/kimi-code/src/tui/constant/kimi-tui.ts b/apps/kimi-code/src/tui/constant/kimi-tui.ts index 4539d1b9fe7..64232353962 100644 --- a/apps/kimi-code/src/tui/constant/kimi-tui.ts +++ b/apps/kimi-code/src/tui/constant/kimi-tui.ts @@ -16,6 +16,9 @@ export const EXIT_CONFIRM_WINDOW_MS = 1500; // presses far apart don't accidentally trigger undo. export const DOUBLE_ESC_WINDOW_MS = 600; +/** Session picker page size: one backend keyset page and one picker window. */ +export const SESSION_LIST_PAGE_SIZE = 50; + export function isManagedUsageProvider( providerKey: string | undefined, ): providerKey is typeof DEFAULT_OAUTH_PROVIDER_NAME { diff --git a/apps/kimi-code/src/tui/kimi-tui.ts b/apps/kimi-code/src/tui/kimi-tui.ts index c1254bce89c..2b6495e0401 100644 --- a/apps/kimi-code/src/tui/kimi-tui.ts +++ b/apps/kimi-code/src/tui/kimi-tui.ts @@ -105,6 +105,7 @@ import { MAIN_AGENT_ID, NO_ACTIVE_SESSION_MESSAGE, PRODUCT_NAME, + SESSION_LIST_PAGE_SIZE, SESSIONLESS_STARTUP_NOTICE, } from './constant/kimi-tui'; import { CHROME_GUTTER } from './constant/rendering'; @@ -885,8 +886,10 @@ export class KimiTUI { }); shouldReplayHistory = true; } else { - const sessions = await this.harness.listSessions({ workDir }); - const target = sessions[0]; + // Only the most recent session matters here — fetch a one-item page + // instead of materializing the whole listing. + const page = await this.harness.listSessionsPage({ workDir, limit: 1 }); + const target = page.items[0]; if (target !== undefined) { session = await this.harness.resumeSession({ id: target.id, @@ -1972,13 +1975,16 @@ export class KimiTUI { async fetchSessions(scope: 'cwd' | 'all' = this.state.sessionsScope): Promise { this.state.loadingSessions = true; this.state.sessionsScope = scope; + this.state.sessionsNextCursor = undefined; + this.state.sessionsLoadingMore = false; try { - const sessions = - scope === 'all' - ? await this.harness.listSessions({}) - : await this.harness.listSessions({ workDir: this.state.appState.workDir }); + const page = await this.harness.listSessionsPage({ + workDir: scope === 'all' ? undefined : this.state.appState.workDir, + limit: SESSION_LIST_PAGE_SIZE, + }); + this.state.sessionsNextCursor = page.nextCursor; this.state.sessions = sessionRowsForPicker( - sessions, + page.items, this.state.appState.sessionId, this.hasSessionContent(), ); @@ -1992,6 +1998,81 @@ export class KimiTUI { } } + /** + * Pulls the next keyset page into the session picker (scroll-bottom paging). + * A scope switch or picker close bumps `sessionPickerScopeRequestToken`, + * which makes an in-flight append discard its result. Returns whether a page + * was appended — callers draining pages stop on the first `false`. + * Scroll triggers pass no argument and are dropped while a fetch is running; + * the search drain passes `waitForInFlight` to join the running fetch and + * continue with the next page, so a query typed mid-fetch still ends up + * covering every session. + */ + private async fetchMoreSessions(waitForInFlight = false): Promise { + while (this.sessionsPageFetchInFlight !== undefined) { + if (!waitForInFlight) return false; + await this.sessionsPageFetchInFlight; + } + const cursor = this.state.sessionsNextCursor; + if (cursor === undefined) return false; + const requestToken = this.sessionPickerScopeRequestToken; + this.state.sessionsLoadingMore = true; + this.sessionPickerComponent?.setPaging(true, true); + this.state.ui.requestRender(); + const run = this.appendNextSessionPage(cursor, requestToken); + this.sessionsPageFetchInFlight = run; + try { + return await run; + } finally { + if (this.sessionsPageFetchInFlight === run) this.sessionsPageFetchInFlight = undefined; + } + } + + private async appendNextSessionPage(cursor: string, requestToken: number): Promise { + try { + const page = await this.harness.listSessionsPage({ + workDir: this.state.sessionsScope === 'all' ? undefined : this.state.appState.workDir, + limit: SESSION_LIST_PAGE_SIZE, + before: cursor, + }); + if (requestToken !== this.sessionPickerScopeRequestToken) return false; + this.state.sessionsNextCursor = page.nextCursor; + const rows = sessionRowsForPicker( + page.items, + this.state.appState.sessionId, + this.hasSessionContent(), + ); + this.state.sessions = [...this.state.sessions, ...rows]; + this.sessionPickerComponent?.appendSessions(rows); + this.sessionPickerComponent?.setPaging(page.nextCursor !== undefined, false); + return true; + } catch (error) { + log.warn('failed to fetch more sessions for picker', { error: String(error) }); + return false; + } finally { + if (requestToken === this.sessionPickerScopeRequestToken) { + this.state.sessionsLoadingMore = false; + this.sessionPickerComponent?.setPaging(this.state.sessionsNextCursor !== undefined, false); + this.state.ui.requestRender(); + } + } + } + + /** + * Search covers every session: while a query is active the picker asks for + * all remaining pages, drained one at a time in the background. A failed or + * superseded fetch stops the drain (the next fresh query re-triggers it). + */ + private async drainSessionsForSearch(): Promise { + const requestToken = this.sessionPickerScopeRequestToken; + while ( + this.state.sessionsNextCursor !== undefined && + requestToken === this.sessionPickerScopeRequestToken + ) { + if (!(await this.fetchMoreSessions(true))) return; + } + } + updateTerminalTitle(): void { const trimmed = this.state.appState.sessionTitle?.trim() ?? ''; const label = trimmed.length > 0 ? trimmed.slice(0, MAX_TERMINAL_TITLE_LENGTH) : PRODUCT_NAME; @@ -3233,6 +3314,8 @@ export class KimiTUI { forwardEditorExit: false, }; private sessionPickerScopeRequestToken = 0; + private sessionPickerComponent: SessionPickerComponent | undefined; + private sessionsPageFetchInFlight: Promise | undefined; async showSessionPicker(): Promise { await this.openSessionPicker({ @@ -3304,6 +3387,7 @@ export class KimiTUI { hideSessionPicker(): void { this.sessionPickerScopeRequestToken += 1; + this.sessionPickerComponent = undefined; this.editorKeyboard.clearPendingExit(); this.state.activeDialog = null; this.restoreEditor(); @@ -3324,29 +3408,37 @@ export class KimiTUI { readonly applyStartupModes?: boolean; }): void { this.state.activeDialog = 'session-picker'; - this.mountEditorReplacement( - new SessionPickerComponent({ - sessions: this.state.sessions, - loading: this.state.loadingSessions, - currentSessionId: this.state.appState.sessionId, - scope: this.state.sessionsScope, - initialSelectedSessionId: options.initialSelectedSessionId, - pageSize: 50, - onSelect: (session: SessionRow) => { - void this.handleSessionPickerSelect(session, options.applyStartupModes === true).catch( - (error) => { - this.showError(`Failed to apply startup flags: ${formatErrorMessage(error)}`); - }, - ); - }, - onCancel: options.onCancel, - onCtrlC: options.onCtrlC, - onCtrlD: options.onCtrlD, - onToggleScope: (selectedSessionId: string) => { - void this.toggleSessionPickerScope(selectedSessionId); - }, - }), - ); + const picker = new SessionPickerComponent({ + sessions: this.state.sessions, + loading: this.state.loadingSessions, + currentSessionId: this.state.appState.sessionId, + scope: this.state.sessionsScope, + initialSelectedSessionId: options.initialSelectedSessionId, + pageSize: SESSION_LIST_PAGE_SIZE, + hasMore: this.state.sessionsNextCursor !== undefined, + loadingMore: this.state.sessionsLoadingMore, + onLoadMore: () => { + void this.fetchMoreSessions(); + }, + onSearchDrain: () => { + void this.drainSessionsForSearch(); + }, + onSelect: (session: SessionRow) => { + void this.handleSessionPickerSelect(session, options.applyStartupModes === true).catch( + (error) => { + this.showError(`Failed to apply startup flags: ${formatErrorMessage(error)}`); + }, + ); + }, + onCancel: options.onCancel, + onCtrlC: options.onCtrlC, + onCtrlD: options.onCtrlD, + onToggleScope: (selectedSessionId: string) => { + void this.toggleSessionPickerScope(selectedSessionId); + }, + }); + this.sessionPickerComponent = picker; + this.mountEditorReplacement(picker); } private async handleSessionPickerSelect( diff --git a/apps/kimi-code/src/tui/tui-state.ts b/apps/kimi-code/src/tui/tui-state.ts index 349ecbdea8a..589d79c579f 100644 --- a/apps/kimi-code/src/tui/tui-state.ts +++ b/apps/kimi-code/src/tui/tui-state.ts @@ -47,6 +47,10 @@ export interface TUIState { toolOutputExpanded: boolean; sessions: SessionRow[]; loadingSessions: boolean; + /** Keyset cursor for the next older page; `undefined` when the listing is exhausted. */ + sessionsNextCursor: string | undefined; + /** A follow-up session page fetch is in flight. */ + sessionsLoadingMore: boolean; sessionsScope: 'cwd' | 'all'; activeDialog: 'session-picker' | 'help' | 'trust-prompt' | 'cache-hint' | null; tasksBrowser: TasksBrowserState | undefined; @@ -105,6 +109,8 @@ export function createTUIState(options: KimiTUIOptions): TUIState { toolOutputExpanded: false, sessions: [], loadingSessions: false, + sessionsNextCursor: undefined, + sessionsLoadingMore: false, sessionsScope: 'cwd', activeDialog: null, tasksBrowser: undefined, diff --git a/apps/kimi-code/src/tui/utils/searchable-list.ts b/apps/kimi-code/src/tui/utils/searchable-list.ts index 00a920e1ffd..20770338038 100644 --- a/apps/kimi-code/src/tui/utils/searchable-list.ts +++ b/apps/kimi-code/src/tui/utils/searchable-list.ts @@ -38,7 +38,7 @@ export interface SearchableListView { } export class SearchableList { - private readonly items: readonly T[]; + private items: readonly T[]; private readonly toSearchText: (item: T) => string; private readonly pageSize: number; private readonly searchable: boolean; @@ -53,6 +53,15 @@ export class SearchableList { this.cursor = Math.max(opts.initialIndex ?? 0, 0); } + /** + * Replaces the item set (e.g. after another page was appended), keeping the + * active query; the cursor is clamped into the new range. + */ + setItems(items: readonly T[]): void { + this.items = items; + this.cursor = Math.min(this.cursor, Math.max(0, items.length - 1)); + } + filtered(): readonly T[] { if (this.query.length === 0) return this.items; return fuzzyFilter([...this.items], this.query, this.toSearchText); diff --git a/apps/kimi-code/test/tui/components/dialogs/session-picker.test.ts b/apps/kimi-code/test/tui/components/dialogs/session-picker.test.ts index 3c885488b25..222adfa6a59 100644 --- a/apps/kimi-code/test/tui/components/dialogs/session-picker.test.ts +++ b/apps/kimi-code/test/tui/components/dialogs/session-picker.test.ts @@ -709,4 +709,164 @@ describe('SessionPickerComponent', () => { expect(onToggleScope).toHaveBeenCalledOnce(); expect(onToggleScope).toHaveBeenCalledWith('ses_beta'); }); + + it('fires onLoadMore when the cursor reaches the last fetched row', () => { + const onLoadMore = vi.fn(); + const component = new SessionPickerComponent({ + sessions: [ + { id: 'ses_a', title: 'Alpha', work_dir: '/tmp/project', updated_at: 1 }, + { id: 'ses_b', title: 'Beta', work_dir: '/tmp/project', updated_at: 2 }, + ], + loading: false, + currentSessionId: '', + hasMore: true, + onSelect: vi.fn(), + onCancel: vi.fn(), + onLoadMore, + }); + + component.handleInput('\u001B[B'); + + expect(onLoadMore).toHaveBeenCalledOnce(); + }); + + it('does not fire onLoadMore while a page fetch is in flight', () => { + const onLoadMore = vi.fn(); + const component = new SessionPickerComponent({ + sessions: [ + { id: 'ses_a', title: 'Alpha', work_dir: '/tmp/project', updated_at: 1 }, + { id: 'ses_b', title: 'Beta', work_dir: '/tmp/project', updated_at: 2 }, + ], + loading: false, + currentSessionId: '', + hasMore: true, + loadingMore: true, + onSelect: vi.fn(), + onCancel: vi.fn(), + onLoadMore, + }); + + component.handleInput('\u001B[B'); + + expect(onLoadMore).not.toHaveBeenCalled(); + }); + + it('appendSessions extends the list and keeps the active query', () => { + const component = new SessionPickerComponent({ + sessions: [{ id: 'ses_alpha', title: 'Alpha session', work_dir: '/tmp/p', updated_at: 1 }], + loading: false, + currentSessionId: '', + onSelect: vi.fn(), + onCancel: vi.fn(), + }); + + component.handleInput('g'); + expect(renderPlain(component)).toContain('No matches'); + + component.appendSessions([ + { id: 'ses_gamma', title: 'Gamma session', work_dir: '/tmp/p', updated_at: 2 }, + ]); + + const output = renderPlain(component); + expect(output).toContain('Search: g'); + expect(output).toContain('Gamma session'); + expect(output).not.toContain('Alpha session'); + }); + + it('appendSessions keeps the selected row', () => { + const onSelect = vi.fn(); + const beta = { id: 'ses_beta', title: 'Beta session', work_dir: '/tmp/p', updated_at: 2 }; + const component = new SessionPickerComponent({ + sessions: [ + { id: 'ses_alpha', title: 'Alpha session', work_dir: '/tmp/p', updated_at: 1 }, + beta, + ], + loading: false, + currentSessionId: '', + onSelect, + onCancel: vi.fn(), + }); + + component.handleInput('\u001B[B'); + component.appendSessions([ + { id: 'ses_gamma', title: 'Gamma session', work_dir: '/tmp/p', updated_at: 3 }, + ]); + component.handleInput('\r'); + + expect(onSelect).toHaveBeenCalledOnce(); + expect(onSelect).toHaveBeenCalledWith(beta); + }); + + it('fires onSearchDrain only when the query becomes active with unfetched pages', () => { + const onSearchDrain = vi.fn(); + const component = new SessionPickerComponent({ + sessions: [{ id: 'ses_alpha', title: 'Alpha session', work_dir: '/tmp/p', updated_at: 1 }], + loading: false, + currentSessionId: '', + hasMore: true, + onSelect: vi.fn(), + onCancel: vi.fn(), + onSearchDrain, + }); + + component.handleInput('a'); + component.handleInput('l'); + + expect(onSearchDrain).toHaveBeenCalledOnce(); + }); + + it('does not fire onSearchDrain when every page is already fetched', () => { + const onSearchDrain = vi.fn(); + const component = new SessionPickerComponent({ + sessions: [{ id: 'ses_alpha', title: 'Alpha session', work_dir: '/tmp/p', updated_at: 1 }], + loading: false, + currentSessionId: '', + onSelect: vi.fn(), + onCancel: vi.fn(), + onSearchDrain, + }); + + component.handleInput('a'); + + expect(onSearchDrain).not.toHaveBeenCalled(); + }); + + it('announces unfetched pages and in-flight fetches in the footer', () => { + const component = new SessionPickerComponent({ + sessions: [ + { id: 'ses_a', title: 'Alpha', work_dir: '/tmp/project', updated_at: 1 }, + { id: 'ses_b', title: 'Beta', work_dir: '/tmp/project', updated_at: 2 }, + ], + loading: false, + currentSessionId: '', + hasMore: true, + onSelect: vi.fn(), + onCancel: vi.fn(), + }); + + expect(renderPlain(component)).toContain('· scroll for more'); + + component.setPaging(true, true); + expect(renderPlain(component)).toContain('· loading more…'); + + component.setPaging(false, false); + const settled = renderPlain(component); + expect(settled).not.toContain('· scroll for more'); + expect(settled).not.toContain('· loading more…'); + }); + + it('notes the background drain in the footer while searching with unfetched pages', () => { + const component = new SessionPickerComponent({ + sessions: [{ id: 'ses_alpha', title: 'Alpha session', work_dir: '/tmp/p', updated_at: 1 }], + loading: false, + currentSessionId: '', + hasMore: true, + onSelect: vi.fn(), + onCancel: vi.fn(), + }); + + component.handleInput('a'); + + expect(renderPlain(component)).toContain('· searching all…'); + }); }); diff --git a/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts b/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts index acd25f34adf..619ecf2c2f4 100644 --- a/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts +++ b/apps/kimi-code/test/tui/kimi-tui-message-flow.test.ts @@ -268,7 +268,7 @@ function makeSession(overrides: Record = {}) { function makeHarness(session = makeSession(), overrides: Record = {}) { const interactiveAgentScope = new AsyncLocalStorage(); - return { + const harness = { getConfig: vi.fn(async () => ({ models: { k2: { model: 'moonshot-v1', maxContextSize: 100 }, @@ -315,6 +315,23 @@ function makeHarness(session = makeSession(), overrides: Record }, ...overrides, }; + // The TUI lists sessions through keyset pages; derive the page mock from + // the (possibly overridden) full-list mock unless a test overrides paging. + if (!('listSessionsPage' in harness)) { + const listSessions = harness.listSessions as (input?: { + workDir?: string; + sessionId?: string; + }) => Promise; + Object.assign(harness, { + listSessionsPage: vi.fn( + async (input: { workDir?: string; sessionId?: string } = {}) => ({ + items: await listSessions({ workDir: input.workDir, sessionId: input.sessionId }), + nextCursor: undefined, + }), + ), + }); + } + return harness; } async function makeDriver( diff --git a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts index 2e76c044029..a621fdaba6e 100644 --- a/apps/kimi-code/test/tui/kimi-tui-startup.test.ts +++ b/apps/kimi-code/test/tui/kimi-tui-startup.test.ts @@ -193,7 +193,7 @@ function loginRequiredError(): Error & { readonly code: string } { } function makeHarness(session = makeSession(), overrides: Record = {}) { - return { + const harness = { getConfig: vi.fn(async () => ({ models: { k2: { model: 'moonshot-v1', maxContextSize: 100 }, @@ -215,6 +215,23 @@ function makeHarness(session = makeSession(), overrides: Record }, ...overrides, }; + // The TUI lists sessions through keyset pages; derive the page mock from + // the (possibly overridden) full-list mock unless a test overrides paging. + if (!('listSessionsPage' in harness)) { + const listSessions = harness.listSessions as (input?: { + workDir?: string; + sessionId?: string; + }) => Promise; + Object.assign(harness, { + listSessionsPage: vi.fn( + async (input: { workDir?: string; sessionId?: string } = {}) => ({ + items: await listSessions({ workDir: input.workDir, sessionId: input.sessionId }), + nextCursor: undefined, + }), + ), + }); + } + return harness; } function makeDriver(harness: ReturnType, input: KimiTUIStartupInput) { @@ -1057,6 +1074,127 @@ describe('KimiTUI startup', () => { expect(mountSessionPicker).toHaveBeenCalledTimes(1); }); + function makePagedListSessionsPage() { + const firstPage = Array.from({ length: 50 }, (_, index) => ({ + id: `ses-page1-${String(index).padStart(2, '0')}`, + workDir: '/tmp/proj-a', + updatedAt: Date.now() - index * 1000, + })); + return vi.fn(async (input: { workDir?: string; before?: string } = {}) => + input.before === undefined + ? { items: firstPage, nextCursor: 'ses-page1-49' } + : { + items: [{ id: 'ses-page2-0', workDir: '/tmp/proj-a', updatedAt: 0 }], + nextCursor: undefined, + }, + ); + } + + it('fetches the next session page when the picker scrolls to the fetched end', async () => { + const listSessionsPage = makePagedListSessionsPage(); + const harness = makeHarness(makeSession({ id: 'ses-current' }), { listSessionsPage }); + const driver = makeDriver(harness, makeStartupInput()); + await expect(driver.init()).resolves.toBe(false); + + await (driver as unknown as { showSessionPicker(): Promise }).showSessionPicker(); + expect(listSessionsPage).toHaveBeenCalledWith({ workDir: '/tmp/proj-a', limit: 50 }); + expect(driver.state.sessions).toHaveLength(50); + + const picker = driver.state.editorContainer.children[0] as { handleInput(data: string): void }; + for (let i = 0; i < 49; i++) { + picker.handleInput('\u001B[B'); + } + await vi.waitFor(() => { + expect(driver.state.sessions).toHaveLength(51); + }); + + expect(listSessionsPage).toHaveBeenLastCalledWith({ + workDir: '/tmp/proj-a', + limit: 50, + before: 'ses-page1-49', + }); + expect(driver.state.sessions.map((session) => session.id)).toContain('ses-page2-0'); + }); + + it('drains the remaining session pages in the background once a query is typed', async () => { + const listSessionsPage = makePagedListSessionsPage(); + const harness = makeHarness(makeSession({ id: 'ses-current' }), { listSessionsPage }); + const driver = makeDriver(harness, makeStartupInput()); + await expect(driver.init()).resolves.toBe(false); + + await (driver as unknown as { showSessionPicker(): Promise }).showSessionPicker(); + expect(driver.state.sessions).toHaveLength(50); + + const picker = driver.state.editorContainer.children[0] as { handleInput(data: string): void }; + picker.handleInput('x'); + await vi.waitFor(() => { + expect(driver.state.sessions).toHaveLength(51); + }); + + expect(listSessionsPage).toHaveBeenLastCalledWith({ + workDir: '/tmp/proj-a', + limit: 50, + before: 'ses-page1-49', + }); + }); + + it('continues the search drain after an in-flight scroll fetch settles', async () => { + const firstPage = Array.from({ length: 50 }, (_, index) => ({ + id: `ses-page1-${String(index).padStart(2, '0')}`, + workDir: '/tmp/proj-a', + updatedAt: Date.now() - index * 1000, + })); + let resolveScrollPage!: (page: { items: unknown[]; nextCursor?: string }) => void; + const listSessionsPage = vi.fn((input: { workDir?: string; before?: string } = {}) => { + if (input.before === undefined) { + return Promise.resolve({ items: firstPage, nextCursor: 'ses-page1-49' }); + } + if (input.before === 'ses-page1-49') { + // The scroll-triggered page fetch stays pending until the test resolves it. + return new Promise<{ items: unknown[]; nextCursor?: string }>((resolve) => { + resolveScrollPage = resolve; + }); + } + return Promise.resolve({ + items: [{ id: 'ses-page3-0', workDir: '/tmp/proj-a', updatedAt: 0 }], + nextCursor: undefined, + }); + }); + const harness = makeHarness(makeSession({ id: 'ses-current' }), { listSessionsPage }); + const driver = makeDriver(harness, makeStartupInput()); + await expect(driver.init()).resolves.toBe(false); + + await (driver as unknown as { showSessionPicker(): Promise }).showSessionPicker(); + const picker = driver.state.editorContainer.children[0] as { handleInput(data: string): void }; + // Reach the fetched end: the scroll-triggered fetch for page 2 starts. + for (let i = 0; i < 49; i++) { + picker.handleInput('\u001B[B'); + } + await vi.waitFor(() => { + expect(listSessionsPage).toHaveBeenCalledWith({ + workDir: '/tmp/proj-a', + limit: 50, + before: 'ses-page1-49', + }); + }); + + // Typing a query while that fetch is in flight must join it, not stop the + // drain: the remaining pages arrive after the in-flight one settles. + picker.handleInput('x'); + resolveScrollPage({ + items: [{ id: 'ses-page2-0', workDir: '/tmp/proj-a', updatedAt: 1 }], + nextCursor: 'ses-page2-0', + }); + await vi.waitFor(() => { + expect(driver.state.sessions).toHaveLength(52); + }); + expect(listSessionsPage).toHaveBeenLastCalledWith({ + workDir: '/tmp/proj-a', + limit: 50, + before: 'ses-page2-0', + }); + }); + it('clears the sessions picker search query when toggling scope with Ctrl+A', async () => { const currentWorkDirSession = { id: 'ses-cwd', diff --git a/apps/kimi-code/test/tui/utils/searchable-list.test.ts b/apps/kimi-code/test/tui/utils/searchable-list.test.ts index 170b8993a46..698d1a60496 100644 --- a/apps/kimi-code/test/tui/utils/searchable-list.test.ts +++ b/apps/kimi-code/test/tui/utils/searchable-list.test.ts @@ -97,4 +97,24 @@ describe('SearchableList', () => { expect(search.handleKey(BACKSPACE)).toBe(true); expect(search.view().query).toBe(''); }); + + it('setItems replaces the items, keeps the query, and clamps the cursor', () => { + const list = make({ searchable: true }); + for (const ch of 'zz') list.handleKey(ch); + list.setItems([...ITEMS, 'item10']); + // The active query survives an items swap and still filters. + expect(list.view().query).toBe('zz'); + expect(list.view().items).toHaveLength(0); + + expect(list.clearQuery()).toBe(true); + for (let i = 0; i < 20; i++) list.moveDown(); + expect(list.view().selectedIndex).toBe(10); + + // Shrinking the set clamps the cursor into the new range. + list.setItems(['item00']); + const v = list.view(); + expect(v.items).toEqual(['item00']); + expect(v.selectedIndex).toBe(0); + expect(list.selected()).toBe('item00'); + }); }); diff --git a/packages/node-sdk/src/kimi-harness.ts b/packages/node-sdk/src/kimi-harness.ts index ae534384931..4ab32498a77 100644 --- a/packages/node-sdk/src/kimi-harness.ts +++ b/packages/node-sdk/src/kimi-harness.ts @@ -35,6 +35,7 @@ import type { ResumeSessionInput, ReloadSessionInput, SessionSummary, + SessionSummaryPage, SkillSummary, TelemetryClient, TelemetryContextPatch, @@ -258,6 +259,15 @@ export class KimiHarness { return this.rpc.listSessions(options); } + /** + * One keyset page of the session listing (`limit` / `before` in + * `ListSessionsOptions`). Paged on the v2 engine; the v1 engine serves the + * whole filtered set as a single terminal page. + */ + async listSessionsPage(options: ListSessionsOptions = {}): Promise { + return this.rpc.listSessionsPage(options); + } + /** Skills visible to a new session in `workDir`, without creating that session. */ async listWorkspaceSkills(workDir: string): Promise { return this.rpc.listWorkspaceSkills(workDir); diff --git a/packages/node-sdk/src/rpc.ts b/packages/node-sdk/src/rpc.ts index 270c9d1d729..b78f77c6b8d 100644 --- a/packages/node-sdk/src/rpc.ts +++ b/packages/node-sdk/src/rpc.ts @@ -59,6 +59,7 @@ import type { ResumeSessionInput, ResumedSessionSummary, SessionSummary, + SessionSummaryPage, SkillSummary, PluginCommandDef, Unsubscribe, @@ -224,6 +225,17 @@ export abstract class SDKRpcClientBase { return rpc.listSessions(input); } + /** + * One keyset page of the session listing (`limit` / `before` in + * `ListSessionsOptions`). The base implementation serves the whole filtered + * set as a single terminal page — the v1 engine has no paged listing; + * `SDKRpcClientV2` overrides this with real index paging. + */ + async listSessionsPage(input: ListSessionsOptions = {}): Promise { + const items = await this.listSessions(input); + return { items, nextCursor: undefined }; + } + async listWorkspaceSkills(workDir: string): Promise { const rpc = await this.getRpc(); return rpc.listWorkspaceSkills({ workDir }); diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index 2969b42b93e..75d99ad8c13 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -233,6 +233,7 @@ import { type Scope, type SecondaryModelConfig, type ServicesAccessor, + type SessionSummary as V2SessionSummary, } from '@moonshot-ai/agent-core-v2'; import type { AgentHandle, Klient } from '@moonshot-ai/klient'; import { createKlient } from '@moonshot-ai/klient/memory'; @@ -299,6 +300,7 @@ import type { SessionPlan, SessionStatus, SessionSummary, + SessionSummaryPage, SessionUsage, SkillSummary, TelemetryClient, @@ -997,50 +999,92 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } override async listSessions(input: ListSessionsOptions = {}): Promise { + // Full-set semantics: drain keyset pages until the listing is exhausted + // (an unpaged query currently answers in one page, but a backend may cap + // it — never silently truncate the unpaged contract). + const all: SessionSummary[] = []; + let before: string | undefined; + for (;;) { + const page = await this.listSessionsPage({ + workDir: input.workDir, + sessionId: input.sessionId, + before, + }); + all.push(...page.items); + if (page.nextCursor === undefined) return all; + before = page.nextCursor; + } + } + + override async listSessionsPage(input: ListSessionsOptions = {}): Promise { // v1 rejects an empty workDir and bucket-filters by the normalized path; // the v2 index filters by workspace-id set instead. const workspaceIds = input.workDir === undefined ? undefined : await this.workspaceIdsFor(normalizeRequiredWorkDir('listSessions', input.workDir)); - const page = await this.klient.global.sessions.list({ - workspaceIds, - sessionId: input.sessionId, - }); - const bootstrapService = this.engineAccessor.get(IBootstrapService); const workspacesById = new Map( (await this.klient.global.workspaces.list()).map((workspace) => [workspace.id, workspace]), ); - const summaries: SessionSummary[] = []; - for (const item of page.items) { - const workDir = item.cwd ?? workspacesById.get(item.workspaceId)?.root; - // A session whose workDir is unrecoverable (corrupt metadata, deleted - // workspace) cannot be resumed on either engine; v1's store never lists - // one in the first place, so drop it here too. - if (workDir === undefined) continue; - // A live session reports its own outcome; the index may still carry a - // stale one while the mirror's clear is queued (a fresh turn just - // started after a failure). - const liveHandle = getLiveSessionById(this.engineAccessor, item.id); - const effectiveItem = - liveHandle === undefined - ? item - : { - ...item, - lastTurnReason: liveHandle.accessor.get(ISessionActivityView).state().lastTurnReason, - }; - summaries.push( - v2SummaryToSessionSummary(effectiveItem, { - workDir, - sessionDir: sessionDirOf( - bootstrapService.homeDir, - workspacePersistenceScope(bootstrapService.scope('sessions'), item.workspaceId), - item.id, - ), - }), - ); + const collected: SessionSummary[] = []; + let before = input.before; + // Entries dropped by the mapping (unrecoverable workDir) shrink the page; + // keep pulling keyset pages until the requested size is filled so callers + // never see a short or empty page that still carries a cursor. + for (;;) { + const remaining = input.limit === undefined ? undefined : input.limit - collected.length; + if (remaining !== undefined && remaining <= 0) break; + const page = await this.klient.global.sessions.list({ + workspaceIds, + sessionId: input.sessionId, + limit: remaining, + before, + }); + if (page.items.length === 0) return { items: collected, nextCursor: undefined }; + for (const item of page.items) { + const summary = this.mapIndexSummary(item, workspacesById); + if (summary !== undefined) collected.push(summary); + } + if (page.nextCursor === undefined) return { items: collected, nextCursor: undefined }; + before = page.nextCursor; + if (input.limit === undefined) return { items: collected, nextCursor: before }; } - return summaries; + return { items: collected, nextCursor: before }; + } + + /** + * Map one v2 index summary to the v1 wire shape, resolving the filesystem + * facts the index does not carry. Returns `undefined` when the session's + * workDir is unrecoverable (corrupt metadata, deleted workspace): such a + * session cannot be resumed on either engine, and v1's store never lists + * one in the first place. + */ + private mapIndexSummary( + item: V2SessionSummary, + workspacesById: ReadonlyMap, + ): SessionSummary | undefined { + const workDir = item.cwd ?? workspacesById.get(item.workspaceId)?.root; + if (workDir === undefined) return undefined; + // A live session reports its own outcome; the index may still carry a + // stale one while the mirror's clear is queued (a fresh turn just + // started after a failure). + const liveHandle = getLiveSessionById(this.engineAccessor, item.id); + const effectiveItem = + liveHandle === undefined + ? item + : { + ...item, + lastTurnReason: liveHandle.accessor.get(ISessionActivityView).state().lastTurnReason, + }; + const bootstrapService = this.engineAccessor.get(IBootstrapService); + return v2SummaryToSessionSummary(effectiveItem, { + workDir, + sessionDir: sessionDirOf( + bootstrapService.homeDir, + workspacePersistenceScope(bootstrapService.scope('sessions'), item.workspaceId), + item.id, + ), + }); } /** diff --git a/packages/node-sdk/src/types.ts b/packages/node-sdk/src/types.ts index 8ce05461d45..8e89c4246fb 100644 --- a/packages/node-sdk/src/types.ts +++ b/packages/node-sdk/src/types.ts @@ -218,6 +218,20 @@ export interface ExportSessionResult { export interface ListSessionsOptions { readonly workDir?: string; readonly sessionId?: string; + /** + * Maximum number of summaries in one page. Only consulted by + * `listSessionsPage`; plain `listSessions` always returns the whole + * filtered set. + */ + readonly limit?: number; + /** Keyset cursor: return the page strictly older than this session id. */ + readonly before?: string; +} + +export interface SessionSummaryPage { + readonly items: readonly SessionSummary[]; + /** Pass as `before` for the next older page; absent when the listing is exhausted. */ + readonly nextCursor?: string; } export interface GetConfigOptions { diff --git a/packages/node-sdk/test/list-sessions.test.ts b/packages/node-sdk/test/list-sessions.test.ts index 8ee0e60bd87..08afb9802b8 100644 --- a/packages/node-sdk/test/list-sessions.test.ts +++ b/packages/node-sdk/test/list-sessions.test.ts @@ -15,6 +15,7 @@ import { drainQueryStoreDisposals, drainSessionIndexMirror, ISessionIndex, + ISessionIndexMirror, } from '@moonshot-ai/agent-core-v2'; import { createKimiHarness, SDKRpcClientV2 } from '#/index'; @@ -435,6 +436,138 @@ describe('KimiHarness.listSessions', () => { await harness.close(); } }); + + it('serves the full set as one terminal page on the v1 engine', async () => { + const homeDir = await makeTempDir(); + const workDir = await makeTempDir(); + const harness = createKimiHarness({ + identity: TEST_IDENTITY, + homeDir, + }); + + try { + await harness.createSession({ id: 'ses_v1_page_a', workDir }); + await harness.createSession({ id: 'ses_v1_page_b', workDir }); + + // The v1 engine has no paged listing: `limit` is ignored and the whole + // filtered set comes back as a single page without a cursor. + const page = await harness.listSessionsPage({ workDir, limit: 1 }); + expect(page.items.map((item) => item.id).toSorted()).toEqual([ + 'ses_v1_page_a', + 'ses_v1_page_b', + ]); + expect(page.nextCursor).toBeUndefined(); + } finally { + await harness.close(); + } + }); +}); + +describe('SDKRpcClientV2.listSessionsPage', () => { + it('pages through the listing with keyset cursors (read model off)', async () => { + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_FLAG', '0'); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL', '0'); + const homeDir = await makeTempDir(); + const workDir = await makeTempDir(); + const client = new SDKRpcClientV2({ homeDir, identity: TEST_IDENTITY }); + + try { + for (let i = 0; i < 5; i += 1) { + const created = await client.createSession({ id: `ses_page_${i}`, workDir }); + await client.closeSession({ sessionId: created.id }); + } + + const page1 = await client.listSessionsPage({ workDir, limit: 2 }); + expect(page1.items).toHaveLength(2); + expect(page1.nextCursor).toBe(page1.items.at(-1)?.id); + + const page2 = await client.listSessionsPage({ workDir, limit: 2, before: page1.nextCursor }); + expect(page2.items).toHaveLength(2); + expect(page2.nextCursor).toBe(page2.items.at(-1)?.id); + + const page3 = await client.listSessionsPage({ workDir, limit: 2, before: page2.nextCursor }); + expect(page3.items).toHaveLength(1); + expect(page3.nextCursor).toBeUndefined(); + + const pagedIds = [...page1.items, ...page2.items, ...page3.items].map((item) => item.id); + expect(new Set(pagedIds)).toEqual( + new Set([0, 1, 2, 3, 4].map((i) => `ses_page_${String(i)}`)), + ); + // Draining pages yields exactly the unpaged listing, in the same order. + const full = await client.listSessions({ workDir }); + expect(pagedIds).toEqual(full.map((item) => item.id)); + } finally { + await client.close(); + vi.unstubAllEnvs(); + } + }); + + it('answers an empty terminal page for an unknown cursor', async () => { + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_FLAG', '0'); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL', '0'); + const homeDir = await makeTempDir(); + const workDir = await makeTempDir(); + const client = new SDKRpcClientV2({ homeDir, identity: TEST_IDENTITY }); + + try { + const created = await client.createSession({ id: 'ses_cursor_probe', workDir }); + await client.closeSession({ sessionId: created.id }); + + await expect( + client.listSessionsPage({ workDir, before: 'ses_unknown' }), + ).resolves.toEqual({ items: [], nextCursor: undefined }); + } finally { + await client.close(); + vi.unstubAllEnvs(); + } + }); + + it('drains follow-up pages when the mapping drops entries (read model on)', async () => { + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_FLAG', '0'); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_PERSISTENCE_MINIDB_READMODEL', '1'); + const homeDir = await makeTempDir(); + const workDir = await makeTempDir(); + const client = new SDKRpcClientV2({ homeDir, identity: TEST_IDENTITY }); + + try { + for (let i = 0; i < 3; i += 1) { + const created = await client.createSession({ id: `ses_drain_${i}`, workDir }); + await client.closeSession({ sessionId: created.id }); + } + const index = client.engineAccessor.get(ISessionIndex); + await index.prepare(); + // A summary whose workDir can no longer be resolved (unknown workspace, + // no cwd) is dropped by the mapping; the page must still fill. + client.engineAccessor.get(ISessionIndexMirror).record({ + id: 'ses_ghost', + workspaceId: 'ws_missing', + createdAt: 1, + updatedAt: Date.now() + 60_000, + archived: false, + }); + await drainSessionIndexMirror(); + + const page1 = await client.listSessionsPage({ limit: 2 }); + expect(page1.items).toHaveLength(2); + expect(page1.items.some((item) => item.id === 'ses_ghost')).toBe(false); + expect(page1.nextCursor).toBeDefined(); + + const page2 = await client.listSessionsPage({ limit: 2, before: page1.nextCursor }); + expect(page2.items).toHaveLength(1); + expect(page2.items[0]?.id).not.toBe('ses_ghost'); + expect(page2.nextCursor).toBeUndefined(); + + const ids = [...page1.items, ...page2.items].map((item) => item.id).toSorted(); + expect(ids).toEqual(['ses_drain_0', 'ses_drain_1', 'ses_drain_2']); + } finally { + await client.close(); + // Dispose fired the mirror/query-store async closes; await them before + // the shared afterEach removes the temp home. + await drainSessionIndexMirror(); + await drainQueryStoreDisposals(); + vi.unstubAllEnvs(); + } + }); }); describe('SDKRpcClientV2 search-index separation', () => { From df8ce73e45e3c473cb58e69311c1213e327f0c01 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Wed, 12 Aug 2026 11:35:44 +0800 Subject: [PATCH 13/50] feat(kimi-code): show step retry progress in the activity indicator (#2825) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(kimi-code): show step retry progress in the activity indicator Wire the engine's turn.step.retrying event into the TUI: while a failed model request is backing off for another attempt, the waiting spinner shows 'retrying (N/M) · errorName · in Xs' with a dim detail line for the status code and provider error message, and the loading tip is suppressed. The retry state clears on the step's terminal events (completed / interrupted), turn.ended, and tool.result. It intentionally survives turn.step.started because the v2 engine re-emits that event for every retried attempt of the same step. * fix(kimi-code): show the retry indicator for mid-stream failures A retryable failure raised after thinking/assistant deltas had already streamed left the pane in thinking/composing mode, so the retry label and detail never rendered during the backoff. Drive the pane and the streaming phase back to waiting when a retry begins. * fix(kimi-code): drop the stale retry countdown once the attempt starts The v2 engine re-emits turn.step.started when the retried attempt begins running after the backoff sleep. Track a backoff/attempt phase so the label keeps showing the retry attempt and error but drops the already-elapsed 'in Xs' countdown, instead of either clearing the state or showing stale timing through a slow attempt. * fix(kimi-code): advance the retry phase on a timer instead of step starts The legacy engine retries inside the same step and never re-emits turn.step.started, so the backoff-to-attempt transition keyed on that event never fired there and the stale countdown stayed up through the attempt. Schedule the flip from delayMs instead, which matches when both engines actually start the next attempt, and drop the step-start hook. * fix(kimi-code): cancel the retry phase timer on TUI shutdown A pending backoff timer survived KimiTUI.stop(), keeping the event loop alive and firing setAppState against a disposed UI when stop() runs without an immediate process exit. Expose the timer cleanup and invoke it from the shutdown path. * fix(kimi-code): align the retry detail line with the spinner label * fix(kimi-code): capitalize the retry spinner label --- .changeset/tui-retry-progress.md | 5 + .../src/tui/components/panes/activity-pane.ts | 17 +- apps/kimi-code/src/tui/constant/rendering.ts | 9 + .../tui/controllers/session-event-handler.ts | 51 ++++- apps/kimi-code/src/tui/kimi-tui.ts | 22 ++- apps/kimi-code/src/tui/types.ts | 20 ++ apps/kimi-code/src/tui/utils/step-retry.ts | 19 ++ .../chrome/footer-status-line.test.ts | 1 + .../test/tui/components/chrome/footer.test.ts | 1 + .../tui/components/chrome/welcome.test.ts | 1 + .../components/panes/activity-pane.test.ts | 20 +- .../session-event-handler-step-retry.test.ts | 180 ++++++++++++++++++ .../test/tui/create-tui-state.test.ts | 1 + .../test/tui/utils/step-retry.test.ts | 64 +++++++ 14 files changed, 401 insertions(+), 10 deletions(-) create mode 100644 .changeset/tui-retry-progress.md create mode 100644 apps/kimi-code/src/tui/utils/step-retry.ts create mode 100644 apps/kimi-code/test/tui/controllers/session-event-handler-step-retry.test.ts create mode 100644 apps/kimi-code/test/tui/utils/step-retry.test.ts diff --git a/.changeset/tui-retry-progress.md b/.changeset/tui-retry-progress.md new file mode 100644 index 00000000000..76143cb0bbe --- /dev/null +++ b/.changeset/tui-retry-progress.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Show retry progress in the loading indicator when a model request fails and is retried, with the attempt count and a detail line for the provider error. diff --git a/apps/kimi-code/src/tui/components/panes/activity-pane.ts b/apps/kimi-code/src/tui/components/panes/activity-pane.ts index 22e6f3bc5c8..43f9ece4126 100644 --- a/apps/kimi-code/src/tui/components/panes/activity-pane.ts +++ b/apps/kimi-code/src/tui/components/panes/activity-pane.ts @@ -1,6 +1,8 @@ -import { Container, Spacer } from '@moonshot-ai/pi-tui'; +import { Container, Spacer, Text } from '@moonshot-ai/pi-tui'; import type { MoonLoader } from '#/tui/components/chrome/moon-loader'; +import { ACTIVITY_DETAIL_INDENT } from '#/tui/constant/rendering'; +import { currentTheme } from '#/tui/theme'; export type ActivityPaneMode = 'hidden' | 'waiting' | 'thinking' | 'composing' | 'tool'; @@ -8,6 +10,12 @@ export interface ActivityPaneOptions { readonly mode: ActivityPaneMode; readonly spinner?: MoonLoader; readonly tip?: string; + /** Extra dim line rendered under the spinner (e.g. step retry error detail). */ + readonly detail?: string; +} + +export function formatActivitySpinnerTip(tip: string | undefined): string { + return tip === undefined || tip.length === 0 ? '' : ` · Tip: ${tip}`; } export class ActivityPaneComponent extends Container { @@ -22,10 +30,11 @@ export class ActivityPaneComponent extends Container { options.spinner !== undefined ) { this.addChild(new Spacer(1)); - if (options.tip) { - options.spinner.setTip(` · Tip: ${options.tip}`); - } + options.spinner.setTip(formatActivitySpinnerTip(options.tip)); this.addChild(options.spinner); + if (options.detail !== undefined && options.detail.length > 0) { + this.addChild(new Text(currentTheme.fg('textDim', options.detail), ACTIVITY_DETAIL_INDENT, 0)); + } } } diff --git a/apps/kimi-code/src/tui/constant/rendering.ts b/apps/kimi-code/src/tui/constant/rendering.ts index a6a1c6b7d4b..d3de252f3dd 100644 --- a/apps/kimi-code/src/tui/constant/rendering.ts +++ b/apps/kimi-code/src/tui/constant/rendering.ts @@ -12,6 +12,15 @@ export const RESULT_PREVIEW_LINES = 3; export const THINKING_PREVIEW_LINES = 2; export const COMMAND_PREVIEW_LINES = 10; +// Cap on the step-retry detail line under the waiting spinner, so huge +// provider error bodies (occasionally whole HTML error pages) can't flood +// the activity pane. +export const RETRY_DETAIL_MAX_CHARS = 160; +// Left indent (cells) for the detail line under the waiting spinner, aligning +// it with the label text: 1 (the spinner Text's own paddingX) + 2 (moon +// frame) + 1 (space between frame and label). +export const ACTIVITY_DETAIL_INDENT = 4; + // Retention caps for the subagent activity store (background-agent detail // view): only the most recent steps are kept, older steps are discarded // whole, and per-step text / per-call output keep bounded tails. diff --git a/apps/kimi-code/src/tui/controllers/session-event-handler.ts b/apps/kimi-code/src/tui/controllers/session-event-handler.ts index 3735465089a..9cb1029bdc5 100644 --- a/apps/kimi-code/src/tui/controllers/session-event-handler.ts +++ b/apps/kimi-code/src/tui/controllers/session-event-handler.ts @@ -27,6 +27,7 @@ import type { TurnStartedEvent, TurnStepCompletedEvent, TurnStepInterruptedEvent, + TurnStepRetryingEvent, TurnStepStartedEvent, TokenUsage, WarningEvent, @@ -166,6 +167,7 @@ export class SessionEventHandler { private queuedGoalPromotionPending = false; private queuedGoalPromotionInFlight = false; private queuedGoalPromotionTimer: ReturnType | undefined; + private stepRetryAttemptTimer: ReturnType | undefined; resetRuntimeState(): void { this.backgroundTasks.clear(); @@ -184,6 +186,7 @@ export class SessionEventHandler { this.queuedGoalPromotionPending = false; this.queuedGoalPromotionInFlight = false; this.clearQueuedGoalPromotionTimer(); + this.clearStepRetryAttemptTimer(); this.stopAllMcpServerStatusSpinners(); } @@ -267,7 +270,7 @@ export class SessionEventHandler { case 'turn.step.started': this.handleStepBegin(event); break; case 'turn.step.interrupted': this.handleStepInterrupted(event); break; case 'turn.step.completed': this.handleStepCompleted(event); break; - case 'turn.step.retrying': break; + case 'turn.step.retrying': this.handleStepRetrying(event); break; case 'tool.progress': this.handleToolProgress(event); break; case 'shell.output': this.host.handleShellOutput(event); break; case 'shell.started': this.host.handleShellStarted(event); break; @@ -354,6 +357,7 @@ export class SessionEventHandler { private handleTurnEnd(event: TurnEndedEvent, sendQueued: (item: QueuedMessage) => void): void { this.host.streamingUI.flushNow(); + this.clearStepRetry(); if (event.reason === 'cancelled') { this.markActiveAgentSwarmsCancelled(); } @@ -414,6 +418,7 @@ export class SessionEventHandler { private handleStepCompleted(event: TurnStepCompletedEvent): void { this.host.streamingUI.flushNow(); + this.clearStepRetry(); this.host.noteStepUsage(event.usage); this.maybeShowDebugTiming(event); @@ -442,6 +447,48 @@ export class SessionEventHandler { this.host.showNotice(title, detail); } + private handleStepRetrying(event: TurnStepRetryingEvent): void { + // The failure may arrive mid-stream, after thinking/assistant deltas have + // parked the pane in `thinking`/`composing` — drive it back to waiting so + // the retry label and detail actually render during the backoff. + this.host.patchLivePane({ mode: 'waiting' }); + this.host.setAppState({ + streamingPhase: 'waiting', + stepRetry: { + nextAttempt: event.nextAttempt, + maxAttempts: event.maxAttempts, + delayMs: event.delayMs, + errorName: event.errorName, + errorMessage: event.errorMessage, + statusCode: event.statusCode, + phase: 'backoff', + }, + }); + // Both engines sleep for `delayMs` before the next attempt runs, but only + // v2 re-emits `turn.step.started` for it — flip the phase on a timer so the + // stale countdown drops on the legacy engine too. + this.clearStepRetryAttemptTimer(); + this.stepRetryAttemptTimer = setTimeout(() => { + this.stepRetryAttemptTimer = undefined; + const retry = this.host.state.appState.stepRetry; + if (retry === null) return; + this.host.setAppState({ stepRetry: { ...retry, phase: 'attempt' } }); + }, event.delayMs); + } + + private clearStepRetry(): void { + this.clearStepRetryAttemptTimer(); + if (this.host.state.appState.stepRetry === null) return; + this.host.setAppState({ stepRetry: null }); + } + + clearStepRetryAttemptTimer(): void { + if (this.stepRetryAttemptTimer !== undefined) { + clearTimeout(this.stepRetryAttemptTimer); + this.stepRetryAttemptTimer = undefined; + } + } + private maybeShowDebugTiming(event: TurnStepCompletedEvent): void { if (process.env['KIMI_CODE_DEBUG'] !== '1') return; const text = formatStepDebugTiming(event); @@ -469,6 +516,7 @@ export class SessionEventHandler { private handleStepInterrupted(event: TurnStepInterruptedEvent): void { this.host.streamingUI.flushNow(); + this.clearStepRetry(); this.host.streamingUI.resetToolUi(); this.host.streamingUI.finalizeLiveTextBuffers('idle'); const reason = event.reason; @@ -621,6 +669,7 @@ export class SessionEventHandler { private handleToolResult(event: ToolResultEvent): void { const { streamingUI } = this.host; streamingUI.flushNow(); + this.clearStepRetry(); const resultData: ToolResultBlockData = { tool_call_id: event.toolCallId, output: serializeToolResultOutput(event.output), diff --git a/apps/kimi-code/src/tui/kimi-tui.ts b/apps/kimi-code/src/tui/kimi-tui.ts index 2b6495e0401..488b426cdb7 100644 --- a/apps/kimi-code/src/tui/kimi-tui.ts +++ b/apps/kimi-code/src/tui/kimi-tui.ts @@ -137,6 +137,7 @@ import { type LoginProgressSpinnerHandle, type QueuedMessage, type SteerInputItem, + type StepRetryState, type TranscriptEntry, type TUIStartupOptions, type TUIStartupState, @@ -153,6 +154,7 @@ import { startupTrace } from '#/utils/startup-trace'; import { REPLAY_TURN_LIMIT } from './utils/message-replay'; import { hasPatchChanges } from './utils/object-patch'; import { sessionRowsForPicker } from './utils/session-picker-rows'; +import { formatStepRetryDetail, formatStepRetryLabel } from './utils/step-retry'; import { formatBashOutputForDisplay } from './utils/shell-output'; import { thinkingEffortFromConfig } from './utils/thinking-config'; import { combineStartupNotice, isOAuthLoginRequiredError } from './utils/startup'; @@ -211,6 +213,10 @@ function loadingTipKind(mode: EffectiveActivityPaneMode): LoadingTipKind | undef return undefined; } +function waitingSpinnerLabel(retry: StepRetryState | null): string { + return retry === null ? '' : formatStepRetryLabel(retry); +} + function sameStringArrays(a: readonly string[], b: readonly string[]): boolean { return a.length === b.length && a.every((value, index) => value === b[index]); } @@ -242,6 +248,7 @@ function createInitialAppState(input: KimiTUIStartupInput): AppState { isReplaying: false, streamingPhase: 'idle', streamingStartTime: 0, + stepRetry: null, theme: input.tuiConfig.theme, version: input.version, editorCommand: input.tuiConfig.editorCommand, @@ -980,6 +987,7 @@ export class KimiTUI { await this.harness.close(); } finally { this.sessionEventHandler.stopAllMcpServerStatusSpinners(); + this.sessionEventHandler.clearStepRetryAttemptTimer(); this.uninstallRainbowDance(); try { await this.state.terminal.drainInput(); @@ -2793,7 +2801,13 @@ export class KimiTUI { } this.syncTerminalProgress(this.shouldShowTerminalProgress(effectiveMode)); const placeSpinnerInAgentSwarm = this.shouldPlaceActivitySpinnerInAgentSwarm(effectiveMode); - const activityModeKey = `${effectiveMode}:${placeSpinnerInAgentSwarm ? 'swarm' : 'pane'}`; + // Carry the retry state in the mode key so an incoming/cleared + // `turn.step.retrying` rebuilds the waiting pane with fresh label and + // detail instead of hitting the cached-pane early return below. + const retry = effectiveMode === 'waiting' ? this.state.appState.stepRetry : null; + const retryKey = + retry === null ? '' : `${formatStepRetryLabel(retry)}|${formatStepRetryDetail(retry)}`; + const activityModeKey = `${effectiveMode}:${placeSpinnerInAgentSwarm ? 'swarm' : 'pane'}:${retryKey}`; if ( activityModeKey === this.lastActivityMode && @@ -2815,14 +2829,16 @@ export class KimiTUI { this.state.ui.requestRender(); return; case 'waiting': { - const spinner = this.ensureActivitySpinner('moon'); + const stepRetry = this.state.appState.stepRetry; + const spinner = this.ensureActivitySpinner('moon', waitingSpinnerLabel(stepRetry)); this.syncAgentSwarmActivitySpinner(placeSpinnerInAgentSwarm ? spinner : undefined); if (placeSpinnerInAgentSwarm) break; this.state.activityContainer.addChild( new ActivityPaneComponent({ mode: 'waiting', spinner, - tip: this.currentLoadingTip?.tip, + tip: stepRetry === null ? this.currentLoadingTip?.tip : undefined, + detail: stepRetry === null ? undefined : formatStepRetryDetail(stepRetry), }), ); break; diff --git a/apps/kimi-code/src/tui/types.ts b/apps/kimi-code/src/tui/types.ts index d423aec7053..d1e3341d87d 100644 --- a/apps/kimi-code/src/tui/types.ts +++ b/apps/kimi-code/src/tui/types.ts @@ -64,6 +64,8 @@ export interface AppState { isReplaying: boolean; streamingPhase: 'idle' | 'waiting' | 'thinking' | 'composing' | 'shell'; streamingStartTime: number; + /** Pending step retry backoff (fed by `turn.step.retrying`); null when no retry is in flight. */ + stepRetry: StepRetryState | null; theme: ThemeName; version: string; editorCommand: string | null; @@ -85,6 +87,24 @@ export interface AppState { banner?: BannerState | null; } +export interface StepRetryState { + /** Upcoming attempt number (1-based). */ + nextAttempt: number; + maxAttempts: number; + /** Backoff wait before the next attempt, in milliseconds. */ + delayMs: number; + errorName: string; + errorMessage: string; + /** HTTP status code for `APIStatusError`; undefined for network/timeout failures. */ + statusCode?: number; + /** + * `backoff` while sleeping before the next attempt (label shows the + * countdown); `attempt` once the `delayMs` backoff has elapsed and the next + * attempt is running — the countdown has expired by then and is dropped. + */ + phase: 'backoff' | 'attempt'; +} + export interface ToolCallBlockData { id: string; name: string; diff --git a/apps/kimi-code/src/tui/utils/step-retry.ts b/apps/kimi-code/src/tui/utils/step-retry.ts new file mode 100644 index 00000000000..34a79887863 --- /dev/null +++ b/apps/kimi-code/src/tui/utils/step-retry.ts @@ -0,0 +1,19 @@ +import { RETRY_DETAIL_MAX_CHARS } from '../constant/rendering'; +import type { StepRetryState } from '../types'; + +export function formatStepRetryLabel(retry: StepRetryState): string { + const base = `Retrying (${retry.nextAttempt}/${retry.maxAttempts}) · ${retry.errorName}`; + if (retry.phase === 'attempt') return base; + const delaySeconds = Math.max(1, Math.ceil(retry.delayMs / 1000)); + return `${base} · in ${delaySeconds}s`; +} + +/** Detail line under the spinner: status code + provider message, single-line, capped. */ +export function formatStepRetryDetail(retry: StepRetryState): string { + const message = retry.errorMessage.replaceAll(/\s+/g, ' ').trim(); + const code = retry.statusCode === undefined ? '' : String(retry.statusCode); + const detail = [code, message].filter((part) => part.length > 0).join(' · '); + return detail.length > RETRY_DETAIL_MAX_CHARS + ? `${detail.slice(0, RETRY_DETAIL_MAX_CHARS - 1)}…` + : detail; +} diff --git a/apps/kimi-code/test/tui/components/chrome/footer-status-line.test.ts b/apps/kimi-code/test/tui/components/chrome/footer-status-line.test.ts index a6be39adfb6..36bd1fcf51d 100644 --- a/apps/kimi-code/test/tui/components/chrome/footer-status-line.test.ts +++ b/apps/kimi-code/test/tui/components/chrome/footer-status-line.test.ts @@ -29,6 +29,7 @@ const baseState: AppState = { isReplaying: false, streamingPhase: 'idle', streamingStartTime: 0, + stepRetry: null, planMode: false, inputMode: 'prompt', swarmMode: false, diff --git a/apps/kimi-code/test/tui/components/chrome/footer.test.ts b/apps/kimi-code/test/tui/components/chrome/footer.test.ts index 2fe6f3e52e6..79abf826e8e 100644 --- a/apps/kimi-code/test/tui/components/chrome/footer.test.ts +++ b/apps/kimi-code/test/tui/components/chrome/footer.test.ts @@ -48,6 +48,7 @@ const appState: AppState = { isReplaying: false, streamingPhase: 'idle', streamingStartTime: 0, + stepRetry: null, planMode: false, inputMode: 'prompt', swarmMode: false, diff --git a/apps/kimi-code/test/tui/components/chrome/welcome.test.ts b/apps/kimi-code/test/tui/components/chrome/welcome.test.ts index bc1b754fb67..18eef144018 100644 --- a/apps/kimi-code/test/tui/components/chrome/welcome.test.ts +++ b/apps/kimi-code/test/tui/components/chrome/welcome.test.ts @@ -25,6 +25,7 @@ const appState: AppState = { isReplaying: false, streamingPhase: 'idle', streamingStartTime: 0, + stepRetry: null, planMode: false, inputMode: 'prompt', swarmMode: false, diff --git a/apps/kimi-code/test/tui/components/panes/activity-pane.test.ts b/apps/kimi-code/test/tui/components/panes/activity-pane.test.ts index 76acd438ce5..314c7a18a86 100644 --- a/apps/kimi-code/test/tui/components/panes/activity-pane.test.ts +++ b/apps/kimi-code/test/tui/components/panes/activity-pane.test.ts @@ -28,23 +28,39 @@ function createMockSpinner(initialText = 'working') { describe('ActivityPaneComponent', () => { it('renders waiting loader after a spacer', () => { + const { spinner } = createMockSpinner('loading'); const component = new ActivityPaneComponent({ mode: 'waiting', - spinner: new Text('loading', 0, 0) as never, + spinner, }); expect(component.render(80).map((line) => line.trimEnd())).toEqual(['', 'loading']); }); it('renders composing spinner after a spacer', () => { + const { spinner } = createMockSpinner('working'); const component = new ActivityPaneComponent({ mode: 'composing', - spinner: new Text('working', 0, 0) as never, + spinner, }); expect(component.render(80).map((line) => line.trimEnd())).toEqual(['', 'working']); }); + it('renders the detail line under the waiting spinner', () => { + const { spinner } = createMockSpinner('working'); + const component = new ActivityPaneComponent({ + mode: 'waiting', + spinner, + detail: '429 · rate limited', + }); + + const lines = component + .render(80) + .map((line) => line.replaceAll(/\u001B\[[0-9;]*m/g, '').trimEnd()); + expect(lines).toEqual(['', 'working', ' 429 · rate limited']); + }); + it.each(['waiting', 'tool', 'composing'] as const)( 'renders %s spinner with tip after a spacer', (mode) => { diff --git a/apps/kimi-code/test/tui/controllers/session-event-handler-step-retry.test.ts b/apps/kimi-code/test/tui/controllers/session-event-handler-step-retry.test.ts new file mode 100644 index 00000000000..a60aa55c636 --- /dev/null +++ b/apps/kimi-code/test/tui/controllers/session-event-handler-step-retry.test.ts @@ -0,0 +1,180 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + +import { SessionEventHandler } from '#/tui/controllers/session-event-handler'; +import { getBuiltInPalette } from '#/tui/theme'; + +function makeHost() { + const host = { + state: { + appState: { + sessionId: 's1', + streamingPhase: 'waiting', + isCompacting: false, + model: 'kimi-model', + permissionMode: 'auto', + stepRetry: null, + }, + queuedMessages: [], + queuedMessageDispatchPending: false, + theme: { palette: getBuiltInPalette('dark') }, + toolOutputExpanded: false, + todoPanel: { getTodos: vi.fn(() => []) }, + transcriptContainer: { addChild: vi.fn() }, + ui: { requestRender: vi.fn() }, + }, + session: { id: 's1' }, + aborted: false, + sessionEventUnsubscribe: undefined, + streamingUI: { + setTurnId: vi.fn(), + setStep: vi.fn(), + flushNow: vi.fn(), + resetToolUi: vi.fn(), + finalizeTurn: vi.fn(), + finalizeLiveTextBuffers: vi.fn(), + completeToolResult: vi.fn(), + }, + requireSession: vi.fn(), + setAppState: vi.fn((patch: Record) => + Object.assign(host.state.appState, patch), + ), + patchLivePane: vi.fn(), + resetLivePane: vi.fn(), + showError: vi.fn(), + showStatus: vi.fn(), + showNotice: vi.fn(), + track: vi.fn(), + recordSessionActivity: vi.fn(), + noteStepUsage: vi.fn(), + noteCompactionFinished: vi.fn(), + mountEditorReplacement: vi.fn(), + restoreEditor: vi.fn(), + restoreInputText: vi.fn(), + appendTranscriptEntry: vi.fn(), + sendNormalUserInput: vi.fn(), + sendQueuedMessage: vi.fn(), + shiftQueuedMessage: vi.fn(), + btwPanelController: { routeEvent: vi.fn(() => false) }, + tasksBrowserController: {}, + }; + return { host: host as any }; +} + +const retryingEvent = { + type: 'turn.step.retrying', + sessionId: 's1', + agentId: 'main', + turnId: 1, + step: 1, + failedAttempt: 1, + nextAttempt: 2, + maxAttempts: 10, + delayMs: 4000, + errorName: 'APIStatusError', + errorMessage: 'rate limited', + statusCode: 429, +} as const; + +describe('SessionEventHandler step retry state', () => { + beforeEach(() => { + vi.useFakeTimers(); + }); + afterEach(() => { + vi.useRealTimers(); + }); + + it('stores the retry snapshot when a step starts retrying', () => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + expect(host.state.appState.stepRetry).toEqual({ + nextAttempt: 2, + maxAttempts: 10, + delayMs: 4000, + errorName: 'APIStatusError', + errorMessage: 'rate limited', + statusCode: 429, + phase: 'backoff', + }); + }); + + it('drives the pane back to waiting so mid-stream retries render', () => { + const { host } = makeHost(); + host.state.appState.streamingPhase = 'composing'; + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + expect(host.patchLivePane).toHaveBeenCalledWith({ mode: 'waiting' }); + expect(host.state.appState.streamingPhase).toBe('waiting'); + }); + + it.each([ + [{ type: 'turn.step.completed', turnId: 1, step: 1 }, 'turn.step.completed'], + [ + { type: 'turn.step.interrupted', turnId: 1, step: 1, reason: 'error' }, + 'turn.step.interrupted', + ], + [{ type: 'turn.ended', turnId: 1, reason: 'completed' }, 'turn.ended'], + [ + { type: 'tool.result', turnId: 1, toolCallId: 'tc1', output: 'ok', isError: false }, + 'tool.result', + ], + ])('clears the retry snapshot on %s', (event, _label) => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + expect(host.state.appState.stepRetry).not.toBeNull(); + handler.handleEvent( + { sessionId: 's1', agentId: 'main', ...event } as any, + vi.fn(), + ); + expect(host.state.appState.stepRetry).toBeNull(); + }); + + it('flips to attempt phase once the backoff delay elapses', () => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + expect(host.state.appState.stepRetry).toMatchObject({ phase: 'backoff' }); + vi.advanceTimersByTime(4000); + expect(host.state.appState.stepRetry).toMatchObject({ nextAttempt: 2, phase: 'attempt' }); + }); + + it('cancels the phase flip when the retry is cleared during the backoff', () => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + handler.handleEvent( + { + type: 'turn.step.interrupted', + sessionId: 's1', + agentId: 'main', + turnId: 1, + step: 1, + reason: 'error', + } as any, + vi.fn(), + ); + vi.advanceTimersByTime(10_000); + expect(host.state.appState.stepRetry).toBeNull(); + }); + + it('keeps the retry snapshot on turn.step.started (v2 re-emits it per attempt)', () => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + handler.handleEvent( + { type: 'turn.step.started', sessionId: 's1', agentId: 'main', turnId: 1, step: 1 } as any, + vi.fn(), + ); + expect(host.state.appState.stepRetry).toMatchObject({ nextAttempt: 2, phase: 'backoff' }); + }); + + it('cancels the pending phase flip via clearStepRetryAttemptTimer (TUI shutdown path)', () => { + const { host } = makeHost(); + const handler = new SessionEventHandler(host); + handler.handleEvent(retryingEvent as any, vi.fn()); + handler.clearStepRetryAttemptTimer(); + vi.advanceTimersByTime(10_000); + expect(host.state.appState.stepRetry).toMatchObject({ phase: 'backoff' }); + }); +}); diff --git a/apps/kimi-code/test/tui/create-tui-state.test.ts b/apps/kimi-code/test/tui/create-tui-state.test.ts index 0899cf07023..8e17cc8f6b3 100644 --- a/apps/kimi-code/test/tui/create-tui-state.test.ts +++ b/apps/kimi-code/test/tui/create-tui-state.test.ts @@ -22,6 +22,7 @@ function fakeInitialAppState(): AppState { isReplaying: false, streamingPhase: 'idle', streamingStartTime: 0, + stepRetry: null, theme: 'dark', version: '0.0.0-test', editorCommand: null, diff --git a/apps/kimi-code/test/tui/utils/step-retry.test.ts b/apps/kimi-code/test/tui/utils/step-retry.test.ts new file mode 100644 index 00000000000..9111471c888 --- /dev/null +++ b/apps/kimi-code/test/tui/utils/step-retry.test.ts @@ -0,0 +1,64 @@ +import { describe, expect, it } from 'vitest'; + +import { RETRY_DETAIL_MAX_CHARS } from '#/tui/constant/rendering'; +import { formatStepRetryDetail, formatStepRetryLabel } from '#/tui/utils/step-retry'; +import type { StepRetryState } from '#/tui/types'; + +function retry(partial: Partial = {}): StepRetryState { + return { + nextAttempt: 2, + maxAttempts: 10, + delayMs: 4000, + errorName: 'APIStatusError', + errorMessage: 'rate limited', + statusCode: 429, + phase: 'backoff', + ...partial, + }; +} + +describe('formatStepRetryLabel', () => { + it('shows attempts, raw error name, and backoff delay', () => { + expect(formatStepRetryLabel(retry())).toBe('Retrying (2/10) · APIStatusError · in 4s'); + }); + + it('drops the stale countdown once the attempt is running', () => { + expect(formatStepRetryLabel(retry({ phase: 'attempt' }))).toBe( + 'Retrying (2/10) · APIStatusError', + ); + }); + + it('rounds sub-second delays up to 1s', () => { + expect(formatStepRetryLabel(retry({ delayMs: 500 }))).toContain('in 1s'); + }); +}); + +describe('formatStepRetryDetail', () => { + it('prefixes the message with the status code', () => { + expect(formatStepRetryDetail(retry())).toBe('429 · rate limited'); + }); + + it('omits the status code for network/timeout failures', () => { + expect( + formatStepRetryDetail( + retry({ errorName: 'APIConnectionError', errorMessage: 'fetch failed', statusCode: undefined }), + ), + ).toBe('fetch failed'); + }); + + it('collapses multi-line error bodies into one line', () => { + expect(formatStepRetryDetail(retry({ errorMessage: 'line one\n\n line two' }))).toBe( + '429 · line one line two', + ); + }); + + it('caps huge error bodies', () => { + const detail = formatStepRetryDetail(retry({ errorMessage: 'x'.repeat(1000) })); + expect(detail.length).toBe(RETRY_DETAIL_MAX_CHARS); + expect(detail.endsWith('…')).toBe(true); + }); + + it('returns the status code alone when the message is empty', () => { + expect(formatStepRetryDetail(retry({ errorMessage: '' }))).toBe('429'); + }); +}); From 68ce3c7a0ccffe32b51d4fdb57cdeced3931ddcc Mon Sep 17 00:00:00 2001 From: qer Date: Wed, 12 Aug 2026 11:38:17 +0800 Subject: [PATCH 14/50] chore: sync web dist from code-app (#2840) --- .changeset/chat-turn-stable-identity.md | 5 + .changeset/icon-button-tooltips.md | 5 + .changeset/image-preview-margin.md | 5 + .changeset/media-preview-style-align.md | 5 + .changeset/sidebar-min-width.md | 5 + .changeset/tool-media-lightbox.md | 5 + .changeset/tooltip-bubble-lazy-mount.md | 5 + .changeset/turnfold-unmount-collapsed.md | 5 + ...-ZZ-0lk3E.js => CodeBlockNode-BAtAs_qm.js} | 4 +- .../assets/DesignSystemView-BOD_23qT.js | 13 - .../assets/DesignSystemView-BnL2v2lB.css | 1 - .../assets/DesignSystemView-CTUhpkDe.js | 13 + .../assets/DesignSystemView-DVONbdv-.css | 1 + ...ooltip-CPKMqLZA.js => Tooltip-DbYQWF1U.js} | 2 +- ...Pt.js => abnfDiagram-VRR7QNED-C0Afmuc1.js} | 2 +- .../{arc-E_7M-TWh.js => arc-IkhU3FHH.js} | 2 +- ... architectureDiagram-ZJ3FMSHR-CBluWNBt.js} | 2 +- ...C.js => blockDiagram-677ZJIJ3-BNXb88Fr.js} | 2 +- ...mgsI.js => c4Diagram-LMCZKHZV-CUyKVoVi.js} | 2 +- .../dist-web/assets/channel-Bob_1R_C.js | 1 - .../dist-web/assets/channel-xkK6nTGq.js | 1 + ...B47YykJY.js => chunk-2Q5K7J3B-DsAC7dRk.js} | 2 +- ...DAsxL712.js => chunk-32BRIVSS-DUDRPqmY.js} | 2 +- ...CfD0Yt-O.js => chunk-5VM5RSS4-yyj9cAyF.js} | 2 +- ...DGM3fHaz.js => chunk-EX3LRPZG-BCWDroXJ.js} | 2 +- ...DTx-f56M.js => chunk-JWPE2WC7-Dsg3gA8l.js} | 2 +- ...hIDvr-8C.js => chunk-MOJQB5TN-JQ2kJR9W.js} | 2 +- ...BHZEnq1y.js => chunk-RYQCIY6F-Df2V79id.js} | 2 +- ...DjiRieSh.js => chunk-V7JOEXUC-B4q9plWN.js} | 2 +- ...he8WxbY-.js => chunk-VR4S4FIN-CEH7JYJn.js} | 2 +- ...BmzWd-kT.js => chunk-XXDRQBXY-5rh7CWvm.js} | 2 +- .../assets/classDiagram-OUVF2IWQ-ClMG95L0.js | 1 + .../assets/classDiagram-OUVF2IWQ-FzVd5qC_.js | 1 - .../classDiagram-v2-EOCWNBFH-ClMG95L0.js | 1 + .../classDiagram-v2-EOCWNBFH-FzVd5qC_.js | 1 - ...7.js => cose-bilkent-JH36ORCC-TWQPJk-P.js} | 2 +- ...gNr-Q4.js => cynefin-VYW2F7L2-BIlq342y.js} | 2 +- ...js => cynefinDiagram-TSTJHNR4-zQaCQNIP.js} | 2 +- ...CDFnWuZ_.js => dagre-VKFMJZFB-D8gdq5tS.js} | 2 +- ...ley8W-.js => diagram-FQU43EPY-D2bRXH1a.js} | 2 +- ...WknpV7.js => diagram-G47NLZAW-BF9x_uf7.js} | 2 +- ...DRMohg.js => diagram-NH7WQ7WH-DUn2m-AO.js} | 2 +- ...nuTLFG.js => diagram-OA4YK3LP-BOIp7TNe.js} | 2 +- ...PhYqjp.js => diagram-WEI45ONY-CFwFRAWa.js} | 2 +- ...Tx.js => ebnfDiagram-CCIWWBDH-B4NTctc_.js} | 2 +- ...pdtV.js => erDiagram-Q63AITRT-DVzumNgk.js} | 2 +- ..._H.js => flowDiagram-23GEKE2U-CzI-GKO4.js} | 2 +- ...o.js => ganttDiagram-NO4QXBWP-B2lfrNfh.js} | 2 +- ...s => gitGraphDiagram-IHSO6WYX-D7UBC8np.js} | 2 +- .../{index-V37-dq86.js => index-BZFTzQ6y.js} | 2 +- .../dist-web/assets/index-D-7nOosq.js | 638 ++++++++++++++++++ .../dist-web/assets/index-DGHD7Bg9.css | 1 + .../{index-CTjtTfCD.js => index-DzfhniX8.js} | 4 +- .../dist-web/assets/index-HRJ6xRtC.js | 626 ----------------- .../{index-B2KLv33G.js => index-ZmzTmhry.js} | 2 +- .../dist-web/assets/index-vdPxBs-i.css | 1 - ...ndex10-BZ-Q5Z-w.js => index10-BCo1_xRY.js} | 2 +- ...ndex11-DvlSNaLO.js => index11-Ci8_PlMN.js} | 2 +- ...{index5-DRizs5us.js => index5-Cn2jfVMX.js} | 2 +- ...{index6-BS7x8iLz.js => index6-D4fZsFMu.js} | 2 +- ...{index7-CjjTl3F3.js => index7-BT2SBznQ.js} | 2 +- ...{index8-BwJHsPMm.js => index8-BaK3y7fN.js} | 2 +- ...mf.js => infoDiagram-FWYZ7A6U-DASw56fH.js} | 2 +- ...s => ishikawaDiagram-FXEZZL3T-CcPuml-k.js} | 2 +- ...js => journeyDiagram-5HDEW3XC-BShuBRgf.js} | 2 +- ...=> kanban-definition-HUTT4EX6-_UoHLqzR.js} | 2 +- ...{linear-DHRafvZW.js => linear-DH49UJnN.js} | 2 +- ...e-Cahi9cr1.js => mermaid.core-CJB1tAev.js} | 8 +- ...> mindmap-definition-LN4V7U3C-HXhM1kRL.js} | 2 +- ...Y6H.js => pegDiagram-2B236MQR-_6D7zUy-.js} | 2 +- ...I8d.js => pieDiagram-ENE6RG2P-f3F4At6v.js} | 2 +- ...s => quadrantDiagram-ABIIQ3AL-3t7sFhfl.js} | 2 +- ...s => railroadDiagram-RFXS5EU6-W9nf8fYD.js} | 2 +- ...> requirementDiagram-TGXJPOKE-Bzvt0v7J.js} | 2 +- ....js => sankeyDiagram-HTMAVEWB-B5WnWxzh.js} | 2 +- ...s => sequenceDiagram-DBY2YBRQ-CnV0H-kS.js} | 2 +- ...ng.js => sizeCapture-X5ZJPWSS-D5GqjpM0.js} | 2 +- ...q.js => stateDiagram-2N3HPSRC-GIVsAB2M.js} | 2 +- .../stateDiagram-v2-6OUMAXLB-0KuGlzV7.js | 1 + .../stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js | 1 - ...JfLo.js => swimlanes-5IMT3BWC-D6xMtJ1E.js} | 4 +- .../swimlanesDiagram-G3AALYLV-DKIx012r.js | 8 + .../swimlanesDiagram-G3AALYLV-DRwlvM9F.js | 8 - ... timeline-definition-FHXFAJF6-5u0AN8o0.js} | 2 +- ...9X.js => vennDiagram-L72KCM5P-ozNTLnJz.js} | 2 +- ...js => vue.runtime.esm-bundler-J0WjtLlK.js} | 2 +- ...js => wardleyDiagram-EHGQE667-BuQJYWm-.js} | 2 +- ...js => xychartDiagram-FW5EYKEG-yQImOWPy.js} | 2 +- apps/kimi-code/dist-web/boot.js | 2 +- apps/kimi-code/dist-web/index.html | 4 +- 90 files changed, 776 insertions(+), 724 deletions(-) create mode 100644 .changeset/chat-turn-stable-identity.md create mode 100644 .changeset/icon-button-tooltips.md create mode 100644 .changeset/image-preview-margin.md create mode 100644 .changeset/media-preview-style-align.md create mode 100644 .changeset/sidebar-min-width.md create mode 100644 .changeset/tool-media-lightbox.md create mode 100644 .changeset/tooltip-bubble-lazy-mount.md create mode 100644 .changeset/turnfold-unmount-collapsed.md rename apps/kimi-code/dist-web/assets/{CodeBlockNode-ZZ-0lk3E.js => CodeBlockNode-BAtAs_qm.js} (99%) delete mode 100644 apps/kimi-code/dist-web/assets/DesignSystemView-BOD_23qT.js delete mode 100644 apps/kimi-code/dist-web/assets/DesignSystemView-BnL2v2lB.css create mode 100644 apps/kimi-code/dist-web/assets/DesignSystemView-CTUhpkDe.js create mode 100644 apps/kimi-code/dist-web/assets/DesignSystemView-DVONbdv-.css rename apps/kimi-code/dist-web/assets/{Tooltip-CPKMqLZA.js => Tooltip-DbYQWF1U.js} (98%) rename apps/kimi-code/dist-web/assets/{abnfDiagram-VRR7QNED-D_3zPyPt.js => abnfDiagram-VRR7QNED-C0Afmuc1.js} (86%) rename apps/kimi-code/dist-web/assets/{arc-E_7M-TWh.js => arc-IkhU3FHH.js} (98%) rename apps/kimi-code/dist-web/assets/{architectureDiagram-ZJ3FMSHR-CEA-tR1m.js => architectureDiagram-ZJ3FMSHR-CBluWNBt.js} (99%) rename apps/kimi-code/dist-web/assets/{blockDiagram-677ZJIJ3-CpvS2-LC.js => blockDiagram-677ZJIJ3-BNXb88Fr.js} (99%) rename apps/kimi-code/dist-web/assets/{c4Diagram-LMCZKHZV-BvJQmgsI.js => c4Diagram-LMCZKHZV-CUyKVoVi.js} (99%) delete mode 100644 apps/kimi-code/dist-web/assets/channel-Bob_1R_C.js create mode 100644 apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js rename apps/kimi-code/dist-web/assets/{chunk-2Q5K7J3B-B47YykJY.js => chunk-2Q5K7J3B-DsAC7dRk.js} (67%) rename apps/kimi-code/dist-web/assets/{chunk-32BRIVSS-DAsxL712.js => chunk-32BRIVSS-DUDRPqmY.js} (96%) rename apps/kimi-code/dist-web/assets/{chunk-5VM5RSS4-CfD0Yt-O.js => chunk-5VM5RSS4-yyj9cAyF.js} (83%) rename apps/kimi-code/dist-web/assets/{chunk-EX3LRPZG-DGM3fHaz.js => chunk-EX3LRPZG-BCWDroXJ.js} (99%) rename apps/kimi-code/dist-web/assets/{chunk-JWPE2WC7-DTx-f56M.js => chunk-JWPE2WC7-Dsg3gA8l.js} (71%) rename apps/kimi-code/dist-web/assets/{chunk-MOJQB5TN-hIDvr-8C.js => chunk-MOJQB5TN-JQ2kJR9W.js} (99%) rename apps/kimi-code/dist-web/assets/{chunk-RYQCIY6F-BHZEnq1y.js => chunk-RYQCIY6F-Df2V79id.js} (99%) rename apps/kimi-code/dist-web/assets/{chunk-V7JOEXUC-DjiRieSh.js => chunk-V7JOEXUC-B4q9plWN.js} (99%) rename apps/kimi-code/dist-web/assets/{chunk-VR4S4FIN-he8WxbY-.js => chunk-VR4S4FIN-CEH7JYJn.js} (87%) rename apps/kimi-code/dist-web/assets/{chunk-XXDRQBXY-BmzWd-kT.js => chunk-XXDRQBXY-5rh7CWvm.js} (72%) create mode 100644 apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js delete mode 100644 apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-FzVd5qC_.js create mode 100644 apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js delete mode 100644 apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-FzVd5qC_.js rename apps/kimi-code/dist-web/assets/{cose-bilkent-JH36ORCC-B4N3AGR7.js => cose-bilkent-JH36ORCC-TWQPJk-P.js} (99%) rename apps/kimi-code/dist-web/assets/{cynefin-VYW2F7L2-C5gNr-Q4.js => cynefin-VYW2F7L2-BIlq342y.js} (99%) rename apps/kimi-code/dist-web/assets/{cynefinDiagram-TSTJHNR4-DZWywj_D.js => cynefinDiagram-TSTJHNR4-zQaCQNIP.js} (98%) rename apps/kimi-code/dist-web/assets/{dagre-VKFMJZFB-CDFnWuZ_.js => dagre-VKFMJZFB-D8gdq5tS.js} (97%) rename apps/kimi-code/dist-web/assets/{diagram-FQU43EPY-Cqley8W-.js => diagram-FQU43EPY-D2bRXH1a.js} (98%) rename apps/kimi-code/dist-web/assets/{diagram-G47NLZAW-jJWknpV7.js => diagram-G47NLZAW-BF9x_uf7.js} (97%) rename apps/kimi-code/dist-web/assets/{diagram-NH7WQ7WH-iqDRMohg.js => diagram-NH7WQ7WH-DUn2m-AO.js} (93%) rename apps/kimi-code/dist-web/assets/{diagram-OA4YK3LP-DSnuTLFG.js => diagram-OA4YK3LP-BOIp7TNe.js} (96%) rename apps/kimi-code/dist-web/assets/{diagram-WEI45ONY-lGPhYqjp.js => diagram-WEI45ONY-CFwFRAWa.js} (95%) rename apps/kimi-code/dist-web/assets/{ebnfDiagram-CCIWWBDH-DWQayqTx.js => ebnfDiagram-CCIWWBDH-B4NTctc_.js} (87%) rename apps/kimi-code/dist-web/assets/{erDiagram-Q63AITRT-MX1lpdtV.js => erDiagram-Q63AITRT-DVzumNgk.js} (99%) rename apps/kimi-code/dist-web/assets/{flowDiagram-23GEKE2U-BJ9xq3_H.js => flowDiagram-23GEKE2U-CzI-GKO4.js} (99%) rename apps/kimi-code/dist-web/assets/{ganttDiagram-NO4QXBWP-UHBCrlBo.js => ganttDiagram-NO4QXBWP-B2lfrNfh.js} (99%) rename apps/kimi-code/dist-web/assets/{gitGraphDiagram-IHSO6WYX-BO6zli_L.js => gitGraphDiagram-IHSO6WYX-D7UBC8np.js} (99%) rename apps/kimi-code/dist-web/assets/{index-V37-dq86.js => index-BZFTzQ6y.js} (99%) create mode 100644 apps/kimi-code/dist-web/assets/index-D-7nOosq.js create mode 100644 apps/kimi-code/dist-web/assets/index-DGHD7Bg9.css rename apps/kimi-code/dist-web/assets/{index-CTjtTfCD.js => index-DzfhniX8.js} (99%) delete mode 100644 apps/kimi-code/dist-web/assets/index-HRJ6xRtC.js rename apps/kimi-code/dist-web/assets/{index-B2KLv33G.js => index-ZmzTmhry.js} (99%) delete mode 100644 apps/kimi-code/dist-web/assets/index-vdPxBs-i.css rename apps/kimi-code/dist-web/assets/{index10-BZ-Q5Z-w.js => index10-BCo1_xRY.js} (99%) rename apps/kimi-code/dist-web/assets/{index11-DvlSNaLO.js => index11-Ci8_PlMN.js} (99%) rename apps/kimi-code/dist-web/assets/{index5-DRizs5us.js => index5-Cn2jfVMX.js} (95%) rename apps/kimi-code/dist-web/assets/{index6-BS7x8iLz.js => index6-D4fZsFMu.js} (98%) rename apps/kimi-code/dist-web/assets/{index7-CjjTl3F3.js => index7-BT2SBznQ.js} (98%) rename apps/kimi-code/dist-web/assets/{index8-BwJHsPMm.js => index8-BaK3y7fN.js} (99%) rename apps/kimi-code/dist-web/assets/{infoDiagram-FWYZ7A6U-D1xLYfmf.js => infoDiagram-FWYZ7A6U-DASw56fH.js} (69%) rename apps/kimi-code/dist-web/assets/{ishikawaDiagram-FXEZZL3T-BpjBlRoK.js => ishikawaDiagram-FXEZZL3T-CcPuml-k.js} (99%) rename apps/kimi-code/dist-web/assets/{journeyDiagram-5HDEW3XC-DW8NrHP6.js => journeyDiagram-5HDEW3XC-BShuBRgf.js} (98%) rename apps/kimi-code/dist-web/assets/{kanban-definition-HUTT4EX6-DBZtJFK7.js => kanban-definition-HUTT4EX6-_UoHLqzR.js} (99%) rename apps/kimi-code/dist-web/assets/{linear-DHRafvZW.js => linear-DH49UJnN.js} (98%) rename apps/kimi-code/dist-web/assets/{mermaid.core-Cahi9cr1.js => mermaid.core-CJB1tAev.js} (99%) rename apps/kimi-code/dist-web/assets/{mindmap-definition-LN4V7U3C-FiRh3KHx.js => mindmap-definition-LN4V7U3C-HXhM1kRL.js} (98%) rename apps/kimi-code/dist-web/assets/{pegDiagram-2B236MQR-DCy00Y6H.js => pegDiagram-2B236MQR-_6D7zUy-.js} (87%) rename apps/kimi-code/dist-web/assets/{pieDiagram-ENE6RG2P-D4ADRI8d.js => pieDiagram-ENE6RG2P-f3F4At6v.js} (94%) rename apps/kimi-code/dist-web/assets/{quadrantDiagram-ABIIQ3AL-DM_U-KIt.js => quadrantDiagram-ABIIQ3AL-3t7sFhfl.js} (99%) rename apps/kimi-code/dist-web/assets/{railroadDiagram-RFXS5EU6-DemW1ILD.js => railroadDiagram-RFXS5EU6-W9nf8fYD.js} (84%) rename apps/kimi-code/dist-web/assets/{requirementDiagram-TGXJPOKE-CxBcxos4.js => requirementDiagram-TGXJPOKE-Bzvt0v7J.js} (99%) rename apps/kimi-code/dist-web/assets/{sankeyDiagram-HTMAVEWB-DQOKpLQv.js => sankeyDiagram-HTMAVEWB-B5WnWxzh.js} (99%) rename apps/kimi-code/dist-web/assets/{sequenceDiagram-DBY2YBRQ-ne5mKmWY.js => sequenceDiagram-DBY2YBRQ-CnV0H-kS.js} (99%) rename apps/kimi-code/dist-web/assets/{sizeCapture-X5ZJPWSS-CseHvhng.js => sizeCapture-X5ZJPWSS-D5GqjpM0.js} (86%) rename apps/kimi-code/dist-web/assets/{stateDiagram-2N3HPSRC-wqCW5C6q.js => stateDiagram-2N3HPSRC-GIVsAB2M.js} (96%) create mode 100644 apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js delete mode 100644 apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js rename apps/kimi-code/dist-web/assets/{swimlanes-5IMT3BWC-DIbCJfLo.js => swimlanes-5IMT3BWC-D6xMtJ1E.js} (99%) create mode 100644 apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js delete mode 100644 apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DRwlvM9F.js rename apps/kimi-code/dist-web/assets/{timeline-definition-FHXFAJF6-DRuJB2Ns.js => timeline-definition-FHXFAJF6-5u0AN8o0.js} (99%) rename apps/kimi-code/dist-web/assets/{vennDiagram-L72KCM5P-DtEwf89X.js => vennDiagram-L72KCM5P-ozNTLnJz.js} (99%) rename apps/kimi-code/dist-web/assets/{vue.runtime.esm-bundler-BX4cWW2k.js => vue.runtime.esm-bundler-J0WjtLlK.js} (98%) rename apps/kimi-code/dist-web/assets/{wardleyDiagram-EHGQE667-BQgMNH39.js => wardleyDiagram-EHGQE667-BuQJYWm-.js} (99%) rename apps/kimi-code/dist-web/assets/{xychartDiagram-FW5EYKEG-DJUplk_O.js => xychartDiagram-FW5EYKEG-yQImOWPy.js} (99%) diff --git a/.changeset/chat-turn-stable-identity.md b/.changeset/chat-turn-stable-identity.md new file mode 100644 index 00000000000..6eb85c42d9a --- /dev/null +++ b/.changeset/chat-turn-stable-identity.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Reduce UI stutter while AI responses stream in long sessions. diff --git a/.changeset/icon-button-tooltips.md b/.changeset/icon-button-tooltips.md new file mode 100644 index 00000000000..f94bb443c00 --- /dev/null +++ b/.changeset/icon-button-tooltips.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Add hover tooltips to icon-only buttons. diff --git a/.changeset/image-preview-margin.md b/.changeset/image-preview-margin.md new file mode 100644 index 00000000000..5031e363287 --- /dev/null +++ b/.changeset/image-preview-margin.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Add breathing room around the fullscreen image preview so images no longer touch the screen edges. diff --git a/.changeset/media-preview-style-align.md b/.changeset/media-preview-style-align.md new file mode 100644 index 00000000000..e194ebe64fe --- /dev/null +++ b/.changeset/media-preview-style-align.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Unify the fullscreen image and video previews with a shared circular close button and the same background overlay. diff --git a/.changeset/sidebar-min-width.md b/.changeset/sidebar-min-width.md new file mode 100644 index 00000000000..72a9e7acd38 --- /dev/null +++ b/.changeset/sidebar-min-width.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Widen the sidebar's minimum draggable width. diff --git a/.changeset/tool-media-lightbox.md b/.changeset/tool-media-lightbox.md new file mode 100644 index 00000000000..b81bb6abb40 --- /dev/null +++ b/.changeset/tool-media-lightbox.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": minor +--- + +web: Image and video tool results now open in a fullscreen preview on click, with zoom support for images. diff --git a/.changeset/tooltip-bubble-lazy-mount.md b/.changeset/tooltip-bubble-lazy-mount.md new file mode 100644 index 00000000000..82034b0a9bd --- /dev/null +++ b/.changeset/tooltip-bubble-lazy-mount.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Reduce memory and CPU usage when the app stays open for a long time. diff --git a/.changeset/turnfold-unmount-collapsed.md b/.changeset/turnfold-unmount-collapsed.md new file mode 100644 index 00000000000..c5c41a1a004 --- /dev/null +++ b/.changeset/turnfold-unmount-collapsed.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +web: Reduce memory usage and stutter during long sessions. diff --git a/apps/kimi-code/dist-web/assets/CodeBlockNode-ZZ-0lk3E.js b/apps/kimi-code/dist-web/assets/CodeBlockNode-BAtAs_qm.js similarity index 99% rename from apps/kimi-code/dist-web/assets/CodeBlockNode-ZZ-0lk3E.js rename to apps/kimi-code/dist-web/assets/CodeBlockNode-BAtAs_qm.js index 5265af7e2cc..accf625fd72 100644 --- a/apps/kimi-code/dist-web/assets/CodeBlockNode-ZZ-0lk3E.js +++ b/apps/kimi-code/dist-web/assets/CodeBlockNode-BAtAs_qm.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CTjtTfCD.js","assets/index-HRJ6xRtC.js","assets/index-vdPxBs-i.css"])))=>i.map(i=>d[i]); -import{bR as xi,cb as Si,bQ as zo,M as vl,bl as Ci,af as dl,bY as Mi,cc as Bi,b$ as ml,aU as O,c0 as Ei,c1 as Fi,c2 as Pi,a0 as Co,aD as Ho,bE as ae,az as Li,cd as hn,c8 as vt,aI as No,aL as G,s as bn,aw as It,au as mt,bk as V,ce as Mo,u as oe,I as To,A as Oi,bJ as Ut,aY as pt,bL as cl,v as b,t as ye,bB as fl,bb as Me,q as k,b7 as $i,cf as zi,cg as gn,ch as Hi,ci as Ni,cj as Ti,ck as Ri,as as j,cl as Bo,cm as Di,cn as Ai,co as jt,cp as Eo,bO as Ro,T as ji,G as qi,F as Fo,g as Wi,c7 as _i,b_ as Ii}from"./index-HRJ6xRtC.js";import{i as fe,t as yn}from"./safeRaf-DGuzXxDK.js";var wn=(x,M,w)=>new Promise((te,ne)=>{var we=E=>{try{r(w.next(E))}catch(z){ne(z)}},be=E=>{try{r(w.throw(E))}catch(z){ne(z)}},r=E=>E.done?te(E.value):Promise.resolve(E.value).then(we,be);r((w=w.apply(x,M)).next())});let Po=!1,qt=null,Wt=null,_t=null;function Ui(){return wn(this,null,function*(){if(_t)return _t;_t=wn(null,null,function*(){if(!Wt)try{if(Wt=(function(x){const M=x;if(typeof M?.useMonaco=="function")return M;const w=x?.default;return typeof w?.useMonaco=="function"?w:null})(yield xi(()=>import("./index-CTjtTfCD.js"),__vite__mapDeps([0,1,2]))),!Wt)return null}catch{return null}try{return yield(function(x){return wn(this,null,function*(){return Po?void 0:qt||(qt=wn(null,null,function*(){const w=globalThis?.MonacoEnvironment;w&&(typeof w.getWorker=="function"||typeof w.getWorkerUrl=="function")||typeof x?.preloadMonacoWorkers!="function"||(yield x.preloadMonacoWorkers()),Po=!0}).finally(()=>{qt=null}),qt)})})(Wt),Si(),Wt}catch{return null}});try{return yield _t}finally{_t=null}})}var Vi=Object.defineProperty,Gi=Object.defineProperties,Ji=Object.getOwnPropertyDescriptors,Lo=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,Oo=(x,M,w)=>M in x?Vi(x,M,{enumerable:!0,configurable:!0,writable:!0,value:w}):x[M]=w,I=(x,M)=>{for(var w in M||(M={}))Yi.call(M,w)&&Oo(x,w,M[w]);if(Lo)for(var w of Lo(M))Qi.call(M,w)&&Oo(x,w,M[w]);return x},Ce=(x,M)=>Gi(x,Ji(M)),q=(x,M,w)=>new Promise((te,ne)=>{var we=E=>{try{r(w.next(E))}catch(z){ne(z)}},be=E=>{try{r(w.throw(E))}catch(z){ne(z)}},r=E=>E.done?te(E.value):Promise.resolve(E.value).then(we,be);r((w=w.apply(x,M)).next())});const Xi={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},Ki={class:"flex items-center gap-0.5"},Zi=["aria-label"],er={class:"code-diff-stat removed"},tr={class:"code-diff-stat added"},nr=["aria-label"],lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},or={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ir=["aria-pressed"],rr={key:3,class:"relative"},ar=["aria-expanded"],ur=["disabled"],sr=["disabled"],dr=["disabled"],cr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},fr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},vr={class:"code-loading-placeholder"},mr={class:"sr-only","aria-live":"polite",role:"status"},pr=vl({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(x,{emit:M}){const w=x,te=M,ne=O(!1),we=O(null),be=O(null);function r(){vt(!0),ne.value=!ne.value,ne.value&&document.addEventListener("click",z,{once:!0,capture:!0})}function E(){vt(!0),ne.value=!1}function z(Y){var f,$;const yt=Y.target;(f=we.value)!=null&&f.contains(yt)||($=be.value)!=null&&$.contains(yt)?document.addEventListener("click",z,{once:!0,capture:!0}):E()}const ie=k(()=>w.showFontSizeButtons&&w.enableFontSizeControl||w.showExpandButton||w.isPreviewable&&w.showPreviewButton),{t:N}=ml(),ht=k(()=>w.showTooltips!==!1);function Ge(Y,f){ht.value&&_i(Y.currentTarget,f,"top",!1,void 0,w.isDark)}function Be(){ht.value&&vt()}function gt(Y){Ge(Y,w.copyText?N("common.copied")||"Copied":N("common.copy")||"Copy")}const pl=k(()=>{var Y,f;return!!Number.isFinite(w.codeFontSize)&&((Y=w.codeFontSize)!=null?Y:0)<=((f=w.codeFontMin)!=null?f:0)}),Vt=k(()=>!w.fontBaselineReady||w.codeFontSize===w.defaultCodeFontSize),Gt=k(()=>{var Y,f;return!!Number.isFinite(w.codeFontSize)&&((Y=w.codeFontSize)!=null?Y:0)>=((f=w.codeFontMax)!=null?f:100)});return(Y,f)=>(G(),oe(Fo,null,[w.showHeader?(G(),oe("div",Xi,[pt(Y.$slots,"header-left"),pt(Y.$slots,"header-right",{},()=>[b("div",Ki,[x.diffStats?(G(),oe("div",{key:0,class:"code-diff-stats","aria-label":x.diffStatsAriaLabel},[b("span",er,"-"+Me(x.diffStats.removed),1),b("span",tr,"+"+Me(x.diffStats.added),1)],8,Zi)):ye("",!0),w.showCopyButton?(G(),oe("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":x.copyText?V(N)("common.copied")||"Copied":V(N)("common.copy")||"Copy",onClick:f[0]||(f[0]=$=>te("copy")),onMouseenter:f[1]||(f[1]=$=>gt($)),onFocus:f[2]||(f[2]=$=>gt($)),onMouseleave:Be,onBlur:Be},[x.copyText?(G(),oe("svg",or,[...f[14]||(f[14]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(G(),oe("svg",lr,[...f[13]||(f[13]=[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),b("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,nr)):ye("",!0),w.showCollapseButton?(G(),oe("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":x.isCollapsed,onClick:f[3]||(f[3]=$=>te("toggleCollapse")),onMouseenter:f[4]||(f[4]=$=>Ge($,x.isCollapsed?V(N)("common.expand")||"Expand":V(N)("common.collapse")||"Collapse")),onFocus:f[5]||(f[5]=$=>Ge($,x.isCollapsed?V(N)("common.expand")||"Expand":V(N)("common.collapse")||"Collapse")),onMouseleave:Be,onBlur:Be},[(G(),oe("svg",{style:It({rotate:x.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...f[15]||(f[15]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ir)):ye("",!0),ie.value?(G(),oe("div",rr,[b("button",{ref_key:"moreBtnRef",ref:be,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":ne.value,"aria-haspopup":"true",onClick:Ro(r,["stop"]),onMouseenter:f[6]||(f[6]=$=>Ge($,V(N)("common.more")||"More")),onFocus:f[7]||(f[7]=$=>Ge($,V(N)("common.more")||"More")),onMouseleave:Be,onBlur:Be},[...f[16]||(f[16]=[qi('',1)])],40,ar),To(Wi,{name:"code-menu"},{default:Ut(()=>[ne.value?(G(),oe("div",{key:0,ref_key:"moreMenuRef",ref:we,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[w.showFontSizeButtons&&w.enableFontSizeControl?(G(),oe(Fo,{key:0},[b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:pl.value,onClick:f[8]||(f[8]=$=>{V(vt)(!0),te("decreaseFont")})},[f[17]||(f[17]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),b("span",null,Me(V(N)("common.fontSmaller")||"Font size −"),1)],8,ur),b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Vt.value,onClick:f[9]||(f[9]=$=>{V(vt)(!0),te("resetFont")})},[f[18]||(f[18]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),b("path",{d:"M3 3v5h5"})])],-1)),b("span",null,Me(V(N)("common.fontReset")||"Font size reset"),1)],8,sr),b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Gt.value,onClick:f[10]||(f[10]=$=>{V(vt)(!0),te("increaseFont")})},[f[19]||(f[19]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),b("span",null,Me(V(N)("common.fontLarger")||"Font size +"),1)],8,dr)],64)):ye("",!0),w.showExpandButton?(G(),oe("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:f[11]||(f[11]=$=>{E(),te("toggleExpand")})},[x.isExpanded?(G(),oe("svg",cr,[...f[20]||(f[20]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(G(),oe("svg",fr,[...f[21]||(f[21]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),b("span",null,Me(x.isExpanded?V(N)("common.collapse")||"Collapse":V(N)("common.expand")||"Expand"),1)])):ye("",!0),x.isPreviewable&&w.showPreviewButton?(G(),oe("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:f[12]||(f[12]=$=>{E(),te("preview")})},[f[22]||(f[22]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),b("circle",{cx:"12",cy:"12",r:"3"})])],-1)),b("span",null,Me(V(N)("common.preview")||"Preview"),1)])):ye("",!0)],512)):ye("",!0)]),_:1})])):ye("",!0)])])])):ye("",!0),cl(b("div",{class:mt(["code-block-shell-content",{"code-block-shell-content--collapsed":x.isCollapsed}])},[pt(Y.$slots,"default")],2),[[fl,!!x.stream||!x.loading]]),cl(b("div",vr,[pt(Y.$slots,"loading",{},()=>[f[23]||(f[23]=b("div",{class:"loading-skeleton"},[b("div",{class:"skeleton-line"}),b("div",{class:"skeleton-line"}),b("div",{class:"skeleton-line short"})],-1))])],512),[[fl,!x.stream&&x.loading]]),b("span",mr,Me(x.copyText?V(N)("common.copied")||"Copied":""),1)],64))}}),hr={class:"html-preview-frame__header"},gr={class:"html-preview-frame__title"},yr={class:"html-preview-frame__label"},wr=["sandbox","srcdoc"],br=zo(vl({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(x){const M=x,w=import.meta!==void 0&&!1;let te=null;const{t:ne}=ml(),we=k(()=>{const E=M.code||"",z=E.trim().toLowerCase();return z.startsWith(" +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DzfhniX8.js","assets/index-D-7nOosq.js","assets/index-DGHD7Bg9.css"])))=>i.map(i=>d[i]); +import{bR as xi,cb as Si,bQ as zo,M as vl,bl as Ci,af as dl,bY as Mi,cc as Bi,b$ as ml,aU as O,c0 as Ei,c1 as Fi,c2 as Pi,a0 as Co,aD as Ho,bE as ae,az as Li,cd as hn,c8 as vt,aI as No,aL as G,s as bn,aw as It,au as mt,bk as V,ce as Mo,u as oe,I as To,A as Oi,bJ as Ut,aY as pt,bL as cl,v as b,t as ye,bB as fl,bb as Me,q as k,b7 as $i,cf as zi,cg as gn,ch as Hi,ci as Ni,cj as Ti,ck as Ri,as as j,cl as Bo,cm as Di,cn as Ai,co as jt,cp as Eo,bO as Ro,T as ji,G as qi,F as Fo,g as Wi,c7 as _i,b_ as Ii}from"./index-D-7nOosq.js";import{i as fe,t as yn}from"./safeRaf-DGuzXxDK.js";var wn=(x,M,w)=>new Promise((te,ne)=>{var we=E=>{try{r(w.next(E))}catch(z){ne(z)}},be=E=>{try{r(w.throw(E))}catch(z){ne(z)}},r=E=>E.done?te(E.value):Promise.resolve(E.value).then(we,be);r((w=w.apply(x,M)).next())});let Po=!1,qt=null,Wt=null,_t=null;function Ui(){return wn(this,null,function*(){if(_t)return _t;_t=wn(null,null,function*(){if(!Wt)try{if(Wt=(function(x){const M=x;if(typeof M?.useMonaco=="function")return M;const w=x?.default;return typeof w?.useMonaco=="function"?w:null})(yield xi(()=>import("./index-DzfhniX8.js"),__vite__mapDeps([0,1,2]))),!Wt)return null}catch{return null}try{return yield(function(x){return wn(this,null,function*(){return Po?void 0:qt||(qt=wn(null,null,function*(){const w=globalThis?.MonacoEnvironment;w&&(typeof w.getWorker=="function"||typeof w.getWorkerUrl=="function")||typeof x?.preloadMonacoWorkers!="function"||(yield x.preloadMonacoWorkers()),Po=!0}).finally(()=>{qt=null}),qt)})})(Wt),Si(),Wt}catch{return null}});try{return yield _t}finally{_t=null}})}var Vi=Object.defineProperty,Gi=Object.defineProperties,Ji=Object.getOwnPropertyDescriptors,Lo=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Qi=Object.prototype.propertyIsEnumerable,Oo=(x,M,w)=>M in x?Vi(x,M,{enumerable:!0,configurable:!0,writable:!0,value:w}):x[M]=w,I=(x,M)=>{for(var w in M||(M={}))Yi.call(M,w)&&Oo(x,w,M[w]);if(Lo)for(var w of Lo(M))Qi.call(M,w)&&Oo(x,w,M[w]);return x},Ce=(x,M)=>Gi(x,Ji(M)),q=(x,M,w)=>new Promise((te,ne)=>{var we=E=>{try{r(w.next(E))}catch(z){ne(z)}},be=E=>{try{r(w.throw(E))}catch(z){ne(z)}},r=E=>E.done?te(E.value):Promise.resolve(E.value).then(we,be);r((w=w.apply(x,M)).next())});const Xi={key:0,class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},Ki={class:"flex items-center gap-0.5"},Zi=["aria-label"],er={class:"code-diff-stat removed"},tr={class:"code-diff-stat added"},nr=["aria-label"],lr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},or={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},ir=["aria-pressed"],rr={key:3,class:"relative"},ar=["aria-expanded"],ur=["disabled"],sr=["disabled"],dr=["disabled"],cr={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},fr={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},vr={class:"code-loading-placeholder"},mr={class:"sr-only","aria-live":"polite",role:"status"},pr=vl({__name:"CodeBlockShell",props:{showHeader:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},showPreviewButton:{type:Boolean,default:!0},showTooltips:{type:Boolean,default:!0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},stream:{type:Boolean,default:!1},isCollapsed:{type:Boolean,default:!1},isExpanded:{type:Boolean,default:!1},copyText:{type:Boolean,default:!1},isPreviewable:{type:Boolean,default:!1},codeFontSize:{},codeFontMin:{},codeFontMax:{},defaultCodeFontSize:{},fontBaselineReady:{type:Boolean,default:!1},diffStats:{},diffStatsAriaLabel:{}},emits:["toggleCollapse","decreaseFont","resetFont","increaseFont","copy","toggleExpand","preview"],setup(x,{emit:M}){const w=x,te=M,ne=O(!1),we=O(null),be=O(null);function r(){vt(!0),ne.value=!ne.value,ne.value&&document.addEventListener("click",z,{once:!0,capture:!0})}function E(){vt(!0),ne.value=!1}function z(Y){var f,$;const yt=Y.target;(f=we.value)!=null&&f.contains(yt)||($=be.value)!=null&&$.contains(yt)?document.addEventListener("click",z,{once:!0,capture:!0}):E()}const ie=k(()=>w.showFontSizeButtons&&w.enableFontSizeControl||w.showExpandButton||w.isPreviewable&&w.showPreviewButton),{t:N}=ml(),ht=k(()=>w.showTooltips!==!1);function Ge(Y,f){ht.value&&_i(Y.currentTarget,f,"top",!1,void 0,w.isDark)}function Be(){ht.value&&vt()}function gt(Y){Ge(Y,w.copyText?N("common.copied")||"Copied":N("common.copy")||"Copy")}const pl=k(()=>{var Y,f;return!!Number.isFinite(w.codeFontSize)&&((Y=w.codeFontSize)!=null?Y:0)<=((f=w.codeFontMin)!=null?f:0)}),Vt=k(()=>!w.fontBaselineReady||w.codeFontSize===w.defaultCodeFontSize),Gt=k(()=>{var Y,f;return!!Number.isFinite(w.codeFontSize)&&((Y=w.codeFontSize)!=null?Y:0)>=((f=w.codeFontMax)!=null?f:100)});return(Y,f)=>(G(),oe(Fo,null,[w.showHeader?(G(),oe("div",Xi,[pt(Y.$slots,"header-left"),pt(Y.$slots,"header-right",{},()=>[b("div",Ki,[x.diffStats?(G(),oe("div",{key:0,class:"code-diff-stats","aria-label":x.diffStatsAriaLabel},[b("span",er,"-"+Me(x.diffStats.removed),1),b("span",tr,"+"+Me(x.diffStats.added),1)],8,Zi)):ye("",!0),w.showCopyButton?(G(),oe("button",{key:1,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-label":x.copyText?V(N)("common.copied")||"Copied":V(N)("common.copy")||"Copy",onClick:f[0]||(f[0]=$=>te("copy")),onMouseenter:f[1]||(f[1]=$=>gt($)),onFocus:f[2]||(f[2]=$=>gt($)),onMouseleave:Be,onBlur:Be},[x.copyText?(G(),oe("svg",or,[...f[14]||(f[14]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(G(),oe("svg",lr,[...f[13]||(f[13]=[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),b("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,nr)):ye("",!0),w.showCollapseButton?(G(),oe("button",{key:2,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] disabled:opacity-40 disabled:cursor-not-allowed transition-colors","aria-pressed":x.isCollapsed,onClick:f[3]||(f[3]=$=>te("toggleCollapse")),onMouseenter:f[4]||(f[4]=$=>Ge($,x.isCollapsed?V(N)("common.expand")||"Expand":V(N)("common.collapse")||"Collapse")),onFocus:f[5]||(f[5]=$=>Ge($,x.isCollapsed?V(N)("common.expand")||"Expand":V(N)("common.collapse")||"Collapse")),onMouseleave:Be,onBlur:Be},[(G(),oe("svg",{style:It({rotate:x.isCollapsed?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...f[15]||(f[15]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,ir)):ye("",!0),ie.value?(G(),oe("div",rr,[b("button",{ref_key:"moreBtnRef",ref:be,type:"button",class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0 cursor-pointer text-[var(--code-action-fg)] hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] active:scale-[0.96] transition-colors","aria-expanded":ne.value,"aria-haspopup":"true",onClick:Ro(r,["stop"]),onMouseenter:f[6]||(f[6]=$=>Ge($,V(N)("common.more")||"More")),onFocus:f[7]||(f[7]=$=>Ge($,V(N)("common.more")||"More")),onMouseleave:Be,onBlur:Be},[...f[16]||(f[16]=[qi('',1)])],40,ar),To(Wi,{name:"code-menu"},{default:Ut(()=>[ne.value?(G(),oe("div",{key:0,ref_key:"moreMenuRef",ref:we,class:"code-more-menu min-w-[10rem] p-1 bg-[hsl(var(--ms-popover))] text-[hsl(var(--ms-popover-foreground))] border border-[var(--code-border)] shadow-[var(--ms-shadow-popover)]",role:"menu"},[w.showFontSizeButtons&&w.enableFontSizeControl?(G(),oe(Fo,{key:0},[b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:pl.value,onClick:f[8]||(f[8]=$=>{V(vt)(!0),te("decreaseFont")})},[f[17]||(f[17]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14"})],-1)),b("span",null,Me(V(N)("common.fontSmaller")||"Font size −"),1)],8,ur),b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Vt.value,onClick:f[9]||(f[9]=$=>{V(vt)(!0),te("resetFont")})},[f[18]||(f[18]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("path",{d:"M3 12a9 9 0 1 0 9-9a9.75 9.75 0 0 0-6.74 2.74L3 8"}),b("path",{d:"M3 3v5h5"})])],-1)),b("span",null,Me(V(N)("common.fontReset")||"Font size reset"),1)],8,sr),b("button",{type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] disabled:opacity-40 disabled:cursor-not-allowed transition-colors",disabled:Gt.value,onClick:f[10]||(f[10]=$=>{V(vt)(!0),te("increaseFont")})},[f[19]||(f[19]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14m-7-7v14"})],-1)),b("span",null,Me(V(N)("common.fontLarger")||"Font size +"),1)],8,dr)],64)):ye("",!0),w.showExpandButton?(G(),oe("button",{key:1,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:f[11]||(f[11]=$=>{E(),te("toggleExpand")})},[x.isExpanded?(G(),oe("svg",cr,[...f[20]||(f[20]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(G(),oe("svg",fr,[...f[21]||(f[21]=[b("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])])),b("span",null,Me(x.isExpanded?V(N)("common.collapse")||"Collapse":V(N)("common.expand")||"Expand"),1)])):ye("",!0),x.isPreviewable&&w.showPreviewButton?(G(),oe("button",{key:2,type:"button",role:"menuitem",class:"flex items-center gap-2 w-full py-1.5 px-2 rounded text-xs text-[var(--code-action-fg)] cursor-pointer whitespace-nowrap hover:bg-[var(--code-action-hover-bg)] hover:text-[var(--code-action-hover-fg)] transition-colors",onClick:f[12]||(f[12]=$=>{E(),te("preview")})},[f[22]||(f[22]=b("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[b("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[b("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),b("circle",{cx:"12",cy:"12",r:"3"})])],-1)),b("span",null,Me(V(N)("common.preview")||"Preview"),1)])):ye("",!0)],512)):ye("",!0)]),_:1})])):ye("",!0)])])])):ye("",!0),cl(b("div",{class:mt(["code-block-shell-content",{"code-block-shell-content--collapsed":x.isCollapsed}])},[pt(Y.$slots,"default")],2),[[fl,!!x.stream||!x.loading]]),cl(b("div",vr,[pt(Y.$slots,"loading",{},()=>[f[23]||(f[23]=b("div",{class:"loading-skeleton"},[b("div",{class:"skeleton-line"}),b("div",{class:"skeleton-line"}),b("div",{class:"skeleton-line short"})],-1))])],512),[[fl,!x.stream&&x.loading]]),b("span",mr,Me(x.copyText?V(N)("common.copied")||"Copied":""),1)],64))}}),hr={class:"html-preview-frame__header"},gr={class:"html-preview-frame__title"},yr={class:"html-preview-frame__label"},wr=["sandbox","srcdoc"],br=zo(vl({__name:"HtmlPreviewFrame",props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(x){const M=x,w=import.meta!==void 0&&!1;let te=null;const{t:ne}=ml(),we=k(()=>{const E=M.code||"",z=E.trim().toLowerCase();return z.startsWith(" diff --git a/apps/kimi-code/dist-web/assets/DesignSystemView-BOD_23qT.js b/apps/kimi-code/dist-web/assets/DesignSystemView-BOD_23qT.js deleted file mode 100644 index cc3248ddad8..00000000000 --- a/apps/kimi-code/dist-web/assets/DesignSystemView-BOD_23qT.js +++ /dev/null @@ -1,13 +0,0 @@ -import{M as T,aD as z,aI as q,aL as o,u as i,v as t,G as d,H as e,F as p,aX as w,bb as y,I as c,bk as f,cx as h,cy as B,cz as k,cA as A,cB as M}from"./index-HRJ6xRtC.js";const I={class:"ds-page"},V={class:"layout"},H={class:"content"},L={class:"content-inner"},E={id:"tokens"},D={class:"icon-sizes"},O={class:"sz"},W={class:"p-ic",style:{width:"14px",height:"14px"},viewBox:"0 0 24 24",fill:"currentColor"},R={class:"sz"},N={class:"p-ic",style:{width:"16px",height:"16px"},viewBox:"0 0 24 24",fill:"currentColor"},U={class:"sz"},P={class:"p-ic",style:{width:"20px",height:"20px"},viewBox:"0 0 24 24",fill:"currentColor"},F={class:"icon-grid"},j={class:"icon-group-label"},K={class:"ic-name"},G={id:"primitives"},_={class:"stage-wrap"},J={class:"stage p"},Q={class:"p-pill",style:{color:"var(--p-warning)"}},Y={class:"stage-wrap"},Z={class:"stage p col"},X={class:"demo-row"},$={class:"p-btn primary disabled"},aa={class:"p-spinner sm",viewBox:"0 0 24 24",style:{"--p-accent":"#fff","--p-line":"rgba(255,255,255,.35)"}},ta={class:"stage-wrap"},da={class:"stage p col"},ea={class:"demo-row"},sa={class:"stage-wrap"},oa={class:"stage p col",style:{gap:"0",background:"var(--p-surface)",padding:"0","max-width":"300px","align-items":"stretch"}},ia={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},na={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},la={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},ra={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},ca={id:"chat"},va={class:"stage-wrap"},fa={class:"stage p col"},pa={style:{"max-width":"560px",width:"100%"}},ha={class:"stage-wrap"},ua={class:"stage p col",style:{"align-items":"center",background:"#fff"}},ga={class:"p-composer",style:{width:"100%","max-width":"620px"}},ba={class:"p-composer-bar"},ma={class:"p-composer-left"},wa={class:"p-pill",style:{color:"var(--p-warning)"}},ya="/repo",ka=T({__name:"DesignSystemView",emits:["close"],setup(xa,{emit:x}){const C=[{path:"/repo/apps/web/src/components/chat/TurnFilesSummary.vue",added:19,removed:4,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/composables/useFilePreview.ts",added:8,removed:1,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/components/chatTurnRendering.ts",added:0,removed:0,hasWrite:!0,statsIncomplete:!0,diff:null},{path:"/repo/apps/web/src/lib/toolDiff.ts",added:3,removed:2,hasWrite:!1,statsIncomplete:!1,diff:null}];function u(){}const S=x;function g(){S("close")}let v=null;function b(r){r.key==="Escape"&&g()}return z(()=>{document.addEventListener("keydown",b);const r=Array.prototype.slice.call(document.querySelectorAll('#nav a[href^="#"]')),a=new Map;r.forEach(l=>{const s=l.getAttribute("href");if(!s)return;const m=document.getElementById(s.slice(1));m&&a.set(m,l)});let n=null;v=new IntersectionObserver(l=>{l.forEach(s=>{s.isIntersecting&&(n&&n.classList.remove("active"),n=a.get(s.target)??null,n&&n.classList.add("active"))})},{rootMargin:"-20% 0px -70% 0px",threshold:0}),a.forEach((l,s)=>v.observe(s)),r.length&&r[0].classList.add("active")}),q(()=>{document.removeEventListener("keydown",b),v&&(v.disconnect(),v=null)}),(r,a)=>(o(),i("div",I,[t("div",{class:"ds-topbar"},[t("button",{class:"ds-back",type:"button",onClick:g},"← Back"),a[0]||(a[0]=t("span",{class:"ds-topbar-title"},"Design system",-1))]),t("div",V,[a[44]||(a[44]=d('

',1)),t("main",H,[t("div",L,[a[42]||(a[42]=d('
● Design System · v1.0

Kimi Web Design System

This document defines the visual language and component specification for Kimi Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

Scope apps/kimi-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
i
This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
01

Design Principles

Every UI decision traces back to the following principles. Kimi Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

  • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
  • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
  • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
  • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
  • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
  • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
  • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
i
Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
',2)),t("section",E,[a[7]||(a[7]=d(`
02

Design Tokens

Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

i
Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

Color

Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

i
The table below shows the semantic tokens. Each ships a light value in :root and a dark override in the data-color-scheme blocks — for example --color-bg is #ffffff in light and #121212 in dark; --color-accent is the brand blue (#1783ff light / #1a88ff dark). The semantic status colors (success / warning / danger / info) are independent palettes, one set each for light / dark.
bg
#ffffff / #121212
surface
#f5f5f5 / #1f1f1f
surface-sunken
#f5f5f5 / #121212
well
#f5f5f5 / #1f1f1f
surface-deep
#f5f5f5 / #0d0d0d
surface-overlay
#ffffff / rgba(255,255,255,.1)
selected
rgba(0,0,0,.05) / rgba(255,255,255,.1)
fg
rgba(0,0,0,.9) / rgba(255,255,255,.84)
fg-muted
rgba(0,0,0,.6) / rgba(255,255,255,.56)
line
rgba(0,0,0,.13) / rgba(255,255,255,.12)
subtle
rgba(0,0,0,.05) / rgba(255,255,255,.05)
accent (KMBlue)
#1783ff / #1a88ff
accent-soft
#e8f3ff / rgba(26,136,255,.1)
TokenLightDarkUsage
--color-bg#ffffff#121212Page background
--color-surface#f5f5f5#1f1f1fPanel / sidebar / card head
--color-surface-raised#ffffff#292929Raised card / dialog / input
--color-menu-bgrgba(255,255,255,.95)rgba(41,41,41,.95)Floating menu panel — frosted glass over --p-menu-backdrop blur
--color-surface-overlay#ffffffrgba(255,255,255,.1)Field-control fill on raised cards (selects, steppers) — top rung; light tops out at white (the level is carried by the border), dark steps one rung above raised. Floating layers stay at raised
--color-well#f5f5f5#1f1f1fContent well on the page (code blocks, tool-output panels, match/file lists, media thumbnails) — light reuses the sunken recess; dark lifts one rung ABOVE the page, because a true recess (#121212) vanishes into the page there
--color-surface-deep#f5f5f5#0d0d0dDeep chrome plane one step BELOW the page (panel headers, diff gutters) — dark drops under --color-bg so chrome framing stays darker than the content it frames
--color-textrgba(0,0,0,.9)rgba(255,255,255,.84)Body text / headings
--color-text-strong#000000#ffffffMax foreground emphasis — menu-row label & icon on hover
--color-text-mutedrgba(0,0,0,.6)rgba(255,255,255,.56)Secondary text / placeholder
--color-linergba(0,0,0,.13)rgba(255,255,255,.12)Divider / card border
--color-subtlergba(0,0,0,.05)rgba(255,255,255,.05)Subtle hairline — tertiary separators below --color-line (diff-gutter column rules, quiet dividers inside wells)
--color-selectedrgba(0,0,0,.05)rgba(255,255,255,.1)Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
--color-hoverrgba(0,0,0,.03)rgba(255,255,255,.05)Row hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface. The global hover rule: transparent-base controls overlay this f1 wash (hover never darkens — never sunken); filled controls use their own hover token (accent-hover, send-bg-hover)
--color-inline-code-bgrgba(0,0,0,.03)rgba(255,255,255,.1)Inline-code chip fill — fills.f1 / fills.f2; dark lifts off any dark surface (sunken == bg there)
--color-media-alpha-bg-1≈#858585≈#76797eCheckerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
--color-media-alpha-bg-2≈#6b6b6b≈#8c8f93Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
--color-sidebar-bg#f9fbfc#0d0d0dSidebar surface — one step off --color-bg (just under white in light, one step BELOW the page in dark) so the session column reads as its own plane and never brighter than the reading surface
--color-scrimrgba(0,0,0,.4)rgba(0,0,0,.6)Modal scrim — the dark veil behind dialogs/lightboxes (mask.base; legacy hardcoded overlays can migrate here)
--color-scrim-strongrgba(0,0,0,.6)rgba(0,0,0,.75)Stronger scrim for full-screen media previews (mask.strong — the PhotoSwipe image preview backdrop)
--color-text-on-scrim#ffffffsameText drawn on the scrim (captions over the media lightbox)
--color-accent#1783ff#1a88ffPrimary action / link / focus
--color-success#0e7a38#3fb950Success / pass
--color-warning#a9610a#d29922Warning / pending
--color-danger#c0392b#f85149Danger / error / abort

Palette

The palette is the production kimi.com palette (design tokens tokens.json): neutral-gray surfaces, an alpha-based label / fill / separator ramp (labels.* / fills.* / separator.s1), the KMBlue accent, and a true neutral dark ladder (#121212 → #1f1f1f → #292929; the deep chrome plane and sidebar derive one step below at #0d0d0d — the palette has nothing darker than primary).

The ONE deliberate exception is the status hues: success / warning / danger / done keep the app's own WCAG-tuned ramp (≥4.5:1 on the neutral surfaces) — the production status colours (positiveGreen #16c456, orange #ff9500, danger red #ff3849) are too bright against it. Diff add/del bands happen to coincide (both use the production 25% fills in light, 14% in dark).

Surface usage

The surface layers each have a role — choose by "field overlay / raised layer / content well / default flat layer / sunken layer / page background / deep chrome", and avoid treating --p-surface-raised as a universal background. In dark, elevation = lighter: floating layers sit above the content, content wells sit above the page, and chrome planes (sidebar, panel headers) sit below it — never the reverse. One consequence: on the page itself, never use --color-surface-sunken for a content carrier — it equals --color-bg in dark and the fill vanishes; use --color-well. Sunken stays correct INSIDE surface / raised cards, where it is a genuine recess. Field controls (selects, steppers) on a raised card use --color-surface-overlay, the top fill rung; floating layers keep --color-surface-raised — their elevation is shadow + hairline, not a lighter fill.

TokenLightDarkUsage
--p-surface-overlay#ffffff#22272eField controls on raised cards — select, stepper (top fill rung; light = white)
--p-surface-raised#ffffff#1c2128Raised card / dialog / input (raised layer)
--p-well#f3f5f8#13181eCode block / tool output / list carrier directly on the page (content well — light: recessed, dark: one rung above the page)
--p-surface#fafbfc#13181ePanel / sidebar / card head (default flat layer)
--p-surface-sunken#f3f5f8#0d1117Recessed area INSIDE a surface / raised card — never a content carrier on the page (sunken layer)
--p-bg#ffffff#0d1117Page background
--p-surface-deep#fafbfc#0a0d12Panel header / diff gutter (deep chrome layer — below the page in dark)

Borders & hairlines

Three line tokens, three jobs: --color-line is the default structural separator, --color-subtle the tertiary separator that must stay quieter (diff-gutter column rules, quiet dividers inside wells), and --color-line-strong the edge of interactive controls (inputs, selects, secondary buttons). Width is one: 0.5px — every stroke is the same hairline, on static structural edges (card rims, plane seams, header dividers), interactive control rims and floating layers alike. Separation comes from luminance first — planes one rung apart already read as distinct in dark, so their shared edge stays a 0.5px hairline rather than a heavier border; same-rung neighbours (list rows, card head / body) are exactly where a hairline is required. In dark, drop shadows fade on near-black surfaces, so a floating layer's edge IS its hairline — never ship a shadow-only floating surface. (Legacy --line / --line2 alias --color-line / --color-subtle for one cycle; new work references the v2 names.)

Focus ring

All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

TokenValueUsage
--p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
--p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

Text selection

The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

Disabled state

All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

Font families

Kimi Web uses two font tokens: --font-ui (UI and body, with Schibsted Grotesk for Latin and Noto Sans SC for Simplified Chinese) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

--font-ui · UI & body (Schibsted Grotesk + Noto Sans SC)

Body and UI use self-hosted Schibsted Grotesk for Latin text and self-hosted Noto Sans SC Variable for Simplified Chinese. Platform fonts remain as fallbacks:

--font-ui
--font-ui: "Schibsted Grotesk Variable", "Helvetica Neue", Arial,
-      "Noto Sans SC Variable", "Noto Sans SC", "PingFang SC",
-      "Microsoft YaHei",
-      -apple-system, BlinkMacSystemFont, "Segoe UI",
-      Roboto, Ubuntu, sans-serif,
-      "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  • Schibsted Grotesk first: self-hosted Latin UI and body text, with normal and italic variable faces.
  • Western fallbacks next: Helvetica Neue / Arial for environments where Schibsted Grotesk cannot load.
  • Noto Sans SC Variable next: bundled Simplified Chinese glyphs with a weight range of 100–900.
  • System UI fallbacks last: PingFang SC / Microsoft YaHei, platform UI fonts, and emoji fonts.

--font-mono · Code & monospace

Code, line numbers, diffs, and Bash commands use JetBrains Mono (a self-hosted variable font), falling back to the system monospace. Other tool labels and summaries use the UI font:

--font-mono
--font-mono: "JetBrains Mono Variable", "JetBrains Mono",
-      ui-monospace, "SF Mono", Menlo, Consolas, monospace;

Loading strategy

FontSourceBundledUsage
JetBrains Mono@fontsource-variable/jetbrains-mono✓ self-hostedmonospace / code (--font-mono)
Schibsted Groteskprepare-fonts → web-ui/assets/fonts✓ generated + bundledUI / body / display (--font-ui, --font-display), wght 400-900, normal + italic
Noto Sans SCprepare-fonts → web-ui/assets/fonts✓ generated + bundledSimplified Chinese UI / body, wght 100–900
System UI / CJK fontsoperating systemlate fallback for UI / body
Schibsted Grotesk, Noto Sans SC, and JetBrains Mono are self-hosted. They make no external network requests and work offline; platform fonts remain as fallbacks.

Usage rules

  • Components always use var(--font-ui) / var(--font-mono); do not hard-code font names like 'Schibsted Grotesk' / 'JetBrains Mono'.
  • Body / UI use --font-ui (Schibsted Grotesk for Latin, Noto Sans SC for Simplified Chinese); code / monospace use --font-mono (JetBrains Mono).
  • Schibsted Grotesk is loaded from complete variable faces, including normal and italic styles; font-optical-sizing: auto is enabled globally.
  • Noto Sans SC is loaded from one complete weight-variable WOFF2 asset. Platform CJK fonts stay late in the fallback chain.

Type scale & weight

The user font-size preference is one of four named steps (small / medium / large / xlarge, Medium default) written to data-font-scale on <html>; the step name is persisted, never a px value. The step only moves --base-font; every size token derives additively (default + shift), and line heights are locked to integer px via round(size × ratio, 1px) — never a unitless ratio.

Two token groups share the shift but keep their own ratios: --ui-* for chrome (tight, 1.40–1.50) and --md-* for Markdown content + the composer (loose, 1.56–1.63; body is anchored to the UI body size — the spec's +2px offset was dropped as a product decision — while keeping its own looser line-height ratios). T0/T1 cap at 24/22px on the top steps (built into the tokens via min() — do not remove). Use the .text-ui-* / .text-md-* utility classes; legacy aliases --ui-font-size (→ --ui-b2), --content-font-size (→ --md-b1) and the whole 6-level --text-* ramp (xs→c1, sm→b2−1px, base→b2, lg→t2, xl→t1, 2xl→t0) keep older components on the ramp. Panel titles sit at the base step (--ui-b2); dropdown menu items sit one rung below (--text-sm = b2 − 1px) — both still follow the user's font scale.

Section Title
--ui-t1 · title (cap 22)
Card title
--ui-t2 · subtitle
UI emphasis
--ui-b1 · body strong
UI control / button / form
--ui-b2 · body
Helper text / table
--ui-c1 · caption
Badge / timestamp
--ui-c2 · non-critical only
Markdown H1
--md-h1
Chat body / message bubbles / composer
--md-b1 · prose body
Quote / table
--md-b2 · secondary
Code block / inline code
--md-b3 · weak / code

The fixed product type tokens still define scale-independent defaults: transcript prose enables text-autospace: normal for mixed CJK and Latin text. Drop stray font-weight: 650 / 750; converge on 400 / 500 (regular / emphasis), with a dedicated 600 weight for sidebar section labels.

TokenValueUsage
--font-ui"Schibsted Grotesk Variable", …, "Noto Sans SC Variable", …UI & body (Schibsted Grotesk + Noto Sans SC)
--font-kbd"Schibsted Grotesk Variable", system-ui, sans-serifkeyboard shortcut keycaps
--font-monoJetBrains Mono…code, Bash commands, line numbers, diffs
data-font-scalesmall / medium / large / xlargeuser preference on <html>; sets --base-font (12–18px), Medium = 14px default
--ui-t0…--ui-c2default + --ui-shift, t0/t1 capped via min()chrome type ramp (title / subtitle / body / caption); .text-ui-* classes
--md-h1…--md-b3default + --md-shiftMarkdown ramp (headings / body / secondary / code); .text-md-* classes
--ui-font-size / --content-font-sizevar(--ui-b2) / var(--md-b1)legacy aliases kept on the ramp
--code-font-sizecalc(var(--content-font-size) - 2px)standalone code surfaces (diff view, file preview, tool cards) — one step below body, 12px @ Medium; prose-embedded code stays on the --md-* ramp
--text-xs / sm / base / lg / xl / 2xlc1 / b2−1 / b2 / t2 / t1 / t0legacy ramp, aliased into the scale
--leading-tight/normal/prose/relaxed1.25 / 1.5 / 1.6 / 1.7headings / UI / chat prose / long text
--weight-regular/option-label/medium/ui-strong400 / 475 / 500 / 525body / settings labels / emphasis / compact UI emphasis
--weight-section-label600sidebar section labels

Icon size

Icons use three size tokens uniformly. The global .p-ic default is 16px (--p-ic-md); components pick as needed, and random pixel sizes are forbidden.

TokenValueUsage
--p-ic-sm14pxsmall button, badge, menu item, inline link icon
--p-ic-md16pxdefault (button, icon button, toolbar)
--p-ic-lg20pxToast status icon, empty-state illustration

Icon

Icons always come from the centralized registry lib/icons.ts: in templates use the <Icon name size /> component (components/ui/Icon.vue); for v-html contexts (such as a tool glyph) use iconSvg(name, size). Do not hand-write <svg> — the scripts/check-style.mjs icon-from-registry rule flags stray SVGs. Every glyph shares the 24×24 source grid and currentColor (colour follows text); size uses the three tokens below, and only icons imported in lib/icons.ts are bundled by unplugin-icons at build time. Three collections feed the registry, in this order of preference: ~icons/kimi/* — Kimi Design System icons (24×24 outlined, 1.8px stroke), local SVGs under src/icons/kimi/ registered as a custom collection in the Vite config, used whenever a Kimi glyph exists for the intent; ~icons/tabler/* — Tabler Icons (MIT), for the few gaps it uniquely covers (today: the right-panel toggle); and ~icons/ri/*Remix Icon (Apache-2.0), for the remaining intents the Kimi set does not cover yet. A few glyphs are filed under their intent rather than the upstream asset name (see the lib/icons.ts header). When an icon is missing, prefer a glyph from the Kimi icon set: copy the SVG into src/icons/kimi/ (kebab-case name, monochrome currentColor) and register it — two static imports (component + ?raw string) plus one entry in ICONS; reach for Remix only when no Kimi glyph fits, and never draw paths in a component.

Size scale

`,49)),t("div",D,[t("div",O,[(o(),i("svg",W,[...a[1]||(a[1]=[t("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),a[2]||(a[2]=e("sm · 14",-1))]),t("div",R,[(o(),i("svg",N,[...a[3]||(a[3]=[t("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),a[4]||(a[4]=e("md · 16",-1))]),t("div",U,[(o(),i("svg",P,[...a[5]||(a[5]=[t("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),a[6]||(a[6]=e("lg · 20",-1))])]),a[8]||(a[8]=t("h4",{class:"mini"},"Icon library",-1)),a[9]||(a[9]=t("p",null,[e("Currently registered icons, grouped by purpose. The display order and grouping are defined by "),t("code",null,"ICON_GROUPS"),e(" in "),t("code",null,"lib/icons.ts"),e(" (a hand-maintained array covering the same icon names), and this catalog is rendered directly from that array so the registry and the document never drift.")],-1)),t("div",F,[(o(!0),i(p,null,w(f(B),([n,l])=>(o(),i(p,{key:n},[t("div",j,y(n),1),(o(!0),i(p,null,w(l,s=>(o(),i("div",{key:s,class:"icon-cell"},[c(f(h),{name:s},null,8,["name"]),t("span",K,y(s),1)]))),128))],64))),128))]),a[10]||(a[10]=d('

Do not use emoji as functional icons. The Kimi brand mark (the robot mascot logo) is a brand asset and is not part of this icon system.

A few special graphics are not in the registry; each has a dedicated component maintained in one place, and must not be copied by hand: <ContextRing :pct /> (the Composer context progress ring, data-driven), <AuthStateIcon kind /> (the success / expired / error colored illustrations in the login flow), <Spinner /> (loading state). Status dots (such as in the Provider list) always use CSS dots (border-radius:50%), not SVG. The scripts/check-style.mjs icon-from-registry rule exempts the above and the brand mark; all other hand-written <svg> is flagged.

Spacing

A 4px base grid. All spacing, gaps, and padding inside and outside components come from this scale — no arbitrary pixels.

--space-1 · 4
icon gap, badge padding
--space-2 · 8
control gap, small padding
--space-3 · 12
button padding, form-item gap
--space-4 · 16
card padding, grid gap
--space-5 · 20
dialog padding
--space-6 · 24
section gap
--space-8 · 32
large section gap

Dense list (sidebar / file tree)

High-density navigation lists like the sidebar share one rhythm, all on the 4px grid: in-row vertical padding --space-1 (4px), no margin between rows (the hover pill provides the separation); section gap (between logo / search / action buttons / group title / list) uniformly --space-2 (8px); between groups --space-2; the brand header is slightly looser at the top (--space-3). When building similar lists, reuse this scale — do not hand-write 1/6/7/10px.

Radius

Merge the existing 14 values into the nearest of 7 scale steps. Rule: the component type determines the radius, not the author's feel. The Composer shell is the sole product-specific exception: its 32px radius pairs with superellipse(1.5) so the flatter curve stays visually concentric with its controls.

xs · 4
sm · 6
md · 8
lg · 12
xl · 16
2xl · 20
composer · 32 / 1.5
full · 999
TokenValueUsageMerged from
--radius-xs4pxsmall badge, inline tag2/3/4px →
--radius-sm6pxsmall button, icon button, menu item5/6px →
--radius-md8pxbutton, input, badge, card7/8/9px →
--radius-lg12pxmenu, toast, bubble, floating card10/12px →
--radius-xl16pxcontainer baseline: dialogs, settings cards, sheets, work panel13/16px →
--radius-2xl20pxworkspace attachment card bottom (0 0 2xl 2xl) tucked under the composer18/20px →
--radius-composer32pxComposer shell, with --corner-shape-composerproduct-specific
--radius-full999pxpill badge, avatar, send button999px / 50%

Elevation & z-index

Shadows express only "elevation", never decoration (no colored glow). z-index is unified into a scale, eradicating 9999-style one-upping.

sm · dropdown menu / sticky
md · Toast
lg · overlay (reserved)
xl · dialog
Z-index TokenValueUsage
--z-base0normal flow
--z-sticky100sticky header / sidebar
--z-dropdown200dropdown menu / tooltip
--z-overlay300overlay / bottom Sheet
--z-modal400dialog — sibling overlays tie-break by DOM order, so the global confirm (ConfirmDialogHost) mounts on demand to always land last / on top
--z-modal-dropdown500menus / popovers that open above a modal dialog (teleported to <body>, e.g. the settings SecondaryModelPicker cascade)
--z-toast600toast
--z-max9999reserved: only this tier for extreme fallback

Motion

TokenValueUsage
--ease-outcubic-bezier(0.16, 1, 0.3, 1)enter, hover, expand
--ease-in-outcubic-bezier(0.4, 0, 0.2, 1)panel width, layout changes
--duration-fast120mspress, focus
--duration-base160mshover, show/hide
--duration-slow260msdialog, Sheet, layout
--duration-hover-intent250mshover-intent reveal gate (TOC rail)
--anim-rive-spin416.7msnew-chat / folder-plus icon: plus spin on hover
--anim-leftbar533.3mssidebar toggle icon: arrow fly-in on hover
--anim-leftbar-shrink200mssidebar toggle icon: divider shrink on hover

The --anim-* lengths are track timings ported verbatim from the designer's Rive exports, so they sit outside the --duration-* ramp on purpose — retiming the ramp must not distort them. Their interpolation stays linear because the easing is already baked into the dense keyframe stops; a token easing would double-apply. Three hover tracks use them today: the sidebar toggle shrinks its divider to half height while an arrow flies in and settles (the expand variant mirrors the track from the left), and the new-chat / folder-plus pluses do one bouncy spin. Each track is keyed to an id inside its own glyph (#bar-divider, #bar-arrow / #bar-arrow-expand, #p1, #af-p1) so every instance of the icon animates, and all revert on mouse-out. They still fall under the global reduced-motion switch below.

Reduced motion

i
Under @media (prefers-reduced-motion: reduce), all animation and transition durations drop to about 0.001ms (effectively off), and the chat working indicator's mascot renders its static fallback instead of the Rive loop. Components should not check this individually; it is handled uniformly in the global styles. The switch clears durations, not transition-delay: a hover-intent gate (the conversation TOC's 250ms reveal) decides whether hidden content appears, and clearing it would make pointer fly-bys strobe content for reduced-motion users.

Layout & breakpoints

Layout sizes and responsive breakpoints are tokenized too: sidebar width, content reading-column width, and two global breakpoints. Components should not hard-code pixels.

TokenValueUsage
--p-sidebar-w264pxleft session sidebar width
--p-content-max760pxchat reading-column max width (regular chat prose)
--p-content-wide920pxwide content (settings / panel)
--p-table-max1040pxdesktop wide-table max width (see §04)
--p-table-cell-max700pxmax width of a single table column; longer cell content wraps (see §04)
--p-bp-sm640pxmobile / desktop boundary
--p-bp-md980pxnarrow / wide screen boundary
i
At ≤640px: dialogs become bottom Sheets, the sidebar collapses into an expandable drawer, and Composer toolbar controls are allowed to wrap.
',24))]),t("section",G,[a[27]||(a[27]=d(`
03

Primitives

Component primitives are the "smallest correct units" of the site UI. Each primitive exposes variants along only two dimensions — variant / size — with appearance driven by tokens, so it naturally supports light / dark mode and customizable theme colors.

i
For every interactive primitive, the keyboard behavior, focus, and ARIA contract are in §08 Accessibility. New primitives must ship with a keyboard model — mouse-only interaction is not enough.

Component selection guide

ScenarioUse
Primary action (submit / confirm)Button variant=primary
Secondary action / cancelButton secondary / ghost
Destructive action (delete / abort)Button danger / danger-soft
Status markerBadge
Toolbar filter / model switchPill
2–5 mutually exclusive optionsSegmentedControl
Top tabsTabs
Switch / multi-selectSwitch / Checkbox
Scrollable regions with overlay controlsScrollArea
Floating content card / list action menuCard / Menu
Inline notice / global toastBanner / Toast
Dialog / confirmation · bottom panel (mobile)Dialog / Sheet

Button

4 semantic variants × 3 sizes. The primary action primary takes its color from the current theme color (§05 can switch between the blue and black families). Radius uses --radius-md uniformly (small size --radius-sm), weight 600, with a visible focus ring.

Variant matrix lightpreview
medium · default
small
With icon / state
Dark skin dark

API

Button.vue · usage
<Button variant="primary" size="md" :loading="submitting">Save</Button>
-    // variant: primary | secondary | ghost | danger | danger-soft
-    // size:    sm | md | lg
States

IconButton

Unified into three sizes — 26 / 32 / 44px — with the neutral --color-hover wash on hover and a visible focus ring. Replaces the ad-hoc icon + click areas scattered across components today.

IconButton
i
The desktop IconButton comes in sm 26 / md 32; on touch devices the tap target should be ≥ 44px, so use lg 44px, satisfying the §01 accessibility principle (the mobile three-piece set uses lg).

Badge · Chip · Pill

Collapsed into two kinds: Badge (status badge, with an optional status dot) and Pill (the clickable pill in the composer toolbar). Radius, font size, and padding are all unified.

Badge · status badge
Semantic variants
pendingrunningcompletedneeds confirmationfailedKIMI
With icon / small size
planpassedread-only
`,19)),t("div",_,[a[14]||(a[14]=t("div",{class:"stage-bar"},[t("span",{class:"st"},"Pill · toolbar pill (composer)")],-1)),t("div",J,[a[12]||(a[12]=d('kimi-k2· thinking',1)),t("span",Q,[c(f(h),{name:"shield-question",size:"sm"}),a[11]||(a[11]=e("yolo",-1))]),a[13]||(a[13]=t("span",{class:"p-pill"},[t("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[t("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"})]),e("12k / 200k")],-1))])]),a[28]||(a[28]=d(`

Kbd · keyboard shortcut

Kbd renders a shortcut as keycaps — one block per key, never inline text like (⌘K). Caps are 18px tall (Badge sm rhythm): transparent ground with a 0.5px hairline edge, 11px --font-kbd (Inter + system-ui), text colour inherited from the row that carries it — the cap has no fill or colour of its own, so it follows its context (bright inside the accent-ringed recording box, quiet in a hint row). Typical placement: pushed to the row's trailing edge, opposite the label (e.g. the sidebar search row), and inside dialog navigation hints.

Kbd · keycaps
KCtrlKP

Card / Surface

All cards across the site share one structurehead / body / foot — and come in two tiers by visual weight:

  • Operation card —— composite "process" content such as the Swarm overview. (Individual tool calls are NOT cards anymore: they render as quiet borderless lines, see §04.) Flat shell: 0.5px hairline, --radius-md, no shadow. The head is compact mono with no fill, low weight by default, not competing with the conversation.
  • Attention card —— content that needs a user decision, such as Question / Approval. A floating neutral card: white raised surface, --radius-lg, a faint popover shadow (--shadow-menu), a plain dark title head, and a hairline footer whose actions read in number-key order (chips on the buttons) leading to one solid primary action. No semantic color band.
Operation card · compact mono head (no fill)
read_filesession.ts
The head uses mono + a neutral background to emphasize its "code / process" nature; the body uses sans for readability. Flat, radius-md, same shape as the Swarm composite card.
Attention card · floating neutral surface (no color band)
A decision needs your confirmation
A floating neutral card — no color band. The raised surface, large radius and soft shadow lift it above the transcript; the head is a plain dark title, and the hairline footer lines up quiet text buttons leading to one solid primary action.
Activity run · a summary row expands into the folded lines
Read 2 files
Readsession.tssrc/auth34 lines
Readmiddleware.tssrc/auth58 lines
  • One structure, two shells: every card is head / body / foot; operation cards are flat + 0.5px hairline + radius-md with no shadow, while the attention card is the single exception — raised surface, radius-lg and a soft shadow, because it floats above the transcript in place of the composer.
  • Differences are intentional: operation cards keep a compact mono head; attention cards get a plain dark title head and footer actions.
  • Grouping: consecutive activity (thinking + tool calls of any kind, cards included) folds into ONE activity-run row — a smart summary sentence that expands into the items in order; only text and successful media tools (inline media is the turn's output) stay out and break the run (see §04).
  • Turn fold: once an assistant turn settles, everything before its final text block (thinking, activity runs, interim text, standalone cards) folds into ONE bare "Worked Ns" row — no glyph, a faint one-line label + rotating chevron sharing the activity-run head's padding and hover language; while the turn streams the row stays hidden and the body forced open, and on settle the row appears and folds itself back. The span is the turn's elapsed time (daemon duration once settled, server message stamps for history; approval/question waits included by design), reading the generic "Work details" without any stamp. The final text — and anything after it, so trailing media / cards stay on screen — never folds; a text-only turn renders no row at all (see §04).
  • Status dots: running (pulsing blue) / done (green) / failed (red), sharing one color vocabulary (see §04 tool calls).

Input / Select / Textarea

Unified 38px height (32px small), --radius-md radius, --color-surface-overlay background, and a unified blue focus ring (0 0 0 3px accent-soft). Select is a custom combobox and listbox, not a native <select>; opening it centres the selected option in the scrollable menu. Open Select roots enter the dropdown layer; containing settings groups temporarily release clipping and join that layer so later sections cannot cover the menu.

Form primitives
Only letters, numbers, and hyphens are allowed.
States
Please enter a valid workspace name
Normal state · validation passed

Code / Diff

Diff controls: The non-selectable branch summary starts with a 14px branch icon, aligns to the panel header's 12px inset, uses 12px labels, and ends with a 0.5px hairline. List and tree choices use the 14px list and tree-view registry icons. Flat-list and tree-view paths use the UI font at 12px. Tree roots share the flat list's 14px content inset, then each depth advances by 12px and adds a grey indentation rule.

Diff empty state: Centre the clean-workspace message in the available panel height and lead with a quiet 32px status icon.

Diff detail body: the right-side diff detail reuses HighlightedCode unframed (the panel owns the edge and scroll) — shiki highlighting with the language inferred from the file path, an old/new line-number gutter, hunk headers as a muted band, at the shared code size --code-font-size (12px at Medium, one step below body text). The file preview's code body (text / JSON / HTML and Markdown source) renders through the same component with a per-row number gutter plus search-hit / jump-target row states.

Inline code, code blocks, and diff contents use the monospace font (--p-font-mono); diff change counts and branch summaries use the UI font. Code blocks have a filename title bar and a copy button; the action edge uses a compact 6px inset. Diffs use + / - row colors to express additions and deletions — additions use a success light background, deletions use a danger light background, with no gradients.

Code / Diff
inline code
The server uses jwt.verify(token) to verify the signature, returning 401 on failure.
code block
session.ts
import { verify } from './jwt';
-
-    export function auth(token: string) {
-      return verify(token, process.env.JWT_SECRET!);
-    }
diff
session.ts · +3 -1
import { verify } from './jwt';
-const secret = 'dev-secret';
+const secret = process.env.JWT_SECRET!;
return verify(token, secret);

Dialog

One dialog primitive replaces 6 hand-written implementations: unified --radius-xl radius, --shadow-xl shadow, 20px head padding, right-aligned footer actions, and an IconButton close button.

Dialog primitive
New chat
Create an independent Agent chat in the current workspace.
i
Size & height: Dialog offers three widths — md 440 / lg 640 / xl 760 (--p-content-max) — chosen by content weight. Height comes in two kinds: auto (default, grows with content up to max-height) and fixed (constant height min(680px, 100vh - 64px), with overflow scrolled inside the body). Content / multi-tab dialogs (settings, model picker, provider manager, folder browser) always use fixed so the frame size stays constant and doesn't jump when switching tabs or content length; short confirmation dialogs keep auto. Selectable controls inside Settings use 0.5px hairlines. Its navigation stays transparent on the grouped canvas — separated from the content region by the 0.5px hairline (horizontal in the stacked mobile layout) — and uses 12px labels at weight 525 with 16px registry icons; the selected tab paints the same neutral --color-hover wash as hover, with the label simply brightening to --color-text — the Kimi app settings nav's recipe (.ss-nav-item--activeFills-F1, no accent tint, no weight change); section captions use 16px UI text in --color-text. Every setting row has a plain-language description; option labels use --color-text at weight 475 with a 1px gap before that description. Chinese descriptions use “思考” and “计划模式” rather than the English terms; “skills” stays lowercase when it appears within a sentence. Every settings section puts its rows inside one rounded group with 0.5px dividers; the content region paints the flat --color-surface so each group (--color-surface-raised) reads one rung above it — never a sunken pit, which would sink the dialog's content below its chrome in dark. The font-size stepper is a compact 32px UI-font control with 12px values and custom minus and plus buttons. Its 52px desktop row centres the control with equal space above and below. Archived workspace headings reuse the sidebar’s folder-closed registry icon, and Restore actions lead with the undo icon. Archive counts use weight 500; timestamps and workspace paths use the UI font.

Dialog backdrop: Use a restrained 28% neutral overlay so the workspace remains legible without competing with the modal.

Settings regions: The settings title and close action belong to the right content region. The navigation is a separate full-height region that starts at the dialog's top edge, not content beneath a dialog-wide header.

Archived sessions: Start with the localized page title. Do not add a repeated English kicker above it.

Settings interaction: Notification labels and descriptions are not selectable; their switches remain fully interactive.

Conversation chrome: Header labels are not selectable; the rename input remains selectable and editable. Branch names start with a 14px branch icon. The overflow trigger is a compact 24px control with a 14px icon. Below a 720px header container, hide the workspace prefix and give the conversation title the available width. On macOS desktop the header doubles as the window-drag region and interactive controls opt out with no-drag; while one of its menus or a dock work panel is open every window-drag strip (chat header, sidebar header, panel header) drops the drag region so an outside press anywhere reaches the page and dismisses the overlay (window dragging is simply paused).

Session search: follows the §09 flush picker anatomy — a boxed Input under the head, and a result list that fills the body's available height and owns vertical scrolling.

Model picker: follows the §09 flush picker anatomy; the provider filter remains horizontally scrollable without showing a persistent scrollbar. Only the model list scrolls; the shortcut bar remains pinned at the bottom.

Toast

Unified information architecture: status icon + title + description. The status color appears only on the icon, avoiding large colored areas that create visual noise. For an undoable action there is a second, lighter form — the Action toast (ActionToast.vue): a pill floating top-center just below the 48px header, carrying a one-line sentence whose actions are plain inline <button>s (styled accent by the component), plus close. Self-timed (default 8s, hover pauses); the parent re-keys to reset and wraps it in a <Transition>. First used by session archive (Undo / Settings); warnings keep the bottom-right Toast stack.

Toast
Connected to server
The local server is responding normally; you can start a new chat.
Context usage 82%
Consider running /compact to free up space.
Action toast
or view archived chats in

Spinner

Loaders fall into two categories by scenario — do not mix them:

  • Spinner (plain · SVG ring) —— the default loader. Used for button loading, app startup (GlobalLoading), and general inline waits — "everything else".
  • WorkingIndicator (小蓝 mascot · brand signature) —— used only for the chat working state after a prompt is sent (the sending placeholder in ChatPane, the send → first-token loading in SideChatPanel). The label follows the phase: "Requesting…" until the assistant's reply starts, then "Working…".

Spinner · plain loader (default)

`,39)),t("div",Y,[a[18]||(a[18]=t("div",{class:"stage-bar"},[t("span",{class:"st"},"Spinner · common scenarios")],-1)),t("div",Z,[t("div",X,[a[17]||(a[17]=d('Loading…',2)),t("button",$,[(o(),i("svg",aa,[...a[15]||(a[15]=[t("circle",{class:"track",cx:"12",cy:"12",r:"9"},null,-1),t("circle",{class:"arc",cx:"12",cy:"12",r:"9"},null,-1)])])),a[16]||(a[16]=e("Submitting",-1))])])])]),a[29]||(a[29]=t("h4",{class:"mini"},"WorkingIndicator · 小蓝 mascot (only the chat working state)",-1)),t("div",ta,[a[20]||(a[20]=t("div",{class:"stage-bar"},[t("span",{class:"st"},[e("WorkingIndicator · chat working state only "),t("span",{class:"tag spec"},"signature")])],-1)),t("div",da,[a[19]||(a[19]=t("span",{class:"stage-label"},"Usage · only while the chat has an unfinished prompt",-1)),t("div",ea,[c(k,{label:"Requesting…"}),c(k,{label:"Working…"})])])]),a[30]||(a[30]=d('
i
The chat working state is rendered uniformly by WorkingIndicator — the 小蓝 mascot (KimiMascot, the kimi.com avatar Rive asset, with a static SVG fallback under reduced motion or when the runtime fails) plus a phase label. All other loading states use the plain Spinner.

Link

Inline text link: the default is the accent color with no underline; on hover it shows an underline and darkens. File links inside inline code use a 1.5px underline offset so the line stays clear of the chip background. The .muted variant uses the secondary text color. Used for in-text jumps, external links, "view all", and other lightweight actions.

Link · inline link
Read the full design token docs before building.View on GitHubView history

Menu / Dropdown

Desktop menus use a 3.5px panel inset. Standard items use 5px × 9px padding and a 7px icon gap. Their three-layer neutral shadow stays below 4% opacity.

Dropdown menu panel: frosted glass — the translucent --color-menu-bg fill over a blurred, saturated page backdrop (--p-menu-backdrop) — plus hairline + light shadow (--shadow-menu, a three-layer neutral ramp). This is the one place glassmorphism is the design language rather than an exception (§06); every floating menu surface (Menu.vue, the Select listbox, composer dropdowns, slash/mention popups) uses the token pair, never ad-hoc blur values. Menu items support icons, the current (active) state, the danger state, and the disabled state, with separators grouping items. All menu actions use 13px labels at weight 475 with 16px leading icons; both share a 16px line box for vertical alignment. Menu timestamps use the UI font. On touch / mobile, use lg (≥44px row height) while keeping the same type size. A dropdown menu pops in from its trigger corner — fade plus a slight 0.97 scale over --duration-base (exit --duration-fast), the composer model dropdown's motion language; the transform origin and the nudge direction follow the anchoring, including the upward flip near the viewport edge.

Row states: hover uses the mode-aware --color-hover wash (it lightens under dark, never darkens); a leading icon sits one rung below the label (--muted), and on hover both label and icon step up to --color-text-strong, the max foreground tier. Selection keeps the accent pair (--color-accent-soft / --color-accent-hover); danger keeps its own colour.

Menu · dropdown menu
Open file
Selected item
Disabled item
Delete chat

SegmentedControl

Mutually exclusive short option groups, commonly used for 2–5 option switches such as "light / dark / follow system" or the four font-scale steps. Options may include a 14px registry icon or a colour swatch. A single raised indicator with a soft shadow (no border — the edge stays clean) slides and resizes between options using the standard motion tokens. Three sizes: md (default, settings pages), sm (compact rows), and xs (dense menus such as the composer model dropdown — 20px items, 12px labels).

SegmentedControl
LightDarkFollow system

SecondaryModelPicker

Linked model + thinking-effort picker (settings → Agent → Subagents, experimental; components/settings/SecondaryModelPicker.vue, shared by both ends). Use it whenever two choices are only valid as a pair — here an effort is meaningless without its model, and every model declares a different supported set. It is a cascading variant of the §03 Select: the trigger is the Select trigger verbatim (value renders model · effort, the unset state uses the placeholder tint), and the dropdown opens as a SINGLE-LEVEL model list (grouped by provider) on the floating menu surface (--color-menu-bg / --p-menu-backdrop / --shadow-lg). The menu teleports to <body> with position: fixed — it opens on top of the settings modal (on the --z-modal-dropdown rung), and only a body-level surface escapes the dialog's scrolling-body clip; it re-anchors to the trigger on any outside scroll and closes on window resize (the UserMenu teleport's full recipe). Hovering or clicking a model row flies its effort submenu out to the RIGHT of the row — same menu surface, anchored to the row's live position, flipping to the left only near the viewport edge per the §03 anchoring rules — with a 250ms hover-intent grace (the UserMenu flyout's recipe) so the diagonal path into the submenu doesn't collapse it. Every model row carries a trailing chevron-right affordance; clicking an effort confirms the pair and closes — one atomic write, never two staggered patches. Flyout options follow the composer's thinking-level model (segmentsFor): effort models get off + their declared levels (always-thinking ones get no off), boolean-thinking models get on/off, unsupported models get off alone; while no effort is set at all, a "Model default" entry leads (it writes the model alone — POST /config merges and cannot clear a stored effort, so the entry disappears once one is set). A configured effort the model no longer declares is appended as an extra flyout option so the current pair stays visible and re-selectable. Keyboard mirrors the Select contract (focus stays on the trigger, Esc preventDefaults so the hosting dialog does not close): ↑/↓ move within the active level (the flyout follows model moves), → opens the flyout, ← collapses it, Enter confirms, Home/End jump. ARIA: combobox trigger → dialog menu holding a model listbox plus the effort listbox flyout with option rows. The menu itself flips upward when the trigger sits near the viewport bottom.

Tabs

Tabs with a bottom hairline, used for grouping and switching sibling content. The current tab is marked with accent text + an accent underline.

Tabs
GeneralAgentAdvanced

Switch

A two-state switch for settings that take effect immediately. The 36×20 track has a 0.5px hairline and full radius; its 16px knob uses 1.5px internal offsets so the visible inset remains 2px and symmetric after accounting for the border. On hover, the knob eases to an 18px rounded rectangle towards the track centre. When on, the track turns accent and the knob slides right.

Switch

Checkbox

A 17×17 checkbox. When checked it fills with the accent color and shows a white tick (inline SVG). Often paired with a text label.

Checkbox

Avatar

A 32px default avatar with md radius; .sm is 24px. Can hold an initial or an icon; falls back to this placeholder when there is no image.

Avatar
KK

EmptyState

A centered placeholder for empty lists / panels: a 48px faint icon + title + hint, avoiding blank pages.

EmptyState
No chats yet
Click "New chat" to start a conversation with Kimi

Divider

A 0.5px hairline divider (--p-line); .p-divider-v is the vertical divider, used between inline elements.

Divider
Content above

Content below
kimi-k2thinking

Tooltip

A CSS-only hover hint, wrapped in .p-tip. Inverted background (--p-text / --p-bg), single line, no wrapping — carries only short notes.

Tooltip (hover the button)
New chat

Banner

An inline notice bar placed at the top of a content area. Three states — .info / .warning / .danger — each with a matching 18px icon.

Banner
Connected to server
Currently in yolo mode; tool calls will run automatically

Sheet / BottomSheet

A mobile bottom slide-up panel: xl top radius + drag handle, xl shadow. At ≤640px, dialogs become bottom-anchored Sheets.

BottomSheet
Choose a model
kimi-k2 · thinking
kimi-k2 · instant

Skeleton

A placeholder for loading content, using a breathing opacity animation (no gradients), following the no-gradient-text rule. Composed into titles / text lines / avatars.

Skeleton

Command Bar

An inline combination of "primary action + command text + copy", sitting between a button and a code block — used for install / onboarding / one-click execution. The primary action reuses Button primary; the command area uses a mono light-grey background.

Command Bar
curl -fsSL https://code.kimi.com/install.sh | bash

TopBar

The application top bar. Solid by default; the .frost variant is translucent + background blur, used only for sticky navigation bars. Together with the floating menu surfaces (Menu / Dropdown), it is one of the two exceptions to the no-glassmorphism rule (see §06).

TopBar · solid / frosted glass
Solid TopBar
Frosted-glass TopBar · .frost

Find Bar · transcript search

The in-transcript find bar (Cmd/Ctrl+F), implemented by components/chat/TranscriptSearch.vue. A floating card pinned to the transcript's top-right (top: --panel-head-h + --space-3, right: --space-3 — equal inset on both axes), --z-sticky, raised surface + 0.5px hairline + --shadow-menu. One radius for both states: --radius-2xl is a full capsule at the collapsed height and a card once the footer expands — never animate between two radii.

PartRule
Input rowSearch icon (muted) + bare input — the list-style bare-input exception family (sidebar search row, inline rename), NOT the boxed Input primitive; the 38px bordered control would break the pill. Circular close IconButton sm (concentric with the capsule end); a 0.5px hairline separator before it. Height comes from the grid: 32px control (--space-8) + 2× --space-1 padding = 40px — at which --radius-2xl is exactly the half-height capsule.
Footer (results)Expands via the 0fr→1fr grid fold (--duration-slow), hairline top separator, prev/next IconButton sm left, right-aligned muted count (N/M results · --ui-font-size-sm). Only exists once a query has settled — while typing or empty, the bar stays a bare pill.
Statescollapsed (empty query) / searching (Spinner sm in the input row during the ~800ms debounce) / results / no-results (count reads "No results", nav disabled). Disabled is uniformly opacity:.5.
FocusComposer-style: a neutral hairline overlay (::after + --color-composer-focus-line) fading in on :focus-within. No accent ring.
Match inkCSS Custom Highlight API — the bar mutates no transcript DOM. All matches: --color-search-match (yellow); current: --color-search-match-current + a 2px --color-warning outline ring (a positioned overlay — highlight pseudos can't paint box outlines). Tokens live in web-ui/style.css with light/dark pairs.
KeyboardCmd/Ctrl+F opens + focuses (repeat = re-focus + select-all; hardcoded, reserved in the desktop keymap), Enter / Shift+Enter steps matches (wrapping), Esc closes from ANY control inside (container-level, so it never reaches the conversation's Esc-abort).
Matching semanticsRendered transcript DOM only (unloaded older pages are out of scope), capped at 1000 matches (count reads N/1000+). Matches span inline nodes within one block, never cross block breaks; inert and display:none content is excluded. Stepping scrolls the match's own rect into view, not its parent element.

SectionLabel

A small group title for sidebar lists, used to section the content below (such as Workspaces in the sidebar). Spec: 13px / 700 / uppercase / letter-spacing .08em, color --color-fg-faint; left-aligned to the row's starting padding (--sb-pad-x), keeping the same indent as the group rows below. For scripts without case (such as Chinese), text-transform:uppercase simply has no effect — no special handling needed.

',55)),t("div",sa,[a[26]||(a[26]=t("div",{class:"stage-bar"},[t("span",{class:"st"},"Sidebar · group title")],-1)),t("div",oa,[a[25]||(a[25]=t("div",{class:"p-section-label",style:{padding:"12px 16px 4px"}},"Workspaces",-1)),t("div",ia,[(o(),i("svg",na,[...a[21]||(a[21]=[t("path",{fill:"currentColor",d:"M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])),a[22]||(a[22]=e(" kimi-code-web ",-1))]),t("div",la,[(o(),i("svg",ra,[...a[23]||(a[23]=[t("path",{fill:"currentColor",d:"M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])),a[24]||(a[24]=e(" playground ",-1))])])])]),t("section",ca,[a[39]||(a[39]=d('
04

Chat Interface Overhaul

The message stream is the core of Kimi Web. Tool calls render as quiet activity lines — one borderless line per call, bespoke per tool kind, auto-grouped, expanding on demand — while Question / Approval elevate to a floating neutral surface because they need a decision, and the Swarm composite keeps a card; the Composer collapses into a single rounded container.

Unified message stream

User-message bubbles follow the kimiwork production recipe (MessageItem .user-bubble): a neutral --color-user-bubble-bg fill (BubbleGray — #f5f5f5 light / #292929 dark), uniform --radius-lg corners, no border, no shadow.

Message timestamps use 12px UI text at weight 500, matching the compact metadata scale without switching to a monospace face.

The user-message metadata row sits one 8px spacing step below the bubble, so its actions and timestamp read as supporting information rather than part of the bubble edge.

Overlong user messages clamp at 10 measured lines, the tail dissolving through an alpha mask rather than a tint overlay (the translucent accent fill would double-composite); a floating pill toggle centred on the fade expands in place and collapses back, and the collapse pins the toggle itself so the reading position survives. Skill / plugin command args clamp through the same wrapper, beside the card head. Like the transcript's other disclosure controls (thinking row, turn fold, tool lines), the toggle is a bare native button carrying aria-expanded — chat-surface disclosure controls do not use the §03 Button primitive.

The floating jump-to-latest control uses 12px UI text at weight 525, led by the full down-arrow icon rather than a disclosure caret.

Thinking is an inline, borderless disclosure row in the message stream — never a side panel. The k15 bulb (the thinking registry icon) leads the row in every state; while streaming the "Thinking…" label breathes (opacity only, never a gradient shimmer) and whole elapsed seconds tick beside it, afterwards the label settles to "Thinking process" with the final span as · Ns (renderer-measured, live sessions only — history shows no seconds). Collapsed by default, it expands in place with the standard grid-rows animation and a 90° chevron rotation, and it folds itself back once the stream moves past it, even if the user expanded mid-stream. The header only animates its text colour on hover (standard duration and easing tokens), no card shell.

Conversation · 760px reading column
Please change the login endpoint to JWT and add the corresponding unit tests.
🌔Analyzing the auth module…
Read 2 files
Readsession.tssrc/auth · :12-4534 lines
12 export function verify(token: string) {
13 return jwt.verify(token, getSecret());
14 }
Readmiddleware.tssrc/auth58 lines
Editmiddleware.tssrc/auth+12−4
Search"jwt.verify"src/auth4 results

I looked at the structure of src/auth; it is currently based on a session cookie. The scope of the change is below — once you confirm, I'll start.

A decision needs your confirmation
How long should the JWT expiry be? Default 7 days, refresh token 30 days.
Write permission required
About to modify src/auth/middleware.ts, 42 lines changed. Allow?
Replace session with JWT signing
Refactor the auth middleware
Add unit tests

Wide markdown tables (desktop): regular chat prose stays within the 760px reading column (--p-content-max), and tables stay there too by default — an overflowing table scrolls horizontally inside its own wrapper, so the page and the chat area never scroll sideways. A clipped table shows a gradient fade at its truncated right edge, and hovering the table reveals a small widen button at its top-right corner; clicking it lets the table grow naturally with its content up to 1040px (--p-table-max), centred within the conversation pane, and clicking again restores the default width. At the default width a single column is capped at 36% of the pane; once widened the cap relaxes to 700px (--p-table-cell-max), so long cell content wraps inside the cell instead of stretching the table. The conversation outline (TOC) keeps its usual position just outside the reading column; when a widened table grows past it and scrolls under the rail, the TOC is hidden temporarily and returns as soon as the table leaves, without touching the user's TOC setting. On mobile a table never breaks out of the reading column.

Tool calls: quiet activity lines, bespoke per tool

High-frequency calls like read / bash / grep are "operational noise" — boxed, collapsible cards quickly drown out the conversation. Tool calls therefore render as one quiet borderless line in the message stream — never a card — and each tool kind composes that line for its own content, so the stream reads like an activity log rather than a pile of widgets. The three visual-weight tiers:

Three visual-weight tiers
① Tool line · lightest (default) — bespoke content per tool, no card chrome
Runpnpm run build && pnpm lint0.8s
② Activity run · medium (consecutive quiet activity — thinking + tool lines — folds to one smart-summary row)
Read 3 files
③ Sub Agent identity card · one per delegation — task title + agent type; the whole card opens the side panel (no in-stream expansion, never grouped)
分析双引擎架构Explore
④ Decision card · heavy (only question / approval, needs user input)
Write permission required
About to modify src/auth/middleware.ts, 42 lines changed.
  • A tool call renders as one quiet borderless line (~24px, the thinking row's rhythm): leading glyph, tool-specific content, trailing meta + status. There is no card chrome and no hover wash — the chevron hugging the line's text (thinking-row style, never pushed to the far edge) is the only disclosure affordance, a real <button> carrying aria-expanded (keyboard path); the head itself is a plain click target (mouse path), so trailing slots may hold genuine buttons of their own (e.g. Agent's "open detail").
  • One type scale for the whole stream: thinking rows, fold summary rows and tool lines all set 13px UI text; in-line mono and trailing meta run one step down at 12px (a monospace x-height reads larger, so 12px sits level next to 13px). Hierarchy comes from colour, never from size jumps or bold — everything on the line is regular weight: the only dark object is the file-name button (--color-text — the one interactive place to go); the action label (Run / Read / Edit…), the mono command / pattern and secondary context all sit at --color-text-muted; auxiliary elements (glyphs, chevrons, trailing meta) stay --color-text-faint. The stream thus reads in three quiet tiers: prose in text, tool lines in muted, thinking / captions in faint. Line content is centre-aligned so mono-only rows (Bash) sit level with the icon and chevron. Truncating line content (the CSS-ellipsis spans) sets --leading-tight rather than the row's line-height: 1 — a 1em line box is shorter than the font's ascent + descent, so overflow: hidden would clip descenders (j / p / g / y); mono runs take the font's own normal leading instead, since JetBrains Mono's ≈1.32em metrics exceed --leading-tight. The 16px chevron still drives the ~24px row height.
  • Every tool kind composes its own line, leading with the tool's localized action label (Run / Read / Edit / Write / Search / Find / Fetch…): Bash pairs its label with the full command in mono (CSS-truncated) plus a duration chip; Read / Edit / Write follow the label with the file name as a real button (opens the file preview) followed by the directory, a :line-range or a +N −M stat with a mini segmented bar; Grep shows the pattern in mono plus a match count; Glob / Ls list paths; Todo carries the active task with a done/total progress bar; goal tools show a coloured status pill; ExitPlanMode expands into a read-only plan receipt with its persisted review outcome. Unrecognized tools fall back to glyph + localized label + argument summary.
  • The settled question is the one exception to the quiet line: once AskUserQuestion settles with a recognized answer, it becomes a small receipt card — the question card's echo (raised surface, hairline edge, lg radius, --shadow-xs, flush with the stream's left edge, ≤560px). The card echoes only the picks, checked with the live QuestionCard's CSS glyph language one step down (14px); passed-over options are not echoed. Dismissed (or zero-answer) collapses to a slim italic one-line card; while running, and for unrecognized output (background launch / error), it stays the plain quiet disclosure line with the raw output.
  • Clicking a line expands it in place; the detail hangs below at the line's own left edge (no inset), so it reads as part of the stream rather than as a separate card. Details are one of: the mono output panel (content-well surface, hairline edge, 12-line scroll cap), the inline diff, or clickable match / file lists (path:line opens the preview at that line). Code-bearing details — the Read content, the Edit diff, the Write content — are syntax-highlighted by file type (github-light / github-dark, following the colour scheme), with the Read output's real line numbers as the gutter; highlighting mounts lazily on first expand and degrades to plain text for unknown languages or oversized content.
  • Rows sit flush with the message stream's left edge (same alignment as prose and the thinking row): no inset, no hover wash, and the glyph rides the thinking row's 4px icon-to-text rhythm with no padded slot. Expanded rows inside a group stack directly on the shared rhythm — no dividers.
  • Consecutive activity — thinking segments and tool calls of ANY kind, quiet lines and richer cards alike — folds into ONE activity-run row: a smart summary sentence that aggregates the run per tool kind in first-appearance order (Read 2 files · Ran 5 commands (1 failed) · 26s), the failure clause hanging on its kind in danger red, the total span faint at the tail — one line, ellipsis-truncated, the full sentence in the title tooltip. Thinking items fold into the run but are not narrated in the sentence. The row shares the thinking row's language (borderless faint text row, text-colour hover only, one whole-row button with a rotating chevron) but rides a roomier 8px vertical padding — 30px against the quiet lines' 22px, so the turn-level summary keeps its presence between prose paragraphs; while the turn streams through the run the row stays expanded and the summary turns live (current action + cumulative per-kind stats + ticking whole seconds), and once every item settles it folds itself back — even if the user expanded it mid-run (the thinking block's vocabulary); a settled → running transition (the stream appending to the same run) reopens it. The glyph carries the state: the current step's own icon breathing while running, green ✓ / red ✕ once settled. A run needs ≥ 2 steps — a lone step renders standalone as the block it always was. Text never folds (it breaks the run), and neither do successful media tools (no card — inline media is the turn's output); everything else folds, cards included: Todo / Goal progress narration, the sub-agent identity card, Question / Swarm cards and unrecognized kinds (skills, MCP tools) all join the run — the stay-expanded-while-live rule keeps a card visible exactly while it is active. The expanded run is the items flat in order (thinking rows + tool rows), each with its own in-row details intact — the lines keep their own 4px row rhythm but breathe 8px apart, with a small inset below the head.
  • Above the activity run sits the turn fold (TurnFold.vue): when an assistant turn settles, every block before the LAST text block — thinking segments, activity runs, interim text paragraphs, Todo / Goal / sub-agent cards — folds into a single bare row reading Worked 4m57s (whole seconds, no glyph, no summary sentence), expanding into the folded blocks in order, each with its own rendering intact. The span is the turn's ELAPSED time (turnWorkMs): it ticks from the stamped start while the turn is open — approval/question waits included by design, so no park bookkeeping exists — then reads the daemon's own durationMs once settled (the server message stamps for history turns); the wall clock only feeds the live tick, so throttled tabs, session switches and remounts cannot corrupt the settled value. Without any stamp the row falls back to the generic Work details. Streaming turns show no row and a forced-open body — the live transcript is untouched, the fold lands only when the stream moves past the turn (or the turn parks). The split never hides the turn's output: the final text block and any trailing blocks (inline media, standalone cards) stay visible, and a text-only turn folds nothing. Fold state is a plain component ref — nothing persists, switching sessions resets to folded. Inside the right-side sub-agent transcript, disclosure bodies open instantly while their chevrons retain the standard rotation: animating the height of a full historical stream would relayout the entire panel on every animation frame.
  • A sub-agent delegation is an identity card — never a quiet line: the card carries the TASK as its title and the agent type as a quiet meta line, while the orchestrator's full prompt stays out of the stream on purpose. The whole card is one action (the quiet shell vocabulary: raised surface, hairline edge, large radius, no shadow): click to open the subagent's live progress in the side panel — there is no in-stream expansion.
  • Status keeps the shared vocabulary: running (pulsing accent dot) / done (green ✓) / failed (red ✗), at the line's right edge. Only two types keep a full card: Question and Approval — they genuinely need the user's attention. The Swarm composite keeps one quiet card (raised surface, 0.5px hairline, large radius) for its phase overview + member accordion.
  • A task notification is a status card, not a quiet line (NotificationCard.vue): the hidden <notification> injections (background-task / sub-agent settlement) render where they landed in the turn — a 28px status chip + title/sub head tinted with the toast status token pairs (completed → success, failed / timed_out / lost → danger, killed → warning, else neutral surface), expanding in place to the fields, the body, an output-file row (copy path) and the raw payload. ≥2 CONSECUTIVE notifications merge into one neutral group card (count + per-item status dots + compact rows, each expanding on its own). Notifications break the activity run but are never turn boundaries, and they never fold — a notification is an event worth noticing, not process noise, so it punches out of the turn fold and renders right after the fold row, in order.
  • A turn that dies on a model-request failure leaves a persistent terminal card at the transcript tail (ChatPane's .turn-failed): the notification card's danger shell (danger-soft surface, danger hairline, 24px status chip with the warning glyph) carrying a title keyed by the wire error kind (model failure vs step-limit stop), the provider message as a muted sub, a mono diagnostics meta (code · HTTP status · request id), and exactly ONE secondary sm action — Continue, which submits a short continue prompt through the normal path. It renders only while the session sits idle on lastTurnReason === 'failed' (a turn with zero assistant output included, so it pins to the tail rather than any assistant row), it is not dismissible, and it vanishes the moment a new turn starts. While the turn is still fighting, the working indicator instead narrates the retry backoff ("retrying n/max" from the live agent.status.updated phase) — a retrying turn never shows the card. The transient error toast now fires only for background sessions; the viewed session's failure is fully covered by the card.
  • Turn failed card · persistent terminal marker + one resume action
    模型请求失败,本轮对话已中断429 The engine is currently overloaded, please try again laterprovider.rate_limit · HTTP 429 · req_01KZ8Y…
  • A goal-continuation turn carries a provenance row: the hidden goal_continuation trigger (goal mode's self-driven next turn — a turn boundary, unlike task notifications) never renders its machine prompt; instead the assistant turn it opens shows one faint 12px line flush with the stream's left edge — the target glyph shared with the Goal tool (this turn belongs to the goal) + a localized label — ABOVE the turn's content and OUTSIDE the turn fold, so the row survives as the turn's provenance after settling. The marker lands with the trigger (before the first assistant block), and while the newest exchange is a goal-continuation turn the undo affordances (edit-and-resend, Esc undo) are suppressed — rewinding would drop the hidden trigger while refilling the older user text.
  • A settled turn's file changes are one summary card (TurnFilesSummary.vue): between the turn's final text and its footer, a §03 Card (hairline border, no shadow — NOT the quiet tool line, the artifacts are worth a discrete object) lists every file the turn's Edit / Write calls touched. The head reads "N files changed" with the aggregate +A −D and the mini diffbar; the aggregate hides whenever any row's stats are incomplete (a Write or an underivable edit makes the total a lower bound, never presented as exact). Each row is one clickable workspace-relative path (short and self-locating; a file outside the cwd stays absolute) with its per-file +A −D at the right edge. The row's action keys on the tool kind, and the stats tell it apart: a Write has no per-file count (its diff is underivable) and opens the whole file in the preview; an Edit / MultiEdit carries its +A −D and opens that file's turn diff in the right-side detail layer (TurnDiffPanel.vue — the turn's own X→Y change, not the git diff), whose header keeps an open-file action. The first three files show inline; the rest collapse behind a "N more files" ghost-button row in the card's foot. Where nothing handles the row action (the BTW side chat), the card renders its file rows as plain text instead of links.
',15)),t("div",va,[a[31]||(a[31]=t("div",{class:"stage-bar"},[t("span",{class:"st"},"Turn files summary · a real TurnFilesSummary (fixed sample)")],-1)),t("div",fa,[t("div",pa,[c(A,{changes:C,cwd:ya,onOpenDiff:u,onOpenFile:u})])])]),a[40]||(a[40]=d('
Tool Call · quiet lines (expand on demand)
Read 2 files
Readsession.tssrc/auth · :12-4534 lines
12 export function verify(…
Readmiddleware.tssrc/auth58 lines
Editmiddleware.ts+12−4

Decision cards · Question / Approval

The two attention cards replace the composer in the dock and share one contract: a floating neutral shell (--color-surface-raised + hairline + --radius-lg + --shadow-menu), a plain dark 16px title head, and a hairline footer whose actions read in number-key order with exactly one accent primary. There is no semantic colour band — the floating card itself is the "needs a decision" signal.

Plan review · pinned option rows, second-line descriptions
按这份 plan 开始实现?
The plan markdown scrolls in a capped area; the approaches are pinned below it — label on the first line, full description always on the second. The number chip doubles as the keyboard hint.
1方案 A:静态徽章零依赖、渲染稳定,升级时需手动同步版本号。
2方案 B:动态徽章版本自动同步免维护,但要求仓库公开可访问。
  • Footer contract: actions are left-aligned in number-key order (1·2·3·4), each carrying a number chip — sized by --p-chip-num over --color-inline-code-bg, the same chip vocabulary as option rows and the multi-step chip; exactly one primary action, the rest are ghost. Feedback mode swaps the whole footer for submit / cancel.
  • Body by kind: Write approvals preview the incoming content with HighlightedCode (syntax-highlighted, 24-row cap with scroll); Edit approvals render the before/after hunk as a highlighted line diff. Plan / diff / file kinds get a head expand toggle that lifts the cap so the block fills the card; the card itself never exceeds the pane (only the scroll area shrinks) — with the dock work pills visible, the dock takes over the same height budget as a flex column, so an expanded card yields the pills' height instead of pushing them past the pane's top edge. Once the plan scrolls, a soft shadow fades in at the scroll area's top edge — the sidebar's scroll-linked seam language, so clipped content reads as passing under the card chrome.
  • Danger hint: destructive shell commands (rm -rf, sudo, force-push…) show a danger-soft filled hint row under the command — detection is a display-layer heuristic on the client.
  • Minimized: the card collapses to a thin bar with a mono peek of the subject; the whole bar is the expand click target.
  • Question card: the title is the question itself (2-line clamp), with a step chip for multi-question flows and a × dismiss button. Options use CSS radio/checkbox glyphs (accent when selected); the number chip and glyph top-align with the option text, optically centred on the label's first line. The footer follows the same left-aligned action contract (primary first, ghosts after), with the keyboard hint pinned to the right edge; keyboard: ↑↓ moves (Space toggles in multi), digits pick, Enter advances/submits, Esc dismisses.

Composer

Unified into a single raised container: --radius-composer (32px) with --corner-shape-composer: superellipse(1.5) and a stable 0.5px edge. Focus crossfades a low-chroma line-and-accent edge over --duration-slow with --ease-in-out, while the neutral shadow stays unchanged — there is no added halo and no layout shift. The textarea uses text-autospace: normal for mixed CJK and Latin input. Toolbar controls use a quiet 32px full-round geometry with 8px edge inset; the send button remains a standard 32px circle, with its glyph at 28px (--composer-send-icon-size, the production kimi.com size; it sits outside the --p-ic-* scale on purpose).

Fill and edge tokens: the card's fill and rest border are their own tokens — --color-composer-bg and --color-composer-line — running the kimiwork / kimi.com production input recipe (.chat-input__shell): fill = groupedBackground.secondary (#ffffff light / #1f1f1f dark), rest border = separator.s1 (13% black / 12% white), focus line = fills.f4 (25% in both schemes), and --shadow-input = effect.shadow.inputDefault (0 5px 16px -4px rgba(0,0,0,0.07), kept identical in dark — the hairline carries the edge there). Only colours sit in the tokens; the 32px superellipse shape and the focus-only edge overlay are unchanged.

Send button tokens: the send circle runs on --color-send-bg / --color-send-bg-hover / --color-send-icon (+ *-disabled, --opacity-send-disabled, --shadow-send[-hover]), following the production recipe (.chat-input__send): a neutral labels.primary fill (90% black light / 84% white dark, hover #252525 / 84.8%) with the production lift shadow (0 7px 16px -13px 38% + 0 1px 2px 7%, one step larger on hover), a groupedBackground.secondary glyph, and a disabled state of the same vocabulary — fills.f2 fill with a labels.quaternary glyph at full opacity. The button is disabled exactly when submit would no-op — an empty draft with no ready attachment (image-only sends stay enabled), an upload in flight, or the starting spinner — so disabled is a first-class persistent state, never a fade.

Layering, anchors, and motion: the dock normally stays at --z-sticky so the Latest Messages pill can remain visible above its veil. While any Composer popup is open, the dock temporarily joins --z-dropdown, ensuring permission, work-mode, and model menus always paint above that pill. The permission menu's left edge and the model menu's right edge each follow their own trigger pill. All three menus use --shadow-menu and the same trigger-corner pop motion as Session Row menus: 0.97 scale with a 2px shift toward the trigger, --duration-base on entry, and --duration-fast on exit.

Attachment strip: attachments hang inside the composer card above the textarea as two grouped rows — images/videos as shared MediaThumb rounded thumbnails, files as the shared AttachmentChip pill — the same pair the sent bubble renders, so a draft looks exactly like the sent message. File-store videos render a static play tile instead of fetching a first frame. The strip caps at two thumbnail rows and scrolls beyond that instead of pushing the input down; while overflowing, a quiet count badge pins to the bottom-left and new attachments auto-scroll into view (to the end of whichever group grew). With two or more attachments, a one-click clear-all pins to the strip's top-right corner as a quiet 22px badge (trash glyph, danger on hover). The composer's pending preview and the bubble's media clicks open the same MediaLightbox preview, which owns Escape via the shared dialog stack: images go through PhotoSwipe (lib/mediaPreview.ts) and zoom out of the clicked thumbnail (scrim = --color-scrim-strong, caption = --color-text-on-scrim), videos keep the custom modal.

',11)),t("div",ha,[a[38]||(a[38]=t("div",{class:"stage-bar"},[t("span",{class:"st"},"Composer")],-1)),t("div",ua,[t("div",ga,[a[36]||(a[36]=t("div",{class:"p-composer-ta ph"},"Message Kimi, / to run a command, @ to reference a file…",-1)),t("div",ba,[t("div",ma,[a[33]||(a[33]=t("button",{class:"p-icon-btn"},[t("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[t("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"})])],-1)),t("span",wa,[c(f(h),{name:"shield-question",size:"sm"}),a[32]||(a[32]=e("yolo",-1))]),a[34]||(a[34]=t("span",{class:"p-pill"},[t("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[t("path",{fill:"currentColor",d:"M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"})]),e("plan")],-1))]),a[35]||(a[35]=d('
kimi-k2· thinking
',1))])]),a[37]||(a[37]=d('
kimi-code-web
',1))])]),a[41]||(a[41]=d('
i
Site-wide consistency: the composer uses one 32px superellipse shell and one 32px desktop control height. Attachment, permission, modes, compact, and model controls are all full-round and transparent at rest; hover reveals a neutral wash, open/active may use accent-soft, and Send remains the sole persistent filled control — an inverted --color-text fill with a --color-bg glyph (never the accent), disabled while the input is empty or an upload is in flight. The transparent dock floats over the transcript, while the scrolling content receives bottom padding equal to the live dock height so its final item can still clear the composer. Composer chrome is not selectable; only the message input permits text selection. Each permission mode has its own registry icon — manual hand, yolo shield-question, auto full-access — paired with the label in the pill (collapsing to the accessible icon below a 620px composer container) and leading its dropdown row in the mode's colour, with the current row's check trailing the row's end. The right toolbar is the flexible region: the model pill shrink-wraps its content, then shrinks and truncates internally only when the toolbar runs out of room. The dock's workbar above the composer carries one pill vocabulary — 32px high with --space-4 inline padding and stadium-shaped (--radius-full) corners, a --color-surface fill (one rung above the page in both schemes — sunken is degenerate in dark — the same material as the popover it opens), and the system hairline edge (0.5px at --color-line-strong, one rung up for presence; no shadow), icon + label + a count or status — for background bash tasks, background sub-agents, todos, and the goal alike; a pill toggles the shared work panel (itself at --radius-xl with the same 0.5px --color-line-strong edge outside — inner separators stay --color-line — and the menu panel's --shadow-menu), and the goal's detail (full objective, completion criterion) fills the panel body while its pause / resume / cancel controls ride the panel head (the decision cards' action vocabulary — exactly one accent primary, resume while paused; secondary pause while active; danger-soft cancel) and the meta counts (turns / tokens / time / budget) sit in a hairline footer — never a separate full-width strip.

Workspace attachment card: on the empty session, the workspace picker is a separate attachment card tucked under the composer — and the composer card itself stays complete (its own 0.5px border, --radius-composer corners with --corner-shape-composer, and shadow are never altered). The attachment lives inside the composer's padding box as the card's sibling, so its width always matches; its top --space-4 slides behind the card (the card is raised to --z-sticky), its square top edge stays hidden, and only the rounded bottom (0 0 --radius-xl --radius-xl) shows. Background --color-hover at 60% via color-mix (≈0.03 black in light, self-adapting in dark), no border, no shadow. Inside sits one quiet capsule trigger: transparent, --radius-full, 16px leading icon and 12px label at weight 475 in --color-text-muted; hover deepens to --color-selected and the label turns --color-text. The dropdown follows the §03 menu spec and is viewport-aware (flips above when more room, clamps max-height to the scrollport); at --z-dropdown it outranks both the card and the fixed click-outside backdrop (--z-sticky), which renders outside the composer because the card's container-type captures position: fixed descendants.

Responsive

See §02 --p-bp-sm for the breakpoint. This section only gives mobile-adaptation pointers for the chat interface; a full mobile mockup is out of scope for this spec.

i
At ≤640px: dialogs anchor to the bottom as Sheets (xl top radius, top drag handle), the sidebar collapses into an expandable drawer, the Composer toolbar is allowed to wrap, and the chat reading column drops its max-width to fill the screen.
',5))]),a[43]||(a[43]=d('
05

Theming

Kimi Web uses one unified theme: the same components, fonts, radii, shadows, and surfaces — theming only swaps color values. Every semantic color token ships a light value in :root and a dark override in the data-color-scheme blocks; the semantic status colors (success / warning / danger) are independent palettes, one set each for light / dark.

Accent

The app has one accent: the brand blue (--color-accent, #1783ff light / #58a6ff dark). Use it sparingly — the accent is reserved for the primary action, focus rings, links, and active marks (current tab, toggles); large fills always come from the neutral surface tokens. Selection that means "where I am" (sidebar rows, list pickers) is deliberately NOT accent-tinted — it uses --color-selected so it reads as location, not as an action.

Light / dark mode

Each semantic token ships a light value in :root and a dark override in the two data-color-scheme blocks (explicit choice, or following the OS preference via prefers-color-scheme). Switching light / dark simply swaps between these two sets of derived tokens, with zero structural change.

Benefits of one theme: components, fonts, radii, and surfaces are consistent site-wide; a single accent keeps the brand identity unambiguous; light / dark mode works out of the box; semantic status colors are independently tunable.
06

Style Rules

Anti-pattern rules that all UI code must follow. These rules are also the basis of the check-style detection script, one-to-one with a warning.

Rule IDWhat it detectsAction
no-gradient-textgradient text / gradient backgroundForbidden
no-glassmorphismbackdrop-filter: blur (TopBar sticky nav bar and menu surfaces via --p-menu-backdrop are the exceptions)TopBar + menus exempt
no-color-glowcolored / large-radius box-shadow glowForbidden
no-emoji-iconusing emoji as a functional icon (no exceptions). Emoji inside user content — session titles, messages — is not chrome and is out of scope (see §07 Session row's emoji icon)Forbidden
no-hardcoded-hexunregistered hex color inside a component <style>Warning
no-hardcoded-fonthard-coded font-family in a component (e.g. 'Inter') instead of var(--font-ui)Warning
radius-from-scaleradius value not in {4,6,8,12,16,20,999}Warning
z-from-scalez-index using an unregistered large numberWarning
weight-from-scalefont-weight not in {400,500}Warning

State matrix

Every interactive primitive should define the following states where applicable; missing ones are flagged by the style rules. focus-visible always uses --p-focus-ring (appears only on keyboard focus, see §08); disabled is uniformly opacity:.5.

StateButtonInputCardMenu itemSwitch
default
hover
active / pressed
focus-visible
disabled
loading
selected / active
error
readonly

Chat working indicator

The chat working state ("prompt sent, turn unfinished") is a brand signature of Kimi Web, rendered uniformly by the WorkingIndicator component: the 小蓝 mascot plus a phase label — "Requesting…" until the assistant's reply starts, "Working…" once it is streaming. All other loading states (including ActivityNotice) use the plain Spinner.

Glassmorphism exemption

backdrop-filter: blur is banned site-wide, with two exceptions: the .frost variant of TopBar — only in the one place of the "sticky navigation bar", used to stay readable over scrolling content — and the floating menu surfaces (Menu.vue, the Select listbox, composer dropdowns, slash/mention popups), which go through the --color-menu-bg / --p-menu-backdrop token pair so the recipe stays single-sourced. No other component (card, dialog, Toast, panel) may use glassmorphism; violations are flagged under no-glassmorphism, and menu blur with ad-hoc values (anything but the token) is flagged too. Persistent panels that stay open over scrolling content (the dock work panel) deliberately stay opaque — a live backdrop blur re-samples the scrolling page every frame and janks in Chromium.
07

App Shell & Sidebar

The structural spec for the app shell (three-column grid + right preview panel) and the left session sidebar. These are business-agnostic "skeletons" — components, fonts, radii, and surfaces are reused from §02 / §03, but layout and alignment have their own conventions.

Layout grid

On web it is a single-row 5-track grid: the sidebar and the right panel each occupy a permanent auto track, with the conversation column in the middle; two 0-width tracks are for the ResizeHandles. (The desktop app adds a second row for its terminal panel — desktop-only, see below.)

App.vue · .app
grid-template-columns: auto 0 minmax(0, 1fr) 0 auto;\n    /*         sidebar ↑    ↑handle  ↑conversation  ↑handle ↑right panel (auto) */
TokenValueUsage
sidebar width270px default (adjustable)expanded sidebar width, changed by dragging the ResizeHandle; should approach §02's --p-sidebar-w (264px)
--preview-w460pxwidth of the right preview panel when open
--panel-head-h48pxunified height for all right panel heads + the conversation column head; both use a 0.5px bottom hairline
--p-bp-sm640px≤640 switches to a mobile single column (top bar + conversation), no sidebar / handle / right panel
  • The right panel track exists permanently, with its width toggling between 0 ↔ var(--preview-w) and no transition — animating a grid track would relayout the whole app grid every frame (when open it squeezes the conversation column, rather than switching templates).
  • The sidebar collapses SYMMETRICALLY to the right panel: its container width animates to 0 while the content keeps its fixed width anchored to the right edge (clipped, sliding out left — no reflow, hairline stays on the clipped content). No rail remains. The collapse control differs by platform: on macOS desktop the toggle is a single resident floating IconButton pinned beside the traffic lights (rendered in both states, only the glyph swaps — the sidebar slides underneath it, never moves or flashes); on Windows / web the collapse button lives inside the sidebar header (right-aligned), and a floating expand button appears at the top-left only while collapsed. The conversation header uses a 0.5px bottom hairline and pads left in step with the transition while collapsed.
  • All grid children must have min-height:0; min-width:0, so only the inner scroll containers scroll and the page itself does not scroll.

Sidebar alignment system (--sb-*)

All sidebar rows (group head, session row, New chat, search, and Settings buttons) share 4 custom properties. Their 16px icon slots and --sb-gap place every label on the same x-axis as the workspace name.

TokenValueUsage
--sb-inset12pxrow box (hover/selected pill) inset from the sidebar edges — matches the brand header's 12px padding
--sb-pad-x20pxcontent start x (= --sb-inset + 8px row padding)
--sb-gutter16pxleading icon slot width — matches the workspace folder icon so the session title aligns under the workspace name
--sb-gap8pxgap between the icon slot and the text
i
The session title's starting x = --sb-pad-x + --sb-gutter + --sb-gap. The group head has a folder icon and the session row has a status slot; both icons are the same width and position, so the titles align naturally.

Sidebar structure

The sidebar from top to bottom: brand header → action group → pinned head (pinned section + "Workspaces" label) → scrolling grouped list (workspace head + session rows) → user-menu footer. New chat and Search are direct sibling controls in the same grid container; the optional new-workspace action shares the first row, while Search spans the next row. A 4px gap keeps Search clear of the scroll boundary. The pinned head sits OUTSIDE the scroll container (the action-group / footer pattern — never position: sticky, which would need an opaque plate over the frosted tint), so the pinned sessions and the "Workspaces" label stay put while the workspace groups scroll beneath; the pinned section is collapsible (a chevron on its label, revealed on hover/focus and kept visible while folded; state persisted) so a long pinned set can't eat the sidebar, and it re-expands when a new session is pinned. Both pinned edges use three light near, middle and far fades across 18px, entering over 260ms only while more session content exists beyond that edge — the top seam lives at the pinned head's bottom border. The footer seam is a 0.5px hairline. Controls reuse the §03 primitives as much as possible. The sidebar sits on --color-sidebar-bg (one step off --color-bg: warm off-white just under white in light, one step BELOW the page in dark — the session column reads as its own plane, and with dark elevation = lighter the chrome never sits brighter than the conversation pane; the hairline still separates it from the pane). Vertical rhythm: the brand header keeps 12px padding (on macOS desktop the left padding grows to 80px to clear the traffic lights); rows inside the action group stack flush (0 gap, same rhythm as the list rows); adjacent groups are separated by 12px. The search glyph has a -0.5px optical correction to align its visual centre with the label. Row hover uses --sb-hover (= the global --color-hover wash); the selected row uses the lighter --sb-selected wash derived from --color-selected — On macOS desktop the sidebar is instead frosted: the window carries a native NSVisualEffectView ('menu' vibrancy, following the in-app scheme via the nativeTheme mirror, its state pinned to inactive so the material keeps its flat pressed-down colour — ≈ #282829 dark / #E7E7E7 light — with no active/inactive drift) and the sidebar column drops --color-sidebar-bg for a single translucent --color-sidebar-tint wash that presses the pinned material one step — ≈ #282829 → ≈ #1e1e1f in dark (rgba(0,0,0,0.25)), ≈ #E7E7E7 → ≈ #f1f1f1 in light (rgba(255,255,255,0.4)) — with header and footer staying transparent so the tint reads as one uniform pane; the root chain (html/body/#app/.app) stays unpainted only under the macos-desktop + vibrancy flags — the latter is the Settings → Appearance accessibility switch (default on; persisted main-side so the window is created with the right material, and live-applied on toggle): off repaints the root chain and the sidebar falls back to opaque --color-sidebar-bg, while the traffic-light layout keeps keying off macos-desktop alone — while the conversation pane, chat header and right preview keep their own opaque surfaces. The list's hover-icon clusters (session-row kebab, group-head actions) paint NOTHING there — no plate, no wash, no blur (real backdrop blur does not even render over this window: Chromium's backdrop sampler returns a flat wash above the transparent BrowserWindow + vibrancy view). Instead the row's title/name dissolves before it ever reaches the buttons: a two-stage mask-image fade — a subtle 16px dissolve at rest, extending over the cluster zone only while the actions are revealed (row hover / keyboard focus / menu open): 34px on session rows (the pin+kebab cluster overhangs the title by ≈25px), 68px on group heads (the floating cluster is ≈60px wide). The fade is zone-based, so short rows render untouched, and text-overflow becomes clip so a long tail dissolves instead of dotting.

BlockUseNote
Brand headerlogo + name + collapse IconButton (right-aligned)on Windows / web the brand is left and the collapse IconButton sm is right-aligned inside the header; the dev-only backend version/address pill uses the UI font, not monospace; the logo is animated (a blinking eye). On macOS desktop the header is a bare drag strip (brand hidden, traffic lights + resident floating toggle over it)
New chatfull-width left-aligned button (custom)500-weight label; same rhythm as the session rows in the list (left-aligned, hover = --sb-hover). Do not use Button (centered, breaks the rhythm)
Searchbare search row (custom)500-weight label; no border, hover/focus shows the faint --color-hover wash; icon + label, with the Kbd keycaps (⌘K / Ctrl K) pushed to the trailing edge — label and shortcut are justified apart. Do not use Input (the 38px bordered version is too heavy). It is a direct sibling of New chat in the action group
Section label.p-section-labeluppercase muted small titles like "Workspaces", using --weight-section-label (600)
Pinned headfixed block above the scroll container (.sessions-head): the pinned section (PinnedSessionList.vue) + the "Workspaces" section labelstays put while the workspace groups scroll; owns the top scroll-linked seam (hairline + fade, only while scrolled). The pinned section folds via its label chevron (persisted, kimi-web.pinned-collapsed) and re-expands only on an explicit pin (never on load backfill); the expanded rows are capped at 40vh with their own scroll so a long pinned set can't push the list or footer out of view
Workspace head / session rowsee next two sectionsshare --sb-* alignment
User-menu footeraccount area (components/UserMenu.vue) opening an upward §03 menupinned row under the session list, separated by a 0.5px --line hairline; trigger keeps the same list-style family as New chat (24px round avatar + nickname when signed in, user icon + sign-in hint otherwise). The menu box follows the trigger's left edge and width (ResizeObserver-tracked, so it survives a sidebar resize) and is teleported to body because the column's container-type would capture position:fixed. Rows: plan usage / theme / language are macOS-style hover flyout submenus — the parent row carries the module icon, a faint current value and a fixed chevron-right, and hovering (or moving focus to the parent row, or pressing Enter / Space / → on it) opens a teleported panel anchored to the parent menu's right edge (content-adaptive width floored by the menu's own min-width and capped at the parent menu's width; flips left near the viewport edge) with a 250ms hover-intent close grace; the usage panel shows weekly + 5h rows (percent values with severity colours), while the theme (three schemes) and language (two locales) panels move the check to the picked option without closing the menu — then the upgrade entry below the top plan level, settings (with an always-visible Kbd keycap shortcut hint on desktop) and a confirming sign-out; all menu icons come from the Kimi set
!
Why New chat / search / inline rename don't use Button / Input: they are "list-style" controls (full-width, left-aligned, compact, borderless), while Button is centered and Input is a 38px bordered control — forcing them in would break the sidebar's visual density and alignment. This is an intentional custom exception, not an oversight.

Session row

A session row is an inset rounded pill, structured as: status slot → title → time → attention Badge → hover actions (pin / archive).

PartRule
Containerpadding: 8px 8px inside the list's --sb-inset gutter, radius-sm; no fixed/min height — row height is font-driven (title line-height: --leading-tight, ≈16px) → ≈32px total, the sidebar-wide row rhythm. The hover actions are absolutely positioned so they never force the row taller (no hover jitter). hover = --sb-hover (the global --color-hover wash); active = --sb-selected (75% of the global selected wash) — neutral, no accent tint, no border, no weight change
Status slot (lead)fixed --sb-gutter width; running = Spinner sm, otherwise unread = 7px accent dot
Titleflex:1 with truncation and user-select:none; double-click enters inline rename (compact input, not Input), whose text remains selectable
Emoji iconthe session icon is the title's LEADING emoji cluster (web-core splitSessionEmoji — no icon field; every client renders the title as-is). The emoji is an ordinary title character — no decoration at rest or on hover (it stays a <button> for a11y), and clicking it opens SessionEmojiPicker — a Menu-shelled panel (bare list-style search row → scrollable sections: Recently used persisted in localStorage (cap 8) + the grouped emoji dataset, with remove/random as MenuItems in the footer; a query swaps the sections for keyword-search results), teleported + fixed + --z-dropdown, popping from the trigger corner like the right-click menu. The menu's "Set Emoji…" opens the same picker and is the discoverable path. Inline rename edits the whole title — the emoji is an ordinary character in the input
Timemono xs, fg-faint; yields to the hover actions on hover
Attention BadgeBadge sm: info (needs answer) / warning (needs approval) / danger (aborted)
Hover actionsIconButton sm × 2 — pin + archive — cross-faded over the time on row hover (no kebab button). Right-clicking the row opens the full menu (copy ID / rename / emoji / fork / export / pin / archive + timestamp) anchored to the cursor, except over the inline rename input, where the native text-editing menu stays
Flat-style variant (flat list + pinned section)the sidebar's flat list rows AND — always, regardless of view mode — the pinned section's rows differ from the grouped row in three ways (all keyed off the facade projecting cwdLabel): ① no leading status slot — the title is left-aligned at the row's content edge; ② a second line under the title: folder-closed icon sm + the cwd's final directory name (- when the session has no cwd), xs faint like the time — except the icon, which takes --color-text-muted (one rung stronger, the same optical compensation as the group head's folder; the open-folder glyph's thin back-flap washed out at 14px) — rest-width tail mask fade; when the session has an associated PR (v2 git domain), a quiet chip (git-pull-request icon + #number) sits at the line's right edge, state-colored the GitHub way (open = --color-success, merged = --color-done purple, closed = faint) and opens the PR on click; ③ the first line's right side shows status — attention Badges anchored to the row's right edge, running Spinner, unread dot — INSTEAD of the time, which only renders when there is nothing to report (the Spinner yields to the attention pills: a session waiting for approval/answer never shows both); on hover the actions cross-fade IN as the whole status cluster fades OUT — pills and pin/archive never co-exist (grouped rows keep pills visible on hover). Height stays font-driven — the pill just grows the line. Grouped rows never set cwdLabel and keep the classic structure. The flat ↔ grouped switch lives in a dropdown on the SESSIONS section label (fixed list-settings icon + hover tooltip; the menu opens with a muted group label, per-view icons, and the current view checked at the row's right edge; mode persisted per device)
Archiveno confirm — the hover archive button / menu item archives immediately, then App.vue shows the §03 ActionToast (top-center) with Undo (restores the session) and Settings (opens the archived list)

Workspace group

The group head and session rows share --sb-*: folder icon (open/closed) → name, with the kebab and "+" revealed on hover.

  • The folder icon leads the row (switching icons between open and closed states) with the plain --sb-gap before the name — it does not pad out the --sb-gutter slot.
  • The name uses 500 weight with muted color (--color-text-muted, one step lighter than session titles), so group heads remain clear without competing with list content. No path subtitle; hovering the name shows the full root path in a Tooltip.
  • The kebab (menu) and "+" (new chat in this workspace) both use IconButton sm inside a floating actions layer anchored to the row's right edge — no reserved layout space, so the name uses the full row width when idle. Shown on hover, keyboard focus, or while the menu is open; the layer backs itself with the sidebar surface (container background) plus the row hover wash (an ::after shown only while the row is hovered), so its color exactly equals the row's current background and the overlapped name tail doesn't bleed through (hidden via opacity:0, staying in the tab order). On macOS desktop the layer paints nothing at all — the name's mask-image fade (see the sidebar section above) dissolves the tail before it reaches the buttons
  • The group is collapsible; when collapsed its session list is hidden.
  • While the active workspace has no session selected (the draft state — e.g. right after adding the workspace, or after New chat), the group head carries the same neutral --sb-selected fill as a selected session row (selection reads as "where I am"; the fill wins over hover). Once a session is selected or created, the fill moves to that session row.

Show more & collapse

The "expand / collapse" controls at the bottom of each workspace group are compact list controls (same family as search, New chat, inline rename — not Buttons) sharing one row: expand (chevron-down) first, collapse (chevron-up) after a faint middot when both are present. Expanding reveals the next batch of sessions, fetching the next page from the server only when the locally loaded rows can't cover it — the control never exposes whether a reveal came from memory or the network.

PartRule
Rowa single flex row holding the controls, all content-width — hover washes just the button as a snug pill, never the full row. Font-driven height (≈32px like a session row), radius-sm; hover = --sb-hover (no text recolor); :focus-visible uses --p-focus-ring
Chevronsm (down = expand, up = collapse); the row indents by --sb-gutter + --sb-gap so the first button's chevron starts exactly at the session-title x, lining the control's leading edge up with the titles above
Labelfont-ui, text-xs, --color-text-muted; truncated
Separatorfaint middot (--color-text-faint) with --space-1 side margins, rendered only when both controls are present
Behavioreach group keeps a display cap starting at the first page; "Show more" steps it up by one batch (5) and fetches the next page only when the loaded rows fall short (busy = "Loading…", disabled); "Show less" resets the cap to the first page (view-layer trim — data is kept, no refetch). "Show more" exists while undisplayed loaded rows remain or the server has more; "Show less" appears once past the first page

ResizeHandle

A 4px grab strip layered over the 1px column border (margin: 0 -2px makes the whole 4px grabbable) with a centred 2px indicator bar. The bar stays transparent at rest and shows the neutral fills one step up the ramp — f2 on hover, f3 while the drag is live (the sidebar column is translucent on macOS, so f1 read too faint) — never the accent.

RuleValue
Width / cursor4px strip, 2px bar / col-resize mid-range; w-resize / e-resize at the drag limits (hints the direction that still resizes)
Normal / hover / dragtransparent / --color-selected (f2) / --color-line-strong (f3) — the neutral ramp one step up, never accent
Layer--z-dropdown, above pane-level sticky chrome (chat dock at --z-sticky) so the overhang stays visible and grabbable
Behaviorpanel width follows the pointer 1:1 while dragging (the parent disables transitions to avoid lag); on release it is persisted to localStorage

Right panel

The right panels (file preview / Diff / compaction summary / sub-agent / side chat) share one track and one head primitive.

  • The panel head uses the PanelHeader primitive (48px = --panel-head-h), the same height as the conversation column head, so the hairline runs as one line.
  • Panel head: bold mono title + optional muted subtitle + middle slot (Badge / control / path) + close IconButton on the right.
  • When opened, the panel width snaps from 0 → var(--preview-w) with no animation, squeezing the conversation column in a single layout.
  • At ≤640px the panel becomes a full-screen overlay (position:fixed; inset:0).

Bottom terminal panel (desktop-only)

The native terminal (components/terminal/) sits in the conversation column's own bottom grid slot — the sidebar and the right panel span BOTH rows and keep full height (the VS Code layout: the panel belongs to the editor area, not to the whole window). Its height transitions 0 ↔ var(--terminal-h) (260px default, 120 min, 60% viewport max; persisted), squeezing the conversation column above instead of overlaying it. The panel mounts lazily on first open and then stays mounted so xterm scrollback survives a collapse.

  • Resize: a horizontal twin of the ResizeHandle (4px strip over the 0.5px top hairline, row-resize mid-range, n/s-resize at the limits, same neutral f2/f3 ramp, never accent). The shared useResizable hook owns it via axis: 'y'; the height var is written imperatively during a drag (same no-Vue-rerender rule as --preview-w).
  • Toolbar (32px, 0.5px bottom hairline): tab strip on the left — each tab is a compact radius-sm pill (leading terminal glyph, muted while exited + shell label + hover close affordance), the active tab uses --color-selected, hover --color-hover; a "+" action appends a tab. Tabs follow the §08 tablist keyboard model (roving tabindex, ←/→/Home/End), the close affordance is its own button (no nested interactives), and the height separator is keyboard-operable (↑/↓ in steps, value exposed). Trailing actions: restart (only while the active tab exited) and a collapse chevron. Collapsing sets inert on the region — the xterm instances and their scrollback stay mounted but leave the tab order.
  • The xterm canvas cannot resolve CSS variables either, so its palette is resolved from the live --color-* tokens at runtime (re-read on scheme flips; the ANSI hues the status ramp doesn't cover use dedicated --color-term-magenta/cyan tokens); the font is the app JetBrains Mono stack sized off the content token scale. While focused, the panel owns every key except the registered app shortcuts (chat-level Esc / find / select-all chords stay inert inside it).
  • Entries: the chat header's terminal IconButton (right of Open in, lit while the panel is open) — on the empty-composer state, where no chat header renders, the same button floats at the conversation's top-right instead — plus ctrl+` (⌃` on macOS — VS Code's binding; ⌘` stays free for the OS window switcher — customizable in the shortcut registry), and the View menu's Toggle Terminal item. New tabs spawn in the visible workspace root. Terminal state is per session: switching sessions swaps the visible bucket while the others keep their PTYs and xterm views alive (scrollback survives a round trip; the ten most recent sessions are kept, LRU). The panel never renders on mobile / web.
i
One-sentence principle: the sidebar / shell is a "list + grid" skeleton that reuses the §02 tokens and §03 primitives (Button / IconButton / Badge / Kbd / Menu / Spinner / PanelHeader); compact list controls that don't fit a primitive (search, New chat, inline rename, show-more) keep their custom form, governed by this section.
08

Accessibility (pragmatic edition)

Kimi Web is a local developer tool; it does not target a specific WCAG conformance level, nor maintain a full screen-reader QA matrix. This section collects only the rules that are "low-cost, don't hurt the look, and directly benefit keyboard-heavy users", as the baseline contract for each primitive; the more expensive, lower-ROI parts (such as real-time announcement orchestration for streaming output) are not mandatory for now.

i
On the "ugly" focus ring: the focus visibility required below always uses :focus-visible (not :focus). It appears only on keyboard focus; mouse clicks don't trigger it, so it doesn't pollute the mouse-driven visual; the ring's strength is tuned uniformly with --p-focus-ring, not overridden per place.

1. Contrast & color

  • Body text vs. background contrast ≥ 4.5:1; control borders, icons, and key graphics ≥ 3:1. When changing theme colors / dark mode, verify against §05 together.
  • Button text vs. button background, and form controls (input, placeholder, helper / error text) vs. their section background must all have contrast ≥ 4.5:1 (large text ≥ 3:1). White-on-white text, a transparent borderless button floating over the page background, and a light placeholder on a near-white background are all flagged by the style rules.
  • State is not conveyed by color alone. Error, selected, and disabled states also carry text, an icon, or a shape change (for example an error state is not just red, but also carries text or an icon).

2. Keyboard operable

Anything doable with a mouse must also be doable with a keyboard; Tab order follows the DOM, with no invented skipping. Composite controls define their keyboard model per the table below; a missing model is treated as incomplete:

ControlKeyboard behavior
DialogTab cycles within the dialog (focus trap); Esc closes; focus returns to the trigger element after closing.
Menu / move the highlight, Enter selects, Esc closes.
Tabs / switch tabs (roving tabindex); only the current tab is in the Tab sequence.
Switch / Segmented / or Space / Enter to toggle.

3. Focus visibility

  • Every interactive element must have a visible focus indicator on keyboard focus, uniformly via :focus-visible + --p-focus-ring (primary actions may use --p-focus-ring-strong).
  • Bare outline: none is forbidden. To remove the default outline, you must provide an equivalent replacement style.

4. Labels & semantics

  • Semantic HTML first (button / a / input / dialog…); ARIA is added only when native semantics fall short.
  • Icon-only buttons must have an aria-labelIconButton already enforces this with a required label prop.
  • Dialog: role="dialog" + aria-modal="true", with the title as the dialog's accessible name.
  • Purely decorative SVG / icons get aria-hidden="true" to avoid being read out by screen readers.

5. Target size

Desktop click targets ≥ 32px; touch devices ≥ 44px (consistent with the §01 principle and the IconButton lg tier).

6. Reduced motion

Handled uniformly in the global styles per §02's @media (prefers-reduced-motion: reduce); components do not check this individually. The chat working indicator's mascot renders its static fallback.

7. Live announcements (non-mandatory)

Screen-reader announcements are not a mandatory contract in this product. Short hints like Toast can use role="status" / aria-live; chat streaming output is currently not announced word-by-word, which is an acceptable trade-off, to be added later if a real need arises.

Explicitly not mandatory for now: a WCAG conformance-level claim, a complete ARIA pattern table, a per-screen-reader QA matrix, and real-time announcement orchestration for streaming output — these are not written into the primitive contract, to avoid becoming slogans no one maintains.
09

Dialogs

Every overlay in the app — pickers, browsers, managers, confirmations — is built on the single §03 Dialog primitive. This chapter fixes the two layout anatomies allowed inside that frame, plus the row and footer contracts that make all dialogs read as one family. Do not hand-roll a third anatomy.

The frame (recap)

All dialogs share the §03 primitive: --radius-xl radius, --shadow-xl shadow, a restrained 28% neutral backdrop, a head (title + IconButton close), a body, and a right-aligned foot. Widths md 440 / lg 640 / xl 760 and auto / fixed height are chosen per §03. One interruptive overlay at a time; Esc closes; focus is trapped and restored. A blocking flow that must be resolved rather than dismissed (server token) uses hideClose with closeOnOverlay/closeOnEsc off — never a hand-written overlay.

Anatomy A — padded (forms & confirmations)

The default: the body carries its own padding and the caller drops content straight in. Confirmations put their Buttons in the #foot slot (right-aligned, cancel → confirm). Used by: confirm, login, status panel, server token.

Anatomy B — flush (pickers & browsers)

:padded="false" with height="fixed"; the consumer owns the zone layout inside a full-height column. The zones below are the whole vocabulary — a picker dialog composes them and adds nothing else. Used by: model picker, session search, folder browser, provider manager.

ZoneContract
SearchThe boxed §03 Input, inset 22px so its edge aligns with the head title. Autofocus on open. No leading icon, no borderless variant.
Filter chipsOptional. 28px pill: transparent + muted text by default, --color-hover on hover, --color-selected + medium --color-text when active. Horizontally scrollable with the scrollbar hidden. Never a row of Buttons.
Listflex:1, owns the vertical scrolling, padded 4px 8px so rows bleed near the dialog edge. role="listbox"; rows carry role="option" + aria-selected.
Row8px 12px padding, --radius-md. Two quiet lines: name 14/20 (medium when current) and a meta line 12/18 in --color-text-faint — provider · context · capability labels, dot-separated. No badge rows, no raw-id line (search still matches them). Trailing slot: check icon (current row only), then the star IconButton.
Row statesHover / keyboard-selected → --color-hover; current → --color-selected — a neutral "where I am" fill, never an accent tint, never an inset stroke. The star stays hidden until row hover, keyboard selection, or starred; it is always visible on touch devices and colored --star when starred.
State rowsLoading / unavailable / empty: centered on both axes, muted 14px; warning color only for the unavailable case.
Shortcut barThe footer: full-bleed, padding 8px 16px, border-top --color-line, left-aligned. Keyboard hints are Kbd keycaps + 12px --color-text-faint labels, groups separated by "·", the whole bar aria-hidden. An instructional sentence (folder browser) reuses the same bar without keycaps.

Keyboard & behavior contract

  • / move a keyboard selection (rendered identical to hover) and always scrollIntoView({ block: 'nearest' }); Enter selects and closes; Esc closes.
  • Pointer hover drives the same selection index, so keyboard and mouse never disagree about which row is active.
  • Rows transition background only (--duration-fast ease-out); the open/close animation lives in the primitive, not in the consumer.
  • Selection is a fill, not a border (surface over stroke). Accent blue is reserved for actions — primary buttons and focus rings — never for "which row am I on".

Dialog map

DialogAnatomyComposition
Model pickerflush · lg · fixedsearch + provider chips + model rows + shortcut bar
Session searchflush · lg · fixedsearch + result rows + shortcut bar
Folder browserflush · lg · fixedbreadcrumb bar + filter bar + folder rows + actions + hint bar
Provider managerflush · xl · fixedmanagement rows with inset dividers (rows are not selectable) + add section + shortcut bar
Confirm / Login / Statuspadded · md · autotitle + message or form + right-aligned foot
App update (desktop)padded · lg · autoversion title + quiet meta line (release date · current version) + height-capped scrolling what's-new list / progress bar + right-aligned action row (skip → download, later → restart) with the auto-download checkbox right-aligned on its own foot row below (a pure preference for future checks)
Server tokenpadded · md · autohideClose, no Esc/overlay close — resolved only by a valid token
Settingsflush · xl · fixedpage-like exception: side-nav region, per §03
Onboarding wizardnot a Dialogfull-page takeover (not built on §03): one centered column (brand lockup → step content → ghost actions + centered primary CTA); selectable options share the option-card pattern — 0.5px --color-line hairline, --color-accent border + --color-accent-soft fill when selected
Design intent: a picker dialog should feel like a quiet command palette — one boxed search, calm rows, a neutral "you are here" fill, and a predictable shortcut bar. Anything noisier — badge clouds, accent-selected rows, per-dialog footer inventions — is a regression to weed out.
',5))])])])]))}}),Sa=M(ka,[["__scopeId","data-v-043da7f5"]]);export{Sa as default}; diff --git a/apps/kimi-code/dist-web/assets/DesignSystemView-BnL2v2lB.css b/apps/kimi-code/dist-web/assets/DesignSystemView-BnL2v2lB.css deleted file mode 100644 index dd72d689985..00000000000 --- a/apps/kimi-code/dist-web/assets/DesignSystemView-BnL2v2lB.css +++ /dev/null @@ -1 +0,0 @@ -.ds-page[data-v-043da7f5]{--d-bg: var(--color-bg);--d-surface: var(--color-surface);--d-surface-2: var(--color-surface-sunken);--d-surface-3: var(--color-line);--d-fg: var(--color-text);--d-fg-soft: var(--color-text-muted);--d-fg-muted: var(--color-text-muted);--d-fg-faint: var(--color-text-faint);--d-line: var(--color-line);--d-line-2: var(--color-line);--d-accent: var(--color-accent);--d-accent-2: var(--color-accent-hover);--d-accent-soft: var(--color-accent-soft);--d-accent-bd: var(--color-accent-bd);--d-green: var(--color-success);--d-green-soft: var(--color-success-soft);--d-amber: var(--color-warning);--d-amber-soft: var(--color-warning-soft);--d-red: var(--color-danger);--d-red-soft: var(--color-danger-soft);--d-violet: var(--color-done);--d-code-bg: var(--color-surface-sunken);--d-sidebar: var(--color-surface);--d-shadow-sm: var(--shadow-sm);--d-shadow-md: var(--shadow-md);--d-shadow-lg: var(--shadow-lg);--sidebar-w: var(--p-sidebar-w);--content-max: var(--p-content-wide)}.ds-page[data-v-043da7f5] *,.ds-page[data-v-043da7f5] *:before,.ds-page[data-v-043da7f5] *:after{box-sizing:border-box}.ds-page[data-v-043da7f5]{scroll-behavior:smooth}.ds-page[data-v-043da7f5]{margin:0;background:var(--d-bg);color:var(--color-text);font-family:var(--font-ui);font-size:var(--text-base);line-height:1.65;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}h1[data-v-043da7f5],h2[data-v-043da7f5],h3[data-v-043da7f5],h4[data-v-043da7f5]{color:var(--d-fg);letter-spacing:-.01em;line-height:1.25;margin:0}p[data-v-043da7f5]{margin:0 0 14px;color:var(--d-fg-soft)}a[data-v-043da7f5]{color:var(--d-accent-2);text-decoration:none}a[data-v-043da7f5]:hover{text-decoration:underline}code[data-v-043da7f5],pre[data-v-043da7f5],.mono[data-v-043da7f5]{font-family:JetBrains Mono,ui-monospace,SF Mono,Menlo,Consolas,monospace}code[data-v-043da7f5]{background:var(--d-code-bg);border:.5px solid var(--d-line-2);border-radius:5px;padding:1px 6px;font-size:.88em;color:#1f2937;white-space:nowrap}.layout[data-v-043da7f5]{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);min-height:100vh}.sidebar[data-v-043da7f5]{position:sticky;top:0;align-self:start;height:100vh;background:var(--d-sidebar);border-right:.5px solid var(--d-line);padding:26px 22px;overflow-y:auto}.brand[data-v-043da7f5]{display:flex;align-items:center;gap:10px;margin-bottom:6px}.brand-mark[data-v-043da7f5]{width:26px;height:26px;border-radius:7px;flex:none;background:var(--d-fg);color:#fff;display:grid;place-items:center;font-weight:800;font-size:14px;letter-spacing:-.04em}.brand-name[data-v-043da7f5]{font-weight:700;font-size:15px;letter-spacing:-.01em}.brand-sub[data-v-043da7f5]{font-size:12px;color:var(--d-fg-faint);margin-bottom:26px;padding-left:36px}.nav-group[data-v-043da7f5]{margin:22px 0 8px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--d-fg-faint)}.p-section-label[data-v-043da7f5]{font-size:12px;font-weight:600;text-transform:uppercase;color:var(--d-fg-faint)}.nav a[data-v-043da7f5]{display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:7px;font-size:13.5px;font-weight:500;color:var(--d-fg-soft);margin:1px 0;transition:background .15s,color .15s}.nav a .num[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:11px;color:var(--d-fg-faint);width:18px}.nav a[data-v-043da7f5]:hover{background:var(--color-hover);color:var(--d-fg);text-decoration:none}.nav a.active[data-v-043da7f5]{background:var(--color-hover);color:var(--d-fg)}.nav a.active .num[data-v-043da7f5]{color:var(--d-fg-soft)}.content[data-v-043da7f5]{min-width:0}.content-inner[data-v-043da7f5]{max-width:var(--content-max);margin:0 auto;padding:64px 56px 120px}section[data-v-043da7f5]{scroll-margin-top:32px;padding-top:8px}section+section[data-v-043da7f5]{margin-top:72px}.hero[data-v-043da7f5]{padding:8px 0 40px;border-bottom:.5px solid var(--d-line);margin-bottom:56px}.eyebrow[data-v-043da7f5]{display:inline-flex;align-items:center;gap:8px;font-family:JetBrains Mono,monospace;font-size:12px;font-weight:600;letter-spacing:.04em;color:var(--d-fg);background:#1783ff1a;border:none;padding:6px 12px;border-radius:8px;margin-bottom:22px}.hero h1[data-v-043da7f5]{font-size:48px;font-weight:600;line-height:1.08;letter-spacing:-.025em;margin-bottom:18px}.hero h1 .grad[data-v-043da7f5]{color:var(--d-accent)}.hero p.lead[data-v-043da7f5]{font-size:18px;line-height:1.6;color:var(--d-fg-soft);max-width:680px}.hero-meta[data-v-043da7f5]{display:flex;flex-wrap:wrap;gap:10px;margin-top:28px}.meta-chip[data-v-043da7f5]{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--d-fg-muted);background:var(--d-surface);border:.5px solid var(--d-line);border-radius:8px;padding:7px 12px}.meta-chip b[data-v-043da7f5]{color:var(--d-fg);font-weight:600}.meta-chip .dot[data-v-043da7f5]{width:7px;height:7px;border-radius:50%;background:var(--d-green)}.sec-head[data-v-043da7f5]{display:flex;align-items:baseline;gap:14px;margin-bottom:8px}.sec-num[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:13px;font-weight:600;color:var(--d-accent-2)}.sec-title[data-v-043da7f5]{font-size:26px;letter-spacing:-.02em}.sec-desc[data-v-043da7f5]{font-size:15.5px;color:var(--d-fg-muted);max-width:720px;margin-bottom:28px}h3.sub[data-v-043da7f5]{font-size:17px;margin:40px 0 14px;display:flex;align-items:center;gap:10px}h3.sub[data-v-043da7f5]:before{content:"";width:4px;height:16px;border-radius:2px;background:var(--d-accent)}h4.mini[data-v-043da7f5]{font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:var(--d-fg-muted);margin:24px 0 12px}.stat-grid[data-v-043da7f5]{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:24px 0}.stat[data-v-043da7f5]{background:var(--d-surface);border:.5px solid var(--d-line);border-radius:14px;padding:18px 18px 16px}.stat .v[data-v-043da7f5]{font-size:34px;font-weight:800;letter-spacing:-.03em;line-height:1;color:var(--d-fg)}.stat .v small[data-v-043da7f5]{font-size:16px;color:var(--d-fg-muted);font-weight:600}.stat .l[data-v-043da7f5]{font-size:12.5px;color:var(--d-fg-muted);margin-top:8px;line-height:1.4}.stat.warn[data-v-043da7f5]{background:var(--d-amber-soft);border-color:#f0d9b8}.stat.warn .v[data-v-043da7f5]{color:var(--d-amber)}.stat.bad[data-v-043da7f5]{background:var(--d-red-soft);border-color:#f0cccc}.stat.bad .v[data-v-043da7f5]{color:var(--d-red)}.stat.good[data-v-043da7f5]{background:var(--d-green-soft);border-color:#bfe3cc}.stat.good .v[data-v-043da7f5]{color:var(--d-green)}.panel[data-v-043da7f5]{background:var(--d-bg);border:.5px solid var(--d-line);border-radius:16px;box-shadow:var(--d-shadow-sm)}.panel-pad[data-v-043da7f5]{padding:22px}.panel-soft[data-v-043da7f5]{background:var(--d-surface);border:.5px solid var(--d-line);border-radius:14px}.callout[data-v-043da7f5]{display:flex;gap:12px;padding:14px 16px;border-radius:12px;font-size:14px;line-height:1.55;background:var(--d-surface);border:.5px solid var(--d-line);color:var(--d-fg-soft);margin:18px 0}.callout .ico[data-v-043da7f5]{flex:none;width:20px;height:20px;border-radius:6px;display:grid;place-items:center;font-size:12px;font-weight:800}.callout.info[data-v-043da7f5]{background:var(--d-accent-soft);border-color:var(--d-accent-bd)}.callout.info .ico[data-v-043da7f5]{background:var(--d-accent);color:#fff}.callout.warn[data-v-043da7f5]{background:var(--d-amber-soft);border-color:#f0d9b8}.callout.warn .ico[data-v-043da7f5]{background:var(--d-amber);color:#fff}.callout.good[data-v-043da7f5]{background:var(--d-green-soft);border-color:#bfe3cc}.callout.good .ico[data-v-043da7f5]{background:var(--d-green);color:#fff}table.dt[data-v-043da7f5]{width:100%;border-collapse:collapse;font-size:13.5px;margin:16px 0}table.dt th[data-v-043da7f5]{text-align:left;font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--d-fg-faint);font-weight:700;padding:10px 12px;border-bottom:.5px solid var(--d-line)}table.dt td[data-v-043da7f5]{padding:11px 12px;border-bottom:.5px solid var(--d-line-2);color:var(--d-fg-soft);vertical-align:middle}table.dt tr:last-child td[data-v-043da7f5]{border-bottom:none}table.dt td.tk[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:12.5px;color:var(--d-fg);white-space:nowrap}table.dt td.val[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.swatch[data-v-043da7f5]{display:inline-block;width:16px;height:16px;border-radius:4px;border:.5px solid rgba(0,0,0,.08);vertical-align:-3px;margin-right:8px}.palette[data-v-043da7f5]{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:16px 0}.color-card[data-v-043da7f5]{border:.5px solid var(--d-line);border-radius:12px;overflow:hidden;background:var(--d-bg)}.color-chip[data-v-043da7f5]{height:56px;border-bottom:.5px solid var(--d-line)}.color-meta[data-v-043da7f5]{padding:10px 12px 12px}.color-meta .cn[data-v-043da7f5]{font-size:13px;font-weight:600;color:var(--d-fg)}.color-meta .cv[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:11.5px;color:var(--d-fg-muted);margin-top:2px}.type-row[data-v-043da7f5]{display:flex;align-items:baseline;gap:18px;padding:13px 0;border-bottom:.5px solid var(--d-line-2)}.type-row[data-v-043da7f5]:last-child{border-bottom:none}.type-sample[data-v-043da7f5]{flex:1;color:var(--d-fg);line-height:1.2}.type-meta[data-v-043da7f5]{width:190px;flex:none;text-align:right;font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.space-row[data-v-043da7f5]{display:flex;align-items:center;gap:16px;padding:10px 0;border-bottom:.5px solid var(--d-line-2)}.space-row[data-v-043da7f5]:last-child{border-bottom:none}.space-bar[data-v-043da7f5]{height:18px;border-radius:4px;background:linear-gradient(90deg,var(--d-accent),var(--d-accent-2));flex:none}.space-meta[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:12.5px;color:var(--d-fg-soft);width:150px}.space-use[data-v-043da7f5]{font-size:12.5px;color:var(--d-fg-muted)}.radius-grid[data-v-043da7f5]{display:flex;flex-wrap:wrap;gap:22px;align-items:flex-end;margin:16px 0}.radius-item[data-v-043da7f5]{display:flex;flex-direction:column;align-items:center;gap:10px}.radius-box[data-v-043da7f5]{width:64px;height:64px;border:.5px solid var(--d-accent);background:var(--d-accent-soft)}.radius-item .rl[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-soft)}.stage-wrap[data-v-043da7f5]{border:.5px solid var(--d-line);border-radius:16px;overflow:hidden;margin:18px 0;background:var(--d-bg);box-shadow:var(--d-shadow-sm)}.stage-bar[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:.5px solid var(--d-line);background:var(--d-surface)}.stage-bar .st[data-v-043da7f5]{font-size:13px;font-weight:600;color:var(--d-fg);display:flex;align-items:center;gap:8px}.stage-bar .st .tag[data-v-043da7f5]{font-size:10.5px;font-weight:700;letter-spacing:.04em;padding:2px 7px;border-radius:999px}.tag.after[data-v-043da7f5]{background:var(--d-green-soft);color:var(--d-green)}.tag.before[data-v-043da7f5]{background:var(--d-red-soft);color:var(--d-red)}.tag.spec[data-v-043da7f5]{background:var(--d-accent-soft);color:var(--d-accent-2)}.stage-bar .sactions[data-v-043da7f5]{display:flex;gap:6px}.tab[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:11.5px;padding:4px 10px;border-radius:6px;color:var(--d-fg-muted);cursor:default}.tab.on[data-v-043da7f5]{background:var(--d-bg);color:var(--d-fg);border:.5px solid var(--d-line)}.stage[data-v-043da7f5]{padding:32px;display:flex;flex-wrap:wrap;align-items:center;gap:16px;background:radial-gradient(circle at 1px 1px,rgba(0,0,0,.045) 1px,transparent 0) 0 0 / 18px 18px,var(--d-surface)}.stage.col[data-v-043da7f5]{flex-direction:column;align-items:stretch}.stage.dark[data-v-043da7f5]{background:radial-gradient(circle at 1px 1px,rgba(255,255,255,.06) 1px,transparent 0) 0 0 / 18px 18px,#0d1117}.stage-label[data-v-043da7f5]{width:100%;font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--d-fg-faint);margin-bottom:-6px}.stage.dark .stage-label[data-v-043da7f5]{color:#6b7280}.ba[data-v-043da7f5]{display:grid;grid-template-columns:1fr 1fr;gap:0;border:.5px solid var(--d-line);border-radius:16px;overflow:hidden;margin:18px 0;box-shadow:var(--d-shadow-sm)}.ba-col[data-v-043da7f5]{min-width:0}.ba-col+.ba-col[data-v-043da7f5]{border-left:.5px solid var(--d-line)}.ba-head[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;padding:11px 16px;border-bottom:.5px solid var(--d-line)}.ba-head.before[data-v-043da7f5]{background:var(--d-red-soft)}.ba-head.after[data-v-043da7f5]{background:var(--d-green-soft)}.ba-head .bh[data-v-043da7f5]{font-size:13px;font-weight:700}.ba-head.before .bh[data-v-043da7f5]{color:var(--d-red)}.ba-head.after .bh[data-v-043da7f5]{color:var(--d-green)}.ba-head .bh small[data-v-043da7f5]{font-weight:500;opacity:.7;margin-left:6px}.ba-body[data-v-043da7f5]{padding:24px;background:var(--d-surface);min-height:120px}.ba-col.after .ba-body[data-v-043da7f5]{background:#fff}.code[data-v-043da7f5]{background:#0d1117;border-radius:12px;overflow:hidden;margin:16px 0;border:.5px solid #1c2128}.code-bar[data-v-043da7f5]{display:flex;align-items:center;gap:8px;padding:9px 14px;background:#13181e;border-bottom:.5px solid #1c2128}.code-bar .d[data-v-043da7f5]{width:10px;height:10px;border-radius:50%;background:#30363d}.code-bar .fn[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:11.5px;color:#8b949e;margin-left:4px}.code pre[data-v-043da7f5]{margin:0;padding:18px;overflow-x:auto;font-size:12.5px;line-height:1.7;color:#c9d1d9}.code .c[data-v-043da7f5]{color:#8b949e}.code .k[data-v-043da7f5]{color:#ff7b72}.code .s[data-v-043da7f5]{color:#a5d6ff}.code .p[data-v-043da7f5]{color:#79c0ff}.code .n[data-v-043da7f5]{color:#d2a8ff}.code .v[data-v-043da7f5]{color:#ffa657}.pill[data-v-043da7f5]{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:3px 9px;border-radius:999px;border:.5px solid var(--d-line);background:var(--d-surface);color:var(--d-fg-soft)}.pill.blue[data-v-043da7f5]{background:var(--d-accent-soft);border-color:var(--d-accent-bd);color:var(--d-accent-2)}.pill.green[data-v-043da7f5]{background:var(--d-green-soft);border-color:#bfe3cc;color:var(--d-green)}.pill.amber[data-v-043da7f5]{background:var(--d-amber-soft);border-color:#f0d9b8;color:var(--d-amber)}.pill.red[data-v-043da7f5]{background:var(--d-red-soft);border-color:#f0cccc;color:var(--d-red)}.pill.mono[data-v-043da7f5]{font-family:JetBrains Mono,monospace}ul.clean[data-v-043da7f5]{list-style:none;padding:0;margin:14px 0}ul.clean li[data-v-043da7f5]{position:relative;padding:8px 0 8px 26px;color:var(--d-fg-soft);border-bottom:.5px solid var(--d-line-2)}ul.clean li[data-v-043da7f5]:last-child{border-bottom:none}ul.clean li[data-v-043da7f5]:before{content:"";position:absolute;left:4px;top:17px;width:7px;height:7px;border-radius:50%;background:var(--d-accent)}ul.clean.check li[data-v-043da7f5]:before{content:"✓";background:none;color:var(--d-green);font-weight:800;top:7px;left:0;font-size:14px}ul.clean.cross li[data-v-043da7f5]:before{content:"✕";background:none;color:var(--d-red);font-weight:800;top:7px;left:0;font-size:13px}ul.clean li b[data-v-043da7f5]{color:var(--d-fg)}ul.clean li .path[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.roadmap[data-v-043da7f5]{position:relative;margin:24px 0}.phase[data-v-043da7f5]{position:relative;display:grid;grid-template-columns:120px 1fr;gap:24px;padding:0 0 32px}.phase[data-v-043da7f5]:not(:last-child):after{content:"";position:absolute;left:59px;top:36px;bottom:0;width:2px;background:var(--d-line)}.phase-tag[data-v-043da7f5]{text-align:right;padding-top:4px}.phase-tag .pt[data-v-043da7f5]{display:inline-block;font-family:JetBrains Mono,monospace;font-size:12px;font-weight:700;color:var(--d-accent-2);background:var(--d-accent-soft);border:.5px solid var(--d-accent-bd);padding:5px 10px;border-radius:8px}.phase-tag .pe[data-v-043da7f5]{font-size:11.5px;color:var(--d-fg-faint);margin-top:8px}.phase-body[data-v-043da7f5]{background:var(--d-bg);border:.5px solid var(--d-line);border-radius:14px;padding:18px 20px;box-shadow:var(--d-shadow-sm)}.phase-body h4[data-v-043da7f5]{font-size:16px;margin-bottom:8px}.phase-body p[data-v-043da7f5]{font-size:14px;margin-bottom:12px}.phase-body ul[data-v-043da7f5]{margin:0}.matrix[data-v-043da7f5]{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:16px 0}.anti[data-v-043da7f5]{border:.5px solid var(--d-line);border-radius:12px;padding:16px;background:var(--d-bg)}.anti .ah[data-v-043da7f5]{display:flex;align-items:center;gap:9px;font-size:14px;font-weight:700;margin-bottom:8px}.anti .ah .verdict[data-v-043da7f5]{margin-left:auto;font-size:11px;font-weight:800;padding:2px 8px;border-radius:999px}.verdict.pass[data-v-043da7f5]{background:var(--d-green-soft);color:var(--d-green)}.verdict.fail[data-v-043da7f5]{background:var(--d-red-soft);color:var(--d-red)}.verdict.warn[data-v-043da7f5]{background:var(--d-amber-soft);color:var(--d-amber)}.anti p[data-v-043da7f5]{font-size:13px;margin:0;color:var(--d-fg-muted)}.footer[data-v-043da7f5]{margin-top:80px;padding-top:28px;border-top:.5px solid var(--d-line);font-size:13px;color:var(--d-fg-faint);display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}.kbd[data-v-043da7f5]{font-family:JetBrains Mono,monospace;font-size:11px;background:var(--d-surface-2);border:.5px solid var(--d-line);border-radius:5px;padding:1px 6px}@media(max-width:980px){.layout[data-v-043da7f5]{grid-template-columns:1fr}.sidebar[data-v-043da7f5]{position:static;height:auto}.nav[data-v-043da7f5]{display:flex;flex-wrap:wrap;gap:4px}.content-inner[data-v-043da7f5]{padding:40px 22px 80px}.stat-grid[data-v-043da7f5]{grid-template-columns:repeat(2,1fr)}.ba[data-v-043da7f5]{grid-template-columns:1fr}.ba-col+.ba-col[data-v-043da7f5]{border-left:none;border-top:.5px solid var(--d-line)}.palette[data-v-043da7f5]{grid-template-columns:repeat(2,1fr)}.matrix[data-v-043da7f5]{grid-template-columns:1fr}}.ds-page .p[data-v-043da7f5],.ds-page .stage.p-skin[data-v-043da7f5],.ds-page [data-p][data-v-043da7f5]{--p-font-sans: var(--font-ui);--p-font-kbd: var(--font-kbd);--p-font-mono: var(--font-mono);--p-bg: var(--color-bg);--p-surface: var(--color-surface);--p-surface-raised: var(--color-surface-raised);--p-surface-overlay: var(--color-surface-overlay);--p-surface-sunken: var(--color-surface-sunken);--p-well: var(--color-well);--p-surface-deep: var(--color-surface-deep);--p-hover: var(--color-hover);--p-text: var(--color-text);--p-text-strong: var(--color-text-strong);--p-muted: var(--muted);--p-text-muted: var(--color-text-muted);--p-text-faint: var(--color-text-faint);--p-text-on-accent: var(--color-text-on-accent);--p-line: var(--color-line);--p-line-strong: var(--color-line-strong);--p-accent: var(--color-accent);--p-accent-hover: var(--color-accent-hover);--p-accent-soft: var(--color-accent-soft);--p-user-bubble-bg: var(--color-user-bubble-bg);--p-accent-bd: var(--color-accent-bd);--p-success: var(--color-success);--p-success-soft: var(--color-success-soft);--p-success-bd: var(--color-success-bd);--p-warning: var(--color-warning);--p-warning-soft: var(--color-warning-soft);--p-warning-bd: var(--color-warning-bd);--p-danger: var(--color-danger);--p-danger-soft: var(--color-danger-soft);--p-danger-bd: var(--color-danger-bd);--p-info: var(--color-info);--p-sp-1: var(--space-1);--p-sp-2: var(--space-2);--p-sp-3: var(--space-3);--p-sp-4: var(--space-4);--p-sp-5: var(--space-5);--p-sp-6: var(--space-6);--p-sp-8: var(--space-8);--p-r-xs: var(--radius-xs);--p-r-sm: var(--radius-sm);--p-r-md: var(--radius-md);--p-r-lg: var(--radius-lg);--p-r-xl: var(--radius-xl);--p-r-composer: var(--radius-composer);--p-r-full: var(--radius-full);--p-corner-composer: var(--corner-shape-composer);--p-sh-xs: var(--shadow-xs);--p-sh-sm: var(--shadow-sm);--p-sh-menu: var(--shadow-menu);--p-sh-md: var(--shadow-md);--p-sh-input: var(--shadow-input);--p-sh-lg: var(--shadow-lg);--p-sh-xl: var(--shadow-xl);--p-font-size-xs: var(--text-xs);--p-font-size-sm: var(--text-sm);--p-font-size-base: var(--text-base);--p-font-size-md: var(--text-base);--p-font-size-lg: var(--text-lg);--p-font-size-xl: var(--text-xl);--p-font-size-2xl: var(--text-2xl);--p-leading-tight: var(--leading-tight);--p-leading-normal: var(--leading-normal);--p-leading-relaxed: var(--leading-relaxed);--p-ease: var(--ease-out);--p-ease-inout: var(--ease-in-out);--p-dur-fast: var(--duration-fast);--p-dur: var(--duration-base);--p-dur-slow: var(--duration-slow);--p-composer-focus-line: var(--color-composer-focus-line);font-family:var(--font-ui);color:var(--color-text);font-size:var(--text-base)}[data-p=dark][data-v-043da7f5]{--p-bg: #0d1117;--p-surface: #13181e;--p-surface-raised: #1c2128;--p-surface-sunken: #0d1117;--p-well: #13181e;--p-surface-deep: #0a0d12;--p-surface-overlay: #22272e;--p-hover: #ffffff0d;--p-text: #e8eaed;--p-text-strong: #ffffff;--p-muted: #727983;--p-text-muted: #9aa0a8;--p-text-faint: #6b7280;--p-line: #2d333b;--p-line-strong: #3d444d;--p-accent: #58a6ff;--p-accent-hover: #79b8ff;--p-accent-soft: rgba(88,166,255,.14);--p-accent-bd: rgba(88,166,255,.28);--p-success: #3fb950;--p-success-soft: rgba(63,185,80,.14);--p-success-bd: rgba(63,185,80,.28);--p-warning: #d29922;--p-warning-soft: rgba(210,153,34,.14);--p-warning-bd: rgba(210,153,34,.28);--p-danger: #f85149;--p-danger-soft: rgba(248,81,73,.14);--p-danger-bd: rgba(248,81,73,.28);--p-sh-sm: 0 1px 2px rgba(0,0,0,.4);--p-sh-md: 0 4px 12px rgba(0,0,0,.45);--p-sh-lg: 0 12px 32px rgba(0,0,0,.55);--p-sh-input: var(--shadow-input);--p-selection: rgba(88,166,255,.32)}.p-ic[data-v-043da7f5]{width:16px;height:16px;flex:none;display:inline-block;vertical-align:middle}.p-btn[data-v-043da7f5]{--_h: 36px;--_px: 16px;--_fs: var(--p-font-size-base);--_r: var(--p-r-md);display:inline-flex;align-items:center;justify-content:center;gap:8px;height:var(--_h);padding:0 var(--_px);border-radius:var(--_r);font-family:var(--p-font-sans);font-size:var(--_fs);font-weight:600;line-height:1;border:.5px solid transparent;cursor:pointer;white-space:nowrap;transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease),transform var(--p-dur-fast) var(--p-ease)}.p-btn[data-v-043da7f5]:active{transform:scale(.98)}.p-btn[data-v-043da7f5]:focus-visible{outline:none;box-shadow:0 0 0 3px var(--p-accent-soft),0 0 0 1px var(--p-accent)}.p-btn .p-ic[data-v-043da7f5]{width:16px;height:16px}.p-btn.sm[data-v-043da7f5]{--_h: 30px;--_px: 12px;--_fs: var(--p-font-size-sm);--_r: var(--p-r-sm)}.p-btn.sm .p-ic[data-v-043da7f5]{width:14px;height:14px}.p-btn.lg[data-v-043da7f5]{--_h: 42px;--_px: 20px;--_fs: var(--p-font-size-md);--_r: var(--p-r-lg)}.p-btn.primary[data-v-043da7f5]{background:var(--p-accent);color:var(--p-text-on-accent);border-color:var(--p-accent);box-shadow:var(--p-sh-xs)}.p-btn.primary[data-v-043da7f5]:hover{background:var(--p-accent-hover);border-color:var(--p-accent-hover)}.p-btn.secondary[data-v-043da7f5]{background:var(--p-surface-raised);color:var(--p-text);border-color:var(--p-line-strong);box-shadow:var(--p-sh-xs)}.p-btn.secondary[data-v-043da7f5]:hover{background:var(--p-hover);border-color:var(--p-line-strong)}.p-btn.ghost[data-v-043da7f5]{background:transparent;color:var(--p-text);border-color:transparent}.p-btn.ghost[data-v-043da7f5]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-btn.danger[data-v-043da7f5]{background:var(--p-danger);color:#fff;border-color:var(--p-danger);box-shadow:var(--p-sh-xs)}.p-btn.danger[data-v-043da7f5]:hover{filter:brightness(.96)}.p-btn.danger-soft[data-v-043da7f5]{background:var(--p-danger-soft);color:var(--p-danger);border-color:var(--p-danger-bd)}.p-btn.danger-soft[data-v-043da7f5]:hover{background:var(--p-danger);color:#fff;border-color:var(--p-danger)}.p-btn[disabled][data-v-043da7f5],.p-btn.disabled[data-v-043da7f5]{opacity:.5;cursor:not-allowed;box-shadow:none;transform:none}.p-icon-btn[data-v-043da7f5]{--_s: 32px;display:inline-grid;place-items:center;width:var(--_s);height:var(--_s);flex:none;border-radius:var(--p-r-md);border:.5px solid transparent;background:transparent;color:var(--p-text-muted);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-icon-btn[data-v-043da7f5]:hover{background:var(--p-hover);color:var(--p-text)}.p-icon-btn[data-v-043da7f5]:focus-visible{outline:none;box-shadow:0 0 0 3px var(--p-accent-soft)}.p-icon-btn.sm[data-v-043da7f5]{--_s: 26px;border-radius:var(--p-r-sm)}.p-icon-btn.lg[data-v-043da7f5]{--_s: 44px}.p-icon-btn .p-ic[data-v-043da7f5]{width:16px;height:16px}.p-icon-btn.lg .p-ic[data-v-043da7f5]{width:20px;height:20px}.p-badge[data-v-043da7f5]{display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:var(--p-r-full);font-family:var(--p-font-sans);font-size:var(--p-font-size-xs);font-weight:600;line-height:1;border:.5px solid var(--p-line);background:var(--p-surface);color:var(--p-text);white-space:nowrap}.p-badge.sm[data-v-043da7f5]{height:18px;padding:0 7px;font-size:11px}.p-badge .bd[data-v-043da7f5]{width:7px;height:7px;border-radius:50%;background:currentColor}.p-badge.neutral[data-v-043da7f5]{background:var(--p-surface-sunken);border-color:var(--p-line);color:var(--p-text-muted)}.p-badge.info[data-v-043da7f5]{background:var(--p-accent-soft);border-color:var(--p-accent-bd);color:var(--p-accent-hover)}.p-badge.success[data-v-043da7f5]{background:var(--p-success-soft);border-color:var(--p-success-bd);color:var(--p-success)}.p-badge.warning[data-v-043da7f5]{background:var(--p-warning-soft);border-color:var(--p-warning-bd);color:var(--p-warning)}.p-badge.danger[data-v-043da7f5]{background:var(--p-danger-soft);border-color:var(--p-danger-bd);color:var(--p-danger)}.p-badge.solid[data-v-043da7f5]{background:var(--p-text);color:var(--p-bg);border-color:var(--p-text)}.p-badge .p-ic[data-v-043da7f5]{width:12px;height:12px}.p-kbd[data-v-043da7f5]{display:inline-flex;align-items:center;gap:3px}.p-kbd kbd[data-v-043da7f5]{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border:.5px solid var(--p-line);border-radius:var(--p-r-xs);background:transparent;color:inherit;font-family:var(--p-font-kbd);font-size:11px;line-height:1}.p-pill[data-v-043da7f5]{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 12px;border-radius:var(--p-r-full);border:.5px solid transparent;background:transparent;font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-pill[data-v-043da7f5]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-pill .pp-strong[data-v-043da7f5]{font-weight:700;color:var(--p-text)}.p-pill .pp-sub[data-v-043da7f5]{color:var(--p-accent);font-weight:600}.p-pill .p-ic[data-v-043da7f5]{width:14px;height:14px;color:var(--p-text-faint)}.p-card[data-v-043da7f5]{background:var(--p-surface);border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;color:var(--p-text)}.p-card.interactive[data-v-043da7f5]{transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease);cursor:pointer}.p-card.interactive[data-v-043da7f5]:hover{background:var(--p-surface);border-color:var(--p-line-strong)}.p-card-head[data-v-043da7f5]{display:flex;align-items:center;gap:9px;padding:10px 14px;border-bottom:.5px solid var(--p-line);background:var(--p-surface)}.p-card-title[data-v-043da7f5]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text);font-family:var(--p-font-mono)}.p-card-body[data-v-043da7f5]{padding:14px;font-size:var(--p-font-size-base);color:var(--p-text);line-height:var(--p-leading-normal)}.p-card-foot[data-v-043da7f5]{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:.5px solid var(--p-line);background:var(--p-surface)}.p-field[data-v-043da7f5]{display:flex;flex-direction:column;gap:6px}.p-label[data-v-043da7f5]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text)}.p-input[data-v-043da7f5],.p-select[data-v-043da7f5],.p-textarea[data-v-043da7f5]{width:100%;height:38px;padding:0 12px;border-radius:var(--p-r-md);border:.5px solid var(--p-line-strong);background:var(--p-surface-raised);font-family:var(--p-font-sans);font-size:var(--p-font-size-base);color:var(--p-text);box-shadow:var(--p-sh-xs);transition:border-color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease)}.p-textarea[data-v-043da7f5]{height:auto;min-height:84px;padding:10px 12px;resize:vertical;line-height:var(--p-leading-normal)}.p-select[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;text-align:left}.p-select[data-v-043da7f5]:after{content:"⌄";color:var(--p-text-muted)}.p-input[data-v-043da7f5]:hover,.p-select[data-v-043da7f5]:hover,.p-textarea[data-v-043da7f5]:hover{border-color:var(--p-line-strong)}.p-input[data-v-043da7f5]:focus,.p-select[data-v-043da7f5]:focus,.p-textarea[data-v-043da7f5]:focus{outline:none;border-color:var(--p-accent);box-shadow:0 0 0 3px var(--p-accent-soft)}.p-input[data-v-043da7f5]::placeholder,.p-textarea[data-v-043da7f5]::placeholder{color:var(--p-text-faint)}.p-input.sm[data-v-043da7f5]{height:32px;font-size:var(--p-font-size-sm);border-radius:var(--p-r-sm)}.p-hint[data-v-043da7f5]{font-size:var(--p-font-size-xs);color:var(--p-text-faint)}.p-dialog[data-v-043da7f5]{width:480px;max-width:calc(100vw - 48px);background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-xl);box-shadow:var(--p-sh-xl);overflow:hidden;color:var(--p-text)}.p-dialog-head[data-v-043da7f5]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:20px 22px 14px}.p-dialog-title[data-v-043da7f5]{font-size:var(--p-font-size-lg);font-weight:700;letter-spacing:-.01em}.p-dialog-desc[data-v-043da7f5]{font-size:var(--p-font-size-base);color:var(--p-text-muted);margin-top:4px;line-height:var(--p-leading-normal)}.p-dialog-body[data-v-043da7f5]{padding:4px 22px 18px}.p-dialog-foot[data-v-043da7f5]{display:flex;justify-content:flex-end;gap:10px;padding:14px 22px 20px}.p-toast[data-v-043da7f5]{display:flex;align-items:flex-start;gap:11px;width:360px;padding:13px 14px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-md)}.p-toast .ti[data-v-043da7f5]{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;flex:none;margin-top:1px}.p-toast.success .ti[data-v-043da7f5]{background:var(--p-success-soft);color:var(--p-success)}.p-toast.warning .ti[data-v-043da7f5]{background:var(--p-warning-soft);color:var(--p-warning)}.p-toast .tt[data-v-043da7f5]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-toast .td[data-v-043da7f5]{font-size:var(--p-font-size-sm);color:var(--p-text-muted);margin-top:2px;line-height:1.45}.p-action-toast[data-v-043da7f5]{display:inline-flex;align-items:center;gap:8px;align-self:center;padding:4px 6px 4px 14px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-sm);font-size:var(--p-font-size-base);color:var(--p-text);white-space:nowrap}.p-action-toast .lk[data-v-043da7f5]{border:0;padding:0;background:none;color:var(--p-accent);cursor:pointer;font:inherit}.p-action-toast .x[data-v-043da7f5]{color:var(--p-text-muted);width:14px;height:14px}.p-spinner[data-v-043da7f5]{width:18px;height:18px;animation:p-spin-043da7f5 .85s linear infinite}.p-spinner.sm[data-v-043da7f5]{width:14px;height:14px}.p-spinner circle[data-v-043da7f5]{fill:none;stroke-width:2.2;stroke-linecap:round}.p-spinner .track[data-v-043da7f5]{stroke:var(--p-line)}.p-spinner .arc[data-v-043da7f5]{stroke:var(--p-accent);stroke-dasharray:56 56;stroke-dashoffset:38}@keyframes p-spin-043da7f5{to{transform:rotate(360deg)}}.p-thinking[data-v-043da7f5]{display:inline-flex;align-items:center;gap:9px;font-size:var(--p-font-size-sm);color:var(--p-text-muted);font-family:var(--p-font-sans)}.p-bubble-user[data-v-043da7f5]{align-self:flex-end;max-width:78%;background:var(--p-user-bubble-bg);border:none;color:var(--p-text);border-radius:var(--p-r-lg);padding:10px 12px;font-size:var(--p-font-size-md);line-height:var(--p-leading-normal)}.p-msg[data-v-043da7f5]{max-width:760px;font-size:var(--p-font-size-md);line-height:var(--p-leading-relaxed);color:var(--p-text)}.p-msg p[data-v-043da7f5]{margin:0 0 10px;color:var(--p-text)}.p-msg code[data-v-043da7f5]{font-family:var(--p-font-mono);background:var(--p-surface-sunken);border:0;color:var(--p-accent-hover);padding:1px 6px;border-radius:5px;font-size:.9em}.p-code[data-v-043da7f5]{font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);line-height:1.65;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);padding:11px 13px;color:var(--p-text);overflow-x:auto}.p-action[data-v-043da7f5]{border-radius:var(--p-r-lg);overflow:hidden;border:.5px solid var(--p-line);background:var(--p-surface-raised);box-shadow:var(--p-sh-menu)}.p-action-head[data-v-043da7f5]{display:flex;align-items:center;gap:9px;padding:14px 16px 0}.p-action-title[data-v-043da7f5]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-action-body[data-v-043da7f5]{padding:12px 16px 0;font-size:var(--p-font-size-base);color:var(--p-text);line-height:var(--p-leading-normal)}.p-action-foot[data-v-043da7f5]{display:flex;gap:8px;margin-top:12px;padding:10px 16px;border-top:.5px solid var(--p-line)}.p-opts[data-v-043da7f5]{display:flex;flex-direction:column;gap:2px;margin-top:12px;padding:12px 16px;border-top:.5px solid var(--p-line)}.p-opt[data-v-043da7f5]{display:flex;align-items:flex-start;gap:10px;padding:8px 12px;border-radius:var(--p-r-md);color:var(--p-text);font-size:var(--p-font-size-base)}.p-opt .n[data-v-043da7f5]{width:var(--p-chip-num);height:var(--p-chip-num);margin-top:calc((var(--p-font-size-base) * var(--p-leading-normal) - var(--p-chip-num)) / 2);border-radius:var(--p-r-sm);background:var(--p-surface-sunken);color:var(--p-text);font-size:var(--p-font-size-xs);font-weight:500;display:inline-flex;align-items:center;justify-content:center;flex:none}.p-opt-text[data-v-043da7f5]{display:flex;flex-direction:column;gap:2px;min-width:0}.p-opt-text .l[data-v-043da7f5]{font-weight:500}.p-opt-text .d[data-v-043da7f5]{font-size:var(--p-font-size-xs);color:var(--p-text-muted);line-height:var(--p-leading-normal)}.p-todo[data-v-043da7f5]{background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-md);padding:6px}.p-todo-row[data-v-043da7f5]{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--p-r-md);font-size:var(--p-font-size-base);color:var(--p-text)}.p-todo-row.done[data-v-043da7f5]{color:var(--p-text-faint);text-decoration:line-through}.p-todo-row.active[data-v-043da7f5]{background:var(--p-accent-soft);color:var(--p-text)}.p-todo-check[data-v-043da7f5]{width:16px;flex:none;display:inline-flex;align-items:center;justify-content:center;user-select:none;color:var(--p-text-faint)}.p-todo-check svg[data-v-043da7f5]{width:14px;height:14px}.p-todo-row.active .p-todo-check[data-v-043da7f5]{color:var(--p-accent)}.p-todo-row.done .p-todo-check[data-v-043da7f5]{color:var(--p-success)}.p-todo-row.active .p-todo-check[data-v-043da7f5]{color:var(--p-accent);font-weight:500}.p-dot[data-v-043da7f5]{width:7px;height:7px;border-radius:50%;flex:none;background:var(--p-text-faint)}.p-dot.done[data-v-043da7f5]{background:var(--p-success)}.p-dot.error[data-v-043da7f5]{background:var(--p-danger)}.p-dot.running[data-v-043da7f5]{background:var(--p-accent);box-shadow:0 0 0 0 var(--p-accent-soft);animation:p-pulse-043da7f5 1.4s ease-out infinite}@keyframes p-pulse-043da7f5{0%{box-shadow:0 0 #1783ff66}to{box-shadow:0 0 0 6px #1783ff00}}.p-tool-group[data-v-043da7f5]{overflow:hidden}.p-tool-group-head[data-v-043da7f5]{display:flex;align-items:center;gap:4px;padding:4px 0;cursor:pointer;border-radius:6px;font-size:var(--p-font-size-sm);line-height:1;color:var(--p-text-faint);user-select:none;transition:color var(--p-dur) var(--p-ease)}.p-tool-group-head .tg-ic[data-v-043da7f5]{width:14px;height:14px;color:var(--p-text-faint);flex:none}.p-tool-group-head[data-v-043da7f5]:hover{color:var(--p-text)}.p-tool-group-head .tg-title[data-v-043da7f5]{font-weight:500}.p-tool-group-head .tg-meta[data-v-043da7f5]{color:var(--p-text-faint);font-weight:400}.p-tool-group-head .tg-car[data-v-043da7f5]{width:14px;height:14px;color:var(--p-text-faint);transition:transform var(--p-dur) var(--p-ease)}.p-tool-group.open .p-tool-group-head .tg-car[data-v-043da7f5]{transform:rotate(90deg)}.p-tool-row[data-v-043da7f5]{position:relative;display:flex;align-items:center;gap:4px;padding:4px 0;border-radius:6px;cursor:pointer;font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);line-height:1;color:var(--p-text)}.p-tool-row .tr-ic[data-v-043da7f5]{width:14px;height:14px;color:var(--p-text-faint);flex:none}.p-tool-row .tr-name[data-v-043da7f5]{font-weight:400;color:var(--p-text-muted);flex:none}.p-tool-row .tr-file[data-v-043da7f5]{font-weight:400;color:var(--p-text);flex:none}.p-tool-row .tr-file[data-v-043da7f5]:hover{color:var(--p-accent);text-decoration:underline;text-underline-offset:3px}.p-tool-row .tr-mono[data-v-043da7f5]{font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);line-height:normal;font-feature-settings:"liga" 0,"calt" 0;font-variant-ligatures:none;color:var(--p-text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.p-tool-row .tr-faint[data-v-043da7f5]{color:var(--p-text-faint);line-height:var(--leading-tight);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.p-tool-row .tr-chip[data-v-043da7f5]{margin-left:auto;color:var(--p-text-faint);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-add[data-v-043da7f5]{margin-left:auto;color:var(--p-success);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-add~.tr-chip[data-v-043da7f5],.p-tool-row .tr-add~.tr-add[data-v-043da7f5]{margin-left:0}.p-tool-row .tr-del[data-v-043da7f5]{color:var(--p-danger);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-bar[data-v-043da7f5]{display:inline-flex;width:36px;height:3px;border-radius:999px;overflow:hidden;gap:1px;flex:none}.p-tool-row .tr-ok[data-v-043da7f5]{color:var(--p-success);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-car[data-v-043da7f5]{width:13px;height:13px;color:var(--p-text-faint);flex:none;transition:transform var(--p-dur) var(--p-ease)}.p-agent-card[data-v-043da7f5]{display:flex;align-items:center;gap:8px;align-self:stretch;padding:8px 12px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);cursor:pointer}.p-agent-card .pa-ic[data-v-043da7f5]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;background:var(--p-surface-sunken);color:var(--p-text-muted);flex:none}.p-agent-card .pa-ic svg[data-v-043da7f5]{width:14px;height:14px}.p-agent-card .pa-main[data-v-043da7f5]{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}.p-agent-card .pa-task[data-v-043da7f5]{font-size:var(--p-font-size-sm);line-height:1.4;color:var(--p-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-agent-card .pa-type[data-v-043da7f5]{font-size:var(--p-font-size-xs);line-height:1.4;color:var(--p-text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-agent-card .pa-ok[data-v-043da7f5]{color:var(--p-success);font-size:var(--p-font-size-xs);flex:none}.p-agent-card .pa-go[data-v-043da7f5]{color:var(--p-text-faint);flex:none}.p-tool-row.expanded .tr-car[data-v-043da7f5]{transform:rotate(90deg)}.p-tool-detail[data-v-043da7f5]{padding:2px 8px 4px 0}.p-tool-detail .p-code[data-v-043da7f5]{margin-top:4px}.p-composer[data-v-043da7f5]{background:var(--p-surface-raised);border:.5px solid var(--p-line-strong);border-radius:var(--p-r-composer);corner-shape:var(--p-corner-composer);box-shadow:var(--p-sh-input);overflow:hidden;position:relative;z-index:1}.p-composer[data-v-043da7f5]:after{content:"";position:absolute;inset:0;border:inherit;border-color:var(--p-composer-focus-line);border-radius:var(--p-r-composer);corner-shape:var(--p-corner-composer);opacity:0;pointer-events:none;transition:opacity var(--p-dur-slow) var(--p-ease-inout)}.p-composer[data-v-043da7f5]:focus-within:after{opacity:1}.p-composer-ta[data-v-043da7f5]{padding:14px 16px 8px;font-family:var(--p-font-sans);font-size:var(--p-font-size-md);color:var(--p-text);line-height:var(--p-leading-normal);text-autospace:normal}.p-composer-ta.ph[data-v-043da7f5]{color:var(--p-text-faint)}.p-composer-bar[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px 8px}.p-composer-strip[data-v-043da7f5]{width:100%;max-width:620px;margin-top:calc(-1 * var(--space-4));display:flex;align-items:center;gap:var(--space-2);padding:calc(var(--space-4) + var(--space-2)) var(--space-2) var(--space-2);background:color-mix(in srgb,var(--color-hover) 60%,transparent);border-radius:0 0 var(--radius-2xl) var(--radius-2xl);font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);color:var(--p-text-faint);cursor:pointer}.p-composer-strip .p-ic[data-v-043da7f5]{width:16px;height:16px;color:var(--p-text-faint)}.p-composer-left[data-v-043da7f5],.p-composer-right[data-v-043da7f5]{display:flex;align-items:center;gap:4px}.p-composer .p-icon-btn[data-v-043da7f5]{border-radius:var(--p-r-full)}.p-send[data-v-043da7f5]{position:relative;width:32px;height:32px;border-radius:var(--p-r-full);display:grid;place-items:center;background:var(--p-text);color:var(--p-bg);border:none;cursor:pointer;box-shadow:var(--p-sh-xs);transition:transform var(--p-dur-fast) var(--p-ease)}.p-send[data-v-043da7f5]:after{content:"";position:absolute;inset:0;border-radius:var(--p-r-full);background:var(--p-bg);opacity:0;transition:opacity var(--p-dur-slow) var(--p-ease);pointer-events:none}.p-send[data-v-043da7f5]:hover:after{opacity:.28}.p-send[data-v-043da7f5]:active{transform:scale(.92)}.p-send .p-ic[data-v-043da7f5]{width:16px;height:16px}.p[data-v-043da7f5] ::selection,[data-p][data-v-043da7f5] ::selection{background:var(--p-selection)}.p-link[data-v-043da7f5]{color:var(--p-accent);text-decoration:none;font-family:var(--p-font-sans);transition:color var(--p-dur) var(--p-ease)}.p-link[data-v-043da7f5]:hover{color:var(--p-accent-hover);text-decoration:underline}.p-link[data-v-043da7f5]:focus-visible{outline:none;box-shadow:var(--p-focus-ring);border-radius:var(--p-r-xs)}.p-link.muted[data-v-043da7f5]{color:var(--p-text-muted)}.p-link.muted[data-v-043da7f5]:hover{color:var(--p-text)}.p-link .p-ic[data-v-043da7f5]{width:var(--p-ic-sm);height:var(--p-ic-sm);vertical-align:-2px}.p-menu[data-v-043da7f5]{background:var(--color-menu-bg);border:.5px solid var(--p-line);-webkit-backdrop-filter:var(--p-menu-backdrop);backdrop-filter:var(--p-menu-backdrop);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-sm);padding:3.5px;min-width:180px;font-family:var(--p-font-sans);color:var(--p-text)}.p-menu-item[data-v-043da7f5]{display:flex;align-items:center;gap:7px;padding:5px 9px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-sm);color:var(--p-text);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-menu-item[data-v-043da7f5]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-menu-item.active[data-v-043da7f5],.p-menu-item.active[data-v-043da7f5]:hover{background:var(--p-hover);color:var(--p-text)}.p-menu-item.danger[data-v-043da7f5]{color:var(--p-danger)}.p-menu-item.danger[data-v-043da7f5]:hover{background:var(--p-danger-soft);color:var(--p-danger)}.p-menu-item.disabled[data-v-043da7f5]{opacity:.5;cursor:not-allowed}.p-menu-item.disabled[data-v-043da7f5]:hover{background:transparent;color:var(--p-text)}.p-menu-item .p-ic[data-v-043da7f5]{width:var(--p-ic-sm);height:var(--p-ic-sm);color:var(--p-muted)}.p-menu-item:hover .p-ic[data-v-043da7f5]{color:var(--p-text-strong)}.p-menu-item.active .p-ic[data-v-043da7f5]{color:var(--p-accent-hover)}.p-menu-item.danger .p-ic[data-v-043da7f5]{color:var(--p-danger)}.p-menu-item.lg[data-v-043da7f5]{min-height:44px;padding:12px 14px;font-size:var(--p-font-size-sm)}.p-menu-sep[data-v-043da7f5]{height:1px;background:var(--p-line);margin:4px 0}.p-seg[data-v-043da7f5]{display:inline-flex;gap:2px;padding:2px;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);font-family:var(--p-font-sans)}.p-seg-item[data-v-043da7f5]{display:inline-flex;align-items:center;gap:4px;padding:5px 12px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text);cursor:pointer;white-space:nowrap;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease)}.p-seg-item[data-v-043da7f5]:hover{color:var(--p-text)}.p-seg-item.on[data-v-043da7f5]{background:var(--p-surface-raised);color:var(--p-text);box-shadow:var(--p-sh-sm)}.p-tabs[data-v-043da7f5]{display:flex;align-items:center;gap:0;border-bottom:.5px solid var(--p-line);font-family:var(--p-font-sans)}.p-tab[data-v-043da7f5]{padding:8px 14px;font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text-muted);cursor:pointer;white-space:nowrap;border-bottom:.5px solid transparent;margin-bottom:-.5px;transition:color var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease)}.p-tab[data-v-043da7f5]:hover{color:var(--p-text)}.p-tab.on[data-v-043da7f5]{color:var(--p-accent);border-bottom-color:var(--p-accent)}.p-switch[data-v-043da7f5]{position:relative;display:inline-block;width:36px;height:20px;flex:none;border-radius:var(--p-r-full);background:var(--p-line-strong);cursor:pointer;transition:background var(--p-dur) var(--p-ease)}.p-switch[data-v-043da7f5]:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:var(--p-r-full);background:var(--p-surface-raised);box-shadow:var(--p-sh-xs);transform-origin:left center;transition:transform var(--p-dur) var(--p-ease)}.p-switch[data-v-043da7f5]:hover:after{transform:scaleX(1.125)}.p-switch.on[data-v-043da7f5]{background:var(--p-accent)}.p-switch.on[data-v-043da7f5]:after{transform:translate(16px);transform-origin:right center}.p-switch.on[data-v-043da7f5]:hover:after{transform:translate(16px) scaleX(1.125)}.p-switch[data-v-043da7f5]:focus-visible{outline:none;box-shadow:var(--p-focus-ring)}.p-check[data-v-043da7f5]{width:17px;height:17px;flex:none;display:inline-grid;place-items:center;border:.5px solid var(--p-line-strong);border-radius:var(--p-r-sm);background:var(--p-surface-raised);color:var(--p-text-on-accent);cursor:pointer;transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease)}.p-check.on[data-v-043da7f5]{background:var(--p-accent);border-color:var(--p-accent)}.p-check[data-v-043da7f5]:focus-visible{outline:none;box-shadow:var(--p-focus-ring)}.p-check .p-ic[data-v-043da7f5]{width:12px;height:12px}.p-avatar[data-v-043da7f5]{width:32px;height:32px;flex:none;display:grid;place-items:center;border-radius:var(--p-r-md);background:var(--p-surface-sunken);border:.5px solid var(--p-line);color:var(--p-text-muted);font-size:var(--p-font-size-sm);font-weight:600}.p-avatar.sm[data-v-043da7f5]{width:24px;height:24px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-xs)}.p-avatar .p-ic[data-v-043da7f5]{width:16px;height:16px}.p-avatar.sm .p-ic[data-v-043da7f5]{width:13px;height:13px}.p-empty[data-v-043da7f5]{display:flex;flex-direction:column;align-items:center;gap:8px;padding:32px 16px;color:var(--p-text-muted);text-align:center}.p-empty .em-ic[data-v-043da7f5]{width:48px;height:48px;color:var(--p-text-faint)}.p-empty .em-title[data-v-043da7f5]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-empty .em-hint[data-v-043da7f5]{font-size:var(--p-font-size-sm);color:var(--p-text-muted)}.p-divider[data-v-043da7f5]{width:100%;height:1px;background:var(--p-line);border:none}.p-divider-v[data-v-043da7f5]{width:1px;align-self:stretch;background:var(--p-line);border:none}.p-turn-failed[data-v-043da7f5]{display:flex;align-items:center;gap:var(--space-2);width:100%;max-width:560px;padding:var(--space-2) var(--space-3);border:var(--p-hairline) solid var(--color-danger-bd);border-radius:var(--radius-lg);background:var(--color-danger-soft);box-shadow:var(--shadow-xs)}.p-turn-failed .tf-chip[data-v-043da7f5]{display:inline-flex;align-items:center;justify-content:center;width:var(--space-6);height:var(--space-6);flex:none;border-radius:var(--radius-md);background:var(--color-surface-raised);box-shadow:var(--shadow-xs);color:var(--color-danger)}.p-turn-failed .tf-chip svg[data-v-043da7f5]{width:var(--p-ic-sm);height:var(--p-ic-sm)}.p-turn-failed .tf-main[data-v-043da7f5]{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}.p-turn-failed .tf-title[data-v-043da7f5]{font-size:var(--text-sm);font-weight:var(--weight-medium);color:var(--color-text);line-height:var(--leading-normal)}.p-turn-failed .tf-sub[data-v-043da7f5],.p-turn-failed .tf-meta[data-v-043da7f5]{font-size:var(--text-xs);color:var(--color-text-muted);line-height:var(--leading-normal);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-turn-failed .tf-meta[data-v-043da7f5]{font-family:var(--font-mono);color:var(--color-text-faint)}.p-tip[data-v-043da7f5]{position:relative;display:inline-flex}.p-tip .p-tooltip[data-v-043da7f5]{position:absolute;bottom:calc(100% + 6px);left:50%;transform:translate(-50%);background:var(--p-text);color:var(--p-bg);font-size:var(--p-font-size-xs);padding:4px 8px;border-radius:var(--p-r-sm);white-space:nowrap;opacity:0;pointer-events:none;transition:opacity var(--p-dur-fast) var(--p-ease)}.p-tip:hover .p-tooltip[data-v-043da7f5]{opacity:1}.p-banner[data-v-043da7f5]{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:var(--p-r-md);border:.5px solid var(--p-line);background:var(--p-surface);font-size:var(--p-font-size-sm);color:var(--p-text)}.p-banner .bn-ic[data-v-043da7f5]{width:18px;height:18px;flex:none}.p-banner.info[data-v-043da7f5]{background:var(--p-accent-soft);border-color:var(--p-accent-bd)}.p-banner.info .bn-ic[data-v-043da7f5]{color:var(--p-accent)}.p-banner.warning[data-v-043da7f5]{background:var(--p-warning-soft);border-color:var(--p-warning-bd)}.p-banner.warning .bn-ic[data-v-043da7f5]{color:var(--p-warning)}.p-banner.danger[data-v-043da7f5]{background:var(--p-danger-soft);border-color:var(--p-danger-bd)}.p-banner.danger .bn-ic[data-v-043da7f5]{color:var(--p-danger)}.p-sheet[data-v-043da7f5]{background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-xl) var(--p-r-xl) 0 0;box-shadow:var(--p-sh-xl);padding:8px 16px 20px}.p-sheet-handle[data-v-043da7f5]{width:36px;height:4px;border-radius:var(--p-r-full);background:var(--p-line-strong);margin:0 auto 8px}.p-skeleton[data-v-043da7f5]{background:var(--p-surface-sunken);border-radius:var(--p-r-sm);animation:p-skel-043da7f5 1.2s var(--p-ease-inout) infinite alternate}@keyframes p-skel-043da7f5{0%{opacity:.5}to{opacity:1}}.p-cmdbar[data-v-043da7f5]{display:flex;align-items:center;gap:8px;width:100%}.p-cmd[data-v-043da7f5]{flex:1;min-width:0;height:38px;display:flex;align-items:center;gap:10px;padding:0 10px 0 14px;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);color:var(--p-text-muted)}.p-cmd .cmd-text[data-v-043da7f5]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-cmd .cmd-copy[data-v-043da7f5]{margin-left:auto;flex:none;display:grid;place-items:center;width:26px;height:26px;border:none;background:transparent;border-radius:var(--p-r-sm);color:var(--p-text-faint);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-cmd .cmd-copy[data-v-043da7f5]:hover{background:var(--p-surface-raised);color:var(--p-text)}.p-cmd .cmd-copy .p-ic[data-v-043da7f5]{width:15px;height:15px}.p-topbar[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;gap:12px;height:48px;padding:0 16px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg)}.p-topbar .tb-title[data-v-043da7f5]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text)}.p-topbar .tb-actions[data-v-043da7f5]{display:flex;align-items:center;gap:4px}.p-topbar.frost[data-v-043da7f5]{background:#ffffffb8;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-color:#fff9}[data-p=dark] .p-topbar.frost[data-v-043da7f5]{background:#161b22b8;border-color:#ffffff14}.demo-row[data-v-043da7f5]{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.demo-stack[data-v-043da7f5]{display:flex;flex-direction:column;gap:12px;width:100%}.demo-col[data-v-043da7f5]{display:flex;flex-direction:column;gap:10px}.demo-grow[data-v-043da7f5]{flex:1;min-width:0}.demo-chat[data-v-043da7f5]{display:flex;flex-direction:column;gap:14px;width:100%;max-width:560px}.icon-grid[data-v-043da7f5]{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px;margin:14px 0}.icon-group-label[data-v-043da7f5]{grid-column:1 / -1;margin-top:10px;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--d-fg-muted)}.icon-cell[data-v-043da7f5]{display:flex;align-items:center;gap:10px;padding:8px 10px;border:.5px solid var(--d-line);border-radius:8px;background:var(--d-surface)}.icon-cell .kw-icon[data-v-043da7f5]{width:20px;height:20px;color:var(--d-fg-soft)}.icon-cell .ic-name[data-v-043da7f5]{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:var(--d-fg)}.icon-sizes[data-v-043da7f5]{display:flex;align-items:end;gap:22px;flex-wrap:wrap}.icon-sizes .sz[data-v-043da7f5]{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:11px;color:var(--d-fg-muted);font-family:JetBrains Mono,ui-monospace,monospace}.p-code-inline[data-v-043da7f5]{font-family:var(--p-font-mono);background:var(--p-surface-sunken);color:var(--p-text);padding:0 5px;border-radius:var(--p-r-sm);font-size:.9em}.p-code-block[data-v-043da7f5]{border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;background:var(--p-surface-sunken)}.p-code-block-head[data-v-043da7f5]{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:var(--p-surface);border-bottom:.5px solid var(--p-line);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);color:var(--p-text-muted)}.p-code-block pre[data-v-043da7f5]{margin:0;padding:12px 14px;font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);line-height:1.65;color:var(--p-text);overflow-x:auto}.p-diff[data-v-043da7f5]{border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;font-family:var(--p-font-mono);font-size:var(--p-font-size-sm)}.p-diff-head[data-v-043da7f5]{padding:8px 12px;background:var(--p-surface);border-bottom:.5px solid var(--p-line);font-size:var(--p-font-size-xs);color:var(--p-text-muted)}.p-diff-row[data-v-043da7f5]{display:flex;gap:10px;padding:2px 12px;line-height:1.6}.p-diff-row .pm[data-v-043da7f5]{width:14px;flex:none;color:var(--p-text-faint)}.p-diff-row.add[data-v-043da7f5]{background:var(--p-success-soft)}.p-diff-row.add .pm[data-v-043da7f5]{color:var(--p-success)}.p-diff-row.del[data-v-043da7f5]{background:var(--p-danger-soft)}.p-diff-row.del .pm[data-v-043da7f5]{color:var(--p-danger)}.p-diff-row .p-diff-code[data-v-043da7f5]{color:var(--p-text)}.p-field-error[data-v-043da7f5]{color:var(--p-danger);font-size:var(--p-font-size-xs)}.p-btn .p-spinner[data-v-043da7f5]{vertical-align:middle}.p-btn .p-spinner .track[data-v-043da7f5]{stroke:currentColor;opacity:.35}.p-btn .p-spinner .arc[data-v-043da7f5]{stroke:currentColor}.ds-page[data-v-043da7f5]{position:fixed;inset:0;z-index:var(--z-max);overflow-y:auto}.ds-topbar[data-v-043da7f5]{position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-4);background:var(--color-surface);border-bottom:.5px solid var(--color-line)}.ds-back[data-v-043da7f5]{display:inline-flex;align-items:center;gap:var(--space-1);padding:var(--space-1) var(--space-3);border:.5px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface-raised);color:var(--color-text);font-family:var(--font-ui);font-size:var(--text-sm);cursor:pointer}.ds-back[data-v-043da7f5]:hover{background:var(--color-hover)}.ds-topbar-title[data-v-043da7f5]{font-size:var(--text-sm);font-weight:var(--weight-medium);color:var(--color-text-muted)} diff --git a/apps/kimi-code/dist-web/assets/DesignSystemView-CTUhpkDe.js b/apps/kimi-code/dist-web/assets/DesignSystemView-CTUhpkDe.js new file mode 100644 index 00000000000..2b2355945fe --- /dev/null +++ b/apps/kimi-code/dist-web/assets/DesignSystemView-CTUhpkDe.js @@ -0,0 +1,13 @@ +import{M as T,aD as z,aI as q,aL as o,u as i,v as a,G as t,H as d,F as p,aX as w,bb as y,I as c,bk as f,cx as h,cy as B,cz as k,cA as A,cB as M}from"./index-D-7nOosq.js";const I={class:"ds-page"},V={class:"layout"},H={class:"content"},L={class:"content-inner"},E={id:"tokens"},D={class:"icon-sizes"},O={class:"sz"},W={class:"p-ic",style:{width:"14px",height:"14px"},viewBox:"0 0 24 24",fill:"currentColor"},R={class:"sz"},N={class:"p-ic",style:{width:"16px",height:"16px"},viewBox:"0 0 24 24",fill:"currentColor"},U={class:"sz"},P={class:"p-ic",style:{width:"20px",height:"20px"},viewBox:"0 0 24 24",fill:"currentColor"},F={class:"icon-grid"},j={class:"icon-group-label"},K={class:"ic-name"},G={id:"primitives"},_={class:"stage-wrap"},J={class:"stage p"},Q={class:"p-pill",style:{color:"var(--p-warning)"}},Y={class:"stage-wrap"},Z={class:"stage p col"},X={class:"demo-row"},$={class:"p-btn primary disabled"},ee={class:"p-spinner sm",viewBox:"0 0 24 24",style:{"--p-accent":"#fff","--p-line":"rgba(255,255,255,.35)"}},ae={class:"stage-wrap"},te={class:"stage p col"},de={class:"demo-row"},se={class:"stage-wrap"},oe={class:"stage p col",style:{gap:"0",background:"var(--p-surface)",padding:"0","max-width":"300px","align-items":"stretch"}},ie={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},ne={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},le={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},re={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},ce={id:"chat"},ve={class:"stage-wrap"},fe={class:"stage p col"},pe={style:{"max-width":"560px",width:"100%"}},he={class:"stage-wrap"},ue={class:"stage p col",style:{"align-items":"center",background:"#fff"}},ge={class:"p-composer",style:{width:"100%","max-width":"620px"}},be={class:"p-composer-bar"},me={class:"p-composer-left"},we={class:"p-pill",style:{color:"var(--p-warning)"}},ye="/repo",ke=T({__name:"DesignSystemView",emits:["close"],setup(xe,{emit:x}){const C=[{path:"/repo/apps/web/src/components/chat/TurnFilesSummary.vue",added:19,removed:4,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/composables/useFilePreview.ts",added:8,removed:1,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/components/chatTurnRendering.ts",added:0,removed:0,hasWrite:!0,statsIncomplete:!0,diff:null},{path:"/repo/apps/web/src/lib/toolDiff.ts",added:3,removed:2,hasWrite:!1,statsIncomplete:!1,diff:null}];function u(){}const S=x;function g(){S("close")}let v=null;function b(r){r.key==="Escape"&&g()}return z(()=>{document.addEventListener("keydown",b);const r=Array.prototype.slice.call(document.querySelectorAll('#nav a[href^="#"]')),e=new Map;r.forEach(l=>{const s=l.getAttribute("href");if(!s)return;const m=document.getElementById(s.slice(1));m&&e.set(m,l)});let n=null;v=new IntersectionObserver(l=>{l.forEach(s=>{s.isIntersecting&&(n&&n.classList.remove("active"),n=e.get(s.target)??null,n&&n.classList.add("active"))})},{rootMargin:"-20% 0px -70% 0px",threshold:0}),e.forEach((l,s)=>v.observe(s)),r.length&&r[0].classList.add("active")}),q(()=>{document.removeEventListener("keydown",b),v&&(v.disconnect(),v=null)}),(r,e)=>(o(),i("div",I,[a("div",{class:"ds-topbar"},[a("button",{class:"ds-back",type:"button",onClick:g},"← Back"),e[0]||(e[0]=a("span",{class:"ds-topbar-title"},"Design system",-1))]),a("div",V,[e[44]||(e[44]=t('',1)),a("main",H,[a("div",L,[e[42]||(e[42]=t('
● Design System · v1.0

Kimi Web Design System

This document defines the visual language and component specification for Kimi Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

Scope apps/kimi-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
i
This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
01

Design Principles

Every UI decision traces back to the following principles. Kimi Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

  • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
  • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
  • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
  • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
  • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
  • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
  • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
i
Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
',2)),a("section",E,[e[7]||(e[7]=t(`
02

Design Tokens

Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

i
Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

Color

Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

i
The table below shows the semantic tokens. Each ships a light value in :root and a dark override in the data-color-scheme blocks — for example --color-bg is #ffffff in light and #121212 in dark; --color-accent is the brand blue (#1783ff light / #1a88ff dark). The semantic status colors (success / warning / danger / info) are independent palettes, one set each for light / dark.
bg
#ffffff / #121212
surface
#f5f5f5 / #1f1f1f
surface-sunken
#f5f5f5 / #121212
well
#f5f5f5 / #1f1f1f
surface-deep
#f5f5f5 / #0d0d0d
surface-overlay
#ffffff / rgba(255,255,255,.1)
selected
rgba(0,0,0,.05) / rgba(255,255,255,.1)
fg
rgba(0,0,0,.9) / rgba(255,255,255,.84)
fg-muted
rgba(0,0,0,.6) / rgba(255,255,255,.56)
line
rgba(0,0,0,.13) / rgba(255,255,255,.12)
subtle
rgba(0,0,0,.05) / rgba(255,255,255,.05)
accent (KMBlue)
#1783ff / #1a88ff
accent-soft
#e8f3ff / rgba(26,136,255,.1)
TokenLightDarkUsage
--color-bg#ffffff#121212Page background
--color-surface#f5f5f5#1f1f1fPanel / sidebar / card head
--color-surface-raised#ffffff#292929Raised card / dialog / input
--color-menu-bgrgba(255,255,255,.95)rgba(41,41,41,.95)Floating menu panel — frosted glass over --p-menu-backdrop blur
--color-surface-overlay#ffffffrgba(255,255,255,.1)Field-control fill on raised cards (selects, steppers) — top rung; light tops out at white (the level is carried by the border), dark steps one rung above raised. Floating layers stay at raised
--color-well#f5f5f5#1f1f1fContent well on the page (code blocks, tool-output panels, match/file lists, media thumbnails) — light reuses the sunken recess; dark lifts one rung ABOVE the page, because a true recess (#121212) vanishes into the page there
--color-surface-deep#f5f5f5#0d0d0dDeep chrome plane one step BELOW the page (panel headers, diff gutters) — dark drops under --color-bg so chrome framing stays darker than the content it frames
--color-textrgba(0,0,0,.9)rgba(255,255,255,.84)Body text / headings
--color-text-strong#000000#ffffffMax foreground emphasis — menu-row label & icon on hover
--color-text-mutedrgba(0,0,0,.6)rgba(255,255,255,.56)Secondary text / placeholder
--color-linergba(0,0,0,.13)rgba(255,255,255,.12)Divider / card border
--color-subtlergba(0,0,0,.05)rgba(255,255,255,.05)Subtle hairline — tertiary separators below --color-line (diff-gutter column rules, quiet dividers inside wells)
--color-selectedrgba(0,0,0,.05)rgba(255,255,255,.1)Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
--color-hoverrgba(0,0,0,.03)rgba(255,255,255,.05)Row hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface. The global hover rule: transparent-base controls overlay this f1 wash (hover never darkens — never sunken); filled controls use their own hover token (accent-hover, send-bg-hover)
--color-inline-code-bgrgba(0,0,0,.03)rgba(255,255,255,.1)Inline-code chip fill — fills.f1 / fills.f2; dark lifts off any dark surface (sunken == bg there)
--color-media-alpha-bg-1≈#858585≈#76797eCheckerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
--color-media-alpha-bg-2≈#6b6b6b≈#8c8f93Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
--color-sidebar-bg#f9fbfc#0d0d0dSidebar surface — one step off --color-bg (just under white in light, one step BELOW the page in dark) so the session column reads as its own plane and never brighter than the reading surface
--color-scrimrgba(0,0,0,.4)rgba(0,0,0,.6)Modal scrim — the dark veil behind dialogs/lightboxes (mask.base; legacy hardcoded overlays can migrate here)
--color-scrim-strongrgba(0,0,0,.6)rgba(0,0,0,.75)Stronger scrim for full-screen media previews (mask.strong — the PhotoSwipe image preview backdrop)
--color-text-on-scrim#ffffffsameText drawn on the scrim (captions over the media lightbox)
--color-accent#1783ff#1a88ffPrimary action / link / focus
--color-success#0e7a38#3fb950Success / pass
--color-warning#a9610a#d29922Warning / pending
--color-danger#c0392b#f85149Danger / error / abort

Palette

The palette is the production kimi.com palette (design tokens tokens.json): neutral-gray surfaces, an alpha-based label / fill / separator ramp (labels.* / fills.* / separator.s1), the KMBlue accent, and a true neutral dark ladder (#121212 → #1f1f1f → #292929; the deep chrome plane and sidebar derive one step below at #0d0d0d — the palette has nothing darker than primary).

The ONE deliberate exception is the status hues: success / warning / danger / done keep the app's own WCAG-tuned ramp (≥4.5:1 on the neutral surfaces) — the production status colours (positiveGreen #16c456, orange #ff9500, danger red #ff3849) are too bright against it. Diff add/del bands happen to coincide (both use the production 25% fills in light, 14% in dark).

Surface usage

The surface layers each have a role — choose by "field overlay / raised layer / content well / default flat layer / sunken layer / page background / deep chrome", and avoid treating --p-surface-raised as a universal background. In dark, elevation = lighter: floating layers sit above the content, content wells sit above the page, and chrome planes (sidebar, panel headers) sit below it — never the reverse. One consequence: on the page itself, never use --color-surface-sunken for a content carrier — it equals --color-bg in dark and the fill vanishes; use --color-well. Sunken stays correct INSIDE surface / raised cards, where it is a genuine recess. Field controls (selects, steppers) on a raised card use --color-surface-overlay, the top fill rung; floating layers keep --color-surface-raised — their elevation is shadow + hairline, not a lighter fill.

TokenLightDarkUsage
--p-surface-overlay#ffffff#22272eField controls on raised cards — select, stepper (top fill rung; light = white)
--p-surface-raised#ffffff#1c2128Raised card / dialog / input (raised layer)
--p-well#f3f5f8#13181eCode block / tool output / list carrier directly on the page (content well — light: recessed, dark: one rung above the page)
--p-surface#fafbfc#13181ePanel / sidebar / card head (default flat layer)
--p-surface-sunken#f3f5f8#0d1117Recessed area INSIDE a surface / raised card — never a content carrier on the page (sunken layer)
--p-bg#ffffff#0d1117Page background
--p-surface-deep#fafbfc#0a0d12Panel header / diff gutter (deep chrome layer — below the page in dark)

Borders & hairlines

Three line tokens, three jobs: --color-line is the default structural separator, --color-subtle the tertiary separator that must stay quieter (diff-gutter column rules, quiet dividers inside wells), and --color-line-strong the edge of interactive controls (inputs, selects, secondary buttons). Width is one: 0.5px — every stroke is the same hairline, on static structural edges (card rims, plane seams, header dividers), interactive control rims and floating layers alike. Separation comes from luminance first — planes one rung apart already read as distinct in dark, so their shared edge stays a 0.5px hairline rather than a heavier border; same-rung neighbours (list rows, card head / body) are exactly where a hairline is required. In dark, drop shadows fade on near-black surfaces, so a floating layer's edge IS its hairline — never ship a shadow-only floating surface. (Legacy --line / --line2 alias --color-line / --color-subtle for one cycle; new work references the v2 names.)

Focus ring

All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

TokenValueUsage
--p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
--p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

Text selection

The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

Disabled state

All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

Font families

Kimi Web uses two font tokens: --font-ui (UI and body, with Schibsted Grotesk for Latin and Noto Sans SC for Simplified Chinese) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

--font-ui · UI & body (Schibsted Grotesk + Noto Sans SC)

Body and UI use self-hosted Schibsted Grotesk for Latin text and self-hosted Noto Sans SC Variable for Simplified Chinese. Platform fonts remain as fallbacks:

--font-ui
--font-ui: "Schibsted Grotesk Variable", "Helvetica Neue", Arial,
+      "Noto Sans SC Variable", "Noto Sans SC", "PingFang SC",
+      "Microsoft YaHei",
+      -apple-system, BlinkMacSystemFont, "Segoe UI",
+      Roboto, Ubuntu, sans-serif,
+      "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  • Schibsted Grotesk first: self-hosted Latin UI and body text, with normal and italic variable faces.
  • Western fallbacks next: Helvetica Neue / Arial for environments where Schibsted Grotesk cannot load.
  • Noto Sans SC Variable next: bundled Simplified Chinese glyphs with a weight range of 100–900.
  • System UI fallbacks last: PingFang SC / Microsoft YaHei, platform UI fonts, and emoji fonts.

--font-mono · Code & monospace

Code, line numbers, diffs, and Bash commands use JetBrains Mono (a self-hosted variable font), falling back to the system monospace. Other tool labels and summaries use the UI font:

--font-mono
--font-mono: "JetBrains Mono Variable", "JetBrains Mono",
+      ui-monospace, "SF Mono", Menlo, Consolas, monospace;

Loading strategy

FontSourceBundledUsage
JetBrains Mono@fontsource-variable/jetbrains-mono✓ self-hostedmonospace / code (--font-mono)
Schibsted Groteskprepare-fonts → app-ui/assets/fonts✓ generated + bundledUI / body / display (--font-ui, --font-display), wght 400-900, normal + italic
Noto Sans SCprepare-fonts → app-ui/assets/fonts✓ generated + bundledSimplified Chinese UI / body, wght 100–900
System UI / CJK fontsoperating systemlate fallback for UI / body
Schibsted Grotesk, Noto Sans SC, and JetBrains Mono are self-hosted. They make no external network requests and work offline; platform fonts remain as fallbacks.

Usage rules

  • Components always use var(--font-ui) / var(--font-mono); do not hard-code font names like 'Schibsted Grotesk' / 'JetBrains Mono'.
  • Body / UI use --font-ui (Schibsted Grotesk for Latin, Noto Sans SC for Simplified Chinese); code / monospace use --font-mono (JetBrains Mono).
  • Schibsted Grotesk is loaded from complete variable faces, including normal and italic styles; font-optical-sizing: auto is enabled globally.
  • Noto Sans SC is loaded from one complete weight-variable WOFF2 asset. Platform CJK fonts stay late in the fallback chain.

Type scale & weight

The user font-size preference is one of four named steps (small / medium / large / xlarge, Medium default) written to data-font-scale on <html>; the step name is persisted, never a px value. The step only moves --base-font; every size token derives additively (default + shift), and line heights are locked to integer px via round(size × ratio, 1px) — never a unitless ratio.

Two token groups share the shift but keep their own ratios: --ui-* for chrome (tight, 1.40–1.50) and --md-* for Markdown content + the composer (loose, 1.56–1.63; body is anchored to the UI body size — the spec's +2px offset was dropped as a product decision — while keeping its own looser line-height ratios). T0/T1 cap at 24/22px on the top steps (built into the tokens via min() — do not remove). Use the .text-ui-* / .text-md-* utility classes; legacy aliases --ui-font-size (→ --ui-b2), --content-font-size (→ --md-b1) and the whole 6-level --text-* ramp (xs→c1, sm→b2−1px, base→b2, lg→t2, xl→t1, 2xl→t0) keep older components on the ramp. Panel titles sit at the base step (--ui-b2); dropdown menu items sit one rung below (--text-sm = b2 − 1px) — both still follow the user's font scale.

Section Title
--ui-t1 · title (cap 22)
Card title
--ui-t2 · subtitle
UI emphasis
--ui-b1 · body strong
UI control / button / form
--ui-b2 · body
Helper text / table
--ui-c1 · caption
Badge / timestamp
--ui-c2 · non-critical only
Markdown H1
--md-h1
Chat body / message bubbles / composer
--md-b1 · prose body
Quote / table
--md-b2 · secondary
Code block / inline code
--md-b3 · weak / code

The fixed product type tokens still define scale-independent defaults: transcript prose enables text-autospace: normal for mixed CJK and Latin text. Drop stray font-weight: 650 / 750; converge on 400 / 500 (regular / emphasis), with a dedicated 600 weight for sidebar section labels.

TokenValueUsage
--font-ui"Schibsted Grotesk Variable", …, "Noto Sans SC Variable", …UI & body (Schibsted Grotesk + Noto Sans SC)
--font-kbd"Schibsted Grotesk Variable", system-ui, sans-serifkeyboard shortcut keycaps
--font-monoJetBrains Mono…code, Bash commands, line numbers, diffs
data-font-scalesmall / medium / large / xlargeuser preference on <html>; sets --base-font (12–18px), Medium = 14px default
--ui-t0…--ui-c2default + --ui-shift, t0/t1 capped via min()chrome type ramp (title / subtitle / body / caption); .text-ui-* classes
--md-h1…--md-b3default + --md-shiftMarkdown ramp (headings / body / secondary / code); .text-md-* classes
--ui-font-size / --content-font-sizevar(--ui-b2) / var(--md-b1)legacy aliases kept on the ramp
--code-font-sizecalc(var(--content-font-size) - 2px)standalone code surfaces (diff view, file preview, tool cards) — one step below body, 12px @ Medium; prose-embedded code stays on the --md-* ramp
--text-xs / sm / base / lg / xl / 2xlc1 / b2−1 / b2 / t2 / t1 / t0legacy ramp, aliased into the scale
--leading-tight/normal/prose/relaxed1.25 / 1.5 / 1.6 / 1.7headings / UI / chat prose / long text
--weight-regular/option-label/medium/ui-strong400 / 475 / 500 / 525body / settings labels / emphasis / compact UI emphasis
--weight-section-label600sidebar section labels

Icon size

Icons use three size tokens uniformly. The global .p-ic default is 16px (--p-ic-md); components pick as needed, and random pixel sizes are forbidden.

TokenValueUsage
--p-ic-sm14pxsmall button, badge, menu item, inline link icon
--p-ic-md16pxdefault (button, icon button, toolbar)
--p-ic-lg20pxToast status icon, empty-state illustration

Icon

Icons always come from the centralized registry lib/icons.ts: in templates use the <Icon name size /> component (components/ui/Icon.vue); for v-html contexts (such as a tool glyph) use iconSvg(name, size). Do not hand-write <svg> — the scripts/check-style.mjs icon-from-registry rule flags stray SVGs. Every glyph shares the 24×24 source grid and currentColor (colour follows text); size uses the three tokens below, and only icons imported in lib/icons.ts are bundled by unplugin-icons at build time. Three collections feed the registry, in this order of preference: ~icons/kimi/* — Kimi Design System icons (24×24 outlined, 1.8px stroke), local SVGs under src/icons/kimi/ registered as a custom collection in the Vite config, used whenever a Kimi glyph exists for the intent; ~icons/tabler/* — Tabler Icons (MIT), for the few gaps it uniquely covers (today: the right-panel toggle); and ~icons/ri/*Remix Icon (Apache-2.0), for the remaining intents the Kimi set does not cover yet. A few glyphs are filed under their intent rather than the upstream asset name (see the lib/icons.ts header). When an icon is missing, prefer a glyph from the Kimi icon set: copy the SVG into src/icons/kimi/ (kebab-case name, monochrome currentColor) and register it — two static imports (component + ?raw string) plus one entry in ICONS; reach for Remix only when no Kimi glyph fits, and never draw paths in a component.

Size scale

`,49)),a("div",D,[a("div",O,[(o(),i("svg",W,[...e[1]||(e[1]=[a("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),e[2]||(e[2]=d("sm · 14",-1))]),a("div",R,[(o(),i("svg",N,[...e[3]||(e[3]=[a("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),e[4]||(e[4]=d("md · 16",-1))]),a("div",U,[(o(),i("svg",P,[...e[5]||(e[5]=[a("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"},null,-1)])])),e[6]||(e[6]=d("lg · 20",-1))])]),e[8]||(e[8]=a("h4",{class:"mini"},"Icon library",-1)),e[9]||(e[9]=a("p",null,[d("Currently registered icons, grouped by purpose. The display order and grouping are defined by "),a("code",null,"ICON_GROUPS"),d(" in "),a("code",null,"lib/icons.ts"),d(" (a hand-maintained array covering the same icon names), and this catalog is rendered directly from that array so the registry and the document never drift.")],-1)),a("div",F,[(o(!0),i(p,null,w(f(B),([n,l])=>(o(),i(p,{key:n},[a("div",j,y(n),1),(o(!0),i(p,null,w(l,s=>(o(),i("div",{key:s,class:"icon-cell"},[c(f(h),{name:s},null,8,["name"]),a("span",K,y(s),1)]))),128))],64))),128))]),e[10]||(e[10]=t('

Do not use emoji as functional icons. The Kimi brand mark (the robot mascot logo) is a brand asset and is not part of this icon system.

A few special graphics are not in the registry; each has a dedicated component maintained in one place, and must not be copied by hand: <ContextRing :pct /> (the Composer context progress ring, data-driven), <AuthStateIcon kind /> (the success / expired / error colored illustrations in the login flow), <Spinner /> (loading state). Status dots (such as in the Provider list) always use CSS dots (border-radius:50%), not SVG. The scripts/check-style.mjs icon-from-registry rule exempts the above and the brand mark; all other hand-written <svg> is flagged.

Spacing

A 4px base grid. All spacing, gaps, and padding inside and outside components come from this scale — no arbitrary pixels.

--space-1 · 4
icon gap, badge padding
--space-2 · 8
control gap, small padding
--space-3 · 12
button padding, form-item gap
--space-4 · 16
card padding, grid gap
--space-5 · 20
dialog padding
--space-6 · 24
section gap
--space-8 · 32
large section gap

Dense list (sidebar / file tree)

High-density navigation lists like the sidebar share one rhythm, all on the 4px grid: in-row vertical padding --space-1 (4px), no margin between rows (the hover pill provides the separation); section gap (between logo / search / action buttons / group title / list) uniformly --space-2 (8px); between groups --space-2; the brand header is slightly looser at the top (--space-3). When building similar lists, reuse this scale — do not hand-write 1/6/7/10px.

Radius

Merge the existing 14 values into the nearest of 7 scale steps. Rule: the component type determines the radius, not the author's feel. The Composer shell is the sole product-specific exception: its 32px radius pairs with superellipse(1.5) so the flatter curve stays visually concentric with its controls.

xs · 4
sm · 6
md · 8
lg · 12
xl · 16
2xl · 20
composer · 32 / 1.5
full · 999
TokenValueUsageMerged from
--radius-xs4pxsmall badge, inline tag2/3/4px →
--radius-sm6pxsmall button, icon button, menu item5/6px →
--radius-md8pxbutton, input, badge, card7/8/9px →
--radius-lg12pxmenu, toast, bubble, floating card10/12px →
--radius-xl16pxcontainer baseline: dialogs, settings cards, sheets, work panel13/16px →
--radius-2xl20pxworkspace attachment card bottom (0 0 2xl 2xl) tucked under the composer18/20px →
--radius-composer32pxComposer shell, with --corner-shape-composerproduct-specific
--radius-full999pxpill badge, avatar, send button999px / 50%

Elevation & z-index

Shadows express only "elevation", never decoration (no colored glow). z-index is unified into a scale, eradicating 9999-style one-upping.

sm · dropdown menu / sticky
md · Toast
lg · overlay (reserved)
xl · dialog
Z-index TokenValueUsage
--z-base0normal flow
--z-sticky100sticky header / sidebar
--z-dropdown200dropdown menu
--z-overlay300overlay / bottom Sheet
--z-modal400dialog — sibling overlays tie-break by DOM order, so the global confirm (ConfirmDialogHost) mounts on demand to always land last / on top
--z-modal-dropdown500menus / popovers that open above a modal dialog (teleported to <body>, e.g. the settings SecondaryModelPicker cascade)
--z-toast600toast
--z-tooltip650tooltip bubble — transient and pointer-events none, so it sits above everything (dialogs, toasts) to stay visible anywhere
--z-max9999reserved: only this tier for extreme fallback

Motion

TokenValueUsage
--ease-outcubic-bezier(0.16, 1, 0.3, 1)enter, hover, expand
--ease-in-outcubic-bezier(0.4, 0, 0.2, 1)panel width, layout changes
--duration-fast120mspress, focus
--duration-base160mshover, show/hide
--duration-slow260msdialog, Sheet, layout
--duration-hover-intent250mshover-intent reveal gate (TOC rail)
--anim-rive-spin416.7msnew-chat / folder-plus icon: plus spin on hover
--anim-leftbar533.3mssidebar toggle icon: arrow fly-in on hover
--anim-leftbar-shrink200mssidebar toggle icon: divider shrink on hover

The --anim-* lengths are track timings ported verbatim from the designer's Rive exports, so they sit outside the --duration-* ramp on purpose — retiming the ramp must not distort them. Their interpolation stays linear because the easing is already baked into the dense keyframe stops; a token easing would double-apply. Three hover tracks use them today: the sidebar toggle shrinks its divider to half height while an arrow flies in and settles (the expand variant mirrors the track from the left), and the new-chat / folder-plus pluses do one bouncy spin. Each track is keyed to an id inside its own glyph (#bar-divider, #bar-arrow / #bar-arrow-expand, #p1, #af-p1) so every instance of the icon animates, and all revert on mouse-out. They still fall under the global reduced-motion switch below.

Reduced motion

i
Under @media (prefers-reduced-motion: reduce), all animation and transition durations drop to about 0.001ms (effectively off), and the chat working indicator's mascot renders its static fallback instead of the Rive loop. Components should not check this individually; it is handled uniformly in the global styles. The switch clears durations, not transition-delay: a hover-intent gate (the conversation TOC's 250ms reveal) decides whether hidden content appears, and clearing it would make pointer fly-bys strobe content for reduced-motion users.

Layout & breakpoints

Layout sizes and responsive breakpoints are tokenized too: sidebar width, content reading-column width, and two global breakpoints. Components should not hard-code pixels.

TokenValueUsage
--p-sidebar-w264pxleft session sidebar width
--p-content-max760pxchat reading-column max width (regular chat prose)
--p-content-wide920pxwide content (settings / panel)
--p-table-max1040pxdesktop wide-table max width (see §04)
--p-table-cell-max700pxmax width of a single table column; longer cell content wraps (see §04)
--p-bp-sm640pxmobile / desktop boundary
--p-bp-md980pxnarrow / wide screen boundary
i
At ≤640px: dialogs become bottom Sheets, the sidebar collapses into an expandable drawer, and Composer toolbar controls are allowed to wrap.
',24))]),a("section",G,[e[27]||(e[27]=t(`
03

Primitives

Component primitives are the "smallest correct units" of the site UI. Each primitive exposes variants along only two dimensions — variant / size — with appearance driven by tokens, so it naturally supports light / dark mode and customizable theme colors.

i
For every interactive primitive, the keyboard behavior, focus, and ARIA contract are in §08 Accessibility. New primitives must ship with a keyboard model — mouse-only interaction is not enough.

Component selection guide

ScenarioUse
Primary action (submit / confirm)Button variant=primary
Secondary action / cancelButton secondary / ghost
Destructive action (delete / abort)Button danger / danger-soft
Status markerBadge
Toolbar filter / model switchPill
2–5 mutually exclusive optionsSegmentedControl
Top tabsTabs
Switch / multi-selectSwitch / Checkbox
Scrollable regions with overlay controlsScrollArea
Floating content card / list action menuCard / Menu
Inline notice / global toastBanner / Toast
Dialog / confirmation · bottom panel (mobile)Dialog / Sheet

Button

4 semantic variants × 3 sizes. The primary action primary takes its color from the current theme color (§05 can switch between the blue and black families). Radius uses --radius-md uniformly (small size --radius-sm), weight 600, with a visible focus ring.

Variant matrix lightpreview
medium · default
small
With icon / state
Dark skin dark

API

Button.vue · usage
<Button variant="primary" size="md" :loading="submitting">Save</Button>
+    // variant: primary | secondary | ghost | danger | danger-soft
+    // size:    sm | md | lg
States

IconButton

Unified into three sizes — 26 / 32 / 44px — with the neutral --color-hover wash on hover and a visible focus ring. Replaces the ad-hoc icon + click areas scattered across components today.

IconButton
i
The desktop IconButton comes in sm 26 / md 32; on touch devices the tap target should be ≥ 44px, so use lg 44px, satisfying the §01 accessibility principle (the mobile three-piece set uses lg). Icon-only buttons must also name themselves on hover: pass tooltip (usually the same text as labellabel alone only sets the aria-label); bare icon <button>/<a> triggers wrap the Tooltip component directly.

Badge · Chip · Pill

Collapsed into two kinds: Badge (status badge, with an optional status dot) and Pill (the clickable pill in the composer toolbar). Radius, font size, and padding are all unified.

Badge · status badge
Semantic variants
pendingrunningcompletedneeds confirmationfailedKIMI
With icon / small size
planpassedread-only
`,19)),a("div",_,[e[14]||(e[14]=a("div",{class:"stage-bar"},[a("span",{class:"st"},"Pill · toolbar pill (composer)")],-1)),a("div",J,[e[12]||(e[12]=t('kimi-k2· thinking',1)),a("span",Q,[c(f(h),{name:"shield-question",size:"sm"}),e[11]||(e[11]=d("yolo",-1))]),e[13]||(e[13]=a("span",{class:"p-pill"},[a("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[a("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m1-8h4v2h-6V7h2z"})]),d("12k / 200k")],-1))])]),e[28]||(e[28]=t(`

Kbd · keyboard shortcut

Kbd renders a shortcut as keycaps — one block per key, never inline text like (⌘K). Caps are 18px tall (Badge sm rhythm): transparent ground with a 0.5px hairline edge, 11px --font-kbd (Inter + system-ui), text colour inherited from the row that carries it — the cap has no fill or colour of its own, so it follows its context (bright inside the accent-ringed recording box, quiet in a hint row). Typical placement: pushed to the row's trailing edge, opposite the label (e.g. the sidebar search row), and inside dialog navigation hints.

Kbd · keycaps
KCtrlKP

Card / Surface

All cards across the site share one structurehead / body / foot — and come in two tiers by visual weight:

  • Operation card —— composite "process" content such as the Swarm overview. (Individual tool calls are NOT cards anymore: they render as quiet borderless lines, see §04.) Flat shell: 0.5px hairline, --radius-md, no shadow. The head is compact mono with no fill, low weight by default, not competing with the conversation.
  • Attention card —— content that needs a user decision, such as Question / Approval. A floating neutral card: white raised surface, --radius-lg, a faint popover shadow (--shadow-menu), a plain dark title head, and a hairline footer whose actions read in number-key order (chips on the buttons) leading to one solid primary action. No semantic color band.
Operation card · compact mono head (no fill)
read_filesession.ts
The head uses mono + a neutral background to emphasize its "code / process" nature; the body uses sans for readability. Flat, radius-md, same shape as the Swarm composite card.
Attention card · floating neutral surface (no color band)
A decision needs your confirmation
A floating neutral card — no color band. The raised surface, large radius and soft shadow lift it above the transcript; the head is a plain dark title, and the hairline footer lines up quiet text buttons leading to one solid primary action.
Activity run · a summary row expands into the folded lines
Read 2 files
Readsession.tssrc/auth34 lines
Readmiddleware.tssrc/auth58 lines
  • One structure, two shells: every card is head / body / foot; operation cards are flat + 0.5px hairline + radius-md with no shadow, while the attention card is the single exception — raised surface, radius-lg and a soft shadow, because it floats above the transcript in place of the composer.
  • Differences are intentional: operation cards keep a compact mono head; attention cards get a plain dark title head and footer actions.
  • Grouping: consecutive activity (thinking + tool calls of any kind, cards included) folds into ONE activity-run row — a smart summary sentence that expands into the items in order; only text and successful media tools (inline media is the turn's output) stay out and break the run (see §04).
  • Turn fold: once an assistant turn settles, everything before its final text block (thinking, activity runs, interim text, standalone cards) folds into ONE bare "Worked Ns" row — no glyph, a faint one-line label + rotating chevron sharing the activity-run head's padding and hover language; while the turn streams the row stays hidden and the body forced open, and on settle the row appears and folds itself back. The span is the turn's elapsed time (daemon duration once settled, server message stamps for history; approval/question waits included by design), reading the generic "Work details" without any stamp. The final text — and anything after it, so trailing media / cards stay on screen — never folds; a text-only turn renders no row at all (see §04).
  • Status dots: running (pulsing blue) / done (green) / failed (red), sharing one color vocabulary (see §04 tool calls).

Input / Select / Textarea

Unified 38px height (32px small), --radius-md radius, --color-surface-overlay background, and a unified blue focus ring (0 0 0 3px accent-soft). Select is a custom combobox and listbox, not a native <select>; opening it centres the selected option in the scrollable menu. Open Select roots enter the dropdown layer; containing settings groups temporarily release clipping and join that layer so later sections cannot cover the menu.

Form primitives
Only letters, numbers, and hyphens are allowed.
States
Please enter a valid workspace name
Normal state · validation passed

Code / Diff

Diff controls: The non-selectable branch summary starts with a 14px branch icon, aligns to the panel header's 12px inset, uses 12px labels, and ends with a 0.5px hairline. List and tree choices use the 14px list and tree-view registry icons. Flat-list and tree-view paths use the UI font at 12px. Tree roots share the flat list's 14px content inset, then each depth advances by 12px and adds a grey indentation rule.

Diff empty state: Centre the clean-workspace message in the available panel height and lead with a quiet 32px status icon.

Diff detail body: the right-side diff detail reuses HighlightedCode unframed (the panel owns the edge and scroll) — shiki highlighting with the language inferred from the file path, an old/new line-number gutter, hunk headers as a muted band, at the shared code size --code-font-size (12px at Medium, one step below body text). The file preview's code body (text / JSON / HTML and Markdown source) renders through the same component with a per-row number gutter plus search-hit / jump-target row states.

Inline code, code blocks, and diff contents use the monospace font (--p-font-mono); diff change counts and branch summaries use the UI font. Code blocks have a filename title bar and a copy button; the action edge uses a compact 6px inset. Diffs use + / - row colors to express additions and deletions — additions use a success light background, deletions use a danger light background, with no gradients.

Code / Diff
inline code
The server uses jwt.verify(token) to verify the signature, returning 401 on failure.
code block
session.ts
import { verify } from './jwt';
+
+    export function auth(token: string) {
+      return verify(token, process.env.JWT_SECRET!);
+    }
diff
session.ts · +3 -1
import { verify } from './jwt';
-const secret = 'dev-secret';
+const secret = process.env.JWT_SECRET!;
return verify(token, secret);

Dialog

One dialog primitive replaces 6 hand-written implementations: unified --radius-xl radius, --shadow-xl shadow, 20px head padding, right-aligned footer actions, and an IconButton close button.

Dialog primitive
New chat
Create an independent Agent chat in the current workspace.
i
Size & height: Dialog offers three widths — md 440 / lg 640 / xl 760 (--p-content-max) — chosen by content weight. Height comes in two kinds: auto (default, grows with content up to max-height) and fixed (constant height min(680px, 100vh - 64px), with overflow scrolled inside the body). Content / multi-tab dialogs (settings, model picker, provider manager, folder browser) always use fixed so the frame size stays constant and doesn't jump when switching tabs or content length; short confirmation dialogs keep auto. Selectable controls inside Settings use 0.5px hairlines. Its navigation stays transparent on the grouped canvas — separated from the content region by the 0.5px hairline (horizontal in the stacked mobile layout) — and uses 12px labels at weight 525 with 16px registry icons; the selected tab paints the same neutral --color-hover wash as hover, with the label simply brightening to --color-text — the Kimi app settings nav's recipe (.ss-nav-item--activeFills-F1, no accent tint, no weight change); section captions use 16px UI text in --color-text. Every setting row has a plain-language description; option labels use --color-text at weight 475 with a 1px gap before that description. Chinese descriptions use “思考” and “计划模式” rather than the English terms; “skills” stays lowercase when it appears within a sentence. Every settings section puts its rows inside one rounded group with 0.5px dividers; the content region paints the flat --color-surface so each group (--color-surface-raised) reads one rung above it — never a sunken pit, which would sink the dialog's content below its chrome in dark. The font-size stepper is a compact 32px UI-font control with 12px values and custom minus and plus buttons. Its 52px desktop row centres the control with equal space above and below. Archived workspace headings reuse the sidebar’s folder-closed registry icon, and Restore actions lead with the undo icon. Archive counts use weight 500; timestamps and workspace paths use the UI font.

Dialog backdrop: Use a restrained 28% neutral overlay so the workspace remains legible without competing with the modal.

Settings regions: The settings title and close action belong to the right content region. The navigation is a separate full-height region that starts at the dialog's top edge, not content beneath a dialog-wide header.

Archived sessions: Start with the localized page title. Do not add a repeated English kicker above it.

Settings interaction: Notification labels and descriptions are not selectable; their switches remain fully interactive.

Conversation chrome: Header labels are not selectable; the rename input remains selectable and editable. Branch names start with a 14px branch icon. The overflow trigger is a compact 24px control with a 14px icon. Below a 720px header container, hide the workspace prefix and give the conversation title the available width. On macOS desktop the header doubles as the window-drag region and interactive controls opt out with no-drag; while one of its menus or a dock work panel is open every window-drag strip (chat header, sidebar header, panel header) drops the drag region so an outside press anywhere reaches the page and dismisses the overlay (window dragging is simply paused).

Session search: follows the §09 flush picker anatomy — a boxed Input under the head, and a result list that fills the body's available height and owns vertical scrolling.

Model picker: follows the §09 flush picker anatomy; the provider filter remains horizontally scrollable without showing a persistent scrollbar. Only the model list scrolls; the shortcut bar remains pinned at the bottom.

Toast

Unified information architecture: status icon + title + description. The status color appears only on the icon, avoiding large colored areas that create visual noise. For an undoable action there is a second, lighter form — the Action toast (ActionToast.vue): a pill floating top-center just below the 48px header, carrying a one-line sentence whose actions are plain inline <button>s (styled accent by the component), plus close. Self-timed (default 8s, hover pauses); the parent re-keys to reset and wraps it in a <Transition>. First used by session archive (Undo / Settings); warnings keep the bottom-right Toast stack.

Toast
Connected to server
The local server is responding normally; you can start a new chat.
Context usage 82%
Consider running /compact to free up space.
Action toast
or view archived chats in

Spinner

Loaders fall into two categories by scenario — do not mix them:

  • Spinner (plain · SVG ring) —— the default loader. Used for button loading, app startup (GlobalLoading), and general inline waits — "everything else".
  • WorkingIndicator (小蓝 mascot · brand signature) —— used only for the chat working state after a prompt is sent (the sending placeholder in ChatPane, the send → first-token loading in SideChatPanel). The label follows the phase: "Requesting…" until the assistant's reply starts, then "Working…".

Spinner · plain loader (default)

`,39)),a("div",Y,[e[18]||(e[18]=a("div",{class:"stage-bar"},[a("span",{class:"st"},"Spinner · common scenarios")],-1)),a("div",Z,[a("div",X,[e[17]||(e[17]=t('Loading…',2)),a("button",$,[(o(),i("svg",ee,[...e[15]||(e[15]=[a("circle",{class:"track",cx:"12",cy:"12",r:"9"},null,-1),a("circle",{class:"arc",cx:"12",cy:"12",r:"9"},null,-1)])])),e[16]||(e[16]=d("Submitting",-1))])])])]),e[29]||(e[29]=a("h4",{class:"mini"},"WorkingIndicator · 小蓝 mascot (only the chat working state)",-1)),a("div",ae,[e[20]||(e[20]=a("div",{class:"stage-bar"},[a("span",{class:"st"},[d("WorkingIndicator · chat working state only "),a("span",{class:"tag spec"},"signature")])],-1)),a("div",te,[e[19]||(e[19]=a("span",{class:"stage-label"},"Usage · only while the chat has an unfinished prompt",-1)),a("div",de,[c(k,{label:"Requesting…"}),c(k,{label:"Working…"})])])]),e[30]||(e[30]=t('
i
The chat working state is rendered uniformly by WorkingIndicator — the 小蓝 mascot (KimiMascot, the kimi.com avatar Rive asset, with a static SVG fallback under reduced motion or when the runtime fails) plus a phase label. All other loading states use the plain Spinner.

Link

Inline text link: the default is the accent color with no underline; on hover it shows an underline and darkens. File links inside inline code use a 1.5px underline offset so the line stays clear of the chip background. The .muted variant uses the secondary text color. Used for in-text jumps, external links, "view all", and other lightweight actions.

Link · inline link
Read the full design token docs before building.View on GitHubView history

Menu / Dropdown

Desktop menus use a 3.5px panel inset. Standard items use 5px × 9px padding and a 7px icon gap. Their three-layer neutral shadow stays below 4% opacity.

Dropdown menu panel: frosted glass — the translucent --color-menu-bg fill over a blurred, saturated page backdrop (--p-menu-backdrop) — plus hairline + light shadow (--shadow-menu, a three-layer neutral ramp). This is the one place glassmorphism is the design language rather than an exception (§06); every floating menu surface (Menu.vue, the Select listbox, composer dropdowns, slash/mention popups) uses the token pair, never ad-hoc blur values. Menu items support icons, the current (active) state, the danger state, and the disabled state, with separators grouping items. All menu actions use 13px labels at weight 475 with 16px leading icons; both share a 16px line box for vertical alignment. Menu timestamps use the UI font. On touch / mobile, use lg (≥44px row height) while keeping the same type size. A dropdown menu pops in from its trigger corner — fade plus a slight 0.97 scale over --duration-base (exit --duration-fast), the composer model dropdown's motion language; the transform origin and the nudge direction follow the anchoring, including the upward flip near the viewport edge.

Row states: hover uses the mode-aware --color-hover wash (it lightens under dark, never darkens); a leading icon sits one rung below the label (--muted), and on hover both label and icon step up to --color-text-strong, the max foreground tier. Selection keeps the accent pair (--color-accent-soft / --color-accent-hover); danger keeps its own colour.

Menu · dropdown menu
Open file
Selected item
Disabled item
Delete chat

SegmentedControl

Mutually exclusive short option groups, commonly used for 2–5 option switches such as "light / dark / follow system" or the four font-scale steps. Options may include a 14px registry icon or a colour swatch. A single raised indicator with a soft shadow (no border — the edge stays clean) slides and resizes between options using the standard motion tokens. Three sizes: md (default, settings pages), sm (compact rows), and xs (dense menus such as the composer model dropdown — 20px items, 12px labels).

SegmentedControl
LightDarkFollow system

SecondaryModelPicker

Linked model + thinking-effort picker (settings → Agent → Subagents, experimental; components/settings/SecondaryModelPicker.vue, shared by both ends). Use it whenever two choices are only valid as a pair — here an effort is meaningless without its model, and every model declares a different supported set. It is a cascading variant of the §03 Select: the trigger is the Select trigger verbatim (value renders model · effort, the unset state uses the placeholder tint), and the dropdown opens as a SINGLE-LEVEL model list (grouped by provider) on the floating menu surface (--color-menu-bg / --p-menu-backdrop / --shadow-lg). The menu teleports to <body> with position: fixed — it opens on top of the settings modal (on the --z-modal-dropdown rung), and only a body-level surface escapes the dialog's scrolling-body clip; it re-anchors to the trigger on any outside scroll and closes on window resize (the UserMenu teleport's full recipe). Hovering or clicking a model row flies its effort submenu out to the RIGHT of the row — same menu surface, anchored to the row's live position, flipping to the left only near the viewport edge per the §03 anchoring rules — with a 250ms hover-intent grace (the UserMenu flyout's recipe) so the diagonal path into the submenu doesn't collapse it. Every model row carries a trailing chevron-right affordance; clicking an effort confirms the pair and closes — one atomic write, never two staggered patches. Flyout options follow the composer's thinking-level model (segmentsFor): effort models get off + their declared levels (always-thinking ones get no off), boolean-thinking models get on/off, unsupported models get off alone; while no effort is set at all, a "Model default" entry leads (it writes the model alone — POST /config merges and cannot clear a stored effort, so the entry disappears once one is set). A configured effort the model no longer declares is appended as an extra flyout option so the current pair stays visible and re-selectable. Keyboard mirrors the Select contract (focus stays on the trigger, Esc preventDefaults so the hosting dialog does not close): ↑/↓ move within the active level (the flyout follows model moves), → opens the flyout, ← collapses it, Enter confirms, Home/End jump. ARIA: combobox trigger → dialog menu holding a model listbox plus the effort listbox flyout with option rows. The menu itself flips upward when the trigger sits near the viewport bottom.

Tabs

Tabs with a bottom hairline, used for grouping and switching sibling content. The current tab is marked with accent text + an accent underline.

Tabs
GeneralAgentAdvanced

Switch

A two-state switch for settings that take effect immediately. The 36×20 track has a 0.5px hairline and full radius; its 16px knob uses 1.5px internal offsets so the visible inset remains 2px and symmetric after accounting for the border. On hover, the knob eases to an 18px rounded rectangle towards the track centre. When on, the track turns accent and the knob slides right.

Switch

Checkbox

A 17×17 checkbox. When checked it fills with the accent color and shows a white tick (inline SVG). Often paired with a text label.

Checkbox

Avatar

A 32px default avatar with md radius; .sm is 24px. Can hold an initial or an icon; falls back to this placeholder when there is no image.

Avatar
KK

EmptyState

A centered placeholder for empty lists / panels: a 48px faint icon + title + hint, avoiding blank pages.

EmptyState
No chats yet
Click "New chat" to start a conversation with Kimi

Divider

A 0.5px hairline divider (--p-line); .p-divider-v is the vertical divider, used between inline elements.

Divider
Content above

Content below
kimi-k2thinking

Tooltip

A CSS-only hover hint, wrapped in .p-tip. Inverted background (--p-text / --p-bg), single line, no wrapping — carries only short notes.

Tooltip (hover the button)
New chat

Banner

An inline notice bar placed at the top of a content area. Three states — .info / .warning / .danger — each with a matching 18px icon.

Banner
Connected to server
Currently in yolo mode; tool calls will run automatically

Sheet / BottomSheet

A mobile bottom slide-up panel: xl top radius + drag handle, xl shadow. At ≤640px, dialogs become bottom-anchored Sheets.

BottomSheet
Choose a model
kimi-k2 · thinking
kimi-k2 · instant

Skeleton

A placeholder for loading content, using a breathing opacity animation (no gradients), following the no-gradient-text rule. Composed into titles / text lines / avatars.

Skeleton

Command Bar

An inline combination of "primary action + command text + copy", sitting between a button and a code block — used for install / onboarding / one-click execution. The primary action reuses Button primary; the command area uses a mono light-grey background.

Command Bar
curl -fsSL https://code.kimi.com/install.sh | bash

TopBar

The application top bar. Solid by default; the .frost variant is translucent + background blur, used only for sticky navigation bars. Together with the floating menu surfaces (Menu / Dropdown), it is one of the two exceptions to the no-glassmorphism rule (see §06).

TopBar · solid / frosted glass
Solid TopBar
Frosted-glass TopBar · .frost

Find Bar · transcript search

The in-transcript find bar (Cmd/Ctrl+F), implemented by components/chat/TranscriptSearch.vue. A floating card pinned to the transcript's top-right (top: --panel-head-h + --space-3, right: --space-3 — equal inset on both axes), --z-sticky, raised surface + 0.5px hairline + --shadow-menu. One radius for both states: --radius-2xl is a full capsule at the collapsed height and a card once the footer expands — never animate between two radii.

PartRule
Input rowSearch icon (muted) + bare input — the list-style bare-input exception family (sidebar search row, inline rename), NOT the boxed Input primitive; the 38px bordered control would break the pill. Circular close IconButton sm (concentric with the capsule end); a 0.5px hairline separator before it. Height comes from the grid: 32px control (--space-8) + 2× --space-1 padding = 40px — at which --radius-2xl is exactly the half-height capsule.
Footer (results)Expands via the 0fr→1fr grid fold (--duration-slow), hairline top separator, prev/next IconButton sm left, right-aligned muted count (N/M results · --ui-font-size-sm). Only exists once a query has settled — while typing or empty, the bar stays a bare pill.
Statescollapsed (empty query) / searching (Spinner sm in the input row during the ~800ms debounce) / results / no-results (count reads "No results", nav disabled). Disabled is uniformly opacity:.5.
FocusComposer-style: a neutral hairline overlay (::after + --color-composer-focus-line) fading in on :focus-within. No accent ring.
Match inkCSS Custom Highlight API — the bar mutates no transcript DOM. All matches: --color-search-match (yellow); current: --color-search-match-current + a 2px --color-warning outline ring (a positioned overlay — highlight pseudos can't paint box outlines). Tokens live in app-ui/style.css with light/dark pairs.
KeyboardCmd/Ctrl+F opens + focuses (repeat = re-focus + select-all; hardcoded, reserved in the desktop keymap), Enter / Shift+Enter steps matches (wrapping), Esc closes from ANY control inside (container-level, so it never reaches the conversation's Esc-abort).
Matching semanticsRendered transcript DOM only (unloaded older pages are out of scope), capped at 1000 matches (count reads N/1000+). Matches span inline nodes within one block, never cross block breaks; inert and display:none content is excluded. Stepping scrolls the match's own rect into view, not its parent element.

SectionLabel

A small group title for sidebar lists, used to section the content below (such as Workspaces in the sidebar). Spec: 13px / 700 / uppercase / letter-spacing .08em, color --color-fg-faint; left-aligned to the row's starting padding (--sb-pad-x), keeping the same indent as the group rows below. For scripts without case (such as Chinese), text-transform:uppercase simply has no effect — no special handling needed.

',55)),a("div",se,[e[26]||(e[26]=a("div",{class:"stage-bar"},[a("span",{class:"st"},"Sidebar · group title")],-1)),a("div",oe,[e[25]||(e[25]=a("div",{class:"p-section-label",style:{padding:"12px 16px 4px"}},"Workspaces",-1)),a("div",ie,[(o(),i("svg",ne,[...e[21]||(e[21]=[a("path",{fill:"currentColor",d:"M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])),e[22]||(e[22]=d(" kimi-code-web ",-1))]),a("div",le,[(o(),i("svg",re,[...e[23]||(e[23]=[a("path",{fill:"currentColor",d:"M4 5v14h16V7h-8.414l-2-2zm8.414 0H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])),e[24]||(e[24]=d(" playground ",-1))])])])]),a("section",ce,[e[39]||(e[39]=t('
04

Chat Interface Overhaul

The message stream is the core of Kimi Web. Tool calls render as quiet activity lines — one borderless line per call, bespoke per tool kind, auto-grouped, expanding on demand — while Question / Approval elevate to a floating neutral surface because they need a decision, and the Swarm composite keeps a card; the Composer collapses into a single rounded container.

Unified message stream

User-message bubbles follow the kimiwork production recipe (MessageItem .user-bubble): a neutral --color-user-bubble-bg fill (BubbleGray — #f5f5f5 light / #292929 dark), uniform --radius-lg corners, no border, no shadow.

Message timestamps use 12px UI text at weight 500, matching the compact metadata scale without switching to a monospace face.

The user-message metadata row sits one 8px spacing step below the bubble, so its actions and timestamp read as supporting information rather than part of the bubble edge.

Overlong user messages clamp at 10 measured lines, the tail dissolving through an alpha mask rather than a tint overlay (the translucent accent fill would double-composite); a floating pill toggle centred on the fade expands in place and collapses back, and the collapse pins the toggle itself so the reading position survives. Skill / plugin command args clamp through the same wrapper, beside the card head. Like the transcript's other disclosure controls (thinking row, turn fold, tool lines), the toggle is a bare native button carrying aria-expanded — chat-surface disclosure controls do not use the §03 Button primitive.

The floating jump-to-latest control uses 12px UI text at weight 525, led by the full down-arrow icon rather than a disclosure caret.

Thinking is an inline, borderless disclosure row in the message stream — never a side panel. The k15 bulb (the thinking registry icon) leads the row in every state; while streaming the "Thinking…" label breathes (opacity only, never a gradient shimmer) and whole elapsed seconds tick beside it, afterwards the label settles to "Thinking process" with the final span as · Ns (renderer-measured, live sessions only — history shows no seconds). Collapsed by default, it expands in place with the standard grid-rows animation and a 90° chevron rotation, and it folds itself back once the stream moves past it, even if the user expanded mid-stream. The header only animates its text colour on hover (standard duration and easing tokens), no card shell.

Conversation · 760px reading column
Please change the login endpoint to JWT and add the corresponding unit tests.
🌔Analyzing the auth module…
Read 2 files
Readsession.tssrc/auth · :12-4534 lines
12 export function verify(token: string) {
13 return jwt.verify(token, getSecret());
14 }
Readmiddleware.tssrc/auth58 lines
Editmiddleware.tssrc/auth+12−4
Search"jwt.verify"src/auth4 results

I looked at the structure of src/auth; it is currently based on a session cookie. The scope of the change is below — once you confirm, I'll start.

A decision needs your confirmation
How long should the JWT expiry be? Default 7 days, refresh token 30 days.
Write permission required
About to modify src/auth/middleware.ts, 42 lines changed. Allow?
Replace session with JWT signing
Refactor the auth middleware
Add unit tests

Wide markdown tables (desktop): regular chat prose stays within the 760px reading column (--p-content-max), and tables stay there too by default — an overflowing table scrolls horizontally inside its own wrapper, so the page and the chat area never scroll sideways. A clipped table shows a gradient fade at its truncated right edge, and hovering the table reveals a small widen button at its top-right corner; clicking it lets the table grow naturally with its content up to 1040px (--p-table-max), centred within the conversation pane, and clicking again restores the default width. At the default width a single column is capped at 36% of the pane; once widened the cap relaxes to 700px (--p-table-cell-max), so long cell content wraps inside the cell instead of stretching the table. The conversation outline (TOC) keeps its usual position just outside the reading column; when a widened table grows past it and scrolls under the rail, the TOC is hidden temporarily and returns as soon as the table leaves, without touching the user's TOC setting. On mobile a table never breaks out of the reading column.

Tool calls: quiet activity lines, bespoke per tool

High-frequency calls like read / bash / grep are "operational noise" — boxed, collapsible cards quickly drown out the conversation. Tool calls therefore render as one quiet borderless line in the message stream — never a card — and each tool kind composes that line for its own content, so the stream reads like an activity log rather than a pile of widgets. The three visual-weight tiers:

Three visual-weight tiers
① Tool line · lightest (default) — bespoke content per tool, no card chrome
Runpnpm run build && pnpm lint0.8s
② Activity run · medium (consecutive quiet activity — thinking + tool lines — folds to one smart-summary row)
Read 3 files
③ Sub Agent identity card · one per delegation — task title + agent type; the whole card opens the side panel (no in-stream expansion, never grouped)
分析双引擎架构Explore
④ Decision card · heavy (only question / approval, needs user input)
Write permission required
About to modify src/auth/middleware.ts, 42 lines changed.
  • A tool call renders as one quiet borderless line (~24px, the thinking row's rhythm): leading glyph, tool-specific content, trailing meta + status. There is no card chrome and no hover wash — the chevron hugging the line's text (thinking-row style, never pushed to the far edge) is the only disclosure affordance, a real <button> carrying aria-expanded (keyboard path); the head itself is a plain click target (mouse path), so trailing slots may hold genuine buttons of their own (e.g. Agent's "open detail").
  • One type scale for the whole stream: thinking rows, fold summary rows and tool lines all set 13px UI text; in-line mono and trailing meta run one step down at 12px (a monospace x-height reads larger, so 12px sits level next to 13px). Hierarchy comes from colour, never from size jumps or bold — everything on the line is regular weight: the only dark object is the file-name button (--color-text — the one interactive place to go); the action label (Run / Read / Edit…), the mono command / pattern and secondary context all sit at --color-text-muted; auxiliary elements (glyphs, chevrons, trailing meta) stay --color-text-faint. The stream thus reads in three quiet tiers: prose in text, tool lines in muted, thinking / captions in faint. Line content is centre-aligned so mono-only rows (Bash) sit level with the icon and chevron. Truncating line content (the CSS-ellipsis spans) sets --leading-tight rather than the row's line-height: 1 — a 1em line box is shorter than the font's ascent + descent, so overflow: hidden would clip descenders (j / p / g / y); mono runs take the font's own normal leading instead, since JetBrains Mono's ≈1.32em metrics exceed --leading-tight. The 16px chevron still drives the ~24px row height.
  • Every tool kind composes its own line, leading with the tool's localized action label (Run / Read / Edit / Write / Search / Find / Fetch…): Bash pairs its label with the full command in mono (CSS-truncated) plus a duration chip; Read / Edit / Write follow the label with the file name as a real button (opens the file preview) followed by the directory, a :line-range or a +N −M stat with a mini segmented bar; Grep shows the pattern in mono plus a match count; Glob / Ls list paths; Todo carries the active task with a done/total progress bar; goal tools show a coloured status pill; ExitPlanMode expands into a read-only plan receipt with its persisted review outcome. Unrecognized tools fall back to glyph + localized label + argument summary.
  • The settled question is the one exception to the quiet line: once AskUserQuestion settles with a recognized answer, it becomes a small receipt card — the question card's echo (raised surface, hairline edge, lg radius, --shadow-xs, flush with the stream's left edge, ≤560px). The card echoes only the picks, checked with the live QuestionCard's CSS glyph language one step down (14px); passed-over options are not echoed. Dismissed (or zero-answer) collapses to a slim italic one-line card; while running, and for unrecognized output (background launch / error), it stays the plain quiet disclosure line with the raw output.
  • Clicking a line expands it in place; the detail hangs below at the line's own left edge (no inset), so it reads as part of the stream rather than as a separate card. Details are one of: the mono output panel (content-well surface, hairline edge, 12-line scroll cap), the inline diff, or clickable match / file lists (path:line opens the preview at that line). Code-bearing details — the Read content, the Edit diff, the Write content — are syntax-highlighted by file type (github-light / github-dark, following the colour scheme), with the Read output's real line numbers as the gutter; highlighting mounts lazily on first expand and degrades to plain text for unknown languages or oversized content.
  • Rows sit flush with the message stream's left edge (same alignment as prose and the thinking row): no inset, no hover wash, and the glyph rides the thinking row's 4px icon-to-text rhythm with no padded slot. Expanded rows inside a group stack directly on the shared rhythm — no dividers.
  • Consecutive activity — thinking segments and tool calls of ANY kind, quiet lines and richer cards alike — folds into ONE activity-run row: a smart summary sentence that aggregates the run per tool kind in first-appearance order (Read 2 files · Ran 5 commands (1 failed) · 26s), the failure clause hanging on its kind in danger red, the total span faint at the tail — one line, ellipsis-truncated, the full sentence in the title tooltip. Thinking items fold into the run but are not narrated in the sentence. The row shares the thinking row's language (borderless faint text row, text-colour hover only, one whole-row button with a rotating chevron) but rides a roomier 8px vertical padding — 30px against the quiet lines' 22px, so the turn-level summary keeps its presence between prose paragraphs; while the turn streams through the run the row stays expanded and the summary turns live (current action + cumulative per-kind stats + ticking whole seconds), and once every item settles it folds itself back — even if the user expanded it mid-run (the thinking block's vocabulary); a settled → running transition (the stream appending to the same run) reopens it. The glyph carries the state: the current step's own icon breathing while running, green ✓ / red ✕ once settled. A run needs ≥ 2 steps — a lone step renders standalone as the block it always was. Text never folds (it breaks the run), and neither do successful media tools (no card — inline media is the turn's output); everything else folds, cards included: Todo / Goal progress narration, the sub-agent identity card, Question / Swarm cards and unrecognized kinds (skills, MCP tools) all join the run — the stay-expanded-while-live rule keeps a card visible exactly while it is active. The expanded run is the items flat in order (thinking rows + tool rows), each with its own in-row details intact — the lines keep their own 4px row rhythm but breathe 8px apart, with a small inset below the head.
  • Above the activity run sits the turn fold (TurnFold.vue): when an assistant turn settles, every block before the LAST text block — thinking segments, activity runs, interim text paragraphs, Todo / Goal / sub-agent cards — folds into a single bare row reading Worked 4m57s (whole seconds, no glyph, no summary sentence), expanding into the folded blocks in order, each with its own rendering intact. The span is the turn's ELAPSED time (turnWorkMs): it ticks from the stamped start while the turn is open — approval/question waits included by design, so no park bookkeeping exists — then reads the daemon's own durationMs once settled (the server message stamps for history turns); the wall clock only feeds the live tick, so throttled tabs, session switches and remounts cannot corrupt the settled value. Without any stamp the row falls back to the generic Work details. Streaming turns show no row and a forced-open body — the live transcript is untouched, the fold lands only when the stream moves past the turn (or the turn parks). The split never hides the turn's output: the final text block and any trailing blocks (inline media, standalone cards) stay visible, and a text-only turn folds nothing. Fold state is a plain component ref — nothing persists, switching sessions resets to folded. Inside the right-side sub-agent transcript, disclosure bodies open instantly while their chevrons retain the standard rotation: animating the height of a full historical stream would relayout the entire panel on every animation frame.
  • A sub-agent delegation is an identity card — never a quiet line: the card carries the TASK as its title and the agent type as a quiet meta line, while the orchestrator's full prompt stays out of the stream on purpose. The whole card is one action (the quiet shell vocabulary: raised surface, hairline edge, large radius, no shadow): click to open the subagent's live progress in the side panel — there is no in-stream expansion.
  • Status keeps the shared vocabulary: running (pulsing accent dot) / done (green ✓) / failed (red ✗), at the line's right edge. Only two types keep a full card: Question and Approval — they genuinely need the user's attention. The Swarm composite keeps one quiet card (raised surface, 0.5px hairline, large radius) for its phase overview + member accordion.
  • A task notification is a status card, not a quiet line (NotificationCard.vue): the hidden <notification> injections (background-task / sub-agent settlement) render where they landed in the turn — a 28px status chip + title/sub head tinted with the toast status token pairs (completed → success, failed / timed_out / lost → danger, killed → warning, else neutral surface), expanding in place to the fields, the body, an output-file row (copy path) and the raw payload. ≥2 CONSECUTIVE notifications merge into one neutral group card (count + per-item status dots + compact rows, each expanding on its own). Notifications break the activity run but are never turn boundaries, and they never fold — a notification is an event worth noticing, not process noise, so it punches out of the turn fold and renders right after the fold row, in order.
  • A turn that dies on a model-request failure leaves a persistent terminal card at the transcript tail (ChatPane's .turn-failed): the notification card's danger shell (danger-soft surface, danger hairline, 24px status chip with the warning glyph) carrying a title keyed by the wire error kind (model failure vs step-limit stop), the provider message as a muted sub, a mono diagnostics meta (code · HTTP status · request id), and exactly ONE secondary sm action — Continue, which submits a short continue prompt through the normal path. It renders only while the session sits idle on lastTurnReason === 'failed' (a turn with zero assistant output included, so it pins to the tail rather than any assistant row), it is not dismissible, and it vanishes the moment a new turn starts. While the turn is still fighting, the working indicator instead narrates the retry backoff ("retrying n/max" from the live agent.status.updated phase) — a retrying turn never shows the card. The transient error toast now fires only for background sessions; the viewed session's failure is fully covered by the card.
  • Turn failed card · persistent terminal marker + one resume action
    模型请求失败,本轮对话已中断429 The engine is currently overloaded, please try again laterprovider.rate_limit · HTTP 429 · req_01KZ8Y…
  • A goal-continuation turn carries a provenance row: the hidden goal_continuation trigger (goal mode's self-driven next turn — a turn boundary, unlike task notifications) never renders its machine prompt; instead the assistant turn it opens shows one faint 12px line flush with the stream's left edge — the target glyph shared with the Goal tool (this turn belongs to the goal) + a localized label — ABOVE the turn's content and OUTSIDE the turn fold, so the row survives as the turn's provenance after settling. The marker lands with the trigger (before the first assistant block), and while the newest exchange is a goal-continuation turn the undo affordances (edit-and-resend, Esc undo) are suppressed — rewinding would drop the hidden trigger while refilling the older user text.
  • A settled turn's file changes are one summary card (TurnFilesSummary.vue): between the turn's final text and its footer, a §03 Card (hairline border, no shadow — NOT the quiet tool line, the artifacts are worth a discrete object) lists every file the turn's Edit / Write calls touched. The head reads "N files changed" with the aggregate +A −D and the mini diffbar; the aggregate hides whenever any row's stats are incomplete (a Write or an underivable edit makes the total a lower bound, never presented as exact). Each row is one clickable workspace-relative path (short and self-locating; a file outside the cwd stays absolute) with its per-file +A −D at the right edge. The row's action keys on the tool kind, and the stats tell it apart: a Write has no per-file count (its diff is underivable) and opens the whole file in the preview; an Edit / MultiEdit carries its +A −D and opens that file's turn diff in the right-side detail layer (TurnDiffPanel.vue — the turn's own X→Y change, not the git diff), whose header keeps an open-file action. The first three files show inline; the rest collapse behind a "N more files" ghost-button row in the card's foot. Where nothing handles the row action (the BTW side chat), the card renders its file rows as plain text instead of links.
',15)),a("div",ve,[e[31]||(e[31]=a("div",{class:"stage-bar"},[a("span",{class:"st"},"Turn files summary · a real TurnFilesSummary (fixed sample)")],-1)),a("div",fe,[a("div",pe,[c(A,{changes:C,cwd:ye,onOpenDiff:u,onOpenFile:u})])])]),e[40]||(e[40]=t('
Tool Call · quiet lines (expand on demand)
Read 2 files
Readsession.tssrc/auth · :12-4534 lines
12 export function verify(…
Readmiddleware.tssrc/auth58 lines
Editmiddleware.ts+12−4

Decision cards · Question / Approval

The two attention cards replace the composer in the dock and share one contract: a floating neutral shell (--color-surface-raised + hairline + --radius-lg + --shadow-menu), a plain dark 16px title head, and a hairline footer whose actions read in number-key order with exactly one accent primary. There is no semantic colour band — the floating card itself is the "needs a decision" signal.

Plan review · pinned option rows, second-line descriptions
按这份 plan 开始实现?
The plan markdown scrolls in a capped area; the approaches are pinned below it — label on the first line, full description always on the second. The number chip doubles as the keyboard hint.
1方案 A:静态徽章零依赖、渲染稳定,升级时需手动同步版本号。
2方案 B:动态徽章版本自动同步免维护,但要求仓库公开可访问。
  • Footer contract: actions are left-aligned in number-key order (1·2·3·4), each carrying a number chip — sized by --p-chip-num over --color-inline-code-bg, the same chip vocabulary as option rows and the multi-step chip; exactly one primary action, the rest are ghost. Feedback mode swaps the whole footer for submit / cancel.
  • Body by kind: Write approvals preview the incoming content with HighlightedCode (syntax-highlighted, 24-row cap with scroll); Edit approvals render the before/after hunk as a highlighted line diff. Plan / diff / file kinds get a head expand toggle that lifts the cap so the block fills the card; the card itself never exceeds the pane (only the scroll area shrinks) — with the dock work pills visible, the dock takes over the same height budget as a flex column, so an expanded card yields the pills' height instead of pushing them past the pane's top edge. Once the plan scrolls, a soft shadow fades in at the scroll area's top edge — the sidebar's scroll-linked seam language, so clipped content reads as passing under the card chrome.
  • Danger hint: destructive shell commands (rm -rf, sudo, force-push…) show a danger-soft filled hint row under the command — detection is a display-layer heuristic on the client.
  • Minimized: the card collapses to a thin bar with a mono peek of the subject; the whole bar is the expand click target.
  • Question card: the title is the question itself (2-line clamp), with a step chip for multi-question flows and a × dismiss button. Options use CSS radio/checkbox glyphs (accent when selected); the number chip and glyph top-align with the option text, optically centred on the label's first line. The footer follows the same left-aligned action contract (primary first, ghosts after), with the keyboard hint pinned to the right edge; keyboard: ↑↓ moves (Space toggles in multi), digits pick, Enter advances/submits, Esc dismisses.

Composer

Unified into a single raised container: --radius-composer (32px) with --corner-shape-composer: superellipse(1.5) and a stable 0.5px edge. Focus crossfades a low-chroma line-and-accent edge over --duration-slow with --ease-in-out, while the neutral shadow stays unchanged — there is no added halo and no layout shift. The textarea uses text-autospace: normal for mixed CJK and Latin input. Toolbar controls use a quiet 32px full-round geometry with 8px edge inset; the send button remains a standard 32px circle, with its glyph at 28px (--composer-send-icon-size, the production kimi.com size; it sits outside the --p-ic-* scale on purpose).

Fill and edge tokens: the card's fill and rest border are their own tokens — --color-composer-bg and --color-composer-line — running the kimiwork / kimi.com production input recipe (.chat-input__shell): fill = groupedBackground.secondary (#ffffff light / #1f1f1f dark), rest border = separator.s1 (13% black / 12% white), focus line = fills.f4 (25% in both schemes), and --shadow-input = effect.shadow.inputDefault (0 5px 16px -4px rgba(0,0,0,0.07), kept identical in dark — the hairline carries the edge there). Only colours sit in the tokens; the 32px superellipse shape and the focus-only edge overlay are unchanged.

Send button tokens: the send circle runs on --color-send-bg / --color-send-bg-hover / --color-send-icon (+ *-disabled, --opacity-send-disabled, --shadow-send[-hover]), following the production recipe (.chat-input__send): a neutral labels.primary fill (90% black light / 84% white dark, hover #252525 / 84.8%) with the production lift shadow (0 7px 16px -13px 38% + 0 1px 2px 7%, one step larger on hover), a groupedBackground.secondary glyph, and a disabled state of the same vocabulary — fills.f2 fill with a labels.quaternary glyph at full opacity. The button is disabled exactly when submit would no-op — an empty draft with no ready attachment (image-only sends stay enabled), an upload in flight, or the starting spinner — so disabled is a first-class persistent state, never a fade.

Layering, anchors, and motion: the dock normally stays at --z-sticky so the Latest Messages pill can remain visible above its veil. While any Composer popup is open, the dock temporarily joins --z-dropdown, ensuring permission, work-mode, and model menus always paint above that pill. The permission menu's left edge and the model menu's right edge each follow their own trigger pill. All three menus use --shadow-menu and the same trigger-corner pop motion as Session Row menus: 0.97 scale with a 2px shift toward the trigger, --duration-base on entry, and --duration-fast on exit.

Attachment strip: attachments hang inside the composer card above the textarea as two grouped rows — images/videos as shared MediaThumb rounded thumbnails, files as the shared AttachmentChip pill — the same pair the sent bubble renders, so a draft looks exactly like the sent message. File-store videos render a static play tile instead of fetching a first frame. The strip caps at two thumbnail rows and scrolls beyond that instead of pushing the input down; while overflowing, a quiet count badge pins to the bottom-left and new attachments auto-scroll into view (to the end of whichever group grew). With two or more attachments, a one-click clear-all pins to the strip's top-right corner as a quiet 22px badge (trash glyph, danger on hover). The composer's pending preview and the bubble's media clicks open the same MediaLightbox preview, which owns Escape via the shared dialog stack: images go through PhotoSwipe (@moonshot-ai/app-client's lib/mediaPreview) and zoom out of the clicked thumbnail (scrim = --color-scrim-strong, caption = --color-text-on-scrim; the slide area is inset — 24px sides matching the video modal, 56px top/bottom clearing the close button and caption — so a viewport-filling image never kisses the edges), videos keep the custom modal. Both share the --color-scrim-strong backdrop and the same close button — the raised 36px circle (.media-lightbox-close) fixed at the viewport's top-right, rendered by MediaLightbox for both (PhotoSwipe's own top bar is disabled; zoom stays on wheel / pinch / image click). ReadMedia tool cards open it too (an App-level instance fed by the openMedia chain): the image zooms out of the card's thumbnail, and videos show as a static play tile that opens the modal player — no more right-side-panel detour or inline <video>.

',11)),a("div",he,[e[38]||(e[38]=a("div",{class:"stage-bar"},[a("span",{class:"st"},"Composer")],-1)),a("div",ue,[a("div",ge,[e[36]||(e[36]=a("div",{class:"p-composer-ta ph"},"Message Kimi, / to run a command, @ to reference a file…",-1)),a("div",be,[a("div",me,[e[33]||(e[33]=a("button",{class:"p-icon-btn"},[a("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[a("path",{fill:"currentColor",d:"M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"})])],-1)),a("span",we,[c(f(h),{name:"shield-question",size:"sm"}),e[32]||(e[32]=d("yolo",-1))]),e[34]||(e[34]=a("span",{class:"p-pill"},[a("svg",{class:"p-ic",viewBox:"0 0 24 24",fill:"currentColor"},[a("path",{fill:"currentColor",d:"M8 4h13v2H8zM4.5 6.5a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 7a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m0 6.9a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3M8 11h13v2H8zm0 7h13v2H8z"})]),d("plan")],-1))]),e[35]||(e[35]=t('
kimi-k2· thinking
',1))])]),e[37]||(e[37]=t('
kimi-code-web
',1))])]),e[41]||(e[41]=t('
i
Site-wide consistency: the composer uses one 32px superellipse shell and one 32px desktop control height. Attachment, permission, modes, compact, and model controls are all full-round and transparent at rest; hover reveals a neutral wash, open/active may use accent-soft, and Send remains the sole persistent filled control — an inverted --color-text fill with a --color-bg glyph (never the accent), disabled while the input is empty or an upload is in flight. The transparent dock floats over the transcript, while the scrolling content receives bottom padding equal to the live dock height so its final item can still clear the composer. Composer chrome is not selectable; only the message input permits text selection. Each permission mode has its own registry icon — manual hand, yolo shield-question, auto full-access — paired with the label in the pill (collapsing to the accessible icon below a 620px composer container) and leading its dropdown row in the mode's colour, with the current row's check trailing the row's end. The right toolbar is the flexible region: the model pill shrink-wraps its content, then shrinks and truncates internally only when the toolbar runs out of room. The dock's workbar above the composer carries one pill vocabulary — 32px high with --space-4 inline padding and stadium-shaped (--radius-full) corners, a --color-surface fill (one rung above the page in both schemes — sunken is degenerate in dark — the same material as the popover it opens), and the system hairline edge (0.5px at --color-line-strong, one rung up for presence; no shadow), icon + label + a count or status — for background bash tasks, background sub-agents, todos, and the goal alike; a pill toggles the shared work panel (itself at --radius-xl with the same 0.5px --color-line-strong edge outside — inner separators stay --color-line — and the menu panel's --shadow-menu), and the goal's detail (full objective, completion criterion) fills the panel body while its pause / resume / cancel controls ride the panel head (the decision cards' action vocabulary — exactly one accent primary, resume while paused; secondary pause while active; danger-soft cancel) and the meta counts (turns / tokens / time / budget) sit in a hairline footer — never a separate full-width strip.

Workspace attachment card: on the empty session, the workspace picker is a separate attachment card tucked under the composer — and the composer card itself stays complete (its own 0.5px border, --radius-composer corners with --corner-shape-composer, and shadow are never altered). The attachment lives inside the composer's padding box as the card's sibling, so its width always matches; its top --space-4 slides behind the card (the card is raised to --z-sticky), its square top edge stays hidden, and only the rounded bottom (0 0 --radius-xl --radius-xl) shows. Background --color-hover at 60% via color-mix (≈0.03 black in light, self-adapting in dark), no border, no shadow. Inside sits one quiet capsule trigger: transparent, --radius-full, 16px leading icon and 12px label at weight 475 in --color-text-muted; hover deepens to --color-selected and the label turns --color-text. The dropdown follows the §03 menu spec and is viewport-aware (flips above when more room, clamps max-height to the scrollport); at --z-dropdown it outranks both the card and the fixed click-outside backdrop (--z-sticky), which renders outside the composer because the card's container-type captures position: fixed descendants.

Responsive

See §02 --p-bp-sm for the breakpoint. This section only gives mobile-adaptation pointers for the chat interface; a full mobile mockup is out of scope for this spec.

i
At ≤640px: dialogs anchor to the bottom as Sheets (xl top radius, top drag handle), the sidebar collapses into an expandable drawer, the Composer toolbar is allowed to wrap, and the chat reading column drops its max-width to fill the screen.
',5))]),e[43]||(e[43]=t('
05

Theming

Kimi Web uses one unified theme: the same components, fonts, radii, shadows, and surfaces — theming only swaps color values. Every semantic color token ships a light value in :root and a dark override in the data-color-scheme blocks; the semantic status colors (success / warning / danger) are independent palettes, one set each for light / dark.

Accent

The app has one accent: the brand blue (--color-accent, #1783ff light / #58a6ff dark). Use it sparingly — the accent is reserved for the primary action, focus rings, links, and active marks (current tab, toggles); large fills always come from the neutral surface tokens. Selection that means "where I am" (sidebar rows, list pickers) is deliberately NOT accent-tinted — it uses --color-selected so it reads as location, not as an action.

Light / dark mode

Each semantic token ships a light value in :root and a dark override in the two data-color-scheme blocks (explicit choice, or following the OS preference via prefers-color-scheme). Switching light / dark simply swaps between these two sets of derived tokens, with zero structural change.

Benefits of one theme: components, fonts, radii, and surfaces are consistent site-wide; a single accent keeps the brand identity unambiguous; light / dark mode works out of the box; semantic status colors are independently tunable.
06

Style Rules

Anti-pattern rules that all UI code must follow. These rules are also the basis of the check-style detection script, one-to-one with a warning.

Rule IDWhat it detectsAction
no-gradient-textgradient text / gradient backgroundForbidden
no-glassmorphismbackdrop-filter: blur (TopBar sticky nav bar and menu surfaces via --p-menu-backdrop are the exceptions)TopBar + menus exempt
no-color-glowcolored / large-radius box-shadow glowForbidden
no-emoji-iconusing emoji as a functional icon (no exceptions). Emoji inside user content — session titles, messages — is not chrome and is out of scope (see §07 Session row's emoji icon)Forbidden
no-hardcoded-hexunregistered hex color inside a component <style>Warning
no-hardcoded-fonthard-coded font-family in a component (e.g. 'Inter') instead of var(--font-ui)Warning
radius-from-scaleradius value not in {4,6,8,12,16,20,999}Warning
z-from-scalez-index using an unregistered large numberWarning
weight-from-scalefont-weight not in {400,500}Warning

State matrix

Every interactive primitive should define the following states where applicable; missing ones are flagged by the style rules. focus-visible always uses --p-focus-ring (appears only on keyboard focus, see §08); disabled is uniformly opacity:.5.

StateButtonInputCardMenu itemSwitch
default
hover
active / pressed
focus-visible
disabled
loading
selected / active
error
readonly

Chat working indicator

The chat working state ("prompt sent, turn unfinished") is a brand signature of Kimi Web, rendered uniformly by the WorkingIndicator component: the 小蓝 mascot plus a phase label — "Requesting…" until the assistant's reply starts, "Working…" once it is streaming. All other loading states (including ActivityNotice) use the plain Spinner.

Glassmorphism exemption

backdrop-filter: blur is banned site-wide, with two exceptions: the .frost variant of TopBar — only in the one place of the "sticky navigation bar", used to stay readable over scrolling content — and the floating menu surfaces (Menu.vue, the Select listbox, composer dropdowns, slash/mention popups), which go through the --color-menu-bg / --p-menu-backdrop token pair so the recipe stays single-sourced. No other component (card, dialog, Toast, panel) may use glassmorphism; violations are flagged under no-glassmorphism, and menu blur with ad-hoc values (anything but the token) is flagged too. Persistent panels that stay open over scrolling content (the dock work panel) deliberately stay opaque — a live backdrop blur re-samples the scrolling page every frame and janks in Chromium.
07

App Shell & Sidebar

The structural spec for the app shell (three-column grid + right preview panel) and the left session sidebar. These are business-agnostic "skeletons" — components, fonts, radii, and surfaces are reused from §02 / §03, but layout and alignment have their own conventions.

Layout grid

On web it is a single-row 5-track grid: the sidebar and the right panel each occupy a permanent auto track, with the conversation column in the middle; two 0-width tracks are for the ResizeHandles. (The desktop app adds a second row for its terminal panel — desktop-only, see below.)

App.vue · .app
grid-template-columns: auto 0 minmax(0, 1fr) 0 auto;\n    /*         sidebar ↑    ↑handle  ↑conversation  ↑handle ↑right panel (auto) */
TokenValueUsage
sidebar width270px default (adjustable)expanded sidebar width, changed by dragging the ResizeHandle; should approach §02's --p-sidebar-w (264px)
--preview-w460pxwidth of the right preview panel when open
--panel-head-h48pxunified height for all right panel heads + the conversation column head; both use a 0.5px bottom hairline
--p-bp-sm640px≤640 switches to a mobile single column (top bar + conversation), no sidebar / handle / right panel
  • The right panel track exists permanently, with its width toggling between 0 ↔ var(--preview-w) and no transition — animating a grid track would relayout the whole app grid every frame (when open it squeezes the conversation column, rather than switching templates).
  • The sidebar collapses SYMMETRICALLY to the right panel: its container width animates to 0 while the content keeps its fixed width anchored to the right edge (clipped, sliding out left — no reflow, hairline stays on the clipped content). No rail remains. The collapse control differs by platform: on macOS desktop the toggle is a single resident floating IconButton pinned beside the traffic lights (rendered in both states, only the glyph swaps — the sidebar slides underneath it, never moves or flashes); on Windows / web the collapse button lives inside the sidebar header (right-aligned), and a floating expand button appears at the top-left only while collapsed. The conversation header uses a 0.5px bottom hairline and pads left in step with the transition while collapsed.
  • All grid children must have min-height:0; min-width:0, so only the inner scroll containers scroll and the page itself does not scroll.

Sidebar alignment system (--sb-*)

All sidebar rows (group head, session row, New chat, search, and Settings buttons) share 4 custom properties. Their 16px icon slots and --sb-gap place every label on the same x-axis as the workspace name.

TokenValueUsage
--sb-inset12pxrow box (hover/selected pill) inset from the sidebar edges — matches the brand header's 12px padding
--sb-pad-x20pxcontent start x (= --sb-inset + 8px row padding)
--sb-gutter16pxleading icon slot width — matches the workspace folder icon so the session title aligns under the workspace name
--sb-gap8pxgap between the icon slot and the text
i
The session title's starting x = --sb-pad-x + --sb-gutter + --sb-gap. The group head has a folder icon and the session row has a status slot; both icons are the same width and position, so the titles align naturally.

Sidebar structure

The sidebar from top to bottom: brand header → action group → pinned head (pinned section + "Workspaces" label) → scrolling grouped list (workspace head + session rows) → user-menu footer. New chat and Search are direct sibling controls in the same grid container; the optional new-workspace action shares the first row, while Search spans the next row. A 4px gap keeps Search clear of the scroll boundary. The pinned head sits OUTSIDE the scroll container (the action-group / footer pattern — never position: sticky, which would need an opaque plate over the frosted tint), so the pinned sessions and the "Workspaces" label stay put while the workspace groups scroll beneath; the pinned section is collapsible (a chevron on its label, revealed on hover/focus and kept visible while folded; state persisted) so a long pinned set can't eat the sidebar, and it re-expands when a new session is pinned. Both pinned edges use three light near, middle and far fades across 18px, entering over 260ms only while more session content exists beyond that edge — the top seam lives at the pinned head's bottom border. The footer seam is a 0.5px hairline. Controls reuse the §03 primitives as much as possible. The sidebar sits on --color-sidebar-bg (one step off --color-bg: warm off-white just under white in light, one step BELOW the page in dark — the session column reads as its own plane, and with dark elevation = lighter the chrome never sits brighter than the conversation pane; the hairline still separates it from the pane). Vertical rhythm: the brand header keeps 12px padding (on macOS desktop the left padding grows to 80px to clear the traffic lights); rows inside the action group stack flush (0 gap, same rhythm as the list rows); adjacent groups are separated by 12px. The search glyph has a -0.5px optical correction to align its visual centre with the label. Row hover uses --sb-hover (= the global --color-hover wash); the selected row uses the lighter --sb-selected wash derived from --color-selected — On macOS desktop the sidebar is instead frosted: the window carries a native NSVisualEffectView ('menu' vibrancy, following the in-app scheme via the nativeTheme mirror, its state pinned to inactive so the material keeps its flat pressed-down colour — ≈ #282829 dark / #E7E7E7 light — with no active/inactive drift) and the sidebar column drops --color-sidebar-bg for a single translucent --color-sidebar-tint wash that presses the pinned material one step — ≈ #282829 → ≈ #1e1e1f in dark (rgba(0,0,0,0.25)), ≈ #E7E7E7 → ≈ #f1f1f1 in light (rgba(255,255,255,0.4)) — with header and footer staying transparent so the tint reads as one uniform pane; the root chain (html/body/#app/.app) stays unpainted only under the macos-desktop + vibrancy flags — the latter is the Settings → Appearance accessibility switch (default on; persisted main-side so the window is created with the right material, and live-applied on toggle): off repaints the root chain and the sidebar falls back to opaque --color-sidebar-bg, while the traffic-light layout keeps keying off macos-desktop alone — while the conversation pane, chat header and right preview keep their own opaque surfaces. The list's hover-icon clusters (session-row kebab, group-head actions) paint NOTHING there — no plate, no wash, no blur (real backdrop blur does not even render over this window: Chromium's backdrop sampler returns a flat wash above the transparent BrowserWindow + vibrancy view). Instead the row's title/name dissolves before it ever reaches the buttons: a two-stage mask-image fade — a subtle 16px dissolve at rest, extending over the cluster zone only while the actions are revealed (row hover / keyboard focus / menu open): 34px on session rows (the pin+kebab cluster overhangs the title by ≈25px), 68px on group heads (the floating cluster is ≈60px wide). The fade is zone-based, so short rows render untouched, and text-overflow becomes clip so a long tail dissolves instead of dotting.

BlockUseNote
Brand headerlogo + name + collapse IconButton (right-aligned)on Windows / web the brand is left and the collapse IconButton sm is right-aligned inside the header; the dev-only backend version/address pill uses the UI font, not monospace; the logo is animated (a blinking eye). On macOS desktop the header is a bare drag strip (brand hidden, traffic lights + resident floating toggle over it)
New chatfull-width left-aligned button (custom)500-weight label; same rhythm as the session rows in the list (left-aligned, hover = --sb-hover). Do not use Button (centered, breaks the rhythm)
Searchbare search row (custom)500-weight label; no border, hover/focus shows the faint --color-hover wash; icon + label, with the Kbd keycaps (⌘K / Ctrl K) pushed to the trailing edge — label and shortcut are justified apart. Do not use Input (the 38px bordered version is too heavy). It is a direct sibling of New chat in the action group
Section label.p-section-labeluppercase muted small titles like "Workspaces", using --weight-section-label (600)
Pinned headfixed block above the scroll container (.sessions-head): the pinned section (PinnedSessionList.vue) + the "Workspaces" section labelstays put while the workspace groups scroll; owns the top scroll-linked seam (hairline + fade, only while scrolled). The pinned section folds via its label chevron (persisted, kimi-web.pinned-collapsed) and re-expands only on an explicit pin (never on load backfill); the expanded rows are capped at 40vh with their own scroll so a long pinned set can't push the list or footer out of view
Workspace head / session rowsee next two sectionsshare --sb-* alignment
User-menu footeraccount area (components/UserMenu.vue) opening an upward §03 menupinned row under the session list, separated by a 0.5px --line hairline; trigger keeps the same list-style family as New chat (24px round avatar + nickname when signed in, user icon + sign-in hint otherwise). The menu box follows the trigger's left edge and width (ResizeObserver-tracked, so it survives a sidebar resize) and is teleported to body because the column's container-type would capture position:fixed. Rows: plan usage / theme / language are macOS-style hover flyout submenus — the parent row carries the module icon, a faint current value and a fixed chevron-right, and hovering (or moving focus to the parent row, or pressing Enter / Space / → on it) opens a teleported panel anchored to the parent menu's right edge (content-adaptive width floored by the menu's own min-width and capped at the parent menu's width; flips left near the viewport edge) with a 250ms hover-intent close grace; the usage panel shows weekly + 5h rows (percent values with severity colours), while the theme (three schemes) and language (two locales) panels move the check to the picked option without closing the menu — then the upgrade entry below the top plan level, settings (with an always-visible Kbd keycap shortcut hint on desktop) and a confirming sign-out; all menu icons come from the Kimi set
!
Why New chat / search / inline rename don't use Button / Input: they are "list-style" controls (full-width, left-aligned, compact, borderless), while Button is centered and Input is a 38px bordered control — forcing them in would break the sidebar's visual density and alignment. This is an intentional custom exception, not an oversight.

Session row

A session row is an inset rounded pill, structured as: status slot → title → time → attention Badge → hover actions (pin / archive).

PartRule
Containerpadding: 8px 8px inside the list's --sb-inset gutter, radius-sm; no fixed/min height — row height is font-driven (title line-height: --leading-tight, ≈16px) → ≈32px total, the sidebar-wide row rhythm. The hover actions are absolutely positioned so they never force the row taller (no hover jitter). hover = --sb-hover (the global --color-hover wash); active = --sb-selected (75% of the global selected wash) — neutral, no accent tint, no border, no weight change
Status slot (lead)fixed --sb-gutter width; running = Spinner sm, otherwise unread = 7px accent dot
Titleflex:1 with truncation and user-select:none; double-click enters inline rename (compact input, not Input), whose text remains selectable
Emoji iconthe session icon is the title's LEADING emoji cluster (app-core splitSessionEmoji — no icon field; every client renders the title as-is). The emoji is an ordinary title character — no decoration at rest or on hover (it stays a <button> for a11y), and clicking it opens SessionEmojiPicker — a Menu-shelled panel (bare list-style search row → scrollable sections: Recently used persisted in localStorage (cap 8) + the grouped emoji dataset, with remove/random as MenuItems in the footer; a query swaps the sections for keyword-search results), teleported + fixed + --z-dropdown, popping from the trigger corner like the right-click menu. The menu's "Set Emoji…" opens the same picker and is the discoverable path. Inline rename edits the whole title — the emoji is an ordinary character in the input
Timemono xs, fg-faint; yields to the hover actions on hover
Attention BadgeBadge sm: info (needs answer) / warning (needs approval) / danger (aborted)
Hover actionsIconButton sm × 2 — pin + archive — cross-faded over the time on row hover (no kebab button). Right-clicking the row opens the full menu (copy ID / rename / emoji / fork / export / pin / archive + timestamp) anchored to the cursor, except over the inline rename input, where the native text-editing menu stays
Flat-style variant (flat list + pinned section)the sidebar's flat list rows AND — always, regardless of view mode — the pinned section's rows differ from the grouped row in three ways (all keyed off the facade projecting cwdLabel): ① no leading status slot — the title is left-aligned at the row's content edge; ② a second line under the title: folder-closed icon sm + the cwd's final directory name (- when the session has no cwd), xs faint like the time — except the icon, which takes --color-text-muted (one rung stronger, the same optical compensation as the group head's folder; the open-folder glyph's thin back-flap washed out at 14px) — rest-width tail mask fade; when the session has an associated PR (v2 git domain), a quiet chip (git-pull-request icon + #number) sits at the line's right edge, state-colored the GitHub way (open = --color-success, merged = --color-done purple, closed = faint) and opens the PR on click; ③ the first line's right side shows status — attention Badges anchored to the row's right edge, running Spinner, unread dot — INSTEAD of the time, which only renders when there is nothing to report (the Spinner yields to the attention pills: a session waiting for approval/answer never shows both); on hover the actions cross-fade IN as the whole status cluster fades OUT — pills and pin/archive never co-exist (grouped rows keep pills visible on hover). Height stays font-driven — the pill just grows the line. Grouped rows never set cwdLabel and keep the classic structure. The flat ↔ grouped switch lives in a dropdown on the SESSIONS section label (fixed list-settings icon + hover tooltip; the menu opens with a muted group label, per-view icons, and the current view checked at the row's right edge; mode persisted per device)
Archiveno confirm — the hover archive button / menu item archives immediately, then App.vue shows the §03 ActionToast (top-center) with Undo (restores the session) and Settings (opens the archived list)

Workspace group

The group head and session rows share --sb-*: folder icon (open/closed) → name, with the kebab and "+" revealed on hover.

  • The folder icon leads the row (switching icons between open and closed states) with the plain --sb-gap before the name — it does not pad out the --sb-gutter slot.
  • The name uses 500 weight with muted color (--color-text-muted, one step lighter than session titles), so group heads remain clear without competing with list content. No path subtitle; hovering the name shows the full root path in a Tooltip.
  • The kebab (menu) and "+" (new chat in this workspace) both use IconButton sm inside a floating actions layer anchored to the row's right edge — no reserved layout space, so the name uses the full row width when idle. Shown on hover, keyboard focus, or while the menu is open; the layer backs itself with the sidebar surface (container background) plus the row hover wash (an ::after shown only while the row is hovered), so its color exactly equals the row's current background and the overlapped name tail doesn't bleed through (hidden via opacity:0, staying in the tab order). On macOS desktop the layer paints nothing at all — the name's mask-image fade (see the sidebar section above) dissolves the tail before it reaches the buttons
  • The group is collapsible; when collapsed its session list is hidden.
  • While the active workspace has no session selected (the draft state — e.g. right after adding the workspace, or after New chat), the group head carries the same neutral --sb-selected fill as a selected session row (selection reads as "where I am"; the fill wins over hover). Once a session is selected or created, the fill moves to that session row.

Show more & collapse

The "expand / collapse" controls at the bottom of each workspace group are compact list controls (same family as search, New chat, inline rename — not Buttons) sharing one row: expand (chevron-down) first, collapse (chevron-up) after a faint middot when both are present. Expanding reveals the next batch of sessions, fetching the next page from the server only when the locally loaded rows can't cover it — the control never exposes whether a reveal came from memory or the network.

PartRule
Rowa single flex row holding the controls, all content-width — hover washes just the button as a snug pill, never the full row. Font-driven height (≈32px like a session row), radius-sm; hover = --sb-hover (no text recolor); :focus-visible uses --p-focus-ring
Chevronsm (down = expand, up = collapse); the row indents by --sb-gutter + --sb-gap so the first button's chevron starts exactly at the session-title x, lining the control's leading edge up with the titles above
Labelfont-ui, text-xs, --color-text-muted; truncated
Separatorfaint middot (--color-text-faint) with --space-1 side margins, rendered only when both controls are present
Behavioreach group keeps a display cap starting at the first page; "Show more" steps it up by one batch (5) and fetches the next page only when the loaded rows fall short (busy = "Loading…", disabled); "Show less" resets the cap to the first page (view-layer trim — data is kept, no refetch). "Show more" exists while undisplayed loaded rows remain or the server has more; "Show less" appears once past the first page

ResizeHandle

A 4px grab strip layered over the 1px column border (margin: 0 -2px makes the whole 4px grabbable) with a centred 2px indicator bar. The bar stays transparent at rest and shows the neutral fills one step up the ramp — f2 on hover, f3 while the drag is live (the sidebar column is translucent on macOS, so f1 read too faint) — never the accent.

RuleValue
Width / cursor4px strip, 2px bar / col-resize mid-range; w-resize / e-resize at the drag limits (hints the direction that still resizes)
Normal / hover / dragtransparent / --color-selected (f2) / --color-line-strong (f3) — the neutral ramp one step up, never accent
Layer--z-dropdown, above pane-level sticky chrome (chat dock at --z-sticky) so the overhang stays visible and grabbable
Behaviorpanel width follows the pointer 1:1 while dragging (the parent disables transitions to avoid lag); on release it is persisted to localStorage

Right panel

The right panels (file preview / Diff / compaction summary / sub-agent / side chat) share one track and one head primitive.

  • The panel head uses the PanelHeader primitive (48px = --panel-head-h), the same height as the conversation column head, so the hairline runs as one line.
  • Panel head: bold mono title + optional muted subtitle + middle slot (Badge / control / path) + close IconButton on the right.
  • When opened, the panel width snaps from 0 → var(--preview-w) with no animation, squeezing the conversation column in a single layout.
  • At ≤640px the panel becomes a full-screen overlay (position:fixed; inset:0).

Bottom terminal panel (desktop-only)

The native terminal (components/terminal/) sits in the conversation column's own bottom grid slot — the sidebar and the right panel span BOTH rows and keep full height (the VS Code layout: the panel belongs to the editor area, not to the whole window). Its height transitions 0 ↔ var(--terminal-h) (260px default, 120 min, 60% viewport max; persisted), squeezing the conversation column above instead of overlaying it. The panel mounts lazily on first open and then stays mounted so xterm scrollback survives a collapse.

  • Resize: a horizontal twin of the ResizeHandle (4px strip over the 0.5px top hairline, row-resize mid-range, n/s-resize at the limits, same neutral f2/f3 ramp, never accent). The shared useResizable hook owns it via axis: 'y'; the height var is written imperatively during a drag (same no-Vue-rerender rule as --preview-w).
  • Toolbar (32px, 0.5px bottom hairline): tab strip on the left — each tab is a compact radius-sm pill (leading terminal glyph, muted while exited + shell label + hover close affordance), the active tab uses --color-selected, hover --color-hover; a "+" action appends a tab. Tabs follow the §08 tablist keyboard model (roving tabindex, ←/→/Home/End), the close affordance is its own button (no nested interactives), and the height separator is keyboard-operable (↑/↓ in steps, value exposed). Trailing actions: restart (only while the active tab exited) and a collapse chevron. Collapsing sets inert on the region — the xterm instances and their scrollback stay mounted but leave the tab order.
  • The xterm canvas cannot resolve CSS variables either, so its palette is resolved from the live --color-* tokens at runtime (re-read on scheme flips; the ANSI hues the status ramp doesn't cover use dedicated --color-term-magenta/cyan tokens); the font is the app JetBrains Mono stack sized off the content token scale. While focused, the panel owns every key except the registered app shortcuts (chat-level Esc / find / select-all chords stay inert inside it).
  • Entries: the chat header's terminal IconButton (right of Open in, lit while the panel is open) — on the empty-composer state, where no chat header renders, the same button floats at the conversation's top-right instead — plus ctrl+` (⌃` on macOS — VS Code's binding; ⌘` stays free for the OS window switcher — customizable in the shortcut registry), and the View menu's Toggle Terminal item. New tabs spawn in the visible workspace root. Terminal state is per session: switching sessions swaps the visible bucket while the others keep their PTYs and xterm views alive (scrollback survives a round trip; the ten most recent sessions are kept, LRU). The panel never renders on mobile / web.
i
One-sentence principle: the sidebar / shell is a "list + grid" skeleton that reuses the §02 tokens and §03 primitives (Button / IconButton / Badge / Kbd / Menu / Spinner / PanelHeader); compact list controls that don't fit a primitive (search, New chat, inline rename, show-more) keep their custom form, governed by this section.
08

Accessibility (pragmatic edition)

Kimi Web is a local developer tool; it does not target a specific WCAG conformance level, nor maintain a full screen-reader QA matrix. This section collects only the rules that are "low-cost, don't hurt the look, and directly benefit keyboard-heavy users", as the baseline contract for each primitive; the more expensive, lower-ROI parts (such as real-time announcement orchestration for streaming output) are not mandatory for now.

i
On the "ugly" focus ring: the focus visibility required below always uses :focus-visible (not :focus). It appears only on keyboard focus; mouse clicks don't trigger it, so it doesn't pollute the mouse-driven visual; the ring's strength is tuned uniformly with --p-focus-ring, not overridden per place.

1. Contrast & color

  • Body text vs. background contrast ≥ 4.5:1; control borders, icons, and key graphics ≥ 3:1. When changing theme colors / dark mode, verify against §05 together.
  • Button text vs. button background, and form controls (input, placeholder, helper / error text) vs. their section background must all have contrast ≥ 4.5:1 (large text ≥ 3:1). White-on-white text, a transparent borderless button floating over the page background, and a light placeholder on a near-white background are all flagged by the style rules.
  • State is not conveyed by color alone. Error, selected, and disabled states also carry text, an icon, or a shape change (for example an error state is not just red, but also carries text or an icon).

2. Keyboard operable

Anything doable with a mouse must also be doable with a keyboard; Tab order follows the DOM, with no invented skipping. Composite controls define their keyboard model per the table below; a missing model is treated as incomplete:

ControlKeyboard behavior
DialogTab cycles within the dialog (focus trap); Esc closes; focus returns to the trigger element after closing.
Menu / move the highlight, Enter selects, Esc closes.
Tabs / switch tabs (roving tabindex); only the current tab is in the Tab sequence.
Switch / Segmented / or Space / Enter to toggle.

3. Focus visibility

  • Every interactive element must have a visible focus indicator on keyboard focus, uniformly via :focus-visible + --p-focus-ring (primary actions may use --p-focus-ring-strong).
  • Bare outline: none is forbidden. To remove the default outline, you must provide an equivalent replacement style.

4. Labels & semantics

  • Semantic HTML first (button / a / input / dialog…); ARIA is added only when native semantics fall short.
  • Icon-only buttons must have an aria-labelIconButton already enforces this with a required label prop.
  • Dialog: role="dialog" + aria-modal="true", with the title as the dialog's accessible name.
  • Purely decorative SVG / icons get aria-hidden="true" to avoid being read out by screen readers.

5. Target size

Desktop click targets ≥ 32px; touch devices ≥ 44px (consistent with the §01 principle and the IconButton lg tier).

6. Reduced motion

Handled uniformly in the global styles per §02's @media (prefers-reduced-motion: reduce); components do not check this individually. The chat working indicator's mascot renders its static fallback.

7. Live announcements (non-mandatory)

Screen-reader announcements are not a mandatory contract in this product. Short hints like Toast can use role="status" / aria-live; chat streaming output is currently not announced word-by-word, which is an acceptable trade-off, to be added later if a real need arises.

Explicitly not mandatory for now: a WCAG conformance-level claim, a complete ARIA pattern table, a per-screen-reader QA matrix, and real-time announcement orchestration for streaming output — these are not written into the primitive contract, to avoid becoming slogans no one maintains.
09

Dialogs

Every overlay in the app — pickers, browsers, managers, confirmations — is built on the single §03 Dialog primitive. This chapter fixes the two layout anatomies allowed inside that frame, plus the row and footer contracts that make all dialogs read as one family. Do not hand-roll a third anatomy.

The frame (recap)

All dialogs share the §03 primitive: --radius-xl radius, --shadow-xl shadow, a restrained 28% neutral backdrop, a head (title + IconButton close), a body, and a right-aligned foot. Widths md 440 / lg 640 / xl 760 and auto / fixed height are chosen per §03. One interruptive overlay at a time; Esc closes; focus is trapped and restored. A blocking flow that must be resolved rather than dismissed (server token) uses hideClose with closeOnOverlay/closeOnEsc off — never a hand-written overlay.

Anatomy A — padded (forms & confirmations)

The default: the body carries its own padding and the caller drops content straight in. Confirmations put their Buttons in the #foot slot (right-aligned, cancel → confirm). Used by: confirm, login, status panel, server token.

Anatomy B — flush (pickers & browsers)

:padded="false" with height="fixed"; the consumer owns the zone layout inside a full-height column. The zones below are the whole vocabulary — a picker dialog composes them and adds nothing else. Used by: model picker, session search, folder browser, provider manager.

ZoneContract
SearchThe boxed §03 Input, inset 22px so its edge aligns with the head title. Autofocus on open. No leading icon, no borderless variant.
Filter chipsOptional. 28px pill: transparent + muted text by default, --color-hover on hover, --color-selected + medium --color-text when active. Horizontally scrollable with the scrollbar hidden. Never a row of Buttons.
Listflex:1, owns the vertical scrolling, padded 4px 8px so rows bleed near the dialog edge. role="listbox"; rows carry role="option" + aria-selected.
Row8px 12px padding, --radius-md. Two quiet lines: name 14/20 (medium when current) and a meta line 12/18 in --color-text-faint — provider · context · capability labels, dot-separated. No badge rows, no raw-id line (search still matches them). Trailing slot: check icon (current row only), then the star IconButton.
Row statesHover / keyboard-selected → --color-hover; current → --color-selected — a neutral "where I am" fill, never an accent tint, never an inset stroke. The star stays hidden until row hover, keyboard selection, or starred; it is always visible on touch devices and colored --star when starred.
State rowsLoading / unavailable / empty: centered on both axes, muted 14px; warning color only for the unavailable case.
Shortcut barThe footer: full-bleed, padding 8px 16px, border-top --color-line, left-aligned. Keyboard hints are Kbd keycaps + 12px --color-text-faint labels, groups separated by "·", the whole bar aria-hidden. An instructional sentence (folder browser) reuses the same bar without keycaps.

Keyboard & behavior contract

  • / move a keyboard selection (rendered identical to hover) and always scrollIntoView({ block: 'nearest' }); Enter selects and closes; Esc closes.
  • Pointer hover drives the same selection index, so keyboard and mouse never disagree about which row is active.
  • Rows transition background only (--duration-fast ease-out); the open/close animation lives in the primitive, not in the consumer.
  • Selection is a fill, not a border (surface over stroke). Accent blue is reserved for actions — primary buttons and focus rings — never for "which row am I on".

Dialog map

DialogAnatomyComposition
Model pickerflush · lg · fixedsearch + provider chips + model rows + shortcut bar
Session searchflush · lg · fixedsearch + result rows + shortcut bar
Folder browserflush · lg · fixedbreadcrumb bar + filter bar + folder rows + actions + hint bar
Provider managerflush · xl · fixedmanagement rows with inset dividers (rows are not selectable) + add section + shortcut bar
Confirm / Login / Statuspadded · md · autotitle + message or form + right-aligned foot
App update (desktop)padded · lg · autoversion title + quiet meta line (release date · current version) + height-capped scrolling what's-new list / progress bar + right-aligned action row (skip → download, later → restart) with the auto-download checkbox right-aligned on its own foot row below (a pure preference for future checks)
Server tokenpadded · md · autohideClose, no Esc/overlay close — resolved only by a valid token
Settingsflush · xl · fixedpage-like exception: side-nav region, per §03
Onboarding wizardnot a Dialogfull-page takeover (not built on §03): one centered column (brand lockup → step content → ghost actions + centered primary CTA); selectable options share the option-card pattern — 0.5px --color-line hairline, --color-accent border + --color-accent-soft fill when selected
Design intent: a picker dialog should feel like a quiet command palette — one boxed search, calm rows, a neutral "you are here" fill, and a predictable shortcut bar. Anything noisier — badge clouds, accent-selected rows, per-dialog footer inventions — is a regression to weed out.
',5))])])])]))}}),Se=M(ke,[["__scopeId","data-v-5fe218d3"]]);export{Se as default}; diff --git a/apps/kimi-code/dist-web/assets/DesignSystemView-DVONbdv-.css b/apps/kimi-code/dist-web/assets/DesignSystemView-DVONbdv-.css new file mode 100644 index 00000000000..9942d27b222 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/DesignSystemView-DVONbdv-.css @@ -0,0 +1 @@ +.ds-page[data-v-5fe218d3]{--d-bg: var(--color-bg);--d-surface: var(--color-surface);--d-surface-2: var(--color-surface-sunken);--d-surface-3: var(--color-line);--d-fg: var(--color-text);--d-fg-soft: var(--color-text-muted);--d-fg-muted: var(--color-text-muted);--d-fg-faint: var(--color-text-faint);--d-line: var(--color-line);--d-line-2: var(--color-line);--d-accent: var(--color-accent);--d-accent-2: var(--color-accent-hover);--d-accent-soft: var(--color-accent-soft);--d-accent-bd: var(--color-accent-bd);--d-green: var(--color-success);--d-green-soft: var(--color-success-soft);--d-amber: var(--color-warning);--d-amber-soft: var(--color-warning-soft);--d-red: var(--color-danger);--d-red-soft: var(--color-danger-soft);--d-violet: var(--color-done);--d-code-bg: var(--color-surface-sunken);--d-sidebar: var(--color-surface);--d-shadow-sm: var(--shadow-sm);--d-shadow-md: var(--shadow-md);--d-shadow-lg: var(--shadow-lg);--sidebar-w: var(--p-sidebar-w);--content-max: var(--p-content-wide)}.ds-page[data-v-5fe218d3] *,.ds-page[data-v-5fe218d3] *:before,.ds-page[data-v-5fe218d3] *:after{box-sizing:border-box}.ds-page[data-v-5fe218d3]{scroll-behavior:smooth}.ds-page[data-v-5fe218d3]{margin:0;background:var(--d-bg);color:var(--color-text);font-family:var(--font-ui);font-size:var(--text-base);line-height:1.65;-webkit-font-smoothing:antialiased;text-rendering:optimizeLegibility}h1[data-v-5fe218d3],h2[data-v-5fe218d3],h3[data-v-5fe218d3],h4[data-v-5fe218d3]{color:var(--d-fg);letter-spacing:-.01em;line-height:1.25;margin:0}p[data-v-5fe218d3]{margin:0 0 14px;color:var(--d-fg-soft)}a[data-v-5fe218d3]{color:var(--d-accent-2);text-decoration:none}a[data-v-5fe218d3]:hover{text-decoration:underline}code[data-v-5fe218d3],pre[data-v-5fe218d3],.mono[data-v-5fe218d3]{font-family:JetBrains Mono,ui-monospace,SF Mono,Menlo,Consolas,monospace}code[data-v-5fe218d3]{background:var(--d-code-bg);border:.5px solid var(--d-line-2);border-radius:5px;padding:1px 6px;font-size:.88em;color:#1f2937;white-space:nowrap}.layout[data-v-5fe218d3]{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);min-height:100vh}.sidebar[data-v-5fe218d3]{position:sticky;top:0;align-self:start;height:100vh;background:var(--d-sidebar);border-right:.5px solid var(--d-line);padding:26px 22px;overflow-y:auto}.brand[data-v-5fe218d3]{display:flex;align-items:center;gap:10px;margin-bottom:6px}.brand-mark[data-v-5fe218d3]{width:26px;height:26px;border-radius:7px;flex:none;background:var(--d-fg);color:#fff;display:grid;place-items:center;font-weight:800;font-size:14px;letter-spacing:-.04em}.brand-name[data-v-5fe218d3]{font-weight:700;font-size:15px;letter-spacing:-.01em}.brand-sub[data-v-5fe218d3]{font-size:12px;color:var(--d-fg-faint);margin-bottom:26px;padding-left:36px}.nav-group[data-v-5fe218d3]{margin:22px 0 8px;font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--d-fg-faint)}.p-section-label[data-v-5fe218d3]{font-size:12px;font-weight:600;text-transform:uppercase;color:var(--d-fg-faint)}.nav a[data-v-5fe218d3]{display:flex;align-items:center;gap:9px;padding:7px 10px;border-radius:7px;font-size:13.5px;font-weight:500;color:var(--d-fg-soft);margin:1px 0;transition:background .15s,color .15s}.nav a .num[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:11px;color:var(--d-fg-faint);width:18px}.nav a[data-v-5fe218d3]:hover{background:var(--color-hover);color:var(--d-fg);text-decoration:none}.nav a.active[data-v-5fe218d3]{background:var(--color-hover);color:var(--d-fg)}.nav a.active .num[data-v-5fe218d3]{color:var(--d-fg-soft)}.content[data-v-5fe218d3]{min-width:0}.content-inner[data-v-5fe218d3]{max-width:var(--content-max);margin:0 auto;padding:64px 56px 120px}section[data-v-5fe218d3]{scroll-margin-top:32px;padding-top:8px}section+section[data-v-5fe218d3]{margin-top:72px}.hero[data-v-5fe218d3]{padding:8px 0 40px;border-bottom:.5px solid var(--d-line);margin-bottom:56px}.eyebrow[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:8px;font-family:JetBrains Mono,monospace;font-size:12px;font-weight:600;letter-spacing:.04em;color:var(--d-fg);background:#1783ff1a;border:none;padding:6px 12px;border-radius:8px;margin-bottom:22px}.hero h1[data-v-5fe218d3]{font-size:48px;font-weight:600;line-height:1.08;letter-spacing:-.025em;margin-bottom:18px}.hero h1 .grad[data-v-5fe218d3]{color:var(--d-accent)}.hero p.lead[data-v-5fe218d3]{font-size:18px;line-height:1.6;color:var(--d-fg-soft);max-width:680px}.hero-meta[data-v-5fe218d3]{display:flex;flex-wrap:wrap;gap:10px;margin-top:28px}.meta-chip[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:8px;font-size:12.5px;color:var(--d-fg-muted);background:var(--d-surface);border:.5px solid var(--d-line);border-radius:8px;padding:7px 12px}.meta-chip b[data-v-5fe218d3]{color:var(--d-fg);font-weight:600}.meta-chip .dot[data-v-5fe218d3]{width:7px;height:7px;border-radius:50%;background:var(--d-green)}.sec-head[data-v-5fe218d3]{display:flex;align-items:baseline;gap:14px;margin-bottom:8px}.sec-num[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:13px;font-weight:600;color:var(--d-accent-2)}.sec-title[data-v-5fe218d3]{font-size:26px;letter-spacing:-.02em}.sec-desc[data-v-5fe218d3]{font-size:15.5px;color:var(--d-fg-muted);max-width:720px;margin-bottom:28px}h3.sub[data-v-5fe218d3]{font-size:17px;margin:40px 0 14px;display:flex;align-items:center;gap:10px}h3.sub[data-v-5fe218d3]:before{content:"";width:4px;height:16px;border-radius:2px;background:var(--d-accent)}h4.mini[data-v-5fe218d3]{font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:var(--d-fg-muted);margin:24px 0 12px}.stat-grid[data-v-5fe218d3]{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:24px 0}.stat[data-v-5fe218d3]{background:var(--d-surface);border:.5px solid var(--d-line);border-radius:14px;padding:18px 18px 16px}.stat .v[data-v-5fe218d3]{font-size:34px;font-weight:800;letter-spacing:-.03em;line-height:1;color:var(--d-fg)}.stat .v small[data-v-5fe218d3]{font-size:16px;color:var(--d-fg-muted);font-weight:600}.stat .l[data-v-5fe218d3]{font-size:12.5px;color:var(--d-fg-muted);margin-top:8px;line-height:1.4}.stat.warn[data-v-5fe218d3]{background:var(--d-amber-soft);border-color:#f0d9b8}.stat.warn .v[data-v-5fe218d3]{color:var(--d-amber)}.stat.bad[data-v-5fe218d3]{background:var(--d-red-soft);border-color:#f0cccc}.stat.bad .v[data-v-5fe218d3]{color:var(--d-red)}.stat.good[data-v-5fe218d3]{background:var(--d-green-soft);border-color:#bfe3cc}.stat.good .v[data-v-5fe218d3]{color:var(--d-green)}.panel[data-v-5fe218d3]{background:var(--d-bg);border:.5px solid var(--d-line);border-radius:16px;box-shadow:var(--d-shadow-sm)}.panel-pad[data-v-5fe218d3]{padding:22px}.panel-soft[data-v-5fe218d3]{background:var(--d-surface);border:.5px solid var(--d-line);border-radius:14px}.callout[data-v-5fe218d3]{display:flex;gap:12px;padding:14px 16px;border-radius:12px;font-size:14px;line-height:1.55;background:var(--d-surface);border:.5px solid var(--d-line);color:var(--d-fg-soft);margin:18px 0}.callout .ico[data-v-5fe218d3]{flex:none;width:20px;height:20px;border-radius:6px;display:grid;place-items:center;font-size:12px;font-weight:800}.callout.info[data-v-5fe218d3]{background:var(--d-accent-soft);border-color:var(--d-accent-bd)}.callout.info .ico[data-v-5fe218d3]{background:var(--d-accent);color:#fff}.callout.warn[data-v-5fe218d3]{background:var(--d-amber-soft);border-color:#f0d9b8}.callout.warn .ico[data-v-5fe218d3]{background:var(--d-amber);color:#fff}.callout.good[data-v-5fe218d3]{background:var(--d-green-soft);border-color:#bfe3cc}.callout.good .ico[data-v-5fe218d3]{background:var(--d-green);color:#fff}table.dt[data-v-5fe218d3]{width:100%;border-collapse:collapse;font-size:13.5px;margin:16px 0}table.dt th[data-v-5fe218d3]{text-align:left;font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;color:var(--d-fg-faint);font-weight:700;padding:10px 12px;border-bottom:.5px solid var(--d-line)}table.dt td[data-v-5fe218d3]{padding:11px 12px;border-bottom:.5px solid var(--d-line-2);color:var(--d-fg-soft);vertical-align:middle}table.dt tr:last-child td[data-v-5fe218d3]{border-bottom:none}table.dt td.tk[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:12.5px;color:var(--d-fg);white-space:nowrap}table.dt td.val[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.swatch[data-v-5fe218d3]{display:inline-block;width:16px;height:16px;border-radius:4px;border:.5px solid rgba(0,0,0,.08);vertical-align:-3px;margin-right:8px}.palette[data-v-5fe218d3]{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:16px 0}.color-card[data-v-5fe218d3]{border:.5px solid var(--d-line);border-radius:12px;overflow:hidden;background:var(--d-bg)}.color-chip[data-v-5fe218d3]{height:56px;border-bottom:.5px solid var(--d-line)}.color-meta[data-v-5fe218d3]{padding:10px 12px 12px}.color-meta .cn[data-v-5fe218d3]{font-size:13px;font-weight:600;color:var(--d-fg)}.color-meta .cv[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:11.5px;color:var(--d-fg-muted);margin-top:2px}.type-row[data-v-5fe218d3]{display:flex;align-items:baseline;gap:18px;padding:13px 0;border-bottom:.5px solid var(--d-line-2)}.type-row[data-v-5fe218d3]:last-child{border-bottom:none}.type-sample[data-v-5fe218d3]{flex:1;color:var(--d-fg);line-height:1.2}.type-meta[data-v-5fe218d3]{width:190px;flex:none;text-align:right;font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.space-row[data-v-5fe218d3]{display:flex;align-items:center;gap:16px;padding:10px 0;border-bottom:.5px solid var(--d-line-2)}.space-row[data-v-5fe218d3]:last-child{border-bottom:none}.space-bar[data-v-5fe218d3]{height:18px;border-radius:4px;background:linear-gradient(90deg,var(--d-accent),var(--d-accent-2));flex:none}.space-meta[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:12.5px;color:var(--d-fg-soft);width:150px}.space-use[data-v-5fe218d3]{font-size:12.5px;color:var(--d-fg-muted)}.radius-grid[data-v-5fe218d3]{display:flex;flex-wrap:wrap;gap:22px;align-items:flex-end;margin:16px 0}.radius-item[data-v-5fe218d3]{display:flex;flex-direction:column;align-items:center;gap:10px}.radius-box[data-v-5fe218d3]{width:64px;height:64px;border:.5px solid var(--d-accent);background:var(--d-accent-soft)}.radius-item .rl[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-soft)}.stage-wrap[data-v-5fe218d3]{border:.5px solid var(--d-line);border-radius:16px;overflow:hidden;margin:18px 0;background:var(--d-bg);box-shadow:var(--d-shadow-sm)}.stage-bar[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:.5px solid var(--d-line);background:var(--d-surface)}.stage-bar .st[data-v-5fe218d3]{font-size:13px;font-weight:600;color:var(--d-fg);display:flex;align-items:center;gap:8px}.stage-bar .st .tag[data-v-5fe218d3]{font-size:10.5px;font-weight:700;letter-spacing:.04em;padding:2px 7px;border-radius:999px}.tag.after[data-v-5fe218d3]{background:var(--d-green-soft);color:var(--d-green)}.tag.before[data-v-5fe218d3]{background:var(--d-red-soft);color:var(--d-red)}.tag.spec[data-v-5fe218d3]{background:var(--d-accent-soft);color:var(--d-accent-2)}.stage-bar .sactions[data-v-5fe218d3]{display:flex;gap:6px}.tab[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:11.5px;padding:4px 10px;border-radius:6px;color:var(--d-fg-muted);cursor:default}.tab.on[data-v-5fe218d3]{background:var(--d-bg);color:var(--d-fg);border:.5px solid var(--d-line)}.stage[data-v-5fe218d3]{padding:32px;display:flex;flex-wrap:wrap;align-items:center;gap:16px;background:radial-gradient(circle at 1px 1px,rgba(0,0,0,.045) 1px,transparent 0) 0 0 / 18px 18px,var(--d-surface)}.stage.col[data-v-5fe218d3]{flex-direction:column;align-items:stretch}.stage.dark[data-v-5fe218d3]{background:radial-gradient(circle at 1px 1px,rgba(255,255,255,.06) 1px,transparent 0) 0 0 / 18px 18px,#0d1117}.stage-label[data-v-5fe218d3]{width:100%;font-size:11.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--d-fg-faint);margin-bottom:-6px}.stage.dark .stage-label[data-v-5fe218d3]{color:#6b7280}.ba[data-v-5fe218d3]{display:grid;grid-template-columns:1fr 1fr;gap:0;border:.5px solid var(--d-line);border-radius:16px;overflow:hidden;margin:18px 0;box-shadow:var(--d-shadow-sm)}.ba-col[data-v-5fe218d3]{min-width:0}.ba-col+.ba-col[data-v-5fe218d3]{border-left:.5px solid var(--d-line)}.ba-head[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;padding:11px 16px;border-bottom:.5px solid var(--d-line)}.ba-head.before[data-v-5fe218d3]{background:var(--d-red-soft)}.ba-head.after[data-v-5fe218d3]{background:var(--d-green-soft)}.ba-head .bh[data-v-5fe218d3]{font-size:13px;font-weight:700}.ba-head.before .bh[data-v-5fe218d3]{color:var(--d-red)}.ba-head.after .bh[data-v-5fe218d3]{color:var(--d-green)}.ba-head .bh small[data-v-5fe218d3]{font-weight:500;opacity:.7;margin-left:6px}.ba-body[data-v-5fe218d3]{padding:24px;background:var(--d-surface);min-height:120px}.ba-col.after .ba-body[data-v-5fe218d3]{background:#fff}.code[data-v-5fe218d3]{background:#0d1117;border-radius:12px;overflow:hidden;margin:16px 0;border:.5px solid #1c2128}.code-bar[data-v-5fe218d3]{display:flex;align-items:center;gap:8px;padding:9px 14px;background:#13181e;border-bottom:.5px solid #1c2128}.code-bar .d[data-v-5fe218d3]{width:10px;height:10px;border-radius:50%;background:#30363d}.code-bar .fn[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:11.5px;color:#8b949e;margin-left:4px}.code pre[data-v-5fe218d3]{margin:0;padding:18px;overflow-x:auto;font-size:12.5px;line-height:1.7;color:#c9d1d9}.code .c[data-v-5fe218d3]{color:#8b949e}.code .k[data-v-5fe218d3]{color:#ff7b72}.code .s[data-v-5fe218d3]{color:#a5d6ff}.code .p[data-v-5fe218d3]{color:#79c0ff}.code .n[data-v-5fe218d3]{color:#d2a8ff}.code .v[data-v-5fe218d3]{color:#ffa657}.pill[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:6px;font-size:12px;font-weight:600;padding:3px 9px;border-radius:999px;border:.5px solid var(--d-line);background:var(--d-surface);color:var(--d-fg-soft)}.pill.blue[data-v-5fe218d3]{background:var(--d-accent-soft);border-color:var(--d-accent-bd);color:var(--d-accent-2)}.pill.green[data-v-5fe218d3]{background:var(--d-green-soft);border-color:#bfe3cc;color:var(--d-green)}.pill.amber[data-v-5fe218d3]{background:var(--d-amber-soft);border-color:#f0d9b8;color:var(--d-amber)}.pill.red[data-v-5fe218d3]{background:var(--d-red-soft);border-color:#f0cccc;color:var(--d-red)}.pill.mono[data-v-5fe218d3]{font-family:JetBrains Mono,monospace}ul.clean[data-v-5fe218d3]{list-style:none;padding:0;margin:14px 0}ul.clean li[data-v-5fe218d3]{position:relative;padding:8px 0 8px 26px;color:var(--d-fg-soft);border-bottom:.5px solid var(--d-line-2)}ul.clean li[data-v-5fe218d3]:last-child{border-bottom:none}ul.clean li[data-v-5fe218d3]:before{content:"";position:absolute;left:4px;top:17px;width:7px;height:7px;border-radius:50%;background:var(--d-accent)}ul.clean.check li[data-v-5fe218d3]:before{content:"✓";background:none;color:var(--d-green);font-weight:800;top:7px;left:0;font-size:14px}ul.clean.cross li[data-v-5fe218d3]:before{content:"✕";background:none;color:var(--d-red);font-weight:800;top:7px;left:0;font-size:13px}ul.clean li b[data-v-5fe218d3]{color:var(--d-fg)}ul.clean li .path[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:12px;color:var(--d-fg-muted)}.roadmap[data-v-5fe218d3]{position:relative;margin:24px 0}.phase[data-v-5fe218d3]{position:relative;display:grid;grid-template-columns:120px 1fr;gap:24px;padding:0 0 32px}.phase[data-v-5fe218d3]:not(:last-child):after{content:"";position:absolute;left:59px;top:36px;bottom:0;width:2px;background:var(--d-line)}.phase-tag[data-v-5fe218d3]{text-align:right;padding-top:4px}.phase-tag .pt[data-v-5fe218d3]{display:inline-block;font-family:JetBrains Mono,monospace;font-size:12px;font-weight:700;color:var(--d-accent-2);background:var(--d-accent-soft);border:.5px solid var(--d-accent-bd);padding:5px 10px;border-radius:8px}.phase-tag .pe[data-v-5fe218d3]{font-size:11.5px;color:var(--d-fg-faint);margin-top:8px}.phase-body[data-v-5fe218d3]{background:var(--d-bg);border:.5px solid var(--d-line);border-radius:14px;padding:18px 20px;box-shadow:var(--d-shadow-sm)}.phase-body h4[data-v-5fe218d3]{font-size:16px;margin-bottom:8px}.phase-body p[data-v-5fe218d3]{font-size:14px;margin-bottom:12px}.phase-body ul[data-v-5fe218d3]{margin:0}.matrix[data-v-5fe218d3]{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:16px 0}.anti[data-v-5fe218d3]{border:.5px solid var(--d-line);border-radius:12px;padding:16px;background:var(--d-bg)}.anti .ah[data-v-5fe218d3]{display:flex;align-items:center;gap:9px;font-size:14px;font-weight:700;margin-bottom:8px}.anti .ah .verdict[data-v-5fe218d3]{margin-left:auto;font-size:11px;font-weight:800;padding:2px 8px;border-radius:999px}.verdict.pass[data-v-5fe218d3]{background:var(--d-green-soft);color:var(--d-green)}.verdict.fail[data-v-5fe218d3]{background:var(--d-red-soft);color:var(--d-red)}.verdict.warn[data-v-5fe218d3]{background:var(--d-amber-soft);color:var(--d-amber)}.anti p[data-v-5fe218d3]{font-size:13px;margin:0;color:var(--d-fg-muted)}.footer[data-v-5fe218d3]{margin-top:80px;padding-top:28px;border-top:.5px solid var(--d-line);font-size:13px;color:var(--d-fg-faint);display:flex;justify-content:space-between;flex-wrap:wrap;gap:12px}.kbd[data-v-5fe218d3]{font-family:JetBrains Mono,monospace;font-size:11px;background:var(--d-surface-2);border:.5px solid var(--d-line);border-radius:5px;padding:1px 6px}@media(max-width:980px){.layout[data-v-5fe218d3]{grid-template-columns:1fr}.sidebar[data-v-5fe218d3]{position:static;height:auto}.nav[data-v-5fe218d3]{display:flex;flex-wrap:wrap;gap:4px}.content-inner[data-v-5fe218d3]{padding:40px 22px 80px}.stat-grid[data-v-5fe218d3]{grid-template-columns:repeat(2,1fr)}.ba[data-v-5fe218d3]{grid-template-columns:1fr}.ba-col+.ba-col[data-v-5fe218d3]{border-left:none;border-top:.5px solid var(--d-line)}.palette[data-v-5fe218d3]{grid-template-columns:repeat(2,1fr)}.matrix[data-v-5fe218d3]{grid-template-columns:1fr}}.ds-page .p[data-v-5fe218d3],.ds-page .stage.p-skin[data-v-5fe218d3],.ds-page [data-p][data-v-5fe218d3]{--p-font-sans: var(--font-ui);--p-font-kbd: var(--font-kbd);--p-font-mono: var(--font-mono);--p-bg: var(--color-bg);--p-surface: var(--color-surface);--p-surface-raised: var(--color-surface-raised);--p-surface-overlay: var(--color-surface-overlay);--p-surface-sunken: var(--color-surface-sunken);--p-well: var(--color-well);--p-surface-deep: var(--color-surface-deep);--p-hover: var(--color-hover);--p-text: var(--color-text);--p-text-strong: var(--color-text-strong);--p-muted: var(--muted);--p-text-muted: var(--color-text-muted);--p-text-faint: var(--color-text-faint);--p-text-on-accent: var(--color-text-on-accent);--p-line: var(--color-line);--p-line-strong: var(--color-line-strong);--p-accent: var(--color-accent);--p-accent-hover: var(--color-accent-hover);--p-accent-soft: var(--color-accent-soft);--p-user-bubble-bg: var(--color-user-bubble-bg);--p-accent-bd: var(--color-accent-bd);--p-success: var(--color-success);--p-success-soft: var(--color-success-soft);--p-success-bd: var(--color-success-bd);--p-warning: var(--color-warning);--p-warning-soft: var(--color-warning-soft);--p-warning-bd: var(--color-warning-bd);--p-danger: var(--color-danger);--p-danger-soft: var(--color-danger-soft);--p-danger-bd: var(--color-danger-bd);--p-info: var(--color-info);--p-sp-1: var(--space-1);--p-sp-2: var(--space-2);--p-sp-3: var(--space-3);--p-sp-4: var(--space-4);--p-sp-5: var(--space-5);--p-sp-6: var(--space-6);--p-sp-8: var(--space-8);--p-r-xs: var(--radius-xs);--p-r-sm: var(--radius-sm);--p-r-md: var(--radius-md);--p-r-lg: var(--radius-lg);--p-r-xl: var(--radius-xl);--p-r-composer: var(--radius-composer);--p-r-full: var(--radius-full);--p-corner-composer: var(--corner-shape-composer);--p-sh-xs: var(--shadow-xs);--p-sh-sm: var(--shadow-sm);--p-sh-menu: var(--shadow-menu);--p-sh-md: var(--shadow-md);--p-sh-input: var(--shadow-input);--p-sh-lg: var(--shadow-lg);--p-sh-xl: var(--shadow-xl);--p-font-size-xs: var(--text-xs);--p-font-size-sm: var(--text-sm);--p-font-size-base: var(--text-base);--p-font-size-md: var(--text-base);--p-font-size-lg: var(--text-lg);--p-font-size-xl: var(--text-xl);--p-font-size-2xl: var(--text-2xl);--p-leading-tight: var(--leading-tight);--p-leading-normal: var(--leading-normal);--p-leading-relaxed: var(--leading-relaxed);--p-ease: var(--ease-out);--p-ease-inout: var(--ease-in-out);--p-dur-fast: var(--duration-fast);--p-dur: var(--duration-base);--p-dur-slow: var(--duration-slow);--p-composer-focus-line: var(--color-composer-focus-line);font-family:var(--font-ui);color:var(--color-text);font-size:var(--text-base)}[data-p=dark][data-v-5fe218d3]{--p-bg: #0d1117;--p-surface: #13181e;--p-surface-raised: #1c2128;--p-surface-sunken: #0d1117;--p-well: #13181e;--p-surface-deep: #0a0d12;--p-surface-overlay: #22272e;--p-hover: #ffffff0d;--p-text: #e8eaed;--p-text-strong: #ffffff;--p-muted: #727983;--p-text-muted: #9aa0a8;--p-text-faint: #6b7280;--p-line: #2d333b;--p-line-strong: #3d444d;--p-accent: #58a6ff;--p-accent-hover: #79b8ff;--p-accent-soft: rgba(88,166,255,.14);--p-accent-bd: rgba(88,166,255,.28);--p-success: #3fb950;--p-success-soft: rgba(63,185,80,.14);--p-success-bd: rgba(63,185,80,.28);--p-warning: #d29922;--p-warning-soft: rgba(210,153,34,.14);--p-warning-bd: rgba(210,153,34,.28);--p-danger: #f85149;--p-danger-soft: rgba(248,81,73,.14);--p-danger-bd: rgba(248,81,73,.28);--p-sh-sm: 0 1px 2px rgba(0,0,0,.4);--p-sh-md: 0 4px 12px rgba(0,0,0,.45);--p-sh-lg: 0 12px 32px rgba(0,0,0,.55);--p-sh-input: var(--shadow-input);--p-selection: rgba(88,166,255,.32)}.p-ic[data-v-5fe218d3]{width:16px;height:16px;flex:none;display:inline-block;vertical-align:middle}.p-btn[data-v-5fe218d3]{--_h: 36px;--_px: 16px;--_fs: var(--p-font-size-base);--_r: var(--p-r-md);display:inline-flex;align-items:center;justify-content:center;gap:8px;height:var(--_h);padding:0 var(--_px);border-radius:var(--_r);font-family:var(--p-font-sans);font-size:var(--_fs);font-weight:600;line-height:1;border:.5px solid transparent;cursor:pointer;white-space:nowrap;transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease),transform var(--p-dur-fast) var(--p-ease)}.p-btn[data-v-5fe218d3]:active{transform:scale(.98)}.p-btn[data-v-5fe218d3]:focus-visible{outline:none;box-shadow:0 0 0 3px var(--p-accent-soft),0 0 0 1px var(--p-accent)}.p-btn .p-ic[data-v-5fe218d3]{width:16px;height:16px}.p-btn.sm[data-v-5fe218d3]{--_h: 30px;--_px: 12px;--_fs: var(--p-font-size-sm);--_r: var(--p-r-sm)}.p-btn.sm .p-ic[data-v-5fe218d3]{width:14px;height:14px}.p-btn.lg[data-v-5fe218d3]{--_h: 42px;--_px: 20px;--_fs: var(--p-font-size-md);--_r: var(--p-r-lg)}.p-btn.primary[data-v-5fe218d3]{background:var(--p-accent);color:var(--p-text-on-accent);border-color:var(--p-accent);box-shadow:var(--p-sh-xs)}.p-btn.primary[data-v-5fe218d3]:hover{background:var(--p-accent-hover);border-color:var(--p-accent-hover)}.p-btn.secondary[data-v-5fe218d3]{background:var(--p-surface-raised);color:var(--p-text);border-color:var(--p-line-strong);box-shadow:var(--p-sh-xs)}.p-btn.secondary[data-v-5fe218d3]:hover{background:var(--p-hover);border-color:var(--p-line-strong)}.p-btn.ghost[data-v-5fe218d3]{background:transparent;color:var(--p-text);border-color:transparent}.p-btn.ghost[data-v-5fe218d3]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-btn.danger[data-v-5fe218d3]{background:var(--p-danger);color:#fff;border-color:var(--p-danger);box-shadow:var(--p-sh-xs)}.p-btn.danger[data-v-5fe218d3]:hover{filter:brightness(.96)}.p-btn.danger-soft[data-v-5fe218d3]{background:var(--p-danger-soft);color:var(--p-danger);border-color:var(--p-danger-bd)}.p-btn.danger-soft[data-v-5fe218d3]:hover{background:var(--p-danger);color:#fff;border-color:var(--p-danger)}.p-btn[disabled][data-v-5fe218d3],.p-btn.disabled[data-v-5fe218d3]{opacity:.5;cursor:not-allowed;box-shadow:none;transform:none}.p-icon-btn[data-v-5fe218d3]{--_s: 32px;display:inline-grid;place-items:center;width:var(--_s);height:var(--_s);flex:none;border-radius:var(--p-r-md);border:.5px solid transparent;background:transparent;color:var(--p-text-muted);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-icon-btn[data-v-5fe218d3]:hover{background:var(--p-hover);color:var(--p-text)}.p-icon-btn[data-v-5fe218d3]:focus-visible{outline:none;box-shadow:0 0 0 3px var(--p-accent-soft)}.p-icon-btn.sm[data-v-5fe218d3]{--_s: 26px;border-radius:var(--p-r-sm)}.p-icon-btn.lg[data-v-5fe218d3]{--_s: 44px}.p-icon-btn .p-ic[data-v-5fe218d3]{width:16px;height:16px}.p-icon-btn.lg .p-ic[data-v-5fe218d3]{width:20px;height:20px}.p-badge[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 9px;border-radius:var(--p-r-full);font-family:var(--p-font-sans);font-size:var(--p-font-size-xs);font-weight:600;line-height:1;border:.5px solid var(--p-line);background:var(--p-surface);color:var(--p-text);white-space:nowrap}.p-badge.sm[data-v-5fe218d3]{height:18px;padding:0 7px;font-size:11px}.p-badge .bd[data-v-5fe218d3]{width:7px;height:7px;border-radius:50%;background:currentColor}.p-badge.neutral[data-v-5fe218d3]{background:var(--p-surface-sunken);border-color:var(--p-line);color:var(--p-text-muted)}.p-badge.info[data-v-5fe218d3]{background:var(--p-accent-soft);border-color:var(--p-accent-bd);color:var(--p-accent-hover)}.p-badge.success[data-v-5fe218d3]{background:var(--p-success-soft);border-color:var(--p-success-bd);color:var(--p-success)}.p-badge.warning[data-v-5fe218d3]{background:var(--p-warning-soft);border-color:var(--p-warning-bd);color:var(--p-warning)}.p-badge.danger[data-v-5fe218d3]{background:var(--p-danger-soft);border-color:var(--p-danger-bd);color:var(--p-danger)}.p-badge.solid[data-v-5fe218d3]{background:var(--p-text);color:var(--p-bg);border-color:var(--p-text)}.p-badge .p-ic[data-v-5fe218d3]{width:12px;height:12px}.p-kbd[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:3px}.p-kbd kbd[data-v-5fe218d3]{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;border:.5px solid var(--p-line);border-radius:var(--p-r-xs);background:transparent;color:inherit;font-family:var(--p-font-kbd);font-size:11px;line-height:1}.p-pill[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 12px;border-radius:var(--p-r-full);border:.5px solid transparent;background:transparent;font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-pill[data-v-5fe218d3]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-pill .pp-strong[data-v-5fe218d3]{font-weight:700;color:var(--p-text)}.p-pill .pp-sub[data-v-5fe218d3]{color:var(--p-accent);font-weight:600}.p-pill .p-ic[data-v-5fe218d3]{width:14px;height:14px;color:var(--p-text-faint)}.p-card[data-v-5fe218d3]{background:var(--p-surface);border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;color:var(--p-text)}.p-card.interactive[data-v-5fe218d3]{transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease);cursor:pointer}.p-card.interactive[data-v-5fe218d3]:hover{background:var(--p-surface);border-color:var(--p-line-strong)}.p-card-head[data-v-5fe218d3]{display:flex;align-items:center;gap:9px;padding:10px 14px;border-bottom:.5px solid var(--p-line);background:var(--p-surface)}.p-card-title[data-v-5fe218d3]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text);font-family:var(--p-font-mono)}.p-card-body[data-v-5fe218d3]{padding:14px;font-size:var(--p-font-size-base);color:var(--p-text);line-height:var(--p-leading-normal)}.p-card-foot[data-v-5fe218d3]{display:flex;align-items:center;justify-content:flex-end;gap:8px;padding:10px 14px;border-top:.5px solid var(--p-line);background:var(--p-surface)}.p-field[data-v-5fe218d3]{display:flex;flex-direction:column;gap:6px}.p-label[data-v-5fe218d3]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text)}.p-input[data-v-5fe218d3],.p-select[data-v-5fe218d3],.p-textarea[data-v-5fe218d3]{width:100%;height:38px;padding:0 12px;border-radius:var(--p-r-md);border:.5px solid var(--p-line-strong);background:var(--p-surface-raised);font-family:var(--p-font-sans);font-size:var(--p-font-size-base);color:var(--p-text);box-shadow:var(--p-sh-xs);transition:border-color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease)}.p-textarea[data-v-5fe218d3]{height:auto;min-height:84px;padding:10px 12px;resize:vertical;line-height:var(--p-leading-normal)}.p-select[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;text-align:left}.p-select[data-v-5fe218d3]:after{content:"⌄";color:var(--p-text-muted)}.p-input[data-v-5fe218d3]:hover,.p-select[data-v-5fe218d3]:hover,.p-textarea[data-v-5fe218d3]:hover{border-color:var(--p-line-strong)}.p-input[data-v-5fe218d3]:focus,.p-select[data-v-5fe218d3]:focus,.p-textarea[data-v-5fe218d3]:focus{outline:none;border-color:var(--p-accent);box-shadow:0 0 0 3px var(--p-accent-soft)}.p-input[data-v-5fe218d3]::placeholder,.p-textarea[data-v-5fe218d3]::placeholder{color:var(--p-text-faint)}.p-input.sm[data-v-5fe218d3]{height:32px;font-size:var(--p-font-size-sm);border-radius:var(--p-r-sm)}.p-hint[data-v-5fe218d3]{font-size:var(--p-font-size-xs);color:var(--p-text-faint)}.p-dialog[data-v-5fe218d3]{width:480px;max-width:calc(100vw - 48px);background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-xl);box-shadow:var(--p-sh-xl);overflow:hidden;color:var(--p-text)}.p-dialog-head[data-v-5fe218d3]{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:20px 22px 14px}.p-dialog-title[data-v-5fe218d3]{font-size:var(--p-font-size-lg);font-weight:700;letter-spacing:-.01em}.p-dialog-desc[data-v-5fe218d3]{font-size:var(--p-font-size-base);color:var(--p-text-muted);margin-top:4px;line-height:var(--p-leading-normal)}.p-dialog-body[data-v-5fe218d3]{padding:4px 22px 18px}.p-dialog-foot[data-v-5fe218d3]{display:flex;justify-content:flex-end;gap:10px;padding:14px 22px 20px}.p-toast[data-v-5fe218d3]{display:flex;align-items:flex-start;gap:11px;width:360px;padding:13px 14px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-md)}.p-toast .ti[data-v-5fe218d3]{width:20px;height:20px;border-radius:50%;display:grid;place-items:center;flex:none;margin-top:1px}.p-toast.success .ti[data-v-5fe218d3]{background:var(--p-success-soft);color:var(--p-success)}.p-toast.warning .ti[data-v-5fe218d3]{background:var(--p-warning-soft);color:var(--p-warning)}.p-toast .tt[data-v-5fe218d3]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-toast .td[data-v-5fe218d3]{font-size:var(--p-font-size-sm);color:var(--p-text-muted);margin-top:2px;line-height:1.45}.p-action-toast[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:8px;align-self:center;padding:4px 6px 4px 14px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-sm);font-size:var(--p-font-size-base);color:var(--p-text);white-space:nowrap}.p-action-toast .lk[data-v-5fe218d3]{border:0;padding:0;background:none;color:var(--p-accent);cursor:pointer;font:inherit}.p-action-toast .x[data-v-5fe218d3]{color:var(--p-text-muted);width:14px;height:14px}.p-spinner[data-v-5fe218d3]{width:18px;height:18px;animation:p-spin-5fe218d3 .85s linear infinite}.p-spinner.sm[data-v-5fe218d3]{width:14px;height:14px}.p-spinner circle[data-v-5fe218d3]{fill:none;stroke-width:2.2;stroke-linecap:round}.p-spinner .track[data-v-5fe218d3]{stroke:var(--p-line)}.p-spinner .arc[data-v-5fe218d3]{stroke:var(--p-accent);stroke-dasharray:56 56;stroke-dashoffset:38}@keyframes p-spin-5fe218d3{to{transform:rotate(360deg)}}.p-thinking[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:9px;font-size:var(--p-font-size-sm);color:var(--p-text-muted);font-family:var(--p-font-sans)}.p-bubble-user[data-v-5fe218d3]{align-self:flex-end;max-width:78%;background:var(--p-user-bubble-bg);border:none;color:var(--p-text);border-radius:var(--p-r-lg);padding:10px 12px;font-size:var(--p-font-size-md);line-height:var(--p-leading-normal)}.p-msg[data-v-5fe218d3]{max-width:760px;font-size:var(--p-font-size-md);line-height:var(--p-leading-relaxed);color:var(--p-text)}.p-msg p[data-v-5fe218d3]{margin:0 0 10px;color:var(--p-text)}.p-msg code[data-v-5fe218d3]{font-family:var(--p-font-mono);background:var(--p-surface-sunken);border:0;color:var(--p-accent-hover);padding:1px 6px;border-radius:5px;font-size:.9em}.p-code[data-v-5fe218d3]{font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);line-height:1.65;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);padding:11px 13px;color:var(--p-text);overflow-x:auto}.p-action[data-v-5fe218d3]{border-radius:var(--p-r-lg);overflow:hidden;border:.5px solid var(--p-line);background:var(--p-surface-raised);box-shadow:var(--p-sh-menu)}.p-action-head[data-v-5fe218d3]{display:flex;align-items:center;gap:9px;padding:14px 16px 0}.p-action-title[data-v-5fe218d3]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-action-body[data-v-5fe218d3]{padding:12px 16px 0;font-size:var(--p-font-size-base);color:var(--p-text);line-height:var(--p-leading-normal)}.p-action-foot[data-v-5fe218d3]{display:flex;gap:8px;margin-top:12px;padding:10px 16px;border-top:.5px solid var(--p-line)}.p-opts[data-v-5fe218d3]{display:flex;flex-direction:column;gap:2px;margin-top:12px;padding:12px 16px;border-top:.5px solid var(--p-line)}.p-opt[data-v-5fe218d3]{display:flex;align-items:flex-start;gap:10px;padding:8px 12px;border-radius:var(--p-r-md);color:var(--p-text);font-size:var(--p-font-size-base)}.p-opt .n[data-v-5fe218d3]{width:var(--p-chip-num);height:var(--p-chip-num);margin-top:calc((var(--p-font-size-base) * var(--p-leading-normal) - var(--p-chip-num)) / 2);border-radius:var(--p-r-sm);background:var(--p-surface-sunken);color:var(--p-text);font-size:var(--p-font-size-xs);font-weight:500;display:inline-flex;align-items:center;justify-content:center;flex:none}.p-opt-text[data-v-5fe218d3]{display:flex;flex-direction:column;gap:2px;min-width:0}.p-opt-text .l[data-v-5fe218d3]{font-weight:500}.p-opt-text .d[data-v-5fe218d3]{font-size:var(--p-font-size-xs);color:var(--p-text-muted);line-height:var(--p-leading-normal)}.p-todo[data-v-5fe218d3]{background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-md);padding:6px}.p-todo-row[data-v-5fe218d3]{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:var(--p-r-md);font-size:var(--p-font-size-base);color:var(--p-text)}.p-todo-row.done[data-v-5fe218d3]{color:var(--p-text-faint);text-decoration:line-through}.p-todo-row.active[data-v-5fe218d3]{background:var(--p-accent-soft);color:var(--p-text)}.p-todo-check[data-v-5fe218d3]{width:16px;flex:none;display:inline-flex;align-items:center;justify-content:center;user-select:none;color:var(--p-text-faint)}.p-todo-check svg[data-v-5fe218d3]{width:14px;height:14px}.p-todo-row.active .p-todo-check[data-v-5fe218d3]{color:var(--p-accent)}.p-todo-row.done .p-todo-check[data-v-5fe218d3]{color:var(--p-success)}.p-todo-row.active .p-todo-check[data-v-5fe218d3]{color:var(--p-accent);font-weight:500}.p-dot[data-v-5fe218d3]{width:7px;height:7px;border-radius:50%;flex:none;background:var(--p-text-faint)}.p-dot.done[data-v-5fe218d3]{background:var(--p-success)}.p-dot.error[data-v-5fe218d3]{background:var(--p-danger)}.p-dot.running[data-v-5fe218d3]{background:var(--p-accent);box-shadow:0 0 0 0 var(--p-accent-soft);animation:p-pulse-5fe218d3 1.4s ease-out infinite}@keyframes p-pulse-5fe218d3{0%{box-shadow:0 0 #1783ff66}to{box-shadow:0 0 0 6px #1783ff00}}.p-tool-group[data-v-5fe218d3]{overflow:hidden}.p-tool-group-head[data-v-5fe218d3]{display:flex;align-items:center;gap:4px;padding:4px 0;cursor:pointer;border-radius:6px;font-size:var(--p-font-size-sm);line-height:1;color:var(--p-text-faint);user-select:none;transition:color var(--p-dur) var(--p-ease)}.p-tool-group-head .tg-ic[data-v-5fe218d3]{width:14px;height:14px;color:var(--p-text-faint);flex:none}.p-tool-group-head[data-v-5fe218d3]:hover{color:var(--p-text)}.p-tool-group-head .tg-title[data-v-5fe218d3]{font-weight:500}.p-tool-group-head .tg-meta[data-v-5fe218d3]{color:var(--p-text-faint);font-weight:400}.p-tool-group-head .tg-car[data-v-5fe218d3]{width:14px;height:14px;color:var(--p-text-faint);transition:transform var(--p-dur) var(--p-ease)}.p-tool-group.open .p-tool-group-head .tg-car[data-v-5fe218d3]{transform:rotate(90deg)}.p-tool-row[data-v-5fe218d3]{position:relative;display:flex;align-items:center;gap:4px;padding:4px 0;border-radius:6px;cursor:pointer;font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);line-height:1;color:var(--p-text)}.p-tool-row .tr-ic[data-v-5fe218d3]{width:14px;height:14px;color:var(--p-text-faint);flex:none}.p-tool-row .tr-name[data-v-5fe218d3]{font-weight:400;color:var(--p-text-muted);flex:none}.p-tool-row .tr-file[data-v-5fe218d3]{font-weight:400;color:var(--p-text);flex:none}.p-tool-row .tr-file[data-v-5fe218d3]:hover{color:var(--p-accent);text-decoration:underline;text-underline-offset:3px}.p-tool-row .tr-mono[data-v-5fe218d3]{font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);line-height:normal;font-feature-settings:"liga" 0,"calt" 0;font-variant-ligatures:none;color:var(--p-text-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.p-tool-row .tr-faint[data-v-5fe218d3]{color:var(--p-text-faint);line-height:var(--leading-tight);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.p-tool-row .tr-chip[data-v-5fe218d3]{margin-left:auto;color:var(--p-text-faint);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-add[data-v-5fe218d3]{margin-left:auto;color:var(--p-success);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-add~.tr-chip[data-v-5fe218d3],.p-tool-row .tr-add~.tr-add[data-v-5fe218d3]{margin-left:0}.p-tool-row .tr-del[data-v-5fe218d3]{color:var(--p-danger);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-bar[data-v-5fe218d3]{display:inline-flex;width:36px;height:3px;border-radius:999px;overflow:hidden;gap:1px;flex:none}.p-tool-row .tr-ok[data-v-5fe218d3]{color:var(--p-success);font-size:var(--p-font-size-xs);flex:none}.p-tool-row .tr-car[data-v-5fe218d3]{width:13px;height:13px;color:var(--p-text-faint);flex:none;transition:transform var(--p-dur) var(--p-ease)}.p-agent-card[data-v-5fe218d3]{display:flex;align-items:center;gap:8px;align-self:stretch;padding:8px 12px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg);cursor:pointer}.p-agent-card .pa-ic[data-v-5fe218d3]{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:8px;background:var(--p-surface-sunken);color:var(--p-text-muted);flex:none}.p-agent-card .pa-ic svg[data-v-5fe218d3]{width:14px;height:14px}.p-agent-card .pa-main[data-v-5fe218d3]{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}.p-agent-card .pa-task[data-v-5fe218d3]{font-size:var(--p-font-size-sm);line-height:1.4;color:var(--p-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-agent-card .pa-type[data-v-5fe218d3]{font-size:var(--p-font-size-xs);line-height:1.4;color:var(--p-text-faint);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-agent-card .pa-ok[data-v-5fe218d3]{color:var(--p-success);font-size:var(--p-font-size-xs);flex:none}.p-agent-card .pa-go[data-v-5fe218d3]{color:var(--p-text-faint);flex:none}.p-tool-row.expanded .tr-car[data-v-5fe218d3]{transform:rotate(90deg)}.p-tool-detail[data-v-5fe218d3]{padding:2px 8px 4px 0}.p-tool-detail .p-code[data-v-5fe218d3]{margin-top:4px}.p-composer[data-v-5fe218d3]{background:var(--p-surface-raised);border:.5px solid var(--p-line-strong);border-radius:var(--p-r-composer);corner-shape:var(--p-corner-composer);box-shadow:var(--p-sh-input);overflow:hidden;position:relative;z-index:1}.p-composer[data-v-5fe218d3]:after{content:"";position:absolute;inset:0;border:inherit;border-color:var(--p-composer-focus-line);border-radius:var(--p-r-composer);corner-shape:var(--p-corner-composer);opacity:0;pointer-events:none;transition:opacity var(--p-dur-slow) var(--p-ease-inout)}.p-composer[data-v-5fe218d3]:focus-within:after{opacity:1}.p-composer-ta[data-v-5fe218d3]{padding:14px 16px 8px;font-family:var(--p-font-sans);font-size:var(--p-font-size-md);color:var(--p-text);line-height:var(--p-leading-normal);text-autospace:normal}.p-composer-ta.ph[data-v-5fe218d3]{color:var(--p-text-faint)}.p-composer-bar[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 8px 8px}.p-composer-strip[data-v-5fe218d3]{width:100%;max-width:620px;margin-top:calc(-1 * var(--space-4));display:flex;align-items:center;gap:var(--space-2);padding:calc(var(--space-4) + var(--space-2)) var(--space-2) var(--space-2);background:color-mix(in srgb,var(--color-hover) 60%,transparent);border-radius:0 0 var(--radius-2xl) var(--radius-2xl);font-family:var(--p-font-sans);font-size:var(--p-font-size-sm);color:var(--p-text-faint);cursor:pointer}.p-composer-strip .p-ic[data-v-5fe218d3]{width:16px;height:16px;color:var(--p-text-faint)}.p-composer-left[data-v-5fe218d3],.p-composer-right[data-v-5fe218d3]{display:flex;align-items:center;gap:4px}.p-composer .p-icon-btn[data-v-5fe218d3]{border-radius:var(--p-r-full)}.p-send[data-v-5fe218d3]{position:relative;width:32px;height:32px;border-radius:var(--p-r-full);display:grid;place-items:center;background:var(--p-text);color:var(--p-bg);border:none;cursor:pointer;box-shadow:var(--p-sh-xs);transition:transform var(--p-dur-fast) var(--p-ease)}.p-send[data-v-5fe218d3]:after{content:"";position:absolute;inset:0;border-radius:var(--p-r-full);background:var(--p-bg);opacity:0;transition:opacity var(--p-dur-slow) var(--p-ease);pointer-events:none}.p-send[data-v-5fe218d3]:hover:after{opacity:.28}.p-send[data-v-5fe218d3]:active{transform:scale(.92)}.p-send .p-ic[data-v-5fe218d3]{width:16px;height:16px}.p[data-v-5fe218d3] ::selection,[data-p][data-v-5fe218d3] ::selection{background:var(--p-selection)}.p-link[data-v-5fe218d3]{color:var(--p-accent);text-decoration:none;font-family:var(--p-font-sans);transition:color var(--p-dur) var(--p-ease)}.p-link[data-v-5fe218d3]:hover{color:var(--p-accent-hover);text-decoration:underline}.p-link[data-v-5fe218d3]:focus-visible{outline:none;box-shadow:var(--p-focus-ring);border-radius:var(--p-r-xs)}.p-link.muted[data-v-5fe218d3]{color:var(--p-text-muted)}.p-link.muted[data-v-5fe218d3]:hover{color:var(--p-text)}.p-link .p-ic[data-v-5fe218d3]{width:var(--p-ic-sm);height:var(--p-ic-sm);vertical-align:-2px}.p-menu[data-v-5fe218d3]{background:var(--color-menu-bg);border:.5px solid var(--p-line);-webkit-backdrop-filter:var(--p-menu-backdrop);backdrop-filter:var(--p-menu-backdrop);border-radius:var(--p-r-lg);box-shadow:var(--p-sh-sm);padding:3.5px;min-width:180px;font-family:var(--p-font-sans);color:var(--p-text)}.p-menu-item[data-v-5fe218d3]{display:flex;align-items:center;gap:7px;padding:5px 9px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-sm);color:var(--p-text);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-menu-item[data-v-5fe218d3]:hover{background:var(--p-hover);color:var(--p-text-strong)}.p-menu-item.active[data-v-5fe218d3],.p-menu-item.active[data-v-5fe218d3]:hover{background:var(--p-hover);color:var(--p-text)}.p-menu-item.danger[data-v-5fe218d3]{color:var(--p-danger)}.p-menu-item.danger[data-v-5fe218d3]:hover{background:var(--p-danger-soft);color:var(--p-danger)}.p-menu-item.disabled[data-v-5fe218d3]{opacity:.5;cursor:not-allowed}.p-menu-item.disabled[data-v-5fe218d3]:hover{background:transparent;color:var(--p-text)}.p-menu-item .p-ic[data-v-5fe218d3]{width:var(--p-ic-sm);height:var(--p-ic-sm);color:var(--p-muted)}.p-menu-item:hover .p-ic[data-v-5fe218d3]{color:var(--p-text-strong)}.p-menu-item.active .p-ic[data-v-5fe218d3]{color:var(--p-accent-hover)}.p-menu-item.danger .p-ic[data-v-5fe218d3]{color:var(--p-danger)}.p-menu-item.lg[data-v-5fe218d3]{min-height:44px;padding:12px 14px;font-size:var(--p-font-size-sm)}.p-menu-sep[data-v-5fe218d3]{height:1px;background:var(--p-line);margin:4px 0}.p-seg[data-v-5fe218d3]{display:inline-flex;gap:2px;padding:2px;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);font-family:var(--p-font-sans)}.p-seg-item[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:4px;padding:5px 12px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text);cursor:pointer;white-space:nowrap;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease),box-shadow var(--p-dur) var(--p-ease)}.p-seg-item[data-v-5fe218d3]:hover{color:var(--p-text)}.p-seg-item.on[data-v-5fe218d3]{background:var(--p-surface-raised);color:var(--p-text);box-shadow:var(--p-sh-sm)}.p-tabs[data-v-5fe218d3]{display:flex;align-items:center;gap:0;border-bottom:.5px solid var(--p-line);font-family:var(--p-font-sans)}.p-tab[data-v-5fe218d3]{padding:8px 14px;font-size:var(--p-font-size-sm);font-weight:500;color:var(--p-text-muted);cursor:pointer;white-space:nowrap;border-bottom:.5px solid transparent;margin-bottom:-.5px;transition:color var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease)}.p-tab[data-v-5fe218d3]:hover{color:var(--p-text)}.p-tab.on[data-v-5fe218d3]{color:var(--p-accent);border-bottom-color:var(--p-accent)}.p-switch[data-v-5fe218d3]{position:relative;display:inline-block;width:36px;height:20px;flex:none;border-radius:var(--p-r-full);background:var(--p-line-strong);cursor:pointer;transition:background var(--p-dur) var(--p-ease)}.p-switch[data-v-5fe218d3]:after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:var(--p-r-full);background:var(--p-surface-raised);box-shadow:var(--p-sh-xs);transform-origin:left center;transition:transform var(--p-dur) var(--p-ease)}.p-switch[data-v-5fe218d3]:hover:after{transform:scaleX(1.125)}.p-switch.on[data-v-5fe218d3]{background:var(--p-accent)}.p-switch.on[data-v-5fe218d3]:after{transform:translate(16px);transform-origin:right center}.p-switch.on[data-v-5fe218d3]:hover:after{transform:translate(16px) scaleX(1.125)}.p-switch[data-v-5fe218d3]:focus-visible{outline:none;box-shadow:var(--p-focus-ring)}.p-check[data-v-5fe218d3]{width:17px;height:17px;flex:none;display:inline-grid;place-items:center;border:.5px solid var(--p-line-strong);border-radius:var(--p-r-sm);background:var(--p-surface-raised);color:var(--p-text-on-accent);cursor:pointer;transition:background var(--p-dur) var(--p-ease),border-color var(--p-dur) var(--p-ease)}.p-check.on[data-v-5fe218d3]{background:var(--p-accent);border-color:var(--p-accent)}.p-check[data-v-5fe218d3]:focus-visible{outline:none;box-shadow:var(--p-focus-ring)}.p-check .p-ic[data-v-5fe218d3]{width:12px;height:12px}.p-avatar[data-v-5fe218d3]{width:32px;height:32px;flex:none;display:grid;place-items:center;border-radius:var(--p-r-md);background:var(--p-surface-sunken);border:.5px solid var(--p-line);color:var(--p-text-muted);font-size:var(--p-font-size-sm);font-weight:600}.p-avatar.sm[data-v-5fe218d3]{width:24px;height:24px;border-radius:var(--p-r-sm);font-size:var(--p-font-size-xs)}.p-avatar .p-ic[data-v-5fe218d3]{width:16px;height:16px}.p-avatar.sm .p-ic[data-v-5fe218d3]{width:13px;height:13px}.p-empty[data-v-5fe218d3]{display:flex;flex-direction:column;align-items:center;gap:8px;padding:32px 16px;color:var(--p-text-muted);text-align:center}.p-empty .em-ic[data-v-5fe218d3]{width:48px;height:48px;color:var(--p-text-faint)}.p-empty .em-title[data-v-5fe218d3]{font-size:var(--p-font-size-base);font-weight:600;color:var(--p-text)}.p-empty .em-hint[data-v-5fe218d3]{font-size:var(--p-font-size-sm);color:var(--p-text-muted)}.p-divider[data-v-5fe218d3]{width:100%;height:1px;background:var(--p-line);border:none}.p-divider-v[data-v-5fe218d3]{width:1px;align-self:stretch;background:var(--p-line);border:none}.p-turn-failed[data-v-5fe218d3]{display:flex;align-items:center;gap:var(--space-2);width:100%;max-width:560px;padding:var(--space-2) var(--space-3);border:var(--p-hairline) solid var(--color-danger-bd);border-radius:var(--radius-lg);background:var(--color-danger-soft);box-shadow:var(--shadow-xs)}.p-turn-failed .tf-chip[data-v-5fe218d3]{display:inline-flex;align-items:center;justify-content:center;width:var(--space-6);height:var(--space-6);flex:none;border-radius:var(--radius-md);background:var(--color-surface-raised);box-shadow:var(--shadow-xs);color:var(--color-danger)}.p-turn-failed .tf-chip svg[data-v-5fe218d3]{width:var(--p-ic-sm);height:var(--p-ic-sm)}.p-turn-failed .tf-main[data-v-5fe218d3]{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}.p-turn-failed .tf-title[data-v-5fe218d3]{font-size:var(--text-sm);font-weight:var(--weight-medium);color:var(--color-text);line-height:var(--leading-normal)}.p-turn-failed .tf-sub[data-v-5fe218d3],.p-turn-failed .tf-meta[data-v-5fe218d3]{font-size:var(--text-xs);color:var(--color-text-muted);line-height:var(--leading-normal);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-turn-failed .tf-meta[data-v-5fe218d3]{font-family:var(--font-mono);color:var(--color-text-faint)}.p-tip[data-v-5fe218d3]{position:relative;display:inline-flex}.p-tip .p-tooltip[data-v-5fe218d3]{position:absolute;bottom:calc(100% + 6px);left:50%;transform:translate(-50%);background:var(--p-text);color:var(--p-bg);font-size:var(--p-font-size-xs);padding:4px 8px;border-radius:var(--p-r-sm);white-space:nowrap;opacity:0;pointer-events:none;transition:opacity var(--p-dur-fast) var(--p-ease)}.p-tip:hover .p-tooltip[data-v-5fe218d3]{opacity:1}.p-banner[data-v-5fe218d3]{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:var(--p-r-md);border:.5px solid var(--p-line);background:var(--p-surface);font-size:var(--p-font-size-sm);color:var(--p-text)}.p-banner .bn-ic[data-v-5fe218d3]{width:18px;height:18px;flex:none}.p-banner.info[data-v-5fe218d3]{background:var(--p-accent-soft);border-color:var(--p-accent-bd)}.p-banner.info .bn-ic[data-v-5fe218d3]{color:var(--p-accent)}.p-banner.warning[data-v-5fe218d3]{background:var(--p-warning-soft);border-color:var(--p-warning-bd)}.p-banner.warning .bn-ic[data-v-5fe218d3]{color:var(--p-warning)}.p-banner.danger[data-v-5fe218d3]{background:var(--p-danger-soft);border-color:var(--p-danger-bd)}.p-banner.danger .bn-ic[data-v-5fe218d3]{color:var(--p-danger)}.p-sheet[data-v-5fe218d3]{background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-xl) var(--p-r-xl) 0 0;box-shadow:var(--p-sh-xl);padding:8px 16px 20px}.p-sheet-handle[data-v-5fe218d3]{width:36px;height:4px;border-radius:var(--p-r-full);background:var(--p-line-strong);margin:0 auto 8px}.p-skeleton[data-v-5fe218d3]{background:var(--p-surface-sunken);border-radius:var(--p-r-sm);animation:p-skel-5fe218d3 1.2s var(--p-ease-inout) infinite alternate}@keyframes p-skel-5fe218d3{0%{opacity:.5}to{opacity:1}}.p-cmdbar[data-v-5fe218d3]{display:flex;align-items:center;gap:8px;width:100%}.p-cmd[data-v-5fe218d3]{flex:1;min-width:0;height:38px;display:flex;align-items:center;gap:10px;padding:0 10px 0 14px;background:var(--p-surface-sunken);border:.5px solid var(--p-line);border-radius:var(--p-r-md);font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);color:var(--p-text-muted)}.p-cmd .cmd-text[data-v-5fe218d3]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.p-cmd .cmd-copy[data-v-5fe218d3]{margin-left:auto;flex:none;display:grid;place-items:center;width:26px;height:26px;border:none;background:transparent;border-radius:var(--p-r-sm);color:var(--p-text-faint);cursor:pointer;transition:background var(--p-dur) var(--p-ease),color var(--p-dur) var(--p-ease)}.p-cmd .cmd-copy[data-v-5fe218d3]:hover{background:var(--p-surface-raised);color:var(--p-text)}.p-cmd .cmd-copy .p-ic[data-v-5fe218d3]{width:15px;height:15px}.p-topbar[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;gap:12px;height:48px;padding:0 16px;background:var(--p-surface-raised);border:.5px solid var(--p-line);border-radius:var(--p-r-lg)}.p-topbar .tb-title[data-v-5fe218d3]{font-size:var(--p-font-size-sm);font-weight:600;color:var(--p-text)}.p-topbar .tb-actions[data-v-5fe218d3]{display:flex;align-items:center;gap:4px}.p-topbar.frost[data-v-5fe218d3]{background:#ffffffb8;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);border-color:#fff9}[data-p=dark] .p-topbar.frost[data-v-5fe218d3]{background:#161b22b8;border-color:#ffffff14}.demo-row[data-v-5fe218d3]{display:flex;flex-wrap:wrap;align-items:center;gap:10px}.demo-stack[data-v-5fe218d3]{display:flex;flex-direction:column;gap:12px;width:100%}.demo-col[data-v-5fe218d3]{display:flex;flex-direction:column;gap:10px}.demo-grow[data-v-5fe218d3]{flex:1;min-width:0}.demo-chat[data-v-5fe218d3]{display:flex;flex-direction:column;gap:14px;width:100%;max-width:560px}.icon-grid[data-v-5fe218d3]{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:8px;margin:14px 0}.icon-group-label[data-v-5fe218d3]{grid-column:1 / -1;margin-top:10px;font-size:11px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--d-fg-muted)}.icon-cell[data-v-5fe218d3]{display:flex;align-items:center;gap:10px;padding:8px 10px;border:.5px solid var(--d-line);border-radius:8px;background:var(--d-surface)}.icon-cell .kw-icon[data-v-5fe218d3]{width:20px;height:20px;color:var(--d-fg-soft)}.icon-cell .ic-name[data-v-5fe218d3]{font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;color:var(--d-fg)}.icon-sizes[data-v-5fe218d3]{display:flex;align-items:end;gap:22px;flex-wrap:wrap}.icon-sizes .sz[data-v-5fe218d3]{display:flex;flex-direction:column;align-items:center;gap:8px;font-size:11px;color:var(--d-fg-muted);font-family:JetBrains Mono,ui-monospace,monospace}.p-code-inline[data-v-5fe218d3]{font-family:var(--p-font-mono);background:var(--p-surface-sunken);color:var(--p-text);padding:0 5px;border-radius:var(--p-r-sm);font-size:.9em}.p-code-block[data-v-5fe218d3]{border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;background:var(--p-surface-sunken)}.p-code-block-head[data-v-5fe218d3]{display:flex;align-items:center;justify-content:space-between;padding:8px 12px;background:var(--p-surface);border-bottom:.5px solid var(--p-line);font-family:var(--p-font-mono);font-size:var(--p-font-size-xs);color:var(--p-text-muted)}.p-code-block pre[data-v-5fe218d3]{margin:0;padding:12px 14px;font-family:var(--p-font-mono);font-size:var(--p-font-size-sm);line-height:1.65;color:var(--p-text);overflow-x:auto}.p-diff[data-v-5fe218d3]{border:.5px solid var(--p-line);border-radius:var(--p-r-md);overflow:hidden;font-family:var(--p-font-mono);font-size:var(--p-font-size-sm)}.p-diff-head[data-v-5fe218d3]{padding:8px 12px;background:var(--p-surface);border-bottom:.5px solid var(--p-line);font-size:var(--p-font-size-xs);color:var(--p-text-muted)}.p-diff-row[data-v-5fe218d3]{display:flex;gap:10px;padding:2px 12px;line-height:1.6}.p-diff-row .pm[data-v-5fe218d3]{width:14px;flex:none;color:var(--p-text-faint)}.p-diff-row.add[data-v-5fe218d3]{background:var(--p-success-soft)}.p-diff-row.add .pm[data-v-5fe218d3]{color:var(--p-success)}.p-diff-row.del[data-v-5fe218d3]{background:var(--p-danger-soft)}.p-diff-row.del .pm[data-v-5fe218d3]{color:var(--p-danger)}.p-diff-row .p-diff-code[data-v-5fe218d3]{color:var(--p-text)}.p-field-error[data-v-5fe218d3]{color:var(--p-danger);font-size:var(--p-font-size-xs)}.p-btn .p-spinner[data-v-5fe218d3]{vertical-align:middle}.p-btn .p-spinner .track[data-v-5fe218d3]{stroke:currentColor;opacity:.35}.p-btn .p-spinner .arc[data-v-5fe218d3]{stroke:currentColor}.ds-page[data-v-5fe218d3]{position:fixed;inset:0;z-index:var(--z-max);overflow-y:auto}.ds-topbar[data-v-5fe218d3]{position:sticky;top:0;z-index:10;display:flex;align-items:center;gap:var(--space-3);padding:var(--space-2) var(--space-4);background:var(--color-surface);border-bottom:.5px solid var(--color-line)}.ds-back[data-v-5fe218d3]{display:inline-flex;align-items:center;gap:var(--space-1);padding:var(--space-1) var(--space-3);border:.5px solid var(--color-line);border-radius:var(--radius-md);background:var(--color-surface-raised);color:var(--color-text);font-family:var(--font-ui);font-size:var(--text-sm);cursor:pointer}.ds-back[data-v-5fe218d3]:hover{background:var(--color-hover)}.ds-topbar-title[data-v-5fe218d3]{font-size:var(--text-sm);font-weight:var(--weight-medium);color:var(--color-text-muted)} diff --git a/apps/kimi-code/dist-web/assets/Tooltip-CPKMqLZA.js b/apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js similarity index 98% rename from apps/kimi-code/dist-web/assets/Tooltip-CPKMqLZA.js rename to apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js index e6d65f8ebfc..2977411a41f 100644 --- a/apps/kimi-code/dist-web/assets/Tooltip-CPKMqLZA.js +++ b/apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js @@ -1 +1 @@ -import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-HRJ6xRtC.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default}; +import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-D-7nOosq.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default}; diff --git a/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-D_3zPyPt.js b/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js similarity index 86% rename from apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-D_3zPyPt.js rename to apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js index f2f785dd20b..e0a31a7b014 100644 --- a/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-D_3zPyPt.js +++ b/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js @@ -1 +1 @@ -import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-hIDvr-8C.js";import{p as f}from"./chunk-JWPE2WC7-DTx-f56M.js";import{_ as n,l as o}from"./mermaid.core-Cahi9cr1.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; +import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p as f}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as n,l as o}from"./mermaid.core-CJB1tAev.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram}; diff --git a/apps/kimi-code/dist-web/assets/arc-E_7M-TWh.js b/apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js similarity index 98% rename from apps/kimi-code/dist-web/assets/arc-E_7M-TWh.js rename to apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js index 0992f956d38..2c68be080a7 100644 --- a/apps/kimi-code/dist-web/assets/arc-E_7M-TWh.js +++ b/apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js @@ -1 +1 @@ -import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-Cahi9cr1.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*ar*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),sy))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(Ly?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),pr*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),sy))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(Ly?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),ps?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=e}),(function(A,G,N){var v=N(0);function h(){}for(var i in v)h[i]=v[i];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,A.exports=h}),(function(A,G,N){function v(h,i){h==null&&i==null?(this.x=0,this.y=0):(this.x=h,this.y=i)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(h){this.x=h},v.prototype.setY=function(h){this.y=h},v.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(0),r=N(7),a=N(3),f=N(1),e=N(13),u=N(12),t=N(11);function s(c,l,T){v.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,l,T){if(l==null&&T==null){var g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var d=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(d.source=l,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),l.edges.push(d),T!=l&&T.edges.push(d),d)}},s.prototype.remove=function(c){var l=c;if(c instanceof a){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),g,d=T.length,C=0;C-1&&P>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(w,1),g.target!=g.source&&g.target.edges.splice(P,1);var S=g.source.owner.getEdges().indexOf(g);if(S==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(S,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,g,d,C=this.getNodes(),S=C.length,w=0;wT&&(c=T),l>g&&(l=g)}return c==h.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?d=C[0].getParent().paddingLeft:d=this.margin,this.left=l-d,this.top=c-d,new u(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,d=-h.MAX_VALUE,C,S,w,P,B,U=this.nodes,V=U.length,M=0;MC&&(l=C),Tw&&(g=w),dC&&(l=C),Tw&&(g=w),d=this.nodes.length){var V=0;T.forEach(function(M){M.owner==c&&V++}),V==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,G,N){var v,h=N(1);function i(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var r=this.layout.newGraph(),a=this.layout.newNode(null),f=this.add(r,a);return this.setRootGraph(f),this.rootGraph},i.prototype.add=function(r,a,f,e,u){if(f==null&&e==null&&u==null){if(r==null)throw"Graph is null!";if(a==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(a.child!=null)throw"Already has a child!";return r.parent=a,a.child=r,r}else{u=f,e=a,f=r;var t=e.getOwner(),s=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,u);if(f.isInterGraph=!0,f.source=e,f.target=u,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},i.prototype.remove=function(r){if(r instanceof v){var a=r;if(a.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(a==this.rootGraph||a.parent!=null&&a.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(a.getEdges());for(var e,u=f.length,t=0;t=r.getRight()?a[0]+=Math.min(r.getX()-i.getX(),i.getRight()-r.getRight()):r.getX()<=i.getX()&&r.getRight()>=i.getRight()&&(a[0]+=Math.min(i.getX()-r.getX(),r.getRight()-i.getRight())),i.getY()<=r.getY()&&i.getBottom()>=r.getBottom()?a[1]+=Math.min(r.getY()-i.getY(),i.getBottom()-r.getBottom()):r.getY()<=i.getY()&&r.getBottom()>=i.getBottom()&&(a[1]+=Math.min(i.getY()-r.getY(),r.getBottom()-i.getBottom()));var u=Math.abs((r.getCenterY()-i.getCenterY())/(r.getCenterX()-i.getCenterX()));r.getCenterY()===i.getCenterY()&&r.getCenterX()===i.getCenterX()&&(u=1);var t=u*a[0],s=a[1]/u;a[0]t)return a[0]=f,a[1]=o,a[2]=u,a[3]=U,!1;if(eu)return a[0]=s,a[1]=e,a[2]=P,a[3]=t,!1;if(fu?(a[0]=l,a[1]=T,n=!0):(a[0]=c,a[1]=o,n=!0):p===y&&(f>u?(a[0]=s,a[1]=o,n=!0):(a[0]=g,a[1]=T,n=!0)),-m===y?u>f?(a[2]=B,a[3]=U,E=!0):(a[2]=P,a[3]=w,E=!0):m===y&&(u>f?(a[2]=S,a[3]=w,E=!0):(a[2]=V,a[3]=U,E=!0)),n&&E)return!1;if(f>u?e>t?(I=this.getCardinalDirection(p,y,4),O=this.getCardinalDirection(m,y,2)):(I=this.getCardinalDirection(-p,y,3),O=this.getCardinalDirection(-m,y,1)):e>t?(I=this.getCardinalDirection(-p,y,1),O=this.getCardinalDirection(-m,y,3)):(I=this.getCardinalDirection(p,y,2),O=this.getCardinalDirection(m,y,4)),!n)switch(I){case 1:W=o,R=f+-C/y,a[0]=R,a[1]=W;break;case 2:R=g,W=e+d*y,a[0]=R,a[1]=W;break;case 3:W=T,R=f+C/y,a[0]=R,a[1]=W;break;case 4:R=l,W=e+-d*y,a[0]=R,a[1]=W;break}if(!E)switch(O){case 1:Q=w,x=u+-_/y,a[2]=x,a[3]=Q;break;case 2:x=V,Q=t+M*y,a[2]=x,a[3]=Q;break;case 3:Q=U,x=u+_/y,a[2]=x,a[3]=Q;break;case 4:x=B,Q=t+-M*y,a[2]=x,a[3]=Q;break}}return!1},h.getCardinalDirection=function(i,r,a){return i>r?a:1+a%4},h.getIntersection=function(i,r,a,f){if(f==null)return this.getIntersection2(i,r,a);var e=i.x,u=i.y,t=r.x,s=r.y,o=a.x,c=a.y,l=f.x,T=f.y,g=void 0,d=void 0,C=void 0,S=void 0,w=void 0,P=void 0,B=void 0,U=void 0,V=void 0;return C=s-u,w=e-t,B=t*u-e*s,S=T-c,P=o-l,U=l*c-o*T,V=C*P-S*w,V===0?null:(g=(w*U-P*B)/V,d=(S*B-C*U)/V,new v(g,d))},h.angleOfVector=function(i,r,a,f){var e=void 0;return i!==a?(e=Math.atan((f-r)/(a-i)),a=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),g=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:d}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,A.exports=h}),(function(A,G,N){function v(){}v.sign=function(h){return h>0?1:h<0?-1:0},v.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},v.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},A.exports=v}),(function(A,G,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,A.exports=v}),(function(A,G,N){var v=(function(){function e(u,t){for(var s=0;s"u"?"undefined":v(i);return i==null||r!="object"&&r!="function"},A.exports=h}),(function(A,G,N){function v(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c0&&c;){for(C.push(w[0]);C.length>0&&c;){var P=C[0];C.splice(0,1),d.add(P);for(var B=P.getEdges(),g=0;g-1&&w.splice(_,1)}d=new Set,S=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(l),g=0;g=0&&c.splice(U,1);var V=S.getNeighborsList();V.forEach(function(n){if(l.indexOf(n)<0){var E=T.get(n),p=E-1;p==1&&P.push(n),T.set(n,p)}})}l=l.concat(P),(c.length==1||c.length==2)&&(g=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,G,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},A.exports=v}),(function(A,G,N){var v=N(5);function h(i,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(i){this.lworldExtX=i},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(i){this.lworldExtY=i},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},h.prototype.transformX=function(i){var r=0,a=this.lworldExtX;return a!=0&&(r=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/a),r},h.prototype.transformY=function(i){var r=0,a=this.lworldExtY;return a!=0&&(r=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/a),r},h.prototype.inverseTransformX=function(i){var r=0,a=this.ldeviceExtX;return a!=0&&(r=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/a),r},h.prototype.inverseTransformY=function(i){var r=0,a=this.ldeviceExtY;return a!=0&&(r=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/a),r},h.prototype.inverseTransformPoint=function(i){var r=new v(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return r},A.exports=h}),(function(A,G,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);si.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,g=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oC||d>C)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(C=s.getEstimatedSize()*this.compoundGravityRangeFactor,(g>C||d>C)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||C>=g[0].length)){for(var S=0;Se}}]),a})();A.exports=r}),(function(A,G,N){function v(){}v.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var i=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function Bt(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),a=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,e=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,Ct){return Tt&&Ct})(z0;){var J=void 0,It=void 0;for(J=n-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==n?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===n-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[n-2];r[n-2]=0;for(var ut=n-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),wt=this.s[ut]/Et,Ot=it/Et;this.s[ut]=Et,ut!==J&&(it=-Ot*r[ut-1],r[ut-1]=wt*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(i)?(r=i/h,r=Math.abs(h)*Math.sqrt(1+r*r)):i!=0?(r=h/i,r=Math.abs(i)*Math.sqrt(1+r*r)):r=0,r},A.exports=v}),(function(A,G,N){var v=(function(){function r(a,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,r),this.sequence1=a,this.sequence2=f,this.match_score=e,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=a.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;a--){var f=this.listeners[a];f.event===i&&f.callback===r&&this.listeners.splice(a,1)}},h.emit=function(i,r){for(var a=0;a{var G={45:((i,r,a)=>{var f={};f.layoutBase=a(551),f.CoSEConstants=a(806),f.CoSEEdge=a(767),f.CoSEGraph=a(880),f.CoSEGraphManager=a(578),f.CoSELayout=a(765),f.CoSENode=a(991),f.ConstraintHandler=a(902),i.exports=f}),806:((i,r,a)=>{var f=a(551).FDLayoutConstants;function e(){}for(var u in f)e[u]=f[u];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,i.exports=e}),767:((i,r,a)=>{var f=a(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),880:((i,r,a)=>{var f=a(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),578:((i,r,a)=>{var f=a(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),765:((i,r,a)=>{var f=a(551).FDLayout,e=a(578),u=a(880),t=a(991),s=a(767),o=a(806),c=a(902),l=a(551).FDLayoutConstants,T=a(551).LayoutConstants,g=a(551).Point,d=a(551).PointD,C=a(551).DimensionD,S=a(551).Layout,w=a(551).Integer,P=a(551).IGeometry,B=a(551).LGraph,U=a(551).Transform,V=a(551).LinkedList;function M(){f.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(f.prototype);for(var _ in f)M[_]=f[_];M.prototype.newGraphManager=function(){var n=new e(this);return this.graphManager=n,n},M.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},M.prototype.newNode=function(n){return new t(this.graphManager,n)},M.prototype.newEdge=function(n){return new s(null,null,n)},M.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return E.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var O=new Map,R=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(D){n.fixedNodesOnHorizontal.add(D),n.fixedNodesOnVertical.add(D)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*D.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=D[tt],D[tt]=D[H],D[H]=k;return D},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes(k)||(n.nodesInRelativeHorizontal.push(k),n.nodeToRelativeConstraintMapHorizontal.set(k,[]),n.dummyToNodeForVerticalAlignment.has(k)?n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(k).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:D.gap}),n.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:D.gap})}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;n.nodesInRelativeVertical.includes(tt)||(n.nodesInRelativeVertical.push(tt),n.nodeToRelativeConstraintMapVertical.set(tt,[]),n.dummyToNodeForHorizontalAlignment.has(tt)?n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(tt).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:D.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:D.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new V,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(wt){It.has(wt)||(J.push(wt),It.add(wt),tt[Nt].push(wt))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,n.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},M.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var D=n.idToNodeMap.get($.nodeId);D.displacementX=0,D.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var R;for(R=0;Rm&&(m=Math.floor(O.y)),I=Math.floor(O.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-O.x/2,T.WORLD_CENTER_Y-O.y/2))},M.radialLayout=function(n,E,p){var m=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(E,null,0,359,0,m);var y=B.calculateBounds(n),I=new U;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var O=0;O1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?D=(z.indexOf(H[0])+1)%$:D=0;for(var ht=Math.abs(m-p)/X,J=D;rt!=X;J=++J%$){var It=z[J].getOtherEnd(n);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;M.branchRadialLayout(It,n,Nt,vt,y+I,I),rt++}}},M.maxDiagonalInTree=function(n){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var n=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[R]=[]),E[R]=E[R].concat(I)}Object.keys(E).forEach(function(W){if(E[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=E[W];var Q=E[W][0].getParent(),z=new t(n.graphManager);z.id=x,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,n.idToDummyNode[x]=z;var X=n.getGraphManager().add(n.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(I+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>I?(m.rect.y-=(m.labelHeight-I)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-I)/2):m.labelPosVertical=="bottom"&&m.setHeight(I+m.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var E=this.compoundOrder[n],p=E.id,m=E.paddingLeft,y=E.paddingTop,I=E.labelMarginLeft,O=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,I,O)}},M.prototype.repopulateZeroDegreeMembers=function(){var n=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=n.idToDummyNode[p],y=m.paddingLeft,I=m.paddingTop,O=m.labelMarginLeft,R=m.labelMarginTop;n.adjustLocations(E[p],m.rect.x,m.rect.y,y,I,O,R)})},M.prototype.getToBeTiled=function(n){var E=n.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=n.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},M.prototype.getNodeDegree=function(n){n.id;for(var E=n.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+n.verticalPadding}},M.prototype.tileCompoundMembers=function(n,E){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(n[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,O=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(O+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>O?(y.rect.y-=(y.labelHeight-O)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-O)/2):y.labelPosVertical=="bottom"&&y.setHeight(O+y.labelHeight))}})},M.prototype.tileNodes=function(n,E){var p=this.tileNodesByFavoringDim(n,E,!0),m=this.tileNodesByFavoringDim(n,E,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(m),O;return IR&&(R=$.getWidth())});var W=I/y,x=O/y,Q=Math.pow(p-m,2)+4*(W+m)*(x+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return R>rt&&(rt=R),rt+=m*2,rt},M.prototype.tileNodesByFavoringDim=function(n,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,I=o.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};I&&(O.idealRowWidth=this.calcIdealRowWidth(n,p));var R=function(D){return D.rect.width*D.rect.height},W=function(D,H){return R(H)-R(D)};n.sort(function($,D){var H=W;return O.idealRowWidth?(H=I,H($.id,D.id)):H($,D)});for(var x=0,Q=0,z=0;z0&&(O+=n.horizontalPadding),n.rowWidth[p]=O,n.width0&&(R+=n.verticalPadding);var W=0;R>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=R,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(E)},M.prototype.getShortestRowIndex=function(n){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=n.rowWidth[m]);return E},M.prototype.canAddHorizontal=function(n,E,p){if(n.idealRowWidth){var m=n.rows.length-1,y=n.rowWidth[m];return y+E+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var O=n.rowWidth[I];if(O+n.horizontalPadding+E<=n.width)return!0;var R=0;n.rowHeight[I]0&&(R=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-O>=E+n.horizontalPadding?W=(n.height+R)/(O+E+n.horizontalPadding):W=(n.height+R)/n.width,R=p+n.verticalPadding;var x;return n.widthI&&E!=p){m.splice(-1,1),n.rows[p].push(y),n.rowWidth[E]=n.rowWidth[E]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=m[R].height);E>0&&(O+=n.verticalPadding);var W=n.rowHeight[E]+n.rowHeight[p];n.rowHeight[E]=O,n.rowHeight[p]0)for(var rt=y;rt<=I;rt++)X[0]+=this.grid[rt][O-1].length+this.grid[rt][O].length-1;if(I0)for(var rt=O;rt<=R;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,D,H,k=0;k{var f=a(551).FDLayoutNode,e=a(551).IMath;function u(s,o,c,l){f.call(this,s,o,c,l)}u.prototype=Object.create(f.prototype);for(var t in f)u[t]=f[t];u.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),l,T=0;T{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,g.has(st)?d[g.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,g.has(st)?C[g.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=g.has(st)?d[g.get(st)]:q.get(st):ft+=g.has(st)?C[g.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var At=function(){var ot=dt.shift(),Lt=Y.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,Bt=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw Bt}}var fe=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),ne;!(Qt=(ne=Jt.next()).done);Qt=!0){var te=ne.value;et.set(te,et.get(te)+fe)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},_=function(Y){var Z=0,K=0,q=0,at=0;if(Y.forEach(function(j){j.left?d[g.get(j.left)]-d[g.get(j.right)]>=0?Z++:K++:C[g.get(j.top)]-C[g.get(j.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var et=0;et1)l.fixedNodeConstraint.forEach(function(F,Y){m[Y]=[F.position.x,F.position.y],y[Y]=[d[g.get(F.nodeId)],C[g.get(F.nodeId)]]}),I=!0;else if(l.alignmentConstraint)(function(){var F=0;if(l.alignmentConstraint.vertical){for(var Y=l.alignmentConstraint.vertical,Z=function(et){var j=new Set;Y[et].forEach(function(pt){j.add(pt)});var dt=new Set([].concat(f(j)).filter(function(pt){return R.has(pt)})),At=void 0;dt.size>0?At=d[g.get(dt.values().next().value)]:At=V(j).x,Y[et].forEach(function(pt){m[F]=[At,C[g.get(pt)]],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},K=0;K0?At=d[g.get(dt.values().next().value)]:At=V(j).y,q[et].forEach(function(pt){m[F]=[d[g.get(pt)],At],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},ct=0;ctz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(F,Y){var Z={x:d[g.get(F.nodeId)],y:C[g.get(F.nodeId)]},K=F.position,q=U(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,d.forEach(function(F,Y){d[Y]+=mt.x}),C.forEach(function(F,Y){C[Y]+=mt.y}),l.fixedNodeConstraint.forEach(function(F){d[g.get(F.nodeId)]=F.position.x,C[g.get(F.nodeId)]=F.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(Y){var Z=new Set;Dt[Y].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return R.has(at)})),q=void 0;K.size>0?q=d[g.get(K.values().next().value)]:q=V(Z).x,Z.forEach(function(at){R.has(at)||(d[g.get(at)]=q)})},Ht=0;Ht0?q=C[g.get(K.values().next().value)]:q=V(Z).y,Z.forEach(function(at){R.has(at)||(C[g.get(at)]=q)})},Ft=0;Ft{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(45);return h})()})})(he)),he.exports}var pr=se.exports,De;function yr(){return De||(De=1,(function(L,b){(function(G,N){L.exports=N(vr())})(pr,function(A){return(()=>{var G={658:(i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var a=arguments.length,f=Array(a>1?a-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],l=!0,T=!1,g=void 0;try{for(var d=s[Symbol.iterator](),C;!(l=(C=d.next()).done)&&(c.push(C.value),!(o&&c.length===o));l=!0);}catch(S){T=!0,g=S}finally{try{!l&&d.return&&d.return()}finally{if(T)throw g}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=a(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var s={},o=0;o0&&I.merge(x)});for(var O=0;O1){C=g[0],S=C.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),B),U},u.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,C=!1,S=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),P;!(d=(P=w.next()).done);d=!0){var B=P.value,U=f(B,2),V=U[0],M=U[1],_=o.cy.getElementById(V);if(_){var n=_.boundingBox(),E=s.xCoords[M]-n.w/2,p=s.xCoords[M]+n.w/2,m=s.yCoords[M]-n.h/2,y=s.yCoords[M]+n.h/2;El&&(l=p),mg&&(g=y)}}}catch(x){C=!0,S=x}finally{try{!d&&w.return&&w.return()}finally{if(C)throw S}}var I=t.x-(l+c)/2,O=t.y-(g+T)/2;s.xCoords=s.xCoords.map(function(x){return x+I}),s.yCoords=s.yCoords.map(function(x){return x+O})}else{Object.keys(s).forEach(function(x){var Q=s[x],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zl&&(l=X),rtg&&(g=$)});var R=t.x-(l+c)/2,W=t.y-(g+T)/2;Object.keys(s).forEach(function(x){var Q=s[x];Q.setCenter(Q.getCenterX()+R,Q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,s,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,C=void 0,S=void 0,w=void 0,P=void 0,B=t.descendants().not(":parent"),U=B.length,V=0;VC&&(l=C),Tw&&(g=w),d{var f=a(548),e=a(140).CoSELayout,u=a(140).CoSENode,t=a(140).layoutBase.PointD,s=a(140).layoutBase.DimensionD,o=a(140).layoutBase.LayoutConstants,c=a(140).layoutBase.FDLayoutConstants,l=a(140).CoSEConstants,T=function(d,C){var S=d.cy,w=d.eles,P=w.nodes(),B=w.edges(),U=void 0,V=void 0,M=void 0,_={};d.randomize&&(U=C.nodeIndexes,V=C.xCoords,M=C.yCoords);var n=function(x){return typeof x=="function"},E=function(x,Q){return n(x)?x(Q):x},p=f.calcParentsWithoutChildren(S,w),m=function W(x,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(x,Q,z){for(var X=0,rt=0,$=0;$0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:n(d.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,Q){Q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(x.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,l.TILE=d.tile,l.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),d.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),d.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new e,R=O.newGraphManager();return m(R.addRoot(),f.getTopMostNodes(P),O,d),y(O,R,B),I(O,d),O.runLayout(),_};i.exports={coseLayout:T}}),212:((i,r,a)=>{var f=(function(){function d(C,S){for(var w=0;w0)if(p){var I=t.getTopMostNodes(w.eles.nodes());if(M=t.connectComponents(P,w.eles,I),M.forEach(function(vt){var it=vt.boundingBox();_.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&M.forEach(function(vt){w.eles=vt,U.push(o(w))}),w.quality=="default"||w.quality=="proof"){var O=P.collection();if(w.tile){var R=new Map,W=[],x=[],Q=0,z={nodeIndexes:R,xCoords:W,yCoords:x},X=[];if(M.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){O.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),O.length>1){var rt=O.boundingBox();_.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),M.push(O),U.push(z);for(var $=X.length-1;$>=0;$--)M.splice(X[$],1),U.splice(X[$],1),_.splice(X[$],1)}}M.forEach(function(vt,it){w.eles=vt,V.push(l(w,U[it])),t.relocateComponent(_[it],V[it],w)})}else M.forEach(function(vt,it){t.relocateComponent(_[it],U[it],w)});var D=new Set;if(M.length>1){var H=[],k=B.filter(function(vt){return vt.css("display")=="none"});M.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=U[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var wt=void 0;vt.nodes().not(k).forEach(function(Ot){if(w.quality=="draft")if(!Ot.isParent())wt=ut.get(Ot.id()),Et.nodes.push({x:U[it].xCoords[wt]-Ot.boundingbox().w/2,y:U[it].yCoords[wt]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var mt=t.calcBoundingBox(Ot,U[it].xCoords,U[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else V[it][Ot.id()]&&Et.nodes.push({x:V[it][Ot.id()].getLeft(),y:V[it][Ot.id()].getTop(),width:V[it][Ot.id()].getWidth(),height:V[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var mt=Ot.source(),Dt=Ot.target();if(mt.css("display")!="none"&&Dt.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Dt.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,U[it].xCoords,U[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[it].xCoords[Rt]),Ut.push(U[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[it].xCoords,U[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[it].xCoords[Ht]),Pt.push(U[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else V[it][mt.id()]&&V[it][Dt.id()]&&Et.edges.push({startX:V[it][mt.id()].getCenterX(),startY:V[it][mt.id()].getCenterY(),endX:V[it][Dt.id()].getCenterX(),endY:V[it][Dt.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),D.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")U.forEach(function(vt,it){var ut=vt.xCoords.map(function(wt){return wt+tt[it].dx}),Et=vt.yCoords.map(function(wt){return wt+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;D.forEach(function(vt){Object.keys(V[vt]).forEach(function(it){var ut=V[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(_.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);U.push(y)}w.quality=="default"||w.quality=="proof"?(V.push(l(w,U[0])),t.relocateComponent(_[0],V[0],w)):t.relocateComponent(_[0],U[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,wt=void 0,Ot=it.data("id");return V.forEach(function(Dt){Ot in Dt&&(Et={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},wt=Dt[Ot])}),w.nodeDimensionsIncludeLabels&&(wt.labelWidth&&(wt.labelPosHorizontal=="left"?Et.x+=wt.labelWidth/2:wt.labelPosHorizontal=="right"&&(Et.x-=wt.labelWidth/2)),wt.labelHeight&&(wt.labelPosVertical=="top"?Et.y+=wt.labelHeight/2:wt.labelPosVertical=="bottom"&&(Et.y-=wt.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(P,B),Nt=B.filter(function(vt){return vt.css("display")=="none"});w.eles=B.not(Nt),B.nodes().not(":parent").not(Nt).layoutPositions(S,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();i.exports=g}),657:((i,r,a)=>{var f=a(548),e=a(140).layoutBase.Matrix,u=a(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),g=l.nodes(":parent"),d=new Map,C=new Map,S=new Map,w=[],P=[],B=[],U=[],V=[],M=[],_=[],n=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,I=o.samplingType,O=o.nodeSeparation,R=void 0,W=function(){for(var Y=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=V[Lt],At=Lt)}return At},Q=function(Y){var Z=void 0;if(Y){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;j=et}for(var pt=0;pt=1)break;j=et}for(var lt=0;lt0&&(Z.isParent()?w[Y].push(S.get(Z.id())):w[Y].push(Z.id()))})});var Nt=function(Y){var Z=C.get(Y),K=void 0;d.get(Y).forEach(function(q){c.getElementById(q).isParent()?K=S.get(q):K=q,w[Z].push(K),w[C.get(K)].push(Y)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),wt;!(vt=(wt=Et.next()).done);vt=!0){var Ot=wt.value;Nt(Ot)}}catch(F){it=!0,ut=F}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=C.size;var mt=void 0;if(E>2){R=E{var f=a(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),i.exports=e}),140:(i=>{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(579);return h})()})})(se)),se.exports}var mr=yr();const Er=cr(mr);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:gt(L=>`${L},${L/2} 0,${L} 0,0`,"L"),R:gt(L=>`0,${L/2} ${L},0 ${L},${L}`,"R"),T:gt(L=>`0,0 ${L},0 ${L/2},${L}`,"T"),B:gt(L=>`${L/2},0 ${L},${L} 0,${L}`,"B")},oe={L:gt((L,b)=>L-b+2,"L"),R:gt((L,b)=>L-2,"R"),T:gt((L,b)=>L-b+2,"T"),B:gt((L,b)=>L-2,"B")},Tr=gt(function(L){return Wt(L)?L==="L"?"R":"L":L==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=gt(function(L){const b=L;return b==="L"||b==="R"||b==="T"||b==="B"},"isArchitectureDirection"),Wt=gt(function(L){const b=L;return b==="L"||b==="R"},"isArchitectureDirectionX"),qt=gt(function(L){const b=L;return b==="T"||b==="B"},"isArchitectureDirectionY"),Te=gt(function(L,b){const A=Wt(L)&&qt(b),G=qt(L)&&Wt(b);return A||G},"isArchitectureDirectionXY"),Nr=gt(function(L){const b=L[0],A=L[1],G=Wt(b)&&qt(A),N=qt(b)&&Wt(A);return G||N},"isArchitecturePairXY"),Lr=gt(function(L){return L!=="LL"&&L!=="RR"&&L!=="TT"&&L!=="BB"},"isValidArchitectureDirectionPair"),pe=gt(function(L,b){const A=`${L}${b}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=gt(function([L,b],A){const G=A[0],N=A[1];return Wt(G)?qt(N)?[L+(G==="L"?-1:1),b+(N==="T"?1:-1)]:[L+(G==="L"?-1:1),b]:Wt(N)?[L+(N==="L"?1:-1),b+(G==="T"?1:-1)]:[L,b+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),wr=gt(function(L){return L==="LT"||L==="TL"?[1,1]:L==="BL"||L==="LB"?[1,-1]:L==="BR"||L==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Ar=gt(function(L,b){return Te(L,b)?"bend":Wt(L)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=gt(function(L){return L.type==="service"},"isArchitectureService"),Or=gt(function(L){return L.type==="junction"},"isArchitectureJunction"),be=gt(L=>L.data(),"edgeData"),ie=gt(L=>L.data(),"nodeData"),Dr=ar.architecture,Pe=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Qe,this.getAccTitle=Je,this.setDiagramTitle=Ke,this.getDiagramTitle=je,this.getAccDescription=_e,this.setAccDescription=tr,this.clear()}static{gt(this,"ArchitectureDB")}setDiagramId(L){this.diagramId=L}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",er()}addService({id:L,icon:b,in:A,title:G,iconText:N}){if(this.registeredIds[L]!==void 0)throw new Error(`The service id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The service [${L}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The service [${L}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[A]==="node")throw new Error(`The service [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"service",icon:b,iconText:N,title:G,edges:[],in:A}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:L,in:b}){if(this.registeredIds[L]!==void 0)throw new Error(`The junction id [${L}] is already in use by another ${this.registeredIds[L]}`);if(b!==void 0){if(L===b)throw new Error(`The junction [${L}] cannot be placed within itself`);if(this.registeredIds[b]===void 0)throw new Error(`The junction [${L}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[b]==="node")throw new Error(`The junction [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"junction",edges:[],in:b}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(L){return this.nodes[L]??null}addGroup({id:L,icon:b,in:A,title:G}){if(this.registeredIds?.[L]!==void 0)throw new Error(`The group id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The group [${L}] cannot be placed within itself`);if(this.registeredIds?.[A]===void 0)throw new Error(`The group [${L}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[A]==="node")throw new Error(`The group [${L}]'s parent is not a group`)}this.registeredIds[L]="group",this.groups[L]={id:L,icon:b,title:G,in:A}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:L,rhsId:b,lhsDir:A,rhsDir:G,lhsInto:N,rhsInto:v,lhsGroup:h,rhsGroup:i,title:r}){if(!Re(A))throw new Error(`Invalid direction given for left hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(A)}`);if(!Re(G))throw new Error(`Invalid direction given for right hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(G)}`);if(this.nodes[L]===void 0&&this.groups[L]===void 0)throw new Error(`The left-hand id [${L}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[b]===void 0&&this.groups[b]===void 0)throw new Error(`The right-hand id [${b}] does not yet exist. Please create the service/group before declaring an edge to it.`);const a=this.nodes[L].in,f=this.nodes[b].in;if(h&&a&&f&&a==f)throw new Error(`The left-hand id [${L}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(i&&a&&f&&a==f)throw new Error(`The right-hand id [${b}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const e={lhsId:L,lhsDir:A,lhsInto:N,lhsGroup:h,rhsId:b,rhsDir:G,rhsInto:v,rhsGroup:i,title:r};this.edges.push(e),this.nodes[L]&&this.nodes[b]&&(this.nodes[L].edges.push(this.edges[this.edges.length-1]),this.nodes[b].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(L){if(L.members.length<2)throw new Error(`An align directive requires at least two members; got ${L.members.length}`);const b=new Set;L.members.forEach(A=>{if(this.registeredIds[A]!=="node")throw new Error(`align ${L.direction} references [${A}], which is not a service or junction`);if(b.has(A))throw new Error(`align ${L.direction} lists [${A}] more than once`);b.add(A)}),this.layoutHints.push(L)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const L={},b=Object.entries(this.nodes).reduce((i,[r,a])=>(i[r]=a.edges.reduce((f,e)=>{const u=this.getNode(e.lhsId)?.in,t=this.getNode(e.rhsId)?.in;if(u&&t&&u!==t){const s=Ar(e.lhsDir,e.rhsDir);s!=="bend"&&(L[u]??={},L[u][t]=s,L[t]??={},L[t][u]=s)}if(e.lhsId===r){const s=pe(e.lhsDir,e.rhsDir);s&&(f[s]=e.rhsId)}else{const s=pe(e.rhsDir,e.lhsDir);s&&(f[s]=e.lhsId)}return f},{}),i),{}),A=Object.keys(b)[0],G={[A]:1},N=Object.keys(b).reduce((i,r)=>r===A?i:{...i,[r]:1},{}),v=gt(i=>{const r={[i]:[0,0]},a=[i];for(;a.length>0;){const f=a.shift();if(f){G[f]=1,delete N[f];const e=b[f],[u,t]=r[f];Object.entries(e).forEach(([s,o])=>{G[o]||(r[o]=Cr([u,t],s),a.push(o))})}}return r},"BFS"),h=[v(A)];for(;Object.keys(N).length>0;)h.push(v(Object.keys(N)[0]));this.dataStructures={adjList:b,spatialMaps:h,groupAlignments:L}}return this.dataStructures}setElementForId(L,b){this.elements[L]=b}getElementById(L){return this.elements[L]}getConfig(){return rr({...Dr,...ir().architecture})}getConfigField(L){return this.getConfig()[L]}},xr=gt((L,b)=>{ke(L,b),L.groups.map(A=>b.addGroup(A)),L.services.map(A=>b.addService({...A,type:"service"})),L.junctions.map(A=>b.addJunction({...A,type:"junction"})),L.edges.map(A=>b.addEdge(A)),L.alignments?.map(A=>b.addLayoutHint({direction:A.direction,members:[...A.members]}))},"populateDb"),Ge={parser:{yy:void 0},parse:gt(async L=>{const b=await fr("architecture",L);Se.debug(b);const A=Ge.parser?.yy;if(!(A instanceof Pe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");xr(b,A)},"parse")},Ir=gt(L=>` +import{p as ke}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as gt,F as Ze,ad as qe,l as Se,b as Qe,a as Je,o as Ke,p as je,g as _e,s as tr,q as er,B as rr,z as ir,D as ar,c as me,a$ as Ee,ai as ve,i as nr,d as or,r as sr,aj as hr,b7 as lr}from"./mermaid.core-CJB1tAev.js";import{p as fr}from"./cynefin-VYW2F7L2-BIlq342y.js";import{c as Fe}from"./cytoscape.esm-OyMbaexL.js";import{g as cr}from"./_commonjsHelpers-CqkleIqs.js";import"./index-D-7nOosq.js";var se={exports:{}},he={exports:{}},le={exports:{}},gr=le.exports,Me;function ur(){return Me||(Me=1,(function(L,b){(function(G,N){L.exports=N()})(gr,function(){return(function(A){var G={};function N(v){if(G[v])return G[v].exports;var h=G[v]={i:v,l:!1,exports:{}};return A[v].call(h.exports,h,h.exports,N),h.l=!0,h.exports}return N.m=A,N.c=G,N.i=function(v){return v},N.d=function(v,h,i){N.o(v,h)||Object.defineProperty(v,h,{configurable:!1,enumerable:!0,get:i})},N.n=function(v){var h=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(h,"a",h),h},N.o=function(v,h){return Object.prototype.hasOwnProperty.call(v,h)},N.p="",N(N.s=28)})([(function(A,G,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,A.exports=v}),(function(A,G,N){var v=N(2),h=N(8),i=N(9);function r(f,e,u){v.call(this,u),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=u,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var a in v)r[a]=v[a];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var u=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(u.getOwner()==e)return u;if(u.getOwner()==t)break;u=u.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=h.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},A.exports=r}),(function(A,G,N){function v(h){this.vGraphObject=h}A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(13),r=N(0),a=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=h.MIN_VALUE,this.inclusionTreeDepth=h.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new i(s.x,s.y,o.width,o.height):this.rect=new i}e.prototype=Object.create(v.prototype);for(var u in v)e[u]=v[u];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),l=0;ls?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=e}),(function(A,G,N){var v=N(0);function h(){}for(var i in v)h[i]=v[i];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,A.exports=h}),(function(A,G,N){function v(h,i){h==null&&i==null?(this.x=0,this.y=0):(this.x=h,this.y=i)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(h){this.x=h},v.prototype.setY=function(h){this.y=h},v.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(0),r=N(7),a=N(3),f=N(1),e=N(13),u=N(12),t=N(11);function s(c,l,T){v.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,l,T){if(l==null&&T==null){var g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var d=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(d.source=l,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),l.edges.push(d),T!=l&&T.edges.push(d),d)}},s.prototype.remove=function(c){var l=c;if(c instanceof a){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),g,d=T.length,C=0;C-1&&P>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(w,1),g.target!=g.source&&g.target.edges.splice(P,1);var S=g.source.owner.getEdges().indexOf(g);if(S==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(S,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,g,d,C=this.getNodes(),S=C.length,w=0;wT&&(c=T),l>g&&(l=g)}return c==h.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?d=C[0].getParent().paddingLeft:d=this.margin,this.left=l-d,this.top=c-d,new u(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,d=-h.MAX_VALUE,C,S,w,P,B,U=this.nodes,V=U.length,M=0;MC&&(l=C),Tw&&(g=w),dC&&(l=C),Tw&&(g=w),d=this.nodes.length){var V=0;T.forEach(function(M){M.owner==c&&V++}),V==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,G,N){var v,h=N(1);function i(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var r=this.layout.newGraph(),a=this.layout.newNode(null),f=this.add(r,a);return this.setRootGraph(f),this.rootGraph},i.prototype.add=function(r,a,f,e,u){if(f==null&&e==null&&u==null){if(r==null)throw"Graph is null!";if(a==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(a.child!=null)throw"Already has a child!";return r.parent=a,a.child=r,r}else{u=f,e=a,f=r;var t=e.getOwner(),s=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,u);if(f.isInterGraph=!0,f.source=e,f.target=u,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},i.prototype.remove=function(r){if(r instanceof v){var a=r;if(a.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(a==this.rootGraph||a.parent!=null&&a.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(a.getEdges());for(var e,u=f.length,t=0;t=r.getRight()?a[0]+=Math.min(r.getX()-i.getX(),i.getRight()-r.getRight()):r.getX()<=i.getX()&&r.getRight()>=i.getRight()&&(a[0]+=Math.min(i.getX()-r.getX(),r.getRight()-i.getRight())),i.getY()<=r.getY()&&i.getBottom()>=r.getBottom()?a[1]+=Math.min(r.getY()-i.getY(),i.getBottom()-r.getBottom()):r.getY()<=i.getY()&&r.getBottom()>=i.getBottom()&&(a[1]+=Math.min(i.getY()-r.getY(),r.getBottom()-i.getBottom()));var u=Math.abs((r.getCenterY()-i.getCenterY())/(r.getCenterX()-i.getCenterX()));r.getCenterY()===i.getCenterY()&&r.getCenterX()===i.getCenterX()&&(u=1);var t=u*a[0],s=a[1]/u;a[0]t)return a[0]=f,a[1]=o,a[2]=u,a[3]=U,!1;if(eu)return a[0]=s,a[1]=e,a[2]=P,a[3]=t,!1;if(fu?(a[0]=l,a[1]=T,n=!0):(a[0]=c,a[1]=o,n=!0):p===y&&(f>u?(a[0]=s,a[1]=o,n=!0):(a[0]=g,a[1]=T,n=!0)),-m===y?u>f?(a[2]=B,a[3]=U,E=!0):(a[2]=P,a[3]=w,E=!0):m===y&&(u>f?(a[2]=S,a[3]=w,E=!0):(a[2]=V,a[3]=U,E=!0)),n&&E)return!1;if(f>u?e>t?(I=this.getCardinalDirection(p,y,4),O=this.getCardinalDirection(m,y,2)):(I=this.getCardinalDirection(-p,y,3),O=this.getCardinalDirection(-m,y,1)):e>t?(I=this.getCardinalDirection(-p,y,1),O=this.getCardinalDirection(-m,y,3)):(I=this.getCardinalDirection(p,y,2),O=this.getCardinalDirection(m,y,4)),!n)switch(I){case 1:W=o,R=f+-C/y,a[0]=R,a[1]=W;break;case 2:R=g,W=e+d*y,a[0]=R,a[1]=W;break;case 3:W=T,R=f+C/y,a[0]=R,a[1]=W;break;case 4:R=l,W=e+-d*y,a[0]=R,a[1]=W;break}if(!E)switch(O){case 1:Q=w,x=u+-_/y,a[2]=x,a[3]=Q;break;case 2:x=V,Q=t+M*y,a[2]=x,a[3]=Q;break;case 3:Q=U,x=u+_/y,a[2]=x,a[3]=Q;break;case 4:x=B,Q=t+-M*y,a[2]=x,a[3]=Q;break}}return!1},h.getCardinalDirection=function(i,r,a){return i>r?a:1+a%4},h.getIntersection=function(i,r,a,f){if(f==null)return this.getIntersection2(i,r,a);var e=i.x,u=i.y,t=r.x,s=r.y,o=a.x,c=a.y,l=f.x,T=f.y,g=void 0,d=void 0,C=void 0,S=void 0,w=void 0,P=void 0,B=void 0,U=void 0,V=void 0;return C=s-u,w=e-t,B=t*u-e*s,S=T-c,P=o-l,U=l*c-o*T,V=C*P-S*w,V===0?null:(g=(w*U-P*B)/V,d=(S*B-C*U)/V,new v(g,d))},h.angleOfVector=function(i,r,a,f){var e=void 0;return i!==a?(e=Math.atan((f-r)/(a-i)),a=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),g=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:d}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,A.exports=h}),(function(A,G,N){function v(){}v.sign=function(h){return h>0?1:h<0?-1:0},v.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},v.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},A.exports=v}),(function(A,G,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,A.exports=v}),(function(A,G,N){var v=(function(){function e(u,t){for(var s=0;s"u"?"undefined":v(i);return i==null||r!="object"&&r!="function"},A.exports=h}),(function(A,G,N){function v(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c0&&c;){for(C.push(w[0]);C.length>0&&c;){var P=C[0];C.splice(0,1),d.add(P);for(var B=P.getEdges(),g=0;g-1&&w.splice(_,1)}d=new Set,S=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(l),g=0;g=0&&c.splice(U,1);var V=S.getNeighborsList();V.forEach(function(n){if(l.indexOf(n)<0){var E=T.get(n),p=E-1;p==1&&P.push(n),T.set(n,p)}})}l=l.concat(P),(c.length==1||c.length==2)&&(g=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,G,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},A.exports=v}),(function(A,G,N){var v=N(5);function h(i,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(i){this.lworldExtX=i},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(i){this.lworldExtY=i},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},h.prototype.transformX=function(i){var r=0,a=this.lworldExtX;return a!=0&&(r=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/a),r},h.prototype.transformY=function(i){var r=0,a=this.lworldExtY;return a!=0&&(r=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/a),r},h.prototype.inverseTransformX=function(i){var r=0,a=this.ldeviceExtX;return a!=0&&(r=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/a),r},h.prototype.inverseTransformY=function(i){var r=0,a=this.ldeviceExtY;return a!=0&&(r=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/a),r},h.prototype.inverseTransformPoint=function(i){var r=new v(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return r},A.exports=h}),(function(A,G,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);si.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,g=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oC||d>C)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(C=s.getEstimatedSize()*this.compoundGravityRangeFactor,(g>C||d>C)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||C>=g[0].length)){for(var S=0;Se}}]),a})();A.exports=r}),(function(A,G,N){function v(){}v.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var i=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function Bt(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),a=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,e=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,Ct){return Tt&&Ct})(z0;){var J=void 0,It=void 0;for(J=n-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==n?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===n-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[n-2];r[n-2]=0;for(var ut=n-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),wt=this.s[ut]/Et,Ot=it/Et;this.s[ut]=Et,ut!==J&&(it=-Ot*r[ut-1],r[ut-1]=wt*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(i)?(r=i/h,r=Math.abs(h)*Math.sqrt(1+r*r)):i!=0?(r=h/i,r=Math.abs(i)*Math.sqrt(1+r*r)):r=0,r},A.exports=v}),(function(A,G,N){var v=(function(){function r(a,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,r),this.sequence1=a,this.sequence2=f,this.match_score=e,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=a.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;a--){var f=this.listeners[a];f.event===i&&f.callback===r&&this.listeners.splice(a,1)}},h.emit=function(i,r){for(var a=0;a{var G={45:((i,r,a)=>{var f={};f.layoutBase=a(551),f.CoSEConstants=a(806),f.CoSEEdge=a(767),f.CoSEGraph=a(880),f.CoSEGraphManager=a(578),f.CoSELayout=a(765),f.CoSENode=a(991),f.ConstraintHandler=a(902),i.exports=f}),806:((i,r,a)=>{var f=a(551).FDLayoutConstants;function e(){}for(var u in f)e[u]=f[u];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,i.exports=e}),767:((i,r,a)=>{var f=a(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),880:((i,r,a)=>{var f=a(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),578:((i,r,a)=>{var f=a(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),765:((i,r,a)=>{var f=a(551).FDLayout,e=a(578),u=a(880),t=a(991),s=a(767),o=a(806),c=a(902),l=a(551).FDLayoutConstants,T=a(551).LayoutConstants,g=a(551).Point,d=a(551).PointD,C=a(551).DimensionD,S=a(551).Layout,w=a(551).Integer,P=a(551).IGeometry,B=a(551).LGraph,U=a(551).Transform,V=a(551).LinkedList;function M(){f.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(f.prototype);for(var _ in f)M[_]=f[_];M.prototype.newGraphManager=function(){var n=new e(this);return this.graphManager=n,n},M.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},M.prototype.newNode=function(n){return new t(this.graphManager,n)},M.prototype.newEdge=function(n){return new s(null,null,n)},M.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return E.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var O=new Map,R=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(D){n.fixedNodesOnHorizontal.add(D),n.fixedNodesOnVertical.add(D)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*D.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=D[tt],D[tt]=D[H],D[H]=k;return D},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes(k)||(n.nodesInRelativeHorizontal.push(k),n.nodeToRelativeConstraintMapHorizontal.set(k,[]),n.dummyToNodeForVerticalAlignment.has(k)?n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(k).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:D.gap}),n.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:D.gap})}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;n.nodesInRelativeVertical.includes(tt)||(n.nodesInRelativeVertical.push(tt),n.nodeToRelativeConstraintMapVertical.set(tt,[]),n.dummyToNodeForHorizontalAlignment.has(tt)?n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(tt).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:D.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:D.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new V,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(wt){It.has(wt)||(J.push(wt),It.add(wt),tt[Nt].push(wt))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,n.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},M.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var D=n.idToNodeMap.get($.nodeId);D.displacementX=0,D.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var R;for(R=0;Rm&&(m=Math.floor(O.y)),I=Math.floor(O.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-O.x/2,T.WORLD_CENTER_Y-O.y/2))},M.radialLayout=function(n,E,p){var m=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(E,null,0,359,0,m);var y=B.calculateBounds(n),I=new U;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var O=0;O1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?D=(z.indexOf(H[0])+1)%$:D=0;for(var ht=Math.abs(m-p)/X,J=D;rt!=X;J=++J%$){var It=z[J].getOtherEnd(n);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;M.branchRadialLayout(It,n,Nt,vt,y+I,I),rt++}}},M.maxDiagonalInTree=function(n){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var n=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[R]=[]),E[R]=E[R].concat(I)}Object.keys(E).forEach(function(W){if(E[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=E[W];var Q=E[W][0].getParent(),z=new t(n.graphManager);z.id=x,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,n.idToDummyNode[x]=z;var X=n.getGraphManager().add(n.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(I+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>I?(m.rect.y-=(m.labelHeight-I)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-I)/2):m.labelPosVertical=="bottom"&&m.setHeight(I+m.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var E=this.compoundOrder[n],p=E.id,m=E.paddingLeft,y=E.paddingTop,I=E.labelMarginLeft,O=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,I,O)}},M.prototype.repopulateZeroDegreeMembers=function(){var n=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=n.idToDummyNode[p],y=m.paddingLeft,I=m.paddingTop,O=m.labelMarginLeft,R=m.labelMarginTop;n.adjustLocations(E[p],m.rect.x,m.rect.y,y,I,O,R)})},M.prototype.getToBeTiled=function(n){var E=n.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=n.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},M.prototype.getNodeDegree=function(n){n.id;for(var E=n.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+n.verticalPadding}},M.prototype.tileCompoundMembers=function(n,E){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(n[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,O=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(O+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>O?(y.rect.y-=(y.labelHeight-O)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-O)/2):y.labelPosVertical=="bottom"&&y.setHeight(O+y.labelHeight))}})},M.prototype.tileNodes=function(n,E){var p=this.tileNodesByFavoringDim(n,E,!0),m=this.tileNodesByFavoringDim(n,E,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(m),O;return IR&&(R=$.getWidth())});var W=I/y,x=O/y,Q=Math.pow(p-m,2)+4*(W+m)*(x+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return R>rt&&(rt=R),rt+=m*2,rt},M.prototype.tileNodesByFavoringDim=function(n,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,I=o.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};I&&(O.idealRowWidth=this.calcIdealRowWidth(n,p));var R=function(D){return D.rect.width*D.rect.height},W=function(D,H){return R(H)-R(D)};n.sort(function($,D){var H=W;return O.idealRowWidth?(H=I,H($.id,D.id)):H($,D)});for(var x=0,Q=0,z=0;z0&&(O+=n.horizontalPadding),n.rowWidth[p]=O,n.width0&&(R+=n.verticalPadding);var W=0;R>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=R,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(E)},M.prototype.getShortestRowIndex=function(n){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=n.rowWidth[m]);return E},M.prototype.canAddHorizontal=function(n,E,p){if(n.idealRowWidth){var m=n.rows.length-1,y=n.rowWidth[m];return y+E+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var O=n.rowWidth[I];if(O+n.horizontalPadding+E<=n.width)return!0;var R=0;n.rowHeight[I]0&&(R=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-O>=E+n.horizontalPadding?W=(n.height+R)/(O+E+n.horizontalPadding):W=(n.height+R)/n.width,R=p+n.verticalPadding;var x;return n.widthI&&E!=p){m.splice(-1,1),n.rows[p].push(y),n.rowWidth[E]=n.rowWidth[E]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=m[R].height);E>0&&(O+=n.verticalPadding);var W=n.rowHeight[E]+n.rowHeight[p];n.rowHeight[E]=O,n.rowHeight[p]0)for(var rt=y;rt<=I;rt++)X[0]+=this.grid[rt][O-1].length+this.grid[rt][O].length-1;if(I0)for(var rt=O;rt<=R;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,D,H,k=0;k{var f=a(551).FDLayoutNode,e=a(551).IMath;function u(s,o,c,l){f.call(this,s,o,c,l)}u.prototype=Object.create(f.prototype);for(var t in f)u[t]=f[t];u.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),l,T=0;T{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,g.has(st)?d[g.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,g.has(st)?C[g.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=g.has(st)?d[g.get(st)]:q.get(st):ft+=g.has(st)?C[g.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var At=function(){var ot=dt.shift(),Lt=Y.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,Bt=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw Bt}}var fe=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),ne;!(Qt=(ne=Jt.next()).done);Qt=!0){var te=ne.value;et.set(te,et.get(te)+fe)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},_=function(Y){var Z=0,K=0,q=0,at=0;if(Y.forEach(function(j){j.left?d[g.get(j.left)]-d[g.get(j.right)]>=0?Z++:K++:C[g.get(j.top)]-C[g.get(j.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var et=0;et1)l.fixedNodeConstraint.forEach(function(F,Y){m[Y]=[F.position.x,F.position.y],y[Y]=[d[g.get(F.nodeId)],C[g.get(F.nodeId)]]}),I=!0;else if(l.alignmentConstraint)(function(){var F=0;if(l.alignmentConstraint.vertical){for(var Y=l.alignmentConstraint.vertical,Z=function(et){var j=new Set;Y[et].forEach(function(pt){j.add(pt)});var dt=new Set([].concat(f(j)).filter(function(pt){return R.has(pt)})),At=void 0;dt.size>0?At=d[g.get(dt.values().next().value)]:At=V(j).x,Y[et].forEach(function(pt){m[F]=[At,C[g.get(pt)]],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},K=0;K0?At=d[g.get(dt.values().next().value)]:At=V(j).y,q[et].forEach(function(pt){m[F]=[d[g.get(pt)],At],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},ct=0;ctz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(F,Y){var Z={x:d[g.get(F.nodeId)],y:C[g.get(F.nodeId)]},K=F.position,q=U(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,d.forEach(function(F,Y){d[Y]+=mt.x}),C.forEach(function(F,Y){C[Y]+=mt.y}),l.fixedNodeConstraint.forEach(function(F){d[g.get(F.nodeId)]=F.position.x,C[g.get(F.nodeId)]=F.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(Y){var Z=new Set;Dt[Y].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return R.has(at)})),q=void 0;K.size>0?q=d[g.get(K.values().next().value)]:q=V(Z).x,Z.forEach(function(at){R.has(at)||(d[g.get(at)]=q)})},Ht=0;Ht0?q=C[g.get(K.values().next().value)]:q=V(Z).y,Z.forEach(function(at){R.has(at)||(C[g.get(at)]=q)})},Ft=0;Ft{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(45);return h})()})})(he)),he.exports}var pr=se.exports,De;function yr(){return De||(De=1,(function(L,b){(function(G,N){L.exports=N(vr())})(pr,function(A){return(()=>{var G={658:(i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var a=arguments.length,f=Array(a>1?a-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],l=!0,T=!1,g=void 0;try{for(var d=s[Symbol.iterator](),C;!(l=(C=d.next()).done)&&(c.push(C.value),!(o&&c.length===o));l=!0);}catch(S){T=!0,g=S}finally{try{!l&&d.return&&d.return()}finally{if(T)throw g}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=a(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var s={},o=0;o0&&I.merge(x)});for(var O=0;O1){C=g[0],S=C.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),B),U},u.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,C=!1,S=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),P;!(d=(P=w.next()).done);d=!0){var B=P.value,U=f(B,2),V=U[0],M=U[1],_=o.cy.getElementById(V);if(_){var n=_.boundingBox(),E=s.xCoords[M]-n.w/2,p=s.xCoords[M]+n.w/2,m=s.yCoords[M]-n.h/2,y=s.yCoords[M]+n.h/2;El&&(l=p),mg&&(g=y)}}}catch(x){C=!0,S=x}finally{try{!d&&w.return&&w.return()}finally{if(C)throw S}}var I=t.x-(l+c)/2,O=t.y-(g+T)/2;s.xCoords=s.xCoords.map(function(x){return x+I}),s.yCoords=s.yCoords.map(function(x){return x+O})}else{Object.keys(s).forEach(function(x){var Q=s[x],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zl&&(l=X),rtg&&(g=$)});var R=t.x-(l+c)/2,W=t.y-(g+T)/2;Object.keys(s).forEach(function(x){var Q=s[x];Q.setCenter(Q.getCenterX()+R,Q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,s,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,C=void 0,S=void 0,w=void 0,P=void 0,B=t.descendants().not(":parent"),U=B.length,V=0;VC&&(l=C),Tw&&(g=w),d{var f=a(548),e=a(140).CoSELayout,u=a(140).CoSENode,t=a(140).layoutBase.PointD,s=a(140).layoutBase.DimensionD,o=a(140).layoutBase.LayoutConstants,c=a(140).layoutBase.FDLayoutConstants,l=a(140).CoSEConstants,T=function(d,C){var S=d.cy,w=d.eles,P=w.nodes(),B=w.edges(),U=void 0,V=void 0,M=void 0,_={};d.randomize&&(U=C.nodeIndexes,V=C.xCoords,M=C.yCoords);var n=function(x){return typeof x=="function"},E=function(x,Q){return n(x)?x(Q):x},p=f.calcParentsWithoutChildren(S,w),m=function W(x,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(x,Q,z){for(var X=0,rt=0,$=0;$0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:n(d.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,Q){Q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(x.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,l.TILE=d.tile,l.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),d.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),d.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new e,R=O.newGraphManager();return m(R.addRoot(),f.getTopMostNodes(P),O,d),y(O,R,B),I(O,d),O.runLayout(),_};i.exports={coseLayout:T}}),212:((i,r,a)=>{var f=(function(){function d(C,S){for(var w=0;w0)if(p){var I=t.getTopMostNodes(w.eles.nodes());if(M=t.connectComponents(P,w.eles,I),M.forEach(function(vt){var it=vt.boundingBox();_.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&M.forEach(function(vt){w.eles=vt,U.push(o(w))}),w.quality=="default"||w.quality=="proof"){var O=P.collection();if(w.tile){var R=new Map,W=[],x=[],Q=0,z={nodeIndexes:R,xCoords:W,yCoords:x},X=[];if(M.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){O.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),O.length>1){var rt=O.boundingBox();_.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),M.push(O),U.push(z);for(var $=X.length-1;$>=0;$--)M.splice(X[$],1),U.splice(X[$],1),_.splice(X[$],1)}}M.forEach(function(vt,it){w.eles=vt,V.push(l(w,U[it])),t.relocateComponent(_[it],V[it],w)})}else M.forEach(function(vt,it){t.relocateComponent(_[it],U[it],w)});var D=new Set;if(M.length>1){var H=[],k=B.filter(function(vt){return vt.css("display")=="none"});M.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=U[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var wt=void 0;vt.nodes().not(k).forEach(function(Ot){if(w.quality=="draft")if(!Ot.isParent())wt=ut.get(Ot.id()),Et.nodes.push({x:U[it].xCoords[wt]-Ot.boundingbox().w/2,y:U[it].yCoords[wt]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var mt=t.calcBoundingBox(Ot,U[it].xCoords,U[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else V[it][Ot.id()]&&Et.nodes.push({x:V[it][Ot.id()].getLeft(),y:V[it][Ot.id()].getTop(),width:V[it][Ot.id()].getWidth(),height:V[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var mt=Ot.source(),Dt=Ot.target();if(mt.css("display")!="none"&&Dt.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Dt.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,U[it].xCoords,U[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[it].xCoords[Rt]),Ut.push(U[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[it].xCoords,U[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[it].xCoords[Ht]),Pt.push(U[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else V[it][mt.id()]&&V[it][Dt.id()]&&Et.edges.push({startX:V[it][mt.id()].getCenterX(),startY:V[it][mt.id()].getCenterY(),endX:V[it][Dt.id()].getCenterX(),endY:V[it][Dt.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),D.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")U.forEach(function(vt,it){var ut=vt.xCoords.map(function(wt){return wt+tt[it].dx}),Et=vt.yCoords.map(function(wt){return wt+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;D.forEach(function(vt){Object.keys(V[vt]).forEach(function(it){var ut=V[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(_.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);U.push(y)}w.quality=="default"||w.quality=="proof"?(V.push(l(w,U[0])),t.relocateComponent(_[0],V[0],w)):t.relocateComponent(_[0],U[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,wt=void 0,Ot=it.data("id");return V.forEach(function(Dt){Ot in Dt&&(Et={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},wt=Dt[Ot])}),w.nodeDimensionsIncludeLabels&&(wt.labelWidth&&(wt.labelPosHorizontal=="left"?Et.x+=wt.labelWidth/2:wt.labelPosHorizontal=="right"&&(Et.x-=wt.labelWidth/2)),wt.labelHeight&&(wt.labelPosVertical=="top"?Et.y+=wt.labelHeight/2:wt.labelPosVertical=="bottom"&&(Et.y-=wt.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(P,B),Nt=B.filter(function(vt){return vt.css("display")=="none"});w.eles=B.not(Nt),B.nodes().not(":parent").not(Nt).layoutPositions(S,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();i.exports=g}),657:((i,r,a)=>{var f=a(548),e=a(140).layoutBase.Matrix,u=a(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),g=l.nodes(":parent"),d=new Map,C=new Map,S=new Map,w=[],P=[],B=[],U=[],V=[],M=[],_=[],n=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,I=o.samplingType,O=o.nodeSeparation,R=void 0,W=function(){for(var Y=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=V[Lt],At=Lt)}return At},Q=function(Y){var Z=void 0;if(Y){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;j=et}for(var pt=0;pt=1)break;j=et}for(var lt=0;lt0&&(Z.isParent()?w[Y].push(S.get(Z.id())):w[Y].push(Z.id()))})});var Nt=function(Y){var Z=C.get(Y),K=void 0;d.get(Y).forEach(function(q){c.getElementById(q).isParent()?K=S.get(q):K=q,w[Z].push(K),w[C.get(K)].push(Y)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),wt;!(vt=(wt=Et.next()).done);vt=!0){var Ot=wt.value;Nt(Ot)}}catch(F){it=!0,ut=F}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=C.size;var mt=void 0;if(E>2){R=E{var f=a(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),i.exports=e}),140:(i=>{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(579);return h})()})})(se)),se.exports}var mr=yr();const Er=cr(mr);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:gt(L=>`${L},${L/2} 0,${L} 0,0`,"L"),R:gt(L=>`0,${L/2} ${L},0 ${L},${L}`,"R"),T:gt(L=>`0,0 ${L},0 ${L/2},${L}`,"T"),B:gt(L=>`${L/2},0 ${L},${L} 0,${L}`,"B")},oe={L:gt((L,b)=>L-b+2,"L"),R:gt((L,b)=>L-2,"R"),T:gt((L,b)=>L-b+2,"T"),B:gt((L,b)=>L-2,"B")},Tr=gt(function(L){return Wt(L)?L==="L"?"R":"L":L==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=gt(function(L){const b=L;return b==="L"||b==="R"||b==="T"||b==="B"},"isArchitectureDirection"),Wt=gt(function(L){const b=L;return b==="L"||b==="R"},"isArchitectureDirectionX"),qt=gt(function(L){const b=L;return b==="T"||b==="B"},"isArchitectureDirectionY"),Te=gt(function(L,b){const A=Wt(L)&&qt(b),G=qt(L)&&Wt(b);return A||G},"isArchitectureDirectionXY"),Nr=gt(function(L){const b=L[0],A=L[1],G=Wt(b)&&qt(A),N=qt(b)&&Wt(A);return G||N},"isArchitecturePairXY"),Lr=gt(function(L){return L!=="LL"&&L!=="RR"&&L!=="TT"&&L!=="BB"},"isValidArchitectureDirectionPair"),pe=gt(function(L,b){const A=`${L}${b}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=gt(function([L,b],A){const G=A[0],N=A[1];return Wt(G)?qt(N)?[L+(G==="L"?-1:1),b+(N==="T"?1:-1)]:[L+(G==="L"?-1:1),b]:Wt(N)?[L+(N==="L"?1:-1),b+(G==="T"?1:-1)]:[L,b+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),wr=gt(function(L){return L==="LT"||L==="TL"?[1,1]:L==="BL"||L==="LB"?[1,-1]:L==="BR"||L==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Ar=gt(function(L,b){return Te(L,b)?"bend":Wt(L)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=gt(function(L){return L.type==="service"},"isArchitectureService"),Or=gt(function(L){return L.type==="junction"},"isArchitectureJunction"),be=gt(L=>L.data(),"edgeData"),ie=gt(L=>L.data(),"nodeData"),Dr=ar.architecture,Pe=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Qe,this.getAccTitle=Je,this.setDiagramTitle=Ke,this.getDiagramTitle=je,this.getAccDescription=_e,this.setAccDescription=tr,this.clear()}static{gt(this,"ArchitectureDB")}setDiagramId(L){this.diagramId=L}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",er()}addService({id:L,icon:b,in:A,title:G,iconText:N}){if(this.registeredIds[L]!==void 0)throw new Error(`The service id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The service [${L}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The service [${L}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[A]==="node")throw new Error(`The service [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"service",icon:b,iconText:N,title:G,edges:[],in:A}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:L,in:b}){if(this.registeredIds[L]!==void 0)throw new Error(`The junction id [${L}] is already in use by another ${this.registeredIds[L]}`);if(b!==void 0){if(L===b)throw new Error(`The junction [${L}] cannot be placed within itself`);if(this.registeredIds[b]===void 0)throw new Error(`The junction [${L}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[b]==="node")throw new Error(`The junction [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"junction",edges:[],in:b}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(L){return this.nodes[L]??null}addGroup({id:L,icon:b,in:A,title:G}){if(this.registeredIds?.[L]!==void 0)throw new Error(`The group id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The group [${L}] cannot be placed within itself`);if(this.registeredIds?.[A]===void 0)throw new Error(`The group [${L}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[A]==="node")throw new Error(`The group [${L}]'s parent is not a group`)}this.registeredIds[L]="group",this.groups[L]={id:L,icon:b,title:G,in:A}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:L,rhsId:b,lhsDir:A,rhsDir:G,lhsInto:N,rhsInto:v,lhsGroup:h,rhsGroup:i,title:r}){if(!Re(A))throw new Error(`Invalid direction given for left hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(A)}`);if(!Re(G))throw new Error(`Invalid direction given for right hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(G)}`);if(this.nodes[L]===void 0&&this.groups[L]===void 0)throw new Error(`The left-hand id [${L}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[b]===void 0&&this.groups[b]===void 0)throw new Error(`The right-hand id [${b}] does not yet exist. Please create the service/group before declaring an edge to it.`);const a=this.nodes[L].in,f=this.nodes[b].in;if(h&&a&&f&&a==f)throw new Error(`The left-hand id [${L}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(i&&a&&f&&a==f)throw new Error(`The right-hand id [${b}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const e={lhsId:L,lhsDir:A,lhsInto:N,lhsGroup:h,rhsId:b,rhsDir:G,rhsInto:v,rhsGroup:i,title:r};this.edges.push(e),this.nodes[L]&&this.nodes[b]&&(this.nodes[L].edges.push(this.edges[this.edges.length-1]),this.nodes[b].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(L){if(L.members.length<2)throw new Error(`An align directive requires at least two members; got ${L.members.length}`);const b=new Set;L.members.forEach(A=>{if(this.registeredIds[A]!=="node")throw new Error(`align ${L.direction} references [${A}], which is not a service or junction`);if(b.has(A))throw new Error(`align ${L.direction} lists [${A}] more than once`);b.add(A)}),this.layoutHints.push(L)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const L={},b=Object.entries(this.nodes).reduce((i,[r,a])=>(i[r]=a.edges.reduce((f,e)=>{const u=this.getNode(e.lhsId)?.in,t=this.getNode(e.rhsId)?.in;if(u&&t&&u!==t){const s=Ar(e.lhsDir,e.rhsDir);s!=="bend"&&(L[u]??={},L[u][t]=s,L[t]??={},L[t][u]=s)}if(e.lhsId===r){const s=pe(e.lhsDir,e.rhsDir);s&&(f[s]=e.rhsId)}else{const s=pe(e.rhsDir,e.lhsDir);s&&(f[s]=e.lhsId)}return f},{}),i),{}),A=Object.keys(b)[0],G={[A]:1},N=Object.keys(b).reduce((i,r)=>r===A?i:{...i,[r]:1},{}),v=gt(i=>{const r={[i]:[0,0]},a=[i];for(;a.length>0;){const f=a.shift();if(f){G[f]=1,delete N[f];const e=b[f],[u,t]=r[f];Object.entries(e).forEach(([s,o])=>{G[o]||(r[o]=Cr([u,t],s),a.push(o))})}}return r},"BFS"),h=[v(A)];for(;Object.keys(N).length>0;)h.push(v(Object.keys(N)[0]));this.dataStructures={adjList:b,spatialMaps:h,groupAlignments:L}}return this.dataStructures}setElementForId(L,b){this.elements[L]=b}getElementById(L){return this.elements[L]}getConfig(){return rr({...Dr,...ir().architecture})}getConfigField(L){return this.getConfig()[L]}},xr=gt((L,b)=>{ke(L,b),L.groups.map(A=>b.addGroup(A)),L.services.map(A=>b.addService({...A,type:"service"})),L.junctions.map(A=>b.addJunction({...A,type:"junction"})),L.edges.map(A=>b.addEdge(A)),L.alignments?.map(A=>b.addLayoutHint({direction:A.direction,members:[...A.members]}))},"populateDb"),Ge={parser:{yy:void 0},parse:gt(async L=>{const b=await fr("architecture",L);Se.debug(b);const A=Ge.parser?.yy;if(!(A instanceof Pe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");xr(b,A)},"parse")},Ir=gt(L=>` .edge { stroke-width: ${L.archEdgeWidth}; stroke: ${L.archEdgeColor}; diff --git a/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CpvS2-LC.js b/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js similarity index 99% rename from apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CpvS2-LC.js rename to apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js index 76eb15c0b34..6e3062b7898 100644 --- a/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CpvS2-LC.js +++ b/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js @@ -1,4 +1,4 @@ -import{g as de}from"./chunk-5VM5RSS4-CfD0Yt-O.js";import{aA as pe,aB as Kt,aC as fe,aD as xe,aE as ye,aF as be,aG as we,aH as me,aI as Se,aJ as Le,aK as ke,aL as ve,aM as Ee,aN as _e,aO as Te,aP as De,aQ as Be,aR as Ne,aS as Ie,aT as Ce,aU as Oe,aV as Re,aW as Ae,aX as ze,aY as Me,_ as g,z as rt,d as D,e as Pe,l as k,q as Fe,t as We,c as R,aZ as Ye,a7 as He,a8 as Ke,a3 as Ue,a_ as M,a$ as kt,b0 as Q,as as Xe,y as $,k as Ve,b1 as je,i as Ct,b2 as Ot,b3 as Ge}from"./mermaid.core-Cahi9cr1.js";import{G as Ze}from"./graph-DOmOIIwC.js";import{c as qe}from"./channel-Bob_1R_C.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";function Je(e){return Array.isArray(e)}function Qe(e){if(pe(e))return e;const t=Kt(e);if(!$e(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(fe(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?er(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return rr(a,e),xt(a,e),tr(a,e),a}function $e(e){switch(Kt(e)){case Me:case ze:case Ae:case Re:case Oe:case Ce:case Ie:case Ne:case Be:case De:case Te:case _e:case Ee:case ve:case ke:case Le:case Se:case me:case we:case be:case ye:case xe:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function tr(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s=a)&&(e[s]=t[s])}function rr(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var bt=(function(){var e=g(function(T,m,p,x){for(p=p||{},x=T.length;x--;p[T[x]]=m);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],d=[1,23],b=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],S={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(m,p,x,L,E,o,F){var f=o.length-1;switch(E){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",o[f-1]),L.setHierarchy(o[f-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",o[f]),typeof o[f].length=="number"?this.$=o[f]:this.$=[o[f]];break;case 13:L.getLogger().debug("Rule: statement #2: ",o[f-1]),this.$=[o[f-1]].concat(o[f]);break;case 14:L.getLogger().debug("Rule: link: ",o[f],m),this.$={edgeTypeStr:o[f],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",o[f-3],o[f-1],o[f]),this.$={edgeTypeStr:o[f],label:o[f-1]};break;case 18:const C=parseInt(o[f]),Z=L.generateId();this.$={id:Z,type:"space",label:"",width:C,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",o[f-2],o[f-1],o[f]," typestr: ",o[f-1].edgeTypeStr);const V=L.edgeStrToEdgeData(o[f-1].edgeTypeStr),at=L.edgeStrToEdgeStartData(o[f-1].edgeTypeStr),gt=L.edgeStrToThickness(o[f-1].edgeTypeStr),O=L.edgeStrToPattern(o[f-1].edgeTypeStr);this.$=[{id:o[f-2].id,label:o[f-2].label,type:o[f-2].type,directions:o[f-2].directions},{id:o[f-2].id+"-"+o[f].id,start:o[f-2].id,end:o[f].id,label:o[f-1].label,type:"edge",thickness:gt,pattern:O,directions:o[f].directions,arrowTypeEnd:V,arrowTypeStart:at},{id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[f-1],o[f]),this.$={id:o[f-1].id,label:o[f-1].label,type:L.typeStr2Type(o[f-1].typeStr),directions:o[f-1].directions,widthInColumns:parseInt(o[f],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",o[f]),this.$={id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",o[f]),this.$={type:"column-setting",columns:o[f]==="auto"?-1:parseInt(o[f])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",o[f-2],o[f-1]),L.generateId(),this.$={...o[f-2],type:"composite",children:o[f-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",o[f-2],o[f-1],o[f]);const j=L.generateId();this.$={id:j,type:"composite",label:"",children:o[f-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",o[f]),this.$={id:o[f]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[f-1],o[f]),this.$={id:o[f-1],label:o[f].label,typeStr:o[f].typeStr,directions:o[f].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",o[f]),this.$=[o[f]];break;case 32:L.getLogger().debug("Rule: dirList: ",o[f-1],o[f]),this.$=[o[f-1]].concat(o[f]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",o[f-2],o[f-1],o[f]),this.$={typeStr:o[f-2]+o[f],label:o[f-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[f-3],o[f-2]," #3:",o[f-1],o[f]),this.$={typeStr:o[f-3]+o[f],label:o[f-2],directions:o[f-1]};break;case 35:case 36:this.$={type:"classDef",id:o[f-1].trim(),css:o[f].trim()};break;case 37:this.$={type:"applyClass",id:o[f-1].trim(),styleClass:o[f].trim()};break;case 38:this.$={type:"applyStyles",id:o[f-1].trim(),stylesStr:o[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(h,[2,16],{14:22,15:d,16:b}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(w,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:t,11:37,13:4,14:22,15:d,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(h,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(m,p){if(p.recoverable)this.trace(m);else{var x=new Error(m);throw x.hash=p,x}},"parseError"),parse:g(function(m){var p=this,x=[0],L=[],E=[null],o=[],F=this.table,f="",C=0,Z=0,V=2,at=1,gt=o.slice.call(arguments,1),O=Object.create(this.lexer),j={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(j.yy[ut]=this.yy[ut]);O.setInput(m,j.yy),j.yy.lexer=O,j.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var dt=O.yylloc;o.push(dt);var ge=O.options&&O.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ue(W){x.length=x.length-2*W,E.length=E.length-W,o.length=o.length-W}g(ue,"popStack");function Nt(){var W;return W=L.pop()||O.lex()||at,typeof W!="number"&&(W instanceof Array&&(L=W,W=L.pop()),W=p.symbols_[W]||W),W}g(Nt,"lex");for(var P,q,H,pt,J={},st,G,It,it;;){if(q=x[x.length-1],this.defaultActions[q]?H=this.defaultActions[q]:((P===null||typeof P>"u")&&(P=Nt()),H=F[q]&&F[q][P]),typeof H>"u"||!H.length||!H[0]){var ft="";it=[];for(st in F[q])this.terminals_[st]&&st>V&&it.push("'"+this.terminals_[st]+"'");O.showPosition?ft="Parse error on line "+(C+1)+`: +import{g as de}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{aA as pe,aB as Kt,aC as fe,aD as xe,aE as ye,aF as be,aG as we,aH as me,aI as Se,aJ as Le,aK as ke,aL as ve,aM as Ee,aN as _e,aO as Te,aP as De,aQ as Be,aR as Ne,aS as Ie,aT as Ce,aU as Oe,aV as Re,aW as Ae,aX as ze,aY as Me,_ as g,z as rt,d as D,e as Pe,l as k,q as Fe,t as We,c as R,aZ as Ye,a7 as He,a8 as Ke,a3 as Ue,a_ as M,a$ as kt,b0 as Q,as as Xe,y as $,k as Ve,b1 as je,i as Ct,b2 as Ot,b3 as Ge}from"./mermaid.core-CJB1tAev.js";import{G as Ze}from"./graph-DOmOIIwC.js";import{c as qe}from"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";function Je(e){return Array.isArray(e)}function Qe(e){if(pe(e))return e;const t=Kt(e);if(!$e(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(fe(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?er(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return rr(a,e),xt(a,e),tr(a,e),a}function $e(e){switch(Kt(e)){case Me:case ze:case Ae:case Re:case Oe:case Ce:case Ie:case Ne:case Be:case De:case Te:case _e:case Ee:case ve:case ke:case Le:case Se:case me:case we:case be:case ye:case xe:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function tr(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s=a)&&(e[s]=t[s])}function rr(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var bt=(function(){var e=g(function(T,m,p,x){for(p=p||{},x=T.length;x--;p[T[x]]=m);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],d=[1,23],b=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],S={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(m,p,x,L,E,o,F){var f=o.length-1;switch(E){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",o[f-1]),L.setHierarchy(o[f-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",o[f]),typeof o[f].length=="number"?this.$=o[f]:this.$=[o[f]];break;case 13:L.getLogger().debug("Rule: statement #2: ",o[f-1]),this.$=[o[f-1]].concat(o[f]);break;case 14:L.getLogger().debug("Rule: link: ",o[f],m),this.$={edgeTypeStr:o[f],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",o[f-3],o[f-1],o[f]),this.$={edgeTypeStr:o[f],label:o[f-1]};break;case 18:const C=parseInt(o[f]),Z=L.generateId();this.$={id:Z,type:"space",label:"",width:C,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",o[f-2],o[f-1],o[f]," typestr: ",o[f-1].edgeTypeStr);const V=L.edgeStrToEdgeData(o[f-1].edgeTypeStr),at=L.edgeStrToEdgeStartData(o[f-1].edgeTypeStr),gt=L.edgeStrToThickness(o[f-1].edgeTypeStr),O=L.edgeStrToPattern(o[f-1].edgeTypeStr);this.$=[{id:o[f-2].id,label:o[f-2].label,type:o[f-2].type,directions:o[f-2].directions},{id:o[f-2].id+"-"+o[f].id,start:o[f-2].id,end:o[f].id,label:o[f-1].label,type:"edge",thickness:gt,pattern:O,directions:o[f].directions,arrowTypeEnd:V,arrowTypeStart:at},{id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[f-1],o[f]),this.$={id:o[f-1].id,label:o[f-1].label,type:L.typeStr2Type(o[f-1].typeStr),directions:o[f-1].directions,widthInColumns:parseInt(o[f],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",o[f]),this.$={id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",o[f]),this.$={type:"column-setting",columns:o[f]==="auto"?-1:parseInt(o[f])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",o[f-2],o[f-1]),L.generateId(),this.$={...o[f-2],type:"composite",children:o[f-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",o[f-2],o[f-1],o[f]);const j=L.generateId();this.$={id:j,type:"composite",label:"",children:o[f-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",o[f]),this.$={id:o[f]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[f-1],o[f]),this.$={id:o[f-1],label:o[f].label,typeStr:o[f].typeStr,directions:o[f].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",o[f]),this.$=[o[f]];break;case 32:L.getLogger().debug("Rule: dirList: ",o[f-1],o[f]),this.$=[o[f-1]].concat(o[f]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",o[f-2],o[f-1],o[f]),this.$={typeStr:o[f-2]+o[f],label:o[f-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[f-3],o[f-2]," #3:",o[f-1],o[f]),this.$={typeStr:o[f-3]+o[f],label:o[f-2],directions:o[f-1]};break;case 35:case 36:this.$={type:"classDef",id:o[f-1].trim(),css:o[f].trim()};break;case 37:this.$={type:"applyClass",id:o[f-1].trim(),styleClass:o[f].trim()};break;case 38:this.$={type:"applyStyles",id:o[f-1].trim(),stylesStr:o[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(h,[2,16],{14:22,15:d,16:b}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(w,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:t,11:37,13:4,14:22,15:d,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(h,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(m,p){if(p.recoverable)this.trace(m);else{var x=new Error(m);throw x.hash=p,x}},"parseError"),parse:g(function(m){var p=this,x=[0],L=[],E=[null],o=[],F=this.table,f="",C=0,Z=0,V=2,at=1,gt=o.slice.call(arguments,1),O=Object.create(this.lexer),j={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(j.yy[ut]=this.yy[ut]);O.setInput(m,j.yy),j.yy.lexer=O,j.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var dt=O.yylloc;o.push(dt);var ge=O.options&&O.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ue(W){x.length=x.length-2*W,E.length=E.length-W,o.length=o.length-W}g(ue,"popStack");function Nt(){var W;return W=L.pop()||O.lex()||at,typeof W!="number"&&(W instanceof Array&&(L=W,W=L.pop()),W=p.symbols_[W]||W),W}g(Nt,"lex");for(var P,q,H,pt,J={},st,G,It,it;;){if(q=x[x.length-1],this.defaultActions[q]?H=this.defaultActions[q]:((P===null||typeof P>"u")&&(P=Nt()),H=F[q]&&F[q][P]),typeof H>"u"||!H.length||!H[0]){var ft="";it=[];for(st in F[q])this.terminals_[st]&&st>V&&it.push("'"+this.terminals_[st]+"'");O.showPosition?ft="Parse error on line "+(C+1)+`: `+O.showPosition()+` Expecting `+it.join(", ")+", got '"+(this.terminals_[P]||P)+"'":ft="Parse error on line "+(C+1)+": Unexpected "+(P==at?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(ft,{text:O.match,token:this.terminals_[P]||P,line:O.yylineno,loc:dt,expected:it})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+P);switch(H[0]){case 1:x.push(P),E.push(O.yytext),o.push(O.yylloc),x.push(H[1]),P=null,Z=O.yyleng,f=O.yytext,C=O.yylineno,dt=O.yylloc;break;case 2:if(G=this.productions_[H[1]][1],J.$=E[E.length-G],J._$={first_line:o[o.length-(G||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(G||1)].first_column,last_column:o[o.length-1].last_column},ge&&(J._$.range=[o[o.length-(G||1)].range[0],o[o.length-1].range[1]]),pt=this.performAction.apply(J,[f,Z,C,j.yy,H[1],E,o].concat(gt)),typeof pt<"u")return pt;G&&(x=x.slice(0,-1*G*2),E=E.slice(0,-1*G),o=o.slice(0,-1*G)),x.push(this.productions_[H[1]][0]),E.push(J.$),o.push(J._$),It=F[x[x.length-2]][x[x.length-1]],x.push(It);break;case 3:return!0}}return!0},"parse")},N=(function(){var T={EOF:1,parseError:g(function(p,x){if(this.yy.parser)this.yy.parser.parseError(p,x);else throw new Error(p)},"parseError"),setInput:g(function(m,p){return this.yy=p||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var p=m.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:g(function(m){var p=m.length,x=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var L=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===L.length?this.yylloc.first_column:0)+L[L.length-x.length].length-x[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(m){this.unput(this.match.slice(m))},"less"),pastInput:g(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var m=this.pastInput(),p=new Array(m.length+1).join("-");return m+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-BvJQmgsI.js b/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js similarity index 99% rename from apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-BvJQmgsI.js rename to apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js index 1603c8fa7f7..c44d1d79294 100644 --- a/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-BvJQmgsI.js +++ b/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js @@ -1,4 +1,4 @@ -import{g as Oe,d as Re}from"./chunk-32BRIVSS-DAsxL712.js";import{s as Se,g as De,a as Pe,b as Be,_ as y,c as Dt,d as Nt,l as he,e as Ie,f as Me,h as Tt,i as pe,j as Le,w as Ne,k as Jt,m as ue}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var jt=(function(){var e=y(function(_t,x,v,E){for(v=v||{},E=_t.length;E--;v[_t[E]]=x);return v},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],r=[1,28],a=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],p=[1,68],g=[1,69],m=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],st=[1,47],rt=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Xt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],A=[1,82],k=[1,83],C=[1,84],w=[1,85],T=[12,14,42],se=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],vt=[12,33],Wt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:y(function(x,v,E,b,R,h,Rt){var f=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[f-3]);break;case 19:b.setTitle(h[f].substring(6)),this.$=h[f].substring(6);break;case 20:b.setAccDescription(h[f].substring(15)),this.$=h[f].substring(15);break;case 21:this.$=h[f].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[f].trim(),b.setAccDescription(this.$);break;case 28:h[f].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 29:h[f].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 30:b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 31:h[f].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[f]),this.$=h[f];break;case 32:b.addDeploymentNode("node",...h[f]),this.$=h[f];break;case 33:b.addDeploymentNode("nodeL",...h[f]),this.$=h[f];break;case 34:b.addDeploymentNode("nodeR",...h[f]),this.$=h[f];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[f]),this.$=h[f];break;case 40:b.addPersonOrSystem("external_person",...h[f]),this.$=h[f];break;case 41:b.addPersonOrSystem("system",...h[f]),this.$=h[f];break;case 42:b.addPersonOrSystem("system_db",...h[f]),this.$=h[f];break;case 43:b.addPersonOrSystem("system_queue",...h[f]),this.$=h[f];break;case 44:b.addPersonOrSystem("external_system",...h[f]),this.$=h[f];break;case 45:b.addPersonOrSystem("external_system_db",...h[f]),this.$=h[f];break;case 46:b.addPersonOrSystem("external_system_queue",...h[f]),this.$=h[f];break;case 47:b.addContainer("container",...h[f]),this.$=h[f];break;case 48:b.addContainer("container_db",...h[f]),this.$=h[f];break;case 49:b.addContainer("container_queue",...h[f]),this.$=h[f];break;case 50:b.addContainer("external_container",...h[f]),this.$=h[f];break;case 51:b.addContainer("external_container_db",...h[f]),this.$=h[f];break;case 52:b.addContainer("external_container_queue",...h[f]),this.$=h[f];break;case 53:b.addComponent("component",...h[f]),this.$=h[f];break;case 54:b.addComponent("component_db",...h[f]),this.$=h[f];break;case 55:b.addComponent("component_queue",...h[f]),this.$=h[f];break;case 56:b.addComponent("external_component",...h[f]),this.$=h[f];break;case 57:b.addComponent("external_component_db",...h[f]),this.$=h[f];break;case 58:b.addComponent("external_component_queue",...h[f]),this.$=h[f];break;case 60:b.addRel("rel",...h[f]),this.$=h[f];break;case 61:b.addRel("birel",...h[f]),this.$=h[f];break;case 62:b.addRel("rel_u",...h[f]),this.$=h[f];break;case 63:b.addRel("rel_d",...h[f]),this.$=h[f];break;case 64:b.addRel("rel_l",...h[f]),this.$=h[f];break;case 65:b.addRel("rel_r",...h[f]),this.$=h[f];break;case 66:b.addRel("rel_b",...h[f]),this.$=h[f];break;case 67:h[f].splice(0,1),b.addRel("rel",...h[f]),this.$=h[f];break;case 68:b.updateElStyle("update_el_style",...h[f]),this.$=h[f];break;case 69:b.updateRelStyle("update_rel_style",...h[f]),this.$=h[f];break;case 70:b.updateLayoutConfig("update_layout_config",...h[f]),this.$=h[f];break;case 71:this.$=[h[f]];break;case 72:h[f].unshift(h[f-1]),this.$=h[f];break;case 73:case 75:this.$=h[f].trim();break;case 74:let Et={};Et[h[f-1].trim()]=h[f].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ct,[2,14]),e(Xt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(Ot,[2,19]),e(Ot,[2,20]),{25:[1,78]},{27:[1,79]},e(Ot,[2,23]),{35:80,75:81,76:A,77:k,79:C,80:w},{35:86,75:81,76:A,77:k,79:C,80:w},{35:87,75:81,76:A,77:k,79:C,80:w},{35:88,75:81,76:A,77:k,79:C,80:w},{35:89,75:81,76:A,77:k,79:C,80:w},{35:90,75:81,76:A,77:k,79:C,80:w},{35:91,75:81,76:A,77:k,79:C,80:w},{35:92,75:81,76:A,77:k,79:C,80:w},{35:93,75:81,76:A,77:k,79:C,80:w},{35:94,75:81,76:A,77:k,79:C,80:w},{35:95,75:81,76:A,77:k,79:C,80:w},{35:96,75:81,76:A,77:k,79:C,80:w},{35:97,75:81,76:A,77:k,79:C,80:w},{35:98,75:81,76:A,77:k,79:C,80:w},{35:99,75:81,76:A,77:k,79:C,80:w},{35:100,75:81,76:A,77:k,79:C,80:w},{35:101,75:81,76:A,77:k,79:C,80:w},{35:102,75:81,76:A,77:k,79:C,80:w},{35:103,75:81,76:A,77:k,79:C,80:w},{35:104,75:81,76:A,77:k,79:C,80:w},e(T,[2,59]),{35:105,75:81,76:A,77:k,79:C,80:w},{35:106,75:81,76:A,77:k,79:C,80:w},{35:107,75:81,76:A,77:k,79:C,80:w},{35:108,75:81,76:A,77:k,79:C,80:w},{35:109,75:81,76:A,77:k,79:C,80:w},{35:110,75:81,76:A,77:k,79:C,80:w},{35:111,75:81,76:A,77:k,79:C,80:w},{35:112,75:81,76:A,77:k,79:C,80:w},{35:113,75:81,76:A,77:k,79:C,80:w},{35:114,75:81,76:A,77:k,79:C,80:w},{35:115,75:81,76:A,77:k,79:C,80:w},{20:116,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:A,77:k,79:C,80:w},{35:120,75:81,76:A,77:k,79:C,80:w},{35:121,75:81,76:A,77:k,79:C,80:w},{35:122,75:81,76:A,77:k,79:C,80:w},{35:123,75:81,76:A,77:k,79:C,80:w},{35:124,75:81,76:A,77:k,79:C,80:w},{35:125,75:81,76:A,77:k,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Xt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:r}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:r,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ot,[2,21]),e(Ot,[2,22]),e(T,[2,39]),e(se,[2,71],{75:81,35:132,76:A,77:k,79:C,80:w}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(T,[2,40]),e(T,[2,41]),e(T,[2,42]),e(T,[2,43]),e(T,[2,44]),e(T,[2,45]),e(T,[2,46]),e(T,[2,47]),e(T,[2,48]),e(T,[2,49]),e(T,[2,50]),e(T,[2,51]),e(T,[2,52]),e(T,[2,53]),e(T,[2,54]),e(T,[2,55]),e(T,[2,56]),e(T,[2,57]),e(T,[2,58]),e(T,[2,60]),e(T,[2,61]),e(T,[2,62]),e(T,[2,63]),e(T,[2,64]),e(T,[2,65]),e(T,[2,66]),e(T,[2,67]),e(T,[2,68]),e(T,[2,69]),e(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(vt,[2,28]),e(vt,[2,29]),e(vt,[2,30]),e(vt,[2,31]),e(vt,[2,32]),e(vt,[2,33]),e(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Xt,[2,18]),e(Ct,[2,38]),e(se,[2,72]),e(Bt,[2,74]),e(T,[2,24]),e(T,[2,35]),e(Wt,[2,25]),e(Wt,[2,26],{12:[1,138]}),e(Wt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:y(function(x,v){if(v.recoverable)this.trace(x);else{var E=new Error(x);throw E.hash=v,E}},"parseError"),parse:y(function(x){var v=this,E=[0],b=[],R=[null],h=[],Rt=this.table,f="",Et=0,re=0,ke=2,le=1,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),At={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(At.yy[Ht]=this.yy[Ht]);D.setInput(x,At.yy),At.yy.lexer=D,At.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;typeof At.yy.parseError=="function"?this.parseError=At.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(L){E.length=E.length-2*L,R.length=R.length-L,h.length=h.length-L}y(Te,"popStack");function oe(){var L;return L=b.pop()||D.lex()||le,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=v.symbols_[L]||L),L}y(oe,"lex");for(var I,kt,N,Gt,wt={},Mt,W,ce,Lt;;){if(kt=E[E.length-1],this.defaultActions[kt]?N=this.defaultActions[kt]:((I===null||typeof I>"u")&&(I=oe()),N=Rt[kt]&&Rt[kt][I]),typeof N>"u"||!N.length||!N[0]){var Kt="";Lt=[];for(Mt in Rt[kt])this.terminals_[Mt]&&Mt>ke&&Lt.push("'"+this.terminals_[Mt]+"'");D.showPosition?Kt="Parse error on line "+(Et+1)+`: +import{g as Oe,d as Re}from"./chunk-32BRIVSS-DUDRPqmY.js";import{s as Se,g as De,a as Pe,b as Be,_ as y,c as Dt,d as Nt,l as he,e as Ie,f as Me,h as Tt,i as pe,j as Le,w as Ne,k as Jt,m as ue}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var jt=(function(){var e=y(function(_t,x,v,E){for(v=v||{},E=_t.length;E--;v[_t[E]]=x);return v},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],r=[1,28],a=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],p=[1,68],g=[1,69],m=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],st=[1,47],rt=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Xt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],A=[1,82],k=[1,83],C=[1,84],w=[1,85],T=[12,14,42],se=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],vt=[12,33],Wt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:y(function(x,v,E,b,R,h,Rt){var f=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[f-3]);break;case 19:b.setTitle(h[f].substring(6)),this.$=h[f].substring(6);break;case 20:b.setAccDescription(h[f].substring(15)),this.$=h[f].substring(15);break;case 21:this.$=h[f].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[f].trim(),b.setAccDescription(this.$);break;case 28:h[f].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 29:h[f].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 30:b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 31:h[f].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[f]),this.$=h[f];break;case 32:b.addDeploymentNode("node",...h[f]),this.$=h[f];break;case 33:b.addDeploymentNode("nodeL",...h[f]),this.$=h[f];break;case 34:b.addDeploymentNode("nodeR",...h[f]),this.$=h[f];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[f]),this.$=h[f];break;case 40:b.addPersonOrSystem("external_person",...h[f]),this.$=h[f];break;case 41:b.addPersonOrSystem("system",...h[f]),this.$=h[f];break;case 42:b.addPersonOrSystem("system_db",...h[f]),this.$=h[f];break;case 43:b.addPersonOrSystem("system_queue",...h[f]),this.$=h[f];break;case 44:b.addPersonOrSystem("external_system",...h[f]),this.$=h[f];break;case 45:b.addPersonOrSystem("external_system_db",...h[f]),this.$=h[f];break;case 46:b.addPersonOrSystem("external_system_queue",...h[f]),this.$=h[f];break;case 47:b.addContainer("container",...h[f]),this.$=h[f];break;case 48:b.addContainer("container_db",...h[f]),this.$=h[f];break;case 49:b.addContainer("container_queue",...h[f]),this.$=h[f];break;case 50:b.addContainer("external_container",...h[f]),this.$=h[f];break;case 51:b.addContainer("external_container_db",...h[f]),this.$=h[f];break;case 52:b.addContainer("external_container_queue",...h[f]),this.$=h[f];break;case 53:b.addComponent("component",...h[f]),this.$=h[f];break;case 54:b.addComponent("component_db",...h[f]),this.$=h[f];break;case 55:b.addComponent("component_queue",...h[f]),this.$=h[f];break;case 56:b.addComponent("external_component",...h[f]),this.$=h[f];break;case 57:b.addComponent("external_component_db",...h[f]),this.$=h[f];break;case 58:b.addComponent("external_component_queue",...h[f]),this.$=h[f];break;case 60:b.addRel("rel",...h[f]),this.$=h[f];break;case 61:b.addRel("birel",...h[f]),this.$=h[f];break;case 62:b.addRel("rel_u",...h[f]),this.$=h[f];break;case 63:b.addRel("rel_d",...h[f]),this.$=h[f];break;case 64:b.addRel("rel_l",...h[f]),this.$=h[f];break;case 65:b.addRel("rel_r",...h[f]),this.$=h[f];break;case 66:b.addRel("rel_b",...h[f]),this.$=h[f];break;case 67:h[f].splice(0,1),b.addRel("rel",...h[f]),this.$=h[f];break;case 68:b.updateElStyle("update_el_style",...h[f]),this.$=h[f];break;case 69:b.updateRelStyle("update_rel_style",...h[f]),this.$=h[f];break;case 70:b.updateLayoutConfig("update_layout_config",...h[f]),this.$=h[f];break;case 71:this.$=[h[f]];break;case 72:h[f].unshift(h[f-1]),this.$=h[f];break;case 73:case 75:this.$=h[f].trim();break;case 74:let Et={};Et[h[f-1].trim()]=h[f].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ct,[2,14]),e(Xt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(Ot,[2,19]),e(Ot,[2,20]),{25:[1,78]},{27:[1,79]},e(Ot,[2,23]),{35:80,75:81,76:A,77:k,79:C,80:w},{35:86,75:81,76:A,77:k,79:C,80:w},{35:87,75:81,76:A,77:k,79:C,80:w},{35:88,75:81,76:A,77:k,79:C,80:w},{35:89,75:81,76:A,77:k,79:C,80:w},{35:90,75:81,76:A,77:k,79:C,80:w},{35:91,75:81,76:A,77:k,79:C,80:w},{35:92,75:81,76:A,77:k,79:C,80:w},{35:93,75:81,76:A,77:k,79:C,80:w},{35:94,75:81,76:A,77:k,79:C,80:w},{35:95,75:81,76:A,77:k,79:C,80:w},{35:96,75:81,76:A,77:k,79:C,80:w},{35:97,75:81,76:A,77:k,79:C,80:w},{35:98,75:81,76:A,77:k,79:C,80:w},{35:99,75:81,76:A,77:k,79:C,80:w},{35:100,75:81,76:A,77:k,79:C,80:w},{35:101,75:81,76:A,77:k,79:C,80:w},{35:102,75:81,76:A,77:k,79:C,80:w},{35:103,75:81,76:A,77:k,79:C,80:w},{35:104,75:81,76:A,77:k,79:C,80:w},e(T,[2,59]),{35:105,75:81,76:A,77:k,79:C,80:w},{35:106,75:81,76:A,77:k,79:C,80:w},{35:107,75:81,76:A,77:k,79:C,80:w},{35:108,75:81,76:A,77:k,79:C,80:w},{35:109,75:81,76:A,77:k,79:C,80:w},{35:110,75:81,76:A,77:k,79:C,80:w},{35:111,75:81,76:A,77:k,79:C,80:w},{35:112,75:81,76:A,77:k,79:C,80:w},{35:113,75:81,76:A,77:k,79:C,80:w},{35:114,75:81,76:A,77:k,79:C,80:w},{35:115,75:81,76:A,77:k,79:C,80:w},{20:116,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:A,77:k,79:C,80:w},{35:120,75:81,76:A,77:k,79:C,80:w},{35:121,75:81,76:A,77:k,79:C,80:w},{35:122,75:81,76:A,77:k,79:C,80:w},{35:123,75:81,76:A,77:k,79:C,80:w},{35:124,75:81,76:A,77:k,79:C,80:w},{35:125,75:81,76:A,77:k,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Xt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:r}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:r,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ot,[2,21]),e(Ot,[2,22]),e(T,[2,39]),e(se,[2,71],{75:81,35:132,76:A,77:k,79:C,80:w}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(T,[2,40]),e(T,[2,41]),e(T,[2,42]),e(T,[2,43]),e(T,[2,44]),e(T,[2,45]),e(T,[2,46]),e(T,[2,47]),e(T,[2,48]),e(T,[2,49]),e(T,[2,50]),e(T,[2,51]),e(T,[2,52]),e(T,[2,53]),e(T,[2,54]),e(T,[2,55]),e(T,[2,56]),e(T,[2,57]),e(T,[2,58]),e(T,[2,60]),e(T,[2,61]),e(T,[2,62]),e(T,[2,63]),e(T,[2,64]),e(T,[2,65]),e(T,[2,66]),e(T,[2,67]),e(T,[2,68]),e(T,[2,69]),e(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(vt,[2,28]),e(vt,[2,29]),e(vt,[2,30]),e(vt,[2,31]),e(vt,[2,32]),e(vt,[2,33]),e(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Xt,[2,18]),e(Ct,[2,38]),e(se,[2,72]),e(Bt,[2,74]),e(T,[2,24]),e(T,[2,35]),e(Wt,[2,25]),e(Wt,[2,26],{12:[1,138]}),e(Wt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:y(function(x,v){if(v.recoverable)this.trace(x);else{var E=new Error(x);throw E.hash=v,E}},"parseError"),parse:y(function(x){var v=this,E=[0],b=[],R=[null],h=[],Rt=this.table,f="",Et=0,re=0,ke=2,le=1,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),At={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(At.yy[Ht]=this.yy[Ht]);D.setInput(x,At.yy),At.yy.lexer=D,At.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;typeof At.yy.parseError=="function"?this.parseError=At.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(L){E.length=E.length-2*L,R.length=R.length-L,h.length=h.length-L}y(Te,"popStack");function oe(){var L;return L=b.pop()||D.lex()||le,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=v.symbols_[L]||L),L}y(oe,"lex");for(var I,kt,N,Gt,wt={},Mt,W,ce,Lt;;){if(kt=E[E.length-1],this.defaultActions[kt]?N=this.defaultActions[kt]:((I===null||typeof I>"u")&&(I=oe()),N=Rt[kt]&&Rt[kt][I]),typeof N>"u"||!N.length||!N[0]){var Kt="";Lt=[];for(Mt in Rt[kt])this.terminals_[Mt]&&Mt>ke&&Lt.push("'"+this.terminals_[Mt]+"'");D.showPosition?Kt="Parse error on line "+(Et+1)+`: `+D.showPosition()+` Expecting `+Lt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Kt="Parse error on line "+(Et+1)+": Unexpected "+(I==le?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Kt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:qt,expected:Lt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+kt+", token: "+I);switch(N[0]){case 1:E.push(I),R.push(D.yytext),h.push(D.yylloc),E.push(N[1]),I=null,re=D.yyleng,f=D.yytext,Et=D.yylineno,qt=D.yylloc;break;case 2:if(W=this.productions_[N[1]][1],wt.$=R[R.length-W],wt._$={first_line:h[h.length-(W||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(W||1)].first_column,last_column:h[h.length-1].last_column},we&&(wt._$.range=[h[h.length-(W||1)].range[0],h[h.length-1].range[1]]),Gt=this.performAction.apply(wt,[f,re,Et,At.yy,N[1],R,h].concat(Ce)),typeof Gt<"u")return Gt;W&&(E=E.slice(0,-1*W*2),R=R.slice(0,-1*W),h=h.slice(0,-1*W)),E.push(this.productions_[N[1]][0]),R.push(wt.$),h.push(wt._$),ce=Rt[E[E.length-2]][E[E.length-1]],E.push(ce);break;case 3:return!0}}return!0},"parse")},Ae=(function(){var _t={EOF:1,parseError:y(function(v,E){if(this.yy.parser)this.yy.parser.parseError(v,E);else throw new Error(v)},"parseError"),setInput:y(function(x,v){return this.yy=v||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var v=x.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:y(function(x){var v=x.length,E=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===b.length?this.yylloc.first_column:0)+b[b.length-E.length].length-E[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(x){this.unput(this.match.slice(x))},"less"),pastInput:y(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var x=this.pastInput(),v=new Array(x.length+1).join("-");return x+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/channel-Bob_1R_C.js b/apps/kimi-code/dist-web/assets/channel-Bob_1R_C.js deleted file mode 100644 index 58164daddcf..00000000000 --- a/apps/kimi-code/dist-web/assets/channel-Bob_1R_C.js +++ /dev/null @@ -1 +0,0 @@ -import{U as a,C as n}from"./mermaid.core-Cahi9cr1.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js b/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js new file mode 100644 index 00000000000..3838ae21631 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js @@ -0,0 +1 @@ +import{U as a,C as n}from"./mermaid.core-CJB1tAev.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c}; diff --git a/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-B47YykJY.js b/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js similarity index 67% rename from apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-B47YykJY.js rename to apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js index 6bf4b6afd7b..09a3ced2a38 100644 --- a/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-B47YykJY.js +++ b/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js @@ -1 +1 @@ -import{_ as i}from"./mermaid.core-Cahi9cr1.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I}; +import{_ as i}from"./mermaid.core-CJB1tAev.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I}; diff --git a/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DAsxL712.js b/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js similarity index 96% rename from apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DAsxL712.js rename to apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js index 6d983def1ac..24d8ca128c6 100644 --- a/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DAsxL712.js +++ b/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js @@ -1 +1 @@ -import{_ as i,d as l,n as d,j as o}from"./mermaid.core-Cahi9cr1.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h}; +import{_ as i,d as l,n as d,j as o}from"./mermaid.core-CJB1tAev.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h}; diff --git a/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CfD0Yt-O.js b/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js similarity index 83% rename from apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CfD0Yt-O.js rename to apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js index 6cf4f3ebbc1..5798bdcabf1 100644 --- a/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CfD0Yt-O.js +++ b/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js @@ -1,4 +1,4 @@ -import{_ as e}from"./mermaid.core-Cahi9cr1.js";var l=e(()=>` +import{_ as e}from"./mermaid.core-CJB1tAev.js";var l=e(()=>` /* Font Awesome icon styling - consolidated */ .label-icon { display: inline-block; diff --git a/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-DGM3fHaz.js b/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js similarity index 99% rename from apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-DGM3fHaz.js rename to apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js index 011f432c9df..e9fc7746854 100644 --- a/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-DGM3fHaz.js +++ b/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js @@ -1,4 +1,4 @@ -import{g as te}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as ee}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as f,l as _,c as $,x as se,y as ie,a as re,b as ae,g as ne,s as oe,o as le,p as ce,a9 as he,k as j,q as ue,d as bt,a5 as de}from"./mermaid.core-Cahi9cr1.js";import{f as fe}from"./chunk-32BRIVSS-DAsxL712.js";var vt=(function(){var t=f(function(V,a,d,r){for(d=d||{},r=V.length;r--;d[V[r]]=a);return d},"o"),e=[1,2],o=[1,3],s=[1,4],c=[2,4],h=[1,9],p=[1,11],y=[1,16],n=[1,17],T=[1,18],m=[1,19],O=[1,33],x=[1,20],k=[1,21],u=[1,22],L=[1,23],I=[1,24],v=[1,26],F=[1,27],C=[1,28],P=[1,29],w=[1,30],H=[1,31],it=[1,32],rt=[1,35],at=[1,36],nt=[1,37],ot=[1,38],z=[1,34],S=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],lt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],xt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],yt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:f(function(a,d,r,g,E,i,B){var l=i.length-1;switch(E){case 3:return g.setRootDoc(i[l]),i[l];case 4:this.$=[];break;case 5:i[l]!="nl"&&(i[l-1].push(i[l]),this.$=i[l-1]);break;case 6:case 7:this.$=i[l];break;case 8:this.$="nl";break;case 12:this.$=i[l];break;case 13:const Q=i[l-1];Q.description=g.trimColon(i[l]),this.$=Q;break;case 14:this.$={stmt:"relation",state1:i[l-2],state2:i[l]};break;case 15:const gt=g.trimColon(i[l]);this.$={stmt:"relation",state1:i[l-3],state2:i[l-1],description:gt};break;case 19:this.$={stmt:"state",id:i[l-3],type:"default",description:"",doc:i[l-1]};break;case 20:var Y=i[l],K=i[l-2].trim();if(i[l].match(":")){var ht=i[l].split(":");Y=ht[0],K=[K,ht[1]]}this.$={stmt:"state",id:Y,type:"default",description:K};break;case 21:this.$={stmt:"state",id:i[l-3],type:"default",description:i[l-5],doc:i[l-1]};break;case 22:this.$={stmt:"state",id:i[l],type:"fork"};break;case 23:this.$={stmt:"state",id:i[l],type:"join"};break;case 24:this.$={stmt:"state",id:i[l],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[l-1].trim(),note:{position:i[l-2].trim(),text:i[l].trim()}};break;case 29:this.$=i[l].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=i[l].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[l-3],url:i[l-2],tooltip:i[l-1]};break;case 33:this.$={stmt:"click",id:i[l-3],url:i[l-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[l-1].trim(),classes:i[l].trim()};break;case 36:this.$={stmt:"style",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 37:this.$={stmt:"applyClass",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[l].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:o,6:s},{1:[3]},{3:5,4:e,5:o,6:s},{3:6,4:e,5:o,6:s},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],c,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,7]),t(S,[2,8]),t(S,[2,9]),t(S,[2,10]),t(S,[2,11]),t(S,[2,12],{14:[1,40],15:[1,41]}),t(S,[2,16]),{18:[1,42]},t(S,[2,18],{20:[1,43]}),{23:[1,44]},t(S,[2,22]),t(S,[2,23]),t(S,[2,24]),t(S,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(S,[2,28]),{34:[1,49]},{36:[1,50]},t(S,[2,31]),{13:51,24:O,57:z},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(lt,[2,44],{58:[1,56]}),t(lt,[2,45],{58:[1,57]}),t(S,[2,38]),t(S,[2,39]),t(S,[2,40]),t(S,[2,41]),t(S,[2,6]),t(S,[2,13]),{13:58,24:O,57:z},t(S,[2,17]),t(xt,c,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(S,[2,29]),t(S,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(S,[2,14],{14:[1,71]}),{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,72],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(S,[2,37]),t(lt,[2,46]),t(lt,[2,47]),t(S,[2,15]),t(S,[2,19]),t(xt,c,{7:78}),t(S,[2,26]),t(S,[2,27]),{5:[1,79]},{5:[1,80]},{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,81],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,32]),t(S,[2,33]),t(S,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(a,d){if(d.recoverable)this.trace(a);else{var r=new Error(a);throw r.hash=d,r}},"parseError"),parse:f(function(a){var d=this,r=[0],g=[],E=[null],i=[],B=this.table,l="",Y=0,K=0,ht=2,Q=1,gt=i.slice.call(arguments,1),b=Object.create(this.lexer),U={yy:{}};for(var Tt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Tt)&&(U.yy[Tt]=this.yy[Tt]);b.setInput(a,U.yy),U.yy.lexer=b,U.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Et=b.yylloc;i.push(Et);var Qt=b.options&&b.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(N){r.length=r.length-2*N,E.length=E.length-N,i.length=i.length-N}f(Zt,"popStack");function Lt(){var N;return N=g.pop()||b.lex()||Q,typeof N!="number"&&(N instanceof Array&&(g=N,N=g.pop()),N=d.symbols_[N]||N),N}f(Lt,"lex");for(var A,W,R,_t,X={},ut,G,It,dt;;){if(W=r[r.length-1],this.defaultActions[W]?R=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=Lt()),R=B[W]&&B[W][A]),typeof R>"u"||!R.length||!R[0]){var mt="";dt=[];for(ut in B[W])this.terminals_[ut]&&ut>ht&&dt.push("'"+this.terminals_[ut]+"'");b.showPosition?mt="Parse error on line "+(Y+1)+`: +import{g as te}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as ee}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as f,l as _,c as $,x as se,y as ie,a as re,b as ae,g as ne,s as oe,o as le,p as ce,a9 as he,k as j,q as ue,d as bt,a5 as de}from"./mermaid.core-CJB1tAev.js";import{f as fe}from"./chunk-32BRIVSS-DUDRPqmY.js";var vt=(function(){var t=f(function(V,a,d,r){for(d=d||{},r=V.length;r--;d[V[r]]=a);return d},"o"),e=[1,2],o=[1,3],s=[1,4],c=[2,4],h=[1,9],p=[1,11],y=[1,16],n=[1,17],T=[1,18],m=[1,19],O=[1,33],x=[1,20],k=[1,21],u=[1,22],L=[1,23],I=[1,24],v=[1,26],F=[1,27],C=[1,28],P=[1,29],w=[1,30],H=[1,31],it=[1,32],rt=[1,35],at=[1,36],nt=[1,37],ot=[1,38],z=[1,34],S=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],lt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],xt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],yt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:f(function(a,d,r,g,E,i,B){var l=i.length-1;switch(E){case 3:return g.setRootDoc(i[l]),i[l];case 4:this.$=[];break;case 5:i[l]!="nl"&&(i[l-1].push(i[l]),this.$=i[l-1]);break;case 6:case 7:this.$=i[l];break;case 8:this.$="nl";break;case 12:this.$=i[l];break;case 13:const Q=i[l-1];Q.description=g.trimColon(i[l]),this.$=Q;break;case 14:this.$={stmt:"relation",state1:i[l-2],state2:i[l]};break;case 15:const gt=g.trimColon(i[l]);this.$={stmt:"relation",state1:i[l-3],state2:i[l-1],description:gt};break;case 19:this.$={stmt:"state",id:i[l-3],type:"default",description:"",doc:i[l-1]};break;case 20:var Y=i[l],K=i[l-2].trim();if(i[l].match(":")){var ht=i[l].split(":");Y=ht[0],K=[K,ht[1]]}this.$={stmt:"state",id:Y,type:"default",description:K};break;case 21:this.$={stmt:"state",id:i[l-3],type:"default",description:i[l-5],doc:i[l-1]};break;case 22:this.$={stmt:"state",id:i[l],type:"fork"};break;case 23:this.$={stmt:"state",id:i[l],type:"join"};break;case 24:this.$={stmt:"state",id:i[l],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[l-1].trim(),note:{position:i[l-2].trim(),text:i[l].trim()}};break;case 29:this.$=i[l].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=i[l].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[l-3],url:i[l-2],tooltip:i[l-1]};break;case 33:this.$={stmt:"click",id:i[l-3],url:i[l-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[l-1].trim(),classes:i[l].trim()};break;case 36:this.$={stmt:"style",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 37:this.$={stmt:"applyClass",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[l].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:o,6:s},{1:[3]},{3:5,4:e,5:o,6:s},{3:6,4:e,5:o,6:s},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],c,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,7]),t(S,[2,8]),t(S,[2,9]),t(S,[2,10]),t(S,[2,11]),t(S,[2,12],{14:[1,40],15:[1,41]}),t(S,[2,16]),{18:[1,42]},t(S,[2,18],{20:[1,43]}),{23:[1,44]},t(S,[2,22]),t(S,[2,23]),t(S,[2,24]),t(S,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(S,[2,28]),{34:[1,49]},{36:[1,50]},t(S,[2,31]),{13:51,24:O,57:z},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(lt,[2,44],{58:[1,56]}),t(lt,[2,45],{58:[1,57]}),t(S,[2,38]),t(S,[2,39]),t(S,[2,40]),t(S,[2,41]),t(S,[2,6]),t(S,[2,13]),{13:58,24:O,57:z},t(S,[2,17]),t(xt,c,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(S,[2,29]),t(S,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(S,[2,14],{14:[1,71]}),{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,72],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(S,[2,37]),t(lt,[2,46]),t(lt,[2,47]),t(S,[2,15]),t(S,[2,19]),t(xt,c,{7:78}),t(S,[2,26]),t(S,[2,27]),{5:[1,79]},{5:[1,80]},{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,81],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,32]),t(S,[2,33]),t(S,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(a,d){if(d.recoverable)this.trace(a);else{var r=new Error(a);throw r.hash=d,r}},"parseError"),parse:f(function(a){var d=this,r=[0],g=[],E=[null],i=[],B=this.table,l="",Y=0,K=0,ht=2,Q=1,gt=i.slice.call(arguments,1),b=Object.create(this.lexer),U={yy:{}};for(var Tt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Tt)&&(U.yy[Tt]=this.yy[Tt]);b.setInput(a,U.yy),U.yy.lexer=b,U.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Et=b.yylloc;i.push(Et);var Qt=b.options&&b.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(N){r.length=r.length-2*N,E.length=E.length-N,i.length=i.length-N}f(Zt,"popStack");function Lt(){var N;return N=g.pop()||b.lex()||Q,typeof N!="number"&&(N instanceof Array&&(g=N,N=g.pop()),N=d.symbols_[N]||N),N}f(Lt,"lex");for(var A,W,R,_t,X={},ut,G,It,dt;;){if(W=r[r.length-1],this.defaultActions[W]?R=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=Lt()),R=B[W]&&B[W][A]),typeof R>"u"||!R.length||!R[0]){var mt="";dt=[];for(ut in B[W])this.terminals_[ut]&&ut>ht&&dt.push("'"+this.terminals_[ut]+"'");b.showPosition?mt="Parse error on line "+(Y+1)+`: `+b.showPosition()+` Expecting `+dt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":mt="Parse error on line "+(Y+1)+": Unexpected "+(A==Q?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(mt,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:Et,expected:dt})}if(R[0]instanceof Array&&R.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(R[0]){case 1:r.push(A),E.push(b.yytext),i.push(b.yylloc),r.push(R[1]),A=null,K=b.yyleng,l=b.yytext,Y=b.yylineno,Et=b.yylloc;break;case 2:if(G=this.productions_[R[1]][1],X.$=E[E.length-G],X._$={first_line:i[i.length-(G||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(G||1)].first_column,last_column:i[i.length-1].last_column},Qt&&(X._$.range=[i[i.length-(G||1)].range[0],i[i.length-1].range[1]]),_t=this.performAction.apply(X,[l,K,Y,U.yy,R[1],E,i].concat(gt)),typeof _t<"u")return _t;G&&(r=r.slice(0,-1*G*2),E=E.slice(0,-1*G),i=i.slice(0,-1*G)),r.push(this.productions_[R[1]][0]),E.push(X.$),i.push(X._$),It=B[r[r.length-2]][r[r.length-1]],r.push(It);break;case 3:return!0}}return!0},"parse")},qt=(function(){var V={EOF:1,parseError:f(function(d,r){if(this.yy.parser)this.yy.parser.parseError(d,r);else throw new Error(d)},"parseError"),setInput:f(function(a,d){return this.yy=d||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var d=a.length,r=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===g.length?this.yylloc.first_column:0)+g[g.length-r.length].length-r[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-DTx-f56M.js b/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js similarity index 71% rename from apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-DTx-f56M.js rename to apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js index fe5afe2afe8..ef3bb13e542 100644 --- a/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-DTx-f56M.js +++ b/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js @@ -1 +1 @@ -import{_ as i}from"./mermaid.core-Cahi9cr1.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p}; +import{_ as i}from"./mermaid.core-CJB1tAev.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p}; diff --git a/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-hIDvr-8C.js b/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js similarity index 99% rename from apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-hIDvr-8C.js rename to apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js index c181e41d283..ca6d13d0a1d 100644 --- a/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-hIDvr-8C.js +++ b/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js @@ -1,4 +1,4 @@ -import{_ as p,l as w,F as L,z as E,q as I,W as X,e as q,i as H,c as G}from"./mermaid.core-Cahi9cr1.js";var z="",b="",N="",A=[],R=new Map,k=p(e=>H(e,G()),"sanitizeText"),F=p(e=>{switch(e.type){case"terminal":return{...e,value:k(e.value)};case"nonterminal":return{...e,name:k(e.name)};case"sequence":return{...e,elements:e.elements.map(F)};case"choice":return{...e,alternatives:e.alternatives.map(F)};case"optional":return{...e,element:F(e.element)};case"repetition":return{...e,element:F(e.element),separator:e.separator?F(e.separator):void 0};case"special":return{...e,text:k(e.text)}}},"sanitizeAstNode"),U=p(()=>{z="",b="",N="",A.length=0,R.clear(),I(),w.debug("[Railroad] Database cleared")},"clear"),W=p(e=>{z=k(e),w.debug("[Railroad] Title set:",e)},"setTitle"),_=p(()=>z,"getTitle"),j=p(e=>{const i={...e,name:k(e.name),definition:F(e.definition),comment:e.comment?k(e.comment):void 0};w.debug("[Railroad] Adding rule:",i.name),R.has(i.name)&&w.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),A.push(i),R.set(i.name,i)},"addRule"),K=p(()=>A,"getRules"),J=p(e=>R.get(e),"getRule"),Q=p(e=>{b=k(e).replace(/^\s+/g,""),w.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),Z=p(()=>b,"getAccTitle"),V=p(e=>{N=k(e).replace(/\n\s+/g,` +import{_ as p,l as w,F as L,z as E,q as I,W as X,e as q,i as H,c as G}from"./mermaid.core-CJB1tAev.js";var z="",b="",N="",A=[],R=new Map,k=p(e=>H(e,G()),"sanitizeText"),F=p(e=>{switch(e.type){case"terminal":return{...e,value:k(e.value)};case"nonterminal":return{...e,name:k(e.name)};case"sequence":return{...e,elements:e.elements.map(F)};case"choice":return{...e,alternatives:e.alternatives.map(F)};case"optional":return{...e,element:F(e.element)};case"repetition":return{...e,element:F(e.element),separator:e.separator?F(e.separator):void 0};case"special":return{...e,text:k(e.text)}}},"sanitizeAstNode"),U=p(()=>{z="",b="",N="",A.length=0,R.clear(),I(),w.debug("[Railroad] Database cleared")},"clear"),W=p(e=>{z=k(e),w.debug("[Railroad] Title set:",e)},"setTitle"),_=p(()=>z,"getTitle"),j=p(e=>{const i={...e,name:k(e.name),definition:F(e.definition),comment:e.comment?k(e.comment):void 0};w.debug("[Railroad] Adding rule:",i.name),R.has(i.name)&&w.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),A.push(i),R.set(i.name,i)},"addRule"),K=p(()=>A,"getRules"),J=p(e=>R.get(e),"getRule"),Q=p(e=>{b=k(e).replace(/^\s+/g,""),w.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),Z=p(()=>b,"getAccTitle"),V=p(e=>{N=k(e).replace(/\n\s+/g,` `),w.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ee=p(()=>N,"getAccDescription"),te=W,re=_,ie={clear:U,setTitle:W,getTitle:_,addRule:j,getRules:K,getRule:J,setAccTitle:Q,getAccTitle:Z,setAccDescription:V,getAccDescription:ee,setDiagramTitle:te,getDiagramTitle:re},g={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},ne=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,ae=/^[\w "',.-]+$/,oe=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),B=p(e=>e?Object.keys(e).every(i=>i==="railroad"||oe.has(i)):!1,"isRailroadStyleOptions"),le=p(e=>e?"railroad"in e&&e.railroad?e.railroad:B(e)?e:{}:{},"extractRailroadOverrides"),se=p(e=>{if(!e||B(e))return{};const{railroad:i,svgId:a,theme:r,look:t,...n}=e;return n},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return ne.test(a)?a:i},"sanitizeColorValue"),Y=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return ae.test(a)?a:i},"sanitizeFontFamilyValue"),S=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),de=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),ce=p(e=>{const i=Y(e.fontFamily,g.fontFamily),a=de(e.fontSize)??g.fontSize;return{...g,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,g.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,g.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,g.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,g.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,g.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,g.nonTerminalTextColor),lineColor:m(e.lineColor,g.lineColor),markerFill:m(e.lineColor,g.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,g.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,g.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,g.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,g.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,g.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,g.ruleNameColor)}},"buildThemeDefaults"),M=p(e=>{const i=E(),a={...X(),...i.themeVariables??{},...se(e)},r=ce(a),t={...i.railroad??{},...le(e)};return{compactMode:t.compactMode??r.compactMode,padding:S(t.padding,r.padding),verticalSeparation:S(t.verticalSeparation,r.verticalSeparation),horizontalSeparation:S(t.horizontalSeparation,r.horizontalSeparation),arcRadius:S(t.arcRadius,r.arcRadius),fontSize:S(t.fontSize,r.fontSize),fontFamily:Y(t.fontFamily,r.fontFamily),terminalFill:m(t.terminalFill,r.terminalFill),terminalStroke:m(t.terminalStroke,r.terminalStroke),terminalTextColor:m(t.terminalTextColor,r.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,r.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,r.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,r.nonTerminalTextColor),lineColor:m(t.lineColor,r.lineColor),strokeWidth:S(t.strokeWidth,r.strokeWidth),markerFill:m(t.markerFill,r.markerFill),commentFill:m(t.commentFill,r.commentFill),commentStroke:m(t.commentStroke,r.commentStroke),commentTextColor:m(t.commentTextColor,r.commentTextColor),specialFill:m(t.specialFill,r.specialFill),specialStroke:m(t.specialStroke,r.specialStroke),ruleNameColor:m(t.ruleNameColor,r.ruleNameColor),showMarkers:t.showMarkers??r.showMarkers,markerRadius:S(t.markerRadius,r.markerRadius)}},"buildRailroadStyleOptions"),ue=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:r,terminalStroke:t,terminalTextColor:n,nonTerminalFill:h,nonTerminalStroke:s,nonTerminalTextColor:o,lineColor:u,strokeWidth:c,markerFill:d,commentFill:x,commentStroke:l,commentTextColor:f,specialFill:y,specialStroke:v,ruleNameColor:C}=M(e);return` .railroad-diagram { font-family: ${i}; diff --git a/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-BHZEnq1y.js b/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js similarity index 99% rename from apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-BHZEnq1y.js rename to apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js index d7e08f4d7f8..b0c5afb3cbb 100644 --- a/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-BHZEnq1y.js +++ b/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js @@ -1 +1 @@ -import{_ as u,l as i}from"./mermaid.core-Cahi9cr1.js";import{i as m,G as y}from"./graph-DOmOIIwC.js";import{b as _,m as X}from"./map-DxJ2ADlA.js";var j=4;function p(e){return _(e,j)}function C(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:F(e),edges:M(e)};return m(e.graph())||(r.value=p(e.graph())),r}function F(e){return X(e.nodes(),function(r){var n=e.node(r),s=e.parent(r),t={v:r};return m(n)||(t.value=n),m(s)||(t.parent=s),t})}function M(e){return X(e.edges(),function(r){var n=e.edge(r),s={v:r.v,w:r.w};return m(r.name)||(s.name=r.name),m(n)||(s.value=n),s})}var c=new Map,w=new Map,A=new Map,J=u(()=>{w.clear(),A.clear(),c.clear()},"clear"),v=u((e,r)=>{const n=w.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),R=u((e,r)=>{const n=w.get(r)||[];return i.info("Descendants of ",r," is ",n),i.info("Edge is ",e),e.v===r||e.w===r?!1:n?n.includes(e.v)||v(e.v,r)||v(e.w,r)||n.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1)},"edgeInCluster"),b=u((e,r,n,s)=>{i.warn("Copying children of ",e,"root",s,"data",r.node(e),s);const t=r.children(e)||[];e!==s&&t.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",t),t.forEach(o=>{if(r.children(o).length>0)b(o,r,n,s);else{const l=r.node(o);i.info("cp ",o," to ",s," with parent ",e),n.setNode(o,l),s!==r.parent(o)&&(i.warn("Setting parent",o,r.parent(o)),n.setParent(o,r.parent(o))),e!==s&&o!==e?(i.debug("Setting parent",o,e),n.setParent(o,e)):(i.info("In copy ",e,"root",s,"data",r.node(e),s),i.debug("Not Setting parent for node=",o,"cluster!==rootId",e!==s,"node!==clusterId",o!==e));const f=r.edges(o);i.debug("Copying Edges",f),f.forEach(a=>{i.info("Edge",a);const d=r.edge(a.v,a.w,a.name);i.info("Edge data",d,s);try{if(R(a,s)){const g=w.get(s)||[],E=g.includes(a.v)||v(a.v,s)||a.v===s,x=g.includes(a.w)||v(a.w,s)||a.w===s;if(E&&x)i.info("Copying as ",a.v,a.w,d,a.name),n.setEdge(a.v,a.w,d,a.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else{const N=E?s:a.v,h=x?s:a.w;i.info("Rebinding cross-boundary edge as ",N,h,d,a.name),r.setEdge(N,h,d,a.name)}}else i.info("Skipping copy of edge ",a.v,"-->",a.w," rootId: ",s," clusterId:",e)}catch(g){i.error(g)}})}i.debug("Removing node",o),r.removeNode(o)})},"copy"),O=u((e,r)=>{const n=r.children(e);let s=[...n];for(const t of n)A.set(t,e),s=[...s,...O(t,r)];return s},"extractDescendants"),P=u((e,r,n)=>{const s=e.edges().filter(a=>a.v===r||a.w===r),t=e.edges().filter(a=>a.v===n||a.w===n),o=s.map(a=>({v:a.v===r?n:a.v,w:a.w===r?r:a.w})),l=t.map(a=>({v:a.v,w:a.w}));return o.filter(a=>l.some(d=>a.v===d.v&&a.w===d.w))},"findCommonEdges"),D=u((e,r,n)=>{const s=r.children(e);if(i.trace("Searching children of id ",e,s),s.length<1)return e;let t;for(const o of s){const l=D(o,r,n),f=P(r,n,l);if(l)if(f.length>0)t=l;else return l}return t},"findNonClusterChild"),S=u(e=>!c.has(e)||!c.get(e).externalConnections?e:c.has(e)?c.get(e).id:e,"getAnchorId"),U=u((e,r)=>{if(!e||r>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),w.set(n,O(n,e)),c.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const s=e.children(n),t=e.edges();s.length>0?(i.debug("Cluster identified",n,w),t.forEach(o=>{const l=v(o.v,n),f=v(o.w,n);l^f&&(i.warn("Edge: ",o," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",w.get(n)),c.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,w)});for(let n of c.keys()){const s=c.get(n).id,t=e.parent(s);t!==n&&c.has(t)&&!c.get(t).externalConnections&&(c.get(n).id=t);const o=e.edges().some(l=>l.v===n);if(s&&c.get(n)?.externalConnections&&o&&L(e,s,n)){const l=T(e,n,e.parent(s));l&&(c.get(n).id=l)}}e.edges().forEach(function(n){const s=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let t=n.v,o=n.w;if(i.warn("Fix XXX",c,"ids:",n.v,n.w,"Translating: ",c.get(n.v)," --- ",c.get(n.w)),c.get(n.v)||c.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),t=S(n.v),o=S(n.w),e.removeEdge(n.v,n.w,n.name),t!==n.v){const l=e.parent(t);c.get(l).externalConnections=!0,s.fromCluster=n.v}if(o!==n.w){const l=e.parent(o);c.get(l).externalConnections=!0,s.toCluster=n.w}i.warn("Fix Replacing with XXX",t,o,n.name),e.setEdge(t,o,s,n.name)}}),i.warn("Adjusted Graph",C(e)),k(e,0),i.trace(c)},"adjustClustersAndEdges"),k=u((e,r)=>{if(i.warn("extractor - ",r,C(e),e.children("D")),r>10){i.error("Bailing out");return}let n=e.nodes(),s=!1;for(const t of n){const o=e.children(t);s=s||o.length>0}if(!s){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,r);for(const t of n)if(i.debug("Extracting node",t,c,c.has(t)&&!c.get(t).externalConnections,!e.parent(t),e.node(t),e.children("D")," Depth ",r),!c.has(t))i.debug("Not a cluster",t,r);else if(c.get(t)?.clusterData?.explicitDir&&e.children(t)&&e.children(t).length>0){i.warn("Cluster with explicit dir, creating subgraph for children",t,r);const o=c.get(t).clusterData.dir,l=new y({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,l,t);const f=e.node(t)||{};e.setNode(t,{...f,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:l}),i.warn("Subgraph for cluster with explicit dir created:",t,C(l))}else if(!c.get(t).externalConnections&&e.children(t)&&e.children(t).length>0){i.warn("Cluster without external connections, without a parent and with children",t,r);let l=e.graph().rankdir==="TB"?"LR":"TB";c.get(t)?.clusterData?.dir&&(l=c.get(t).clusterData.dir,i.warn("Fixing dir",c.get(t).clusterData.dir,l));const f=new y({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,f,t);const a=e.node(t)||{};e.setNode(t,{...a,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:f}),i.debug("Old graph after copy",C(e))}else i.warn("Cluster ** ",t," **not meeting the criteria !externalConnections:",!c.get(t).externalConnections," no parent: ",!e.parent(t)," children ",e.children(t)&&e.children(t).length>0,e.children("D"),r),i.debug(c);n=e.nodes(),i.warn("New list of nodes",n);for(const t of n){const o=e.node(t);i.warn(" Now next level",t,o),o?.clusterNode&&k(o.graph,r+1)}},"extractor"),B=u((e,r)=>{if(r.length===0)return[];let n=Object.assign([],r);return r.forEach(s=>{const t=e.children(s),o=B(e,t);n=[...n,...o]}),n},"sorter"),W=u(e=>B(e,e.children()),"sortNodesByHierarchy"),L=u((e,r,n)=>{let s=e.parent(r);for(;s&&s!==n;){const t=c.get(s);if(t&&!t.externalConnections)return!0;s=e.parent(s)}return!1},"isNodeInExtractableCluster"),T=u((e,r,n)=>{const s=e.children(r)??[];for(const t of s){if(t===n||v(t,n))continue;const o=D(t,e,r);if(o&&!L(e,o,r))return o}return null},"findSafeAnchorNode");export{U as a,c as b,J as c,D as f,W as s,C as w}; +import{_ as u,l as i}from"./mermaid.core-CJB1tAev.js";import{i as m,G as y}from"./graph-DOmOIIwC.js";import{b as _,m as X}from"./map-DxJ2ADlA.js";var j=4;function p(e){return _(e,j)}function C(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:F(e),edges:M(e)};return m(e.graph())||(r.value=p(e.graph())),r}function F(e){return X(e.nodes(),function(r){var n=e.node(r),s=e.parent(r),t={v:r};return m(n)||(t.value=n),m(s)||(t.parent=s),t})}function M(e){return X(e.edges(),function(r){var n=e.edge(r),s={v:r.v,w:r.w};return m(r.name)||(s.name=r.name),m(n)||(s.value=n),s})}var c=new Map,w=new Map,A=new Map,J=u(()=>{w.clear(),A.clear(),c.clear()},"clear"),v=u((e,r)=>{const n=w.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),R=u((e,r)=>{const n=w.get(r)||[];return i.info("Descendants of ",r," is ",n),i.info("Edge is ",e),e.v===r||e.w===r?!1:n?n.includes(e.v)||v(e.v,r)||v(e.w,r)||n.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1)},"edgeInCluster"),b=u((e,r,n,s)=>{i.warn("Copying children of ",e,"root",s,"data",r.node(e),s);const t=r.children(e)||[];e!==s&&t.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",t),t.forEach(o=>{if(r.children(o).length>0)b(o,r,n,s);else{const l=r.node(o);i.info("cp ",o," to ",s," with parent ",e),n.setNode(o,l),s!==r.parent(o)&&(i.warn("Setting parent",o,r.parent(o)),n.setParent(o,r.parent(o))),e!==s&&o!==e?(i.debug("Setting parent",o,e),n.setParent(o,e)):(i.info("In copy ",e,"root",s,"data",r.node(e),s),i.debug("Not Setting parent for node=",o,"cluster!==rootId",e!==s,"node!==clusterId",o!==e));const f=r.edges(o);i.debug("Copying Edges",f),f.forEach(a=>{i.info("Edge",a);const d=r.edge(a.v,a.w,a.name);i.info("Edge data",d,s);try{if(R(a,s)){const g=w.get(s)||[],E=g.includes(a.v)||v(a.v,s)||a.v===s,x=g.includes(a.w)||v(a.w,s)||a.w===s;if(E&&x)i.info("Copying as ",a.v,a.w,d,a.name),n.setEdge(a.v,a.w,d,a.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else{const N=E?s:a.v,h=x?s:a.w;i.info("Rebinding cross-boundary edge as ",N,h,d,a.name),r.setEdge(N,h,d,a.name)}}else i.info("Skipping copy of edge ",a.v,"-->",a.w," rootId: ",s," clusterId:",e)}catch(g){i.error(g)}})}i.debug("Removing node",o),r.removeNode(o)})},"copy"),O=u((e,r)=>{const n=r.children(e);let s=[...n];for(const t of n)A.set(t,e),s=[...s,...O(t,r)];return s},"extractDescendants"),P=u((e,r,n)=>{const s=e.edges().filter(a=>a.v===r||a.w===r),t=e.edges().filter(a=>a.v===n||a.w===n),o=s.map(a=>({v:a.v===r?n:a.v,w:a.w===r?r:a.w})),l=t.map(a=>({v:a.v,w:a.w}));return o.filter(a=>l.some(d=>a.v===d.v&&a.w===d.w))},"findCommonEdges"),D=u((e,r,n)=>{const s=r.children(e);if(i.trace("Searching children of id ",e,s),s.length<1)return e;let t;for(const o of s){const l=D(o,r,n),f=P(r,n,l);if(l)if(f.length>0)t=l;else return l}return t},"findNonClusterChild"),S=u(e=>!c.has(e)||!c.get(e).externalConnections?e:c.has(e)?c.get(e).id:e,"getAnchorId"),U=u((e,r)=>{if(!e||r>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),w.set(n,O(n,e)),c.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const s=e.children(n),t=e.edges();s.length>0?(i.debug("Cluster identified",n,w),t.forEach(o=>{const l=v(o.v,n),f=v(o.w,n);l^f&&(i.warn("Edge: ",o," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",w.get(n)),c.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,w)});for(let n of c.keys()){const s=c.get(n).id,t=e.parent(s);t!==n&&c.has(t)&&!c.get(t).externalConnections&&(c.get(n).id=t);const o=e.edges().some(l=>l.v===n);if(s&&c.get(n)?.externalConnections&&o&&L(e,s,n)){const l=T(e,n,e.parent(s));l&&(c.get(n).id=l)}}e.edges().forEach(function(n){const s=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let t=n.v,o=n.w;if(i.warn("Fix XXX",c,"ids:",n.v,n.w,"Translating: ",c.get(n.v)," --- ",c.get(n.w)),c.get(n.v)||c.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),t=S(n.v),o=S(n.w),e.removeEdge(n.v,n.w,n.name),t!==n.v){const l=e.parent(t);c.get(l).externalConnections=!0,s.fromCluster=n.v}if(o!==n.w){const l=e.parent(o);c.get(l).externalConnections=!0,s.toCluster=n.w}i.warn("Fix Replacing with XXX",t,o,n.name),e.setEdge(t,o,s,n.name)}}),i.warn("Adjusted Graph",C(e)),k(e,0),i.trace(c)},"adjustClustersAndEdges"),k=u((e,r)=>{if(i.warn("extractor - ",r,C(e),e.children("D")),r>10){i.error("Bailing out");return}let n=e.nodes(),s=!1;for(const t of n){const o=e.children(t);s=s||o.length>0}if(!s){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,r);for(const t of n)if(i.debug("Extracting node",t,c,c.has(t)&&!c.get(t).externalConnections,!e.parent(t),e.node(t),e.children("D")," Depth ",r),!c.has(t))i.debug("Not a cluster",t,r);else if(c.get(t)?.clusterData?.explicitDir&&e.children(t)&&e.children(t).length>0){i.warn("Cluster with explicit dir, creating subgraph for children",t,r);const o=c.get(t).clusterData.dir,l=new y({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,l,t);const f=e.node(t)||{};e.setNode(t,{...f,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:l}),i.warn("Subgraph for cluster with explicit dir created:",t,C(l))}else if(!c.get(t).externalConnections&&e.children(t)&&e.children(t).length>0){i.warn("Cluster without external connections, without a parent and with children",t,r);let l=e.graph().rankdir==="TB"?"LR":"TB";c.get(t)?.clusterData?.dir&&(l=c.get(t).clusterData.dir,i.warn("Fixing dir",c.get(t).clusterData.dir,l));const f=new y({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,f,t);const a=e.node(t)||{};e.setNode(t,{...a,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:f}),i.debug("Old graph after copy",C(e))}else i.warn("Cluster ** ",t," **not meeting the criteria !externalConnections:",!c.get(t).externalConnections," no parent: ",!e.parent(t)," children ",e.children(t)&&e.children(t).length>0,e.children("D"),r),i.debug(c);n=e.nodes(),i.warn("New list of nodes",n);for(const t of n){const o=e.node(t);i.warn(" Now next level",t,o),o?.clusterNode&&k(o.graph,r+1)}},"extractor"),B=u((e,r)=>{if(r.length===0)return[];let n=Object.assign([],r);return r.forEach(s=>{const t=e.children(s),o=B(e,t);n=[...n,...o]}),n},"sorter"),W=u(e=>B(e,e.children()),"sortNodesByHierarchy"),L=u((e,r,n)=>{let s=e.parent(r);for(;s&&s!==n;){const t=c.get(s);if(t&&!t.externalConnections)return!0;s=e.parent(s)}return!1},"isNodeInExtractableCluster"),T=u((e,r,n)=>{const s=e.children(r)??[];for(const t of s){if(t===n||v(t,n))continue;const o=D(t,e,r);if(o&&!L(e,o,r))return o}return null},"findSafeAnchorNode");export{U as a,c as b,J as c,D as f,W as s,C as w}; diff --git a/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-DjiRieSh.js b/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js similarity index 99% rename from apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-DjiRieSh.js rename to apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js index e4a150ebe9f..2943bac3ee9 100644 --- a/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-DjiRieSh.js +++ b/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js @@ -1,4 +1,4 @@ -import{g as tt}from"./chunk-5VM5RSS4-CfD0Yt-O.js";import{g as st}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as it}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as f,l as Ie,c as F,v as at,x as nt,y as Oe,d as de,a5 as rt,b as ut,a as lt,s as ct,g as ot,o as ht,p as dt,k as I,q as pt,r as At,i as ft,a6 as G}from"./mermaid.core-Cahi9cr1.js";import{f as gt}from"./chunk-32BRIVSS-DAsxL712.js";var we=(function(){var t=f(function(O,o,h,p){for(h=h||{},p=O.length;p--;h[O[p]]=o);return h},"o"),i=[1,18],a=[1,19],n=[1,20],r=[1,41],c=[1,26],u=[1,42],d=[1,24],m=[1,25],g=[1,32],N=[1,33],Ae=[1,34],b=[1,45],fe=[1,35],ge=[1,36],me=[1,37],Ce=[1,38],be=[1,27],ke=[1,28],Ee=[1,29],Te=[1,30],ye=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],De=[1,9],A=[1,8,9],Z=[1,58],$=[1,59],ee=[1,60],te=[1,61],se=[1,62],Fe=[1,63],Be=[1,64],_=[1,8,9,41],Pe=[1,77],M=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ie=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ae=[13,60,86,100,102,103],U=[13,60,73,74,86,100,102,103],Me=[13,60,68,69,70,71,72,86,100,102,103],ne=[1,103],z=[1,121],Y=[1,117],K=[1,113],W=[1,119],Q=[1,114],j=[1,115],X=[1,116],q=[1,118],H=[1,120],Re=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],re=[12,39],_e=[1,8,9,39,41,44,46],ue=[1,8,9,22],Ue=[1,153],ze=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Se={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:f(function(o,h,p,l,C,e,J){var s=e.length-1;switch(C){case 8:this.$=e[s-1];break;case 9:case 10:case 13:case 15:this.$=e[s];break;case 11:case 14:this.$=e[s-2]+"."+e[s];break;case 12:case 16:this.$=e[s-1]+e[s];break;case 17:case 18:this.$=e[s-1]+"~"+e[s]+"~";break;case 19:l.addRelation(e[s]);break;case 20:e[s-1].title=l.cleanupLabel(e[s]),l.addRelation(e[s-1]);break;case 31:this.$=e[s].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[s].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[s-3],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[s-4],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[s]);break;case 37:this.$=l.addNamespace(e[s-1],e[s]);break;case 38:this.$=[[e[s]],[]];break;case 39:this.$=[[e[s-1]],[]];break;case 40:e[s][0].unshift(e[s-2]),this.$=e[s];break;case 41:this.$=[[],[e[s]]];break;case 42:this.$=[[],[e[s-1]]];break;case 43:e[s][1].unshift(e[s-2]),this.$=e[s];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[s];break;case 48:l.setCssClass(e[s-2],e[s]);break;case 49:l.addMembers(e[s-3],e[s-1]);break;case 51:l.setCssClass(e[s-5],e[s-3]),l.addMembers(e[s-5],e[s-1]);break;case 52:l.addAnnotation(e[s-3],e[s-1]);break;case 53:l.addAnnotation(e[s-6],e[s-4]),l.addMembers(e[s-6],e[s-1]);break;case 54:l.addAnnotation(e[s-5],e[s-3]);break;case 55:this.$=e[s],l.addClass(e[s]);break;case 56:this.$=e[s-1],l.addClass(e[s-1]),l.setClassLabel(e[s-1],e[s]);break;case 60:l.addAnnotation(e[s],e[s-2]);break;case 61:case 74:this.$=[e[s]];break;case 62:e[s].push(e[s-1]),this.$=e[s];break;case 63:break;case 64:l.addMember(e[s-1],l.cleanupLabel(e[s]));break;case 65:break;case 66:break;case 67:this.$={id1:e[s-2],id2:e[s],relation:e[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[s-3],id2:e[s],relation:e[s-1],relationTitle1:e[s-2],relationTitle2:"none"};break;case 69:this.$={id1:e[s-3],id2:e[s],relation:e[s-2],relationTitle1:"none",relationTitle2:e[s-1]};break;case 70:this.$={id1:e[s-4],id2:e[s],relation:e[s-2],relationTitle1:e[s-3],relationTitle2:e[s-1]};break;case 71:this.$=l.addNote(e[s],e[s-1]);break;case 72:this.$=l.addNote(e[s]);break;case 73:this.$=e[s-2],l.defineClass(e[s-1],e[s]);break;case 75:this.$=e[s-2].concat([e[s]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[s-2],type2:e[s],lineType:e[s-1]};break;case 81:this.$={type1:"none",type2:e[s],lineType:e[s-1]};break;case 82:this.$={type1:e[s-1],type2:"none",lineType:e[s]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[s]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[s-2],l.setClickEvent(e[s-1],e[s]);break;case 92:case 98:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 93:this.$=e[s-2],l.setLink(e[s-1],e[s]);break;case 94:this.$=e[s-3],l.setLink(e[s-2],e[s-1],e[s]);break;case 95:this.$=e[s-3],l.setLink(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 96:this.$=e[s-4],l.setLink(e[s-3],e[s-2],e[s]),l.setTooltip(e[s-3],e[s-1]);break;case 99:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1],e[s]);break;case 100:this.$=e[s-4],l.setClickEvent(e[s-3],e[s-2],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 101:this.$=e[s-3],l.setLink(e[s-2],e[s]);break;case 102:this.$=e[s-4],l.setLink(e[s-3],e[s-1],e[s]);break;case 103:this.$=e[s-4],l.setLink(e[s-3],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 104:this.$=e[s-5],l.setLink(e[s-4],e[s-2],e[s]),l.setTooltip(e[s-4],e[s-1]);break;case 105:this.$=e[s-2],l.setCssStyle(e[s-1],e[s]);break;case 106:l.setCssClass(e[s-1],e[s]);break;case 107:this.$=[e[s]];break;case 108:e[s-2].push(e[s]),this.$=e[s-2];break;case 110:this.$=e[s-1]+e[s];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(De,[2,5],{8:[1,48]}),{8:[1,49]},t(A,[2,19],{22:[1,50]}),t(A,[2,21]),t(A,[2,22]),t(A,[2,23]),t(A,[2,24]),t(A,[2,25]),t(A,[2,26]),t(A,[2,27]),t(A,[2,28]),t(A,[2,29]),t(A,[2,30]),{34:[1,51]},{36:[1,52]},t(A,[2,33]),t(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be}),{39:[1,65]},t(_,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),t(A,[2,65]),t(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Pe,55:76},{58:78,60:[1,79]},t(A,[2,76]),t(A,[2,77]),t(A,[2,78]),t(A,[2,79]),t(M,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),t(M,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},t(ie,[2,133]),t(ie,[2,134]),t(ie,[2,135]),t(ie,[2,136]),t([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),t(De,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:n,42:r,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},t(A,[2,20]),t(A,[2,31]),t(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be},t(A,[2,64]),{67:93,73:Fe,74:Be},t(ae,[2,83],{66:94,68:Z,69:$,70:ee,71:te,72:se}),t(U,[2,84]),t(U,[2,85]),t(U,[2,86]),t(U,[2,87]),t(U,[2,88]),t(Me,[2,89]),t(Me,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:r,43:23,48:u,54:g,56:N},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:ne},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:z,50:Y,59:110,60:K,82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},{60:[1,122]},{13:Pe,55:123},t(_,[2,72]),t(_,[2,138]),{22:z,50:Y,59:124,60:K,61:[1,125],82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},t(Re,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},t(M,[2,16]),t(M,[2,17]),t(M,[2,18]),{11:127,12:Ge,39:[2,36]},t(re,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),t(re,[2,10]),t(_e,[2,55],{11:131,12:Ge}),t(De,[2,7]),{9:[1,132]},t(ue,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},t(ae,[2,82],{66:136,68:Z,69:$,70:ee,71:te,72:se}),t(ae,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:r,43:23,48:u,54:g,56:N},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},t(_,[2,48],{39:[1,142]}),{41:[1,143]},t(_,[2,50]),{41:[2,61],45:144,51:ne},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},t(A,[2,91],{13:[1,147]}),t(A,[2,93],{13:[1,149],77:[1,148]}),t(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},t(A,[2,105],{61:Ue}),t(ze,[2,107],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(x,[2,109]),t(x,[2,111]),t(x,[2,112]),t(x,[2,113]),t(x,[2,114]),t(x,[2,115]),t(x,[2,116]),t(x,[2,117]),t(x,[2,118]),t(x,[2,119]),t(A,[2,106]),t(_,[2,71]),t(A,[2,73],{61:Ue}),{60:[1,155]},t(M,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},t(re,[2,12]),t(_e,[2,56]),{1:[2,4]},t(ue,[2,69]),t(ue,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},t(ae,[2,80]),t(_,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:r,43:23,48:u,54:g,56:N},{45:163,51:ne},t(_,[2,49]),{41:[2,62]},t(_,[2,52],{39:[1,164]}),t(A,[2,60]),t(A,[2,92]),t(A,[2,94]),t(A,[2,95],{77:[1,165]}),t(A,[2,98]),t(A,[2,99],{13:[1,166]}),t(A,[2,101],{13:[1,168],77:[1,167]}),{22:z,50:Y,60:K,82:W,84:169,85:112,86:Q,87:j,88:X,89:q,90:H},t(x,[2,110]),t(Re,[2,75]),{14:[1,170]},t(re,[2,11]),t(ue,[2,70]),t(_,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:ne},t(A,[2,96]),t(A,[2,100]),t(A,[2,102]),t(A,[2,103],{77:[1,174]}),t(ze,[2,108],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(_e,[2,8]),t(_,[2,51]),{41:[1,175]},t(_,[2,54]),t(A,[2,104]),t(_,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:f(function(o,h){if(h.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=h,p}},"parseError"),parse:f(function(o){var h=this,p=[0],l=[],C=[null],e=[],J=this.table,s="",ce=0,Ye=0,Je=2,Ke=1,Ze=e.slice.call(arguments,1),D=Object.create(this.lexer),w={yy:{}};for(var Ne in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ne)&&(w.yy[Ne]=this.yy[Ne]);D.setInput(o,w.yy),w.yy.lexer=D,w.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Le=D.yylloc;e.push(Le);var $e=D.options&&D.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function et(S){p.length=p.length-2*S,C.length=C.length-S,e.length=e.length-S}f(et,"popStack");function We(){var S;return S=l.pop()||D.lex()||Ke,typeof S!="number"&&(S instanceof Array&&(l=S,S=l.pop()),S=h.symbols_[S]||S),S}f(We,"lex");for(var B,V,L,xe,R={},oe,v,Qe,he;;){if(V=p[p.length-1],this.defaultActions[V]?L=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=We()),L=J[V]&&J[V][B]),typeof L>"u"||!L.length||!L[0]){var ve="";he=[];for(oe in J[V])this.terminals_[oe]&&oe>Je&&he.push("'"+this.terminals_[oe]+"'");D.showPosition?ve="Parse error on line "+(ce+1)+`: +import{g as tt}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{g as st}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as it}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as f,l as Ie,c as F,v as at,x as nt,y as Oe,d as de,a5 as rt,b as ut,a as lt,s as ct,g as ot,o as ht,p as dt,k as I,q as pt,r as At,i as ft,a6 as G}from"./mermaid.core-CJB1tAev.js";import{f as gt}from"./chunk-32BRIVSS-DUDRPqmY.js";var we=(function(){var t=f(function(O,o,h,p){for(h=h||{},p=O.length;p--;h[O[p]]=o);return h},"o"),i=[1,18],a=[1,19],n=[1,20],r=[1,41],c=[1,26],u=[1,42],d=[1,24],m=[1,25],g=[1,32],N=[1,33],Ae=[1,34],b=[1,45],fe=[1,35],ge=[1,36],me=[1,37],Ce=[1,38],be=[1,27],ke=[1,28],Ee=[1,29],Te=[1,30],ye=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],De=[1,9],A=[1,8,9],Z=[1,58],$=[1,59],ee=[1,60],te=[1,61],se=[1,62],Fe=[1,63],Be=[1,64],_=[1,8,9,41],Pe=[1,77],M=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ie=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ae=[13,60,86,100,102,103],U=[13,60,73,74,86,100,102,103],Me=[13,60,68,69,70,71,72,86,100,102,103],ne=[1,103],z=[1,121],Y=[1,117],K=[1,113],W=[1,119],Q=[1,114],j=[1,115],X=[1,116],q=[1,118],H=[1,120],Re=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],re=[12,39],_e=[1,8,9,39,41,44,46],ue=[1,8,9,22],Ue=[1,153],ze=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Se={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:f(function(o,h,p,l,C,e,J){var s=e.length-1;switch(C){case 8:this.$=e[s-1];break;case 9:case 10:case 13:case 15:this.$=e[s];break;case 11:case 14:this.$=e[s-2]+"."+e[s];break;case 12:case 16:this.$=e[s-1]+e[s];break;case 17:case 18:this.$=e[s-1]+"~"+e[s]+"~";break;case 19:l.addRelation(e[s]);break;case 20:e[s-1].title=l.cleanupLabel(e[s]),l.addRelation(e[s-1]);break;case 31:this.$=e[s].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[s].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[s-3],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[s-4],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[s]);break;case 37:this.$=l.addNamespace(e[s-1],e[s]);break;case 38:this.$=[[e[s]],[]];break;case 39:this.$=[[e[s-1]],[]];break;case 40:e[s][0].unshift(e[s-2]),this.$=e[s];break;case 41:this.$=[[],[e[s]]];break;case 42:this.$=[[],[e[s-1]]];break;case 43:e[s][1].unshift(e[s-2]),this.$=e[s];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[s];break;case 48:l.setCssClass(e[s-2],e[s]);break;case 49:l.addMembers(e[s-3],e[s-1]);break;case 51:l.setCssClass(e[s-5],e[s-3]),l.addMembers(e[s-5],e[s-1]);break;case 52:l.addAnnotation(e[s-3],e[s-1]);break;case 53:l.addAnnotation(e[s-6],e[s-4]),l.addMembers(e[s-6],e[s-1]);break;case 54:l.addAnnotation(e[s-5],e[s-3]);break;case 55:this.$=e[s],l.addClass(e[s]);break;case 56:this.$=e[s-1],l.addClass(e[s-1]),l.setClassLabel(e[s-1],e[s]);break;case 60:l.addAnnotation(e[s],e[s-2]);break;case 61:case 74:this.$=[e[s]];break;case 62:e[s].push(e[s-1]),this.$=e[s];break;case 63:break;case 64:l.addMember(e[s-1],l.cleanupLabel(e[s]));break;case 65:break;case 66:break;case 67:this.$={id1:e[s-2],id2:e[s],relation:e[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[s-3],id2:e[s],relation:e[s-1],relationTitle1:e[s-2],relationTitle2:"none"};break;case 69:this.$={id1:e[s-3],id2:e[s],relation:e[s-2],relationTitle1:"none",relationTitle2:e[s-1]};break;case 70:this.$={id1:e[s-4],id2:e[s],relation:e[s-2],relationTitle1:e[s-3],relationTitle2:e[s-1]};break;case 71:this.$=l.addNote(e[s],e[s-1]);break;case 72:this.$=l.addNote(e[s]);break;case 73:this.$=e[s-2],l.defineClass(e[s-1],e[s]);break;case 75:this.$=e[s-2].concat([e[s]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[s-2],type2:e[s],lineType:e[s-1]};break;case 81:this.$={type1:"none",type2:e[s],lineType:e[s-1]};break;case 82:this.$={type1:e[s-1],type2:"none",lineType:e[s]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[s]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[s-2],l.setClickEvent(e[s-1],e[s]);break;case 92:case 98:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 93:this.$=e[s-2],l.setLink(e[s-1],e[s]);break;case 94:this.$=e[s-3],l.setLink(e[s-2],e[s-1],e[s]);break;case 95:this.$=e[s-3],l.setLink(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 96:this.$=e[s-4],l.setLink(e[s-3],e[s-2],e[s]),l.setTooltip(e[s-3],e[s-1]);break;case 99:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1],e[s]);break;case 100:this.$=e[s-4],l.setClickEvent(e[s-3],e[s-2],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 101:this.$=e[s-3],l.setLink(e[s-2],e[s]);break;case 102:this.$=e[s-4],l.setLink(e[s-3],e[s-1],e[s]);break;case 103:this.$=e[s-4],l.setLink(e[s-3],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 104:this.$=e[s-5],l.setLink(e[s-4],e[s-2],e[s]),l.setTooltip(e[s-4],e[s-1]);break;case 105:this.$=e[s-2],l.setCssStyle(e[s-1],e[s]);break;case 106:l.setCssClass(e[s-1],e[s]);break;case 107:this.$=[e[s]];break;case 108:e[s-2].push(e[s]),this.$=e[s-2];break;case 110:this.$=e[s-1]+e[s];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(De,[2,5],{8:[1,48]}),{8:[1,49]},t(A,[2,19],{22:[1,50]}),t(A,[2,21]),t(A,[2,22]),t(A,[2,23]),t(A,[2,24]),t(A,[2,25]),t(A,[2,26]),t(A,[2,27]),t(A,[2,28]),t(A,[2,29]),t(A,[2,30]),{34:[1,51]},{36:[1,52]},t(A,[2,33]),t(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be}),{39:[1,65]},t(_,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),t(A,[2,65]),t(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Pe,55:76},{58:78,60:[1,79]},t(A,[2,76]),t(A,[2,77]),t(A,[2,78]),t(A,[2,79]),t(M,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),t(M,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},t(ie,[2,133]),t(ie,[2,134]),t(ie,[2,135]),t(ie,[2,136]),t([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),t(De,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:n,42:r,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},t(A,[2,20]),t(A,[2,31]),t(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be},t(A,[2,64]),{67:93,73:Fe,74:Be},t(ae,[2,83],{66:94,68:Z,69:$,70:ee,71:te,72:se}),t(U,[2,84]),t(U,[2,85]),t(U,[2,86]),t(U,[2,87]),t(U,[2,88]),t(Me,[2,89]),t(Me,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:r,43:23,48:u,54:g,56:N},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:ne},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:z,50:Y,59:110,60:K,82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},{60:[1,122]},{13:Pe,55:123},t(_,[2,72]),t(_,[2,138]),{22:z,50:Y,59:124,60:K,61:[1,125],82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},t(Re,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},t(M,[2,16]),t(M,[2,17]),t(M,[2,18]),{11:127,12:Ge,39:[2,36]},t(re,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),t(re,[2,10]),t(_e,[2,55],{11:131,12:Ge}),t(De,[2,7]),{9:[1,132]},t(ue,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},t(ae,[2,82],{66:136,68:Z,69:$,70:ee,71:te,72:se}),t(ae,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:r,43:23,48:u,54:g,56:N},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},t(_,[2,48],{39:[1,142]}),{41:[1,143]},t(_,[2,50]),{41:[2,61],45:144,51:ne},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},t(A,[2,91],{13:[1,147]}),t(A,[2,93],{13:[1,149],77:[1,148]}),t(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},t(A,[2,105],{61:Ue}),t(ze,[2,107],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(x,[2,109]),t(x,[2,111]),t(x,[2,112]),t(x,[2,113]),t(x,[2,114]),t(x,[2,115]),t(x,[2,116]),t(x,[2,117]),t(x,[2,118]),t(x,[2,119]),t(A,[2,106]),t(_,[2,71]),t(A,[2,73],{61:Ue}),{60:[1,155]},t(M,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},t(re,[2,12]),t(_e,[2,56]),{1:[2,4]},t(ue,[2,69]),t(ue,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},t(ae,[2,80]),t(_,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:r,43:23,48:u,54:g,56:N},{45:163,51:ne},t(_,[2,49]),{41:[2,62]},t(_,[2,52],{39:[1,164]}),t(A,[2,60]),t(A,[2,92]),t(A,[2,94]),t(A,[2,95],{77:[1,165]}),t(A,[2,98]),t(A,[2,99],{13:[1,166]}),t(A,[2,101],{13:[1,168],77:[1,167]}),{22:z,50:Y,60:K,82:W,84:169,85:112,86:Q,87:j,88:X,89:q,90:H},t(x,[2,110]),t(Re,[2,75]),{14:[1,170]},t(re,[2,11]),t(ue,[2,70]),t(_,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:ne},t(A,[2,96]),t(A,[2,100]),t(A,[2,102]),t(A,[2,103],{77:[1,174]}),t(ze,[2,108],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(_e,[2,8]),t(_,[2,51]),{41:[1,175]},t(_,[2,54]),t(A,[2,104]),t(_,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:f(function(o,h){if(h.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=h,p}},"parseError"),parse:f(function(o){var h=this,p=[0],l=[],C=[null],e=[],J=this.table,s="",ce=0,Ye=0,Je=2,Ke=1,Ze=e.slice.call(arguments,1),D=Object.create(this.lexer),w={yy:{}};for(var Ne in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ne)&&(w.yy[Ne]=this.yy[Ne]);D.setInput(o,w.yy),w.yy.lexer=D,w.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Le=D.yylloc;e.push(Le);var $e=D.options&&D.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function et(S){p.length=p.length-2*S,C.length=C.length-S,e.length=e.length-S}f(et,"popStack");function We(){var S;return S=l.pop()||D.lex()||Ke,typeof S!="number"&&(S instanceof Array&&(l=S,S=l.pop()),S=h.symbols_[S]||S),S}f(We,"lex");for(var B,V,L,xe,R={},oe,v,Qe,he;;){if(V=p[p.length-1],this.defaultActions[V]?L=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=We()),L=J[V]&&J[V][B]),typeof L>"u"||!L.length||!L[0]){var ve="";he=[];for(oe in J[V])this.terminals_[oe]&&oe>Je&&he.push("'"+this.terminals_[oe]+"'");D.showPosition?ve="Parse error on line "+(ce+1)+`: `+D.showPosition()+` Expecting `+he.join(", ")+", got '"+(this.terminals_[B]||B)+"'":ve="Parse error on line "+(ce+1)+": Unexpected "+(B==Ke?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(ve,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Le,expected:he})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(L[0]){case 1:p.push(B),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),B=null,Ye=D.yyleng,s=D.yytext,ce=D.yylineno,Le=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],R.$=C[C.length-v],R._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},$e&&(R._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),xe=this.performAction.apply(R,[s,Ye,ce,w.yy,L[1],C,e].concat(Ze)),typeof xe<"u")return xe;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(R.$),e.push(R._$),Qe=J[p[p.length-2]][p[p.length-1]],p.push(Qe);break;case 3:return!0}}return!0},"parse")},He=(function(){var O={EOF:1,parseError:f(function(h,p){if(this.yy.parser)this.yy.parser.parseError(h,p);else throw new Error(h)},"parseError"),setInput:f(function(o,h){return this.yy=h||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var h=o.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:f(function(o){var h=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(o){this.unput(this.match.slice(o))},"less"),pastInput:f(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var o=this.pastInput(),h=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-he8WxbY-.js b/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js similarity index 87% rename from apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-he8WxbY-.js rename to apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js index 0fd0e5f3986..2d8f67ed12b 100644 --- a/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-he8WxbY-.js +++ b/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js @@ -1 +1 @@ -import{_ as a,e as w,l as x}from"./mermaid.core-Cahi9cr1.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s}; +import{_ as a,e as w,l as x}from"./mermaid.core-CJB1tAev.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s}; diff --git a/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-BmzWd-kT.js b/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js similarity index 72% rename from apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-BmzWd-kT.js rename to apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js index d22960aaf6f..146d773226a 100644 --- a/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-BmzWd-kT.js +++ b/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js @@ -1 +1 @@ -import{_ as a,d as o}from"./mermaid.core-Cahi9cr1.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; +import{_ as a,d as o}from"./mermaid.core-CJB1tAev.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g}; diff --git a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js new file mode 100644 index 00000000000..75377c626f9 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B4q9plWN.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-FzVd5qC_.js b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-FzVd5qC_.js deleted file mode 100644 index 51d71a408e8..00000000000 --- a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-FzVd5qC_.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-DjiRieSh.js";import{_ as i}from"./mermaid.core-Cahi9cr1.js";import"./chunk-5VM5RSS4-CfD0Yt-O.js";import"./chunk-XXDRQBXY-BmzWd-kT.js";import"./chunk-VR4S4FIN-he8WxbY-.js";import"./chunk-32BRIVSS-DAsxL712.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js new file mode 100644 index 00000000000..75377c626f9 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js @@ -0,0 +1 @@ +import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B4q9plWN.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-FzVd5qC_.js b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-FzVd5qC_.js deleted file mode 100644 index 51d71a408e8..00000000000 --- a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-FzVd5qC_.js +++ /dev/null @@ -1 +0,0 @@ -import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-DjiRieSh.js";import{_ as i}from"./mermaid.core-Cahi9cr1.js";import"./chunk-5VM5RSS4-CfD0Yt-O.js";import"./chunk-XXDRQBXY-BmzWd-kT.js";import"./chunk-VR4S4FIN-he8WxbY-.js";import"./chunk-32BRIVSS-DAsxL712.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram}; diff --git a/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-B4N3AGR7.js b/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js similarity index 99% rename from apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-B4N3AGR7.js rename to apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js index e161ae8ee88..7c650885bc9 100644 --- a/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-B4N3AGR7.js +++ b/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js @@ -1 +1 @@ -import{_ as V,l as k,d as lt}from"./mermaid.core-Cahi9cr1.js";import{c as tt}from"./cytoscape.esm-OyMbaexL.js";import{g as gt}from"./_commonjsHelpers-CqkleIqs.js";import"./index-HRJ6xRtC.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,L){G.exports=L()})(ut,function(){return(function(N){var I={};function L(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,L),e.l=!0,e.exports}return L.m=N,L.c=I,L.i=function(o){return o},L.d=function(o,e,t){L.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},L.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return L.d(e,"a",e),e},L.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},L.p="",L(L.s=26)})([(function(N,I,L){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,L){var o=L(2),e=L(8),t=L(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,L){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(13),i=L(0),l=L(16),g=L(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,L){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(0),i=L(6),l=L(3),g=L(1),n=L(13),d=L(12),r=L(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var T=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(T.source=v,T.target=D,T.isInterGraph=!1,this.getEdges().push(T),v.edges.push(T),D!=v&&D.edges.push(T),T)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,T=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,T,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?T=y[0].getParent().paddingLeft:T=this.margin,this.left=v-T,this.top=p-T,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,T=-e.MAX_VALUE,y,O,s,f,c,E=this.nodes,A=E.length,m=0;my&&(v=y),Ds&&(u=s),Ty&&(v=y),Ds&&(u=s),T=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,L){var o,e=L(1);function t(i){o=L(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=E,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=E,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=E,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+T*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-T*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=E,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,T=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,E=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,E=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*E-f*c)/A,T=(O*c-y*E)/A,new o(u,T))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,L){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,L){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,L){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),T.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}T=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(E,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,T=p[0])}return T},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,L){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,L){var o=L(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,L){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,a=0;ay||T>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||T>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,L){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(E){return f.has(E)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RE&&(E=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var E=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,E);var A=u.calculateBounds(s),m=new T;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(E-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],E=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,E=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,E,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var E=s.idToDummyNode[c],A=E.paddingLeft,m=E.paddingTop;s.adjustLocations(f[c],E.rect.x,E.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var E=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,E=0;EM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var A=f[E];c.tiledMemberPack[E]=c.tileNodes(s[E],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[E].width,A.rect.height=c.tiledMemberPack[E].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,E=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:E};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,E=0;Ec&&(f=E,c=s.rowWidth[E]);return f},y.prototype.canAddHorizontal=function(s,f,c){var E=this.getShortestRowIndex(s);if(E<0)return!0;var A=s.rowWidth[E];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[E]0&&(m=c+s.verticalPadding-s.rowHeight[E]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){E.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=E[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=T.getGraphManager().add(T.newGraph(),c),this.processChildrenList(R,f,T)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(L=>{["id","label","height","width","padding","x","y"].includes(L)||(I[L]=N[L])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(L=>{["id","start","end"].includes(L)||(I[L]=N[L])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const L={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(L).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),L={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(L[o]=N[o])}),L})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,L={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(L[o]=N[o])}),L})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),L=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${L.length} edges`),{nodes:I,edges:L}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:L,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const T={...u};n[u.id]=T,g[u.id]=T,await N(r,u)}else{const T={...u};g[u.id]=T;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();T.width=O.width,T.height=O.height,T.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const T=g[u.id];return{...u,width:T.width,height:T.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const T=g[u.id];T?.domId&&(T.domId.attr("transform",`translate(${u.x}, ${u.y})`),T.x=u.x,T.y=u.y,t.debug(`Positioned node ${T.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const T=G.edges.find(y=>y.id===u.id);T&&(T.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await L(a,u);const T=g[u.start??""],y=g[u.end??""];if(T&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:T.x||0,y:T.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; +import{_ as V,l as k,d as lt}from"./mermaid.core-CJB1tAev.js";import{c as tt}from"./cytoscape.esm-OyMbaexL.js";import{g as gt}from"./_commonjsHelpers-CqkleIqs.js";import"./index-D-7nOosq.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,L){G.exports=L()})(ut,function(){return(function(N){var I={};function L(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,L),e.l=!0,e.exports}return L.m=N,L.c=I,L.i=function(o){return o},L.d=function(o,e,t){L.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},L.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return L.d(e,"a",e),e},L.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},L.p="",L(L.s=26)})([(function(N,I,L){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,L){var o=L(2),e=L(8),t=L(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,L){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(13),i=L(0),l=L(16),g=L(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,L){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(0),i=L(6),l=L(3),g=L(1),n=L(13),d=L(12),r=L(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var T=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(T.source=v,T.target=D,T.isInterGraph=!1,this.getEdges().push(T),v.edges.push(T),D!=v&&D.edges.push(T),T)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,T=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,T,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?T=y[0].getParent().paddingLeft:T=this.margin,this.left=v-T,this.top=p-T,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,T=-e.MAX_VALUE,y,O,s,f,c,E=this.nodes,A=E.length,m=0;my&&(v=y),Ds&&(u=s),Ty&&(v=y),Ds&&(u=s),T=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,L){var o,e=L(1);function t(i){o=L(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=E,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=E,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=E,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+T*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-T*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=E,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,T=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,E=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,E=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*E-f*c)/A,T=(O*c-y*E)/A,new o(u,T))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,L){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,L){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,L){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),T.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}T=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(E,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,T=p[0])}return T},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,L){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,L){var o=L(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,L){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,a=0;ay||T>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||T>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,L){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(E){return f.has(E)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RE&&(E=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var E=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,E);var A=u.calculateBounds(s),m=new T;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(E-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],E=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,E=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,E,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var E=s.idToDummyNode[c],A=E.paddingLeft,m=E.paddingTop;s.adjustLocations(f[c],E.rect.x,E.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var E=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,E=0;EM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var A=f[E];c.tiledMemberPack[E]=c.tileNodes(s[E],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[E].width,A.rect.height=c.tiledMemberPack[E].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,E=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:E};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,E=0;Ec&&(f=E,c=s.rowWidth[E]);return f},y.prototype.canAddHorizontal=function(s,f,c){var E=this.getShortestRowIndex(s);if(E<0)return!0;var A=s.rowWidth[E];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[E]0&&(m=c+s.verticalPadding-s.rowHeight[E]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){E.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=E[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=T.getGraphManager().add(T.newGraph(),c),this.processChildrenList(R,f,T)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(L=>{["id","label","height","width","padding","x","y"].includes(L)||(I[L]=N[L])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(L=>{["id","start","end"].includes(L)||(I[L]=N[L])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const L={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(L).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),L={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(L[o]=N[o])}),L})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,L={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(L[o]=N[o])}),L})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),L=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${L.length} edges`),{nodes:I,edges:L}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:L,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const T={...u};n[u.id]=T,g[u.id]=T,await N(r,u)}else{const T={...u};g[u.id]=T;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();T.width=O.width,T.height=O.height,T.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const T=g[u.id];return{...u,width:T.width,height:T.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const T=g[u.id];T?.domId&&(T.domId.attr("transform",`translate(${u.x}, ${u.y})`),T.x=u.x,T.y=u.y,t.debug(`Positioned node ${T.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const T=G.edges.find(y=>y.id===u.id);T&&(T.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await L(a,u);const T=g[u.start??""],y=g[u.end??""];if(T&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:T.x||0,y:T.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render}; diff --git a/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-C5gNr-Q4.js b/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js similarity index 99% rename from apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-C5gNr-Q4.js rename to apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js index c74a442cccf..465b4ad8556 100644 --- a/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-C5gNr-Q4.js +++ b/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js @@ -1,4 +1,4 @@ -import{bR as et}from"./index-HRJ6xRtC.js";var RI=Object.create,Ds=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyNames,EI=Object.getPrototypeOf,CI=Object.prototype.hasOwnProperty,i=(e,t)=>Ds(e,"name",{value:t,configurable:!0}),bI=(e,t)=>function(){return e&&(t=(0,e[Ad(e)[0]])(e=0)),t},H=(e,t)=>function(){return t||(0,e[Ad(e)[0]])((t={exports:{}}).exports,t),t.exports},Vr=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},Ed=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ad(t))!CI.call(e,a)&&a!==r&&Ds(e,a,{get:()=>t[a],enumerable:!(n=AI(t,a))||n.enumerable});return e},Ll=(e,t,r)=>(Ed(e,t,"default"),r),Cd=(e,t,r)=>(r=e!=null?RI(EI(e)):{},Ed(Ds(r,"default",{value:e,enumerable:!0}),e)),bd=e=>Ed(Ds({},"__esModule",{value:!0}),e),Dl={};Vr(Dl,{AnnotatedTextEdit:()=>mr,ChangeAnnotation:()=>an,ChangeAnnotationIdentifier:()=>Ke,CodeAction:()=>ef,CodeActionContext:()=>Qc,CodeActionKind:()=>Zc,CodeActionTriggerKind:()=>Xi,CodeDescription:()=>Nc,CodeLens:()=>tf,Color:()=>Co,ColorInformation:()=>Cc,ColorPresentation:()=>bc,Command:()=>nn,CompletionItem:()=>zc,CompletionItemKind:()=>Lc,CompletionItemLabelDetails:()=>Fc,CompletionItemTag:()=>xc,CompletionList:()=>jc,CreateFile:()=>ya,DeleteFile:()=>va,Diagnostic:()=>Vi,DiagnosticRelatedInformation:()=>bo,DiagnosticSeverity:()=>wc,DiagnosticTag:()=>Ic,DocumentHighlight:()=>Vc,DocumentHighlightKind:()=>Wc,DocumentLink:()=>nf,DocumentSymbol:()=>Jc,DocumentUri:()=>Rc,EOL:()=>zg,FoldingRange:()=>Sc,FoldingRangeKind:()=>_c,FormattingOptions:()=>rf,Hover:()=>Bc,InlayHint:()=>pf,InlayHintKind:()=>wo,InlayHintLabelPart:()=>Io,InlineCompletionContext:()=>Tf,InlineCompletionItem:()=>hf,InlineCompletionList:()=>yf,InlineCompletionTriggerKind:()=>gf,InlineValueContext:()=>df,InlineValueEvaluatableExpression:()=>ff,InlineValueText:()=>uf,InlineValueVariableLookup:()=>cf,InsertReplaceEdit:()=>Mc,InsertTextFormat:()=>Dc,InsertTextMode:()=>Gc,Location:()=>Wi,LocationLink:()=>Ec,MarkedString:()=>Yi,MarkupContent:()=>Ta,MarkupKind:()=>So,OptionalVersionedTextDocumentIdentifier:()=>Hi,ParameterInformation:()=>Uc,Position:()=>ie,Range:()=>Q,RenameFile:()=>ga,SelectedCompletionInfo:()=>vf,SelectionRange:()=>af,SemanticTokenModifiers:()=>of,SemanticTokenTypes:()=>sf,SemanticTokens:()=>lf,SignatureInformation:()=>Kc,StringValue:()=>mf,SymbolInformation:()=>Yc,SymbolKind:()=>qc,SymbolTag:()=>Hc,TextDocument:()=>Rf,TextDocumentEdit:()=>qi,TextDocumentIdentifier:()=>Pc,TextDocumentItem:()=>Oc,TextEdit:()=>Yt,URI:()=>Eo,VersionedTextDocumentIdentifier:()=>kc,WorkspaceChange:()=>Fg,WorkspaceEdit:()=>_o,WorkspaceFolder:()=>$f,WorkspaceSymbol:()=>Xc,integer:()=>Ac,uinteger:()=>Ki});var Rc,Eo,Ac,Ki,ie,Q,Wi,Ec,Co,Cc,bc,_c,Sc,bo,wc,Ic,Nc,Vi,nn,Yt,an,Ke,mr,qi,ya,ga,va,_o,ki,Ku,Fg,Pc,kc,Hi,Oc,So,Ta,Lc,Dc,xc,Mc,Gc,Fc,zc,jc,Yi,Bc,Uc,Kc,Wc,Vc,qc,Hc,Yc,Xc,Jc,Zc,Xi,Qc,ef,tf,rf,nf,af,sf,of,lf,uf,cf,ff,df,wo,Io,pf,mf,hf,yf,gf,vf,Tf,$f,zg,Rf,lh,A,xs=bI({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Rc||(Rc={})),(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Eo||(Eo={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ac||(Ac={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ki||(Ki={})),(function(e){function t(n,a){return n===Number.MAX_VALUE&&(n=Ki.MAX_VALUE),a===Number.MAX_VALUE&&(a=Ki.MAX_VALUE),{line:n,character:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&A.uinteger(a.line)&&A.uinteger(a.character)}i(r,"is"),e.is=r})(ie||(ie={})),(function(e){function t(n,a,s,o){if(A.uinteger(n)&&A.uinteger(a)&&A.uinteger(s)&&A.uinteger(o))return{start:ie.create(n,a),end:ie.create(s,o)};if(ie.is(n)&&ie.is(a))return{start:n,end:a};throw new Error(`Range#create called with invalid arguments[${n}, ${a}, ${s}, ${o}]`)}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&ie.is(a.start)&&ie.is(a.end)}i(r,"is"),e.is=r})(Q||(Q={})),(function(e){function t(n,a){return{uri:n,range:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(A.string(a.uri)||A.undefined(a.uri))}i(r,"is"),e.is=r})(Wi||(Wi={})),(function(e){function t(n,a,s,o){return{targetUri:n,targetRange:a,targetSelectionRange:s,originSelectionRange:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.targetRange)&&A.string(a.targetUri)&&Q.is(a.targetSelectionRange)&&(Q.is(a.originSelectionRange)||A.undefined(a.originSelectionRange))}i(r,"is"),e.is=r})(Ec||(Ec={})),(function(e){function t(n,a,s,o){return{red:n,green:a,blue:s,alpha:o}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.numberRange(a.red,0,1)&&A.numberRange(a.green,0,1)&&A.numberRange(a.blue,0,1)&&A.numberRange(a.alpha,0,1)}i(r,"is"),e.is=r})(Co||(Co={})),(function(e){function t(n,a){return{range:n,color:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&Q.is(a.range)&&Co.is(a.color)}i(r,"is"),e.is=r})(Cc||(Cc={})),(function(e){function t(n,a,s){return{label:n,textEdit:a,additionalTextEdits:s}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.undefined(a.textEdit)||Yt.is(a))&&(A.undefined(a.additionalTextEdits)||A.typedArray(a.additionalTextEdits,Yt.is))}i(r,"is"),e.is=r})(bc||(bc={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(_c||(_c={})),(function(e){function t(n,a,s,o,l,u){const c={startLine:n,endLine:a};return A.defined(s)&&(c.startCharacter=s),A.defined(o)&&(c.endCharacter=o),A.defined(l)&&(c.kind=l),A.defined(u)&&(c.collapsedText=u),c}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.uinteger(a.startLine)&&A.uinteger(a.startLine)&&(A.undefined(a.startCharacter)||A.uinteger(a.startCharacter))&&(A.undefined(a.endCharacter)||A.uinteger(a.endCharacter))&&(A.undefined(a.kind)||A.string(a.kind))}i(r,"is"),e.is=r})(Sc||(Sc={})),(function(e){function t(n,a){return{location:n,message:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Wi.is(a.location)&&A.string(a.message)}i(r,"is"),e.is=r})(bo||(bo={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(wc||(wc={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(Ic||(Ic={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&A.string(n.href)}i(t,"is"),e.is=t})(Nc||(Nc={})),(function(e){function t(n,a,s,o,l,u){let c={range:n,message:a};return A.defined(s)&&(c.severity=s),A.defined(o)&&(c.code=o),A.defined(l)&&(c.source=l),A.defined(u)&&(c.relatedInformation=u),c}i(t,"create"),e.create=t;function r(n){var a;let s=n;return A.defined(s)&&Q.is(s.range)&&A.string(s.message)&&(A.number(s.severity)||A.undefined(s.severity))&&(A.integer(s.code)||A.string(s.code)||A.undefined(s.code))&&(A.undefined(s.codeDescription)||A.string((a=s.codeDescription)===null||a===void 0?void 0:a.href))&&(A.string(s.source)||A.undefined(s.source))&&(A.undefined(s.relatedInformation)||A.typedArray(s.relatedInformation,bo.is))}i(r,"is"),e.is=r})(Vi||(Vi={})),(function(e){function t(n,a,...s){let o={title:n,command:a};return A.defined(s)&&s.length>0&&(o.arguments=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.title)&&A.string(a.command)}i(r,"is"),e.is=r})(nn||(nn={})),(function(e){function t(s,o){return{range:s,newText:o}}i(t,"replace"),e.replace=t;function r(s,o){return{range:{start:s,end:s},newText:o}}i(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}i(n,"del"),e.del=n;function a(s){const o=s;return A.objectLiteral(o)&&A.string(o.newText)&&Q.is(o.range)}i(a,"is"),e.is=a})(Yt||(Yt={})),(function(e){function t(n,a,s){const o={label:n};return a!==void 0&&(o.needsConfirmation=a),s!==void 0&&(o.description=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.boolean(a.needsConfirmation)||a.needsConfirmation===void 0)&&(A.string(a.description)||a.description===void 0)}i(r,"is"),e.is=r})(an||(an={})),(function(e){function t(r){const n=r;return A.string(n)}i(t,"is"),e.is=t})(Ke||(Ke={})),(function(e){function t(s,o,l){return{range:s,newText:o,annotationId:l}}i(t,"replace"),e.replace=t;function r(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}i(r,"insert"),e.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}i(n,"del"),e.del=n;function a(s){const o=s;return Yt.is(o)&&(an.is(o.annotationId)||Ke.is(o.annotationId))}i(a,"is"),e.is=a})(mr||(mr={})),(function(e){function t(n,a){return{textDocument:n,edits:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Hi.is(a.textDocument)&&Array.isArray(a.edits)}i(r,"is"),e.is=r})(qi||(qi={})),(function(e){function t(n,a,s){let o={kind:"create",uri:n};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="create"&&A.string(a.uri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ya||(ya={})),(function(e){function t(n,a,s,o){let l={kind:"rename",oldUri:n,newUri:a};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="rename"&&A.string(a.oldUri)&&A.string(a.newUri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ga||(ga={})),(function(e){function t(n,a,s){let o={kind:"delete",uri:n};return a!==void 0&&(a.recursive!==void 0||a.ignoreIfNotExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="delete"&&A.string(a.uri)&&(a.options===void 0||(a.options.recursive===void 0||A.boolean(a.options.recursive))&&(a.options.ignoreIfNotExists===void 0||A.boolean(a.options.ignoreIfNotExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(va||(va={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(a=>A.string(a.kind)?ya.is(a)||ga.is(a)||va.is(a):qi.is(a)))}i(t,"is"),e.is=t})(_o||(_o={})),ki=class{static{i(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,a;if(r===void 0?n=Yt.insert(e,t):Ke.is(r)?(a=r,n=mr.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.insert(e,t,a)),this.edits.push(n),a!==void 0)return a}replace(e,t,r){let n,a;if(r===void 0?n=Yt.replace(e,t):Ke.is(r)?(a=r,n=mr.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.replace(e,t,a)),this.edits.push(n),a!==void 0)return a}delete(e,t){let r,n;if(t===void 0?r=Yt.del(e):Ke.is(t)?(n=t,r=mr.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=mr.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},Ku=class{static{i(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(Ke.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Fg=class{static{i(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Ku(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(qi.is(t)){const r=new ki(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new ki(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Hi.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const n=[],a={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(a),r=new ki(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new ki(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ku,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=ya.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=ya.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let a;an.is(r)||Ke.is(r)?a=r:n=r;let s,o;if(a===void 0?s=ga.create(e,t,n):(o=Ke.is(a)?a:this._changeAnnotations.manage(a),s=ga.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=va.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=va.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}},(function(e){function t(n){return{uri:n}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)}i(r,"is"),e.is=r})(Pc||(Pc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.integer(a.version)}i(r,"is"),e.is=r})(kc||(kc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&(a.version===null||A.integer(a.version))}i(r,"is"),e.is=r})(Hi||(Hi={})),(function(e){function t(n,a,s,o){return{uri:n,languageId:a,version:s,text:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.string(a.languageId)&&A.integer(a.version)&&A.string(a.text)}i(r,"is"),e.is=r})(Oc||(Oc={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){const n=r;return n===e.PlainText||n===e.Markdown}i(t,"is"),e.is=t})(So||(So={})),(function(e){function t(r){const n=r;return A.objectLiteral(r)&&So.is(n.kind)&&A.string(n.value)}i(t,"is"),e.is=t})(Ta||(Ta={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Lc||(Lc={})),(function(e){e.PlainText=1,e.Snippet=2})(Dc||(Dc={})),(function(e){e.Deprecated=1})(xc||(xc={})),(function(e){function t(n,a,s){return{newText:n,insert:a,replace:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a&&A.string(a.newText)&&Q.is(a.insert)&&Q.is(a.replace)}i(r,"is"),e.is=r})(Mc||(Mc={})),(function(e){e.asIs=1,e.adjustIndentation=2})(Gc||(Gc={})),(function(e){function t(r){const n=r;return n&&(A.string(n.detail)||n.detail===void 0)&&(A.string(n.description)||n.description===void 0)}i(t,"is"),e.is=t})(Fc||(Fc={})),(function(e){function t(r){return{label:r}}i(t,"create"),e.create=t})(zc||(zc={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}i(t,"create"),e.create=t})(jc||(jc={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i(t,"fromPlainText"),e.fromPlainText=t;function r(n){const a=n;return A.string(a)||A.objectLiteral(a)&&A.string(a.language)&&A.string(a.value)}i(r,"is"),e.is=r})(Yi||(Yi={})),(function(e){function t(r){let n=r;return!!n&&A.objectLiteral(n)&&(Ta.is(n.contents)||Yi.is(n.contents)||A.typedArray(n.contents,Yi.is))&&(r.range===void 0||Q.is(r.range))}i(t,"is"),e.is=t})(Bc||(Bc={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}i(t,"create"),e.create=t})(Uc||(Uc={})),(function(e){function t(r,n,...a){let s={label:r};return A.defined(n)&&(s.documentation=n),A.defined(a)?s.parameters=a:s.parameters=[],s}i(t,"create"),e.create=t})(Kc||(Kc={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(Wc||(Wc={})),(function(e){function t(r,n){let a={range:r};return A.number(n)&&(a.kind=n),a}i(t,"create"),e.create=t})(Vc||(Vc={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(qc||(qc={})),(function(e){e.Deprecated=1})(Hc||(Hc={})),(function(e){function t(r,n,a,s,o){let l={name:r,kind:n,location:{uri:s,range:a}};return o&&(l.containerName=o),l}i(t,"create"),e.create=t})(Yc||(Yc={})),(function(e){function t(r,n,a,s){return s!==void 0?{name:r,kind:n,location:{uri:a,range:s}}:{name:r,kind:n,location:{uri:a}}}i(t,"create"),e.create=t})(Xc||(Xc={})),(function(e){function t(n,a,s,o,l,u){let c={name:n,detail:a,kind:s,range:o,selectionRange:l};return u!==void 0&&(c.children=u),c}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.name)&&A.number(a.kind)&&Q.is(a.range)&&Q.is(a.selectionRange)&&(a.detail===void 0||A.string(a.detail))&&(a.deprecated===void 0||A.boolean(a.deprecated))&&(a.children===void 0||Array.isArray(a.children))&&(a.tags===void 0||Array.isArray(a.tags))}i(r,"is"),e.is=r})(Jc||(Jc={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(Zc||(Zc={})),(function(e){e.Invoked=1,e.Automatic=2})(Xi||(Xi={})),(function(e){function t(n,a,s){let o={diagnostics:n};return a!=null&&(o.only=a),s!=null&&(o.triggerKind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.typedArray(a.diagnostics,Vi.is)&&(a.only===void 0||A.typedArray(a.only,A.string))&&(a.triggerKind===void 0||a.triggerKind===Xi.Invoked||a.triggerKind===Xi.Automatic)}i(r,"is"),e.is=r})(Qc||(Qc={})),(function(e){function t(n,a,s){let o={title:n},l=!0;return typeof a=="string"?(l=!1,o.kind=a):nn.is(a)?o.command=a:o.edit=a,l&&s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.title)&&(a.diagnostics===void 0||A.typedArray(a.diagnostics,Vi.is))&&(a.kind===void 0||A.string(a.kind))&&(a.edit!==void 0||a.command!==void 0)&&(a.command===void 0||nn.is(a.command))&&(a.isPreferred===void 0||A.boolean(a.isPreferred))&&(a.edit===void 0||_o.is(a.edit))}i(r,"is"),e.is=r})(ef||(ef={})),(function(e){function t(n,a){let s={range:n};return A.defined(a)&&(s.data=a),s}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.command)||nn.is(a.command))}i(r,"is"),e.is=r})(tf||(tf={})),(function(e){function t(n,a){return{tabSize:n,insertSpaces:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.uinteger(a.tabSize)&&A.boolean(a.insertSpaces)}i(r,"is"),e.is=r})(rf||(rf={})),(function(e){function t(n,a,s){return{range:n,target:a,data:s}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.target)||A.string(a.target))}i(r,"is"),e.is=r})(nf||(nf={})),(function(e){function t(n,a){return{range:n,parent:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(a.parent===void 0||e.is(a.parent))}i(r,"is"),e.is=r})(af||(af={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(sf||(sf={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(of||(of={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i(t,"is"),e.is=t})(lf||(lf={})),(function(e){function t(n,a){return{range:n,text:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.string(a.text)}i(r,"is"),e.is=r})(uf||(uf={})),(function(e){function t(n,a,s){return{range:n,variableName:a,caseSensitiveLookup:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.boolean(a.caseSensitiveLookup)&&(A.string(a.variableName)||a.variableName===void 0)}i(r,"is"),e.is=r})(cf||(cf={})),(function(e){function t(n,a){return{range:n,expression:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&(A.string(a.expression)||a.expression===void 0)}i(r,"is"),e.is=r})(ff||(ff={})),(function(e){function t(n,a){return{frameId:n,stoppedLocation:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.defined(a)&&Q.is(n.stoppedLocation)}i(r,"is"),e.is=r})(df||(df={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}i(t,"is"),e.is=t})(wo||(wo={})),(function(e){function t(n){return{value:n}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.location===void 0||Wi.is(a.location))&&(a.command===void 0||nn.is(a.command))}i(r,"is"),e.is=r})(Io||(Io={})),(function(e){function t(n,a,s){const o={position:n,label:a};return s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&ie.is(a.position)&&(A.string(a.label)||A.typedArray(a.label,Io.is))&&(a.kind===void 0||wo.is(a.kind))&&a.textEdits===void 0||A.typedArray(a.textEdits,Yt.is)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.paddingLeft===void 0||A.boolean(a.paddingLeft))&&(a.paddingRight===void 0||A.boolean(a.paddingRight))}i(r,"is"),e.is=r})(pf||(pf={})),(function(e){function t(r){return{kind:"snippet",value:r}}i(t,"createSnippet"),e.createSnippet=t})(mf||(mf={})),(function(e){function t(r,n,a,s){return{insertText:r,filterText:n,range:a,command:s}}i(t,"create"),e.create=t})(hf||(hf={})),(function(e){function t(r){return{items:r}}i(t,"create"),e.create=t})(yf||(yf={})),(function(e){e.Invoked=0,e.Automatic=1})(gf||(gf={})),(function(e){function t(r,n){return{range:r,text:n}}i(t,"create"),e.create=t})(vf||(vf={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}i(t,"create"),e.create=t})(Tf||(Tf={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&Eo.is(n.uri)&&A.string(n.name)}i(t,"is"),e.is=t})($f||($f={})),zg=[` +import{bR as et}from"./index-D-7nOosq.js";var RI=Object.create,Ds=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyNames,EI=Object.getPrototypeOf,CI=Object.prototype.hasOwnProperty,i=(e,t)=>Ds(e,"name",{value:t,configurable:!0}),bI=(e,t)=>function(){return e&&(t=(0,e[Ad(e)[0]])(e=0)),t},H=(e,t)=>function(){return t||(0,e[Ad(e)[0]])((t={exports:{}}).exports,t),t.exports},Vr=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},Ed=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ad(t))!CI.call(e,a)&&a!==r&&Ds(e,a,{get:()=>t[a],enumerable:!(n=AI(t,a))||n.enumerable});return e},Ll=(e,t,r)=>(Ed(e,t,"default"),r),Cd=(e,t,r)=>(r=e!=null?RI(EI(e)):{},Ed(Ds(r,"default",{value:e,enumerable:!0}),e)),bd=e=>Ed(Ds({},"__esModule",{value:!0}),e),Dl={};Vr(Dl,{AnnotatedTextEdit:()=>mr,ChangeAnnotation:()=>an,ChangeAnnotationIdentifier:()=>Ke,CodeAction:()=>ef,CodeActionContext:()=>Qc,CodeActionKind:()=>Zc,CodeActionTriggerKind:()=>Xi,CodeDescription:()=>Nc,CodeLens:()=>tf,Color:()=>Co,ColorInformation:()=>Cc,ColorPresentation:()=>bc,Command:()=>nn,CompletionItem:()=>zc,CompletionItemKind:()=>Lc,CompletionItemLabelDetails:()=>Fc,CompletionItemTag:()=>xc,CompletionList:()=>jc,CreateFile:()=>ya,DeleteFile:()=>va,Diagnostic:()=>Vi,DiagnosticRelatedInformation:()=>bo,DiagnosticSeverity:()=>wc,DiagnosticTag:()=>Ic,DocumentHighlight:()=>Vc,DocumentHighlightKind:()=>Wc,DocumentLink:()=>nf,DocumentSymbol:()=>Jc,DocumentUri:()=>Rc,EOL:()=>zg,FoldingRange:()=>Sc,FoldingRangeKind:()=>_c,FormattingOptions:()=>rf,Hover:()=>Bc,InlayHint:()=>pf,InlayHintKind:()=>wo,InlayHintLabelPart:()=>Io,InlineCompletionContext:()=>Tf,InlineCompletionItem:()=>hf,InlineCompletionList:()=>yf,InlineCompletionTriggerKind:()=>gf,InlineValueContext:()=>df,InlineValueEvaluatableExpression:()=>ff,InlineValueText:()=>uf,InlineValueVariableLookup:()=>cf,InsertReplaceEdit:()=>Mc,InsertTextFormat:()=>Dc,InsertTextMode:()=>Gc,Location:()=>Wi,LocationLink:()=>Ec,MarkedString:()=>Yi,MarkupContent:()=>Ta,MarkupKind:()=>So,OptionalVersionedTextDocumentIdentifier:()=>Hi,ParameterInformation:()=>Uc,Position:()=>ie,Range:()=>Q,RenameFile:()=>ga,SelectedCompletionInfo:()=>vf,SelectionRange:()=>af,SemanticTokenModifiers:()=>of,SemanticTokenTypes:()=>sf,SemanticTokens:()=>lf,SignatureInformation:()=>Kc,StringValue:()=>mf,SymbolInformation:()=>Yc,SymbolKind:()=>qc,SymbolTag:()=>Hc,TextDocument:()=>Rf,TextDocumentEdit:()=>qi,TextDocumentIdentifier:()=>Pc,TextDocumentItem:()=>Oc,TextEdit:()=>Yt,URI:()=>Eo,VersionedTextDocumentIdentifier:()=>kc,WorkspaceChange:()=>Fg,WorkspaceEdit:()=>_o,WorkspaceFolder:()=>$f,WorkspaceSymbol:()=>Xc,integer:()=>Ac,uinteger:()=>Ki});var Rc,Eo,Ac,Ki,ie,Q,Wi,Ec,Co,Cc,bc,_c,Sc,bo,wc,Ic,Nc,Vi,nn,Yt,an,Ke,mr,qi,ya,ga,va,_o,ki,Ku,Fg,Pc,kc,Hi,Oc,So,Ta,Lc,Dc,xc,Mc,Gc,Fc,zc,jc,Yi,Bc,Uc,Kc,Wc,Vc,qc,Hc,Yc,Xc,Jc,Zc,Xi,Qc,ef,tf,rf,nf,af,sf,of,lf,uf,cf,ff,df,wo,Io,pf,mf,hf,yf,gf,vf,Tf,$f,zg,Rf,lh,A,xs=bI({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Rc||(Rc={})),(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Eo||(Eo={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ac||(Ac={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ki||(Ki={})),(function(e){function t(n,a){return n===Number.MAX_VALUE&&(n=Ki.MAX_VALUE),a===Number.MAX_VALUE&&(a=Ki.MAX_VALUE),{line:n,character:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&A.uinteger(a.line)&&A.uinteger(a.character)}i(r,"is"),e.is=r})(ie||(ie={})),(function(e){function t(n,a,s,o){if(A.uinteger(n)&&A.uinteger(a)&&A.uinteger(s)&&A.uinteger(o))return{start:ie.create(n,a),end:ie.create(s,o)};if(ie.is(n)&&ie.is(a))return{start:n,end:a};throw new Error(`Range#create called with invalid arguments[${n}, ${a}, ${s}, ${o}]`)}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&ie.is(a.start)&&ie.is(a.end)}i(r,"is"),e.is=r})(Q||(Q={})),(function(e){function t(n,a){return{uri:n,range:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(A.string(a.uri)||A.undefined(a.uri))}i(r,"is"),e.is=r})(Wi||(Wi={})),(function(e){function t(n,a,s,o){return{targetUri:n,targetRange:a,targetSelectionRange:s,originSelectionRange:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.targetRange)&&A.string(a.targetUri)&&Q.is(a.targetSelectionRange)&&(Q.is(a.originSelectionRange)||A.undefined(a.originSelectionRange))}i(r,"is"),e.is=r})(Ec||(Ec={})),(function(e){function t(n,a,s,o){return{red:n,green:a,blue:s,alpha:o}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.numberRange(a.red,0,1)&&A.numberRange(a.green,0,1)&&A.numberRange(a.blue,0,1)&&A.numberRange(a.alpha,0,1)}i(r,"is"),e.is=r})(Co||(Co={})),(function(e){function t(n,a){return{range:n,color:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&Q.is(a.range)&&Co.is(a.color)}i(r,"is"),e.is=r})(Cc||(Cc={})),(function(e){function t(n,a,s){return{label:n,textEdit:a,additionalTextEdits:s}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.undefined(a.textEdit)||Yt.is(a))&&(A.undefined(a.additionalTextEdits)||A.typedArray(a.additionalTextEdits,Yt.is))}i(r,"is"),e.is=r})(bc||(bc={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(_c||(_c={})),(function(e){function t(n,a,s,o,l,u){const c={startLine:n,endLine:a};return A.defined(s)&&(c.startCharacter=s),A.defined(o)&&(c.endCharacter=o),A.defined(l)&&(c.kind=l),A.defined(u)&&(c.collapsedText=u),c}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.uinteger(a.startLine)&&A.uinteger(a.startLine)&&(A.undefined(a.startCharacter)||A.uinteger(a.startCharacter))&&(A.undefined(a.endCharacter)||A.uinteger(a.endCharacter))&&(A.undefined(a.kind)||A.string(a.kind))}i(r,"is"),e.is=r})(Sc||(Sc={})),(function(e){function t(n,a){return{location:n,message:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Wi.is(a.location)&&A.string(a.message)}i(r,"is"),e.is=r})(bo||(bo={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(wc||(wc={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(Ic||(Ic={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&A.string(n.href)}i(t,"is"),e.is=t})(Nc||(Nc={})),(function(e){function t(n,a,s,o,l,u){let c={range:n,message:a};return A.defined(s)&&(c.severity=s),A.defined(o)&&(c.code=o),A.defined(l)&&(c.source=l),A.defined(u)&&(c.relatedInformation=u),c}i(t,"create"),e.create=t;function r(n){var a;let s=n;return A.defined(s)&&Q.is(s.range)&&A.string(s.message)&&(A.number(s.severity)||A.undefined(s.severity))&&(A.integer(s.code)||A.string(s.code)||A.undefined(s.code))&&(A.undefined(s.codeDescription)||A.string((a=s.codeDescription)===null||a===void 0?void 0:a.href))&&(A.string(s.source)||A.undefined(s.source))&&(A.undefined(s.relatedInformation)||A.typedArray(s.relatedInformation,bo.is))}i(r,"is"),e.is=r})(Vi||(Vi={})),(function(e){function t(n,a,...s){let o={title:n,command:a};return A.defined(s)&&s.length>0&&(o.arguments=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.title)&&A.string(a.command)}i(r,"is"),e.is=r})(nn||(nn={})),(function(e){function t(s,o){return{range:s,newText:o}}i(t,"replace"),e.replace=t;function r(s,o){return{range:{start:s,end:s},newText:o}}i(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}i(n,"del"),e.del=n;function a(s){const o=s;return A.objectLiteral(o)&&A.string(o.newText)&&Q.is(o.range)}i(a,"is"),e.is=a})(Yt||(Yt={})),(function(e){function t(n,a,s){const o={label:n};return a!==void 0&&(o.needsConfirmation=a),s!==void 0&&(o.description=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.boolean(a.needsConfirmation)||a.needsConfirmation===void 0)&&(A.string(a.description)||a.description===void 0)}i(r,"is"),e.is=r})(an||(an={})),(function(e){function t(r){const n=r;return A.string(n)}i(t,"is"),e.is=t})(Ke||(Ke={})),(function(e){function t(s,o,l){return{range:s,newText:o,annotationId:l}}i(t,"replace"),e.replace=t;function r(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}i(r,"insert"),e.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}i(n,"del"),e.del=n;function a(s){const o=s;return Yt.is(o)&&(an.is(o.annotationId)||Ke.is(o.annotationId))}i(a,"is"),e.is=a})(mr||(mr={})),(function(e){function t(n,a){return{textDocument:n,edits:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Hi.is(a.textDocument)&&Array.isArray(a.edits)}i(r,"is"),e.is=r})(qi||(qi={})),(function(e){function t(n,a,s){let o={kind:"create",uri:n};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="create"&&A.string(a.uri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ya||(ya={})),(function(e){function t(n,a,s,o){let l={kind:"rename",oldUri:n,newUri:a};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="rename"&&A.string(a.oldUri)&&A.string(a.newUri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ga||(ga={})),(function(e){function t(n,a,s){let o={kind:"delete",uri:n};return a!==void 0&&(a.recursive!==void 0||a.ignoreIfNotExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="delete"&&A.string(a.uri)&&(a.options===void 0||(a.options.recursive===void 0||A.boolean(a.options.recursive))&&(a.options.ignoreIfNotExists===void 0||A.boolean(a.options.ignoreIfNotExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(va||(va={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(a=>A.string(a.kind)?ya.is(a)||ga.is(a)||va.is(a):qi.is(a)))}i(t,"is"),e.is=t})(_o||(_o={})),ki=class{static{i(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,a;if(r===void 0?n=Yt.insert(e,t):Ke.is(r)?(a=r,n=mr.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.insert(e,t,a)),this.edits.push(n),a!==void 0)return a}replace(e,t,r){let n,a;if(r===void 0?n=Yt.replace(e,t):Ke.is(r)?(a=r,n=mr.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.replace(e,t,a)),this.edits.push(n),a!==void 0)return a}delete(e,t){let r,n;if(t===void 0?r=Yt.del(e):Ke.is(t)?(n=t,r=mr.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=mr.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},Ku=class{static{i(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(Ke.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Fg=class{static{i(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Ku(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(qi.is(t)){const r=new ki(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new ki(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Hi.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const n=[],a={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(a),r=new ki(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new ki(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ku,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=ya.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=ya.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let a;an.is(r)||Ke.is(r)?a=r:n=r;let s,o;if(a===void 0?s=ga.create(e,t,n):(o=Ke.is(a)?a:this._changeAnnotations.manage(a),s=ga.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=va.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=va.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}},(function(e){function t(n){return{uri:n}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)}i(r,"is"),e.is=r})(Pc||(Pc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.integer(a.version)}i(r,"is"),e.is=r})(kc||(kc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&(a.version===null||A.integer(a.version))}i(r,"is"),e.is=r})(Hi||(Hi={})),(function(e){function t(n,a,s,o){return{uri:n,languageId:a,version:s,text:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.string(a.languageId)&&A.integer(a.version)&&A.string(a.text)}i(r,"is"),e.is=r})(Oc||(Oc={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){const n=r;return n===e.PlainText||n===e.Markdown}i(t,"is"),e.is=t})(So||(So={})),(function(e){function t(r){const n=r;return A.objectLiteral(r)&&So.is(n.kind)&&A.string(n.value)}i(t,"is"),e.is=t})(Ta||(Ta={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Lc||(Lc={})),(function(e){e.PlainText=1,e.Snippet=2})(Dc||(Dc={})),(function(e){e.Deprecated=1})(xc||(xc={})),(function(e){function t(n,a,s){return{newText:n,insert:a,replace:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a&&A.string(a.newText)&&Q.is(a.insert)&&Q.is(a.replace)}i(r,"is"),e.is=r})(Mc||(Mc={})),(function(e){e.asIs=1,e.adjustIndentation=2})(Gc||(Gc={})),(function(e){function t(r){const n=r;return n&&(A.string(n.detail)||n.detail===void 0)&&(A.string(n.description)||n.description===void 0)}i(t,"is"),e.is=t})(Fc||(Fc={})),(function(e){function t(r){return{label:r}}i(t,"create"),e.create=t})(zc||(zc={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}i(t,"create"),e.create=t})(jc||(jc={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i(t,"fromPlainText"),e.fromPlainText=t;function r(n){const a=n;return A.string(a)||A.objectLiteral(a)&&A.string(a.language)&&A.string(a.value)}i(r,"is"),e.is=r})(Yi||(Yi={})),(function(e){function t(r){let n=r;return!!n&&A.objectLiteral(n)&&(Ta.is(n.contents)||Yi.is(n.contents)||A.typedArray(n.contents,Yi.is))&&(r.range===void 0||Q.is(r.range))}i(t,"is"),e.is=t})(Bc||(Bc={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}i(t,"create"),e.create=t})(Uc||(Uc={})),(function(e){function t(r,n,...a){let s={label:r};return A.defined(n)&&(s.documentation=n),A.defined(a)?s.parameters=a:s.parameters=[],s}i(t,"create"),e.create=t})(Kc||(Kc={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(Wc||(Wc={})),(function(e){function t(r,n){let a={range:r};return A.number(n)&&(a.kind=n),a}i(t,"create"),e.create=t})(Vc||(Vc={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(qc||(qc={})),(function(e){e.Deprecated=1})(Hc||(Hc={})),(function(e){function t(r,n,a,s,o){let l={name:r,kind:n,location:{uri:s,range:a}};return o&&(l.containerName=o),l}i(t,"create"),e.create=t})(Yc||(Yc={})),(function(e){function t(r,n,a,s){return s!==void 0?{name:r,kind:n,location:{uri:a,range:s}}:{name:r,kind:n,location:{uri:a}}}i(t,"create"),e.create=t})(Xc||(Xc={})),(function(e){function t(n,a,s,o,l,u){let c={name:n,detail:a,kind:s,range:o,selectionRange:l};return u!==void 0&&(c.children=u),c}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.name)&&A.number(a.kind)&&Q.is(a.range)&&Q.is(a.selectionRange)&&(a.detail===void 0||A.string(a.detail))&&(a.deprecated===void 0||A.boolean(a.deprecated))&&(a.children===void 0||Array.isArray(a.children))&&(a.tags===void 0||Array.isArray(a.tags))}i(r,"is"),e.is=r})(Jc||(Jc={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(Zc||(Zc={})),(function(e){e.Invoked=1,e.Automatic=2})(Xi||(Xi={})),(function(e){function t(n,a,s){let o={diagnostics:n};return a!=null&&(o.only=a),s!=null&&(o.triggerKind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.typedArray(a.diagnostics,Vi.is)&&(a.only===void 0||A.typedArray(a.only,A.string))&&(a.triggerKind===void 0||a.triggerKind===Xi.Invoked||a.triggerKind===Xi.Automatic)}i(r,"is"),e.is=r})(Qc||(Qc={})),(function(e){function t(n,a,s){let o={title:n},l=!0;return typeof a=="string"?(l=!1,o.kind=a):nn.is(a)?o.command=a:o.edit=a,l&&s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.title)&&(a.diagnostics===void 0||A.typedArray(a.diagnostics,Vi.is))&&(a.kind===void 0||A.string(a.kind))&&(a.edit!==void 0||a.command!==void 0)&&(a.command===void 0||nn.is(a.command))&&(a.isPreferred===void 0||A.boolean(a.isPreferred))&&(a.edit===void 0||_o.is(a.edit))}i(r,"is"),e.is=r})(ef||(ef={})),(function(e){function t(n,a){let s={range:n};return A.defined(a)&&(s.data=a),s}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.command)||nn.is(a.command))}i(r,"is"),e.is=r})(tf||(tf={})),(function(e){function t(n,a){return{tabSize:n,insertSpaces:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.uinteger(a.tabSize)&&A.boolean(a.insertSpaces)}i(r,"is"),e.is=r})(rf||(rf={})),(function(e){function t(n,a,s){return{range:n,target:a,data:s}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.target)||A.string(a.target))}i(r,"is"),e.is=r})(nf||(nf={})),(function(e){function t(n,a){return{range:n,parent:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(a.parent===void 0||e.is(a.parent))}i(r,"is"),e.is=r})(af||(af={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(sf||(sf={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(of||(of={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i(t,"is"),e.is=t})(lf||(lf={})),(function(e){function t(n,a){return{range:n,text:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.string(a.text)}i(r,"is"),e.is=r})(uf||(uf={})),(function(e){function t(n,a,s){return{range:n,variableName:a,caseSensitiveLookup:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.boolean(a.caseSensitiveLookup)&&(A.string(a.variableName)||a.variableName===void 0)}i(r,"is"),e.is=r})(cf||(cf={})),(function(e){function t(n,a){return{range:n,expression:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&(A.string(a.expression)||a.expression===void 0)}i(r,"is"),e.is=r})(ff||(ff={})),(function(e){function t(n,a){return{frameId:n,stoppedLocation:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.defined(a)&&Q.is(n.stoppedLocation)}i(r,"is"),e.is=r})(df||(df={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}i(t,"is"),e.is=t})(wo||(wo={})),(function(e){function t(n){return{value:n}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.location===void 0||Wi.is(a.location))&&(a.command===void 0||nn.is(a.command))}i(r,"is"),e.is=r})(Io||(Io={})),(function(e){function t(n,a,s){const o={position:n,label:a};return s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&ie.is(a.position)&&(A.string(a.label)||A.typedArray(a.label,Io.is))&&(a.kind===void 0||wo.is(a.kind))&&a.textEdits===void 0||A.typedArray(a.textEdits,Yt.is)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.paddingLeft===void 0||A.boolean(a.paddingLeft))&&(a.paddingRight===void 0||A.boolean(a.paddingRight))}i(r,"is"),e.is=r})(pf||(pf={})),(function(e){function t(r){return{kind:"snippet",value:r}}i(t,"createSnippet"),e.createSnippet=t})(mf||(mf={})),(function(e){function t(r,n,a,s){return{insertText:r,filterText:n,range:a,command:s}}i(t,"create"),e.create=t})(hf||(hf={})),(function(e){function t(r){return{items:r}}i(t,"create"),e.create=t})(yf||(yf={})),(function(e){e.Invoked=0,e.Automatic=1})(gf||(gf={})),(function(e){function t(r,n){return{range:r,text:n}}i(t,"create"),e.create=t})(vf||(vf={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}i(t,"create"),e.create=t})(Tf||(Tf={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&Eo.is(n.uri)&&A.string(n.name)}i(t,"is"),e.is=t})($f||($f={})),zg=[` `,`\r `,"\r"],(function(e){function t(s,o,l,u){return new lh(s,o,l,u)}i(t,"create"),e.create=t;function r(s){let o=s;return!!(A.defined(o)&&A.string(o.uri)&&(A.undefined(o.languageId)||A.string(o.languageId))&&A.uinteger(o.lineCount)&&A.func(o.getText)&&A.func(o.positionAt)&&A.func(o.offsetAt))}i(r,"is"),e.is=r;function n(s,o){let l=s.getText(),u=a(o,(f,d)=>{let m=f.range.start.line-d.range.start.line;return m===0?f.range.start.character-d.range.start.character:m}),c=l.length;for(let f=u.length-1;f>=0;f--){let d=u[f],m=s.offsetAt(d.range.start),g=s.offsetAt(d.range.end);if(g<=c)l=l.substring(0,m)+d.newText+l.substring(g,l.length);else throw new Error("Overlapping edit");c=m}return l}i(n,"applyEdits"),e.applyEdits=n;function a(s,o){if(s.length<=1)return s;const l=s.length/2|0,u=s.slice(0,l),c=s.slice(l);a(u,o),a(c,o);let f=0,d=0,m=0;for(;f({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,G=-x/C,ht=$/C,et=M+G*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Vt={draw:_t},Et=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return` +import{p as xt}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{s as gt,g as $t,p as bt,o as wt,a as Ct,b as vt,_ as s,l as O,F as Dt,e as kt,q as Tt,B as U,z as Q,D as At,W as ot}from"./mermaid.core-CJB1tAev.js";import{p as Bt}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,G=-x/C,ht=$/C,et=M+G*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Vt={draw:_t},Et=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return` .cynefinDomain { stroke: none; } diff --git a/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CDFnWuZ_.js b/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js similarity index 97% rename from apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CDFnWuZ_.js rename to apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js index f6280a8f8a9..b6eae6b18c3 100644 --- a/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CDFnWuZ_.js +++ b/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js @@ -1,4 +1,4 @@ -import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-BHZEnq1y.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-Cahi9cr1.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,m,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==m&&r.add(i),n!==m&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,m=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(m,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",m=0,c={})=>{const r=s.x,f=s.y-m,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const m=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;m.has(h)||m.set(h,[]),m.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),m.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},y=Z(s,n,r,i.start,o),X=ee(n,y,t,p.width??0),S=te(n,X,y,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,m,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX +import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-Df2V79id.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-CJB1tAev.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,m,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==m&&r.add(i),n!==m&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,m=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(m,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",m=0,c={})=>{const r=s.x,f=s.y-m,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const m=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;m.has(h)||m.set(h,[]),m.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),m.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},y=Z(s,n,r,i.start,o),X=ee(n,y,t,p.width??0),S=te(n,X,y,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,m,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX Node.id = `,d,` data=`,u.height,` Parent cluster`,c.height),t.setNode(c.id,u),t.parent(d)||(l.trace("Setting parent",d,c.id),t.setParent(d,c.id,u))}if(l.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),e?.clusterNode){l.info("Cluster identified XBX",d,e.width,t.node(d));const{ranksep:u,nodesep:x}=t.graph();e.graph.setGraph({...e.graph.graph(),ranksep:u+25,nodesep:x});const N=await T(n,e.graph,g,m,t.node(d),o),M=N.elem;W(e,M),e.diff=N.diff||0,l.info("New compound node after recursive render XAX",d,"width",e.width,"height",e.height),$(M,e)}else t.children(d).length>0?(l.trace("Cluster - the non recursive path XBX",d,e.id,e,e.width,"Graph:",t),l.trace(P(e.id,t)),E.set(e.id,{id:P(e.id,t),node:e})):(l.trace("Node - the non recursive path XAX",d,n,t.node(d),r),await j(n,t.node(d),{config:o,dir:r}))})),await w(async()=>{const d=t.edges().map(async function(e){const u=t.edge(e.v,e.w,e.name);if(l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),l.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),l.info("Fix",E,"ids:",e.v,e.w,"Translating: ",E.get(e.v),E.get(e.w)),p&&u.selfLoop){if(u.selfLoop.order!==1)return;const x=u.id;u.id=u.selfLoop.id,await G(i,u),u.id=x;return}await G(i,u)});await Promise.all(d)},"processEdges")(),l.info("Graph before layout:",JSON.stringify(I(t))),l.info("############################################# XXX"),l.info("### Layout ### XXX"),l.info("############################################# XXX"),U(t),l.info("Graph after layout:",JSON.stringify(I(t)));let X=0,{subGraphTitleTotalMargin:S}=q(o);await Promise.all(A(t).map(async function(d){const e=t.node(d);if(l.info("Position XBX => "+d+": ("+e.x,","+e.y,") width: ",e.width," height: ",e.height),e?.clusterNode)e.y+=S,l.info("A tainted cluster node XBX1",d,e.id,e.width,e.height,e.x,e.y,t.parent(d)),E.get(e.id).node=e,R(e);else if(t.children(d).length>0){l.info("A pure cluster node XBX1",d,e.id,e.x,e.y,e.width,e.height,t.parent(d)),e.height+=S,t.node(e.parentId);const u=e?.padding/2||0,x=e?.labelBBox?.height||0,N=x-u||0;l.debug("OffsetY",N,"labelHeight",x,"halfPadding",u),await F(h,e),E.get(e.id).node=e}else{const u=t.node(e.parentId);e.y+=S/2,l.info("A regular node XBX1 - using the padding",e.id,"parent",e.parentId,e.width,e.height,e.x,e.y,"offsetY",e.offsetY,"parent",u,u?.offsetY,e),R(e)}}));const b=S/2;return ne(t,b,{mergeSelfLoops:p}).forEach(function({edge:d,start:e,end:u}){l.info("Edge "+e+" -> "+u+": "+JSON.stringify(d),d),d.points.forEach(k=>k.y+=b);const x=t.node(e),N=t.node(u),M=z(a,d,E,g,x,N,m);K(d,M)}),t.nodes().forEach(function(d){const e=t.node(d);l.info(d,e.type,e.diff),e.isGroup&&(X=e.diff)}),l.warn("Returning from recursive render XAX",f,X),{elem:f,diff:X}},"recursiveRender"),le=w(async(s,t)=>{const g=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:s.direction,nodesep:s.config?.nodeSpacing||s.config?.flowchart?.nodeSpacing||s.nodeSpacing,ranksep:s.config?.rankSpacing||s.config?.flowchart?.rankSpacing||s.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),m=t.select("g");v(m,s.markers,s.type,s.diagramId),D(),H(),Y(),O(),s.nodes.forEach(o=>{g.setNode(o.id,{...o}),o.parentId&&g.setParent(o.id,o.parentId)}),l.debug("Edges:",s.edges),s.edges.forEach(o=>{if(o.start===o.end){const r=o.start,f=r+"---"+r+"---1",h=r+"---"+r+"---2",a=g.node(r);g.setNode(f,{domId:f,id:f,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),g.setParent(f,a.parentId),g.setNode(h,{domId:h,id:h,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),g.setParent(h,a.parentId);const i=structuredClone(o),n=structuredClone(o),p=structuredClone(o),y=structuredClone(o);n.originalEdge=i,n.selfLoop={id:i.id,order:0},p.originalEdge=i,p.selfLoop={id:i.id,order:1},y.originalEdge=i,y.selfLoop={id:i.id,order:2},n.label="",n.arrowTypeEnd="none",n.endLabelLeft="",n.endLabelRight="",n.startLabelLeft="",n.id=r+"-cyclic-special-1",p.startLabelRight="",p.startLabelLeft="",p.endLabelLeft="",p.endLabelRight="",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=r+"-cyclic-special-mid",y.label="",y.startLabelRight="",y.startLabelLeft="",y.arrowTypeStart="none",a.isGroup&&(n.fromCluster=r,y.toCluster=r),y.id=r+"-cyclic-special-2",y.arrowTypeStart="none",g.setEdge(r,f,n,r+"-cyclic-special-0"),g.setEdge(f,h,p,r+"-cyclic-special-1"),g.setEdge(h,r,y,r+"-cyclic-special-2")}else g.setEdge(o.start,o.end,{...o},o.id)}),l.warn("Graph at first:",JSON.stringify(I(g))),J(g),l.warn("Graph after XAX:",JSON.stringify(I(g)));const c=_();await T(m,g,s.type,s.diagramId,void 0,c)},"render");export{ne as getEdgesToRender,le as render}; diff --git a/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-Cqley8W-.js b/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js similarity index 98% rename from apps/kimi-code/dist-web/assets/diagram-FQU43EPY-Cqley8W-.js rename to apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js index 8c54a47a89e..f0cf49a2553 100644 --- a/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-Cqley8W-.js +++ b/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js @@ -1,3 +1,3 @@ -import{p as re}from"./chunk-JWPE2WC7-DTx-f56M.js";import{p as oe,o as se,s as de,g as le,a as ce,b as me,_ as o,l as g,c as D,d as ue,A as xe,q as fe,B as ge,z as M,D as he,i as y,w as P,ak as pe}from"./mermaid.core-Cahi9cr1.js";import{p as be,i as ve}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var T="position frame",$="frame positioned",S="position relation",N="relation positioned",we=o(function(e){g.debug("options str",e)},"setOptions"),ye=o(function(){return{}},"getOptions"),Pe=o(function(){C(),fe()},"clear");function C(){B={}}o(C,"reset");var Se=he.eventmodeling,ke=o(()=>ge({...Se,...M().eventmodeling}),"getConfig"),B={};function O(){let e=Fe;const{ast:n}=B,t=E();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=v(e,{$kind:T,index:a,frame:i,textProps:r});let d;K(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=v(e,{$kind:S,index:a,frame:i,sourceFrame:l})})):e=v(e,{$kind:S,index:a,frame:i})}),e={...e,sortedSwimlanesArray:A(e.swimlanes)},e}o(O,"getState");function I(e){B.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function E(){return s}o(E,"getDiagramProps");var Fe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function W(e){const n=e.split(".");if(n.length===2)return n[0]}o(W,"extractNamespace");function H(e){const n=e.split(".");return n.length===2?n[1]:e}o(H,"extractName");function U(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(U,"findSwimlaneByNamespace");function b(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(b,"findNextAvailableIndex");function _(e,n){const t=W(e.entityIdentifier),i=U(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:b(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:b(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:b(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=M();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function G(e,n,t){const i=M(),a=y(H(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${P(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(w=>w.name===e.dataReference?.$refText);p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as re}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{p as oe,o as se,s as de,g as le,a as ce,b as me,_ as o,l as g,c as D,d as ue,A as xe,q as fe,B as ge,z as M,D as he,i as y,w as P,ak as pe}from"./mermaid.core-CJB1tAev.js";import{p as be,i as ve}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var T="position frame",$="frame positioned",S="position relation",N="relation positioned",we=o(function(e){g.debug("options str",e)},"setOptions"),ye=o(function(){return{}},"getOptions"),Pe=o(function(){C(),fe()},"clear");function C(){B={}}o(C,"reset");var Se=he.eventmodeling,ke=o(()=>ge({...Se,...M().eventmodeling}),"getConfig"),B={};function O(){let e=Fe;const{ast:n}=B,t=E();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=v(e,{$kind:T,index:a,frame:i,textProps:r});let d;K(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=v(e,{$kind:S,index:a,frame:i,sourceFrame:l})})):e=v(e,{$kind:S,index:a,frame:i})}),e={...e,sortedSwimlanesArray:A(e.swimlanes)},e}o(O,"getState");function I(e){B.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function E(){return s}o(E,"getDiagramProps");var Fe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function W(e){const n=e.split(".");if(n.length===2)return n[0]}o(W,"extractNamespace");function H(e){const n=e.split(".");return n.length===2?n[1]:e}o(H,"extractName");function U(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(U,"findSwimlaneByNamespace");function b(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(b,"findNextAvailableIndex");function _(e,n){const t=W(e.entityIdentifier),i=U(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:b(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:b(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:b(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=M();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function G(e,n,t){const i=M(),a=y(H(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
"};let c=`${P(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(w=>w.name===e.dataReference?.$refText);p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="
")}const m=r!==void 0;m&&(c+=`

${r}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(G,"calculateTextProps");function V(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:$,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(V,"decidePositionFrame");function X(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(X,"calculateX");function j(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(j,"calculateMaxRight");function A(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o(A,"sortedSwimlanesArray");function Y(e,n){const t=n,i=_(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=X(a,d,r),m=c+l.width+s.boxPadding,x=j(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=A(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(K,"hasSourceFrame");function k(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(k,"findBoxByFrame");function q(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(q,"findBoxByLineIndex");function J(e,n){const t=n;if(ve(t.frame)||z(t.index,t.frame))return[];const i=k(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=k(e.boxes,t.sourceFrame):a=q(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:N,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(J,"decidePositionRelation");function Q(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Q,"evolveRelationPositioned");var Me={[T]:V,[S]:J},Be={[$]:Y,[N]:Q};function Z(e,n){const t=Me[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(Z,"decide");function ee(e,n){const t=n.reduce((i,a)=>{const r=Be[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(ee,"evolve");function v(e,n){const t=Z(e,n);return ee(e,t)}o(v,"dispatch");var F={getConfig:ke,setOptions:we,getOptions:ye,clear:Pe,setAccTitle:me,getAccTitle:ce,getAccDescription:le,setAccDescription:de,setDiagramTitle:se,getDiagramTitle:oe,setAst:I,getDiagramProps:E,getState:O},Ee={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),F.setAst(n),re(n,F)},"parse")},Ae=D(),Re=Ae?.eventmodeling;function te(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(te,"renderD3Box");function ne(e,n){return e>n}o(ne,"dirUpwards");function ie(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ne(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ie,"renderD3Relation");function ae(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(ae,"renderD3Swimlane");var De=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=D(),l=ue(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(ae(l,m.maxR,c,r)),m.boxes.forEach(te(l,c)),m.relations.forEach(ie(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,d?.padding??30,d?.useMaxWidth)},"draw"),Te={draw:De},$e=o(e=>"","getStyles"),Ne=$e,Ue={parser:Ee,db:F,renderer:Te,styles:Ne};export{Ue as diagram}; diff --git a/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-jJWknpV7.js b/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js similarity index 97% rename from apps/kimi-code/dist-web/assets/diagram-G47NLZAW-jJWknpV7.js rename to apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js index 4cfba9e28b2..646a8516187 100644 --- a/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-jJWknpV7.js +++ b/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js @@ -1,4 +1,4 @@ -import{p as me}from"./chunk-JWPE2WC7-DTx-f56M.js";import{_ as w,W as ge,z as te,B as Q,F as ye,e as Se,l as ee,be as B,d as j,b as ve,a as xe,o as be,p as we,g as Ce,s as Te,D as Le,bf as $e,q as Ae}from"./mermaid.core-Cahi9cr1.js";import{s as Fe}from"./chunk-VR4S4FIN-he8WxbY-.js";import{p as Ne}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Me(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function _e(){return this.eachAfter(Me)}function ke(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function ze(e,a){for(var n=this,l=[n],r,o,h=-1;n=l.pop();)if(e.call(a,n,++h,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ve(e,a){for(var n=this,l=[n],r=[],o,h,d,g=-1;n=l.pop();)if(r.push(n),o=n.children)for(h=0,d=o.length;h=0;)n+=l[r].value;a.value=n})}function Be(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function We(e){for(var a=this,n=Ee(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function Ee(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function Re(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function He(){return Array.from(this)}function Ie(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Oe(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*qe(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r=0;--d)r.push(o=h[d]=new U(h[d])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ue)}function Ge(){return ae(this).eachBefore(je)}function Xe(e){return e.children}function Ye(e){return Array.isArray(e)?e[1]:null}function je(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ue(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=ae.prototype={constructor:U,count:_e,each:ke,eachAfter:Ve,eachBefore:ze,find:De,sum:Pe,sort:Be,path:We,ancestors:Re,descendants:He,leaves:Ie,links:Oe,copy:Ge,[Symbol.iterator]:qe};function Ze(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function q(e){return function(){return e}}function Je(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ke(e,a,n,l,r){for(var o=e.children,h,d=-1,g=o.length,c=e.value&&(l-a)/e.value;++dN&&(N=c),M=u*u*E,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?l:1)},n})(et);function nt(){var e=at,a=!1,n=1,l=1,r=[0],o=O,h=O,d=O,g=O,c=O;function p(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u{$e(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Ae(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function oe(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(oe,"buildHierarchy");var lt=w((e,a)=>{me(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const h=o.item;if(!h)continue;const d=o.indent?parseInt(o.indent):0,g=rt(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};n.push(b)}const l=oe(n),r=w((o,h)=>{for(const d of o)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(l,0)},"populate"),rt=w(e=>e.name?String(e.name):"","getItemName"),ce={parser:{yy:void 0},parse:w(async e=>{try{const n=await Ne("treemap",e);ee.debug("Treemap AST:",n);const l=ce.parser?.yy;if(!(l instanceof ie))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");lt(n,l)}catch(a){throw ee.error("Error parsing treemap:",a),a}},"parse")},st=10,W=10,G=25,it=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),h=o.padding??st,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=te();if(!g)return;const p=d?30:0,b=ye(a),s=o.nodeWidth?o.nodeWidth*W:960,x=o.nodeHeight?o.nodeHeight*W:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),Se(b,v,S,o.useMaxWidth);let u;try{const t=o.valueFormat||",";if(t==="$0,0")u=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";u=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);u=w(f=>"$"+I(i||"")(f),"valueFormat")}else u=I(t)}catch(t){ee.error("Error creating format function:",t),u=I(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),E=ae(g).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),ne=nt().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?G+W:0).paddingInner(h).paddingLeft(t=>t.children&&t.children.length>0?W:0).paddingRight(t=>t.children&&t.children.length>0?W:0).paddingBottom(t=>t.children&&t.children.length>0?W:0).round(!0)(E),he=ne.descendants().filter(t=>t.children&&t.children.length>0),R=V.selectAll(".treemapSection").data(he).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",G),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>y(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>N(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=B({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("clip-path",(t,i)=>`url(#clip-section-${a}-${i})`).attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=j(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let T;o.showValues!==!1&&t.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=i.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){i.text("..."),_.getComputedTextLength()>m&&i.text("");break}if(i.text(z+"..."),_.getComputedTextLength()<=m)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?u(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const le=ne.leaves(),A=le.length>20,de=A?16:38,X=A?14:28,D=A?4:8,H=A?4:6,Z=A?2:4,re=A?8:10,J=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(le).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);Y.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("style",t=>B({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i=`text-anchor: middle; dominant-baseline: middle; font-size: ${de}px;fill:`+$(t.data.name)+";",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=j(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),T=f-2*Z,P=C-2*Z;if(TT&&m>D;)m--,i.style("font-size",`${m}px`);let F=Math.max(H,Math.min(X,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(H,Math.min(X,Math.round(m*_))),!(FT||m(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${X}px;fill:`+$(i.data.name)+";",C=B({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?u(i.value):"").each(function(i){const f=j(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=j(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(H,Math.min(X,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(i.y1-i.y0)/2+T/2+J;f.attr("y",F);const k=i.x1-i.x0,se=i.y1-i.y0-4,fe=k-2*Z;f.node().getComputedTextLength()>fe||F+m>se||m{const a=ge(),n=te(),l=Q(a,n.themeVariables),r=Q(ht,e),o=r.titleColor??l.titleColor,h=r.labelColor??l.textColor,d=r.valueColor??l.textColor;return` +import{p as me}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as w,W as ge,z as te,B as Q,F as ye,e as Se,l as ee,be as B,d as j,b as ve,a as xe,o as be,p as we,g as Ce,s as Te,D as Le,bf as $e,q as Ae}from"./mermaid.core-CJB1tAev.js";import{s as Fe}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{p as Ne}from"./cynefin-VYW2F7L2-BIlq342y.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Me(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function _e(){return this.eachAfter(Me)}function ke(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function ze(e,a){for(var n=this,l=[n],r,o,h=-1;n=l.pop();)if(e.call(a,n,++h,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ve(e,a){for(var n=this,l=[n],r=[],o,h,d,g=-1;n=l.pop();)if(r.push(n),o=n.children)for(h=0,d=o.length;h=0;)n+=l[r].value;a.value=n})}function Be(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function We(e){for(var a=this,n=Ee(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function Ee(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function Re(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function He(){return Array.from(this)}function Ie(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Oe(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*qe(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r=0;--d)r.push(o=h[d]=new U(h[d])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ue)}function Ge(){return ae(this).eachBefore(je)}function Xe(e){return e.children}function Ye(e){return Array.isArray(e)?e[1]:null}function je(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ue(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=ae.prototype={constructor:U,count:_e,each:ke,eachAfter:Ve,eachBefore:ze,find:De,sum:Pe,sort:Be,path:We,ancestors:Re,descendants:He,leaves:Ie,links:Oe,copy:Ge,[Symbol.iterator]:qe};function Ze(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function q(e){return function(){return e}}function Je(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ke(e,a,n,l,r){for(var o=e.children,h,d=-1,g=o.length,c=e.value&&(l-a)/e.value;++dN&&(N=c),M=u*u*E,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?l:1)},n})(et);function nt(){var e=at,a=!1,n=1,l=1,r=[0],o=O,h=O,d=O,g=O,c=O;function p(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u{$e(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Ae(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function oe(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(oe,"buildHierarchy");var lt=w((e,a)=>{me(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const h=o.item;if(!h)continue;const d=o.indent?parseInt(o.indent):0,g=rt(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};n.push(b)}const l=oe(n),r=w((o,h)=>{for(const d of o)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(l,0)},"populate"),rt=w(e=>e.name?String(e.name):"","getItemName"),ce={parser:{yy:void 0},parse:w(async e=>{try{const n=await Ne("treemap",e);ee.debug("Treemap AST:",n);const l=ce.parser?.yy;if(!(l instanceof ie))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");lt(n,l)}catch(a){throw ee.error("Error parsing treemap:",a),a}},"parse")},st=10,W=10,G=25,it=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),h=o.padding??st,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=te();if(!g)return;const p=d?30:0,b=ye(a),s=o.nodeWidth?o.nodeWidth*W:960,x=o.nodeHeight?o.nodeHeight*W:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),Se(b,v,S,o.useMaxWidth);let u;try{const t=o.valueFormat||",";if(t==="$0,0")u=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";u=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);u=w(f=>"$"+I(i||"")(f),"valueFormat")}else u=I(t)}catch(t){ee.error("Error creating format function:",t),u=I(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),E=ae(g).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),ne=nt().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?G+W:0).paddingInner(h).paddingLeft(t=>t.children&&t.children.length>0?W:0).paddingRight(t=>t.children&&t.children.length>0?W:0).paddingBottom(t=>t.children&&t.children.length>0?W:0).round(!0)(E),he=ne.descendants().filter(t=>t.children&&t.children.length>0),R=V.selectAll(".treemapSection").data(he).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",G),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>y(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>N(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=B({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("clip-path",(t,i)=>`url(#clip-section-${a}-${i})`).attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=j(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let T;o.showValues!==!1&&t.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=i.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){i.text("..."),_.getComputedTextLength()>m&&i.text("");break}if(i.text(z+"..."),_.getComputedTextLength()<=m)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?u(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const le=ne.leaves(),A=le.length>20,de=A?16:38,X=A?14:28,D=A?4:8,H=A?4:6,Z=A?2:4,re=A?8:10,J=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(le).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);Y.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("style",t=>B({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i=`text-anchor: middle; dominant-baseline: middle; font-size: ${de}px;fill:`+$(t.data.name)+";",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=j(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),T=f-2*Z,P=C-2*Z;if(TT&&m>D;)m--,i.style("font-size",`${m}px`);let F=Math.max(H,Math.min(X,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(H,Math.min(X,Math.round(m*_))),!(FT||m(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${X}px;fill:`+$(i.data.name)+";",C=B({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?u(i.value):"").each(function(i){const f=j(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=j(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(H,Math.min(X,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(i.y1-i.y0)/2+T/2+J;f.attr("y",F);const k=i.x1-i.x0,se=i.y1-i.y0-4,fe=k-2*Z;f.node().getComputedTextLength()>fe||F+m>se||m{const a=ge(),n=te(),l=Q(a,n.themeVariables),r=Q(ht,e),o=r.titleColor??l.titleColor,h=r.labelColor??l.textColor,d=r.valueColor??l.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-iqDRMohg.js b/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js similarity index 93% rename from apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-iqDRMohg.js rename to apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js index fc3f9fa4bf1..bc899383c68 100644 --- a/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-iqDRMohg.js +++ b/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js @@ -1,4 +1,4 @@ -import{p as B}from"./chunk-JWPE2WC7-DTx-f56M.js";import{_ as b,B as u,F as $,e as C,l as m,b as S,a as D,o as T,p as z,g as F,s as P,z as E,D as A,q as W}from"./mermaid.core-Cahi9cr1.js";import{p as _}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var N=A.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=z,this.getAccDescription=F,this.setAccDescription=P}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),j={draw:I},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},G=b(({packet:t}={})=>{const e=u(q,t);return` +import{p as B}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as b,B as u,F as $,e as C,l as m,b as S,a as D,o as T,p as z,g as F,s as P,z as E,D as A,q as W}from"./mermaid.core-CJB1tAev.js";import{p as _}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var N=A.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=z,this.getAccDescription=F,this.setAccDescription=P}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),j={draw:I},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},G=b(({packet:t}={})=>{const e=u(q,t);return` .packetByte { font-size: ${e.byteFontSize}; } diff --git a/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-DSnuTLFG.js b/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js similarity index 96% rename from apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-DSnuTLFG.js rename to apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js index 7a0f11d802e..dd7fa5554fd 100644 --- a/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-DSnuTLFG.js +++ b/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js @@ -1,4 +1,4 @@ -import{I as X}from"./chunk-2Q5K7J3B-B47YykJY.js";import{p as O}from"./chunk-JWPE2WC7-DTx-f56M.js";import{o as G,b as Y,s as F,p as P,g as j,a as q,_ as f,B as A,l as D,F as Z,e as U,z as N,q as J,i as K,ai as Q,D as ee,aj as te}from"./mermaid.core-Cahi9cr1.js";import{p as ne}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(` +import{I as X}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{p as O}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{o as G,b as Y,s as F,p as P,g as j,a as q,_ as f,B as A,l as D,F as Z,e as U,z as N,q as J,i as K,ai as Q,D as ee,aj as te}from"./mermaid.core-CJB1tAev.js";import{p as ne}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(` `),t=new Map;let r=-1;for(const[s,o]of e.entries())if(o.trim()==="treeView-beta"){r=s;break}if(r===-1)return{text:n,lineMap:t};const i=[];for(let s=r+1;s({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),oe=f(()=>{x.reset(),J()},"clear"),se=f(()=>x.records.stack[0],"getRoot"),ae=f(()=>x.records.cnt,"getCount"),ce=ee.treeView,le=f(()=>A(ce,N().treeView),"getConfig"),de=f((n,e,t,r,i,a)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const c={id:x.records.cnt++,level:n,name:e,nodeType:t,icon:i,cssClass:r,description:a,children:[]};x.records.stack[x.records.stack.length-1].children.push(c),x.records.stack.push(c)},"addNode"),he={clear:oe,addNode:de,getRoot:se,getCount:ae,getConfig:le,getAccTitle:q,getAccDescription:j,getDiagramTitle:P,setAccDescription:F,setAccTitle:Y,setDiagramTitle:G},I=he,pe=f(n=>{O(n,I);for(const e of n.nodes){const t=typeof e.indent=="number"?e.indent:0;let r=e.name;const i=r.endsWith("/");i&&(r=r.slice(0,-1));const a=i?"directory":"file",c=e.classAnnotation||void 0,l=e.iconAnnotation,s=l!==void 0?l||"none":void 0,o=e.descAnnotation||void 0,h=o?K(o,N()):void 0;I.addNode(t,r,a,c,s,h)}},"populate"),fe={parse:f(async n=>{const{text:e,lineMap:t}=R(n);try{const r=await ne("treeView",e);D.debug(r),pe(r)}catch(r){throw t.size>0&&r instanceof Error&&(r.message=M(r.message,t)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function z(n,e){const t=e?.filenameIcons?.[n];if(t)return t;const r=n.lastIndexOf(".");if(r>0){const i=n.substring(r).toLowerCase(),a=e?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}f(z,"detectIcon");function C(n,e){return n.includes(":")?n:n in b.icons||!e?`${b.prefix}:${n}`:`${e}:${n}`}f(C,"qualifyIcon");function B(n,e){if(n.icon!=="none"){if(n.icon)return C(n.icon,e.defaultIconPack);if(e.showIcons){if(n.nodeType==="file"){const t=z(n.name,e);if(t==="none")return;if(t)return C(t,e.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}f(B,"getNodeIcon");te([{name:b.prefix,icons:b}]);var y=14,ge=4,ue=16,H=f((n,e)=>`tv-icon-${n}-${e.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),we=f(async(n,e,t,r)=>{const i=new Set,a=f(s=>{const o=B(s,t);o&&i.add(o),s.children.forEach(a)},"collect");if(a(e),i.size===0)return;const c=await Promise.all([...i].map(async s=>({icon:s,svg:await Q(s,{height:y,width:y})}))),l=n.append("defs");for(const{icon:s,svg:o}of c)l.append("g").attr("id",H(r,s)).html(o)},"injectIconDefs"),me=f((n,e,t,r,i,a)=>{const c=r.append("g");let l="treeView-node-label";t.nodeType==="directory"&&(l+=" treeView-node-dir"),t.cssClass&&(l+=` ${t.cssClass}`);const s=y+ge,o=B(t,i),h=o!==void 0;o&&c.append("use").attr("xlink:href",`#${H(a,o)}`).attr("x",n+i.paddingX).attr("y",e+i.paddingY).attr("class","treeView-node-icon");const p=c.append("text").text(t.name).attr("dominant-baseline","middle").attr("class",l),{height:d,width:w}=p.node().getBBox(),g=d+i.paddingY*2,m=n+i.paddingX+(h?s:0);p.attr("x",m),p.attr("y",e+g/2);const u=m+w,v=w+i.paddingX*2+(h?s:0);return t.BBox={x:n,y:e,width:v,height:g},t.cssClass?.split(/\s+/).includes("highlight")&&c.insert("rect",":first-child").attr("x",n).attr("y",e+1).attr("width",0).attr("height",g-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:t,nodeGroup:c,labelRightEdge:u,centerY:e+g/2}},"positionLabel"),T=f((n,e,t,r,i,a)=>n.append("line").attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),xe=f((n,e,t,r)=>{let i=0,a=0;const c=[],l=f((h,p,d,w)=>{const g=w*(d.rowIndent+d.paddingX),m=me(g,i,p,h,d,r);c.push(m);const{height:u,width:v}=p.BBox;T(h,g-d.rowIndent,i+u/2,g,i+u/2,d.lineThickness),a=Math.max(a,g+v),i+=u},"drawNode"),s=f((h,p=0)=>{l(n,h,t,p),h.children.forEach(m=>{s(m,p+1)});const{x:d,y:w,height:g}=h.BBox;if(h.children.length){const{y:m,height:u}=h.children[h.children.length-1].BBox;T(n,d+t.paddingX,w+g,d+t.paddingX,m+u/2+t.lineThickness/2,t.lineThickness)}},"processNode");s(e);const o=c.filter(h=>h.node.description);if(o.length>0){const p=Math.max(...c.map(d=>d.labelRightEdge))+ue;for(const d of o){const g=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",d.centerY).node().getBBox();a=Math.max(a,p+g.width+t.paddingX)}}for(const h of c)if(h.node.cssClass?.split(/\s+/).includes("highlight")){const p=h.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const d=a-h.node.BBox.x+8;p.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),ve=f(async(n,e,t,r)=>{D.debug(`Rendering treeView diagram `+n);const i=r.db,a=i.getRoot(),c=i.getConfig(),l=Z(e);await we(l,a,c,e);const s=l.append("g");s.attr("class","tree-view");const{totalHeight:o,totalWidth:h}=xe(s,a,c,e);l.attr("viewBox",`-${c.lineThickness/2} 0 ${h} ${o}`),U(l,o,h,c.useMaxWidth)},"draw"),be={draw:ve},Ie=be,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},ye=f(({treeView:n})=>{const{labelFontSize:e,labelColor:t,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:c,highlightStroke:l}=A(Ce,n);return` diff --git a/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-lGPhYqjp.js b/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js similarity index 95% rename from apps/kimi-code/dist-web/assets/diagram-WEI45ONY-lGPhYqjp.js rename to apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js index 9b7db5b49e6..b2a80168d0f 100644 --- a/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-lGPhYqjp.js +++ b/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js @@ -1,4 +1,4 @@ -import{p as k}from"./chunk-JWPE2WC7-DTx-f56M.js";import{s as R,g as F,p as I,o as _,a as D,b as E,_ as c,F as z,q as P,B as y,z as C,D as G,l as B,W,e as V}from"./mermaid.core-Cahi9cr1.js";import{p as H}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var m={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:m},x=structuredClone(w),j=G.radar,q=c(()=>y({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),N=c(()=>x.curves,"getCurves"),U=c(()=>x.options,"getOptions"),X=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{P(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:J,getConfig:q,clear:K,setAccTitle:E,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:F,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=z(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;ry({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),N=c(()=>x.curves,"getCurves"),U=c(()=>x.options,"getOptions"),X=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{P(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:J,getConfig:q,clear:K,setAccTitle:E,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:F,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=z(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;r{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; +import{g as l,r as m,d as n}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as t,l as o}from"./mermaid.core-CJB1tAev.js";import{M as u,a as f}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; diff --git a/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-MX1lpdtV.js b/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js similarity index 99% rename from apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-MX1lpdtV.js rename to apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js index 54e42e29243..317317275ff 100644 --- a/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-MX1lpdtV.js +++ b/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js @@ -1,4 +1,4 @@ -import{g as Mt}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as Bt}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as l,b as Ft,a as Yt,s as Pt,g as zt,o as Gt,p as Kt,c as it,l as V,q as Ut,r as Zt,t as jt,u as Wt,v as qt,x as Qt,d as Xt,y as Ht}from"./mermaid.core-Cahi9cr1.js";import{c as Jt}from"./channel-Bob_1R_C.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var _t=(function(){var e=l(function(I,n,c,o){for(c=c||{},o=I.length;o--;c[I[o]]=n);return c},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],h=[1,10],a=[1,11],u=[1,12],d=[1,13],y=[1,23],f=[1,24],m=[1,25],j=[1,26],W=[1,27],S=[1,19],q=[1,28],M=[1,29],D=[1,20],R=[1,18],T=[1,21],C=[1,22],nt=[1,36],at=[1,37],ct=[1,38],ot=[1,39],lt=[1,40],B=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],O=[1,45],N=[1,46],F=[1,55],Y=[40,48,50,51,52,71,72],P=[1,66],z=[1,64],A=[1,61],G=[1,65],K=[1,67],Q=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],gt=[66,67,68,69,70],bt=[1,85],kt=[1,84],mt=[1,82],Et=[1,83],St=[6,10,42,47],L=[6,10,13,41,42,47,48,49],X=[1,93],H=[1,92],J=[1,91],U=[19,58],Tt=[1,102],Ot=[1,101],ht=[19,58,61,63],ut={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:l(function(n,c,o,r,p,t,Z){var s=t.length-1;switch(p){case 1:break;case 2:this.$=[];break;case 3:t[s-1].push(t[s]),this.$=t[s-1];break;case 4:case 5:this.$=t[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[s-4]),r.addEntity(t[s-2]),r.addRelationship(t[s-4],t[s],t[s-2],t[s-3]);break;case 9:r.addEntity(t[s-8]),r.addEntity(t[s-4]),r.addRelationship(t[s-8],t[s],t[s-4],t[s-5]),r.setClass([t[s-8]],t[s-6]),r.setClass([t[s-4]],t[s-2]);break;case 10:r.addEntity(t[s-6]),r.addEntity(t[s-2]),r.addRelationship(t[s-6],t[s],t[s-2],t[s-3]),r.setClass([t[s-6]],t[s-4]);break;case 11:r.addEntity(t[s-6]),r.addEntity(t[s-4]),r.addRelationship(t[s-6],t[s],t[s-4],t[s-5]),r.setClass([t[s-4]],t[s-2]);break;case 12:r.addEntity(t[s-3]),r.addAttributes(t[s-3],t[s-1]);break;case 13:r.addEntity(t[s-5]),r.addAttributes(t[s-5],t[s-1]),r.setClass([t[s-5]],t[s-3]);break;case 14:r.addEntity(t[s-2]);break;case 15:r.addEntity(t[s-4]),r.setClass([t[s-4]],t[s-2]);break;case 16:r.addEntity(t[s]);break;case 17:r.addEntity(t[s-2]),r.setClass([t[s-2]],t[s]);break;case 18:r.addEntity(t[s-6],t[s-4]),r.addAttributes(t[s-6],t[s-1]);break;case 19:r.addEntity(t[s-8],t[s-6]),r.addAttributes(t[s-8],t[s-1]),r.setClass([t[s-8]],t[s-3]);break;case 20:r.addEntity(t[s-5],t[s-3]);break;case 21:r.addEntity(t[s-7],t[s-5]),r.setClass([t[s-7]],t[s-2]);break;case 22:r.addEntity(t[s-3],t[s-1]);break;case 23:r.addEntity(t[s-5],t[s-3]),r.setClass([t[s-5]],t[s]);break;case 24:case 25:this.$=t[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[s-3],r.addClass(t[s-2],t[s-1]);break;case 37:case 38:case 59:case 68:this.$=[t[s]];break;case 39:case 40:this.$=t[s-2].concat([t[s]]);break;case 41:this.$=t[s-2],r.setClass(t[s-1],t[s]);break;case 42:this.$=t[s-3],r.addCssStyles(t[s-2],t[s-1]);break;case 43:this.$=[t[s]];break;case 44:t[s-2].push(t[s]),this.$=t[s-2];break;case 46:this.$=t[s-1]+t[s];break;case 54:case 80:case 81:this.$=t[s].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=t[s];break;case 60:t[s].push(t[s-1]),this.$=t[s];break;case 61:this.$={type:t[s-1],name:t[s]};break;case 62:this.$={type:t[s-2],name:t[s-1],keys:t[s]};break;case 63:this.$={type:t[s-2],name:t[s-1],comment:t[s]};break;case 64:this.$={type:t[s-3],name:t[s-2],keys:t[s-1],comment:t[s]};break;case 65:case 67:case 70:this.$=t[s];break;case 66:this.$=t[s-1]+t[s];break;case 69:t[s-2].push(t[s]),this.$=t[s-2];break;case 71:this.$=t[s].replace(/"/g,"");break;case 72:this.$={cardA:t[s],relType:t[s-1],cardB:t[s-2]};break;case 73:this.$=r.Cardinality.ZERO_OR_ONE;break;case 74:this.$=r.Cardinality.ZERO_OR_MORE;break;case 75:this.$=r.Cardinality.ONE_OR_MORE;break;case 76:this.$=r.Cardinality.ONLY_ONE;break;case 77:this.$=r.Cardinality.MD_PARENT;break;case 78:this.$=r.Identification.NON_IDENTIFYING;break;case 79:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,7],{1:[2,1]}),e(i,[2,3]),{9:30,11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,5]),e(i,[2,6]),e(i,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:nt,67:at,68:ct,69:ot,70:lt}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(i,[2,27]),e(i,[2,28]),e(i,[2,29]),e(i,[2,30]),e(i,[2,31]),e(B,[2,54]),e(B,[2,55]),e(B,[2,56]),e(B,[2,57]),e(B,[2,58]),e(i,[2,32]),e(i,[2,33]),e(i,[2,34]),e(i,[2,35]),{16:44,40:O,41:N},{16:47,40:O,41:N},{16:48,40:O,41:N},e(i,[2,4]),{11:49,40:S,48:D,50:R,51:T,52:C},{16:50,40:O,41:N},{18:51,19:[1,52],53:53,54:54,58:F},{11:56,40:S,48:D,50:R,51:T,52:C},{65:57,71:[1,58],72:[1,59]},e(Y,[2,73]),e(Y,[2,74]),e(Y,[2,75]),e(Y,[2,76]),e(Y,[2,77]),e(i,[2,24]),e(i,[2,25]),e(i,[2,26]),{13:P,38:60,41:z,42:A,45:62,46:63,48:G,49:K},e(Q,[2,37]),e(Q,[2,38]),{16:68,40:O,41:N,42:A},{13:P,38:69,41:z,42:A,45:62,46:63,48:G,49:K},{13:[1,70],15:[1,71]},e(i,[2,17],{64:35,12:72,17:[1,73],42:A,66:nt,67:at,68:ct,69:ot,70:lt}),{19:[1,74]},e(i,[2,14]),{18:75,19:[2,59],53:53,54:54,58:F},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:nt,67:at,68:ct,69:ot,70:lt},e(gt,[2,78]),e(gt,[2,79]),{6:bt,10:kt,39:81,42:mt,47:Et},{40:[1,86],41:[1,87]},e(St,[2,43],{46:88,13:P,41:z,48:G,49:K}),e(L,[2,45]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(i,[2,41],{42:A}),{6:bt,10:kt,39:89,42:mt,47:Et},{14:90,40:X,50:H,73:J},{16:94,40:O,41:N},{11:95,40:S,48:D,50:R,51:T,52:C},{18:96,19:[1,97],53:53,54:54,58:F},e(i,[2,12]),{19:[2,60]},e(U,[2,61],{56:98,57:99,60:100,62:Tt,63:Ot}),e([19,58,62,63],[2,67]),{58:[2,66]},e(i,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(i,[2,36]),{13:P,41:z,45:105,46:63,48:G,49:K},e(i,[2,47]),e(i,[2,48]),e(i,[2,49]),e(Q,[2,39]),e(Q,[2,40]),e(L,[2,46]),e(i,[2,42]),e(i,[2,8]),e(i,[2,80]),e(i,[2,81]),e(i,[2,82]),{13:[1,106],42:A},{13:[1,108],15:[1,107]},{19:[1,109]},e(i,[2,15]),e(U,[2,62],{57:110,61:[1,111],63:Ot}),e(U,[2,63]),e(ht,[2,68]),e(U,[2,71]),e(ht,[2,70]),{18:112,19:[1,113],53:53,54:54,58:F},{16:114,40:O,41:N},e(St,[2,44],{46:88,13:P,41:z,48:G,49:K}),{14:115,40:X,50:H,73:J},{16:116,40:O,41:N},{14:117,40:X,50:H,73:J},e(i,[2,13]),e(U,[2,64]),{60:118,62:Tt},{19:[1,119]},e(i,[2,20]),e(i,[2,23],{17:[1,120],42:A}),e(i,[2,11]),{13:[1,121],42:A},e(i,[2,10]),e(ht,[2,69]),e(i,[2,18]),{18:122,19:[1,123],53:53,54:54,58:F},{14:124,40:X,50:H,73:J},{19:[1,125]},e(i,[2,21]),e(i,[2,9]),e(i,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:l(function(n,c){if(c.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=c,o}},"parseError"),parse:l(function(n){var c=this,o=[0],r=[],p=[null],t=[],Z=this.table,s="",tt=0,Nt=0,Dt=2,At=1,Lt=t.slice.call(arguments,1),_=Object.create(this.lexer),x={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(x.yy[dt]=this.yy[dt]);_.setInput(n,x.yy),x.yy.lexer=_,x.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var pt=_.yylloc;t.push(pt);var wt=_.options&&_.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Vt(b){o.length=o.length-2*b,p.length=p.length-b,t.length=t.length-b}l(Vt,"popStack");function It(){var b;return b=r.pop()||_.lex()||At,typeof b!="number"&&(b instanceof Array&&(r=b,b=r.pop()),b=c.symbols_[b]||b),b}l(It,"lex");for(var g,v,k,ft,w={},et,E,Rt,st;;){if(v=o[o.length-1],this.defaultActions[v]?k=this.defaultActions[v]:((g===null||typeof g>"u")&&(g=It()),k=Z[v]&&Z[v][g]),typeof k>"u"||!k.length||!k[0]){var yt="";st=[];for(et in Z[v])this.terminals_[et]&&et>Dt&&st.push("'"+this.terminals_[et]+"'");_.showPosition?yt="Parse error on line "+(tt+1)+`: +import{g as Mt}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Bt}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as l,b as Ft,a as Yt,s as Pt,g as zt,o as Gt,p as Kt,c as it,l as V,q as Ut,r as Zt,t as jt,u as Wt,v as qt,x as Qt,d as Xt,y as Ht}from"./mermaid.core-CJB1tAev.js";import{c as Jt}from"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var _t=(function(){var e=l(function(I,n,c,o){for(c=c||{},o=I.length;o--;c[I[o]]=n);return c},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],h=[1,10],a=[1,11],u=[1,12],d=[1,13],y=[1,23],f=[1,24],m=[1,25],j=[1,26],W=[1,27],S=[1,19],q=[1,28],M=[1,29],D=[1,20],R=[1,18],T=[1,21],C=[1,22],nt=[1,36],at=[1,37],ct=[1,38],ot=[1,39],lt=[1,40],B=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],O=[1,45],N=[1,46],F=[1,55],Y=[40,48,50,51,52,71,72],P=[1,66],z=[1,64],A=[1,61],G=[1,65],K=[1,67],Q=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],gt=[66,67,68,69,70],bt=[1,85],kt=[1,84],mt=[1,82],Et=[1,83],St=[6,10,42,47],L=[6,10,13,41,42,47,48,49],X=[1,93],H=[1,92],J=[1,91],U=[19,58],Tt=[1,102],Ot=[1,101],ht=[19,58,61,63],ut={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:l(function(n,c,o,r,p,t,Z){var s=t.length-1;switch(p){case 1:break;case 2:this.$=[];break;case 3:t[s-1].push(t[s]),this.$=t[s-1];break;case 4:case 5:this.$=t[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[s-4]),r.addEntity(t[s-2]),r.addRelationship(t[s-4],t[s],t[s-2],t[s-3]);break;case 9:r.addEntity(t[s-8]),r.addEntity(t[s-4]),r.addRelationship(t[s-8],t[s],t[s-4],t[s-5]),r.setClass([t[s-8]],t[s-6]),r.setClass([t[s-4]],t[s-2]);break;case 10:r.addEntity(t[s-6]),r.addEntity(t[s-2]),r.addRelationship(t[s-6],t[s],t[s-2],t[s-3]),r.setClass([t[s-6]],t[s-4]);break;case 11:r.addEntity(t[s-6]),r.addEntity(t[s-4]),r.addRelationship(t[s-6],t[s],t[s-4],t[s-5]),r.setClass([t[s-4]],t[s-2]);break;case 12:r.addEntity(t[s-3]),r.addAttributes(t[s-3],t[s-1]);break;case 13:r.addEntity(t[s-5]),r.addAttributes(t[s-5],t[s-1]),r.setClass([t[s-5]],t[s-3]);break;case 14:r.addEntity(t[s-2]);break;case 15:r.addEntity(t[s-4]),r.setClass([t[s-4]],t[s-2]);break;case 16:r.addEntity(t[s]);break;case 17:r.addEntity(t[s-2]),r.setClass([t[s-2]],t[s]);break;case 18:r.addEntity(t[s-6],t[s-4]),r.addAttributes(t[s-6],t[s-1]);break;case 19:r.addEntity(t[s-8],t[s-6]),r.addAttributes(t[s-8],t[s-1]),r.setClass([t[s-8]],t[s-3]);break;case 20:r.addEntity(t[s-5],t[s-3]);break;case 21:r.addEntity(t[s-7],t[s-5]),r.setClass([t[s-7]],t[s-2]);break;case 22:r.addEntity(t[s-3],t[s-1]);break;case 23:r.addEntity(t[s-5],t[s-3]),r.setClass([t[s-5]],t[s]);break;case 24:case 25:this.$=t[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[s-3],r.addClass(t[s-2],t[s-1]);break;case 37:case 38:case 59:case 68:this.$=[t[s]];break;case 39:case 40:this.$=t[s-2].concat([t[s]]);break;case 41:this.$=t[s-2],r.setClass(t[s-1],t[s]);break;case 42:this.$=t[s-3],r.addCssStyles(t[s-2],t[s-1]);break;case 43:this.$=[t[s]];break;case 44:t[s-2].push(t[s]),this.$=t[s-2];break;case 46:this.$=t[s-1]+t[s];break;case 54:case 80:case 81:this.$=t[s].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=t[s];break;case 60:t[s].push(t[s-1]),this.$=t[s];break;case 61:this.$={type:t[s-1],name:t[s]};break;case 62:this.$={type:t[s-2],name:t[s-1],keys:t[s]};break;case 63:this.$={type:t[s-2],name:t[s-1],comment:t[s]};break;case 64:this.$={type:t[s-3],name:t[s-2],keys:t[s-1],comment:t[s]};break;case 65:case 67:case 70:this.$=t[s];break;case 66:this.$=t[s-1]+t[s];break;case 69:t[s-2].push(t[s]),this.$=t[s-2];break;case 71:this.$=t[s].replace(/"/g,"");break;case 72:this.$={cardA:t[s],relType:t[s-1],cardB:t[s-2]};break;case 73:this.$=r.Cardinality.ZERO_OR_ONE;break;case 74:this.$=r.Cardinality.ZERO_OR_MORE;break;case 75:this.$=r.Cardinality.ONE_OR_MORE;break;case 76:this.$=r.Cardinality.ONLY_ONE;break;case 77:this.$=r.Cardinality.MD_PARENT;break;case 78:this.$=r.Identification.NON_IDENTIFYING;break;case 79:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,7],{1:[2,1]}),e(i,[2,3]),{9:30,11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,5]),e(i,[2,6]),e(i,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:nt,67:at,68:ct,69:ot,70:lt}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(i,[2,27]),e(i,[2,28]),e(i,[2,29]),e(i,[2,30]),e(i,[2,31]),e(B,[2,54]),e(B,[2,55]),e(B,[2,56]),e(B,[2,57]),e(B,[2,58]),e(i,[2,32]),e(i,[2,33]),e(i,[2,34]),e(i,[2,35]),{16:44,40:O,41:N},{16:47,40:O,41:N},{16:48,40:O,41:N},e(i,[2,4]),{11:49,40:S,48:D,50:R,51:T,52:C},{16:50,40:O,41:N},{18:51,19:[1,52],53:53,54:54,58:F},{11:56,40:S,48:D,50:R,51:T,52:C},{65:57,71:[1,58],72:[1,59]},e(Y,[2,73]),e(Y,[2,74]),e(Y,[2,75]),e(Y,[2,76]),e(Y,[2,77]),e(i,[2,24]),e(i,[2,25]),e(i,[2,26]),{13:P,38:60,41:z,42:A,45:62,46:63,48:G,49:K},e(Q,[2,37]),e(Q,[2,38]),{16:68,40:O,41:N,42:A},{13:P,38:69,41:z,42:A,45:62,46:63,48:G,49:K},{13:[1,70],15:[1,71]},e(i,[2,17],{64:35,12:72,17:[1,73],42:A,66:nt,67:at,68:ct,69:ot,70:lt}),{19:[1,74]},e(i,[2,14]),{18:75,19:[2,59],53:53,54:54,58:F},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:nt,67:at,68:ct,69:ot,70:lt},e(gt,[2,78]),e(gt,[2,79]),{6:bt,10:kt,39:81,42:mt,47:Et},{40:[1,86],41:[1,87]},e(St,[2,43],{46:88,13:P,41:z,48:G,49:K}),e(L,[2,45]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(i,[2,41],{42:A}),{6:bt,10:kt,39:89,42:mt,47:Et},{14:90,40:X,50:H,73:J},{16:94,40:O,41:N},{11:95,40:S,48:D,50:R,51:T,52:C},{18:96,19:[1,97],53:53,54:54,58:F},e(i,[2,12]),{19:[2,60]},e(U,[2,61],{56:98,57:99,60:100,62:Tt,63:Ot}),e([19,58,62,63],[2,67]),{58:[2,66]},e(i,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(i,[2,36]),{13:P,41:z,45:105,46:63,48:G,49:K},e(i,[2,47]),e(i,[2,48]),e(i,[2,49]),e(Q,[2,39]),e(Q,[2,40]),e(L,[2,46]),e(i,[2,42]),e(i,[2,8]),e(i,[2,80]),e(i,[2,81]),e(i,[2,82]),{13:[1,106],42:A},{13:[1,108],15:[1,107]},{19:[1,109]},e(i,[2,15]),e(U,[2,62],{57:110,61:[1,111],63:Ot}),e(U,[2,63]),e(ht,[2,68]),e(U,[2,71]),e(ht,[2,70]),{18:112,19:[1,113],53:53,54:54,58:F},{16:114,40:O,41:N},e(St,[2,44],{46:88,13:P,41:z,48:G,49:K}),{14:115,40:X,50:H,73:J},{16:116,40:O,41:N},{14:117,40:X,50:H,73:J},e(i,[2,13]),e(U,[2,64]),{60:118,62:Tt},{19:[1,119]},e(i,[2,20]),e(i,[2,23],{17:[1,120],42:A}),e(i,[2,11]),{13:[1,121],42:A},e(i,[2,10]),e(ht,[2,69]),e(i,[2,18]),{18:122,19:[1,123],53:53,54:54,58:F},{14:124,40:X,50:H,73:J},{19:[1,125]},e(i,[2,21]),e(i,[2,9]),e(i,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:l(function(n,c){if(c.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=c,o}},"parseError"),parse:l(function(n){var c=this,o=[0],r=[],p=[null],t=[],Z=this.table,s="",tt=0,Nt=0,Dt=2,At=1,Lt=t.slice.call(arguments,1),_=Object.create(this.lexer),x={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(x.yy[dt]=this.yy[dt]);_.setInput(n,x.yy),x.yy.lexer=_,x.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var pt=_.yylloc;t.push(pt);var wt=_.options&&_.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Vt(b){o.length=o.length-2*b,p.length=p.length-b,t.length=t.length-b}l(Vt,"popStack");function It(){var b;return b=r.pop()||_.lex()||At,typeof b!="number"&&(b instanceof Array&&(r=b,b=r.pop()),b=c.symbols_[b]||b),b}l(It,"lex");for(var g,v,k,ft,w={},et,E,Rt,st;;){if(v=o[o.length-1],this.defaultActions[v]?k=this.defaultActions[v]:((g===null||typeof g>"u")&&(g=It()),k=Z[v]&&Z[v][g]),typeof k>"u"||!k.length||!k[0]){var yt="";st=[];for(et in Z[v])this.terminals_[et]&&et>Dt&&st.push("'"+this.terminals_[et]+"'");_.showPosition?yt="Parse error on line "+(tt+1)+`: `+_.showPosition()+` Expecting `+st.join(", ")+", got '"+(this.terminals_[g]||g)+"'":yt="Parse error on line "+(tt+1)+": Unexpected "+(g==At?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(yt,{text:_.match,token:this.terminals_[g]||g,line:_.yylineno,loc:pt,expected:st})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+g);switch(k[0]){case 1:o.push(g),p.push(_.yytext),t.push(_.yylloc),o.push(k[1]),g=null,Nt=_.yyleng,s=_.yytext,tt=_.yylineno,pt=_.yylloc;break;case 2:if(E=this.productions_[k[1]][1],w.$=p[p.length-E],w._$={first_line:t[t.length-(E||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(E||1)].first_column,last_column:t[t.length-1].last_column},wt&&(w._$.range=[t[t.length-(E||1)].range[0],t[t.length-1].range[1]]),ft=this.performAction.apply(w,[s,Nt,tt,x.yy,k[1],p,t].concat(Lt)),typeof ft<"u")return ft;E&&(o=o.slice(0,-1*E*2),p=p.slice(0,-1*E),t=t.slice(0,-1*E)),o.push(this.productions_[k[1]][0]),p.push(w.$),t.push(w._$),Rt=Z[o[o.length-2]][o[o.length-1]],o.push(Rt);break;case 3:return!0}}return!0},"parse")},vt=(function(){var I={EOF:1,parseError:l(function(c,o){if(this.yy.parser)this.yy.parser.parseError(c,o);else throw new Error(c)},"parseError"),setInput:l(function(n,c){return this.yy=c||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var c=n.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:l(function(n){var c=n.length,o=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===r.length?this.yylloc.first_column:0)+r[r.length-o.length].length-o[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(n){this.unput(this.match.slice(n))},"less"),pastInput:l(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var n=this.pastInput(),c=new Array(n.length+1).join("-");return n+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-BJ9xq3_H.js b/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js similarity index 99% rename from apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-BJ9xq3_H.js rename to apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js index fe7e7dec940..c717156e91c 100644 --- a/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-BJ9xq3_H.js +++ b/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js @@ -1,4 +1,4 @@ -import{g as He}from"./chunk-5VM5RSS4-CfD0Yt-O.js";import{g as Xe}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as Qe}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as b,b6 as Ze,X as Oe,l as Z,c as g1,v as Je,x as $e,y as ie,b as et,s as tt,o as st,a as it,g as rt,p as at,k as nt,Y as ut,Z as ot,bo as lt,r as te,d as se,a5 as ct,q as ht,b8 as dt,t as pt}from"./mermaid.core-Cahi9cr1.js";import{f as ft}from"./chunk-32BRIVSS-DAsxL712.js";import{c as gt}from"./channel-Bob_1R_C.js";var bt="flowchart-",At=class{constructor(){this.vertexCounter=0,this.config=g1(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=et,this.setAccDescription=tt,this.setDiagramTitle=st,this.getAccTitle=it,this.getAccDescription=rt,this.getDiagramTitle=at,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return nt.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(const i of this.vertices.values())if(i.id===e)return this.diagramId?`${this.diagramId}-${i.domId}`:i.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,i,r,a,o,d,l={},A){if(!e||e.trim().length===0)return;let n;if(A!==void 0){let k;A.includes(` +import{g as He}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{g as Xe}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Qe}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as b,b6 as Ze,X as Oe,l as Z,c as g1,v as Je,x as $e,y as ie,b as et,s as tt,o as st,a as it,g as rt,p as at,k as nt,Y as ut,Z as ot,bo as lt,r as te,d as se,a5 as ct,q as ht,b8 as dt,t as pt}from"./mermaid.core-CJB1tAev.js";import{f as ft}from"./chunk-32BRIVSS-DUDRPqmY.js";import{c as gt}from"./channel-xkK6nTGq.js";var bt="flowchart-",At=class{constructor(){this.vertexCounter=0,this.config=g1(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=et,this.setAccDescription=tt,this.setDiagramTitle=st,this.getAccTitle=it,this.getAccDescription=rt,this.getDiagramTitle=at,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return nt.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(const i of this.vertices.values())if(i.id===e)return this.diagramId?`${this.diagramId}-${i.domId}`:i.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,i,r,a,o,d,l={},A){if(!e||e.trim().length===0)return;let n;if(A!==void 0){let k;A.includes(` `)?k=A+` `:k=`{ `+A+` diff --git a/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-UHBCrlBo.js b/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js similarity index 99% rename from apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-UHBCrlBo.js rename to apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js index 13998c2fc52..7552e3c8e0c 100644 --- a/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-UHBCrlBo.js +++ b/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js @@ -1,4 +1,4 @@ -import{bg as on,bh as On,bi as cn,bj as un,bk as ln,bl as ue,bm as Hn,g as Nn,s as Pn,p as Vn,o as Rn,a as zn,b as qn,_ as d,c as Yt,d as Zt,e as Bn,bn as it,l as Tt,k as Zn,j as Xn,q as Gn,y as jn}from"./mermaid.core-Cahi9cr1.js";import{g as oe}from"./_commonjsHelpers-CqkleIqs.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-DHRafvZW.js";import{i as er}from"./init-Gi6I4Gst.js";import"./index-HRJ6xRtC.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: +import{bg as on,bh as On,bi as cn,bj as un,bk as ln,bl as ue,bm as Hn,g as Nn,s as Pn,p as Vn,o as Rn,a as zn,b as qn,_ as d,c as Yt,d as Zt,e as Bn,bn as it,l as Tt,k as Zn,j as Xn,q as Gn,y as jn}from"./mermaid.core-CJB1tAev.js";import{g as oe}from"./_commonjsHelpers-CqkleIqs.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-DH49UJnN.js";import{i as er}from"./init-Gi6I4Gst.js";import"./index-D-7nOosq.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: `+H.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":ce="Parse error on line "+(K+1)+": Unexpected "+(A==O?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(ce,{text:H.match,token:this.terminals_[A]||A,line:H.yylineno,loc:N,expected:Bt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+A);switch(Z[0]){case 1:b.push(A),I.push(H.yytext),o.push(H.yylloc),b.push(Z[1]),A=null,l=H.yyleng,u=H.yytext,K=H.yylineno,N=H.yylloc;break;case 2:if(ut=this.productions_[Z[1]][1],at.$=I[I.length-ut],at._$={first_line:o[o.length-(ut||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(ut||1)].first_column,last_column:o[o.length-1].last_column},V&&(at._$.range=[o[o.length-(ut||1)].range[0],o[o.length-1].range[1]]),st=this.performAction.apply(at,[u,l,K,J.yy,Z[1],I,o].concat(j)),typeof st<"u")return st;ut&&(b=b.slice(0,-1*ut*2),I=I.slice(0,-1*ut),o=o.slice(0,-1*ut)),b.push(this.productions_[Z[1]][0]),I.push(at.$),o.push(at._$),He=W[b[b.length-2]][b[b.length-1]],b.push(He);break;case 3:return!0}}return!0},"parse")},C=(function(){var D={EOF:1,parseError:d(function(g,b){if(this.yy.parser)this.yy.parser.parseError(g,b);else throw new Error(g)},"parseError"),setInput:d(function(c,g){return this.yy=g||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var g=c.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:d(function(c){var g=c.length,b=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===m.length?this.yylloc.first_column:0)+m[m.length-b.length].length-b[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(c){this.unput(this.match.slice(c))},"less"),pastInput:d(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var c=this.pastInput(),g=new Array(c.length+1).join("-");return c+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-BO6zli_L.js b/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js similarity index 99% rename from apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-BO6zli_L.js rename to apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js index d319a6d09f5..131bb563844 100644 --- a/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-BO6zli_L.js +++ b/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js @@ -1,4 +1,4 @@ -import{I as le}from"./chunk-2Q5K7J3B-B47YykJY.js";import{p as he}from"./chunk-JWPE2WC7-DTx-f56M.js";import{p as $e,o as fe,s as ge,g as ue,a as ye,b as xe,_ as h,z as J,l as w,d as me,c as W,y as pe,A as be,q as we,k as B,B as ke,D as ve,E as Ce}from"./mermaid.core-Cahi9cr1.js";import{p as Ee}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var m={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Be=ve.gitGraph,S=h(()=>ke({...Be,...J().gitGraph}),"getConfig"),d=new le(()=>{const e=S(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function Y(){return Ce({length:7})}h(Y,"getID");function te(e,r){const t=Object.create(null);return e.reduce((s,o)=>{const i=r(o);return t[i]||(t[i]=!0,s.push(o)),s},[])}h(te,"uniqBy");var Te=h(function(e){d.records.direction=e},"setDirection"),Le=h(function(e){w.debug("options str",e),e=e?.trim(),e=e||"{}";try{d.records.options=JSON.parse(e)}catch(r){w.error("error while parsing gitGraph options",r.message)}},"setOptions"),Me=h(function(){return d.records.options},"getOptions"),Re=h(function(e){let r=e.msg,t=e.id;const s=e.type;let o=e.tags;w.info("commit",r,t,s,o),w.debug("Entering commit:",r,t,s,o);const i=S();t=B.sanitizeText(t,i),r=B.sanitizeText(r,i),o=o?.map(a=>B.sanitizeText(a,i));const n={id:t||d.records.seq+"-"+Y(),message:r,seq:d.records.seq++,type:s??m.NORMAL,tags:o??[],parents:d.records.head==null?[]:[d.records.head.id],branch:d.records.currBranch};d.records.head=n,w.info("main branch",i.mainBranchName),d.records.commits.has(n.id)&&w.warn(`Commit ID ${n.id} already exists`),d.records.commits.set(n.id,n),d.records.branches.set(d.records.currBranch,n.id),w.debug("in pushCommit "+n.id)},"commit"),Ie=h(function(e){let r=e.name;const t=e.order;if(r=B.sanitizeText(r,S()),d.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);d.records.branches.set(r,d.records.head!=null?d.records.head.id:null),d.records.branchConfig.set(r,{name:r,order:t}),ae(r),w.debug("in createBranch")},"branch"),Oe=h(e=>{let r=e.branch,t=e.id;const s=e.type,o=e.tags,i=S();r=B.sanitizeText(r,i),t&&(t=B.sanitizeText(t,i));const n=d.records.branches.get(d.records.currBranch),a=d.records.branches.get(r),l=n?d.records.commits.get(n):void 0,f=a?d.records.commits.get(a):void 0;if(l&&f&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(d.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!d.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(f===void 0||!f){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===f){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&d.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${s} ${o?.join(" ")}`,token:`merge ${r} ${t} ${s} ${o?.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`]},c}const g=a||"",$={id:t||`${d.records.seq}-${Y()}`,message:`merged branch ${r} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,g],branch:d.records.currBranch,type:m.MERGE,customType:s,customId:!!t,tags:o??[]};d.records.head=$,d.records.commits.set($.id,$),d.records.branches.set(d.records.currBranch,$.id),w.debug(d.records.branches),w.debug("in mergeBranch")},"merge"),_e=h(function(e){let r=e.id,t=e.targetId,s=e.tags,o=e.parent;w.debug("Entering cherryPick:",r,t,s);const i=S();if(r=B.sanitizeText(r,i),t=B.sanitizeText(t,i),s=s?.map(l=>B.sanitizeText(l,i)),o=B.sanitizeText(o,i),!r||!d.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=d.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&!(Array.isArray(n.parents)&&n.parents.includes(o)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===m.MERGE&&!o)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!d.records.commits.has(t)){if(a===d.records.currBranch){const $=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const l=d.records.branches.get(d.records.currBranch);if(l===void 0||!l){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const f=d.records.commits.get(l);if(f===void 0||!f){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const g={id:d.records.seq+"-"+Y(),message:`cherry-picked ${n?.message} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,n.id],branch:d.records.currBranch,type:m.CHERRY_PICK,tags:s?s.filter(Boolean):[`cherry-pick:${n.id}${n.type===m.MERGE?`|parent:${o}`:""}`]};d.records.head=g,d.records.commits.set(g.id,g),d.records.branches.set(d.records.currBranch,g.id),w.debug(d.records.branches),w.debug("in cherryPick")}},"cherryPick"),ae=h(function(e){if(e=B.sanitizeText(e,S()),d.records.branches.has(e)){d.records.currBranch=e;const r=d.records.branches.get(d.records.currBranch);r===void 0||!r?d.records.head=null:d.records.head=d.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function V(e,r,t){const s=e.indexOf(r);s===-1?e.push(t):e.splice(s,1,t)}h(V,"upsert");function Q(e){const r=e.reduce((o,i)=>o.seq>i.seq?o:i,e[0]);let t="";e.forEach(function(o){o===r?t+=" *":t+=" |"});const s=[t,r.id,r.seq];for(const o in d.records.branches)d.records.branches.get(o)===r.id&&s.push(o);if(w.debug(s.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const o=d.records.commits.get(r.parents[0]);V(e,r,o),r.parents[1]&&e.push(d.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const o=d.records.commits.get(r.parents[0]);V(e,r,o)}}e=te(e,o=>o.id),Q(e)}h(Q,"prettyPrintCommitHistory");var Ge=h(function(){w.debug(d.records.commits);const e=ne()[0];Q([e])},"prettyPrint"),He=h(function(){d.reset(),we()},"clear"),Se=h(function(){return[...d.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ae=h(function(){return d.records.branches},"getBranches"),De=h(function(){return d.records.commits},"getCommits"),ne=h(function(){const e=[...d.records.commits.values()];return e.forEach(function(r){w.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),qe=h(function(){return d.records.currBranch},"getCurrentBranch"),Pe=h(function(){return d.records.direction},"getDirection"),We=h(function(){return d.records.head},"getHead"),se={commitType:m,getConfig:S,setDirection:Te,setOptions:Le,getOptions:Me,commit:Re,branch:Ie,merge:Oe,cherryPick:_e,checkout:ae,prettyPrint:Ge,clear:He,getBranchesAsObjArray:Se,getBranches:Ae,getCommits:De,getCommitsArray:ne,getCurrentBranch:qe,getDirection:Pe,getHead:We,setAccTitle:xe,getAccTitle:ye,getAccDescription:ue,setAccDescription:ge,setDiagramTitle:fe,getDiagramTitle:$e},Ne=h((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)Fe(t,r)},"populate"),Fe=h((e,r)=>{const s={Commit:h(o=>r.commit(ze(o)),"Commit"),Branch:h(o=>r.branch(Ye(o)),"Branch"),Merge:h(o=>r.merge(je(o)),"Merge"),Checkout:h(o=>r.checkout(Ue(o)),"Checkout"),CherryPicking:h(o=>r.cherryPick(Ke(o)),"CherryPicking")}[e.$type];s?s(e):w.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),ze=h(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?m[e.type]:m.NORMAL,tags:e.tags??void 0}),"parseCommit"),Ye=h(e=>({name:e.name,order:e.order??0}),"parseBranch"),je=h(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?m[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ue=h(e=>e.branch,"parseCheckout"),Ke=h(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ve={parse:h(async e=>{const r=await Ee("gitGraph",e);w.debug(r),Ne(r,se)},"parse")},O=10,_=40,L=4,R=2,G=8,j=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),X=12,Z=new Set(["redux-color","redux-dark-color"]),Xe=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),H=h((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,E=new Map,F=30,q=new Map,z=[],I=0,y="LR",Je=h(()=>{C.clear(),E.clear(),q.clear(),I=0,z=[],y="LR"},"clear"),oe=h(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(s=>{const o=document.createElementNS("http://www.w3.org/2000/svg","tspan");o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),o.setAttribute("dy","1em"),o.setAttribute("x","0"),o.setAttribute("class","row"),o.textContent=s.trim(),r.appendChild(o)}),r},"drawText"),ce=h(e=>{let r,t,s;return y==="BT"?(t=h((o,i)=>o<=i,"comparisonFunc"),s=1/0):(t=h((o,i)=>o>=i,"comparisonFunc"),s=0),e.forEach(o=>{const i=y==="TB"||y=="BT"?E.get(o)?.y:E.get(o)?.x;i!==void 0&&t(i,s)&&(r=o,s=i)}),r},"findClosestParent"),Qe=h(e=>{let r="",t=1/0;return e.forEach(s=>{const o=E.get(s).y;o<=t&&(r=s,t=o)}),r||void 0},"findClosestParentBT"),Ze=h((e,r,t)=>{let s=t,o=t;const i=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(s=rr(a),o=Math.max(s,o)):i.push(a),tr(a,s)}),s=o,i.forEach(n=>{ar(n,s,t)}),e.forEach(n=>{const a=r.get(n);if(a?.parents.length){const l=Qe(a.parents);s=E.get(l).y-_,s<=o&&(o=s);const f=C.get(a.branch).pos,g=s-O;E.set(a.id,{x:f,y:g})}})},"setParallelBTPos"),er=h(e=>{const r=ce(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=E.get(r)?.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),rr=h(e=>er(e)+_,"calculateCommitPosition"),tr=h((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const s=t.pos,o=r+O;return E.set(e.id,{x:s,y:o}),{x:s,y:o}},"setCommitPosition"),ar=h((e,r,t)=>{const s=C.get(e.branch);if(!s)throw new Error(`Branch not found for commit ${e.id}`);const o=r+t,i=s.pos;E.set(e.id,{x:i,y:o})},"setRootPosition"),nr=h((e,r,t,s,o,i)=>{const{theme:n}=W(),a=j.has(n??""),l=Z.has(n??""),f=Xe.has(n??"");if(i===m.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${H(o,G,l)} ${s}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${H(o,G,l)} ${s}-inner`);else if(i===m.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${H(o,G,l)}`),i===m.MERGE){const $=e.append("circle");$.attr("cx",t.x),$.attr("cy",t.y),$.attr("r",a?5:6),$.attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}if(i===m.REVERSE){const $=e.append("path"),c=a?4:5;$.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}}},"drawCommitBullet"),sr=h((e,r,t,s,o)=>{if(r.type!==m.CHERRY_PICK&&(r.customId&&r.type===m.MERGE||r.type!==m.MERGE)&&o.showCommitLabel){const i=e.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),a=i.append("text").attr("x",s).attr("y",t.y+25).attr("class","commit-label").text(r.id),l=a.node()?.getBBox();if(l&&(n.attr("x",t.posWithOffset-l.width/2-R).attr("y",t.y+13.5).attr("width",l.width+2*R).attr("height",l.height+2*R),y==="TB"||y==="BT"?(n.attr("x",t.x-(l.width+4*L+5)).attr("y",t.y-12),a.attr("x",t.x-(l.width+4*L)).attr("y",t.y+l.height-12)):a.attr("x",t.posWithOffset-l.width/2),o.rotateCommitLabel))if(y==="TB"||y==="BT")a.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),n.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const f=-7.5-(l.width+10)/25*9.5,g=10+l.width/25*8.5;i.attr("transform","translate("+f+", "+g+") rotate(-45, "+s+", "+t.y+")")}}},"drawCommitLabel"),or=h((e,r,t,s)=>{if(r.tags.length>0){let o=0,i=0,n=0;const a=[];for(const l of r.tags.reverse()){const f=e.insert("polygon"),g=e.append("circle"),$=e.append("text").attr("y",t.y-16-o).attr("class","tag-label").text(l),c=$.node()?.getBBox();if(!c)throw new Error("Tag bbox not found");i=Math.max(i,c.width),n=Math.max(n,c.height),$.attr("x",t.posWithOffset-c.width/2),a.push({tag:$,hole:g,rect:f,yOffset:o}),o+=20}for(const{tag:l,hole:f,rect:g,yOffset:$}of a){const c=n/2,x=t.y-19.2-$;if(g.attr("class","tag-label-bkg").attr("points",` +import{I as le}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{p as he}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{p as $e,o as fe,s as ge,g as ue,a as ye,b as xe,_ as h,z as J,l as w,d as me,c as W,y as pe,A as be,q as we,k as B,B as ke,D as ve,E as Ce}from"./mermaid.core-CJB1tAev.js";import{p as Ee}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var m={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Be=ve.gitGraph,S=h(()=>ke({...Be,...J().gitGraph}),"getConfig"),d=new le(()=>{const e=S(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function Y(){return Ce({length:7})}h(Y,"getID");function te(e,r){const t=Object.create(null);return e.reduce((s,o)=>{const i=r(o);return t[i]||(t[i]=!0,s.push(o)),s},[])}h(te,"uniqBy");var Te=h(function(e){d.records.direction=e},"setDirection"),Le=h(function(e){w.debug("options str",e),e=e?.trim(),e=e||"{}";try{d.records.options=JSON.parse(e)}catch(r){w.error("error while parsing gitGraph options",r.message)}},"setOptions"),Me=h(function(){return d.records.options},"getOptions"),Re=h(function(e){let r=e.msg,t=e.id;const s=e.type;let o=e.tags;w.info("commit",r,t,s,o),w.debug("Entering commit:",r,t,s,o);const i=S();t=B.sanitizeText(t,i),r=B.sanitizeText(r,i),o=o?.map(a=>B.sanitizeText(a,i));const n={id:t||d.records.seq+"-"+Y(),message:r,seq:d.records.seq++,type:s??m.NORMAL,tags:o??[],parents:d.records.head==null?[]:[d.records.head.id],branch:d.records.currBranch};d.records.head=n,w.info("main branch",i.mainBranchName),d.records.commits.has(n.id)&&w.warn(`Commit ID ${n.id} already exists`),d.records.commits.set(n.id,n),d.records.branches.set(d.records.currBranch,n.id),w.debug("in pushCommit "+n.id)},"commit"),Ie=h(function(e){let r=e.name;const t=e.order;if(r=B.sanitizeText(r,S()),d.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);d.records.branches.set(r,d.records.head!=null?d.records.head.id:null),d.records.branchConfig.set(r,{name:r,order:t}),ae(r),w.debug("in createBranch")},"branch"),Oe=h(e=>{let r=e.branch,t=e.id;const s=e.type,o=e.tags,i=S();r=B.sanitizeText(r,i),t&&(t=B.sanitizeText(t,i));const n=d.records.branches.get(d.records.currBranch),a=d.records.branches.get(r),l=n?d.records.commits.get(n):void 0,f=a?d.records.commits.get(a):void 0;if(l&&f&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(d.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!d.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(f===void 0||!f){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===f){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&d.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${s} ${o?.join(" ")}`,token:`merge ${r} ${t} ${s} ${o?.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`]},c}const g=a||"",$={id:t||`${d.records.seq}-${Y()}`,message:`merged branch ${r} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,g],branch:d.records.currBranch,type:m.MERGE,customType:s,customId:!!t,tags:o??[]};d.records.head=$,d.records.commits.set($.id,$),d.records.branches.set(d.records.currBranch,$.id),w.debug(d.records.branches),w.debug("in mergeBranch")},"merge"),_e=h(function(e){let r=e.id,t=e.targetId,s=e.tags,o=e.parent;w.debug("Entering cherryPick:",r,t,s);const i=S();if(r=B.sanitizeText(r,i),t=B.sanitizeText(t,i),s=s?.map(l=>B.sanitizeText(l,i)),o=B.sanitizeText(o,i),!r||!d.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=d.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&!(Array.isArray(n.parents)&&n.parents.includes(o)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===m.MERGE&&!o)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!d.records.commits.has(t)){if(a===d.records.currBranch){const $=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const l=d.records.branches.get(d.records.currBranch);if(l===void 0||!l){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const f=d.records.commits.get(l);if(f===void 0||!f){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const g={id:d.records.seq+"-"+Y(),message:`cherry-picked ${n?.message} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,n.id],branch:d.records.currBranch,type:m.CHERRY_PICK,tags:s?s.filter(Boolean):[`cherry-pick:${n.id}${n.type===m.MERGE?`|parent:${o}`:""}`]};d.records.head=g,d.records.commits.set(g.id,g),d.records.branches.set(d.records.currBranch,g.id),w.debug(d.records.branches),w.debug("in cherryPick")}},"cherryPick"),ae=h(function(e){if(e=B.sanitizeText(e,S()),d.records.branches.has(e)){d.records.currBranch=e;const r=d.records.branches.get(d.records.currBranch);r===void 0||!r?d.records.head=null:d.records.head=d.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function V(e,r,t){const s=e.indexOf(r);s===-1?e.push(t):e.splice(s,1,t)}h(V,"upsert");function Q(e){const r=e.reduce((o,i)=>o.seq>i.seq?o:i,e[0]);let t="";e.forEach(function(o){o===r?t+=" *":t+=" |"});const s=[t,r.id,r.seq];for(const o in d.records.branches)d.records.branches.get(o)===r.id&&s.push(o);if(w.debug(s.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const o=d.records.commits.get(r.parents[0]);V(e,r,o),r.parents[1]&&e.push(d.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const o=d.records.commits.get(r.parents[0]);V(e,r,o)}}e=te(e,o=>o.id),Q(e)}h(Q,"prettyPrintCommitHistory");var Ge=h(function(){w.debug(d.records.commits);const e=ne()[0];Q([e])},"prettyPrint"),He=h(function(){d.reset(),we()},"clear"),Se=h(function(){return[...d.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ae=h(function(){return d.records.branches},"getBranches"),De=h(function(){return d.records.commits},"getCommits"),ne=h(function(){const e=[...d.records.commits.values()];return e.forEach(function(r){w.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),qe=h(function(){return d.records.currBranch},"getCurrentBranch"),Pe=h(function(){return d.records.direction},"getDirection"),We=h(function(){return d.records.head},"getHead"),se={commitType:m,getConfig:S,setDirection:Te,setOptions:Le,getOptions:Me,commit:Re,branch:Ie,merge:Oe,cherryPick:_e,checkout:ae,prettyPrint:Ge,clear:He,getBranchesAsObjArray:Se,getBranches:Ae,getCommits:De,getCommitsArray:ne,getCurrentBranch:qe,getDirection:Pe,getHead:We,setAccTitle:xe,getAccTitle:ye,getAccDescription:ue,setAccDescription:ge,setDiagramTitle:fe,getDiagramTitle:$e},Ne=h((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)Fe(t,r)},"populate"),Fe=h((e,r)=>{const s={Commit:h(o=>r.commit(ze(o)),"Commit"),Branch:h(o=>r.branch(Ye(o)),"Branch"),Merge:h(o=>r.merge(je(o)),"Merge"),Checkout:h(o=>r.checkout(Ue(o)),"Checkout"),CherryPicking:h(o=>r.cherryPick(Ke(o)),"CherryPicking")}[e.$type];s?s(e):w.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),ze=h(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?m[e.type]:m.NORMAL,tags:e.tags??void 0}),"parseCommit"),Ye=h(e=>({name:e.name,order:e.order??0}),"parseBranch"),je=h(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?m[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ue=h(e=>e.branch,"parseCheckout"),Ke=h(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ve={parse:h(async e=>{const r=await Ee("gitGraph",e);w.debug(r),Ne(r,se)},"parse")},O=10,_=40,L=4,R=2,G=8,j=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),X=12,Z=new Set(["redux-color","redux-dark-color"]),Xe=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),H=h((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,E=new Map,F=30,q=new Map,z=[],I=0,y="LR",Je=h(()=>{C.clear(),E.clear(),q.clear(),I=0,z=[],y="LR"},"clear"),oe=h(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(s=>{const o=document.createElementNS("http://www.w3.org/2000/svg","tspan");o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),o.setAttribute("dy","1em"),o.setAttribute("x","0"),o.setAttribute("class","row"),o.textContent=s.trim(),r.appendChild(o)}),r},"drawText"),ce=h(e=>{let r,t,s;return y==="BT"?(t=h((o,i)=>o<=i,"comparisonFunc"),s=1/0):(t=h((o,i)=>o>=i,"comparisonFunc"),s=0),e.forEach(o=>{const i=y==="TB"||y=="BT"?E.get(o)?.y:E.get(o)?.x;i!==void 0&&t(i,s)&&(r=o,s=i)}),r},"findClosestParent"),Qe=h(e=>{let r="",t=1/0;return e.forEach(s=>{const o=E.get(s).y;o<=t&&(r=s,t=o)}),r||void 0},"findClosestParentBT"),Ze=h((e,r,t)=>{let s=t,o=t;const i=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(s=rr(a),o=Math.max(s,o)):i.push(a),tr(a,s)}),s=o,i.forEach(n=>{ar(n,s,t)}),e.forEach(n=>{const a=r.get(n);if(a?.parents.length){const l=Qe(a.parents);s=E.get(l).y-_,s<=o&&(o=s);const f=C.get(a.branch).pos,g=s-O;E.set(a.id,{x:f,y:g})}})},"setParallelBTPos"),er=h(e=>{const r=ce(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=E.get(r)?.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),rr=h(e=>er(e)+_,"calculateCommitPosition"),tr=h((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const s=t.pos,o=r+O;return E.set(e.id,{x:s,y:o}),{x:s,y:o}},"setCommitPosition"),ar=h((e,r,t)=>{const s=C.get(e.branch);if(!s)throw new Error(`Branch not found for commit ${e.id}`);const o=r+t,i=s.pos;E.set(e.id,{x:i,y:o})},"setRootPosition"),nr=h((e,r,t,s,o,i)=>{const{theme:n}=W(),a=j.has(n??""),l=Z.has(n??""),f=Xe.has(n??"");if(i===m.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${H(o,G,l)} ${s}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${H(o,G,l)} ${s}-inner`);else if(i===m.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${H(o,G,l)}`),i===m.MERGE){const $=e.append("circle");$.attr("cx",t.x),$.attr("cy",t.y),$.attr("r",a?5:6),$.attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}if(i===m.REVERSE){const $=e.append("path"),c=a?4:5;$.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}}},"drawCommitBullet"),sr=h((e,r,t,s,o)=>{if(r.type!==m.CHERRY_PICK&&(r.customId&&r.type===m.MERGE||r.type!==m.MERGE)&&o.showCommitLabel){const i=e.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),a=i.append("text").attr("x",s).attr("y",t.y+25).attr("class","commit-label").text(r.id),l=a.node()?.getBBox();if(l&&(n.attr("x",t.posWithOffset-l.width/2-R).attr("y",t.y+13.5).attr("width",l.width+2*R).attr("height",l.height+2*R),y==="TB"||y==="BT"?(n.attr("x",t.x-(l.width+4*L+5)).attr("y",t.y-12),a.attr("x",t.x-(l.width+4*L)).attr("y",t.y+l.height-12)):a.attr("x",t.posWithOffset-l.width/2),o.rotateCommitLabel))if(y==="TB"||y==="BT")a.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),n.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const f=-7.5-(l.width+10)/25*9.5,g=10+l.width/25*8.5;i.attr("transform","translate("+f+", "+g+") rotate(-45, "+s+", "+t.y+")")}}},"drawCommitLabel"),or=h((e,r,t,s)=>{if(r.tags.length>0){let o=0,i=0,n=0;const a=[];for(const l of r.tags.reverse()){const f=e.insert("polygon"),g=e.append("circle"),$=e.append("text").attr("y",t.y-16-o).attr("class","tag-label").text(l),c=$.node()?.getBBox();if(!c)throw new Error("Tag bbox not found");i=Math.max(i,c.width),n=Math.max(n,c.height),$.attr("x",t.posWithOffset-c.width/2),a.push({tag:$,hole:g,rect:f,yOffset:o}),o+=20}for(const{tag:l,hole:f,rect:g,yOffset:$}of a){const c=n/2,x=t.y-19.2-$;if(g.attr("class","tag-label-bkg").attr("points",` ${s-i/2-L/2},${x+R} ${s-i/2-L/2},${x-R} ${t.posWithOffset-i/2-L},${x-c-R} diff --git a/apps/kimi-code/dist-web/assets/index-V37-dq86.js b/apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index-V37-dq86.js rename to apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js index 45e88f965a5..2fcf7105af6 100644 --- a/apps/kimi-code/dist-web/assets/index-V37-dq86.js +++ b/apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-UfJy6YNI.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-Dm6A9KJ5.js","assets/ruby-DyJCeAvU.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-DbPARsA_.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-D7OTSIA_.js","assets/r-Dspwwk_N.js","assets/just-CUsbIsdP.js","assets/perl-B9cMNwum.js","assets/latex-CaSxy8MP.js","assets/tex-idrVyKtj.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/php-Csjmro_R.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/csharp-DSvCPggb.js","assets/rst-CpCqk9r5.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/go-C27-OAKa.js","assets/ts-tags-D351s5mN.js","assets/twig-CW1WmMYd.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]); -import{bR as c}from"./index-HRJ6xRtC.js";var Ft=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyNames,no=Object.prototype.hasOwnProperty,an=(e,t)=>{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return Ft(n,Symbol.toStringTag,{value:"Module"}),n},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=to(t),o=0,s=i.length,a;ot[l]).bind(null,a),enumerable:!(r=eo(t,a))||r.enumerable});return e},Sr=(e,t,n)=>(ro(e,t,"default"),n);const Ne=[{id:"abap",name:"ABAP",import:(()=>c(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>c(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>c(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>c(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>c(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>c(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>c(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>c(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>c(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>c(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>c(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>c(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>c(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>c(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>c(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>c(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>c(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>c(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>c(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>c(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>c(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>c(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>c(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>c(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>c(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>c(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>c(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>c(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>c(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>c(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>c(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>c(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>c(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>c(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>c(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>c(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>c(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>c(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>c(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>c(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>c(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>c(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>c(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>c(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>c(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>c(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>c(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>c(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>c(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>c(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>c(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>c(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>c(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>c(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>c(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>c(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>c(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>c(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>c(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>c(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>c(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>c(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>c(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>c(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>c(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>c(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>c(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>c(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>c(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>c(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>c(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>c(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>c(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>c(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>c(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>c(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>c(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>c(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>c(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>c(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>c(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>c(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>c(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>c(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>c(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>c(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>c(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>c(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>c(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>c(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>c(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>c(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>c(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>c(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>c(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>c(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>c(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>c(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>c(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>c(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>c(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>c(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>c(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>c(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>c(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>c(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>c(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>c(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>c(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>c(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>c(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>c(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>c(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>c(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>c(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>c(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>c(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>c(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>c(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>c(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>c(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>c(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>c(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>c(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>c(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>c(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>c(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>c(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>c(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>c(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>c(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>c(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>c(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>c(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>c(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>c(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>c(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>c(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>c(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>c(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>c(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>c(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>c(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>c(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>c(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>c(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>c(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>c(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>c(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>c(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>c(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>c(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>c(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>c(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>c(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>c(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>c(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>c(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>c(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>c(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>c(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>c(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>c(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>c(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>c(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>c(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>c(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>c(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>c(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>c(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>c(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>c(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>c(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>c(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>c(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>c(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>c(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>c(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>c(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>c(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>c(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>c(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>c(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>c(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>c(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>c(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>c(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>c(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>c(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>c(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>c(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>c(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>c(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>c(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>c(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>c(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>c(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>c(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>c(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>c(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>c(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>c(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>c(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>c(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>c(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>c(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>c(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>c(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>c(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>c(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>c(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>c(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>c(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>c(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>c(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>c(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>c(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>c(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>c(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>c(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>c(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>c(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>c(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>c(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>c(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>c(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>c(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>c(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>c(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>c(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>c(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>c(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>c(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>c(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>c(()=>import("./zig-VOosw3JB.js"),[]))}],at=Object.fromEntries(Ne.map(e=>[e.id,e.import])),lt=Object.fromEntries(Ne.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ut={...at,...lt},ct=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>c(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>c(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>c(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>c(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>c(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>c(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>c(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>c(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>c(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>c(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>c(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>c(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>c(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>c(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>c(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>c(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>c(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>c(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>c(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>c(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>c(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>c(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>c(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>c(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>c(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>c(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>c(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>c(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>c(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>c(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>c(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>c(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>c(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>c(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>c(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>c(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>c(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>c(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>c(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>c(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>c(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>c(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>c(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>c(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>c(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>c(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>c(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>c(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>c(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>c(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>c(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>c(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>c(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>c(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>c(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>c(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>c(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>c(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>c(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>c(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>c(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>c(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],dt=Object.fromEntries(ct.map(e=>[e.id,e.import]));var ln=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function io(){return 2147483648}function oo(){return typeof performance<"u"?performance.now():Date.now()}const so=(e,t)=>e+(t-e%t)%t;async function ao(e){let t,n;const r={};function i(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,m,E){r.HEAPU8.copyWithin(h,m,m+E)}function s(h){try{return t.grow(h-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function a(h){const m=r.HEAPU8.length;h=h>>>0;const E=io();if(h>E)return!1;for(let b=1;b<=4;b*=2){let g=m*(1+.2/b);g=Math.min(g,h+100663296);const y=Math.min(E,so(Math.max(h,g),65536));if(s(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(h,m,E=1024){const b=m+E;let g=m;for(;h[g]&&!(g>=b);)++g;if(g-m>16&&h.buffer&&l)return l.decode(h.subarray(m,g));let y="";for(;m>10,56320|I&1023)}}return y}function p(h,m){return h?u(r.HEAPU8,h,m):""}const d={emscripten_get_now:oo,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const m=await e({env:d,wasi_snapshot_preview1:d});t=m.memory,i(t.buffer),Object.assign(r,m),r.UTF8ToString=p}return await f(),r}var lo=Object.defineProperty,uo=(e,t,n)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>uo(e,typeof t!="symbol"?t+"":t,n);let D=null;function co(e){throw new ln(e.UTF8ToString(e.getLastOnigError()))}class pt{constructor(t){P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16Value"),P(this,"utf8Value"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16");const n=t.length,r=pt._utf8ByteLength(t),i=r!==n,o=i?new Uint32Array(n+1):null;i&&(o[n]=r);const s=i?new Uint32Array(r+1):null;i&&(s[r]=n);const a=new Uint8Array(r);let l=0;for(let u=0;u=55296&&p<=56319&&u+1=56320&&h<=57343&&(d=(p-55296<<10)+65536|h-56320,f=!0)}i&&(o[u]=l,f&&(o[u+1]=l),d<=127?s[l+0]=u:d<=2047?(s[l+0]=u,s[l+1]=u):d<=65535?(s[l+0]=u,s[l+1]=u,s[l+2]=u):(s[l+0]=u,s[l+1]=u,s[l+2]=u,s[l+3]=u)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=s}static _utf8ByteLength(t){let n=0;for(let r=0,i=t.length;r=55296&&o<=56319&&r+1=56320&&l<=57343&&(s=(o-55296<<10)+65536|l-56320,a=!0)}s<=127?n+=1:s<=2047?n+=2:s<=65535?n+=3:n+=4,a&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ht=class X{constructor(t){if(P(this,"id",++X.LAST_ID),P(this,"_onigBinding"),P(this,"content"),P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16"),P(this,"ptr"),!D)throw new ln("Must invoke loadWasm first.");this._onigBinding=D,this.content=t;const n=new pt(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!X._sharedPtrInUse?(X._sharedPtr||(X._sharedPtr=D.omalloc(1e4)),X._sharedPtrInUse=!0,D.HEAPU8.set(n.utf8Value,X._sharedPtr),this.ptr=X._sharedPtr):this.ptr=n.createString(D)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===X._sharedPtr?X._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};P(ht,"LAST_ID",0);P(ht,"_sharedPtr",0);P(ht,"_sharedPtrInUse",!1);let Lr=ht;class po{constructor(t){if(P(this,"_onigBinding"),P(this,"_ptr"),!D)throw new ln("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),ho(r)?r=await r.instantiator(n):fo(r)?r=await r.default(n):(mo(r)&&(r=r.data),go(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await yo(r)(n):r=await Eo(r)(n):_o(r)?r=await Lt(r)(n):r instanceof WebAssembly.Module?r=await Lt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Lt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Fe=t(),Fe}function Lt(e){return t=>WebAssembly.instantiate(e,t)}function yo(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Eo(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Rr;function bo(e){Rr=e}function wo(){return Rr}async function un(e){return e&&await ft(e),{createScanner(t){return new po(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Lr(t)}}}const vo=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:un,getDefaultWasmLoader:wo,loadWasm:ft,setDefaultWasmLoader:bo},Symbol.toStringTag,{value:"Module"}));var Ir=an({});Sr(Ir,vo);var L=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Co(e){return cn(e)}function cn(e){return Array.isArray(e)?Ao(e):e instanceof RegExp?e:typeof e=="object"?ko(e):e}function Ao(e){let t=[];for(let n=0,r=e.length;n{for(let r in n)e[r]=n[r]}),e}function Pr(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Pr(e.substring(0,e.length-1)):e.substr(~t+1)}var Rt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Rt.lastIndex=0,Rt.test(e))}static replaceCaptures(e,t,n){return e.replace(Rt,(r,i,o,s)=>{let a=n[parseInt(i||o,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(s){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Or(e,t){return et?1:0}function xr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;ithis._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>So(e.parent,i.parentScopes));return r?new Vr(r.fontStyle,r.foreground,r.background):null}},It=class Ke{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ke(t,r);return t}static from(...t){let n=null;for(let r=0;r"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Lo(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Lo(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Vr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ro(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,o=t.length;i1&&(b=m.slice(0,m.length-1),b.reverse()),n[r++]=new Io(E,b,i,l,u,p)}}return n}var Io=class{constructor(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o}},$=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))($||{});function To(e,t){e.sort((l,u)=>{let p=Or(l.scope,u.scope);return p!==0||(p=xr(l.parentScopes,u.parentScopes),p!==0)?p:l.index-u.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let o=new Po(t),s=new Vr(n,o.getId(r),o.getId(i)),a=new xo(new jt(0,null,-1,0,0),[]);for(let l=0,u=e.length;lt?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},xo=class Ht{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const o=n.parentScopes[i].length-t.parentScopes[r].length;if(o!==0)return o;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,o;if(r===-1?(i=t,o=""):(i=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ht._cmpBySpecificity),n}insert(t,n,r,i,o,s){if(n===""){this._doInsertHere(t,r,i,o,s);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let p;this._children.hasOwnProperty(l)?p=this._children[l]:(p=new Ht(this._mainRule.clone(),jt.cloneArr(this._rulesWithParentScopes)),this._children[l]=p),p.insert(t+1,u,r,i,o,s)}_doInsertHere(t,n,r,i,o){if(n===null){this._mainRule.acceptOverwrite(t,r,i,o);return}for(let s=0,a=this._rulesWithParentScopes.length;s>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,o,s,a){let l=U.getLanguageId(t),u=U.getTokenType(t),p=U.containsBalancedBrackets(t)?1:0,d=U.getFontStyle(t),f=U.getForeground(t),h=U.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),i!==null&&(p=i?1:0),o!==-1&&(d=o),s!==0&&(f=s),a!==0&&(h=a),(l<<0|u<<8|p<<10|d<<11|f<<15|h<<24)>>>0}};function Ze(e,t){const n=[],r=Do(e);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let u=s();if(n.push({matcher:u,priority:l}),i!==",")break;i=r.next()}return n;function o(){if(i==="-"){i=r.next();const l=o();return u=>!!l&&!l(u)}if(i==="("){i=r.next();const l=a();return i===")"&&(i=r.next()),l}if(Mn(i)){const l=[];do l.push(i),i=r.next();while(Mn(i));return u=>t(l,u)}return null}function s(){const l=[];let u=o();for(;u;)l.push(u),u=o();return p=>l.every(d=>d(p))}function a(){const l=[];let u=s();for(;u&&(l.push(u),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");u=s()}return p=>l.some(d=>d(p))}}function Mn(e){return!!e&&!!e.match(/[\w\.:]+/)}function Do(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Mr(e){typeof e.dispose=="function"&&e.dispose()}var Se=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},No=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Vo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$o=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Se(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Vo;for(const n of e)Mo(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Se){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Mo(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Se?Qe({baseGrammar:o,selfGrammar:i},r):Wt(e.ruleName,{baseGrammar:o,selfGrammar:i,repository:i.repository},r);const s=n.injections(e.scopeName);if(s)for(const a of s)r.add(new Se(a))}function Wt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];et([r],t,n)}}function Qe(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&et(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&et(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function et(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Tr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&et(r.patterns,{...t,repository:i},n);const o=r.include;if(!o)continue;const s=Gr(o);switch(s.kind){case 0:Qe({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qe(t,n);break;case 2:Wt(s.ruleName,{...t,repository:i},n);break;case 3:case 4:const a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:i};s.kind===4?Wt(s.ruleName,l,n):Qe(l,n)}else s.kind===4?n.add(new No(s.scopeName,s.ruleName)):n.add(new Se(s.scopeName));break}}}var Go=class{kind=0},Bo=class{kind=1},Uo=class{constructor(e){this.ruleName=e}kind=2},Fo=class{constructor(e){this.scopeName=e}kind=3},jo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Gr(e){if(e==="$base")return new Go;if(e==="$self")return new Bo;const t=e.indexOf("#");if(t===-1)return new Fo(e);if(t===0)return new Uo(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new jo(n,r)}}var Ho=/\\(\d+)/,Gn=/\\(\d+)/g,Wo=-1,Br=-2;var Ve=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Pr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},zo=class extends Ve{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},qo=class extends Ve{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Le(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Bn=class extends Ve{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zt=class extends Ve{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,o,s,a,l,u){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this._end=new Le(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},tt=class extends Ve{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Le(s,Br),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Re,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Ur=class V{static createCaptureRule(t,n,r,i,o){return t.registerRule(s=>new zo(n,s,r,i,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new qo(t.$vscodeTextmateLocation,t.id,t.name,t.match,V._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Tr({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Bn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,V._compilePatterns(o,n,r))}return t.while?new tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,V._compileCaptures(t.whileCaptures||t.captures,n,r),V._compilePatterns(t.patterns,n,r)):new zt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,V._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,V._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let o=0;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);a>o&&(o=a)}for(let s=0;s<=o;s++)i[s]=null;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);let l=0;t[s].patterns&&(l=V.getCompiledRuleId(t[s],n,r)),i[a]=V.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,l)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let o=0,s=t.length;ot.substring(i.start,i.end));return Gn.lastIndex=0,this.source.replace(Gn,(i,o)=>Dr(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],o,s,a,l;for(o=0,s=this.source.length;on.source);this._cached=new Un(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new Un(e,r,this._items.map(i=>i.ruleId))}},Un=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return Ft(n,Symbol.toStringTag,{value:"Module"}),n},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=to(t),o=0,s=i.length,a;ot[l]).bind(null,a),enumerable:!(r=eo(t,a))||r.enumerable});return e},Sr=(e,t,n)=>(ro(e,t,"default"),n);const Ne=[{id:"abap",name:"ABAP",import:(()=>c(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>c(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>c(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>c(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>c(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>c(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>c(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>c(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>c(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>c(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>c(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>c(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>c(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>c(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>c(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>c(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>c(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>c(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>c(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>c(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>c(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>c(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>c(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>c(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>c(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>c(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>c(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>c(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>c(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>c(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>c(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>c(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>c(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>c(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>c(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>c(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>c(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>c(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>c(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>c(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>c(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>c(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>c(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>c(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>c(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>c(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>c(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>c(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>c(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>c(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>c(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>c(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>c(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>c(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>c(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>c(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>c(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>c(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>c(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>c(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>c(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>c(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>c(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>c(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>c(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>c(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>c(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>c(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>c(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>c(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>c(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>c(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>c(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>c(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>c(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>c(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>c(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>c(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>c(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>c(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>c(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>c(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>c(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>c(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>c(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>c(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>c(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>c(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>c(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>c(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>c(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>c(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>c(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>c(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>c(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>c(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>c(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>c(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>c(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>c(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>c(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>c(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>c(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>c(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>c(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>c(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>c(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>c(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>c(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>c(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>c(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>c(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>c(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>c(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>c(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>c(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>c(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>c(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>c(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>c(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>c(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>c(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>c(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>c(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>c(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>c(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>c(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>c(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>c(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>c(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>c(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>c(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>c(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>c(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>c(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>c(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>c(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>c(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>c(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>c(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>c(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>c(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>c(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>c(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>c(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>c(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>c(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>c(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>c(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>c(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>c(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>c(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>c(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>c(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>c(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>c(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>c(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>c(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>c(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>c(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>c(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>c(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>c(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>c(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>c(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>c(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>c(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>c(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>c(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>c(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>c(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>c(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>c(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>c(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>c(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>c(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>c(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>c(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>c(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>c(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>c(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>c(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>c(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>c(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>c(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>c(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>c(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>c(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>c(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>c(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>c(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>c(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>c(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>c(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>c(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>c(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>c(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>c(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>c(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>c(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>c(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>c(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>c(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>c(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>c(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>c(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>c(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>c(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>c(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>c(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>c(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>c(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>c(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>c(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>c(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>c(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>c(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>c(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>c(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>c(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>c(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>c(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>c(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>c(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>c(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>c(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>c(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>c(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>c(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>c(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>c(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>c(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>c(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>c(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>c(()=>import("./zig-VOosw3JB.js"),[]))}],at=Object.fromEntries(Ne.map(e=>[e.id,e.import])),lt=Object.fromEntries(Ne.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ut={...at,...lt},ct=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>c(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>c(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>c(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>c(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>c(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>c(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>c(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>c(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>c(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>c(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>c(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>c(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>c(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>c(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>c(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>c(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>c(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>c(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>c(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>c(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>c(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>c(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>c(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>c(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>c(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>c(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>c(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>c(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>c(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>c(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>c(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>c(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>c(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>c(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>c(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>c(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>c(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>c(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>c(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>c(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>c(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>c(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>c(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>c(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>c(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>c(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>c(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>c(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>c(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>c(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>c(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>c(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>c(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>c(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>c(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>c(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>c(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>c(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>c(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>c(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>c(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>c(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],dt=Object.fromEntries(ct.map(e=>[e.id,e.import]));var ln=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function io(){return 2147483648}function oo(){return typeof performance<"u"?performance.now():Date.now()}const so=(e,t)=>e+(t-e%t)%t;async function ao(e){let t,n;const r={};function i(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,m,E){r.HEAPU8.copyWithin(h,m,m+E)}function s(h){try{return t.grow(h-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function a(h){const m=r.HEAPU8.length;h=h>>>0;const E=io();if(h>E)return!1;for(let b=1;b<=4;b*=2){let g=m*(1+.2/b);g=Math.min(g,h+100663296);const y=Math.min(E,so(Math.max(h,g),65536));if(s(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(h,m,E=1024){const b=m+E;let g=m;for(;h[g]&&!(g>=b);)++g;if(g-m>16&&h.buffer&&l)return l.decode(h.subarray(m,g));let y="";for(;m>10,56320|I&1023)}}return y}function p(h,m){return h?u(r.HEAPU8,h,m):""}const d={emscripten_get_now:oo,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const m=await e({env:d,wasi_snapshot_preview1:d});t=m.memory,i(t.buffer),Object.assign(r,m),r.UTF8ToString=p}return await f(),r}var lo=Object.defineProperty,uo=(e,t,n)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>uo(e,typeof t!="symbol"?t+"":t,n);let D=null;function co(e){throw new ln(e.UTF8ToString(e.getLastOnigError()))}class pt{constructor(t){P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16Value"),P(this,"utf8Value"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16");const n=t.length,r=pt._utf8ByteLength(t),i=r!==n,o=i?new Uint32Array(n+1):null;i&&(o[n]=r);const s=i?new Uint32Array(r+1):null;i&&(s[r]=n);const a=new Uint8Array(r);let l=0;for(let u=0;u=55296&&p<=56319&&u+1=56320&&h<=57343&&(d=(p-55296<<10)+65536|h-56320,f=!0)}i&&(o[u]=l,f&&(o[u+1]=l),d<=127?s[l+0]=u:d<=2047?(s[l+0]=u,s[l+1]=u):d<=65535?(s[l+0]=u,s[l+1]=u,s[l+2]=u):(s[l+0]=u,s[l+1]=u,s[l+2]=u,s[l+3]=u)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=s}static _utf8ByteLength(t){let n=0;for(let r=0,i=t.length;r=55296&&o<=56319&&r+1=56320&&l<=57343&&(s=(o-55296<<10)+65536|l-56320,a=!0)}s<=127?n+=1:s<=2047?n+=2:s<=65535?n+=3:n+=4,a&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ht=class X{constructor(t){if(P(this,"id",++X.LAST_ID),P(this,"_onigBinding"),P(this,"content"),P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16"),P(this,"ptr"),!D)throw new ln("Must invoke loadWasm first.");this._onigBinding=D,this.content=t;const n=new pt(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!X._sharedPtrInUse?(X._sharedPtr||(X._sharedPtr=D.omalloc(1e4)),X._sharedPtrInUse=!0,D.HEAPU8.set(n.utf8Value,X._sharedPtr),this.ptr=X._sharedPtr):this.ptr=n.createString(D)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===X._sharedPtr?X._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};P(ht,"LAST_ID",0);P(ht,"_sharedPtr",0);P(ht,"_sharedPtrInUse",!1);let Lr=ht;class po{constructor(t){if(P(this,"_onigBinding"),P(this,"_ptr"),!D)throw new ln("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),ho(r)?r=await r.instantiator(n):fo(r)?r=await r.default(n):(mo(r)&&(r=r.data),go(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await yo(r)(n):r=await Eo(r)(n):_o(r)?r=await Lt(r)(n):r instanceof WebAssembly.Module?r=await Lt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Lt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Fe=t(),Fe}function Lt(e){return t=>WebAssembly.instantiate(e,t)}function yo(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Eo(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Rr;function bo(e){Rr=e}function wo(){return Rr}async function un(e){return e&&await ft(e),{createScanner(t){return new po(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Lr(t)}}}const vo=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:un,getDefaultWasmLoader:wo,loadWasm:ft,setDefaultWasmLoader:bo},Symbol.toStringTag,{value:"Module"}));var Ir=an({});Sr(Ir,vo);var L=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Co(e){return cn(e)}function cn(e){return Array.isArray(e)?Ao(e):e instanceof RegExp?e:typeof e=="object"?ko(e):e}function Ao(e){let t=[];for(let n=0,r=e.length;n{for(let r in n)e[r]=n[r]}),e}function Pr(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Pr(e.substring(0,e.length-1)):e.substr(~t+1)}var Rt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Rt.lastIndex=0,Rt.test(e))}static replaceCaptures(e,t,n){return e.replace(Rt,(r,i,o,s)=>{let a=n[parseInt(i||o,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(s){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Or(e,t){return et?1:0}function xr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;ithis._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>So(e.parent,i.parentScopes));return r?new Vr(r.fontStyle,r.foreground,r.background):null}},It=class Ke{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ke(t,r);return t}static from(...t){let n=null;for(let r=0;r"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Lo(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Lo(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Vr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ro(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,o=t.length;i1&&(b=m.slice(0,m.length-1),b.reverse()),n[r++]=new Io(E,b,i,l,u,p)}}return n}var Io=class{constructor(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o}},$=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))($||{});function To(e,t){e.sort((l,u)=>{let p=Or(l.scope,u.scope);return p!==0||(p=xr(l.parentScopes,u.parentScopes),p!==0)?p:l.index-u.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let o=new Po(t),s=new Vr(n,o.getId(r),o.getId(i)),a=new xo(new jt(0,null,-1,0,0),[]);for(let l=0,u=e.length;lt?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},xo=class Ht{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const o=n.parentScopes[i].length-t.parentScopes[r].length;if(o!==0)return o;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,o;if(r===-1?(i=t,o=""):(i=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ht._cmpBySpecificity),n}insert(t,n,r,i,o,s){if(n===""){this._doInsertHere(t,r,i,o,s);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let p;this._children.hasOwnProperty(l)?p=this._children[l]:(p=new Ht(this._mainRule.clone(),jt.cloneArr(this._rulesWithParentScopes)),this._children[l]=p),p.insert(t+1,u,r,i,o,s)}_doInsertHere(t,n,r,i,o){if(n===null){this._mainRule.acceptOverwrite(t,r,i,o);return}for(let s=0,a=this._rulesWithParentScopes.length;s>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,o,s,a){let l=U.getLanguageId(t),u=U.getTokenType(t),p=U.containsBalancedBrackets(t)?1:0,d=U.getFontStyle(t),f=U.getForeground(t),h=U.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),i!==null&&(p=i?1:0),o!==-1&&(d=o),s!==0&&(f=s),a!==0&&(h=a),(l<<0|u<<8|p<<10|d<<11|f<<15|h<<24)>>>0}};function Ze(e,t){const n=[],r=Do(e);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let u=s();if(n.push({matcher:u,priority:l}),i!==",")break;i=r.next()}return n;function o(){if(i==="-"){i=r.next();const l=o();return u=>!!l&&!l(u)}if(i==="("){i=r.next();const l=a();return i===")"&&(i=r.next()),l}if(Mn(i)){const l=[];do l.push(i),i=r.next();while(Mn(i));return u=>t(l,u)}return null}function s(){const l=[];let u=o();for(;u;)l.push(u),u=o();return p=>l.every(d=>d(p))}function a(){const l=[];let u=s();for(;u&&(l.push(u),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");u=s()}return p=>l.some(d=>d(p))}}function Mn(e){return!!e&&!!e.match(/[\w\.:]+/)}function Do(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Mr(e){typeof e.dispose=="function"&&e.dispose()}var Se=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},No=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Vo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$o=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Se(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Vo;for(const n of e)Mo(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Se){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Mo(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Se?Qe({baseGrammar:o,selfGrammar:i},r):Wt(e.ruleName,{baseGrammar:o,selfGrammar:i,repository:i.repository},r);const s=n.injections(e.scopeName);if(s)for(const a of s)r.add(new Se(a))}function Wt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];et([r],t,n)}}function Qe(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&et(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&et(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function et(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Tr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&et(r.patterns,{...t,repository:i},n);const o=r.include;if(!o)continue;const s=Gr(o);switch(s.kind){case 0:Qe({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qe(t,n);break;case 2:Wt(s.ruleName,{...t,repository:i},n);break;case 3:case 4:const a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:i};s.kind===4?Wt(s.ruleName,l,n):Qe(l,n)}else s.kind===4?n.add(new No(s.scopeName,s.ruleName)):n.add(new Se(s.scopeName));break}}}var Go=class{kind=0},Bo=class{kind=1},Uo=class{constructor(e){this.ruleName=e}kind=2},Fo=class{constructor(e){this.scopeName=e}kind=3},jo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Gr(e){if(e==="$base")return new Go;if(e==="$self")return new Bo;const t=e.indexOf("#");if(t===-1)return new Fo(e);if(t===0)return new Uo(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new jo(n,r)}}var Ho=/\\(\d+)/,Gn=/\\(\d+)/g,Wo=-1,Br=-2;var Ve=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Pr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},zo=class extends Ve{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},qo=class extends Ve{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Le(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Bn=class extends Ve{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zt=class extends Ve{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,o,s,a,l,u){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this._end=new Le(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},tt=class extends Ve{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Le(s,Br),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Re,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Ur=class V{static createCaptureRule(t,n,r,i,o){return t.registerRule(s=>new zo(n,s,r,i,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new qo(t.$vscodeTextmateLocation,t.id,t.name,t.match,V._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Tr({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Bn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,V._compilePatterns(o,n,r))}return t.while?new tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,V._compileCaptures(t.whileCaptures||t.captures,n,r),V._compilePatterns(t.patterns,n,r)):new zt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,V._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,V._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let o=0;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);a>o&&(o=a)}for(let s=0;s<=o;s++)i[s]=null;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);let l=0;t[s].patterns&&(l=V.getCompiledRuleId(t[s],n,r)),i[a]=V.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,l)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let o=0,s=t.length;ot.substring(i.start,i.end));return Gn.lastIndex=0,this.source.replace(Gn,(i,o)=>Dr(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],o,s,a,l;for(o=0,s=this.source.length;on.source);this._cached=new Un(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new Un(e,r,this._items.map(i=>i.ruleId))}},Un=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Tt(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(qt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Ko=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Dr(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Fn=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function jr(e,t,n,r,i,o,s,a){const l=t.content.length;let u=!1,p=-1;if(s){const h=Qo(e,t,n,r,i,o);i=h.stack,r=h.linePos,n=h.isFirstLine,p=h.anchorPosition}const d=Date.now();for(;!u;){if(a!==0&&Date.now()-d>a)return new Fn(i,!0);f()}return new Fn(i,!1);function f(){const h=Jo(e,t,n,r,i,p);if(!h){o.produce(i,l),u=!0;return}const m=h.captureIndices,E=h.matchedRuleId,b=m&&m.length>0?m[0].end>r:!1;if(E===Wo){const g=i.getRule(e);o.produce(i,m[0].start),i=i.withContentNameScopesList(i.nameScopesList),Ce(e,t,n,i,o,g.endCaptures,m),o.produce(i,m[0].end);const y=i;if(i=i.parent,p=y.getAnchorPos(),!b&&y.getEnterPos()===r){i=y,o.produce(i,l),u=!0;return}}else{const g=e.getRule(E);o.produce(i,m[0].start);const y=i,w=g.getName(t.content,m),A=i.contentNameScopesList.pushAttributed(w,e);if(i=i.push(E,r,p,m[0].end===l,null,A,A),g instanceof zt){const k=g;Ce(e,t,n,i,o,k.beginCaptures,m),o.produce(i,m[0].end),p=m[0].end;const I=k.getContentName(t.content,m),M=A.pushAttributed(I,e);if(i=i.withContentNameScopesList(M),k.endHasBackReferences&&(i=i.withEndRule(k.getEndWithResolvedBackReferences(t.content,m))),!b&&y.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),u=!0;return}}else if(g instanceof tt){const k=g;Ce(e,t,n,i,o,k.beginCaptures,m),o.produce(i,m[0].end),p=m[0].end;const I=k.getContentName(t.content,m),M=A.pushAttributed(I,e);if(i=i.withContentNameScopesList(M),k.whileHasBackReferences&&(i=i.withEndRule(k.getWhileWithResolvedBackReferences(t.content,m))),!b&&y.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),u=!0;return}}else if(Ce(e,t,n,i,o,g.captures,m),o.produce(i,m[0].end),i=i.pop(),!b){i=i.safePop(),o.produce(i,l),u=!0;return}}m[0].end>r&&(r=m[0].end,n=!1)}}function Qo(e,t,n,r,i,o){let s=i.beginRuleCapturedEOL?0:-1;const a=[];for(let l=i;l;l=l.pop()){const u=l.getRule(e);u instanceof tt&&a.push({rule:u,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:u,findOptions:p}=es(l.rule,e,l.stack.endRule,n,r===s),d=u.findNextMatchSync(t,r,p);if(d){if(d.ruleId!==Br){i=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(o.produce(l.stack,d.captureIndices[0].start),Ce(e,t,n,l.stack,o,l.rule.whileCaptures,d.captureIndices),o.produce(l.stack,d.captureIndices[0].end),s=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{i=l.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:s,isFirstLine:n}}function Jo(e,t,n,r,i,o){const s=Yo(e,t,n,r,i,o),a=e.getInjections();if(a.length===0)return s;const l=Zo(a,e,t,n,r,i,o);if(!l)return s;if(!s)return l;const u=s.captureIndices[0].start,p=l.captureIndices[0].start;return p=a)&&(a=w,l=y.captureIndices,u=y.ruleId,p=m.priority,a===i))break}return l?{priorityMatch:p===-1,captureIndices:l,matchedRuleId:u}:null}function Hr(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function es(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ce(e,t,n,r,i,o,s){if(o.length===0)return;const a=t.content,l=Math.min(o.length,s.length),u=[],p=s[0].end;for(let d=0;dp)break;for(;u.length>0&&u[u.length-1].endPos<=h.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,h.start):i.produce(r,h.start),f.retokenizeCapturedWithRuleId){const E=f.getName(a,s),b=r.contentNameScopesList.pushAttributed(E,e),g=f.getContentName(a,s),y=b.pushAttributed(g,e),w=r.push(f.retokenizeCapturedWithRuleId,h.start,-1,!1,null,b,y),A=e.createOnigString(a.substring(0,h.end));jr(e,A,n&&h.start===0,h.start,w,i,!1,0),Mr(A);continue}const m=f.getName(a,s);if(m!==null){const b=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(m,e);u.push(new ts(b,h.end))}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var ts=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ns(e,t,n,r,i,o,s,a){return new is(e,t,n,r,i,o,s,a)}function jn(e,t,n,r,i){const o=Ze(t,nt),s=Ur.getCompiledRuleId(n,r,i.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:s,grammar:i,priority:a.priority})}function nt(e,t){if(t.length{for(let i=n;in&&e.substr(0,n)===t&&e[n]==="."}var is=class{constructor(e,t,n,r,i,o,s,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new Xo(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=Hn(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const l of Object.keys(i)){const u=Ze(l,nt);for(const p of u)this._tokenTypeMatchers.push({matcher:p.matcher,type:i[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const i=r.injections;if(i)for(let s in i)jn(t,s,i[s],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(s=>{const a=this.getExternalGrammar(s);if(a){const l=a.injectionSelector;l&&jn(t,l,a,this,a)}})}return t.sort((i,o)=>i.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Hn(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Ur.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Xt.NULL){i=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),p=this.themeProvider.getDefaults(),d=le.set(0,u.languageId,u.tokenType,null,p.fontStyle,p.foregroundId,p.backgroundId),f=this.getRule(this._rootId).getName(null,null);let h;f?h=Ae.createRootAndLookUpScopeName(f,d,this):h=Ae.createRoot("unknown",d),t=new Xt(null,this._rootId,-1,-1,!1,null,h,h)}else i=!1,t.reset();e=e+` `;const o=this.createOnigString(e),s=o.content.length,a=new ss(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=jr(this,o,i,0,t,a,!0,r);return Mr(o),{lineLength:s,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Hn(e,t){return e=Co(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Ae=class K{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(const o of n)i=It.push(i,o.scopeNames),r=new K(r,i,o.encodedTokenAttributes);return r}static createRoot(t,n){return new K(null,new It(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const i=r.getMetadataForScope(t),o=new It(null,t),s=r.themeProvider.themeMatch(o),a=K.mergeAttributes(n,i,s);return new K(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return K.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let i=-1,o=0,s=0;return r!==null&&(i=r.fontStyle,o=r.foregroundId,s=r.backgroundId),le.set(t,n.languageId,n.tokenType,null,i,o,s)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return K._pushAttributed(this,t,n);const r=t.split(/ /g);let i=this;for(const o of r)i=K._pushAttributed(i,o,n);return i}static _pushAttributed(t,n,r){const i=r.getMetadataForScope(n),o=t.scopePath.push(n),s=r.themeProvider.themeMatch(o),a=K.mergeAttributes(t.tokenAttributes,i,s);return new K(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},Xt=class ie{constructor(t,n,r,i,o,s,a,l){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}_stackElementBrand=void 0;static NULL=new ie(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:ie._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Ae.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ie._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,o,s,a){return new ie(this,t,n,r,i,o,s,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ie(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=Ae.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new ie(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ae.fromExtension(r,n.contentNameScopesList))}},os=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Ze(n,nt).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Ze(n,nt).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},ss=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,i=!1;if(this.balancedBracketSelectors?.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const s of this._tokenTypeOverrides)s.matcher(o)&&(r=le.set(r,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=le.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r0;)s.Q.map(a=>this._loadSingleGrammar(a.scopeName)),s.processQueue();return this._grammarForScopeName(t,n,r,i,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,i=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,i)}_grammarForScopeName(t,n=0,r=null,i=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,i,o)}},Kt=Xt.NULL;function Ie(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[i,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[i]=o:i===r&&Object.assign(n,o);return n}function ee(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Wr(e){return Array.isArray(e)?e:[e]}async function dn(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function $e(e){return!e||["plaintext","txt","text","plain"].includes(e)}function pn(e){return e==="ansi"||$e(e)}function Me(e){return e==="none"}function hn(e){return Me(e)}const us=/(\r?\n)/g;function Ge(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(us);let r=0;const i=[];for(let o=0;o!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?Wn.light:Wn.dark),n||(n=t.type==="light"?zn.light:zn.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0;const o=new Map;function s(a){if(o.has(a))return o.get(a);i+=1;const l=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?s(a):(o.set(a,l),l)}t.settings=t.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),u=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!u)return a;const p={...a,settings:{...a.settings}};if(l){const d=s(a.settings.foreground);t.colorReplacements[d]=a.settings.foreground,p.settings.foreground=d}if(u){const d=s(a.settings.background);t.colorReplacements[d]=a.settings.background,p.settings.background=d}return p});for(const a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const l=s(t.colors[a]);t.colorReplacements[l]=t.colors[a],t.colors[a]=l}return Object.defineProperty(t,qn,{enumerable:!1,writable:!1,value:!0}),t}async function zr(e){return[...new Set((await Promise.all(e.filter(t=>!pn(t)).map(async t=>await dn(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function qr(e){return(await Promise.all(e.map(async t=>hn(t)?null:mt(await dn(t))))).filter(t=>!!t)}function Xr(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new L(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var cs=class extends ls{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=mt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ye.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(i=>i.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(i=>{this._alias[i]=e.name}),this._loadedLanguagesCache=null,t.size)for(const i of t)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,i])=>!i);if(n.length){const r=t.filter(([i,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(s=>n.map(([a])=>a).includes(s)):!1).filter(i=>!n.includes(i));throw new L(`Missing languages ${n.map(([i])=>`\`${i}\``).join(", ")}, required by ${r.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[r,i]of t)this._resolver.addLanguage(i);for(const[r,i]of t)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},ds=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let r=1;r<=t.length;r++){const i=t.slice(0,r).join(".");n=[...n,...this._injections.get(i)||[]]}return n}};let ve=0;function gt(e){ve+=1,e.warnings!==!1&&ve>=10&&ve%10===0&&console.warn(`[Shiki] ${ve} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new L("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(mt),i=new cs(new ds(e.engine,n),r,n,e.langAlias);let o;function s(y){return Xr(y,e.langAlias)}function a(y){b();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new L(`Language \`${y}\` not found, you may need to load it first`);return w}function l(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};b();const w=i.getTheme(y);if(!w)throw new L(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){b();const w=l(y);return o!==y&&(i.setTheme(w),o=y),{theme:w,colorMap:i.getColorMap()}}function p(){return b(),i.getLoadedThemes()}function d(){return b(),i.getLoadedLanguages()}function f(...y){b(),i.loadLanguages(y.flat(1))}async function h(...y){return f(await zr(y))}function m(...y){b();for(const w of y.flat(1))i.loadTheme(w)}async function E(...y){return b(),m(await qr(y))}function b(){if(t)throw new L("Shiki instance has been disposed")}function g(){t||(t=!0,i.dispose(),ve-=1)}return{setTheme:u,getTheme:l,getLanguage:a,getLoadedThemes:p,getLoadedLanguages:d,resolveLangAlias:s,loadLanguage:h,loadLanguageSync:f,loadTheme:E,loadThemeSync:m,dispose:g,[Symbol.dispose]:g}}const ps=gt;async function fn(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([qr(e.themes||[]),zr(e.langs||[]),e.engine]);return gt({...e,themes:t,langs:n,engine:r})}const hs=fn,Kr=new WeakMap;function _t(e,t){Kr.set(e,t)}function Te(e){return Kr.get(e)}var yt=class Qr{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Qr(Object.fromEntries(Wr(n).map(r=>[r,Kt])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,i]=t;this.lang=r,this._stacks={[i]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return fs(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function fs(e){const t=[],n=new Set;function r(i){if(n.has(i))return;n.add(i);const o=i?.nameScopesList?.scopeName;o&&t.push(o),i.parent&&r(i.parent)}return r(e),t}function ms(e,t){if(!(e instanceof yt))throw new L("Invalid grammar state");return e.getInternalStack(t)}const gs=/,/,_s=/ /;function Jr(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if($e(e.resolveLangAlias(n.lang||"text"))||Me(r))return Ge(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:i,colorMap:o}=e.setTheme(r),s=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==s.name)throw new L(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(i.name))throw new L(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Zr(t,s,i,o,n)}function Yr(...e){if(e.length===2)return Te(e[1]);const[t,n,r={}]=e,{lang:i="text",theme:o=t.getLoadedThemes()[0]}=r;if($e(i)||Me(o))throw new L("Plain language does not have grammar state");if(i==="ansi")throw new L("ANSI language does not have grammar state");const{theme:s,colorMap:a}=t.setTheme(o),l=t.getLanguage(i);return new yt(mn(n,l,s,a,r).stateStack,l.name,s.name)}function Zr(e,t,n,r,i){const o=mn(e,t,n,r,i),s=new yt(o.stateStack,t.name,n.name);return _t(o.tokens,s),o.tokens}function mn(e,t,n,r,i){const o=Ie(n,i),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:a=500,includeExplanation:l=!1}=i,u=Ge(e);let p=i.grammarState?ms(i.grammarState,n.name)??Kt:i.grammarContextCode!=null?mn(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:Kt,d=[];const f=[];for(let h=0,m=u.length;h0&&E.length>=s){d=[],f.push([{content:E,offset:b,color:"",fontStyle:0}]);continue}let g,y,w;l&&l!=="tokenType"&&(g=t.tokenizeLine(E,p,a),y=g.tokens,w=0);const A=t.tokenizeLine2(E,p,a),k=A.tokens.length/2;for(let I=0;ISt.trim());break;case"object":he=Q.scope;break;default:continue}Nn.push({settings:Q,selectors:he.map(St=>St.split(_s))})}q.explanation=[];let Vn=0;for(;M+Vn({scopeName:t}))}function Es(e,t){const n=[];for(let r=0,i=t.length;r=0&&i>=0;)Xn(e[r],n[i])&&(r-=1),i-=1;return r===-1}function ws(e,t,n){const r=[];for(const{selectors:i,settings:o}of e)for(const s of i)if(bs(s,t,n)){r.push(o);break}return r}function gn(e,t,n,r=Jr){const i=Object.entries(n.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})),o=i.map(u=>{const p=r(e,t,{...n,theme:u.theme});return{tokens:p,state:Te(p),theme:typeof u.theme=="string"?u.theme:u.theme.name}}),s=vs(...o.map(u=>u.tokens)),a=s[0].map((u,p)=>u.map((d,f)=>{const h={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=d.explanation),s.forEach((m,E)=>{const{content:b,explanation:g,offset:y,...w}=m[p][f];h.variants[i[E].color]=w}),h})),l=o[0].state?new yt(Object.fromEntries(o.map(u=>[u.theme,u.state?.getInternalStack(u.theme)])),o[0].state.lang):void 0;return l&&_t(a,l),a}function vs(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;rl[r]),o=t.map(()=>[]);t.forEach((l,u)=>l.push(o[u]));const s=i.map(()=>0),a=i.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(u=>u.content.length));for(let u=0;u4&&n.slice(0,4)==="data"&&Rs.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Qn,Ps);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Qn.test(o)){let s=o.replace(Ls,Ts);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=_n}return new i(r,t)}function Ts(e){return"-"+e.toLowerCase()}function Ps(e){return e.charAt(1).toUpperCase()}const Os=ei([ti,ks,ii,oi,si],"html"),ai=ei([ti,Ss,ii,oi,si],"svg"),Jn={}.hasOwnProperty;function xs(e,t){const n=t||{};function r(i,...o){let s=r.invalid;const a=r.handlers;if(i&&Jn.call(i,e)){const l=String(i[e]);s=Jn.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Ds=/["&'<>`]/g,Ns=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$s=/[|\\{}()[\]^$+*?.]/g,Yn=new WeakMap;function Ms(e,t){if(e=e.replace(t.subset?Gs(t.subset):Ds,r),t.subset||t.escapeOnly)return e;return e.replace(Ns,n).replace(Vs,r);function n(i,o,s){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),t)}function r(i,o,s){return t.format(i.charCodeAt(0),s.charCodeAt(o+1),t)}}function Gs(e){let t=Yn.get(e);return t||(t=Bs(e),Yn.set(e,t)),t}function Bs(e){const t=[];let n=-1;for(;++n",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},zs=["cent","copy","divide","gt","lt","not","para","times"],li={}.hasOwnProperty,Zt={};let He;for(He in Ot)li.call(Ot,He)&&(Zt[Ot[He]]=He);const qs=/[^\dA-Za-z]/;function Xs(e,t,n,r){const i=String.fromCharCode(e);if(li.call(Zt,i)){const o=Zt[i],s="&"+o;return n&&Ws.includes(o)&&!zs.includes(o)&&(!r||t&&t!==61&&qs.test(String.fromCharCode(t)))?s:s+";"}return""}function Ks(e,t,n){let r=Fs(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Xs(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const o=Hs(e,t,n.omitOptionalSemicolons);o.length|^->||--!>|"],Ys=["<",">"];function Zs(e,t,n,r){return r.settings.bogusComments?"":"";function i(o){return ye(o,Object.assign({},r.settings.characterReferences,{subset:Ys}))}}function ea(e,t,n,r){return""}function Zn(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function ta(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function na(e){return e.join(" ").trim()}const ra=/[ \t\n\f\r]/g;function yn(e){return typeof e=="object"?e.type==="text"?er(e.value):!1:er(e)}function er(e){return e.replace(ra,"")===""}const x=ci(1),ui=ci(-1),ia=[];function ci(e){return t;function t(n,r,i){const o=n?n.children:ia;let s=(r||0)+e,a=o[s];if(!i)for(;a&&yn(a);)s+=e,a=o[s];return a}}const oa={}.hasOwnProperty;function di(e){return t;function t(n,r,i){return oa.call(e,n.tagName)&&e[n.tagName](n,r,i)}}const En=di({body:aa,caption:xt,colgroup:xt,dd:da,dt:ca,head:xt,html:sa,li:ua,optgroup:pa,option:ha,p:la,rp:tr,rt:tr,tbody:ma,td:nr,tfoot:ga,th:nr,thead:fa,tr:_a});function xt(e,t,n){const r=x(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&yn(r.value.charAt(0)))}function sa(e,t,n){const r=x(n,t);return!r||r.type!=="comment"}function aa(e,t,n){const r=x(n,t);return!r||r.type!=="comment"}function la(e,t,n){const r=x(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ua(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="li"}function ca(e,t,n){const r=x(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function da(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function tr(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function pa(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function ha(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function fa(e,t,n){const r=x(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ma(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ga(e,t,n){return!x(n,t)}function _a(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function nr(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ya=di({body:wa,colgroup:va,head:ba,html:Ea,tbody:Ca});function Ea(e){const t=x(e,-1);return!t||t.type!=="comment"}function ba(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function wa(e){const t=x(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&yn(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function va(e,t,n){const r=ui(n,t),i=x(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&En(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Ca(e,t,n){const r=ui(n,t),i=x(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&En(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const We={name:[[` \f\r &/=>`.split(""),` diff --git a/apps/kimi-code/dist-web/assets/index-D-7nOosq.js b/apps/kimi-code/dist-web/assets/index-D-7nOosq.js new file mode 100644 index 00000000000..f2c6fdf4b69 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/index-D-7nOosq.js @@ -0,0 +1,638 @@ +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mhchem-DtR62fUK.js","assets/katex-DnlPpQZa.js","assets/mermaid.core-CJB1tAev.js","assets/_commonjsHelpers-CqkleIqs.js","assets/CodeBlockNode-BAtAs_qm.js","assets/safeRaf-DGuzXxDK.js","assets/index5-Cn2jfVMX.js","assets/index11-Ci8_PlMN.js","assets/DesignSystemView-CTUhpkDe.js","assets/DesignSystemView-DVONbdv-.css","assets/rive-CeXCFBdn.js"])))=>i.map(i=>d[i]); +(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))o(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&o(r)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function o(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();/** +* @vue/shared v3.5.39 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/function Dg(e){const t=Object.create(null);for(const n of e.split(","))t[n]=1;return n=>n in t}const An={},Id=[],wr=()=>{},xS=()=>!1,Fp=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),Bg=e=>e.startsWith("onUpdate:"),to=Object.assign,I8=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},pR=Object.prototype.hasOwnProperty,Kn=(e,t)=>pR.call(e,t),jt=Array.isArray,Ld=e=>c1(e)==="[object Map]",Ac=e=>c1(e)==="[object Set]",k7=e=>c1(e)==="[object Date]",hR=e=>c1(e)==="[object RegExp]",un=e=>typeof e=="function",ro=e=>typeof e=="string",lr=e=>typeof e=="symbol",Zn=e=>e!==null&&typeof e=="object",L8=e=>(Zn(e)||un(e))&&un(e.then)&&un(e.catch),SS=Object.prototype.toString,c1=e=>SS.call(e),mR=e=>c1(e).slice(8,-1),Hg=e=>c1(e)==="[object Object]",zg=e=>ro(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,oc=Dg(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Wg=e=>{const t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},gR=/-\w/g,_s=Wg(e=>e.replace(gR,t=>t.slice(1).toUpperCase())),vR=/\B([A-Z])/g,Bi=Wg(e=>e.replace(vR,"-$1").toLowerCase()),Ug=Wg(e=>e.charAt(0).toUpperCase()+e.slice(1)),Fh=Wg(e=>e?`on${Ug(e)}`:""),Es=(e,t)=>!Object.is(e,t),$d=(e,...t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:o,value:n})},jg=e=>{const t=parseFloat(e);return isNaN(t)?e:t},cm=e=>{const t=ro(e)?Number(e):NaN;return isNaN(t)?e:t};let b7;const Vg=()=>b7||(b7=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),yR="Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol",kR=Dg(yR);function Zt(e){if(jt(e)){const t={};for(let n=0;n{if(n){const o=n.split(CR);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Re(e){let t="";if(ro(e))t=e;else if(jt(e))for(let n=0;nsa(n,t))}const TS=e=>!!(e&&e.__v_isRef===!0),N=e=>ro(e)?e:e==null?"":jt(e)||Zn(e)&&(e.toString===SS||!un(e.toString))?TS(e)?N(e.value):JSON.stringify(e,ES,2):String(e),ES=(e,t)=>TS(t)?ES(e,t.value):Ld(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,s],i)=>(n[Dv(o,i)+" =>"]=s,n),{})}:Ac(t)?{[`Set(${t.size})`]:[...t.values()].map(n=>Dv(n))}:lr(t)?Dv(t):Zn(t)&&!jt(t)&&!Hg(t)?String(t):t,Dv=(e,t="")=>{var n;return lr(e)?`Symbol(${(n=e.description)!=null?n:t})`:e};function TR(e){return e==null?"initial":typeof e=="string"?e===""?" ":e:String(e)}/** +* @vue/reactivity v3.5.39 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let ks;class IS{constructor(t=!1){this.detached=t,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!t&&ks&&(ks.active?(this.parent=ks,this.index=(ks.scopes||(ks.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let t,n;if(this.scopes)for(t=0,n=this.scopes.length;t0&&--this._on===0){if(ks===this)ks=this.prevScope;else{let t=ks;for(;t;){if(t.prevScope===this){t.prevScope=this.prevScope;break}t=t.prevScope}}this.prevScope=void 0}}stop(t){if(this._active){this._active=!1;let n,o;for(n=0,o=this.effects.length;n0)return;if(Nf){let t=Nf;for(Nf=void 0;t;){const n=t.next;t.next=void 0,t.flags&=-9,t=n}}let e;for(;$f;){let t=$f;for($f=void 0;t;){const n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(o){e||(e=o)}t=n}}if(e)throw e}function NS(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function FS(e){let t,n=e.depsTail,o=n;for(;o;){const s=o.prevDep;o.version===-1?(o===n&&(n=s),F8(o),IR(o)):t=o,o.dep.activeLink=o.prevActiveLink,o.prevActiveLink=void 0,o=s}e.deps=t,e.depsTail=n}function A4(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(RS(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function RS(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===ip)||(e.globalVersion=ip,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!A4(e))))return;e.flags|=2;const t=e.dep,n=ho,o=jr;ho=e,jr=!0;try{NS(e);const s=e.fn(e._value);(t.version===0||Es(s,e._value))&&(e.flags|=128,e._value=s,t.version++)}catch(s){throw t.version++,s}finally{ho=n,jr=o,FS(e),e.flags&=-3}}function F8(e,t=!1){const{dep:n,prevSub:o,nextSub:s}=e;if(o&&(o.nextSub=s,e.prevSub=void 0),s&&(s.prevSub=o,e.nextSub=void 0),n.subs===e&&(n.subs=o,!o&&n.computed)){n.computed.flags&=-5;for(let i=n.computed.deps;i;i=i.nextDep)F8(i,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function IR(e){const{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}function kje(e,t){e.effect instanceof dm&&(e=e.effect.fn);const n=new dm(e);t&&to(n,t);try{n.run()}catch(s){throw n.stop(),s}const o=n.run.bind(n);return o.effect=n,o}function bje(e){e.effect.stop()}let jr=!0;const OS=[];function wl(){OS.push(jr),jr=!1}function _l(){const e=OS.pop();jr=e===void 0?!0:e}function C7(e){const{cleanup:t}=e;if(e.cleanup=void 0,t){const n=ho;ho=void 0;try{t()}finally{ho=n}}}let ip=0;class LR{constructor(t,n){this.sub=t,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class Zg{constructor(t){this.computed=t,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(t){if(!ho||!jr||ho===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==ho)n=this.activeLink=new LR(ho,this),ho.deps?(n.prevDep=ho.depsTail,ho.depsTail.nextDep=n,ho.depsTail=n):ho.deps=ho.depsTail=n,PS(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const o=n.nextDep;o.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=o),n.prevDep=ho.depsTail,n.nextDep=void 0,ho.depsTail.nextDep=n,ho.depsTail=n,ho.deps===n&&(ho.deps=o)}return n}trigger(t){this.version++,ip++,this.notify(t)}notify(t){$8();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{N8()}}}function PS(e){if(e.dep.sc++,e.sub.flags&4){const t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let o=t.deps;o;o=o.nextDep)PS(o)}const n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}const fm=new WeakMap,sc=Symbol(""),M4=Symbol(""),rp=Symbol("");function ii(e,t,n){if(jr&&ho){let o=fm.get(e);o||fm.set(e,o=new Map);let s=o.get(n);s||(o.set(n,s=new Zg),s.map=o,s.key=n),s.track()}}function Zl(e,t,n,o,s,i){const r=fm.get(e);if(!r){ip++;return}const l=a=>{a&&a.trigger()};if($8(),t==="clear")r.forEach(l);else{const a=jt(e),u=a&&zg(n);if(a&&n==="length"){const c=Number(o);r.forEach((d,f)=>{(f==="length"||f===rp||!lr(f)&&f>=c)&&l(d)})}else switch((n!==void 0||r.has(void 0))&&l(r.get(n)),u&&l(r.get(rp)),t){case"add":a?u&&l(r.get("length")):(l(r.get(sc)),Ld(e)&&l(r.get(M4)));break;case"delete":a||(l(r.get(sc)),Ld(e)&&l(r.get(M4)));break;case"set":Ld(e)&&l(r.get(sc));break}}N8()}function $R(e,t){const n=fm.get(e);return n&&n.get(t)}function Jc(e){const t=Pn(e);return t===e?t:(ii(t,"iterate",rp),tr(e)?t:t.map(Kr))}function Gg(e){return ii(e=Pn(e),"iterate",rp),e}function ml(e,t){return ia(e)?Xd(Wa(e)?Kr(t):t):Kr(t)}const NR={__proto__:null,[Symbol.iterator](){return Hv(this,Symbol.iterator,e=>ml(this,e))},concat(...e){return Jc(this).concat(...e.map(t=>jt(t)?Jc(t):t))},entries(){return Hv(this,"entries",e=>(e[1]=ml(this,e[1]),e))},every(e,t){return Hl(this,"every",e,t,void 0,arguments)},filter(e,t){return Hl(this,"filter",e,t,n=>n.map(o=>ml(this,o)),arguments)},find(e,t){return Hl(this,"find",e,t,n=>ml(this,n),arguments)},findIndex(e,t){return Hl(this,"findIndex",e,t,void 0,arguments)},findLast(e,t){return Hl(this,"findLast",e,t,n=>ml(this,n),arguments)},findLastIndex(e,t){return Hl(this,"findLastIndex",e,t,void 0,arguments)},forEach(e,t){return Hl(this,"forEach",e,t,void 0,arguments)},includes(...e){return zv(this,"includes",e)},indexOf(...e){return zv(this,"indexOf",e)},join(e){return Jc(this).join(e)},lastIndexOf(...e){return zv(this,"lastIndexOf",e)},map(e,t){return Hl(this,"map",e,t,void 0,arguments)},pop(){return G1(this,"pop")},push(...e){return G1(this,"push",e)},reduce(e,...t){return w7(this,"reduce",e,t)},reduceRight(e,...t){return w7(this,"reduceRight",e,t)},shift(){return G1(this,"shift")},some(e,t){return Hl(this,"some",e,t,void 0,arguments)},splice(...e){return G1(this,"splice",e)},toReversed(){return Jc(this).toReversed()},toSorted(e){return Jc(this).toSorted(e)},toSpliced(...e){return Jc(this).toSpliced(...e)},unshift(...e){return G1(this,"unshift",e)},values(){return Hv(this,"values",e=>ml(this,e))}};function Hv(e,t,n){const o=Gg(e),s=o[t]();return o!==e&&!tr(e)&&(s._next=s.next,s.next=()=>{const i=s._next();return i.done||(i.value=n(i.value)),i}),s}const FR=Array.prototype;function Hl(e,t,n,o,s,i){const r=Gg(e),l=r!==e&&!tr(e),a=r[t];if(a!==FR[t]){const d=a.apply(e,i);return l?Kr(d):d}let u=n;r!==e&&(l?u=function(d,f){return n.call(this,ml(e,d),f,e)}:n.length>2&&(u=function(d,f){return n.call(this,d,f,e)}));const c=a.call(r,u,o);return l&&s?s(c):c}function w7(e,t,n,o){const s=Gg(e),i=s!==e&&!tr(e);let r=n,l=!1;s!==e&&(i?(l=o.length===0,r=function(u,c,d){return l&&(l=!1,u=ml(e,u)),n.call(this,u,ml(e,c),d,e)}):n.length>3&&(r=function(u,c,d){return n.call(this,u,c,d,e)}));const a=s[t](r,...o);return l?ml(e,a):a}function zv(e,t,n){const o=Pn(e);ii(o,"iterate",rp);const s=o[t](...n);return(s===-1||s===!1)&&Jg(n[0])?(n[0]=Pn(n[0]),o[t](...n)):s}function G1(e,t,n=[]){wl(),$8();const o=Pn(e)[t].apply(e,n);return N8(),_l(),o}const RR=Dg("__proto__,__v_isRef,__isVue"),DS=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(lr));function OR(e){lr(e)||(e=String(e));const t=Pn(this);return ii(t,"has",e),t.hasOwnProperty(e)}class BS{constructor(t=!1,n=!1){this._isReadonly=t,this._isShallow=n}get(t,n,o){if(n==="__v_skip")return t.__v_skip;const s=this._isReadonly,i=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return i;if(n==="__v_raw")return o===(s?i?VS:jS:i?US:WS).get(t)||Object.getPrototypeOf(t)===Object.getPrototypeOf(o)?t:void 0;const r=jt(t);if(!s){let a;if(r&&(a=NR[n]))return a;if(n==="hasOwnProperty")return OR}const l=Reflect.get(t,n,Xo(t)?t:o);if((lr(n)?DS.has(n):RR(n))||(s||ii(t,"get",n),i))return l;if(Xo(l)){const a=r&&zg(n)?l:l.value;return s&&Zn(a)?E4(a):a}return Zn(l)?s?E4(l):Go(l):l}}class HS extends BS{constructor(t=!1){super(!1,t)}set(t,n,o,s){let i=t[n];const r=jt(t)&&zg(n);if(!this._isShallow){const u=ia(i);if(!tr(o)&&!ia(o)&&(i=Pn(i),o=Pn(o)),!r&&Xo(i)&&!Xo(o))return u||(i.value=o),!0}const l=r?Number(n)e,P0=e=>Reflect.getPrototypeOf(e);function zR(e,t,n){return function(...o){const s=this.__v_raw,i=Pn(s),r=Ld(i),l=e==="entries"||e===Symbol.iterator&&r,a=e==="keys"&&r,u=s[e](...o),c=n?T4:t?Xd:Kr;return!t&&ii(i,"iterate",a?M4:sc),to(Object.create(u),{next(){const{value:d,done:f}=u.next();return f?{value:d,done:f}:{value:l?[c(d[0]),c(d[1])]:c(d),done:f}}})}}function D0(e){return function(...t){return e==="delete"?!1:e==="clear"?void 0:this}}function WR(e,t){const n={get(s){const i=this.__v_raw,r=Pn(i),l=Pn(s);e||(Es(s,l)&&ii(r,"get",s),ii(r,"get",l));const{has:a}=P0(r),u=t?T4:e?Xd:Kr;if(a.call(r,s))return u(i.get(s));if(a.call(r,l))return u(i.get(l));i!==r&&i.get(s)},get size(){const s=this.__v_raw;return!e&&ii(Pn(s),"iterate",sc),s.size},has(s){const i=this.__v_raw,r=Pn(i),l=Pn(s);return e||(Es(s,l)&&ii(r,"has",s),ii(r,"has",l)),s===l?i.has(s):i.has(s)||i.has(l)},forEach(s,i){const r=this,l=r.__v_raw,a=Pn(l),u=t?T4:e?Xd:Kr;return!e&&ii(a,"iterate",sc),l.forEach((c,d)=>s.call(i,u(c),u(d),r))}};return to(n,e?{add:D0("add"),set:D0("set"),delete:D0("delete"),clear:D0("clear")}:{add(s){const i=Pn(this),r=P0(i),l=Pn(s),a=!t&&!tr(s)&&!ia(s)?l:s;return r.has.call(i,a)||Es(s,a)&&r.has.call(i,s)||Es(l,a)&&r.has.call(i,l)||(i.add(a),Zl(i,"add",a,a)),this},set(s,i){!t&&!tr(i)&&!ia(i)&&(i=Pn(i));const r=Pn(this),{has:l,get:a}=P0(r);let u=l.call(r,s);u||(s=Pn(s),u=l.call(r,s));const c=a.call(r,s);return r.set(s,i),u?Es(i,c)&&Zl(r,"set",s,i):Zl(r,"add",s,i),this},delete(s){const i=Pn(this),{has:r,get:l}=P0(i);let a=r.call(i,s);a||(s=Pn(s),a=r.call(i,s)),l&&l.call(i,s);const u=i.delete(s);return a&&Zl(i,"delete",s,void 0),u},clear(){const s=Pn(this),i=s.size!==0,r=s.clear();return i&&Zl(s,"clear",void 0,void 0),r}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=zR(s,e,t)}),n}function Yg(e,t){const n=WR(e,t);return(o,s,i)=>s==="__v_isReactive"?!e:s==="__v_isReadonly"?e:s==="__v_raw"?o:Reflect.get(Kn(n,s)&&s in o?n:o,s,i)}const UR={get:Yg(!1,!1)},jR={get:Yg(!1,!0)},VR={get:Yg(!0,!1)},qR={get:Yg(!0,!0)},WS=new WeakMap,US=new WeakMap,jS=new WeakMap,VS=new WeakMap;function KR(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Go(e){return ia(e)?e:Xg(e,!1,PR,UR,WS)}function qS(e){return Xg(e,!1,BR,jR,US)}function E4(e){return Xg(e,!0,DR,VR,jS)}function Cje(e){return Xg(e,!0,HR,qR,VS)}function Xg(e,t,n,o,s){if(!Zn(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;const i=s.get(e);if(i)return i;const r=KR(mR(e));if(r===0)return e;const l=new Proxy(e,r===2?o:n);return s.set(e,l),l}function Wa(e){return ia(e)?Wa(e.__v_raw):!!(e&&e.__v_isReactive)}function ia(e){return!!(e&&e.__v_isReadonly)}function tr(e){return!!(e&&e.__v_isShallow)}function Jg(e){return e?!!e.__v_raw:!1}function Pn(e){const t=e&&e.__v_raw;return t?Pn(t):e}function kt(e){return!Kn(e,"__v_skip")&&Object.isExtensible(e)&&AS(e,"__v_skip",!0),e}const Kr=e=>Zn(e)?Go(e):e,Xd=e=>Zn(e)?E4(e):e;function Xo(e){return e?e.__v_isRef===!0:!1}function Z(e){return KS(e,!1)}function Xr(e){return KS(e,!0)}function KS(e,t){return Xo(e)?e:new ZR(e,t)}class ZR{constructor(t,n){this.dep=new Zg,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?t:Pn(t),this._value=n?t:Kr(t),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(t){const n=this._rawValue,o=this.__v_isShallow||tr(t)||ia(t);t=o?t:Pn(t),Es(t,n)&&(this._rawValue=t,this._value=o?t:Kr(t),this.dep.trigger())}}function GR(e){e.dep&&e.dep.trigger()}function p(e){return Xo(e)?e.value:e}function Rh(e){return un(e)?e():p(e)}const YR={get:(e,t,n)=>t==="__v_raw"?e:p(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const s=e[t];return Xo(s)&&!Xo(n)?(s.value=n,!0):Reflect.set(e,t,n,o)}};function ZS(e){return Wa(e)?e:new Proxy(e,YR)}class XR{constructor(t){this.__v_isRef=!0,this._value=void 0;const n=this.dep=new Zg,{get:o,set:s}=t(n.track.bind(n),n.trigger.bind(n));this._get=o,this._set=s}get value(){return this._value=this._get()}set value(t){this._set(t)}}function JR(e){return new XR(e)}function wje(e){const t=jt(e)?new Array(e.length):{};for(const n in e)t[n]=GS(e,n);return t}class QR{constructor(t,n,o){this._object=t,this._defaultValue=o,this.__v_isRef=!0,this._value=void 0,this._key=lr(n)?n:String(n),this._raw=Pn(t);let s=!0,i=t;if(!jt(t)||lr(this._key)||!zg(this._key))do s=!Jg(i)||tr(i);while(s&&(i=i.__v_raw));this._shallow=s}get value(){let t=this._object[this._key];return this._shallow&&(t=p(t)),this._value=t===void 0?this._defaultValue:t}set value(t){if(this._shallow&&Xo(this._raw[this._key])){const n=this._object[this._key];if(Xo(n)){n.value=t;return}}this._object[this._key]=t}get dep(){return $R(this._raw,this._key)}}class eO{constructor(t){this._getter=t,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function _je(e,t,n){return Xo(e)?e:un(e)?new eO(e):Zn(e)&&arguments.length>1?GS(e,t,n):Z(e)}function GS(e,t,n){return new QR(e,t,n)}class tO{constructor(t,n,o){this.fn=t,this.setter=n,this._value=void 0,this.dep=new Zg(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=ip-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=o}notify(){if(this.flags|=16,!(this.flags&8)&&ho!==this)return $S(this,!0),!0}get value(){const t=this.dep.track();return RS(this),t&&(t.version=this.dep.version),this._value}set value(t){this.setter&&this.setter(t)}}function nO(e,t,n=!1){let o,s;return un(e)?o=e:(o=e.get,s=e.set),new tO(o,s,n)}const xje={GET:"get",HAS:"has",ITERATE:"iterate"},Sje={SET:"set",ADD:"add",DELETE:"delete",CLEAR:"clear"},B0={},pm=new WeakMap;let La;function Aje(){return La}function oO(e,t=!1,n=La){if(n){let o=pm.get(n);o||pm.set(n,o=[]),o.push(e)}}function sO(e,t,n=An){const{immediate:o,deep:s,once:i,scheduler:r,augmentJob:l,call:a}=n,u=g=>s?g:tr(g)||s===!1||s===0?Gl(g,1):Gl(g);let c,d,f,h,m=!1,v=!1;if(Xo(e)?(d=()=>e.value,m=tr(e)):Wa(e)?(d=()=>u(e),m=!0):jt(e)?(v=!0,m=e.some(g=>Wa(g)||tr(g)),d=()=>e.map(g=>{if(Xo(g))return g.value;if(Wa(g))return u(g);if(un(g))return a?a(g,2):g()})):un(e)?t?d=a?()=>a(e,2):e:d=()=>{if(f){wl();try{f()}finally{_l()}}const g=La;La=c;try{return a?a(e,3,[h]):e(h)}finally{La=g}}:d=wr,t&&s){const g=d,x=s===!0?1/0:s;d=()=>Gl(g(),x)}const k=Kg(),w=()=>{c.stop(),k&&k.active&&I8(k.effects,c)};if(i&&t){const g=t;t=(...x)=>{const S=g(...x);return w(),S}}let b=v?new Array(e.length).fill(B0):B0;const _=g=>{if(!(!(c.flags&1)||!c.dirty&&!g))if(t){const x=c.run();if(g||s||m||(v?x.some((S,T)=>Es(S,b[T])):Es(x,b))){f&&f();const S=La;La=c;try{const T=[x,b===B0?void 0:v&&b[0]===B0?[]:b,h];b=x,a?a(t,3,T):t(...T)}finally{La=S}}}else c.run()};return l&&l(_),c=new dm(d),c.scheduler=r?()=>r(_,!1):_,h=g=>oO(g,!1,c),f=c.onStop=()=>{const g=pm.get(c);if(g){if(a)a(g,4);else for(const x of g)x();pm.delete(c)}},t?o?_(!0):b=c.run():r?r(_.bind(null,!0),!0):c.run(),w.pause=c.pause.bind(c),w.resume=c.resume.bind(c),w.stop=w,w}function Gl(e,t=1/0,n){if(t<=0||!Zn(e)||e.__v_skip||(n=n||new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,Xo(e))Gl(e.value,t,n);else if(jt(e))for(let o=0;o{Gl(o,t,n)});else if(Hg(e)){for(const o in e)Gl(e[o],t,n);for(const o of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,o)&&Gl(e[o],t,n)}return e}/** +* @vue/runtime-core v3.5.39 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/const YS=[];function iO(e){YS.push(e)}function rO(){YS.pop()}function Mje(e,t){}const Tje={SETUP_FUNCTION:0,0:"SETUP_FUNCTION",RENDER_FUNCTION:1,1:"RENDER_FUNCTION",NATIVE_EVENT_HANDLER:5,5:"NATIVE_EVENT_HANDLER",COMPONENT_EVENT_HANDLER:6,6:"COMPONENT_EVENT_HANDLER",VNODE_HOOK:7,7:"VNODE_HOOK",DIRECTIVE_HOOK:8,8:"DIRECTIVE_HOOK",TRANSITION_HOOK:9,9:"TRANSITION_HOOK",APP_ERROR_HANDLER:10,10:"APP_ERROR_HANDLER",APP_WARN_HANDLER:11,11:"APP_WARN_HANDLER",FUNCTION_REF:12,12:"FUNCTION_REF",ASYNC_COMPONENT_LOADER:13,13:"ASYNC_COMPONENT_LOADER",SCHEDULER:14,14:"SCHEDULER",COMPONENT_UPDATE:15,15:"COMPONENT_UPDATE",APP_UNMOUNT_CLEANUP:16,16:"APP_UNMOUNT_CLEANUP"},lO={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",0:"setup function",1:"render function",2:"watcher getter",3:"watcher callback",4:"watcher cleanup function",5:"native event handler",6:"component event handler",7:"vnode hook",8:"directive hook",9:"transition hook",10:"app errorHandler",11:"app warnHandler",12:"ref function",13:"async component loader",14:"scheduler flush",15:"component update",16:"app unmount cleanup function"};function Rp(e,t,n,o){try{return o?e(...o):e()}catch(s){f1(s,t,n)}}function xr(e,t,n,o){if(un(e)){const s=Rp(e,t,n,o);return s&&L8(s)&&s.catch(i=>{f1(i,t,n)}),s}if(jt(e)){const s=[];for(let i=0;i>>1,s=yi[o],i=lp(s);i=lp(n)?yi.push(e):yi.splice(uO(t),0,e),e.flags|=1,JS()}}function JS(){hm||(hm=XS.then(QS))}function mm(e){jt(e)?Nd.push(...e):$a&&e.id===-1?$a.splice(dd+1,0,e):e.flags&1||(Nd.push(e),e.flags|=1),JS()}function _7(e,t,n=fl+1){for(;nlp(n)-lp(o));if(Nd.length=0,$a){$a.push(...t);return}for($a=t,dd=0;dd<$a.length;dd++){const n=$a[dd];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}$a=null,dd=0}}const lp=e=>e.id==null?e.flags&2?-1:1/0:e.id;function QS(e){try{for(fl=0;flfd.emit(s,...i)),H0=[]):typeof window<"u"&&window.HTMLElement&&!((o=(n=window.navigator)==null?void 0:n.userAgent)!=null&&o.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(i=>{eA(i,t)}),setTimeout(()=>{fd||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,H0=[])},3e3)):H0=[]}let Ks=null,Qg=null;function ap(e){const t=Ks;return Ks=e,Qg=e&&e.type.__scopeId||null,t}function Eje(e){Qg=e}function Ije(){Qg=null}const Lje=e=>me;function me(e,t=Ks,n){if(!t||e._n)return e;const o=(...s)=>{o._d&&wm(-1);const i=ap(t);let r;try{r=e(...s)}finally{ap(i),o._d&&wm(1)}return r};return o._n=!0,o._c=!0,o._d=!0,o}function Bn(e,t){if(Ks===null)return e;const n=Bp(Ks),o=e.dirs||(e.dirs=[]);for(let s=0;s1)return n&&un(t)?t.call(o&&o.proxy):t}}function $je(){return!!(ds()||ic)}const cO=Symbol.for("v-scx"),dO=()=>nn(cO);function I4(e,t){return Op(e,null,t)}function Nje(e,t){return Op(e,null,{flush:"post"})}function fO(e,t){return Op(e,null,{flush:"sync"})}function Je(e,t,n){return Op(e,t,n)}function Op(e,t,n=An){const{immediate:o,deep:s,flush:i,once:r}=n,l=to({},n),a=t&&o||!t&&i!=="post";let u;if(fc){if(i==="sync"){const h=dO();u=h.__watcherHandles||(h.__watcherHandles=[])}else if(!a){const h=()=>{};return h.stop=wr,h.resume=wr,h.pause=wr,h}}const c=Vs;l.call=(h,m,v)=>xr(h,c,m,v);let d=!1;i==="post"?l.scheduler=h=>{os(h,c&&c.suspense)}:i!=="sync"&&(d=!0,l.scheduler=(h,m)=>{m?h():R8(h)}),l.augmentJob=h=>{t&&(h.flags|=4),d&&(h.flags|=2,c&&(h.id=c.uid,h.i=c))};const f=sO(e,t,l);return fc&&(u?u.push(f):a&&f()),f}function pO(e,t,n){const o=this.proxy,s=ro(e)?e.includes(".")?tA(o,e):()=>o[e]:e.bind(o,o);let i;un(t)?i=t:(i=t.handler,n=t);const r=h1(this),l=Op(s,i.bind(o),n);return r(),l}function tA(e,t){const n=t.split(".");return()=>{let o=e;for(let s=0;se.__isTeleport,Vu=e=>e&&(e.disabled||e.disabled===""),hO=e=>e&&(e.defer||e.defer===""),x7=e=>typeof SVGElement<"u"&&e instanceof SVGElement,S7=e=>typeof MathMLElement=="function"&&e instanceof MathMLElement,L4=(e,t)=>{const n=e&&e.to;return ro(n)?t?t(n):null:n},mO={name:"Teleport",__isTeleport:!0,process(e,t,n,o,s,i,r,l,a,u){const{mc:c,pc:d,pbc:f,o:{insert:h,querySelector:m,createText:v,createComment:k,parentNode:w}}=u,b=Vu(t.props);let{dynamicChildren:_}=t;const g=(T,A,E)=>{T.shapeFlag&16&&c(T.children,A,E,s,i,r,l,a)},x=(T=t)=>{const A=Vu(T.props),E=T.target=L4(T.props,m),P=$4(E,T,v,h);E&&(r!=="svg"&&x7(E)?r="svg":r!=="mathml"&&S7(E)&&(r="mathml"),s&&s.isCE&&(s.ce._teleportTargets||(s.ce._teleportTargets=new Set)).add(E),A||(g(T,E,P),pf(T,!1)))},S=T=>{const A=()=>{if(Aa.get(T)===A){if(Aa.delete(T),Vu(T.props)){const E=w(T.el)||n;g(T,E,T.anchor),pf(T,!0)}x(T)}};Aa.set(T,A),os(A,i)};if(e==null){const T=t.el=v(""),A=t.anchor=v("");if(h(T,n,o),h(A,n,o),hO(t.props)||i&&i.pendingBranch){S(t);return}b&&(g(t,n,A),pf(t,!0)),x()}else{t.el=e.el;const T=t.anchor=e.anchor,A=Aa.get(e);if(A){A.flags|=8,Aa.delete(e),S(t);return}t.targetStart=e.targetStart;const E=t.target=e.target,P=t.targetAnchor=e.targetAnchor,D=Vu(e.props),I=D?n:E,$=D?T:P;if(r==="svg"||x7(E)?r="svg":(r==="mathml"||S7(E))&&(r="mathml"),_?(f(e.dynamicChildren,_,I,s,i,r,l),V8(e,t,!0)):a||d(e,t,I,$,s,i,r,l,!1),b)D?t.props&&e.props&&t.props.to!==e.props.to&&(t.props.to=e.props.to):z0(t,n,T,u,1);else if((t.props&&t.props.to)!==(e.props&&e.props.to)){const B=L4(t.props,m);B&&(t.target=B,z0(t,B,null,u,0))}else D&&z0(t,E,P,u,1);pf(t,b)}},remove(e,t,n,{um:o,o:{remove:s}},i){const{shapeFlag:r,children:l,anchor:a,targetStart:u,targetAnchor:c,target:d,props:f}=e,h=Vu(f),m=i||!h,v=Aa.get(e);if(v&&(v.flags|=8,Aa.delete(e)),d&&(s(u),s(c)),i&&s(a),!v&&(h||d)&&r&16)for(let k=0;k{e.isMounted=!0}),Vn(()=>{e.isUnmounting=!0}),e}const fr=[Function,Array],iA={mode:String,appear:Boolean,persisted:Boolean,onBeforeEnter:fr,onEnter:fr,onAfterEnter:fr,onEnterCancelled:fr,onBeforeLeave:fr,onLeave:fr,onAfterLeave:fr,onLeaveCancelled:fr,onBeforeAppear:fr,onAppear:fr,onAfterAppear:fr,onAppearCancelled:fr},rA=e=>{const t=e.subTree;return t.component?rA(t.component):t},vO={name:"BaseTransition",props:iA,setup(e,{slots:t}){const n=ds(),o=sA();return()=>{const s=t.default&&O8(t.default(),!0),i=s&&s.length?lA(s):n.subTree?ee():void 0;if(!i)return;const r=Pn(e),{mode:l}=r;if(o.isLeaving)return Wv(i);const a=A7(i);if(!a)return Wv(i);let u=up(a,r,o,n,d=>u=d);a.type!==rs&&Za(a,u);let c=n.subTree&&A7(n.subTree);if(c&&c.type!==rs&&!Br(c,a)&&rA(n).type!==rs){let d=up(c,r,o,n);if(Za(c,d),l==="out-in"&&a.type!==rs)return o.isLeaving=!0,d.afterLeave=()=>{o.isLeaving=!1,n.job.flags&8||n.update(),delete d.afterLeave,c=void 0},Wv(i);l==="in-out"&&a.type!==rs?d.delayLeave=(f,h,m)=>{const v=aA(o,c);v[String(c.key)]=c,f[yr]=()=>{h(),f[yr]=void 0,delete u.delayedLeave,c=void 0},u.delayedLeave=()=>{m(),delete u.delayedLeave,c=void 0}}:c=void 0}else c&&(c=void 0);return i}}};function lA(e){let t=e[0];if(e.length>1){for(const n of e)if(n.type!==rs){t=n;break}}return t}const yO=vO;function aA(e,t){const{leavingVNodes:n}=e;let o=n.get(t.type);return o||(o=Object.create(null),n.set(t.type,o)),o}function up(e,t,n,o,s){const{appear:i,mode:r,persisted:l=!1,onBeforeEnter:a,onEnter:u,onAfterEnter:c,onEnterCancelled:d,onBeforeLeave:f,onLeave:h,onAfterLeave:m,onLeaveCancelled:v,onBeforeAppear:k,onAppear:w,onAfterAppear:b,onAppearCancelled:_}=t,g=String(e.key),x=aA(n,e),S=(E,P)=>{E&&xr(E,o,9,P)},T=(E,P)=>{const D=P[1];S(E,P),jt(E)?E.every(I=>I.length<=1)&&D():E.length<=1&&D()},A={mode:r,persisted:l,beforeEnter(E){let P=a;if(!n.isMounted)if(i)P=k||a;else return;E[yr]&&E[yr](!0);const D=x[g];D&&Br(e,D)&&D.el[yr]&&D.el[yr](),S(P,[E])},enter(E){if(x[g]===e)return;let P=u,D=c,I=d;if(!n.isMounted)if(i)P=w||u,D=b||c,I=_||d;else return;let $=!1;E[Y1]=H=>{$||($=!0,H?S(I,[E]):S(D,[E]),A.delayedLeave&&A.delayedLeave(),E[Y1]=void 0)};const B=E[Y1].bind(null,!1);P?T(P,[E,B]):B()},leave(E,P){const D=String(e.key);if(E[Y1]&&E[Y1](!0),n.isUnmounting)return P();S(f,[E]);let I=!1;E[yr]=B=>{I||(I=!0,P(),B?S(v,[E]):S(m,[E]),E[yr]=void 0,x[D]===e&&delete x[D])};const $=E[yr].bind(null,!1);x[D]=e,h?T(h,[E,$]):$()},clone(E){const P=up(E,t,n,o,s);return s&&s(P),P}};return A}function Wv(e){if(Pp(e))return e=ra(e),e.children=null,e}function A7(e){if(!Pp(e))return oA(e.type)&&e.children?lA(e.children):e;if(e.component)return e.component.subTree;const{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&un(n.default))return n.default()}}function Za(e,t){e.shapeFlag&6&&e.component?(e.transition=t,Za(e.component.subTree,t)):e.shapeFlag&128?(e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback)):e.transition=t}function O8(e,t=!1,n){let o=[],s=0;for(let i=0;i1)for(let i=0;in.value,set:i=>n.value=i})}return n}function M7(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}const vm=new WeakMap;function Fd(e,t,n,o,s=!1){if(jt(e)){e.forEach((v,k)=>Fd(v,t&&(jt(t)?t[k]:t),n,o,s));return}if(na(o)&&!s){o.shapeFlag&512&&o.type.__asyncResolved&&o.component.subTree.component&&Fd(e,t,n,o.component.subTree);return}const i=o.shapeFlag&4?Bp(o.component):o.el,r=s?null:i,{i:l,r:a}=e,u=t&&t.r,c=l.refs===An?l.refs={}:l.refs,d=l.setupState,f=Pn(d),h=d===An?xS:v=>M7(c,v)?!1:Kn(f,v),m=(v,k)=>!(k&&M7(c,k));if(u!=null&&u!==a){if(T7(t),ro(u))c[u]=null,h(u)&&(d[u]=null);else if(Xo(u)){const v=t;m(u,v.k)&&(u.value=null),v.k&&(c[v.k]=null)}}if(un(a)){wl();try{Rp(a,l,12,[r,c])}finally{_l()}}else{const v=ro(a),k=Xo(a);if(v||k){const w=()=>{if(e.f){const b=v?h(a)?d[a]:c[a]:m()||!e.k?a.value:c[e.k];if(s)jt(b)&&I8(b,i);else if(jt(b))b.includes(i)||b.push(i);else if(v)c[a]=[i],h(a)&&(d[a]=c[a]);else{const _=[i];m(a,e.k)&&(a.value=_),e.k&&(c[e.k]=_)}}else v?(c[a]=r,h(a)&&(d[a]=r)):k&&(m(a,e.k)&&(a.value=r),e.k&&(c[e.k]=r))};if(r){const b=()=>{w(),vm.delete(e)};b.id=-1,vm.set(e,b),os(b,n)}else T7(e),w()}}}function T7(e){const t=vm.get(e);t&&(t.flags|=8,vm.delete(e))}let E7=!1;const Qc=()=>{E7||(console.error("Hydration completed but contains mismatches."),E7=!0)},bO=e=>e.namespaceURI.includes("svg")&&e.tagName!=="foreignObject",CO=e=>e.namespaceURI.includes("MathML"),W0=e=>{if(e.nodeType===1){if(bO(e))return"svg";if(CO(e))return"mathml"}},kd=e=>e.nodeType===8;function wO(e){const{mt:t,p:n,o:{patchProp:o,createText:s,nextSibling:i,parentNode:r,remove:l,insert:a,createComment:u}}=e,c=(_,g)=>{if(!g.hasChildNodes()){n(null,_,g),gm(),g._vnode=_;return}d(g.firstChild,_,null,null,null),gm(),g._vnode=_},d=(_,g,x,S,T,A=!1)=>{A=A||!!g.dynamicChildren;const E=kd(_)&&_.data==="[",P=()=>v(_,g,x,S,T,E),{type:D,ref:I,shapeFlag:$,patchFlag:B}=g;let H=_.nodeType;g.el=_,B===-2&&(A=!1,g.dynamicChildren=null);let O=null;switch(D){case Ua:H!==3?g.children===""?(a(g.el=s(""),r(_),_),O=_):O=P():(_.data!==g.children&&(Qc(),_.data=g.children),O=i(_));break;case rs:b(_)?(O=i(_),w(g.el=_.content.firstChild,_,x)):H!==8||E?O=P():O=i(_);break;case Od:if(E&&(_=i(_),H=_.nodeType),H===1||H===3){O=_;const F=!g.children.length;for(let U=0;U{A=A||!!g.dynamicChildren;const{type:E,dynamicProps:P,props:D,patchFlag:I,shapeFlag:$,dirs:B,transition:H}=g,O=E==="input"||E==="option",F=!!P;if(O||F||I!==-1){B&&hl(g,null,x,"created");let U=!1;if(b(_)){U=TA(null,H)&&x&&x.vnode.props&&x.vnode.props.appear;const W=_.content.firstChild;if(U){const K=W.getAttribute("class");K&&(W.$cls=K),H.beforeEnter(W)}w(W,_,x),g.el=_=W}if($&16&&!(D&&(D.innerHTML||D.textContent))){let W=h(_.firstChild,g,_,x,S,T,A);for(W&&!Oh(_,1)&&Qc();W;){const K=W;W=W.nextSibling,l(K)}}else if($&8){let W=g.children;W[0]===` +`&&(_.tagName==="PRE"||_.tagName==="TEXTAREA")&&(W=W.slice(1));const{textContent:K}=_;K!==W&&K!==W.replace(/\r\n|\r/g,` +`)&&(Oh(_,0)||Qc(),_.textContent=g.children)}if(D){if(O||F||!A||I&48){const W=_.tagName.includes("-");for(const K in D)(O&&(K.endsWith("value")||K==="indeterminate")||Fp(K)&&!oc(K)||K[0]==="."||W&&!oc(K)||P&&P.includes(K))&&o(_,K,null,D[K],void 0,x)}else if(D.onClick)o(_,"onClick",null,D.onClick,void 0,x);else if(I&4&&Wa(D.style))for(const W in D.style)D.style[W]}let z;(z=D&&D.onVnodeBeforeMount)&&Fi(z,x,g),B&&hl(g,null,x,"beforeMount"),((z=D&&D.onVnodeMounted)||B||U)&&$A(()=>{z&&Fi(z,x,g),U&&H.enter(_),B&&hl(g,null,x,"mounted")},S)}return _.nextSibling},h=(_,g,x,S,T,A,E)=>{E=E||!!g.dynamicChildren;const P=g.children,D=P.length;let I=!1;for(let $=0;${const{slotScopeIds:E}=g;E&&(T=T?T.concat(E):E);const P=r(_),D=h(i(_),g,P,x,S,T,A);return D&&kd(D)&&D.data==="]"?i(g.anchor=D):(Qc(),a(g.anchor=u("]"),P,D),D)},v=(_,g,x,S,T,A)=>{if(xO(_,g)||Qc(),g.el=null,A){const D=k(_);for(;;){const I=i(_);if(I&&I!==D)l(I);else break}}const E=i(_),P=r(_);return l(_),n(null,g,P,E,x,S,W0(P),T),x&&(x.vnode.el=g.el,n2(x,g.el)),E},k=(_,g="[",x="]")=>{let S=0;for(;_;)if(_=i(_),_&&kd(_)&&(_.data===g&&S++,_.data===x)){if(S===0)return i(_);S--}return _},w=(_,g,x)=>{const S=g.parentNode;S&&S.replaceChild(_,g);let T=x;for(;T;)T.vnode.el===g&&(T.vnode.el=T.subTree.el=_),T=T.parent},b=_=>_.nodeType===1&&_.tagName==="TEMPLATE";return[c,d]}const ym="data-allow-mismatch",_O={0:"text",1:"children",2:"class",3:"style",4:"attribute"};function Oh(e,t){if(t===0||t===1)for(;e&&!e.hasAttribute(ym);)e=e.parentElement;return D8(e&&e.getAttribute(ym),t)}function D8(e,t){if(e==null)return!1;if(e==="")return!0;{const n=e.split(",");return t===0&&n.includes("children")?!0:n.includes(_O[t])}}function xO(e,t){return Oh(e.parentElement,1)||SO(e)||AO(t)}function SO(e){return e.nodeType===1&&D8(e.getAttribute(ym),1)}function AO({props:e}){const t=e&&e[ym];return typeof t=="string"&&D8(t,1)}const MO=Vg().requestIdleCallback||(e=>setTimeout(e,1)),TO=Vg().cancelIdleCallback||(e=>clearTimeout(e)),Rje=(e=1e4)=>t=>{const n=MO(t,{timeout:e});return()=>TO(n)};function EO(e){const{top:t,left:n,bottom:o,right:s}=e.getBoundingClientRect(),{innerHeight:i,innerWidth:r}=window;return(t>0&&t0&&o0&&n0&&s(t,n)=>{const o=new IntersectionObserver(s=>{for(const i of s)if(i.isIntersecting){o.disconnect(),t();break}},e);return n(s=>{if(s instanceof Element){if(EO(s))return t(),o.disconnect(),!1;o.observe(s)}}),()=>o.disconnect()},Pje=e=>t=>{if(e){const n=matchMedia(e);if(n.matches)t();else return n.addEventListener("change",t,{once:!0}),()=>n.removeEventListener("change",t)}},Dje=(e=[])=>(t,n)=>{ro(e)&&(e=[e]);let o=!1;const s=r=>{o||(o=!0,i(),t(),r.target.dispatchEvent(new r.constructor(r.type,r)))},i=()=>{n(r=>{for(const l of e)r.removeEventListener(l,s)})};return n(r=>{for(const l of e)r.addEventListener(l,s,{once:!0})}),i};function IO(e,t){if(kd(e)&&e.data==="["){let n=1,o=e.nextSibling;for(;o;){if(o.nodeType===1){if(t(o)===!1)break}else if(kd(o))if(o.data==="]"){if(--n===0)break}else o.data==="["&&n++;o=o.nextSibling}}else t(e)}const na=e=>!!e.type.__asyncLoader;function zr(e){un(e)&&(e={loader:e});const{loader:t,loadingComponent:n,errorComponent:o,delay:s=200,hydrate:i,timeout:r,suspensible:l=!0,onError:a}=e;let u=null,c,d=0;const f=()=>(d++,u=null,h()),h=()=>{let m;return u||(m=u=t().catch(v=>{if(v=v instanceof Error?v:new Error(String(v)),a)return new Promise((k,w)=>{a(v,()=>k(f()),()=>w(v),d+1)});throw v}).then(v=>m!==u&&u?u:(v&&(v.__esModule||v[Symbol.toStringTag]==="Module")&&(v=v.default),c=v,v)))};return et({name:"AsyncComponentWrapper",__asyncLoader:h,__asyncHydrate(m,v,k){let w=!1;(v.bu||(v.bu=[])).push(()=>w=!0);const b=()=>{w||k()},_=i?()=>{const g=i(b,x=>IO(m,x));g&&(v.bum||(v.bum=[])).push(g)}:b;c?_():h().then(()=>!v.isUnmounted&&_())},get __asyncResolved(){return c},setup(){const m=Vs;if(P8(m),c)return()=>U0(c,m);const v=x=>{u=null,f1(x,m,13,!o)};if(l&&m.suspense||fc)return h().then(x=>()=>U0(x,m)).catch(x=>(v(x),()=>o?j(o,{error:x}):null));const k=Z(!1),w=Z(),b=Z(!!s);let _,g;return bn(()=>{_!=null&&clearTimeout(_),g!=null&&clearTimeout(g)}),s&&(g=setTimeout(()=>{m.isUnmounted||(b.value=!1)},s)),r!=null&&(_=setTimeout(()=>{if(!m.isUnmounted&&!k.value&&!w.value){const x=new Error(`Async component timed out after ${r}ms.`);v(x),w.value=x}},r)),h().then(()=>{m.isUnmounted||(k.value=!0,m.parent&&Pp(m.parent.vnode)&&m.parent.update())}).catch(x=>{if(m.isUnmounted){u=null;return}v(x),w.value=x}),()=>{if(k.value&&c)return U0(c,m);if(w.value&&o)return j(o,{error:w.value});if(n&&!b.value)return U0(n,m)}}})}function U0(e,t){const{ref:n,props:o,children:s,ce:i}=t.vnode,r=j(e,o,s);return r.ref=n,r.ce=i,delete t.vnode.ce,r}const Pp=e=>e.type.__isKeepAlive,LO={name:"KeepAlive",__isKeepAlive:!0,props:{include:[String,RegExp,Array],exclude:[String,RegExp,Array],max:[String,Number]},setup(e,{slots:t}){const n=ds(),o=n.ctx;if(!o.renderer)return()=>{const b=t.default&&t.default();return b&&b.length===1?b[0]:b};const s=new Map,i=new Set;let r=null;const l=n.suspense,{renderer:{p:a,m:u,um:c,o:{createElement:d}}}=o,f=d("div");o.activate=(b,_,g,x,S)=>{const T=b.component;u(b,_,g,0,l),a(T.vnode,b,_,g,T,l,x,b.slotScopeIds,S),os(()=>{T.isDeactivated=!1,T.a&&$d(T.a);const A=b.props&&b.props.onVnodeMounted;A&&Fi(A,T.parent,b)},l)},o.deactivate=b=>{const _=b.component;bm(_.m),bm(_.a),u(b,f,null,1,l),os(()=>{_.da&&$d(_.da);const g=b.props&&b.props.onVnodeUnmounted;g&&Fi(g,_.parent,b),_.isDeactivated=!0},l)};function h(b){Uv(b),c(b,n,l,!0)}function m(b){s.forEach((_,g)=>{const x=z4(na(_)?_.type.__asyncResolved||{}:_.type);x&&!b(x)&&v(g)})}function v(b){const _=s.get(b);_&&(!r||!Br(_,r))?h(_):r&&Uv(r),s.delete(b),i.delete(b)}Je(()=>[e.include,e.exclude],([b,_])=>{b&&m(g=>hf(b,g)),_&&m(g=>!hf(_,g))},{flush:"post",deep:!0});let k=null;const w=()=>{k!=null&&(Cm(n.subTree.type)?os(()=>{s.set(k,j0(n.subTree))},n.subTree.suspense):s.set(k,j0(n.subTree)))};return dn(w),Dp(w),Vn(()=>{s.forEach(b=>{const{subTree:_,suspense:g}=n,x=j0(_);if(b.type===x.type&&b.key===x.key){Uv(x);const S=x.component.da;S&&os(S,g);return}h(b)})}),()=>{if(k=null,!t.default)return r=null;const b=t.default(),_=b[0];if(b.length>1)return r=null,b;if(!Ga(_)||!(_.shapeFlag&4)&&!(_.shapeFlag&128))return r=null,_;let g=j0(_);if(g.type===rs)return r=null,g;const x=g.type,S=z4(na(g)?g.type.__asyncResolved||{}:x),{include:T,exclude:A,max:E}=e;if(T&&(!S||!hf(T,S))||A&&S&&hf(A,S))return g.shapeFlag&=-257,r=g,_;const P=g.key==null?x:g.key,D=s.get(P);return g.el&&(g=ra(g),_.shapeFlag&128&&(_.ssContent=g)),k=P,D?(g.el=D.el,g.component=D.component,g.transition&&Za(g,g.transition),g.shapeFlag|=512,i.delete(P),i.add(P)):(i.add(P),E&&i.size>parseInt(E,10)&&v(i.values().next().value)),g.shapeFlag|=256,r=g,Cm(_.type)?_:g}}},Bje=LO;function hf(e,t){return jt(e)?e.some(n=>hf(n,t)):ro(e)?e.split(",").includes(t):hR(e)?(e.lastIndex=0,e.test(t)):!1}function $O(e,t){uA(e,"a",t)}function NO(e,t){uA(e,"da",t)}function uA(e,t,n=Vs){const o=e.__wdc||(e.__wdc=()=>{let s=n;for(;s;){if(s.isDeactivated)return;s=s.parent}return e()});if(e2(t,o,n),n){let s=n.parent;for(;s&&s.parent;)Pp(s.parent.vnode)&&FO(o,t,n,s),s=s.parent}}function FO(e,t,n,o){const s=e2(t,e,o,!0);bn(()=>{I8(o[t],s)},n)}function Uv(e){e.shapeFlag&=-257,e.shapeFlag&=-513}function j0(e){return e.shapeFlag&128?e.ssContent:e}function e2(e,t,n=Vs,o=!1){if(n){const s=n[e]||(n[e]=[]),i=t.__weh||(t.__weh=(...r)=>{wl();const l=h1(n),a=xr(t,n,e,r);return l(),_l(),a});return o?s.unshift(i):s.push(i),i}}const aa=e=>(t,n=Vs)=>{(!fc||e==="sp")&&e2(e,(...o)=>t(...o),n)},RO=aa("bm"),dn=aa("m"),cA=aa("bu"),Dp=aa("u"),Vn=aa("bum"),bn=aa("um"),OO=aa("sp"),PO=aa("rtg"),DO=aa("rtc");function BO(e,t=Vs){e2("ec",e,t)}const B8="components",HO="directives";function zO(e,t){return H8(B8,e,!0,t)||e}const dA=Symbol.for("v-ndc");function bs(e){return ro(e)?H8(B8,e,!1)||e:e||dA}function Hje(e){return H8(HO,e)}function H8(e,t,n=!0,o=!1){const s=Ks||Vs;if(s){const i=s.type;if(e===B8){const l=z4(i,!1);if(l&&(l===t||l===_s(t)||l===Ug(_s(t))))return i}const r=I7(s[e]||i[e],t)||I7(s.appContext[e],t);return!r&&o?i:r}}function I7(e,t){return e&&(e[t]||e[_s(t)]||e[Ug(_s(t))])}function pt(e,t,n,o){let s;const i=n&&n[o],r=jt(e);if(r||ro(e)){const l=r&&Wa(e);let a=!1,u=!1;l&&(a=!tr(e),u=ia(e),e=Gg(e)),s=new Array(e.length);for(let c=0,d=e.length;ct(l,a,void 0,i&&i[a]));else{const l=Object.keys(e);s=new Array(l.length);for(let a=0,u=l.length;a{const i=o.fn(...s);return i&&(i.key=o.key),i}:o.fn)}return e}function xn(e,t,n={},o,s){if(Ks.ce||Ks.parent&&na(Ks.parent)&&Ks.parent.ce){const u=Object.keys(n).length>0;return t!=="default"&&(n.name=t),y(),he(Pe,null,[j("slot",n,o&&o())],u?-2:64)}let i=e[t];i&&i._c&&(i._d=!1),y();const r=i&&z8(i(n)),l=n.key||r&&r.key,a=he(Pe,{key:(l&&!lr(l)?l:`_${t}`)+(!r&&o?"_fb":"")},r||(o?o():[]),r&&e._===1?64:-2);return!s&&a.scopeId&&(a.slotScopeIds=[a.scopeId+"-s"]),i&&i._c&&(i._d=!0),a}function z8(e){return e.some(t=>Ga(t)?!(t.type===rs||t.type===Pe&&!z8(t.children)):!0)?e:null}function zje(e,t){const n={};for(const o in e)n[t&&/[A-Z]/.test(o)?`on:${o}`:Fh(o)]=e[o];return n}const N4=e=>e?DA(e)?Bp(e):N4(e.parent):null,Ff=to(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>N4(e.parent),$root:e=>N4(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>W8(e),$forceUpdate:e=>e.f||(e.f=()=>{R8(e.update)}),$nextTick:e=>e.n||(e.n=yt.bind(e.proxy)),$watch:e=>pO.bind(e)}),jv=(e,t)=>e!==An&&!e.__isScriptSetup&&Kn(e,t),F4={get({_:e},t){if(t==="__v_skip")return!0;const{ctx:n,setupState:o,data:s,props:i,accessCache:r,type:l,appContext:a}=e;if(t[0]!=="$"){const f=r[t];if(f!==void 0)switch(f){case 1:return o[t];case 2:return s[t];case 4:return n[t];case 3:return i[t]}else{if(jv(o,t))return r[t]=1,o[t];if(s!==An&&Kn(s,t))return r[t]=2,s[t];if(Kn(i,t))return r[t]=3,i[t];if(n!==An&&Kn(n,t))return r[t]=4,n[t];R4&&(r[t]=0)}}const u=Ff[t];let c,d;if(u)return t==="$attrs"&&ii(e.attrs,"get",""),u(e);if((c=l.__cssModules)&&(c=c[t]))return c;if(n!==An&&Kn(n,t))return r[t]=4,n[t];if(d=a.config.globalProperties,Kn(d,t))return d[t]},set({_:e},t,n){const{data:o,setupState:s,ctx:i}=e;return jv(s,t)?(s[t]=n,!0):o!==An&&Kn(o,t)?(o[t]=n,!0):Kn(e.props,t)||t[0]==="$"&&t.slice(1)in e?!1:(i[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:o,appContext:s,props:i,type:r}},l){let a;return!!(n[l]||e!==An&&l[0]!=="$"&&Kn(e,l)||jv(t,l)||Kn(i,l)||Kn(o,l)||Kn(Ff,l)||Kn(s.config.globalProperties,l)||(a=r.__cssModules)&&a[l])},defineProperty(e,t,n){return n.get!=null?e._.accessCache[t]=0:Kn(n,"value")&&this.set(e,t,n.value,null),Reflect.defineProperty(e,t,n)}},WO=to({},F4,{get(e,t){if(t!==Symbol.unscopables)return F4.get(e,t,e)},has(e,t){return t[0]!=="_"&&!kR(t)}});function Wje(){return null}function Uje(){return null}function jje(e){}function Vje(e){}function qje(){return null}function Kje(){}function Zje(e,t){return null}function Gje(){return pA().slots}function p1(){return pA().attrs}function pA(e){const t=ds();return t.setupContext||(t.setupContext=zA(t))}function cp(e){return jt(e)?e.reduce((t,n)=>(t[n]=null,t),{}):e}function Yje(e,t){const n=cp(e);for(const o in t){if(o.startsWith("__skip"))continue;let s=n[o];s?jt(s)||un(s)?s=n[o]={type:s,default:t[o]}:s.default=t[o]:s===null&&(s=n[o]={default:t[o]}),s&&t[`__skip_${o}`]&&(s.skipFactory=!0)}return n}function Xje(e,t){return!e||!t?e||t:jt(e)&&jt(t)?e.concat(t):to({},cp(e),cp(t))}function Jje(e,t){const n={};for(const o in e)t.includes(o)||Object.defineProperty(n,o,{enumerable:!0,get:()=>e[o]});return n}function Qje(e){const t=ds(),n=fc;let o=e();fp(),n&&Pd(!1);const s=()=>{h1(t),n&&Pd(!0)},i=()=>{ds()!==t&&t.scope.off(),fp(),n&&Pd(!1)};return L8(o)&&(o=o.catch(r=>{throw s(),Promise.resolve().then(()=>Promise.resolve().then(i)),r})),[o,()=>{s(),Promise.resolve().then(i)}]}let R4=!0;function UO(e){const t=W8(e),n=e.proxy,o=e.ctx;R4=!1,t.beforeCreate&&L7(t.beforeCreate,e,"bc");const{data:s,computed:i,methods:r,watch:l,provide:a,inject:u,created:c,beforeMount:d,mounted:f,beforeUpdate:h,updated:m,activated:v,deactivated:k,beforeDestroy:w,beforeUnmount:b,destroyed:_,unmounted:g,render:x,renderTracked:S,renderTriggered:T,errorCaptured:A,serverPrefetch:E,expose:P,inheritAttrs:D,components:I,directives:$,filters:B}=t;if(u&&jO(u,o,null),r)for(const F in r){const U=r[F];un(U)&&(o[F]=U.bind(n))}if(s){const F=s.call(n,n);Zn(F)&&(e.data=Go(F))}if(R4=!0,i)for(const F in i){const U=i[F],z=un(U)?U.bind(n,n):un(U.get)?U.get.bind(n,n):wr,W=!un(U)&&un(U.set)?U.set.bind(n):wr,K=R({get:z,set:W});Object.defineProperty(o,F,{enumerable:!0,configurable:!0,get:()=>K.value,set:V=>K.value=V})}if(l)for(const F in l)hA(l[F],o,n,F);if(a){const F=un(a)?a.call(n):a;Reflect.ownKeys(F).forEach(U=>{Ln(U,F[U])})}c&&L7(c,e,"c");function O(F,U){jt(U)?U.forEach(z=>F(z.bind(n))):U&&F(U.bind(n))}if(O(RO,d),O(dn,f),O(cA,h),O(Dp,m),O($O,v),O(NO,k),O(BO,A),O(DO,S),O(PO,T),O(Vn,b),O(bn,g),O(OO,E),jt(P))if(P.length){const F=e.exposed||(e.exposed={});P.forEach(U=>{Object.defineProperty(F,U,{get:()=>n[U],set:z=>n[U]=z,enumerable:!0})})}else e.exposed||(e.exposed={});x&&e.render===wr&&(e.render=x),D!=null&&(e.inheritAttrs=D),I&&(e.components=I),$&&(e.directives=$),E&&P8(e)}function jO(e,t,n=wr){jt(e)&&(e=O4(e));for(const o in e){const s=e[o];let i;Zn(s)?"default"in s?i=nn(s.from||o,s.default,!0):i=nn(s.from||o):i=nn(s),Xo(i)?Object.defineProperty(t,o,{enumerable:!0,configurable:!0,get:()=>i.value,set:r=>i.value=r}):t[o]=i}}function L7(e,t,n){xr(jt(e)?e.map(o=>o.bind(t.proxy)):e.bind(t.proxy),t,n)}function hA(e,t,n,o){let s=o.includes(".")?tA(n,o):()=>n[o];if(ro(e)){const i=t[e];un(i)&&Je(s,i)}else if(un(e))Je(s,e.bind(n));else if(Zn(e))if(jt(e))e.forEach(i=>hA(i,t,n,o));else{const i=un(e.handler)?e.handler.bind(n):t[e.handler];un(i)&&Je(s,i,e)}}function W8(e){const t=e.type,{mixins:n,extends:o}=t,{mixins:s,optionsCache:i,config:{optionMergeStrategies:r}}=e.appContext,l=i.get(t);let a;return l?a=l:!s.length&&!n&&!o?a=t:(a={},s.length&&s.forEach(u=>km(a,u,r,!0)),km(a,t,r)),Zn(t)&&i.set(t,a),a}function km(e,t,n,o=!1){const{mixins:s,extends:i}=t;i&&km(e,i,n,!0),s&&s.forEach(r=>km(e,r,n,!0));for(const r in t)if(!(o&&r==="expose")){const l=VO[r]||n&&n[r];e[r]=l?l(e[r],t[r]):t[r]}return e}const VO={data:$7,props:N7,emits:N7,methods:mf,computed:mf,beforeCreate:mi,created:mi,beforeMount:mi,mounted:mi,beforeUpdate:mi,updated:mi,beforeDestroy:mi,beforeUnmount:mi,destroyed:mi,unmounted:mi,activated:mi,deactivated:mi,errorCaptured:mi,serverPrefetch:mi,components:mf,directives:mf,watch:KO,provide:$7,inject:qO};function $7(e,t){return t?e?function(){return to(un(e)?e.call(this,this):e,un(t)?t.call(this,this):t)}:t:e}function qO(e,t){return mf(O4(e),O4(t))}function O4(e){if(jt(e)){const t={};for(let n=0;n{let c,d=An,f;return fO(()=>{const h=e[s];Es(c,h)&&(c=h,u())}),{get(){return a(),n.get?n.get(c):c},set(h){const m=n.set?n.set(h):h;if(!Es(m,c)&&!(d!==An&&Es(h,d)))return;const v=o.vnode.props,k=!!(v&&(t in v||s in v||i in v)&&(`onUpdate:${t}`in v||`onUpdate:${s}`in v||`onUpdate:${i}`in v));k||(c=h,u()),o.emit(`update:${t}`,m),Es(h,d)&&(Es(h,m)&&!Es(m,f)||k&&d!==An&&!Es(m,c))&&u(),d=h,f=m}}});return l[Symbol.iterator]=()=>{let a=0;return{next(){return a<2?{value:a++?r||An:l,done:!1}:{done:!0}}}},l}const gA=(e,t)=>t==="modelValue"||t==="model-value"?e.modelModifiers:e[`${t}Modifiers`]||e[`${_s(t)}Modifiers`]||e[`${Bi(t)}Modifiers`];function YO(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||An;let s=n;const i=t.startsWith("update:"),r=i&&gA(o,t.slice(7));r&&(r.trim&&(s=n.map(c=>ro(c)?c.trim():c)),r.number&&(s=n.map(jg)));let l,a=o[l=Fh(t)]||o[l=Fh(_s(t))];!a&&i&&(a=o[l=Fh(Bi(t))]),a&&xr(a,e,6,s);const u=o[l+"Once"];if(u){if(!e.emitted)e.emitted={};else if(e.emitted[l])return;e.emitted[l]=!0,xr(u,e,6,s)}}const XO=new WeakMap;function vA(e,t,n=!1){const o=n?XO:t.emitsCache,s=o.get(e);if(s!==void 0)return s;const i=e.emits;let r={},l=!1;if(!un(e)){const a=u=>{const c=vA(u,t,!0);c&&(l=!0,to(r,c))};!n&&t.mixins.length&&t.mixins.forEach(a),e.extends&&a(e.extends),e.mixins&&e.mixins.forEach(a)}return!i&&!l?(Zn(e)&&o.set(e,null),null):(jt(i)?i.forEach(a=>r[a]=null):to(r,i),Zn(e)&&o.set(e,r),r)}function t2(e,t){return!e||!Fp(t)?!1:(t=t.slice(2),t=t==="Once"?t:t.replace(/Once$/,""),Kn(e,t[0].toLowerCase()+t.slice(1))||Kn(e,Bi(t))||Kn(e,t))}function Ph(e){const{type:t,vnode:n,proxy:o,withProxy:s,propsOptions:[i],slots:r,attrs:l,emit:a,render:u,renderCache:c,props:d,data:f,setupState:h,ctx:m,inheritAttrs:v}=e,k=ap(e);let w,b;try{if(n.shapeFlag&4){const g=s||o,x=g;w=Di(u.call(x,g,c,d,h,f,m)),b=l}else{const g=t;w=Di(g.length>1?g(d,{attrs:l,slots:r,emit:a}):g(d,null)),b=t.props?l:QO(l)}}catch(g){Rf.length=0,f1(g,e,1),w=j(rs)}let _=w;if(b&&v!==!1){const g=Object.keys(b),{shapeFlag:x}=_;g.length&&x&7&&(i&&g.some(Bg)&&(b=eP(b,i)),_=ra(_,b,!1,!0))}return n.dirs&&(_=ra(_,null,!1,!0),_.dirs=_.dirs?_.dirs.concat(n.dirs):n.dirs),n.transition&&Za(_,n.transition),w=_,ap(k),w}function JO(e,t=!0){let n;for(let o=0;o{let t;for(const n in e)(n==="class"||n==="style"||Fp(n))&&((t||(t={}))[n]=e[n]);return t},eP=(e,t)=>{const n={};for(const o in e)(!Bg(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n};function tP(e,t,n){const{props:o,children:s,component:i}=e,{props:r,children:l,patchFlag:a}=t,u=i.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&a>=0){if(a&1024)return!0;if(a&16)return o?F7(o,r,u):!!r;if(a&8){const c=t.dynamicProps;for(let d=0;dObject.create(kA),CA=e=>Object.getPrototypeOf(e)===kA;function nP(e,t,n,o=!1){const s={},i=bA();e.propsDefaults=Object.create(null),wA(e,t,s,i);for(const r in e.propsOptions[0])r in s||(s[r]=void 0);n?e.props=o?s:qS(s):e.type.props?e.props=s:e.props=i,e.attrs=i}function oP(e,t,n,o){const{props:s,attrs:i,vnode:{patchFlag:r}}=e,l=Pn(s),[a]=e.propsOptions;let u=!1;if((o||r>0)&&!(r&16)){if(r&8){const c=e.vnode.dynamicProps;for(let d=0;d{a=!0;const[f,h]=_A(d,t,!0);to(r,f),h&&l.push(...h)};!n&&t.mixins.length&&t.mixins.forEach(c),e.extends&&c(e.extends),e.mixins&&e.mixins.forEach(c)}if(!i&&!a)return Zn(e)&&o.set(e,Id),Id;if(jt(i))for(let c=0;ce==="_"||e==="_ctx"||e==="$stable",j8=e=>jt(e)?e.map(Di):[Di(e)],iP=(e,t,n)=>{if(t._n)return t;const o=me((...s)=>j8(t(...s)),n);return o._c=!1,o},xA=(e,t,n)=>{const o=e._ctx;for(const s in e){if(U8(s))continue;const i=e[s];if(un(i))t[s]=iP(s,i,o);else if(i!=null){const r=j8(i);t[s]=()=>r}}},SA=(e,t)=>{const n=j8(t);e.slots.default=()=>n},AA=(e,t,n)=>{for(const o in t)(n||!U8(o))&&(e[o]=t[o])},rP=(e,t,n)=>{const o=e.slots=bA();if(e.vnode.shapeFlag&32){const s=t._;s?(AA(o,t,n),n&&AS(o,"_",s,!0)):xA(t,o)}else t&&SA(e,t)},lP=(e,t,n)=>{const{vnode:o,slots:s}=e;let i=!0,r=An;if(o.shapeFlag&32){const l=t._;l?n&&l===1?i=!1:AA(s,t,n):(i=!t.$stable,xA(t,s)),r=t}else t&&(SA(e,t),r={default:1});if(i)for(const l in s)!U8(l)&&r[l]==null&&delete s[l]},os=$A;function aP(e){return MA(e)}function uP(e){return MA(e,wO)}function MA(e,t){const n=Vg();n.__VUE__=!0;const{insert:o,remove:s,patchProp:i,createElement:r,createText:l,createComment:a,setText:u,setElementText:c,parentNode:d,nextSibling:f,setScopeId:h=wr,insertStaticContent:m}=e,v=(G,Y,fe,we=null,ge=null,Q=null,te=void 0,ce=null,ue=!!Y.dynamicChildren)=>{if(G===Y)return;G&&!Br(G,Y)&&(we=Ie(G),V(G,ge,Q,!0),G=null),Y.patchFlag===-2&&(ue=!1,Y.dynamicChildren=null);const{type:Se,ref:ze,shapeFlag:_e}=Y;switch(Se){case Ua:k(G,Y,fe,we);break;case rs:w(G,Y,fe,we);break;case Od:G==null&&b(Y,fe,we,te);break;case Pe:I(G,Y,fe,we,ge,Q,te,ce,ue);break;default:_e&1?x(G,Y,fe,we,ge,Q,te,ce,ue):_e&6?$(G,Y,fe,we,ge,Q,te,ce,ue):(_e&64||_e&128)&&Se.process(G,Y,fe,we,ge,Q,te,ce,ue,ve)}ze!=null&&ge?Fd(ze,G&&G.ref,Q,Y||G,!Y):ze==null&&G&&G.ref!=null&&Fd(G.ref,null,Q,G,!0)},k=(G,Y,fe,we)=>{if(G==null)o(Y.el=l(Y.children),fe,we);else{const ge=Y.el=G.el;Y.children!==G.children&&u(ge,Y.children)}},w=(G,Y,fe,we)=>{G==null?o(Y.el=a(Y.children||""),fe,we):Y.el=G.el},b=(G,Y,fe,we)=>{[G.el,G.anchor]=m(G.children,Y,fe,we,G.el,G.anchor)},_=({el:G,anchor:Y},fe,we)=>{let ge;for(;G&&G!==Y;)ge=f(G),o(G,fe,we),G=ge;o(Y,fe,we)},g=({el:G,anchor:Y})=>{let fe;for(;G&&G!==Y;)fe=f(G),s(G),G=fe;s(Y)},x=(G,Y,fe,we,ge,Q,te,ce,ue)=>{if(Y.type==="svg"?te="svg":Y.type==="math"&&(te="mathml"),G==null)S(Y,fe,we,ge,Q,te,ce,ue);else{const Se=G.el&&G.el._isVueCE?G.el:null;try{Se&&Se._beginPatch(),E(G,Y,ge,Q,te,ce,ue)}finally{Se&&Se._endPatch()}}},S=(G,Y,fe,we,ge,Q,te,ce)=>{let ue,Se;const{props:ze,shapeFlag:_e,transition:Ee,dirs:it}=G;if(ue=G.el=r(G.type,Q,ze&&ze.is,ze),_e&8?c(ue,G.children):_e&16&&A(G.children,ue,null,we,ge,Vv(G,Q),te,ce),it&&hl(G,null,we,"created"),T(ue,G,G.scopeId,te,we),ze){for(const Oe in ze)Oe!=="value"&&!oc(Oe)&&i(ue,Oe,null,ze[Oe],Q,we);"value"in ze&&i(ue,"value",null,ze.value,Q),(Se=ze.onVnodeBeforeMount)&&Fi(Se,we,G)}it&&hl(G,null,we,"beforeMount");const Fe=TA(ge,Ee);Fe&&Ee.beforeEnter(ue),o(ue,Y,fe),((Se=ze&&ze.onVnodeMounted)||Fe||it)&&os(()=>{try{Se&&Fi(Se,we,G),Fe&&Ee.enter(ue),it&&hl(G,null,we,"mounted")}finally{}},ge)},T=(G,Y,fe,we,ge)=>{if(fe&&h(G,fe),we)for(let Q=0;Q{for(let Se=ue;Se{const ce=Y.el=G.el;let{patchFlag:ue,dynamicChildren:Se,dirs:ze}=Y;ue|=G.patchFlag&16;const _e=G.props||An,Ee=Y.props||An;let it;if(fe&&Iu(fe,!1),(it=Ee.onVnodeBeforeUpdate)&&Fi(it,fe,Y,G),ze&&hl(Y,G,fe,"beforeUpdate"),fe&&Iu(fe,!0),Se&&(!G.dynamicChildren||G.dynamicChildren.length!==Se.length)&&(ue=0,te=!1,Se=null),(_e.innerHTML&&Ee.innerHTML==null||_e.textContent&&Ee.textContent==null)&&c(ce,""),Se?P(G.dynamicChildren,Se,ce,fe,we,Vv(Y,ge),Q):te||U(G,Y,ce,null,fe,we,Vv(Y,ge),Q,!1),ue>0){if(ue&16)D(ce,_e,Ee,fe,ge);else if(ue&2&&_e.class!==Ee.class&&i(ce,"class",null,Ee.class,ge),ue&4&&i(ce,"style",_e.style,Ee.style,ge),ue&8){const Fe=Y.dynamicProps;for(let Oe=0;Oe{it&&Fi(it,fe,Y,G),ze&&hl(Y,G,fe,"updated")},we)},P=(G,Y,fe,we,ge,Q,te)=>{for(let ce=0;ce{if(Y!==fe){if(Y!==An)for(const Q in Y)!oc(Q)&&!(Q in fe)&&i(G,Q,Y[Q],null,ge,we);for(const Q in fe){if(oc(Q))continue;const te=fe[Q],ce=Y[Q];te!==ce&&Q!=="value"&&i(G,Q,ce,te,ge,we)}"value"in fe&&i(G,"value",Y.value,fe.value,ge)}},I=(G,Y,fe,we,ge,Q,te,ce,ue)=>{const Se=Y.el=G?G.el:l(""),ze=Y.anchor=G?G.anchor:l("");let{patchFlag:_e,dynamicChildren:Ee,slotScopeIds:it}=Y;it&&(ce=ce?ce.concat(it):it),G==null?(o(Se,fe,we),o(ze,fe,we),A(Y.children||[],fe,ze,ge,Q,te,ce,ue)):_e>0&&_e&64&&Ee&&G.dynamicChildren&&G.dynamicChildren.length===Ee.length?(P(G.dynamicChildren,Ee,fe,ge,Q,te,ce),(Y.key!=null||ge&&Y===ge.subTree)&&V8(G,Y,!0)):U(G,Y,fe,ze,ge,Q,te,ce,ue)},$=(G,Y,fe,we,ge,Q,te,ce,ue)=>{Y.slotScopeIds=ce,G==null?Y.shapeFlag&512?ge.ctx.activate(Y,fe,we,te,ue):B(Y,fe,we,ge,Q,te,ue):H(G,Y,ue)},B=(G,Y,fe,we,ge,Q,te)=>{const ce=G.component=PA(G,we,ge);if(Pp(G)&&(ce.ctx.renderer=ve),BA(ce,!1,te),ce.asyncDep){if(ge&&ge.registerDep(ce,O,te),!G.el){const ue=ce.subTree=j(rs);w(null,ue,Y,fe),G.placeholder=ue.el}}else O(ce,G,Y,fe,ge,Q,te)},H=(G,Y,fe)=>{const we=Y.component=G.component;if(tP(G,Y,fe))if(we.asyncDep&&!we.asyncResolved){F(we,Y,fe);return}else we.next=Y,we.update();else Y.el=G.el,we.vnode=Y},O=(G,Y,fe,we,ge,Q,te)=>{const ce=()=>{if(G.isMounted){let{next:_e,bu:Ee,u:it,parent:Fe,vnode:Oe}=G;{const Yt=EA(G);if(Yt){_e&&(_e.el=Oe.el,F(G,_e,te)),Yt.asyncDep.then(()=>{os(()=>{G.isUnmounted||Se()},ge)});return}}let Ge=_e,at;Iu(G,!1),_e?(_e.el=Oe.el,F(G,_e,te)):_e=Oe,Ee&&$d(Ee),(at=_e.props&&_e.props.onVnodeBeforeUpdate)&&Fi(at,Fe,_e,Oe),Iu(G,!0);const Tt=Ph(G),Bt=G.subTree;G.subTree=Tt,v(Bt,Tt,d(Bt.el),Ie(Bt),G,ge,Q),_e.el=Tt.el,Ge===null&&n2(G,Tt.el),it&&os(it,ge),(at=_e.props&&_e.props.onVnodeUpdated)&&os(()=>Fi(at,Fe,_e,Oe),ge)}else{let _e;const{el:Ee,props:it}=Y,{bm:Fe,m:Oe,parent:Ge,root:at,type:Tt}=G,Bt=na(Y);if(Iu(G,!1),Fe&&$d(Fe),!Bt&&(_e=it&&it.onVnodeBeforeMount)&&Fi(_e,Ge,Y),Iu(G,!0),Ee&&ye){const Yt=()=>{G.subTree=Ph(G),ye(Ee,G.subTree,G,ge,null)};Bt&&Tt.__asyncHydrate?Tt.__asyncHydrate(Ee,G,Yt):Yt()}else{at.ce&&at.ce._hasShadowRoot()&&at.ce._injectChildStyle(Tt,G.parent?G.parent.type:void 0);const Yt=G.subTree=Ph(G);v(null,Yt,fe,we,G,ge,Q),Y.el=Yt.el}if(Oe&&os(Oe,ge),!Bt&&(_e=it&&it.onVnodeMounted)){const Yt=Y;os(()=>Fi(_e,Ge,Yt),ge)}(Y.shapeFlag&256||Ge&&na(Ge.vnode)&&Ge.vnode.shapeFlag&256)&&G.a&&os(G.a,ge),G.isMounted=!0,Y=fe=we=null}};G.scope.on();const ue=G.effect=new dm(ce);G.scope.off();const Se=G.update=ue.run.bind(ue),ze=G.job=ue.runIfDirty.bind(ue);ze.i=G,ze.id=G.uid,ue.scheduler=()=>R8(ze),Iu(G,!0),Se()},F=(G,Y,fe)=>{Y.component=G;const we=G.vnode.props;G.vnode=Y,G.next=null,oP(G,Y.props,we,fe),lP(G,Y.children,fe),wl(),_7(G),_l()},U=(G,Y,fe,we,ge,Q,te,ce,ue=!1)=>{const Se=G&&G.children,ze=G?G.shapeFlag:0,_e=Y.children,{patchFlag:Ee,shapeFlag:it}=Y;if(Ee>0){if(Ee&128){W(Se,_e,fe,we,ge,Q,te,ce,ue);return}else if(Ee&256){z(Se,_e,fe,we,ge,Q,te,ce,ue);return}}it&8?(ze&16&&le(Se,ge,Q),_e!==Se&&c(fe,_e)):ze&16?it&16?W(Se,_e,fe,we,ge,Q,te,ce,ue):le(Se,ge,Q,!0):(ze&8&&c(fe,""),it&16&&A(_e,fe,we,ge,Q,te,ce,ue))},z=(G,Y,fe,we,ge,Q,te,ce,ue)=>{G=G||Id,Y=Y||Id;const Se=G.length,ze=Y.length,_e=Math.min(Se,ze);let Ee;for(Ee=0;Ee<_e;Ee++){const it=Y[Ee]=ue?Kl(Y[Ee]):Di(Y[Ee]);v(G[Ee],it,fe,null,ge,Q,te,ce,ue)}Se>ze?le(G,ge,Q,!0,!1,_e):A(Y,fe,we,ge,Q,te,ce,ue,_e)},W=(G,Y,fe,we,ge,Q,te,ce,ue)=>{let Se=0;const ze=Y.length;let _e=G.length-1,Ee=ze-1;for(;Se<=_e&&Se<=Ee;){const it=G[Se],Fe=Y[Se]=ue?Kl(Y[Se]):Di(Y[Se]);if(Br(it,Fe))v(it,Fe,fe,null,ge,Q,te,ce,ue);else break;Se++}for(;Se<=_e&&Se<=Ee;){const it=G[_e],Fe=Y[Ee]=ue?Kl(Y[Ee]):Di(Y[Ee]);if(Br(it,Fe))v(it,Fe,fe,null,ge,Q,te,ce,ue);else break;_e--,Ee--}if(Se>_e){if(Se<=Ee){const it=Ee+1,Fe=itEe)for(;Se<=_e;)V(G[Se],ge,Q,!0),Se++;else{const it=Se,Fe=Se,Oe=new Map;for(Se=Fe;Se<=Ee;Se++){const en=Y[Se]=ue?Kl(Y[Se]):Di(Y[Se]);en.key!=null&&Oe.set(en.key,Se)}let Ge,at=0;const Tt=Ee-Fe+1;let Bt=!1,Yt=0;const Sn=new Array(Tt);for(Se=0;Se=Tt){V(en,ge,Q,!0);continue}let Cn;if(en.key!=null)Cn=Oe.get(en.key);else for(Ge=Fe;Ge<=Ee;Ge++)if(Sn[Ge-Fe]===0&&Br(en,Y[Ge])){Cn=Ge;break}Cn===void 0?V(en,ge,Q,!0):(Sn[Cn-Fe]=Se+1,Cn>=Yt?Yt=Cn:Bt=!0,v(en,Y[Cn],fe,null,ge,Q,te,ce,ue),at++)}const on=Bt?cP(Sn):Id;for(Ge=on.length-1,Se=Tt-1;Se>=0;Se--){const en=Fe+Se,Cn=Y[en],Mn=Y[en+1],We=en+1{const{el:Q,type:te,transition:ce,children:ue,shapeFlag:Se}=G;if(Se&6){K(G.component.subTree,Y,fe,we);return}if(Se&128){G.suspense.move(Y,fe,we);return}if(Se&64){te.move(G,Y,fe,ve);return}if(te===Pe){o(Q,Y,fe);for(let _e=0;_ece.enter(Q),ge));else{const{leave:_e,delayLeave:Ee,afterLeave:it}=ce,Fe=()=>{G.ctx.isUnmounted?s(Q):o(Q,Y,fe)},Oe=()=>{const Ge=Q._isLeaving||!!Q[yr];Q._isLeaving&&Q[yr](!0),ce.persisted&&!Ge?Fe():_e(Q,()=>{Fe(),it&&it()})};Ee?Ee(Q,Fe,Oe):Oe()}else o(Q,Y,fe)},V=(G,Y,fe,we=!1,ge=!1)=>{const{type:Q,props:te,ref:ce,children:ue,dynamicChildren:Se,shapeFlag:ze,patchFlag:_e,dirs:Ee,cacheIndex:it,memo:Fe}=G;if(_e===-2&&(ge=!1),ce!=null&&(wl(),Fd(ce,null,fe,G,!0),_l()),it!=null&&(Y.renderCache[it]=void 0),ze&256){Y.ctx.deactivate(G);return}const Oe=ze&1&&Ee,Ge=!na(G);let at;if(Ge&&(at=te&&te.onVnodeBeforeUnmount)&&Fi(at,Y,G),ze&6)X(G.component,fe,we);else{if(ze&128){G.suspense.unmount(fe,we);return}Oe&&hl(G,null,Y,"beforeUnmount"),ze&64?G.type.remove(G,Y,fe,ve,we):Se&&!Se.hasOnce&&(Q!==Pe||_e>0&&_e&64)?le(Se,Y,fe,!1,!0):(Q===Pe&&_e&384||!ge&&ze&16)&&le(ue,Y,fe),we&&ie(G)}const Tt=Fe!=null&&it==null;(Ge&&(at=te&&te.onVnodeUnmounted)||Oe||Tt)&&os(()=>{at&&Fi(at,Y,G),Oe&&hl(G,null,Y,"unmounted"),Tt&&(G.el=null)},fe)},ie=G=>{const{type:Y,el:fe,anchor:we,transition:ge}=G;if(Y===Pe){ne(fe,we);return}if(Y===Od){g(G);return}const Q=()=>{s(fe),ge&&!ge.persisted&&ge.afterLeave&&ge.afterLeave()};if(G.shapeFlag&1&&ge&&!ge.persisted){const{leave:te,delayLeave:ce}=ge,ue=()=>te(fe,Q);ce?ce(G.el,Q,ue):ue()}else Q()},ne=(G,Y)=>{let fe;for(;G!==Y;)fe=f(G),s(G),G=fe;s(Y)},X=(G,Y,fe)=>{const{bum:we,scope:ge,job:Q,subTree:te,um:ce,m:ue,a:Se}=G;bm(ue),bm(Se),we&&$d(we),ge.stop(),Q&&(Q.flags|=8,V(te,G,Y,fe)),ce&&os(ce,Y),os(()=>{G.isUnmounted=!0},Y)},le=(G,Y,fe,we=!1,ge=!1,Q=0)=>{for(let te=Q;te{if(G.shapeFlag&6)return Ie(G.component.subTree);if(G.shapeFlag&128)return G.suspense.next();const Y=f(G.anchor||G.el),fe=Y&&Y[nA];return fe?f(fe):Y};let de=!1;const pe=(G,Y,fe)=>{let we;G==null?Y._vnode&&(V(Y._vnode,null,null,!0),we=Y._vnode.component):v(Y._vnode||null,G,Y,null,null,null,fe),Y._vnode=G,de||(de=!0,_7(we),gm(),de=!1)},ve={p:v,um:V,m:K,r:ie,mt:B,mc:A,pc:U,pbc:P,n:Ie,o:e};let oe,ye;return t&&([oe,ye]=t(ve)),{render:pe,hydrate:oe,createApp:GO(pe,oe)}}function Vv({type:e,props:t},n){return n==="svg"&&e==="foreignObject"||n==="mathml"&&e==="annotation-xml"&&t&&t.encoding&&t.encoding.includes("html")?void 0:n}function Iu({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function TA(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function V8(e,t,n=!1){const o=e.children,s=t.children;if(jt(o)&&jt(s))for(let i=0;i>1,e[n[l]]0&&(t[o]=n[i-1]),n[i]=o)}}for(i=n.length,r=n[i-1];i-- >0;)n[i]=r,r=t[r];return n}function EA(e){const t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:EA(t)}function bm(e){if(e)for(let t=0;te.__isSuspense;let D4=0;const dP={name:"Suspense",__isSuspense:!0,process(e,t,n,o,s,i,r,l,a,u){if(e==null)fP(t,n,o,s,i,r,l,a,u);else{if(i&&i.deps>0&&!e.suspense.isInFallback){t.suspense=e.suspense,t.suspense.vnode=t,t.el=e.el;return}pP(e,t,n,o,s,r,l,a,u)}},hydrate:hP,normalize:mP},tVe=dP;function dp(e,t){const n=e.props&&e.props[t];un(n)&&n()}function fP(e,t,n,o,s,i,r,l,a){const{p:u,o:{createElement:c}}=a,d=c("div"),f=e.suspense=LA(e,s,o,t,d,n,i,r,l,a);u(null,f.pendingBranch=e.ssContent,d,null,o,f,i,r),f.deps>0?(dp(e,"onPending"),dp(e,"onFallback"),u(null,e.ssFallback,t,n,o,null,i,r),Rd(f,e.ssFallback)):f.resolve(!1,!0)}function pP(e,t,n,o,s,i,r,l,{p:a,um:u,o:{createElement:c}}){const d=t.suspense=e.suspense;d.vnode=t,t.el=e.el;const f=t.ssContent,h=t.ssFallback,{activeBranch:m,pendingBranch:v,isInFallback:k,isHydrating:w}=d;if(v)d.pendingBranch=f,Br(v,f)?(a(v,f,d.hiddenContainer,null,s,d,i,r,l),d.deps<=0?d.resolve():k&&(w||(a(m,h,n,o,s,null,i,r,l),Rd(d,h)))):(d.pendingId=D4++,w?(d.isHydrating=!1,d.activeBranch=v):u(v,s,d),d.deps=0,d.effects.length=0,d.hiddenContainer=c("div"),k?(a(null,f,d.hiddenContainer,null,s,d,i,r,l),d.deps<=0?d.resolve():(a(m,h,n,o,s,null,i,r,l),Rd(d,h))):m&&Br(m,f)?(a(m,f,n,o,s,d,i,r,l),d.resolve(!0)):(a(null,f,d.hiddenContainer,null,s,d,i,r,l),d.deps<=0&&d.resolve()));else if(m&&Br(m,f))a(m,f,n,o,s,d,i,r,l),Rd(d,f);else if(dp(t,"onPending"),d.pendingBranch=f,f.shapeFlag&512?d.pendingId=f.component.suspenseId:d.pendingId=D4++,a(null,f,d.hiddenContainer,null,s,d,i,r,l),d.deps<=0)d.resolve();else{const{timeout:b,pendingId:_}=d;b>0?setTimeout(()=>{d.pendingId===_&&d.fallback(h)},b):b===0&&d.fallback(h)}}function LA(e,t,n,o,s,i,r,l,a,u,c=!1){const{p:d,m:f,um:h,n:m,o:{parentNode:v,remove:k}}=u;let w;const b=gP(e);b&&t&&t.pendingBranch&&(w=t.pendingId,t.deps++);const _=e.props?cm(e.props.timeout):void 0,g=i,x={vnode:e,parent:t,parentComponent:n,namespace:r,container:o,hiddenContainer:s,deps:0,pendingId:D4++,timeout:typeof _=="number"?_:-1,activeBranch:null,isFallbackMountPending:!1,pendingBranch:null,isInFallback:!c,isHydrating:c,isUnmounted:!1,effects:[],resolve(S=!1,T=!1){const{vnode:A,activeBranch:E,pendingBranch:P,pendingId:D,effects:I,parentComponent:$,container:B,isInFallback:H}=x;let O=!1;if(x.isHydrating)x.isHydrating=!1;else if(!S){O=E&&P.transition&&P.transition.mode==="out-in";let z=!1;O&&(E.transition.afterLeave=()=>{D===x.pendingId&&(f(P,B,i===g&&!z?m(E):i,0),mm(I),H&&A.ssFallback&&(A.ssFallback.el=null))}),E&&!x.isFallbackMountPending&&(v(E.el)===B&&(i=m(E),z=!0),h(E,$,x,!0),!O&&H&&A.ssFallback&&os(()=>A.ssFallback.el=null,x)),O||f(P,B,i,0)}x.isFallbackMountPending=!1,Rd(x,P),x.pendingBranch=null,x.isInFallback=!1;let F=x.parent,U=!1;for(;F;){if(F.pendingBranch){F.effects.push(...I),U=!0;break}F=F.parent}!U&&!O&&mm(I),x.effects=[],b&&t&&t.pendingBranch&&w===t.pendingId&&(t.deps--,t.deps===0&&!T&&t.resolve()),dp(A,"onResolve")},fallback(S){if(!x.pendingBranch)return;const{vnode:T,activeBranch:A,parentComponent:E,container:P,namespace:D}=x;dp(T,"onFallback");const I=m(A),$=()=>{x.isFallbackMountPending=!1,x.isInFallback&&(d(null,S,P,I,E,null,D,l,a),Rd(x,S))},B=S.transition&&S.transition.mode==="out-in";B&&(x.isFallbackMountPending=!0,A.transition.afterLeave=$),x.isInFallback=!0,h(A,E,null,!0),B||$()},move(S,T,A){x.activeBranch&&f(x.activeBranch,S,T,A),x.container=S},next(){return x.activeBranch&&m(x.activeBranch)},registerDep(S,T,A){const E=!!x.pendingBranch;E&&x.deps++;const P=S.vnode.el;S.asyncDep.catch(D=>{f1(D,S,0)}).then(D=>{if(S.isUnmounted||x.isUnmounted||x.pendingId!==S.suspenseId)return;fp(),S.asyncResolved=!0;const{vnode:I}=S;B4(S,D,!1),P&&(I.el=P);const $=!P&&S.subTree.el;T(S,I,v(P||S.subTree.el),P?null:m(S.subTree),x,r,A),$&&(I.placeholder=null,k($)),n2(S,I.el),E&&--x.deps===0&&x.resolve()})},unmount(S,T){x.isUnmounted=!0,x.activeBranch&&h(x.activeBranch,n,S,T),x.pendingBranch&&h(x.pendingBranch,n,S,T)}};return x}function hP(e,t,n,o,s,i,r,l,a){const u=t.suspense=LA(t,o,n,e.parentNode,document.createElement("div"),null,s,i,r,l,!0),c=a(e,u.pendingBranch=t.ssContent,n,u,i,r);return u.deps===0&&u.resolve(!1,!0),c}function mP(e){const{shapeFlag:t,children:n}=e,o=t&32;e.ssContent=O7(o?n.default:n),e.ssFallback=o?O7(n.fallback):j(rs)}function O7(e){let t;if(un(e)){const n=dc&&e._c;n&&(e._d=!1,y()),e=e(),n&&(e._d=!0,t=ri,NA())}return jt(e)&&(e=JO(e)),e=Di(e),t&&!e.dynamicChildren&&(e.dynamicChildren=t.filter(n=>n!==e)),e}function $A(e,t){t&&t.pendingBranch?jt(e)?t.effects.push(...e):t.effects.push(e):mm(e)}function Rd(e,t){e.activeBranch=t;const{vnode:n,parentComponent:o}=e;let s=t.el;for(;!s&&t.component;)t=t.component.subTree,s=t.el;n.el=s,o&&o.subTree===n&&(o.vnode.el=s,n2(o,s))}function gP(e){const t=e.props&&e.props.suspensible;return t!=null&&t!==!1}const Pe=Symbol.for("v-fgt"),Ua=Symbol.for("v-txt"),rs=Symbol.for("v-cmt"),Od=Symbol.for("v-stc"),Rf=[];let ri=null;function y(e=!1){Rf.push(ri=e?null:[])}function NA(){Rf.pop(),ri=Rf[Rf.length-1]||null}let dc=1;function wm(e,t=!1){dc+=e,e<0&&ri&&t&&(ri.hasOnce=!0)}function FA(e){return e.dynamicChildren=dc>0?ri||Id:null,NA(),dc>0&&ri&&ri.push(e),e}function M(e,t,n,o,s,i){return FA(C(e,t,n,o,s,i,!0))}function he(e,t,n,o,s){return FA(j(e,t,n,o,s,!0))}function Ga(e){return e?e.__v_isVNode===!0:!1}function Br(e,t){return e.type===t.type&&e.key===t.key}function nVe(e){}const RA=({key:e})=>e??null,Dh=({ref:e,ref_key:t,ref_for:n})=>(typeof e=="number"&&(e=""+e),e!=null?ro(e)||Xo(e)||un(e)?{i:Ks,r:e,k:t,f:!!n}:e:null);function C(e,t=null,n=null,o=0,s=null,i=e===Pe?0:1,r=!1,l=!1){const a={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&RA(t),ref:t&&Dh(t),scopeId:Qg,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:i,patchFlag:o,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ks};return l?(_m(a,n),i&128&&e.normalize(a)):n&&(a.shapeFlag|=ro(n)?8:16),dc>0&&!r&&ri&&(a.patchFlag>0||i&6)&&a.patchFlag!==32&&ri.push(a),a}const j=vP;function vP(e,t=null,n=null,o=0,s=null,i=!1){if((!e||e===dA)&&(e=rs),Ga(e)){const l=ra(e,t,!0);return n&&_m(l,n),dc>0&&!i&&ri&&(l.shapeFlag&6?ri[ri.indexOf(e)]=l:ri.push(l)),l.patchFlag=-2,l}if(wP(e)&&(e=e.__vccOpts),t){t=OA(t);let{class:l,style:a}=t;l&&!ro(l)&&(t.class=Re(l)),Zn(a)&&(Jg(a)&&!jt(a)&&(a=to({},a)),t.style=Zt(a))}const r=ro(e)?1:Cm(e)?128:oA(e)?64:Zn(e)?4:un(e)?2:0;return C(e,t,n,o,s,r,i,!0)}function OA(e){return e?Jg(e)||CA(e)?to({},e):e:null}function ra(e,t,n=!1,o=!1){const{props:s,ref:i,patchFlag:r,children:l,transition:a}=e,u=t?zn(s||{},t):s,c={__v_isVNode:!0,__v_skip:!0,type:e.type,props:u,key:u&&RA(u),ref:t&&t.ref?n&&i?jt(i)?i.concat(Dh(t)):[i,Dh(t)]:Dh(t):i,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:l,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==Pe?r===-1?16:r|16:r,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:a,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&ra(e.ssContent),ssFallback:e.ssFallback&&ra(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce};return a&&o&&Za(c,a.clone(c)),c}function qe(e=" ",t=0){return j(Ua,null,e,t)}function iu(e,t){const n=j(Od,null,e);return n.staticCount=t,n}function ee(e="",t=!1){return t?(y(),he(rs,null,e)):j(rs,null,e)}function Di(e){return e==null||typeof e=="boolean"?j(rs):jt(e)?j(Pe,null,e.slice()):Ga(e)?Kl(e):j(Ua,null,String(e))}function Kl(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:ra(e)}function _m(e,t){let n=0;const{shapeFlag:o}=e;if(t==null)t=null;else if(jt(t))n=16;else if(typeof t=="object")if(o&65){const s=t.default;s&&(s._c&&(s._d=!1),_m(e,s()),s._c&&(s._d=!0));return}else{n=32;const s=t._;!s&&!CA(t)?t._ctx=Ks:s===3&&Ks&&(Ks.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}else if(un(t)){if(o&65){_m(e,{default:t});return}t={default:t,_ctx:Ks},n=32}else t=String(t),o&64?(n=16,t=[qe(t)]):n=8;e.children=t,e.shapeFlag|=n}function zn(...e){const t={};for(let n=0;nVs||Ks;let xm,Pd;{const e=Vg(),t=(n,o)=>{let s;return(s=e[n])||(s=e[n]=[]),s.push(o),i=>{s.length>1?s.forEach(r=>r(i)):s[0](i)}};xm=t("__VUE_INSTANCE_SETTERS__",n=>Vs=n),Pd=t("__VUE_SSR_SETTERS__",n=>fc=n)}const h1=e=>{const t=Vs;return xm(e),e.scope.on(),()=>{e.scope.off(),xm(t)}},fp=()=>{Vs&&Vs.scope.off(),xm(null)};function DA(e){return e.vnode.shapeFlag&4}let fc=!1;function BA(e,t=!1,n=!1){t&&Pd(t);const{props:o,children:s}=e.vnode,i=DA(e);nP(e,o,i,t),rP(e,s,n||t);const r=i?bP(e,t):void 0;return t&&Pd(!1),r}function bP(e,t){const n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,F4);const{setup:o}=n;if(o){wl();const s=e.setupContext=o.length>1?zA(e):null,i=h1(e),r=Rp(o,e,0,[e.props,s]),l=L8(r);if(_l(),i(),(l||e.sp)&&!na(e)&&P8(e),l){if(r.then(fp,fp),t)return r.then(a=>{B4(e,a,t)}).catch(a=>{f1(a,e,0)});e.asyncDep=r}else B4(e,r,t)}else HA(e,t)}function B4(e,t,n){un(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:Zn(t)&&(e.setupState=ZS(t)),HA(e,n)}let Sm,H4;function oVe(e){Sm=e,H4=t=>{t.render._rc&&(t.withProxy=new Proxy(t.ctx,WO))}}const sVe=()=>!Sm;function HA(e,t,n){const o=e.type;if(!e.render){if(!t&&Sm&&!o.render){const s=o.template||W8(e).template;if(s){const{isCustomElement:i,compilerOptions:r}=e.appContext.config,{delimiters:l,compilerOptions:a}=o,u=to(to({isCustomElement:i,delimiters:l},r),a);o.render=Sm(s,u)}}e.render=o.render||wr,H4&&H4(e)}{const s=h1(e);wl();try{UO(e)}finally{_l(),s()}}}const CP={get(e,t){return ii(e,"get",""),e[t]}};function zA(e){const t=n=>{e.exposed=n||{}};return{attrs:new Proxy(e.attrs,CP),slots:e.slots,emit:e.emit,expose:t}}function Bp(e){return e.exposed?e.exposeProxy||(e.exposeProxy=new Proxy(ZS(kt(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Ff)return Ff[n](e)},has(t,n){return n in t||n in Ff}})):e.proxy}function z4(e,t=!0){return un(e)?e.displayName||e.name:e.name||t&&e.__name}function wP(e){return un(e)&&"__vccOpts"in e}const R=(e,t)=>nO(e,t,fc);function tn(e,t,n){try{wm(-1);const o=arguments.length;return o===2?Zn(t)&&!jt(t)?Ga(t)?j(e,null,[t]):j(e,t):j(e,null,t):(o>3?n=Array.prototype.slice.call(arguments,2):o===3&&Ga(n)&&(n=[n]),j(e,t,n))}finally{wm(1)}}function iVe(){}function rVe(e,t,n,o){const s=n[o];if(s&&_P(s,e))return s;const i=t();return i.memo=e.slice(),i.cacheIndex=o,n[o]=i}function _P(e,t){const n=e.memo;if(n.length!=t.length)return!1;for(let o=0;o0&&ri&&ri.push(e),!0}const xP="3.5.39",lVe=wr,aVe=lO,uVe=fd,cVe=eA,SP={createComponentInstance:PA,setupComponent:BA,renderComponentRoot:Ph,setCurrentRenderingInstance:ap,isVNode:Ga,normalizeVNode:Di,getComponentPublicInstance:Bp,ensureValidVNode:z8,pushWarningContext:iO,popWarningContext:rO},dVe=SP,fVe=null,pVe=null,hVe=null;/** +* @vue/runtime-dom v3.5.39 +* (c) 2018-present Yuxi (Evan) You and Vue contributors +* @license MIT +**/let W4;const P7=typeof window<"u"&&window.trustedTypes;if(P7)try{W4=P7.createPolicy("vue",{createHTML:e=>e})}catch{}const WA=W4?e=>W4.createHTML(e):e=>e,AP="http://www.w3.org/2000/svg",MP="http://www.w3.org/1998/Math/MathML",jl=typeof document<"u"?document:null,D7=jl&&jl.createElement("template"),TP={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{const t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,o)=>{const s=t==="svg"?jl.createElementNS(AP,e):t==="mathml"?jl.createElementNS(MP,e):n?jl.createElement(e,{is:n}):jl.createElement(e);return e==="select"&&o&&o.multiple!=null&&s.setAttribute("multiple",o.multiple),s},createText:e=>jl.createTextNode(e),createComment:e=>jl.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>jl.querySelector(e),setScopeId(e,t){e.setAttribute(t,"")},insertStaticContent(e,t,n,o,s,i){const r=n?n.previousSibling:t.lastChild;if(s&&(s===i||s.nextSibling))for(;t.insertBefore(s.cloneNode(!0),n),!(s===i||!(s=s.nextSibling)););else{D7.innerHTML=WA(o==="svg"?`${e}`:o==="mathml"?`${e}`:e);const l=D7.content;if(o==="svg"||o==="mathml"){const a=l.firstChild;for(;a.firstChild;)l.appendChild(a.firstChild);l.removeChild(a)}t.insertBefore(l,n)}return[r?r.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},va="transition",X1="animation",Jd=Symbol("_vtc"),UA={name:String,type:String,css:{type:Boolean,default:!0},duration:[String,Number,Object],enterFromClass:String,enterActiveClass:String,enterToClass:String,appearFromClass:String,appearActiveClass:String,appearToClass:String,leaveFromClass:String,leaveActiveClass:String,leaveToClass:String},jA=to({},iA,UA),EP=e=>(e.displayName="Transition",e.props=jA,e),as=EP((e,{slots:t})=>tn(yO,VA(e),t)),Lu=(e,t=[])=>{jt(e)?e.forEach(n=>n(...t)):e&&e(...t)},B7=e=>e?jt(e)?e.some(t=>t.length>1):e.length>1:!1;function VA(e){const t={};for(const I in e)I in UA||(t[I]=e[I]);if(e.css===!1)return t;const{name:n="v",type:o,duration:s,enterFromClass:i=`${n}-enter-from`,enterActiveClass:r=`${n}-enter-active`,enterToClass:l=`${n}-enter-to`,appearFromClass:a=i,appearActiveClass:u=r,appearToClass:c=l,leaveFromClass:d=`${n}-leave-from`,leaveActiveClass:f=`${n}-leave-active`,leaveToClass:h=`${n}-leave-to`}=e,m=IP(s),v=m&&m[0],k=m&&m[1],{onBeforeEnter:w,onEnter:b,onEnterCancelled:_,onLeave:g,onLeaveCancelled:x,onBeforeAppear:S=w,onAppear:T=b,onAppearCancelled:A=_}=t,E=(I,$,B,H)=>{I._enterCancelled=H,Ma(I,$?c:l),Ma(I,$?u:r),B&&B()},P=(I,$)=>{I._isLeaving=!1,Ma(I,d),Ma(I,h),Ma(I,f),$&&$()},D=I=>($,B)=>{const H=I?T:b,O=()=>E($,I,B);Lu(H,[$,O]),H7(()=>{Ma($,I?a:i),dl($,I?c:l),B7(H)||z7($,o,v,O)})};return to(t,{onBeforeEnter(I){Lu(w,[I]),dl(I,i),dl(I,r)},onBeforeAppear(I){Lu(S,[I]),dl(I,a),dl(I,u)},onEnter:D(!1),onAppear:D(!0),onLeave(I,$){I._isLeaving=!0;const B=()=>P(I,$);dl(I,d),I._enterCancelled?(dl(I,f),U4(I)):(U4(I),dl(I,f)),H7(()=>{I._isLeaving&&(Ma(I,d),dl(I,h),B7(g)||z7(I,o,k,B))}),Lu(g,[I,B])},onEnterCancelled(I){E(I,!1,void 0,!0),Lu(_,[I])},onAppearCancelled(I){E(I,!0,void 0,!0),Lu(A,[I])},onLeaveCancelled(I){P(I),Lu(x,[I])}})}function IP(e){if(e==null)return null;if(Zn(e))return[qv(e.enter),qv(e.leave)];{const t=qv(e);return[t,t]}}function qv(e){return cm(e)}function dl(e,t){t.split(/\s+/).forEach(n=>n&&e.classList.add(n)),(e[Jd]||(e[Jd]=new Set)).add(t)}function Ma(e,t){t.split(/\s+/).forEach(o=>o&&e.classList.remove(o));const n=e[Jd];n&&(n.delete(t),n.size||(e[Jd]=void 0))}function H7(e){requestAnimationFrame(()=>{requestAnimationFrame(e)})}let LP=0;function z7(e,t,n,o){const s=e._endId=++LP,i=()=>{s===e._endId&&o()};if(n!=null)return setTimeout(i,n);const{type:r,timeout:l,propCount:a}=qA(e,t);if(!r)return o();const u=r+"end";let c=0;const d=()=>{e.removeEventListener(u,f),i()},f=h=>{h.target===e&&++c>=a&&d()};setTimeout(()=>{c(n[m]||"").split(", "),s=o(`${va}Delay`),i=o(`${va}Duration`),r=W7(s,i),l=o(`${X1}Delay`),a=o(`${X1}Duration`),u=W7(l,a);let c=null,d=0,f=0;t===va?r>0&&(c=va,d=r,f=i.length):t===X1?u>0&&(c=X1,d=u,f=a.length):(d=Math.max(r,u),c=d>0?r>u?va:X1:null,f=c?c===va?i.length:a.length:0);const h=c===va&&/\b(?:transform|all)(?:,|$)/.test(o(`${va}Property`).toString());return{type:c,timeout:d,propCount:f,hasTransform:h}}function W7(e,t){for(;e.lengthU7(n)+U7(e[o])))}function U7(e){return e==="auto"?0:Number(e.slice(0,-1).replace(",","."))*1e3}function U4(e){return(e?e.ownerDocument:document).body.offsetHeight}function $P(e,t,n){const o=e[Jd];o&&(t=(t?[t,...o]:[...o]).join(" ")),t==null?e.removeAttribute("class"):n?e.setAttribute("class",t):e.className=t}const Am=Symbol("_vod"),q8=Symbol("_vsh"),qs={name:"show",beforeMount(e,{value:t},{transition:n}){e[Am]=e.style.display==="none"?"":e.style.display,n&&t?n.beforeEnter(e):J1(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:o}){!t!=!n&&(o?t?(o.beforeEnter(e),J1(e,!0),o.enter(e)):o.leave(e,()=>{J1(e,!1)}):J1(e,t))},beforeUnmount(e,{value:t}){J1(e,t)}};function J1(e,t){e.style.display=t?e[Am]:"none",e[q8]=!t}function NP(){qs.getSSRProps=({value:e})=>{if(!e)return{style:{display:"none"}}}}const KA=Symbol("");function mVe(e){const t=ds();if(!t)return;const n=t.ut=(s=e(t.proxy))=>{Array.from(document.querySelectorAll(`[data-v-owner="${t.uid}"]`)).forEach(i=>Mm(i,s))},o=()=>{const s=e(t.proxy);t.ce?Mm(t.ce,s):j4(t.subTree,s),n(s)};cA(()=>{mm(o)}),dn(()=>{Je(o,wr,{flush:"post"});const s=new MutationObserver(o);s.observe(t.subTree.el.parentNode,{childList:!0}),bn(()=>s.disconnect())})}function j4(e,t){if(e.shapeFlag&128){const n=e.suspense;e=n.activeBranch,n.pendingBranch&&!n.isHydrating&&n.effects.push(()=>{j4(n.activeBranch,t)})}for(;e.component;)e=e.component.subTree;if(e.shapeFlag&1&&e.el)Mm(e.el,t);else if(e.type===Pe)e.children.forEach(n=>j4(n,t));else if(e.type===Od){let{el:n,anchor:o}=e;for(;n&&(Mm(n,t),n!==o);)n=n.nextSibling}}function Mm(e,t){if(e.nodeType===1){const n=e.style;let o="";for(const s in t){const i=TR(t[s]);n.setProperty(`--${s}`,i),o+=`--${s}: ${i};`}n[KA]=o}}const FP=/(?:^|;)\s*display\s*:/;function RP(e,t,n){const o=e.style,s=ro(n);let i=!1;if(n&&!s){if(t)if(ro(t))for(const r of t.split(";")){const l=r.slice(0,r.indexOf(":")).trim();n[l]==null&&gf(o,l,"")}else for(const r in t)n[r]==null&&gf(o,r,"");for(const r in n){r==="display"&&(i=!0);const l=n[r];l!=null?PP(e,r,!ro(t)&&t?t[r]:void 0,l)||gf(o,r,l):gf(o,r,"")}}else if(s){if(t!==n){const r=o[KA];r&&(n+=";"+r),o.cssText=n,i=FP.test(n)}}else t&&e.removeAttribute("style");Am in e&&(e[Am]=i?o.display:"",e[q8]&&(o.display="none"))}const j7=/\s*!important$/;function gf(e,t,n){if(jt(n))n.forEach(o=>gf(e,t,o));else if(n==null&&(n=""),t.startsWith("--"))e.setProperty(t,n);else{const o=OP(e,t);j7.test(n)?e.setProperty(Bi(o),n.replace(j7,""),"important"):e[o]=n}}const V7=["Webkit","Moz","ms"],Kv={};function OP(e,t){const n=Kv[t];if(n)return n;let o=_s(t);if(o!=="filter"&&o in e)return Kv[t]=o;o=Ug(o);for(let s=0;sZv||(UP.then(()=>Zv=0),Zv=Date.now());function VP(e,t){const n=o=>{if(!o._vts)o._vts=Date.now();else if(o._vts<=n.attached)return;const s=n.value;if(jt(s)){const i=o.stopImmediatePropagation;o.stopImmediatePropagation=()=>{i.call(o),o._stopped=!0};const r=s.slice(),l=[o];for(let a=0;ae.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,qP=(e,t,n,o,s,i)=>{const r=s==="svg";t==="class"?$P(e,o,r):t==="style"?RP(e,n,o):Fp(t)?Bg(t)||BP(e,t,n,o,i):(t[0]==="."?(t=t.slice(1),!0):t[0]==="^"?(t=t.slice(1),!1):KP(e,t,o,r))?(Z7(e,t,o),!e.tagName.includes("-")&&(t==="value"||t==="checked"||t==="selected")&&K7(e,t,o,r,i,t!=="value")):e._isVueCE&&(ZP(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!ro(o)))?Z7(e,_s(t),o,i,t):(t==="true-value"?e._trueValue=o:t==="false-value"&&(e._falseValue=o),K7(e,t,o,r))};function KP(e,t,n,o){if(o)return!!(t==="innerHTML"||t==="textContent"||t in e&&Y7(t)&&un(n));if(t==="spellcheck"||t==="draggable"||t==="translate"||t==="autocorrect"||t==="sandbox"&&e.tagName==="IFRAME"||t==="form"||t==="list"&&e.tagName==="INPUT"||t==="type"&&e.tagName==="TEXTAREA")return!1;if(t==="width"||t==="height"){const s=e.tagName;if(s==="IMG"||s==="VIDEO"||s==="CANVAS"||s==="SOURCE")return!1}return Y7(t)&&ro(n)?!1:t in e}function ZP(e,t){const n=e._def.props;if(!n)return!1;const o=_s(t);return Array.isArray(n)?n.some(s=>_s(s)===o):Object.keys(n).some(s=>_s(s)===o)}const X7={};function GP(e,t,n){let o=et(e,t);Hg(o)&&(o=to({},o,t));class s extends K8{constructor(r){super(o,r,n)}}return s.def=o,s}const gVe=((e,t)=>GP(e,t,dD)),YP=typeof HTMLElement<"u"?HTMLElement:class{};class K8 extends YP{constructor(t,n={},o=Im){super(),this._def=t,this._props=n,this._createApp=o,this._isVueCE=!0,this._instance=null,this._app=null,this._nonce=this._def.nonce,this._connected=!1,this._resolved=!1,this._patching=!1,this._dirty=!1,this._numberProps=null,this._styleChildren=new WeakSet,this._styleAnchors=new WeakMap,this._ob=null,this.shadowRoot&&o!==Im?this._root=this.shadowRoot:t.shadowRoot!==!1?(this.attachShadow(to({},t.shadowRootOptions,{mode:"open"})),this._root=this.shadowRoot):this._root=this}connectedCallback(){if(!this.isConnected)return;!this.shadowRoot&&!this._resolved&&this._parseSlots(),this._connected=!0;let t=this;for(;t=t&&(t.assignedSlot||t.parentNode||t.host);)if(t instanceof K8){this._parent=t;break}this._instance||(this._resolved?this._mount(this._def):t&&t._pendingResolve?this._pendingResolve=t._pendingResolve.then(()=>{this._pendingResolve=void 0,this._resolveDef()}):this._resolveDef())}_setParent(t=this._parent){t&&(this._instance.parent=t._instance,this._inheritParentContext(t))}_inheritParentContext(t=this._parent){t&&this._app&&Object.setPrototypeOf(this._app._context.provides,t._instance.provides)}disconnectedCallback(){this._connected=!1,yt(()=>{this._connected||(this._ob&&(this._ob.disconnect(),this._ob=null),this._app&&this._app.unmount(),this._instance&&(this._instance.ce=void 0),this._app=this._instance=null,this._teleportTargets&&(this._teleportTargets.clear(),this._teleportTargets=void 0))})}_processMutations(t){for(const n of t)this._setAttr(n.attributeName)}_resolveDef(){if(this._pendingResolve)return;for(let o=0;o{this._resolved=!0,this._pendingResolve=void 0;const{props:i,styles:r}=o;let l;if(i&&!jt(i))for(const a in i){const u=i[a];(u===Number||u&&u.type===Number)&&(a in this._props&&(this._props[a]=cm(this._props[a])),(l||(l=Object.create(null)))[_s(a)]=!0)}this._numberProps=l,this._resolveProps(o),this.shadowRoot&&this._applyStyles(r),this._mount(o)},n=this._def.__asyncLoader;n?this._pendingResolve=n().then(o=>{o.configureApp=this._def.configureApp,t(this._def=o,!0)}):t(this._def)}_mount(t){this._app=this._createApp(t),this._inheritParentContext(),t.configureApp&&t.configureApp(this._app),this._app._ceVNode=this._createVNode(),this._app.mount(this._root);const n=this._instance&&this._instance.exposed;if(n)for(const o in n)Kn(this,o)||Object.defineProperty(this,o,{get:()=>p(n[o])})}_resolveProps(t){const{props:n}=t,o=jt(n)?n:Object.keys(n||{});for(const s of Object.keys(this))s[0]!=="_"&&o.includes(s)&&this._setProp(s,this[s]);for(const s of o.map(_s))Object.defineProperty(this,s,{get(){return this._getProp(s)},set(i){this._setProp(s,i,!0,!this._patching)}})}_setAttr(t){if(t.startsWith("data-v-"))return;const n=this.hasAttribute(t);let o=n?this.getAttribute(t):X7;const s=_s(t);n&&this._numberProps&&this._numberProps[s]&&(o=cm(o)),this._setProp(s,o,!1,!0)}_getProp(t){return this._props[t]}_setProp(t,n,o=!0,s=!1){if(n!==this._props[t]&&(this._dirty=!0,n===X7?delete this._props[t]:(this._props[t]=n,t==="key"&&this._app&&(this._app._ceVNode.key=n)),s&&this._instance&&this._update(),o)){const i=this._ob;i&&(this._processMutations(i.takeRecords()),i.disconnect()),n===!0?this.setAttribute(Bi(t),""):typeof n=="string"||typeof n=="number"?this.setAttribute(Bi(t),n+""):n||this.removeAttribute(Bi(t)),i&&i.observe(this,{attributes:!0})}}_update(){const t=this._createVNode();this._app&&(t.appContext=this._app._context),cD(t,this._root)}_createVNode(){const t={};this.shadowRoot||(t.onVnodeMounted=t.onVnodeUpdated=this._renderSlots.bind(this));const n=j(this._def,to(t,this._props));return this._instance||(n.ce=o=>{this._instance=o,o.ce=this,o.isCE=!0;const s=(i,r)=>{this.dispatchEvent(new CustomEvent(i,Hg(r[0])?to({detail:r},r[0]):{detail:r}))};o.emit=(i,...r)=>{s(i,r),Bi(i)!==i&&s(Bi(i),r)},this._setParent()}),n}_applyStyles(t,n,o){if(!t)return;if(n){if(n===this._def||this._styleChildren.has(n))return;this._styleChildren.add(n)}const s=this._nonce,i=this.shadowRoot,r=o?this._getStyleAnchor(o)||this._getStyleAnchor(this._def):this._getRootStyleInsertionAnchor(i);let l=null;for(let a=t.length-1;a>=0;a--){const u=document.createElement("style");s&&u.setAttribute("nonce",s),u.textContent=t[a],i.insertBefore(u,l||r),l=u,a===0&&(o||this._styleAnchors.set(this._def,u),n&&this._styleAnchors.set(n,u))}}_getStyleAnchor(t){if(!t)return null;const n=this._styleAnchors.get(t);return n&&n.parentNode===this.shadowRoot?n:(n&&this._styleAnchors.delete(t),null)}_getRootStyleInsertionAnchor(t){for(let n=0;n(delete e.props.mode,e),QP=JP({name:"TransitionGroup",props:to({},jA,{tag:String,moveClass:String}),setup(e,{slots:t}){const n=ds(),o=sA();let s,i;return Dp(()=>{if(!s.length)return;const r=e.moveClass||`${e.name||"v"}-move`;if(!oD(s[0].el,n.vnode.el,r)){s=[];return}s.forEach(eD),s.forEach(tD);const l=s.filter(nD);U4(n.vnode.el),l.forEach(a=>{const u=a.el,c=u.style;dl(u,r),c.transform=c.webkitTransform=c.transitionDuration="";const d=u[Tm]=f=>{f&&f.target!==u||(!f||f.propertyName.endsWith("transform"))&&(u.removeEventListener("transitionend",d),u[Tm]=null,Ma(u,r))};u.addEventListener("transitionend",d)}),s=[]}),()=>{const r=Pn(e),l=VA(r);let a=r.tag||Pe;if(s=[],i)for(let u=0;u{l.split(/\s+/).forEach(a=>a&&o.classList.remove(a))}),n.split(/\s+/).forEach(l=>l&&o.classList.add(l)),o.style.display="none";const i=t.nodeType===1?t:t.parentNode;i.appendChild(o);const{hasTransform:r}=qA(o);return i.removeChild(o),r}const Ya=e=>{const t=e.props["onUpdate:modelValue"]||!1;return jt(t)?n=>$d(t,n):t};function sD(e){e.target.composing=!0}function Q7(e){const t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event("input")))}const _r=Symbol("_assign");function ek(e,t,n){return t&&(e=e.trim()),n&&(e=jg(e)),e}const ai={created(e,{modifiers:{lazy:t,trim:n,number:o}},s){e[_r]=Ya(s);const i=o||s.props&&s.props.type==="number";Yl(e,t?"change":"input",r=>{r.target.composing||e[_r](ek(e.value,n,i))}),(n||i)&&Yl(e,"change",()=>{e.value=ek(e.value,n,i)}),t||(Yl(e,"compositionstart",sD),Yl(e,"compositionend",Q7),Yl(e,"change",Q7))},mounted(e,{value:t}){e.value=t??""},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:o,trim:s,number:i}},r){if(e[_r]=Ya(r),e.composing)return;const l=(i||e.type==="number")&&!/^0\d/.test(e.value)?jg(e.value):e.value,a=t??"";if(l===a)return;const u=e.getRootNode();(u instanceof Document||u instanceof ShadowRoot)&&u.activeElement===e&&e.type!=="range"&&(o&&t===n||s&&e.value.trim()===a)||(e.value=a)}},Em={deep:!0,created(e,t,n){e[_r]=Ya(n),Yl(e,"change",()=>{const o=e._modelValue,s=Qd(e),i=e.checked,r=e[_r];if(jt(o)){const l=qg(o,s),a=l!==-1;if(i&&!a)r(o.concat(s));else if(!i&&a){const u=[...o];u.splice(l,1),r(u)}}else if(Ac(o)){const l=new Set(o);i?l.add(s):l.delete(s),r(l)}else r(QA(e,i))})},mounted:tk,beforeUpdate(e,t,n){e[_r]=Ya(n),tk(e,t,n)}};function tk(e,{value:t,oldValue:n},o){e._modelValue=t;let s;if(jt(t))s=qg(t,o.props.value)>-1;else if(Ac(t))s=t.has(o.props.value);else{if(t===n)return;s=sa(t,QA(e,!0))}e.checked!==s&&(e.checked=s)}const JA={created(e,{value:t},n){e.checked=sa(t,n.props.value),e[_r]=Ya(n),Yl(e,"change",()=>{e[_r](Qd(e))})},beforeUpdate(e,{value:t,oldValue:n},o){e[_r]=Ya(o),t!==n&&(e.checked=sa(t,o.props.value))}},V4={deep:!0,created(e,{value:t,modifiers:{number:n}},o){const s=Ac(t);Yl(e,"change",()=>{const i=Array.prototype.filter.call(e.options,r=>r.selected).map(r=>n?jg(Qd(r)):Qd(r));e[_r](e.multiple?s?new Set(i):i:i[0]),e._assigning=!0,yt(()=>{e._assigning=!1})}),e[_r]=Ya(o)},mounted(e,{value:t}){nk(e,t)},beforeUpdate(e,t,n){e[_r]=Ya(n)},updated(e,{value:t}){e._assigning||nk(e,t)}};function nk(e,t){const n=e.multiple,o=jt(t);if(!(n&&!o&&!Ac(t))){for(let s=0,i=e.options.length;sString(u)===String(l)):r.selected=qg(t,l)>-1}else r.selected=t.has(l);else if(sa(Qd(r),t)){e.selectedIndex!==s&&(e.selectedIndex=s);return}}!n&&e.selectedIndex!==-1&&(e.selectedIndex=-1)}}function Qd(e){return"_value"in e?e._value:e.value}function QA(e,t){const n=t?"_trueValue":"_falseValue";return n in e?e[n]:t}const iD={created(e,t,n){V0(e,t,n,null,"created")},mounted(e,t,n){V0(e,t,n,null,"mounted")},beforeUpdate(e,t,n,o){V0(e,t,n,o,"beforeUpdate")},updated(e,t,n,o){V0(e,t,n,o,"updated")}};function eM(e,t){switch(e){case"SELECT":return V4;case"TEXTAREA":return ai;default:switch(t){case"checkbox":return Em;case"radio":return JA;default:return ai}}}function V0(e,t,n,o,s){const r=eM(e.tagName,n.props&&n.props.type)[s];r&&r(e,t,n,o)}function rD(){ai.getSSRProps=({value:e})=>({value:e}),JA.getSSRProps=({value:e},t)=>{if(t.props&&sa(t.props.value,e))return{checked:!0}},Em.getSSRProps=({value:e},t)=>{if(jt(e)){if(t.props&&qg(e,t.props.value)>-1)return{checked:!0}}else if(Ac(e)){if(t.props&&e.has(t.props.value))return{checked:!0}}else if(e)return{checked:!0}},iD.getSSRProps=(e,t)=>{if(typeof t.type!="string")return;const n=eM(t.type.toUpperCase(),t.props&&t.props.type);if(n.getSSRProps)return n.getSSRProps(e,t)}}const lD=["ctrl","shift","alt","meta"],aD={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>"button"in e&&e.button!==0,middle:e=>"button"in e&&e.button!==1,right:e=>"button"in e&&e.button!==2,exact:(e,t)=>lD.some(n=>e[`${n}Key`]&&!t.includes(n))},It=(e,t)=>{if(!e)return e;const n=e._withMods||(e._withMods={}),o=t.join(".");return n[o]||(n[o]=((s,...i)=>{for(let r=0;r{const n=e._withKeys||(e._withKeys={}),o=t.join(".");return n[o]||(n[o]=(s=>{if(!("key"in s))return;const i=Bi(s.key);if(t.some(r=>r===i||uD[r]===i))return e(s)}))},tM=to({patchProp:qP},TP);let Of,ok=!1;function nM(){return Of||(Of=aP(tM))}function oM(){return Of=ok?Of:uP(tM),ok=!0,Of}const cD=((...e)=>{nM().render(...e)}),kVe=((...e)=>{oM().hydrate(...e)}),Im=((...e)=>{const t=nM().createApp(...e),{mount:n}=t;return t.mount=o=>{const s=iM(o);if(!s)return;const i=t._component;!un(i)&&!i.render&&!i.template&&(i.template=s.innerHTML),s.nodeType===1&&(s.textContent="");const r=n(s,!1,sM(s));return s instanceof Element&&(s.removeAttribute("v-cloak"),s.setAttribute("data-v-app","")),r},t}),dD=((...e)=>{const t=oM().createApp(...e),{mount:n}=t;return t.mount=o=>{const s=iM(o);if(s)return n(s,!0,sM(s))},t});function sM(e){if(e instanceof SVGElement)return"svg";if(typeof MathMLElement=="function"&&e instanceof MathMLElement)return"mathml"}function iM(e){return ro(e)?document.querySelector(e):e}let sk=!1;const bVe=()=>{sk||(sk=!0,rD(),NP())};/*! + * shared v11.4.6 + * (c) 2026 kazuya kawaguchi + * Released under the MIT License. + */function fD(e,t){typeof console<"u"&&(console.warn("[intlify] "+e),t&&console.warn(t.stack))}const Lm=typeof window<"u",ru=(e,t=!1)=>t?Symbol.for(e):Symbol(e),pD=(e,t,n)=>hD({l:e,k:t,s:n}),hD=e=>JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),ls=e=>typeof e=="number"&&isFinite(e),rM=e=>G8(e)==="[object Date]",e1=e=>G8(e)==="[object RegExp]",o2=e=>$n(e)&&Object.keys(e).length===0,us=Object.assign,mD=Object.create,io=(e=null)=>mD(e);let ik;const Xu=()=>ik||(ik=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:io());function rk(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function gD(e){return e.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(//g,">")}const vD=/^\s*javascript\s*(?::|�*58;?|�*3a;?|:?)/i,yD=/^(?:href|src|action|formaction)$/i;function Z8(e){return vD.test(e)}function kD(e){const t=/url\s*\(/gi;let n="",o=0,s;for(;(s=t.exec(e))!==null;){const i=s.index,r=t.lastIndex-1;let l=r+1,a=1,u=null;for(;l`${o}="${lk(o,s)}"`),e=e.replace(/([\w:-]+)\s*=\s*'([^']*)'/g,(n,o,s)=>`${o}='${lk(o,s)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(e)&&(e=e.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),e=e.replace(/(\s+(?:href|src|action|formaction)\s*=\s*)([^\s"'=<>`]+)/gi,(n,o,s)=>Z8(s)?`${o}about:blank`:n),e}const CD=Object.prototype.hasOwnProperty;function br(e,t){return CD.call(e,t)}const Uo=Array.isArray,xo=e=>typeof e=="function",zt=e=>typeof e=="string",Un=e=>typeof e=="boolean",qn=e=>e!==null&&typeof e=="object",wD=e=>qn(e)&&xo(e.then)&&xo(e.catch),lM=Object.prototype.toString,G8=e=>lM.call(e),$n=e=>G8(e)==="[object Object]",_D=e=>e==null?"":Uo(e)||$n(e)&&e.toString===lM?JSON.stringify(e,null,2):String(e);function Y8(e,t=""){return e.reduce((n,o,s)=>s===0?n+o:n+t+o,"")}const q0=e=>!qn(e)||Uo(e);function Bh(e,t){if(q0(e)||q0(t))throw new Error("Invalid value");const n=[{src:e,des:t}];for(;n.length;){const{src:o,des:s}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(qn(o[i])&&!qn(s[i])&&(s[i]=Array.isArray(o[i])?[]:io()),q0(s[i])||q0(o[i])?s[i]=o[i]:n.push({src:o[i],des:s[i]}))})}}/*! + * message-compiler v11.4.6 + * (c) 2026 kazuya kawaguchi + * Released under the MIT License. + */function xD(e,t,n){return{line:e,column:t,offset:n}}function q4(e,t,n){return{start:e,end:t}}const Xn={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14},SD=17;function s2(e,t,n={}){const{domain:o,messages:s,args:i}=n,r=e,l=new SyntaxError(String(r));return l.code=e,t&&(l.location=t),l.domain=o,l}function AD(e){throw e}const rl=" ",MD="\r",ni=` +`,TD="\u2028",ED="\u2029";function ID(e){const t=e;let n=0,o=1,s=1,i=0;const r=T=>t[T]===MD&&t[T+1]===ni,l=T=>t[T]===ni,a=T=>t[T]===ED,u=T=>t[T]===TD,c=T=>r(T)||l(T)||a(T)||u(T),d=()=>n,f=()=>o,h=()=>s,m=()=>i,v=T=>r(T)||a(T)||u(T)?ni:t[T],k=()=>v(n),w=()=>v(n+i);function b(){return i=0,c(n)&&(o++,s=0),r(n)&&n++,n++,s++,t[n]}function _(){return r(n+i)&&i++,i++,t[n+i]}function g(){n=0,o=1,s=1,i=0}function x(T=0){i=T}function S(){const T=n+i;for(;T!==n;)b();i=0}return{index:d,line:f,column:h,peekOffset:m,charAt:v,currentChar:k,currentPeek:w,next:b,peek:_,reset:g,resetPeek:x,skipToPeek:S}}const zl=void 0,LD=".",ak="'",$D="tokenizer";function ND(e,t={}){const n=t.location!==!1,o=ID(e),s=()=>o.index(),i=()=>xD(o.line(),o.column(),o.index()),r=i(),l=s(),a={currentType:13,offset:l,startLoc:r,endLoc:r,lastType:13,lastOffset:l,lastStartLoc:r,lastEndLoc:r,braceNest:0,inLinked:!1,text:""},u=()=>a,{onError:c}=t;function d(Q,te,ce,...ue){const Se=u();if(te.column+=ce,te.offset+=ce,c){const ze=n?q4(Se.startLoc,te):null,_e=s2(Q,ze,{domain:$D,args:ue});c(_e)}}function f(Q,te,ce){Q.endLoc=i(),Q.currentType=te;const ue={type:te};return n&&(ue.loc=q4(Q.startLoc,Q.endLoc)),ce!=null&&(ue.value=ce),ue}const h=Q=>f(Q,13);function m(Q,te){return Q.currentChar()===te?(Q.next(),te):(d(Xn.EXPECTED_TOKEN,i(),0,te),"")}function v(Q){let te="";for(;Q.currentPeek()===rl||Q.currentPeek()===ni;)te+=Q.currentPeek(),Q.peek();return te}function k(Q){const te=v(Q);return Q.skipToPeek(),te}function w(Q){if(Q===zl)return!1;const te=Q.charCodeAt(0);return te>=97&&te<=122||te>=65&&te<=90||te===95}function b(Q){if(Q===zl)return!1;const te=Q.charCodeAt(0);return te>=48&&te<=57}function _(Q,te){const{currentType:ce}=te;if(ce!==2)return!1;v(Q);const ue=w(Q.currentPeek());return Q.resetPeek(),ue}function g(Q,te){const{currentType:ce}=te;if(ce!==2)return!1;v(Q);const ue=Q.currentPeek()==="-"?Q.peek():Q.currentPeek(),Se=b(ue);return Q.resetPeek(),Se}function x(Q,te){const{currentType:ce}=te;if(ce!==2)return!1;v(Q);const ue=Q.currentPeek()===ak;return Q.resetPeek(),ue}function S(Q,te){const{currentType:ce}=te;if(ce!==7)return!1;v(Q);const ue=Q.currentPeek()===".";return Q.resetPeek(),ue}function T(Q,te){const{currentType:ce}=te;if(ce!==8)return!1;v(Q);const ue=w(Q.currentPeek());return Q.resetPeek(),ue}function A(Q,te){const{currentType:ce}=te;if(!(ce===7||ce===11))return!1;v(Q);const ue=Q.currentPeek()===":";return Q.resetPeek(),ue}function E(Q,te){const{currentType:ce}=te;if(ce!==9)return!1;const ue=()=>{const ze=Q.currentPeek();return ze==="{"?w(Q.peek()):ze==="@"||ze==="|"||ze===":"||ze==="."||ze===rl||!ze?!1:ze===ni?(Q.peek(),ue()):D(Q,!1)},Se=ue();return Q.resetPeek(),Se}function P(Q){v(Q);const te=Q.currentPeek()==="|";return Q.resetPeek(),te}function D(Q,te=!0){const ce=(Se=!1,ze="")=>{const _e=Q.currentPeek();return _e==="{"||_e==="@"||!_e?Se:_e==="|"?!(ze===rl||ze===ni):_e===rl?(Q.peek(),ce(!0,rl)):_e===ni?(Q.peek(),ce(!0,ni)):!0},ue=ce();return te&&Q.resetPeek(),ue}function I(Q,te){const ce=Q.currentChar();return ce===zl?zl:te(ce)?(Q.next(),ce):null}function $(Q){const te=Q.charCodeAt(0);return te>=97&&te<=122||te>=65&&te<=90||te>=48&&te<=57||te===95||te===36}function B(Q){return I(Q,$)}function H(Q){const te=Q.charCodeAt(0);return te>=97&&te<=122||te>=65&&te<=90||te>=48&&te<=57||te===95||te===36||te===45}function O(Q){return I(Q,H)}function F(Q){const te=Q.charCodeAt(0);return te>=48&&te<=57}function U(Q){return I(Q,F)}function z(Q){const te=Q.charCodeAt(0);return te>=48&&te<=57||te>=65&&te<=70||te>=97&&te<=102}function W(Q){return I(Q,z)}function K(Q){let te="",ce="";for(;te=U(Q);)ce+=te;return ce}function V(Q){let te="";for(;;){const ce=Q.currentChar();if(ce==="\\"){const ue=Q.peek();ue==="{"||ue==="}"||ue==="@"||ue==="|"||ue==="\\"?(te+=ce+ue,Q.next(),Q.next()):(Q.resetPeek(),te+=ce,Q.next())}else{if(ce==="{"||ce==="}"||ce==="@"||ce==="|"||!ce)break;if(ce===rl||ce===ni)if(D(Q))te+=ce,Q.next();else{if(P(Q))break;te+=ce,Q.next()}else te+=ce,Q.next()}}return te}function ie(Q){k(Q);let te="",ce="";for(;te=O(Q);)ce+=te;const ue=Q.currentChar();if(ue&&ue!=="}"&&ue!==zl&&ue!==rl&&ue!==ni&&ue!==" "){const Se=ve(Q);return d(Xn.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,ce+Se),ce+Se}return Q.currentChar()===zl&&d(Xn.UNTERMINATED_CLOSING_BRACE,i(),0),ce}function ne(Q){k(Q);let te="";return Q.currentChar()==="-"?(Q.next(),te+=`-${K(Q)}`):te+=K(Q),Q.currentChar()===zl&&d(Xn.UNTERMINATED_CLOSING_BRACE,i(),0),te}function X(Q){return Q!==ak&&Q!==ni}function le(Q){k(Q),m(Q,"'");let te="",ce="";for(;te=I(Q,X);)te==="\\"?ce+=Ie(Q):ce+=te;const ue=Q.currentChar();return ue===ni||ue===zl?(d(Xn.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),ue===ni&&(Q.next(),m(Q,"'")),ce):(m(Q,"'"),ce)}function Ie(Q){const te=Q.currentChar();switch(te){case"\\":case"'":return Q.next(),`\\${te}`;case"u":return de(Q,te,4);case"U":return de(Q,te,6);default:return d(Xn.UNKNOWN_ESCAPE_SEQUENCE,i(),0,te),""}}function de(Q,te,ce){m(Q,te);let ue="";for(let Se=0;Se{const ue=Q.currentChar();return ue==="{"||ue==="@"||ue==="|"||ue==="("||ue===")"||!ue||ue===rl?ce:(ce+=ue,Q.next(),te(ce))};return te("")}function G(Q){k(Q);const te=m(Q,"|");return k(Q),te}function Y(Q,te){let ce=null;switch(Q.currentChar()){case"{":return te.braceNest>=1&&d(Xn.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),Q.next(),ce=f(te,2,"{"),k(Q),te.braceNest++,ce;case"}":return te.braceNest>0&&te.currentType===2&&d(Xn.EMPTY_PLACEHOLDER,i(),0),Q.next(),ce=f(te,3,"}"),te.braceNest--,te.braceNest>0&&k(Q),te.inLinked&&te.braceNest===0&&(te.inLinked=!1),ce;case"@":return te.braceNest>0&&d(Xn.UNTERMINATED_CLOSING_BRACE,i(),0),ce=fe(Q,te)||h(te),te.braceNest=0,ce;default:{let Se=!0,ze=!0,_e=!0;if(P(Q))return te.braceNest>0&&d(Xn.UNTERMINATED_CLOSING_BRACE,i(),0),ce=f(te,1,G(Q)),te.braceNest=0,te.inLinked=!1,ce;if(te.braceNest>0&&(te.currentType===4||te.currentType===5||te.currentType===6))return d(Xn.UNTERMINATED_CLOSING_BRACE,i(),0),te.braceNest=0,we(Q,te);if(Se=_(Q,te))return ce=f(te,4,ie(Q)),k(Q),ce;if(ze=g(Q,te))return ce=f(te,5,ne(Q)),k(Q),ce;if(_e=x(Q,te))return ce=f(te,6,le(Q)),k(Q),ce;if(!Se&&!ze&&!_e)return ce=f(te,12,ve(Q)),d(Xn.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,ce.value),k(Q),ce;break}}return ce}function fe(Q,te){const{currentType:ce}=te;let ue=null;const Se=Q.currentChar();switch((ce===7||ce===8||ce===11||ce===9)&&(Se===ni||Se===rl)&&d(Xn.INVALID_LINKED_FORMAT,i(),0),Se){case"@":return Q.next(),ue=f(te,7,"@"),te.inLinked=!0,ue;case".":return k(Q),Q.next(),f(te,8,".");case":":return k(Q),Q.next(),f(te,9,":");default:return P(Q)?(ue=f(te,1,G(Q)),te.braceNest=0,te.inLinked=!1,ue):S(Q,te)||A(Q,te)?(k(Q),fe(Q,te)):T(Q,te)?(k(Q),f(te,11,oe(Q))):E(Q,te)?(k(Q),Se==="{"?Y(Q,te)||ue:f(te,10,ye(Q))):(ce===7&&d(Xn.INVALID_LINKED_FORMAT,i(),0),te.braceNest=0,te.inLinked=!1,we(Q,te))}}function we(Q,te){let ce={type:13};if(te.braceNest>0)return Y(Q,te)||h(te);if(te.inLinked)return fe(Q,te)||h(te);switch(Q.currentChar()){case"{":return Y(Q,te)||h(te);case"}":return d(Xn.UNBALANCED_CLOSING_BRACE,i(),0),Q.next(),f(te,3,"}");case"@":return fe(Q,te)||h(te);default:{if(P(Q))return ce=f(te,1,G(Q)),te.braceNest=0,te.inLinked=!1,ce;if(D(Q))return f(te,0,V(Q));break}}return ce}function ge(){const{currentType:Q,offset:te,startLoc:ce,endLoc:ue}=a;return a.lastType=Q,a.lastOffset=te,a.lastStartLoc=ce,a.lastEndLoc=ue,a.offset=s(),a.startLoc=i(),o.currentChar()===zl?f(a,13):we(o,a)}return{nextToken:ge,currentOffset:s,currentPosition:i,context:u}}const FD="parser",RD=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g,OD=/\\([\\@{}|])/g;function PD(e,t){return t}function DD(e,t,n){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(t||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function BD(e={}){const t=e.location!==!1,{onError:n}=e;function o(w,b,_,g,...x){const S=w.currentPosition();if(S.offset+=g,S.column+=g,n){const T=t?q4(_,S):null,A=s2(b,T,{domain:FD,args:x});n(A)}}function s(w,b,_){const g={type:w};return t&&(g.start=b,g.end=b,g.loc={start:_,end:_}),g}function i(w,b,_,g){t&&(w.end=b,w.loc&&(w.loc.end=_))}function r(w,b){const _=w.context(),g=s(3,_.offset,_.startLoc);return g.value=b.replace(OD,PD),i(g,w.currentOffset(),w.currentPosition()),g}function l(w,b){const _=w.context(),{lastOffset:g,lastStartLoc:x}=_,S=s(5,g,x);return S.index=parseInt(b,10),w.nextToken(),i(S,w.currentOffset(),w.currentPosition()),S}function a(w,b){const _=w.context(),{lastOffset:g,lastStartLoc:x}=_,S=s(4,g,x);return S.key=b,w.nextToken(),i(S,w.currentOffset(),w.currentPosition()),S}function u(w,b){const _=w.context(),{lastOffset:g,lastStartLoc:x}=_,S=s(9,g,x);return S.value=b.replace(RD,DD),w.nextToken(),i(S,w.currentOffset(),w.currentPosition()),S}function c(w){const b=w.nextToken(),_=w.context(),{lastOffset:g,lastStartLoc:x}=_,S=s(8,g,x);return b.type!==11?(o(w,Xn.UNEXPECTED_EMPTY_LINKED_MODIFIER,_.lastStartLoc,0),S.value="",i(S,g,x),{nextConsumeToken:b,node:S}):(b.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,_.lastStartLoc,0,ll(b)),S.value=b.value||"",i(S,w.currentOffset(),w.currentPosition()),{node:S})}function d(w,b){const _=w.context(),g=s(7,_.offset,_.startLoc);return g.value=b,i(g,w.currentOffset(),w.currentPosition()),g}function f(w){const b=w.context(),_=s(6,b.offset,b.startLoc);let g=w.nextToken();if(g.type===8){const x=c(w);_.modifier=x.node,g=x.nextConsumeToken||w.nextToken()}switch(g.type!==9&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(g)),g=w.nextToken(),g.type===2&&(g=w.nextToken()),g.type){case 10:g.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(g)),_.key=d(w,g.value||"");break;case 4:g.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(g)),_.key=a(w,g.value||"");break;case 5:g.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(g)),_.key=l(w,g.value||"");break;case 6:g.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(g)),_.key=u(w,g.value||"");break;default:{o(w,Xn.UNEXPECTED_EMPTY_LINKED_KEY,b.lastStartLoc,0);const x=w.context(),S=s(7,x.offset,x.startLoc);return S.value="",i(S,x.offset,x.startLoc),_.key=S,i(_,x.offset,x.startLoc),{nextConsumeToken:g,node:_}}}return i(_,w.currentOffset(),w.currentPosition()),{node:_}}function h(w){const b=w.context(),_=b.currentType===1?w.currentOffset():b.offset,g=b.currentType===1?b.endLoc:b.startLoc,x=s(2,_,g);x.items=[];let S=null;do{const E=S||w.nextToken();switch(S=null,E.type){case 0:E.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(E)),x.items.push(r(w,E.value||""));break;case 5:E.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(E)),x.items.push(l(w,E.value||""));break;case 4:E.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(E)),x.items.push(a(w,E.value||""));break;case 6:E.value==null&&o(w,Xn.UNEXPECTED_LEXICAL_ANALYSIS,b.lastStartLoc,0,ll(E)),x.items.push(u(w,E.value||""));break;case 7:{const P=f(w);x.items.push(P.node),S=P.nextConsumeToken||null;break}}}while(b.currentType!==13&&b.currentType!==1);const T=b.currentType===1?b.lastOffset:w.currentOffset(),A=b.currentType===1?b.lastEndLoc:w.currentPosition();return i(x,T,A),x}function m(w,b,_,g){const x=w.context();let S=g.items.length===0;const T=s(1,b,_);T.cases=[],T.cases.push(g);do{const A=h(w);S||(S=A.items.length===0),T.cases.push(A)}while(x.currentType!==13);return S&&o(w,Xn.MUST_HAVE_MESSAGES_IN_PLURAL,_,0),i(T,w.currentOffset(),w.currentPosition()),T}function v(w){const b=w.context(),{offset:_,startLoc:g}=b,x=h(w);return b.currentType===13?x:m(w,_,g,x)}function k(w){const b=ND(w,us({},e)),_=b.context(),g=s(0,_.offset,_.startLoc);return t&&g.loc&&(g.loc.source=w),g.body=v(b),e.onCacheKey&&(g.cacheKey=e.onCacheKey(w)),_.currentType!==13&&o(b,Xn.UNEXPECTED_LEXICAL_ANALYSIS,_.lastStartLoc,0,w[_.offset]||""),i(g,b.currentOffset(),b.currentPosition()),g}return{parse:k}}function ll(e){if(e.type===13)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function HD(e,t={}){const n={ast:e,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function uk(e,t){for(let n=0;nck(n)),e}function ck(e){if(e.items.length===1){const t=e.items[0];(t.type===3||t.type===9)&&(e.static=t.value,delete t.value)}else{const t=[];for(let n=0;nr;function a(v,k){r.code+=v}function u(v,k=!0){const w=k?o:"";a(s?w+" ".repeat(v):w)}function c(v=!0){const k=++r.indentLevel;v&&u(k)}function d(v=!0){const k=--r.indentLevel;v&&u(k)}function f(){u(r.indentLevel)}return{context:l,push:a,indent:c,deindent:d,newline:f,helper:v=>`_${v}`,needIndent:()=>r.needIndent}}function jD(e,t){const{helper:n}=e;e.push(`${n("linked")}(`),t1(e,t.key),t.modifier?(e.push(", "),t1(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function VD(e,t){const{helper:n,needIndent:o}=e;e.push(`${n("normalize")}([`),e.indent(o());const s=t.items.length;for(let i=0;i1){e.push(`${n("plural")}([`),e.indent(o());const s=t.cases.length;for(let i=0;i{const n=zt(t.mode)?t.mode:"normal",o=zt(t.filename)?t.filename:"message.intl";t.sourceMap;const s=t.breakLineCode!=null?t.breakLineCode:n==="arrow"?";":` +`,i=t.needIndent?t.needIndent:n!=="arrow",r=e.helpers||[],l=UD(e,{filename:o,breakLineCode:s,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),r.length>0&&(l.push(`const { ${Y8(r.map(c=>`${c}: _${c}`),", ")} } = ctx`),l.newline()),l.push("return "),t1(l,e),l.deindent(i),l.push("}"),delete e.helpers;const{code:a,map:u}=l.context();return{ast:e,code:a,map:u?u.toJSON():void 0}};function GD(e,t={}){const n=us({},t),o=!!n.jit,s=!!n.minify,i=n.optimize==null?!0:n.optimize,l=BD(n).parse(e);return o?(i&&WD(l),s&&pd(l),{ast:l,code:""}):(zD(l,n),ZD(l,n))}/*! + * core-base v11.4.6 + * (c) 2026 kazuya kawaguchi + * Released under the MIT License. + */function YD(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Xu().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Xu().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function bl(e){return qn(e)&&J8(e)===0&&(br(e,"b")||br(e,"body"))}const aM=["b","body"];function XD(e){return lu(e,aM)}const uM=["c","cases"];function JD(e){return lu(e,uM,[])}const cM=["s","static"];function QD(e){return lu(e,cM)}const dM=["i","items"];function eB(e){return lu(e,dM,[])}const fM=["t","type"];function J8(e){return lu(e,fM)}const pM=["v","value"];function K0(e,t){const n=lu(e,pM);if(n!=null)return n;throw pp(t)}const hM=["m","modifier"];function tB(e){return lu(e,hM)}const mM=["k","key"];function nB(e){const t=lu(e,mM);if(t)return t;throw pp(6)}function lu(e,t,n){for(let o=0;ooB(n,e)}function oB(e,t){const n=XD(t);if(n==null)throw pp(0);if(J8(n)===1){const i=JD(n);return e.plural(i.reduce((r,l)=>[...r,dk(e,l)],[]))}else return dk(e,n)}function dk(e,t){const n=QD(t);if(n!=null)return e.type==="text"?n:e.normalize([n]);{const o=eB(t).reduce((s,i)=>[...s,K4(e,i)],[]);return e.normalize(o)}}function K4(e,t){const n=J8(t);switch(n){case 3:return K0(t,n);case 9:return K0(t,n);case 4:{const o=t;if(br(o,"k")&&o.k)return e.interpolate(e.named(o.k));if(br(o,"key")&&o.key)return e.interpolate(e.named(o.key));throw pp(n)}case 5:{const o=t;if(br(o,"i")&&ls(o.i))return e.interpolate(e.list(o.i));if(br(o,"index")&&ls(o.index))return e.interpolate(e.list(o.index));throw pp(n)}case 6:{const o=t,s=tB(o),i=nB(o);return e.linked(K4(e,i),s?K4(e,s):void 0,e.type)}case 7:return K0(t,n);case 8:return K0(t,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const sB=e=>e;let Z0=io();function iB(e,t={}){let n=!1;const o=t.onError||AD;return t.onError=s=>{n=!0,o(s)},{...GD(e,t),detectError:n}}function rB(e,t){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&zt(e)){Un(t.warnHtmlMessage)&&t.warnHtmlMessage;const o=(t.onCacheKey||sB)(e),s=Z0[o];if(s)return s;const{ast:i,detectError:r}=iB(e,{...t,location:!1,jit:!0}),l=Gv(i);return r?l:Z0[o]=l}else{const n=e.cacheKey;if(n){const o=Z0[n];return o||(Z0[n]=Gv(e))}else return Gv(e)}}let hp=null;function lB(e){hp=e}function aB(e,t,n){hp&&hp.emit("i18n:init",{timestamp:Date.now(),i18n:e,version:t,meta:n})}const uB=cB("function:translate");function cB(e){return t=>hp&&hp.emit(e,t)}const Jl={INVALID_ARGUMENT:SD,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},dB=24;function Ql(e){return s2(e,null,void 0)}function Q8(e,t){return t.locale!=null?fk(t.locale):fk(e.locale)}let Yv;function fk(e){if(zt(e))return e;if(xo(e)){if(e.resolvedOnce&&Yv!=null)return Yv;if(e.constructor.name==="Function"){const t=e();if(wD(t))throw Ql(Jl.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Yv=t}else throw Ql(Jl.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Ql(Jl.NOT_SUPPORT_LOCALE_TYPE)}function fB(e,t,n){return[...new Set([n,...Uo(t)?t:qn(t)?Object.keys(t):zt(t)?[t]:[n]])]}function Z4(e,t,n){const o=zt(n)?n:mp,s=e;s.__localeChainCache||(s.__localeChainCache=new Map);let i=s.__localeChainCache.get(o);if(!i){i=[];let r=[n];for(;Uo(r);)r=pk(i,r,t);const l=Uo(t)||!$n(t)?t:t.default?t.default:null;r=zt(l)?[l]:l,Uo(r)&&pk(i,r,!1),s.__localeChainCache.set(o,i)}return i}function pk(e,t,n){let o=!0;for(let s=0;s{r===void 0?r=l:r+=l},f[1]=()=>{r!==void 0&&(t.push(r),r=void 0)},f[2]=()=>{f[0](),s++},f[3]=()=>{if(s>0)s--,o=4,f[0]();else{if(s=0,r===void 0||(r=kB(r),r===!1))return!1;f[1]()}};function h(){const m=e[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,f[0](),!0}for(;o!==null;)if(n++,i=e[n],!(i==="\\"&&h())){if(a=yB(i),d=au[o],u=d[a]||d.l||8,u===8||(o=u[0],u[1]!==void 0&&(c=f[u[1]],c&&(l=i,c()===!1))))return;if(o===7)return t}}const hk=new Map;function CB(e,t){return qn(e)?e[t]:null}function wB(e,t){if(!qn(e))return null;let n=hk.get(t);if(n||(n=bB(t),n&&hk.set(t,n)),!n)return null;const o=n.length;let s=e,i=0;for(;i`${e.charAt(0).toLocaleUpperCase()}${e.substr(1)}`;function xB(){return{upper:(e,t)=>t==="text"&&zt(e)?e.toUpperCase():t==="vnode"&&qn(e)&&"__v_isVNode"in e?e.children.toUpperCase():e,lower:(e,t)=>t==="text"&&zt(e)?e.toLowerCase():t==="vnode"&&qn(e)&&"__v_isVNode"in e?e.children.toLowerCase():e,capitalize:(e,t)=>t==="text"&&zt(e)?mk(e):t==="vnode"&&qn(e)&&"__v_isVNode"in e?mk(e.children):e}}let vM;function SB(e){vM=e}let yM;function AB(e){yM=e}let kM;function MB(e){kM=e}let bM=null;const TB=e=>{bM=e},EB=()=>bM;let CM=null;const gk=e=>{CM=e},IB=()=>CM;let vk=0;function LB(e={}){const t=xo(e.onWarn)?e.onWarn:fD,n=zt(e.version)?e.version:_B,o=zt(e.locale)||xo(e.locale)?e.locale:mp,s=xo(o)?mp:o,i=Uo(e.fallbackLocale)||$n(e.fallbackLocale)||zt(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:s,r=$n(e.messages)?e.messages:Xv(s),l=$n(e.datetimeFormats)?e.datetimeFormats:Xv(s),a=$n(e.numberFormats)?e.numberFormats:Xv(s),u=us(io(),e.modifiers,xB()),c=e.pluralRules||io(),d=xo(e.missing)?e.missing:null,f=Un(e.missingWarn)||e1(e.missingWarn)?e.missingWarn:!0,h=Un(e.fallbackWarn)||e1(e.fallbackWarn)?e.fallbackWarn:!0,m=!!e.fallbackFormat,v=!!e.unresolving,k=xo(e.postTranslation)?e.postTranslation:null,w=$n(e.processor)?e.processor:null,b=Un(e.warnHtmlMessage)?e.warnHtmlMessage:!0,_=!!e.escapeParameter,g=xo(e.messageCompiler)?e.messageCompiler:vM,x=xo(e.messageResolver)?e.messageResolver:yM||CB,S=xo(e.localeFallbacker)?e.localeFallbacker:kM||fB,T=qn(e.fallbackContext)?e.fallbackContext:void 0,A=e,E=qn(A.__datetimeFormatters)?A.__datetimeFormatters:new Map,P=qn(A.__numberFormatters)?A.__numberFormatters:new Map,D=qn(A.__meta)?A.__meta:{};vk++;const I={version:n,cid:vk,locale:o,fallbackLocale:i,messages:r,modifiers:u,pluralRules:c,missing:d,missingWarn:f,fallbackWarn:h,fallbackFormat:m,unresolving:v,postTranslation:k,processor:w,warnHtmlMessage:b,escapeParameter:_,messageCompiler:g,messageResolver:x,localeFallbacker:S,fallbackContext:T,onWarn:t,__meta:D};return I.datetimeFormats=l,I.numberFormats=a,I.__datetimeFormatters=E,I.__numberFormatters=P,__INTLIFY_PROD_DEVTOOLS__&&aB(I,n,D),I}const Xv=e=>({[e]:io()});function ey(e,t,n,o,s){const{missing:i,onWarn:r}=e;if(i!==null){const l=i(e,n,t,s);return zt(l)?l:t}else return t}function Q1(e,t,n){const o=e;o.__localeChainCache=new Map,e.localeFallbacker(e,n,t)}function $B(e,t){return e===t?!1:e.split("-")[0]===t.split("-")[0]}function NB(e,t){const n=t.indexOf(e);if(n===-1)return!1;for(let o=n+1;o{wM.includes(a)?r[a]=n[a]:i[a]=n[a]}),zt(o)?i.locale=o:$n(o)&&(r=o),$n(s)&&(r=s),[i.key||"",l,i,r]}function kk(e,t,n){const o=e;for(const s in n){const i=`${t}__${s}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function bk(e,...t){const{numberFormats:n,unresolving:o,fallbackLocale:s,onWarn:i,localeFallbacker:r}=e,{__numberFormatters:l}=e;if(!ls(t[0]))return $m;const[a,u,c,d]=Y4(...t),f=Un(c.missingWarn)?c.missingWarn:e.missingWarn;Un(c.fallbackWarn)?c.fallbackWarn:e.fallbackWarn;const h=!!c.part,m=Q8(e,c),v=r(e,s,m);if(!zt(a)||a===""){const S=new Intl.NumberFormat(m.replace(/!/g,""),d);return h?S.formatToParts(u):S.format(u)}let k={},w,b=null;const _="number format";for(let S=0;S{_M.includes(a)?r[a]=n[a]:i[a]=n[a]}),zt(o)?i.locale=o:$n(o)&&(r=o),$n(s)&&(r=s),[i.key||"",l,i,r]}function Ck(e,t,n){const o=e;for(const s in n){const i=`${t}__${s}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}const FB=e=>e,RB=e=>"",OB="text",PB=e=>e.length===0?"":Y8(e),DB=_D;function Jv(e,t){return e=Math.abs(e),t===2?e===1?0:1:Math.min(e,2)}function BB(e){const t=ls(e.pluralIndex)?e.pluralIndex:-1;return ls(e.named?.count)?e.named.count:ls(e.named?.n)?e.named.n:t}function HB(e={}){const t=e.locale,n=BB(e),o=zt(t)&&xo(e.pluralRules?.[t])?e.pluralRules[t]:Jv,s=o===Jv?void 0:Jv,i=w=>w[o(n,w.length,s)],r=e.list||[],l=w=>r[w],a=e.named||io();ls(e.pluralIndex)&&(a.count||=e.pluralIndex,a.n||=e.pluralIndex);const u=w=>a[w];function c(w,b){const _=xo(e.messages)?e.messages(w,!!b):qn(e.messages)?e.messages[w]:!1;return _||(e.parent?e.parent.message(w):RB)}const d=w=>e.modifiers?e.modifiers[w]:FB,f=xo(e.processor?.normalize)?e.processor.normalize:PB,h=xo(e.processor?.interpolate)?e.processor.interpolate:DB,m=zt(e.processor?.type)?e.processor.type:OB,k={list:l,named:u,plural:i,linked:(w,...b)=>{const[_,g]=b;let x="text",S="";b.length===1?qn(_)?(S=_.modifier||S,x=_.type||x):zt(_)&&(S=_||S):b.length===2&&(zt(_)&&(S=_||S),zt(g)&&(x=g||x));const T=c(w,!0)(k),A=T===""||T===void 0?w:T,E=x==="vnode"&&Uo(A)&&S?A[0]:A;return S?d(S)(E,x):E},message:c,type:m,interpolate:h,normalize:f,values:us(io(),r,a)};return k}const wk=()=>"",kr=e=>xo(e);function _k(e,...t){const{fallbackFormat:n,postTranslation:o,unresolving:s,messageCompiler:i,fallbackLocale:r,messages:l}=e,[a,u]=X4(...t),c=Un(u.missingWarn)?u.missingWarn:e.missingWarn,d=Un(u.fallbackWarn)?u.fallbackWarn:e.fallbackWarn,f=Un(u.escapeParameter)?u.escapeParameter:e.escapeParameter,h=!!u.resolvedMessage,m=zt(u.default)||Un(u.default)?Un(u.default)?i?a:()=>a:u.default:n?i?a:()=>a:null,v=n||m!=null&&(zt(m)||xo(m)),k=Q8(e,u);f&&zB(u);let[w,b,_]=h?[a,k,l[k]||io()]:xM(e,a,k,r,d,c),g=w,x=a;if(!h&&!(zt(g)||bl(g)||kr(g))&&v&&(g=m,x=g),!h&&(!(zt(g)||bl(g)||kr(g))||!zt(b)))return s?i2:a;let S=!1;const T=()=>{S=!0},A=kr(g)?g:SM(e,a,b,g,x,T);if(S)return g;const E=jB(e,b,_,u),P=HB(E),D=WB(e,A,P);let I=o?o(D,a):D;if(f&&zt(I)&&(I=bD(I)),__INTLIFY_PROD_DEVTOOLS__){const $={timestamp:Date.now(),key:zt(a)?a:kr(g)?g.key:"",locale:b||(kr(g)?g.locale:""),format:zt(g)?g:kr(g)?g.source:"",message:I};$.meta=us({},e.__meta,EB()||{}),uB($)}return I}function zB(e){Uo(e.list)?e.list=e.list.map(t=>zt(t)?rk(t):t):qn(e.named)&&Object.keys(e.named).forEach(t=>{zt(e.named[t])&&(e.named[t]=rk(e.named[t]))})}function xM(e,t,n,o,s,i){const{messages:r,onWarn:l,messageResolver:a,localeFallbacker:u}=e,c=u(e,o,n);let d=io(),f,h=null;const m="translate";for(let v=0;vo);return u.locale=n,u.key=t,u}const a=r(o,UB(e,n,s,o,l,i));return a.locale=n,a.key=t,a.source=o,a}function WB(e,t,n){return t(n)}function X4(...e){const[t,n,o]=e,s=io();if(!zt(t)&&!ls(t)&&!kr(t)&&!bl(t))throw Ql(Jl.INVALID_ARGUMENT);const i=ls(t)?String(t):(kr(t),t);return ls(n)?s.plural=n:zt(n)?s.default=n:$n(n)&&!o2(n)?s.named=n:Uo(n)&&(s.list=n),ls(o)?s.plural=o:zt(o)?s.default=o:$n(o)&&us(s,o),[i,s]}function UB(e,t,n,o,s,i){return{locale:t,key:n,warnHtmlMessage:s,onError:r=>{throw i&&i(r),r},onCacheKey:r=>pD(t,n,r)}}function jB(e,t,n,o){const{modifiers:s,pluralRules:i,messageResolver:r,fallbackLocale:l,fallbackWarn:a,missingWarn:u,fallbackContext:c}=e,f={locale:t,modifiers:s,pluralRules:i,messages:(h,m)=>{let v=r(n,h);if(v==null&&(c||m)){const[k,,w]=xM(c||e,h,t,l,a,u);v=k??r(w,h)}if(zt(v)||bl(v)){let k=!1;const b=SM(e,h,t,v,h,()=>{k=!0});return k?wk:b}else return kr(v)?v:wk}};return e.processor&&(f.processor=e.processor),o.list&&(f.list=o.list),o.named&&(f.named=o.named),ls(o.plural)&&(f.pluralIndex=o.plural),f}YD();/*! + * vue-i18n v11.4.6 + * (c) 2026 kazuya kawaguchi + * Released under the MIT License. + */const VB="11.4.6";function qB(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(Xu().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(Xu().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(Xu().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(Xu().__INTLIFY_PROD_DEVTOOLS__=!1)}const _i={UNEXPECTED_RETURN_TYPE:dB,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Hi(e,...t){return s2(e,null,void 0)}const J4=ru("__translateVNode"),Q4=ru("__datetimeParts"),e3=ru("__numberParts"),AM=ru("__setPluralRules"),MM=ru("__injectWithOption"),bd=ru("__dispose");function gp(e){if(!qn(e)||bl(e))return e;for(const t in e)if(br(e,t))if(!t.includes("."))qn(e[t])&&gp(e[t]);else{const n=t.split("."),o=n.length-1;let s=e,i=!1;for(let r=0;r{if("locale"in l&&"resource"in l){const{locale:a,resource:u}=l;a?(r[a]=r[a]||io(),Bh(u,r[a])):Bh(u,r)}else zt(l)&&Bh(JSON.parse(l),r)}),s==null&&i)for(const l in r)br(r,l)&&gp(r[l]);return r}function TM(e){return e.type}function EM(e,t,n){let o=qn(t.messages)?t.messages:io();"__i18nGlobal"in n&&(o=ty(e.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const s=Object.keys(o);s.length&&s.forEach(i=>{e.mergeLocaleMessage(i,o[i])});{if(qn(t.datetimeFormats)){const i=Object.keys(t.datetimeFormats);i.length&&i.forEach(r=>{e.mergeDateTimeFormat(r,t.datetimeFormats[r])})}if(qn(t.numberFormats)){const i=Object.keys(t.numberFormats);i.length&&i.forEach(r=>{e.mergeNumberFormat(r,t.numberFormats[r])})}}}function xk(e){return j(Ua,null,e,0)}function vp(){return ds()}const Sk="__INTLIFY_META__",Ak=()=>[],KB=()=>!1;let Mk=0;function Tk(e){return((t,n,o,s)=>e(n,o,vp()||void 0,s))}const ZB=()=>{const e=vp();let t=null;return e&&(t=TM(e)[Sk])?{[Sk]:t}:null};function Nm(e={}){const{__root:t,__injectWithOption:n}=e,o=t===void 0,s=e.flatJson,i=Lm?Z:Xr;let r=Un(e.inheritLocale)?e.inheritLocale:!0;const l=i(t&&r?t.locale.value:zt(e.locale)?e.locale:mp),a=i(t&&r?t.fallbackLocale.value:zt(e.fallbackLocale)||Uo(e.fallbackLocale)||$n(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:l.value),u=i(ty(l.value,e)),c=i($n(e.datetimeFormats)?e.datetimeFormats:{[l.value]:{}}),d=i($n(e.numberFormats)?e.numberFormats:{[l.value]:{}});let f=t?t.missingWarn:Un(e.missingWarn)||e1(e.missingWarn)?e.missingWarn:!0,h=t?t.fallbackWarn:Un(e.fallbackWarn)||e1(e.fallbackWarn)?e.fallbackWarn:!0,m=t?t.fallbackRoot:Un(e.fallbackRoot)?e.fallbackRoot:!0,v=!!e.fallbackFormat,k=xo(e.missing)?e.missing:null,w=xo(e.missing)?Tk(e.missing):null,b=xo(e.postTranslation)?e.postTranslation:null,_=t?t.warnHtmlMessage:Un(e.warnHtmlMessage)?e.warnHtmlMessage:!0,g=!!e.escapeParameter;const x=t?t.modifiers:$n(e.modifiers)?e.modifiers:{};let S=e.pluralRules||t&&t.pluralRules,T;T=(()=>{o&&gk(null);const _e={version:VB,locale:l.value,fallbackLocale:a.value,messages:u.value,modifiers:x,pluralRules:S,missing:w===null?void 0:w,missingWarn:f,fallbackWarn:h,fallbackFormat:v,unresolving:!0,postTranslation:b===null?void 0:b,warnHtmlMessage:_,escapeParameter:g,messageResolver:e.messageResolver,messageCompiler:e.messageCompiler,__meta:{framework:"vue"}};_e.datetimeFormats=c.value,_e.numberFormats=d.value,_e.__datetimeFormatters=$n(T)?T.__datetimeFormatters:void 0,_e.__numberFormatters=$n(T)?T.__numberFormatters:void 0;const Ee=LB(_e);return o&&gk(Ee),Ee})(),Q1(T,l.value,a.value);function E(){return[l.value,a.value,u.value,c.value,d.value]}const P=R({get:()=>l.value,set:_e=>{T.locale=_e,l.value=_e}}),D=R({get:()=>a.value,set:_e=>{T.fallbackLocale=_e,a.value=_e,Q1(T,l.value,_e)}}),I=R(()=>u.value),$=R(()=>c.value),B=R(()=>d.value);function H(){return xo(b)?b:null}function O(_e){b=_e,T.postTranslation=_e}function F(){return k}function U(_e){_e!==null&&(w=Tk(_e)),k=_e,T.missing=w}const z=(_e,Ee,it,Fe,Oe,Ge)=>{E();let at;try{__INTLIFY_PROD_DEVTOOLS__,o||(T.fallbackContext=t?IB():void 0),at=_e(T)}finally{__INTLIFY_PROD_DEVTOOLS__,o||(T.fallbackContext=void 0)}if(it!=="translate exists"&&ls(at)&&at===i2||it==="translate exists"&&!at){const[Tt,Bt]=Ee();return t&&m?Fe(t):Oe(Tt)}else{if(Ge(at))return at;throw Hi(_i.UNEXPECTED_RETURN_TYPE)}};function W(..._e){return z(Ee=>Reflect.apply(_k,null,[Ee,..._e]),()=>X4(..._e),"translate",Ee=>Reflect.apply(Ee.t,Ee,[..._e]),Ee=>Ee,Ee=>zt(Ee))}function K(..._e){const[Ee,it,Fe]=_e;if(Fe&&!qn(Fe))throw Hi(_i.INVALID_ARGUMENT);return W(Ee,it,us({resolvedMessage:!0},Fe||{}))}function V(..._e){return z(Ee=>Reflect.apply(yk,null,[Ee,..._e]),()=>G4(..._e),"datetime format",Ee=>Reflect.apply(Ee.d,Ee,[..._e]),()=>$m,Ee=>zt(Ee)||Uo(Ee))}function ie(..._e){return z(Ee=>Reflect.apply(bk,null,[Ee,..._e]),()=>Y4(..._e),"number format",Ee=>Reflect.apply(Ee.n,Ee,[..._e]),()=>$m,Ee=>zt(Ee)||Uo(Ee))}function ne(_e){return _e.map(Ee=>zt(Ee)||ls(Ee)||Un(Ee)?xk(String(Ee)):Ee)}const le={normalize:ne,interpolate:_e=>_e,type:"vnode"};function Ie(..._e){return z(Ee=>{let it;const Fe=Ee;try{Fe.processor=le,it=Reflect.apply(_k,null,[Fe,..._e])}finally{Fe.processor=null}return it},()=>X4(..._e),"translate",Ee=>Ee[J4](..._e),Ee=>[xk(Ee)],Ee=>Uo(Ee))}function de(..._e){return z(Ee=>Reflect.apply(bk,null,[Ee,..._e]),()=>Y4(..._e),"number format",Ee=>Ee[e3](..._e),Ak,Ee=>zt(Ee)||Uo(Ee))}function pe(..._e){return z(Ee=>Reflect.apply(yk,null,[Ee,..._e]),()=>G4(..._e),"datetime format",Ee=>Ee[Q4](..._e),Ak,Ee=>zt(Ee)||Uo(Ee))}function ve(_e){S=_e,T.pluralRules=S}function oe(_e,Ee){return z(()=>{if(!_e)return!1;const it=zt(Ee)?Ee:l.value,Fe=zt(Ee)?[it]:Z4(T,a.value,it);for(let Oe=0;Oe[_e],"translate exists",it=>Reflect.apply(it.te,it,[_e,Ee]),KB,it=>Un(it))}function ye(_e){let Ee=null;const it=Z4(T,a.value,l.value);for(let Fe=0;Fe{r&&(l.value=_e,T.locale=_e,Q1(T,l.value,a.value))}),Je(t.fallbackLocale,_e=>{r&&(a.value=_e,T.fallbackLocale=_e,Q1(T,l.value,a.value))}));const ze={id:Mk,locale:P,fallbackLocale:D,get inheritLocale(){return r},set inheritLocale(_e){r=_e,_e&&t&&(l.value=t.locale.value,a.value=t.fallbackLocale.value,Q1(T,l.value,a.value))},get availableLocales(){return Object.keys(u.value).sort()},messages:I,get modifiers(){return x},get pluralRules(){return S||{}},get isGlobal(){return o},get missingWarn(){return f},set missingWarn(_e){f=_e,T.missingWarn=f},get fallbackWarn(){return h},set fallbackWarn(_e){h=_e,T.fallbackWarn=h},get fallbackRoot(){return m},set fallbackRoot(_e){m=_e},get fallbackFormat(){return v},set fallbackFormat(_e){v=_e,T.fallbackFormat=v},get warnHtmlMessage(){return _},set warnHtmlMessage(_e){_=_e,T.warnHtmlMessage=_e},get escapeParameter(){return g},set escapeParameter(_e){g=_e,T.escapeParameter=_e},t:W,getLocaleMessage:Y,setLocaleMessage:fe,mergeLocaleMessage:we,getPostTranslationHandler:H,setPostTranslationHandler:O,getMissingHandler:F,setMissingHandler:U,[AM]:ve};return ze.datetimeFormats=$,ze.numberFormats=B,ze.rt=K,ze.te=oe,ze.tm=G,ze.d=V,ze.n=ie,ze.getDateTimeFormat=ge,ze.setDateTimeFormat=Q,ze.mergeDateTimeFormat=te,ze.getNumberFormat=ce,ze.setNumberFormat=ue,ze.mergeNumberFormat=Se,ze[MM]=n,ze[J4]=Ie,ze[Q4]=pe,ze[e3]=de,ze}function GB(e){const t=zt(e.locale)?e.locale:mp,n=zt(e.fallbackLocale)||Uo(e.fallbackLocale)||$n(e.fallbackLocale)||e.fallbackLocale===!1?e.fallbackLocale:t,o=xo(e.missing)?e.missing:void 0,s=Un(e.silentTranslationWarn)||e1(e.silentTranslationWarn)?!e.silentTranslationWarn:!0,i=Un(e.silentFallbackWarn)||e1(e.silentFallbackWarn)?!e.silentFallbackWarn:!0,r=Un(e.fallbackRoot)?e.fallbackRoot:!0,l=!!e.formatFallbackMessages,a=$n(e.modifiers)?e.modifiers:{},u=e.pluralizationRules,c=xo(e.postTranslation)?e.postTranslation:void 0,d=zt(e.warnHtmlInMessage)?e.warnHtmlInMessage!=="off":!0,f=!!e.escapeParameterHtml,h=Un(e.sync)?e.sync:!0;let m=e.messages;if($n(e.sharedMessages)){const x=e.sharedMessages;m=Object.keys(x).reduce((T,A)=>{const E=T[A]||(T[A]={});return us(E,x[A]),T},m||{})}const{__i18n:v,__root:k,__injectWithOption:w}=e,b=e.datetimeFormats,_=e.numberFormats,g=e.flatJson;return{locale:t,fallbackLocale:n,messages:m,flatJson:g,datetimeFormats:b,numberFormats:_,missing:o,missingWarn:s,fallbackWarn:i,fallbackRoot:r,fallbackFormat:l,modifiers:a,pluralRules:u,postTranslation:c,warnHtmlMessage:d,escapeParameter:f,messageResolver:e.messageResolver,inheritLocale:h,__i18n:v,__root:k,__injectWithOption:w}}function t3(e={}){const t=Nm(GB(e)),{__extender:n}=e,o={id:t.id,get locale(){return t.locale.value},set locale(s){t.locale.value=s},get fallbackLocale(){return t.fallbackLocale.value},set fallbackLocale(s){t.fallbackLocale.value=s},get messages(){return t.messages.value},get datetimeFormats(){return t.datetimeFormats.value},get numberFormats(){return t.numberFormats.value},get availableLocales(){return t.availableLocales},get missing(){return t.getMissingHandler()},set missing(s){t.setMissingHandler(s)},get silentTranslationWarn(){return Un(t.missingWarn)?!t.missingWarn:t.missingWarn},set silentTranslationWarn(s){t.missingWarn=Un(s)?!s:s},get silentFallbackWarn(){return Un(t.fallbackWarn)?!t.fallbackWarn:t.fallbackWarn},set silentFallbackWarn(s){t.fallbackWarn=Un(s)?!s:s},get modifiers(){return t.modifiers},get formatFallbackMessages(){return t.fallbackFormat},set formatFallbackMessages(s){t.fallbackFormat=s},get postTranslation(){return t.getPostTranslationHandler()},set postTranslation(s){t.setPostTranslationHandler(s)},get sync(){return t.inheritLocale},set sync(s){t.inheritLocale=s},get warnHtmlInMessage(){return t.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(s){t.warnHtmlMessage=s!=="off"},get escapeParameterHtml(){return t.escapeParameter},set escapeParameterHtml(s){t.escapeParameter=s},get pluralizationRules(){return t.pluralRules||{}},__composer:t,t(...s){return Reflect.apply(t.t,t,[...s])},rt(...s){return Reflect.apply(t.rt,t,[...s])},te(s,i){return t.te(s,i)},tm(s){return t.tm(s)},getLocaleMessage(s){return t.getLocaleMessage(s)},setLocaleMessage(s,i){t.setLocaleMessage(s,i)},mergeLocaleMessage(s,i){t.mergeLocaleMessage(s,i)},d(...s){return Reflect.apply(t.d,t,[...s])},getDateTimeFormat(s){return t.getDateTimeFormat(s)},setDateTimeFormat(s,i){t.setDateTimeFormat(s,i)},mergeDateTimeFormat(s,i){t.mergeDateTimeFormat(s,i)},n(...s){return Reflect.apply(t.n,t,[...s])},getNumberFormat(s){return t.getNumberFormat(s)},setNumberFormat(s,i){t.setNumberFormat(s,i)},mergeNumberFormat(s,i){t.mergeNumberFormat(s,i)}};return o.__extender=n,o}function YB(e,t,n){return{beforeCreate(){const o=vp();if(!o)throw Hi(_i.UNEXPECTED_ERROR);const s=this.$options;if(s.i18n){const i=s.i18n;if(s.__i18n&&(i.__i18n=s.__i18n),i.__root=t,this===this.$root)this.$i18n=Ek(e,i);else{i.__injectWithOption=!0,i.__extender=n.__vueI18nExtend,this.$i18n=t3(i);const r=this.$i18n;r.__extender&&(r.__disposer=r.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=Ek(e,s);else{this.$i18n=t3({__i18n:s.__i18n,__injectWithOption:!0,__extender:n.__vueI18nExtend,__root:t});const i=this.$i18n;i.__extender&&(i.__disposer=i.__extender(this.$i18n))}else this.$i18n=e;s.__i18nGlobal&&EM(t,s,s),this.$t=(...i)=>this.$i18n.t(...i),this.$rt=(...i)=>this.$i18n.rt(...i),this.$te=(i,r)=>this.$i18n.te(i,r),this.$d=(...i)=>this.$i18n.d(...i),this.$n=(...i)=>this.$i18n.n(...i),this.$tm=i=>this.$i18n.tm(i),n.__setInstance(o,this.$i18n)},mounted(){},unmounted(){const o=vp();if(!o)throw Hi(_i.UNEXPECTED_ERROR);const s=this.$i18n;s&&(delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,s?.__disposer&&(s.__disposer(),delete s.__disposer,delete s.__extender),n.__deleteInstance(o),delete this.$i18n)}}}function Ek(e,t){e.locale=t.locale||e.locale,e.fallbackLocale=t.fallbackLocale||e.fallbackLocale,e.missing=t.missing||e.missing,e.silentTranslationWarn=t.silentTranslationWarn||e.silentFallbackWarn,e.silentFallbackWarn=t.silentFallbackWarn||e.silentFallbackWarn,e.formatFallbackMessages=t.formatFallbackMessages||e.formatFallbackMessages,e.postTranslation=t.postTranslation||e.postTranslation,e.warnHtmlInMessage=t.warnHtmlInMessage||e.warnHtmlInMessage,e.escapeParameterHtml=t.escapeParameterHtml||e.escapeParameterHtml,e.sync=t.sync||e.sync,e.__composer[AM](t.pluralizationRules||e.pluralizationRules);const n=ty(e.locale,{messages:t.messages,__i18n:t.__i18n});return Object.keys(n).forEach(o=>e.mergeLocaleMessage(o,n[o])),t.datetimeFormats&&Object.keys(t.datetimeFormats).forEach(o=>e.mergeDateTimeFormat(o,t.datetimeFormats[o])),t.numberFormats&&Object.keys(t.numberFormats).forEach(o=>e.mergeNumberFormat(o,t.numberFormats[o])),e}const ny={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:e=>e==="parent"||e==="global",default:"parent"},i18n:{type:Object}};function XB({slots:e},t){return t.length===1&&t[0]==="default"?(e.default?e.default():[]).reduce((o,s)=>[...o,...s.type===Pe?s.children:[s]],[]):t.reduce((n,o)=>{const s=e[o];return s&&(n[o]=s()),n},io())}function IM(){return Pe}const JB=et({name:"i18n-t",props:us({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:e=>ls(e)||!isNaN(e)}},ny),setup(e,t){const{slots:n,attrs:o}=t,s=e.i18n||Nt({useScope:e.scope,__useComponent:!0});return()=>{const i=()=>{const a=Object.keys(n).filter(d=>d[0]!=="_"),u=io();e.locale&&(u.locale=e.locale),e.plural!==void 0&&(u.plural=zt(e.plural)?+e.plural:e.plural);const c=XB(t,a);return s[J4](e.keypath,c,u)},r=us(io(),o),l=zt(e.tag)||qn(e.tag)?e.tag:IM();return qn(l)?tn(l,r,{default:i}):tn(l,r,i())}}}),Ik=JB;function QB(e){return Uo(e)&&!zt(e[0])}function LM(e,t,n,o){const{slots:s,attrs:i}=t;return()=>{const r=()=>{const u={part:!0};let c=io();e.locale&&(u.locale=e.locale),zt(e.format)?u.key=e.format:qn(e.format)&&(zt(e.format.key)&&(u.key=e.format.key),c=Object.keys(e.format).reduce((h,m)=>n.includes(m)?us(io(),h,{[m]:e.format[m]}):h,io()));const d=o(e.value,u,c);let f=[u.key];return Uo(d)?f=d.map((h,m)=>{const v=s[h.type],k=v?v({[h.type]:h.value,index:m,parts:d}):[h.value];return QB(k)&&(k[0].key=`${h.type}-${m}`),k}):zt(d)&&(f=[d]),f},l=us(io(),i),a=zt(e.tag)||qn(e.tag)?e.tag:IM();return qn(a)?tn(a,l,{default:r}):tn(a,l,r())}}const eH=et({name:"i18n-n",props:us({value:{type:Number,required:!0},format:{type:[String,Object]}},ny),setup(e,t){const n=e.i18n||Nt({useScope:e.scope,__useComponent:!0});return LM(e,t,_M,(...o)=>n[e3](...o))}}),Lk=eH;function tH(e,t){const n=e;if(e.mode==="composition")return n.__getInstance(t)||e.global;{const o=n.__getInstance(t);return o!=null?o.__composer:e.global.__composer}}function nH(e){const t=r=>{const{instance:l,value:a}=r;if(!l||!l.$)throw Hi(_i.UNEXPECTED_ERROR);const u=tH(e,l.$),c=$k(a);return[Reflect.apply(u.t,u,[...Nk(c)]),u]};return{created:(r,l)=>{const[a,u]=t(l);Lm&&(r.__i18nWatcher=Je(u.locale,()=>{l.instance&&l.instance.$forceUpdate()})),r.__composer=u,r.textContent=a},unmounted:r=>{Lm&&r.__i18nWatcher&&(r.__i18nWatcher(),r.__i18nWatcher=void 0,delete r.__i18nWatcher),r.__composer&&(r.__composer=void 0,delete r.__composer)},beforeUpdate:(r,{value:l})=>{if(r.__composer){const a=r.__composer,u=$k(l);r.textContent=Reflect.apply(a.t,a,[...Nk(u)])}},getSSRProps:r=>{const[l]=t(r);return{textContent:l}}}}function $k(e){if(zt(e))return{path:e};if($n(e)){if(!("path"in e))throw Hi(_i.REQUIRED_VALUE,"path");return e}else throw Hi(_i.INVALID_VALUE)}function Nk(e){const{path:t,locale:n,args:o,choice:s,plural:i}=e,r={},l=o||{};return zt(n)&&(r.locale=n),ls(s)&&(r.plural=s),ls(i)&&(r.plural=i),[t,l,r]}function oH(e,t,...n){const o=$n(n[0])?n[0]:{};(Un(o.globalInstall)?o.globalInstall:!0)&&([Ik.name,"I18nT"].forEach(i=>e.component(i,Ik)),[Lk.name,"I18nN"].forEach(i=>e.component(i,Lk)),[Ok.name,"I18nD"].forEach(i=>e.component(i,Ok))),e.directive("t",nH(t))}const sH=ru("global-vue-i18n");function iH(e={}){const t=__VUE_I18N_LEGACY_API__&&Un(e.legacy)?e.legacy:__VUE_I18N_LEGACY_API__,n=Un(e.globalInjection)?e.globalInjection:!0,o=new Map,[s,i]=rH(e,t),r=ru("");function l(d){return o.get(d)||null}function a(d,f){o.set(d,f)}function u(d){o.delete(d)}const c={get mode(){return __VUE_I18N_LEGACY_API__&&t?"legacy":"composition"},async install(d,...f){if(d.__VUE_I18N_SYMBOL__=r,d.provide(d.__VUE_I18N_SYMBOL__,c),$n(f[0])){const v=f[0];c.__composerExtend=v.__composerExtend,c.__vueI18nExtend=v.__vueI18nExtend}let h=null;!t&&n&&(h=pH(d,c.global)),__VUE_I18N_FULL_INSTALL__&&oH(d,c,...f),__VUE_I18N_LEGACY_API__&&t&&d.mixin(YB(i,i.__composer,c));const m=d.unmount;d.unmount=()=>{h&&h(),c.dispose(),m()}},get global(){return i},dispose(){s.stop()},__instances:o,__getInstance:l,__setInstance:a,__deleteInstance:u};return c}function Nt(e={}){const t=vp();if(t==null)throw Hi(_i.MUST_BE_CALL_SETUP_TOP);if(!t.isCE&&t.appContext.app!=null&&!t.appContext.app.__VUE_I18N_SYMBOL__)throw Hi(_i.NOT_INSTALLED);const n=lH(t),o=uH(n),s=TM(t),i=aH(e,s);if(i==="global")return EM(o,e,s),o;if(i==="parent"){let a=Fk(n,t,e.__useComponent);return a==null&&(a=o),a}if(i==="isolated"){if(n.mode!=="composition")throw Hi(_i.NOT_AVAILABLE_COMPOSITION_IN_LEGACY);const a=n,u=us({},e),c=Fk(n,t);u.__root=c||o;const d=Nm(u);return a.__composerExtend&&(d[bd]=a.__composerExtend(d)),Kg()&&d1(()=>{const h=d[bd];h&&(h(),delete d[bd])}),d}const r=n;let l=r.__getInstance(t);if(l==null){const a=us({},e);"__i18n"in s&&(a.__i18n=s.__i18n),o&&(a.__root=o),l=Nm(a),r.__composerExtend&&(l[bd]=r.__composerExtend(l)),dH(r,t,l),r.__setInstance(t,l)}return l}function rH(e,t){const n=ER(),o=__VUE_I18N_LEGACY_API__&&t?n.run(()=>t3(e)):n.run(()=>Nm(e));if(o==null)throw Hi(_i.UNEXPECTED_ERROR);return[n,o]}function lH(e){const t=nn(e.isCE?sH:e.appContext.app.__VUE_I18N_SYMBOL__);if(!t)throw Hi(e.isCE?_i.NOT_INSTALLED_WITH_PROVIDE:_i.UNEXPECTED_ERROR);return t}function aH(e,t){return o2(e)?"__i18n"in t?"local":"global":e.useScope?e.useScope:"local"}function uH(e){return e.mode==="composition"?e.global:e.global.__composer}function Fk(e,t,n=!1){let o=null;const s=t.root;let i=cH(t,n);for(;i!=null;){const r=e;if(e.mode==="composition")o=r.__getInstance(i);else if(__VUE_I18N_LEGACY_API__){const l=r.__getInstance(i);l!=null&&(o=l.__composer,n&&o&&!o[MM]&&(o=null))}if(o!=null||s===i)break;i=i.parent}return o}function cH(e,t=!1){return e==null?null:t&&e.vnode.ctx||e.parent}function dH(e,t,n){dn(()=>{},t),bn(()=>{const o=n;e.__deleteInstance(t);const s=o[bd];s&&(s(),delete o[bd])},t)}const fH=["locale","fallbackLocale","availableLocales"],Rk=["t","rt","d","n","tm","te"];function pH(e,t){const n=Object.create(null);return fH.forEach(s=>{const i=Object.getOwnPropertyDescriptor(t,s);if(!i)throw Hi(_i.UNEXPECTED_ERROR);const r=Xo(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,s,r)}),e.config.globalProperties.$i18n=n,Rk.forEach(s=>{const i=Object.getOwnPropertyDescriptor(t,s);if(!i||!i.value)throw Hi(_i.UNEXPECTED_ERROR);Object.defineProperty(e.config.globalProperties,`$${s}`,i)}),()=>{delete e.config.globalProperties.$i18n,Rk.forEach(s=>{delete e.config.globalProperties[`$${s}`]})}}const hH=et({name:"i18n-d",props:us({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},ny),setup(e,t){const n=e.i18n||Nt({useScope:e.scope,__useComponent:!0});return LM(e,t,wM,(...o)=>n[Q4](...o))}}),Ok=hH;qB();SB(rB);AB(wB);MB(Z4);if(__INTLIFY_PROD_DEVTOOLS__){const e=Xu();e.__INTLIFY__=!0,lB(e.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}const mH={preview:"Preview",confirm:"Confirm",cancel:"Cancel",close:"Close",dismiss:"Dismiss",loading:"Loading",copy:"Copy"},gH={authBannerMessage:"Not signed in · Sign in to Kimi Code to start a conversation",authBannerLogin:"Sign in",connecting:"Connecting…",internalBuildBanner:"Internal testing only",menuFile:"File",menuEdit:"Edit",menuView:"View",menuHelp:"Help",applicationMenu:"Application menu"},vH={workspaceMeta:"workspace · {branch}",sessionsHeader:"sessions",workspaces:"Workspaces",viewSwitcher:"View options",viewGroup:"View",viewFlat:"Flat list",viewGrouped:"Group by workspace",collapseAll:"Collapse all workspaces",expandAll:"Expand all workspaces",newSession:"New Session",newChat:"New Session",newWorkspace:"New Workspace",dropToAddWorkspace:"Drop to add workspace",emptyState:"No sessions yet · click New Session to start",options:"Options",rename:"Rename",setEmoji:"Set Emoji…",sessionEmojiTitle:"Pick an emoji",removeEmoji:"Remove emoji",randomEmoji:"Random",searchEmoji:"Search emoji",recentEmojis:"Recently used",noEmojiResults:"No matching emoji",emojiGroupFaces:"Smileys & People",emojiGroupNature:"Animals & Nature",emojiGroupFood:"Food & Drink",emojiGroupActivity:"Activities & Travel",emojiGroupObjects:"Objects & Work",emojiGroupSymbols:"Symbols & Status",copyPath:"Copy path",copySessionId:"Copy session ID",copied:"Copied ✓",copyFailed:"Copy failed",archive:"Archive",archiveToastUndo:"Undo",archiveToastMid:"or view archived chats in",archiveToastSettings:"Settings",archiveToastTail:"",fork:"Fork session",export:"Export session",pin:"Pin",unpin:"Unpin",pinned:"Pinned",collapsePinned:"Collapse pinned",expandPinned:"Expand pinned",delete:"Delete",removeWorkspace:"Remove workspace",brand:"Kimi Code",signedIn:"Signed in",signOut:"Sign out",notSignedIn:"Not signed in",signIn:"Sign in",defaultUserName:"Kimi User",upgrade:"Upgrade",logoutConfirmTitle:"Sign out",logoutConfirmMessage:"Are you sure you want to sign out?",language:"Language",backendTitle:"Backend {backend} · {endpoint} — click to switch",noSessions:"No conversations yet",allPinned:"{count} conversations pinned",showMore:"Show more",loadMore:"Load more",showLess:"Show less",loadingMore:"Loading…",collapseSidebar:"Collapse sidebar",expandSidebar:"Expand sidebar",searchPlaceholder:"Search sessions",search:"Search",searchHint:"↑↓ navigate · ↵ open · Esc close",searchHintSelect:"navigate",searchHintOpen:"open",searchHintClose:"close",searchClear:"Clear search",searchNoResults:"No matching sessions",searchEmpty:"No sessions yet",update:"Upgrade",updateAvailable:"v{version} available",updateDownloading:"Downloading… {percent}%",updateReady:"v{version} ready",updateDone:"Restart",updateFailed:"Download failed",updateRetry:"Retry",updateDownloadNow:"Download & Update",updateSkip:"Skip This Version",updateRestartNow:"Restart Now",updateRestartLater:"Later",updateReleaseDate:"Released {date}",updateCurrentVersion:"Current v{version}",updateWhatsNew:"What’s new",updateBackground:"Download in Background",updateAutoDownload:"Automatically download and install updates"},yH={switcherTitle:"Switch workspace",switchTooltip:"Switch workspace",eyebrow:"Workspace",branchLabel:"branch: {branch}",noBranch:"no branch",sessionCount:"{count} session | {count} sessions",allWorkspaces:"All workspaces",currentWorkspace:"Current workspace only",addWorkspace:"Add workspace…",noWorkspace:"No workspace",deleteHasSessions:"This workspace still has sessions — archive them before deleting it",removeWorkspaceConfirm:'Remove workspace "{name}"?',swarmEnableTitle:"Enable swarm mode?",swarmEnableConfirm:"The agent will run multiple sub-agents in parallel.",goalStartTitle:"Start goal?",goalStartConfirm:'"{objective}" — the agent will run autonomously toward it.',scopeCurrent:"this workspace",scopeAll:"all workspaces",newInGroup:"New session in this workspace",addTitle:"Add workspace",pathLabel:"Path",pathPlaceholder:"/absolute/path/to/project",recentLabel:"Recent folders",add:"Add",cancel:"Cancel",addHint:"Paste an absolute folder path, or pick a recent one.",addFailed:"Couldn't open this folder. Check the path and try again.",requiredTitle:"Choose a workspace first",requiredMessage:"Pick a folder to use as your workspace before sending a message.",openThisFolder:"Open this folder",up:"Up",browsing:"Browsing…",filterPlaceholder:"Filter subfolders…",searchPlaceholder:"Fuzzy-search under this folder…",searching:"Searching…",pasteToggle:"Enter an absolute path",noFilterMatch:"No subfolders match “{q}”",noSubfolders:"No subfolders here",browseHint:'Click a folder to enter it, then "Open this folder" to add it as a workspace.',attentionTitle:"{count} item needs your attention | {count} items need your attention",awaitingAnswer:"Answer",awaitingAnswerTitle:"A question is waiting for your answer",awaitingPermission:"Approve",awaitingPermissionTitle:"An action is waiting for your approval",aborted:"Failed",abortedTitle:"This session's latest turn ended on an error"},kH={jumpToLatestAria:"Jump to latest message",toc:"Conversation outline",newMessages:"Latest messages",loading:"Loading…",starting:"Starting conversation…",requesting:"Requesting…",working:"Working…",workingRetry:"Model request failed — retrying ({n}/{max})…",emptyWorkspaceHint:"Send in {name}",switchWorkspace:"Switch workspace",addWorkspace:"New workspace",moreWorkspaces:"More workspaces ({count})",pickFolder:"Choose folder…",compacting:"Compacting context…",compactedPlain:"Context compacted",compactedAuto:"Context auto-compacted",compactedTokens:" ({before} → {after} tokens)",viewSummary:"View summary",summaryTitle:"Compaction summary",activatedSkill:"Activated skill: {name}",undo:"Undo",undoTooltip:"Undo edit",undoConfirm:"Undo last message?",escUndoHintPre:"Press",escUndoHintPost:"again to undo",undone:"Undone — the message is back in the composer",turnInterrupted:"Manually stopped",turnFailed:"Model request failed — this turn was interrupted",turnFailedMaxSteps:"Step limit reached — this turn was interrupted",turnFailedResume:"Continue",turnFailedResumeText:"Continue",yesterday:"Yesterday",loadOlder:"Load earlier messages",loadingOlder:"Loading earlier messages…",widenTable:"Widen table",restoreTableWidth:"Restore default width",cron:{fired:"Scheduled reminder fired",missed:"Missed scheduled reminders",job:"job {id}",oneShot:"one-shot",coalesced:"{n} fires coalesced",missedCount:"{n} missed",finalDelivery:"final delivery",expand:"Show more",collapse:"Show less"},fold:{worked:"Worked {duration}",workedUnknown:"Work details"},turnFiles:{titleOne:"{number} file changed",titleOther:"{number} files changed",more:"{number} more files",moreOne:"1 more file",showLess:"Show less",diffTitle:"Changes this turn",diffUnavailable:"This file’s changes can’t be shown line by line",openFile:"Open file"},goal:{continuation:"Goal continuation"},notification:{kindTask:"Background task",kindSubagent:"Subagent",title:{completed:"{kind} completed",failed:"{kind} failed",timed_out:"{kind} timed out",killed:"{kind} killed",lost:"{kind} lost",info:"{kind} notification"},status:{completed:"completed",failed:"failed",timed_out:"timed out",killed:"killed",lost:"lost",info:"info"},groupTitle:"{n} notifications",copyPath:"Copy path",copied:"Copied",rawPayload:"Raw payload",fields:{type:"Type",source:"Source",severity:"Severity"}},userMessage:{expand:"Show more",collapse:"Show less"},search:{placeholder:"Search chat…",searching:"Searching…",results:"{current}/{total} results",resultsCapped:"{current}/{total}+ results",noResults:"No results",previous:"Previous match",next:"Next match",close:"Close search"}},bH={connectionConnected:"Connected",connectionConnecting:"Connecting…",connectionDisconnected:"Disconnected",ctxTooltip:"Used {used} / {max} tokens ({pct}%)",modelLabel:"Model",permissionManual:"Manual",permissionAuto:"Auto",permissionYolo:"YOLO",permissionManualDesc:"Ask for approval on every tool action",permissionAutoDesc:"Fully autonomous — agent decides everything without asking",permissionYoloDesc:"Auto-approve tool actions, but agent may still ask questions",planLabel:"Plan",planDesc:"Have the agent make a plan before changing files",planOn:"on",planOff:"off",planTooltip:"Toggle plan mode (research before editing)",modesLabel:"Mode",goalLabel:"Goal",goalDesc:"Track one objective until it is complete",swarmLabel:"Swarm",swarmDesc:"Run parallel agents for broader exploration",modeOff:"Off",goalPlaceholder:"What should the agent achieve?",goalStart:"Start",goalPause:"Pause",goalResume:"Resume",goalCancel:"Cancel",goalCancelConfirm:"Cancel this goal? It cannot be resumed afterwards.",goalCancelConfirmYes:"Yes",goalCancelConfirmNo:"No",goalDoneWhen:"Done when",goalStatusActive:"Active",goalStatusPaused:"Paused",goalStatusBlocked:"Blocked",goalStatusComplete:"Complete",modeNotSupported:"Not supported",thinkingLabel:"Thinking",thinkingTooltip:"Toggle thinking mode",thinkingOn:"On",thinkingOff:"Off",cacheNote:"Note: Switching models or thinking effort invalidates the existing prompt cache. Start a new chat to avoid extra token costs.",starredModels:"Starred",moreModels:"More models…",statusPanelTitle:"Session status",statusPanelClose:"Close",statusModel:"Model",statusThinking:"Thinking",statusPermission:"Permission",statusPlanMode:"Plan mode",statusSwarmMode:"Swarm mode",swarmOn:"on",swarmOff:"off",statusContext:"Context",statusCost:"Cost",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"Running…",activityAwaitingApproval:"Awaiting approval",activityAwaitingQuestion:"Awaiting answer",interrupt:"Interrupt",runningShort:"in progress"},CH={placeholder:"Type a message…",send:"Send ↵",queueLabel:"Queue",placeholderRunning:"Press Enter to queue · Ctrl+S to inject into the running turn",starting:"Sending…",queueAutoDrain:"sends automatically when the current turn ends",queueNext:"Up next",queueDragTitle:"Drag to reorder",editQueued:"Edit (load back into the input)",queuedAttachments:"attachment ×{n}",queuedHasImage:"Contains {n} image(s) — remove only, not editable",attachmentImage:"Image",attachmentVideo:"Video",attachmentFile:"File",attachmentOpenUnsupported:"Can’t open {name} — this file type isn’t supported",dropToAttach:"Drop files to attach",remove:"Remove",removeNamed:"Remove {name}",clearAll:"Clear all attachments",attachmentCount:"{n} attachments",uploading:"Uploading",uploadFailed:"Upload failed",attachFile:"Attach file",previewAttachment:"Preview {name}",interrupt:"Interrupt",interruptTitle:"Interrupt current operation",expandTitle:"Expand input for multi-line editing",collapseTitle:"Collapse input",emptyConversationTitle:"Kimi Code",emptyConversation:"No messages yet — type below to start the conversation",upgradeBanner:"Upgrade your Kimi account to use Kimi Code",quickStartPlaceholder:"Type a message to start a new conversation…",thinkingSuffix:" · thinking",thinkingSuffixEffort:" · {level}"},wH={title:"Sign in to Kimi Code",close:"Close (Esc)",starting:"Starting sign-in flow…",lead:"Click the button below to sign in from a new browser tab.",authorizeInBrowser:"Sign in via browser",orDivider:"or",fallbackPrefix:"On another device? Open ",fallbackSuffix:" and enter the device code:",copy:"Copy",copied:"Copied",copyLink:"Copy link",waitingAuth:"Waiting for sign-in",waitingAutoClose:"Waiting for sign-in, closes automatically…",success:"Signed in",successHint:"Loading, will close automatically…",expiredTitle:"Device code expired",expiredHint:"Please restart the sign-in flow",retry:"Retry",closeBtn:"Close",errorTitle:"The current version does not support login yet",errorHint:"Please upgrade kimi-code and try again",pollErrorTitle:"Lost connection",pollErrorHint:"Sign-in polling failed repeatedly. Check the kimi-code process and try again.",action:"Sign in",requiredTitle:"Sign in required",requiredMessage:"Sign in to your Kimi account and set up a model to start chatting.",goToLogin:"Sign in",upgradeRequiredTitle:"Upgrade required",upgradeRequiredMessage:"Your account is on the free plan. Upgrade to a membership to start chatting with Kimi models."},_H={title:"Provider management",loading:"Loading providers…",unavailable:"Provider management is not available yet",empty:"No providers yet",status:{connected:"Connected",error:"Error",unconfigured:"Not configured"},keySet:"key set",keyNotSet:"key not set",managedBadge:"OAuth",modelCount:"{count} models",confirmDelete:"Confirm delete?",refresh:"Refresh",delete:"Delete",refreshTitle:"Refresh {type}",deleteTitle:"Delete {type}",loginKimi:"Sign in to Kimi",loginAnthropic:"Sign in to Anthropic",addProvider:"Add provider",added:"Provider added",enterApiKey:"Enter API Key",optional:"Optional",apiKeyRequired:"API Key cannot be empty",fieldId:"Name",fieldType:"API Protocol",types:{kimi:"Kimi",openai:"OpenAI",openai_responses:"OpenAI Responses",anthropic:"Anthropic","google-genai":"Google GenAI",vertexai:"Vertex AI"},fieldApiKey:"API Key",apiKeyManaged:"Signed in with OAuth",apiKeySet:"Set — enter a new key to replace",showApiKey:"Show API key",hideApiKey:"Hide API key",fieldBaseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",fieldModels:"Models",colModelId:"Model ID",colContext:"Context",colDisplayName:"Display name",modelIdPlaceholder:"kimi-k3",modelContextPlaceholder:"1048576",modelNamePlaceholder:"Optional",noModels:"No models",addModel:"Add model",removeModel:"Remove model",fieldDefaultModel:"Default model",save:"Save",saved:"Provider saved",deleteProvider:"Delete provider",deleteConfirm:"Delete {id} and its {count} models?",deleteConfirmYes:"Delete",managedHint:"Managed providers sign in and out on the Account tab",unsavedGuard:"You have unsaved changes.",guardStay:"Keep editing",guardDiscard:"Discard",add:"Add",catalog:{sourceCatalog:"From directory",sourceManual:"Manual",sourceRegistry:"Registry",registryHint:"Import providers and models from an api.json registry; re-importing the same URL refreshes it",registryUrlLabel:"Registry URL",registryImported:"{count} providers imported",searchPlaceholder:"Search providers",loading:"Loading directory…",loadError:"Failed to load the directory. Check your network and retry.",retry:"Retry",empty:"No matching providers",rejected:"Not importable",rejectReason:{"unknown-explicit-type":"Unsupported protocol","proprietary-sdk":"Proprietary SDK — cannot be imported","empty-base-url":"Blank base URL","placeholder-base-url":"Endpoint contains an env placeholder"},backToList:"Back to directory",willImport:"{count} models will be imported from the directory",overwriteWarning:"A provider with this name already exists; importing overwrites its config and models",importAction:"Import"},error:{idRequired:"Name cannot be empty",idInvalid:'Name must start with a letter or digit and may only contain letters, digits, "-", "_" and spaces',apiKeyRequired:"API Key cannot be empty",baseUrlRequired:"Base URL cannot be empty",registryUrlRequired:"Registry URL cannot be empty",modelRequired:"Model ID cannot be empty",contextSizeRequired:"Max context size cannot be empty",contextSizeInvalid:"Max context size must be a positive integer"},hintClose:"Close"},xH={dialogLabel:"Switch model",title:"Switch model",close:"Close (Esc)",allTab:"All",providerTabs:"Model providers",searchPlaceholder:"Search models or providers…",clearSearch:"Clear search",loading:"Loading models…",unavailable:"Model list is unavailable",contextSuffix:"{size} ctx",capabilityImageInput:"Image input",capabilityVideoInput:"Video input",capabilityToolUse:"Tool use",capabilityThinking:"Thinking",capabilityAlwaysThinking:"Always thinking",emptyNoModels:"No models available",emptyNoMatch:"No matching models",starTitle:"Add to favorites",unstarTitle:"Remove from favorites",hintNavigate:"Navigate",hintSelect:"Select",hintClose:"Close"},SH={justNow:"just now"},AH={title:{shell:"Run command?",diff:"Apply changes?",file:"Write file?",fileop:"File operation?",url:"Fetch URL?",search:"Search?",invocation:"Invoke?",todo:"Update todo?",plan_review:"Ready to build with this plan?",generic:"Approve action?"},subagentBadge:"sub agent · {name}",danger:"Danger: {detail}",searchQueryLabel:"query",searchScope:"scope: {scope}",feedbackPlaceholder:"Explain why you are rejecting… (Enter to submit, Esc to cancel)",feedbackHint:"Enter to submit · Esc to cancel",approve:"Approve",approveSession:"Approve for session",reject:"Reject",feedback:"Feedback",feedbackSubmit:"Reject with feedback",feedbackCancel:"Cancel",approvePlan:"Approve plan",revise:"Revise",rejectAndExit:"Reject and Exit",expandPlan:"Expand",collapsePlan:"Collapse"},MH={back:"‹ Previous question",nextQuestion:"Next question ›",otherDefault:"Other…",submit:"Submit",dismiss:"Dismiss",minimize:"Minimize",expand:"Expand",hint:"↑↓ to choose · Enter to confirm"},TH={tag:"tasks",summary:"{run} running · {done} done",copy:"Copy",calling:"Calling {label}",fieldTask:"Task",fieldOutput:"Output",fieldProgress:"Progress",fieldResult:"Result",moreLines:"… ({count} more)",copied:"Copied",stop:"stop",defaultDescription:"Background task",dockTasks:"Background tasks",dockBash:"Bash",dockSubagent:"Sub Agent",dockTodos:"Todos",running:"running",closePanel:"Close panel",timingRunning:"Running · {time}",timingDone:"Done · {sec}s",emptyTasks:"No background tasks running",emptyBash:"No bash tasks running",emptySubagent:"No sub agent tasks running",emptyTodo:"No todos yet",openTab:"Open the tasks tab",openDetail:"Open",collapse:"Collapse",expand:"Expand",transcriptLoadError:"Failed to load this sub agent’s conversation."},EH={panelTitle:"Thinking",streaming:"Thinking…",close:"Close"},IH={title:"Changes",branch:"branch",aheadTitle:"ahead of remote",behindTitle:"behind remote",fileCountOne:"{number} file",fileCountOther:"{number} files",empty:"No git changes",clean:"Working tree clean, no changes",back:"Back",loading:"Loading diff…",noDiff:"No line changes for this file",emptyFile:"Empty file",list:"List",tree:"Tree",close:"Close"},LH={},$H={empty:"Select a file on the left to preview",loading:"Loading…",lineCount:"{count} lines",copy:"Copy",copied:"Copied",copyPath:"Copy path",openInEditor:"Open",reveal:"Reveal",download:"Download",close:"Close",search:"Search",prevMatch:"Previous match",nextMatch:"Next match",htmlMode:"HTML preview mode",markdownMode:"Markdown preview mode",preview:"Preview",source:"Source",imageFit:"Image sizing",fit:"Fit",actual:"Actual",pdfNoPreview:"This PDF cannot be embedded here. Download it to view.",imageNoPreview:"Image file · {mime} · {size} · preview unavailable",binaryNoPreview:"Binary file · {mime} · {size} bytes · preview unavailable",unknownType:"unknown type",copyCode:"Copy code",enlargeImage:"Enlarge image",errors:{emptyPath:"File path is empty",unsupportedPath:"URLs and remote paths cannot be previewed",outsideWorkspace:"Only files inside the current workspace can be previewed",isDirectory:"Select a file instead of a directory",notFound:"File no longer exists or was moved",tooLarge:"File is too large to preview",loadFailed:"Unable to read this file"}},NH={searching:"Searching…",noMatch:"No matches"},FH={dismiss:"Close",errorLabel:"Error",noteLabel:"Note",agentWarningFallback:"agent warning",unhandledEvent:"Unhandled event: {type}",agentError:{title:"Model request failed",connection:"Cannot connect to the model service",auth:"Model authentication failed",rateLimit:"Model rate limit reached",overloaded:"Model overloaded",filtered:"Response filtered by the provider",api:"Model API error",contextOverflow:"Context size exceeded"},details:{cause:"Cause",code:"Error code",connection:"Connection",contentType:"Content type",details:"Server details",duration:"Duration",endpoint:"Endpoint",errorName:"Error type",message:"Message",operation:"Operation",phase:"Failure phase",request:"Request",requestId:"Request ID",responsePreview:"Response preview",sessionId:"Session ID",stack:"Stack",status:"HTTP status",timeout:"Timeout",timestamp:"Time"},daemonApiTitle:"Kimi server returned an error",daemonNetworkMessage:"Web did not receive a response from the Kimi server. Check that it is still running, or refresh the page.",daemonNetworkTitle:"Cannot connect to Kimi server",diagnostics:"Diagnostics",hideDetails:"Hide details",operationFailedMessage:"The last operation did not finish. Try again later.",operationFailedTitle:"Operation failed",sessionSnapshotMessage:"Web could not load the current conversation. Check that the Kimi server is still running, or refresh the page.",sessionSnapshotTitle:"Cannot load current conversation",showDetails:"Show details",copyDetails:"Copy diagnostics",copied:"Copied",wsTitle:"Realtime connection error",goal:{alreadyExists:"This session already has an active goal. Cancel it before starting a new one.",notFound:"No goal to act on — it may have already finished or been cancelled.",statusInvalid:"The current goal state does not allow this action.",notResumable:"This goal cannot be resumed (it may be cancelled or completed).",objectiveTooLong:"The objective is too long. Please shorten it and try again."}},RH={new:{desc:"Create a new session"},clear:{desc:"Clear and start a new session"},login:{desc:"Sign in to Kimi in the browser"},plan:{desc:"Toggle plan mode on/off"},swarm:{desc:"Toggle swarm mode; /swarm runs a task in swarm"},goal:{desc:"Create/control a goal: /goal , /goal pause{'|'}resume{'|'}cancel"},btw:{desc:"Side chat: /btw asks a forked side session"},yolo:{desc:"Auto-approve tool actions; the agent may still ask questions"},auto:{desc:"Fully autonomous — the agent never asks questions"},thinking:{desc:"Set the thinking level"},compact:{desc:"Compact the conversation history"},fork:{desc:"Fork this session into a new one"},export:{desc:"Download this session and troubleshooting logs as a ZIP",noSession:"Open a session before exporting it."},status:{desc:"View session status"},undo:{desc:"Undo the last message"}},OH={label:{read:"Read",bash:"Run",edit:"Edit",write:"Write",grep:"Search",glob:"Find",ls:"List",web_fetch:"Fetch",search:"Search",todo:"Todo",task:"Task",swarm:"Swarm",ask_user:"Question",plan:"Plan",goal_create:"Start Goal",goal_get:"Read Goal",goal_budget:"Set Goal Budget",goal_update:"Update Goal"},swarm:{progress:"{done} / {total}",runningSub:"{count} in progress",doneSub:"{completed} completed · {failed} failed",phaseQueued:"Queued",phaseWorking:"Working",phaseSuspended:"Suspended",phaseCompleted:"Completed",phaseFailed:"Failed",waiting:"Waiting for subagents…"},chip:{lines:"{count} lines",results:"{count} results",files:"{count} files",edited:"edited",created:"created",todos:"{count} items"},disclosure:{expand:"Expand details",collapse:"Collapse details"},output:{waiting:"Waiting for output…",empty:"No output",saved:"Saved result"},plan:{review:{pending:"Pending review",approved:"Approved",rejected:"Rejected",cancelled:"Cancelled"},selectedOption:"Selected",feedback:"Feedback"},summary:{inScope:"{value} in {scope}"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"Status: {status}",budget:"{value} {unit}",turns:"{value} turns",tokens:"{value} tokens",milliseconds:"{value} ms",seconds:"{value} sec",minutes:"{value} min",hours:"{value} hr"},group:{countOther:"{count} tool call | {count} tool calls",typed:{read:{done:"Read {count} file | Read {count} files"},bash:{done:"Ran {count} command | Ran {count} commands"},grep:{done:"Searched {count} pattern | Searched {count} patterns"},search:{done:"Ran {count} web search | Ran {count} web searches"},glob:{done:"Matched {count} file pattern | Matched {count} file patterns"},ls:{done:"Listed {count} directory | Listed {count} directories"},web_fetch:{done:"Fetched {count} page | Fetched {count} pages"},edit:{done:"Made {count} edit | Made {count} edits"},write:{done:"Wrote {count} file | Wrote {count} files"}}},activity:{failedClause:" ({count} failed)",liveDonePrefix:"",busy:"Working…",doing:{read:"Reading {subject}",bash:"Running {subject}",grep:"Searching {subject}",search:"Searching {subject}",glob:"Matching {subject}",ls:"Listing {subject}",web_fetch:"Fetching {subject}",edit:"Editing {subject}",write:"Writing {subject}"}},ask:{dismissed:"Dismissed",answer:"{count} answer",answers:"{count} answers",answered:"Answered",more:"(+{count} more)",collected:"Collected your answers",question:"{count} question",questions:"{count} questions",freeInput:"(free text)",unanswered:"No answer"}},PH={resizeHandleAria:"Resize sidebar width",resizePreviewAria:"Resize preview panel width",detailPanelAria:"Detail panel"},DH={openSwitcher:"Switch session / workspace",openSettings:"Session settings",settingsTitle:"Session settings",groupSession:"Current session",groupApp:"App preferences",sheetLabel:"Sheet",closeSheet:"Close",tapToCycle:"tap to cycle",running:"running",idle:"idle",sessionCount:"{n} sessions",newSession:"New session",permManualSub:"confirm every tool",permAutoSub:"fully autonomous, never asks",permYoloSub:"auto-approve tools, may still ask",planModeSub:"Plan mode",swarmModeSub:"Swarm mode",archivedSessions:"Archived sessions",archivedSessionsSub:"Browse and restore archived sessions",archivedBack:"Back"},BH={colorSchemeLabel:"Appearance",light:"Moon bright",dark:"Moon dark",system:"System"},HH={continue:"Continue",back:"Back",skip:"Skip",welcome:{title:"Welcome to Kimi Code",subtitle:"The AI coding workbench for professional developers",languageLabel:"Language",themeLabel:"Appearance"},login:{title:"Configure Model",subtitle:"Choose the model service that powers Kimi Code. You can change it later in Settings",kimiTitle:"Sign in with Kimi",kimiHint:"Ready out of the box with Kimi membership benefits",recommended:"Recommended",customProviderTitle:"Add a custom provider",customProviderHint:"Bring your own API key for OpenAI-compatible and other services",loggedInTitle:"Logged in with Kimi",loggedInHint:"Your model service is ready to use",finish:"Finish",skip:"Skip for now"}},zH={title:"Settings",internalTest:"Internal Test",close:"Close (Esc)",tabs:{general:"General",agent:"Agent",account:"Account",providers:"Providers",advanced:"Advanced",archived:"Archived",shortcuts:"Hotkeys"},appearance:"Appearance",notifications:"Notifications",notifyEnabled:"System notifications",notifyEnabledHint:"Send a system notification when a turn completes, needs an answer, or needs approval",notifySound:"Notification sound",notifySoundHint:"Play the system sound with notifications",notifyDenied:"Blocked in browser settings",notifyTitle:"Kimi Code · Turn finished",notifyQuestionTitle:"Kimi Code · Needs answer",notifyApprovalTitle:"Kimi Code · Approval required",notifyFallback:"View result",notifyQuestionFallback:"A question is waiting for your answer",notifyApprovalFallback:"A tool needs your approval",account:"Account",signedIn:"Signed in",signedOutHint:"Sign in to view your account and model access",planUsage:{title:"Plan Usage",retry:"Retry",loadFailed:"Failed to load",empty:"No usage data yet",weekLimit:"Weekly limit",genericLimit:"Limit",hourLimit:"{n}h limit",dayLimit:"{n}d limit",minuteLimit:"{n}m limit",resetsIn:"resets in {duration}",resetDone:"reset",durationDay:"{n}d",durationHour:"{n}h",durationMinute:"{n}m",durationSecond:"{n}s",usedPct:"{pct}% used",boosterTitle:"Booster",boosterBalance:"Balance",monthlyUsed:"Used this month",monthlyLimit:"Monthly limit",unlimited:"Unlimited",freeTitle:"Free account",freeHint:"Upgrade to a membership to use Kimi models and see plan usage"},colorSchemeHint:"Choose the app’s light or dark appearance",appIcon:"Dock icon",appIconHint:"Choose the icon shown in the Dock",appIconDefault:"Default",appIconBlack:"Black",uiFontSize:"Font size",uiFontSizeHint:"Adjust interface and message text size",vibrancy:"Frosted sidebar",vibrancyHint:"Use the native macOS frosted-glass material behind the sidebar — turn it off if the translucency is hard to read",languageHint:"Choose the interface language",defaultOpenInApp:"Default open-in app",defaultOpenInAppHint:"App used when opening files and folders from the header menu",openWith:"Open with",agentDefaults:"Agent defaults",saving:"Saving",defaultModel:"Default model",defaultModelHint:"New sessions prefer this model",noDefaultModel:"No default model",defaultPermission:"Default permission",defaultPermissionHint:"Only affects newly-created sessions",defaultThinking:"Thinking by default",defaultThinkingHint:"Whether new sessions start with thinking enabled",defaultPlanMode:"Plan mode by default",defaultPlanModeHint:"Whether new sessions start in plan mode",secondaryModelSection:"Subagents",secondaryModel:"Subagent model",secondaryModelHint:"Model and thinking effort that subagents use by default",secondaryModelEffort:"Thinking effort",noSecondaryModel:"Not set (inherit primary)",secondaryModelEffortAuto:"Model default",telemetry:"Improve product with usage data",telemetryHint:"When on, we collect anonymous interaction data (such as clicks, interruptions, and feature usage) to improve the product experience. You can turn it off at any time.",telemetryRestartHint:"Takes effect after restarting the service.",credentialReady:"Credential configured",credentialMissing:"Missing credential",configUnavailable:"The server did not return config yet. These settings are unavailable.",versionAndUpdates:"Version & updates",appVersion:"App version",appVersionHint:"The running app’s version and build time",checkUpdate:"Check for updates",checkUpdateHint:"Manually check whether a new version is available",checkUpdateBtn:"Check now",updateChecking:"Checking…",updateCheckLatest:"You’re on the latest version",updateCheckAvailable:"Version {version} is available — download it from the update entry in the sidebar",updateCheckUnsupported:"This build does not support update checks",updateCheckFailed:"Check failed. Please try again later.",updateCheckAvailableAuto:"Version {version} found — downloading in the background",updateCheckDownloaded:"Version {version} is ready — restart from the update entry in the sidebar",autoDownloadUpdate:"Auto-download updates",autoDownloadUpdateHint:"Download new versions in the background and install them on the next restart",privacy:"Data & privacy",diagnostics:"Diagnostics",build:"Build",serverVersion:"Server version",serverAddress:"Server address",serverAddressHint:"The address of the connected server",serverVersionHint:"The version of the connected service",exportLog:"Troubleshooting log",exportLogHint:"Export the troubleshooting log collected by the app",logHint:"Enable with ?debug=1 to capture",exportLogBtn:"Export log",archivedTitle:"Archived sessions",archivedDesc:"Browse archived sessions, see their workspace path, name, and archive time, and restore them to the session list.",archivedSearch:"Search archived sessions",archivedAllWorkspaces:"All workspaces",archivedSortLabel:"Sort by",archivedSortArchived:"Archive time",archivedSortCreated:"Created time",archivedSortName:"Name",archivedRestore:"Restore",archivedEmpty:"No archived sessions yet",archivedNoMatch:"No matching archived sessions",archivedSessionsCount:"{count} sessions",archivedAt:"Archived {time}",archivedLoadMore:"Load more",archivedLoading:"Loading…",archivedLoadingAll:"Loading all archived sessions…"},WH={openInEditor:"Open in editor",openInEditorShort:"Open",openInApp:"Open in {app}",chooseOpenApp:"Choose application",copyAll:"Copy all as Markdown",copyFinalSummary:"Copy final summary",copied:"Copied",lastUsed:"Last used",copyPath:"Copy path",changed:"{n} changed",gitTooltip:"Open Files > Changed",detached:"detached",openPr:"Open pull request",prStatusOpen:"open",prStatusClosed:"closed",prStatusMerged:"merged",prStatusDraft:"draft",prStatusUnknown:"unknown",options:"Options",copySessionId:"Copy session ID",renameSession:"Rename",forkSession:"Fork session",archiveSession:"Archive",exportSession:"Export session",devBadge:"Running in development mode"},UH={title:"Side chat",subtitle:"forked from this session",empty:"Ask a quick question on the side — it shares this session’s context.",placeholder:"Ask the side chat…",send:"Send"},jH={actions:{summonApp:{label:"Show App Window",desc:"Bring the app window to the foreground from anywhere"},newSession:{label:"New Session",desc:"Start a new session in the current workspace"},searchSessions:{label:"Search Chats",desc:"Open the session search dialog"},archiveSession:{label:"Archive Chat",desc:"Archive the current chat right away"},toggleSideChat:{label:"Toggle Side Chat",desc:"Open or close the /btw side chat"},toggleSidebar:{label:"Toggle Sidebar",desc:"Collapse or expand the session sidebar"},openFolder:{label:"Open Folder",desc:"Add a workspace folder with the native picker"},openInDefaultApp:{label:"Open in App",desc:"Open the workspace in your default editor/terminal"},openSettings:{label:"Open Settings",desc:"Show or hide the settings dialog"},toggleTerminal:{label:"Toggle Terminal",desc:"Show or hide the bottom terminal panel"},send:{label:"Send Message",desc:"Send the composer input"},newline:{label:"Newline",desc:"Insert a newline in the composer"}},searchPlaceholder:"Search shortcuts",unassigned:"Unassigned",unassign:"Unassign shortcut",edit:"Edit shortcut",reset:"Reset to default",resetAll:"Reset all to defaults",recording:"Press the new shortcut…",invalid:"This key combination can’t be used as a shortcut",notGlobal:"This key combination can’t be registered as a system-wide shortcut",globalTaken:"This shortcut is already taken by the system or another app",reserved:"Reserved by the system menu",reservedSteer:"Reserved for steer (Ctrl/Cmd+S)",reservedFind:"Reserved for transcript find (Ctrl/Cmd+F)",conflict:"Already used by “{action}”",customBadge:"Custom"},VH={panelAria:"Terminal",toolbarAria:"Terminal tabs",resizeAria:"Resize terminal panel height",toggle:"Toggle terminal",newTab:"New terminal",closeTab:"Close terminal",restartTab:"Restart terminal",collapse:"Collapse terminal panel",empty:"No terminal yet — click to start one",processExited:"[process exited]",processExitedWithCode:"[process exited with code {code}]"},qH={common:mH,app:gH,sidebar:vH,workspace:yH,conversation:kH,status:bH,composer:CH,login:wH,providers:_H,model:xH,sessions:SH,approval:AH,question:MH,tasks:TH,thinking:EH,diff:IH,fileTree:LH,filePreview:$H,mention:NH,warnings:FH,commands:RH,tools:OH,layout:PH,mobile:DH,theme:BH,onboarding:HH,settings:zH,header:WH,sideChat:UH,shortcuts:jH,terminal:VH},KH={preview:"预览",confirm:"确认",cancel:"取消",close:"关闭",dismiss:"关闭",loading:"加载中",copy:"复制"},ZH={authBannerMessage:"未登录 · 需要登录 Kimi Code 才能开始对话",authBannerLogin:"登录",connecting:"连接中…",internalBuildBanner:"仅供内部测试",menuFile:"文件",menuEdit:"编辑",menuView:"视图",menuHelp:"帮助",applicationMenu:"应用菜单"},GH={workspaceMeta:"workspace · {branch}",sessionsHeader:"会话",workspaces:"工作区",viewSwitcher:"视图选项",viewGroup:"视图",viewFlat:"平铺列表",viewGrouped:"按工作区分组",collapseAll:"折叠全部工作区",expandAll:"展开全部工作区",newSession:"新建会话",newChat:"新建会话",newWorkspace:"新建工作区",dropToAddWorkspace:"松开鼠标添加工作区",emptyState:"还没有会话 · 点击 新建会话 开始",options:"选项",rename:"重命名",setEmoji:"设置 Emoji…",sessionEmojiTitle:"选择 Emoji",removeEmoji:"移除 Emoji",randomEmoji:"随机",searchEmoji:"搜索 Emoji",recentEmojis:"最近使用",noEmojiResults:"没有匹配的 Emoji",emojiGroupFaces:"笑脸与人物",emojiGroupNature:"动物与自然",emojiGroupFood:"美食饮品",emojiGroupActivity:"活动与出行",emojiGroupObjects:"物品与工作",emojiGroupSymbols:"符号与状态",copyPath:"复制路径",copySessionId:"复制 Session ID",copied:"已复制 ✓",copyFailed:"复制失败",archive:"归档",archiveToastUndo:"撤销",archiveToastMid:"或到",archiveToastSettings:"设置",archiveToastTail:"查看已归档的会话",fork:"分叉会话",export:"导出会话",pin:"置顶",unpin:"取消置顶",pinned:"置顶",collapsePinned:"折叠置顶区",expandPinned:"展开置顶区",delete:"删除",removeWorkspace:"移除工作区",brand:"Kimi Code",signedIn:"已登录",signOut:"退出登录",notSignedIn:"未登录",signIn:"登录",defaultUserName:"Kimi 用户",upgrade:"升级",logoutConfirmTitle:"退出登录",logoutConfirmMessage:"确定要退出当前账号吗?",language:"语言",backendTitle:"后端 {backend} · {endpoint} — 点击切换",noSessions:"暂无对话",allPinned:"有 {count} 条对话被置顶",showMore:"展开更多",loadMore:"加载更多",showLess:"收起",loadingMore:"加载中…",collapseSidebar:"收起侧边栏",expandSidebar:"展开侧边栏",searchPlaceholder:"搜索会话",search:"搜索",searchHint:"↑↓ 选择 · ↵ 打开 · Esc 关闭",searchHintSelect:"选择",searchHintOpen:"打开",searchHintClose:"关闭",searchClear:"清除搜索",searchNoResults:"没有匹配的会话",searchEmpty:"暂无会话",update:"更新",updateAvailable:"发现新版本 v{version}",updateDownloading:"下载中… {percent}%",updateReady:"v{version} 已就绪",updateDone:"重启并更新",updateFailed:"下载失败",updateRetry:"重试",updateDownloadNow:"下载并更新",updateSkip:"本次跳过",updateRestartNow:"立即重启",updateRestartLater:"下次启动",updateReleaseDate:"发布于 {date}",updateCurrentVersion:"当前版本 v{version}",updateWhatsNew:"更新内容",updateBackground:"后台下载",updateAutoDownload:"以后自动下载并安装更新"},YH={switcherTitle:"切换工作区",switchTooltip:"切换工作区",eyebrow:"工作区",branchLabel:"分支: {branch}",noBranch:"无分支",sessionCount:"{count} 个会话",allWorkspaces:"全部工作区",currentWorkspace:"仅当前工作区",addWorkspace:"添加工作区…",noWorkspace:"暂无工作区",deleteHasSessions:"工作区内还有会话,请先归档这些会话再删除",removeWorkspaceConfirm:"移除工作区「{name}」?",swarmEnableTitle:"启用 swarm 模式?",swarmEnableConfirm:"Agent 将并行运行多个子 agent。",goalStartTitle:"启动 goal?",goalStartConfirm:"「{objective}」——Agent 将自主执行。",scopeCurrent:"当前工作区",scopeAll:"全部工作区",newInGroup:"在此工作区新建会话",addTitle:"添加工作区",pathLabel:"路径",pathPlaceholder:"/项目的绝对路径",recentLabel:"最近的文件夹",add:"添加",cancel:"取消",addHint:"粘贴一个绝对路径,或从最近用过的文件夹中选择。",addFailed:"无法打开此文件夹,请检查路径后重试。",requiredTitle:"请先选择工作空间",requiredMessage:"发送消息前,需要先选择一个文件夹作为工作区。",openThisFolder:"打开此文件夹",up:"上一级",browsing:"加载中…",filterPlaceholder:"过滤子文件夹…",searchPlaceholder:"在此目录下模糊搜索…",searching:"搜索中…",pasteToggle:"直接输入绝对路径",noFilterMatch:"没有匹配「{q}」的子文件夹",noSubfolders:"此处没有子文件夹",browseHint:'点击文件夹进入,再点"打开此文件夹"将其添加为工作区。',attentionTitle:"{count} 项待处理",awaitingAnswer:"待回答",awaitingAnswerTitle:"有提问等待你回答",awaitingPermission:"待授权",awaitingPermissionTitle:"有操作等待你授权",aborted:"失败",abortedTitle:"此会话的上一轮对话因错误中断"},XH={jumpToLatestAria:"跳到最新消息",toc:"对话目录",newMessages:"最新消息",loading:"加载中…",starting:"正在创建对话…",requesting:"请求中…",working:"工作中…",workingRetry:"模型请求失败,正在重试(第 {n}/{max} 次)…",emptyWorkspaceHint:"在 {name} 中发送",switchWorkspace:"切换工作区",addWorkspace:"添加工作区",moreWorkspaces:"更多工作区 ({count})",pickFolder:"选择文件夹…",compacting:"正在压缩上下文…",compactedPlain:"上下文已压缩",compactedAuto:"已自动压缩上下文",compactedTokens:"({before} → {after} tokens)",viewSummary:"查看摘要",summaryTitle:"压缩摘要",activatedSkill:"已激活技能: {name}",undo:"撤销",undoTooltip:"撤回编辑",undoConfirm:"撤销上一条消息?",escUndoHintPre:"再按",escUndoHintPost:"撤销本条",undone:"已撤销,原文已放回输入框",turnInterrupted:"已手动终止",turnFailed:"模型请求失败,本轮对话已中断",turnFailedMaxSteps:"达到本轮步数上限,对话已中断",turnFailedResume:"继续",turnFailedResumeText:"继续",yesterday:"昨天",loadOlder:"加载更早的消息",loadingOlder:"正在加载更早的消息…",widenTable:"加宽表格",restoreTableWidth:"恢复默认宽度",cron:{fired:"定时任务已触发",missed:"错过的定时提醒",job:"任务 {id}",oneShot:"单次",coalesced:"已合并 {n} 次触发",missedCount:"错过 {n} 次",finalDelivery:"最后一次投递",expand:"展开",collapse:"收起"},fold:{worked:"已工作 {duration}",workedUnknown:"工作过程"},turnFiles:{titleOne:"{number} 个文件已修改",titleOther:"{number} 个文件已修改",more:"还有 {number} 个文件",moreOne:"还有 1 个文件",showLess:"收起",diffTitle:"本次改动",diffUnavailable:"此文件的改动无法逐项展示",openFile:"打开文件"},goal:{continuation:"目标续跑"},notification:{kindTask:"后台任务",kindSubagent:"子代理",title:{completed:"{kind}完成",failed:"{kind}失败",timed_out:"{kind}超时",killed:"{kind}被终止",lost:"{kind}丢失",info:"{kind}通知"},status:{completed:"完成",failed:"失败",timed_out:"超时",killed:"已终止",lost:"丢失",info:"信息"},groupTitle:"{n} 条通知",copyPath:"复制路径",copied:"已复制",rawPayload:"原始 payload",fields:{type:"类型",source:"来源",severity:"严重度"}},userMessage:{expand:"展开",collapse:"收起"},search:{placeholder:"搜索对话…",searching:"搜索中…",results:"{current}/{total} 条结果",resultsCapped:"{current}/{total}+ 条结果",noResults:"无结果",previous:"上一个匹配",next:"下一个匹配",close:"关闭搜索"}},JH={connectionConnected:"已连接",connectionConnecting:"连接中…",connectionDisconnected:"未连接",ctxTooltip:"使用 {used} / {max} tokens ({pct}%)",modelLabel:"模型",permissionManual:"逐条确认",permissionAuto:"完全自主",permissionYolo:"自动通过",permissionManualDesc:"每个工具操作都需要你手动确认",permissionAutoDesc:"完全自主运行,智能体自己做决定,不再询问",permissionYoloDesc:"自动批准工具操作,但遇到关键问题仍会询问",planLabel:"计划",planDesc:"先让智能体梳理计划,再修改文件",planOn:"开",planOff:"关",planTooltip:"切换计划模式(先调研再修改)",modesLabel:"模式",goalLabel:"目标",goalDesc:"持续跟踪一个目标,直到任务完成",swarmLabel:"Swarm",swarmDesc:"并行运行多个智能体,适合大范围探索",modeOff:"未启用",goalPlaceholder:"让智能体完成什么目标?",goalStart:"开始",goalPause:"暂停",goalResume:"继续",goalCancel:"取消",goalCancelConfirm:"是否需要取消当前目标?取消后将无法恢复。",goalCancelConfirmYes:"是",goalCancelConfirmNo:"否",goalDoneWhen:"完成条件",goalStatusActive:"进行中",goalStatusPaused:"已暂停",goalStatusBlocked:"已阻塞",goalStatusComplete:"已完成",modeNotSupported:"暂不支持",thinkingLabel:"思考",thinkingTooltip:"切换思考模式",thinkingOn:"开",thinkingOff:"关",cacheNote:"提示:切换模型或思考程度会使已有的提示词缓存失效。建议新建会话,避免额外的 token 消耗。",starredModels:"收藏",moreModels:"更多模型…",statusPanelTitle:"会话状态",statusPanelClose:"关闭",statusModel:"模型",statusThinking:"思考强度",statusPermission:"权限",statusPlanMode:"计划模式",statusSwarmMode:"Swarm 模式",swarmOn:"开",swarmOff:"关",statusContext:"上下文",statusCost:"花费",statusContextValue:"{used} / {max} ({pct}%)",statusNone:"—",activityRunning:"运行中…",activityAwaitingApproval:"等待批准",activityAwaitingQuestion:"等待回答",interrupt:"中断",runningShort:"进行中"},QH={placeholder:"输入消息…",send:"发送 ↵",queueLabel:"队列",placeholderRunning:"输入会加入队列 · Ctrl+S 立即插入运行中的回合",starting:"正在发送…",queueAutoDrain:"当前回合结束后自动逐条发送",queueNext:"下一条",queueDragTitle:"拖拽排序",editQueued:"编辑(载入到输入框)",queuedAttachments:"附件 ×{n}",queuedHasImage:"包含 {n} 张图片 — 只能移除,不能编辑",attachmentImage:"图片",attachmentVideo:"视频",attachmentFile:"文件",attachmentOpenUnsupported:"无法打开 {name}:暂不支持此文件类型",dropToAttach:"松开鼠标添加附件",remove:"移除",removeNamed:"移除 {name}",clearAll:"清空全部附件",attachmentCount:"共 {n} 个附件",uploading:"上传中",uploadFailed:"上传失败",attachFile:"添加附件",previewAttachment:"预览 {name}",interrupt:"中断",interruptTitle:"中断当前操作",expandTitle:"展开输入框进行多行编辑",collapseTitle:"收起输入框",emptyConversationTitle:"Kimi Code",emptyConversation:"还没有消息 —— 在下方输入开始对话",upgradeBanner:"升级你的 Kimi 账户来使用 Kimi Code",quickStartPlaceholder:"输入消息开始新对话…",thinkingSuffix:" · 思考",thinkingSuffixEffort:" · {level}"},ez={title:"登录 Kimi Code",close:"关闭 (Esc)",starting:"正在启动登录流程…",lead:"点击下方按钮,在新标签页中完成登录。",authorizeInBrowser:"在浏览器中登录",orDivider:"或者",fallbackPrefix:"换个设备?在浏览器打开 ",fallbackSuffix:" 输入设备码:",copy:"复制",copied:"已复制",copyLink:"复制链接",waitingAuth:"等待登录",waitingAutoClose:"等待登录,完成后自动关闭…",success:"已登录",successHint:"正在加载,稍后自动关闭…",expiredTitle:"设备码已过期",expiredHint:"请重新开始登录流程",retry:"重试",closeBtn:"关闭",errorTitle:"当前版本暂不支持登录",errorHint:"请升级 kimi-code 后重试",pollErrorTitle:"连接已断开",pollErrorHint:"登录轮询连续失败,请检查 kimi-code 进程后重试",action:"登录",requiredTitle:"请先登录",requiredMessage:"登录 Kimi 账号并配置模型后,才能开始对话。",goToLogin:"去登录",upgradeRequiredTitle:"请升级会员",upgradeRequiredMessage:"当前为免费账户,升级会员后即可使用 Kimi 模型开始对话。"},tz={title:"供应商管理",loading:"加载提供商中…",unavailable:"暂不支持提供商管理",empty:"暂无提供商",status:{connected:"已连接",error:"错误",unconfigured:"未配置"},keySet:"key 已设置",keyNotSet:"未设置 key",managedBadge:"OAuth",modelCount:"{count} 个模型",confirmDelete:"确认删除?",refresh:"刷新",delete:"删除",refreshTitle:"刷新 {type}",deleteTitle:"删除 {type}",loginKimi:"登录 Kimi",loginAnthropic:"登录 Anthropic",addProvider:"添加供应商",added:"已添加",enterApiKey:"填写 API Key",optional:"可选",apiKeyRequired:"API Key 不能为空",fieldId:"名称",fieldType:"API 协议",types:{kimi:"Kimi",openai:"OpenAI",openai_responses:"OpenAI Responses",anthropic:"Anthropic","google-genai":"Google GenAI",vertexai:"Vertex AI"},fieldApiKey:"API Key",apiKeyManaged:"OAuth 托管登录",apiKeySet:"已设置,输入以更换",showApiKey:"显示 API Key",hideApiKey:"隐藏 API Key",fieldBaseUrl:"Base URL",baseUrlPlaceholder:"https://api.example.com/v1",fieldModels:"模型",colModelId:"模型 ID",colContext:"上下文",colDisplayName:"显示名",modelIdPlaceholder:"kimi-k3",modelContextPlaceholder:"1048576",modelNamePlaceholder:"可选",noModels:"暂无模型",addModel:"添加模型",removeModel:"移除模型",fieldDefaultModel:"默认模型",save:"保存",saved:"已保存",deleteProvider:"删除供应商",deleteConfirm:"确认删除 {id} 及其 {count} 个模型?",deleteConfirmYes:"确认删除",managedHint:"托管供应商在账户页登录 / 登出",unsavedGuard:"有未保存的修改。",guardStay:"继续编辑",guardDiscard:"丢弃",add:"添加",catalog:{sourceCatalog:"从目录添加",sourceManual:"手动添加",sourceRegistry:"注册表",registryHint:"从 api.json 注册表导入供应商与模型;同一 URL 重复导入即为刷新",registryUrlLabel:"注册表 URL",registryImported:"已导入 {count} 个供应商",searchPlaceholder:"搜索供应商",loading:"加载目录中…",loadError:"目录加载失败,请检查网络后重试",retry:"重试",empty:"没有匹配的供应商",rejected:"不可导入",rejectReason:{"unknown-explicit-type":"协议不受支持","proprietary-sdk":"私有协议,无法导入","empty-base-url":"Base URL 为空","placeholder-base-url":"端点包含环境变量占位符"},backToList:"返回目录列表",willImport:"将从目录导入 {count} 个模型",overwriteWarning:"已存在同名供应商,导入将覆盖其配置与模型",importAction:"导入"},error:{idRequired:"名称不能为空",idInvalid:'名称需以字母或数字开头,只能包含字母、数字、"-"、"_" 和空格',apiKeyRequired:"API Key 不能为空",baseUrlRequired:"Base URL 不能为空",registryUrlRequired:"注册表 URL 不能为空",modelRequired:"模型 ID 不能为空",contextSizeRequired:"上下文长度不能为空",contextSizeInvalid:"上下文长度需为正整数"},hintClose:"关闭"},nz={dialogLabel:"切换模型",title:"切换模型",close:"关闭 (Esc)",allTab:"全部",providerTabs:"模型提供商",searchPlaceholder:"搜索模型或提供商…",clearSearch:"清除搜索",loading:"加载模型中…",unavailable:"暂无可用模型列表",contextSuffix:"{size} ctx",capabilityImageInput:"图片输入",capabilityVideoInput:"视频输入",capabilityToolUse:"工具调用",capabilityThinking:"思考",capabilityAlwaysThinking:"始终思考",emptyNoModels:"暂无可用模型",emptyNoMatch:"无匹配模型",starTitle:"添加到收藏",unstarTitle:"取消收藏",hintNavigate:"导航",hintSelect:"选择",hintClose:"关闭"},oz={justNow:"刚刚"},sz={title:{shell:"运行命令?",diff:"应用修改?",file:"写入文件?",fileop:"文件操作?",url:"抓取 URL?",search:"搜索?",invocation:"调用?",todo:"更新 todo?",plan_review:"按这份 plan 开始实现?",generic:"批准操作?"},subagentBadge:"子 agent · {name}",danger:"危险: {detail}",searchQueryLabel:"查询",searchScope:"范围:{scope}",feedbackPlaceholder:"说明拒绝原因… (Enter 提交, Esc 取消)",feedbackHint:"Enter 提交 · Esc 取消",approve:"批准",approveSession:"本会话内批准",reject:"拒绝",feedback:"反馈",feedbackSubmit:"提交并拒绝",feedbackCancel:"取消",approvePlan:"批准 plan",revise:"修改",rejectAndExit:"拒绝并退出",expandPlan:"放大",collapsePlan:"还原"},iz={back:"‹ 上一题",nextQuestion:"下一题 ›",otherDefault:"其他…",submit:"提交",dismiss:"放弃",minimize:"最小化",expand:"展开",hint:"↑↓ 选择 · Enter 确认"},rz={tag:"任务",summary:"{run} 运行中 · {done} 完成",copy:"复制",calling:"调用 {label}",fieldTask:"任务",fieldOutput:"输出",fieldProgress:"进度",fieldResult:"结果",moreLines:"…(还有 {count} 行)",copied:"已复制",stop:"stop",defaultDescription:"后台任务",dockTasks:"后台任务",dockBash:"后台 Bash",dockSubagent:"子 Agent",dockTodos:"待办",running:"运行中",closePanel:"关闭面板",timingRunning:"运行中 · {time}",timingDone:"完成 · {sec}s",emptyTasks:"暂无后台任务",emptyBash:"暂无后台 Bash 任务",emptySubagent:"暂无子 Agent 任务",emptyTodo:"暂无待办事项",openTab:"查看全部后台任务",openDetail:"查看",collapse:"折叠",expand:"展开",transcriptLoadError:"无法加载这个子 Agent 的对话。"},lz={panelTitle:"思考过程",streaming:"思考中…",close:"关闭"},az={title:"改动",branch:"分支",aheadTitle:"领先远程",behindTitle:"落后远程",fileCountOne:"{number} 个文件",fileCountOther:"{number} 个文件",empty:"无 git 改动",clean:"工作区干净,无改动",back:"返回",loading:"正在加载 diff…",noDiff:"该文件没有行级改动",emptyFile:"空文件",list:"列表",tree:"树形",close:"关闭"},uz={},cz={empty:"选择左侧文件预览",loading:"加载中…",lineCount:"{count} 行",copy:"复制",copied:"已复制",copyPath:"复制路径",openInEditor:"打开",reveal:"显示",download:"下载",close:"关闭",search:"搜索",prevMatch:"上一个匹配",nextMatch:"下一个匹配",htmlMode:"HTML 预览模式",markdownMode:"Markdown 预览模式",preview:"预览",source:"源码",imageFit:"图片缩放",fit:"适应",actual:"原始",pdfNoPreview:"无法内嵌预览此 PDF,可以下载后查看",imageNoPreview:"图片文件 · {mime} · {size} · 暂不预览",binaryNoPreview:"二进制文件 · {mime} · {size} 字节 · 暂不预览",unknownType:"未知类型",copyCode:"复制代码",enlargeImage:"放大图片",errors:{emptyPath:"文件路径为空",unsupportedPath:"不支持预览 URL 或远程路径",outsideWorkspace:"只能预览当前 workspace 内的文件",isDirectory:"请选择具体文件,而不是目录",notFound:"文件不存在或已被移动",tooLarge:"文件过大,暂不支持预览",loadFailed:"无法读取这个文件"}},dz={searching:"搜索中…",noMatch:"无匹配"},fz={dismiss:"关闭",errorLabel:"错误",noteLabel:"提示",agentWarningFallback:"agent 警告",unhandledEvent:"未处理的事件:{type}",agentError:{title:"模型请求失败",connection:"无法连接模型服务",auth:"模型认证失败",rateLimit:"模型请求被限流",overloaded:"模型服务过载",filtered:"响应被提供方过滤",api:"模型接口返回错误",contextOverflow:"上下文超出模型限制"},details:{cause:"底层原因",code:"错误码",connection:"连接状态",contentType:"响应类型",details:"服务端详情",duration:"耗时",endpoint:"请求地址",errorName:"错误类型",message:"错误信息",operation:"操作",phase:"失败阶段",request:"请求",requestId:"Request ID",responsePreview:"响应预览",sessionId:"Session ID",stack:"堆栈",status:"HTTP 状态",timeout:"超时设置",timestamp:"时间"},daemonApiTitle:"Kimi 服务器返回错误",daemonNetworkMessage:"Web 没有拿到 Kimi 服务器的响应。请确认它仍在运行,或刷新页面重试。",daemonNetworkTitle:"无法连接到 Kimi 服务器",diagnostics:"诊断信息",hideDetails:"收起详情",operationFailedMessage:"刚才的操作没有完成,请稍后重试。",operationFailedTitle:"操作失败",sessionSnapshotMessage:"Web 没能加载当前会话内容。请确认 Kimi 服务器仍在运行,或刷新页面重试。",sessionSnapshotTitle:"无法加载当前会话内容",showDetails:"查看详情",copyDetails:"复制诊断信息",copied:"已复制",wsTitle:"实时连接出错",goal:{alreadyExists:"当前会话已有一个进行中的目标,请先取消它再创建新目标。",notFound:"没有找到可操作的目标,可能它已经结束或被取消。",statusInvalid:"当前目标状态不支持这个操作。",notResumable:"这个目标无法恢复(可能已取消或已完成)。",objectiveTooLong:"目标描述太长了,请精简后重试。"}},pz={new:{desc:"创建新会话"},clear:{desc:"清空并新建会话"},login:{desc:"在浏览器中登录 Kimi"},plan:{desc:"切换计划模式 开/关"},swarm:{desc:"切换 swarm 模式;/swarm <任务> 直接在 swarm 下执行"},goal:{desc:"创建/控制目标:/goal <目标>、/goal pause{'|'}resume{'|'}cancel"},btw:{desc:"侧边聊天:/btw <问题> 向 fork 的侧边会话提问"},yolo:{desc:"自动批准工具操作,Agent 仍可能提问"},auto:{desc:"完全自主,Agent 不再提问"},thinking:{desc:"设置思考强度"},compact:{desc:"压缩会话历史"},fork:{desc:"把当前会话 fork 出一个新会话"},export:{desc:"将当前会话和排障日志下载为 ZIP 压缩包",noSession:"请先打开一个会话再导出。"},status:{desc:"查看会话状态"},undo:{desc:"撤销上一条消息"}},hz={label:{read:"读取",bash:"运行",edit:"编辑",write:"写入",grep:"搜索",glob:"查找",ls:"列目录",web_fetch:"抓取",search:"搜索",todo:"待办",task:"任务",swarm:"Swarm",ask_user:"提问",plan:"计划",goal_create:"启动目标",goal_get:"读取目标",goal_budget:"设置目标预算",goal_update:"更新目标"},swarm:{progress:"{done} / {total}",runningSub:"{count} 个进行中",doneSub:"完成 {completed} · 失败 {failed}",phaseQueued:"排队",phaseWorking:"运行中",phaseSuspended:"暂停",phaseCompleted:"完成",phaseFailed:"失败",waiting:"等待子任务加入…"},chip:{lines:"{count} 行",results:"{count} 结果",files:"{count} 个文件",edited:"已编辑",created:"已创建",todos:"{count} 项"},disclosure:{expand:"展开详情",collapse:"收起详情"},output:{waiting:"等待输出…",empty:"(无输出)",saved:"已保存的结果"},plan:{review:{pending:"待确认",approved:"已通过",rejected:"已拒绝",cancelled:"已取消"},selectedOption:"已选择",feedback:"反馈"},summary:{inScope:"{value} 在 {scope} 中"},goal:{objectiveWithCriterion:"{objective} · {criterion}",status:"状态:{status}",budget:"{value} {unit}",turns:"{value} 轮",tokens:"{value} token",milliseconds:"{value} 毫秒",seconds:"{value} 秒",minutes:"{value} 分钟",hours:"{value} 小时"},group:{countOther:"执行了 {count} 次工具调用",typed:{read:{done:"读取了 {count} 个文件"},bash:{done:"运行了 {count} 条命令"},grep:{done:"搜索了 {count} 个模式"},search:{done:"网络搜索了 {count} 次"},glob:{done:"找了 {count} 次文件"},ls:{done:"列出了 {count} 个目录"},web_fetch:{done:"抓取了 {count} 个页面"},edit:{done:"编辑了 {count} 处"},write:{done:"写入了 {count} 个文件"}}},activity:{failedClause:"({count} 失败)",liveDonePrefix:"已",busy:"正在执行…",doing:{read:"正在读取 {subject}",bash:"正在运行 {subject}",grep:"正在搜索 {subject}",search:"正在搜索 {subject}",glob:"正在匹配 {subject}",ls:"正在列出 {subject}",web_fetch:"正在抓取 {subject}",edit:"正在编辑 {subject}",write:"正在写入 {subject}"}},ask:{dismissed:"已忽略",answer:"{count} 个回答",answers:"{count} 个回答",answered:"已回答",more:"(还有 {count} 个)",collected:"已收集回答",question:"{count} 个问题",questions:"{count} 个问题",freeInput:"(自由输入)",unanswered:"未作答"}},mz={resizeHandleAria:"调整侧栏宽度",resizePreviewAria:"调整预览面板宽度",detailPanelAria:"详情面板"},gz={openSwitcher:"切换会话 / 工作区",openSettings:"会话设置",settingsTitle:"会话设置",groupSession:"当前会话",groupApp:"应用偏好",sheetLabel:"面板",closeSheet:"关闭",tapToCycle:"点击切换",running:"运行中",idle:"空闲",sessionCount:"{n} 个会话",newSession:"新建会话",permManualSub:"每个工具都确认",permAutoSub:"完全自主,不再提问",permYoloSub:"自动批准工具,仍可能提问",planModeSub:"计划模式",swarmModeSub:"Swarm 模式",archivedSessions:"已归档会话",archivedSessionsSub:"查看并恢复已归档会话",archivedBack:"返回"},vz={colorSchemeLabel:"外观",light:"月之亮面",dark:"月之暗面",system:"跟随系统"},yz={continue:"继续",back:"上一步",skip:"跳过",welcome:{title:"欢迎使用 Kimi Code",subtitle:"为专业开发者打造的 AI 编程工作台",languageLabel:"语言",themeLabel:"外观"},login:{title:"选择配置模型",subtitle:"选择驱动 Kimi Code 的模型服务,之后可在「设置」中更改。",kimiTitle:"登录 Kimi 账号",kimiHint:"使用 Kimi 会员权益,开箱即用",recommended:"推荐",customProviderTitle:"添加自定义供应商",customProviderHint:"使用自己的 API Key,接入 OpenAI 兼容等模型服务",loggedInTitle:"已登录 Kimi 账号",loggedInHint:"模型服务已就绪,可以开始使用",finish:"完成",skip:"跳过,稍后再说"}},kz={title:"设置",internalTest:"内部测试",close:"关闭 (Esc)",tabs:{general:"通用",agent:"Agent",account:"账户",providers:"供应商",advanced:"高级",archived:"已归档",shortcuts:"快捷键"},appearance:"外观",notifications:"通知",notifyEnabled:"系统通知",notifyEnabledHint:"回合完成、待回答或待审批时发送系统通知",notifySound:"通知提示音",notifySoundHint:"系统通知随附提示音",notifyDenied:"已在浏览器设置中被阻止",notifyTitle:"Kimi Code · 回合完成",notifyQuestionTitle:"Kimi Code · 待回答",notifyApprovalTitle:"Kimi Code · 等待审批",notifyFallback:"点击查看结果",notifyQuestionFallback:"有提问等待你回答",notifyApprovalFallback:"有工具等待你审批",account:"账户",signedIn:"已登录",signedOutHint:"登录后可查看账户和模型权益",planUsage:{title:"套餐用量",retry:"重试",loadFailed:"加载失败",empty:"暂无用量数据",weekLimit:"每周限额",genericLimit:"限额",hourLimit:"{n} 小时限额",dayLimit:"{n} 天限额",minuteLimit:"{n} 分钟限额",resetsIn:"{duration}后重置",resetDone:"已重置",durationDay:"{n} 天",durationHour:"{n} 小时",durationMinute:"{n} 分钟",durationSecond:"{n} 秒",usedPct:"已用 {pct}%",boosterTitle:"加油包",boosterBalance:"余额",monthlyUsed:"本月已用",monthlyLimit:"每月上限",unlimited:"不限",freeTitle:"免费账户",freeHint:"升级会员后即可使用 Kimi 模型并查看套餐用量"},colorSchemeHint:"选择应用的明暗外观",appIcon:"程序坞图标",appIconHint:"选择程序坞中显示的图标",appIconDefault:"默认",appIconBlack:"黑色",uiFontSize:"字体大小",uiFontSizeHint:"调整界面和消息文字大小",vibrancy:"毛玻璃侧栏",vibrancyHint:"在侧栏使用 macOS 原生毛玻璃材质——如果半透明影响阅读可以关闭",languageHint:"选择界面显示语言",defaultOpenInApp:"默认打开应用",defaultOpenInAppHint:"从顶栏菜单打开文件和文件夹时默认使用的应用",openWith:"打开方式",agentDefaults:"Agent 默认值",saving:"保存中",defaultModel:"默认模型",defaultModelHint:"新会话会优先使用这个模型",noDefaultModel:"未设置默认模型",defaultPermission:"默认权限",defaultPermissionHint:"只影响之后新建的会话",defaultThinking:"默认开启思考",defaultThinkingHint:"新会话默认是否开启思考",defaultPlanMode:"默认计划模式",defaultPlanModeHint:"新会话默认进入计划模式",secondaryModelSection:"子智能体",secondaryModel:"子智能体模型",secondaryModelHint:"子智能体默认使用的模型与思考强度",secondaryModelEffort:"思考强度",noSecondaryModel:"未设置(跟随主模型)",secondaryModelEffortAuto:"模型默认",telemetry:"使用数据改进产品",telemetryHint:"开启后,我们会收集您的匿名交互数据(如点击、打断、功能使用等),用于改进产品体验。您可以随时关闭。",telemetryRestartHint:"更改后需重启服务生效。",credentialReady:"凭据已配置",credentialMissing:"缺少凭据",configUnavailable:"当前服务端没有返回 config,设置项暂不可用。",versionAndUpdates:"版本与更新",appVersion:"应用版本",appVersionHint:"当前应用的版本号和构建时间",checkUpdate:"检查更新",checkUpdateHint:"手动检查是否有新版本",checkUpdateBtn:"立即检查",updateChecking:"检查中…",updateCheckLatest:"已是最新版本",updateCheckAvailable:"发现新版本 {version},可从侧边栏的更新入口下载",updateCheckUnsupported:"当前构建不支持检查更新",updateCheckFailed:"检查失败,请稍后重试",updateCheckAvailableAuto:"发现新版本 {version},正在后台下载",updateCheckDownloaded:"新版本 {version} 已就绪,可从侧边栏的更新入口重启安装",autoDownloadUpdate:"自动下载更新",autoDownloadUpdateHint:"发现新版本时在后台自动下载,重启后完成安装",privacy:"数据与隐私",diagnostics:"诊断",build:"构建",serverVersion:"服务端版本",serverAddress:"服务器地址",serverAddressHint:"当前连接的服务器地址",serverVersionHint:"当前连接服务的版本",exportLog:"故障排查日志",exportLogHint:"导出已采集的故障排查日志",logHint:"加 ?debug=1 开启采集",exportLogBtn:"导出日志",archivedTitle:"已归档会话",archivedDesc:"查看已归档会话,确认其所属工作区路径、会话名称和归档时间,并可恢复到会话列表。",archivedSearch:"搜索已归档会话",archivedAllWorkspaces:"所有工作区",archivedSortLabel:"排序方式",archivedSortArchived:"归档时间",archivedSortCreated:"创建时间",archivedSortName:"按字母顺序",archivedRestore:"恢复",archivedEmpty:"还没有归档的会话",archivedNoMatch:"没有匹配的已归档会话",archivedSessionsCount:"{count} 个会话",archivedAt:"归档于 {time}",archivedLoadMore:"加载更多",archivedLoading:"加载中…",archivedLoadingAll:"正在加载全部归档会话…"},bz={openInEditor:"在编辑器中打开",openInEditorShort:"打开",openInApp:"用 {app} 打开",chooseOpenApp:"选择应用",copyAll:"复制全部对话为 Markdown",copyFinalSummary:"仅复制最终总结",copied:"已复制",lastUsed:"上次使用",copyPath:"复制路径",changed:"{n} 处改动",gitTooltip:"打开「文件 > 改动」",detached:"游离",openPr:"打开 Pull Request",prStatusOpen:"已打开",prStatusClosed:"已关闭",prStatusMerged:"已合并",prStatusDraft:"草稿",prStatusUnknown:"未知",options:"选项",copySessionId:"复制 Session ID",renameSession:"重命名",forkSession:"分叉会话",archiveSession:"归档",exportSession:"导出会话",devBadge:"开发环境运行中"},Cz={title:"侧边聊天",subtitle:"从当前会话 fork",empty:"在侧边随手问一句 —— 它共享当前会话的上下文。",placeholder:"问问侧边聊天…",send:"发送"},wz={actions:{summonApp:{label:"显示应用窗口",desc:"从任意位置将应用窗口唤起到前台"},newSession:{label:"新建会话",desc:"在当前工作区开始一个新会话"},searchSessions:{label:"搜索会话",desc:"打开会话搜索弹窗"},archiveSession:{label:"归档任务",desc:"立即归档当前聊天"},toggleSideChat:{label:"侧边聊天",desc:"打开或关闭 /btw 侧边聊天"},toggleSidebar:{label:"展开/收起侧边栏",desc:"收起或展开会话侧边栏"},openFolder:{label:"打开文件夹",desc:"通过系统原生选择器添加工作目录"},openInDefaultApp:{label:"在默认应用中打开",desc:"在默认编辑器或终端中打开当前工作目录"},openSettings:{label:"打开设置",desc:"显示或隐藏设置窗口"},toggleTerminal:{label:"切换终端",desc:"显示或隐藏底部终端面板"},send:{label:"发送消息",desc:"发送输入框中的内容"},newline:{label:"换行",desc:"在输入框中插入换行"}},searchPlaceholder:"搜索快捷键",unassigned:"未分配",unassign:"取消分配",edit:"编辑快捷键",reset:"恢复默认",resetAll:"全部恢复默认",recording:"按下新的快捷键…",invalid:"该按键组合不能用作快捷键",notGlobal:"该按键组合无法注册为系统级快捷键",globalTaken:"该快捷键已被系统或其他应用占用",reserved:"系统菜单已占用该快捷键",reservedSteer:"steer 固定快捷键(Ctrl/Cmd+S),不可占用",reservedFind:"对话搜索固定快捷键(Ctrl/Cmd+F),不可占用",conflict:"已被「{action}」占用",customBadge:"自定义"},_z={panelAria:"终端",toolbarAria:"终端标签页",resizeAria:"调整终端面板高度",toggle:"切换终端",newTab:"新建终端",closeTab:"关闭终端",restartTab:"重启终端",collapse:"收起终端面板",empty:"还没有终端,点击新建一个",processExited:"[进程已退出]",processExitedWithCode:"[进程已退出,退出码 {code}]"},xz={common:KH,app:ZH,sidebar:GH,workspace:YH,conversation:XH,status:JH,composer:QH,login:ez,providers:tz,model:nz,sessions:oz,approval:sz,question:iz,tasks:rz,thinking:lz,diff:az,fileTree:uz,filePreview:cz,mention:dz,warnings:fz,commands:pz,tools:hz,layout:mz,mobile:gz,theme:vz,onboarding:yz,settings:kz,header:bz,sideChat:Cz,shortcuts:wz,terminal:_z},Sz={en:qH,zh:xz},Az="kimi-locale";function $M(){let e=null;try{e=globalThis.localStorage?.getItem(Az)??null}catch{e=null}return e==="en"||e==="zh"?e:globalThis.navigator?.language?.toLowerCase().startsWith("zh")?"zh":"en"}function Mz(e){const t=e.locale??$M();return iH({legacy:!1,locale:t,fallbackLocale:"en",messages:Sz})}const NM=Symbol("KimiI18n"),Tz={t:e=>e};function m1(){const e=nn(NM,null);if(e)return e;try{const t=Nt();return{t:(n,o)=>t.t(n,o),locale:t.locale.value}}catch{return Tz}}const ya=6,ka=8,Ez=150,Iz=et({__name:"TooltipBubble",props:{target:{default:null},delegate:{default:null},text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=e,n=Z(),o=Z(!1),s=Z(!1),i=Z({maxWidth:`${t.maxWidth}px`});let r,l=null,a;function u(){if(t.target)return t.target;const T=t.delegate;return T?T.firstElementChild??T:null}function c(T){const A=n.value;if(!A)return;const E=T.getBoundingClientRect(),P=A.offsetWidth,D=A.offsetHeight,I=window.innerWidth,$=window.innerHeight;let B=t.placement;B==="top"&&E.top-ya-D$-ka?B="top":B==="left"&&E.left-ya-PI-ka&&(B="left");let H=0,O=0;B==="top"?(H=E.top-ya-D,O=E.left+E.width/2-P/2):B==="bottom"?(H=E.bottom+ya,O=E.left+E.width/2-P/2):B==="left"?(H=E.top+E.height/2-D/2,O=E.left-ya-P):(H=E.top+E.height/2-D/2,O=E.right+ya),O=Math.min(Math.max(O,ka),I-ka-P),H=Math.min(Math.max(H,ka),$-ka-D),i.value={maxWidth:`${t.maxWidth}px`,top:`${Math.round(H)}px`,left:`${Math.round(O)}px`}}function d(){if(!t.text)return;const T=u();T&&(window.clearTimeout(r),r=window.setTimeout(()=>{o.value=!0,s.value=!1,yt(()=>{c(T),s.value=!0})},Ez))}function f(){window.clearTimeout(r),o.value=!1,s.value=!1}function h(){d()}function m(){f()}function v(T){return T instanceof Element?T.closest(".ui-tip"):null}function k(T){const A=t.delegate;if(!A)return;if(v(T.target)!==A){f();return}const E=T.relatedTarget;E instanceof Element&&A.contains(E)&&v(E)===A||d()}function w(T){const A=t.delegate;if(!A)return;const E=T.relatedTarget;E instanceof Element&&A.contains(E)||f()}function b(T){v(T.target)===t.delegate&&d()}function _(){f()}function g(){l&&(t.delegate?(l.removeEventListener("mouseover",k),l.removeEventListener("mouseout",w),l.removeEventListener("focusin",b),l.removeEventListener("focusout",_)):(l.removeEventListener("mouseenter",h),l.removeEventListener("mouseleave",m),l.removeEventListener("focusin",h),l.removeEventListener("focusout",m)),l=null)}function x(){g(),a?.disconnect(),a=void 0;const T=t.target??t.delegate;T&&(l=T,t.delegate?(T.addEventListener("mouseover",k),T.addEventListener("mouseout",w),T.addEventListener("focusin",b),T.addEventListener("focusout",_),a=new MutationObserver(()=>{o.value&&f()}),a.observe(T,{childList:!0})):(T.addEventListener("mouseenter",h),T.addEventListener("mouseleave",m),T.addEventListener("focusin",h),T.addEventListener("focusout",m)))}Je(()=>[t.target,t.delegate],()=>{f(),x()});function S(){o.value&&f()}return dn(()=>{x(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S)}),Vn(()=>{window.clearTimeout(r),a?.disconnect(),g(),window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}),(T,A)=>o.value?(y(),he(Zr,{key:0,to:"body"},[C("div",{ref_key:"bubble",ref:n,class:Re(["ui-tip__bubble",{positioned:s.value}]),style:Zt([i.value,{"--tip-lines":e.maxLines}]),role:"tooltip"},N(e.text),7)])):ee("",!0)}}),ft=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},FM=ft(Iz,[["__scopeId","data-v-93bacf6d"]]),Lz=["type","disabled","aria-label"],$z=et({__name:"IconButton",props:{size:{default:"md"},disabled:{type:Boolean},label:{},tooltip:{},type:{default:"button"}},setup(e,{expose:t}){const n=Z();return t({el:n}),(o,s)=>(y(),M("button",{ref_key:"el",ref:n,class:Re(["ui-icon-button",`ui-icon-button--${e.size}`]),type:e.type,disabled:e.disabled,"aria-label":e.label},[xn(o.$slots,"default",{},void 0,!0),e.tooltip?(y(),he(FM,{key:0,target:n.value??null,text:e.tooltip},null,8,["target","text"])):ee("",!0)],10,Lz))}}),gn=ft($z,[["__scopeId","data-v-2cbeca98"]]),RM=Symbol("IconResolver"),Nz={sm:14,md:16,lg:20},Te=et({__name:"Icon",props:{name:{},size:{default:"md"},label:{}},setup(e){const t=e,n=nn(RM,()=>{}),o=R(()=>n(t.name)),s=R(()=>Nz[t.size]);return(i,r)=>o.value?(y(),he(bs(o.value),{key:0,class:"kw-icon",width:s.value,height:s.value,"aria-label":e.label,"aria-hidden":e.label?void 0:!0},null,8,["width","height","aria-label","aria-hidden"])):ee("",!0)}}),Fz={class:"ui-action-toast-host"},Rz={class:"ui-action-toast__body"},Oz=et({__name:"ActionToast",props:{duration:{default:8e3},dismissLabel:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=m1();let i=null,r=0,l=0;function a(d){i=setTimeout(()=>o("dismiss"),d),r=Date.now()+d}function u(){i!==null&&(clearTimeout(i),i=null,l=Math.max(0,r-Date.now()))}function c(){i===null&&a(l)}return a(n.duration),bn(()=>{i!==null&&clearTimeout(i)}),(d,f)=>(y(),M("div",Fz,[C("div",{class:"ui-action-toast",role:"status",onPointerenter:u,onPointerleave:c},[C("span",Rz,[xn(d.$slots,"default")]),j(gn,{class:"ui-action-toast__close",size:"sm",label:e.dismissLabel??p(s)("common.dismiss"),tooltip:e.dismissLabel??p(s)("common.dismiss"),onClick:f[0]||(f[0]=h=>o("dismiss"))},{default:me(()=>[j(Te,{name:"close",size:"sm"})]),_:1},8,["label","tooltip"])],32)]))}}),Pz=ft(Oz,[["__scopeId","data-v-e84c8ca2"]]),Dz={key:0,width:"36",height:"36",viewBox:"0 0 36 36",fill:"none",stroke:"var(--color-success)","stroke-width":"2","aria-hidden":"true"},Bz={key:1,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-danger)","stroke-width":"1.5","aria-hidden":"true"},Hz={key:2,width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",stroke:"var(--color-warning)","stroke-width":"1.5","aria-hidden":"true"},Dd=et({__name:"AuthStateIcon",props:{kind:{}},setup(e){return(t,n)=>e.kind==="success"?(y(),M("svg",Dz,[...n[0]||(n[0]=[C("circle",{cx:"18",cy:"18",r:"15"},null,-1),C("polyline",{points:"10,18 15,24 26,12"},null,-1)])])):e.kind==="expired"?(y(),M("svg",Bz,[...n[1]||(n[1]=[C("circle",{cx:"14",cy:"14",r:"12"},null,-1),C("line",{x1:"14",y1:"8",x2:"14",y2:"15"},null,-1),C("circle",{cx:"14",cy:"19",r:"1.2",fill:"var(--color-danger)"},null,-1)])])):(y(),M("svg",Hz,[...n[2]||(n[2]=[C("path",{d:"M14 3 L26 24 H2 Z"},null,-1),C("line",{x1:"14",y1:"12",x2:"14",y2:"18"},null,-1),C("circle",{cx:"14",cy:"21.5",r:"1",fill:"var(--color-warning)"},null,-1)])]))}}),zz={key:0,class:"ui-badge__dot","aria-hidden":"true"},Wz=et({__name:"Badge",props:{variant:{default:"neutral"},size:{default:"md"},dot:{type:Boolean}},setup(e){return(t,n)=>(y(),M("span",{class:Re(["ui-badge",[`ui-badge--${e.variant}`,`ui-badge--${e.size}`]])},[e.dot?(y(),M("span",zz)):ee("",!0),xn(t.$slots,"default",{},void 0,!0)],2))}}),Vr=ft(Wz,[["__scopeId","data-v-d879fe18"]]),Uz={class:"ui-banner__icon","aria-hidden":"true"},jz={class:"ui-banner__text"},Vz=et({__name:"Banner",props:{variant:{default:"info"}},setup(e){return(t,n)=>(y(),M("div",{class:Re(["ui-banner",`ui-banner--${e.variant}`]),role:"status"},[C("span",Uz,[xn(t.$slots,"icon",{},()=>[e.variant==="info"?(y(),he(Te,{key:0,name:"info",size:"md"})):(y(),he(Te,{key:1,name:"alert-triangle",size:"md"}))],!0)]),C("span",jz,[xn(t.$slots,"default",{},void 0,!0)])],2))}}),qu=ft(Vz,[["__scopeId","data-v-6d739c6d"]]),qz=["aria-label"],Kz=et({__name:"Spinner",props:{size:{default:"md"},label:{}},setup(e){const{t}=m1(),n=Z(null);let o,s;function i(){const r=n.value;if(r){if(s?.matches){o?.cancel(),o=void 0;return}o||(o=r.animate([{transform:"rotate(0deg)"},{transform:"rotate(360deg)"}],{duration:850,iterations:1/0}),o.startTime=0)}}return dn(()=>{const r=n.value;!r||typeof r.animate!="function"||(s=window.matchMedia("(prefers-reduced-motion: reduce)"),s.addEventListener("change",i),i())}),Vn(()=>{s?.removeEventListener("change",i),s=void 0,o?.cancel(),o=void 0}),(r,l)=>(y(),M("span",{ref_key:"boxRef",ref:n,class:Re(["ui-spinner",`ui-spinner--${e.size}`]),role:"status","aria-label":e.label??p(t)("common.loading")},[...l[0]||(l[0]=[C("svg",{class:"ui-spinner__svg",viewBox:"0 0 24 24","aria-hidden":"true"},[C("circle",{class:"ui-spinner__track",cx:"12",cy:"12",r:"9"}),C("circle",{class:"ui-spinner__arc",cx:"12",cy:"12",r:"9"})],-1)])],10,qz))}}),Ao=ft(Kz,[["__scopeId","data-v-0b81b1b5"]]),Zz=["type","disabled"],Gz={class:"ui-button__content"},Yz=et({__name:"Button",props:{variant:{default:"primary"},size:{default:"md"},disabled:{type:Boolean},loading:{type:Boolean},type:{default:"button"}},setup(e){return(t,n)=>(y(),M("button",{class:Re(["ui-button",[`ui-button--${e.variant}`,`ui-button--${e.size}`,{"is-loading":e.loading}]]),type:e.type,disabled:e.disabled||e.loading},[e.loading?(y(),he(Ao,{key:0,size:"sm",class:"ui-button__spinner"})):ee("",!0),C("span",Gz,[xn(t.$slots,"default",{},void 0,!0)])],10,Zz))}}),Rt=ft(Yz,[["__scopeId","data-v-01b5ec22"]]),Xz={key:0,class:"ui-card__head"},Jz={class:"ui-card__body"},Qz={key:1,class:"ui-card__foot"},eW=et({__name:"Card",props:{elevated:{type:Boolean,default:!1}},setup(e){return(t,n)=>(y(),M("div",{class:Re(["ui-card",{"is-elevated":e.elevated}])},[t.$slots.head?(y(),M("div",Xz,[xn(t.$slots,"head",{},void 0,!0)])):ee("",!0),C("div",Jz,[xn(t.$slots,"default",{},void 0,!0)]),t.$slots.foot?(y(),M("div",Qz,[xn(t.$slots,"foot",{},void 0,!0)])):ee("",!0)],2))}}),tW=ft(eW,[["__scopeId","data-v-fbd05138"]]),nW=["checked","disabled"],oW={class:"ui-check__box","aria-hidden":"true"},sW={key:0,class:"ui-check__label"},iW=et({__name:"Checkbox",props:{modelValue:{type:Boolean},disabled:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(o,s)=>(y(),M("label",{class:Re(["ui-check",{"is-on":e.modelValue,"is-disabled":e.disabled}])},[C("input",{class:"ui-check__input",type:"checkbox",checked:e.modelValue,disabled:e.disabled,onChange:s[0]||(s[0]=i=>n("update:modelValue",i.target.checked))},null,40,nW),C("span",oW,[e.modelValue?(y(),he(Te,{key:0,name:"check",size:"md"})):ee("",!0)]),o.$slots.default?(y(),M("span",sW,[xn(o.$slots,"default",{},void 0,!0)])):ee("",!0)],2))}}),rW=ft(iW,[["__scopeId","data-v-d4bf4026"]]),lW={class:"ctx-ring",viewBox:"0 0 20 20","aria-hidden":"true"},aW=["stroke-dasharray","stroke-dashoffset"],Qv=7,uW=et({__name:"ContextRing",props:{pct:{}},setup(e){const t=e,n=2*Math.PI*Qv;return(o,s)=>(y(),M("svg",lW,[C("circle",{class:"ctx-ring-track",cx:"10",cy:"10",r:Qv,fill:"none","stroke-width":"2.5"}),C("circle",{class:"ctx-ring-fill",cx:"10",cy:"10",r:Qv,fill:"none","stroke-width":"2.5","stroke-linecap":"round","stroke-dasharray":`${n}`,"stroke-dashoffset":`${n*(1-t.pct/100)}`},null,8,aW)]))}}),cW=ft(uW,[["__scopeId","data-v-de787cf2"]]),Ci=Z(0),dW=["aria-label"],fW={key:0,class:"ui-dialog__head"},pW={class:"ui-dialog__titles"},hW={key:0,class:"ui-dialog__title"},mW={key:1,class:"ui-dialog__desc"},gW={class:"ui-dialog__body"},vW={key:1,class:"ui-dialog__foot"},yW='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])',kW=et({__name:"Dialog",props:{open:{type:Boolean},title:{},ariaLabel:{},description:{},closeOnOverlay:{type:Boolean,default:!0},closeOnEsc:{type:Boolean,default:!0},size:{default:"md"},height:{default:"auto"},padded:{type:Boolean,default:!0},hideClose:{type:Boolean},level:{default:"raised"},initialFocus:{}},emits:["update:open","close"],setup(e,{emit:t}){const n=e,o=t,{t:s}=m1(),i=Z(null);let r=null;function l(){o("update:open",!1),o("close")}function a(){return i.value?Array.from(i.value.querySelectorAll(yW)):[]}function u(){const{initialFocus:f}=n;return f?typeof f=="function"?f()??null:typeof f=="string"?i.value?.querySelector(f)??null:i.value?.contains(f)?f:null:null}function c(f){if(!n.open)return;if(f.key==="Escape"&&n.closeOnEsc){f.preventDefault(),l();return}if(f.key!=="Tab")return;const h=a(),m=h[0],v=h[h.length-1];if(!m||!v){f.preventDefault(),i.value?.focus();return}const k=document.activeElement;f.shiftKey&&k===m?(f.preventDefault(),v.focus()):!f.shiftKey&&k===v&&(f.preventDefault(),m.focus())}function d(f){n.closeOnOverlay&&f.target===f.currentTarget&&l()}return Je(()=>n.open,async f=>{if(f){Ci.value+=1,r=document.activeElement,await yt();const h=u(),m=a();(h??m[0]??i.value)?.focus()}else Ci.value=Math.max(0,Ci.value-1),r instanceof HTMLElement&&(r.focus(),r=null)},{immediate:!0}),typeof window<"u"&&window.addEventListener("keydown",c),Vn(()=>{typeof window<"u"&&window.removeEventListener("keydown",c),n.open&&(Ci.value=Math.max(0,Ci.value-1),r instanceof HTMLElement&&r.focus())}),(f,h)=>(y(),he(Zr,{to:"body"},[e.open?(y(),M("div",{key:0,class:"ui-dialog__overlay",onMousedown:d},[C("div",{ref_key:"panel",ref:i,class:Re(["ui-dialog",[`ui-dialog--${e.size}`,{"ui-dialog--flush":!e.padded,"ui-dialog--fixed-height":e.height==="fixed","ui-dialog--grouped":e.level==="grouped"}]]),role:"dialog","aria-modal":"true","aria-label":e.ariaLabel??e.title,tabindex:"-1"},[e.title||f.$slots.head?(y(),M("div",fW,[xn(f.$slots,"head",{},()=>[C("div",pW,[e.title?(y(),M("div",hW,N(e.title),1)):ee("",!0),e.description?(y(),M("div",mW,N(e.description),1)):ee("",!0)])],!0),e.hideClose?ee("",!0):(y(),he(gn,{key:0,class:"ui-dialog__close",size:"sm",label:p(s)("common.close"),tooltip:p(s)("common.close"),onClick:l},{default:me(()=>[j(Te,{name:"close",size:"md"})]),_:1},8,["label","tooltip"]))])):ee("",!0),C("div",gW,[xn(f.$slots,"default",{},void 0,!0)]),f.$slots.foot?(y(),M("div",vW,[xn(f.$slots,"foot",{},void 0,!0)])):ee("",!0)],10,dW)],32)):ee("",!0)]))}}),ua=ft(kW,[["__scopeId","data-v-ebbc1a68"]]),bW={class:"ui-empty"},CW={key:0,class:"ui-empty__icon","aria-hidden":"true"},wW={key:1,class:"ui-empty__title"},_W={key:2,class:"ui-empty__hint"},xW=et({__name:"EmptyState",props:{title:{},hint:{}},setup(e){return(t,n)=>(y(),M("div",bW,[t.$slots.icon?(y(),M("span",CW,[xn(t.$slots,"icon",{},void 0,!0)])):ee("",!0),e.title?(y(),M("div",wW,N(e.title),1)):ee("",!0),e.hint?(y(),M("div",_W,N(e.hint),1)):ee("",!0),xn(t.$slots,"default",{},void 0,!0)]))}}),SW=ft(xW,[["__scopeId","data-v-6da80932"]]),AW={key:0,class:"ui-field__label"},MW={key:1,class:"ui-field__error"},TW={key:2,class:"ui-field__hint"},EW=et({__name:"Field",props:{label:{},hint:{},error:{}},setup(e){return(t,n)=>(y(),M("div",{class:Re(["ui-field",{"has-error":!!e.error}])},[e.label?(y(),M("label",AW,N(e.label),1)):ee("",!0),xn(t.$slots,"default",{},void 0,!0),e.error?(y(),M("span",MW,N(e.error),1)):e.hint?(y(),M("span",TW,N(e.hint),1)):ee("",!0)],2))}}),IW=ft(EW,[["__scopeId","data-v-a8de5f7f"]]),LW=["type","value","placeholder","disabled","readonly"],$W=et({__name:"Input",props:{modelValue:{},size:{default:"md"},type:{default:"text"},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue","focus","blur"],setup(e,{expose:t,emit:n}){const o=n,s=Z();function i(a){o("update:modelValue",a.target.value)}function r(){s.value?.focus()}function l(){s.value?.select()}return t({focus:r,select:l,el:s}),(a,u)=>(y(),M("input",{ref_key:"el",ref:s,class:Re(["ui-input",[`ui-input--${e.size}`,{"has-error":e.error}]]),type:e.type,value:e.modelValue,placeholder:e.placeholder,disabled:e.disabled,readonly:e.readonly,onInput:i,onFocus:u[0]||(u[0]=c=>a.$emit("focus",c)),onBlur:u[1]||(u[1]=c=>a.$emit("blur",c))},null,42,LW))}}),js=ft($W,[["__scopeId","data-v-f1cdf732"]]),NW={class:"ui-kbd"},FW=et({__name:"Kbd",props:{keys:{}},setup(e){return(t,n)=>(y(),M("span",NW,[(y(!0),M(Pe,null,pt(e.keys,o=>(y(),M("kbd",{key:o,class:"ui-kbd__key"},N(o),1))),128))]))}}),oa=ft(FW,[["__scopeId","data-v-04b30ce2"]]),RW=["role"],OW=et({__name:"Menu",props:{role:{default:"menu"}},setup(e,{expose:t}){const n=Z();return t({el:n}),(o,s)=>(y(),M("div",{ref_key:"el",ref:n,class:"ui-menu",role:e.role},[xn(o.$slots,"default",{},void 0,!0)],8,RW))}}),Cl=ft(OW,[["__scopeId","data-v-9be2c64a"]]),PW={key:0,class:"ui-menu-sep",role:"separator"},DW=["role","disabled"],BW=et({__name:"MenuItem",props:{active:{type:Boolean},danger:{type:Boolean},disabled:{type:Boolean},separator:{type:Boolean},size:{default:"md"},role:{default:"menuitem"}},emits:["click"],setup(e){return(t,n)=>e.separator?(y(),M("div",PW)):(y(),M("button",{key:1,class:Re(["ui-menu-item",[`ui-menu-item--${e.size}`,{"is-active":e.active,"is-danger":e.danger}]]),type:"button",role:e.role,disabled:e.disabled,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[xn(t.$slots,"default",{},void 0,!0)],10,DW))}}),hn=ft(BW,[["__scopeId","data-v-3866cadb"]]),HW=et({__name:"Tooltip",props:{text:{},placement:{default:"top"},maxWidth:{default:280},maxLines:{default:6}},setup(e){const t=Z();return(n,o)=>(y(),M(Pe,null,[C("span",{ref_key:"trigger",ref:t,class:"ui-tip"},[xn(n.$slots,"default",{},void 0,!0)],512),j(FM,{delegate:t.value??null,text:e.text,placement:e.placement,"max-width":e.maxWidth,"max-lines":e.maxLines},null,8,["delegate","text","placement","max-width","max-lines"])],64))}}),pn=ft(HW,[["__scopeId","data-v-414bd903"]]),zW={class:"ui-panel-header__title"},WW={key:0,class:"ui-panel-header__sub"},UW=et({__name:"PanelHeader",props:{title:{},subtitle:{},closable:{type:Boolean,default:!0},closeLabel:{},closeIcon:{default:"close"},wrap:{type:Boolean}},emits:["close"],setup(e){const{t}=m1();return(n,o)=>(y(),M("div",{class:Re(["ui-panel-header",{wrap:e.wrap}])},[C("span",zW,N(e.title),1),j(pn,{text:e.subtitle},{default:me(()=>[e.subtitle?(y(),M("span",WW,N(e.subtitle),1)):ee("",!0)]),_:1},8,["text"]),xn(n.$slots,"default",{},void 0,!0),e.closable?(y(),he(gn,{key:0,class:"ui-panel-header__close",size:"sm",label:e.closeLabel??p(t)("common.close"),tooltip:e.closeLabel??p(t)("common.close"),onClick:o[0]||(o[0]=s=>n.$emit("close"))},{default:me(()=>[j(Te,{name:e.closeIcon,size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"])):ee("",!0)],2))}}),pc=ft(UW,[["__scopeId","data-v-eb14b05d"]]),jW=["disabled","aria-pressed"],VW=et({__name:"Pill",props:{clickable:{type:Boolean,default:!0},active:{type:Boolean},disabled:{type:Boolean},ariaPressed:{type:Boolean}},emits:["click"],setup(e){return(t,n)=>e.clickable?(y(),M("button",{key:0,class:Re(["ui-pill",{"is-active":e.active}]),type:"button",disabled:e.disabled,"aria-pressed":e.ariaPressed,onClick:n[0]||(n[0]=o=>t.$emit("click",o))},[xn(t.$slots,"default",{},void 0,!0)],10,jW)):(y(),M("span",{key:1,class:Re(["ui-pill",{"is-active":e.active}])},[xn(t.$slots,"default",{},void 0,!0)],2))}}),G0=ft(VW,[["__scopeId","data-v-fe6a2873"]]),qW=et({__name:"ScrollArea",props:{orientation:{default:"vertical"},hideDelay:{default:600}},setup(e,{expose:t}){const n=e,o=Z(null),s=Z(null),i=Z(!1),r=Z({overflow:!1,size:0,offset:0}),l=Z({overflow:!1,size:0,offset:0}),a=Z(null);let u=null,c=null,d=null;const f=R(()=>({overflowX:n.orientation==="vertical"?"hidden":"auto",overflowY:n.orientation==="horizontal"?"hidden":"auto"})),h=R(()=>({height:`${r.value.size}px`,transform:`translateY(${r.value.offset}px)`})),m=R(()=>({width:`${l.value.size}px`,transform:`translateX(${l.value.offset}px)`}));function v(E,P,D){if(!(P>E+1)||E<=0)return{overflow:!1,size:0,offset:0};const $=Math.max(0,E-4),B=Math.min($,Math.max(24,$*E/P)),H=Math.max(0,$-B),O=Math.max(1,P-E);return{overflow:!0,size:B,offset:H*D/O}}function k(){const E=s.value;if(!E)return;const P=v(E.clientHeight,E.scrollHeight,E.scrollTop),D=v(E.clientWidth,E.scrollWidth,E.scrollLeft);(P.overflow!==r.value.overflow||P.size!==r.value.size||P.offset!==r.value.offset)&&(r.value=P),(D.overflow!==l.value.overflow||D.size!==l.value.size||D.offset!==l.value.offset)&&(l.value=D)}function w(){u!==null&&clearTimeout(u),u=null}function b(){w(),i.value=!0}function _(){w(),!(a.value||o.value?.matches(":hover, :focus-within"))&&(u=setTimeout(()=>{i.value=!1,u=null},n.hideDelay))}function g(){k(),b(),_()}function x(E,P){const D=s.value;D&&(P.preventDefault(),b(),a.value={axis:E,pointerId:P.pointerId,startPointer:E==="vertical"?P.clientY:P.clientX,startScroll:E==="vertical"?D.scrollTop:D.scrollLeft},P.currentTarget.setPointerCapture(P.pointerId))}function S(E){const P=a.value,D=s.value;if(!P||P.pointerId!==E.pointerId||!D)return;const I=P.axis==="vertical"?E.clientY:E.clientX,$=P.axis==="vertical"?D.clientHeight:D.clientWidth,B=P.axis==="vertical"?D.scrollHeight:D.scrollWidth,H=P.axis==="vertical"?r.value.size:l.value.size,O=Math.max(1,$-4-H),F=(I-P.startPointer)*(B-$)/O;P.axis==="vertical"?D.scrollTop=P.startScroll+F:D.scrollLeft=P.startScroll+F}function T(E){!a.value||a.value.pointerId!==E.pointerId||(a.value=null,_())}function A(){const E=s.value;if(!(!E||!c))for(const P of E.children)c.observe(P)}return dn(async()=>{await yt();const E=s.value;E&&(c=new ResizeObserver(k),c.observe(E),A(),d=new MutationObserver(()=>{A(),k()}),d.observe(E,{childList:!0,subtree:!0,characterData:!0}),k())}),Vn(()=>{w(),c?.disconnect(),d?.disconnect()}),t({viewport:s,updateMetrics:k}),(E,P)=>(y(),M("div",{ref_key:"root",ref:o,class:"ui-scroll-area",onPointerenter:b,onPointerleave:_,onFocusin:b,onFocusout:_},[C("div",{ref_key:"viewport",ref:s,class:"ui-scroll-area__viewport",style:Zt(f.value),tabindex:"0",onScroll:g},[xn(E.$slots,"default",{},void 0,!0)],36),r.value.overflow&&n.orientation!=="horizontal"?(y(),M("div",{key:0,class:Re(["ui-scroll-area__bar ui-scroll-area__bar--vertical",{"is-visible":i.value}]),"aria-hidden":"true"},[C("span",{class:"ui-scroll-area__thumb",style:Zt(h.value),onPointerdown:P[0]||(P[0]=D=>x("vertical",D)),onPointermove:S,onPointerup:T,onPointercancel:T},null,36)],2)):ee("",!0),l.value.overflow&&n.orientation!=="vertical"?(y(),M("div",{key:1,class:Re(["ui-scroll-area__bar ui-scroll-area__bar--horizontal",{"is-visible":i.value}]),"aria-hidden":"true"},[C("span",{class:"ui-scroll-area__thumb",style:Zt(m.value),onPointerdown:P[1]||(P[1]=D=>x("horizontal",D)),onPointermove:S,onPointerup:T,onPointercancel:T},null,36)],2)):ee("",!0)],544))}}),Pk=ft(qW,[["__scopeId","data-v-9c504ebc"]]),KW=["aria-selected","onClick"],ZW=et({__name:"SegmentedControl",props:{modelValue:{},options:{},size:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,s=Z(null),i=Z([]),r=Z(!1),l=Z({});let a=null;function u(d,f){d instanceof HTMLElement&&(i.value[f]=d)}async function c(){await yt();const d=n.options.findIndex(h=>h.value===n.modelValue),f=i.value[d];f&&(l.value={width:`${f.offsetWidth}px`,height:`${f.offsetHeight}px`,transform:`translate(${f.offsetLeft}px, ${f.offsetTop}px)`},r.value=!0)}return Je(()=>[n.modelValue,n.options.length],c,{immediate:!0}),dn(()=>{a=new ResizeObserver(()=>c()),s.value&&a.observe(s.value);for(const d of i.value)a.observe(d);c()}),Vn(()=>a?.disconnect()),(d,f)=>(y(),M("div",{ref_key:"root",ref:s,class:Re(["ui-seg",`ui-seg--${e.size??"md"}`]),role:"tablist"},[C("span",{class:Re(["ui-seg__indicator",{"is-ready":r.value}]),style:Zt(l.value),"aria-hidden":"true"},null,6),(y(!0),M(Pe,null,pt(e.options,(h,m)=>(y(),M("button",{key:h.value,ref_for:!0,ref:v=>u(v,m),class:Re(["ui-seg__item",{"is-on":h.value===e.modelValue}]),type:"button",role:"tab","aria-selected":h.value===e.modelValue,onClick:v=>o("update:modelValue",h.value)},[h.icon?(y(),he(Te,{key:0,class:"ui-seg__icon",name:h.icon,size:"sm"},null,8,["name"])):ee("",!0),h.swatch?(y(),M("span",{key:1,class:"ui-seg__swatch",style:Zt({backgroundColor:h.swatch})},null,4)):ee("",!0),qe(" "+N(h.label),1)],10,KW))),128))],2))}}),wi=ft(ZW,[["__scopeId","data-v-27f5a180"]]),GW=["aria-expanded","disabled"],YW=["src"],XW={class:"ui-select__value-text"},JW={key:0,class:"ui-select__group"},QW=["aria-selected","disabled","onMouseenter","onClick"],eU=["src"],tU=et({inheritAttrs:!1,__name:"Select",props:{modelValue:{},options:{},placeholder:{default:""},size:{default:"md"},disabled:{type:Boolean},error:{type:Boolean}},emits:["update:modelValue"],setup(e,{emit:t}){const n=e,o=t,s=p1(),i=Z(null),r=Z(null),l=Z(null),a=Z([]),u=Z(!1),c=Z(-1),d=`ui-select-${Math.random().toString(36).slice(2,9)}`,f=R(()=>n.options.findIndex(A=>String(A.value)===String(n.modelValue??""))),h=R(()=>n.options[f.value]),m=R(()=>h.value?.label??n.placeholder);function v(A,E){a.value[E]=A instanceof HTMLElement?A:null}function k(){const A=l.value,E=a.value[c.value];!A||!E||(A.scrollTop=E.offsetTop-(A.clientHeight-E.offsetHeight)/2)}function w(){n.disabled||u.value||(u.value=!0,c.value=f.value>=0?f.value:n.options.findIndex(A=>!A.disabled),yt(k))}function b({restoreFocus:A=!1}={}){u.value&&(u.value=!1,A&&yt(()=>r.value?.focus()))}function _(){u.value?b():w()}function g(A){A.disabled||(String(A.value)!==String(n.modelValue??"")&&o("update:modelValue",A.value),b({restoreFocus:!0}))}function x(A){if(u.value||w(),n.options.length===0)return;let E=c.value;for(let P=0;PP.disabled?-1:D).filter(P=>P>=0);c.value=A.key==="Home"?E[0]??-1:E.at(-1)??-1,yt(k)}}function T(A){i.value?.contains(A.target)||b()}return dn(()=>document.addEventListener("pointerdown",T)),bn(()=>document.removeEventListener("pointerdown",T)),(A,E)=>(y(),M("div",{ref_key:"rootRef",ref:i,class:Re(["ui-select",[`ui-select--${e.size}`,{"has-error":e.error,"is-open":u.value,"is-disabled":e.disabled}]])},[C("button",zn({ref_key:"triggerRef",ref:r},p(s),{class:"ui-select__trigger",type:"button",role:"combobox","aria-controls":d,"aria-expanded":u.value,"aria-haspopup":"listbox",disabled:e.disabled,onClick:_,onKeydown:S}),[C("span",{class:Re(["ui-select__value",{"is-placeholder":!h.value}])},[h.value?.icon?(y(),M("img",{key:0,class:"ui-select__icon",src:h.value.icon,alt:""},null,8,YW)):ee("",!0),C("span",XW,N(m.value),1)],2),j(Te,{class:"ui-select__chevron",name:"chevron-down",size:"sm"})],16,GW),u.value?(y(),M("div",{key:0,id:d,ref_key:"listRef",ref:l,class:"ui-select__menu",role:"listbox"},[(y(!0),M(Pe,null,pt(e.options,(P,D)=>(y(),M(Pe,{key:`${P.group??""}:${P.value}`},[P.group&&P.group!==e.options[D-1]?.group?(y(),M("div",JW,N(P.group),1)):ee("",!0),C("button",{ref_for:!0,ref:I=>v(I,D),class:Re(["ui-select__option",{"is-selected":D===f.value,"is-active":D===c.value}]),type:"button",role:"option","aria-selected":D===f.value,disabled:P.disabled,onMouseenter:I=>c.value=D,onClick:I=>g(P)},[j(Te,{class:"ui-select__check",name:"check",size:"sm"}),P.icon?(y(),M("img",{key:0,class:"ui-select__icon ui-select__icon--option",src:P.icon,alt:""},null,8,eU)):ee("",!0),C("span",null,N(P.label),1)],42,QW)],64))),128))],512)):ee("",!0)],2))}}),n3=ft(tU,[["__scopeId","data-v-63f5dcbc"]]),nU=et({__name:"StatusDot",props:{status:{}},setup(e){const t=e;function n(s){switch(s){case"ok":case"done":case"completed":case"success":return"ok";case"error":case"failed":case"danger":return"error";case"running":case"working":case"in_progress":case"active":return"running";case"suspended":return"suspended";default:return"idle"}}const o=R(()=>n(t.status));return(s,i)=>(y(),M("span",{class:Re(["kw-dot",`kw-dot--${o.value}`]),"aria-hidden":"true"},null,2))}}),hc=ft(nU,[["__scopeId","data-v-b282847b"]]),oU=["aria-checked","aria-label","disabled"],sU=et({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},label:{}},emits:["update:modelValue"],setup(e,{emit:t}){const n=t;return(o,s)=>(y(),M("button",{class:Re(["ui-switch",{"is-on":e.modelValue}]),type:"button",role:"switch","aria-checked":e.modelValue,"aria-label":e.label,disabled:e.disabled,onClick:s[0]||(s[0]=i=>n("update:modelValue",!e.modelValue))},[...s[1]||(s[1]=[C("span",{class:"ui-switch__thumb"},null,-1)])],10,oU))}}),ed=ft(sU,[["__scopeId","data-v-2fc56545"]]),iU={class:"ui-toast__icon","aria-hidden":"true"},rU={class:"ui-toast__body"},lU={class:"ui-toast__title"},aU={key:0,class:"ui-toast__msg"},uU=et({__name:"Toast",props:{variant:{default:"info"},title:{},message:{},dismissLabel:{}},emits:["dismiss"],setup(e){const{t}=m1();return(n,o)=>(y(),M("div",{class:Re(["ui-toast",`ui-toast--${e.variant}`])},[C("span",iU,[xn(n.$slots,"icon",{},()=>[e.variant==="success"?(y(),he(Te,{key:0,name:"check"})):e.variant==="danger"?(y(),he(Te,{key:1,name:"close"})):e.variant==="warning"?(y(),he(Te,{key:2,name:"alert-triangle"})):(y(),he(Te,{key:3,name:"info"}))],!0)]),C("div",rU,[C("div",lU,N(e.title),1),e.message?(y(),M("div",aU,N(e.message),1)):ee("",!0),xn(n.$slots,"default",{},void 0,!0)]),j(gn,{class:"ui-toast__close",size:"sm",label:e.dismissLabel??p(t)("common.dismiss"),tooltip:e.dismissLabel??p(t)("common.dismiss"),onClick:o[0]||(o[0]=s=>n.$emit("dismiss"))},{default:me(()=>[j(Te,{name:"close",size:"sm"})]),_:1},8,["label","tooltip"])],2))}}),cU=ft(uU,[["__scopeId","data-v-62bc76d1"]]),dU=100;function Ar(){let e=!1,t=0;function n(){e=!0,t=0}function o(){e=!1,t=Date.now()}function s(){e=!1,t=0}function i(r){return e||r.isComposing||r.keyCode===229||Date.now()-t{typeof window<"u"&&(window.removeEventListener("focusin",s,!0),window.removeEventListener("focusout",s,!0))}),{handleCompositionStart:n,handleCompositionEnd:o,resetComposition:s,isComposingKeyEvent:i}}function Cd(e,t,n="/api/v1"){return`${e}${n}${t.startsWith("/")?t:`/${t}`}`}function fU(e,t){const n=new URL(`${e}/api/v1/ws`);return n.protocol=n.protocol==="https:"?"wss:":"ws:",n.searchParams.set("client_id",t),n.toString()}const oy={};class wd extends Error{code;requestId;details;timestamp;durationMs;constructor(t){super(t.msg),this.name="DaemonApiError",this.code=t.code,this.requestId=t.requestId,this.details=t.details,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}class Wl extends Error{cause;method;path;url;requestId;phase;timeoutMs;status;statusText;contentType;bodyPreview;timestamp;durationMs;constructor(t){super(t.message),this.name="DaemonNetworkError",this.cause=t.cause,this.method=t.method,this.path=t.path,this.url=t.url,this.requestId=t.requestId,this.phase=t.phase,this.timeoutMs=t.timeoutMs,this.status=t.status,this.statusText=t.statusText,this.contentType=t.contentType,this.bodyPreview=t.bodyPreview,this.timestamp=t.timestamp,this.durationMs=t.durationMs}}class sy extends Error{size;limit;constructor(t){super(`file too large to preview: ${t.size} bytes (limit ${t.limit})`),this.name="FileTooLargeError",this.size=t.size,this.limit=t.limit}}function Us(e){return e instanceof wd||typeof e=="object"&&e!==null&&e.name==="DaemonApiError"&&typeof e.code=="number"}function iy(e){return e instanceof Wl||typeof e=="object"&&e!==null&&e.name==="DaemonNetworkError"&&typeof e.method=="string"&&typeof e.path=="string"}function pU(e){return e instanceof sy||typeof e=="object"&&e!==null&&e.name==="FileTooLargeError"&&typeof e.limit=="number"}const hU=40922;function mU(e){return Us(e)&&e.code===hU}const hd=3e4,Y0=5*6e4,OM="0123456789ABCDEFGHJKMNPQRSTVWXYZ",Dk=500,PM=40101;function Bk(e,t){for(const[n,o]of Object.entries(t))if(o!==void 0)if(Array.isArray(o))for(const s of o)s!==void 0&&e.append(n,String(s));else e.set(n,String(o))}function X0(e=hd){try{return AbortSignal.timeout(e)}catch{return}}function gU(e,t){let n="",o=e;for(let s=0;sOM[n%32]).join("")}function J0(){return`${gU(Date.now(),10)}${vU(16)}`}function yU(e){try{const t=[];return e.forEach((n,o)=>{typeof n=="string"?t.push({field:o,value:n}):t.push({field:o,file:n.name,size:n.size,type:n.type})}),{formData:t}}catch{return"[FormData]"}}async function e9(e){try{const t=await e.text();return t?t.length>Dk?`${t.slice(0,Dk)}...`:t:void 0}catch{return}}class Hk{constructor(t){this.opts=t,this.tracer=t.tracer??oy}tracer;async get(t,n){return this.request("GET",t,void 0,n)}async getBlob(t,n,o){let s=Cd(this.opts.origin,t,this.opts.restBasePath);if(n){const c=new URLSearchParams;Bk(c,n);const d=c.toString();d&&(s=`${s}?${d}`)}const i=J0(),r={"X-Request-Id":i};this.addClientHeaders(r);const l=Date.now();this.tracer.restRequest?.({method:"GET",path:t,url:s,requestId:i});let a;try{a=await fetch(s,{method:"GET",headers:r,signal:X0()})}catch(c){throw this.tracer.restFailure?.({method:"GET",path:t,requestId:i,phase:"fetch",durationMs:Date.now()-l,error:c}),new Wl({message:`Network error calling GET ${t}`,cause:c,method:"GET",path:t,url:s,requestId:i,phase:"fetch",timeoutMs:hd,timestamp:Date.now(),durationMs:Date.now()-l})}if(a.ok){this.tracer.restResponse?.({method:"GET",path:t,requestId:i,status:a.status,durationMs:Date.now()-l,code:0,msg:""});const c=Number(a.headers.get("content-length")??0);if(o?.maxBytes!==void 0&&c>o.maxBytes)throw a.body?.cancel(),new sy({size:c,limit:o.maxBytes});return a.blob()}let u;try{u=await a.clone().json()}catch{}throw this.checkAuthRequired(a,u?.code??0),this.tracer.restResponse?.({method:"GET",path:t,requestId:i,status:a.status,durationMs:Date.now()-l,code:u?.code??a.status,msg:u?.msg??a.statusText,envelopeRequestId:u?.request_id}),new wd({code:u?.code??a.status,msg:u?.msg??a.statusText,requestId:u?.request_id??i,details:u?.details,timestamp:Date.now(),durationMs:Date.now()-l})}async post(t,n,o){return this.request("POST",t,n,void 0,o?.allowCodes)}async postZip(t,n,o){const s="POST",i=Cd(this.opts.origin,t,this.opts.restBasePath),r=J0(),l={"X-Request-Id":r,"Content-Type":"application/json; charset=utf-8"};this.addClientHeaders(l);const a=Date.now();this.tracer.restRequest?.({method:s,path:t,url:i,requestId:r,body:o});let u;try{u=await fetch(i,{method:s,headers:l,body:JSON.stringify(n),signal:X0(Y0)})}catch(h){throw this.tracer.restFailure?.({method:s,path:t,requestId:r,phase:"fetch",durationMs:Date.now()-a,error:h}),new Wl({message:`Network error calling ${s} ${t}`,cause:h,method:s,path:t,url:i,requestId:r,phase:"fetch",timeoutMs:Y0,timestamp:Date.now(),durationMs:Date.now()-a})}const c=u.headers.get("content-type")??void 0,d=c?.split(";",1)[0]?.trim().toLowerCase();if(!u.ok||d!=="application/zip"){let h;try{h=await u.clone().json()}catch{}if(this.checkAuthRequired(u,h?.code??0),!u.ok||h!==void 0&&h.code!==0){const k=h?.code??u.status,w=h?.msg??u.statusText;throw this.tracer.restResponse?.({method:s,path:t,requestId:r,status:u.status,durationMs:Date.now()-a,code:k,msg:w,envelopeRequestId:h?.request_id}),new wd({code:k,msg:w,requestId:h?.request_id??r,details:h?.details,timestamp:Date.now(),durationMs:Date.now()-a})}const m=u.clone(),v=new TypeError(`Expected application/zip, received ${c??"no content type"}`);throw this.tracer.restFailure?.({method:s,path:t,requestId:r,phase:"parse",durationMs:Date.now()-a,status:u.status,error:v}),new Wl({message:`Invalid ZIP response from ${s} ${t}`,cause:v,method:s,path:t,url:i,requestId:r,phase:"parse",timeoutMs:Y0,status:u.status,statusText:u.statusText,contentType:c,bodyPreview:await e9(m),timestamp:Date.now(),durationMs:Date.now()-a})}let f;try{f=await u.blob()}catch(h){throw this.tracer.restFailure?.({method:s,path:t,requestId:r,phase:"parse",durationMs:Date.now()-a,status:u.status,error:h}),new Wl({message:`Failed to read ZIP response from ${s} ${t}`,cause:h,method:s,path:t,url:i,requestId:r,phase:"parse",timeoutMs:Y0,status:u.status,statusText:u.statusText,contentType:c,timestamp:Date.now(),durationMs:Date.now()-a})}return this.tracer.restResponse?.({method:s,path:t,requestId:r,status:u.status,durationMs:Date.now()-a,code:0,msg:""}),{blob:f,contentDisposition:u.headers.get("content-disposition")??void 0}}async postForm(t,n){const o=Cd(this.opts.origin,t,this.opts.restBasePath),s=J0(),i={"X-Request-Id":s};this.addClientHeaders(i);const r=Date.now();this.tracer.restRequest?.({method:"POST",path:t,url:o,requestId:s,body:yU(n)});let l;try{l=await fetch(o,{method:"POST",headers:i,body:n,signal:X0()})}catch(c){throw this.tracer.restFailure?.({method:"POST",path:t,requestId:s,phase:"fetch",durationMs:Date.now()-r,error:c}),new Wl({message:`Network error calling POST ${t}`,cause:c,method:"POST",path:t,url:o,requestId:s,phase:"fetch",timeoutMs:hd,timestamp:Date.now(),durationMs:Date.now()-r})}let a;const u=l.clone();try{a=await l.json()}catch(c){throw this.tracer.restFailure?.({method:"POST",path:t,requestId:s,phase:"parse",durationMs:Date.now()-r,status:l.status,error:c}),new Wl({message:`Failed to parse JSON response from POST ${t}`,cause:c,method:"POST",path:t,url:o,requestId:s,phase:"parse",timeoutMs:hd,status:l.status,statusText:l.statusText,contentType:l.headers.get("content-type")??void 0,bodyPreview:await e9(u),timestamp:Date.now(),durationMs:Date.now()-r})}if(this.tracer.restResponse?.({method:"POST",path:t,requestId:s,status:l.status,durationMs:Date.now()-r,code:a.code,msg:a.msg,envelopeRequestId:a.request_id,data:a.data}),this.checkAuthRequired(l,a.code),a.code!==0)throw new wd({code:a.code,msg:a.msg,requestId:a.request_id,details:a.details,timestamp:Date.now(),durationMs:Date.now()-r});return a.data}async patch(t,n){return this.request("PATCH",t,n)}async put(t,n){return this.request("PUT",t,n)}async delete(t){return this.request("DELETE",t)}async request(t,n,o,s,i=[]){let r=Cd(this.opts.origin,n,this.opts.restBasePath);if(s){const h=new URLSearchParams;Bk(h,s);const m=h.toString();m&&(r=`${r}?${m}`)}const l=J0(),a={"X-Request-Id":l};this.addClientHeaders(a),o!==void 0&&(a["Content-Type"]="application/json; charset=utf-8");const u=Date.now();this.tracer.restRequest?.({method:t,path:n,url:r,requestId:l,body:o});let c;try{c=await fetch(r,{method:t,headers:a,body:o!==void 0?JSON.stringify(o):void 0,signal:X0()})}catch(h){throw this.tracer.restFailure?.({method:t,path:n,requestId:l,phase:"fetch",durationMs:Date.now()-u,error:h}),new Wl({message:`Network error calling ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"fetch",timeoutMs:hd,timestamp:Date.now(),durationMs:Date.now()-u})}let d;const f=c.clone();try{const h=await c.text();d=c.status===204&&h===""?{code:0,msg:"",data:null,request_id:l}:JSON.parse(h)}catch(h){throw this.tracer.restFailure?.({method:t,path:n,requestId:l,phase:"parse",durationMs:Date.now()-u,status:c.status,error:h}),new Wl({message:`Failed to parse JSON response from ${t} ${n}`,cause:h,method:t,path:n,url:r,requestId:l,phase:"parse",timeoutMs:hd,status:c.status,statusText:c.statusText,contentType:c.headers.get("content-type")??void 0,bodyPreview:await e9(f),timestamp:Date.now(),durationMs:Date.now()-u})}if(this.tracer.restResponse?.({method:t,path:n,requestId:l,status:c.status,durationMs:Date.now()-u,code:d.code,msg:d.msg,envelopeRequestId:d.request_id,data:d.data}),this.checkAuthRequired(c,d.code),d.code!==0&&!i.includes(d.code))throw new wd({code:d.code,msg:typeof d.msg=="string"&&d.msg.length>0?d.msg:`HTTP ${c.status}${c.statusText?` ${c.statusText}`:""}`,requestId:d.request_id??l,details:d.details,timestamp:Date.now(),durationMs:Date.now()-u});return d.data}addClientHeaders(t){const n=this.opts.credentialStore?.getToken();n!==void 0&&(t.Authorization=`Bearer ${n}`);const o=this.opts.identity;o!==void 0&&(t["X-Kimi-Client-Id"]=o.clientId,t["X-Kimi-Client-Name"]=o.clientName,t["X-Kimi-Client-Version"]=o.clientVersion,t["X-Kimi-Client-Ui-Mode"]=o.clientUiMode)}checkAuthRequired(t,n){(t.status===401||n===PM)&&this.opts.credentialStore?.markAuthRequired?.()}}function DM(e){return{inputTokens:e.input_tokens,outputTokens:e.output_tokens,cacheReadTokens:e.cache_read_tokens,cacheCreationTokens:e.cache_creation_tokens,totalCostUsd:e.total_cost_usd,contextTokens:e.context_tokens,contextLimit:e.context_limit,turnCount:e.turn_count}}function o3(e){return e.contextTokens===0&&e.contextLimit===0&&e.inputTokens===0&&e.outputTokens===0&&e.turnCount===0}function Fr(e){return{id:e.id,title:e.title,createdAt:e.created_at,updatedAt:e.updated_at,busy:e.busy,mainTurnActive:e.main_turn_active,pendingInteraction:e.pending_interaction,lastTurnReason:e.last_turn_reason,archived:e.archived??!1,currentPromptId:e.current_prompt_id,lastPrompt:e.last_prompt,cwd:e.metadata.cwd,model:e.agent_config.model,usage:DM(e.usage),messageCount:e.message_count,lastSeq:e.last_seq,workspaceId:e.workspace_id,parentSessionId:typeof e.metadata.parent_session_id=="string"?e.metadata.parent_session_id:void 0}}function kU(e){const t=e.activity.status;return{id:e.id,title:e.meta.title??e.meta.last_prompt??e.id.slice(0,12),createdAt:new Date(e.meta.created_at).toISOString(),updatedAt:new Date(e.meta.updated_at).toISOString(),busy:t==="running",pendingInteraction:t==="approval"?"approval":t==="question"?"question":void 0,lastTurnReason:t==="failed"?"failed":void 0,archived:e.meta.archived,lastPrompt:e.meta.last_prompt??void 0,cwd:e.workspace.cwd??"",model:"",pullRequest:e.git===void 0?void 0:e.git.pull_request,usage:{inputTokens:0,outputTokens:0,cacheReadTokens:0,cacheCreationTokens:0,totalCostUsd:0,contextTokens:0,contextLimit:0,turnCount:0},messageCount:0,lastSeq:0,workspaceId:e.workspace.id.length>0?e.workspace.id:void 0}}function Pf(e){return{id:e.id,root:e.root,name:e.name,lastOpenedAt:e.last_opened_at,sessionCount:e.session_count}}function zk(e){return e.kind==="base64"?{kind:"base64",mediaType:e.media_type,data:e.data}:e.kind==="file"?{kind:"file",fileId:e.file_id}:{kind:"url",url:e.url}}function ry(e){switch(e.type){case"text":return{type:"text",text:e.text};case"tool_use":return{type:"toolUse",toolCallId:e.tool_call_id,toolName:e.tool_name,input:e.input};case"tool_result":return{type:"toolResult",toolCallId:e.tool_call_id,output:e.output,isError:e.is_error};case"image":return{type:"image",source:zk(e.source)};case"video":return{type:"video",source:zk(e.source)};case"file":return{type:"file",fileId:e.file_id,name:e.name,mediaType:e.media_type,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};default:return{type:"unknown",raw:e}}}function s3(e){return{id:e.id,sessionId:e.session_id,role:e.role,content:e.content.map(ry),createdAt:e.created_at,promptId:e.prompt_id,parentMessageId:e.parent_message_id,metadata:e.metadata}}function BM(e){switch(e.type){case"text":return{type:"text",text:e.text};case"toolUse":return{type:"tool_use",tool_call_id:e.toolCallId,tool_name:e.toolName,input:e.input};case"toolResult":return{type:"tool_result",tool_call_id:e.toolCallId,output:e.output,is_error:e.isError};case"image":case"video":{const t=e.source;let n;return t.kind==="base64"?n={kind:"base64",media_type:t.mediaType,data:t.data}:t.kind==="file"?n={kind:"file",file_id:t.fileId}:n={kind:"url",url:t.url},{type:e.type,source:n}}case"file":return{type:"file",file_id:e.fileId,name:e.name,media_type:e.mediaType,size:e.size};case"thinking":return{type:"thinking",thinking:e.thinking,signature:e.signature};case"unknown":return e.raw}}function bU(e){return{content:e.content.map(BM),metadata:e.metadata,agent_id:e.agentId,model:e.model,thinking:e.thinking,permission_mode:e.permissionMode,plan_mode:e.planMode,swarm_mode:e.swarmMode,goal_objective:e.goalObjective,goal_control:e.goalControl}}function CU(e){return{decision:e.decision,scope:e.scope,feedback:e.feedback,selected_label:e.selectedLabel}}function HM(e){return{approvalId:e.approval_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,toolName:e.tool_name,action:e.action,display:e.tool_input_display??e.display,expiresAt:e.expires_at,createdAt:e.created_at}}function wU(e){return{id:e.id,label:e.label,description:e.description,recommended:e.recommended===!0||e.is_recommended===!0}}function _U(e){return{id:e.id,question:e.question,header:e.header,body:e.body,options:e.options.map(wU),multiSelect:e.multi_select,allowOther:e.allow_other,otherLabel:e.other_label,otherDescription:e.other_description}}function zM(e){return{questionId:e.question_id,sessionId:e.session_id,turnId:e.turn_id,toolCallId:e.tool_call_id,questions:e.questions.map(_U),createdAt:e.created_at}}function xU(e){switch(e.kind){case"single":return{kind:"single",option_id:e.optionId};case"multi":return{kind:"multi",option_ids:e.optionIds};case"other":return{kind:"other",text:e.text};case"multiWithOther":return{kind:"multi_with_other",option_ids:e.optionIds,other_text:e.otherText};case"skipped":return{kind:"skipped"}}}function SU(e){const t={};for(const[n,o]of Object.entries(e.answers))t[n]=xU(o);return{answers:t,method:e.method,note:e.note}}function Hh(e,t){return{id:e.id,agentId:e.agent_id??t,sessionId:e.session_id,kind:e.kind,description:e.description,status:e.status,command:e.command,createdAt:e.created_at,startedAt:e.started_at,completedAt:e.completed_at,outputPreview:e.output_preview,outputBytes:e.output_bytes,subagentPhase:e.subagent_phase,subagentType:e.subagent_type,model:e.model,thinkingEffort:e.thinking_effort,parentToolCallId:e.parent_tool_call_id,suspendedReason:e.suspended_reason,swarmIndex:e.swarm_index,runInBackground:e.run_in_background??(e.kind==="subagent"?!0:void 0)}}function Wk(e){return{path:e.path,name:e.name,kind:e.kind,size:e.size,modifiedAt:e.modified_at,etag:e.etag,mime:e.mime,languageId:e.language_id,isBinary:e.is_binary,isSymlinkTo:e.is_symlink_to,gitStatus:e.git_status,childCount:e.child_count}}function ba(e,t){const n=e[t];return typeof n=="string"?n:void 0}function td(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function pr(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function WM(e){if(!e||typeof e!="object")return null;const t=e,n=ba(t,"status");if(n!=="active"&&n!=="paused"&&n!=="blocked"&&n!=="complete")return null;const o=t.budget,s=o&&typeof o=="object"?o:{};return{goalId:ba(t,"goalId")??ba(t,"goal_id")??"goal",objective:ba(t,"objective")??"",completionCriterion:ba(t,"completionCriterion")??ba(t,"completion_criterion"),status:n,turnsUsed:td(t,"turnsUsed")??td(t,"turns_used")??0,tokensUsed:td(t,"tokensUsed")??td(t,"tokens_used")??0,wallClockMs:td(t,"wallClockMs")??td(t,"wall_clock_ms")??0,terminalReason:ba(t,"terminalReason")??ba(t,"terminal_reason"),budget:{tokenBudget:pr(s,"tokenBudget")??pr(s,"token_budget"),remainingTokens:pr(s,"remainingTokens")??pr(s,"remaining_tokens"),turnBudget:pr(s,"turnBudget")??pr(s,"turn_budget"),remainingTurns:pr(s,"remainingTurns")??pr(s,"remaining_turns"),wallClockBudgetMs:pr(s,"wallClockBudgetMs")??pr(s,"wall_clock_budget_ms"),remainingWallClockMs:pr(s,"remainingWallClockMs")??pr(s,"remaining_wall_clock_ms"),overBudget:s.overBudget===!0||s.over_budget===!0}}}function AU(e){const t=e;switch(e.type){case"event.session.created":return{type:"sessionCreated",session:Fr(t.payload.session)};case"event.session.updated":return{type:"sessionUpdated",session:Fr(t.payload.session),changedFields:t.payload.changed_fields};case"event.session.deleted":return{type:"sessionDeleted",sessionId:t.session_id};case"event.workspace.created":return{type:"workspaceCreated",workspace:Pf(t.payload.workspace)};case"event.workspace.updated":return{type:"workspaceUpdated",workspace:Pf(t.payload.workspace)};case"event.workspace.deleted":return{type:"workspaceDeleted",workspaceId:t.payload.workspace_id,root:t.payload.root};case"event.session.work_changed":return{type:"sessionWorkChanged",sessionId:t.session_id,busy:t.payload.busy,mainTurnActive:t.payload.main_turn_active,pendingInteraction:t.payload.pending_interaction,lastTurnReason:t.payload.last_turn_reason};case"event.session.status_changed":return{type:"sessionWorkChanged",sessionId:t.session_id,busy:t.payload.status!=="idle"&&t.payload.status!=="aborted",mainTurnActive:t.payload.status!=="idle"&&t.payload.status!=="aborted",pendingInteraction:t.payload.status==="awaiting_approval"?"approval":t.payload.status==="awaiting_question"?"question":"none",lastTurnReason:t.payload.status==="aborted"?"cancelled":void 0};case"event.session.usage_updated":return{type:"sessionUsageUpdated",sessionId:t.session_id,usage:DM(t.payload.usage)};case"event.session.history_compacted":return{type:"historyCompacted",sessionId:t.session_id,beforeSeq:t.payload.before_seq,reason:t.payload.reason,summaryMessageId:t.payload.summary_message_id};case"event.goal.updated":{const n=WM(t.payload.snapshot??null);return{type:"goalUpdated",sessionId:t.session_id,goal:n?.status==="complete"?null:n}}case"event.message.created":return{type:"messageCreated",message:s3(t.payload.message)};case"event.message.updated":return{type:"messageUpdated",sessionId:t.session_id,messageId:t.payload.message_id,content:t.payload.content.map(ry),status:t.payload.status};case"event.assistant.delta":return{type:"assistantDelta",sessionId:t.session_id,messageId:t.payload.message_id,contentIndex:t.payload.content_index,delta:t.payload.delta};case"event.assistant.tool_use_started":case"event.assistant.tool_use_delta":case"event.assistant.tool_use_completed":case"event.assistant.completed":case"event.tool.started":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.output":return{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.chunk,stream:t.payload.stream};case"event.tool.progress":return typeof t.payload.message=="string"&&t.payload.message.length>0?{type:"toolOutput",sessionId:t.session_id,toolCallId:t.payload.tool_call_id,outputChunk:t.payload.message,stream:"stdout"}:{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.tool.completed":return{type:"unknown",raw:{_noop:!0,_wireType:t.type}};case"event.approval.requested":return{type:"approvalRequested",sessionId:t.session_id,approval:HM(t.payload)};case"event.approval.resolved":return{type:"approvalResolved",sessionId:t.session_id,approvalId:t.payload.approval_id,decision:t.payload.decision,resolvedAt:t.payload.resolved_at};case"event.approval.expired":return{type:"approvalExpired",sessionId:t.session_id,approvalId:t.payload.approval_id};case"event.question.requested":return{type:"questionRequested",sessionId:t.session_id,question:zM(t.payload)};case"event.question.answered":return{type:"questionAnswered",sessionId:t.session_id,questionId:t.payload.question_id,resolvedAt:t.payload.resolved_at};case"event.question.dismissed":return{type:"questionDismissed",sessionId:t.session_id,questionId:t.payload.question_id,dismissedAt:t.payload.dismissed_at};case"event.task.created":return{type:"taskCreated",sessionId:t.session_id,task:Hh(t.payload.task)};case"event.task.progress":return{type:"taskProgress",sessionId:t.session_id,taskId:t.payload.task_id,outputChunk:t.payload.output_chunk,stream:t.payload.stream};case"event.task.completed":return{type:"taskCompleted",sessionId:t.session_id,taskId:t.payload.task_id,status:t.payload.status,outputPreview:t.payload.output_preview,outputBytes:t.payload.output_bytes};case"event.config.changed":return{type:"configChanged",changedFields:t.payload.changed_fields,config:i3(t.payload.config)};case"event.model_catalog.changed":return{type:"modelCatalogChanged",changed:t.payload.changed.map(n=>({providerId:n.provider_id,providerName:n.provider_name,added:n.added,removed:n.removed})),unchanged:t.payload.unchanged,failed:t.payload.failed};default:return{type:"unknown",raw:e}}}function MU(e){return{id:e.model,provider:e.provider,model:e.model,displayName:e.display_name,maxContextSize:e.max_context_size,capabilities:e.capabilities,supportEfforts:e.support_efforts,defaultEffort:e.default_effort}}function nd(e){return{id:e.id,type:e.type,baseUrl:e.base_url,defaultModel:e.default_model,hasApiKey:e.has_api_key,status:e.status,models:e.models}}function Uk(e){return{id:e.id,name:e.name,wireType:e.wire_type,guessed:e.guessed,needsBaseUrl:e.needs_base_url,rejected:e.rejected,rejectReason:e.reject_reason,envKey:e.env_key,models:e.models.map(t=>({id:t.id,name:t.name,maxContextSize:t.max_context_size,capabilities:t.capabilities,reasoning:t.reasoning}))}}function i3(e){const t={};for(const[n,o]of Object.entries(e.providers))t[n]={type:o.type,baseUrl:o.base_url,defaultModel:o.default_model,hasApiKey:o.has_api_key};return{providers:t,defaultProvider:e.default_provider,defaultModel:e.default_model,secondaryModel:e.secondary_model,models:e.models,thinking:e.thinking,planMode:e.plan_mode,yolo:e.yolo,defaultPermissionMode:e.default_permission_mode,defaultPlanMode:e.default_plan_mode,permission:e.permission,hooks:e.hooks,services:e.services,mergeAllAvailableSkills:e.merge_all_available_skills,extraSkillDirs:e.extra_skill_dirs,loopControl:e.loop_control,background:e.background,experimental:e.experimental,telemetry:e.telemetry,raw:e.raw}}function TU(e){return e.session_id}function EU(e){return e.seq}function IU(e){const t=Number(e.slice(1));return Number.isFinite(t)?t:0}const LU={items:[],tasks:new Map,interactions:new Map,attachments:new Map,todos:new Map,prompts:new Map,meta:{},pendingInteractions:new Set,hasMoreOlder:!1};function $U(e,t){switch(t.op){case"reset":return NU(e,t);case"turn.upsert":return RU(e,t.turn);case"step.upsert":return PU(e,t.turnId,t.step);case"frame.upsert":return BU(e,t);case"append":return zU(e,t);case"marker.upsert":return Vk(e,t.item,t.item.markerId,t.beforeTurn);case"taskref.upsert":return Vk(e,t.item,t.item.refId,t.beforeTurn);case"task.upsert":return jU(e,t.task);case"interaction.upsert":return VU(e,t.interaction);case"attachment.upsert":return KU(e,t.attachment);case"todo.upsert":return GU(e,t.todo);case"prompt.upsert":return XU(e,t.prompt);case"meta.merge":return ej(e,t.meta);case"items.remove":return UU(e,t.ids)}}function NU(e,t){const n=new Set;for(const o of t.snapshot.interactions)o.state==="pending"&&n.add(o.interactionId);return{state:{items:t.snapshot.items,tasks:new Map(t.snapshot.tasks.map(o=>[o.taskId,o])),interactions:new Map(t.snapshot.interactions.map(o=>[o.interactionId,o])),attachments:new Map(t.snapshot.attachments.map(o=>[o.attachmentId,o])),todos:new Map(t.snapshot.todos.map(o=>[o.todoId,o])),prompts:new Map(t.snapshot.prompts.map(o=>[o.promptId,o])),meta:t.snapshot.meta,pendingInteractions:n,hasMoreOlder:t.snapshot.hasMoreOlder??!1},changed:!0}}function jk(e,t){return{...e,kind:"turn",steps:[...t]}}function UM(e){return{kind:"turn",turnId:e,ordinal:IU(e),state:"running",origin:{kind:"other"},steps:[]}}function FU(e,t){const n=Number(e.slice(t.length+1))||0;return{kind:"step",stepId:e,turnId:t,ordinal:n,state:"running",frames:[]}}function n1(e,t){const n=e.items.find(o=>o.kind==="turn"&&o.turnId===t);return n?.kind==="turn"?n:void 0}function ly(e,t){const n=[...e];let o=n.length;for(let s=0;st.ordinal){o=s;break}}return n.splice(o,0,t),n}function r2(e,t,n){return e.map(o=>o.kind==="turn"&&o.turnId===t?n(o):o)}function RU(e,t){const n=n1(e,t.turnId);return n?OU(n,t)?{state:e,changed:!1}:{state:{...e,items:r2(e.items,t.turnId,o=>jk(t,o.steps))},changed:!0}:{state:{...e,items:ly(e.items,jk(t,[]))},changed:!0}}function OU(e,t){return e.ordinal===t.ordinal&&e.state===t.state&&e.prompt===t.prompt&&e.attachmentIds===t.attachmentIds&&e.startedAt===t.startedAt&&e.endedAt===t.endedAt&&e.origin.kind===t.origin.kind&&e.origin.payload===t.origin.payload&&e.usage===t.usage&&e.durationMs===t.durationMs&&e.error===t.error}function PU(e,t,n){const o=n1(e,t)??UM(t),s=o.steps.findIndex(u=>u.stepId===n.stepId);let i,r=!0;if(s>=0){const u=o.steps[s];u&&DU(u,n)?(r=!1,i=o.steps):i=o.steps.map(c=>c.stepId===n.stepId?{...n,kind:"step",frames:c.frames}:c)}else i=[...o.steps,{...n,kind:"step",frames:[]}].toSorted((u,c)=>u.ordinal-c.ordinal);if(!r)return{state:e,changed:!1};const l={...o,steps:[...i]},a=n1(e,t)?r2(e.items,t,()=>l):ly(e.items,l);return{state:{...e,items:a},changed:!0}}function DU(e,t){return e.ordinal===t.ordinal&&e.state===t.state&&e.startedAt===t.startedAt&&e.endedAt===t.endedAt&&e.usage===t.usage&&e.finishReason===t.finishReason&&e.timing===t.timing&&e.retry===t.retry&&e.endReason===t.endReason&&e.endMessage===t.endMessage}function BU(e,t){const n=n1(e,t.turnId)??UM(t.turnId),o=n.steps.find(c=>c.stepId===t.stepId)??FU(t.stepId,t.turnId),s=o.frames.findIndex(c=>c.frameId===t.frame.frameId);let i;if(s>=0){const c=o.frames[s];if(c!==void 0&&HU(c,t.frame))return{state:e,changed:!1};i=o.frames.map(d=>d.frameId===t.frame.frameId?t.frame:d)}else i=[...o.frames,t.frame];const r={...o,frames:[...i]},l=n.steps.some(c=>c.stepId===t.stepId)?n.steps.map(c=>c.stepId===t.stepId?r:c):[...n.steps,r].toSorted((c,d)=>c.ordinal-d.ordinal),a={...n,steps:l},u=n1(e,t.turnId)?r2(e.items,t.turnId,()=>a):ly(e.items,a);return{state:{...e,items:u},changed:!0}}function HU(e,t){return e.kind!==t.kind?!1:e.kind==="text"&&t.kind==="text"?e.text===t.text&&e.role===t.role&&e.attachmentIds===t.attachmentIds&&e.taskId===t.taskId:e.kind==="thinking"&&t.kind==="thinking"?e.text===t.text:e.kind==="tool"&&t.kind==="tool"?e.state===t.state&&e.toolCallId===t.toolCallId&&e.name===t.name&&e.view===t.view&&e.input===t.input&&e.output===t.output&&e.display===t.display&&e.error===t.error&&e.inputText===t.inputText&&e.progress===t.progress&&e.taskId===t.taskId&&e.approvalId===t.approvalId&&e.todoId===t.todoId&&e.agentRefs===t.agentRefs:e.kind==="notice"&&t.kind==="notice"?e.message===t.message&&e.level===t.level&&e.detail===t.detail:!1}function zU(e,t){if(t.target.type==="task")return WU(e,t);const{turnId:n,stepId:o,frameId:s}=t.target,i=n1(e,n),r=i?.steps.find(f=>f.stepId===o),l=r?.frames.find(f=>f.frameId===s);if(!i||!r||!l||l.kind!=="text"&&l.kind!=="thinking")return{state:e,changed:!1,gap:{expected:0,got:t.offset}};const a=jM(l.text,t.offset,t.text);if(a.gap)return{state:e,changed:!1,gap:a.gap};if(!a.changed)return{state:e,changed:!1};const u={...l,text:a.text},c={...r,frames:r.frames.map(f=>f.frameId===s?u:f)},d={...i,steps:i.steps.map(f=>f.stepId===o?c:f)};return{state:{...e,items:r2(e.items,n,()=>d)},changed:!0}}function WU(e,t){if(t.target.type!=="task")throw new Error("unreachable");const n=t.target.taskId,o=e.tasks.get(n),s=o?.outputTail??"",i=jM(s,t.offset,t.text);if(i.gap)return{state:e,changed:!1,gap:i.gap};if(!i.changed)return{state:e,changed:!1};const r=o?{...o,outputTail:i.text}:{taskId:n,kind:"other",state:"running",detached:!1,outputTail:i.text},l=new Map(e.tasks);return l.set(n,r),{state:{...e,tasks:l},changed:!0}}function jM(e,t,n){if(t>e.length)return{text:e,changed:!1,gap:{expected:e.length,got:t}};if(e.slice(t,t+n.length)===n)return{text:e,changed:!1};const o=e.length-t;return e.slice(t)!==n.slice(0,o)?{text:e,changed:!1,gap:{expected:e.length,got:t}}:(o>0?n.slice(o):n).length===0?{text:e,changed:!1}:{text:e.slice(0,t)+n,changed:!0}}function Vk(e,t,n,o){if(e.items.some(i=>r3(i)===n)){let i=!1;const r=e.items.map(l=>r3(l)!==n||l===t?l:(i=!0,t));return i?{state:{...e,items:r},changed:!0}:{state:e,changed:!1}}if(o!==void 0){const i=[...e.items];let r=i.length;for(let l=0;l=o){r=l;break}}return i.splice(r,0,t),{state:{...e,items:i},changed:!0}}return{state:{...e,items:[...e.items,t]},changed:!0}}function r3(e){switch(e.kind){case"turn":return e.turnId;case"marker":return e.markerId;case"taskref":return e.refId}}function UU(e,t){const n=new Set(t),o=e.items.filter(l=>l.kind==="turn"&&n.has(l.turnId)),s=e.items.filter(l=>!n.has(r3(l)));if(s.length===e.items.length)return{state:e,changed:!1};let i=e.pendingInteractions,r=e.interactions;if(o.length>0){const l=new Set,a=new Set(i),u=new Set;for(const c of o)for(const d of c.steps)for(const f of d.frames)f.kind==="tool"&&l.add(f.toolCallId);for(const c of r.values())c.toolCallId!==void 0&&l.has(c.toolCallId)&&(u.add(c.interactionId),a.delete(c.interactionId));if(u.size>0){const c=new Map(r);for(const d of u)c.delete(d);r=c}i=a}return{state:{...e,items:s,interactions:r,pendingInteractions:i},changed:!0}}function jU(e,t){const n=e.tasks.get(t.taskId);if(n&&QU(n,t))return{state:e,changed:!1};const o=new Map(e.tasks);return o.set(t.taskId,t),{state:{...e,tasks:o},changed:!0}}function VU(e,t){const n=e.interactions.get(t.interactionId);if(n&&qU(n,t))return{state:e,changed:!1};const o=new Map(e.interactions);o.set(t.interactionId,t);let s=e.pendingInteractions;if(t.state==="pending"){if(!s.has(t.interactionId)){const i=new Set(s);i.add(t.interactionId),s=i}}else if(s.has(t.interactionId)){const i=new Set(s);i.delete(t.interactionId),s=i}return{state:{...e,interactions:o,pendingInteractions:s},changed:!0}}function qU(e,t){return e.interactionKind===t.interactionKind&&e.toolCallId===t.toolCallId&&e.state===t.state&&e.request===t.request&&e.response===t.response}function KU(e,t){const n=e.attachments.get(t.attachmentId);if(n&&ZU(n,t))return{state:e,changed:!1};const o=new Map(e.attachments);return o.set(t.attachmentId,t),{state:{...e,attachments:o},changed:!0}}function ZU(e,t){return e.mediaType===t.mediaType&&e.name===t.name&&e.size===t.size&&e.source===t.source&&e.placeholder===t.placeholder}function GU(e,t){const n=e.todos.get(t.todoId);if(n&&YU(n,t))return{state:e,changed:!1};const o=new Map(e.todos);return o.set(t.todoId,t),{state:{...e,todos:o},changed:!0}}function YU(e,t){return e.items===t.items&&e.updatedAt===t.updatedAt}function XU(e,t){const n=e.prompts.get(t.promptId);if(n&&JU(n,t))return{state:e,changed:!1};const o=new Map(e.prompts);return o.set(t.promptId,t),{state:{...e,prompts:o},changed:!0}}function JU(e,t){return e.status===t.status&&e.userMessageId===t.userMessageId&&e.content===t.content&&e.createdAt===t.createdAt&&e.finishedAt===t.finishedAt&&e.steeredAt===t.steeredAt}function QU(e,t){return e.kind===t.kind&&e.state===t.state&&e.detached===t.detached&&e.description===t.description&&e.agentId===t.agentId&&e.outputTail===t.outputTail&&e.startedAt===t.startedAt&&e.endedAt===t.endedAt&&e.resultSummary===t.resultSummary&&e.error===t.error&&e.stateReason===t.stateReason&&e.usage===t.usage}function ej(e,t){const n=t.modes!==void 0?{plan:t.modes.plan===null?void 0:t.modes.plan??e.meta.modes?.plan,swarm:t.modes.swarm===null?void 0:t.modes.swarm??e.meta.modes?.swarm}:e.meta.modes,o=t.agent!==void 0?{...e.meta.agent,...t.agent}:e.meta.agent,s={goal:t.goal??e.meta.goal,activity:t.activity??e.meta.activity,modes:n!==void 0&&n.plan===void 0&&n.swarm===void 0?void 0:n,agent:o};return s.goal===e.meta.goal&&s.activity===e.meta.activity&&s.modes===e.meta.modes&&s.agent===e.meta.agent?{state:e,changed:!1}:{state:{...e,meta:s},changed:!0}}class tj{constructor(t){this.agentId=t}#e=LU;#t=new Set;receive(t){return this.apply(t)}apply(t){const n=[];let o,s=this.#e;for(const i of t){const r=$U(s,i);if(r.gap){o={target:i.target,...r.gap};continue}r.changed&&(s=r.state,n.push(i))}if(this.#e=s,n.length>0){const i={agentId:this.agentId,ops:n};for(const r of this.#t)r(i)}return{accepted:n,gap:o}}onChange(t){return this.#t.add(t),{dispose:()=>void this.#t.delete(t)}}getItems(){return this.#e.items}getTurn(t){const n=this.#e.items.find(o=>o.kind==="turn"&&o.turnId===t);return n?.kind==="turn"?n:void 0}getTasks(){return this.#e.tasks}getTask(t){return this.#e.tasks.get(t)}getInteractions(){return this.#e.interactions}getInteraction(t){return this.#e.interactions.get(t)}getAttachments(){return this.#e.attachments}getAttachment(t){return this.#e.attachments.get(t)}getTodos(){return this.#e.todos}getTodo(t){return this.#e.todos.get(t)}getPrompts(){return this.#e.prompts}getPrompt(t){return this.#e.prompts.get(t)}getMeta(){return this.#e.meta}listPendingInteractions(){return[...this.#e.pendingInteractions]}get hasMoreOlder(){return this.#e.hasMoreOlder}snapshot(t){let n=this.#e.items,o=this.#e.hasMoreOlder;if(t!==void 0){const s=n.reduce((i,r)=>r.kind==="turn"?i+1:i,0);if(s>t.tailTurns){const i=s-t.tailTurns,r=[];let l=0;for(const a of n)if(a.kind==="turn"){if(l+=1,l<=i)continue;r.push(a)}else l>i&&r.push(a);n=r,o=!0}}return{items:n,tasks:[...this.#e.tasks.values()],interactions:[...this.#e.interactions.values()],attachments:[...this.#e.attachments.values()],todos:[...this.#e.todos.values()],prompts:[...this.#e.prompts.values()],meta:this.#e.meta,hasMoreOlder:o}}}function ct(e,t,n){function o(l,a){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:a,constr:r,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,a);const u=r.prototype,c=Object.keys(u);for(let d=0;dn?.Parent&&l instanceof n.Parent?!0:l?._zod?.traits?.has(e)}),Object.defineProperty(r,"name",{value:e}),r}class Bd extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class VM extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const qM={};function Xa(e){return qM}function KM(e){const t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,s])=>t.indexOf(+o)===-1).map(([o,s])=>s)}function l3(e,t){return typeof t=="bigint"?t.toString():t}function l2(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function ay(e){return e==null}function uy(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function nj(e,t){const n=(e.toString().split(".")[1]||"").length,o=t.toString();let s=(o.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(o)){const a=o.match(/\d?e-(\d?)/);a?.[1]&&(s=Number.parseInt(a[1]))}const i=n>s?n:s,r=Number.parseInt(e.toFixed(i).replace(".","")),l=Number.parseInt(t.toFixed(i).replace(".",""));return r%l/10**i}const qk=Symbol("evaluating");function Jn(e,t,n){let o;Object.defineProperty(e,t,{get(){if(o!==qk)return o===void 0&&(o=qk,o=n()),o},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function Mc(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function uu(...e){const t={};for(const n of e){const o=Object.getOwnPropertyDescriptors(n);Object.assign(t,o)}return Object.defineProperties({},t)}function Kk(e){return JSON.stringify(e)}function oj(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ZM="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function yp(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const sj=l2(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function o1(e){if(yp(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(yp(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function GM(e){return o1(e)?{...e}:Array.isArray(e)?[...e]:e}const ij=new Set(["string","number","symbol"]);function s1(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function cu(e,t,n){const o=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(o._zod.parent=e),o}function Jt(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function rj(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const lj={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function aj(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=uu(e._zod.def,{get shape(){const r={};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&(r[l]=n.shape[l])}return Mc(this,"shape",r),r},checks:[]});return cu(e,i)}function uj(e,t){const n=e._zod.def,o=n.checks;if(o&&o.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=uu(e._zod.def,{get shape(){const r={...e._zod.def.shape};for(const l in t){if(!(l in n.shape))throw new Error(`Unrecognized key: "${l}"`);t[l]&&delete r[l]}return Mc(this,"shape",r),r},checks:[]});return cu(e,i)}function cj(e,t){if(!o1(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const r in t)if(Object.getOwnPropertyDescriptor(i,r)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const s=uu(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Mc(this,"shape",i),i}});return cu(e,s)}function dj(e,t){if(!o1(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=uu(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t};return Mc(this,"shape",o),o}});return cu(e,n)}function fj(e,t){const n=uu(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return Mc(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:[]});return cu(e,n)}function pj(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const r=uu(t._zod.def,{get shape(){const l=t._zod.def.shape,a={...l};if(n)for(const u in n){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(a[u]=e?new e({type:"optional",innerType:l[u]}):l[u])}else for(const u in l)a[u]=e?new e({type:"optional",innerType:l[u]}):l[u];return Mc(this,"shape",a),a},checks:[]});return cu(t,r)}function hj(e,t,n){const o=uu(t._zod.def,{get shape(){const s=t._zod.def.shape,i={...s};if(n)for(const r in n){if(!(r in i))throw new Error(`Unrecognized key: "${r}"`);n[r]&&(i[r]=new e({type:"nonoptional",innerType:s[r]}))}else for(const r in s)i[r]=new e({type:"nonoptional",innerType:s[r]});return Mc(this,"shape",i),i}});return cu(t,o)}function _d(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n{var o;return(o=n).path??(o.path=[]),n.path.unshift(e),n})}function Q0(e){return typeof e=="string"?e:e?.message}function Ja(e,t,n){const o={...e,path:e.path??[]};if(!e.message){const s=Q0(e.inst?._zod.def?.error?.(e))??Q0(t?.error?.(e))??Q0(n.customError?.(e))??Q0(n.localeError?.(e))??"Invalid input";o.message=s}return delete o.inst,delete o.continue,t?.reportInput||delete o.input,o}function cy(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function kp(...e){const[t,n,o]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:o}:{...t}}const YM=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,l3,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},XM=ct("$ZodError",YM),JM=ct("$ZodError",YM,{Parent:Error});function mj(e,t=n=>n.message){const n={},o=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):o.push(t(s));return{formErrors:o,fieldErrors:n}}function gj(e,t=n=>n.message){const n={_errors:[]},o=s=>{for(const i of s.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(r=>o({issues:r}));else if(i.code==="invalid_key")o({issues:i.issues});else if(i.code==="invalid_element")o({issues:i.issues});else if(i.path.length===0)n._errors.push(t(i));else{let r=n,l=0;for(;l(t,n,o,s)=>{const i=o?Object.assign(o,{async:!1}):{async:!1},r=t._zod.run({value:n,issues:[]},i);if(r instanceof Promise)throw new Bd;if(r.issues.length){const l=new(s?.Err??e)(r.issues.map(a=>Ja(a,i,Xa())));throw ZM(l,s?.callee),l}return r.value},fy=e=>async(t,n,o,s)=>{const i=o?Object.assign(o,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},i);if(r instanceof Promise&&(r=await r),r.issues.length){const l=new(s?.Err??e)(r.issues.map(a=>Ja(a,i,Xa())));throw ZM(l,s?.callee),l}return r.value},a2=e=>(t,n,o)=>{const s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Bd;return i.issues.length?{success:!1,error:new(e??XM)(i.issues.map(r=>Ja(r,s,Xa())))}:{success:!0,data:i.value}},vj=a2(JM),u2=e=>async(t,n,o)=>{const s=o?Object.assign(o,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(r=>Ja(r,s,Xa())))}:{success:!0,data:i.value}},yj=u2(JM),kj=e=>(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return dy(e)(t,n,s)},bj=e=>(t,n,o)=>dy(e)(t,n,o),Cj=e=>async(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return fy(e)(t,n,s)},wj=e=>async(t,n,o)=>fy(e)(t,n,o),_j=e=>(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return a2(e)(t,n,s)},xj=e=>(t,n,o)=>a2(e)(t,n,o),Sj=e=>async(t,n,o)=>{const s=o?Object.assign(o,{direction:"backward"}):{direction:"backward"};return u2(e)(t,n,s)},Aj=e=>async(t,n,o)=>u2(e)(t,n,o),Mj=/^[cC][^\s-]{8,}$/,Tj=/^[0-9a-z]+$/,Ej=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ij=/^[0-9a-vA-V]{20}$/,Lj=/^[A-Za-z0-9]{27}$/,$j=/^[a-zA-Z0-9_-]{21}$/,Nj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Fj=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Zk=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Rj=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Oj="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Pj(){return new RegExp(Oj,"u")}const Dj=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Bj=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Hj=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,zj=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Wj=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,QM=/^[A-Za-z0-9_-]*$/,Uj=/^\+[1-9]\d{6,14}$/,eT="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",jj=new RegExp(`^${eT}$`);function tT(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Vj(e){return new RegExp(`^${tT(e)}$`)}function qj(e){const t=tT({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const o=`${t}(?:${n.join("|")})`;return new RegExp(`^${eT}T(?:${o})$`)}const Kj=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Zj=/^-?\d+$/,nT=/^-?\d+(?:\.\d+)?$/,Gj=/^(?:true|false)$/i,Yj=/^[^A-Z]*$/,Xj=/^[^a-z]*$/,qi=ct("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),oT={number:"number",bigint:"bigint",object:"date"},sT=ct("$ZodCheckLessThan",(e,t)=>{qi.init(e,t);const n=oT[typeof t.value];e._zod.onattach.push(o=>{const s=o._zod.bag,i=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?o.value<=t.value:o.value{qi.init(e,t);const n=oT[typeof t.value];e._zod.onattach.push(o=>{const s=o._zod.bag,i=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>i&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=o=>{(t.inclusive?o.value>=t.value:o.value>t.value)||o.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:o.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Jj=ct("$ZodCheckMultipleOf",(e,t)=>{qi.init(e,t),e._zod.onattach.push(n=>{var o;(o=n._zod.bag).multipleOf??(o.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):nj(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Qj=ct("$ZodCheckNumberFormat",(e,t)=>{qi.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),o=n?"int":"number",[s,i]=lj[t.format];e._zod.onattach.push(r=>{const l=r._zod.bag;l.format=t.format,l.minimum=s,l.maximum=i,n&&(l.pattern=Zj)}),e._zod.check=r=>{const l=r.value;if(n){if(!Number.isInteger(l)){r.issues.push({expected:o,format:t.format,code:"invalid_type",continue:!1,input:l,inst:e});return}if(!Number.isSafeInteger(l)){l>0?r.issues.push({input:l,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort}):r.issues.push({input:l,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:o,inclusive:!0,continue:!t.abort});return}}li&&r.issues.push({origin:"number",input:l,code:"too_big",maximum:i,inclusive:!0,inst:e,continue:!t.abort})}}),eV=ct("$ZodCheckMaxLength",(e,t)=>{var n;qi.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!ay(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const s=o.value;if(s.length<=t.maximum)return;const r=cy(s);o.issues.push({origin:r,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),tV=ct("$ZodCheckMinLength",(e,t)=>{var n;qi.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!ay(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(o._zod.bag.minimum=t.minimum)}),e._zod.check=o=>{const s=o.value;if(s.length>=t.minimum)return;const r=cy(s);o.issues.push({origin:r,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),nV=ct("$ZodCheckLengthEquals",(e,t)=>{var n;qi.init(e,t),(n=e._zod.def).when??(n.when=o=>{const s=o.value;return!ay(s)&&s.length!==void 0}),e._zod.onattach.push(o=>{const s=o._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=o=>{const s=o.value,i=s.length;if(i===t.length)return;const r=cy(s),l=i>t.length;o.issues.push({origin:r,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:o.value,inst:e,continue:!t.abort})}}),c2=ct("$ZodCheckStringFormat",(e,t)=>{var n,o;qi.init(e,t),e._zod.onattach.push(s=>{const i=s._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),oV=ct("$ZodCheckRegex",(e,t)=>{c2.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),sV=ct("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Yj),c2.init(e,t)}),iV=ct("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Xj),c2.init(e,t)}),rV=ct("$ZodCheckIncludes",(e,t)=>{qi.init(e,t);const n=s1(t.includes),o=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=o,e._zod.onattach.push(s=>{const i=s._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(o)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),lV=ct("$ZodCheckStartsWith",(e,t)=>{qi.init(e,t);const n=new RegExp(`^${s1(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.startsWith(t.prefix)||o.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:o.value,inst:e,continue:!t.abort})}}),aV=ct("$ZodCheckEndsWith",(e,t)=>{qi.init(e,t);const n=new RegExp(`.*${s1(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(o=>{const s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=o=>{o.value.endsWith(t.suffix)||o.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:o.value,inst:e,continue:!t.abort})}}),uV=ct("$ZodCheckOverwrite",(e,t)=>{qi.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class cV{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const o=t.split(` +`).filter(r=>r),s=Math.min(...o.map(r=>r.length-r.trimStart().length)),i=o.map(r=>r.slice(s)).map(r=>" ".repeat(this.indent*2)+r);for(const r of i)this.content.push(r)}compile(){const t=Function,n=this?.args,s=[...(this?.content??[""]).map(i=>` ${i}`)];return new t(...n,s.join(` +`))}}const dV={major:4,minor:3,patch:6},No=ct("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=dV;const o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(const s of o)for(const i of s._zod.onattach)i(e);if(o.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(r,l,a)=>{let u=_d(r),c;for(const d of l){if(d._zod.def.when){if(!d._zod.def.when(r))continue}else if(u)continue;const f=r.issues.length,h=d._zod.check(r);if(h instanceof Promise&&a?.async===!1)throw new Bd;if(c||h instanceof Promise)c=(c??Promise.resolve()).then(async()=>{await h,r.issues.length!==f&&(u||(u=_d(r,f)))});else{if(r.issues.length===f)continue;u||(u=_d(r,f))}}return c?c.then(()=>r):r},i=(r,l,a)=>{if(_d(r))return r.aborted=!0,r;const u=s(l,o,a);if(u instanceof Promise){if(a.async===!1)throw new Bd;return u.then(c=>e._zod.parse(c,a))}return e._zod.parse(u,a)};e._zod.run=(r,l)=>{if(l.skipChecks)return e._zod.parse(r,l);if(l.direction==="backward"){const u=e._zod.parse({value:r.value,issues:[]},{...l,skipChecks:!0});return u instanceof Promise?u.then(c=>i(c,r,l)):i(u,r,l)}const a=e._zod.parse(r,l);if(a instanceof Promise){if(l.async===!1)throw new Bd;return a.then(u=>s(u,o,l))}return s(a,o,l)}}Jn(e,"~standard",()=>({validate:s=>{try{const i=vj(e,s);return i.success?{value:i.data}:{issues:i.error?.issues}}catch{return yj(e,s).then(r=>r.success?{value:r.data}:{issues:r.error?.issues})}},vendor:"zod",version:1}))}),py=ct("$ZodString",(e,t)=>{No.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Kj(e._zod.bag),e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Mo=ct("$ZodStringFormat",(e,t)=>{c2.init(e,t),py.init(e,t)}),fV=ct("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Fj),Mo.init(e,t)}),pV=ct("$ZodUUID",(e,t)=>{if(t.version){const o={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(o===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Zk(o))}else t.pattern??(t.pattern=Zk());Mo.init(e,t)}),hV=ct("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Rj),Mo.init(e,t)}),mV=ct("$ZodURL",(e,t)=>{Mo.init(e,t),e._zod.check=n=>{try{const o=n.value.trim(),s=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=s.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),gV=ct("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Pj()),Mo.init(e,t)}),vV=ct("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=$j),Mo.init(e,t)}),yV=ct("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Mj),Mo.init(e,t)}),kV=ct("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Tj),Mo.init(e,t)}),bV=ct("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ej),Mo.init(e,t)}),CV=ct("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Ij),Mo.init(e,t)}),wV=ct("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Lj),Mo.init(e,t)}),_V=ct("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qj(t)),Mo.init(e,t)}),xV=ct("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=jj),Mo.init(e,t)}),SV=ct("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Vj(t)),Mo.init(e,t)}),AV=ct("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Nj),Mo.init(e,t)}),MV=ct("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Dj),Mo.init(e,t),e._zod.bag.format="ipv4"}),TV=ct("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Bj),Mo.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),EV=ct("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Hj),Mo.init(e,t)}),IV=ct("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=zj),Mo.init(e,t),e._zod.check=n=>{const o=n.value.split("/");try{if(o.length!==2)throw new Error;const[s,i]=o;if(!i)throw new Error;const r=Number(i);if(`${r}`!==i)throw new Error;if(r<0||r>128)throw new Error;new URL(`http://[${s}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function rT(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const LV=ct("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Wj),Mo.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{rT(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function $V(e){if(!QM.test(e))return!1;const t=e.replace(/[-_]/g,o=>o==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return rT(n)}const NV=ct("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=QM),Mo.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{$V(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),FV=ct("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Uj),Mo.init(e,t)});function RV(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[o]=n;if(!o)return!1;const s=JSON.parse(atob(o));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const OV=ct("$ZodJWT",(e,t)=>{Mo.init(e,t),e._zod.check=n=>{RV(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),lT=ct("$ZodNumber",(e,t)=>{No.init(e,t),e._zod.pattern=e._zod.bag.pattern??nT,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const s=n.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return n;const i=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...i?{received:i}:{}}),n}}),PV=ct("$ZodNumberFormat",(e,t)=>{Qj.init(e,t),lT.init(e,t)}),DV=ct("$ZodBoolean",(e,t)=>{No.init(e,t),e._zod.pattern=Gj,e._zod.parse=(n,o)=>{if(t.coerce)try{n.value=!!n.value}catch{}const s=n.value;return typeof s=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:s,inst:e}),n}}),BV=ct("$ZodUnknown",(e,t)=>{No.init(e,t),e._zod.parse=n=>n}),HV=ct("$ZodNever",(e,t)=>{No.init(e,t),e._zod.parse=(n,o)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Gk(e,t,n){e.issues.length&&t.issues.push(...xd(n,e.issues)),t.value[n]=e.value}const zV=ct("$ZodArray",(e,t)=>{No.init(e,t),e._zod.parse=(n,o)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const i=[];for(let r=0;rGk(u,n,r))):Gk(a,n,r)}return i.length?Promise.all(i).then(()=>n):n}});function Fm(e,t,n,o,s){if(e.issues.length){if(s&&!(n in o))return;t.issues.push(...xd(n,e.issues))}e.value===void 0?n in o&&(t.value[n]=void 0):t.value[n]=e.value}function aT(e){const t=Object.keys(e.shape);for(const o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);const n=rj(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function uT(e,t,n,o,s,i){const r=[],l=s.keySet,a=s.catchall._zod,u=a.def.type,c=a.optout==="optional";for(const d in t){if(l.has(d))continue;if(u==="never"){r.push(d);continue}const f=a.run({value:t[d],issues:[]},o);f instanceof Promise?e.push(f.then(h=>Fm(h,n,d,t,c))):Fm(f,n,d,t,c)}return r.length&&n.issues.push({code:"unrecognized_keys",keys:r,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const WV=ct("$ZodObject",(e,t)=>{if(No.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const l=t.shape;Object.defineProperty(t,"shape",{get:()=>{const a={...l};return Object.defineProperty(t,"shape",{value:a}),a}})}const o=l2(()=>aT(t));Jn(e._zod,"propValues",()=>{const l=t.shape,a={};for(const u in l){const c=l[u]._zod;if(c.values){a[u]??(a[u]=new Set);for(const d of c.values)a[u].add(d)}}return a});const s=yp,i=t.catchall;let r;e._zod.parse=(l,a)=>{r??(r=o.value);const u=l.value;if(!s(u))return l.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),l;l.value={};const c=[],d=r.shape;for(const f of r.keys){const h=d[f],m=h._zod.optout==="optional",v=h._zod.run({value:u[f],issues:[]},a);v instanceof Promise?c.push(v.then(k=>Fm(k,l,f,u,m))):Fm(v,l,f,u,m)}return i?uT(c,u,l,a,o.value,e):c.length?Promise.all(c).then(()=>l):l}}),UV=ct("$ZodObjectJIT",(e,t)=>{WV.init(e,t);const n=e._zod.parse,o=l2(()=>aT(t)),s=f=>{const h=new cV(["shape","payload","ctx"]),m=o.value,v=_=>{const g=Kk(_);return`shape[${g}]._zod.run({ value: input[${g}], issues: [] }, ctx)`};h.write("const input = payload.value;");const k=Object.create(null);let w=0;for(const _ of m.keys)k[_]=`key_${w++}`;h.write("const newResult = {};");for(const _ of m.keys){const g=k[_],x=Kk(_),T=f[_]?._zod?.optout==="optional";h.write(`const ${g} = ${v(_)};`),T?h.write(` + if (${g}.issues.length) { + if (${x} in input) { + payload.issues = payload.issues.concat(${g}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${x}, ...iss.path] : [${x}] + }))); + } + } + + if (${g}.value === undefined) { + if (${x} in input) { + newResult[${x}] = undefined; + } + } else { + newResult[${x}] = ${g}.value; + } + + `):h.write(` + if (${g}.issues.length) { + payload.issues = payload.issues.concat(${g}.issues.map(iss => ({ + ...iss, + path: iss.path ? [${x}, ...iss.path] : [${x}] + }))); + } + + if (${g}.value === undefined) { + if (${x} in input) { + newResult[${x}] = undefined; + } + } else { + newResult[${x}] = ${g}.value; + } + + `)}h.write("payload.value = newResult;"),h.write("return payload;");const b=h.compile();return(_,g)=>b(f,_,g)};let i;const r=yp,l=!qM.jitless,u=l&&sj.value,c=t.catchall;let d;e._zod.parse=(f,h)=>{d??(d=o.value);const m=f.value;return r(m)?l&&u&&h?.async===!1&&h.jitless!==!0?(i||(i=s(t.shape)),f=i(f,h),c?uT([],m,f,h,d,e):f):n(f,h):(f.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),f)}});function Yk(e,t,n,o){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const s=e.filter(i=>!_d(i));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(r=>Ja(r,o,Xa())))}),t)}const cT=ct("$ZodUnion",(e,t)=>{No.init(e,t),Jn(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Jn(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Jn(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Jn(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(i=>i._zod.pattern);return new RegExp(`^(${s.map(i=>uy(i.source)).join("|")})$`)}});const n=t.options.length===1,o=t.options[0]._zod.run;e._zod.parse=(s,i)=>{if(n)return o(s,i);let r=!1;const l=[];for(const a of t.options){const u=a._zod.run({value:s.value,issues:[]},i);if(u instanceof Promise)l.push(u),r=!0;else{if(u.issues.length===0)return u;l.push(u)}}return r?Promise.all(l).then(a=>Yk(a,s,e,i)):Yk(l,s,e,i)}}),jV=ct("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,cT.init(e,t);const n=e._zod.parse;Jn(e._zod,"propValues",()=>{const s={};for(const i of t.options){const r=i._zod.propValues;if(!r||Object.keys(r).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const[l,a]of Object.entries(r)){s[l]||(s[l]=new Set);for(const u of a)s[l].add(u)}}return s});const o=l2(()=>{const s=t.options,i=new Map;for(const r of s){const l=r._zod.propValues?.[t.discriminator];if(!l||l.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(const a of l){if(i.has(a))throw new Error(`Duplicate discriminator value "${String(a)}"`);i.set(a,r)}}return i});e._zod.parse=(s,i)=>{const r=s.value;if(!yp(r))return s.issues.push({code:"invalid_type",expected:"object",input:r,inst:e}),s;const l=o.value.get(r?.[t.discriminator]);return l?l._zod.run(s,i):t.unionFallback?n(s,i):(s.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,input:r,path:[t.discriminator],inst:e}),s)}}),VV=ct("$ZodIntersection",(e,t)=>{No.init(e,t),e._zod.parse=(n,o)=>{const s=n.value,i=t.left._zod.run({value:s,issues:[]},o),r=t.right._zod.run({value:s,issues:[]},o);return i instanceof Promise||r instanceof Promise?Promise.all([i,r]).then(([a,u])=>Xk(n,a,u)):Xk(n,i,r)}});function a3(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(o1(e)&&o1(t)){const n=Object.keys(t),o=Object.keys(e).filter(i=>n.indexOf(i)!==-1),s={...e,...t};for(const i of o){const r=a3(e[i],t[i]);if(!r.valid)return{valid:!1,mergeErrorPath:[i,...r.mergeErrorPath]};s[i]=r.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let o=0;ol.l&&l.r).map(([l])=>l);if(i.length&&s&&e.issues.push({...s,keys:i}),_d(e))return e;const r=a3(t.value,n.value);if(!r.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(r.mergeErrorPath)}`);return e.value=r.data,e}const qV=ct("$ZodRecord",(e,t)=>{No.init(e,t),e._zod.parse=(n,o)=>{const s=n.value;if(!o1(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const i=[],r=t.keyType._zod.values;if(r){n.value={};const l=new Set;for(const u of r)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){l.add(typeof u=="number"?u.toString():u);const c=t.valueType._zod.run({value:s[u],issues:[]},o);c instanceof Promise?i.push(c.then(d=>{d.issues.length&&n.issues.push(...xd(u,d.issues)),n.value[u]=d.value})):(c.issues.length&&n.issues.push(...xd(u,c.issues)),n.value[u]=c.value)}let a;for(const u in s)l.has(u)||(a=a??[],a.push(u));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:a})}else{n.value={};for(const l of Reflect.ownKeys(s)){if(l==="__proto__")continue;let a=t.keyType._zod.run({value:l,issues:[]},o);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof l=="string"&&nT.test(l)&&a.issues.length){const d=t.keyType._zod.run({value:Number(l),issues:[]},o);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");d.issues.length===0&&(a=d)}if(a.issues.length){t.mode==="loose"?n.value[l]=s[l]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(d=>Ja(d,o,Xa())),input:l,path:[l],inst:e});continue}const c=t.valueType._zod.run({value:s[l],issues:[]},o);c instanceof Promise?i.push(c.then(d=>{d.issues.length&&n.issues.push(...xd(l,d.issues)),n.value[a.value]=d.value})):(c.issues.length&&n.issues.push(...xd(l,c.issues)),n.value[a.value]=c.value)}}return i.length?Promise.all(i).then(()=>n):n}}),KV=ct("$ZodEnum",(e,t)=>{No.init(e,t);const n=KM(t.entries),o=new Set(n);e._zod.values=o,e._zod.pattern=new RegExp(`^(${n.filter(s=>ij.has(typeof s)).map(s=>typeof s=="string"?s1(s):s.toString()).join("|")})$`),e._zod.parse=(s,i)=>{const r=s.value;return o.has(r)||s.issues.push({code:"invalid_value",values:n,input:r,inst:e}),s}}),ZV=ct("$ZodLiteral",(e,t)=>{if(No.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(o=>typeof o=="string"?s1(o):o?s1(o.toString()):String(o)).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return n.has(i)||o.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),o}}),GV=ct("$ZodTransform",(e,t)=>{No.init(e,t),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new VM(e.constructor.name);const s=t.transform(n.value,n);if(o.async)return(s instanceof Promise?s:Promise.resolve(s)).then(r=>(n.value=r,n));if(s instanceof Promise)throw new Bd;return n.value=s,n}});function Jk(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const dT=ct("$ZodOptional",(e,t)=>{No.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Jn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Jn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${uy(n.source)})?$`):void 0}),e._zod.parse=(n,o)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(i=>Jk(i,n.value)):Jk(s,n.value)}return n.value===void 0?n:t.innerType._zod.run(n,o)}}),YV=ct("$ZodExactOptional",(e,t)=>{dT.init(e,t),Jn(e._zod,"values",()=>t.innerType._zod.values),Jn(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,o)=>t.innerType._zod.run(n,o)}),XV=ct("$ZodNullable",(e,t)=>{No.init(e,t),Jn(e._zod,"optin",()=>t.innerType._zod.optin),Jn(e._zod,"optout",()=>t.innerType._zod.optout),Jn(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${uy(n.source)}|null)$`):void 0}),Jn(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,o)=>n.value===null?n:t.innerType._zod.run(n,o)}),JV=ct("$ZodDefault",(e,t)=>{No.init(e,t),e._zod.optin="optional",Jn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);if(n.value===void 0)return n.value=t.defaultValue,n;const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(i=>Qk(i,t)):Qk(s,t)}});function Qk(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const QV=ct("$ZodPrefault",(e,t)=>{No.init(e,t),e._zod.optin="optional",Jn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>(o.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,o))}),eq=ct("$ZodNonOptional",(e,t)=>{No.init(e,t),Jn(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(o=>o!==void 0)):void 0}),e._zod.parse=(n,o)=>{const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(i=>eb(i,e)):eb(s,e)}});function eb(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const tq=ct("$ZodCatch",(e,t)=>{No.init(e,t),Jn(e._zod,"optin",()=>t.innerType._zod.optin),Jn(e._zod,"optout",()=>t.innerType._zod.optout),Jn(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(r=>Ja(r,o,Xa()))},input:n.value}),n.issues=[]),n)):(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Ja(i,o,Xa()))},input:n.value}),n.issues=[]),n)}}),nq=ct("$ZodPipe",(e,t)=>{No.init(e,t),Jn(e._zod,"values",()=>t.in._zod.values),Jn(e._zod,"optin",()=>t.in._zod.optin),Jn(e._zod,"optout",()=>t.out._zod.optout),Jn(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,o)=>{if(o.direction==="backward"){const i=t.out._zod.run(n,o);return i instanceof Promise?i.then(r=>eh(r,t.in,o)):eh(i,t.in,o)}const s=t.in._zod.run(n,o);return s instanceof Promise?s.then(i=>eh(i,t.out,o)):eh(s,t.out,o)}});function eh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const oq=ct("$ZodReadonly",(e,t)=>{No.init(e,t),Jn(e._zod,"propValues",()=>t.innerType._zod.propValues),Jn(e._zod,"values",()=>t.innerType._zod.values),Jn(e._zod,"optin",()=>t.innerType?._zod?.optin),Jn(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,o)=>{if(o.direction==="backward")return t.innerType._zod.run(n,o);const s=t.innerType._zod.run(n,o);return s instanceof Promise?s.then(tb):tb(s)}});function tb(e){return e.value=Object.freeze(e.value),e}const sq=ct("$ZodCustom",(e,t)=>{qi.init(e,t),No.init(e,t),e._zod.parse=(n,o)=>n,e._zod.check=n=>{const o=n.value,s=t.fn(o);if(s instanceof Promise)return s.then(i=>nb(i,n,o,e));nb(s,n,o,e)}});function nb(e,t,n,o){if(!e){const s={code:"custom",input:n,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(s.params=o._zod.def.params),t.issues.push(kp(s))}}var ob;class iq{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const o=n[0];return this._map.set(t,o),o&&typeof o=="object"&&"id"in o&&this._idmap.set(o.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const o={...this.get(n)??{}};delete o.id;const s={...o,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function rq(){return new iq}(ob=globalThis).__zod_globalRegistry??(ob.__zod_globalRegistry=rq());const vf=globalThis.__zod_globalRegistry;function lq(e,t){return new e({type:"string",...Jt(t)})}function aq(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Jt(t)})}function sb(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Jt(t)})}function uq(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Jt(t)})}function cq(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Jt(t)})}function dq(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Jt(t)})}function fq(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Jt(t)})}function pq(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Jt(t)})}function hq(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Jt(t)})}function mq(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Jt(t)})}function gq(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Jt(t)})}function vq(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Jt(t)})}function yq(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Jt(t)})}function kq(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Jt(t)})}function bq(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Jt(t)})}function Cq(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Jt(t)})}function wq(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Jt(t)})}function _q(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Jt(t)})}function xq(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Jt(t)})}function Sq(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Jt(t)})}function Aq(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Jt(t)})}function Mq(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Jt(t)})}function Tq(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Jt(t)})}function Eq(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Jt(t)})}function Iq(e,t){return new e({type:"string",format:"date",check:"string_format",...Jt(t)})}function Lq(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Jt(t)})}function $q(e,t){return new e({type:"string",format:"duration",check:"string_format",...Jt(t)})}function Nq(e,t){return new e({type:"number",checks:[],...Jt(t)})}function Fq(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Jt(t)})}function Rq(e,t){return new e({type:"boolean",...Jt(t)})}function Oq(e){return new e({type:"unknown"})}function Pq(e,t){return new e({type:"never",...Jt(t)})}function ib(e,t){return new sT({check:"less_than",...Jt(t),value:e,inclusive:!1})}function t9(e,t){return new sT({check:"less_than",...Jt(t),value:e,inclusive:!0})}function rb(e,t){return new iT({check:"greater_than",...Jt(t),value:e,inclusive:!1})}function n9(e,t){return new iT({check:"greater_than",...Jt(t),value:e,inclusive:!0})}function lb(e,t){return new Jj({check:"multiple_of",...Jt(t),value:e})}function fT(e,t){return new eV({check:"max_length",...Jt(t),maximum:e})}function Rm(e,t){return new tV({check:"min_length",...Jt(t),minimum:e})}function pT(e,t){return new nV({check:"length_equals",...Jt(t),length:e})}function Dq(e,t){return new oV({check:"string_format",format:"regex",...Jt(t),pattern:e})}function Bq(e){return new sV({check:"string_format",format:"lowercase",...Jt(e)})}function Hq(e){return new iV({check:"string_format",format:"uppercase",...Jt(e)})}function zq(e,t){return new rV({check:"string_format",format:"includes",...Jt(t),includes:e})}function Wq(e,t){return new lV({check:"string_format",format:"starts_with",...Jt(t),prefix:e})}function Uq(e,t){return new aV({check:"string_format",format:"ends_with",...Jt(t),suffix:e})}function g1(e){return new uV({check:"overwrite",tx:e})}function jq(e){return g1(t=>t.normalize(e))}function Vq(){return g1(e=>e.trim())}function qq(){return g1(e=>e.toLowerCase())}function Kq(){return g1(e=>e.toUpperCase())}function Zq(){return g1(e=>oj(e))}function Gq(e,t,n){return new e({type:"array",element:t,...Jt(n)})}function Yq(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Jt(n)})}function Xq(e){const t=Jq(n=>(n.addIssue=o=>{if(typeof o=="string")n.issues.push(kp(o,n.value,t._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=n.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),n.issues.push(kp(s))}},e(n.value,n)));return t}function Jq(e,t){const n=new qi({check:"custom",...Jt(t)});return n._zod.check=e,n}function hT(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??vf,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function cs(e,t,n={path:[],schemaPath:[]}){var o;const s=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const r={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,r);const l=e._zod.toJSONSchema?.();if(l)r.schema=l;else{const c={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,r.schema,c);else{const f=r.schema,h=t.processors[s.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);h(e,t,f,c)}const d=e._zod.parent;d&&(r.ref||(r.ref=d),cs(d,t,c),t.seen.get(d).isParent=!0)}const a=t.metadataRegistry.get(e);return a&&Object.assign(r.schema,a),t.io==="input"&&gi(e)&&(delete r.schema.examples,delete r.schema.default),t.io==="input"&&r.schema._prefault&&((o=r.schema).default??(o.default=r.schema._prefault)),delete r.schema._prefault,t.seen.get(e).schema}function mT(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=new Map;for(const r of e.seen.entries()){const l=e.metadataRegistry.get(r[0])?.id;if(l){const a=o.get(l);if(a&&a!==r[0])throw new Error(`Duplicate schema id "${l}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);o.set(l,r[0])}}const s=r=>{const l=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const d=e.external.registry.get(r[0])?.id,f=e.external.uri??(m=>m);if(d)return{ref:f(d)};const h=r[1].defId??r[1].schema.id??`schema${e.counter++}`;return r[1].defId=h,{defId:h,ref:`${f("__shared")}#/${l}/${h}`}}if(r[1]===n)return{ref:"#"};const u=`#/${l}/`,c=r[1].schema.id??`__schema${e.counter++}`;return{defId:c,ref:u+c}},i=r=>{if(r[1].schema.$ref)return;const l=r[1],{ref:a,defId:u}=s(r);l.def={...l.schema},u&&(l.defId=u);const c=l.schema;for(const d in c)delete c[d];c.$ref=a};if(e.cycles==="throw")for(const r of e.seen.entries()){const l=r[1];if(l.cycle)throw new Error(`Cycle detected: #/${l.cycle?.join("/")}/ + +Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const r of e.seen.entries()){const l=r[1];if(t===r[0]){i(r);continue}if(e.external){const u=e.external.registry.get(r[0])?.id;if(t!==r[0]&&u){i(r);continue}}if(e.metadataRegistry.get(r[0])?.id){i(r);continue}if(l.cycle){i(r);continue}if(l.count>1&&e.reused==="ref"){i(r);continue}}}function gT(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const o=r=>{const l=e.seen.get(r);if(l.ref===null)return;const a=l.def??l.schema,u={...a},c=l.ref;if(l.ref=null,c){o(c);const f=e.seen.get(c),h=f.schema;if(h.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(a.allOf=a.allOf??[],a.allOf.push(h)):Object.assign(a,h),Object.assign(a,u),r._zod.parent===c)for(const v in a)v==="$ref"||v==="allOf"||v in u||delete a[v];if(h.$ref&&f.def)for(const v in a)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(a[v])===JSON.stringify(f.def[v])&&delete a[v]}const d=r._zod.parent;if(d&&d!==c){o(d);const f=e.seen.get(d);if(f?.schema.$ref&&(a.$ref=f.schema.$ref,f.def))for(const h in a)h==="$ref"||h==="allOf"||h in f.def&&JSON.stringify(a[h])===JSON.stringify(f.def[h])&&delete a[h]}e.override({zodSchema:r,jsonSchema:a,path:l.path??[]})};for(const r of[...e.seen.entries()].reverse())o(r[0]);const s={};if(e.target==="draft-2020-12"?s.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?s.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const r=e.external.registry.get(t)?.id;if(!r)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(r)}Object.assign(s,n.def??n.schema);const i=e.external?.defs??{};for(const r of e.seen.entries()){const l=r[1];l.def&&l.defId&&(i[l.defId]=l.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?s.$defs=i:s.definitions=i);try{const r=JSON.parse(JSON.stringify(s));return Object.defineProperty(r,"~standard",{value:{...t["~standard"],jsonSchema:{input:Om(t,"input",e.processors),output:Om(t,"output",e.processors)}},enumerable:!1,writable:!1}),r}catch{throw new Error("Error converting schema to JSON.")}}function gi(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const o=e._zod.def;if(o.type==="transform")return!0;if(o.type==="array")return gi(o.element,n);if(o.type==="set")return gi(o.valueType,n);if(o.type==="lazy")return gi(o.getter(),n);if(o.type==="promise"||o.type==="optional"||o.type==="nonoptional"||o.type==="nullable"||o.type==="readonly"||o.type==="default"||o.type==="prefault")return gi(o.innerType,n);if(o.type==="intersection")return gi(o.left,n)||gi(o.right,n);if(o.type==="record"||o.type==="map")return gi(o.keyType,n)||gi(o.valueType,n);if(o.type==="pipe")return gi(o.in,n)||gi(o.out,n);if(o.type==="object"){for(const s in o.shape)if(gi(o.shape[s],n))return!0;return!1}if(o.type==="union"){for(const s of o.options)if(gi(s,n))return!0;return!1}if(o.type==="tuple"){for(const s of o.items)if(gi(s,n))return!0;return!!(o.rest&&gi(o.rest,n))}return!1}const Qq=(e,t={})=>n=>{const o=hT({...n,processors:t});return cs(e,o),mT(o,e),gT(o,e)},Om=(e,t,n={})=>o=>{const{libraryOptions:s,target:i}=o??{},r=hT({...s??{},target:i,io:t,processors:n});return cs(e,r),mT(r,e),gT(r,e)},eK={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tK=(e,t,n,o)=>{const s=n;s.type="string";const{minimum:i,maximum:r,format:l,patterns:a,contentEncoding:u}=e._zod.bag;if(typeof i=="number"&&(s.minLength=i),typeof r=="number"&&(s.maxLength=r),l&&(s.format=eK[l]??l,s.format===""&&delete s.format,l==="time"&&delete s.format),u&&(s.contentEncoding=u),a&&a.size>0){const c=[...a];c.length===1?s.pattern=c[0].source:c.length>1&&(s.allOf=[...c.map(d=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:d.source}))])}},nK=(e,t,n,o)=>{const s=n,{minimum:i,maximum:r,format:l,multipleOf:a,exclusiveMaximum:u,exclusiveMinimum:c}=e._zod.bag;typeof l=="string"&&l.includes("int")?s.type="integer":s.type="number",typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.minimum=c,s.exclusiveMinimum=!0):s.exclusiveMinimum=c),typeof i=="number"&&(s.minimum=i,typeof c=="number"&&t.target!=="draft-04"&&(c>=i?delete s.minimum:delete s.exclusiveMinimum)),typeof u=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(s.maximum=u,s.exclusiveMaximum=!0):s.exclusiveMaximum=u),typeof r=="number"&&(s.maximum=r,typeof u=="number"&&t.target!=="draft-04"&&(u<=r?delete s.maximum:delete s.exclusiveMaximum)),typeof a=="number"&&(s.multipleOf=a)},oK=(e,t,n,o)=>{n.type="boolean"},sK=(e,t,n,o)=>{n.not={}},iK=(e,t,n,o)=>{},rK=(e,t,n,o)=>{const s=e._zod.def,i=KM(s.entries);i.every(r=>typeof r=="number")&&(n.type="number"),i.every(r=>typeof r=="string")&&(n.type="string"),n.enum=i},lK=(e,t,n,o)=>{const s=e._zod.def,i=[];for(const r of s.values)if(r===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof r=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");i.push(Number(r))}else i.push(r);if(i.length!==0)if(i.length===1){const r=i[0];n.type=r===null?"null":typeof r,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[r]:n.const=r}else i.every(r=>typeof r=="number")&&(n.type="number"),i.every(r=>typeof r=="string")&&(n.type="string"),i.every(r=>typeof r=="boolean")&&(n.type="boolean"),i.every(r=>r===null)&&(n.type="null"),n.enum=i},aK=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},uK=(e,t,n,o)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},cK=(e,t,n,o)=>{const s=n,i=e._zod.def,{minimum:r,maximum:l}=e._zod.bag;typeof r=="number"&&(s.minItems=r),typeof l=="number"&&(s.maxItems=l),s.type="array",s.items=cs(i.element,t,{...o,path:[...o.path,"items"]})},dK=(e,t,n,o)=>{const s=n,i=e._zod.def;s.type="object",s.properties={};const r=i.shape;for(const u in r)s.properties[u]=cs(r[u],t,{...o,path:[...o.path,"properties",u]});const l=new Set(Object.keys(r)),a=new Set([...l].filter(u=>{const c=i.shape[u]._zod;return t.io==="input"?c.optin===void 0:c.optout===void 0}));a.size>0&&(s.required=Array.from(a)),i.catchall?._zod.def.type==="never"?s.additionalProperties=!1:i.catchall?i.catchall&&(s.additionalProperties=cs(i.catchall,t,{...o,path:[...o.path,"additionalProperties"]})):t.io==="output"&&(s.additionalProperties=!1)},fK=(e,t,n,o)=>{const s=e._zod.def,i=s.inclusive===!1,r=s.options.map((l,a)=>cs(l,t,{...o,path:[...o.path,i?"oneOf":"anyOf",a]}));i?n.oneOf=r:n.anyOf=r},pK=(e,t,n,o)=>{const s=e._zod.def,i=cs(s.left,t,{...o,path:[...o.path,"allOf",0]}),r=cs(s.right,t,{...o,path:[...o.path,"allOf",1]}),l=u=>"allOf"in u&&Object.keys(u).length===1,a=[...l(i)?i.allOf:[i],...l(r)?r.allOf:[r]];n.allOf=a},hK=(e,t,n,o)=>{const s=n,i=e._zod.def;s.type="object";const r=i.keyType,a=r._zod.bag?.patterns;if(i.mode==="loose"&&a&&a.size>0){const c=cs(i.valueType,t,{...o,path:[...o.path,"patternProperties","*"]});s.patternProperties={};for(const d of a)s.patternProperties[d.source]=c}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(s.propertyNames=cs(i.keyType,t,{...o,path:[...o.path,"propertyNames"]})),s.additionalProperties=cs(i.valueType,t,{...o,path:[...o.path,"additionalProperties"]});const u=r._zod.values;if(u){const c=[...u].filter(d=>typeof d=="string"||typeof d=="number");c.length>0&&(s.required=c)}},mK=(e,t,n,o)=>{const s=e._zod.def,i=cs(s.innerType,t,o),r=t.seen.get(e);t.target==="openapi-3.0"?(r.ref=s.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},gK=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType},vK=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))},yK=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))},kK=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType;let r;try{r=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=r},bK=(e,t,n,o)=>{const s=e._zod.def,i=t.io==="input"?s.in._zod.def.type==="transform"?s.out:s.in:s.out;cs(i,t,o);const r=t.seen.get(e);r.ref=i},CK=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType,n.readOnly=!0},vT=(e,t,n,o)=>{const s=e._zod.def;cs(s.innerType,t,o);const i=t.seen.get(e);i.ref=s.innerType},wK=ct("ZodISODateTime",(e,t)=>{_V.init(e,t),Ro.init(e,t)});function _K(e){return Eq(wK,e)}const xK=ct("ZodISODate",(e,t)=>{xV.init(e,t),Ro.init(e,t)});function SK(e){return Iq(xK,e)}const AK=ct("ZodISOTime",(e,t)=>{SV.init(e,t),Ro.init(e,t)});function MK(e){return Lq(AK,e)}const TK=ct("ZodISODuration",(e,t)=>{AV.init(e,t),Ro.init(e,t)});function EK(e){return $q(TK,e)}const IK=(e,t)=>{XM.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>gj(e,n)},flatten:{value:n=>mj(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,l3,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,l3,2)}},isEmpty:{get(){return e.issues.length===0}}})},Mr=ct("ZodError",IK,{Parent:Error}),LK=dy(Mr),$K=fy(Mr),NK=a2(Mr),FK=u2(Mr),RK=kj(Mr),OK=bj(Mr),PK=Cj(Mr),DK=wj(Mr),BK=_j(Mr),HK=xj(Mr),zK=Sj(Mr),WK=Aj(Mr),Fo=ct("ZodType",(e,t)=>(No.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Om(e,"input"),output:Om(e,"output")}}),e.toJSONSchema=Qq(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(uu(t,{checks:[...t.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0}),e.with=e.check,e.clone=(n,o)=>cu(e,n,o),e.brand=()=>e,e.register=((n,o)=>(n.add(e,o),e)),e.parse=(n,o)=>LK(e,n,o,{callee:e.parse}),e.safeParse=(n,o)=>NK(e,n,o),e.parseAsync=async(n,o)=>$K(e,n,o,{callee:e.parseAsync}),e.safeParseAsync=async(n,o)=>FK(e,n,o),e.spa=e.safeParseAsync,e.encode=(n,o)=>RK(e,n,o),e.decode=(n,o)=>OK(e,n,o),e.encodeAsync=async(n,o)=>PK(e,n,o),e.decodeAsync=async(n,o)=>DK(e,n,o),e.safeEncode=(n,o)=>BK(e,n,o),e.safeDecode=(n,o)=>HK(e,n,o),e.safeEncodeAsync=async(n,o)=>zK(e,n,o),e.safeDecodeAsync=async(n,o)=>WK(e,n,o),e.refine=(n,o)=>e.check(OZ(n,o)),e.superRefine=n=>e.check(PZ(n)),e.overwrite=n=>e.check(g1(n)),e.optional=()=>cb(e),e.exactOptional=()=>_Z(e),e.nullable=()=>db(e),e.nullish=()=>cb(db(e)),e.nonoptional=n=>EZ(e,n),e.array=()=>Wn(e),e.or=n=>hZ([e,n]),e.and=n=>vZ(e,n),e.transform=n=>fb(e,CZ(n)),e.default=n=>AZ(e,n),e.prefault=n=>TZ(e,n),e.catch=n=>LZ(e,n),e.pipe=n=>fb(e,n),e.readonly=()=>FZ(e),e.describe=n=>{const o=e.clone();return vf.add(o,{description:n}),o},Object.defineProperty(e,"description",{get(){return vf.get(e)?.description},configurable:!0}),e.meta=(...n)=>{if(n.length===0)return vf.get(e);const o=e.clone();return vf.add(o,n[0]),o},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=n=>n(e),e)),yT=ct("_ZodString",(e,t)=>{py.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(o,s,i)=>tK(e,o,s);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...o)=>e.check(Dq(...o)),e.includes=(...o)=>e.check(zq(...o)),e.startsWith=(...o)=>e.check(Wq(...o)),e.endsWith=(...o)=>e.check(Uq(...o)),e.min=(...o)=>e.check(Rm(...o)),e.max=(...o)=>e.check(fT(...o)),e.length=(...o)=>e.check(pT(...o)),e.nonempty=(...o)=>e.check(Rm(1,...o)),e.lowercase=o=>e.check(Bq(o)),e.uppercase=o=>e.check(Hq(o)),e.trim=()=>e.check(Vq()),e.normalize=(...o)=>e.check(jq(...o)),e.toLowerCase=()=>e.check(qq()),e.toUpperCase=()=>e.check(Kq()),e.slugify=()=>e.check(Zq())}),UK=ct("ZodString",(e,t)=>{py.init(e,t),yT.init(e,t),e.email=n=>e.check(aq(jK,n)),e.url=n=>e.check(pq(VK,n)),e.jwt=n=>e.check(Tq(rZ,n)),e.emoji=n=>e.check(hq(qK,n)),e.guid=n=>e.check(sb(ab,n)),e.uuid=n=>e.check(uq(th,n)),e.uuidv4=n=>e.check(cq(th,n)),e.uuidv6=n=>e.check(dq(th,n)),e.uuidv7=n=>e.check(fq(th,n)),e.nanoid=n=>e.check(mq(KK,n)),e.guid=n=>e.check(sb(ab,n)),e.cuid=n=>e.check(gq(ZK,n)),e.cuid2=n=>e.check(vq(GK,n)),e.ulid=n=>e.check(yq(YK,n)),e.base64=n=>e.check(Sq(oZ,n)),e.base64url=n=>e.check(Aq(sZ,n)),e.xid=n=>e.check(kq(XK,n)),e.ksuid=n=>e.check(bq(JK,n)),e.ipv4=n=>e.check(Cq(QK,n)),e.ipv6=n=>e.check(wq(eZ,n)),e.cidrv4=n=>e.check(_q(tZ,n)),e.cidrv6=n=>e.check(xq(nZ,n)),e.e164=n=>e.check(Mq(iZ,n)),e.datetime=n=>e.check(_K(n)),e.date=n=>e.check(SK(n)),e.time=n=>e.check(MK(n)),e.duration=n=>e.check(EK(n))});function bt(e){return lq(UK,e)}const Ro=ct("ZodStringFormat",(e,t)=>{Mo.init(e,t),yT.init(e,t)}),jK=ct("ZodEmail",(e,t)=>{hV.init(e,t),Ro.init(e,t)}),ab=ct("ZodGUID",(e,t)=>{fV.init(e,t),Ro.init(e,t)}),th=ct("ZodUUID",(e,t)=>{pV.init(e,t),Ro.init(e,t)}),VK=ct("ZodURL",(e,t)=>{mV.init(e,t),Ro.init(e,t)}),qK=ct("ZodEmoji",(e,t)=>{gV.init(e,t),Ro.init(e,t)}),KK=ct("ZodNanoID",(e,t)=>{vV.init(e,t),Ro.init(e,t)}),ZK=ct("ZodCUID",(e,t)=>{yV.init(e,t),Ro.init(e,t)}),GK=ct("ZodCUID2",(e,t)=>{kV.init(e,t),Ro.init(e,t)}),YK=ct("ZodULID",(e,t)=>{bV.init(e,t),Ro.init(e,t)}),XK=ct("ZodXID",(e,t)=>{CV.init(e,t),Ro.init(e,t)}),JK=ct("ZodKSUID",(e,t)=>{wV.init(e,t),Ro.init(e,t)}),QK=ct("ZodIPv4",(e,t)=>{MV.init(e,t),Ro.init(e,t)}),eZ=ct("ZodIPv6",(e,t)=>{TV.init(e,t),Ro.init(e,t)}),tZ=ct("ZodCIDRv4",(e,t)=>{EV.init(e,t),Ro.init(e,t)}),nZ=ct("ZodCIDRv6",(e,t)=>{IV.init(e,t),Ro.init(e,t)}),oZ=ct("ZodBase64",(e,t)=>{LV.init(e,t),Ro.init(e,t)}),sZ=ct("ZodBase64URL",(e,t)=>{NV.init(e,t),Ro.init(e,t)}),iZ=ct("ZodE164",(e,t)=>{FV.init(e,t),Ro.init(e,t)}),rZ=ct("ZodJWT",(e,t)=>{OV.init(e,t),Ro.init(e,t)}),kT=ct("ZodNumber",(e,t)=>{lT.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(o,s,i)=>nK(e,o,s),e.gt=(o,s)=>e.check(rb(o,s)),e.gte=(o,s)=>e.check(n9(o,s)),e.min=(o,s)=>e.check(n9(o,s)),e.lt=(o,s)=>e.check(ib(o,s)),e.lte=(o,s)=>e.check(t9(o,s)),e.max=(o,s)=>e.check(t9(o,s)),e.int=o=>e.check(ub(o)),e.safe=o=>e.check(ub(o)),e.positive=o=>e.check(rb(0,o)),e.nonnegative=o=>e.check(n9(0,o)),e.negative=o=>e.check(ib(0,o)),e.nonpositive=o=>e.check(t9(0,o)),e.multipleOf=(o,s)=>e.check(lb(o,s)),e.step=(o,s)=>e.check(lb(o,s)),e.finite=()=>e;const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function Ut(e){return Nq(kT,e)}const lZ=ct("ZodNumberFormat",(e,t)=>{PV.init(e,t),kT.init(e,t)});function ub(e){return Fq(lZ,e)}const aZ=ct("ZodBoolean",(e,t)=>{DV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>oK(e,n,o)});function Hp(e){return Rq(aZ,e)}const uZ=ct("ZodUnknown",(e,t)=>{BV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>iK()});function Cs(){return Oq(uZ)}const cZ=ct("ZodNever",(e,t)=>{HV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>sK(e,n,o)});function dZ(e){return Pq(cZ,e)}const fZ=ct("ZodArray",(e,t)=>{zV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>cK(e,n,o,s),e.element=t.element,e.min=(n,o)=>e.check(Rm(n,o)),e.nonempty=n=>e.check(Rm(1,n)),e.max=(n,o)=>e.check(fT(n,o)),e.length=(n,o)=>e.check(pT(n,o)),e.unwrap=()=>e.element});function Wn(e,t){return Gq(fZ,e,t)}const pZ=ct("ZodObject",(e,t)=>{UV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>dK(e,n,o,s),Jn(e,"shape",()=>t.shape),e.keyof=()=>So(Object.keys(e._zod.def.shape)),e.catchall=n=>e.clone({...e._zod.def,catchall:n}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Cs()}),e.loose=()=>e.clone({...e._zod.def,catchall:Cs()}),e.strict=()=>e.clone({...e._zod.def,catchall:dZ()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=n=>cj(e,n),e.safeExtend=n=>dj(e,n),e.merge=n=>fj(e,n),e.pick=n=>aj(e,n),e.omit=n=>uj(e,n),e.partial=(...n)=>pj(CT,e,n[0]),e.required=(...n)=>hj(wT,e,n[0])});function $t(e,t){const n={type:"object",shape:e??{},...Jt(t)};return new pZ(n)}const bT=ct("ZodUnion",(e,t)=>{cT.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>fK(e,n,o,s),e.options=t.options});function hZ(e,t){return new bT({type:"union",options:e,...Jt(t)})}const mZ=ct("ZodDiscriminatedUnion",(e,t)=>{bT.init(e,t),jV.init(e,t)});function du(e,t,n){return new mZ({type:"union",options:t,discriminator:e,...Jt(n)})}const gZ=ct("ZodIntersection",(e,t)=>{VV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>pK(e,n,o,s)});function vZ(e,t){return new gZ({type:"intersection",left:e,right:t})}const yZ=ct("ZodRecord",(e,t)=>{qV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>hK(e,n,o,s),e.keyType=t.keyType,e.valueType=t.valueType});function hy(e,t,n){return new yZ({type:"record",keyType:e,valueType:t,...Jt(n)})}const u3=ct("ZodEnum",(e,t)=>{KV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(o,s,i)=>rK(e,o,s),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(o,s)=>{const i={};for(const r of o)if(n.has(r))i[r]=t.entries[r];else throw new Error(`Key ${r} not found in enum`);return new u3({...t,checks:[],...Jt(s),entries:i})},e.exclude=(o,s)=>{const i={...t.entries};for(const r of o)if(n.has(r))delete i[r];else throw new Error(`Key ${r} not found in enum`);return new u3({...t,checks:[],...Jt(s),entries:i})}});function So(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new u3({type:"enum",entries:n,...Jt(t)})}const kZ=ct("ZodLiteral",(e,t)=>{ZV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>lK(e,n,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function mn(e,t){return new kZ({type:"literal",values:Array.isArray(e)?e:[e],...Jt(t)})}const bZ=ct("ZodTransform",(e,t)=>{GV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>uK(e,n),e._zod.parse=(n,o)=>{if(o.direction==="backward")throw new VM(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(kp(i,n.value,t));else{const r=i;r.fatal&&(r.continue=!1),r.code??(r.code="custom"),r.input??(r.input=n.value),r.inst??(r.inst=e),n.issues.push(kp(r))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(i=>(n.value=i,n)):(n.value=s,n)}});function CZ(e){return new bZ({type:"transform",transform:e})}const CT=ct("ZodOptional",(e,t)=>{dT.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>vT(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function cb(e){return new CT({type:"optional",innerType:e})}const wZ=ct("ZodExactOptional",(e,t)=>{YV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>vT(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function _Z(e){return new wZ({type:"optional",innerType:e})}const xZ=ct("ZodNullable",(e,t)=>{XV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>mK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function db(e){return new xZ({type:"nullable",innerType:e})}const SZ=ct("ZodDefault",(e,t)=>{JV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>vK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function AZ(e,t){return new SZ({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():GM(t)}})}const MZ=ct("ZodPrefault",(e,t)=>{QV.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>yK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function TZ(e,t){return new MZ({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():GM(t)}})}const wT=ct("ZodNonOptional",(e,t)=>{eq.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>gK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function EZ(e,t){return new wT({type:"nonoptional",innerType:e,...Jt(t)})}const IZ=ct("ZodCatch",(e,t)=>{tq.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>kK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function LZ(e,t){return new IZ({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const $Z=ct("ZodPipe",(e,t)=>{nq.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>bK(e,n,o,s),e.in=t.in,e.out=t.out});function fb(e,t){return new $Z({type:"pipe",in:e,out:t})}const NZ=ct("ZodReadonly",(e,t)=>{oq.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>CK(e,n,o,s),e.unwrap=()=>e._zod.def.innerType});function FZ(e){return new NZ({type:"readonly",innerType:e})}const RZ=ct("ZodCustom",(e,t)=>{sq.init(e,t),Fo.init(e,t),e._zod.processJSONSchema=(n,o,s)=>aK(e,n)});function OZ(e,t={}){return Yq(RZ,e,t)}function PZ(e){return Xq(e)}const mc=bt().min(1),my=bt().min(1),zp=bt().min(1),gc=bt().min(1),ar=bt().min(1),DZ=/^[A-Za-z0-9._-]{1,128}$/;function BZ(e){return DZ.test(e)&&e!=="."&&e!==".."}const _T=du("kind",[$t({kind:mn("user"),payload:Cs().optional()}),$t({kind:mn("cron"),taskId:gc.optional(),payload:Cs().optional()}),$t({kind:mn("task"),taskId:gc,payload:Cs().optional()}),$t({kind:mn("hook"),payload:Cs().optional()}),$t({kind:mn("compaction"),payload:Cs().optional()}),$t({kind:mn("side"),payload:Cs().optional()}),$t({kind:mn("other"),payload:Cs().optional()})]),HZ=$t({inputTokens:Ut().optional(),outputTokens:Ut().optional(),cachedTokens:Ut().optional(),cost:Ut().optional()}),Df=$t({inputOther:Ut(),output:Ut(),inputCacheRead:Ut(),inputCacheCreation:Ut()}),zZ=$t({llmFirstTokenLatencyMs:Ut().optional(),llmStreamDurationMs:Ut().optional(),llmRequestBuildMs:Ut().optional(),llmServerFirstTokenMs:Ut().optional(),llmServerDecodeMs:Ut().optional(),llmClientConsumeMs:Ut().optional()}),WZ=$t({failedAttempt:Ut(),nextAttempt:Ut(),maxAttempts:Ut(),delayMs:Ut(),errorName:bt(),errorMessage:bt(),statusCode:Ut().optional()}),xT=So(["queued","running","completed","failed","cancelled"]),UZ=So(["running","completed","interrupted","failed"]),jZ=$t({kind:mn("text"),frameId:zp,role:So(["assistant","user"]),text:bt(),attachmentIds:Wn(bt()).optional(),taskId:gc.optional()}),VZ=$t({kind:mn("thinking"),frameId:zp,text:bt()}),qZ=$t({agentId:ar,role:So(["child","member"]).optional()}),KZ=$t({kind:So(["stdout","stderr","progress","status","custom"]),text:bt().optional(),percent:Ut().optional(),customKind:bt().optional(),customData:Cs().optional()}),ZZ=$t({kind:mn("tool"),frameId:zp,toolCallId:bt(),name:bt(),view:bt().optional(),state:So(["running","done","error"]),input:Cs().optional(),output:Cs().optional(),display:Cs().optional(),error:bt().optional(),inputText:bt().optional(),progress:KZ.optional(),taskId:gc.optional(),approvalId:bt().optional(),todoId:bt().optional(),agentRefs:Wn(qZ).optional()}),gy=$t({interactionId:bt(),interactionKind:So(["approval","question"]),toolCallId:bt().optional(),state:So(["pending","approved","rejected","cancelled","answered","dismissed"]),request:Cs().optional(),response:Cs().optional()}),GZ=$t({kind:mn("notice"),frameId:zp,level:So(["error","warning","info"]),source:bt().optional(),message:bt(),detail:Cs().optional()}),ST=du("kind",[jZ,VZ,ZZ,GZ]),AT=$t({kind:mn("step"),stepId:my,turnId:mc,ordinal:Ut().int(),state:UZ,frames:Wn(ST),startedAt:bt().optional(),endedAt:bt().optional(),usage:Df.optional(),finishReason:bt().optional(),timing:zZ.optional(),retry:WZ.optional(),endReason:bt().optional(),endMessage:bt().optional()}),MT=$t({kind:mn("turn"),turnId:mc,ordinal:Ut().int(),state:xT,origin:_T,prompt:bt().optional(),attachmentIds:Wn(bt()).optional(),steps:Wn(AT),startedAt:bt().optional(),endedAt:bt().optional(),usage:HZ.optional(),durationMs:Ut().optional(),error:bt().optional()}),TT=$t({kind:mn("marker"),markerId:bt(),marker:bt(),payload:Cs().optional(),at:bt().optional()}),ET=$t({kind:mn("taskref"),refId:bt(),taskId:gc,at:bt().optional()}),IT=du("kind",[MT,TT,ET]),vy=$t({taskId:gc,kind:So(["shell","subagent","tool","other"]),state:So(["running","completed","failed","timed_out","killed","lost"]),detached:Hp(),description:bt().optional(),agentId:ar.optional(),outputTail:bt(),startedAt:bt().optional(),endedAt:bt().optional(),resultSummary:bt().optional(),error:bt().optional(),stateReason:bt().optional(),usage:Df.optional()}),YZ=$t({objective:bt(),status:So(["active","paused","blocked","complete"]),completionCriterion:bt().optional(),budgetUsed:Ut().optional(),budgetLimit:Ut().optional()}),XZ=$t({plan:$t({reviewPath:bt().optional(),version:Ut().optional()}).optional(),swarm:$t({trigger:bt().optional()}).optional()}),JZ=$t({plan:$t({reviewPath:bt().optional(),version:Ut().optional()}).nullable().optional(),swarm:$t({trigger:bt().optional()}).nullable().optional()}),QZ=du("kind",[$t({kind:mn("idle")}),$t({kind:mn("running"),turnId:Ut(),step:Ut(),stepId:bt(),since:Ut()}),$t({kind:mn("streaming"),turnId:Ut(),step:Ut(),stepId:bt(),stream:So(["assistant","thinking","tool_call"]),toolCallId:bt().optional(),toolName:bt().optional(),since:Ut()}),$t({kind:mn("tool_call"),turnId:Ut(),step:Ut(),toolCallId:bt(),name:bt(),since:Ut()}),$t({kind:mn("retrying"),turnId:Ut(),step:Ut(),stepId:bt(),failedAttempt:Ut(),nextAttempt:Ut(),maxAttempts:Ut(),delayMs:Ut(),errorName:bt().optional(),statusCode:Ut().optional(),since:Ut()}),$t({kind:mn("awaiting_approval"),turnId:Ut(),step:Ut().optional(),approval:Cs().optional(),since:Ut()}),$t({kind:mn("interrupted"),turnId:Ut(),step:Ut().optional(),reason:So(["aborted","max_steps","error"]),message:bt().optional(),at:Ut()}),$t({kind:mn("ended"),turnId:Ut(),reason:So(["completed","cancelled","failed","blocked"]),durationMs:Ut().optional(),at:Ut()})]),eG=$t({byModel:hy(bt(),Df).optional(),currentTurn:Df.optional(),total:Df.optional()}),tG=$t({model:bt().optional(),thinkingEffort:bt().optional(),usage:eG.optional(),contextTokens:Ut().optional(),maxContextTokens:Ut().optional(),contextUsage:Ut().optional(),permission:So(["manual","yolo","auto"]).optional(),phase:QZ.optional()}),yy=$t({goal:YZ.optional(),modes:XZ.optional(),activity:So(["idle","turn","disposing","unknown"]).optional(),agent:tG.optional()}),nG=yy.extend({modes:JZ.optional()}),d2=$t({attachmentId:bt(),mediaType:bt(),name:bt().optional(),size:Ut().optional(),source:du("kind",[$t({kind:mn("url"),url:bt()}),$t({kind:mn("file"),fileId:bt()})]).optional(),placeholder:bt().optional()}),oG=$t({title:bt(),status:So(["pending","in_progress","done"])}),ky=$t({todoId:bt(),items:Wn(oG),updatedAt:bt().optional()}),by=$t({promptId:bt(),status:So(["running","queued","blocked","completed","failed","aborted"]),userMessageId:bt().optional(),content:Cs().optional(),createdAt:bt(),finishedAt:bt().optional(),steeredAt:bt().optional()}),LT=$t({items:Wn(IT),tasks:Wn(vy),interactions:Wn(gy).default([]),attachments:Wn(d2).default([]),todos:Wn(ky).default([]),prompts:Wn(by).default([]),meta:yy,hasMoreOlder:Hp().optional()}),sG=MT.omit({steps:!0}),iG=AT.omit({frames:!0}),rG=du("type",[$t({type:mn("frame"),turnId:mc,stepId:my,frameId:zp}),$t({type:mn("task"),taskId:gc})]),Cy=du("op",[$t({op:mn("reset"),agentId:ar,snapshot:LT}),$t({op:mn("turn.upsert"),turn:sG}),$t({op:mn("step.upsert"),turnId:mc,step:iG}),$t({op:mn("frame.upsert"),turnId:mc,stepId:my,frame:ST}),$t({op:mn("append"),target:rG,offset:Ut().int().nonnegative(),text:bt()}),$t({op:mn("marker.upsert"),item:TT,beforeTurn:Ut().int().optional()}),$t({op:mn("taskref.upsert"),item:ET,beforeTurn:Ut().int().optional()}),$t({op:mn("task.upsert"),task:vy}),$t({op:mn("interaction.upsert"),interaction:gy}),$t({op:mn("attachment.upsert"),attachment:d2}),$t({op:mn("todo.upsert"),todo:ky}),$t({op:mn("prompt.upsert"),prompt:by}),$t({op:mn("meta.merge"),meta:nG}),$t({op:mn("items.remove"),ids:Wn(bt())})]);$t({agentId:ar,ops:Wn(Cy)});const lG=So(["off","turn","block","delta"]),i1=Ut().int().nonnegative(),aG=hy(bt(),lG);$t({session_id:bt().min(1),transcript:aG,transcript_since:hy(bt(),i1).optional()});$t({agent_id:ar,before_turn:bt().min(1).optional(),after_turn:bt().min(1).optional(),page_size:Ut().int().min(1).max(100).optional()}).superRefine((e,t)=>{e.before_turn!==void 0&&e.after_turn!==void 0&&t.addIssue({code:"custom",message:"before_turn and after_turn are mutually exclusive",path:["before_turn"]}),BZ(e.agent_id)||t.addIssue({code:"custom",message:"agent_id must be a plain agent id (no path separators)",path:["agent_id"]})});const uG=$t({agentId:ar,type:So(["main","sub","independent"]).optional(),parentAgentId:ar.optional(),label:bt().optional(),createdAt:bt().optional(),disposedAt:bt().optional()}),cG=$t({agent_id:ar,items:Wn(IT),has_more:Hp(),tasks:Wn(vy),interactions:Wn(gy).default([]),attachments:Wn(d2).default([]),todos:Wn(ky).default([]),prompts:Wn(by).default([]),meta:yy,agents:Wn(uG),pending_interactions:Wn(bt()),seq:i1.optional()});$t({agent_id:ar,batches:Wn($t({seq:i1,ops:Wn(Cy)})),latest_seq:i1,complete:Hp()});const dG=$t({turn_id:mc,ordinal:Ut().int(),state:xT,origin:_T,prompt:bt(),attachment_ids:Wn(bt()).optional(),started_at:bt().optional()});$t({agents:Wn($t({agent_id:ar,messages:Wn(dG),attachments:Wn(d2).default([])}))});const fG=$t({state:So(["pending","approved","rejected","cancelled"]),selected_option:bt().optional(),feedback:bt().optional()}),pG=$t({tool_call_id:bt(),turn_id:mc,source:So(["interaction","display","output"]),plan:bt(),path:bt().optional(),options:Wn($t({label:bt(),description:bt().optional()})).optional(),review:fG.optional()});$t({agent_id:ar,plans:Wn(pG)});const hG=$t({agent_id:ar,snapshot:LT,has_more_older:Hp(),seq:i1.optional()}),mG=$t({agent_id:ar,ops:Wn(Cy),seq:i1.optional()}),$T=hG.extend({type:mn("transcript.reset")}),NT=mG.extend({type:mn("transcript.ops")});du("type",[$T,NT]);const pb=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.call.started","tool.use","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.submitted","prompt.completed","prompt.aborted","session.meta.updated","compaction.started","compaction.completed","compaction.cancelled","goal.updated","error","warning","subagent.spawned","subagent.started","subagent.suspended","subagent.completed","subagent.failed","task.started","task.terminated","background.task.started","background.task.terminated","cron.fired"]),gG=new Set(["session.created","session.updated","session.deleted","session.status_changed","session.usage_updated","session.history_compacted","message.created","message.updated","approval.requested","approval.resolved","approval.expired","question.requested","question.answered","question.dismissed","task.created","task.progress","task.completed","assistant.tool_use_started","assistant.tool_use_delta","assistant.tool_use_completed","assistant.completed","tool.started","tool.output","tool.completed"]),vG=new Set(["server_hello","ack","ping","resync_required","error","pong"]),yG=new Set(["assistant.delta","thinking.delta"]);function kG(e,t){if(vG.has(e))return{route:"ignore"};const n=e.startsWith("event."),o=n?e.slice(6):e;return yG.has(o)?bG(t)?{route:"agent",agentType:o}:{route:"protocol"}:n?gG.has(o)?{route:"protocol"}:pb.has(o)?{route:"agent",agentType:o}:{route:"protocol"}:pb.has(o)?{route:"agent",agentType:o}:{route:"agent",agentType:o}}function bG(e){if(!e||typeof e!="object")return!1;const t=e;return"message_id"in t||"content_index"in t?!1:typeof t.delta=="string"}const CG="kimi-code.bearer.",wG=3e4;class _G{constructor(t){this.opts=t,this.tracer=t.tracer??oy}ws=null;connected=!1;closed=!1;subscriptions=new Map;transcriptSubscriptions=new Map;sideChannelAgents=new Map;pendingSubscriptions=[];terminalAttachments=new Map;msgSeq=0;clientHelloId=null;reconnectAttempts=0;reconnectTimer=null;heartbeatMs=3e4;lastActivityAt=0;tracer;connect(){if(this.ws!==null||this.closed)return;this.lastActivityAt=Date.now(),this.tracer.wsEvent?.({kind:"lifecycle",event:"connect",detail:{url:this.opts.wsUrl,attempt:this.reconnectAttempts}});const t=this.opts.credentialStore?.getToken(),n=t!==void 0?[`${CG}${t}`]:void 0,o=new WebSocket(this.opts.wsUrl,n);this.ws=o,o.onopen=()=>{this.tracer.wsEvent?.({kind:"lifecycle",event:"open"})},o.onmessage=s=>{this.lastActivityAt=Date.now();try{const i=JSON.parse(String(s.data));this.tracer.wsEvent?.({kind:"in",frame:i}),this.handleFrame(i)}catch(i){this.tracer.wsEvent?.({kind:"lifecycle",event:"parse-error",detail:{error:String(i)}}),this.opts.handlers.onError(0,`Failed to parse WS frame: ${String(i)}`,!1)}},o.onerror=()=>{this.tracer.wsEvent?.({kind:"lifecycle",event:"error"}),this.opts.handlers.onError(0,"WebSocket error",!1)},o.onclose=s=>{this.tracer.wsEvent?.({kind:"lifecycle",event:"close",detail:s?{code:s.code,reason:s.reason,wasClean:s.wasClean}:void 0}),this.connected=!1,this.ws=null,this.opts.handlers.onConnectionState(!1),this.scheduleReconnect()}}scheduleReconnect(){if(this.closed||this.reconnectTimer!==null)return;const n=Math.min(3e4,1e3*2**this.reconnectAttempts)+Math.floor(Math.random()*250);this.reconnectAttempts+=1,this.tracer.wsEvent?.({kind:"lifecycle",event:"reconnect-scheduled",detail:{delayMs:n,attempt:this.reconnectAttempts}}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}subscribe(t,n={seq:0}){if(this.subscriptions.set(t,{...n}),this.connected)this.sendSubscribe([t],{[t]:n});else{const o=this.pendingSubscriptions.findIndex(s=>s.sessionId===t);o!==-1&&this.pendingSubscriptions.splice(o,1),this.pendingSubscriptions.push({sessionId:t,cursor:{...n}})}}unsubscribe(t){this.subscriptions.delete(t);const n=this.pendingSubscriptions.findIndex(o=>o.sessionId===t);n!==-1&&this.pendingSubscriptions.splice(n,1),this.connected&&this.ws&&this.send({type:"unsubscribe",id:this.nextId(),payload:{session_ids:[t]}})}subscribeTranscript(t,n,o){this.transcriptSubscriptions.set(t,{agentId:n,...o!==void 0?{sinceSeq:o}:{}}),this.connected&&this.sendTranscriptSubscribe(t,n,o)}unsubscribeTranscript(t,n){const o=this.transcriptSubscriptions.get(t);(n===void 0||o===void 0||n.includes(o.agentId))&&this.transcriptSubscriptions.delete(t),!(!this.connected||!this.ws)&&this.send({type:"unsubscribe_v2",id:this.nextId(),payload:{session_id:t,...n!==void 0?{agent_ids:n}:{}}})}markSideChannelAgent(t,n){if(!this.opts.mainAgentOnly)return;let o=this.sideChannelAgents.get(t);if(o===void 0&&(o=new Set,this.sideChannelAgents.set(t,o)),o.has(n))return;o.add(n);const s=this.subscriptions.get(t);this.connected&&s!==void 0&&this.sendSubscribe([t],{[t]:s})}abort(t,n){!this.connected||!this.ws||this.send({type:"abort",id:this.nextId(),payload:{session_id:t,prompt_id:n}})}terminalAttach(t,n,o){const s=nh(t,n),i=this.terminalAttachments.get(s),r=o??i?.lastSeq??0;this.terminalAttachments.set(s,{sessionId:t,terminalId:n,lastSeq:r}),!(!this.connected||!this.ws)&&this.sendTerminalAttach(t,n,r)}terminalInput(t,n,o){!this.connected||!this.ws||this.send({type:"terminal_input",id:this.nextId(),payload:{session_id:t,terminal_id:n,data:o}})}terminalResize(t,n,o,s){!this.connected||!this.ws||this.send({type:"terminal_resize",id:this.nextId(),payload:{session_id:t,terminal_id:n,cols:o,rows:s}})}terminalDetach(t,n){this.terminalAttachments.delete(nh(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_detach",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}terminalClose(t,n){this.terminalAttachments.delete(nh(t,n)),!(!this.connected||!this.ws)&&this.send({type:"terminal_close",id:this.nextId(),payload:{session_id:t,terminal_id:n}})}close(){this.closed=!0,this.connected=!1,this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.ws&&(this.ws.close(1e3),this.ws=null)}health(){const t=this.ws!==null&&this.ws.readyState===WebSocket.OPEN,n=Math.max(this.heartbeatMs*2,wG),o=this.lastActivityAt>0&&Date.now()-this.lastActivityAt>n;return{connected:this.connected,open:t,stale:o}}reconnect(){if(this.closed)return;this.reconnectTimer!==null&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null);const t=this.ws;if(t!==null){t.onopen=null,t.onmessage=null,t.onerror=null,t.onclose=null;try{t.close(1e3,"reconnect")}catch{}}const n=this.connected;this.ws=null,this.connected=!1,n&&this.opts.handlers.onConnectionState(!1),this.connect()}handleFrame(t){const n=t,o=t.type;if(o==="transcript.reset"){const s=$T.safeParse({type:o,...n.payload}),i=n.session_id;if(!s.success||typeof i!="string"){this.opts.handlers.onError(0,"Invalid transcript.reset frame",!1);return}const r=s.data;this.opts.handlers.onTranscriptReset?.(i,r.agent_id,{...r.snapshot,hasMoreOlder:r.has_more_older},r.seq);const l=this.transcriptSubscriptions.get(i);l?.agentId===r.agent_id&&r.seq!==void 0&&(l.sinceSeq=r.seq);return}if(o==="transcript.ops"){const s=NT.safeParse({type:o,...n.payload}),i=n.session_id;if(!s.success||typeof i!="string"){this.opts.handlers.onError(0,"Invalid transcript.ops frame",!1);return}const r=s.data,l=this.opts.handlers.onTranscriptOps?.(i,r.agent_id,r.ops,r.seq),a=this.transcriptSubscriptions.get(i);l!==!1&&a?.agentId===r.agent_id&&r.seq!==void 0&&(a.sinceSeq=r.seq);return}switch(o){case"server_hello":{const s=n.payload?.heartbeat_ms;typeof s=="number"&&s>0&&(this.heartbeatMs=s),this.onServerHello();break}case"ping":this.send({type:"pong",payload:{nonce:n.payload.nonce}});break;case"resync_required":{const s=n.payload.session_id,i=n.payload.epoch;this.subscriptions.set(s,{seq:n.payload.current_seq,epoch:i}),this.opts.handlers.onResync(s,n.payload.current_seq,i);break}case"error":{const s=n.session_id;typeof s=="string"&&this.opts.handlers.onRawAgentEvent?this.opts.handlers.onRawAgentEvent({type:"error",seq:n.seq,session_id:s,timestamp:n.timestamp,payload:n.payload}):this.opts.handlers.onError(n.payload.code,n.payload.msg,n.payload.fatal);break}case"ack":n.id===this.clientHelloId&&(this.clientHelloId=null,n.code===0&&this.opts.handlers.onReplayComplete?.());break;case"terminal_output":{const s=n.session_id,i=n.terminal_id,r=n.seq,l=nh(s,i),a=this.terminalAttachments.get(l);a&&this.terminalAttachments.set(l,{...a,lastSeq:Math.max(a.lastSeq,r)});const u=typeof n.payload?.data=="string"?n.payload.data:"";this.opts.handlers.onTerminalOutput?.(s,i,u,r);break}case"terminal_exit":{const s=n.session_id,i=n.terminal_id,r=n.payload?.exit_code,l=typeof r=="number"?r:null;this.opts.handlers.onTerminalExit?.(s,i,l);break}default:{this.trackCursor(n);const s=n.type,i=kG(s,n.payload);if(i.route==="protocol"){this.opts.handlers.onWireEvent(n);break}if(i.route==="agent"){if(this.opts.handlers.onRawAgentEvent&&typeof n.session_id=="string"){const r=n,l=n;this.opts.handlers.onRawAgentEvent({type:i.agentType,seq:r.seq,session_id:r.session_id,timestamp:r.timestamp,payload:r.payload,...l.volatile!==void 0?{volatile:l.volatile}:{},...l.offset!==void 0?{offset:l.offset}:{}})}break}break}}}onServerHello(){this.connected=!0,this.reconnectAttempts=0,this.opts.handlers.onConnectionState(!0);const t=Array.from(this.subscriptions.keys());for(const s of this.pendingSubscriptions)this.subscriptions.set(s.sessionId,s.cursor),t.includes(s.sessionId)||t.push(s.sessionId);this.pendingSubscriptions.length=0;const n={};for(const[s,i]of this.subscriptions.entries())n[s]=i;const o=this.nextId();this.clientHelloId=o,this.send({type:"client_hello",id:o,payload:{client_id:this.opts.clientId,subscriptions:t,cursors:n,...this.opts.mainAgentOnly?{agent_filter:this.rawAgentFilter(t)}:{}}});for(const[s,i]of this.transcriptSubscriptions)this.sendTranscriptSubscribe(s,i.agentId,i.sinceSeq);for(const s of this.terminalAttachments.values())this.sendTerminalAttach(s.sessionId,s.terminalId,s.lastSeq)}sendSubscribe(t,n){this.send({type:"subscribe",id:this.nextId(),payload:{session_ids:t,cursors:n,...this.opts.mainAgentOnly?{agent_filter:this.rawAgentFilter(t)}:{}}})}rawAgentFilter(t){return Object.fromEntries(t.map(n=>[n,["main",...this.sideChannelAgents.get(n)??[]]]))}sendTranscriptSubscribe(t,n,o){this.send({type:"subscribe_v2",id:this.nextId(),payload:{session_id:t,transcript:{[n]:"delta"},...o!==void 0?{transcript_since:{[n]:o}}:{}}})}sendTerminalAttach(t,n,o){this.send({type:"terminal_attach",id:this.nextId(),payload:{session_id:t,terminal_id:n,since_seq:o>0?o:void 0}})}trackCursor(t){if(t.volatile===!0)return;const n=t.session_id,o=t.seq;if(typeof n!="string"||typeof o!="number")return;const s=this.subscriptions.get(n);if(!s||o<=s.seq&&s.epoch!==void 0)return;const i=typeof t.epoch=="string"?t.epoch:s.epoch;this.subscriptions.set(n,{seq:Math.max(o,s.seq),epoch:i})}send(t){if(!(!this.ws||this.ws.readyState!==WebSocket.OPEN))try{this.ws.send(JSON.stringify(t)),this.tracer.wsEvent?.({kind:"out",frame:t})}catch{}}nextId(){return`c_${++this.msgSeq}`}}function nh(e,t){return`${e}\0${t}`}async function xG(e,t,n){const o=await e.get(`/sessions/${encodeURIComponent(t)}/transcript`,{agent_id:n.agentId,before_turn:n.beforeTurn,after_turn:n.afterTurn,page_size:n.pageSize}),s=cG.parse(o),i={items:s.items,tasks:s.tasks,interactions:s.interactions,attachments:s.attachments,todos:s.todos,prompts:s.prompts,meta:s.meta,hasMoreOlder:s.has_more};return{agentId:s.agent_id,...i,agents:s.agents,pendingInteractions:s.pending_interactions,...s.seq!==void 0?{seq:s.seq}:{}}}const o9=10485760,SG=40001;function AG(e,t){if(e===void 0)return t;let n;const o=/filename\*\s*=\s*UTF-8''([^;]+)/i.exec(e)?.[1]?.trim();if(o!==void 0)try{n=decodeURIComponent(o.replaceAll(/^"|"$/g,""))}catch{return t}else n=/filename\s*=\s*"([^"]*)"/i.exec(e)?.[1]??/filename\s*=\s*([^;]+)/i.exec(e)?.[1]?.trim();return n===void 0||n.length===0||n.length>200||n==="."||n===".."||/[\u0000-\u001F\u007F/\\]/.test(n)||!n.toLowerCase().endsWith(".zip")?t:n}function hb(e){if(typeof e!="object"||e===null)return{errorName:typeof e};const t=e;return{errorName:typeof t.name=="string"?t.name:"Error",errorCode:typeof t.code=="number"?t.code:void 0,requestId:typeof t.requestId=="string"?t.requestId:void 0,phase:typeof t.phase=="string"?t.phase:void 0,httpStatus:typeof t.status=="number"?t.status:void 0}}function s9(e){return{id:e.id,sessionId:e.session_id,cwd:e.cwd,shell:e.shell,cols:e.cols,rows:e.rows,status:e.status,createdAt:e.created_at,exitedAt:e.exited_at,exitCode:e.exit_code}}function mb(e){return e==="auto_compact"||e==="manual_compact"}class MG{constructor(t){this.opts=t,this.tracer=t.tracer??oy,this.http=new Hk({origin:t.origin,identity:t.identity,tracer:this.tracer,credentialStore:t.credentialStore}),this.httpV2=new Hk({origin:t.origin,identity:t.identity,tracer:this.tracer,credentialStore:t.credentialStore,restBasePath:"/api/v2"})}http;httpV2;tracer;async getHealth(){return{status:"ok",uptimeSec:(await this.http.get("/healthz")).uptime_sec??0}}async getMeta(){const t=await this.http.get("/meta");return{serverVersion:t.server_version,serverId:t.server_id,startedAt:t.started_at,capabilities:t.capabilities,openInApps:Array.isArray(t.open_in_apps)?t.open_in_apps:[],dangerousBypassAuth:t.dangerous_bypass_auth===!0,experimentalFlags:t.experimental_flags??{},backend:t.backend==="v2"?"v2":"v1"}}async listSessions(t){const n={before_id:t?.beforeId,after_id:t?.afterId,page_size:t?.pageSize,busy:t?.busy,include_archive:t?.includeArchive,archived_only:t?.archivedOnly,exclude_empty:t?.excludeEmpty,workspace_id:t?.workspaceId},o=await this.http.get("/sessions",n);return{items:o.items.map(Fr),hasMore:o.has_more}}async listSessionsV2(t){const n={sort:t?.sort,page_size:t?.pageSize,page_token:t?.pageToken,"meta.updated_after":t?.updatedAfter,"meta.archived":t?.archived===void 0?void 0:String(t.archived),include:t?.include,"workspace.id":t?.workspaceIds,"activity.status":t?.statuses},o=await this.httpV2.get("/sessions",n);return{items:o.items,hasMore:o.has_more,nextPageToken:o.next_page_token}}async createSession(t){const n={metadata:t.cwd!==void 0?{cwd:t.cwd}:{}};t.workspaceId!==void 0&&(n.workspace_id=t.workspaceId),t.title!==void 0&&(n.title=t.title),t.model!==void 0&&(n.agent_config={model:t.model});const o=await this.http.post("/sessions",n);return Fr(o)}async getSession(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}`);return Fr(n)}async updateSession(t,n){const o={};n.title!==void 0&&(o.title=n.title),n.cwd!==void 0&&(o.metadata={cwd:n.cwd});const s={};n.model!==void 0&&(s.model=n.model),n.permissionMode!==void 0&&(s.permission_mode=n.permissionMode),n.planMode!==void 0&&(s.plan_mode=n.planMode),n.swarmMode!==void 0&&(s.swarm_mode=n.swarmMode),n.goalObjective!==void 0&&(s.goal_objective=n.goalObjective),n.goalControl!==void 0&&(s.goal_control=n.goalControl),n.thinking!==void 0&&(s.thinking=n.thinking),Object.keys(s).length>0&&(o.agent_config=s);const i=await this.http.post(`/sessions/${encodeURIComponent(t)}/profile`,o);return Fr(i)}async getSessionStatus(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/status`);return{model:n.model&&n.model.length>0?n.model:null,thinkingEffort:n.thinking_level,permission:n.permission,planMode:n.plan_mode===!0,swarmMode:n.swarm_mode===!0,contextTokens:n.context_tokens??0,maxContextTokens:n.max_context_tokens??0,contextUsage:n.context_usage??0}}async getSessionGoal(t){const n=await this.http.get(`/sessions/${encodeURIComponent(t)}/goal`);return WM(n)}async getSessionPlans(t,n){const o=await this.http.get(`/sessions/${encodeURIComponent(t)}/transcript/plan`,{agent_id:n.agentId,tool_call_id:n.toolCallId});return o.plans.map(s=>({agentId:o.agent_id,toolCallId:s.tool_call_id,turnId:s.turn_id,source:s.source,plan:s.plan,...s.path!==void 0?{path:s.path}:{},...s.options!==void 0?{options:s.options.map(i=>({label:i.label,...i.description!==void 0?{description:i.description}:{}}))}:{},...s.review!==void 0?{review:{state:s.review.state,...s.review.selected_option!==void 0?{selectedOption:s.review.selected_option}:{},...s.review.feedback!==void 0?{feedback:s.review.feedback}:{}}}:{}}))}async getSessionWarnings(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/warnings`)).warnings??[]}async archiveSession(t){return await this.http.post(`/sessions/${encodeURIComponent(t)}:archive`,{})}async restoreSession(t){const n=await this.http.post(`/sessions/${encodeURIComponent(t)}:restore`,{});return Fr(n)}async listMessages(t,n){const o={before_id:n?.beforeId,after_id:n?.afterId,page_size:n?.pageSize,role:n?.role},s=await this.http.get(`/sessions/${encodeURIComponent(t)}/messages`,o);return{items:s.items.map(s3),hasMore:s.has_more}}async getSessionSnapshot(t){const n=Date.now();this.tracer.traceKeyEvent?.("session:snapshot:start",{sessionId:t});try{const o=await this.http.get(`/sessions/${encodeURIComponent(t)}/snapshot`),s={asOfSeq:o.as_of_seq,epoch:o.epoch,session:Fr(o.session),messages:o.messages.items.map(s3),hasMoreMessages:o.messages.has_more,inFlightTurn:o.in_flight_turn===null?null:{turnId:o.in_flight_turn.turn_id,assistantText:o.in_flight_turn.assistant_text,thinkingText:o.in_flight_turn.thinking_text,runningTools:o.in_flight_turn.running_tools.map(i=>({toolCallId:i.tool_call_id,name:i.name,args:i.args,description:i.description,lastProgress:i.last_progress})),promptId:o.in_flight_turn.current_prompt_id},pendingApprovals:o.pending_approvals.map(HM),pendingQuestions:o.pending_questions.map(zM),subagents:(o.subagents??[]).map(i=>Hh(i,i.id))};return this.tracer.traceKeyEvent?.("session:snapshot:accepted",{sessionId:t,busy:s.session.busy,seq:s.asOfSeq,messageCount:s.messages.length,durationMs:Date.now()-n}),s}catch(o){throw this.tracer.traceKeyEvent?.("session:snapshot:failed",{sessionId:t,status:"failed",durationMs:Date.now()-n,...hb(o)}),o}}async getSessionTranscript(t,n){return xG(this.http,t,n)}async exportSession(t,n,o){const s=n===void 0?0:new TextEncoder().encode(n).byteLength,i=n===void 0||n.length===0?0:n.split(` +`).length,r=`/sessions/${encodeURIComponent(t)}/export`,l={web_log_bytes:s,web_log_entries:i},a=o?.desktop===!0;let u;try{u=await this.http.postZip(r,{web_log:n,...a?{desktop:!0}:{}},l)}catch(d){if(a&&Us(d)&&d.code===SG)u=await this.http.postZip(r,{web_log:n},l);else throw d}const c=`${t}.zip`;return{blob:u.blob,fileName:AG(u.contentDisposition,c)}}async submitPrompt(t,n){const o=Date.now();this.tracer.traceKeyEvent?.("prompt:start",{sessionId:t,contentCount:n.content.length,mediaCount:n.content.filter(s=>s.type==="image"||s.type==="video"||s.type==="file").length});try{const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts`,bU(n));return this.tracer.traceKeyEvent?.("prompt:accepted",{sessionId:t,promptId:s.prompt_id,status:s.status,durationMs:Date.now()-o}),{promptId:s.prompt_id,userMessageId:s.user_message_id,status:s.status}}catch(s){throw this.tracer.traceKeyEvent?.("prompt:failed",{sessionId:t,status:"failed",durationMs:Date.now()-o,...hb(s)}),s}}async steerPrompts(t,n){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts:steer`,{prompt_ids:n});return{steered:o.steered,promptIds:o.prompt_ids}}async abortPrompt(t,n){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/prompts/${encodeURIComponent(n)}:abort`,void 0,{allowCodes:[40903]});return{aborted:o.aborted,atSeq:o.at_seq}}async abortSession(t){return{aborted:(await this.http.post(`/sessions/${encodeURIComponent(t)}:abort`,{})).aborted}}async compactSession(t,n){await this.http.post(`/sessions/${encodeURIComponent(t)}:compact`,n?{instruction:n}:{})}async undoSession(t,n=1){await this.http.post(`/sessions/${encodeURIComponent(t)}:undo`,{count:n})}async forkSession(t,n){const o={};n?.title!==void 0&&(o.title=n.title);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}:fork`,o);return Fr(s)}async createChildSession(t,n){const o={};n?.title!==void 0&&(o.title=n.title);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/children`,o);return Fr(s)}async listChildSessions(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/children`)).items.map(Fr)}async startBtw(t){return{agentId:(await this.http.post(`/sessions/${encodeURIComponent(t)}:btw`,{})).agent_id}}async respondApproval(t,n,o){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/approvals/${encodeURIComponent(n)}`,CU(o));return{resolved:s.resolved,resolvedAt:s.resolved_at}}async respondQuestion(t,n,o){const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}`,SU(o));return{resolved:s.resolved,resolvedAt:s.resolved_at}}async dismissQuestion(t,n){return{dismissed:!0,dismissedAt:(await this.http.post(`/sessions/${encodeURIComponent(t)}/questions/${encodeURIComponent(n)}:dismiss`,void 0,{allowCodes:[40909]})).dismissed_at}}async listTasks(t,n){const o={status:n};return(await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks`,o)).items.map(i=>Hh(i))}async getTask(t,n,o){const s={with_output:o?.withOutput,output_bytes:o?.outputBytes},i=await this.http.get(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}`,s);return Hh(i)}async cancelTask(t,n){return await this.http.post(`/sessions/${encodeURIComponent(t)}/tasks/${encodeURIComponent(n)}:cancel`)}async listTerminals(t){return(await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals`)).items.map(s9)}async createTerminal(t,n={}){const o={cwd:n.cwd,shell:n.shell,cols:n.cols,rows:n.rows},s=await this.http.post(`/sessions/${encodeURIComponent(t)}/terminals`,o);return s9(s)}async getTerminal(t,n){const o=await this.http.get(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}`);return s9(o)}async closeTerminal(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/terminals/${encodeURIComponent(n)}:close`)}async listSkills(t){return((await this.http.get(`/sessions/${encodeURIComponent(t)}/skills`)).skills??[]).map(o=>({name:o.name,description:o.description,source:o.source}))}async listSkillsForWorkspace(t){return((await this.http.get(`/workspaces/${encodeURIComponent(t)}/skills`)).skills??[]).map(o=>({name:o.name,description:o.description,source:o.source}))}async activateSkill(t,n,o,s){const i={};o!==void 0&&o.length>0&&(i.args=o),s!==void 0&&s.length>0&&(i.attachments=s.map(BM));const r=await this.http.post(`/sessions/${encodeURIComponent(t)}/skills/${encodeURIComponent(n)}:activate`,i);return{activated:r.activated,skillName:r.skill_name}}async listDirectory(t,n){const o={};n.path!==void 0&&(o.path=n.path),n.depth!==void 0&&(o.depth=n.depth),n.includeGitStatus!==void 0&&(o.include_git_status=n.includeGitStatus);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:list`,o),i=s.children_by_path?Object.fromEntries(Object.entries(s.children_by_path).map(([r,l])=>[r,l.map(Wk)])):void 0;return{items:s.items.map(Wk),childrenByPath:i,truncated:s.truncated}}async readFile(t,n){const o={path:n.path};n.offset!==void 0&&(o.offset=n.offset),n.length!==void 0&&(o.length=n.length);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:read`,o);return{path:s.path,content:s.content,encoding:s.encoding,size:s.size,truncated:s.truncated,etag:s.etag,mime:s.mime,languageId:s.language_id,lineCount:s.line_count,isBinary:s.is_binary}}async searchFiles(t,n){const o={workspace:t,query:n.query};n.limit!==void 0&&(o.limit=n.limit);const s=await this.http.post("/workspace/fs:search",o);return{items:s.items.map(i=>({path:i.path,name:i.name,kind:i.kind,score:i.score,matchPositions:i.match_positions})),truncated:s.truncated}}async grepFiles(t,n){const o={pattern:n.pattern};n.regex!==void 0&&(o.regex=n.regex),n.caseSensitive!==void 0&&(o.case_sensitive=n.caseSensitive);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:grep`,o);return{files:s.files,filesScanned:s.files_scanned,truncated:s.truncated,elapsedMs:s.elapsed_ms}}async getGitStatus(t,n){const o={};n!==void 0&&(o.paths=n);const s=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:git_status`,o);return{branch:s.branch,ahead:s.ahead,behind:s.behind,entries:s.entries,additions:s.additions,deletions:s.deletions,pullRequest:s.pullRequest??null}}async getFileDiff(t,n){const o=await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:diff`,{path:n});return{path:o.path,diff:o.diff,truncated:o.truncated??!1}}getFileDownloadUrl(t,n){const o=n.split("/").map(s=>encodeURIComponent(s)).join("/");return Cd(this.opts.origin,`/sessions/${encodeURIComponent(t)}/fs/${o}:download`)}async openFile(t,n){const o={path:n.path};return n.line!==void 0&&(o.line=n.line),this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open`,o)}async revealFile(t,n){return this.http.post(`/sessions/${encodeURIComponent(t)}/fs:reveal`,{path:n.path})}async openInApp(t,n,o,s){const i={app_id:n,path:o};s!==void 0&&(i.line=s),await this.http.post(`/sessions/${encodeURIComponent(t)}/fs:open-in`,i)}async listWorkspaces(){try{return((await this.http.get("/workspaces")).items??[]).map(Pf)}catch{return[]}}async addWorkspace(t){const n={root:t.root};t.name!==void 0&&(n.name=t.name);const o=await this.http.post("/workspaces",n);return Pf(o)}async deleteWorkspace(t){await this.http.delete(`/workspaces/${encodeURIComponent(t)}`)}async updateWorkspace(t,n){const o=await this.http.patch(`/workspaces/${encodeURIComponent(t)}`,{name:n.name});return Pf(o)}async browseFs(t){try{const n=await this.http.get("/fs:browse",{path:t});return{path:n.path,parent:n.parent,entries:(n.entries??[]).map(o=>({name:o.name,path:o.path,isDir:o.is_dir}))}}catch{return{path:"",parent:null,entries:[]}}}async getFsHome(){try{const t=await this.http.get("/fs:home");return{home:t.home,recentRoots:t.recent_roots??[]}}catch{return{home:"",recentRoots:[]}}}async listModels(){return(await this.http.get("/models")).items.map(MU)}async listProviders(){return(await this.http.get("/providers")).items.map(nd)}async getProvider(t){const n=await this.http.get(`/providers/${encodeURIComponent(t)}`),o=nd(n);return n.api_key!==void 0?{...o,apiKey:n.api_key}:o}async addProvider(t){const n={id:t.id??"",type:t.type,models:(t.models??[]).map(s=>{const i={model:s.model,max_context_size:s.maxContextSize};return s.displayName!==void 0&&(i.display_name=s.displayName),s.capabilities!==void 0&&(i.capabilities=s.capabilities),s.maxOutputSize!==void 0&&(i.max_output_size=s.maxOutputSize),s.supportEfforts!==void 0&&(i.support_efforts=s.supportEfforts),s.adaptiveThinking!==void 0&&(i.adaptive_thinking=s.adaptiveThinking),i})};t.apiKey!==void 0&&(n.api_key=t.apiKey),t.baseUrl!==void 0&&(n.base_url=t.baseUrl),t.defaultModel!==void 0&&(n.default_model=t.defaultModel);const o=await this.http.post("/providers",n);return nd(o)}async updateProvider(t,n){const o={type:n.type,models:(n.models??[]).map(i=>{const r={model:i.model,max_context_size:i.maxContextSize};return i.displayName!==void 0&&(r.display_name=i.displayName),i.capabilities!==void 0&&(r.capabilities=i.capabilities),i.maxOutputSize!==void 0&&(r.max_output_size=i.maxOutputSize),i.supportEfforts!==void 0&&(r.support_efforts=i.supportEfforts),i.adaptiveThinking!==void 0&&(r.adaptive_thinking=i.adaptiveThinking),r})};n.newId!==void 0&&(o.new_id=n.newId),n.apiKey!==void 0&&(o.api_key=n.apiKey),n.baseUrl!==void 0&&(o.base_url=n.baseUrl),n.defaultModel!==void 0&&(o.default_model=n.defaultModel);const s=await this.http.put(`/providers/${encodeURIComponent(t)}`,o);return{provider:nd(s.provider)}}async deleteProvider(t){return await this.http.delete(`/providers/${encodeURIComponent(t)}`),{deleted:t}}async listCatalogProviders(){return(await this.http.get("/catalog/providers")).items.map(Uk)}async getCatalogProvider(t){const n=await this.http.get(`/catalog/providers/${encodeURIComponent(t)}`);return Uk(n)}async importCatalogProvider(t){const n={catalog_id:t.catalogId};t.apiKey!==void 0&&(n.api_key=t.apiKey),t.baseUrl!==void 0&&(n.base_url=t.baseUrl),t.id!==void 0&&(n.id=t.id);const o=await this.http.post("/providers:import_catalog",n);return{provider:nd(o.provider),modelsImported:o.models_imported}}async importCustomRegistry(t){const n={url:t.url};t.apiKey!==void 0&&(n.api_key=t.apiKey);const o=await this.http.post("/providers:import_registry",n);return{providers:o.providers.map(nd),modelsImported:o.models_imported}}async refreshProvider(t){const n=await this.http.post(`/providers/${encodeURIComponent(t)}:refresh`);return i9(n)}async refreshAllProviders(){const t=await this.http.post("/providers:refresh");return i9(t)}async refreshOAuthProviderModels(){const t=await this.http.post("/providers:refresh_oauth");return i9(t)}async getConfig(){const t=await this.http.get("/config");return i3(t)}async setConfig(t){const n={},o={providers:"providers",defaultProvider:"default_provider",defaultModel:"default_model",secondaryModel:"secondary_model",models:"models",thinking:"thinking",planMode:"plan_mode",yolo:"yolo",defaultPermissionMode:"default_permission_mode",defaultPlanMode:"default_plan_mode",permission:"permission",hooks:"hooks",services:"services",mergeAllAvailableSkills:"merge_all_available_skills",extraSkillDirs:"extra_skill_dirs",loopControl:"loop_control",background:"background",experimental:"experimental",telemetry:"telemetry",raw:"raw"};for(const[i,r]of Object.entries(t)){const l=o[i];l!==void 0&&(n[l]=r)}const s=await this.http.post("/config",n);return i3(s)}async getAuth(){const t=await this.http.get("/auth");return{ready:t.ready,providersCount:t.providers_count,defaultModel:t.default_model,managedProvider:t.managed_provider?{status:t.managed_provider.status}:null}}async startOAuthLogin(){const t=await this.http.post("/oauth/login",{});return t.status==="authenticated"?{flowId:t.flow_id,provider:t.provider,status:"authenticated"}:{flowId:t.flow_id,provider:t.provider,status:"pending",verificationUri:t.verification_uri,verificationUriComplete:t.verification_uri_complete,userCode:t.user_code,expiresIn:t.expires_in,interval:t.interval,expiresAt:t.expires_at}}async pollOAuthLogin(){const t=await this.http.get("/oauth/login");return t?{flowId:t.flow_id,status:t.status,resolvedAt:t.resolved_at}:null}async cancelOAuthLogin(){const t=await this.http.delete("/oauth/login");return{cancelled:t.cancelled,status:t.status}}async logout(){return{loggedOut:(await this.http.post("/oauth/logout",{})).logged_out}}async getUsage(){const t=await this.http.get("/oauth/usage");if(t.kind==="error")return{kind:"error",message:t.message,status:t.status};const n=o=>({name:o.name,window:o.window,used:o.used,limit:o.limit,resetAt:o.reset_at});return{kind:"ok",summary:t.summary===null?null:n(t.summary),limits:t.limits.map(n),extraUsage:t.extra_usage===null?null:{balanceCents:t.extra_usage.balance_cents,totalCents:t.extra_usage.total_cents,monthlyChargeLimitEnabled:t.extra_usage.monthly_charge_limit_enabled,monthlyChargeLimitCents:t.extra_usage.monthly_charge_limit_cents,monthlyUsedCents:t.extra_usage.monthly_used_cents,currency:t.extra_usage.currency}}}async getUserInfo(){return this.http.get("/oauth/userinfo")}async uploadFile(t){const n=new FormData;n.append("file",t.file,t.name??(t.file instanceof File?t.file.name:"upload")),t.name!==void 0&&n.append("name",t.name);const o=await this.http.postForm("/files",n);return{id:o.id,name:o.name,mediaType:o.media_type,size:o.size}}getFileUrl(t){return Cd(this.opts.origin,`/files/${encodeURIComponent(t)}`)}async getFileBlob(t){return this.http.getBlob(`/files/${encodeURIComponent(t)}`)}async readHostFileContent(t){const n=await this.http.getBlob("/fs:content",{path:t},{maxBytes:o9});if(n.size>o9)throw new sy({size:n.size,limit:o9});const o=n.type,s=!TG(o),i=o||(s?"application/octet-stream":"text/plain");if(s){const l=await EG(n);return{path:t,content:l,encoding:"base64",mime:i,isBinary:!0,size:n.size}}const r=await n.text();return{path:t,content:r,encoding:"utf-8",mime:i,isBinary:!1,size:n.size}}connectEvents(t){const n=fU(this.opts.origin,this.opts.identity.clientId),o=this.opts.projectorFactory(),s=new _G({wsUrl:n,clientId:this.opts.identity.clientId,tracer:this.tracer,credentialStore:this.opts.credentialStore,mainAgentOnly:this.opts.mainAgentOnly,handlers:{onWireEvent:i=>{const r=TU(i),l=EU(i),a=AU(i);a.type==="historyCompacted"&&!mb(a.reason)&&t.onResync(a.sessionId,a.beforeSeq),t.onEvent(a,{sessionId:r,seq:l})},onRawAgentEvent:i=>{const{type:r,seq:l,session_id:a,payload:u,offset:c}=i,d=o.project(r,u,a,{offset:c});for(const f of d){const h=u?.turnId,m=f.type==="assistantDelta"&&typeof h=="number"&&typeof c=="number"&&(r==="assistant.delta"||r==="thinking.delta")?{turnId:h,offset:c,kind:r==="assistant.delta"?"text":"thinking"}:void 0;f.type==="historyCompacted"&&!mb(f.reason)&&t.onResync(a,l),t.onEvent(f,{sessionId:a,seq:l,stream:m})}},onResync:(i,r,l)=>{o.reset(i),t.onResync(i,r,l)},onConnectionState:i=>{t.onConnectionChange(i)},onReplayComplete:()=>{t.onReplayComplete?.()},onError:(i,r,l)=>{t.onError(i,r,l)},onTerminalOutput:(i,r,l,a)=>{t.onTerminalOutput?.(i,r,l,a)},onTerminalExit:(i,r,l)=>{t.onTerminalExit?.(i,r,l)},onTranscriptReset:(i,r,l,a)=>{t.onTranscriptReset?.(i,r,l,a)},onTranscriptOps:(i,r,l,a)=>t.onTranscriptOps?.(i,r,l,a)??!0}});return s.connect(),{subscribe(i,r){s.subscribe(i,r??{seq:0})},unsubscribe(i){s.unsubscribe(i)},subscribeTranscript(i,r,l){s.subscribeTranscript(i,r,l)},unsubscribeTranscript(i,r){s.unsubscribeTranscript(i,r)},seedSnapshot(i,r){if(r.inFlightTurn===null){o.reset(i);return}const l=o.seedInFlight(i,r.inFlightTurn);for(const a of l)t.onEvent(a,{sessionId:i,seq:r.asOfSeq})},bindNextPromptId(i,r){o.bindNextPromptId(i,r)},abort(i,r){s.abort(i,r)},terminalAttach(i,r,l){s.terminalAttach(i,r,l)},terminalInput(i,r,l){s.terminalInput(i,r,l)},terminalResize(i,r,l,a){s.terminalResize(i,r,l,a)},terminalDetach(i,r){s.terminalDetach(i,r)},terminalClose(i,r){s.terminalClose(i,r)},markSideChannelAgent(i,r){s.markSideChannelAgent(i,r),o.markSideChannelAgent(r)},health(){return s.health()},reconnect(){s.reconnect()},close(){s.close()}}}}function i9(e){return{changed:e.changed.map(t=>({providerId:t.provider_id,providerName:t.provider_name,added:t.added,removed:t.removed})),unchanged:e.unchanged,failed:e.failed}}function TG(e){const t=e.toLowerCase().split(";")[0].trim();return t===""||t==="text/plain"||t.startsWith("text/")?!0:/(json|xml|javascript|typescript|x-yaml|yaml|svg|x-sh|x-python|markdown|csv|html|css)$/.test(t)}function EG(e){return new Promise((t,n)=>{const o=new FileReader;o.onload=()=>{const s=String(o.result);t(s.slice(s.indexOf(",")+1))},o.onerror=()=>n(o.error),o.readAsDataURL(e)})}function IG(){return window.kimiDesktop}function FT(e,t,n){const o=n.length===0?void 0:n.length===1?n[0]:n;try{IG()?.log?.(e,t,o)}catch{}}function gl(e,...t){console.warn(e,...t),FT("warn",e,t)}function Xl(e,...t){console.error(e,...t),FT("error",e,t)}const LG={multiedit:"multi_edit",multiedits:"multi_edit",shell:"bash",run:"bash",exec:"bash",ripgrep:"grep",rg:"grep",find:"glob",fetch:"web_fetch",webfetch:"web_fetch",url_fetch:"web_fetch",urlfetch:"web_fetch",list:"ls",listdir:"ls",list_dir:"ls",todowrite:"todo",todo_write:"todo",todoread:"todo",todolist:"todo",todo_list:"todo",agent:"task",subagent:"task",websearch:"search",web_search:"search",create_goal:"creategoal",get_goal:"getgoal",set_goal_budget:"setgoalbudget",update_goal:"updategoal"};function Gs(e){const t=(e??"").trim().toLowerCase().replace(/[\s-]+/g,"_");return LG[t]??t}const $G={read:"tools.label.read",bash:"tools.label.bash",edit:"tools.label.edit",multi_edit:"tools.label.edit",write:"tools.label.write",grep:"tools.label.grep",glob:"tools.label.glob",ls:"tools.label.ls",web_fetch:"tools.label.web_fetch",search:"tools.label.search",todo:"tools.label.todo",task:"tools.label.task",agentswarm:"tools.label.swarm",askuserquestion:"tools.label.ask_user",exitplanmode:"tools.label.plan",creategoal:"tools.label.goal_create",getgoal:"tools.label.goal_get",setgoalbudget:"tools.label.goal_budget",updategoal:"tools.label.goal_update"};function RT(e,t){const n=$G[Gs(t)];return n?e(n):t}const OT=80;function NG(e,t=OT){const n=e.trim();return n.length>t?n.slice(0,t-1)+"…":n}function FG(e,t){const n=e.trim();return!!(n===""||n==="{}"||n==="[]"||n==="null"||t&&Object.keys(t).length===0)}function RG(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function En(e){return typeof e=="string"&&e.length>0?e:void 0}function Ta(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function OG(e){try{const t=new URL(e),n=t.pathname.split("/").filter(Boolean)[0];return n?`${t.host}/${n}`:t.host}catch{return e.replace(/^https?:\/\//,"")}}function r9(e){return En(e.path)??En(e.file_path)??En(e.filePath)??En(e.filename)}const PG={active:"status.goalStatusActive",blocked:"status.goalStatusBlocked",complete:"status.goalStatusComplete"};function DG(e,t){const n=En(t);if(!n)return;const o=PG[n];return o?e(o):n}function BG(e,t){const n=Ta(t.value),o=En(t.unit);if(!(n===void 0||!o))switch(o){case"turns":return e("tools.goal.turns",{value:n});case"tokens":return e("tools.goal.tokens",{value:n});case"milliseconds":return e("tools.goal.milliseconds",{value:n});case"seconds":return e("tools.goal.seconds",{value:n});case"minutes":return e("tools.goal.minutes",{value:n});case"hours":return e("tools.goal.hours",{value:n});default:return e("tools.goal.budget",{value:n,unit:o})}}function wy(e,t,n,o=!1){const s=(i,r=OT)=>o?i.trim():NG(i,r);try{const i=RG(n);if(!o&&FG(n,i))return"";const r=()=>s(n.replace(/^·\s*/,""));if(!i)return r();switch(Gs(t)){case"read":{const l=r9(i);if(!l)return r();const a=Ta(i.offset)??Ta(i.line_start)??Ta(i.start_line),u=Ta(i.limit)??Ta(i.length),c=Ta(i.line_end)??Ta(i.end_line)??(a!==void 0&&u!==void 0?a+u:void 0);return s(a!==void 0&&c!==void 0?`${l}:${a}-${c}`:a!==void 0?`${l}:${a}`:l)}case"write":{const l=r9(i);return l?s(`${l} ${e("tools.chip.created")}`):r()}case"edit":case"multi_edit":{const l=r9(i);return l?s(l):r()}case"bash":{const l=En(i.command)??En(i.cmd)??En(i.script);return l?l.trim():r()}case"grep":case"search":{const l=En(i.pattern)??En(i.query)??En(i.regex),a=En(i.path)??En(i.glob)??En(i.include);return l&&a?s(e("tools.summary.inScope",{value:l,scope:a})):l?s(l):r()}case"glob":{const l=En(i.pattern)??En(i.glob)??En(i.query),a=En(i.path)??En(i.cwd);return l&&a?s(e("tools.summary.inScope",{value:l,scope:a})):l?s(l):En(i.path)?s(En(i.path)):r()}case"ls":{const l=En(i.path)??En(i.dir)??En(i.directory)??En(i.cwd);return l?s(l):r()}case"web_fetch":{const l=En(i.url)??En(i.uri);return l?s(OG(l)):r()}case"todo":case"task":{const l=En(i.description)??En(i.title)??En(i.prompt)??En(i.name)??En(i.subagent_type);if(l)return s(l);const a=Array.isArray(i.todos)?i.todos:Array.isArray(i.items)?i.items:void 0;return a?s(e("tools.chip.todos",{count:a.length})):r()}case"creategoal":{if(o)return r();const l=En(i.objective),a=En(i.completionCriterion);return l&&a?s(e("tools.goal.objectiveWithCriterion",{objective:l,criterion:a})):l?s(l):r()}case"getgoal":return o?r():"";case"setgoalbudget":{if(o)return r();const l=BG(e,i);return l?s(l):r()}case"updategoal":{if(o)return r();const l=DG(e,i.status);return l?s(e("tools.goal.status",{status:l})):r()}default:return r()}}catch{return n}}function HG(e,t){try{switch(Gs(t.name)){case"bash":return t.timing?t.timing:"";case"read":{if(t.output&&t.output.length>0){const n=t.output.length;return e("tools.chip.lines",{count:n})}return""}case"edit":case"multi_edit":case"write":{if(t.output){for(const o of t.output){const s=o.match(/\+(\d+).*[-−](\d+)/);if(s)return`+${s[1]} −${s[2]}`}const n=t.output.find(o=>/\d+/.test(o));if(n){const o=n.match(/\+(\d+)/),s=n.match(/[-−](\d+)/);if(o||s)return`${o?`+${o[1]}`:""} ${s?`−${s[1]}`:""}`.trim()}if(t.status!=="error")return e("tools.chip.edited")}return""}case"grep":case"search":return t.output&&t.output.length>0?e("tools.chip.results",{count:t.output.length}):"";default:return""}}catch{return""}}const zG="main",WG=new Set(["turn.started","turn.step.started","turn.step.completed","turn.step.retrying","turn.step.interrupted","turn.ended","thinking.delta","assistant.delta","tool.use","tool.call.started","tool.call.delta","tool.progress","tool.result","agent.status.updated","prompt.completed","prompt.aborted","error"]);function pl(e="msg_"){const t=Date.now().toString(36).padStart(10,"0"),n=Math.random().toString(36).slice(2,12).padEnd(10,"0");return`${e}${t}${n}`}function UG(e){if(!e||typeof e!="object")return{input:0,output:0,cacheRead:0,cacheCreate:0};const t=e;return{input:t.inputOther??t.input_tokens??0,output:t.output??t.output_tokens??0,cacheRead:t.inputCacheRead??t.cache_read_input_tokens??0,cacheCreate:t.inputCacheCreation??t.cache_creation_input_tokens??0}}function gb(){return{turnPromptId:new Map,currentPromptId:void 0,currentAssistantMsgId:void 0,turnTextLen:0,turnThinkLen:0,toolStartTimes:new Map,totalInput:0,totalOutput:0,totalCacheRead:0,totalCacheCreate:0,contextTokens:0,contextLimit:0,turnCount:0,model:"",messages:[],subagentMeta:new Map,retryReuseMsgId:void 0,retryActive:!1}}function _o(e,t){const n=e[t];return typeof n=="string"?n:void 0}function Ts(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0}function hr(e,t){const n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:null}function jG(e){if(!e||typeof e!="object")return null;const t=e,n=t.budget,o=n&&typeof n=="object"?n:{},s=_o(t,"status");if(s!=="active"&&s!=="paused"&&s!=="blocked"&&s!=="complete")return null;const i=_o(t,"goalId")??_o(t,"goal_id")??"goal",r=_o(t,"objective")??"";return{goalId:i,objective:r,completionCriterion:_o(t,"completionCriterion")??_o(t,"completion_criterion"),status:s,turnsUsed:Ts(t,"turnsUsed")??Ts(t,"turns_used")??0,tokensUsed:Ts(t,"tokensUsed")??Ts(t,"tokens_used")??0,wallClockMs:Ts(t,"wallClockMs")??Ts(t,"wall_clock_ms")??0,terminalReason:_o(t,"terminalReason")??_o(t,"terminal_reason"),budget:{tokenBudget:hr(o,"tokenBudget")??hr(o,"token_budget"),remainingTokens:hr(o,"remainingTokens")??hr(o,"remaining_tokens"),turnBudget:hr(o,"turnBudget")??hr(o,"turn_budget"),remainingTurns:hr(o,"remainingTurns")??hr(o,"remaining_turns"),wallClockBudgetMs:hr(o,"wallClockBudgetMs")??hr(o,"wall_clock_budget_ms"),remainingWallClockMs:hr(o,"remainingWallClockMs")??hr(o,"remaining_wall_clock_ms"),overBudget:o.overBudget===!0||o.over_budget===!0}}}function Ku(e,t,n,o,s){if(typeof o!="string"||o.length===0)return null;const r={...t.subagentMeta.get(o)??{id:o,agentId:o,sessionId:n,kind:"subagent",description:e("tasks.dockSubagent"),status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued"},...s,id:o,sessionId:n,kind:"subagent"};return t.subagentMeta.set(o,r),r}function VG(e,t,n){if(t==="turn.step.started")return null;if(t==="tool.use"||t==="tool.call.started"){const o=_o(n,"name")??_o(n,"toolName")??"tool",s=RT(e,qG(o)),i=KG(e,o,n.args??n.input);return i?`Calling ${s}: ${i}`:`Calling ${s}`}if(t==="tool.progress"){const o=n.update;if(o&&typeof o=="object"){const i=_o(o,"text");if(i)return l9(i);const r=_o(o,"message");if(r)return l9(r)}const s=_o(n,"message");if(s)return l9(s)}return null}function qG(e){return e.replace(/_\d+$/,"")}const vb=2e3;function l9(e){return e.length>vb?`${e.slice(0,vb)}…`:e}function KG(e,t,n){if(n==null)return"";const o=typeof n=="string"?n:JSON.stringify(n);return wy(e,t,o)}function ZG(e,t,n,o,s,i,r){if(r.has(o)&&s==="turn.step.started")return[];if(s==="assistant.delta"){const d=_o(i,"delta");if(!d)return[];const f=t.subagentMeta.get(o),h=Ku(e,t,n,o,{status:"running",subagentPhase:"working",startedAt:f?.startedAt??new Date().toISOString()}),m=[];return h&&m.push({type:"taskCreated",sessionId:n,task:h}),m.push({type:"taskProgress",sessionId:n,taskId:o,outputChunk:d,stream:"stdout",kind:"text"}),m}const l=VG(e,s,i);if(l===null||l.length===0)return[];const a=t.subagentMeta.get(o),u=Ku(e,t,n,o,{status:"running",subagentPhase:"working",startedAt:a?.startedAt??new Date().toISOString()}),c=[];return u&&c.push({type:"taskCreated",sessionId:n,task:u}),c.push({type:"taskProgress",sessionId:n,taskId:o,outputChunk:l,stream:"stdout"}),c}function $u(e){return{...e,content:e.content.map(t=>({...t}))}}function yb(e,t,n){const o={id:pl("msg_"),sessionId:t,role:"assistant",content:[],createdAt:new Date().toISOString(),promptId:n};return e.messages.push(o),o}function GG(e,t,n,o,s,i){const r={id:o,sessionId:t,role:"user",content:s,createdAt:i,promptId:n};return e.messages.push(r),r}function kb(e){return Array.isArray(e)?e.map(t=>ry(t)):[]}function bb(e,t,n,o){const s=e.messages.find(r=>r.id===t);if(!s)return-1;const i=s.content.at(-1);return i&&i.type===n?(n==="text"?i.text+=o:i.thinking+=o,s.content.length-1):(s.content.push(n==="text"?{type:"text",text:o}:{type:"thinking",thinking:o}),s.content.length-1)}function YG(e,t,n,o,s,i){const r=e.messages.find(l=>l.id===t);r&&r.content.push({type:"toolUse",toolCallId:n,toolName:o,input:s,outputLines:i})}function XG(e){const t=e.update,n=t&&typeof t=="object"?t:null,s=(n?.stream??n?.kind??e.stream)==="stderr"?"stderr":"stdout",i=typeof n?.text=="string"&&n.text||typeof n?.message=="string"&&n.message||typeof e.chunk=="string"&&e.chunk||typeof e.output=="string"&&e.output||typeof e.message=="string"&&e.message||"";return i.length>0?{outputChunk:i,stream:s}:null}function Cb(e,t){e.messages.find(n=>n.id===t)}function JG(e,t,n,o,s,i){const r={id:pl("msg_"),sessionId:t,role:"tool",content:[{type:"toolResult",toolCallId:n,output:o,isError:s}],createdAt:new Date().toISOString(),promptId:i};return e.messages.push(r),r}function ef(e,t){return e.messages.find(n=>n.id===t)}function wb(e){return{inputTokens:e.totalInput,outputTokens:e.totalOutput,cacheReadTokens:e.totalCacheRead,cacheCreationTokens:e.totalCacheCreate,totalCostUsd:0,contextTokens:e.contextTokens,contextLimit:e.contextLimit,turnCount:e.turnCount}}function QG(e){const{t}=e,n=new Map,o=new Set;function s(f){let h=n.get(f);return h||(h=gb(),n.set(f,h)),h}function i(f){n.set(f,gb())}function r(f){o.add(f)}function l(f,h){const m=s(f);m.currentPromptId=h}function a(f,h){i(f);const m=s(f),v=h.promptId??pl("pr_");m.currentPromptId=v,m.turnPromptId.set(h.turnId,v);const k=yb(m,f,v);h.thinkingText.length>0&&k.content.push({type:"thinking",thinking:h.thinkingText}),h.assistantText.length>0&&k.content.push({type:"text",text:h.assistantText});for(const w of h.runningTools){const b=typeof w.lastProgress?.text=="string"&&w.lastProgress.text.length>0?[w.lastProgress.text]:void 0;k.content.push({type:"toolUse",toolCallId:w.toolCallId,toolName:w.name,input:w.args??{},outputLines:b}),m.toolStartTimes.set(w.toolCallId,Date.now())}return m.currentAssistantMsgId=k.id,m.turnTextLen=h.assistantText.length,m.turnThinkLen=h.thinkingText.length,[{type:"messageCreated",message:$u(k)}]}function u(f,h,m,v){try{return d(f,h,m,v)}catch(k){return Xl("[agentProjector] Error projecting event:",f,k instanceof Error?k.message:k),[]}}function c(f,h){return h===void 0?"append":hf?"gap":"append"}function d(f,h,m,v){const k=s(m),w=h,b=[],_=w?.agentId;if(typeof _=="string"&&_!==zG){const g=o.has(_);if(f==="prompt.submitted"){if(!g)return[];const x=w?.promptId,S=w?.userMessageId;if(!x||!S)return[];const T=kb(w?.content);return T.length===0?[]:[{type:"messageCreated",agentId:_,message:{id:S,sessionId:m,role:"user",content:T,createdAt:typeof w?.createdAt=="string"?w.createdAt:new Date().toISOString(),promptId:x}}]}if(g&&(f==="thinking.delta"||f==="assistant.delta")){const x=w?.delta??"";return x?[{type:"agentDelta",sessionId:m,agentId:_,delta:{[f==="thinking.delta"?"thinking":"text"]:x}}]:[]}if(g&&f==="turn.ended")return[{type:"agentTurnEnded",sessionId:m,agentId:_,reason:w?.reason}];if(WG.has(f))return ZG(t,k,m,_,f,w??{},o)}switch(f){case"session.meta.updated":{const g=w?.patch?.title??w?.title,x=w?.patch?.lastPrompt,S={};typeof g=="string"&&g.length>0&&(S.title=g),typeof x=="string"&&(S.lastPrompt=x),(S.title!==void 0||S.lastPrompt!==void 0)&&b.push({type:"sessionMetaUpdated",sessionId:m,...S});break}case"prompt.submitted":{const g=w?.promptId,x=w?.userMessageId;if(!g||!x)break;const S=kb(w?.content);if(S.length===0)break;k.currentPromptId=g;const T=GG(k,m,g,x,S,typeof w?.createdAt=="string"?w.createdAt:new Date().toISOString());b.push({type:"messageCreated",message:$u(T),...typeof _=="string"?{agentId:_}:{}});break}case"turn.started":{const g=w?.turnId,x=k.currentPromptId??pl("pr_");k.currentPromptId=x,g!==void 0&&k.turnPromptId.set(g,x),k.turnTextLen=0,k.turnThinkLen=0;const S=w?.origin;if(S&&typeof S=="object"&&S.kind==="system_trigger"&&S.name==="goal_continuation"){const T={id:g!==void 0?`goal_cont_${g}`:pl("goal_"),sessionId:m,role:"user",content:[{type:"text",text:_o(w??{},"prompt")??""}],createdAt:new Date().toISOString(),metadata:{origin:S}};k.messages.push(T),b.push({type:"turnActiveChanged",sessionId:m,active:!0}),b.push({type:"messageCreated",message:$u(T)});break}b.push({type:"turnActiveChanged",sessionId:m,active:!0});break}case"turn.step.started":{const g=w?.turnId;k.retryActive&&(k.retryActive=!1,b.push({type:"turnRetry",sessionId:m,retry:void 0}));let x=k.turnPromptId.get(g)??k.currentPromptId;if(x||(x=pl("pr_"),k.currentPromptId=x,g!==void 0&&k.turnPromptId.set(g,x)),k.turnTextLen=0,k.turnThinkLen=0,k.retryReuseMsgId!==void 0){const T=k.retryReuseMsgId;if(k.retryReuseMsgId=void 0,ef(k,T)!==void 0){k.currentAssistantMsgId=T;break}}const S=yb(k,m,x);k.currentAssistantMsgId=S.id,b.push({type:"messageCreated",message:$u(S)});break}case"thinking.delta":{const g=k.currentAssistantMsgId;if(!g)break;const x=w?.delta??"";if(!x)break;v?.offset===0&&k.turnThinkLen>0&&(k.turnThinkLen=0);const S=c(k.turnThinkLen,v?.offset);if(S==="skip")break;if(S==="gap"){b.push({type:"historyCompacted",sessionId:m,beforeSeq:0,reason:"delta_gap"});break}const T=bb(k,g,"thinking",x);if(T<0)break;k.turnThinkLen+=x.length,b.push({type:"assistantDelta",sessionId:m,messageId:g,contentIndex:T,delta:{thinking:x}});break}case"assistant.delta":{const g=k.currentAssistantMsgId;if(!g)break;const x=w?.delta??"";if(!x)break;v?.offset===0&&k.turnTextLen>0&&(k.turnTextLen=0);const S=c(k.turnTextLen,v?.offset);if(S==="skip")break;if(S==="gap"){b.push({type:"historyCompacted",sessionId:m,beforeSeq:0,reason:"delta_gap"});break}const T=bb(k,g,"text",x);if(T<0)break;k.turnTextLen+=x.length,b.push({type:"assistantDelta",sessionId:m,messageId:g,contentIndex:T,delta:{text:x}});break}case"tool.use":case"tool.call.started":{const g=k.currentAssistantMsgId,x=w?.turnId,S=k.turnPromptId.get(x)??k.currentPromptId;if(!g||!S)break;const T=w?.toolCallId,A=w?.name??w?.toolName??"",E=w?.args??w?.input??{};YG(k,g,T,A,E);const P=ef(k,g);P&&P.content.length-1,k.toolStartTimes.set(T,Date.now()),P&&b.push({type:"messageUpdated",sessionId:m,messageId:g,content:P.content.map(D=>({...D})),status:"pending"});break}case"tool.call.delta":break;case"tool.progress":{const g=w?.toolCallId,x=XG(w??{});g&&x&&b.push({type:"toolOutput",sessionId:m,toolCallId:g,outputChunk:x.outputChunk,stream:x.stream});break}case"tool.result":{const g=w?.turnId;let x=k.turnPromptId.get(g)??k.currentPromptId;x||(x=pl("pr_"),k.currentPromptId=x,g!==void 0&&k.turnPromptId.set(g,x));const S=w?.toolCallId,T=w?.output,A=w?.isError??!1;k.toolStartTimes.get(S)??Date.now(),k.toolStartTimes.delete(S);const E=JG(k,m,S,T,A,x);b.push({type:"messageCreated",message:$u(E)}),k.currentAssistantMsgId=void 0;break}case"turn.step.completed":{const g=k.currentAssistantMsgId,x=UG(w?.usage);if(k.totalInput+=x.input,k.totalOutput+=x.output,k.totalCacheRead+=x.cacheRead,k.totalCacheCreate+=x.cacheCreate,g){Cb(k,g);const S=ef(k,g);S&&b.push({type:"messageUpdated",sessionId:m,messageId:g,content:S.content.map(T=>({...T})),status:"completed"})}break}case"agent.status.updated":{w?.model&&(k.model=w.model),w?.contextTokens!==void 0&&(k.contextTokens=w.contextTokens),w?.maxContextTokens!==void 0&&(k.contextLimit=w.maxContextTokens);const g=w?.phase;g!=null&&g.kind==="retrying"?(k.retryActive=!0,b.push({type:"turnRetry",sessionId:m,retry:{failedAttempt:Ts(g,"failedAttempt")??0,nextAttempt:Ts(g,"nextAttempt")??0,maxAttempts:Ts(g,"maxAttempts")??0,delayMs:Ts(g,"delayMs")??0,errorName:_o(g,"errorName"),statusCode:Ts(g,"statusCode"),turnId:Ts(g,"turnId")}})):k.retryActive&&g!==void 0&&g!==null&&typeof g.kind=="string"&&(k.retryActive=!1,b.push({type:"turnRetry",sessionId:m,retry:void 0})),b.push({type:"sessionUsageUpdated",sessionId:m,usage:wb(k),model:k.model||void 0,swarmMode:w?.swarmMode===!0?!0:w?.swarmMode===!1?!1:void 0,planMode:w?.planMode===!0?!0:w?.planMode===!1?!1:void 0,thinking:typeof w?.thinkingEffort=="string"&&w.thinkingEffort.length>0?w.thinkingEffort:void 0});break}case"turn.ended":{const g=k.currentAssistantMsgId,x=w?.reason??"completed",S=Ts(w??{},"durationMs"),T=w?.turnId,A=(T!==void 0?k.turnPromptId.get(T):void 0)??k.currentPromptId;if(b.push({type:"turnActiveChanged",sessionId:m,active:!1,reason:w?.reason,promptId:A}),g){Cb(k,g);const P=ef(k,g);P&&b.push({type:"messageUpdated",sessionId:m,messageId:g,content:P.content.map(D=>({...D})),status:x==="failed"||x==="blocked"?"error":"completed",durationMs:S})}k.turnCount++;const E=wb(k);b.push({type:"sessionUsageUpdated",sessionId:m,usage:E}),k.currentAssistantMsgId=void 0,k.currentPromptId=void 0,k.turnTextLen=0,k.turnThinkLen=0,k.retryReuseMsgId=void 0;break}case"prompt.completed":{const g=w?.promptId;typeof g=="string"&&g.length>0&&b.push({type:"promptCompleted",sessionId:m,promptId:g,reason:w?.reason??"completed"});break}case"prompt.aborted":{const g=w?.promptId;typeof g=="string"&&g.length>0&&b.push({type:"promptAborted",sessionId:m,promptId:g});break}case"turn.step.retrying":{k.retryActive=!0,b.push({type:"turnRetry",sessionId:m,retry:{failedAttempt:Ts(w??{},"failedAttempt")??0,nextAttempt:Ts(w??{},"nextAttempt")??0,maxAttempts:Ts(w??{},"maxAttempts")??0,delayMs:Ts(w??{},"delayMs")??0,errorName:_o(w??{},"errorName"),statusCode:Ts(w??{},"statusCode"),turnId:typeof w?.turnId=="number"?w.turnId:void 0}});const g=k.currentAssistantMsgId;if(g!==void 0){const x=ef(k,g);x!==void 0&&(x.content=x.content.filter(S=>S.type!=="text"&&S.type!=="thinking"&&S.type!=="toolUse"),b.push({type:"messageUpdated",sessionId:m,messageId:g,content:x.content.map(S=>({...S})),status:"pending"}),k.retryReuseMsgId=g)}k.turnTextLen=0,k.turnThinkLen=0,k.toolStartTimes.clear();break}case"turn.step.interrupted":{k.currentAssistantMsgId=void 0,k.retryReuseMsgId=void 0;break}case"subagent.spawned":{const g=typeof w?.subagentId=="string"&&w.subagentId.length>0?w.subagentId:pl("task_"),x={id:g,agentId:g,sessionId:m,kind:"subagent",description:typeof w?.description=="string"?w.description:w?.subagentName??t("tasks.dockSubagent"),status:"running",createdAt:new Date().toISOString(),subagentPhase:"queued",subagentType:typeof w?.subagentName=="string"?w.subagentName:void 0,model:typeof w?.model=="string"&&w.model.length>0?w.model:void 0,thinkingEffort:typeof w?.thinkingEffort=="string"&&w.thinkingEffort.length>0?w.thinkingEffort:void 0,parentToolCallId:typeof w?.parentToolCallId=="string"?w.parentToolCallId:void 0,swarmIndex:typeof w?.swarmIndex=="number"?w.swarmIndex:void 0,runInBackground:w?.runInBackground===!0};k.subagentMeta.set(x.id,x),b.push({type:"taskCreated",sessionId:m,task:x});break}case"subagent.started":{const g=Ku(t,k,m,w?.subagentId,{subagentPhase:"working",status:"running",startedAt:new Date().toISOString()});g&&b.push({type:"taskCreated",sessionId:m,task:g});break}case"subagent.suspended":{const g=Ku(t,k,m,w?.subagentId,{subagentPhase:"suspended",status:"running",suspendedReason:typeof w?.reason=="string"?w.reason:void 0});g&&b.push({type:"taskCreated",sessionId:m,task:g});break}case"subagent.completed":{const g=typeof w?.resultSummary=="string"?w.resultSummary:void 0,x=Ku(t,k,m,w?.subagentId,{subagentPhase:"completed",status:"completed",completedAt:new Date().toISOString(),outputPreview:g});x&&b.push({type:"taskCreated",sessionId:m,task:x}),b.push({type:"taskCompleted",sessionId:m,taskId:w?.subagentId??"",status:"completed",outputPreview:g});break}case"subagent.failed":{const g=typeof w?.error=="string"?w.error:void 0,x=Ku(t,k,m,w?.subagentId,{subagentPhase:"failed",status:"failed",completedAt:new Date().toISOString(),outputPreview:g});x&&b.push({type:"taskCreated",sessionId:m,task:x}),b.push({type:"taskCompleted",sessionId:m,taskId:w?.subagentId??"",status:"failed",outputPreview:g});break}case"error":{b.push({type:"unknown",raw:{_agentError:!0,code:w?.code,message:w?.message,name:w?.name,details:w?.details,retryable:w?.retryable}});break}case"task.notified":{const g=_o(w??{},"notificationType"),x=_o(w??{},"sourceKind"),S=_o(w??{},"sourceId");if(!g||!x||!S)break;const T=g.startsWith("task.")?g.slice(5):g,A=`task:${S}:${T}`,E=H=>H.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">"),P=_o(w??{},"title")??"",D=_o(w??{},"severity")??"",I=_o(w??{},"body")??"",$=` +`+(P!==""?`Title: ${E(P)} +`:"")+(D!==""?`Severity: ${E(D)} +`:"")+(I!==""?`${E(I)} +`:"")+"",B={id:`task_ntf_${A}`,sessionId:m,role:"user",content:[{type:"text",text:$}],createdAt:new Date().toISOString(),metadata:{origin:{kind:"task",taskId:S,status:T,notificationId:A}}};k.messages.push(B),b.push({type:"messageCreated",message:$u(B)});break}case"warning":{b.push({type:"unknown",raw:{_agentWarning:!0,message:w?.message}});break}case"task.started":case"background.task.started":{const g=w?.info??{},x=typeof g.startedAt=="number"?new Date(g.startedAt).toISOString():void 0,S=typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):pl("task_"),T=typeof g.description=="string"?g.description:typeof g.command=="string"?g.command:t("tasks.defaultDescription");if(g.kind==="agent"){const E=typeof g.agentId=="string"&&g.agentId.length>0?g.agentId:void 0;if(E!==void 0){const P=Ku(t,k,m,E,{description:T,backgroundTaskId:S,runInBackground:!0});P&&b.push({type:"taskCreated",sessionId:m,task:P})}else b.push({type:"taskCreated",sessionId:m,task:{id:S,sessionId:m,kind:"subagent",description:T,status:"running",createdAt:x??new Date().toISOString(),startedAt:x,subagentPhase:"queued",runInBackground:!0}});break}const A=typeof g.command=="string"?g.command:void 0;b.push({type:"taskCreated",sessionId:m,task:{id:S,sessionId:m,kind:"bash",description:T,command:A,status:"running",createdAt:x??new Date().toISOString(),startedAt:x,outputPreview:A!==void 0?`$ ${A}`:void 0}});break}case"task.terminated":case"background.task.terminated":{const g=w?.info??{},x=g.status==="failed"||typeof g.exitCode=="number"&&g.exitCode!==0;b.push({type:"taskCompleted",sessionId:m,taskId:typeof g.taskId=="string"?g.taskId:typeof g.taskId=="number"?String(g.taskId):"",status:x?"failed":"completed"});break}case"compaction.completed":{const g=w?.result??{};b.push({type:"compactionCompleted",sessionId:m,tokensBefore:typeof g.tokensBefore=="number"?g.tokensBefore:void 0,tokensAfter:typeof g.tokensAfter=="number"?g.tokensAfter:void 0,summary:typeof g.summary=="string"?g.summary:void 0}),b.push({type:"historyCompacted",sessionId:m,beforeSeq:0,reason:"auto_compact"});break}case"compaction.started":{b.push({type:"compactionStarted",sessionId:m,trigger:w?.trigger==="manual"?"manual":"auto",instruction:typeof w?.instruction=="string"?w.instruction:void 0});break}case"compaction.cancelled":{b.push({type:"compactionCancelled",sessionId:m});break}case"goal.updated":{const g=jG(w?.snapshot??null);b.push({type:"goalUpdated",sessionId:m,goal:g?.status==="complete"?null:g});break}case"cron.fired":{const g=w?.origin,x=_o(w??{},"prompt");if(g&&typeof g=="object"&&g.kind==="cron_job"&&x){const S={id:pl("cron_"),sessionId:m,role:"user",content:[{type:"text",text:x}],createdAt:new Date().toISOString(),metadata:{origin:g}};k.messages.push(S),b.push({type:"messageCreated",message:$u(S)})}break}}return b}return{project:u,bindNextPromptId:l,seedInFlight:a,reset:i,markSideChannelAgent:r}}function eY(e){return new MG({origin:e.origin,identity:e.identity,tracer:e.tracer,credentialStore:e.credentialStore,projectorFactory:()=>QG({t:e.t}),mainAgentOnly:e.mainAgentOnly})}const PT="kimiWeb.compaction",tY={t:e=>e},nY="kimiWeb.optimisticUserMessage",_b="Sub Agent";function yf(e,t,n=e.length){for(let o=0;o=0;s--){const i=o[s];if(i.role!=="assistant")continue;if(!i.content.some(u=>u.type==="thinking"&&u.startedAt!==void 0&&u.durationMs===void 0))return;const l=[...i.content];yf(l,n);const a=[...o];a[s]={...i,content:l},e.messagesBySession[t]=a;return}}function Sb(e){const t=Date.parse(e);return Number.isNaN(t)?Date.now():t}function oY(){return{sessions:[],activeSessionId:void 0,messagesBySession:{},approvalsBySession:{},planReviewByToolCallId:{},questionsBySession:{},tasksBySession:{},goalBySession:{},goalVersionBySession:{},lastSeqBySession:{},turnActiveBySession:{},turnEndedPromptIdBySession:{},turnErrorBySession:{},turnRetryBySession:{},compactionBySession:{},warnings:[]}}function sY(e){return{...e,sessions:e.sessions,messagesBySession:{...e.messagesBySession},approvalsBySession:{...e.approvalsBySession},planReviewByToolCallId:{...e.planReviewByToolCallId},questionsBySession:{...e.questionsBySession},tasksBySession:{...e.tasksBySession},goalBySession:{...e.goalBySession},goalVersionBySession:{...e.goalVersionBySession},lastSeqBySession:{...e.lastSeqBySession},turnActiveBySession:{...e.turnActiveBySession},turnEndedPromptIdBySession:{...e.turnEndedPromptIdBySession},turnErrorBySession:{...e.turnErrorBySession},turnRetryBySession:{...e.turnRetryBySession},compactionBySession:{...e.compactionBySession},warnings:[...e.warnings]}}function iY(e,t,n){if(t!==void 0&&n!==void 0&&n>0){const o=e.lastSeqBySession[t]??0;n>o&&(e.lastSeqBySession[t]=n)}}function od(e,t){const n=new Date().toISOString();e.sessions=e.sessions.map(o=>o.id===t&&n>o.updatedAt?{...o,updatedAt:n}:o)}function Ca(e,t){return t.seq>(e.lastSeqBySession[t.sessionId]??0)}function Ab(e){return e.role==="user"&&e.metadata?.[nY]===!0}function rY(e){const t=e.metadata?.origin;return t?.kind==="cron_job"||t?.kind==="cron_missed"}function lY(e){return e.metadata?.origin?.kind==="system_trigger"}function aY(e,t){const n=t.userMessageId??t.id;for(let s=e.length-1;s>=0;s--){const i=e[s];if(Ab(i)&&i.userMessageId===n)return s}const o=t.promptId;if(o!==void 0)for(let s=e.length-1;s>=0;s--){const i=e[s];if(Ab(i)&&i.promptId===o)return s}return-1}function uY(e,t,n){let o=!1;const s=e.map(i=>{let r=!1;const l=i.content.map(a=>a.type!=="toolUse"||a.toolCallId!==t?a:(r=!0,{...a,outputLines:[...a.outputLines??[],n]}));return r?(o=!0,{...i,content:l}):i});return o?s:e}const cY={"provider.connection_error":"connection","provider.auth_error":"auth","provider.rate_limit":"rateLimit","provider.overloaded":"overloaded","provider.filtered":"filtered","provider.api_error":"api","context.overflow":"contextOverflow"};function dY(e,t){const n=[],o=(r,l)=>{typeof l=="number"||typeof l=="boolean"?n.push({label:r,value:String(l)}):typeof l=="string"&&l.length>0&&n.push({label:r,value:l})};o(t("warnings.details.code"),e.code);const s=e.details??{};o(t("warnings.details.status"),s.statusCode),o(t("warnings.details.requestId"),s.requestId),o(t("warnings.details.errorName"),e.name);for(const[r,l]of Object.entries(s))r==="statusCode"||r==="requestId"||o(r,l);const i=(e.code!==void 0?cY[e.code]:void 0)??"title";return{severity:"error",title:t(`warnings.agentError.${i}`),message:e.message,details:n.length>0?n:void 0}}function fY(e,t,n,o=tY){const s=sY(e);switch(iY(s,n.sessionId,n.seq),t.type){case"sessionCreated":{s.sessions.some(r=>r.id===t.session.id)||(s.sessions=[t.session,...s.sessions]);break}case"sessionUpdated":{s.sessions=s.sessions.map(i=>i.id===t.session.id?{...t.session,pullRequest:i.pullRequest}:i);break}case"sessionDeleted":{const i=t.sessionId;s.sessions=s.sessions.filter(r=>r.id!==i),delete s.messagesBySession[i],delete s.tasksBySession[i],delete s.goalBySession[i],delete s.approvalsBySession[i],delete s.questionsBySession[i],delete s.lastSeqBySession[i],delete s.turnActiveBySession[i],delete s.turnEndedPromptIdBySession[i],delete s.turnErrorBySession[i],delete s.turnRetryBySession[i],s.activeSessionId===i&&(s.activeSessionId=void 0);break}case"sessionWorkChanged":{if(!Ca(e,n))break;let i;s.sessions=s.sessions.map(r=>r.id!==t.sessionId?r:(i=t.pendingInteraction??(t.busy?r.pendingInteraction:"none"),{...r,busy:t.busy,mainTurnActive:t.mainTurnActive??(t.busy?r.mainTurnActive:!1),pendingInteraction:i,lastTurnReason:t.lastTurnReason})),i==="none"?(delete s.approvalsBySession[t.sessionId],delete s.questionsBySession[t.sessionId]):i==="question"&&delete s.approvalsBySession[t.sessionId],t.mainTurnActive===!0?s.turnActiveBySession[t.sessionId]=!0:(t.mainTurnActive===!1||!t.busy)&&(e.turnActiveBySession[t.sessionId]&&od(s,t.sessionId),delete s.turnActiveBySession[t.sessionId],delete s.turnRetryBySession[t.sessionId]);break}case"sessionMetaUpdated":{s.sessions=s.sessions.map(i=>i.id===t.sessionId?{...i,title:t.title??i.title,lastPrompt:t.lastPrompt??i.lastPrompt}:i);break}case"sessionUsageUpdated":{s.sessions=s.sessions.map(i=>{if(i.id!==t.sessionId)return i;const r=t.model&&t.model.length>0?t.model:i.model;return{...i,usage:t.usage,model:r}});break}case"historyCompacted":break;case"compactionStarted":{s.compactionBySession={...s.compactionBySession,[t.sessionId]:{status:"running",trigger:t.trigger}};break}case"compactionCompleted":{const i=t.sessionId,r=s.compactionBySession[i],{[i]:l,...a}=s.compactionBySession;if(s.compactionBySession=a,Object.prototype.hasOwnProperty.call(s.messagesBySession,i)){const u=s.messagesBySession[i]??[],c=`compaction_${i}_${n.seq}`;if(!u.some(d=>d.id===c)){const d={trigger:r?.trigger??"auto",tokensBefore:t.tokensBefore,tokensAfter:t.tokensAfter};s.messagesBySession[i]=[...u,{id:c,sessionId:i,role:"assistant",content:t.summary?[{type:"text",text:t.summary}]:[],createdAt:new Date().toISOString(),metadata:{origin:{kind:"compaction_summary"},[PT]:d}}]}}break}case"compactionCancelled":{const{[t.sessionId]:i,...r}=s.compactionBySession;s.compactionBySession=r;break}case"messageCreated":{const i=t.message.sessionId,r=s.messagesBySession[i]??[];if(!r.some(a=>a.id===t.message.id)){if(t.message.role==="user"&&!rY(t.message)&&!lY(t.message)){const a=aY(r,t.message);if(a!==-1){const u=[...r],c=u[a];u[a]={...t.message,id:c.id,promptId:t.message.promptId??c.promptId,userMessageId:t.message.userMessageId??t.message.id,metadata:{...t.message.metadata,...c.metadata}},s.messagesBySession[i]=u;break}}s.messagesBySession[i]=[...r,t.message]}break}case"messageUpdated":{const i=t.sessionId,r=s.messagesBySession[i]??[];s.messagesBySession[i]=r.map(l=>{if(l.id!==t.messageId)return l;const a=t.content.map((c,d)=>{const f=l.content[d];return c.type==="thinking"&&f?.type==="thinking"?{...c,startedAt:f.startedAt,durationMs:f.durationMs}:c}),u=Date.now();return yf(a,u,a.length-1),(t.status!=="pending"||t.durationMs!==void 0)&&yf(a,u),{...l,content:a,durationMs:t.durationMs??l.durationMs}});break}case"assistantDelta":{const i=t.sessionId,r=s.messagesBySession[i]??[];s.messagesBySession[i]=r.map(l=>{if(l.id!==t.messageId)return l;const a=[...l.content],u=t.contentIndex,c=a.length<=u;for(;a.length<=u;)a.push({type:"text",text:""});const d=a[u];let f;return t.delta.text!==void 0?d.type==="text"&&!c?f={type:"text",text:d.text+t.delta.text}:(f={type:"text",text:t.delta.text},yf(a,Date.now(),u)):t.delta.thinking!==void 0?d.type==="thinking"?f={type:"thinking",thinking:d.thinking+t.delta.thinking,signature:d.signature,startedAt:d.startedAt,durationMs:d.durationMs}:(f={type:"thinking",thinking:t.delta.thinking,startedAt:new Date().toISOString()},yf(a,Date.now(),u)):f=d,a[u]=f,{...l,content:a}});break}case"toolOutput":{const i=t.sessionId,r=s.messagesBySession[i]??[];s.messagesBySession[i]=uY(r,t.toolCallId,t.outputChunk);break}case"approvalRequested":{const i=t.sessionId,r=s.approvalsBySession[i]??[];r.some(u=>u.approvalId===t.approval.approvalId)||(s.approvalsBySession[i]=[...r,t.approval],Ca(e,n)&&(xb(s,i,Sb(t.approval.createdAt)),od(s,i)));const a=t.approval.display;a?.kind==="plan_review"&&typeof a.plan=="string"&&a.plan.length>0&&(s.planReviewByToolCallId={...s.planReviewByToolCallId,[t.approval.toolCallId]:{plan:a.plan,path:typeof a.path=="string"?a.path:void 0}});break}case"approvalResolved":case"approvalExpired":{const i=t.sessionId,r=t.approvalId,l=s.approvalsBySession[i]??[];s.approvalsBySession[i]=l.filter(a=>a.approvalId!==r);break}case"questionRequested":{const i=t.sessionId,r=s.questionsBySession[i]??[];r.some(a=>a.questionId===t.question.questionId)||(s.questionsBySession[i]=[...r,t.question],Ca(e,n)&&(xb(s,i,Sb(t.question.createdAt)),od(s,i)));break}case"questionAnswered":case"questionDismissed":{const i=t.sessionId,r=t.questionId,l=s.questionsBySession[i]??[];s.questionsBySession[i]=l.filter(a=>a.questionId!==r);break}case"taskCreated":{const i=t.sessionId,r=s.tasksBySession[i]??[],l=r.findIndex(a=>a.id===t.task.id);if(l===-1)s.tasksBySession[i]=[...r,t.task];else{const a=[...r],u=r[l];a[l]={...t.task,outputLines:u.outputLines,text:u.text,description:t.task.description===_b&&u.description!==_b?u.description:t.task.description,swarmIndex:t.task.swarmIndex??u.swarmIndex,parentToolCallId:t.task.parentToolCallId??u.parentToolCallId,subagentType:t.task.subagentType??u.subagentType,model:t.task.model??u.model,thinkingEffort:t.task.thinkingEffort??u.thinkingEffort,runInBackground:t.task.runInBackground??u.runInBackground,backgroundTaskId:t.task.backgroundTaskId??u.backgroundTaskId,agentId:t.task.agentId??u.agentId},s.tasksBySession[i]=a}break}case"taskProgress":{const i=t.sessionId,r=s.tasksBySession[i]??[];s.tasksBySession[i]=r.map(l=>{if(l.id!==t.taskId)return l;if(l.kind==="subagent"&&t.kind==="text")return{...l,text:(l.text??"")+t.outputChunk};const a=l.outputLines??[];if(a.at(-1)===t.outputChunk)return l;const u=[...a,t.outputChunk];return{...l,outputLines:l.kind==="subagent"?u:u.slice(-40)}});break}case"taskCompleted":{const i=t.sessionId,r=s.tasksBySession[i]??[];s.tasksBySession[i]=r.map(l=>l.id!==t.taskId?l:{...l,status:t.status,outputPreview:t.outputPreview,outputBytes:t.outputBytes});break}case"goalUpdated":{const i=t.sessionId;s.goalVersionBySession[i]=(s.goalVersionBySession[i]??0)+1,t.goal===null||t.goal.status==="complete"?delete s.goalBySession[i]:s.goalBySession[i]=t.goal;break}case"configChanged":{s.config=t.config;break}case"modelCatalogChanged":break;case"agentDelta":case"agentTurnEnded":break;case"promptCompleted":{t.reason==="blocked"&&Ca(e,n)&&od(s,t.sessionId);break}case"promptAborted":{if(t.promptId===e.turnEndedPromptIdBySession[t.sessionId])break;Ca(e,n)&&od(s,t.sessionId);break}case"turnActiveChanged":{if(!Ca(e,n))break;s.sessions=s.sessions.map(i=>i.id===t.sessionId?{...i,mainTurnActive:t.active}:i),t.active?(s.turnActiveBySession[t.sessionId]=!0,delete s.turnEndedPromptIdBySession[t.sessionId],delete s.turnErrorBySession[t.sessionId],delete s.turnRetryBySession[t.sessionId]):(delete s.turnActiveBySession[t.sessionId],delete s.turnRetryBySession[t.sessionId],t.promptId!==void 0&&(s.turnEndedPromptIdBySession[t.sessionId]=t.promptId),od(s,t.sessionId));break}case"turnRetry":{if(!Ca(e,n))break;t.retry===void 0?delete s.turnRetryBySession[t.sessionId]:s.turnRetryBySession[t.sessionId]=t.retry;break}case"unknown":{const i=t.raw;if(!(i&&i._noop===!0))if(i&&i._agentError){if(Ca(e,n)){if(n.sessionId!==void 0){const r=i.details??{};s.turnErrorBySession[n.sessionId]={code:i.code,message:i.message,name:i.name,retryable:i.retryable,statusCode:typeof r.statusCode=="number"?r.statusCode:void 0,requestId:typeof r.requestId=="string"?r.requestId:void 0}}(n.sessionId===void 0||n.sessionId!==e.activeSessionId)&&(s.warnings=[...s.warnings,dY(i,o.t)])}}else if(i&&i._agentWarning){const r=i.message??i.code??o.t("warnings.agentWarningFallback");s.warnings=[...s.warnings,`${o.t("warnings.noteLabel")}: ${r}`]}else{const r=i?.type??"(unknown)";s.warnings=[...s.warnings,o.t("warnings.unhandledEvent",{type:r})]}break}}return s}function pY(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n\s*\/dev\/(?:sd|nvme|disk|hd)/,detail:"> /dev/…"},{pattern:/:\(\)\s*\{/,detail:"fork bomb"},{pattern:/\bgit\s+push\b[^|;&]*(?:--force(?:-with-lease)?\b|\s-f\b)/,detail:"git push --force"},{pattern:/\bchmod\s+(?:-[a-zA-Z]+\s+)*777\b/,detail:"chmod 777"},{pattern:/\b(?:curl|wget)\b[^|;&]*\|\s*(?:sudo\s+)?(?:ba|z)?sh\b/,detail:"curl | sh"},{pattern:/\b(?:shutdown|reboot|poweroff|halt)\b/,detail:"shutdown / reboot"}];function DT(e){const t=e.replace(/"[^"]*"|'[^']*'/g," ");for(const{pattern:n,detail:o}of hY)if(n.test(t))return o}const BT="kimiWeb.taskNotification",mY=/]*)>([\s\S]*?)<\/notification>/g,gY=/([\w-]+)="([^"]*)"/g,vY=/]*)>[\s\S]*?<\/output-file>/,yY=/^Title: (.*)$/m,kY=/^Severity: (.*)$/m;function c3(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function Mb(e){const t={};for(const n of e.matchAll(gY))n[1]!==void 0&&n[2]!==void 0&&(t[n[1]]=c3(n[2]));return t}function bY(e,t,n){const o=Mb(e),s=yY.exec(t)?.[1]?.trim()??"",i=kY.exec(t)?.[1]?.trim()??"";let r=t.split(` +`).filter(c=>!c.startsWith("Title: ")&&!c.startsWith("Severity: ")).join(` +`);const l=r.search(/^<\w/m);l!==-1&&(r=r.slice(0,l)),r=r.trim();const a=vY.exec(t),u=a?(()=>{const c=Mb(a[1]??""),d=Number(c.bytes);return c.path!==void 0&&c.path!==""?{path:c.path,bytes:Number.isFinite(d)?d:void 0}:void 0})():void 0;return{id:o.id??"",category:o.category??"",type:o.type??"",sourceKind:o.source_kind??"",sourceId:o.source_id??"",agentId:o.agent_id,title:c3(s),severity:i,body:c3(r),outputFile:u,raw:n}}function CY(e){if(!e.includes("Tb||i>Tb||(s+1)*(i+1)>xY)return null;const r=Array.from({length:s+1},()=>Array.from({length:i+1},()=>0));for(let h=1;h<=s;h++)for(let m=1;m<=i;m++)r[h][m]=n[h-1]===o[m-1]?r[h-1][m-1]+1:Math.max(r[h-1][m],r[h][m-1]);const l=[];let a=s,u=i;for(;a>0||u>0;)a>0&&u>0&&n[a-1]===o[u-1]?(l.push({type:"context",text:n[a-1]}),a--,u--):u>0&&(a===0||r[a][u-1]>=r[a-1][u])?(l.push({type:"add",text:o[u-1]}),u--):(l.push({type:"del",text:n[a-1]}),a--);l.reverse();const c=[];let d=1,f=1;for(const h of l)h.type==="context"?(c.push({type:"context",text:h.text,oldNo:d,newNo:f}),d++,f++):h.type==="add"?(c.push({type:"add",text:h.text,newNo:f}),f++):(c.push({type:"del",text:h.text,oldNo:d}),d++);return c}const Eb=500;function Pm(e,t){const n=[],o=Sl(e),s=Sl(t),i=Math.min(o.length,Eb),r=Math.min(s.length,Eb);for(let l=1;l<=i;l++)n.push({type:"del",text:o[l-1],oldNo:l});o.length>i&&n.push({type:"context",text:`… ${o.length-i} more lines …`});for(let l=1;l<=r;l++)n.push({type:"add",text:s[l-1],newNo:l});return s.length>r&&n.push({type:"context",text:`… ${s.length-r} more lines …`}),n}function HT(e){let t=0,n=0;for(const o of e)o.type==="add"?t++:o.type==="del"&&n++;return{added:t,removed:n}}const SY=/^read[_-]?media(?:file)?$/i,AY=/^data:([^;]+);base64,(.*)$/s,MY=/^<(image|video|audio)\s+path="([^"]+)">$/,TY=/^<(image|video|audio)\s+path="([^"]+)">(?:<\/\1>)?$/,EY=/Mime type:\s*([^.\s]+)/i,IY=/Size:\s*(\d+)\s*bytes/i,LY=/Original dimensions:\s*(\d+)x(\d+)\s*pixels/i,$Y="Image compressed to fit model limits:",NY=/Image compressed to fit model limits:[\s\S]*?<\/system>/g;function FY(e){return e.includes($Y)?e.replace(NY,""):e}function RY(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function Ib(e){const t=TY.exec(e.trim());return t?{kind:t[1],path:RY(t[2])}:null}const zT=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})$/,OY=/^f_(?:[0-9A-Za-z]{26}|[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})(?=-)/;function d3(e){const t=e.split(/[\\/]/).at(-1)??"",n=t.lastIndexOf("."),o=n>0?t.slice(0,n):t;return zT.test(o)?o:void 0}const PY=/^Attached file "(.+)" \(([^,]+), (\d+) bytes\): (.+) — open it with the Read tool$/;function Lb(e){const t=PY.exec(e.trim());if(!t)return null;const n=(t[4]??"").split(/[\\/]/).at(-1)??"",o=OY.exec(n)?.[0];return{name:t[1],mediaType:t[2],size:Number(t[3]),fileId:o!==void 0&&zT.test(o)?o:void 0}}function DY(e){if(e.length===0)return 0;const t=e.endsWith("==")?2:e.endsWith("=")?1:0;return Math.floor(e.length*3/4)-t}function BY(e){if(Array.isArray(e))return e;if(typeof e!="string")return null;try{const t=JSON.parse(e);return Array.isArray(t)?t:null}catch{return null}}function HY(e){const t=e.type,n=t==="image_url"?"image":t==="video_url"?"video":t==="audio_url"?"audio":null;if(n===null)return null;const s=e[n==="image"?"imageUrl":n==="video"?"videoUrl":"audioUrl"];if(typeof s!="object"||s===null)return null;const i=s.url;return typeof i=="string"?{kind:n,url:i}:null}function zY(e,t){if(!SY.test(e))return;const n=BY(t);if(n===null)return;let o,s,i,r,l,a=null;for(const c of n){if(typeof c!="object"||c===null)continue;const d=c;if(d.type==="text"&&typeof d.text=="string"){const h=d.text,m=MY.exec(h);m&&(s=m[1],o=m[2]);const v=EY.exec(h);v?.[1]&&(i=v[1]);const k=IY.exec(h);k?.[1]&&(r=Number(k[1]));const w=LY.exec(h);w?.[1]&&w[2]&&(l=`${w[1]}x${w[2]}`);continue}const f=HY(d);f&&(a=f)}if(a===null)return;const u=AY.exec(a.url);return u?.[1]&&(i=u[1]),u?.[2]&&(r=DY(u[2])),{kind:a.kind??s??"image",url:a.url,path:o,fileId:a.url.startsWith("ms://")&&o!==void 0?d3(o):void 0,mimeType:i,bytes:Number.isFinite(r)?r:void 0,dimensions:l}}function WT(e){if(e!=null){if(typeof e=="string")return e.split(` +`);if(Array.isArray(e)){const t=[];for(const n of e)if(typeof n=="string")t.push(...n.split(` +`));else if(n&&typeof n=="object"){const o=n;o.type==="text"&&typeof o.text=="string"?t.push(...o.text.split(` +`)):o.type==="think"&&typeof o.think=="string"?t.push(...o.think.split(` +`)):o.type==="image_url"||o.type==="image"?t.push("[image]"):typeof o.type=="string"?t.push(`[${o.type}]`):t.push(JSON.stringify(n))}return t.length>0?t:void 0}return[JSON.stringify(e)]}}function WY(e,t){if(Gs(e)==="task")for(const n of t??[]){const o=/^agent_id:\s*(\S+)\s*$/.exec(n);if(o?.[1])return o[1]}}function UY(e){return{id:e.agentId??e.id,toolCallId:e.parentToolCallId,name:e.description,subagentType:e.subagentType,model:e.model,thinkingEffort:e.thinkingEffort,phase:e.subagentPhase??(e.status==="completed"?"completed":e.status==="failed"?"failed":"working"),status:e.status,summary:e.outputPreview,outputLines:e.outputLines,text:e.text,suspendedReason:e.suspendedReason,swarmIndex:e.swarmIndex}}function jY(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";if(Array.isArray(t.diff))return{kind:"diff",path:o,diff:t.diff};const s=typeof t.old_text=="string"?t.old_text:typeof t.before=="string"?t.before:void 0,i=typeof t.new_text=="string"?t.new_text:typeof t.after=="string"?t.after:void 0;if(s!==void 0&&i!==void 0){const r=r1(s,i)??Pm(s,i);return{kind:"diff",path:o,diff:r}}return{kind:"diff",path:o,diff:[]}}if(n==="file_io"){const o=typeof t.path=="string"?t.path:"",s=typeof t.operation=="string"?t.operation:"";if(s==="write"&&typeof t.content=="string")return{kind:"file",path:o,content:t.content};if(s==="edit"&&typeof t.before=="string"&&typeof t.after=="string"){const r=r1(t.before,t.after)??Pm(t.before,t.after);return{kind:"diff",path:o,diff:r}}const i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s||n,path:o,detail:i}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action;return{kind:"shell",command:o,cwd:typeof t.cwd=="string"?t.cwd:void 0,danger:typeof t.danger=="string"?t.danger:DT(o)}}if(n==="file_content"||n==="file")return{kind:"file",path:typeof t.path=="string"?t.path:"",content:typeof t.content=="string"?t.content:"",language:typeof t.language=="string"?t.language:void 0};if(n==="file_op"||n==="fileop")return{kind:"fileop",op:typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,path:typeof t.path=="string"?t.path:"",detail:typeof t.detail=="string"?t.detail:void 0};if(n==="url_fetch"||n==="url")return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:typeof t.url=="string"?t.url:e.action};if(n==="search")return{kind:"search",query:typeof t.query=="string"?t.query:e.action,scope:typeof t.scope=="string"?t.scope:void 0};if(n==="invocation"||n==="agent_call"||n==="skill_call")return{kind:"invocation",kind2:typeof t.kind=="string"?t.kind:n,name:typeof t.name=="string"?t.name:e.toolName,description:typeof t.description=="string"?t.description:void 0};if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},u=typeof a.label=="string"?a.label:"";if(!u)return null;const c=typeof a.description=="string"?a.description:void 0;return{label:u,description:c}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function VY(e){const t=` +`,n=` +`,o=e.indexOf(t),s=e.lastIndexOf(n);return o>=0&&s>=o+t.length?e.slice(o+t.length,s):qY(e)}function qY(e){const t=e.split(` +`);return t.length>=2&&t[0]?.startsWith(""?t.slice(1,-1).join(` +`):e}function KY(e){const t=e.metadata?.origin;if(t?.kind==="cron_job"||t?.kind==="cron_missed")return t.kind}function ZY(e){const t=e.content.filter(n=>n.type==="text").map(n=>n.text).join(` +`);return VY(t)}function GY(e,t){const n=e.metadata?.origin??{},o=ZY(e);return t==="cron_missed"?{text:o,cron:{missedCount:typeof n.count=="number"?n.count:void 0}}:{text:o,cron:{jobId:typeof n.jobId=="string"?n.jobId:void 0,cron:typeof n.cron=="string"?n.cron:void 0,recurring:typeof n.recurring=="boolean"?n.recurring:void 0,coalescedCount:typeof n.coalescedCount=="number"?n.coalescedCount:void 0,stale:typeof n.stale=="boolean"?n.stale:void 0}}}function YY(e,t,n){const{text:o,cron:s}=GY(e,n);return{id:e.id,role:"cron",no:t,text:o,createdAt:e.createdAt,cron:s}}function XY(e){const t=e.metadata?.origin,n=t?.kind;return n===void 0||n==="user"?!0:n==="skill_activation"||n==="plugin_command"?t?.trigger==="user-slash":!1}function JY(e){return e.metadata?.origin?.kind==="compaction_summary"}function QY(e,t){return e===null?!1:e.promptId===void 0||t===void 0||e.promptId===t}function eX(e){if(!e||e.length===0)return;const t="Plan saved to: ";for(const n of e)if(n.startsWith(t))return n.slice(t.length).trim()}function tX(e){const t=[];for(const n of e){const o=t.at(-1);n.type==="text"&&o?.type==="text"?o.text+=n.text:n.type==="thinking"&&o?.type==="thinking"?o.thinking+=n.thinking:n.type==="thinking"?t.push({type:"thinking",thinking:n.thinking}):t.push({...n})}return JSON.stringify(t)}function UT(e,t,n,o=!0,s={},i={},r){const l=[];let a=r?.startNo??1;const u=r?.collect,c=new Map;for(const v of t)c.set(v.toolCallId,v);let d=null;function f(v=!1){if(!d)return;const k=d;if(d=null,!v&&k.blocks.length===0&&k.textParts.length===0&&k.thinkingParts.length===0&&k.tools.length===0)return;if(!v||!o)for(let b=0;bS.kind==="tool"&&S.tool.id===g.id);x&&x.kind==="tool"&&(x.tool=g)}const w={id:k.id,role:"assistant",no:a++,text:k.textParts.join(` +`),thinking:k.thinkingParts.length>0?k.thinkingParts.join(` +`):void 0,tools:k.tools.length>0?k.tools:void 0,blocks:k.blocks.length>0?k.blocks:void 0,approval:k.approval,approvalId:k.approvalId,durationMs:k.durationMs,createdAt:k.createdAt,endedAt:k.endedAt,goalContinuation:k.goalContinuation};l.push(w),u?.(w,k.sources)}function h(v,k){let w=null;for(const b of k)if(b.type==="text"){if(b.text){w==="text"?v.textParts[v.textParts.length-1]+=b.text:v.textParts.push(b.text);const _=v.blocks.at(-1);_&&_.kind==="text"?_.text+=(w==="text"?"":` +`)+b.text:v.blocks.push({kind:"text",text:b.text}),w="text"}}else if(b.type==="thinking"){if(b.thinking){w==="thinking"?v.thinkingParts[v.thinkingParts.length-1]+=b.thinking:v.thinkingParts.push(b.thinking);const _=v.blocks.at(-1);if(_&&_.kind==="thinking"){_.thinking+=(w==="thinking"?"":` +`)+b.thinking;const g=[_.startedAt,b.startedAt].filter(T=>T!==void 0).sort()[0],x=_.startedAt!==void 0&&_.durationMs===void 0||b.startedAt!==void 0&&b.durationMs===void 0,S=[_,b].flatMap(T=>T.startedAt!==void 0&&T.durationMs!==void 0?[Date.parse(T.startedAt)+T.durationMs]:[]);_.startedAt=g,_.durationMs=!x&&g!==void 0&&S.length>0?Math.max(...S)-Date.parse(g):void 0}else v.blocks.push({kind:"thinking",thinking:b.thinking,startedAt:b.startedAt,durationMs:b.durationMs});w="thinking"}}else if(b.type==="toolUse"){w=null;const _=c.get(b.toolCallId),g=b.toolName==="ExitPlanMode"?i[b.toolCallId]:void 0,x={id:b.toolCallId,name:b.toolName,arg:typeof b.input=="string"?b.input:JSON.stringify(b.input),agentId:Gs(b.toolName)==="task"?b.agentRefs?.find(S=>S.role!=="member")?.agentId??b.agentRefs?.[0]?.agentId:void 0,status:"running",output:b.outputLines,plan:g,planPath:b.toolName==="ExitPlanMode"?g?.path??s[b.toolCallId]?.path:void 0};v.tools.push(x),v.blocks.push({kind:"tool",tool:x}),_&&(v.approval=jY(_),v.approvalId=_.approvalId)}else if(b.type==="toolResult"){w=null;const _=v.tools.findIndex(g=>g.id===b.toolCallId);if(_!==-1){const g=v.tools[_],x=WT(b.output),S={...g,status:b.isError?"error":"ok",output:x,media:b.isError?void 0:zY(g.name,b.output),agentId:g.agentId??WY(g.name,x)};S.name==="ExitPlanMode"&&!S.planPath&&(S.planPath=eX(S.output)),v.tools[_]=S;const T=v.blocks.find(A=>A.kind==="tool"&&A.tool.id===b.toolCallId);T&&T.kind==="tool"&&(T.tool=S)}}else w=null}function m(v){if(v.type==="image"||v.type==="video"){const k=v.type,w=v.source;if(w.kind==="url")return{url:w.url,kind:k};if(w.kind==="base64")return{url:`data:${w.mediaType};base64,${w.data}`,kind:k};if(w.kind==="file"&&n)return{url:n(w.fileId),kind:k,fileId:w.fileId}}if(v.type==="file"&&n){if(v.mediaType.startsWith("image/"))return{url:n(v.fileId),kind:"image",fileId:v.fileId};if(v.mediaType.startsWith("video/"))return{url:n(v.fileId),kind:"video",fileId:v.fileId}}}for(const v of e){if(v.role==="system")continue;if(JY(v)){f();const g=v.metadata?.[PT],x={id:v.id,role:"compaction",no:a,text:v.content.filter(S=>S.type==="text").map(S=>S.text).join(` +`),compaction:{trigger:g?.trigger,tokensBefore:g?.tokensBefore,tokensAfter:g?.tokensAfter}};l.push(x),u?.(x,[v]);continue}if(v.role==="user"){const g=KY(v),x=v.metadata?.origin?.kind,S=x==="skill_activation"&&v.metadata?.origin?.trigger!=="user-slash";if(g===void 0&&(x==="injection"||S))continue;if(g===void 0&&(x==="task"||x==="background_task"||x==="task_notification")){const $=v.content.filter(O=>O.type==="text").map(O=>O.text).join(` +`),B=wY(v.metadata),H=B!==void 0?[B]:CY($);if(H.length>0){d??={id:v.id,promptId:void 0,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,seenSigs:new Set,sources:[v],createdAt:v.createdAt};for(const O of H)d.blocks.push({kind:"notification",notification:{...O,createdAt:v.createdAt}})}continue}if(f(),g!==void 0){const $=YY(v,a++,g);l.push($),u?.($,[v]);continue}if(x==="system_trigger"&&v.metadata?.origin?.name==="goal_continuation"){d={id:v.id,promptId:void 0,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,seenSigs:new Set,sources:[v],createdAt:v.createdAt,goalContinuation:!0};continue}if(!XY(v))continue;const T=v.metadata?.origin,A=T?.kind==="skill_activation"&&T?.trigger==="user-slash",E=T?.kind==="plugin_command"&&T?.trigger==="user-slash",P=[],D=[];for(const $ of v.content){if($.type==="text")if(A){const H=Ib($.text);if(H&&(H.kind==="video"||H.kind==="image")&&n){const F=d3(H.path);if(F){D.push({url:n(F),kind:H.kind,fileId:F});continue}}const O=Lb($.text);O&&D.push({kind:"file",url:O.fileId&&n?n(O.fileId):"",fileId:O.fileId,name:O.name,mediaType:O.mediaType,size:O.size})}else if(E)P.push(T.commandArgs??"");else{const H=Ib($.text);if(H&&(H.kind==="video"||H.kind==="image")&&n){const U=d3(H.path);if(U){D.push({url:n(U),kind:H.kind,fileId:U});continue}}const O=Lb($.text);if(O){D.push({kind:"file",url:O.fileId&&n?n(O.fileId):"",fileId:O.fileId,name:O.name,mediaType:O.mediaType,size:O.size});continue}const F=FY($.text);if(F!==$.text&&F.trim().length===0)continue;P.push(F)}const B=m($);if(B){D.push({url:B.url,kind:B.kind,name:$.type==="file"?$.name:void 0,fileId:B.fileId});continue}$.type==="file"&&n&&D.push({kind:"file",url:n($.fileId),fileId:$.fileId,name:$.name,mediaType:$.mediaType||void 0,size:$.size})}const I={id:v.id,role:"user",no:a++,text:A?T?.skillArgs??"":P.join(` +`),attachments:D.length>0?D:void 0,skillActivation:A?{name:T.skillName,args:T.skillArgs}:void 0,pluginCommand:E?{pluginId:T.pluginId,commandName:T.commandName,args:T.commandArgs}:void 0,createdAt:v.createdAt};l.push(I),u?.(I,[v]);continue}if(v.role==="tool"){d&&(d.sources.push(v),h(d,v.content),d.endedAt=v.createdAt);continue}const k=v.promptId;QY(d,k)?d!==null&&d.promptId===void 0&&k!==void 0&&(d.promptId=k):(f(),d={id:v.id,promptId:k,textParts:[],thinkingParts:[],tools:[],blocks:[],approval:void 0,approvalId:void 0,seenSigs:new Set,sources:[],durationMs:v.durationMs,createdAt:v.createdAt});const b=d;if(b===null)continue;const _=tX(v.content);b.promptId!==void 0&&b.seenSigs.has(_)||(b.seenSigs.add(_),b.sources.push(v),v.durationMs!==void 0&&(b.durationMs=v.durationMs),h(b,v.content),v.id!==b.id&&(b.endedAt=v.createdAt))}return f(!0),l}function nX(e,t,n){const o=e.items.filter(u=>u.kind==="turn"),s=o[0]?.turnId,i=o.length===1?s:void 0,r=new Map(e.tasks.map(u=>[u.taskId,u])),l=e.items.flatMap(u=>u.kind==="turn"?oX(u,e.attachments,r,u.turnId===s?n?.createdAt:void 0,u.turnId===i?n?.disposedAt:void 0):[]),a=e.meta.activity==="turn";return UT(l,[],t,a).map(iX)}function oX(e,t,n,o,s){const i=[],r=new Map(t.map(d=>[d.attachmentId,d])),l=rX([e.startedAt,...e.steps.map(d=>d.startedAt),o])??"",a=$b(e.endedAt)??$b(s),u=e.turnId;if(e.prompt!==void 0&&e.prompt.length>0){const d=[{type:"text",text:e.prompt}];for(const f of e.attachmentIds??[]){const h=lX(r.get(f));h!==void 0&&d.push(h)}i.push({id:`${e.turnId}:input`,sessionId:"",role:"user",content:d,createdAt:l,promptId:u,metadata:e.origin.kind==="task"&&e.prompt.includes("f.role==="assistant");d>=0&&(i[d]={...i[d],durationMs:c})}return i}function sX(e,t,n){const[o="",...s]=t.split(` +`),i=n?.state??"info";return{id:`task:${e}:${i}`,category:"task",type:`task.${i}`,sourceKind:n?.kind==="subagent"?"subagent":"background_task",sourceId:e,agentId:n?.agentId,title:o.trim(),severity:i==="completed"?"info":"warning",body:s.join(` +`).trim(),raw:t}}function iX(e){if(e.createdAt!==""&&e.endedAt!=="")return e;const t={...e};return t.createdAt===""&&delete t.createdAt,t.endedAt===""&&delete t.endedAt,t}function rX(e){let t;for(const n of e){if(n===void 0)continue;const o=Date.parse(n);Number.isFinite(o)&&(t===void 0||o=0?n:void 0}const Fb=6e3,f3=256*1024,aX=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/;function Rb(e,t){return t===0?e:e-1}function uX(e,t){const n=Sl(t),o=[];let s=0;for(const i of e){if(i.type==="hunk"){const r=aX.exec(i.text);if(!r)return null;const l=Rb(Number(r[1]),r[2]===void 0?1:Number(r[2])),a=Rb(Number(r[3]),r[4]===void 0?1:Number(r[4]));if(an.length)return null;for(;s=n.length||n[s]!==i.text)return null;s++,i.type==="context"&&o.push(i.text)}for(;sf3||Sl(n).length>Fb)return null;const o=uX(e,n);return o===null||o.length>f3||Sl(o).length>Fb?null:{before:o,after:n}}const dX=new Set(["assistantDelta","agentDelta","toolOutput","taskProgress"]);function fX(e){return dX.has(e.type)}const pX=50,hX=100,p3=32*1024,mX={requestFrame(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):null},cancelFrame(e){typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(e)},requestTask(e){return setTimeout(e,pX)},cancelTask(e){clearTimeout(e)}};function gX(e,t,n={}){const o=n.scheduler??mX,s=Math.max(1,Math.floor(n.maxItemsPerSlice??hX)),i=[];let r=0,l=null,a=null,u=0,c=!1;const d=()=>i.length-r,f=()=>{u+=1,l!==null&&(o.cancelFrame(l),l=null),a!==null&&(o.cancelTask(a),a=null)},h=()=>{r===i.length?(i.length=0,r=0):r>=1024&&(i.splice(0,r),r=0)};let m;const v=()=>{if(c||l!==null||a!==null||d()===0)return;const w=++u,b=()=>{w===u&&m()};l=o.requestFrame(b),a=o.requestTask(b)};m=()=>{f();let w=0;for(;!c&&w{if(!c){if(t(w)){const b=i.length>r?i.at(-1):void 0,_=b===void 0?void 0:n.coalesce?.(b,w);_===void 0?i.push(w):i[i.length-1]=_,v();return}if(d()===0){e(w);return}i.push(w),m()}});return k.flush=()=>{if(!c){for(f();!c&&r{if(c||d()===0)return;let b=r;for(let _=r;_{c||(c=!0,f(),i.length=0,r=0)},k}function h3(e){if(e.type==="assistantDelta"){if(e.delta.text!==void 0&&e.delta.thinking===void 0)return{kind:"text",value:e.delta.text};if(e.delta.thinking!==void 0&&e.delta.text===void 0)return{kind:"thinking",value:e.delta.thinking}}}function vX(e){if(e.appEvent.type!=="assistantDelta")return[e];const t=e.appEvent,n=e.meta.stream,o=h3(t);if(n===void 0||o===void 0||n.kind!==o.kind||o.value.length<=p3)return[e];const s=[];let i=0;for(;ii&&/[\uD800-\uDBFF]/u.test(o.value[r-1])&&/[\uDC00-\uDFFF]/u.test(o.value[r])&&(r-=1);const l=o.value.slice(i,r);s.push({appEvent:{...t,delta:o.kind==="text"?{text:l}:{thinking:l}},meta:{...e.meta,stream:{...n,offset:n.offset+i}}}),i=r}return s}function yX(e,t){if(e.appEvent.type!=="assistantDelta"||t.appEvent.type!=="assistantDelta")return;const n=e.meta.stream,o=t.meta.stream,s=h3(e.appEvent),i=h3(t.appEvent);if(n===void 0||o===void 0||s===void 0||i===void 0||e.meta.sessionId!==t.meta.sessionId||e.appEvent.sessionId!==t.appEvent.sessionId||e.appEvent.messageId!==t.appEvent.messageId||e.appEvent.contentIndex!==t.appEvent.contentIndex||n.turnId!==o.turnId||n.kind!==o.kind||s.kind!==i.kind||n.kind!==s.kind||o.kind!==i.kind||o.offset!==n.offset+s.value.length||s.value.length+i.value.length>p3)return;const r=s.value+i.value;return{appEvent:{...e.appEvent,delta:s.kind==="text"?{text:r}:{thinking:r}},meta:{...t.meta,stream:{...n}}}}function kX(e){return e==="in_progress"?"in_progress":e==="done"||e==="completed"?"done":"pending"}function bX(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="assistant")for(let o=n.content.length-1;o>=0;o--){const s=n.content[o];if(s.type!=="toolUse"||Gs(s.toolName)!=="todo")continue;let i=s.input;if(typeof i=="string")try{i=JSON.parse(i)}catch{continue}const r=i?.todos;if(Array.isArray(r))return r.flatMap(l=>{const a=l??{},u=typeof a.title=="string"?a.title:typeof a.content=="string"?a.content:"";return u?[{title:u,status:kX(a.status)}]:[]})}}return[]}function CX(e){return e.startsWith("diff --git")||e.startsWith("index ")||e.startsWith("--- ")||e.startsWith("+++ ")||e.startsWith("new file mode")||e.startsWith("deleted file mode")||e.startsWith("old mode")||e.startsWith("new mode")||e.startsWith("similarity index")||e.startsWith("dissimilarity index")||e.startsWith("rename from")||e.startsWith("rename to")||e.startsWith("copy from")||e.startsWith("copy to")||e.startsWith("Binary files")}function wX(e){const t=[];if(!e)return t;let n=0,o=0,s=!1;for(const i of e.split(` +`)){if(i.startsWith("diff --git")){s=!1;continue}if(!s&&CX(i))continue;if(i.startsWith("@@")){const a=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/.exec(i);a&&(n=Number.parseInt(a[1],10),o=Number.parseInt(a[2],10)),s=!0,t.push({type:"hunk",text:i});continue}if(!s||i.startsWith("\\"))continue;const r=i.charAt(0),l=i.slice(1);r==="+"?(t.push({type:"add",text:l,newNo:o}),o+=1):r==="-"?(t.push({type:"del",text:l,oldNo:n}),n+=1):r===" "&&(t.push({type:"context",text:l,oldNo:n,newNo:o}),n+=1,o+=1)}return t}function Ob(e){return e?e.split(` +`).map(t=>t.trimEnd()).filter(Boolean).at(-1)??"":""}function _X(e){return e.suspendedReason||Ob(e.text)||Ob(e.outputLines?.join(` +`))||e.summary||""}function xX(e){return e.suspendedReason?e.suspendedReason:e.text?e.text:e.outputLines&&e.outputLines.length>0?e.outputLines.join(` +`):e.summary??""}function SX(e){return e==="completed"?"completed":e==="failed"||e==="aborted"?"failed":"working"}function Pb(e,t){return{id:e.agentId??e.item??`result-${t}`,agentId:e.agentId,name:e.item??`subagent ${t+1}`,activity:e.body.split(` +`)[0]??"",phase:SX(e.outcome),body:e.body}}function AX(e,t){return!!(t.agentId&&e.agentId===t.agentId||t.item&&e.name.includes(t.item))}function MX(e,t){const n=e.map(s=>({id:s.id,agentId:s.agentId,name:s.name,activity:_X(s),phase:s.phase,body:xX(s)}));if(!t)return n;const o=t.subagents.filter(s=>(s.outcome==="aborted"||s.state==="not_started")&&!e.some(i=>AX(i,s))).map((s,i)=>Pb(s,i));return n.length>0?[...n,...o]:t.subagents.map((s,i)=>Pb(s,i))}const TX=["queued","working","suspended","completed","failed"];function jT(e){return e.status==="completed"?"completed":e.status==="failed"||e.status==="cancelled"?"failed":e.subagentPhase?e.subagentPhase:"working"}function EX(){return{queued:0,working:0,suspended:0,completed:0,failed:0}}function IX(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||n.swarmIndex===void 0)continue;const o=n.parentToolCallId??"swarm",s=t.get(o)??[];s.push({id:n.id,agentId:n.agentId,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,phase:jT(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex}),t.set(o,s)}return[...t.entries()].map(([n,o])=>{const s=o.toSorted((r,l)=>r.swarmIndex-l.swarmIndex||r.id.localeCompare(l.id)),i=EX();for(const r of s)i[r.phase]++;return{id:n,members:s,counts:i}}).filter(n=>n.members.length>1).toSorted((n,o)=>{const s=n.members.at(0)?.swarmIndex??0,i=o.members.at(0)?.swarmIndex??0;return s!==i?s-i:n.id.localeCompare(o.id)})}function LX(e){let t=0,n=0;for(const o of e){n+=o.members.length;for(const s of TX)(s==="completed"||s==="failed")&&(t+=o.counts[s])}return{done:t,total:n}}function $X(e){const t=new Map;for(const n of e){if(n.kind!=="subagent"||!n.parentToolCallId)continue;const o=t.get(n.parentToolCallId)??[];o.push({id:n.id,agentId:n.agentId,name:n.description,subagentType:n.subagentType,model:n.model,thinkingEffort:n.thinkingEffort,phase:jT(n),summary:n.outputPreview,outputLines:n.outputLines,text:n.text,suspendedReason:n.suspendedReason,swarmIndex:n.swarmIndex??Number.MAX_SAFE_INTEGER}),t.set(n.parentToolCallId,o)}for(const[n,o]of t)t.set(n,o.toSorted((s,i)=>s.swarmIndex-i.swarmIndex||s.id.localeCompare(i.id)));return t}function _y(e){const t=e.trim();if(!t.startsWith("{"))return null;try{const n=JSON.parse(t);return n&&typeof n=="object"&&!Array.isArray(n)?n:null}catch{return null}}function VT(e){for(const t of["path","file_path","filePath","filename"]){const n=e[t];if(typeof n=="string"&&n.length>0)return n}}const kf=100*1024;function qT(e){const t=Gs(e.name);if(t!=="edit"&&t!=="multi_edit")return null;const n=_y(e.arg);if(!n)return null;if(t==="edit"){if(n.replace_all===!0)return null;const l=typeof n.old_string=="string"?n.old_string:void 0,a=typeof n.new_string=="string"?n.new_string:void 0;return l===void 0||a===void 0||l.length>kf||a.length>kf?null:r1(l,a)}const o=Array.isArray(n.edits)?n.edits:void 0;if(!o||o.length===0)return null;const s=[];let i=0,r=0;for(const l of o){if(!l||typeof l!="object")return null;const a=l;if(a.replace_all===!0)return null;const u=typeof a.old_string=="string"?a.old_string:void 0,c=typeof a.new_string=="string"?a.new_string:void 0;if(u===void 0||c===void 0||u.length>kf||c.length>kf)return null;const d=r1(u,c);if(d===null)return null;s.length>0&&s.push({type:"hunk",text:"···"});for(const f of d)s.push({...f,oldNo:f.oldNo!==void 0?f.oldNo+i:void 0,newNo:f.newNo!==void 0?f.newNo+r:void 0});i+=Sl(u).length,r+=Sl(c).length}return s}const NX=5e3;function FX(e){if(Gs(e.name)!=="write")return null;const t=_y(e.arg);return!t||typeof t.content!="string"||t.content.length>kf||t.content.split(` +`).length>NX?null:{content:t.content,path:VT(t)}}function Db(e){const t=_y(e.arg);return t?VT(t):void 0}function KT(){let e=[],t=null,n=null,o=null,s,i=!0;const r=new WeakMap,l=a=>{const{messages:u,approvals:c}=a,d=a.sessionActive??!0,f=a.planReviewByToolCallId??{},h=a.plansByToolCallId??{},m=(T,A)=>r.set(T,A);let v=n!==null;if(v){const T=n,A=Object.keys(f);v=A.length===Object.keys(T).length&&A.every(E=>f[E]===T[E])}let k=o!==null;if(k){const T=o,A=Object.keys(h);k=A.length===Object.keys(T).length&&A.every(E=>h[E]===T[E])}const w=e.length>0&&c===t&&v&&k&&a.getFileUrl===s;let b=0,_=0,g=1;if(w){let T=-1;for(let A=e.length-1;A>=0;A--)if(e[A].role==="assistant"){T=A;break}for(let A=0;A0?[...e.slice(0,b),...x]:x;return e=S,t=c,n={...f},o={...h},s=a.getFileUrl,i=d,S};return l.reset=()=>{e=[],t=null,n=null,o=null,s=void 0,i=!0},l}const ZT=["light","dark","system"],RX=["small","medium","large","xlarge"],a9="medium",GT="kimi-web.color-scheme",m3="kimi-web.font-scale",Bb="kimi-web.ui-font-size";function g3(e){try{return globalThis.localStorage.getItem(e)}catch{return null}}function xy(e,t){try{globalThis.localStorage.setItem(e,t)}catch{}}function OX(e){try{globalThis.localStorage.removeItem(e)}catch{}}function PX(){const e=g3(GT);return e&&ZT.includes(e)?e:"system"}const oh={light:"#ffffff",dark:"#121212"};function DX(e){if(typeof document>"u"||!document.documentElement)return;document.documentElement.dataset.colorScheme=e;const t=document.querySelectorAll('meta[name="theme-color"]');if(t.length===0)return;const n=e==="dark"?oh.dark:e==="light"?oh.light:null;t.forEach(o=>{const i=(o.getAttribute("media")??"").includes("dark")?oh.dark:oh.light;o.setAttribute("content",n??i)})}function YT(e){return RX.includes(e)}function BX(e){return e<=13?"small":e<=15?"medium":e<=17?"large":"xlarge"}function HX(){const e=g3(m3);if(e==="xxlarge")return"xlarge";if(e!==null)return YT(e)?e:a9;const t=g3(Bb);if(t===null)return a9;const n=Number(t),o=Number.isFinite(n)?BX(n):a9;return xy(m3,o),OX(Bb),o}function zX(e){typeof document>"u"||!document.documentElement||(document.documentElement.dataset.fontScale=e)}const Sy=Z(PX()),Ay=Z(HX());let Hb=!1;function WX(){Hb||(Hb=!0,Je(Sy,DX,{immediate:!0}),Je(Ay,zX,{immediate:!0}))}function UX(e){ZT.includes(e)&&(Sy.value=e,xy(GT,e))}function jX(e){YT(e)&&(Ay.value=e,xy(m3,e))}function XT(){return WX(),{colorScheme:Sy,fontScale:Ay,setColorScheme:UX,setFontScale:jX}}const sh=Z(!1);let zb=!1;function u9(){const e=document.documentElement.dataset.colorScheme;return e==="dark"?!0:e==="light"?!1:window.matchMedia("(prefers-color-scheme: dark)").matches}function f2(){return!zb&&typeof window<"u"&&typeof document<"u"&&(zb=!0,sh.value=u9(),new MutationObserver(()=>{sh.value=u9()}).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{sh.value=u9()})),sh}const VX=Symbol("KimiWebClientFacade"),qX="modulepreload",KX=function(e){return"/"+e},Wb={},jo=function(t,n,o){let s=Promise.resolve();if(n&&n.length>0){let r=function(u){return Promise.all(u.map(c=>Promise.resolve(c).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),a=l?.nonce||l?.getAttribute("nonce");s=r(n.map(u=>{if(u=KX(u),u in Wb)return;Wb[u]=!0;const c=u.endsWith(".css"),d=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":qX,c||(f.as="script"),f.crossOrigin="",f.href=u,a&&f.setAttribute("nonce",a),document.head.appendChild(f),c)return new Promise((h,m)=>{f.addEventListener("load",h),f.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return s.then(r=>{for(const l of r||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function vc(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return t===0?"":`${t}s`;const n=Math.floor(t/60);if(n<60){const i=t%60;return i===0?`${n}m`:`${n}m${i}s`}const o=Math.floor(n/60),s=n%60;return s===0?`${o}h`:`${o}h${s}m`}const JT=new Set(["read","bash","grep","search","glob","ls","web_fetch","edit","write"]);function QT(e){const t=Gs(e);return t==="multi_edit"?"edit":t}function eE(e){const t=[],n=new Map;for(const o of e){if(o.kind==="thinking")continue;const s=QT(o.tool.name);let i=n.get(s);i||(i={count:0,errors:0},n.set(s,i),t.push(s)),i.count++,o.tool.status==="error"&&i.errors++}return{order:t,byKind:n}}function tE(e,t,n){return JT.has(t)?e(`tools.group.typed.${t}.done`,{count:n}):e("tools.group.countOther",{count:n})}function nE(e,t){return{text:e("tools.activity.failedClause",{count:t}),tone:"danger"}}function oE(e){return e.map(t=>t.fragments.map(n=>n.text).join("")).join(" · ")}function ZX(e,t,n={}){const{order:o,byKind:s}=eE(t),i=[];let r=!1;for(const l of o){const a=s.get(l);if(!a)continue;const u=[{text:tE(e,l,a.count),tone:"normal"}];a.errors>0&&(r=!0,u.push(nE(e,a.errors))),i.push({fragments:u})}if(n.durationMs!==void 0){const l=vc(n.durationMs);l&&i.push({fragments:[{text:l,tone:"faint"}]})}return{clauses:i,plain:oE(i),hasError:r}}function GX(e,t){if(t.kind==="thinking")return{fragments:[{text:e("thinking.streaming"),tone:"normal"}]};const n=QT(t.tool.name);let o=wy(e,t.tool.name,t.tool.arg);if(n==="write"&&o){const i=e("tools.chip.created");o.endsWith(i)&&(o=o.slice(0,o.length-i.length).trimEnd())}return{fragments:[{text:o&&JT.has(n)?e(`tools.activity.doing.${n}`,{subject:o}):e("tools.activity.busy"),tone:"normal"}]}}function YX(e,t,n){const o=t.filter(c=>c!==n&&!(c.kind==="tool"&&c.tool.status==="running")),{order:s,byKind:i}=eE(o),r=e("tools.activity.liveDonePrefix"),l=[];for(const c of s){const d=i.get(c);if(!d)continue;const f=[{text:`${r}${tE(e,c,d.count)}`,tone:"faint"}];d.errors>0&&f.push(nE(e,d.errors)),l.push({fragments:f})}const a=n===null?null:GX(e,n),u=a?[a,...l]:l;return{current:a,done:l,plain:oE(u)}}async function Zs(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return XX(e)}function XX(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}const JX={ts:"ts",tsx:"tsx",js:"js",jsx:"jsx",mjs:"js",cjs:"js",vue:"vue",svelte:"svelte",py:"py",rb:"rb",go:"go",rs:"rs",java:"java",kt:"kt",kts:"kts",scala:"scala",swift:"swift",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",cs:"cs",php:"php",sh:"sh",bash:"bash",zsh:"zsh",fish:"fish",ps1:"ps1",bat:"bat",cmd:"bat",sql:"sql",graphql:"graphql",prisma:"prisma",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",sass:"sass",less:"less",json:"json",jsonc:"jsonc",json5:"json5",yaml:"yaml",yml:"yml",toml:"toml",ini:"ini",md:"md",markdown:"markdown",mdx:"mdx",lua:"lua",r:"r",dart:"dart",zig:"zig",mk:"makefile",cmake:"cmake",diff:"diff",proto:"proto"},QX={dockerfile:"dockerfile",makefile:"makefile","cmakelists.txt":"cmake"};function eJ(e){const t=e?.split(/[\\/]/).pop()?.toLowerCase()??"";if(!t)return;const n=QX[t];if(n)return n;const o=t.lastIndexOf(".");if(!(o<=0))return JX[t.slice(o+1)]}const tJ="kimi_desktop",nJ="platform",Ub="kimi-desktop",jb="kimi-desktop-platform";function oJ(){let e=!1,t=null;try{const n=new URLSearchParams(window.location.search);n.has(tJ)?(sessionStorage.setItem(Ub,"1"),e=!0):e=e||sessionStorage.getItem(Ub)==="1";const o=n.get(nJ);o?(sessionStorage.setItem(jb,o),t=o):t=sessionStorage.getItem(jb)}catch{}return{isDesktop:e,platform:t}}const v3=oJ(),Wp=v3.isDesktop,rc=v3.isDesktop&&v3.platform==="darwin",sJ=["faces","nature","food","activity","objects","symbols"],iJ=[["😀","faces","grinning smile happy 笑 开心"],["😄","faces","smile happy joy 笑 开心 高兴"],["😁","faces","grin beaming 咧嘴笑 开心"],["😂","faces","joy laugh tears 笑哭 爆笑"],["🤣","faces","rofl laugh rolling 笑翻 爆笑"],["😊","faces","blush shy happy 微笑 害羞"],["😉","faces","wink 眨眼"],["😍","faces","heart eyes love 爱心眼 喜欢 爱"],["🥰","faces","smiling hearts love 爱心 喜欢"],["😘","faces","kiss 飞吻 亲亲"],["😋","faces","yum tongue 好吃 馋"],["🤪","faces","zany crazy 鬼脸 疯"],["🤔","faces","thinking hmm consider 思考 想"],["🤨","faces","skeptical eyebrow 怀疑 挑眉"],["😐","faces","neutral meh 面无表情 无语"],["😑","faces","expressionless 面无表情 无语"],["🙄","faces","eye roll 翻白眼 无语"],["😶","faces","no mouth silent 无言 沉默"],["🫡","faces","salute 敬礼 收到"],["🤫","faces","shush quiet 嘘 安静"],["🤭","faces","oops giggle 捂嘴 偷笑"],["😴","faces","sleeping sleepy 睡觉 困"],["😪","faces","sleepy tired 困 疲惫"],["😷","faces","mask sick 口罩 生病"],["🤒","faces","sick fever 生病 发烧"],["🤕","faces","hurt bandage 受伤"],["🤢","faces","nauseated 恶心"],["🤯","faces","mind blown explode 震惊 爆炸"],["🥳","faces","party celebrate 庆祝 派对"],["🤩","faces","star struck 星星眼 激动"],["😎","faces","cool sunglasses 酷 墨镜"],["🥸","faces","disguise 伪装 假扮"],["🤓","faces","nerd geek 书呆子 学霸"],["😢","faces","cry sad 哭 难过"],["😭","faces","sob cry loudly 大哭 痛哭"],["😤","faces","triumph huff 哼 生气"],["😡","faces","angry rage mad 生气 愤怒"],["🤬","faces","swearing cursing 骂人 爆粗"],["😱","faces","scream fear 尖叫 害怕"],["😨","faces","fearful 害怕 恐惧"],["🥵","faces","hot heat 热 出汗"],["🥶","faces","cold freezing 冷 冻"],["🥴","faces","woozy drunk 晕 醉"],["😇","faces","angel innocent 天使 无辜"],["🙃","faces","upside down silly 倒脸 哭笑不得"],["💀","faces","skull dead 骷髅 笑死"],["👻","faces","ghost 鬼 幽灵"],["👍","faces","thumbs up like good 赞 好"],["👎","faces","thumbs down dislike 踩 差"],["👏","faces","clap applause 鼓掌 厉害"],["🙌","faces","raise hands celebrate 举手 庆祝"],["🙏","faces","pray thanks please 拜托 感谢 祈祷"],["💪","faces","muscle strong flex 加油 强壮 肌肉"],["👀","faces","eyes look watch 看 围观 眼睛"],["🤝","faces","handshake deal 握手 合作"],["✌️","faces","victory peace 胜利 耶"],["👋","faces","wave hello bye 挥手 你好 再见"],["🤞","faces","crossed fingers luck 祈祷 好运"],["👌","faces","ok okay 好的 可以"],["🫶","faces","heart hands love 比心 爱心"],["✍️","faces","writing hand 写字 记录"],["🧠","faces","brain smart 大脑 聪明"],["🦾","faces","mechanical arm 机械臂 力量"],["👤","faces","person user profile 个人 用户"],["👥","faces","people team group 团队 多人"],["🐶","nature","dog puppy 狗 小狗"],["🐱","nature","cat kitten 猫 小猫"],["🐭","nature","mouse rat 老鼠"],["🐹","nature","hamster 仓鼠"],["🐰","nature","rabbit bunny 兔子"],["🦊","nature","fox 狐狸"],["🐻","nature","bear 熊"],["🐼","nature","panda 熊猫"],["🐨","nature","koala 考拉"],["🐯","nature","tiger 老虎"],["🦁","nature","lion 狮子"],["🐮","nature","cow 牛"],["🐷","nature","pig 猪"],["🐸","nature","frog 青蛙"],["🐵","nature","monkey 猴子"],["🐔","nature","chicken 鸡"],["🐧","nature","penguin 企鹅"],["🐦","nature","bird 鸟"],["🐣","nature","chick hatching 小鸡 孵化"],["🦆","nature","duck 鸭子"],["🦉","nature","owl 猫头鹰"],["🐝","nature","bee 蜜蜂"],["🐛","nature","bug caterpillar 虫子 毛虫"],["🦋","nature","butterfly 蝴蝶"],["🐌","nature","snail slow 蜗牛 慢"],["🐢","nature","turtle slow 乌龟 慢"],["🐍","nature","snake 蛇"],["🐙","nature","octopus 章鱼"],["🦑","nature","squid 鱿鱼"],["🦐","nature","shrimp 虾"],["🦀","nature","crab 螃蟹"],["🐠","nature","tropical fish 鱼 热带鱼"],["🐳","nature","whale 鲸鱼"],["🦈","nature","shark 鲨鱼"],["🐊","nature","crocodile 鳄鱼"],["🦄","nature","unicorn 独角兽"],["🐴","nature","horse 马"],["🐑","nature","sheep 羊 绵羊"],["🐐","nature","goat 山羊"],["🦜","nature","parrot 鹦鹉"],["🌸","nature","blossom flower sakura 樱花 花"],["🌹","nature","rose flower 玫瑰 花"],["🌻","nature","sunflower 向日葵"],["🌷","nature","tulip 郁金香"],["🌱","nature","seedling sprout 发芽 幼苗"],["🌲","nature","tree evergreen 树 松树"],["🌳","nature","deciduous tree 树 大树"],["🌵","nature","cactus 仙人掌"],["🍀","nature","clover luck 四叶草 幸运"],["🍁","nature","maple leaf autumn 枫叶 秋天"],["🍄","nature","mushroom 蘑菇"],["🌈","nature","rainbow 彩虹"],["☀️","nature","sun sunny 太阳 晴"],["🌙","nature","moon crescent 月亮"],["⭐","nature","star 星星"],["🌟","nature","glowing star 星星 闪亮"],["☁️","nature","cloud 云"],["⛅","nature","partly cloudy 多云"],["🌧️","nature","rain rainy 下雨"],["❄️","nature","snowflake snow 雪 雪花"],["⛄","nature","snowman 雪人"],["⚡","nature","lightning bolt 闪电"],["🔥","nature","fire hot 火 燃"],["🌊","nature","wave ocean sea 海浪"],["🏔️","nature","mountain snow 雪山 山"],["☕","food","coffee 咖啡"],["🍵","food","tea 茶"],["🧋","food","bubble tea boba 奶茶"],["🥛","food","milk 牛奶"],["🍺","food","beer 啤酒"],["🍷","food","wine 红酒"],["🥂","food","champagne cheers 香槟 干杯"],["🥤","food","cup straw soda 饮料 可乐"],["🧃","food","juice box 果汁"],["🍎","food","apple 苹果"],["🍊","food","orange tangerine 橙子 橘子"],["🍋","food","lemon 柠檬"],["🍉","food","watermelon 西瓜"],["🍓","food","strawberry 草莓"],["🍑","food","peach 桃子"],["🥭","food","mango 芒果"],["🍍","food","pineapple 菠萝"],["🥝","food","kiwi 猕猴桃"],["🍇","food","grapes 葡萄"],["🍒","food","cherries 樱桃"],["🥑","food","avocado 牛油果"],["🥦","food","broccoli 西兰花"],["🌽","food","corn 玉米"],["🌶️","food","hot pepper spicy 辣椒 辣"],["🍔","food","burger hamburger 汉堡"],["🍟","food","fries 薯条"],["🍕","food","pizza 披萨"],["🌭","food","hot dog 热狗"],["🥪","food","sandwich 三明治"],["🌮","food","taco 墨西哥卷"],["🍜","food","ramen noodles 拉面 面条"],["🍝","food","spaghetti pasta 意面"],["🍣","food","sushi 寿司"],["🍱","food","bento 便当"],["🥟","food","dumpling 饺子"],["🍚","food","rice 米饭"],["🍞","food","bread 面包"],["🥐","food","croissant 可颂 牛角包"],["🧀","food","cheese 奶酪 芝士"],["🍳","food","cooking egg 煎蛋 做饭"],["🍦","food","ice cream 冰淇淋"],["🍰","food","cake 蛋糕"],["🎂","food","birthday cake 生日蛋糕"],["🍫","food","chocolate 巧克力"],["🍩","food","donut doughnut 甜甜圈"],["🍪","food","cookie 饼干"],["🍭","food","lollipop 棒棒糖"],["⚽","activity","soccer football 足球"],["🏀","activity","basketball 篮球"],["🏈","activity","american football 橄榄球"],["⚾","activity","baseball 棒球"],["🎾","activity","tennis 网球"],["🏐","activity","volleyball 排球"],["🏓","activity","ping pong 乒乓球"],["🏸","activity","badminton 羽毛球"],["🥊","activity","boxing 拳击"],["⛳","activity","golf 高尔夫"],["🎣","activity","fishing 钓鱼"],["🏊","activity","swim 游泳"],["🏄","activity","surf 冲浪"],["🚴","activity","cycling 骑行"],["🏋️","activity","weightlifting gym 举重 健身"],["🧘","activity","yoga meditation 瑜伽 冥想"],["🎮","activity","video game controller 游戏 游戏机"],["🎲","activity","dice 骰子"],["🎯","activity","target bullseye 目标 靶心"],["🎳","activity","bowling 保龄球"],["🎰","activity","slot machine 老虎机"],["♟️","activity","chess 国际象棋 棋"],["🎸","activity","guitar 吉他"],["🎹","activity","piano keyboard 钢琴"],["🥁","activity","drum 鼓"],["🎤","activity","microphone sing 麦克风 唱歌"],["🎧","activity","headphones 耳机"],["🎬","activity","clapper movie 电影 拍摄"],["🎨","activity","art palette paint 画画 艺术"],["🎭","activity","theater masks 戏剧 面具"],["🎪","activity","circus 马戏团"],["🎡","activity","ferris wheel 摩天轮"],["✈️","activity","airplane travel flight 飞机 旅行"],["🚗","activity","car drive 汽车 车"],["🚕","activity","taxi 出租车"],["🚌","activity","bus 公交车"],["🚑","activity","ambulance 救护车"],["🚒","activity","fire engine 消防车"],["🚀","activity","rocket launch ship 火箭 发射"],["🛸","activity","ufo flying saucer 飞碟"],["🚲","activity","bicycle bike 自行车"],["🛴","activity","scooter 滑板车"],["🚄","activity","bullet train 高铁 动车"],["🚢","activity","ship 船 轮船"],["⛵","activity","sailboat 帆船"],["🏠","activity","house home 房子 家"],["🏢","activity","office building 公司 办公楼"],["🏥","activity","hospital 医院"],["🏫","activity","school 学校"],["🏖️","activity","beach vacation 海滩 度假"],["⛺","activity","camping tent 露营 帐篷"],["🌋","activity","volcano 火山"],["🗺️","activity","map world 地图"],["🧭","activity","compass 指南针"],["💻","objects","laptop computer 电脑 笔记本"],["🖥️","objects","desktop computer 台式机 电脑"],["⌨️","objects","keyboard 键盘"],["🖱️","objects","computer mouse 鼠标"],["📱","objects","phone mobile 手机"],["🔋","objects","battery 电池"],["🔌","objects","plug electric 插头"],["💾","objects","floppy save 软盘 保存"],["📀","objects","cd disc 光盘"],["🎥","objects","movie camera 摄像机"],["📷","objects","camera 相机"],["🔭","objects","telescope 望远镜"],["📡","objects","satellite antenna 卫星 天线"],["🌐","objects","globe web internet 网络 全球 互联网"],["🕯️","objects","candle 蜡烛"],["💡","objects","bulb idea light 灯泡 点子"],["🔦","objects","flashlight 手电筒"],["📁","objects","folder 文件夹"],["📂","objects","open folder 文件夹 打开"],["🗂️","objects","card index archive 归档 索引"],["📅","objects","calendar date 日历 日期"],["📌","objects","pin pushpin 图钉 置顶"],["📍","objects","round pin location 定位 位置"],["📎","objects","paperclip attachment 回形针 附件"],["✂️","objects","scissors cut 剪刀 剪切"],["📏","objects","ruler 尺子"],["📝","objects","memo note write 备忘 记录"],["✏️","objects","pencil edit write 铅笔 编辑"],["📄","objects","document page 文档 文件"],["📃","objects","page curl 文档 文件"],["📑","objects","bookmark tabs 标签页 文档"],["📚","objects","books 书 书籍"],["📖","objects","open book 打开的书 阅读"],["🔖","objects","bookmark 书签"],["🏷️","objects","label tag 标签"],["📊","objects","bar chart stats 图表 统计"],["📈","objects","chart up growth 上涨 增长"],["📉","objects","chart down 下跌 下降"],["🔍","objects","search magnifier 搜索 查找"],["🔎","objects","search magnifier right 搜索 查找"],["🔒","objects","lock locked 锁 锁定"],["🔓","objects","unlock open 解锁"],["🔑","objects","key 钥匙 密钥"],["🔧","objects","wrench tool 扳手 工具"],["🔨","objects","hammer 锤子"],["🛠️","objects","tools hammer wrench 工具 修理"],["🧰","objects","toolbox 工具箱 工具"],["🪛","objects","screwdriver 螺丝刀 工具"],["🔩","objects","nut and bolt screw 螺母 螺栓"],["🏗️","objects","building construction crane 施工 建造"],["⚙️","objects","gear settings 齿轮 设置"],["🧲","objects","magnet 磁铁"],["⚗️","objects","alembic 蒸馏器 实验"],["🧪","objects","test tube experiment 实验 试管"],["🔬","objects","microscope science 显微镜 科学"],["🤖","objects","robot bot 机器人"],["👾","objects","alien monster game 外星人 游戏"],["💣","objects","bomb 炸弹"],["🧨","objects","firecracker 爆竹"],["🗑️","objects","trash delete 垃圾桶 删除"],["🧹","objects","broom clean 扫帚 清理"],["🧻","objects","toilet paper 纸巾"],["🧽","objects","sponge 海绵"],["📦","objects","package box 包裹 箱子"],["✉️","objects","envelope mail 邮件 信封"],["📮","objects","mailbox postbox 邮箱"],["📧","objects","email mail 邮件"],["📥","objects","inbox tray receive 收件箱 接收"],["📤","objects","outbox tray send 发件箱 发送"],["📞","objects","telephone receiver call phone 电话 通话"],["💬","objects","speech balloon chat message bubble 聊天 对话 气泡 消息"],["💭","objects","thought balloon thinking 思考 想法 气泡"],["📣","objects","megaphone announcement 喇叭 公告"],["📢","objects","loudspeaker broadcast 广播 喇叭 通知"],["🚨","objects","police light alert emergency 警报 告警 紧急"],["🗳️","objects","ballot box vote 投票箱 投票"],["🔗","objects","link chain 链接 连接"],["🧩","objects","puzzle piece plugin 拼图 插件"],["🪄","objects","magic wand 魔法 魔杖"],["🛡️","objects","shield security 盾牌 安全"],["⚔️","objects","crossed swords 交叉剑 战斗"],["💳","objects","credit card 信用卡"],["💰","objects","money bag 钱袋 钱"],["🧾","objects","receipt 收据 小票"],["📿","objects","prayer beads 念珠"],["💍","objects","ring 戒指"],["👑","objects","crown 皇冠"],["🎩","objects","top hat 礼帽"],["🎒","objects","backpack 背包 书包"],["👓","objects","glasses 眼镜"],["🌂","objects","umbrella 雨伞"],["🕰️","objects","mantel clock 座钟"],["⌚","objects","watch 手表"],["⏱️","objects","stopwatch 秒表"],["🧯","objects","fire extinguisher 灭火器"],["🩹","objects","bandage patch fix 创可贴 补丁 修复"],["🎓","objects","graduation cap study learn 毕业 学习"],["🎫","objects","ticket 票 门票 工单"],["✅","symbols","check done complete 完成 对勾"],["✔️","symbols","checkmark correct 对勾 正确"],["❌","symbols","cross x wrong 错误 叉"],["❓","symbols","question help 问题 问号"],["❔","symbols","white question 问题 问号"],["❗","symbols","exclamation important 感叹号 重要"],["❕","symbols","white exclamation 感叹号"],["⚠️","symbols","warning caution 警告 注意"],["🚧","symbols","construction wip 施工 进行中"],["🚫","symbols","prohibited no 禁止"],["💥","symbols","boom explosion 爆炸"],["✨","symbols","sparkles shiny 闪亮 星星"],["🎉","symbols","tada party celebrate 庆祝 撒花"],["🎊","symbols","confetti party 庆祝 彩带"],["🏆","symbols","trophy champion 奖杯 冠军"],["🥇","symbols","gold medal first 金牌 第一"],["🥈","symbols","silver medal second 银牌 第二"],["🥉","symbols","bronze medal third 铜牌 第三"],["🎖️","symbols","military medal 勋章"],["🚩","symbols","red flag mark 红旗 标记"],["🏁","symbols","checkered flag finish 终点 完成"],["⏳","symbols","hourglass time waiting 沙漏 时间"],["⌛","symbols","hourglass done 沙漏 时间"],["🕐","symbols","clock one time 时钟 一点"],["⏰","symbols","alarm clock 闹钟"],["🔔","symbols","bell notification 铃铛 通知"],["🔕","symbols","bell slash mute 静音 免打扰"],["🕹️","symbols","joystick game 摇杆 游戏"],["🔴","symbols","red circle record 红圆 录制"],["🟢","symbols","green circle online 绿圆 在线"],["🟡","symbols","yellow circle 黄圆"],["🟠","symbols","orange circle 橙圆"],["🔵","symbols","blue circle 蓝圆"],["🟣","symbols","purple circle 紫圆"],["⚫","symbols","black circle 黑圆"],["⚪","symbols","white circle 白圆"],["🟥","symbols","red square 红方"],["🟩","symbols","green square 绿方"],["🟦","symbols","blue square 蓝方"],["🔺","symbols","red triangle up 三角 上"],["🔻","symbols","triangle down 三角 下"],["🔸","symbols","diamond orange 菱形"],["🔹","symbols","diamond blue 菱形"],["💠","symbols","diamond dot 菱形 花"],["🔶","symbols","diamond orange big 菱形"],["🔷","symbols","diamond blue big 菱形"],["▶️","symbols","play 播放"],["⏸️","symbols","pause 暂停"],["⏹️","symbols","stop 停止"],["⏺️","symbols","record 录制"],["⏩","symbols","fast forward 快进"],["⏪","symbols","rewind 快退"],["🔀","symbols","shuffle 随机 打乱"],["🔁","symbols","repeat 重复 循环"],["🔂","symbols","repeat one 单曲循环"],["🔄","symbols","refresh sync 刷新 同步"],["🔃","symbols","reload 重载"],["➕","symbols","plus add 加 新增"],["➖","symbols","minus 减"],["➗","symbols","divide 除"],["✖️","symbols","multiply 乘"],["💲","symbols","dollar money 美元 钱"],["™️","symbols","trademark 商标"],["©️","symbols","copyright 版权"],["®️","symbols","registered 注册商标"],["↔️","symbols","left right arrow 左右箭头"],["⬆️","symbols","up arrow 上箭头"],["⬇️","symbols","down arrow 下箭头"],["➡️","symbols","right arrow 右箭头"],["⬅️","symbols","left arrow 左箭头"],["🔙","symbols","back 返回"],["🔜","symbols","soon 很快"],["🔝","symbols","top 置顶 顶部"],["💤","symbols","zzz sleep 睡觉"],["🆕","symbols","new 新 新品"],["🆒","symbols","cool 酷"],["🆓","symbols","free 免费"],["🆗","symbols","ok 可以"],["🆙","symbols","up 提升"],["🆚","symbols","vs versus 对比"],["♾️","symbols","infinity 无限"],["💯","symbols","hundred perfect 满分 一百"],["💢","symbols","anger 生气"],["♨️","symbols","hot springs 温泉"],["🚸","symbols","children crossing 注意儿童"],["🔞","symbols","no one under eighteen 十八禁"],["📵","symbols","no mobile phones 禁止手机"],["❤️","symbols","red heart love 红心 爱"],["🧡","symbols","orange heart 橙心"],["💛","symbols","yellow heart 黄心"],["💚","symbols","green heart 绿心"],["💙","symbols","blue heart 蓝心"],["💜","symbols","purple heart 紫心"],["🖤","symbols","black heart 黑心"],["🤍","symbols","white heart 白心"],["🤎","symbols","brown heart 棕心"],["💔","symbols","broken heart 心碎"],["💕","symbols","two hearts 双心 爱心"],["💖","symbols","sparkling heart 闪亮的心"],["💗","symbols","growing heart 心动"]],sE=iJ.map(([e,t,n])=>({emoji:e,group:t,keywords:n}));function rJ(e,t=24){const n=e.trim().toLowerCase();if(!n)return[];const o=[];for(const s of sE)if((s.keywords.includes(n)||s.emoji===n)&&(o.push(s.emoji),o.length>=t))break;return o}const lJ=8;function aJ(e,t,n=lJ){return[t,...e.filter(o=>o!==t)].slice(0,n)}function uJ(e,t){try{const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const o=new Date,s=c=>String(c).padStart(2,"0"),i=`${s(n.getHours())}:${s(n.getMinutes())}`,r=n.getFullYear()===o.getFullYear(),l=n.getMonth()===o.getMonth(),a=n.getDate()===o.getDate();if(r&&l&&a)return i;const u=new Date(o);return u.setDate(o.getDate()-1),n.getFullYear()===u.getFullYear()&&n.getMonth()===u.getMonth()&&n.getDate()===u.getDate()?`${t} ${i}`:r?`${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`}catch{return e}}function Al(e){if(e>=1024*1024)return`${Vb(e/(1024*1024))}M`;if(e>=1024){const t=e/1024;return`${t>=100?Math.round(t):Vb(t)}k`}return String(e)}function Vb(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}function v1(e){const t=e.split("/").filter(Boolean);return t.length>0?t[t.length-1]:e}const cJ=/^(?:[A-Za-z]:[\\/]|\\\\|\/\/)/;function Pr(e){const t=e.replaceAll("\\","/"),n=cJ.test(t),o=t.replace(/\/+$/,"");return n?o.toLowerCase():o}function dJ(e){const{workspaces:t,sessions:n,hiddenWorkspaceRoots:o,sessionsHasMoreByWorkspace:s}=e,i=new Set(o.map(Pr)),r=new Map;for(const f of t){const h=Pr(f.root);i.has(h)||r.has(h)||r.set(h,{...f})}for(const f of n){const h=f.cwd;if(!h)continue;const m=Pr(h);i.has(m)||r.has(m)||r.set(m,{id:f.workspaceId??h,root:h,name:v1(h),sessionCount:0})}const l=new Map;for(const f of t){const h=Pr(f.root);l.has(h)||l.set(h,f.id)}const a=new Map;for(const f of n){const h=l.get(Pr(f.cwd))??f.workspaceId??f.cwd;a.set(h,(a.get(h)??0)+1)}const u=[];for(const f of t){const h=Pr(f.root);!i.has(h)&&!u.includes(h)&&u.push(h)}const c=[...r.keys()].filter(f=>!u.includes(f));c.sort((f,h)=>r.get(f).root.localeCompare(r.get(h).root));const d=[];for(const f of[...u,...c]){const h=r.get(f),m=a.get(h.id)??a.get(h.root)??0,v=s[h.id]===!1?m:Math.max(h.sessionCount,m);d.push({...h,sessionCount:v})}return d}function fJ(e,t){if(e===void 0||e.length===0)return;const n=t?.find(o=>o.id===e)??t?.find(o=>o.model===e);return n?.displayName||n?.model||(e.includes("/")?e.split("/").pop():e)}function pJ(e){if(!(e===void 0||e.length===0||e==="off"||e==="on"))return e}function p2(e){if(e===void 0)return"toggle";const t=e.capabilities??[];return t.includes("always_thinking")?"always-on":t.includes("thinking")||e.adaptiveThinking===!0?"toggle":"unsupported"}function iE(e){return e?.supportEfforts??[]}function hJ(e){return e[Math.floor(e.length/2)]}function bp(e){if(p2(e)==="unsupported")return"off";const t=iE(e);return t.length>0?e?.defaultEffort??hJ(t):"on"}function Up(e){const t=iE(e),n=p2(e);return t.length>0?n==="always-on"?[...t]:["off",...t]:n==="always-on"?["on"]:n==="unsupported"?["off"]:["on","off"]}function y3(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function mJ(e){return e!=="off"}function gJ(e,t){return Up(e).includes(t)}function My(e,t){return t==="off"?"off":t==="on"?bp(e):t}function Dm(e,t){return t??bp(e)}function vJ(e,t){if(e==="off")return{enabled:!1};if(e==="on")return{enabled:!0};const n=t?.at(-1);return n!==void 0&&e===n?{enabled:!0}:{enabled:!0,effort:e}}function yJ(e,t,n){return!n||e===void 0?t:bp(e)}let kJ=0;function k3(e,t){const n=++kJ;return e.pendingThinkingBySession[t]=n,n}function vl(e,t,n){return n===void 0||e.pendingThinkingBySession[t]!==n?!1:(delete e.pendingThinkingBySession[t],!0)}function rE(e,t,n){e.pendingThinkingBySession[t]===void 0&&(e.thinkingBySession[t]=n)}function lE(){return window.kimiDesktop}function ih(){return typeof lE()?.getPathForFile=="function"}function aE(e){const t=lE()?.getPathForFile;if(typeof t!="function")return null;try{return t(e)}catch{return null}}function c9(e){return Array.from(e.dataTransfer?.items??[]).some(t=>t.kind==="file"&&t.type==="")}function b3(e,t=aE){const n=Array.from(e.dataTransfer?.items??[]);if(n.length===0)return{files:Array.from(e.dataTransfer?.files??[]),folderPaths:[]};const o=[],s=[],i=new Set;for(const r of n){if(r.kind!=="file")continue;const l=r.getAsFile();if(l)if(r.webkitGetAsEntry()?.isDirectory===!0){const a=t(l);if(!a||i.has(a))continue;i.add(a),s.push(a)}else o.push(l)}return{files:o,folderPaths:s}}function bJ(e,t=aE){return b3(e,t).folderPaths}const CJ=/([\s\S]*?)<\/summary>/,wJ=/([\s\S]*?)<\/resume_hint>/,d9=/]*)>|<\/subagent>/g,_J="",qb=/(completed|failed|aborted):\s*(\d+)/g,Kb=/([a-z_]+)="([^"]*)"/g;function xJ(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function SJ(e){const t={};Kb.lastIndex=0;let n;for(;(n=Kb.exec(e))!==null;)t[n[1]]=xJ(n[2]);return t}function AJ(e){const t={completed:0,failed:0,aborted:0};qb.lastIndex=0;let n;for(;(n=qb.exec(e))!==null;){const o=n[1];t[o]=Number(n[2])}return t}function MJ(e,t){const n=SJ(e);return{outcome:n.outcome??"completed",item:n.item,agentId:n.agent_id,mode:n.mode,state:n.state,body:t.trim()}}function TJ(e){const t=[],n=[];d9.lastIndex=0;let o;for(;(o=d9.exec(e))!==null;)if(o[0]===_J){if(n.length===0)continue;const s=n.pop();s&&n.length===0&&t.push(MJ(s.attrs,e.slice(s.bodyStart,o.index)))}else n.length===0?n.push({attrs:o[1]??"",bodyStart:d9.lastIndex}):n.push(null);return t}function EJ(e){if(e==null)return null;const t=Array.isArray(e)?e.join(` +`):e;if(!t.includes(""))return null;const n=CJ.exec(t)?.[1]?.trim()??"",{completed:o,failed:s,aborted:i}=AJ(n),r=wJ.exec(t)?.[1]?.trim(),l=TJ(t),a=o+s+i;return{summary:n,completed:o,failed:s,aborted:i,total:a>0?a:l.length,subagents:l,resumeHint:r}}const IJ=/^[A-Za-z]:[\\/]/;function Zb(e){return IJ.test(e)||e.startsWith("\\\\")||e.startsWith("//")}function h2(e,t){if(!t)return null;const n=c=>c.replace(/\\/g,"/"),o=n(e);let s=n(t);s.length>1&&(s=s.replace(/\/+$/,""));const i=Zb(s)||Zb(o),r=i?s.toLowerCase():s,l=i?o.toLowerCase():o,a=r.endsWith("/")?r:`${r}/`;if(l!==r&&!l.startsWith(a))return null;const u=l===r?"":o.slice(a.length);return u.split("/").includes("..")?null:u||null}const Bf="application/x-kimi-session-row";function LJ(e,t){return e.includes(t)?e:[...e,t]}function uE(e,t){return e.includes(t)?e.filter(n=>n!==t):e}function cE(e,t){const n=new Set(e);return[...e,...t.filter(o=>!n.has(o))]}function $J(e,t){const n=new Set(t),o=new Map,s=[];for(const r of e)n.has(r.id)?o.set(r.id,r):s.push(r);const i=[];for(const r of t){const l=o.get(r);l!==void 0&&i.push(l)}return{pinned:i,unpinned:s}}function NJ(e,t,n,o){const s=e.filter(r=>r!==t),i=n===null?-1:s.indexOf(n);return i===-1?[...s,t]:(s.splice(o==="before"?i:i+1,0,t),s)}function FJ(e,t,n){return e.find(o=>o.window?.duration===t&&o.window?.unit===n)}const RJ=30;function OJ(e){return e!==void 0&&e0?(l.push(t("settings.planUsage.durationDay",{n:s})),l.push(t("settings.planUsage.durationHour",{n:i})),l.push(t("settings.planUsage.durationMinute",{n:r}))):i>0?(l.push(t("settings.planUsage.durationHour",{n:i})),l.push(t("settings.planUsage.durationMinute",{n:r}))):r>0?l.push(t("settings.planUsage.durationMinute",{n:r})):l.push(t("settings.planUsage.durationSecond",{n:o})),t("settings.planUsage.resetsIn",{duration:l.join(" ")})}function C3(e,t){if(t<=0)return"ok";const n=e/t;return n>=.85?"danger":n>=.5?"warn":"ok"}function Wh(e,t){return t<=0?0:Math.min(100,Math.round(e/t*100))}function PJ(e,t){const n=(e/100).toFixed(2);switch(t.toUpperCase()){case"CNY":return{symbol:"¥",number:n};case"USD":return{symbol:"$",number:n};default:return{symbol:"",number:`${n} ${t}`}}}const DJ=["kimi","openai","openai_responses","anthropic","google-genai","vertexai"];function rh(){return{model:"",maxContextSize:"",displayName:"",capabilities:["tool_use","thinking"],supportEfforts:[],adaptiveThinking:!0}}function w3(e,t){const n=[];for(const o of Object.values(t??{})){if(o===null||typeof o!="object")continue;const s=o;s.provider===e.id&&n.push({model:typeof s.model=="string"?s.model:"",maxContextSize:typeof s.maxContextSize=="number"?String(s.maxContextSize):"",displayName:typeof s.displayName=="string"?s.displayName:"",capabilities:Array.isArray(s.capabilities)?s.capabilities.filter(i=>typeof i=="string"):[],supportEfforts:Array.isArray(s.supportEfforts)?s.supportEfforts.filter(i=>typeof i=="string"):[],...typeof s.adaptiveThinking=="boolean"?{adaptiveThinking:s.adaptiveThinking}:{}})}return n}const pE=/^[\p{L}\p{N}][\p{L}\p{N}\-_ ]*$/u;function BJ(e,t={}){const n=e.id.trim();if(n==="")return"idRequired";if(!pE.test(n))return"idInvalid";if(t.requireApiKey===!0&&e.apiKey.trim()==="")return"apiKeyRequired";if(t.requireBaseUrl===!0&&e.baseUrl.trim()==="")return"baseUrlRequired";if(e.models.length===0)return"modelRequired";for(const o of e.models){if(o.model.trim()==="")return"modelRequired";const s=o.maxContextSize.trim();if(s==="")return"contextSizeRequired";if(!/^\d+$/.test(s)||Number(s)<1)return"contextSizeInvalid"}return null}function hE(e){return e.map(t=>{const n=t.displayName.trim();return{model:t.model.trim(),maxContextSize:Number(t.maxContextSize.trim()),...t.capabilities.length>0?{capabilities:[...t.capabilities]}:{},...t.supportEfforts.length>0?{supportEfforts:[...t.supportEfforts]}:{},...t.adaptiveThinking!==void 0?{adaptiveThinking:t.adaptiveThinking}:{},...n===""?{}:{displayName:n}}})}function HJ(e){const t=e.apiKey.trim(),n=e.baseUrl.trim();return{id:e.id.trim(),type:e.type,models:hE(e.models),...t===""?{}:{apiKey:t},...n===""?{}:{baseUrl:n}}}function zJ(e,t,n){const o=hE(e.models),s=e.id.trim(),i=e.apiKey.trim(),r=e.baseUrl.trim(),l=n?.existingDefaultModel?.trim()??"",a=l.indexOf("/")>=0?l.slice(l.indexOf("/")+1):l;return{...t!==void 0&&s!==""&&s!==t.id?{newId:s}:{},type:e.type,models:o,...i===""&&n?.includeBlankApiKey!==!0?{}:{apiKey:i},...r===""?{}:{baseUrl:r},...a!==""&&o.some(u=>u.model===a)?{defaultModel:a}:{}}}function mE(e){return e.id==="managed:kimi-code"&&e.type==="kimi"}const WJ=/^(\d+)\t(.*)$/;function UJ(e){const t=e.at(-1)===""?e.slice(0,-1):e;if(t.length===0)return null;const n=[],o=[];for(const s of t){const i=WJ.exec(s);if(!i)return null;o.push(Number(i[1])),n.push(i[2]??"")}return{contents:n,lineNumbers:o}}function gE(e,t){for(const n of e.stateMachineNames){const o=(e.stateMachineInputs(n)??[]).find(s=>s.name===t);if(o!==void 0)return o}return null}function jJ(e,t){const n=gE(e,t);return n!==null&&typeof n.fire=="function"?(n.fire(),!0):!1}function Gb(e,t,n){const o=gE(e,t);return o!==null&&typeof o.value==typeof n?(o.value=n,!0):!1}const VJ={"&":"&","<":"<",">":">",'"':""","'":"'"};function Yb(e){return e.replace(/[&<>"']/g,t=>VJ[t]??t)}function qJ(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function KJ(e,t,n=40){const o=e.replace(/\s+/g," ").trim();if(o.length===0)return"";const s=t.trim();if(s.length===0)return Xb(o,n*2);const i=o.toLowerCase().indexOf(s.toLowerCase());if(i<0)return Xb(o,n*2);const r=Math.max(0,i-n),l=Math.min(o.length,i+s.length+n),a=r>0,u=l`${i}`)}const zs="kimi-web.server-credential",ZJ="token",GJ=10080*60*1e3;let yl;const _3=new Set;function YJ(){if(typeof window>"u")return;const e=window.location.hash??"";if(!e.startsWith("#"))return;const n=new URLSearchParams(e.slice(1)).get(ZJ);if(!n)return;const o=new URL(window.location.href);return o.hash="",window.history.replaceState(window.history.state,"",`${o.pathname}${o.search}`),n}function x3(e){return{version:1,credential:e,expiresAt:Date.now()+GJ}}function XJ(e){return JSON.stringify(e)}function Ty(e){try{const t=JSON.parse(e);if(typeof t!="object"||t===null)return;const n=t;return n.version!==1||typeof n.credential!="string"||n.credential.length===0||typeof n.expiresAt!="number"||!Number.isFinite(n.expiresAt)?void 0:{version:1,credential:n.credential,expiresAt:n.expiresAt}}catch{return}}function S3(e){globalThis.localStorage?.setItem(zs,XJ(e))}function JJ(){try{const e=globalThis.localStorage?.getItem(zs);if(e){const n=Ty(e);if(n===void 0){const o=x3(e);let s=!1;try{S3(o),s=!0}catch{}if(!s)try{globalThis.localStorage?.getItem(zs)===e&&globalThis.localStorage?.removeItem(zs),s=!0}catch{}try{globalThis.sessionStorage?.removeItem(zs)}catch{}return s?o:void 0}if(n.expiresAt>Date.now())return n;globalThis.sessionStorage?.removeItem(zs),globalThis.localStorage?.getItem(zs)===e&&globalThis.localStorage?.removeItem(zs);return}const t=globalThis.sessionStorage?.getItem(zs);if(t){const n=x3(t);let o=!1;try{S3(n),o=!0}catch{}try{globalThis.sessionStorage?.removeItem(zs),o=!0}catch{}return o?n:void 0}return}catch{return}}function QJ(){const e=YJ();return e?(vE(e),!0):(yl=JJ(),yl!==void 0)}function eQ(){if(yl!==void 0){if(yl.expiresAt<=Date.now()){tQ(yl);return}return yl.credential}}function tQ(e){yl=void 0;try{globalThis.sessionStorage?.removeItem(zs);const t=globalThis.localStorage?.getItem(zs),n=t==null?void 0:Ty(t);(n===void 0?t===e.credential:n.credential===e.credential&&n.expiresAt===e.expiresAt)&&globalThis.localStorage?.removeItem(zs)}catch{}}function vE(e){const t=x3(e);yl=t;try{S3(t)}catch{}try{globalThis.sessionStorage?.removeItem(zs)}catch{}}function nQ(){const e=yl;yl=void 0;try{const t=globalThis.localStorage?.getItem(zs),o=(t==null?void 0:Ty(t))?.credential??t;e!==void 0&&o===e.credential&&globalThis.localStorage?.removeItem(zs),globalThis.sessionStorage?.removeItem(zs)}catch{}}function oQ(e){return _3.add(e),()=>{_3.delete(e)}}function sQ(){nQ();for(const e of _3)try{e()}catch{}}let Jb;function iQ(e){if(typeof Intl.Segmenter=="function")return Jb??=new Intl.Segmenter("und",{granularity:"grapheme"}),Jb.segment(e)}const rQ=/\p{Emoji_Presentation}/u,lQ=/\p{Regional_Indicator}/u,aQ=/\p{Extended_Pictographic}/u,uQ="️";function cQ(e){return rQ.test(e)||lQ.test(e)?!0:aQ.test(e)&&e.includes(uQ)}function yE(e){const t=iQ(e)?.[Symbol.iterator]().next().value;if(t===void 0||!cQ(t.segment))return{emoji:null,rest:e};const n=e.slice(t.index+t.segment.length).replace(/^\s+/,"");return{emoji:t.segment,rest:n}}function dQ(e,t){const{rest:n}=yE(e),o=t?.trim()??"";return o?n?`${o} ${n}`:o:n}const A3="/sessions/";function Qb(e){const{pathname:t}=e;if(!t.startsWith(A3))return;const n=t.slice(A3.length);if(!(!n||n.includes("/")))try{const o=decodeURIComponent(n);return o.length>0?o:void 0}catch{return}}function fQ(e){return e===void 0||e.length===0?"/":`${A3}${encodeURIComponent(e)}`}function kE(e){const t=!e.renaming&&(e.questionCount>0||e.pendingInteraction==="question"),n=!e.renaming&&(e.approvalCount>0||e.pendingInteraction==="approval"),o=!e.renaming&&!e.busy&&e.pendingInteraction!=="question"&&e.pendingInteraction!=="approval"&&e.questionCount===0&&e.approvalCount===0&&e.lastTurnReason==="failed",s=e.busy&&!t&&!n,i=e.busy||e.unread||t||n||o;return{showQuestionBadge:t,showApprovalBadge:n,showAbortedBadge:o,showBusySpinner:s,hasStatus:i}}const bE=[{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/export",desc:"commands.export.desc"},{name:"/status",desc:"commands.status.desc"}];function pQ(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}const Bm="skill:";function hQ(e){return e.startsWith(Bm)?e.slice(Bm.length):e}function CE(e=[]){const t=e.map(n=>({name:n.source==="builtin"?`/${n.name}`:`/${Bm}${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...bE,...t]}function mQ(e,t=bE){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((o,s)=>{const i=o.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:o,index:s,score:r}}).filter(({score:o})=>o>0).sort((o,s)=>o.score!==s.score?s.score-o.score:o.index-s.index).map(({item:o})=>o)}function gQ(e,t){if(t.length===0||e.length===0)return t;const n=Date.parse(t[0].createdAt);if(Number.isNaN(n))return t;const o=new Set(t.map(r=>r.id)),s=new Set(t.flatMap(r=>r.role==="user"&&r.promptId!==void 0?[r.promptId]:[])),i=e.filter(r=>{const l=Date.parse(r.createdAt);return!(Number.isNaN(l)||l>=n||o.has(r.id)||r.role==="user"&&(r.userMessageId!==void 0&&o.has(r.userMessageId)||r.promptId!==void 0&&s.has(r.promptId)))});return i.length>0?[...i,...t]:t}function vQ(e){const t=new Map,n=new Set;function o(i){const r=t.get(i);if(r!==void 0)return r;const l=(async()=>e(i))().finally(()=>{t.delete(i),n.delete(i)&&o(i)});return t.set(i,l),l}function s(i){if(t.has(i)){n.add(i);return}o(i)}return{run:o,request:s}}const cn={permission:"kimi-web.permission",activeWorkspace:"kimi-active-workspace",planMode:"kimi-web.plan-mode",swarmMode:"kimi-web.swarm-mode",goalMode:"kimi-web.goal-mode",fontScale:"kimi-web.font-scale",starredModels:"kimi-web.starred-models",unread:"kimi-web.unread",onboarded:"kimi-web.onboarded",colorScheme:"kimi-web.color-scheme",hiddenWorkspaces:"kimi-web.hidden-workspaces",collapsedWorkspaces:"kimi-web.collapsed-workspaces",workspaceOrder:"kimi-web.workspace-order",pinnedSessions:"kimi-web.pinned-sessions",pinnedCollapsed:"kimi-web.pinned-collapsed",workspaceNameOverrides:"kimi-web.workspace-name-overrides",notifyEnabled:"kimi-web.notify-enabled",notifySound:"kimi-web.notify-sound",inputHistory:"kimi-web.input-history",locale:"kimi-locale",clientId:"kimi-web.client-id",debug:"kimi-web.debug",openInDefaultTarget:"kimi-web.open-in.default-target",openInLastTarget:"kimi-web.open-in.last-target",sidebarCollapsed:"kimi-web.sidebar-collapsed",sidebarWidth:"kimi-web.sidebar-width",sidebarViewMode:"kimi-web.sidebar-view-mode",shortcutOverrides:"kimi-web.shortcut-overrides",dockIconChoice:"kimi-web.dock-icon-choice",updateSkippedVersion:"kimi-web.update-skipped-version",codeFont:"kimi-web.code-font",contentAlign:"kimi-web.content-align",theme:"kimi-web.theme",thinking:"kimi-web.thinking",accent:"kimi-web.accent",notifyOnComplete:"kimi-web.notify-on-complete",notifyOnQuestion:"kimi-web.notify-on-question",notifyOnApproval:"kimi-web.notify-on-approval",soundOnComplete:"kimi-web.sound-on-complete"};function eC(e){return`kimi-web.draft.${e&&e.length>0?e:"__new__"}`}function ui(e){try{return globalThis.localStorage.getItem(e)}catch{return null}}function Ls(e,t){try{globalThis.localStorage.setItem(e,t)}catch{}}function ur(e){try{globalThis.localStorage.removeItem(e)}catch{}}function y1(e){const t=ui(e);if(t===null)return null;try{return JSON.parse(t)}catch{return null}}function Tc(e,t){try{globalThis.localStorage.setItem(e,JSON.stringify(t))}catch{}}function Ey(){const e=ui(cn.unread);if(!e)return{};try{const t=JSON.parse(e);if(!t||typeof t!="object")return{};const n={};for(const[o,s]of Object.entries(t))s===!0&&(n[o]=!0);return n}catch{return{}}}function Iy(e){const n={...Ey()};for(const[o,s]of Object.entries(e))s?n[o]=!0:delete n[o];Ls(cn.unread,JSON.stringify(n))}function yQ(){const e=y1(cn.collapsedWorkspaces);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function p9(e){Tc(cn.collapsedWorkspaces,Array.from(e))}function kQ(){return y1(cn.pinnedCollapsed)===!0}function M3(e){Tc(cn.pinnedCollapsed,e)}function bQ(){return ui(cn.sidebarViewMode)==="flat"?"flat":"grouped"}function CQ(e){Ls(cn.sidebarViewMode,e)}function wQ(){const e=y1(cn.workspaceOrder);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function wE(e){Tc(cn.workspaceOrder,Array.from(e))}function _E(){const e=y1(cn.pinnedSessions);return Array.isArray(e)?e.filter(t=>typeof t=="string"):[]}function k1(e){Tc(cn.pinnedSessions,Array.from(e))}function lh(){const e=y1(cn.workspaceNameOverrides);if(!e||typeof e!="object")return{};const t={};for(const[n,o]of Object.entries(e))typeof o=="string"&&(t[n]=o);return t}function tC(e){Tc(cn.workspaceNameOverrides,e)}function nC(e,t){const n=new Set(e.map(a=>a.id)),o=t.filter(a=>a.kind==="subagent"&&!n.has(a.id));if(o.length===0)return e;const s=new Map(e.map(a=>[a.id,a])),i=new Set,r=o.map(a=>{const u=a.backgroundTaskId!==void 0?s.get(a.backgroundTaskId):void 0;if(u===void 0)return a;i.add(u.id);const c=a.status==="running"&&u.status!=="running";return{...a,status:a.status==="running"?u.status:a.status,subagentPhase:c?u.status==="completed"?"completed":"failed":a.subagentPhase,completedAt:a.completedAt??u.completedAt,outputPreview:u.outputPreview??a.outputPreview,outputBytes:u.outputBytes??a.outputBytes,model:a.model??u.model,thinkingEffort:a.thinkingEffort??u.thinkingEffort}});return[...e.filter(a=>!i.has(a.id)),...r]}function _Q(e,t){if(e.length===0)return t;const n=new Map(t.map(r=>[r.id,r])),o=new Set(e.map(r=>r.id)),s=e.map(r=>{const l=n.get(r.id);return l?{...r,outputLines:l.outputLines,text:l.text,model:r.model??l.model,thinkingEffort:r.thinkingEffort??l.thinkingEffort}:r}),i=t.filter(r=>!o.has(r.id));return i.length===0?s:[...s,...i]}function xQ(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const e=navigator.userAgentData;return e?.platform==="macOS"||e?.platform==="iOS"}function SQ(e,t=xQ()){return(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey&&(e.code==="KeyF"||e.key.toLowerCase()==="f")&&!e.defaultPrevented}const AQ=new Map([["ς","σ"],["ß","ss"],["ſ","s"],["ff","ff"],["fi","fi"],["fl","fl"],["ffi","ffi"],["ffl","ffl"],["ſt","st"],["st","st"],["ʼn","ʼn"],["µ","μ"],["K","k"],["Å","å"],["Ω","ω"]]);function MQ(e){return e==="pre"||e==="pre-wrap"||e==="break-spaces"?"preserve":e==="pre-line"?"pre-line":"collapse"}function TQ(e,t){if(t==="preserve")return{text:e,map:Array.from({length:e.length},(r,l)=>l)};const n=t==="collapse"?/[\t\n\f\r ]/:/[\t ]/;let o="";const s=[];let i=!1;for(let r=0;roC(c.text)),o="\0";let s="";const i=[];for(let c=0;c0&&e[c].gapBefore&&(s+=o),i[c]=s.length,s+=n[c].folded;const r=LQ(oC(t).folded);if(r===null)return;const l=new RegExp(r,"g");function a(c){let d=0,f=i.length-1,h=0;for(;d<=f;){const m=d+f>>1;i[m]<=c?(h=m,d=m+1):f=m-1}return h}let u;for(;;){const c=l.exec(s);if(c===null)return;const d=c.index,f=d+c[0].length-1,h=a(d),m=a(f),v=n[h].map[d-i[h]],k=n[m].map[f-i[m]],w={startSeg:h,startOffset:v.start,endSeg:m,endOffset:k.start+k.length};u!==void 0&&u.startSeg===w.startSeg&&u.startOffset===w.startOffset&&u.endSeg===w.endSeg&&u.endOffset===w.endOffset||(u=w,yield w)}}const IQ=/[.*+?^${}()|[\]\\]/g;function LQ(e){const t=[];let n=0;for(;n=OQ)return{ranges:a,truncated:!0};a.push(f)}}return{ranges:a,truncated:!1}}const xE="kimi-transcript-search",T3="kimi-transcript-search-current";function SE(){return globalThis.CSS?.highlights??null}function h9(e,t){const n=SE(),o=globalThis.Highlight;if(!n||!o)return;if(e.length===0){E3();return}const s=new o;for(const r of e)s.add(r);n.set(xE,s);const i=e[t];if(i!==void 0){const r=new o;r.add(i),n.set(T3,r)}else n.delete(T3)}function E3(){const e=SE();e?.delete(xE),e?.delete(T3)}function DQ(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const e=navigator.userAgentData;return e?.platform==="macOS"||e?.platform==="iOS"}function BQ(e,t=DQ()){return(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey&&(e.code==="KeyA"||e.key.toLowerCase()==="a")&&!e.defaultPrevented}function HQ(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement&&(e.isContentEditable||e.closest("input, textarea")!==null)}function zQ(e,t){return typeof Element>"u"||!(e instanceof Element)?null:e.closest(t)}function iC(e){e.ownerDocument.getSelection()?.selectAllChildren(e)}const WQ=`https://www.kimi.com/code?from=${Wp?"kimi_code_desktop":"kimi_code_web"}`;function jp(){window.open(WQ,"_blank","noopener")}function UQ(e,t){if(e.length===0)return null;const n=new Set(e),o=t.filter(i=>n.has(i)),s=e.filter(i=>!t.includes(i));return s.length===0&&o.length===t.length?null:[...s,...o]}function jQ(e,t){const n=new Map(t.map((o,s)=>[o,s]));return e.toSorted((o,s)=>(n.get(o.id)??-1)-(n.get(s.id)??-1))}function AE(e,t,n,o="before"){const s=e.indexOf(t),i=e.indexOf(n);if(s===-1||i===-1||s===i)return e;const r=[...e];r.splice(s,1);const l=si.id===t)){const i=e.find(r=>r.id===t);i&&(s[o-1]=i)}return s}const KQ={class:"sd-body"},ZQ={class:"sd-search"},GQ=["aria-label"],YQ=["aria-selected","onClick","onMousemove"],XQ={class:"sd-meta"},JQ=["innerHTML"],QQ={class:"sd-time"},eee=["innerHTML"],tee=["innerHTML"],nee={key:1,class:"sd-empty"},oee={class:"sd-foot","aria-hidden":"true"},see={class:"sd-hint"},iee={class:"sd-hint"},ree={class:"sd-hint"},lee=200,aee=et({__name:"SearchSessionsDialog",props:{sessions:{},activeId:{}},emits:["select","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!0),r=Z(""),l=Z(null),a=Z(null),u=R(()=>{const S=r.value.trim().toLowerCase(),T=[];for(const A of o.sessions){const E=A.title??"",P=A.lastPrompt??"",D=A.workspaceName??"",I=S.length>0&&E.toLowerCase().includes(S),$=S.length>0&&P.toLowerCase().includes(S),B=S.length>0&&D.toLowerCase().includes(S);if(!(S.length>0&&!I&&!$&&!B)&&(T.push({session:A,inTitle:I,inWorkspace:B,snippetText:P?KJ(P,r.value):""}),T.length>=lee))break}return T}),c=Z(0);Je(r,()=>{c.value=0});function d(S){const T=u.value.length;return T===0?0:Math.max(0,Math.min(T-1,S))}async function f(){await yt(),a.value?.querySelector('[aria-selected="true"]')?.scrollIntoView({block:"nearest"})}function h(S){c.value=d(c.value+S),f()}function m(S){s("select",S),s("close")}function v(){r.value="",l.value?.focus()}function k(){const S=u.value[c.value];S&&m(S.session.id)}function w(){return l.value?.el??null}const{handleCompositionStart:b,handleCompositionEnd:_,isComposingKeyEvent:g}=Ar();function x(S){if(g(S)){S.key==="Escape"&&S.stopPropagation();return}S.key==="ArrowDown"?(S.preventDefault(),h(1)):S.key==="ArrowUp"?(S.preventDefault(),h(-1)):S.key==="Enter"&&(S.preventDefault(),k())}return dn(()=>{l.value?.focus()}),(S,T)=>(y(),he(p(ua),{open:i.value,"onUpdate:open":T[1]||(T[1]=A=>i.value=A),title:p(n)("sidebar.searchPlaceholder"),size:"lg",height:"fixed",padded:!1,"initial-focus":w,onClose:T[2]||(T[2]=A=>s("close"))},{default:me(()=>[C("div",KQ,[C("div",ZQ,[j(p(js),{ref_key:"inputRef",ref:l,modelValue:r.value,"onUpdate:modelValue":T[0]||(T[0]=A=>r.value=A),placeholder:p(n)("sidebar.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:x,onCompositionstart:p(b),onCompositionend:p(_)},null,8,["modelValue","placeholder","onCompositionstart","onCompositionend"]),j(p(pn),{text:p(n)("sidebar.searchClear")},{default:me(()=>[C("button",{type:"button",class:Re(["search-clear",{"is-on":r.value.length>0}]),tabindex:"-1","aria-label":p(n)("sidebar.searchClear"),onClick:v},[j(p(Te),{name:"close",size:"sm"})],10,GQ)]),_:1},8,["text"])]),C("div",{ref_key:"listRef",ref:a,class:"sd-list",role:"listbox"},[u.value.length>0?(y(!0),M(Pe,{key:0},pt(u.value,(A,E)=>(y(),M("button",{key:A.session.id,class:Re(["sd-row",{on:E===c.value,active:A.session.id===e.activeId}]),role:"option","aria-selected":E===c.value,onClick:P=>m(A.session.id),onMousemove:P=>c.value=E},[C("span",XQ,[j(p(Te),{class:"sd-folder",name:"folder-closed",size:"sm"}),C("span",{class:"sd-ws",innerHTML:p(f9)(A.session.workspaceName??A.session.workspaceId??"",A.inWorkspace?r.value:"")},null,8,JQ),C("span",QQ,N(A.session.time),1)]),C("span",{class:"sd-title",innerHTML:p(f9)(A.session.title,A.inTitle?r.value:"")},null,8,eee),A.snippetText?(y(),M("span",{key:0,class:"sd-snippet",innerHTML:p(f9)(A.snippetText,r.value)},null,8,tee)):ee("",!0)],42,YQ))),128)):(y(),M("div",nee,[j(p(SW),{title:r.value.trim()?p(n)("sidebar.searchNoResults"):p(n)("sidebar.searchEmpty")},{icon:me(()=>[j(p(Te),{name:"search",size:"lg"})]),_:1},8,["title"])]))],512),C("div",oee,[C("span",see,[j(p(oa),{keys:["↑","↓"]}),qe(N(p(n)("sidebar.searchHintSelect")),1)]),T[3]||(T[3]=C("span",{class:"sd-dot"},"·",-1)),C("span",iee,[j(p(oa),{keys:["Enter"]}),qe(N(p(n)("sidebar.searchHintOpen")),1)]),T[4]||(T[4]=C("span",{class:"sd-dot"},"·",-1)),C("span",ree,[j(p(oa),{keys:["Esc"]}),qe(N(p(n)("sidebar.searchHintClose")),1)])])])]),_:1},8,["open","title"]))}}),uee=ft(aee,[["__scopeId","data-v-d69c7a8c"]]);var cee=Object.create,Ly=Object.defineProperty,dee=Object.getOwnPropertyDescriptor,ME=Object.getOwnPropertyNames,fee=Object.getPrototypeOf,pee=Object.prototype.hasOwnProperty,TE=(e,t)=>function(){return t||(0,e[ME(e)[0]])((t={exports:{}}).exports,t),t.exports},EE=e=>{let t={};for(var n in e)Ly(t,n,{get:e[n],enumerable:!0});return t},hee=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(var s=ME(t),i=0,r=s.length,l;it[a]).bind(null,l),enumerable:!(o=dee(t,l))||o.enumerable});return e},IE=(e,t,n)=>(n=e!=null?cee(fee(e)):{},hee(Ly(n,"default",{value:e,enumerable:!0}),e));function mee(e,t,n,o){const s=Number(e[t].meta.id+1).toString();let i="";return typeof o.docId=="string"&&(i=`-${o.docId}-`),i+s}function gee(e,t){let n=Number(e[t].meta.id+1).toString();return e[t].meta.subId>0&&(n+=`:${e[t].meta.subId}`),`[${n}]`}function vee(e,t,n,o,s){const i=s.rules.footnote_anchor_name(e,t,n,o,s),r=s.rules.footnote_caption(e,t,n,o,s);let l=i;return e[t].meta.subId>0&&(l+=`:${e[t].meta.subId}`),`${r}`}function yee(e,t,n){return(n.xhtmlOut?`
+`:`
+`)+`
+
    +`}function kee(){return`
+
+`}function bee(e,t,n,o,s){let i=s.rules.footnote_anchor_name(e,t,n,o,s);return e[t].meta.subId>0&&(i+=`:${e[t].meta.subId}`),`
  • `}function Cee(){return`
  • +`}function wee(e,t,n,o,s){let i=s.rules.footnote_anchor_name(e,t,n,o,s);return e[t].meta.subId>0&&(i+=`:${e[t].meta.subId}`),` ↩︎`}function _ee(e){const t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=vee,e.renderer.rules.footnote_block_open=yee,e.renderer.rules.footnote_block_close=kee,e.renderer.rules.footnote_open=bee,e.renderer.rules.footnote_close=Cee,e.renderer.rules.footnote_anchor=wee,e.renderer.rules.footnote_caption=gee,e.renderer.rules.footnote_anchor_name=mee;function o(l,a,u,c){const d=l.bMarks[a]+l.tShift[a],f=l.eMarks[a];if(d+4>f||l.src.charCodeAt(d)!==91||l.src.charCodeAt(d+1)!==94)return!1;let h;for(h=d+2;h=f||l.src.charCodeAt(++h)!==58)return!1;if(c)return!0;h++,l.env.footnotes||(l.env.footnotes={}),l.env.footnotes.refs||(l.env.footnotes.refs={});const m=l.src.slice(d+2,h-2);l.env.footnotes.refs[`:${m}`]=-1;const v=new l.Token("footnote_reference_open","",1);v.meta={label:m},v.level=l.level++,l.tokens.push(v);const k=l.bMarks[a],w=l.tShift[a],b=l.sCount[a],_=l.parentType,g=h,x=l.sCount[a]+h-(l.bMarks[a]+l.tShift[a]);let S=x;for(;h=u||l.src.charCodeAt(c)!==94||l.src.charCodeAt(c+1)!==91)return!1;const d=c+2,f=t(l,c+1);if(f<0)return!1;if(!a){l.env.footnotes||(l.env.footnotes={}),l.env.footnotes.list||(l.env.footnotes.list=[]);const h=l.env.footnotes.list.length,m=[];l.md.inline.parse(l.src.slice(d,f),l.md,l.env,m);const v=l.push("footnote_ref","",0);v.meta={id:h},l.env.footnotes.list[h]={content:l.src.slice(d,f),tokens:m}}return l.pos=f+1,l.posMax=u,!0}function i(l,a){const u=l.posMax,c=l.pos;if(c+3>u||!l.env.footnotes||!l.env.footnotes.refs||l.src.charCodeAt(c)!==91||l.src.charCodeAt(c+1)!==94)return!1;let d;for(d=c+2;d=u)return!1;d++;const f=l.src.slice(c+2,d-1);if(typeof l.env.footnotes.refs[`:${f}`]>"u")return!1;if(!a){l.env.footnotes.list||(l.env.footnotes.list=[]);let h;l.env.footnotes.refs[`:${f}`]<0?(h=l.env.footnotes.list.length,l.env.footnotes.list[h]={label:f,count:0},l.env.footnotes.refs[`:${f}`]=h):h=l.env.footnotes.refs[`:${f}`];const m=l.env.footnotes.list[h].count;l.env.footnotes.list[h].count++;const v=l.push("footnote_ref","",0);v.meta={id:h,subId:m,label:f}}return l.pos=d,l.posMax=u,!0}function r(l){let a,u,c,d=!1;const f={};if(!l.env.footnotes||(l.tokens=l.tokens.filter(function(m){return m.type==="footnote_reference_open"?(d=!0,u=[],c=m.meta.label,!1):m.type==="footnote_reference_close"?(d=!1,f[":"+c]=u,!1):(d&&u.push(m),!d)}),!l.env.footnotes.list))return;const h=l.env.footnotes.list;l.tokens.push(new l.Token("footnote_block_open","",1));for(let m=0,v=h.length;m0?h[m].count:1;for(let _=0;_?@[\]^_`{|}~-])/g;function Mee(e,t){const n=e.posMax,o=e.pos;if(e.src.charCodeAt(o)!==126||t||o+2>=n)return!1;e.pos=o+1;let s=!1;for(;e.pos?@[\]^_`{|}~-])/g;function Iee(e,t){const n=e.posMax,o=e.pos;if(e.src.charCodeAt(o)!==94||t||o+2>=n)return!1;e.pos=o+1;let s=!1;for(;e.pos{t.exports=function(v,k){k=Object.assign({},{disabled:!0,divWrap:!1,divClass:"checkbox",idPrefix:"cbx_",ulClass:"task-list",liClass:"task-list-item"},k),v.core.ruler.after("inline","github-task-lists",function(w){for(var b=w.tokens,_=0,g=2;g=0;b--)if(v[b].level===w)return b;return-1}function s(v,k){return d(v[k])&&f(v[k-1])&&h(v[k-2])&&m(v[k])}function i(v,k,w,b){var _=w.idPrefix+k;v.children[0].content=v.children[0].content.slice(3),v.children.unshift(l(_,b)),v.children.push(a(b)),v.children.unshift(r(v,_,w,b)),w.divWrap&&(v.children.unshift(u(w,b)),v.children.push(c(b)))}function r(v,k,w,b){var _=new b("checkbox_input","input",0);return _.attrs=[["type","checkbox"],["id",k]],/^\[[xX]\][ \u00A0]/.test(v.content)===!0&&_.attrs.push(["checked","true"]),w.disabled===!0&&_.attrs.push(["disabled","true"]),_}function l(v,k){var w=new k("label_open","label",1);return w.attrs=[["for",v]],w}function a(v){return new v("label_close","label",-1)}function u(v,k){var w=new k("checkbox_open","div",0);return w.attrs=[["class",v.divClass]],w}function c(v){return new v("checkbox_close","div",-1)}function d(v){return v.type==="inline"}function f(v){return v.type==="paragraph_open"}function h(v){return v.type==="list_item_open"}function m(v){return/^\[[xX \u00A0]\][ \u00A0]/.test(v.content)}})}),Nee=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))),Fee=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(e=>e.charCodeAt(0))),m9;const Ree=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]]),Oee=(m9=String.fromCodePoint)!==null&&m9!==void 0?m9:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function Pee(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Ree.get(e))!==null&&t!==void 0?t:e}var Is;(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"})(Is||(Is={}));const Dee=32;var Ba;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Ba||(Ba={}));function I3(e){return e>=Is.ZERO&&e<=Is.NINE}function Bee(e){return e>=Is.UPPER_A&&e<=Is.UPPER_F||e>=Is.LOWER_A&&e<=Is.LOWER_F}function Hee(e){return e>=Is.UPPER_A&&e<=Is.UPPER_Z||e>=Is.LOWER_A&&e<=Is.LOWER_Z||I3(e)}function zee(e){return e===Is.EQUALS||Hee(e)}var Ms;(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"})(Ms||(Ms={}));var Ra;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Ra||(Ra={}));var Wee=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Ms.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Ra.Strict}startEntity(e){this.decodeMode=e,this.state=Ms.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Ms.EntityStart:return e.charCodeAt(t)===Is.NUM?(this.state=Ms.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Ms.NamedEntity,this.stateNamedEntity(e,t));case Ms.NumericStart:return this.stateNumericStart(e,t);case Ms.NumericDecimal:return this.stateNumericDecimal(e,t);case Ms.NumericHex:return this.stateNumericHex(e,t);case Ms.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Dee)===Is.LOWER_X?(this.state=Ms.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Ms.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,o){if(t!==n){const s=n-t;this.result=this.result*Math.pow(o,s)+parseInt(e.substr(t,s),o),this.consumed+=s}}stateNumericHex(e,t){const n=t;for(;t>14;for(;t>14,s!==0){if(i===Is.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Ra.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:t,decodeTree:n}=this,o=(n[t]&Ba.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,o,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){const{decodeTree:o}=this;return this.emitCodePoint(t===1?o[e]&~Ba.VALUE_LENGTH:o[e+1],n),t===3&&this.emitCodePoint(o[e+2],n),n}end(){var e;switch(this.state){case Ms.NamedEntity:return this.result!==0&&(this.decodeMode!==Ra.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ms.NumericDecimal:return this.emitNumericEntity(0,2);case Ms.NumericHex:return this.emitNumericEntity(0,3);case Ms.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ms.EntityStart:return 0}}};function LE(e){let t="";const n=new Wee(e,o=>t+=Oee(o));return function(s,i){let r=0,l=0;for(;(l=s.indexOf("&",l))>=0;){t+=s.slice(r,l),n.startEntity(i);const u=n.write(s,l+1);if(u<0){r=l+n.end();break}r=l+u,l=u===0?r+1:r}const a=t+s.slice(r);return t="",a}}function Uee(e,t,n,o){const s=(t&Ba.BRANCH_LENGTH)>>7,i=t&Ba.JUMP_TABLE;if(s===0)return i!==0&&o===i?n:-1;if(i){const a=o-i;return a<0||a>=s?-1:e[n+a]-1}let r=n,l=r+s-1;for(;r<=l;){const a=r+l>>>1,u=e[a];if(uo)l=a-1;else return e[a+s]}return-1}const jee=LE(Nee);LE(Fee);function $y(e,t=Ra.Legacy){return jee(e,t)}var Vee=IE($ee());const rC={};function qee(e){let t=rC[e];if(t)return t;t=rC[e]=[];for(let n=0;n<128;n++){const o=String.fromCharCode(n);t.push(o)}for(let n=0;n=55296&&c<=57343?s+="���":s+=String.fromCharCode(c),i+=6;continue}}if((l&248)===240&&i+91114111?s+="����":(d-=65536,s+=String.fromCharCode(55296+(d>>10),56320+(d&1023))),i+=9;continue}}s+="�"}return s})}m2.defaultChars=";/?:@&=+$,#";m2.componentChars="";var L3=m2;const lC={};function Kee(e){let t=lC[e];if(t)return t;t=lC[e]=[];for(let n=0;n<128;n++){const o=String.fromCharCode(n);/^[0-9a-z]$/i.test(o)?t.push(o):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n"u"&&(n=!0);const o=Kee(t);let s="";for(let i=0,r=e.length;i=55296&&l<=57343){if(l>=55296&&l<=56319&&i+1=56320&&a<=57343){s+=encodeURIComponent(e[i]+e[i+1]),i++;continue}}s+="%EF%BF%BD";continue}s+=encodeURIComponent(e[i])}return s}g2.defaultChars=";/?:@&=+$,-_.!~*'()#";g2.componentChars="-_.!~*'()";var $E=g2;function Ny(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Hm(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Zee=/^([a-z0-9.+-]+:)/i,Gee=/:[0-9]*$/,Yee=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Xee=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` +`," "]),Jee=["'"].concat(Xee),aC=["%","/","?",";","#"].concat(Jee),uC=["/","?","#"],Qee=255,cC=/^[+a-z0-9A-Z_-]{0,63}$/,ete=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,dC={javascript:!0,"javascript:":!0},fC={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function tte(e,t){if(e&&e instanceof Hm)return e;const n=new Hm;return n.parse(e,t),n}Hm.prototype.parse=function(e,t){let n,o,s,i=e;if(i=i.trim(),!t&&e.split("#").length===1){const u=Yee.exec(i);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let r=Zee.exec(i);if(r&&(r=r[0],n=r.toLowerCase(),this.protocol=r,i=i.substr(r.length)),(t||r||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(s=i.substr(0,2)==="//",s&&!(r&&dC[r])&&(i=i.substr(2),this.slashes=!0)),!dC[r]&&(s||r&&!fC[r])){let u=-1;for(let m=0;m127?b+="x":b+=w[_];if(!b.match(cC)){const _=m.slice(0,v),g=m.slice(v+1),x=w.match(ete);x&&(_.push(x[1]),g.unshift(x[2])),g.length&&(i=g.join(".")+i),this.hostname=_.join(".");break}}}}this.hostname.length>Qee&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const l=i.indexOf("#");l!==-1&&(this.hash=i.substr(l),i=i.slice(0,l));const a=i.indexOf("?");return a!==-1&&(this.search=i.substr(a),i=i.slice(0,a)),i&&(this.pathname=i),fC[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Hm.prototype.parseHost=function(e){let t=Gee.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Fy=tte,NE=EE({decode:()=>L3,encode:()=>$E,format:()=>Ny,parse:()=>Fy}),FE=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,RE=/[\0-\x1F\x7F-\x9F]/,nte=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,OE=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,ote=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,PE=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,ste=EE({Any:()=>FE,Cc:()=>RE,Cf:()=>nte,P:()=>OE,S:()=>ote,Z:()=>PE}),ite=Object.defineProperty,DE=e=>{let t={};for(var n in e)ite(t,n,{get:e[n],enumerable:!0});return t},ws=class{type;tag;attrs;map;nesting;level;children;content;markup;info;meta;block;hidden;constructor(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,o=t.length;n=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},rte=DE({arrayReplaceAt:()=>pte,assign:()=>dte,countLines:()=>Wo,escapeHtml:()=>wte,escapeRE:()=>xte,fromCodePoint:()=>wp,has:()=>cte,isMdAsciiPunct:()=>Um,isPunctChar:()=>Wm,isPunctCode:()=>$3,isSpace:()=>fte,isString:()=>ate,isValidEntityCode:()=>y2,isWhiteSpace:()=>Cp,lib:()=>Ste,mdurl:()=>NE,normalizeReference:()=>v2,ucmicro:()=>zm,unescapeAll:()=>_p,unescapeMd:()=>vte});const zm=ste;function lte(e){return Object.prototype.toString.call(e)}function ate(e){return lte(e)==="[object String]"}const ute=Object.prototype.hasOwnProperty;function cte(e,t){return ute.call(e,t)}function dte(e,...t){return t.forEach(n=>{if(n){if(typeof n!="object")throw new TypeError(`${String(n)}must be object`);Object.keys(n).forEach(o=>{e[o]=n[o]})}}),e}function fte(e){return e===9||e===32}function Cp(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Wm(e){return zm.P.test(e)||zm.S.test(e)}const pC=new Map;function $3(e){if(Um(e))return!0;if(e>=0&&e<128)return!1;const t=pC.get(e);if(t!==void 0)return t;const n=Wm(String.fromCharCode(e));return pC.set(e,n),n}function Um(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function v2(e){return e=e.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}function pte(e,t,n){return[...e.slice(0,t),...n,...e.slice(t+1)]}function y2(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function wp(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}const BE=/\\([!"#$%&'()*+,\-\./:;<=>?@[\\\]^_`{|}~])/g,hte=new RegExp(`${BE.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),mte=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function gte(e,t){if(t.charCodeAt(0)===35&&mte.test(t)){const o=t[1].toLowerCase()==="x"?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return y2(o)?wp(o):e}const n=$y(e);return n!==e?n:e}function vte(e){return e.includes("\\")?e.replace(BE,"$1"):e}function _p(e){return!e.includes("\\")&&!e.includes("&")?e:e.replace(hte,(t,n,o)=>n||gte(t,o))}const yte=/[&<>"]/,kte=/[&<>"]/g,bte={"&":"&","<":"<",">":">",'"':"""};function Cte(e){return bte[e]}function wte(e){return yte.test(e)?e.replace(kte,Cte):e}const _te=/[.?*+^$[\]\\(){}|-]/g;function xte(e){return e.replace(_te,"\\$&")}const Ste={mdurl:NE,ucmicro:zm};function Wo(e){if(e.length===0)return 0;let t=0,n=-1;for(;(n=e.indexOf(` +`,n+1))!==-1;)t++;return t}const Ate=/(?:^|\n)[ \t]{0,3}\[\^[^\]\n]+\]:/m,Mte=/(?:^|\n)[ \t]{0,3}\*\[[^\]\n]+\]:/m,Tte=/(?:^|\n)[ \t]{0,3}\[(?!\^)(?:\\[\s\S]|[^\]\\[])+\][ \t]*:/m,Ry=["references","footnotes","abbreviations","abbr","abbrs"],Oy=Symbol.for("markdown-it-ts.global-state"),Py=Object.prototype.hasOwnProperty;function hC(e){return e==="reference-definition"||e==="footnote-definition"||e==="abbreviation-definition"}function Wr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ja(e){if(Array.isArray(e))return e.map(t=>ja(t));if(Wr(e)){const t={};for(const n of Object.keys(e))t[n]=ja(e[n]);return t}return e}function jm(e){return Array.isArray(e)?e.map((t,n)=>String(n)):Wr(e)?Object.keys(e):[]}function N3(e,t){if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;ni.has(r)?!N3(s[r],HE(o.value,r)):!0)}}function la(e){const t=Dy(e);if(t){for(const n of Ry){const o=t.snapshot[n];if(!o){delete e[n];continue}if(o.ownedKeys){Ite(e,n,o);continue}o.existed?e[n]=Ete(e[n],o.value):delete e[n]}delete e[Oy]}}function g9(e){return{area:e,attempted:!0,matched:!1,attemptMs:0,blocks:0,headings:0,paragraphs:0,lists:0,fences:0,paragraphCacheHits:0,paragraphCacheMisses:0,paragraphCacheBypasses:0,listCacheHits:0,listCacheMisses:0,fenceCacheHits:0,fenceCacheMisses:0}}const F3=Symbol.for("markdown-it-ts.diagnostics");function qp(e,t){if(e)try{const n=e[F3];if(n&&typeof n=="object")return n;if(!t)return;const o={};return e[F3]=o,o}catch{return}}function Vl(e){return qp(e,!1)}function $te(e){if(e)try{const t=e[F3];t&&typeof t=="object"&&(delete t.strategy,delete t.chunk,delete t.unbounded,delete t.editable,delete t.stockFast)}catch{}}function vi(e){$te(e)}function tf(e,t){const n=qp(e,!0);n&&(n.stockFast=t)}function ss(e,t){const n=qp(e,!0);n&&(n.strategy=t)}function v9(e,t){const n=qp(e,!0);n&&(n.chunk=t)}function zE(e,t){const n=qp(e,!0);n&&(n.unbounded=t)}function Nte(e){const t={};e=e||{},t.src_Any=FE.source,t.src_Cc=RE.source,t.src_Z=PE.source,t.src_P=OE.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");const n="[><|]";return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain="(?:"+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy="(?:"+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function R3(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function k2(e){return Object.prototype.toString.call(e)}function Fte(e){return k2(e)==="[object String]"}function Rte(e){return k2(e)==="[object Object]"}function Ote(e){return k2(e)==="[object RegExp]"}function mC(e){return k2(e)==="[object Function]"}function Pte(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const WE={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Dte(e){return Object.keys(e||{}).reduce(function(t,n){return t||WE.hasOwnProperty(n)},!1)}const Bte={"http:":{validate:function(e,t,n){const o=e.slice(t);return n.re.http||(n.re.http=new RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,"i")),n.re.http.test(o)?o.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const o=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(o)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const o=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,"i")),n.re.mailto.test(o)?o.match(n.re.mailto)[0].length:0}}},Hte="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",zte="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function Wte(e){return function(t,n){const o=t.slice(n);return e.test(o)?o.match(e)[0].length:0}}function gC(){return function(e,t){t.normalize(e)}}function Vm(e){const t=e.re=Nte(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(Hte),n.push(t.src_xn),t.src_tlds=n.join("|");function o(l){return l.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(o(t.tpl_email_fuzzy),"i"),t.email_fuzzy_global=RegExp(o(t.tpl_email_fuzzy),"ig"),t.link_fuzzy=RegExp(o(t.tpl_link_fuzzy),"i"),t.link_fuzzy_global=RegExp(o(t.tpl_link_fuzzy),"ig"),t.link_no_ip_fuzzy=RegExp(o(t.tpl_link_no_ip_fuzzy),"i"),t.link_no_ip_fuzzy_global=RegExp(o(t.tpl_link_no_ip_fuzzy),"ig"),t.host_fuzzy_test=RegExp(o(t.tpl_host_fuzzy_test),"i");const s=[];e.__compiled__={};function i(l,a){throw new Error(`(LinkifyIt) Invalid schema "${l}": ${a}`)}Object.keys(e.__schemas__).forEach(function(l){const a=e.__schemas__[l];if(a===null)return;const u={validate:null,link:null};if(e.__compiled__[l]=u,Rte(a)){Ote(a.validate)?u.validate=Wte(a.validate):mC(a.validate)?u.validate=a.validate:i(l,a),mC(a.normalize)?u.normalize=a.normalize:a.normalize?i(l,a):u.normalize=gC();return}if(Fte(a)){s.push(l);return}i(l,a)}),s.forEach(function(l){e.__compiled__[e.__schemas__[l]]&&(e.__compiled__[l].validate=e.__compiled__[e.__schemas__[l]].validate,e.__compiled__[l].normalize=e.__compiled__[e.__schemas__[l]].normalize)}),e.__compiled__[""]={validate:null,normalize:gC()};const r=Object.keys(e.__compiled__).filter(function(l){return l.length>0&&e.__compiled__[l]}).map(Pte).join("|");e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${r})`,"i"),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${r})`,"ig"),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,"i"),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,"i")}function UE(e,t,n,o){const s=e.slice(n,o);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=o,this.raw=s,this.text=s,this.url=s}function cr(e,t){if(!(this instanceof cr))return new cr(e,t);t||Dte(e)&&(t=e,e={}),this.__opts__=R3({},WE,t),this.__schemas__=R3({},Bte,e),this.__compiled__={},this.__tlds__=zte,this.__tlds_replaced__=!1,this.re={},Vm(this)}cr.prototype.add=function(t,n){return this.__schemas__[t]=n,Vm(this),this};cr.prototype.set=function(t){return this.__opts__=R3(this.__opts__,t),this};cr.prototype.test=function(t){if(!t.length)return!1;let n,o;if(this.re.schema_test.test(t)){for(o=this.re.schema_search,o.lastIndex=0;(n=o.exec(t))!==null;)if(this.testSchemaAt(t,n[2],o.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&t.search(this.re.host_fuzzy_test)>=0&&t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&t.indexOf("@")>=0&&t.match(this.re.email_fuzzy)!==null)};cr.prototype.pretest=function(t){return this.re.pretest.test(t)};cr.prototype.testSchemaAt=function(t,n,o){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,o,this):0};cr.prototype.match=function(t){const n=[],o=[],s=[],i=[];let r,l,a;function u(f,h){return f?h?f.index!==h.index?f.index=h.lastIndex?f:h:f:h}if(!t.length)return null;if(this.re.schema_test.test(t))for(a=this.re.schema_search,a.lastIndex=0;(r=a.exec(t))!==null;)l=this.testSchemaAt(t,r[2],a.lastIndex),l&&o.push({schema:r[2],index:r.index+r[1].length,lastIndex:r.index+r[0].length+l});if(this.__opts__.fuzzyLink&&this.__compiled__["http:"])for(a=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,a.lastIndex=0;(r=a.exec(t))!==null;)s.push({schema:"",index:r.index+r[1].length,lastIndex:r.index+r[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"])for(a=this.re.email_fuzzy_global,a.lastIndex=0;(r=a.exec(t))!==null;)i.push({schema:"mailto:",index:r.index+r[1].length,lastIndex:r.index+r[0].length});const c=[0,0,0];let d=0;for(;;){const f=[o[c[0]],i[c[1]],s[c[2]]],h=u(u(f[0],f[1]),f[2]);if(!h)break;if(h===f[0]?c[0]++:h===f[1]?c[1]++:c[2]++,h.index{const d=/^xn--/,f=/[^\0-\x7F]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,m={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},v=35,k=Math.floor,w=String.fromCharCode;function b(H){throw new RangeError(m[H])}function _(H,O){const F=[];let U=H.length;for(;U--;)F[U]=O(H[U]);return F}function g(H,O){const F=H.split("@");let U="";F.length>1&&(U=F[0]+"@",H=F[1]),H=H.replace(h,".");const z=_(H.split("."),O).join(".");return U+z}function x(H){const O=[];let F=0;const U=H.length;for(;F=55296&&z<=56319&&FString.fromCodePoint(...H),T=function(H){return H>=48&&H<58?26+(H-48):H>=65&&H<91?H-65:H>=97&&H<123?H-97:36},A=function(H,O){return H+22+75*(H<26)-((O!=0)<<5)},E=function(H,O,F){let U=0;for(H=F?k(H/700):H>>1,H+=k(H/O);H>v*26>>1;U+=36)H=k(H/v);return k(U+(v+1)*H/(H+38))},P=function(H){const O=[],F=H.length;let U=0,z=128,W=72,K=H.lastIndexOf("-");K<0&&(K=0);for(let V=0;V=128&&b("not-basic"),O.push(H.charCodeAt(V));for(let V=K>0?K+1:0;V=F&&b("invalid-input");const Ie=T(H.charCodeAt(V++));Ie>=36&&b("invalid-input"),Ie>k((2147483647-U)/X)&&b("overflow"),U+=Ie*X;const de=le<=W?1:le>=W+26?26:le-W;if(Iek(2147483647/pe)&&b("overflow"),X*=pe}const ne=O.length+1;W=E(U-ie,ne,ie==0),k(U/ne)>2147483647-z&&b("overflow"),z+=k(U/ne),U%=ne,O.splice(U++,0,z)}return String.fromCodePoint(...O)},D=function(H){const O=[];H=x(H);const F=H.length;let U=128,z=0,W=72;for(const ie of H)ie<128&&O.push(w(ie));const K=O.length;let V=K;for(K&&O.push("-");V=U&&Xk((2147483647-z)/ne)&&b("overflow"),z+=(ie-U)*ne,U=ie;for(const X of H)if(X2147483647&&b("overflow"),X===U){let le=z;for(let Ie=36;;Ie+=36){const de=Ie<=W?1:Ie>=W+26?26:Ie-W;if(le32))return i;if(o===41){if(r===0)break;r--}s++}return t===s||r!==0||(i.str=_p(e.slice(t,s)),i.pos=s,i.ok=!0),i}var qE=zy;const Uh=-2;function jte(e,t,n,o){let s=1,i=t+1;for(;i=0&&t+1>=c)return-1;const d=l.indexOf("]",t+1);if(d<0||d>=a)return e.linkLabelNoCloseFrom=t+1,-1;const f=jte(l,t,a,n);if(f!==Uh)return f;for(e.pos=t+1;e.pos=n)return r;let l=e.charCodeAt(i);if(l!==34&&l!==39&&l!==40)return r;t++,i++,l===40&&(l=41),r.marker=l}for(;i=0?e.attrs[n][1]:null}function Kte(e,t,n){const o=b2(e,t);o<0?jy(e,[t,n]):e.attrs[o][1]=`${e.attrs[o][1]} ${n}`}var Zte=DE({attrGet:()=>qte,attrIndex:()=>b2,attrJoin:()=>Kte,attrPush:()=>jy,attrSet:()=>Vte,parseLinkDestination:()=>zy,parseLinkLabel:()=>Wy,parseLinkTitle:()=>Uy});function Gte(e){return e.includes("\r")||e.includes("\0")}function ZE(e){return typeof e=="string"?e:e.toString()}function Yte(e){if(e.inlineMode){const t=new ws("inline","",0);t.content=ZE(e.src),t.map=[0,1],t.children=[],t.level=0,e.tokens.push(t)}else e.md&&e.md.block&&e.md.block.parse(e.src,e.md,e.env,e.tokens)}const Xte=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,Jte=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Qte(e,t){let n=e.pos;const o=e.src;if(o.charCodeAt(n)!==60)return!1;const s=n,i=e.posMax;for(;;){if(++n>=i)return!1;const l=o.charCodeAt(n);if(l===60)return!1;if(l===62)break}const r=o.slice(s+1,n);if(Jte.test(r)){const l=e.md.normalizeLink(r);if(!e.md.validateLink(l))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",l]],a.markup="autolink",a.info="auto";const u=e.push("text","",0);u.content=e.md.normalizeLinkText(r);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=r.length+2,!0}if(Xte.test(r)){const l=e.md.normalizeLink(`mailto:${r}`);if(!e.md.validateLink(l))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",l]],a.markup="autolink",a.info="auto";const u=e.push("text","",0);u.content=e.md.normalizeLinkText(r);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=r.length+2,!0}return!1}var GE=Qte;function ene(e,t){const n=e.src;let o=e.pos;if(n.charCodeAt(o)!==96)return!1;const s=o;o++;const i=e.posMax;for(;o2&&f.charCodeAt(0)===32&&f.charCodeAt(f.length-1)===32&&(f=f.slice(1,-1)),d.content=f}return e.pos=a,!0}e.backticks[c]=u}return e.backticksScanned=!0,t||(e.pending+=r),e.pos+=l,!0}var YE=ene;function vC(e){const t={},n=e.length;if(!n)return;let o=0,s=-2;const i=[];for(let r=0;ra;u-=i[u]+1){const d=e[u];if(d.marker===l.marker&&d.open&&d.end<0){let f=!1;if((d.close||l.open)&&(d.length+l.length)%3===0&&(d.length%3!==0||l.length%3!==0)&&(f=!0),!f){const h=u>0&&!e[u-1].open?i[u-1]+1:0;i[r]=r-u+h,i[u]=h,l.open=!1,d.end=r,d.close=!1,c=-1,s=-2;break}}}c!==-1&&(t[l.marker][(l.open?3:0)+(l.length||0)%3]=c)}}function tne(e){const t=e.tokens_meta,n=e.tokens_meta.length;vC(e.delimiters);for(let o=0;o=0;s--){const i=t[s],r=i.marker;if(r!==95&&r!==42||i.end===-1)continue;const l=t[i.end],a=i.token,u=l.token,c=s>0&&t[s-1].end===i.end+1&&t[s-1].marker===r&&t[s-1].token===a-1&&t[i.end+1].token===u+1,d=r===42?XE:JE,f=o[a];c?(f.type="strong_open",f.tag="strong",f.nesting=1,f.markup=d+d,f.content=""):(f.type="em_open",f.tag="em",f.nesting=1,f.markup=d,f.content="");const h=o[u];c?(h.type="strong_close",h.tag="strong",h.nesting=-1,h.markup=d+d,h.content=""):(h.type="em_close",h.tag="em",h.nesting=-1,h.markup=d,h.content=""),c&&(o[t[s-1].token].content="",o[t[i.end+1].token].content="",s--)}}function sne(e){const t=e.tokens_meta,n=e.tokens_meta.length;yC(e,e.delimiters);for(let o=0;o=48&&e<=57}function ine(e){const t=e|32;return Vy(e)||t>=97&&t<=102}function eI(e){const t=e|32;return t>=97&&t<=122}function rne(e){return eI(e)||Vy(e)}function lne(e,t,n){let o=t+2;if(o>=n)return null;let s=!1,i=7,r=o;for((e.charCodeAt(o)|32)===120&&(s=!0,i=6,o++,r=o);o=n||e.charCodeAt(o)!==59?null:e.slice(t,o+1)}function ane(e,t,n){let o=t+1;if(o>=n||!eI(e.charCodeAt(o)))return null;for(o++;o=n||e.charCodeAt(o)!==59)return null;const s=e.slice(t,o+1);return QE(s)!==s?s:null}function une(e,t){const n=e.pos,o=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=o)return!1;if(e.src.charCodeAt(n+1)===35){const s=lne(e.src,n,o);if(s){if(!t){const i=(s.charCodeAt(2)|32)===120?Number.parseInt(s.slice(3,-1),16):Number.parseInt(s.slice(2,-1),10),r=e.push("text_special","",0);r.content=y2(i)?wp(i):wp(65533),r.markup=s,r.info="entity"}return e.pos+=s.length,!0}}else{const s=ane(e.src,n,o);if(s){const i=QE(s);if(!t){const r=e.push("text_special","",0);r.content=i,r.markup=s,r.info="entity"}return e.pos+=s.length,!0}}return!1}var tI=une;const nI=(()=>{const e=new Array(256).fill(0),t="\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-";for(let n=0;n<32;n++)e[t.charCodeAt(n)]=1;return e})(),P3=new Array(128),oI=new Array(128);for(let e=0;e<128;e++){const t=String.fromCharCode(e);P3[e]=`\\${t}`,oI[e]=nI[e]?t:P3[e]}function kC(e,t,n){e.pending&&e.pushPending();const o=new ws("text_special","",0);o.level=e.level,o.content=t,o.markup=n,o.info="escape",e.pendingLevel=e.level,e.tokens.push(o),e.tokens_meta.push(null)}function cne(e,t){let n=e.pos;const o=e.posMax,s=e.src;if(s.charCodeAt(n)!==92||(n++,n>=o))return!1;let i=s.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&a<=57343&&n++}return e.pos=n+1,!0}let r=s.charAt(n);if(i>=55296&&i<=56319&&n+1=56320&&a<=57343&&(r+=s.charAt(n+1),n++)}const l=`\\${r}`;return kC(e,i<256&&nI[i]?r:l,l),e.pos=n+1,!0}var sI=cne;function dne(e){let t,n,o=0;const s=e.tokens,i=e.tokens.length;for(t=n=0;t0&&o++,r.type==="text"&&t+1\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,rI="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",pne=new RegExp(`^(?:${iI}|${rI}||<\\?[\\s\\S]*?\\?>|]*>|)`),hne=new RegExp(`^(?:${iI}|${rI})`);function lI(e){return e===32||e===9||e===10||e===12||e===13}function mne(e){if(e.length<3||e.charCodeAt(0)!==60||(e.charCodeAt(1)|32)!==97)return!1;const t=e.charCodeAt(2);return t===62||lI(t)}function gne(e){if(e.length<4||e.charCodeAt(0)!==60||e.charCodeAt(1)!==47||(e.charCodeAt(2)|32)!==97)return!1;for(let t=3;t=97&&t<=122}function yne(e,t){if(!e.md.options.html)return!1;const n=e.posMax,o=e.pos,s=e.src;if(s.charCodeAt(o)!==60||o+2>=n)return!1;const i=s.charCodeAt(o+1);if(i!==33&&i!==63&&i!==47&&!vne(i))return!1;const r=s.slice(o).match(pne);if(!r)return!1;const l=r[0];if(!t){const a=e.pushSimple("html_inline","");a.content=l,mne(l)&&e.linkLevel++,gne(l)&&e.linkLevel--}return e.pos+=l.length,!0}var aI=yne;function kne(e,t){let n,o,s,i,r,l,a,u,c="";const d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const h=e.pos+2,m=qm(e,e.pos+1,!1);if(m<0)return!1;if(i=m+1,i=f)return!1;if(l=qE(e.src,i,e.posMax),l.ok){for(c=e.md.normalizeLink(l.str),e.md.validateLink(c)?i=l.pos:c="",u=i;i=f||e.src.charCodeAt(i)!==41)return e.pos=d,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i=0?s=e.src.slice(u,i++):i=m+1):i=m+1,s||(s=e.src.slice(h,m)),r=e.env.references[v2(s)],!r)return e.pos=d,!1;c=r.href,a=r.title}if(!t){o=e.src.slice(h,m);const v=[];e.md.inline.parse(o,e.md,e.env,v);const k=e.push("image","img",0);k.attrs=[["src",c],["alt",""]],k.children=v,k.content=o,a&&k.attrs.push(["title",a])}return e.pos=i,e.posMax=f,!0}var uI=kne;function y9(e,t,n){for(;t"u")return!1;let d;if(l=r+1,l=0?(d=n.slice(h,m),d||(d=n.slice(i,r)),l=m+1):d=n.slice(i,r)}else d=n.slice(i,r);const f=e.env.references[v2(d)];if(!f)return e.pos=o,!1;a=f.href,u=f.title}if(!t){e.pos=i,e.posMax=r;const d=e.push("link_open","a",1);d.attrs=u?[["href",a],["title",u]]:[["href",a]],e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=l,e.posMax=s,!0}var cI=bne;function dI(e){const t=e|32;return t>=97&&t<=122}function Cne(e){return e>=48&&e<=57}function wne(e){return dI(e)||Cne(e)||e===43||e===45||e===46}function _ne(e){if(e.length===0)return null;let t=e.length-1;for(;t>=0&&wne(e.charCodeAt(t));)t--;return t++,t>=e.length||!dI(e.charCodeAt(t))?null:e.slice(t)}function xne(e,t,n){let o=t;for(;o0)return!1;const n=e.pos,o=e.posMax;if(n+3>o||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const s=_ne(e.pending);if(!s)return!1;const i=xne(e.src,n-s.length,o),r=e.md.linkify.matchAtStart(i);if(!r)return!1;let l=r.url;if(l.length<=s.length)return!1;let a=l.length;for(;a>0&&l.charCodeAt(a-1)===42;)a--;a!==l.length&&(l=l.slice(0,a));const u=e.md.normalizeLink(l);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const c=e.push("link_open","a",1);c.attrs=[["href",u]],c.markup="linkify",c.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(l);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=l.length-s.length,!0}function Sne(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const o=e.pending.length-1,s=e.posMax;if(!t)if(o>=0&&e.pending.charCodeAt(o)===32)if(o>=1&&e.pending.charCodeAt(o-1)===32){let i=o-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.pushSimple("hardbreak","br")}else e.pending=e.pending.slice(0,-1),e.pushSimple("softbreak","br");else e.pushSimple("softbreak","br");for(n++;n=s||CC(n.charCodeAt(o)))return!1;let i=o+1;for(;io-s),n=Math.floor(t.length/2);return t.length%2===0?(t[n-1]+t[n])/2:t[n]}function Ine(e,t){return{chain:e,name:t,calls:0,hits:0,inclusiveMs:0,medianMs:0,maxMs:0,normalCalls:0,normalHits:0,silentCalls:0,silentHits:0,samples:[]}}function mI(e){const t=e;if(!t)return null;if(t.__mdtsRuleProfile)return t.__mdtsRuleProfile;if(!t.__mdtsProfileRules)return null;const n=t.__mdtsProfileRules===!0?{}:t.__mdtsProfileRules,o={enabled:!0,fixture:n.fixture,mode:n.mode,startedAt:qy(),records:Object.create(null)};return t.__mdtsRuleProfile=o,o}function zd(e,t,n,o,s,i){const r=mI(e);if(!r)return;const l=`${t}:${n}`,a=r.records[l]??(r.records[l]=Ine(t,n));a.calls++,a.inclusiveMs+=o,o>a.maxMs&&(a.maxMs=o),a.samples.push(o),i?(a.silentCalls++,s&&a.silentHits++):(a.normalCalls++,s&&a.normalHits++),s&&a.hits++,r.completedAt=qy()}function Lne(e){const t=mI(e);if(!t)return null;const n=Object.keys(t.records);for(let o=0;os.name===e);o>=0&&this.rules.splice(o,1),this.rules.push({name:e,fn:t,alt:n?.alt||[],enabled:!0}),this.invalidateCache()}at(e,t,n){const o=this.rules.findIndex(s=>s.name===e);if(t===void 0){if(o<0)return;const s=this.rules[o];return Object.freeze({name:s.name,fn:s.fn,alt:s.alt?Object.freeze(s.alt.slice()):void 0,enabled:s.enabled})}if(o<0)throw new Error(`Parser rule not found: ${e}`);this.rules[o].fn=t,n?.alt!==void 0&&(this.rules[o].alt=n.alt),this.invalidateCache()}before(e,t,n,o){const s=this.rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this.rules.findIndex(r=>r.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(s,0,{name:t,fn:n,alt:o?.alt||[],enabled:!0}),this.invalidateCache()}after(e,t,n,o){const s=this.rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this.rules.findIndex(r=>r.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(s+1,0,{name:t,fn:n,alt:o?.alt||[],enabled:!0}),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled||(this.rules[r].enabled=!0,s=!0)}return s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled&&(this.rules[r].enabled=!1,s=!0)}return s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this.rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}getRules(e){const t=e||"";return this.cache||this.compileCache(),this.cache.get(t)??[]}getNamedRules(e){const t=e||"";return this.namedCache||this.compileCache(),this.namedCache.get(t)??[]}compileCache(){const e=new Set([""]);for(const o of this.rules)if(o.enabled&&o.alt)for(const s of o.alt)e.add(s);const t=new Map,n=new Map;for(const o of e){const s=[],i=[];for(const r of this.rules)r.enabled&&(o!==""&&!r.alt?.includes(o)||(s.push(r.fn),i.push({name:r.name,fn:r.fn})));t.set(o,s),n.set(o,i)}this.cache=t,this.namedCache=n}},gI=class{src;md;env;tokens;tokens_meta;pos;posMax;level;pending;pendingLevel;cache;delimiters;_prev_delimiters;backticks;backticksScanned;linkLevel;linkLabelNoCloseFrom;maxNesting;constructor(e,t,n,o){this.src=e,this.md=t,this.env=n,this.tokens=o,this.tokens_meta=new Array(o.length),this.pos=0,this.posMax=e.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0,this.linkLabelNoCloseFrom=-1,this.maxNesting=t.options.maxNesting}pushPending(){const e=new ws("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}pushSimple(e,t){this.pending&&this.pushPending();const n=new ws(e,t,0);return n.level=this.level,this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(null),n}push(e,t,n){if(this.pending&&this.pushPending(),n===0)return this.pushSimple(e,t);const o=new ws(e,t,n);let s=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),o.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(o),this.tokens_meta.push(s),o}scanDelims(e,t){const{src:n,posMax:o}=this,s=n.charCodeAt(e);let i=e;for(;i0?n.charCodeAt(e-1):32,a=i@[\]\\^_`{}~]/;function _C(e,t){switch(e.src.charCodeAt(e.pos)){case 10:return pI(e,t);case 33:return uI(e,t);case 38:return tI(e,t);case 42:case 95:return O3.tokenize(e,t);case 58:return e.md.options.linkify&&fI(e,t);case 60:return GE(e,t)||aI(e,t);case 91:return cI(e,t);case 92:return sI(e,t);case 96:return YE(e,t);case 126:return D3.tokenize(e,t);default:return hI(e,t)}}function vI(e){return!$ne.test(e)}var Nne=class{ruler;ruler2;cachedRulesVersion=-1;cachedRules=[];cachedRules2Version=-1;cachedRules2=[];defaultRulerVersion;defaultRuler2Version;constructor(){this.ruler=new wC,this.ruler2=new wC,this.ruler.push("text",hI),this.ruler.push("linkify",fI),this.ruler.push("newline",pI),this.ruler.push("escape",sI),this.ruler.push("backticks",YE),this.ruler.push("strikethrough",D3.tokenize),this.ruler.push("emphasis",O3.tokenize),this.ruler.push("link",cI),this.ruler.push("image",uI),this.ruler.push("autolink",GE),this.ruler.push("html_inline",aI),this.ruler.push("entity",tI),this.ruler2.push("balance_pairs",nne),this.ruler2.push("strikethrough",D3.postProcess),this.ruler2.push("emphasis",O3.postProcess),this.ruler2.push("fragments_join",fne),this.defaultRulerVersion=this.ruler.version,this.defaultRuler2Version=this.ruler2.version}skipToken(e){const t=e.pos,n=this.getRules(),o=n.length,s=e.cache,i=s[t],r=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(e.env,"__mdtsProfileRules"));if(i!==void 0){e.pos=i;return}let l=!1;if(e.level=e.pos)throw new Error("inline rule didn't increment state.pos");break}}}else if(this.isDefaultRuleset()){if(e.level++,l=_C(e,!0),e.level--,l&&t>=e.pos)throw new Error("inline rule didn't increment state.pos")}else for(let a=0;a=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;l||e.pos++,s[t]=e.pos}tokenize(e){const t=this.getRules(),n=t.length,o=e.posMax;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(e.env,"__mdtsProfileRules")))){const i=this.isDefaultRuleset();for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos")}if(l){if(e.pos>=o)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending();return}const s=this.ruler.getNamedRules("");for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(r){if(e.pos>=o)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending()}isDefaultRuleset(){return this.ruler.version===this.defaultRulerVersion&&this.ruler2.version===this.defaultRuler2Version}parseSource(e,t,n,o){if(typeof e=="string"&&e.length>0&&this.isDefaultRuleset()&&vI(e)){const a=new ws("text","",0);a.content=e,o.push(a);return}const s=new gI(e,t,n,o);this.tokenize(s);const i=this.getRules2(),r=i.length;if(!(s.env&&(Object.prototype.hasOwnProperty.call(s.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(s.env,"__mdtsProfileRules")))){for(let a=0;a0&&vI(i.content)){const r=new ws("text","",0);r.content=i.content,i.children.push(r);continue}e.md.inline.parse(i.content,e.md,e.env,i.children)}}}const Rne=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,One=/[0-9a-z]/i;function Pne(e){return/^\s]/i.test(e)}function Dne(e){return/^<\/a\s*>/i.test(e)}function Bne(e,t){if(t.schema||t.index!==0||!t.raw)return t;for(let n=1;n=0;r--){const l=s[r];if(l.type==="link_close"){for(r--;r>=0&&s[r].level!==l.level&&s[r].type!=="link_open";)r--;continue}if(l.type==="html_inline"&&(Pne(l.content)&&i>0&&i--,Dne(l.content)&&i++),i>0||l.type!=="text"||!e.md.linkify.test(l.content))continue;const a=l.content;let u=(e.md.linkify.match(a)||[]).map(h=>Bne(e.md.linkify,h));if(u.length===0)continue;const c=[];let d=l.level,f=0;u.length>0&&u[0].index===0&&r>0&&s[r-1].type==="text_special"&&(u=u.slice(1));for(let h=0;hf){const x=new ws("text","",0);x.content=a.slice(f,w),x.level=d,c.push(x)}const b=new ws("link_open","a",1);b.attrs=[["href",v]],b.level=d++,b.markup="linkify",b.info="auto",c.push(b);const _=new ws("text","",0);_.content=k,_.level=d,c.push(_);const g=new ws("link_close","a",-1);g.level=--d,g.markup="linkify",g.info="auto",c.push(g),f=m.lastIndex}if(f!==0){if(f=0;n--){const o=e[n];o.type==="text"&&!t&&(o.content=o.content.replace(Vne,Kne)),o.type==="link_open"&&o.info==="auto"&&t--,o.type==="link_close"&&o.info==="auto"&&t++}}function Gne(e){let t=0;for(let n=e.length-1;n>=0;n--){const o=e[n];o.type==="text"&&!t&&yI.test(o.content)&&(o.content=o.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),o.type==="link_open"&&o.info==="auto"&&t--,o.type==="link_close"&&o.info==="auto"&&t++}}function Yne(e){if(e.md?.options?.typographer)for(let t=e.tokens.length-1;t>=0;t--){const n=e.tokens[t];if(n.type!=="inline")continue;const o=n.content||(Array.isArray(n.children)?n.children.map(s=>s.type==="text"?s.content:"").join(""):"");jne.test(o)&&Zne(n.children||[]),yI.test(o)&&Gne(n.children||[])}}var Xne=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t){const n=this.rules.findIndex(o=>o.name===e);n>=0&&this.rules.splice(n,1),this.rules.push({name:e,fn:t,enabled:!0}),this.invalidateCache()}at(e,t){const n=this.rules.findIndex(o=>o.name===e);if(n<0)throw new Error(`Parser rule not found: ${e}`);this.rules[n].fn=t,this.invalidateCache()}before(e,t,n){const o=this.rules.findIndex(i=>i.name===e);if(o<0)throw new Error(`Parser rule not found: ${e}`);const s=this.rules.findIndex(i=>i.name===t);s>=0&&this.rules.splice(s,1),this.rules.splice(o,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}after(e,t,n){const o=this.rules.findIndex(i=>i.name===e);if(o<0)throw new Error(`Parser rule not found: ${e}`);const s=this.rules.findIndex(i=>i.name===t);s>=0&&this.rules.splice(s,1),this.rules.splice(o+1,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled||(this.rules[r].enabled=!0,s=!0)}return s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled&&(this.rules[r].enabled=!1,s=!0)}return s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this.rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}compileCache(){this.cache=this.rules.filter(e=>e.enabled).map(e=>e.fn),this.namedCache=this.rules.filter(e=>e.enabled).map(e=>({name:e.name,fn:e.fn}))}getRules(e=""){return this.cache||this.compileCache(),this.cache}getNamedRules(e=""){return this.namedCache||this.compileCache(),this.namedCache}};const Jne=/['"]/,xC=/['"]/g,SC="’";function ah(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function Qne(e,t){let n;const o=[],s=t.md&&t.md.options&&t.md.options.quotes||"“”‘’";for(let i=0;i=0&&!(o[n].level<=l);n--);if(o.length=n+1,r.type!=="text")continue;let a=r.content,u=0,c=a.length;e:for(;u=0)v=a.charCodeAt(d.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){v=e[n].content.charCodeAt(e[n].content.length-1);break}let k=32;if(u=48&&v<=57&&(h=f=!1),f&&h&&(f=w,h=b),!f&&!h){m&&(r.content=ah(r.content,d.index,SC));continue}if(h)for(n=o.length-1;n>=0;n--){let x=o[n];if(o[n].level=0;t--){const n=e.tokens[t];if(n.type!=="inline")continue;const o=typeof n.content=="string"?n.content:(n.children||[]).map(s=>s.content||"").join("");!Jne.test(o)||!n.children||Qne(n.children,e)}}function toe(e){const t=e.tokens||[],n=t.length;for(let o=0;o=4||s.charCodeAt(c)!==62)return!1;if(o)return!0;const h=[],m=[],v=[],k=[],w=e.md.block.ruler.getRulesForState(e,"blockquote"),b=e.parentType;e.parentType="blockquote";let _=!1,g;for(g=t;g=d)break;if(s.charCodeAt(c++)===62&&!E){let D=a[g]+1,I,$;s.charCodeAt(c)===32?(c++,D++,$=!1,I=!0):s.charCodeAt(c)===9?(I=!0,(u[g]+D)%4===3?(c++,D++,$=!1):$=!0):I=!1;let B=D;for(h.push(i[g]),i[g]=c;c=d,m.push(u[g]),u[g]=a[g]+1+(I?1:0),v.push(a[g]),a[g]=B-D,k.push(l[g]),l[g]=c-i[g];continue}if(_)break;let P=!1;for(let D=0,I=w.length;D";const T=[t,0];S.map=T,e.md.block.tokenize(e,t,g);const A=e.push("blockquote_close","blockquote",-1);A.markup=">",e.lineMax=f,e.parentType=b,T[1]=e.line;for(let E=0;E=4){o++,s=o;continue}break}e.line=s;const i=e.push("code_block","code",0);return i.content=`${e.getLines(t,s,4+e.blkIndent,!1)} +`,i.map=[t,e.line],!0}function loe(e,t,n,o){let s=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||s+3>i)return!1;const r=e.src.charCodeAt(s);if(r!==126&&r!==96)return!1;let l=s;s=e.skipChars(s,r);let a=s-l;if(a<3)return!1;const u=e.src.slice(l,s),c=e.src.slice(s,i);if(r===96&&c.includes(String.fromCharCode(r)))return!1;if(o)return!0;let d=t,f=!1;for(;d++,!(d>=n||(s=l=e.bMarks[d]+e.tShift[d],i=e.eMarks[d],s=4)&&(s=e.skipChars(s,r),!(s-l=4)return!1;let c=s.charCodeAt(a);if(c!==35||a>=u)return!1;let d=1;for(c=s.charCodeAt(++a);c===35&&a6||aa&&TC(s.charCodeAt(f-1))&&(u=f),e.line=t+1;const h=e.push("heading_open",AC[d],1);h.markup=MC[d],h.map=[t,e.line];const m=e.push("inline","",0);m.content=s.slice(a,u).trim(),m.map=[t,e.line],m.children=[];const v=e.push("heading_close",AC[d],-1);return v.markup=MC[d],!0}function uoe(e){switch(e){case 9:case 32:return!0}return!1}function coe(e,t,n,o){const s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t];const r=e.src.charCodeAt(i++);if(r!==42&&r!==45&&r!==95)return!1;let l=1;for(;i|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp(`^|$))`,"i"),/^$/,!0],[new RegExp(`${hne.source}\\s*$`),/^$/,!1]];function doe(e,t,n,o){let s=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(s)!==60)return!1;let r=e.src.slice(s,i),l=0;for(;l=48&&e<=57}var _I=class{src;md;env;tokens;bMarks=[];eMarks=[];tShift=[];sCount=[];bsCount=[];lineFlags=[];blkIndent=0;line=0;lineMax=0;tight=!1;ddIndent=-1;listIndent=-1;parentType="root";level=0;constructor(e,t,n,o){this.src=e,this.md=t,this.env=n,this.tokens=o;const s=this.src;let i=0,r=0,l=0,a=!1,u=0;for(let c=0,d=s.length;c0&&this.level++,this.tokens.push(o),o}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){const t=this.bMarks,n=this.tShift,o=this.eMarks;for(let s=this.lineMax;et;){const o=n.charCodeAt(--e);if(o!==9&&o!==32)return e+1}return e}skipChars(e,t){const n=this.src;for(let o=n.length;en;)if(t!==o.charCodeAt(--e))return e+1;return e}getLines(e,t,n,o){if(e>=t)return"";if(e+1===t){const c=e,d=this.bMarks[c];let f=d;const h=o?this.eMarks[c]+1:this.eMarks[c];let m=0;const v=this.src,k=this.bsCount,w=this.tShift;for(;fn?new Array(m-n+1).join(" ")+v.slice(f,h):v.slice(f,h)}const s=new Array(t-e),i=this.src,r=this.bMarks,l=this.eMarks,a=this.bsCount,u=this.tShift;for(let c=0,d=e;dn?s[c]=new Array(f-n+1).join(" ")+i.slice(m,v):s[c]=i.slice(m,v)}return s.join("")}};_I.prototype.Token=ws;function poe(e,t,n){for(let o=t;o=s)return!1;const i=n.charCodeAt(o);switch(i){case 35:case 42:case 43:case 45:case 60:case 62:case 95:case 96:case 126:return!0}return i>=48&&i<=57?!0:poe(n,o,s)}const IC=["","h1","h2"];function hoe(e,t,n){const o=e.md.block.ruler.getRulesForState(e,"paragraph"),s=e.src,i=e.bMarks,r=e.tShift,l=e.eMarks,a=e.sCount,u=e.blkIndent,c=xI(e);if(a[t]-u>=4)return!1;const d=e.parentType;e.parentType="paragraph";let f=0,h,m=t+1;for(;m=x)break;if(a[m]-u>3)continue;if(a[m]>=u&&(h=s.charCodeAt(g),h===45||h===61)){let T=g+1,A=T;for(;T=x){f=h===61?1:2;break}if(A-g>1)continue}if(a[m]<0||c&&!SI(e,m,s,g,x))continue;let S=!1;for(let T=0,A=o.length;Tg;){const S=s.charCodeAt(x-1);if(S!==9&&S!==32)break;x--}v=s.slice(g,x)}else v=e.getLines(t,m,u,!1).trim();e.line=m+1;const k=h===61?"=":"-",w=e.push("heading_open",IC[f],1);w.markup=k,w.map=[t,e.line];const b=e.push("inline","",0);b.content=v,b.map=[t,e.line-1],b.children=[];const _=e.push("heading_close",IC[f],-1);return _.markup=k,e.parentType=d,!0}function AI(e){switch(e){case 9:case 32:return!0}return!1}function LC(e,t){const n=e.eMarks,o=e.bMarks,s=e.tShift,i=e.src,r=n[t];let l=o[t]+s[t];const a=i.charCodeAt(l++);return a!==42&&a!==45&&a!==43||l=l)return-1;let u=i.charCodeAt(a++);if(u<48||u>57)return-1;for(;;){if(a>=l)return-1;if(u=i.charCodeAt(a++),u>=48&&u<=57){if(a-r>=10)return-1;continue}if(u===41||u===46)break;return-1}return a0&&++s=4||e.listIndent>=0&&e.sCount[l]-e.listIndent>=4&&e.sCount[l]=e.blkIndent&&(u=!0);let c,d,f;const h=e.src,m=e.bMarks,v=e.tShift,k=e.eMarks,w=e.sCount,b=e.bsCount,_=m[l]+v[l];if(_>=k[l])return!1;const g=h.charCodeAt(_);if(g>=48&&g<=57){if(f=$C(e,l),f<0||(c=!0,r=_,d=moe(e,l,f),u&&d!==1))return!1}else if(g===42||g===45||g===43){if(f=LC(e,l),f<0)return!1;c=!1}else return!1;if(u&&e.skipSpaces(f)>=k[l])return!1;if(o)return!0;const x=h.charCodeAt(f-1),S=String.fromCharCode(x);if(c){const I=e.push("ordered_list_open","ol",1);d!==void 0&&d!==1&&(I.attrs=[["start",String(d)]])}else e.push("bullet_list_open","ul",1);const T=[l,0];e.tokens[e.tokens.length-1].map=T,e.tokens[e.tokens.length-1].markup=S;let A=!1;const E=e.tokens.length-1,P=e.md.block.ruler.getRulesForState(e,"list"),D=e.parentType;for(e.parentType="list";l=s?H=1:H=$-I,H>4&&(H=1);const O=I+H,F=e.push("list_item_open","li",1);F.markup=S;const U=[l,0];F.map=U,c&&(F.info=f-r-1===1?goe[h.charCodeAt(r)-48]:h.slice(r,f-1));const z=e.tight,W=e.tShift[l],K=e.sCount[l],V=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=O,e.tight=!0,e.tShift[l]=B-m[l],e.sCount[l]=$,B>=s&&e.isEmpty(l+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,l,n,!0),(!e.tight||A)&&(a=!1),A=e.line-l>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=V,e.tShift[l]=W,e.sCount[l]=K,e.tight=z,e.push("list_item_close","li",-1).markup=S,l=e.line,U[1]=l,l>=n||e.sCount[l]=4)break;let ie=!1;for(let ne=0,X=P.length;ne3||u[f]<0)continue;if(s==="list"&&u[f]>=c){const _=r[f]+l[f],g=a[f];if(_=g||NC(i.charCodeAt(_+1)))break}else if(x>=48&&x<=57&&_+1=g){S=-1;break}const T=i.charCodeAt(S++);if(T>=48&&T<=57){if(S-_>=10){S=-1;break}continue}if((T===41||T===46)&&(S>=g||NC(i.charCodeAt(S))))break;S=-1;break}if(S>=0)break}}}const k=r[f]+l[f],w=a[f];if(d&&!SI(e,f,i,k,w))continue;let b=!1;for(let _=0,g=o.length;_=4||e.src.charCodeAt(s)!==91)return!1;function a(_){const g=e.lineMax;if(_>=g||e.isEmpty(_))return null;let x=!1;if(e.sCount[_]-e.blkIndent>3&&(x=!0),e.sCount[_]<0&&(x=!0),!x){const A=e.parentType;e.parentType="reference";let E=!1;for(let P=0,D=l.length;P"u"&&(e.env.references={}),typeof e.env.references[b]>"u"&&(e.env.references[b]={title:w,href:f}),e.line=r),!0):!1}function k9(e){switch(e){case 9:case 32:return!0}return!1}const Coe=65536;function b9(e,t){const n=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];return e.src.slice(n,o)}function woe(e,t){if(e.lineFlags)return(e.lineFlags[t]&Hf.Pipe)!==0;for(let n=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];nn)return!1;let s=t+1;if(e.sCount[s]=4)return!1;let i=e.bMarks[s]+e.tShift[s];if(i>=e.eMarks[s])return!1;const r=e.src.charCodeAt(i++);if(r!==124&&r!==45&&r!==58||i>=e.eMarks[s])return!1;const l=e.src.charCodeAt(i++);if(l!==124&&l!==45&&l!==58&&!k9(l)||r===45&&k9(l)||!woe(e,t))return!1;for(;i=4)return!1;u=FC(a),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const d=u.length;if(d===0||d!==c.length)return!1;if(o)return!0;const f=e.parentType;e.parentType="table";const h=e.md.block.ruler.getRulesForState(e,"blockquote"),m=e.push("table_open","table",1),v=[t,0];m.map=v;const k=e.push("thead_open","thead",1);k.map=[t,t+1];const w=e.push("tr_open","tr",1);w.map=[t,t+1];for(let g=0;g=4||(u=FC(a),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),_+=d-u.length,_>Coe))break;if(s===t+2){const S=e.push("tbody_open","tbody",1);S.map=b=[t+2,0]}const x=e.push("tr_open","tr",1);x.map=[s,s+1];for(let S=0;Sr.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this._rules.findIndex(r=>r.name===t);i>=0&&this._rules.splice(i,1),this._rules.splice(s,0,{name:t,enabled:!0,fn:n,alt:o?.alt||[]}),this.invalidateCache()}after(e,t,n,o){const s=this._rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this._rules.findIndex(r=>r.name===t);i>=0&&this._rules.splice(i,1),this._rules.splice(s+1,0,{name:t,enabled:!0,fn:n,alt:o?.alt||[]}),this.invalidateCache()}getRules(e){const t=e||"";return this.cache||this.compileCache(),this.cache[t]??[]}getNamedRules(e){const t=e||"";return this.namedCache||this.compileCache(),this.namedCache[t]??[]}getRulesForState(e,t){const n=e?.env;return n&&(Object.prototype.hasOwnProperty.call(n,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(n,"__mdtsProfileRules"))?this.getNamedRules(t).map(({name:o,fn:s})=>(i,r,l,a)=>{const u=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),c=s(i,r,l,a),d=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();return zd(i?.env,"block",o,d-u,c,!!a),c}):this.getRules(t)}at(e,t,n){const o=this._rules.findIndex(s=>s.name===e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this._rules[o].fn=t,n?.alt&&(this._rules[o].alt=n.alt),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;return n.forEach(i=>{const r=this._rules.findIndex(l=>l.name===i);if(r===-1){if(t)return;throw new Error(`Rules manager: invalid rule name ${i}`)}o.push(i),this._rules[r].enabled||(this._rules[r].enabled=!0,s=!0)}),s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;return n.forEach(i=>{const r=this._rules.findIndex(l=>l.name===i);if(r===-1){if(t)return;throw new Error(`Rules manager: invalid rule name ${i}`)}o.push(i),this._rules[r].enabled&&(this._rules[r].enabled=!1,s=!0)}),s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this._rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}compileCache(){const e=new Set([""]);for(const o of this._rules)if(o.enabled)for(const s of o.alt)e.add(s);const t=Object.create(null),n=Object.create(null);for(const o of e){const s=[],i=[];for(const r of this._rules)r.enabled&&(o!==""&&!r.alt.includes(o)||(s.push(r.fn),i.push({name:r.name,fn:r.fn})));t[o]=s,n[o]=i}this.cache=t,this.namedCache=n}};const ch=[["table",_oe,["paragraph","reference"]],["code",roe],["fence",loe,["paragraph","reference","blockquote","list"]],["blockquote",ioe,["paragraph","reference","blockquote","list"]],["hr",coe,["paragraph","reference","blockquote","list"]],["list",yoe,["paragraph","reference","blockquote"]],["reference",boe],["html_block",doe,["paragraph","reference","blockquote"]],["heading",aoe,["paragraph","reference","blockquote"]],["lheading",hoe],["paragraph",koe]];var Soe=class{ruler;cachedRulesVersion=-1;cachedRules=[];constructor(){this.ruler=new xoe;for(let e=0;e=a[c];)c++;if(e.line=c,c>=n||u[c]=i){e.line=n;break}const h=e.line;let m=!1;for(let v=0;v=e.line)throw new Error("block rule didn't increment state.line");break}if(!m)throw new Error("none of the block rules matched");e.tight=!d,r[e.line-1]+l[e.line-1]>=a[e.line-1]&&(d=!0),c=e.line,c=a[c]&&(d=!0,c++,e.line=c)}return}const f=this.ruler.getNamedRules("");for(;c=a[c];)c++;if(e.line=c,c>=n||u[c]=i){e.line=n;break}const h=e.line;let m=!1;for(let v=0;v=e.line)throw new Error("block rule didn't increment state.line");break}}if(!m)throw new Error("none of the block rules matched");e.tight=!d,r[e.line-1]+l[e.line-1]>=a[e.line-1]&&(d=!0),c=e.line,c=a[c]&&(d=!0,c++,e.line=c)}}parse(e,t,n,o){if(!e||e.length===0)return;const s=new _I(e,t,n,o);this.tokenize(s,s.line,s.lineMax)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(""),this.cachedRulesVersion=this.ruler.version),this.cachedRules}},MI=class{src;env;tokens;inlineMode;md;constructor(e,t,n={}){this.src=typeof e=="string"?e||"":e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}};MI.prototype.Token=ws;const RC=[["normalize",Une],["block",Yte],["inline",Fne],["linkify",Hne],["replacements",Yne],["smartquotes",eoe],["text_join",toe]],Aoe={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",maxNesting:100},Moe={parseLinkLabel:Wy,parseLinkDestination:zy,parseLinkTitle:Uy};function Toe(){return{...Aoe}}function Eoe(){return{...Moe}}var Ioe=class{fallbackParser;lastState=null;block;inline;ruler;linkifyInstance=null;cachedCoreRulesVersion=-1;cachedCoreRules=[];cachedCoreNamedRulesVersion=-1;cachedCoreNamedRules=[];constructor(){this.block=new Soe,this.inline=new Nne,this.ruler=new Xne;for(let e=0;e@[\]\\^_`{}~]/;function Km(e){return!Loe.test(e)}function bf(e,t){const n=e.indexOf(` +`,t);return n===-1?e.length:n}function jh(e,t,n){for(let o=t;o3)return Km(e);for(let t=0;t=o||t.charCodeAt(r)!==32)return!1;let l=r+1;for(;ll&&t.charCodeAt(a-1)===32;)a--;let u=a;for(;u>l&&t.charCodeAt(u-1)===35;)u--;if(u>l&&t.charCodeAt(u-1)===32)for(a=u-1;a>l&&t.charCodeAt(a-1)===32;)a--;const c=t.slice(l,a);if(!Km(c))return!1;const d=Noe[i],f=Foe[i],h=Cr("heading_open",d,1,0);h.map=[s,s+1],h.markup=f,e.push(h),e.push(Ky(c,s,1));const m=Cr("heading_close",d,-1,0);return m.markup=f,e.push(m),!0}function Ooe(e,t,n){const o=Cr("paragraph_open","p",1,0);o.map=[n,n+1],e.push(o),e.push(Ky(t,n,1)),e.push(Cr("paragraph_close","p",-1,0))}function Poe(e,t,n){const o=e.charCodeAt(n-1);return o===32||o===9?e.slice(t,n).trim():e.slice(t,n)}function x9(e,t){for(;t=1e5?PC:_9,s="",i=!1,r=!1,l=0,a=0;for(;l"]/,DC=/[&<>"]/g,joe=/&/g,Voe=/[<>"]/g,qoe={"&":"&","<":"<",">":">",'"':"""};function S9(e){return qoe[e]||e}function eo(e){if(e.length===0)return"";if(e.length<32)return Uoe.test(e)?e.replace(DC,S9):e;const t=e.includes("&"),n=e.includes("<"),o=e.includes(">"),s=e.includes('"');return!t&&!n&&!o&&!s?e:t&&!n&&!o&&!s?e.replace(joe,"&"):t?e.replace(DC,S9):e.replace(Voe,S9)}const Koe=new RegExp(`${/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),Zoe=/^#(?:x[a-f0-9]{1,8}|\d{1,8})$/i;function TI(e){return!e.includes("\\")&&!e.includes("&")?e:e.replace(Koe,(t,n,o)=>{if(n)return n;if(Zoe.test(o)){const i=o[1].toLowerCase()==="x"?Number.parseInt(o.slice(2),16):Number.parseInt(o.slice(1),10);return y2(i)?wp(i):"�"}const s=$y(t);return s!==t?s:t})}const Goe=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/,Yoe=/[\n!"#$%&*+\-:<=>@[\]\\^_`{}~]/,Xoe=/"/g;function Sd(e,t){const n=e.indexOf(` +`,t);return n===-1?e.length:n}function Zm(e,t,n){for(let o=t;o=e.length||e.charCodeAt(t)===10?!1:!Zm(e,t,Sd(e,t))}function BC(e,t,n){return t+2=n||e.charCodeAt(s)!==32)return null;let i=s+1;for(;ii&&e.charCodeAt(r-1)===32;)r--;let l=r;for(;l>i&&e.charCodeAt(l-1)===35;)l--;if(l>i&&e.charCodeAt(l-1)===32)for(r=l-1;r>i&&e.charCodeAt(r-1)===32;)r--;const a=Zy(e.slice(i,r));return a===null?null:`${a} +`}function HC(e,t,n){return t+1" +`;case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return null}return`
  • ${e[t]}
  • +`}function nse(e,t,n){const o=t+2;if(n===o+1)return tse(e,o);const s=Zy(e.slice(t+2,n));return s===null?null:`
  • ${s}
  • +`}function ose(e,t,n){for(;tt;){const s=e.charCodeAt(n-1);if(s!==32&&s!==9)break;n--}let o=n;for(let s=t;s`:"
    ",o.lang=i,o.open=d),{html:`${d}${eo(c)}
    +`,nextPos:u=25e4,i=[],r={lang:null,open:""};let l="",a="",u="",c="";for(;n +`;g +`,l=w,a=b}let _=dh(e,k);for(;_${k}

    +`,u=h,c=m}const v=de.core.parse(t,n,e).tokens);let r=Vh(t,s);if(s.maxChunks&&r.length>s.maxChunks&&(r=use(r,s.maxChunks)),qh(t,r))return v9(n,{count:1,fallback:!0,fallbackReason:"unsafe-chunk-boundary",maxChunkChars:s.maxChunkChars,maxChunkLines:s.maxChunkLines}),Hd(n,i,()=>e.core.parse(t,n,e).tokens);let l=0;const a=[];return v9(n,{count:r.length,maxChunkChars:s.maxChunkChars,maxChunkLines:s.maxChunkLines,globalStateDetected:i||void 0,globalStateFallbackDisabled:s.fallbackOnGlobalState===!1&&!!i}),Hd(n,i,()=>{for(let u=0;u=3&&(c?c.marker===_&&x>=c.length&&(c=null):c={marker:_,length:x})}}const k=m-f;s+=k,i+=1,l+=1,v?(a=0,u=0):(a+=1,u+=k);const w=v;if((s>=t.maxChunkChars||i>=t.maxChunkLines)&&!c)if(w)d(m);else{const b=Math.max(10,Math.floor(t.maxChunkLines*.5)),_=Math.max(t.maxChunkChars,8e3);(a>=b||u>=_)&&d(m)}f=m}return n&&d(e.length),o}function qh(e,t,n={rangesCoverWholeSource:!0}){const o=n.rangesCoverWholeSource?t.length-1:t.length;for(let s=0;se.length||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;for(let o=n+1;o=0;o--)n.push(e[o]);for(;n.length;){const o=n.pop();if(o.map&&(o.map[0]+=t,o.map[1]+=t),o.children)for(let s=o.children.length-1;s>=0;s--)n.push(o.children[s])}}function ase(e,t){for(let n=0;n=0;o--)n.push(e[o]);for(;n.length;){const o=n.pop();if(o.map&&(o.map[0]+=t,o.map[1]+=t),o.children)for(let s=o.children.length-1;s>=0;s--)n.push(o.children[s])}}function wa(e){return e.length===0?0:Wo(e)+(e.charCodeAt(e.length-1)===10?0:1)}function gse(e,t,n){for(let o=t;o=3&&(n?n.marker===r&&a>=n.length&&(n=null):n={marker:r,length:a})}o=s===e.length?e.length:s+1}return n!==null}function yse(e,t){if(e.length===0||e.charCodeAt(e.length-1)!==10)return!1;let n=e.length-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;return gse(e,n+1,e.length-1)?!vse(e,t):!1}function kse(e,t,n,o={}){const s=o.mode??"full",i=o.fenceAware??(s==="stream"?e.options.streamChunkFenceAware??!0:e.options.fullChunkFenceAware??!0);if(o.maxChunkChars!==void 0||o.maxChunkLines!==void 0||o.autoTune===!1){const r=o.maxChunkChars??(s==="stream"?e.options.streamChunkSizeChars??pse:e.options.fullChunkSizeChars??dse),l=o.maxChunkLines??(s==="stream"?e.options.streamChunkSizeLines??hse:e.options.fullChunkSizeLines??fse);return{maxChunkChars:r,maxChunkLines:l,holdBelowChars:r,holdBelowLines:l,fenceAware:i}}return s==="stream"?t<=5e3?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:i}:t<=2e4?{maxChunkChars:16e3,maxChunkLines:200,holdBelowChars:16e3,holdBelowLines:200,fenceAware:i}:t<=5e4?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:i}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:i}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:i}:t<=1e5&&n<=2500?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:1e5,holdBelowLines:2500,fenceAware:i}:t<=2e5?{maxChunkChars:2e4,maxChunkLines:150,holdBelowChars:2e4,holdBelowLines:150,fenceAware:i}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:i}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:i}}var Kp=class{md;options;pending="";tokens=[];committedChars=0;committedLines=0;fedChunks=0;parsedChunks=0;globalStateEnv=null;markedGlobalStateReason=null;constructor(e,t={}){if(this.md=e,this.options={mode:"full",autoTune:!0,retainTokens:!0,...t},this.options.retainTokens===!1&&!this.options.onChunkTokens)throw new Error("UnboundedBuffer with retainTokens=false requires onChunkTokens")}feed(e){e&&(this.pending+=e,this.fedChunks+=1)}flushAvailable(e={}){if(!this.pending)return null;const t=this.resolveWindow(),n=wa(this.pending);if(this.pending.length=o||n>=s}function FI(e,t,n){if(e.options.autoUnbounded===!1)return"no";if(t>=(e.options.autoUnboundedThresholdChars??II))return"yes";const o=e.options.autoUnboundedThresholdLines??LI;return n!==void 0?n>=o?"yes":"no":t+1e.core.parse(t,n,e).tokens);const i=[],r=new Kp(e,{mode:"full",...o,retainTokens:!1,onChunkTokens(l){$I(i,l)}});if(s&&By(n,s),r.feed(t),r.flushForce(n),s&&(Hy(n),o.fallbackOnGlobalState===!1)){const l=Vl(n)?.unbounded;l&&(l.globalStateDetected=s,l.globalStateFallbackDisabled=!0)}return i}const Wd=(e,t,n)=>en?n:e;function RI(e){return e.experimental?{...e,...e.experimental}:e}const UC=[{max:5e3,strategy:"discrete",maxChunkChars:32e3,maxChunkLines:150,maxChunks:8,notes:"<=5k"},{max:2e4,strategy:"discrete",maxChunkChars:24e3,maxChunkLines:200,maxChunks:12,notes:"<=20k"},{max:1e5,strategy:"plain",notes:"<=100k plain"},{max:2e5,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:150,maxChunks:12,notes:"<=200k"},{max:5e5,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:"<=500k"},{max:5e6,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:"<=5M"}],jC=[{max:5e3,strategy:"discrete",maxChunkChars:16e3,maxChunkLines:250,maxChunks:8,notes:"<=5k"},{max:2e4,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:"<=20k"},{max:1e5,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:"<=100k"},{max:5e5,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:"<=500k"},{max:5e6,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:"<=5M"}];function OI(e,t){return{strategy:t.strategy,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,maxChunks:t.maxChunks,fenceAware:e,notes:t.notes}}function xse(e,t=Math.max(0,e/40|0),n={}){const o=RI(n),s=o.fullChunkFenceAware??!0,i=o.fullChunkTargetChunks??8,r=o.fullChunkAdaptive!==!1;for(let l=0;l5e6?{strategy:"plain",fenceAware:s,notes:">5M plain"}:r?{strategy:"adaptive",maxChunkChars:Wd(Math.ceil(e/i),8e3,64e3),maxChunkLines:Wd(Math.ceil(t/i),150,700),maxChunks:Wd(Math.ceil(e/64e3),i,16),fenceAware:s,notes:"adaptive fallback"}:{strategy:"discrete",maxChunkChars:o.fullChunkSizeChars??1e4,maxChunkLines:o.fullChunkSizeLines??200,fenceAware:s,maxChunks:o.fullChunkMaxChunks}}function VC(e,t=Math.max(0,e/40|0),n={}){const o=RI(n),s=o.streamChunkFenceAware??!0,i=o.streamChunkTargetChunks??8,r=o.streamChunkAdaptive!==!1;for(let l=0;l5e6?{strategy:"plain",fenceAware:s,notes:">5M plain"}:r?{strategy:"adaptive",maxChunkChars:Wd(Math.ceil(e/i),8e3,64e3),maxChunkLines:Wd(Math.ceil(t/i),150,700),maxChunks:Wd(Math.ceil(e/64e3),i,32),fenceAware:s,notes:"adaptive fallback"}:{strategy:"discrete",maxChunkChars:o.streamChunkSizeChars??1e4,maxChunkLines:o.streamChunkSizeLines??200,maxChunks:o.streamChunkMaxChunks,fenceAware:s}}var Sse={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"]},inline2:{rules:["balance_pairs","emphasis","fragments_join"]}}},Ase={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Mse={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"]},inline2:{rules:["balance_pairs","fragments_join"]}}};function C2(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Kh(e,t){if(C2(e))throw new TypeError(`Renderer rule "${t}" returned a Promise. Use renderAsync() instead.`);return e}const qC=e=>C2(e)?e:Promise.resolve(e);function Wf(e){switch(e){case"alt":case"class":case"href":case"id":case"lang":case"rel":case"src":case"start":case"style":case"target":case"title":return e;default:return eo(e)}}function Qa(e){if(!e||e.length===0)return"";const t=e[0];let n=` ${Wf(t[0])}="${eo(t[1])}"`;for(let o=1;o=e.length)return{langName:e,langAttrs:""};let n=t;for(;n${t} +`;const i=e.attrIndex("class"),r=e.attrs?e.attrs.slice():[],l=`${s.langPrefix??"language-"}${o}`;return i<0?r.push(["class",l]):(r[i]=r[i].slice(),r[i][1]+=` ${l}`),`
    ${t}
    +`}return`
    ${t}
    +`}function xp(e){return!e.attrs||e.attrs.length===0?`${eo(e.content)}`:`${eo(e.content)}`}function B3(e){const t=eo(e.content);return e.attrs?`${t} +`:`
    ${t}
    +`}function Tse(e,t){const n=e.attrs;if(!n||n.length===0)switch(e.type){case"paragraph_open":return`${t}

    `;case"heading_open":return`<${e.tag}>`;case"td_open":return`${t}`;case"th_open":return`${t}`;default:return null}if(n.length===1&&n[0][0]==="style"){if(e.type==="td_open")return`${t}`;if(e.type==="th_open")return`${t}`}return null}function KC(e){const t=e.attrs;return!t||t.length===0?"":t.length===1?``:t.length===2?``:``}function Ese(e){switch(e.type){case"text":case"text_special":case"softbreak":case"hardbreak":case"html_inline":case"code_inline":case"image":return!0;default:return!1}}function ZC(e){switch(e.type){case"text":case"text_special":case"softbreak":case"hardbreak":case"html_inline":case"code_inline":return!0;default:return!1}}function Ym(e,t){if(e.hidden)return"";const n=e.attrs,o=e.nesting,s=e.tag;if(!n||n.length===0)return o===0?t?`<${s} />`:`<${s}>`:o===-1?``:`<${s}>`;let i=(o===-1?"`}const Ise={langPrefix:"language-",xhtmlOut:!1,breaks:!1},fh=Object.prototype.hasOwnProperty,On={code_inline(e,t){return xp(e[t])},code_block(e,t){return B3(e[t])},fence(e,t,n,o,s){const i=e[t],r=i.info?TI(i.info).trim():"",{langName:l,langAttrs:a}=PI(r),u=n.highlight,c=eo(i.content);if(!u)return Uf(i,c,r,l,n);const d=u(i.content,l,a);return C2(d)?d.then(f=>Uf(i,f||c,r,l,n)):Uf(i,d||c,r,l,n)},image(e,t,n,o,s){const i=e[t],r=s.renderInlineAsText(i.children||[],n,o),l=i.attrIndex("alt");return l>=0&&i.attrs?i.attrs[l][1]=r:i.attrs?i.attrs.push(["alt",r]):i.attrs=[["alt",r]],Ym(i,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`
    +`:`
    +`},softbreak(e,t,n){return n.breaks?n.xhtmlOut?`
    +`:`
    +`:` +`},text(e,t){return eo(e[t].content)},text_special(e,t){return eo(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function GC(e,t,n){const o=e.info?TI(e.info).trim():"",{langName:s,langAttrs:i}=PI(o),r=t.highlight,l=eo(e.content);if(!r)return Uf(e,l,o,s,t);const a=r(e.content,s,i);if(C2(a))throw new TypeError('Renderer rule "fence" returned a Promise. Use renderAsync() instead.');return Uf(e,a||l,o,s,t)}function A9(e,t,n,o){switch(e.type){case"text":return t.text===On.text?e.content.length===0?"":eo(e.content):null;case"text_special":return t.text_special===On.text_special?e.content.length===0?"":eo(e.content):null;case"softbreak":return t.softbreak===On.softbreak?o:null;case"hardbreak":return t.hardbreak===On.hardbreak?n:null;case"html_inline":return t.html_inline===On.html_inline?e.content:null;case"code_inline":return t.code_inline===On.code_inline?xp(e):null;default:return null}}function Lse(e,t,n,o,s){const i=e[0];switch(i.type){case"text":if(s.text===On.text)return i.content.length===0?"":eo(i.content);break;case"text_special":if(s.text_special===On.text_special)return i.content.length===0?"":eo(i.content);break;case"softbreak":if(s.softbreak===On.softbreak)return t.breaks?t.xhtmlOut?`
    +`:`
    +`:` +`;break;case"hardbreak":if(s.hardbreak===On.hardbreak)return t.xhtmlOut?`
    +`:`
    +`;break;case"html_inline":if(s.html_inline===On.html_inline)return i.content;break;case"code_inline":if(s.code_inline===On.code_inline)return xp(i);break}const r=s[i.type];if(!r)return Ym(i,t.xhtmlOut===!0);const l=r(e,0,t,n,o);return typeof l=="string"?l:Kh(l,i.type)}var $se=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...On}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw new TypeError("render expects token array as first argument");if(e.length===1)return this.renderSingleToken(e,e[0],t,n);const o=this.mergeOptions(t),s=n??{},i=this.rules,r=o.xhtmlOut===!0;let l,a,u,c,d,f,h="",m="",v=!1,k="";for(let w=0;w0&&e[w-1].hidden?` +`:"";if(_==="list_item_open"&&(!b.attrs||b.attrs.length===0)&&w+3${this.renderInlineTokens(A.children||[],o,s)}`,w+=3;continue}}if(w+2 +`,w+=2;continue}}}if(_==="inline"){const T=b.children||[];if(T.length===1){v||(l=i.text,a=i.text_special,u=i.softbreak,c=i.hardbreak,d=i.html_inline,f=i.code_inline,h=o.xhtmlOut?`
    +`:`
    +`,m=o.breaks?h:` +`,v=!0);const A=T[0];switch(A.type){case"text":if(l===On.text){k+=eo(A.content);continue}break;case"text_special":if(a===On.text_special){k+=eo(A.content);continue}break;case"softbreak":if(u===On.softbreak){k+=m;continue}break;case"hardbreak":if(c===On.hardbreak){k+=h;continue}break;case"html_inline":if(d===On.html_inline){k+=A.content;continue}break;case"code_inline":if(f===On.code_inline){k+=xp(A);continue}break}}k+=this.renderInlineTokens(T,o,s);continue}const x=i[_];if(!x){const T=b.attrs;if(!b.hidden){if(!T||T.length===0)switch(_){case"hr":k+=r?`


    +`:`
    +`;continue;case"heading_open":k+=`<${b.tag}>`;continue;case"heading_close":k+=` +`;continue;case"paragraph_open":k+=`${g}

    `;continue;case"paragraph_close":k+=`

    +`;continue;case"list_item_open":{const A=e[w+1];k+=g+(A&&(A.type==="inline"||A.hidden||A.nesting===-1&&A.tag==="li")?"
  • ":`
  • +`);continue}case"list_item_close":k+=`
  • +`;continue;case"bullet_list_open":k+=`${g}
      +`;continue;case"bullet_list_close":k+=`
    +`;continue;case"blockquote_open":k+=g+(e[w+1]&&e[w+1].nesting===-1&&e[w+1].tag==="blockquote"?"
    ":`
    +`);continue;case"blockquote_close":k+=`
    +`;continue;case"ordered_list_open":k+=`${g}
      +`;continue;case"ordered_list_close":k+=`
    +`;continue;case"table_open":k+=`${g} +`;continue;case"table_close":k+=`
    +`;continue;case"thead_open":k+=`${g} +`;continue;case"thead_close":k+=` +`;continue;case"tbody_open":k+=`${g} +`;continue;case"tbody_close":k+=` +`;continue;case"tr_open":k+=`${g} +`;continue;case"tr_close":k+=` +`;continue;case"td_open":k+=`${g}`;continue;case"td_close":k+=` +`;continue;case"th_open":k+=`${g}`;continue;case"th_close":k+=` +`;continue}else if(T.length===1){const A=T[0];if(_==="ordered_list_open"&&A[0]==="start"){k+=`${g}
      +`;continue}if(_==="td_open"&&A[0]==="style"){k+=`${g}`;continue}if(_==="th_open"&&A[0]==="style"){k+=`${g}`;continue}}}k+=this.renderToken(e,w,o);continue}if(_==="code_block"&&x===On.code_block){k+=B3(b);continue}if(_==="fence"&&x===On.fence){k+=GC(b,o);continue}if(_==="html_block"&&x===On.html_block){k+=b.content;continue}const S=x(e,w,o,s,this);typeof S=="string"?k+=S:k+=Kh(S,b.type)}return k}async renderAsync(e,t,n){if(!Array.isArray(e))throw new TypeError("render expects token array as first argument");const o=this.mergeOptions(t),s=n??{},i=this.rules;let r="";for(let l=0;l0&&e[t-1].hidden?` +`:"",c=a?`> +`:">";if(!l||l.length===0)return i===0?n.xhtmlOut?`${u}<${r} /${c}`:`${u}<${r}${c}`:i===-1?`${u}(n||(n={...t}),n);if(fh.call(e,"highlight")&&e.highlight!==t.highlight&&(o().highlight=e.highlight),fh.call(e,"langPrefix")){const s=e.langPrefix;s!==t.langPrefix&&(o().langPrefix=s)}if(fh.call(e,"xhtmlOut")){const s=e.xhtmlOut;s!==t.xhtmlOut&&(o().xhtmlOut=s)}if(fh.call(e,"breaks")){const s=e.breaks;s!==t.breaks&&(o().breaks=s)}return n||t}buildNormalizedBase(){return Object.freeze({...Ise,...this.baseOptions})}renderSingleToken(e,t,n,o){const s=this.rules,i=t.type;if(i==="code_block"&&s.code_block===On.code_block)return B3(t);if(i==="html_block"&&s.html_block===On.html_block)return t.content;const r=this.mergeOptions(n),l=o??{};if(i==="inline")return this.renderInlineTokens(t.children||[],r,l);const a=s[i];if(!a)return t.block?this.renderToken(e,0,r):Ym(t,r.xhtmlOut===!0);if(i==="fence"&&a===On.fence)return GC(t,r);const u=a(e,0,r,l,this);return typeof u=="string"?u:Kh(u,i)}renderInlineTokens(e,t,n){if(!e||e.length===0)return"";const o=this.rules;if(e.length===1)return Lse(e,t,n,this,o);const s=t.xhtmlOut===!0,i=s?`
      +`:`
      +`,r=t.breaks?i:` +`,l=o.text,a=o.text_special,u=o.softbreak,c=o.hardbreak,d=o.html_inline,f=o.code_inline,h=o.link_open,m=o.link_close,v=o.em_open,k=o.em_close,w=o.strong_open,b=o.strong_close;let _="";for(let g=0;g`;if(u===On.softbreak&&g+3`,g+=1;continue}if(x.type==="em_open"&&!v&&!k&&g+2${E}`,g+=2;continue}}}if(x.type==="strong_open"&&!w&&!b&&g+2${E}`,g+=2;continue}}}switch(x.type){case"text":if(l===On.text){const A=x.content.length===0?"":eo(x.content);if(d===On.html_inline&&g+1=4)return!0;continue}if(l===9){if(r+=4-r%4,i++,r>=4)return!0;continue}break}if(i0&&u<=6){if(a=3)return!0;break}default:if(l>=48&&l<=57){let a=i+1;for(;a57)break;a++}if(a=de,!oe&&pe!==void 0&&(ve=Wo(e),oe=ve>=pe)),oe){const G=this.parseFullDocument(e,$,n,ve,!1);return this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss($,{area:"stream",path:"stream-full",reason:"skip-cache-large-one-shot",unbounded:!!Vl($)?.unbounded}),G.tokens}else if(U){const G=(ce,ue,Se)=>ceSe?Se:ce;ve===void 0&&(ve=Wo(e));const Y=X&&!ne?VC(e.length,ve,n.options):null,fe=Y?.maxChunkChars??(z?G(Math.ceil(e.length/W),8e3,64e3):K??1e4),we=Y?.maxChunkLines??(z?G(Math.ceil(ve/W),150,700):V??200),ge=Y?.maxChunks??(z?G(Math.ceil(e.length/64e3),W,32):ie),Q=e.length>0&&e.charCodeAt(e.length-1)===10,te=F&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&Y?.strategy!=="plain";if((O||te)&&(e.length>=fe*2||ve>=we*2)&&Q){const ce=Gm(n,e,$,{maxChunkChars:fe,maxChunkLines:we,fenceAware:Y?.fenceAware??le,maxChunks:ge});return this.cache={src:e,tokens:ce,env:$,lineCount:ve,lastSegment:void 0,globalStateReason:Ri(e)},this.updateCacheLineCount(this.cache,ve),this.recordChunkedParseResult($,O?"explicit-initial-large-doc":"default-initial-large-doc"),ce}}const ye=this.parseFullDocument(e,$,n,ve);return ve=ye.lineCount,this.cache={src:e,tokens:ye.tokens,env:$,lineCount:ve,lastSegment:void 0,globalStateReason:Ri(e)},this.updateCacheLineCount(this.cache,ve),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss($,{area:"stream",path:"stream-full",reason:"initial-parse",unbounded:!!Vl($)?.unbounded}),ye.tokens}if(e===s.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode="cache",ss(s.env,{area:"stream",path:"stream-cache",reason:"same-source"}),s.tokens;const i=e.startsWith(s.src)?e.slice(s.src.length):null;let r=s.globalStateReason;r===void 0&&(r=Ri(s.src),s.globalStateReason=r);const l=r?null:i!==null?this.detectGlobalStateForAppend(s,i):Ri(e),a=r||l;if(a){const $=o??s.env;la($);const B=Ri(e),H=this.parseFullDocument(e,$,n),O=H.tokens,F=H.lineCount;return this.cache={src:e,tokens:O,env:$,lineCount:F,lastSegment:void 0,globalStateReason:B},this.updateCacheLineCount(this.cache,F),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss($,{area:"stream",path:"stream-full",reason:`global-state:${a}`,unbounded:!!Vl($)?.unbounded}),O}const u=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(s.src.length5e3?B=8:c.length>1e3?B=6:c.length>200&&(B=4),B=Math.min(B,$);let H=null;const O=n.options?.streamContextParseStrategy??"chars",F=n.options?.streamContextParseMinChars??200,U=n.options?.streamContextParseMinLines??2;let z;const W=()=>(z===void 0&&(z=Wo(c)),z),K=this.canDirectlyParseAppend(s),V=K&&this.shouldUseUnboundedAppend(e,s,c);let ie=!1;if(!K)switch(O){case"lines":ie=W()>=U;break;case"constructs":if(c.length>=F){ie=!0;break}if(Rse(c)){ie=!0;break}ie=W()>=U;break;case"chars":default:ie=c.length>=F}if(B>0&&ie){const le=this.getTailLines(s.src,B)+c;try{const Ie=this.core.parse(le,s.env,n).tokens,de=Ie.findIndex(pe=>pe.map&&typeof pe.map[1]=="number"&&pe.map[1]>B);if(de!==-1){const pe=Ie.slice(de),ve=$-B;ve!==0&&this.shiftTokenLines(pe,ve),H={tokens:pe}}}catch{H=null}}else H=null;if(!H){const le=$;if(V)H={tokens:zf(n,c,s.env,{mode:"stream"})},le>0&&this.shiftTokenLines(H.tokens,le);else{const Ie=this.core.parse(c,s.env,n);le>0&&this.shiftTokenLines(Ie.tokens,le),H=Ie}}let ne=0;if(s.tokens.length>0&&H.tokens.length>0){const le=s.tokens[s.tokens.length-1],Ie=H.tokens[0];try{le.type==="inline"&&Ie.type==="inline"&&(Ie.children&&Ie.children.length>0&&(le.children||(le.children=[]),this.appendTokens(le.children,Ie.children)),le.content=(le.content||"")+(Ie.content||""),ne=1)}catch{ne=0}}const X=s.tokens.length;if(H.tokens.length>ne){const le=s.tokens,Ie=H.tokens,de=Math.min(le.length,Ie.length-ne);let pe=0;for(let ve=de;ve>0;ve--){let oe=!0;for(let ye=0;ye0&&(ne+=pe),Ie.length>ne&&this.appendTokens(s.tokens,Ie,ne)}if(s.src=e,s.globalStateReason=null,s.lineCount=$+(z??W()),s.tokens.length>X){const le=this.getLastSegment(s.tokens,e,X,s.tokens.length,e.length-c.length,$);le?s.lastSegment=le:s.lastSegment=void 0}else s.lastSegment=void 0;return this.stats.total+=1,this.stats.appendHits+=1,V&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode="append",ss(s.env,{area:"stream",path:V?"stream-unbounded-append":"stream-append",reason:V?"large-delta":"safe-append",unbounded:V}),s.tokens}const d=o??s.env,f=this.tryTailSegmentReparse(e,s,d,n);if(f)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode="tail",ss(d,{area:"stream",path:"stream-tail",reason:"tail-reparse"}),f;const h=!!n.__explicitStreamChunkFallbackSetting,m=typeof n.__canUseImplicitLargeInputStrategy=="function"?n.__canUseImplicitLargeInputStrategy():!0,v=!!n.options?.streamChunkedFallback,k=!h&&!c&&m,w=v||k,b=n.options?.streamChunkAdaptive!==!1,_=n.options?.streamChunkTargetChunks??8,g=n.options?.streamChunkSizeChars,x=n.options?.streamChunkSizeLines,S=n.options?.streamChunkMaxChunks,T=!!n.__explicitStreamChunkConfig,A=n.options?.autoTuneChunks!==!1,E=n.options?.streamChunkFenceAware??!0;let P=c&&s.lineCount!==void 0?s.lineCount+Wo(c):void 0;if(w){P===void 0&&(P=Wo(e));const $=(W,K,V)=>WV?V:W,B=A&&!T?VC(e.length,P,n.options):null,H=B?.maxChunkChars??(b?$(Math.ceil(e.length/_),8e3,64e3):g??1e4),O=B?.maxChunkLines??(b?$(Math.ceil(P/_),150,700):x??200),F=B?.maxChunks??(b?$(Math.ceil(e.length/64e3),_,32):S),U=e.length>0&&e.charCodeAt(e.length-1)===10,z=k&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&B?.strategy!=="plain";if((v||z)&&(e.length>=H*2||P>=O*2)&&U){const W=Gm(n,e,d,{maxChunkChars:H,maxChunkLines:O,fenceAware:B?.fenceAware??E,maxChunks:F});return this.cache={src:e,tokens:W,env:d,lineCount:P,lastSegment:void 0,globalStateReason:Ri(e)},this.updateCacheLineCount(this.cache,P),this.recordChunkedParseResult(d,v?"explicit-fallback-large-doc":"default-fallback-large-doc"),W}}const D=this.parseFullDocument(e,d,n,P),I=D.tokens;return P=D.lineCount,this.cache={src:e,tokens:I,env:d,lineCount:P,lastSegment:void 0,globalStateReason:Ri(e)},this.updateCacheLineCount(this.cache,P),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss(d,{area:"stream",path:"stream-full",reason:"fallback-full",unbounded:!!Vl(d)?.unbounded}),I}recordChunkedParseResult(e,t){const n=Vl(e)?.chunk,o=n?.fallback?String(n.fallbackReason||"global-state"):null;if(this.stats.total+=1,o){this.stats.fullParses+=1,this.stats.lastMode="full",ss(e,{area:"stream",path:"stream-full",reason:`global-state:${o}`,unbounded:!!Vl(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode="chunked",ss(e,{area:"stream",path:"stream-chunked",chunked:!0,reason:t})}parseFullDocument(e,t,n,o,s=!0){const i=Ri(e);Vp(t)&&la(t);const r=typeof n.__canUseImplicitLargeInputStrategy!="function"||n.__canUseImplicitLargeInputStrategy()?FI(n,e.length,o):"no";if(r==="yes"){const a=zf(n,e,t);return ss(t,{area:"stream",path:"stream-full",reason:"auto-unbounded-char-threshold",unbounded:!0}),{tokens:a,lineCount:o??(s?Wo(e):0)}}let l=o;if(r==="need-lines"&&(l=Wo(e),NI(n,e.length,l))){const a=zf(n,e,t);return ss(t,{area:"stream",path:"stream-full",reason:"auto-unbounded-line-threshold",unbounded:!0}),{tokens:a,lineCount:l}}return l===void 0&&(l=s?Wo(e):0),{tokens:Hd(t,i,()=>this.core.parse(e,t,n).tokens),lineCount:l}}shouldUseUnboundedAppend(e,t,n){return!n||e.length=this.MIN_UNBOUNDED_APPEND_CHARS?!0:Wo(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){if(n===null||n===void 0&&!t.startsWith(e)||!e.endsWith(` +`))return null;const o=n??t.slice(e.length);if(!o)return null;const s=o.length;if(o.charCodeAt(s-1)!==10)return null;let i=0,r=-1;for(let a=0;a=2));a++);if(i<2)return null;const l=(r===-1?o:o.slice(0,r)).trim();if(l.length===0)return null;if(/^[-=]+$/.test(l)){const a=e.slice(0,-1),u=a.lastIndexOf(` +`);if(a.slice(u+1).trim().length>0)return null}return this.endsInsideOpenFence(e)||this.mayContainReferenceDefinition(o)?null:o}tryTailSegmentReparse(e,t,n,o){const s=this.ensureLastSegment(t);if(!s||s.srcOffset<=0&&s.tokenStart<=0)return null;const i=t.src.slice(0,s.srcOffset);if(!e.startsWith(i))return null;const r=t.src.slice(s.srcOffset),l=e.slice(s.srcOffset);if(l===r)return null;const a=e.startsWith(t.src)?e.slice(t.src.length):null;if(a){const u=this.tryContainerTailAppendMerge(e,t,n,o,s,a);if(u)return u}if(this.mayContainReferenceDefinition(r)||this.mayContainReferenceDefinition(l))return null;try{const u=this.core.parse(l,n,o),c=this.getLastSegment(u.tokens,l);return s.lineStart>0&&this.shiftTokenLines(u.tokens,s.lineStart),t.src=e,t.env=n,t.globalStateReason=null,t.globalStateCarry=void 0,t.tokens.length=s.tokenStart,this.appendTokens(t.tokens,u.tokens),t.lineCount=s.lineStart+Wo(l),c?t.lastSegment={tokenStart:s.tokenStart+c.tokenStart,tokenEnd:s.tokenStart+c.tokenEnd,lineStart:s.lineStart+c.lineStart,lineEnd:s.lineStart+c.lineEnd,srcOffset:s.srcOffset+c.srcOffset}:t.lastSegment=null,t.tokens}catch{return null}}getTailLines(e,t){if(t<=0)return"";let n=t;for(let o=e.length-1;o>=0;o--)if(e.charCodeAt(o)===10&&(n--,n===0))return e.slice(o+1);return e}endsInsideOpenFence(e){const n=e.length>4e3?e.length-4e3:0,o=e.slice(n),s=o.length;let i=null,r=0;for(;r<=s;){let l=o.indexOf(` +`,r);l===-1&&(l=s);let a=r;for(;a=3&&(i?i.marker===u&&d>=i.length&&(i=null):i={marker:u,length:d})}}if(l===s)break;r=l+1}return i!==null}peek(){return this.cache?.tokens??Fse}getStats(){return{...this.stats}}appendTokens(e,t,n=0,o=t.length){for(let s=n;sM9?n.slice(n.length-M9):n,o&&(e.globalStateReason=o),o}ensureLastSegment(e){return e.lastSegment!==void 0||(e.lastSegment=this.getLastSegment(e.tokens,e.src)),e.lastSegment}getLastSegment(e,t,n=0,o=e.length,s,i){if(o<=n)return null;let r=Number.POSITIVE_INFINITY,l=-1,a=0;for(let u=o-1;u>=n;u--){const c=e[u];if(c.map&&(c.map[0]l&&(l=c.map[1])),c.nesting<0){a+=-c.nesting;continue}if(c.nesting>0){if(a-=c.nesting,c.level===0&&a<=0){const d=Number.isFinite(r)?r:c.map?.[0]??0,f=l>=d?l:c.map?.[1]??d;return{tokenStart:u,tokenEnd:o,lineStart:d,lineEnd:f,srcOffset:this.getLineStartOffset(t,d,s,i)}}continue}if(c.level===0&&a===0){const d=Number.isFinite(r)?r:c.map?.[0]??0,f=l>=d?l:c.map?.[1]??d;return{tokenStart:u,tokenEnd:o,lineStart:d,lineEnd:f,srcOffset:this.getLineStartOffset(t,d,s,i)}}}return null}getLineStartOffset(e,t,n,o){if(n!==void 0&&o!==void 0&&t>=o)return this.getLineStartOffsetFrom(e,n,t-o);if(t<=0)return 0;let s=t,i=-1;for(;s>0;){if(i=e.indexOf(` +`,i+1),i===-1)return e.length;s--}return i+1}getLineStartOffsetFrom(e,t,n){if(n<=0)return t;let o=n,s=t-1;for(;o>0;){if(s=e.indexOf(` +`,s+1),s===-1)return e.length;o--}return s+1}mayContainReferenceDefinition(e){return e.includes("]:")?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.endsWithBlankLine(e.src))return!1;const t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case"paragraph_open":case"heading_open":case"fence":case"code_block":case"html_block":case"hr":case"table_open":return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,o,s,i){if(!i||this.mayContainReferenceDefinition(i))return null;const r=t.tokens[s.tokenStart];switch(r?.type){case"bullet_list_open":case"ordered_list_open":return this.tryListTailAppendMerge(e,t,n,o,s,i,r);case"table_open":return this.tryTableTailAppendMerge(e,t,n,o,s,i,r);default:return null}}tryListTailAppendMerge(e,t,n,o,s,i,r){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10)return null;const l=s.lineEnd-s.lineStart,a=t.src.length-s.srcOffset;if(l0&&this.shiftTokenLines(d,f);const h=this.getListParagraphMode(t.tokens,s.tokenStart,t.tokens.length,r.level),m=this.getListParagraphMode(c,0,c.length,0);(h==="loose"||m==="loose"||this.endsWithBlankLine(t.src)||(c[0]?.map?.[0]??0)>0)&&(this.setListParagraphVisibility(t.tokens,s.tokenStart,t.tokens.length,r.level,!1),this.setListParagraphVisibility(d,0,d.length,r.level,!1)),t.tokens.splice(t.tokens.length-1,0,...d),t.src=e,t.env=n,t.globalStateReason=null;const v=f+Wo(i);t.lineCount=v;const k=this.getDocLineCount(e,v);return r.map&&(r.map[1]=k),t.lastSegment={tokenStart:s.tokenStart,tokenEnd:t.tokens.length,lineStart:s.lineStart,lineEnd:k,srcOffset:s.srcOffset},t.tokens}tryTableTailAppendMerge(e,t,n,o,s,i,r){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10||/(?:^|\n)[ \t]*\n/.test(i))return null;const l=s.lineEnd-s.lineStart,a=t.src.length-s.srcOffset;if(l=0?d.slice(f.tbodyOpenIndex+1,f.tbodyCloseIndex):d.slice(f.tbodyOpenIndex,f.tbodyCloseIndex+1);if(m.length===0)return null;const v=s.lineEnd-2;v!==0&&this.shiftTokenLines(m,v);const k=h.tbodyCloseIndex>=0?h.tbodyCloseIndex:h.tableCloseIndex,w=t.lineCount??Wo(t.src);t.tokens.splice(k,0,...m),t.src=e,t.env=n,t.globalStateReason=null;const b=w+Wo(i);t.lineCount=b;const _=this.getDocLineCount(e,b);if(r.map&&(r.map[1]=_),h.tbodyOpenIndex>=0){const g=t.tokens[h.tbodyOpenIndex];g?.map&&(g.map[1]=_)}return t.lastSegment={tokenStart:s.tokenStart,tokenEnd:t.tokens.length,lineStart:s.lineStart,lineEnd:_,srcOffset:s.srcOffset},t.tokens}getTableHeaderContext(e){const t=e.indexOf(` +`);if(t<0)return null;const n=e.indexOf(` +`,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,o){if(t<0||t>=n||e[t]?.type!=="table_open")return null;let s=-1;for(let l=n-1;l>t;l--){const a=e[l];if(a.type==="table_close"&&a.level===o){s=l;break}}if(s<0)return null;let i=-1,r=-1;for(let l=t+1;l=0){for(let l=s-1;l>i;l--){const a=e[l];if(a.type==="tbody_close"&&a.level===o+1){r=l;break}}if(r<0)return null}return{tableCloseIndex:s,tbodyOpenIndex:i,tbodyCloseIndex:r}}isSingleTopLevelContainer(e,t,n,o){if(e.length<2)return!1;const s=e[0],i=e[e.length-1];if(s.type!==t||i.type!==n||s.level!==0||i.level!==0||o!==void 0&&s.markup!==o)return!1;let r=0;for(let l=0;l0&&l0||a.nesting<0)&&(r+=a.nesting)}return r===0}getListParagraphMode(e,t,n,o){let s=!1,i=!1;const r=o+2;for(let l=t;l=0;){const o=e.charCodeAt(n);if(o===32||o===9){n--;continue}return o===10}return!0}getDocLineCount(e,t=Wo(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let o=0;o=0;i--)n.push(s.children[i]);for(;n.length>0;){const i=n.pop();if(i.map&&(i.map[0]+=t,i.map[1]+=t),i.children)for(let r=i.children.length-1;r>=0;r--)n.push(i.children[r])}}}}};const XC={default:Ase,zero:Mse,commonmark:Sse};function Bse(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function Hse(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function JC(e){return e.experimental?{...e,...e.experimental}:e}function vr(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;const n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function QC(e,t,n){for(let o=0;o=4?n.quotes=[A[0],A[1],A[2],A[3]]:n.quotes=["“","”","‘","’"]}let r=QC(i?.options,s,["fullChunkSizeChars","fullChunkSizeLines","fullChunkMaxChunks"]),l=QC(i?.options,s,["streamChunkSizeChars","streamChunkSizeLines","streamChunkMaxChunks"]),a=ew(i?.options,s,"fullChunkedFallback"),u=ew(i?.options,s,"streamChunkedFallback"),c=!1,d=null,f=null;const h=new Ioe;let m=null;const v=()=>(m||(m=new Nse(n)),m);let k=null;const w=()=>(k||(k=new Dse(h)),k);let b=null;const _=()=>(b||(b=new jE),b),g=A=>!c&&!!d&&!Hse(A,d),x=(A,E)=>o==="default"&&!c&&m===null&&f!==null&&A.parse===f&&g(A)&&!A.stream.enabled&&E<(A.options.autoUnboundedThresholdChars??4e6)&&A.options.html===!1&&A.options.xhtmlOut===!1&&A.options.breaks===!1&&A.options.langPrefix==="language-"&&A.options.linkify===!1&&A.options.typographer===!1&&A.options.highlight===null,S=(A,E)=>o==="default"&&!c&&g(A)&&!A.stream.enabled&&!A.options.fullChunkedFallback&&E<(A.options.autoUnboundedThresholdChars??4e6)&&A.options.html===!1&&A.options.linkify===!1&&A.options.typographer===!1,T={core:h,block:h.block,inline:h.inline,get linkify(){const A=_();return Object.defineProperty(this,"linkify",{value:A,writable:!0,configurable:!0}),A},get renderer(){const A=v();return Object.defineProperty(this,"renderer",{value:A,writable:!0,configurable:!0}),A},options:n,__explicitFullChunkConfig:r,__explicitStreamChunkConfig:l,__explicitFullChunkFallbackSetting:a,__explicitStreamChunkFallbackSetting:u,__canUseImplicitLargeInputStrategy(){return g(this)},set(A){const E=JC(A);return this.options={...this.options,...E},(vr(A,"fullChunkSizeChars")||vr(A,"fullChunkSizeLines")||vr(A,"fullChunkMaxChunks"))&&(r=!0,this.__explicitFullChunkConfig=!0),(vr(A,"streamChunkSizeChars")||vr(A,"streamChunkSizeLines")||vr(A,"streamChunkMaxChunks"))&&(l=!0,this.__explicitStreamChunkConfig=!0),vr(A,"fullChunkedFallback")&&(a=!0,this.__explicitFullChunkFallbackSetting=!0),vr(A,"streamChunkedFallback")&&(u=!0,this.__explicitStreamChunkFallbackSetting=!0),m&&m.set(E),typeof E.stream=="boolean"&&(this.stream.enabled=E.stream,k&&(k.reset(),k.resetStats())),this},configure(A){const E=typeof A=="string"?XC[A]:A;if(!E)throw new Error("Wrong `markdown-it` preset, can't be empty");if(E.options&&this.set(E.options),E.components){const P=E.components;P.core?.rules&&this.core.ruler.enableOnly(P.core.rules),P.block?.rules&&this.block.ruler.enableOnly(P.block.rules),P.inline?.rules&&this.inline.ruler.enableOnly(P.inline.rules),P.inline2?.rules&&this.inline.ruler2.enableOnly(P.inline2.rules)}return this},enable(A,E){const P=Array.isArray(A)?A:[A],D=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],I=new Set;for(const $ of D){if(!$)continue;const B=$.enable(P,!0);for(let H=0;H!I.has(B));if($.length)throw new Error(`Rules manager: invalid rule name ${$.join(", ")}`)}return this},disable(A,E){const P=Array.isArray(A)?A:[A],D=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],I=new Set;for(const $ of D){if(!$)continue;const B=$.disable(P,!0);for(let H=0;H!I.has(B));if($.length)throw new Error(`Rules manager: invalid rule name ${$.join(", ")}`)}return this},use(A,...E){const P=typeof A=="function"?A:A&&typeof A.default=="function"?A.default:void 0;if(!P)throw new TypeError("MarkdownIt.use: plugin must be a function");const D=[this,...E],I=A;return c=!0,P.apply(I,D),this},render(A,E){let P;if(x(this,A.length)){E!==void 0&&(vi(E),P=g9("render"));const $=P?id():0,B=P?WC(A,P):zC(A);if(P&&(P.attemptMs=id()-$,B===null&&(P.fallbackReason="unsupported-stock-subset"),tf(E,P)),B!==null)return E!==void 0&&ss(E,{area:"render",path:"stock-fast",reason:"stock-subset"}),B}const D=E??{},I=this.parse(A,D);return P&&tf(D,P),v().render(I,this.options,D)},async renderAsync(A,E){let P;if(x(this,A.length)){E!==void 0&&(vi(E),P=g9("render"));const $=P?id():0,B=P?WC(A,P):zC(A);if(P&&(P.attemptMs=id()-$,B===null&&(P.fallbackReason="unsupported-stock-subset"),tf(E,P)),B!==null)return E!==void 0&&ss(E,{area:"render",path:"stock-fast",reason:"stock-subset"}),B}const D=E??{},I=this.parse(A,D);return P&&tf(D,P),v().renderAsync(I,this.options,D)},renderIterable(A,E={}){const P=this.parseIterable(A,E);return v().render(P,this.options,E)},async renderAsyncIterable(A,E={}){const P=await this.parseAsyncIterable(A,E);return v().renderAsync(P,this.options,E)},renderInline(A,E={}){const P=this.parseInline(A,E);return v().render(P,this.options,E)},validateLink:bI,normalizeLink:CI,normalizeLinkText:wI,utils:rte,helpers:{...Zte},parse(A,E){if(typeof A!="string")throw new TypeError("Input data should be a String");if(E!==void 0&&vi(E),S(this,A.length)){const $=E===void 0?void 0:g9("parse"),B=$?id():0,H=Woe(A,$);if($&&($.attemptMs=id()-B,H===null&&($.fallbackReason="unsupported-stock-subset"),tf(E,$)),H!==null)return E!==void 0&&ss(E,{area:"parse",path:"stock-fast",reason:"stock-subset"}),H}const P=E??{};let D;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&g(this)){const $=FI(this,A.length);if($==="yes"){const B=zf(this,A,P);return ss(E,{area:"parse",path:"auto-unbounded",unbounded:!0,reason:"char-threshold"}),B}$==="need-lines"&&(D=Wo(A))}if(!this.stream.enabled){const $=A.length,B=this.options.autoTuneChunks!==!1,H=r,O=!a&&g(this),F=!!this.options.fullChunkedFallback,U=O&&$>=2e5;let z;(F||U||D!==void 0)&&(z=D??Wo(A));const W=(F||U)&&B&&!H?xse($,z,this.options):null;if(F||U){const K=z??0;if(F?$>=(this.options.fullChunkThresholdChars??2e4)||K>=(this.options.fullChunkThresholdLines??400):U){if(W&&W.strategy!=="plain"){const V=Gm(this,A,P,{maxChunkChars:W.maxChunkChars,maxChunkLines:W.maxChunkLines,fenceAware:W.fenceAware,maxChunks:W.maxChunks});return E&&tw(E,F?"explicit-full-chunk":"default-large-string"),V}if(F){const V=(oe,ye,G)=>oeG?G:oe,ie=this.options.fullChunkAdaptive!==!1,ne=this.options.fullChunkTargetChunks??8,X=V(Math.ceil($/ne),8e3,64e3),le=V(Math.ceil(K/ne),150,700),Ie=ie?X:this.options.fullChunkSizeChars??1e4,de=ie?le:this.options.fullChunkSizeLines??200,pe=ie?V(Math.ceil($/64e3),ne,32):this.options.fullChunkMaxChunks,ve=Gm(this,A,P,{maxChunkChars:Ie,maxChunkLines:de,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:pe});return E&&tw(E,"explicit-full-chunk"),ve}}}if(D!==void 0&&g(this)&&NI(this,$,z??D)){const K=zf(this,A,P);return ss(E,{area:"parse",path:"auto-unbounded",unbounded:!0,reason:"line-threshold"}),K}}const I=Ri(A);return ss(E,{area:"parse",path:"plain",reason:"default-plain"}),Hd(P,I,()=>h.parse(A,P,this).tokens)},parseIterable(A,E={}){return vi(E),bse(this,A,E)},parseAsyncIterable(A,E={}){return vi(E),Cse(this,A,E)},parseIterableToSink(A,E,P={}){return vi(P),wse(this,A,E,P)},parseAsyncIterableToSink(A,E,P={}){return vi(P),_se(this,A,E,P)},parseInline(A,E={}){if(typeof A!="string")throw new TypeError("Input data should be a String");vi(E),Vp(E)&&la(E);const P=h.createState(A,E,this);return P.inlineMode=!0,h.process(P),P.tokens}};if(T.stream={enabled:!!n.stream,parse(A,E){return T.stream.enabled?w().parse(A,E,T):T.parse(A,E??{})},reset(){w().reset()},peek(){return k?k.peek():[]},stats(){return k?k.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:"idle"}},resetStats(){k&&k.resetStats()}},i?.components){const A=i.components;A.core?.rules&&T.core.ruler.enableOnly(A.core.rules),A.block?.rules&&T.block.ruler.enableOnly(A.block.rules),A.inline?.rules&&T.inline.ruler.enableOnly(A.inline.rules),A.inline2?.rules&&T.inline.ruler2.enableOnly(A.inline2.rules)}return d=Bse(T),f=T.parse,T}var Wse=zse;const BI=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Use=["a","abbr","b","bdi","bdo","button","cite","code","data","del","dfn","em","font","i","ins","kbd","label","mark","q","s","samp","small","span","strong","sub","sup","time","u","var"],HI=["article","aside","blockquote","details","div","figcaption","figure","footer","header","h1","h2","h3","h4","h5","h6","li","main","nav","ol","p","pre","section","summary","table","tbody","td","th","thead","tr","ul"],jse=["svg","g","path"],Vse=["address","audio","body","canvas","caption","colgroup","datalist","dd","dialog","dl","dt","fieldset","form","head","hgroup","html","iframe","legend","map","menu","meter","noscript","object","optgroup","option","output","picture","progress","rp","rt","ruby","script","select","style","template","textarea","tfoot","title","video"],qse=["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onsearch","innerhtml","outerhtml","textcontent","innertext","srcdoc","ping"],Kse=["action","data","href","src","srcset","poster","xlink:href","formaction"],Zse=["script"],Gse=["pre","iframe","picture","script","style","table","tbody","td","tfoot","th","thead","textarea","tr","title","video"],eu=new Set(BI),zI=new Set(HI),Sp=new Set([...BI,...Use,...HI,...jse]),WI=new Set([...Sp,...Vse]),Yse=new Set(qse),Xse=new Set(Kse),Zp=new Set(Zse),UI=new Set(Gse);function jI(e){let t="";for(const n of e){const o=n.charCodeAt(0);o<=31||o>=127&&o<=159||/\s/u.test(n)||(t+=n)}return t}const Jse={amp:"&",bsol:"\\",colon:":",newline:` +`,sol:"/",tab:" "};function VI(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(t,n,o,s)=>{const i=n??o;if(i){const r=Number.parseInt(i,n?10:16);try{return Number.isFinite(r)?String.fromCodePoint(r):""}catch{return""}}return Jse[String(s??"").toLowerCase()]??t})}const ph=new Set(["http","https","mailto","tel"]),Qse=new Set(["javascript","vbscript","data","file","ftp","blob","filesystem","intent","chrome","chrome-extension","moz-extension","ms-browser-extension","view-source"]),Nu=new Set(["http","https"]);function qI(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??""}const eie=/^https?:\/\//i;function tie(e){if(!eie.test(e))return!1;for(const t of e){const n=t.charCodeAt(0);if(t==="&"||n<=32||n>=127&&n<=159||n>127&&/\s/u.test(t))return!1}return!0}function nie(e,t,n){if(!jf(t,n)||!e.startsWith("file:///"))return!1;const o=e.charAt(8);return o!=="/"&&o!=="\\"}function jf(e,t){return e?(e==="a"||e==="area")&&(!t||t==="href"||t==="xlink:href"):!t||t==="href"}function oie(e,t){return t==="href"||t==="xlink:href"?jf(e,t)?ph:Nu:t==="src"||t==="srcset"||t==="poster"||t==="action"||t==="formaction"||t==="data"?Nu:(jf(e,t),ph)}function lc(e,t={}){if(tie(e))return!1;const n=jI(VI(e)).toLowerCase(),o=String(t.tagName??"").toLowerCase(),s=String(t.attrName??"").toLowerCase();if(!n)return!1;if(n.startsWith("data:")){const r=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return o==="img"&&s==="src"?!r:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith("/")||n.startsWith("./")||n.startsWith("../")||n.startsWith("#")||n.startsWith("?"))return!1;const i=qI(n);return i?i==="file"?!nie(n,o,s):jf(o,s)?Qse.has(i):!oie(o,s).has(i):!1}function sie(e){const t=VI(String(e??"")).trim();if(!t||t.startsWith("#")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")||t.startsWith("?"))return!1;const n=qI(jI(t).toLowerCase());return n==="http"||n==="https"}function iie(e,t={}){const n=String(e??"").trim();return n?lc(n,t)?"":n:""}function nw(e){return iie(e,{tagName:"img",attrName:"src"})}function rie(e,t,n){function o(f){return f.trim().split(" ",2)[0]===t}function s(f,h,m,v,k){return f[h].nesting===1&&f[h].attrJoin("class",t),k.renderToken(f,h,m,v,k)}n=n||{};const i=3,r=n.marker||":",l=r.charCodeAt(0),a=r.length,u=n.validate||o,c=n.render||s;function d(f,h,m,v){let k,w=!1,b=f.bMarks[h]+f.tShift[h],_=f.eMarks[h];if(l!==f.src.charCodeAt(b))return!1;for(k=b+1;k<=_&&r[(k-b)%a]===f.src[k];k++);const g=Math.floor((k-b)/a);if(g=m||(b=f.bMarks[T]+f.tShift[T],_=f.eMarks[T],b<_&&f.sCount[T]=4)){for(k=b+1;k<=_&&r[(k-b)%a]===f.src[k];k++);if(!(Math.floor((k-b)/a)=2){const r=Number(i[0]),l=Number(i[1]);Number.isFinite(r)&&Number.isFinite(l)&&(s.map=[r+t,Math.min(l+t,n)])}Array.isArray(s.children)&&KI(s.children,t,n)}}function aie(e){["admonition","info","warning","error","tip","danger","note","caution"].forEach(t=>{e.use(rie,t,{render(n,o){return n[o].nesting===1?`
      `:`
      +`}})}),e.block.ruler.before("fence","vmr_container_fallback",(t,n,o,s)=>{const i=t,r=i.bMarks[n]+i.tShift[n],l=i.eMarks[n],a=i.src.slice(r,l),u=a.match(/^:::\s*([^\s{]+)/);if(!u)return!1;const c=u[1];if(!c.trim())return!1;const d=a.slice(u[0].length).trim();let f,h;const m=d.indexOf("{"),v=m>=0?d.slice(m).trimStart():void 0;if(m===-1)f=d||void 0;else{if(f=d.slice(0,m).trim()||void 0,v?.startsWith("{")){let S=0,T=-1;for(let A=0;A0&&(h=v.slice(0,T))}h||(f=d||void 0)}if(s)return!0;const k=!!i.env.__markstreamFinal;let w=n+1,b=!1;for(;w<=o;){const S=i.bMarks[w]+i.tShift[w],T=i.eMarks[w];if(i.src.slice(S,T).trim()===":::"){b=!0;break}w++}b||(w=o);const _=i.push("vmr_container_open","div",1);if(_.attrSet("class",`vmr-container vmr-container-${c}`),_.map=[n,b?w:o],_.meta={..._.meta??{},unclosed:!b&&!k},f&&_.attrSet("data-args",f),h)try{const S=JSON.parse(h);for(const[T,A]of Object.entries(S)){const E=A!=null&&typeof A=="object";_.attrSet(`data-${T}`,E?JSON.stringify(A):String(A))}}catch{const S=lie(h);if(S)for(const[T,A]of Object.entries(S)){const E=A!=null&&typeof A=="object";_.attrSet(`data-${T}`,E?JSON.stringify(A):String(A))}else _.attrSet("data-attrs",h)}const g=[];for(let S=n+1;SS.trim().length>0)){let S=g.join(` +`);S.endsWith(` +`)||(S+=` +`),S.endsWith(` + +`)||(S+=` +`);const T=i.tokens[i.tokens.length-1];T&&(T.raw=S);const A=[];i.md.block.parse(S,i.md,i.env,A),KI(A,n+1,n+1+g.length),i.tokens.push(...A)}const x=i.push("vmr_container_close","div",-1);return b||(x.hidden=!0,x.map=[o,o]),i.line=b?w+1:w,!0},{alt:["paragraph","reference","blockquote","list"]})}function Gr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Vo(e){let t=!1,n=!1;for(let o=0;o")return o}return-1}function w2(e){const t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=o[2]||o[3]||o[4]||"";t.push([s,i])}return t}const uie=/^[a-z][a-z0-9_-]*$/;function ow(e){return uie.test(String(e??"").trim().toLowerCase())}function Sr(e){const t=String(e??"").trim();if(!t)return"";if(!t.startsWith("<"))return ow(t)?t.toLowerCase():"";let n=1;for(;n]/.test(i)?"":ow(s)?s:""}function Ec(e){if(!e||e.length===0)return[];const t=new Set,n=[];for(const o of e){const s=Sr(o);!s||t.has(s)||(t.add(s),n.push(s))}return n}function cie(...e){const t=new Set,n=[];for(const o of e)for(const s of Ec(o))t.has(s)||(t.add(s),n.push(s));return n}function die(e){const t=Ec(e);return{key:t.join(","),tags:t}}function ZI(e){return Sr(e)}function fie(e,t){const n=String(e??""),o=Sr(t);if(!o)return!1;const s=Gr(o),i=n.match(new RegExp(String.raw`^\s*<\s*${s}(?:\s[^>]*)?(\s*\/)?>`,"i"));return i?i[1]?!0:new RegExp(String.raw`<\s*\/\s*${s}\s*>`,"i").test(n):!1}function GI(e,t){const n=Sr(t);return!!n&&!Sp.has(n)&&!fie(e,n)}function pie(e,t){const n=String(e??""),o=Sr(t);if(!o)return n;const s=Gr(o),i=new RegExp(String.raw`^\s*<\s*${s}(?:\s[^>]*)?>\s*`,"i"),r=new RegExp(String.raw`\s*<\s*\/\s*${s}\s*>\s*$`,"i");return n.replace(i,"").replace(r,"")}const YI=eu,hie=Sp,XI=new Set(zI);XI.delete("details");const mie=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,gie=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,H3=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,vie=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function Xm(e){return(e.match(H3)?.[1]??"").toLowerCase()}function Gy(e){return/^\s*<\s*\//.test(e)}function Yy(e,t){return YI.has(t)||/\/\s*>\s*$/.test(e)}function yie(e,t){let n=0;for(let o=0;o0&&n--;continue}Yy(s,i)||n++}}return n}function sw(e,t,n=0){const o=new RegExp(String.raw`<\s*(\/?)\s*${Gr(t)}(?=[\s>/])[^>]*>`,"gi");o.lastIndex=Math.max(0,n);let s=0,i;for(;(i=o.exec(e))!==null;){const r=i[0]??"",l=!!i[1],a=!l&&/\/\s*>$/.test(r);if(l){if(s===0)return{start:i.index,end:i.index+r.length};s--;continue}a||s++}return null}function bie(e,t){const n=new RegExp(String.raw`<\s*(\/?)\s*${Gr(t)}(?=[\s>/])[^>]*>`,"gi");let o=0,s;for(;(s=n.exec(e))!==null;){const i=s[0]??"",r=!!s[1],l=!r&&/\/\s*>$/.test(i);if(r){o>0&&o--;continue}l||o++}return o}function Jm(e){const t=e;return String(t.raw??t.content??t.markup??"")}function Cie(e){const t=e;return t.meta||(t.meta={}),t.meta}function T9(e,t,n){const o=Cie(e);o.markstreamCustomHtmlRaw=t,o.markstreamCustomHtmlInner=n}function wie(e,t){if(!t.size)return;const n=Array.from(t,h=>new RegExp(String.raw`<\s*${Gr(h)}(?=[\s>/])`,"i")),o=[];let s=!1;const i=h=>h?n.some(m=>m.test(h)):!1,r=h=>{if(!(!h||!o.length))for(const m of o)m.raw+=h,m.inner+=h},l=()=>{!o.length||!s||(r(` +`),s=!1)},a=h=>{r(h)},u=h=>{for(let v=0;v{const m=o[o.length-1]?.tag;if(!m)return null;const v=new RegExp(String.raw`^\s*<\s*\/\s*${Gr(m)}\s*>`,"i");return h.match(v)?.[0]??null},d=h=>!!c(h),f=(h,m,v)=>{const k=v??(h.type==="html_inline"?Xm(m):"");if(!(k&&t.has(k))){r(m);return}const w=Gy(m),b=!w&&Yy(m,k);if(w){if(!o.length||o[o.length-1].tag!==k){r(m);return}u(m);return}if(r(m),b){T9(h,m,"");return}o.push({tag:k,token:h,raw:m,inner:""})};for(const h of e){if(h.type==="inline"&&Array.isArray(h.children)){const m=String(h.content??"");if(d(m)?s=!1:l(),!o.length&&!i(m)){s=!1;continue}let v=0,k=!0;for(const w of h.children){const b=Jm(w),_=w.type==="html_inline"?Xm(b):"",g=_&&t.has(_);let x=b;if(k&&m&&b&&(o.length||g)){const S=m.indexOf(b,v);if(S!==-1)a(m.slice(v,S)),x=m.slice(S,S+b.length),v=S+b.length;else{if(o.length&&!g)continue;k=!1}}f(w,x,_)}k&&m&&v0;continue}if(o.length&&typeof h.content=="string"){const m=Jm(h),v=h.type==="html_block"?c(m):null;if(v){u(`${s?` +`:""}${v}`),s=o.length>0;continue}if(!h.content)continue;l(),r(h.content),s=!0}}for(const h of o)T9(h.token,h.raw,h.inner)}function _ie(e){return/^\s*<\s*[!?]/.test(e)}function xie(e){const t=new Set(hie);if(e&&Array.isArray(e))for(const n of e){const o=String(n??"").trim();if(!o)continue;const s=o.match(/^[<\s/]*([A-Z][\w-]*)/i);s&&t.add(s[1].toLowerCase())}return t}function iw(e,t){if(t.has(e))return!0;for(const n of t)if(n.startsWith(e))return!0;return!1}function Sie(e,t){let n=null;for(const i of e.matchAll(mie)){const r=i.index??-1;if(r<0)continue;const l=(i[1]??"").toLowerCase();iw(l,t)&&Vo(e.slice(r))===-1&&(!n||r")&&(!n||i")&&(!n||i{const h=f,m=new Set(n),v=Array.isArray(h.env?.__markstreamCustomHtmlTags)?h.env.__markstreamCustomHtmlTags:[];for(const _ of v){const g=Sr(String(_??""));g&&m.add(g)}const k=xie(Array.from(m)),w=new Set(Tie);for(const _ of m)w.add(_);return{autoCloseInlineTagSet:w,commonHtmlTags:k,customTagSet:m,shouldMergeHtmlBlockTag:_=>m.has(_)||!k.has(_)||XI.has(_)}},s=f=>{if(f.type==="html_block")return String(f.content??"");if(f.type!=="inline"||!Array.isArray(f.children)||f.children.length!==1)return"";const h=f.children[0];return h?.type!=="html_block"?"":String(f.content??h.content??"")},i=(f,h)=>{f.type="html_block",f.content=h,f.raw=h,f.children=[]},r=f=>f.replace(/^(?:\r?\n)+/,""),l=f=>/^(?: {4}|\t)/.test(f),a=f=>f.replace(/^(?: {4}|\t)/gm,""),u=(f,h)=>{const m=r(f);if(!/\S/.test(m))return[];if(l(m))return[{type:"code_block",content:a(m),raw:m}];const v=m.replace(/^[\t ]+/,"");if(!v)return[];if(v.startsWith("<"))return[{type:"html_block",content:v}];const k={type:"inline",tag:"",nesting:0,content:v,children:[{type:"text",content:v,raw:v}]};return h==="paragraph"?[{type:"paragraph_open",tag:"p",nesting:1},k,{type:"paragraph_close",tag:"p",nesting:-1}]:h==="text"?[{type:"text",content:v,raw:v}]:[k]},c=(f,h,m)=>f[h-1]?.type==="paragraph_open"&&f[h+1]?.type==="paragraph_close"?"inline":m,d=(f,h)=>{const m=r(h);return!/\S/.test(m)||f.type!=="inline"||!Array.isArray(f.children)?!1:(f.content=`${String(f.content??"")}${m}`,f.children.push({type:"text",content:m,raw:m}),!0)};e.core.ruler.after("inline","fix_html_inline_streaming",f=>{const h=f.tokens??[],{commonHtmlTags:m,customTagSet:v}=o(f);for(const k of h){const w=k;if(w.type!=="inline"||!Array.isArray(w.children))continue;const b=String(w.content??""),_=w.children.length?w.children:b.includes("<")?[{type:"text",content:b,raw:b}]:null;if(_)try{const g=Mie(_,m);if(w.children=g.children,g.pendingBuffer){const x=b.lastIndexOf(g.pendingBuffer);if(x!==-1){const S=b.slice(0,x);w.content=S,typeof w.raw=="string"&&(w.raw=S)}}}catch(g){console.error("[applyFixHtmlInlineTokens] failed to fix streaming html inline",g)}}wie(h,v)}),e.core.ruler.push("fix_html_inline_tokens",f=>{const h=f.tokens??[],{autoCloseInlineTagSet:m,customTagSet:v,shouldMergeHtmlBlockTag:k}=o(f),w=[];for(let b=0;b0){const[x,S]=w[w.length-1];if(b!==S){if(_.type==="paragraph_open"||_.type==="paragraph_close"){h.splice(b,1),b--;continue}const T=String(_.content??_.raw??"");if(T){const A=h[S],E=`${String(A.content||"")} +${T}`,P=Vo(E),D=P===-1?null:sw(E,x,P+1);if(D){const I=E.slice(0,D.end),$=E.slice(D.end);A.content=I,A.loading=!1,h.splice(b,1),w.pop();const B=d(A,$)?[]:u($,c(h,b,"paragraph"));B.length&&h.splice(b,0,...B),b--;continue}A.content=E,A.loading!==!1&&(A.loading=!0)}h.splice(b,1),b--;continue}}const g=s(_);if(g){if(_ie(g))continue;const x=(g.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??"").toLowerCase(),S=/^\s*<\s*\//.test(g);if(!x||!k(x))continue;if(i(_,g),!S)x&&!new RegExp(`^\\s*<\\s*${x}\\b[^>]*\\/\\s*>`,"i").test(g)&&bie(g,x)>0&&w.push([x,b]);else if(w.length>0&&x&&w[w.length-1][0]===x){const[,T]=w[w.length-1],A=h[T];A.content=`${String(A.content||"")} +${g}`,A.loading=!1,w.pop(),h.splice(b,1),b--}continue}else if(w.length>0){if(_.type==="paragraph_open"||_.type==="paragraph_close"){h.splice(b,1),b--;continue}const x=_.content||"",S=new RegExp(`<\\s*\\/\\s*${w[w.length-1][0]}\\s*>`,"i").test(x);if(x){const[,T]=w[w.length-1],A=h[T];A.content=`${A.content||""} +${x}`,A.loading!==!1&&(A.loading=!S)}S&&w.pop(),h.splice(b,1),b--}else continue}if(v.size>0){const b=new Map,_=new Map,g=T=>{let A=b.get(T);return A||(A=new RegExp(`<\\s*${T}\\b`,"i"),b.set(T,A)),A},x=T=>{let A=_.get(T);return A||(A=new RegExp(`<\\s*\\/\\s*${T}\\s*>`,"i"),_.set(T,A)),A},S=[];for(let T=0;T0){const D=S[S.length-1],I=h[D.index],$=A.type==="html_block"?x(D.tag).exec(E):null;if($){const O=$.index+$[0].length,F=E.slice(0,O),U=E.slice(O);I.content=`${String(I.content??"")} +${F}`,Array.isArray(I.children)&&I.children.push({type:"html_inline",content:``,raw:``}),S.pop();const z=d(I,U)?[]:u(U,c(h,T,"paragraph"));z.length?h.splice(T,1,...z):(h.splice(T,1),T--);continue}if(A.type!=="inline")continue;const B=Array.isArray(A.children)?A.children:[],H=yie(B,D.tag);if(H!==-1){const O=B.slice(0,H+1),F=B.slice(H+1),U=O.map(z=>String(z?.content??z?.raw??"")).join("");if(I.content=`${String(I.content??"")} +${U}`,Array.isArray(I.children)&&I.children.push(...O),F.length){const z=F.map(W=>String(W.content??W.raw??"")).join("");if(z.trim()){const W=z.replace(/^\s+/,"");if(d(I,z))h.splice(T,1),T--;else if(W.startsWith("<"))h.splice(T,1,{type:"html_block",content:W});else{const K=u(z,c(h,T,"paragraph"));h.splice(T,1,...K)}}else h.splice(T,1),T--}else h.splice(T,1),T--;S.pop();continue}I.content=`${String(I.content??"")} +${E}`,Array.isArray(I.children)&&I.children.push(...B),h.splice(T,1),T--;continue}if(A.type!=="inline")continue;const P=Array.isArray(A.children)?A.children:[];for(const D of v)if((P.length?kie(P,D):g(D).test(E)&&!x(D).test(E)?1:0)>0){S.push({tag:D,index:T});break}}}{let b=0;for(let _=0;_0?b--:(h.splice(_,1),_--))}}for(let b=0;b/]+)/)?.[1]??"").toLowerCase();if(A.startsWith("!")||A.startsWith("?")){_.loading=!1;continue}if(v.has(A)){const H=String(_.content??""),O=Vo(H),F=O===-1?null:sw(H,A,O+1);_.loading=F?!1:_.loading!==void 0?_.loading:!0;const U=F?.start??-1,z=F?F.end-F.start:0;if(U!==-1){const W=H.slice(0,U+z);let K="";O!==-1&&O]+)))?/g;let P;for(;(P=E.exec(_.content||""))!==null;)P[1],P[2]||P[3]||P[4];const D=String(_.content??""),I=new RegExp(`<\\/\\s*${A}\\s*>`,"i").exec(D),$=I?I.index:-1,B=I?I[0].length:0;if($!==-1){const H=D.slice(0,$+B),O=(D.slice($+B)||"").replace(/^\s+/,"");_.children=[{type:"html_block",content:H,tag:A,loading:!1}],_.content=H,_.raw=H,O&&h.splice(b+1,0,O.startsWith("<")?{type:"html_block",content:O}:{type:"text",content:O,raw:O})}else _.children=[{type:"html_block",content:_.content,tag:A,loading:!0}];continue}if(!_||_.type!=="inline")continue;if(_.children.length===2&&_.children[0].type==="html_inline"){const A=(_.children[0].content?.match(/<([^\s>/]+)/)?.[1]??"").toLowerCase(),E=_.children[1],P=String(E?.content??"").match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??"";if(E?.type==="html_inline"&&P===A)continue;m.has(A)?(_.children[0].loading=!0,_.children[0].tag=A,_.children.push({type:"html_inline",tag:A,loading:!0,content:``})):_.children=[{type:"html_block",loading:!0,tag:A,content:String(_.children[0]?.content??"")+String(_.children[1]?.content??"")}];continue}else if(_.children.length===3&&_.children[0].type==="html_inline"&&_.children[2].type==="html_inline"){const A=(_.children[0].content?.match(/<([^\s>/]+)/)?.[1]??"").toLowerCase();if(m.has(A))continue;_.children=[{type:"html_block",loading:!1,tag:A,content:_.children.map(E=>E.content).join("")}];continue}if(!_.content?.startsWith("<")||_.children?.length!==1)continue;const g=String(_.content),x=_,S=x.children[0];if(S?.type!=="html_inline"){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(g)&&(x.children.length=0);continue}const T=String(S.content??g).match(vie)?.[1]?.toLowerCase()??"";if(T){if(/\/\s*>\s*$/.test(g)||YI.has(T)){x.children=[{type:"html_inline",content:g}];continue}x.children.length=0}}})}function Iie(e){const t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function Lie(e,t={}){t.enabled!==!1&&e.core.ruler.after("inline","fix_indented_code_block",n=>{const o=n.tokens??[];for(let s=0;sa.trim().length>0);if(l.length===1&&!Iie(l[0]??"")){const a=l[0]??"",u=i.level??0;o.splice(s,1,{type:"paragraph_open",tag:"p",nesting:1,level:u},{type:"inline",tag:"",nesting:0,level:u,content:a,children:[{type:"text",content:a,level:u+1,raw:a}],block:!0},{type:"paragraph_close",tag:"p",nesting:-1,level:u}),s+=2}}})}const JI=/\.([a-z0-9]{1,15})$/i,$ie=/[_()[\]{}<>]/u,Nie=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,Fie=/[?#@]/u,Rie=/[\\/]/u,Oie=/^[\p{L}\p{N}./\\-]+$/u,Pie=/^[A-Za-z0-9-]{1,63}$/u,Die=/^xn--[a-z0-9-]{2,59}$/i,Bie=/^(?:[A-Z]{1,6}|\d{1,8})$/u,Hie=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,zie=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,Wie=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,Uie=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,jie=2e3,Vie=512,qie={},Kie=new Set(["ai","md","py","rs","sh","zip"]),QI=new Set(["as","bj","de","hk","l","ln","ny","pa","sh","ss","sz","t","us"]),Zie=new Set([...QI,"at","ax","cn","co","it","jp","ks","mc","mx","nz","pl","sa","si","to","tw"]),Gie=new Set(["com","dev","io","page","site"]),Yie=new Set(["app","apk","dmg","exe","ipa","lock","log","markdown","webmanifest"]),Xie=new Set(["7z","ai","astro","avi","bash","bz2","c","cjs","cpp","cs","csv","doc","docx","fish","flac","gif","go","gz","h","hpp","html","java","jpeg","jpg","js","json","jsx","kt","md","mdx","mjs","mov","mp3","mp4","pdf","php","png","ppt","pptx","ps1","py","rar","rb","rs","sh","sql","svg","swift","svelte","tar","tgz","toml","ts","tsx","txt","vue","wav","webp","xls","xlsx","xml","yaml","yml","zip","zsh"]),Ju=new Map;function rw(e,t){if(!e||e.length>Vie)return t;for(Ju.set(e,t);Ju.size>jie;){const n=Ju.keys().next().value;if(!n)break;Ju.delete(n)}return t}function Ap(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function E9(e,t){const n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return Ap(n)?n:void 0}function lw(e,t){if(!Ap(t))return e;const n=e?.__linkifyDemotionContext;return{...e,__linkifyDemotionContext:{filename:n?.filename||t?.filename,explicitFilename:n?.explicitFilename||t?.explicitFilename,marketTicker:n?.marketTicker||t?.marketTicker}}}function aw(e){const t=Gp(e);return Ap(t)?t:void 0}function Jie(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,"").replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,"")}function uw(e,t){if(!Ap(t))return;const n=String(e??"").trim().split(/\s+/u).map(Jie).filter(Boolean);if(n.length===0)return;const o={};return t?.filename&&n.every(s=>Qm(s,{filename:!0,explicitFilename:t.explicitFilename}))&&(o.filename=!0),t?.explicitFilename&&o.filename&&(o.explicitFilename=!0),t?.marketTicker&&n.every(s=>Qm(s,{marketTicker:!0}))&&(o.marketTicker=!0),Ap(o)?o:void 0}function fu(e,t=!1){let n;return{options(o){return t||o==null?lw(e,n):lw(e,E9(aw(o),uw(o,n)))},remember(o){const s=aw(o);n=t?E9(n,s):E9(s,uw(o,n))},reset(){n=void 0}}}function cw(e){return Pie.test(e)&&!e.startsWith("-")&&!e.endsWith("-")}function Qie(e){const t=e.split(".");if(t.length<2)return!1;const n=t[t.length-1]?.toLowerCase()??"";return cw(n)||Die.test(n)?t.every(cw):!1}function eL(e){return Array.from(e).some(t=>t.charCodeAt(0)>127)}function ere(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0]??""}function tre(e){return e.split(".").some(t=>t.toLowerCase().startsWith("xn--"))}function tL(e,t,n){const o=ere(t);return eL(e)&&tre(o)&&String(n??"").toLowerCase().includes(o.toLowerCase())}function nre(e){if(!e)return!1;if(e.includes("文件")||e.includes("附件")||e.includes("路径")||e.includes("路徑")||e.includes("文档")||e.includes("文檔")||e.includes("档案")||e.includes("檔案")||e.includes("资料")||e.includes("資料")||e.includes("股票")||e.includes("证券")||e.includes("證券")||e.includes("代码")||e.includes("代碼")||e.includes("交易所")||e.includes("后缀")||e.includes("後綴")||e.includes("市场")||e.includes("市場"))return!0;const t=e.toLowerCase();return t.includes("file")||t.includes("attachment")||t.includes("document")||t.includes("doc")||t.includes("path")||t.includes("ticker")||t.includes("symbol")||t.includes("exchange")}function Gp(e){const t=String(e??""),n=Ju.get(t);return n?(Ju.delete(t),Ju.set(t,n),n):nre(t)?rw(t,{explicitFilename:zie.test(t),filename:Wie.test(t),marketTicker:Uie.test(t)}):rw(t,qie)}function ore(e){return Qie(e.split(/[\\/]/)[0]??"")}function sre(e){const t=e.replace(/[^a-z]/gi,"");return t.length>=2&&t===t.toUpperCase()}function ire(e){if($ie.test(e)||!Oie.test(e))return!0;if(Rie.test(e))return!ore(e);const t=e.replace(JI,"");return eL(t)?!0:t.split(".").filter(Boolean).some(sre)}function rre(e,t,n){if(!(n?Zie:QI).has(t))return!1;const o=e.slice(0,-(t.length+1));return o===""?e.startsWith("."):(n?Hie:Bie).test(o)}function Qm(e,t={}){if(!e||Nie.test(e)||Fie.test(e))return!1;const n=e.match(JI);if(!n)return!1;const o=String(n[1]??"").toLowerCase();return rre(e,o,t.marketTicker===!0)?!0:Xie.has(o)?!Kie.has(o)||t.filename?!0:ire(e):!!(t.explicitFilename&&Gie.has(o)||t.filename&&Yie.has(o))}const dw=["!"];function $i(e){return{type:"text",content:e,raw:e}}function Fu(e,t){t===1?e.push({type:"em_open",tag:"em",nesting:1}):t===2?e.push({type:"strong_open",tag:"strong",nesting:1}):t===3&&(e.push({type:"strong_open",tag:"strong",nesting:1}),e.push({type:"em_open",tag:"em",nesting:1}))}function Ru(e,t){t===1?e.push({type:"em_close",tag:"em",nesting:-1}):t===2?e.push({type:"strong_close",tag:"strong",nesting:-1}):t===3&&(e.push({type:"em_close",tag:"em",nesting:-1}),e.push({type:"strong_close",tag:"strong",nesting:-1}))}function _a(e,t,n){let o="";if(t.includes('"')){const s=t.split('"');t=s[0].trim(),o=s[1].trim()}return{type:"link",loading:n,href:t,title:o,text:e,children:[{type:"text",content:e,raw:e}],raw:`[${e}](${t})`}}function lre(e,t){if(!(!e||!t)&&(e.href=String(e.href??"")+t,e.text=String(e.text??"")+t,e.raw=`[${e.text}](${e.href})`,Array.isArray(e.children)&&e.children.length)){const n=e.children[e.children.length-1];n?.type==="text"?(n.content=String(n.content??"")+t,n.raw=String(n.raw??"")+t):e.children.push($i(t))}}function fw(e,t){let n=-1;for(const o of t){const s=e.indexOf(o);s!==-1&&(n===-1||sn?.[0]==="href")?.[1];return typeof t=="string"?t:""}function ure(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];const n=e.attrs.findIndex(o=>o?.[0]==="href");n>=0?e.attrs[n][1]=t:e.attrs.push(["href",t])}function pw(e,t,n){let o="";for(let s=t+1;s{const n=t.tokens??[];for(let o=0;or.type==="code_inline"),o=new Map;let s=0;for(let r=0;r0&&u?hw(u):-1;if(c!==-1&&u)for(const d of u.slice(c))d==="("?s++:d===")"&&s>0&&s--}a!==-1&&(r=a);continue}if(!(l.type!=="text"||typeof l.content!="string"))for(const a of l.content)a==="("?s++:a===")"&&s>0&&s--}const i=Gp(t);for(let r=0;r<=e.length-1;r++){r<0&&(r=0);const l=e[r];if(!l)break;if(l.type==="link_open"&&(l.markup==="linkify"||l.markup==="autolink")){let a=-1;for(let u=r+1;u0){const m=hw(u);m!==-1&&(d===-1||m=v.content.length){h-=v.content.length;continue}if(h<0)break;const k=v.content[h],w=v.content.slice(0,h);let b=v.content.slice(h);for(let x=m+1;x0&&(e.splice(m+1,_),a=m+1);let g=c;if(k==="!"&&f!==-1)g=c.slice(0,f);else if(b){const x=encodeURI(b);if(x&&c.endsWith(x))g=c.slice(0,c.length-x.length);else{const S=k?encodeURI(k):"",T=S?c.indexOf(S):-1;T!==-1&&(g=c.slice(0,T))}}g!==c&&ure(l,g),b&&e.splice(a+1,0,$i(b));break}}}if(!n){if(l?.type==="em_open"&&e[r-1]?.type==="text"&&e[r-1].content?.endsWith("*")){const a=e[r-1].content?.replace(/(\*+)$/,"")||"";e[r-1].content=a,l.type="strong_open",l.tag="strong",l.markup="**";for(let u=r+1;ud[0]==="href")?.[1]||"";if(e[r+3]?.type==="text"){const d=(e[r+3]?.content??"").indexOf(")"),f=d===-1;d===-1&&(c+=e[r+3]?.content?.slice(0,d)||"",e[r+3].content=""),a.push(_a(u,c,f));const h=e[r+3].content?.replace(/^\)\**/,"");h&&a.push($i(h)),e.splice(r-4,8,...a)}else a.push({type:"link",loading:!0,href:c,title:"",text:u,children:[{type:"text",content:c,raw:c}],raw:`[${u}](${c})`}),e.splice(r-4,7,...a);continue}else if(e[r-1].content==="]("&&e[r-3]?.type==="text"&&e[r-3].content?.endsWith(")"))if(e[r-2]?.type==="strong_open"){const[a,u]=e[r-3].content?.split("[**")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}else if(e[r-2]?.type==="em_open"){const[a,u]=e[r-3].content?.split("[*")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}else{const[a,u]=e[r-3].content?.split("[")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}}if(l.type==="link_close"&&l.nesting===-1&&e[r-2]?.type==="link_open"&&e[r+1]?.type==="text"&&e[r-1]?.type==="text"){const a=e[r-1].content||"",u=e[r-2].attrs||[],c=u.find(w=>w[0]==="href")?.[1]||"",d=u.find(w=>w[0]==="title")?.[1]||"";let f=3,h=2;const m=(e[r-3]?.content||"").match(/^(\*+)$/),v=[];if(m){h+=1;const w=m[1].length;Fu(v,w)}if(l.markup!=="linkify"&&e[r+1].type==="text"&&e[r+1]?.content?.startsWith("](")){f+=1;for(let w=r+1;wk[0]==="href")?.[1];e[r+5]?.type==="text"&&e[r+5].content==="."?(f=(v||f)+e[r+5].content,e[r+5].content=""):f=v||f,h+=3}let m=!0;if(l.nesting===-1&&(d=d.replace(/\*+$/,"")),e[r+2]?.type==="text"){const v=(e[r+2]?.content??"").indexOf(")");m=v===-1,v===-1&&(f+=e[r+2]?.content?.slice(0,v)||"",e[r+2].content="")}a.push(_a(d,f,m)),Ru(a,2),e.splice(r-2,h,...a)}if(l.type==="text"&&/\*+\[[^\]]*$/.test(l.content||"")&&e[r+1]?.type==="strong_open"&&e[r+2]?.type==="text"&&e[r+2].content==="]("&&e[r+3]?.type==="link_open"&&e[r+5]?.type==="link_close"&&e[r+6]?.type==="text"&&e[r+6].content===")"&&e[r+7]?.type==="strong_close"){const a=(l.content||"").match(/^(\*+)\[(.*)$/);if(a){const u=(a[2]||"")+a[1];let c=e[r+3]?.attrs?.find(f=>f[0]==="href")?.[1]||"";!c&&e[r+4]?.type==="text"&&(c=e[r+4].content||"");const d=[];Fu(d,2),d.push(_a(u,c,!1)),Ru(d,2),e.splice(r,9,...d),r-=d.length-1;continue}}}}if(n)return e;for(let r=0;r{const n=t.tokens??[];for(let o=0;o{const n=t.tokens??[];for(let o=0;o=0&&e[m].type==="text"&&e[m].content==="";)m--;const v=e[m];let k=c+1;for(;k=0&&e[m].type==="text"&&e[m].content==="";)m--;const v=e[m];let k=c+1;for(;k{const n=t;try{const o=xre(n.tokens??[],!!n.env?.__markstreamFinal,n.src??"");Array.isArray(o)&&(n.tokens=o)}catch(o){console.error("[applyFixTableTokens] failed to fix table tokens",o)}})}function mw(){return[{type:"table_open",tag:"table",attrs:null,map:null,children:null,content:"",markup:"",info:"",level:0,loading:!0,meta:null},{type:"thead_open",tag:"thead",attrs:null,block:!0,level:1,children:null},{type:"tr_open",tag:"tr",attrs:null,block:!0,level:2,children:null}]}function gw(){return[{type:"tr_close",tag:"tr",attrs:null,block:!0,level:2,children:null},{type:"thead_close",tag:"thead",attrs:null,block:!0,level:1,children:null},{type:"table_close",tag:"table",attrs:null,map:null,children:null,content:"",markup:"",info:"",level:0,meta:null}]}function vw(e){return[{type:"th_open",tag:"th",attrs:null,block:!0,level:3,children:null},{type:"inline",tag:"",children:null,content:e,level:4,attrs:null,block:!0},{type:"th_close",tag:"th",attrs:null,block:!0,level:3,children:null}]}function nL(e,t){if(!e.startsWith("|")||e.includes(` +`)||!e.endsWith("|"))return null;const n=e.slice(1).split("|");return n.at(-1)===""&&n.pop(),n.length>0&&n.every(o=>o.trim().length>0)?n:null}function I9(e){return nL(e)!==null}function oL(e){return/^:?-+:?$/.test(e.trim())}function kre(e){if(!e.startsWith("|"))return!1;const t=e.slice(1).split("|");return t.at(-1)===""&&t.pop(),t.length>0&&t.every(oL)}function bre(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function Cre(e){if(e==="")return!0;if(!e.startsWith("|"))return!1;const t=e.slice(1).split("|"),n=t.at(-1)??"";return t.slice(0,-1).every(oL)&&bre(n)}function wre(e){return e==="|"||e==="|:"}function _re(e){const t=nL(e);return t!==null&&t.every(n=>!n.includes(":"))}function xre(e,t=!1,n=""){const o=[...e];if(e.length<3)return o;const s=e.length-2,i=e[s];if(i.type==="inline"){const r=String(i.content??""),l=r.split(` +`)[0]??"",[a="",u="",...c]=r.split(` +`),d=!t&&!r.includes(` +`)&&/\r?\n$/.test(n)&&I9(r);if(!t&&(r.includes(` +`)&&c.length===0&&I9(a)&&Cre(u)||d)){const f=l.slice(1,-1).split("|").map(m=>m.trim()).flatMap(m=>vw(m)),h=[...mw(),...f,...gw()];o.splice(s-1,3,...h)}else if(r.includes(` +`)&&c.length===0&&I9(a)&&kre(u)){const f=l.slice(1,-1).split("|").map(m=>m.trim()).flatMap(m=>vw(m)),h=[...mw(),...f,...gw()];o.splice(s-1,3,...h)}else r.includes(` +`)&&c.length===0&&_re(a)&&wre(u)&&(i.content=r.slice(0,-2),i.children.splice(2,1))}return o}function Sre(e,t,n,o){const s=e.length;if(n==="$$"&&o==="$$"){let u=t;for(;u=0&&e[c]==="\\";)d++,c--;if(d%2===0)return u}u++}return-1}const i=n[n.length-1],r=o;let l=0,a=t;for(;a=0&&e[c]==="\\";)d++,c--;if(d%2===0){if(l===0)return a;l--,a+=r.length;continue}}const u=e[a];if(u==="\\"){a+=2;continue}u===i?l++:u===r[r.length-1]&&l>0&&l--,a++}return-1}var Are=Sre;const Mre=["boldsymbol","mathbb","mathcal","mathfrak","mathrm","mathit","mathsf","vec","hat","bar","tilde","overline","underline","mathscr","mathnormal","operatorname","mathbf*"],eg=Mre.map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,"\\$&")).join("|"),Tre=/\\[a-z]+/i,sL="(?:\\\\|\\u0008)",Ere=new RegExp(String.raw`${sL}(?:${eg})\s*\{[^}]+\}`,"i"),Ire=new RegExp(String.raw`(?:${sL})?(?:${eg})\s*\{`,"i"),Lre=/\\(?:text|frac|left|right|times)/,$re=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,Nre=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,Fre=/[A-Z]+\s*\([^)]+\)/i,Rre=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,Ore=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,Pre=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,Dre={"\b":"\\b","\v":"\\v","\f":"\\f"};function Bre(e){let t="";for(const n of e)t+=Dre[n]??n;return t}function Oa(e){if(!e)return!1;const t=Bre(e),n=t.trim();if(Pre.test(n)||n.includes("**"))return!1;if(n.length>2e3)return!0;const o=Tre.test(t),s=Ere.test(t),i=Ire.test(t),r=Lre.test(t),l=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),a=$re.test(t)&&!Nre.test(t),u=Fre.test(t),c=Rre.test(n),d=Ore.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),h=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return o||s||i||r||l||a||u||c||d||f||h}const iL="__markstreamMathPluginApplied",z3=80,rL=2e4,yw=rL+4096;function Xy(e){return!!e[iL]}function Hre(e){e[iL]=!0}const lL=["ldots","cdots","quad","in","displaystyle","int_","lim","lim_","ce","pu","end","infty","perp","mid","operatorname","to","rightarrow","leftarrow","math","mathrm","mathit","mathbb","mathcal","mathfrak","implies","alpha","beta","gamma","delta","epsilon","lambda","sum","sum_","prod","sqrt","fbox","boxed","color","rule","edef","fcolorbox","hline","hdashline","cdot","times","pm","le","ge","neq","sin","cos","tan","log","ln","exp","frac","text","left","right"],zre=["cdot","mathbf{","partial","mu_{"],aL=lL.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,"\\$&")).join("|"),uL="[ \r\b\f\v]",Wre=new RegExp(`([^\\\\])(${zre.map(e=>e).join("|")})+`,"g"),Ure=/span\{([^}]+)\}/,jre=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,Vre=/(^|[^\\])\\\r?\n/g,qre=/(^|[^\\])\\$/g,Kre=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,Zre=new RegExp(`(${uL})|(${aL})\\b`,"g"),kw=new Map,bw=new Map;function Gre(e){if(!e)return Zre;const t=[...e];t.sort((r,l)=>l.length-r.length);const n=t.join(""),o=kw.get(n);if(o)return o;const s=`(?:${t.map(r=>r.replace(/[.*+?^${}()|[\\]\\"\]/g,"\\$&")).join("|")})`,i=new RegExp(`(${uL})|(${s})\\b`,"g");return kw.set(n,i),i}function Yre(e,t){const n=e?[]:[...t??[]];e||n.sort((l,a)=>a.length-l.length);const o=e?"__default__":n.join(""),s=bw.get(o);if(s)return s;const i=e?[eg,aL].filter(Boolean).join("|"):[n.map(l=>l.replace(/[.*+?^${}()|[\\]\\\]/g,"\\$&")).join("|"),eg].filter(Boolean).join("|"),r=new RegExp(`(^|[^\\\\\\w])(${i})\\s*\\{`,"g");return bw.set(o,r),r}const Cw={" ":"t","\r":"r","\b":"b","\f":"f","\v":"v"};function ww(e){const t=/(^|[^\\])(__|\*\*)/g;let n=0;for(;t.exec(e)!==null;)n++;return n}function Xre(e){return e.replace(/(^|[^\\])!+/gu,(t,n)=>{if(n&&Kre.test(n))return t;const o=n?t.slice(n.length):t;return`${n}${"\\!".repeat(o.length)}`})}function _w(e){const t=/(^|[^\\])(__|\*\*)/g;let n,o=null;for(;(n=t.exec(e))!==null;)o={marker:n[2],index:n.index+(n[1]?.length??0)};return o}function xa(e,t){const n=t?.commands??lL,o=t?.escapeExclamation??!0,s=t?.commands==null,i=Gre(s?void 0:n);let r=e.replace(i,(u,c,d,f,h)=>{if(c!==void 0&&Cw[c]!==void 0)return`\\${Cw[c]}`;if(d&&n.includes(d)){const m=h&&typeof f=="number"?h[f-1]:void 0;return m==="\\"||m&&/\w/.test(m)?u:`\\${d}`}return u});o&&(r=Xre(r));let l=r;const a=Yre(s,s?void 0:n);return l=l.replace(a,(u,c,d)=>`${c}\\${d}{`),l=l.replace(Ure,"span\\{$1\\}").replace(jre,"\\operatorname{span}\\{$1\\}"),l=l.replace(Vre,`$1\\\\ +`),l=l.replace(qre,"$1\\\\"),l=l.replace(Wre,"$1\\$2"),l}function xw(e){const t=e.trim();return!(!Oa(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}function cL(e){const t=[];let n=0;for(;n=n[0]&&t0;){if(e[i]==="\\"&&i+10;){if(e[l]==="\\"&&l+1=0&&e[n]==="\\";)o++,n--;return o%2===1}function W3(e,t){let n=t;for(;n0&&e[o-1]==="$"||o+1=l)break;const u=tg(s,a);if(u){r=Math.max(a+Math.max(1,t.length),u[1]);continue}Yp(e,a)||i++,r=a+Math.max(1,t.length)}return i}function Jy(e,t,n){const o=Tp(String(e??""));if(!o.endsWith(t))return-1;const s=o.length-t.length;if(s<=0||!Tp(o.slice(0,s)).trim()||Yp(o,s))return-1;const i=cL(o);if(tg(i,s))return-1;const r=Sw(o,t,0,s,i);if(t==="$$"){if(r%2===1)return-1}else if(r>Sw(o,n,0,s,i))return-1;return s}function Mp(e){return e===" "||e===" "}function Tp(e){let t=e.length;for(;t>0&&Mp(e[t-1]);)t--;return e.slice(0,t)}function Aw(e){let t=0;for(let n=0;n=48&&t<=57}function Qre(e){if(e.length<3)return!1;const t=e[0];if(t!=="-"&&t!=="*"&&t!=="_"&&t!=="=")return!1;let n=0;for(let o=0;o=3}function ele(e){const t=e.trim();if(!t)return!1;let n=0;t[n]===":"&&n++;let o=0;for(;t[n]==="-";)o++,n++;return o<3?!1:(t[n]===":"&&n++,n===t.length)}function tle(e){if(!e.includes("|"))return!1;const t=e[0]==="|"?e.slice(1):e;return(t.endsWith("|")?t.slice(0,-1):t).split("|").every(ele)}function nle(e){let t=0;if(!Mw(e[t]))return!1;for(;Mw(e[t]);)t++;return e[t]!=="."&&e[t]!==")"?!1:Mp(e[t+1])}function dL(e){const t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith("~~~")||t.startsWith(":::")||t[0]===">"||t[0]==="<")return!0;if(t[0]==="#"){let n=0;for(;t[n]==="#";)n++;if(n>=1&&n<=6&&Mp(t[n]))return!0}return!!((t[0]==="-"||t[0]==="+"||t[0]==="*")&&Mp(t[1])||nle(t)||Qre(t)||tle(t))}function Tw(e,t){return e?t?`${e} +${t}`:e:t}function U3(e){const t=String(e??"").trim();return t?Oa(t):!1}function Ew(e){let t=0;for(let n=0;nz3){h=!0;break}const v=s[m],k=md(v,c);if(k!==-1){const w=Tw(f,v.slice(0,k));if(!U3(w)){h=!0;break}const b=v.slice(k+c.length),_=b.trim()?`suffix:${Ew(b)}`:"nosuffix";return["closed",u,o+l,d,o+m,k,Ew(w),_].join(":")}if(dL(v)){h=!0;break}if(f=Tw(f,v),f.length>rL){h=!0;break}}if(!h&&U3(f))return["pending",u,o+l,d].join(":")}}return null}function $9(e,t){const n=String(e??"").trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??""))}function sle(e){const t=String(e??"").trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;const o=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(o)?!1:o===""||/^[)\s,.!?;:]/.test(o)}function N9(e){const t=String(e??"").trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function ile(e,t){Hre(e);const n=(r,l,a)=>{const u=String(l??"").replace(/^[\t ]+/,"").replace(/[\t ]+$/,"");if(!u)return;const c=r.push("paragraph_open","p",1);c.map=[a,a+1];const d=r.push("inline","",0);d.content=u,d.map=[a,a+1],d.children=[],r.push("paragraph_close","p",-1)},o=(r,l)=>{const a=r,u=!!t?.strictDelimiters,c=!a?.env?.__markstreamFinal,d=(b,_)=>{let g=_;for(;g=3&&(!g||/\s/.test(g))){const x=a.push("text","",0);return x.content=a.src.slice(a.pos,b),a.pos=b,!0}}const f=[["$$","$$"],["$","$"],["\\(","\\)"]],h=String(a.pending??""),m=Math.max(0,a.pos-h.length);let v=m,k=m;const w=m;for(const[b,_]of f){const g=a.src,x=cL(g),S=Jre(g,c);let T=!1;b==="$$"&&v!==w&&(v=w);let A=-1,E=-1,P=0;const D=I=>{if((I==="undefined"||I==null)&&(I=""),I==="\\"){a.pos=a.pos+I.length,v=a.pos;return}if(I==="\\)"||I==="\\("){const H=a.push("text_special","",0);H.content=I==="\\)"?")":"(",H.markup=I,a.pos=a.pos+I.length,v=a.pos;return}if(!I)return;if(b==="$$"&&I.includes("$")){let H=0;for(;H0&&I[O-1]==="$"||O+10){const F=I.slice(0,$),U=a.push("text","",0);U.content=F,a.pos=a.pos+F.length,v=a.pos}const H=I.slice($).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(H){const[,F,U]=H,z=U.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),W=z?z[1]:U,K=z&&z[2]?z[2]:null,V=a.push("image","img",0);V.attrs=[["src",W],["alt",F]],K&&V.attrs.push(["title",K]),V.content=F,V.children=[{type:"text",content:F,tag:""}],a.pos=a.pos+H[0].length,v=a.pos;const ie=I.slice($+H[0].length);ie&&D(ie);return}const O=a.push("text","",0);O.content=I,a.pos=a.pos+I.length,v=a.pos;return}const B=a.push("text","",0);B.content=I,a.pos=a.pos+I.length,v=a.pos};for(;!(v>=g.length);){const I=g.indexOf(b,v);if(I===-1)break;if(Yp(g,I)){v=I+Math.max(1,b.length);continue}const $=tg(x,I);if($){v=$[1];continue}const B=tg(S,I);if(B){v=B[1];continue}if(I===A&&v===E){if(P++,P>2){v=I+Math.max(1,b.length);continue}}else P=0,A=I,E=v;if(b==="("&&I>0){let ie=I-1;for(;ie>=0&&g[ie]===" ";)ie--;if(ie>=0&&g[ie]==="]"){v=I+b.length;continue}}if(b==="$"&&I>0&&g[I-1]==="$"){v=I+1;continue}if(b==="$"&&I=g.length);){const $=W3(g,I);if($===-1)break;if($+10&&g[$-1]==="$"){I=$+1;continue}const B=L9(g,$+1);if(B===-1)break;const H=g.slice($+1,B),O=H.includes("`"),F=!H||!H.trim(),U=g[B+1],z=$9(H,U),W=N9(H);if(!O&&!F&&!z&&!W){const K=g.slice(v,$);K&&D(K);const V=a.push("math_inline","math",0);V.content=xa(H,t),V.markup="$",V.raw=`$${H}$`,V.loading=!1,v=B+1,I=B+1}else D("$"),I=$+1}I{const c=r,d=!c?.env?.__markstreamFinal,f=t?.strictDelimiters,h=f?[["\\[","\\]"],["$$","$$"]]:[["\\[","\\]"],["[","]"],["$$","$$"]],m=c.bMarks[l]+c.tShift[l];let v=c.src.slice(m,c.eMarks[l]).trim(),k=!1,w="",b="",_=!1,g="",x=!1;for(const[K,V]of h)if(v.startsWith(K))if(K.includes("[")){const ie=K==="\\["?v.slice(K.length):"";if(K==="\\["&&md(ie,V)===-1&&!/^\s*!\[/.test(ie)&&!ie.includes("`")&&Oa(ie)){k=!0,w=K,b=V;break}if(t?.strictDelimiters){if(v.replace("\\","")==="["){if(l+1=0?"\\]":b,P=A>=0?A:md(v,b,T);if(!_&&P>w.length){const K=v.slice(S+w.length,P),V=c.push("math_block","math",0);V.content=xa(K),V.markup=w==="$$"?"$$":w==="["?"[]":"\\[\\]",V.map=[l,l+1],V.raw=`${w}${K}${E}`,V.block=!0,V.loading=!1,c.line=l+1;const ie=v.slice(P+E.length);return ie.trim()&&n(c,ie,l),!0}let D=l,I="",$=!1,B="",H=l;const O=_?v:v===w?"":v.slice(w.length),F=!f&&w==="\\["?"]":"",U=md(O,b);if(U!==-1){const K=U;I=O.slice(0,K),B=O.slice(K+b.length),H=_?l+1:l,$=!0,D=H}else for(O&&!_&&(I=O),D=l+1;D{const c=r,d=c.bMarks[l]+c.tShift[l],f=c.src.slice(d,c.eMarks[l]).trim();return!f.startsWith("$$")&&!f.startsWith("\\[")?!1:s(r,l,a,u)};e.inline.ruler.before("escape","math",o),e.block.ruler.before("lheading","explicit_math_block",i,{alt:["paragraph","reference","blockquote","list"]}),e.block.ruler.before("paragraph","math_block",s,{alt:["paragraph","reference","blockquote","list"]})}function rle(e){const t=e.renderer.rules.image||function(n,o,s,i,r){const l=n,a=r;return a.renderToken?a.renderToken(l,o,s):""};e.renderer.rules.image=(n,o,s,i,r)=>{const l=n;return l[o].attrSet?.("loading","lazy"),t(l,o,s,i,r)},e.renderer.rules.fence=e.renderer.rules.fence||((n,o)=>{const s=n[o],i=String(s.info??"").trim();return`
      ${e.utils.escapeHtml(String(s.content??""))}
      `})}const lle=/^\s]/i,ale=/^<\/a\s*>/i;function ule(e,t){if(e?.type!=="inline")return!1;const n=e.children;if(!Array.isArray(n)||n.length===0)return t.pretest(String(e.content??""));let o=0;for(let s=n.length-1;s>=0;s--){const i=n[s];if(i?.type==="link_close"){for(s--;s>=0&&n[s]?.level!==i.level&&n[s]?.type!=="link_open";)s--;continue}if(i?.type==="html_inline"){const r=String(i.content??"");lle.test(r)&&o>0&&o--,ale.test(r)&&o++}if(!(o>0)&&i?.type==="text"&&t.pretest(String(i.content??"")))return!0}return!1}function cle(e){const t=e.core?.ruler,n=t.getNamedRules?.().find(o=>o.name==="linkify")?.fn;typeof n=="function"&&t.at("linkify",o=>{if(!o.md?.options?.linkify)return;const s=Array.isArray(o.tokens)?o.tokens:[],i=o.md.linkify;if(!i)return;const r=s.filter(l=>ule(l,i));if(r.length)return n(Object.assign(Object.create(Object.getPrototypeOf(o)),o,{tokens:r}))})}function dle(e){const t=e.inline.ruler,n=t.getNamedRules?.(),o=n?.find(l=>l.name==="link")?.fn,s=n?.find(l=>l.name==="image")?.fn;if(typeof o!="function"||typeof s!="function")return;const i=e.validateLink,r=e;r.__markstreamOriginalValidateLink=i,t.at("link",(...l)=>{const a=l[0].md,u=a?.validateLink===i?a.options?.validateLink:a?.validateLink;if(!a||typeof u!="function")return o(...l);const c=a.validateLink;a.validateLink=u;try{return o(...l)}finally{a.validateLink=c}}),t.at("image",(...l)=>{const a=l[0].md;if(!a)return s(...l);const u=a.validateLink;a.validateLink=i;try{return s(...l)}finally{a.validateLink=u}})}function fle(e={}){const t=e.markdownItOptions??{},n=typeof t.experimental=="object"&&t.experimental!==null?t.experimental:{},o=Object.prototype.hasOwnProperty.call(t,"stream")?!!t.stream:!0,s=Object.prototype.hasOwnProperty.call(t,"validateLink"),i=new Wse({html:!0,linkify:!0,typographer:!0,...t,experimental:{stream:o,...n}});return s||i.set({validateLink:r=>!lc(r,{tagName:"a",attrName:"href"})}),dle(i),cle(i),(e.enableMath??!0)&&ile(i,{...e.mathOptions??{}}),(e.enableContainers??!0)&&aie(i),e.enableFixIndentedCodeBlock!==!1&&Lie(i),cre(i),hre(i),fre(i),yre(i),rle(i),Eie(i,{customHtmlTags:e.customHtmlTags}),i}function ac(e){const t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(n=>[...n])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(n=>ac(n))),t}function ple(e){const t=e.meta??{};return{type:"checkbox",checked:t.checked===!0,raw:t.checked?"[x]":"[ ]"}}function hle(e){const t=e,n=t.attrGet?t.attrGet("checked"):void 0,o=n===""||n==="true";return{type:"checkbox_input",checked:o,raw:o?"[x]":"[ ]"}}function mle(e){const t=String(e.content??"");return{type:"emoji",name:t,markup:String(e.markup??""),raw:`:${t}:`}}function hh(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;in.startsWith(t)||t.startsWith(n)):!1}function Lw(e,t,n,o){n.length>0&&e.push(...n),o.length>0&&t.push(...o),n.length=0,o.length=0}function $w(e,t){return!t&&e.startsWith(" ")&&!e.startsWith(" ")?` ${e}`:e}function yle(e,t){const n=[],o=[],s=[],i=[],r=e.split(gle),l=/\r?\n$/.test(e),a=r.some(h=>h.startsWith("diff ")||h.startsWith("--- ")||h.startsWith("+++ ")||h.startsWith("@@ ")),u=h=>{const m=h;if(!hL.some(v=>m.startsWith(v)))if(m.startsWith("-")){const v=m.slice(1);s.push($w(v,a))}else if(m.startsWith("+")){const v=m.slice(1);i.push($w(v,a))}else{Lw(n,o,s,i);const v=a&&m.startsWith(" ")?m.slice(1):m;n.push(v),o.push(v)}},c=l?Math.max(0,r.length-1):r.length;for(let h=0;h0||i.length>0)&&Lw(n,o,s,i);const d=n.join(` +`),f=o.join(` +`);return{original:t&&l&&d?`${d} +`:d,updated:t&&l&&f?`${f} +`:f}}function Qy(e){const t=Array.isArray(e.map)&&e.map.length===2,n=e.meta??{},o=typeof n.closed=="boolean"?n.closed:void 0,s=o===!0||o!==!1&&t,i=String(e.info??""),r=i.startsWith("diff"),l=r?(()=>{const u=i,c=u.indexOf(" ");return c===-1?"":String(u.slice(c+1)??"")})():i;let a=String(e.content??"");if(Iw.test(a)&&(a=a.replace(Iw,"")),r){const{original:u,updated:c}=yle(a,s===!0);return{type:"code_block",language:l,code:String(c??""),raw:String(a??""),diff:r,loading:o===!0?!1:o===!1?!0:!t,originalCode:u,updatedCode:c}}return{type:"code_block",language:l,code:String(a??""),raw:String(a??""),diff:r,loading:o===!0?!1:o===!1?!0:!t}}function kle(e){const t=e.meta??{};return{type:"footnote_reference",id:String(t.label??""),raw:`[^${String(t.label??"")}]`}}function ble(){return{type:"hardbreak",raw:`\\ +`}}function Cle(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;i\s*$/.test(t)||eu.has(e)}function wle(e){if(!e||e.length===0)return Nw();const t=R9.get(e);if(t)return t;const n=e.map(Sr).filter(Boolean);if(!n.length){const s=Nw();return R9.set(e,s),s}const o={customTagSet:new Set(n),allowedTagSet:A2({customHtmlTags:e})};return R9.set(e,o),o}function yL(e){const t=e,n=t.raw??t.content??t.markup??"";return String(n??"")}function _le(e){const t=e.meta,n=t?.markstreamCustomHtmlRaw,o=t?.markstreamCustomHtmlInner;return typeof n=="string"&&typeof o=="string"?{raw:n,inner:o}:null}function ng(e,t){const n=t.toLowerCase();for(let o=e.length-1;o>=0;o--){const[s,i]=e[o];if(String(s).toLowerCase()===n)return i}}function xle(e,t,n){const o=e.slice();return ng(o,"href")||o.push(["href",t]),n!=null&&!ng(o,"title")&&o.push(["title",n]),o}function j3(e){return e.map(yL).join("")}function Zh(e){const t=[],n=o=>{const s=String(o??"");if(!s)return;const i=t[t.length-1];if(i?.type==="text"){i.content=`${i.content}${s}`,i.raw=`${i.raw}${s}`;return}t.push({type:"text",content:s,raw:s})};for(const o of e)if(o){if(o.type==="reference"||o.type==="footnote_reference"){n(String(o.raw??""));continue}if("children"in o&&Array.isArray(o.children)){t.push({...o,children:Zh(o.children)});continue}t.push(o)}return t}function Sle(e,t,n){let o=0;for(let s=t;s`;v.toLowerCase().includes(x.toLowerCase())||(v+=x),w=!0,k=!0}const b=[],_=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let g;for(;(g=_.exec(l))!==null;){const x=g[1],S=g[2]||g[3]||g[4]||"";b.push([x,S])}if(u?.has(a)){const x=_le(e);return[{type:a,tag:a,attrs:b,content:x?x.inner:h.innerTokens.length?j3(h.innerTokens):"",children:h.innerTokens.length?o(h.innerTokens,s,i,r):[],raw:x?.raw??v,loading:e.loading||k,autoClosed:w},h.nextIndex]}return[{type:"html_inline",tag:a,attrs:b,content:v,children:m,raw:v,loading:k,autoClosed:w},h.nextIndex]}function kL(e){if(e.type==="math_inline"){if(e.raw)return String(e.raw);const t=e.markup==="$$"?"$$":"$";return`${t}${String(e.content??"")}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(t=>kL(t)).join(""):String(e.content??"")}function Mle(e){return!e||!Array.isArray(e.children)||e.children.length===0?"":e.children.map(t=>kL(t)).join("")}function Fw(e,t=!1){let n=e.attrs??[],o=null;if((!n||n.length===0)&&Array.isArray(e.children))for(const d of e.children){const f=d.attrs;if(Array.isArray(f)&&f.length>0){n=f,o=d;break}}const s=String(n.find(d=>d[0]==="src")?.[1]??""),i=n.find(d=>d[0]==="alt")?.[1],r=Mle(o??e);let l="";r?l=r:i!=null&&String(i).length>0?l=String(i):o?.content!=null&&String(o.content).length>0?l=String(o.content):Array.isArray(o?.children)&&o.children[0]?.content?l=String(o.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?l=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(l=String(e.content));const a=n.find(d=>d[0]==="title")?.[1]??null,u=a===null?null:String(a),c=String(e.content??"");return{type:"image",src:s,alt:l,title:u,raw:c,loading:t}}function Tle(e){const t=String(e.content??"");return{type:"inline_code",code:t,raw:t}}function Ele(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;i=0;o--){const[s,i]=e[o];if(String(s).toLowerCase()===n)return i}}function Lle(e,t,n){const o=e.slice();return og(o,"href")||o.push(["href",t]),n!=null&&!og(o,"title")&&o.push(["title",n]),o}function mh(e,t,n){const o=e[t],s=Ile(o.attrs),i=String(og(s,"href")??""),r=og(s,"title"),l=r==null?null:String(r),a=Lle(s,i,l);let u=t+1;const c=[];let d=!0;for(;uk.type==="strong_open")){const k=String(h.content??""),w=String(h.raw??k),b=ac(h);b.content=k.slice(0,-2),b.raw=w.replace(/\*\*$/,""),f=c.slice(),f[f.length-1]=b}const m=$o(f,void 0,void 0,n),v=m.map(k=>{const w=k;return"content"in k?String(w.content??""):String(w.raw??"")}).join("");return{node:{type:"link",href:i,title:l,text:v,children:m,raw:`[${v}](${i}${l?` "${l}"`:""})`,loading:d,attrs:a},nextIndex:u0?o:[{type:"text",content:a,raw:a}],raw:`~${a}~`},nextIndex:i0?o:[{type:"text",content:s||String(e[t].content??""),raw:s||String(e[t].content??"")}],raw:`^${s||String(e[t].content??"")}^`},nextIndex:i?@[\\\]^_`{|}~]/,jle=/\p{P}/u,Vle=/^[《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,qle=/^[》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u,Kle=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,Zle=/:\/\//,V3=1,bL=2,Gle=4,Yle=8,CL=16,Ea=32,Gh=64,Cf=128,wL=256,Xle=512,wf=1024,Jle=1982;function gh(e){let t=0;for(let n=0;n=t){n++,o++;continue}n++,o++;continue}if(s==="*"&&n>=t)return n;n++}return-1}function tu(e){return!!e&&Wle.test(e)}function nu(e){return!!e&&(Ule.test(e)||jle.test(e))}function xL(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&Vle.test(e)}function SL(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&qle.test(e)}function eae(e,t){const n=t>0?e[t-1]:void 0,o=e[t+1];return!o||tu(o)?!1:!(nu(o)&&!xL(o,n)&&n&&!tu(n)&&!nu(n))}function tae(e,t){const n=t>0?e[t-1]:void 0,o=e[t+1];return!n||tu(n)?!1:!(nu(n)&&!SL(n,o)&&o&&!tu(o)&&!nu(o))}function nae(e,t,n=0){let o=n,s=!1;for(;o0?e[t-1]:void 0,o=e[t+2];return!o||tu(o)?!1:!(nu(o)&&!xL(o,n)&&n&&!tu(n)&&!nu(n))}function sae(e,t){const n=t>0?e[t-1]:void 0,o=e[t+2];return!n||tu(n)?!1:!(nu(n)&&!SL(n,o)&&o&&!tu(o)&&!nu(o))}function iae(e,t=0){let n=t,o=!1;for(;n=0&&e[i]==="\\";i--)s++;return s%2===1}const uae=/[\p{L}\p{N}]/u,cae=/^[\p{L}\p{N}]+$/u;function q3(e){return e?uae.test(e):!1}function AL(e){return e?cae.test(e):!1}function Vf(e,t){let n=t;for(;n0?e[t-1]:void 0,s=n=2&&o.intraword&&t.push({start:n,end:s}),n=s}for(let n=0;n=3)return o;n=o+s.len}return-1}function hae(e){return e?Kle.test(e)||Zle.test(e):!1}function mae(e,t){if(!e||!t)return null;const n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function $o(e,t,n,o){if(!e||e.length===0)return[];const s=o?.__linkifyDemotionContext,i=Gp(t),r={filename:s?.filename||i.filename,explicitFilename:s?.explicitFilename||i.explicitFilename,marketTicker:s?.marketTicker||i.marketTicker};(r.filename||r.explicitFilename||r.marketTicker)&&(o={...o,__linkifyDemotionContext:r});const l=o,a=[];let u=null,c=0;const d=o?.requireClosingStrong,f=e;function h(){return e===f&&(e=e.slice()),e}function m(){u=null}function v(oe,ye){const G=e.length===1?t:String(ye.content??""),Y=[],fe=dae(oe);if(fe!==-1){x(oe.slice(0,fe),oe.slice(0,fe));const ge=oe.slice(fe);return ge&&(D({type:"text",content:ge,raw:ge}),c--),c++,!0}if(Dle.test(oe)){const ge=oe.indexOf("~~");ge!==-1&&Y.push({type:"strikethrough",index:ge})}if(Ble.test(oe)){const ge=oe.indexOf("**");ge!==-1&&Y.push({type:"strong",index:ge})}if(/[^*]*\*[^*]+/.test(oe)){const ge=G?_L(G,0):oe.indexOf("*");if(G&&ge===-1)return!1;ge!==-1&&Y.push({type:"emphasis",index:ge})}Y.sort((ge,Q)=>ge.index!==Q.index?ge.index-Q.index:ge.type===Q.type?0:ge.type==="strong"?-1:Q.type==="strong"?1:0);const we=Y[0];if(!we)return!1;if(we.type==="strikethrough"){const ge=we.index,Q=ge>-1?oe.slice(0,ge):"";if(Q&&x(Q,Q),ge===-1)return c++,!0;const te=oe.indexOf("~~",ge+2),ce=te===-1?oe.slice(ge+2):oe.slice(ge+2,te),ue=te===-1?"":oe.slice(te+2),{node:Se}=Ow([{type:"s_open",tag:"s",content:"",markup:"~~",info:"",meta:null},{type:"text",tag:"",content:ce,markup:"",info:"",meta:null},{type:"s_close",tag:"s",content:"",markup:"~~",info:"",meta:null}],0,o);return m(),g(Se),ue&&(D({type:"text",content:ue,raw:ue}),c--),c++,!0}if(we.type==="strong"){const ge=we.index,Q=ge>-1?oe.slice(0,ge):"";if(Q&&x(Q,Q),ge===-1)return c++,!0;if(t&&ge===0){let _e=!1,Ee=0;for(;Ee=2)return x(oe,oe),c++,!0}}if(t&&(oe.match(/\*/g)||[]).length>Qle(t))return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0;const te=Vf(oe,ge);if(te.len>=3){const _e=pae(oe,ge+te.len);if(_e!==-1){const Ee=oe.slice(ge+te.len,_e);if(fae(Ee)){const{node:it}=nf([{type:"strong_open",tag:"strong",content:"",markup:"**",info:"",meta:null},{type:"em_open",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"text",tag:"",content:Ee,markup:"",info:"",meta:null},{type:"em_close",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"strong_close",tag:"strong",content:"",markup:"**",info:"",meta:null}],0,t,o);m(),g(it);const Fe=oe.slice(_e+3);return Fe&&(D({type:"text",content:Fe,raw:Fe}),c--),c++,!0}}}if(!oae(oe,ge)){const _e=oe.slice(ge,ge+te.len);x(_e,_e);const Ee=oe.slice(ge+te.len);return Ee&&(D({type:"text",content:Ee,raw:Ee}),c--),c++,!0}const ce=iae(oe,ge+2);let ue="",Se="";if(ce.index!==-1){ue=oe.slice(ge+2,ce.index),Se=oe.slice(ce.index+2);const _e=ce.index,Ee=Vf(oe,_e);if(te.intraword&&Ee.intraword&&!AL(ue)||!ue&&te.len>=4&&te.intraword)return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0}else{if(d||ce.sawInvalidClose||te.intraword)return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0;ue=oe.slice(ge+2),Se=""}if(!ue&&/^\*+$/.test(Se))return x(oe,oe),c++,!0;const{node:ze}=nf([{type:"strong_open",tag:"strong",content:"",markup:"**",info:"",meta:null},{type:"text",tag:"",content:ue,markup:"",info:"",meta:null},{type:"strong_close",tag:"strong",content:"",markup:"**",info:"",meta:null}],0,t,o);return m(),g(ze),Se&&(D({type:"text",content:Se,raw:Se}),c--),c++,!0}if(we.type==="emphasis"){let ge=we.index;ge===-1&&(ge=0);const Q=oe.slice(0,ge);if(Q&&x(Q,Q),!eae(oe,ge)){x(oe[ge],oe[ge]);const _e=oe.slice(ge+1);return _e&&(D({type:"text",content:_e,raw:_e}),c--),c++,!0}const te=Vf(oe,ge),ce=nae(G,oe,ge+1),ue=ce.index,Se=e[c+1];if(o?.final&&Se?.type==="em_open"&&ue!==-1&&oe.slice(ge+1,ue).trim()!==oe.slice(ge+1,ue)||ue===-1&&(ce.sawInvalidClose||o?.final||te.intraword||!q3(oe[ge+1])))return x(oe.slice(ge),oe.slice(ge)),c++,!0;const{node:ze}=hh([{type:"em_open",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"text",tag:"",content:ue>-1?oe.slice(ge+1,ue):oe.slice(ge+1),markup:"",info:"",meta:null},{type:"em_close",tag:"em",content:"",markup:"*",info:"",meta:null}],0,o);if(m(),g(ze),ue!==-1&&ue{for(let ze=0;ze=0&&Se[Ee]==="\\";Ee--)_e++;if(_e%2===0)return ze}return-1})(oe);if(Y===-1)return!1;let fe=1;for(let Se=Y+1;Sewe?.type==="math_inline")||!Hle.test(oe))return null;const G=ye.parseInline(oe,{__markstreamFinal:!!o?.final});if(!Array.isArray(G)||G.length===0)return null;const Y=(G.find(we=>we?.type==="inline")?.children??[]).filter(we=>!(we?.type==="text"&&String(we.content??"")===""));if(!Y.length||!Y.some(we=>we?.type!=="text")||Y.length===1&&Y[0]?.type==="text"&&String(Y[0].content??"")===oe)return null;const fe=$o(Y,oe,n,o);return fe.length?fe:null}function b(oe){m(),a.push(oe)}function _(oe){m();const ye=ac(oe);a.push(ye)}function g(oe){b(oe)}function x(oe,ye){u?(u.content+=oe,u.raw+=ye??oe):(u={type:"text",content:String(oe??""),raw:String(ye??oe??"")},a.push(u))}function S(oe,ye){if(!oe)return;const G=$o([{...ye,type:"text",content:oe,raw:oe}],oe,n,o);if(G.length===1&&G[0]?.type==="text"){const Y=G[0];x(String(Y.content??""),String(Y.raw??Y.content??""));return}for(const Y of G)g(Y)}function T(oe,ye){return String(oe.markup??"").startsWith(ye)}function A(oe){if(!u||oe.loading!==!0||oe.markup!=="\\(\\)")return;const ye=e[c-1];!ye||ye.type!=="text"||!T(ye,"\\(")||u.content.endsWith("(")&&(u.content=u.content.slice(0,-1),u.raw.endsWith("(")&&(u.raw=u.raw.slice(0,-1)),!u.content&&a[a.length-1]===u&&(a.pop(),u=null))}function E(oe){return oe.endsWith("](")?e[c+1]?.type==="link_open"&&e[c+1]?.markup==="linkify"&&e[c+2]?.type==="text"&&e[c+3]?.type==="link_close"&&e[c+4]?.type==="text"&&String(e[c+4]?.content??"").startsWith(")"):!1}function P(oe,ye,G=gh(oe)){let Y=oe;const fe=String(ye.content??"");return(G&V3)!==0&&Y.endsWith("\\")&&!T(ye,"\\\\")&&!fe.endsWith("\\\\")&&(Y=Y.slice(0,-1)),(G&wf)!==0&&Y.endsWith("(")&&!T(ye,"\\(")&&!fe.endsWith("\\(")&&(Y=Y.slice(0,-1)),(G&bL)!==0&&/\*+$/.test(Y)&&!T(ye,"\\*")&&!fe.endsWith("\\*")&&(Y=Y.replace(/\*+$/,"")),Y}for(;c=0;_e--){const Ee=a[_e];if(Ee.type!=="text")break;te=_e,ce=String(Ee.content??"")+ce}teQ==="href")?.[1],ge=String(we??"");if(t&&ge){const Q=t.indexOf("](");if(Q!==-1){const te=t.indexOf(")",Q+2);te===-1?ye.loading=!0:ye.loading&&t.slice(Q+2,te).includes(ge)&&(ye.loading=!1)}}F(ye)||b(ye)}function H(oe){if(oe.markup!=="linkify")return!1;const{node:ye,nextIndex:G}=mh(e,c,o);return z(ye,G)?(c=G,!0):!1}function O(oe){m(),g($le(oe)),c++}function F(oe){if(oe.type!=="link")return!1;const ye=a[a.length-1];if(!ye||ye.type!=="text")return!1;const G=String(ye.content??"").match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!G)return!1;const Y=oe,fe=String(Y.href??""),we=String(Y.text??""),ge=String(G[2]??""),Q=fe.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,"");if(!fe||!(we===fe||we===Q||hae(we)))return!1;const te=String(G[1]??"");return te?(ye.content=te,ye.raw=te):a.pop(),b({...oe,text:ge,children:[{type:"text",content:ge,raw:ge}],raw:`[${ge}](${fe}${Y.title?` "${Y.title}"`:""})`}),!0}function U(oe){if(oe.type!=="link")return!1;const ye=oe,G=String(ye.href??"");return G?z({href:G,title:ye.title==null||ye.title===""?null:String(ye.title),loading:!!ye.loading},c+1):!1}function z(oe,ye){const G=a[a.length-1];if(G?.type!=="image"||G.src||!G.loading||!String(G.raw??"").endsWith("]("))return!1;const Y=e[ye],fe=String(Y?.content??"");if(Y?.type!=="text"||!fe.startsWith(")"))return!1;a.pop(),u=null;const we=String(G.alt??"");b({type:"image",src:oe.href,alt:we,title:oe.title,raw:`![${we}](${oe.href}${oe.title?` "${oe.title}"`:""})`,loading:!!oe.loading});const ge=fe.slice(1),Q=ac(Y);return Q.content=ge,Q.raw=ge,h()[ye]=Q,!0}function W(oe){if(oe.type!=="link")return!1;const ye=a[a.length-1],G=e[c-1];if(!ye||ye.type!=="text"||G?.type!=="text")return!1;const Y=String(ye.content??""),fe=String(G.content??"");if(!Y.endsWith("!")||!fe.endsWith("!")||T(G,"\\!"))return!1;const we=Y.slice(0,-1);we?(ye.content=we,ye.raw=we,u=ye):(a.pop(),u=null);const ge=oe,Q=String(ge.text??ge.children?.map(ue=>String(ue?.content??ue?.raw??"")).join("")??""),te=String(ge.href??""),ce=ge.title==null||ge.title===""?null:String(ge.title);return b({type:"image",src:te,alt:Q,title:ce,raw:`![${Q}](${te}${ce?` "${ce}"`:""})`,loading:!!ge.loading}),!0}function K(oe,ye="",G=null){const Y=String(oe.alt??oe.raw??"");return{type:"link",href:ye,title:G,text:Y,children:[oe],raw:`[${Y}](${ye}${G?` "${G}"`:""})`,loading:!0}}function V(oe){const ye=oe.startsWith("![")?oe:`![${oe}`,G=ye.slice(2),Y=G.indexOf("](");return{type:"image",src:"",alt:Y===-1?G.replace(/\]$/,""):G.slice(0,Y),title:null,raw:ye,loading:!0}}function ie(oe){const ye=oe.indexOf("[![");if(ye===-1||typeof t=="string"&&e.length===1&&aae(t,ye,"["))return!1;const G=oe.slice(0,ye);return G&&x(G,G),b(K(V(oe.slice(ye+1)))),c++,!0}function ne(oe){if(o?.final)return!1;const ye=e[c-1];if(ye?.type!=="text"||!String(ye.content??"").endsWith("[")||T(ye,"\\["))return!1;const G=a[a.length-1];if(G?.type==="text"&&G.content.endsWith("[")){const Y=G.content.slice(0,-1);Y?(G.content=Y,G.raw=Y,u=G):(a.pop(),u=null)}return b(K(Fw(oe))),c++,!0}function X(oe){if(oe.type!=="link")return!1;const ye=oe,G=String(ye.raw??""),Y=String(ye.text??"");if(!G.startsWith("[![")&&!Y.startsWith("!["))return!1;const fe=ye.title==null||ye.title===""?null:String(ye.title);return b(K({type:"image",src:String(ye.href??""),alt:Y.replace(/^!\[/,"").replace(/\]$/,""),title:fe,raw:G.startsWith("[![")?G.slice(1):G,loading:!0})),!0}function le(oe){if(!oe.startsWith("]("))return!1;const ye=e[c-2];if(ye?.type==="text"&&String(ye.content??"").endsWith("[")&&T(ye,"\\["))return!1;const G=a[a.length-1];if(G?.type!=="image"&&G?.type!=="link")return!1;const Y=G,fe=G?.type==="link"&&Array.isArray(Y.children)&&Y.children.length===1&&Y.children[0]?.type==="image"?a.pop():null,we=fe?fe.children[0]:a.pop();if(!we||we.type!=="image")return!1;const ge=e[c+1];let Q=String(fe?.href??""),te=fe?.title==null?null:String(fe.title),ce=!0;if(ge?.type==="link_open"){const{node:Se,nextIndex:ze}=mh(e,c+1,o);Q=Se.href,te=Se.title,ce=!0,c=ze}else{if(Q=oe.slice(2),Q.includes('"')){const Se=Q.split('"');Q=String(Se[0]??"").trim(),te=Se[1]==null?null:String(Se[1]).trim()}c++}const ue=K(we,Q,te);return ue.loading=ce,b(ue),!0}function Ie(){const oe=e[c-3];return e[c-2]?.type==="image"&&e[c-1]?.type==="text"&&String(e[c-1].content??"")==="]("&&oe?.type==="text"&&String(oe.content??"").endsWith("[")&&T(oe,"\\[")}function de(oe,ye){const G=oe.indexOf("[");if(G===-1)return!1;let Y=oe.slice(0,G);const fe=oe.indexOf("](",G);if(fe!==-1){const we=e[c+2];let ge=oe.slice(G+1,fe);if(ge.includes("[")){const _e=ge.indexOf("[");Y+=oe.slice(0,G+_e+1);const Ee=G+_e+1;ge=oe.slice(Ee+1,fe)}const Q=e[c+1];if(oe.endsWith("](")&&Q?.type==="link_open"&&we){const _e=e[c+4];let Ee=4,it=!0;if(_e?.type==="text"){const Oe=String(_e.content??"");if(Oe.startsWith(")")){it=!1;const Ge=Oe.slice(1);if(Ge){const at=ac(_e);at.content=Ge,at.raw=Ge,h()[c+4]=at}else Ee++}else Oe==="."&&Ee++}S(Y,ye);const Fe=String(we.content??"");return o?.validateLink&&!o.validateLink(Fe)?x(ge,ge):b({type:"link",href:Fe,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:it}),c+=Ee,!0}const te=oe.indexOf(")",fe),ce=te!==-1?oe.slice(fe+2,te):"",ue=te===-1;let Se=Y.match(/\*+$/);if(Se&&(Y=Y.replace(/\*+$/,"")),S(Y,ye),Se||(Se=ge.match(/^\*+/)),!d&&Se){const _e=Se[0].length;ge=ge.replace(/^\*+/,"").replace(/\*+$/,"");const Ee=[];if(_e===1?Ee.push({type:"em_open",tag:"em",nesting:1}):_e===2?Ee.push({type:"strong_open",tag:"strong",nesting:1}):_e===3&&(Ee.push({type:"strong_open",tag:"strong",nesting:1}),Ee.push({type:"em_open",tag:"em",nesting:1})),Ee.push({type:"link",href:ce,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:ue}),_e===1){Ee.push({type:"em_close",tag:"em",nesting:-1});const{node:it}=hh(Ee,0,o);g(it)}else if(_e===2){Ee.push({type:"strong_close",tag:"strong",nesting:-1});const{node:it}=nf(Ee,0,void 0,o);g(it)}else if(_e===3){Ee.push({type:"em_close",tag:"em",nesting:-1}),Ee.push({type:"strong_close",tag:"strong",nesting:-1});const{node:it}=nf(Ee,0,void 0,o);g(it)}else{const{node:it}=hh(Ee,0,o);g(it)}}else o?.validateLink&&!o.validateLink(ce)?x(ge,ge):b({type:"link",href:ce,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:ue});const ze=te!==-1?oe.slice(te+1):"";return ze&&(D({type:"text",content:ze,raw:ze}),c--),c++,!0}return!1}function pe(oe){const ye=oe.indexOf("![");if(ye===-1)return!1;const G=oe.slice(0,ye);return G&&!u?u={type:"text",content:G,raw:G}:G&&u&&(u.content+=G),u&&(a.push(u),u=null),b(V(oe.slice(ye))),c++,!0}function ve(oe){if(!(oe?.startsWith("[")&&n?.type==="list_item_open"))return!1;const ye=oe.slice(1).match(/[^\s\]]/);if(ye===null)return c++,!0;if(ye&&/x/i.test(ye[0])){const G=ye[0]==="x"||ye[0]==="X";return b({type:"checkbox_input",checked:G,raw:G?"[x]":"[ ]"}),c++,!0}return!1}return a}function t5(e,t,n){const o=n?.__sourceLineMapper;if(!o)return{startLine:e,endLine:t};const s=o(e),i=t>e?o(t-1).endLine:o(t).startLine;return{startLine:s.startLine,endLine:Math.max(s.startLine,i)}}function Pw(e,t){const n=Math.max(0,Math.min(e.length,Math.trunc(t)));let o=0;for(let s=0;so&&e[s-1]!==` +`&&r++,{startLine:i,endLine:r}}function Ep(e,t,n,o){const s=gae(e,t,n);return t5(s.startLine,s.endLine,o)}function vae(e,t){const n=e?.map;if(!Array.isArray(n)||n.length<2)return null;const o=Number(n[0]),s=Number(n[1]);return!Number.isFinite(o)||!Number.isFinite(s)?null:t5(o,s,t)}function Dn(e,t,n){if(!n?.includeSourceMap)return e;const o=vae(t,n);if(!o)return e;if(e.sourceMap=o,e.type==="code_block"){const s=e;s.startLine=o.startLine,s.endLine=o.endLine}return e}function yae(e,t,n,o){if(!o?.includeSourceMap)return e;const s=t?.map;if(!Array.isArray(s)||s.length<2)return e;const i=Number(s[0]),r=Number(s[1]),l=Number(n);return!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(l)||(e.sourceMap=t5(i,Math.max(r,l),o)),e}function kae(e){const t=String(e.content??""),n=t.replace(/[ \t\r\n]+$/g,"");if(n===t)return;e.content=n;const o=e.children;if(!(!Array.isArray(o)||o.length===0))for(;o.length;){const s=o[o.length-1];if(!s){o.pop();continue}if(s.type==="softbreak"||s.type==="hardbreak"){o.pop();continue}if(s.type==="text"){const i=String(s.content??""),r=i.replace(/[ \t\r\n]+$/g,"");if(r===i)break;if(r){s.content=r;break}o.pop();continue}break}}function bae(e){const t=String(e.content??""),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!="number")return;e.content=t.slice(0,n.index);const o=e.children;if(!(!Array.isArray(o)||o.length===0))for(;o.length;){const s=o[o.length-1];if(!s){o.pop();continue}if(s.type==="softbreak"||s.type==="hardbreak"){o.pop();continue}if(s.type==="text"){const i=String(s.content??"");if(/^[ \t\r\n\d.)]*$/.test(i)){o.pop();continue}const r=i.replace(/[ \t\r\n\d.)]+$/g,"");r!==i&&(r?s.content=r:o.pop())}break}}function Cae(e){const t=String(e.content??"");return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function b1(e,t,n){const o=e[t],s=[],i=fu(n,!0);let r=t+1;for(;rd.raw).join("")};n?.includeSourceMap&&Dn(c,e[r],n),s.push(c),r=u+1}else r+=1;const l={type:"list",ordered:o.type==="ordered_list_open",start:(()=>{if(o.attrs&&o.attrs.length){const a=o.attrs.find(u=>u[0]==="start");if(a){const u=Number(a[1]);return Number.isFinite(u)&&u!==0?u:1}}})(),items:s,raw:s.map(a=>a.raw).join(` +`)};return n?.includeSourceMap&&Dn(l,o,n),[l,r+1]}function wae(e,t,n,o){const s=String(n[1]??"note"),i=String(n[2]??s.charAt(0).toUpperCase()+s.slice(1)),r=[],l=fu(o,!0);let a=t+1;for(;au.raw).join(` +`)} +:::`},a+1]}const _ae=new Set(["warning","info","note","tip","danger","caution"]);function xae(e){let t=0;for(;t=0;v--){const k=f[v];if(k.type==="text"&&/:+/.test(k.content)){h=v;break}}const m={type:"paragraph",children:$o((h!==-1?f.slice(0,h):f)||[],void 0,void 0,a.options()),raw:String(d.content??"").replace(/\n:+$/,"").replace(/\n\s*:::\s*$/,"")};n?.includeSourceMap&&Dn(m,e[u],n),l.push(m),a.remember(m.raw)}u+=3}else if(e[u].type==="bullet_list_open"||e[u].type==="ordered_list_open"){const[d,f]=b1(e,u,a.options());n?.includeSourceMap&&Dn(d,e[u],n),l.push(d),a.remember(d.raw),u=f}else if(e[u].type==="blockquote_open"){const[d,f]=C1(e,u,a.options());n?.includeSourceMap&&Dn(d,e[u],n),l.push(d),a.remember(d.raw),u=f}else{const d=_2(e,u,a.options());d?(l.push(d[0]),a.remember(d[0].raw),u=d[1]):u++}return[{type:"admonition",kind:s,title:i,children:l,raw:`:::${s} ${i} +${l.map(d=>d.raw).join(` +`)} +:::`},u+1]}const Aae=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function Mae(e,t,n){const o=e[t];if(o.type!=="container_open")return null;const s=Aae.exec(String(o.info??""));return s?wae(e,t,s,n):null}const n5={parseContainer:(e,t,n)=>Sae(e,t,n),matchAdmonition:Mae};function C1(e,t,n){const o=[],s=fu(n,!0);let i=t+1;for(;il.raw).join(` +`)};return n?.includeSourceMap&&Dn(r,e[t],n),[r,i+1]}function Tae(e){if(e.info?.startsWith("diff"))return Qy(e);const t=String(e.content??""),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/);let o=t;n?.[1]&&(o=t.replace(/]*>/g,"").replace(/<\/antArtifact>/g,""));const s=Array.isArray(e.map)&&e.map.length===2;return{type:"code_block",language:n?n[1]:String(e.info??""),code:o,raw:o,loading:!s}}function Eae(e,t,n){const o=[];let s=t+1,i=[],r=[];const l=fu(n,!0);for(;su.raw).join("")),s+=3}else if(e[s].type==="dd_open"){let a=s+1;for(r=[];a0&&(o.push({type:"definition_item",term:i,definition:r,raw:`${i.map(u=>u.raw).join("")}: ${r.map(u=>u.raw).join(` +`)}`}),i=[]),s=a+1}else s++;return[{type:"definition_list",items:o,raw:o.map(a=>a.raw).join(` +`)},s+1]}function Iae(e,t,n){const o=e[t].meta??{},s=String(o?.label??"0"),i=[],r=fu(n,!0);let l=t+1;for(;la.raw).join(` +`)}`},l+1]}function Lae(e,t,n){const o=e[t],s=o.attrs,i=Array.isArray(s)&&s.length?Object.fromEntries(s.filter(c=>Array.isArray(c)&&c.length>=1&&c[0]).map(([c,d])=>[String(c),d==null||d===""?!0:String(d)])):void 0,r=String(o.tag?.substring(1)??"1"),l=Number.parseInt(r,10),a=e[t+1],u=String(a.content??"");return{type:"heading",level:l,text:u,...i?{attrs:i}:{},children:$o(a.children||[],u,void 0,n),raw:u}}function $ae(e,t,n){const o=t.toLowerCase(),s=new RegExp(String.raw`^<\s*${o}(?=\s|>|/)`,"i"),i=new RegExp(String.raw`^<\s*\/\s*${o}(?=\s|>)`,"i");let r=0,l=Math.max(0,n);for(;l$/.test(d)||r++,l=a+c+1;continue}l=a+1}return-1}function ML(e){const t=String(e.content??"");if(/^\s*");else if(a)a=!k.includes(">");else if(u)u=!k.includes("?>");else if(k.startsWith("");else if(k.startsWith("");else if(k.startsWith("");else{const w=s(k);if(w)if(w.closing){for(let b=r.length-1;b>=0;b--)if(r[b]===w.tag){r.length=b;break}}else w.selfClosing||i(w.after,w.tag)||r.push(w.tag)}}if(d===-1||d>=t)break;c=d+1}return l||a||u||r.length>0}function mue(e,t,n){if(!n?.length)return!1;const o=new Set(Ec(n));if(!o.size)return!1;const s=c=>{const d=c.charCodeAt(0);return d>=65&&d<=90||d>=97&&d<=122||d>=48&&d<=57||c==="_"||c==="-"||c===":"},i=c=>c===" "||c===" ",r=c=>{if(c[0]!=="<")return null;let d=1;for(;d"&&v!=="/")return null;const k=c.indexOf(">",d);if(k===-1)return null;let w=k-1;for(;w>=0&&i(c[w]);)w--;return{closing:f,tag:m,selfClosing:!f&&c[w]==="/",after:c.slice(k+1)}},l=(c,d)=>{const f=c.toLowerCase();let h=0;for(;h")return!0}}return!1},a=[];let u=0;for(;u=t?t:c,f=e.slice(u,d),h=f.endsWith("\r")?f.slice(0,-1):f,m=w1(h);if(m){const v=r(h.slice(m.index));if(v)if(v.closing){for(let k=a.length-1;k>=0;k--)if(a[k]===v.tag){a.length=k;break}}else v.selfClosing||l(v.after,v.tag)||a.push(v.tag)}if(c===-1||c>=t)break;u=c+1}return a.length>0}function gue(e,t){const n=Zae.exec(e);if(!n)return null;const o=n[1]??"",s=n.index+o.length,i=e.indexOf(` +`,s),r=e.slice(s,i===-1?e.length:i);return!w1(r.endsWith("\r")?r.slice(0,-1):r)||pue(e,s)||hue(e,s)||mue(e,s,t)?null:`${e.slice(0,n.index)}${o}`}function DL(e,t,n){let o=t;for(;oo&&(r=!0),t.inMath=!1,t.mathOpenOffset=null,i+=2;continue}i++;continue}if(t.inDollarMath){if(e.startsWith("$$",i)&&!of(e,l)){o!=null&&s&&n+i+2>o&&(r=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,i+=2;continue}i++;continue}if(e[i]==="`"&&!of(e,l)){const a=DL(e,i,"`"),u=vue(e,i+a,a);if(u===-1)break;i=u+a;continue}if(e.startsWith("\\[",i)&&!of(e,l)){t.inMath=!0,t.mathOpenOffset=n+i,i+=2;continue}if(e.startsWith("$$",i)&&!of(e,l)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+i,i+=2;continue}i++}return r}function yue(e,t){if(!Xy(t))return e;const n=t,o=Ww.get(n),s=o?.source===e?o.state:o&&e.startsWith(o.source)?BL(o.state,e.slice(o.source.length),o.source.length-o.state.lineBuffer.length).state:S2(e).state;Ww.set(n,{source:e,state:s});const{context:i}=s,r=i.inMath?i.mathOpenOffset:i.inDollarMath?i.dollarMathOpenOffset:null;if(r==null)return e;const l=e.slice(r+2),a=e.lastIndexOf(` +`,r-1)+1;if(e.slice(a,r).trim()!==""&&!/^\r?\n/.test(l)||/^\s*!\[/.test(l))return e;const u=l.trim(),c=/^(?:[a-z]|pi)$/i.test(u);return Oa(l)&&!c?e:e.slice(0,r)}function kue(e,t,n,o,s){const i=i5(e),r=r5(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&l5(e)==null&&z9(t),t.inFence&&t.fenceInList&&e.trim()&&i.column=t.fenceLen&&/^\s*$/.test(l.rest)&&z9(t):(t.inFence=!0,t.fenceChar=l.markerChar,t.fenceLen=l.markerLen,t.fenceInBlockquote=l.inBlockquote,t.fenceInList=l.inList||t.listContentIndent!=null&&!l.inBlockquote&&i.column>=t.listContentIndent,t.fenceListIndent=l.listIndent||t.listContentIndent||0);else if(!t.inFence)return qw(e,t,n,o,s)}else return qw(e,t,n,o,s);return!1}function S2(e,t=aue(),n=null,o=!1,s=0){const i=qf(t);let r=qf(t),l="",a=!1,u=0;for(;uu&&e[c-1]==="\r"?c-1:d?c:e.length,h=e.slice(u,f);kue(h,i,s+u,n,o)&&(a=!0),d?(r=qf(i),l=""):l=h,u=d?c+1:e.length}return{closedOpenMath:a,state:{committedContext:r,context:i,lineBuffer:l}}}function BL(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&!(e.lineBuffer.endsWith("\\")&&(t[0]==="["||t[0]==="]"))?{closedOpenMath:!1,state:{committedContext:qf(e.committedContext),context:qf(e.context),lineBuffer:e.lineBuffer+t}}:S2(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function bue(e,t){if(!Xy(e))return;const n=e.stream;if(typeof n?.reset!="function")return;const o=e,s=x2.get(o);if(s?.source===t)return;const i=s?t.startsWith(s.source):!1,r=i&&s?t.slice(s.source.length):"",l=i&&s?BL(s.explicitBracketMath,r,s.source.length-s.explicitBracketMath.lineBuffer.length):S2(t),a=l.state,u=i&&s?l.closedOpenMath:!1;if(s&&i&&s.key===null&&s.pendingCandidate===!1&&!u&&!fue(s.source,r)&&!cue(t)){s.source=t,s.explicitBracketMath=a;return}const c=ole(t);(s&&(s&&!i||s.key!==c||u)||!s&&c)&&n.reset(),uue(e,t,c,a)}function Cue(e){return typeof e.preTransformTokens=="function"||typeof e.postTransformTokens=="function"}function wue(e,t){const n=e?.map,o=t?.map;return n===o?!0:!Array.isArray(n)||!Array.isArray(o)?!1:n.length===o.length&&n.every((s,i)=>s===o[i])}function W9(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&wue(e,t)}function Kw(e,t){return e[t]?.type==="paragraph_open"&&e[t+1]?.type==="inline"&&e[t+2]?.type==="paragraph_close"}function _ue(e){for(let t=0;t+5":""}function Gw(e){return{type:"paragraph",children:e,raw:e.map(Aue).join("")}}function Yw(e,t){if(t.sourceMap)for(const n of e)n.sourceMap||(n.sourceMap=t.sourceMap)}function Xw(e,t){if(e.type!=="paragraph")return null;const n=e.children,o=Array.isArray(n)?n:[];if(o.length===0)return null;const s=oue(t);if(!s?.size)return null;let i=-1;for(let c=0;ch?.type==="hardbreak")){i=c;break}}if(i===-1)return null;const r=o.slice(0,i),l=o[i];if(!l)return null;const a=[];r.length&&a.push(Gw(r)),a.push(l);const u=o.slice(i+1);return u.length&&a.push(Gw(u)),a}function Mue(e){const t=e.trim();if(!t)return null;const n=/^(?:]*>\s*)?]*)?>/i.test(t),o=/<\/html>\s*$/i.test(t);return!n||!o?null:[{type:"html_block",tag:"html",raw:e,content:e,loading:!1}]}function Kf(e){const t=e.raw;if(typeof t=="string")return t;const n=e.content;return typeof n=="string"?n:""}function Tue(e,t){if(e.type!=="html_block"||!t)return!1;const n=String(e.raw??e.content??"");return new RegExp(String.raw`^\s*<\s*\/\s*${Gr(t)}\s*>\s*$`,"i").test(n)}const U9=new Set(["iframe","script","style","textarea","title"]);function Xp(e,t,n){if(!e||!t)return null;const o=t.toLowerCase(),s=f=>{if(e.startsWith("",f+4);return{closing:!1,end:_===-1?e.length:_+3,selfClosing:!1,tag:""}}if(e.startsWith("",f+9);return{closing:!1,end:_===-1?e.length:_+3,selfClosing:!1,tag:""}}const h=Vo(e.slice(f));if(h===-1)return null;const m=f+h+1,v=e.slice(f,m);if(/^<\s*[!?]/.test(v))return{closing:!1,end:m,selfClosing:!1,tag:""};let k=v.slice(1).trimStart();const w=k.startsWith("/");w&&(k=k.slice(1).trimStart());const b=k.match(/^([A-Z][\w:-]*)/i);return b?.[1]?{closing:w,end:m,selfClosing:/\/\s*>$/.test(v),tag:b[1].toLowerCase()}:{closing:!1,end:f+1,selfClosing:!1,tag:""}},i=(f,h)=>{const m=new RegExp(String.raw`<\s*\/\s*${Gr(f)}(?=\s|>)`,"gi");m.lastIndex=h;const v=m.exec(e);if(!v||v.index==null)return null;const k=s(v.index);return k?{start:v.index,end:k.end}:null};let r=-1,l=-1,a=Math.max(0,n);for(;a$/.test(u))return{raw:u,start:r,end:l+1,closed:!0};if(U9.has(o)){const f=i(o,l+1);return f?{raw:e.slice(r,f.end),start:r,end:f.end,closeStart:f.start,closed:!0}:{raw:e.slice(r),start:r,end:e.length,closed:!1}}let c=1,d=l+1;for(;d]*$/,"")} +`}function Jw(e){return e.replace(/\r\n/g,` +`).replace(/(^|\n)[ \t]{1,4}/g,"$1")}function Lue(e,t,n){return n?e.includes(n,t)?!0:Jw(e.slice(Math.max(0,t))).includes(Jw(n)):!1}function $ue(e,t){let n=Math.max(0,t);for(;n)`,"gi");let o=-1,s;for(;(s=n.exec(e))!==null;)o=s.index;return o}function zL(e,t){return{final:t,__disableStreamParse:!0,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink}}const Fue=new Set(["admonition","blockquote","code_block","definition_list","footnote","heading","list","math_block","table","thematic_break"]),Rue=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m;function Oue(e){return/\n\s*\n/.test(e)||Rue.test(e)}function Pue(e,t){if(!e.trim()||t.length===0)return!1;if(t.some(o=>Fue.has(String(o?.type??"").toLowerCase()))||t.some(o=>{if(o?.type!=="html_block")return!1;const s=o;return Array.isArray(s.children)&&s.children.length>0}))return!0;if(!Oue(e))return!1;if(t.length>1)return!0;const[n]=t;return!!(n&&n.type==="paragraph")}function Due(e){const t=[];let n=0;for(;n=e.length)break;const o=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!o?.[1])return null;const s=Xp(e,o[1],n);if(!s||s.start!==n)return null;t.push(s.raw),n=s.end}return t.length>1?t:null}function Bue(e,t,n,o){const s=n.customHtmlTags?.join("\0")??"",i=t,r=zw.get(i),l=r&&r.final===o&&r.customHtmlTags===s&&r.requireClosingStrong===n.requireClosingStrong&&r.validateLink===n.validateLink,a=e.map((u,c)=>l&&r.blocks[c]===u?r.children[c]:Ud(u,t,n));return zw.set(i,{blocks:e,children:a,customHtmlTags:s,final:o,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),a.flat()}function Hue(e,t,n,o){return e.map(s=>{if(s?.type!=="html_block")return s;const i=s,r=String(i.tag??"").toLowerCase();if(!r||r==="details"||UI.has(r)||Array.isArray(i.children))return s;const l=String(s.raw??i.content??"");if(!l)return s;const a=Vo(l);if(a===-1)return s;const u=Xp(l,r,0),c=u?.closeStart??-1,d=u?.closed===!0&&c>=a+1,f=d?l.slice(a+1,c):l.slice(a+1);if(!f.trim())return s;const h=zL(n,o),m=d?null:Due(f),v=m?Bue(m,t,h,o):Ud(f,t,h);return Pue(f,v)?{...s,children:v}:s})}function zue(e){for(const t of e)if(t?.type==="html_block")return!0;return!1}function Ud(e,t,n){return e.trim()?UL(e,t,{...n,__disableStreamParse:!0}):[]}function Wue(e,t,n){const o=Ud(e,t,n),s=o[0];return o.length===1&&s?.type==="paragraph"&&Array.isArray(s.children)?s.children:o}function Uue(e,t,n){const o=ML({content:e}),s=Vo(e),i=HL(e,"summary");if(s!==-1&&i!==-1&&i>=s+1){const r=Wue(e.slice(s+1,i),t,n);r.length>0&&(o.children=r)}return o.raw=e,o}function jue(e,t,n){const o=Vo(e);if(o===-1)return[];const s=e.slice(o+1);if(!s.trim())return[];const i=Xp(s,"summary",0);if(!i)return Ud(s,t,n);const r=s.slice(0,i.start),l=s.slice(i.end);return[...Ud(r,t,n),Uue(i.raw,t,n),...Ud(l,t,n)]}function WL(e,t,n,o,s,i=0){const r=[];let l=i;for(let a=0;a{const W=HL(f,"details");return W!==-1?f.slice(0,W):f})():f,[_]=WL(w?[]:v===-1?e.slice(a+1):e.slice(a+1,v),t,n,o,s,h+f.length),g=jue(b,n,zL(o,s)),x=v===-1?"":String(e[v].raw??Kf(e[v])??""),S=w||v!==-1&&k?.closed===!0,T=x.replace(/[\t\r\n ]+$/,""),A=S?(()=>{const W=(k?.raw??"").lastIndexOf(T);return W===-1?t.length:h+W})():t.length,E=Vo(f),P=w&&E!==-1?h+E+1:h+f.length,D=t.slice(P,A===-1?t.length:A),I=n.parse(D,{__markstreamFinal:s}),$=n.renderer.render(I,n.options,{__markstreamFinal:s}),B=A+T.length,H=S?Math.max(A+x.length,$ue(t,B)):t.length,O=S?t.slice(A,H):x,F=S?t.slice(h,H):t.slice(h),U=w&&E!==-1?f.slice(0,E+1):f,z={...u,tag:"details",attrs:w2(f.slice(0,E+1)),raw:F,content:`${U}${$}${O}`,children:[...g,..._],loading:!s&&!S};if(o.includeSourceMap&&(z.sourceMap=Ep(t,h,S?H:t.length,o)),r.push(z),l=S?H:t.length,v===-1&&!w)break;v!==-1&&(a=v)}return[r,l]}function Vue(e,t,n,o){if(!n)return e;const s=e.slice();let i=0;for(let r=0;r=d.start&&E.end<=d.end){s.splice(S,1);continue}break}x=A+T.length,s.splice(S,1)}}return s}function que(e){const t=l=>l===" "||l===" "||l===` +`||l==="\r",n=l=>{if(!l||l[0]!=="<"||l.includes(">"))return!1;let a=1;if(a{const k=v.charCodeAt(0);return k>=65&&k<=90||k>=97&&k<=122},c=v=>{const k=v.charCodeAt(0);return k>=48&&k<=57},d=v=>v==="!"||u(v),f=v=>u(v)||c(v)||v===":"||v==="-",h=v=>u(v)||c(v)||v==="_"||v==="."||v===":"||v==="-",m=h;if(a>=l.length||!d(l[a]))return!1;for(a++;a=l.length)return!0;if(l[a]==="/"){for(a++;a=l.length}if(!h(l[a]))return!1;for(a++;a=l.length)return!0;const v=l[a];if(v==='"'||v==="'"){for(a++;a=l.length)return!0;a++}else{for(;a"||k==='"'||k==="'"||k==="`")break;a++}if(a>=l.length)return!0}}}return!0},o=(l,a)=>{let u=!1,c="",d=0;const f=b=>b===" "||b===" ",h=b=>{let _=0;for(;_{let _=0;for(;_";)for(g=!0,_++;_{const _=h(b);if(_)return _;const g=m(b);return g==null?null:h(g)};let k=0;const w=l.split(/\r?\n/);for(const b of w){const _=k,g=k+b.length;if(a<_)break;const x=v(b);if(x){const S=x.markerChar,T=x.markerLen;u?S===c&&T>=d&&/^\s*$/.test(x.rest)&&(u=!1,c="",d=0):(u=!0,c=S,d=T)}if(a<=g)break;k=g+1}return u},s=String(e??""),i=s.lastIndexOf("<");if(i===-1||o(s,i))return s;if(i>0){const l=s[i-1],a=l===" "||l===" "||l===` +`||l==="\r",u=s[i-2];if(!a&&!((l==="n"||l==="r")&&u==="\\"))return s}const r=s.slice(i);return r.includes(">")||r.length>1&&(r[1]===" "||r[1]===" "||r[1]===` +`||r[1]==="\r")||!n(r)?s:s.slice(0,i)}function e_(e,t){if(e===t)return;const n=e.split(/\r?\n/),o=t.split(/\r?\n/),s=[];let i=0;for(let r=0;r{const l=Number.isFinite(r)?Math.max(0,Math.trunc(r)):0;if(lString(m??"").toLowerCase()).filter(Boolean));if(!n.size)return e;const o=m=>m===" "||m===" ",s=m=>{const v=m.charCodeAt(0);return v>=65&&v<=90||v>=97&&v<=122||v>=48&&v<=57||m==="_"||m==="-"||m===":"},i=m=>{if(!m)return!1;if(m[0]===" ")return!0;let v=0;for(let k=0;k=4)return!0;continue}if(w===" ")return!0;break}return!1},r=m=>{let v=!1,k=!1;for(let w=0;w")return w}return-1},l=m=>{let v=0;for(;v{if(i(m))return-1;const k=m.replace(/^[ \t]+/,"");if(!k||k.startsWith(">")||k.startsWith("|")||/^(?:[*+-]|\d+[.)])[\t ]+/.test(k))return-1;let w=!1,b=0;for(;b=x.length){w=!0,b++;continue}const T=x[S];if(T==="!"||T==="?"){w=!0,b+=g+1;continue}if(T==="/"){w=!0,b+=g+1;continue}const A=S;for(;S"&&P!=="/"){w=!0,b++;continue}const D=new RegExp(String.raw`<\s*\/\s*${E}\s*>`,"i"),I=/\/\s*>$/.test(x),$=D.test(m.slice(b+g+1)),B=D.test(e.slice(v+b+g+1)),H=/[\r\n]/.test(e.slice(v+b+g+1));if(w&&n.has(E)&&!I&&!$&&(B||H))return b;w=!0,b+=g+1}return-1};let u=!1,c="",d=0,f="",h=0;for(;hh&&e[m-1]==="\r",w=v?k?m-1:m:e.length,b=e.slice(h,w),_=v?k?`\r +`:` +`:"",g=l(b);let x=b;if(!u&&!g){const S=a(b,h);if(S!==-1){const T=_||` +`;x=`${b.slice(0,S).replace(/[ \t]+$/,"")}${T}${T}${b.slice(S).replace(/^[ \t]+/,"")}`}}f+=x,f+=_,g&&(u?g.markerChar===c&&g.markerLen>=d&&/^\s*$/.test(g.rest)&&(u=!1,c="",d=0):(u=!0,c=g.markerChar,d=g.markerLen)),h=v?m+1:e.length}return f}function Zue(e,t){if(!e||!t.length)return e;const n=new Set(t.map(d=>String(d??"").toLowerCase()));if(!n.size)return e;const o=d=>d===" "||d===" ",s=d=>{const f=d.charCodeAt(0);return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||d==="_"||d==="-"},i=d=>{let f=0;for(;f{let f=!1,h=!1;for(let m=0;m")return m}return-1},l=(d,f,h)=>{const m=h.toLowerCase();let v=d.indexOf("<",f);for(;v!==-1;){let k=v+1;for(;k=d.length||d[k]!=="/"){v=d.indexOf("<",v+1);continue}for(k++;kd.length){v=d.indexOf("<",v+1);continue}let w=!0;for(let _=0;_="A"&&g<="Z"?String.fromCharCode(g.charCodeAt(0)+32):g)!==m[_]){w=!1;break}}if(!w){v=d.indexOf("<",v+1);continue}let b=k+m.length;if(b")return!0;v=d.indexOf("<",v+1)}return!1},a=d=>{let f=0;for(;f=d.length||d[f]!=="<")return d;for(f++;f=d.length||d[f]==="/")return d;const h=f;for(;fc&&e[d-1]==="\r",h=f?d-1:d,m=e.slice(c,h);u+=a(m),u+=f?`\r +`:` +`,c=d+1}return u}function Gue(e,t){if(!e||!t.length)return e;const n=new Set(t.map(f=>String(f??"").toLowerCase()));if(!n.size)return e;const o=f=>f===" "||f===" ",s=f=>{let h=0,m=!1,v=0;for(;h=f.length||f[h]!==">")break;for(m=!0,h++;h{let h=0;for(;hnew RegExp(String.raw`(<\s*\/\s*${f}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,"gi"));let l=!1,a="",u=0,c="",d=0;for(;dd&&e[f-1]==="\r",v=h?m?f-1:f:e.length,k=e.slice(d,v),w=h?m?`\r +`:` +`:"",b=s(k),_=b?.prefix??"",g=b?.content??k,x=i(g);x&&(l?x.markerChar===a&&x.markerLen>=u&&/^\s*$/.test(x.rest)&&(l=!1,a="",u=0):(l=!0,a=x.markerChar,u=x.markerLen));let S=g;if(!l&&S.includes("{if(D.replace(/^[\t ]+/,"").startsWith("|"))return A;const I=D.slice(0,P).replace(/^[\t ]+/,"");if(I.length>0){const $=E.match(/^<\s*\/\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??"",B=I.match(/^<\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??"";if(!$||!B||$!==B)return A}return`${E} + +`});if(_){const T=_+S.split(` +`).join(` +${_}`);c+=T}else c+=S;c+=w,d=h?f+1:e.length}return c}function Yue(e,t){if(!e||!t.length)return e;const n=new Set(t.map(I=>String(I??"").toLowerCase()));if(!n.size)return e;const o=I=>I===" "||I===" ",s=I=>{if(!I)return!1;if(I[0]===" ")return!0;let $=0;for(let B=0;B=4)return!0;continue}if(H===" ")return!0;break}return!1},i=I=>{const $=I.charCodeAt(0);return $>=65&&$<=90||$>=97&&$<=122||$>=48&&$<=57||I==="_"||I==="-"||I===":"},r=I=>{let $=0;for(;${let $=0,B=!1,H=0;for(;$=I.length||I[$]!==">")break;for(B=!0,$++;$r(I).startsWith("<"),u=I=>{for(let $=0;${if(s(I))return"";const $=r(I);if(!$.startsWith("<"))return"";let B=1;for(;B<$.length&&o($[B]);)B++;if(B>=$.length||$[B]==="/"||$[B]==="!"||$[B]==="?")return"";const H=B;for(;B<$.length&&i($[B]);)B++;if(B===H)return"";const O=$.slice(H,B).toLowerCase();if(!n.has(O))return"";const F=$[B];return F&&F!==" "&&F!==" "&&F!==">"&&F!=="/"?"":O},d=I=>{if(s(I))return null;const $=r(I);if(!$.startsWith("<"))return null;let B=1;for(;B<$.length&&o($[B]);)B++;if(B>=$.length)return null;const H=$[B]==="/";if(H)for(B++;B<$.length&&o($[B]);)B++;const O=$[B];if(!O||O==="!"||O==="?")return null;const F=B;for(;B<$.length&&i($[B]);)B++;if(B===F)return null;const U=$.slice(F,B).toLowerCase();if(!n.has(U))return null;const z=$[B];if(z&&z!==" "&&z!==" "&&z!==">"&&z!=="/")return null;if(H)return{type:"close",name:U};if(/\/\s*>\s*$/.test($))return{type:"open",name:U,complete:!0};const W=$.indexOf(">",B);if(W!==-1){const K=$.slice(W+1);if(new RegExp(`<\\s*\\/\\s*${U}\\s*>`,"i").test(K))return{type:"open",name:U,complete:!0}}return{type:"open",name:U,complete:!1}},f=I=>{if(s(I))return null;const $=r(I).replace(/[ \t]+$/,"");if(!$.startsWith("<")||/^<\s*(?:!--|!doctype\b|\?)/i.test($))return null;const B=$.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(B?.[1])return B[1].toLowerCase();const H=$.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!H?.[1]||!H[2])return null;const O=H[1].toLowerCase();return O===H[2].toLowerCase()?O:null};let h=!1,m="",v=0;const k=I=>{let $=0;for(;$k(I),b=I=>{const $=r(I);return $?s(I)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test($):!1},_=(I,$,B)=>{let H=I,O=0;for(;HH&&e[F-1]==="\r",W=U?z?F-1:F:e.length,K=e.slice(H,W),V=l(K),ie=V?.key??"";if(O>0&&$&&ie!==$)break;const ne=V?.content??K,X=d(ne);if(X?.name===B){if(X.type==="open")X.complete||O++;else if(O>0&&(O--,O===0))return!1}else if(O>0&&(u(ne)||b(ne)))return!0;if(U)H=F+1;else break}return!1};let g="",x=0,S=!0,T=!1,A=!1,E=` +`;const P=[];let D="";for(;xx&&e[I-1]==="\r",H=$?B?I-1:I:e.length,O=e.slice(x,H),F=$?B?`\r +`:` +`:"",U=l(O),z=U?.key??"",W=U?.content??O,K=w(W);K&&(h?K.markerChar===m&&K.markerLen>=v&&/^\s*$/.test(K.rest)&&(h=!1,m="",v=0):(h=!0,m=K.markerChar,v=K.markerLen));const V=P.length>0;if(!h&&!V){const ne=c(W),X=!!ne&&!S&&T&&A&&_(x,z,ne);ne&&!S&&(!T||X)&&(z&&D&&z===D?g+=`${z}${E}`:z||(g+=E))}if(g+=O,g+=F,F&&(E=F),!h){const ne=d(W);if(ne){if(ne.type==="open")ne.complete||P.push(ne.name);else for(let X=P.length-1;X>=0;X--)if(P[X]===ne.name){P.length=X;break}}}const ie=u(W);S=ie,T=!ie&&a(W),A=!ie&&!!f(W),D=z,x=$?I+1:e.length}return g}function UL(e,t,n={}){const o=LL(n),s=o?l1():0,i=!!n.final,r=(e??"").toString();let l=r.replace(/([^\\])\r(ight|ho)/g,"$1\\r$2").replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,"$1\\n$2");if(rue(t,n)&&(t.stream.reset(),lue(t)),i||(l.endsWith("- *")&&(l=l.replace(/- \*$/,"- \\*")),/(?:^|\n)\s*-\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*-\s*$/,b=>b.startsWith(` +`)?` +`:""):/(?:^|\n)\s*--\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*--\s*$/,b=>b.startsWith(` +`)?` +`:""):/(?:^|\n)\s*>\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*>\s*$/,b=>b.startsWith(` +`)?` +`:""):/\n\s*[*+]\s*$/.test(l)?l=l.replace(/\n\s*[*+]\s*$/,` +`):/(?:^|\n)\s*\d+\s*$/.test(l)?/^\d+$/.test(l.trim())||(l=l.replace(/(?:^|\n)\s*\d+\s*$/,b=>b.startsWith(` +`)?` +`:"")):/(?:^|\n)\s*\d+[.)]\s+\*{1,3}\s*$/.test(l)?l=l.replace(/((?:^|\n)\s*\d+[.)]\s+)(\*{1,3})\s*$/,(b,_,g)=>`${_}${g.split("").map(()=>"\\*").join("")}`):/(?:^|\n)\s*\d+[.)]\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*\d+[.)]\s*$/,b=>b.startsWith(` +`)?` +`:""):/\n[[(]\n*$/.test(l)&&(l=l.replace(/(\n\[|\n\()+\n*$/g,` +`)),l=yue(l,t),l=gue(l,n.customHtmlTags)??l),n.customHtmlTags?.length&&l.includes("<")){const b=Ec(n.customHtmlTags);if(b.length&&(l=Kue(l,b),l=Zue(l,b),l=Yue(l,b),l=Gue(l,b),l.includes("[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,"gim");l=l.replace(g,"$1$2$2")}}i||(l=que(l));const a=Mue(l);if(a){if(n.includeSourceMap){const g={...n,__sourceLineMapper:e_(r,l)};a[0].sourceMap=Ep(l,0,l.length,g)}const b=n.preTransformTokens,_=n.postTransformTokens;if(s5(t,n)||typeof b=="function"||typeof _=="function"){const g=Zw(t,l,{__markstreamFinal:i},n),x=typeof b=="function"&&b(g)||g;typeof _=="function"&&_(x)}return Uw(a,n,o,s)}const u=Zw(t,l,{__markstreamFinal:i},n);if(!u||!Array.isArray(u))return Uw([],n,o,s);const c=n.preTransformTokens,d=n.postTransformTokens;let f=u;c&&typeof c=="function"&&(f=c(f)||f);const h=t,m=typeof h.validateLink=="function"&&h.__markstreamOriginalValidateLink&&h.validateLink!==h.__markstreamOriginalValidateLink?h.validateLink:void 0,v=n.validateLink??m??h.options?.validateLink??(typeof h.validateLink=="function"?h.validateLink:void 0),k={...n,validateLink:v,__markdownIt:t,__sourceLineMapper:n.includeSourceMap===!0?e_(r,l):void 0,__sourceMarkdown:l,__customHtmlBlockCursor:0};let w=nue(t,l,f,k,o);if(d&&typeof d=="function"){const b=d(f);if(Array.isArray(b)){const _=b[0],g=_?.type;_&&typeof g=="string"?w=Yh(b,{...k,__customHtmlBlockCursor:0},o):w=b}}if(zue(w)&&(w=Vue(w,i,l,k),w=WL(w,l,t,k,i)[0],w=Hue(w,t,k,i)),i){const b=new WeakSet,_=g=>{if(!g||typeof g!="object"||b.has(g))return;if(b.add(g),Array.isArray(g)){for(const S of g)_(S);return}const x=g;x.type==="html_block"&&x.loading===!0&&(x.loading=!1);for(const S of Object.values(x))_(S)};_(w)}return w=NL(w,n),n.debug&&console.log("Parsed Markdown Tree Structure:",w),$L(w,o,s)}function t_(e,t){if(!e||!Array.isArray(e))return[];const n=[],o=fu(t),s=t?.includeSourceMap===!0;let i=0;for(;ic.type==="html_block")){if(s)for(const c of u)Dn(c,l,t);for(const c of u)al(c,l,t);n.push(...u)}else{const c={type:"paragraph",raw:a,children:u};s&&Dn(c,l,t);const d=Xw(c,t);if(d){s&&Yw(d,c);for(const f of d)al(f,l,t);n.push(...d)}else al(c,l,t),n.push(c)}o.remember(a)}i+=1;break;default:i+=1;break}}return n}const Xue=/^([a-z][\w-]*)(?=[\t\n\f\r />]|$)/i,Jue=new Set([...Zp,"base","button","datalist","dialog","embed","fieldset","form","iframe","input","legend","link","meta","object","optgroup","option","output","param","select","style","template","textarea","title"]),Que=new Set(["a","abbr","b","blockquote","br","caption","code","col","colgroup","dd","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","picture","pre","s","small","source","span","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","ul"]);function n_(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ece(e){return typeof e=="string"?e:e==null?"":String(e)}function jL(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function Pa(e){return ece(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function VL(e){return Pa(e).replace(/`/g,"`")}function M2(e){return String(e??"").trim().toLowerCase()}function a5(e,t="safe"){const n=M2(e);return n?t==="escape"?!0:t==="trusted"?Zp.has(n):!Que.has(n):!1}function qL(e,t="safe"){const n=M2(e);return n?t==="escape"?!0:t==="trusted"?Zp.has(n):Jue.has(n):!1}function o_(e){const t=Object.entries(e);return t.length===0?"":t.map(([n,o])=>o===""?` ${n}`:` ${n}="${VL(o)}"`).join("")}function KL(e){const t=e.startsWith("/"),n=t?e.slice(1):e,o=n.match(Xue);return o?{attrsStr:t?"":n.slice(o[0].length).trimStart(),isClosing:t,isSelfClosing:!t&&e.trimEnd().endsWith("/"),tagName:o[1]}:null}function tce(e,t){const n=e.split(",").map(o=>o.trim()).filter(Boolean);return n.length===0?!1:n.some(o=>{const s=o.split(/\s+/,1)[0]??"";return!s||lc(s,{tagName:t,attrName:"srcset"})})}function ZL(e,t,n,o){return Yse.has(e)||n==="safe"&&e==="style"?!0:e==="srcset"?tce(t,o):!!(Xse.has(e)&&t&&lc(t,{tagName:o,attrName:e}))}function Gu(e,t){const n=t.toLowerCase();return Object.keys(e).find(o=>o.toLowerCase()===n)}function GL(e,t,n,o=!1){if(t!=="safe"||M2(n)!=="a")return e;const s=Gu(e,"href");if(o&&(!s||!e[s])){const a=Gu(e,"target"),u=Gu(e,"rel");return a&&delete e[a],u&&delete e[u],e}const i=Gu(e,"target");if((i?String(e[i]).trim():"").toLowerCase()!=="_blank")return e;const r=Gu(e,"rel"),l=new Set(String(r?e[r]:"").split(/\s+/).map(a=>a.trim()).filter(Boolean).filter(a=>a.toLowerCase()!=="opener"));return l.add("noopener"),l.add("noreferrer"),r&&r!=="rel"&&delete e[r],e.rel=Array.from(l).join(" "),e}function s_(e,t="safe",n){const o={};for(const[s,i]of Object.entries(e)){const r=s.trim(),l=r.toLowerCase();!r||!jL(r)||ZL(l,i,t,n)||(o[r]=i)}return GL(o,t,n,!!Gu(e,"href"))}function YL(e,t){const n=e.toLowerCase();return WI.has(n)?!1:n_(t,n)||n_(t,e)}function u5(e,t="safe",n){const o={};for(const[s,i]of Object.entries(e)){const r=s.trim(),l=r.toLowerCase();!r||!jL(r)||ZL(l,i,t,n)||(o[r]=i)}return GL(o,t,n,!!Gu(e,"href"))}function Zf(e){const t={};if(!Array.isArray(e)||e.length===0)return t;for(const[n,o]of e)n&&(t[String(n)]=o==null?"":String(o));return t}function Xh(e,t="safe",n){const o=u5(Zf(e),t,n),s=Object.entries(o).map(([i,r])=>[i,r]);return s.length>0?s:void 0}function nce(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return e==="true"||e===""||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const o=Number(e);if(e!==""&&!Number.isNaN(o))return o}return e}function oce(e){const t={};for(const[n,o]of Object.entries(e))t[n]=nce(o,n);return t}function j9(e){return e.trim().length>0}function XL(e){const t=[];let n=0;for(;n",n);if(r!==-1){n=r+3;continue}break}const o=e.indexOf("<",n);if(o===-1){if(nn){const r=e.slice(n,o);j9(r)&&t.push({type:"text",content:r})}if(e.startsWith("![CDATA[",o+1)){const r=e.indexOf("]]>",o);if(r!==-1){t.push({type:"text",content:e.slice(o,r+3)}),n=r+3;continue}break}if(e.startsWith("!",o+1)){const r=e.indexOf(">",o);if(r!==-1){n=r+1;continue}break}const s=e.indexOf(">",o);if(s===-1)break;const i=KL(e.slice(o+1,s));if(!i){const r=e.slice(o,s+1);j9(r)&&t.push({type:"text",content:r}),n=s+1;continue}if(i.isClosing)t.push({type:"tag_close",tagName:i.tagName});else{const r={};if(i.attrsStr){const l=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let a;for(;(a=l.exec(i.attrsStr))!==null;){const u=a[1],c=a[2]??a[3]??a[4]??"";u&&!u.endsWith("/")&&(r[u]=c)}}t.push({type:i.isSelfClosing||eu.has(i.tagName.toLowerCase())?"self_closing":"tag_open",tagName:i.tagName,attrs:r})}n=s+1}return t}function sce(e){const t=[];let n=0;for(;n",n);if(l!==-1){n=l+3;continue}break}const o=e.indexOf("<",n);if(o===-1){nn&&t.push({type:"text",content:e.slice(n,o)}),e.startsWith("![CDATA[",o+1)){const l=e.indexOf("]]>",o);if(l!==-1){t.push({type:"text",content:e.slice(o,l+3)}),n=l+3;continue}break}if(e.startsWith("!",o+1)){const l=e.indexOf(">",o);if(l!==-1){n=l+1;continue}break}const s=e.indexOf(">",o);if(s===-1)break;const i=KL(e.slice(o+1,s));if(!i){t.push({type:"text",content:e.slice(o,s+1)}),n=s+1;continue}if(i.isClosing){t.push({type:"tag_close",tagName:i.tagName}),n=s+1;continue}const r={};if(i.attrsStr){const l=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let a;for(;(a=l.exec(i.attrsStr))!==null;){const u=a[1],c=a[2]??a[3]??a[4]??"";u&&!u.endsWith("/")&&(r[u]=c)}}t.push({type:i.isSelfClosing||eu.has(i.tagName.toLowerCase())?"self_closing":"tag_open",tagName:i.tagName,attrs:r}),n=s+1}return t}function ice(e){const t=String(e.tagName??"").trim();if(!t)return"";if(e.type==="tag_close")return`</${Pa(t)}>`;const n=Object.entries(e.attrs??{}).map(([o,s])=>s===""?` ${Pa(o)}`:` ${Pa(o)}="${VL(s)}"`).join("");return e.type==="self_closing"?`<${Pa(t)}${n} />`:`<${Pa(t)}${n}>`}function rce(e,t){if(!e||!e.includes("<")||!t||Object.keys(t).length===0)return!1;for(const n of XL(e))if((n.type==="tag_open"||n.type==="self_closing")&&YL(n.tagName??"",t))return!0;return!1}function jd(e,t="safe"){if(!e)return"";if(t==="escape")return Pa(e);const n=sce(e),o=[],s=[],i=[];for(const r of n){if(r.type==="text"){i.length===0&&s.push(Pa(r.content??""));continue}const l=M2(r.tagName);if(!l)continue;if(qL(l,t)){r.type==="tag_open"?i.push(l):r.type==="tag_close"&&i[i.length-1]===l&&i.pop();continue}if(i.length>0)continue;if(t==="safe"&&a5(l,t)){s.push(ice(r));continue}if(r.type==="self_closing"){s.push(`<${l}${o_(s_(r.attrs??{},t,l))}>`);continue}if(r.type==="tag_open"){s.push(`<${l}${o_(s_(r.attrs??{},t,l))}>`),eu.has(l)||o.push(l);continue}const a=o.lastIndexOf(l);if(a===-1)continue;for(;o.length>a+1;){const c=o.pop();c&&s.push(``)}const u=o.pop();u&&s.push(``)}for(;o.length>0;){const r=o.pop();r&&s.push(``)}return s.join("")}const lce=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],i_="http://www.w3.org/2000/svg",ace=new Set(["script","style","iframe","object","embed","link","meta"]),uce=new Set(["svg","style","g","a","defs","marker","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","title","desc","use","image","lineargradient","radialgradient","stop","clippath","mask","pattern"]),cce=new Set(["href","xlink:href","src","srcdoc","action","data","formaction","poster"]),dce=new Set(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]),fce=new Set(["circle","ellipse","image","line","path","polygon","polyline","rect","text","tspan","use"]);function pce(e){return(e.getAttribute("href")||e.getAttribute("xlink:href"))?.startsWith("#")===!0}function hce(e){return!!(e.getAttribute("href")||e.getAttribute("xlink:href")||e.getAttribute("src"))}function mce(e){const t=e.nodeName.toLowerCase();return t==="use"?pce(e):t==="image"?hce(e):t==="text"||t==="tspan"?!!e.textContent?.trim():fce.has(t)}function gce(e){return e.replace(/(["'])\s*javascript:/gi,"$1#").replace(/\bjavascript:/gi,"#").replace(/(["'])\s*vbscript:/gi,"$1#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#")}function vce(e,t,n){const o=e.toLowerCase(),s=t.toLowerCase(),i=String(n??"").trim();return i?(o==="use"||o==="marker"||o==="clippath"||o==="mask")&&(s==="href"||s==="xlink:href")?i.startsWith("#")?i:"":o==="a"&&(s==="href"||s==="xlink:href")?lc(i,{tagName:"a",attrName:"href"})?"":i:o==="image"&&(s==="href"||s==="xlink:href"||s==="src")?lc(i,{tagName:"img",attrName:"src"})?"":i:s==="href"||s==="xlink:href"?i.startsWith("#")?i:"":lc(i,{tagName:o,attrName:s})?"":i:""}function yce(e,t){let n=t+4;for(;n{const o=n.trim();if(/^[0-9a-f]+$/i.test(o)){const s=Number.parseInt(o,16);try{return Number.isFinite(s)?String.fromCodePoint(s):""}catch{return""}}return String(n).trim()})}function QL(e){const t=JL(e),n=t.toLowerCase();let o=0;for(;on.test(t))||QL(t)}function kce(e){if(e.tagName.toLowerCase()!=="a"||e.getAttribute("target")?.trim().toLowerCase()!=="_blank")return;const t=new Set(String(e.getAttribute("rel")??"").split(/\s+/).map(n=>n.trim()).filter(Boolean).filter(n=>n.toLowerCase()!=="opener"));t.add("noopener"),t.add("noreferrer"),e.setAttribute("rel",Array.from(t).join(" "))}function yh(e){const t=Number.parseFloat(String(e??""));return Number.isFinite(t)?t:0}function e$(e,t){if(e.nodeType===Node.TEXT_NODE){const s=e.textContent??"";s&&t.push(s);return}if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,o=n.tagName.toLowerCase();if(!ace.has(o)){if(o==="br"){t.push(` +`);return}for(const s of Array.from(n.childNodes))e$(s,t)}}function bce(e){for(const t of Array.from(e.querySelectorAll("foreignObject"))){const n=[];e$(t,n);const o=n.join("").split(/\r?\n/).map(c=>c.trim()).filter(Boolean);if(!o.length){t.remove();continue}const s=yh(t.getAttribute("width")),i=yh(t.getAttribute("height")),r=yh(t.getAttribute("x")),l=yh(t.getAttribute("y")),a=e.ownerDocument.createElementNS(i_,"text");a.setAttribute("x",String(r+s/2)),a.setAttribute("y",String(l+i/2)),a.setAttribute("text-anchor","middle"),a.setAttribute("dominant-baseline","central");const u=t.querySelector(".nodeLabel");if(u?.getAttribute("class")&&a.setAttribute("class",u.getAttribute("class")),o.length===1)a.textContent=o[0];else{const c=-.6*(o.length-1);for(const[d,f]of o.entries()){const h=e.ownerDocument.createElementNS(i_,"tspan");h.setAttribute("x",String(r+s/2)),h.setAttribute("dy",d===0?`${c}em`:"1.2em"),h.textContent=f,a.appendChild(h)}}t.parentNode?.replaceChild(a,t)}}function Cce(e){bce(e);const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){const o=n.tagName.toLowerCase();if(!uce.has(o)){n.remove();continue}if(o==="style"&&r_(n.textContent??"")){n.remove();continue}const s=Array.from(n.attributes);for(const i of s){const r=i.name.toLowerCase();if(/^on/i.test(r)){n.removeAttribute(i.name);continue}if(r==="style"&&i.value&&r_(i.value)){n.removeAttribute(i.name);continue}if(r==="srcdoc"){n.removeAttribute(i.name);continue}if(cce.has(r)&&i.value){const l=vce(o,r,i.value);if(!l){n.removeAttribute(i.name);continue}l!==i.value&&n.setAttribute(i.name,l);continue}if(dce.has(r)&&i.value&&QL(i.value)){n.removeAttribute(i.name);continue}if(i.value){const l=gce(i.value);l!==i.value&&n.setAttribute(i.name,l)}}kce(n)}}function CVe(e){if(typeof DOMParser>"u"||!e)return null;try{const t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(!t||t.nodeName.toLowerCase()!=="svg")return null;const n=t;return Cce(n),wce(n)?null:n}catch{return null}}function wce(e){const t=e.getAttribute("viewBox");if(t){const s=t.trim().split(/[\s,]+/);if(s.length===4){const i=Number.parseFloat(s[2]||""),r=Number.parseFloat(s[3]||"");if(!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0)return!0}}const n=[e,...Array.from(e.querySelectorAll("*"))];let o=!1;for(const s of n){mce(s)&&(o=!0);for(const i of Array.from(s.attributes))if(/\bNaN\b/i.test(i.value)||i.name==="style"&&/max-width:\s*0(?:px)?/i.test(i.value))return!0}return!o}const kh=[];function V9(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function _ce(e){return(String(e||"text").trim().split(/\s+/)[0]||"text").replace(/[^\w+.#:-]/g,"-").replace(/-+/g,"-")||"text"}function xce(e){return e.replace(/[^\w:.+-]/g,"-").replace(/-+/g,"-")}function l_(e=`editor-${Date.now()}`,t={}){const n=fle(t),o=n;o.__markstreamRegisteredPluginCount=kh.length,o.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||kh.length);const s={"common.copy":"Copy"};let i;if(typeof t.i18n=="function")i=t.i18n;else if(t.i18n&&typeof t.i18n=="object"){const m=t.i18n;i=v=>m[v]??s[v]??v}else i=m=>s[m]??m;if(Array.isArray(t.plugin))for(const m of t.plugin){const v=m;if(Array.isArray(v)){const[k,...w]=v;typeof k=="function"&&n.use(k,...w)}else typeof v=="function"&&n.use(v)}if(Array.isArray(t.apply))for(const m of t.apply)try{m(n)}catch(v){console.error("[getMarkdown] apply function threw an error",v)}if(kh.length)for(const m of kh)if(Array.isArray(m)){const[v,...k]=m;typeof v=="function"&&n.use(v,...k)}else typeof m=="function"&&n.use(m);n.use(Tee),n.use(Lee),n.use(See);const r=Vee,l=r.default??r;n.use(l),n.use(xee),n.use(_ee),n.core.ruler.after("block","mark_fence_closed",m=>{const v=m,k=v.src,w=!!v.env?.__markstreamFinal,b=k.split(/\r?\n/);for(const _ of v.tokens){if(_.type!=="fence"||!_.map||!_.markup)continue;const g=_.map[0],x=_.map[1],S=_.markup,T=S[0],A=S.length,E=b[Math.max(0,x-1)]??"";let P=0;for(;Pg+1&&D>=A&&I===E.length,B=_;B.meta=B.meta??{},B.meta.unclosed=!$,B.meta.closed=!!$}});const a=(m,v)=>{const k=m,w=k.pos;if(k.src[w]!=="~")return!1;const b=k.src[w-1],_=k.src[w+1];if(/\d/.test(b)&&/\d/.test(_)){if(!v){const g=k.push("text","",0);g.content="~"}return k.pos+=1,!0}return!1};n.inline.ruler.before("sub","wave",a),n.renderer.rules.fence=(m,v)=>{const k=m[v],w=String(k.info??"").trim(),b=String(k.content??""),_=btoa(unescape(encodeURIComponent(b))),g=_ce(w),x=V9(g),S=xce(`editor-${e}-${v}-${g}`),T=V9(i("common.copy"));return`
      +
      + ${V9(g.toUpperCase())} + +
      +
      +
      `};const u=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,d=m=>{if(!m.startsWith("["))return!1;const v=c.exec(m);if(!v)return m!=="["&&!/^\[\d+$/.test(m);const k=String(v[1]??"");return m.slice(v[0].length).startsWith("(")?!1:!/^\d+$/.test(k)},f=(m,v)=>{const k=m;if(k.src[k.pos]!=="[")return!1;const w=u.exec(k.src.slice(k.pos));if(!w)return!1;const b=k.src.slice(Math.max(0,k.pos-120),k.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(b))return!1;const _=k.src.slice(k.pos+w[0].length);if(_.startsWith("](")||_.startsWith("(")||d(_))return!1;if(!v){const g=w[1],x=k.push("reference","span",0);x.content=g,x.markup=w[0],x.raw=w[0]}return k.pos+=w[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(m,v)=>{const w=String(m[v].content??"");return`${w}`};const h=n.use.bind(n);return n.use=((...m)=>(o.__markstreamHasCustomParserExtensions=!0,h(...m))),n}function Sce({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function t$({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Sce({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const Ace={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Mce(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function n$(e){const t=Mce(e);return Ace[t]??t}function Tce(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>n$(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Ece(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Ice(e){return Ece(e)?.join("\0")??""}function Lce(e,t){return`${Ice(e)}\0\0${Tce(t)?.join("\0")??""}`}function rd(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function a_(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var $ce=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const m=u_();this.startedAt=f&&this.hasStarted?m-this.normalizedStartDelayMs:m,this.lastTick=m,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=u_();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,k=Oce(m/Math.max(.001,v/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(k-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const w=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),b=Rce(this.source.slice(this.visible.length),w,this.segmenter);b.text&&(this.visible+=b.text,this.charBudget=Math.max(0,this.charBudget-b.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:u=80,flushOnFinish:c=!1}=e;this.minCharsPerSecond=rd(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,rd(o,1e3,1)),this.normalizedTargetLatencyMs=rd(s,900,1),this.normalizedCatchUpLatencyMs=rd(i,350,1),this.normalizedCatchUpThreshold=a_(r,600),this.normalizedStartDelayMs=a_(a,80),this.maxCommitFps=Math.trunc(rd(l,30,1)),this.maxCharsPerCommit=Math.trunc(rd(u,80,1)),this.flushOnFinish=c,this.segmenter=Fce(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function Nce(e={},t){const n=new $ce(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Fce(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function Rce(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function u_(){return typeof performance<"u"?performance.now():Date.now()}function Oce(e,t,n){return Math.min(n,Math.max(t,e))}var Pce=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const G3=Symbol.for("markstream-vue:node-lifecycle");function wVe(){}const c5=new Map;let o$="material";const Ad=new Map,c_=new Map;let Y3=null;function Dce(e){c5.set(e.id,e)}function Bce(e){const t=c5.get(o$);if(!t)return;const n=t.core[e];if(n)return n;const o=Ad.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Ad.has(t.id)&&zce(t)}function Hce(){var e,t;return(t=(e=c5.get(o$))==null?void 0:e.fallback)!=null?t:""}function zce(e){return Pce(this,null,function*(){var t,n,o;if(Ad.has(e.id))return(t=Ad.get(e.id))!=null?t:null;let s=c_.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Ad.set(e.id,i),Y3?.(),i)).catch(()=>(Ad.set(e.id,null),null)),c_.set(e.id,s)),s})}const d_='',f_='',Wce={id:"material",core:{"":f_,plain:'',text:f_,javascript:'',typescript:'',jsx:'',tsx:'',html:'',css:'',scss:'',json:'',python:'',ruby:'',go:'',java:'',kotlin:'',c:'',cpp:'',cs:d_,csharp:d_,php:'',shell:'',powershell:'',sql:'',yaml:'',markdown:'',xml:'',rust:'',vue:'',mermaid:''},fallback:'',loadExtended:()=>jo(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},Uce=Xr(0);Y3=()=>{Uce.value++},Dce(Wce);const jce={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function T2(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=jce[n])!=null?t:n}function _Ve(e){const t=T2(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function xVe(e){return Bce(T2(e))||Hce()}const p_={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var E2=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let ki=null,Qu=!1,ec=null,I2=f5;function Jp(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function d5(){try{const e=globalThis;return Jp(e?.katex)}catch{return null}}function f5(){return E2(null,null,function*(){const e=d5();if(e)return e;const t=yield jo(()=>import("./katex-DnlPpQZa.js"),[]);try{yield jo(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([0,1]))}catch{}return Jp(t)})}function s$(e){const t=Promise.resolve(e).then(n=>{var o;return ec===t&&n?(ki=(o=Jp(n))!=null?o:n,ki):null}).catch(()=>null).finally(()=>{ec===t&&(ec=null)});return ec=t,Qu=!0,t}function Vce(e){I2=e,ki=null,Qu=!1,ec=null}function qce(e){Vce(f5)}function i$(){return typeof I2=="function"}function SVe(){var e;const t=I2;if(!t||t===f5)return null;if(ki)return ki;const n=d5();if(n)return ki=n,ki;if(Qu)return null;try{const o=t();return o?typeof o?.then=="function"?(s$(o),null):(ki=(e=Jp(o))!=null?e:o,ki):null}catch{return null}}function r$(){return E2(this,null,function*(){var e;const t=d5();if(t)return ki=t,ki;if(ki)return ki;if(ec)return ec;if(Qu)return null;const n=I2;if(!n)return Qu=!0,null;try{const o=n();if(typeof o?.then=="function")return s$(o);if(o)return ki=(e=Jp(o))!=null?e:o,Qu=!0,ki}catch{}return Qu=!0,null})}function l$(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Ha=null,Na=null;const Ws=new Map,ea=new Map;let Lp=5;const uc=new Set;function Gf(){if(Ws.size{const{id:n,html:o,error:s}=t.data,i=Ws.get(n);if(i)if(Ws.delete(n),clearTimeout(i.timeoutId),i.cleanup(),Gf(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(ea.set(a,o),ea.size>200){const u=ea.keys().next().value;ea.delete(u)}}i.aborted||i.resolve(o)}},Ha.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Ws.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Ws.clear(),a$()}}function Zce(){var e;for(const t of Ws.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Ws.clear(),a$(),Ha&&((e=Ha.terminate)==null||e.call(Ha)),Ha=null,Na=null}function Gce(e,t=!0,n=2e3,o){return E2(this,null,function*(){performance.now();const s=l$(e);if(!i$()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if(Na)return Promise.reject(Na);const i=`${t?"d":"i"}:${s}`,r=ea.get(i);if(r)return Gf(),Promise.resolve(r);const l=Ha||(Na=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Na.name="WorkerInitError",Na.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Na);if(Ws.size>=Lp){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Ws.size,a.max=Lp,Promise.reject(a)}return new Promise((a,u)=>{if(o?.aborted){const v=new Error("Aborted");return v.name="AbortError",void u(v)}const c=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const v=Ws.get(c);if(!v)return;Ws.delete(c),v.cleanup();const k=new Error("Worker render timed out");k.name="WorkerTimeout",k.code="WORKER_TIMEOUT",v.aborted||v.reject(k),Gf()},n);d=()=>{const v=Ws.get(c);if(!v||v.aborted)return;v.aborted=!0,v.cleanup();const k=new Error("Aborted");k.name="AbortError",u(k)},o&&o.addEventListener("abort",d,{once:!0});const h=a,m=u;Ws.set(c,{resolve:v=>{h(v)},reject:v=>{m(v)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:c,content:s,displayMode:t})}catch(v){const k=Ws.get(c);Ws.delete(c),clearTimeout(f),k?.cleanup(),k?.reject(v),Gf()}})})}function AVe(e,t=!0,n){const o=`${t?"d":"i"}:${l$(e)}`;if(ea.set(o,n),ea.size>200){const s=ea.keys().next().value;ea.delete(s)}}const Yce="WORKER_BUSY";function Xce(e=2e3,t){return Ws.size{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),uc.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},uc.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const u=new Error("Wait for worker slot timed out");u.name="WorkerBusyTimeout",u.code="WORKER_BUSY_TIMEOUT",o(u)},e),queueMicrotask(()=>Gf()),t&&(r=()=>{if(i)return;i=!0,a();const u=new Error("Aborted");u.name="AbortError",o(u)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const sf={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function MVe(e){return E2(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!i$()){const v=new Error("KaTeX rendering disabled");throw v.name="KaTeXDisabled",v.code="KATEX_DISABLED",v}const a=(s=o.timeout)!=null?s:sf.timeout,u=(i=o.waitTimeout)!=null?i:sf.waitTimeout,c=(r=o.backoffMs)!=null?r:sf.backoffMs,d=(l=o.maxRetries)!=null?l:sf.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):sf.maxRetries,h=o.signal;let m=0;for(;;){if(h?.aborted){const v=new Error("Aborted");throw v.name="AbortError",v}try{return yield Gce(t,n,a,h)}catch(v){if(v?.code!==Yce||m>=f)throw v;if(m++,yield Xce(u,h).catch(()=>{}),h?.aborted){const k=new Error("Aborted");throw k.name="AbortError",k}c>0&&(yield new Promise(k=>globalThis.setTimeout(k,c*m)))}}})}function Md(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Jce(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function ig(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=Jce(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function rg(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function u$(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function lg(e,t=360,n=500){return u$(e,t,n)}function ag(e,t=360,n=500){return u$(e,t,n)}var Qce=Object.defineProperty,ede=Object.defineProperties,tde=Object.getOwnPropertyDescriptors,h_=Object.getOwnPropertySymbols,nde=Object.prototype.hasOwnProperty,ode=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Qce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c$=(e,t)=>{for(var n in t||(t={}))nde.call(t,n)&&m_(e,n,t[n]);if(h_)for(var n of h_(t))ode.call(t,n)&&m_(e,n,t[n]);return e},g_=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const ug=()=>jo(()=>import("./mermaid.core-CJB1tAev.js").then(e=>e.bp),__vite__mapDeps([2,3]));let Ul=null,Td=ug,xf=null,X3=!1,J3=!1,Sf=0;function sde(e){Td=e,Sf++,Ul=null,xf=null,X3=!1,J3=!1}function ide(e){sde(ug)}function v_(){return typeof Td=="function"}function y_(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=c$({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},ede(n,tde(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function k_(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=c$({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function TVe(){return g_(this,null,function*(){if(Ul)return Ul;const e=(function(){try{const o=globalThis;return y_(o?.mermaid)}catch{return null}})();if(e)return Ul=e,k_(Ul),Ul;const t=Td,n=Sf;return t?t===ug&&X3?null:xf||(xf=g_(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===ug)return n===Sf&&t===Td&&(X3=!0,(function(i){J3||(J3=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===Sf&&t===Td&&(xf=null)}return n!==Sf||t!==Td?null:o?(Ul=y_(o),k_(Ul),Ul):null}),xf):null})}let Oi=null,Fa=null;const Dr=new Map,Uu=new Map;function Jh(e){for(const t of Dr.values())t.reject(e);Dr.clear(),Uu.clear()}let b_=5,C_=!1;const rde="WORKER_BUSY",w_="MERMAID_DISABLED";function lde(e){if(Oi&&Oi!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Jh(n)}Oi=e,Fa=null;const t=e;Oi.onmessage=n=>{if(Oi!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Dr.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Oi.onerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Jh(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Oi.onmessageerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Jh(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function ade(){var e;if(Oi)try{Jh(new Error("Worker cleared")),(e=Oi.terminate)==null||e.call(Oi)}catch{}Oi=null,Fa=null}function d$(e,t,n,o){if(!v_()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=w_,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=Uu.get(s);return i||(i=(function(r,l,a=1400){if(!v_()){const c=new Error("Mermaid rendering disabled");return c.name="MermaidDisabled",c.code=w_,Promise.reject(c)}if(Fa)return Promise.reject(Fa);const u=Oi||(Fa=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Fa.name="WorkerInitError",Fa.code="WORKER_INIT_ERROR",null);if(!u)return Promise.reject(Fa);if(Dr.size>=b_){const c=new Error("Worker busy");return c.name="WorkerBusy",c.code=rde,c.inFlight=Dr.size,c.max=b_,Promise.reject(c)}return new Promise((c,d)=>{const f=Math.random().toString(36).slice(2);let h,m=!1;const v=()=>{m||(m=!0,h!=null&&globalThis.clearTimeout(h),Dr.delete(f))},k={resolve:w=>{v(),c(w)},reject:w=>{v(),d(w)}};Dr.set(f,k);try{u.postMessage({id:f,action:r,payload:l})}catch(w){return Dr.delete(f),void d(w)}h=globalThis.setTimeout(()=>{const w=new Error("Worker call timed out");w.name="WorkerTimeout",w.code="WORKER_TIMEOUT";const b=Dr.get(f);b&&b.reject(w)},a)})})(e,t,n),Uu.set(s,i),i.then(()=>{Uu.get(s)===i&&Uu.delete(s)},()=>{Uu.get(s)===i&&Uu.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,u)=>{let c=()=>{};const d=()=>l.removeEventListener("abort",c);c=()=>{d();const f=new Error("Aborted");f.name="AbortError",u(f)},l.addEventListener("abort",c,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),u(f)})})})(i,o)}function EVe(e,t,n=1400,o){return d$("canParse",{code:e,theme:t},n,o)}function IVe(e,t,n=1400,o){return d$("findPrefix",{code:e,theme:t},n,o)}var ude=Object.defineProperty,cde=Object.defineProperties,dde=Object.getOwnPropertyDescriptors,__=Object.getOwnPropertySymbols,fde=Object.prototype.hasOwnProperty,pde=Object.prototype.propertyIsEnumerable,x_=(e,t,n)=>t in e?ude(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))fde.call(t,n)&&x_(e,n,t[n]);if(__)for(var n of __(t))pde.call(t,n)&&x_(e,n,t[n]);return e},rn=(e,t)=>cde(e,dde(t)),mo=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const hde="__global__",q9="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Q3=(()=>{const e=globalThis;if(e[q9])return e[q9];const t={scopedCustomComponents:{},revision:Xr(0)};return e[q9]=t,t})(),S_=Q3.revision,mde=Symbol("markstreamCustomComponents"),gde=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Qp(e){return gde.has(String(e).trim().toLowerCase())}function vde(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function K9(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([Sr(n),Sr(vde(n))]))!s||Qp(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function fs(e){const t=nn(mde,null);return R(()=>{var n;return S_.value,(function(o,s={}){return S_.value,mt(mt(mt({},K9(Q3.scopedCustomComponents[hde]||{})),K9(s)),K9((function(i){return i&&Q3.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const yde=["aria-label"],kde={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},bde={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Gn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},nr=Gn(et({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(y(),M("svg",bde,[...n[1]||(n[1]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),C("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(y(),M("svg",kde,[...n[0]||(n[0]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,yde))}),[["__scopeId","data-v-be21ab83"]]);nr.install=e=>{e.component(nr.__name,nr)};const Cde={class:"emoji-node"},zi=Gn(et({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",Cde,N(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);zi.install=e=>{e.component(zi.__name,zi)};const wde=["id"],_de=["title"],or=Gn(et({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(y(),M("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[C("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+N(e.node.id)+"]",9,_de)],8,wde))}}),[["__scopeId","data-v-c1463a29"]]);or.install=e=>{e.component(or.__name,or)};const f$=(()=>{try{return!1}catch{}return!1})();function Z9(e){f$&&console.warn(e)}function A_(e,t="safe",n){return u5(e,t,n)}function p$(e){return oce(e)}function G9(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function p5(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Xh((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),G9(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),G9(r.value)]):Object.entries(s).map(([r,l])=>[r,G9(l)]):null,t,n);var s;if(!o)return;const i=p$(Zf(o));return Object.keys(i).length>0?i:void 0}function M_(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function rf(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Y9(e,t,n,o,s,i,r=!1){const l=(function(d,f){return YL(d,f)})(e,o);if(Zp.has(e.toLowerCase())||!l&&qL(e,i))return null;if(!l&&a5(e,i))return r?[M_(e,t,!0)]:[M_(e,t),...n,``];const a=u5(t,i,e),u=a.key,c=u!=null&&u!==""?u:s;if(l){const d=o[e]||o[e.toLowerCase()],f=p$(a);return tn(d,rn(mt({},f),{key:c}),n.length>0?n:void 0)}return tn(e,rn(mt({},a),{innerHTML:void 0,key:c}),n.length>0?n:void 0)}function h$(e,t){return rce(e,t)}function cg(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const u=[],c=[];for(const d of i)if(d.type==="text")(u.length>0?u[u.length-1].children:c).push(d.content);else if(d.type==="self_closing"){const f=Y9(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);rf(u.length>0?u[u.length-1].children:c,f)}else if(d.type==="tag_open")u.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let m=u.length-1;m>=0;m--)if(u[m].tagName.toLowerCase()===f){h=m;break}if(h!==-1)for(;u.length>h;){const m=u.pop(),v=Y9(m.tagName,m.attrs||{},m.children,r,m.autoKey,l);u.length>0?rf(u[u.length-1].children,v):rf(c,v),m.tagName.toLowerCase()!==f&&u.length>h&&Z9(`Auto-closing unclosed tag: <${m.tagName}>`)}else Z9(`Ignoring closing tag with no matching opening tag: `)}for(;u.length>0;){const d=u.pop(),f=Y9(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);u.length>0?rf(u[u.length-1].children,f):rf(c,f),Z9(`Auto-closing unclosed tag: <${d.tagName}>`)}return c})(XL(e),t,n)}catch(s){return o=s,f$&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xde=["innerHTML"],sr=Gn(et({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=R(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=fs(()=>t.customId),i=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=R(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:jd(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const u=cg(l,s.value,o.value);if(u!==null)return{mode:"dynamic",nodes:u}}if(!h$(l,s.value))return{mode:"html",content:jd(l,o.value)};const a=cg(l,s.value,o.value);return a===null?{mode:"html",content:jd(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(y(),M("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[j(p(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(y(),M("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},N(r.value.content),3)):(y(),M("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,xde))}}),[["__scopeId","data-v-d17f12b0"]]);sr.install=e=>{e.component(sr.__name,sr)};const Sde={class:"inline-code"},Ade={key:0},li=Gn(et({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const b=n.fade;return b===""||b===!0||b==="true"||b!==!1&&b!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var b;return String((b=t.node.code)!=null?b:"")}),u=R(()=>!l.value),c=R(()=>{var b;const _=(b=n["index-key"])!=null?b:n.indexKey;return _==null||_===""?"":String(_)}),d=Z(t.node.code),f=Z(""),h=Z(0);let m;function v(){m?.(),m=void 0}function k(){v(),f.value&&(d.value=d.value+f.value,f.value="")}Je([()=>t.node.code,c,l],([b])=>{const _=String(b??""),g=c.value,x=t$({nextContent:_,persistedContent:g?s?.get(g):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=x.settledContent,f.value=x.streamedDelta,x.appended?(h.value+=1,(function(){if(!f.value||m||!i)return;const S=i.value;m=Je(()=>i.value,T=>{T!==S&&k()},{flush:"sync"})})()):f.value||v(),g&&s?.set(g,_)},{immediate:!0}),d1(v);const w=R(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(b,_)=>(y(),M("code",Sde,[u.value?(y(),M(Pe,{key:0},[qe(N(a.value),1)],64)):(y(),M(Pe,{key:1},[d.value?(y(),M("span",Ade,N(d.value),1)):ee("",!0),f.value?(y(),M("span",{key:1,class:Re(["inline-code-stream-delta",[w.value]]),onAnimationend:k},N(f.value),35)):ee("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);li.install=e=>{e.component(li.__name,li)};const e8=Z(!1),T_=Z(""),E_=Z("top"),Yf=Z(null),Xf=Z(null),t8=Z(null),n8=Z(null),I_=Z(null);let Qh=null,em=null,o8=0;function m$(){Qh&&(clearTimeout(Qh),Qh=null),em&&(clearTimeout(em),em=null)}let bh=!1,Ch=null,L_=!1;function Mde(e,t,n="top",o=!1,s,i){if(!e)return;const r=++o8;m$();const l=()=>mo(null,null,function*(){var a,u;if(yield(function(){return mo(this,null,function*(){if(!bh&&!L_&&typeof document<"u"){Ch!=null||(Ch=mo(null,null,function*(){const[{createApp:c,h:d},{default:f}]=yield Promise.all([jo(()=>import("./vue.runtime.esm-bundler-J0WjtLlK.js"),[]),jo(()=>import("./Tooltip-DbYQWF1U.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),c({setup:()=>()=>{var m;return d(f,{visible:e8.value,"anchor-el":Yf.value,content:T_.value,placement:E_.value,id:Xf.value,originX:t8.value,originY:n8.value,isDark:(m=I_.value)!=null?m:void 0})}}).mount(h),bh=!0}));try{yield Ch}catch(c){bh=!1,Ch=null,L_=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",c)}}})})(),bh&&r===o8){Xf.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Yf.value=e,T_.value=t,E_.value=n,t8.value=(a=s?.x)!=null?a:null,n8.value=(u=s?.y)!=null?u:null,I_.value=typeof i=="boolean"?i:null,e8.value=!0;try{e.setAttribute("aria-describedby",Xf.value)}catch{}}});o?l():Qh=setTimeout(l,80)}function Tde(e=!1){o8+=1,m$();const t=()=>{if(Yf.value&&Xf.value)try{Yf.value.removeAttribute("aria-describedby")}catch{}e8.value=!1,Yf.value=null,Xf.value=null,t8.value=null,n8.value=null};e?t():em=setTimeout(t,120)}const Ede={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Ide=Symbol("markstreamI18nFallback");function g$(e,t){var n;return(n=t?.[e])!=null?n:Ede[e]}const s8=(e,t)=>{var n;return(n=g$(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function $_(e,t){return{t(n){const o=g$(n,t);if(e.te&&o!=null&&!e.te(n))return s8(n,t);const s=e.t(n);return s===n&&o!=null?s8(n,t):s}}}function Lde(){const e=(function(){var n,o,s;try{const i=ds(),r=Ide,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=ds(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const u=i?.$te;return{t:r.bind(i),te:typeof u=="function"?u.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const u=l?.$te;return{t:a.bind(l),te:typeof u=="function"?u.bind(l):void 0}}}catch{}return null})();if(t)return $_(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return $_({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>s8(n,e)}}const v$=Symbol("ViewportPriority"),y$=Symbol("ViewportPriorityOptions"),k$=Symbol("OffscreenHeavyNodeDeferral"),$de=R(()=>!1),yc="400px";function h5(){return nn(y$,void 0)}function m5(){return nn(k$,$de)}function Nde(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=s?(n=window.requestIdleCallback)!=null?n:T=>window.setTimeout(()=>T({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:T=>window.clearTimeout(T):null,a=new WeakMap;let u=1;const c=new Map,d=new Map,f=new Set;let h=null,m=null;function v(T){if(!T)return"viewport";let A=a.get(T);return A||(A=u++,a.set(T,A)),String(A)}function k(){if(h!=null){try{l?.(h)}catch{}h=null}}function w(T){if(T){const A=c.get(T);if(A&&!A.targets.size){try{A.io.disconnect()}catch{}c.delete(T)}}d.size||f.size||k()}function b(T){const A=d.get(T);if(!A)return;const E=c.get(A.bucketKey);if(!A.visible.value){A.visible.value=!0;try{A.resolve()}catch{}}try{E?.io.unobserve(T)}catch{}E?.targets.delete(T),d.delete(T),f.delete(T),w(A.bucketKey)}function _(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const T=f.values().next().value;T&&(f.delete(T),b(T),f.size&&_())},{timeout:1200}))}function g(T,A){if(!s||typeof IntersectionObserver>"u")return null;const E=(function(H,O){var F,U,z;return{root:(F=e?.(H??null))!=null?F:null,rootMargin:(U=O?.rootMargin)!=null?U:yc,threshold:(z=O?.threshold)!=null?z:0}})(T,A),P=[v((D=E).root),D.rootMargin,D.threshold].join("\0");var D;const I=c.get(P);if(I)return{key:P,bucket:I};let $;try{$=new IntersectionObserver(H=>{for(const O of H)(O.isIntersecting||O.intersectionRatio>0)&&b(O.target)},{root:E.root,rootMargin:E.rootMargin,threshold:E.threshold})}catch{return null}const B={io:$,targets:new Map};return c.set(P,B),{key:P,bucket:B}}function x(){if(s&&i.value)for(const[T,A]of Array.from(d.entries())){const E=g(T,A.opts);if(!E){b(T);continue}if(E.key===A.bucketKey)continue;const P=A.bucketKey,D=c.get(P);try{D?.io.unobserve(T)}catch{}D?.targets.delete(T),A.bucketKey=E.key,E.bucket.targets.set(T,A),E.bucket.io.observe(T),w(P)}}Je(i,T=>{if(!T){for(const A of Array.from(d.keys()))b(A);k()}},{flush:"sync"});const S=(T,A)=>{const E=Z(!1);let P,D=!1;const I=new Promise(O=>{P=()=>{D||(D=!0,O())}}),$=()=>{const O=d.get(T);if(!O)return f.delete(T),void w();const F=c.get(O.bucketKey);try{F?.io.unobserve(T)}catch{}F?.targets.delete(T),d.delete(T),f.delete(T),w(O.bucketKey)};if(!s||!i.value)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const B=g(T,A);if(!B)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const H={resolve:P,visible:E,bucketKey:B.key,opts:A};return d.set(T,H),B.bucket.targets.set(T,H),B.bucket.io.observe(T),s&&m==null&&(m=window.requestAnimationFrame(()=>{m=null,x()})),A?.allowIdle!==!1&&(f.add(T),_()),{isVisible:E,whenVisible:I,destroy:$}};return S.refresh=x,Ln(v$,S),S}function g5(){var e,t;const n=nn(v$,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,u=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},c=h=>{if(!h)return;const m=s.get(h);if(m&&!m.targets.size){try{m.io.disconnect()}catch{}s.delete(h)}},d=h=>{const m=o.get(h);if(!m)return;const v=s.get(m.bucketKey);if(!m.visible.value){m.visible.value=!0;try{m.resolve()}catch{}}try{v?.io.unobserve(h)}catch{}o.delete(h),v?.targets.delete(h),i.delete(h),c(m.bucketKey),i.size||u()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,m)=>{const v=Z(!1);let k,w=!1;const b=new Promise(x=>{k=()=>{w||(w=!0,x())}}),_=()=>{const x=o.get(h);if(!x)return i.delete(h),void(i.size||u());const S=s.get(x.bucketKey);try{S?.io.unobserve(h)}catch{}o.delete(h),S?.targets.delete(h),i.delete(h),c(x.bucketKey),i.size||u()},g=(x=>{var S,T;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const A=($=>{var B,H;return[(B=$?.rootMargin)!=null?B:yc,(H=$?.threshold)!=null?H:0].join("\0")})(x),E=s.get(A);if(E)return{key:A,bucket:E};const P=(S=x?.rootMargin)!=null?S:yc;let D;try{D=new IntersectionObserver($=>{for(const B of $)(B.isIntersecting||B.intersectionRatio>0)&&d(B.target)},{root:null,rootMargin:P,threshold:(T=x?.threshold)!=null?T:0})}catch{return null}const I={io:D,targets:new Set};return s.set(A,I),{key:A,bucket:I}})(m);return g?(o.set(h,{resolve:k,visible:v,bucketKey:g.key}),g.bucket.targets.add(h),g.bucket.io.observe(h),m?.allowIdle!==!1&&(i.add(h),f()),{isVisible:v,whenVisible:b,destroy:_}):(v.value=!0,k(),{isVisible:v,whenVisible:b,destroy:_})}}function Fde(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const Rde=["data-markstream-viewport-pending"],Ode=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Pde={key:1,class:"image-placeholder"},Dde={key:1,class:"image-node__raw-text"},Bde={key:2,class:"image-shimmer-overlay"},Hde={key:1,class:"image-node__raw-text"},zde={key:3,class:"image-error"},Va=Gn(et({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=Z(!1),a=Z(!1),u=Z(""),c=Z("primary"),d=Z(null),f=p1(),h=nn(G3,null),m=g5(),v=h5(),k=m5(),w=R(()=>nw(i.node.src)),b=R(()=>nw(i.fallbackSrc)),_=(s=(o=(n=ds())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),g=typeof window<"u"&&_?.getAttribute("src")===(w.value||b.value),x=Z(typeof window>"u"||g||!k.value),S=Xr(null);let T="",A=null;const E=R(()=>u.value),P=R(()=>!i.lazy),D=R(()=>typeof window<"u"&&k.value&&!g),I=R(()=>!D.value||x.value),$=R(()=>I.value?E.value:""),B=R(()=>{var de,pe;return(pe=(de=v?.value.heavyBlockMargin)!=null?de:v?.value.rootMargin)!=null?pe:yc}),H=R(()=>!i.node.loading&&c.value!=="failed"&&u.value.length>0),O=R(()=>c.value==="failed"),F=R(()=>(!P.value||D.value&&!x.value)&&!l.value&&!a.value&&c.value!=="failed"&&u.value.length>0),U=R(()=>Fde(i,f));function z(de=U.value){de&&d.value&&h?.reportHeight(de,d.value.offsetHeight)}function W(de=U.value){de&&yt(()=>{z(de)})}function K(){A&&(clearTimeout(A),A=null)}function V(){const de=U.value;de&&T!==de&&(T&&h?.markSettled(T),K(),T=de,h?.markPending(de),typeof window<"u"&&(A=window.setTimeout(()=>{T===de&&(W(de),ie())},8e3)))}function ie(){return mo(this,null,function*(){const de=T;de&&(K(),T="",yield yt(),z(de),h?.markSettled(de))})}function ne(){if(c.value==="primary"&&b.value&&b.value!==u.value)return c.value="fallback",u.value=b.value,l.value=!1,a.value=!1,void W();c.value="failed",a.value=!0,r("error",u.value),W()}function X(){l.value=!0,a.value=!1,r("load",E.value),W()}function le(de){de.preventDefault(),l.value&&!a.value&&r("click",[de,E.value])}const{t:Ie}=Lde();return Je([w,b,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||w.value?(u.value=w.value,void(c.value="primary")):b.value?(u.value=b.value,void(c.value="fallback")):(u.value="",c.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&Je([d,D],([de,pe],ve,oe)=>{var ye;if((ye=S.value)==null||ye.destroy(),S.value=null,!pe||x.value)return void(x.value=!0);if(!de)return void(x.value=!1);let G=!0;const Y=m(de,{rootMargin:B.value,allowIdle:!1});S.value=Y,x.value=Y.isVisible.value,Y.whenVisible.then(()=>{G&&S.value===Y&&(x.value=!0)}),oe(()=>{G=!1,Y.destroy(),S.value===Y&&(S.value=null)})},{immediate:!0}),Je([H,l,a,E,()=>i.lazy,I],([de,pe,ve,oe,ye,G])=>de&&oe&&!ve&&G?pe?(ie(),void W()):ye?(V(),void W()):void(pe||ve||V()):(ie(),void W()),{flush:"post",immediate:!0}),Vn(()=>{var de;(de=S.value)==null||de.destroy(),S.value=null,(function(){const pe=T;pe&&(K(),T="",h?.markSettled(pe))})()}),(de,pe)=>{var ve,oe,ye,G,Y;return y(),M("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":D.value&&!x.value?"true":void 0},[H.value?(y(),M("img",{key:0,src:$.value||void 0,alt:String((oe=(ve=i.node.alt)!=null?ve:i.node.title)!=null?oe:""),title:String((G=(ye=i.node.title)!=null?ye:i.node.alt)!=null?G:""),class:Re(["image-node__img",{"is-loading":!P.value&&!l.value,"is-loaded":P.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:P.value?"high":void 0,decoding:P.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(Y=i.node.alt)!=null?Y:p(Ie)("image.preview"),onError:ne,onLoad:X,onClick:le},null,42,Ode)):ee("",!0),e.node.loading&&!a.value?(y(),M("span",Pde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[0]||(pe[0]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Dde,N(e.node.raw),1))])):ee("",!0),F.value&&!e.node.loading?(y(),M("span",Bde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[1]||(pe[1]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Hde,N(e.node.raw),1))])):ee("",!0),O.value?(y(),M("span",zde,[xn(de.$slots,"error",{node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[2]||(pe[2]=C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[C("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),C("span",null,N(p(Ie)("image.loadError")),1)],!0)])):ee("",!0)],8,Rde)}}}),[["__scopeId","data-v-046e82ac"]]);Va.install=e=>{e.component(Va.__name,Va)};const Wde={key:2},El=et({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamNestedRendererProps",void 0),i=R(()=>{var m;return(m=o?.value)!=null?m:"safe"}),r=R(()=>{var m,v;const k=(m=s?.value)!=null?m:{};return rn(mt({},k),{customId:(v=t.customId)!=null?v:k.customId,htmlPolicy:i.value})}),l=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),a=R(()=>t.components[String(t.node.type)]),u=R(()=>!!(a.value&&n.value[t.node.type]&&!Qp(String(t.node.type)))),c=R(()=>u.value?p5(t.node,i.value):void 0),d=R(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=R(()=>{var m;return String((m=t.node.content)!=null?m:"")}),h=R(()=>{var m,v;return String((v=(m=t.node.content)!=null?m:t.node.raw)!=null?v:"")});return(m,v)=>a.value&&u.value?(y(),he(bs(a.value),zn({key:0},c.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:me(()=>[d.value?(y(),he(p(l),zn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(y(),he(p(l),zn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(y(),he(bs(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(y(),M("span",Wde,N(h.value),1)):ee("",!0)}}),N_=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Ude(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return rn(mt(mt({},N_),n),{enabled:(t=n.enabled)==null||t})}return mt({},N_)}function v5(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function b$(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function F_(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function jde(e){var t;return e.diff===!0||F_(e.language)||F_(b$(String((t=e.raw)!=null?t:"")))}function Vde(e,t,n){const o=(function(s){const i=b$(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const u=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(u&&/[./\\-]/.test(u))return u}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const qde=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Kde={key:0,translate:"no",class:"markstream-pre__diff-code"},Zde={class:"markstream-pre__diff-pane-content"},Gde={class:"markstream-pre__diff-number","aria-hidden":"true"},Yde={class:"markstream-pre__diff-content"},Xde={class:"markstream-pre__diff-content-inner"},Jde={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Qde=["textContent"],e1e=["textContent"],Pi=et({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(X,le){const Ie=String(X??"");return le?Ie:Ie.replace(/\r\n$|\n$|\r$/,"")}const o=R(()=>{var X,le,Ie;const de=String((le=(X=t.node)==null?void 0:X.language)!=null?le:"");return String((Ie=String(de).split(/\s+/g)[0])!=null?Ie:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=R(()=>`language-${o.value}`),i=R(()=>{var X;return t.loading===!0||((X=t.node)==null?void 0:X.loading)===!0}),r=R(()=>{var X;return n((X=t.node)==null?void 0:X.code,i.value)});let l="",a=1;const u=R(()=>(function(X){let le=0,Ie=1;X.startsWith(l)&&(le=l.length,Ie=a,le>0&&X[le-1]==="\r"&&X[le]===` +`&&le++);for(let de=le;der.value.split(/\r\n|\n|\r/));let d=0,f="";const h=R(()=>{const X=u.value;X{var X;return t.showLineNumbers===!0&&((X=t.node)==null?void 0:X.diff)===!0}),v=R(()=>m.value&&t.diffInline===!0),k=R(()=>{const X=Number(t.reservedHeightPx);if(!Number.isFinite(X)||X<=0)return;const le=`${Math.ceil(X)}px`;return i.value?{maxHeight:le,overflow:"auto"}:{height:le,minHeight:le,maxHeight:le,overflow:"auto"}}),w=["diff ","index ","--- ","+++ ","@@ "];function b(X){return String(X??"").trim().length===0}function _(X,le="context",Ie={}){const de=b(X);return{code:X,kind:de&&le!=="hunk"&&le!=="spacer"&&!Ie.preserveBlankKind?"context":le,empty:de}}function g(X){const le=n(X,i.value);return le?le.split(/\r\n|\n|\r/):[]}function x(X,le){return!b(X[le])||lew.some(Ie=>le.startsWith(Ie)))}function E(X,le){return le||!X.startsWith(" ")||X.startsWith(" ")?X:` ${X}`}function P(X,le){const Ie=X.length,de=le.length,pe=[];let ve=0;for(;ve=ve&&G>=ve&&X[ye]===le[G];)oe.unshift({originalIndex:ye,modifiedIndex:G}),ye--,G--;const Y=ye-ve+1,fe=G-ve+1;if(Y<=0||fe<=0||i.value||(Y+1)*(fe+1)>15e5)return pe.concat(oe);const we=fe+1,ge=new Uint32Array((Y+1)*(fe+1));for(let ue=Y-1;ue>=0;ue--)for(let Se=fe-1;Se>=0;Se--){const ze=ue*we+Se;if(X[ve+ue]===le[ve+Se])ge[ze]=ge[(ue+1)*we+Se+1]+1;else{const _e=ge[(ue+1)*we+Se],Ee=ge[ue*we+Se+1];ge[ze]=_e>=Ee?_e:Ee}}const Q=[];let te=0,ce=0;for(;te=ge[te*we+ce+1]?te++:ce++;return pe.concat(Q,oe)}function D(X){var le;const Ie=(function(){var G,Y;const fe=t.diffHideUnchangedRegions;if(fe==null||fe===!1)return null;const we=fe===!0?{}:fe;return we.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((G=we.contextLineCount)!=null?G:2)),minimumLineCount:Math.max(1,Math.floor((Y=we.minimumLineCount)!=null?Y:4))}})();if(!Ie||X.length<1||X.length>2||X.length===2&&X[0].lines.length!==X[1].lines.length)return X;const de=X[0].lines,pe=(le=X[1])==null?void 0:le.lines,ve=G=>de[G].kind==="context"&&(pe===void 0||pe[G].kind==="context"&&de[G].code===pe[G].code),oe=[];let ye=0;for(;ye=Ie.minimumLineCount){const fe=G+(G===0?0:Ie.contextLineCount),we=Y-(Y===de.length?0:Ie.contextLineCount);we-fe>=Ie.minimumLineCount&&oe.push({start:fe,end:we})}ye===G&&ye++}return oe.length?X.map((G,Y)=>{const fe=[];let we=0;for(const ge of oe)fe.push(...G.lines.slice(we,ge.start)),fe.push({code:Y===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${G.key}-collapsed-${ge.start}-${ge.end}`,number:""}),we=ge.end;return fe.push(...G.lines.slice(we)),rn(mt({},G),{lines:fe})}):X}const I=R(()=>{var X,le,Ie,de;if(!m.value)return[];const pe=(function(Y){const fe=Y.some(ge=>S(ge)),we=Y.some(ge=>T(ge));return fe&&we||(function(){var ge,Q,te,ce;if(o.value==="diff")return!0;const ue=(ce=(te=String((Q=(ge=t.node)==null?void 0:ge.raw)!=null?Q:"").split(/\r?\n/,1)[0])==null?void 0:te.trim())!=null?ce:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ue)})()&&(fe||we)})(c.value),ve=(function(){var Y,fe;return((Y=t.node)==null?void 0:Y.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(v.value){const Y=ve?(function(fe,we){const ge=g(fe),Q=g(we),te=P(ge,Q);if(te.length>0){const Ee=[];let it=0,Fe=0;for(const Oe of te){for(;it=ue&&ze>=ue&&ge[Se]===Q[ze];)_e.unshift(rn(mt({},_(Q[ze])),{key:`inline-suffix-${ze}`,number:ze+1})),Se--,ze--;for(let Ee=ue;Ee<=Se;Ee++)ce.push(rn(mt({},_(ge[Ee],"removed",{preserveBlankKind:x(ge,Ee)})),{key:`inline-removed-source-${Ee}`,number:Ee+1}));for(let Ee=ue;Ee<=ze;Ee++)ce.push(rn(mt({},_(Q[Ee],"added",{preserveBlankKind:x(Q,Ee)})),{key:`inline-added-source-${Ee}`,number:Ee+1}));return ce.concat(_e)})((X=t.node)==null?void 0:X.originalCode,(le=t.node)==null?void 0:le.updatedCode):(function(fe){const we=[];let ge=1,Q=1;const te=A(fe);for(const[ce,ue]of fe.entries())if(ue.startsWith("@@")){const Se=ue.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Se&&(ge=Number(Se[1]),Q=Number(Se[2])),we.push(rn(mt({},_(ue,"hunk")),{key:`inline-hunk-${ce}`,number:""}))}else if(S(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${ce}`,number:ge++}));else if(T(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"added",{preserveBlankKind:!0})),{key:`inline-added-${ce}`,number:Q++}));else{const Se=te&&ue.startsWith(" ")?ue.slice(1):ue;we.push(rn(mt({},_(Se)),{key:`inline-context-${ce}`,number:Q})),ge++,Q++}return we})(c.value);return D([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Y}])}if(!pe&&ve)return(function(Y,fe){const we=g(Y),ge=g(fe),Q=P(we,ge),te=[],ce=[];let ue=0,Se=0,ze=0;const _e=(Ee,it)=>{const Fe=Math.max(Ee-ue,it-Se);for(let Oe=0;Oern(mt({},Y),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:ye.map((Y,fe)=>rn(mt({},Y),{key:`modified-${fe}`,number:fe+1}))}])}),$=R(()=>I.value.some(X=>X.lines.some(le=>le.kind==="collapsed"))),B=R(()=>{const X=o.value;return X?`Code block: ${X}`:"Code block"}),H=Z(null),O=Z([]);let F=null,U=!1,z=null;function W(X){const le=Number.parseFloat(String(X??""));return Number.isFinite(le)&&le>0?le:0}function K(X,le){var Ie;if(!X)return le;if(X.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const de=X.querySelector(".markstream-pre__diff-content"),pe=de?.getBoundingClientRect(),ve=(Ie=pe?.height)!=null?Ie:0;return Math.max(le,Math.ceil(ve))}function V(){U||typeof window>"u"||(F!=null&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>{F=null,U||(function(){var X,le;F=null;const Ie=H.value;if(!Ie||!m.value||v.value||!Ie.classList.contains("is-wrap"))return void(O.value.length&&(O.value=[]));const de=(function(fe){const we=window.getComputedStyle(fe),ge=W(we.getPropertyValue("--markstream-pre-diff-line-height"));if(ge>0)return ge;const Q=W(we.lineHeight);return Q>0?Q:18})(Ie),pe=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),ve=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),oe=Math.max(pe.length,ve.length),ye=[];for(let fe=0;fe{const ge=Y[we];return ge&&Math.abs(fe.rowHeight-ge.rowHeight)<=.5&&Math.abs(fe.originalHeight-ge.originalHeight)<=.5&&Math.abs(fe.modifiedHeight-ge.modifiedHeight)<=.5})||(O.value=ye)})()}))}function ie(X){z?.disconnect(),z=null,X&&m.value&&!v.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{V()}),z.observe(X))}function ne(X,le){const Ie=O.value[X];if(!Ie)return;const de=le==="original"?Ie.originalHeight:Ie.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(Ie.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(de)}px`}}return Je(H,X=>{ie(X),yt(()=>V())},{flush:"post"}),Je([m,v,I],()=>{ie(H.value),yt(()=>V())},{flush:"post",immediate:!0}),Vn(()=>{U=!0,F!=null&&(window.cancelAnimationFrame(F),F=null),z?.disconnect(),z=null}),(X,le)=>(y(),M("pre",{ref_key:"preRef",ref:H,style:Zt(k.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":m.value,"markstream-pre--diff-inline":v.value,"markstream-pre--diff-collapsed":$.value}]),"aria-busy":i.value,"aria-label":B.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[m.value?(y(),M("code",Kde,[(y(!0),M(Pe,null,pt(I.value,Ie=>(y(),M("span",{key:Ie.key,class:Re(["markstream-pre__diff-pane",Ie.className])},[C("span",Zde,[(y(!0),M(Pe,null,pt(Ie.lines,(de,pe)=>(y(),M("span",{key:de.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${de.kind}`,{"markstream-pre__diff-line--empty":de.empty}]]),style:Zt(ne(pe,Ie.key))},[le[0]||(le[0]=C("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),C("span",Gde,N(de.number),1),C("span",Yde,[C("span",Xde,N(de.code),1)])],6))),128))])],2))),128))])):(y(),M(Pe,{key:1},[t.showLineNumbers?(y(),M("span",Jde,[C("span",{class:"markstream-pre__line-numbers-text",textContent:N(h.value)},null,8,Qde)])):ee("",!0),C("code",{translate:"no",class:"markstream-pre__code",textContent:N(r.value)},null,8,e1e)],64))],14,qde))}});Pi.install=e=>{e.component(Pi.__name,Pi)};const t1e={key:0},qo=Gn(et({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const k=n.fade;return k===""||k===!0||k==="true"||k!==!1&&k!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var k;const w=(k=n["index-key"])!=null?k:n.indexKey;return w==null||w===""?"":String(w)}),u=Z(t.node.content),c=Z(""),d=Z(0);let f;function h(){f?.(),f=void 0}function m(){h(),c.value&&(u.value=u.value+c.value,c.value="")}Je([()=>t.node.content,a,l],([k])=>{const w=String(k??""),b=a.value,_=t$({nextContent:w,persistedContent:b?s?.get(b):void 0,currentState:{settledContent:u.value,streamedDelta:c.value},typewriterEnabled:l.value});u.value=_.settledContent,c.value=_.streamedDelta,_.appended?(d.value+=1,(function(){if(!c.value||f||!i)return;const g=i.value;f=Je(()=>i.value,x=>{x!==g&&m()},{flush:"sync"})})()):c.value||h(),b&&s?.set(b,w)},{immediate:!0}),d1(h);const v=R(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(k,w)=>(y(),M("span",{class:Re([[e.node.center?"text-node-center":""],"text-node"])},[u.value?(y(),M("span",t1e,N(u.value),1)):ee("",!0),c.value?(y(),M("span",{key:1,class:Re(["text-node-stream-delta",[v.value]]),onAnimationend:m},N(c.value),35)):ee("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function Af(e,t,n){return et({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=g5(),u=h5(),c=m5(),d=typeof window<"u"&&((l=(r=ds())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=Z(typeof window>"u"||d||!c.value),h=Xr(null);let m=null;function v(k){const w=k&&"$el"in k?k.$el:k;h.value=w instanceof HTMLElement?w:null}return typeof window<"u"&&Je([h,c],([k,w],b,_)=>{if(m?.destroy(),m=null,!w||f.value)return void(f.value=!0);if(!k)return;let g=!0;const x=a(k,{rootMargin:u?.value.heavyBlockMargin,allowIdle:!1});m=x,f.value=x.isVisible.value,x.whenVisible.then(()=>{g&&m===x&&(f.value=!0)}),_(()=>{g=!1,x.destroy(),m===x&&(m=null)})},{immediate:!0}),Vn(()=>{m?.destroy(),m=null}),()=>tn(f.value?t:n,rn(mt({},s),{ref:v}),i)}})}qo.install=e=>{e.component(qo.__name,qo)};const dg=et({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,u;const c=T2(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=p_[c]||(c?c.charAt(0).toUpperCase()+c.slice(1):p_[""]),f=jde(n.node),h=Vde(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),m=n.monacoOptions,v=f&&((l=n.estimatedDiffInline)!=null?l:v5(m??{},typeof window>"u"?0:window.innerWidth)),k=m?.diffAppearance,w=k==="dark"||k!=="light"&&n.isDark===!0,b=typeof m?.fontSize=="number"&&Number.isFinite(m.fontSize)&&m.fontSize>0?m.fontSize:12,_=typeof m?.lineHeight=="number"&&Number.isFinite(m.lineHeight)&&m.lineHeight>0?m.lineHeight:b===12?18:Math.max(12,Math.round(1.5*b)),g=typeof m?.tabSize=="number"&&Number.isFinite(m.tabSize)&&m.tabSize>0?m.tabSize:4,x=f?0:8,S=typeof((a=m?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(m.padding.top)&&m.padding.top>=0?m.padding.top:x,T=typeof((u=m?.padding)==null?void 0:u.bottom)=="number"&&Number.isFinite(m.padding.bottom)&&m.padding.bottom>=0?m.padding.bottom:x,A=typeof m?.fontFamily=="string"?m.fontFamily.trim():"",E=mt(mt({fontSize:`${b}px`,lineHeight:`${_}px`,tabSize:g,paddingTop:`${S}px`,paddingBottom:`${T}px`,"--markstream-pre-line-number-top":`${S}px`},f?{"--markstream-pre-diff-line-height":`${_}px`}:{}),A?{"--markstream-code-font-family":A}:{}),P=()=>tn("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[tn("svg",{class:"action-icon"})]),D=n.isShowPreview!==!1&&(c==="html"||c==="svg"),I=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||D&&n.showPreviewButton!==!1,$=H=>{if(H!=null)return typeof H=="number"?`${H}px`:String(H)},B=mt(mt(mt({"--markstream-code-layout-character-width":"1ch"},$(n.minWidth)?{minWidth:$(n.minWidth)}:{}),$(n.maxWidth)?{maxWidth:$(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return tn("div",rn(mt({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":w,"is-diff":f,"is-plain-text":c===""||c==="plaintext"||c==="text"},t.class],style:[B,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:tn("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[tn("div",{class:"code-header-main"},[tn("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),tn("div",{class:"code-header-copy"},[tn("div",{class:"code-header-title"},h.title),h.caption?tn("div",{class:"code-header-caption"},h.caption):null])]),tn("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?tn("div",{class:"code-diff-stats","aria-hidden":"true"},[tn("span",{class:"code-diff-stat removed"},"-0"),tn("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:P(),n.showCollapseButton===!1?null:P(),I?tn("div",{class:"relative"},[P()]):null])]),tn("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[tn(Pi,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:v,diffHideUnchangedRegions:f?Ude(m?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:E,"data-markstream-code-loading":"1"})]),tn("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[tn("div",{class:"loading-skeleton"},[tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line short"})])]),tn("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),X9=Af("ViewportDeferredCodeBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./CodeBlockNode-BAtAs_qm.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Pi}}),loadingComponent:dg,delay:0,suspensible:!1}),dg),Jr=zr(()=>mo(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield r$(),(yield jo(()=>import("./index7-BT2SBznQ.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),C$=zr(()=>mo(null,null,function*(){try{return yield r$(),(yield jo(()=>import("./index6-D4fZsFMu.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return tn(qo,rn(mt({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),xi=Gn(et({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(y(),M("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},N(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);xi.install=e=>{e.component(xi.__name,xi)};const n1e={class:"superscript-node"},Wi=Gn(et({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sup",n1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Wi.install=e=>{e.component(Wi.__name,Wi)};const o1e={class:"subscript-node"},Ui=Gn(et({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,superscript:Wi,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sub",o1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Ui.install=e=>{e.component(Ui.__name,Ui)};const s1e={class:"strong-node"},Si=Gn(et({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("strong",s1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Si.install=e=>{e.component(Si.__name,Si)};const i1e={class:"strikethrough-node"},Ai=Gn(et({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("del",i1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);Ai.install=e=>{e.component(Ai.__name,Ai)};const r1e=["href","title","aria-label","aria-hidden","target","rel"],l1e=["aria-hidden"],a1e={class:"link-text-wrapper relative inline-flex"},u1e={class:"leading-[normal] link-text"},Mi=Gn(et({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=nn("markstreamShowTooltips",void 0),o=R(()=>{const w=n?.value;return typeof w=="boolean"?w:t.showTooltip}),s=R(()=>{var w,b,_,g,x;const S=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",T=(w=t.animationOpacity)!=null?w:.35,A=Math.max(.12,Math.min(.5*T,T)),E={"--underline-height":`${(b=t.underlineHeight)!=null?b:2}px`,"--underline-bottom":S,"--underline-opacity":String(T),"--underline-rest-opacity":String(A),"--underline-duration":`${(_=t.animationDuration)!=null?_:1.6}s`,"--underline-timing":(g=t.animationTiming)!=null?g:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(x=t.animationIteration)!=null?x:"infinite"};return t.color&&(E["--link-color"]=t.color),E}),i=fs(()=>t.customId),r=R(()=>mt({text:qo,strong:Si,strikethrough:Ai,emphasis:Ti,image:Va,html_inline:sr,inline_code:li},i.value)),l=p1(),a=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.attrs;if(!_||typeof _!="object")return{};const g={};if(Array.isArray(_))for(const x of _)Array.isArray(x)&&x[0]&&(g[String(x[0])]=String((b=x[1])!=null?b:""));else for(const[x,S]of Object.entries(_))x&&S!=null&&S!==!1&&(g[x]=S===!0?"":String(S));return A_(g,"safe","a")}),u=R(()=>mt(mt({},l),a.value)),c=R(()=>{var w,b;return A_({href:String((b=(w=t.node)==null?void 0:w.href)!=null?b:"")},"safe","a").href}),d=R(()=>{if(!c.value)return;const w=u.value.target;return(typeof w=="string"?w.trim():String(w??"").trim())||(sie(c.value)?"_blank":void 0)}),f=R(()=>{var w;return String((w=d.value)!=null?w:"").trim().toLowerCase()==="_blank"}),h=R(()=>{if(!c.value)return;const w=u.value.rel,b=new Set((typeof w=="string"?w:String(w??"")).split(/\s+/).filter(Boolean)),_=new Set(Array.from(b).filter(g=>g.toLowerCase()!=="opener"));return f.value&&(_.add("noopener"),_.add("noreferrer")),_.size>0?Array.from(_).join(" "):void 0}),m=R(()=>{const w=mt({},u.value);return delete w.title,delete w.href,delete w.target,delete w.rel,w});function v(){o.value&&Tde()}const k=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.title;return typeof _=="string"&&_.trim().length>0?_:String((b=c.value)!=null?b:"")});return(w,b)=>{var _,g;return e.node.loading?(y(),M("span",zn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},p(l),{style:s.value}),[C("span",a1e,[C("span",u1e,[j(p(qo),{class:"leading-[normal] link-text",node:{type:"text",content:String((_=e.node.text)!=null?_:""),raw:String((g=e.node.text)!=null?g:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),b[1]||(b[1]=C("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,l1e)):(y(),M("a",zn({key:0,class:"link-node",href:c.value,title:o.value?"":k.value,"aria-label":`Link: ${k.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},m.value,{style:s.value,onMouseenter:b[0]||(b[0]=x=>(function(S){var T,A,E,P;if(!o.value)return;const D=S,I=D?.clientX!=null&&D?.clientY!=null?{x:D.clientX,y:D.clientY}:void 0,$=((T=t.node)==null?void 0:T.title)||((A=c.value)!=null&&A.includes("xn--")&&((P=(E=t.node)==null?void 0:E.text)!=null&&P.includes("://"))?t.node.text:c.value)||"";Mde(S.currentTarget,$,"top",!1,I)})(x)),onMouseleave:v}),[(y(!0),M(Pe,null,pt(e.node.children,(x,S)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${S}`,components:r.value,node:x,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${S}`},null,8,["components","node","custom-id","index-key"]))),128))],16,r1e))}}}),[["__scopeId","data-v-367e6ca4"]]);Mi.install=e=>{e.component(Mi.__name,Mi)};const c1e={class:"insert-node"},ji=Gn(et({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("ins",c1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);ji.install=e=>{e.component(ji.__name,ji)};const d1e={class:"highlight-node"},ir=Gn(et({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("mark",d1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);ir.install=e=>{e.component(ir.__name,ir)};const f1e={class:"emphasis-node"},Ti=Gn(et({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("em",f1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ti.install=e=>{e.component(Ti.__name,Ti)};const p1e={class:"hard-break"},qa=Gn(et({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("br",p1e))}),[["__scopeId","data-v-50c58f70"]]);qa.install=e=>{e.component(qa.__name,qa)};const $p=et({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=kt({checkbox:nr,checkbox_input:nr,emoji:zi,emphasis:Ti,hardbreak:qa,highlight:ir,inline_code:li,insert:ji,link:Mi,reference:xi,strikethrough:Ai,strong:Si,subscript:Ui,superscript:Wi,text:qo}),o=fs(()=>t.customId),s=R(()=>{const i=o.value;return Object.keys(i).length>0?mt(mt({},n),i):n});return(i,r)=>(y(!0),M(Pe,null,pt(e.nodes,(l,a)=>(y(),he(p(El),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function i8(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(i8)}function fg(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(i8))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(i8)?s:null}function kc(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const h1e=["cite"],m1e={key:0,dir:"auto",class:"paragraph-node"},g1e=["custom-id"],tm=Gn(et({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>!!n.value.paragraph),s=R(()=>!!n.value.text),i=R(()=>fg(t.node.children,!o.value)),r=R(()=>t.fade!==!1||s.value?null:kc(i.value));return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(l,a)=>(y(),M("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(y(),M("p",m1e,[r.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(r.value),9,g1e)):(y(),he(p($p),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(y(),he(p(Vi),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=u=>l.$emit("copy",u))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,h1e))}}),[["__scopeId","data-v-abfecebc"]]);tm.install=e=>{e.component(tm.__name,tm)};const v1e={class:"definition-list"},y1e={class:"definition-term"},k1e={class:"definition-desc"},nm=Gn(et({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("dl",v1e,[(y(!0),M(Pe,null,pt(t.node.items,(s,i)=>(y(),M(Pe,{key:i},[C("dt",y1e,[j(p(Vi),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),C("dd",k1e,[j(p(Vi),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);nm.install=e=>{e.component(nm.__name,nm)};const b1e=["href","title"],Jf=Gn(et({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(y(),M("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,b1e))}}),[["__scopeId","data-v-e1eb37b6"]]);Jf.install=e=>{e.component(Jf.__name,Jf)};const C1e=["id"],w1e={class:"flex-1"},om=et({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[C("div",w1e,[j(p(Vi),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,C1e))}});om.install=e=>{e.component(om.__name,om)};const _1e=["custom-id"],r8=Gn(et({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamFade",void 0),s=R(()=>o?.value!==!1||n.value.text?null:kc(t.node.children)),i=R(()=>mt({text:qo,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,footnote_reference:or,hardbreak:qa,math_inline:Jr,reference:xi},n.value));return(r,l)=>(y(),he(bs(`h${e.node.level}`),zn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:me(()=>[s.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(s.value),9,_1e)):(y(!0),M(Pe,{key:1},pt(e.node.children,(a,u)=>(y(),he(p(El),{key:u,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${u}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),L2=r8;L2.install=e=>{e.component(r8.__name,r8)};const x1e={key:0,dir:"auto",class:"paragraph-node"},S1e=["custom-id"],A1e={dir:"auto",class:"paragraph-node"},M1e=["custom-id"],Vd=Gn(et({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var h;return(h=t.node)!=null?h:t.item}),o=fs(()=>t.customId),s=R(()=>!!o.value.paragraph),i=R(()=>!!o.value.text),r=R(()=>{var h;return fg((h=n.value)==null?void 0:h.children,!s.value)}),l=R(()=>{var h;if(s.value)return null;const m=(h=n.value)==null?void 0:h.children;if(!Array.isArray(m)||m.length<2)return null;const v=m[0];if(v?.type!=="paragraph"||!Array.isArray(v.children))return null;const k=m.slice(1);if(!k.every(b=>b?.type==="list"))return null;const w=fg([v]);return w?{paragraphChildren:w,nestedLists:k}:null});function a(){return t.fade===!1&&!i.value}const u=R(()=>a()?kc(r.value):null),c=R(()=>{var h;return a()?kc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=R(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(h,m)=>{var v,k;return y(),M("li",zn({class:"list-item",dir:"auto"},f.value),[r.value?(y(),M("p",x1e,[u.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(u.value),9,S1e)):(y(),he(p($p),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(y(),M(Pe,{key:1},[C("p",A1e,[c.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(c.value),9,M1e)):(y(),he(p($p),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(y(!0),M(Pe,null,pt(l.value.nestedLists,(w,b)=>(y(),he(p(Vi),{key:b,nodes:[w],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${b}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:m[0]||(m[0]=_=>h.$emit("copy",_))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(y(),he(p(Vi),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(k=(v=n.value)==null?void 0:v.children)!=null?k:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:m[1]||(m[1]=w=>h.$emit("copy",w))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);Vd.install=e=>{e.component(Vd.__name,Vd)};const qd=Gn(et({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=fs(()=>e.customId),n=R(()=>t.value.list_item||Vd);return(o,s)=>(y(),he(bs(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:me(()=>[(y(!0),M(Pe,null,pt(e.node.items,(i,r)=>{var l;return y(),he(bs(n.value),zn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);qd.install=e=>{e.component(qd.__name,qd)};const T1e={key:2,class:"html-block-node__raw"},E1e=["innerHTML"],I1e={key:1,class:"html-block-node__placeholder"},Qf=Gn(et({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=nn("markstreamNestedRendererProps",void 0),s=R(()=>{var I,$;return($=(I=t.htmlPolicy)!=null?I:n?.value)!=null?$:"safe"}),i=R(()=>{var I,$;const B=(I=o?.value)!=null?I:{};return rn(mt({},B),{customId:($=t.customId)!=null?$:B.customId,htmlPolicy:s.value})}),r=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),l=R(()=>{const I=Xh(t.node.attrs,s.value);if(!I)return;const $=Zf(I);return Object.keys($).length>0?$:void 0}),a=R(()=>{const I=String(t.node.tag||"").trim(),$=Xh(t.node.attrs,s.value,I);if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),u=fs(()=>t.customId),c=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),f=Z(typeof window>"u"),h=Z(t.node.content),m=R(()=>Array.isArray(t.node.children)?t.node.children:[]),v=R(()=>String(t.node.tag||"div")),k=R(()=>{var I;if(v.value.trim().toLowerCase()!=="details"||(I=t.node.attrs)!=null&&I.some(([B])=>String(B).toLowerCase()==="open"))return null;const $=m.value[0];return $?.type==="html_block"&&String($.tag||"").toLowerCase()==="summary"?$:null}),w=R(()=>{var I;return kc((I=k.value)==null?void 0:I.children)}),b=R(()=>{const I=k.value;if(!I)return;const $=Xh(I.attrs,s.value,"summary");if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),_=R(()=>w.value==null?m.value:m.value.slice(1)),g=R(()=>{const I=v.value.trim().toLowerCase();return UI.has(I)||a5(I,s.value)}),x=R(()=>m.value.length>0&&!!t.node.tag&&!g.value),S=R(()=>{var I,$,B;if(x.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(I=h.value)!=null?I:""};const H=($=h.value)!=null?$:t.node.content;if(!H)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:jd(H,s.value)};if(t.node.loading){const F=cg(H,u.value,s.value);return F===null?{mode:"text",content:(B=t.node.raw)!=null?B:H}:{mode:"dynamic",nodes:F}}if(!h$(H,u.value))return{mode:"html",content:jd(H,s.value)};const O=cg(H,u.value,s.value);return O===null?{mode:"html",content:jd(H,s.value)}:{mode:"dynamic",nodes:O}}),T=g5(),A=h5(),E=m5(),P=Xr(null),D=!!t.node.loading;return typeof window<"u"?(Je([()=>d.value,()=>A?.value.heavyBlockMargin,()=>A?.value.rootMargin],([I],$,B)=>{var H,O,F,U;if((O=(H=P.value)==null?void 0:H.destroy)==null||O.call(H),P.value=null,!D)return f.value=!0,void(h.value=t.node.content);if(!I)return void(f.value=!1);let z=!0;const W=(U=(F=A?.value.heavyBlockMargin)!=null?F:A?.value.rootMargin)!=null?U:yc,K=T(I,{rootMargin:W,allowIdle:!E.value});P.value=K,f.value=f.value||K.isVisible.value,K.whenVisible.then(()=>{z&&P.value===K&&(f.value=!0)}),B(()=>{z=!1,K.destroy(),P.value===K&&(P.value=null)})},{immediate:!0}),Je(()=>t.node.content,I=>{D&&!f.value||(h.value=I)})):f.value=!0,Vn(()=>{var I,$;($=(I=P.value)==null?void 0:I.destroy)==null||$.call(I),P.value=null}),(I,$)=>(y(),he(bs(x.value?v.value:"div"),zn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":p(E)&&!f.value?"true":void 0},x.value?a.value:void 0),{default:me(()=>[f.value?(y(),M(Pe,{key:0},[S.value.mode==="structured"?(y(),M(Pe,{key:0},[w.value!==null?(y(),M(Pe,{key:0},[C("summary",xR(OA(b.value)),N(w.value),17),_.value.length?(y(),he(p(r),zn({key:0},i.value,{nodes:_.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):ee("",!0)],64)):(y(),he(p(r),zn({key:1},i.value,{nodes:m.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):S.value.mode==="dynamic"?(y(),he(p(c),{key:1,nodes:S.value.nodes},null,8,["nodes"])):S.value.mode==="text"?(y(),M("pre",T1e,N(S.value.content),1)):(y(),M("div",zn({key:3},l.value,{innerHTML:S.value.content}),null,16,E1e))],64)):(y(),M("div",I1e,[xn(I.$slots,"placeholder",{node:e.node},()=>[$[0]||($[0]=C("span",{class:"html-block-node__placeholder-bar"},null,-1)),$[1]||($[1]=C("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),$[2]||($[2]=C("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Qf.install=e=>{e.component(Qf.__name,Qf)};const L1e={dir:"auto",class:"paragraph-node"},$1e=["custom-id"],cc=Gn(et({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamFade",void 0),i=nn("markstreamParseOptions",void 0),r=nn("markstreamCustomMarkdownIt",void 0),l=nn("markstreamNestedRendererProps",void 0),a=R(()=>{var A;return(A=o?.value)!=null?A:"safe"}),u=R(()=>{var A;return(A=t.parseOptions)!=null?A:i?.value}),c=R(()=>{var A;return(A=t.customMarkdownIt)!=null?A:r?.value}),d=R(()=>{var A,E;return(E=t.customHtmlTags)!=null?E:(A=l?.value)==null?void 0:A.customHtmlTags}),f=R(()=>{var A,E;const P=(A=l?.value)!=null?A:{};return rn(mt({},P),{customId:(E=t.customId)!=null?E:P.customId,customHtmlTags:d.value,parseOptions:u.value,customMarkdownIt:c.value,htmlPolicy:a.value})}),h=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1});function m(A){var E;return A.type==="text"&&String((E=A.content)!=null?E:"").trim()===""}const v=R(()=>t.node.children.filter(A=>!m(A))),k=R(()=>v.value.length>0&&v.value.every(A=>A.type==="image"||(function(E){var P;const D=(function(I){return I.type==="link"&&Array.isArray(I.children)?I.children.filter($=>!m($)):[]})(E);return D.length===1&&((P=D[0])==null?void 0:P.type)==="image"})(A))),w=R(()=>new Set(Ec(d.value))),b=R(()=>{if(!k.value||v.value.length<=1)return t.node.children;const A=[];for(let E=0;E0,I=t.node.children.slice(E+1).some($=>!m($));D&&I&&A.push(rn(mt({},P),{content:" ",raw:" "}))}return A}),_=R(()=>s?.value===!1&&!n.value.text),g=R(()=>_.value?kc(b.value):null);function x(A,E){return{node:A,"index-key":`${t.indexKey}-${E}`,"custom-id":t.customId,"custom-html-tags":d.value}}const S=R(()=>mt({inline_code:li,image:Va,link:Mi,hardbreak:qa,emphasis:Ti,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,html_inline:sr,html_block:Qf,emoji:zi,checkbox:nr,math_inline:Jr,checkbox_input:nr,reference:xi,footnote_anchor:Jf,footnote_reference:or,text:qo},n.value)),T=R(()=>b.value.map((A,E)=>{var P;const D=(function(I){var $,B,H,O;if(I.type==="html_block"||I.type==="html_inline"){const F=String(($=I.tag)!=null?$:"").trim().toLowerCase()||ZI(I.content);if(F&&!w.value.has(F)&&GI((B=I.content)!=null?B:I.raw,F)){const U=String((O=(H=I.content)!=null?H:I.raw)!=null?O:"");return{child:{type:"text",content:U,raw:U},component:qo,isCustomComponent:!1}}}return{child:I,component:S.value[I.type],isCustomComponent:!!(n.value[I.type]&&!Qp(String(I.type)))}})(A);return rn(mt({},D),{index:E,key:`${t.indexKey||"paragraph"}-${E}`,customAttrs:D.isCustomComponent?p5(D.child,a.value):void 0,hasSlotChildren:Array.isArray(D.child.children)&&D.child.children.length>0,slotContent:String((P=D.child.content)!=null?P:""),originalChild:A})}));return(A,E)=>(y(),M("p",L1e,[g.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(g.value),9,$1e)):(y(!0),M(Pe,{key:1},pt(T.value,P=>{return y(),M(Pe,{key:P.key},[k.value&&m(P.originalChild)?(y(),M(Pe,{key:0},[qe(N((D=P.originalChild,String((I=D.content)!=null?I:""))),1)],64)):P.isCustomComponent?(y(),he(bs(P.component),zn({key:1,ref_for:!0},P.customAttrs,{node:P.child,loading:P.child.loading,"index-key":P.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:me(()=>[P.hasSlotChildren?(y(),he(p(h),zn({key:0,ref_for:!0},f.value,{nodes:P.child.children,"index-key":P.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):P.slotContent?(y(),he(p(h),zn({key:1,ref_for:!0},f.value,{content:P.slotContent,final:!P.child.loading,"index-key":`${P.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(y(),he(bs(P.component),zn({key:2,ref_for:!0},x(P.child,P.index)),null,16))],64);var D,I}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);cc.install=e=>{e.component(cc.__name,cc)};const N1e={class:"table-node-wrapper"},F1e=["aria-busy"],R1e={key:0},O1e=["custom-id"],P1e=["aria-label","onPointerdown"],D1e=["custom-id"],B1e={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ep=Gn(et({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var w;return(w=t.node.loading)!=null&&w}),o=R(()=>{var w;return(w=t.node.rows)!=null?w:[]}),s=Z(null),i=Z([]);let r=null;const l=R(()=>t.node.header.cells.length),a=R(()=>i.value.some(w=>Number.isFinite(w)&&w>0)),u=R(()=>a.value?i.value.map(w=>w>0?{width:`${w}px`}:void 0):[]);Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade));const c=fs(()=>t.customId),d=R(()=>!!c.value.text),f=R(()=>!!c.value.paragraph),h=new WeakMap;function m(w){const b=t.fade===!1&&!d.value,_=!f.value,g=h.get(w);if(g?.children===w.children&&g.textFastPath===b&&g.paragraphFastPath===_)return g.info;const x=fg(w.children,_,!0),S={simpleChildren:x,plainText:x&&b?kc(x):null};return h.set(w,{children:w.children,textFastPath:b,paragraphFastPath:_,info:S}),S}function v(w){if(!r)return;w.preventDefault();const b=r.startWidth+r.nextStartWidth,_=Math.min(48,Math.floor(b/2)),g=Math.max(_,Math.min(b-_,Math.round(r.startWidth+w.clientX-r.startX))),x=[...r.widths];x[r.index]=g,x[r.index+1]=b-g,i.value=x}function k(){r&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k),r=null)}return Je(l,()=>{k(),i.value=[]}),Vn(k),(w,b)=>(y(),M("div",N1e,[C("table",{ref_key:"tableRef",ref:s,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(y(),M("colgroup",R1e,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("col",{key:g,style:Zt(u.value[g])},null,4))),128))])):ee("",!0),C("thead",null,[C("tr",null,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("th",{key:g,dir:"auto",class:Re([_.align==="right"?"text-right":_.align==="center"?"text-center":"text-left"])},[m(_).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(_).plainText),9,O1e)):m(_).simpleChildren?(y(),he(p($p),{key:1,nodes:m(_).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${g}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:_.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[0]||(b[0]=x=>w.$emit("copy",x))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),g(function(S,T){if(T.button!==0)return;const A=(function(){var D;const I=(D=s.value)==null?void 0:D.querySelectorAll("thead th");return Array.from(I??[],$=>Math.round($.getBoundingClientRect().width))})(),E=A[S],P=A[S+1];E&&P&&(T.preventDefault(),r={index:S,startX:T.clientX,startWidth:E,nextStartWidth:P,widths:A},i.value=A,window.addEventListener("pointermove",v),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k))})(g,x)},null,40,P1e)):ee("",!0)],2))),128))])]),C("tbody",null,[(y(!0),M(Pe,null,pt(o.value,(_,g)=>(y(),M("tr",{key:g},[(y(!0),M(Pe,null,pt(_.cells,(x,S)=>(y(),M("td",{key:S,class:Re([x.align==="right"?"text-right":x.align==="center"?"text-center":"text-left"]),dir:"auto"},[m(x).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(x).plainText),9,D1e)):m(x).simpleChildren?(y(),he(p($p),{key:1,nodes:m(x).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${g}-${S}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:x.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[1]||(b[1]=T=>w.$emit("copy",T))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,F1e),j(as,{name:"table-node-fade"},{default:me(()=>[n.value?(y(),M("div",B1e,[xn(w.$slots,"loading",{isLoading:n.value},()=>[b[2]||(b[2]=C("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),b[3]||(b[3]=C("span",{class:"sr-only"},"Loading",-1))],!0)])):ee("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);ep.install=e=>{e.component(ep.__name,ep)};const H1e={class:"hr-node"},sm=Gn({},[["render",function(e,t){return y(),M("hr",H1e)}],["__scopeId","data-v-39b2349c"]]);sm.install=e=>{e.component(sm.__name,sm)};const z1e={class:"unknown-node"},l8=et({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(y(),M("div",z1e,N(e.node.raw),1))}),im=Gn(et({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=R(()=>`vmr-container vmr-container-${t.node.name}`),o=fs(()=>t.customId),s=R(()=>mt({text:qo,paragraph:cc,heading:L2,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,checkbox:nr,checkbox_input:nr,hardbreak:qa,math_inline:Jr,reference:xi,list:qd,math_block:C$,table:ep},o.value));return(i,r)=>(y(),M("div",zn({class:n.value},e.node.attrs),[(y(!0),M(Pe,null,pt(e.node.children,(l,a)=>{return y(),he(bs((u=l.type,s.value[u]||l8)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var u}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);im.install=e=>{e.component(im.__name,im)};const W1e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],R_=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function U1e(e){if(e<=255)return W1e[e];let t=0,n=R_.length-1;for(;t<=n;){const o=t+n>>1,s=R_[o];if(es[1]))return s[2];t=o+1}}return"L"}const j1e=/[ \t\n\r\f]+/g,V1e=/[\t\n\r\f]| {2,}|^ | $/;let J9=null;const q1e=new RegExp("\\p{Script=Arabic}","u"),ou=new RegExp("\\p{M}","u"),y5=new RegExp("\\p{Nd}","u");function O_(e){return q1e.test(e)}function P_(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function kl(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&o<=57343){if(P_(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(P_(n))return!0}}return!1}const K1e=new Set([" "," ","⁠","\uFEFF"]),Z1e=new Set(["-","‐","–","—"]);function w$(e,t){return!((function(n){const o=tp(n);return o!==null&&K1e.has(o)})(e)||t&&((function(n){const o=tp(n);return o!==null&&(k5.has(o)||bc.has(o))})(e)||(function(n){const o=tp(n);return o!==null&&Z1e.has(o)})(e)))}const k5=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),$2=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),b5=new Set(["'","’"]),bc=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),G1e=new Set([":",".","،","؛"]),Y1e=new Set(["၏"]),X1e=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function J1e(e){if(C5(e))return!0;let t=!1;for(const n of e)if(bc.has(n)||hg(n))t=!0;else if(!t||!ou.test(n))return!1;return t}function Q1e(e){for(const t of e)if(!k5.has(t)&&!bc.has(t))return!1;return e.length>0}function efe(e){if(C5(e))return!0;for(const t of e)if(!($2.has(t)||b5.has(t)||ou.test(t)||hg(t)))return!1;return e.length>0}function C5(e){let t=!1;for(const n of e)if(n!=="\\"&&!ou.test(n)){if(!($2.has(n)||bc.has(n)||b5.has(n)))return!1;t=!0}return t}function pg(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function tp(e){if(e.length===0)return null;const t=pg(e,e.length);return e.slice(t)}const tfe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function hg(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s=o[s]&&n<=o[s+1])return!0;return!1})(t,tfe)}function nfe(e){const t=(function(n){for(const o of n)if(!ou.test(o))return o;return null})(e);return t!==null&&y5.test(t)}function ofe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ou.test(o))n--;else{if(!$2.has(o)&&!b5.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function sfe(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function D_(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function B_(e,t){return e&&t!==null&&G1e.has(t)}function ife(e){const t=tp(e);return t!==null&&Y1e.has(t)}function rfe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function a8(e){let t=e.length;for(;t>0;){const n=pg(e,t),o=e.slice(n,t);if(X1e.has(o))return!0;if(!bc.has(o))return!1;t=n}return!1}function lfe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` +`)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const afe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Or(e){return e.length===1?e[0]:e.join("")}function ufe(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),Or(n)}function cfe(e,t,n,o){if(!afe.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,u=0;for(const c of e){const d=lfe(c,o),f=d==="text"&&t;i===null||d!==i||f!==a?(i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),i=d,r=[c],l=n+u,a=f,u+=c.length):(r.push(c),u+=c.length)}return i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),s}function Q9(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const dfe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function ffe(e,t){const n=e.texts[t];return!!n.startsWith("www.")||dfe.test(n)&&t+1=33&&n<=47&&n!==45||n>=58&&n<=64&&n!==63||n>=91&&n<=96||n>=123&&n<=126})(t):!vfe.has(e)&&!gfe.test(e)&&mfe.test(e)}function H_(e){let t=!1;for(const n of e)if(!ou.test(n)){if(!_$(n))return!1;t=!0}return t}function yfe(e,t,n,o){const s=!t&&H_(e),i=!o&&H_(n),r=(function(a){const u=(function(c){for(let d=c.length;d>0;){const f=pg(c,d),h=c.slice(f,d);if(!ou.test(h))return h;d=f}return null})(a);return u!==null&&hg(u)})(e),l=(t||r)&&(function(a){for(let u=a.length;u>0;){const c=pg(a,u),d=a.slice(c,u);if(!ou.test(d))return _$(d)||hg(d);u=c}return!1})(e);return!!(s||i||l)&&!kl(e)&&!kl(n)&&(t||s||r)&&(o||i)}function z_(e){for(const t of e)if(y5.test(t))return!0;return!1}function rm(e){if(e.length===0)return!1;for(const t of e)if(!y5.test(t)&&!hfe.has(t))return!1;return!0}function kfe(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s0&&u.charCodeAt(u.length-1)===32&&(u=u.slice(0,-1)),u})(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=(function(a,u,c){var d,f,h;const m=(J9===null&&(J9=new Intl.Segmenter(void 0,{granularity:"word"})),J9);let v=0;const k=[],w=[],b=[],_=[],g=[],x=[],S=[],T=[],A=[],E=[],P=[],D=[];for(const O of m.segment(a))for(const F of cfe(O.segment,(d=O.isWordLike)!=null&&d,O.index,c)){let U=function(){x[le]!==null&&(w[le]=[D_(k,x,S,le)],x[le]=null),w[le].push(F.text),b[le]=b[le]||F.isWordLike,T[le]=T[le]||K,A[le]=A[le]||V,E[le]=ne,P[le]=X,D[le]=B_(A[le],ie)};const z=F.kind==="text",W=sfe(F.text,F.isWordLike,F.kind),K=kl(F.text),V=O_(F.text),ie=tp(F.text),ne=a8(F.text),X=ife(F.text),le=v-1;u.carryCJKAfterClosingQuote&&z&&v>0&&_[le]==="text"&&K&&T[le]&&E[le]||z&&v>0&&_[le]==="text"&&Q1e(F.text)&&T[le]||z&&v>0&&_[le]==="text"&&P[le]?U():z&&v>0&&_[le]==="text"&&F.isWordLike&&V&&D[le]?(U(),b[le]=!0):W!==null&&v>0&&_[le]==="text"&&x[le]===W?S[le]=((f=S[le])!=null?f:1)+1:z&&!F.isWordLike&&v>0&&_[le]==="text"&&!T[le]&&(J1e(F.text)||F.text==="-"&&b[le])?U():(k[v]=F.text,w[v]=[F.text],b[v]=F.isWordLike,_[v]=F.kind,g[v]=F.start,x[v]=W,S[v]=W===null?0:1,T[v]=K,A[v]=V,E[v]=ne,P[v]=X,D[v]=B_(V,ie),v++)}for(let O=0;Onull);let $=-1;for(let O=v-1;O>=0;O--){const F=k[O];if(F.length!==0){if(_[O]==="text"&&!b[O]&&$>=0&&_[$]==="text"&&(efe(F)||F==="-"&&nfe(k[$]))){const U=(h=I[$])!=null?h:[];U.push(F),I[$]=U,g[$]=g[O],k[O]="";continue}$=O}}for(let O=0;OK+1){F.push(Or(X)),U.push(Ie),z.push("text"),W.push(O.starts[K]),K=le;continue}}F.push(V),U.push(ne),z.push(ie),W.push(O.starts[K]),K++}return{len:F.length,texts:F,isWordLike:U,kinds:z,starts:W}})((function(O){const F=[],U=[],z=[],W=[];for(let K=0;K1;for(let X=0;X=O.len||Q9(O.kinds[ie]))continue;const ne=[],X=O.starts[ie];let le=ie;for(;le0&&(F.push(Or(ne)),U.push(!0),z.push("text"),W.push(X),K=le-1)}return{len:F.length,texts:F,isWordLike:U,kinds:z,starts:W}})((function(O){const F=O.texts.slice(),U=O.isWordLike.slice(),z=O.kinds.slice(),W=O.starts.slice();for(let V=0;V=0&&!w$(u.texts[_-1],c)&&b(_),v<0&&(v=_),k=k||kl(g))}return b(u.len),{len:d.length,texts:d,isWordLike:f,kinds:h,starts:m}})(i,r,t.breakKeepAllAfterPunctuation):r;return mt({normalized:i,chunks:kfe(l,s)},l)}let ld=null;const W_=new Map;let ad=null;const Cfe=new RegExp("\\p{Emoji_Presentation}","u"),wfe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let e4=null;const U_=new Map;function u8(){if(ld!==null)return ld;if(typeof OffscreenCanvas<"u")return ld=new OffscreenCanvas(1,1).getContext("2d"),ld;if(typeof document<"u")return ld=document.createElement("canvas").getContext("2d"),ld;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Sa(e,t){let n=t.get(e);return n===void 0&&(n={width:u8().measureText(e).width,containsCJK:kl(e)},t.set(e,n)),n}function mg(){if(ad!==null)return ad;if(typeof navigator>"u")return ad={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ad;const e=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),n=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return ad={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},ad}function x$(){return e4===null&&(e4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),e4}function _fe(e){return Cfe.test(e)||e.includes("️")}function Ou(e,t,n){return n===0?t.width:t.width-(function(o,s){return s.emojiCount===void 0&&(s.emojiCount=(function(i){let r=0;const l=x$();for(const a of l.segment(i))_fe(a.segment)&&r++;return r})(o)),s.emojiCount})(e,t)*n}function xfe(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function j_(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function V_(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function w5(e,t){return t===0?0:e+t}function Mfe(e,t,n,o,s){return w5(o,t==="tab"?s+(function(i,r){return i.letterSpacing!==0&&i.spacingGraphemeCounts[r]>0?i.letterSpacing:0})(e,n):e.lineEndFitAdvances[n])}function q_(e,t,n,o){return w5(o,t==="tab"?0:e.lineEndFitAdvances[n])}function K_(e,t,n,o,s){return w5(o,t==="tab"?s:e.lineEndPaintAdvances[n])}function Tfe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Efe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function wh(e,t,n){let o=t;for(;oU){if(we!==null&&Q>G){le(ye,Q,te),ce=Q,ge=wh(we,ge,ce+1),Q=-1,te=0;continue}le(),de(ye,ce,ue)}else W+=ue,V=ye,ie=ce+1;else de(ye,ce,ue);const Se=ce+1;we!==null&&we[ge]===Se&&(Q=Se,te=W,ge++),ce++}K&&V===ye&&ie===fe.length&&(V=ye+1,ie=0)}let oe=0;for(;oe=B.length)));){const ye=B[oe],G=j_(H[oe]);if(K)if(W+ye>U){if(G){pe(oe,ye),le(oe+1,0,W-ye),oe++;continue}if(ne>=0){if(V>ne||V===ne&&ie>0){le();continue}le(ne,0,X);continue}if(ye>U&&O[oe]!==null){le(),ve(oe,0),oe++;continue}le()}else pe(oe,ye),G&&(ne=oe+1,X=W-ye),oe++;else ye>U&&O[oe]!==null?ve(oe,0):Ie(oe,ye),G&&(ne=oe+1,X=W-ye),oe++}return K&&le(),z})(n,o);const{widths:s,kinds:i,breakableFitAdvances:r,breakablePreferredBreaks:l,discretionaryHyphenWidth:a,chunks:u}=n;if(s.length===0||u.length===0)return 0;const c=mg(),d=o+c.lineFitEpsilon;let f=0,h=0,m=!1,v=0,k=0,w=-1,b=0,_=null;function g(){w=-1,b=0,_=null}function x(I=v,$=k,B){f++,h=0,m=!1,g()}function S(I,$){m=!0,v=I+1,k=0,h=$}function T(I,$,B){m=!0,v=I,k=$+1,h=B}function A(I,$){m?(h+=$,v=I+1,k=0):S(I,$)}function E(I,$,B,H,O,F){if(!$)return;const U=q_(n,I,B,O);K_(n,I,B,O,H),w=B+1,b=h-F+U,_=I}function P(I,$){var B;const H=r[I],O=(B=l[I])!=null?B:null;let F=O===null?-1:wh(O,0,$+1),U=-1,z=$;for(;zd){if(O!==null&&U>$){x(I,U),z=U,F=wh(O,F,z+1),U=-1;continue}x(),T(I,z,W)}else h=ie,v=I,k=z+1}else T(I,z,W);const K=z+1;O!==null&&O[F]===K&&(U=K,F++),z++}m&&v===I&&k===H.length&&(v=I+1,k=0)}function D(I){f++,g()}for(let I=0;I=$.endSegmentIndex)));){const H=i[B],O=j_(H),F=Afe(n,m,B),U=H==="tab"?Sfe(h+F,n.tabStopAdvance):s[B],z=F+U,W=Mfe(n,H,B,F,U);if(H!=="soft-hyphen")if(m){if(h+W>d){const K=h+q_(n,H,B,F);if(K_(n,H,B,F,U),_==="soft-hyphen"&&c.preferEarlySoftHyphenBreak&&b<=d){x(w,0);continue}if(O&&K<=d){A(B,z),x(B+1,0),B++;continue}if(w>=0&&b<=d){if(v>w||v===w&&k>0){x();continue}const V=w;x(V,0),B=V;continue}if(W>d&&r[B]!==null){x(),P(B,0),B++;continue}x();continue}A(B,z),E(H,O,B,U,F,z),B++}else W>d&&r[B]!==null?P(B,0):S(B,U),E(H,O,B,U,F,z),B++;else m&&(v=B+1,k=0,w=B+1,b=h+a,_=H),B++}m&&($.consumedEndSegmentIndex,x($.consumedEndSegmentIndex,0))}return f})(e,t)}let t4=null;function _5(){return t4===null&&(t4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),t4}function Lfe(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function u(d,f,h){o=[d],s=f,i=h,r=a8(d),l=$2.has(d)}function c(d,f){o.push(d),i=i||f;const h=a8(d);r=d.length===1&&bc.has(d)&&r||h,l=!1}for(const d of _5().segment(e)){const f=d.segment,h=kl(f);o.length!==0?l||k5.has(f)||bc.has(f)||t.carryCJKAfterClosingQuote&&h&&r?c(f,h):i||h?(a(),u(f,d.index,h)):c(f,h):u(f,d.index,h)}return a(),n}function $fe(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(l){if(!(s<0)){if(i)s+1===l?o.push(t[s]):(function(a,u){const c=t[a].start,d=u=0&&!w$(t[l-1].text,n)&&r(l),s<0&&(s=l),i=i||kl(a.text)}return r(t.length),o}function Z_(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=_5();for(const s of o.segment(e))n++;return n}function Nfe(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function Ffe(e,t,n,o,s){const i=mg(),{cache:r,emojiCorrection:l}=(function(D,I){u8().font=D;const $=(function(O){let F=W_.get(O);return F||(F=new Map,W_.set(O,F)),F})(D),B=(function(O){const F=O.match(/(\d+(?:\.\d+)?)\s*px/);return F?parseFloat(F[1]):16})(D),H=I?(function(O,F){let U=U_.get(O);if(U!==void 0)return U;const z=u8();z.font=O;const W=z.measureText("😀").width;if(U=0,W>F+.5&&typeof document<"u"&&document.body!==null){const K=document.createElement("span");K.style.font=O,K.style.display="inline-block",K.style.visibility="hidden",K.style.position="absolute",K.textContent="😀",document.body.appendChild(K);const V=K.getBoundingClientRect().width;document.body.removeChild(K),W-V>.5&&(U=W-V)}return U_.set(O,U),U})(D,B):0;return{cache:$,fontSize:B,emojiCorrection:H}})(t,(a=e.normalized,wfe.test(a)));var a;const u=Ou("-",Sa("-",r),l)+(s===0?0:2*s),c=8*Ou(" ",Sa(" ",r),l),d=s!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],h=[],m=[],v=[];let k=e.chunks.length<=1&&!d;const w=null,b=[],_=[],g=[],x=null,S=Array.from({length:e.len});function T(D,I,$,B,H,O,F,U,z){H!=="text"&&H!=="space"&&H!=="zero-width-break"&&(k=!1),f.push(I),h.push($),m.push(B),v.push(H),b.push(F),_.push(U),d&&g.push(z)}function A(D,I,$,B,H){const O=Sa(D,r),F=d?Z_(D,I):0,U=(function(V,ie,ne){return ie>1?V+(ie-1)*ne:V})(Ou(D,O,l),F,s),z=I==="space"||I==="preserved-space"||I==="zero-width-break"?0:U,W=z===0?0:z+(F>0?s:0),K=I==="space"||I==="zero-width-break"?0:U;if(H&&B&&D.length>1){let V="sum-graphemes";s!==0?V="segment-prefixes":rm(D)?V="pair-context":i.preferPrefixWidthsForBreakableRuns&&(V="segment-prefixes");const ie=(function(X,le,Ie,de,pe){if(le.breakableFitAdvances!==void 0&&le.breakableFitMode===pe)return le.breakableFitAdvances;le.breakableFitMode=pe;const ve=x$(),oe=[];for(const fe of ve.segment(X))oe.push(fe.segment);if(oe.length<=1)return le.breakableFitAdvances=null,le.breakableFitAdvances;if(pe==="sum-graphemes"){const fe=[];for(const we of oe){const ge=Sa(we,Ie);fe.push(Ou(we,ge,de))}return le.breakableFitAdvances=fe,le.breakableFitAdvances}if(pe==="pair-context"||oe.length>96){const fe=[];let we=null,ge=0;for(const Q of oe){const te=Ou(Q,Sa(Q,Ie),de);if(we===null)fe.push(te);else{const ce=we+Q,ue=Sa(ce,Ie);fe.push(Ou(ce,ue,de)-ge)}we=Q,ge=te}return le.breakableFitAdvances=fe,le.breakableFitAdvances}const ye=[];let G="",Y=0;for(const fe of oe){G+=fe;const we=Ou(G,Sa(G,Ie),de);ye.push(we-Y),Y=we}return le.breakableFitAdvances=ye,le.breakableFitAdvances})(D,O,r,l,V),ne=ie===null||o==="keep-all"?null:(function(X){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(X))return null;const le=[];let Ie=0;for(const de of _5().segment(X))Ie++,Nfe(de.segment)&&le.push(Ie);return le.length===0?null:le})(D);return void T(D,U,W,K,I,$,ie,ne,F)}T(D,U,W,K,I,$,null,null,F)}for(let D=0;D=55296&&X<=56319&&ne+1=56320&&pe<=57343&&(le=pe-56320+(X-55296<<10)+65536,Ie=2)}const de=U1e(le);de!=="R"&&de!=="AL"&&de!=="AN"||(U=!0);for(let pe=0;pe=0&&F[X]==="ET";X--)F[X]="EN";for(X=ne+1;X0?F[ne-1]:V)!=="L"?"R":"L";if(le===((X{const e=globalThis;if(e[n4])return e[n4];const t={configs:{},controllers:{},revision:Xr(0),preparedCache:new Map,blockEstimateCache:new Map};return e[n4]=t,t})();let lf=null;const o4=ys.revision;function G_(e){var t;return e&&(t=ys.configs[e])!=null?t:null}function Y_(e,t){const n=Number.parseFloat(String(e??""));return Number.isFinite(n)&&n>0?n:t}function Ofe(e){return e?.type==="text"||e?.type==="emoji"||e?.type==="hardbreak"}function s4(e){var t,n,o;if(!Array.isArray(e)||e.length===0)return null;let s="";for(const i of e){if(!Ofe(i))return null;i.type==="text"?s+=String((t=i.content)!=null?t:""):i.type==="emoji"?s+=String((o=(n=i.name)!=null?n:i.raw)!=null?o:""):i.type==="hardbreak"&&(s+=` +`)}return s.length>0?s:null}function i4(e,t,n){var o,s;if(!e||!Number.isFinite(t)||t<=0||!(function(){var i;if(lf!=null)return lf;if(typeof document>"u")return!1;try{const r=document.createElement("canvas");return lf=!!((i=r.getContext)!=null&&i.call(r,"2d")),lf}catch{return lf=!1,!1}})())return null;try{const i=Math.round(100*t)/100,r=[(o=n.whiteSpace)!=null?o:"pre-wrap",n.font,n.lineHeight,n.wrapperOverhead,n.widthAdjustment,i,e].join("\0"),l=ys.blockEstimateCache.get(r);if(l)return ys.blockEstimateCache.delete(r),ys.blockEstimateCache.set(r,l),{kind:"simple-text",height:l.height,contentHeight:l.contentHeight};const a=(s=n.whiteSpace)!=null?s:"pre-wrap",u=(function(h,m,v){const k=`${v}\0${m}\0${h}`,w=ys.preparedCache.get(k);if(w)return ys.preparedCache.delete(k),ys.preparedCache.set(k,w),w.prepared;const b=(function(_,g,x){return(function(S,T,A,E){var P,D;const I=(P=E?.wordBreak)!=null?P:"normal",$=(D=E?.letterSpacing)!=null?D:0;return Ffe(bfe(S,mg(),E?.whiteSpace,I),T,!1,I,$)})(_,g,0,x)})(h,m,{whiteSpace:v});for(ys.preparedCache.set(k,{prepared:b});ys.preparedCache.size>240;){const _=ys.preparedCache.keys().next().value;if(!_)break;ys.preparedCache.delete(_)}return b})(e,n.font,a),c=(function(h,m,v){const k=Ife(h,m);return{lineCount:k,height:k*v}})(u,Math.max(24,i-n.widthAdjustment),n.lineHeight),d=Math.max(n.lineHeight,c.height),f=Math.max(n.lineHeight,Math.round(d+n.wrapperOverhead));for(ys.blockEstimateCache.set(r,{height:f,contentHeight:Math.round(d)});ys.blockEstimateCache.size>4e3;){const h=ys.blockEstimateCache.keys().next().value;if(!h)break;ys.blockEstimateCache.delete(h)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch{return null}}function S$(e,t,n){var o,s;if(!n||!e||!Number.isFinite(t)||t<=0)return null;if(e.type==="paragraph"){const i=s4(e.children);return i&&n.paragraph?i4(i,t,n.paragraph):null}if(e.type==="heading"){const i=Number(e.level||0),r=s4(e.children),l=n.headings[i];return r&&l?i4(r,t,l):null}if(e.type==="list_item"){const i=Array.isArray(e.children)?e.children:[];if(i.length!==1||((o=i[0])==null?void 0:o.type)!=="paragraph"||!n.listItem)return null;const r=s4((s=i[0])==null?void 0:s.children);return r?i4(r,t,n.listItem):null}if(e.type==="list"){const i=Array.isArray(e.items)?e.items:[];if(!i.length)return null;let r=Math.max(0,n.listWrapperOverhead);for(const l of i){const a=S$(l,t,n);if(!a)return null;r+=a.height}return{kind:"simple-text",height:Math.max(1,Math.round(r)),contentHeight:Math.max(1,Math.round(r))}}return null}function af(e){if(!e)return 1;const t=String(e).split(/\r?\n/);return Math.max(1,t.length)}function Pu(e,t){const n=String(e??"");return t?n:n.replace(/\r\n$|\n$|\r$/,"")}function r4(e,t,n=0){return e.diff?v5(t??{},n)?(function(o){const s=Pu(o.raw);if(s){const i=s.split(/\r?\n/);return o.originalCode!=null||o.updatedCode!=null?Math.max(1,i.filter(r=>!Rfe.some(l=>r.startsWith(l))).length):Math.max(1,i.length)}return af(Pu(o.originalCode))+af(Pu(o.updatedCode))})(e):(function(o){const s=o.originalCode,i=o.updatedCode;if(s!=null||i!=null)return Math.max(af(Pu(s)),af(Pu(i)));const r=Pu(o.code).split(/\r?\n/);let l=0,a=0;for(const u of r)u.startsWith("+")&&!u.startsWith("+++")?a++:u.startsWith("-")&&!u.startsWith("---")?l++:(l++,a++);return Math.max(1,l,a)})(e):af(Pu(e.code,e.loading===!0))}function Pfe(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function l4(e,t,n="pre-wrap"){if(!e||!t||typeof window>"u")return null;const o=window.getComputedStyle(t),s=e.offsetHeight,i=Y_(o.lineHeight,1.5*Y_(o.fontSize,16)),r=e.getBoundingClientRect().width,l=t.getBoundingClientRect().width;return{font:Pfe(o),lineHeight:i,wrapperOverhead:Math.max(0,s-i),widthAdjustment:Math.max(0,r-l),whiteSpace:n}}const Dfe=new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function X_(e,t={}){var n;const o={},s=new Set((n=t.omit)!=null?n:[]);if(!e||typeof e!="object")return o;const i=Object.getOwnPropertyDescriptors(e);for(const[r,l]of Object.entries(i))Dfe.has(r)||s.has(r)||l.enumerable&&"value"in l&&(o[r]=l.value);return o}function J_(e,t,n,o){var s;const i=(function(f){return Math.max(0,Math.ceil(f.scrollHeight||0)-Math.ceil(f.clientHeight||0))})(e),r=(function(f,h){return Number.isFinite(f)?Math.min(Math.max(0,f),h):0})(n,i);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=r);const l=Math.max(0,i-r),a=[-l,l];let u=a[0],c=Number.POSITIVE_INFINITY;for(const f of a){e.scrollTop=f;const h=o.getNormalizedScrollTop(e,t,!1),m=Math.abs(h-r);md&&(e.scrollTop=u)}function Q_(e,t){let n=0,o=null,s=null;const i=()=>{const r=s;s=null,o=null,r&&(n=Date.now(),e(...r))};return function(...r){const l=Date.now(),a=t-(l-n);s=r,a<=0?(o&&(clearTimeout(o),o=null),n=l,s=null,e(...r)):o||(o=setTimeout(i,a))}}function ex(e){return e==="simple"?"simple":e===!0||e==="true"||e==="precise"?"precise":"off"}const A$=Symbol("MarkstreamMathBlockMinHeightCache");function LVe(){return nn(A$,null)}const Bfe=new Set(["text","inline_code","emoji","footnote_reference"]),Hfe=new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function uf(e){const t=Number(e);return!Number.isFinite(t)||t<=0?-1:Math.round(t/32)}function Du(e,t,n,o=22){const s=String(e??"");if(!s)return n;const i=Math.max(18,Math.floor(Math.max(320,t)/8)),r=s.split(/\r?\n/).length,l=Math.ceil(s.length/i),a=Math.max(1,r,l);return Math.max(n,Math.ceil(a*o+12))}function M$(e){var t;if(!e||typeof e!="object")return!1;const n=e,o=String((t=n.type)!=null?t:"");if(Bfe.has(o))return!0;if(!Hfe.has(o))return!1;const s=n.children;return!Array.isArray(s)||!s.length||s.every(M$)}function c8(e){var t,n,o,s,i,r,l,a;if(!e||typeof e!="object")return"";const u=e,c=String((t=u.type)!=null?t:"");if(c==="text")return String((o=(n=u.content)!=null?n:u.raw)!=null?o:"");if(c==="inline_code")return String((r=(i=(s=u.code)!=null?s:u.content)!=null?i:u.raw)!=null?r:"");if(c==="emoji")return String((a=(l=u.name)!=null?l:u.raw)!=null?a:"");if(typeof u.text=="string")return u.text;const d=[];for(const f of["children","items","cells","rows"]){const h=u[f];if(Array.isArray(h)){const m=h.map(c8).filter(Boolean).join(" ");m&&d.push(m)}}return d.join(" ").replace(/\s+/g," ").trim()}function T$(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="inline_code"||["children","items","cells","rows"].some(n=>{const o=t[n];return Array.isArray(o)&&o.some(T$)})}function zfe(e,t){if(!e)return 30;const n=Math.max(18,Math.floor(Math.max(320,t)/8)),o=e.split(/\r?\n/).length,s=Math.ceil(e.length/n),i=Math.max(1,o,s);return 30+26*Math.max(0,i-1)}function Wfe(e,t){var n,o,s,i,r,l,a,u,c,d,f,h,m,v;if(!e||typeof e!="object")return 32;const k=e,w=String((n=k.type)!=null?n:""),b=Number.isFinite(t)&&t>0?t:640;switch(w){case"heading":return(function(_){var g;const x=Number((g=_.level)!=null?g:_.depth);return x>=4?20:x===3?30:x===2?32:44})(k);case"paragraph":return(function(_,g){const x=String(_??"");if(!x)return 28;const S=Math.max(18,Math.floor(Math.max(320,g)/8)),T=x.split(/\r?\n/).length,A=Math.ceil(x.length/S);return Math.max(1,T,A)<=1?28:Du(x,g,34)})(String((s=(o=k.raw)!=null?o:k.content)!=null?s:""),b);case"list":return(function(_,g){var x;const S=Array.isArray(_.items)?_.items:[];if(!S.length)return 48;const T=Math.max(48,30*S.length+12);let A=12;for(const D of S)A+=zfe(c8(D)||String((x=D.raw)!=null?x:""),g);const E=Math.max(0,A-T);if(S.length>20){const D=Math.round(2.4*S.length);return Math.round(T+Math.max(D,Math.min(E,3*S.length)))}if(E<=0)return T;const P=S.length>8?8*S.length:E;return Math.round(T+Math.min(E,P))})(k,b);case"list_item":return Du(String((r=(i=k.raw)!=null?i:k.content)!=null?r:""),b,34);case"blockquote":return Du(String((a=(l=k.raw)!=null?l:k.content)!=null?a:""),b,56);case"table":return(function(_,g){const x=[..._.header?[_.header]:[],...Array.isArray(_.rows)?_.rows:[]];if(!x.length){const S=Array.isArray(_.children)?_.children.length:3;return Math.max(120,38*S+48)}return Math.max(120,Math.round(4+x.reduce((S,T)=>S+(function(A,E){const P=Math.max(1,A.length),D=Math.max(80,(E-32)/P),I=Math.max(10,Math.floor(D/8)),$=Math.max(1,...A.map(B=>{var H;const O=c8(B)||String((H=B?.raw)!=null?H:"");return Math.ceil(O.length/I)||1}));return 54+34*Math.max(0,$-1)+(P<=3&&A.some(T$)?14:0)})((function(A){var E;return Array.isArray(A?.cells)&&(E=A.cells)!=null?E:[]})(T),g),0)))})(k,b);case"code_block":{const _=String((u=k.language)!=null?u:"").trim().toLowerCase(),g=String((d=(c=k.code)!=null?c:k.raw)!=null?d:"");return _==="mermaid"?lg(ig(g)):_==="infographic"?ag(rg(g)):Du(g,b,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return(function(_,g){var x,S,T;const A=_.match(/^\s*]*)>/i);return A&&!/(?:^|\s)open(?:\s|=|$)/i.test((x=A[1])!=null?x:"")?Du(((T=(S=_.match(/]*>([\s\S]*?)<\/summary>/i))==null?void 0:S[1])==null?void 0:T.replace(/<[^>]*>/g,"").trim())||"Details",g,28,28):Du(_,g,96)})(String((h=(f=k.raw)!=null?f:k.content)!=null?h:""),b);case"thematic_break":return 24;default:return Du(String((v=(m=k.raw)!=null?m:k.content)!=null?v:""),b,40)}}function tx(e,t,n){return Math.min(Math.max(e,t),n)}const Ufe=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],jfe=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","parseMarkdownToStructureTotalMs"],Vfe=new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),E$=["raw","content","code","originalCode","updatedCode"],nx=new WeakMap,ox=new WeakMap;let qfe=1;function Rr(){return typeof performance<"u"?performance.now():Date.now()}function sx(e){const t=e.stream;return t&&typeof t.stats=="function"?t.stats():null}function Qi(e){if(typeof e!="object"&&typeof e!="function"||e===null)return"";const t=e;let n=nx.get(t);return n||(n=qfe++,nx.set(t,n)),String(n)}function ix(e,t,n,o={}){var s,i;const r=o.includeFinal!==!1,l={md:Qi(t),customMarkdownIt:Qi(n),requireClosingStrong:e.requireClosingStrong===!0,customHtmlTags:(s=e.customHtmlTags)!=null?s:[],includeSourceMap:e.includeSourceMap===!0,streamParse:(i=e.streamParse)!=null?i:"auto",validateLink:Qi(e.validateLink),preTransformTokens:Qi(e.preTransformTokens),postTransformTokens:Qi(e.postTransformTokens),postTransformNodes:Qi(e.postTransformNodes)};return r&&(l.final=e.final===!0),JSON.stringify(l)}function rx(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===10;)t-=1;const n=e.lastIndexOf(` +`,t-1)+1;return e.slice(n,t).trim()}function lx(e){const t=I$(e);return t.length>=2&&t.every(n=>{const o=n.trim();return o.length>=1&&o.replace(/^:/,"").replace(/:$/,"").split("").every(s=>s==="-")})}function I$(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function L$(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function x5(e){const t=String(e??"");return`${t.length}:${L$(t)}`}function d8(e,t=new WeakMap,n=0){if(e==null||typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="string")return`s:${(function(r){return r.length<=8192?x5(r):`${r.length}:${L$(r.slice(0,8192))}:truncated`})(e)}`;if(typeof e=="function")return`fn:${Qi(e)}`;if(typeof e!="object")return typeof e;const o=e,s=t.get(o);if(s)return`cycle:${s}`;if(n>=6)return`object:${Qi(o)}`;const i=Qi(o);if(t.set(o,i),Array.isArray(e)){const r=e.slice(0,200);return`a:${e.length}:${r.map(l=>d8(l,t,n+1)).join(",")}`}if(typeof e=="object"){const r=e,l=Object.keys(r).sort(),a=l.slice(0,80);return`o:${l.length}:${a.sort().map(u=>`${u}:${d8(r[u],t,n+1)}`).join(";")}`}return typeof e}function gg(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"&&typeof e.raw=="string"}function $$(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(o=>gg(o)?su(o,t,n+1):$$(o,t,n+1)).join(",")}`:gg(e)?su(e,t,n):d8(e,t,n)}function Kfe(e,t,n){return Object.keys(e).sort().filter(o=>o!=="children"&&!E$.includes(o)).map(o=>{const s=e[o];return typeof s=="string"?`${o}=s:${x5(s)}`:typeof s=="number"||typeof s=="boolean"||s==null?`${o}=${String(s)}`:typeof s=="function"?`${o}=fn:${Qi(s)}`:Vfe.has(o)&&(Array.isArray(s)||typeof s=="object")?`${o}=${$$(s,t,n+1)}`:s&&typeof s=="object"?`${o}=object:${Qi(s)}`:""}).filter(Boolean).join(";")}function Zfe(e){return E$.map(t=>{const n=e[t];return typeof n=="string"?`${t}=s:${x5(n)}`:""}).filter(Boolean).join(";")}function su(e,t=new WeakMap,n=0){const o=ox.get(e);if(o)return o;const s=e,i=t.get(s);if(i)return`node-cycle:${i}`;if(n>=6)return`node:${e.type}:${Qi(s)}`;const r=Qi(s);t.set(s,r);const l=(function(a,u,c){const d=a,f=Array.isArray(d.children)?d.children:[],h=f.length?f.slice(0,200).map(m=>su(m,u,c+1)).join("|"):"";return[a.type,Zfe(d),Kfe(d,u,c),f.length,h].join(":")})(e,t,n);return ox.set(s,l),l}function N$(e,t){return su(e)===su(t)}function S5(e,t,n){const o=Rr(),s=t==="stabilizeSignatureMs"?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return n()}finally{e[t]+=Rr()-o,e[s]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function ax(e,t,n){return S5(t,n,()=>su(e))}function F$(e,t,n){return ax(e,n,"stabilizeSignatureMs")===ax(t,n,"stabilizeSignatureMs")}function _h(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ux(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function cx(e){return e.__markstreamHasCustomParserExtensions===!0||(function(t){var n;return Number((n=t.__markstreamRegisteredPluginCount)!=null?n:0)>0})(e)}function Gfe(e,t){return e.length===t.length&&e===t}function A5(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;const o=e,s=t,i=Object.keys(o).filter(c=>c!=="type"&&c!=="children").sort(),r=Object.keys(s).filter(c=>c!=="type"&&c!=="children").sort();if(i.length!==r.length)return!1;for(let c=0;c{o=A5(e,t)}),o??F$(e,t,n)}function Jfe(e,t){const n={};for(const o of Ufe){const s=e[o],i=t?.[o];typeof s=="number"&&(n[o]=s-(typeof i=="number"?i:0))}return n}function Qfe(e,t){var n;const o=l_(t.instanceMsgId),s=new Map,i=(n=t.smoothStreamingEnabled)!=null?n:R(()=>!1),r=Z(t.renderContent.value);let l=[],a="",u="",c="",d=!1;const f=(function(){let B="",H=0,O=!1,F=!1,U=!1,z=!1;function W(){B="",H=0,O=!1,F=!1,U=!1,z=!1}function K(V){let ie=!1;for(let ne=0;ne{if(!V||!ie.startsWith(V)||ie.length<=V.length)return W(),[!0,0];let ne=0;B!==V&&(W(),K(V),ne=V.length);const X=ie.slice(V.length),le=K(X);return B=ie,[le,ne+X.length]}})();let h,m=0,v=0,k=Rr(),w=-1,b=0;function _(B){w=Number.isInteger(B)?B:0,b+=1}function g(){h&&(clearTimeout(h),h=void 0)}function x(){g();const B=t.renderContent.value;r.value!==B&&(r.value=B),k=Rr()}Je([t.renderContent,t.effectiveFinal,i],([B,H,O])=>{r.value!==B&&(!O||H||(function(F,U){if(!F&&U||U.length<=80||U.length\s*|`{3,}|~{3,})/.test(z))||z.endsWith(` +`)&&!(function(W){const K=rx(W);if(lx(K))return!1;const V=I$(K);return V.length>=2&&V.some(ie=>ie.trim())})(U))})(r.value,B)?x():(function(){if(v+=1,h)return;const F=Math.max(0,(function(U){const z=U.parseCoalesceMs;return typeof z=="number"&&Number.isFinite(z)&&z>=0?z:80})(e)-(Rr()-k));F<=0?x():h=setTimeout(x,F)})())},{flush:"sync",immediate:!0}),d1(g);const S=R(()=>{var B,H,O,F;return cie(e.customHtmlTags,(B=e.parseOptions)==null?void 0:B.customHtmlTags,(F=(O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{},Object.entries(F).map(([U,z])=>{const W=Sr(U);return z==null||!W||Qp(W)||WI.has(W)||Zp.has(W)?"":W}).filter(Boolean)))}),T=R(()=>{const{key:B,tags:H}=die(S.value);if(!B)return o;const O=s.get(B);if(O)return O;const F=l_(t.instanceMsgId,{customHtmlTags:H});return s.set(B,F),F}),A=R(()=>{const B=T.value;if(!e.customMarkdownIt)return B;const H=e.customMarkdownIt(B);return B.__markstreamHasCustomParserExtensions=!0,H.__markstreamHasCustomParserExtensions=!0,H}),E=R(()=>{var B,H;const O=(B=e.parseOptions)!=null?B:{},F=t.effectiveFinal.value,U=S.value,z=F!=null,W=U.length>0;return z||W||O.streamParse==null?mt(mt(rn(mt({},O),{streamParse:(H=O.streamParse)==null||H}),z?{final:F}:{}),W?{customHtmlTags:U}:{}):O}),P=R(()=>{var B;return new Set(((B=E.value.customHtmlTags)!=null?B:[]).map(H=>String(H).trim().toLowerCase()).filter(Boolean))}),D=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!0})),I=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!1}));Je([D,I],([B,H],[O,F])=>{O&&(B===O&&H===F||(x(),H!==F&&(l=[],c="")))},{flush:"sync"});const $=R(()=>{var B,H,O,F,U,z,W,K,V,ie,ne;if((B=e.nodes)!=null&&B.length)return l=[],c="",_(0),kt(e.nodes.slice());const X=r.value;if(!X)return l=[],c="",_(-1),[];const le=t.debugPerformanceEnabled.value,Ie=le?Rr():0,de=A.value,pe=D.value,ve=I.value;a&&pe!==a&&(function(Fe){var Oe,Ge;(Ge=(Oe=Fe.stream)==null?void 0:Oe.reset)==null||Ge.call(Oe)})(de),u&&ve!==u&&(l=[],c="");const oe=Object.keys((O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{}).length>0||typeof E.value.postTransformNodes=="function";oe!==d&&(l=[],c="");const ye=!oe&&l.length>0&&X.startsWith(c)&&ve===u,G=le?sx(de):null,Y=le?{}:void 0,fe=cx(de),we=!fe&&!oe,ge=mt(mt(rn(mt({},E.value),{__reuseStableTopLevelNodes:we}),fe?{__disableStreamParse:!0}:{}),Y?{__timing:Y}:{}),Q=UL(X,de,ge),te=le?Rr():0,ce=le?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ue,Se=le?_h(Q.length):void 0,ze=0,_e=0,Ee=0;if(ye){const Fe=le?Rr():0,[Oe,Ge]=(function(Tt){var Bt,Yt;const[Sn,on]=Tt.scanGlobalReferenceAppend(Tt.previousContent,Tt.content),en=Tt.parseOptions;return[Tt.previousDirtyStartIndex>0&&en.final!==!0&&!Tt.customMarkdownIt&&!cx(Tt.md)&&!Sn&&typeof en.preTransformTokens!="function"&&typeof en.postTransformTokens!="function"&&typeof en.postTransformNodes!="function"&&((Yt=(Bt=en.customHtmlTags)==null?void 0:Bt.length)!=null?Yt:0)===0?Tt.previousDirtyStartIndex:0,on]})({content:X,previousContent:c,previousDirtyStartIndex:w,parseOptions:E.value,customMarkdownIt:e.customMarkdownIt,md:de,scanGlobalReferenceAppend:f});Ee=Ge;const at=Oe<=0;if(ce){const Tt=(function(Bt,Yt,Sn,on={}){var en;if(!Yt.length)return{nodes:Bt,metrics:_h(Bt.length)};const Cn=(en=on.scanStartIndex)!=null?en:0,Mn=on.reuseDirtyTail!==!1,We=(function(Lt,gt,wn,yn=0){const go=Math.min(Lt.length,gt.length);for(let qt=Math.min(go,Math.max(0,yn));qtsu(Fe[at]))})(ue,ce,_e):(function(Fe,Oe=0){for(let Ge=Math.max(0,Oe);Ge((U=G?.total)!=null?U:0);t.logPerf(Oe?"parse(stream)":"parse(sync)",mt(mt(mt({rendererId:t.instanceMsgId,ms:Math.round(Rr()-Ie),nodes:ue.length,contentLength:X.length,parseCommitCount:m,parseCoalescedCount:v,nodeReuseMs:it,referenceDefinitionScanChars:Ee,signatureMs:(z=ce?.signatureMs)!=null?z:0,stabilizeSignatureMs:(W=ce?.stabilizeSignatureMs)!=null?W:0,primeSignatureMs:(K=ce?.primeSignatureMs)!=null?K:0,signatureCallCount:(V=ce?.signatureCallCount)!=null?V:0,stabilizeSignatureCallCount:(ie=ce?.stabilizeSignatureCallCount)!=null?ie:0,primeSignatureCallCount:(ne=ce?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:ze},Se??{}),Y?Object.fromEntries(jfe.map(Ge=>{var at;return[Ge,(at=Y[Ge])!=null?at:0]})):{}),Fe?{streamMode:Fe.lastMode,streamDelta:Jfe(Fe,G),streamStats:Fe}:{}))}return kt(ue)});return{effectiveCustomHtmlTags:S,effectiveCustomHtmlTagsSet:P,mdBase:T,mdInstance:A,mergedParseOptions:E,getParsedNodesDirtyStartIndex:()=>w,getParsedNodesRevision:()=>b,parsedNodes:$}}function epe(e){const{isClient:t}=e,n=Z(new Set),o=new Map,s=new Map,i=new Map;function r(u){if(!t)return;const c=i.get(u);c!=null&&(window.clearTimeout(c),i.delete(u))}function l(){if(t)for(const u of i.values())window.clearTimeout(u);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(u,c=!0){var d;c&&r(u),(function(f,h){if((v=(m=e.shouldTrackVisibleNodeIndices)==null?void 0:m.call(e))!=null&&!v)return;var m,v;const k=n.value,w=k.has(f);if(h){if(w)return;const _=new Set(k);return _.add(f),void(n.value=_)}if(!w)return;const b=new Set(k);b.delete(f),n.value=b})(u,c),c&&((d=e.onNodeMarkedVisible)==null||d.call(e,u))},resetNodeVisibleState:a,cleanupNodeVisibility:function(u){var c;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f{const c=s.getSnapshot();t.value=c.source,n.value=c.visible,o.value=c.done},r=s.subscribe(i);i();const l=R(()=>Math.max(0,t.value.length-n.value.length)),a=R(()=>l.value===0),u=R(()=>o.value&&a.value);return Kg()&&d1(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:u,caughtUp:a,pendingChars:l,enqueue:c=>s.enqueue(c),finish:c=>s.finish(c),flush:()=>s.flush(),reset:c=>s.reset(c),pause:()=>s.pause(),resume:()=>s.resume()}}const npe={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},dx=/auto|scroll|overlay/i;function ope(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return dx.test(t)||dx.test(n)}function spe(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const ipe={class:"m-0 p-0"},rpe=["data-probe"],lpe=Gn(et(rn(mt({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(y(),M("div",{class:"height-estimation-probes",style:Zt({width:`${e.width}px`}),"aria-hidden":"true"},[C("div",{ref:i=>e.setParagraphWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[j(p(cc),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),C("div",{ref:i=>e.setListItemWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[C("ul",ipe,[j(p(Vd),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),C("div",{ref:i=>e.setListWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[j(p(qd),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(y(),M(Pe,null,pt(6,i=>C("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[j(p(L2),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,rpe)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),fx=et({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return ag((o=Md(e.estimatedPreviewHeightPx))!=null?o:rg(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),tn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),tn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,tn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"absolute inset-0"},[tn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),px=et({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return lg((o=Md(e.estimatedPreviewHeightPx))!=null?o:ig(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),tn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[tn("span",{class:"action-icon block"})])))]):null,tn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),ape={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function As(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const upe=["data-custom-id"],cpe=["data-node-index","data-node-type"],hx="typewriter-simple-cursor-target",R$=Gn(et(rn(mt({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(L){if(!(typeof Event<"u"&&L instanceof Event))return typeof L=="string"&&s("copy-code",L),void s("copy",L)}const r=ds(),l=nn("markstreamNestedRendererProps",void 0);function a(L){const q=r?.vnode.props;return!!q&&(Object.prototype.hasOwnProperty.call(q,L)||Object.prototype.hasOwnProperty.call(q,String(L).replace(/[A-Z]/g,re=>`-${re.toLowerCase()}`)))}function u(L){var q,re;const ae=o[L];return a(L)?ae:(re=(q=l?.value)==null?void 0:q[L])!=null?re:ae}const c=R(()=>{return(L=u("mode"))==="chat"||L==="minimal"||L==="docs"?L:"docs";var L}),d=R(()=>ex(u("typewriter"))),f=R(()=>d.value!=="off"),h=R(()=>u("domMode")==="minimal"?"minimal":"full"),m=R(()=>{return(L={mode:c.value,codeRenderer:u("codeRenderer"),renderCodeBlocksAsPre:u("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":L.codeRenderer==="pre"||L.codeRenderer==="shiki"||L.codeRenderer==="monaco"?L.codeRenderer:L.renderCodeBlocksAsPre===!1||L.mode==="docs"?"monaco":"pre";var L}),v=R(()=>ape[c.value]),k=R(()=>{var L;return(L=u("showTooltips"))!=null?L:v.value.showTooltips}),w=R(()=>{var L;return(L=u("fade"))!=null?L:v.value.fade}),b=R(()=>{var L;return(L=u("batchRendering"))!=null?L:v.value.batchRendering}),_=R(()=>{var L;return(L=u("initialRenderBatchSize"))!=null?L:v.value.initialRenderBatchSize}),g=R(()=>{var L;return(L=u("renderBatchSize"))!=null?L:v.value.renderBatchSize}),x=R(()=>{var L;return(L=u("renderBatchDelay"))!=null?L:v.value.renderBatchDelay}),S=R(()=>{var L;return(L=u("renderBatchBudgetMs"))!=null?L:v.value.renderBatchBudgetMs}),T=R(()=>{var L;return(L=u("renderBatchIdleTimeoutMs"))!=null?L:v.value.renderBatchIdleTimeoutMs}),A=R(()=>{var L;return(L=u("deferNodesUntilVisible"))!=null?L:v.value.deferNodesUntilVisible}),E=R(()=>{var L;return(L=u("maxLiveNodes"))!=null?L:v.value.maxLiveNodes}),P=R(()=>{var L;return(L=u("liveNodeBuffer"))!=null?L:v.value.liveNodeBuffer}),D=R(()=>{var L;return(L=u("nodeVirtual"))!=null?L:v.value.nodeVirtual}),I={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return u("parseOptions")},get customMarkdownIt(){return u("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return u("customHtmlTags")},get mode(){return u("mode")},get domMode(){return h.value},get htmlPolicy(){return u("htmlPolicy")},get viewportPriority(){return u("viewportPriority")},get viewportPriorityOptions(){return u("viewportPriorityOptions")},get codeBlockStream(){return u("codeBlockStream")},get codeBlockDarkTheme(){return u("codeBlockDarkTheme")},get codeBlockLightTheme(){return u("codeBlockLightTheme")},get codeBlockMonacoOptions(){return u("codeBlockMonacoOptions")},get codeRenderer(){return u("codeRenderer")},get renderCodeBlocksAsPre(){return u("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return u("codeBlockMinWidth")},get codeBlockMaxWidth(){return u("codeBlockMaxWidth")},get codeBlockProps(){return u("codeBlockProps")},get mermaidProps(){return u("mermaidProps")},get d2Props(){return u("d2Props")},get infographicProps(){return u("infographicProps")},get showTooltips(){return k.value},get themes(){return u("themes")},get langs(){return u("langs")},get isDark(){return u("isDark")},get customId(){return u("customId")},get indexKey(){return o.indexKey},get typewriter(){return u("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return u("smoothStreamingOptions")},get parseCoalesceMs(){return u("parseCoalesceMs")},get fade(){return w.value},get batchRendering(){return b.value},get initialRenderBatchSize(){return _.value},get renderBatchSize(){return g.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return S.value},get renderBatchIdleTimeoutMs(){return T.value},get deferNodesUntilVisible(){return A.value},get maxLiveNodes(){return E.value},get liveNodeBuffer(){return P.value},get nodeVirtual(){return D.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function $(L){s("height-change",L)}function B(L){s("virtual-state-change",L)}function H(L){s("anchor-change",L)}const O=Z(),F=Z(null),U=Z(null),z=Z(null),W=Go({1:null,2:null,3:null,4:null,5:null,6:null}),K=Z(!1),V=new Map,ie=Z(0),ne=Z(0),X=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function le(L,q){return typeof L!="string"?q:L.trim()||q}function Ie(L){const q=Number(L);return Number.isFinite(q)&&q>0?Math.max(1,Math.trunc(q)):640}const de=R(()=>{var L;const q=(L=I.viewportPriorityOptions)!=null?L:{},re=le(q.rootMargin,yc);return{rootMargin:re,heavyBlockMargin:le(q.heavyBlockMargin,re),maxTargets:Ie(q.maxTargets)}}),pe=R(()=>{var L;return(L=de.value.rootMargin)!=null?L:yc}),ve=R(()=>{var L;return(L=de.value.maxTargets)!=null?L:640});function oe(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.enabled)!==!0)return null;const re=(q=o.virtualScroll)==null?void 0:q.scrollRoot;return ye(typeof re=="function"?re():re)}function ye(L){return L?typeof HTMLElement<"u"&&L instanceof HTMLElement?L:typeof L=="object"&&"value"in L?ye(L.value):typeof L=="object"&&"$el"in L?ye(L.$el):null:null}Ln(y$,de);const{isClient:G,renderAsFragment:Y,debugPerformanceEnabled:fe,resolvedShowTooltips:we,resolvedHtmlPolicy:ge,inheritedSmoothStreaming:Q,ownsTypewriterCursor:te}=(function(L){const q=typeof window<"u",re=p1(),ae=nn("markstreamHtmlPolicy",void 0),be=nn("markstreamTypewriterCursor",void 0),Ne=nn("markstreamSmoothStreaming",void 0),De=R(()=>L.renderAsFragment===!0),je=R(()=>!!(L.debugPerformance&&q&&typeof console<"u")),ot=R(()=>{var nt;if(typeof L.showTooltips=="boolean")return L.showTooltips;const Be=(nt=re.showTooltips)!=null?nt:re["show-tooltips"];return Be===""||Be===!0||Be==="true"||Be!==!1&&Be!=="false"&&void 0}),Ve=R(()=>{var nt,Be;return(Be=(nt=L.htmlPolicy)!=null?nt:ae?.value)!=null?Be:"safe"}),Ye=R(()=>be?.value!==!0);return{isClient:q,renderAsFragment:De,debugPerformanceEnabled:je,resolvedShowTooltips:ot,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:Ne,inheritedTypewriterCursor:be,ownsTypewriterCursor:Ye}})(I),{resolveViewportRoot:ce,resolveScrollContainer:ue,isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e}=(function(L,q){function re(){var je,ot;return(ot=(je=q.scrollRoot)==null?void 0:je.call(q))!=null?ot:null}function ae(je){if(typeof window>"u")return null;const ot=re();if(ot)return ot;const Ve=je??L.value;if(!Ve)return null;const Ye=Ve.ownerDocument||document,nt=Ye.scrollingElement||Ye.documentElement;let Be=Ve;for(;Be&&Be!==Ye.body&&Be!==nt;){if(ope(window.getComputedStyle(Be))&&spe(Be))return Be;Be=Be.parentElement}return null}function be(je){if(!q.isClient)return!1;try{const ot=window.getComputedStyle(je);return!!(ot.display||"").toLowerCase().includes("flex")&&(ot.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function Ne(je,ot,Ve){var Ye,nt;if(Ve)return De(ot);const Be=je.scrollTop;if(!be(je))return Be;const Xe=Be<0?-Be:Be;return Math.max(0,((Ye=je.scrollHeight)!=null?Ye:0)-((nt=je.clientHeight)!=null?nt:0))-Xe}function De(je){var ot,Ve,Ye,nt,Be;const Xe=Number((ot=je.scrollingElement)==null?void 0:ot.scrollTop),lt=Number((Ye=(Ve=je.documentElement)==null?void 0:Ve.scrollTop)!=null?Ye:0),rt=Number((Be=(nt=je.body)==null?void 0:nt.scrollTop)!=null?Be:0);return Math.max(0,Number.isFinite(Xe)?Xe:0,Number.isFinite(lt)?lt:0,Number.isFinite(rt)?rt:0)}return{resolveViewportRoot:ae,resolveScrollContainer:function(je){var ot,Ve,Ye,nt;const Be=re();if(Be)return Be;const Xe=ae((ot=je??L.value)!=null?ot:null);if(Xe)return Xe;const lt=(nt=(Ye=je?.ownerDocument)!=null?Ye:(Ve=L.value)==null?void 0:Ve.ownerDocument)!=null?nt:typeof document<"u"?document:null;return lt?.scrollingElement||lt?.documentElement||null},isReverseFlexScrollRoot:be,getNormalizedScrollTop:Ne,getOffsetTopWithinRoot:function(je,ot){const Ve=ot.ownerDocument||je.ownerDocument||document;if((function(Xe,lt){return Xe===lt.documentElement||Xe===lt.body||Xe===lt.scrollingElement})(ot,Ve))return je.getBoundingClientRect().top+De(Ve);const Ye=ot.getBoundingClientRect(),nt=je.getBoundingClientRect(),Be=Ne(ot,Ve,!1);return nt.top-Ye.top+Be}}})(O,{isClient:G,scrollRoot:oe});Ln("markstreamShowTooltips",we),Ln("markstreamHtmlPolicy",ge),Ln("markstreamTypewriter",f),Ln("markstreamFade",R(()=>I.fade!==!1)),Ln("markstreamTypewriterCursor",R(()=>!0)),Ln("markstreamTextStreamState",V),Ln("markstreamStreamVersion",ie),Ln("markstreamParseOptions",R(()=>I.parseOptions)),Ln("markstreamCustomMarkdownIt",R(()=>I.customMarkdownIt));const{smoothStreamingEnabled:Ee,renderContent:it,requestedFinal:Fe,effectiveFinal:Oe}=(function(L,q){const re=tpe(mt(mt({},npe),L.smoothStreamingOptions)),ae=R(()=>{var Be,Xe,lt;return L.smoothStreaming!==!1&&!((Be=L.nodes)!=null&&Be.length)&&(L.smoothStreaming===!0||!((Xe=q.inheritedSmoothStreaming)!=null&&Xe.value))&&(L.smoothStreaming===!0||ex(L.typewriter)!=="off"||((lt=L.maxLiveNodes)!=null?lt:0)<=0)}),be=Z(!q.isClient||L.smoothStreaming===!0);dn(()=>{be.value=!0});const Ne=R(()=>be.value&&ae.value),De=R(()=>{var Be;return Ne.value?re.visible.value:(Be=L.content)!=null?Be:""}),je=R(()=>{var Be,Xe;const lt=(Be=L.parseOptions)!=null?Be:{};return(Xe=L.final)!=null?Xe:lt.final}),ot=R(()=>{const Be=je.value;return Ne.value&&Be!=null?!!Be&&re.caughtUp.value:Be});let Ve=0,Ye=!1;function nt(){Ve=0,Ye=!1}return Je([()=>L.content,()=>L.nodes,Ne,je],([Be,Xe,lt,rt])=>{if(Xe?.length)return nt(),void re.reset("");const wt=Be??"";if(!lt)return nt(),re.reset(wt),void(rt&&re.finish({flush:!0}));const dt=re.source.value;if(wt){if(wt!==dt)if(wt.startsWith(dt)){const Ft=wt.slice(dt.length),Ht=re.pendingChars.value;Ft.length<=8?(Ve++,Ye||Ve>=2&&Ht<=8?(Ye=!0,re.reset(wt)):re.enqueue(Ft)):(nt(),re.enqueue(Ft))}else nt(),re.reset(wt)}else nt(),re.reset("");rt&&re.finish()},{immediate:!0}),{smoothStream:re,smoothStreamingEligible:ae,smoothStreamingEnabled:Ne,renderContent:De,requestedFinal:je,effectiveFinal:ot}})(I,{isClient:G,inheritedSmoothStreaming:Q}),Ge=Fe.value===!0;Ln("markstreamSmoothStreaming",Ee);const at=Z(!1),Tt=Z(!1),Bt=Z(!1);let Yt="",Sn=!1,on=null;function en(){G&&on!=null&&(window.clearTimeout(on),on=null)}function Cn(){at.value=!1,en()}function Mn(L,q){if(!fe.value)return;const re=(function(){if(!fe.value)return null;const ae=gt(We),be=gt(tt),Ne=Math.max(Lt,be);if(ae<=0&&Ne<=0)return null;const De={total:ae,maxPerFrame:Ne,byLabel:(je=We,Object.fromEntries(Array.from(je.entries()).sort((ot,Ve)=>Ve[1]-ot[1]||ot[0].localeCompare(Ve[0]))))};var je;return We.clear(),tt.clear(),Lt=0,De})();console.info(`[markstream-vue][perf] ${L}`,re?rn(mt({},q),{layoutReads:re}):q)}Je([()=>I.indexKey,()=>I.customId],()=>{var L,q;Cn(),Tt.value=!1,Bt.value=!((L=o.nodes)!=null&&L.length)&&Fe.value!==!0&&!!o.content,Yt=(q=it.value)!=null?q:"",Sn=Yt.length>0},{flush:"sync"}),Je([()=>o.content,()=>o.nodes,Fe],([L,q,re])=>{!q?.length&&re!==!0&&L&&(Bt.value=!0)},{flush:"sync",immediate:!0}),Je([it,()=>o.nodes,Fe],([L,q,re])=>{const ae=L??"";return q?.length||re===!0?(Cn(),Tt.value=!1,Yt=ae,void(Sn=!0)):(ae.length>0&&(Bt.value=!0),Sn?(Yt&&ae.length>Yt.length&&ae.startsWith(Yt)?(at.value=!0,Tt.value=!0,G&&(en(),on=window.setTimeout(()=>{var be;on=null,Oe.value===!0||(be=o.nodes)!=null&&be.length||(qc(),at.value=!1,Ol())},1200))):(ae.length"u")return null;const Ne=window;if(Ne.__markstreamLayoutReadPerformance)return Ne.__markstreamLayoutReadPerformance;const De={total:0,maxPerFrame:0,byLabel:{}};return Ne.__markstreamLayoutReadPerformance=De,De})();be&&(be.total=Number(be.total||0)+1,be.byLabel[ae]=Number(be.byLabel[ae]||0)+1,be.currentFrameTotal=Number(be.currentFrameTotal||0)+1,be.frameScheduled||(be.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>yn(be),0):queueMicrotask(()=>yn(be)):window.requestAnimationFrame(()=>yn(be))))})(L),Ue||(Ue=!0,G&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(wn):typeof queueMicrotask!="function"?setTimeout(wn,0):queueMicrotask(wn)))}function qt(L,q){return go(L),q()}const ps=I.customId?`renderer-${I.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,xs=(function(L){const q=new Map;return{scope:L,cache:q,clear:()=>q.clear()}})(ps),_n=ps;Ln(A$,xs);const In=fs(()=>I.customId),{effectiveCustomHtmlTagsSet:To,mergedParseOptions:lo,parsedNodes:St,getParsedNodesDirtyStartIndex:hs,getParsedNodesRevision:Jo}=Qfe(I,{instanceMsgId:ps,renderContent:it,effectiveFinal:Oe,smoothStreamingEnabled:Ee,debugPerformanceEnabled:fe,customComponentsMap:In,logPerf:Mn});Je(St,()=>{at.value||xs.clear(),ie.value+=1},{immediate:!0});const uo=R(()=>({customId:I.customId,customHtmlTags:lo.value.customHtmlTags,parseOptions:I.parseOptions,customMarkdownIt:I.customMarkdownIt,htmlPolicy:ge.value,viewportPriority:I.viewportPriority,viewportPriorityOptions:de.value,mode:c.value,domMode:I.domMode,codeRenderer:m.value,codeBlockStream:I.codeBlockStream,codeBlockDarkTheme:I.codeBlockDarkTheme,codeBlockLightTheme:I.codeBlockLightTheme,codeBlockMonacoOptions:I.codeBlockMonacoOptions,renderCodeBlocksAsPre:I.renderCodeBlocksAsPre,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockProps:I.codeBlockProps,mermaidProps:I.mermaidProps,d2Props:I.d2Props,infographicProps:I.infographicProps,showTooltips:we.value,themes:I.themes,langs:I.langs,isDark:I.isDark,typewriter:f.value,smoothStreamingOptions:I.smoothStreamingOptions,parseCoalesceMs:I.parseCoalesceMs,fade:I.fade}));Ln("markstreamNestedRendererProps",uo);const Ys=R(()=>St.value),Nn=R(()=>St.value.length),no=Z(null),$s=Z(null),Xs=Z(null),ci=Z(null),Oo=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),vo=!Oo&&I.customId?G_(I.customId):null,Po=R(()=>vo?(o4.value,G_(I.customId)):null),co=R(()=>{var L;return!!(!Y.value&&I.customId&&!Oo&&((L=Po.value)!=null&&L.enabled))}),Tn=R(()=>!!(G&&co.value)),fo=R(()=>{var L;return!!(!Y.value&&((L=o.virtualScroll)!=null&&L.enabled))}),Qe=R(()=>fo.value),st=Z(!1);dn(()=>{st.value=!0});const Ct=R(()=>!!(G&&fo.value));Ln("markstreamHostScrollManaged",Ct);const Qt=R(()=>!!(st.value&&Ct.value)),kn=R(()=>Tn.value||Ct.value),Ko=R(()=>Tn.value||Qt.value),Eo=R(()=>{var L;return kn.value&&((L=Po.value)==null?void 0:L.textEstimation)!==!1});function bo(){const L=ne.value||qt("getMeasuredContainerWidth.clientWidth",()=>{var q;return((q=O.value)==null?void 0:q.clientWidth)||0});return Number.isFinite(L)&&L>0?L:0}const Ns=R(()=>{const L=bo();return L>0?Math.max(1,Math.round(L)):640}),Do=R(()=>{var L,q;return!(Oe.value!==!0||fo.value||c.value!=="chat"&&c.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(L=o.nodes)!=null&&L.length||Bt.value||!(((q=I.maxLiveNodes)!=null?q:0)<=0))}),Io=R(()=>{var L;return Do.value?50:Math.max(1,(L=I.maxLiveNodes)!=null?L:320)}),Qo=R(()=>{var L;return Do.value?16:Math.max(0,(L=I.liveNodeBuffer)!=null?L:60)}),sn=R(()=>{var L;return!Y.value&&I.nodeVirtual!==!1&&!(((L=I.maxLiveNodes)!=null?L:0)<=0&&!Do.value)&&(I.nodeVirtual===!0?St.value.length>0:St.value.length>Io.value)}),es=R(()=>sn.value||Tn.value||Ct.value),ms=R(()=>I.viewportPriority!==!1),Tr=R(()=>!!ms.value&&!K.value);var ts;ts=R(()=>ms.value),Ln(k$,ts);const Ki=R(()=>{var L;return!(Y.value||I.deferNodesUntilVisible===!1||((L=I.maxLiveNodes)!=null?L:0)<=0||sn.value||St.value.length>900||I.viewportPriority===!1)}),Js=Nde(L=>{var q;return ce((q=L??O.value)!=null?q:null)},ms),{requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,isTestEnv:Zi}=(function(L){const q=L.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,re=L.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,ae=L.isClient&&typeof window.requestIdleCallback=="function",be=(function(){var Ne;if(typeof globalThis>"u"||!("process"in globalThis))return;const De=(Ne=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:Ne.value;return De?.env})();return{requestFrame:q,cancelFrame:re,hasIdleCallback:ae,isTestEnv:be?.NODE_ENV==="test"}})({isClient:G}),tl=R(()=>Oe.value===!0&&!fo.value),{resolvedBatchSize:Ho,resolvedInitialBatch:Co,batchingEnabled:Fs,incrementalRenderingActive:Rs,renderedCount:yo,previousRenderContext:ht,adaptiveBatchSize:Le,previousBatchConfig:Ze}=(function(L,q){var re;const ae=R(()=>{var nt;const Be=Math.trunc((nt=L.renderBatchSize)!=null?nt:80);return Number.isFinite(Be)?Math.max(0,Be):0}),be=R(()=>{var nt;const Be=Math.trunc((nt=L.initialRenderBatchSize)!=null?nt:ae.value);return Number.isFinite(Be)?Math.max(0,Be):ae.value}),Ne=R(()=>!q.renderAsFragment.value&&L.batchRendering!==!1&&ae.value>0&&q.isClient&&!q.isTestEnv),De=Z(0),je=Z({key:L.indexKey,total:0}),ot=Z(Math.max(1,ae.value||1)),Ve=R(()=>{var nt,Be,Xe;return Ne.value&&!((nt=q.continuousStreaming)!=null&&nt.value)&&!((Be=q.forceFullRenderFinalContent)!=null&&Be.value)&&((Xe=L.maxLiveNodes)!=null?Xe:0)<=0}),Ye=Z({batchSize:ae.value,initial:be.value,delay:(re=L.renderBatchDelay)!=null?re:16,enabled:Ve.value});return{resolvedBatchSize:ae,resolvedInitialBatch:be,batchingEnabled:Ne,incrementalRenderingActive:Ve,renderedCount:De,previousRenderContext:je,adaptiveBatchSize:ot,previousBatchConfig:Ye}})(I,{isClient:G,isTestEnv:Zi,renderAsFragment:Y,forceFullRenderFinalContent:tl,continuousStreaming:R(()=>Tt.value&&Oe.value!==!0)}),Xt=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&!Zi&&((L=I.maxLiveNodes)!=null?L:0)<=0&&!tl.value}),gs=R(()=>Xt.value),di=R(()=>kn.value||gs.value),Ei=R(()=>{var L;return di.value&&((L=Po.value)==null?void 0:L.codeBlockEstimation)!==!1}),ao=new Map,Gi=new Map,Er=new WeakMap;let fi=null;const Ll=new WeakMap,zo=new Map,Ir=[];let Qs=[],pi=[],se=-1;const xe=Xr(Ir),J=new Set,Ce=Z(0);let $e=0;const He=Z(0),vt=R(()=>(He.value,Array.from(ao.entries()).sort((L,q)=>L[0]-q[0]))),ut=Z(null),Dt=Z(null);let Et,ln=null,oo=0,Ot=null;function Pt(){Et.markFallbackHeightPrefixDirty()}function Yn(L){return Et.getFallbackNodeHeight(L)}function ko(L,q){return Et.estimateHeightRange(L,q)}function vs(L){return Et.estimateIndexForOffset(L)}const{activeRestoreAnchor:Os,getRelativeScrollTopWithinContainer:ei,setRelativeScrollTopWithinContainer:Lc,resolveAnchorOffset:U2,clearRestoreReconcile:$c,scheduleRestoreReconcile:yu,captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2}=(function(L){const{isClient:q,containerRef:re,parsedNodeCount:ae,requestFrame:be,cancelFrame:Ne,resolveScrollContainer:De,getNormalizedScrollTop:je,getOffsetTopWithinRoot:ot,isReverseFlexScrollRoot:Ve,estimateIndexForOffset:Ye,estimateHeightRange:nt,getFallbackNodeHeight:Be,clamp:Xe}=L,lt=Z(null);let rt=null,wt=[];function dt(){const Kt=De(),fn=re.value;if(!Kt||!fn)return null;const vn=Kt.ownerDocument||fn.ownerDocument||document;if(Kt===vn.documentElement||Kt===vn.body||Kt===vn.scrollingElement){const Qn=fn.getBoundingClientRect();return Math.max(0,-Qn.top)}return Math.max(0,je(Kt,vn,!1)-ot(fn,Kt))}function Ft(Kt){var fn;const vn=De(),Qn=re.value;if(!vn||!Qn)return;const Hs=Math.max(0,Kt),Ss=vn.ownerDocument||Qn.ownerDocument||document,$r=Ss.defaultView||(typeof window<"u"?window:null);if(vn===Ss.documentElement||vn===Ss.body||vn===Ss.scrollingElement){const il=je(vn,Ss,!0)+Qn.getBoundingClientRect().top;return void((fn=$r?.scrollTo)==null||fn.call($r,0,Math.max(0,il+Hs)))}J_(vn,Ss,ot(Qn,vn)+Hs,{isReverseFlexScrollRoot:il=>{var K1;return(K1=Ve?.(il))!=null&&K1},getNormalizedScrollTop:je})}function Ht(Kt){const fn=ae.value,vn=Xe(Kt.nodeIndex,0,Math.max(0,fn-1));return nt(0,vn)+Math.max(0,Kt.offsetWithinNodePx)}function Vt(){if(rt!=null&&(Ne?.(rt),rt=null),q)for(const Kt of wt)window.clearTimeout(Kt);wt=[]}function Wt(Kt){const fn=Ht(Kt),vn=dt();vn!=null&&Math.abs(vn-fn)<=.5||Ft(fn)}return{activeRestoreAnchor:lt,getRelativeScrollTopWithinContainer:dt,setRelativeScrollTopWithinContainer:Ft,resolveAnchorOffset:Ht,clearRestoreReconcile:Vt,applyRestoreAnchor:Wt,scheduleRestoreReconcile:function(){lt.value&&q&&rt==null&&(rt=be?be(()=>{rt=null,lt.value&&Wt(lt.value)}):null,rt==null&<.value&&Wt(lt.value))},captureRestoreAnchor:function(){const Kt=dt(),fn=ae.value;if(Kt==null||fn<=0)return null;const vn=Xe(Ye(Kt+1),0,fn-1),Qn=nt(0,vn),Hs=Be(vn);return{nodeIndex:vn,offsetWithinNodePx:Xe(Kt-Qn,0,Math.max(0,Hs-1))}},restoreAnchor:function(Kt){const fn=ae.value;if(lt.value={nodeIndex:Xe(Kt.nodeIndex,0,Math.max(0,fn-1)),offsetWithinNodePx:Math.max(0,Kt.offsetWithinNodePx)},Vt(),Wt(lt.value),q)for(const vn of[0,120,280,480])wt.push(window.setTimeout(()=>{lt.value&&Wt(lt.value)},vn))},getAnchorDrift:function(Kt){const fn=dt();return fn==null?null:fn-Ht(Kt)}}})({isClient:G,containerRef:O,parsedNodeCount:Nn,requestFrame:Bo,cancelFrame:Zo,resolveScrollContainer:()=>ut.value||ue(),getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e,isReverseFlexScrollRoot:Se,estimateIndexForOffset:vs,estimateHeightRange:ko,getFallbackNodeHeight:Yn,clamp:Bs}),{nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,resetHeightMeasurements:c0,pruneHeightMeasurements:d0,rebuildHeightTrees:Rc,recordNodeHeight:V2,removeNodeHeights:q2,exportHeightCache:ke,importHeightCache:Ae,fenwickRangeSum:Ke}=(function(L={}){const q=Go({}),re=Go({total:0,count:0}),ae=Z(0),be=Z([]),Ne=Z([]);function De(){for(const Be of Object.keys(q))delete q[Number(Be)];re.total=0,re.count=0,ae.value=0,be.value=[],Ne.value=[]}function je(Be,Xe,lt){for(let rt=Xe+1;rt0;rt-=rt&-rt)lt+=Be[rt];return lt}function Ve(Be){ae.value=Be;const Xe=new Array(Be+1).fill(0),lt=new Array(Be+1).fill(0);for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0||(je(Xe,dt,Ft),je(lt,dt,1))}be.value=Xe,Ne.value=lt}function Ye(Be){if(!Number.isInteger(Be)||Be<0)return!1;const Xe=q[Be];if(!Number.isFinite(Xe)||Xe<=0)return!1;if(delete q[Be],re.total=Math.max(0,re.total-Xe),re.count=Math.max(0,re.count-1),ae.value>Be){const lt=be.value,rt=Ne.value;lt.length&&rt.length&&(je(lt,Be,-Xe),je(rt,Be,-1))}return!0}const nt=R(()=>re.count>0?Math.max(12,re.total/re.count):32);return{nodeHeights:q,heightStats:re,heightTreeSize:ae,heightSumTree:be,heightKnownTree:Ne,averageNodeHeight:nt,resetHeightMeasurements:De,pruneHeightMeasurements:function(Be){if(Be<=0)return void De();let Xe=0,lt=0;for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0?delete q[dt]:(Xe+=Ft,lt++)}re.total=Xe,re.count=lt},rebuildHeightTrees:Ve,recordNodeHeight:function(Be,Xe,lt={}){(function(rt,wt,dt={}){var Ft;if(!Number.isFinite(wt)||wt<=0)return!1;const Ht=q[rt];if(Ht&&(dt.allowShrink===!1&&wtrt){const Vt=be.value,Wt=Ne.value;if(Vt.length&&Wt.length)if(Ht){const Kt=wt-Ht;Kt!==0&&je(Vt,rt,Kt)}else je(Vt,rt,wt),je(Wt,rt,1)}dt.notify!==!1&&((Ft=L.onHeightRecorded)==null||Ft.call(L))})(Be,Xe,rn(mt({},lt),{notify:!0}))},removeNodeHeight:function(Be,Xe={}){var lt;const rt=Ye(Be);return rt&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},removeNodeHeights:function(Be,Xe={}){var lt;let rt=0;for(const wt of Be)Ye(Number(wt))&&rt++;return rt>0&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},exportHeightCache:function(){return Object.entries(q).map(([Be,Xe])=>({index:Number(Be),height:Number(Xe)})).filter(Be=>Number.isFinite(Be.index)&&Be.index>=0&&Number.isFinite(Be.height)&&Be.height>0).sort((Be,Xe)=>Be.index-Xe.index)},importHeightCache:function(Be,Xe={}){var lt;if(!Array.isArray(Be))return;const rt=ae.value;let wt=!1;if(Xe.mode!=="merge"){const dt=Object.keys(q);if(dt.length>0){for(const Ft of dt)delete q[Number(Ft)];wt=!0}}for(const dt of Be){const Ft=Number(dt.index),Ht=Number(dt.height);if(!Number.isInteger(Ft)||Ft<0||rt>0&&Ft>=rt||!Number.isFinite(Ht)||Ht<=0)continue;const Vt=q[Ft];Vt&&Math.abs(Vt-Ht)<=1||(q[Ft]=Ht,wt=!0)}wt&&((function(){let dt=0,Ft=0;const Ht=ae.value;for(const[Vt,Wt]of Object.entries(q)){const Kt=Number(Vt),fn=Number(Wt);!Number.isFinite(Kt)||Kt<0||Ht>0&&Kt>=Ht||!Number.isFinite(fn)||fn<=0?delete q[Kt]:(dt+=fn,Ft++)}re.total=dt,re.count=Ft})(),rt>0&&Ve(rt),(lt=L.onHeightRecorded)==null||lt.call(L))},fenwickRangeSum:function(Be,Xe,lt){if(lt<=Xe)return 0;const rt=ot(Be,lt-1);return Xe<=0?rt:rt-ot(Be,Xe-1)}}})({onHeightRecorded:()=>{Pt(),Ct.value&&z1(),Os.value&&yu(),Dt.value&&Uc(),po("node-resize")}});function Mt(L){Number.isInteger(L)&&L>=0&&J.add(L)}function Gt(L){for(const q of L)Mt(Number(q))}function an(L){$e++;let q=!0;try{const re=L();return q=re!==!1,re}finally{$e--,$e===0&&q&&Ce.value++}}function Fn(){Qs=[],pi=[],se=-1,J.clear(),xe.value=Ir}function so(){Fn(),an(()=>c0()),zo.clear()}function Ps(L){!Number.isInteger(L)||L<0||L>=St.value.length||zo.set(L,I1(L))}function ku(L,q,re={}){const ae=$l[L];Mt(L),V2(L,q,re);const be=$l[L];return Object.is(ae,be)?(J.delete(L),!1):(be&&be>0?Ps(L):ae&&zo.delete(L),!0)}function A1(L,q){const re=qt("getNodeLayoutHeight.slot.offsetHeight",()=>{var ae,be;return(be=(ae=ao.get(L))==null?void 0:ae.offsetHeight)!=null?be:0});return re>0?re:qt("getNodeLayoutHeight.content.offsetHeight",()=>q.offsetHeight)}function a6(L,q={}){q.mode!=="merge"?Fn():Gt(L.map(re=>re.index)),an(()=>Ae(L,q)),bv()}const nl=R(()=>Ki.value&&Tr.value),wF=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&((L=I.maxLiveNodes)!=null?L:0)<=0}),_F=R(()=>!Y.value&&Ge&&Oe.value===!0&&!sn.value&&!fo.value&&!co.value&&!nl.value&&!wF.value),u6=R(()=>!!Js&&nl.value),c6=R(()=>sn.value||Ct.value),{focusIndex:Nl,liveRange:Ds,updateLiveRange:M1}=(function(L,q){const{parsedNodeCount:re,virtualizationEnabled:ae,maxLiveNodesResolved:be,liveNodeBufferResolved:Ne,clamp:De}=q,je=Ne??R(()=>{var Ye;return Math.max(0,(Ye=L.liveNodeBuffer)!=null?Ye:60)}),ot=Z(0),Ve=Go({start:0,end:0});return{liveNodeBufferResolved:je,focusIndex:ot,liveRange:Ve,updateLiveRange:function(){const Ye=re.value;if(!ae.value||Ye===0)return Ve.start=0,void(Ve.end=Ye);const nt=Math.min(be.value,Ye),Be=je.value,Xe=De(ot.value-Be,0,Math.max(0,Ye-nt));Ve.start=Xe,Ve.end=Math.min(Ye,Xe+nt)}}})(I,{parsedNodeCount:Nn,virtualizationEnabled:sn,maxLiveNodesResolved:Io,liveNodeBufferResolved:Qo,clamp:Bs}),ol=new Map,bu=new Map,da=new Map,f0=[],Fl=new Map,fa=new Set,d6=Z(0);let K2=!1;const f6=R(()=>(d6.value,fa.size)),Yi=new Map,sl=new Map,p6=Z(0),Z2=R(()=>{p6.value;let L=0;for(const q of Yi.values())L+=Math.max(0,q);return L});let Xi=null;const p0=R(()=>{if(!sn.value)return St.value.length;const L=Qo.value,q=Math.max(Ds.end+L,Co.value),re=Math.min(St.value.length,q);return Math.max(yo.value,re)});function h0(){K2||(K2=!0,queueMicrotask(()=>{K2=!1,d6.value+=1}))}function h6(L,q,re="node-resize"){if(!G||typeof window>"u")return null;const ae=window.setTimeout(()=>{fa.delete(ae)&&h0();try{q()}finally{po(re)}},Math.max(0,L));return fa.add(ae),h0(),ae}function m0(L){G&&L!=null&&(fa.delete(L)&&h0(),window.clearTimeout(L))}function m6(){if(G&&typeof window<"u")for(const L of fa)window.clearTimeout(L);fa.size&&(fa.clear(),h0()),f0.length=0,da.clear()}function xF(L){F.value=L}function SF(L){U.value=L}function AF(L){z.value=L}const{cancelScheduledFocusSync:G2,scheduleFocusSync:Lr}=(function(L){const{isClient:q,containerRef:re,virtualizationEnabled:ae,requestFrame:be,cancelFrame:Ne,syncFocusToScroll:De}=L;let je=null;function ot(){var Ye,nt,Be;return(Be=(nt=(Ye=re.value)==null?void 0:Ye.ownerDocument)==null?void 0:nt.defaultView)!=null?Be:typeof window<"u"?window:null}function Ve(){if(!je)return;const Ye=ot();je.viaTimeout?Ye?Ye.clearTimeout(je.id):clearTimeout(je.id):Ne?.(je.id),je=null}return{cancelScheduledFocusSync:Ve,scheduleFocusSync:function(Ye={}){if(!ae.value)return;if(!q)return void De(!0);if(Ye.immediate)return Ve(),void De(!0);if(je)return;const nt=()=>{je=null,De()};if(be)return void(je={id:be(nt),viaTimeout:!1});const Be=ot();je={id:Be?Be.setTimeout(nt,16):setTimeout(nt,16),viaTimeout:!0}}}})({isClient:G,containerRef:O,virtualizationEnabled:sn,requestFrame:Bo,cancelFrame:Zo,syncFocusToScroll:function(L=!1){var q;if(!sn.value)return;const re=ut.value||ue();if(!re)return;const ae=re.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,be=ae?.defaultView||(typeof window<"u"?window:null),Ne=re===ae?.documentElement||re===ae?.body,De=St.value.length;if(De<=0)return;if(!Ne&&De>0&&Se(re)){const rt=qt("syncFocusToScroll.clientHeight",()=>re.clientHeight||0),wt=qt("syncFocusToScroll.scrollTop",()=>re.scrollTop),dt=wt<0?-wt:wt;return void y0(Bs((je=Math.max(0,dt)+.5*Math.max(0,rt),Et.estimateIndexForOffsetFromEnd(je)),0,Math.max(0,De-1)),L)}var je;const ot=(function(rt,wt,dt,Ft){const Ht=O.value;if(!Ht)return null;const Vt=Ft?0:qt("syncFocusToScroll.model.root.getBoundingClientRect",()=>rt.getBoundingClientRect().top),Wt=qt("syncFocusToScroll.model.container.getBoundingClientRect",()=>Ht.getBoundingClientRect().top),Kt=Math.max(0,Vt-Wt),fn=Ft?qt("syncFocusToScroll.model.viewport.clientHeight",()=>{var vn,Qn,Hs,Ss;return(Ss=(Hs=(Qn=dt?.innerHeight)!=null?Qn:(vn=wt.documentElement)==null?void 0:vn.clientHeight)!=null?Hs:rt.clientHeight)!=null?Ss:0}):qt("syncFocusToScroll.model.root.clientHeight",()=>rt.clientHeight);return Bs(vs(Kt+.5*Math.max(0,fn)),0,Math.max(0,St.value.length-1))})(re,ae,be,Ne);if(ot!=null)return void y0(ot,L);const Ve=Ne?null:qt("syncFocusToScroll.root.getBoundingClientRect",()=>re.getBoundingClientRect()),Ye=Ne?0:Ve.top,nt=Ne?qt("syncFocusToScroll.viewport.clientHeight",()=>{var rt,wt;return(wt=(rt=be?.innerHeight)!=null?rt:re.clientHeight)!=null?wt:0}):Ve.bottom,Be=vt.value;let Xe=null,lt=null;for(const[rt,wt]of Be){if(!wt)continue;const dt=qt("syncFocusToScroll.slot.getBoundingClientRect",()=>wt.getBoundingClientRect());dt.bottom<=Ye||dt.top>=nt||(Xe==null&&(Xe=rt),lt=rt)}if(Xe==null||lt==null){const rt=O.value;if(!rt)return;const wt=Ne?{top:0}:qt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>re.getBoundingClientRect()),dt=qt("syncFocusToScroll.fallback.scrollTop",()=>ze(re,ae,Ne)),Ft=Ne?(()=>{const Vt=qt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>rt.getBoundingClientRect()),Wt=(Ne?0:wt.top)-Vt.top;return Math.max(0,Wt)})():(()=>{const Vt=_e(rt,re);return Math.max(0,dt-Vt)})(),Ht=Ne?qt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var Vt,Wt,Kt,fn;return(fn=(Kt=(Wt=be?.innerHeight)!=null?Wt:(Vt=ae?.documentElement)==null?void 0:Vt.clientHeight)!=null?Kt:re.clientHeight)!=null?fn:0}):qt("syncFocusToScroll.fallback.root.clientHeight",()=>re.clientHeight);return void y0(Bs(vs(Ft+.5*Math.max(0,Ht)),0,Math.max(0,St.value.length-1)),!0)}y0(Math.round((Xe+lt)/2),L)}}),{visibleNodeIndices:Y2,nodeVisibilityHandles:Oc,nodeVisibilityWatchStops:g0,nodeVisibilityFallbackTimers:g6,clearVisibilityFallback:v0,markNodeVisible:pa,cleanupNodeVisibility:MF,destroyNodeVisibilityState:X2}=epe({isClient:G,shouldTrackVisibleNodeIndices:()=>nl.value,shouldCleanupNodeVisibility:()=>sn.value,onNodeMarkedVisible:L=>{sn.value?Lr():Nl.value=Bs(L,0,Math.max(0,St.value.length-1))},onNodeVisibilityCleaned:L=>{ao.delete(L)&&j6()}}),{cleanupScrollListener:v6,setupScrollListener:TF}=(function(L){const{isClient:q,virtualizationEnabled:re,listenerEnabled:ae,scrollRootElement:be,resolveScrollContainer:Ne,scheduleFocusSync:De,onScroll:je}=L;let ot=null,Ve=null;function Ye(){ot&&(ot(),ot=null),Ve=null,be.value=null}function nt(Be){const Xe=L.getScrollTop?L.getScrollTop(Be):Be.scrollTop;return Math.max(0,Number.isFinite(Xe)?Math.abs(Xe):0)}return{cleanupScrollListener:Ye,setupScrollListener:function(){if(!q)return;if(!((Be=ae?.value)!=null?Be:re.value))return void Ye();var Be;const Xe=Ne();if(!Xe)return void Ye();if(be.value===Xe&&ot)return;Ye(),Ve=nt(Xe);const lt=()=>{if(je?.(),re.value){const rt=(function(wt){const dt=nt(wt),Ft=Ve;Ve=dt;const Ht=Math.max(480,.75*(wt.clientHeight||0));return Ft==null?dt>Ht?{immediate:!0}:void 0:Math.abs(dt-Ft)>Ht?{immediate:!0}:void 0})(Xe);rt?De(rt):De()}};Xe.addEventListener("scroll",lt,{passive:!0}),be.value=Xe,ot=()=>{Xe.removeEventListener("scroll",lt)}}}})({isClient:G,virtualizationEnabled:sn,listenerEnabled:c6,scrollRootElement:ut,resolveScrollContainer:ue,scheduleFocusSync:Lr,onScroll:function(){const L=Dt.value;if(!L)return;const q=E1();if(!q||(function(ae){if(R1()>=oo)return Ot=null,!1;const be=Ot;if(be==null)return!0;const Ne=Math.abs(ae.scrollTop-be)<=2;return Ne||(Ot=null),Ne})(q))return;const re=$6(q);re!=null?(re<-32||Math.abs(Math.max(0,re)-Math.max(0,L.distanceFromBottomPx))>32)&&Wc("restore"):Wc("restore")},getScrollTop:L=>{var q;const re=L.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement;return qt("scrollListener.getScrollTop",()=>ze(L,re,ae))}});function y0(L,q=!1){const re=Bs(L,0,Math.max(0,St.value.length-1));!q&&Math.abs(re-Nl.value)<=1||(Nl.value=re,M1())}function Bs(L,q,re){return Math.min(Math.max(L,q),re)}function J2(L=St.value.length){const q=hs();return!Number.isInteger(q)||q<0?L:Bs(q,0,L)}function Q2(L){return L?.firstElementChild}function y6(L,q){var re;return L?(re=L.matches)!=null&&re.call(L,q)?L:L.querySelector(q):null}function EF(L,q){L<1||L>6||(W[L]=q)}function k6(){if(!kn.value)return void(ne.value=0);const L=qt("updateExperimentContainerWidth.clientWidth",()=>{var q,re;return(re=(q=O.value)==null?void 0:q.clientWidth)!=null?re:0});ne.value=L>0?L:0}let T1=null;function ev(){T1?.disconnect(),T1=null}const b6=Af("ViewportDeferredMarkdownCodeBlockNode",zr({loader:()=>mo(null,null,function*(){return(yield jo(()=>import("./index5-Cn2jfVMX.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:dg,delay:0,suspensible:!1}),dg);function C6(L){return L===b6}const w6=R(()=>m.value==="pre"?Pi:m.value==="shiki"?b6:X9);function _6(){var L;return((L=I.codeBlockProps)==null?void 0:L.showHeader)!==!1}function x6(L,q,re){const ae=$l[q],be=typeof ae=="number"&&ae>0;if(Eo.value&&!be&&!(function(Ne){return!!In.value.paragraph&&(Ne.type==="paragraph"||Ne.type==="list_item"||Ne.type==="list")})(L)){const Ne=S$(L,re,X.value);if(Ne)return Ne}if(Ei.value&&L.type==="code_block"){const Ne=(function(De){if(De.type!=="code_block")return null;const je=n7(De,T0(De));return C6(je)?"markdown":je===Pi?"pre":je===w6.value||je===X9?"monaco":null})(L);if(Ne==="monaco"||Ne==="markdown"||Ne==="pre")return(function(De,je){var ot,Ve,Ye;if(!De||De.type!=="code_block")return null;const nt=je.rendererKind,Be=nt!=="pre"&&je.showHeader!==!1,Xe=!!De.diff;let lt=0,rt=500;if(nt==="monaco"){const dt=(ot=je.monacoOptions)!=null?ot:{},Ft=r4(De,dt,je.width),Ht=(function(Wt){const Kt=typeof Wt?.fontSize=="number"&&Wt.fontSize>0?Wt.fontSize:12;return typeof Wt?.lineHeight=="number"&&Wt.lineHeight>0?Wt.lineHeight:Math.round(1.5*Kt)})(dt),Vt=(function(Wt,Kt){var fn,vn;const Qn=typeof((fn=Wt?.padding)==null?void 0:fn.top)=="number"?Wt.padding.top:Kt?0:8,Hs=typeof((vn=Wt?.padding)==null?void 0:vn.bottom)=="number"?Wt.padding.bottom:Kt?0:8;return Math.max(0,Qn)+Math.max(0,Hs)})(dt,Xe);rt=typeof dt.MAX_HEIGHT=="number"&&dt.MAX_HEIGHT>0?dt.MAX_HEIGHT:500,lt=Math.round(Ft*Ht+Vt)}else if(nt==="markdown"){const dt=r4(De);lt=Math.round(21*dt+32)}else{const dt=r4(De);lt=Math.round(28*dt),rt=Number.POSITIVE_INFINITY}const wt=Math.max(1,Math.min(lt,rt));return mt({kind:"code-block",height:Math.round(wt+(Be?40:0)),contentHeight:wt,rendererKind:nt},Xe&&nt==="monaco"?{diffInline:v5((Ve=je.monacoOptions)!=null?Ve:{},(Ye=je.width)!=null?Ye:0)}:{})})(L,{rendererKind:Ne,monacoOptions:I.codeBlockMonacoOptions,showHeader:_6(),width:re})}return null}I4(()=>{if(Ce.value,$e>0)return;const L=St.value,q=Jo();if(!L.length||!di.value)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const re=ne.value||qt("estimatedNodeHeights.clientWidth",()=>{var Ve;return((Ve=O.value)==null?void 0:Ve.clientWidth)||0});if(!Number.isFinite(re)||re<=0)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const ae=(function(Ve){return[Math.round(Ve),Eo.value,Ei.value,X.value,I.codeBlockMonacoOptions,_6(),m.value,In.value,o4.value]})(re),be=Qs.length<=L.length&&(De=ae,(Ne=pi).length===De.length&&Ne.every((Ve,Ye)=>Object.is(Ve,De[Ye])));var Ne,De;const je=be&&se===q?L.length:be?J2(L.length):0,ot=be?Array.from(J):[];Qs.length=L.length;for(let Ve=je;Ve=0&&Vexe.value);Et=(function(L){let q=!0,re=[0],ae="";function be(Ye){var nt;const Be=L.nodeHeights[Ye];if(Number.isFinite(Be)&&Be>0)return Be;const Xe=L.parsedNodes.value[Ye],lt=Xe?.type,rt=!!((nt=L.hasCustomParagraphComponent)!=null&&nt.call(L)),wt=L.estimatedNodeHeights.value[Ye],dt=wt?.height;if(!(function(Ht,Vt,Wt){return!!(Wt&&Vt?.kind==="simple-text"&&(Ht==="paragraph"||Ht==="list_item"||Ht==="list"))})(lt,wt,rt)&&Number.isFinite(dt)&&dt>0)return dt;const Ft=Wfe(Xe,L.getContainerWidth()||640);return lt==="heading"||lt==="paragraph"&&Ft<=28&&(function(Ht,Vt){if(Vt)return!1;const Wt=Ht.children;return!Array.isArray(Wt)||!Wt.length||Wt.every(M$)})(Xe,rt)?Ft:Math.max(L.averageNodeHeight.value,Ft)}function Ne(){var Ye;const nt=L.parsedNodes.value.length,Be=L.getPrefixCacheKeyParts().join(":");if(!q&&ae===Be)return re;const Xe=new Array(nt+1);Xe[0]=0;for(let lt=0;lt=((nt=lt[Xe])!=null?nt:0))return Xe-1;let rt=0,wt=Xe-1,dt=Xe-1;for(;rt<=wt;){const Ft=rt+wt>>1;((Be=lt[Ft+1])!=null?Be:0)>=Ye?(dt=Ft,wt=Ft-1):rt=Ft+1}return dt}function je(Ye,nt){var Be,Xe;if(Ye>=nt)return 0;if(L.heightEstimationActive.value)return(function(wt,dt){var Ft,Ht;const Vt=L.parsedNodes.value.length,Wt=tx(Math.trunc(wt),0,Vt),Kt=tx(Math.trunc(dt),Wt,Vt);if(Wt>=Kt)return 0;const fn=Ne();return((Ft=fn[Kt])!=null?Ft:0)-((Ht=fn[Wt])!=null?Ht:0)})(Ye,nt);if(L.heightTreeSize.value!==L.parsedNodes.value.length){let wt=0;for(let dt=Ye;dtWt<=0?0:L.fenwickRangeSum(rt,0,Wt)+(Wt-L.fenwickRangeSum(wt,0,Wt))*lt;let Ft=0,Ht=Be.length-1,Vt=Be.length-1;for(;Ft<=Ht;){const Wt=Ft+Ht>>1;dt(Wt+1)>=Ye?(Vt=Wt,Ht=Wt-1):Ft=Wt+1}return Vt}let Xe=Ye;for(let lt=0;lt0||Ye++}return Ye}return{markFallbackHeightPrefixDirty:function(){q=!0},getFallbackNodeHeight:be,estimateHeightRange:je,estimateIndexForOffset:ot,estimateIndexForOffsetFromEnd:function(Ye){var nt,Be;const Xe=L.parsedNodes.value;if(!Xe.length)return 0;if(Ye<=0)return Math.max(0,Xe.length-1);if(L.heightEstimationActive.value){const rt=(nt=Ne()[Xe.length])!=null?nt:0;return De(Math.max(0,rt-Ye))}if(L.heightTreeSize.value===Xe.length){const rt=je(0,Xe.length);return ot(Math.max(0,rt-Ye))}let lt=Ye;for(let rt=Xe.length-1;rt>=0;rt--){const wt=(Be=L.nodeHeights[rt])!=null?Be:L.averageNodeHeight.value;if(lt<=wt)return rt;lt-=wt}return 0},getEstimatedNodeHeightCount:Ve,buildVirtualHeightSummary:function(Ye){var nt;const Be=L.parsedNodes.value.length;return{totalNodes:Be,measuredCount:L.heightStats.count,estimatedCount:Ve(),averageNodeHeight:L.averageNodeHeight.value,topSpacerHeight:Ye.topSpacerHeight,bottomSpacerHeight:Ye.bottomSpacerHeight,estimatedTotalHeight:je(0,Be),width:(nt=Ye.width)!=null?nt:L.getContainerWidth()}}}})({parsedNodes:St,nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,heightEstimationActive:kn,estimatedNodeHeights:Pc,getContainerWidth:bo,hasCustomParagraphComponent:()=>!!In.value.paragraph,getPrefixCacheKeyParts:()=>{var L;const q=uf(ne.value||qt("getFallbackHeightPrefix.clientWidth",()=>{var ae;return((ae=O.value)==null?void 0:ae.clientWidth)||0})),re=((L=o.virtualScroll)==null?void 0:L.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[St.value.length,hi.count,Math.round(hi.total),Math.round(100*S1.value),re,q,kn.value?1:0,o4.value,ie.value,In.value.paragraph?1:0]},fenwickRangeSum:Ke}),Je(()=>St.value.length,L=>{var q;Pt(),L<=0?so():(Ld0(q))),L!==x1.value&&Rc(L))},{immediate:!0});const IF=R(()=>{if(!sn.value)return St.value.map((ae,be)=>({node:ae,index:be}));const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);return St.value.slice(q,re).map((ae,be)=>({node:ae,index:q+be}))}),tv=R(()=>sn.value?ko(0,Math.min(Ds.start,St.value.length)):0),nv=R(()=>{if(!sn.value)return 0;const L=St.value.length;return ko(Math.min(Ds.end,L),L)});function S6(){return Et.buildVirtualHeightSummary({topSpacerHeight:tv.value,bottomSpacerHeight:nv.value,width:Cu()})}function LF(){const L=St.value,q=S6();return rn(mt({},q),{probe:{paragraphReady:!!X.value.paragraph,listItemReady:!!X.value.listItem,listWrapperOverhead:X.value.listWrapperOverhead,headingReadyLevels:Object.entries(X.value.headings).filter(([,re])=>!!re).map(([re])=>Number(re))},nodes:L.map((re,ae)=>{var be,Ne,De,je,ot,Ve,Ye,nt,Be;return{index:ae,type:re.type,estimateKind:(Ne=(be=Pc.value[ae])==null?void 0:be.kind)!=null?Ne:null,rendererKind:(je=(De=Pc.value[ae])==null?void 0:De.rendererKind)!=null?je:null,estimatedHeight:(Ve=(ot=Pc.value[ae])==null?void 0:ot.height)!=null?Ve:null,estimatedContentHeight:(nt=(Ye=Pc.value[ae])==null?void 0:Ye.contentHeight)!=null?nt:null,measuredHeight:(Be=$l[ae])!=null?Be:null}})})}function ov(){return o.indexKey!=null?String(o.indexKey):fo.value?`virtual-${wo()}`:"markdown-renderer"}function A6(L){const q=String(L),re=`${ov()}-`;if(!q.startsWith(re))return null;const ae=q.slice(re.length).match(/^(\d+)(?:$|-)/);if(!ae)return null;const be=Number(ae[1]);return!Number.isInteger(be)||be<0||be>=St.value.length?null:be}function wo(){var L,q,re;const ae=(L=o.virtualScroll)==null?void 0:L.sessionKey;return String(ae!=null&&ae!==""?ae:(re=(q=o.indexKey)!=null?q:I.customId)!=null?re:ps)}function ns(){var L;const q=(L=o.virtualScroll)==null?void 0:L.threadKey;return q==null||q===""?void 0:String(q)}const $F=R(()=>{var L,q,re;return(re=ns())!=null?re:String((q=(L=o.indexKey)!=null?L:I.customId)!=null?q:ps)});function sv(L){var q;return(L??"")===((q=ns())!=null?q:"")}function Rl(){var L,q,re;return q=(L=o.virtualScroll)==null?void 0:L.measurementKey,re=(function(){const ae=m.value;return(function(be){var Ne,De;const je=be.renderer,ot=je==="monaco"?be.codeBlockMonacoOptions:void 0,Ve=be.codeBlockProps,Ye=je==="shiki";return[be.isDark?"dark":"light",je==="monaco"?"code-rich":je==="pre"?"code-pre":"code-shiki",be.codeBlockStream===!1?"code-static":"code-stream",As(be.codeBlockMinWidth),As(be.codeBlockMaxWidth),...Ye?[Lce((Ne=Ve?.themes)!=null?Ne:be.themes,(De=Ve?.langs)!=null?De:be.langs)]:[],As(ot?.fontSize),As(ot?.lineHeight),As(ot?.fontFamily),As(ot?.tabSize),As(ot?.MAX_HEIGHT),As(ot?.wordWrap),As(ot?.wrappingIndent),As(ot?.padding),As(Ve?.showHeader),As(Ve?.showCopyButton),As(Ve?.showExpandButton),As(Ve?.showPreviewButton),As(Ve?.showCollapseButton),As(Ve?.showFontSizeButtons)].join("\0")})({renderer:ae,isDark:I.isDark,codeBlockStream:I.codeBlockStream,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockMonacoOptions:ae==="monaco"?I.codeBlockMonacoOptions:void 0,codeBlockProps:I.codeBlockProps,themes:ae==="shiki"?I.themes:void 0,langs:ae==="shiki"?I.langs:void 0})})(),[q==null?"":String(q),re].join("\0")}function Cu(){return bo()}const k0=R(()=>uf(Cu())),Ji=R(()=>[Rl(),k0.value].join("\0")),NF=R(()=>{var L;return fo.value?["virtual",(L=ns())!=null?L:"",wo(),Ji.value].join("\0"):o.indexKey});function Dc(){p6.value+=1}function iv(L){return!(!L||!Number.isInteger(L.index)||L.index<0||L.index>=St.value.length||L.sessionKey!==wo()||L.threadKey!==ns()||L.layoutEpochKey!==Ji.value)}function M6(L){const q=String(L),re=sl.get(q);return re?iv(re)?re.index:null:A6(q)}function T6(L="async-node"){(Yi.size||sl.size)&&(Yi.clear(),sl.clear(),Dc(),po(L))}const Bc=nn(G3,null),rv={reportHeight(L,q){if(!Ct.value)return;const re=M6(L);if(re==null)return;const ae=ol.get(re);if(!ae)return;const be=Number(q),Ne=A1(re,ae);(function(De,je,ot={}){an(()=>ku(De,je,ot))})(re,Number.isFinite(be)&&be>0?Math.max(be,Ne||0):Ne)},markPending(L){if(!Ct.value)return;const q=A6(L);q!=null&&(function(re,ae){var be;const Ne=sl.get(re);if(Ne&&iv(Ne))return Yi.set(re,Math.max(0,(be=Yi.get(re))!=null?be:0)+1),Dc(),void po("async-node");Yi.set(re,1),sl.set(re,(function(De){return{index:De,sessionKey:wo(),threadKey:ns(),layoutEpochKey:Ji.value}})(ae)),Dc(),po("async-node")})(String(L),q)},markSettled(L){if(!Ct.value)return;const q=String(L),re=M6(L);(re!=null||(function(ae){return Yi.has(String(ae))})(q))&&(function(ae){var be;const Ne=(be=Yi.get(ae))!=null?be:0;return!(Ne<=0||(Ne<=1?(Yi.delete(ae),sl.delete(ae)):Yi.set(ae,Ne-1),Dc(),Ne===1&&po("async-node"),0))})(q)&&re!=null&&Ol()}};function FF(){let L=0;for(const q of ol.values())L+=qt("getVisibleDomHeight.offsetHeight",()=>{var re;return(re=q?.offsetHeight)!=null?re:0});return Math.ceil(Math.max(0,L))}Ln(G3,{reportHeight(L,q){rv.reportHeight(L,q),Bc?.reportHeight(L,q)},markPending(L){rv.markPending(L),Bc?.markPending(L)},markSettled(L){rv.markSettled(L),Bc?.markSettled(L)}});let lv,av=null,Hc=null;function b0(L){return L!==!1&&L!=null&&L!==""}function E6(){return sn.value?(function(){if(!sn.value)return!0;const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);if(q>=re)return!0;for(let ae=q;ae=p0.value}function uv(){return Oe.value===!0&&!at.value&&Z2.value===0&&fa.size===0&&Fl.size===0&&Xi==null&&E6()}function I6(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.settleMode)!=="manual"||av===wo()&&lv===ns())return!0;const re=(q=o.virtualScroll)==null?void 0:q.settledToken;return!!b0(re)&&Hc===W1(re)}function cv(){return uv()&&I6()}function RF(L,q){return q.totalNodes<=0?L==="final"?"final":"estimate":q.measuredCount>=q.totalNodes?L==="final"?"final":"measured":q.measuredCount>0||q.estimatedCount>0?"mixed":"estimate"}function wu(L="manual",q){const re=S6(),ae=(function(be){return be||(Oe.value!==!0?St.value.length>0?"streaming":"estimating":!E6()||Fl.size>0||Xi!=null?"measuring":cv()?"settled":"settling")})(q);return{sessionKey:wo(),threadKey:ns(),phase:ae,nodeCount:re.totalNodes,liveRange:{start:Ds.start,end:Ds.end},renderedCount:yo.value,measuredCount:re.measuredCount,estimatedCount:re.estimatedCount,averageNodeHeight:re.averageNodeHeight,topSpacerHeight:re.topSpacerHeight,bottomSpacerHeight:re.bottomSpacerHeight,visibleDomHeight:FF(),totalHeight:L6(),width:re.width,final:Oe.value===!0,stable:cv(),confidence:RF(ae,re),reason:L}}function E1(){const L=ut.value||ue(),q=O.value;if(!L||!q)return null;const re=L.ownerDocument||q.ownerDocument||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement,be=qt("getScrollBox.scrollTop",()=>ze(L,re,ae)),Ne=qt("getScrollBox.scrollHeight",()=>{var je,ot,Ve,Ye,nt;return ae?Math.max((ot=(je=re.documentElement)==null?void 0:je.scrollHeight)!=null?ot:0,(Ye=(Ve=re.body)==null?void 0:Ve.scrollHeight)!=null?Ye:0,(nt=L.scrollHeight)!=null?nt:0):L.scrollHeight}),De=qt("getScrollBox.clientHeight",()=>{var je;return ae?((je=re.documentElement)==null?void 0:je.clientHeight)||L.clientHeight||0:L.clientHeight});return{root:L,doc:re,isViewportRoot:ae,scrollTop:be,scrollHeight:Ne,clientHeight:De}}function L6(){const L=St.value.length,q=Math.max(0,ko(0,L)),re=qt("getRendererLogicalHeight.offsetHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.offsetHeight)!=null?Ne:0}),ae=Math.max(0,re>0?re:qt("getRendererLogicalHeight.scrollHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.scrollHeight)!=null?Ne:0}));return L<=0?Math.ceil(re):sn.value?q>0?Math.max(1,Math.ceil(q),(function(){let be=tv.value+nv.value;for(const Ne of ao.values())Ne&&(be+=Math.max(0,qt("getVirtualizedDomLogicalHeight.offsetHeight",()=>Ne.offsetHeight||0)));return Math.ceil(Math.max(0,be))})(),(function(be,Ne){return be<=0||Ne<=0?0:Ne<=be+Math.max(512,.05*be)?Math.ceil(Ne):0})(q,ae)):Math.max(1,Math.ceil(ae)):Ct.value?q>0||hi.count>0||Et.getEstimatedNodeHeightCount()>0?(Rs.value&&yo.value,Math.max(1,Math.ceil(ae),Math.ceil(q))):Math.ceil(ae):Math.max(1,Math.ceil(ae),Math.ceil(q))}function $6(L){const q=O.value;if(!q)return null;const re=qt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>q.getBoundingClientRect());return(function(be){return be.isViewportRoot?be.clientHeight:qt("getViewportBottomInRoot.getBoundingClientRect",()=>be.root.getBoundingClientRect().bottom)})(L)-re.bottom}function OF(L={}){const q=L.requireViewport!==!1,re=(function(Ne=64){const De=E1(),je=O.value;if(!De||!je)return!1;const ot=(function(Ye){if(Ye.isViewportRoot)return{top:0,bottom:Ye.clientHeight};const nt=qt("getVirtualViewportRect.getBoundingClientRect",()=>Ye.root.getBoundingClientRect());return{top:nt.top,bottom:nt.bottom}})(De),Ve=qt("isRendererNearVirtualViewport.getBoundingClientRect",()=>je.getBoundingClientRect());return Ve.bottom>=ot.top-Ne&&Ve.top<=ot.bottom+Ne})();if(q&&!re)return null;const ae=(function(){const Ne=E1(),De=O.value;if(!Ne||!De||Math.max(0,Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight)>64)return null;const je=$6(Ne);return je==null?null:je>=-8&&je<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,je)}:null})();if(ae)return{anchor:ae,captured:!0};const be=Nc();if(be)return{anchor:{type:"node",nodeIndex:be.nodeIndex,offsetWithinNodePx:be.offsetWithinNodePx},captured:re};if(L.allowFallback===!0){const Ne=(function(){const De=St.value.length;return De<=0?null:{type:"node",nodeIndex:Bs(Nl.value,0,Math.max(0,De-1)),offsetWithinNodePx:0}})();return Ne?{anchor:Ne,captured:!1}:null}return null}function dv(L){let q=2166136261;for(let re=0;re>>0).toString(36)}function PF(L,q){let re=L;for(let ae=0;ae8192?`${ae.slice(0,8192)}...${ae.length}`:ae;return`${ae.length}:${dv(be)}`})(L)}`;if(typeof L=="function")return"fn";if(typeof L!="object")return typeof L;if(q.has(L))return"cycle";if(re>=6)return"max-depth";q.add(L);try{if(Array.isArray(L)){if(L.length<=160){const Ve=[];for(let Ye=0;Ye=je&&De.push(Ye)}return[`a:${L.length}`,`h=${Ne.join(",")}`,`t=${De.join(",")}`,`all=${(ot>>>0).toString(36)}`].join(":")}const ae=L,be=Object.keys(ae).filter(Ne=>{const De=ae[Ne];return Ne!=="parent"&&Ne!=="el"&&Ne!=="component"&&(De==null||typeof De=="string"||typeof De=="number"||typeof De=="boolean"||DF.has(Ne))}).sort();return`o:${be.length}:${be.map(Ne=>`${Ne}=${C0(ae[Ne],q,re+1)}`).join(";")}`}finally{q.delete(L)}}let fv=-1,pv="",_u=[2166136261];function I1(L){const q=St.value[L];return q?dv(C0(q)):""}function BF(L,q){let re=L;for(let ae=0;ae>>0}function hv(){var L,q;const re=ie.value;if(fv===re)return pv;const ae=St.value.length;let be=J2(ae);(fv!==re-1||be>ae||_u.length>>0).toString(36),fv=re,pv}function zc(L,q={}){var re;const ae=q.includeHeightCache===!0,be=(re=q.includeContentHash)!=null?re:ae,Ne=ae?(function(je){const ot=(function(){var rt,wt;const dt=Number((wt=(rt=o.virtualScroll)==null?void 0:rt.heightCacheLimit)!=null?wt:5e3);return!Number.isFinite(dt)||dt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(dt))})();if(!Number.isFinite(ot)||je.length<=ot)return je;const Ve=new Map,Ye=rt=>{!rt||Ve.size>=ot||Ve.set(rt.index,rt)},nt=St.value.length,Be=Bs(Ds.start-2*Qo.value,0,nt),Xe=Bs(Ds.end+2*Qo.value,Be,nt);for(const rt of je)rt.index>=Be&&rt.index=0&&Ve.sizert.index-wt.index).slice(0,ot)})(ke().map(je=>{var ot;const Ve=St.value[je.index];return Ve?rn(mt({},je),{nodeType:String((ot=Ve.type)!=null?ot:""),signature:I1(je.index)}):null}).filter(je=>!!je)):[],De=OF({allowFallback:q.allowAnchorFallback===!0,requireViewport:q.requireViewport});return De||Ne.length||q.includeEmptyState===!0?rn(mt({sessionKey:L.sessionKey,threadKey:L.threadKey},De?{anchor:De.anchor,anchorCaptured:De.captured}:{anchorCaptured:!1}),{metrics:L,width:L.width,contentHash:be?hv():void 0,measurementKey:Rl()||void 0,heightCache:Ne.length?Ne:void 0}):null}function mv(L){var q,re;const ae=E1();if(!ae)return;const be=(function(je){const ot=O.value;if(!ot)return null;const Ve=_e(ot,je.root),Ye=St.value.length,nt=qt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>ot.offsetHeight||0),Be=Math.max(0,nt>0?nt:Ye>0?qt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>ot.scrollHeight||0):0),Xe=L6();return Ve+Math.max(Be,Xe)})(ae);if(be==null)return;const Ne=Math.max(0,L.distanceFromBottomPx),De=Math.max(0,be-ae.clientHeight-Ne);(function(je){oo=R1()+120,Ot=je})(De),ae.isViewportRoot?(re=(q=ae.doc.defaultView)==null?void 0:q.scrollTo)==null||re.call(q,0,De):J_(ae.root,ae.doc,De,{isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze})}const gv=[];function N6(){if(G)for(ln!=null&&(Zo?.(ln),ln=null);gv.length;){const L=gv.pop();L!=null&&window.clearTimeout(L)}}function Wc(L){const q=!!Dt.value;Dt.value=null,oo=0,Ot=null,N6(),q&&L&&po(L)}function Uc(){if(!Dt.value||!G||ln!=null)return;const L=()=>{ln=null;const q=Dt.value;q&&mv(q)};ln=Bo?Bo(L):null,ln==null&&L()}function F6(L,q={}){const re=St.value.length;return re<=0?[]:L.filter(ae=>!(!Number.isInteger(ae.index)||ae.index<0||ae.index>=re)&&!(!Number.isFinite(ae.height)||ae.height<=0)&&!(q.requireSignature&&!ae.signature)&&!(q.requireCompatibilityMetadata&&!ae.nodeType&&!ae.signature)&&(function(be){var Ne;const De=St.value[be.index];return!(!De||be.nodeType&&be.nodeType!==String((Ne=De.type)!=null?Ne:"")||be.signature&&be.signature!==I1(be.index))})(ae))}function R6(L){const q=uf(Cu()),re=uf(L);return q!==-1&&re!==-1&&q===re}function vv(L){var q;const re=Number(L?.width);if(Number.isFinite(re)&&re>0)return re;const ae=Number((q=L?.metrics)==null?void 0:q.width);return Number.isFinite(ae)&&ae>0?ae:null}function O6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&((q=L.measurementKey)!=null?q:"")===Rl()&&!!R6(vv(L))&&!!(function(re){const ae=re.heightCache;return!!ae?.length&&(P6(re)?ae.some(be=>!!(be.nodeType||be.signature)):ae.some(be=>!!be.signature))})(L)}function P6(L){return!!(L.contentHash&&L.contentHash===hv())}function HF(L){return!P6(L)}let xu=null,Su=null,w0=null,L1=null,$1=null;function yv(L){var q;const re=L.map(be=>{var Ne,De;return[be.index,Math.round(10*be.height),(Ne=be.nodeType)!=null?Ne:"",(De=be.signature)!=null?De:""].join("")}).join(""),ae=uf(Cu());return[(q=ns())!=null?q:"",wo(),Rl(),St.value.length,ae,L.length,dv(re)].join(":")}function D6(L=(q=>(q=o.virtualScroll)==null?void 0:q.heightCache)()){if(!Ct.value||!L?.length||St.value.length<=0||!R6((q=o.virtualScroll)==null?void 0:q.heightCacheWidth))return!1;var q;const re=F6(L,{requireSignature:!0});if(!re.length)return!1;const ae=yv(re);return ae===xu?(Su="standalone",!0):(a6(re,{mode:"merge"}),Pt(),xu=ae,Su="standalone",P1(),po("restore"),!0)}function kv(L,q={}){var re,ae,be;if(!Ct.value||!L||L.sessionKey!==wo()||!sv(L.threadKey)||St.value.length<=0)return!1;const Ne=!!((re=L.heightCache)!=null&&re.length)&&!_0(),De=!L.anchor||L.anchorCaptured===!1&&q.allowUncapturedAnchor!==!0?null:L.anchor,je=q.restoreAnchor===!0&&!!De&&!_0()&&Number(vv(L))>0;let ot=!1;if((ae=L.heightCache)!=null&&ae.length&&O6(L)){const Ye=F6(L.heightCache,{requireCompatibilityMetadata:!L.contentHash,requireSignature:HF(L)});Ye.length&&(a6(Ye,{mode:"merge"}),Pt(),xu=yv(Ye),Su="restore",P1(),ot=!0)}if(Ne||je)return!1;if(!q.restoreAnchor||!De)return ot&&po("restore"),!0;const Ve=(function(Ye,nt){var Be;const Xe=Ye.anchor,lt=Xe?Xe.type==="bottom"?`bottom:${Math.round(Xe.distanceFromBottomPx)}`:`node:${Xe.nodeIndex}:${Math.round(Xe.offsetWithinNodePx)}`:"none";return[(Be=ns())!=null?Be:"",wo(),Rl(),k0.value,nt,lt].join(":")})(L,(be=q.restoreToken)!=null?be:"imperative");return w0===Ve?(ot&&po("restore"),!0):(w0=Ve,(function(Ye){const nt=()=>{if(Ye.type==="node")return Wc(),void Fc({nodeIndex:Ye.nodeIndex,offsetWithinNodePx:Ye.offsetWithinNodePx});if($c(),Os.value=null,Dt.value=Ye,N6(),mv(Ye),G)for(const Be of[0,120,280,480])gv.push(window.setTimeout(()=>{const Xe=Dt.value;Xe&&mv(Xe)},Be))};(function(Be){if(!sn.value)return!1;const Xe=St.value.length;return!(Xe<=0||(Nl.value=Be.type==="node"?Bs(Be.nodeIndex,0,Xe-1):Xe-1,M1(),0))})(Ye)?yt(nt):nt()})(De),po("restore"),!0)}function _0(){const L=Cu();return Number.isFinite(L)&&L>0}function B6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&(St.value.length<=0||!(!((q=L.heightCache)!=null&&q.length)||_0())||!(!(L.anchor&&Number(vv(L))>0)||_0()))}function bv(){zo.clear();for(const L of Object.keys($l)){const q=Number(L);Number.isInteger(q)&&q>=0&&q{let q=!1,re=null;const ae=()=>{q||(q=!0,re!=null&&window.clearTimeout(re),L())};if(Bo)return Bo(ae),void(re=window.setTimeout(ae,50));re=window.setTimeout(ae,0)})}function Cv(L,q=ns(),re=Ji.value){return wo()===L&&ns()===q&&Ji.value===re}function wv(){return mo(this,arguments,function*(L={}){var q,re,ae,be,Ne;const De=wo(),je=ns(),ot=Ji.value,Ve=(q=L.frames)!=null?q:2,Ye=(re=L.timeoutMs)!=null?re:120,nt=(ae=L.reason)!=null?ae:"manual",Be=L.expectedSettledTokenKey,Xe=L.flushPendingTimers===!0,lt=wu(nt),rt=()=>rn(mt({},lt),{phase:lt.final?"settling":lt.phase,stable:!1,confidence:lt.confidence==="final"?"mixed":lt.confidence,reason:nt}),wt=()=>Cv(De,je,ot)&&(Be==null||O1()===Be);for(let Vt=0;Vtwindow.setTimeout(Wt,Vt))})(Ye),!wt()||(Xe&&m6(),Ol(),N1(),!wt()))return rt();const dt=uv();dt&&(av=De,lv=je,((be=o.virtualScroll)==null?void 0:be.settleMode)==="manual"&&Be!=null&&b0((Ne=o.virtualScroll)==null?void 0:Ne.settledToken)&&O1()===Be&&(Hc=W1(o.virtualScroll.settledToken)));const Ft=wt()&&dt&&I6(),Ht=wu(nt,Ft?"final":void 0);return Mv(Ht,!0),Ht})}let _v="content",Au=null,Mu=null,xv=0,F1=null,jc=null,Sv=null,Av=null;function R1(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function z6(L){var q,re;const ae=F1;if(!ae)return!0;const be=(re=(q=o.virtualScroll)==null?void 0:q.heightDiffThresholdPx)!=null?re:1;return Math.abs(L.totalHeight-ae.totalHeight)>be||L.sessionKey!==ae.sessionKey||L.phase!==ae.phase||L.stable!==ae.stable||L.final!==ae.final||L.threadKey!==ae.threadKey||L.nodeCount!==ae.nodeCount||L.measuredCount!==ae.measuredCount||L.width!==ae.width}function O1(L=(q=>(q=o.virtualScroll)==null?void 0:q.settledToken)()){return As(L)}function W6(L,q){var re,ae;return[L,q.sessionKey,(re=q.threadKey)!=null?re:"",Rl(),hv(),As((ae=o.virtualScroll)==null?void 0:ae.settledToken),Math.round(q.totalHeight),Math.round(q.width)].join("\0")}function P1(){Sv=null,Av=null,jc=null}function zF(L){const q=L.heightCache;return q?.length?yv(q):""}function D1(L){var q,re,ae;const be=L.metrics,Ne=L.anchor?(De=L.anchor).type==="bottom"?`bottom:${Math.round(De.distanceFromBottomPx)}`:`node:${De.nodeIndex}:${Math.round(De.offsetWithinNodePx)}`:"none";var De;return[L.sessionKey,(q=L.threadKey)!=null?q:"",(re=L.measurementKey)!=null?re:Rl(),(ae=L.contentHash)!=null?ae:"",zF(L),Ne,L.anchorCaptured?1:0,be.liveRange.start,be.liveRange.end,be.renderedCount,be.nodeCount,Math.round(be.totalHeight),Math.round(be.width),be.phase,be.stable?1:0].join("\0")}function Mv(L,q=!1){if(!Ct.value||(function(De=!1){return!De&&fo.value&&!Qt.value})(q))return;const re=q||z6(L),ae=(function(De,je=!1){return je||De.stable||De.phase==="final"?{state:zc(De,{includeHeightCache:!0})}:{state:zc(De)}})(L,q),be=ae.state,Ne=!!(be&&(re||(function(De,je=!1){return!!je||D1(De)!==jc})(be,q)));if(re&&($(L),F1=L,xv=R1()),be&&Ne&&(B(be),be.anchor&&H(be.anchor),jc=D1(be)),L.stable){const De=W6("settled",L);if(De!==Sv){Sv=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-settled",ot)})(L)}}if(L.phase==="final"){const De=W6("final",L);if(De!==Av){Av=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-final",ot)})(L)}}}function Tv(){Au!=null&&(Zo?.(Au),Au=null),Mu!=null&&G&&(window.clearTimeout(Mu),Mu=null)}function U6(){Au=null,Mu=null,(function(L){if(Fl.size>0||Xi!=null)return!0;switch(L){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(_v)&&(Ol(),N1()),Mv(wu(_v))}function po(L){var q,re;if(!Ct.value||(_v=L,Au!=null||Mu!=null))return;const ae=Math.max(0,(re=(q=o.virtualScroll)==null?void 0:q.emitIntervalMs)!=null?re:32),be=Math.max(0,ae-(R1()-xv)),Ne=()=>{Mu=null,Au=Bo?Bo(U6):null,Au==null&&U6()};G&&be>0?Mu=window.setTimeout(Ne,be):Ne()}function j6(){He.value+=1}function x0(L){if(Rs.value&&L>=yo.value){const q=St.value[L],re=Fe.value===!0&&Oe.value!==!0&&L>=St.value.length-2,ae=q?.type==="code_block"||q?.type==="image"||q?.type==="mermaid"||q?.type==="infographic";if(!re||ae)return!1}return!nl.value||L=ve.value&&(K.value||(K.value=!0,X2()),!u6.value||!Js))return Vc(L),void(q&&pa(L,!0));if(L{if(g6.delete(Ne),!nl.value||Y2.value.has(Ne))return;const ot=ao.get(Ne);if(!ot)return;const Ve=ue(ot),Ye=ot.ownerDocument||document,nt=Ye.defaultView||window,Be=!Ve||Ve===Ye.documentElement||Ve===Ye.body,Xe=!Be&&Ve?qt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Ve.getBoundingClientRect()):null,lt=Be?0:Xe.top,rt=Be?qt("nodeVisibilityFallback.clientHeight",()=>{var dt,Ft;return(Ft=(dt=nt.innerHeight)!=null?dt:Ve?.clientHeight)!=null?Ft:0}):Xe.bottom,wt=qt("nodeVisibilityFallback.node.getBoundingClientRect",()=>ot.getBoundingClientRect());wt.bottom>=lt-500&&wt.top<=rt+500&&pa(Ne,!0)},1800+De);g6.set(Ne,je)})(L);let be=null;be=Je(()=>ae.isVisible.value,Ne=>{if(Ne){v0(L),pa(L,!0),be?.(),g0.delete(L),Oc.get(L)===ae&&Oc.delete(L);try{ae.destroy()}catch{}}},{immediate:!0}),g0.set(L,be),sn.value&&Lr()}function Ev(){Xi=null,an(()=>{let L=!1;for(const[q,re]of Fl)Fl.delete(q),ol.get(q)===re.el&&bu.get(q)===re.version&&(L=ku(q,re.height,{allowShrink:re.allowShrink})||L);return L})}function qc(){Xi!=null&&(Zo?.(Xi),Xi=null),Fl.clear()}function A0(L,q){(function(re,ae,be){var Ne;if(!Number.isFinite(be)||be<=0||ol.get(re)!==ae)return;const De=bu.get(re);if(De==null)return;const je=St.value[re],ot=at.value&&Oe.value!==!0&&!((Ne=o.nodes)!=null&&Ne.length)&&re>=St.value.length-2,Ve=!(je?.loading===!0||ot),Ye=Fl.get(re),nt=Ye?Ye.allowShrink&&Ve:Ve,Be=Ye&&!nt?Math.max(Ye.height,be):be;Fl.set(re,{height:Be,allowShrink:nt,version:De,el:ae}),Xi==null&&(Xi=Bo?Bo(Ev):null,Xi==null&&Ev())})(L,q,A1(L,q))}function Ol(){for(const[L,q]of ol)q&&A0(L,q)}function V6(){fi?.disconnect(),fi=null,Gi.clear()}function Iv(){for(;f0.length;)m0(f0.pop())}Je(Qt,L=>{L&&po("content")},{flush:"post"}),t({getVirtualMetrics:wu,captureVirtualState:function(L={}){var q;return zc(wu("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:L.allowFallbackAnchor===!0,requireViewport:L.requireViewport===!0,includeEmptyState:(q=L.includeEmptyState)==null||q})},restoreVirtualState:function(L,q={}){const re=q.restoreAnchor===!0,ae=q.restoreToken==null?"imperative":String(q.restoreToken);L1=L,$1={restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0},!kv(L,{restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0})&&B6(L)||(L1=null,$1=null)},forceMeasure:function(L="manual"){return mo(this,null,function*(){yield yt(),yield H6(),Ol(),N1(),yield yt();const q=wu(L);return Mv(q,!0),q})},settle:wv,scrollToNode:function(L,q="start"){Wc(),$c();const re=St.value.length;if(re<=0)return;const ae=Bs(L,0,re-1),be=()=>{var Ne;const De=U2({nodeIndex:ae,offsetWithinNodePx:0}),je=Yn(ae),ot=E1(),Ve=(Ne=ot?.clientHeight)!=null?Ne:0,Ye=ei();let nt=De;if(q==="center")nt=De-Ve/2+je/2;else if(q==="end")nt=De-Ve+je;else if(q==="nearest"&&Ye!=null){if(De>=Ye&&De+je<=Ye+Ve)return;nt=Dees.value,L=>{if(!L){V6();for(const q of da.values())for(const re of q)m0(re);da.clear(),bu.clear(),Iv(),qc()}},{immediate:!0}),Je(Oe,L=>{L&&(function(){if(G&&Oe.value&&ol.size){Iv();for(const q of[80,240,640]){const re=h6(q,()=>{for(const[ae,be]of ol)be&&A0(ae,be)},"final");re!=null&&f0.push(re)}}})(),po(L?"final":"content")});const WF=Q_(()=>po("content"),16),UF=Q_(()=>po("batch"),16);Je([()=>St.value.length,()=>yo.value],()=>{Dt.value&&Uc(),WF()},{flush:"post",immediate:!0}),Je([()=>Ds.start,()=>Ds.end],()=>{UF()},{flush:"post"});const{cleanupBatchScheduler:jF}=(function(L){const{props:q,isClient:re,isTestEnv:ae,parsedNodesIdentity:be,parsedNodeCount:Ne,desiredRenderedCount:De,datasetKey:je,batchingEnabled:ot,incrementalRenderingActive:Ve,resolvedBatchSize:Ye,resolvedInitialBatch:nt,renderedCount:Be,adaptiveBatchSize:Xe,previousRenderContext:lt,previousBatchConfig:rt,requestFrame:wt,cancelFrame:dt,hasIdleCallback:Ft,cleanupNodeVisibility:Ht,onDatasetKeyChanged:Vt,onDatasetChanged:Wt}=L;let Kt=null,fn="raf",vn=null,Qn=0,Hs=!1,Ss=!1;const $r=new Set,il=new Set;function K1(){if(re){Kt!=null&&(fn==="raf"&&dt?dt(Kt):fn==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Kt):fn==="timeout"&&window.clearTimeout(Kt),Kt=null),Qn+=1;for(const ti of $r)dt&&dt(ti);for(const ti of il)window.clearTimeout(ti);$r.clear(),il.clear(),vn=null,Hs=!1,Ss=!1}}function R0(){return typeof performance<"u"?performance.now():Date.now()}function u7(ti){(function(Pl){var ma;if(!Ve.value)return;const Dl=Math.max(2,(ma=q.renderBatchBudgetMs)!=null?ma:6),Bl=Math.max(1,Ye.value||1),Nr=Math.max(1,Math.floor(Bl/4));Pl>1.5*Dl?Xe.value=Math.max(Nr,Math.floor(.8*Xe.value)):Pl<.6*Dl&&Xe.value=Dl)return;const Bl=Math.max(1,ti),Nr=()=>{const Gc=R0();Kt=null;const Z1=vn??Bl;vn=null;const Yc=R0();Be.value=Math.min(Dl,Be.value+Z1),Ht(Be.value),(function(Pv,O0){if(!re)return void u7(O0);Hs=!0;const p7=++Qn;yt().then(()=>{var h7;if(p7!==Qn)return;const dR=R0(),fR=Math.max(O0,dR-Pv),m7=()=>{p7===Qn&&u7(fR)};if(wt){let Eu=null,Xc=null,v7=!1;const y7=()=>{v7||(v7=!0,Eu!==null&&($r.delete(Eu),Eu=null),Xc!==null&&(il.delete(Xc),window.clearTimeout(Xc),Xc=null),m7())};return Eu=wt(()=>{y7()}),$r.add(Eu),Xc=window.setTimeout(()=>{Eu!==null&&dt&&dt(Eu),y7()},Math.max(32,(h7=q.renderBatchIdleTimeoutMs)!=null?h7:120)),void il.add(Xc)}const g7=window.setTimeout(()=>{il.delete(g7),m7()},0);il.add(g7)})})(Gc,R0()-Yc)};if(!re||Li.immediate)return void Nr();const ga=Math.max(0,(Pl=q.renderBatchDelay)!=null?Pl:16);if(vn=vn!=null?Math.max(vn,Bl):Bl,Kt==null){if(!ae&&Ft&&window.requestIdleCallback){const Gc=Math.max(0,(ma=q.renderBatchIdleTimeoutMs)!=null?ma:120);return fn="idle",void(Kt=window.requestIdleCallback(()=>Nr(),{timeout:Gc}))}if(wt&&!ae)return fn="raf",void(Kt=wt(()=>{ga===0?Nr():(fn="timeout",Kt=window.setTimeout(()=>Nr(),ga))}));fn="timeout",Kt=window.setTimeout(()=>Nr(),ga)}}function d7(ti,Li={}){Hs?Ss=!0:ti==null?f7():c7(ti,Li)}function f7(){Ve.value&&c7(ot.value?Math.max(1,Math.round(Xe.value)):Math.max(1,Ye.value))}return Je([be,Ne,je,Ve,Ye,nt,()=>q.renderBatchDelay],()=>{var ti;const Li=Ne.value,Pl=lt.value,ma=je.value,Dl=!Object.is(ma,Pl.key),Bl=Li!==Pl.total,Nr=Dl||Bl;lt.value={key:ma,total:Li};const ga=rt.value,Gc=(ti=q.renderBatchDelay)!=null?ti:16,Z1=ga.batchSize!==Ye.value||ga.initial!==nt.value||ga.delay!==Gc||ga.enabled!==Ve.value;rt.value={batchSize:Ye.value,initial:nt.value,delay:Gc,enabled:Ve.value},Dl&&Vt(Li),(Nr||Z1||!Ve.value)&&K1(),(Nr||Z1)&&(Xe.value=Math.max(1,Ye.value||1)),Nr&&Wt();const Yc=De.value;if(!Li)return Be.value=0,void Ht(0);if(!Ve.value)return Be.value=Yc,void Ht(Be.value);const Pv=Dl||Pl.total===0;Be.value=Pv||Z1?Math.min(Yc,nt.value):Math.min(Be.value,Yc);const O0=Math.max(1,nt.value||Ye.value||Li);Be.value{Ve.value&&(typeof Li=="number"&&ti<=Li||ti>Be.value&&d7())}),{cleanupBatchScheduler:K1}})({props:I,isClient:G,isTestEnv:Zi,parsedNodesIdentity:Ys,parsedNodeCount:Nn,desiredRenderedCount:p0,datasetKey:NF,batchingEnabled:Fs,incrementalRenderingActive:Rs,resolvedBatchSize:Ho,resolvedInitialBatch:Co,renderedCount:yo,adaptiveBatchSize:Le,previousRenderContext:ht,previousBatchConfig:Ze,requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,cleanupNodeVisibility:MF,onDatasetKeyChanged:L=>{qc(),so(),Pt(),P1(),L>0&&Rc(L)},onDatasetChanged:()=>{sn.value&&Lr({immediate:!0})}});Je([c6,sn,()=>O.value,()=>oe()],([L,q])=>{if(!L)return v6(),void G2();TF(),q?Lr({immediate:!0}):G2()},{flush:"post",immediate:!0}),Je([()=>St.value.length,()=>sn.value],L=>mo(null,[L],function*([q,re]){re&&q&&G&&(yield yt(),Lr({immediate:!0}))}),{flush:"post"}),Je(kn,L=>{L&&(function(){var q;if(no.value&&$s.value&&Xs.value&&((q=ci.value)!=null&&q[1]))return;const re=kt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),ae=kt({type:"list_item",children:[re],raw:"- Probe paragraph text"}),be=kt({type:"list",ordered:!1,items:[ae],raw:"- Probe paragraph text"});no.value=re,$s.value=ae,Xs.value=be;const Ne={1:null,2:null,3:null,4:null,5:null,6:null};for(let De=1;De<=6;De++)Ne[De]=kt({type:"heading",level:De,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(De)} Probe heading`});ci.value=Ne})()},{immediate:!0}),Je([()=>O.value,kn],()=>{if(!kn.value)return ev(),void(ne.value=0);k6(),ev(),kn.value&&O.value&&typeof ResizeObserver<"u"&&(T1=new ResizeObserver(()=>{k6(),Os.value&&yu(),Dt.value&&Uc(),po("resize")}),T1.observe(O.value))},{immediate:!0}),Je([kn,Ns,Ji],()=>mo(null,null,function*(){if(!kn.value)return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();yield yt(),(function(){if(!kn.value||typeof window>"u")return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();const L={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},q=y6(Q2(F.value),".paragraph-node");L.paragraph=l4(F.value,q,"pre-wrap");const re=Q2(U.value),ae=re?.querySelector(".paragraph-node");L.listItem=l4(U.value,ae,"pre-wrap");const be=qt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var De,je;return(je=(De=z.value)==null?void 0:De.offsetHeight)!=null?je:0}),Ne=qt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var De,je;return(je=(De=U.value)==null?void 0:De.offsetHeight)!=null?je:0});L.listWrapperOverhead=Math.max(0,be-Ne);for(let De=1;De<=6;De++){const je=y6(Q2(W[De]),`h${De}`);L.headings[De]=l4(W[De],je,"pre-wrap")}X.value=L,Pt()})()}),{flush:"post",immediate:!0}),Je(()=>St.value.length,()=>{sn.value&&Lr({immediate:!0})}),Je([kn,ne],()=>{Pt(),sn.value&&Lr({immediate:!0}),Os.value&&yu(),Dt.value&&Uc(),po("resize")},{immediate:!1}),Je(()=>nl.value,L=>{if(L)for(const[q,re]of ao)S0(q,re);else if(X2(),sn.value)Lr({immediate:!0});else for(const[q,re]of ao)re&&pa(q,!0)},{immediate:!1}),Je([pe,ve,()=>oe()],()=>{var L;(L=Js.refresh)==null||L.call(Js);for(const[q,re]of ao)S0(q,re)},{immediate:!1}),Je([()=>I.viewportPriority,()=>St.value.length,ve],([L,q,re])=>{if(L!==!1){if(K.value&&(q<=200||q<=re)){K.value=!1;for(const[ae,be]of ao)S0(ae,be)}}else K.value=!1}),Je(()=>yo.value,()=>{sn.value&&Lr({immediate:!0})}),Je([Nl,Io,Qo,()=>St.value.length,sn],()=>{M1()},{immediate:!0});let B1=null,H1=!1,Kc=null;function z1(){B1=null,av=null,lv=void 0,Hc=null,P1()}function Lv(){qc(),so(),Pt(),zo.clear();const L=St.value.length;L>0&&Rc(L),bv()}function $v(){Tv(),m6(),F1=null,xu=null,Su=null,w0=null,L1=null,$1=null,H1=!1,z1(),T6("restore"),$c(),Wc()}function W1(L){var q;return[(q=ns())!=null?q:"",wo(),Rl(),k0.value,O1(L),St.value.length,Math.round(ko(0,St.value.length)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")}function q6(){return mo(this,null,function*(){var L,q,re,ae;const be=(L=o.virtualScroll)==null?void 0:L.settledToken,Ne=O1(be),De=wo(),je=ns(),ot=Ji.value;if(Ct.value&&((q=o.virtualScroll)==null?void 0:q.settleMode)==="manual"&&b0(be))if(uv()){if(W1(be)!==Hc&&!H1){H1=!0;try{const Ve=yield wv({reason:"manual",expectedSettledTokenKey:Ne}),Ye=O1()===Ne;Cv(De,je,ot)&&Ve.sessionKey===De&&Ve.threadKey===je&&Ye&&Ve.stable&&Ve.phase==="final"&&(Hc=W1((re=o.virtualScroll)==null?void 0:re.settledToken))}finally{H1=!1,yield yt();const Ve=(ae=o.virtualScroll)==null?void 0:ae.settledToken,Ye=b0(Ve)?W1(Ve):"";Cv(De,je,ot)&&Ye&&Hc!==Ye&&q6()}}}else po("manual")})}Je(Ct,(L,q)=>{if(L!==q){if(!L)return $v(),void Tv();$v(),Lv(),Kc=Ji.value,po("content")}},{flush:"post"}),Je([Ct,Ji],([L,q])=>{L?Kc!=null?Kc!==q&&(Kc=q,(function(re="resize"){qc(),so(),Pt(),zo.clear();const ae=St.value.length;ae>0&&Rc(ae),bv(),xu=null,Su=null,w0=null,F1=null,H1=!1,z1(),D6(),yt(()=>{Ol(),Os.value&&yu(),Dt.value&&Uc(),po(re)})})("resize")):Kc=q:Kc=null},{flush:"post",immediate:!0}),Je([Ct,()=>wo(),()=>ns()],([L])=>{L&&($v(),Lv(),T6("content"),po("content"))}),Je([Ct,()=>wo(),()=>ns(),Ji,()=>St.value.length],([L])=>{L&&(function(q="async-node"){let re=!1;for(const[ae,be]of Array.from(sl.entries()))iv(be)||(sl.delete(ae),Yi.delete(ae),re=!0);re&&(Dc(),po(q))})("async-node")},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.sessionKey},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>o.indexKey,()=>ie.value],([L])=>{L&&(P1(),(function(q="content"){if(!Ct.value)return;const re=[],ae=St.value.length,be=J2(ae);for(const Ne of Array.from(zo.keys())){if(Ne>=ae){re.push(Ne);continue}if(Ne=ae&&zo.delete(Ne);re.length&&((function(Ne,De={}){const je=Array.from(Ne,Number);Gt(je);let ot=0;if(an(()=>(ot=q2(je,De),ot>0)),ot>0)(function(Ve){for(const Ye of Ve)zo.delete(Ye)})(je);else for(const Ve of je)J.delete(Ve)})(re,{notify:!1}),Pt(),z1(),Os.value&&yu(),Dt.value&&Uc(),po(q))})("content"))},{flush:"post",immediate:!0}),Je([Ct,()=>St.value.length,()=>wo(),()=>ns()],([L,q,re,ae],[be,Ne,De,je])=>{L&&be&&re===De&&ae===je&&q!==Ne&&z1()},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCache},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCacheWidth},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],()=>{D6()},{flush:"post",immediate:!0}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreAnchor},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q,re]){if(!q||!re)return;yield yt();const ae=(function(){var be;const Ne=(be=o.virtualScroll)==null?void 0:be.restoreAnchor;return Ne==null||Ne===!1?null:Ne===!0?"true":String(Ne)})();kv(re,{restoreAnchor:ae!=null,restoreToken:ae??void 0})}),{flush:"post",immediate:!0}),Je([Ct,ne,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey}],([L])=>{var q;if(!L)return;const re=(q=o.virtualScroll)==null?void 0:q.restoreState;re&&xu&&Su==="restore"&&(O6(re)||(Lv(),xu=null,Su=null,po("resize")))},{flush:"post"}),Je([Ct,()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q]){var re;const ae=L1,be=$1;q&&ae&&(yield yt(),!kv(ae,{restoreAnchor:be?.restoreAnchor===!0,restoreToken:(re=be?.restoreToken)!=null?re:"imperative",allowUncapturedAnchor:be?.allowUncapturedAnchor===!0})&&B6(ae)||(L1=null,$1=null))}),{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>hi.count,()=>hi.total],([L,q,re])=>{if(!L||q!==!0||re==="manual"||!cv())return;const ae=(function(){var be;const Ne=St.value.length;return[(be=ns())!=null?be:"",wo(),Rl(),k0.value,Ne,Math.round(ko(0,Ne)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")})();B1!==ae&&(B1=ae,wv({reason:"final"}).then(be=>{be.stable||B1!==ae||(B1=null)}))},{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settledToken},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>St.value.length,()=>hi.count,()=>hi.total],()=>{q6()},{flush:"post",immediate:!0}),Je([()=>St.value.length,sn,Io,Qo,()=>Ds.start,()=>Ds.end],([L,q,re,ae,be,Ne])=>{fe.value&&Mn("virtualization",{nodes:L,virtualization:q,maxLiveNodes:re,buffer:ae,focusIndex:Nl.value,scroll:q?(()=>{const De=ut.value||ue();return De?{reverse:Se(De),scrollTop:Math.round(De.scrollTop),scrollTopAbs:Math.round(Math.abs(De.scrollTop)),scrollHeight:Math.round(De.scrollHeight),clientHeight:Math.round(De.clientHeight)}:null})():null,liveRange:{start:be,end:Ne},rendered:yo.value})}),Je([()=>I.customId],([L],q,re)=>{if(!L||Oo)return;const ae=(function(be,Ne){return be?(ys.controllers[be]=Ne,()=>{ys.controllers[be]===Ne&&delete ys.controllers[be]}):()=>{}})(L,{captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2,getReport:LF});re(()=>{ae()})},{immediate:!0}),Vn(()=>{(function(){if(Ct.value)try{Ol(),N1();const L=wu("manual");z6(L)&&($(L),F1=L,xv=R1());const q=zc(L,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});q&&(B(q),q.anchor&&H(q.anchor),jc=D1(q))}catch{}})(),jF(),X2(),en(),V6();for(const L of da.values())for(const q of L)m0(q);da.clear(),bu.clear(),zo.clear(),Iv(),qc(),ev(),$c(),Wc(),Tv(),v6(),G2()});const VF=Af("ViewportDeferredMermaidBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index11-Ci8_PlMN.js"),__vite__mapDeps([7,5]))).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',L),Pi}}),loadingComponent:px,delay:0}),px),qF=Af("ViewportDeferredInfographicBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index10-BCo1_xRY.js"),[])).default}catch(L){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',L),Pi}}),loadingComponent:fx,delay:0}),fx),KF=Af("ViewportDeferredD2BlockNode",zr(()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index8-BaK3y7fN.js"),[])).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',L),Pi}})),Pi),K6={text:qo,paragraph:cc,heading:L2,code_block:X9,list:qd,list_item:Vd,blockquote:tm,table:ep,definition_list:nm,footnote:om,footnote_reference:or,footnote_anchor:Jf,admonition:lm,vmr_container:im,hardbreak:qa,link:Mi,image:Va,thematic_break:sm,math_inline:Jr,math_block:C$,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,inline_code:li,html_inline:sr,reference:xi,html_block:Qf},ZF=R(()=>ov()),Z6=R(()=>X_(I.codeBlockProps)),GF=R(()=>X_(I.codeBlockProps,{omit:["langs"]})),G6=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,monacoOptions:I.codeBlockMonacoOptions,themes:I.themes,langs:m.value==="shiki"?I.langs:void 0,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),GF.value)),Y6=R(()=>mt(rn(mt({},G6.value),{langs:I.langs}),Z6.value));function X6(L){return typeof L=="boolean"?L:void 0}const YF=R(()=>{const L=I.codeBlockProps||{},q={},re=X6(L.showLineNumbers);re!==void 0&&(q.showLineNumbers=re);const ae=X6(L.diffInline);ae!==void 0&&(q.diffInline=ae);const be=(function(Ne){const De=Number(Ne);return Number.isFinite(De)&&De>0?De:void 0})(L.reservedHeightPx);return be!==void 0&&(q.reservedHeightPx=be),q}),XF=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,themes:I.themes,langs:I.langs,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),Z6.value)),JF=R(()=>mt({},I.mermaidProps||{})),J6=R(()=>mt({},I.d2Props||{})),QF=R(()=>mt({},I.infographicProps||{})),U1=R(()=>({typewriter:f.value,fade:I.fade,customHtmlTags:lo.value.customHtmlTags})),eR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltip:we.value}:{})),tR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),nR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),oR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{}));function sR(L){return Array.isArray(L.children)&&L.children.length>0}const M0=R(()=>IF.value.map(L=>{var q,re,ae,be,Ne,De,je,ot;let Ve=(function(dt){var Ft,Ht,Vt,Wt,Kt,fn,vn;if(dt.type!=="code_block")return dt;const Qn=dt,Hs=[String((Ft=Qn.language)!=null?Ft:""),String((Ht=Qn.loading)!=null?Ht:""),String((Vt=Qn.diff)!=null?Vt:""),String((Wt=Qn.code)!=null?Wt:""),String((Kt=Qn.originalCode)!=null?Kt:""),String((fn=Qn.updatedCode)!=null?fn:""),String((vn=Qn.raw)!=null?vn:"")].join("\0"),Ss=Ll.get(Qn);if(Ss&&Ss.signature===Hs)return Ss.node;const $r=mt({},Qn);return Ll.set(Qn,{signature:Hs,node:$r}),$r})(L.node);const Ye=T0(Ve);let nt=n7(Ve,Ye);if((Ve.type==="html_block"||Ve.type==="html_inline")&&nt===K6[Ve.type]){const dt=Ve,Ft=String((q=dt.tag)!=null?q:"").trim().toLowerCase()||ZI(dt.content);if(Ft){const Ht=In.value[Ft];if(To.value.has(Ft)&&Ht)nt=Ht,Ve=rn(mt({},dt),{type:Ft,tag:Ft,content:pie(dt.content,Ft)});else if(GI((re=dt.content)!=null?re:dt.raw,Ft)){const Vt=String((be=(ae=dt.content)!=null?ae:dt.raw)!=null?be:"");Ve.type==="html_inline"?(nt=qo,Ve={type:"text",content:Vt,raw:Vt}):(nt=cc,Ve={type:"paragraph",children:[{type:"text",content:Vt,raw:Vt}],raw:Vt})}}}const Be=Ve.type==="code_block"&&m.value==="pre"&&nt===Pi&&!Nv(In.value,Ye);let Xe=mt({},(function(dt,Ft,Ht){const Vt=Ft??T0(dt);if(dt.type==="code_block"){const Wt=Vt?Nv(In.value,Vt):void 0;if(Ht&&m.value==="pre"&&!Wt&&Ht===Pi)return YF.value;if(Ht&&Vt&&Ht===Wt)return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:Y6.value;if(Ht&&Ht===In.value.code_block)return Y6.value;if(C6(Ht))return XF.value}return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:dt.type==="link"?eR.value:dt.type==="list"?tR.value:dt.type==="blockquote"?nR.value:dt.type==="table"?oR.value:dt.type==="code_block"?G6.value:U1.value})(Ve,Ye,nt));const lt=kn.value?Pc.value[L.index]:null;Ve.type==="code_block"&<?.kind==="code-block"&&(Xe=rn(mt({},Xe),Be?{reservedHeightPx:(Ne=lt.height)!=null?Ne:lt.contentHeight}:{estimatedHeightPx:lt.height,estimatedContentHeightPx:lt.contentHeight,estimatedDiffInline:lt.diffInline})),Be||Ve.type!=="code_block"||Ye!=="mermaid"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:lg(ig(String((De=Ve.code)!=null?De:"")))})),Be||Ve.type!=="code_block"||Ye!=="infographic"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:ag(rg(String((je=Ve.code)!=null?je:"")))})),Ve.type==="math_block"&&(Xe=rn(mt({},Xe),{cacheScope:_n}));const rt=(function(dt,Ft){const Ht=String(dt.type);return!Qp(Ht)&&In.value[Ht]===Ft})(Ve,nt),wt=rt?p5(Ve,ge.value):void 0;return rn(mt({},L),{node:Ve,component:nt,bindings:Xe,customBindings:mt(mt({},wt??{}),Xe),rendersCustomNode:rt,hasSlotChildren:sR(Ve),slotContent:String((ot=Ve.content)!=null?ot:""),isCodeBlock:Ve.type==="code_block",indexKey:`${ZF.value}-${L.index}`,vnodeKey:`${$F.value}\0${L.index}\0${Ve.type}`})}));function T0(L){var q;return L?.type==="code_block"?String((q=L.language)!=null?q:"").trim().toLowerCase():""}function Nv(L,q){const re=q.trim().toLowerCase();if(re)for(const ae of[re,T2(re),n$(re)]){const be=ae&&L[ae];if(be)return be}}function Q6(L,q,re,ae){var be,Ne;const De=mt({},L.value);return Md(De.estimatedPreviewHeightPx)==null&&(De.estimatedPreviewHeightPx=ae(re(String((be=q?.code)!=null?be:"")),void 0,De.maxHeight==="none"?null:(Ne=Md(De.maxHeight))!=null?Ne:void 0)),De}function e7(L){return Q6(JF,L,ig,lg)}function t7(L){return Q6(QF,L,rg,ag)}function n7(L,q){if(!L)return l8;const re=In.value,ae=re[String(L.type)];if(L.type==="code_block"){const be=q??T0(L),Ne=be?Nv(re,be):void 0;return Ne||(m.value==="pre"?re.code_block||Pi:be==="mermaid"?re.mermaid||VF:be==="infographic"?re.infographic||qF:be==="d2"||be==="d2lang"?re.d2||KF:ae||re.code_block||w6.value)}return ae||K6[String(L.type)]||l8}function Fv(L){s("click",L)}function iR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseover",L)}function rR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseout",L)}function o7(L){s("mouseover",L)}function s7(L){s("mouseout",L)}const Tu=Z(null),Ii=Z(!1),j1=Z(null),lR=R(()=>!(I.domMode!=="minimal"||Y.value||I.fade!==!1||f.value||Ii.value||Xt.value||sn.value||Qe.value||co.value||Ki.value||Object.keys(In.value).length!==0));let V1,Zc=null,Rv=0,E0=0,I0=0;const i7=["code_block","admonition","table","math_block","html_block","image","thematic_break"],aR=new Set(i7),r7=[".typewriter-cursor",".height-estimation-probes",...i7.map(L=>`[data-node-type="${L}"]`),"script","style"].join(",");function l7(L){if(!L||typeof L!="object")return!1;const q=L.type;return typeof q=="string"&&aR.has(q)}function L0(L){var q,re;if(!L||typeof L!="object")return 0;const ae=L,be=(re=(q=ae.raw)!=null?q:ae.content)!=null?re:ae.code;if(typeof be=="string")return be.length;const Ne=ae.children;if(Array.isArray(Ne))return Ne.reduce((je,ot)=>je+L0(ot),0);const De=ae.items;return Array.isArray(De)?De.reduce((je,ot)=>je+L0(ot),0):0}function $0(){V1&&(clearTimeout(V1),V1=void 0)}function Ov(){Rv+=1,Zc!=null&&(Zo?.(Zc),Zc=null)}function q1(){Ov(),ha(),Tu.value&&(Tu.value.style.visibility="hidden")}function uR(L){var q;if(L.nodeType!==Node.TEXT_NODE||!((q=L.textContent)!=null?q:"").trim())return!1;const re=L.parentElement;return!!re&&!re.closest(r7)}function cR(L){let q=L.lastChild;for(;q;){if(uR(q))return q;if(q.nodeType===Node.ELEMENT_NODE){const re=q;if(!re.matches(r7)&&re.lastChild){q=re.lastChild;continue}}for(;q&&q!==L&&!q.previousSibling;)q=q.parentNode;if(!q||q===L)break;q=q.previousSibling}return null}function a7(){const L=M0.value;for(let q=L.length-1;q>=0;q--){const re=L[q];if(!re||l7(re.node)||!x0(re.index))continue;const ae=ao.get(re.index);if(!ae)continue;const be=cR(ae);if(be)return be}return null}function ha(){j1.value&&(j1.value.classList.remove(hx),j1.value=null)}function N0(){if(d.value!=="simple"||!G||!Ii.value||!O.value)return void ha();const L=a7(),q=L?(function(re){var ae;const be=(ae=re.parentElement)==null?void 0:ae.closest(".text-node");return be instanceof HTMLElement?be:re.parentElement})(L):null;q!==j1.value&&(ha(),q&&(q.classList.add(hx),j1.value=q))}function F0(){if(d.value!=="precise"||!G||!Ii.value||Zc!=null)return;const L=Rv,q=()=>{Zc=null,L===Rv&&(function(){var re,ae;if(d.value!=="precise"||!(G&&Ii.value&&O.value&&Tu.value))return;const be=O.value,Ne=Tu.value;Ne.style.visibility="hidden";const De=a7();if(!De)return;let je=0,ot=0,Ve=20,Ye=!1;if(De?.textContent){const nt=De.textContent.length,Be=document.createRange();Be.setStart(De,Math.max(0,nt-1)),Be.setEnd(De,nt);const Xe=typeof Be.getClientRects=="function"?Be.getClientRects():void 0,lt=(ae=Xe?.[Xe.length-1])!=null?ae:(re=De.parentElement)==null?void 0:re.getBoundingClientRect();if(lt){const rt=qt("typewriterCursor.root.getBoundingClientRect",()=>be.getBoundingClientRect());je=lt.right-rt.left+be.scrollLeft,ot=lt.top-rt.top+be.scrollTop,Ve=lt.height||Ve,Ye=!0}Be.detach()}Ye&&(Ne.style.transform=`translate(${Math.max(0,je)}px, ${Math.max(0,ot)}px)`,Ne.style.height=`${Ve}px`,Ne.style.visibility="visible")})()};Bo?Zc=Bo(q):q()}return Je([it,()=>o.content,()=>o.nodes,()=>I.typewriter,Oe],()=>mo(null,null,function*(){var L,q;if(!G||Y.value||!te.value)return;if(Oe.value)return Ii.value=!1,$0(),void q1();if((L=o.nodes)!=null&&L.length)return Ii.value=!1,$0(),q1(),E0=((q=o.content)!=null?q:"").length,void(I0=it.value.length);const re=(function(){var je,ot;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((Ve,Ye)=>Ve+L0(Ye),0):((ot=o.content)!=null?ot:"").length})(),ae=(function(){var je;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((ot,Ve)=>ot+L0(Ve),0):it.value.length})(),be=!l7(St.value[St.value.length-1]),Ne=re>E0,De=ae>I0;if(!f.value||!be||!Ne&&!De)return f.value&&be||(Ii.value=!1,q1()),E0=re,void(I0=ae);E0=re,I0=ae,Ii.value=!0,d.value==="precise"&&Tu.value&&(Tu.value.style.visibility="hidden"),$0(),yield yt(),d.value==="simple"?N0():(ha(),F0()),V1=setTimeout(()=>{V1=void 0,Ii.value=!1},3e3)}),{flush:"post",immediate:!0}),Je(Ii,L=>mo(null,null,function*(){L?(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0()):q1()}),{flush:"post"}),Je(d,()=>mo(null,null,function*(){if(G&&!Y.value&&te.value&&Ii.value){if(yield yt(),d.value==="simple")return Ov(),void N0();ha(),d.value!=="precise"?q1():F0()}}),{flush:"post"}),Je([()=>yo.value,()=>Ds.start,()=>Ds.end],()=>mo(null,null,function*(){G&&!Y.value&&te.value&&Ii.value&&(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0())}),{flush:"post"}),Vn(()=>{$0(),Ov(),ha(),xs.clear()}),(L,q)=>{const re=zO("NodeRenderer",!0);return p(Y)?(y(!0),M(Pe,{key:0},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[0]||(q[0]=be=>i(be)),onHandleArtifactClick:q[1]||(q[1]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[2]||(q[2]=be=>i(be)),onHandleArtifactClick:q[3]||(q[3]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(y(),M("div",{key:1,ref_key:"containerRef",ref:O,class:Re(["markstream-vue markdown-renderer",[{dark:I.isDark},{virtualized:sn.value},{"virtual-scroll-coordinated":Qt.value},{"stable-layout":_F.value},{"typewriter-simple-cursor":Ii.value&&d.value==="simple"}]]),"data-custom-id":I.customId,onClick:Fv,onMouseover:iR,onMouseout:rR},[Ko.value||sn.value?(y(),M(Pe,{key:0},[Ko.value?(y(),he(lpe,{key:0,width:Ns.value,"flow-root":sn.value||Qt.value,"paragraph-node":no.value,"list-item-node":$s.value,"list-node":Xs.value,"heading-nodes":ci.value,"set-paragraph-wrapper":xF,"set-list-item-wrapper":SF,"set-list-wrapper":AF,"set-heading-wrapper":EF},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):ee("",!0),sn.value?(y(),M("div",{key:1,class:"node-spacer",style:Zt({height:`${tv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],64)):ee("",!0),lR.value?(y(!0),M(Pe,{key:1},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[x0(ae.index)?(y(),he(bs(ae.component),zn({key:0,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onMouseover:q[4]||(q[4]=be=>s("mouseover",be)),onMouseout:q[5]||(q[5]=be=>s("mouseout",be)),onCopy:q[6]||(q[6]=be=>i(be)),onHandleArtifactClick:q[7]||(q[7]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):ee("",!0)],64))),128)):(y(!0),M(Pe,{key:2},pt(M0.value,ae=>(y(),M("div",{key:ae.vnodeKey,ref_for:!0,ref:be=>S0(ae.index,be),class:"node-slot","data-node-index":ae.index,"data-node-type":ae.node.type},[x0(ae.index)?(y(),M("div",{key:0,ref_for:!0,ref:be=>(function(Ne,De){var je;De||(function(nt){const Be=`${ov()}-${nt}`;let Xe=!1;for(const lt of Array.from(Yi.keys())){const rt=sl.get(lt);(rt?.index===nt||lt===Be||lt.startsWith(`${Be}-`))&&(Yi.delete(lt),sl.delete(lt),Xe=!0)}Xe&&(Dc(),po("async-node"))})(Ne),Fl.delete(Ne),(function(nt){var Be;const Xe=((Be=bu.get(nt))!=null?Be:0)+1;bu.set(nt,Xe)})(Ne);const ot=da.get(Ne);if(ot){for(const nt of ot)m0(nt);da.delete(Ne)}if((function(nt){const Be=Gi.get(nt);Be&&(fi?.unobserve(Be),Er.delete(Be),Gi.delete(nt))})(Ne),!De||!es.value)return ol.delete(Ne),void bu.delete(Ne);ol.set(Ne,De);const Ve=()=>{A0(Ne,De)};queueMicrotask(Ve);const Ye=(fi||typeof ResizeObserver>"u"||(fi=new ResizeObserver(nt=>{if(nt.length)for(const Be of nt){const Xe=Er.get(Be.target),lt=Gi.get(Xe??-1);Xe!=null&<&&A0(Xe,lt)}else Ol()})),fi);if(Ye&&(Gi.set(Ne,De),Er.set(De,Ne),Ye.observe(De)),typeof window<"u"){const nt=((je=St.value[Ne])==null?void 0:je.type)==="code_block"?[16,80,240,800]:Oe.value?[80]:[];if(nt.length){const Be=nt.map(Xe=>h6(Xe,Ve,"node-resize")).filter(Xe=>Xe!=null);Be.length&&da.set(Ne,Be)}}})(ae.index,be),class:"node-content"},[ae.isCodeBlock?ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:1,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[12]||(q[12]=be=>i(be)),onHandleArtifactClick:q[13]||(q[13]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:2,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[14]||(q[14]=be=>i(be)),onHandleArtifactClick:q[15]||(q[15]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(y(),he(as,{key:0,name:"fade",css:I.fade!==!1,appear:I.fade!==!1},{default:me(()=>[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[8]||(q[8]=be=>i(be)),onHandleArtifactClick:q[9]||(q[9]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[10]||(q[10]=be=>i(be)),onHandleArtifactClick:q[11]||(q[11]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(y(),M("div",{key:1,class:"node-placeholder",style:Zt({height:`${Yn(ae.index)}px`})},null,4))],8,cpe))),128)),Ii.value&&d.value==="precise"?(y(),M("span",{key:3,ref_key:"typewriterCursorRef",ref:Tu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ee("",!0),sn.value?(y(),M("div",{key:4,class:"node-spacer",style:Zt({height:`${nv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],42,upe))}}})),[["__scopeId","data-v-a9489508"]]),Vi=R$;Vi.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",Vi.__name,Vi.name].filter(n=>!!n));for(const n of t)e.component(n,R$)};const M5=Object.freeze(Object.defineProperty({__proto__:null,default:Vi},Symbol.toStringTag,{value:"Module"})),dpe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},fpe={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},ppe={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},hpe={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},mpe={class:"admonition-title"},gpe=["aria-expanded","aria-controls"],vpe=["id"],lm=Gn(et({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=R(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const u=o.node.kind||"note";return u.charAt(0).toUpperCase()+u.slice(1)}),r=Z(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(u,c)=>(y(),M("div",{class:Re(["admonition",[`admonition-${o.node.kind}`]])},[C("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(y(),M("svg",dpe,[...c[1]||(c[1]=[C("circle",{cx:"12",cy:"12",r:"10"},null,-1),C("path",{d:"M12 16v-4"},null,-1),C("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(y(),M("svg",fpe,[...c[2]||(c[2]=[C("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),C("path",{d:"M9 18h6"},null,-1),C("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(y(),M("svg",ppe,[...c[3]||(c[3]=[C("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"},null,-1),C("path",{d:"M12 9v4"},null,-1),C("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(y(),M("svg",hpe,[...c[4]||(c[4]=[C("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),C("path",{d:"M12 8v4"},null,-1),C("path",{d:"M12 16h.01"},null,-1)])])):ee("",!0),C("span",mpe,N(i.value),1),o.node.collapsible?(y(),M("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(y(),M("svg",{style:Zt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...c[5]||(c[5]=[C("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,gpe)):ee("",!0)]),Bn(C("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[j(p(Vi),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:c[0]||(c[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,vpe),[[qs,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);lm.install=e=>{e.component(lm.__name,lm)};const f8=()=>jo(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let xh=null,Sh=f8,Ah=null,mx=!1,gx=!1;function $Ve(){return mo(this,null,function*(){if(xh)return xh;const e=Sh;return e?e===f8&&mx?null:Ah||(Ah=mo(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===f8)return e===Sh&&(mx=!0,(function(o){gx||(gx=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===Sh&&(Ah=null)}return e!==Sh?null:t?(xh=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),xh):null}),Ah):null})}let Mh=null,O$=null,Th=null;function NVe(){return typeof O$=="function"}function FVe(){return mo(this,null,function*(){if(Mh)return Mh;const e=O$;return e?Th||(Th=mo(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(Mh=n,Mh):null}).finally(()=>{Th=null}),Th):null})}const RVe=Symbol("markstreamLanguageIconResolver"),P$=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],ype=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),p8=[...P$].sort((e,t)=>t.length-e.length).join("|"),a4=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${p8}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${p8})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),D$=/[),.;!?,。;!?)]+$/;function kpe(e){const t=e.toLowerCase();return P$.some(n=>t.endsWith(`.${n}`))}function bpe(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${p8}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Cpe(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(D$,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=ype.has(i),a=kpe(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const u=o[2]??o[3],c=u?Number(u):void 0;return{path:s,line:c!==void 0&&Number.isFinite(c)&&c>0?c:void 0}}function wpe(e,t={}){const n=[];a4.lastIndex=0;let o;for(;(o=a4.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const u=a.replace(D$,""),c=a.length-u.length;a=u;const d=Cpe(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),c>0&&(a4.lastIndex-=c)}return n}function u4(e,t){let n=0,o=t-1;for(;o>=0&&e[o]==="\\";)n++,o--;return n%2===1}const _pe=/\s/,xpe=/\p{Nd}/u;function Cc(e,t){const n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function Spe(e,t){if(t<=0)return;const n=e.charCodeAt(t-1),o=n>=56320&&n<=57343&&t>1?t-2:t-1,s=e.codePointAt(o);return s===void 0?void 0:String.fromCodePoint(s)}function vx(e){return e!==void 0&&_pe.test(e)}function a1(e){return e!==void 0&&xpe.test(e)}function Ape(e,t){const n=e[t+1];return a1(Cc(e,t+1))?!0:(n==="-"||n==="+"||n==="."||n==="−"||n==="+"||n==="-")&&a1(Cc(e,t+2))}function vg(e){return e!==void 0&&e>="A"&&e<="Z"}const B$=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function Mpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))||a1(Cc(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")&&!/\p{L}/u.test(Cc(e,t+1)??"")}function Tpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")}const Epe=/^[-–—,,、;;::~~(([【//]$/;function Ipe(e,t){const n=e[t+1];if(n!=="-"&&n!=="+"&&n!=="."||!a1(Cc(e,t+2)))return!1;const o=e[t-1];return o!==void 0&&Epe.test(o)}function Lpe(e){const t=String.raw`[、,,;;::~~\-–—至到//\s()()=*×=]|和|跟|与|及|或|and|or`;let n=e.replace(new RegExp(String.raw`^(?:${t})+`,"u"),"");for(;;){const s=n.replace(new RegExp(String.raw`^\p{L}+(?:${t})+`,"u"),"").replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,"");if(s===n)break;n=s}if(!/\p{Nd}/u.test(n))return!1;const o=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${o}(?:\p{L}+)?(?:(?:${t})+${o}(?:\p{L}+)?)*$`,"u").test(n)}const ul=-1,yx=1,kx=2,bx=3;function $pe(e){const t=e.length,n=new Uint8Array(t),o=new Int32Array(t+1).fill(ul),s=new Int32Array(t+1),i=new Int32Array(t+1),r=[],l=[];{const F=[];for(let K=0;K{for(;a=(l[a]?.[1]??0);)a++;const U=l[a];return U!==void 0&&F>=U[0]},c=new Set(' \n\r)。,、;:!?"<>`「」『』【】〔〕()*—–“”‘’'),d=[];for(const F of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))d.push(F.index);for(const F of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))d.push(F.index);for(const F of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(F.index===0||!/[\w~/.-]/.test(e[F.index-1]))&&d.push(F.index);d.sort((F,U)=>F-U);let f=-1;for(const F of d){if(FF+7&&!/[\w/?#@~.+&=%-]/.test(e[U+1]??""))break}U++}r.push([F,U]),f=U}const h=[];for(let F=0;F]/.test(K))continue;let V=U,ie=ul,ne=ul;for(;V"){ne=V;break}if(!z&&X==="/"&&e[V+1]===">"){ne=V+1;break}if(!/\s/.test(X)){ie=V;break}for(;V"){ne=V;break}if(z){ie=V;break}if(le==="/"&&e[V+1]===">"){ne=V+1;break}const Ie=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(V));if(!Ie){ie=V;break}V+=Ie[0].length;let de=V;for(;de`]+/.exec(e.slice(de));if(!ve){ie=de;break}V=de+ve[0].length}}}if(ne!==ul)h.push([F,ne+1]),F=ne;else if(ie!==ul){const X=e.indexOf("<",F+1);F=(X!==-1&&X",F+2);ie===-1?v=!1:(h.push([F,ie+2]),F=ie+1,z=!0)}else if(U==="!"){if(e[F+2]==="-"&&e[F+3]==="-"){if(m){const ie=e.indexOf("-->",F+4);ie===-1?m=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(e.startsWith("[CDATA[",F+2)){if(k){const ie=e.indexOf("]]>",F+9);ie===-1?k=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(w&&/[A-Z]/.test(e[F+2]??"")){const ie=e.indexOf(">",F+3);ie===-1?w=!1:(h.push([F,ie+1]),F=ie,z=!0)}}if(z)continue;if(U!==void 0&&/[a-zA-Z]/.test(U)){const ie=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(F+1));if(ie){let ne=F+1+ie[0].length;for(;ne"&&e[ne]!=="<"&&!/\s/.test(e[ne]);)ne++;if(e[ne]===">"){h.push([F,ne+1]),F=ne;continue}}}if(U===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(U))continue;let W=F+1;for(;W"&&(h.push([F,W+1]),F=W)}}h.sort((F,U)=>F[0]-U[0]);const b=[];for(const[F,U]of h){const z=b[b.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):b.push([F,U])}r.push(...b);let _=0;const g=F=>{for(;_=(b[_]?.[1]??0);)_++;const U=b[_];return U!==void 0&&F>=U[0]},x=[];let S=null,T=0,A=!1;for(let F=0;F"&&(A=!1);else if(!(u(F)||g(F))){if(S!==null)e[F]===S&&(S=null);else if(x.length>0&&(e[F]==='"'||e[F]==="'")&&F>0&&/\s/.test(e[F-1]))S=e[F];else if(e[F]==="[")T++;else if(e[F]==="]")T>0&&e[F+1]==="("&&(x.push(F),A=e[F+2]==="<",F++),T=Math.max(0,T-1);else if(e[F]==="("&&x.length>0)x.push(-1);else if(e[F]===")"&&x.length>0){const U=x.pop();if(U!==void 0&&U>=0){const z=e.slice(U+2,F);(/\s/.exec(z)===null||z.startsWith("<")&&/^<(?:\\[<>]|[^<>])*>$/.test(z)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(z))&&r.push([U,F+1])}}}r.sort((F,U)=>F[0]-U[0]);const E=[];for(const[F,U]of r){const z=E[E.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):E.push([F,U])}const P=F=>{let U=0,z=E.length-1;for(;U<=z;){const W=U+z>>1,K=E[W];if(K===void 0)return!1;if(F=K[1])U=W+1;else return!0}return!1};for(let F=0;F=0;F--)n[F]===bx&&(D=F),o[F]=D;const I=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,$=/[^\p{L}\p{Nd}\s]$/u,B=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,H=/(?:^|\s)[a-z]{2,}/,O=(F,U)=>{const z=Cc(e,F+1);if(z===void 0||!I.test(z))return!1;const W=o[F+1]??ul;if(W!==ul){const K=e.slice(F+1,W);return!(K.length===((K.codePointAt(0)??0)>65535?2:1))&&B.test(K)||/[,;:!?]$/.test(K)||/^[a-z]{2,}$/.test(K)?!1:(s[W]??0)-(s[F+1]??0)===0&&(i[W]??0)-(i[F+1]??0)===0}return $.test(U)||B.test(U)||H.test(U)};return(F,U=-1)=>{if(e[F]!=="$"||n[F]===yx||e[F+1]==="$"||e[F-1]==="$"&&U!==F||Mpe(e,F)||F+1>=t||vx(e[F+1]))return null;const z=o[F+1]??ul;if(z===ul||(s[z]??0)-(s[F+1]??0)>0||(i[z]??0)-(i[F+1]??0)>0)return null;const W=e.slice(F+1,z);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(W)||e[z+1]==="{"&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(W)||a1(Spe(e,F))&&Lpe(W)||Ape(e,F)&&(O(z,W)||Tpe(e,z)||/\s/.test(W)&&/\p{Nd}$/u.test(W)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(W)||e[z+1]==="$"&&!/\p{L}/u.test(W)&&/[^\p{L}\p{Nd}\s]$/u.test(W))?null:{content:W,end:z+1}}}const Cx=new WeakMap;function Npe(e,t){if(e.src[e.pos]!=="$")return!1;let n=Cx.get(e);(!n||n.src!==e.src)&&(n={src:e.src,match:$pe(e.src),lastEnd:-1},Cx.set(e,n));const o=n.match(e.pos,n.lastEnd);if(!o||o.end>e.posMax)return!1;if(n.lastEnd=o.end,t)return e.pos=o.end,!0;const s=e.push("math_inline","math",0);return s.content=o.content,s.markup="$",s.raw=e.src.slice(e.pos,o.end),s.loading=!1,e.pos=o.end,!0}function Fpe(e){return e.inline.ruler.disable("math"),e.inline.ruler.before("escape","math",Npe),e}const Rpe=12e4,Ope=6e4,Ppe=32,Dpe=3e4,wx=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function Bpe(e){let t=0,n=0,o=0;wx.lastIndex=0;let s;for(;(s=wx.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=Rpe||n>=Ope||t>=Ppe||o>=Dpe?"pre":"shiki",codeFenceCount:t,codeChars:n}}async function H$(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return zpe(e)}function Hpe(e){if(typeof e!="string")return;const t=typeof navigator<"u"?navigator.clipboard:void 0;t&&typeof t.writeText=="function"||H$(e)}function zpe(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}const z$="md-table-wide",W$="md-table-toggle",U$="md-table-fade",_x="md-table-toggle--show",Wpe="md-table-at-end",Upe="kimi-table-layout",j$='',jpe='';function e0(e){return e.querySelector(`button.${W$}`)}function V$(e){return e.querySelector(`.${U$}`)}const Vpe=26;function qpe(e){const t=e0(e);if(!t)return;const n=e.querySelector("thead tr")??e.querySelector("tr");if(!n)return;const o=n.getBoundingClientRect(),s=e.getBoundingClientRect().top,i=Math.max(2,Math.round(o.top-s+(o.height-Vpe)/2));t.style.top=`${i}px`,t.style.right=`${i}px`}function Kpe(e){return e.closest(".a-msg .msg")!==null}function Zpe(e){const t=e.querySelector("table");return t!==null&&t.scrollWidth>e.clientWidth+1}function q$(e){const t=`translateX(${e.scrollLeft}px)`,n=V$(e);n&&(n.style.transform=t);const o=e0(e);o&&(o.style.transform=t);const s=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(Wpe,s)}function Gpe(e,t){const n=e0(e);if(n)return n;if(!Kpe(e))return null;const o=document.createElement("div");o.className=U$,o.setAttribute("aria-hidden","true");const s=document.createElement("button");return s.type="button",s.className=W$,s.innerHTML=j$,s.setAttribute("aria-label",t.widen),s.title=t.widen,s.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),Ype(e,t)}),e.appendChild(o),e.appendChild(s),e.addEventListener("scroll",()=>q$(e),{passive:!0}),T5(e),s}function Ype(e,t){const n=e.classList.toggle(z$),o=e0(e);if(o){o.innerHTML=n?jpe:j$;const s=n?t.restore:t.widen;o.setAttribute("aria-label",s),o.title=s}T5(e),e.dispatchEvent(new CustomEvent(Upe,{bubbles:!0}))}function T5(e){const t=e0(e);if(!t)return;const n=Zpe(e),o=e.classList.contains(z$);t.classList.toggle(_x,n||o);const s=V$(e);s&&s.classList.toggle(_x,n),qpe(e),q$(e)}function Xpe(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function Jpe(e){return new Worker("/assets/mermaidParser.worker-BFSlSHEW.js",{type:"module",name:e?.name})}const Qpe={key:1,class:"diff-wrap"},e0e={class:"diff-bar"},t0e=["aria-label","onClick"],n0e={class:"diff-pre"},o0e={key:0,class:"diff-sign"},s0e={class:"diff-text"},i0e="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",xx="github-light",Sx="github-dark",r0e=et({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){qce(),ide(),Zce(),ade(),Kce(new Xpe),lde(new Jpe);const{t}=m1(),n=nn("resolveImage"),o=Z(null),s=e,i=R(()=>!s.streaming),r=R(()=>bpe(s.text??"")),l=R(()=>s.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:Bpe(s.text??"")),a=f2(),u=R(()=>!s.streaming),c=Go(new Map),d=new Set,f=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,h=/(]*?\bsrc=")([^"]+)(")/gi;function m(F){return!/^(https?:|data:|blob:)/i.test(F)}function v(F){if(!n)return;const U=[];for(const z of[f,h]){z.lastIndex=0;let W;for(;(W=z.exec(F))!==null;)U.push(W[2]??"")}for(const z of U)!z||!m(z)||c.has(z)||d.has(z)||(d.add(z),n(z).then(W=>{c.set(z,W!==z?W:"")}).catch(()=>{c.set(z,"")}).finally(()=>{d.delete(z)}))}function k(F){if(!n)return F;const U=z=>{if(!m(z))return null;const W=c.get(z);return W===void 0?i0e:W===""?null:W};return F.replace(f,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`}).replace(h,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`})}Je(()=>s.text,F=>v(F??""),{immediate:!0});function w(){if(!o.value||!s.openFile||s.streaming)return;const F=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),U=[];let z=F.nextNode();for(;z;){const W=z,K=W.parentElement;K&&!K.closest("a, pre, .md-file-link, svg")&&W.data.trim().length>0&&U.push(W),z=F.nextNode()}for(const W of U){const K=wpe(W.data,{aliases:r.value});if(K.length===0||!W.parentNode)continue;const V=document.createDocumentFragment();let ie=0;for(const ne of K){ne.start>ie&&V.append(document.createTextNode(W.data.slice(ie,ne.start)));const X=document.createElement("button");X.type="button",X.className="md-file-link",X.textContent=ne.text,X.title=ne.line?`${ne.path}:${ne.line}`:ne.path,X.addEventListener("click",le=>{le.preventDefault(),le.stopPropagation(),s.openFile?.({path:ne.path,line:ne.line})}),V.append(X),ie=ne.end}ie{W.preventDefault(),W.stopPropagation(),s.openFile?.({path:_(z)})}))}}function x(){return{widen:t("conversation.widenTable"),restore:t("conversation.restoreTableWidth")}}function S(){if(!o.value||s.streaming)return;const F=x();for(const U of o.value.querySelectorAll(".table-node-wrapper"))Gpe(U,F)}function T(){if(!(!o.value||s.streaming))for(const F of o.value.querySelectorAll(".table-node-wrapper"))T5(F)}function A(){yt().then(()=>{w(),g(),S()})}Je(()=>s.text,A),Je(()=>s.streaming,A);let E=null,P=null;dn(()=>{A(),o.value&&(E=new MutationObserver(A),E.observe(o.value,{childList:!0,subtree:!0}),P=new ResizeObserver(T),P.observe(o.value))}),bn(()=>{E?.disconnect(),P?.disconnect()});const D={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},I=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,$=R(()=>{const F=k(s.text??""),U=[];let z=0;I.lastIndex=0;let W;for(;(W=I.exec(F))!==null;){const V=W[1]??"",ie=F.slice(z,W.index)+(V||"");ie.trim()&&U.push({kind:"md",text:ie}),U.push({kind:"diff",code:W[2]??""}),z=I.lastIndex}const K=F.slice(z);return(K.trim()||U.length===0)&&U.push({kind:"md",text:K}),U});function B(F){return F.split(` +`).map(U=>U.startsWith("@@")?{type:"hunk",sign:"",text:U}:/^\+(?!\+\+)/.test(U)?{type:"add",sign:"+",text:U.slice(1)}:/^-(?!--)/.test(U)?{type:"del",sign:"-",text:U.slice(1)}:U.startsWith(" ")?{type:"ctx",sign:"",text:U.slice(1)}:{type:"ctx",sign:"",text:U})}const H=Z(null);function O(F,U){H$(F).then(z=>{z&&(H.value=U,setTimeout(()=>{H.value=null},1400))})}return(F,U)=>(y(),M("div",{ref_key:"mdRef",ref:o,class:"md"},[(y(!0),M(Pe,null,pt($.value,(z,W)=>(y(),M(Pe,{key:W},[z.kind==="md"?(y(),he(p(Vi),{key:0,content:z.text,"custom-markdown-it":p(Fpe),mode:"chat","code-renderer":l.value.codeRenderer,"is-dark":p(a),"code-block-light-theme":xx,"code-block-dark-theme":Sx,themes:[xx,Sx],"code-block-props":D,final:i.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1,onCopy:p(Hpe)},null,8,["content","custom-markdown-it","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering","onCopy"])):(y(),M("div",Qpe,[C("div",e0e,[U[0]||(U[0]=C("span",{class:"diff-lang"},"diff",-1)),j(p(pn),{text:p(t)("filePreview.copyCode")},{default:me(()=>[C("button",{class:"diff-copy","aria-label":p(t)("filePreview.copyCode"),onClick:K=>O(z.code,W)},[j(p(Te),{name:H.value===W?"check":"copy",size:"sm"},null,8,["name"])],8,t0e)]),_:2},1032,["text"])]),C("pre",n0e,[C("code",null,[(y(!0),M(Pe,null,pt(B(z.code),(K,V)=>(y(),M("span",{key:V,class:Re(["diff-line",`diff-${K.type}`])},[K.type!=="hunk"?(y(),M("span",o0e,N(K.sign),1)):ee("",!0),C("span",s0e,N(K.text),1)],2))),128))])])]))],64))),128))],512))}}),Ic=ft(r0e,[["__scopeId","data-v-2a3e373d"]]),l0e={state:"idle"};function a0e(e){const t=Z(l0e),n=Z(ui(cn.updateSkippedVersion)),o=Z(!1);if(typeof e?.getUpdateAutoDownload=="function"&&e.getUpdateAutoDownload().then(i=>{o.value=i}).catch(()=>{}),e!==void 0){let i=!1;e.onUpdateStatus(r=>{i=!0,t.value=r}),e.getUpdateStatus().then(r=>{i||(t.value=r)}).catch(()=>{})}const s=R(()=>{const i=t.value;return!(i.state==="idle"||i.state==="available"&&i.version!==void 0&&i.version===n.value)});return{status:t,visible:s,canCheck:typeof e?.checkForUpdates=="function",autoDownload:o,canToggleAutoDownload:typeof e?.getUpdateAutoDownload=="function"&&typeof e?.setUpdateAutoDownload=="function",setAutoDownload:i=>{o.value=i,e?.setUpdateAutoDownload?.(i).catch(()=>{})},skipVersion:()=>{const i=t.value.version;t.value.state==="available"&&i!==void 0&&(n.value=i,Ls(cn.updateSkippedVersion,i))},check:async()=>{if(typeof e?.checkForUpdates!="function")return Promise.resolve({outcome:"unsupported"});const i=await e.checkForUpdates().catch(()=>({outcome:"error",message:"bridge call failed"}));return i.outcome==="available"&&i.version!==void 0&&i.version===n.value&&(n.value=null,ur(cn.updateSkippedVersion)),i},download:()=>{e?.downloadUpdate().catch(()=>{})},install:()=>{e?.installUpdate().catch(()=>{})}}}let c4=null;function K$(){return c4===null&&(c4=a0e(window.kimiDesktop)),c4}const u0e=["data-state"],c0e=["aria-label"],d0e={class:"upd-pill-text"},f0e={key:0,class:"upd-meta"},p0e={key:1,class:"upd-notes"},h0e={class:"upd-notes-title"},m0e={key:2,class:"upd-progress"},g0e={key:3,class:"upd-message"},v0e={class:"upd-foot"},y0e={class:"upd-foot-actions"},k0e=et({__name:"UpdateIndicator",setup(e){const{t,locale:n}=Nt(),{status:o,visible:s,skipVersion:i,download:r,install:l,autoDownload:a,setAutoDownload:u,canToggleAutoDownload:c}=K$(),d=Z(!1),f="0.33.0".trim()?"0.33.0":"",h=R(()=>{switch(o.value.state){case"available":return t("sidebar.update");case"downloading":return`${o.value.percent??0}%`;case"downloaded":return t("sidebar.updateDone");case"error":return t("sidebar.updateFailed");default:return""}}),m=R(()=>{switch(o.value.state){case"available":return t("sidebar.updateAvailable",{version:o.value.version??""});case"downloading":return t("sidebar.updateDownloading",{percent:o.value.percent??0});case"downloaded":return t("sidebar.updateReady",{version:o.value.version??""});case"error":return t("sidebar.updateFailed");default:return""}}),v=R(()=>{const T=o.value.releaseDate;if(T===void 0||T==="")return"";const A=new Date(T),E=Number.isNaN(A.getTime())?T:A.toLocaleDateString();return t("sidebar.updateReleaseDate",{date:E})}),k=R(()=>{const T=[];return v.value!==""&&T.push(v.value),f!==""&&T.push(t("sidebar.updateCurrentVersion",{version:f})),T.join(" · ")}),w=R(()=>o.value.percent??0),b=R(()=>{const T=o.value.releaseNotes;return T===void 0?"":((n.value.toLowerCase().startsWith("zh")?T.zh:T.en)??T.zh??T.en??"").trim()}),_=R(()=>{switch(o.value.state){case"error":return"alert-triangle";default:return"download"}});function g(){r()}function x(){i(),d.value=!1}function S(){l(),d.value=!1}return(T,A)=>p(s)?(y(),M("span",{key:0,class:"upd","data-state":p(o).state},[C("button",{class:"upd-pill",type:"button","aria-label":h.value,onClick:A[0]||(A[0]=E=>d.value=!0)},[j(p(Te),{class:"upd-pill-icon",name:_.value,size:"sm"},null,8,["name"]),C("span",d0e,N(h.value),1)],8,c0e),j(p(ua),{open:d.value,title:m.value,size:"lg","onUpdate:open":A[4]||(A[4]=E=>d.value=E)},{foot:me(()=>[C("div",v0e,[C("div",y0e,[p(o).state==="available"?(y(),M(Pe,{key:0},[j(p(Rt),{variant:"ghost",onClick:x},{default:me(()=>[qe(N(p(t)("sidebar.updateSkip")),1)]),_:1}),j(p(Rt),{onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateDownloadNow")),1)]),_:1})],64)):p(o).state==="downloading"?(y(),he(p(Rt),{key:1,variant:"secondary",onClick:A[1]||(A[1]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateBackground")),1)]),_:1})):p(o).state==="downloaded"?(y(),M(Pe,{key:2},[j(p(Rt),{variant:"ghost",onClick:A[2]||(A[2]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartLater")),1)]),_:1}),j(p(Rt),{onClick:S},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartNow")),1)]),_:1})],64)):p(o).state==="error"?(y(),he(p(Rt),{key:3,variant:"danger-soft",onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateRetry")),1)]),_:1})):ee("",!0)]),p(c)?(y(),he(p(rW),{key:0,class:"upd-auto","model-value":p(a),"onUpdate:modelValue":A[3]||(A[3]=E=>p(u)(E))},{default:me(()=>[qe(N(p(t)("sidebar.updateAutoDownload")),1)]),_:1},8,["model-value"])):ee("",!0)])]),default:me(()=>[(p(o).state==="available"||p(o).state==="downloaded")&&k.value?(y(),M("p",f0e,N(k.value),1)):ee("",!0),b.value?(y(),M("section",p0e,[C("h4",h0e,N(p(t)("sidebar.updateWhatsNew")),1),j(p(Ic),{text:b.value},null,8,["text"])])):ee("",!0),p(o).state==="downloading"?(y(),M("div",m0e,[C("div",{class:"upd-progress-fill",style:Zt({width:`${w.value}%`})},null,4)])):ee("",!0),p(o).state==="error"&&p(o).message?(y(),M("p",g0e,N(p(o).message),1)):ee("",!0)]),_:1},8,["open","title"])],8,u0e)):ee("",!0)}}),b0e=ft(k0e,[["__scopeId","data-v-c0a4acce"]]),yg=[{code:"en",label:"English"},{code:"zh",label:"简体中文"}],Hn=Mz({locale:$M()});function E5(e){Hn.global.locale.value=e,Ls(cn.locale,e)}const C0e=["app:load:start","app:load:complete","export:start","export:accepted","export:failed","prompt:start","prompt:accepted","prompt:failed","session:snapshot:start","session:snapshot:accepted","session:snapshot:failed","operation:failed","window:error","window:unhandled-rejection","ws:connection","ws:error","ws:resync","ws:stale-reconnect"],Z$=500,kg=256*1024,Ax=200,d4=16384,f4=500,p4=50,h4=50,w0e=6,_0e=/api[_-]?key|authorization|token|secret|password|cookie|credential|email|phone|nickname|avatar/i,x0e=/^[A-Za-z0-9+/=_-]{200,}$/;let m4=null;function Qr(){if(m4!==null)return m4;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=ui(cn.debug)==="1"),m4=e,e}const Ka=[],Ed=[];let Mf=0;const Yu=[];let Tf=0,S0e=1;const bg=new TextEncoder,A0e=new Set(C0e),I5=Z(0),Ef=Xr(!1);function M0e(){return Ka}function T0e(){Ka.length=0,Ed.length=0,Mf=0,Yu.length=0,Tf=0,I5.value++}function ca(e){if(!Ef.value){try{const t={id:S0e++,ts:Date.now(),source:e.source,kind:String(Kd(e.kind)),label:String(Kd(e.label)),sessionId:e.sessionId===void 0?void 0:String(Kd(e.sessionId)),method:e.method,path:e.path,eventType:e.eventType,seq:e.seq,offset:e.offset,status:e.status,code:e.code,requestId:e.requestId,durationMs:e.durationMs,detail:pu(e.detail)},n=JSON.stringify(t),o=bg.encode(n).byteLength;if(o>kg)return;for(Ka.push(t),Ed.push(n),Mf+=o+(Ed.length>1?1:0);Ka.length>Z$||Mf>kg;){const s=Ed.shift();Ka.shift(),s!==void 0&&(Mf-=bg.encode(s).byteLength,Ed.length>0&&(Mf-=1))}}catch{return}I5.value++}}function Bu(e){if(typeof e=="string")return e.length<=Ax?e:e.slice(0,Ax)}function mr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function E0e(e,t){if(A0e.has(e))try{const n={ts:Date.now(),event:e,sessionId:Bu(t?.sessionId),status:Bu(t?.status),operation:Bu(t?.operation),seq:mr(t?.seq),durationMs:mr(t?.durationMs),messageCount:mr(t?.messageCount),contentCount:mr(t?.contentCount),mediaCount:mr(t?.mediaCount),sessionCount:mr(t?.sessionCount),workspaceCount:mr(t?.workspaceCount),promptId:Bu(t?.promptId),zipBytes:mr(t?.zipBytes),errorName:Bu(t?.errorName),errorCode:mr(t?.errorCode),requestId:Bu(t?.requestId),phase:Bu(t?.phase),httpStatus:mr(t?.httpStatus),fatal:typeof t?.fatal=="boolean"?t.fatal:void 0,line:mr(t?.line),col:mr(t?.col)},o=JSON.stringify(n),s=bg.encode(o).byteLength;if(s>kg)return;for(Yu.push(o),Tf+=s+(Yu.length>1?1:0);Yu.length>Z$||Tf>kg;){const i=Yu.shift();i!==void 0&&(Tf-=bg.encode(i).byteLength,Yu.length>0&&(Tf-=1))}}catch{return}}function Kd(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const i=e;return x0e.test(i)?`[base64-like, ${i.length} chars omitted]`:i.length>f4?`${i.slice(0,f4)}… [+${i.length-f4} chars]`:i}if(n!=="object")return String(e);if(t>=w0e)return"[max depth]";if(Array.isArray(e)){const i=e.slice(0,p4).map(r=>Kd(r,t+1));return e.length>p4&&i.push(`[+${e.length-p4} more items]`),i}const o={},s=Object.entries(e);for(const[i,r]of s.slice(0,h4))o[i]=_0e.test(i)?"[redacted]":Kd(r,t+1);return s.length>h4&&(o._truncatedKeys=s.length-h4),o}function pu(e){if(e===void 0)return;const t=Kd(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>d4)return{_truncated:`detail JSON was ${n.length} chars; first ${d4} kept`,preview:n.slice(0,d4)}}catch{return"[unserializable detail]"}return t}function I0e(e){Qr()&&ca({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:pu(e.body)}})}function L0e(e){if(!Qr())return;const t=e.code!==0;ca({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:pu(e.data)}})}function $0e(e){Qr()&&ca({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function N0e(e,t){Qr()&&ca({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:pu(t)})}function F0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=t.payload,s=typeof o?.session_id=="string"?o.session_id:void 0;ca({source:"ws",kind:"ws:out",eventType:n,sessionId:s,label:`→ ${n}`,detail:pu(e)})}function R0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,s=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[o,s!==void 0?`seq=${s}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);ca({source:"ws",kind:"ws:in",eventType:n,sessionId:o,seq:s,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:pu(t.payload)})}const O0e={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function P0e(e,t,n){Qr()&&ca({source:"client",kind:`client:${e}`,label:`${O0e[e]} ${t}`,detail:pu(n)})}function D0e(e,t){Qr()&&ca({source:"client",kind:"client:event",label:`· ${e}`,detail:pu(t)})}function bi(e,t){E0e(e,t),ca({source:"client",kind:"client:key",label:e,sessionId:typeof t?.sessionId=="string"?t.sessionId:void 0,seq:typeof t?.seq=="number"?t.seq:void 0,durationMs:typeof t?.durationMs=="number"?t.durationMs:void 0,detail:t})}let g4=!1,Eh=null;function B0e(){if(g4)return()=>Eh?.();g4=!0;const e=[];try{if(typeof window<"u"){const n=s=>{bi("window:error",{status:"failed",errorName:s.error instanceof Error?s.error.name:"Error",line:s.lineno,col:s.colno}),Xl(`[kimi-web] window error: ${s.message}`,s.error instanceof Error?s.error.stack:void 0)},o=s=>{const i=s.reason;bi("window:unhandled-rejection",{status:"failed",errorName:i instanceof Error?i.name:typeof i}),Xl(`[kimi-web] unhandled rejection: ${z0e(i)}`,i instanceof Error?i.stack:void 0)};window.addEventListener("error",n),window.addEventListener("unhandledrejection",o),e.push(()=>{window.removeEventListener("error",n)}),e.push(()=>{window.removeEventListener("unhandledrejection",o)})}}catch{}if(Qr())for(const n of["error","warn","log","info","debug"]){const o=console[n];if(typeof o!="function")continue;const s=(...i)=>{try{P0e(n,i.map(H0e).join(" "),i.length>1?i:i[0])}catch{}o.apply(console,i)};console[n]=s,e.push(()=>{console[n]===s&&(console[n]=o)})}const t=()=>{if(Eh===t){for(const n of e.toReversed())n();Eh=null,g4=!1}};return Eh=t,t}function H0e(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function z0e(e){if(e instanceof Error)return e.message;try{return String(e)}catch{return"[unstringifiable reason]"}}function G$(e=Ka){if(typeof document>"u")return;const t=new Blob([W0e(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t);let o;try{o=document.createElement("a"),o.href=n,o.download=`kimi-web-log-${new Date().toISOString().replaceAll(/[:.]/g,"-")}.jsonl`,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(n)}catch{}},0)}}function W0e(e=Ka){return e===Ka?Ed.join(` +`):e.map(t=>JSON.stringify(t)).join(` +`)}function U0e(){return Yu.join(` +`)}const Mx=cn.clientId,j0e="kimi-code-web",V0e="web";function q0e(){return{serverHttpUrl:Z0e(),clientId:Y0e(),clientName:j0e,clientVersion:X0e(),clientUiMode:V0e}}function K0e(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function Z0e(){const e=Y$();return h8(e||void 0)}const Tx="kimi-desktop-server-origin";function Y$(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("kimi_origin");try{return e?(window.sessionStorage.setItem(Tx,e),e):window.sessionStorage.getItem(Tx)??void 0}catch{return e??void 0}}function h8(e){const t=e&&e.trim()?e:K0e(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function Ex(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function G0e(){if(typeof window<"u"){const t=Y$();if(t)return Ex(h8(t))}const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return Ex(e)}function Y0e(){const e=ui(Mx);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return Ls(Mx,t),t}function X0e(){return"0.33.0".trim()?"0.33.0":"0.0.0-dev"}const J0e={restRequest:e=>I0e(e),restResponse:e=>L0e(e),restFailure:e=>$0e(e),wsEvent:e=>{switch(e.kind){case"lifecycle":N0e(e.event,e.detail);break;case"in":R0e(e.frame);break;case"out":F0e(e.frame);break}},traceKeyEvent:(e,t)=>bi(e,t)},Q0e={getToken:eQ,markAuthRequired:sQ},ehe=(e,t)=>t===void 0?Hn.global.t(e):Hn.global.t(e,t);function the(){const e=q0e();return eY({origin:e.serverHttpUrl,identity:{clientId:e.clientId,clientName:e.clientName,clientVersion:e.clientVersion,clientUiMode:e.clientUiMode},tracer:J0e,credentialStore:Q0e,t:ehe})}const nhe=the();function _t(){return nhe}function ohe(e,t,n){return e==="idle"&&!t&&!n}function X$(e,t){const n=ui(e);return n===null?t:n==="1"}const Cg=Z(X$(cn.notifyEnabled,!0)),L5=Z(X$(cn.notifySound,!0)),$5=Z(typeof Notification<"u"?Notification.permission:"denied"),she="/favicon.ico";async function ihe(e){if(!e){Cg.value=!1,Ls(cn.notifyEnabled,"0");return}if(typeof Notification>"u")return;let t=Notification.permission;if(t==="default")try{t=await Notification.requestPermission()}catch{}$5.value=t,t==="granted"&&(Cg.value=!0,Ls(cn.notifyEnabled,"1"))}function rhe(e){L5.value=e,Ls(cn.notifySound,e?"1":"0")}function N5(...e){for(const t of e){const n=t?.trim();if(n)return n}return""}function lhe(e){return{title:Hn.global.t("settings.notifyTitle"),body:N5(e,Hn.global.t("settings.notifyFallback"))}}function ahe(e,t){return{title:Hn.global.t("settings.notifyQuestionTitle"),body:N5(t,e,Hn.global.t("settings.notifyQuestionFallback"))}}function uhe(e,t){return{title:Hn.global.t("settings.notifyApprovalTitle"),body:N5(t,e,Hn.global.t("settings.notifyApprovalFallback"))}}function F5(e,t,n){if(!Cg.value||typeof Notification>"u")return;const o=Notification.permission;if(o!=="denied"){if(o==="default"){Notification.requestPermission().then(s=>{$5.value=s,s==="granted"&&Ix(e,t,n)});return}Ix(e,t,n)}}function Ix(e,t,n){if(!e.isUserWatching)try{const o=new Notification(t.title,{body:t.body,tag:n,icon:she,silent:!L5.value});o.onclick=()=>{try{window.kimiDesktop?.showWindow?.(),window.focus()}catch{}e.onClick(),o.close()}}catch{}}function che(e,t){F5(t,lhe(t.sessionTitle),`kimi-complete-${e}-${t.promptId??Date.now()}`)}function dhe(e){F5(e,ahe(e.sessionTitle,e.questionPreview),`kimi-question-${e.questionId}`)}function fhe(e){F5(e,uhe(e.sessionTitle,e.toolName),`kimi-approval-${e.approvalId}`)}function phe(){return{notifyEnabled:Cg,notifySound:L5,notifyPermission:$5,setNotifyEnabled:ihe,setNotifySound:rhe,maybeNotifyCompletion:che,maybeNotifyQuestion:dhe,maybeNotifyApproval:fhe}}const hhe=1e3,mhe=4096,Lx=32*1024;function ghe(e,t){let n=null,o;const s=new Set;async function i(f){try{const m=await _t().listTasks(f);e.tasksBySession={...e.tasksBySession,[f]:nC(m,e.tasksBySession[f]??[])},await r(f,m)}catch{}}async function r(f,h){if(e.activeSessionId!==f)return;const m=h??e.tasksBySession[f]??[],v=_t(),k=new Map;if(await Promise.all(m.map(async b=>{if((b.status==="completed"||b.status==="failed"||b.status==="cancelled")&&!s.has(b.id)&&!((b.outputLines?.length??0)>0))try{const g=await v.getTask(f,b.id,{withOutput:!0,outputBytes:Lx});g.outputPreview!==void 0&&k.set(b.id,{preview:g.outputPreview,bytes:g.outputBytes}),s.add(b.id)}catch{}})),k.size===0)return;const w=e.tasksBySession[f]??[];e.tasksBySession={...e.tasksBySession,[f]:w.map(b=>{const _=k.get(b.id)??(b.backgroundTaskId!==void 0?k.get(b.backgroundTaskId):void 0);return _?{...b,outputPreview:_.preview,outputBytes:_.bytes}:b})}}async function l(f){if(e.activeSessionId!==f)return;const h=_t();let m;try{m=await h.listTasks(f)}catch{return}const v=new Map;await Promise.all(m.map(async _=>{const g=_.status==="running",x=_.status==="completed"||_.status==="failed"||_.status==="cancelled";if(!(!g&&!x)&&!(x&&(s.has(_.id)||(_.outputLines?.length??0)>0)))try{const S=await h.getTask(f,_.id,{withOutput:!0,outputBytes:g?mhe:Lx});S.outputPreview!==void 0&&v.set(_.id,{preview:S.outputPreview,bytes:S.outputBytes}),x&&s.add(_.id)}catch{}}));const k=e.tasksBySession[f]??[],w=new Map(k.map(_=>[_.id,_])),b=m.map(_=>{const g=w.get(_.id),x=v.get(_.id);return{..._,outputLines:g?.outputLines,text:g?.text,outputPreview:x?.preview??g?.outputPreview,outputBytes:x?.bytes??g?.outputBytes}});e.tasksBySession={...e.tasksBySession,[f]:nC(b,k)}}function a(f){n!==null&&o===f||(u(),o=f,l(f),n=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||(e.activeSessionId===f?l(f):u())},hhe))}function u(){n!==null&&(clearInterval(n),n=null),o=void 0,s.clear()}const c=Z(0);let d=null;return Je(()=>t.value.some(f=>f.status==="running"),f=>{f&&d===null?d=setInterval(()=>{c.value=(c.value+1)%Number.MAX_SAFE_INTEGER},1e3):!f&&d!==null&&(clearInterval(d),d=null)},{immediate:!0}),Je(()=>{const f=e.activeSessionId;if(!f)return{sid:void 0,hasRunning:!1};const h=e.tasksBySession[f]??[];return{sid:f,hasRunning:h.some(m=>m.status==="running")}},({sid:f,hasRunning:h},m,v)=>{let k;h&&f!==void 0?a(f):f!==void 0?k=setTimeout(()=>{(e.tasksBySession[f]??[]).some(b=>b.status==="running")||u()},1500):u(),v(()=>{k!==void 0&&clearTimeout(k)})},{deep:!0,immediate:!0}),{taskClock:R(()=>c.value),loadTasksForSession:i}}function m8(e){const t=[];for(const n of e??[])n.kind==="video"?t.push({type:"video",source:{kind:"file",fileId:n.fileId}}):n.kind==="file"?t.push({type:"file",fileId:n.fileId,name:n.name??"",mediaType:n.mediaType||"application/octet-stream",size:n.size??0}):t.push({type:"image",source:{kind:"file",fileId:n.fileId}});return t}const vhe=640,yhe=`(max-width: ${vhe}px)`;function khe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(yhe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),bn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),bn(()=>t.removeListener(n))),e}const J$=Z(typeof window>"u"?0:window.innerWidth);let Ih=0,wg=!1;function g8(){J$.value=window.innerWidth}function bhe(){wg||typeof window>"u"||(window.addEventListener("resize",g8),wg=!0,g8())}function Che(){!wg||typeof window>"u"||(window.removeEventListener("resize",g8),wg=!1)}function Q$(e,t,n){return Math.max(t,e-n)}function v8(e,t,n){return Math.min(n,Math.max(t,e))}function eN(){return dn(()=>{Ih+=1,bhe()}),Vn(()=>{Ih=Math.max(0,Ih-1),Ih===0&&Che()}),{viewportWidth:J$}}const whe=24;function _he(e){const t=Z(null),n=Z(!0);let o=null,s=null,i=null,r=0,l=0,a=!1,u=0;function c(){const k=t.value;k&&(k.scrollTop=Math.max(k.scrollTop,r))}function d(){const w=t.value?.firstElementChild??null;w!==i&&(i&&o?.unobserve(i),i=w,w&&o?.observe(w))}function f(){const k=t.value;!k||a||(n.value=r-k.scrollTop-lh(k));return}requestAnimationFrame(()=>{requestAnimationFrame(()=>h(k))})}function v(){const k=t.value;k&&(o?.disconnect(),s?.disconnect(),i=null,a=!1,u++,r=0,l=0,typeof ResizeObserver=="function"?(o=new ResizeObserver(()=>{const w=t.value;if(!w)return;const{scrollHeight:b,clientHeight:_}=w,g=b>r+1,x=_{n.value=!0,yt(v)}),Je(t,()=>void yt(v)),dn(()=>void yt(v)),bn(()=>{u++,o?.disconnect(),s?.disconnect()}),{scroller:t,following:n,onScroll:f,pinScroll:m}}function xhe(e){try{const t=ui(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function $x(e,t){try{Ls(e,String(t))}catch{}}function She(e){const{storageKey:t,defaultWidth:n,min:o,max:s,reverse:i=!1,axis:r="x",applyLive:l}=e;function a(D){return Number.isFinite(D)?Math.min(Rh(s),Math.max(o,Math.round(D))):n}const u=Z(a(xhe(t)??n)),c=Z(!1);function d(D){const I=D<=o,$=D>=Rh(s),B=r==="x"?"col-resize":"row-resize";if(I&&$)return B;const[H,O]=r==="x"?["e-resize","w-resize"]:["s-resize","n-resize"];return $?i?H:O:I?i?O:H:B}const f=Z(null),h=R(()=>d(f.value??u.value));function m(D){typeof document>"u"||(document.body.style.cursor=d(D))}function v(D){const I=a(D);u.value=I,$x(t,I)}Je(()=>Rh(s),D=>{!c.value&&u.value>D&&v(D)});let k=0,w=0,b=null,_=-1,g=0,x=0,S=0;function T(){if(x=0,!c.value)return;const D=g-k;S=a(w+(i?-D:D)),f.value=S,m(S),l?l(S):u.value=S}function A(D){if(c.value&&(g=r==="x"?D.clientX:D.clientY,x===0)){if(typeof requestAnimationFrame!="function"){T();return}x=requestAnimationFrame(T)}}function E(){if(c.value){if(x!==0&&(cancelAnimationFrame(x),T()),c.value=!1,l?v(S):$x(t,u.value),f.value=null,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),b){try{b.releasePointerCapture(_)}catch{}b.removeEventListener("pointermove",A),b.removeEventListener("pointerup",E),b.removeEventListener("pointercancel",E)}b=null,_=-1}}function P(D){D.preventDefault(),c.value=!0,k=r==="x"?D.clientX:D.clientY,w=a(u.value),S=w,b=D.currentTarget,_=D.pointerId,typeof document<"u"&&(document.body.style.userSelect="none"),m(w);try{b.setPointerCapture(_)}catch{}b.addEventListener("pointermove",A),b.addEventListener("pointerup",E),b.addEventListener("pointercancel",E)}return Vn(E),{width:u,dragging:c,cursor:h,clamp:a,setWidth:v,onPointerDown:P}}const Hr=Z(null),Zd=Z(!1),Ahe=R(()=>Hr.value!==null);function R5(e){const t=Hr.value;!t||Zd.value||(Hr.value=null,t.resolve(e))}async function Mhe(){const e=Hr.value;if(!(!e||Zd.value)){if(!e.action){R5(!0);return}Zd.value=!0;try{await e.action(),Hr.value===e&&(Hr.value=null),e.resolve(!0)}catch(t){Hr.value===e&&(Hr.value=null),e.reject(t)}finally{Zd.value=!1}}}function The(e){return Zd.value?Promise.resolve(!1):(Hr.value&&R5(!1),new Promise((t,n)=>{Hr.value={...e,resolve:t,reject:n}}))}function hu(){return{current:Hr,busy:Zd,isConfirmOpen:Ahe,confirm:The,settle:R5,runAction:Mhe}}function Ehe(e){const{sessionId:t}=e;function n(u){return ui(eC(u))??""}function o(u,c){const d=eC(u);c?Ls(d,c):ur(d)}const s=Z(n(t())),i=Z(null);function r(){const u=i.value;u&&(u.style.height="auto",u.style.height=`${u.scrollHeight}px`)}Je(s,u=>{yt(r),o(t(),u)}),Je(t,(u,c)=>{u!==c&&(o(c,s.value),s.value=n(u),yt(r))});function l(u){s.value=u,yt(()=>{const c=i.value;if(!c)return;c.focus();const d=u.length;c.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function Ihe(e){return e?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0:!1}function Lhe(e){const{sessionId:t,mobile:n,starting:o,dockedComposer:s,emptyComposer:i}=e,r=Z(!1);Je(t,()=>{n()||(r.value=!0)}),Je([r,s,i,o],()=>{if(!r.value)return;const l=s.value??i.value;if(!l)return;const a=typeof document<"u"?document.activeElement:null;if(Ihe(a)){r.value=!1;return}l.focus(),(typeof document>"u"||document.activeElement!==a)&&(r.value=!1)},{flush:"post"})}const _g=100;function $he(e){const t=y1(cn.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>_g?n.slice(-_g):n,s={[e]:o};return Tc(cn.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function Nhe(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=Z($he(s())),r=R(()=>i.value[s()??""]??[]);let l=-1,a="";function u(w){const b=s();if(l=-1,!b)return;const _=w.trim();if(!_)return;const g=i.value[b]??[];if(g.at(-1)===_)return;const x=[...g,_],S=x.length>_g?x.slice(-_g):x;i.value={...i.value,[b]:S},Tc(cn.inputHistory,i.value)}function c(){const w=n.value;return w?(w.selectionStart??0)===0:!1}function d(w){t.value=w,yt(()=>{const b=n.value;if(!b)return;o();const _=w.length;b.setSelectionRange(_,_)})}function f(){const w=r.value;if(w.length!==0){if(l===-1)a=t.value,l=w.length-1;else if(l>0)l-=1;else return;d(w[l])}}function h(){if(l===-1)return;const w=r.value;l0}return Je(s,()=>{l=-1}),{push:u,caretAtTextStart:c,recallOlder:f,recallNewer:h,resetBrowsing:m,isBrowsing:v,hasHistory:k}}function Fhe(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),u=Z([]),c=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(u.value=mQ(h,CE(s())),c.value=0,a.value=u.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const m=n.value;if(!m)return;const v=t.value.length;m.setSelectionRange(v,v),m.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:u,active:c,update:d,select:f}}function Rhe(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let u=null;function c(){const h=t.value,m=n.value?.selectionStart??h.length;let v=m-1;for(;v>=0&&!/\s/.test(h[v]);)v--;v++;const k=h.slice(v,m);return k.startsWith("@")?{token:k.slice(1),start:v,end:m}:null}function d(){const h=c(),m=s();if(u!==null&&clearTimeout(u),!h||!m||h.token.length===0){i.value=!1,a.value=!1;return}const v=h.token;u=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;const k=()=>{const w=c();return w!==null&&w.token===v&&i.value};try{const w=await m(v);k()&&(r.value=w)}catch{k()&&(r.value=[])}finally{k()&&(a.value=!1)}},200)}function f(h){const m=c();if(!m)return;const v=t.value;t.value=v.slice(0,m.start)+h.path+v.slice(m.end),i.value=!1,yt(()=>{const k=n.value;if(!k)return;const w=m.start+h.path.length;k.setSelectionRange(w,w),k.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}const Ohe="kimi-web.file-preview-width",gd=320;function Phe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=eN(),i=R(()=>Math.max(0,s.value-t.value)),r=R(()=>Q$(i.value,gd,gd));function l(Y){return v8(Math.round(Y),gd,r.value)}function a(){return l(i.value/2)}const u=R(()=>a()),c=Z(u.value),d=R(()=>v8(c.value,gd,r.value)),f=Z(null),h=R(()=>{const Y=f.value;if(!Y)return null;const fe=e.turns.value.find(we=>we.id===Y.turnId);return fe?.role==="compaction"&&fe.text?fe.text:null}),m=R(()=>h.value!==null);function v(Y){if(f.value?.turnId===Y.turnId){f.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",f.value=Y}function k(){f.value=null,n.value==="compaction"&&(n.value=null)}const w=Z(null),b=R(()=>{const Y=w.value;if(!Y)return{entry:void 0,version:0};const fe=e.auxiliaryTranscripts.getEntry(Y.sessionId,Y.subagentId);return{entry:fe,version:fe?.version.value??0}});function _(Y){const fe=e.turns.value.flatMap(we=>we.tools??[]).find(we=>we.agentId===Y);if(!fe)return{};try{const we=JSON.parse(fe.arg);return{name:typeof we.description=="string"?we.description:void 0,subagentType:typeof we.subagent_type=="string"?we.subagent_type:void 0,status:fe.status,outputLines:fe.output}}catch{return{}}}const g=R(()=>{const Y=w.value;if(!Y)return null;const fe=e.activeAppTasks.value.find(Fe=>Fe.agentId===Y.subagentId||Fe.id===Y.subagentId);if(fe)return UY(fe);const we=b.value.entry?.channel,ge=we?.agents.find(Fe=>Fe.agentId===Y.subagentId),Q=we?.refreshError??!1,te=we===void 0||we.loading,ce=we?.snapshot.meta.activity==="turn",ue=_(Y.subagentId),Se=we?.snapshot.items.findLast(Fe=>Fe.kind==="turn"),ze=Se?.kind==="turn"&&Se.state==="cancelled",_e=Se?.kind==="turn"&&Se.state==="failed"||ue.status==="error",Ee=ce?"working":_e||ze?"failed":te?"queued":Q&&ue.status===void 0?"failed":"completed",it=ce?"running":ze?"cancelled":_e?"failed":te?"running":Q&&ue.status===void 0?"failed":"completed";return{id:Y.subagentId,name:ge?.label??ue.name??Y.subagentId,subagentType:ue.subagentType??(ge?.type==="sub"?"subagent":ge?.type),phase:Ee,status:it,outputLines:ue.outputLines}}),x=R(()=>{const Y=b.value.entry;if(!Y)return[];const fe=w.value,we=Y.channel.agents.find(ge=>ge.agentId===fe?.subagentId);return nX(Y.channel.snapshot,e.getFileUrl,we)}),S=R(()=>b.value.entry?.channel.loading??!1),T=R(()=>b.value.entry?.channel.refreshError??!1),A=R(()=>b.value.entry?.channel.loadingOlder??!1),E=R(()=>b.value.entry?.channel.loadOlderError??!1),P=R(()=>b.value.entry?.channel.snapshot.hasMoreOlder??!1),D=R(()=>b.value.entry?.channel.snapshot.meta.activity==="turn"),I=R(()=>g.value!==null);function $(Y){const fe=e.activeSessionId.value;if(!(!Y||!fe)){if(n.value==="agent"&&w.value?.sessionId===fe&&w.value.subagentId===Y){B();return}w.value={sessionId:fe,subagentId:Y},n.value="agent",e.auxiliaryTranscripts.activate(fe,Y)}}function B(){const Y=w.value;Y&&e.auxiliaryTranscripts.deactivate(Y.sessionId,Y.subagentId),w.value=null,n.value==="agent"&&(n.value=null)}Je(n,(Y,fe)=>{if(fe!=="agent"||Y==="agent")return;const we=w.value;we&&e.auxiliaryTranscripts.deactivate(we.sessionId,we.subagentId)});function H(){const Y=b.value.entry;Y&&Y.channel.loadOlder().catch(()=>{})}const O=Z("list"),F=Z(null);function U(){if(n.value==="diff"){z();return}n.value="diff",O.value="list",F.value=null,e.loadGitStatus(e.activeSessionId.value)}function z(){n.value==="diff"&&(n.value=null),O.value="list",F.value=null,e.clearFileDiff()}async function W(Y){O.value="detail",F.value=Y,await e.loadFileDiff(Y)}const K=Xr(null);function V(Y){if(K.value===Y&&n.value==="turn-diff"){ie();return}K.value=Y,n.value="turn-diff"}function ie(){K.value=null,n.value==="turn-diff"&&(n.value=null)}async function ne(Y){if(!e.activeSessionId.value&&e.activeWorkspaceId.value){const fe=await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,Y);return n.value="btw",fe}return await e.openSideChat(Y),n.value="btw",null}function X(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function le(){n.value==="btw"&&(n.value=null)}const Ie=R(()=>e.sideChatVisible.value),de=R(()=>n.value!==null&&(n.value!=="compaction"||m.value)&&(n.value!=="agent"||I.value)&&(n.value!=="btw"||Ie.value)),pe=Z(!1),ve=Z({});function oe(){switch(n.value){case"compaction":return f.value?{kind:"compaction",...f.value}:null;case"agent":return w.value?{kind:"agent",...w.value}:null;case"btw":return{kind:"btw"};default:return null}}function ye(Y){if(Y)switch(Y.kind){case"compaction":f.value={turnId:Y.turnId},n.value="compaction";break;case"agent":e.activeSessionId.value&&(w.value={sessionId:e.activeSessionId.value,subagentId:Y.subagentId},n.value="agent",e.auxiliaryTranscripts.activate(e.activeSessionId.value,Y.subagentId));break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="compaction"&&m.value?(k(),!0):n.value==="agent"&&I.value?(B(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(z(),!0):n.value==="turn-diff"?(ie(),!0):n.value==="btw"?(X(),!0):!1}return Je(e.activeSessionId,(Y,fe)=>{if(fe){const we=oe();we?ve.value[fe]=we:delete ve.value[fe]}o(),k(),B(),z(),ie(),le(),Y&&ye(ve.value[Y])}),{PREVIEW_WIDTH_KEY:Ohe,PREVIEW_MIN:gd,previewDefaultWidth:u,previewMax:r,previewWidth:c,previewPanelWidth:d,compactionPanelText:h,compactionPanelVisible:m,openCompactionPanel:v,closeCompactionPanel:k,agentPanelMember:g,agentPanelTurns:x,agentPanelLoading:S,agentPanelLoadError:T,agentPanelLoadingMore:A,agentPanelLoadMoreError:E,agentPanelHasMore:P,agentPanelRunning:D,agentPanelVisible:I,openAgentPanel:$,closeAgentPanel:B,loadOlderAgentMessages:H,detailDiffMode:O,detailDiffPath:F,openDiffDetail:U,closeDiffDetail:z,selectDiffFile:W,turnDiffChange:K,openTurnDiff:V,closeTurnDiff:ie,btwVisible:Ie,openSideChatTab:ne,closeSideChat:X,hideSideChatPanel:le,sidePanelVisible:de,panelDragging:pe,closeOpenSidePanel:G}}const Dhe=cn.sidebarWidth,Nx=cn.sidebarCollapsed,Fx=270,v4=220,Bhe=480,Hhe=320;function zhe(e={}){const{viewportWidth:t}=eN(),n=Z(Fx),o=Z(!1),s=Z(!1),i=R(()=>{const c=Hhe+(Rh(e.previewOpen)?gd:0);return Math.min(Bhe,Q$(t.value,v4,c))}),r=R(()=>v8(n.value,v4,i.value));function l(){try{o.value=ui(Nx)==="true"}catch{o.value=!1}}function a(){try{Ls(Nx,String(o.value))}catch{}}function u(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:Dhe,SIDEBAR_DEFAULT:Fx,SIDEBAR_MIN:v4,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:u}}const Whe=40409;function Rx(e){return Us(e)&&e.code===Whe}function Ox(e){return e.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function Px(e){if(e.startsWith("\\\\"))return e;const t=/^[a-zA-Z]:/.test(e)?e.slice(0,2):"",n=[];for(const o of e.slice(t.length).split(/[\\/]+/))if(!(!o||o===".")){if(o===".."){n.pop();continue}n.push(o)}return t?`${t}/${n.join("/")}`:`/${n.join("/")}`}function Uhe({client:e,detailTarget:t,t:n}){const o=Z(null),s=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0;const u=R(()=>{const g=l.value;return g?e.getFileDownloadUrl(g):null}),c=R(()=>o.value!==null&&l.value!==null);function d(g){return g.length>1?g.replace(/\/+$/,""):g}function f(g){const x=h2(g,e.status.value.cwd);return x===null||x.split(/[\\/]+/).includes("..")?null:h(x)||null}function h(g){const x=[];for(const S of g.split(/[\\/]+/))if(!(!S||S===".")){if(S===".."){x.pop();continue}x.push(S)}return x.join("/")}function m(g){const x=g.trim();if(!x)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(x))return{error:n("filePreview.errors.unsupportedPath")};if(x.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const S=d(e.status.value.cwd);if(x.startsWith("/")){if(!S||x!==S&&!x.startsWith(`${S}/`))return{error:n("filePreview.errors.outsideWorkspace")};const A=x===S?"":x.slice(S.length+1);if(A.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const E=h(A);return E?{path:E}:{error:n("filePreview.errors.isDirectory")}}if(x.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const T=h(x);return T?{path:T}:{error:n("filePreview.errors.emptyPath")}}async function v(g){const x=o.value;if(t.value==="file"&&x&&x.path===g.path&&x.line===g.line){w();return}const S=++a;if(t.value="file",s.value=null,r.value=null,i.value=!0,o.value=g,l.value=null,typeof g.content=="string"){i.value=!1,s.value={path:g.path,content:g.content,encoding:"utf-8",mime:"text/markdown",isBinary:!1,size:g.content.length};return}if(!Ox(g.path)&&g.path.split(/[\\/]+/).includes("..")){const A=d(e.status.value.cwd);A&&(g={...g,path:Px(`${A}/${g.path}`)})}if(Ox(g.path)){g={...g,path:Px(g.path)};const A=f(g.path);if(A!==null)g={...g,path:A};else{try{const E=await e.readHostFileContent(g.path);if(S!==a)return;l.value=null,s.value={path:g.path,content:E.content,encoding:E.encoding,mime:E.mime,isBinary:E.isBinary,size:E.size}}catch(E){if(S!==a)return;r.value=Rx(E)?n("filePreview.errors.notFound"):pU(E)?n("filePreview.errors.tooLarge"):E instanceof Error?E.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}return}}const T=m(g.path);if("error"in T){i.value=!1,r.value=T.error;return}l.value=T.path;try{const A=await e.readFileContent(T.path);if(S!==a)return;A?s.value={...A,path:A.path||T.path}:r.value=n("filePreview.errors.loadFailed")}catch(A){if(S!==a)return;r.value=Rx(A)?n("filePreview.errors.notFound"):A instanceof Error?A.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}}function k(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1}function w(){k(),t.value==="file"&&(t.value=null)}Je(t,(g,x)=>{x==="file"&&g!=="file"&&k()});function b(){const g=s.value?.path??o.value?.path;g&&e.openWorkspaceFile(g,o.value?.line)}function _(){const g=s.value?.path??o.value?.path;g&&e.revealWorkspaceFile(g)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:u,previewExternalActions:c,openFilePreview:v,closeFilePreview:w,openPreviewInEditor:b,revealPreviewFile:_}}function jhe({running:e,title:t="Kimi Code"}){if(Wp){I4(()=>{typeof document<"u"&&(document.title=t)});return}const n=["◐","◓","◑","◒"],o=Z(0);let s=null;function i(){s===null&&(o.value=0,s=setInterval(()=>{o.value=(o.value+1)%n.length},250))}function r(){s!==null&&(clearInterval(s),s=null),o.value=0}Je(e,a=>{a?i():r()},{immediate:!0});const l=R(()=>`${e.value?`${n[o.value]} `:""}${t}`);I4(()=>{typeof document<"u"&&(document.title=l.value)}),bn(()=>{r()})}const Vhe=50,am=5,O5=5,xg=50,qhe=40401,Khe=40402,Zhe=40410,Ghe=40409,Yhe=40902,Xhe=2e3,Jhe=10;function y4(e){return Us(e)&&e.code===Yhe}const Qhe=40904;function eme(e){return Us(e)&&e.code===Qhe}const Hu=Go({}),Lh=Go({}),k4=Go({}),cl=Go(new Set),N2=new Map,wc=new Map,Sg=new Map;let tme=0;const ju=new Map,nme=3;let Dx=0;function ome(){return Dx+=1,`${Date.now().toString(36)}-${Dx}`}function sme(e){return{generation:N2.get(e)??0,pending:(wc.get(e)?.size??0)>0}}function y8(e){const t=++tme;N2.set(e,t);const n=wc.get(e)??new Set;return n.add(t),wc.set(e,n),t}function k8(e,t){const n=wc.get(e);if(n===void 0||(n.delete(t),n.size>0))return;wc.delete(e);const o=Sg.get(e);Sg.delete(e),o?.()}function ime(e){N2.delete(e),wc.delete(e),Sg.delete(e),ju.delete(e)}function rme(e,t){return!t.pending&&t.generation===(N2.get(e)??0)}function lme(e,t){if((wc.get(e)?.size??0)===0){t();return}Sg.set(e,t)}function ame(e,t){const{t:n}=Hn.global,{confirm:o}=hu(),{taskPoller:s,sideChat:i,modelProvider:r,pushOperationFailure:l,activity:a,sessionsKnownEmpty:u,setSessions:c,updateSession:d,upsertSessionFront:f,appendSession:h,forgetSession:m,unpinSessions:v,setActiveSessionId:k,updateSessionMessages:w,nextOptimisticMsgId:b,getEventConn:_,syncSessionFromSnapshot:g,reopenSession:x,hasLoadedMessages:S,refreshSessionStatus:T,refreshSessionGoal:A,refreshSessionPlans:E,persistSessionProfile:P,mergedWorkspaces:D,workspacesView:I,status:$,workspaceIdForSession:B,savePermissionToStorage:H,savePlanModeToStorage:O,saveSwarmModeToStorage:F,saveGoalModeToStorage:U,draftModes:z,saveUnread:W,saveActiveWorkspaceToStorage:K,saveHiddenWorkspacesToStorage:V,goalErrorMessage:ie,initialized:ne,connectIssue:X,selectedDiffPath:le,fileDiffLines:Ie,fileDiffLoading:de,fileDiffTexts:pe,fileDiffEmptyFile:ve}=t;let oe=!1,ye=0;function G(se,xe,J,Ce){w(se,$e=>{const He=$e.findIndex(Et=>Et.id===xe);if(He===-1)return $e;const vt=$e.findIndex((Et,ln)=>ln!==He&&Et.role==="user"&&(Et.id===Ce||Et.userMessageId===Ce||Et.promptId===J)),ut=$e[He],Dt=vt===-1?ut:$e[vt];return $e.flatMap((Et,ln)=>ln===vt?[]:ln!==He?[Et]:[{...Dt,id:ut.id,promptId:J,userMessageId:Ce,metadata:{...Dt.metadata,...ut.metadata}}])})}async function Y(se){if(e.messagesLoadingMoreBySession[se])return;const xe=e.messagesBySession[se];if(!xe||xe.length===0)return;const J=xe[0].id;e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!0},e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!1};try{const Ce=await _t().listMessages(se,{beforeId:J,pageSize:Vhe}),$e=[...Ce.items].reverse();w(se,He=>[...$e,...He]),e.messagesHasMoreBySession={...e.messagesHasMoreBySession,[se]:Ce.hasMore}}catch(Ce){e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!0},l("loadOlderMessages",Ce,{sessionId:se})}finally{e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!1}}}function fe(se,xe){s.loadTasksForSession(se),Q(se),xe?.skipStatus!==!0&&T(se),A(se),E(se),Object.prototype.hasOwnProperty.call(r.skillsBySession.value,se)||r.loadSkillsForSession(se)}async function we(se){const xe=e.activeSessionId;if(xe){le.value=se,Ie.value=[],pe.value=null,ve.value=!1,de.value=!0;try{const Ce=await _t().getFileDiff(xe,se);if(le.value!==se||e.activeSessionId!==xe)return;const $e=wX(Ce.diff);if(Ie.value=$e,$e.length===0){const vt=await Ei(se).catch(()=>null);if(le.value!==se||e.activeSessionId!==xe)return;ve.value=vt!==null&&vt.size===0;return}de.value=!1;const He=await cX($e,{truncated:Ce.truncated,readNewText:async()=>{const vt=await Ei(se).catch(()=>null);return!vt||vt.isBinary||vt.encoding!=="utf-8"?null:vt.content}});if(le.value!==se||e.activeSessionId!==xe)return;pe.value=He}catch(J){le.value===se&&(Ie.value=[]),gl("[loadFileDiff] diff unavailable for",se,J)}finally{le.value===se&&(de.value=!1)}}}function ge(){le.value=null,Ie.value=[],pe.value=null,ve.value=!1,de.value=!1}async function Q(se){try{const J=await _t().getGitStatus(se);e.gitStatusBySession={...e.gitStatusBySession,[se]:J}}catch{}}let te=0;async function ce(se){try{const xe=await _t().getUserInfo();if(se!==te||e.managedProviderStatus!=="authenticated")return;e.managedUserInfo=xe.kind==="ok"?xe.userInfo:null,xe.kind==="ok"?e.managedMembership=xe.userInfo.userLevel===Jhe?"free":"member":e.managedMembership=xe.status===402?"free":null}catch{if(se!==te)return;e.managedProviderStatus==="authenticated"&&(e.managedUserInfo=null,e.managedMembership=null)}}async function ue(){e.managedProviderStatus==="authenticated"&&await ce(++te)}async function Se(){const se=++te;try{const J=await _t().getAuth();return e.authReady=J.ready,e.defaultModel=J.defaultModel,e.managedProviderStatus=J.managedProvider?.status??null,e.managedProviderStatus==="authenticated"?ce(se):(e.managedUserInfo=null,e.managedMembership=null),X.value=null,"proceed"}catch(xe){return Us(xe)&&(xe.code===401||xe.code===PM)?(X.value=null,"server-auth-required"):(X.value=(xe instanceof Error?xe.message:String(xe)).slice(0,140),"retry")}}async function ze(){let se=!0;for(;;){const xe=await Se();if(xe!=="retry")return xe;se&&(X.value=null,se=!1),await new Promise(J=>{setTimeout(J,Xhe)})}}async function _e(){try{const se=_t();e.config=await se.getConfig()}catch{}}async function Ee(se){try{const J=await _t().setConfig(se);return e.config=J,e.defaultModel=J.defaultModel??null,!0}catch(xe){return l("setConfig",xe),!1}}const it=100,Fe=720*60*1e3;async function Oe(se){const xe=_t(),J=[];let Ce,$e;for(;se?.shouldContinue?.()!==!1;){let He;try{He=await xe.listSessions({pageSize:it,beforeId:Ce,excludeEmpty:!0})}catch(vt){if(J.length===0)throw vt;$e=vt;break}if(J.push(...He.items),!He.hasMore||He.items.length===0)break;Ce=He.items[He.items.length-1].id}return{sessions:J,error:$e}}function Ge(se){const xe=new Map(e.sessions.map(J=>[J.id,J]));c(se.map(J=>{const Ce=xe.get(J.id);if(Ce===void 0)return J;const $e=o3(J.usage)&&!o3(Ce.usage),He=J.pullRequest??Ce.pullRequest;return!$e&&He===J.pullRequest?J:{...J,usage:$e?Ce.usage:J.usage,pullRequest:He}}))}function at(se){const xe=[...se],J=new Set(xe.map(Ce=>Ce.id));for(const Ce of e.sessions)J.has(Ce.id)||(xe.push(Ce),J.add(Ce.id));return xe.sort((Ce,$e)=>new Date($e.updatedAt).getTime()-new Date(Ce.updatedAt).getTime()),xe}async function Tt(se){const xe=_t(),J=[],Ce=Date.now(),$e=Et=>Ce-new Date(Et.updatedAt).getTime();let He,vt=!1,ut=!0,Dt;for(;;){let Et;try{Et=await xe.listSessions({workspaceId:se,pageSize:am,beforeId:He,excludeEmpty:!0})}catch(Ot){if(ut)throw Ot;Dt=Ot,vt=!0;break}if(vt=Et.hasMore,Et.items.length===0)break;const ln=Et.items[Et.items.length-1],oo=$e(ln)>=Fe;if(!ut&&oo){const Ot=Et.items.findIndex(Yn=>$e(Yn)>=Fe),Pt=Ot>=0?Ot+1:Et.items.length;J.push(...Et.items.slice(0,Pt)),vt=Et.hasMore||PtTt(Ot.id))),J=[],Ce=new Set,$e=new Map,He=new Set;let vt;for(let Ot=0;OtHe.has(Ot.id)).map(Ot=>Ot.root)),Dt=new Set(se.map(Ot=>Ot.id));for(const Ot of e.sessions)!(Ot.workspaceId!==void 0&&Dt.has(Ot.workspaceId)?He.has(Ot.workspaceId):ut.has(Ot.cwd)||He.has(B(Ot)))||Ce.has(Ot.id)||(J.push(Ot),Ce.add(Ot.id));const Et={},ln={},oo={};for(const{id:Ot}of se){const Pt=$e.get(Ot);if(Pt===void 0){const Yn=e.sessionsHasMoreByWorkspace[Ot],ko=e.sessionsCursorByWorkspace[Ot],vs=e.sessionsInitialCountByWorkspace[Ot];Yn!==void 0&&(Et[Ot]=Yn),ko!==void 0&&(ln[Ot]=ko),vs!==void 0&&(oo[Ot]=vs);continue}Et[Ot]=Pt.hasMore,ln[Ot]=Pt.items.length>0?Pt.items[Pt.items.length-1].id:void 0,oo[Ot]=Math.max(Pt.items.length,am)}return e.sessionsHasMoreByWorkspace=Et,e.sessionsCursorByWorkspace=ln,e.sessionsInitialCountByWorkspace=oo,e.sessionsFullyLoaded=!1,J.sort((Ot,Pt)=>new Date(Pt.updatedAt).getTime()-new Date(Ot.updatedAt).getTime()),He.size>0&&l("load",vt),J}async function Yt(se){if(!e.sessionsLoadingMoreByWorkspace[se]&&e.sessionsHasMoreByWorkspace[se]!==!1&&e.sessionsCursorByWorkspace[se]!==void 0){e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!0};try{let xe=e.sessionsCursorByWorkspace[se],J;for(let He=0;He<3&&xe!==void 0&&(J=await _t().listSessions({workspaceId:se,pageSize:O5,beforeId:xe,excludeEmpty:!0}),e.sessionsCursorByWorkspace[se]!==xe);He+=1)J=void 0,xe=e.sessionsCursorByWorkspace[se];if(J===void 0)return;const Ce=new Set(e.sessions.map(He=>He.id)),$e=J.items.filter(He=>!Ce.has(He.id));$e.length>0&&c([...e.sessions,...$e]),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:J.items.length>0?J.items[J.items.length-1].id:xe},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:J.hasMore}}catch(xe){l("loadMoreSessions",xe)}finally{e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!1}}}}function Sn(se){return e.sessions.filter(xe=>!xe.parentSessionId&&B(xe)===se)}const on=5;function en(se,xe){const J=new Set(e.sessions.map(He=>He.id)),Ce=se.items.filter(He=>!J.has(He.id)&&(He.meta.last_prompt??"").length>0).map(kU);Ce.length>0&&c([...e.sessions,...Ce]);for(const He of se.items)if(J.has(He.id)&&He.git!==void 0){const vt=He.git.pull_request;d(He.id,ut=>ut.pullRequest===vt?ut:{...ut,pullRequest:vt})}if(se.items.length>0){const He=Math.min(...se.items.map(vt=>vt.meta.updated_at));e.flatSessionsFrontier=xe?.resetFrontier===!0||e.flatSessionsFrontier===null?He:Math.min(e.flatSessionsFrontier,He)}e.flatSessionsNextPageToken=se.nextPageToken,e.flatSessionsHasMore=se.hasMore;const $e=new Set(I.value.map(He=>He.id));return se.items.filter(He=>(He.meta.last_prompt??"").length>0&&$e.has(B({workspaceId:He.workspace.id,cwd:He.workspace.cwd??""}))).length}async function Cn(){const se=await _t().listSessionsV2({pageSize:xg,include:"git"});en(se,{resetFrontier:!0}),e.flatSessionsSeeded=!0}async function Mn(){if(!(e.flatSessionsSeeded||e.flatSessionsLoading)){e.flatSessionsLoading=!0;try{await Cn()}catch(se){l("ensureFlatSessions",se)}finally{e.flatSessionsLoading=!1}}}async function We(){if(!(e.flatSessionsLoading||e.flatSessionsLoadingMore)&&e.flatSessionsHasMore){e.flatSessionsLoadingMore=!0;try{if(!e.flatSessionsSeeded){await Cn();return}if(e.flatSessionsNextPageToken===null)return;for(let se=0;se0)break}}catch(se){l("loadMoreFlatSessions",se)}finally{e.flatSessionsLoadingMore=!1}}}async function tt(se,xe,J,Ce){if(e.sessionsCursorByWorkspace[se]===xe){const He=new Date(J).getTime();let vt;for(const ut of e.sessions){if(B(ut)!==se)continue;const Dt=new Date(ut.updatedAt).getTime();Dt<=He||(vt===void 0||Dt0&&Sn(se).lengthln.id)),Et=ut.items.filter(ln=>!Dt.has(ln.id));Et.length>0&&c([...e.sessions,...Et].sort((ln,oo)=>new Date(oo.updatedAt).getTime()-new Date(ln.updatedAt).getTime())),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:ut.items.length>0?ut.items[ut.items.length-1].id:void 0},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:ut.hasMore}}catch(ut){l("loadMoreSessions",ut);break}else await Yt(se);if($e-=1,Sn(se).length===vt&&e.sessionsCursorByWorkspace[se]===He)break}}async function Ue(){if(e.sessionsFullyLoaded)return;const se=await Oe().catch(Ce=>(gl("[kimi-web] loadAllSessions failed; search covers only loaded sessions",Ce),null));if(se===null)return;const xe=se.error===void 0?se.sessions:at(se.sessions);if(Ge(xe),e.sessionsFullyLoaded=se.error===void 0,se.error!==void 0)return;const J={};for(const Ce of e.workspaces)J[Ce.id]=!1;e.sessionsHasMoreByWorkspace=J}async function Lt(){const se=await _t().getMeta().catch(()=>null);se!==null&&(e.serverVersion=se.serverVersion,e.availableOpenInApps=se.openInApps,e.dangerousBypassAuth=se.dangerousBypassAuth,e.experimentalFlags=se.experimentalFlags,e.backend=se.backend)}async function gt(){const se=Date.now();let xe="accepted";bi("app:load:start"),e.loading=!0;const J=!ne.value;let Ce=!0;try{if(J&&await ze()==="server-auth-required"){Ce=!1,xe="auth-required";return}const $e=_t();await Promise.all([$e.getHealth().catch(()=>null),Lt(),r.loadModels()]),J||await Se(),await _e(),await wn();const He=await Bt(),vt=He??e.sessions;if(He!==void 0&&Ge(He),!J&&He!==void 0&&e.flatSessionsSeeded){e.flatSessionsSeeded=!1,e.flatSessionsNextPageToken=null,e.flatSessionsHasMore=!0,e.flatSessionsFrontier=null;try{await Cn()}catch(Ot){l("ensureFlatSessions",Ot)}}const ut=_E().filter(Ot=>!e.sessions.some(Pt=>Pt.id===Ot));if(ut.length>0){const Ot=await Promise.all(ut.map(Yn=>$s(Yn))),Pt=ut.filter((Yn,ko)=>Ot[ko]==="stale");Pt.length>0&&v(Pt)}const Dt=vt[0],Et=e.activeWorkspaceId;!(Et!==null&&D.value.some(Ot=>Ot.id===Et))&&Dt&&go(B(Dt)),Oo();const oo=typeof window<"u"?Qb(window.location):void 0;!e.activeSessionId&&oo!==void 0&&(e.sessions.some(Pt=>Pt.id===oo)||await no(oo))&&await vo(oo,{urlMode:"replace"}),!e.activeSessionId&&vt.length>0&&await vo(vt[0].id,{urlMode:"replace"})}catch($e){xe="failed",l("load",$e)}finally{e.loading=!1,Ce&&(ne.value=!0),bi("app:load:complete",{status:xe,sessionId:e.activeSessionId,sessionCount:e.sessions.length,workspaceCount:e.workspaces.length,durationMs:Date.now()-se})}}async function wn(){try{const se=_t(),[xe,J]=await Promise.all([se.listWorkspaces().catch(()=>[]),se.getFsHome().catch(()=>({home:"",recentRoots:[]}))]);e.workspaces=yn(xe),e.fsHome=J.home||null,e.recentRoots=J.recentRoots}catch{}}function yn(se){const xe=lh();return Object.keys(xe).length===0?se:se.map(J=>{const Ce=xe[J.root];return Ce!==void 0?{...J,name:Ce}:J})}function go(se){e.activeWorkspaceId=se,K(se)}function qt(se){go(se);const xe=e.sessions.filter(J=>B(J)===se);if(xe.length>0){const J=xe[0];J&&J.id!==e.activeSessionId&&vo(J.id)}else k(void 0),Nn(void 0,"push")}function ps(se){const xe=lh()[se.root],J=xe!==void 0?{...se,name:xe}:se,Ce=Pr(J.root);e.hiddenWorkspaceRoots.some(vt=>Pr(vt)===Ce)&&(e.hiddenWorkspaceRoots=e.hiddenWorkspaceRoots.filter(vt=>Pr(vt)!==Ce),V(e.hiddenWorkspaceRoots));const $e=e.workspaces.findIndex(vt=>vt.id===J.id||vt.root===J.root);if($e===-1){e.workspaces=[J,...e.workspaces];return}const He=[...e.workspaces];He[$e]=J,e.workspaces=He}function xs(se){if(se.type==="workspaceCreated"||se.type==="workspaceUpdated"){ps(se.workspace);return}const xe=e.workspaces.find(Ce=>Ce.id===se.workspaceId)?.root??se.root;if(xe&&!e.hiddenWorkspaceRoots.includes(xe)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,xe],V(e.hiddenWorkspaceRoots)),e.workspaces=e.workspaces.filter(Ce=>Ce.id!==se.workspaceId&&Ce.root!==xe),e.activeWorkspaceId===se.workspaceId||e.activeWorkspaceId===xe){const Ce=I.value[0]?.id??null;if(e.activeWorkspaceId=Ce,Ce)K(Ce);else try{ur(cn.activeWorkspace)}catch{}k(void 0),e.sessionLoading=!1,ge(),Nn(void 0,"replace")}}function _n(){k(void 0),Nn(void 0,"push")}function In(se){go(se),_n(),ge()}async function To(se){const xe=D.value.find(ln=>ln.id===se);if(!xe)return null;const J=e.thinking,Ce=_t();let $e,He=xe.root;try{const ln=await Ce.addWorkspace({root:xe.root});$e=ln.id,He=ln.root,ps(ln)}catch{}const vt=r.draftModel.value??void 0,ut=await Ce.createSession({workspaceId:$e,cwd:He,model:vt});r.draftModel.value=null;const Dt=vt!==void 0&&(!ut.model||ut.model.length===0)?{...ut,model:vt}:ut;f(Dt);const Et=ut.id;return J!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[Et]:J},k3(e,Et)),go(ut.workspaceId??$e??se),await vo(ut.id,{skipStatusRefresh:!0}),z.planMode&&(e.planModeBySession={...e.planModeBySession,[Et]:!0},O()),z.swarmMode&&(e.swarmModeBySession={...e.swarmModeBySession,[Et]:!0},F()),z.goalMode&&(e.goalModeBySession={...e.goalModeBySession,[Et]:!0},U()),z.planMode=!1,z.swarmMode=!1,z.goalMode=!1,Et}async function lo(se,xe,J){if(cl.has(se))return null;cl.add(se);let Ce=null;try{const $e=await To(se);return $e?(Ce=$e,await Po($e,xe,J),$e):null}catch($e){return l("startSessionAndSendPrompt",$e),Ce}finally{cl.delete(se)}}async function St(se,xe,J,Ce){if(cl.has(se))return null;cl.add(se);let $e=null;try{const He=await To(se);if(!He)return null;$e=He;const vt=e.planModeBySession[He]??!1,ut=e.swarmModeBySession[He]??!1,Dt=e.sessions.find(Ot=>Ot.id===He),Et=(Dt?.model&&Dt.model.length>0?Dt.model:e.defaultModel)??void 0,ln=await r.resolveThinkingForPrompt(He,Et)??e.thinking;return await P({model:Et,planMode:vt,swarmMode:ut,permissionMode:e.permission,thinking:ln},He)&&await r.activateSkill(xe,J,Ce,He,{skipThinkingPersist:!0}),He}catch(He){return l("startSessionAndActivateSkill",He),$e}finally{cl.delete(se)}}async function hs(se,xe){if(cl.has(se))return null;cl.add(se);let J=null;try{const Ce=await To(se);return Ce?(J=Ce,await i.openSideChatOn(Ce,xe),Ce):null}catch(Ce){return l("startSessionAndOpenSideChat",Ce),J}finally{cl.delete(se)}}async function Jo(se){const xe=se.trim();if(!xe)return!1;const J=_t();try{const Ce=await J.addWorkspace({root:xe});return ps(Ce),In(Ce.id),!0}catch(Ce){return gl("[kimi-web] addWorkspaceByPath failed for",xe,Ce),!1}}async function uo(se){try{return await _t().browseFs(se)}catch{return{path:"",parent:null,entries:[]}}}async function Ys(){try{return await _t().getFsHome()}catch{return{home:"",recentRoots:[]}}}function Nn(se,xe){if(xe==="none"||typeof window>"u"||!window.history)return;const J=fQ(se);if(window.location.pathname!==J)try{xe==="push"?window.history.pushState(null,"",J):window.history.replaceState(null,"",J)}catch{}}async function no(se){try{const xe=await _t().getSession(se);return e.sessions.some(J=>J.id===xe.id)||h(xe),!0}catch{return!1}}async function $s(se){try{const xe=await _t().getSession(se);return xe.archived?"stale":(e.sessions.some(J=>J.id===xe.id)||h(xe),"ok")}catch(xe){return Us(xe)&&xe.code===qhe?"stale":"retry"}}function Xs(){const se=Qb(window.location);if(se===void 0){k(void 0);return}if(se!==e.activeSessionId){if(e.sessions.some(xe=>xe.id===se)){vo(se,{urlMode:"none"});return}(async()=>{if(await no(se)){await vo(se,{urlMode:"none"});return}const xe=e.sessions[0];xe?await vo(xe.id,{urlMode:"replace"}):(k(void 0),Nn(void 0,"replace"))})()}}let ci=!1;function Oo(){ci||typeof window>"u"||(ci=!0,window.addEventListener("popstate",Xs))}async function vo(se,xe){if(!e.sessions.some($e=>$e.id===se)){const $e=++ye;if(!await no(se)||$e!==ye)return}const J=S(se),Ce=!J&&u.has(se);u.delete(se);try{Nn(se,xe?.urlMode??"push"),e.sessionLoading=!J&&!Ce,k(se),e.unreadBySession[se]&&(e.unreadBySession={...e.unreadBySession,[se]:!1},W({[se]:!1})),ge();const $e=e.sessions.find(He=>He.id===se);if($e){const He=B($e);e.activeWorkspaceId!==He&&go(He)}if(J){if(await x(se)==="not-found")return}else if(await g(se,{skipStatusRefresh:xe?.skipStatusRefresh===!0})==="not-found")return;fe(se,{skipStatus:xe?.skipStatusRefresh===!0})}catch($e){l("selectSession",$e,{sessionId:se})}finally{e.activeSessionId===se&&(e.sessionLoading=!1)}}async function Po(se,xe,J){const Ce=y8(se);e.inFlightBySession={...e.inFlightBySession,[se]:!0};const $e=b();let He=e.pendingThinkingBySession[se];try{const vt=_t(),ut=[];if(xe&&ut.push({type:"text",text:xe}),ut.push(...m8(J)),ut.length===0)return e.inFlightBySession={...e.inFlightBySession,[se]:!1},"rejected";const Dt={id:$e,sessionId:se,role:"user",content:ut,createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};w(se,vs=>[...vs,Dt]);const Et=e.sessions.find(vs=>vs.id===se),ln=(Et?.model&&Et.model.length>0?Et.model:e.defaultModel)??void 0,oo=e.planModeBySession[se]??!1,Ot=e.swarmModeBySession[se]??!1,Pt=e.goalModeBySession[se]??!1;if(Pt&&xe)try{await vt.updateSession(se,{goalObjective:xe.trim()})}catch(vs){return vl(e,se,He)&&T(se),l("createGoal",vs,{sessionId:se}),e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,Os=>Os.some(ei=>ei.id===$e)?Os.filter(ei=>ei.id!==$e):Os),"rejected"}const Yn=await r.resolveThinkingForPrompt(se,ln)??e.thinking;He=e.pendingThinkingBySession[se];const ko=await vt.submitPrompt(se,{content:ut,model:ln,thinking:Yn,permissionMode:e.permission,planMode:oo,swarmMode:Ot});return Yn!==void 0&&vl(e,se,He),Pt&&(e.goalModeBySession={...e.goalModeBySession,[se]:!1},U()),e.promptIdBySession={...e.promptIdBySession,[se]:ko.promptId},G(se,$e,ko.promptId,ko.userMessageId),_()?.bindNextPromptId(se,ko.promptId),"ok"}catch(vt){return e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,ut=>ut.some(Dt=>Dt.id===$e)?ut.filter(Dt=>Dt.id!==$e||Dt.promptId!==void 0||Dt.userMessageId!==void 0):ut),vl(e,se,He)&&T(se),l("sendPrompt",vt,{sessionId:se}),Us(vt)?"rejected":"uncertain"}finally{k8(se,Ce)}}async function co(se,xe){const J=e.activeSessionId;if(J){if(a.value!=="idle"||e.inFlightBySession[J]){Qe(se,xe);return}if((e.queuedBySession[J]?.length??0)>0){Qe(se,xe),st(J);return}await Po(J,se,xe)}}async function Tn(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[],$e=[],He=[];for(const Pt of Ce){const Yn=Pt.text.trim();Yn&&$e.push(Yn),Pt.attachments?.length&&He.push(...Pt.attachments)}const vt=se.trim();if(vt&&$e.push(vt),xe?.length&&He.push(...xe),$e.length===0&&He.length===0)return;Ce.length>0&&(e.queuedBySession={...e.queuedBySession,[J]:[]});const ut=$e.join(` + +`),Dt=()=>{if(Ce.length===0)return;const Pt=e.queuedBySession[J]??[];e.queuedBySession={...e.queuedBySession,[J]:[...Ce,...Pt]}};if(a.value==="idle"&&!e.inFlightBySession[J]){await Po(J,ut,He)==="rejected"&&Dt();return}const Et=[];ut&&Et.push({type:"text",text:ut});for(const Pt of He)Pt.kind==="video"?Et.push({type:"video",source:{kind:"file",fileId:Pt.fileId}}):Pt.kind==="file"?Et.push({type:"file",fileId:Pt.fileId,name:Pt.name??"",mediaType:Pt.mediaType||"application/octet-stream",size:Pt.size??0}):Et.push({type:"image",source:{kind:"file",fileId:Pt.fileId}});const ln=b(),oo={id:ln,sessionId:J,role:"user",content:Et,createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};w(J,Pt=>[...Pt,oo]);const Ot=y8(J);try{const Pt=_t(),Yn=e.sessions.find(Lc=>Lc.id===J),ko=(Yn?.model&&Yn.model.length>0?Yn.model:e.defaultModel)??void 0,vs=await r.resolveThinkingForPrompt(J,ko)??e.thinking,Os=e.pendingThinkingBySession[J],ei=await Pt.submitPrompt(J,{content:Et,model:ko,thinking:vs,permissionMode:e.permission,planMode:e.planModeBySession[J]??!1,swarmMode:e.swarmModeBySession[J]??!1});if(vs!==void 0&&vl(e,J,Os),G(J,ln,ei.promptId,ei.userMessageId),ei.status!=="queued"){e.promptIdBySession={...e.promptIdBySession,[J]:ei.promptId},_()?.bindNextPromptId(J,ei.promptId);return}try{await Pt.steerPrompts(J,[ei.promptId])}catch{}}catch(Pt){w(J,Yn=>Yn.filter(ko=>ko.id!==ln||ko.promptId!==void 0||ko.userMessageId!==void 0)),Us(Pt)&&Dt(),l("steer",Pt,{sessionId:J})}finally{k8(J,Ot)}}async function fo(se,xe){try{const Ce=await _t().uploadFile({file:se,name:xe});return{fileId:Ce.id,name:Ce.name,mediaType:Ce.mediaType}}catch(J){return l("uploadImage",J),null}}function Qe(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[],$e={text:se,attachments:xe,id:ome()};e.queuedBySession={...e.queuedBySession,[J]:[...Ce,$e]}}function st(se){const[xe,...J]=e.queuedBySession[se]??[];xe!==void 0&&(e.queuedBySession={...e.queuedBySession,[se]:J},Po(se,xe.text,xe.attachments).then(Ce=>{if(Ce==="ok"){ju.delete(se);return}if(Ce==="uncertain"){ju.delete(se);return}if(!e.sessions.some(Dt=>Dt.id===se)){ju.delete(se);return}const $e=xe.id??xe.text,He=ju.get(se),vt=He!==void 0&&He.key===$e?He.count+1:1;if(vt>=nme){ju.delete(se),(e.queuedBySession[se]?.length??0)>0&&st(se);return}ju.set(se,{key:$e,count:vt});const ut=e.queuedBySession[se]??[];e.queuedBySession={...e.queuedBySession,[se]:[xe,...ut]}}))}function Ct(se,xe){const J=e.inFlightBySession[se]===!0;if(e.inFlightBySession={...e.inFlightBySession,[se]:!1},e.promptIdBySession[se]!==void 0){const $e={...e.promptIdBySession};delete $e[se],e.promptIdBySession=$e}return(J||xe?.turnWasActive===!0||(e.turnActiveBySession[se]??!1))&&st(se),J}function Qt(se,xe){xe.inFlightTurn!==null&&xe.busy||Ct(se)}async function kn(){const se=e.activeSessionId;if(!se)return!1;const xe=e.sessions.find(ut=>ut.id===se);let J=e.promptIdBySession[se];if(J===void 0){const ut=xe?.currentPromptId;ut!==void 0&&ut.length>0&&!ut.startsWith("pr_")&&(J=ut)}const Ce=_t();let $e=!1;const He=()=>{e.inFlightBySession={...e.inFlightBySession,[se]:!1},e.turnActiveBySession={...e.turnActiveBySession,[se]:!1}};if(J!==void 0)try{if((await Ce.abortPrompt(se,J)).aborted)return!0;$e=!0;const Dt={...e.promptIdBySession};delete Dt[se],e.promptIdBySession=Dt,He()}catch(ut){if(Us(ut)&&ut.code===Khe){$e=!0;const Dt={...e.promptIdBySession};delete Dt[se],e.promptIdBySession=Dt,He()}else return l("abortCurrentPrompt",ut,{sessionId:se}),!1}if($e||!((e.inFlightBySession[se]??!1)||(e.turnActiveBySession[se]??!1)||(xe?.mainTurnActive??!1)))return!1;try{return(await Ce.abortSession(se)).aborted===!0}catch(ut){return l("abortCurrentPrompt",ut,{sessionId:se}),!1}}function Ko(se,xe){const J=e.approvalsBySession[se]??[];e.approvalsBySession={...e.approvalsBySession,[se]:J.filter(Ce=>Ce.approvalId!==xe)}}function Eo(se,xe){const J=e.questionsBySession[se]??[];e.questionsBySession={...e.questionsBySession,[se]:J.filter(Ce=>Ce.questionId!==xe)}}async function bo(se,xe){const J=e.activeSessionId;if(!J||Lh[se])return;Lh[se]=!0;const Ce=e.approvalsBySession[J]?.find($e=>$e.approvalId===se&&$e.toolName==="ExitPlanMode")?.toolCallId;try{const $e=_t(),He={decision:xe.decision,scope:xe.scope,feedback:xe.feedback,selectedLabel:xe.selectedLabel};await $e.respondApproval(J,se,He),Ko(J,se),Ce!==void 0&&E(J,Ce)}catch($e){y4($e)?(Ko(J,se),Ce!==void 0&&E(J,Ce)):l("respondApproval",$e,{sessionId:J})}finally{delete Lh[se]}}async function Ns(se,xe){const J=e.activeSessionId;if(J&&!Hu[se]){Hu[se]="answer";try{await _t().respondQuestion(J,se,xe),Eo(J,se)}catch(Ce){y4(Ce)?Eo(J,se):l("respondQuestion",Ce,{sessionId:J})}finally{delete Hu[se]}}}async function Do(se){const xe=e.activeSessionId;if(xe&&!Hu[se]){Hu[se]="dismiss";try{await _t().dismissQuestion(xe,se),Eo(xe,se)}catch(J){y4(J)?Eo(xe,se):l("dismissQuestion",J,{sessionId:xe})}finally{delete Hu[se]}}}async function Io(se){const xe=e.activeSessionId;if(xe&&!k4[se]){k4[se]=!0;try{const J=_t(),Ce=(e.tasksBySession[xe]??[]).find(He=>He.id===se)?.backgroundTaskId;await J.cancelTask(xe,Ce??se);const $e=e.tasksBySession[xe]??[];e.tasksBySession={...e.tasksBySession,[xe]:$e.map(He=>He.id===se?{...He,status:"cancelled"}:He)}}catch(J){eme(J)||l("cancelTask",J,{sessionId:xe})}finally{delete k4[se]}}}function Qo(se){const xe=e.activeSessionId;xe?(e.planModeBySession={...e.planModeBySession,[xe]:se},O(),P({planMode:se})):z.planMode=se}function sn(){const se=e.activeSessionId,xe=se?e.planModeBySession[se]??!1:z.planMode;Qo(!xe)}function es(se){const xe=e.activeSessionId;xe?(e.swarmModeBySession={...e.swarmModeBySession,[xe]:se},F(),P({swarmMode:se})):z.swarmMode=se}async function ms(){const se=e.activeSessionId,J=!(se?e.swarmModeBySession[se]??!1:z.swarmMode);J&&e.permission==="manual"&&!await o({title:n("workspace.swarmEnableTitle"),message:n("workspace.swarmEnableConfirm"),variant:"primary"})||es(J)}function Tr(se){const xe=e.activeSessionId;xe?(e.goalModeBySession={...e.goalModeBySession,[xe]:se},U()):z.goalMode=se}function ts(){const se=e.activeSessionId,xe=se?e.goalModeBySession[se]??!1:z.goalMode;Tr(!xe)}async function Ki(se){const xe=se.trim();if(!xe||e.permission==="manual"&&!await o({title:n("workspace.goalStartTitle"),message:n("workspace.goalStartConfirm",{objective:xe}),variant:"primary"}))return null;let J=e.activeSessionId,Ce=null;if(!J){const $e=e.activeWorkspaceId,He=$e&&I.value.some(vt=>vt.id===$e)?$e:I.value[0]?.id??null;if(!He)return null;try{J=await To(He)??void 0,Ce=J??null}catch(vt){return l("createGoal",vt),null}if(!J)return null}try{await _t().updateSession(J,{goalObjective:xe})}catch($e){return l("createGoal",$e,{sessionId:J,message:ie($e)}),Ce}return e.goalModeBySession[J]&&(e.goalModeBySession={...e.goalModeBySession,[J]:!1},U()),e.activeSessionId===J?await co(xe):await Po(J,xe),Ce}function Js(se){const xe=e.activeSessionId;xe&&Promise.resolve(_t().updateSession(xe,{goalControl:se})).catch(J=>{l("controlGoal",J,{sessionId:xe,message:ie(J)})})}function Bo(se){e.permission=se,H(se),P({permissionMode:se})}function Zo(se){const xe=[...e.warnings];xe.splice(se,1),e.warnings=xe}async function Il(se,xe){try{await _t().updateSession(se,{title:xe}),d(se,Ce=>({...Ce,title:xe}))}catch(J){l("renameSession",J,{sessionId:se})}}async function Zi(se,xe){const J=e.workspaces.find($e=>$e.id===se)?.root,Ce=()=>{e.workspaces=e.workspaces.map($e=>$e.id===se?{...$e,name:xe}:$e)};try{if(await _t().updateWorkspace(se,{name:xe}),J!==void 0){const $e=lh();J in $e&&(delete $e[J],tC($e))}Ce()}catch($e){if(J!==void 0&&Us($e)&&$e.code===Zhe){tC({...lh(),[J]:xe}),Ce();return}l("renameWorkspace",$e)}}async function tl(se){const xe=e.workspaces.find(He=>He.id===se)?.root??D.value.find(He=>He.id===se)?.root??se,J=e.activeSessionId?e.sessions.find(He=>He.id===e.activeSessionId):void 0,Ce=e.activeWorkspaceId===se||e.activeWorkspaceId===xe,$e=!!(J&&(J.cwd===xe||J.workspaceId===se||B(J)===se));xe&&!e.hiddenWorkspaceRoots.includes(xe)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,xe],V(e.hiddenWorkspaceRoots));try{await _t().deleteWorkspace(se)}catch(He){gl("[kimi-web] deleteWorkspace registry cleanup failed for",se,He)}if(e.workspaces=e.workspaces.filter(He=>He.id!==se&&He.root!==xe),Ce||$e){const He=I.value[0]?.id??null;if(e.activeWorkspaceId=He,He)K(He);else try{ur(cn.activeWorkspace)}catch{}}(Ce||$e)&&(k(void 0),e.sessionLoading=!1,ge(),Nn(void 0,"replace"))}async function Ho(se){try{const xe=_t(),J=e.sessions.find(ut=>ut.id===se),Ce=J!==void 0?B(J):void 0,$e=Ce!==void 0?Sn(Ce).length:0;await xe.archiveSession(se),m(se),J!==void 0&&Ce!==void 0&&tt(Ce,se,J.updatedAt,$e),i.clearSideChatForSession(se);const{[se]:He,...vt}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=vt,e.activeSessionId===se){const ut=e.sessions[0];ut?await vo(ut.id,{urlMode:"replace"}):(k(void 0),Nn(void 0,"replace"))}}catch(xe){l("archiveSession",xe,{sessionId:se})}}async function Co(se){if(oe)return;const xe=se??e.activeSessionId;if(!xe){const Ce=n("commands.export.noSession");bi("export:failed",{status:"no-session"}),l("exportSession",new Error(Ce),{message:Ce});return}oe=!0;const J=Date.now();bi("export:start",{sessionId:xe});try{const Ce=U0e(),{blob:$e,fileName:He}=await _t().exportSession(xe,Ce,{desktop:Wp});if(typeof document>"u")throw new Error("Document is unavailable");const vt=URL.createObjectURL($e);let ut;try{ut=document.createElement("a"),ut.href=vt,ut.download=He,document.body.append(ut),ut.click()}finally{ut?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(vt)}catch{}},0)}bi("export:accepted",{sessionId:xe,status:"accepted",zipBytes:$e.size,durationMs:Date.now()-J})}catch(Ce){const $e=typeof Ce=="object"&&Ce!==null?Ce:void 0;bi("export:failed",{sessionId:xe,status:"failed",durationMs:Date.now()-J,errorName:typeof $e?.name=="string"?$e.name:typeof Ce,errorCode:typeof $e?.code=="number"?$e.code:void 0,requestId:typeof $e?.requestId=="string"?$e.requestId:void 0,phase:typeof $e?.phase=="string"?$e.phase:void 0,httpStatus:typeof $e?.status=="number"?$e.status:void 0}),l("exportSession",Ce,{sessionId:xe})}finally{oe=!1}}async function Fs(se){try{const xe=await _t().restoreSession(se);return f(xe),!0}catch(xe){return l("restoreSession",xe,{sessionId:se}),!1}}function Rs(se){return _t().listSessions({archivedOnly:!0,beforeId:se?.beforeId,pageSize:se?.pageSize??50})}async function yo(){try{await _t().logout(),await Se(),await gt()}catch(se){l("logout",se)}}function ht(se){const xe=e.activeSessionId;xe&&_t().compactSession(xe,se).catch(J=>{l("compact",J,{sessionId:xe})})}async function Le(se){const xe=se??e.activeSessionId;if(xe)try{const J=await _t().forkSession(xe);f(J),await vo(J.id)}catch(J){l("fork",J,{sessionId:xe})}}async function Ze(se=1){const xe=e.activeSessionId;if(!xe)return null;const J=e.messagesBySession[xe]??[];let Ce=-1;for(let ut=J.length-1;ut>=0;ut--){const Dt=J[ut];if(Dt.role==="user"&&!(Dt.metadata?.origin&&Dt.metadata.origin.kind!=="user")){Ce=ut;break}}const $e=Ce>=0?J[Ce].content.filter(ut=>ut.type==="text").map(ut=>ut.text).join(` +`):null,He=se===1&&Ce>=0&&J.slice(Ce+1).every(ut=>ut.role!=="user"),vt=He?e.sessions.find(ut=>ut.id===xe):void 0;if(He&&(e.messagesBySession={...e.messagesBySession,[xe]:J.slice(0,Ce)},vt!==void 0)){const ut={...vt};delete ut.lastTurnReason,f(ut)}try{return await _t().undoSession(xe,se),await g(xe),{text:$e}}catch(ut){return He&&(e.messagesBySession={...e.messagesBySession,[xe]:J},vt!==void 0&&f(vt),await g(xe).catch(()=>{})),l("undo",ut,{sessionId:xe}),null}}function Xt(se){const xe=e.activeSessionId;if(!xe)return;const J=e.queuedBySession[xe]??[];if(se<0||se>=J.length)return;const Ce=[...J];Ce.splice(se,1),e.queuedBySession={...e.queuedBySession,[xe]:Ce}}function gs(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[];if(se===xe||se<0||se>=Ce.length||xe<0||xe>=Ce.length)return;const $e=[...Ce],[He]=$e.splice(se,1);He!==void 0&&($e.splice(xe,0,He),e.queuedBySession={...e.queuedBySession,[J]:$e})}async function di(se){const xe=e.activeSessionId;if(!xe)return[];try{return(await _t().listDirectory(xe,{path:se,includeGitStatus:!0})).items}catch{return[]}}async function Ei(se){const xe=e.activeSessionId;if(!xe)return null;try{const Ce=await _t().readFile(xe,{path:se});return{path:Ce.path,content:Ce.content,encoding:Ce.encoding,mime:Ce.mime,languageId:Ce.languageId,isBinary:Ce.isBinary,size:Ce.size,lineCount:Ce.lineCount}}catch(J){if(gl("[kimi-web] readFileContent failed for",se,J),Us(J)&&J.code===Ghe)throw J;return null}}async function ao(se){return _t().readHostFileContent(se)}const Gi=10485760;function Er(se){const xe=e.activeSessionId;return xe?_t().getFileDownloadUrl(xe,se):null}async function fi(se,xe){const J=e.activeSessionId;if(!J)return!1;try{return await _t().openFile(J,{path:se,line:xe}),!0}catch(Ce){return l("openFile",Ce,{sessionId:J}),!1}}async function Ll(se){const xe=e.activeSessionId;if(!xe)return;const J=$.value.cwd||".";try{await _t().openInApp(xe,se,J)}catch(Ce){l("openInApp",Ce,{sessionId:xe})}}async function zo(se){const xe=e.activeSessionId;if(!xe)return!1;try{return await _t().revealFile(xe,{path:se}),!0}catch(J){return l("revealFile",J,{sessionId:xe}),!1}}function Ir(se){return se.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(se)||se.startsWith("\\\\")}async function Qs(se){if(/^(https?:|data:|blob:)/i.test(se))return se;const xe=e.activeSessionId;if(!xe)return se;let J=se;if(Ir(J)){const Ce=e.sessions.find(He=>He.id===xe)?.cwd,$e=Ce?h2(J,Ce):null;if($e)J=$e;else try{const He=await ao(J);return!He.isBinary||He.encoding!=="base64"?se:`data:${He.mime};base64,${He.content}`}catch{return se}}try{const $e=await _t().readFile(xe,{path:J,length:Gi});return!$e.isBinary||$e.encoding!=="base64"||$e.truncated?se:`data:${$e.mime};base64,${$e.content}`}catch{return se}}async function pi(se){const xe=e.sessions.find(Ce=>Ce.id===e.activeSessionId),J=xe===void 0?e.activeWorkspaceId:B(xe);if(!J)return[];try{return(await _t().searchFiles(J,{query:se,limit:20})).items.map(He=>({path:He.path,name:He.name}))}catch{return[]}}return{loadFileDiff:we,clearFileDiff:ge,loadGitStatus:Q,checkAuth:Se,probeManagedMembership:ue,loadConfig:_e,updateConfig:Ee,listAllSessionsGlobal:Oe,load:gt,refreshServerMeta:Lt,loadWorkspaces:wn,loadMoreSessions:Yt,loadAllSessions:Ue,ensureFlatSessions:Mn,loadMoreFlatSessions:We,selectWorkspace:go,openWorkspace:qt,upsertWorkspacePreserveOrder:ps,applyWorkspaceEvent:xs,clearActiveSession:_n,openWorkspaceDraft:In,startSessionAndSendPrompt:lo,startSessionAndActivateSkill:St,startSessionAndOpenSideChat:hs,addWorkspaceByPath:Jo,browseFs:uo,getFsHome:Ys,writeSessionUrl:Nn,fetchSessionIntoList:no,onSessionRoutePopState:Xs,bindSessionRoute:Oo,selectSession:vo,submitPromptInternal:Po,finishPromptLocal:Ct,localTurnStartState:sme,isLocalTurnSnapshotCurrent:rme,afterLocalTurnStartsSettle:lme,handleSessionSnapshot:Qt,sendPrompt:co,steerPrompt:Tn,uploadImage:fo,enqueue:Qe,unqueue:Xt,reorderQueue:gs,abortCurrentPrompt:kn,respondApproval:bo,respondQuestion:Ns,dismissQuestion:Do,pendingQuestionActions:Hu,pendingApprovalActions:Lh,cancelTask:Io,setPlanMode:Qo,togglePlanMode:sn,setSwarmMode:es,toggleSwarmMode:ms,setGoalMode:Tr,toggleGoalMode:ts,createGoal:Ki,controlGoal:Js,setPermission:Bo,dismissWarning:Zo,renameSession:Il,renameWorkspace:Zi,deleteWorkspace:tl,archiveSession:Ho,exportSession:Co,restoreSession:Fs,loadArchivedSessions:Rs,logout:yo,compact:ht,forkSession:Le,undo:Ze,listDir:di,readFileContent:Ei,readHostFileContent:ao,getFileDownloadUrl:Er,openWorkspaceFile:fi,openInApp:Ll,revealWorkspaceFile:zo,resolveImageUrl:Qs,searchFiles:pi,loadOlderMessages:Y,refreshSessionSidecars:fe,isStartingFirstPrompt:()=>cl.size>0}}const tN=cn.starredModels,Bx=new Error("profile persist failed");function ume(){try{const e=ui(tN);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t)&&t.every(n=>typeof n=="string"))return t}catch{}return[]}function cme(e){try{Ls(tN,JSON.stringify(e))}catch{}}function dme(e,t){const{pushOperationFailure:n,refreshSessionStatus:o,persistSessionProfile:s,activity:i,updateSession:r,updateSessionMessages:l,loadConfig:a,checkAuth:u}=t,c=Z([]),d=Z(ume()),f=Z({}),h=Z({}),m=Z([]),v=Z(null);function k(pe){if(!(pe==null||pe.length===0))return c.value.find(ve=>ve.id===pe)??c.value.find(ve=>ve.model===pe)}function w(){const pe=e.activeSessionId?e.sessions.find(oe=>oe.id===e.activeSessionId):void 0,ve=pe===void 0?v.value??e.defaultModel:pe.model||e.defaultModel;return k(ve)?.id??ve??void 0}function b(pe){if(pe===void 0)return;const ve=k(pe);return ve===void 0?void 0:bp(ve)}function _(pe,ve){const oe=pe==null?void 0:e.thinkingBySession[pe];return oe!==void 0&&gJ(ve,oe)?oe:bp(ve)}function g(pe,ve){if(ve===void 0)return;const oe=k(ve);return oe===void 0?void 0:_(pe,oe)}async function x(pe,ve){return pe!=null&&e.thinkingBySession[pe]===void 0&&await o(pe),g(pe,ve)}function S(pe){e.thinking=pe;const ve=e.activeSessionId;return pe!==void 0&&ve!==null&&ve!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:pe},k3(e,ve)),pe}Je([()=>e.activeSessionId,()=>w(),()=>{const pe=e.activeSessionId;return pe==null?void 0:e.thinkingBySession[pe]}],()=>{const pe=k(w());pe!==void 0&&(e.thinking=_(e.activeSessionId,pe))});function T(pe){_t().setConfig({thinking:vJ(pe,k(w())?.supportEfforts)}).catch(ve=>n("setConfig",ve))}async function A(pe){try{const oe=await _t().listSkills(pe);f.value={...f.value,[pe]:oe}}catch{}}async function E(pe){try{const oe=await _t().listSkillsForWorkspace(pe);h.value={...h.value,[pe]:oe}}catch{}}async function P(){try{const pe=_t();c.value=await pe.listModels();const ve=k(w());ve!==void 0&&(e.thinking=_(e.activeSessionId,ve))}catch(pe){n("loadModels",pe)}}async function D(){try{const pe=_t();m.value=await pe.listProviders()}catch(pe){n("loadProviders",pe)}}async function I(pe){const ve=e.activeSessionId,oe=k(pe),ye=e.thinking,G=ve?e.sessions.find(ge=>ge.id===ve)?.model:void 0,Y=w()!==(oe?.id??pe),fe=yJ(oe,ye,Y);if(!ve)return v.value=pe,e.thinking=fe,fe!==ye&&fe!==void 0&&T(fe),!0;r(ve,ge=>({...ge,model:pe}));let we;fe!==ye&&(e.thinking=fe,fe!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:fe},we=k3(e,ve)));try{await _t().updateSession(ve,{model:pe,thinking:fe!==ye?fe:void 0})}catch(ge){return r(ve,Q=>({...Q,model:G??Q.model})),fe!==ye&&(e.thinking=ye,ye!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:ye}),vl(e,ve,we)&&o(ve)),n("setModel",ge,{sessionId:ve}),!1}return fe!==ye&&fe!==void 0&&T(fe),vl(e,ve,we),await o(ve),!0}function $(pe){const ve=new Set(d.value);ve.has(pe)?ve.delete(pe):ve.add(pe),d.value=Array.from(ve),cme(d.value)}async function B(pe,ve,oe,ye,G){const Y=ye??e.activeSessionId;if(!Y)return;const fe=i.value==="idle"&&!e.inFlightBySession[Y],we=`msg_skill_opt_${Date.now().toString(36)}`,ge=fe?y8(Y):void 0;if(fe){e.inFlightBySession={...e.inFlightBySession,[Y]:!0};const Q={id:we,sessionId:Y,role:"user",content:[{type:"text",text:`/${pe}${ve?` ${ve}`:""}`},...m8(oe)],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0,origin:{kind:"skill_activation",trigger:"user-slash",skillName:pe,skillArgs:ve}}};l(Y,te=>[...te,Q])}try{if(G?.skipThinkingPersist!==!0){const Q=e.sessions.find(ue=>ue.id===Y)?.model,te=(Q&&Q.length>0?Q:e.defaultModel)??void 0;if(!await s({thinking:await x(Y,te)??e.thinking},Y))throw Bx}await _t().activateSkill(Y,pe,ve,m8(oe))}catch(Q){fe&&(e.inFlightBySession={...e.inFlightBySession,[Y]:!1},l(Y,te=>te.filter(ce=>ce.id!==we))),Q!==Bx&&n("activateSkill",Q,{sessionId:Y})}finally{ge!==void 0&&k8(Y,ge)}}async function H(pe){return _t().getProvider(pe)}async function O(pe){try{return await _t().addProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: addProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function F(pe,ve){try{return await _t().updateProvider(pe,ve),await Promise.all([D(),P(),a()]),null}catch(oe){return Xl("[kimi-web] operation failed: updateProvider",oe),oe instanceof Error?oe.message:String(oe)}}async function U(pe){try{const oe=await _t().deleteProvider(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return n("deleteProvider",ve),null}}async function z(pe){try{const ve=await _t().refreshProvider(pe);for(const oe of ve.failed)n("refreshProvider",new Error(oe.reason),{message:oe.provider});await Promise.all([D(),P(),a()])}catch(ve){n("refreshProvider",ve)}}async function W(){try{const pe=await _t().refreshAllProviders();for(const ve of pe.failed)n("refreshAllProviders",new Error(ve.reason),{message:ve.provider});await Promise.all([D(),P(),a()])}catch(pe){n("refreshAllProviders",pe)}}async function K(){try{return{kind:"ok",items:await _t().listCatalogProviders()}}catch(pe){return pe instanceof wd&&pe.code===void 0?{kind:"unsupported"}:(Xl("[kimi-web] operation failed: loadCatalogProviders",pe),{kind:"error"})}}async function V(pe){try{return await _t().importCatalogProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: importCatalogProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function ie(pe){try{const oe=await _t().importCustomRegistry(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return Xl("[kimi-web] operation failed: importCustomRegistry",ve),ve instanceof Error?ve.message:String(ve)}}async function ne(){try{return await _t().startOAuthLogin()}catch{return null}}async function X(){try{return await _t().pollOAuthLogin()}catch(pe){return gl("[kimi-web] pollOAuthLogin failed",pe),null}}async function le(){try{await _t().cancelOAuthLogin()}catch{}}async function Ie(){try{return await _t().getUsage()}catch(pe){return{kind:"error",message:pe instanceof Error?pe.message:String(pe)}}}function de(pe){const ve=S(pe);s({thinking:ve}),ve!==void 0&&T(ve)}return{models:c,starredModelIds:d,providers:m,draftModel:v,skillsBySession:f,skillsByWorkspace:h,loadSkillsForSession:A,loadSkillsForWorkspace:E,loadModels:P,loadProviders:D,setModel:I,thinkingLevelForModelId:b,thinkingLevelForSessionId:g,resolveThinkingForPrompt:x,toggleStarModel:$,activateSkill:B,addProvider:O,updateProvider:F,deleteProvider:U,getProvider:H,loadCatalogProviders:K,importCatalogProvider:V,importCustomRegistry:ie,refreshProvider:z,refreshAllProviders:W,startOAuthLogin:ne,pollOAuthLogin:X,cancelOAuthLogin:le,getUsage:Ie,setThinking:de}}function fme(e,t){const{pushOperationFailure:n,nextOptimisticMsgId:o,connectEventsIfNeeded:s,getEventConn:i,resolveThinkingForPrompt:r,refreshSessionStatus:l}=t,a=Z({}),u=R(()=>{const O=e.activeSessionId;if(!O)return null;const F=a.value[O];return F?{parentId:O,agentId:F.agentId}:null}),c=R(()=>u.value?.parentId??null),d=R(()=>u.value!==null),f=R(()=>{const O=u.value;return O?!!e.sideChatSendingByAgent[O.agentId]:!1}),h=R(()=>{const O=u.value;return O?e.sideChatSendingByAgent[O.agentId]?!0:(e.tasksBySession[O.parentId]??[]).some(F=>F.id===O.agentId&&F.status==="running"):!1}),m=O=>_t().getFileUrl(O),v=[],k=KT(),w=R(()=>{const O=u.value;return O?k({messages:e.sideChatMessagesByAgent[O.agentId]??[],approvals:v,getFileUrl:m,sessionActive:h.value}):[]});function b(O,F){e.sideChatMessagesByAgent[O]=F(e.sideChatMessagesByAgent[O]??[])}function _(O,F){b(O,U=>[...U,F])}function g(O,F){b(O,U=>{const z=U.find(W=>W.id===F);return z?.promptId!==void 0||z?.userMessageId!==void 0?U:U.filter(W=>W.id!==F)})}function x(O,F){const U=e.sideChatUserMessageIdsBySession[O]??[];U.includes(F)||(e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[O]:[...U,F]})}function S(O,F,U,z){b(O,W=>{const K=W.findIndex(X=>X.id===F);if(K===-1)return W;const V=W.findIndex((X,le)=>le!==K&&X.role==="user"&&(X.id===z||X.userMessageId===z||X.promptId===U)),ie=W[K],ne=V===-1?ie:W[V];return W.flatMap((X,le)=>le===V?[]:le!==K?[X]:[{...ne,id:ie.id,promptId:U,userMessageId:z,metadata:{...ne.metadata,...ie.metadata}}])})}function T(O,F){x(F.sessionId,F.userMessageId??F.id),b(O,U=>{const z=U.findIndex(V=>V.role==="user"&&(V.userMessageId===(F.userMessageId??F.id)||V.promptId!==void 0&&V.promptId===F.promptId));if(z===-1)return[...U,F];const W=U[z],K=[...U];return K[z]={...F,id:W.id,promptId:F.promptId??W.promptId,userMessageId:F.userMessageId??F.id,metadata:{...F.metadata,...W.metadata}},K})}function A(O,F,U){U&&b(O,z=>{const W=z.at(-1);if(W?.role==="assistant"){const K=W.content[0],V=K?.type==="text"?K.text:"";return[...z.slice(0,-1),{...W,content:[{type:"text",text:`${V}${U}`}]}]}return[...z,{id:o(),sessionId:F,role:"assistant",content:[{type:"text",text:U}],createdAt:new Date().toISOString()}]})}function E(O,F,U){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[O]:!1},!U)return;const W=(e.sideChatMessagesByAgent[O]??[]).at(-1);(W?.role==="assistant"&&W.content[0]?.type==="text"?W.content[0].text:"").trim().length>0||A(O,F,U)}async function P(O){const F=e.activeSessionId;F&&await D(F,O)}async function D(O,F){if(!a.value[O]){let U;try{({agentId:U}=await _t().startBtw(O))}catch(z){n("openSideChat",z,{sessionId:O});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[U]:e.sideChatMessagesByAgent[U]??[]},a.value={...a.value,[O]:{agentId:U}},s(),i()?.markSideChannelAgent(O,U)}F&&F.trim()&&await I(O,F.trim())}async function I(O,F){const U=a.value[O],z=F.trim();if(!U||!z)return;const W=O,K=U.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!0};const V=o(),ie={id:V,sessionId:W,role:"user",content:[{type:"text",text:z}],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};_(K,ie);let ne;try{const X=e.sessions.find(pe=>pe.id===W),le=(X?.model&&X.model.length>0?X.model:e.defaultModel)??void 0,Ie=await r(W,le)??e.thinking;ne=e.pendingThinkingBySession[W];const de=await _t().submitPrompt(W,{content:[{type:"text",text:z}],agentId:K,model:le,thinking:Ie,permissionMode:e.permission,planMode:e.planModeBySession[W]??!1,swarmMode:e.swarmModeBySession[W]??!1});Ie!==void 0&&vl(e,W,ne),S(K,V,de.promptId,de.userMessageId),x(W,de.userMessageId)}catch(X){vl(e,W,ne)&&l(W),n("sendSideChatPrompt",X,{sessionId:W}),g(K,V),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!1}}}function $(){const O=e.activeSessionId;if(!O)return;const{[O]:F,...U}=a.value;a.value=U}async function B(O){const F=u.value;F&&await I(F.parentId,O)}function H(O){if(!a.value[O])return;const{[O]:F,...U}=a.value;a.value=U}return{sideChatTargetBySession:a,sideChatSessionId:c,sideChatVisible:d,sideChatSending:f,sideChatRunning:h,sideChatTurns:w,appendSideChatAssistantText:A,finishSideChatAgent:E,reconcileSideChatUserMessage:T,openSideChat:P,openSideChatOn:D,closeSideChat:$,sendSideChatPrompt:B,clearSideChatForSession:H}}class pme{transcript;sessionId;agentId;fetchPage;pageSize;onChange;onGap;refreshPromise=null;buffered=[];agents_=[];seq_;loadingOlder_=!1;loadOlderError_=!1;refreshError_=!1;constructor(t){this.sessionId=t.sessionId,this.agentId=t.agentId,this.transcript=new tj(t.agentId),this.fetchPage=t.fetchPage,this.pageSize=t.pageSize??20,this.onChange=t.onChange,this.onGap=t.onGap}get snapshot(){return this.transcript.snapshot()}get seq(){return this.seq_}get agents(){return this.agents_}get loading(){return this.refreshPromise!==null}get loadingOlder(){return this.loadingOlder_}get loadOlderError(){return this.loadOlderError_}get refreshError(){return this.refreshError_}refresh(){if(this.refreshPromise!==null)return this.refreshPromise;this.refreshError_=!1;const t=this.fetchPage({pageSize:this.pageSize}).then(n=>this.applyPage(n,!0)).catch(n=>{throw this.refreshError_=!0,n}).finally(()=>{this.refreshPromise=null;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()});return this.refreshPromise=t,this.onChange?.(),t}receiveReset(t,n){this.transcript.receive([{op:"reset",agentId:this.agentId,snapshot:t}]),n!==void 0&&(this.seq_=n),this.refreshError_=!1,this.onChange?.()}applyOps(t,n){if(this.refreshPromise!==null||this.loadingOlder_)return this.buffered.push({ops:t,...n!==void 0?{seq:n}:{}}),!1;if(n!==void 0&&this.seq_!==void 0){if(n<=this.seq_)return!0;if(n!==this.seq_+1)return this.onGap?.(),!1}const o=this.transcript.apply(t);return n!==void 0&&(this.seq_=n),o.gap!==void 0&&this.onGap?.(),o.accepted.length>0&&this.onChange?.(),o.gap===void 0}async loadOlder(){if(!this.snapshot.hasMoreOlder||this.loadingOlder_)return;const t=this.snapshot.items.find(n=>n.kind==="turn");if(t?.kind==="turn"){this.loadingOlder_=!0,this.loadOlderError_=!1,this.onChange?.();try{const n=await this.fetchPage({beforeTurn:t.turnId,pageSize:this.pageSize});this.applyPage(n,!1)}catch(n){throw this.loadOlderError_=!0,n}finally{this.loadingOlder_=!1;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()}}}applyPage(t,n){this.agents_=t.agents;const o=this.snapshot,s=n?t:{...t,items:hme(t.items,o.items),hasMoreOlder:t.hasMoreOlder};this.receiveReset(s,n?t.seq:void 0)}}function hme(e,t){const n=new Set,o=[];for(const s of[...e,...t]){const i=s.kind==="turn"?s.turnId:s.kind==="marker"?s.markerId:s.refId;n.has(i)||(n.add(i),o.push(s))}return o}function mme(e){const t=qS(new Map),n=new Map,o=new Map,s=new Set;let i=null,r=null;function l(){i!==null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(i),i=null),r!==null&&(clearTimeout(r),r=null);for(const _ of s)_.version.value+=1;s.clear()}function a(_){s.add(_),!(i!==null||r!==null)&&(typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(l)),r=setTimeout(l,50))}function u(_,g){return`${_}\0${g}`}function c(_,g,x){const S=e.getEventConnection();S!==null&&(S.subscribeTranscript(_,g,x),o.set(_,g))}function d(_,g){const x=u(_,g),S=t.get(x);if(S!==void 0)return S;const T={channel:new pme({sessionId:_,agentId:g,fetchPage:A=>e.api.getSessionTranscript(_,{...A,agentId:g}),onChange:()=>{a(T)},onGap:()=>{f(T)}}),version:Z(0),baselineLoaded:!1,resumePromise:null};return t.set(x,T),T}async function f(_){if(_.resumePromise!==null)return _.resumePromise;const g=h(_).finally(()=>{_.resumePromise===g&&(_.resumePromise=null)});return _.resumePromise=g,g}async function h(_){try{await _.channel.refresh(),_.baselineLoaded=!0,n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId,_.channel.seq)}catch{n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId)}}function m(_,g){e.connectEventsIfNeeded(),n.set(_,g);const x=d(_,g);return x.baselineLoaded?c(_,g,x.channel.seq):f(x),x}function v(_,g){if(n.get(_)!==g)return;n.delete(_);const x=o.get(_);x!==void 0&&(e.getEventConnection()?.unsubscribeTranscript(_,[x]),o.delete(_))}function k(_,g,x,S){if(n.get(_)!==g)return;const T=d(_,g);T.channel.receiveReset(x,S),T.baselineLoaded=!0}function w(_,g,x,S){return n.get(_)!==g?!0:d(_,g).channel.applyOps(x,S)}function b(_){n.delete(_),o.delete(_)&&e.getEventConnection()?.unsubscribeTranscript(_);for(const[g,x]of t)x.channel.sessionId===_&&(t.delete(g),s.delete(x))}return{getEntry:(_,g)=>t.get(u(_,g)),activate:m,deactivate:v,receiveReset:k,applyOps:w,forgetSession:b}}const $h=XT(),Da=phe(),nN=cn.permission,oN=cn.activeWorkspace,sN=cn.planMode,iN=cn.swarmMode,rN=cn.goalMode,Hx=40401,Ag=cn.onboarded;ur(cn.codeFont);ur(cn.accent);ur(cn.theme);ur(cn.thinking);ur(cn.notifyOnComplete);ur(cn.notifyOnQuestion);ur(cn.notifyOnApproval);ur(cn.soundOnComplete);function gme(){try{const e=ui(nN);if(e==="auto"||e==="yolo"||e==="manual")return e}catch{}return"manual"}function vme(e){try{Ls(nN,e)}catch{}}function b4(e){const t=ui(e);if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const o={};for(const[s,i]of Object.entries(n))i===!0&&(o[s]=!0);return o}catch{return{}}}function P5(e,t){try{const n={};for(const[o,s]of Object.entries(t))s&&(n[o]=!0);Ls(e,JSON.stringify(n))}catch{}}function lN(){P5(sN,Me.planModeBySession)}function aN(){P5(iN,Me.swarmModeBySession)}function uN(){P5(rN,Me.goalModeBySession)}function yme(){try{return ui(oN)}catch{return null}}const cN=cn.hiddenWorkspaces;function kme(){try{const e=ui(cN);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function bme(e){try{Ls(cN,JSON.stringify(e))}catch{}}function Cme(e){try{Ls(oN,e)}catch{}}function wme(e,t){if(t&&e.startsWith(t)){const o=e.slice(t.length);return o?`~${o}`:"~"}const n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??""}`:e}const Me=Go({...oY(),connected:!1,serverVersion:"",dangerousBypassAuth:!1,backend:"v1",experimentalFlags:{},workspaceName:"kimi-web",connection:"disconnected",permission:gme(),thinking:void 0,thinkingBySession:{},pendingThinkingBySession:{},planModeBySession:b4(sN),swarmModeBySession:b4(iN),goalModeBySession:b4(rN),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:Ey(),authReady:!1,defaultModel:null,managedProviderStatus:null,managedUserInfo:null,managedMembership:null,workspaces:[],activeWorkspaceId:yme(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:kme(),availableOpenInApps:[],config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1,flatSessionsNextPageToken:null,flatSessionsHasMore:!0,flatSessionsLoading:!1,flatSessionsLoadingMore:!1,flatSessionsSeeded:!1,flatSessionsFrontier:null}),Mg=Go({}),np=new Map,If=new Map;function _me(e,t){return`${e}\0${t??"*"}`}async function b8(e,t){const n=_me(e,t),o=(np.get(n)??0)+1;np.set(n,o),t!==void 0&&If.set(e,(If.get(e)??0)+1);const s=If.get(e)??0;try{const i=await _t().getSessionPlans(e,{agentId:"main",toolCallId:t});if(np.get(n)!==o||t===void 0&&(If.get(e)??0)!==s||!Me.sessions.some(l=>l.id===e))return;const r=Object.fromEntries(i.map(l=>[l.toolCallId,l]));Mg[e]=t===void 0?r:{...Mg[e],...r}}catch(i){gl("[refreshSessionPlans] plan history unavailable for",e,i)}}function xme(e){const t=`${e}\0`;for(const n of np.keys())n.startsWith(t)&&np.delete(n);If.delete(e),delete Mg[e]}const F2=Go({planMode:!1,swarmMode:!1,goalMode:!1});function D5(e){Me.sessions=e}function R2(e,t){Me.sessions=Me.sessions.map(n=>n.id===e?t(n):n)}function Sme(e){Me.sessions=[e,...Me.sessions.filter(t=>t.id!==e.id)]}function Ame(e){Me.sessions=[...Me.sessions,e]}function Mme(e){Me.sessions=Me.sessions.filter(t=>t.id!==e)}function dN(){const e=Me.activeSessionId;e&&Me.unreadBySession[e]&&typeof document<"u"&&document.visibilityState==="visible"&&(Me.unreadBySession[e]=!1,Iy({[e]:!1}))}typeof window<"u"&&window.addEventListener("storage",e=>{e.key===cn.unread&&(Me.unreadBySession=Ey(),dN())});function C8(){if(rr===null||!rr.health().stale)return;bi("ws:stale-reconnect",{sessionId:Me.activeSessionId,status:"stale"}),D0e("ws: stale socket on focus, reconnecting",{activeSessionId:Me.activeSessionId}),rr.reconnect();const e=Me.activeSessionId;e&&Lg.request(e)}typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(dN(),C8())});typeof window<"u"&&(window.addEventListener("focus",C8),window.addEventListener("online",C8));function B5(e){Me.activeSessionId=e}function Tme(e){Ni(Me.messagesBySession,e)}function Eme(e,t){Me.messagesBySession[e]=t}function fN(e,t){Me.messagesBySession[e]=t(Me.messagesBySession[e]??[])}function Ime(e){delete Me.messagesBySession[e]}function pN(e){rr?.unsubscribe(e),Tg.forgetSession(e),ege(e),Gd.discard(({meta:t})=>t.sessionId===e),Mme(e),Ime(e),xme(e),delete Me.approvalsBySession[e],delete Me.questionsBySession[e],delete Me.tasksBySession[e],delete Me.goalBySession[e],delete Me.gitStatusBySession[e],delete Me.lastSeqBySession[e],delete Me.compactionBySession[e],delete Me.messagesLoadingMoreBySession[e],delete Me.messagesHasMoreBySession[e],delete Me.messagesLoadMoreErrorBySession[e],delete w8[e],Ig.delete(e),um.delete(e),MN.delete(e),ime(e),delete Me.queuedBySession[e],delete Me.promptIdBySession[e],delete Me.inFlightBySession[e],delete Me.turnActiveBySession[e],delete Me.turnEndedPromptIdBySession[e],delete Me.turnErrorBySession[e],delete Me.turnRetryBySession[e],delete Me.planModeBySession[e],delete Me.swarmModeBySession[e],delete Me.goalModeBySession[e],delete Me.thinkingBySession[e],delete Me.pendingThinkingBySession[e],lN(),aN(),uN(),Yo.value.includes(e)&&(Yo.value=uE(Yo.value,e),k1(Yo.value))}const hN=Z(null),mN=Z([]),gN=Z(!1),vN=Z(null),yN=Z(!1),kN=Z(!1),bN=Z(null);async function _c(e){let t;try{t=await _t().getSessionStatus(e)}catch{return}R2(e,n=>({...n,model:t.model||n.model,usage:{...n.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),Me.swarmModeBySession[e]=t.swarmMode,Me.planModeBySession[e]=t.planMode,t.thinkingEffort.length>0&&rE(Me,e,t.thinkingEffort)}async function Lme(e){const t=Me.goalVersionBySession[e]??0;let n;try{n=await _t().getSessionGoal(e)}catch{return}(Me.goalVersionBySession[e]??0)===t&&(n===null||n.status==="complete"?delete Me.goalBySession[e]:Me.goalBySession[e]=n)}function CN(e,t){const n=t??Me.activeSessionId;if(!n)return Promise.resolve(!1);const o=e.thinking!==void 0?Me.pendingThinkingBySession[n]:void 0;return Promise.resolve(_t().updateSession(n,e)).then(()=>(vl(Me,n,o),_c(n))).then(()=>!0).catch(s=>(vl(Me,n,o)&&_c(n),t0("persistSessionProfile",s,{sessionId:n}),!1))}function wN(e){try{return ui(e)??""}catch{return""}}function $me(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("kimi_onboarded")==="1"}const _N=$me();if(_N&&wN(Ag)!=="1")try{Ls(Ag,"1")}catch{}const xN=Z(_N||wN(Ag)==="1");function Nme(e){xN.value=e;try{Ls(Ag,e?"1":"0")}catch{}e&&window.kimiDesktop?.setOnboarded?.()}let rr=null;const Tg=mme({api:_t(),connectEventsIfNeeded:H5,getEventConnection:()=>rr});let zx=0;function SN(){return zx+=1,`msg_opt_${Date.now().toString(36)}_${zx}`}function Wx(e,t,n){const o={sessions:Me.sessions,activeSessionId:Me.activeSessionId,messagesBySession:Me.messagesBySession,approvalsBySession:Me.approvalsBySession,planReviewByToolCallId:Me.planReviewByToolCallId,questionsBySession:Me.questionsBySession,tasksBySession:Me.tasksBySession,goalBySession:Me.goalBySession,goalVersionBySession:Me.goalVersionBySession,lastSeqBySession:Me.lastSeqBySession,turnActiveBySession:Me.turnActiveBySession,turnEndedPromptIdBySession:Me.turnEndedPromptIdBySession,turnErrorBySession:Me.turnErrorBySession,turnRetryBySession:Me.turnRetryBySession,compactionBySession:Me.compactionBySession,config:Me.config,warnings:Me.warnings},s=fY(o,e,{sessionId:t,seq:n},{t:(i,r)=>r===void 0?Hn.global.t(i):Hn.global.t(i,r)});s.sessions!==o.sessions&&D5(s.sessions),s.activeSessionId!==o.activeSessionId&&B5(s.activeSessionId),Tme(s.messagesBySession),Ni(Me.approvalsBySession,s.approvalsBySession),Ni(Me.planReviewByToolCallId,s.planReviewByToolCallId),Ni(Me.questionsBySession,s.questionsBySession),Ni(Me.tasksBySession,s.tasksBySession),Ni(Me.goalBySession,s.goalBySession),Ni(Me.goalVersionBySession,s.goalVersionBySession),Ni(Me.lastSeqBySession,s.lastSeqBySession),Ni(Me.turnActiveBySession,s.turnActiveBySession),Ni(Me.turnEndedPromptIdBySession,s.turnEndedPromptIdBySession),Ni(Me.turnErrorBySession,s.turnErrorBySession),Ni(Me.turnRetryBySession,s.turnRetryBySession),Ni(Me.compactionBySession,s.compactionBySession),s.config!==o.config&&(Me.config=s.config??null),pY(s.warnings,o.warnings)||(Me.warnings=s.warnings),e.type==="configChanged"&&(Me.defaultModel=e.config.defaultModel??null),e.type==="modelCatalogChanged"&&(Rn.loadModels(),Rn.loadProviders()),e.type==="sessionUsageUpdated"&&(e.swarmMode!==void 0&&(Me.swarmModeBySession[e.sessionId]=e.swarmMode),e.planMode!==void 0&&(Me.planModeBySession[e.sessionId]=e.planMode),e.thinking!==void 0&&rE(Me,e.sessionId,e.thinking)),e.type==="sessionDeleted"&&V5(e.sessionId)}function Fme(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return;if(n.role==="assistant")for(let o=n.content.length-1;o>=0;o--){const s=n.content[o];if(s.type==="toolUse"&&s.toolName==="ExitPlanMode")return s.toolCallId}}}function Rme(e,t){const n=Me.lastSeqBySession[t.sessionId]??0,o=Me.turnActiveBySession[t.sessionId]??!1,s=e.type==="approvalResolved"||e.type==="approvalExpired"?Me.approvalsBySession[t.sessionId]?.find(r=>r.approvalId===e.approvalId&&r.toolName==="ExitPlanMode")?.toolCallId:void 0,i=si.sideChatTargetBySession.value[t.sessionId];if(e.type==="messageCreated"&&e.message.role==="user"&&e.agentId!==void 0&&Object.prototype.hasOwnProperty.call(Me.sideChatMessagesByAgent,e.agentId)){Wx({type:"unknown",raw:{_noop:!0}},t.sessionId,t.seq),si.reconcileSideChatUserMessage(e.agentId,e.message);return}if(Wx(e,t.sessionId,t.seq),i){const{agentId:r}=i,l=t.sessionId;e.type==="agentDelta"&&e.agentId===r?e.delta.text&&si.appendSideChatAssistantText(r,l,e.delta.text):e.type==="agentTurnEnded"&&e.agentId===r?si.finishSideChatAgent(r,l):e.type==="taskProgress"&&e.taskId===r?si.appendSideChatAssistantText(r,l,e.outputChunk):e.type==="taskCompleted"&&e.taskId===r&&si.finishSideChatAgent(r,l,e.outputPreview)}if(e.type==="messageCreated"&&e.message.role==="user"&&e.message.promptId!==void 0){const r=e.message.sessionId;Me.promptIdBySession[r]!==e.message.promptId&&(Me.promptIdBySession[r]=e.message.promptId)}if(e.type==="turnActiveChanged"&&!e.active&&t.seq>n){const r=e.reason;y2e(e.sessionId,r==="cancelled"||r==="failed"||r==="blocked"?"aborted":"idle",o);const l=Fme(Me.messagesBySession[e.sessionId]??[]);l!==void 0&&b8(e.sessionId,l)}e.type==="sessionWorkChanged"&&(e.mainTurnActive===!1&&o||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&v2e(e.sessionId),(e.type==="promptAborted"||e.type==="promptCompleted"&&e.reason==="blocked")&&t.seq>n&&Me.promptIdBySession[e.sessionId]===e.promptId&&At.finishPromptLocal(e.sessionId),e.type==="questionRequested"&&k2e(e.sessionId,e.question),e.type==="approvalRequested"&&b2e(e.sessionId,e.approval),s!==void 0&&b8(t.sessionId,s)}const Gd=gX(({appEvent:e,meta:t})=>Rme(e,t),({appEvent:e})=>fX(e),{coalesce:yX}),Ome=3e4;let Ux=0,oi=null;const op=new Map;let Eg=0,Yd=null;function Pme(){Yd!==null&&(clearTimeout(Yd),Yd=null)}function jx(e){if(!Me.connected||Yd!==null)return;const t=Math.min(Ome,1e3*2**Eg);Eg+=1,gl("[kimi-web] session work reconciliation incomplete; retrying",e),Yd=setTimeout(()=>{Yd=null,Me.connected&&AN()},t)}function Dme(e,t){const n=new Map(e.map(u=>[u.id,u]));let o=!1,s=!1;const i={...Me.turnActiveBySession},r=[],l=new Map,a=Me.sessions.map(u=>{const c=n.get(u.id);if(c===void 0)return u;const d=t.workEventSeqBySession.get(u.id)??0,f=t.turnEventSeqBySession.get(u.id)??0,h=t.pendingEventBySession.get(u.id),m=d>c.lastSeq,v=f>c.lastSeq,k=h!==void 0&&h.seq>c.lastSeq,w=m||v&&u.mainTurnActive===!0?u.busy||u.mainTurnActive===!0:c.busy,b=m||v?u.mainTurnActive:c.mainTurnActive??(w?u.mainTurnActive:!1),_=k?h.source==="work"?u.pendingInteraction:(Me.approvalsBySession[u.id]?.length??0)>0?"approval":(Me.questionsBySession[u.id]?.length??0)>0?"question":"none":c.pendingInteraction??(w?u.pendingInteraction:"none");(k&&h.source==="work"||!k&&(c.pendingInteraction!==void 0||c.busy===!1))&&_!==void 0&&l.set(u.id,_);const g=m?u.lastTurnReason:c.lastTurnReason;op.set(u.id,Math.max(op.get(u.id)??0,c.lastSeq));const x=t.turnStartBySession.get(u.id);return(b===!1||b===void 0&&!w)&&t.witnessedTurnBySession.has(u.id)&&x!==void 0&&At.isLocalTurnSnapshotCurrent(u.id,x)&&r.push(u.id),b===!0&&!i[u.id]?(i[u.id]=!0,s=!0):(b===!1||!w)&&i[u.id]&&(delete i[u.id],s=!0),u.busy===w&&u.mainTurnActive===b&&u.pendingInteraction===_&&u.lastTurnReason===g?u:(o=!0,{...u,busy:w,mainTurnActive:b,pendingInteraction:_,lastTurnReason:g})});o&&D5(a),s&&Ni(Me.turnActiveBySession,i);for(const[u,c]of l)c==="none"?(delete Me.approvalsBySession[u],delete Me.questionsBySession[u]):c==="question"&&delete Me.approvalsBySession[u];for(const u of r)At.finishPromptLocal(u,{turnWasActive:!0})}async function AN(){const e={workEventSeqBySession:new Map,turnEventSeqBySession:new Map,pendingEventBySession:new Map,turnStartBySession:new Map(Me.sessions.map(t=>[t.id,At.localTurnStartState(t.id)])),witnessedTurnBySession:new Set(Me.sessions.filter(t=>Me.inFlightBySession[t.id]||Me.turnActiveBySession[t.id]).map(t=>t.id))};oi=e;try{const t=await At.listAllSessionsGlobal({shouldContinue:()=>oi===e&&Me.connected});if(oi!==e||!Me.connected)return;Gd.flush(),Dme(t.sessions,e),oi=null,t.error!==void 0?jx(t.error):Eg=0}catch(t){if(oi!==e||!Me.connected)return;oi=null,jx(t)}}function H5(){if(rr!==null||typeof WebSocket>"u")return;bi("ws:connection",{status:"connecting"}),Me.connection="connecting",rr=_t().connectEvents({onEvent(t,n){if(t.type==="workspaceCreated"||t.type==="workspaceUpdated"||t.type==="workspaceDeleted"){At.applyWorkspaceEvent(t);return}const o=t.type==="sessionWorkChanged",s=t.type==="turnActiveChanged",i=t.type==="approvalRequested"||t.type==="approvalResolved"||t.type==="approvalExpired"||t.type==="questionRequested"||t.type==="questionAnswered"||t.type==="questionDismissed";if((o||s||i)&&n.seq>0){const r=op.get(n.sessionId)??0;if(n.seq<=r)return;op.set(n.sessionId,n.seq)}if(oi!==null&&(o||s||i))if(o){const r=oi.workEventSeqBySession.get(n.sessionId)??0;if(n.seq>r&&oi.workEventSeqBySession.set(n.sessionId,n.seq),t.pendingInteraction!==void 0||!t.busy){const l=oi.pendingEventBySession.get(n.sessionId);(l===void 0||n.seq>l.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"work"})}}else if(s){const r=oi.turnEventSeqBySession.get(n.sessionId)??0;n.seq>r&&oi.turnEventSeqBySession.set(n.sessionId,n.seq)}else{const r=oi.pendingEventBySession.get(n.sessionId);(r===void 0||n.seq>r.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"interaction"})}for(const r of vX({appEvent:t,meta:n}))Gd(r)},onResync(t,n,o){bi("ws:resync",{sessionId:t,status:"required",seq:n}),Gd.flush(),Ig.add(t),Lg.request(t)},onError(t,n,o){bi("ws:error",{status:"failed",errorCode:t,fatal:o}),O2({severity:"error",title:Hn.global.t("warnings.wsTitle"),message:n,details:[Lo("message",n)].filter(s=>s!==void 0)})},onConnectionChange(t){bi("ws:connection",{status:t?"connected":"disconnected"}),Me.connected=t,Me.connection=t?"connected":"disconnected",t||(oi=null,op.clear(),Pme(),Eg=0),t&&(Ux+=1,qme(),At.refreshServerMeta())},onReplayComplete(){Gd.flush(),Ux>1&&AN()},onTranscriptReset(t,n,o,s){Tg.receiveReset(t,n,o,s)},onTranscriptOps(t,n,o,s){return Tg.applyOps(t,n,o,s)}})}const w8={},Ig=new Set,um=new Set,MN=new Set;function Bme(e){return Us(e)&&e.code===Hx?!0:typeof e=="object"&&e!==null&&e.code===Hx}function Lo(e,t){if(!(t==null||t===""))return{label:Hn.global.t(`warnings.details.${e}`),value:TN(t)}}function TN(e){if(e instanceof Error)return typeof e.stack=="string"&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Hme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.name=="string"?e.name:void 0}function zme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.message=="string"?e.message:void 0}function Wme(e){return e instanceof Error&&typeof e.stack=="string"&&e.stack?e.stack:void 0}function Ume(e){if(!(typeof e!="number"||!Number.isFinite(e)))return new Date(e).toISOString()}function Vx(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`${Math.round(e)}ms`}function jme(e,t,n){const o=iy(t),s=Us(t),i=o||s?t.timestamp:void 0,r=o||s?t.durationMs:void 0,l=[Lo("operation",e),Lo("sessionId",n??Me.activeSessionId),Lo("connection",Me.connection),Lo("timestamp",Ume(i??Date.now()))];return o?l.push(Lo("duration",Vx(r)),Lo("request",`${t.method} ${t.path}`),Lo("endpoint",t.url),Lo("requestId",t.requestId),Lo("phase",t.phase),Lo("timeout",`${t.timeoutMs}ms`),Lo("status",t.status===void 0?void 0:`${t.status} ${t.statusText??""}`.trim()),Lo("contentType",t.contentType),Lo("responsePreview",t.bodyPreview),Lo("cause",t.cause)):s?l.push(Lo("duration",Vx(r)),Lo("code",t.code),Lo("requestId",t.requestId),Lo("message",t.message),Lo("details",t.details)):l.push(Lo("errorName",Hme(t)),Lo("message",zme(t)??TN(t)),Lo("stack",Wme(t))),l.filter(a=>a!==void 0)}function Vme(e,t,n={}){const o=iy(t),s=Us(t),i=n.title??(o?Hn.global.t("warnings.daemonNetworkTitle"):s?Hn.global.t("warnings.daemonApiTitle"):Hn.global.t("warnings.operationFailedTitle")),r=n.message??(o?Hn.global.t("warnings.daemonNetworkMessage"):s?t.message:Hn.global.t("warnings.operationFailedMessage"));return{severity:"error",title:i,message:r,details:jme(e,t,n.sessionId)}}function O2(e){Me.warnings=[...Me.warnings,e]}function qme(){const e=Hn.global.t("warnings.wsTitle"),t=Me.warnings.filter(n=>!(typeof n=="object"&&n!==null&&n.severity==="error"&&n.title===e));t.length!==Me.warnings.length&&(Me.warnings=t)}function t0(e,t,n){Xl(`[kimi-web] operation failed: ${e}`,t);const o=Us(t),s=iy(t);bi("operation:failed",{sessionId:n?.sessionId,status:"failed",operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:o?t.code:void 0,requestId:o||s?t.requestId:void 0,phase:s?t.phase:void 0,httpStatus:s?t.status:void 0}),O2(Vme(e,t,n))}const Kme={40913:"warnings.goal.alreadyExists",40914:"warnings.goal.notFound",40915:"warnings.goal.statusInvalid",40916:"warnings.goal.notResumable",40918:"warnings.goal.objectiveTooLong"};function Zme(e){if(!Us(e)||e.code===void 0)return;const t=Kme[e.code];return t?Hn.global.t(t):void 0}async function Gme(e){if(pN(e),Me.activeSessionId!==e)return;const t=Me.sessions[0];t?await At.selectSession(t.id,{urlMode:"replace"}):(B5(void 0),Me.sessionLoading=!1,At.writeSessionUrl(void 0,"replace"))}const qx=new Set;async function Yme(e){if(!qx.has(e)){qx.add(e);try{const t=await _t().getSessionWarnings(e),n=Hn.global.t("warnings.noteLabel");for(const o of t)O2(`${n}: ${o.message}`)}catch{}}}async function z5(e,t){const n=At.localTurnStartState(e);try{const s=await _t().getSessionSnapshot(e);if(!Me.sessions.some(c=>c.id===e))return"ok";Gd.flush();const i=Me.lastSeqBySession[e]??0,r=w8[e],l=Ig.has(e)||$g.has(e);if(!l&&r!==void 0&&r===s.epoch&&i>s.asOfSeq)return um.delete(e)||(um.add(e),Lg.request(e)),"ok";if(!At.isLocalTurnSnapshotCurrent(e,n))return At.afterLocalTurnStartsSettle(e,()=>{Lg.request(e)}),"ok";const a=Me.turnRetryBySession[e];a!==void 0&&a.turnId!==s.inFlightTurn?.turnId&&delete Me.turnRetryBySession[e],(l||s.session.lastTurnReason!=="failed")&&delete Me.turnErrorBySession[e];const u=o3(s.session.usage);R2(e,c=>({...s.session,model:s.session.model&&s.session.model.length>0?s.session.model:c.model,usage:u?c.usage:s.session.usage,updatedAt:!s.session.mainTurnActive&&s.session.updatedAt>c.updatedAt?s.session.updatedAt:c.updatedAt})),Eme(e,gQ(Me.messagesBySession[e]??[],s.messages)),Me.tasksBySession[e]=_Q(s.subagents,Me.tasksBySession[e]??[]),Me.messagesHasMoreBySession[e]=s.hasMoreMessages,Me.approvalsBySession[e]=s.pendingApprovals;for(const c of s.pendingApprovals){const d=c.display;d?.kind==="plan_review"&&typeof d.plan=="string"&&d.plan.length>0&&(Me.planReviewByToolCallId[c.toolCallId]={plan:d.plan,path:typeof d.path=="string"?d.path:void 0})}return Me.questionsBySession[e]=s.pendingQuestions,Me.lastSeqBySession[e]=s.asOfSeq,w8[e]=s.epoch,Ig.delete(e),um.delete(e),At.handleSessionSnapshot(e,{inFlightTurn:s.inFlightTurn,busy:s.session.busy}),s.session.mainTurnActive??(s.inFlightTurn!==null&&s.session.busy)?Me.turnActiveBySession[e]=!0:delete Me.turnActiveBySession[e],H5(),rr&&(rr.seedSnapshot(e,s),rr.subscribe(e,{seq:s.asOfSeq,epoch:s.epoch}),Qme(e)),$g.delete(e),u&&t?.skipStatusRefresh!==!0&&_c(e),Yme(e),"ok"}catch(o){return Bme(o)?(await Gme(e),"not-found"):(t0("getSessionSnapshot",o,{title:Hn.global.t("warnings.sessionSnapshotTitle"),message:Hn.global.t("warnings.sessionSnapshotMessage"),sessionId:e}),"failed")}}const Lg=vQ(z5);function Xme(e){return Object.prototype.hasOwnProperty.call(Me.messagesBySession,e)}const Jme=4,ql=[],$g=new Set;function Qme(e){const t=ql.indexOf(e);for(t!==-1&&ql.splice(t,1),ql.unshift(e);ql.length>Jme;){let n=-1;for(let s=ql.length-1;s>=0;s--)if(ql[s]!==Me.activeSessionId){n=s;break}if(n===-1)break;const[o]=ql.splice(n,1);if(o===void 0)break;rr?.unsubscribe(o),$g.add(o)}}function ege(e){const t=ql.indexOf(e);t!==-1&&ql.splice(t,1),$g.delete(e)}async function tge(e){return z5(e)}function u1(e,t){return(Me.inFlightBySession[e]??!1)||(Me.turnActiveBySession[e]??!1)||(t??Me.sessions.find(n=>n.id===e)?.mainTurnActive??!1)}function n0(e){try{const t=new Date(e),o=Date.now()-t.getTime(),s=o/36e5;if(o<6e4)return Hn.global.t("sessions.justNow");if(s<1)return`${Math.round(o/6e4)}m`;if(s<24)return`${Math.round(s)}h`;const i=o/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}const nge=3e4,xc=Z(0);let C4=null;function oge(){C4===null&&(C4=setInterval(()=>{xc.value=(xc.value+1)%Number.MAX_SAFE_INTEGER},nge),C4.unref?.())}function sge(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";if(Array.isArray(t.diff))return{kind:"diff",path:o,diff:t.diff};const s=typeof t.old_text=="string"?t.old_text:typeof t.before=="string"?t.before:void 0,i=typeof t.new_text=="string"?t.new_text:typeof t.after=="string"?t.after:void 0;if(s!==void 0&&i!==void 0){const r=r1(s,i)??Pm(s,i);return{kind:"diff",path:o,diff:r}}return{kind:"diff",path:o,diff:[]}}if(n==="file_io"){const o=typeof t.path=="string"?t.path:"",s=typeof t.operation=="string"?t.operation:"";if(s==="write"&&typeof t.content=="string")return{kind:"file",path:o,content:t.content};if(s==="edit"&&typeof t.before=="string"&&typeof t.after=="string"){const r=r1(t.before,t.after)??Pm(t.before,t.after);return{kind:"diff",path:o,diff:r}}const i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s||n,path:o,detail:i}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action,s=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:DT(o);return{kind:"shell",command:o,cwd:s,danger:i}}if(n==="file_content"||n==="file"){const o=typeof t.path=="string"?t.path:"",s=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:o,content:s,language:i}}if(n==="file_op"||n==="fileop"){const o=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,s=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:o,path:s,detail:i}}if(n==="url_fetch"||n==="url"){const o=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:o}}if(n==="search"){const o=typeof t.query=="string"?t.query:e.action,s=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:o,scope:s}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const o=typeof t.kind=="string"?t.kind:n,s=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:o,name:s,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},u=typeof a.label=="string"?a.label:"";if(!u)return null;const c=typeof a.description=="string"?a.description:void 0;return{label:u,description:c}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function ige(e){return{questionId:e.questionId,sessionId:e.sessionId,toolCallId:e.toolCallId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function rge(e){const t=Me.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const s of t)if(s.role==="assistant")for(const i of s.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const o=`task_id: ${e.id}`;for(const s of t)if(s.role==="tool")for(const i of s.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(o)){const l=n.get(i.toolCallId);if(l)return l}}}function lge(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Hn.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Hn.global.t("tasks.timingDone",{sec:r})}else n=e.status;const o=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,s=e.command??rge(e),i=e.kind==="bash"&&s?`$ ${s}`:void 0;return{id:e.id,agentId:e.agentId,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:o,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId,model:e.model,thinkingEffort:e.thinkingEffort}}const age=R(()=>{const e=Me.sessions.find(n=>n.id===Me.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:Me.workspaceName,branch:t}}),uge=R(()=>(xc.value,Me.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:n0(e.updatedAt),busy:u1(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason,workspaceId:Ml(e),cwd:e.cwd})))),cge=R(()=>Me.activeSessionId??""),dge=R(()=>{const e=Me.activeSessionId;if(e)return Rn.skillsBySession.value[e]??[];const t=P2.value;return t?Rn.skillsByWorkspace.value[t]??[]:[]}),W5=R(()=>{const e=Me.activeSessionId;return e?Me.inFlightBySession[e]??!1:!1}),fge=R(()=>At.isStartingFirstPrompt()),si=fme(Me,{pushOperationFailure:t0,nextOptimisticMsgId:SN,connectEventsIfNeeded:H5,getEventConn:()=>rr,resolveThinkingForPrompt:(e,t)=>Rn.resolveThinkingForPrompt(e,t),refreshSessionStatus:_c}),o0=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=si.sideChatTargetBySession.value[e]?.agentId;return(Me.tasksBySession[e]??[]).filter(n=>n.id!==t)}),EN=ghe(Me,o0),s0=R(()=>{const e=Me.activeSessionId;return e?(Me.turnActiveBySession[e]??!1)||(Me.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),pge=R(()=>{const e=Me.activeSessionId;if(e)return Me.turnErrorBySession[e]}),hge=R(()=>{const e=Me.activeSessionId;if(e&&s0.value)return Me.turnRetryBySession[e]}),IN=e=>_t().getFileUrl(e),mge=[],gge=KT(),vge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=new Set(Me.sideChatUserMessageIdsBySession[e]??[]);return gge({messages:(Me.messagesBySession[e]??[]).filter(n=>!t.has(n.id)),approvals:Me.approvalsBySession[e]??mge,getFileUrl:IN,sessionActive:s0.value,planReviewByToolCallId:Me.planReviewByToolCallId,plansByToolCallId:Mg[e]})}),yge=R(()=>W5.value||s0.value),kge=R(()=>(EN.taskClock.value,o0.value.map(lge))),LN=R(()=>IX(o0.value)),bge=R(()=>$X(o0.value)),vd=R(()=>{const e=Me.activeSessionId;return e?Me.goalBySession[e]??null:null}),Cge=R(()=>{const e=Me.activeSessionId;return e?bX(Me.messagesBySession[e]??[]):[]}),wge=R(()=>{const e=Me.activeSessionId;return e?Me.compactionBySession[e]??null:null}),_ge=R(()=>Me.connection),xge=R(()=>Me.loading),Sge=R(()=>Me.sessionLoading),Age=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadingMoreBySession[e]??!1:!1}),Mge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesHasMoreBySession[e]??!1:!1}),Tge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadMoreErrorBySession[e]??!1:!1}),Ege=R(()=>Me.serverVersion),Ige=R(()=>Me.experimentalFlags),Lge=R(()=>Me.backend),$ge=R(()=>Me.dangerousBypassAuth);function Nge(){Me.dangerousBypassAuth=!1}const Fge=R(()=>Me.permission),Rge=R(()=>Me.thinking),$N=R(()=>{const e=Me.activeSessionId;return e?Me.planModeBySession[e]??!1:F2.planMode}),Oge=R(()=>{const e=Me.activeSessionId;return e?Me.swarmModeBySession[e]??!1:F2.swarmMode}),Pge=R(()=>{const e=Me.activeSessionId;return e?Me.goalModeBySession[e]??!1:F2.goalMode}),Dge=R(()=>{const e=LX(LN.value);return{plan:$N.value,goal:vd.value&&vd.value.status!=="complete"?{status:vd.value.status,turnsUsed:vd.value.turnsUsed,elapsedMs:vd.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Bge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=_t();return(Me.queuedBySession[e]??[]).map(n=>({id:n.id??n.text,text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(o=>({fileId:o.fileId,kind:o.kind,url:t.getFileUrl(o.fileId),name:o.name}))}))}),Hge=R(()=>Me.warnings),zge=R(()=>{const e=Me.activeSessionId;return e?(Me.questionsBySession[e]??[]).map(ige):[]}),Wge=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:sge(t),agentName:t.agentName,toolCallId:t.toolCallId})):[]}),U5=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).length>0?"awaiting-approval":(Me.questionsBySession[e]??[]).length>0?"awaiting-question":W5.value||s0.value?"running":"idle":"idle"}),Rn=dme(Me,{pushOperationFailure:t0,refreshSessionStatus:_c,persistSessionProfile:CN,activity:U5,updateSession:R2,updateSessionMessages:fN,loadConfig:()=>At.loadConfig(),checkAuth:()=>At.checkAuth()}),_8=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),Uge=R(()=>{const e=Me.activeSessionId;return e?Me.gitStatusBySession[e]?.pullRequest??null:null}),jge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=Me.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,o])=>({path:n,status:o})).sort((n,o)=>n.path.localeCompare(o.path)):[]}),Vge=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),NN=R(()=>{const e=Me.sessions.find(r=>r.id===Me.activeSessionId),t=_8.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Rn.draftModel.value:null,o=(e?.model&&e.model.length>0?e.model:n??Me.defaultModel)??"—",s=Rn.models.value.find(r=>r.id===o)??Rn.models.value.find(r=>r.model===o);return{model:s?.displayName||s?.model||(o.includes("/")?o.split("/").pop():o),modelId:s?.id??o,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:Me.permission,branch:t,cwd:e?.cwd??"",isGitRepo:_8.value!==null}}),qge=R(()=>mN.value),Kge=R(()=>Me.sessions.find(t=>t.id===Me.activeSessionId)?.usage.totalCostUsd??0),Zge=R(()=>Me.authReady),Gge=R(()=>Me.defaultModel),Yge=R(()=>Me.managedProviderStatus),Xge=R(()=>Me.managedUserInfo),Jge=R(()=>Me.managedMembership),Qge=R(()=>Me.config),e2e=R(()=>{const e=Me.activeSessionId;if(!e)return{};const t=Me.gitStatusBySession[e];return t?{...t.entries}:{}}),t2e=R(()=>{const e=new Map;for(const t of Me.workspaces){const n=Pr(t.root);e.has(n)||e.set(n,t.id)}return e});function Ml(e){return t2e.value.get(Pr(e.cwd))??e.workspaceId??e.cwd}const j5=R(()=>dJ({workspaces:Me.workspaces,sessions:Me.sessions,hiddenWorkspaceRoots:Me.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:Me.sessionsHasMoreByWorkspace})),Ng=Z(wQ());Je(()=>[j5.value.map(e=>e.id).join("\0"),Me.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],o=UQ(n,Ng.value);o!==null&&(Ng.value=o,wE(o))});const Yo=Z(_E());function FN(e){const t=LJ(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function V5(e){const t=uE(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function n2e(e){const t=new Set(e),n=Yo.value.filter(o=>!t.has(o));n.length!==Yo.value.length&&(Yo.value=n,k1(n))}function o2e(e){Yo.value.includes(e)?V5(e):FN(e)}function s2e(e){const t=cE(e,Yo.value);Yo.value=t,k1(t)}function i2e(e,t,n){const o=ON.value.map(r=>r.id),s=NJ(o,e,t,n),i=cE(s,Yo.value);Yo.value=i,k1(i)}const Yr=R(()=>{const e=j5.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:wme(t.root,Me.fsHome),sessionCount:t.sessionCount}));return jQ(e,Ng.value)}),P2=R(()=>{const e=Me.activeWorkspaceId,t=Yr.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null});Je(P2,e=>{e&&(Object.prototype.hasOwnProperty.call(Rn.skillsByWorkspace.value,e)||Rn.loadSkillsForWorkspace(e))},{immediate:!0});const r2e=R(()=>{const e=P2.value;return e?Yr.value.find(t=>t.id===e)??null:null}),l2e=R(()=>{xc.value;const e=new Set(Yr.value.map(n=>n.id)),t=new Map(Yr.value.map(n=>[n.id,n.name]));return Me.sessions.filter(n=>!n.parentSessionId&&e.has(Ml(n))).map(n=>{const o=Ml(n);return{id:n.id,title:n.title,time:n0(n.updatedAt),busy:u1(n.id,n.mainTurnActive),pendingInteraction:n.pendingInteraction,lastTurnReason:n.lastTurnReason,lastPrompt:n.lastPrompt,workspaceId:o,workspaceName:t.get(o)}})}),Fg=Z(xg),q5=R(()=>{xc.value;const e=new Set(Yr.value.map(l=>l.id)),t=new Map(Yr.value.map(l=>[l.id,l.name])),n=new Set(Yo.value),o=(l,a)=>new Date(a.updatedAt).getTime()-new Date(l.updatedAt).getTime(),s=Me.flatSessionsFrontier,i=[],r=[];for(const l of Me.sessions){if(l.parentSessionId||l.archived||n.has(l.id)||!e.has(Ml(l)))continue;if(kE({busy:u1(l.id,l.mainTurnActive),unread:DN.value[l.id]??!1,renaming:!1,questionCount:x8.value[l.id]?.questions??0,approvalCount:x8.value[l.id]?.approvals??0,pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason}).hasStatus){i.push(l);continue}s!==null&&new Date(l.updatedAt).getTime(){const a=Ml(l);return{id:l.id,title:l.title,time:n0(l.updatedAt),busy:u1(l.id,l.mainTurnActive),pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason,lastPrompt:l.lastPrompt,updatedAt:l.updatedAt,workspaceId:a,workspaceName:t.get(a),cwdLabel:l.cwd?v1(l.cwd):"-",pullRequest:l.pullRequest}})}),a2e=R(()=>q5.value.slice(0,Fg.value)),u2e=R(()=>Me.flatSessionsHasMore||Fg.valueq5.value.length&&Me.flatSessionsHasMore&&At.loadMoreFlatSessions()}function RN(e){xc.value;const t=new Set(Yo.value),n=new Map,o=new Map;for(const s of Me.sessions.toSorted((i,r)=>new Date(r.updatedAt).getTime()-new Date(i.updatedAt).getTime())){if(s.parentSessionId)continue;const i=Ml(s);if(e&&t.has(s.id)){o.set(i,(o.get(i)??0)+1);continue}const r={id:s.id,title:s.title,time:n0(s.updatedAt),busy:u1(s.id,s.mainTurnActive),pendingInteraction:s.pendingInteraction,lastTurnReason:s.lastTurnReason,updatedAt:s.updatedAt},l=n.get(i)??[];l.push(r),n.set(i,l)}return Yr.value.map(s=>({workspace:s,sessions:n.get(s.id)??[],pinnedCount:o.get(s.id)??0,hasMore:Me.sessionsHasMoreByWorkspace[s.id]??!1,loadingMore:Me.sessionsLoadingMoreByWorkspace[s.id]??!1,initialCount:Me.sessionsInitialCountByWorkspace[s.id]??am}))}const d2e=R(()=>RN(!0)),f2e=R(()=>RN(!1)),ON=R(()=>{xc.value;const e=new Set(Yr.value.map(o=>o.id)),t=new Map(Yr.value.map(o=>[o.id,o.name])),n=Me.sessions.filter(o=>!o.parentSessionId&&!o.archived&&e.has(Ml(o)));return $J(n,Yo.value).pinned.map(o=>{const s=Ml(o);return{id:o.id,title:o.title,time:n0(o.updatedAt),busy:u1(o.id,o.mainTurnActive),pendingInteraction:o.pendingInteraction,lastTurnReason:o.lastTurnReason,updatedAt:o.updatedAt,workspaceId:s,workspaceName:t.get(s),pinned:!0,cwdLabel:o.cwd?v1(o.cwd):"-",pullRequest:o.pullRequest}})});function p2e(e){Ng.value=e,wE(e)}const PN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),x8=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),DN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.unreadBySession))n&&(e[t]=!0);return e}),h2e=R(()=>{const e={},t=PN.value;for(const n of Me.sessions){const o=t[n.id]??0;if(o<=0)continue;const s=Ml(n);e[s]=(e[s]??0)+o}return e}),m2e=R(()=>Me.recentRoots),g2e=R(()=>Me.availableOpenInApps),At=ame(Me,{taskPoller:EN,sideChat:si,modelProvider:Rn,pushOperationFailure:t0,activity:U5,sessionsKnownEmpty:MN,setSessions:D5,updateSession:R2,upsertSessionFront:Sme,appendSession:Ame,forgetSession:pN,unpinSessions:n2e,setActiveSessionId:B5,updateSessionMessages:fN,nextOptimisticMsgId:SN,getEventConn:()=>rr,syncSessionFromSnapshot:z5,reopenSession:tge,hasLoadedMessages:Xme,refreshSessionStatus:_c,refreshSessionGoal:Lme,refreshSessionPlans:b8,persistSessionProfile:CN,mergedWorkspaces:j5,workspacesView:Yr,status:NN,workspaceIdForSession:Ml,savePermissionToStorage:vme,savePlanModeToStorage:lN,saveSwarmModeToStorage:aN,saveGoalModeToStorage:uN,draftModes:F2,saveUnread:Iy,saveActiveWorkspaceToStorage:Cme,saveHiddenWorkspacesToStorage:bme,goalErrorMessage:Zme,initialized:kN,connectIssue:bN,selectedDiffPath:hN,fileDiffLines:mN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN});function K5(e){return e===Me.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible"&&document.hasFocus()}function v2e(e){Me.turnActiveBySession[e]&&delete Me.turnActiveBySession[e],Me.inFlightBySession[e]&&(Me.inFlightBySession[e]=!1)}function y2e(e,t,n){const o=Me.promptIdBySession[e];At.finishPromptLocal(e,{turnWasActive:n}),e===Me.activeSessionId?(At.loadGitStatus(e),_c(e)):t==="idle"&&(Me.unreadBySession[e]=!0,Iy({[e]:!0}));const s=(Me.approvalsBySession[e]??[]).length>0,i=(Me.questionsBySession[e]??[]).length>0;ohe(t,s,i)&&Da.maybeNotifyCompletion(e,{isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",promptId:o,onClick:()=>{At.selectSession(e)}})}function k2e(e,t){const n=t.questions[0],o=n?.header?.trim()??"",s=n?.question?.trim()??"",i=o&&s?`${o}: ${s}`:s||o;Da.maybeNotifyQuestion({isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,questionId:t.questionId,onClick:()=>{At.selectSession(e)}})}function b2e(e,t){Da.maybeNotifyApproval({isUserWatching:K5(e),sessionTitle:Me.sessions.find(n=>n.id===e)?.title??"",toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{At.selectSession(e)}})}function mu(){return oge(),{workspace:age,sessions:uge,activeSessionId:cge,workspacesView:Yr,visibleWorkspace:r2e,activeWorkspaceId:P2,sessionsForView:l2e,workspaceGroups:d2e,mobileWorkspaceGroups:f2e,pinnedSessions:ON,flatSessions:a2e,flatSessionsHasMore:u2e,flatSessionsLoadingMore:R(()=>Me.flatSessionsLoadingMore),attentionBySession:PN,pendingBySession:x8,attentionByWorkspace:h2e,unreadBySession:DN,recentRoots:m2e,turns:vge,tasks:kge,activeAppTasks:o0,auxiliaryTranscripts:Tg,getFileUrl:IN,todos:Cge,goal:vd,swarms:LN,swarmMembersByToolCallId:bge,activationBadges:Dge,compaction:wge,status:NN,sessionCost:Kge,fileDiff:qge,selectedDiffPath:hN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN,changes:jge,gitInfo:_8,gitDiffStats:Vge,activePullRequest:Uge,changesByPath:e2e,pendingApprovals:Wge,availableOpenInApps:g2e,connection:_ge,loading:xge,sessionLoading:Sge,loadingMoreMessages:Age,hasMoreMessages:Mge,loadMoreMessagesError:Tge,serverVersion:Ege,backend:Lge,dangerousBypassAuth:$ge,experimentalFlags:Ige,clearDangerousBypassAuth:Nge,initialized:kN,connectIssue:bN,permission:Fge,thinking:Rge,planMode:$N,swarmMode:Oge,goalMode:Pge,queued:Bge,warnings:Hge,questions:zge,activity:U5,turnActive:s0,activeTurnError:pge,activeTurnRetry:hge,inFlight:W5,working:yge,isStartingFirstPrompt:fge,models:Rn.models,starredModelIds:Rn.starredModelIds,providers:Rn.providers,fontScale:$h.fontScale,setFontScale:$h.setFontScale,colorScheme:$h.colorScheme,setColorScheme:$h.setColorScheme,notifyEnabled:Da.notifyEnabled,notifySound:Da.notifySound,notifyPermission:Da.notifyPermission,setNotifyEnabled:Da.setNotifyEnabled,setNotifySound:Da.setNotifySound,onboarded:xN,setOnboarded:Nme,load:At.load,selectSession:At.selectSession,clearActiveSession:At.clearActiveSession,loadOlderMessages:At.loadOlderMessages,loadWorkspaces:At.loadWorkspaces,loadMoreSessions:At.loadMoreSessions,loadAllSessions:At.loadAllSessions,ensureFlatSessions:At.ensureFlatSessions,loadMoreFlatSessions:c2e,selectWorkspace:At.selectWorkspace,openWorkspace:At.openWorkspace,openWorkspaceDraft:At.openWorkspaceDraft,startSessionAndSendPrompt:At.startSessionAndSendPrompt,startSessionAndActivateSkill:At.startSessionAndActivateSkill,startSessionAndOpenSideChat:At.startSessionAndOpenSideChat,addWorkspaceByPath:At.addWorkspaceByPath,browseFs:At.browseFs,getFsHome:At.getFsHome,sendPrompt:At.sendPrompt,steerPrompt:At.steerPrompt,sideChatVisible:si.sideChatVisible,sideChatSessionId:si.sideChatSessionId,sideChatTurns:si.sideChatTurns,sideChatRunning:si.sideChatRunning,sideChatSending:si.sideChatSending,openSideChat:si.openSideChat,closeSideChat:si.closeSideChat,sendSideChatPrompt:si.sendSideChatPrompt,uploadImage:At.uploadImage,abortCurrentPrompt:At.abortCurrentPrompt,respondApproval:At.respondApproval,respondQuestion:At.respondQuestion,dismissQuestion:At.dismissQuestion,pendingQuestionActions:At.pendingQuestionActions,pendingApprovalActions:At.pendingApprovalActions,cancelTask:At.cancelTask,setPermission:At.setPermission,setThinking:Rn.setThinking,setPlanMode:At.setPlanMode,togglePlanMode:At.togglePlanMode,setSwarmMode:At.setSwarmMode,toggleSwarmMode:At.toggleSwarmMode,setGoalMode:At.setGoalMode,toggleGoalMode:At.toggleGoalMode,createGoal:At.createGoal,controlGoal:At.controlGoal,enqueue:At.enqueue,dismissWarning:At.dismissWarning,renameSession:At.renameSession,renameWorkspace:At.renameWorkspace,deleteWorkspace:At.deleteWorkspace,reorderWorkspaces:p2e,pinSession:FN,unpinSession:V5,togglePinSession:o2e,reorderPinnedSessions:s2e,pinSessionAt:i2e,archiveSession:At.archiveSession,exportSession:At.exportSession,restoreSession:At.restoreSession,loadArchivedSessions:At.loadArchivedSessions,compact:At.compact,forkSession:At.forkSession,undo:At.undo,unqueue:At.unqueue,reorderQueue:At.reorderQueue,searchFiles:At.searchFiles,loadGitStatus:At.loadGitStatus,loadFileDiff:At.loadFileDiff,clearFileDiff:At.clearFileDiff,listDir:At.listDir,readFileContent:At.readFileContent,readHostFileContent:At.readHostFileContent,getFileDownloadUrl:At.getFileDownloadUrl,openWorkspaceFile:At.openWorkspaceFile,openInApp:At.openInApp,revealWorkspaceFile:At.revealWorkspaceFile,resolveImageUrl:At.resolveImageUrl,loadModels:Rn.loadModels,loadProviders:Rn.loadProviders,skills:dge,activateSkill:Rn.activateSkill,setModel:Rn.setModel,toggleStarModel:Rn.toggleStarModel,addProvider:Rn.addProvider,updateProvider:Rn.updateProvider,getProvider:Rn.getProvider,deleteProvider:Rn.deleteProvider,refreshProvider:Rn.refreshProvider,refreshAllProviders:Rn.refreshAllProviders,loadCatalogProviders:Rn.loadCatalogProviders,importCatalogProvider:Rn.importCatalogProvider,importCustomRegistry:Rn.importCustomRegistry,authReady:Zge,defaultModel:Gge,managedProviderStatus:Yge,managedUserInfo:Xge,managedMembership:Jge,notify:O2,config:Qge,loadConfig:At.loadConfig,updateConfig:At.updateConfig,checkAuth:At.checkAuth,probeManagedMembership:At.probeManagedMembership,startOAuthLogin:Rn.startOAuthLogin,pollOAuthLogin:Rn.pollOAuthLogin,cancelOAuthLogin:Rn.cancelOAuthLogin,getUsage:Rn.getUsage,logout:At.logout}}const C2e=["aria-expanded"],w2e={class:"user-menu-avatar","aria-hidden":"true"},_2e=["src"],x2e={class:"user-menu-name"},S2e={class:"user-menu-name"},A2e={class:"user-menu-item-label"},M2e={class:"user-menu-item-label"},T2e={class:"user-menu-item-label user-menu-login-label"},E2e={class:"user-menu-item-label"},I2e={class:"user-menu-row-value"},L2e={class:"user-menu-item-label"},$2e={class:"user-menu-row-value"},N2e={class:"user-menu-item-label"},F2e={key:0,class:"user-menu-usage"},R2e={key:0,class:"user-menu-usage-state"},O2e={key:1,class:"user-menu-usage-state"},P2e={class:"user-menu-usage-error"},D2e={key:2,class:"user-menu-usage-state user-menu-usage-empty"},B2e={class:"user-menu-usage-main"},H2e={class:"user-menu-usage-label"},z2e={key:0,class:"user-menu-usage-hint"},W2e={class:"user-menu-item-label"},U2e={class:"user-menu-item-label"},j2e=et({__name:"UserMenu",emits:["login","openSettings"],setup(e,{emit:t}){const n=t,{t:o,locale:s}=Nt(),i=mu(),{confirm:r}=hu(),l=R(()=>i.managedProviderStatus.value==="authenticated"),a=i.managedUserInfo,u=i.managedMembership,c=R(()=>a.value?.nickname||o("sidebar.defaultUserName")),d=R(()=>u.value==="free"||OJ(a.value?.userLevel)),f=R(()=>u.value!=="free"),h=Z(!1);Je(()=>a.value?.avatar,()=>{h.value=!1});const m=R(()=>!!a.value?.avatar&&!h.value),v=i.colorScheme,k=R(()=>o(`theme.${v.value}`)),w=R(()=>v.value==="light"?"light-mode":v.value==="dark"?"dark-mode":"follow-system"),b=[{value:"light",labelKey:"theme.light",icon:"light-mode"},{value:"dark",labelKey:"theme.dark",icon:"dark-mode"},{value:"system",labelKey:"theme.system",icon:"follow-system"}];function _(te){i.setColorScheme(te)}const g=R(()=>yg.find(te=>te.code===s.value)?.label??s.value);function x(te){s.value!==te&&E5(te)}const S=Z(!1),T=Z({}),A=Z(null),E=Z(null);let P=null;function D(te){const ce=te.target;ce.closest(".user-menu")||ce.closest(".user-menu-trigger")||ce.closest(".user-submenu")||O()}function I(te){te.key==="Escape"&&(te.stopPropagation(),O())}async function $(){if(S.value){O();return}S.value=!0,document.addEventListener("mousedown",D),document.addEventListener("keydown",I,!0),window.addEventListener("resize",O),l.value&&oe(),await yt(),B();const te=E.value;te&&(P=new ResizeObserver(H),P.observe(te))}function B(){const te=E.value,ce=A.value?.el;if(!te||!ce)return;const ue=te.getBoundingClientRect(),Se=4,ze=8,_e=ce.offsetHeight,Ee={left:`${Math.round(ue.left)}px`,width:`${Math.round(ue.width)}px`};ue.top-_e-Se{W[te]=ce instanceof HTMLElement?ce:ce?.$el??null}}function ie(te){le(),F.value!==te&&(F.value=te,yt(Ie))}function ne(te,ce){te.key!=="Enter"&&te.key!==" "&&te.key!=="ArrowRight"||(te.preventDefault(),ie(ce))}function X(){le(),K=setTimeout(()=>{F.value=null,K=null},250)}function le(){K!==null&&(clearTimeout(K),K=null)}function Ie(){const te=F.value,ce=A.value?.el,ue=z.value?.el,Se=te!==null?W[te]:null;if(!ce||!ue||!Se)return;const ze=4,_e=8,Ee=ce.getBoundingClientRect(),it=Se.getBoundingClientRect(),Fe=ue.offsetHeight,Oe=Math.min(ue.offsetWidth,Ee.width);let Ge=Ee.right+ze,at=!1;Ge+Oe>window.innerWidth-_e&&(Ge=Math.max(_e,Ee.left-Oe-ze),at=!0);const Tt=Math.max(_e,Math.min(it.top,window.innerHeight-Fe-_e));U.value={top:`${Math.round(Tt)}px`,left:`${Math.round(Ge)}px`,maxWidth:`${Math.round(Ee.width)}px`,transformOrigin:at?"top right":"top left","--menu-pop-shift":"-2px"}}const de=Z(!1),pe=Z(null);let ve=0;async function oe(){const te=++ve;de.value=!0;try{const ce=await i.getUsage();te===ve&&(pe.value=ce)}finally{te===ve&&(de.value=!1)}}const ye=R(()=>{if(pe.value?.kind!=="ok")return[];const{summary:te,limits:ce}=pe.value,ue=FJ(ce,5,"hour");return[te,ue].filter(Se=>Se!=null)}),G=R(()=>pe.value?.kind==="error"?pe.value.message:o("settings.planUsage.loadFailed"));function Y(te){return te.resetAt===void 0?"":fE(te.resetAt,o)}function fe(){O(),jp()}function we(){O(),n("login")}function ge(){O(),n("openSettings")}async function Q(){O(),await r({title:o("sidebar.logoutConfirmTitle"),message:o("sidebar.logoutConfirmMessage"),variant:"danger",action:()=>i.logout()})}return(te,ce)=>(y(),M(Pe,null,[C("button",{ref_key:"triggerRef",ref:E,class:"user-menu-trigger",type:"button","aria-haspopup":"menu","aria-expanded":S.value,onClick:It($,["stop"])},[l.value?(y(),M(Pe,{key:0},[C("span",w2e,[m.value?(y(),M("img",{key:0,src:p(a)?.avatar,alt:"",onError:ce[0]||(ce[0]=ue=>h.value=!0)},null,40,_2e)):(y(),he(p(Te),{key:1,name:"user",size:"sm"}))]),C("span",x2e,N(c.value),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"user"}),C("span",S2e,N(p(o)("sidebar.notSignedIn")),1)],64))],8,C2e),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[S.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:A,class:"user-menu",style:Zt(T.value),onClick:ce[14]||(ce[14]=It(()=>{},["stop"]))},{default:me(()=>[l.value?(y(),M(Pe,{key:0},[f.value?(y(),he(p(hn),{key:0,ref:V("usage"),"aria-haspopup":"true","aria-expanded":F.value==="usage",onMouseenter:ce[1]||(ce[1]=ue=>ie("usage")),onMouseleave:X,onFocus:ce[2]||(ce[2]=ue=>ie("usage")),onBlur:X,onClick:ce[3]||(ce[3]=ue=>ie("usage")),onKeydown:ce[4]||(ce[4]=ue=>ne(ue,"usage"))},{default:me(()=>[j(p(Te),{name:"histogram",size:"sm"}),C("span",A2e,N(p(o)("settings.planUsage.title")),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"])):ee("",!0),d.value?(y(),he(p(hn),{key:1,onClick:fe,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"music",size:"sm"}),C("span",M2e,N(p(o)("sidebar.upgrade")),1),j(p(Te),{name:"external-link",size:"sm"})]),_:1})):ee("",!0),j(p(hn),{separator:""})],64)):(y(),M(Pe,{key:1},[j(p(hn),{class:"user-menu-login",onClick:we,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-in",size:"sm"}),C("span",T2e,N(p(o)("sidebar.signIn")),1)]),_:1}),j(p(hn),{separator:""})],64)),j(p(hn),{ref:V("theme"),"aria-haspopup":"true","aria-expanded":F.value==="theme",onMouseenter:ce[5]||(ce[5]=ue=>ie("theme")),onMouseleave:X,onFocus:ce[6]||(ce[6]=ue=>ie("theme")),onBlur:X,onClick:ce[7]||(ce[7]=ue=>ie("theme")),onKeydown:ce[8]||(ce[8]=ue=>ne(ue,"theme"))},{default:me(()=>[j(p(Te),{name:w.value,size:"sm"},null,8,["name"]),C("span",E2e,N(p(o)("theme.colorSchemeLabel")),1),C("span",I2e,N(k.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{ref:V("language"),"aria-haspopup":"true","aria-expanded":F.value==="language",onMouseenter:ce[9]||(ce[9]=ue=>ie("language")),onMouseleave:X,onFocus:ce[10]||(ce[10]=ue=>ie("language")),onBlur:X,onClick:ce[11]||(ce[11]=ue=>ie("language")),onKeydown:ce[12]||(ce[12]=ue=>ne(ue,"language"))},{default:me(()=>[j(p(Te),{name:"translate",size:"sm"}),C("span",L2e,N(p(o)("sidebar.language")),1),C("span",$2e,N(g.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{onClick:ge,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"settings",size:"sm"}),C("span",N2e,N(p(o)("settings.title")),1)]),_:1}),l.value?(y(),M(Pe,{key:2},[j(p(hn),{separator:""}),j(p(hn),{onClick:ce[13]||(ce[13]=ue=>void Q()),onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-out",size:"sm"}),qe(" "+N(p(o)("sidebar.signOut")),1)]),_:1})],64)):ee("",!0)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[F.value!==null?(y(),he(p(Cl),{key:0,ref_key:"submenuRef",ref:z,class:"user-submenu",style:Zt(U.value),role:F.value==="usage"?"dialog":"menu",onClick:ce[16]||(ce[16]=It(()=>{},["stop"])),onMouseenter:le,onMouseleave:X,onFocusin:le,onFocusout:X},{default:me(()=>[F.value==="usage"?(y(),M("div",F2e,[de.value?(y(),M("div",R2e,[j(p(Ao),{size:"sm"})])):pe.value?.kind!=="ok"?(y(),M("div",O2e,[C("span",P2e,N(G.value),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:ce[15]||(ce[15]=ue=>void oe())},{default:me(()=>[qe(N(p(o)("settings.planUsage.retry")),1)]),_:1})])):ye.value.length===0?(y(),M("span",D2e,N(p(o)("settings.planUsage.empty")),1)):(y(!0),M(Pe,{key:3},pt(ye.value,(ue,Se)=>(y(),M("div",{key:Se,class:"user-menu-usage-row"},[C("span",B2e,[C("span",H2e,N(p(dE)(ue,p(o))),1),Y(ue)?(y(),M("span",z2e,N(Y(ue)),1)):ee("",!0)]),C("span",{class:Re(["user-menu-usage-value",`sev-${p(C3)(ue.used,ue.limit)}`])},N(p(Wh)(ue.used,ue.limit))+"% ",3)]))),128))])):F.value==="theme"?(y(),M(Pe,{key:1},pt(b,ue=>j(p(hn),{key:ue.value,onClick:Se=>_(ue.value)},{default:me(()=>[j(p(Te),{name:ue.icon,size:"sm"},null,8,["name"]),C("span",W2e,N(p(o)(ue.labelKey)),1),p(v)===ue.value?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"])),64)):(y(!0),M(Pe,{key:2},pt(p(yg),ue=>(y(),he(p(hn),{key:ue.code,onClick:Se=>x(ue.code)},{default:me(()=>[C("span",U2e,N(ue.label),1),p(s)===ue.code?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"]))),128))]),_:1},8,["style","role"])):ee("",!0)]),_:1})]))],64))}}),V2e=ft(j2e,[["__scopeId","data-v-06f13413"]]),q2e={class:"ep-search"},K2e=["placeholder"],Z2e={class:"ep-scroll"},G2e={key:0,class:"ep-grid"},Y2e=["onClick"],X2e={key:1,class:"ep-empty"},J2e={class:"ep-label"},Q2e={class:"ep-grid"},eve=["onClick"],tve={class:"ep-label"},nve={class:"ep-grid"},ove=["onClick"],Kx="kimi-web.recent-emojis",sve=et({__name:"SessionEmojiPicker",props:{current:{default:null},removable:{type:Boolean,default:!0}},emits:["pick"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),{handleCompositionStart:s,handleCompositionEnd:i,isComposingKeyEvent:r}=Ar(),l=e,a=n,u=["⏳","⚠️","🐛","✨","🔥","🚀","🎯","🧪","📝","🔍","🛠️","💡","📦","🎨","🔒","📈","🧹","🚧","✅","❓","🌙","☕","🐳","🗂️","📊","🤖","🧩","⚙️","🌱","📌","💥","🕐"],c={faces:"sidebar.emojiGroupFaces",nature:"sidebar.emojiGroupNature",food:"sidebar.emojiGroupFood",activity:"sidebar.emojiGroupActivity",objects:"sidebar.emojiGroupObjects",symbols:"sidebar.emojiGroupSymbols"},d=sJ.map(S=>({id:S,labelKey:c[S],emojis:sE.filter(T=>T.group===S).map(T=>T.emoji)})),f=Z(h());function h(){try{const S=JSON.parse(localStorage.getItem(Kx)??"[]");return Array.isArray(S)?S.filter(T=>typeof T=="string"):[]}catch{return[]}}function m(S){f.value=aJ(f.value,S);try{localStorage.setItem(Kx,JSON.stringify(f.value))}catch{}a("pick",S)}const v=Z(""),k=R(()=>v.value.trim().length>0),w=R(()=>rJ(v.value)),b=Z(null);dn(()=>b.value?.focus());function _(S){if(r(S))return;const T=w.value[0];k.value&&T&&m(T)}function g(){let S=l.current??void 0;for(;S===void 0||S===l.current;)S=u[Math.floor(Math.random()*u.length)];m(S)}const x=Z(null);return t({el:R(()=>x.value?.el),isComposingKeyEvent:r}),(S,T)=>(y(),he(p(Cl),{ref_key:"menuRef",ref:x,class:"emoji-picker",role:"dialog","aria-label":p(o)("sidebar.sessionEmojiTitle"),onKeydown:T[4]||(T[4]=It(()=>{},["stop"]))},{default:me(()=>[C("div",q2e,[j(p(Te),{name:"search",size:"sm"}),Bn(C("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":T[0]||(T[0]=A=>v.value=A),class:"ep-input",type:"text",placeholder:p(o)("sidebar.searchEmoji"),autocomplete:"off",spellcheck:"false",onKeydown:xl(_,["enter"]),onCompositionstart:T[1]||(T[1]=(...A)=>p(s)&&p(s)(...A)),onCompositionend:T[2]||(T[2]=(...A)=>p(i)&&p(i)(...A))},null,40,K2e),[[ai,v.value]])]),C("div",Z2e,[k.value?(y(),M(Pe,{key:0},[w.value.length?(y(),M("div",G2e,[(y(!0),M(Pe,null,pt(w.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,Y2e))),128))])):(y(),M("div",X2e,N(p(o)("sidebar.noEmojiResults")),1))],64)):(y(),M(Pe,{key:1},[f.value.length?(y(),M(Pe,{key:0},[C("div",J2e,N(p(o)("sidebar.recentEmojis")),1),C("div",Q2e,[(y(!0),M(Pe,null,pt(f.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,eve))),128))])],64)):ee("",!0),(y(!0),M(Pe,null,pt(p(d),A=>(y(),M(Pe,{key:A.id},[C("div",tve,N(p(o)(A.labelKey)),1),C("div",nve,[(y(!0),M(Pe,null,pt(A.emojis,E=>(y(),M("button",{key:E,class:Re(["ep-e",{sel:E===e.current}]),type:"button",onClick:P=>m(E)},N(E),11,ove))),128))])],64))),128))],64))]),j(p(hn),{separator:""}),j(p(hn),{role:"button",disabled:!(e.current&&e.removable),onClick:T[3]||(T[3]=A=>a("pick",null))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(o)("sidebar.removeEmoji")),1)]),_:1},8,["disabled"]),j(p(hn),{role:"button",onClick:g},{default:me(()=>[j(p(Te),{name:"sparkles",size:"sm"}),qe(" "+N(p(o)("sidebar.randomEmoji")),1)]),_:1})]),_:1},8,["aria-label"]))}}),ive=ft(sve,[["__scopeId","data-v-05e46bbb"]]),rve={class:"row"},lve={key:0,class:"lead","aria-hidden":"true"},ave={key:1,class:"unread-dot"},uve={class:"left"},cve=["onKeydown"],dve=["aria-label"],fve={class:"act"},pve={key:0,class:"ts"},hve={key:1,class:"st"},mve={key:1,class:"unread-dot"},gve={key:2,class:"ha"},vve={key:0,class:"sub"},yve={class:"sub-text"},kve=["aria-label"],bve={class:"menu-time"},Cve=et({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","renameStateChange","archive","fork","export","pin"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n;function r(ue){const Se=new Date(ue);if(Number.isNaN(Se.getTime()))return ue;const ze=_e=>String(_e).padStart(2,"0");return`${Se.getFullYear()}-${ze(Se.getMonth()+1)}-${ze(Se.getDate())} ${ze(Se.getHours())}:${ze(Se.getMinutes())}`}const l=R(()=>s.session.updatedAt?r(s.session.updatedAt):s.session.time),a=R(()=>s.session.cwdLabel!==void 0),u=R(()=>kE({busy:s.session.busy,unread:s.unread,renaming:W.value,questionCount:s.questionCount,approvalCount:s.approvalCount,pendingInteraction:s.session.pendingInteraction,lastTurnReason:s.session.lastTurnReason})),c=R(()=>u.value.showQuestionBadge),d=R(()=>u.value.showApprovalBadge),f=R(()=>u.value.showAbortedBadge),h=R(()=>u.value.showBusySpinner),m=R(()=>u.value.hasStatus),v=Z(!1),k=Z(null),w=Z({});function b(ue){const Se=ue.target;k.value?.el?.contains(Se)||g()}async function _(){$(),v.value=!0,setTimeout(()=>document.addEventListener("mousedown",b),0),window.addEventListener("resize",g),await yt()}function g(){v.value=!1,document.removeEventListener("mousedown",b),window.removeEventListener("resize",g)}bn(()=>{document.removeEventListener("mousedown",b),document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",g),window.removeEventListener("resize",$)});const x=R(()=>yE(s.session.title)),S=R(()=>{const ue=x.value.emoji;return ue?s.session.title.slice(ue.length):s.session.title}),T=Z(!1),A=Z(null),E=Z({});let P=null;function D(ue,Se,ze){const _e=A.value?.el,Ee=4,it=8,Fe=_e?.offsetHeight??0,Oe=_e?.offsetWidth??0;let Ge=ue.bottom+Ee,at=!1;Ge+Fe>window.innerHeight-it&&(Ge=Math.max(it,ue.top-Fe-Ee),at=!0);const Tt=ze??(Se==="left"?ue.left:ue.right-Oe),Bt=Math.max(it,Math.min(Tt,window.innerWidth-Oe-it)),Yt=ze===void 0?Se:`${Math.round(Math.min(Math.max(ze-Bt,0),Oe))}px`;E.value={top:`${Math.round(Ge)}px`,left:`${Math.round(Bt)}px`,transformOrigin:`${Yt} ${at?"bottom":"top"}`,"--menu-pop-shift":at?"2px":"-2px"}}async function I(ue,Se,ze="left",_e){const Ee=Se??ue?.getBoundingClientRect();if(Ee){if(T.value){$();return}g(),P=ue??null,T.value=!0,setTimeout(()=>document.addEventListener("mousedown",B),0),window.addEventListener("keydown",H,!0),window.addEventListener("resize",$),await yt(),D(Ee,ze,_e)}}function $(){T.value=!1,P=null,document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",$)}function B(ue){const Se=ue.target;A.value?.el?.contains(Se)||P?.contains(Se)||$()}function H(ue){ue.key==="Escape"&&(A.value?.isComposingKeyEvent(ue)||(ue.preventDefault(),ue.stopPropagation(),$()))}function O(ue){return ue.clientX||ue.clientY?new DOMRect(ue.clientX,ue.clientY,0,0):void 0}function F(ue){ue.stopPropagation();const Se=ue;I(Se.currentTarget,O(Se),"left",Se.clientX||void 0)}function U(ue){const Se=k.value?.el,ze=ue,_e=O(ze)??Se?.getBoundingClientRect();g(),I(Se,_e,"left",ze.clientX||void 0)}function z(ue){if($(),ue===x.value.emoji)return;const Se=dQ(s.session.title,ue);Se&&Se!==s.session.title&&i("rename",s.session.id,Se)}const W=Z(!1),K=Z(""),V=Z(null),{handleCompositionStart:ie,handleCompositionEnd:ne,isComposingKeyEvent:X}=Ar();async function le(){g(),$(),W.value=!0,K.value=s.session.title,await yt();try{V.value?.focus(),V.value?.select()}catch{}}function Ie(){const ue=K.value.trim();ue&&ue!==s.session.title&&i("rename",s.session.id,ue),W.value=!1}function de(ue){X(ue)||Ie()}function pe(ue){X(ue)||ve()}function ve(){W.value=!1}Je(W,ue=>i("renameStateChange",ue));async function oe(ue){W.value||(ue.preventDefault(),ue.stopPropagation(),v.value&&g(),await _(),ye(ue))}function ye(ue){const Se=k.value?.el,ze=8,_e=Se?.offsetHeight??0,Ee=Se?.offsetWidth??0;let it=ue.clientY,Fe=!1;it+_e>window.innerHeight-ze&&(it=Math.max(ze,ue.clientY-_e),Fe=!0);let Oe=ue.clientX,Ge=!1;Oe+Ee>window.innerWidth-ze&&(Oe=Math.max(ze,ue.clientX-Ee),Ge=!0),w.value={top:`${Math.round(it)}px`,left:`${Math.round(Oe)}px`,transformOrigin:`${Fe?"bottom":"top"} ${Ge?"right":"left"}`,"--menu-pop-shift":Fe?"2px":"-2px"}}const G=Z(!1),Y=Z(!1);async function fe(){const ue=await Zs(s.session.id);G.value=ue,Y.value=!ue,setTimeout(()=>{G.value=!1,Y.value=!1,g()},1500)}function we(){g(),i("fork",s.session.id)}function ge(){g(),i("export",s.session.id)}function Q(){g(),i("pin",s.session.id)}function te(){g(),i("archive",s.session.id)}t({closeMenu:g});function ce(){const ue=s.session.pullRequest?.url;ue&&window.open(ue,"_blank","noopener")}return(ue,Se)=>(y(),M("div",{class:Re(["se",{on:e.active,flat:a.value}]),onClick:Se[7]||(Se[7]=ze=>i("select",e.session.id)),onContextmenu:oe},[C("div",rve,[a.value?ee("",!0):(y(),M("span",lve,[e.session.busy?(y(),he(p(Ao),{key:0,size:"sm"})):e.unread?(y(),M("span",ave)):ee("",!0)])),C("div",uve,[W.value?Bn((y(),M("input",{key:0,ref_key:"renameInputRef",ref:V,"onUpdate:modelValue":Se[0]||(Se[0]=ze=>K.value=ze),class:"rename-input",onClick:Se[1]||(Se[1]=It(()=>{},["stop"])),onKeydown:[xl(It(de,["stop"]),["enter"]),xl(It(pe,["stop"]),["esc"])],onCompositionstart:Se[2]||(Se[2]=(...ze)=>p(ie)&&p(ie)(...ze)),onCompositionend:Se[3]||(Se[3]=(...ze)=>p(ne)&&p(ne)(...ze)),onBlur:Ie},null,40,cve)),[[ai,K.value]]):(y(),M("span",{key:1,class:"t",onDblclick:It(le,["stop"])},[x.value.emoji?(y(),M("button",{key:0,type:"button",class:"emoji","aria-label":p(o)("sidebar.setEmoji"),onClick:It(F,["stop"]),onDblclick:Se[4]||(Se[4]=It(()=>{},["stop"]))},N(x.value.emoji),41,dve)):ee("",!0),qe(N(S.value),1)],32))]),C("span",fve,[j(p(pn),{text:p(o)("workspace.awaitingAnswerTitle")},{default:me(()=>[c.value?(y(),he(p(Vr),{key:0,variant:"info",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingAnswer")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.awaitingPermissionTitle")},{default:me(()=>[d.value?(y(),he(p(Vr),{key:0,variant:"warning",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingPermission")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.abortedTitle")},{default:me(()=>[f.value?(y(),he(p(Vr),{key:0,variant:"danger",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.aborted")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),!a.value||!m.value?(y(),M("span",pve,N(e.session.time),1)):h.value||e.unread?(y(),M("span",hve,[h.value?(y(),he(p(Ao),{key:0,size:"sm"})):(y(),M("span",mve))])):ee("",!0),W.value?ee("",!0):(y(),M("span",gve,[j(p(pn),{text:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")},{default:me(()=>[j(p(gn),{class:"pin-btn",size:"sm",label:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin"),onClick:It(Q,["stop"])},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin"},null,8,["name"])]),_:1},8,["label"])]),_:1},8,["text"]),j(p(pn),{text:p(o)("sidebar.archive")},{default:me(()=>[j(p(gn),{class:"archive-btn",size:"sm",label:p(o)("sidebar.archive"),onClick:It(te,["stop"])},{default:me(()=>[j(p(Te),{name:"archive"})]),_:1},8,["label"])]),_:1},8,["text"])]))])]),e.session.cwdLabel!==void 0?(y(),M("div",vve,[j(p(Te),{class:"sub-icon",name:"folder-closed",size:"sm"}),C("span",yve,N(e.session.cwdLabel),1),e.session.pullRequest?(y(),M("button",{key:0,type:"button",class:Re(["pr",`pr--${e.session.pullRequest.state}`]),"aria-label":`PR #${e.session.pullRequest.number}`,onClick:It(ce,["stop"])},[j(p(Te),{name:"git-pull-request",size:"sm"}),C("span",null,"#"+N(e.session.pullRequest.number),1)],10,kve)):ee("",!0)])):ee("",!0),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[v.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:k,class:"menu",style:Zt(w.value),onClick:Se[5]||(Se[5]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{danger:Y.value,onClick:fe},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(Y.value?p(o)("sidebar.copyFailed"):G.value?p(o)("sidebar.copied"):p(o)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),j(p(hn),{separator:""}),j(p(hn),{onClick:le},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(o)("sidebar.rename")),1)]),_:1}),j(p(hn),{onClick:U},{default:me(()=>[j(p(Te),{name:"emoji",size:"sm"}),qe(" "+N(p(o)("sidebar.setEmoji")),1)]),_:1}),j(p(hn),{onClick:we},{default:me(()=>[j(p(Te),{name:"git-fork",size:"sm"}),qe(" "+N(p(o)("sidebar.fork")),1)]),_:1}),j(p(hn),{onClick:ge},{default:me(()=>[j(p(Te),{name:"download",size:"sm"}),qe(" "+N(p(o)("sidebar.export")),1)]),_:1}),j(p(hn),{onClick:Q},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin",size:"sm"},null,8,["name"]),qe(" "+N(e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")),1)]),_:1}),j(p(hn),{onClick:te},{default:me(()=>[j(p(Te),{name:"archive",size:"sm"}),qe(" "+N(p(o)("sidebar.archive")),1)]),_:1}),j(p(hn),{separator:""}),C("div",bve,N(l.value),1)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[T.value?(y(),he(ive,{key:0,ref_key:"pickerRef",ref:A,class:"picker",style:Zt(E.value),current:x.value.emoji,removable:x.value.rest.length>0,onClick:Se[6]||(Se[6]=It(()=>{},["stop"])),onPick:z},null,8,["style","current","removable"])):ee("",!0)]),_:1})]))],34))}}),Z5=ft(Cve,[["__scopeId","data-v-341acfa2"]]),wve=["draggable"],_ve={class:"gh-top"},xve={class:"gh-name"},Sve=["inert"],Ave={key:0,class:"show-more-row"},Mve=["disabled"],Tve={class:"show-more-label"},Eve={key:1,class:"show-more-sep","aria-hidden":"true"},Ive={class:"show-more-label"},Lve={key:1,class:"group-empty"},$ve=et({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},isCollapsed:{type:Function},visibleLimit:{type:Function},pinnedDragSession:{}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","dropPinnedSession","expand","collapse","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R({get:()=>o.renameValue,set:P=>s("updateRenameValue",P)}),r=Z(!1),l=R(()=>o.pinnedDragSession!=null),a=R(()=>o.pinnedDragSession?.workspaceId===o.group.workspace.id);function u(P){if(o.pinnedDragSession!=null){if(!a.value){P.dataTransfer&&(P.dataTransfer.dropEffect="none");return}P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),r.value=!0}}function c(P){o.pinnedDragSession==null||!a.value||(P.preventDefault(),r.value=!1,s("dropPinnedSession",o.pinnedDragSession.id))}function d(P){P.currentTarget.contains(P.relatedTarget)||(r.value=!1)}const f=R(()=>o.visibleLimit(o.group.workspace.id)??o.group.initialCount),h=R(()=>{const P=o.group.sessions.slice(0,f.value);if(o.activeId&&!P.some(D=>D.id===o.activeId)){const D=o.group.sessions.find(I=>I.id===o.activeId);if(D)return[...P,D]}return P}),m=R(()=>o.group.sessions.length>f.value||o.group.hasMore||o.group.loadingMore),v=R(()=>f.value>o.group.initialCount);function k(P){o.renameInputRef.value=P instanceof HTMLInputElement?P:null}const{handleCompositionStart:w,handleCompositionEnd:b,isComposingKeyEvent:_}=Ar();function g(P){_(P)||s("confirmRename")}function x(P){_(P)||s("cancelRename")}const S=Z(null);function T(P){o.renamingId!==o.group.workspace.id&&s("groupContextmenu",o.group.workspace,P)}function A(P){P.dataTransfer&&(P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",o.group.workspace.id),s("wsDragstart",o.group.workspace.id))}function E(P,D){D.dataTransfer&&(D.dataTransfer.effectAllowed="move",D.dataTransfer.setData(Bf,P),D.dataTransfer.setData("text/plain",P))}return(P,D)=>(y(),M("div",{class:Re(["group",{dragging:e.dragging,"pinned-drag-active":l.value&&a.value,"pinned-drop-hover":r.value,"pinned-drop-blocked":l.value&&!a.value}]),onDragover:u,onDrop:c,onDragleave:d},[C("div",{class:Re(["gh",{on:e.group.workspace.id===e.activeWorkspaceId&&e.activeId==="",collapsed:e.isCollapsed(e.group.workspace.id)}]),draggable:e.renamingId!==e.group.workspace.id,onClick:D[7]||(D[7]=It(I=>s("groupClick",e.group.workspace.id,I),["stop"])),onContextmenu:T,onDragstart:A,onDragend:D[8]||(D[8]=I=>s("wsDragend"))},[C("div",_ve,[e.isCollapsed(e.group.workspace.id)?(y(),he(p(Te),{key:0,class:"gh-folder",name:"folder-closed"})):(y(),he(p(Te),{key:1,class:"gh-folder",name:"folder"})),e.renamingId!==e.group.workspace.id?(y(),he(p(pn),{key:2,text:e.group.workspace.root},{default:me(()=>[C("span",xve,N(e.group.workspace.name),1)]),_:1},8,["text"])):Bn((y(),M("input",{key:3,ref:k,"onUpdate:modelValue":D[0]||(D[0]=I=>i.value=I),class:"gh-rename",type:"text",onKeydown:[xl(g,["enter"]),xl(x,["esc"])],onCompositionstart:D[1]||(D[1]=(...I)=>p(w)&&p(w)(...I)),onCompositionend:D[2]||(D[2]=(...I)=>p(b)&&p(b)(...I)),onBlur:D[3]||(D[3]=I=>s("cancelRename")),onClick:D[4]||(D[4]=It(()=>{},["stop"]))},null,544)),[[ai,i.value]]),e.renamingId!==e.group.workspace.id?(y(),M("div",{key:4,class:Re(["gh-actions",{open:e.wsMenuOpenId===e.group.workspace.id}])},[j(p(gn),{class:Re(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:p(n)("sidebar.options"),tooltip:p(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:D[5]||(D[5]=It(I=>s("toggleWsMenu",e.group.workspace,I),["stop"]))},{default:me(()=>[j(p(Te),{name:"dots-horizontal"})]),_:1},8,["class","label","tooltip","aria-expanded"]),j(p(gn),{class:"gh-add",size:"sm",label:p(n)("workspace.newInGroup"),tooltip:p(n)("workspace.newInGroup"),onClick:D[6]||(D[6]=It(I=>s("createInWorkspace",e.group.workspace.id),["stop"]))},{default:me(()=>[j(p(Te),{name:"chat-new"})]),_:1},8,["label","tooltip"])],2)):ee("",!0)])],42,wve),C("div",{class:Re(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(y(!0),M(Pe,null,pt(h.value,I=>(y(),he(Z5,{key:I.id,session:I,active:I.id===e.activeId,"approval-count":e.pendingBySession[I.id]?.approvals??0,"question-count":e.pendingBySession[I.id]?.questions??0,unread:e.unreadBySession[I.id]??!1,draggable:S.value!==I.id,onDragstart:$=>E(I.id,$),onRenameStateChange:$=>S.value=$?I.id:null,onSelect:D[9]||(D[9]=$=>s("selectSession",$)),onRename:D[10]||(D[10]=($,B)=>s("renameSession",$,B)),onArchive:D[11]||(D[11]=$=>s("archiveSession",$)),onFork:D[12]||(D[12]=$=>s("forkSession",$)),onExport:D[13]||(D[13]=$=>s("exportSession",$)),onPin:D[14]||(D[14]=$=>s("pinSession",$))},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),m.value||v.value?(y(),M("div",Ave,[m.value?(y(),M("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:D[15]||(D[15]=It(I=>s("expand",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-down",size:"sm"}),C("span",Tve,N(e.group.loadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.showMore")),1)],8,Mve)):ee("",!0),m.value&&v.value?(y(),M("span",Eve,"·")):ee("",!0),v.value?(y(),M("button",{key:2,class:"show-more",onClick:D[16]||(D[16]=It(I=>s("collapse",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-up",size:"sm"}),C("span",Ive,N(p(n)("sidebar.showLess")),1)])):ee("",!0)])):ee("",!0),e.group.sessions.length===0?(y(),M("div",Lve,N(e.group.pinnedCount>0?p(n)("sidebar.allPinned",{count:e.group.pinnedCount}):p(n)("sidebar.noSessions")),1)):ee("",!0)],10,Sve)],34))}}),Nve=ft($ve,[["__scopeId","data-v-9586bfbe"]]),Fve={class:"pinned-label"},Rve={class:"pinned-title"},Ove={key:0,class:"pinned-rows"},Pve=["draggable","onDragstart","onDragover","onDrop"],Dve=et({__name:"PinnedSessionList",props:{sessions:{},activeId:{},pendingBySession:{},unreadBySession:{}},emits:["selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","pinSessionAt","sessionDragStart","sessionDragEnd","reorder"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n,r=Z(kQ());function l(){r.value=!r.value,M3(r.value)}function a(){r.value&&(r.value=!1,M3(!1))}t({expand:a});const u=Z(null),c=Z(null),d=Z(null);function f(x,S){if(!S.dataTransfer)return;S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",x),u.value=x;const T=s.sessions.find(A=>A.id===x)?.workspaceId;T!==void 0&&i("sessionDragStart",x,T)}function h(){u.value=null,c.value=null,i("sessionDragEnd")}Je(()=>s.sessions,x=>{u.value!==null&&!x.some(S=>S.id===u.value)&&(u.value=null,c.value=null)});function m(x){const S=x.currentTarget.getBoundingClientRect();return x.clientYP.id),T,x,A));return}const E=S.dataTransfer?.getData(Bf);E&&i("pinSessionAt",E,x,A)}function b(x){if(u.value===null&&!v(x))return;x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="move");const S=s.sessions[s.sessions.length-1];S!==void 0&&(c.value={id:S.id,position:"after"})}function _(x){const S=s.sessions.map(E=>E.id),T=u.value;if(c.value=null,u.value=null,T!==null){const E=S[S.length-1];E!==void 0&&T!==E&&i("reorder",[...S.filter(P=>P!==T),T]);return}const A=x.dataTransfer?.getData(Bf);A&&i("pinSessionAt",A,S[S.length-1]??null,"after")}function g(x){x.currentTarget.contains(x.relatedTarget)||(c.value=null)}return(x,S)=>(y(),M("div",{class:"pinned",onDragover:b,onDrop:_,onDragleave:g},[C("div",Fve,[C("span",Rve,N(p(o)("sidebar.pinned")),1),j(p(gn),{class:Re(["pinned-toggle",{"pinned-toggle--on":r.value}]),size:"sm",label:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),tooltip:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),onClick:It(l,["stop"])},{default:me(()=>[r.value?(y(),he(p(Te),{key:0,name:"chevron-right"})):(y(),he(p(Te),{key:1,name:"chevron-down"}))]),_:1},8,["class","label","tooltip"])]),r.value?ee("",!0):(y(),M("div",Ove,[(y(!0),M(Pe,null,pt(e.sessions,T=>(y(),M("div",{key:T.id,class:Re(["pin-drop-target",{dragging:u.value===T.id,"drop-before":c.value?.id===T.id&&c.value.position==="before","drop-after":c.value?.id===T.id&&c.value.position==="after"}]),draggable:d.value!==T.id,onDragstart:A=>f(T.id,A),onDragend:h,onDragover:It(A=>k(A,T.id),["stop"]),onDrop:It(A=>w(T.id,A),["stop"])},[j(Z5,{session:T,active:T.id===e.activeId,"approval-count":e.pendingBySession[T.id]?.approvals??0,"question-count":e.pendingBySession[T.id]?.questions??0,unread:e.unreadBySession[T.id]??!1,onRenameStateChange:A=>d.value=A?T.id:null,onSelect:S[0]||(S[0]=A=>i("selectSession",A)),onRename:S[1]||(S[1]=(A,E)=>i("renameSession",A,E)),onArchive:S[2]||(S[2]=A=>i("archiveSession",A)),onFork:S[3]||(S[3]=A=>i("forkSession",A)),onExport:S[4]||(S[4]=A=>i("exportSession",A)),onPin:S[5]||(S[5]=A=>i("pinSession",A))},null,8,["session","active","approval-count","question-count","unread","onRenameStateChange"])],42,Pve))),128))]))],32))}}),Bve=ft(Dve,[["__scopeId","data-v-aec340eb"]]),Hve={class:"ch"},zve={class:"ch-brand"},Wve={class:"ch-tail"},Uve={class:"search-input"},jve={class:"side-section-label"},Vve={class:"side-section-title"},qve={class:"side-section-actions"},Kve={key:0,class:"empty"},Zve=["onDragover","onDrop"],Gve={key:0,class:"empty"},Yve={key:1,class:"show-more-row"},Xve=["disabled"],Jve={class:"show-more-label"},Qve={class:"folder-drop-card"},e9e={class:"view-menu-label"},t9e={class:"view-menu-check"},n9e={class:"view-menu-check"},o9e=!1,s9e=1e3,i9e=et({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},pinnedSessions:{default:()=>[]},flatSessions:{default:()=>[]},flatHasMore:{type:Boolean,default:!1},flatLoadingMore:{type:Boolean,default:!1},initialized:{type:Boolean,default:!1},activeId:{},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220},collapsed:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","addWorkspacePaths","rename","archive","fork","export","pin","reorderPinned","pinAt","unpin","renameWorkspace","deleteWorkspace","reorderWorkspaces","loadMoreSessions","loadAllSessions","ensureFlatSessions","loadMoreFlatSessions","openSettings","login","collapse"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!1),r=c()?["⌘","K"]:["Ctrl","K"],l=c()?["⌃","⇧","O"]:["Ctrl","Shift","O"];function a(){s("loadAllSessions"),i.value=!0}function u(Qe){(Qe.metaKey||Qe.ctrlKey)&&(Qe.key.toLowerCase()==="k"?(Qe.preventDefault(),a()):!Qe.metaKey&&Qe.ctrlKey&&Qe.shiftKey&&Qe.key.toLowerCase()==="o"&&(Qe.preventDefault(),s("create")))}dn(()=>window.addEventListener("keydown",u)),Vn(()=>window.removeEventListener("keydown",u));function c(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const Qe=navigator.userAgentData;return Qe?.platform==="macOS"||Qe?.platform==="iOS"}const d=Z(null),f=Z(!1),h=Z(!1),m=Z(!1);let v=null;function k(Qe=d.value){Qe&&(f.value=Qe.scrollTop>0,h.value=Qe.scrollTop+Qe.clientHeight{m.value=!1,v=null},900)}let b=null;dn(()=>{yt(()=>{k(),typeof ResizeObserver=="function"&&d.value&&(b=new ResizeObserver(()=>k()),b.observe(d.value))})}),Dp(()=>k()),Vn(()=>{b?.disconnect(),v&&clearTimeout(v)});const _=Z(new Set(yQ()));function g(Qe){return _.value.has(Qe)}function x(Qe){const st=new Set(_.value);st.has(Qe)?st.delete(Qe):st.add(Qe),_.value=st,p9(st)}function S(){const Qe=new Set(o.groups.map(st=>st.workspace.id));_.value=Qe,p9(Qe)}function T(){const Qe=new Set;_.value=Qe,p9(Qe)}const A=R(()=>o.groups.length>0&&o.groups.every(Qe=>_.value.has(Qe.workspace.id))),E=Z(new Map);function P(Qe){return E.value.get(Qe)}function D(Qe){const st=o.groups.find(kn=>kn.workspace.id===Qe);if(!st)return;const Ct=(E.value.get(Qe)??st.initialCount)+O5,Qt=new Map(E.value);Qt.set(Qe,Ct),E.value=Qt,st.sessions.lengthkn.workspace.id),st,Qe,Ct);s("reorderWorkspaces",Qt)}const W=Z(null);function K(Qe,st){W.value={id:Qe,workspaceId:st}}function V(){W.value=null}function ie(Qe){W.value=null,s("unpin",Qe)}const ne=Z(bQ());function X(Qe){ne.value!==Qe&&(ne.value=Qe,CQ(Qe),Qe==="flat"&&s("ensureFlatSessions"))}Je(()=>o.initialized,Qe=>{Qe&&ne.value==="flat"&&s("ensureFlatSessions")},{immediate:!0});const le=Z(!1),Ie=Z({}),de=Z(null);function pe(Qe){const st=Qe.target;st.closest(".view-menu")||st.closest(".side-section-view")||oe()}async function ve(Qe){if(le.value){oe();return}const st=Qe.currentTarget;le.value=!0,document.addEventListener("mousedown",pe),window.addEventListener("resize",oe),await yt();const Ct=de.value?.el,Qt=st.getBoundingClientRect(),kn=4,Ko=8,Eo=Ct?.offsetHeight??0,bo=Ct?.offsetWidth??0;let Ns=Qt.bottom+kn,Do=!1;Ns+Eo>window.innerHeight-Ko&&(Ns=Math.max(Ko,Qt.top-Eo-kn),Do=!0);let Io=Qt.right-bo;IoSn.value?.focus())}function Cn(){const Qe=Tt.value,st=Bt.value.trim();Qe&&st&&st!==Yt.value&&s("renameWorkspace",Qe,st),Tt.value=null}function Mn(){Tt.value=null}function We(Qe){Bt.value=Qe}const tt=Z(!1),Ue=Z(null),Lt=Z({}),gt=Z(null);function wn(Qe){gt.value?.el&&!gt.value.el.contains(Qe.target)&&go()}function yn(Qe,st){st.preventDefault(),st.stopPropagation(),Ue.value=Qe,Lt.value={top:`${st.clientY}px`,left:`${st.clientX}px`,transformOrigin:"top left","--menu-pop-shift":"-2px"},tt.value=!0,document.addEventListener("mousedown",wn,!0)}function go(){tt.value=!1,document.removeEventListener("mousedown",wn,!0),Ue.value=null}function qt(){Ue.value&&Zs(Ue.value.root),go()}function ps(){Ue.value&&en(Ue.value.id,Ue.value.name),go()}function xs(){const Qe=Ue.value;Qe&&(go(),s("deleteWorkspace",Qe.id))}const _n=Z(null),In=Z(null),To=Z({}),lo=Z(null);function St(Qe){const st=Qe.target;st.closest(".gh-more")||st.closest(".ws-menu")||Jo()}async function hs(Qe,st){if(_n.value===Qe.id){Jo();return}const Ct=st.currentTarget;In.value=Qe,_n.value=Qe.id,document.addEventListener("mousedown",St),window.addEventListener("resize",Jo),await yt();const Qt=lo.value?.el,kn=Ct.getBoundingClientRect(),Ko=4,Eo=8,bo=Qt?.offsetHeight??0,Ns=Qt?.offsetWidth??0;let Do=kn.bottom+Ko,Io=!1;Do+bo>window.innerHeight-Eo&&(Do=Math.max(Eo,kn.top-bo-Ko),Io=!0);let Qo=kn.right-Ns;Qo{document.removeEventListener("mousedown",wn,!0),document.removeEventListener("mousedown",St),document.removeEventListener("mousedown",pe),window.removeEventListener("resize",Jo),window.removeEventListener("resize",oe)});const no=Z(null);let $s;function Xs(){const Qe=no.value;Qe&&(Qe.classList.remove("blink-now"),Qe.getBoundingClientRect(),Qe.classList.add("blink-now"),clearTimeout($s),$s=setTimeout(()=>Qe.classList.remove("blink-now"),300))}const ci=zr(()=>jo(()=>import("./DesignSystemView-CTUhpkDe.js"),__vite__mapDeps([8,9]))),Oo=Z(!1);let vo,Po=!1;function co(Qe){Po=!1,clearTimeout(vo),Qe.currentTarget.setPointerCapture?.(Qe.pointerId),vo=setTimeout(()=>{Po=!0,Oo.value=!0},s9e)}function Tn(Qe){clearTimeout(vo);const st=Qe.currentTarget;st.hasPointerCapture?.(Qe.pointerId)&&st.releasePointerCapture(Qe.pointerId)}function fo(){if(Po){Po=!1;return}Xs()}return Vn(()=>{clearTimeout(vo)}),(Qe,st)=>(y(),M("aside",{class:Re(["side",{"macos-desktop":p(rc),collapsed:e.collapsed,"no-anim":e.dragging}]),style:Zt({width:e.collapsed?"0px":e.colWidth+"px"})},[C("div",{class:"col",style:Zt({width:e.colWidth+"px"}),onDragenter:Fe,onDragover:Oe,onDragleave:Ge,onDrop:at},[C("div",Hve,[C("div",zve,[p(rc)?ee("",!0):(y(),M(Pe,{key:0},[(y(),M("svg",{ref_key:"logoRef",ref:no,class:"ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:fo,onPointerdown:co,onPointerup:Tn,onPointercancel:Tn},[...st[31]||(st[31]=[iu('',2)])],544)),st[32]||(st[32]=C("span",{class:"ch-name"},"Kimi Code",-1))],64))]),C("div",Wve,[p(rc)?ee("",!0):(y(),he(p(gn),{key:0,class:"ch-collapse",size:"sm",label:p(n)("sidebar.collapseSidebar"),tooltip:p(n)("sidebar.collapseSidebar"),onClick:st[0]||(st[0]=It(Ct=>s("collapse"),["stop"]))},{default:me(()=>[j(p(Te),{name:"panel-collapse"})]),_:1},8,["label","tooltip"])),j(b0e)])]),C("div",{class:Re(["sidebar-actions",{"sidebar-actions--has-workspace-action":o9e}])},[C("button",{class:"btn-new-chat",type:"button",onClick:st[1]||(st[1]=It(Ct=>s("create"),["stop"]))},[j(p(Te),{name:"chat-new"}),C("span",null,N(p(n)("sidebar.newChat")),1),j(p(oa),{keys:p(l)},null,8,["keys"])]),ee("",!0),C("button",{class:"search",type:"button",onClick:a},[j(p(Te),{class:"search-icon",name:"search"}),C("span",Uve,N(p(n)("sidebar.search")),1),j(p(oa),{keys:p(r)},null,8,["keys"])])],2),ne.value==="flat"||e.groups.length>0?(y(),M("div",{key:0,class:Re(["sessions-head",{"sessions-head--scrolled":f.value}])},[e.pinnedSessions.length>0?(y(),he(Bve,{key:0,ref_key:"pinnedListRef",ref:ue,sessions:e.pinnedSessions,"active-id":e.activeId,"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,onSelectSession:ce,onRenameSession:st[3]||(st[3]=(Ct,Qt)=>s("rename",Ct,Qt)),onArchiveSession:st[4]||(st[4]=Ct=>s("archive",Ct)),onForkSession:st[5]||(st[5]=Ct=>s("fork",Ct)),onExportSession:st[6]||(st[6]=Ct=>s("export",Ct)),onPinSession:Se,onPinSessionAt:ze,onSessionDragStart:K,onSessionDragEnd:V,onReorder:st[7]||(st[7]=Ct=>s("reorderPinned",Ct))},null,8,["sessions","active-id","pending-by-session","unread-by-session"])):ee("",!0),C("div",jve,[C("span",Vve,N(p(n)("sidebar.sessionsHeader")),1),C("div",qve,[ne.value==="grouped"?(y(),he(p(gn),{key:0,class:"side-section-toggle",size:"sm",label:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),tooltip:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),onClick:st[8]||(st[8]=It(Ct=>A.value?T():S(),["stop"]))},{default:me(()=>[A.value?(y(),he(p(Te),{key:0,name:"expand"})):(y(),he(p(Te),{key:1,name:"collapse"}))]),_:1},8,["label","tooltip"])):ee("",!0),j(p(pn),{text:p(n)("sidebar.viewSwitcher")},{default:me(()=>[j(p(gn),{class:"side-section-toggle side-section-view",size:"sm",label:p(n)("sidebar.viewSwitcher"),onClick:It(ve,["stop"])},{default:me(()=>[j(p(Te),{name:"list-settings"})]),_:1},8,["label"])]),_:1},8,["text"])])])],2)):ee("",!0),C("div",{ref_key:"sessionsEl",ref:d,class:Re(["sessions",{scrolling:m.value,"pinned-drag-active":ne.value==="flat"&&W.value!==null,"flat-pinned-drop-hover":fe.value}]),onScroll:w,onDragover:we,onDrop:ge,onDragleave:Q},[ne.value==="grouped"?(y(),M(Pe,{key:0},[e.groups.length===0?(y(),M("div",Kve,N(p(n)("workspace.noWorkspace")),1)):(y(!0),M(Pe,{key:1},pt(e.groups,Ct=>(y(),M("div",{key:Ct.workspace.id,class:Re(["ws-drop-target",{"drop-before":B.value?.id===Ct.workspace.id&&B.value.position==="before","drop-after":B.value?.id===Ct.workspace.id&&B.value.position==="after"}]),onDragover:Qt=>U(Qt,Ct.workspace.id),onDrop:Qt=>z(Ct.workspace.id)},[j(Nve,{group:Ct,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":Tt.value,"rename-value":Bt.value,"rename-input-ref":on(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":_n.value,dragging:$.value===Ct.workspace.id,"is-collapsed":g,"visible-limit":P,"pinned-drag-session":W.value,onGroupClick:te,onGroupContextmenu:yn,onToggleWsMenu:hs,onCreateInWorkspace:st[9]||(st[9]=Qt=>s("createInWorkspace",Qt)),onSelectSession:ce,onRenameSession:st[10]||(st[10]=(Qt,kn)=>s("rename",Qt,kn)),onArchiveSession:st[11]||(st[11]=Qt=>s("archive",Qt)),onForkSession:st[12]||(st[12]=Qt=>s("fork",Qt)),onExportSession:st[13]||(st[13]=Qt=>s("export",Qt)),onPinSession:Se,onDropPinnedSession:ie,onExpand:D,onCollapse:I,onConfirmRename:Cn,onCancelRename:Mn,onUpdateRenameValue:We,onWsDragstart:H,onWsDragend:O},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging","pinned-drag-session"])],42,Zve))),128))],64)):(y(),M(Pe,{key:1},[(y(!0),M(Pe,null,pt(e.flatSessions,Ct=>(y(),he(Z5,{key:Ct.id,session:Ct,active:Ct.id===e.activeId,"approval-count":e.pendingBySession[Ct.id]?.approvals??0,"question-count":e.pendingBySession[Ct.id]?.questions??0,unread:e.unreadBySession[Ct.id]??!1,draggable:G.value!==Ct.id,onDragstart:Qt=>Y(Ct.id,Qt),onRenameStateChange:Qt=>G.value=Qt?Ct.id:null,onSelect:ce,onRename:st[14]||(st[14]=(Qt,kn)=>s("rename",Qt,kn)),onArchive:st[15]||(st[15]=Qt=>s("archive",Qt)),onFork:st[16]||(st[16]=Qt=>s("fork",Qt)),onExport:st[17]||(st[17]=Qt=>s("export",Qt)),onPin:Se},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),e.flatSessions.length===0&&!e.flatHasMore&&e.pinnedSessions.length===0?(y(),M("div",Gve,N(p(n)("sidebar.noSessions")),1)):ee("",!0),e.flatHasMore?(y(),M("div",Yve,[C("button",{class:"show-more",disabled:e.flatLoadingMore,onClick:st[18]||(st[18]=It(Ct=>s("loadMoreFlatSessions"),["stop"]))},[C("span",Jve,N(e.flatLoadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.loadMore")),1),j(p(Te),{name:"chevron-down",size:"sm"})],8,Xve)])):ee("",!0)],64))],34),C("div",{class:Re(["side-footer",{"side-footer--shadowed":h.value}])},[j(V2e,{onLogin:st[19]||(st[19]=Ct=>s("login")),onOpenSettings:st[20]||(st[20]=Ct=>s("openSettings"))})],2),C("div",{class:Re(["folder-drop-overlay",{show:Ee.value}]),"aria-hidden":"true"},[C("div",Qve,[j(p(Te),{name:"folder",size:"lg"}),C("span",null,N(p(n)("sidebar.dropToAddWorkspace")),1)])],2)],36),j(as,{name:"menu-pop"},{default:me(()=>[tt.value?(y(),he(p(Cl),{key:0,ref_key:"ghMenuRef",ref:gt,class:"gh-menu",style:Zt(Lt.value),onClick:st[21]||(st[21]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:qt},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:ps},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:xs},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[_n.value!==null&&In.value?(y(),he(p(Cl),{key:0,ref_key:"wsMenuRef",ref:lo,class:"ws-menu",style:Zt(To.value),onClick:st[25]||(st[25]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:st[22]||(st[22]=Ct=>uo(In.value))},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:st[23]||(st[23]=Ct=>Ys(In.value))},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:st[24]||(st[24]=Ct=>Nn(In.value))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[le.value?(y(),he(p(Cl),{key:0,ref_key:"viewMenuRef",ref:de,class:"view-menu",style:Zt(Ie.value),onClick:st[28]||(st[28]=It(()=>{},["stop"]))},{default:me(()=>[C("div",e9e,N(p(n)("sidebar.viewGroup")),1),j(p(hn),{onClick:st[26]||(st[26]=Ct=>ye("flat"))},{default:me(()=>[j(p(Te),{name:"list",size:"sm"}),qe(" "+N(p(n)("sidebar.viewFlat"))+" ",1),C("span",t9e,[ne.value==="flat"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1}),j(p(hn),{onClick:st[27]||(st[27]=Ct=>ye("grouped"))},{default:me(()=>[j(p(Te),{name:"tree-view",size:"sm"}),qe(" "+N(p(n)("sidebar.viewGrouped"))+" ",1),C("span",n9e,[ne.value==="grouped"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),i.value?(y(),he(uee,{key:0,sessions:e.sessions,"active-id":e.activeId,onSelect:ce,onClose:st[29]||(st[29]=Ct=>i.value=!1)},null,8,["sessions","active-id"])):ee("",!0),(y(),he(Zr,{to:"body"},[Oo.value?(y(),he(p(ci),{key:0,onClose:st[30]||(st[30]=Ct=>Oo.value=!1)})):ee("",!0)]))],6))}}),r9e=ft(i9e,[["__scopeId","data-v-a80a4ba6"]]),l9e=["aria-label"],a9e=et({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{},applyLive:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),{width:i,dragging:r,cursor:l,onPointerDown:a}=She({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse,applyLive:n.applyLive});return o("update:width",i.value),Je(i,u=>o("update:width",u)),Je(r,u=>o("update:dragging",u)),(u,c)=>(y(),M("div",{class:Re(["rh",{dragging:p(r)}]),style:Zt({cursor:p(l)}),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??p(s)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...d)=>p(a)&&p(a)(...d))},[...c[1]||(c[1]=[C("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],46,l9e))}}),Zx=ft(a9e,[["__scopeId","data-v-1c6dfdc5"]]),u9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c9e(e,t){return y(),M("svg",u9e,[...t[0]||(t[0]=[C("path",{d:"M12.0684 2.03418C12.5654 2.03421 12.9687 2.43755 12.9688 2.93457V11.0996H21.0654C21.5625 11.0996 21.9658 11.503 21.9658 12C21.9658 12.497 21.5625 12.9004 21.0654 12.9004H12.9688V21.0654C12.9687 21.5624 12.5654 21.9658 12.0684 21.9658C11.5713 21.9658 11.168 21.5625 11.168 21.0654V12.9004H2.93457C2.43751 12.9004 2.03418 12.4971 2.03418 12C2.03418 11.5029 2.43751 11.0996 2.93457 11.0996H11.168V2.93457C11.168 2.43753 11.5713 2.03418 12.0684 2.03418Z",fill:"currentColor"},null,-1)])])}const d9e=kt({name:"kimi-add",render:c9e}),f9e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function p9e(e,t){return y(),M("svg",f9e,[...t[0]||(t[0]=[C("path",{id:"p0",d:"M 0 -9.9 C -5.468 -9.9 -9.9 -5.468 -9.9 0 C -9.9 1.923 -9.351 3.719 -8.402 5.239 C -8.402 5.239 -9.483 7.821 -9.483 7.821 C -9.896 8.809 -9.171 9.9 -8.099 9.9 C -8.099 9.9 0 9.9 0 9.9 C 5.468 9.9 9.9 5.468 9.9 0 C 9.9 -5.468 5.468 -9.9 0 -9.9 Z M -8.1 0 C -8.1 -4.474 -4.474 -8.1 0 -8.1 C 4.473 -8.1 8.1 -4.474 8.1 0 C 8.1 4.473 4.473 8.1 -0.001 8.1 C -0.001 8.1 -7.648 8.1 -7.648 8.1 L -6.365 5.035 C -6.365 5.035 -6.648 4.629 -6.648 4.629 C -7.563 3.317 -8.1 1.723 -8.1 0 Z",transform:"matrix(1 0 0 1 12 12)",fill:"currentColor","fill-rule":"evenodd"},null,-1),C("path",{id:"p1",d:"M 3.6 0.5 L -2.6 0.5 M 0.5 -2.573 L 0.5 3.573",transform:"translate(11.5 11.5)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},null,-1)])])}const h9e=kt({name:"kimi-add-conversation",render:p9e}),m9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g9e(e,t){return y(),M("svg",m9e,[...t[0]||(t[0]=[C("path",{d:"M15.0996 12C15.5967 12 16 12.4033 16 12.9004C15.9998 13.3973 15.5965 13.7998 15.0996 13.7998H8.90039C8.40346 13.7998 8.00021 13.3973 8 12.9004C8 12.4033 8.40333 12 8.90039 12H15.0996Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19 3.2002C20.5464 3.2002 21.7998 4.4536 21.7998 6V7C21.7998 8.03565 21.2363 8.93754 20.4004 9.42188V17C20.4004 19.1539 18.6539 20.9004 16.5 20.9004H7.5C5.34609 20.9004 3.59961 19.1539 3.59961 17V9.42188C2.76374 8.93754 2.2002 8.03565 2.2002 7V6C2.2002 4.4536 3.4536 3.2002 5 3.2002H19ZM5.40039 17C5.40039 18.1598 6.3402 19.0996 7.5 19.0996H16.5C17.6598 19.0996 18.5996 18.1598 18.5996 17V9.7998H5.40039V17ZM4.89746 5.00488C4.39333 5.05621 4 5.48232 4 6V7L4.00488 7.10254C4.05278 7.57297 4.42703 7.94722 4.89746 7.99512L5 8H19C19.5523 8 20 7.55228 20 7V6C20 5.44772 19.5523 5 19 5H5L4.89746 5.00488Z",fill:"currentColor"},null,-1)])])}const v9e=kt({name:"kimi-archive",render:g9e}),y9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function k9e(e,t){return y(),M("svg",y9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 21.6387C11.7378 21.988 12.3059 21.987 12.6565 21.6364L18.1949 16.098C18.5464 15.7465 18.5464 15.1766 18.1949 14.8252C17.8434 14.4737 17.2736 14.4737 16.9221 14.8252L12.9201 18.8272V3.00002C12.9201 2.50297 12.5171 2.10003 12.0201 2.10003C11.523 2.10003 11.1201 2.50297 11.1201 3.00002V18.8383L7.07554 14.8229C6.7228 14.4727 6.15295 14.4747 5.80275 14.8275C5.45255 15.1802 5.45461 15.7501 5.80735 16.1003L11.386 21.6387Z",fill:"currentColor"},null,-1)])])}const b9e=kt({name:"kimi-arrow-down",render:k9e}),C9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function w9e(e,t){return y(),M("svg",C9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.16127 12.814C1.81197 12.4622 1.81299 11.8941 2.16357 11.5435L7.70203 6.00506C8.0535 5.65359 8.62335 5.65359 8.97482 6.00506C9.32629 6.35653 9.32629 6.92638 8.97482 7.27785L4.97276 11.2799H20.8C21.297 11.2799 21.7 11.6829 21.7 12.1799C21.7 12.677 21.297 13.0799 20.8 13.0799H4.96171L8.97712 17.1244C9.32732 17.4772 9.32526 18.047 8.97252 18.3972C8.61978 18.7474 8.04993 18.7454 7.69973 18.3926L2.16127 12.814Z",fill:"currentColor"},null,-1)])])}const _9e=kt({name:"kimi-arrow-left",render:w9e}),x9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function S9e(e,t){return y(),M("svg",x9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.4387 12.814C21.788 12.4622 21.787 11.8941 21.4364 11.5436L15.8979 6.0051C15.5464 5.65363 14.9766 5.65363 14.6251 6.0051C14.2737 6.35657 14.2737 6.92642 14.6251 7.27789L18.6272 11.28H2.79998C2.30293 11.28 1.89998 11.6829 1.89998 12.18C1.89998 12.677 2.30293 13.08 2.79998 13.08H18.6382L14.6228 17.1245C14.2726 17.4772 14.2747 18.0471 14.6274 18.3973C14.9802 18.7475 15.55 18.7454 15.9002 18.3927L21.4387 12.814Z",fill:"currentColor"},null,-1)])])}const A9e=kt({name:"kimi-arrow-right",render:S9e}),M9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T9e(e,t){return y(),M("svg",M9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 2.36129C11.7378 2.01198 12.3059 2.013 12.6565 2.36358L18.1949 7.90204C18.5464 8.25351 18.5464 8.82336 18.1949 9.17483C17.8434 9.52631 17.2736 9.52631 16.9221 9.17483L12.9201 5.17277V21C12.9201 21.497 12.5171 21.9 12.0201 21.9C11.523 21.9 11.1201 21.497 11.1201 21V5.16172L7.07554 9.17713C6.7228 9.52733 6.15295 9.52527 5.80275 9.17253C5.45255 8.81979 5.45461 8.24995 5.80735 7.89975L11.386 2.36129Z",fill:"currentColor"},null,-1)])])}const E9e=kt({name:"kimi-arrow-up",render:T9e}),I9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function L9e(e,t){return y(),M("svg",I9e,[...t[0]||(t[0]=[C("path",{d:"M19.3027 5.9053C19.6542 5.55397 20.2247 5.55388 20.5761 5.9053C20.9273 6.25675 20.9273 6.82734 20.5761 7.17874L9.65911 18.0948C9.30773 18.4461 8.73814 18.446 8.38665 18.0948L3.42376 13.1328C3.0726 12.7814 3.07263 12.2118 3.42376 11.8604C3.77524 11.509 4.34575 11.5089 4.6972 11.8604L9.02239 16.1856L19.3027 5.9053Z",fill:"currentColor"},null,-1)])])}const $9e=kt({name:"kimi-check",render:L9e}),N9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function F9e(e,t){return y(),M("svg",N9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 16.7134C11.743 17.0627 12.3111 17.0617 12.6617 16.7111L19.6364 9.73641C19.9878 9.38494 19.9878 8.81509 19.6364 8.46362C19.2849 8.11215 18.7151 8.11215 18.3636 8.46362L12.023 14.8042L5.63407 8.46132C5.28133 8.11112 4.71149 8.11318 4.36129 8.46592C4.01109 8.81866 4.01314 9.3885 4.36588 9.73871L11.3912 16.7134Z",fill:"currentColor"},null,-1)])])}const R9e=kt({name:"kimi-chevron-down",render:F9e}),O9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function P9e(e,t){return y(),M("svg",O9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.1261 12.6088C16.4754 12.257 16.4743 11.6889 16.1238 11.3383L9.14904 4.36363C8.79757 4.01216 8.22772 4.01216 7.87625 4.36363C7.52477 4.7151 7.52477 5.28495 7.87625 5.63642L14.2169 11.977L7.87395 18.3659C7.52375 18.7187 7.52581 19.2885 7.87855 19.6387C8.23129 19.9889 8.80113 19.9869 9.15133 19.6341L16.1261 12.6088Z",fill:"currentColor"},null,-1)])])}const D9e=kt({name:"kimi-chevron-right",render:P9e}),B9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H9e(e,t){return y(),M("svg",B9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 8.46132C11.743 8.11202 12.3111 8.11304 12.6617 8.46362L19.6364 15.4383C19.9878 15.7898 19.9878 16.3597 19.6364 16.7111C19.2849 17.0626 18.7151 17.0626 18.3636 16.7111L12.023 10.3705L5.63407 16.7134C5.28133 17.0636 4.71149 17.0616 4.36129 16.7088C4.01109 16.3561 4.01314 15.7862 4.36588 15.436L11.3912 8.46132Z",fill:"currentColor"},null,-1)])])}const z9e=kt({name:"kimi-chevron-up",render:H9e}),W9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function U9e(e,t){return y(),M("svg",W9e,[...t[0]||(t[0]=[C("path",{d:"M11.8999 6.79965C12.397 6.79965 12.7997 7.20235 12.7997 7.69941V11.7266L14.7359 13.6629C15.0873 14.0143 15.0879 14.584 14.7366 14.9355C14.3852 15.287 13.8148 15.287 13.4633 14.9355L11.2632 12.7355C11.0947 12.5668 11.0002 12.338 11.0001 12.0995V7.69941C11.0001 7.20238 11.4029 6.7997 11.8999 6.79965Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 1.89893C17.4677 1.89893 21.9001 6.33147 21.9002 11.7991C21.9002 17.2669 17.4678 21.6993 12 21.6993C6.53228 21.6993 2.09985 17.2669 2.09985 11.7991C2.09998 6.33147 6.53236 1.89893 12 1.89893ZM20.1 11.7998C20.1 7.32616 16.4737 3.69984 12 3.69984C7.5264 3.69984 3.90008 7.32616 3.90008 11.7998C3.90032 16.2732 7.52655 19.8998 12 19.8998C16.4735 19.8998 20.0998 16.2732 20.1 11.7998Z",fill:"currentColor"},null,-1)])])}const j9e=kt({name:"kimi-clock",render:U9e}),V9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q9e(e,t){return y(),M("svg",V9e,[...t[0]||(t[0]=[C("path",{d:"M17.9542 4.77253C18.3056 4.42106 18.8761 4.42106 19.2276 4.77253C19.579 5.12401 19.579 5.69452 19.2276 6.04597L13.2735 12.0001L19.2276 17.9542C19.5791 18.3056 19.5791 18.8761 19.2276 19.2276C18.8761 19.5791 18.3056 19.5791 17.9542 19.2276L12.0001 13.2735L6.04595 19.2276C5.69451 19.5791 5.12399 19.579 4.77252 19.2276C4.42104 18.8761 4.42104 18.3056 4.77252 17.9542L10.7266 12.0001L4.77252 6.04597C4.42104 5.6945 4.42104 5.124 4.77252 4.77253C5.12399 4.42107 5.69448 4.42106 6.04595 4.77253L12.0001 10.7266L17.9542 4.77253Z",fill:"currentColor"},null,-1)])])}const K9e=kt({name:"kimi-close",render:q9e}),Z9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G9e(e,t){return y(),M("svg",Z9e,[...t[0]||(t[0]=[C("path",{d:"M9.85815 11.957C10.9074 11.957 11.7583 12.8083 11.7585 13.8574V19.8574C11.7585 20.3545 11.3552 20.7578 10.8582 20.7578C10.3611 20.7578 9.95776 20.3545 9.95776 19.8574V13.8574C9.95755 13.8024 9.91325 13.7578 9.85815 13.7578H3.85815C3.3611 13.7578 2.95776 13.3545 2.95776 12.8574C2.95798 12.3605 3.36123 11.957 3.85815 11.957H9.85815Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8582 2.95703C13.3551 2.95703 13.7583 3.36054 13.7585 3.85742V9.85742C13.7585 9.91265 13.8029 9.95703 13.8582 9.95703H19.8582C20.3551 9.95703 20.7583 10.3605 20.7585 10.8574C20.7585 11.3545 20.3552 11.7578 19.8582 11.7578H13.8582C12.8088 11.7578 11.9578 10.9068 11.9578 9.85742V3.85742C11.958 3.36054 12.3612 2.95703 12.8582 2.95703Z",fill:"currentColor"},null,-1)])])}const Y9e=kt({name:"kimi-collapse",render:G9e}),X9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J9e(e,t){return y(),M("svg",X9e,[...t[0]||(t[0]=[C("path",{d:"M11.9004 2.19995C17.3678 2.20016 21.7998 6.63285 21.7998 12.1003C21.7996 17.5677 17.3677 21.9995 11.9004 21.9998H3.80078C2.72946 21.9996 2.00334 20.9089 2.41699 19.9207L3.49805 17.3386C2.54871 15.8189 2.00007 14.0226 2 12.1003C2 6.63272 6.43277 2.19995 11.9004 2.19995ZM11.9004 3.99976C7.42688 3.99976 3.7998 7.62684 3.7998 12.1003C3.79989 13.8228 4.33669 15.4175 5.25195 16.7292L5.53516 17.1345L4.25195 20.2H11.8994C16.3727 20.1999 19.9998 16.5736 20 12.1003C20 7.62697 16.3737 3.99997 11.9004 3.99976ZM8.9541 10.8005C9.75473 10.8006 10.4041 11.4491 10.4043 12.2498C10.4043 13.0505 9.75482 13.6998 8.9541 13.7C8.15329 13.7 7.50391 13.0506 7.50391 12.2498C7.50406 11.4491 8.15339 10.8005 8.9541 10.8005ZM15.1533 10.8005C15.9539 10.8006 16.6034 11.4491 16.6035 12.2498C16.6035 13.0505 15.954 13.6998 15.1533 13.7C14.3525 13.7 13.7031 13.0506 13.7031 12.2498C13.7033 11.4491 14.3526 10.8005 15.1533 10.8005Z",fill:"currentColor"},null,-1)])])}const Q9e=kt({name:"kimi-comment",render:J9e}),e4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function t4e(e,t){return y(),M("svg",e4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 7.09961C19.1539 7.09961 20.9004 8.84609 20.9004 11V17C20.9004 19.1539 19.1539 20.9004 17 20.9004H11C8.84609 20.9004 7.09961 19.1539 7.09961 17V11C7.09961 8.84609 8.84609 7.09961 11 7.09961H17ZM11 8.90039C9.8402 8.90039 8.90039 9.8402 8.90039 11V17C8.90039 18.1598 9.8402 19.0996 11 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V11C19.0996 9.8402 18.1598 8.90039 17 8.90039H11Z",fill:"currentColor"},null,-1),C("path",{d:"M13 3.09961C14.4447 3.09961 15.705 3.88644 16.3779 5.0498C16.6265 5.47999 16.4789 6.03049 16.0488 6.2793C15.6186 6.52781 15.0681 6.38029 14.8193 5.9502C14.4548 5.32041 13.776 4.90039 13 4.90039H7C5.8402 4.90039 4.90039 5.8402 4.90039 7V13C4.90039 13.776 5.32041 14.4548 5.9502 14.8193C6.38029 15.0681 6.52781 15.6186 6.2793 16.0488C6.03049 16.4789 5.47999 16.6265 5.0498 16.3779C3.88644 15.705 3.09961 14.4447 3.09961 13V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H13Z",fill:"currentColor"},null,-1)])])}const n4e=kt({name:"kimi-copy",render:t4e}),o4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function s4e(e,t){return y(),M("svg",o4e,[...t[0]||(t[0]=[C("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 10.2797 2.43414 8.66074 3.19922 7.24707C3.20172 7.24246 3.20453 7.23801 3.20703 7.2334C3.33385 6.99995 3.47181 6.77351 3.61621 6.55176C3.73214 6.37355 3.85079 6.19744 3.97754 6.02734C5.35905 4.17471 7.36856 2.81959 9.68945 2.27051C9.69952 2.26813 9.70965 2.26602 9.71973 2.26367C9.85224 2.23276 9.98563 2.2043 10.1201 2.17871C10.1542 2.17221 10.1884 2.16631 10.2227 2.16016C10.3466 2.13791 10.4712 2.11724 10.5967 2.09961C10.6301 2.09489 10.6637 2.0913 10.6973 2.08691C10.8216 2.07073 10.9465 2.05552 11.0723 2.04395C11.1125 2.04022 11.153 2.0384 11.1934 2.03516C11.4595 2.0139 11.7284 2 12 2ZM11.9941 3.7998C11.9968 3.86623 12 3.93292 12 4C12 6.76142 9.76142 9 7 9C6.14209 9 5.33517 8.78324 4.62988 8.40234C4.09862 9.48861 3.7998 10.7093 3.7998 12C3.7998 12.4438 3.83644 12.8791 3.9043 13.3037C4.52807 12.5673 5.45945 12.0996 6.5 12.0996C8.37777 12.0996 9.90039 13.6222 9.90039 15.5C9.90039 17.0702 8.83532 18.3903 7.38867 18.7812C8.70267 19.6765 10.2901 20.2002 12 20.2002C12.468 20.2002 12.9264 20.1583 13.373 20.083C13.1323 19.4342 13 18.7327 13 18C13 14.6863 15.6863 12 19 12C19.4098 12 19.8098 12.0416 20.1963 12.1201C20.1969 12.0801 20.2002 12.0401 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998H11.9941ZM19 13.7998C16.6804 13.7998 14.7998 15.6804 14.7998 18C14.7998 18.5617 14.9112 19.0972 15.1113 19.5869C17.5225 18.597 19.3558 16.4929 19.9727 13.9141C19.6605 13.8399 19.3349 13.7998 19 13.7998ZM6.5 13.9004C5.61634 13.9004 4.90039 14.6163 4.90039 15.5C4.90039 16.3837 5.61634 17.0996 6.5 17.0996C7.38366 17.0996 8.09961 16.3837 8.09961 15.5C8.09961 14.6163 7.38366 13.9004 6.5 13.9004ZM15.5 6.09961C16.8255 6.09961 17.9004 7.17452 17.9004 8.5C17.9004 9.82548 16.8255 10.9004 15.5 10.9004C14.1745 10.9004 13.0996 9.82548 13.0996 8.5C13.0996 7.17452 14.1745 6.09961 15.5 6.09961ZM15.5 7.90039C15.1686 7.90039 14.9004 8.16863 14.9004 8.5C14.9004 8.83137 15.1686 9.09961 15.5 9.09961C15.8314 9.09961 16.0996 8.83137 16.0996 8.5C16.0996 8.16863 15.8314 7.90039 15.5 7.90039ZM10.1992 4C8.35326 4.41375 6.74333 5.44923 5.59961 6.87598C6.02235 7.08306 6.49716 7.2002 7 7.2002C8.76731 7.2002 10.1992 5.76731 10.1992 4Z",fill:"currentColor"},null,-1)])])}const i4e=kt({name:"kimi-dark-mode",render:s4e}),r4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l4e(e,t){return y(),M("svg",r4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.90002C12.4971 2.90002 12.9 3.30297 12.9 3.80002V12.2939L15.8081 9.38585C16.1595 9.03438 16.7294 9.03438 17.0808 9.38585C17.4323 9.73732 17.4323 10.3072 17.0808 10.6586L12.6364 15.1031C12.4676 15.2719 12.2387 15.3667 12 15.3667C11.7613 15.3667 11.5324 15.2719 11.3636 15.1031L6.91917 10.6586C6.5677 10.3072 6.5677 9.73732 6.91917 9.38585C7.27064 9.03438 7.84049 9.03438 8.19196 9.38585L11.1 12.2939V3.80002C11.1 3.30297 11.503 2.90002 12 2.90002ZM4.00001 13.5874C4.49706 13.5874 4.90001 13.9903 4.90001 14.4874V18.043C4.90001 18.2758 4.99249 18.499 5.1571 18.6636C5.32172 18.8282 5.54498 18.9207 5.77778 18.9207H18.2222C18.455 18.9207 18.6783 18.8283 18.8429 18.6636C19.0075 18.499 19.1 18.2758 19.1 18.043V14.4874C19.1 13.9903 19.5029 13.5874 20 13.5874C20.4971 13.5874 20.9 13.9903 20.9 14.4874V18.043C20.9 18.7531 20.6179 19.4342 20.1157 19.9364C19.6135 20.4386 18.9324 20.7207 18.2222 20.7207H5.77778C5.06759 20.7207 4.38649 20.4386 3.88431 19.9364C3.38213 19.4342 3.10001 18.7531 3.10001 18.043V14.4874C3.10001 13.9903 3.50295 13.5874 4.00001 13.5874Z",fill:"currentColor"},null,-1)])])}const a4e=kt({name:"kimi-download",render:l4e}),u4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c4e(e,t){return y(),M("svg",u4e,[...t[0]||(t[0]=[C("path",{d:"M18.0179 3.09998C18.3963 3.10003 18.7709 3.17491 19.1205 3.31971C19.4701 3.46454 19.7884 3.67614 20.056 3.94373C20.3237 4.21144 20.5362 4.52965 20.681 4.87928C20.8258 5.22887 20.8997 5.60423 20.8997 5.9828C20.8997 6.36118 20.8257 6.73591 20.681 7.08533C20.5362 7.43497 20.3237 7.75317 20.056 8.02088L17.639 10.4379L9.15756 18.9183C8.5296 19.5463 7.74274 19.992 6.8812 20.2074L4.21811 20.8734C3.91148 20.95 3.5871 20.8596 3.36362 20.6361C3.14017 20.4126 3.05063 20.0883 3.12729 19.7816L3.79233 17.1185C4.00771 16.257 4.45344 15.4701 5.08139 14.8422L15.9798 3.94373C16.5203 3.40346 17.2536 3.09998 18.0179 3.09998ZM19.0003 19.1C19.4972 19.1002 19.8997 19.5034 19.8997 20.0004C19.8995 20.4971 19.4971 20.8996 19.0003 20.8998H12.0003C11.5034 20.8998 11.1001 20.4973 11.0999 20.0004C11.0999 19.5033 11.5033 19.1 12.0003 19.1H19.0003ZM18.0179 4.89979C17.7309 4.89979 17.4553 5.01417 17.2523 5.21717L6.35385 16.1146C5.95661 16.5119 5.67469 17.01 5.53842 17.5551L5.23666 18.7631L6.44467 18.4613C6.98971 18.3251 7.48782 18.0431 7.8851 17.6459L18.7826 6.74744C18.883 6.64702 18.9635 6.52821 19.0179 6.39686C19.0723 6.26558 19.0999 6.1247 19.0999 5.9828C19.0999 5.84075 19.0723 5.69916 19.0179 5.56776C18.9635 5.43645 18.883 5.31757 18.7826 5.21717C18.6821 5.11678 18.5631 5.03716 18.432 4.9828C18.3008 4.92845 18.16 4.89983 18.0179 4.89979Z",fill:"currentColor"},null,-1)])])}const d4e=kt({name:"kimi-edit",render:c4e}),f4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function p4e(e,t){return y(),M("svg",f4e,[...t[0]||(t[0]=[C("path",{d:"M5 11.0996C5.49693 11.0996 5.90018 11.5031 5.90039 12V18C5.90039 18.0552 5.94477 18.0996 6 18.0996H12C12.4969 18.0996 12.9002 18.5031 12.9004 19C12.9004 19.4971 12.4971 19.9004 12 19.9004H6C4.95066 19.9004 4.09961 19.0493 4.09961 18V12C4.09982 11.5031 4.50307 11.0996 5 11.0996ZM18 4.09961C19.0492 4.09961 19.9002 4.95084 19.9004 6V12C19.9004 12.4971 19.4971 12.9004 19 12.9004C18.5029 12.9004 18.0996 12.4971 18.0996 12V6C18.0994 5.94495 18.0551 5.90039 18 5.90039H12C11.5029 5.90039 11.0996 5.49706 11.0996 5C11.0998 4.50312 11.5031 4.09961 12 4.09961H18Z",fill:"currentColor"},null,-1)])])}const h4e=kt({name:"kimi-expand",render:p4e}),m4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g4e(e,t){return y(),M("svg",m4e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1723 2.1001C13.9413 2.10018 14.6793 2.40592 15.2231 2.94971L19.0512 6.77783C19.595 7.32162 19.9007 8.0596 19.9008 8.82861V18.0005C19.9008 20.1544 18.1543 21.9009 16.0004 21.9009H8.0004C5.84649 21.9009 4.10001 20.1544 4.10001 18.0005V6.00049C4.10001 3.84658 5.84649 2.1001 8.0004 2.1001H13.1723ZM8.0004 3.90088C6.8406 3.90088 5.90079 4.84069 5.90079 6.00049V18.0005C5.90079 19.1603 6.8406 20.1001 8.0004 20.1001H16.0004C17.1602 20.1001 18.1 19.1603 18.1 18.0005V9.90088H15.0004C13.3988 9.90088 12.1 8.60211 12.1 7.00049V3.90088H8.0004ZM13.9008 7.00049C13.9008 7.608 14.3929 8.1001 15.0004 8.1001H17.8217C17.8072 8.08375 17.7933 8.06681 17.7777 8.05127L13.9496 4.22314C13.9339 4.20745 13.9173 4.19286 13.9008 4.17822V7.00049Z",fill:"currentColor"})],-1)])])}const Gx=kt({name:"kimi-file",render:g4e}),v4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y4e(e,t){return y(),M("svg",v4e,[...t[0]||(t[0]=[C("path",{d:"M15.4795 15.4971C15.9765 15.4971 16.3799 15.9004 16.3799 16.3975C16.3799 16.8945 15.9765 17.2978 15.4795 17.2979H8.52051C8.02345 17.2979 7.62012 16.8945 7.62012 16.3975C7.62012 15.9004 8.02345 15.4971 8.52051 15.4971H15.4795Z",fill:"currentColor"},null,-1),C("path",{d:"M12.3359 11.0996C12.8329 11.0997 13.2354 11.503 13.2354 12C13.2354 12.497 12.8329 12.9003 12.3359 12.9004H8.52051C8.02345 12.9004 7.62012 12.4971 7.62012 12C7.62012 11.5029 8.02345 11.0996 8.52051 11.0996H12.3359Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1719 2.09961C13.9408 2.09969 14.6789 2.40555 15.2227 2.94922L19.0508 6.77734C19.5946 7.32113 19.9003 8.05911 19.9004 8.82812V18C19.9004 20.1539 18.1539 21.9004 16 21.9004H8C5.84626 21.9002 4.09961 20.1538 4.09961 18V6C4.09961 3.84621 5.84626 2.09981 8 2.09961H13.1719ZM8 3.90039C6.84037 3.90059 5.90039 4.84032 5.90039 6V18C5.90039 19.1597 6.84037 20.0994 8 20.0996H16C17.1598 20.0996 18.0996 19.1598 18.0996 18V9.90039H15C13.3985 9.90019 12.0996 8.6015 12.0996 7V3.90039H8ZM13.9004 7C13.9004 7.60739 14.3927 8.09941 15 8.09961H17.8213C17.8068 8.08333 17.7928 8.06626 17.7773 8.05078L13.9492 4.22266C13.9335 4.20696 13.9169 4.19237 13.9004 4.17773V7Z",fill:"currentColor"},null,-1)])])}const k4e=kt({name:"kimi-file-text",render:y4e}),b4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C4e(e,t){return y(),M("svg",b4e,[...t[0]||(t[0]=[C("path",{d:"M9.2373 3.7002C10.4169 3.7002 11.5297 4.24779 12.249 5.18262L12.4424 5.43359H18C20.0987 5.43359 21.7998 7.13472 21.7998 9.2334V16.5C21.7998 18.5987 20.0987 20.2998 18 20.2998H6C3.90132 20.2998 2.2002 18.5987 2.2002 16.5V7.5C2.2002 5.40132 3.90132 3.7002 6 3.7002H9.2373ZM6 5.5C4.89543 5.5 4 6.39543 4 7.5V16.5C4 17.6046 4.89543 18.5 6 18.5H18C19.0357 18.5 19.887 17.7128 19.9893 16.7041L20 16.5V9.2334C20 8.19775 19.2128 7.34641 18.2041 7.24414L18 7.2334H12.0479L11.9326 7.22656C11.666 7.19561 11.4205 7.05812 11.2549 6.84277L10.8223 6.28027C10.4437 5.78834 9.85808 5.5 9.2373 5.5H6ZM16 9.59961C16.4971 9.59961 16.9004 10.0029 16.9004 10.5C16.9004 10.9971 16.4971 11.4004 16 11.4004H8C7.50294 11.4004 7.09961 10.9971 7.09961 10.5C7.09961 10.0029 7.50294 9.59961 8 9.59961H16Z",fill:"currentColor"},null,-1)])])}const w4e=kt({name:"kimi-folder",render:C4e}),_4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x4e(e,t){return y(),M("svg",_4e,[...t[0]||(t[0]=[C("g",null,[C("path",{d:"M18.3623 9.99976L18.209 8.48999C18.2031 8.43161 18.2004 8.37289 18.2002 8.31421C18.1988 8.31196 18.1956 8.30842 18.1904 8.30347C18.1718 8.28559 18.1302 8.26245 18.0713 8.26245H11C10.261 8.26245 9.59753 7.81016 9.32617 7.1228L8.9082 6.06421C8.88101 5.9953 8.85737 5.92501 8.83887 5.85327C8.83778 5.85099 8.833 5.84268 8.81836 5.83179C8.79454 5.81475 8.7549 5.79939 8.70605 5.80054H3.92871C3.86986 5.80054 3.82825 5.82368 3.80957 5.84155C3.80816 5.8429 3.80675 5.84428 3.80566 5.84546L4.47559 14.0955L3.62109 17.5154L5.12109 11.5154C5.34367 10.6251 6.1438 9.99977 7.06152 9.99976H18.3623ZM7.06152 11.7996C6.96976 11.7996 6.88944 11.8629 6.86719 11.9519L5.36719 17.9519C5.33598 18.078 5.43158 18.1999 5.56152 18.2H19.4385C19.5302 18.1999 19.6106 18.1376 19.6328 18.0486L21.1328 12.0486C21.1644 11.9224 21.0686 11.7996 20.9385 11.7996H7.06152ZM20.9385 9.99976C22.2396 9.99977 23.1945 11.2228 22.8789 12.4851L21.3789 18.4851C21.1563 19.3754 20.3562 19.9997 19.4385 19.9998H4.92871C4.41722 19.9998 3.92613 19.8059 3.56445 19.4597C3.20281 19.1135 3.00004 18.6436 3 18.1541L2 5.84644C2.00006 5.35711 2.20311 4.88786 2.56445 4.54175C2.92613 4.19554 3.41722 4.00073 3.92871 4.00073H8.66406C9.10133 3.99051 9.5296 4.1225 9.87793 4.37573C10.2285 4.63118 10.4767 4.99457 10.582 5.40405L11 6.46167H18.0713C18.5828 6.46167 19.0739 6.65648 19.4355 7.00269C19.7971 7.34888 20 7.81883 20 8.30835L20.1719 9.99976H20.9385Z",fill:"currentColor"})],-1)])])}const S4e=kt({name:"kimi-folder-open",render:x4e}),A4e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function M4e(e,t){return y(),M("svg",A4e,[...t[0]||(t[0]=[C("path",{id:"af-p0",d:"M -2.619 -8.3 C -1.815 -8.3 -1.048 -7.97 -0.499 -7.39 C -0.499 -7.39 0.141 -6.712 0.141 -6.712 C 0.141 -6.712 5.75 -6.712 5.75 -6.712 C 7.904 -6.712 9.65 -4.986 9.65 -2.858 C 9.65 -2.858 9.65 -1.71 9.65 -1.71 C 9.65 -1.219 9.247 -0.821 8.75 -0.821 C 8.253 -0.821 7.85 -1.219 7.85 -1.71 C 7.85 -1.71 7.85 -2.858 7.85 -2.858 C 7.849 -4.004 6.91 -4.934 5.75 -4.934 C 5.75 -4.934 -0.207 -4.934 -0.207 -4.934 C -0.484 -4.934 -0.749 -5.047 -0.938 -5.247 C -0.938 -5.247 -1.815 -6.177 -1.815 -6.177 C -2.023 -6.397 -2.315 -6.521 -2.619 -6.521 C -2.619 -6.521 -6.25 -6.521 -6.25 -6.521 C -7.41 -6.521 -8.35 -5.592 -8.35 -4.446 C -8.35 -4.446 -8.35 4.446 -8.35 4.446 C -8.35 5.592 -7.41 6.521 -6.25 6.521 C -6.25 6.521 1.25 6.521 1.25 6.521 C 1.747 6.521 2.15 6.919 2.15 7.41 C 2.15 7.901 1.747 8.3 1.25 8.3 C 1.25 8.3 -6.25 8.3 -6.25 8.3 C -8.404 8.3 -10.15 6.574 -10.15 4.446 C -10.15 4.446 -10.15 -4.446 -10.15 -4.446 C -10.15 -6.574 -8.404 -8.3 -6.25 -8.3 C -6.25 -8.3 -2.619 -8.3 -2.619 -8.3 Z M 3.75 -2.5 C 4.247 -2.5 4.65 -2.097 4.65 -1.6 C 4.65 -1.103 4.247 -0.699 3.75 -0.699 C 3.75 -0.699 -4.25 -0.699 -4.25 -0.699 C -4.747 -0.699 -5.15 -1.103 -5.15 -1.6 C -5.15 -2.097 -4.747 -2.5 -4.25 -2.5 C -4.25 -2.5 3.75 -2.5 3.75 -2.5 Z",transform:"matrix(1 0 0 1 11.75 12)",fill:"currentColor"},null,-1),C("g",{id:"af-p1"},[C("path",{d:"M 2.635 0 L -2.635 0 M 0 -2.635 L 0 2.635",transform:"matrix(1 0 0 1 18.4 16.3)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"})],-1)])])}const T4e=kt({name:"kimi-folder-plus",render:M4e}),E4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I4e(e,t){return y(),M("svg",E4e,[...t[0]||(t[0]=[C("path",{d:"M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3ZM12 19.2002C15.9764 19.2002 19.2002 15.9764 19.2002 12C19.2002 8.02355 15.9764 4.7998 12 4.7998V19.2002Z",fill:"currentColor"},null,-1)])])}const L4e=kt({name:"kimi-follow-system",render:I4e}),$4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N4e(e,t){return y(),M("svg",$4e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7ZM12 15.6992C12.4968 15.6992 12.8994 16.1028 12.8994 16.5996C12.8994 17.0964 12.4968 17.5 12 17.5C11.5024 17.5 11.0996 17.0964 11.0996 16.5996C11.0996 16.1028 11.5024 15.6992 12 15.6992ZM12 6.49902C12.4969 6.49922 12.8994 6.86908 12.8994 7.3252V13.6729C12.8994 14.129 12.4969 14.4988 12 14.499C11.5029 14.499 11.0996 14.1291 11.0996 13.6729V7.3252C11.0996 6.86896 11.5029 6.49902 12 6.49902Z",fill:"currentColor"},null,-1)])])}const F4e=kt({name:"kimi-full-access",render:N4e}),R4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O4e(e,t){return y(),M("svg",R4e,[...t[0]||(t[0]=[C("path",{d:"M12.5092 2.11279C17.7402 2.37781 21.8998 6.70364 21.8998 12.0005C21.8996 17.4153 17.5524 21.8108 12.1576 21.895C12.1056 21.898 12.0532 21.8999 12.0004 21.8999C11.948 21.8999 11.8954 21.8968 11.8432 21.896L11.8422 21.895C6.44751 21.8107 2.10022 17.4152 2.10001 12.0005C2.10001 6.53287 6.53278 2.1001 12.0004 2.1001L12.5092 2.11279ZM8.92715 13.0005C9.02896 14.9787 9.42581 16.721 9.99356 17.9985C10.3249 18.7441 10.6971 19.292 11.0639 19.6411C11.4259 19.9855 11.741 20.1001 12.0004 20.1001C12.2598 20.1 12.5749 19.9856 12.9369 19.6411C13.3037 19.292 13.6749 18.7441 14.0063 17.9985C14.574 16.721 14.9718 14.9788 15.0736 13.0005H8.92715ZM3.96329 13.0005C4.31462 15.8522 6.14714 18.2427 8.66837 19.3823C8.55544 19.1733 8.44916 18.9552 8.34903 18.73C7.66574 17.1926 7.22657 15.1926 7.12344 13.0005H3.96329ZM16.8764 13.0005C16.7732 15.1926 16.3341 17.1926 15.6508 18.73C15.5506 18.9554 15.4435 19.1732 15.3305 19.3823C17.8522 18.2429 19.6851 15.8525 20.0365 13.0005H16.8764ZM8.66934 4.6167C6.08869 5.78266 4.22826 8.25964 3.93985 11.1997H7.11661C7.20176 8.92954 7.64512 6.85497 8.34903 5.271C8.4494 5.04516 8.5561 4.82619 8.66934 4.6167ZM12.0004 3.8999C11.7411 3.8999 11.4259 4.01454 11.0639 4.35889C10.6971 4.70797 10.3249 5.25587 9.99356 6.00146C9.40671 7.32188 9.00186 9.13885 8.91739 11.1997H15.0834C14.9989 9.13884 14.5931 7.32189 14.0063 6.00146C13.6749 5.2559 13.3037 4.70796 12.9369 4.35889C12.5749 4.0144 12.2598 3.90002 12.0004 3.8999ZM15.3295 4.61572C15.443 4.82559 15.5502 5.04471 15.6508 5.271C16.3547 6.85498 16.799 8.92949 16.8842 11.1997H20.06C19.7715 8.25914 17.9108 5.78143 15.3295 4.61572Z",fill:"currentColor"},null,-1)])])}const P4e=kt({name:"kimi-globe",render:O4e}),D4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B4e(e,t){return y(),M("svg",D4e,[...t[0]||(t[0]=[C("path",{d:"M8 17C8.82834 17 9.5 17.6717 9.5 18.5C9.5 19.3283 8.82834 20 8 20C7.17166 20 6.5 19.3283 6.5 18.5C6.5 17.6717 7.17166 17 8 17ZM16 17C16.8283 17 17.5 17.6717 17.5 18.5C17.5 19.3283 16.8283 20 16 20C15.1717 20 14.5 19.3283 14.5 18.5C14.5 17.6717 15.1717 17 16 17ZM8 10.5C8.82834 10.5 9.5 11.1717 9.5 12C9.5 12.8283 8.82834 13.5 8 13.5C7.17166 13.5 6.5 12.8283 6.5 12C6.5 11.1717 7.17166 10.5 8 10.5ZM16 10.5C16.8283 10.5 17.5 11.1717 17.5 12C17.5 12.8283 16.8283 13.5 16 13.5C15.1717 13.5 14.5 12.8283 14.5 12C14.5 11.1717 15.1717 10.5 16 10.5ZM8 4C8.82834 4 9.5 4.67166 9.5 5.5C9.5 6.32834 8.82834 7 8 7C7.17166 7 6.5 6.32834 6.5 5.5C6.5 4.67166 7.17166 4 8 4ZM16 4C16.8283 4 17.5 4.67166 17.5 5.5C17.5 6.32834 16.8283 7 16 7C15.1717 7 14.5 6.32834 14.5 5.5C14.5 4.67166 15.1717 4 16 4Z",fill:"currentColor"},null,-1)])])}const H4e=kt({name:"kimi-grip",render:B4e}),z4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W4e(e,t){return y(),M("svg",z4e,[...t[0]||(t[0]=[C("path",{d:"M7.22264 6.10352C7.22264 5.5078 7.48259 4.95449 7.91405 4.56055C8.34271 4.16918 8.90831 3.96198 9.48241 3.96191C9.64155 3.96191 9.80001 3.97936 9.95507 4.01074C10.0127 3.5042 10.2586 3.04178 10.6338 2.69922C11.0625 2.30778 11.6279 2.09961 12.2021 2.09961C12.7763 2.09966 13.3418 2.30783 13.7705 2.69922C13.9947 2.90401 14.1709 3.15244 14.29 3.42676C14.4947 3.37044 14.7071 3.34182 14.9209 3.3418C15.4951 3.3418 16.0605 3.549 16.4892 3.94043C16.8644 4.28293 17.1093 4.74548 17.167 5.25195C17.3223 5.22045 17.4812 5.20312 17.6406 5.20312C18.2147 5.20318 18.7803 5.41135 19.209 5.80273C19.6402 6.19663 19.9004 6.74922 19.9004 7.34473V14.6543C19.9004 17.413 19.2914 19.0434 18.0137 20.21C16.82 21.2998 15.2175 21.9004 13.5615 21.9004C11.7538 21.9004 10.2315 21.5696 8.95702 20.8535C7.67664 20.1341 6.71683 19.0652 5.97362 17.708L3.3496 12.916C3.18848 12.6213 3.10112 12.2914 3.0996 11.9531C3.09812 11.6147 3.18309 11.2835 3.34179 10.9873C3.5001 10.692 3.72639 10.4416 3.99706 10.251C4.26771 10.0604 4.57776 9.93235 4.90136 9.87305C5.56617 9.75102 6.25934 9.84517 6.86425 10.1445C6.9942 10.2088 7.11461 10.2788 7.22264 10.3477V6.10352ZM9.02343 12.7969C9.02336 13.1912 8.76624 13.5395 8.38964 13.6562C8.0129 13.773 7.60387 13.6309 7.38085 13.3057L6.53514 12.0723C6.51218 12.0529 6.48411 12.0282 6.45018 12.002C6.34595 11.9213 6.20986 11.8289 6.06639 11.7578C5.81525 11.6335 5.51637 11.5904 5.22655 11.6436H5.22557C5.15055 11.6573 5.08558 11.6865 5.03417 11.7227C4.98289 11.7588 4.94815 11.7998 4.92772 11.8379C4.90762 11.8755 4.90023 11.9122 4.90038 11.9453C4.90057 11.9782 4.9084 12.0144 4.9287 12.0518L7.55272 16.8438C8.16912 17.9693 8.90989 18.7622 9.83886 19.2842C10.7737 19.8094 11.9704 20.0996 13.5615 20.0996C14.7902 20.0996 15.9536 19.6533 16.7998 18.8809C17.5619 18.185 18.0996 17.1383 18.0996 14.6543V7.34473C18.0996 7.28204 18.0734 7.20342 17.9951 7.13184C17.9139 7.05771 17.7875 7.00396 17.6406 7.00391C17.4937 7.00391 17.3674 7.05771 17.2861 7.13184C17.2077 7.20347 17.1807 7.28199 17.1807 7.34473V11.0693C17.1805 11.5661 16.778 11.9685 16.2812 11.9688C15.7843 11.9688 15.381 11.5662 15.3808 11.0693V5.48242C15.3808 5.41973 15.3537 5.34107 15.2754 5.26953C15.1941 5.19547 15.0677 5.1416 14.9209 5.1416C14.774 5.14166 14.6476 5.19541 14.5664 5.26953C14.4881 5.34105 14.462 5.41974 14.4619 5.48242V11.0693C14.4617 11.5662 14.0584 11.9688 13.5615 11.9688C13.0646 11.9687 12.6613 11.5662 12.6611 11.0693V4.24121C12.6611 4.17852 12.635 4.09989 12.5566 4.02832C12.4754 3.95419 12.349 3.90045 12.2021 3.90039C12.0552 3.90039 11.9289 3.95421 11.8476 4.02832C11.7692 4.09992 11.7422 4.17849 11.7422 4.24121V11.0693C11.742 11.5661 11.3395 11.9685 10.8428 11.9688C10.3458 11.9688 9.94257 11.5662 9.94237 11.0693V6.10352L9.93651 6.05371C9.92534 6.00177 9.89573 5.94433 9.8369 5.89062C9.75567 5.81647 9.62938 5.76172 9.48241 5.76172C9.33554 5.76179 9.2091 5.81651 9.12792 5.89062C9.04964 5.96222 9.02343 6.04084 9.02343 6.10352V12.7969Z",fill:"currentColor"},null,-1)])])}const U4e=kt({name:"kimi-hand",render:W4e}),j4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V4e(e,t){return y(),M("svg",j4e,[...t[0]||(t[0]=[C("path",{d:"M4 3.33203C4.55224 3.33203 4.99993 3.7798 5 4.33203V18.0908H20.0674C20.6195 18.0908 21.0671 18.5388 21.0674 19.0908C21.0674 19.6431 20.6197 20.0908 20.0674 20.0908H5C3.89543 20.0908 3 19.1954 3 18.0908V4.33203C3.00007 3.7798 3.44776 3.33203 4 3.33203ZM8.19922 9.28418C8.7515 9.28418 9.19922 9.73189 9.19922 10.2842V15.6045C9.19908 16.1567 8.75142 16.6045 8.19922 16.6045C7.64719 16.6043 7.19936 16.1565 7.19922 15.6045V10.2842C7.19922 9.73202 7.6471 9.28438 8.19922 9.28418ZM17.2227 6.85645C17.7748 6.85658 18.2226 7.3043 18.2227 7.85645V15.6045C18.2225 16.1566 17.7747 16.6044 17.2227 16.6045C16.6705 16.6045 16.2228 16.1566 16.2227 15.6045V7.85645C16.2227 7.30422 16.6704 6.85645 17.2227 6.85645ZM12.7109 3.96387C13.2631 3.96387 13.7107 4.41175 13.7109 4.96387V15.6035C13.7109 16.1558 13.2632 16.6035 12.7109 16.6035C12.1587 16.6035 11.7109 16.1558 11.7109 15.6035V4.96387C11.7111 4.41175 12.1588 3.96387 12.7109 3.96387Z",fill:"currentColor"},null,-1)])])}const q4e=kt({name:"kimi-histogram",render:V4e}),K4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z4e(e,t){return y(),M("svg",K4e,[...t[0]||(t[0]=[C("path",{d:"M8.00916 7.50488C8.47326 7.50488 8.91828 7.68943 9.24646 8.01758C9.57465 8.34577 9.75916 8.79075 9.75916 9.25488C9.75916 9.71901 9.57465 10.164 9.24646 10.4922C8.91828 10.8203 8.47326 11.0049 8.00916 11.0049C7.54507 11.0049 7.10001 10.8203 6.77185 10.4922C6.4437 10.164 6.25916 9.71898 6.25916 9.25488C6.25916 8.79078 6.4437 8.34576 6.77185 8.01758C7.10001 7.68942 7.54507 7.50492 8.00916 7.50488Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17.8998 4.09961C20.0537 4.09961 21.8002 5.84609 21.8002 8V16C21.8002 18.1539 20.0537 19.9004 17.8998 19.9004H5.89978C3.74598 19.9003 1.99939 18.1538 1.99939 16V8C1.99939 5.84617 3.74598 4.09974 5.89978 4.09961H17.8998ZM15.4867 12.2539C15.448 12.2184 15.3885 12.2192 15.351 12.2559L11.7338 15.8027C11.0146 16.5079 9.87305 16.5222 9.13708 15.835L6.98669 13.8262C6.95049 13.7924 6.89516 13.791 6.85681 13.8223L3.82361 16.2988C3.96873 17.3168 4.84165 18.0995 5.89978 18.0996H17.8998C18.9375 18.0996 19.7964 17.3466 19.9662 16.3574L15.4867 12.2539ZM5.89978 5.90039C4.74009 5.90052 3.80017 6.84028 3.80017 8V14.002L5.73181 12.4238C6.46046 11.8286 7.51253 11.8634 8.20056 12.5059L10.351 14.5146C10.3897 14.5508 10.4498 14.5497 10.4877 14.5127L14.1049 10.9658C14.819 10.2656 15.9506 10.2466 16.6879 10.9219L19.9994 13.9551V8C19.9994 6.8402 19.0596 5.90039 17.8998 5.90039H5.89978Z",fill:"currentColor"},null,-1)])])}const G4e=kt({name:"kimi-image",render:Z4e}),Y4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X4e(e,t){return y(),M("svg",Y4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.09375 2.81174C5.4825 2.50796 6.04376 2.56488 6.34766 2.93869L20.1855 19.9602C20.4895 20.3341 20.421 20.8836 20.0322 21.1877C19.6435 21.4917 19.0823 21.4355 18.7783 21.0617L17.9971 20.1008H5.99609C3.84224 20.1008 2.0958 18.3552 2.0957 16.2014V8.13889C2.09589 6.26755 3.41429 4.70428 5.17285 4.32639L4.93945 4.03928C4.63577 3.66536 4.7051 3.11573 5.09375 2.81174ZM7.13184 14.1096C7.09416 14.0738 7.03659 14.0713 6.99609 14.1037L3.92871 16.5569C4.09761 17.5472 4.95753 18.301 5.99609 18.301H16.5342L13.373 14.4133L11.9072 15.9455C11.1531 16.7324 9.92202 16.7621 9.13281 16.0119L7.13184 14.1096ZM5.99609 6.03928C4.83643 6.03928 3.89669 6.97927 3.89648 8.13889V14.1408L5.83496 12.5901C6.60469 11.9742 7.69929 12.022 8.41504 12.7024L10.416 14.6037C10.4575 14.6431 10.5218 14.642 10.5615 14.6008L12.1641 12.926L9.78906 10.0051C9.70282 10.2646 9.55682 10.5038 9.35645 10.7004C9.02202 11.0285 8.56767 11.2131 8.09473 11.2131C7.62195 11.213 7.1683 11.0284 6.83398 10.7004C6.49961 10.3724 6.31152 9.92701 6.31152 9.46311C6.3116 8.99941 6.49981 8.55474 6.83398 8.22678C7.12986 7.93654 7.51931 7.75901 7.93262 7.7219L6.56543 6.03928H5.99609Z",fill:"currentColor"},null,-1),C("path",{d:"M18.0049 4.31272C20.1587 4.31288 21.9043 6.0593 21.9043 8.21311V13.718C21.9039 15.4743 19.7248 16.2906 18.5713 14.966L14.9141 10.7658C14.5882 10.3912 14.6278 9.82271 15.002 9.49631C15.3768 9.16994 15.9451 9.20948 16.2715 9.5842L19.9287 13.7844C19.9528 13.812 19.9696 13.8167 19.9775 13.8186C19.9908 13.8216 20.0141 13.8213 20.04 13.8117C20.0655 13.8021 20.0826 13.7875 20.0908 13.7766C20.0955 13.7702 20.1044 13.7552 20.1045 13.718V8.21311C20.1045 7.05341 19.1645 6.11366 18.0049 6.1135H10.6328C10.1361 6.11327 9.73267 5.70981 9.73242 5.21311C9.73242 4.71619 10.136 4.31295 10.6328 4.31272H18.0049Z",fill:"currentColor"},null,-1)])])}const J4e=kt({name:"kimi-image-failed",render:X4e}),Q4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e3e(e,t){return y(),M("svg",Q4e,[...t[0]||(t[0]=[C("path",{d:"M12 2.1001C17.4676 2.10031 21.8994 6.53286 21.8994 12.0005C21.8992 17.4679 17.4674 21.8997 12 21.8999C6.53237 21.8999 2.09982 17.4681 2.09961 12.0005C2.09961 6.53273 6.53224 2.1001 12 2.1001ZM12 3.8999C7.52636 3.8999 3.89941 7.52684 3.89941 12.0005C3.89963 16.474 7.52649 20.1001 12 20.1001C16.4733 20.0999 20.0994 16.4738 20.0996 12.0005C20.0996 7.52697 16.4735 3.90011 12 3.8999ZM12 9.50049C12.4969 9.50068 12.8994 9.87055 12.8994 10.3267V16.6743C12.8992 17.1303 12.4968 17.5003 12 17.5005C11.503 17.5005 11.0998 17.1304 11.0996 16.6743V10.3267C11.0996 9.87043 11.5029 9.50049 12 9.50049ZM12 6.49951C12.4968 6.49951 12.8994 6.90313 12.8994 7.3999C12.8992 7.8965 12.4966 8.30029 12 8.30029C11.5025 8.30028 11.0998 7.8965 11.0996 7.3999C11.0996 6.90313 11.5024 6.49952 12 6.49951Z",fill:"currentColor"},null,-1)])])}const t3e=kt({name:"kimi-info",render:e3e}),n3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o3e(e,t){return y(),M("svg",n3e,[...t[0]||(t[0]=[iu('',10)])])}const s3e=kt({name:"kimi-keyboard",render:o3e}),i3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function r3e(e,t){return y(),M("svg",i3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const l3e=kt({name:"kimi-left-panel",render:r3e}),a3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function u3e(e,t){return y(),M("svg",a3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow-expand",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const c3e=kt({name:"kimi-left-panel-expand",render:u3e}),d3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f3e(e,t){return y(),M("svg",d3e,[...t[0]||(t[0]=[iu('',1)])])}const p3e=kt({name:"kimi-light-mode",render:f3e}),h3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m3e(e,t){return y(),M("svg",h3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.97427 8.06961C4.99348 7.33581 6.18946 7.1 7.00001 7.1H9.00001C9.49706 7.1 9.90001 7.50294 9.90001 8C9.90001 8.49706 9.49706 8.9 9.00001 8.9H7.00001C6.47755 8.9 5.67353 9.06419 5.02599 9.53039C4.42434 9.96356 3.90001 10.6934 3.90001 12C3.90001 13.3066 4.42434 14.0364 5.02599 14.4696C5.67353 14.9358 6.47755 15.1 7.00001 15.1H9.00001C9.49706 15.1 9.90001 15.5029 9.90001 16C9.90001 16.4971 9.49706 16.9 9.00001 16.9H7.00001C6.18946 16.9 4.99348 16.6642 3.97427 15.9304C2.90917 15.1636 2.10001 13.8934 2.10001 12C2.10001 10.1066 2.90917 8.83644 3.97427 8.06961ZM14.1 8C14.1 7.50294 14.5029 7.1 15 7.1H17C17.8105 7.1 19.0065 7.33581 20.0257 8.06961C21.0908 8.83644 21.9 10.1066 21.9 12C21.9 13.8934 21.0908 15.1636 20.0257 15.9304C19.0065 16.6642 17.8105 16.9 17 16.9H15C14.5029 16.9 14.1 16.4971 14.1 16C14.1 15.5029 14.5029 15.1 15 15.1H17C17.5225 15.1 18.3265 14.9358 18.974 14.4696C19.5757 14.0364 20.1 13.3066 20.1 12C20.1 10.6934 19.5757 9.96356 18.974 9.53039C18.3265 9.06419 17.5225 8.9 17 8.9H15C14.5029 8.9 14.1 8.49706 14.1 8ZM7.10001 12C7.10001 11.5029 7.50295 11.1 8.00001 11.1H16C16.4971 11.1 16.9 11.5029 16.9 12C16.9 12.4971 16.4971 12.9 16 12.9H8.00001C7.50295 12.9 7.10001 12.4971 7.10001 12Z",fill:"currentColor"},null,-1)])])}const g3e=kt({name:"kimi-link",render:m3e}),v3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y3e(e,t){return y(),M("svg",v3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.10001 5.99998C4.10001 5.50292 4.50295 5.09998 5.00001 5.09998H19C19.4971 5.09998 19.9 5.50292 19.9 5.99998C19.9 6.49703 19.4971 6.89998 19 6.89998H5.00001C4.50295 6.89998 4.10001 6.49703 4.10001 5.99998ZM4.10001 12C4.10001 11.5029 4.50295 11.1 5.00001 11.1H19C19.4971 11.1 19.9 11.5029 19.9 12C19.9 12.497 19.4971 12.9 19 12.9H5.00001C4.50295 12.9 4.10001 12.497 4.10001 12ZM4.10001 18C4.10001 17.5029 4.50295 17.1 5.00001 17.1H19C19.4971 17.1 19.9 17.5029 19.9 18C19.9 18.497 19.4971 18.9 19 18.9H5.00001C4.50295 18.9 4.10001 18.497 4.10001 18Z",fill:"currentColor"},null,-1)])])}const k3e=kt({name:"kimi-list",render:y3e}),b3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C3e(e,t){return y(),M("svg",b3e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 4.09961C20.1539 4.09961 21.9004 5.84609 21.9004 8V16C21.9004 18.1539 20.1539 19.9004 18 19.9004H6C3.84609 19.9004 2.09961 18.1539 2.09961 16V8C2.09961 5.84609 3.84609 4.09961 6 4.09961H18ZM3.90039 16C3.90039 17.1598 4.8402 18.0996 6 18.0996H18C19.1598 18.0996 20.0996 17.1598 20.0996 16V9.49805L13.5361 13.5361C12.5955 14.1147 11.4075 14.1084 10.4727 13.5205L3.90039 9.38672V16ZM6 5.90039C5.0746 5.90039 4.29039 6.49909 4.01074 7.33008L11.4316 11.9971C11.7861 12.2199 12.2361 12.2222 12.5928 12.0029L20.0195 7.43457C19.7725 6.54993 18.9636 5.90039 18 5.90039H6Z",fill:"currentColor"})],-1)])])}const w3e=kt({name:"kimi-mail",render:C3e}),_3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x3e(e,t){return y(),M("svg",_3e,[...t[0]||(t[0]=[C("path",{d:"M17 11.0996C17.4971 11.0996 17.9004 11.5029 17.9004 12C17.9004 12.4971 17.4971 12.9004 17 12.9004H7C6.50294 12.9004 6.09961 12.4971 6.09961 12C6.09961 11.5029 6.50294 11.0996 7 11.0996H17Z",fill:"currentColor"},null,-1)])])}const S3e=kt({name:"kimi-minus",render:x3e}),A3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M3e(e,t){return y(),M("svg",A3e,[...t[0]||(t[0]=[C("path",{d:"M15.182 3.32802C15.9304 2.72235 17.0309 2.76978 17.724 3.46767L18.5424 4.29189L18.6722 4.43642C19.2377 5.13495 19.234 6.1404 18.6635 6.83486L18.5326 6.97841L18.0248 7.48232C17.9549 7.55172 17.8793 7.61254 17.8021 7.66884C17.9794 8.18027 17.9316 8.7498 17.6595 9.22841C17.6847 9.24522 17.7091 9.2635 17.7328 9.2831L17.8002 9.3456L17.9847 9.53798C19.8515 11.5442 20.4549 14.0022 19.6224 16.2196C19.1921 17.3657 18.4025 18.3827 17.2992 19.203H19.0873L19.1801 19.2079C19.6337 19.2542 19.9877 19.6375 19.9877 20.1034C19.9876 20.5692 19.6337 20.9527 19.1801 20.9989L19.0873 21.0028H13.0385C13.0244 21.0033 13.0104 21.0031 12.9965 21.0028H4.9115C4.41448 21.0028 4.01117 20.6004 4.01111 20.1034C4.01111 19.6064 4.41444 19.203 4.9115 19.203H12.9047C15.7614 18.5471 17.3679 17.1023 17.9369 15.5868C18.4678 14.1726 18.179 12.4782 16.807 10.9188L16.5189 10.6093L16.4574 10.5399C16.4549 10.5368 16.453 10.5333 16.4506 10.5302L12.3011 14.6522C11.6031 15.3454 10.5023 15.3845 9.75818 14.7733L9.61365 14.6425L7.31091 12.3231C6.5717 11.5786 6.57617 10.376 7.32068 9.63662L12.3676 4.62392L12.5121 4.49404C13.0358 4.06988 13.7318 3.96755 14.3402 4.18251C14.3969 4.10597 14.4591 4.03197 14.5287 3.96279L15.0365 3.45791L15.182 3.32802ZM4.83044 12.9335C5.16112 12.6052 5.68305 12.5863 6.03552 12.8759L6.10291 12.9384L9.07361 15.9286L9.13513 15.997C9.42218 16.3514 9.3992 16.8727 9.06873 17.2011C8.7381 17.5294 8.21712 17.5482 7.86462 17.2587L7.79626 17.1972L4.82654 14.2069L4.76501 14.1376C4.47792 13.7831 4.49979 13.2619 4.83044 12.9335ZM13.6693 5.87978L13.6361 5.90126L8.58826 10.914C8.54935 10.9529 8.54943 11.0165 8.58826 11.0556L10.891 13.3739L10.9242 13.3964C10.9602 13.4111 11.0032 13.404 11.0326 13.3749L16.0795 8.3622L16.1019 8.329C16.1117 8.3049 16.1117 8.2779 16.1019 8.2538L16.0804 8.2206L13.7777 5.90224C13.7486 5.87289 13.7054 5.86535 13.6693 5.87978ZM16.3383 4.71376L16.3051 4.73525L15.7972 5.24013C15.7584 5.27904 15.7585 5.34166 15.7972 5.38076L16.6146 6.20498L16.6478 6.22744C16.6838 6.24221 16.7268 6.23487 16.7562 6.20595L17.264 5.70107L17.2865 5.66787C17.2962 5.64382 17.2963 5.61672 17.2865 5.59267L17.265 5.55947L16.4467 4.73623C16.4174 4.70681 16.3744 4.6992 16.3383 4.71376Z",fill:"currentColor"},null,-1)])])}const T3e=kt({name:"kimi-microscope",render:M3e}),E3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I3e(e,t){return y(),M("svg",E3e,[...t[0]||(t[0]=[C("path",{d:"M6 12C6 12.8283 5.32834 13.5 4.5 13.5C3.67166 13.5 3 12.8283 3 12C3 11.1717 3.67166 10.5 4.5 10.5C5.32834 10.5 6 11.1717 6 12Z",fill:"currentColor"},null,-1),C("path",{d:"M13.5 12C13.5 12.8283 12.8283 13.5 12 13.5C11.1717 13.5 10.5 12.8283 10.5 12C10.5 11.1717 11.1717 10.5 12 10.5C12.8283 10.5 13.5 11.1717 13.5 12Z",fill:"currentColor"},null,-1),C("path",{d:"M19.5002 13.5C20.3287 13.5 21 12.8287 21 12.0002C21 11.1718 20.3287 10.5 19.5002 10.5C18.6718 10.5 18 11.1718 18 12.0002C18 12.8287 18.6718 13.5 19.5002 13.5Z",fill:"currentColor"},null,-1)])])}const L3e=kt({name:"kimi-more",render:I3e}),$3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N3e(e,t){return y(),M("svg",$3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 12.0993C8.49691 12.0993 8.90016 12.5028 8.90039 12.9997V17.9997C8.90039 19.6013 7.60163 20.9001 6 20.9001C4.39837 20.9001 3.09961 19.6013 3.09961 17.9997C3.09984 16.3982 4.39852 15.0993 6 15.0993C6.38939 15.0993 6.76033 15.1778 7.09961 15.317V12.9997C7.09984 12.5028 7.50309 12.0993 8 12.0993ZM6 16.9001C5.39263 16.9001 4.90062 17.3923 4.90039 17.9997C4.90039 18.6072 5.39249 19.0993 6 19.0993C6.60751 19.0993 7.09961 18.6072 7.09961 17.9997C7.09938 17.3923 6.60737 16.9001 6 16.9001Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.627 3.35611C19.8025 3.12106 20.9001 4.02068 20.9004 5.21939V15.9997C20.9004 17.6013 19.6016 18.9001 18 18.9001C16.3984 18.9001 15.0996 17.6013 15.0996 15.9997C15.0998 14.3982 16.3985 13.0993 18 13.0993C18.3894 13.0993 18.7603 13.1778 19.0996 13.317V9.21939C19.0993 9.15657 19.0421 9.10946 18.9805 9.12173L12.6768 10.3825C12.1894 10.4799 11.7148 10.1637 11.6172 9.67642C11.52 9.18922 11.8361 8.71439 12.3232 8.61685L18.627 7.35611C18.7868 7.32415 18.9452 7.31502 19.0996 7.32291V5.21939C19.0993 5.15657 19.0421 5.10946 18.9805 5.12173L12.6768 6.38248C12.1894 6.47994 11.7148 6.16372 11.6172 5.67642C11.52 5.18922 11.8361 4.71439 12.3232 4.61685L18.627 3.35611ZM18 14.9001C17.3926 14.9001 16.9006 15.3923 16.9004 15.9997C16.9004 16.6072 17.3925 17.0993 18 17.0993C18.6075 17.0993 19.0996 16.6072 19.0996 15.9997C19.0994 15.3923 18.6074 14.9001 18 14.9001Z",fill:"currentColor"},null,-1),C("path",{d:"M7.32422 5.38931C7.61669 4.87032 8.38346 4.87015 8.67578 5.38931L8.73047 5.50845L8.89551 5.95376L8.97949 6.1481C9.19937 6.58817 9.57968 6.93145 10.0459 7.10415L10.4912 7.26919C11.127 7.50461 11.1666 8.36217 10.6104 8.67544L10.4912 8.73013L10.0459 8.89517C9.5799 9.06783 9.19939 9.41141 8.97949 9.85123L8.89551 10.0456L8.73047 10.4909C8.49495 11.1267 7.63737 11.1665 7.32422 10.61L7.26953 10.4909L7.10449 10.0456C6.93172 9.57931 6.58767 9.19898 6.14746 8.97916L5.9541 8.89517L5.50879 8.73013C4.83054 8.47903 4.83061 7.52037 5.50879 7.26919L5.9541 7.10415L6.14746 7.02017C6.58757 6.80032 6.93176 6.41995 7.10449 5.95376L7.26953 5.50845L7.32422 5.38931Z",fill:"currentColor"},null,-1)])])}const F3e=kt({name:"kimi-music",render:N3e}),R3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O3e(e,t){return y(),M("svg",R3e,[...t[0]||(t[0]=[C("path",{d:"M17.9551 6.32648C17.955 5.82951 17.5517 5.42706 17.0547 5.42706H15.4844C14.9875 5.42717 14.5851 5.82958 14.585 6.32648V17.6732C14.585 18.1701 14.9874 18.5734 15.4844 18.5735H17.0547C17.5518 18.5735 17.9551 18.1702 17.9551 17.6732V6.32648ZM19.7549 17.6732C19.7549 19.1643 18.5459 20.3734 17.0547 20.3734H15.4844C13.9933 20.3732 12.7842 19.1643 12.7842 17.6732V6.32648C12.7843 4.83546 13.9934 3.62639 15.4844 3.62628H17.0547C18.5458 3.62628 19.7548 4.8354 19.7549 6.32648V17.6732Z",fill:"currentColor"},null,-1),C("path",{d:"M9.41571 6.32648C9.41561 5.82951 9.01231 5.42706 8.51532 5.42706H6.94501C6.44811 5.42717 6.0457 5.82958 6.04559 6.32648V17.6732C6.04559 18.1701 6.44804 18.5734 6.94501 18.5735H8.51532C9.01238 18.5735 9.41571 18.1702 9.41571 17.6732V6.32648ZM11.2155 17.6732C11.2155 19.1643 10.0065 20.3734 8.51532 20.3734H6.94501C5.45393 20.3732 4.24481 19.1643 4.24481 17.6732V6.32648C4.24492 4.83546 5.45399 3.62639 6.94501 3.62628H8.51532C10.0064 3.62628 11.2154 4.8354 11.2155 6.32648V17.6732Z",fill:"currentColor"},null,-1)])])}const P3e=kt({name:"kimi-pause",render:O3e}),D3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B3e(e,t){return y(),M("svg",D3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.0176 4.89998C17.7305 4.89998 17.4552 5.014 17.2522 5.217L6.35429 16.1149C5.957 16.5122 5.67517 17.01 5.53889 17.5551L5.23691 18.763L6.44486 18.4611C6.98994 18.3248 7.48773 18.0429 7.88502 17.6456L18.783 6.74773C18.8834 6.64728 18.9631 6.52797 19.0176 6.39658C19.072 6.26517 19.1 6.12441 19.1 5.98236C19.1 5.84031 19.072 5.69956 19.0176 5.56815C18.9631 5.43676 18.8834 5.31745 18.783 5.217C18.6825 5.11649 18.5631 5.03676 18.4318 4.98237C18.3005 4.92798 18.1597 4.89998 18.0176 4.89998ZM15.9794 3.94421C16.52 3.40366 17.2531 3.09998 18.0176 3.09998C18.3961 3.09998 18.7709 3.17452 19.1207 3.31938C19.4704 3.46424 19.7881 3.67656 20.0558 3.94421C20.3235 4.21192 20.5357 4.52969 20.6805 4.87932C20.8254 5.22895 20.9 5.60375 20.9 5.98236C20.9 6.36098 20.8254 6.73578 20.6805 7.08541C20.5357 7.43504 20.3235 7.75281 20.0558 8.02052L17.6385 10.4378L9.15781 18.9184C8.52984 19.5464 7.74301 19.9919 6.88142 20.2073L4.21828 20.8731C3.91158 20.9498 3.58714 20.8599 3.3636 20.6364C3.14006 20.4128 3.05019 20.0884 3.12686 19.7817L3.79264 17.1185C4.00803 16.257 4.45351 15.4701 5.0815 14.8421L15.9794 3.94421Z",fill:"currentColor"},null,-1)])])}const H3e=kt({name:"kimi-pencil",render:B3e}),z3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W3e(e,t){return y(),M("svg",z3e,[...t[0]||(t[0]=[C("path",{d:"M7.76251 3.10547C8.25776 3.10552 8.74422 3.23849 9.17072 3.49023L19.533 9.60742C20.8536 10.3869 21.2922 12.0901 20.5174 13.4121C20.2785 13.8195 19.9398 14.1604 19.533 14.4004L9.16974 20.5156C7.84721 21.2958 6.14595 20.8511 5.36993 19.5273C5.1196 19.1003 4.98719 18.6142 4.98712 18.1191V5.88672C4.98716 4.3537 6.2273 3.10547 7.76251 3.10547ZM6.7879 18.1191C6.78797 18.2945 6.8343 18.4664 6.92267 18.6172C7.19638 19.0841 7.79336 19.2377 8.25568 18.9648L18.618 12.8496C18.7607 12.7654 18.8803 12.6458 18.9647 12.502C19.2393 12.0334 19.082 11.4311 18.618 11.1572L8.25568 5.04102C8.1061 4.95273 7.93562 4.9063 7.76251 4.90625C7.22703 4.90625 6.78794 5.34218 6.7879 5.88672V18.1191Z",fill:"currentColor"},null,-1)])])}const U3e=kt({name:"kimi-play",render:W3e}),j3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V3e(e,t){return y(),M("svg",j3e,[...t[0]||(t[0]=[C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 3.7998C7.47126 3.7998 3.7998 7.47126 3.7998 12C3.7998 16.5287 7.47126 20.2002 12 20.2002C16.5287 20.2002 20.2002 16.5287 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998Z",fill:"currentColor"},null,-1)])])}const q3e=kt({name:"kimi-question",render:V3e}),K3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z3e(e,t){return y(),M("svg",K3e,[...t[0]||(t[0]=[C("path",{d:"M12 2C13.1046 2 14 2.89543 14 4C14 4.78019 13.552 5.45353 12.9004 5.7832V7H16.5C18.1569 7 19.5 8.34315 19.5 10V17C19.5 18.6051 18.2394 19.9158 16.6543 19.9961L16.5 20H7.5L7.3457 19.9961C5.81166 19.9184 4.58163 18.6883 4.50391 17.1543L4.5 17V10C4.5 8.34315 5.84315 7 7.5 7H11.0996V5.7832C10.448 5.45353 10 4.78019 10 4C10 2.89543 10.8954 2 12 2ZM7.5 8.7998C6.83726 8.7998 6.2998 9.33726 6.2998 10V17C6.2998 17.6627 6.83726 18.2002 7.5 18.2002H16.5C17.1627 18.2002 17.7002 17.6627 17.7002 17V10C17.7002 9.33726 17.1627 8.7998 16.5 8.7998H7.5ZM3 10.7666C3.49706 10.7666 3.90039 11.1699 3.90039 11.667V15C3.90039 15.4971 3.49706 15.9004 3 15.9004C2.50294 15.9004 2.09961 15.4971 2.09961 15V11.667C2.09961 11.1699 2.50294 10.7666 3 10.7666ZM21 10.7666C21.4971 10.7666 21.9004 11.1699 21.9004 11.667V15C21.9004 15.4971 21.4971 15.9004 21 15.9004C20.5029 15.9004 20.0996 15.4971 20.0996 15V11.667C20.0996 11.1699 20.5029 10.7666 21 10.7666ZM9.5 11.0996C9.99706 11.0996 10.4004 11.5029 10.4004 12V14.5C10.4004 14.9971 9.99706 15.4004 9.5 15.4004C9.00294 15.4004 8.59961 14.9971 8.59961 14.5V12C8.59961 11.5029 9.00294 11.0996 9.5 11.0996ZM14.5 11.0996C14.9971 11.0996 15.4004 11.5029 15.4004 12V14.5C15.4004 14.9971 14.9971 15.4004 14.5 15.4004C14.0029 15.4004 13.5996 14.9971 13.5996 14.5V12C13.5996 11.5029 14.0029 11.0996 14.5 11.0996ZM12 3.5C11.7239 3.5 11.5 3.72386 11.5 4C11.5 4.27614 11.7239 4.5 12 4.5C12.2761 4.5 12.5 4.27614 12.5 4C12.5 3.72386 12.2761 3.5 12 3.5Z",fill:"currentColor"},null,-1)])])}const G3e=kt({name:"kimi-robot",render:Z3e}),Y3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X3e(e,t){return y(),M("svg",Y3e,[...t[0]||(t[0]=[C("path",{d:"M11.5 3C16.1944 3 20 6.80558 20 11.5C20 13.523 19.2933 15.381 18.1132 16.8404L21.1364 19.8636C21.4879 20.2151 21.4879 20.7849 21.1364 21.1364C20.7849 21.4879 20.2151 21.4879 19.8636 21.1364L16.8404 18.1132C15.381 19.2933 13.523 20 11.5 20C6.80558 20 3 16.1944 3 11.5C3 6.80558 6.80558 3 11.5 3ZM11.5 18.2C15.2003 18.2 18.2 15.2003 18.2 11.5C18.2 7.79969 15.2003 4.8 11.5 4.8C7.79969 4.8 4.8 7.79969 4.8 11.5C4.8 15.2003 7.79969 18.2 11.5 18.2Z",fill:"currentColor"},null,-1)])])}const J3e=kt({name:"kimi-search",render:X3e}),Q3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e8e(e,t){return y(),M("svg",Q3e,[...t[0]||(t[0]=[C("path",{d:"M16.5364 10.1636C16.8879 10.5151 16.8879 11.0849 16.5364 11.4364C16.1849 11.7879 15.6151 11.7879 15.2636 11.4364L12.9 9.07281V17.1C12.9 17.597 12.4971 18 12 18C11.503 18 11.1 17.597 11.1 17.1V9.07281L8.73641 11.4364C8.38494 11.7879 7.81509 11.7879 7.46362 11.4364C7.11214 11.0849 7.11214 10.5151 7.46362 10.1636L11.3636 6.2636C11.7151 5.91211 12.2849 5.91211 12.6364 6.2636L16.5364 10.1636Z",fill:"currentColor"},null,-1)])])}const t8e=kt({name:"kimi-send",render:e8e}),n8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o8e(e,t){return y(),M("svg",n8e,[...t[0]||(t[0]=[C("path",{d:"M16.0404 12C16.0404 9.76874 14.2313 7.9596 12.0001 7.9596C9.76883 7.9596 7.95972 9.76874 7.95972 12C7.95972 14.2313 9.76883 16.0404 12.0001 16.0404C14.2313 16.0404 16.0404 14.2313 16.0404 12ZM14.2222 12C14.2222 13.2271 13.2271 14.2222 12 14.2222C10.7729 14.2222 9.77783 13.2271 9.77783 12C9.77783 10.7729 10.7729 9.77778 12 9.77778C13.2271 9.77778 14.2222 10.7729 14.2222 12Z",fill:"currentColor"},null,-1),C("path",{d:"M9.91145 21.8009C9.29001 21.6797 8.76914 21.2612 8.50632 20.6922L8.07372 19.7556C7.88838 19.3544 7.43553 19.1048 6.95371 19.1549L5.89572 19.2647C5.2733 19.3293 4.64823 19.114 4.22298 18.6611C3.74343 18.1504 3.32454 17.6037 2.97033 17.0181C2.61571 16.4318 2.32839 15.8106 2.10407 15.1566C1.89769 14.5549 2.02148 13.8954 2.4089 13.3902L3.0376 12.5704C3.30043 12.2277 3.30042 11.7722 3.03758 11.4295L2.40413 10.6035C2.01474 10.0958 1.891 9.43198 2.10208 8.82826C2.55037 7.54612 3.27017 6.35997 4.22 5.34259C4.64518 4.8872 5.27275 4.67067 5.89701 4.73544L6.95383 4.84514C7.43561 4.89515 7.88844 4.6456 8.07377 4.24441L8.50266 3.31593C8.76494 2.74818 9.28448 2.33019 9.90423 2.20761C11.2916 1.9332 12.7148 1.93127 14.0885 2.19913C14.7099 2.32029 15.2308 2.73881 15.4937 3.3078L15.9263 4.24441C16.1116 4.6456 16.5644 4.89514 17.0462 4.84514L18.1043 4.73532C18.7267 4.67072 19.3518 4.88603 19.777 5.33886C20.2566 5.84953 20.6755 6.3963 21.0297 6.98193C21.3843 7.56823 21.6716 8.18942 21.8959 8.84339C22.1023 9.44509 21.9785 10.1046 21.5911 10.6098L20.9624 11.4295C20.6996 11.7722 20.6996 12.2278 20.9624 12.5705L21.5959 13.3964C21.9853 13.9042 22.109 14.568 21.8979 15.1717C21.4497 16.4538 20.7299 17.6399 19.7801 18.6573C19.3549 19.1128 18.7273 19.3294 18.103 19.2646L17.0462 19.1549C16.5645 19.1049 16.1116 19.3544 15.9263 19.7556L15.4974 20.6841C15.2351 21.2518 14.7156 21.6698 14.0958 21.7924C12.7083 22.0668 11.2852 22.0687 9.91145 21.8009ZM13.7432 20.0088C13.7844 20.0006 13.8259 19.9673 13.847 19.9216L14.2758 18.9931C14.7915 17.8768 15.9886 17.2171 17.2341 17.3464L18.2909 17.4561C18.3649 17.4638 18.4272 17.4423 18.4512 17.4166C19.2296 16.5828 19.8171 15.6146 20.1817 14.5716C20.1845 14.5636 20.1796 14.5373 20.1532 14.5029L19.5198 13.677C18.7564 12.6815 18.7564 11.3185 19.5198 10.323L20.1485 9.5033C20.1746 9.46927 20.1795 9.4429 20.1762 9.43327C19.9932 8.89965 19.7603 8.39623 19.4741 7.92293C19.1873 7.4489 18.846 7.00333 18.4517 6.58351C18.4272 6.55739 18.3656 6.53616 18.2921 6.54378L17.234 6.65361C15.9886 6.78287 14.7915 6.12317 14.2758 5.00689L13.8432 4.07027C13.822 4.02448 13.7811 3.9916 13.7406 3.98371C12.5983 3.76097 11.4132 3.76258 10.2571 3.99124C10.2158 3.99941 10.1744 4.03271 10.1533 4.07842L9.72441 5.00689C9.20875 6.12317 8.01164 6.7829 6.76619 6.6536L5.70942 6.54391C5.63535 6.53623 5.573 6.55774 5.54905 6.5834C4.77067 7.41713 4.18312 8.38534 3.81845 9.42835C3.81564 9.43637 3.82054 9.46265 3.84693 9.49706L4.48038 10.323C5.24381 11.3185 5.24383 12.6815 4.48041 13.6769L3.85171 14.4967C3.82561 14.5307 3.82066 14.5571 3.82396 14.5667C4.00701 15.1004 4.23986 15.6038 4.52613 16.0771C4.81284 16.5511 5.15421 16.9967 5.54845 17.4165C5.57298 17.4426 5.63461 17.4638 5.70811 17.4562L6.76608 17.3464C8.01157 17.2171 9.20871 17.8768 9.72438 18.9932L10.157 19.9297C10.1781 19.9755 10.2191 20.0084 10.2595 20.0163C11.4018 20.239 12.587 20.2374 13.7432 20.0088Z",fill:"currentColor"},null,-1)])])}const s8e=kt({name:"kimi-setting",render:o8e}),i8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function r8e(e,t){return y(),M("svg",i8e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1)])])}const l8e=kt({name:"kimi-shield-question",render:r8e}),a8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function u8e(e,t){return y(),M("svg",a8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.90005 12C2.90005 11.503 3.303 11.1 3.80005 11.1H12.2939L9.38588 8.19197C9.03441 7.8405 9.03441 7.27065 9.38588 6.91918C9.73735 6.56771 10.3072 6.56771 10.6587 6.91918L15.1031 11.3636C15.2719 11.5324 15.3667 11.7613 15.3667 12C15.3667 12.2387 15.2719 12.4676 15.1031 12.6364L10.6587 17.0809C10.3072 17.4323 9.73735 17.4323 9.38588 17.0809C9.03441 16.7294 9.03441 16.1595 9.38588 15.8081L12.2939 12.9H3.80005C3.303 12.9 2.90005 12.4971 2.90005 12ZM13.5874 20C13.5874 19.503 13.9904 19.1 14.4874 19.1H18.043C18.2758 19.1 18.4991 19.0075 18.6637 18.8429C18.8283 18.6783 18.9208 18.455 18.9208 18.2222V5.7778C18.9208 5.545 18.8283 5.32174 18.6637 5.15712C18.499 4.9925 18.2758 4.90002 18.043 4.90002H14.4874C13.9904 4.90002 13.5874 4.49708 13.5874 4.00002C13.5874 3.50297 13.9904 3.10003 14.4874 3.10003H18.043C18.7532 3.10003 19.4343 3.38215 19.9365 3.88433C20.4386 4.38651 20.7208 5.06761 20.7208 5.7778V18.2222C20.7208 18.9324 20.4386 19.6135 19.9365 20.1157C19.4343 20.6179 18.7532 20.9 18.043 20.9H14.4874C13.9904 20.9 13.5874 20.4971 13.5874 20Z",fill:"currentColor"},null,-1)])])}const c8e=kt({name:"kimi-sign-in",render:u8e}),d8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f8e(e,t){return y(),M("svg",d8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20.6364 11.3636C20.9879 11.7151 20.9879 12.2849 20.6364 12.6364L16.1919 17.0808C15.8405 17.4323 15.2706 17.4323 14.9192 17.0808C14.5677 16.7293 14.5677 16.1595 14.9192 15.808L17.8272 12.9H9.33333C8.83627 12.9 8.43333 12.497 8.43333 12C8.43333 11.5029 8.83627 11.1 9.33333 11.1H17.8272L14.9192 8.19193C14.5677 7.84046 14.5677 7.27061 14.9192 6.91914C15.2706 6.56766 15.8405 6.56766 16.1919 6.91914L20.6364 11.3636ZM10.2333 3.99998C10.2333 4.49703 9.83038 4.89998 9.33333 4.89998H5.77777C5.54497 4.89998 5.3217 4.99246 5.15709 5.15707C4.99247 5.32169 4.89999 5.54495 4.89999 5.77775V18.2222C4.89999 18.455 4.99247 18.6783 5.15709 18.8429C5.32171 19.0075 5.54497 19.1 5.77777 19.1H9.33333C9.83038 19.1 10.2333 19.5029 10.2333 20C10.2333 20.497 9.83038 20.9 9.33333 20.9H5.77777C5.06758 20.9 4.38648 20.6179 3.8843 20.1157C3.38212 19.6135 3.09999 18.9324 3.09999 18.2222V5.77775C3.09999 5.06756 3.38212 4.38646 3.8843 3.88428C4.38648 3.3821 5.06758 3.09998 5.77777 3.09998H9.33333C9.83038 3.09998 10.2333 3.50292 10.2333 3.99998Z",fill:"currentColor"},null,-1)])])}const p8e=kt({name:"kimi-sign-out",render:f8e}),h8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m8e(e,t){return y(),M("svg",h8e,[...t[0]||(t[0]=[iu('',9)])])}const g8e=kt({name:"kimi-sliders",render:m8e}),v8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y8e(e,t){return y(),M("svg",v8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.78027 8.90405C7.5 9.45411 7.5 10.1742 7.5 11.6144V12.3856C7.5 13.8258 7.5 14.5459 7.78027 15.096C8.02681 15.5798 8.42019 15.9732 8.90405 16.2197C9.45411 16.5 10.1742 16.5 11.6144 16.5H12.3856C13.8258 16.5 14.5459 16.5 15.096 16.2197C15.5798 15.9732 15.9732 15.5798 16.2197 15.096C16.5 14.5459 16.5 13.8258 16.5 12.3856V11.6144C16.5 10.1742 16.5 9.45411 16.2197 8.90405C15.9732 8.42019 15.5798 8.02681 15.096 7.78027C14.5459 7.5 13.8258 7.5 12.3856 7.5H11.6144C10.1742 7.5 9.45411 7.5 8.90405 7.78027C8.42019 8.02681 8.02681 8.42019 7.78027 8.90405Z",fill:"currentColor"},null,-1)])])}const k8e=kt({name:"kimi-stop",render:y8e}),b8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C8e(e,t){return y(),M("svg",b8e,[...t[0]||(t[0]=[C("path",{d:"M7.01562 3.41459C7.4446 3.16449 7.9954 3.30924 8.24609 3.73784C8.49645 4.167 8.35189 4.71868 7.92285 4.96928C5.51497 6.37506 3.90054 8.98498 3.90039 11.9703C3.90076 16.4435 7.52672 20.0699 12 20.0699C16.4733 20.0699 20.0992 16.4435 20.0996 11.9703C20.0996 11.2291 20 10.5116 19.8145 9.83159C19.6838 9.35222 19.967 8.85702 20.4463 8.72612C20.9256 8.59541 21.4207 8.87778 21.5518 9.35698C21.7792 10.1901 21.9004 11.0674 21.9004 11.9703C21.9 17.4376 17.4674 21.8697 12 21.8697C6.53261 21.8697 2.09998 17.4376 2.09961 11.9703C2.09976 8.31904 4.07782 5.12972 7.01562 3.41459ZM8.39258 8.24077C8.75015 7.89591 9.3199 7.90591 9.66504 8.26323C10.01 8.62076 9.99985 9.19051 9.64258 9.53569C9.00203 10.1541 8.60558 11.02 8.60547 11.979C8.60584 13.8536 10.1253 15.3736 12 15.3736C13.8746 15.3735 15.3942 13.8536 15.3945 11.979C15.3945 11.6847 15.3577 11.3989 15.2881 11.1285C15.1646 10.6474 15.4536 10.1568 15.9346 10.0328C16.4158 9.9089 16.9071 10.1991 17.0312 10.6802C17.1383 11.096 17.1943 11.5321 17.1943 11.979C17.194 14.8477 14.8688 17.1733 12 17.1734C9.1312 17.1734 6.80506 14.8478 6.80469 11.979C6.8048 10.5117 7.41519 9.18431 8.39258 8.24077ZM11.5459 1.12651C11.8216 0.965605 12.1631 0.963306 12.4414 1.11967L19.1953 4.91752C19.4859 5.08108 19.662 5.39277 19.6533 5.72612C19.6443 6.05972 19.4515 6.36154 19.1523 6.50932L12.9004 9.5933V12.2583C12.9004 12.7554 12.4971 13.1587 12 13.1587C11.5029 13.1587 11.0996 12.7554 11.0996 12.2583V1.90385C11.0999 1.58444 11.2702 1.2878 11.5459 1.12651ZM12.9004 7.58549L16.8252 5.64897L12.9004 3.44194V7.58549Z",fill:"currentColor"},null,-1)])])}const w8e=kt({name:"kimi-target",render:C8e}),_8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x8e(e,t){return y(),M("svg",_8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.9893 6.60743C20.5897 6.60757 21.8877 7.8926 21.8877 9.47736C21.8877 10.7416 21.0607 11.8129 19.9141 12.1955V14.257C19.914 15.8428 18.6152 17.1288 17.0137 17.1289H12.8438V20.1381C12.8437 20.6301 12.4412 21.0293 11.9443 21.0296C11.4473 21.0296 11.044 20.6302 11.0439 20.1381V16.4356C11.0441 15.8343 11.5363 15.3461 12.1436 15.3458H17.0137C17.6211 15.3457 18.1133 14.8585 18.1133 14.257V12.2129C16.9408 11.8451 16.0909 10.7598 16.0908 9.47736C16.0908 7.89251 17.3887 6.60743 18.9893 6.60743ZM18.9893 8.38953C18.3828 8.38953 17.8906 8.87684 17.8906 9.47736C17.8907 10.0778 18.3828 10.5642 18.9893 10.5642C19.5956 10.5641 20.0869 10.0777 20.0869 9.47736C20.0869 8.87693 19.5956 8.38967 18.9893 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.89844 6.60743C6.49899 6.60747 7.79688 7.89254 7.79688 9.47736C7.79684 10.7388 6.97371 11.8078 5.83105 12.1926V14.4021C5.83105 15.0036 6.32315 15.4918 6.93066 15.4918H8.37109C8.86789 15.492 9.27038 15.8905 9.27051 16.3824C9.27051 16.8744 8.86797 17.2737 8.37109 17.2739H6.93066C5.32904 17.2739 4.03027 15.9879 4.03027 14.4021V12.2158C2.85382 11.8504 2.00004 10.7627 2 9.47736C2 7.89251 3.29784 6.60743 4.89844 6.60743ZM4.89844 8.38953C4.29196 8.38953 3.7998 8.87684 3.7998 9.47736C3.79985 10.0778 4.29198 10.5642 4.89844 10.5642C5.50485 10.5642 5.99605 10.0778 5.99609 9.47736C5.99609 8.87687 5.50488 8.38958 4.89844 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.9434 2.9707C13.5439 2.97075 14.8418 4.25581 14.8418 5.84063C14.8418 7.11413 14.0035 8.1923 12.8438 8.56745V13.0135C12.8436 13.5056 12.4403 13.9041 11.9434 13.9041C11.4466 13.9039 11.0431 13.5055 11.043 13.0135V8.56745C9.8836 8.19209 9.04496 7.11387 9.04492 5.84063C9.04492 4.25592 10.343 2.97093 11.9434 2.9707ZM11.9434 4.75281C11.3371 4.75303 10.8447 5.24026 10.8447 5.84063C10.8448 6.44097 11.3371 6.92726 11.9434 6.92749C12.5498 6.92745 13.041 6.44108 13.041 5.84063C13.041 5.24014 12.5498 4.75285 11.9434 4.75281Z",fill:"currentColor"},null,-1)])])}const S8e=kt({name:"kimi-task",render:x8e}),A8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M8e(e,t){return y(),M("svg",A8e,[...t[0]||(t[0]=[C("path",{d:"M16.5293 15.0596C16.9496 15.1021 17.2772 15.4572 17.2773 15.8887C17.2773 16.3202 16.9497 16.6753 16.5293 16.7178L16.4443 16.7217H12C11.5399 16.7216 11.167 16.3488 11.167 15.8887C11.1671 15.4286 11.54 15.0558 12 15.0557H16.4443L16.5293 15.0596Z",fill:"currentColor"},null,-1),C("path",{d:"M6.96582 7.52246C7.27077 7.21751 7.75375 7.1983 8.08105 7.46484L8.14453 7.52246L10.8232 10.2002C11.5102 10.8872 11.5102 12.0014 10.8232 12.6885L8.14453 15.3672L8.08105 15.4248C7.75377 15.6913 7.27075 15.6721 6.96582 15.3672C6.66114 15.0621 6.64234 14.5791 6.90918 14.252L6.96582 14.1885L9.64453 11.5098C9.68057 11.4736 9.68062 11.415 9.64453 11.3789L6.96582 8.7002C6.64116 8.37488 6.6411 7.84774 6.96582 7.52246Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 3.09961C19.1539 3.09966 20.9004 4.84612 20.9004 7V17C20.9004 19.1539 19.1539 20.9003 17 20.9004H7C4.84609 20.9004 3.09961 19.1539 3.09961 17V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H17ZM7 4.90039C5.8402 4.90039 4.90039 5.8402 4.90039 7V17C4.90039 18.1598 5.8402 19.0996 7 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V7C19.0996 5.84024 18.1598 4.90044 17 4.90039H7Z",fill:"currentColor"},null,-1)])])}const T8e=kt({name:"kimi-terminal",render:M8e}),E8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I8e(e,t){return y(),M("svg",E8e,[...t[0]||(t[0]=[C("path",{d:"M16.9971 3.90597C15.9799 2.99725 14.7342 2.38312 13.394 2.12966C12.0538 1.8762 10.6699 1.99301 9.39111 2.46751C8.11236 2.94202 6.98721 3.75626 6.13676 4.82261C5.2863 5.88896 4.74274 7.16703 4.56457 8.5193C4.40455 9.70501 4.53253 10.9118 4.93767 12.0376C5.34281 13.1634 6.01318 14.175 6.89207 14.9868C7.43557 15.4634 7.87413 16.0477 8.17997 16.7027C8.48581 17.3577 8.65224 18.0691 8.66873 18.7918V18.926C8.66962 19.7412 8.99387 20.5229 9.57035 21.0993C10.1468 21.6758 10.9285 22.0001 11.7437 22.001H12.2604C13.0757 22.0001 13.8573 21.6758 14.4338 21.0993C15.0103 20.5229 15.3345 19.7412 15.3354 18.926V18.4685C15.3479 17.8297 15.4982 17.2011 15.7761 16.6258C16.0539 16.0505 16.4528 15.542 16.9454 15.1351C17.7442 14.4355 18.3853 13.5741 18.826 12.608C19.2668 11.642 19.4973 10.5932 19.5022 9.53136C19.5071 8.46948 19.2863 7.41869 18.8544 6.4486C18.4225 5.4785 17.7894 4.61125 16.9971 3.9043V3.90597ZM12.2604 20.3343H11.7437C11.3704 20.3339 11.0124 20.1853 10.7484 19.9213C10.4844 19.6573 10.3358 19.2993 10.3354 18.926C10.3354 18.926 10.3296 18.7093 10.3287 18.6676H13.6687V18.926C13.6683 19.2993 13.5198 19.6573 13.2558 19.9213C12.9917 20.1853 12.6338 20.3339 12.2604 20.3343ZM15.8437 13.8835C14.8949 14.7064 14.2097 15.7908 13.8737 17.001H12.8354V11.0143C13.3212 10.8426 13.742 10.5249 14.0403 10.1049C14.3387 9.68482 14.4999 9.18285 14.5021 8.66763C14.5021 8.44662 14.4143 8.23466 14.258 8.07838C14.1017 7.9221 13.8897 7.8343 13.6687 7.8343C13.4477 7.8343 13.2358 7.9221 13.0795 8.07838C12.9232 8.23466 12.8354 8.44662 12.8354 8.66763C12.8354 8.88865 12.7476 9.10061 12.5913 9.25689C12.435 9.41317 12.2231 9.50097 12.0021 9.50097C11.7811 9.50097 11.5691 9.41317 11.4128 9.25689C11.2565 9.10061 11.1687 8.88865 11.1687 8.66763C11.1687 8.44662 11.0809 8.23466 10.9247 8.07838C10.7684 7.9221 10.5564 7.8343 10.3354 7.8343C10.1144 7.8343 9.90242 7.9221 9.74614 8.07838C9.58986 8.23466 9.50207 8.44662 9.50207 8.66763C9.5042 9.18285 9.66547 9.68482 9.96381 10.1049C10.2621 10.5249 10.683 10.8426 11.1687 11.0143V17.001H10.0671C9.69123 15.7586 8.98633 14.6411 8.02707 13.7668C7.21286 13.0081 6.63267 12.0324 6.35496 10.9547C6.07725 9.87703 6.1136 8.7424 6.45974 7.68471C6.80588 6.62702 7.44735 5.69042 8.30846 4.98543C9.16956 4.28045 10.2144 3.83649 11.3196 3.70597C11.5487 3.68039 11.779 3.66759 12.0096 3.66763C13.4409 3.66338 14.8226 4.19149 15.8862 5.1493C16.5026 5.69896 16.9952 6.37337 17.3312 7.12782C17.6672 7.88227 17.839 8.69952 17.8352 9.5254C17.8314 10.3513 17.6522 11.1669 17.3092 11.9183C16.9663 12.6696 16.4677 13.3395 15.8462 13.8835H15.8437Z",fill:"currentColor"},null,-1)])])}const L8e=kt({name:"kimi-thinking",render:I8e}),$8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N8e(e,t){return y(),M("svg",$8e,[...t[0]||(t[0]=[iu('',6)])])}const F8e=kt({name:"kimi-todo",render:N8e}),R8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O8e(e,t){return y(),M("svg",R8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.09752 2.19507C8.5421 1.97278 9.08271 2.15298 9.305 2.59756L10.0562 4.10005H13.5C13.9971 4.10005 14.4 4.50299 14.4 5.00005C14.4 5.49711 13.9971 5.90005 13.5 5.90005H12.3106C12.2556 6.2319 12.1667 6.64073 12.0226 7.0987C11.7254 8.04355 11.191 9.20402 10.2334 10.3239C11.4166 11.196 12.5606 11.7524 13.4512 12.0987C13.978 12.3036 14.4136 12.434 14.7124 12.5122L14.7348 12.5181L15.695 10.5976C15.8475 10.2927 16.1591 10.1 16.5 10.1C16.8409 10.1 17.1525 10.2927 17.305 10.5976L20.7969 17.5814L20.8044 17.5959L20.8137 17.615L21.805 19.5976C22.0273 20.0421 21.8471 20.5827 21.4025 20.805C20.9579 21.0273 20.4173 20.8471 20.195 20.4025L19.4438 18.9H13.5562L12.805 20.4025C12.5827 20.8471 12.0421 21.0273 11.5975 20.805C11.1529 20.5827 10.9727 20.0421 11.195 19.5976L12.1863 17.615C12.1917 17.6036 12.1973 17.5924 12.2031 17.5814L13.9146 14.1583C13.6034 14.0667 13.2256 13.9423 12.7988 13.7764C11.7294 13.3605 10.3442 12.6802 8.92538 11.5924C7.79753 12.5167 6.69473 13.0764 5.83285 13.4112C5.33899 13.603 4.92286 13.7216 4.62401 13.7931C4.47449 13.8288 4.35399 13.8529 4.26741 13.8684C4.2241 13.8762 4.18924 13.8818 4.16343 13.8858L4.13156 13.8904L4.12084 13.8919L4.11682 13.8924L4.11514 13.8927C4.11514 13.8927 4.11368 13.8928 4.00001 13L4.11368 13.8928C3.62061 13.9556 3.17 13.6068 3.10722 13.1137C3.0446 12.6219 3.39148 12.1723 3.88256 12.1077L3.94947 12.0967C4.00428 12.0869 4.09114 12.0698 4.20543 12.0424C4.43422 11.9877 4.77156 11.8924 5.18106 11.7334C5.84103 11.477 6.68484 11.0564 7.56458 10.3753C7.15054 9.93496 6.78945 9.48388 6.50421 9.10102C6.26672 8.78224 6.07517 8.50172 5.94227 8.29973C5.87571 8.19858 5.82359 8.11671 5.78748 8.05909C5.76942 8.03027 5.75535 8.00749 5.74545 7.99135L5.73377 7.9722L5.73032 7.96651L5.72864 7.96371C5.71133 7.9349 5.69582 7.9055 5.68208 7.87566C5.49265 7.46416 5.6393 6.96717 6.03659 6.72853C6.09037 6.69623 6.14617 6.6702 6.20315 6.65023C6.59739 6.51205 7.04758 6.66421 7.27129 7.03623L7.27266 7.0385L7.28001 7.05054C7.28695 7.06186 7.29793 7.07964 7.31274 7.10328C7.34239 7.15059 7.38731 7.2212 7.44595 7.31032C7.56343 7.48886 7.73484 7.73997 7.94765 8.02562C8.21085 8.37889 8.52772 8.77187 8.8756 9.14201C9.64226 8.24147 10.0681 7.3133 10.3056 6.55854C10.381 6.3186 10.4372 6.09683 10.4791 5.90005H9.51951C9.50696 5.90031 9.49442 5.90031 9.48191 5.90005H4.00001C3.50296 5.90005 3.10001 5.49711 3.10001 5.00005C3.10001 4.50299 3.50296 4.10005 4.00001 4.10005H8.04378L7.69503 3.40254C7.67314 3.35877 7.65516 3.31407 7.64094 3.26883C7.51078 2.8546 7.69671 2.39547 8.09752 2.19507ZM16.5 13.0125L18.5438 17.1H14.4562L16.5 13.0125Z",fill:"currentColor"},null,-1),C("path",{d:"M15.1 4.00007C15.1 3.50301 15.5029 3.10007 16 3.10007H18C19.6016 3.10007 20.9 4.39844 20.9 6.00007V8.00007C20.9 8.49712 20.497 8.90007 20 8.90007C19.5029 8.90007 19.1 8.49712 19.1 8.00007V6.00007C19.1 5.39255 18.6075 4.90007 18 4.90007H16C15.5029 4.90007 15.1 4.49712 15.1 4.00007Z",fill:"currentColor"},null,-1),C("path",{d:"M3.99998 15.1001C4.49703 15.1001 4.89998 15.503 4.89998 16.0001V18.0001C4.89998 18.6076 5.39246 19.1001 5.99998 19.1001H7.99998C8.49703 19.1001 8.89998 19.503 8.89998 20.0001C8.89998 20.4971 8.49703 20.9001 7.99998 20.9001H5.99998C4.39835 20.9001 3.09998 19.6017 3.09998 18.0001V16.0001C3.09998 15.503 3.50292 15.1001 3.99998 15.1001Z",fill:"currentColor"},null,-1)])])}const P8e=kt({name:"kimi-translate",render:O8e}),D8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B8e(e,t){return y(),M("svg",D8e,[...t[0]||(t[0]=[C("path",{d:"M8.10001 3C8.10001 2.50294 8.50295 2.1 9.00001 2.1H15C15.4971 2.1 15.9 2.50294 15.9 3C15.9 3.49706 15.4971 3.9 15 3.9H9.00001C8.50295 3.9 8.10001 3.49706 8.10001 3Z",fill:"currentColor"},null,-1),C("path",{d:"M10 15.9C9.50295 15.9 9.10001 15.4971 9.10001 15L9.10001 10C9.10001 9.50294 9.50295 9.1 10 9.1C10.4971 9.1 10.9 9.50294 10.9 10L10.9 15C10.9 15.4971 10.4971 15.9 10 15.9Z",fill:"currentColor"},null,-1),C("path",{d:"M13.1 15C13.1 15.4971 13.5029 15.9 14 15.9C14.4971 15.9 14.9 15.4971 14.9 15L14.9 10C14.9 9.50294 14.4971 9.1 14 9.1C13.5029 9.1 13.1 9.50294 13.1 10V15Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.10001 6C2.10001 5.50294 2.50295 5.1 3.00001 5.1H4.99152C4.99785 5.09993 5.00417 5.09993 5.01048 5.1H18.9895C18.9958 5.09993 19.0021 5.09993 19.0085 5.1H21C21.4971 5.1 21.9 5.50294 21.9 6C21.9 6.49706 21.4971 6.9 21 6.9H19.8281L18.8448 18.6993C18.7412 19.9432 17.7013 20.9 16.4531 20.9H7.54686C6.29865 20.9 5.25881 19.9432 5.15515 18.6993L4.17188 6.9H3.00001C2.50295 6.9 2.10001 6.49706 2.10001 6ZM5.97811 6.9L18.0219 6.9L17.0511 18.5498C17.0251 18.8608 16.7652 19.1 16.4531 19.1H7.54686C7.23481 19.1 6.97485 18.8608 6.94893 18.5498L5.97811 6.9Z",fill:"currentColor"},null,-1)])])}const H8e=kt({name:"kimi-trash",render:B8e}),z8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W8e(e,t){return y(),M("svg",z8e,[...t[0]||(t[0]=[C("path",{d:"M7.36336 3.3634C7.71483 3.01192 8.28533 3.01192 8.6368 3.3634C8.98817 3.71488 8.98824 4.2854 8.6368 4.63683L6.17391 7.09972H15.0001C18.2585 7.09977 20.9005 9.74166 20.9005 13.0001C20.9004 16.2585 18.2585 18.9005 15.0001 18.9005H7.00008C6.50307 18.9005 6.09976 18.4971 6.09969 18.0001C6.09969 17.5031 6.50302 17.0997 7.00008 17.0997H15.0001C17.2644 17.0997 19.0996 15.2644 19.0997 13.0001C19.0997 10.7358 17.2644 8.90055 15.0001 8.90051H6.17391L8.6368 11.3634L8.69832 11.4318C8.98668 11.7853 8.96632 12.3073 8.6368 12.6368C8.30728 12.9663 7.78521 12.9867 7.43172 12.6984L7.36336 12.6368L3.36336 8.63683C3.33098 8.60445 3.30286 8.56908 3.27645 8.53332C3.25597 8.50559 3.23607 8.47741 3.21883 8.44738C3.20492 8.42311 3.19221 8.39837 3.18074 8.37316C3.1764 8.36365 3.17109 8.35453 3.16707 8.34484C3.1627 8.33427 3.1593 8.32331 3.15535 8.31261C3.12946 8.24274 3.11237 8.16872 3.10457 8.09191C3.09258 7.97426 3.10262 7.85446 3.1368 7.74035C3.14281 7.72035 3.15094 7.70114 3.15828 7.68176C3.16165 7.67283 3.16341 7.66325 3.16707 7.65441C3.17216 7.64216 3.17806 7.63025 3.18367 7.61828C3.19055 7.60356 3.19744 7.58874 3.20516 7.57433C3.24709 7.49624 3.3012 7.42556 3.36336 7.3634L7.36336 3.3634Z",fill:"currentColor"},null,-1)])])}const U8e=kt({name:"kimi-undo",render:W8e}),j8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V8e(e,t){return y(),M("svg",j8e,[...t[0]||(t[0]=[C("path",{d:"M11.9997 12.8779C16.0197 12.878 19.4393 15.3848 20.7048 18.8828C21.0812 19.9234 20.2782 20.8962 19.2038 21.0137L18.9861 21.0264H5.0134L4.79562 21.0137C3.7213 20.8961 2.91743 19.9233 3.29367 18.8828C4.55905 15.3847 7.9797 12.8781 11.9997 12.8779ZM11.9997 14.6777C8.84467 14.6779 6.17462 16.5794 5.09152 19.2256H18.9079C17.8248 16.5793 15.1549 14.6778 11.9997 14.6777ZM12.2312 3.00586C14.6088 3.1264 16.4997 5.09239 16.4997 7.5L16.4939 7.73145C16.3734 10.1091 14.4073 11.9999 11.9997 12C9.59225 11.9998 7.62604 10.109 7.50558 7.73145L7.49973 7.5C7.49973 5.01485 9.51462 3.00021 11.9997 3L12.2312 3.00586ZM11.9997 4.7998C10.5087 4.80001 9.29953 6.00896 9.29953 7.5C9.29953 8.99104 10.5087 10.2 11.9997 10.2002C13.4908 10.2001 14.6999 8.99112 14.6999 7.5C14.6999 6.00888 13.4908 4.79989 11.9997 4.7998Z",fill:"currentColor"},null,-1)])])}const q8e=kt({name:"kimi-user",render:V8e}),K8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z8e(e,t){return y(),M("svg",K8e,[...t[0]||(t[0]=[C("path",{d:"M11.9996 7C11.5026 7 11.0996 7.36985 11.0996 7.82609V14.1739C11.0996 14.6301 11.5026 15 11.9996 15C12.4967 15 12.8996 14.6301 12.8996 14.1739V7.82609C12.8996 7.36985 12.4967 7 11.9996 7Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8996 17.1006C12.8996 17.5974 12.4968 18.001 11.9992 18.001C11.5024 18.001 11.0996 17.5974 11.0996 17.1006C11.0996 16.6038 11.5024 16.2002 11.9992 16.2002C12.4968 16.2002 12.8996 16.6038 12.8996 17.1006Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.5108 3.5501C13.3946 1.61676 10.6041 1.61676 9.48786 3.5501L1.69363 17.0501C0.577423 18.9834 1.97269 21.4001 4.20511 21.4001H19.7936C22.026 21.4001 23.4212 18.9834 22.305 17.0501L14.5108 3.5501ZM11.0467 4.4501C11.4701 3.71676 12.5286 3.71676 12.952 4.4501L20.7462 17.9501C21.1696 18.6834 20.6403 19.6001 19.7936 19.6001H4.20511C3.35833 19.6001 2.82909 18.6834 3.25248 17.9501L11.0467 4.4501Z",fill:"currentColor"},null,-1)])])}const G8e=kt({name:"kimi-warning",render:Z8e}),Y8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function X8e(e,t){return y(),M("svg",Y8e,[...t[0]||(t[0]=[C("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[C("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm11-2v16"}),C("path",{d:"m9 10l2 2l-2 2"})],-1)])])}const J8e=kt({name:"tabler-layout-sidebar-right-collapse",render:X8e}),Q8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eye(e,t){return y(),M("svg",Q8e,[...t[0]||(t[0]=[C("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"},null,-1)])])}const tye=kt({name:"tabler-paperclip",render:eye}),nye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function oye(e,t){return y(),M("svg",nye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"},null,-1)])])}const sye=kt({name:"ri-braces-line",render:oye}),iye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rye(e,t){return y(),M("svg",iye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"},null,-1)])])}const lye=kt({name:"ri-calendar-close-line",render:rye}),aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function uye(e,t){return y(),M("svg",aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"},null,-1)])])}const cye=kt({name:"ri-calendar-schedule-line",render:uye}),dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fye(e,t){return y(),M("svg",dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"},null,-1)])])}const pye=kt({name:"ri-calendar-todo-line",render:fye}),hye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function mye(e,t){return y(),M("svg",hye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"},null,-1)])])}const gye=kt({name:"ri-code-line",render:mye}),vye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yye(e,t){return y(),M("svg",vye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-4-7h8a4 4 0 0 1-8 0m0-2a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m8 0a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3"},null,-1)])])}const kye=kt({name:"ri-emotion-line",render:yye}),bye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cye(e,t){return y(),M("svg",bye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"},null,-1)])])}const wye=kt({name:"ri-external-link-line",render:Cye}),_ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xye(e,t){return y(),M("svg",_ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 3c5.392 0 9.878 3.88 10.819 9c-.94 5.12-5.427 9-10.819 9s-9.878-3.88-10.818-9C2.122 6.88 6.608 3 12 3m0 16a9.005 9.005 0 0 0 8.778-7a9.005 9.005 0 0 0-17.555 0A9.005 9.005 0 0 0 12 19m0-2.5a4.5 4.5 0 1 1 0-9a4.5 4.5 0 0 1 0 9m0-2a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5"},null,-1)])])}const Sye=kt({name:"ri-eye-line",render:xye}),Aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mye(e,t){return y(),M("svg",Aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M17.883 19.297A10.95 10.95 0 0 1 12 21c-5.392 0-9.878-3.88-10.818-9A11 11 0 0 1 4.52 5.935L1.394 2.808l1.414-1.414l19.799 19.798l-1.414 1.415zM5.936 7.35A8.97 8.97 0 0 0 3.223 12a9.005 9.005 0 0 0 13.201 5.838l-2.028-2.028A4.5 4.5 0 0 1 8.19 9.604zm6.978 6.978l-3.242-3.241a2.5 2.5 0 0 0 3.241 3.241m7.893 2.265l-1.431-1.431A8.9 8.9 0 0 0 20.778 12A9.005 9.005 0 0 0 9.552 5.338L7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.95 10.95 0 0 1-2.012 4.593m-9.084-9.084Q11.86 7.5 12 7.5a4.5 4.5 0 0 1 4.492 4.778z"},null,-1)])])}const Tye=kt({name:"ri-eye-off-line",render:Mye}),Eye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Iye(e,t){return y(),M("svg",Eye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"},null,-1)])])}const Lye=kt({name:"ri-file-add-line",render:Iye}),$ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nye(e,t){return y(),M("svg",$ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"},null,-1)])])}const Fye=kt({name:"ri-flashlight-line",render:Nye}),Rye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Oye(e,t){return y(),M("svg",Rye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])}const Pye=kt({name:"ri-folder-fill",render:Oye}),Dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bye(e,t){return y(),M("svg",Dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"},null,-1)])])}const Hye=kt({name:"ri-git-fork-line",render:Bye}),zye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wye(e,t){return y(),M("svg",zye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"},null,-1)])])}const Uye=kt({name:"ri-git-pull-request-line",render:Wye}),jye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vye(e,t){return y(),M("svg",jye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M2 18h7v2H2zm0-7h9v2H2zm0-7h20v2H2zm18.674 9.025l1.156-.391l1 1.732l-.916.805a4 4 0 0 1 0 1.658l.916.805l-1 1.732l-1.156-.391a4 4 0 0 1-1.435.83L19 21h-2l-.24-1.196a4 4 0 0 1-1.434-.83l-1.156.392l-1-1.732l.916-.805a4 4 0 0 1 0-1.658l-.916-.805l1-1.732l1.156.391c.41-.37.898-.655 1.435-.83L17 11h2l.24 1.196a4 4 0 0 1 1.434.83M18 18a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const qye=kt({name:"ri-list-settings-line",render:Vye}),Kye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zye(e,t){return y(),M("svg",Kye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8v2h5V9a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H8v6h5v-1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H7a1 1 0 0 1-1-1V8H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm9 16h-4v2h4zm0-8h-4v2h4zM9 4H5v2h4z"},null,-1)])])}const Gye=kt({name:"ri-node-tree",render:Zye}),Yye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xye(e,t){return y(),M("svg",Yye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m13.827 1.69l8.486 8.485l-1.415 1.414l-.707-.707l-4.242 4.243l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243l1.414-1.414l3.536-.707l4.242-4.243l-.707-.707zm.707 3.536l-4.67 4.67l-2.822.565l6.5 6.5l.564-2.822l4.671-4.67z"},null,-1)])])}const Jye=kt({name:"ri-pushpin-line",render:Xye}),Qye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function e5e(e,t){return y(),M("svg",Qye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"},null,-1)])])}const t5e=kt({name:"ri-sort-desc",render:e5e}),n5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o5e(e,t){return y(),M("svg",n5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"},null,-1)])])}const s5e=kt({name:"ri-star-fill",render:o5e}),i5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function r5e(e,t){return y(),M("svg",i5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"},null,-1)])])}const l5e=kt({name:"ri-star-line",render:r5e}),a5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function u5e(e,t){return y(),M("svg",a5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"},null,-1)])])}const c5e=kt({name:"ri-tools-line",render:u5e}),d5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function f5e(e,t){return y(),M("svg",d5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m20.97 17.172l-1.414 1.414l-3.535-3.535l-.073.074l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243L5.34 8.761l3.536-.707l.073-.074l-3.536-3.536L6.828 3.03zM10.365 9.394l-.502.502l-2.822.565l6.5 6.5l.564-2.822l.502-.502zm8.411.074l-1.34 1.34l1.414 1.415l1.34-1.34l.707.707l1.415-1.415l-8.486-8.485l-1.414 1.414l.707.707l-1.34 1.34l1.414 1.415l1.34-1.34z"},null,-1)])])}const p5e=kt({name:"ri-unpin-line",render:f5e}),h5e=` + + +`,m5e=` + + + +`,g5e=` + + + +`,v5e=` + + +`,y5e=` + + +`,k5e=` + + +`,b5e=` + + +`,C5e=` + + +`,w5e=` + + +`,_5e=` + + +`,x5e=` + + +`,S5e=` + + + +`,A5e=` + + +`,M5e=` + + + +`,T5e=` + + +`,E5e=` + + + +`,I5e=` + + +`,L5e=` + + +`,$5e=` + + +`,N5e=` + + +`,Yx=` + + + + +`,F5e=` + + + + +`,R5e=` + + +`,O5e=` + + + + +`,P5e=` + + + + + +`,D5e=` + + +`,B5e=` + + +`,H5e=` + + +`,z5e=` + + +`,W5e=` + + +`,U5e=` + + +`,j5e=` + + + +`,V5e=` + + + +`,q5e=` + + +`,K5e=` + + + + + + + + + + + +`,Z5e=` + + + + +`,G5e=` + + + + +`,Y5e=` + + + + + + + + + + + + +`,X5e=` + + +`,J5e=` + + +`,Q5e=` + + + + +`,e6e=` + + +`,t6e=` + + +`,n6e=` + + + + +`,o6e=` + + + + +`,s6e=` + + + +`,i6e=` + + +`,r6e=` + + +`,l6e=` + + + + +`,a6e=` + + +`,u6e=` + + +`,c6e=` + + +`,d6e=` + + + +`,f6e=` + + + + +`,p6e=` + + +`,h6e=` + + +`,m6e='',g6e=` + + +`,v6e=` + + +`,y6e=` + + + + +`,k6e=` + + + + +`,b6e=` + + +`,C6e=` + + + + + + + +`,w6e=` + + + + +`,_6e=` + + + + + +`,x6e=` + + +`,S6e=` + + +`,A6e=` + + + + +`,M6e='',T6e='',E6e='',I6e='',L6e='',$6e='',N6e='',F6e='',R6e='',O6e='',P6e='',D6e='',B6e='',H6e='',z6e='',W6e='',U6e='',j6e='',V6e='',q6e='',K6e='',Z6e='',G6e='',Y6e='',X6e={sm:14,md:16,lg:20};function xt(e,t){return{component:e,svg:t}}const BN={plus:xt(d9e,h5e),"chat-new":xt(h9e,m5e),"calendar-close":xt(lye,I6e),"calendar-schedule":xt(cye,L6e),"calendar-todo":xt(pye,$6e),close:xt(K9e,A5e),check:xt($9e,C5e),archive:xt(v9e,g5e),search:xt(J3e,u6e),copy:xt(n4e,E5e),link:xt(g3e,X5e),"external-link":xt(wye,R6e),download:xt(a4e,L5e),undo:xt(U8e,x6e),send:xt(t8e,c6e),image:xt(G4e,j5e),settings:xt(s8e,d6e),sliders:xt(g8e,m6e),"light-mode":xt(p3e,Y5e),"dark-mode":xt(i4e,I5e),"follow-system":xt(L4e,D5e),"log-in":xt(c8e,p6e),"log-out":xt(p8e,h6e),hand:xt(U4e,W5e),"full-access":xt(F4e,B5e),"shield-question":xt(l8e,f6e),"chevron-down":xt(R9e,w5e),"chevron-right":xt(D9e,_5e),"chevron-up":xt(z9e,x5e),"arrow-up":xt(E9e,b5e),"arrow-down":xt(b9e,v5e),"arrow-right":xt(A9e,k5e),"arrow-left":xt(_9e,y5e),minus:xt(S3e,e6e),microscope:xt(T3e,t6e),"panel-collapse":xt(l3e,Z5e),"panel-collapse-right":xt(J8e,M6e),"panel-expand":xt(c3e,G5e),expand:xt(h4e,N5e),collapse:xt(Y9e,M5e),list:xt(k3e,J5e),"list-settings":xt(qye,U6e),"tree-view":xt(Gye,j6e),sort:xt(t5e,q6e),grip:xt(H4e,z5e),folder:xt(S4e,O5e),"folder-closed":xt(w4e,R5e),"folder-plus":xt(T4e,P5e),"folder-solid":xt(Pye,H6e),file:xt(Gx,Yx),"file-text":xt(k4e,F5e),"file-edit":xt(d4e,$5e),"file-plus":xt(Lye,D6e),"file-off":xt(Gx,Yx),attachment:xt(tye,T6e),"image-off":xt(J4e,V5e),eye:xt(Sye,O6e),"eye-off":xt(Tye,P6e),code:xt(gye,N6e),terminal:xt(T8e,k6e),pencil:xt(H3e,i6e),tool:xt(c5e,G6e),glob:xt(sye,E6e),globe:xt(P4e,H5e),translate:xt(P8e,w6e),"check-list":xt(F8e,C6e),bolt:xt(Fye,B6e),keyboard:xt(s3e,K5e),trash:xt(H8e,_6e),"git-fork":xt(Hye,z6e),"git-pull-request":xt(Uye,W6e),message:xt(Q9e,T5e),mail:xt(w3e,Q5e),user:xt(q8e,S6e),info:xt(t3e,q5e),"help-circle":xt(q3e,l6e),"alert-triangle":xt(G8e,A6e),clock:xt(j9e,S5e),robot:xt(G3e,a6e),sparkles:xt(S8e,y6e),histogram:xt(q4e,U5e),music:xt(F3e,o6e),emoji:xt(kye,F6e),target:xt(w8e,v6e),pause:xt(P3e,s6e),play:xt(U3e,r6e),pin:xt(Jye,V6e),stop:xt(k8e,g6e),star:xt(s5e,K6e),"star-outline":xt(l5e,Z6e),unpin:xt(p5e,Y6e),"dots-horizontal":xt(L3e,n6e),thinking:xt(L8e,b6e)};function J6e(e){return BN[e]}function Q6e(e,t){return e.replace(/]*>/,n=>n.replace(/\s(?:width|height)="[^"]*"/g,"")).replace(/^
      ${r}`}function OY(e,t,n){return(n.xhtmlOut?`
      -`:`
      -`)+`
      -
        -`}function PY(){return`
      -
      -`}function DY(e,t,n,o,s){let i=s.rules.footnote_anchor_name(e,t,n,o,s);return e[t].meta.subId>0&&(i+=`:${e[t].meta.subId}`),`
    1. `}function BY(){return`
    2. -`}function HY(e,t,n,o,s){let i=s.rules.footnote_anchor_name(e,t,n,o,s);return e[t].meta.subId>0&&(i+=`:${e[t].meta.subId}`),` ↩︎`}function zY(e){const t=e.helpers.parseLinkLabel,n=e.utils.isSpace;e.renderer.rules.footnote_ref=RY,e.renderer.rules.footnote_block_open=OY,e.renderer.rules.footnote_block_close=PY,e.renderer.rules.footnote_open=DY,e.renderer.rules.footnote_close=BY,e.renderer.rules.footnote_anchor=HY,e.renderer.rules.footnote_caption=FY,e.renderer.rules.footnote_anchor_name=NY;function o(l,a,u,c){const d=l.bMarks[a]+l.tShift[a],f=l.eMarks[a];if(d+4>f||l.src.charCodeAt(d)!==91||l.src.charCodeAt(d+1)!==94)return!1;let h;for(h=d+2;h=f||l.src.charCodeAt(++h)!==58)return!1;if(c)return!0;h++,l.env.footnotes||(l.env.footnotes={}),l.env.footnotes.refs||(l.env.footnotes.refs={});const g=l.src.slice(d+2,h-2);l.env.footnotes.refs[`:${g}`]=-1;const m=new l.Token("footnote_reference_open","",1);m.meta={label:g},m.level=l.level++,l.tokens.push(m);const w=l.bMarks[a],_=l.tShift[a],v=l.sCount[a],k=l.parentType,y=h,x=l.sCount[a]+h-(l.bMarks[a]+l.tShift[a]);let M=x;for(;h=u||l.src.charCodeAt(c)!==94||l.src.charCodeAt(c+1)!==91)return!1;const d=c+2,f=t(l,c+1);if(f<0)return!1;if(!a){l.env.footnotes||(l.env.footnotes={}),l.env.footnotes.list||(l.env.footnotes.list=[]);const h=l.env.footnotes.list.length,g=[];l.md.inline.parse(l.src.slice(d,f),l.md,l.env,g);const m=l.push("footnote_ref","",0);m.meta={id:h},l.env.footnotes.list[h]={content:l.src.slice(d,f),tokens:g}}return l.pos=f+1,l.posMax=u,!0}function i(l,a){const u=l.posMax,c=l.pos;if(c+3>u||!l.env.footnotes||!l.env.footnotes.refs||l.src.charCodeAt(c)!==91||l.src.charCodeAt(c+1)!==94)return!1;let d;for(d=c+2;d=u)return!1;d++;const f=l.src.slice(c+2,d-1);if(typeof l.env.footnotes.refs[`:${f}`]>"u")return!1;if(!a){l.env.footnotes.list||(l.env.footnotes.list=[]);let h;l.env.footnotes.refs[`:${f}`]<0?(h=l.env.footnotes.list.length,l.env.footnotes.list[h]={label:f,count:0},l.env.footnotes.refs[`:${f}`]=h):h=l.env.footnotes.refs[`:${f}`];const g=l.env.footnotes.list[h].count;l.env.footnotes.list[h].count++;const m=l.push("footnote_ref","",0);m.meta={id:h,subId:g,label:f}}return l.pos=d,l.posMax=u,!0}function r(l){let a,u,c,d=!1;const f={};if(!l.env.footnotes||(l.tokens=l.tokens.filter(function(g){return g.type==="footnote_reference_open"?(d=!0,u=[],c=g.meta.label,!1):g.type==="footnote_reference_close"?(d=!1,f[":"+c]=u,!1):(d&&u.push(g),!d)}),!l.env.footnotes.list))return;const h=l.env.footnotes.list;l.tokens.push(new l.Token("footnote_block_open","",1));for(let g=0,m=h.length;g0?h[g].count:1;for(let k=0;k?@[\]^_`{|}~-])/g;function VY(e,t){const n=e.posMax,o=e.pos;if(e.src.charCodeAt(o)!==126||t||o+2>=n)return!1;e.pos=o+1;let s=!1;for(;e.pos?@[\]^_`{|}~-])/g;function ZY(e,t){const n=e.posMax,o=e.pos;if(e.src.charCodeAt(o)!==94||t||o+2>=n)return!1;e.pos=o+1;let s=!1;for(;e.pos{t.exports=function(m,w){w=Object.assign({},{disabled:!0,divWrap:!1,divClass:"checkbox",idPrefix:"cbx_",ulClass:"task-list",liClass:"task-list-item"},w),m.core.ruler.after("inline","github-task-lists",function(_){for(var v=_.tokens,k=0,y=2;y=0;v--)if(m[v].level===_)return v;return-1}function s(m,w){return d(m[w])&&f(m[w-1])&&h(m[w-2])&&g(m[w])}function i(m,w,_,v){var k=_.idPrefix+w;m.children[0].content=m.children[0].content.slice(3),m.children.unshift(l(k,v)),m.children.push(a(v)),m.children.unshift(r(m,k,_,v)),_.divWrap&&(m.children.unshift(u(_,v)),m.children.push(c(v)))}function r(m,w,_,v){var k=new v("checkbox_input","input",0);return k.attrs=[["type","checkbox"],["id",w]],/^\[[xX]\][ \u00A0]/.test(m.content)===!0&&k.attrs.push(["checked","true"]),_.disabled===!0&&k.attrs.push(["disabled","true"]),k}function l(m,w){var _=new w("label_open","label",1);return _.attrs=[["for",m]],_}function a(m){return new m("label_close","label",-1)}function u(m,w){var _=new w("checkbox_open","div",0);return _.attrs=[["class",m.divClass]],_}function c(m){return new m("checkbox_close","div",-1)}function d(m){return m.type==="inline"}function f(m){return m.type==="paragraph_open"}function h(m){return m.type==="list_item_open"}function g(m){return/^\[[xX \u00A0]\][ \u00A0]/.test(m.content)}})}),XY=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))),JY=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(e=>e.charCodeAt(0))),p9;const QY=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]]),eX=(p9=String.fromCodePoint)!==null&&p9!==void 0?p9:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function tX(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=QY.get(e))!==null&&t!==void 0?t:e}var Is;(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"})(Is||(Is={}));const nX=32;var Da;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Da||(Da={}));function m3(e){return e>=Is.ZERO&&e<=Is.NINE}function oX(e){return e>=Is.UPPER_A&&e<=Is.UPPER_F||e>=Is.LOWER_A&&e<=Is.LOWER_F}function sX(e){return e>=Is.UPPER_A&&e<=Is.UPPER_Z||e>=Is.LOWER_A&&e<=Is.LOWER_Z||m3(e)}function iX(e){return e===Is.EQUALS||sX(e)}var Ss;(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"})(Ss||(Ss={}));var Fa;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Fa||(Fa={}));var rX=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=Ss.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Fa.Strict}startEntity(e){this.decodeMode=e,this.state=Ss.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case Ss.EntityStart:return e.charCodeAt(t)===Is.NUM?(this.state=Ss.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=Ss.NamedEntity,this.stateNamedEntity(e,t));case Ss.NumericStart:return this.stateNumericStart(e,t);case Ss.NumericDecimal:return this.stateNumericDecimal(e,t);case Ss.NumericHex:return this.stateNumericHex(e,t);case Ss.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|nX)===Is.LOWER_X?(this.state=Ss.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=Ss.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,o){if(t!==n){const s=n-t;this.result=this.result*Math.pow(o,s)+parseInt(e.substr(t,s),o),this.consumed+=s}}stateNumericHex(e,t){const n=t;for(;t>14;for(;t>14,s!==0){if(i===Is.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Fa.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:t,decodeTree:n}=this,o=(n[t]&Da.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,o,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){const{decodeTree:o}=this;return this.emitCodePoint(t===1?o[e]&~Da.VALUE_LENGTH:o[e+1],n),t===3&&this.emitCodePoint(o[e+2],n),n}end(){var e;switch(this.state){case Ss.NamedEntity:return this.result!==0&&(this.decodeMode!==Fa.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Ss.NumericDecimal:return this.emitNumericEntity(0,2);case Ss.NumericHex:return this.emitNumericEntity(0,3);case Ss.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Ss.EntityStart:return 0}}};function KT(e){let t="";const n=new rX(e,o=>t+=eX(o));return function(s,i){let r=0,l=0;for(;(l=s.indexOf("&",l))>=0;){t+=s.slice(r,l),n.startEntity(i);const u=n.write(s,l+1);if(u<0){r=l+n.end();break}r=l+u,l=u===0?r+1:r}const a=t+s.slice(r);return t="",a}}function lX(e,t,n,o){const s=(t&Da.BRANCH_LENGTH)>>7,i=t&Da.JUMP_TABLE;if(s===0)return i!==0&&o===i?n:-1;if(i){const a=o-i;return a<0||a>=s?-1:e[n+a]-1}let r=n,l=r+s-1;for(;r<=l;){const a=r+l>>>1,u=e[a];if(uo)l=a-1;else return e[a+s]}return-1}const aX=KT(XY);KT(JY);function E8(e,t=Fa.Legacy){return aX(e,t)}var uX=qT(YY());const Mb={};function cX(e){let t=Mb[e];if(t)return t;t=Mb[e]=[];for(let n=0;n<128;n++){const o=String.fromCharCode(n);t.push(o)}for(let n=0;n=55296&&c<=57343?s+="���":s+=String.fromCharCode(c),i+=6;continue}}if((l&248)===240&&i+91114111?s+="����":(d-=65536,s+=String.fromCharCode(55296+(d>>10),56320+(d&1023))),i+=9;continue}}s+="�"}return s})}h2.defaultChars=";/?:@&=+$,#";h2.componentChars="";var g3=h2;const Tb={};function dX(e){let t=Tb[e];if(t)return t;t=Tb[e]=[];for(let n=0;n<128;n++){const o=String.fromCharCode(n);/^[0-9a-z]$/i.test(o)?t.push(o):t.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n"u"&&(n=!0);const o=dX(t);let s="";for(let i=0,r=e.length;i=55296&&l<=57343){if(l>=55296&&l<=56319&&i+1=56320&&a<=57343){s+=encodeURIComponent(e[i]+e[i+1]),i++;continue}}s+="%EF%BF%BD";continue}s+=encodeURIComponent(e[i])}return s}m2.defaultChars=";/?:@&=+$,-_.!~*'()#";m2.componentChars="-_.!~*'()";var ZT=m2;function I8(e){let t="";return t+=e.protocol||"",t+=e.slashes?"//":"",t+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?t+="["+e.hostname+"]":t+=e.hostname||"",t+=e.port?":"+e.port:"",t+=e.pathname||"",t+=e.search||"",t+=e.hash||"",t}function Pm(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const fX=/^([a-z0-9.+-]+:)/i,pX=/:[0-9]*$/,hX=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,mX=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r",` -`," "]),gX=["'"].concat(mX),Eb=["%","/","?",";","#"].concat(gX),Ib=["/","?","#"],vX=255,Lb=/^[+a-z0-9A-Z_-]{0,63}$/,yX=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,$b={javascript:!0,"javascript:":!0},Nb={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function kX(e,t){if(e&&e instanceof Pm)return e;const n=new Pm;return n.parse(e,t),n}Pm.prototype.parse=function(e,t){let n,o,s,i=e;if(i=i.trim(),!t&&e.split("#").length===1){const u=hX.exec(i);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let r=fX.exec(i);if(r&&(r=r[0],n=r.toLowerCase(),this.protocol=r,i=i.substr(r.length)),(t||r||i.match(/^\/\/[^@\/]+@[^@\/]+/))&&(s=i.substr(0,2)==="//",s&&!(r&&$b[r])&&(i=i.substr(2),this.slashes=!0)),!$b[r]&&(s||r&&!Nb[r])){let u=-1;for(let g=0;g127?v+="x":v+=_[k];if(!v.match(Lb)){const k=g.slice(0,m),y=g.slice(m+1),x=_.match(yX);x&&(k.push(x[1]),y.unshift(x[2])),y.length&&(i=y.join(".")+i),this.hostname=k.join(".");break}}}}this.hostname.length>vX&&(this.hostname=""),h&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const l=i.indexOf("#");l!==-1&&(this.hash=i.substr(l),i=i.slice(0,l));const a=i.indexOf("?");return a!==-1&&(this.search=i.substr(a),i=i.slice(0,a)),i&&(this.pathname=i),Nb[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Pm.prototype.parseHost=function(e){let t=pX.exec(e);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var L8=kX,GT=VT({decode:()=>g3,encode:()=>ZT,format:()=>I8,parse:()=>L8}),YT=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,XT=/[\0-\x1F\x7F-\x9F]/,bX=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,JT=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,CX=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,QT=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,wX=VT({Any:()=>YT,Cc:()=>XT,Cf:()=>bX,P:()=>JT,S:()=>CX,Z:()=>QT}),_X=Object.defineProperty,eE=e=>{let t={};for(var n in e)_X(t,n,{get:e[n],enumerable:!0});return t},bs=class{type;tag;attrs;map;nesting;level;children;content;markup;info;meta;block;hidden;constructor(e,t,n){this.type=e,this.tag=t,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}attrIndex(e){if(!this.attrs)return-1;const t=this.attrs;for(let n=0,o=t.length;n=0&&(n=this.attrs[t][1]),n}attrJoin(e,t){const n=this.attrIndex(e);n<0?this.attrPush([e,t]):this.attrs[n][1]=`${this.attrs[n][1]} ${t}`}},xX=eE({arrayReplaceAt:()=>LX,assign:()=>EX,countLines:()=>Ko,escapeHtml:()=>HX,escapeRE:()=>WX,fromCodePoint:()=>Cp,has:()=>TX,isMdAsciiPunct:()=>Hm,isPunctChar:()=>Bm,isPunctCode:()=>v3,isSpace:()=>IX,isString:()=>AX,isValidEntityCode:()=>v2,isWhiteSpace:()=>bp,lib:()=>UX,mdurl:()=>GT,normalizeReference:()=>g2,ucmicro:()=>Dm,unescapeAll:()=>wp,unescapeMd:()=>RX});const Dm=wX;function SX(e){return Object.prototype.toString.call(e)}function AX(e){return SX(e)==="[object String]"}const MX=Object.prototype.hasOwnProperty;function TX(e,t){return MX.call(e,t)}function EX(e,...t){return t.forEach(n=>{if(n){if(typeof n!="object")throw new TypeError(`${String(n)}must be object`);Object.keys(n).forEach(o=>{e[o]=n[o]})}}),e}function IX(e){return e===9||e===32}function bp(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Bm(e){return Dm.P.test(e)||Dm.S.test(e)}const Fb=new Map;function v3(e){if(Hm(e))return!0;if(e>=0&&e<128)return!1;const t=Fb.get(e);if(t!==void 0)return t;const n=Bm(String.fromCharCode(e));return Fb.set(e,n),n}function Hm(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function g2(e){return e=e.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(e=e.replace(/ẞ/g,"ß")),e.toLowerCase().toUpperCase()}function LX(e,t,n){return[...e.slice(0,t),...n,...e.slice(t+1)]}function v2(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function Cp(e){if(e>65535){e-=65536;const t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}const tE=/\\([!"#$%&'()*+,\-\./:;<=>?@[\\\]^_`{|}~])/g,$X=new RegExp(`${tE.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),NX=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function FX(e,t){if(t.charCodeAt(0)===35&&NX.test(t)){const o=t[1].toLowerCase()==="x"?Number.parseInt(t.slice(2),16):Number.parseInt(t.slice(1),10);return v2(o)?Cp(o):e}const n=E8(e);return n!==e?n:e}function RX(e){return e.includes("\\")?e.replace(tE,"$1"):e}function wp(e){return!e.includes("\\")&&!e.includes("&")?e:e.replace($X,(t,n,o)=>n||FX(t,o))}const OX=/[&<>"]/,PX=/[&<>"]/g,DX={"&":"&","<":"<",">":">",'"':"""};function BX(e){return DX[e]}function HX(e){return OX.test(e)?e.replace(PX,BX):e}const zX=/[.?*+^$[\]\\(){}|-]/g;function WX(e){return e.replace(zX,"\\$&")}const UX={mdurl:GT,ucmicro:Dm};function Ko(e){if(e.length===0)return 0;let t=0,n=-1;for(;(n=e.indexOf(` -`,n+1))!==-1;)t++;return t}const jX=/(?:^|\n)[ \t]{0,3}\[\^[^\]\n]+\]:/m,VX=/(?:^|\n)[ \t]{0,3}\*\[[^\]\n]+\]:/m,qX=/(?:^|\n)[ \t]{0,3}\[(?!\^)(?:\\[\s\S]|[^\]\\[])+\][ \t]*:/m,$8=["references","footnotes","abbreviations","abbr","abbrs"],N8=Symbol.for("markdown-it-ts.global-state"),F8=Object.prototype.hasOwnProperty;function Rb(e){return e==="reference-definition"||e==="footnote-definition"||e==="abbreviation-definition"}function Wr(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function ja(e){if(Array.isArray(e))return e.map(t=>ja(t));if(Wr(e)){const t={};for(const n of Object.keys(e))t[n]=ja(e[n]);return t}return e}function zm(e){return Array.isArray(e)?e.map((t,n)=>String(n)):Wr(e)?Object.keys(e):[]}function y3(e,t){if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;ni.has(r)?!y3(s[r],nE(o.value,r)):!0)}}function aa(e){const t=R8(e);if(t){for(const n of $8){const o=t.snapshot[n];if(!o){delete e[n];continue}if(o.ownedKeys){ZX(e,n,o);continue}o.existed?e[n]=KX(e[n],o.value):delete e[n]}delete e[N8]}}function h9(e){return{area:e,attempted:!0,matched:!1,attemptMs:0,blocks:0,headings:0,paragraphs:0,lists:0,fences:0,paragraphCacheHits:0,paragraphCacheMisses:0,paragraphCacheBypasses:0,listCacheHits:0,listCacheMisses:0,fenceCacheHits:0,fenceCacheMisses:0}}const k3=Symbol.for("markdown-it-ts.diagnostics");function Up(e,t){if(e)try{const n=e[k3];if(n&&typeof n=="object")return n;if(!t)return;const o={};return e[k3]=o,o}catch{return}}function ql(e){return Up(e,!1)}function YX(e){if(e)try{const t=e[k3];t&&typeof t=="object"&&(delete t.strategy,delete t.chunk,delete t.unbounded,delete t.editable,delete t.stockFast)}catch{}}function mi(e){YX(e)}function t1(e,t){const n=Up(e,!0);n&&(n.stockFast=t)}function ss(e,t){const n=Up(e,!0);n&&(n.strategy=t)}function m9(e,t){const n=Up(e,!0);n&&(n.chunk=t)}function oE(e,t){const n=Up(e,!0);n&&(n.unbounded=t)}function XX(e){const t={};e=e||{},t.src_Any=YT.source,t.src_Cc=XT.source,t.src_Z=QT.source,t.src_P=JT.source,t.src_ZPCc=[t.src_Z,t.src_P,t.src_Cc].join("|"),t.src_ZCc=[t.src_Z,t.src_Cc].join("|");const n="[><|]";return t.src_pseudo_letter=`(?:(?!${n}|${t.src_ZPCc})${t.src_Any})`,t.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",t.src_auth=`(?:(?:(?!${t.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`,t.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",t.src_host_terminator=`(?=$|${n}|${t.src_ZPCc})(?!${e["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${t.src_ZPCc}))`,t.src_path=`(?:[/?#](?:(?!${t.src_ZCc}|${n}|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!${t.src_ZCc}|\\]).)*\\]|\\((?:(?!${t.src_ZCc}|[)]).)*\\)|\\{(?:(?!${t.src_ZCc}|[}]).)*\\}|\\"(?:(?!${t.src_ZCc}|["]).)+\\"|\\'(?:(?!${t.src_ZCc}|[']).)+\\'|\\'(?=${t.src_pseudo_letter}|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!${t.src_ZCc}|[.]|$)|`+(e["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+`,(?!${t.src_ZCc}|$)|;(?!${t.src_ZCc}|$)|\\!+(?!${t.src_ZCc}|[!]|$)|\\?(?!${t.src_ZCc}|[?]|$))+|\\/)?`,t.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]{0,63}',t.src_xn="xn--[a-z0-9\\-]{1,59}",t.src_domain_root="(?:"+t.src_xn+`|${t.src_pseudo_letter}{1,63})`,t.src_domain="(?:"+t.src_xn+`|(?:${t.src_pseudo_letter})|(?:${t.src_pseudo_letter}(?:-|${t.src_pseudo_letter}){0,61}${t.src_pseudo_letter}))`,t.src_host=`(?:(?:(?:(?:${t.src_domain})\\.)*${t.src_domain}))`,t.tpl_host_fuzzy="(?:"+t.src_ip4+`|(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%)))`,t.tpl_host_no_ip_fuzzy=`(?:(?:(?:${t.src_domain})\\.)+(?:%TLDS%))`,t.src_host_strict=t.src_host+t.src_host_terminator,t.tpl_host_fuzzy_strict=t.tpl_host_fuzzy+t.src_host_terminator,t.src_host_port_strict=t.src_host+t.src_port+t.src_host_terminator,t.tpl_host_port_fuzzy_strict=t.tpl_host_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_port_no_ip_fuzzy_strict=t.tpl_host_no_ip_fuzzy+t.src_port+t.src_host_terminator,t.tpl_host_fuzzy_test=`localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:${t.src_ZPCc}|>|$))`,t.tpl_email_fuzzy=`(^|${n}|"|\\(|${t.src_ZCc})(${t.src_email_name}@${t.tpl_host_fuzzy_strict})`,t.tpl_link_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_fuzzy_strict}${t.src_path})`,t.tpl_link_no_ip_fuzzy=`(^|(?![.:/\\-_@])(?:[$+<=>^\`||]|${t.src_ZPCc}))((?![$+<=>^\`||])${t.tpl_host_port_no_ip_fuzzy_strict}${t.src_path})`,t}function b3(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){t&&Object.keys(t).forEach(function(n){e[n]=t[n]})}),e}function y2(e){return Object.prototype.toString.call(e)}function JX(e){return y2(e)==="[object String]"}function QX(e){return y2(e)==="[object Object]"}function eJ(e){return y2(e)==="[object RegExp]"}function Ob(e){return y2(e)==="[object Function]"}function tJ(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const sE={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function nJ(e){return Object.keys(e||{}).reduce(function(t,n){return t||sE.hasOwnProperty(n)},!1)}const oJ={"http:":{validate:function(e,t,n){const o=e.slice(t);return n.re.http||(n.re.http=new RegExp(`^\\/\\/${n.re.src_auth}${n.re.src_host_port_strict}${n.re.src_path}`,"i")),n.re.http.test(o)?o.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(e,t,n){const o=e.slice(t);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+`(?:localhost|(?:(?:${n.re.src_domain})\\.)+${n.re.src_domain_root})`+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(o)?t>=3&&e[t-3]===":"||t>=3&&e[t-3]==="/"?0:o.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(e,t,n){const o=e.slice(t);return n.re.mailto||(n.re.mailto=new RegExp(`^${n.re.src_email_name}@${n.re.src_host_strict}`,"i")),n.re.mailto.test(o)?o.match(n.re.mailto)[0].length:0}}},sJ="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",iJ="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function rJ(e){return function(t,n){const o=t.slice(n);return e.test(o)?o.match(e)[0].length:0}}function Pb(){return function(e,t){t.normalize(e)}}function Wm(e){const t=e.re=XX(e.__opts__),n=e.__tlds__.slice();e.onCompile(),e.__tlds_replaced__||n.push(sJ),n.push(t.src_xn),t.src_tlds=n.join("|");function o(l){return l.replace("%TLDS%",t.src_tlds)}t.email_fuzzy=RegExp(o(t.tpl_email_fuzzy),"i"),t.email_fuzzy_global=RegExp(o(t.tpl_email_fuzzy),"ig"),t.link_fuzzy=RegExp(o(t.tpl_link_fuzzy),"i"),t.link_fuzzy_global=RegExp(o(t.tpl_link_fuzzy),"ig"),t.link_no_ip_fuzzy=RegExp(o(t.tpl_link_no_ip_fuzzy),"i"),t.link_no_ip_fuzzy_global=RegExp(o(t.tpl_link_no_ip_fuzzy),"ig"),t.host_fuzzy_test=RegExp(o(t.tpl_host_fuzzy_test),"i");const s=[];e.__compiled__={};function i(l,a){throw new Error(`(LinkifyIt) Invalid schema "${l}": ${a}`)}Object.keys(e.__schemas__).forEach(function(l){const a=e.__schemas__[l];if(a===null)return;const u={validate:null,link:null};if(e.__compiled__[l]=u,QX(a)){eJ(a.validate)?u.validate=rJ(a.validate):Ob(a.validate)?u.validate=a.validate:i(l,a),Ob(a.normalize)?u.normalize=a.normalize:a.normalize?i(l,a):u.normalize=Pb();return}if(JX(a)){s.push(l);return}i(l,a)}),s.forEach(function(l){e.__compiled__[e.__schemas__[l]]&&(e.__compiled__[l].validate=e.__compiled__[e.__schemas__[l]].validate,e.__compiled__[l].normalize=e.__compiled__[e.__schemas__[l]].normalize)}),e.__compiled__[""]={validate:null,normalize:Pb()};const r=Object.keys(e.__compiled__).filter(function(l){return l.length>0&&e.__compiled__[l]}).map(tJ).join("|");e.re.schema_test=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${r})`,"i"),e.re.schema_search=RegExp(`(^|(?!_)(?:[><|]|${t.src_ZPCc}))(${r})`,"ig"),e.re.schema_at_start=RegExp(`^${e.re.schema_search.source}`,"i"),e.re.pretest=RegExp(`(${e.re.schema_test.source})|(${e.re.host_fuzzy_test.source})|@`,"i")}function iE(e,t,n,o){const s=e.slice(n,o);this.schema=t.toLowerCase(),this.index=n,this.lastIndex=o,this.raw=s,this.text=s,this.url=s}function ar(e,t){if(!(this instanceof ar))return new ar(e,t);t||nJ(e)&&(t=e,e={}),this.__opts__=b3({},sE,t),this.__schemas__=b3({},oJ,e),this.__compiled__={},this.__tlds__=iJ,this.__tlds_replaced__=!1,this.re={},Wm(this)}ar.prototype.add=function(t,n){return this.__schemas__[t]=n,Wm(this),this};ar.prototype.set=function(t){return this.__opts__=b3(this.__opts__,t),this};ar.prototype.test=function(t){if(!t.length)return!1;let n,o;if(this.re.schema_test.test(t)){for(o=this.re.schema_search,o.lastIndex=0;(n=o.exec(t))!==null;)if(this.testSchemaAt(t,n[2],o.lastIndex))return!0}return!!(this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&t.search(this.re.host_fuzzy_test)>=0&&t.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy)!==null||this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&t.indexOf("@")>=0&&t.match(this.re.email_fuzzy)!==null)};ar.prototype.pretest=function(t){return this.re.pretest.test(t)};ar.prototype.testSchemaAt=function(t,n,o){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(t,o,this):0};ar.prototype.match=function(t){const n=[],o=[],s=[],i=[];let r,l,a;function u(f,h){return f?h?f.index!==h.index?f.index=h.lastIndex?f:h:f:h}if(!t.length)return null;if(this.re.schema_test.test(t))for(a=this.re.schema_search,a.lastIndex=0;(r=a.exec(t))!==null;)l=this.testSchemaAt(t,r[2],a.lastIndex),l&&o.push({schema:r[2],index:r.index+r[1].length,lastIndex:r.index+r[0].length+l});if(this.__opts__.fuzzyLink&&this.__compiled__["http:"])for(a=this.__opts__.fuzzyIP?this.re.link_fuzzy_global:this.re.link_no_ip_fuzzy_global,a.lastIndex=0;(r=a.exec(t))!==null;)s.push({schema:"",index:r.index+r[1].length,lastIndex:r.index+r[0].length});if(this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"])for(a=this.re.email_fuzzy_global,a.lastIndex=0;(r=a.exec(t))!==null;)i.push({schema:"mailto:",index:r.index+r[1].length,lastIndex:r.index+r[0].length});const c=[0,0,0];let d=0;for(;;){const f=[o[c[0]],i[c[1]],s[c[2]]],h=u(u(f[0],f[1]),f[2]);if(!h)break;if(h===f[0]?c[0]++:h===f[1]?c[1]++:c[2]++,h.index{const d=/^xn--/,f=/[^\0-\x7F]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,g={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},m=35,w=Math.floor,_=String.fromCharCode;function v(H){throw new RangeError(g[H])}function k(H,O){const F=[];let W=H.length;for(;W--;)F[W]=O(H[W]);return F}function y(H,O){const F=H.split("@");let W="";F.length>1&&(W=F[0]+"@",H=F[1]),H=H.replace(h,".");const z=k(H.split("."),O).join(".");return W+z}function x(H){const O=[];let F=0;const W=H.length;for(;F=55296&&z<=56319&&FString.fromCodePoint(...H),$=function(H){return H>=48&&H<58?26+(H-48):H>=65&&H<91?H-65:H>=97&&H<123?H-97:36},S=function(H,O){return H+22+75*(H<26)-((O!=0)<<5)},I=function(H,O,F){let W=0;for(H=F?w(H/700):H>>1,H+=w(H/O);H>m*26>>1;W+=36)H=w(H/m);return w(W+(m+1)*H/(H+38))},P=function(H){const O=[],F=H.length;let W=0,z=128,U=72,q=H.lastIndexOf("-");q<0&&(q=0);for(let K=0;K=128&&v("not-basic"),O.push(H.charCodeAt(K));for(let K=q>0?q+1:0;K=F&&v("invalid-input");const Ee=$(H.charCodeAt(K++));Ee>=36&&v("invalid-input"),Ee>w((2147483647-W)/Y)&&v("overflow"),W+=Ee*Y;const de=le<=U?1:le>=U+26?26:le-U;if(Eew(2147483647/he)&&v("overflow"),Y*=he}const ne=O.length+1;U=I(W-ie,ne,ie==0),w(W/ne)>2147483647-z&&v("overflow"),z+=w(W/ne),W%=ne,O.splice(W++,0,z)}return String.fromCodePoint(...O)},D=function(H){const O=[];H=x(H);const F=H.length;let W=128,z=0,U=72;for(const ie of H)ie<128&&O.push(_(ie));const q=O.length;let K=q;for(q&&O.push("-");K=W&&Yw((2147483647-z)/ne)&&v("overflow"),z+=(ie-W)*ne,W=ie;for(const Y of H)if(Y2147483647&&v("overflow"),Y===W){let le=z;for(let Ee=36;;Ee+=36){const de=Ee<=U?1:Ee>=U+26?26:Ee-U;if(le32))return i;if(o===41){if(r===0)break;r--}s++}return t===s||r!==0||(i.str=wp(e.slice(t,s)),i.pos=s,i.ok=!0),i}var aE=D8;const zh=-2;function aJ(e,t,n,o){let s=1,i=t+1;for(;i=0&&t+1>=c)return-1;const d=l.indexOf("]",t+1);if(d<0||d>=a)return e.linkLabelNoCloseFrom=t+1,-1;const f=aJ(l,t,a,n);if(f!==zh)return f;for(e.pos=t+1;e.pos=n)return r;let l=e.charCodeAt(i);if(l!==34&&l!==39&&l!==40)return r;t++,i++,l===40&&(l=41),r.marker=l}for(;i=0?e.attrs[n][1]:null}function dJ(e,t,n){const o=k2(e,t);o<0?z8(e,[t,n]):e.attrs[o][1]=`${e.attrs[o][1]} ${n}`}var fJ=eE({attrGet:()=>cJ,attrIndex:()=>k2,attrJoin:()=>dJ,attrPush:()=>z8,attrSet:()=>uJ,parseLinkDestination:()=>D8,parseLinkLabel:()=>B8,parseLinkTitle:()=>H8});function pJ(e){return e.includes("\r")||e.includes("\0")}function cE(e){return typeof e=="string"?e:e.toString()}function hJ(e){if(e.inlineMode){const t=new bs("inline","",0);t.content=cE(e.src),t.map=[0,1],t.children=[],t.level=0,e.tokens.push(t)}else e.md&&e.md.block&&e.md.block.parse(e.src,e.md,e.env,e.tokens)}const mJ=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,gJ=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function vJ(e,t){let n=e.pos;const o=e.src;if(o.charCodeAt(n)!==60)return!1;const s=n,i=e.posMax;for(;;){if(++n>=i)return!1;const l=o.charCodeAt(n);if(l===60)return!1;if(l===62)break}const r=o.slice(s+1,n);if(gJ.test(r)){const l=e.md.normalizeLink(r);if(!e.md.validateLink(l))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",l]],a.markup="autolink",a.info="auto";const u=e.push("text","",0);u.content=e.md.normalizeLinkText(r);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=r.length+2,!0}if(mJ.test(r)){const l=e.md.normalizeLink(`mailto:${r}`);if(!e.md.validateLink(l))return!1;if(!t){const a=e.push("link_open","a",1);a.attrs=[["href",l]],a.markup="autolink",a.info="auto";const u=e.push("text","",0);u.content=e.md.normalizeLinkText(r);const c=e.push("link_close","a",-1);c.markup="autolink",c.info="auto"}return e.pos+=r.length+2,!0}return!1}var dE=vJ;function yJ(e,t){const n=e.src;let o=e.pos;if(n.charCodeAt(o)!==96)return!1;const s=o;o++;const i=e.posMax;for(;o2&&f.charCodeAt(0)===32&&f.charCodeAt(f.length-1)===32&&(f=f.slice(1,-1)),d.content=f}return e.pos=a,!0}e.backticks[c]=u}return e.backticksScanned=!0,t||(e.pending+=r),e.pos+=l,!0}var fE=yJ;function Db(e){const t={},n=e.length;if(!n)return;let o=0,s=-2;const i=[];for(let r=0;ra;u-=i[u]+1){const d=e[u];if(d.marker===l.marker&&d.open&&d.end<0){let f=!1;if((d.close||l.open)&&(d.length+l.length)%3===0&&(d.length%3!==0||l.length%3!==0)&&(f=!0),!f){const h=u>0&&!e[u-1].open?i[u-1]+1:0;i[r]=r-u+h,i[u]=h,l.open=!1,d.end=r,d.close=!1,c=-1,s=-2;break}}}c!==-1&&(t[l.marker][(l.open?3:0)+(l.length||0)%3]=c)}}function kJ(e){const t=e.tokens_meta,n=e.tokens_meta.length;Db(e.delimiters);for(let o=0;o=0;s--){const i=t[s],r=i.marker;if(r!==95&&r!==42||i.end===-1)continue;const l=t[i.end],a=i.token,u=l.token,c=s>0&&t[s-1].end===i.end+1&&t[s-1].marker===r&&t[s-1].token===a-1&&t[i.end+1].token===u+1,d=r===42?pE:hE,f=o[a];c?(f.type="strong_open",f.tag="strong",f.nesting=1,f.markup=d+d,f.content=""):(f.type="em_open",f.tag="em",f.nesting=1,f.markup=d,f.content="");const h=o[u];c?(h.type="strong_close",h.tag="strong",h.nesting=-1,h.markup=d+d,h.content=""):(h.type="em_close",h.tag="em",h.nesting=-1,h.markup=d,h.content=""),c&&(o[t[s-1].token].content="",o[t[i.end+1].token].content="",s--)}}function wJ(e){const t=e.tokens_meta,n=e.tokens_meta.length;Bb(e,e.delimiters);for(let o=0;o=48&&e<=57}function _J(e){const t=e|32;return W8(e)||t>=97&&t<=102}function gE(e){const t=e|32;return t>=97&&t<=122}function xJ(e){return gE(e)||W8(e)}function SJ(e,t,n){let o=t+2;if(o>=n)return null;let s=!1,i=7,r=o;for((e.charCodeAt(o)|32)===120&&(s=!0,i=6,o++,r=o);o=n||e.charCodeAt(o)!==59?null:e.slice(t,o+1)}function AJ(e,t,n){let o=t+1;if(o>=n||!gE(e.charCodeAt(o)))return null;for(o++;o=n||e.charCodeAt(o)!==59)return null;const s=e.slice(t,o+1);return mE(s)!==s?s:null}function MJ(e,t){const n=e.pos,o=e.posMax;if(e.src.charCodeAt(n)!==38||n+1>=o)return!1;if(e.src.charCodeAt(n+1)===35){const s=SJ(e.src,n,o);if(s){if(!t){const i=(s.charCodeAt(2)|32)===120?Number.parseInt(s.slice(3,-1),16):Number.parseInt(s.slice(2,-1),10),r=e.push("text_special","",0);r.content=v2(i)?Cp(i):Cp(65533),r.markup=s,r.info="entity"}return e.pos+=s.length,!0}}else{const s=AJ(e.src,n,o);if(s){const i=mE(s);if(!t){const r=e.push("text_special","",0);r.content=i,r.markup=s,r.info="entity"}return e.pos+=s.length,!0}}return!1}var vE=MJ;const yE=(()=>{const e=new Array(256).fill(0),t="\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-";for(let n=0;n<32;n++)e[t.charCodeAt(n)]=1;return e})(),w3=new Array(128),kE=new Array(128);for(let e=0;e<128;e++){const t=String.fromCharCode(e);w3[e]=`\\${t}`,kE[e]=yE[e]?t:w3[e]}function Hb(e,t,n){e.pending&&e.pushPending();const o=new bs("text_special","",0);o.level=e.level,o.content=t,o.markup=n,o.info="escape",e.pendingLevel=e.level,e.tokens.push(o),e.tokens_meta.push(null)}function TJ(e,t){let n=e.pos;const o=e.posMax,s=e.src;if(s.charCodeAt(n)!==92||(n++,n>=o))return!1;let i=s.charCodeAt(n);if(i===10){for(t||e.push("hardbreak","br",0),n++;n=55296&&i<=56319&&n+1=56320&&a<=57343&&n++}return e.pos=n+1,!0}let r=s.charAt(n);if(i>=55296&&i<=56319&&n+1=56320&&a<=57343&&(r+=s.charAt(n+1),n++)}const l=`\\${r}`;return Hb(e,i<256&&yE[i]?r:l,l),e.pos=n+1,!0}var bE=TJ;function EJ(e){let t,n,o=0;const s=e.tokens,i=e.tokens.length;for(t=n=0;t0&&o++,r.type==="text"&&t+1\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,wE="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",LJ=new RegExp(`^(?:${CE}|${wE}||<\\?[\\s\\S]*?\\?>|]*>|)`),$J=new RegExp(`^(?:${CE}|${wE})`);function _E(e){return e===32||e===9||e===10||e===12||e===13}function NJ(e){if(e.length<3||e.charCodeAt(0)!==60||(e.charCodeAt(1)|32)!==97)return!1;const t=e.charCodeAt(2);return t===62||_E(t)}function FJ(e){if(e.length<4||e.charCodeAt(0)!==60||e.charCodeAt(1)!==47||(e.charCodeAt(2)|32)!==97)return!1;for(let t=3;t=97&&t<=122}function OJ(e,t){if(!e.md.options.html)return!1;const n=e.posMax,o=e.pos,s=e.src;if(s.charCodeAt(o)!==60||o+2>=n)return!1;const i=s.charCodeAt(o+1);if(i!==33&&i!==63&&i!==47&&!RJ(i))return!1;const r=s.slice(o).match(LJ);if(!r)return!1;const l=r[0];if(!t){const a=e.pushSimple("html_inline","");a.content=l,NJ(l)&&e.linkLevel++,FJ(l)&&e.linkLevel--}return e.pos+=l.length,!0}var xE=OJ;function PJ(e,t){let n,o,s,i,r,l,a,u,c="";const d=e.pos,f=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;const h=e.pos+2,g=Um(e,e.pos+1,!1);if(g<0)return!1;if(i=g+1,i=f)return!1;if(l=aE(e.src,i,e.posMax),l.ok){for(c=e.md.normalizeLink(l.str),e.md.validateLink(c)?i=l.pos:c="",u=i;i=f||e.src.charCodeAt(i)!==41)return e.pos=d,!1;i++}else{if(typeof e.env.references>"u")return!1;if(i=0?s=e.src.slice(u,i++):i=g+1):i=g+1,s||(s=e.src.slice(h,g)),r=e.env.references[g2(s)],!r)return e.pos=d,!1;c=r.href,a=r.title}if(!t){o=e.src.slice(h,g);const m=[];e.md.inline.parse(o,e.md,e.env,m);const w=e.push("image","img",0);w.attrs=[["src",c],["alt",""]],w.children=m,w.content=o,a&&w.attrs.push(["title",a])}return e.pos=i,e.posMax=f,!0}var SE=PJ;function g9(e,t,n){for(;t"u")return!1;let d;if(l=r+1,l=0?(d=n.slice(h,g),d||(d=n.slice(i,r)),l=g+1):d=n.slice(i,r)}else d=n.slice(i,r);const f=e.env.references[g2(d)];if(!f)return e.pos=o,!1;a=f.href,u=f.title}if(!t){e.pos=i,e.posMax=r;const d=e.push("link_open","a",1);d.attrs=u?[["href",a],["title",u]]:[["href",a]],e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=l,e.posMax=s,!0}var AE=DJ;function ME(e){const t=e|32;return t>=97&&t<=122}function BJ(e){return e>=48&&e<=57}function HJ(e){return ME(e)||BJ(e)||e===43||e===45||e===46}function zJ(e){if(e.length===0)return null;let t=e.length-1;for(;t>=0&&HJ(e.charCodeAt(t));)t--;return t++,t>=e.length||!ME(e.charCodeAt(t))?null:e.slice(t)}function WJ(e,t,n){let o=t;for(;o0)return!1;const n=e.pos,o=e.posMax;if(n+3>o||e.src.charCodeAt(n)!==58||e.src.charCodeAt(n+1)!==47||e.src.charCodeAt(n+2)!==47)return!1;const s=zJ(e.pending);if(!s)return!1;const i=WJ(e.src,n-s.length,o),r=e.md.linkify.matchAtStart(i);if(!r)return!1;let l=r.url;if(l.length<=s.length)return!1;let a=l.length;for(;a>0&&l.charCodeAt(a-1)===42;)a--;a!==l.length&&(l=l.slice(0,a));const u=e.md.normalizeLink(l);if(!e.md.validateLink(u))return!1;if(!t){e.pending=e.pending.slice(0,-s.length);const c=e.push("link_open","a",1);c.attrs=[["href",u]],c.markup="linkify",c.info="auto";const d=e.push("text","",0);d.content=e.md.normalizeLinkText(l);const f=e.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return e.pos+=l.length-s.length,!0}function UJ(e,t){let n=e.pos;if(e.src.charCodeAt(n)!==10)return!1;const o=e.pending.length-1,s=e.posMax;if(!t)if(o>=0&&e.pending.charCodeAt(o)===32)if(o>=1&&e.pending.charCodeAt(o-1)===32){let i=o-1;for(;i>=1&&e.pending.charCodeAt(i-1)===32;)i--;e.pending=e.pending.slice(0,i),e.pushSimple("hardbreak","br")}else e.pending=e.pending.slice(0,-1),e.pushSimple("softbreak","br");else e.pushSimple("softbreak","br");for(n++;n=s||Wb(n.charCodeAt(o)))return!1;let i=o+1;for(;io-s),n=Math.floor(t.length/2);return t.length%2===0?(t[n-1]+t[n])/2:t[n]}function ZJ(e,t){return{chain:e,name:t,calls:0,hits:0,inclusiveMs:0,medianMs:0,maxMs:0,normalCalls:0,normalHits:0,silentCalls:0,silentHits:0,samples:[]}}function LE(e){const t=e;if(!t)return null;if(t.__mdtsRuleProfile)return t.__mdtsRuleProfile;if(!t.__mdtsProfileRules)return null;const n=t.__mdtsProfileRules===!0?{}:t.__mdtsProfileRules,o={enabled:!0,fixture:n.fixture,mode:n.mode,startedAt:U8(),records:Object.create(null)};return t.__mdtsRuleProfile=o,o}function Wd(e,t,n,o,s,i){const r=LE(e);if(!r)return;const l=`${t}:${n}`,a=r.records[l]??(r.records[l]=ZJ(t,n));a.calls++,a.inclusiveMs+=o,o>a.maxMs&&(a.maxMs=o),a.samples.push(o),i?(a.silentCalls++,s&&a.silentHits++):(a.normalCalls++,s&&a.normalHits++),s&&a.hits++,r.completedAt=U8()}function GJ(e){const t=LE(e);if(!t)return null;const n=Object.keys(t.records);for(let o=0;os.name===e);o>=0&&this.rules.splice(o,1),this.rules.push({name:e,fn:t,alt:n?.alt||[],enabled:!0}),this.invalidateCache()}at(e,t,n){const o=this.rules.findIndex(s=>s.name===e);if(t===void 0){if(o<0)return;const s=this.rules[o];return Object.freeze({name:s.name,fn:s.fn,alt:s.alt?Object.freeze(s.alt.slice()):void 0,enabled:s.enabled})}if(o<0)throw new Error(`Parser rule not found: ${e}`);this.rules[o].fn=t,n?.alt!==void 0&&(this.rules[o].alt=n.alt),this.invalidateCache()}before(e,t,n,o){const s=this.rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this.rules.findIndex(r=>r.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(s,0,{name:t,fn:n,alt:o?.alt||[],enabled:!0}),this.invalidateCache()}after(e,t,n,o){const s=this.rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this.rules.findIndex(r=>r.name===t);i>=0&&this.rules.splice(i,1),this.rules.splice(s+1,0,{name:t,fn:n,alt:o?.alt||[],enabled:!0}),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled||(this.rules[r].enabled=!0,s=!0)}return s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled&&(this.rules[r].enabled=!1,s=!0)}return s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this.rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}getRules(e){const t=e||"";return this.cache||this.compileCache(),this.cache.get(t)??[]}getNamedRules(e){const t=e||"";return this.namedCache||this.compileCache(),this.namedCache.get(t)??[]}compileCache(){const e=new Set([""]);for(const o of this.rules)if(o.enabled&&o.alt)for(const s of o.alt)e.add(s);const t=new Map,n=new Map;for(const o of e){const s=[],i=[];for(const r of this.rules)r.enabled&&(o!==""&&!r.alt?.includes(o)||(s.push(r.fn),i.push({name:r.name,fn:r.fn})));t.set(o,s),n.set(o,i)}this.cache=t,this.namedCache=n}},$E=class{src;md;env;tokens;tokens_meta;pos;posMax;level;pending;pendingLevel;cache;delimiters;_prev_delimiters;backticks;backticksScanned;linkLevel;linkLabelNoCloseFrom;maxNesting;constructor(e,t,n,o){this.src=e,this.md=t,this.env=n,this.tokens=o,this.tokens_meta=new Array(o.length),this.pos=0,this.posMax=e.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0,this.linkLabelNoCloseFrom=-1,this.maxNesting=t.options.maxNesting}pushPending(){const e=new bs("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}pushSimple(e,t){this.pending&&this.pushPending();const n=new bs(e,t,0);return n.level=this.level,this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(null),n}push(e,t,n){if(this.pending&&this.pushPending(),n===0)return this.pushSimple(e,t);const o=new bs(e,t,n);let s=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),o.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],s={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(o),this.tokens_meta.push(s),o}scanDelims(e,t){const{src:n,posMax:o}=this,s=n.charCodeAt(e);let i=e;for(;i0?n.charCodeAt(e-1):32,a=i@[\]\\^_`{}~]/;function jb(e,t){switch(e.src.charCodeAt(e.pos)){case 10:return EE(e,t);case 33:return SE(e,t);case 38:return vE(e,t);case 42:case 95:return C3.tokenize(e,t);case 58:return e.md.options.linkify&&TE(e,t);case 60:return dE(e,t)||xE(e,t);case 91:return AE(e,t);case 92:return bE(e,t);case 96:return fE(e,t);case 126:return _3.tokenize(e,t);default:return IE(e,t)}}function NE(e){return!YJ.test(e)}var XJ=class{ruler;ruler2;cachedRulesVersion=-1;cachedRules=[];cachedRules2Version=-1;cachedRules2=[];defaultRulerVersion;defaultRuler2Version;constructor(){this.ruler=new Ub,this.ruler2=new Ub,this.ruler.push("text",IE),this.ruler.push("linkify",TE),this.ruler.push("newline",EE),this.ruler.push("escape",bE),this.ruler.push("backticks",fE),this.ruler.push("strikethrough",_3.tokenize),this.ruler.push("emphasis",C3.tokenize),this.ruler.push("link",AE),this.ruler.push("image",SE),this.ruler.push("autolink",dE),this.ruler.push("html_inline",xE),this.ruler.push("entity",vE),this.ruler2.push("balance_pairs",bJ),this.ruler2.push("strikethrough",_3.postProcess),this.ruler2.push("emphasis",C3.postProcess),this.ruler2.push("fragments_join",IJ),this.defaultRulerVersion=this.ruler.version,this.defaultRuler2Version=this.ruler2.version}skipToken(e){const t=e.pos,n=this.getRules(),o=n.length,s=e.cache,i=s[t],r=!!e.env&&(Object.prototype.hasOwnProperty.call(e.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(e.env,"__mdtsProfileRules"));if(i!==void 0){e.pos=i;return}let l=!1;if(e.level=e.pos)throw new Error("inline rule didn't increment state.pos");break}}}else if(this.isDefaultRuleset()){if(e.level++,l=jb(e,!0),e.level--,l&&t>=e.pos)throw new Error("inline rule didn't increment state.pos")}else for(let a=0;a=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;l||e.pos++,s[t]=e.pos}tokenize(e){const t=this.getRules(),n=t.length,o=e.posMax;if(!(e.env&&(Object.prototype.hasOwnProperty.call(e.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(e.env,"__mdtsProfileRules")))){const i=this.isDefaultRuleset();for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos")}if(l){if(e.pos>=o)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending();return}const s=this.ruler.getNamedRules("");for(;e.pos=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(r){if(e.pos>=o)break;continue}e.pending+=e.src.charAt(e.pos++)}e.pending&&e.pushPending()}isDefaultRuleset(){return this.ruler.version===this.defaultRulerVersion&&this.ruler2.version===this.defaultRuler2Version}parseSource(e,t,n,o){if(typeof e=="string"&&e.length>0&&this.isDefaultRuleset()&&NE(e)){const a=new bs("text","",0);a.content=e,o.push(a);return}const s=new $E(e,t,n,o);this.tokenize(s);const i=this.getRules2(),r=i.length;if(!(s.env&&(Object.prototype.hasOwnProperty.call(s.env,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(s.env,"__mdtsProfileRules")))){for(let a=0;a0&&NE(i.content)){const r=new bs("text","",0);r.content=i.content,i.children.push(r);continue}e.md.inline.parse(i.content,e.md,e.env,i.children)}}}const QJ=/[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]/u,eQ=/[0-9a-z]/i;function tQ(e){return/^\s]/i.test(e)}function nQ(e){return/^<\/a\s*>/i.test(e)}function oQ(e,t){if(t.schema||t.index!==0||!t.raw)return t;for(let n=1;n=0;r--){const l=s[r];if(l.type==="link_close"){for(r--;r>=0&&s[r].level!==l.level&&s[r].type!=="link_open";)r--;continue}if(l.type==="html_inline"&&(tQ(l.content)&&i>0&&i--,nQ(l.content)&&i++),i>0||l.type!=="text"||!e.md.linkify.test(l.content))continue;const a=l.content;let u=(e.md.linkify.match(a)||[]).map(h=>oQ(e.md.linkify,h));if(u.length===0)continue;const c=[];let d=l.level,f=0;u.length>0&&u[0].index===0&&r>0&&s[r-1].type==="text_special"&&(u=u.slice(1));for(let h=0;hf){const x=new bs("text","",0);x.content=a.slice(f,_),x.level=d,c.push(x)}const v=new bs("link_open","a",1);v.attrs=[["href",m]],v.level=d++,v.markup="linkify",v.info="auto",c.push(v);const k=new bs("text","",0);k.content=w,k.level=d,c.push(k);const y=new bs("link_close","a",-1);y.level=--d,y.markup="linkify",y.info="auto",c.push(y),f=g.lastIndex}if(f!==0){if(f=0;n--){const o=e[n];o.type==="text"&&!t&&(o.content=o.content.replace(uQ,dQ)),o.type==="link_open"&&o.info==="auto"&&t--,o.type==="link_close"&&o.info==="auto"&&t++}}function pQ(e){let t=0;for(let n=e.length-1;n>=0;n--){const o=e[n];o.type==="text"&&!t&&FE.test(o.content)&&(o.content=o.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1—").replace(/(^|\s)--(?=\s|$)/gm,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1–")),o.type==="link_open"&&o.info==="auto"&&t--,o.type==="link_close"&&o.info==="auto"&&t++}}function hQ(e){if(e.md?.options?.typographer)for(let t=e.tokens.length-1;t>=0;t--){const n=e.tokens[t];if(n.type!=="inline")continue;const o=n.content||(Array.isArray(n.children)?n.children.map(s=>s.type==="text"?s.content:"").join(""):"");aQ.test(o)&&fQ(n.children||[]),FE.test(o)&&pQ(n.children||[])}}var mQ=class{rules=[];cache=null;namedCache=null;version=0;invalidateCache(){this.cache=null,this.namedCache=null,this.version++}push(e,t){const n=this.rules.findIndex(o=>o.name===e);n>=0&&this.rules.splice(n,1),this.rules.push({name:e,fn:t,enabled:!0}),this.invalidateCache()}at(e,t){const n=this.rules.findIndex(o=>o.name===e);if(n<0)throw new Error(`Parser rule not found: ${e}`);this.rules[n].fn=t,this.invalidateCache()}before(e,t,n){const o=this.rules.findIndex(i=>i.name===e);if(o<0)throw new Error(`Parser rule not found: ${e}`);const s=this.rules.findIndex(i=>i.name===t);s>=0&&this.rules.splice(s,1),this.rules.splice(o,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}after(e,t,n){const o=this.rules.findIndex(i=>i.name===e);if(o<0)throw new Error(`Parser rule not found: ${e}`);const s=this.rules.findIndex(i=>i.name===t);s>=0&&this.rules.splice(s,1),this.rules.splice(o+1,0,{name:t,fn:n,enabled:!0}),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled||(this.rules[r].enabled=!0,s=!0)}return s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;for(const i of n){const r=this.rules.findIndex(l=>l.name===i);if(r<0){if(!t)throw new Error(`Rules manager: invalid rule name ${i}`);continue}o.push(i),this.rules[r].enabled&&(this.rules[r].enabled=!1,s=!0)}return s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this.rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}compileCache(){this.cache=this.rules.filter(e=>e.enabled).map(e=>e.fn),this.namedCache=this.rules.filter(e=>e.enabled).map(e=>({name:e.name,fn:e.fn}))}getRules(e=""){return this.cache||this.compileCache(),this.cache}getNamedRules(e=""){return this.namedCache||this.compileCache(),this.namedCache}};const gQ=/['"]/,Vb=/['"]/g,qb="’";function lh(e,t,n){return e.slice(0,t)+n+e.slice(t+1)}function vQ(e,t){let n;const o=[],s=t.md&&t.md.options&&t.md.options.quotes||"“”‘’";for(let i=0;i=0&&!(o[n].level<=l);n--);if(o.length=n+1,r.type!=="text")continue;let a=r.content,u=0,c=a.length;e:for(;u=0)m=a.charCodeAt(d.index-1);else for(n=i-1;n>=0&&!(e[n].type==="softbreak"||e[n].type==="hardbreak");n--)if(e[n].content){m=e[n].content.charCodeAt(e[n].content.length-1);break}let w=32;if(u=48&&m<=57&&(h=f=!1),f&&h&&(f=_,h=v),!f&&!h){g&&(r.content=lh(r.content,d.index,qb));continue}if(h)for(n=o.length-1;n>=0;n--){let x=o[n];if(o[n].level=0;t--){const n=e.tokens[t];if(n.type!=="inline")continue;const o=typeof n.content=="string"?n.content:(n.children||[]).map(s=>s.content||"").join("");!gQ.test(o)||!n.children||vQ(n.children,e)}}function kQ(e){const t=e.tokens||[],n=t.length;for(let o=0;o=4||s.charCodeAt(c)!==62)return!1;if(o)return!0;const h=[],g=[],m=[],w=[],_=e.md.block.ruler.getRulesForState(e,"blockquote"),v=e.parentType;e.parentType="blockquote";let k=!1,y;for(y=t;y=d)break;if(s.charCodeAt(c++)===62&&!I){let D=a[y]+1,T,L;s.charCodeAt(c)===32?(c++,D++,L=!1,T=!0):s.charCodeAt(c)===9?(T=!0,(u[y]+D)%4===3?(c++,D++,L=!1):L=!0):T=!1;let B=D;for(h.push(i[y]),i[y]=c;c=d,g.push(u[y]),u[y]=a[y]+1+(T?1:0),m.push(a[y]),a[y]=B-D,w.push(l[y]),l[y]=c-i[y];continue}if(k)break;let P=!1;for(let D=0,T=_.length;D";const $=[t,0];M.map=$,e.md.block.tokenize(e,t,y);const S=e.push("blockquote_close","blockquote",-1);S.markup=">",e.lineMax=f,e.parentType=v,$[1]=e.line;for(let I=0;I=4){o++,s=o;continue}break}e.line=s;const i=e.push("code_block","code",0);return i.content=`${e.getLines(t,s,4+e.blkIndent,!1)} -`,i.map=[t,e.line],!0}function SQ(e,t,n,o){let s=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||s+3>i)return!1;const r=e.src.charCodeAt(s);if(r!==126&&r!==96)return!1;let l=s;s=e.skipChars(s,r);let a=s-l;if(a<3)return!1;const u=e.src.slice(l,s),c=e.src.slice(s,i);if(r===96&&c.includes(String.fromCharCode(r)))return!1;if(o)return!0;let d=t,f=!1;for(;d++,!(d>=n||(s=l=e.bMarks[d]+e.tShift[d],i=e.eMarks[d],s=4)&&(s=e.skipChars(s,r),!(s-l=4)return!1;let c=s.charCodeAt(a);if(c!==35||a>=u)return!1;let d=1;for(c=s.charCodeAt(++a);c===35&&a6||aa&&Gb(s.charCodeAt(f-1))&&(u=f),e.line=t+1;const h=e.push("heading_open",Kb[d],1);h.markup=Zb[d],h.map=[t,e.line];const g=e.push("inline","",0);g.content=s.slice(a,u).trim(),g.map=[t,e.line],g.children=[];const m=e.push("heading_close",Kb[d],-1);return m.markup=Zb[d],!0}function MQ(e){switch(e){case 9:case 32:return!0}return!1}function TQ(e,t,n,o){const s=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4)return!1;let i=e.bMarks[t]+e.tShift[t];const r=e.src.charCodeAt(i++);if(r!==42&&r!==45&&r!==95)return!1;let l=1;for(;i|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp(`^|$))`,"i"),/^$/,!0],[new RegExp(`${$J.source}\\s*$`),/^$/,!1]];function EQ(e,t,n,o){let s=e.bMarks[t]+e.tShift[t],i=e.eMarks[t];if(e.sCount[t]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(s)!==60)return!1;let r=e.src.slice(s,i),l=0;for(;l=48&&e<=57}var BE=class{src;md;env;tokens;bMarks=[];eMarks=[];tShift=[];sCount=[];bsCount=[];lineFlags=[];blkIndent=0;line=0;lineMax=0;tight=!1;ddIndent=-1;listIndent=-1;parentType="root";level=0;constructor(e,t,n,o){this.src=e,this.md=t,this.env=n,this.tokens=o;const s=this.src;let i=0,r=0,l=0,a=!1,u=0;for(let c=0,d=s.length;c0&&this.level++,this.tokens.push(o),o}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){const t=this.bMarks,n=this.tShift,o=this.eMarks;for(let s=this.lineMax;et;){const o=n.charCodeAt(--e);if(o!==9&&o!==32)return e+1}return e}skipChars(e,t){const n=this.src;for(let o=n.length;en;)if(t!==o.charCodeAt(--e))return e+1;return e}getLines(e,t,n,o){if(e>=t)return"";if(e+1===t){const c=e,d=this.bMarks[c];let f=d;const h=o?this.eMarks[c]+1:this.eMarks[c];let g=0;const m=this.src,w=this.bsCount,_=this.tShift;for(;fn?new Array(g-n+1).join(" ")+m.slice(f,h):m.slice(f,h)}const s=new Array(t-e),i=this.src,r=this.bMarks,l=this.eMarks,a=this.bsCount,u=this.tShift;for(let c=0,d=e;dn?s[c]=new Array(f-n+1).join(" ")+i.slice(g,m):s[c]=i.slice(g,m)}return s.join("")}};BE.prototype.Token=bs;function LQ(e,t,n){for(let o=t;o=s)return!1;const i=n.charCodeAt(o);switch(i){case 35:case 42:case 43:case 45:case 60:case 62:case 95:case 96:case 126:return!0}return i>=48&&i<=57?!0:LQ(n,o,s)}const Xb=["","h1","h2"];function $Q(e,t,n){const o=e.md.block.ruler.getRulesForState(e,"paragraph"),s=e.src,i=e.bMarks,r=e.tShift,l=e.eMarks,a=e.sCount,u=e.blkIndent,c=HE(e);if(a[t]-u>=4)return!1;const d=e.parentType;e.parentType="paragraph";let f=0,h,g=t+1;for(;g=x)break;if(a[g]-u>3)continue;if(a[g]>=u&&(h=s.charCodeAt(y),h===45||h===61)){let $=y+1,S=$;for(;$=x){f=h===61?1:2;break}if(S-y>1)continue}if(a[g]<0||c&&!zE(e,g,s,y,x))continue;let M=!1;for(let $=0,S=o.length;$y;){const M=s.charCodeAt(x-1);if(M!==9&&M!==32)break;x--}m=s.slice(y,x)}else m=e.getLines(t,g,u,!1).trim();e.line=g+1;const w=h===61?"=":"-",_=e.push("heading_open",Xb[f],1);_.markup=w,_.map=[t,e.line];const v=e.push("inline","",0);v.content=m,v.map=[t,e.line-1],v.children=[];const k=e.push("heading_close",Xb[f],-1);return k.markup=w,e.parentType=d,!0}function WE(e){switch(e){case 9:case 32:return!0}return!1}function Jb(e,t){const n=e.eMarks,o=e.bMarks,s=e.tShift,i=e.src,r=n[t];let l=o[t]+s[t];const a=i.charCodeAt(l++);return a!==42&&a!==45&&a!==43||l=l)return-1;let u=i.charCodeAt(a++);if(u<48||u>57)return-1;for(;;){if(a>=l)return-1;if(u=i.charCodeAt(a++),u>=48&&u<=57){if(a-r>=10)return-1;continue}if(u===41||u===46)break;return-1}return a0&&++s=4||e.listIndent>=0&&e.sCount[l]-e.listIndent>=4&&e.sCount[l]=e.blkIndent&&(u=!0);let c,d,f;const h=e.src,g=e.bMarks,m=e.tShift,w=e.eMarks,_=e.sCount,v=e.bsCount,k=g[l]+m[l];if(k>=w[l])return!1;const y=h.charCodeAt(k);if(y>=48&&y<=57){if(f=Qb(e,l),f<0||(c=!0,r=k,d=NQ(e,l,f),u&&d!==1))return!1}else if(y===42||y===45||y===43){if(f=Jb(e,l),f<0)return!1;c=!1}else return!1;if(u&&e.skipSpaces(f)>=w[l])return!1;if(o)return!0;const x=h.charCodeAt(f-1),M=String.fromCharCode(x);if(c){const T=e.push("ordered_list_open","ol",1);d!==void 0&&d!==1&&(T.attrs=[["start",String(d)]])}else e.push("bullet_list_open","ul",1);const $=[l,0];e.tokens[e.tokens.length-1].map=$,e.tokens[e.tokens.length-1].markup=M;let S=!1;const I=e.tokens.length-1,P=e.md.block.ruler.getRulesForState(e,"list"),D=e.parentType;for(e.parentType="list";l=s?H=1:H=L-T,H>4&&(H=1);const O=T+H,F=e.push("list_item_open","li",1);F.markup=M;const W=[l,0];F.map=W,c&&(F.info=f-r-1===1?FQ[h.charCodeAt(r)-48]:h.slice(r,f-1));const z=e.tight,U=e.tShift[l],q=e.sCount[l],K=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=O,e.tight=!0,e.tShift[l]=B-g[l],e.sCount[l]=L,B>=s&&e.isEmpty(l+1)?e.line=Math.min(e.line+2,n):e.md.block.tokenize(e,l,n,!0),(!e.tight||S)&&(a=!1),S=e.line-l>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=K,e.tShift[l]=U,e.sCount[l]=q,e.tight=z,e.push("list_item_close","li",-1).markup=M,l=e.line,W[1]=l,l>=n||e.sCount[l]=4)break;let ie=!1;for(let ne=0,Y=P.length;ne3||u[f]<0)continue;if(s==="list"&&u[f]>=c){const k=r[f]+l[f],y=a[f];if(k=y||eC(i.charCodeAt(k+1)))break}else if(x>=48&&x<=57&&k+1=y){M=-1;break}const $=i.charCodeAt(M++);if($>=48&&$<=57){if(M-k>=10){M=-1;break}continue}if(($===41||$===46)&&(M>=y||eC(i.charCodeAt(M))))break;M=-1;break}if(M>=0)break}}}const w=r[f]+l[f],_=a[f];if(d&&!zE(e,f,i,w,_))continue;let v=!1;for(let k=0,y=o.length;k=4||e.src.charCodeAt(s)!==91)return!1;function a(k){const y=e.lineMax;if(k>=y||e.isEmpty(k))return null;let x=!1;if(e.sCount[k]-e.blkIndent>3&&(x=!0),e.sCount[k]<0&&(x=!0),!x){const S=e.parentType;e.parentType="reference";let I=!1;for(let P=0,D=l.length;P"u"&&(e.env.references={}),typeof e.env.references[v]>"u"&&(e.env.references[v]={title:_,href:f}),e.line=r),!0):!1}function v9(e){switch(e){case 9:case 32:return!0}return!1}const BQ=65536;function y9(e,t){const n=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];return e.src.slice(n,o)}function HQ(e,t){if(e.lineFlags)return(e.lineFlags[t]&H1.Pipe)!==0;for(let n=e.bMarks[t]+e.tShift[t],o=e.eMarks[t];nn)return!1;let s=t+1;if(e.sCount[s]=4)return!1;let i=e.bMarks[s]+e.tShift[s];if(i>=e.eMarks[s])return!1;const r=e.src.charCodeAt(i++);if(r!==124&&r!==45&&r!==58||i>=e.eMarks[s])return!1;const l=e.src.charCodeAt(i++);if(l!==124&&l!==45&&l!==58&&!v9(l)||r===45&&v9(l)||!HQ(e,t))return!1;for(;i=4)return!1;u=tC(a),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();const d=u.length;if(d===0||d!==c.length)return!1;if(o)return!0;const f=e.parentType;e.parentType="table";const h=e.md.block.ruler.getRulesForState(e,"blockquote"),g=e.push("table_open","table",1),m=[t,0];g.map=m;const w=e.push("thead_open","thead",1);w.map=[t,t+1];const _=e.push("tr_open","tr",1);_.map=[t,t+1];for(let y=0;y=4||(u=tC(a),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),k+=d-u.length,k>BQ))break;if(s===t+2){const M=e.push("tbody_open","tbody",1);M.map=v=[t+2,0]}const x=e.push("tr_open","tr",1);x.map=[s,s+1];for(let M=0;Mr.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this._rules.findIndex(r=>r.name===t);i>=0&&this._rules.splice(i,1),this._rules.splice(s,0,{name:t,enabled:!0,fn:n,alt:o?.alt||[]}),this.invalidateCache()}after(e,t,n,o){const s=this._rules.findIndex(r=>r.name===e);if(s<0)throw new Error(`Parser rule not found: ${e}`);const i=this._rules.findIndex(r=>r.name===t);i>=0&&this._rules.splice(i,1),this._rules.splice(s+1,0,{name:t,enabled:!0,fn:n,alt:o?.alt||[]}),this.invalidateCache()}getRules(e){const t=e||"";return this.cache||this.compileCache(),this.cache[t]??[]}getNamedRules(e){const t=e||"";return this.namedCache||this.compileCache(),this.namedCache[t]??[]}getRulesForState(e,t){const n=e?.env;return n&&(Object.prototype.hasOwnProperty.call(n,"__mdtsRuleProfile")||Object.prototype.hasOwnProperty.call(n,"__mdtsProfileRules"))?this.getNamedRules(t).map(({name:o,fn:s})=>(i,r,l,a)=>{const u=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now(),c=s(i,r,l,a),d=typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now();return Wd(i?.env,"block",o,d-u,c,!!a),c}):this.getRules(t)}at(e,t,n){const o=this._rules.findIndex(s=>s.name===e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this._rules[o].fn=t,n?.alt&&(this._rules[o].alt=n.alt),this.invalidateCache()}enable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;return n.forEach(i=>{const r=this._rules.findIndex(l=>l.name===i);if(r===-1){if(t)return;throw new Error(`Rules manager: invalid rule name ${i}`)}o.push(i),this._rules[r].enabled||(this._rules[r].enabled=!0,s=!0)}),s&&this.invalidateCache(),o}disable(e,t){const n=Array.isArray(e)?e:[e],o=[];let s=!1;return n.forEach(i=>{const r=this._rules.findIndex(l=>l.name===i);if(r===-1){if(t)return;throw new Error(`Rules manager: invalid rule name ${i}`)}o.push(i),this._rules[r].enabled&&(this._rules[r].enabled=!1,s=!0)}),s&&this.invalidateCache(),o}enableOnly(e){const t=new Set(e);let n=!1;for(const o of this._rules){const s=t.has(o.name);o.enabled!==s&&(o.enabled=s,n=!0)}n&&this.invalidateCache()}compileCache(){const e=new Set([""]);for(const o of this._rules)if(o.enabled)for(const s of o.alt)e.add(s);const t=Object.create(null),n=Object.create(null);for(const o of e){const s=[],i=[];for(const r of this._rules)r.enabled&&(o!==""&&!r.alt.includes(o)||(s.push(r.fn),i.push({name:r.name,fn:r.fn})));t[o]=s,n[o]=i}this.cache=t,this.namedCache=n}};const uh=[["table",zQ,["paragraph","reference"]],["code",xQ],["fence",SQ,["paragraph","reference","blockquote","list"]],["blockquote",_Q,["paragraph","reference","blockquote","list"]],["hr",TQ,["paragraph","reference","blockquote","list"]],["list",OQ,["paragraph","reference","blockquote"]],["reference",DQ],["html_block",EQ,["paragraph","reference","blockquote"]],["heading",AQ,["paragraph","reference","blockquote"]],["lheading",$Q],["paragraph",PQ]];var UQ=class{ruler;cachedRulesVersion=-1;cachedRules=[];constructor(){this.ruler=new WQ;for(let e=0;e=a[c];)c++;if(e.line=c,c>=n||u[c]=i){e.line=n;break}const h=e.line;let g=!1;for(let m=0;m=e.line)throw new Error("block rule didn't increment state.line");break}if(!g)throw new Error("none of the block rules matched");e.tight=!d,r[e.line-1]+l[e.line-1]>=a[e.line-1]&&(d=!0),c=e.line,c=a[c]&&(d=!0,c++,e.line=c)}return}const f=this.ruler.getNamedRules("");for(;c=a[c];)c++;if(e.line=c,c>=n||u[c]=i){e.line=n;break}const h=e.line;let g=!1;for(let m=0;m=e.line)throw new Error("block rule didn't increment state.line");break}}if(!g)throw new Error("none of the block rules matched");e.tight=!d,r[e.line-1]+l[e.line-1]>=a[e.line-1]&&(d=!0),c=e.line,c=a[c]&&(d=!0,c++,e.line=c)}}parse(e,t,n,o){if(!e||e.length===0)return;const s=new BE(e,t,n,o);this.tokenize(s,s.line,s.lineMax)}getRules(){return this.cachedRulesVersion!==this.ruler.version&&(this.cachedRules=this.ruler.getRules(""),this.cachedRulesVersion=this.ruler.version),this.cachedRules}},UE=class{src;env;tokens;inlineMode;md;constructor(e,t,n={}){this.src=typeof e=="string"?e||"":e,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=t}};UE.prototype.Token=bs;const nC=[["normalize",lQ],["block",hJ],["inline",JJ],["linkify",sQ],["replacements",hQ],["smartquotes",yQ],["text_join",kQ]],jQ={html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",maxNesting:100},VQ={parseLinkLabel:B8,parseLinkDestination:D8,parseLinkTitle:H8};function qQ(){return{...jQ}}function KQ(){return{...VQ}}var ZQ=class{fallbackParser;lastState=null;block;inline;ruler;linkifyInstance=null;cachedCoreRulesVersion=-1;cachedCoreRules=[];cachedCoreNamedRulesVersion=-1;cachedCoreNamedRules=[];constructor(){this.block=new UQ,this.inline=new XJ,this.ruler=new mQ;for(let e=0;e@[\]\\^_`{}~]/;function jm(e){return!GQ.test(e)}function k1(e,t){const n=e.indexOf(` -`,t);return n===-1?e.length:n}function Wh(e,t,n){for(let o=t;o3)return jm(e);for(let t=0;t=o||t.charCodeAt(r)!==32)return!1;let l=r+1;for(;ll&&t.charCodeAt(a-1)===32;)a--;let u=a;for(;u>l&&t.charCodeAt(u-1)===35;)u--;if(u>l&&t.charCodeAt(u-1)===32)for(a=u-1;a>l&&t.charCodeAt(a-1)===32;)a--;const c=t.slice(l,a);if(!jm(c))return!1;const d=XQ[i],f=JQ[i],h=br("heading_open",d,1,0);h.map=[s,s+1],h.markup=f,e.push(h),e.push(j8(c,s,1));const g=br("heading_close",d,-1,0);return g.markup=f,e.push(g),!0}function eee(e,t,n){const o=br("paragraph_open","p",1,0);o.map=[n,n+1],e.push(o),e.push(j8(t,n,1)),e.push(br("paragraph_close","p",-1,0))}function tee(e,t,n){const o=e.charCodeAt(n-1);return o===32||o===9?e.slice(t,n).trim():e.slice(t,n)}function w9(e,t){for(;t=1e5?sC:C9,s="",i=!1,r=!1,l=0,a=0;for(;l"]/,iC=/[&<>"]/g,aee=/&/g,uee=/[<>"]/g,cee={"&":"&","<":"<",">":">",'"':"""};function _9(e){return cee[e]||e}function Qn(e){if(e.length===0)return"";if(e.length<32)return lee.test(e)?e.replace(iC,_9):e;const t=e.includes("&"),n=e.includes("<"),o=e.includes(">"),s=e.includes('"');return!t&&!n&&!o&&!s?e:t&&!n&&!o&&!s?e.replace(aee,"&"):t?e.replace(iC,_9):e.replace(uee,_9)}const dee=new RegExp(`${/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),fee=/^#(?:x[a-f0-9]{1,8}|\d{1,8})$/i;function jE(e){return!e.includes("\\")&&!e.includes("&")?e:e.replace(dee,(t,n,o)=>{if(n)return n;if(fee.test(o)){const i=o[1].toLowerCase()==="x"?Number.parseInt(o.slice(2),16):Number.parseInt(o.slice(1),10);return v2(i)?Cp(i):"�"}const s=E8(t);return s!==t?s:t})}const pee=/[\n!#$%&*+\-:<=>@[\]\\^_`{}~]/,hee=/[\n!"#$%&*+\-:<=>@[\]\\^_`{}~]/,mee=/"/g;function Ad(e,t){const n=e.indexOf(` -`,t);return n===-1?e.length:n}function Vm(e,t,n){for(let o=t;o=e.length||e.charCodeAt(t)===10?!1:!Vm(e,t,Ad(e,t))}function rC(e,t,n){return t+2=n||e.charCodeAt(s)!==32)return null;let i=s+1;for(;ii&&e.charCodeAt(r-1)===32;)r--;let l=r;for(;l>i&&e.charCodeAt(l-1)===35;)l--;if(l>i&&e.charCodeAt(l-1)===32)for(r=l-1;r>i&&e.charCodeAt(r-1)===32;)r--;const a=V8(e.slice(i,r));return a===null?null:`${a} -`}function lC(e,t,n){return t+1" -`;case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return null}return`
    3. ${e[t]}
    4. -`}function bee(e,t,n){const o=t+2;if(n===o+1)return kee(e,o);const s=V8(e.slice(t+2,n));return s===null?null:`
    5. ${s}
    6. -`}function Cee(e,t,n){for(;tt;){const s=e.charCodeAt(n-1);if(s!==32&&s!==9)break;n--}let o=n;for(let s=t;s`:"
      ",o.lang=i,o.open=d),{html:`${d}${Qn(c)}
      -`,nextPos:u=25e4,i=[],r={lang:null,open:""};let l="",a="",u="",c="";for(;n -`;y -`,l=_,a=v}let k=ch(e,w);for(;k${w}

      -`,u=h,c=g}const m=de.core.parse(t,n,e).tokens);let r=Uh(t,s);if(s.maxChunks&&r.length>s.maxChunks&&(r=Mee(r,s.maxChunks)),jh(t,r))return m9(n,{count:1,fallback:!0,fallbackReason:"unsafe-chunk-boundary",maxChunkChars:s.maxChunkChars,maxChunkLines:s.maxChunkLines}),zd(n,i,()=>e.core.parse(t,n,e).tokens);let l=0;const a=[];return m9(n,{count:r.length,maxChunkChars:s.maxChunkChars,maxChunkLines:s.maxChunkLines,globalStateDetected:i||void 0,globalStateFallbackDisabled:s.fallbackOnGlobalState===!1&&!!i}),zd(n,i,()=>{for(let u=0;u=3&&(c?c.marker===k&&x>=c.length&&(c=null):c={marker:k,length:x})}}const w=g-f;s+=w,i+=1,l+=1,m?(a=0,u=0):(a+=1,u+=w);const _=m;if((s>=t.maxChunkChars||i>=t.maxChunkLines)&&!c)if(_)d(g);else{const v=Math.max(10,Math.floor(t.maxChunkLines*.5)),k=Math.max(t.maxChunkChars,8e3);(a>=v||u>=k)&&d(g)}f=g}return n&&d(e.length),o}function jh(e,t,n={rangesCoverWholeSource:!0}){const o=n.rangesCoverWholeSource?t.length-1:t.length;for(let s=0;se.length||e.charCodeAt(t-1)!==10)return!1;let n=t-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;for(let o=n+1;o=0;o--)n.push(e[o]);for(;n.length;){const o=n.pop();if(o.map&&(o.map[0]+=t,o.map[1]+=t),o.children)for(let s=o.children.length-1;s>=0;s--)n.push(o.children[s])}}function Aee(e,t){for(let n=0;n=0;o--)n.push(e[o]);for(;n.length;){const o=n.pop();if(o.map&&(o.map[0]+=t,o.map[1]+=t),o.children)for(let s=o.children.length-1;s>=0;s--)n.push(o.children[s])}}function Ca(e){return e.length===0?0:Ko(e)+(e.charCodeAt(e.length-1)===10?0:1)}function Fee(e,t,n){for(let o=t;o=3&&(n?n.marker===r&&a>=n.length&&(n=null):n={marker:r,length:a})}o=s===e.length?e.length:s+1}return n!==null}function Oee(e,t){if(e.length===0||e.charCodeAt(e.length-1)!==10)return!1;let n=e.length-2;for(;n>=0&&e.charCodeAt(n)!==10;)n--;return Fee(e,n+1,e.length-1)?!Ree(e,t):!1}function Pee(e,t,n,o={}){const s=o.mode??"full",i=o.fenceAware??(s==="stream"?e.options.streamChunkFenceAware??!0:e.options.fullChunkFenceAware??!0);if(o.maxChunkChars!==void 0||o.maxChunkLines!==void 0||o.autoTune===!1){const r=o.maxChunkChars??(s==="stream"?e.options.streamChunkSizeChars??Lee:e.options.fullChunkSizeChars??Eee),l=o.maxChunkLines??(s==="stream"?e.options.streamChunkSizeLines??$ee:e.options.fullChunkSizeLines??Iee);return{maxChunkChars:r,maxChunkLines:l,holdBelowChars:r,holdBelowLines:l,fenceAware:i}}return s==="stream"?t<=5e3?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:i}:t<=2e4?{maxChunkChars:16e3,maxChunkLines:200,holdBelowChars:16e3,holdBelowLines:200,fenceAware:i}:t<=5e4?{maxChunkChars:16e3,maxChunkLines:250,holdBelowChars:16e3,holdBelowLines:250,fenceAware:i}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:i}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:i}:t<=1e5&&n<=2500?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:1e5,holdBelowLines:2500,fenceAware:i}:t<=2e5?{maxChunkChars:2e4,maxChunkLines:150,holdBelowChars:2e4,holdBelowLines:150,fenceAware:i}:t<=5e5?{maxChunkChars:32e3,maxChunkLines:350,holdBelowChars:32e3,holdBelowLines:350,fenceAware:i}:{maxChunkChars:64e3,maxChunkLines:700,holdBelowChars:64e3,holdBelowLines:700,fenceAware:i}}var jp=class{md;options;pending="";tokens=[];committedChars=0;committedLines=0;fedChunks=0;parsedChunks=0;globalStateEnv=null;markedGlobalStateReason=null;constructor(e,t={}){if(this.md=e,this.options={mode:"full",autoTune:!0,retainTokens:!0,...t},this.options.retainTokens===!1&&!this.options.onChunkTokens)throw new Error("UnboundedBuffer with retainTokens=false requires onChunkTokens")}feed(e){e&&(this.pending+=e,this.fedChunks+=1)}flushAvailable(e={}){if(!this.pending)return null;const t=this.resolveWindow(),n=Ca(this.pending);if(this.pending.length=o||n>=s}function YE(e,t,n){if(e.options.autoUnbounded===!1)return"no";if(t>=(e.options.autoUnboundedThresholdChars??qE))return"yes";const o=e.options.autoUnboundedThresholdLines??KE;return n!==void 0?n>=o?"yes":"no":t+1e.core.parse(t,n,e).tokens);const i=[],r=new jp(e,{mode:"full",...o,retainTokens:!1,onChunkTokens(l){ZE(i,l)}});if(s&&O8(n,s),r.feed(t),r.flushForce(n),s&&(P8(n),o.fallbackOnGlobalState===!1)){const l=ql(n)?.unbounded;l&&(l.globalStateDetected=s,l.globalStateFallbackDisabled=!0)}return i}const Ud=(e,t,n)=>en?n:e;function XE(e){return e.experimental?{...e,...e.experimental}:e}const cC=[{max:5e3,strategy:"discrete",maxChunkChars:32e3,maxChunkLines:150,maxChunks:8,notes:"<=5k"},{max:2e4,strategy:"discrete",maxChunkChars:24e3,maxChunkLines:200,maxChunks:12,notes:"<=20k"},{max:1e5,strategy:"plain",notes:"<=100k plain"},{max:2e5,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:150,maxChunks:12,notes:"<=200k"},{max:5e5,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:"<=500k"},{max:5e6,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:16,notes:"<=5M"}],dC=[{max:5e3,strategy:"discrete",maxChunkChars:16e3,maxChunkLines:250,maxChunks:8,notes:"<=5k"},{max:2e4,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:"<=20k"},{max:1e5,strategy:"discrete",maxChunkChars:2e4,maxChunkLines:200,maxChunks:24,notes:"<=100k"},{max:5e5,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:"<=500k"},{max:5e6,strategy:"discrete",maxChunkChars:64e3,maxChunkLines:700,maxChunks:32,notes:"<=5M"}];function JE(e,t){return{strategy:t.strategy,maxChunkChars:t.maxChunkChars,maxChunkLines:t.maxChunkLines,maxChunks:t.maxChunks,fenceAware:e,notes:t.notes}}function Wee(e,t=Math.max(0,e/40|0),n={}){const o=XE(n),s=o.fullChunkFenceAware??!0,i=o.fullChunkTargetChunks??8,r=o.fullChunkAdaptive!==!1;for(let l=0;l5e6?{strategy:"plain",fenceAware:s,notes:">5M plain"}:r?{strategy:"adaptive",maxChunkChars:Ud(Math.ceil(e/i),8e3,64e3),maxChunkLines:Ud(Math.ceil(t/i),150,700),maxChunks:Ud(Math.ceil(e/64e3),i,16),fenceAware:s,notes:"adaptive fallback"}:{strategy:"discrete",maxChunkChars:o.fullChunkSizeChars??1e4,maxChunkLines:o.fullChunkSizeLines??200,fenceAware:s,maxChunks:o.fullChunkMaxChunks}}function fC(e,t=Math.max(0,e/40|0),n={}){const o=XE(n),s=o.streamChunkFenceAware??!0,i=o.streamChunkTargetChunks??8,r=o.streamChunkAdaptive!==!1;for(let l=0;l5e6?{strategy:"plain",fenceAware:s,notes:">5M plain"}:r?{strategy:"adaptive",maxChunkChars:Ud(Math.ceil(e/i),8e3,64e3),maxChunkLines:Ud(Math.ceil(t/i),150,700),maxChunks:Ud(Math.ceil(e/64e3),i,32),fenceAware:s,notes:"adaptive fallback"}:{strategy:"discrete",maxChunkChars:o.streamChunkSizeChars??1e4,maxChunkLines:o.streamChunkSizeLines??200,maxChunks:o.streamChunkMaxChunks,fenceAware:s}}var Uee={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"]},inline2:{rules:["balance_pairs","emphasis","fragments_join"]}}},jee={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},Vee={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"]},inline2:{rules:["balance_pairs","fragments_join"]}}};function b2(e){return!!e&&(typeof e=="object"||typeof e=="function")&&typeof e.then=="function"}function Vh(e,t){if(b2(e))throw new TypeError(`Renderer rule "${t}" returned a Promise. Use renderAsync() instead.`);return e}const pC=e=>b2(e)?e:Promise.resolve(e);function W1(e){switch(e){case"alt":case"class":case"href":case"id":case"lang":case"rel":case"src":case"start":case"style":case"target":case"title":return e;default:return Qn(e)}}function Qa(e){if(!e||e.length===0)return"";const t=e[0];let n=` ${W1(t[0])}="${Qn(t[1])}"`;for(let o=1;o=e.length)return{langName:e,langAttrs:""};let n=t;for(;n${t} -`;const i=e.attrIndex("class"),r=e.attrs?e.attrs.slice():[],l=`${s.langPrefix??"language-"}${o}`;return i<0?r.push(["class",l]):(r[i]=r[i].slice(),r[i][1]+=` ${l}`),`
      ${t}
      -`}return`
      ${t}
      -`}function _p(e){return!e.attrs||e.attrs.length===0?`${Qn(e.content)}`:`${Qn(e.content)}`}function x3(e){const t=Qn(e.content);return e.attrs?`${t} -`:`
      ${t}
      -`}function qee(e,t){const n=e.attrs;if(!n||n.length===0)switch(e.type){case"paragraph_open":return`${t}

      `;case"heading_open":return`<${e.tag}>`;case"td_open":return`${t}`;case"th_open":return`${t}`;default:return null}if(n.length===1&&n[0][0]==="style"){if(e.type==="td_open")return`${t}`;if(e.type==="th_open")return`${t}`}return null}function hC(e){const t=e.attrs;return!t||t.length===0?"":t.length===1?``:t.length===2?``:``}function Kee(e){switch(e.type){case"text":case"text_special":case"softbreak":case"hardbreak":case"html_inline":case"code_inline":case"image":return!0;default:return!1}}function mC(e){switch(e.type){case"text":case"text_special":case"softbreak":case"hardbreak":case"html_inline":case"code_inline":return!0;default:return!1}}function Km(e,t){if(e.hidden)return"";const n=e.attrs,o=e.nesting,s=e.tag;if(!n||n.length===0)return o===0?t?`<${s} />`:`<${s}>`:o===-1?``:`<${s}>`;let i=(o===-1?"`}const Zee={langPrefix:"language-",xhtmlOut:!1,breaks:!1},dh=Object.prototype.hasOwnProperty,Fn={code_inline(e,t){return _p(e[t])},code_block(e,t){return x3(e[t])},fence(e,t,n,o,s){const i=e[t],r=i.info?jE(i.info).trim():"",{langName:l,langAttrs:a}=QE(r),u=n.highlight,c=Qn(i.content);if(!u)return U1(i,c,r,l,n);const d=u(i.content,l,a);return b2(d)?d.then(f=>U1(i,f||c,r,l,n)):U1(i,d||c,r,l,n)},image(e,t,n,o,s){const i=e[t],r=s.renderInlineAsText(i.children||[],n,o),l=i.attrIndex("alt");return l>=0&&i.attrs?i.attrs[l][1]=r:i.attrs?i.attrs.push(["alt",r]):i.attrs=[["alt",r]],Km(i,n.xhtmlOut===!0)},hardbreak(e,t,n){return n.xhtmlOut?`
      -`:`
      -`},softbreak(e,t,n){return n.breaks?n.xhtmlOut?`
      -`:`
      -`:` -`},text(e,t){return Qn(e[t].content)},text_special(e,t){return Qn(e[t].content)},html_block(e,t){return e[t].content},html_inline(e,t){return e[t].content}};function gC(e,t,n){const o=e.info?jE(e.info).trim():"",{langName:s,langAttrs:i}=QE(o),r=t.highlight,l=Qn(e.content);if(!r)return U1(e,l,o,s,t);const a=r(e.content,s,i);if(b2(a))throw new TypeError('Renderer rule "fence" returned a Promise. Use renderAsync() instead.');return U1(e,a||l,o,s,t)}function x9(e,t,n,o){switch(e.type){case"text":return t.text===Fn.text?e.content.length===0?"":Qn(e.content):null;case"text_special":return t.text_special===Fn.text_special?e.content.length===0?"":Qn(e.content):null;case"softbreak":return t.softbreak===Fn.softbreak?o:null;case"hardbreak":return t.hardbreak===Fn.hardbreak?n:null;case"html_inline":return t.html_inline===Fn.html_inline?e.content:null;case"code_inline":return t.code_inline===Fn.code_inline?_p(e):null;default:return null}}function Gee(e,t,n,o,s){const i=e[0];switch(i.type){case"text":if(s.text===Fn.text)return i.content.length===0?"":Qn(i.content);break;case"text_special":if(s.text_special===Fn.text_special)return i.content.length===0?"":Qn(i.content);break;case"softbreak":if(s.softbreak===Fn.softbreak)return t.breaks?t.xhtmlOut?`
      -`:`
      -`:` -`;break;case"hardbreak":if(s.hardbreak===Fn.hardbreak)return t.xhtmlOut?`
      -`:`
      -`;break;case"html_inline":if(s.html_inline===Fn.html_inline)return i.content;break;case"code_inline":if(s.code_inline===Fn.code_inline)return _p(i);break}const r=s[i.type];if(!r)return Km(i,t.xhtmlOut===!0);const l=r(e,0,t,n,o);return typeof l=="string"?l:Vh(l,i.type)}var Yee=class{rules;baseOptions;normalizedBase;constructor(e={}){this.baseOptions={...e},this.normalizedBase=this.buildNormalizedBase(),this.rules={...Fn}}set(e){return this.baseOptions={...this.baseOptions,...e},this.normalizedBase=this.buildNormalizedBase(),this}render(e,t,n){if(!Array.isArray(e))throw new TypeError("render expects token array as first argument");if(e.length===1)return this.renderSingleToken(e,e[0],t,n);const o=this.mergeOptions(t),s=n??{},i=this.rules,r=o.xhtmlOut===!0;let l,a,u,c,d,f,h="",g="",m=!1,w="";for(let _=0;_0&&e[_-1].hidden?` -`:"";if(k==="list_item_open"&&(!v.attrs||v.attrs.length===0)&&_+3${this.renderInlineTokens(S.children||[],o,s)}`,_+=3;continue}}if(_+2 -`,_+=2;continue}}}if(k==="inline"){const $=v.children||[];if($.length===1){m||(l=i.text,a=i.text_special,u=i.softbreak,c=i.hardbreak,d=i.html_inline,f=i.code_inline,h=o.xhtmlOut?`
      -`:`
      -`,g=o.breaks?h:` -`,m=!0);const S=$[0];switch(S.type){case"text":if(l===Fn.text){w+=Qn(S.content);continue}break;case"text_special":if(a===Fn.text_special){w+=Qn(S.content);continue}break;case"softbreak":if(u===Fn.softbreak){w+=g;continue}break;case"hardbreak":if(c===Fn.hardbreak){w+=h;continue}break;case"html_inline":if(d===Fn.html_inline){w+=S.content;continue}break;case"code_inline":if(f===Fn.code_inline){w+=_p(S);continue}break}}w+=this.renderInlineTokens($,o,s);continue}const x=i[k];if(!x){const $=v.attrs;if(!v.hidden){if(!$||$.length===0)switch(k){case"hr":w+=r?`


      -`:`
      -`;continue;case"heading_open":w+=`<${v.tag}>`;continue;case"heading_close":w+=` -`;continue;case"paragraph_open":w+=`${y}

      `;continue;case"paragraph_close":w+=`

      -`;continue;case"list_item_open":{const S=e[_+1];w+=y+(S&&(S.type==="inline"||S.hidden||S.nesting===-1&&S.tag==="li")?"
    7. ":`
    8. -`);continue}case"list_item_close":w+=`
    9. -`;continue;case"bullet_list_open":w+=`${y}
        -`;continue;case"bullet_list_close":w+=`
      -`;continue;case"blockquote_open":w+=y+(e[_+1]&&e[_+1].nesting===-1&&e[_+1].tag==="blockquote"?"
      ":`
      -`);continue;case"blockquote_close":w+=`
      -`;continue;case"ordered_list_open":w+=`${y}
        -`;continue;case"ordered_list_close":w+=`
      -`;continue;case"table_open":w+=`${y} -`;continue;case"table_close":w+=`
      -`;continue;case"thead_open":w+=`${y} -`;continue;case"thead_close":w+=` -`;continue;case"tbody_open":w+=`${y} -`;continue;case"tbody_close":w+=` -`;continue;case"tr_open":w+=`${y} -`;continue;case"tr_close":w+=` -`;continue;case"td_open":w+=`${y}`;continue;case"td_close":w+=` -`;continue;case"th_open":w+=`${y}`;continue;case"th_close":w+=` -`;continue}else if($.length===1){const S=$[0];if(k==="ordered_list_open"&&S[0]==="start"){w+=`${y}
        -`;continue}if(k==="td_open"&&S[0]==="style"){w+=`${y}`;continue}if(k==="th_open"&&S[0]==="style"){w+=`${y}`;continue}}}w+=this.renderToken(e,_,o);continue}if(k==="code_block"&&x===Fn.code_block){w+=x3(v);continue}if(k==="fence"&&x===Fn.fence){w+=gC(v,o);continue}if(k==="html_block"&&x===Fn.html_block){w+=v.content;continue}const M=x(e,_,o,s,this);typeof M=="string"?w+=M:w+=Vh(M,v.type)}return w}async renderAsync(e,t,n){if(!Array.isArray(e))throw new TypeError("render expects token array as first argument");const o=this.mergeOptions(t),s=n??{},i=this.rules;let r="";for(let l=0;l0&&e[t-1].hidden?` -`:"",c=a?`> -`:">";if(!l||l.length===0)return i===0?n.xhtmlOut?`${u}<${r} /${c}`:`${u}<${r}${c}`:i===-1?`${u}(n||(n={...t}),n);if(dh.call(e,"highlight")&&e.highlight!==t.highlight&&(o().highlight=e.highlight),dh.call(e,"langPrefix")){const s=e.langPrefix;s!==t.langPrefix&&(o().langPrefix=s)}if(dh.call(e,"xhtmlOut")){const s=e.xhtmlOut;s!==t.xhtmlOut&&(o().xhtmlOut=s)}if(dh.call(e,"breaks")){const s=e.breaks;s!==t.breaks&&(o().breaks=s)}return n||t}buildNormalizedBase(){return Object.freeze({...Zee,...this.baseOptions})}renderSingleToken(e,t,n,o){const s=this.rules,i=t.type;if(i==="code_block"&&s.code_block===Fn.code_block)return x3(t);if(i==="html_block"&&s.html_block===Fn.html_block)return t.content;const r=this.mergeOptions(n),l=o??{};if(i==="inline")return this.renderInlineTokens(t.children||[],r,l);const a=s[i];if(!a)return t.block?this.renderToken(e,0,r):Km(t,r.xhtmlOut===!0);if(i==="fence"&&a===Fn.fence)return gC(t,r);const u=a(e,0,r,l,this);return typeof u=="string"?u:Vh(u,i)}renderInlineTokens(e,t,n){if(!e||e.length===0)return"";const o=this.rules;if(e.length===1)return Gee(e,t,n,this,o);const s=t.xhtmlOut===!0,i=s?`
        -`:`
        -`,r=t.breaks?i:` -`,l=o.text,a=o.text_special,u=o.softbreak,c=o.hardbreak,d=o.html_inline,f=o.code_inline,h=o.link_open,g=o.link_close,m=o.em_open,w=o.em_close,_=o.strong_open,v=o.strong_close;let k="";for(let y=0;y`;if(u===Fn.softbreak&&y+3`,y+=1;continue}if(x.type==="em_open"&&!m&&!w&&y+2${I}`,y+=2;continue}}}if(x.type==="strong_open"&&!_&&!v&&y+2${I}`,y+=2;continue}}}switch(x.type){case"text":if(l===Fn.text){const S=x.content.length===0?"":Qn(x.content);if(d===Fn.html_inline&&y+1=4)return!0;continue}if(l===9){if(r+=4-r%4,i++,r>=4)return!0;continue}break}if(i0&&u<=6){if(a=3)return!0;break}default:if(l>=48&&l<=57){let a=i+1;for(;a57)break;a++}if(a=de,!oe&&he!==void 0&&(pe=Ko(e),oe=pe>=he)),oe){const G=this.parseFullDocument(e,L,n,pe,!1);return this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss(L,{area:"stream",path:"stream-full",reason:"skip-cache-large-one-shot",unbounded:!!ql(L)?.unbounded}),G.tokens}else if(W){const G=(ce,ue,Se)=>ceSe?Se:ce;pe===void 0&&(pe=Ko(e));const X=Y&&!ne?fC(e.length,pe,n.options):null,fe=X?.maxChunkChars??(z?G(Math.ceil(e.length/U),8e3,64e3):q??1e4),Ce=X?.maxChunkLines??(z?G(Math.ceil(pe/U),150,700):K??200),ge=X?.maxChunks??(z?G(Math.ceil(e.length/64e3),U,32):ie),Q=e.length>0&&e.charCodeAt(e.length-1)===10,ee=F&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&X?.strategy!=="plain";if((O||ee)&&(e.length>=fe*2||pe>=Ce*2)&&Q){const ce=qm(n,e,L,{maxChunkChars:fe,maxChunkLines:Ce,fenceAware:X?.fenceAware??le,maxChunks:ge});return this.cache={src:e,tokens:ce,env:L,lineCount:pe,lastSegment:void 0,globalStateReason:Ni(e)},this.updateCacheLineCount(this.cache,pe),this.recordChunkedParseResult(L,O?"explicit-initial-large-doc":"default-initial-large-doc"),ce}}const ve=this.parseFullDocument(e,L,n,pe);return pe=ve.lineCount,this.cache={src:e,tokens:ve.tokens,env:L,lineCount:pe,lastSegment:void 0,globalStateReason:Ni(e)},this.updateCacheLineCount(this.cache,pe),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss(L,{area:"stream",path:"stream-full",reason:"initial-parse",unbounded:!!ql(L)?.unbounded}),ve.tokens}if(e===s.src)return this.stats.total+=1,this.stats.cacheHits+=1,this.stats.lastMode="cache",ss(s.env,{area:"stream",path:"stream-cache",reason:"same-source"}),s.tokens;const i=e.startsWith(s.src)?e.slice(s.src.length):null;let r=s.globalStateReason;r===void 0&&(r=Ni(s.src),s.globalStateReason=r);const l=r?null:i!==null?this.detectGlobalStateForAppend(s,i):Ni(e),a=r||l;if(a){const L=o??s.env;aa(L);const B=Ni(e),H=this.parseFullDocument(e,L,n),O=H.tokens,F=H.lineCount;return this.cache={src:e,tokens:O,env:L,lineCount:F,lastSegment:void 0,globalStateReason:B},this.updateCacheLineCount(this.cache,F),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss(L,{area:"stream",path:"stream-full",reason:`global-state:${a}`,unbounded:!!ql(L)?.unbounded}),O}const u=n.options?.streamOptimizationMinSize??this.MIN_SIZE_FOR_OPTIMIZATION;if(s.src.length5e3?B=8:c.length>1e3?B=6:c.length>200&&(B=4),B=Math.min(B,L);let H=null;const O=n.options?.streamContextParseStrategy??"chars",F=n.options?.streamContextParseMinChars??200,W=n.options?.streamContextParseMinLines??2;let z;const U=()=>(z===void 0&&(z=Ko(c)),z),q=this.canDirectlyParseAppend(s),K=q&&this.shouldUseUnboundedAppend(e,s,c);let ie=!1;if(!q)switch(O){case"lines":ie=U()>=W;break;case"constructs":if(c.length>=F){ie=!0;break}if(Qee(c)){ie=!0;break}ie=U()>=W;break;case"chars":default:ie=c.length>=F}if(B>0&&ie){const le=this.getTailLines(s.src,B)+c;try{const Ee=this.core.parse(le,s.env,n).tokens,de=Ee.findIndex(he=>he.map&&typeof he.map[1]=="number"&&he.map[1]>B);if(de!==-1){const he=Ee.slice(de),pe=L-B;pe!==0&&this.shiftTokenLines(he,pe),H={tokens:he}}}catch{H=null}}else H=null;if(!H){const le=L;if(K)H={tokens:z1(n,c,s.env,{mode:"stream"})},le>0&&this.shiftTokenLines(H.tokens,le);else{const Ee=this.core.parse(c,s.env,n);le>0&&this.shiftTokenLines(Ee.tokens,le),H=Ee}}let ne=0;if(s.tokens.length>0&&H.tokens.length>0){const le=s.tokens[s.tokens.length-1],Ee=H.tokens[0];try{le.type==="inline"&&Ee.type==="inline"&&(Ee.children&&Ee.children.length>0&&(le.children||(le.children=[]),this.appendTokens(le.children,Ee.children)),le.content=(le.content||"")+(Ee.content||""),ne=1)}catch{ne=0}}const Y=s.tokens.length;if(H.tokens.length>ne){const le=s.tokens,Ee=H.tokens,de=Math.min(le.length,Ee.length-ne);let he=0;for(let pe=de;pe>0;pe--){let oe=!0;for(let ve=0;ve0&&(ne+=he),Ee.length>ne&&this.appendTokens(s.tokens,Ee,ne)}if(s.src=e,s.globalStateReason=null,s.lineCount=L+(z??U()),s.tokens.length>Y){const le=this.getLastSegment(s.tokens,e,Y,s.tokens.length,e.length-c.length,L);le?s.lastSegment=le:s.lastSegment=void 0}else s.lastSegment=void 0;return this.stats.total+=1,this.stats.appendHits+=1,K&&(this.stats.unboundedAppendHits=(this.stats.unboundedAppendHits||0)+1),this.stats.lastMode="append",ss(s.env,{area:"stream",path:K?"stream-unbounded-append":"stream-append",reason:K?"large-delta":"safe-append",unbounded:K}),s.tokens}const d=o??s.env,f=this.tryTailSegmentReparse(e,s,d,n);if(f)return this.stats.total+=1,this.stats.tailHits+=1,this.stats.lastMode="tail",ss(d,{area:"stream",path:"stream-tail",reason:"tail-reparse"}),f;const h=!!n.__explicitStreamChunkFallbackSetting,g=typeof n.__canUseImplicitLargeInputStrategy=="function"?n.__canUseImplicitLargeInputStrategy():!0,m=!!n.options?.streamChunkedFallback,w=!h&&!c&&g,_=m||w,v=n.options?.streamChunkAdaptive!==!1,k=n.options?.streamChunkTargetChunks??8,y=n.options?.streamChunkSizeChars,x=n.options?.streamChunkSizeLines,M=n.options?.streamChunkMaxChunks,$=!!n.__explicitStreamChunkConfig,S=n.options?.autoTuneChunks!==!1,I=n.options?.streamChunkFenceAware??!0;let P=c&&s.lineCount!==void 0?s.lineCount+Ko(c):void 0;if(_){P===void 0&&(P=Ko(e));const L=(U,q,K)=>UK?K:U,B=S&&!$?fC(e.length,P,n.options):null,H=B?.maxChunkChars??(v?L(Math.ceil(e.length/k),8e3,64e3):y??1e4),O=B?.maxChunkLines??(v?L(Math.ceil(P/k),150,700):x??200),F=B?.maxChunks??(v?L(Math.ceil(e.length/64e3),k,32):M),W=e.length>0&&e.charCodeAt(e.length-1)===10,z=w&&e.length>=this.IMPLICIT_STREAM_CHUNK_MIN_CHARS&&B?.strategy!=="plain";if((m||z)&&(e.length>=H*2||P>=O*2)&&W){const U=qm(n,e,d,{maxChunkChars:H,maxChunkLines:O,fenceAware:B?.fenceAware??I,maxChunks:F});return this.cache={src:e,tokens:U,env:d,lineCount:P,lastSegment:void 0,globalStateReason:Ni(e)},this.updateCacheLineCount(this.cache,P),this.recordChunkedParseResult(d,m?"explicit-fallback-large-doc":"default-fallback-large-doc"),U}}const D=this.parseFullDocument(e,d,n,P),T=D.tokens;return P=D.lineCount,this.cache={src:e,tokens:T,env:d,lineCount:P,lastSegment:void 0,globalStateReason:Ni(e)},this.updateCacheLineCount(this.cache,P),this.stats.total+=1,this.stats.fullParses+=1,this.stats.lastMode="full",ss(d,{area:"stream",path:"stream-full",reason:"fallback-full",unbounded:!!ql(d)?.unbounded}),T}recordChunkedParseResult(e,t){const n=ql(e)?.chunk,o=n?.fallback?String(n.fallbackReason||"global-state"):null;if(this.stats.total+=1,o){this.stats.fullParses+=1,this.stats.lastMode="full",ss(e,{area:"stream",path:"stream-full",reason:`global-state:${o}`,unbounded:!!ql(e)?.unbounded});return}this.stats.chunkedParses=(this.stats.chunkedParses||0)+1,this.stats.lastMode="chunked",ss(e,{area:"stream",path:"stream-chunked",chunked:!0,reason:t})}parseFullDocument(e,t,n,o,s=!0){const i=Ni(e);Wp(t)&&aa(t);const r=typeof n.__canUseImplicitLargeInputStrategy!="function"||n.__canUseImplicitLargeInputStrategy()?YE(n,e.length,o):"no";if(r==="yes"){const a=z1(n,e,t);return ss(t,{area:"stream",path:"stream-full",reason:"auto-unbounded-char-threshold",unbounded:!0}),{tokens:a,lineCount:o??(s?Ko(e):0)}}let l=o;if(r==="need-lines"&&(l=Ko(e),GE(n,e.length,l))){const a=z1(n,e,t);return ss(t,{area:"stream",path:"stream-full",reason:"auto-unbounded-line-threshold",unbounded:!0}),{tokens:a,lineCount:l}}return l===void 0&&(l=s?Ko(e):0),{tokens:zd(t,i,()=>this.core.parse(e,t,n).tokens),lineCount:l}}shouldUseUnboundedAppend(e,t,n){return!n||e.length=this.MIN_UNBOUNDED_APPEND_CHARS?!0:Ko(n)>=this.MIN_UNBOUNDED_APPEND_LINES}getAppendedSegment(e,t,n){if(n===null||n===void 0&&!t.startsWith(e)||!e.endsWith(` -`))return null;const o=n??t.slice(e.length);if(!o)return null;const s=o.length;if(o.charCodeAt(s-1)!==10)return null;let i=0,r=-1;for(let a=0;a=2));a++);if(i<2)return null;const l=(r===-1?o:o.slice(0,r)).trim();if(l.length===0)return null;if(/^[-=]+$/.test(l)){const a=e.slice(0,-1),u=a.lastIndexOf(` -`);if(a.slice(u+1).trim().length>0)return null}return this.endsInsideOpenFence(e)||this.mayContainReferenceDefinition(o)?null:o}tryTailSegmentReparse(e,t,n,o){const s=this.ensureLastSegment(t);if(!s||s.srcOffset<=0&&s.tokenStart<=0)return null;const i=t.src.slice(0,s.srcOffset);if(!e.startsWith(i))return null;const r=t.src.slice(s.srcOffset),l=e.slice(s.srcOffset);if(l===r)return null;const a=e.startsWith(t.src)?e.slice(t.src.length):null;if(a){const u=this.tryContainerTailAppendMerge(e,t,n,o,s,a);if(u)return u}if(this.mayContainReferenceDefinition(r)||this.mayContainReferenceDefinition(l))return null;try{const u=this.core.parse(l,n,o),c=this.getLastSegment(u.tokens,l);return s.lineStart>0&&this.shiftTokenLines(u.tokens,s.lineStart),t.src=e,t.env=n,t.globalStateReason=null,t.globalStateCarry=void 0,t.tokens.length=s.tokenStart,this.appendTokens(t.tokens,u.tokens),t.lineCount=s.lineStart+Ko(l),c?t.lastSegment={tokenStart:s.tokenStart+c.tokenStart,tokenEnd:s.tokenStart+c.tokenEnd,lineStart:s.lineStart+c.lineStart,lineEnd:s.lineStart+c.lineEnd,srcOffset:s.srcOffset+c.srcOffset}:t.lastSegment=null,t.tokens}catch{return null}}getTailLines(e,t){if(t<=0)return"";let n=t;for(let o=e.length-1;o>=0;o--)if(e.charCodeAt(o)===10&&(n--,n===0))return e.slice(o+1);return e}endsInsideOpenFence(e){const n=e.length>4e3?e.length-4e3:0,o=e.slice(n),s=o.length;let i=null,r=0;for(;r<=s;){let l=o.indexOf(` -`,r);l===-1&&(l=s);let a=r;for(;a=3&&(i?i.marker===u&&d>=i.length&&(i=null):i={marker:u,length:d})}}if(l===s)break;r=l+1}return i!==null}peek(){return this.cache?.tokens??Jee}getStats(){return{...this.stats}}appendTokens(e,t,n=0,o=t.length){for(let s=n;sS9?n.slice(n.length-S9):n,o&&(e.globalStateReason=o),o}ensureLastSegment(e){return e.lastSegment!==void 0||(e.lastSegment=this.getLastSegment(e.tokens,e.src)),e.lastSegment}getLastSegment(e,t,n=0,o=e.length,s,i){if(o<=n)return null;let r=Number.POSITIVE_INFINITY,l=-1,a=0;for(let u=o-1;u>=n;u--){const c=e[u];if(c.map&&(c.map[0]l&&(l=c.map[1])),c.nesting<0){a+=-c.nesting;continue}if(c.nesting>0){if(a-=c.nesting,c.level===0&&a<=0){const d=Number.isFinite(r)?r:c.map?.[0]??0,f=l>=d?l:c.map?.[1]??d;return{tokenStart:u,tokenEnd:o,lineStart:d,lineEnd:f,srcOffset:this.getLineStartOffset(t,d,s,i)}}continue}if(c.level===0&&a===0){const d=Number.isFinite(r)?r:c.map?.[0]??0,f=l>=d?l:c.map?.[1]??d;return{tokenStart:u,tokenEnd:o,lineStart:d,lineEnd:f,srcOffset:this.getLineStartOffset(t,d,s,i)}}}return null}getLineStartOffset(e,t,n,o){if(n!==void 0&&o!==void 0&&t>=o)return this.getLineStartOffsetFrom(e,n,t-o);if(t<=0)return 0;let s=t,i=-1;for(;s>0;){if(i=e.indexOf(` -`,i+1),i===-1)return e.length;s--}return i+1}getLineStartOffsetFrom(e,t,n){if(n<=0)return t;let o=n,s=t-1;for(;o>0;){if(s=e.indexOf(` -`,s+1),s===-1)return e.length;o--}return s+1}mayContainReferenceDefinition(e){return e.includes("]:")?/(?:^|\n)[ \t]{0,3}\[[^\]\n]+\]:/.test(e):!1}canDirectlyParseAppend(e){if(!this.endsWithBlankLine(e.src))return!1;const t=this.ensureLastSegment(e);if(!t)return!1;switch(e.tokens[t.tokenStart]?.type){case"paragraph_open":case"heading_open":case"fence":case"code_block":case"html_block":case"hr":case"table_open":return!0;default:return!1}}tryContainerTailAppendMerge(e,t,n,o,s,i){if(!i||this.mayContainReferenceDefinition(i))return null;const r=t.tokens[s.tokenStart];switch(r?.type){case"bullet_list_open":case"ordered_list_open":return this.tryListTailAppendMerge(e,t,n,o,s,i,r);case"table_open":return this.tryTableTailAppendMerge(e,t,n,o,s,i,r);default:return null}}tryListTailAppendMerge(e,t,n,o,s,i,r){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10)return null;const l=s.lineEnd-s.lineStart,a=t.src.length-s.srcOffset;if(l0&&this.shiftTokenLines(d,f);const h=this.getListParagraphMode(t.tokens,s.tokenStart,t.tokens.length,r.level),g=this.getListParagraphMode(c,0,c.length,0);(h==="loose"||g==="loose"||this.endsWithBlankLine(t.src)||(c[0]?.map?.[0]??0)>0)&&(this.setListParagraphVisibility(t.tokens,s.tokenStart,t.tokens.length,r.level,!1),this.setListParagraphVisibility(d,0,d.length,r.level,!1)),t.tokens.splice(t.tokens.length-1,0,...d),t.src=e,t.env=n,t.globalStateReason=null;const m=f+Ko(i);t.lineCount=m;const w=this.getDocLineCount(e,m);return r.map&&(r.map[1]=w),t.lastSegment={tokenStart:s.tokenStart,tokenEnd:t.tokens.length,lineStart:s.lineStart,lineEnd:w,srcOffset:s.srcOffset},t.tokens}tryTableTailAppendMerge(e,t,n,o,s,i,r){if(t.src.length===0||t.src.charCodeAt(t.src.length-1)!==10||/(?:^|\n)[ \t]*\n/.test(i))return null;const l=s.lineEnd-s.lineStart,a=t.src.length-s.srcOffset;if(l=0?d.slice(f.tbodyOpenIndex+1,f.tbodyCloseIndex):d.slice(f.tbodyOpenIndex,f.tbodyCloseIndex+1);if(g.length===0)return null;const m=s.lineEnd-2;m!==0&&this.shiftTokenLines(g,m);const w=h.tbodyCloseIndex>=0?h.tbodyCloseIndex:h.tableCloseIndex,_=t.lineCount??Ko(t.src);t.tokens.splice(w,0,...g),t.src=e,t.env=n,t.globalStateReason=null;const v=_+Ko(i);t.lineCount=v;const k=this.getDocLineCount(e,v);if(r.map&&(r.map[1]=k),h.tbodyOpenIndex>=0){const y=t.tokens[h.tbodyOpenIndex];y?.map&&(y.map[1]=k)}return t.lastSegment={tokenStart:s.tokenStart,tokenEnd:t.tokens.length,lineStart:s.lineStart,lineEnd:k,srcOffset:s.srcOffset},t.tokens}getTableHeaderContext(e){const t=e.indexOf(` -`);if(t<0)return null;const n=e.indexOf(` -`,t+1);return n<0?null:e.slice(0,n+1)}getTableBodySection(e,t,n,o){if(t<0||t>=n||e[t]?.type!=="table_open")return null;let s=-1;for(let l=n-1;l>t;l--){const a=e[l];if(a.type==="table_close"&&a.level===o){s=l;break}}if(s<0)return null;let i=-1,r=-1;for(let l=t+1;l=0){for(let l=s-1;l>i;l--){const a=e[l];if(a.type==="tbody_close"&&a.level===o+1){r=l;break}}if(r<0)return null}return{tableCloseIndex:s,tbodyOpenIndex:i,tbodyCloseIndex:r}}isSingleTopLevelContainer(e,t,n,o){if(e.length<2)return!1;const s=e[0],i=e[e.length-1];if(s.type!==t||i.type!==n||s.level!==0||i.level!==0||o!==void 0&&s.markup!==o)return!1;let r=0;for(let l=0;l0&&l0||a.nesting<0)&&(r+=a.nesting)}return r===0}getListParagraphMode(e,t,n,o){let s=!1,i=!1;const r=o+2;for(let l=t;l=0;){const o=e.charCodeAt(n);if(o===32||o===9){n--;continue}return o===10}return!0}getDocLineCount(e,t=Ko(e)){return e.length===0?0:e.charCodeAt(e.length-1)===10?t:t+1}shiftTokenLines(e,t){if(t===0)return;let n=null;for(let o=0;o=0;i--)n.push(s.children[i]);for(;n.length>0;){const i=n.pop();if(i.map&&(i.map[0]+=t,i.map[1]+=t),i.children)for(let r=i.children.length-1;r>=0;r--)n.push(i.children[r])}}}}};const yC={default:jee,zero:Vee,commonmark:Uee};function ote(e){return{core:e.core.ruler.version,block:e.block.ruler.version,inline:e.inline.ruler.version,inline2:e.inline.ruler2.version}}function ste(e,t){return e.core.ruler.version!==t.core||e.block.ruler.version!==t.block||e.inline.ruler.version!==t.inline||e.inline.ruler2.version!==t.inline2}function kC(e){return e.experimental?{...e,...e.experimental}:e}function gr(e,t){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t)&&e[t]!==void 0)return!0;const n=e.experimental;return!!n&&Object.prototype.hasOwnProperty.call(n,t)&&n[t]!==void 0}function bC(e,t,n){for(let o=0;o=4?n.quotes=[S[0],S[1],S[2],S[3]]:n.quotes=["“","”","‘","’"]}let r=bC(i?.options,s,["fullChunkSizeChars","fullChunkSizeLines","fullChunkMaxChunks"]),l=bC(i?.options,s,["streamChunkSizeChars","streamChunkSizeLines","streamChunkMaxChunks"]),a=CC(i?.options,s,"fullChunkedFallback"),u=CC(i?.options,s,"streamChunkedFallback"),c=!1,d=null,f=null;const h=new ZQ;let g=null;const m=()=>(g||(g=new Xee(n)),g);let w=null;const _=()=>(w||(w=new nte(h)),w);let v=null;const k=()=>(v||(v=new rE),v),y=S=>!c&&!!d&&!ste(S,d),x=(S,I)=>o==="default"&&!c&&g===null&&f!==null&&S.parse===f&&y(S)&&!S.stream.enabled&&I<(S.options.autoUnboundedThresholdChars??4e6)&&S.options.html===!1&&S.options.xhtmlOut===!1&&S.options.breaks===!1&&S.options.langPrefix==="language-"&&S.options.linkify===!1&&S.options.typographer===!1&&S.options.highlight===null,M=(S,I)=>o==="default"&&!c&&y(S)&&!S.stream.enabled&&!S.options.fullChunkedFallback&&I<(S.options.autoUnboundedThresholdChars??4e6)&&S.options.html===!1&&S.options.linkify===!1&&S.options.typographer===!1,$={core:h,block:h.block,inline:h.inline,get linkify(){const S=k();return Object.defineProperty(this,"linkify",{value:S,writable:!0,configurable:!0}),S},get renderer(){const S=m();return Object.defineProperty(this,"renderer",{value:S,writable:!0,configurable:!0}),S},options:n,__explicitFullChunkConfig:r,__explicitStreamChunkConfig:l,__explicitFullChunkFallbackSetting:a,__explicitStreamChunkFallbackSetting:u,__canUseImplicitLargeInputStrategy(){return y(this)},set(S){const I=kC(S);return this.options={...this.options,...I},(gr(S,"fullChunkSizeChars")||gr(S,"fullChunkSizeLines")||gr(S,"fullChunkMaxChunks"))&&(r=!0,this.__explicitFullChunkConfig=!0),(gr(S,"streamChunkSizeChars")||gr(S,"streamChunkSizeLines")||gr(S,"streamChunkMaxChunks"))&&(l=!0,this.__explicitStreamChunkConfig=!0),gr(S,"fullChunkedFallback")&&(a=!0,this.__explicitFullChunkFallbackSetting=!0),gr(S,"streamChunkedFallback")&&(u=!0,this.__explicitStreamChunkFallbackSetting=!0),g&&g.set(I),typeof I.stream=="boolean"&&(this.stream.enabled=I.stream,w&&(w.reset(),w.resetStats())),this},configure(S){const I=typeof S=="string"?yC[S]:S;if(!I)throw new Error("Wrong `markdown-it` preset, can't be empty");if(I.options&&this.set(I.options),I.components){const P=I.components;P.core?.rules&&this.core.ruler.enableOnly(P.core.rules),P.block?.rules&&this.block.ruler.enableOnly(P.block.rules),P.inline?.rules&&this.inline.ruler.enableOnly(P.inline.rules),P.inline2?.rules&&this.inline.ruler2.enableOnly(P.inline2.rules)}return this},enable(S,I){const P=Array.isArray(S)?S:[S],D=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],T=new Set;for(const L of D){if(!L)continue;const B=L.enable(P,!0);for(let H=0;H!T.has(B));if(L.length)throw new Error(`Rules manager: invalid rule name ${L.join(", ")}`)}return this},disable(S,I){const P=Array.isArray(S)?S:[S],D=[this.core?.ruler,this.block?.ruler,this.inline?.ruler,this.inline?.ruler2],T=new Set;for(const L of D){if(!L)continue;const B=L.disable(P,!0);for(let H=0;H!T.has(B));if(L.length)throw new Error(`Rules manager: invalid rule name ${L.join(", ")}`)}return this},use(S,...I){const P=typeof S=="function"?S:S&&typeof S.default=="function"?S.default:void 0;if(!P)throw new TypeError("MarkdownIt.use: plugin must be a function");const D=[this,...I],T=S;return c=!0,P.apply(T,D),this},render(S,I){let P;if(x(this,S.length)){I!==void 0&&(mi(I),P=h9("render"));const L=P?rd():0,B=P?uC(S,P):aC(S);if(P&&(P.attemptMs=rd()-L,B===null&&(P.fallbackReason="unsupported-stock-subset"),t1(I,P)),B!==null)return I!==void 0&&ss(I,{area:"render",path:"stock-fast",reason:"stock-subset"}),B}const D=I??{},T=this.parse(S,D);return P&&t1(D,P),m().render(T,this.options,D)},async renderAsync(S,I){let P;if(x(this,S.length)){I!==void 0&&(mi(I),P=h9("render"));const L=P?rd():0,B=P?uC(S,P):aC(S);if(P&&(P.attemptMs=rd()-L,B===null&&(P.fallbackReason="unsupported-stock-subset"),t1(I,P)),B!==null)return I!==void 0&&ss(I,{area:"render",path:"stock-fast",reason:"stock-subset"}),B}const D=I??{},T=this.parse(S,D);return P&&t1(D,P),m().renderAsync(T,this.options,D)},renderIterable(S,I={}){const P=this.parseIterable(S,I);return m().render(P,this.options,I)},async renderAsyncIterable(S,I={}){const P=await this.parseAsyncIterable(S,I);return m().renderAsync(P,this.options,I)},renderInline(S,I={}){const P=this.parseInline(S,I);return m().render(P,this.options,I)},validateLink:OE,normalizeLink:PE,normalizeLinkText:DE,utils:xX,helpers:{...fJ},parse(S,I){if(typeof S!="string")throw new TypeError("Input data should be a String");if(I!==void 0&&mi(I),M(this,S.length)){const L=I===void 0?void 0:h9("parse"),B=L?rd():0,H=ree(S,L);if(L&&(L.attemptMs=rd()-B,H===null&&(L.fallbackReason="unsupported-stock-subset"),t1(I,L)),H!==null)return I!==void 0&&ss(I,{area:"parse",path:"stock-fast",reason:"stock-subset"}),H}const P=I??{};let D;if(!this.stream.enabled&&!this.options.fullChunkedFallback&&y(this)){const L=YE(this,S.length);if(L==="yes"){const B=z1(this,S,P);return ss(I,{area:"parse",path:"auto-unbounded",unbounded:!0,reason:"char-threshold"}),B}L==="need-lines"&&(D=Ko(S))}if(!this.stream.enabled){const L=S.length,B=this.options.autoTuneChunks!==!1,H=r,O=!a&&y(this),F=!!this.options.fullChunkedFallback,W=O&&L>=2e5;let z;(F||W||D!==void 0)&&(z=D??Ko(S));const U=(F||W)&&B&&!H?Wee(L,z,this.options):null;if(F||W){const q=z??0;if(F?L>=(this.options.fullChunkThresholdChars??2e4)||q>=(this.options.fullChunkThresholdLines??400):W){if(U&&U.strategy!=="plain"){const K=qm(this,S,P,{maxChunkChars:U.maxChunkChars,maxChunkLines:U.maxChunkLines,fenceAware:U.fenceAware,maxChunks:U.maxChunks});return I&&wC(I,F?"explicit-full-chunk":"default-large-string"),K}if(F){const K=(oe,ve,G)=>oeG?G:oe,ie=this.options.fullChunkAdaptive!==!1,ne=this.options.fullChunkTargetChunks??8,Y=K(Math.ceil(L/ne),8e3,64e3),le=K(Math.ceil(q/ne),150,700),Ee=ie?Y:this.options.fullChunkSizeChars??1e4,de=ie?le:this.options.fullChunkSizeLines??200,he=ie?K(Math.ceil(L/64e3),ne,32):this.options.fullChunkMaxChunks,pe=qm(this,S,P,{maxChunkChars:Ee,maxChunkLines:de,fenceAware:this.options.fullChunkFenceAware??!0,maxChunks:he});return I&&wC(I,"explicit-full-chunk"),pe}}}if(D!==void 0&&y(this)&&GE(this,L,z??D)){const q=z1(this,S,P);return ss(I,{area:"parse",path:"auto-unbounded",unbounded:!0,reason:"line-threshold"}),q}}const T=Ni(S);return ss(I,{area:"parse",path:"plain",reason:"default-plain"}),zd(P,T,()=>h.parse(S,P,this).tokens)},parseIterable(S,I={}){return mi(I),Dee(this,S,I)},parseAsyncIterable(S,I={}){return mi(I),Bee(this,S,I)},parseIterableToSink(S,I,P={}){return mi(P),Hee(this,S,I,P)},parseAsyncIterableToSink(S,I,P={}){return mi(P),zee(this,S,I,P)},parseInline(S,I={}){if(typeof S!="string")throw new TypeError("Input data should be a String");mi(I),Wp(I)&&aa(I);const P=h.createState(S,I,this);return P.inlineMode=!0,h.process(P),P.tokens}};if($.stream={enabled:!!n.stream,parse(S,I){return $.stream.enabled?_().parse(S,I,$):$.parse(S,I??{})},reset(){_().reset()},peek(){return w?w.peek():[]},stats(){return w?w.getStats():{total:0,cacheHits:0,appendHits:0,unboundedAppendHits:0,tailHits:0,fullParses:0,resets:0,chunkedParses:0,lastMode:"idle"}},resetStats(){w&&w.resetStats()}},i?.components){const S=i.components;S.core?.rules&&$.core.ruler.enableOnly(S.core.rules),S.block?.rules&&$.block.ruler.enableOnly(S.block.rules),S.inline?.rules&&$.inline.ruler.enableOnly(S.inline.rules),S.inline2?.rules&&$.inline.ruler2.enableOnly(S.inline2.rules)}return d=ote($),f=$.parse,$}var rte=ite;const tI=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],lte=["a","abbr","b","bdi","bdo","button","cite","code","data","del","dfn","em","font","i","ins","kbd","label","mark","q","s","samp","small","span","strong","sub","sup","time","u","var"],nI=["article","aside","blockquote","details","div","figcaption","figure","footer","header","h1","h2","h3","h4","h5","h6","li","main","nav","ol","p","pre","section","summary","table","tbody","td","th","thead","tr","ul"],ate=["svg","g","path"],ute=["address","audio","body","canvas","caption","colgroup","datalist","dd","dialog","dl","dt","fieldset","form","head","hgroup","html","iframe","legend","map","menu","meter","noscript","object","optgroup","option","output","picture","progress","rp","rt","ruby","script","select","style","template","textarea","tfoot","title","video"],cte=["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick","ontouchstart","ontouchend","ontouchmove","ontouchcancel","onwheel","onscroll","oncopy","oncut","onpaste","oninput","oninvalid","onsearch","innerhtml","outerhtml","textcontent","innertext","srcdoc","ping"],dte=["action","data","href","src","srcset","poster","xlink:href","formaction"],fte=["script"],pte=["pre","iframe","picture","script","style","table","tbody","td","tfoot","th","thead","textarea","tr","title","video"],eu=new Set(tI),oI=new Set(nI),xp=new Set([...tI,...lte,...nI,...ate]),sI=new Set([...xp,...ute]),hte=new Set(cte),mte=new Set(dte),Vp=new Set(fte),iI=new Set(pte);function rI(e){let t="";for(const n of e){const o=n.charCodeAt(0);o<=31||o>=127&&o<=159||/\s/u.test(n)||(t+=n)}return t}const gte={amp:"&",bsol:"\\",colon:":",newline:` -`,sol:"/",tab:" "};function lI(e){return e.replace(/&(?:#(\d+)|#x([0-9a-f]+)|([a-z][a-z0-9]+));?/gi,(t,n,o,s)=>{const i=n??o;if(i){const r=Number.parseInt(i,n?10:16);try{return Number.isFinite(r)?String.fromCodePoint(r):""}catch{return""}}return gte[String(s??"").toLowerCase()]??t})}const fh=new Set(["http","https","mailto","tel"]),vte=new Set(["javascript","vbscript","data","file","ftp","blob","filesystem","intent","chrome","chrome-extension","moz-extension","ms-browser-extension","view-source"]),Lu=new Set(["http","https"]);function aI(e){return e.match(/^([a-z][a-z0-9+.-]*):/i)?.[1]?.toLowerCase()??""}const yte=/^https?:\/\//i;function kte(e){if(!yte.test(e))return!1;for(const t of e){const n=t.charCodeAt(0);if(t==="&"||n<=32||n>=127&&n<=159||n>127&&/\s/u.test(t))return!1}return!0}function bte(e,t,n){if(!j1(t,n)||!e.startsWith("file:///"))return!1;const o=e.charAt(8);return o!=="/"&&o!=="\\"}function j1(e,t){return e?(e==="a"||e==="area")&&(!t||t==="href"||t==="xlink:href"):!t||t==="href"}function Cte(e,t){return t==="href"||t==="xlink:href"?j1(e,t)?fh:Lu:t==="src"||t==="srcset"||t==="poster"||t==="action"||t==="formaction"||t==="data"?Lu:(j1(e,t),fh)}function ic(e,t={}){if(kte(e))return!1;const n=rI(lI(e)).toLowerCase(),o=String(t.tagName??"").toLowerCase(),s=String(t.attrName??"").toLowerCase();if(!n)return!1;if(n.startsWith("data:")){const r=/^data:image\/(?:png|gif|jpe?g|webp|avif|bmp);/i.test(n);return o==="img"&&s==="src"?!r:!0}if(/^[\\/]{2}/.test(n))return!0;if(n.startsWith("/")||n.startsWith("./")||n.startsWith("../")||n.startsWith("#")||n.startsWith("?"))return!1;const i=aI(n);return i?i==="file"?!bte(n,o,s):j1(o,s)?vte.has(i):!Cte(o,s).has(i):!1}function wte(e){const t=lI(String(e??"")).trim();if(!t||t.startsWith("#")||t.startsWith("/")||t.startsWith("./")||t.startsWith("../")||t.startsWith("?"))return!1;const n=aI(rI(t).toLowerCase());return n==="http"||n==="https"}function _te(e,t={}){const n=String(e??"").trim();return n?ic(n,t)?"":n:""}function _C(e){return _te(e,{tagName:"img",attrName:"src"})}function xte(e,t,n){function o(f){return f.trim().split(" ",2)[0]===t}function s(f,h,g,m,w){return f[h].nesting===1&&f[h].attrJoin("class",t),w.renderToken(f,h,g,m,w)}n=n||{};const i=3,r=n.marker||":",l=r.charCodeAt(0),a=r.length,u=n.validate||o,c=n.render||s;function d(f,h,g,m){let w,_=!1,v=f.bMarks[h]+f.tShift[h],k=f.eMarks[h];if(l!==f.src.charCodeAt(v))return!1;for(w=v+1;w<=k&&r[(w-v)%a]===f.src[w];w++);const y=Math.floor((w-v)/a);if(y=g||(v=f.bMarks[$]+f.tShift[$],k=f.eMarks[$],v=4)){for(w=v+1;w<=k&&r[(w-v)%a]===f.src[w];w++);if(!(Math.floor((w-v)/a)=2){const r=Number(i[0]),l=Number(i[1]);Number.isFinite(r)&&Number.isFinite(l)&&(s.map=[r+t,Math.min(l+t,n)])}Array.isArray(s.children)&&uI(s.children,t,n)}}function Ate(e){["admonition","info","warning","error","tip","danger","note","caution"].forEach(t=>{e.use(xte,t,{render(n,o){return n[o].nesting===1?`
        `:`
        -`}})}),e.block.ruler.before("fence","vmr_container_fallback",(t,n,o,s)=>{const i=t,r=i.bMarks[n]+i.tShift[n],l=i.eMarks[n],a=i.src.slice(r,l),u=a.match(/^:::\s*([^\s{]+)/);if(!u)return!1;const c=u[1];if(!c.trim())return!1;const d=a.slice(u[0].length).trim();let f,h;const g=d.indexOf("{"),m=g>=0?d.slice(g).trimStart():void 0;if(g===-1)f=d||void 0;else{if(f=d.slice(0,g).trim()||void 0,m?.startsWith("{")){let M=0,$=-1;for(let S=0;S0&&(h=m.slice(0,$))}h||(f=d||void 0)}if(s)return!0;const w=!!i.env.__markstreamFinal;let _=n+1,v=!1;for(;_<=o;){const M=i.bMarks[_]+i.tShift[_],$=i.eMarks[_];if(i.src.slice(M,$).trim()===":::"){v=!0;break}_++}v||(_=o);const k=i.push("vmr_container_open","div",1);if(k.attrSet("class",`vmr-container vmr-container-${c}`),k.map=[n,v?_:o],k.meta={...k.meta??{},unclosed:!v&&!w},f&&k.attrSet("data-args",f),h)try{const M=JSON.parse(h);for(const[$,S]of Object.entries(M)){const I=S!=null&&typeof S=="object";k.attrSet(`data-${$}`,I?JSON.stringify(S):String(S))}}catch{const M=Ste(h);if(M)for(const[$,S]of Object.entries(M)){const I=S!=null&&typeof S=="object";k.attrSet(`data-${$}`,I?JSON.stringify(S):String(S))}else k.attrSet("data-attrs",h)}const y=[];for(let M=n+1;M<_;M++){const $=i.bMarks[M]+i.tShift[M],S=i.eMarks[M];y.push(i.src.slice($,S))}if(y.some(M=>M.trim().length>0)){let M=y.join(` -`);M.endsWith(` -`)||(M+=` -`),M.endsWith(` - -`)||(M+=` -`);const $=i.tokens[i.tokens.length-1];$&&($.raw=M);const S=[];i.md.block.parse(M,i.md,i.env,S),uI(S,n+1,n+1+y.length),i.tokens.push(...S)}const x=i.push("vmr_container_close","div",-1);return v||(x.hidden=!0,x.map=[o,o]),i.line=v?_+1:_,!0},{alt:["paragraph","reference","blockquote","list"]})}function Gr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Yo(e){let t=!1,n=!1;for(let o=0;o")return o}return-1}function C2(e){const t=[],n=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=o[2]||o[3]||o[4]||"";t.push([s,i])}return t}const Mte=/^[a-z][a-z0-9_-]*$/;function xC(e){return Mte.test(String(e??"").trim().toLowerCase())}function xr(e){const t=String(e??"").trim();if(!t)return"";if(!t.startsWith("<"))return xC(t)?t.toLowerCase():"";let n=1;for(;n]/.test(i)?"":xC(s)?s:""}function Ec(e){if(!e||e.length===0)return[];const t=new Set,n=[];for(const o of e){const s=xr(o);!s||t.has(s)||(t.add(s),n.push(s))}return n}function Tte(...e){const t=new Set,n=[];for(const o of e)for(const s of Ec(o))t.has(s)||(t.add(s),n.push(s));return n}function Ete(e){const t=Ec(e);return{key:t.join(","),tags:t}}function cI(e){return xr(e)}function Ite(e,t){const n=String(e??""),o=xr(t);if(!o)return!1;const s=Gr(o),i=n.match(new RegExp(String.raw`^\s*<\s*${s}(?:\s[^>]*)?(\s*\/)?>`,"i"));return i?i[1]?!0:new RegExp(String.raw`<\s*\/\s*${s}\s*>`,"i").test(n):!1}function dI(e,t){const n=xr(t);return!!n&&!xp.has(n)&&!Ite(e,n)}function Lte(e,t){const n=String(e??""),o=xr(t);if(!o)return n;const s=Gr(o),i=new RegExp(String.raw`^\s*<\s*${s}(?:\s[^>]*)?>\s*`,"i"),r=new RegExp(String.raw`\s*<\s*\/\s*${s}\s*>\s*$`,"i");return n.replace(i,"").replace(r,"")}const fI=eu,$te=xp,pI=new Set(oI);pI.delete("details");const Nte=/<([A-Z][\w-]*)(?=[\s/>]|$)/gi,Fte=/<\/\s*([A-Z][\w-]*)(?=[\s/>]|$)/gi,S3=/^<\s*(?:\/\s*)?([A-Z][\w-]*)/i,Rte=/^<\s*([A-Z][\w:-]*)(?=[\s/>]|$)/i;function Zm(e){return(e.match(S3)?.[1]??"").toLowerCase()}function q8(e){return/^\s*<\s*\//.test(e)}function K8(e,t){return fI.has(t)||/\/\s*>\s*$/.test(e)}function Ote(e,t){let n=0;for(let o=0;o0&&n--;continue}K8(s,i)||n++}}return n}function SC(e,t,n=0){const o=new RegExp(String.raw`<\s*(\/?)\s*${Gr(t)}(?=[\s>/])[^>]*>`,"gi");o.lastIndex=Math.max(0,n);let s=0,i;for(;(i=o.exec(e))!==null;){const r=i[0]??"",l=!!i[1],a=!l&&/\/\s*>$/.test(r);if(l){if(s===0)return{start:i.index,end:i.index+r.length};s--;continue}a||s++}return null}function Dte(e,t){const n=new RegExp(String.raw`<\s*(\/?)\s*${Gr(t)}(?=[\s>/])[^>]*>`,"gi");let o=0,s;for(;(s=n.exec(e))!==null;){const i=s[0]??"",r=!!s[1],l=!r&&/\/\s*>$/.test(i);if(r){o>0&&o--;continue}l||o++}return o}function Gm(e){const t=e;return String(t.raw??t.content??t.markup??"")}function Bte(e){const t=e;return t.meta||(t.meta={}),t.meta}function A9(e,t,n){const o=Bte(e);o.markstreamCustomHtmlRaw=t,o.markstreamCustomHtmlInner=n}function Hte(e,t){if(!t.size)return;const n=Array.from(t,h=>new RegExp(String.raw`<\s*${Gr(h)}(?=[\s>/])`,"i")),o=[];let s=!1;const i=h=>h?n.some(g=>g.test(h)):!1,r=h=>{if(!(!h||!o.length))for(const g of o)g.raw+=h,g.inner+=h},l=()=>{!o.length||!s||(r(` -`),s=!1)},a=h=>{r(h)},u=h=>{for(let m=0;m{const g=o[o.length-1]?.tag;if(!g)return null;const m=new RegExp(String.raw`^\s*<\s*\/\s*${Gr(g)}\s*>`,"i");return h.match(m)?.[0]??null},d=h=>!!c(h),f=(h,g,m)=>{const w=m??(h.type==="html_inline"?Zm(g):"");if(!(w&&t.has(w))){r(g);return}const _=q8(g),v=!_&&K8(g,w);if(_){if(!o.length||o[o.length-1].tag!==w){r(g);return}u(g);return}if(r(g),v){A9(h,g,"");return}o.push({tag:w,token:h,raw:g,inner:""})};for(const h of e){if(h.type==="inline"&&Array.isArray(h.children)){const g=String(h.content??"");if(d(g)?s=!1:l(),!o.length&&!i(g)){s=!1;continue}let m=0,w=!0;for(const _ of h.children){const v=Gm(_),k=_.type==="html_inline"?Zm(v):"",y=k&&t.has(k);let x=v;if(w&&g&&v&&(o.length||y)){const M=g.indexOf(v,m);if(M!==-1)a(g.slice(m,M)),x=g.slice(M,M+v.length),m=M+v.length;else{if(o.length&&!y)continue;w=!1}}f(_,x,k)}w&&g&&m0;continue}if(o.length&&typeof h.content=="string"){const g=Gm(h),m=h.type==="html_block"?c(g):null;if(m){u(`${s?` -`:""}${m}`),s=o.length>0;continue}if(!h.content)continue;l(),r(h.content),s=!0}}for(const h of o)A9(h.token,h.raw,h.inner)}function zte(e){return/^\s*<\s*[!?]/.test(e)}function Wte(e){const t=new Set($te);if(e&&Array.isArray(e))for(const n of e){const o=String(n??"").trim();if(!o)continue;const s=o.match(/^[<\s/]*([A-Z][\w-]*)/i);s&&t.add(s[1].toLowerCase())}return t}function AC(e,t){if(t.has(e))return!0;for(const n of t)if(n.startsWith(e))return!0;return!1}function Ute(e,t){let n=null;for(const i of e.matchAll(Nte)){const r=i.index??-1;if(r<0)continue;const l=(i[1]??"").toLowerCase();AC(l,t)&&Yo(e.slice(r))===-1&&(!n||r")&&(!n||i")&&(!n||i{const h=f,g=new Set(n),m=Array.isArray(h.env?.__markstreamCustomHtmlTags)?h.env.__markstreamCustomHtmlTags:[];for(const k of m){const y=xr(String(k??""));y&&g.add(y)}const w=Wte(Array.from(g)),_=new Set(qte);for(const k of g)_.add(k);return{autoCloseInlineTagSet:_,commonHtmlTags:w,customTagSet:g,shouldMergeHtmlBlockTag:k=>g.has(k)||!w.has(k)||pI.has(k)}},s=f=>{if(f.type==="html_block")return String(f.content??"");if(f.type!=="inline"||!Array.isArray(f.children)||f.children.length!==1)return"";const h=f.children[0];return h?.type!=="html_block"?"":String(f.content??h.content??"")},i=(f,h)=>{f.type="html_block",f.content=h,f.raw=h,f.children=[]},r=f=>f.replace(/^(?:\r?\n)+/,""),l=f=>/^(?: {4}|\t)/.test(f),a=f=>f.replace(/^(?: {4}|\t)/gm,""),u=(f,h)=>{const g=r(f);if(!/\S/.test(g))return[];if(l(g))return[{type:"code_block",content:a(g),raw:g}];const m=g.replace(/^[\t ]+/,"");if(!m)return[];if(m.startsWith("<"))return[{type:"html_block",content:m}];const w={type:"inline",tag:"",nesting:0,content:m,children:[{type:"text",content:m,raw:m}]};return h==="paragraph"?[{type:"paragraph_open",tag:"p",nesting:1},w,{type:"paragraph_close",tag:"p",nesting:-1}]:h==="text"?[{type:"text",content:m,raw:m}]:[w]},c=(f,h,g)=>f[h-1]?.type==="paragraph_open"&&f[h+1]?.type==="paragraph_close"?"inline":g,d=(f,h)=>{const g=r(h);return!/\S/.test(g)||f.type!=="inline"||!Array.isArray(f.children)?!1:(f.content=`${String(f.content??"")}${g}`,f.children.push({type:"text",content:g,raw:g}),!0)};e.core.ruler.after("inline","fix_html_inline_streaming",f=>{const h=f.tokens??[],{commonHtmlTags:g,customTagSet:m}=o(f);for(const w of h){const _=w;if(_.type!=="inline"||!Array.isArray(_.children))continue;const v=String(_.content??""),k=_.children.length?_.children:v.includes("<")?[{type:"text",content:v,raw:v}]:null;if(k)try{const y=Vte(k,g);if(_.children=y.children,y.pendingBuffer){const x=v.lastIndexOf(y.pendingBuffer);if(x!==-1){const M=v.slice(0,x);_.content=M,typeof _.raw=="string"&&(_.raw=M)}}}catch(y){console.error("[applyFixHtmlInlineTokens] failed to fix streaming html inline",y)}}Hte(h,m)}),e.core.ruler.push("fix_html_inline_tokens",f=>{const h=f.tokens??[],{autoCloseInlineTagSet:g,customTagSet:m,shouldMergeHtmlBlockTag:w}=o(f),_=[];for(let v=0;v0){const[x,M]=_[_.length-1];if(v!==M){if(k.type==="paragraph_open"||k.type==="paragraph_close"){h.splice(v,1),v--;continue}const $=String(k.content??k.raw??"");if($){const S=h[M],I=`${String(S.content||"")} -${$}`,P=Yo(I),D=P===-1?null:SC(I,x,P+1);if(D){const T=I.slice(0,D.end),L=I.slice(D.end);S.content=T,S.loading=!1,h.splice(v,1),_.pop();const B=d(S,L)?[]:u(L,c(h,v,"paragraph"));B.length&&h.splice(v,0,...B),v--;continue}S.content=I,S.loading!==!1&&(S.loading=!0)}h.splice(v,1),v--;continue}}const y=s(k);if(y){if(zte(y))continue;const x=(y.match(/<\s*(?:\/\s*)?([^\s>/]+)/)?.[1]??"").toLowerCase(),M=/^\s*<\s*\//.test(y);if(!x||!w(x))continue;if(i(k,y),!M)x&&!new RegExp(`^\\s*<\\s*${x}\\b[^>]*\\/\\s*>`,"i").test(y)&&Dte(y,x)>0&&_.push([x,v]);else if(_.length>0&&x&&_[_.length-1][0]===x){const[,$]=_[_.length-1],S=h[$];S.content=`${String(S.content||"")} -${y}`,S.loading=!1,_.pop(),h.splice(v,1),v--}continue}else if(_.length>0){if(k.type==="paragraph_open"||k.type==="paragraph_close"){h.splice(v,1),v--;continue}const x=k.content||"",M=new RegExp(`<\\s*\\/\\s*${_[_.length-1][0]}\\s*>`,"i").test(x);if(x){const[,$]=_[_.length-1],S=h[$];S.content=`${S.content||""} -${x}`,S.loading!==!1&&(S.loading=!M)}M&&_.pop(),h.splice(v,1),v--}else continue}if(m.size>0){const v=new Map,k=new Map,y=$=>{let S=v.get($);return S||(S=new RegExp(`<\\s*${$}\\b`,"i"),v.set($,S)),S},x=$=>{let S=k.get($);return S||(S=new RegExp(`<\\s*\\/\\s*${$}\\s*>`,"i"),k.set($,S)),S},M=[];for(let $=0;$0){const D=M[M.length-1],T=h[D.index],L=S.type==="html_block"?x(D.tag).exec(I):null;if(L){const O=L.index+L[0].length,F=I.slice(0,O),W=I.slice(O);T.content=`${String(T.content??"")} -${F}`,Array.isArray(T.children)&&T.children.push({type:"html_inline",content:``,raw:``}),M.pop();const z=d(T,W)?[]:u(W,c(h,$,"paragraph"));z.length?h.splice($,1,...z):(h.splice($,1),$--);continue}if(S.type!=="inline")continue;const B=Array.isArray(S.children)?S.children:[],H=Ote(B,D.tag);if(H!==-1){const O=B.slice(0,H+1),F=B.slice(H+1),W=O.map(z=>String(z?.content??z?.raw??"")).join("");if(T.content=`${String(T.content??"")} -${W}`,Array.isArray(T.children)&&T.children.push(...O),F.length){const z=F.map(U=>String(U.content??U.raw??"")).join("");if(z.trim()){const U=z.replace(/^\s+/,"");if(d(T,z))h.splice($,1),$--;else if(U.startsWith("<"))h.splice($,1,{type:"html_block",content:U});else{const q=u(z,c(h,$,"paragraph"));h.splice($,1,...q)}}else h.splice($,1),$--}else h.splice($,1),$--;M.pop();continue}T.content=`${String(T.content??"")} -${I}`,Array.isArray(T.children)&&T.children.push(...B),h.splice($,1),$--;continue}if(S.type!=="inline")continue;const P=Array.isArray(S.children)?S.children:[];for(const D of m)if((P.length?Pte(P,D):y(D).test(I)&&!x(D).test(I)?1:0)>0){M.push({tag:D,index:$});break}}}{let v=0;for(let k=0;k0?v--:(h.splice(k,1),k--))}}for(let v=0;v/]+)/)?.[1]??"").toLowerCase();if(S.startsWith("!")||S.startsWith("?")){k.loading=!1;continue}if(m.has(S)){const H=String(k.content??""),O=Yo(H),F=O===-1?null:SC(H,S,O+1);k.loading=F?!1:k.loading!==void 0?k.loading:!0;const W=F?.start??-1,z=F?F.end-F.start:0;if(W!==-1){const U=H.slice(0,W+z);let q="";O!==-1&&O]+)))?/g;let P;for(;(P=I.exec(k.content||""))!==null;)P[1],P[2]||P[3]||P[4];const D=String(k.content??""),T=new RegExp(`<\\/\\s*${S}\\s*>`,"i").exec(D),L=T?T.index:-1,B=T?T[0].length:0;if(L!==-1){const H=D.slice(0,L+B),O=(D.slice(L+B)||"").replace(/^\s+/,"");k.children=[{type:"html_block",content:H,tag:S,loading:!1}],k.content=H,k.raw=H,O&&h.splice(v+1,0,O.startsWith("<")?{type:"html_block",content:O}:{type:"text",content:O,raw:O})}else k.children=[{type:"html_block",content:k.content,tag:S,loading:!0}];continue}if(!k||k.type!=="inline")continue;if(k.children.length===2&&k.children[0].type==="html_inline"){const S=(k.children[0].content?.match(/<([^\s>/]+)/)?.[1]??"").toLowerCase(),I=k.children[1],P=String(I?.content??"").match(/^<\s*\/\s*([^\s>]+)/)?.[1]?.toLowerCase()??"";if(I?.type==="html_inline"&&P===S)continue;g.has(S)?(k.children[0].loading=!0,k.children[0].tag=S,k.children.push({type:"html_inline",tag:S,loading:!0,content:``})):k.children=[{type:"html_block",loading:!0,tag:S,content:String(k.children[0]?.content??"")+String(k.children[1]?.content??"")}];continue}else if(k.children.length===3&&k.children[0].type==="html_inline"&&k.children[2].type==="html_inline"){const S=(k.children[0].content?.match(/<([^\s>/]+)/)?.[1]??"").toLowerCase();if(g.has(S))continue;k.children=[{type:"html_block",loading:!1,tag:S,content:k.children.map(I=>I.content).join("")}];continue}if(!k.content?.startsWith("<")||k.children?.length!==1)continue;const y=String(k.content),x=k,M=x.children[0];if(M?.type!=="html_inline"){/^<\s*(?:\/\s*)?[A-Z][\w:-]*\s*$/i.test(y)&&(x.children.length=0);continue}const $=String(M.content??y).match(Rte)?.[1]?.toLowerCase()??"";if($){if(/\/\s*>\s*$/.test(y)||fI.has($)){x.children=[{type:"html_inline",content:y}];continue}x.children.length=0}}})}function Zte(e){const t=e.trim();return!t||/^&[a-z0-9#]+;/i.test(t)?!1:!!(/^(?:const|let|var|function|class|import|export|if|for|while|return|await|async|yield|try|catch|throw|new|typeof|instanceof|switch|case|break|continue|def|ruby|perl|print|echo|true|false|null|undefined|NaN|Infinity|this)\b/.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[\d+\])*\s*\(/i.test(t)||/[a-z_$][\w$]*(?:\.[a-z_$][\w$]*|\['[^']*'\]|\["[^"]*"\]|\[[\d+\]])+/i.test(t)||/\w+\s*(?:===?|!==?|<=?|>=?|\+\+|--|&&|\|\||\?\.)/.test(t)||/^(?:!!|\+\+|--)\s*\w/.test(t)||/[\w$]+\s*(?:\+=|-=|\*=|\/=|%=|\*\*=|=)/.test(t)||/^(?:https?:\/\/|ftp:\/\/|file:\/\/|\/\/|www\.)/i.test(t)||/`[^`]*\$\{[^}]*\}[^`]*`/.test(t)||/<\/?[A-Z][a-zA-Z0-9]*/.test(t)||/<[a-z][a-z0-9]*\s[^>]+>/.test(t)||/^(["'`]).*\1\s*[;,]?$/.test(t)||/^\[[\s\S]*\]$/.test(t)||/^\{[\s\S]*\}$/.test(t)||/^\(\s*\)$/.test(t)||/[\w$]+(?:\s*[+\-*/%<>=!&|^~:]+\s*[\w$]+|\s*\.\s*[\w$]+)/.test(t)||/=>|->|::/.test(t)||/^@[\w.$]+$/.test(t)||/^(?:0x[0-9a-fA-F]+|0b[01]+|0o[0-7]+|\d+(?:\.\d*)?(?:px|em|rem|%|vh|vw|deg|s|ms)?)$/.test(t)||/^\$[\w$]+\s*[=:]/.test(t)||/\|\s*\w+|\w+\s*\|/.test(t)||/^(?:git|npm|yarn|pnpm|bun|pip|cargo|go|rust|python|node|java|mvn|gradle|docker|kubectl)\s+/.test(t)||/(?:console|window|document|Math|JSON|Date|Array|Object|String|Number|Boolean)\.[a-zA-Z]/.test(t)||/^(?:\/\/|#|\/\*|\*\/|)/.test(t)||/^(?:<<<|<<\s*['"]?\w+['"]?)/.test(t))}function Gte(e,t={}){t.enabled!==!1&&e.core.ruler.after("inline","fix_indented_code_block",n=>{const o=n.tokens??[];for(let s=0;sa.trim().length>0);if(l.length===1&&!Zte(l[0]??"")){const a=l[0]??"",u=i.level??0;o.splice(s,1,{type:"paragraph_open",tag:"p",nesting:1,level:u},{type:"inline",tag:"",nesting:0,level:u,content:a,children:[{type:"text",content:a,level:u+1,raw:a}],block:!0},{type:"paragraph_close",tag:"p",nesting:-1,level:u}),s+=2}}})}const hI=/\.([a-z0-9]{1,15})$/i,Yte=/[_()[\]{}<>]/u,Xte=/^(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/i,Jte=/[?#@]/u,Qte=/[\\/]/u,ene=/^[\p{L}\p{N}./\\-]+$/u,tne=/^[A-Za-z0-9-]{1,63}$/u,nne=/^xn--[a-z0-9-]{2,59}$/i,one=/^(?:[A-Z]{1,6}|\d{1,8})$/u,sne=/^(?=.{1,12}$)[A-Z0-9]+(?:[-.][A-Z0-9]+)*$/iu,ine=/文件名\s*[::]?|附件\s*[::]?|路径\s*[::]?|路徑\s*[::]?|文件列表\s*[::]?|文档列表\s*[::]?|文檔列表\s*[::]?|\bfile\s*names?\b\s*[::]?|\battachments?\b\s*[::]?|\bpaths?\b\s*[::]?|\bfile\s+lists?\b\s*[::]?|\bdocument\s+lists?\b\s*[::]?/iu,rne=/文件名\s*[::]?|文件\s*[::]?|附件\s*[::]?|档案\s*[::]?|檔案\s*[::]?|文档\s*[::]?|文檔\s*[::]?|资料\s*[::]?|資料\s*[::]?|路径\s*[::]?|路徑\s*[::]?|\bfile\s*name\b\s*[::]?|\battachments?\b\s*[::]?|\bfiles?\b\s*[::]?|\bdocuments?\b\s*[::]?|\bdocs?\b\s*[::]?|\bpaths?\b\s*[::]?/iu,lne=/股票代码|股票代碼|证券代码|證券代碼|(?:代码|代碼|交易所|后缀|後綴|市场|市場)(?=$|[\s::/|,,、()()])|\btickers?\b|\bsymbols?\b|\bexchanges?\b/iu,ane=2e3,une=512,cne={},dne=new Set(["ai","md","py","rs","sh","zip"]),mI=new Set(["as","bj","de","hk","l","ln","ny","pa","sh","ss","sz","t","us"]),fne=new Set([...mI,"at","ax","cn","co","it","jp","ks","mc","mx","nz","pl","sa","si","to","tw"]),pne=new Set(["com","dev","io","page","site"]),hne=new Set(["app","apk","dmg","exe","ipa","lock","log","markdown","webmanifest"]),mne=new Set(["7z","ai","astro","avi","bash","bz2","c","cjs","cpp","cs","csv","doc","docx","fish","flac","gif","go","gz","h","hpp","html","java","jpeg","jpg","js","json","jsx","kt","md","mdx","mjs","mov","mp3","mp4","pdf","php","png","ppt","pptx","ps1","py","rar","rb","rs","sh","sql","svg","swift","svelte","tar","tgz","toml","ts","tsx","txt","vue","wav","webp","xls","xlsx","xml","yaml","yml","zip","zsh"]),Xu=new Map;function MC(e,t){if(!e||e.length>une)return t;for(Xu.set(e,t);Xu.size>ane;){const n=Xu.keys().next().value;if(!n)break;Xu.delete(n)}return t}function Sp(e){return e?.filename===!0||e?.explicitFilename===!0||e?.marketTicker===!0}function M9(e,t){const n={filename:e?.filename||t?.filename,explicitFilename:e?.explicitFilename||t?.explicitFilename,marketTicker:e?.marketTicker||t?.marketTicker};return Sp(n)?n:void 0}function TC(e,t){if(!Sp(t))return e;const n=e?.__linkifyDemotionContext;return{...e,__linkifyDemotionContext:{filename:n?.filename||t?.filename,explicitFilename:n?.explicitFilename||t?.explicitFilename,marketTicker:n?.marketTicker||t?.marketTicker}}}function EC(e){const t=qp(e);return Sp(t)?t:void 0}function gne(e){return e.replace(/^[\s>*_`[\]((【《"'“‘]+/u,"").replace(/[\s<*_`\]))】》"'.。;;,,、::!?!?]+$/u,"")}function IC(e,t){if(!Sp(t))return;const n=String(e??"").trim().split(/\s+/u).map(gne).filter(Boolean);if(n.length===0)return;const o={};return t?.filename&&n.every(s=>Ym(s,{filename:!0,explicitFilename:t.explicitFilename}))&&(o.filename=!0),t?.explicitFilename&&o.filename&&(o.explicitFilename=!0),t?.marketTicker&&n.every(s=>Ym(s,{marketTicker:!0}))&&(o.marketTicker=!0),Sp(o)?o:void 0}function du(e,t=!1){let n;return{options(o){return t||o==null?TC(e,n):TC(e,M9(EC(o),IC(o,n)))},remember(o){const s=EC(o);n=t?M9(n,s):M9(s,IC(o,n))},reset(){n=void 0}}}function LC(e){return tne.test(e)&&!e.startsWith("-")&&!e.endsWith("-")}function vne(e){const t=e.split(".");if(t.length<2)return!1;const n=t[t.length-1]?.toLowerCase()??"";return LC(n)||nne.test(n)?t.every(LC):!1}function gI(e){return Array.from(e).some(t=>t.charCodeAt(0)>127)}function yne(e){return e.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0]??""}function kne(e){return e.split(".").some(t=>t.toLowerCase().startsWith("xn--"))}function vI(e,t,n){const o=yne(t);return gI(e)&&kne(o)&&String(n??"").toLowerCase().includes(o.toLowerCase())}function bne(e){if(!e)return!1;if(e.includes("文件")||e.includes("附件")||e.includes("路径")||e.includes("路徑")||e.includes("文档")||e.includes("文檔")||e.includes("档案")||e.includes("檔案")||e.includes("资料")||e.includes("資料")||e.includes("股票")||e.includes("证券")||e.includes("證券")||e.includes("代码")||e.includes("代碼")||e.includes("交易所")||e.includes("后缀")||e.includes("後綴")||e.includes("市场")||e.includes("市場"))return!0;const t=e.toLowerCase();return t.includes("file")||t.includes("attachment")||t.includes("document")||t.includes("doc")||t.includes("path")||t.includes("ticker")||t.includes("symbol")||t.includes("exchange")}function qp(e){const t=String(e??""),n=Xu.get(t);return n?(Xu.delete(t),Xu.set(t,n),n):bne(t)?MC(t,{explicitFilename:ine.test(t),filename:rne.test(t),marketTicker:lne.test(t)}):MC(t,cne)}function Cne(e){return vne(e.split(/[\\/]/)[0]??"")}function wne(e){const t=e.replace(/[^a-z]/gi,"");return t.length>=2&&t===t.toUpperCase()}function _ne(e){if(Yte.test(e)||!ene.test(e))return!0;if(Qte.test(e))return!Cne(e);const t=e.replace(hI,"");return gI(t)?!0:t.split(".").filter(Boolean).some(wne)}function xne(e,t,n){if(!(n?fne:mI).has(t))return!1;const o=e.slice(0,-(t.length+1));return o===""?e.startsWith("."):(n?sne:one).test(o)}function Ym(e,t={}){if(!e||Xte.test(e)||Jte.test(e))return!1;const n=e.match(hI);if(!n)return!1;const o=String(n[1]??"").toLowerCase();return xne(e,o,t.marketTicker===!0)?!0:mne.has(o)?!dne.has(o)||t.filename?!0:_ne(e):!!(t.explicitFilename&&pne.has(o)||t.filename&&hne.has(o))}const $C=["!"];function Ii(e){return{type:"text",content:e,raw:e}}function $u(e,t){t===1?e.push({type:"em_open",tag:"em",nesting:1}):t===2?e.push({type:"strong_open",tag:"strong",nesting:1}):t===3&&(e.push({type:"strong_open",tag:"strong",nesting:1}),e.push({type:"em_open",tag:"em",nesting:1}))}function Nu(e,t){t===1?e.push({type:"em_close",tag:"em",nesting:-1}):t===2?e.push({type:"strong_close",tag:"strong",nesting:-1}):t===3&&(e.push({type:"em_close",tag:"em",nesting:-1}),e.push({type:"strong_close",tag:"strong",nesting:-1}))}function wa(e,t,n){let o="";if(t.includes('"')){const s=t.split('"');t=s[0].trim(),o=s[1].trim()}return{type:"link",loading:n,href:t,title:o,text:e,children:[{type:"text",content:e,raw:e}],raw:`[${e}](${t})`}}function Sne(e,t){if(!(!e||!t)&&(e.href=String(e.href??"")+t,e.text=String(e.text??"")+t,e.raw=`[${e.text}](${e.href})`,Array.isArray(e.children)&&e.children.length)){const n=e.children[e.children.length-1];n?.type==="text"?(n.content=String(n.content??"")+t,n.raw=String(n.raw??"")+t):e.children.push(Ii(t))}}function NC(e,t){let n=-1;for(const o of t){const s=e.indexOf(o);s!==-1&&(n===-1||sn?.[0]==="href")?.[1];return typeof t=="string"?t:""}function Mne(e,t){if(!e)return;e.attrs=Array.isArray(e.attrs)?e.attrs:[];const n=e.attrs.findIndex(o=>o?.[0]==="href");n>=0?e.attrs[n][1]=t:e.attrs.push(["href",t])}function FC(e,t,n){let o="";for(let s=t+1;s{const n=t.tokens??[];for(let o=0;or.type==="code_inline"),o=new Map;let s=0;for(let r=0;r0&&u?RC(u):-1;if(c!==-1&&u)for(const d of u.slice(c))d==="("?s++:d===")"&&s>0&&s--}a!==-1&&(r=a);continue}if(!(l.type!=="text"||typeof l.content!="string"))for(const a of l.content)a==="("?s++:a===")"&&s>0&&s--}const i=qp(t);for(let r=0;r<=e.length-1;r++){r<0&&(r=0);const l=e[r];if(!l)break;if(l.type==="link_open"&&(l.markup==="linkify"||l.markup==="autolink")){let a=-1;for(let u=r+1;u0){const g=RC(u);g!==-1&&(d===-1||g=m.content.length){h-=m.content.length;continue}if(h<0)break;const w=m.content[h],_=m.content.slice(0,h);let v=m.content.slice(h);for(let x=g+1;x0&&(e.splice(g+1,k),a=g+1);let y=c;if(w==="!"&&f!==-1)y=c.slice(0,f);else if(v){const x=encodeURI(v);if(x&&c.endsWith(x))y=c.slice(0,c.length-x.length);else{const M=w?encodeURI(w):"",$=M?c.indexOf(M):-1;$!==-1&&(y=c.slice(0,$))}}y!==c&&Mne(l,y),v&&e.splice(a+1,0,Ii(v));break}}}if(!n){if(l?.type==="em_open"&&e[r-1]?.type==="text"&&e[r-1].content?.endsWith("*")){const a=e[r-1].content?.replace(/(\*+)$/,"")||"";e[r-1].content=a,l.type="strong_open",l.tag="strong",l.markup="**";for(let u=r+1;ud[0]==="href")?.[1]||"";if(e[r+3]?.type==="text"){const d=(e[r+3]?.content??"").indexOf(")"),f=d===-1;d===-1&&(c+=e[r+3]?.content?.slice(0,d)||"",e[r+3].content=""),a.push(wa(u,c,f));const h=e[r+3].content?.replace(/^\)\**/,"");h&&a.push(Ii(h)),e.splice(r-4,8,...a)}else a.push({type:"link",loading:!0,href:c,title:"",text:u,children:[{type:"text",content:c,raw:c}],raw:`[${u}](${c})`}),e.splice(r-4,7,...a);continue}else if(e[r-1].content==="]("&&e[r-3]?.type==="text"&&e[r-3].content?.endsWith(")"))if(e[r-2]?.type==="strong_open"){const[a,u]=e[r-3].content?.split("[**")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}else if(e[r-2]?.type==="em_open"){const[a,u]=e[r-3].content?.split("[*")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}else{const[a,u]=e[r-3].content?.split("[")||[];e[r+1].content=u||"",e[r-3].content=a||"",e[r-1].content=""}}if(l.type==="link_close"&&l.nesting===-1&&e[r-2]?.type==="link_open"&&e[r+1]?.type==="text"&&e[r-1]?.type==="text"){const a=e[r-1].content||"",u=e[r-2].attrs||[],c=u.find(_=>_[0]==="href")?.[1]||"",d=u.find(_=>_[0]==="title")?.[1]||"";let f=3,h=2;const g=(e[r-3]?.content||"").match(/^(\*+)$/),m=[];if(g){h+=1;const _=g[1].length;$u(m,_)}if(l.markup!=="linkify"&&e[r+1].type==="text"&&e[r+1]?.content?.startsWith("](")){f+=1;for(let _=r+1;_w[0]==="href")?.[1];e[r+5]?.type==="text"&&e[r+5].content==="."?(f=(m||f)+e[r+5].content,e[r+5].content=""):f=m||f,h+=3}let g=!0;if(l.nesting===-1&&(d=d.replace(/\*+$/,"")),e[r+2]?.type==="text"){const m=(e[r+2]?.content??"").indexOf(")");g=m===-1,m===-1&&(f+=e[r+2]?.content?.slice(0,m)||"",e[r+2].content="")}a.push(wa(d,f,g)),Nu(a,2),e.splice(r-2,h,...a)}if(l.type==="text"&&/\*+\[[^\]]*$/.test(l.content||"")&&e[r+1]?.type==="strong_open"&&e[r+2]?.type==="text"&&e[r+2].content==="]("&&e[r+3]?.type==="link_open"&&e[r+5]?.type==="link_close"&&e[r+6]?.type==="text"&&e[r+6].content===")"&&e[r+7]?.type==="strong_close"){const a=(l.content||"").match(/^(\*+)\[(.*)$/);if(a){const u=(a[2]||"")+a[1];let c=e[r+3]?.attrs?.find(f=>f[0]==="href")?.[1]||"";!c&&e[r+4]?.type==="text"&&(c=e[r+4].content||"");const d=[];$u(d,2),d.push(wa(u,c,!1)),Nu(d,2),e.splice(r,9,...d),r-=d.length-1;continue}}}}if(n)return e;for(let r=0;r{const n=t.tokens??[];for(let o=0;o{const n=t.tokens??[];for(let o=0;o=0&&e[g].type==="text"&&e[g].content==="";)g--;const m=e[g];let w=c+1;for(;w=0&&e[g].type==="text"&&e[g].content==="";)g--;const m=e[g];let w=c+1;for(;w{const n=t;try{const o=Wne(n.tokens??[],!!n.env?.__markstreamFinal,n.src??"");Array.isArray(o)&&(n.tokens=o)}catch(o){console.error("[applyFixTableTokens] failed to fix table tokens",o)}})}function OC(){return[{type:"table_open",tag:"table",attrs:null,map:null,children:null,content:"",markup:"",info:"",level:0,loading:!0,meta:null},{type:"thead_open",tag:"thead",attrs:null,block:!0,level:1,children:null},{type:"tr_open",tag:"tr",attrs:null,block:!0,level:2,children:null}]}function PC(){return[{type:"tr_close",tag:"tr",attrs:null,block:!0,level:2,children:null},{type:"thead_close",tag:"thead",attrs:null,block:!0,level:1,children:null},{type:"table_close",tag:"table",attrs:null,map:null,children:null,content:"",markup:"",info:"",level:0,meta:null}]}function DC(e){return[{type:"th_open",tag:"th",attrs:null,block:!0,level:3,children:null},{type:"inline",tag:"",children:null,content:e,level:4,attrs:null,block:!0},{type:"th_close",tag:"th",attrs:null,block:!0,level:3,children:null}]}function yI(e,t){if(!e.startsWith("|")||e.includes(` -`)||!e.endsWith("|"))return null;const n=e.slice(1).split("|");return n.at(-1)===""&&n.pop(),n.length>0&&n.every(o=>o.trim().length>0)?n:null}function T9(e){return yI(e)!==null}function kI(e){return/^:?-+:?$/.test(e.trim())}function Pne(e){if(!e.startsWith("|"))return!1;const t=e.slice(1).split("|");return t.at(-1)===""&&t.pop(),t.length>0&&t.every(kI)}function Dne(e){return/^(?:[::]-*|:?-+:?)?$/.test(e.trim())}function Bne(e){if(e==="")return!0;if(!e.startsWith("|"))return!1;const t=e.slice(1).split("|"),n=t.at(-1)??"";return t.slice(0,-1).every(kI)&&Dne(n)}function Hne(e){return e==="|"||e==="|:"}function zne(e){const t=yI(e);return t!==null&&t.every(n=>!n.includes(":"))}function Wne(e,t=!1,n=""){const o=[...e];if(e.length<3)return o;const s=e.length-2,i=e[s];if(i.type==="inline"){const r=String(i.content??""),l=r.split(` -`)[0]??"",[a="",u="",...c]=r.split(` -`),d=!t&&!r.includes(` -`)&&/\r?\n$/.test(n)&&T9(r);if(!t&&(r.includes(` -`)&&c.length===0&&T9(a)&&Bne(u)||d)){const f=l.slice(1,-1).split("|").map(g=>g.trim()).flatMap(g=>DC(g)),h=[...OC(),...f,...PC()];o.splice(s-1,3,...h)}else if(r.includes(` -`)&&c.length===0&&T9(a)&&Pne(u)){const f=l.slice(1,-1).split("|").map(g=>g.trim()).flatMap(g=>DC(g)),h=[...OC(),...f,...PC()];o.splice(s-1,3,...h)}else r.includes(` -`)&&c.length===0&&zne(a)&&Hne(u)&&(i.content=r.slice(0,-2),i.children.splice(2,1))}return o}function Une(e,t,n,o){const s=e.length;if(n==="$$"&&o==="$$"){let u=t;for(;u=0&&e[c]==="\\";)d++,c--;if(d%2===0)return u}u++}return-1}const i=n[n.length-1],r=o;let l=0,a=t;for(;a=0&&e[c]==="\\";)d++,c--;if(d%2===0){if(l===0)return a;l--,a+=r.length;continue}}const u=e[a];if(u==="\\"){a+=2;continue}u===i?l++:u===r[r.length-1]&&l>0&&l--,a++}return-1}var jne=Une;const Vne=["boldsymbol","mathbb","mathcal","mathfrak","mathrm","mathit","mathsf","vec","hat","bar","tilde","overline","underline","mathscr","mathnormal","operatorname","mathbf*"],Xm=Vne.map(e=>e.replace(/[.*+?^${}()|[\\]"\]/g,"\\$&")).join("|"),qne=/\\[a-z]+/i,bI="(?:\\\\|\\u0008)",Kne=new RegExp(String.raw`${bI}(?:${Xm})\s*\{[^}]+\}`,"i"),Zne=new RegExp(String.raw`(?:${bI})?(?:${Xm})\s*\{`,"i"),Gne=/\\(?:text|frac|left|right|times)/,Yne=/(?:^|[^+])\+(?!\+)|[=\-*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/,Xne=/\b[A-Z]{2,}-[A-Z]{2,}\b/i,Jne=/[A-Z]+\s*\([^)]+\)/i,Qne=/^\(\s*[a-z](?:\s*,\s*[a-z])+\s*\)$/i,eoe=/\b(?:sin|cos|tan|log|ln|exp|sqrt|frac|sum|lim|int|prod)\b/,toe=/\b\d{4}\/\d{1,2}\/\d{1,2}(?:[ T]\d{1,2}:\d{2}(?::\d{2})?)?\b/,noe={"\b":"\\b","\v":"\\v","\f":"\\f"};function ooe(e){let t="";for(const n of e)t+=noe[n]??n;return t}function Ra(e){if(!e)return!1;const t=ooe(e),n=t.trim();if(toe.test(n)||n.includes("**"))return!1;if(n.length>2e3)return!0;const o=qne.test(t),s=Kne.test(t),i=Zne.test(t),r=Gne.test(t),l=/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)_(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t)||/(?:^|[^\w\\])(?:[A-Z]|\\[A-Z]+)\^(?:\{[^}]+\}|[A-Z0-9\\])/i.test(t),a=Yne.test(t)&&!Xne.test(t),u=Jne.test(t),c=Qne.test(n),d=eoe.test(t),f=/^\([a-z]\)$/i.test(n)||/^(?:[a-z]|pi)$/i.test(n),h=/^(?:[A-Z][a-z]?(?:_\{?\d+\}?|\^\{?\d+\}?)?)+$/.test(n);return o||s||i||r||l||a||u||c||d||f||h}const CI="__markstreamMathPluginApplied",A3=80,wI=2e4,BC=wI+4096;function Z8(e){return!!e[CI]}function soe(e){e[CI]=!0}const _I=["ldots","cdots","quad","in","displaystyle","int_","lim","lim_","ce","pu","end","infty","perp","mid","operatorname","to","rightarrow","leftarrow","math","mathrm","mathit","mathbb","mathcal","mathfrak","implies","alpha","beta","gamma","delta","epsilon","lambda","sum","sum_","prod","sqrt","fbox","boxed","color","rule","edef","fcolorbox","hline","hdashline","cdot","times","pm","le","ge","neq","sin","cos","tan","log","ln","exp","frac","text","left","right"],ioe=["cdot","mathbf{","partial","mu_{"],xI=_I.slice().sort((e,t)=>t.length-e.length).map(e=>e.replace(/[.*+?^${}()|[\\]\\\]/g,"\\$&")).join("|"),SI="[ \r\b\f\v]",roe=new RegExp(`([^\\\\])(${ioe.map(e=>e).join("|")})+`,"g"),loe=/span\{([^}]+)\}/,aoe=/\\operatorname\{span\}\{((?:[^{}]|\{[^}]*\})+)\}/,uoe=/(^|[^\\])\\\r?\n/g,coe=/(^|[^\\])\\$/g,doe=/[\p{L}\p{M}\p{N}\p{Pe}\p{Pf}'′″‴|‖]/u,foe=new RegExp(`(${SI})|(${xI})\\b`,"g"),HC=new Map,zC=new Map;function poe(e){if(!e)return foe;const t=[...e];t.sort((r,l)=>l.length-r.length);const n=t.join(""),o=HC.get(n);if(o)return o;const s=`(?:${t.map(r=>r.replace(/[.*+?^${}()|[\\]\\"\]/g,"\\$&")).join("|")})`,i=new RegExp(`(${SI})|(${s})\\b`,"g");return HC.set(n,i),i}function hoe(e,t){const n=e?[]:[...t??[]];e||n.sort((l,a)=>a.length-l.length);const o=e?"__default__":n.join(""),s=zC.get(o);if(s)return s;const i=e?[Xm,xI].filter(Boolean).join("|"):[n.map(l=>l.replace(/[.*+?^${}()|[\\]\\\]/g,"\\$&")).join("|"),Xm].filter(Boolean).join("|"),r=new RegExp(`(^|[^\\\\\\w])(${i})\\s*\\{`,"g");return zC.set(o,r),r}const WC={" ":"t","\r":"r","\b":"b","\f":"f","\v":"v"};function UC(e){const t=/(^|[^\\])(__|\*\*)/g;let n=0;for(;t.exec(e)!==null;)n++;return n}function moe(e){return e.replace(/(^|[^\\])!+/gu,(t,n)=>{if(n&&doe.test(n))return t;const o=n?t.slice(n.length):t;return`${n}${"\\!".repeat(o.length)}`})}function jC(e){const t=/(^|[^\\])(__|\*\*)/g;let n,o=null;for(;(n=t.exec(e))!==null;)o={marker:n[2],index:n.index+(n[1]?.length??0)};return o}function _a(e,t){const n=t?.commands??_I,o=t?.escapeExclamation??!0,s=t?.commands==null,i=poe(s?void 0:n);let r=e.replace(i,(u,c,d,f,h)=>{if(c!==void 0&&WC[c]!==void 0)return`\\${WC[c]}`;if(d&&n.includes(d)){const g=h&&typeof f=="number"?h[f-1]:void 0;return g==="\\"||g&&/\w/.test(g)?u:`\\${d}`}return u});o&&(r=moe(r));let l=r;const a=hoe(s,s?void 0:n);return l=l.replace(a,(u,c,d)=>`${c}\\${d}{`),l=l.replace(loe,"span\\{$1\\}").replace(aoe,"\\operatorname{span}\\{$1\\}"),l=l.replace(uoe,`$1\\\\ -`),l=l.replace(coe,"$1\\\\"),l=l.replace(roe,"$1\\$2"),l}function VC(e){const t=e.trim();return!(!Ra(t)||/"[^"\n]{1,80}"\s*:\s*/.test(t)||!(/\\[a-z]+/i.test(t)||/[=+*/^<>]|\\times|\\pm|\\cdot|\\le|\\ge|\\neq/.test(t)||/[_^]/.test(t))&&/\s-\s/.test(t))}function AI(e){const t=[];let n=0;for(;n=n[0]&&t0;){if(e[i]==="\\"&&i+10;){if(e[l]==="\\"&&l+1=0&&e[n]==="\\";)o++,n--;return o%2===1}function M3(e,t){let n=t;for(;n0&&e[o-1]==="$"||o+1=l)break;const u=Jm(s,a);if(u){r=Math.max(a+Math.max(1,t.length),u[1]);continue}Kp(e,a)||i++,r=a+Math.max(1,t.length)}return i}function G8(e,t,n){const o=Mp(String(e??""));if(!o.endsWith(t))return-1;const s=o.length-t.length;if(s<=0||!Mp(o.slice(0,s)).trim()||Kp(o,s))return-1;const i=AI(o);if(Jm(i,s))return-1;const r=qC(o,t,0,s,i);if(t==="$$"){if(r%2===1)return-1}else if(r>qC(o,n,0,s,i))return-1;return s}function Ap(e){return e===" "||e===" "}function Mp(e){let t=e.length;for(;t>0&&Ap(e[t-1]);)t--;return e.slice(0,t)}function KC(e){let t=0;for(let n=0;n=48&&t<=57}function voe(e){if(e.length<3)return!1;const t=e[0];if(t!=="-"&&t!=="*"&&t!=="_"&&t!=="=")return!1;let n=0;for(let o=0;o=3}function yoe(e){const t=e.trim();if(!t)return!1;let n=0;t[n]===":"&&n++;let o=0;for(;t[n]==="-";)o++,n++;return o<3?!1:(t[n]===":"&&n++,n===t.length)}function koe(e){if(!e.includes("|"))return!1;const t=e[0]==="|"?e.slice(1):e;return(t.endsWith("|")?t.slice(0,-1):t).split("|").every(yoe)}function boe(e){let t=0;if(!ZC(e[t]))return!1;for(;ZC(e[t]);)t++;return e[t]!=="."&&e[t]!==")"?!1:Ap(e[t+1])}function MI(e){const t=e.trimStart();if(!t||t.startsWith("```")||t.startsWith("~~~")||t.startsWith(":::")||t[0]===">"||t[0]==="<")return!0;if(t[0]==="#"){let n=0;for(;t[n]==="#";)n++;if(n>=1&&n<=6&&Ap(t[n]))return!0}return!!((t[0]==="-"||t[0]==="+"||t[0]==="*")&&Ap(t[1])||boe(t)||voe(t)||koe(t))}function GC(e,t){return e?t?`${e} -${t}`:e:t}function T3(e){const t=String(e??"").trim();return t?Ra(t):!1}function YC(e){let t=0;for(let n=0;nA3){h=!0;break}const m=s[g],w=gd(m,c);if(w!==-1){const _=GC(f,m.slice(0,w));if(!T3(_)){h=!0;break}const v=m.slice(w+c.length),k=v.trim()?`suffix:${YC(v)}`:"nosuffix";return["closed",u,o+l,d,o+g,w,YC(_),k].join(":")}if(MI(m)){h=!0;break}if(f=GC(f,m),f.length>wI){h=!0;break}}if(!h&&T3(f))return["pending",u,o+l,d].join(":")}}return null}function I9(e,t){const n=String(e??"").trim();return!n||!/^\d[\d,.]*\s*[~~-]\s*$/.test(n)?!1:/\d/.test(String(t??""))}function woe(e){const t=String(e??"").trimStart(),n=t.match(/^\d+(?:,\d{3})*(?:\.\d+)?/);if(!n)return!1;const o=t.slice(n[0].length);return/^\s*(?:[+\-*/^_=<>]|\\[a-z]+)/i.test(o)?!1:o===""||/^[)\s,.!?;:]/.test(o)}function L9(e){const t=String(e??"").trim();return t?/^(?:\.{3,}|…+)$/.test(t):!1}function _oe(e,t){soe(e);const n=(r,l,a)=>{const u=String(l??"").replace(/^[\t ]+/,"").replace(/[\t ]+$/,"");if(!u)return;const c=r.push("paragraph_open","p",1);c.map=[a,a+1];const d=r.push("inline","",0);d.content=u,d.map=[a,a+1],d.children=[],r.push("paragraph_close","p",-1)},o=(r,l)=>{const a=r,u=!!t?.strictDelimiters,c=!a?.env?.__markstreamFinal,d=(v,k)=>{let y=k;for(;y=3&&(!y||/\s/.test(y))){const x=a.push("text","",0);return x.content=a.src.slice(a.pos,v),a.pos=v,!0}}const f=[["$$","$$"],["$","$"],["\\(","\\)"]],h=String(a.pending??""),g=Math.max(0,a.pos-h.length);let m=g,w=g;const _=g;for(const[v,k]of f){const y=a.src,x=AI(y),M=goe(y,c);let $=!1;v==="$$"&&m!==_&&(m=_);let S=-1,I=-1,P=0;const D=T=>{if((T==="undefined"||T==null)&&(T=""),T==="\\"){a.pos=a.pos+T.length,m=a.pos;return}if(T==="\\)"||T==="\\("){const H=a.push("text_special","",0);H.content=T==="\\)"?")":"(",H.markup=T,a.pos=a.pos+T.length,m=a.pos;return}if(!T)return;if(v==="$$"&&T.includes("$")){let H=0;for(;H0&&T[O-1]==="$"||O+10){const F=T.slice(0,L),W=a.push("text","",0);W.content=F,a.pos=a.pos+F.length,m=a.pos}const H=T.slice(L).match(/^!\[([^\]]*)\]\(([^)]+)\)/);if(H){const[,F,W]=H,z=W.match(/^(\S+)(?:\s+"([^"]+)")?\s*$/),U=z?z[1]:W,q=z&&z[2]?z[2]:null,K=a.push("image","img",0);K.attrs=[["src",U],["alt",F]],q&&K.attrs.push(["title",q]),K.content=F,K.children=[{type:"text",content:F,tag:""}],a.pos=a.pos+H[0].length,m=a.pos;const ie=T.slice(L+H[0].length);ie&&D(ie);return}const O=a.push("text","",0);O.content=T,a.pos=a.pos+T.length,m=a.pos;return}const B=a.push("text","",0);B.content=T,a.pos=a.pos+T.length,m=a.pos};for(;!(m>=y.length);){const T=y.indexOf(v,m);if(T===-1)break;if(Kp(y,T)){m=T+Math.max(1,v.length);continue}const L=Jm(x,T);if(L){m=L[1];continue}const B=Jm(M,T);if(B){m=B[1];continue}if(T===S&&m===I){if(P++,P>2){m=T+Math.max(1,v.length);continue}}else P=0,S=T,I=m;if(v==="("&&T>0){let ie=T-1;for(;ie>=0&&y[ie]===" ";)ie--;if(ie>=0&&y[ie]==="]"){m=T+v.length;continue}}if(v==="$"&&T>0&&y[T-1]==="$"){m=T+1;continue}if(v==="$"&&T=y.length);){const L=M3(y,T);if(L===-1)break;if(L+10&&y[L-1]==="$"){T=L+1;continue}const B=E9(y,L+1);if(B===-1)break;const H=y.slice(L+1,B),O=H.includes("`"),F=!H||!H.trim(),W=y[B+1],z=I9(H,W),U=L9(H);if(!O&&!F&&!z&&!U){const q=y.slice(m,L);q&&D(q);const K=a.push("math_inline","math",0);K.content=_a(H,t),K.markup="$",K.raw=`$${H}$`,K.loading=!1,m=B+1,T=B+1}else D("$"),T=L+1}T{const c=r,d=!c?.env?.__markstreamFinal,f=t?.strictDelimiters,h=f?[["\\[","\\]"],["$$","$$"]]:[["\\[","\\]"],["[","]"],["$$","$$"]],g=c.bMarks[l]+c.tShift[l];let m=c.src.slice(g,c.eMarks[l]).trim(),w=!1,_="",v="",k=!1,y="",x=!1;for(const[q,K]of h)if(m.startsWith(q))if(q.includes("[")){const ie=q==="\\["?m.slice(q.length):"";if(q==="\\["&&gd(ie,K)===-1&&!/^\s*!\[/.test(ie)&&!ie.includes("`")&&Ra(ie)){w=!0,_=q,v=K;break}if(t?.strictDelimiters){if(m.replace("\\","")==="["){if(l+1=0?"\\]":v,P=S>=0?S:gd(m,v,$);if(!k&&P>_.length){const q=m.slice(M+_.length,P),K=c.push("math_block","math",0);K.content=_a(q),K.markup=_==="$$"?"$$":_==="["?"[]":"\\[\\]",K.map=[l,l+1],K.raw=`${_}${q}${I}`,K.block=!0,K.loading=!1,c.line=l+1;const ie=m.slice(P+I.length);return ie.trim()&&n(c,ie,l),!0}let D=l,T="",L=!1,B="",H=l;const O=k?m:m===_?"":m.slice(_.length),F=!f&&_==="\\["?"]":"",W=gd(O,v);if(W!==-1){const q=W;T=O.slice(0,q),B=O.slice(q+v.length),H=k?l+1:l,L=!0,D=H}else for(O&&!k&&(T=O),D=l+1;D{const c=r,d=c.bMarks[l]+c.tShift[l],f=c.src.slice(d,c.eMarks[l]).trim();return!f.startsWith("$$")&&!f.startsWith("\\[")?!1:s(r,l,a,u)};e.inline.ruler.before("escape","math",o),e.block.ruler.before("lheading","explicit_math_block",i,{alt:["paragraph","reference","blockquote","list"]}),e.block.ruler.before("paragraph","math_block",s,{alt:["paragraph","reference","blockquote","list"]})}function xoe(e){const t=e.renderer.rules.image||function(n,o,s,i,r){const l=n,a=r;return a.renderToken?a.renderToken(l,o,s):""};e.renderer.rules.image=(n,o,s,i,r)=>{const l=n;return l[o].attrSet?.("loading","lazy"),t(l,o,s,i,r)},e.renderer.rules.fence=e.renderer.rules.fence||((n,o)=>{const s=n[o],i=String(s.info??"").trim();return`
        ${e.utils.escapeHtml(String(s.content??""))}
        `})}const Soe=/^\s]/i,Aoe=/^<\/a\s*>/i;function Moe(e,t){if(e?.type!=="inline")return!1;const n=e.children;if(!Array.isArray(n)||n.length===0)return t.pretest(String(e.content??""));let o=0;for(let s=n.length-1;s>=0;s--){const i=n[s];if(i?.type==="link_close"){for(s--;s>=0&&n[s]?.level!==i.level&&n[s]?.type!=="link_open";)s--;continue}if(i?.type==="html_inline"){const r=String(i.content??"");Soe.test(r)&&o>0&&o--,Aoe.test(r)&&o++}if(!(o>0)&&i?.type==="text"&&t.pretest(String(i.content??"")))return!0}return!1}function Toe(e){const t=e.core?.ruler,n=t.getNamedRules?.().find(o=>o.name==="linkify")?.fn;typeof n=="function"&&t.at("linkify",o=>{if(!o.md?.options?.linkify)return;const s=Array.isArray(o.tokens)?o.tokens:[],i=o.md.linkify;if(!i)return;const r=s.filter(l=>Moe(l,i));if(r.length)return n(Object.assign(Object.create(Object.getPrototypeOf(o)),o,{tokens:r}))})}function Eoe(e){const t=e.inline.ruler,n=t.getNamedRules?.(),o=n?.find(l=>l.name==="link")?.fn,s=n?.find(l=>l.name==="image")?.fn;if(typeof o!="function"||typeof s!="function")return;const i=e.validateLink,r=e;r.__markstreamOriginalValidateLink=i,t.at("link",(...l)=>{const a=l[0].md,u=a?.validateLink===i?a.options?.validateLink:a?.validateLink;if(!a||typeof u!="function")return o(...l);const c=a.validateLink;a.validateLink=u;try{return o(...l)}finally{a.validateLink=c}}),t.at("image",(...l)=>{const a=l[0].md;if(!a)return s(...l);const u=a.validateLink;a.validateLink=i;try{return s(...l)}finally{a.validateLink=u}})}function Ioe(e={}){const t=e.markdownItOptions??{},n=typeof t.experimental=="object"&&t.experimental!==null?t.experimental:{},o=Object.prototype.hasOwnProperty.call(t,"stream")?!!t.stream:!0,s=Object.prototype.hasOwnProperty.call(t,"validateLink"),i=new rte({html:!0,linkify:!0,typographer:!0,...t,experimental:{stream:o,...n}});return s||i.set({validateLink:r=>!ic(r,{tagName:"a",attrName:"href"})}),Eoe(i),Toe(i),(e.enableMath??!0)&&_oe(i,{...e.mathOptions??{}}),(e.enableContainers??!0)&&Ate(i),e.enableFixIndentedCodeBlock!==!1&&Gte(i),Tne(i),$ne(i),Ine(i),One(i),xoe(i),Kte(i,{customHtmlTags:e.customHtmlTags}),i}function rc(e){const t=Object.assign(Object.create(Object.getPrototypeOf(e)),e);return Array.isArray(e.attrs)&&(t.attrs=e.attrs.map(n=>[...n])),Array.isArray(e.map)&&(t.map=[...e.map]),Array.isArray(e.children)&&(t.children=e.children.map(n=>rc(n))),t}function Loe(e){const t=e.meta??{};return{type:"checkbox",checked:t.checked===!0,raw:t.checked?"[x]":"[ ]"}}function $oe(e){const t=e,n=t.attrGet?t.attrGet("checked"):void 0,o=n===""||n==="true";return{type:"checkbox_input",checked:o,raw:o?"[x]":"[ ]"}}function Noe(e){const t=String(e.content??"");return{type:"emoji",name:t,markup:String(e.markup??""),raw:`:${t}:`}}function ph(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;in.startsWith(t)||t.startsWith(n)):!1}function JC(e,t,n,o){n.length>0&&e.push(...n),o.length>0&&t.push(...o),n.length=0,o.length=0}function QC(e,t){return!t&&e.startsWith(" ")&&!e.startsWith(" ")?` ${e}`:e}function Ooe(e,t){const n=[],o=[],s=[],i=[],r=e.split(Foe),l=/\r?\n$/.test(e),a=r.some(h=>h.startsWith("diff ")||h.startsWith("--- ")||h.startsWith("+++ ")||h.startsWith("@@ ")),u=h=>{const g=h;if(!II.some(m=>g.startsWith(m)))if(g.startsWith("-")){const m=g.slice(1);s.push(QC(m,a))}else if(g.startsWith("+")){const m=g.slice(1);i.push(QC(m,a))}else{JC(n,o,s,i);const m=a&&g.startsWith(" ")?g.slice(1):g;n.push(m),o.push(m)}},c=l?Math.max(0,r.length-1):r.length;for(let h=0;h0||i.length>0)&&JC(n,o,s,i);const d=n.join(` -`),f=o.join(` -`);return{original:t&&l&&d?`${d} -`:d,updated:t&&l&&f?`${f} -`:f}}function Y8(e){const t=Array.isArray(e.map)&&e.map.length===2,n=e.meta??{},o=typeof n.closed=="boolean"?n.closed:void 0,s=o===!0||o!==!1&&t,i=String(e.info??""),r=i.startsWith("diff"),l=r?(()=>{const u=i,c=u.indexOf(" ");return c===-1?"":String(u.slice(c+1)??"")})():i;let a=String(e.content??"");if(XC.test(a)&&(a=a.replace(XC,"")),r){const{original:u,updated:c}=Ooe(a,s===!0);return{type:"code_block",language:l,code:String(c??""),raw:String(a??""),diff:r,loading:o===!0?!1:o===!1?!0:!t,originalCode:u,updatedCode:c}}return{type:"code_block",language:l,code:String(a??""),raw:String(a??""),diff:r,loading:o===!0?!1:o===!1?!0:!t}}function Poe(e){const t=e.meta??{};return{type:"footnote_reference",id:String(t.label??""),raw:`[^${String(t.label??"")}]`}}function Doe(){return{type:"hardbreak",raw:`\\ -`}}function Boe(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;i\s*$/.test(t)||eu.has(e)}function Hoe(e){if(!e||e.length===0)return ew();const t=N9.get(e);if(t)return t;const n=e.map(xr).filter(Boolean);if(!n.length){const s=ew();return N9.set(e,s),s}const o={customTagSet:new Set(n),allowedTagSet:S2({customHtmlTags:e})};return N9.set(e,o),o}function FI(e){const t=e,n=t.raw??t.content??t.markup??"";return String(n??"")}function zoe(e){const t=e.meta,n=t?.markstreamCustomHtmlRaw,o=t?.markstreamCustomHtmlInner;return typeof n=="string"&&typeof o=="string"?{raw:n,inner:o}:null}function Qm(e,t){const n=t.toLowerCase();for(let o=e.length-1;o>=0;o--){const[s,i]=e[o];if(String(s).toLowerCase()===n)return i}}function Woe(e,t,n){const o=e.slice();return Qm(o,"href")||o.push(["href",t]),n!=null&&!Qm(o,"title")&&o.push(["title",n]),o}function E3(e){return e.map(FI).join("")}function qh(e){const t=[],n=o=>{const s=String(o??"");if(!s)return;const i=t[t.length-1];if(i?.type==="text"){i.content=`${i.content}${s}`,i.raw=`${i.raw}${s}`;return}t.push({type:"text",content:s,raw:s})};for(const o of e)if(o){if(o.type==="reference"||o.type==="footnote_reference"){n(String(o.raw??""));continue}if("children"in o&&Array.isArray(o.children)){t.push({...o,children:qh(o.children)});continue}t.push(o)}return t}function Uoe(e,t,n){let o=0;for(let s=t;s`;m.toLowerCase().includes(x.toLowerCase())||(m+=x),_=!0,w=!0}const v=[],k=/\s([\w:-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g;let y;for(;(y=k.exec(l))!==null;){const x=y[1],M=y[2]||y[3]||y[4]||"";v.push([x,M])}if(u?.has(a)){const x=zoe(e);return[{type:a,tag:a,attrs:v,content:x?x.inner:h.innerTokens.length?E3(h.innerTokens):"",children:h.innerTokens.length?o(h.innerTokens,s,i,r):[],raw:x?.raw??m,loading:e.loading||w,autoClosed:_},h.nextIndex]}return[{type:"html_inline",tag:a,attrs:v,content:m,children:g,raw:m,loading:w,autoClosed:_},h.nextIndex]}function RI(e){if(e.type==="math_inline"){if(e.raw)return String(e.raw);const t=e.markup==="$$"?"$$":"$";return`${t}${String(e.content??"")}${t}`}return Array.isArray(e.children)&&e.children.length>0?e.children.map(t=>RI(t)).join(""):String(e.content??"")}function Voe(e){return!e||!Array.isArray(e.children)||e.children.length===0?"":e.children.map(t=>RI(t)).join("")}function tw(e,t=!1){let n=e.attrs??[],o=null;if((!n||n.length===0)&&Array.isArray(e.children))for(const d of e.children){const f=d.attrs;if(Array.isArray(f)&&f.length>0){n=f,o=d;break}}const s=String(n.find(d=>d[0]==="src")?.[1]??""),i=n.find(d=>d[0]==="alt")?.[1],r=Voe(o??e);let l="";r?l=r:i!=null&&String(i).length>0?l=String(i):o?.content!=null&&String(o.content).length>0?l=String(o.content):Array.isArray(o?.children)&&o.children[0]?.content?l=String(o.children[0].content):Array.isArray(e.children)&&e.children[0]?.content?l=String(e.children[0].content):e.content!=null&&String(e.content).length>0&&(l=String(e.content));const a=n.find(d=>d[0]==="title")?.[1]??null,u=a===null?null:String(a),c=String(e.content??"");return{type:"image",src:s,alt:l,title:u,raw:c,loading:t}}function qoe(e){const t=String(e.content??"");return{type:"inline_code",code:t,raw:t}}function Koe(e,t,n){const o=[];let s="",i=t+1;const r=[];for(;i=0;o--){const[s,i]=e[o];if(String(s).toLowerCase()===n)return i}}function Goe(e,t,n){const o=e.slice();return eg(o,"href")||o.push(["href",t]),n!=null&&!eg(o,"title")&&o.push(["title",n]),o}function hh(e,t,n){const o=e[t],s=Zoe(o.attrs),i=String(eg(s,"href")??""),r=eg(s,"title"),l=r==null?null:String(r),a=Goe(s,i,l);let u=t+1;const c=[];let d=!0;for(;uw.type==="strong_open")){const w=String(h.content??""),_=String(h.raw??w),v=rc(h);v.content=w.slice(0,-2),v.raw=_.replace(/\*\*$/,""),f=c.slice(),f[f.length-1]=v}const g=No(f,void 0,void 0,n),m=g.map(w=>{const _=w;return"content"in w?String(_.content??""):String(_.raw??"")}).join("");return{node:{type:"link",href:i,title:l,text:m,children:g,raw:`[${m}](${i}${l?` "${l}"`:""})`,loading:d,attrs:a},nextIndex:u0?o:[{type:"text",content:a,raw:a}],raw:`~${a}~`},nextIndex:i0?o:[{type:"text",content:s||String(e[t].content??""),raw:s||String(e[t].content??"")}],raw:`^${s||String(e[t].content??"")}^`},nextIndex:i?@[\\\]^_`{|}~]/,ase=/\p{P}/u,use=/^[《「『【〔〖〘〚〈([{“‘﹁﹃﹙﹛﹝]$/u,cse=/^[》」』】〕〗〙〛〉)]}”’﹂﹄﹚﹜﹞]$/u,dse=/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,fse=/:\/\//,I3=1,OI=2,pse=4,hse=8,PI=16,Ma=32,Kh=64,b1=128,DI=256,mse=512,C1=1024,gse=1982;function mh(e){let t=0;for(let n=0;n=t){n++,o++;continue}n++,o++;continue}if(s==="*"&&n>=t)return n;n++}return-1}function tu(e){return!!e&&rse.test(e)}function nu(e){return!!e&&(lse.test(e)||ase.test(e))}function HI(e,t){return!!e&&!!t&&/^\p{Script=Han}$/u.test(t)&&use.test(e)}function zI(e,t){return!!e&&!!t&&/^[\p{L}\p{N}]$/u.test(t)&&cse.test(e)}function yse(e,t){const n=t>0?e[t-1]:void 0,o=e[t+1];return!o||tu(o)?!1:!(nu(o)&&!HI(o,n)&&n&&!tu(n)&&!nu(n))}function kse(e,t){const n=t>0?e[t-1]:void 0,o=e[t+1];return!n||tu(n)?!1:!(nu(n)&&!zI(n,o)&&o&&!tu(o)&&!nu(o))}function bse(e,t,n=0){let o=n,s=!1;for(;o0?e[t-1]:void 0,o=e[t+2];return!o||tu(o)?!1:!(nu(o)&&!HI(o,n)&&n&&!tu(n)&&!nu(n))}function wse(e,t){const n=t>0?e[t-1]:void 0,o=e[t+2];return!n||tu(n)?!1:!(nu(n)&&!zI(n,o)&&o&&!tu(o)&&!nu(o))}function _se(e,t=0){let n=t,o=!1;for(;n=0&&e[i]==="\\";i--)s++;return s%2===1}const Mse=/[\p{L}\p{N}]/u,Tse=/^[\p{L}\p{N}]+$/u;function L3(e){return e?Mse.test(e):!1}function WI(e){return e?Tse.test(e):!1}function V1(e,t){let n=t;for(;n0?e[t-1]:void 0,s=n=2&&o.intraword&&t.push({start:n,end:s}),n=s}for(let n=0;n=3)return o;n=o+s.len}return-1}function $se(e){return e?dse.test(e)||fse.test(e):!1}function Nse(e,t){if(!e||!t)return null;const n=e.match(/\[([^\]\n]+)\]\(([^)]*)$/);return n&&n[2]===t?n[1]:null}function No(e,t,n,o){if(!e||e.length===0)return[];const s=o?.__linkifyDemotionContext,i=qp(t),r={filename:s?.filename||i.filename,explicitFilename:s?.explicitFilename||i.explicitFilename,marketTicker:s?.marketTicker||i.marketTicker};(r.filename||r.explicitFilename||r.marketTicker)&&(o={...o,__linkifyDemotionContext:r});const l=o,a=[];let u=null,c=0;const d=o?.requireClosingStrong,f=e;function h(){return e===f&&(e=e.slice()),e}function g(){u=null}function m(oe,ve){const G=e.length===1?t:String(ve.content??""),X=[],fe=Ese(oe);if(fe!==-1){x(oe.slice(0,fe),oe.slice(0,fe));const ge=oe.slice(fe);return ge&&(D({type:"text",content:ge,raw:ge}),c--),c++,!0}if(nse.test(oe)){const ge=oe.indexOf("~~");ge!==-1&&X.push({type:"strikethrough",index:ge})}if(ose.test(oe)){const ge=oe.indexOf("**");ge!==-1&&X.push({type:"strong",index:ge})}if(/[^*]*\*[^*]+/.test(oe)){const ge=G?BI(G,0):oe.indexOf("*");if(G&&ge===-1)return!1;ge!==-1&&X.push({type:"emphasis",index:ge})}X.sort((ge,Q)=>ge.index!==Q.index?ge.index-Q.index:ge.type===Q.type?0:ge.type==="strong"?-1:Q.type==="strong"?1:0);const Ce=X[0];if(!Ce)return!1;if(Ce.type==="strikethrough"){const ge=Ce.index,Q=ge>-1?oe.slice(0,ge):"";if(Q&&x(Q,Q),ge===-1)return c++,!0;const ee=oe.indexOf("~~",ge+2),ce=ee===-1?oe.slice(ge+2):oe.slice(ge+2,ee),ue=ee===-1?"":oe.slice(ee+2),{node:Se}=ow([{type:"s_open",tag:"s",content:"",markup:"~~",info:"",meta:null},{type:"text",tag:"",content:ce,markup:"",info:"",meta:null},{type:"s_close",tag:"s",content:"",markup:"~~",info:"",meta:null}],0,o);return g(),y(Se),ue&&(D({type:"text",content:ue,raw:ue}),c--),c++,!0}if(Ce.type==="strong"){const ge=Ce.index,Q=ge>-1?oe.slice(0,ge):"";if(Q&&x(Q,Q),ge===-1)return c++,!0;if(t&&ge===0){let _e=!1,Te=0;for(;Te=2)return x(oe,oe),c++,!0}}if(t&&(oe.match(/\*/g)||[]).length>vse(t))return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0;const ee=V1(oe,ge);if(ee.len>=3){const _e=Lse(oe,ge+ee.len);if(_e!==-1){const Te=oe.slice(ge+ee.len,_e);if(Ise(Te)){const{node:st}=n1([{type:"strong_open",tag:"strong",content:"",markup:"**",info:"",meta:null},{type:"em_open",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"text",tag:"",content:Te,markup:"",info:"",meta:null},{type:"em_close",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"strong_close",tag:"strong",content:"",markup:"**",info:"",meta:null}],0,t,o);g(),y(st);const Fe=oe.slice(_e+3);return Fe&&(D({type:"text",content:Fe,raw:Fe}),c--),c++,!0}}}if(!Cse(oe,ge)){const _e=oe.slice(ge,ge+ee.len);x(_e,_e);const Te=oe.slice(ge+ee.len);return Te&&(D({type:"text",content:Te,raw:Te}),c--),c++,!0}const ce=_se(oe,ge+2);let ue="",Se="";if(ce.index!==-1){ue=oe.slice(ge+2,ce.index),Se=oe.slice(ce.index+2);const _e=ce.index,Te=V1(oe,_e);if(ee.intraword&&Te.intraword&&!WI(ue)||!ue&&ee.len>=4&&ee.intraword)return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0}else{if(d||ce.sawInvalidClose||ee.intraword)return x(oe.slice(Q.length),oe.slice(Q.length)),c++,!0;ue=oe.slice(ge+2),Se=""}if(!ue&&/^\*+$/.test(Se))return x(oe,oe),c++,!0;const{node:Ue}=n1([{type:"strong_open",tag:"strong",content:"",markup:"**",info:"",meta:null},{type:"text",tag:"",content:ue,markup:"",info:"",meta:null},{type:"strong_close",tag:"strong",content:"",markup:"**",info:"",meta:null}],0,t,o);return g(),y(Ue),Se&&(D({type:"text",content:Se,raw:Se}),c--),c++,!0}if(Ce.type==="emphasis"){let ge=Ce.index;ge===-1&&(ge=0);const Q=oe.slice(0,ge);if(Q&&x(Q,Q),!yse(oe,ge)){x(oe[ge],oe[ge]);const _e=oe.slice(ge+1);return _e&&(D({type:"text",content:_e,raw:_e}),c--),c++,!0}const ee=V1(oe,ge),ce=bse(G,oe,ge+1),ue=ce.index,Se=e[c+1];if(o?.final&&Se?.type==="em_open"&&ue!==-1&&oe.slice(ge+1,ue).trim()!==oe.slice(ge+1,ue)||ue===-1&&(ce.sawInvalidClose||o?.final||ee.intraword||!L3(oe[ge+1])))return x(oe.slice(ge),oe.slice(ge)),c++,!0;const{node:Ue}=ph([{type:"em_open",tag:"em",content:"",markup:"*",info:"",meta:null},{type:"text",tag:"",content:ue>-1?oe.slice(ge+1,ue):oe.slice(ge+1),markup:"",info:"",meta:null},{type:"em_close",tag:"em",content:"",markup:"*",info:"",meta:null}],0,o);if(g(),y(Ue),ue!==-1&&ue{for(let Ue=0;Ue=0&&Se[Te]==="\\";Te--)_e++;if(_e%2===0)return Ue}return-1})(oe);if(X===-1)return!1;let fe=1;for(let Se=X+1;SeCe?.type==="math_inline")||!sse.test(oe))return null;const G=ve.parseInline(oe,{__markstreamFinal:!!o?.final});if(!Array.isArray(G)||G.length===0)return null;const X=(G.find(Ce=>Ce?.type==="inline")?.children??[]).filter(Ce=>!(Ce?.type==="text"&&String(Ce.content??"")===""));if(!X.length||!X.some(Ce=>Ce?.type!=="text")||X.length===1&&X[0]?.type==="text"&&String(X[0].content??"")===oe)return null;const fe=No(X,oe,n,o);return fe.length?fe:null}function v(oe){g(),a.push(oe)}function k(oe){g();const ve=rc(oe);a.push(ve)}function y(oe){v(oe)}function x(oe,ve){u?(u.content+=oe,u.raw+=ve??oe):(u={type:"text",content:String(oe??""),raw:String(ve??oe??"")},a.push(u))}function M(oe,ve){if(!oe)return;const G=No([{...ve,type:"text",content:oe,raw:oe}],oe,n,o);if(G.length===1&&G[0]?.type==="text"){const X=G[0];x(String(X.content??""),String(X.raw??X.content??""));return}for(const X of G)y(X)}function $(oe,ve){return String(oe.markup??"").startsWith(ve)}function S(oe){if(!u||oe.loading!==!0||oe.markup!=="\\(\\)")return;const ve=e[c-1];!ve||ve.type!=="text"||!$(ve,"\\(")||u.content.endsWith("(")&&(u.content=u.content.slice(0,-1),u.raw.endsWith("(")&&(u.raw=u.raw.slice(0,-1)),!u.content&&a[a.length-1]===u&&(a.pop(),u=null))}function I(oe){return oe.endsWith("](")?e[c+1]?.type==="link_open"&&e[c+1]?.markup==="linkify"&&e[c+2]?.type==="text"&&e[c+3]?.type==="link_close"&&e[c+4]?.type==="text"&&String(e[c+4]?.content??"").startsWith(")"):!1}function P(oe,ve,G=mh(oe)){let X=oe;const fe=String(ve.content??"");return(G&I3)!==0&&X.endsWith("\\")&&!$(ve,"\\\\")&&!fe.endsWith("\\\\")&&(X=X.slice(0,-1)),(G&C1)!==0&&X.endsWith("(")&&!$(ve,"\\(")&&!fe.endsWith("\\(")&&(X=X.slice(0,-1)),(G&OI)!==0&&/\*+$/.test(X)&&!$(ve,"\\*")&&!fe.endsWith("\\*")&&(X=X.replace(/\*+$/,"")),X}for(;c=0;_e--){const Te=a[_e];if(Te.type!=="text")break;ee=_e,ce=String(Te.content??"")+ce}eeQ==="href")?.[1],ge=String(Ce??"");if(t&&ge){const Q=t.indexOf("](");if(Q!==-1){const ee=t.indexOf(")",Q+2);ee===-1?ve.loading=!0:ve.loading&&t.slice(Q+2,ee).includes(ge)&&(ve.loading=!1)}}F(ve)||v(ve)}function H(oe){if(oe.markup!=="linkify")return!1;const{node:ve,nextIndex:G}=hh(e,c,o);return z(ve,G)?(c=G,!0):!1}function O(oe){g(),y(Yoe(oe)),c++}function F(oe){if(oe.type!=="link")return!1;const ve=a[a.length-1];if(!ve||ve.type!=="text")return!1;const G=String(ve.content??"").match(/^([^[]*)\[([^\]\n]+)\]\($/);if(!G)return!1;const X=oe,fe=String(X.href??""),Ce=String(X.text??""),ge=String(G[2]??""),Q=fe.replace(/^(?:https?:\/\/|mailto:|ftp:\/\/)/i,"");if(!fe||!(Ce===fe||Ce===Q||$se(Ce)))return!1;const ee=String(G[1]??"");return ee?(ve.content=ee,ve.raw=ee):a.pop(),v({...oe,text:ge,children:[{type:"text",content:ge,raw:ge}],raw:`[${ge}](${fe}${X.title?` "${X.title}"`:""})`}),!0}function W(oe){if(oe.type!=="link")return!1;const ve=oe,G=String(ve.href??"");return G?z({href:G,title:ve.title==null||ve.title===""?null:String(ve.title),loading:!!ve.loading},c+1):!1}function z(oe,ve){const G=a[a.length-1];if(G?.type!=="image"||G.src||!G.loading||!String(G.raw??"").endsWith("]("))return!1;const X=e[ve],fe=String(X?.content??"");if(X?.type!=="text"||!fe.startsWith(")"))return!1;a.pop(),u=null;const Ce=String(G.alt??"");v({type:"image",src:oe.href,alt:Ce,title:oe.title,raw:`![${Ce}](${oe.href}${oe.title?` "${oe.title}"`:""})`,loading:!!oe.loading});const ge=fe.slice(1),Q=rc(X);return Q.content=ge,Q.raw=ge,h()[ve]=Q,!0}function U(oe){if(oe.type!=="link")return!1;const ve=a[a.length-1],G=e[c-1];if(!ve||ve.type!=="text"||G?.type!=="text")return!1;const X=String(ve.content??""),fe=String(G.content??"");if(!X.endsWith("!")||!fe.endsWith("!")||$(G,"\\!"))return!1;const Ce=X.slice(0,-1);Ce?(ve.content=Ce,ve.raw=Ce,u=ve):(a.pop(),u=null);const ge=oe,Q=String(ge.text??ge.children?.map(ue=>String(ue?.content??ue?.raw??"")).join("")??""),ee=String(ge.href??""),ce=ge.title==null||ge.title===""?null:String(ge.title);return v({type:"image",src:ee,alt:Q,title:ce,raw:`![${Q}](${ee}${ce?` "${ce}"`:""})`,loading:!!ge.loading}),!0}function q(oe,ve="",G=null){const X=String(oe.alt??oe.raw??"");return{type:"link",href:ve,title:G,text:X,children:[oe],raw:`[${X}](${ve}${G?` "${G}"`:""})`,loading:!0}}function K(oe){const ve=oe.startsWith("![")?oe:`![${oe}`,G=ve.slice(2),X=G.indexOf("](");return{type:"image",src:"",alt:X===-1?G.replace(/\]$/,""):G.slice(0,X),title:null,raw:ve,loading:!0}}function ie(oe){const ve=oe.indexOf("[![");if(ve===-1||typeof t=="string"&&e.length===1&&Ase(t,ve,"["))return!1;const G=oe.slice(0,ve);return G&&x(G,G),v(q(K(oe.slice(ve+1)))),c++,!0}function ne(oe){if(o?.final)return!1;const ve=e[c-1];if(ve?.type!=="text"||!String(ve.content??"").endsWith("[")||$(ve,"\\["))return!1;const G=a[a.length-1];if(G?.type==="text"&&G.content.endsWith("[")){const X=G.content.slice(0,-1);X?(G.content=X,G.raw=X,u=G):(a.pop(),u=null)}return v(q(tw(oe))),c++,!0}function Y(oe){if(oe.type!=="link")return!1;const ve=oe,G=String(ve.raw??""),X=String(ve.text??"");if(!G.startsWith("[![")&&!X.startsWith("!["))return!1;const fe=ve.title==null||ve.title===""?null:String(ve.title);return v(q({type:"image",src:String(ve.href??""),alt:X.replace(/^!\[/,"").replace(/\]$/,""),title:fe,raw:G.startsWith("[![")?G.slice(1):G,loading:!0})),!0}function le(oe){if(!oe.startsWith("]("))return!1;const ve=e[c-2];if(ve?.type==="text"&&String(ve.content??"").endsWith("[")&&$(ve,"\\["))return!1;const G=a[a.length-1];if(G?.type!=="image"&&G?.type!=="link")return!1;const X=G,fe=G?.type==="link"&&Array.isArray(X.children)&&X.children.length===1&&X.children[0]?.type==="image"?a.pop():null,Ce=fe?fe.children[0]:a.pop();if(!Ce||Ce.type!=="image")return!1;const ge=e[c+1];let Q=String(fe?.href??""),ee=fe?.title==null?null:String(fe.title),ce=!0;if(ge?.type==="link_open"){const{node:Se,nextIndex:Ue}=hh(e,c+1,o);Q=Se.href,ee=Se.title,ce=!0,c=Ue}else{if(Q=oe.slice(2),Q.includes('"')){const Se=Q.split('"');Q=String(Se[0]??"").trim(),ee=Se[1]==null?null:String(Se[1]).trim()}c++}const ue=q(Ce,Q,ee);return ue.loading=ce,v(ue),!0}function Ee(){const oe=e[c-3];return e[c-2]?.type==="image"&&e[c-1]?.type==="text"&&String(e[c-1].content??"")==="]("&&oe?.type==="text"&&String(oe.content??"").endsWith("[")&&$(oe,"\\[")}function de(oe,ve){const G=oe.indexOf("[");if(G===-1)return!1;let X=oe.slice(0,G);const fe=oe.indexOf("](",G);if(fe!==-1){const Ce=e[c+2];let ge=oe.slice(G+1,fe);if(ge.includes("[")){const _e=ge.indexOf("[");X+=oe.slice(0,G+_e+1);const Te=G+_e+1;ge=oe.slice(Te+1,fe)}const Q=e[c+1];if(oe.endsWith("](")&&Q?.type==="link_open"&&Ce){const _e=e[c+4];let Te=4,st=!0;if(_e?.type==="text"){const Oe=String(_e.content??"");if(Oe.startsWith(")")){st=!1;const Ye=Oe.slice(1);if(Ye){const ft=rc(_e);ft.content=Ye,ft.raw=Ye,h()[c+4]=ft}else Te++}else Oe==="."&&Te++}M(X,ve);const Fe=String(Ce.content??"");return o?.validateLink&&!o.validateLink(Fe)?x(ge,ge):v({type:"link",href:Fe,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:st}),c+=Te,!0}const ee=oe.indexOf(")",fe),ce=ee!==-1?oe.slice(fe+2,ee):"",ue=ee===-1;let Se=X.match(/\*+$/);if(Se&&(X=X.replace(/\*+$/,"")),M(X,ve),Se||(Se=ge.match(/^\*+/)),!d&&Se){const _e=Se[0].length;ge=ge.replace(/^\*+/,"").replace(/\*+$/,"");const Te=[];if(_e===1?Te.push({type:"em_open",tag:"em",nesting:1}):_e===2?Te.push({type:"strong_open",tag:"strong",nesting:1}):_e===3&&(Te.push({type:"strong_open",tag:"strong",nesting:1}),Te.push({type:"em_open",tag:"em",nesting:1})),Te.push({type:"link",href:ce,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:ue}),_e===1){Te.push({type:"em_close",tag:"em",nesting:-1});const{node:st}=ph(Te,0,o);y(st)}else if(_e===2){Te.push({type:"strong_close",tag:"strong",nesting:-1});const{node:st}=n1(Te,0,void 0,o);y(st)}else if(_e===3){Te.push({type:"em_close",tag:"em",nesting:-1}),Te.push({type:"strong_close",tag:"strong",nesting:-1});const{node:st}=n1(Te,0,void 0,o);y(st)}else{const{node:st}=ph(Te,0,o);y(st)}}else o?.validateLink&&!o.validateLink(ce)?x(ge,ge):v({type:"link",href:ce,title:null,text:ge,children:[{type:"text",content:ge,raw:ge}],loading:ue});const Ue=ee!==-1?oe.slice(ee+1):"";return Ue&&(D({type:"text",content:Ue,raw:Ue}),c--),c++,!0}return!1}function he(oe){const ve=oe.indexOf("![");if(ve===-1)return!1;const G=oe.slice(0,ve);return G&&!u?u={type:"text",content:G,raw:G}:G&&u&&(u.content+=G),u&&(a.push(u),u=null),v(K(oe.slice(ve))),c++,!0}function pe(oe){if(!(oe?.startsWith("[")&&n?.type==="list_item_open"))return!1;const ve=oe.slice(1).match(/[^\s\]]/);if(ve===null)return c++,!0;if(ve&&/x/i.test(ve[0])){const G=ve[0]==="x"||ve[0]==="X";return v({type:"checkbox_input",checked:G,raw:G?"[x]":"[ ]"}),c++,!0}return!1}return a}function J8(e,t,n){const o=n?.__sourceLineMapper;if(!o)return{startLine:e,endLine:t};const s=o(e),i=t>e?o(t-1).endLine:o(t).startLine;return{startLine:s.startLine,endLine:Math.max(s.startLine,i)}}function sw(e,t){const n=Math.max(0,Math.min(e.length,Math.trunc(t)));let o=0;for(let s=0;so&&e[s-1]!==` -`&&r++,{startLine:i,endLine:r}}function Tp(e,t,n,o){const s=Fse(e,t,n);return J8(s.startLine,s.endLine,o)}function Rse(e,t){const n=e?.map;if(!Array.isArray(n)||n.length<2)return null;const o=Number(n[0]),s=Number(n[1]);return!Number.isFinite(o)||!Number.isFinite(s)?null:J8(o,s,t)}function On(e,t,n){if(!n?.includeSourceMap)return e;const o=Rse(t,n);if(!o)return e;if(e.sourceMap=o,e.type==="code_block"){const s=e;s.startLine=o.startLine,s.endLine=o.endLine}return e}function Ose(e,t,n,o){if(!o?.includeSourceMap)return e;const s=t?.map;if(!Array.isArray(s)||s.length<2)return e;const i=Number(s[0]),r=Number(s[1]),l=Number(n);return!Number.isFinite(i)||!Number.isFinite(r)||!Number.isFinite(l)||(e.sourceMap=J8(i,Math.max(r,l),o)),e}function Pse(e){const t=String(e.content??""),n=t.replace(/[ \t\r\n]+$/g,"");if(n===t)return;e.content=n;const o=e.children;if(!(!Array.isArray(o)||o.length===0))for(;o.length;){const s=o[o.length-1];if(!s){o.pop();continue}if(s.type==="softbreak"||s.type==="hardbreak"){o.pop();continue}if(s.type==="text"){const i=String(s.content??""),r=i.replace(/[ \t\r\n]+$/g,"");if(r===i)break;if(r){s.content=r;break}o.pop();continue}break}}function Dse(e){const t=String(e.content??""),n=t.match(/\r?\n\s*\d+[.)]?\s*$/);if(!n||typeof n.index!="number")return;e.content=t.slice(0,n.index);const o=e.children;if(!(!Array.isArray(o)||o.length===0))for(;o.length;){const s=o[o.length-1];if(!s){o.pop();continue}if(s.type==="softbreak"||s.type==="hardbreak"){o.pop();continue}if(s.type==="text"){const i=String(s.content??"");if(/^[ \t\r\n\d.)]*$/.test(i)){o.pop();continue}const r=i.replace(/[ \t\r\n\d.)]+$/g,"");r!==i&&(r?s.content=r:o.pop())}break}}function Bse(e){const t=String(e.content??"");return/[ \t\r\n]+$/.test(t)||/\r?\n\s*\d+[.)]?\s*$/.test(t)}function Cf(e,t,n){const o=e[t],s=[],i=du(n,!0);let r=t+1;for(;rd.raw).join("")};n?.includeSourceMap&&On(c,e[r],n),s.push(c),r=u+1}else r+=1;const l={type:"list",ordered:o.type==="ordered_list_open",start:(()=>{if(o.attrs&&o.attrs.length){const a=o.attrs.find(u=>u[0]==="start");if(a){const u=Number(a[1]);return Number.isFinite(u)&&u!==0?u:1}}})(),items:s,raw:s.map(a=>a.raw).join(` -`)};return n?.includeSourceMap&&On(l,o,n),[l,r+1]}function Hse(e,t,n,o){const s=String(n[1]??"note"),i=String(n[2]??s.charAt(0).toUpperCase()+s.slice(1)),r=[],l=du(o,!0);let a=t+1;for(;au.raw).join(` -`)} -:::`},a+1]}const zse=new Set(["warning","info","note","tip","danger","caution"]);function Wse(e){let t=0;for(;t=0;m--){const w=f[m];if(w.type==="text"&&/:+/.test(w.content)){h=m;break}}const g={type:"paragraph",children:No((h!==-1?f.slice(0,h):f)||[],void 0,void 0,a.options()),raw:String(d.content??"").replace(/\n:+$/,"").replace(/\n\s*:::\s*$/,"")};n?.includeSourceMap&&On(g,e[u],n),l.push(g),a.remember(g.raw)}u+=3}else if(e[u].type==="bullet_list_open"||e[u].type==="ordered_list_open"){const[d,f]=Cf(e,u,a.options());n?.includeSourceMap&&On(d,e[u],n),l.push(d),a.remember(d.raw),u=f}else if(e[u].type==="blockquote_open"){const[d,f]=wf(e,u,a.options());n?.includeSourceMap&&On(d,e[u],n),l.push(d),a.remember(d.raw),u=f}else{const d=w2(e,u,a.options());d?(l.push(d[0]),a.remember(d[0].raw),u=d[1]):u++}return[{type:"admonition",kind:s,title:i,children:l,raw:`:::${s} ${i} -${l.map(d=>d.raw).join(` -`)} -:::`},u+1]}const jse=/^::: ?(warning|info|note|tip|danger|caution|error) ?(.*)$/;function Vse(e,t,n){const o=e[t];if(o.type!=="container_open")return null;const s=jse.exec(String(o.info??""));return s?Hse(e,t,s,n):null}const Q8={parseContainer:(e,t,n)=>Use(e,t,n),matchAdmonition:Vse};function wf(e,t,n){const o=[],s=du(n,!0);let i=t+1;for(;il.raw).join(` -`)};return n?.includeSourceMap&&On(r,e[t],n),[r,i+1]}function qse(e){if(e.info?.startsWith("diff"))return Y8(e);const t=String(e.content??""),n=t.match(/ type="application\/vnd\.ant\.([^"]+)"/);let o=t;n?.[1]&&(o=t.replace(/]*>/g,"").replace(/<\/antArtifact>/g,""));const s=Array.isArray(e.map)&&e.map.length===2;return{type:"code_block",language:n?n[1]:String(e.info??""),code:o,raw:o,loading:!s}}function Kse(e,t,n){const o=[];let s=t+1,i=[],r=[];const l=du(n,!0);for(;su.raw).join("")),s+=3}else if(e[s].type==="dd_open"){let a=s+1;for(r=[];a0&&(o.push({type:"definition_item",term:i,definition:r,raw:`${i.map(u=>u.raw).join("")}: ${r.map(u=>u.raw).join(` -`)}`}),i=[]),s=a+1}else s++;return[{type:"definition_list",items:o,raw:o.map(a=>a.raw).join(` -`)},s+1]}function Zse(e,t,n){const o=e[t].meta??{},s=String(o?.label??"0"),i=[],r=du(n,!0);let l=t+1;for(;la.raw).join(` -`)}`},l+1]}function Gse(e,t,n){const o=e[t],s=o.attrs,i=Array.isArray(s)&&s.length?Object.fromEntries(s.filter(c=>Array.isArray(c)&&c.length>=1&&c[0]).map(([c,d])=>[String(c),d==null||d===""?!0:String(d)])):void 0,r=String(o.tag?.substring(1)??"1"),l=Number.parseInt(r,10),a=e[t+1],u=String(a.content??"");return{type:"heading",level:l,text:u,...i?{attrs:i}:{},children:No(a.children||[],u,void 0,n),raw:u}}function Yse(e,t,n){const o=t.toLowerCase(),s=new RegExp(String.raw`^<\s*${o}(?=\s|>|/)`,"i"),i=new RegExp(String.raw`^<\s*\/\s*${o}(?=\s|>)`,"i");let r=0,l=Math.max(0,n);for(;l$/.test(d)||r++,l=a+c+1;continue}l=a+1}return-1}function UI(e){const t=String(e.content??"");if(/^\s*");else if(a)a=!w.includes(">");else if(u)u=!w.includes("?>");else if(w.startsWith("");else if(w.startsWith("");else if(w.startsWith("");else{const _=s(w);if(_)if(_.closing){for(let v=r.length-1;v>=0;v--)if(r[v]===_.tag){r.length=v;break}}else _.selfClosing||i(_.after,_.tag)||r.push(_.tag)}}if(d===-1||d>=t)break;c=d+1}return l||a||u||r.length>0}function Nie(e,t,n){if(!n?.length)return!1;const o=new Set(Ec(n));if(!o.size)return!1;const s=c=>{const d=c.charCodeAt(0);return d>=65&&d<=90||d>=97&&d<=122||d>=48&&d<=57||c==="_"||c==="-"||c===":"},i=c=>c===" "||c===" ",r=c=>{if(c[0]!=="<")return null;let d=1;for(;d"&&m!=="/")return null;const w=c.indexOf(">",d);if(w===-1)return null;let _=w-1;for(;_>=0&&i(c[_]);)_--;return{closing:f,tag:g,selfClosing:!f&&c[_]==="/",after:c.slice(w+1)}},l=(c,d)=>{const f=c.toLowerCase();let h=0;for(;h")return!0}}return!1},a=[];let u=0;for(;u=t?t:c,f=e.slice(u,d),h=f.endsWith("\r")?f.slice(0,-1):f,g=_f(h);if(g){const m=r(h.slice(g.index));if(m)if(m.closing){for(let w=a.length-1;w>=0;w--)if(a[w]===m.tag){a.length=w;break}}else m.selfClosing||l(m.after,m.tag)||a.push(m.tag)}if(c===-1||c>=t)break;u=c+1}return a.length>0}function Fie(e,t){const n=fie.exec(e);if(!n)return null;const o=n[1]??"",s=n.index+o.length,i=e.indexOf(` -`,s),r=e.slice(s,i===-1?e.length:i);return!_f(r.endsWith("\r")?r.slice(0,-1):r)||Lie(e,s)||$ie(e,s)||Nie(e,s,t)?null:`${e.slice(0,n.index)}${o}`}function eL(e,t,n){let o=t;for(;oo&&(r=!0),t.inMath=!1,t.mathOpenOffset=null,i+=2;continue}i++;continue}if(t.inDollarMath){if(e.startsWith("$$",i)&&!o1(e,l)){o!=null&&s&&n+i+2>o&&(r=!0),t.inDollarMath=!1,t.dollarMathOpenOffset=null,i+=2;continue}i++;continue}if(e[i]==="`"&&!o1(e,l)){const a=eL(e,i,"`"),u=Rie(e,i+a,a);if(u===-1)break;i=u+a;continue}if(e.startsWith("\\[",i)&&!o1(e,l)){t.inMath=!0,t.mathOpenOffset=n+i,i+=2;continue}if(e.startsWith("$$",i)&&!o1(e,l)){t.inDollarMath=!0,t.dollarMathOpenOffset=n+i,i+=2;continue}i++}return r}function Oie(e,t){if(!Z8(t))return e;const n=t,o=uw.get(n),s=o?.source===e?o.state:o&&e.startsWith(o.source)?tL(o.state,e.slice(o.source.length),o.source.length-o.state.lineBuffer.length).state:x2(e).state;uw.set(n,{source:e,state:s});const{context:i}=s,r=i.inMath?i.mathOpenOffset:i.inDollarMath?i.dollarMathOpenOffset:null;if(r==null)return e;const l=e.slice(r+2),a=e.lastIndexOf(` -`,r-1)+1;if(e.slice(a,r).trim()!==""&&!/^\r?\n/.test(l)||/^\s*!\[/.test(l))return e;const u=l.trim(),c=/^(?:[a-z]|pi)$/i.test(u);return Ra(l)&&!c?e:e.slice(0,r)}function Pie(e,t,n,o,s){const i=n5(e),r=o5(e);if(t.inFence&&t.fenceInBlockquote&&e.trim()&&s5(e)==null&&B9(t),t.inFence&&t.fenceInList&&e.trim()&&i.column=t.fenceLen&&/^\s*$/.test(l.rest)&&B9(t):(t.inFence=!0,t.fenceChar=l.markerChar,t.fenceLen=l.markerLen,t.fenceInBlockquote=l.inBlockquote,t.fenceInList=l.inList||t.listContentIndent!=null&&!l.inBlockquote&&i.column>=t.listContentIndent,t.fenceListIndent=l.listIndent||t.listContentIndent||0);else if(!t.inFence)return pw(e,t,n,o,s)}else return pw(e,t,n,o,s);return!1}function x2(e,t=Aie(),n=null,o=!1,s=0){const i=q1(t);let r=q1(t),l="",a=!1,u=0;for(;uu&&e[c-1]==="\r"?c-1:d?c:e.length,h=e.slice(u,f);Pie(h,i,s+u,n,o)&&(a=!0),d?(r=q1(i),l=""):l=h,u=d?c+1:e.length}return{closedOpenMath:a,state:{committedContext:r,context:i,lineBuffer:l}}}function tL(e,t,n=0){return t&&!e.context.inMath&&!e.context.inDollarMath&&!e.context.inFence&&!e.committedContext.inFence&&!/[\\$`~\r\n]/.test(t)&&!(e.lineBuffer.endsWith("\\")&&(t[0]==="["||t[0]==="]"))?{closedOpenMath:!1,state:{committedContext:q1(e.committedContext),context:q1(e.context),lineBuffer:e.lineBuffer+t}}:x2(e.lineBuffer+t,e.committedContext,n+e.lineBuffer.length,e.context.inMath||e.context.inDollarMath,n)}function Die(e,t){if(!Z8(e))return;const n=e.stream;if(typeof n?.reset!="function")return;const o=e,s=_2.get(o);if(s?.source===t)return;const i=s?t.startsWith(s.source):!1,r=i&&s?t.slice(s.source.length):"",l=i&&s?tL(s.explicitBracketMath,r,s.source.length-s.explicitBracketMath.lineBuffer.length):x2(t),a=l.state,u=i&&s?l.closedOpenMath:!1;if(s&&i&&s.key===null&&s.pendingCandidate===!1&&!u&&!Iie(s.source,r)&&!Tie(t)){s.source=t,s.explicitBracketMath=a;return}const c=Coe(t);(s&&(s&&!i||s.key!==c||u)||!s&&c)&&n.reset(),Mie(e,t,c,a)}function Bie(e){return typeof e.preTransformTokens=="function"||typeof e.postTransformTokens=="function"}function Hie(e,t){const n=e?.map,o=t?.map;return n===o?!0:!Array.isArray(n)||!Array.isArray(o)?!1:n.length===o.length&&n.every((s,i)=>s===o[i])}function H9(e,t){return!!e&&!!t&&e.type===t.type&&e.tag===t.tag&&e.nesting===t.nesting&&e.markup===t.markup&&e.content===t.content&&Hie(e,t)}function hw(e,t){return e[t]?.type==="paragraph_open"&&e[t+1]?.type==="inline"&&e[t+2]?.type==="paragraph_close"}function zie(e){for(let t=0;t+5":""}function gw(e){return{type:"paragraph",children:e,raw:e.map(jie).join("")}}function vw(e,t){if(t.sourceMap)for(const n of e)n.sourceMap||(n.sourceMap=t.sourceMap)}function yw(e,t){if(e.type!=="paragraph")return null;const n=e.children,o=Array.isArray(n)?n:[];if(o.length===0)return null;const s=Cie(t);if(!s?.size)return null;let i=-1;for(let c=0;ch?.type==="hardbreak")){i=c;break}}if(i===-1)return null;const r=o.slice(0,i),l=o[i];if(!l)return null;const a=[];r.length&&a.push(gw(r)),a.push(l);const u=o.slice(i+1);return u.length&&a.push(gw(u)),a}function Vie(e){const t=e.trim();if(!t)return null;const n=/^(?:]*>\s*)?]*)?>/i.test(t),o=/<\/html>\s*$/i.test(t);return!n||!o?null:[{type:"html_block",tag:"html",raw:e,content:e,loading:!1}]}function K1(e){const t=e.raw;if(typeof t=="string")return t;const n=e.content;return typeof n=="string"?n:""}function qie(e,t){if(e.type!=="html_block"||!t)return!1;const n=String(e.raw??e.content??"");return new RegExp(String.raw`^\s*<\s*\/\s*${Gr(t)}\s*>\s*$`,"i").test(n)}const z9=new Set(["iframe","script","style","textarea","title"]);function Zp(e,t,n){if(!e||!t)return null;const o=t.toLowerCase(),s=f=>{if(e.startsWith("",f+4);return{closing:!1,end:k===-1?e.length:k+3,selfClosing:!1,tag:""}}if(e.startsWith("",f+9);return{closing:!1,end:k===-1?e.length:k+3,selfClosing:!1,tag:""}}const h=Yo(e.slice(f));if(h===-1)return null;const g=f+h+1,m=e.slice(f,g);if(/^<\s*[!?]/.test(m))return{closing:!1,end:g,selfClosing:!1,tag:""};let w=m.slice(1).trimStart();const _=w.startsWith("/");_&&(w=w.slice(1).trimStart());const v=w.match(/^([A-Z][\w:-]*)/i);return v?.[1]?{closing:_,end:g,selfClosing:/\/\s*>$/.test(m),tag:v[1].toLowerCase()}:{closing:!1,end:f+1,selfClosing:!1,tag:""}},i=(f,h)=>{const g=new RegExp(String.raw`<\s*\/\s*${Gr(f)}(?=\s|>)`,"gi");g.lastIndex=h;const m=g.exec(e);if(!m||m.index==null)return null;const w=s(m.index);return w?{start:m.index,end:w.end}:null};let r=-1,l=-1,a=Math.max(0,n);for(;a$/.test(u))return{raw:u,start:r,end:l+1,closed:!0};if(z9.has(o)){const f=i(o,l+1);return f?{raw:e.slice(r,f.end),start:r,end:f.end,closeStart:f.start,closed:!0}:{raw:e.slice(r),start:r,end:e.length,closed:!1}}let c=1,d=l+1;for(;d]*$/,"")} -`}function kw(e){return e.replace(/\r\n/g,` -`).replace(/(^|\n)[ \t]{1,4}/g,"$1")}function Gie(e,t,n){return n?e.includes(n,t)?!0:kw(e.slice(Math.max(0,t))).includes(kw(n)):!1}function Yie(e,t){let n=Math.max(0,t);for(;n)`,"gi");let o=-1,s;for(;(s=n.exec(e))!==null;)o=s.index;return o}function oL(e,t){return{final:t,__disableStreamParse:!0,requireClosingStrong:e.requireClosingStrong,customHtmlTags:e.customHtmlTags,validateLink:e.validateLink}}const Jie=new Set(["admonition","blockquote","code_block","definition_list","footnote","heading","list","math_block","table","thematic_break"]),Qie=/(?:^|\n)\s{0,3}(?:#{1,6}\s+\S|[-+*]\s+\S|\d+[.)]\s+\S|>\s*\S|`{3,}|~{3,}|(?:\*{3,}|-{3,}|_{3,})(?:\s|$)|\|.*\|)/m;function ere(e){return/\n\s*\n/.test(e)||Qie.test(e)}function tre(e,t){if(!e.trim()||t.length===0)return!1;if(t.some(o=>Jie.has(String(o?.type??"").toLowerCase()))||t.some(o=>{if(o?.type!=="html_block")return!1;const s=o;return Array.isArray(s.children)&&s.children.length>0}))return!0;if(!ere(e))return!1;if(t.length>1)return!0;const[n]=t;return!!(n&&n.type==="paragraph")}function nre(e){const t=[];let n=0;for(;n=e.length)break;const o=e.slice(n).match(/^<([A-Z][\w:-]*)/i);if(!o?.[1])return null;const s=Zp(e,o[1],n);if(!s||s.start!==n)return null;t.push(s.raw),n=s.end}return t.length>1?t:null}function ore(e,t,n,o){const s=n.customHtmlTags?.join("\0")??"",i=t,r=aw.get(i),l=r&&r.final===o&&r.customHtmlTags===s&&r.requireClosingStrong===n.requireClosingStrong&&r.validateLink===n.validateLink,a=e.map((u,c)=>l&&r.blocks[c]===u?r.children[c]:jd(u,t,n));return aw.set(i,{blocks:e,children:a,customHtmlTags:s,final:o,requireClosingStrong:n.requireClosingStrong,validateLink:n.validateLink}),a.flat()}function sre(e,t,n,o){return e.map(s=>{if(s?.type!=="html_block")return s;const i=s,r=String(i.tag??"").toLowerCase();if(!r||r==="details"||iI.has(r)||Array.isArray(i.children))return s;const l=String(s.raw??i.content??"");if(!l)return s;const a=Yo(l);if(a===-1)return s;const u=Zp(l,r,0),c=u?.closeStart??-1,d=u?.closed===!0&&c>=a+1,f=d?l.slice(a+1,c):l.slice(a+1);if(!f.trim())return s;const h=oL(n,o),g=d?null:nre(f),m=g?ore(g,t,h,o):jd(f,t,h);return tre(f,m)?{...s,children:m}:s})}function ire(e){for(const t of e)if(t?.type==="html_block")return!0;return!1}function jd(e,t,n){return e.trim()?iL(e,t,{...n,__disableStreamParse:!0}):[]}function rre(e,t,n){const o=jd(e,t,n),s=o[0];return o.length===1&&s?.type==="paragraph"&&Array.isArray(s.children)?s.children:o}function lre(e,t,n){const o=UI({content:e}),s=Yo(e),i=nL(e,"summary");if(s!==-1&&i!==-1&&i>=s+1){const r=rre(e.slice(s+1,i),t,n);r.length>0&&(o.children=r)}return o.raw=e,o}function are(e,t,n){const o=Yo(e);if(o===-1)return[];const s=e.slice(o+1);if(!s.trim())return[];const i=Zp(s,"summary",0);if(!i)return jd(s,t,n);const r=s.slice(0,i.start),l=s.slice(i.end);return[...jd(r,t,n),lre(i.raw,t,n),...jd(l,t,n)]}function sL(e,t,n,o,s,i=0){const r=[];let l=i;for(let a=0;a{const U=nL(f,"details");return U!==-1?f.slice(0,U):f})():f,[k]=sL(_?[]:m===-1?e.slice(a+1):e.slice(a+1,m),t,n,o,s,h+f.length),y=are(v,n,oL(o,s)),x=m===-1?"":String(e[m].raw??K1(e[m])??""),M=_||m!==-1&&w?.closed===!0,$=x.replace(/[\t\r\n ]+$/,""),S=M?(()=>{const U=(w?.raw??"").lastIndexOf($);return U===-1?t.length:h+U})():t.length,I=Yo(f),P=_&&I!==-1?h+I+1:h+f.length,D=t.slice(P,S===-1?t.length:S),T=n.parse(D,{__markstreamFinal:s}),L=n.renderer.render(T,n.options,{__markstreamFinal:s}),B=S+$.length,H=M?Math.max(S+x.length,Yie(t,B)):t.length,O=M?t.slice(S,H):x,F=M?t.slice(h,H):t.slice(h),W=_&&I!==-1?f.slice(0,I+1):f,z={...u,tag:"details",attrs:C2(f.slice(0,I+1)),raw:F,content:`${W}${L}${O}`,children:[...y,...k],loading:!s&&!M};if(o.includeSourceMap&&(z.sourceMap=Tp(t,h,M?H:t.length,o)),r.push(z),l=M?H:t.length,m===-1&&!_)break;m!==-1&&(a=m)}return[r,l]}function ure(e,t,n,o){if(!n)return e;const s=e.slice();let i=0;for(let r=0;r=d.start&&I.end<=d.end){s.splice(M,1);continue}break}x=S+$.length,s.splice(M,1)}}return s}function cre(e){const t=l=>l===" "||l===" "||l===` -`||l==="\r",n=l=>{if(!l||l[0]!=="<"||l.includes(">"))return!1;let a=1;if(a{const w=m.charCodeAt(0);return w>=65&&w<=90||w>=97&&w<=122},c=m=>{const w=m.charCodeAt(0);return w>=48&&w<=57},d=m=>m==="!"||u(m),f=m=>u(m)||c(m)||m===":"||m==="-",h=m=>u(m)||c(m)||m==="_"||m==="."||m===":"||m==="-",g=h;if(a>=l.length||!d(l[a]))return!1;for(a++;a=l.length)return!0;if(l[a]==="/"){for(a++;a=l.length}if(!h(l[a]))return!1;for(a++;a=l.length)return!0;const m=l[a];if(m==='"'||m==="'"){for(a++;a=l.length)return!0;a++}else{for(;a"||w==='"'||w==="'"||w==="`")break;a++}if(a>=l.length)return!0}}}return!0},o=(l,a)=>{let u=!1,c="",d=0;const f=v=>v===" "||v===" ",h=v=>{let k=0;for(;k{let k=0;for(;k";)for(y=!0,k++;k{const k=h(v);if(k)return k;const y=g(v);return y==null?null:h(y)};let w=0;const _=l.split(/\r?\n/);for(const v of _){const k=w,y=w+v.length;if(a=d&&/^\s*$/.test(x.rest)&&(u=!1,c="",d=0):(u=!0,c=M,d=$)}if(a<=y)break;w=y+1}return u},s=String(e??""),i=s.lastIndexOf("<");if(i===-1||o(s,i))return s;if(i>0){const l=s[i-1],a=l===" "||l===" "||l===` -`||l==="\r",u=s[i-2];if(!a&&!((l==="n"||l==="r")&&u==="\\"))return s}const r=s.slice(i);return r.includes(">")||r.length>1&&(r[1]===" "||r[1]===" "||r[1]===` -`||r[1]==="\r")||!n(r)?s:s.slice(0,i)}function Cw(e,t){if(e===t)return;const n=e.split(/\r?\n/),o=t.split(/\r?\n/),s=[];let i=0;for(let r=0;r{const l=Number.isFinite(r)?Math.max(0,Math.trunc(r)):0;if(lString(g??"").toLowerCase()).filter(Boolean));if(!n.size)return e;const o=g=>g===" "||g===" ",s=g=>{const m=g.charCodeAt(0);return m>=65&&m<=90||m>=97&&m<=122||m>=48&&m<=57||g==="_"||g==="-"||g===":"},i=g=>{if(!g)return!1;if(g[0]===" ")return!0;let m=0;for(let w=0;w=4)return!0;continue}if(_===" ")return!0;break}return!1},r=g=>{let m=!1,w=!1;for(let _=0;_")return _}return-1},l=g=>{let m=0;for(;m{if(i(g))return-1;const w=g.replace(/^[ \t]+/,"");if(!w||w.startsWith(">")||w.startsWith("|")||/^(?:[*+-]|\d+[.)])[\t ]+/.test(w))return-1;let _=!1,v=0;for(;v=x.length){_=!0,v++;continue}const $=x[M];if($==="!"||$==="?"){_=!0,v+=y+1;continue}if($==="/"){_=!0,v+=y+1;continue}const S=M;for(;M"&&P!=="/"){_=!0,v++;continue}const D=new RegExp(String.raw`<\s*\/\s*${I}\s*>`,"i"),T=/\/\s*>$/.test(x),L=D.test(g.slice(v+y+1)),B=D.test(e.slice(m+v+y+1)),H=/[\r\n]/.test(e.slice(m+v+y+1));if(_&&n.has(I)&&!T&&!L&&(B||H))return v;_=!0,v+=y+1}return-1};let u=!1,c="",d=0,f="",h=0;for(;hh&&e[g-1]==="\r",_=m?w?g-1:g:e.length,v=e.slice(h,_),k=m?w?`\r -`:` -`:"",y=l(v);let x=v;if(!u&&!y){const M=a(v,h);if(M!==-1){const $=k||` -`;x=`${v.slice(0,M).replace(/[ \t]+$/,"")}${$}${$}${v.slice(M).replace(/^[ \t]+/,"")}`}}f+=x,f+=k,y&&(u?y.markerChar===c&&y.markerLen>=d&&/^\s*$/.test(y.rest)&&(u=!1,c="",d=0):(u=!0,c=y.markerChar,d=y.markerLen)),h=m?g+1:e.length}return f}function fre(e,t){if(!e||!t.length)return e;const n=new Set(t.map(d=>String(d??"").toLowerCase()));if(!n.size)return e;const o=d=>d===" "||d===" ",s=d=>{const f=d.charCodeAt(0);return f>=65&&f<=90||f>=97&&f<=122||f>=48&&f<=57||d==="_"||d==="-"},i=d=>{let f=0;for(;f{let f=!1,h=!1;for(let g=0;g")return g}return-1},l=(d,f,h)=>{const g=h.toLowerCase();let m=d.indexOf("<",f);for(;m!==-1;){let w=m+1;for(;w=d.length||d[w]!=="/"){m=d.indexOf("<",m+1);continue}for(w++;wd.length){m=d.indexOf("<",m+1);continue}let _=!0;for(let k=0;k="A"&&y<="Z"?String.fromCharCode(y.charCodeAt(0)+32):y)!==g[k]){_=!1;break}}if(!_){m=d.indexOf("<",m+1);continue}let v=w+g.length;if(v")return!0;m=d.indexOf("<",m+1)}return!1},a=d=>{let f=0;for(;f=d.length||d[f]!=="<")return d;for(f++;f=d.length||d[f]==="/")return d;const h=f;for(;fc&&e[d-1]==="\r",h=f?d-1:d,g=e.slice(c,h);u+=a(g),u+=f?`\r -`:` -`,c=d+1}return u}function pre(e,t){if(!e||!t.length)return e;const n=new Set(t.map(f=>String(f??"").toLowerCase()));if(!n.size)return e;const o=f=>f===" "||f===" ",s=f=>{let h=0,g=!1,m=0;for(;h=f.length||f[h]!==">")break;for(g=!0,h++;h{let h=0;for(;hnew RegExp(String.raw`(<\s*\/\s*${f}\s*>)${"(?=[\\t ]*(?:#{1,6}[\\t ]+|>|(?:[*+-]|\\d+[.)])[\\t ]+|(?:`{3,}|~{3,})|\\||\\$\\$|:{3,}|\\[\\^[^\\]]+\\]:|(?:-{3,}|\\*{3,}|_{3,})))"}`,"gi"));let l=!1,a="",u=0,c="",d=0;for(;dd&&e[f-1]==="\r",m=h?g?f-1:f:e.length,w=e.slice(d,m),_=h?g?`\r -`:` -`:"",v=s(w),k=v?.prefix??"",y=v?.content??w,x=i(y);x&&(l?x.markerChar===a&&x.markerLen>=u&&/^\s*$/.test(x.rest)&&(l=!1,a="",u=0):(l=!0,a=x.markerChar,u=x.markerLen));let M=y;if(!l&&M.includes("{if(D.replace(/^[\t ]+/,"").startsWith("|"))return S;const T=D.slice(0,P).replace(/^[\t ]+/,"");if(T.length>0){const L=I.match(/^<\s*\/\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??"",B=T.match(/^<\s*([A-Z][\w:-]*)/i)?.[1]?.toLowerCase()??"";if(!L||!B||L!==B)return S}return`${I} - -`});if(k){const $=k+M.split(` -`).join(` -${k}`);c+=$}else c+=M;c+=_,d=h?f+1:e.length}return c}function hre(e,t){if(!e||!t.length)return e;const n=new Set(t.map(T=>String(T??"").toLowerCase()));if(!n.size)return e;const o=T=>T===" "||T===" ",s=T=>{if(!T)return!1;if(T[0]===" ")return!0;let L=0;for(let B=0;B=4)return!0;continue}if(H===" ")return!0;break}return!1},i=T=>{const L=T.charCodeAt(0);return L>=65&&L<=90||L>=97&&L<=122||L>=48&&L<=57||T==="_"||T==="-"||T===":"},r=T=>{let L=0;for(;L{let L=0,B=!1,H=0;for(;L=T.length||T[L]!==">")break;for(B=!0,L++;Lr(T).startsWith("<"),u=T=>{for(let L=0;L{if(s(T))return"";const L=r(T);if(!L.startsWith("<"))return"";let B=1;for(;B=L.length||L[B]==="/"||L[B]==="!"||L[B]==="?")return"";const H=B;for(;B"&&F!=="/"?"":O},d=T=>{if(s(T))return null;const L=r(T);if(!L.startsWith("<"))return null;let B=1;for(;B=L.length)return null;const H=L[B]==="/";if(H)for(B++;B"&&z!=="/")return null;if(H)return{type:"close",name:W};if(/\/\s*>\s*$/.test(L))return{type:"open",name:W,complete:!0};const U=L.indexOf(">",B);if(U!==-1){const q=L.slice(U+1);if(new RegExp(`<\\s*\\/\\s*${W}\\s*>`,"i").test(q))return{type:"open",name:W,complete:!0}}return{type:"open",name:W,complete:!1}},f=T=>{if(s(T))return null;const L=r(T).replace(/[ \t]+$/,"");if(!L.startsWith("<")||/^<\s*(?:!--|!doctype\b|\?)/i.test(L))return null;const B=L.match(/^<\s*([A-Z][\w:-]*)\b[^>]*\/\s*>\s*$/i);if(B?.[1])return B[1].toLowerCase();const H=L.match(/^<\s*([A-Z][\w:-]*)\b[^>]*>[\s\S]*<\s*\/\s*([A-Z][\w:-]*)\s*>\s*$/i);if(!H?.[1]||!H[2])return null;const O=H[1].toLowerCase();return O===H[2].toLowerCase()?O:null};let h=!1,g="",m=0;const w=T=>{let L=0;for(;Lw(T),v=T=>{const L=r(T);return L?s(T)?!0:/^(?:#{1,6}[ \t]+|>|[*+-][ \t]+|\d+[.)][ \t]+|`{3,}|~{3,}|\||\$\$|:{3,}|\[\^[^\]]+\]:|-{3,}|\*{3,}|_{3,})/.test(L):!1},k=(T,L,B)=>{let H=T,O=0;for(;HH&&e[F-1]==="\r",U=W?z?F-1:F:e.length,q=e.slice(H,U),K=l(q),ie=K?.key??"";if(O>0&&L&&ie!==L)break;const ne=K?.content??q,Y=d(ne);if(Y?.name===B){if(Y.type==="open")Y.complete||O++;else if(O>0&&(O--,O===0))return!1}else if(O>0&&(u(ne)||v(ne)))return!0;if(W)H=F+1;else break}return!1};let y="",x=0,M=!0,$=!1,S=!1,I=` -`;const P=[];let D="";for(;xx&&e[T-1]==="\r",H=L?B?T-1:T:e.length,O=e.slice(x,H),F=L?B?`\r -`:` -`:"",W=l(O),z=W?.key??"",U=W?.content??O,q=_(U);q&&(h?q.markerChar===g&&q.markerLen>=m&&/^\s*$/.test(q.rest)&&(h=!1,g="",m=0):(h=!0,g=q.markerChar,m=q.markerLen));const K=P.length>0;if(!h&&!K){const ne=c(U),Y=!!ne&&!M&&$&&S&&k(x,z,ne);ne&&!M&&(!$||Y)&&(z&&D&&z===D?y+=`${z}${I}`:z||(y+=I))}if(y+=O,y+=F,F&&(I=F),!h){const ne=d(U);if(ne){if(ne.type==="open")ne.complete||P.push(ne.name);else for(let Y=P.length-1;Y>=0;Y--)if(P[Y]===ne.name){P.length=Y;break}}}const ie=u(U);M=ie,$=!ie&&a(U),S=!ie&&!!f(U),D=z,x=L?T+1:e.length}return y}function iL(e,t,n={}){const o=KI(n),s=o?af():0,i=!!n.final,r=(e??"").toString();let l=r.replace(/([^\\])\r(ight|ho)/g,"$1\\r$2").replace(/([^\\])\r?\n(abla|eq|ot|exists)/g,"$1\\n$2");if(xie(t,n)&&(t.stream.reset(),Sie(t)),i||(l.endsWith("- *")&&(l=l.replace(/- \*$/,"- \\*")),/(?:^|\n)\s*-\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*-\s*$/,v=>v.startsWith(` -`)?` -`:""):/(?:^|\n)\s*--\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*--\s*$/,v=>v.startsWith(` -`)?` -`:""):/(?:^|\n)\s*>\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*>\s*$/,v=>v.startsWith(` -`)?` -`:""):/\n\s*[*+]\s*$/.test(l)?l=l.replace(/\n\s*[*+]\s*$/,` -`):/(?:^|\n)\s*\d+\s*$/.test(l)?/^\d+$/.test(l.trim())||(l=l.replace(/(?:^|\n)\s*\d+\s*$/,v=>v.startsWith(` -`)?` -`:"")):/(?:^|\n)\s*\d+[.)]\s+\*{1,3}\s*$/.test(l)?l=l.replace(/((?:^|\n)\s*\d+[.)]\s+)(\*{1,3})\s*$/,(v,k,y)=>`${k}${y.split("").map(()=>"\\*").join("")}`):/(?:^|\n)\s*\d+[.)]\s*$/.test(l)?l=l.replace(/(?:^|\n)\s*\d+[.)]\s*$/,v=>v.startsWith(` -`)?` -`:""):/\n[[(]\n*$/.test(l)&&(l=l.replace(/(\n\[|\n\()+\n*$/g,` -`)),l=Oie(l,t),l=Fie(l,n.customHtmlTags)??l),n.customHtmlTags?.length&&l.includes("<")){const v=Ec(n.customHtmlTags);if(v.length&&(l=dre(l,v),l=fre(l,v),l=hre(l,v),l=pre(l,v),l.includes("[\t ]*)(\r?\n)(?![\t ]*\r?\n|$)`,"gim");l=l.replace(y,"$1$2$2")}}i||(l=cre(l));const a=Vie(l);if(a){if(n.includeSourceMap){const y={...n,__sourceLineMapper:Cw(r,l)};a[0].sourceMap=Tp(l,0,l.length,y)}const v=n.preTransformTokens,k=n.postTransformTokens;if(t5(t,n)||typeof v=="function"||typeof k=="function"){const y=mw(t,l,{__markstreamFinal:i},n),x=typeof v=="function"&&v(y)||y;typeof k=="function"&&k(x)}return cw(a,n,o,s)}const u=mw(t,l,{__markstreamFinal:i},n);if(!u||!Array.isArray(u))return cw([],n,o,s);const c=n.preTransformTokens,d=n.postTransformTokens;let f=u;c&&typeof c=="function"&&(f=c(f)||f);const h=t,g=typeof h.validateLink=="function"&&h.__markstreamOriginalValidateLink&&h.validateLink!==h.__markstreamOriginalValidateLink?h.validateLink:void 0,m=n.validateLink??g??h.options?.validateLink??(typeof h.validateLink=="function"?h.validateLink:void 0),w={...n,validateLink:m,__markdownIt:t,__sourceLineMapper:n.includeSourceMap===!0?Cw(r,l):void 0,__sourceMarkdown:l,__customHtmlBlockCursor:0};let _=bie(t,l,f,w,o);if(d&&typeof d=="function"){const v=d(f);if(Array.isArray(v)){const k=v[0],y=k?.type;k&&typeof y=="string"?_=Zh(v,{...w,__customHtmlBlockCursor:0},o):_=v}}if(ire(_)&&(_=ure(_,i,l,w),_=sL(_,l,t,w,i)[0],_=sre(_,t,w,i)),i){const v=new WeakSet,k=y=>{if(!y||typeof y!="object"||v.has(y))return;if(v.add(y),Array.isArray(y)){for(const M of y)k(M);return}const x=y;x.type==="html_block"&&x.loading===!0&&(x.loading=!1);for(const M of Object.values(x))k(M)};k(_)}return _=GI(_,n),n.debug&&console.log("Parsed Markdown Tree Structure:",_),ZI(_,o,s)}function ww(e,t){if(!e||!Array.isArray(e))return[];const n=[],o=du(t),s=t?.includeSourceMap===!0;let i=0;for(;ic.type==="html_block")){if(s)for(const c of u)On(c,l,t);for(const c of u)al(c,l,t);n.push(...u)}else{const c={type:"paragraph",raw:a,children:u};s&&On(c,l,t);const d=yw(c,t);if(d){s&&vw(d,c);for(const f of d)al(f,l,t);n.push(...d)}else al(c,l,t),n.push(c)}o.remember(a)}i+=1;break;default:i+=1;break}}return n}const mre=/^([a-z][\w-]*)(?=[\t\n\f\r />]|$)/i,gre=new Set([...Vp,"base","button","datalist","dialog","embed","fieldset","form","iframe","input","legend","link","meta","object","optgroup","option","output","param","select","style","template","textarea","title"]),vre=new Set(["a","abbr","b","blockquote","br","caption","code","col","colgroup","dd","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","li","mark","ol","p","picture","pre","s","small","source","span","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","ul"]);function _w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yre(e){return typeof e=="string"?e:e==null?"":String(e)}function rL(e){return/^[^\s"'<>`=]+$/.test(e)&&!/^on/i.test(e)}function Oa(e){return yre(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function lL(e){return Oa(e).replace(/`/g,"`")}function A2(e){return String(e??"").trim().toLowerCase()}function i5(e,t="safe"){const n=A2(e);return n?t==="escape"?!0:t==="trusted"?Vp.has(n):!vre.has(n):!1}function aL(e,t="safe"){const n=A2(e);return n?t==="escape"?!0:t==="trusted"?Vp.has(n):gre.has(n):!1}function xw(e){const t=Object.entries(e);return t.length===0?"":t.map(([n,o])=>o===""?` ${n}`:` ${n}="${lL(o)}"`).join("")}function uL(e){const t=e.startsWith("/"),n=t?e.slice(1):e,o=n.match(mre);return o?{attrsStr:t?"":n.slice(o[0].length).trimStart(),isClosing:t,isSelfClosing:!t&&e.trimEnd().endsWith("/"),tagName:o[1]}:null}function kre(e,t){const n=e.split(",").map(o=>o.trim()).filter(Boolean);return n.length===0?!1:n.some(o=>{const s=o.split(/\s+/,1)[0]??"";return!s||ic(s,{tagName:t,attrName:"srcset"})})}function cL(e,t,n,o){return hte.has(e)||n==="safe"&&e==="style"?!0:e==="srcset"?kre(t,o):!!(mte.has(e)&&t&&ic(t,{tagName:o,attrName:e}))}function Ku(e,t){const n=t.toLowerCase();return Object.keys(e).find(o=>o.toLowerCase()===n)}function dL(e,t,n,o=!1){if(t!=="safe"||A2(n)!=="a")return e;const s=Ku(e,"href");if(o&&(!s||!e[s])){const a=Ku(e,"target"),u=Ku(e,"rel");return a&&delete e[a],u&&delete e[u],e}const i=Ku(e,"target");if((i?String(e[i]).trim():"").toLowerCase()!=="_blank")return e;const r=Ku(e,"rel"),l=new Set(String(r?e[r]:"").split(/\s+/).map(a=>a.trim()).filter(Boolean).filter(a=>a.toLowerCase()!=="opener"));return l.add("noopener"),l.add("noreferrer"),r&&r!=="rel"&&delete e[r],e.rel=Array.from(l).join(" "),e}function Sw(e,t="safe",n){const o={};for(const[s,i]of Object.entries(e)){const r=s.trim(),l=r.toLowerCase();!r||!rL(r)||cL(l,i,t,n)||(o[r]=i)}return dL(o,t,n,!!Ku(e,"href"))}function fL(e,t){const n=e.toLowerCase();return sI.has(n)?!1:_w(t,n)||_w(t,e)}function r5(e,t="safe",n){const o={};for(const[s,i]of Object.entries(e)){const r=s.trim(),l=r.toLowerCase();!r||!rL(r)||cL(l,i,t,n)||(o[r]=i)}return dL(o,t,n,!!Ku(e,"href"))}function Z1(e){const t={};if(!Array.isArray(e)||e.length===0)return t;for(const[n,o]of e)n&&(t[String(n)]=o==null?"":String(o));return t}function Gh(e,t="safe",n){const o=r5(Z1(e),t,n),s=Object.entries(o).map(([i,r])=>[i,r]);return s.length>0?s:void 0}function bre(e,t){const n=t.toLowerCase();if(["checked","disabled","readonly","required","autofocus","multiple","hidden"].includes(n))return e==="true"||e===""||e===t;if(["value","min","max","step","width","height","size","maxlength"].includes(n)){const o=Number(e);if(e!==""&&!Number.isNaN(o))return o}return e}function Cre(e){const t={};for(const[n,o]of Object.entries(e))t[n]=bre(o,n);return t}function W9(e){return e.trim().length>0}function pL(e){const t=[];let n=0;for(;n",n);if(r!==-1){n=r+3;continue}break}const o=e.indexOf("<",n);if(o===-1){if(nn){const r=e.slice(n,o);W9(r)&&t.push({type:"text",content:r})}if(e.startsWith("![CDATA[",o+1)){const r=e.indexOf("]]>",o);if(r!==-1){t.push({type:"text",content:e.slice(o,r+3)}),n=r+3;continue}break}if(e.startsWith("!",o+1)){const r=e.indexOf(">",o);if(r!==-1){n=r+1;continue}break}const s=e.indexOf(">",o);if(s===-1)break;const i=uL(e.slice(o+1,s));if(!i){const r=e.slice(o,s+1);W9(r)&&t.push({type:"text",content:r}),n=s+1;continue}if(i.isClosing)t.push({type:"tag_close",tagName:i.tagName});else{const r={};if(i.attrsStr){const l=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let a;for(;(a=l.exec(i.attrsStr))!==null;){const u=a[1],c=a[2]??a[3]??a[4]??"";u&&!u.endsWith("/")&&(r[u]=c)}}t.push({type:i.isSelfClosing||eu.has(i.tagName.toLowerCase())?"self_closing":"tag_open",tagName:i.tagName,attrs:r})}n=s+1}return t}function wre(e){const t=[];let n=0;for(;n",n);if(l!==-1){n=l+3;continue}break}const o=e.indexOf("<",n);if(o===-1){nn&&t.push({type:"text",content:e.slice(n,o)}),e.startsWith("![CDATA[",o+1)){const l=e.indexOf("]]>",o);if(l!==-1){t.push({type:"text",content:e.slice(o,l+3)}),n=l+3;continue}break}if(e.startsWith("!",o+1)){const l=e.indexOf(">",o);if(l!==-1){n=l+1;continue}break}const s=e.indexOf(">",o);if(s===-1)break;const i=uL(e.slice(o+1,s));if(!i){t.push({type:"text",content:e.slice(o,s+1)}),n=s+1;continue}if(i.isClosing){t.push({type:"tag_close",tagName:i.tagName}),n=s+1;continue}const r={};if(i.attrsStr){const l=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let a;for(;(a=l.exec(i.attrsStr))!==null;){const u=a[1],c=a[2]??a[3]??a[4]??"";u&&!u.endsWith("/")&&(r[u]=c)}}t.push({type:i.isSelfClosing||eu.has(i.tagName.toLowerCase())?"self_closing":"tag_open",tagName:i.tagName,attrs:r}),n=s+1}return t}function _re(e){const t=String(e.tagName??"").trim();if(!t)return"";if(e.type==="tag_close")return`</${Oa(t)}>`;const n=Object.entries(e.attrs??{}).map(([o,s])=>s===""?` ${Oa(o)}`:` ${Oa(o)}="${lL(s)}"`).join("");return e.type==="self_closing"?`<${Oa(t)}${n} />`:`<${Oa(t)}${n}>`}function xre(e,t){if(!e||!e.includes("<")||!t||Object.keys(t).length===0)return!1;for(const n of pL(e))if((n.type==="tag_open"||n.type==="self_closing")&&fL(n.tagName??"",t))return!0;return!1}function Vd(e,t="safe"){if(!e)return"";if(t==="escape")return Oa(e);const n=wre(e),o=[],s=[],i=[];for(const r of n){if(r.type==="text"){i.length===0&&s.push(Oa(r.content??""));continue}const l=A2(r.tagName);if(!l)continue;if(aL(l,t)){r.type==="tag_open"?i.push(l):r.type==="tag_close"&&i[i.length-1]===l&&i.pop();continue}if(i.length>0)continue;if(t==="safe"&&i5(l,t)){s.push(_re(r));continue}if(r.type==="self_closing"){s.push(`<${l}${xw(Sw(r.attrs??{},t,l))}>`);continue}if(r.type==="tag_open"){s.push(`<${l}${xw(Sw(r.attrs??{},t,l))}>`),eu.has(l)||o.push(l);continue}const a=o.lastIndexOf(l);if(a===-1)continue;for(;o.length>a+1;){const c=o.pop();c&&s.push(``)}const u=o.pop();u&&s.push(``)}for(;o.length>0;){const r=o.pop();r&&s.push(``)}return s.join("")}const Sre=[/javascript:/i,/vbscript:/i,/data:text\/html/i,/expression\s*\(/i,/@import/i],Aw="http://www.w3.org/2000/svg",Are=new Set(["script","style","iframe","object","embed","link","meta"]),Mre=new Set(["svg","style","g","a","defs","marker","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","title","desc","use","image","lineargradient","radialgradient","stop","clippath","mask","pattern"]),Tre=new Set(["href","xlink:href","src","srcdoc","action","data","formaction","poster"]),Ere=new Set(["clip-path","fill","filter","marker-end","marker-mid","marker-start","mask","stroke"]),Ire=new Set(["circle","ellipse","image","line","path","polygon","polyline","rect","text","tspan","use"]);function Lre(e){return(e.getAttribute("href")||e.getAttribute("xlink:href"))?.startsWith("#")===!0}function $re(e){return!!(e.getAttribute("href")||e.getAttribute("xlink:href")||e.getAttribute("src"))}function Nre(e){const t=e.nodeName.toLowerCase();return t==="use"?Lre(e):t==="image"?$re(e):t==="text"||t==="tspan"?!!e.textContent?.trim():Ire.has(t)}function Fre(e){return e.replace(/(["'])\s*javascript:/gi,"$1#").replace(/\bjavascript:/gi,"#").replace(/(["'])\s*vbscript:/gi,"$1#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#")}function Rre(e,t,n){const o=e.toLowerCase(),s=t.toLowerCase(),i=String(n??"").trim();return i?(o==="use"||o==="marker"||o==="clippath"||o==="mask")&&(s==="href"||s==="xlink:href")?i.startsWith("#")?i:"":o==="a"&&(s==="href"||s==="xlink:href")?ic(i,{tagName:"a",attrName:"href"})?"":i:o==="image"&&(s==="href"||s==="xlink:href"||s==="src")?ic(i,{tagName:"img",attrName:"src"})?"":i:s==="href"||s==="xlink:href"?i.startsWith("#")?i:"":ic(i,{tagName:o,attrName:s})?"":i:""}function Ore(e,t){let n=t+4;for(;n{const o=n.trim();if(/^[0-9a-f]+$/i.test(o)){const s=Number.parseInt(o,16);try{return Number.isFinite(s)?String.fromCodePoint(s):""}catch{return""}}return String(n).trim()})}function mL(e){const t=hL(e),n=t.toLowerCase();let o=0;for(;on.test(t))||mL(t)}function Pre(e){if(e.tagName.toLowerCase()!=="a"||e.getAttribute("target")?.trim().toLowerCase()!=="_blank")return;const t=new Set(String(e.getAttribute("rel")??"").split(/\s+/).map(n=>n.trim()).filter(Boolean).filter(n=>n.toLowerCase()!=="opener"));t.add("noopener"),t.add("noreferrer"),e.setAttribute("rel",Array.from(t).join(" "))}function vh(e){const t=Number.parseFloat(String(e??""));return Number.isFinite(t)?t:0}function gL(e,t){if(e.nodeType===Node.TEXT_NODE){const s=e.textContent??"";s&&t.push(s);return}if(e.nodeType!==Node.ELEMENT_NODE)return;const n=e,o=n.tagName.toLowerCase();if(!Are.has(o)){if(o==="br"){t.push(` -`);return}for(const s of Array.from(n.childNodes))gL(s,t)}}function Dre(e){for(const t of Array.from(e.querySelectorAll("foreignObject"))){const n=[];gL(t,n);const o=n.join("").split(/\r?\n/).map(c=>c.trim()).filter(Boolean);if(!o.length){t.remove();continue}const s=vh(t.getAttribute("width")),i=vh(t.getAttribute("height")),r=vh(t.getAttribute("x")),l=vh(t.getAttribute("y")),a=e.ownerDocument.createElementNS(Aw,"text");a.setAttribute("x",String(r+s/2)),a.setAttribute("y",String(l+i/2)),a.setAttribute("text-anchor","middle"),a.setAttribute("dominant-baseline","central");const u=t.querySelector(".nodeLabel");if(u?.getAttribute("class")&&a.setAttribute("class",u.getAttribute("class")),o.length===1)a.textContent=o[0];else{const c=-.6*(o.length-1);for(const[d,f]of o.entries()){const h=e.ownerDocument.createElementNS(Aw,"tspan");h.setAttribute("x",String(r+s/2)),h.setAttribute("dy",d===0?`${c}em`:"1.2em"),h.textContent=f,a.appendChild(h)}}t.parentNode?.replaceChild(a,t)}}function Bre(e){Dre(e);const t=[e,...Array.from(e.querySelectorAll("*"))];for(const n of t){const o=n.tagName.toLowerCase();if(!Mre.has(o)){n.remove();continue}if(o==="style"&&Mw(n.textContent??"")){n.remove();continue}const s=Array.from(n.attributes);for(const i of s){const r=i.name.toLowerCase();if(/^on/i.test(r)){n.removeAttribute(i.name);continue}if(r==="style"&&i.value&&Mw(i.value)){n.removeAttribute(i.name);continue}if(r==="srcdoc"){n.removeAttribute(i.name);continue}if(Tre.has(r)&&i.value){const l=Rre(o,r,i.value);if(!l){n.removeAttribute(i.name);continue}l!==i.value&&n.setAttribute(i.name,l);continue}if(Ere.has(r)&&i.value&&mL(i.value)){n.removeAttribute(i.name);continue}if(i.value){const l=Fre(i.value);l!==i.value&&n.setAttribute(i.name,l)}}Pre(n)}}function tVe(e){if(typeof DOMParser>"u"||!e)return null;try{const t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;if(!t||t.nodeName.toLowerCase()!=="svg")return null;const n=t;return Bre(n),Hre(n)?null:n}catch{return null}}function Hre(e){const t=e.getAttribute("viewBox");if(t){const s=t.trim().split(/[\s,]+/);if(s.length===4){const i=Number.parseFloat(s[2]||""),r=Number.parseFloat(s[3]||"");if(!Number.isFinite(i)||!Number.isFinite(r)||i<=0||r<=0)return!0}}const n=[e,...Array.from(e.querySelectorAll("*"))];let o=!1;for(const s of n){Nre(s)&&(o=!0);for(const i of Array.from(s.attributes))if(/\bNaN\b/i.test(i.value)||i.name==="style"&&/max-width:\s*0(?:px)?/i.test(i.value))return!0}return!o}const yh=[];function U9(e){return String(e??"").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function zre(e){return(String(e||"text").trim().split(/\s+/)[0]||"text").replace(/[^\w+.#:-]/g,"-").replace(/-+/g,"-")||"text"}function Wre(e){return e.replace(/[^\w:.+-]/g,"-").replace(/-+/g,"-")}function Tw(e=`editor-${Date.now()}`,t={}){const n=Ioe(t),o=n;o.__markstreamRegisteredPluginCount=yh.length,o.__markstreamHasCustomParserExtensions=!!(t.plugin?.length||t.apply?.length||yh.length);const s={"common.copy":"Copy"};let i;if(typeof t.i18n=="function")i=t.i18n;else if(t.i18n&&typeof t.i18n=="object"){const g=t.i18n;i=m=>g[m]??s[m]??m}else i=g=>s[g]??g;if(Array.isArray(t.plugin))for(const g of t.plugin){const m=g;if(Array.isArray(m)){const[w,..._]=m;typeof w=="function"&&n.use(w,..._)}else typeof m=="function"&&n.use(m)}if(Array.isArray(t.apply))for(const g of t.apply)try{g(n)}catch(m){console.error("[getMarkdown] apply function threw an error",m)}if(yh.length)for(const g of yh)if(Array.isArray(g)){const[m,...w]=g;typeof m=="function"&&n.use(m,...w)}else typeof g=="function"&&n.use(g);n.use(qY),n.use(GY),n.use(UY);const r=uX,l=r.default??r;n.use(l),n.use(WY),n.use(zY),n.core.ruler.after("block","mark_fence_closed",g=>{const m=g,w=m.src,_=!!m.env?.__markstreamFinal,v=w.split(/\r?\n/);for(const k of m.tokens){if(k.type!=="fence"||!k.map||!k.markup)continue;const y=k.map[0],x=k.map[1],M=k.markup,$=M[0],S=M.length,I=v[Math.max(0,x-1)]??"";let P=0;for(;Py+1&&D>=S&&T===I.length,B=k;B.meta=B.meta??{},B.meta.unclosed=!L,B.meta.closed=!!L}});const a=(g,m)=>{const w=g,_=w.pos;if(w.src[_]!=="~")return!1;const v=w.src[_-1],k=w.src[_+1];if(/\d/.test(v)&&/\d/.test(k)){if(!m){const y=w.push("text","",0);y.content="~"}return w.pos+=1,!0}return!1};n.inline.ruler.before("sub","wave",a),n.renderer.rules.fence=(g,m)=>{const w=g[m],_=String(w.info??"").trim(),v=String(w.content??""),k=btoa(unescape(encodeURIComponent(v))),y=zre(_),x=U9(y),M=Wre(`editor-${e}-${m}-${y}`),$=U9(i("common.copy"));return`
        -
        - ${U9(y.toUpperCase())} - -
        -
        -
        `};const u=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,d=g=>{if(!g.startsWith("["))return!1;const m=c.exec(g);if(!m)return g!=="["&&!/^\[\d+$/.test(g);const w=String(m[1]??"");return g.slice(m[0].length).startsWith("(")?!1:!/^\d+$/.test(w)},f=(g,m)=>{const w=g;if(w.src[w.pos]!=="[")return!1;const _=u.exec(w.src.slice(w.pos));if(!_)return!1;const v=w.src.slice(Math.max(0,w.pos-120),w.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(v))return!1;const k=w.src.slice(w.pos+_[0].length);if(k.startsWith("](")||k.startsWith("(")||d(k))return!1;if(!m){const y=_[1],x=w.push("reference","span",0);x.content=y,x.markup=_[0],x.raw=_[0]}return w.pos+=_[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(g,m)=>{const _=String(g[m].content??"");return`${_}`};const h=n.use.bind(n);return n.use=((...g)=>(o.__markstreamHasCustomParserExtensions=!0,h(...g))),n}function Ure({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function vL({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Ure({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const jre={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Vre(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function yL(e){const t=Vre(e);return jre[t]??t}function qre(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>yL(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Kre(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Zre(e){return Kre(e)?.join("\0")??""}function Gre(e,t){return`${Zre(e)}\0\0${qre(t)?.join("\0")??""}`}function ld(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function Ew(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var Yre=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const g=Iw();this.startedAt=f&&this.hasStarted?g-this.normalizedStartDelayMs:g,this.lastTick=g,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=Iw();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,w=ele(g/Math.max(.001,m/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(w-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const _=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),v=Qre(this.source.slice(this.visible.length),_,this.segmenter);v.text&&(this.visible+=v.text,this.charBudget=Math.max(0,this.charBudget-v.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:u=80,flushOnFinish:c=!1}=e;this.minCharsPerSecond=ld(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,ld(o,1e3,1)),this.normalizedTargetLatencyMs=ld(s,900,1),this.normalizedCatchUpLatencyMs=ld(i,350,1),this.normalizedCatchUpThreshold=Ew(r,600),this.normalizedStartDelayMs=Ew(a,80),this.maxCommitFps=Math.trunc(ld(l,30,1)),this.maxCharsPerCommit=Math.trunc(ld(u,80,1)),this.flushOnFinish=c,this.segmenter=Jre(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function Xre(e={},t){const n=new Yre(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Jre(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function Qre(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function Iw(){return typeof performance<"u"?performance.now():Date.now()}function ele(e,t,n){return Math.min(n,Math.max(t,e))}var tle=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const F3=Symbol.for("markstream-vue:node-lifecycle");function nVe(){}const l5=new Map;let kL="material";const Md=new Map,Lw=new Map;let R3=null;function nle(e){l5.set(e.id,e)}function ole(e){const t=l5.get(kL);if(!t)return;const n=t.core[e];if(n)return n;const o=Md.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Md.has(t.id)&&ile(t)}function sle(){var e,t;return(t=(e=l5.get(kL))==null?void 0:e.fallback)!=null?t:""}function ile(e){return tle(this,null,function*(){var t,n,o;if(Md.has(e.id))return(t=Md.get(e.id))!=null?t:null;let s=Lw.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Md.set(e.id,i),R3?.(),i)).catch(()=>(Md.set(e.id,null),null)),Lw.set(e.id,s)),s})}const $w='',Nw='',rle={id:"material",core:{"":Nw,plain:'',text:Nw,javascript:'',typescript:'',jsx:'',tsx:'',html:'',css:'',scss:'',json:'',python:'',ruby:'',go:'',java:'',kotlin:'',c:'',cpp:'',cs:$w,csharp:$w,php:'',shell:'',powershell:'',sql:'',yaml:'',markdown:'',xml:'',rust:'',vue:'',mermaid:''},fallback:'',loadExtended:()=>Go(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},lle=Xr(0);R3=()=>{lle.value++},nle(rle);const ale={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function M2(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=ale[n])!=null?t:n}function oVe(e){const t=M2(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function sVe(e){return ole(M2(e))||sle()}const Fw={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var T2=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let vi=null,Ju=!1,Qu=null,E2=u5;function Gp(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function a5(){try{const e=globalThis;return Gp(e?.katex)}catch{return null}}function u5(){return T2(null,null,function*(){const e=a5();if(e)return e;const t=yield Go(()=>import("./katex-DnlPpQZa.js"),[]);try{yield Go(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([0,1]))}catch{}return Gp(t)})}function bL(e){const t=Promise.resolve(e).then(n=>{var o;return Qu===t&&n?(vi=(o=Gp(n))!=null?o:n,vi):null}).catch(()=>null).finally(()=>{Qu===t&&(Qu=null)});return Qu=t,Ju=!0,t}function ule(e){E2=e,vi=null,Ju=!1,Qu=null}function cle(e){ule(u5)}function CL(){return typeof E2=="function"}function iVe(){var e;const t=E2;if(!t||t===u5)return null;if(vi)return vi;const n=a5();if(n)return vi=n,vi;if(Ju)return null;try{const o=t();return o?typeof o?.then=="function"?(bL(o),null):(vi=(e=Gp(o))!=null?e:o,vi):null}catch{return null}}function wL(){return T2(this,null,function*(){var e;const t=a5();if(t)return vi=t,vi;if(vi)return vi;if(Qu)return Qu;if(Ju)return null;const n=E2;if(!n)return Ju=!0,null;try{const o=n();if(typeof o?.then=="function")return bL(o);if(o)return vi=(e=Gp(o))!=null?e:o,Ju=!0,vi}catch{}return Ju=!0,null})}function _L(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Ba=null,$a=null;const Bs=new Map,ta=new Map;let Ip=5;const lc=new Set;function G1(){if(Bs.size{const{id:n,html:o,error:s}=t.data,i=Bs.get(n);if(i)if(Bs.delete(n),clearTimeout(i.timeoutId),i.cleanup(),G1(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(ta.set(a,o),ta.size>200){const u=ta.keys().next().value;ta.delete(u)}}i.aborted||i.resolve(o)}},Ba.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Bs.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Bs.clear(),xL()}}function fle(){var e;for(const t of Bs.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Bs.clear(),xL(),Ba&&((e=Ba.terminate)==null||e.call(Ba)),Ba=null,$a=null}function ple(e,t=!0,n=2e3,o){return T2(this,null,function*(){performance.now();const s=_L(e);if(!CL()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if($a)return Promise.reject($a);const i=`${t?"d":"i"}:${s}`,r=ta.get(i);if(r)return G1(),Promise.resolve(r);const l=Ba||($a=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),$a.name="WorkerInitError",$a.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject($a);if(Bs.size>=Ip){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Bs.size,a.max=Ip,Promise.reject(a)}return new Promise((a,u)=>{if(o?.aborted){const m=new Error("Aborted");return m.name="AbortError",void u(m)}const c=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const m=Bs.get(c);if(!m)return;Bs.delete(c),m.cleanup();const w=new Error("Worker render timed out");w.name="WorkerTimeout",w.code="WORKER_TIMEOUT",m.aborted||m.reject(w),G1()},n);d=()=>{const m=Bs.get(c);if(!m||m.aborted)return;m.aborted=!0,m.cleanup();const w=new Error("Aborted");w.name="AbortError",u(w)},o&&o.addEventListener("abort",d,{once:!0});const h=a,g=u;Bs.set(c,{resolve:m=>{h(m)},reject:m=>{g(m)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:c,content:s,displayMode:t})}catch(m){const w=Bs.get(c);Bs.delete(c),clearTimeout(f),w?.cleanup(),w?.reject(m),G1()}})})}function rVe(e,t=!0,n){const o=`${t?"d":"i"}:${_L(e)}`;if(ta.set(o,n),ta.size>200){const s=ta.keys().next().value;ta.delete(s)}}const hle="WORKER_BUSY";function mle(e=2e3,t){return Bs.size{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),lc.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},lc.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const u=new Error("Wait for worker slot timed out");u.name="WorkerBusyTimeout",u.code="WORKER_BUSY_TIMEOUT",o(u)},e),queueMicrotask(()=>G1()),t&&(r=()=>{if(i)return;i=!0,a();const u=new Error("Aborted");u.name="AbortError",o(u)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const s1={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function lVe(e){return T2(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!CL()){const m=new Error("KaTeX rendering disabled");throw m.name="KaTeXDisabled",m.code="KATEX_DISABLED",m}const a=(s=o.timeout)!=null?s:s1.timeout,u=(i=o.waitTimeout)!=null?i:s1.waitTimeout,c=(r=o.backoffMs)!=null?r:s1.backoffMs,d=(l=o.maxRetries)!=null?l:s1.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):s1.maxRetries,h=o.signal;let g=0;for(;;){if(h?.aborted){const m=new Error("Aborted");throw m.name="AbortError",m}try{return yield ple(t,n,a,h)}catch(m){if(m?.code!==hle||g>=f)throw m;if(g++,yield mle(u,h).catch(()=>{}),h?.aborted){const w=new Error("Aborted");throw w.name="AbortError",w}c>0&&(yield new Promise(w=>globalThis.setTimeout(w,c*g)))}}})}function Td(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function gle(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function ng(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=gle(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function og(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function SL(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function sg(e,t=360,n=500){return SL(e,t,n)}function ig(e,t=360,n=500){return SL(e,t,n)}var vle=Object.defineProperty,yle=Object.defineProperties,kle=Object.getOwnPropertyDescriptors,Rw=Object.getOwnPropertySymbols,ble=Object.prototype.hasOwnProperty,Cle=Object.prototype.propertyIsEnumerable,Ow=(e,t,n)=>t in e?vle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,AL=(e,t)=>{for(var n in t||(t={}))ble.call(t,n)&&Ow(e,n,t[n]);if(Rw)for(var n of Rw(t))Cle.call(t,n)&&Ow(e,n,t[n]);return e},Pw=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const rg=()=>Go(()=>import("./mermaid.core-Cahi9cr1.js").then(e=>e.bp),__vite__mapDeps([2,3]));let jl=null,Ed=rg,_1=null,O3=!1,P3=!1,x1=0;function wle(e){Ed=e,x1++,jl=null,_1=null,O3=!1,P3=!1}function _le(e){wle(rg)}function Dw(){return typeof Ed=="function"}function Bw(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=AL({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},yle(n,kle(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function Hw(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=AL({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function aVe(){return Pw(this,null,function*(){if(jl)return jl;const e=(function(){try{const o=globalThis;return Bw(o?.mermaid)}catch{return null}})();if(e)return jl=e,Hw(jl),jl;const t=Ed,n=x1;return t?t===rg&&O3?null:_1||(_1=Pw(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===rg)return n===x1&&t===Ed&&(O3=!0,(function(i){P3||(P3=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===x1&&t===Ed&&(_1=null)}return n!==x1||t!==Ed?null:o?(jl=Bw(o),Hw(jl),jl):null}),_1):null})}let Fi=null,Na=null;const Pr=new Map,Wu=new Map;function Yh(e){for(const t of Pr.values())t.reject(e);Pr.clear(),Wu.clear()}let zw=5,Ww=!1;const xle="WORKER_BUSY",Uw="MERMAID_DISABLED";function Sle(e){if(Fi&&Fi!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Yh(n)}Fi=e,Na=null;const t=e;Fi.onmessage=n=>{if(Fi!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Pr.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Fi.onerror=n=>{var o,s;if(Fi===t)if(Pr.size!==0){try{Ww?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Yh(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Fi.onmessageerror=n=>{var o,s;if(Fi===t)if(Pr.size!==0){try{Ww?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Yh(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function Ale(){var e;if(Fi)try{Yh(new Error("Worker cleared")),(e=Fi.terminate)==null||e.call(Fi)}catch{}Fi=null,Na=null}function ML(e,t,n,o){if(!Dw()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=Uw,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=Wu.get(s);return i||(i=(function(r,l,a=1400){if(!Dw()){const c=new Error("Mermaid rendering disabled");return c.name="MermaidDisabled",c.code=Uw,Promise.reject(c)}if(Na)return Promise.reject(Na);const u=Fi||(Na=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Na.name="WorkerInitError",Na.code="WORKER_INIT_ERROR",null);if(!u)return Promise.reject(Na);if(Pr.size>=zw){const c=new Error("Worker busy");return c.name="WorkerBusy",c.code=xle,c.inFlight=Pr.size,c.max=zw,Promise.reject(c)}return new Promise((c,d)=>{const f=Math.random().toString(36).slice(2);let h,g=!1;const m=()=>{g||(g=!0,h!=null&&globalThis.clearTimeout(h),Pr.delete(f))},w={resolve:_=>{m(),c(_)},reject:_=>{m(),d(_)}};Pr.set(f,w);try{u.postMessage({id:f,action:r,payload:l})}catch(_){return Pr.delete(f),void d(_)}h=globalThis.setTimeout(()=>{const _=new Error("Worker call timed out");_.name="WorkerTimeout",_.code="WORKER_TIMEOUT";const v=Pr.get(f);v&&v.reject(_)},a)})})(e,t,n),Wu.set(s,i),i.then(()=>{Wu.get(s)===i&&Wu.delete(s)},()=>{Wu.get(s)===i&&Wu.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,u)=>{let c=()=>{};const d=()=>l.removeEventListener("abort",c);c=()=>{d();const f=new Error("Aborted");f.name="AbortError",u(f)},l.addEventListener("abort",c,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),u(f)})})})(i,o)}function uVe(e,t,n=1400,o){return ML("canParse",{code:e,theme:t},n,o)}function cVe(e,t,n=1400,o){return ML("findPrefix",{code:e,theme:t},n,o)}var Mle=Object.defineProperty,Tle=Object.defineProperties,Ele=Object.getOwnPropertyDescriptors,jw=Object.getOwnPropertySymbols,Ile=Object.prototype.hasOwnProperty,Lle=Object.prototype.propertyIsEnumerable,Vw=(e,t,n)=>t in e?Mle(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))Ile.call(t,n)&&Vw(e,n,t[n]);if(jw)for(var n of jw(t))Lle.call(t,n)&&Vw(e,n,t[n]);return e},rn=(e,t)=>Tle(e,Ele(t)),vo=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const $le="__global__",j9="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",D3=(()=>{const e=globalThis;if(e[j9])return e[j9];const t={scopedCustomComponents:{},revision:Xr(0)};return e[j9]=t,t})(),qw=D3.revision,Nle=Symbol("markstreamCustomComponents"),Fle=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Yp(e){return Fle.has(String(e).trim().toLowerCase())}function Rle(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function V9(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([xr(n),xr(Rle(n))]))!s||Yp(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function fs(e){const t=on(Nle,null);return R(()=>{var n;return qw.value,(function(o,s={}){return qw.value,mt(mt(mt({},V9(D3.scopedCustomComponents[$le]||{})),V9(s)),V9((function(i){return i&&D3.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const Ole=["aria-label"],Ple={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},Dle={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Kn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},er=Kn(tt({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(b(),A("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(b(),A("svg",Dle,[...n[1]||(n[1]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),C("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(b(),A("svg",Ple,[...n[0]||(n[0]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,Ole))}),[["__scopeId","data-v-be21ab83"]]);er.install=e=>{e.component(er.__name,er)};const Ble={class:"emoji-node"},Bi=Kn(tt({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(b(),A("span",Ble,N(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);Bi.install=e=>{e.component(Bi.__name,Bi)};const Hle=["id"],zle=["title"],tr=Kn(tt({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(b(),A("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[C("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+N(e.node.id)+"]",9,zle)],8,Hle))}}),[["__scopeId","data-v-c1463a29"]]);tr.install=e=>{e.component(tr.__name,tr)};const TL=(()=>{try{return!1}catch{}return!1})();function q9(e){TL&&console.warn(e)}function Kw(e,t="safe",n){return r5(e,t,n)}function EL(e){return Cre(e)}function K9(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function c5(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Gh((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),K9(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),K9(r.value)]):Object.entries(s).map(([r,l])=>[r,K9(l)]):null,t,n);var s;if(!o)return;const i=EL(Z1(o));return Object.keys(i).length>0?i:void 0}function Zw(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function i1(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Z9(e,t,n,o,s,i,r=!1){const l=(function(d,f){return fL(d,f)})(e,o);if(Vp.has(e.toLowerCase())||!l&&aL(e,i))return null;if(!l&&i5(e,i))return r?[Zw(e,t,!0)]:[Zw(e,t),...n,``];const a=r5(t,i,e),u=a.key,c=u!=null&&u!==""?u:s;if(l){const d=o[e]||o[e.toLowerCase()],f=EL(a);return nn(d,rn(mt({},f),{key:c}),n.length>0?n:void 0)}return nn(e,rn(mt({},a),{innerHTML:void 0,key:c}),n.length>0?n:void 0)}function IL(e,t){return xre(e,t)}function lg(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const u=[],c=[];for(const d of i)if(d.type==="text")(u.length>0?u[u.length-1].children:c).push(d.content);else if(d.type==="self_closing"){const f=Z9(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);i1(u.length>0?u[u.length-1].children:c,f)}else if(d.type==="tag_open")u.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let g=u.length-1;g>=0;g--)if(u[g].tagName.toLowerCase()===f){h=g;break}if(h!==-1)for(;u.length>h;){const g=u.pop(),m=Z9(g.tagName,g.attrs||{},g.children,r,g.autoKey,l);u.length>0?i1(u[u.length-1].children,m):i1(c,m),g.tagName.toLowerCase()!==f&&u.length>h&&q9(`Auto-closing unclosed tag: <${g.tagName}>`)}else q9(`Ignoring closing tag with no matching opening tag: `)}for(;u.length>0;){const d=u.pop(),f=Z9(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);u.length>0?i1(u[u.length-1].children,f):i1(c,f),q9(`Auto-closing unclosed tag: <${d.tagName}>`)}return c})(pL(e),t,n)}catch(s){return o=s,TL&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const Wle=["innerHTML"],nr=Kn(tt({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=on("markstreamHtmlPolicy",void 0),o=R(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=fs(()=>t.customId),i=tt({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=R(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:Vd(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const u=lg(l,s.value,o.value);if(u!==null)return{mode:"dynamic",nodes:u}}if(!IL(l,s.value))return{mode:"html",content:Vd(l,o.value)};const a=lg(l,s.value,o.value);return a===null?{mode:"html",content:Vd(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(b(),A("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[V(p(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(b(),A("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},N(r.value.content),3)):(b(),A("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,Wle))}}),[["__scopeId","data-v-d17f12b0"]]);nr.install=e=>{e.component(nr.__name,nr)};const Ule={class:"inline-code"},jle={key:0},ii=Kn(tt({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=mf(),o=on("markstreamFade",void 0),s=on("markstreamTextStreamState",void 0),i=on("markstreamStreamVersion",void 0),r=R(()=>{const v=n.fade;return v===""||v===!0||v==="true"||v!==!1&&v!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var v;return String((v=t.node.code)!=null?v:"")}),u=R(()=>!l.value),c=R(()=>{var v;const k=(v=n["index-key"])!=null?v:n.indexKey;return k==null||k===""?"":String(k)}),d=Z(t.node.code),f=Z(""),h=Z(0);let g;function m(){g?.(),g=void 0}function w(){m(),f.value&&(d.value=d.value+f.value,f.value="")}et([()=>t.node.code,c,l],([v])=>{const k=String(v??""),y=c.value,x=vL({nextContent:k,persistedContent:y?s?.get(y):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=x.settledContent,f.value=x.streamedDelta,x.appended?(h.value+=1,(function(){if(!f.value||g||!i)return;const M=i.value;g=et(()=>i.value,$=>{$!==M&&w()},{flush:"sync"})})()):f.value||m(),y&&s?.set(y,k)},{immediate:!0}),pf(m);const _=R(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(v,k)=>(b(),A("code",Ule,[u.value?(b(),A(Pe,{key:0},[Ve(N(a.value),1)],64)):(b(),A(Pe,{key:1},[d.value?(b(),A("span",jle,N(d.value),1)):te("",!0),f.value?(b(),A("span",{key:1,class:Re(["inline-code-stream-delta",[_.value]]),onAnimationend:w},N(f.value),35)):te("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);ii.install=e=>{e.component(ii.__name,ii)};const B3=Z(!1),Gw=Z(""),Yw=Z("top"),Y1=Z(null),X1=Z(null),H3=Z(null),z3=Z(null),Xw=Z(null);let Xh=null,Jh=null,W3=0;function LL(){Xh&&(clearTimeout(Xh),Xh=null),Jh&&(clearTimeout(Jh),Jh=null)}let kh=!1,bh=null,Jw=!1;function Vle(e,t,n="top",o=!1,s,i){if(!e)return;const r=++W3;LL();const l=()=>vo(null,null,function*(){var a,u;if(yield(function(){return vo(this,null,function*(){if(!kh&&!Jw&&typeof document<"u"){bh!=null||(bh=vo(null,null,function*(){const[{createApp:c,h:d},{default:f}]=yield Promise.all([Go(()=>import("./vue.runtime.esm-bundler-BX4cWW2k.js"),[]),Go(()=>import("./Tooltip-CPKMqLZA.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),c({setup:()=>()=>{var g;return d(f,{visible:B3.value,"anchor-el":Y1.value,content:Gw.value,placement:Yw.value,id:X1.value,originX:H3.value,originY:z3.value,isDark:(g=Xw.value)!=null?g:void 0})}}).mount(h),kh=!0}));try{yield bh}catch(c){kh=!1,bh=null,Jw=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",c)}}})})(),kh&&r===W3){X1.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Y1.value=e,Gw.value=t,Yw.value=n,H3.value=(a=s?.x)!=null?a:null,z3.value=(u=s?.y)!=null?u:null,Xw.value=typeof i=="boolean"?i:null,B3.value=!0;try{e.setAttribute("aria-describedby",X1.value)}catch{}}});o?l():Xh=setTimeout(l,80)}function qle(e=!1){W3+=1,LL();const t=()=>{if(Y1.value&&X1.value)try{Y1.value.removeAttribute("aria-describedby")}catch{}B3.value=!1,Y1.value=null,X1.value=null,H3.value=null,z3.value=null};e?t():Jh=setTimeout(t,120)}const Kle={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Zle=Symbol("markstreamI18nFallback");function $L(e,t){var n;return(n=t?.[e])!=null?n:Kle[e]}const U3=(e,t)=>{var n;return(n=$L(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function Qw(e,t){return{t(n){const o=$L(n,t);if(e.te&&o!=null&&!e.te(n))return U3(n,t);const s=e.t(n);return s===n&&o!=null?U3(n,t):s}}}function Gle(){const e=(function(){var n,o,s;try{const i=ds(),r=Zle,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=ds(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const u=i?.$te;return{t:r.bind(i),te:typeof u=="function"?u.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const u=l?.$te;return{t:a.bind(l),te:typeof u=="function"?u.bind(l):void 0}}}catch{}return null})();if(t)return Qw(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return Qw({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>U3(n,e)}}const NL=Symbol("ViewportPriority"),FL=Symbol("ViewportPriorityOptions"),RL=Symbol("OffscreenHeavyNodeDeferral"),Yle=R(()=>!1),gc="400px";function d5(){return on(FL,void 0)}function f5(){return on(RL,Yle)}function Xle(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=s?(n=window.requestIdleCallback)!=null?n:$=>window.setTimeout(()=>$({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:$=>window.clearTimeout($):null,a=new WeakMap;let u=1;const c=new Map,d=new Map,f=new Set;let h=null,g=null;function m($){if(!$)return"viewport";let S=a.get($);return S||(S=u++,a.set($,S)),String(S)}function w(){if(h!=null){try{l?.(h)}catch{}h=null}}function _($){if($){const S=c.get($);if(S&&!S.targets.size){try{S.io.disconnect()}catch{}c.delete($)}}d.size||f.size||w()}function v($){const S=d.get($);if(!S)return;const I=c.get(S.bucketKey);if(!S.visible.value){S.visible.value=!0;try{S.resolve()}catch{}}try{I?.io.unobserve($)}catch{}I?.targets.delete($),d.delete($),f.delete($),_(S.bucketKey)}function k(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const $=f.values().next().value;$&&(f.delete($),v($),f.size&&k())},{timeout:1200}))}function y($,S){if(!s||typeof IntersectionObserver>"u")return null;const I=(function(H,O){var F,W,z;return{root:(F=e?.(H??null))!=null?F:null,rootMargin:(W=O?.rootMargin)!=null?W:gc,threshold:(z=O?.threshold)!=null?z:0}})($,S),P=[m((D=I).root),D.rootMargin,D.threshold].join("\0");var D;const T=c.get(P);if(T)return{key:P,bucket:T};let L;try{L=new IntersectionObserver(H=>{for(const O of H)(O.isIntersecting||O.intersectionRatio>0)&&v(O.target)},{root:I.root,rootMargin:I.rootMargin,threshold:I.threshold})}catch{return null}const B={io:L,targets:new Map};return c.set(P,B),{key:P,bucket:B}}function x(){if(s&&i.value)for(const[$,S]of Array.from(d.entries())){const I=y($,S.opts);if(!I){v($);continue}if(I.key===S.bucketKey)continue;const P=S.bucketKey,D=c.get(P);try{D?.io.unobserve($)}catch{}D?.targets.delete($),S.bucketKey=I.key,I.bucket.targets.set($,S),I.bucket.io.observe($),_(P)}}et(i,$=>{if(!$){for(const S of Array.from(d.keys()))v(S);w()}},{flush:"sync"});const M=($,S)=>{const I=Z(!1);let P,D=!1;const T=new Promise(O=>{P=()=>{D||(D=!0,O())}}),L=()=>{const O=d.get($);if(!O)return f.delete($),void _();const F=c.get(O.bucketKey);try{F?.io.unobserve($)}catch{}F?.targets.delete($),d.delete($),f.delete($),_(O.bucketKey)};if(!s||!i.value)return I.value=!0,P(),{isVisible:I,whenVisible:T,destroy:L};const B=y($,S);if(!B)return I.value=!0,P(),{isVisible:I,whenVisible:T,destroy:L};const H={resolve:P,visible:I,bucketKey:B.key,opts:S};return d.set($,H),B.bucket.targets.set($,H),B.bucket.io.observe($),s&&g==null&&(g=window.requestAnimationFrame(()=>{g=null,x()})),S?.allowIdle!==!1&&(f.add($),k()),{isVisible:I,whenVisible:T,destroy:L}};return M.refresh=x,En(NL,M),M}function p5(){var e,t;const n=on(NL,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,u=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},c=h=>{if(!h)return;const g=s.get(h);if(g&&!g.targets.size){try{g.io.disconnect()}catch{}s.delete(h)}},d=h=>{const g=o.get(h);if(!g)return;const m=s.get(g.bucketKey);if(!g.visible.value){g.visible.value=!0;try{g.resolve()}catch{}}try{m?.io.unobserve(h)}catch{}o.delete(h),m?.targets.delete(h),i.delete(h),c(g.bucketKey),i.size||u()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,g)=>{const m=Z(!1);let w,_=!1;const v=new Promise(x=>{w=()=>{_||(_=!0,x())}}),k=()=>{const x=o.get(h);if(!x)return i.delete(h),void(i.size||u());const M=s.get(x.bucketKey);try{M?.io.unobserve(h)}catch{}o.delete(h),M?.targets.delete(h),i.delete(h),c(x.bucketKey),i.size||u()},y=(x=>{var M,$;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const S=(L=>{var B,H;return[(B=L?.rootMargin)!=null?B:gc,(H=L?.threshold)!=null?H:0].join("\0")})(x),I=s.get(S);if(I)return{key:S,bucket:I};const P=(M=x?.rootMargin)!=null?M:gc;let D;try{D=new IntersectionObserver(L=>{for(const B of L)(B.isIntersecting||B.intersectionRatio>0)&&d(B.target)},{root:null,rootMargin:P,threshold:($=x?.threshold)!=null?$:0})}catch{return null}const T={io:D,targets:new Set};return s.set(S,T),{key:S,bucket:T}})(g);return y?(o.set(h,{resolve:w,visible:m,bucketKey:y.key}),y.bucket.targets.add(h),y.bucket.io.observe(h),g?.allowIdle!==!1&&(i.add(h),f()),{isVisible:m,whenVisible:v,destroy:k}):(m.value=!0,w(),{isVisible:m,whenVisible:v,destroy:k})}}function Jle(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const Qle=["data-markstream-viewport-pending"],eae=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],tae={key:1,class:"image-placeholder"},nae={key:1,class:"image-node__raw-text"},oae={key:2,class:"image-shimmer-overlay"},sae={key:1,class:"image-node__raw-text"},iae={key:3,class:"image-error"},Va=Kn(tt({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=Z(!1),a=Z(!1),u=Z(""),c=Z("primary"),d=Z(null),f=mf(),h=on(F3,null),g=p5(),m=d5(),w=f5(),_=R(()=>_C(i.node.src)),v=R(()=>_C(i.fallbackSrc)),k=(s=(o=(n=ds())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),y=typeof window<"u"&&k?.getAttribute("src")===(_.value||v.value),x=Z(typeof window>"u"||y||!w.value),M=Xr(null);let $="",S=null;const I=R(()=>u.value),P=R(()=>!i.lazy),D=R(()=>typeof window<"u"&&w.value&&!y),T=R(()=>!D.value||x.value),L=R(()=>T.value?I.value:""),B=R(()=>{var de,he;return(he=(de=m?.value.heavyBlockMargin)!=null?de:m?.value.rootMargin)!=null?he:gc}),H=R(()=>!i.node.loading&&c.value!=="failed"&&u.value.length>0),O=R(()=>c.value==="failed"),F=R(()=>(!P.value||D.value&&!x.value)&&!l.value&&!a.value&&c.value!=="failed"&&u.value.length>0),W=R(()=>Jle(i,f));function z(de=W.value){de&&d.value&&h?.reportHeight(de,d.value.offsetHeight)}function U(de=W.value){de&&yt(()=>{z(de)})}function q(){S&&(clearTimeout(S),S=null)}function K(){const de=W.value;de&&$!==de&&($&&h?.markSettled($),q(),$=de,h?.markPending(de),typeof window<"u"&&(S=window.setTimeout(()=>{$===de&&(U(de),ie())},8e3)))}function ie(){return vo(this,null,function*(){const de=$;de&&(q(),$="",yield yt(),z(de),h?.markSettled(de))})}function ne(){if(c.value==="primary"&&v.value&&v.value!==u.value)return c.value="fallback",u.value=v.value,l.value=!1,a.value=!1,void U();c.value="failed",a.value=!0,r("error",u.value),U()}function Y(){l.value=!0,a.value=!1,r("load",I.value),U()}function le(de){de.preventDefault(),l.value&&!a.value&&r("click",[de,I.value])}const{t:Ee}=Gle();return et([_,v,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||_.value?(u.value=_.value,void(c.value="primary")):v.value?(u.value=v.value,void(c.value="fallback")):(u.value="",c.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&et([d,D],([de,he],pe,oe)=>{var ve;if((ve=M.value)==null||ve.destroy(),M.value=null,!he||x.value)return void(x.value=!0);if(!de)return void(x.value=!1);let G=!0;const X=g(de,{rootMargin:B.value,allowIdle:!1});M.value=X,x.value=X.isVisible.value,X.whenVisible.then(()=>{G&&M.value===X&&(x.value=!0)}),oe(()=>{G=!1,X.destroy(),M.value===X&&(M.value=null)})},{immediate:!0}),et([H,l,a,I,()=>i.lazy,T],([de,he,pe,oe,ve,G])=>de&&oe&&!pe&&G?he?(ie(),void U()):ve?(K(),void U()):void(he||pe||K()):(ie(),void U()),{flush:"post",immediate:!0}),Un(()=>{var de;(de=M.value)==null||de.destroy(),M.value=null,(function(){const he=$;he&&(q(),$="",h?.markSettled(he))})()}),(de,he)=>{var pe,oe,ve,G,X;return b(),A("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":D.value&&!x.value?"true":void 0},[H.value?(b(),A("img",{key:0,src:L.value||void 0,alt:String((oe=(pe=i.node.alt)!=null?pe:i.node.title)!=null?oe:""),title:String((G=(ve=i.node.title)!=null?ve:i.node.alt)!=null?G:""),class:Re(["image-node__img",{"is-loading":!P.value&&!l.value,"is-loaded":P.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:P.value?"high":void 0,decoding:P.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(X=i.node.alt)!=null?X:p(Ee)("image.preview"),onError:ne,onLoad:Y,onClick:le},null,42,eae)):te("",!0),e.node.loading&&!a.value?(b(),A("span",tae,[i.usePlaceholder?Cn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:I.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[he[0]||(he[0]=C("span",{class:"image-shimmer"},null,-1))],!0):(b(),A("span",nae,N(e.node.raw),1))])):te("",!0),F.value&&!e.node.loading?(b(),A("span",oae,[i.usePlaceholder?Cn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:I.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[he[1]||(he[1]=C("span",{class:"image-shimmer"},null,-1))],!0):(b(),A("span",sae,N(e.node.raw),1))])):te("",!0),O.value?(b(),A("span",iae,[Cn(de.$slots,"error",{node:i.node,displaySrc:I.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[he[2]||(he[2]=C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[C("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),C("span",null,N(p(Ee)("image.loadError")),1)],!0)])):te("",!0)],8,Qle)}}}),[["__scopeId","data-v-046e82ac"]]);Va.install=e=>{e.component(Va.__name,Va)};const rae={key:2},El=tt({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=fs(()=>t.customId),o=on("markstreamHtmlPolicy",void 0),s=on("markstreamNestedRendererProps",void 0),i=R(()=>{var g;return(g=o?.value)!=null?g:"safe"}),r=R(()=>{var g,m;const w=(g=s?.value)!=null?g:{};return rn(mt({},w),{customId:(m=t.customId)!=null?m:w.customId,htmlPolicy:i.value})}),l=zr({loader:()=>Promise.resolve().then(()=>x5),suspensible:!1}),a=R(()=>t.components[String(t.node.type)]),u=R(()=>!!(a.value&&n.value[t.node.type]&&!Yp(String(t.node.type)))),c=R(()=>u.value?c5(t.node,i.value):void 0),d=R(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=R(()=>{var g;return String((g=t.node.content)!=null?g:"")}),h=R(()=>{var g,m;return String((m=(g=t.node.content)!=null?g:t.node.raw)!=null?m:"")});return(g,m)=>a.value&&u.value?(b(),me(ys(a.value),Dn({key:0},c.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:ke(()=>[d.value?(b(),me(p(l),Dn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(b(),me(p(l),Dn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):te("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(b(),me(ys(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(b(),A("span",rae,N(h.value),1)):te("",!0)}}),e_=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function lae(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return rn(mt(mt({},e_),n),{enabled:(t=n.enabled)==null||t})}return mt({},e_)}function h5(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function OL(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function t_(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function aae(e){var t;return e.diff===!0||t_(e.language)||t_(OL(String((t=e.raw)!=null?t:"")))}function uae(e,t,n){const o=(function(s){const i=OL(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const u=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(u&&/[./\\-]/.test(u))return u}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const cae=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],dae={key:0,translate:"no",class:"markstream-pre__diff-code"},fae={class:"markstream-pre__diff-pane-content"},pae={class:"markstream-pre__diff-number","aria-hidden":"true"},hae={class:"markstream-pre__diff-content"},mae={class:"markstream-pre__diff-content-inner"},gae={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},vae=["textContent"],yae=["textContent"],Ri=tt({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(Y,le){const Ee=String(Y??"");return le?Ee:Ee.replace(/\r\n$|\n$|\r$/,"")}const o=R(()=>{var Y,le,Ee;const de=String((le=(Y=t.node)==null?void 0:Y.language)!=null?le:"");return String((Ee=String(de).split(/\s+/g)[0])!=null?Ee:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=R(()=>`language-${o.value}`),i=R(()=>{var Y;return t.loading===!0||((Y=t.node)==null?void 0:Y.loading)===!0}),r=R(()=>{var Y;return n((Y=t.node)==null?void 0:Y.code,i.value)});let l="",a=1;const u=R(()=>(function(Y){let le=0,Ee=1;Y.startsWith(l)&&(le=l.length,Ee=a,le>0&&Y[le-1]==="\r"&&Y[le]===` -`&&le++);for(let de=le;der.value.split(/\r\n|\n|\r/));let d=0,f="";const h=R(()=>{const Y=u.value;Y{var Y;return t.showLineNumbers===!0&&((Y=t.node)==null?void 0:Y.diff)===!0}),m=R(()=>g.value&&t.diffInline===!0),w=R(()=>{const Y=Number(t.reservedHeightPx);if(!Number.isFinite(Y)||Y<=0)return;const le=`${Math.ceil(Y)}px`;return i.value?{maxHeight:le,overflow:"auto"}:{height:le,minHeight:le,maxHeight:le,overflow:"auto"}}),_=["diff ","index ","--- ","+++ ","@@ "];function v(Y){return String(Y??"").trim().length===0}function k(Y,le="context",Ee={}){const de=v(Y);return{code:Y,kind:de&&le!=="hunk"&&le!=="spacer"&&!Ee.preserveBlankKind?"context":le,empty:de}}function y(Y){const le=n(Y,i.value);return le?le.split(/\r\n|\n|\r/):[]}function x(Y,le){return!v(Y[le])||le_.some(Ee=>le.startsWith(Ee)))}function I(Y,le){return le||!Y.startsWith(" ")||Y.startsWith(" ")?Y:` ${Y}`}function P(Y,le){const Ee=Y.length,de=le.length,he=[];let pe=0;for(;pe=pe&&G>=pe&&Y[ve]===le[G];)oe.unshift({originalIndex:ve,modifiedIndex:G}),ve--,G--;const X=ve-pe+1,fe=G-pe+1;if(X<=0||fe<=0||i.value||(X+1)*(fe+1)>15e5)return he.concat(oe);const Ce=fe+1,ge=new Uint32Array((X+1)*(fe+1));for(let ue=X-1;ue>=0;ue--)for(let Se=fe-1;Se>=0;Se--){const Ue=ue*Ce+Se;if(Y[pe+ue]===le[pe+Se])ge[Ue]=ge[(ue+1)*Ce+Se+1]+1;else{const _e=ge[(ue+1)*Ce+Se],Te=ge[ue*Ce+Se+1];ge[Ue]=_e>=Te?_e:Te}}const Q=[];let ee=0,ce=0;for(;ee=ge[ee*Ce+ce+1]?ee++:ce++;return he.concat(Q,oe)}function D(Y){var le;const Ee=(function(){var G,X;const fe=t.diffHideUnchangedRegions;if(fe==null||fe===!1)return null;const Ce=fe===!0?{}:fe;return Ce.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((G=Ce.contextLineCount)!=null?G:2)),minimumLineCount:Math.max(1,Math.floor((X=Ce.minimumLineCount)!=null?X:4))}})();if(!Ee||Y.length<1||Y.length>2||Y.length===2&&Y[0].lines.length!==Y[1].lines.length)return Y;const de=Y[0].lines,he=(le=Y[1])==null?void 0:le.lines,pe=G=>de[G].kind==="context"&&(he===void 0||he[G].kind==="context"&&de[G].code===he[G].code),oe=[];let ve=0;for(;ve=Ee.minimumLineCount){const fe=G+(G===0?0:Ee.contextLineCount),Ce=X-(X===de.length?0:Ee.contextLineCount);Ce-fe>=Ee.minimumLineCount&&oe.push({start:fe,end:Ce})}ve===G&&ve++}return oe.length?Y.map((G,X)=>{const fe=[];let Ce=0;for(const ge of oe)fe.push(...G.lines.slice(Ce,ge.start)),fe.push({code:X===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${G.key}-collapsed-${ge.start}-${ge.end}`,number:""}),Ce=ge.end;return fe.push(...G.lines.slice(Ce)),rn(mt({},G),{lines:fe})}):Y}const T=R(()=>{var Y,le,Ee,de;if(!g.value)return[];const he=(function(X){const fe=X.some(ge=>M(ge)),Ce=X.some(ge=>$(ge));return fe&&Ce||(function(){var ge,Q,ee,ce;if(o.value==="diff")return!0;const ue=(ce=(ee=String((Q=(ge=t.node)==null?void 0:ge.raw)!=null?Q:"").split(/\r?\n/,1)[0])==null?void 0:ee.trim())!=null?ce:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ue)})()&&(fe||Ce)})(c.value),pe=(function(){var X,fe;return((X=t.node)==null?void 0:X.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(m.value){const X=pe?(function(fe,Ce){const ge=y(fe),Q=y(Ce),ee=P(ge,Q);if(ee.length>0){const Te=[];let st=0,Fe=0;for(const Oe of ee){for(;st=ue&&Ue>=ue&&ge[Se]===Q[Ue];)_e.unshift(rn(mt({},k(Q[Ue])),{key:`inline-suffix-${Ue}`,number:Ue+1})),Se--,Ue--;for(let Te=ue;Te<=Se;Te++)ce.push(rn(mt({},k(ge[Te],"removed",{preserveBlankKind:x(ge,Te)})),{key:`inline-removed-source-${Te}`,number:Te+1}));for(let Te=ue;Te<=Ue;Te++)ce.push(rn(mt({},k(Q[Te],"added",{preserveBlankKind:x(Q,Te)})),{key:`inline-added-source-${Te}`,number:Te+1}));return ce.concat(_e)})((Y=t.node)==null?void 0:Y.originalCode,(le=t.node)==null?void 0:le.updatedCode):(function(fe){const Ce=[];let ge=1,Q=1;const ee=S(fe);for(const[ce,ue]of fe.entries())if(ue.startsWith("@@")){const Se=ue.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Se&&(ge=Number(Se[1]),Q=Number(Se[2])),Ce.push(rn(mt({},k(ue,"hunk")),{key:`inline-hunk-${ce}`,number:""}))}else if(M(ue))Ce.push(rn(mt({},k(I(ue.slice(1),ee),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${ce}`,number:ge++}));else if($(ue))Ce.push(rn(mt({},k(I(ue.slice(1),ee),"added",{preserveBlankKind:!0})),{key:`inline-added-${ce}`,number:Q++}));else{const Se=ee&&ue.startsWith(" ")?ue.slice(1):ue;Ce.push(rn(mt({},k(Se)),{key:`inline-context-${ce}`,number:Q})),ge++,Q++}return Ce})(c.value);return D([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:X}])}if(!he&&pe)return(function(X,fe){const Ce=y(X),ge=y(fe),Q=P(Ce,ge),ee=[],ce=[];let ue=0,Se=0,Ue=0;const _e=(Te,st)=>{const Fe=Math.max(Te-ue,st-Se);for(let Oe=0;Oern(mt({},X),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:ve.map((X,fe)=>rn(mt({},X),{key:`modified-${fe}`,number:fe+1}))}])}),L=R(()=>T.value.some(Y=>Y.lines.some(le=>le.kind==="collapsed"))),B=R(()=>{const Y=o.value;return Y?`Code block: ${Y}`:"Code block"}),H=Z(null),O=Z([]);let F=null,W=!1,z=null;function U(Y){const le=Number.parseFloat(String(Y??""));return Number.isFinite(le)&&le>0?le:0}function q(Y,le){var Ee;if(!Y)return le;if(Y.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const de=Y.querySelector(".markstream-pre__diff-content"),he=de?.getBoundingClientRect(),pe=(Ee=he?.height)!=null?Ee:0;return Math.max(le,Math.ceil(pe))}function K(){W||typeof window>"u"||(F!=null&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>{F=null,W||(function(){var Y,le;F=null;const Ee=H.value;if(!Ee||!g.value||m.value||!Ee.classList.contains("is-wrap"))return void(O.value.length&&(O.value=[]));const de=(function(fe){const Ce=window.getComputedStyle(fe),ge=U(Ce.getPropertyValue("--markstream-pre-diff-line-height"));if(ge>0)return ge;const Q=U(Ce.lineHeight);return Q>0?Q:18})(Ee),he=Array.from(Ee.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),pe=Array.from(Ee.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),oe=Math.max(he.length,pe.length),ve=[];for(let fe=0;fe{const ge=X[Ce];return ge&&Math.abs(fe.rowHeight-ge.rowHeight)<=.5&&Math.abs(fe.originalHeight-ge.originalHeight)<=.5&&Math.abs(fe.modifiedHeight-ge.modifiedHeight)<=.5})||(O.value=ve)})()}))}function ie(Y){z?.disconnect(),z=null,Y&&g.value&&!m.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{K()}),z.observe(Y))}function ne(Y,le){const Ee=O.value[Y];if(!Ee)return;const de=le==="original"?Ee.originalHeight:Ee.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(Ee.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(de)}px`}}return et(H,Y=>{ie(Y),yt(()=>K())},{flush:"post"}),et([g,m,T],()=>{ie(H.value),yt(()=>K())},{flush:"post",immediate:!0}),Un(()=>{W=!0,F!=null&&(window.cancelAnimationFrame(F),F=null),z?.disconnect(),z=null}),(Y,le)=>(b(),A("pre",{ref_key:"preRef",ref:H,style:Gt(w.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":g.value,"markstream-pre--diff-inline":m.value,"markstream-pre--diff-collapsed":L.value}]),"aria-busy":i.value,"aria-label":B.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[g.value?(b(),A("code",dae,[(b(!0),A(Pe,null,pt(T.value,Ee=>(b(),A("span",{key:Ee.key,class:Re(["markstream-pre__diff-pane",Ee.className])},[C("span",fae,[(b(!0),A(Pe,null,pt(Ee.lines,(de,he)=>(b(),A("span",{key:de.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${de.kind}`,{"markstream-pre__diff-line--empty":de.empty}]]),style:Gt(ne(he,Ee.key))},[le[0]||(le[0]=C("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),C("span",pae,N(de.number),1),C("span",hae,[C("span",mae,N(de.code),1)])],6))),128))])],2))),128))])):(b(),A(Pe,{key:1},[t.showLineNumbers?(b(),A("span",gae,[C("span",{class:"markstream-pre__line-numbers-text",textContent:N(h.value)},null,8,vae)])):te("",!0),C("code",{translate:"no",class:"markstream-pre__code",textContent:N(r.value)},null,8,yae)],64))],14,cae))}});Ri.install=e=>{e.component(Ri.__name,Ri)};const kae={key:0},Xo=Kn(tt({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=mf(),o=on("markstreamFade",void 0),s=on("markstreamTextStreamState",void 0),i=on("markstreamStreamVersion",void 0),r=R(()=>{const w=n.fade;return w===""||w===!0||w==="true"||w!==!1&&w!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var w;const _=(w=n["index-key"])!=null?w:n.indexKey;return _==null||_===""?"":String(_)}),u=Z(t.node.content),c=Z(""),d=Z(0);let f;function h(){f?.(),f=void 0}function g(){h(),c.value&&(u.value=u.value+c.value,c.value="")}et([()=>t.node.content,a,l],([w])=>{const _=String(w??""),v=a.value,k=vL({nextContent:_,persistedContent:v?s?.get(v):void 0,currentState:{settledContent:u.value,streamedDelta:c.value},typewriterEnabled:l.value});u.value=k.settledContent,c.value=k.streamedDelta,k.appended?(d.value+=1,(function(){if(!c.value||f||!i)return;const y=i.value;f=et(()=>i.value,x=>{x!==y&&g()},{flush:"sync"})})()):c.value||h(),v&&s?.set(v,_)},{immediate:!0}),pf(h);const m=R(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(w,_)=>(b(),A("span",{class:Re([[e.node.center?"text-node-center":""],"text-node"])},[u.value?(b(),A("span",kae,N(u.value),1)):te("",!0),c.value?(b(),A("span",{key:1,class:Re(["text-node-stream-delta",[m.value]]),onAnimationend:g},N(c.value),35)):te("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function S1(e,t,n){return tt({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=p5(),u=d5(),c=f5(),d=typeof window<"u"&&((l=(r=ds())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=Z(typeof window>"u"||d||!c.value),h=Xr(null);let g=null;function m(w){const _=w&&"$el"in w?w.$el:w;h.value=_ instanceof HTMLElement?_:null}return typeof window<"u"&&et([h,c],([w,_],v,k)=>{if(g?.destroy(),g=null,!_||f.value)return void(f.value=!0);if(!w)return;let y=!0;const x=a(w,{rootMargin:u?.value.heavyBlockMargin,allowIdle:!1});g=x,f.value=x.isVisible.value,x.whenVisible.then(()=>{y&&g===x&&(f.value=!0)}),k(()=>{y=!1,x.destroy(),g===x&&(g=null)})},{immediate:!0}),Un(()=>{g?.destroy(),g=null}),()=>nn(f.value?t:n,rn(mt({},s),{ref:m}),i)}})}Xo.install=e=>{e.component(Xo.__name,Xo)};const ag=tt({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,u;const c=M2(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=Fw[c]||(c?c.charAt(0).toUpperCase()+c.slice(1):Fw[""]),f=aae(n.node),h=uae(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),g=n.monacoOptions,m=f&&((l=n.estimatedDiffInline)!=null?l:h5(g??{},typeof window>"u"?0:window.innerWidth)),w=g?.diffAppearance,_=w==="dark"||w!=="light"&&n.isDark===!0,v=typeof g?.fontSize=="number"&&Number.isFinite(g.fontSize)&&g.fontSize>0?g.fontSize:12,k=typeof g?.lineHeight=="number"&&Number.isFinite(g.lineHeight)&&g.lineHeight>0?g.lineHeight:v===12?18:Math.max(12,Math.round(1.5*v)),y=typeof g?.tabSize=="number"&&Number.isFinite(g.tabSize)&&g.tabSize>0?g.tabSize:4,x=f?0:8,M=typeof((a=g?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(g.padding.top)&&g.padding.top>=0?g.padding.top:x,$=typeof((u=g?.padding)==null?void 0:u.bottom)=="number"&&Number.isFinite(g.padding.bottom)&&g.padding.bottom>=0?g.padding.bottom:x,S=typeof g?.fontFamily=="string"?g.fontFamily.trim():"",I=mt(mt({fontSize:`${v}px`,lineHeight:`${k}px`,tabSize:y,paddingTop:`${M}px`,paddingBottom:`${$}px`,"--markstream-pre-line-number-top":`${M}px`},f?{"--markstream-pre-diff-line-height":`${k}px`}:{}),S?{"--markstream-code-font-family":S}:{}),P=()=>nn("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[nn("svg",{class:"action-icon"})]),D=n.isShowPreview!==!1&&(c==="html"||c==="svg"),T=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||D&&n.showPreviewButton!==!1,L=H=>{if(H!=null)return typeof H=="number"?`${H}px`:String(H)},B=mt(mt(mt({"--markstream-code-layout-character-width":"1ch"},L(n.minWidth)?{minWidth:L(n.minWidth)}:{}),L(n.maxWidth)?{maxWidth:L(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return nn("div",rn(mt({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":_,"is-diff":f,"is-plain-text":c===""||c==="plaintext"||c==="text"},t.class],style:[B,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:nn("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[nn("div",{class:"code-header-main"},[nn("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),nn("div",{class:"code-header-copy"},[nn("div",{class:"code-header-title"},h.title),h.caption?nn("div",{class:"code-header-caption"},h.caption):null])]),nn("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?nn("div",{class:"code-diff-stats","aria-hidden":"true"},[nn("span",{class:"code-diff-stat removed"},"-0"),nn("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:P(),n.showCollapseButton===!1?null:P(),T?nn("div",{class:"relative"},[P()]):null])]),nn("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[nn(Ri,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:m,diffHideUnchangedRegions:f?lae(g?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:I,"data-markstream-code-loading":"1"})]),nn("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[nn("div",{class:"loading-skeleton"},[nn("div",{class:"skeleton-line"}),nn("div",{class:"skeleton-line"}),nn("div",{class:"skeleton-line short"})])]),nn("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),G9=S1("ViewportDeferredCodeBlockNode",zr({loader:()=>vo(null,null,function*(){try{return(yield Go(()=>import("./CodeBlockNode-ZZ-0lk3E.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Ri}}),loadingComponent:ag,delay:0,suspensible:!1}),ag),Jr=zr(()=>vo(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return nn(Xo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield wL(),(yield Go(()=>import("./index7-CjjTl3F3.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return nn(Xo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),PL=zr(()=>vo(null,null,function*(){try{return yield wL(),(yield Go(()=>import("./index6-BS7x8iLz.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return nn(Xo,rn(mt({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),wi=Kn(tt({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(b(),A("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},N(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);wi.install=e=>{e.component(wi.__name,wi)};const bae={class:"superscript-node"},Hi=Kn(tt({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,emphasis:Ai,footnote_reference:tr,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,emoji:Bi,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("sup",bae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Hi.install=e=>{e.component(Hi.__name,Hi)};const Cae={class:"subscript-node"},zi=Kn(tt({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,emphasis:Ai,footnote_reference:tr,strikethrough:xi,highlight:or,insert:Wi,superscript:Hi,emoji:Bi,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("sub",Cae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);zi.install=e=>{e.component(zi.__name,zi)};const wae={class:"strong-node"},_i=Kn(tt({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,emphasis:Ai,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,footnote_reference:tr,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("strong",wae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);_i.install=e=>{e.component(_i.__name,_i)};const _ae={class:"strikethrough-node"},xi=Kn(tt({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,emphasis:Ai,highlight:or,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,footnote_reference:tr,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("del",_ae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);xi.install=e=>{e.component(xi.__name,xi)};const xae=["href","title","aria-label","aria-hidden","target","rel"],Sae=["aria-hidden"],Aae={class:"link-text-wrapper relative inline-flex"},Mae={class:"leading-[normal] link-text"},Si=Kn(tt({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=on("markstreamShowTooltips",void 0),o=R(()=>{const _=n?.value;return typeof _=="boolean"?_:t.showTooltip}),s=R(()=>{var _,v,k,y,x;const M=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",$=(_=t.animationOpacity)!=null?_:.35,S=Math.max(.12,Math.min(.5*$,$)),I={"--underline-height":`${(v=t.underlineHeight)!=null?v:2}px`,"--underline-bottom":M,"--underline-opacity":String($),"--underline-rest-opacity":String(S),"--underline-duration":`${(k=t.animationDuration)!=null?k:1.6}s`,"--underline-timing":(y=t.animationTiming)!=null?y:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(x=t.animationIteration)!=null?x:"infinite"};return t.color&&(I["--link-color"]=t.color),I}),i=fs(()=>t.customId),r=R(()=>mt({text:Xo,strong:_i,strikethrough:xi,emphasis:Ai,image:Va,html_inline:nr,inline_code:ii},i.value)),l=mf(),a=R(()=>{var _,v;const k=(_=t.node)==null?void 0:_.attrs;if(!k||typeof k!="object")return{};const y={};if(Array.isArray(k))for(const x of k)Array.isArray(x)&&x[0]&&(y[String(x[0])]=String((v=x[1])!=null?v:""));else for(const[x,M]of Object.entries(k))x&&M!=null&&M!==!1&&(y[x]=M===!0?"":String(M));return Kw(y,"safe","a")}),u=R(()=>mt(mt({},l),a.value)),c=R(()=>{var _,v;return Kw({href:String((v=(_=t.node)==null?void 0:_.href)!=null?v:"")},"safe","a").href}),d=R(()=>{if(!c.value)return;const _=u.value.target;return(typeof _=="string"?_.trim():String(_??"").trim())||(wte(c.value)?"_blank":void 0)}),f=R(()=>{var _;return String((_=d.value)!=null?_:"").trim().toLowerCase()==="_blank"}),h=R(()=>{if(!c.value)return;const _=u.value.rel,v=new Set((typeof _=="string"?_:String(_??"")).split(/\s+/).filter(Boolean)),k=new Set(Array.from(v).filter(y=>y.toLowerCase()!=="opener"));return f.value&&(k.add("noopener"),k.add("noreferrer")),k.size>0?Array.from(k).join(" "):void 0}),g=R(()=>{const _=mt({},u.value);return delete _.title,delete _.href,delete _.target,delete _.rel,_});function m(){o.value&&qle()}const w=R(()=>{var _,v;const k=(_=t.node)==null?void 0:_.title;return typeof k=="string"&&k.trim().length>0?k:String((v=c.value)!=null?v:"")});return(_,v)=>{var k,y;return e.node.loading?(b(),A("span",Dn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},p(l),{style:s.value}),[C("span",Aae,[C("span",Mae,[V(p(Xo),{class:"leading-[normal] link-text",node:{type:"text",content:String((k=e.node.text)!=null?k:""),raw:String((y=e.node.text)!=null?y:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),v[1]||(v[1]=C("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,Sae)):(b(),A("a",Dn({key:0,class:"link-node",href:c.value,title:o.value?"":w.value,"aria-label":`Link: ${w.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},g.value,{style:s.value,onMouseenter:v[0]||(v[0]=x=>(function(M){var $,S,I,P;if(!o.value)return;const D=M,T=D?.clientX!=null&&D?.clientY!=null?{x:D.clientX,y:D.clientY}:void 0,L=(($=t.node)==null?void 0:$.title)||((S=c.value)!=null&&S.includes("xn--")&&((P=(I=t.node)==null?void 0:I.text)!=null&&P.includes("://"))?t.node.text:c.value)||"";Vle(M.currentTarget,L,"top",!1,T)})(x)),onMouseleave:m}),[(b(!0),A(Pe,null,pt(e.node.children,(x,M)=>(b(),me(p(El),{key:`${e.indexKey||"emphasis"}-${M}`,components:r.value,node:x,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${M}`},null,8,["components","node","custom-id","index-key"]))),128))],16,xae))}}}),[["__scopeId","data-v-367e6ca4"]]);Si.install=e=>{e.component(Si.__name,Si)};const Tae={class:"insert-node"},Wi=Kn(tt({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,emphasis:Ai,strikethrough:xi,highlight:or,subscript:zi,superscript:Hi,emoji:Bi,footnote_reference:tr,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("ins",Tae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);Wi.install=e=>{e.component(Wi.__name,Wi)};const Eae={class:"highlight-node"},or=Kn(tt({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,emphasis:Ai,strikethrough:xi,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,footnote_reference:tr,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("mark",Eae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);or.install=e=>{e.component(or.__name,or)};const Iae={class:"emphasis-node"},Ai=Kn(tt({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:Xo,inline_code:ii,link:Si,html_inline:nr,strong:_i,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,footnote_reference:tr,math_inline:Jr,reference:wi},n.value));return(s,i)=>(b(),A("em",Iae,[(b(!0),A(Pe,null,pt(e.node.children,(r,l)=>(b(),me(p(El),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ai.install=e=>{e.component(Ai.__name,Ai)};const Lae={class:"hard-break"},qa=Kn(tt({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(b(),A("br",Lae))}),[["__scopeId","data-v-50c58f70"]]);qa.install=e=>{e.component(qa.__name,qa)};const Lp=tt({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=kt({checkbox:er,checkbox_input:er,emoji:Bi,emphasis:Ai,hardbreak:qa,highlight:or,inline_code:ii,insert:Wi,link:Si,reference:wi,strikethrough:xi,strong:_i,subscript:zi,superscript:Hi,text:Xo}),o=fs(()=>t.customId),s=R(()=>{const i=o.value;return Object.keys(i).length>0?mt(mt({},n),i):n});return(i,r)=>(b(!0),A(Pe,null,pt(e.nodes,(l,a)=>(b(),me(p(El),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function j3(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(j3)}function ug(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(j3))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(j3)?s:null}function vc(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const $ae=["cite"],Nae={key:0,dir:"auto",class:"paragraph-node"},Fae=["custom-id"],Qh=Kn(tt({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>!!n.value.paragraph),s=R(()=>!!n.value.text),i=R(()=>ug(t.node.children,!o.value)),r=R(()=>t.fade!==!1||s.value?null:vc(i.value));return En("markstreamShowTooltips",R(()=>t.showTooltips)),En("markstreamFade",R(()=>t.fade)),(l,a)=>(b(),A("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(b(),A("p",Nae,[r.value!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(r.value),9,Fae)):(b(),me(p(Lp),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(b(),me(p(Ui),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=u=>l.$emit("copy",u))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,$ae))}}),[["__scopeId","data-v-abfecebc"]]);Qh.install=e=>{e.component(Qh.__name,Qh)};const Rae={class:"definition-list"},Oae={class:"definition-term"},Pae={class:"definition-desc"},em=Kn(tt({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(b(),A("dl",Rae,[(b(!0),A(Pe,null,pt(t.node.items,(s,i)=>(b(),A(Pe,{key:i},[C("dt",Oae,[V(p(Ui),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),C("dd",Pae,[V(p(Ui),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);em.install=e=>{e.component(em.__name,em)};const Dae=["href","title"],J1=Kn(tt({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(b(),A("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,Dae))}}),[["__scopeId","data-v-e1eb37b6"]]);J1.install=e=>{e.component(J1.__name,J1)};const Bae=["id"],Hae={class:"flex-1"},tm=tt({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(b(),A("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[C("div",Hae,[V(p(Ui),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,Bae))}});tm.install=e=>{e.component(tm.__name,tm)};const zae=["custom-id"],V3=Kn(tt({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=on("markstreamFade",void 0),s=R(()=>o?.value!==!1||n.value.text?null:vc(t.node.children)),i=R(()=>mt({text:Xo,inline_code:ii,link:Si,image:Va,strong:_i,emphasis:Ai,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,checkbox:er,checkbox_input:er,footnote_reference:tr,hardbreak:qa,math_inline:Jr,reference:wi},n.value));return(r,l)=>(b(),me(ys(`h${e.node.level}`),Dn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:ke(()=>[s.value!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(s.value),9,zae)):(b(!0),A(Pe,{key:1},pt(e.node.children,(a,u)=>(b(),me(p(El),{key:u,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${u}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),I2=V3;I2.install=e=>{e.component(V3.__name,V3)};const Wae={key:0,dir:"auto",class:"paragraph-node"},Uae=["custom-id"],jae={dir:"auto",class:"paragraph-node"},Vae=["custom-id"],qd=Kn(tt({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var h;return(h=t.node)!=null?h:t.item}),o=fs(()=>t.customId),s=R(()=>!!o.value.paragraph),i=R(()=>!!o.value.text),r=R(()=>{var h;return ug((h=n.value)==null?void 0:h.children,!s.value)}),l=R(()=>{var h;if(s.value)return null;const g=(h=n.value)==null?void 0:h.children;if(!Array.isArray(g)||g.length<2)return null;const m=g[0];if(m?.type!=="paragraph"||!Array.isArray(m.children))return null;const w=g.slice(1);if(!w.every(v=>v?.type==="list"))return null;const _=ug([m]);return _?{paragraphChildren:_,nestedLists:w}:null});function a(){return t.fade===!1&&!i.value}const u=R(()=>a()?vc(r.value):null),c=R(()=>{var h;return a()?vc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=R(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return En("markstreamShowTooltips",R(()=>t.showTooltips)),En("markstreamFade",R(()=>t.fade)),(h,g)=>{var m,w;return b(),A("li",Dn({class:"list-item",dir:"auto"},f.value),[r.value?(b(),A("p",Wae,[u.value!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(u.value),9,Uae)):(b(),me(p(Lp),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(b(),A(Pe,{key:1},[C("p",jae,[c.value!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(c.value),9,Vae)):(b(),me(p(Lp),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(b(!0),A(Pe,null,pt(l.value.nestedLists,(_,v)=>(b(),me(p(Ui),{key:v,nodes:[_],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${v}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:g[0]||(g[0]=k=>h.$emit("copy",k))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(b(),me(p(Ui),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(w=(m=n.value)==null?void 0:m.children)!=null?w:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:g[1]||(g[1]=_=>h.$emit("copy",_))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);qd.install=e=>{e.component(qd.__name,qd)};const Kd=Kn(tt({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=fs(()=>e.customId),n=R(()=>t.value.list_item||qd);return(o,s)=>(b(),me(ys(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:ke(()=>[(b(!0),A(Pe,null,pt(e.node.items,(i,r)=>{var l;return b(),me(ys(n.value),Dn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);Kd.install=e=>{e.component(Kd.__name,Kd)};const qae={key:2,class:"html-block-node__raw"},Kae=["innerHTML"],Zae={key:1,class:"html-block-node__placeholder"},Q1=Kn(tt({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=on("markstreamHtmlPolicy",void 0),o=on("markstreamNestedRendererProps",void 0),s=R(()=>{var T,L;return(L=(T=t.htmlPolicy)!=null?T:n?.value)!=null?L:"safe"}),i=R(()=>{var T,L;const B=(T=o?.value)!=null?T:{};return rn(mt({},B),{customId:(L=t.customId)!=null?L:B.customId,htmlPolicy:s.value})}),r=zr({loader:()=>Promise.resolve().then(()=>x5),suspensible:!1}),l=R(()=>{const T=Gh(t.node.attrs,s.value);if(!T)return;const L=Z1(T);return Object.keys(L).length>0?L:void 0}),a=R(()=>{const T=String(t.node.tag||"").trim(),L=Gh(t.node.attrs,s.value,T);if(!L)return;const B=Z1(L);return Object.keys(B).length>0?B:void 0}),u=fs(()=>t.customId),c=tt({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),f=Z(typeof window>"u"),h=Z(t.node.content),g=R(()=>Array.isArray(t.node.children)?t.node.children:[]),m=R(()=>String(t.node.tag||"div")),w=R(()=>{var T;if(m.value.trim().toLowerCase()!=="details"||(T=t.node.attrs)!=null&&T.some(([B])=>String(B).toLowerCase()==="open"))return null;const L=g.value[0];return L?.type==="html_block"&&String(L.tag||"").toLowerCase()==="summary"?L:null}),_=R(()=>{var T;return vc((T=w.value)==null?void 0:T.children)}),v=R(()=>{const T=w.value;if(!T)return;const L=Gh(T.attrs,s.value,"summary");if(!L)return;const B=Z1(L);return Object.keys(B).length>0?B:void 0}),k=R(()=>_.value==null?g.value:g.value.slice(1)),y=R(()=>{const T=m.value.trim().toLowerCase();return iI.has(T)||i5(T,s.value)}),x=R(()=>g.value.length>0&&!!t.node.tag&&!y.value),M=R(()=>{var T,L,B;if(x.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(T=h.value)!=null?T:""};const H=(L=h.value)!=null?L:t.node.content;if(!H)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:Vd(H,s.value)};if(t.node.loading){const F=lg(H,u.value,s.value);return F===null?{mode:"text",content:(B=t.node.raw)!=null?B:H}:{mode:"dynamic",nodes:F}}if(!IL(H,u.value))return{mode:"html",content:Vd(H,s.value)};const O=lg(H,u.value,s.value);return O===null?{mode:"html",content:Vd(H,s.value)}:{mode:"dynamic",nodes:O}}),$=p5(),S=d5(),I=f5(),P=Xr(null),D=!!t.node.loading;return typeof window<"u"?(et([()=>d.value,()=>S?.value.heavyBlockMargin,()=>S?.value.rootMargin],([T],L,B)=>{var H,O,F,W;if((O=(H=P.value)==null?void 0:H.destroy)==null||O.call(H),P.value=null,!D)return f.value=!0,void(h.value=t.node.content);if(!T)return void(f.value=!1);let z=!0;const U=(W=(F=S?.value.heavyBlockMargin)!=null?F:S?.value.rootMargin)!=null?W:gc,q=$(T,{rootMargin:U,allowIdle:!I.value});P.value=q,f.value=f.value||q.isVisible.value,q.whenVisible.then(()=>{z&&P.value===q&&(f.value=!0)}),B(()=>{z=!1,q.destroy(),P.value===q&&(P.value=null)})},{immediate:!0}),et(()=>t.node.content,T=>{D&&!f.value||(h.value=T)})):f.value=!0,Un(()=>{var T,L;(L=(T=P.value)==null?void 0:T.destroy)==null||L.call(T),P.value=null}),(T,L)=>(b(),me(ys(x.value?m.value:"div"),Dn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":p(I)&&!f.value?"true":void 0},x.value?a.value:void 0),{default:ke(()=>[f.value?(b(),A(Pe,{key:0},[M.value.mode==="structured"?(b(),A(Pe,{key:0},[_.value!==null?(b(),A(Pe,{key:0},[C("summary",bR(FA(v.value)),N(_.value),17),k.value.length?(b(),me(p(r),Dn({key:0},i.value,{nodes:k.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):te("",!0)],64)):(b(),me(p(r),Dn({key:1},i.value,{nodes:g.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):M.value.mode==="dynamic"?(b(),me(p(c),{key:1,nodes:M.value.nodes},null,8,["nodes"])):M.value.mode==="text"?(b(),A("pre",qae,N(M.value.content),1)):(b(),A("div",Dn({key:3},l.value,{innerHTML:M.value.content}),null,16,Kae))],64)):(b(),A("div",Zae,[Cn(T.$slots,"placeholder",{node:e.node},()=>[L[0]||(L[0]=C("span",{class:"html-block-node__placeholder-bar"},null,-1)),L[1]||(L[1]=C("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),L[2]||(L[2]=C("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Q1.install=e=>{e.component(Q1.__name,Q1)};const Gae={dir:"auto",class:"paragraph-node"},Yae=["custom-id"],ac=Kn(tt({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=fs(()=>t.customId),o=on("markstreamHtmlPolicy",void 0),s=on("markstreamFade",void 0),i=on("markstreamParseOptions",void 0),r=on("markstreamCustomMarkdownIt",void 0),l=on("markstreamNestedRendererProps",void 0),a=R(()=>{var S;return(S=o?.value)!=null?S:"safe"}),u=R(()=>{var S;return(S=t.parseOptions)!=null?S:i?.value}),c=R(()=>{var S;return(S=t.customMarkdownIt)!=null?S:r?.value}),d=R(()=>{var S,I;return(I=t.customHtmlTags)!=null?I:(S=l?.value)==null?void 0:S.customHtmlTags}),f=R(()=>{var S,I;const P=(S=l?.value)!=null?S:{};return rn(mt({},P),{customId:(I=t.customId)!=null?I:P.customId,customHtmlTags:d.value,parseOptions:u.value,customMarkdownIt:c.value,htmlPolicy:a.value})}),h=zr({loader:()=>Promise.resolve().then(()=>x5),suspensible:!1});function g(S){var I;return S.type==="text"&&String((I=S.content)!=null?I:"").trim()===""}const m=R(()=>t.node.children.filter(S=>!g(S))),w=R(()=>m.value.length>0&&m.value.every(S=>S.type==="image"||(function(I){var P;const D=(function(T){return T.type==="link"&&Array.isArray(T.children)?T.children.filter(L=>!g(L)):[]})(I);return D.length===1&&((P=D[0])==null?void 0:P.type)==="image"})(S))),_=R(()=>new Set(Ec(d.value))),v=R(()=>{if(!w.value||m.value.length<=1)return t.node.children;const S=[];for(let I=0;I0,T=t.node.children.slice(I+1).some(L=>!g(L));D&&T&&S.push(rn(mt({},P),{content:" ",raw:" "}))}return S}),k=R(()=>s?.value===!1&&!n.value.text),y=R(()=>k.value?vc(v.value):null);function x(S,I){return{node:S,"index-key":`${t.indexKey}-${I}`,"custom-id":t.customId,"custom-html-tags":d.value}}const M=R(()=>mt({inline_code:ii,image:Va,link:Si,hardbreak:qa,emphasis:Ai,strong:_i,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,superscript:Hi,html_inline:nr,html_block:Q1,emoji:Bi,checkbox:er,math_inline:Jr,checkbox_input:er,reference:wi,footnote_anchor:J1,footnote_reference:tr,text:Xo},n.value)),$=R(()=>v.value.map((S,I)=>{var P;const D=(function(T){var L,B,H,O;if(T.type==="html_block"||T.type==="html_inline"){const F=String((L=T.tag)!=null?L:"").trim().toLowerCase()||cI(T.content);if(F&&!_.value.has(F)&&dI((B=T.content)!=null?B:T.raw,F)){const W=String((O=(H=T.content)!=null?H:T.raw)!=null?O:"");return{child:{type:"text",content:W,raw:W},component:Xo,isCustomComponent:!1}}}return{child:T,component:M.value[T.type],isCustomComponent:!!(n.value[T.type]&&!Yp(String(T.type)))}})(S);return rn(mt({},D),{index:I,key:`${t.indexKey||"paragraph"}-${I}`,customAttrs:D.isCustomComponent?c5(D.child,a.value):void 0,hasSlotChildren:Array.isArray(D.child.children)&&D.child.children.length>0,slotContent:String((P=D.child.content)!=null?P:""),originalChild:S})}));return(S,I)=>(b(),A("p",Gae,[y.value!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(y.value),9,Yae)):(b(!0),A(Pe,{key:1},pt($.value,P=>{return b(),A(Pe,{key:P.key},[w.value&&g(P.originalChild)?(b(),A(Pe,{key:0},[Ve(N((D=P.originalChild,String((T=D.content)!=null?T:""))),1)],64)):P.isCustomComponent?(b(),me(ys(P.component),Dn({key:1,ref_for:!0},P.customAttrs,{node:P.child,loading:P.child.loading,"index-key":P.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:ke(()=>[P.hasSlotChildren?(b(),me(p(h),Dn({key:0,ref_for:!0},f.value,{nodes:P.child.children,"index-key":P.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):P.slotContent?(b(),me(p(h),Dn({key:1,ref_for:!0},f.value,{content:P.slotContent,final:!P.child.loading,"index-key":`${P.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):te("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(b(),me(ys(P.component),Dn({key:2,ref_for:!0},x(P.child,P.index)),null,16))],64);var D,T}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);ac.install=e=>{e.component(ac.__name,ac)};const Xae={class:"table-node-wrapper"},Jae=["aria-busy"],Qae={key:0},eue=["custom-id"],tue=["aria-label","onPointerdown"],nue=["custom-id"],oue={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ep=Kn(tt({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var _;return(_=t.node.loading)!=null&&_}),o=R(()=>{var _;return(_=t.node.rows)!=null?_:[]}),s=Z(null),i=Z([]);let r=null;const l=R(()=>t.node.header.cells.length),a=R(()=>i.value.some(_=>Number.isFinite(_)&&_>0)),u=R(()=>a.value?i.value.map(_=>_>0?{width:`${_}px`}:void 0):[]);En("markstreamShowTooltips",R(()=>t.showTooltips)),En("markstreamFade",R(()=>t.fade));const c=fs(()=>t.customId),d=R(()=>!!c.value.text),f=R(()=>!!c.value.paragraph),h=new WeakMap;function g(_){const v=t.fade===!1&&!d.value,k=!f.value,y=h.get(_);if(y?.children===_.children&&y.textFastPath===v&&y.paragraphFastPath===k)return y.info;const x=ug(_.children,k,!0),M={simpleChildren:x,plainText:x&&v?vc(x):null};return h.set(_,{children:_.children,textFastPath:v,paragraphFastPath:k,info:M}),M}function m(_){if(!r)return;_.preventDefault();const v=r.startWidth+r.nextStartWidth,k=Math.min(48,Math.floor(v/2)),y=Math.max(k,Math.min(v-k,Math.round(r.startWidth+_.clientX-r.startX))),x=[...r.widths];x[r.index]=y,x[r.index+1]=v-y,i.value=x}function w(){r&&(window.removeEventListener("pointermove",m),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w),r=null)}return et(l,()=>{w(),i.value=[]}),Un(w),(_,v)=>(b(),A("div",Xae,[C("table",{ref_key:"tableRef",ref:s,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(b(),A("colgroup",Qae,[(b(!0),A(Pe,null,pt(e.node.header.cells,(k,y)=>(b(),A("col",{key:y,style:Gt(u.value[y])},null,4))),128))])):te("",!0),C("thead",null,[C("tr",null,[(b(!0),A(Pe,null,pt(e.node.header.cells,(k,y)=>(b(),A("th",{key:y,dir:"auto",class:Re([k.align==="right"?"text-right":k.align==="center"?"text-center":"text-left"])},[g(k).plainText!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(g(k).plainText),9,eue)):g(k).simpleChildren?(b(),me(p(Lp),{key:1,nodes:g(k).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${y}`},null,8,["nodes","custom-id","index-key"])):(b(),me(p(Ui),{key:2,nodes:k.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:v[0]||(v[0]=x=>_.$emit("copy",x))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),y(function(M,$){if($.button!==0)return;const S=(function(){var D;const T=(D=s.value)==null?void 0:D.querySelectorAll("thead th");return Array.from(T??[],L=>Math.round(L.getBoundingClientRect().width))})(),I=S[M],P=S[M+1];I&&P&&($.preventDefault(),r={index:M,startX:$.clientX,startWidth:I,nextStartWidth:P,widths:S},i.value=S,window.addEventListener("pointermove",m),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w))})(y,x)},null,40,tue)):te("",!0)],2))),128))])]),C("tbody",null,[(b(!0),A(Pe,null,pt(o.value,(k,y)=>(b(),A("tr",{key:y},[(b(!0),A(Pe,null,pt(k.cells,(x,M)=>(b(),A("td",{key:M,class:Re([x.align==="right"?"text-right":x.align==="center"?"text-center":"text-left"]),dir:"auto"},[g(x).plainText!==null?(b(),A("span",{key:0,class:"text-node","custom-id":t.customId},N(g(x).plainText),9,nue)):g(x).simpleChildren?(b(),me(p(Lp),{key:1,nodes:g(x).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${y}-${M}`},null,8,["nodes","custom-id","index-key"])):(b(),me(p(Ui),{key:2,nodes:x.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:v[1]||(v[1]=$=>_.$emit("copy",$))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,Jae),V(as,{name:"table-node-fade"},{default:ke(()=>[n.value?(b(),A("div",oue,[Cn(_.$slots,"loading",{isLoading:n.value},()=>[v[2]||(v[2]=C("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),v[3]||(v[3]=C("span",{class:"sr-only"},"Loading",-1))],!0)])):te("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);ep.install=e=>{e.component(ep.__name,ep)};const sue={class:"hr-node"},nm=Kn({},[["render",function(e,t){return b(),A("hr",sue)}],["__scopeId","data-v-39b2349c"]]);nm.install=e=>{e.component(nm.__name,nm)};const iue={class:"unknown-node"},q3=tt({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(b(),A("div",iue,N(e.node.raw),1))}),om=Kn(tt({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=R(()=>`vmr-container vmr-container-${t.node.name}`),o=fs(()=>t.customId),s=R(()=>mt({text:Xo,paragraph:ac,heading:I2,inline_code:ii,link:Si,image:Va,strong:_i,emphasis:Ai,strikethrough:xi,insert:Wi,subscript:zi,superscript:Hi,checkbox:er,checkbox_input:er,hardbreak:qa,math_inline:Jr,reference:wi,list:Kd,math_block:PL,table:ep},o.value));return(i,r)=>(b(),A("div",Dn({class:n.value},e.node.attrs),[(b(!0),A(Pe,null,pt(e.node.children,(l,a)=>{return b(),me(ys((u=l.type,s.value[u]||q3)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var u}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);om.install=e=>{e.component(om.__name,om)};const rue=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],n_=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function lue(e){if(e<=255)return rue[e];let t=0,n=n_.length-1;for(;t<=n;){const o=t+n>>1,s=n_[o];if(es[1]))return s[2];t=o+1}}return"L"}const aue=/[ \t\n\r\f]+/g,uue=/[\t\n\r\f]| {2,}|^ | $/;let Y9=null;const cue=new RegExp("\\p{Script=Arabic}","u"),ou=new RegExp("\\p{M}","u"),m5=new RegExp("\\p{Nd}","u");function o_(e){return cue.test(e)}function s_(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function vl(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&o<=57343){if(s_(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(s_(n))return!0}}return!1}const due=new Set([" "," ","⁠","\uFEFF"]),fue=new Set(["-","‐","–","—"]);function DL(e,t){return!((function(n){const o=tp(n);return o!==null&&due.has(o)})(e)||t&&((function(n){const o=tp(n);return o!==null&&(g5.has(o)||yc.has(o))})(e)||(function(n){const o=tp(n);return o!==null&&fue.has(o)})(e)))}const g5=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),L2=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),v5=new Set(["'","’"]),yc=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),pue=new Set([":",".","،","؛"]),hue=new Set(["၏"]),mue=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function gue(e){if(y5(e))return!0;let t=!1;for(const n of e)if(yc.has(n)||dg(n))t=!0;else if(!t||!ou.test(n))return!1;return t}function vue(e){for(const t of e)if(!g5.has(t)&&!yc.has(t))return!1;return e.length>0}function yue(e){if(y5(e))return!0;for(const t of e)if(!(L2.has(t)||v5.has(t)||ou.test(t)||dg(t)))return!1;return e.length>0}function y5(e){let t=!1;for(const n of e)if(n!=="\\"&&!ou.test(n)){if(!(L2.has(n)||yc.has(n)||v5.has(n)))return!1;t=!0}return t}function cg(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function tp(e){if(e.length===0)return null;const t=cg(e,e.length);return e.slice(t)}const kue=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function dg(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s=o[s]&&n<=o[s+1])return!0;return!1})(t,kue)}function bue(e){const t=(function(n){for(const o of n)if(!ou.test(o))return o;return null})(e);return t!==null&&m5.test(t)}function Cue(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ou.test(o))n--;else{if(!L2.has(o)&&!v5.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function wue(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function i_(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function r_(e,t){return e&&t!==null&&pue.has(t)}function _ue(e){const t=tp(e);return t!==null&&hue.has(t)}function xue(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function K3(e){let t=e.length;for(;t>0;){const n=cg(e,t),o=e.slice(n,t);if(mue.has(o))return!0;if(!yc.has(o))return!1;t=n}return!1}function Sue(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` -`)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const Aue=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Or(e){return e.length===1?e[0]:e.join("")}function Mue(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),Or(n)}function Tue(e,t,n,o){if(!Aue.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,u=0;for(const c of e){const d=Sue(c,o),f=d==="text"&&t;i===null||d!==i||f!==a?(i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),i=d,r=[c],l=n+u,a=f,u+=c.length):(r.push(c),u+=c.length)}return i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),s}function X9(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const Eue=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function Iue(e,t){const n=e.texts[t];return!!n.startsWith("www.")||Eue.test(n)&&t+1=33&&n<=47&&n!==45||n>=58&&n<=64&&n!==63||n>=91&&n<=96||n>=123&&n<=126})(t):!Rue.has(e)&&!Fue.test(e)&&Nue.test(e)}function l_(e){let t=!1;for(const n of e)if(!ou.test(n)){if(!BL(n))return!1;t=!0}return t}function Oue(e,t,n,o){const s=!t&&l_(e),i=!o&&l_(n),r=(function(a){const u=(function(c){for(let d=c.length;d>0;){const f=cg(c,d),h=c.slice(f,d);if(!ou.test(h))return h;d=f}return null})(a);return u!==null&&dg(u)})(e),l=(t||r)&&(function(a){for(let u=a.length;u>0;){const c=cg(a,u),d=a.slice(c,u);if(!ou.test(d))return BL(d)||dg(d);u=c}return!1})(e);return!!(s||i||l)&&!vl(e)&&!vl(n)&&(t||s||r)&&(o||i)}function a_(e){for(const t of e)if(m5.test(t))return!0;return!1}function sm(e){if(e.length===0)return!1;for(const t of e)if(!m5.test(t)&&!$ue.has(t))return!1;return!0}function Pue(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s0&&u.charCodeAt(u.length-1)===32&&(u=u.slice(0,-1)),u})(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=(function(a,u,c){var d,f,h;const g=(Y9===null&&(Y9=new Intl.Segmenter(void 0,{granularity:"word"})),Y9);let m=0;const w=[],_=[],v=[],k=[],y=[],x=[],M=[],$=[],S=[],I=[],P=[],D=[];for(const O of g.segment(a))for(const F of Tue(O.segment,(d=O.isWordLike)!=null&&d,O.index,c)){let W=function(){x[le]!==null&&(_[le]=[i_(w,x,M,le)],x[le]=null),_[le].push(F.text),v[le]=v[le]||F.isWordLike,$[le]=$[le]||q,S[le]=S[le]||K,I[le]=ne,P[le]=Y,D[le]=r_(S[le],ie)};const z=F.kind==="text",U=wue(F.text,F.isWordLike,F.kind),q=vl(F.text),K=o_(F.text),ie=tp(F.text),ne=K3(F.text),Y=_ue(F.text),le=m-1;u.carryCJKAfterClosingQuote&&z&&m>0&&k[le]==="text"&&q&&$[le]&&I[le]||z&&m>0&&k[le]==="text"&&vue(F.text)&&$[le]||z&&m>0&&k[le]==="text"&&P[le]?W():z&&m>0&&k[le]==="text"&&F.isWordLike&&K&&D[le]?(W(),v[le]=!0):U!==null&&m>0&&k[le]==="text"&&x[le]===U?M[le]=((f=M[le])!=null?f:1)+1:z&&!F.isWordLike&&m>0&&k[le]==="text"&&!$[le]&&(gue(F.text)||F.text==="-"&&v[le])?W():(w[m]=F.text,_[m]=[F.text],v[m]=F.isWordLike,k[m]=F.kind,y[m]=F.start,x[m]=U,M[m]=U===null?0:1,$[m]=q,S[m]=K,I[m]=ne,P[m]=Y,D[m]=r_(K,ie),m++)}for(let O=0;Onull);let L=-1;for(let O=m-1;O>=0;O--){const F=w[O];if(F.length!==0){if(k[O]==="text"&&!v[O]&&L>=0&&k[L]==="text"&&(yue(F)||F==="-"&&bue(w[L]))){const W=(h=T[L])!=null?h:[];W.push(F),T[L]=W,y[L]=y[O],w[O]="";continue}L=O}}for(let O=0;Oq+1){F.push(Or(Y)),W.push(Ee),z.push("text"),U.push(O.starts[q]),q=le;continue}}F.push(K),W.push(ne),z.push(ie),U.push(O.starts[q]),q++}return{len:F.length,texts:F,isWordLike:W,kinds:z,starts:U}})((function(O){const F=[],W=[],z=[],U=[];for(let q=0;q1;for(let Y=0;Y=O.len||X9(O.kinds[ie]))continue;const ne=[],Y=O.starts[ie];let le=ie;for(;le0&&(F.push(Or(ne)),W.push(!0),z.push("text"),U.push(Y),q=le-1)}return{len:F.length,texts:F,isWordLike:W,kinds:z,starts:U}})((function(O){const F=O.texts.slice(),W=O.isWordLike.slice(),z=O.kinds.slice(),U=O.starts.slice();for(let K=0;K=0&&!DL(u.texts[k-1],c)&&v(k),m<0&&(m=k),w=w||vl(y))}return v(u.len),{len:d.length,texts:d,isWordLike:f,kinds:h,starts:g}})(i,r,t.breakKeepAllAfterPunctuation):r;return mt({normalized:i,chunks:Pue(l,s)},l)}let ad=null;const u_=new Map;let ud=null;const Bue=new RegExp("\\p{Emoji_Presentation}","u"),Hue=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let J9=null;const c_=new Map;function Z3(){if(ad!==null)return ad;if(typeof OffscreenCanvas<"u")return ad=new OffscreenCanvas(1,1).getContext("2d"),ad;if(typeof document<"u")return ad=document.createElement("canvas").getContext("2d"),ad;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function xa(e,t){let n=t.get(e);return n===void 0&&(n={width:Z3().measureText(e).width,containsCJK:vl(e)},t.set(e,n)),n}function fg(){if(ud!==null)return ud;if(typeof navigator>"u")return ud={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ud;const e=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),n=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return ud={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},ud}function HL(){return J9===null&&(J9=new Intl.Segmenter(void 0,{granularity:"grapheme"})),J9}function zue(e){return Bue.test(e)||e.includes("️")}function Fu(e,t,n){return n===0?t.width:t.width-(function(o,s){return s.emojiCount===void 0&&(s.emojiCount=(function(i){let r=0;const l=HL();for(const a of l.segment(i))zue(a.segment)&&r++;return r})(o)),s.emojiCount})(e,t)*n}function Wue(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function d_(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function f_(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function k5(e,t){return t===0?0:e+t}function Vue(e,t,n,o,s){return k5(o,t==="tab"?s+(function(i,r){return i.letterSpacing!==0&&i.spacingGraphemeCounts[r]>0?i.letterSpacing:0})(e,n):e.lineEndFitAdvances[n])}function p_(e,t,n,o){return k5(o,t==="tab"?0:e.lineEndFitAdvances[n])}function h_(e,t,n,o,s){return k5(o,t==="tab"?s:e.lineEndPaintAdvances[n])}function que(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Kue(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function Ch(e,t,n){let o=t;for(;oW){if(Ce!==null&&Q>G){le(ve,Q,ee),ce=Q,ge=Ch(Ce,ge,ce+1),Q=-1,ee=0;continue}le(),de(ve,ce,ue)}else U+=ue,K=ve,ie=ce+1;else de(ve,ce,ue);const Se=ce+1;Ce!==null&&Ce[ge]===Se&&(Q=Se,ee=U,ge++),ce++}q&&K===ve&&ie===fe.length&&(K=ve+1,ie=0)}let oe=0;for(;oe=B.length)));){const ve=B[oe],G=d_(H[oe]);if(q)if(U+ve>W){if(G){he(oe,ve),le(oe+1,0,U-ve),oe++;continue}if(ne>=0){if(K>ne||K===ne&&ie>0){le();continue}le(ne,0,Y);continue}if(ve>W&&O[oe]!==null){le(),pe(oe,0),oe++;continue}le()}else he(oe,ve),G&&(ne=oe+1,Y=U-ve),oe++;else ve>W&&O[oe]!==null?pe(oe,0):Ee(oe,ve),G&&(ne=oe+1,Y=U-ve),oe++}return q&&le(),z})(n,o);const{widths:s,kinds:i,breakableFitAdvances:r,breakablePreferredBreaks:l,discretionaryHyphenWidth:a,chunks:u}=n;if(s.length===0||u.length===0)return 0;const c=fg(),d=o+c.lineFitEpsilon;let f=0,h=0,g=!1,m=0,w=0,_=-1,v=0,k=null;function y(){_=-1,v=0,k=null}function x(T=m,L=w,B){f++,h=0,g=!1,y()}function M(T,L){g=!0,m=T+1,w=0,h=L}function $(T,L,B){g=!0,m=T,w=L+1,h=B}function S(T,L){g?(h+=L,m=T+1,w=0):M(T,L)}function I(T,L,B,H,O,F){if(!L)return;const W=p_(n,T,B,O);h_(n,T,B,O,H),_=B+1,v=h-F+W,k=T}function P(T,L){var B;const H=r[T],O=(B=l[T])!=null?B:null;let F=O===null?-1:Ch(O,0,L+1),W=-1,z=L;for(;zd){if(O!==null&&W>L){x(T,W),z=W,F=Ch(O,F,z+1),W=-1;continue}x(),$(T,z,U)}else h=ie,m=T,w=z+1}else $(T,z,U);const q=z+1;O!==null&&O[F]===q&&(W=q,F++),z++}g&&m===T&&w===H.length&&(m=T+1,w=0)}function D(T){f++,y()}for(let T=0;T=L.endSegmentIndex)));){const H=i[B],O=d_(H),F=jue(n,g,B),W=H==="tab"?Uue(h+F,n.tabStopAdvance):s[B],z=F+W,U=Vue(n,H,B,F,W);if(H!=="soft-hyphen")if(g){if(h+U>d){const q=h+p_(n,H,B,F);if(h_(n,H,B,F,W),k==="soft-hyphen"&&c.preferEarlySoftHyphenBreak&&v<=d){x(_,0);continue}if(O&&q<=d){S(B,z),x(B+1,0),B++;continue}if(_>=0&&v<=d){if(m>_||m===_&&w>0){x();continue}const K=_;x(K,0),B=K;continue}if(U>d&&r[B]!==null){x(),P(B,0),B++;continue}x();continue}S(B,z),I(H,O,B,W,F,z),B++}else U>d&&r[B]!==null?P(B,0):M(B,W),I(H,O,B,W,F,z),B++;else g&&(m=B+1,w=0,_=B+1,v=h+a,k=H),B++}g&&(L.consumedEndSegmentIndex,x(L.consumedEndSegmentIndex,0))}return f})(e,t)}let Q9=null;function b5(){return Q9===null&&(Q9=new Intl.Segmenter(void 0,{granularity:"grapheme"})),Q9}function Gue(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function u(d,f,h){o=[d],s=f,i=h,r=K3(d),l=L2.has(d)}function c(d,f){o.push(d),i=i||f;const h=K3(d);r=d.length===1&&yc.has(d)&&r||h,l=!1}for(const d of b5().segment(e)){const f=d.segment,h=vl(f);o.length!==0?l||g5.has(f)||yc.has(f)||t.carryCJKAfterClosingQuote&&h&&r?c(f,h):i||h?(a(),u(f,d.index,h)):c(f,h):u(f,d.index,h)}return a(),n}function Yue(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(l){if(!(s<0)){if(i)s+1===l?o.push(t[s]):(function(a,u){const c=t[a].start,d=u=0&&!DL(t[l-1].text,n)&&r(l),s<0&&(s=l),i=i||vl(a.text)}return r(t.length),o}function m_(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=b5();for(const s of o.segment(e))n++;return n}function Xue(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function Jue(e,t,n,o,s){const i=fg(),{cache:r,emojiCorrection:l}=(function(D,T){Z3().font=D;const L=(function(O){let F=u_.get(O);return F||(F=new Map,u_.set(O,F)),F})(D),B=(function(O){const F=O.match(/(\d+(?:\.\d+)?)\s*px/);return F?parseFloat(F[1]):16})(D),H=T?(function(O,F){let W=c_.get(O);if(W!==void 0)return W;const z=Z3();z.font=O;const U=z.measureText("😀").width;if(W=0,U>F+.5&&typeof document<"u"&&document.body!==null){const q=document.createElement("span");q.style.font=O,q.style.display="inline-block",q.style.visibility="hidden",q.style.position="absolute",q.textContent="😀",document.body.appendChild(q);const K=q.getBoundingClientRect().width;document.body.removeChild(q),U-K>.5&&(W=U-K)}return c_.set(O,W),W})(D,B):0;return{cache:L,fontSize:B,emojiCorrection:H}})(t,(a=e.normalized,Hue.test(a)));var a;const u=Fu("-",xa("-",r),l)+(s===0?0:2*s),c=8*Fu(" ",xa(" ",r),l),d=s!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],h=[],g=[],m=[];let w=e.chunks.length<=1&&!d;const _=null,v=[],k=[],y=[],x=null,M=Array.from({length:e.len});function $(D,T,L,B,H,O,F,W,z){H!=="text"&&H!=="space"&&H!=="zero-width-break"&&(w=!1),f.push(T),h.push(L),g.push(B),m.push(H),v.push(F),k.push(W),d&&y.push(z)}function S(D,T,L,B,H){const O=xa(D,r),F=d?m_(D,T):0,W=(function(K,ie,ne){return ie>1?K+(ie-1)*ne:K})(Fu(D,O,l),F,s),z=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:W,U=z===0?0:z+(F>0?s:0),q=T==="space"||T==="zero-width-break"?0:W;if(H&&B&&D.length>1){let K="sum-graphemes";s!==0?K="segment-prefixes":sm(D)?K="pair-context":i.preferPrefixWidthsForBreakableRuns&&(K="segment-prefixes");const ie=(function(Y,le,Ee,de,he){if(le.breakableFitAdvances!==void 0&&le.breakableFitMode===he)return le.breakableFitAdvances;le.breakableFitMode=he;const pe=HL(),oe=[];for(const fe of pe.segment(Y))oe.push(fe.segment);if(oe.length<=1)return le.breakableFitAdvances=null,le.breakableFitAdvances;if(he==="sum-graphemes"){const fe=[];for(const Ce of oe){const ge=xa(Ce,Ee);fe.push(Fu(Ce,ge,de))}return le.breakableFitAdvances=fe,le.breakableFitAdvances}if(he==="pair-context"||oe.length>96){const fe=[];let Ce=null,ge=0;for(const Q of oe){const ee=Fu(Q,xa(Q,Ee),de);if(Ce===null)fe.push(ee);else{const ce=Ce+Q,ue=xa(ce,Ee);fe.push(Fu(ce,ue,de)-ge)}Ce=Q,ge=ee}return le.breakableFitAdvances=fe,le.breakableFitAdvances}const ve=[];let G="",X=0;for(const fe of oe){G+=fe;const Ce=Fu(G,xa(G,Ee),de);ve.push(Ce-X),X=Ce}return le.breakableFitAdvances=ve,le.breakableFitAdvances})(D,O,r,l,K),ne=ie===null||o==="keep-all"?null:(function(Y){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(Y))return null;const le=[];let Ee=0;for(const de of b5().segment(Y))Ee++,Xue(de.segment)&&le.push(Ee);return le.length===0?null:le})(D);return void $(D,W,U,q,T,L,ie,ne,F)}$(D,W,U,q,T,L,null,null,F)}for(let D=0;D=55296&&Y<=56319&&ne+1=56320&&he<=57343&&(le=he-56320+(Y-55296<<10)+65536,Ee=2)}const de=lue(le);de!=="R"&&de!=="AL"&&de!=="AN"||(W=!0);for(let he=0;he=0&&F[Y]==="ET";Y--)F[Y]="EN";for(Y=ne+1;Y0?F[ne-1]:K)!=="L"?"R":"L";if(le===((Y{const e=globalThis;if(e[e4])return e[e4];const t={configs:{},controllers:{},revision:Xr(0),preparedCache:new Map,blockEstimateCache:new Map};return e[e4]=t,t})();let r1=null;const t4=gs.revision;function g_(e){var t;return e&&(t=gs.configs[e])!=null?t:null}function v_(e,t){const n=Number.parseFloat(String(e??""));return Number.isFinite(n)&&n>0?n:t}function ece(e){return e?.type==="text"||e?.type==="emoji"||e?.type==="hardbreak"}function n4(e){var t,n,o;if(!Array.isArray(e)||e.length===0)return null;let s="";for(const i of e){if(!ece(i))return null;i.type==="text"?s+=String((t=i.content)!=null?t:""):i.type==="emoji"?s+=String((o=(n=i.name)!=null?n:i.raw)!=null?o:""):i.type==="hardbreak"&&(s+=` -`)}return s.length>0?s:null}function o4(e,t,n){var o,s;if(!e||!Number.isFinite(t)||t<=0||!(function(){var i;if(r1!=null)return r1;if(typeof document>"u")return!1;try{const r=document.createElement("canvas");return r1=!!((i=r.getContext)!=null&&i.call(r,"2d")),r1}catch{return r1=!1,!1}})())return null;try{const i=Math.round(100*t)/100,r=[(o=n.whiteSpace)!=null?o:"pre-wrap",n.font,n.lineHeight,n.wrapperOverhead,n.widthAdjustment,i,e].join("\0"),l=gs.blockEstimateCache.get(r);if(l)return gs.blockEstimateCache.delete(r),gs.blockEstimateCache.set(r,l),{kind:"simple-text",height:l.height,contentHeight:l.contentHeight};const a=(s=n.whiteSpace)!=null?s:"pre-wrap",u=(function(h,g,m){const w=`${m}\0${g}\0${h}`,_=gs.preparedCache.get(w);if(_)return gs.preparedCache.delete(w),gs.preparedCache.set(w,_),_.prepared;const v=(function(k,y,x){return(function(M,$,S,I){var P,D;const T=(P=I?.wordBreak)!=null?P:"normal",L=(D=I?.letterSpacing)!=null?D:0;return Jue(Due(M,fg(),I?.whiteSpace,T),$,!1,T,L)})(k,y,0,x)})(h,g,{whiteSpace:m});for(gs.preparedCache.set(w,{prepared:v});gs.preparedCache.size>240;){const k=gs.preparedCache.keys().next().value;if(!k)break;gs.preparedCache.delete(k)}return v})(e,n.font,a),c=(function(h,g,m){const w=Zue(h,g);return{lineCount:w,height:w*m}})(u,Math.max(24,i-n.widthAdjustment),n.lineHeight),d=Math.max(n.lineHeight,c.height),f=Math.max(n.lineHeight,Math.round(d+n.wrapperOverhead));for(gs.blockEstimateCache.set(r,{height:f,contentHeight:Math.round(d)});gs.blockEstimateCache.size>4e3;){const h=gs.blockEstimateCache.keys().next().value;if(!h)break;gs.blockEstimateCache.delete(h)}return{kind:"simple-text",height:f,contentHeight:Math.round(d)}}catch{return null}}function zL(e,t,n){var o,s;if(!n||!e||!Number.isFinite(t)||t<=0)return null;if(e.type==="paragraph"){const i=n4(e.children);return i&&n.paragraph?o4(i,t,n.paragraph):null}if(e.type==="heading"){const i=Number(e.level||0),r=n4(e.children),l=n.headings[i];return r&&l?o4(r,t,l):null}if(e.type==="list_item"){const i=Array.isArray(e.children)?e.children:[];if(i.length!==1||((o=i[0])==null?void 0:o.type)!=="paragraph"||!n.listItem)return null;const r=n4((s=i[0])==null?void 0:s.children);return r?o4(r,t,n.listItem):null}if(e.type==="list"){const i=Array.isArray(e.items)?e.items:[];if(!i.length)return null;let r=Math.max(0,n.listWrapperOverhead);for(const l of i){const a=zL(l,t,n);if(!a)return null;r+=a.height}return{kind:"simple-text",height:Math.max(1,Math.round(r)),contentHeight:Math.max(1,Math.round(r))}}return null}function l1(e){if(!e)return 1;const t=String(e).split(/\r?\n/);return Math.max(1,t.length)}function Ru(e,t){const n=String(e??"");return t?n:n.replace(/\r\n$|\n$|\r$/,"")}function s4(e,t,n=0){return e.diff?h5(t??{},n)?(function(o){const s=Ru(o.raw);if(s){const i=s.split(/\r?\n/);return o.originalCode!=null||o.updatedCode!=null?Math.max(1,i.filter(r=>!Que.some(l=>r.startsWith(l))).length):Math.max(1,i.length)}return l1(Ru(o.originalCode))+l1(Ru(o.updatedCode))})(e):(function(o){const s=o.originalCode,i=o.updatedCode;if(s!=null||i!=null)return Math.max(l1(Ru(s)),l1(Ru(i)));const r=Ru(o.code).split(/\r?\n/);let l=0,a=0;for(const u of r)u.startsWith("+")&&!u.startsWith("+++")?a++:u.startsWith("-")&&!u.startsWith("---")?l++:(l++,a++);return Math.max(1,l,a)})(e):l1(Ru(e.code,e.loading===!0))}function tce(e){return e?`${e.fontStyle||"normal"} ${e.fontWeight||"400"} ${e.fontSize||"16px"} ${e.fontFamily||"sans-serif"}`:""}function i4(e,t,n="pre-wrap"){if(!e||!t||typeof window>"u")return null;const o=window.getComputedStyle(t),s=e.offsetHeight,i=v_(o.lineHeight,1.5*v_(o.fontSize,16)),r=e.getBoundingClientRect().width,l=t.getBoundingClientRect().width;return{font:tce(o),lineHeight:i,wrapperOverhead:Math.max(0,s-i),widthAdjustment:Math.max(0,r-l),whiteSpace:n}}const nce=new Set(["node","key","ref","ctx","renderNode","indexKey","__proto__","prototype","constructor"]);function y_(e,t={}){var n;const o={},s=new Set((n=t.omit)!=null?n:[]);if(!e||typeof e!="object")return o;const i=Object.getOwnPropertyDescriptors(e);for(const[r,l]of Object.entries(i))nce.has(r)||s.has(r)||l.enumerable&&"value"in l&&(o[r]=l.value);return o}function k_(e,t,n,o){var s;const i=(function(f){return Math.max(0,Math.ceil(f.scrollHeight||0)-Math.ceil(f.clientHeight||0))})(e),r=(function(f,h){return Number.isFinite(f)?Math.min(Math.max(0,f),h):0})(n,i);if(!o.isReverseFlexScrollRoot(e))return void(e.scrollTop=r);const l=Math.max(0,i-r),a=[-l,l];let u=a[0],c=Number.POSITIVE_INFINITY;for(const f of a){e.scrollTop=f;const h=o.getNormalizedScrollTop(e,t,!1),g=Math.abs(h-r);gd&&(e.scrollTop=u)}function b_(e,t){let n=0,o=null,s=null;const i=()=>{const r=s;s=null,o=null,r&&(n=Date.now(),e(...r))};return function(...r){const l=Date.now(),a=t-(l-n);s=r,a<=0?(o&&(clearTimeout(o),o=null),n=l,s=null,e(...r)):o||(o=setTimeout(i,a))}}function C_(e){return e==="simple"?"simple":e===!0||e==="true"||e==="precise"?"precise":"off"}const WL=Symbol("MarkstreamMathBlockMinHeightCache");function dVe(){return on(WL,null)}const oce=new Set(["text","inline_code","emoji","footnote_reference"]),sce=new Set(["strong","emphasis","strikethrough","highlight","insert","subscript","superscript","link"]);function a1(e){const t=Number(e);return!Number.isFinite(t)||t<=0?-1:Math.round(t/32)}function Ou(e,t,n,o=22){const s=String(e??"");if(!s)return n;const i=Math.max(18,Math.floor(Math.max(320,t)/8)),r=s.split(/\r?\n/).length,l=Math.ceil(s.length/i),a=Math.max(1,r,l);return Math.max(n,Math.ceil(a*o+12))}function UL(e){var t;if(!e||typeof e!="object")return!1;const n=e,o=String((t=n.type)!=null?t:"");if(oce.has(o))return!0;if(!sce.has(o))return!1;const s=n.children;return!Array.isArray(s)||!s.length||s.every(UL)}function G3(e){var t,n,o,s,i,r,l,a;if(!e||typeof e!="object")return"";const u=e,c=String((t=u.type)!=null?t:"");if(c==="text")return String((o=(n=u.content)!=null?n:u.raw)!=null?o:"");if(c==="inline_code")return String((r=(i=(s=u.code)!=null?s:u.content)!=null?i:u.raw)!=null?r:"");if(c==="emoji")return String((a=(l=u.name)!=null?l:u.raw)!=null?a:"");if(typeof u.text=="string")return u.text;const d=[];for(const f of["children","items","cells","rows"]){const h=u[f];if(Array.isArray(h)){const g=h.map(G3).filter(Boolean).join(" ");g&&d.push(g)}}return d.join(" ").replace(/\s+/g," ").trim()}function jL(e){if(!e||typeof e!="object")return!1;const t=e;return t.type==="inline_code"||["children","items","cells","rows"].some(n=>{const o=t[n];return Array.isArray(o)&&o.some(jL)})}function ice(e,t){if(!e)return 30;const n=Math.max(18,Math.floor(Math.max(320,t)/8)),o=e.split(/\r?\n/).length,s=Math.ceil(e.length/n),i=Math.max(1,o,s);return 30+26*Math.max(0,i-1)}function rce(e,t){var n,o,s,i,r,l,a,u,c,d,f,h,g,m;if(!e||typeof e!="object")return 32;const w=e,_=String((n=w.type)!=null?n:""),v=Number.isFinite(t)&&t>0?t:640;switch(_){case"heading":return(function(k){var y;const x=Number((y=k.level)!=null?y:k.depth);return x>=4?20:x===3?30:x===2?32:44})(w);case"paragraph":return(function(k,y){const x=String(k??"");if(!x)return 28;const M=Math.max(18,Math.floor(Math.max(320,y)/8)),$=x.split(/\r?\n/).length,S=Math.ceil(x.length/M);return Math.max(1,$,S)<=1?28:Ou(x,y,34)})(String((s=(o=w.raw)!=null?o:w.content)!=null?s:""),v);case"list":return(function(k,y){var x;const M=Array.isArray(k.items)?k.items:[];if(!M.length)return 48;const $=Math.max(48,30*M.length+12);let S=12;for(const D of M)S+=ice(G3(D)||String((x=D.raw)!=null?x:""),y);const I=Math.max(0,S-$);if(M.length>20){const D=Math.round(2.4*M.length);return Math.round($+Math.max(D,Math.min(I,3*M.length)))}if(I<=0)return $;const P=M.length>8?8*M.length:I;return Math.round($+Math.min(I,P))})(w,v);case"list_item":return Ou(String((r=(i=w.raw)!=null?i:w.content)!=null?r:""),v,34);case"blockquote":return Ou(String((a=(l=w.raw)!=null?l:w.content)!=null?a:""),v,56);case"table":return(function(k,y){const x=[...k.header?[k.header]:[],...Array.isArray(k.rows)?k.rows:[]];if(!x.length){const M=Array.isArray(k.children)?k.children.length:3;return Math.max(120,38*M+48)}return Math.max(120,Math.round(4+x.reduce((M,$)=>M+(function(S,I){const P=Math.max(1,S.length),D=Math.max(80,(I-32)/P),T=Math.max(10,Math.floor(D/8)),L=Math.max(1,...S.map(B=>{var H;const O=G3(B)||String((H=B?.raw)!=null?H:"");return Math.ceil(O.length/T)||1}));return 54+34*Math.max(0,L-1)+(P<=3&&S.some(jL)?14:0)})((function(S){var I;return Array.isArray(S?.cells)&&(I=S.cells)!=null?I:[]})($),y),0)))})(w,v);case"code_block":{const k=String((u=w.language)!=null?u:"").trim().toLowerCase(),y=String((d=(c=w.code)!=null?c:w.raw)!=null?d:"");return k==="mermaid"?sg(ng(y)):k==="infographic"?ig(og(y)):Ou(y,v,96,20)}case"math_block":return 72;case"image":return 220;case"admonition":case"vmr_container":case"html_block":return(function(k,y){var x,M,$;const S=k.match(/^\s*]*)>/i);return S&&!/(?:^|\s)open(?:\s|=|$)/i.test((x=S[1])!=null?x:"")?Ou((($=(M=k.match(/]*>([\s\S]*?)<\/summary>/i))==null?void 0:M[1])==null?void 0:$.replace(/<[^>]*>/g,"").trim())||"Details",y,28,28):Ou(k,y,96)})(String((h=(f=w.raw)!=null?f:w.content)!=null?h:""),v);case"thematic_break":return 24;default:return Ou(String((m=(g=w.raw)!=null?g:w.content)!=null?m:""),v,40)}}function w_(e,t,n){return Math.min(Math.max(e,t),n)}const lce=["total","cacheHits","appendHits","tailHits","fullParses","chunkedParses"],ace=["tokenCloneMs","processTokensInputTokens","processTokensReusedTopLevelNodes","processTokensMs","parseMarkdownToStructureTotalMs"],uce=new Set(["attrs","data","items","header","payload","props","rows","cells","term","definition","sourceMap"]),VL=["raw","content","code","originalCode","updatedCode"],__=new WeakMap,x_=new WeakMap;let cce=1;function Rr(){return typeof performance<"u"?performance.now():Date.now()}function S_(e){const t=e.stream;return t&&typeof t.stats=="function"?t.stats():null}function Xi(e){if(typeof e!="object"&&typeof e!="function"||e===null)return"";const t=e;let n=__.get(t);return n||(n=cce++,__.set(t,n)),String(n)}function A_(e,t,n,o={}){var s,i;const r=o.includeFinal!==!1,l={md:Xi(t),customMarkdownIt:Xi(n),requireClosingStrong:e.requireClosingStrong===!0,customHtmlTags:(s=e.customHtmlTags)!=null?s:[],includeSourceMap:e.includeSourceMap===!0,streamParse:(i=e.streamParse)!=null?i:"auto",validateLink:Xi(e.validateLink),preTransformTokens:Xi(e.preTransformTokens),postTransformTokens:Xi(e.postTransformTokens),postTransformNodes:Xi(e.postTransformNodes)};return r&&(l.final=e.final===!0),JSON.stringify(l)}function M_(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===10;)t-=1;const n=e.lastIndexOf(` -`,t-1)+1;return e.slice(n,t).trim()}function T_(e){const t=qL(e);return t.length>=2&&t.every(n=>{const o=n.trim();return o.length>=1&&o.replace(/^:/,"").replace(/:$/,"").split("").every(s=>s==="-")})}function qL(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function KL(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function C5(e){const t=String(e??"");return`${t.length}:${KL(t)}`}function Y3(e,t=new WeakMap,n=0){if(e==null||typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="string")return`s:${(function(r){return r.length<=8192?C5(r):`${r.length}:${KL(r.slice(0,8192))}:truncated`})(e)}`;if(typeof e=="function")return`fn:${Xi(e)}`;if(typeof e!="object")return typeof e;const o=e,s=t.get(o);if(s)return`cycle:${s}`;if(n>=6)return`object:${Xi(o)}`;const i=Xi(o);if(t.set(o,i),Array.isArray(e)){const r=e.slice(0,200);return`a:${e.length}:${r.map(l=>Y3(l,t,n+1)).join(",")}`}if(typeof e=="object"){const r=e,l=Object.keys(r).sort(),a=l.slice(0,80);return`o:${l.length}:${a.sort().map(u=>`${u}:${Y3(r[u],t,n+1)}`).join(";")}`}return typeof e}function pg(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"&&typeof e.raw=="string"}function ZL(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(o=>pg(o)?su(o,t,n+1):ZL(o,t,n+1)).join(",")}`:pg(e)?su(e,t,n):Y3(e,t,n)}function dce(e,t,n){return Object.keys(e).sort().filter(o=>o!=="children"&&!VL.includes(o)).map(o=>{const s=e[o];return typeof s=="string"?`${o}=s:${C5(s)}`:typeof s=="number"||typeof s=="boolean"||s==null?`${o}=${String(s)}`:typeof s=="function"?`${o}=fn:${Xi(s)}`:uce.has(o)&&(Array.isArray(s)||typeof s=="object")?`${o}=${ZL(s,t,n+1)}`:s&&typeof s=="object"?`${o}=object:${Xi(s)}`:""}).filter(Boolean).join(";")}function fce(e){return VL.map(t=>{const n=e[t];return typeof n=="string"?`${t}=s:${C5(n)}`:""}).filter(Boolean).join(";")}function su(e,t=new WeakMap,n=0){const o=x_.get(e);if(o)return o;const s=e,i=t.get(s);if(i)return`node-cycle:${i}`;if(n>=6)return`node:${e.type}:${Xi(s)}`;const r=Xi(s);t.set(s,r);const l=(function(a,u,c){const d=a,f=Array.isArray(d.children)?d.children:[],h=f.length?f.slice(0,200).map(g=>su(g,u,c+1)).join("|"):"";return[a.type,fce(d),dce(d,u,c),f.length,h].join(":")})(e,t,n);return x_.set(s,l),l}function GL(e,t){return su(e)===su(t)}function w5(e,t,n){const o=Rr(),s=t==="stabilizeSignatureMs"?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return n()}finally{e[t]+=Rr()-o,e[s]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function E_(e,t,n){return w5(t,n,()=>su(e))}function YL(e,t,n){return E_(e,n,"stabilizeSignatureMs")===E_(t,n,"stabilizeSignatureMs")}function wh(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function I_(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function L_(e){return e.__markstreamHasCustomParserExtensions===!0||(function(t){var n;return Number((n=t.__markstreamRegisteredPluginCount)!=null?n:0)>0})(e)}function pce(e,t){return e.length===t.length&&e===t}function _5(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;const o=e,s=t,i=Object.keys(o).filter(c=>c!=="type"&&c!=="children").sort(),r=Object.keys(s).filter(c=>c!=="type"&&c!=="children").sort();if(i.length!==r.length)return!1;for(let c=0;c{o=_5(e,t)}),o??YL(e,t,n)}function gce(e,t){const n={};for(const o of lce){const s=e[o],i=t?.[o];typeof s=="number"&&(n[o]=s-(typeof i=="number"?i:0))}return n}function vce(e,t){var n;const o=Tw(t.instanceMsgId),s=new Map,i=(n=t.smoothStreamingEnabled)!=null?n:R(()=>!1),r=Z(t.renderContent.value);let l=[],a="",u="",c="",d=!1;const f=(function(){let B="",H=0,O=!1,F=!1,W=!1,z=!1;function U(){B="",H=0,O=!1,F=!1,W=!1,z=!1}function q(K){let ie=!1;for(let ne=0;ne{if(!K||!ie.startsWith(K)||ie.length<=K.length)return U(),[!0,0];let ne=0;B!==K&&(U(),q(K),ne=K.length);const Y=ie.slice(K.length),le=q(Y);return B=ie,[le,ne+Y.length]}})();let h,g=0,m=0,w=Rr(),_=-1,v=0;function k(B){_=Number.isInteger(B)?B:0,v+=1}function y(){h&&(clearTimeout(h),h=void 0)}function x(){y();const B=t.renderContent.value;r.value!==B&&(r.value=B),w=Rr()}et([t.renderContent,t.effectiveFinal,i],([B,H,O])=>{r.value!==B&&(!O||H||(function(F,W){if(!F&&W||W.length<=80||W.length\s*|`{3,}|~{3,})/.test(z))||z.endsWith(` -`)&&!(function(U){const q=M_(U);if(T_(q))return!1;const K=qL(q);return K.length>=2&&K.some(ie=>ie.trim())})(W))})(r.value,B)?x():(function(){if(m+=1,h)return;const F=Math.max(0,(function(W){const z=W.parseCoalesceMs;return typeof z=="number"&&Number.isFinite(z)&&z>=0?z:80})(e)-(Rr()-w));F<=0?x():h=setTimeout(x,F)})())},{flush:"sync",immediate:!0}),pf(y);const M=R(()=>{var B,H,O,F;return Tte(e.customHtmlTags,(B=e.parseOptions)==null?void 0:B.customHtmlTags,(F=(O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{},Object.entries(F).map(([W,z])=>{const U=xr(W);return z==null||!U||Yp(U)||sI.has(U)||Vp.has(U)?"":U}).filter(Boolean)))}),$=R(()=>{const{key:B,tags:H}=Ete(M.value);if(!B)return o;const O=s.get(B);if(O)return O;const F=Tw(t.instanceMsgId,{customHtmlTags:H});return s.set(B,F),F}),S=R(()=>{const B=$.value;if(!e.customMarkdownIt)return B;const H=e.customMarkdownIt(B);return B.__markstreamHasCustomParserExtensions=!0,H.__markstreamHasCustomParserExtensions=!0,H}),I=R(()=>{var B,H;const O=(B=e.parseOptions)!=null?B:{},F=t.effectiveFinal.value,W=M.value,z=F!=null,U=W.length>0;return z||U||O.streamParse==null?mt(mt(rn(mt({},O),{streamParse:(H=O.streamParse)==null||H}),z?{final:F}:{}),U?{customHtmlTags:W}:{}):O}),P=R(()=>{var B;return new Set(((B=I.value.customHtmlTags)!=null?B:[]).map(H=>String(H).trim().toLowerCase()).filter(Boolean))}),D=R(()=>A_(I.value,S.value,e.customMarkdownIt,{includeFinal:!0})),T=R(()=>A_(I.value,S.value,e.customMarkdownIt,{includeFinal:!1}));et([D,T],([B,H],[O,F])=>{O&&(B===O&&H===F||(x(),H!==F&&(l=[],c="")))},{flush:"sync"});const L=R(()=>{var B,H,O,F,W,z,U,q,K,ie,ne;if((B=e.nodes)!=null&&B.length)return l=[],c="",k(0),kt(e.nodes.slice());const Y=r.value;if(!Y)return l=[],c="",k(-1),[];const le=t.debugPerformanceEnabled.value,Ee=le?Rr():0,de=S.value,he=D.value,pe=T.value;a&&he!==a&&(function(Fe){var Oe,Ye;(Ye=(Oe=Fe.stream)==null?void 0:Oe.reset)==null||Ye.call(Oe)})(de),u&&pe!==u&&(l=[],c="");const oe=Object.keys((O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{}).length>0||typeof I.value.postTransformNodes=="function";oe!==d&&(l=[],c="");const ve=!oe&&l.length>0&&Y.startsWith(c)&&pe===u,G=le?S_(de):null,X=le?{}:void 0,fe=L_(de),Ce=!fe&&!oe,ge=mt(mt(rn(mt({},I.value),{__reuseStableTopLevelNodes:Ce}),fe?{__disableStreamParse:!0}:{}),X?{__timing:X}:{}),Q=iL(Y,de,ge),ee=le?Rr():0,ce=le?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ue,Se=le?wh(Q.length):void 0,Ue=0,_e=0,Te=0;if(ve){const Fe=le?Rr():0,[Oe,Ye]=(function($t){var Ht,Yt;const[_n,je]=$t.scanGlobalReferenceAppend($t.previousContent,$t.content),Ke=$t.parseOptions;return[$t.previousDirtyStartIndex>0&&Ke.final!==!0&&!$t.customMarkdownIt&&!L_($t.md)&&!_n&&typeof Ke.preTransformTokens!="function"&&typeof Ke.postTransformTokens!="function"&&typeof Ke.postTransformNodes!="function"&&((Yt=(Ht=Ke.customHtmlTags)==null?void 0:Ht.length)!=null?Yt:0)===0?$t.previousDirtyStartIndex:0,je]})({content:Y,previousContent:c,previousDirtyStartIndex:_,parseOptions:I.value,customMarkdownIt:e.customMarkdownIt,md:de,scanGlobalReferenceAppend:f});Te=Ye;const ft=Oe<=0;if(ce){const $t=(function(Ht,Yt,_n,je={}){var Ke;if(!Yt.length)return{nodes:Ht,metrics:wh(Ht.length)};const Ze=(Ke=je.scanStartIndex)!=null?Ke:0,zt=je.reuseDirtyTail!==!1,at=(function(fn,Sn,to,An=0){const ao=Math.min(fn.length,Sn.length);for(let Kt=Math.min(ao,Math.max(0,An));Ktsu(Fe[ft]))})(ue,ce,_e):(function(Fe,Oe=0){for(let Ye=Math.max(0,Oe);Ye((W=G?.total)!=null?W:0);t.logPerf(Oe?"parse(stream)":"parse(sync)",mt(mt(mt({rendererId:t.instanceMsgId,ms:Math.round(Rr()-Ee),nodes:ue.length,contentLength:Y.length,parseCommitCount:g,parseCoalescedCount:m,nodeReuseMs:st,referenceDefinitionScanChars:Te,signatureMs:(z=ce?.signatureMs)!=null?z:0,stabilizeSignatureMs:(U=ce?.stabilizeSignatureMs)!=null?U:0,primeSignatureMs:(q=ce?.primeSignatureMs)!=null?q:0,signatureCallCount:(K=ce?.signatureCallCount)!=null?K:0,stabilizeSignatureCallCount:(ie=ce?.stabilizeSignatureCallCount)!=null?ie:0,primeSignatureCallCount:(ne=ce?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:Ue},Se??{}),X?Object.fromEntries(ace.map(Ye=>{var ft;return[Ye,(ft=X[Ye])!=null?ft:0]})):{}),Fe?{streamMode:Fe.lastMode,streamDelta:gce(Fe,G),streamStats:Fe}:{}))}return kt(ue)});return{effectiveCustomHtmlTags:M,effectiveCustomHtmlTagsSet:P,mdBase:$,mdInstance:S,mergedParseOptions:I,getParsedNodesDirtyStartIndex:()=>_,getParsedNodesRevision:()=>v,parsedNodes:L}}function yce(e){const{isClient:t}=e,n=Z(new Set),o=new Map,s=new Map,i=new Map;function r(u){if(!t)return;const c=i.get(u);c!=null&&(window.clearTimeout(c),i.delete(u))}function l(){if(t)for(const u of i.values())window.clearTimeout(u);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(u,c=!0){var d;c&&r(u),(function(f,h){if((m=(g=e.shouldTrackVisibleNodeIndices)==null?void 0:g.call(e))!=null&&!m)return;var g,m;const w=n.value,_=w.has(f);if(h){if(_)return;const k=new Set(w);return k.add(f),void(n.value=k)}if(!_)return;const v=new Set(w);v.delete(f),n.value=v})(u,c),c&&((d=e.onNodeMarkedVisible)==null||d.call(e,u))},resetNodeVisibleState:a,cleanupNodeVisibility:function(u){var c;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f{const c=s.getSnapshot();t.value=c.source,n.value=c.visible,o.value=c.done},r=s.subscribe(i);i();const l=R(()=>Math.max(0,t.value.length-n.value.length)),a=R(()=>l.value===0),u=R(()=>o.value&&a.value);return Zg()&&pf(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:u,caughtUp:a,pendingChars:l,enqueue:c=>s.enqueue(c),finish:c=>s.finish(c),flush:()=>s.flush(),reset:c=>s.reset(c),pause:()=>s.pause(),resume:()=>s.resume()}}const bce={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},$_=/auto|scroll|overlay/i;function Cce(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return $_.test(t)||$_.test(n)}function wce(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const _ce={class:"m-0 p-0"},xce=["data-probe"],Sce=Kn(tt(rn(mt({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(b(),A("div",{class:"height-estimation-probes",style:Gt({width:`${e.width}px`}),"aria-hidden":"true"},[C("div",{ref:i=>e.setParagraphWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[V(p(ac),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),C("div",{ref:i=>e.setListItemWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[C("ul",_ce,[V(p(qd),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),C("div",{ref:i=>e.setListWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[V(p(Kd),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(b(),A(Pe,null,pt(6,i=>C("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[V(p(I2),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,xce)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),N_=tt({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return ig((o=Td(e.estimatedPreviewHeightPx))!=null?o:og(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return nn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?nn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[nn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[nn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),nn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),nn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>nn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,nn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[nn("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),nn("div",{class:"absolute inset-0"},[nn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),F_=tt({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return sg((o=Td(e.estimatedPreviewHeightPx))!=null?o:ng(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return nn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?nn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[nn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[nn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),nn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>nn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[nn("span",{class:"action-icon block"})])))]):null,nn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[nn("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),nn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),Ace={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function xs(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const Mce=["data-custom-id"],Tce=["data-node-index","data-node-type"],R_="typewriter-simple-cursor-target",XL=Kn(tt(rn(mt({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(E){if(!(typeof Event<"u"&&E instanceof Event))return typeof E=="string"&&s("copy-code",E),void s("copy",E)}const r=ds(),l=on("markstreamNestedRendererProps",void 0);function a(E){const j=r?.vnode.props;return!!j&&(Object.prototype.hasOwnProperty.call(j,E)||Object.prototype.hasOwnProperty.call(j,String(E).replace(/[A-Z]/g,re=>`-${re.toLowerCase()}`)))}function u(E){var j,re;const ae=o[E];return a(E)?ae:(re=(j=l?.value)==null?void 0:j[E])!=null?re:ae}const c=R(()=>{return(E=u("mode"))==="chat"||E==="minimal"||E==="docs"?E:"docs";var E}),d=R(()=>C_(u("typewriter"))),f=R(()=>d.value!=="off"),h=R(()=>u("domMode")==="minimal"?"minimal":"full"),g=R(()=>{return(E={mode:c.value,codeRenderer:u("codeRenderer"),renderCodeBlocksAsPre:u("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":E.codeRenderer==="pre"||E.codeRenderer==="shiki"||E.codeRenderer==="monaco"?E.codeRenderer:E.renderCodeBlocksAsPre===!1||E.mode==="docs"?"monaco":"pre";var E}),m=R(()=>Ace[c.value]),w=R(()=>{var E;return(E=u("showTooltips"))!=null?E:m.value.showTooltips}),_=R(()=>{var E;return(E=u("fade"))!=null?E:m.value.fade}),v=R(()=>{var E;return(E=u("batchRendering"))!=null?E:m.value.batchRendering}),k=R(()=>{var E;return(E=u("initialRenderBatchSize"))!=null?E:m.value.initialRenderBatchSize}),y=R(()=>{var E;return(E=u("renderBatchSize"))!=null?E:m.value.renderBatchSize}),x=R(()=>{var E;return(E=u("renderBatchDelay"))!=null?E:m.value.renderBatchDelay}),M=R(()=>{var E;return(E=u("renderBatchBudgetMs"))!=null?E:m.value.renderBatchBudgetMs}),$=R(()=>{var E;return(E=u("renderBatchIdleTimeoutMs"))!=null?E:m.value.renderBatchIdleTimeoutMs}),S=R(()=>{var E;return(E=u("deferNodesUntilVisible"))!=null?E:m.value.deferNodesUntilVisible}),I=R(()=>{var E;return(E=u("maxLiveNodes"))!=null?E:m.value.maxLiveNodes}),P=R(()=>{var E;return(E=u("liveNodeBuffer"))!=null?E:m.value.liveNodeBuffer}),D=R(()=>{var E;return(E=u("nodeVirtual"))!=null?E:m.value.nodeVirtual}),T={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return u("parseOptions")},get customMarkdownIt(){return u("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return u("customHtmlTags")},get mode(){return u("mode")},get domMode(){return h.value},get htmlPolicy(){return u("htmlPolicy")},get viewportPriority(){return u("viewportPriority")},get viewportPriorityOptions(){return u("viewportPriorityOptions")},get codeBlockStream(){return u("codeBlockStream")},get codeBlockDarkTheme(){return u("codeBlockDarkTheme")},get codeBlockLightTheme(){return u("codeBlockLightTheme")},get codeBlockMonacoOptions(){return u("codeBlockMonacoOptions")},get codeRenderer(){return u("codeRenderer")},get renderCodeBlocksAsPre(){return u("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return u("codeBlockMinWidth")},get codeBlockMaxWidth(){return u("codeBlockMaxWidth")},get codeBlockProps(){return u("codeBlockProps")},get mermaidProps(){return u("mermaidProps")},get d2Props(){return u("d2Props")},get infographicProps(){return u("infographicProps")},get showTooltips(){return w.value},get themes(){return u("themes")},get langs(){return u("langs")},get isDark(){return u("isDark")},get customId(){return u("customId")},get indexKey(){return o.indexKey},get typewriter(){return u("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return u("smoothStreamingOptions")},get parseCoalesceMs(){return u("parseCoalesceMs")},get fade(){return _.value},get batchRendering(){return v.value},get initialRenderBatchSize(){return k.value},get renderBatchSize(){return y.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return M.value},get renderBatchIdleTimeoutMs(){return $.value},get deferNodesUntilVisible(){return S.value},get maxLiveNodes(){return I.value},get liveNodeBuffer(){return P.value},get nodeVirtual(){return D.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function L(E){s("height-change",E)}function B(E){s("virtual-state-change",E)}function H(E){s("anchor-change",E)}const O=Z(),F=Z(null),W=Z(null),z=Z(null),U=Jo({1:null,2:null,3:null,4:null,5:null,6:null}),q=Z(!1),K=new Map,ie=Z(0),ne=Z(0),Y=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function le(E,j){return typeof E!="string"?j:E.trim()||j}function Ee(E){const j=Number(E);return Number.isFinite(j)&&j>0?Math.max(1,Math.trunc(j)):640}const de=R(()=>{var E;const j=(E=T.viewportPriorityOptions)!=null?E:{},re=le(j.rootMargin,gc);return{rootMargin:re,heavyBlockMargin:le(j.heavyBlockMargin,re),maxTargets:Ee(j.maxTargets)}}),he=R(()=>{var E;return(E=de.value.rootMargin)!=null?E:gc}),pe=R(()=>{var E;return(E=de.value.maxTargets)!=null?E:640});function oe(){var E,j;if(((E=o.virtualScroll)==null?void 0:E.enabled)!==!0)return null;const re=(j=o.virtualScroll)==null?void 0:j.scrollRoot;return ve(typeof re=="function"?re():re)}function ve(E){return E?typeof HTMLElement<"u"&&E instanceof HTMLElement?E:typeof E=="object"&&"value"in E?ve(E.value):typeof E=="object"&&"$el"in E?ve(E.$el):null:null}En(FL,de);const{isClient:G,renderAsFragment:X,debugPerformanceEnabled:fe,resolvedShowTooltips:Ce,resolvedHtmlPolicy:ge,inheritedSmoothStreaming:Q,ownsTypewriterCursor:ee}=(function(E){const j=typeof window<"u",re=mf(),ae=on("markstreamHtmlPolicy",void 0),be=on("markstreamTypewriterCursor",void 0),Ne=on("markstreamSmoothStreaming",void 0),De=R(()=>E.renderAsFragment===!0),ze=R(()=>!!(E.debugPerformance&&j&&typeof console<"u")),ot=R(()=>{var nt;if(typeof E.showTooltips=="boolean")return E.showTooltips;const Be=(nt=re.showTooltips)!=null?nt:re["show-tooltips"];return Be===""||Be===!0||Be==="true"||Be!==!1&&Be!=="false"&&void 0}),We=R(()=>{var nt,Be;return(Be=(nt=E.htmlPolicy)!=null?nt:ae?.value)!=null?Be:"safe"}),Xe=R(()=>be?.value!==!0);return{isClient:j,renderAsFragment:De,debugPerformanceEnabled:ze,resolvedShowTooltips:ot,resolvedHtmlPolicy:We,inheritedSmoothStreaming:Ne,inheritedTypewriterCursor:be,ownsTypewriterCursor:Xe}})(T),{resolveViewportRoot:ce,resolveScrollContainer:ue,isReverseFlexScrollRoot:Se,getNormalizedScrollTop:Ue,getOffsetTopWithinRoot:_e}=(function(E,j){function re(){var ze,ot;return(ot=(ze=j.scrollRoot)==null?void 0:ze.call(j))!=null?ot:null}function ae(ze){if(typeof window>"u")return null;const ot=re();if(ot)return ot;const We=ze??E.value;if(!We)return null;const Xe=We.ownerDocument||document,nt=Xe.scrollingElement||Xe.documentElement;let Be=We;for(;Be&&Be!==Xe.body&&Be!==nt;){if(Cce(window.getComputedStyle(Be))&&wce(Be))return Be;Be=Be.parentElement}return null}function be(ze){if(!j.isClient)return!1;try{const ot=window.getComputedStyle(ze);return!!(ot.display||"").toLowerCase().includes("flex")&&(ot.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function Ne(ze,ot,We){var Xe,nt;if(We)return De(ot);const Be=ze.scrollTop;if(!be(ze))return Be;const Je=Be<0?-Be:Be;return Math.max(0,((Xe=ze.scrollHeight)!=null?Xe:0)-((nt=ze.clientHeight)!=null?nt:0))-Je}function De(ze){var ot,We,Xe,nt,Be;const Je=Number((ot=ze.scrollingElement)==null?void 0:ot.scrollTop),lt=Number((Xe=(We=ze.documentElement)==null?void 0:We.scrollTop)!=null?Xe:0),rt=Number((Be=(nt=ze.body)==null?void 0:nt.scrollTop)!=null?Be:0);return Math.max(0,Number.isFinite(Je)?Je:0,Number.isFinite(lt)?lt:0,Number.isFinite(rt)?rt:0)}return{resolveViewportRoot:ae,resolveScrollContainer:function(ze){var ot,We,Xe,nt;const Be=re();if(Be)return Be;const Je=ae((ot=ze??E.value)!=null?ot:null);if(Je)return Je;const lt=(nt=(Xe=ze?.ownerDocument)!=null?Xe:(We=E.value)==null?void 0:We.ownerDocument)!=null?nt:typeof document<"u"?document:null;return lt?.scrollingElement||lt?.documentElement||null},isReverseFlexScrollRoot:be,getNormalizedScrollTop:Ne,getOffsetTopWithinRoot:function(ze,ot){const We=ot.ownerDocument||ze.ownerDocument||document;if((function(Je,lt){return Je===lt.documentElement||Je===lt.body||Je===lt.scrollingElement})(ot,We))return ze.getBoundingClientRect().top+De(We);const Xe=ot.getBoundingClientRect(),nt=ze.getBoundingClientRect(),Be=Ne(ot,We,!1);return nt.top-Xe.top+Be}}})(O,{isClient:G,scrollRoot:oe});En("markstreamShowTooltips",Ce),En("markstreamHtmlPolicy",ge),En("markstreamTypewriter",f),En("markstreamFade",R(()=>T.fade!==!1)),En("markstreamTypewriterCursor",R(()=>!0)),En("markstreamTextStreamState",K),En("markstreamStreamVersion",ie),En("markstreamParseOptions",R(()=>T.parseOptions)),En("markstreamCustomMarkdownIt",R(()=>T.customMarkdownIt));const{smoothStreamingEnabled:Te,renderContent:st,requestedFinal:Fe,effectiveFinal:Oe}=(function(E,j){const re=kce(mt(mt({},bce),E.smoothStreamingOptions)),ae=R(()=>{var Be,Je,lt;return E.smoothStreaming!==!1&&!((Be=E.nodes)!=null&&Be.length)&&(E.smoothStreaming===!0||!((Je=j.inheritedSmoothStreaming)!=null&&Je.value))&&(E.smoothStreaming===!0||C_(E.typewriter)!=="off"||((lt=E.maxLiveNodes)!=null?lt:0)<=0)}),be=Z(!j.isClient||E.smoothStreaming===!0);dn(()=>{be.value=!0});const Ne=R(()=>be.value&&ae.value),De=R(()=>{var Be;return Ne.value?re.visible.value:(Be=E.content)!=null?Be:""}),ze=R(()=>{var Be,Je;const lt=(Be=E.parseOptions)!=null?Be:{};return(Je=E.final)!=null?Je:lt.final}),ot=R(()=>{const Be=ze.value;return Ne.value&&Be!=null?!!Be&&re.caughtUp.value:Be});let We=0,Xe=!1;function nt(){We=0,Xe=!1}return et([()=>E.content,()=>E.nodes,Ne,ze],([Be,Je,lt,rt])=>{if(Je?.length)return nt(),void re.reset("");const wt=Be??"";if(!lt)return nt(),re.reset(wt),void(rt&&re.finish({flush:!0}));const dt=re.source.value;if(wt){if(wt!==dt)if(wt.startsWith(dt)){const Nt=wt.slice(dt.length),Dt=re.pendingChars.value;Nt.length<=8?(We++,Xe||We>=2&&Dt<=8?(Xe=!0,re.reset(wt)):re.enqueue(Nt)):(nt(),re.enqueue(Nt))}else nt(),re.reset(wt)}else nt(),re.reset("");rt&&re.finish()},{immediate:!0}),{smoothStream:re,smoothStreamingEligible:ae,smoothStreamingEnabled:Ne,renderContent:De,requestedFinal:ze,effectiveFinal:ot}})(T,{isClient:G,inheritedSmoothStreaming:Q}),Ye=Fe.value===!0;En("markstreamSmoothStreaming",Te);const ft=Z(!1),$t=Z(!1),Ht=Z(!1);let Yt="",_n=!1,je=null;function Ke(){G&&je!=null&&(window.clearTimeout(je),je=null)}function Ze(){ft.value=!1,Ke()}function zt(E,j){if(!fe.value)return;const re=(function(){if(!fe.value)return null;const ae=Sn(at),be=Sn(tn),Ne=Math.max(fn,be);if(ae<=0&&Ne<=0)return null;const De={total:ae,maxPerFrame:Ne,byLabel:(ze=at,Object.fromEntries(Array.from(ze.entries()).sort((ot,We)=>We[1]-ot[1]||ot[0].localeCompare(We[0]))))};var ze;return at.clear(),tn.clear(),fn=0,De})();console.info(`[markstream-vue][perf] ${E}`,re?rn(mt({},j),{layoutReads:re}):j)}et([()=>T.indexKey,()=>T.customId],()=>{var E,j;Ze(),$t.value=!1,Ht.value=!((E=o.nodes)!=null&&E.length)&&Fe.value!==!0&&!!o.content,Yt=(j=st.value)!=null?j:"",_n=Yt.length>0},{flush:"sync"}),et([()=>o.content,()=>o.nodes,Fe],([E,j,re])=>{!j?.length&&re!==!0&&E&&(Ht.value=!0)},{flush:"sync",immediate:!0}),et([st,()=>o.nodes,Fe],([E,j,re])=>{const ae=E??"";return j?.length||re===!0?(Ze(),$t.value=!1,Yt=ae,void(_n=!0)):(ae.length>0&&(Ht.value=!0),_n?(Yt&&ae.length>Yt.length&&ae.startsWith(Yt)?(ft.value=!0,$t.value=!0,G&&(Ke(),je=window.setTimeout(()=>{var be;je=null,Oe.value===!0||(be=o.nodes)!=null&&be.length||(Kc(),ft.value=!1,Pl())},1200))):(ae.length"u")return null;const Ne=window;if(Ne.__markstreamLayoutReadPerformance)return Ne.__markstreamLayoutReadPerformance;const De={total:0,maxPerFrame:0,byLabel:{}};return Ne.__markstreamLayoutReadPerformance=De,De})();be&&(be.total=Number(be.total||0)+1,be.byLabel[ae]=Number(be.byLabel[ae]||0)+1,be.currentFrameTotal=Number(be.currentFrameTotal||0)+1,be.frameScheduled||(be.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>An(be),0):queueMicrotask(()=>An(be)):window.requestAnimationFrame(()=>An(be))))})(E),Wt||(Wt=!0,G&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(to):typeof queueMicrotask!="function"?setTimeout(to,0):queueMicrotask(to)))}function Kt(E,j){return ao(E),j()}const Co=T.customId?`renderer-${T.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,Po=(function(E){const j=new Map;return{scope:E,cache:j,clear:()=>j.clear()}})(Co),Mn=Co;En(WL,Po);const bn=fs(()=>T.customId),{effectiveCustomHtmlTagsSet:Do,mergedParseOptions:po,parsedNodes:At,getParsedNodesDirtyStartIndex:qs,getParsedNodesRevision:Bo}=vce(T,{instanceMsgId:Co,renderContent:st,effectiveFinal:Oe,smoothStreamingEnabled:Te,debugPerformanceEnabled:fe,customComponentsMap:bn,logPerf:zt});et(At,()=>{ft.value||Po.clear(),ie.value+=1},{immediate:!0});const To=R(()=>({customId:T.customId,customHtmlTags:po.value.customHtmlTags,parseOptions:T.parseOptions,customMarkdownIt:T.customMarkdownIt,htmlPolicy:ge.value,viewportPriority:T.viewportPriority,viewportPriorityOptions:de.value,mode:c.value,domMode:T.domMode,codeRenderer:g.value,codeBlockStream:T.codeBlockStream,codeBlockDarkTheme:T.codeBlockDarkTheme,codeBlockLightTheme:T.codeBlockLightTheme,codeBlockMonacoOptions:T.codeBlockMonacoOptions,renderCodeBlocksAsPre:T.renderCodeBlocksAsPre,codeBlockMinWidth:T.codeBlockMinWidth,codeBlockMaxWidth:T.codeBlockMaxWidth,codeBlockProps:T.codeBlockProps,mermaidProps:T.mermaidProps,d2Props:T.d2Props,infographicProps:T.infographicProps,showTooltips:Ce.value,themes:T.themes,langs:T.langs,isDark:T.isDark,typewriter:f.value,smoothStreamingOptions:T.smoothStreamingOptions,parseCoalesceMs:T.parseCoalesceMs,fade:T.fade}));En("markstreamNestedRendererProps",To);const ai=R(()=>At.value),Tn=R(()=>At.value.length),no=Z(null),Ks=Z(null),ps=Z(null),ui=Z(null),$s=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),yo=!$s&&T.customId?g_(T.customId):null,oo=R(()=>yo?(t4.value,g_(T.customId)):null),uo=R(()=>{var E;return!!(!X.value&&T.customId&&!$s&&((E=oo.value)!=null&&E.enabled))}),Xn=R(()=>!!(G&&uo.value)),co=R(()=>{var E;return!!(!X.value&&((E=o.virtualScroll)!=null&&E.enabled))}),Qe=R(()=>co.value),it=Z(!1);dn(()=>{it.value=!0});const Ct=R(()=>!!(G&&co.value));En("markstreamHostScrollManaged",Ct);const en=R(()=>!!(it.value&&Ct.value)),yn=R(()=>Xn.value||Ct.value),Ho=R(()=>Xn.value||en.value),Eo=R(()=>{var E;return yn.value&&((E=oo.value)==null?void 0:E.textEstimation)!==!1});function Io(){const E=ne.value||Kt("getMeasuredContainerWidth.clientWidth",()=>{var j;return((j=O.value)==null?void 0:j.clientWidth)||0});return Number.isFinite(E)&&E>0?E:0}const Zs=R(()=>{const E=Io();return E>0?Math.max(1,Math.round(E)):640}),zo=R(()=>{var E,j;return!(Oe.value!==!0||co.value||c.value!=="chat"&&c.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(E=o.nodes)!=null&&E.length||Ht.value||!(((j=T.maxLiveNodes)!=null?j:0)<=0))}),Lo=R(()=>{var E;return zo.value?50:Math.max(1,(E=T.maxLiveNodes)!=null?E:320)}),Wo=R(()=>{var E;return zo.value?16:Math.max(0,(E=T.liveNodeBuffer)!=null?E:60)}),sn=R(()=>{var E;return!X.value&&T.nodeVirtual!==!1&&!(((E=T.maxLiveNodes)!=null?E:0)<=0&&!zo.value)&&(T.nodeVirtual===!0?At.value.length>0:At.value.length>Lo.value)}),ws=R(()=>sn.value||Xn.value||Ct.value),Uo=R(()=>T.viewportPriority!==!1),Mr=R(()=>!!Uo.value&&!q.value);var Gs;Gs=R(()=>Uo.value),En(RL,Gs);const Vi=R(()=>{var E;return!(X.value||T.deferNodesUntilVisible===!1||((E=T.maxLiveNodes)!=null?E:0)<=0||sn.value||At.value.length>900||T.viewportPriority===!1)}),Ys=Xle(E=>{var j;return ce((j=E??O.value)!=null?j:null)},Uo),{requestFrame:jo,cancelFrame:Vo,hasIdleCallback:Il,isTestEnv:cr}=(function(E){const j=E.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,re=E.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,ae=E.isClient&&typeof window.requestIdleCallback=="function",be=(function(){var Ne;if(typeof globalThis>"u"||!("process"in globalThis))return;const De=(Ne=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:Ne.value;return De?.env})();return{requestFrame:j,cancelFrame:re,hasIdleCallback:ae,isTestEnv:be?.NODE_ENV==="test"}})({isClient:G}),Tr=R(()=>Oe.value===!0&&!co.value),{resolvedBatchSize:ho,resolvedInitialBatch:ko,batchingEnabled:qi,incrementalRenderingActive:gt,renderedCount:Le,previousRenderContext:Ge,adaptiveBatchSize:Xt,previousBatchConfig:hs}=(function(E,j){var re;const ae=R(()=>{var nt;const Be=Math.trunc((nt=E.renderBatchSize)!=null?nt:80);return Number.isFinite(Be)?Math.max(0,Be):0}),be=R(()=>{var nt;const Be=Math.trunc((nt=E.initialRenderBatchSize)!=null?nt:ae.value);return Number.isFinite(Be)?Math.max(0,Be):ae.value}),Ne=R(()=>!j.renderAsFragment.value&&E.batchRendering!==!1&&ae.value>0&&j.isClient&&!j.isTestEnv),De=Z(0),ze=Z({key:E.indexKey,total:0}),ot=Z(Math.max(1,ae.value||1)),We=R(()=>{var nt,Be,Je;return Ne.value&&!((nt=j.continuousStreaming)!=null&&nt.value)&&!((Be=j.forceFullRenderFinalContent)!=null&&Be.value)&&((Je=E.maxLiveNodes)!=null?Je:0)<=0}),Xe=Z({batchSize:ae.value,initial:be.value,delay:(re=E.renderBatchDelay)!=null?re:16,enabled:We.value});return{resolvedBatchSize:ae,resolvedInitialBatch:be,batchingEnabled:Ne,incrementalRenderingActive:We,renderedCount:De,previousRenderContext:ze,adaptiveBatchSize:ot,previousBatchConfig:Xe}})(T,{isClient:G,isTestEnv:cr,renderAsFragment:X,forceFullRenderFinalContent:Tr,continuousStreaming:R(()=>$t.value&&Oe.value!==!0)}),ts=R(()=>{var E;return!X.value&&T.batchRendering!==!1&&ho.value>0&&!cr&&((E=T.maxLiveNodes)!=null?E:0)<=0&&!Tr.value}),Ll=R(()=>ts.value),tl=R(()=>yn.value||Ll.value),Mi=R(()=>{var E;return tl.value&&((E=oo.value)==null?void 0:E.codeBlockEstimation)!==!1}),fo=new Map,Ki=new Map,Er=new WeakMap;let ci=null;const $l=new WeakMap,qo=new Map,Ir=[];let Xs=[],di=[],se=-1;const xe=Xr(Ir),J=new Set,we=Z(0);let $e=0;const He=Z(0),vt=R(()=>(He.value,Array.from(fo.entries()).sort((E,j)=>E[0]-j[0]))),ut=Z(null),Pt=Z(null);let Tt,ln=null,so=0,Rt=null;function Ot(){Tt.markFallbackHeightPrefixDirty()}function Zn(E){return Tt.getFallbackNodeHeight(E)}function bo(E,j){return Tt.estimateHeightRange(E,j)}function ms(E){return Tt.estimateIndexForOffset(E)}const{activeRestoreAnchor:Ns,getRelativeScrollTopWithinContainer:Js,setRelativeScrollTopWithinContainer:$c,resolveAnchorOffset:V2,clearRestoreReconcile:Nc,scheduleRestoreReconcile:vu,captureRestoreAnchor:Fc,restoreAnchor:Rc,getAnchorDrift:q2}=(function(E){const{isClient:j,containerRef:re,parsedNodeCount:ae,requestFrame:be,cancelFrame:Ne,resolveScrollContainer:De,getNormalizedScrollTop:ze,getOffsetTopWithinRoot:ot,isReverseFlexScrollRoot:We,estimateIndexForOffset:Xe,estimateHeightRange:nt,getFallbackNodeHeight:Be,clamp:Je}=E,lt=Z(null);let rt=null,wt=[];function dt(){const Zt=De(),pn=re.value;if(!Zt||!pn)return null;const vn=Zt.ownerDocument||pn.ownerDocument||document;if(Zt===vn.documentElement||Zt===vn.body||Zt===vn.scrollingElement){const Jn=pn.getBoundingClientRect();return Math.max(0,-Jn.top)}return Math.max(0,ze(Zt,vn,!1)-ot(pn,Zt))}function Nt(Zt){var pn;const vn=De(),Jn=re.value;if(!vn||!Jn)return;const Ps=Math.max(0,Zt),_s=vn.ownerDocument||Jn.ownerDocument||document,$r=_s.defaultView||(typeof window<"u"?window:null);if(vn===_s.documentElement||vn===_s.body||vn===_s.scrollingElement){const il=ze(vn,_s,!0)+Jn.getBoundingClientRect().top;return void((pn=$r?.scrollTo)==null||pn.call($r,0,Math.max(0,il+Ps)))}k_(vn,_s,ot(Jn,vn)+Ps,{isReverseFlexScrollRoot:il=>{var Zf;return(Zf=We?.(il))!=null&&Zf},getNormalizedScrollTop:ze})}function Dt(Zt){const pn=ae.value,vn=Je(Zt.nodeIndex,0,Math.max(0,pn-1));return nt(0,vn)+Math.max(0,Zt.offsetWithinNodePx)}function qt(){if(rt!=null&&(Ne?.(rt),rt=null),j)for(const Zt of wt)window.clearTimeout(Zt);wt=[]}function Ut(Zt){const pn=Dt(Zt),vn=dt();vn!=null&&Math.abs(vn-pn)<=.5||Nt(pn)}return{activeRestoreAnchor:lt,getRelativeScrollTopWithinContainer:dt,setRelativeScrollTopWithinContainer:Nt,resolveAnchorOffset:Dt,clearRestoreReconcile:qt,applyRestoreAnchor:Ut,scheduleRestoreReconcile:function(){lt.value&&j&&rt==null&&(rt=be?be(()=>{rt=null,lt.value&&Ut(lt.value)}):null,rt==null&<.value&&Ut(lt.value))},captureRestoreAnchor:function(){const Zt=dt(),pn=ae.value;if(Zt==null||pn<=0)return null;const vn=Je(Xe(Zt+1),0,pn-1),Jn=nt(0,vn),Ps=Be(vn);return{nodeIndex:vn,offsetWithinNodePx:Je(Zt-Jn,0,Math.max(0,Ps-1))}},restoreAnchor:function(Zt){const pn=ae.value;if(lt.value={nodeIndex:Je(Zt.nodeIndex,0,Math.max(0,pn-1)),offsetWithinNodePx:Math.max(0,Zt.offsetWithinNodePx)},qt(),Ut(lt.value),j)for(const vn of[0,120,280,480])wt.push(window.setTimeout(()=>{lt.value&&Ut(lt.value)},vn))},getAnchorDrift:function(Zt){const pn=dt();return pn==null?null:pn-Dt(Zt)}}})({isClient:G,containerRef:O,parsedNodeCount:Tn,requestFrame:jo,cancelFrame:Vo,resolveScrollContainer:()=>ut.value||ue(),getNormalizedScrollTop:Ue,getOffsetTopWithinRoot:_e,isReverseFlexScrollRoot:Se,estimateIndexForOffset:ms,estimateHeightRange:bo,getFallbackNodeHeight:Zn,clamp:Os}),{nodeHeights:Nl,heightStats:fi,heightTreeSize:Sf,heightSumTree:l0,heightKnownTree:a0,averageNodeHeight:Af,resetHeightMeasurements:u0,pruneHeightMeasurements:c0,rebuildHeightTrees:Oc,recordNodeHeight:K2,removeNodeHeights:Z2,exportHeightCache:ye,importHeightCache:Ae,fenwickRangeSum:qe}=(function(E={}){const j=Jo({}),re=Jo({total:0,count:0}),ae=Z(0),be=Z([]),Ne=Z([]);function De(){for(const Be of Object.keys(j))delete j[Number(Be)];re.total=0,re.count=0,ae.value=0,be.value=[],Ne.value=[]}function ze(Be,Je,lt){for(let rt=Je+1;rt0;rt-=rt&-rt)lt+=Be[rt];return lt}function We(Be){ae.value=Be;const Je=new Array(Be+1).fill(0),lt=new Array(Be+1).fill(0);for(const[rt,wt]of Object.entries(j)){const dt=Number(rt),Nt=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Nt)||Nt<=0||(ze(Je,dt,Nt),ze(lt,dt,1))}be.value=Je,Ne.value=lt}function Xe(Be){if(!Number.isInteger(Be)||Be<0)return!1;const Je=j[Be];if(!Number.isFinite(Je)||Je<=0)return!1;if(delete j[Be],re.total=Math.max(0,re.total-Je),re.count=Math.max(0,re.count-1),ae.value>Be){const lt=be.value,rt=Ne.value;lt.length&&rt.length&&(ze(lt,Be,-Je),ze(rt,Be,-1))}return!0}const nt=R(()=>re.count>0?Math.max(12,re.total/re.count):32);return{nodeHeights:j,heightStats:re,heightTreeSize:ae,heightSumTree:be,heightKnownTree:Ne,averageNodeHeight:nt,resetHeightMeasurements:De,pruneHeightMeasurements:function(Be){if(Be<=0)return void De();let Je=0,lt=0;for(const[rt,wt]of Object.entries(j)){const dt=Number(rt),Nt=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Nt)||Nt<=0?delete j[dt]:(Je+=Nt,lt++)}re.total=Je,re.count=lt},rebuildHeightTrees:We,recordNodeHeight:function(Be,Je,lt={}){(function(rt,wt,dt={}){var Nt;if(!Number.isFinite(wt)||wt<=0)return!1;const Dt=j[rt];if(Dt&&(dt.allowShrink===!1&&wtrt){const qt=be.value,Ut=Ne.value;if(qt.length&&Ut.length)if(Dt){const Zt=wt-Dt;Zt!==0&&ze(qt,rt,Zt)}else ze(qt,rt,wt),ze(Ut,rt,1)}dt.notify!==!1&&((Nt=E.onHeightRecorded)==null||Nt.call(E))})(Be,Je,rn(mt({},lt),{notify:!0}))},removeNodeHeight:function(Be,Je={}){var lt;const rt=Xe(Be);return rt&&Je.notify!==!1&&((lt=E.onHeightRecorded)==null||lt.call(E)),rt},removeNodeHeights:function(Be,Je={}){var lt;let rt=0;for(const wt of Be)Xe(Number(wt))&&rt++;return rt>0&&Je.notify!==!1&&((lt=E.onHeightRecorded)==null||lt.call(E)),rt},exportHeightCache:function(){return Object.entries(j).map(([Be,Je])=>({index:Number(Be),height:Number(Je)})).filter(Be=>Number.isFinite(Be.index)&&Be.index>=0&&Number.isFinite(Be.height)&&Be.height>0).sort((Be,Je)=>Be.index-Je.index)},importHeightCache:function(Be,Je={}){var lt;if(!Array.isArray(Be))return;const rt=ae.value;let wt=!1;if(Je.mode!=="merge"){const dt=Object.keys(j);if(dt.length>0){for(const Nt of dt)delete j[Number(Nt)];wt=!0}}for(const dt of Be){const Nt=Number(dt.index),Dt=Number(dt.height);if(!Number.isInteger(Nt)||Nt<0||rt>0&&Nt>=rt||!Number.isFinite(Dt)||Dt<=0)continue;const qt=j[Nt];qt&&Math.abs(qt-Dt)<=1||(j[Nt]=Dt,wt=!0)}wt&&((function(){let dt=0,Nt=0;const Dt=ae.value;for(const[qt,Ut]of Object.entries(j)){const Zt=Number(qt),pn=Number(Ut);!Number.isFinite(Zt)||Zt<0||Dt>0&&Zt>=Dt||!Number.isFinite(pn)||pn<=0?delete j[Zt]:(dt+=pn,Nt++)}re.total=dt,re.count=Nt})(),rt>0&&We(rt),(lt=E.onHeightRecorded)==null||lt.call(E))},fenwickRangeSum:function(Be,Je,lt){if(lt<=Je)return 0;const rt=ot(Be,lt-1);return Je<=0?rt:rt-ot(Be,Je-1)}}})({onHeightRecorded:()=>{Ot(),Ct.value&&Wf(),Ns.value&&vu(),Pt.value&&jc(),mo("node-resize")}});function Mt(E){Number.isInteger(E)&&E>=0&&J.add(E)}function Jt(E){for(const j of E)Mt(Number(j))}function an(E){$e++;let j=!0;try{const re=E();return j=re!==!1,re}finally{$e--,$e===0&&j&&we.value++}}function $n(){Xs=[],di=[],se=-1,J.clear(),xe.value=Ir}function io(){$n(),an(()=>u0()),qo.clear()}function Fs(E){!Number.isInteger(E)||E<0||E>=At.value.length||qo.set(E,Lf(E))}function yu(E,j,re={}){const ae=Nl[E];Mt(E),K2(E,j,re);const be=Nl[E];return Object.is(ae,be)?(J.delete(E),!1):(be&&be>0?Fs(E):ae&&qo.delete(E),!0)}function Mf(E,j){const re=Kt("getNodeLayoutHeight.slot.offsetHeight",()=>{var ae,be;return(be=(ae=fo.get(E))==null?void 0:ae.offsetHeight)!=null?be:0});return re>0?re:Kt("getNodeLayoutHeight.content.offsetHeight",()=>j.offsetHeight)}function r6(E,j={}){j.mode!=="merge"?$n():Jt(E.map(re=>re.index)),an(()=>Ae(E,j)),wv()}const nl=R(()=>Vi.value&&Mr.value),yF=R(()=>{var E;return!X.value&&T.batchRendering!==!1&&ho.value>0&&((E=T.maxLiveNodes)!=null?E:0)<=0}),kF=R(()=>!X.value&&Ye&&Oe.value===!0&&!sn.value&&!co.value&&!uo.value&&!nl.value&&!yF.value),l6=R(()=>!!Ys&&nl.value),a6=R(()=>sn.value||Ct.value),{focusIndex:Fl,liveRange:Rs,updateLiveRange:Tf}=(function(E,j){const{parsedNodeCount:re,virtualizationEnabled:ae,maxLiveNodesResolved:be,liveNodeBufferResolved:Ne,clamp:De}=j,ze=Ne??R(()=>{var Xe;return Math.max(0,(Xe=E.liveNodeBuffer)!=null?Xe:60)}),ot=Z(0),We=Jo({start:0,end:0});return{liveNodeBufferResolved:ze,focusIndex:ot,liveRange:We,updateLiveRange:function(){const Xe=re.value;if(!ae.value||Xe===0)return We.start=0,void(We.end=Xe);const nt=Math.min(be.value,Xe),Be=ze.value,Je=De(ot.value-Be,0,Math.max(0,Xe-nt));We.start=Je,We.end=Math.min(Xe,Je+nt)}}})(T,{parsedNodeCount:Tn,virtualizationEnabled:sn,maxLiveNodesResolved:Lo,liveNodeBufferResolved:Wo,clamp:Os}),ol=new Map,ku=new Map,fa=new Map,d0=[],Rl=new Map,pa=new Set,u6=Z(0);let G2=!1;const c6=R(()=>(u6.value,pa.size)),Zi=new Map,sl=new Map,d6=Z(0),Y2=R(()=>{d6.value;let E=0;for(const j of Zi.values())E+=Math.max(0,j);return E});let Gi=null;const f0=R(()=>{if(!sn.value)return At.value.length;const E=Wo.value,j=Math.max(Rs.end+E,ko.value),re=Math.min(At.value.length,j);return Math.max(Le.value,re)});function p0(){G2||(G2=!0,queueMicrotask(()=>{G2=!1,u6.value+=1}))}function f6(E,j,re="node-resize"){if(!G||typeof window>"u")return null;const ae=window.setTimeout(()=>{pa.delete(ae)&&p0();try{j()}finally{mo(re)}},Math.max(0,E));return pa.add(ae),p0(),ae}function h0(E){G&&E!=null&&(pa.delete(E)&&p0(),window.clearTimeout(E))}function p6(){if(G&&typeof window<"u")for(const E of pa)window.clearTimeout(E);pa.size&&(pa.clear(),p0()),d0.length=0,fa.clear()}function bF(E){F.value=E}function CF(E){W.value=E}function wF(E){z.value=E}const{cancelScheduledFocusSync:X2,scheduleFocusSync:Lr}=(function(E){const{isClient:j,containerRef:re,virtualizationEnabled:ae,requestFrame:be,cancelFrame:Ne,syncFocusToScroll:De}=E;let ze=null;function ot(){var Xe,nt,Be;return(Be=(nt=(Xe=re.value)==null?void 0:Xe.ownerDocument)==null?void 0:nt.defaultView)!=null?Be:typeof window<"u"?window:null}function We(){if(!ze)return;const Xe=ot();ze.viaTimeout?Xe?Xe.clearTimeout(ze.id):clearTimeout(ze.id):Ne?.(ze.id),ze=null}return{cancelScheduledFocusSync:We,scheduleFocusSync:function(Xe={}){if(!ae.value)return;if(!j)return void De(!0);if(Xe.immediate)return We(),void De(!0);if(ze)return;const nt=()=>{ze=null,De()};if(be)return void(ze={id:be(nt),viaTimeout:!1});const Be=ot();ze={id:Be?Be.setTimeout(nt,16):setTimeout(nt,16),viaTimeout:!0}}}})({isClient:G,containerRef:O,virtualizationEnabled:sn,requestFrame:jo,cancelFrame:Vo,syncFocusToScroll:function(E=!1){var j;if(!sn.value)return;const re=ut.value||ue();if(!re)return;const ae=re.ownerDocument||((j=O.value)==null?void 0:j.ownerDocument)||document,be=ae?.defaultView||(typeof window<"u"?window:null),Ne=re===ae?.documentElement||re===ae?.body,De=At.value.length;if(De<=0)return;if(!Ne&&De>0&&Se(re)){const rt=Kt("syncFocusToScroll.clientHeight",()=>re.clientHeight||0),wt=Kt("syncFocusToScroll.scrollTop",()=>re.scrollTop),dt=wt<0?-wt:wt;return void v0(Os((ze=Math.max(0,dt)+.5*Math.max(0,rt),Tt.estimateIndexForOffsetFromEnd(ze)),0,Math.max(0,De-1)),E)}var ze;const ot=(function(rt,wt,dt,Nt){const Dt=O.value;if(!Dt)return null;const qt=Nt?0:Kt("syncFocusToScroll.model.root.getBoundingClientRect",()=>rt.getBoundingClientRect().top),Ut=Kt("syncFocusToScroll.model.container.getBoundingClientRect",()=>Dt.getBoundingClientRect().top),Zt=Math.max(0,qt-Ut),pn=Nt?Kt("syncFocusToScroll.model.viewport.clientHeight",()=>{var vn,Jn,Ps,_s;return(_s=(Ps=(Jn=dt?.innerHeight)!=null?Jn:(vn=wt.documentElement)==null?void 0:vn.clientHeight)!=null?Ps:rt.clientHeight)!=null?_s:0}):Kt("syncFocusToScroll.model.root.clientHeight",()=>rt.clientHeight);return Os(ms(Zt+.5*Math.max(0,pn)),0,Math.max(0,At.value.length-1))})(re,ae,be,Ne);if(ot!=null)return void v0(ot,E);const We=Ne?null:Kt("syncFocusToScroll.root.getBoundingClientRect",()=>re.getBoundingClientRect()),Xe=Ne?0:We.top,nt=Ne?Kt("syncFocusToScroll.viewport.clientHeight",()=>{var rt,wt;return(wt=(rt=be?.innerHeight)!=null?rt:re.clientHeight)!=null?wt:0}):We.bottom,Be=vt.value;let Je=null,lt=null;for(const[rt,wt]of Be){if(!wt)continue;const dt=Kt("syncFocusToScroll.slot.getBoundingClientRect",()=>wt.getBoundingClientRect());dt.bottom<=Xe||dt.top>=nt||(Je==null&&(Je=rt),lt=rt)}if(Je==null||lt==null){const rt=O.value;if(!rt)return;const wt=Ne?{top:0}:Kt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>re.getBoundingClientRect()),dt=Kt("syncFocusToScroll.fallback.scrollTop",()=>Ue(re,ae,Ne)),Nt=Ne?(()=>{const qt=Kt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>rt.getBoundingClientRect()),Ut=(Ne?0:wt.top)-qt.top;return Math.max(0,Ut)})():(()=>{const qt=_e(rt,re);return Math.max(0,dt-qt)})(),Dt=Ne?Kt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var qt,Ut,Zt,pn;return(pn=(Zt=(Ut=be?.innerHeight)!=null?Ut:(qt=ae?.documentElement)==null?void 0:qt.clientHeight)!=null?Zt:re.clientHeight)!=null?pn:0}):Kt("syncFocusToScroll.fallback.root.clientHeight",()=>re.clientHeight);return void v0(Os(ms(Nt+.5*Math.max(0,Dt)),0,Math.max(0,At.value.length-1)),!0)}v0(Math.round((Je+lt)/2),E)}}),{visibleNodeIndices:J2,nodeVisibilityHandles:Pc,nodeVisibilityWatchStops:m0,nodeVisibilityFallbackTimers:h6,clearVisibilityFallback:g0,markNodeVisible:ha,cleanupNodeVisibility:_F,destroyNodeVisibilityState:Q2}=yce({isClient:G,shouldTrackVisibleNodeIndices:()=>nl.value,shouldCleanupNodeVisibility:()=>sn.value,onNodeMarkedVisible:E=>{sn.value?Lr():Fl.value=Os(E,0,Math.max(0,At.value.length-1))},onNodeVisibilityCleaned:E=>{fo.delete(E)&&W6()}}),{cleanupScrollListener:m6,setupScrollListener:xF}=(function(E){const{isClient:j,virtualizationEnabled:re,listenerEnabled:ae,scrollRootElement:be,resolveScrollContainer:Ne,scheduleFocusSync:De,onScroll:ze}=E;let ot=null,We=null;function Xe(){ot&&(ot(),ot=null),We=null,be.value=null}function nt(Be){const Je=E.getScrollTop?E.getScrollTop(Be):Be.scrollTop;return Math.max(0,Number.isFinite(Je)?Math.abs(Je):0)}return{cleanupScrollListener:Xe,setupScrollListener:function(){if(!j)return;if(!((Be=ae?.value)!=null?Be:re.value))return void Xe();var Be;const Je=Ne();if(!Je)return void Xe();if(be.value===Je&&ot)return;Xe(),We=nt(Je);const lt=()=>{if(ze?.(),re.value){const rt=(function(wt){const dt=nt(wt),Nt=We;We=dt;const Dt=Math.max(480,.75*(wt.clientHeight||0));return Nt==null?dt>Dt?{immediate:!0}:void 0:Math.abs(dt-Nt)>Dt?{immediate:!0}:void 0})(Je);rt?De(rt):De()}};Je.addEventListener("scroll",lt,{passive:!0}),be.value=Je,ot=()=>{Je.removeEventListener("scroll",lt)}}}})({isClient:G,virtualizationEnabled:sn,listenerEnabled:a6,scrollRootElement:ut,resolveScrollContainer:ue,scheduleFocusSync:Lr,onScroll:function(){const E=Pt.value;if(!E)return;const j=If();if(!j||(function(ae){if(Of()>=so)return Rt=null,!1;const be=Rt;if(be==null)return!0;const Ne=Math.abs(ae.scrollTop-be)<=2;return Ne||(Rt=null),Ne})(j))return;const re=I6(j);re!=null?(re<-32||Math.abs(Math.max(0,re)-Math.max(0,E.distanceFromBottomPx))>32)&&Uc("restore"):Uc("restore")},getScrollTop:E=>{var j;const re=E.ownerDocument||((j=O.value)==null?void 0:j.ownerDocument)||document,ae=E===re.documentElement||E===re.body||E===re.scrollingElement;return Kt("scrollListener.getScrollTop",()=>Ue(E,re,ae))}});function v0(E,j=!1){const re=Os(E,0,Math.max(0,At.value.length-1));!j&&Math.abs(re-Fl.value)<=1||(Fl.value=re,Tf())}function Os(E,j,re){return Math.min(Math.max(E,j),re)}function ev(E=At.value.length){const j=qs();return!Number.isInteger(j)||j<0?E:Os(j,0,E)}function tv(E){return E?.firstElementChild}function g6(E,j){var re;return E?(re=E.matches)!=null&&re.call(E,j)?E:E.querySelector(j):null}function SF(E,j){E<1||E>6||(U[E]=j)}function v6(){if(!yn.value)return void(ne.value=0);const E=Kt("updateExperimentContainerWidth.clientWidth",()=>{var j,re;return(re=(j=O.value)==null?void 0:j.clientWidth)!=null?re:0});ne.value=E>0?E:0}let Ef=null;function nv(){Ef?.disconnect(),Ef=null}const y6=S1("ViewportDeferredMarkdownCodeBlockNode",zr({loader:()=>vo(null,null,function*(){return(yield Go(()=>import("./index5-DRizs5us.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:ag,delay:0,suspensible:!1}),ag);function k6(E){return E===y6}const b6=R(()=>g.value==="pre"?Ri:g.value==="shiki"?y6:G9);function C6(){var E;return((E=T.codeBlockProps)==null?void 0:E.showHeader)!==!1}function w6(E,j,re){const ae=Nl[j],be=typeof ae=="number"&&ae>0;if(Eo.value&&!be&&!(function(Ne){return!!bn.value.paragraph&&(Ne.type==="paragraph"||Ne.type==="list_item"||Ne.type==="list")})(E)){const Ne=zL(E,re,Y.value);if(Ne)return Ne}if(Mi.value&&E.type==="code_block"){const Ne=(function(De){if(De.type!=="code_block")return null;const ze=e7(De,M0(De));return k6(ze)?"markdown":ze===Ri?"pre":ze===b6.value||ze===G9?"monaco":null})(E);if(Ne==="monaco"||Ne==="markdown"||Ne==="pre")return(function(De,ze){var ot,We,Xe;if(!De||De.type!=="code_block")return null;const nt=ze.rendererKind,Be=nt!=="pre"&&ze.showHeader!==!1,Je=!!De.diff;let lt=0,rt=500;if(nt==="monaco"){const dt=(ot=ze.monacoOptions)!=null?ot:{},Nt=s4(De,dt,ze.width),Dt=(function(Ut){const Zt=typeof Ut?.fontSize=="number"&&Ut.fontSize>0?Ut.fontSize:12;return typeof Ut?.lineHeight=="number"&&Ut.lineHeight>0?Ut.lineHeight:Math.round(1.5*Zt)})(dt),qt=(function(Ut,Zt){var pn,vn;const Jn=typeof((pn=Ut?.padding)==null?void 0:pn.top)=="number"?Ut.padding.top:Zt?0:8,Ps=typeof((vn=Ut?.padding)==null?void 0:vn.bottom)=="number"?Ut.padding.bottom:Zt?0:8;return Math.max(0,Jn)+Math.max(0,Ps)})(dt,Je);rt=typeof dt.MAX_HEIGHT=="number"&&dt.MAX_HEIGHT>0?dt.MAX_HEIGHT:500,lt=Math.round(Nt*Dt+qt)}else if(nt==="markdown"){const dt=s4(De);lt=Math.round(21*dt+32)}else{const dt=s4(De);lt=Math.round(28*dt),rt=Number.POSITIVE_INFINITY}const wt=Math.max(1,Math.min(lt,rt));return mt({kind:"code-block",height:Math.round(wt+(Be?40:0)),contentHeight:wt,rendererKind:nt},Je&&nt==="monaco"?{diffInline:h5((We=ze.monacoOptions)!=null?We:{},(Xe=ze.width)!=null?Xe:0)}:{})})(E,{rendererKind:Ne,monacoOptions:T.codeBlockMonacoOptions,showHeader:C6(),width:re})}return null}JS(()=>{if(we.value,$e>0)return;const E=At.value,j=Bo();if(!E.length||!tl.value)return Xs=[],di=[],se=-1,J.clear(),void(xe.value=Ir);const re=ne.value||Kt("estimatedNodeHeights.clientWidth",()=>{var We;return((We=O.value)==null?void 0:We.clientWidth)||0});if(!Number.isFinite(re)||re<=0)return Xs=[],di=[],se=-1,J.clear(),void(xe.value=Ir);const ae=(function(We){return[Math.round(We),Eo.value,Mi.value,Y.value,T.codeBlockMonacoOptions,C6(),g.value,bn.value,t4.value]})(re),be=Xs.length<=E.length&&(De=ae,(Ne=di).length===De.length&&Ne.every((We,Xe)=>Object.is(We,De[Xe])));var Ne,De;const ze=be&&se===j?E.length:be?ev(E.length):0,ot=be?Array.from(J):[];Xs.length=E.length;for(let We=ze;We=0&&Wexe.value);Tt=(function(E){let j=!0,re=[0],ae="";function be(Xe){var nt;const Be=E.nodeHeights[Xe];if(Number.isFinite(Be)&&Be>0)return Be;const Je=E.parsedNodes.value[Xe],lt=Je?.type,rt=!!((nt=E.hasCustomParagraphComponent)!=null&&nt.call(E)),wt=E.estimatedNodeHeights.value[Xe],dt=wt?.height;if(!(function(Dt,qt,Ut){return!!(Ut&&qt?.kind==="simple-text"&&(Dt==="paragraph"||Dt==="list_item"||Dt==="list"))})(lt,wt,rt)&&Number.isFinite(dt)&&dt>0)return dt;const Nt=rce(Je,E.getContainerWidth()||640);return lt==="heading"||lt==="paragraph"&&Nt<=28&&(function(Dt,qt){if(qt)return!1;const Ut=Dt.children;return!Array.isArray(Ut)||!Ut.length||Ut.every(UL)})(Je,rt)?Nt:Math.max(E.averageNodeHeight.value,Nt)}function Ne(){var Xe;const nt=E.parsedNodes.value.length,Be=E.getPrefixCacheKeyParts().join(":");if(!j&&ae===Be)return re;const Je=new Array(nt+1);Je[0]=0;for(let lt=0;lt=((nt=lt[Je])!=null?nt:0))return Je-1;let rt=0,wt=Je-1,dt=Je-1;for(;rt<=wt;){const Nt=rt+wt>>1;((Be=lt[Nt+1])!=null?Be:0)>=Xe?(dt=Nt,wt=Nt-1):rt=Nt+1}return dt}function ze(Xe,nt){var Be,Je;if(Xe>=nt)return 0;if(E.heightEstimationActive.value)return(function(wt,dt){var Nt,Dt;const qt=E.parsedNodes.value.length,Ut=w_(Math.trunc(wt),0,qt),Zt=w_(Math.trunc(dt),Ut,qt);if(Ut>=Zt)return 0;const pn=Ne();return((Nt=pn[Zt])!=null?Nt:0)-((Dt=pn[Ut])!=null?Dt:0)})(Xe,nt);if(E.heightTreeSize.value!==E.parsedNodes.value.length){let wt=0;for(let dt=Xe;dtUt<=0?0:E.fenwickRangeSum(rt,0,Ut)+(Ut-E.fenwickRangeSum(wt,0,Ut))*lt;let Nt=0,Dt=Be.length-1,qt=Be.length-1;for(;Nt<=Dt;){const Ut=Nt+Dt>>1;dt(Ut+1)>=Xe?(qt=Ut,Dt=Ut-1):Nt=Ut+1}return qt}let Je=Xe;for(let lt=0;lt0||Xe++}return Xe}return{markFallbackHeightPrefixDirty:function(){j=!0},getFallbackNodeHeight:be,estimateHeightRange:ze,estimateIndexForOffset:ot,estimateIndexForOffsetFromEnd:function(Xe){var nt,Be;const Je=E.parsedNodes.value;if(!Je.length)return 0;if(Xe<=0)return Math.max(0,Je.length-1);if(E.heightEstimationActive.value){const rt=(nt=Ne()[Je.length])!=null?nt:0;return De(Math.max(0,rt-Xe))}if(E.heightTreeSize.value===Je.length){const rt=ze(0,Je.length);return ot(Math.max(0,rt-Xe))}let lt=Xe;for(let rt=Je.length-1;rt>=0;rt--){const wt=(Be=E.nodeHeights[rt])!=null?Be:E.averageNodeHeight.value;if(lt<=wt)return rt;lt-=wt}return 0},getEstimatedNodeHeightCount:We,buildVirtualHeightSummary:function(Xe){var nt;const Be=E.parsedNodes.value.length;return{totalNodes:Be,measuredCount:E.heightStats.count,estimatedCount:We(),averageNodeHeight:E.averageNodeHeight.value,topSpacerHeight:Xe.topSpacerHeight,bottomSpacerHeight:Xe.bottomSpacerHeight,estimatedTotalHeight:ze(0,Be),width:(nt=Xe.width)!=null?nt:E.getContainerWidth()}}}})({parsedNodes:At,nodeHeights:Nl,heightStats:fi,heightTreeSize:Sf,heightSumTree:l0,heightKnownTree:a0,averageNodeHeight:Af,heightEstimationActive:yn,estimatedNodeHeights:Dc,getContainerWidth:Io,hasCustomParagraphComponent:()=>!!bn.value.paragraph,getPrefixCacheKeyParts:()=>{var E;const j=a1(ne.value||Kt("getFallbackHeightPrefix.clientWidth",()=>{var ae;return((ae=O.value)==null?void 0:ae.clientWidth)||0})),re=((E=o.virtualScroll)==null?void 0:E.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[At.value.length,fi.count,Math.round(fi.total),Math.round(100*Af.value),re,j,yn.value?1:0,t4.value,ie.value,bn.value.paragraph?1:0]},fenwickRangeSum:qe}),et(()=>At.value.length,E=>{var j;Ot(),E<=0?io():(Ec0(j))),E!==Sf.value&&Oc(E))},{immediate:!0});const AF=R(()=>{if(!sn.value)return At.value.map((ae,be)=>({node:ae,index:be}));const E=At.value.length,j=Os(Rs.start,0,E),re=Os(Rs.end,j,E);return At.value.slice(j,re).map((ae,be)=>({node:ae,index:j+be}))}),ov=R(()=>sn.value?bo(0,Math.min(Rs.start,At.value.length)):0),sv=R(()=>{if(!sn.value)return 0;const E=At.value.length;return bo(Math.min(Rs.end,E),E)});function _6(){return Tt.buildVirtualHeightSummary({topSpacerHeight:ov.value,bottomSpacerHeight:sv.value,width:bu()})}function MF(){const E=At.value,j=_6();return rn(mt({},j),{probe:{paragraphReady:!!Y.value.paragraph,listItemReady:!!Y.value.listItem,listWrapperOverhead:Y.value.listWrapperOverhead,headingReadyLevels:Object.entries(Y.value.headings).filter(([,re])=>!!re).map(([re])=>Number(re))},nodes:E.map((re,ae)=>{var be,Ne,De,ze,ot,We,Xe,nt,Be;return{index:ae,type:re.type,estimateKind:(Ne=(be=Dc.value[ae])==null?void 0:be.kind)!=null?Ne:null,rendererKind:(ze=(De=Dc.value[ae])==null?void 0:De.rendererKind)!=null?ze:null,estimatedHeight:(We=(ot=Dc.value[ae])==null?void 0:ot.height)!=null?We:null,estimatedContentHeight:(nt=(Xe=Dc.value[ae])==null?void 0:Xe.contentHeight)!=null?nt:null,measuredHeight:(Be=Nl[ae])!=null?Be:null}})})}function iv(){return o.indexKey!=null?String(o.indexKey):co.value?`virtual-${wo()}`:"markdown-renderer"}function x6(E){const j=String(E),re=`${iv()}-`;if(!j.startsWith(re))return null;const ae=j.slice(re.length).match(/^(\d+)(?:$|-)/);if(!ae)return null;const be=Number(ae[1]);return!Number.isInteger(be)||be<0||be>=At.value.length?null:be}function wo(){var E,j,re;const ae=(E=o.virtualScroll)==null?void 0:E.sessionKey;return String(ae!=null&&ae!==""?ae:(re=(j=o.indexKey)!=null?j:T.customId)!=null?re:Co)}function ns(){var E;const j=(E=o.virtualScroll)==null?void 0:E.threadKey;return j==null||j===""?void 0:String(j)}const TF=R(()=>{var E,j,re;return(re=ns())!=null?re:String((j=(E=o.indexKey)!=null?E:T.customId)!=null?j:Co)});function rv(E){var j;return(E??"")===((j=ns())!=null?j:"")}function Ol(){var E,j,re;return j=(E=o.virtualScroll)==null?void 0:E.measurementKey,re=(function(){const ae=g.value;return(function(be){var Ne,De;const ze=be.renderer,ot=ze==="monaco"?be.codeBlockMonacoOptions:void 0,We=be.codeBlockProps,Xe=ze==="shiki";return[be.isDark?"dark":"light",ze==="monaco"?"code-rich":ze==="pre"?"code-pre":"code-shiki",be.codeBlockStream===!1?"code-static":"code-stream",xs(be.codeBlockMinWidth),xs(be.codeBlockMaxWidth),...Xe?[Gre((Ne=We?.themes)!=null?Ne:be.themes,(De=We?.langs)!=null?De:be.langs)]:[],xs(ot?.fontSize),xs(ot?.lineHeight),xs(ot?.fontFamily),xs(ot?.tabSize),xs(ot?.MAX_HEIGHT),xs(ot?.wordWrap),xs(ot?.wrappingIndent),xs(ot?.padding),xs(We?.showHeader),xs(We?.showCopyButton),xs(We?.showExpandButton),xs(We?.showPreviewButton),xs(We?.showCollapseButton),xs(We?.showFontSizeButtons)].join("\0")})({renderer:ae,isDark:T.isDark,codeBlockStream:T.codeBlockStream,codeBlockMinWidth:T.codeBlockMinWidth,codeBlockMaxWidth:T.codeBlockMaxWidth,codeBlockMonacoOptions:ae==="monaco"?T.codeBlockMonacoOptions:void 0,codeBlockProps:T.codeBlockProps,themes:ae==="shiki"?T.themes:void 0,langs:ae==="shiki"?T.langs:void 0})})(),[j==null?"":String(j),re].join("\0")}function bu(){return Io()}const y0=R(()=>a1(bu())),Yi=R(()=>[Ol(),y0.value].join("\0")),EF=R(()=>{var E;return co.value?["virtual",(E=ns())!=null?E:"",wo(),Yi.value].join("\0"):o.indexKey});function Bc(){d6.value+=1}function lv(E){return!(!E||!Number.isInteger(E.index)||E.index<0||E.index>=At.value.length||E.sessionKey!==wo()||E.threadKey!==ns()||E.layoutEpochKey!==Yi.value)}function S6(E){const j=String(E),re=sl.get(j);return re?lv(re)?re.index:null:x6(j)}function A6(E="async-node"){(Zi.size||sl.size)&&(Zi.clear(),sl.clear(),Bc(),mo(E))}const Hc=on(F3,null),av={reportHeight(E,j){if(!Ct.value)return;const re=S6(E);if(re==null)return;const ae=ol.get(re);if(!ae)return;const be=Number(j),Ne=Mf(re,ae);(function(De,ze,ot={}){an(()=>yu(De,ze,ot))})(re,Number.isFinite(be)&&be>0?Math.max(be,Ne||0):Ne)},markPending(E){if(!Ct.value)return;const j=x6(E);j!=null&&(function(re,ae){var be;const Ne=sl.get(re);if(Ne&&lv(Ne))return Zi.set(re,Math.max(0,(be=Zi.get(re))!=null?be:0)+1),Bc(),void mo("async-node");Zi.set(re,1),sl.set(re,(function(De){return{index:De,sessionKey:wo(),threadKey:ns(),layoutEpochKey:Yi.value}})(ae)),Bc(),mo("async-node")})(String(E),j)},markSettled(E){if(!Ct.value)return;const j=String(E),re=S6(E);(re!=null||(function(ae){return Zi.has(String(ae))})(j))&&(function(ae){var be;const Ne=(be=Zi.get(ae))!=null?be:0;return!(Ne<=0||(Ne<=1?(Zi.delete(ae),sl.delete(ae)):Zi.set(ae,Ne-1),Bc(),Ne===1&&mo("async-node"),0))})(j)&&re!=null&&Pl()}};function IF(){let E=0;for(const j of ol.values())E+=Kt("getVisibleDomHeight.offsetHeight",()=>{var re;return(re=j?.offsetHeight)!=null?re:0});return Math.ceil(Math.max(0,E))}En(F3,{reportHeight(E,j){av.reportHeight(E,j),Hc?.reportHeight(E,j)},markPending(E){av.markPending(E),Hc?.markPending(E)},markSettled(E){av.markSettled(E),Hc?.markSettled(E)}});let uv,cv=null,zc=null;function k0(E){return E!==!1&&E!=null&&E!==""}function M6(){return sn.value?(function(){if(!sn.value)return!0;const E=At.value.length,j=Os(Rs.start,0,E),re=Os(Rs.end,j,E);if(j>=re)return!0;for(let ae=j;ae=f0.value}function dv(){return Oe.value===!0&&!ft.value&&Y2.value===0&&pa.size===0&&Rl.size===0&&Gi==null&&M6()}function T6(){var E,j;if(((E=o.virtualScroll)==null?void 0:E.settleMode)!=="manual"||cv===wo()&&uv===ns())return!0;const re=(j=o.virtualScroll)==null?void 0:j.settledToken;return!!k0(re)&&zc===Uf(re)}function fv(){return dv()&&T6()}function LF(E,j){return j.totalNodes<=0?E==="final"?"final":"estimate":j.measuredCount>=j.totalNodes?E==="final"?"final":"measured":j.measuredCount>0||j.estimatedCount>0?"mixed":"estimate"}function Cu(E="manual",j){const re=_6(),ae=(function(be){return be||(Oe.value!==!0?At.value.length>0?"streaming":"estimating":!M6()||Rl.size>0||Gi!=null?"measuring":fv()?"settled":"settling")})(j);return{sessionKey:wo(),threadKey:ns(),phase:ae,nodeCount:re.totalNodes,liveRange:{start:Rs.start,end:Rs.end},renderedCount:Le.value,measuredCount:re.measuredCount,estimatedCount:re.estimatedCount,averageNodeHeight:re.averageNodeHeight,topSpacerHeight:re.topSpacerHeight,bottomSpacerHeight:re.bottomSpacerHeight,visibleDomHeight:IF(),totalHeight:E6(),width:re.width,final:Oe.value===!0,stable:fv(),confidence:LF(ae,re),reason:E}}function If(){const E=ut.value||ue(),j=O.value;if(!E||!j)return null;const re=E.ownerDocument||j.ownerDocument||document,ae=E===re.documentElement||E===re.body||E===re.scrollingElement,be=Kt("getScrollBox.scrollTop",()=>Ue(E,re,ae)),Ne=Kt("getScrollBox.scrollHeight",()=>{var ze,ot,We,Xe,nt;return ae?Math.max((ot=(ze=re.documentElement)==null?void 0:ze.scrollHeight)!=null?ot:0,(Xe=(We=re.body)==null?void 0:We.scrollHeight)!=null?Xe:0,(nt=E.scrollHeight)!=null?nt:0):E.scrollHeight}),De=Kt("getScrollBox.clientHeight",()=>{var ze;return ae?((ze=re.documentElement)==null?void 0:ze.clientHeight)||E.clientHeight||0:E.clientHeight});return{root:E,doc:re,isViewportRoot:ae,scrollTop:be,scrollHeight:Ne,clientHeight:De}}function E6(){const E=At.value.length,j=Math.max(0,bo(0,E)),re=Kt("getRendererLogicalHeight.offsetHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.offsetHeight)!=null?Ne:0}),ae=Math.max(0,re>0?re:Kt("getRendererLogicalHeight.scrollHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.scrollHeight)!=null?Ne:0}));return E<=0?Math.ceil(re):sn.value?j>0?Math.max(1,Math.ceil(j),(function(){let be=ov.value+sv.value;for(const Ne of fo.values())Ne&&(be+=Math.max(0,Kt("getVirtualizedDomLogicalHeight.offsetHeight",()=>Ne.offsetHeight||0)));return Math.ceil(Math.max(0,be))})(),(function(be,Ne){return be<=0||Ne<=0?0:Ne<=be+Math.max(512,.05*be)?Math.ceil(Ne):0})(j,ae)):Math.max(1,Math.ceil(ae)):Ct.value?j>0||fi.count>0||Tt.getEstimatedNodeHeightCount()>0?(gt.value&&Le.value,Math.max(1,Math.ceil(ae),Math.ceil(j))):Math.ceil(ae):Math.max(1,Math.ceil(ae),Math.ceil(j))}function I6(E){const j=O.value;if(!j)return null;const re=Kt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>j.getBoundingClientRect());return(function(be){return be.isViewportRoot?be.clientHeight:Kt("getViewportBottomInRoot.getBoundingClientRect",()=>be.root.getBoundingClientRect().bottom)})(E)-re.bottom}function $F(E={}){const j=E.requireViewport!==!1,re=(function(Ne=64){const De=If(),ze=O.value;if(!De||!ze)return!1;const ot=(function(Xe){if(Xe.isViewportRoot)return{top:0,bottom:Xe.clientHeight};const nt=Kt("getVirtualViewportRect.getBoundingClientRect",()=>Xe.root.getBoundingClientRect());return{top:nt.top,bottom:nt.bottom}})(De),We=Kt("isRendererNearVirtualViewport.getBoundingClientRect",()=>ze.getBoundingClientRect());return We.bottom>=ot.top-Ne&&We.top<=ot.bottom+Ne})();if(j&&!re)return null;const ae=(function(){const Ne=If(),De=O.value;if(!Ne||!De||Math.max(0,Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight)>64)return null;const ze=I6(Ne);return ze==null?null:ze>=-8&&ze<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,ze)}:null})();if(ae)return{anchor:ae,captured:!0};const be=Fc();if(be)return{anchor:{type:"node",nodeIndex:be.nodeIndex,offsetWithinNodePx:be.offsetWithinNodePx},captured:re};if(E.allowFallback===!0){const Ne=(function(){const De=At.value.length;return De<=0?null:{type:"node",nodeIndex:Os(Fl.value,0,Math.max(0,De-1)),offsetWithinNodePx:0}})();return Ne?{anchor:Ne,captured:!1}:null}return null}function pv(E){let j=2166136261;for(let re=0;re>>0).toString(36)}function NF(E,j){let re=E;for(let ae=0;ae8192?`${ae.slice(0,8192)}...${ae.length}`:ae;return`${ae.length}:${pv(be)}`})(E)}`;if(typeof E=="function")return"fn";if(typeof E!="object")return typeof E;if(j.has(E))return"cycle";if(re>=6)return"max-depth";j.add(E);try{if(Array.isArray(E)){if(E.length<=160){const We=[];for(let Xe=0;Xe=ze&&De.push(Xe)}return[`a:${E.length}`,`h=${Ne.join(",")}`,`t=${De.join(",")}`,`all=${(ot>>>0).toString(36)}`].join(":")}const ae=E,be=Object.keys(ae).filter(Ne=>{const De=ae[Ne];return Ne!=="parent"&&Ne!=="el"&&Ne!=="component"&&(De==null||typeof De=="string"||typeof De=="number"||typeof De=="boolean"||FF.has(Ne))}).sort();return`o:${be.length}:${be.map(Ne=>`${Ne}=${b0(ae[Ne],j,re+1)}`).join(";")}`}finally{j.delete(E)}}let hv=-1,mv="",wu=[2166136261];function Lf(E){const j=At.value[E];return j?pv(b0(j)):""}function RF(E,j){let re=E;for(let ae=0;ae>>0}function gv(){var E,j;const re=ie.value;if(hv===re)return mv;const ae=At.value.length;let be=ev(ae);(hv!==re-1||be>ae||wu.length>>0).toString(36),hv=re,mv}function Wc(E,j={}){var re;const ae=j.includeHeightCache===!0,be=(re=j.includeContentHash)!=null?re:ae,Ne=ae?(function(ze){const ot=(function(){var rt,wt;const dt=Number((wt=(rt=o.virtualScroll)==null?void 0:rt.heightCacheLimit)!=null?wt:5e3);return!Number.isFinite(dt)||dt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(dt))})();if(!Number.isFinite(ot)||ze.length<=ot)return ze;const We=new Map,Xe=rt=>{!rt||We.size>=ot||We.set(rt.index,rt)},nt=At.value.length,Be=Os(Rs.start-2*Wo.value,0,nt),Je=Os(Rs.end+2*Wo.value,Be,nt);for(const rt of ze)rt.index>=Be&&rt.index=0&&We.sizert.index-wt.index).slice(0,ot)})(ye().map(ze=>{var ot;const We=At.value[ze.index];return We?rn(mt({},ze),{nodeType:String((ot=We.type)!=null?ot:""),signature:Lf(ze.index)}):null}).filter(ze=>!!ze)):[],De=$F({allowFallback:j.allowAnchorFallback===!0,requireViewport:j.requireViewport});return De||Ne.length||j.includeEmptyState===!0?rn(mt({sessionKey:E.sessionKey,threadKey:E.threadKey},De?{anchor:De.anchor,anchorCaptured:De.captured}:{anchorCaptured:!1}),{metrics:E,width:E.width,contentHash:be?gv():void 0,measurementKey:Ol()||void 0,heightCache:Ne.length?Ne:void 0}):null}function vv(E){var j,re;const ae=If();if(!ae)return;const be=(function(ze){const ot=O.value;if(!ot)return null;const We=_e(ot,ze.root),Xe=At.value.length,nt=Kt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>ot.offsetHeight||0),Be=Math.max(0,nt>0?nt:Xe>0?Kt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>ot.scrollHeight||0):0),Je=E6();return We+Math.max(Be,Je)})(ae);if(be==null)return;const Ne=Math.max(0,E.distanceFromBottomPx),De=Math.max(0,be-ae.clientHeight-Ne);(function(ze){so=Of()+120,Rt=ze})(De),ae.isViewportRoot?(re=(j=ae.doc.defaultView)==null?void 0:j.scrollTo)==null||re.call(j,0,De):k_(ae.root,ae.doc,De,{isReverseFlexScrollRoot:Se,getNormalizedScrollTop:Ue})}const yv=[];function L6(){if(G)for(ln!=null&&(Vo?.(ln),ln=null);yv.length;){const E=yv.pop();E!=null&&window.clearTimeout(E)}}function Uc(E){const j=!!Pt.value;Pt.value=null,so=0,Rt=null,L6(),j&&E&&mo(E)}function jc(){if(!Pt.value||!G||ln!=null)return;const E=()=>{ln=null;const j=Pt.value;j&&vv(j)};ln=jo?jo(E):null,ln==null&&E()}function $6(E,j={}){const re=At.value.length;return re<=0?[]:E.filter(ae=>!(!Number.isInteger(ae.index)||ae.index<0||ae.index>=re)&&!(!Number.isFinite(ae.height)||ae.height<=0)&&!(j.requireSignature&&!ae.signature)&&!(j.requireCompatibilityMetadata&&!ae.nodeType&&!ae.signature)&&(function(be){var Ne;const De=At.value[be.index];return!(!De||be.nodeType&&be.nodeType!==String((Ne=De.type)!=null?Ne:"")||be.signature&&be.signature!==Lf(be.index))})(ae))}function N6(E){const j=a1(bu()),re=a1(E);return j!==-1&&re!==-1&&j===re}function kv(E){var j;const re=Number(E?.width);if(Number.isFinite(re)&&re>0)return re;const ae=Number((j=E?.metrics)==null?void 0:j.width);return Number.isFinite(ae)&&ae>0?ae:null}function F6(E){var j;return E.sessionKey===wo()&&!!rv(E.threadKey)&&((j=E.measurementKey)!=null?j:"")===Ol()&&!!N6(kv(E))&&!!(function(re){const ae=re.heightCache;return!!ae?.length&&(R6(re)?ae.some(be=>!!(be.nodeType||be.signature)):ae.some(be=>!!be.signature))})(E)}function R6(E){return!!(E.contentHash&&E.contentHash===gv())}function OF(E){return!R6(E)}let _u=null,xu=null,C0=null,$f=null,Nf=null;function bv(E){var j;const re=E.map(be=>{var Ne,De;return[be.index,Math.round(10*be.height),(Ne=be.nodeType)!=null?Ne:"",(De=be.signature)!=null?De:""].join("")}).join(""),ae=a1(bu());return[(j=ns())!=null?j:"",wo(),Ol(),At.value.length,ae,E.length,pv(re)].join(":")}function O6(E=(j=>(j=o.virtualScroll)==null?void 0:j.heightCache)()){if(!Ct.value||!E?.length||At.value.length<=0||!N6((j=o.virtualScroll)==null?void 0:j.heightCacheWidth))return!1;var j;const re=$6(E,{requireSignature:!0});if(!re.length)return!1;const ae=bv(re);return ae===_u?(xu="standalone",!0):(r6(re,{mode:"merge"}),Ot(),_u=ae,xu="standalone",Df(),mo("restore"),!0)}function Cv(E,j={}){var re,ae,be;if(!Ct.value||!E||E.sessionKey!==wo()||!rv(E.threadKey)||At.value.length<=0)return!1;const Ne=!!((re=E.heightCache)!=null&&re.length)&&!w0(),De=!E.anchor||E.anchorCaptured===!1&&j.allowUncapturedAnchor!==!0?null:E.anchor,ze=j.restoreAnchor===!0&&!!De&&!w0()&&Number(kv(E))>0;let ot=!1;if((ae=E.heightCache)!=null&&ae.length&&F6(E)){const Xe=$6(E.heightCache,{requireCompatibilityMetadata:!E.contentHash,requireSignature:OF(E)});Xe.length&&(r6(Xe,{mode:"merge"}),Ot(),_u=bv(Xe),xu="restore",Df(),ot=!0)}if(Ne||ze)return!1;if(!j.restoreAnchor||!De)return ot&&mo("restore"),!0;const We=(function(Xe,nt){var Be;const Je=Xe.anchor,lt=Je?Je.type==="bottom"?`bottom:${Math.round(Je.distanceFromBottomPx)}`:`node:${Je.nodeIndex}:${Math.round(Je.offsetWithinNodePx)}`:"none";return[(Be=ns())!=null?Be:"",wo(),Ol(),y0.value,nt,lt].join(":")})(E,(be=j.restoreToken)!=null?be:"imperative");return C0===We?(ot&&mo("restore"),!0):(C0=We,(function(Xe){const nt=()=>{if(Xe.type==="node")return Uc(),void Rc({nodeIndex:Xe.nodeIndex,offsetWithinNodePx:Xe.offsetWithinNodePx});if(Nc(),Ns.value=null,Pt.value=Xe,L6(),vv(Xe),G)for(const Be of[0,120,280,480])yv.push(window.setTimeout(()=>{const Je=Pt.value;Je&&vv(Je)},Be))};(function(Be){if(!sn.value)return!1;const Je=At.value.length;return!(Je<=0||(Fl.value=Be.type==="node"?Os(Be.nodeIndex,0,Je-1):Je-1,Tf(),0))})(Xe)?yt(nt):nt()})(De),mo("restore"),!0)}function w0(){const E=bu();return Number.isFinite(E)&&E>0}function P6(E){var j;return E.sessionKey===wo()&&!!rv(E.threadKey)&&(At.value.length<=0||!(!((j=E.heightCache)!=null&&j.length)||w0())||!(!(E.anchor&&Number(kv(E))>0)||w0()))}function wv(){qo.clear();for(const E of Object.keys(Nl)){const j=Number(E);Number.isInteger(j)&&j>=0&&j{let j=!1,re=null;const ae=()=>{j||(j=!0,re!=null&&window.clearTimeout(re),E())};if(jo)return jo(ae),void(re=window.setTimeout(ae,50));re=window.setTimeout(ae,0)})}function _v(E,j=ns(),re=Yi.value){return wo()===E&&ns()===j&&Yi.value===re}function xv(){return vo(this,arguments,function*(E={}){var j,re,ae,be,Ne;const De=wo(),ze=ns(),ot=Yi.value,We=(j=E.frames)!=null?j:2,Xe=(re=E.timeoutMs)!=null?re:120,nt=(ae=E.reason)!=null?ae:"manual",Be=E.expectedSettledTokenKey,Je=E.flushPendingTimers===!0,lt=Cu(nt),rt=()=>rn(mt({},lt),{phase:lt.final?"settling":lt.phase,stable:!1,confidence:lt.confidence==="final"?"mixed":lt.confidence,reason:nt}),wt=()=>_v(De,ze,ot)&&(Be==null||Pf()===Be);for(let qt=0;qtwindow.setTimeout(Ut,qt))})(Xe),!wt()||(Je&&p6(),Pl(),Ff(),!wt()))return rt();const dt=dv();dt&&(cv=De,uv=ze,((be=o.virtualScroll)==null?void 0:be.settleMode)==="manual"&&Be!=null&&k0((Ne=o.virtualScroll)==null?void 0:Ne.settledToken)&&Pf()===Be&&(zc=Uf(o.virtualScroll.settledToken)));const Nt=wt()&&dt&&T6(),Dt=Cu(nt,Nt?"final":void 0);return Ev(Dt,!0),Dt})}let Sv="content",Su=null,Au=null,Av=0,Rf=null,Vc=null,Mv=null,Tv=null;function Of(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function B6(E){var j,re;const ae=Rf;if(!ae)return!0;const be=(re=(j=o.virtualScroll)==null?void 0:j.heightDiffThresholdPx)!=null?re:1;return Math.abs(E.totalHeight-ae.totalHeight)>be||E.sessionKey!==ae.sessionKey||E.phase!==ae.phase||E.stable!==ae.stable||E.final!==ae.final||E.threadKey!==ae.threadKey||E.nodeCount!==ae.nodeCount||E.measuredCount!==ae.measuredCount||E.width!==ae.width}function Pf(E=(j=>(j=o.virtualScroll)==null?void 0:j.settledToken)()){return xs(E)}function H6(E,j){var re,ae;return[E,j.sessionKey,(re=j.threadKey)!=null?re:"",Ol(),gv(),xs((ae=o.virtualScroll)==null?void 0:ae.settledToken),Math.round(j.totalHeight),Math.round(j.width)].join("\0")}function Df(){Mv=null,Tv=null,Vc=null}function PF(E){const j=E.heightCache;return j?.length?bv(j):""}function Bf(E){var j,re,ae;const be=E.metrics,Ne=E.anchor?(De=E.anchor).type==="bottom"?`bottom:${Math.round(De.distanceFromBottomPx)}`:`node:${De.nodeIndex}:${Math.round(De.offsetWithinNodePx)}`:"none";var De;return[E.sessionKey,(j=E.threadKey)!=null?j:"",(re=E.measurementKey)!=null?re:Ol(),(ae=E.contentHash)!=null?ae:"",PF(E),Ne,E.anchorCaptured?1:0,be.liveRange.start,be.liveRange.end,be.renderedCount,be.nodeCount,Math.round(be.totalHeight),Math.round(be.width),be.phase,be.stable?1:0].join("\0")}function Ev(E,j=!1){if(!Ct.value||(function(De=!1){return!De&&co.value&&!en.value})(j))return;const re=j||B6(E),ae=(function(De,ze=!1){return ze||De.stable||De.phase==="final"?{state:Wc(De,{includeHeightCache:!0})}:{state:Wc(De)}})(E,j),be=ae.state,Ne=!!(be&&(re||(function(De,ze=!1){return!!ze||Bf(De)!==Vc})(be,j)));if(re&&(L(E),Rf=E,Av=Of()),be&&Ne&&(B(be),be.anchor&&H(be.anchor),Vc=Bf(be)),E.stable){const De=H6("settled",E);if(De!==Mv){Mv=De;const ze=Wc(E,{includeHeightCache:!0});ze&&(B(ze),Vc=Bf(ze)),(function(ot){s("render-settled",ot)})(E)}}if(E.phase==="final"){const De=H6("final",E);if(De!==Tv){Tv=De;const ze=Wc(E,{includeHeightCache:!0});ze&&(B(ze),Vc=Bf(ze)),(function(ot){s("render-final",ot)})(E)}}}function Iv(){Su!=null&&(Vo?.(Su),Su=null),Au!=null&&G&&(window.clearTimeout(Au),Au=null)}function z6(){Su=null,Au=null,(function(E){if(Rl.size>0||Gi!=null)return!0;switch(E){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(Sv)&&(Pl(),Ff()),Ev(Cu(Sv))}function mo(E){var j,re;if(!Ct.value||(Sv=E,Su!=null||Au!=null))return;const ae=Math.max(0,(re=(j=o.virtualScroll)==null?void 0:j.emitIntervalMs)!=null?re:32),be=Math.max(0,ae-(Of()-Av)),Ne=()=>{Au=null,Su=jo?jo(z6):null,Su==null&&z6()};G&&be>0?Au=window.setTimeout(Ne,be):Ne()}function W6(){He.value+=1}function _0(E){if(gt.value&&E>=Le.value){const j=At.value[E],re=Fe.value===!0&&Oe.value!==!0&&E>=At.value.length-2,ae=j?.type==="code_block"||j?.type==="image"||j?.type==="mermaid"||j?.type==="infographic";if(!re||ae)return!1}return!nl.value||E=pe.value&&(q.value||(q.value=!0,Q2()),!l6.value||!Ys))return qc(E),void(j&&ha(E,!0));if(E{if(h6.delete(Ne),!nl.value||J2.value.has(Ne))return;const ot=fo.get(Ne);if(!ot)return;const We=ue(ot),Xe=ot.ownerDocument||document,nt=Xe.defaultView||window,Be=!We||We===Xe.documentElement||We===Xe.body,Je=!Be&&We?Kt("nodeVisibilityFallback.root.getBoundingClientRect",()=>We.getBoundingClientRect()):null,lt=Be?0:Je.top,rt=Be?Kt("nodeVisibilityFallback.clientHeight",()=>{var dt,Nt;return(Nt=(dt=nt.innerHeight)!=null?dt:We?.clientHeight)!=null?Nt:0}):Je.bottom,wt=Kt("nodeVisibilityFallback.node.getBoundingClientRect",()=>ot.getBoundingClientRect());wt.bottom>=lt-500&&wt.top<=rt+500&&ha(Ne,!0)},1800+De);h6.set(Ne,ze)})(E);let be=null;be=et(()=>ae.isVisible.value,Ne=>{if(Ne){g0(E),ha(E,!0),be?.(),m0.delete(E),Pc.get(E)===ae&&Pc.delete(E);try{ae.destroy()}catch{}}},{immediate:!0}),m0.set(E,be),sn.value&&Lr()}function Lv(){Gi=null,an(()=>{let E=!1;for(const[j,re]of Rl)Rl.delete(j),ol.get(j)===re.el&&ku.get(j)===re.version&&(E=yu(j,re.height,{allowShrink:re.allowShrink})||E);return E})}function Kc(){Gi!=null&&(Vo?.(Gi),Gi=null),Rl.clear()}function S0(E,j){(function(re,ae,be){var Ne;if(!Number.isFinite(be)||be<=0||ol.get(re)!==ae)return;const De=ku.get(re);if(De==null)return;const ze=At.value[re],ot=ft.value&&Oe.value!==!0&&!((Ne=o.nodes)!=null&&Ne.length)&&re>=At.value.length-2,We=!(ze?.loading===!0||ot),Xe=Rl.get(re),nt=Xe?Xe.allowShrink&&We:We,Be=Xe&&!nt?Math.max(Xe.height,be):be;Rl.set(re,{height:Be,allowShrink:nt,version:De,el:ae}),Gi==null&&(Gi=jo?jo(Lv):null,Gi==null&&Lv())})(E,j,Mf(E,j))}function Pl(){for(const[E,j]of ol)j&&S0(E,j)}function U6(){ci?.disconnect(),ci=null,Ki.clear()}function $v(){for(;d0.length;)h0(d0.pop())}et(en,E=>{E&&mo("content")},{flush:"post"}),t({getVirtualMetrics:Cu,captureVirtualState:function(E={}){var j;return Wc(Cu("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:E.allowFallbackAnchor===!0,requireViewport:E.requireViewport===!0,includeEmptyState:(j=E.includeEmptyState)==null||j})},restoreVirtualState:function(E,j={}){const re=j.restoreAnchor===!0,ae=j.restoreToken==null?"imperative":String(j.restoreToken);$f=E,Nf={restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:j.allowUncapturedAnchor===!0},!Cv(E,{restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:j.allowUncapturedAnchor===!0})&&P6(E)||($f=null,Nf=null)},forceMeasure:function(E="manual"){return vo(this,null,function*(){yield yt(),yield D6(),Pl(),Ff(),yield yt();const j=Cu(E);return Ev(j,!0),j})},settle:xv,scrollToNode:function(E,j="start"){Uc(),Nc();const re=At.value.length;if(re<=0)return;const ae=Os(E,0,re-1),be=()=>{var Ne;const De=V2({nodeIndex:ae,offsetWithinNodePx:0}),ze=Zn(ae),ot=If(),We=(Ne=ot?.clientHeight)!=null?Ne:0,Xe=Js();let nt=De;if(j==="center")nt=De-We/2+ze/2;else if(j==="end")nt=De-We+ze;else if(j==="nearest"&&Xe!=null){if(De>=Xe&&De+ze<=Xe+We)return;nt=Dews.value,E=>{if(!E){U6();for(const j of fa.values())for(const re of j)h0(re);fa.clear(),ku.clear(),$v(),Kc()}},{immediate:!0}),et(Oe,E=>{E&&(function(){if(G&&Oe.value&&ol.size){$v();for(const j of[80,240,640]){const re=f6(j,()=>{for(const[ae,be]of ol)be&&S0(ae,be)},"final");re!=null&&d0.push(re)}}})(),mo(E?"final":"content")});const DF=b_(()=>mo("content"),16),BF=b_(()=>mo("batch"),16);et([()=>At.value.length,()=>Le.value],()=>{Pt.value&&jc(),DF()},{flush:"post",immediate:!0}),et([()=>Rs.start,()=>Rs.end],()=>{BF()},{flush:"post"});const{cleanupBatchScheduler:HF}=(function(E){const{props:j,isClient:re,isTestEnv:ae,parsedNodesIdentity:be,parsedNodeCount:Ne,desiredRenderedCount:De,datasetKey:ze,batchingEnabled:ot,incrementalRenderingActive:We,resolvedBatchSize:Xe,resolvedInitialBatch:nt,renderedCount:Be,adaptiveBatchSize:Je,previousRenderContext:lt,previousBatchConfig:rt,requestFrame:wt,cancelFrame:dt,hasIdleCallback:Nt,cleanupNodeVisibility:Dt,onDatasetKeyChanged:qt,onDatasetChanged:Ut}=E;let Zt=null,pn="raf",vn=null,Jn=0,Ps=!1,_s=!1;const $r=new Set,il=new Set;function Zf(){if(re){Zt!=null&&(pn==="raf"&&dt?dt(Zt):pn==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Zt):pn==="timeout"&&window.clearTimeout(Zt),Zt=null),Jn+=1;for(const Qs of $r)dt&&dt(Qs);for(const Qs of il)window.clearTimeout(Qs);$r.clear(),il.clear(),vn=null,Ps=!1,_s=!1}}function F0(){return typeof performance<"u"?performance.now():Date.now()}function l7(Qs){(function(Dl){var ga;if(!We.value)return;const Bl=Math.max(2,(ga=j.renderBatchBudgetMs)!=null?ga:6),Hl=Math.max(1,Xe.value||1),Nr=Math.max(1,Math.floor(Hl/4));Dl>1.5*Bl?Je.value=Math.max(Nr,Math.floor(.8*Je.value)):Dl<.6*Bl&&Je.value=Bl)return;const Hl=Math.max(1,Qs),Nr=()=>{const Yc=F0();Zt=null;const Gf=vn??Hl;vn=null;const Xc=F0();Be.value=Math.min(Bl,Be.value+Gf),Dt(Be.value),(function(Bv,R0){if(!re)return void l7(R0);Ps=!0;const d7=++Jn;yt().then(()=>{var f7;if(d7!==Jn)return;const lR=F0(),aR=Math.max(R0,lR-Bv),p7=()=>{d7===Jn&&l7(aR)};if(wt){let Tu=null,Jc=null,m7=!1;const g7=()=>{m7||(m7=!0,Tu!==null&&($r.delete(Tu),Tu=null),Jc!==null&&(il.delete(Jc),window.clearTimeout(Jc),Jc=null),p7())};return Tu=wt(()=>{g7()}),$r.add(Tu),Jc=window.setTimeout(()=>{Tu!==null&&dt&&dt(Tu),g7()},Math.max(32,(f7=j.renderBatchIdleTimeoutMs)!=null?f7:120)),void il.add(Jc)}const h7=window.setTimeout(()=>{il.delete(h7),p7()},0);il.add(h7)})})(Yc,F0()-Xc)};if(!re||Ei.immediate)return void Nr();const va=Math.max(0,(Dl=j.renderBatchDelay)!=null?Dl:16);if(vn=vn!=null?Math.max(vn,Hl):Hl,Zt==null){if(!ae&&Nt&&window.requestIdleCallback){const Yc=Math.max(0,(ga=j.renderBatchIdleTimeoutMs)!=null?ga:120);return pn="idle",void(Zt=window.requestIdleCallback(()=>Nr(),{timeout:Yc}))}if(wt&&!ae)return pn="raf",void(Zt=wt(()=>{va===0?Nr():(pn="timeout",Zt=window.setTimeout(()=>Nr(),va))}));pn="timeout",Zt=window.setTimeout(()=>Nr(),va)}}function u7(Qs,Ei={}){Ps?_s=!0:Qs==null?c7():a7(Qs,Ei)}function c7(){We.value&&a7(ot.value?Math.max(1,Math.round(Je.value)):Math.max(1,Xe.value))}return et([be,Ne,ze,We,Xe,nt,()=>j.renderBatchDelay],()=>{var Qs;const Ei=Ne.value,Dl=lt.value,ga=ze.value,Bl=!Object.is(ga,Dl.key),Hl=Ei!==Dl.total,Nr=Bl||Hl;lt.value={key:ga,total:Ei};const va=rt.value,Yc=(Qs=j.renderBatchDelay)!=null?Qs:16,Gf=va.batchSize!==Xe.value||va.initial!==nt.value||va.delay!==Yc||va.enabled!==We.value;rt.value={batchSize:Xe.value,initial:nt.value,delay:Yc,enabled:We.value},Bl&&qt(Ei),(Nr||Gf||!We.value)&&Zf(),(Nr||Gf)&&(Je.value=Math.max(1,Xe.value||1)),Nr&&Ut();const Xc=De.value;if(!Ei)return Be.value=0,void Dt(0);if(!We.value)return Be.value=Xc,void Dt(Be.value);const Bv=Bl||Dl.total===0;Be.value=Bv||Gf?Math.min(Xc,nt.value):Math.min(Be.value,Xc);const R0=Math.max(1,nt.value||Xe.value||Ei);Be.value{We.value&&(typeof Ei=="number"&&Qs<=Ei||Qs>Be.value&&u7())}),{cleanupBatchScheduler:Zf}})({props:T,isClient:G,isTestEnv:cr,parsedNodesIdentity:ai,parsedNodeCount:Tn,desiredRenderedCount:f0,datasetKey:EF,batchingEnabled:qi,incrementalRenderingActive:gt,resolvedBatchSize:ho,resolvedInitialBatch:ko,renderedCount:Le,adaptiveBatchSize:Xt,previousRenderContext:Ge,previousBatchConfig:hs,requestFrame:jo,cancelFrame:Vo,hasIdleCallback:Il,cleanupNodeVisibility:_F,onDatasetKeyChanged:E=>{Kc(),io(),Ot(),Df(),E>0&&Oc(E)},onDatasetChanged:()=>{sn.value&&Lr({immediate:!0})}});et([a6,sn,()=>O.value,()=>oe()],([E,j])=>{if(!E)return m6(),void X2();xF(),j?Lr({immediate:!0}):X2()},{flush:"post",immediate:!0}),et([()=>At.value.length,()=>sn.value],E=>vo(null,[E],function*([j,re]){re&&j&&G&&(yield yt(),Lr({immediate:!0}))}),{flush:"post"}),et(yn,E=>{E&&(function(){var j;if(no.value&&Ks.value&&ps.value&&((j=ui.value)!=null&&j[1]))return;const re=kt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),ae=kt({type:"list_item",children:[re],raw:"- Probe paragraph text"}),be=kt({type:"list",ordered:!1,items:[ae],raw:"- Probe paragraph text"});no.value=re,Ks.value=ae,ps.value=be;const Ne={1:null,2:null,3:null,4:null,5:null,6:null};for(let De=1;De<=6;De++)Ne[De]=kt({type:"heading",level:De,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(De)} Probe heading`});ui.value=Ne})()},{immediate:!0}),et([()=>O.value,yn],()=>{if(!yn.value)return nv(),void(ne.value=0);v6(),nv(),yn.value&&O.value&&typeof ResizeObserver<"u"&&(Ef=new ResizeObserver(()=>{v6(),Ns.value&&vu(),Pt.value&&jc(),mo("resize")}),Ef.observe(O.value))},{immediate:!0}),et([yn,Zs,Yi],()=>vo(null,null,function*(){if(!yn.value)return Y.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Ot();yield yt(),(function(){if(!yn.value||typeof window>"u")return Y.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Ot();const E={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},j=g6(tv(F.value),".paragraph-node");E.paragraph=i4(F.value,j,"pre-wrap");const re=tv(W.value),ae=re?.querySelector(".paragraph-node");E.listItem=i4(W.value,ae,"pre-wrap");const be=Kt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var De,ze;return(ze=(De=z.value)==null?void 0:De.offsetHeight)!=null?ze:0}),Ne=Kt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var De,ze;return(ze=(De=W.value)==null?void 0:De.offsetHeight)!=null?ze:0});E.listWrapperOverhead=Math.max(0,be-Ne);for(let De=1;De<=6;De++){const ze=g6(tv(U[De]),`h${De}`);E.headings[De]=i4(U[De],ze,"pre-wrap")}Y.value=E,Ot()})()}),{flush:"post",immediate:!0}),et(()=>At.value.length,()=>{sn.value&&Lr({immediate:!0})}),et([yn,ne],()=>{Ot(),sn.value&&Lr({immediate:!0}),Ns.value&&vu(),Pt.value&&jc(),mo("resize")},{immediate:!1}),et(()=>nl.value,E=>{if(E)for(const[j,re]of fo)x0(j,re);else if(Q2(),sn.value)Lr({immediate:!0});else for(const[j,re]of fo)re&&ha(j,!0)},{immediate:!1}),et([he,pe,()=>oe()],()=>{var E;(E=Ys.refresh)==null||E.call(Ys);for(const[j,re]of fo)x0(j,re)},{immediate:!1}),et([()=>T.viewportPriority,()=>At.value.length,pe],([E,j,re])=>{if(E!==!1){if(q.value&&(j<=200||j<=re)){q.value=!1;for(const[ae,be]of fo)x0(ae,be)}}else q.value=!1}),et(()=>Le.value,()=>{sn.value&&Lr({immediate:!0})}),et([Fl,Lo,Wo,()=>At.value.length,sn],()=>{Tf()},{immediate:!0});let Hf=null,zf=!1,Zc=null;function Wf(){Hf=null,cv=null,uv=void 0,zc=null,Df()}function Nv(){Kc(),io(),Ot(),qo.clear();const E=At.value.length;E>0&&Oc(E),wv()}function Fv(){Iv(),p6(),Rf=null,_u=null,xu=null,C0=null,$f=null,Nf=null,zf=!1,Wf(),A6("restore"),Nc(),Uc()}function Uf(E){var j;return[(j=ns())!=null?j:"",wo(),Ol(),y0.value,Pf(E),At.value.length,Math.round(bo(0,At.value.length)),Math.round(bu()),fi.count,Math.round(fi.total)].join(":")}function j6(){return vo(this,null,function*(){var E,j,re,ae;const be=(E=o.virtualScroll)==null?void 0:E.settledToken,Ne=Pf(be),De=wo(),ze=ns(),ot=Yi.value;if(Ct.value&&((j=o.virtualScroll)==null?void 0:j.settleMode)==="manual"&&k0(be))if(dv()){if(Uf(be)!==zc&&!zf){zf=!0;try{const We=yield xv({reason:"manual",expectedSettledTokenKey:Ne}),Xe=Pf()===Ne;_v(De,ze,ot)&&We.sessionKey===De&&We.threadKey===ze&&Xe&&We.stable&&We.phase==="final"&&(zc=Uf((re=o.virtualScroll)==null?void 0:re.settledToken))}finally{zf=!1,yield yt();const We=(ae=o.virtualScroll)==null?void 0:ae.settledToken,Xe=k0(We)?Uf(We):"";_v(De,ze,ot)&&Xe&&zc!==Xe&&j6()}}}else mo("manual")})}et(Ct,(E,j)=>{if(E!==j){if(!E)return Fv(),void Iv();Fv(),Nv(),Zc=Yi.value,mo("content")}},{flush:"post"}),et([Ct,Yi],([E,j])=>{E?Zc!=null?Zc!==j&&(Zc=j,(function(re="resize"){Kc(),io(),Ot(),qo.clear();const ae=At.value.length;ae>0&&Oc(ae),wv(),_u=null,xu=null,C0=null,Rf=null,zf=!1,Wf(),O6(),yt(()=>{Pl(),Ns.value&&vu(),Pt.value&&jc(),mo(re)})})("resize")):Zc=j:Zc=null},{flush:"post",immediate:!0}),et([Ct,()=>wo(),()=>ns()],([E])=>{E&&(Fv(),Nv(),A6("content"),mo("content"))}),et([Ct,()=>wo(),()=>ns(),Yi,()=>At.value.length],([E])=>{E&&(function(j="async-node"){let re=!1;for(const[ae,be]of Array.from(sl.entries()))lv(be)||(sl.delete(ae),Zi.delete(ae),re=!0);re&&(Bc(),mo(j))})("async-node")},{flush:"post"}),et([Ct,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.sessionKey},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.measurementKey},()=>o.indexKey,()=>ie.value],([E])=>{E&&(Df(),(function(j="content"){if(!Ct.value)return;const re=[],ae=At.value.length,be=ev(ae);for(const Ne of Array.from(qo.keys())){if(Ne>=ae){re.push(Ne);continue}if(Ne=ae&&qo.delete(Ne);re.length&&((function(Ne,De={}){const ze=Array.from(Ne,Number);Jt(ze);let ot=0;if(an(()=>(ot=Z2(ze,De),ot>0)),ot>0)(function(We){for(const Xe of We)qo.delete(Xe)})(ze);else for(const We of ze)J.delete(We)})(re,{notify:!1}),Ot(),Wf(),Ns.value&&vu(),Pt.value&&jc(),mo(j))})("content"))},{flush:"post",immediate:!0}),et([Ct,()=>At.value.length,()=>wo(),()=>ns()],([E,j,re,ae],[be,Ne,De,ze])=>{E&&be&&re===De&&ae===ze&&j!==Ne&&Wf()},{flush:"post"}),et([Ct,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.heightCache},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.heightCacheWidth},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.restoreState},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.measurementKey},()=>At.value.length,()=>wo(),ne],()=>{O6()},{flush:"post",immediate:!0}),et([Ct,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.restoreState},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.restoreAnchor},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.measurementKey},()=>At.value.length,()=>wo(),ne],E=>vo(null,[E],function*([j,re]){if(!j||!re)return;yield yt();const ae=(function(){var be;const Ne=(be=o.virtualScroll)==null?void 0:be.restoreAnchor;return Ne==null||Ne===!1?null:Ne===!0?"true":String(Ne)})();Cv(re,{restoreAnchor:ae!=null,restoreToken:ae??void 0})}),{flush:"post",immediate:!0}),et([Ct,ne,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.restoreState},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.measurementKey}],([E])=>{var j;if(!E)return;const re=(j=o.virtualScroll)==null?void 0:j.restoreState;re&&_u&&xu==="restore"&&(F6(re)||(Nv(),_u=null,xu=null,mo("resize")))},{flush:"post"}),et([Ct,()=>At.value.length,()=>wo(),ne],E=>vo(null,[E],function*([j]){var re;const ae=$f,be=Nf;j&&ae&&(yield yt(),!Cv(ae,{restoreAnchor:be?.restoreAnchor===!0,restoreToken:(re=be?.restoreToken)!=null?re:"imperative",allowUncapturedAnchor:be?.allowUncapturedAnchor===!0})&&P6(ae)||($f=null,Nf=null))}),{flush:"post",immediate:!0}),et([Ct,Oe,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.settleMode},()=>wo(),()=>ns(),Yi,Y2,c6,()=>Le.value,f0,()=>fi.count,()=>fi.total],([E,j,re])=>{if(!E||j!==!0||re==="manual"||!fv())return;const ae=(function(){var be;const Ne=At.value.length;return[(be=ns())!=null?be:"",wo(),Ol(),y0.value,Ne,Math.round(bo(0,Ne)),Math.round(bu()),fi.count,Math.round(fi.total)].join(":")})();Hf!==ae&&(Hf=ae,xv({reason:"final"}).then(be=>{be.stable||Hf!==ae||(Hf=null)}))},{flush:"post",immediate:!0}),et([Ct,Oe,()=>{var E;return(E=o.virtualScroll)==null?void 0:E.settleMode},()=>{var E;return(E=o.virtualScroll)==null?void 0:E.settledToken},()=>wo(),()=>ns(),Yi,Y2,c6,()=>Le.value,f0,()=>At.value.length,()=>fi.count,()=>fi.total],()=>{j6()},{flush:"post",immediate:!0}),et([()=>At.value.length,sn,Lo,Wo,()=>Rs.start,()=>Rs.end],([E,j,re,ae,be,Ne])=>{fe.value&&zt("virtualization",{nodes:E,virtualization:j,maxLiveNodes:re,buffer:ae,focusIndex:Fl.value,scroll:j?(()=>{const De=ut.value||ue();return De?{reverse:Se(De),scrollTop:Math.round(De.scrollTop),scrollTopAbs:Math.round(Math.abs(De.scrollTop)),scrollHeight:Math.round(De.scrollHeight),clientHeight:Math.round(De.clientHeight)}:null})():null,liveRange:{start:be,end:Ne},rendered:Le.value})}),et([()=>T.customId],([E],j,re)=>{if(!E||$s)return;const ae=(function(be,Ne){return be?(gs.controllers[be]=Ne,()=>{gs.controllers[be]===Ne&&delete gs.controllers[be]}):()=>{}})(E,{captureRestoreAnchor:Fc,restoreAnchor:Rc,getAnchorDrift:q2,getReport:MF});re(()=>{ae()})},{immediate:!0}),Un(()=>{(function(){if(Ct.value)try{Pl(),Ff();const E=Cu("manual");B6(E)&&(L(E),Rf=E,Av=Of());const j=Wc(E,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});j&&(B(j),j.anchor&&H(j.anchor),Vc=Bf(j))}catch{}})(),HF(),Q2(),Ke(),U6();for(const E of fa.values())for(const j of E)h0(j);fa.clear(),ku.clear(),qo.clear(),$v(),Kc(),nv(),Nc(),Uc(),Iv(),m6(),X2()});const zF=S1("ViewportDeferredMermaidBlockNode",zr({loader:()=>vo(null,null,function*(){try{return(yield Go(()=>import("./index11-DvlSNaLO.js"),__vite__mapDeps([7,5]))).default}catch(E){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',E),Ri}}),loadingComponent:F_,delay:0}),F_),WF=S1("ViewportDeferredInfographicBlockNode",zr({loader:()=>vo(null,null,function*(){try{return(yield Go(()=>import("./index10-BZ-Q5Z-w.js"),[])).default}catch(E){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',E),Ri}}),loadingComponent:N_,delay:0}),N_),UF=S1("ViewportDeferredD2BlockNode",zr(()=>vo(null,null,function*(){try{return(yield Go(()=>import("./index8-BwJHsPMm.js"),[])).default}catch(E){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',E),Ri}})),Ri),V6={text:Xo,paragraph:ac,heading:I2,code_block:G9,list:Kd,list_item:qd,blockquote:Qh,table:ep,definition_list:em,footnote:tm,footnote_reference:tr,footnote_anchor:J1,admonition:im,vmr_container:om,hardbreak:qa,link:Si,image:Va,thematic_break:nm,math_inline:Jr,math_block:PL,strong:_i,emphasis:Ai,strikethrough:xi,highlight:or,insert:Wi,subscript:zi,superscript:Hi,emoji:Bi,checkbox:er,checkbox_input:er,inline_code:ii,html_inline:nr,reference:wi,html_block:Q1},jF=R(()=>iv()),q6=R(()=>y_(T.codeBlockProps)),VF=R(()=>y_(T.codeBlockProps,{omit:["langs"]})),K6=R(()=>mt(mt({stream:T.codeBlockStream,darkTheme:T.codeBlockDarkTheme,lightTheme:T.codeBlockLightTheme,monacoOptions:T.codeBlockMonacoOptions,themes:T.themes,langs:g.value==="shiki"?T.langs:void 0,minWidth:T.codeBlockMinWidth,maxWidth:T.codeBlockMaxWidth},typeof Ce.value=="boolean"?{showTooltips:Ce.value}:{}),VF.value)),Z6=R(()=>mt(rn(mt({},K6.value),{langs:T.langs}),q6.value));function G6(E){return typeof E=="boolean"?E:void 0}const qF=R(()=>{const E=T.codeBlockProps||{},j={},re=G6(E.showLineNumbers);re!==void 0&&(j.showLineNumbers=re);const ae=G6(E.diffInline);ae!==void 0&&(j.diffInline=ae);const be=(function(Ne){const De=Number(Ne);return Number.isFinite(De)&&De>0?De:void 0})(E.reservedHeightPx);return be!==void 0&&(j.reservedHeightPx=be),j}),KF=R(()=>mt(mt({stream:T.codeBlockStream,darkTheme:T.codeBlockDarkTheme,lightTheme:T.codeBlockLightTheme,themes:T.themes,langs:T.langs,minWidth:T.codeBlockMinWidth,maxWidth:T.codeBlockMaxWidth},typeof Ce.value=="boolean"?{showTooltips:Ce.value}:{}),q6.value)),ZF=R(()=>mt({},T.mermaidProps||{})),Y6=R(()=>mt({},T.d2Props||{})),GF=R(()=>mt({},T.infographicProps||{})),jf=R(()=>({typewriter:f.value,fade:T.fade,customHtmlTags:po.value.customHtmlTags})),YF=R(()=>mt(mt({},jf.value),typeof Ce.value=="boolean"?{showTooltip:Ce.value}:{})),XF=R(()=>mt(mt({},jf.value),typeof Ce.value=="boolean"?{showTooltips:Ce.value}:{})),JF=R(()=>mt(mt({},jf.value),typeof Ce.value=="boolean"?{showTooltips:Ce.value}:{})),QF=R(()=>mt(mt({},jf.value),typeof Ce.value=="boolean"?{showTooltips:Ce.value}:{}));function eR(E){return Array.isArray(E.children)&&E.children.length>0}const A0=R(()=>AF.value.map(E=>{var j,re,ae,be,Ne,De,ze,ot;let We=(function(dt){var Nt,Dt,qt,Ut,Zt,pn,vn;if(dt.type!=="code_block")return dt;const Jn=dt,Ps=[String((Nt=Jn.language)!=null?Nt:""),String((Dt=Jn.loading)!=null?Dt:""),String((qt=Jn.diff)!=null?qt:""),String((Ut=Jn.code)!=null?Ut:""),String((Zt=Jn.originalCode)!=null?Zt:""),String((pn=Jn.updatedCode)!=null?pn:""),String((vn=Jn.raw)!=null?vn:"")].join("\0"),_s=$l.get(Jn);if(_s&&_s.signature===Ps)return _s.node;const $r=mt({},Jn);return $l.set(Jn,{signature:Ps,node:$r}),$r})(E.node);const Xe=M0(We);let nt=e7(We,Xe);if((We.type==="html_block"||We.type==="html_inline")&&nt===V6[We.type]){const dt=We,Nt=String((j=dt.tag)!=null?j:"").trim().toLowerCase()||cI(dt.content);if(Nt){const Dt=bn.value[Nt];if(Do.value.has(Nt)&&Dt)nt=Dt,We=rn(mt({},dt),{type:Nt,tag:Nt,content:Lte(dt.content,Nt)});else if(dI((re=dt.content)!=null?re:dt.raw,Nt)){const qt=String((be=(ae=dt.content)!=null?ae:dt.raw)!=null?be:"");We.type==="html_inline"?(nt=Xo,We={type:"text",content:qt,raw:qt}):(nt=ac,We={type:"paragraph",children:[{type:"text",content:qt,raw:qt}],raw:qt})}}}const Be=We.type==="code_block"&&g.value==="pre"&&nt===Ri&&!Rv(bn.value,Xe);let Je=mt({},(function(dt,Nt,Dt){const qt=Nt??M0(dt);if(dt.type==="code_block"){const Ut=qt?Rv(bn.value,qt):void 0;if(Dt&&g.value==="pre"&&!Ut&&Dt===Ri)return qF.value;if(Dt&&qt&&Dt===Ut)return qt==="mermaid"?J6(dt):qt==="infographic"?Q6(dt):qt==="d2"||qt==="d2lang"?Y6.value:Z6.value;if(Dt&&Dt===bn.value.code_block)return Z6.value;if(k6(Dt))return KF.value}return qt==="mermaid"?J6(dt):qt==="infographic"?Q6(dt):qt==="d2"||qt==="d2lang"?Y6.value:dt.type==="link"?YF.value:dt.type==="list"?XF.value:dt.type==="blockquote"?JF.value:dt.type==="table"?QF.value:dt.type==="code_block"?K6.value:jf.value})(We,Xe,nt));const lt=yn.value?Dc.value[E.index]:null;We.type==="code_block"&<?.kind==="code-block"&&(Je=rn(mt({},Je),Be?{reservedHeightPx:(Ne=lt.height)!=null?Ne:lt.contentHeight}:{estimatedHeightPx:lt.height,estimatedContentHeightPx:lt.contentHeight,estimatedDiffInline:lt.diffInline})),Be||We.type!=="code_block"||Xe!=="mermaid"||Td(Je.estimatedPreviewHeightPx)!=null||(Je=rn(mt({},Je),{estimatedPreviewHeightPx:sg(ng(String((De=We.code)!=null?De:"")))})),Be||We.type!=="code_block"||Xe!=="infographic"||Td(Je.estimatedPreviewHeightPx)!=null||(Je=rn(mt({},Je),{estimatedPreviewHeightPx:ig(og(String((ze=We.code)!=null?ze:"")))})),We.type==="math_block"&&(Je=rn(mt({},Je),{cacheScope:Mn}));const rt=(function(dt,Nt){const Dt=String(dt.type);return!Yp(Dt)&&bn.value[Dt]===Nt})(We,nt),wt=rt?c5(We,ge.value):void 0;return rn(mt({},E),{node:We,component:nt,bindings:Je,customBindings:mt(mt({},wt??{}),Je),rendersCustomNode:rt,hasSlotChildren:eR(We),slotContent:String((ot=We.content)!=null?ot:""),isCodeBlock:We.type==="code_block",indexKey:`${jF.value}-${E.index}`,vnodeKey:`${TF.value}\0${E.index}\0${We.type}`})}));function M0(E){var j;return E?.type==="code_block"?String((j=E.language)!=null?j:"").trim().toLowerCase():""}function Rv(E,j){const re=j.trim().toLowerCase();if(re)for(const ae of[re,M2(re),yL(re)]){const be=ae&&E[ae];if(be)return be}}function X6(E,j,re,ae){var be,Ne;const De=mt({},E.value);return Td(De.estimatedPreviewHeightPx)==null&&(De.estimatedPreviewHeightPx=ae(re(String((be=j?.code)!=null?be:"")),void 0,De.maxHeight==="none"?null:(Ne=Td(De.maxHeight))!=null?Ne:void 0)),De}function J6(E){return X6(ZF,E,ng,sg)}function Q6(E){return X6(GF,E,og,ig)}function e7(E,j){if(!E)return q3;const re=bn.value,ae=re[String(E.type)];if(E.type==="code_block"){const be=j??M0(E),Ne=be?Rv(re,be):void 0;return Ne||(g.value==="pre"?re.code_block||Ri:be==="mermaid"?re.mermaid||zF:be==="infographic"?re.infographic||WF:be==="d2"||be==="d2lang"?re.d2||UF:ae||re.code_block||b6.value)}return ae||V6[String(E.type)]||q3}function Ov(E){s("click",E)}function tR(E){var j;(j=E.target)!=null&&j.closest("[data-node-index]")&&s("mouseover",E)}function nR(E){var j;(j=E.target)!=null&&j.closest("[data-node-index]")&&s("mouseout",E)}function t7(E){s("mouseover",E)}function n7(E){s("mouseout",E)}const Mu=Z(null),Ti=Z(!1),Vf=Z(null),oR=R(()=>!(T.domMode!=="minimal"||X.value||T.fade!==!1||f.value||Ti.value||ts.value||sn.value||Qe.value||uo.value||Vi.value||Object.keys(bn.value).length!==0));let qf,Gc=null,Pv=0,T0=0,E0=0;const o7=["code_block","admonition","table","math_block","html_block","image","thematic_break"],sR=new Set(o7),s7=[".typewriter-cursor",".height-estimation-probes",...o7.map(E=>`[data-node-type="${E}"]`),"script","style"].join(",");function i7(E){if(!E||typeof E!="object")return!1;const j=E.type;return typeof j=="string"&&sR.has(j)}function I0(E){var j,re;if(!E||typeof E!="object")return 0;const ae=E,be=(re=(j=ae.raw)!=null?j:ae.content)!=null?re:ae.code;if(typeof be=="string")return be.length;const Ne=ae.children;if(Array.isArray(Ne))return Ne.reduce((ze,ot)=>ze+I0(ot),0);const De=ae.items;return Array.isArray(De)?De.reduce((ze,ot)=>ze+I0(ot),0):0}function L0(){qf&&(clearTimeout(qf),qf=void 0)}function Dv(){Pv+=1,Gc!=null&&(Vo?.(Gc),Gc=null)}function Kf(){Dv(),ma(),Mu.value&&(Mu.value.style.visibility="hidden")}function iR(E){var j;if(E.nodeType!==Node.TEXT_NODE||!((j=E.textContent)!=null?j:"").trim())return!1;const re=E.parentElement;return!!re&&!re.closest(s7)}function rR(E){let j=E.lastChild;for(;j;){if(iR(j))return j;if(j.nodeType===Node.ELEMENT_NODE){const re=j;if(!re.matches(s7)&&re.lastChild){j=re.lastChild;continue}}for(;j&&j!==E&&!j.previousSibling;)j=j.parentNode;if(!j||j===E)break;j=j.previousSibling}return null}function r7(){const E=A0.value;for(let j=E.length-1;j>=0;j--){const re=E[j];if(!re||i7(re.node)||!_0(re.index))continue;const ae=fo.get(re.index);if(!ae)continue;const be=rR(ae);if(be)return be}return null}function ma(){Vf.value&&(Vf.value.classList.remove(R_),Vf.value=null)}function $0(){if(d.value!=="simple"||!G||!Ti.value||!O.value)return void ma();const E=r7(),j=E?(function(re){var ae;const be=(ae=re.parentElement)==null?void 0:ae.closest(".text-node");return be instanceof HTMLElement?be:re.parentElement})(E):null;j!==Vf.value&&(ma(),j&&(j.classList.add(R_),Vf.value=j))}function N0(){if(d.value!=="precise"||!G||!Ti.value||Gc!=null)return;const E=Pv,j=()=>{Gc=null,E===Pv&&(function(){var re,ae;if(d.value!=="precise"||!(G&&Ti.value&&O.value&&Mu.value))return;const be=O.value,Ne=Mu.value;Ne.style.visibility="hidden";const De=r7();if(!De)return;let ze=0,ot=0,We=20,Xe=!1;if(De?.textContent){const nt=De.textContent.length,Be=document.createRange();Be.setStart(De,Math.max(0,nt-1)),Be.setEnd(De,nt);const Je=typeof Be.getClientRects=="function"?Be.getClientRects():void 0,lt=(ae=Je?.[Je.length-1])!=null?ae:(re=De.parentElement)==null?void 0:re.getBoundingClientRect();if(lt){const rt=Kt("typewriterCursor.root.getBoundingClientRect",()=>be.getBoundingClientRect());ze=lt.right-rt.left+be.scrollLeft,ot=lt.top-rt.top+be.scrollTop,We=lt.height||We,Xe=!0}Be.detach()}Xe&&(Ne.style.transform=`translate(${Math.max(0,ze)}px, ${Math.max(0,ot)}px)`,Ne.style.height=`${We}px`,Ne.style.visibility="visible")})()};jo?Gc=jo(j):j()}return et([st,()=>o.content,()=>o.nodes,()=>T.typewriter,Oe],()=>vo(null,null,function*(){var E,j;if(!G||X.value||!ee.value)return;if(Oe.value)return Ti.value=!1,L0(),void Kf();if((E=o.nodes)!=null&&E.length)return Ti.value=!1,L0(),Kf(),T0=((j=o.content)!=null?j:"").length,void(E0=st.value.length);const re=(function(){var ze,ot;return(ze=o.nodes)!=null&&ze.length?o.nodes.reduce((We,Xe)=>We+I0(Xe),0):((ot=o.content)!=null?ot:"").length})(),ae=(function(){var ze;return(ze=o.nodes)!=null&&ze.length?o.nodes.reduce((ot,We)=>ot+I0(We),0):st.value.length})(),be=!i7(At.value[At.value.length-1]),Ne=re>T0,De=ae>E0;if(!f.value||!be||!Ne&&!De)return f.value&&be||(Ti.value=!1,Kf()),T0=re,void(E0=ae);T0=re,E0=ae,Ti.value=!0,d.value==="precise"&&Mu.value&&(Mu.value.style.visibility="hidden"),L0(),yield yt(),d.value==="simple"?$0():(ma(),N0()),qf=setTimeout(()=>{qf=void 0,Ti.value=!1},3e3)}),{flush:"post",immediate:!0}),et(Ti,E=>vo(null,null,function*(){E?(yield yt(),d.value!=="simple"?(ma(),d.value==="precise"&&N0()):$0()):Kf()}),{flush:"post"}),et(d,()=>vo(null,null,function*(){if(G&&!X.value&&ee.value&&Ti.value){if(yield yt(),d.value==="simple")return Dv(),void $0();ma(),d.value!=="precise"?Kf():N0()}}),{flush:"post"}),et([()=>Le.value,()=>Rs.start,()=>Rs.end],()=>vo(null,null,function*(){G&&!X.value&&ee.value&&Ti.value&&(yield yt(),d.value!=="simple"?(ma(),d.value==="precise"&&N0()):$0())}),{flush:"post"}),Un(()=>{L0(),Dv(),ma(),Po.clear()}),(E,j)=>{const re=PO("NodeRenderer",!0);return p(X)?(b(!0),A(Pe,{key:0},pt(A0.value,ae=>(b(),A(Pe,{key:ae.vnodeKey},[ae.rendersCustomNode?(b(),me(ys(ae.component),Dn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":T.customId,"is-dark":T.isDark,onClick:Ov,onMouseover:t7,onMouseout:n7,onCopy:j[0]||(j[0]=be=>i(be)),onHandleArtifactClick:j[1]||(j[1]=be=>s("handleArtifactClick",be))}),{default:ke(()=>[ae.hasSlotChildren?(b(),me(re,Dn({key:0,ref_for:!0},To.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(b(),me(re,Dn({key:1,ref_for:!0},To.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):te("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(b(),me(ys(ae.component),Dn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":T.customId,"is-dark":T.isDark,onClick:Ov,onMouseover:t7,onMouseout:n7,onCopy:j[2]||(j[2]=be=>i(be)),onHandleArtifactClick:j[3]||(j[3]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(b(),A("div",{key:1,ref_key:"containerRef",ref:O,class:Re(["markstream-vue markdown-renderer",[{dark:T.isDark},{virtualized:sn.value},{"virtual-scroll-coordinated":en.value},{"stable-layout":kF.value},{"typewriter-simple-cursor":Ti.value&&d.value==="simple"}]]),"data-custom-id":T.customId,onClick:Ov,onMouseover:tR,onMouseout:nR},[Ho.value||sn.value?(b(),A(Pe,{key:0},[Ho.value?(b(),me(Sce,{key:0,width:Zs.value,"flow-root":sn.value||en.value,"paragraph-node":no.value,"list-item-node":Ks.value,"list-node":ps.value,"heading-nodes":ui.value,"set-paragraph-wrapper":bF,"set-list-item-wrapper":CF,"set-list-wrapper":wF,"set-heading-wrapper":SF},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):te("",!0),sn.value?(b(),A("div",{key:1,class:"node-spacer",style:Gt({height:`${ov.value}px`}),"aria-hidden":"true"},null,4)):te("",!0)],64)):te("",!0),oR.value?(b(!0),A(Pe,{key:1},pt(A0.value,ae=>(b(),A(Pe,{key:ae.vnodeKey},[_0(ae.index)?(b(),me(ys(ae.component),Dn({key:0,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":T.customId,"is-dark":T.isDark,onMouseover:j[4]||(j[4]=be=>s("mouseover",be)),onMouseout:j[5]||(j[5]=be=>s("mouseout",be)),onCopy:j[6]||(j[6]=be=>i(be)),onHandleArtifactClick:j[7]||(j[7]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):te("",!0)],64))),128)):(b(!0),A(Pe,{key:2},pt(A0.value,ae=>(b(),A("div",{key:ae.vnodeKey,ref_for:!0,ref:be=>x0(ae.index,be),class:"node-slot","data-node-index":ae.index,"data-node-type":ae.node.type},[_0(ae.index)?(b(),A("div",{key:0,ref_for:!0,ref:be=>(function(Ne,De){var ze;De||(function(nt){const Be=`${iv()}-${nt}`;let Je=!1;for(const lt of Array.from(Zi.keys())){const rt=sl.get(lt);(rt?.index===nt||lt===Be||lt.startsWith(`${Be}-`))&&(Zi.delete(lt),sl.delete(lt),Je=!0)}Je&&(Bc(),mo("async-node"))})(Ne),Rl.delete(Ne),(function(nt){var Be;const Je=((Be=ku.get(nt))!=null?Be:0)+1;ku.set(nt,Je)})(Ne);const ot=fa.get(Ne);if(ot){for(const nt of ot)h0(nt);fa.delete(Ne)}if((function(nt){const Be=Ki.get(nt);Be&&(ci?.unobserve(Be),Er.delete(Be),Ki.delete(nt))})(Ne),!De||!ws.value)return ol.delete(Ne),void ku.delete(Ne);ol.set(Ne,De);const We=()=>{S0(Ne,De)};queueMicrotask(We);const Xe=(ci||typeof ResizeObserver>"u"||(ci=new ResizeObserver(nt=>{if(nt.length)for(const Be of nt){const Je=Er.get(Be.target),lt=Ki.get(Je??-1);Je!=null&<&&S0(Je,lt)}else Pl()})),ci);if(Xe&&(Ki.set(Ne,De),Er.set(De,Ne),Xe.observe(De)),typeof window<"u"){const nt=((ze=At.value[Ne])==null?void 0:ze.type)==="code_block"?[16,80,240,800]:Oe.value?[80]:[];if(nt.length){const Be=nt.map(Je=>f6(Je,We,"node-resize")).filter(Je=>Je!=null);Be.length&&fa.set(Ne,Be)}}})(ae.index,be),class:"node-content"},[ae.isCodeBlock?ae.rendersCustomNode?(b(),me(ys(ae.component),Dn({key:1,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":T.customId,"is-dark":T.isDark,onCopy:j[12]||(j[12]=be=>i(be)),onHandleArtifactClick:j[13]||(j[13]=be=>s("handleArtifactClick",be))}),{default:ke(()=>[ae.hasSlotChildren?(b(),me(re,Dn({key:0,ref_for:!0},To.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(b(),me(re,Dn({key:1,ref_for:!0},To.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):te("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(b(),me(ys(ae.component),Dn({key:2,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":T.customId,"is-dark":T.isDark,onCopy:j[14]||(j[14]=be=>i(be)),onHandleArtifactClick:j[15]||(j[15]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(b(),me(as,{key:0,name:"fade",css:T.fade!==!1,appear:T.fade!==!1},{default:ke(()=>[ae.rendersCustomNode?(b(),me(ys(ae.component),Dn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":T.customId,"is-dark":T.isDark,onCopy:j[8]||(j[8]=be=>i(be)),onHandleArtifactClick:j[9]||(j[9]=be=>s("handleArtifactClick",be))}),{default:ke(()=>[ae.hasSlotChildren?(b(),me(re,Dn({key:0,ref_for:!0},To.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(b(),me(re,Dn({key:1,ref_for:!0},To.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):te("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(b(),me(ys(ae.component),Dn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":T.customId,"is-dark":T.isDark,onCopy:j[10]||(j[10]=be=>i(be)),onHandleArtifactClick:j[11]||(j[11]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(b(),A("div",{key:1,class:"node-placeholder",style:Gt({height:`${Zn(ae.index)}px`})},null,4))],8,Tce))),128)),Ti.value&&d.value==="precise"?(b(),A("span",{key:3,ref_key:"typewriterCursorRef",ref:Mu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):te("",!0),sn.value?(b(),A("div",{key:4,class:"node-spacer",style:Gt({height:`${sv.value}px`}),"aria-hidden":"true"},null,4)):te("",!0)],42,Mce))}}})),[["__scopeId","data-v-a9489508"]]),Ui=XL;Ui.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",Ui.__name,Ui.name].filter(n=>!!n));for(const n of t)e.component(n,XL)};const x5=Object.freeze(Object.defineProperty({__proto__:null,default:Ui},Symbol.toStringTag,{value:"Module"})),Ece={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Ice={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Lce={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},$ce={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},Nce={class:"admonition-title"},Fce=["aria-expanded","aria-controls"],Rce=["id"],im=Kn(tt({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=R(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const u=o.node.kind||"note";return u.charAt(0).toUpperCase()+u.slice(1)}),r=Z(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(u,c)=>(b(),A("div",{class:Re(["admonition",[`admonition-${o.node.kind}`]])},[C("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(b(),A("svg",Ece,[...c[1]||(c[1]=[C("circle",{cx:"12",cy:"12",r:"10"},null,-1),C("path",{d:"M12 16v-4"},null,-1),C("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(b(),A("svg",Ice,[...c[2]||(c[2]=[C("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),C("path",{d:"M9 18h6"},null,-1),C("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(b(),A("svg",Lce,[...c[3]||(c[3]=[C("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"},null,-1),C("path",{d:"M12 9v4"},null,-1),C("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(b(),A("svg",$ce,[...c[4]||(c[4]=[C("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),C("path",{d:"M12 8v4"},null,-1),C("path",{d:"M12 16h.01"},null,-1)])])):te("",!0),C("span",Nce,N(i.value),1),o.node.collapsible?(b(),A("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(b(),A("svg",{style:Gt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...c[5]||(c[5]=[C("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,Fce)):te("",!0)]),In(C("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[V(p(Ui),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:c[0]||(c[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,Rce),[[Es,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);im.install=e=>{e.component(im.__name,im)};const X3=()=>Go(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let _h=null,xh=X3,Sh=null,O_=!1,P_=!1;function fVe(){return vo(this,null,function*(){if(_h)return _h;const e=xh;return e?e===X3&&O_?null:Sh||(Sh=vo(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===X3)return e===xh&&(O_=!0,(function(o){P_||(P_=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===xh&&(Sh=null)}return e!==xh?null:t?(_h=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),_h):null}),Sh):null})}let Ah=null,JL=null,Mh=null;function pVe(){return typeof JL=="function"}function hVe(){return vo(this,null,function*(){if(Ah)return Ah;const e=JL;return e?Mh||(Mh=vo(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(Ah=n,Ah):null}).finally(()=>{Mh=null}),Mh):null})}const mVe=Symbol("markstreamLanguageIconResolver"),QL=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],Oce=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),J3=[...QL].sort((e,t)=>t.length-e.length).join("|"),r4=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${J3}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${J3})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),e$=/[),.;!?,。;!?)]+$/;function Pce(e){const t=e.toLowerCase();return QL.some(n=>t.endsWith(`.${n}`))}function Dce(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${J3}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Bce(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(e$,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=Oce.has(i),a=Pce(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const u=o[2]??o[3],c=u?Number(u):void 0;return{path:s,line:c!==void 0&&Number.isFinite(c)&&c>0?c:void 0}}function Hce(e,t={}){const n=[];r4.lastIndex=0;let o;for(;(o=r4.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const u=a.replace(e$,""),c=a.length-u.length;a=u;const d=Bce(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),c>0&&(r4.lastIndex-=c)}return n}function l4(e,t){let n=0,o=t-1;for(;o>=0&&e[o]==="\\";)n++,o--;return n%2===1}const zce=/\s/,Wce=/\p{Nd}/u;function kc(e,t){const n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function Uce(e,t){if(t<=0)return;const n=e.charCodeAt(t-1),o=n>=56320&&n<=57343&&t>1?t-2:t-1,s=e.codePointAt(o);return s===void 0?void 0:String.fromCodePoint(s)}function D_(e){return e!==void 0&&zce.test(e)}function uf(e){return e!==void 0&&Wce.test(e)}function jce(e,t){const n=e[t+1];return uf(kc(e,t+1))?!0:(n==="-"||n==="+"||n==="."||n==="−"||n==="+"||n==="-")&&uf(kc(e,t+2))}function hg(e){return e!==void 0&&e>="A"&&e<="Z"}const t$=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function Vce(e,t){if(!hg(e[t-1]))return!1;let n=t-1;for(;n>0&&hg(e[n-1]);)n--;return t$.test(e.slice(n,t))||uf(kc(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")&&!/\p{L}/u.test(kc(e,t+1)??"")}function qce(e,t){if(!hg(e[t-1]))return!1;let n=t-1;for(;n>0&&hg(e[n-1]);)n--;return t$.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")}const Kce=/^[-–—,,、;;::~~(([【//]$/;function Zce(e,t){const n=e[t+1];if(n!=="-"&&n!=="+"&&n!=="."||!uf(kc(e,t+2)))return!1;const o=e[t-1];return o!==void 0&&Kce.test(o)}function Gce(e){const t=String.raw`[、,,;;::~~\-–—至到//\s()()=*×=]|和|跟|与|及|或|and|or`;let n=e.replace(new RegExp(String.raw`^(?:${t})+`,"u"),"");for(;;){const s=n.replace(new RegExp(String.raw`^\p{L}+(?:${t})+`,"u"),"").replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,"");if(s===n)break;n=s}if(!/\p{Nd}/u.test(n))return!1;const o=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${o}(?:\p{L}+)?(?:(?:${t})+${o}(?:\p{L}+)?)*$`,"u").test(n)}const ul=-1,B_=1,H_=2,z_=3;function Yce(e){const t=e.length,n=new Uint8Array(t),o=new Int32Array(t+1).fill(ul),s=new Int32Array(t+1),i=new Int32Array(t+1),r=[],l=[];{const F=[];for(let q=0;q{for(;a=(l[a]?.[1]??0);)a++;const W=l[a];return W!==void 0&&F>=W[0]},c=new Set(' \n\r)。,、;:!?"<>`「」『』【】〔〕()*—–“”‘’'),d=[];for(const F of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))d.push(F.index);for(const F of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))d.push(F.index);for(const F of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(F.index===0||!/[\w~/.-]/.test(e[F.index-1]))&&d.push(F.index);d.sort((F,W)=>F-W);let f=-1;for(const F of d){if(FF+7&&!/[\w/?#@~.+&=%-]/.test(e[W+1]??""))break}W++}r.push([F,W]),f=W}const h=[];for(let F=0;F]/.test(q))continue;let K=W,ie=ul,ne=ul;for(;K"){ne=K;break}if(!z&&Y==="/"&&e[K+1]===">"){ne=K+1;break}if(!/\s/.test(Y)){ie=K;break}for(;K"){ne=K;break}if(z){ie=K;break}if(le==="/"&&e[K+1]===">"){ne=K+1;break}const Ee=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(K));if(!Ee){ie=K;break}K+=Ee[0].length;let de=K;for(;de`]+/.exec(e.slice(de));if(!pe){ie=de;break}K=de+pe[0].length}}}if(ne!==ul)h.push([F,ne+1]),F=ne;else if(ie!==ul){const Y=e.indexOf("<",F+1);F=(Y!==-1&&Y",F+2);ie===-1?m=!1:(h.push([F,ie+2]),F=ie+1,z=!0)}else if(W==="!"){if(e[F+2]==="-"&&e[F+3]==="-"){if(g){const ie=e.indexOf("-->",F+4);ie===-1?g=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(e.startsWith("[CDATA[",F+2)){if(w){const ie=e.indexOf("]]>",F+9);ie===-1?w=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(_&&/[A-Z]/.test(e[F+2]??"")){const ie=e.indexOf(">",F+3);ie===-1?_=!1:(h.push([F,ie+1]),F=ie,z=!0)}}if(z)continue;if(W!==void 0&&/[a-zA-Z]/.test(W)){const ie=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(F+1));if(ie){let ne=F+1+ie[0].length;for(;ne"&&e[ne]!=="<"&&!/\s/.test(e[ne]);)ne++;if(e[ne]===">"){h.push([F,ne+1]),F=ne;continue}}}if(W===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(W))continue;let U=F+1;for(;U"&&(h.push([F,U+1]),F=U)}}h.sort((F,W)=>F[0]-W[0]);const v=[];for(const[F,W]of h){const z=v[v.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],W):v.push([F,W])}r.push(...v);let k=0;const y=F=>{for(;k=(v[k]?.[1]??0);)k++;const W=v[k];return W!==void 0&&F>=W[0]},x=[];let M=null,$=0,S=!1;for(let F=0;F"&&(S=!1);else if(!(u(F)||y(F))){if(M!==null)e[F]===M&&(M=null);else if(x.length>0&&(e[F]==='"'||e[F]==="'")&&F>0&&/\s/.test(e[F-1]))M=e[F];else if(e[F]==="[")$++;else if(e[F]==="]")$>0&&e[F+1]==="("&&(x.push(F),S=e[F+2]==="<",F++),$=Math.max(0,$-1);else if(e[F]==="("&&x.length>0)x.push(-1);else if(e[F]===")"&&x.length>0){const W=x.pop();if(W!==void 0&&W>=0){const z=e.slice(W+2,F);(/\s/.exec(z)===null||z.startsWith("<")&&/^<(?:\\[<>]|[^<>])*>$/.test(z)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(z))&&r.push([W,F+1])}}}r.sort((F,W)=>F[0]-W[0]);const I=[];for(const[F,W]of r){const z=I[I.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],W):I.push([F,W])}const P=F=>{let W=0,z=I.length-1;for(;W<=z;){const U=W+z>>1,q=I[U];if(q===void 0)return!1;if(F=q[1])W=U+1;else return!0}return!1};for(let F=0;F=0;F--)n[F]===z_&&(D=F),o[F]=D;const T=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,L=/[^\p{L}\p{Nd}\s]$/u,B=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,H=/(?:^|\s)[a-z]{2,}/,O=(F,W)=>{const z=kc(e,F+1);if(z===void 0||!T.test(z))return!1;const U=o[F+1]??ul;if(U!==ul){const q=e.slice(F+1,U);return!(q.length===((q.codePointAt(0)??0)>65535?2:1))&&B.test(q)||/[,;:!?]$/.test(q)||/^[a-z]{2,}$/.test(q)?!1:(s[U]??0)-(s[F+1]??0)===0&&(i[U]??0)-(i[F+1]??0)===0}return L.test(W)||B.test(W)||H.test(W)};return(F,W=-1)=>{if(e[F]!=="$"||n[F]===B_||e[F+1]==="$"||e[F-1]==="$"&&W!==F||Vce(e,F)||F+1>=t||D_(e[F+1]))return null;const z=o[F+1]??ul;if(z===ul||(s[z]??0)-(s[F+1]??0)>0||(i[z]??0)-(i[F+1]??0)>0)return null;const U=e.slice(F+1,z);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(U)||e[z+1]==="{"&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(U)||uf(Uce(e,F))&&Gce(U)||jce(e,F)&&(O(z,U)||qce(e,z)||/\s/.test(U)&&/\p{Nd}$/u.test(U)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(U)||e[z+1]==="$"&&!/\p{L}/u.test(U)&&/[^\p{L}\p{Nd}\s]$/u.test(U))?null:{content:U,end:z+1}}}const W_=new WeakMap;function Xce(e,t){if(e.src[e.pos]!=="$")return!1;let n=W_.get(e);(!n||n.src!==e.src)&&(n={src:e.src,match:Yce(e.src),lastEnd:-1},W_.set(e,n));const o=n.match(e.pos,n.lastEnd);if(!o||o.end>e.posMax)return!1;if(n.lastEnd=o.end,t)return e.pos=o.end,!0;const s=e.push("math_inline","math",0);return s.content=o.content,s.markup="$",s.raw=e.src.slice(e.pos,o.end),s.loading=!1,e.pos=o.end,!0}function Jce(e){return e.inline.ruler.disable("math"),e.inline.ruler.before("escape","math",Xce),e}const Qce=12e4,ede=6e4,tde=32,nde=3e4,U_=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function ode(e){let t=0,n=0,o=0;U_.lastIndex=0;let s;for(;(s=U_.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=Qce||n>=ede||t>=tde||o>=nde?"pre":"shiki",codeFenceCount:t,codeChars:n}}async function n$(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return ide(e)}function sde(e){if(typeof e!="string")return;const t=typeof navigator<"u"?navigator.clipboard:void 0;t&&typeof t.writeText=="function"||n$(e)}function ide(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}const o$="md-table-wide",s$="md-table-toggle",i$="md-table-fade",j_="md-table-toggle--show",rde="md-table-at-end",lde="kimi-table-layout",r$='',ade='';function Xp(e){return e.querySelector(`button.${s$}`)}function l$(e){return e.querySelector(`.${i$}`)}const ude=26;function cde(e){const t=Xp(e);if(!t)return;const n=e.querySelector("thead tr")??e.querySelector("tr");if(!n)return;const o=n.getBoundingClientRect(),s=e.getBoundingClientRect().top,i=Math.max(2,Math.round(o.top-s+(o.height-ude)/2));t.style.top=`${i}px`,t.style.right=`${i}px`}function dde(e){return e.closest(".a-msg .msg")!==null}function fde(e){const t=e.querySelector("table");return t!==null&&t.scrollWidth>e.clientWidth+1}function a$(e){const t=`translateX(${e.scrollLeft}px)`,n=l$(e);n&&(n.style.transform=t);const o=Xp(e);o&&(o.style.transform=t);const s=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(rde,s)}function pde(e,t){const n=Xp(e);if(n)return n;if(!dde(e))return null;const o=document.createElement("div");o.className=i$,o.setAttribute("aria-hidden","true");const s=document.createElement("button");return s.type="button",s.className=s$,s.innerHTML=r$,s.setAttribute("aria-label",t.widen),s.title=t.widen,s.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),hde(e,t)}),e.appendChild(o),e.appendChild(s),e.addEventListener("scroll",()=>a$(e),{passive:!0}),S5(e),s}function hde(e,t){const n=e.classList.toggle(o$),o=Xp(e);if(o){o.innerHTML=n?ade:r$;const s=n?t.restore:t.widen;o.setAttribute("aria-label",s),o.title=s}S5(e),e.dispatchEvent(new CustomEvent(lde,{bubbles:!0}))}function S5(e){const t=Xp(e);if(!t)return;const n=fde(e),o=e.classList.contains(o$);t.classList.toggle(j_,n||o);const s=l$(e);s&&s.classList.toggle(j_,n),cde(e),a$(e)}function mde(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function gde(e){return new Worker("/assets/mermaidParser.worker-BFSlSHEW.js",{type:"module",name:e?.name})}const vde={key:1,class:"diff-wrap"},yde={class:"diff-bar"},kde=["aria-label","onClick"],bde={class:"diff-pre"},Cde={key:0,class:"diff-sign"},wde={class:"diff-text"},_de="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",V_="github-light",q_="github-dark",xde=tt({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){cle(),_le(),fle(),Ale(),dle(new mde),Sle(new gde);const{t}=vf(),n=on("resolveImage"),o=Z(null),s=e,i=R(()=>!s.streaming),r=R(()=>Dce(s.text??"")),l=R(()=>s.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:ode(s.text??"")),a=p2(),u=R(()=>!s.streaming),c=Jo(new Map),d=new Set,f=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,h=/(]*?\bsrc=")([^"]+)(")/gi;function g(F){return!/^(https?:|data:|blob:)/i.test(F)}function m(F){if(!n)return;const W=[];for(const z of[f,h]){z.lastIndex=0;let U;for(;(U=z.exec(F))!==null;)W.push(U[2]??"")}for(const z of W)!z||!g(z)||c.has(z)||d.has(z)||(d.add(z),n(z).then(U=>{c.set(z,U!==z?U:"")}).catch(()=>{c.set(z,"")}).finally(()=>{d.delete(z)}))}function w(F){if(!n)return F;const W=z=>{if(!g(z))return null;const U=c.get(z);return U===void 0?_de:U===""?null:U};return F.replace(f,(z,U,q,K)=>{const ie=W(q);return ie===null?z:`${U}${ie}${K}`}).replace(h,(z,U,q,K)=>{const ie=W(q);return ie===null?z:`${U}${ie}${K}`})}et(()=>s.text,F=>m(F??""),{immediate:!0});function _(){if(!o.value||!s.openFile||s.streaming)return;const F=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),W=[];let z=F.nextNode();for(;z;){const U=z,q=U.parentElement;q&&!q.closest("a, pre, .md-file-link, svg")&&U.data.trim().length>0&&W.push(U),z=F.nextNode()}for(const U of W){const q=Hce(U.data,{aliases:r.value});if(q.length===0||!U.parentNode)continue;const K=document.createDocumentFragment();let ie=0;for(const ne of q){ne.start>ie&&K.append(document.createTextNode(U.data.slice(ie,ne.start)));const Y=document.createElement("button");Y.type="button",Y.className="md-file-link",Y.textContent=ne.text,Y.title=ne.line?`${ne.path}:${ne.line}`:ne.path,Y.addEventListener("click",le=>{le.preventDefault(),le.stopPropagation(),s.openFile?.({path:ne.path,line:ne.line})}),K.append(Y),ie=ne.end}ie{U.preventDefault(),U.stopPropagation(),s.openFile?.({path:k(z)})}))}}function x(){return{widen:t("conversation.widenTable"),restore:t("conversation.restoreTableWidth")}}function M(){if(!o.value||s.streaming)return;const F=x();for(const W of o.value.querySelectorAll(".table-node-wrapper"))pde(W,F)}function $(){if(!(!o.value||s.streaming))for(const F of o.value.querySelectorAll(".table-node-wrapper"))S5(F)}function S(){yt().then(()=>{_(),y(),M()})}et(()=>s.text,S),et(()=>s.streaming,S);let I=null,P=null;dn(()=>{S(),o.value&&(I=new MutationObserver(S),I.observe(o.value,{childList:!0,subtree:!0}),P=new ResizeObserver($),P.observe(o.value))}),kn(()=>{I?.disconnect(),P?.disconnect()});const D={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},T=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,L=R(()=>{const F=w(s.text??""),W=[];let z=0;T.lastIndex=0;let U;for(;(U=T.exec(F))!==null;){const K=U[1]??"",ie=F.slice(z,U.index)+(K||"");ie.trim()&&W.push({kind:"md",text:ie}),W.push({kind:"diff",code:U[2]??""}),z=T.lastIndex}const q=F.slice(z);return(q.trim()||W.length===0)&&W.push({kind:"md",text:q}),W});function B(F){return F.split(` -`).map(W=>W.startsWith("@@")?{type:"hunk",sign:"",text:W}:/^\+(?!\+\+)/.test(W)?{type:"add",sign:"+",text:W.slice(1)}:/^-(?!--)/.test(W)?{type:"del",sign:"-",text:W.slice(1)}:W.startsWith(" ")?{type:"ctx",sign:"",text:W.slice(1)}:{type:"ctx",sign:"",text:W})}const H=Z(null);function O(F,W){n$(F).then(z=>{z&&(H.value=W,setTimeout(()=>{H.value=null},1400))})}return(F,W)=>(b(),A("div",{ref_key:"mdRef",ref:o,class:"md"},[(b(!0),A(Pe,null,pt(L.value,(z,U)=>(b(),A(Pe,{key:U},[z.kind==="md"?(b(),me(p(Ui),{key:0,content:z.text,"custom-markdown-it":p(Jce),mode:"chat","code-renderer":l.value.codeRenderer,"is-dark":p(a),"code-block-light-theme":V_,"code-block-dark-theme":q_,themes:[V_,q_],"code-block-props":D,final:i.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1,onCopy:p(sde)},null,8,["content","custom-markdown-it","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering","onCopy"])):(b(),A("div",vde,[C("div",yde,[W[0]||(W[0]=C("span",{class:"diff-lang"},"diff",-1)),V(p(Pn),{text:p(t)("filePreview.copyCode")},{default:ke(()=>[C("button",{class:"diff-copy","aria-label":p(t)("filePreview.copyCode"),onClick:q=>O(z.code,U)},[V(p(Ie),{name:H.value===U?"check":"copy",size:"sm"},null,8,["name"])],8,kde)]),_:2},1032,["text"])]),C("pre",bde,[C("code",null,[(b(!0),A(Pe,null,pt(B(z.code),(q,K)=>(b(),A("span",{key:K,class:Re(["diff-line",`diff-${q.type}`])},[q.type!=="hunk"?(b(),A("span",Cde,N(q.sign),1)):te("",!0),C("span",wde,N(q.text),1)],2))),128))])])]))],64))),128))],512))}}),Ic=ht(xde,[["__scopeId","data-v-2ec518c1"]]),Sde={state:"idle"};function Ade(e){const t=Z(Sde),n=Z(li(cn.updateSkippedVersion)),o=Z(!1);if(typeof e?.getUpdateAutoDownload=="function"&&e.getUpdateAutoDownload().then(i=>{o.value=i}).catch(()=>{}),e!==void 0){let i=!1;e.onUpdateStatus(r=>{i=!0,t.value=r}),e.getUpdateStatus().then(r=>{i||(t.value=r)}).catch(()=>{})}const s=R(()=>{const i=t.value;return!(i.state==="idle"||i.state==="available"&&i.version!==void 0&&i.version===n.value)});return{status:t,visible:s,canCheck:typeof e?.checkForUpdates=="function",autoDownload:o,canToggleAutoDownload:typeof e?.getUpdateAutoDownload=="function"&&typeof e?.setUpdateAutoDownload=="function",setAutoDownload:i=>{o.value=i,e?.setUpdateAutoDownload?.(i).catch(()=>{})},skipVersion:()=>{const i=t.value.version;t.value.state==="available"&&i!==void 0&&(n.value=i,Ls(cn.updateSkippedVersion,i))},check:async()=>{if(typeof e?.checkForUpdates!="function")return Promise.resolve({outcome:"unsupported"});const i=await e.checkForUpdates().catch(()=>({outcome:"error",message:"bridge call failed"}));return i.outcome==="available"&&i.version!==void 0&&i.version===n.value&&(n.value=null,lr(cn.updateSkippedVersion)),i},download:()=>{e?.downloadUpdate().catch(()=>{})},install:()=>{e?.installUpdate().catch(()=>{})}}}let a4=null;function u$(){return a4===null&&(a4=Ade(window.kimiDesktop)),a4}const Mde=["data-state"],Tde=["aria-label"],Ede={class:"upd-pill-text"},Ide={key:0,class:"upd-meta"},Lde={key:1,class:"upd-notes"},$de={class:"upd-notes-title"},Nde={key:2,class:"upd-progress"},Fde={key:3,class:"upd-message"},Rde={class:"upd-foot"},Ode={class:"upd-foot-actions"},Pde=tt({__name:"UpdateIndicator",setup(e){const{t,locale:n}=Lt(),{status:o,visible:s,skipVersion:i,download:r,install:l,autoDownload:a,setAutoDownload:u,canToggleAutoDownload:c}=u$(),d=Z(!1),f="0.33.0".trim()?"0.33.0":"",h=R(()=>{switch(o.value.state){case"available":return t("sidebar.update");case"downloading":return`${o.value.percent??0}%`;case"downloaded":return t("sidebar.updateDone");case"error":return t("sidebar.updateFailed");default:return""}}),g=R(()=>{switch(o.value.state){case"available":return t("sidebar.updateAvailable",{version:o.value.version??""});case"downloading":return t("sidebar.updateDownloading",{percent:o.value.percent??0});case"downloaded":return t("sidebar.updateReady",{version:o.value.version??""});case"error":return t("sidebar.updateFailed");default:return""}}),m=R(()=>{const $=o.value.releaseDate;if($===void 0||$==="")return"";const S=new Date($),I=Number.isNaN(S.getTime())?$:S.toLocaleDateString();return t("sidebar.updateReleaseDate",{date:I})}),w=R(()=>{const $=[];return m.value!==""&&$.push(m.value),f!==""&&$.push(t("sidebar.updateCurrentVersion",{version:f})),$.join(" · ")}),_=R(()=>o.value.percent??0),v=R(()=>{const $=o.value.releaseNotes;return $===void 0?"":((n.value.toLowerCase().startsWith("zh")?$.zh:$.en)??$.zh??$.en??"").trim()}),k=R(()=>{switch(o.value.state){case"error":return"alert-triangle";default:return"download"}});function y(){r()}function x(){i(),d.value=!1}function M(){l(),d.value=!1}return($,S)=>p(s)?(b(),A("span",{key:0,class:"upd","data-state":p(o).state},[C("button",{class:"upd-pill",type:"button","aria-label":h.value,onClick:S[0]||(S[0]=I=>d.value=!0)},[V(p(Ie),{class:"upd-pill-icon",name:k.value,size:"sm"},null,8,["name"]),C("span",Ede,N(h.value),1)],8,Tde),V(p(ca),{open:d.value,title:g.value,size:"lg","onUpdate:open":S[4]||(S[4]=I=>d.value=I)},{foot:ke(()=>[C("div",Rde,[C("div",Ode,[p(o).state==="available"?(b(),A(Pe,{key:0},[V(p(Ft),{variant:"ghost",onClick:x},{default:ke(()=>[Ve(N(p(t)("sidebar.updateSkip")),1)]),_:1}),V(p(Ft),{onClick:y},{default:ke(()=>[Ve(N(p(t)("sidebar.updateDownloadNow")),1)]),_:1})],64)):p(o).state==="downloading"?(b(),me(p(Ft),{key:1,variant:"secondary",onClick:S[1]||(S[1]=I=>d.value=!1)},{default:ke(()=>[Ve(N(p(t)("sidebar.updateBackground")),1)]),_:1})):p(o).state==="downloaded"?(b(),A(Pe,{key:2},[V(p(Ft),{variant:"ghost",onClick:S[2]||(S[2]=I=>d.value=!1)},{default:ke(()=>[Ve(N(p(t)("sidebar.updateRestartLater")),1)]),_:1}),V(p(Ft),{onClick:M},{default:ke(()=>[Ve(N(p(t)("sidebar.updateRestartNow")),1)]),_:1})],64)):p(o).state==="error"?(b(),me(p(Ft),{key:3,variant:"danger-soft",onClick:y},{default:ke(()=>[Ve(N(p(t)("sidebar.updateRetry")),1)]),_:1})):te("",!0)]),p(c)?(b(),me(p(eW),{key:0,class:"upd-auto","model-value":p(a),"onUpdate:modelValue":S[3]||(S[3]=I=>p(u)(I))},{default:ke(()=>[Ve(N(p(t)("sidebar.updateAutoDownload")),1)]),_:1},8,["model-value"])):te("",!0)])]),default:ke(()=>[(p(o).state==="available"||p(o).state==="downloaded")&&w.value?(b(),A("p",Ide,N(w.value),1)):te("",!0),v.value?(b(),A("section",Lde,[C("h4",$de,N(p(t)("sidebar.updateWhatsNew")),1),V(p(Ic),{text:v.value},null,8,["text"])])):te("",!0),p(o).state==="downloading"?(b(),A("div",Nde,[C("div",{class:"upd-progress-fill",style:Gt({width:`${_.value}%`})},null,4)])):te("",!0),p(o).state==="error"&&p(o).message?(b(),A("p",Fde,N(p(o).message),1)):te("",!0)]),_:1},8,["open","title"])],8,Mde)):te("",!0)}}),Dde=ht(Pde,[["__scopeId","data-v-fdb68462"]]),mg=[{code:"en",label:"English"},{code:"zh",label:"简体中文"}],Wn=_z({locale:IM()});function A5(e){Wn.global.locale.value=e,Ls(cn.locale,e)}function Bde(){return window.kimiDesktop}function c$(e,t,n){const o=n.length===0?void 0:n.length===1?n[0]:n;try{Bde()?.log?.(e,t,o)}catch{}}function gl(e,...t){console.warn(e,...t),c$("warn",e,t)}function Jl(e,...t){console.error(e,...t),c$("error",e,t)}const Hde=["app:load:start","app:load:complete","export:start","export:accepted","export:failed","prompt:start","prompt:accepted","prompt:failed","session:snapshot:start","session:snapshot:accepted","session:snapshot:failed","operation:failed","window:error","window:unhandled-rejection","ws:connection","ws:error","ws:resync","ws:stale-reconnect"],d$=500,gg=256*1024,K_=200,u4=16384,c4=500,d4=50,f4=50,zde=6,Wde=/api[_-]?key|authorization|token|secret|password|cookie|credential|email|phone|nickname|avatar/i,Ude=/^[A-Za-z0-9+/=_-]{200,}$/;let p4=null;function Qr(){if(p4!==null)return p4;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=li(cn.debug)==="1"),p4=e,e}const Ka=[],Id=[];let A1=0;const Zu=[];let M1=0,jde=1;const vg=new TextEncoder,Vde=new Set(Hde),M5=Z(0),T1=Xr(!1);function qde(){return Ka}function Kde(){Ka.length=0,Id.length=0,A1=0,Zu.length=0,M1=0,M5.value++}function da(e){if(!T1.value){try{const t={id:jde++,ts:Date.now(),source:e.source,kind:String(Zd(e.kind)),label:String(Zd(e.label)),sessionId:e.sessionId===void 0?void 0:String(Zd(e.sessionId)),method:e.method,path:e.path,eventType:e.eventType,seq:e.seq,offset:e.offset,status:e.status,code:e.code,requestId:e.requestId,durationMs:e.durationMs,detail:fu(e.detail)},n=JSON.stringify(t),o=vg.encode(n).byteLength;if(o>gg)return;for(Ka.push(t),Id.push(n),A1+=o+(Id.length>1?1:0);Ka.length>d$||A1>gg;){const s=Id.shift();Ka.shift(),s!==void 0&&(A1-=vg.encode(s).byteLength,Id.length>0&&(A1-=1))}}catch{return}M5.value++}}function Pu(e){if(typeof e=="string")return e.length<=K_?e:e.slice(0,K_)}function pr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function Zde(e,t){if(Vde.has(e))try{const n={ts:Date.now(),event:e,sessionId:Pu(t?.sessionId),status:Pu(t?.status),operation:Pu(t?.operation),seq:pr(t?.seq),durationMs:pr(t?.durationMs),messageCount:pr(t?.messageCount),contentCount:pr(t?.contentCount),mediaCount:pr(t?.mediaCount),sessionCount:pr(t?.sessionCount),workspaceCount:pr(t?.workspaceCount),promptId:Pu(t?.promptId),zipBytes:pr(t?.zipBytes),errorName:Pu(t?.errorName),errorCode:pr(t?.errorCode),requestId:Pu(t?.requestId),phase:Pu(t?.phase),httpStatus:pr(t?.httpStatus),fatal:typeof t?.fatal=="boolean"?t.fatal:void 0,line:pr(t?.line),col:pr(t?.col)},o=JSON.stringify(n),s=vg.encode(o).byteLength;if(s>gg)return;for(Zu.push(o),M1+=s+(Zu.length>1?1:0);Zu.length>d$||M1>gg;){const i=Zu.shift();i!==void 0&&(M1-=vg.encode(i).byteLength,Zu.length>0&&(M1-=1))}}catch{return}}function Zd(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const i=e;return Ude.test(i)?`[base64-like, ${i.length} chars omitted]`:i.length>c4?`${i.slice(0,c4)}… [+${i.length-c4} chars]`:i}if(n!=="object")return String(e);if(t>=zde)return"[max depth]";if(Array.isArray(e)){const i=e.slice(0,d4).map(r=>Zd(r,t+1));return e.length>d4&&i.push(`[+${e.length-d4} more items]`),i}const o={},s=Object.entries(e);for(const[i,r]of s.slice(0,f4))o[i]=Wde.test(i)?"[redacted]":Zd(r,t+1);return s.length>f4&&(o._truncatedKeys=s.length-f4),o}function fu(e){if(e===void 0)return;const t=Zd(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>u4)return{_truncated:`detail JSON was ${n.length} chars; first ${u4} kept`,preview:n.slice(0,u4)}}catch{return"[unserializable detail]"}return t}function Gde(e){Qr()&&da({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:fu(e.body)}})}function Yde(e){if(!Qr())return;const t=e.code!==0;da({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:fu(e.data)}})}function Xde(e){Qr()&&da({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function Jde(e,t){Qr()&&da({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:fu(t)})}function Qde(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=t.payload,s=typeof o?.session_id=="string"?o.session_id:void 0;da({source:"ws",kind:"ws:out",eventType:n,sessionId:s,label:`→ ${n}`,detail:fu(e)})}function efe(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,s=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[o,s!==void 0?`seq=${s}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);da({source:"ws",kind:"ws:in",eventType:n,sessionId:o,seq:s,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:fu(t.payload)})}const tfe={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function nfe(e,t,n){Qr()&&da({source:"client",kind:`client:${e}`,label:`${tfe[e]} ${t}`,detail:fu(n)})}function ofe(e,t){Qr()&&da({source:"client",kind:"client:event",label:`· ${e}`,detail:fu(t)})}function yi(e,t){Zde(e,t),da({source:"client",kind:"client:key",label:e,sessionId:typeof t?.sessionId=="string"?t.sessionId:void 0,seq:typeof t?.seq=="number"?t.seq:void 0,durationMs:typeof t?.durationMs=="number"?t.durationMs:void 0,detail:t})}let h4=!1,Th=null;function sfe(){if(h4)return()=>Th?.();h4=!0;const e=[];try{if(typeof window<"u"){const n=s=>{yi("window:error",{status:"failed",errorName:s.error instanceof Error?s.error.name:"Error",line:s.lineno,col:s.colno}),Jl(`[kimi-web] window error: ${s.message}`,s.error instanceof Error?s.error.stack:void 0)},o=s=>{const i=s.reason;yi("window:unhandled-rejection",{status:"failed",errorName:i instanceof Error?i.name:typeof i}),Jl(`[kimi-web] unhandled rejection: ${rfe(i)}`,i instanceof Error?i.stack:void 0)};window.addEventListener("error",n),window.addEventListener("unhandledrejection",o),e.push(()=>{window.removeEventListener("error",n)}),e.push(()=>{window.removeEventListener("unhandledrejection",o)})}}catch{}if(Qr())for(const n of["error","warn","log","info","debug"]){const o=console[n];if(typeof o!="function")continue;const s=(...i)=>{try{nfe(n,i.map(ife).join(" "),i.length>1?i:i[0])}catch{}o.apply(console,i)};console[n]=s,e.push(()=>{console[n]===s&&(console[n]=o)})}const t=()=>{if(Th===t){for(const n of e.toReversed())n();Th=null,h4=!1}};return Th=t,t}function ife(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function rfe(e){if(e instanceof Error)return e.message;try{return String(e)}catch{return"[unstringifiable reason]"}}function f$(e=Ka){if(typeof document>"u")return;const t=new Blob([lfe(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t);let o;try{o=document.createElement("a"),o.href=n,o.download=`kimi-web-log-${new Date().toISOString().replaceAll(/[:.]/g,"-")}.jsonl`,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(n)}catch{}},0)}}function lfe(e=Ka){return e===Ka?Id.join(` -`):e.map(t=>JSON.stringify(t)).join(` -`)}function afe(){return Zu.join(` -`)}const Ds="kimi-web.server-credential",ufe="token",cfe=10080*60*1e3;let yl;const Q3=new Set;function dfe(){if(typeof window>"u")return;const e=window.location.hash??"";if(!e.startsWith("#"))return;const n=new URLSearchParams(e.slice(1)).get(ufe);if(!n)return;const o=new URL(window.location.href);return o.hash="",window.history.replaceState(window.history.state,"",`${o.pathname}${o.search}`),n}function ey(e){return{version:1,credential:e,expiresAt:Date.now()+cfe}}function ffe(e){return JSON.stringify(e)}function T5(e){try{const t=JSON.parse(e);if(typeof t!="object"||t===null)return;const n=t;return n.version!==1||typeof n.credential!="string"||n.credential.length===0||typeof n.expiresAt!="number"||!Number.isFinite(n.expiresAt)?void 0:{version:1,credential:n.credential,expiresAt:n.expiresAt}}catch{return}}function ty(e){globalThis.localStorage?.setItem(Ds,ffe(e))}function pfe(){try{const e=globalThis.localStorage?.getItem(Ds);if(e){const n=T5(e);if(n===void 0){const o=ey(e);let s=!1;try{ty(o),s=!0}catch{}if(!s)try{globalThis.localStorage?.getItem(Ds)===e&&globalThis.localStorage?.removeItem(Ds),s=!0}catch{}try{globalThis.sessionStorage?.removeItem(Ds)}catch{}return s?o:void 0}if(n.expiresAt>Date.now())return n;globalThis.sessionStorage?.removeItem(Ds),globalThis.localStorage?.getItem(Ds)===e&&globalThis.localStorage?.removeItem(Ds);return}const t=globalThis.sessionStorage?.getItem(Ds);if(t){const n=ey(t);let o=!1;try{ty(n),o=!0}catch{}try{globalThis.sessionStorage?.removeItem(Ds),o=!0}catch{}return o?n:void 0}return}catch{return}}function hfe(){const e=dfe();return e?(p$(e),!0):(yl=pfe(),yl!==void 0)}function mfe(){if(yl!==void 0){if(yl.expiresAt<=Date.now()){gfe(yl);return}return yl.credential}}function gfe(e){yl=void 0;try{globalThis.sessionStorage?.removeItem(Ds);const t=globalThis.localStorage?.getItem(Ds),n=t==null?void 0:T5(t);(n===void 0?t===e.credential:n.credential===e.credential&&n.expiresAt===e.expiresAt)&&globalThis.localStorage?.removeItem(Ds)}catch{}}function p$(e){const t=ey(e);yl=t;try{ty(t)}catch{}try{globalThis.sessionStorage?.removeItem(Ds)}catch{}}function vfe(){const e=yl;yl=void 0;try{const t=globalThis.localStorage?.getItem(Ds),o=(t==null?void 0:T5(t))?.credential??t;e!==void 0&&o===e.credential&&globalThis.localStorage?.removeItem(Ds),globalThis.sessionStorage?.removeItem(Ds)}catch{}}function yfe(e){return Q3.add(e),()=>{Q3.delete(e)}}function kfe(){vfe();for(const e of Q3)try{e()}catch{}}const Z_=cn.clientId,bfe="kimi-code-web",Cfe="web";function wfe(){return{serverHttpUrl:xfe(),clientId:Afe(),clientName:bfe,clientVersion:Mfe(),clientUiMode:Cfe}}function _fe(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function xfe(){const e=h$();return ny(e||void 0)}const G_="kimi-desktop-server-origin";function h$(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("kimi_origin");try{return e?(window.sessionStorage.setItem(G_,e),e):window.sessionStorage.getItem(G_)??void 0}catch{return e??void 0}}function ny(e){const t=e&&e.trim()?e:_fe(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function Y_(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function Sfe(){if(typeof window<"u"){const t=h$();if(t)return Y_(ny(t))}const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return Y_(e)}function Afe(){const e=li(Z_);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return Ls(Z_,t),t}function Mfe(){return"0.33.0".trim()?"0.33.0":"0.0.0-dev"}const Tfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Efe(e,t){return b(),A("svg",Tfe,[...t[0]||(t[0]=[C("path",{d:"M12.0684 2.03418C12.5654 2.03421 12.9687 2.43755 12.9688 2.93457V11.0996H21.0654C21.5625 11.0996 21.9658 11.503 21.9658 12C21.9658 12.497 21.5625 12.9004 21.0654 12.9004H12.9688V21.0654C12.9687 21.5624 12.5654 21.9658 12.0684 21.9658C11.5713 21.9658 11.168 21.5625 11.168 21.0654V12.9004H2.93457C2.43751 12.9004 2.03418 12.4971 2.03418 12C2.03418 11.5029 2.43751 11.0996 2.93457 11.0996H11.168V2.93457C11.168 2.43753 11.5713 2.03418 12.0684 2.03418Z",fill:"currentColor"},null,-1)])])}const Ife=kt({name:"kimi-add",render:Efe}),Lfe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function $fe(e,t){return b(),A("svg",Lfe,[...t[0]||(t[0]=[C("path",{id:"p0",d:"M 0 -9.9 C -5.468 -9.9 -9.9 -5.468 -9.9 0 C -9.9 1.923 -9.351 3.719 -8.402 5.239 C -8.402 5.239 -9.483 7.821 -9.483 7.821 C -9.896 8.809 -9.171 9.9 -8.099 9.9 C -8.099 9.9 0 9.9 0 9.9 C 5.468 9.9 9.9 5.468 9.9 0 C 9.9 -5.468 5.468 -9.9 0 -9.9 Z M -8.1 0 C -8.1 -4.474 -4.474 -8.1 0 -8.1 C 4.473 -8.1 8.1 -4.474 8.1 0 C 8.1 4.473 4.473 8.1 -0.001 8.1 C -0.001 8.1 -7.648 8.1 -7.648 8.1 L -6.365 5.035 C -6.365 5.035 -6.648 4.629 -6.648 4.629 C -7.563 3.317 -8.1 1.723 -8.1 0 Z",transform:"matrix(1 0 0 1 12 12)",fill:"currentColor","fill-rule":"evenodd"},null,-1),C("path",{id:"p1",d:"M 3.6 0.5 L -2.6 0.5 M 0.5 -2.573 L 0.5 3.573",transform:"translate(11.5 11.5)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},null,-1)])])}const Nfe=kt({name:"kimi-add-conversation",render:$fe}),Ffe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Rfe(e,t){return b(),A("svg",Ffe,[...t[0]||(t[0]=[C("path",{d:"M15.0996 12C15.5967 12 16 12.4033 16 12.9004C15.9998 13.3973 15.5965 13.7998 15.0996 13.7998H8.90039C8.40346 13.7998 8.00021 13.3973 8 12.9004C8 12.4033 8.40333 12 8.90039 12H15.0996Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19 3.2002C20.5464 3.2002 21.7998 4.4536 21.7998 6V7C21.7998 8.03565 21.2363 8.93754 20.4004 9.42188V17C20.4004 19.1539 18.6539 20.9004 16.5 20.9004H7.5C5.34609 20.9004 3.59961 19.1539 3.59961 17V9.42188C2.76374 8.93754 2.2002 8.03565 2.2002 7V6C2.2002 4.4536 3.4536 3.2002 5 3.2002H19ZM5.40039 17C5.40039 18.1598 6.3402 19.0996 7.5 19.0996H16.5C17.6598 19.0996 18.5996 18.1598 18.5996 17V9.7998H5.40039V17ZM4.89746 5.00488C4.39333 5.05621 4 5.48232 4 6V7L4.00488 7.10254C4.05278 7.57297 4.42703 7.94722 4.89746 7.99512L5 8H19C19.5523 8 20 7.55228 20 7V6C20 5.44772 19.5523 5 19 5H5L4.89746 5.00488Z",fill:"currentColor"},null,-1)])])}const Ofe=kt({name:"kimi-archive",render:Rfe}),Pfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Dfe(e,t){return b(),A("svg",Pfe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 21.6387C11.7378 21.988 12.3059 21.987 12.6565 21.6364L18.1949 16.098C18.5464 15.7465 18.5464 15.1766 18.1949 14.8252C17.8434 14.4737 17.2736 14.4737 16.9221 14.8252L12.9201 18.8272V3.00002C12.9201 2.50297 12.5171 2.10003 12.0201 2.10003C11.523 2.10003 11.1201 2.50297 11.1201 3.00002V18.8383L7.07554 14.8229C6.7228 14.4727 6.15295 14.4747 5.80275 14.8275C5.45255 15.1802 5.45461 15.7501 5.80735 16.1003L11.386 21.6387Z",fill:"currentColor"},null,-1)])])}const Bfe=kt({name:"kimi-arrow-down",render:Dfe}),Hfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function zfe(e,t){return b(),A("svg",Hfe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.16127 12.814C1.81197 12.4622 1.81299 11.8941 2.16357 11.5435L7.70203 6.00506C8.0535 5.65359 8.62335 5.65359 8.97482 6.00506C9.32629 6.35653 9.32629 6.92638 8.97482 7.27785L4.97276 11.2799H20.8C21.297 11.2799 21.7 11.6829 21.7 12.1799C21.7 12.677 21.297 13.0799 20.8 13.0799H4.96171L8.97712 17.1244C9.32732 17.4772 9.32526 18.047 8.97252 18.3972C8.61978 18.7474 8.04993 18.7454 7.69973 18.3926L2.16127 12.814Z",fill:"currentColor"},null,-1)])])}const Wfe=kt({name:"kimi-arrow-left",render:zfe}),Ufe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function jfe(e,t){return b(),A("svg",Ufe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.4387 12.814C21.788 12.4622 21.787 11.8941 21.4364 11.5436L15.8979 6.0051C15.5464 5.65363 14.9766 5.65363 14.6251 6.0051C14.2737 6.35657 14.2737 6.92642 14.6251 7.27789L18.6272 11.28H2.79998C2.30293 11.28 1.89998 11.6829 1.89998 12.18C1.89998 12.677 2.30293 13.08 2.79998 13.08H18.6382L14.6228 17.1245C14.2726 17.4772 14.2747 18.0471 14.6274 18.3973C14.9802 18.7475 15.55 18.7454 15.9002 18.3927L21.4387 12.814Z",fill:"currentColor"},null,-1)])])}const Vfe=kt({name:"kimi-arrow-right",render:jfe}),qfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Kfe(e,t){return b(),A("svg",qfe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 2.36129C11.7378 2.01198 12.3059 2.013 12.6565 2.36358L18.1949 7.90204C18.5464 8.25351 18.5464 8.82336 18.1949 9.17483C17.8434 9.52631 17.2736 9.52631 16.9221 9.17483L12.9201 5.17277V21C12.9201 21.497 12.5171 21.9 12.0201 21.9C11.523 21.9 11.1201 21.497 11.1201 21V5.16172L7.07554 9.17713C6.7228 9.52733 6.15295 9.52527 5.80275 9.17253C5.45255 8.81979 5.45461 8.24995 5.80735 7.89975L11.386 2.36129Z",fill:"currentColor"},null,-1)])])}const Zfe=kt({name:"kimi-arrow-up",render:Kfe}),Gfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Yfe(e,t){return b(),A("svg",Gfe,[...t[0]||(t[0]=[C("path",{d:"M19.3027 5.9053C19.6542 5.55397 20.2247 5.55388 20.5761 5.9053C20.9273 6.25675 20.9273 6.82734 20.5761 7.17874L9.65911 18.0948C9.30773 18.4461 8.73814 18.446 8.38665 18.0948L3.42376 13.1328C3.0726 12.7814 3.07263 12.2118 3.42376 11.8604C3.77524 11.509 4.34575 11.5089 4.6972 11.8604L9.02239 16.1856L19.3027 5.9053Z",fill:"currentColor"},null,-1)])])}const Xfe=kt({name:"kimi-check",render:Yfe}),Jfe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Qfe(e,t){return b(),A("svg",Jfe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 16.7134C11.743 17.0627 12.3111 17.0617 12.6617 16.7111L19.6364 9.73641C19.9878 9.38494 19.9878 8.81509 19.6364 8.46362C19.2849 8.11215 18.7151 8.11215 18.3636 8.46362L12.023 14.8042L5.63407 8.46132C5.28133 8.11112 4.71149 8.11318 4.36129 8.46592C4.01109 8.81866 4.01314 9.3885 4.36588 9.73871L11.3912 16.7134Z",fill:"currentColor"},null,-1)])])}const e1e=kt({name:"kimi-chevron-down",render:Qfe}),t1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function n1e(e,t){return b(),A("svg",t1e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.1261 12.6088C16.4754 12.257 16.4743 11.6889 16.1238 11.3383L9.14904 4.36363C8.79757 4.01216 8.22772 4.01216 7.87625 4.36363C7.52477 4.7151 7.52477 5.28495 7.87625 5.63642L14.2169 11.977L7.87395 18.3659C7.52375 18.7187 7.52581 19.2885 7.87855 19.6387C8.23129 19.9889 8.80113 19.9869 9.15133 19.6341L16.1261 12.6088Z",fill:"currentColor"},null,-1)])])}const o1e=kt({name:"kimi-chevron-right",render:n1e}),s1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function i1e(e,t){return b(),A("svg",s1e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 8.46132C11.743 8.11202 12.3111 8.11304 12.6617 8.46362L19.6364 15.4383C19.9878 15.7898 19.9878 16.3597 19.6364 16.7111C19.2849 17.0626 18.7151 17.0626 18.3636 16.7111L12.023 10.3705L5.63407 16.7134C5.28133 17.0636 4.71149 17.0616 4.36129 16.7088C4.01109 16.3561 4.01314 15.7862 4.36588 15.436L11.3912 8.46132Z",fill:"currentColor"},null,-1)])])}const r1e=kt({name:"kimi-chevron-up",render:i1e}),l1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function a1e(e,t){return b(),A("svg",l1e,[...t[0]||(t[0]=[C("path",{d:"M11.8999 6.79965C12.397 6.79965 12.7997 7.20235 12.7997 7.69941V11.7266L14.7359 13.6629C15.0873 14.0143 15.0879 14.584 14.7366 14.9355C14.3852 15.287 13.8148 15.287 13.4633 14.9355L11.2632 12.7355C11.0947 12.5668 11.0002 12.338 11.0001 12.0995V7.69941C11.0001 7.20238 11.4029 6.7997 11.8999 6.79965Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 1.89893C17.4677 1.89893 21.9001 6.33147 21.9002 11.7991C21.9002 17.2669 17.4678 21.6993 12 21.6993C6.53228 21.6993 2.09985 17.2669 2.09985 11.7991C2.09998 6.33147 6.53236 1.89893 12 1.89893ZM20.1 11.7998C20.1 7.32616 16.4737 3.69984 12 3.69984C7.5264 3.69984 3.90008 7.32616 3.90008 11.7998C3.90032 16.2732 7.52655 19.8998 12 19.8998C16.4735 19.8998 20.0998 16.2732 20.1 11.7998Z",fill:"currentColor"},null,-1)])])}const u1e=kt({name:"kimi-clock",render:a1e}),c1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function d1e(e,t){return b(),A("svg",c1e,[...t[0]||(t[0]=[C("path",{d:"M17.9542 4.77253C18.3056 4.42106 18.8761 4.42106 19.2276 4.77253C19.579 5.12401 19.579 5.69452 19.2276 6.04597L13.2735 12.0001L19.2276 17.9542C19.5791 18.3056 19.5791 18.8761 19.2276 19.2276C18.8761 19.5791 18.3056 19.5791 17.9542 19.2276L12.0001 13.2735L6.04595 19.2276C5.69451 19.5791 5.12399 19.579 4.77252 19.2276C4.42104 18.8761 4.42104 18.3056 4.77252 17.9542L10.7266 12.0001L4.77252 6.04597C4.42104 5.6945 4.42104 5.124 4.77252 4.77253C5.12399 4.42107 5.69448 4.42106 6.04595 4.77253L12.0001 10.7266L17.9542 4.77253Z",fill:"currentColor"},null,-1)])])}const f1e=kt({name:"kimi-close",render:d1e}),p1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function h1e(e,t){return b(),A("svg",p1e,[...t[0]||(t[0]=[C("path",{d:"M9.85815 11.957C10.9074 11.957 11.7583 12.8083 11.7585 13.8574V19.8574C11.7585 20.3545 11.3552 20.7578 10.8582 20.7578C10.3611 20.7578 9.95776 20.3545 9.95776 19.8574V13.8574C9.95755 13.8024 9.91325 13.7578 9.85815 13.7578H3.85815C3.3611 13.7578 2.95776 13.3545 2.95776 12.8574C2.95798 12.3605 3.36123 11.957 3.85815 11.957H9.85815Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8582 2.95703C13.3551 2.95703 13.7583 3.36054 13.7585 3.85742V9.85742C13.7585 9.91265 13.8029 9.95703 13.8582 9.95703H19.8582C20.3551 9.95703 20.7583 10.3605 20.7585 10.8574C20.7585 11.3545 20.3552 11.7578 19.8582 11.7578H13.8582C12.8088 11.7578 11.9578 10.9068 11.9578 9.85742V3.85742C11.958 3.36054 12.3612 2.95703 12.8582 2.95703Z",fill:"currentColor"},null,-1)])])}const m1e=kt({name:"kimi-collapse",render:h1e}),g1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function v1e(e,t){return b(),A("svg",g1e,[...t[0]||(t[0]=[C("path",{d:"M11.9004 2.19995C17.3678 2.20016 21.7998 6.63285 21.7998 12.1003C21.7996 17.5677 17.3677 21.9995 11.9004 21.9998H3.80078C2.72946 21.9996 2.00334 20.9089 2.41699 19.9207L3.49805 17.3386C2.54871 15.8189 2.00007 14.0226 2 12.1003C2 6.63272 6.43277 2.19995 11.9004 2.19995ZM11.9004 3.99976C7.42688 3.99976 3.7998 7.62684 3.7998 12.1003C3.79989 13.8228 4.33669 15.4175 5.25195 16.7292L5.53516 17.1345L4.25195 20.2H11.8994C16.3727 20.1999 19.9998 16.5736 20 12.1003C20 7.62697 16.3737 3.99997 11.9004 3.99976ZM8.9541 10.8005C9.75473 10.8006 10.4041 11.4491 10.4043 12.2498C10.4043 13.0505 9.75482 13.6998 8.9541 13.7C8.15329 13.7 7.50391 13.0506 7.50391 12.2498C7.50406 11.4491 8.15339 10.8005 8.9541 10.8005ZM15.1533 10.8005C15.9539 10.8006 16.6034 11.4491 16.6035 12.2498C16.6035 13.0505 15.954 13.6998 15.1533 13.7C14.3525 13.7 13.7031 13.0506 13.7031 12.2498C13.7033 11.4491 14.3526 10.8005 15.1533 10.8005Z",fill:"currentColor"},null,-1)])])}const y1e=kt({name:"kimi-comment",render:v1e}),k1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function b1e(e,t){return b(),A("svg",k1e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 7.09961C19.1539 7.09961 20.9004 8.84609 20.9004 11V17C20.9004 19.1539 19.1539 20.9004 17 20.9004H11C8.84609 20.9004 7.09961 19.1539 7.09961 17V11C7.09961 8.84609 8.84609 7.09961 11 7.09961H17ZM11 8.90039C9.8402 8.90039 8.90039 9.8402 8.90039 11V17C8.90039 18.1598 9.8402 19.0996 11 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V11C19.0996 9.8402 18.1598 8.90039 17 8.90039H11Z",fill:"currentColor"},null,-1),C("path",{d:"M13 3.09961C14.4447 3.09961 15.705 3.88644 16.3779 5.0498C16.6265 5.47999 16.4789 6.03049 16.0488 6.2793C15.6186 6.52781 15.0681 6.38029 14.8193 5.9502C14.4548 5.32041 13.776 4.90039 13 4.90039H7C5.8402 4.90039 4.90039 5.8402 4.90039 7V13C4.90039 13.776 5.32041 14.4548 5.9502 14.8193C6.38029 15.0681 6.52781 15.6186 6.2793 16.0488C6.03049 16.4789 5.47999 16.6265 5.0498 16.3779C3.88644 15.705 3.09961 14.4447 3.09961 13V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H13Z",fill:"currentColor"},null,-1)])])}const C1e=kt({name:"kimi-copy",render:b1e}),w1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _1e(e,t){return b(),A("svg",w1e,[...t[0]||(t[0]=[C("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 10.2797 2.43414 8.66074 3.19922 7.24707C3.20172 7.24246 3.20453 7.23801 3.20703 7.2334C3.33385 6.99995 3.47181 6.77351 3.61621 6.55176C3.73214 6.37355 3.85079 6.19744 3.97754 6.02734C5.35905 4.17471 7.36856 2.81959 9.68945 2.27051C9.69952 2.26813 9.70965 2.26602 9.71973 2.26367C9.85224 2.23276 9.98563 2.2043 10.1201 2.17871C10.1542 2.17221 10.1884 2.16631 10.2227 2.16016C10.3466 2.13791 10.4712 2.11724 10.5967 2.09961C10.6301 2.09489 10.6637 2.0913 10.6973 2.08691C10.8216 2.07073 10.9465 2.05552 11.0723 2.04395C11.1125 2.04022 11.153 2.0384 11.1934 2.03516C11.4595 2.0139 11.7284 2 12 2ZM11.9941 3.7998C11.9968 3.86623 12 3.93292 12 4C12 6.76142 9.76142 9 7 9C6.14209 9 5.33517 8.78324 4.62988 8.40234C4.09862 9.48861 3.7998 10.7093 3.7998 12C3.7998 12.4438 3.83644 12.8791 3.9043 13.3037C4.52807 12.5673 5.45945 12.0996 6.5 12.0996C8.37777 12.0996 9.90039 13.6222 9.90039 15.5C9.90039 17.0702 8.83532 18.3903 7.38867 18.7812C8.70267 19.6765 10.2901 20.2002 12 20.2002C12.468 20.2002 12.9264 20.1583 13.373 20.083C13.1323 19.4342 13 18.7327 13 18C13 14.6863 15.6863 12 19 12C19.4098 12 19.8098 12.0416 20.1963 12.1201C20.1969 12.0801 20.2002 12.0401 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998H11.9941ZM19 13.7998C16.6804 13.7998 14.7998 15.6804 14.7998 18C14.7998 18.5617 14.9112 19.0972 15.1113 19.5869C17.5225 18.597 19.3558 16.4929 19.9727 13.9141C19.6605 13.8399 19.3349 13.7998 19 13.7998ZM6.5 13.9004C5.61634 13.9004 4.90039 14.6163 4.90039 15.5C4.90039 16.3837 5.61634 17.0996 6.5 17.0996C7.38366 17.0996 8.09961 16.3837 8.09961 15.5C8.09961 14.6163 7.38366 13.9004 6.5 13.9004ZM15.5 6.09961C16.8255 6.09961 17.9004 7.17452 17.9004 8.5C17.9004 9.82548 16.8255 10.9004 15.5 10.9004C14.1745 10.9004 13.0996 9.82548 13.0996 8.5C13.0996 7.17452 14.1745 6.09961 15.5 6.09961ZM15.5 7.90039C15.1686 7.90039 14.9004 8.16863 14.9004 8.5C14.9004 8.83137 15.1686 9.09961 15.5 9.09961C15.8314 9.09961 16.0996 8.83137 16.0996 8.5C16.0996 8.16863 15.8314 7.90039 15.5 7.90039ZM10.1992 4C8.35326 4.41375 6.74333 5.44923 5.59961 6.87598C6.02235 7.08306 6.49716 7.2002 7 7.2002C8.76731 7.2002 10.1992 5.76731 10.1992 4Z",fill:"currentColor"},null,-1)])])}const x1e=kt({name:"kimi-dark-mode",render:_1e}),S1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function A1e(e,t){return b(),A("svg",S1e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.90002C12.4971 2.90002 12.9 3.30297 12.9 3.80002V12.2939L15.8081 9.38585C16.1595 9.03438 16.7294 9.03438 17.0808 9.38585C17.4323 9.73732 17.4323 10.3072 17.0808 10.6586L12.6364 15.1031C12.4676 15.2719 12.2387 15.3667 12 15.3667C11.7613 15.3667 11.5324 15.2719 11.3636 15.1031L6.91917 10.6586C6.5677 10.3072 6.5677 9.73732 6.91917 9.38585C7.27064 9.03438 7.84049 9.03438 8.19196 9.38585L11.1 12.2939V3.80002C11.1 3.30297 11.503 2.90002 12 2.90002ZM4.00001 13.5874C4.49706 13.5874 4.90001 13.9903 4.90001 14.4874V18.043C4.90001 18.2758 4.99249 18.499 5.1571 18.6636C5.32172 18.8282 5.54498 18.9207 5.77778 18.9207H18.2222C18.455 18.9207 18.6783 18.8283 18.8429 18.6636C19.0075 18.499 19.1 18.2758 19.1 18.043V14.4874C19.1 13.9903 19.5029 13.5874 20 13.5874C20.4971 13.5874 20.9 13.9903 20.9 14.4874V18.043C20.9 18.7531 20.6179 19.4342 20.1157 19.9364C19.6135 20.4386 18.9324 20.7207 18.2222 20.7207H5.77778C5.06759 20.7207 4.38649 20.4386 3.88431 19.9364C3.38213 19.4342 3.10001 18.7531 3.10001 18.043V14.4874C3.10001 13.9903 3.50295 13.5874 4.00001 13.5874Z",fill:"currentColor"},null,-1)])])}const M1e=kt({name:"kimi-download",render:A1e}),T1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function E1e(e,t){return b(),A("svg",T1e,[...t[0]||(t[0]=[C("path",{d:"M18.0179 3.09998C18.3963 3.10003 18.7709 3.17491 19.1205 3.31971C19.4701 3.46454 19.7884 3.67614 20.056 3.94373C20.3237 4.21144 20.5362 4.52965 20.681 4.87928C20.8258 5.22887 20.8997 5.60423 20.8997 5.9828C20.8997 6.36118 20.8257 6.73591 20.681 7.08533C20.5362 7.43497 20.3237 7.75317 20.056 8.02088L17.639 10.4379L9.15756 18.9183C8.5296 19.5463 7.74274 19.992 6.8812 20.2074L4.21811 20.8734C3.91148 20.95 3.5871 20.8596 3.36362 20.6361C3.14017 20.4126 3.05063 20.0883 3.12729 19.7816L3.79233 17.1185C4.00771 16.257 4.45344 15.4701 5.08139 14.8422L15.9798 3.94373C16.5203 3.40346 17.2536 3.09998 18.0179 3.09998ZM19.0003 19.1C19.4972 19.1002 19.8997 19.5034 19.8997 20.0004C19.8995 20.4971 19.4971 20.8996 19.0003 20.8998H12.0003C11.5034 20.8998 11.1001 20.4973 11.0999 20.0004C11.0999 19.5033 11.5033 19.1 12.0003 19.1H19.0003ZM18.0179 4.89979C17.7309 4.89979 17.4553 5.01417 17.2523 5.21717L6.35385 16.1146C5.95661 16.5119 5.67469 17.01 5.53842 17.5551L5.23666 18.7631L6.44467 18.4613C6.98971 18.3251 7.48782 18.0431 7.8851 17.6459L18.7826 6.74744C18.883 6.64702 18.9635 6.52821 19.0179 6.39686C19.0723 6.26558 19.0999 6.1247 19.0999 5.9828C19.0999 5.84075 19.0723 5.69916 19.0179 5.56776C18.9635 5.43645 18.883 5.31757 18.7826 5.21717C18.6821 5.11678 18.5631 5.03716 18.432 4.9828C18.3008 4.92845 18.16 4.89983 18.0179 4.89979Z",fill:"currentColor"},null,-1)])])}const I1e=kt({name:"kimi-edit",render:E1e}),L1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function $1e(e,t){return b(),A("svg",L1e,[...t[0]||(t[0]=[C("path",{d:"M5 11.0996C5.49693 11.0996 5.90018 11.5031 5.90039 12V18C5.90039 18.0552 5.94477 18.0996 6 18.0996H12C12.4969 18.0996 12.9002 18.5031 12.9004 19C12.9004 19.4971 12.4971 19.9004 12 19.9004H6C4.95066 19.9004 4.09961 19.0493 4.09961 18V12C4.09982 11.5031 4.50307 11.0996 5 11.0996ZM18 4.09961C19.0492 4.09961 19.9002 4.95084 19.9004 6V12C19.9004 12.4971 19.4971 12.9004 19 12.9004C18.5029 12.9004 18.0996 12.4971 18.0996 12V6C18.0994 5.94495 18.0551 5.90039 18 5.90039H12C11.5029 5.90039 11.0996 5.49706 11.0996 5C11.0998 4.50312 11.5031 4.09961 12 4.09961H18Z",fill:"currentColor"},null,-1)])])}const N1e=kt({name:"kimi-expand",render:$1e}),F1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function R1e(e,t){return b(),A("svg",F1e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1723 2.1001C13.9413 2.10018 14.6793 2.40592 15.2231 2.94971L19.0512 6.77783C19.595 7.32162 19.9007 8.0596 19.9008 8.82861V18.0005C19.9008 20.1544 18.1543 21.9009 16.0004 21.9009H8.0004C5.84649 21.9009 4.10001 20.1544 4.10001 18.0005V6.00049C4.10001 3.84658 5.84649 2.1001 8.0004 2.1001H13.1723ZM8.0004 3.90088C6.8406 3.90088 5.90079 4.84069 5.90079 6.00049V18.0005C5.90079 19.1603 6.8406 20.1001 8.0004 20.1001H16.0004C17.1602 20.1001 18.1 19.1603 18.1 18.0005V9.90088H15.0004C13.3988 9.90088 12.1 8.60211 12.1 7.00049V3.90088H8.0004ZM13.9008 7.00049C13.9008 7.608 14.3929 8.1001 15.0004 8.1001H17.8217C17.8072 8.08375 17.7933 8.06681 17.7777 8.05127L13.9496 4.22314C13.9339 4.20745 13.9173 4.19286 13.9008 4.17822V7.00049Z",fill:"currentColor"})],-1)])])}const X_=kt({name:"kimi-file",render:R1e}),O1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function P1e(e,t){return b(),A("svg",O1e,[...t[0]||(t[0]=[C("path",{d:"M15.4795 15.4971C15.9765 15.4971 16.3799 15.9004 16.3799 16.3975C16.3799 16.8945 15.9765 17.2978 15.4795 17.2979H8.52051C8.02345 17.2979 7.62012 16.8945 7.62012 16.3975C7.62012 15.9004 8.02345 15.4971 8.52051 15.4971H15.4795Z",fill:"currentColor"},null,-1),C("path",{d:"M12.3359 11.0996C12.8329 11.0997 13.2354 11.503 13.2354 12C13.2354 12.497 12.8329 12.9003 12.3359 12.9004H8.52051C8.02345 12.9004 7.62012 12.4971 7.62012 12C7.62012 11.5029 8.02345 11.0996 8.52051 11.0996H12.3359Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1719 2.09961C13.9408 2.09969 14.6789 2.40555 15.2227 2.94922L19.0508 6.77734C19.5946 7.32113 19.9003 8.05911 19.9004 8.82812V18C19.9004 20.1539 18.1539 21.9004 16 21.9004H8C5.84626 21.9002 4.09961 20.1538 4.09961 18V6C4.09961 3.84621 5.84626 2.09981 8 2.09961H13.1719ZM8 3.90039C6.84037 3.90059 5.90039 4.84032 5.90039 6V18C5.90039 19.1597 6.84037 20.0994 8 20.0996H16C17.1598 20.0996 18.0996 19.1598 18.0996 18V9.90039H15C13.3985 9.90019 12.0996 8.6015 12.0996 7V3.90039H8ZM13.9004 7C13.9004 7.60739 14.3927 8.09941 15 8.09961H17.8213C17.8068 8.08333 17.7928 8.06626 17.7773 8.05078L13.9492 4.22266C13.9335 4.20696 13.9169 4.19237 13.9004 4.17773V7Z",fill:"currentColor"},null,-1)])])}const D1e=kt({name:"kimi-file-text",render:P1e}),B1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H1e(e,t){return b(),A("svg",B1e,[...t[0]||(t[0]=[C("path",{d:"M9.2373 3.7002C10.4169 3.7002 11.5297 4.24779 12.249 5.18262L12.4424 5.43359H18C20.0987 5.43359 21.7998 7.13472 21.7998 9.2334V16.5C21.7998 18.5987 20.0987 20.2998 18 20.2998H6C3.90132 20.2998 2.2002 18.5987 2.2002 16.5V7.5C2.2002 5.40132 3.90132 3.7002 6 3.7002H9.2373ZM6 5.5C4.89543 5.5 4 6.39543 4 7.5V16.5C4 17.6046 4.89543 18.5 6 18.5H18C19.0357 18.5 19.887 17.7128 19.9893 16.7041L20 16.5V9.2334C20 8.19775 19.2128 7.34641 18.2041 7.24414L18 7.2334H12.0479L11.9326 7.22656C11.666 7.19561 11.4205 7.05812 11.2549 6.84277L10.8223 6.28027C10.4437 5.78834 9.85808 5.5 9.2373 5.5H6ZM16 9.59961C16.4971 9.59961 16.9004 10.0029 16.9004 10.5C16.9004 10.9971 16.4971 11.4004 16 11.4004H8C7.50294 11.4004 7.09961 10.9971 7.09961 10.5C7.09961 10.0029 7.50294 9.59961 8 9.59961H16Z",fill:"currentColor"},null,-1)])])}const z1e=kt({name:"kimi-folder",render:H1e}),W1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function U1e(e,t){return b(),A("svg",W1e,[...t[0]||(t[0]=[C("g",null,[C("path",{d:"M18.3623 9.99976L18.209 8.48999C18.2031 8.43161 18.2004 8.37289 18.2002 8.31421C18.1988 8.31196 18.1956 8.30842 18.1904 8.30347C18.1718 8.28559 18.1302 8.26245 18.0713 8.26245H11C10.261 8.26245 9.59753 7.81016 9.32617 7.1228L8.9082 6.06421C8.88101 5.9953 8.85737 5.92501 8.83887 5.85327C8.83778 5.85099 8.833 5.84268 8.81836 5.83179C8.79454 5.81475 8.7549 5.79939 8.70605 5.80054H3.92871C3.86986 5.80054 3.82825 5.82368 3.80957 5.84155C3.80816 5.8429 3.80675 5.84428 3.80566 5.84546L4.47559 14.0955L3.62109 17.5154L5.12109 11.5154C5.34367 10.6251 6.1438 9.99977 7.06152 9.99976H18.3623ZM7.06152 11.7996C6.96976 11.7996 6.88944 11.8629 6.86719 11.9519L5.36719 17.9519C5.33598 18.078 5.43158 18.1999 5.56152 18.2H19.4385C19.5302 18.1999 19.6106 18.1376 19.6328 18.0486L21.1328 12.0486C21.1644 11.9224 21.0686 11.7996 20.9385 11.7996H7.06152ZM20.9385 9.99976C22.2396 9.99977 23.1945 11.2228 22.8789 12.4851L21.3789 18.4851C21.1563 19.3754 20.3562 19.9997 19.4385 19.9998H4.92871C4.41722 19.9998 3.92613 19.8059 3.56445 19.4597C3.20281 19.1135 3.00004 18.6436 3 18.1541L2 5.84644C2.00006 5.35711 2.20311 4.88786 2.56445 4.54175C2.92613 4.19554 3.41722 4.00073 3.92871 4.00073H8.66406C9.10133 3.99051 9.5296 4.1225 9.87793 4.37573C10.2285 4.63118 10.4767 4.99457 10.582 5.40405L11 6.46167H18.0713C18.5828 6.46167 19.0739 6.65648 19.4355 7.00269C19.7971 7.34888 20 7.81883 20 8.30835L20.1719 9.99976H20.9385Z",fill:"currentColor"})],-1)])])}const j1e=kt({name:"kimi-folder-open",render:U1e}),V1e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function q1e(e,t){return b(),A("svg",V1e,[...t[0]||(t[0]=[C("path",{id:"af-p0",d:"M -2.619 -8.3 C -1.815 -8.3 -1.048 -7.97 -0.499 -7.39 C -0.499 -7.39 0.141 -6.712 0.141 -6.712 C 0.141 -6.712 5.75 -6.712 5.75 -6.712 C 7.904 -6.712 9.65 -4.986 9.65 -2.858 C 9.65 -2.858 9.65 -1.71 9.65 -1.71 C 9.65 -1.219 9.247 -0.821 8.75 -0.821 C 8.253 -0.821 7.85 -1.219 7.85 -1.71 C 7.85 -1.71 7.85 -2.858 7.85 -2.858 C 7.849 -4.004 6.91 -4.934 5.75 -4.934 C 5.75 -4.934 -0.207 -4.934 -0.207 -4.934 C -0.484 -4.934 -0.749 -5.047 -0.938 -5.247 C -0.938 -5.247 -1.815 -6.177 -1.815 -6.177 C -2.023 -6.397 -2.315 -6.521 -2.619 -6.521 C -2.619 -6.521 -6.25 -6.521 -6.25 -6.521 C -7.41 -6.521 -8.35 -5.592 -8.35 -4.446 C -8.35 -4.446 -8.35 4.446 -8.35 4.446 C -8.35 5.592 -7.41 6.521 -6.25 6.521 C -6.25 6.521 1.25 6.521 1.25 6.521 C 1.747 6.521 2.15 6.919 2.15 7.41 C 2.15 7.901 1.747 8.3 1.25 8.3 C 1.25 8.3 -6.25 8.3 -6.25 8.3 C -8.404 8.3 -10.15 6.574 -10.15 4.446 C -10.15 4.446 -10.15 -4.446 -10.15 -4.446 C -10.15 -6.574 -8.404 -8.3 -6.25 -8.3 C -6.25 -8.3 -2.619 -8.3 -2.619 -8.3 Z M 3.75 -2.5 C 4.247 -2.5 4.65 -2.097 4.65 -1.6 C 4.65 -1.103 4.247 -0.699 3.75 -0.699 C 3.75 -0.699 -4.25 -0.699 -4.25 -0.699 C -4.747 -0.699 -5.15 -1.103 -5.15 -1.6 C -5.15 -2.097 -4.747 -2.5 -4.25 -2.5 C -4.25 -2.5 3.75 -2.5 3.75 -2.5 Z",transform:"matrix(1 0 0 1 11.75 12)",fill:"currentColor"},null,-1),C("g",{id:"af-p1"},[C("path",{d:"M 2.635 0 L -2.635 0 M 0 -2.635 L 0 2.635",transform:"matrix(1 0 0 1 18.4 16.3)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"})],-1)])])}const K1e=kt({name:"kimi-folder-plus",render:q1e}),Z1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G1e(e,t){return b(),A("svg",Z1e,[...t[0]||(t[0]=[C("path",{d:"M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3ZM12 19.2002C15.9764 19.2002 19.2002 15.9764 19.2002 12C19.2002 8.02355 15.9764 4.7998 12 4.7998V19.2002Z",fill:"currentColor"},null,-1)])])}const Y1e=kt({name:"kimi-follow-system",render:G1e}),X1e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J1e(e,t){return b(),A("svg",X1e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7ZM12 15.6992C12.4968 15.6992 12.8994 16.1028 12.8994 16.5996C12.8994 17.0964 12.4968 17.5 12 17.5C11.5024 17.5 11.0996 17.0964 11.0996 16.5996C11.0996 16.1028 11.5024 15.6992 12 15.6992ZM12 6.49902C12.4969 6.49922 12.8994 6.86908 12.8994 7.3252V13.6729C12.8994 14.129 12.4969 14.4988 12 14.499C11.5029 14.499 11.0996 14.1291 11.0996 13.6729V7.3252C11.0996 6.86896 11.5029 6.49902 12 6.49902Z",fill:"currentColor"},null,-1)])])}const Q1e=kt({name:"kimi-full-access",render:J1e}),epe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function tpe(e,t){return b(),A("svg",epe,[...t[0]||(t[0]=[C("path",{d:"M12.5092 2.11279C17.7402 2.37781 21.8998 6.70364 21.8998 12.0005C21.8996 17.4153 17.5524 21.8108 12.1576 21.895C12.1056 21.898 12.0532 21.8999 12.0004 21.8999C11.948 21.8999 11.8954 21.8968 11.8432 21.896L11.8422 21.895C6.44751 21.8107 2.10022 17.4152 2.10001 12.0005C2.10001 6.53287 6.53278 2.1001 12.0004 2.1001L12.5092 2.11279ZM8.92715 13.0005C9.02896 14.9787 9.42581 16.721 9.99356 17.9985C10.3249 18.7441 10.6971 19.292 11.0639 19.6411C11.4259 19.9855 11.741 20.1001 12.0004 20.1001C12.2598 20.1 12.5749 19.9856 12.9369 19.6411C13.3037 19.292 13.6749 18.7441 14.0063 17.9985C14.574 16.721 14.9718 14.9788 15.0736 13.0005H8.92715ZM3.96329 13.0005C4.31462 15.8522 6.14714 18.2427 8.66837 19.3823C8.55544 19.1733 8.44916 18.9552 8.34903 18.73C7.66574 17.1926 7.22657 15.1926 7.12344 13.0005H3.96329ZM16.8764 13.0005C16.7732 15.1926 16.3341 17.1926 15.6508 18.73C15.5506 18.9554 15.4435 19.1732 15.3305 19.3823C17.8522 18.2429 19.6851 15.8525 20.0365 13.0005H16.8764ZM8.66934 4.6167C6.08869 5.78266 4.22826 8.25964 3.93985 11.1997H7.11661C7.20176 8.92954 7.64512 6.85497 8.34903 5.271C8.4494 5.04516 8.5561 4.82619 8.66934 4.6167ZM12.0004 3.8999C11.7411 3.8999 11.4259 4.01454 11.0639 4.35889C10.6971 4.70797 10.3249 5.25587 9.99356 6.00146C9.40671 7.32188 9.00186 9.13885 8.91739 11.1997H15.0834C14.9989 9.13884 14.5931 7.32189 14.0063 6.00146C13.6749 5.2559 13.3037 4.70796 12.9369 4.35889C12.5749 4.0144 12.2598 3.90002 12.0004 3.8999ZM15.3295 4.61572C15.443 4.82559 15.5502 5.04471 15.6508 5.271C16.3547 6.85498 16.799 8.92949 16.8842 11.1997H20.06C19.7715 8.25914 17.9108 5.78143 15.3295 4.61572Z",fill:"currentColor"},null,-1)])])}const npe=kt({name:"kimi-globe",render:tpe}),ope={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function spe(e,t){return b(),A("svg",ope,[...t[0]||(t[0]=[C("path",{d:"M8 17C8.82834 17 9.5 17.6717 9.5 18.5C9.5 19.3283 8.82834 20 8 20C7.17166 20 6.5 19.3283 6.5 18.5C6.5 17.6717 7.17166 17 8 17ZM16 17C16.8283 17 17.5 17.6717 17.5 18.5C17.5 19.3283 16.8283 20 16 20C15.1717 20 14.5 19.3283 14.5 18.5C14.5 17.6717 15.1717 17 16 17ZM8 10.5C8.82834 10.5 9.5 11.1717 9.5 12C9.5 12.8283 8.82834 13.5 8 13.5C7.17166 13.5 6.5 12.8283 6.5 12C6.5 11.1717 7.17166 10.5 8 10.5ZM16 10.5C16.8283 10.5 17.5 11.1717 17.5 12C17.5 12.8283 16.8283 13.5 16 13.5C15.1717 13.5 14.5 12.8283 14.5 12C14.5 11.1717 15.1717 10.5 16 10.5ZM8 4C8.82834 4 9.5 4.67166 9.5 5.5C9.5 6.32834 8.82834 7 8 7C7.17166 7 6.5 6.32834 6.5 5.5C6.5 4.67166 7.17166 4 8 4ZM16 4C16.8283 4 17.5 4.67166 17.5 5.5C17.5 6.32834 16.8283 7 16 7C15.1717 7 14.5 6.32834 14.5 5.5C14.5 4.67166 15.1717 4 16 4Z",fill:"currentColor"},null,-1)])])}const ipe=kt({name:"kimi-grip",render:spe}),rpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function lpe(e,t){return b(),A("svg",rpe,[...t[0]||(t[0]=[C("path",{d:"M7.22264 6.10352C7.22264 5.5078 7.48259 4.95449 7.91405 4.56055C8.34271 4.16918 8.90831 3.96198 9.48241 3.96191C9.64155 3.96191 9.80001 3.97936 9.95507 4.01074C10.0127 3.5042 10.2586 3.04178 10.6338 2.69922C11.0625 2.30778 11.6279 2.09961 12.2021 2.09961C12.7763 2.09966 13.3418 2.30783 13.7705 2.69922C13.9947 2.90401 14.1709 3.15244 14.29 3.42676C14.4947 3.37044 14.7071 3.34182 14.9209 3.3418C15.4951 3.3418 16.0605 3.549 16.4892 3.94043C16.8644 4.28293 17.1093 4.74548 17.167 5.25195C17.3223 5.22045 17.4812 5.20312 17.6406 5.20312C18.2147 5.20318 18.7803 5.41135 19.209 5.80273C19.6402 6.19663 19.9004 6.74922 19.9004 7.34473V14.6543C19.9004 17.413 19.2914 19.0434 18.0137 20.21C16.82 21.2998 15.2175 21.9004 13.5615 21.9004C11.7538 21.9004 10.2315 21.5696 8.95702 20.8535C7.67664 20.1341 6.71683 19.0652 5.97362 17.708L3.3496 12.916C3.18848 12.6213 3.10112 12.2914 3.0996 11.9531C3.09812 11.6147 3.18309 11.2835 3.34179 10.9873C3.5001 10.692 3.72639 10.4416 3.99706 10.251C4.26771 10.0604 4.57776 9.93235 4.90136 9.87305C5.56617 9.75102 6.25934 9.84517 6.86425 10.1445C6.9942 10.2088 7.11461 10.2788 7.22264 10.3477V6.10352ZM9.02343 12.7969C9.02336 13.1912 8.76624 13.5395 8.38964 13.6562C8.0129 13.773 7.60387 13.6309 7.38085 13.3057L6.53514 12.0723C6.51218 12.0529 6.48411 12.0282 6.45018 12.002C6.34595 11.9213 6.20986 11.8289 6.06639 11.7578C5.81525 11.6335 5.51637 11.5904 5.22655 11.6436H5.22557C5.15055 11.6573 5.08558 11.6865 5.03417 11.7227C4.98289 11.7588 4.94815 11.7998 4.92772 11.8379C4.90762 11.8755 4.90023 11.9122 4.90038 11.9453C4.90057 11.9782 4.9084 12.0144 4.9287 12.0518L7.55272 16.8438C8.16912 17.9693 8.90989 18.7622 9.83886 19.2842C10.7737 19.8094 11.9704 20.0996 13.5615 20.0996C14.7902 20.0996 15.9536 19.6533 16.7998 18.8809C17.5619 18.185 18.0996 17.1383 18.0996 14.6543V7.34473C18.0996 7.28204 18.0734 7.20342 17.9951 7.13184C17.9139 7.05771 17.7875 7.00396 17.6406 7.00391C17.4937 7.00391 17.3674 7.05771 17.2861 7.13184C17.2077 7.20347 17.1807 7.28199 17.1807 7.34473V11.0693C17.1805 11.5661 16.778 11.9685 16.2812 11.9688C15.7843 11.9688 15.381 11.5662 15.3808 11.0693V5.48242C15.3808 5.41973 15.3537 5.34107 15.2754 5.26953C15.1941 5.19547 15.0677 5.1416 14.9209 5.1416C14.774 5.14166 14.6476 5.19541 14.5664 5.26953C14.4881 5.34105 14.462 5.41974 14.4619 5.48242V11.0693C14.4617 11.5662 14.0584 11.9688 13.5615 11.9688C13.0646 11.9687 12.6613 11.5662 12.6611 11.0693V4.24121C12.6611 4.17852 12.635 4.09989 12.5566 4.02832C12.4754 3.95419 12.349 3.90045 12.2021 3.90039C12.0552 3.90039 11.9289 3.95421 11.8476 4.02832C11.7692 4.09992 11.7422 4.17849 11.7422 4.24121V11.0693C11.742 11.5661 11.3395 11.9685 10.8428 11.9688C10.3458 11.9688 9.94257 11.5662 9.94237 11.0693V6.10352L9.93651 6.05371C9.92534 6.00177 9.89573 5.94433 9.8369 5.89062C9.75567 5.81647 9.62938 5.76172 9.48241 5.76172C9.33554 5.76179 9.2091 5.81651 9.12792 5.89062C9.04964 5.96222 9.02343 6.04084 9.02343 6.10352V12.7969Z",fill:"currentColor"},null,-1)])])}const ape=kt({name:"kimi-hand",render:lpe}),upe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function cpe(e,t){return b(),A("svg",upe,[...t[0]||(t[0]=[C("path",{d:"M4 3.33203C4.55224 3.33203 4.99993 3.7798 5 4.33203V18.0908H20.0674C20.6195 18.0908 21.0671 18.5388 21.0674 19.0908C21.0674 19.6431 20.6197 20.0908 20.0674 20.0908H5C3.89543 20.0908 3 19.1954 3 18.0908V4.33203C3.00007 3.7798 3.44776 3.33203 4 3.33203ZM8.19922 9.28418C8.7515 9.28418 9.19922 9.73189 9.19922 10.2842V15.6045C9.19908 16.1567 8.75142 16.6045 8.19922 16.6045C7.64719 16.6043 7.19936 16.1565 7.19922 15.6045V10.2842C7.19922 9.73202 7.6471 9.28438 8.19922 9.28418ZM17.2227 6.85645C17.7748 6.85658 18.2226 7.3043 18.2227 7.85645V15.6045C18.2225 16.1566 17.7747 16.6044 17.2227 16.6045C16.6705 16.6045 16.2228 16.1566 16.2227 15.6045V7.85645C16.2227 7.30422 16.6704 6.85645 17.2227 6.85645ZM12.7109 3.96387C13.2631 3.96387 13.7107 4.41175 13.7109 4.96387V15.6035C13.7109 16.1558 13.2632 16.6035 12.7109 16.6035C12.1587 16.6035 11.7109 16.1558 11.7109 15.6035V4.96387C11.7111 4.41175 12.1588 3.96387 12.7109 3.96387Z",fill:"currentColor"},null,-1)])])}const dpe=kt({name:"kimi-histogram",render:cpe}),fpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ppe(e,t){return b(),A("svg",fpe,[...t[0]||(t[0]=[C("path",{d:"M8.00916 7.50488C8.47326 7.50488 8.91828 7.68943 9.24646 8.01758C9.57465 8.34577 9.75916 8.79075 9.75916 9.25488C9.75916 9.71901 9.57465 10.164 9.24646 10.4922C8.91828 10.8203 8.47326 11.0049 8.00916 11.0049C7.54507 11.0049 7.10001 10.8203 6.77185 10.4922C6.4437 10.164 6.25916 9.71898 6.25916 9.25488C6.25916 8.79078 6.4437 8.34576 6.77185 8.01758C7.10001 7.68942 7.54507 7.50492 8.00916 7.50488Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17.8998 4.09961C20.0537 4.09961 21.8002 5.84609 21.8002 8V16C21.8002 18.1539 20.0537 19.9004 17.8998 19.9004H5.89978C3.74598 19.9003 1.99939 18.1538 1.99939 16V8C1.99939 5.84617 3.74598 4.09974 5.89978 4.09961H17.8998ZM15.4867 12.2539C15.448 12.2184 15.3885 12.2192 15.351 12.2559L11.7338 15.8027C11.0146 16.5079 9.87305 16.5222 9.13708 15.835L6.98669 13.8262C6.95049 13.7924 6.89516 13.791 6.85681 13.8223L3.82361 16.2988C3.96873 17.3168 4.84165 18.0995 5.89978 18.0996H17.8998C18.9375 18.0996 19.7964 17.3466 19.9662 16.3574L15.4867 12.2539ZM5.89978 5.90039C4.74009 5.90052 3.80017 6.84028 3.80017 8V14.002L5.73181 12.4238C6.46046 11.8286 7.51253 11.8634 8.20056 12.5059L10.351 14.5146C10.3897 14.5508 10.4498 14.5497 10.4877 14.5127L14.1049 10.9658C14.819 10.2656 15.9506 10.2466 16.6879 10.9219L19.9994 13.9551V8C19.9994 6.8402 19.0596 5.90039 17.8998 5.90039H5.89978Z",fill:"currentColor"},null,-1)])])}const hpe=kt({name:"kimi-image",render:ppe}),mpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function gpe(e,t){return b(),A("svg",mpe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.09375 2.81174C5.4825 2.50796 6.04376 2.56488 6.34766 2.93869L20.1855 19.9602C20.4895 20.3341 20.421 20.8836 20.0322 21.1877C19.6435 21.4917 19.0823 21.4355 18.7783 21.0617L17.9971 20.1008H5.99609C3.84224 20.1008 2.0958 18.3552 2.0957 16.2014V8.13889C2.09589 6.26755 3.41429 4.70428 5.17285 4.32639L4.93945 4.03928C4.63577 3.66536 4.7051 3.11573 5.09375 2.81174ZM7.13184 14.1096C7.09416 14.0738 7.03659 14.0713 6.99609 14.1037L3.92871 16.5569C4.09761 17.5472 4.95753 18.301 5.99609 18.301H16.5342L13.373 14.4133L11.9072 15.9455C11.1531 16.7324 9.92202 16.7621 9.13281 16.0119L7.13184 14.1096ZM5.99609 6.03928C4.83643 6.03928 3.89669 6.97927 3.89648 8.13889V14.1408L5.83496 12.5901C6.60469 11.9742 7.69929 12.022 8.41504 12.7024L10.416 14.6037C10.4575 14.6431 10.5218 14.642 10.5615 14.6008L12.1641 12.926L9.78906 10.0051C9.70282 10.2646 9.55682 10.5038 9.35645 10.7004C9.02202 11.0285 8.56767 11.2131 8.09473 11.2131C7.62195 11.213 7.1683 11.0284 6.83398 10.7004C6.49961 10.3724 6.31152 9.92701 6.31152 9.46311C6.3116 8.99941 6.49981 8.55474 6.83398 8.22678C7.12986 7.93654 7.51931 7.75901 7.93262 7.7219L6.56543 6.03928H5.99609Z",fill:"currentColor"},null,-1),C("path",{d:"M18.0049 4.31272C20.1587 4.31288 21.9043 6.0593 21.9043 8.21311V13.718C21.9039 15.4743 19.7248 16.2906 18.5713 14.966L14.9141 10.7658C14.5882 10.3912 14.6278 9.82271 15.002 9.49631C15.3768 9.16994 15.9451 9.20948 16.2715 9.5842L19.9287 13.7844C19.9528 13.812 19.9696 13.8167 19.9775 13.8186C19.9908 13.8216 20.0141 13.8213 20.04 13.8117C20.0655 13.8021 20.0826 13.7875 20.0908 13.7766C20.0955 13.7702 20.1044 13.7552 20.1045 13.718V8.21311C20.1045 7.05341 19.1645 6.11366 18.0049 6.1135H10.6328C10.1361 6.11327 9.73267 5.70981 9.73242 5.21311C9.73242 4.71619 10.136 4.31295 10.6328 4.31272H18.0049Z",fill:"currentColor"},null,-1)])])}const vpe=kt({name:"kimi-image-failed",render:gpe}),ype={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function kpe(e,t){return b(),A("svg",ype,[...t[0]||(t[0]=[C("path",{d:"M12 2.1001C17.4676 2.10031 21.8994 6.53286 21.8994 12.0005C21.8992 17.4679 17.4674 21.8997 12 21.8999C6.53237 21.8999 2.09982 17.4681 2.09961 12.0005C2.09961 6.53273 6.53224 2.1001 12 2.1001ZM12 3.8999C7.52636 3.8999 3.89941 7.52684 3.89941 12.0005C3.89963 16.474 7.52649 20.1001 12 20.1001C16.4733 20.0999 20.0994 16.4738 20.0996 12.0005C20.0996 7.52697 16.4735 3.90011 12 3.8999ZM12 9.50049C12.4969 9.50068 12.8994 9.87055 12.8994 10.3267V16.6743C12.8992 17.1303 12.4968 17.5003 12 17.5005C11.503 17.5005 11.0998 17.1304 11.0996 16.6743V10.3267C11.0996 9.87043 11.5029 9.50049 12 9.50049ZM12 6.49951C12.4968 6.49951 12.8994 6.90313 12.8994 7.3999C12.8992 7.8965 12.4966 8.30029 12 8.30029C11.5025 8.30028 11.0998 7.8965 11.0996 7.3999C11.0996 6.90313 11.5024 6.49952 12 6.49951Z",fill:"currentColor"},null,-1)])])}const bpe=kt({name:"kimi-info",render:kpe}),Cpe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function wpe(e,t){return b(),A("svg",Cpe,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const _pe=kt({name:"kimi-left-panel",render:wpe}),xpe={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function Spe(e,t){return b(),A("svg",xpe,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow-expand",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const Ape=kt({name:"kimi-left-panel-expand",render:Spe}),Mpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Tpe(e,t){return b(),A("svg",Mpe,[...t[0]||(t[0]=[Ac('',1)])])}const Epe=kt({name:"kimi-light-mode",render:Tpe}),Ipe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Lpe(e,t){return b(),A("svg",Ipe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.97427 8.06961C4.99348 7.33581 6.18946 7.1 7.00001 7.1H9.00001C9.49706 7.1 9.90001 7.50294 9.90001 8C9.90001 8.49706 9.49706 8.9 9.00001 8.9H7.00001C6.47755 8.9 5.67353 9.06419 5.02599 9.53039C4.42434 9.96356 3.90001 10.6934 3.90001 12C3.90001 13.3066 4.42434 14.0364 5.02599 14.4696C5.67353 14.9358 6.47755 15.1 7.00001 15.1H9.00001C9.49706 15.1 9.90001 15.5029 9.90001 16C9.90001 16.4971 9.49706 16.9 9.00001 16.9H7.00001C6.18946 16.9 4.99348 16.6642 3.97427 15.9304C2.90917 15.1636 2.10001 13.8934 2.10001 12C2.10001 10.1066 2.90917 8.83644 3.97427 8.06961ZM14.1 8C14.1 7.50294 14.5029 7.1 15 7.1H17C17.8105 7.1 19.0065 7.33581 20.0257 8.06961C21.0908 8.83644 21.9 10.1066 21.9 12C21.9 13.8934 21.0908 15.1636 20.0257 15.9304C19.0065 16.6642 17.8105 16.9 17 16.9H15C14.5029 16.9 14.1 16.4971 14.1 16C14.1 15.5029 14.5029 15.1 15 15.1H17C17.5225 15.1 18.3265 14.9358 18.974 14.4696C19.5757 14.0364 20.1 13.3066 20.1 12C20.1 10.6934 19.5757 9.96356 18.974 9.53039C18.3265 9.06419 17.5225 8.9 17 8.9H15C14.5029 8.9 14.1 8.49706 14.1 8ZM7.10001 12C7.10001 11.5029 7.50295 11.1 8.00001 11.1H16C16.4971 11.1 16.9 11.5029 16.9 12C16.9 12.4971 16.4971 12.9 16 12.9H8.00001C7.50295 12.9 7.10001 12.4971 7.10001 12Z",fill:"currentColor"},null,-1)])])}const $pe=kt({name:"kimi-link",render:Lpe}),Npe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Fpe(e,t){return b(),A("svg",Npe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.10001 5.99998C4.10001 5.50292 4.50295 5.09998 5.00001 5.09998H19C19.4971 5.09998 19.9 5.50292 19.9 5.99998C19.9 6.49703 19.4971 6.89998 19 6.89998H5.00001C4.50295 6.89998 4.10001 6.49703 4.10001 5.99998ZM4.10001 12C4.10001 11.5029 4.50295 11.1 5.00001 11.1H19C19.4971 11.1 19.9 11.5029 19.9 12C19.9 12.497 19.4971 12.9 19 12.9H5.00001C4.50295 12.9 4.10001 12.497 4.10001 12ZM4.10001 18C4.10001 17.5029 4.50295 17.1 5.00001 17.1H19C19.4971 17.1 19.9 17.5029 19.9 18C19.9 18.497 19.4971 18.9 19 18.9H5.00001C4.50295 18.9 4.10001 18.497 4.10001 18Z",fill:"currentColor"},null,-1)])])}const Rpe=kt({name:"kimi-list",render:Fpe}),Ope={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ppe(e,t){return b(),A("svg",Ope,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 4.09961C20.1539 4.09961 21.9004 5.84609 21.9004 8V16C21.9004 18.1539 20.1539 19.9004 18 19.9004H6C3.84609 19.9004 2.09961 18.1539 2.09961 16V8C2.09961 5.84609 3.84609 4.09961 6 4.09961H18ZM3.90039 16C3.90039 17.1598 4.8402 18.0996 6 18.0996H18C19.1598 18.0996 20.0996 17.1598 20.0996 16V9.49805L13.5361 13.5361C12.5955 14.1147 11.4075 14.1084 10.4727 13.5205L3.90039 9.38672V16ZM6 5.90039C5.0746 5.90039 4.29039 6.49909 4.01074 7.33008L11.4316 11.9971C11.7861 12.2199 12.2361 12.2222 12.5928 12.0029L20.0195 7.43457C19.7725 6.54993 18.9636 5.90039 18 5.90039H6Z",fill:"currentColor"})],-1)])])}const Dpe=kt({name:"kimi-mail",render:Ppe}),Bpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hpe(e,t){return b(),A("svg",Bpe,[...t[0]||(t[0]=[C("path",{d:"M17 11.0996C17.4971 11.0996 17.9004 11.5029 17.9004 12C17.9004 12.4971 17.4971 12.9004 17 12.9004H7C6.50294 12.9004 6.09961 12.4971 6.09961 12C6.09961 11.5029 6.50294 11.0996 7 11.0996H17Z",fill:"currentColor"},null,-1)])])}const zpe=kt({name:"kimi-minus",render:Hpe}),Wpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Upe(e,t){return b(),A("svg",Wpe,[...t[0]||(t[0]=[C("path",{d:"M15.182 3.32802C15.9304 2.72235 17.0309 2.76978 17.724 3.46767L18.5424 4.29189L18.6722 4.43642C19.2377 5.13495 19.234 6.1404 18.6635 6.83486L18.5326 6.97841L18.0248 7.48232C17.9549 7.55172 17.8793 7.61254 17.8021 7.66884C17.9794 8.18027 17.9316 8.7498 17.6595 9.22841C17.6847 9.24522 17.7091 9.2635 17.7328 9.2831L17.8002 9.3456L17.9847 9.53798C19.8515 11.5442 20.4549 14.0022 19.6224 16.2196C19.1921 17.3657 18.4025 18.3827 17.2992 19.203H19.0873L19.1801 19.2079C19.6337 19.2542 19.9877 19.6375 19.9877 20.1034C19.9876 20.5692 19.6337 20.9527 19.1801 20.9989L19.0873 21.0028H13.0385C13.0244 21.0033 13.0104 21.0031 12.9965 21.0028H4.9115C4.41448 21.0028 4.01117 20.6004 4.01111 20.1034C4.01111 19.6064 4.41444 19.203 4.9115 19.203H12.9047C15.7614 18.5471 17.3679 17.1023 17.9369 15.5868C18.4678 14.1726 18.179 12.4782 16.807 10.9188L16.5189 10.6093L16.4574 10.5399C16.4549 10.5368 16.453 10.5333 16.4506 10.5302L12.3011 14.6522C11.6031 15.3454 10.5023 15.3845 9.75818 14.7733L9.61365 14.6425L7.31091 12.3231C6.5717 11.5786 6.57617 10.376 7.32068 9.63662L12.3676 4.62392L12.5121 4.49404C13.0358 4.06988 13.7318 3.96755 14.3402 4.18251C14.3969 4.10597 14.4591 4.03197 14.5287 3.96279L15.0365 3.45791L15.182 3.32802ZM4.83044 12.9335C5.16112 12.6052 5.68305 12.5863 6.03552 12.8759L6.10291 12.9384L9.07361 15.9286L9.13513 15.997C9.42218 16.3514 9.3992 16.8727 9.06873 17.2011C8.7381 17.5294 8.21712 17.5482 7.86462 17.2587L7.79626 17.1972L4.82654 14.2069L4.76501 14.1376C4.47792 13.7831 4.49979 13.2619 4.83044 12.9335ZM13.6693 5.87978L13.6361 5.90126L8.58826 10.914C8.54935 10.9529 8.54943 11.0165 8.58826 11.0556L10.891 13.3739L10.9242 13.3964C10.9602 13.4111 11.0032 13.404 11.0326 13.3749L16.0795 8.3622L16.1019 8.329C16.1117 8.3049 16.1117 8.2779 16.1019 8.2538L16.0804 8.2206L13.7777 5.90224C13.7486 5.87289 13.7054 5.86535 13.6693 5.87978ZM16.3383 4.71376L16.3051 4.73525L15.7972 5.24013C15.7584 5.27904 15.7585 5.34166 15.7972 5.38076L16.6146 6.20498L16.6478 6.22744C16.6838 6.24221 16.7268 6.23487 16.7562 6.20595L17.264 5.70107L17.2865 5.66787C17.2962 5.64382 17.2963 5.61672 17.2865 5.59267L17.265 5.55947L16.4467 4.73623C16.4174 4.70681 16.3744 4.6992 16.3383 4.71376Z",fill:"currentColor"},null,-1)])])}const jpe=kt({name:"kimi-microscope",render:Upe}),Vpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function qpe(e,t){return b(),A("svg",Vpe,[...t[0]||(t[0]=[C("path",{d:"M6 12C6 12.8283 5.32834 13.5 4.5 13.5C3.67166 13.5 3 12.8283 3 12C3 11.1717 3.67166 10.5 4.5 10.5C5.32834 10.5 6 11.1717 6 12Z",fill:"currentColor"},null,-1),C("path",{d:"M13.5 12C13.5 12.8283 12.8283 13.5 12 13.5C11.1717 13.5 10.5 12.8283 10.5 12C10.5 11.1717 11.1717 10.5 12 10.5C12.8283 10.5 13.5 11.1717 13.5 12Z",fill:"currentColor"},null,-1),C("path",{d:"M19.5002 13.5C20.3287 13.5 21 12.8287 21 12.0002C21 11.1718 20.3287 10.5 19.5002 10.5C18.6718 10.5 18 11.1718 18 12.0002C18 12.8287 18.6718 13.5 19.5002 13.5Z",fill:"currentColor"},null,-1)])])}const Kpe=kt({name:"kimi-more",render:qpe}),Zpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Gpe(e,t){return b(),A("svg",Zpe,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 12.0993C8.49691 12.0993 8.90016 12.5028 8.90039 12.9997V17.9997C8.90039 19.6013 7.60163 20.9001 6 20.9001C4.39837 20.9001 3.09961 19.6013 3.09961 17.9997C3.09984 16.3982 4.39852 15.0993 6 15.0993C6.38939 15.0993 6.76033 15.1778 7.09961 15.317V12.9997C7.09984 12.5028 7.50309 12.0993 8 12.0993ZM6 16.9001C5.39263 16.9001 4.90062 17.3923 4.90039 17.9997C4.90039 18.6072 5.39249 19.0993 6 19.0993C6.60751 19.0993 7.09961 18.6072 7.09961 17.9997C7.09938 17.3923 6.60737 16.9001 6 16.9001Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.627 3.35611C19.8025 3.12106 20.9001 4.02068 20.9004 5.21939V15.9997C20.9004 17.6013 19.6016 18.9001 18 18.9001C16.3984 18.9001 15.0996 17.6013 15.0996 15.9997C15.0998 14.3982 16.3985 13.0993 18 13.0993C18.3894 13.0993 18.7603 13.1778 19.0996 13.317V9.21939C19.0993 9.15657 19.0421 9.10946 18.9805 9.12173L12.6768 10.3825C12.1894 10.4799 11.7148 10.1637 11.6172 9.67642C11.52 9.18922 11.8361 8.71439 12.3232 8.61685L18.627 7.35611C18.7868 7.32415 18.9452 7.31502 19.0996 7.32291V5.21939C19.0993 5.15657 19.0421 5.10946 18.9805 5.12173L12.6768 6.38248C12.1894 6.47994 11.7148 6.16372 11.6172 5.67642C11.52 5.18922 11.8361 4.71439 12.3232 4.61685L18.627 3.35611ZM18 14.9001C17.3926 14.9001 16.9006 15.3923 16.9004 15.9997C16.9004 16.6072 17.3925 17.0993 18 17.0993C18.6075 17.0993 19.0996 16.6072 19.0996 15.9997C19.0994 15.3923 18.6074 14.9001 18 14.9001Z",fill:"currentColor"},null,-1),C("path",{d:"M7.32422 5.38931C7.61669 4.87032 8.38346 4.87015 8.67578 5.38931L8.73047 5.50845L8.89551 5.95376L8.97949 6.1481C9.19937 6.58817 9.57968 6.93145 10.0459 7.10415L10.4912 7.26919C11.127 7.50461 11.1666 8.36217 10.6104 8.67544L10.4912 8.73013L10.0459 8.89517C9.5799 9.06783 9.19939 9.41141 8.97949 9.85123L8.89551 10.0456L8.73047 10.4909C8.49495 11.1267 7.63737 11.1665 7.32422 10.61L7.26953 10.4909L7.10449 10.0456C6.93172 9.57931 6.58767 9.19898 6.14746 8.97916L5.9541 8.89517L5.50879 8.73013C4.83054 8.47903 4.83061 7.52037 5.50879 7.26919L5.9541 7.10415L6.14746 7.02017C6.58757 6.80032 6.93176 6.41995 7.10449 5.95376L7.26953 5.50845L7.32422 5.38931Z",fill:"currentColor"},null,-1)])])}const Ype=kt({name:"kimi-music",render:Gpe}),Xpe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Jpe(e,t){return b(),A("svg",Xpe,[...t[0]||(t[0]=[C("path",{d:"M17.9551 6.32648C17.955 5.82951 17.5517 5.42706 17.0547 5.42706H15.4844C14.9875 5.42717 14.5851 5.82958 14.585 6.32648V17.6732C14.585 18.1701 14.9874 18.5734 15.4844 18.5735H17.0547C17.5518 18.5735 17.9551 18.1702 17.9551 17.6732V6.32648ZM19.7549 17.6732C19.7549 19.1643 18.5459 20.3734 17.0547 20.3734H15.4844C13.9933 20.3732 12.7842 19.1643 12.7842 17.6732V6.32648C12.7843 4.83546 13.9934 3.62639 15.4844 3.62628H17.0547C18.5458 3.62628 19.7548 4.8354 19.7549 6.32648V17.6732Z",fill:"currentColor"},null,-1),C("path",{d:"M9.41571 6.32648C9.41561 5.82951 9.01231 5.42706 8.51532 5.42706H6.94501C6.44811 5.42717 6.0457 5.82958 6.04559 6.32648V17.6732C6.04559 18.1701 6.44804 18.5734 6.94501 18.5735H8.51532C9.01238 18.5735 9.41571 18.1702 9.41571 17.6732V6.32648ZM11.2155 17.6732C11.2155 19.1643 10.0065 20.3734 8.51532 20.3734H6.94501C5.45393 20.3732 4.24481 19.1643 4.24481 17.6732V6.32648C4.24492 4.83546 5.45399 3.62639 6.94501 3.62628H8.51532C10.0064 3.62628 11.2154 4.8354 11.2155 6.32648V17.6732Z",fill:"currentColor"},null,-1)])])}const Qpe=kt({name:"kimi-pause",render:Jpe}),e0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function t0e(e,t){return b(),A("svg",e0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.0176 4.89998C17.7305 4.89998 17.4552 5.014 17.2522 5.217L6.35429 16.1149C5.957 16.5122 5.67517 17.01 5.53889 17.5551L5.23691 18.763L6.44486 18.4611C6.98994 18.3248 7.48773 18.0429 7.88502 17.6456L18.783 6.74773C18.8834 6.64728 18.9631 6.52797 19.0176 6.39658C19.072 6.26517 19.1 6.12441 19.1 5.98236C19.1 5.84031 19.072 5.69956 19.0176 5.56815C18.9631 5.43676 18.8834 5.31745 18.783 5.217C18.6825 5.11649 18.5631 5.03676 18.4318 4.98237C18.3005 4.92798 18.1597 4.89998 18.0176 4.89998ZM15.9794 3.94421C16.52 3.40366 17.2531 3.09998 18.0176 3.09998C18.3961 3.09998 18.7709 3.17452 19.1207 3.31938C19.4704 3.46424 19.7881 3.67656 20.0558 3.94421C20.3235 4.21192 20.5357 4.52969 20.6805 4.87932C20.8254 5.22895 20.9 5.60375 20.9 5.98236C20.9 6.36098 20.8254 6.73578 20.6805 7.08541C20.5357 7.43504 20.3235 7.75281 20.0558 8.02052L17.6385 10.4378L9.15781 18.9184C8.52984 19.5464 7.74301 19.9919 6.88142 20.2073L4.21828 20.8731C3.91158 20.9498 3.58714 20.8599 3.3636 20.6364C3.14006 20.4128 3.05019 20.0884 3.12686 19.7817L3.79264 17.1185C4.00803 16.257 4.45351 15.4701 5.0815 14.8421L15.9794 3.94421Z",fill:"currentColor"},null,-1)])])}const n0e=kt({name:"kimi-pencil",render:t0e}),o0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function s0e(e,t){return b(),A("svg",o0e,[...t[0]||(t[0]=[C("path",{d:"M7.76251 3.10547C8.25776 3.10552 8.74422 3.23849 9.17072 3.49023L19.533 9.60742C20.8536 10.3869 21.2922 12.0901 20.5174 13.4121C20.2785 13.8195 19.9398 14.1604 19.533 14.4004L9.16974 20.5156C7.84721 21.2958 6.14595 20.8511 5.36993 19.5273C5.1196 19.1003 4.98719 18.6142 4.98712 18.1191V5.88672C4.98716 4.3537 6.2273 3.10547 7.76251 3.10547ZM6.7879 18.1191C6.78797 18.2945 6.8343 18.4664 6.92267 18.6172C7.19638 19.0841 7.79336 19.2377 8.25568 18.9648L18.618 12.8496C18.7607 12.7654 18.8803 12.6458 18.9647 12.502C19.2393 12.0334 19.082 11.4311 18.618 11.1572L8.25568 5.04102C8.1061 4.95273 7.93562 4.9063 7.76251 4.90625C7.22703 4.90625 6.78794 5.34218 6.7879 5.88672V18.1191Z",fill:"currentColor"},null,-1)])])}const i0e=kt({name:"kimi-play",render:s0e}),r0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l0e(e,t){return b(),A("svg",r0e,[...t[0]||(t[0]=[C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 3.7998C7.47126 3.7998 3.7998 7.47126 3.7998 12C3.7998 16.5287 7.47126 20.2002 12 20.2002C16.5287 20.2002 20.2002 16.5287 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998Z",fill:"currentColor"},null,-1)])])}const a0e=kt({name:"kimi-question",render:l0e}),u0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c0e(e,t){return b(),A("svg",u0e,[...t[0]||(t[0]=[C("path",{d:"M12 2C13.1046 2 14 2.89543 14 4C14 4.78019 13.552 5.45353 12.9004 5.7832V7H16.5C18.1569 7 19.5 8.34315 19.5 10V17C19.5 18.6051 18.2394 19.9158 16.6543 19.9961L16.5 20H7.5L7.3457 19.9961C5.81166 19.9184 4.58163 18.6883 4.50391 17.1543L4.5 17V10C4.5 8.34315 5.84315 7 7.5 7H11.0996V5.7832C10.448 5.45353 10 4.78019 10 4C10 2.89543 10.8954 2 12 2ZM7.5 8.7998C6.83726 8.7998 6.2998 9.33726 6.2998 10V17C6.2998 17.6627 6.83726 18.2002 7.5 18.2002H16.5C17.1627 18.2002 17.7002 17.6627 17.7002 17V10C17.7002 9.33726 17.1627 8.7998 16.5 8.7998H7.5ZM3 10.7666C3.49706 10.7666 3.90039 11.1699 3.90039 11.667V15C3.90039 15.4971 3.49706 15.9004 3 15.9004C2.50294 15.9004 2.09961 15.4971 2.09961 15V11.667C2.09961 11.1699 2.50294 10.7666 3 10.7666ZM21 10.7666C21.4971 10.7666 21.9004 11.1699 21.9004 11.667V15C21.9004 15.4971 21.4971 15.9004 21 15.9004C20.5029 15.9004 20.0996 15.4971 20.0996 15V11.667C20.0996 11.1699 20.5029 10.7666 21 10.7666ZM9.5 11.0996C9.99706 11.0996 10.4004 11.5029 10.4004 12V14.5C10.4004 14.9971 9.99706 15.4004 9.5 15.4004C9.00294 15.4004 8.59961 14.9971 8.59961 14.5V12C8.59961 11.5029 9.00294 11.0996 9.5 11.0996ZM14.5 11.0996C14.9971 11.0996 15.4004 11.5029 15.4004 12V14.5C15.4004 14.9971 14.9971 15.4004 14.5 15.4004C14.0029 15.4004 13.5996 14.9971 13.5996 14.5V12C13.5996 11.5029 14.0029 11.0996 14.5 11.0996ZM12 3.5C11.7239 3.5 11.5 3.72386 11.5 4C11.5 4.27614 11.7239 4.5 12 4.5C12.2761 4.5 12.5 4.27614 12.5 4C12.5 3.72386 12.2761 3.5 12 3.5Z",fill:"currentColor"},null,-1)])])}const d0e=kt({name:"kimi-robot",render:c0e}),f0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function p0e(e,t){return b(),A("svg",f0e,[...t[0]||(t[0]=[C("path",{d:"M11.5 3C16.1944 3 20 6.80558 20 11.5C20 13.523 19.2933 15.381 18.1132 16.8404L21.1364 19.8636C21.4879 20.2151 21.4879 20.7849 21.1364 21.1364C20.7849 21.4879 20.2151 21.4879 19.8636 21.1364L16.8404 18.1132C15.381 19.2933 13.523 20 11.5 20C6.80558 20 3 16.1944 3 11.5C3 6.80558 6.80558 3 11.5 3ZM11.5 18.2C15.2003 18.2 18.2 15.2003 18.2 11.5C18.2 7.79969 15.2003 4.8 11.5 4.8C7.79969 4.8 4.8 7.79969 4.8 11.5C4.8 15.2003 7.79969 18.2 11.5 18.2Z",fill:"currentColor"},null,-1)])])}const h0e=kt({name:"kimi-search",render:p0e}),m0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g0e(e,t){return b(),A("svg",m0e,[...t[0]||(t[0]=[C("path",{d:"M16.5364 10.1636C16.8879 10.5151 16.8879 11.0849 16.5364 11.4364C16.1849 11.7879 15.6151 11.7879 15.2636 11.4364L12.9 9.07281V17.1C12.9 17.597 12.4971 18 12 18C11.503 18 11.1 17.597 11.1 17.1V9.07281L8.73641 11.4364C8.38494 11.7879 7.81509 11.7879 7.46362 11.4364C7.11214 11.0849 7.11214 10.5151 7.46362 10.1636L11.3636 6.2636C11.7151 5.91211 12.2849 5.91211 12.6364 6.2636L16.5364 10.1636Z",fill:"currentColor"},null,-1)])])}const v0e=kt({name:"kimi-send",render:g0e}),y0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function k0e(e,t){return b(),A("svg",y0e,[...t[0]||(t[0]=[C("path",{d:"M16.0404 12C16.0404 9.76874 14.2313 7.9596 12.0001 7.9596C9.76883 7.9596 7.95972 9.76874 7.95972 12C7.95972 14.2313 9.76883 16.0404 12.0001 16.0404C14.2313 16.0404 16.0404 14.2313 16.0404 12ZM14.2222 12C14.2222 13.2271 13.2271 14.2222 12 14.2222C10.7729 14.2222 9.77783 13.2271 9.77783 12C9.77783 10.7729 10.7729 9.77778 12 9.77778C13.2271 9.77778 14.2222 10.7729 14.2222 12Z",fill:"currentColor"},null,-1),C("path",{d:"M9.91145 21.8009C9.29001 21.6797 8.76914 21.2612 8.50632 20.6922L8.07372 19.7556C7.88838 19.3544 7.43553 19.1048 6.95371 19.1549L5.89572 19.2647C5.2733 19.3293 4.64823 19.114 4.22298 18.6611C3.74343 18.1504 3.32454 17.6037 2.97033 17.0181C2.61571 16.4318 2.32839 15.8106 2.10407 15.1566C1.89769 14.5549 2.02148 13.8954 2.4089 13.3902L3.0376 12.5704C3.30043 12.2277 3.30042 11.7722 3.03758 11.4295L2.40413 10.6035C2.01474 10.0958 1.891 9.43198 2.10208 8.82826C2.55037 7.54612 3.27017 6.35997 4.22 5.34259C4.64518 4.8872 5.27275 4.67067 5.89701 4.73544L6.95383 4.84514C7.43561 4.89515 7.88844 4.6456 8.07377 4.24441L8.50266 3.31593C8.76494 2.74818 9.28448 2.33019 9.90423 2.20761C11.2916 1.9332 12.7148 1.93127 14.0885 2.19913C14.7099 2.32029 15.2308 2.73881 15.4937 3.3078L15.9263 4.24441C16.1116 4.6456 16.5644 4.89514 17.0462 4.84514L18.1043 4.73532C18.7267 4.67072 19.3518 4.88603 19.777 5.33886C20.2566 5.84953 20.6755 6.3963 21.0297 6.98193C21.3843 7.56823 21.6716 8.18942 21.8959 8.84339C22.1023 9.44509 21.9785 10.1046 21.5911 10.6098L20.9624 11.4295C20.6996 11.7722 20.6996 12.2278 20.9624 12.5705L21.5959 13.3964C21.9853 13.9042 22.109 14.568 21.8979 15.1717C21.4497 16.4538 20.7299 17.6399 19.7801 18.6573C19.3549 19.1128 18.7273 19.3294 18.103 19.2646L17.0462 19.1549C16.5645 19.1049 16.1116 19.3544 15.9263 19.7556L15.4974 20.6841C15.2351 21.2518 14.7156 21.6698 14.0958 21.7924C12.7083 22.0668 11.2852 22.0687 9.91145 21.8009ZM13.7432 20.0088C13.7844 20.0006 13.8259 19.9673 13.847 19.9216L14.2758 18.9931C14.7915 17.8768 15.9886 17.2171 17.2341 17.3464L18.2909 17.4561C18.3649 17.4638 18.4272 17.4423 18.4512 17.4166C19.2296 16.5828 19.8171 15.6146 20.1817 14.5716C20.1845 14.5636 20.1796 14.5373 20.1532 14.5029L19.5198 13.677C18.7564 12.6815 18.7564 11.3185 19.5198 10.323L20.1485 9.5033C20.1746 9.46927 20.1795 9.4429 20.1762 9.43327C19.9932 8.89965 19.7603 8.39623 19.4741 7.92293C19.1873 7.4489 18.846 7.00333 18.4517 6.58351C18.4272 6.55739 18.3656 6.53616 18.2921 6.54378L17.234 6.65361C15.9886 6.78287 14.7915 6.12317 14.2758 5.00689L13.8432 4.07027C13.822 4.02448 13.7811 3.9916 13.7406 3.98371C12.5983 3.76097 11.4132 3.76258 10.2571 3.99124C10.2158 3.99941 10.1744 4.03271 10.1533 4.07842L9.72441 5.00689C9.20875 6.12317 8.01164 6.7829 6.76619 6.6536L5.70942 6.54391C5.63535 6.53623 5.573 6.55774 5.54905 6.5834C4.77067 7.41713 4.18312 8.38534 3.81845 9.42835C3.81564 9.43637 3.82054 9.46265 3.84693 9.49706L4.48038 10.323C5.24381 11.3185 5.24383 12.6815 4.48041 13.6769L3.85171 14.4967C3.82561 14.5307 3.82066 14.5571 3.82396 14.5667C4.00701 15.1004 4.23986 15.6038 4.52613 16.0771C4.81284 16.5511 5.15421 16.9967 5.54845 17.4165C5.57298 17.4426 5.63461 17.4638 5.70811 17.4562L6.76608 17.3464C8.01157 17.2171 9.20871 17.8768 9.72438 18.9932L10.157 19.9297C10.1781 19.9755 10.2191 20.0084 10.2595 20.0163C11.4018 20.239 12.587 20.2374 13.7432 20.0088Z",fill:"currentColor"},null,-1)])])}const b0e=kt({name:"kimi-setting",render:k0e}),C0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function w0e(e,t){return b(),A("svg",C0e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1)])])}const _0e=kt({name:"kimi-shield-question",render:w0e}),x0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function S0e(e,t){return b(),A("svg",x0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.90005 12C2.90005 11.503 3.303 11.1 3.80005 11.1H12.2939L9.38588 8.19197C9.03441 7.8405 9.03441 7.27065 9.38588 6.91918C9.73735 6.56771 10.3072 6.56771 10.6587 6.91918L15.1031 11.3636C15.2719 11.5324 15.3667 11.7613 15.3667 12C15.3667 12.2387 15.2719 12.4676 15.1031 12.6364L10.6587 17.0809C10.3072 17.4323 9.73735 17.4323 9.38588 17.0809C9.03441 16.7294 9.03441 16.1595 9.38588 15.8081L12.2939 12.9H3.80005C3.303 12.9 2.90005 12.4971 2.90005 12ZM13.5874 20C13.5874 19.503 13.9904 19.1 14.4874 19.1H18.043C18.2758 19.1 18.4991 19.0075 18.6637 18.8429C18.8283 18.6783 18.9208 18.455 18.9208 18.2222V5.7778C18.9208 5.545 18.8283 5.32174 18.6637 5.15712C18.499 4.9925 18.2758 4.90002 18.043 4.90002H14.4874C13.9904 4.90002 13.5874 4.49708 13.5874 4.00002C13.5874 3.50297 13.9904 3.10003 14.4874 3.10003H18.043C18.7532 3.10003 19.4343 3.38215 19.9365 3.88433C20.4386 4.38651 20.7208 5.06761 20.7208 5.7778V18.2222C20.7208 18.9324 20.4386 19.6135 19.9365 20.1157C19.4343 20.6179 18.7532 20.9 18.043 20.9H14.4874C13.9904 20.9 13.5874 20.4971 13.5874 20Z",fill:"currentColor"},null,-1)])])}const A0e=kt({name:"kimi-sign-in",render:S0e}),M0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T0e(e,t){return b(),A("svg",M0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20.6364 11.3636C20.9879 11.7151 20.9879 12.2849 20.6364 12.6364L16.1919 17.0808C15.8405 17.4323 15.2706 17.4323 14.9192 17.0808C14.5677 16.7293 14.5677 16.1595 14.9192 15.808L17.8272 12.9H9.33333C8.83627 12.9 8.43333 12.497 8.43333 12C8.43333 11.5029 8.83627 11.1 9.33333 11.1H17.8272L14.9192 8.19193C14.5677 7.84046 14.5677 7.27061 14.9192 6.91914C15.2706 6.56766 15.8405 6.56766 16.1919 6.91914L20.6364 11.3636ZM10.2333 3.99998C10.2333 4.49703 9.83038 4.89998 9.33333 4.89998H5.77777C5.54497 4.89998 5.3217 4.99246 5.15709 5.15707C4.99247 5.32169 4.89999 5.54495 4.89999 5.77775V18.2222C4.89999 18.455 4.99247 18.6783 5.15709 18.8429C5.32171 19.0075 5.54497 19.1 5.77777 19.1H9.33333C9.83038 19.1 10.2333 19.5029 10.2333 20C10.2333 20.497 9.83038 20.9 9.33333 20.9H5.77777C5.06758 20.9 4.38648 20.6179 3.8843 20.1157C3.38212 19.6135 3.09999 18.9324 3.09999 18.2222V5.77775C3.09999 5.06756 3.38212 4.38646 3.8843 3.88428C4.38648 3.3821 5.06758 3.09998 5.77777 3.09998H9.33333C9.83038 3.09998 10.2333 3.50292 10.2333 3.99998Z",fill:"currentColor"},null,-1)])])}const E0e=kt({name:"kimi-sign-out",render:T0e}),I0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function L0e(e,t){return b(),A("svg",I0e,[...t[0]||(t[0]=[Ac('',9)])])}const $0e=kt({name:"kimi-sliders",render:L0e}),N0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function F0e(e,t){return b(),A("svg",N0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.78027 8.90405C7.5 9.45411 7.5 10.1742 7.5 11.6144V12.3856C7.5 13.8258 7.5 14.5459 7.78027 15.096C8.02681 15.5798 8.42019 15.9732 8.90405 16.2197C9.45411 16.5 10.1742 16.5 11.6144 16.5H12.3856C13.8258 16.5 14.5459 16.5 15.096 16.2197C15.5798 15.9732 15.9732 15.5798 16.2197 15.096C16.5 14.5459 16.5 13.8258 16.5 12.3856V11.6144C16.5 10.1742 16.5 9.45411 16.2197 8.90405C15.9732 8.42019 15.5798 8.02681 15.096 7.78027C14.5459 7.5 13.8258 7.5 12.3856 7.5H11.6144C10.1742 7.5 9.45411 7.5 8.90405 7.78027C8.42019 8.02681 8.02681 8.42019 7.78027 8.90405Z",fill:"currentColor"},null,-1)])])}const R0e=kt({name:"kimi-stop",render:F0e}),O0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function P0e(e,t){return b(),A("svg",O0e,[...t[0]||(t[0]=[C("path",{d:"M7.01562 3.41459C7.4446 3.16449 7.9954 3.30924 8.24609 3.73784C8.49645 4.167 8.35189 4.71868 7.92285 4.96928C5.51497 6.37506 3.90054 8.98498 3.90039 11.9703C3.90076 16.4435 7.52672 20.0699 12 20.0699C16.4733 20.0699 20.0992 16.4435 20.0996 11.9703C20.0996 11.2291 20 10.5116 19.8145 9.83159C19.6838 9.35222 19.967 8.85702 20.4463 8.72612C20.9256 8.59541 21.4207 8.87778 21.5518 9.35698C21.7792 10.1901 21.9004 11.0674 21.9004 11.9703C21.9 17.4376 17.4674 21.8697 12 21.8697C6.53261 21.8697 2.09998 17.4376 2.09961 11.9703C2.09976 8.31904 4.07782 5.12972 7.01562 3.41459ZM8.39258 8.24077C8.75015 7.89591 9.3199 7.90591 9.66504 8.26323C10.01 8.62076 9.99985 9.19051 9.64258 9.53569C9.00203 10.1541 8.60558 11.02 8.60547 11.979C8.60584 13.8536 10.1253 15.3736 12 15.3736C13.8746 15.3735 15.3942 13.8536 15.3945 11.979C15.3945 11.6847 15.3577 11.3989 15.2881 11.1285C15.1646 10.6474 15.4536 10.1568 15.9346 10.0328C16.4158 9.9089 16.9071 10.1991 17.0312 10.6802C17.1383 11.096 17.1943 11.5321 17.1943 11.979C17.194 14.8477 14.8688 17.1733 12 17.1734C9.1312 17.1734 6.80506 14.8478 6.80469 11.979C6.8048 10.5117 7.41519 9.18431 8.39258 8.24077ZM11.5459 1.12651C11.8216 0.965605 12.1631 0.963306 12.4414 1.11967L19.1953 4.91752C19.4859 5.08108 19.662 5.39277 19.6533 5.72612C19.6443 6.05972 19.4515 6.36154 19.1523 6.50932L12.9004 9.5933V12.2583C12.9004 12.7554 12.4971 13.1587 12 13.1587C11.5029 13.1587 11.0996 12.7554 11.0996 12.2583V1.90385C11.0999 1.58444 11.2702 1.2878 11.5459 1.12651ZM12.9004 7.58549L16.8252 5.64897L12.9004 3.44194V7.58549Z",fill:"currentColor"},null,-1)])])}const D0e=kt({name:"kimi-target",render:P0e}),B0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H0e(e,t){return b(),A("svg",B0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.9893 6.60743C20.5897 6.60757 21.8877 7.8926 21.8877 9.47736C21.8877 10.7416 21.0607 11.8129 19.9141 12.1955V14.257C19.914 15.8428 18.6152 17.1288 17.0137 17.1289H12.8438V20.1381C12.8437 20.6301 12.4412 21.0293 11.9443 21.0296C11.4473 21.0296 11.044 20.6302 11.0439 20.1381V16.4356C11.0441 15.8343 11.5363 15.3461 12.1436 15.3458H17.0137C17.6211 15.3457 18.1133 14.8585 18.1133 14.257V12.2129C16.9408 11.8451 16.0909 10.7598 16.0908 9.47736C16.0908 7.89251 17.3887 6.60743 18.9893 6.60743ZM18.9893 8.38953C18.3828 8.38953 17.8906 8.87684 17.8906 9.47736C17.8907 10.0778 18.3828 10.5642 18.9893 10.5642C19.5956 10.5641 20.0869 10.0777 20.0869 9.47736C20.0869 8.87693 19.5956 8.38967 18.9893 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.89844 6.60743C6.49899 6.60747 7.79688 7.89254 7.79688 9.47736C7.79684 10.7388 6.97371 11.8078 5.83105 12.1926V14.4021C5.83105 15.0036 6.32315 15.4918 6.93066 15.4918H8.37109C8.86789 15.492 9.27038 15.8905 9.27051 16.3824C9.27051 16.8744 8.86797 17.2737 8.37109 17.2739H6.93066C5.32904 17.2739 4.03027 15.9879 4.03027 14.4021V12.2158C2.85382 11.8504 2.00004 10.7627 2 9.47736C2 7.89251 3.29784 6.60743 4.89844 6.60743ZM4.89844 8.38953C4.29196 8.38953 3.7998 8.87684 3.7998 9.47736C3.79985 10.0778 4.29198 10.5642 4.89844 10.5642C5.50485 10.5642 5.99605 10.0778 5.99609 9.47736C5.99609 8.87687 5.50488 8.38958 4.89844 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.9434 2.9707C13.5439 2.97075 14.8418 4.25581 14.8418 5.84063C14.8418 7.11413 14.0035 8.1923 12.8438 8.56745V13.0135C12.8436 13.5056 12.4403 13.9041 11.9434 13.9041C11.4466 13.9039 11.0431 13.5055 11.043 13.0135V8.56745C9.8836 8.19209 9.04496 7.11387 9.04492 5.84063C9.04492 4.25592 10.343 2.97093 11.9434 2.9707ZM11.9434 4.75281C11.3371 4.75303 10.8447 5.24026 10.8447 5.84063C10.8448 6.44097 11.3371 6.92726 11.9434 6.92749C12.5498 6.92745 13.041 6.44108 13.041 5.84063C13.041 5.24014 12.5498 4.75285 11.9434 4.75281Z",fill:"currentColor"},null,-1)])])}const z0e=kt({name:"kimi-task",render:H0e}),W0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function U0e(e,t){return b(),A("svg",W0e,[...t[0]||(t[0]=[C("path",{d:"M16.5293 15.0596C16.9496 15.1021 17.2772 15.4572 17.2773 15.8887C17.2773 16.3202 16.9497 16.6753 16.5293 16.7178L16.4443 16.7217H12C11.5399 16.7216 11.167 16.3488 11.167 15.8887C11.1671 15.4286 11.54 15.0558 12 15.0557H16.4443L16.5293 15.0596Z",fill:"currentColor"},null,-1),C("path",{d:"M6.96582 7.52246C7.27077 7.21751 7.75375 7.1983 8.08105 7.46484L8.14453 7.52246L10.8232 10.2002C11.5102 10.8872 11.5102 12.0014 10.8232 12.6885L8.14453 15.3672L8.08105 15.4248C7.75377 15.6913 7.27075 15.6721 6.96582 15.3672C6.66114 15.0621 6.64234 14.5791 6.90918 14.252L6.96582 14.1885L9.64453 11.5098C9.68057 11.4736 9.68062 11.415 9.64453 11.3789L6.96582 8.7002C6.64116 8.37488 6.6411 7.84774 6.96582 7.52246Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 3.09961C19.1539 3.09966 20.9004 4.84612 20.9004 7V17C20.9004 19.1539 19.1539 20.9003 17 20.9004H7C4.84609 20.9004 3.09961 19.1539 3.09961 17V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H17ZM7 4.90039C5.8402 4.90039 4.90039 5.8402 4.90039 7V17C4.90039 18.1598 5.8402 19.0996 7 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V7C19.0996 5.84024 18.1598 4.90044 17 4.90039H7Z",fill:"currentColor"},null,-1)])])}const j0e=kt({name:"kimi-terminal",render:U0e}),V0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q0e(e,t){return b(),A("svg",V0e,[...t[0]||(t[0]=[C("path",{d:"M16.9971 3.90597C15.9799 2.99725 14.7342 2.38312 13.394 2.12966C12.0538 1.8762 10.6699 1.99301 9.39111 2.46751C8.11236 2.94202 6.98721 3.75626 6.13676 4.82261C5.2863 5.88896 4.74274 7.16703 4.56457 8.5193C4.40455 9.70501 4.53253 10.9118 4.93767 12.0376C5.34281 13.1634 6.01318 14.175 6.89207 14.9868C7.43557 15.4634 7.87413 16.0477 8.17997 16.7027C8.48581 17.3577 8.65224 18.0691 8.66873 18.7918V18.926C8.66962 19.7412 8.99387 20.5229 9.57035 21.0993C10.1468 21.6758 10.9285 22.0001 11.7437 22.001H12.2604C13.0757 22.0001 13.8573 21.6758 14.4338 21.0993C15.0103 20.5229 15.3345 19.7412 15.3354 18.926V18.4685C15.3479 17.8297 15.4982 17.2011 15.7761 16.6258C16.0539 16.0505 16.4528 15.542 16.9454 15.1351C17.7442 14.4355 18.3853 13.5741 18.826 12.608C19.2668 11.642 19.4973 10.5932 19.5022 9.53136C19.5071 8.46948 19.2863 7.41869 18.8544 6.4486C18.4225 5.4785 17.7894 4.61125 16.9971 3.9043V3.90597ZM12.2604 20.3343H11.7437C11.3704 20.3339 11.0124 20.1853 10.7484 19.9213C10.4844 19.6573 10.3358 19.2993 10.3354 18.926C10.3354 18.926 10.3296 18.7093 10.3287 18.6676H13.6687V18.926C13.6683 19.2993 13.5198 19.6573 13.2558 19.9213C12.9917 20.1853 12.6338 20.3339 12.2604 20.3343ZM15.8437 13.8835C14.8949 14.7064 14.2097 15.7908 13.8737 17.001H12.8354V11.0143C13.3212 10.8426 13.742 10.5249 14.0403 10.1049C14.3387 9.68482 14.4999 9.18285 14.5021 8.66763C14.5021 8.44662 14.4143 8.23466 14.258 8.07838C14.1017 7.9221 13.8897 7.8343 13.6687 7.8343C13.4477 7.8343 13.2358 7.9221 13.0795 8.07838C12.9232 8.23466 12.8354 8.44662 12.8354 8.66763C12.8354 8.88865 12.7476 9.10061 12.5913 9.25689C12.435 9.41317 12.2231 9.50097 12.0021 9.50097C11.7811 9.50097 11.5691 9.41317 11.4128 9.25689C11.2565 9.10061 11.1687 8.88865 11.1687 8.66763C11.1687 8.44662 11.0809 8.23466 10.9247 8.07838C10.7684 7.9221 10.5564 7.8343 10.3354 7.8343C10.1144 7.8343 9.90242 7.9221 9.74614 8.07838C9.58986 8.23466 9.50207 8.44662 9.50207 8.66763C9.5042 9.18285 9.66547 9.68482 9.96381 10.1049C10.2621 10.5249 10.683 10.8426 11.1687 11.0143V17.001H10.0671C9.69123 15.7586 8.98633 14.6411 8.02707 13.7668C7.21286 13.0081 6.63267 12.0324 6.35496 10.9547C6.07725 9.87703 6.1136 8.7424 6.45974 7.68471C6.80588 6.62702 7.44735 5.69042 8.30846 4.98543C9.16956 4.28045 10.2144 3.83649 11.3196 3.70597C11.5487 3.68039 11.779 3.66759 12.0096 3.66763C13.4409 3.66338 14.8226 4.19149 15.8862 5.1493C16.5026 5.69896 16.9952 6.37337 17.3312 7.12782C17.6672 7.88227 17.839 8.69952 17.8352 9.5254C17.8314 10.3513 17.6522 11.1669 17.3092 11.9183C16.9663 12.6696 16.4677 13.3395 15.8462 13.8835H15.8437Z",fill:"currentColor"},null,-1)])])}const K0e=kt({name:"kimi-thinking",render:q0e}),Z0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G0e(e,t){return b(),A("svg",Z0e,[...t[0]||(t[0]=[Ac('',6)])])}const Y0e=kt({name:"kimi-todo",render:G0e}),X0e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J0e(e,t){return b(),A("svg",X0e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.09752 2.19507C8.5421 1.97278 9.08271 2.15298 9.305 2.59756L10.0562 4.10005H13.5C13.9971 4.10005 14.4 4.50299 14.4 5.00005C14.4 5.49711 13.9971 5.90005 13.5 5.90005H12.3106C12.2556 6.2319 12.1667 6.64073 12.0226 7.0987C11.7254 8.04355 11.191 9.20402 10.2334 10.3239C11.4166 11.196 12.5606 11.7524 13.4512 12.0987C13.978 12.3036 14.4136 12.434 14.7124 12.5122L14.7348 12.5181L15.695 10.5976C15.8475 10.2927 16.1591 10.1 16.5 10.1C16.8409 10.1 17.1525 10.2927 17.305 10.5976L20.7969 17.5814L20.8044 17.5959L20.8137 17.615L21.805 19.5976C22.0273 20.0421 21.8471 20.5827 21.4025 20.805C20.9579 21.0273 20.4173 20.8471 20.195 20.4025L19.4438 18.9H13.5562L12.805 20.4025C12.5827 20.8471 12.0421 21.0273 11.5975 20.805C11.1529 20.5827 10.9727 20.0421 11.195 19.5976L12.1863 17.615C12.1917 17.6036 12.1973 17.5924 12.2031 17.5814L13.9146 14.1583C13.6034 14.0667 13.2256 13.9423 12.7988 13.7764C11.7294 13.3605 10.3442 12.6802 8.92538 11.5924C7.79753 12.5167 6.69473 13.0764 5.83285 13.4112C5.33899 13.603 4.92286 13.7216 4.62401 13.7931C4.47449 13.8288 4.35399 13.8529 4.26741 13.8684C4.2241 13.8762 4.18924 13.8818 4.16343 13.8858L4.13156 13.8904L4.12084 13.8919L4.11682 13.8924L4.11514 13.8927C4.11514 13.8927 4.11368 13.8928 4.00001 13L4.11368 13.8928C3.62061 13.9556 3.17 13.6068 3.10722 13.1137C3.0446 12.6219 3.39148 12.1723 3.88256 12.1077L3.94947 12.0967C4.00428 12.0869 4.09114 12.0698 4.20543 12.0424C4.43422 11.9877 4.77156 11.8924 5.18106 11.7334C5.84103 11.477 6.68484 11.0564 7.56458 10.3753C7.15054 9.93496 6.78945 9.48388 6.50421 9.10102C6.26672 8.78224 6.07517 8.50172 5.94227 8.29973C5.87571 8.19858 5.82359 8.11671 5.78748 8.05909C5.76942 8.03027 5.75535 8.00749 5.74545 7.99135L5.73377 7.9722L5.73032 7.96651L5.72864 7.96371C5.71133 7.9349 5.69582 7.9055 5.68208 7.87566C5.49265 7.46416 5.6393 6.96717 6.03659 6.72853C6.09037 6.69623 6.14617 6.6702 6.20315 6.65023C6.59739 6.51205 7.04758 6.66421 7.27129 7.03623L7.27266 7.0385L7.28001 7.05054C7.28695 7.06186 7.29793 7.07964 7.31274 7.10328C7.34239 7.15059 7.38731 7.2212 7.44595 7.31032C7.56343 7.48886 7.73484 7.73997 7.94765 8.02562C8.21085 8.37889 8.52772 8.77187 8.8756 9.14201C9.64226 8.24147 10.0681 7.3133 10.3056 6.55854C10.381 6.3186 10.4372 6.09683 10.4791 5.90005H9.51951C9.50696 5.90031 9.49442 5.90031 9.48191 5.90005H4.00001C3.50296 5.90005 3.10001 5.49711 3.10001 5.00005C3.10001 4.50299 3.50296 4.10005 4.00001 4.10005H8.04378L7.69503 3.40254C7.67314 3.35877 7.65516 3.31407 7.64094 3.26883C7.51078 2.8546 7.69671 2.39547 8.09752 2.19507ZM16.5 13.0125L18.5438 17.1H14.4562L16.5 13.0125Z",fill:"currentColor"},null,-1),C("path",{d:"M15.1 4.00007C15.1 3.50301 15.5029 3.10007 16 3.10007H18C19.6016 3.10007 20.9 4.39844 20.9 6.00007V8.00007C20.9 8.49712 20.497 8.90007 20 8.90007C19.5029 8.90007 19.1 8.49712 19.1 8.00007V6.00007C19.1 5.39255 18.6075 4.90007 18 4.90007H16C15.5029 4.90007 15.1 4.49712 15.1 4.00007Z",fill:"currentColor"},null,-1),C("path",{d:"M3.99998 15.1001C4.49703 15.1001 4.89998 15.503 4.89998 16.0001V18.0001C4.89998 18.6076 5.39246 19.1001 5.99998 19.1001H7.99998C8.49703 19.1001 8.89998 19.503 8.89998 20.0001C8.89998 20.4971 8.49703 20.9001 7.99998 20.9001H5.99998C4.39835 20.9001 3.09998 19.6017 3.09998 18.0001V16.0001C3.09998 15.503 3.50292 15.1001 3.99998 15.1001Z",fill:"currentColor"},null,-1)])])}const Q0e=kt({name:"kimi-translate",render:J0e}),ehe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function the(e,t){return b(),A("svg",ehe,[...t[0]||(t[0]=[C("path",{d:"M8.10001 3C8.10001 2.50294 8.50295 2.1 9.00001 2.1H15C15.4971 2.1 15.9 2.50294 15.9 3C15.9 3.49706 15.4971 3.9 15 3.9H9.00001C8.50295 3.9 8.10001 3.49706 8.10001 3Z",fill:"currentColor"},null,-1),C("path",{d:"M10 15.9C9.50295 15.9 9.10001 15.4971 9.10001 15L9.10001 10C9.10001 9.50294 9.50295 9.1 10 9.1C10.4971 9.1 10.9 9.50294 10.9 10L10.9 15C10.9 15.4971 10.4971 15.9 10 15.9Z",fill:"currentColor"},null,-1),C("path",{d:"M13.1 15C13.1 15.4971 13.5029 15.9 14 15.9C14.4971 15.9 14.9 15.4971 14.9 15L14.9 10C14.9 9.50294 14.4971 9.1 14 9.1C13.5029 9.1 13.1 9.50294 13.1 10V15Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.10001 6C2.10001 5.50294 2.50295 5.1 3.00001 5.1H4.99152C4.99785 5.09993 5.00417 5.09993 5.01048 5.1H18.9895C18.9958 5.09993 19.0021 5.09993 19.0085 5.1H21C21.4971 5.1 21.9 5.50294 21.9 6C21.9 6.49706 21.4971 6.9 21 6.9H19.8281L18.8448 18.6993C18.7412 19.9432 17.7013 20.9 16.4531 20.9H7.54686C6.29865 20.9 5.25881 19.9432 5.15515 18.6993L4.17188 6.9H3.00001C2.50295 6.9 2.10001 6.49706 2.10001 6ZM5.97811 6.9L18.0219 6.9L17.0511 18.5498C17.0251 18.8608 16.7652 19.1 16.4531 19.1H7.54686C7.23481 19.1 6.97485 18.8608 6.94893 18.5498L5.97811 6.9Z",fill:"currentColor"},null,-1)])])}const nhe=kt({name:"kimi-trash",render:the}),ohe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function she(e,t){return b(),A("svg",ohe,[...t[0]||(t[0]=[C("path",{d:"M7.36336 3.3634C7.71483 3.01192 8.28533 3.01192 8.6368 3.3634C8.98817 3.71488 8.98824 4.2854 8.6368 4.63683L6.17391 7.09972H15.0001C18.2585 7.09977 20.9005 9.74166 20.9005 13.0001C20.9004 16.2585 18.2585 18.9005 15.0001 18.9005H7.00008C6.50307 18.9005 6.09976 18.4971 6.09969 18.0001C6.09969 17.5031 6.50302 17.0997 7.00008 17.0997H15.0001C17.2644 17.0997 19.0996 15.2644 19.0997 13.0001C19.0997 10.7358 17.2644 8.90055 15.0001 8.90051H6.17391L8.6368 11.3634L8.69832 11.4318C8.98668 11.7853 8.96632 12.3073 8.6368 12.6368C8.30728 12.9663 7.78521 12.9867 7.43172 12.6984L7.36336 12.6368L3.36336 8.63683C3.33098 8.60445 3.30286 8.56908 3.27645 8.53332C3.25597 8.50559 3.23607 8.47741 3.21883 8.44738C3.20492 8.42311 3.19221 8.39837 3.18074 8.37316C3.1764 8.36365 3.17109 8.35453 3.16707 8.34484C3.1627 8.33427 3.1593 8.32331 3.15535 8.31261C3.12946 8.24274 3.11237 8.16872 3.10457 8.09191C3.09258 7.97426 3.10262 7.85446 3.1368 7.74035C3.14281 7.72035 3.15094 7.70114 3.15828 7.68176C3.16165 7.67283 3.16341 7.66325 3.16707 7.65441C3.17216 7.64216 3.17806 7.63025 3.18367 7.61828C3.19055 7.60356 3.19744 7.58874 3.20516 7.57433C3.24709 7.49624 3.3012 7.42556 3.36336 7.3634L7.36336 3.3634Z",fill:"currentColor"},null,-1)])])}const ihe=kt({name:"kimi-undo",render:she}),rhe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function lhe(e,t){return b(),A("svg",rhe,[...t[0]||(t[0]=[C("path",{d:"M11.9997 12.8779C16.0197 12.878 19.4393 15.3848 20.7048 18.8828C21.0812 19.9234 20.2782 20.8962 19.2038 21.0137L18.9861 21.0264H5.0134L4.79562 21.0137C3.7213 20.8961 2.91743 19.9233 3.29367 18.8828C4.55905 15.3847 7.9797 12.8781 11.9997 12.8779ZM11.9997 14.6777C8.84467 14.6779 6.17462 16.5794 5.09152 19.2256H18.9079C17.8248 16.5793 15.1549 14.6778 11.9997 14.6777ZM12.2312 3.00586C14.6088 3.1264 16.4997 5.09239 16.4997 7.5L16.4939 7.73145C16.3734 10.1091 14.4073 11.9999 11.9997 12C9.59225 11.9998 7.62604 10.109 7.50558 7.73145L7.49973 7.5C7.49973 5.01485 9.51462 3.00021 11.9997 3L12.2312 3.00586ZM11.9997 4.7998C10.5087 4.80001 9.29953 6.00896 9.29953 7.5C9.29953 8.99104 10.5087 10.2 11.9997 10.2002C13.4908 10.2001 14.6999 8.99112 14.6999 7.5C14.6999 6.00888 13.4908 4.79989 11.9997 4.7998Z",fill:"currentColor"},null,-1)])])}const ahe=kt({name:"kimi-user",render:lhe}),uhe={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function che(e,t){return b(),A("svg",uhe,[...t[0]||(t[0]=[C("path",{d:"M11.9996 7C11.5026 7 11.0996 7.36985 11.0996 7.82609V14.1739C11.0996 14.6301 11.5026 15 11.9996 15C12.4967 15 12.8996 14.6301 12.8996 14.1739V7.82609C12.8996 7.36985 12.4967 7 11.9996 7Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8996 17.1006C12.8996 17.5974 12.4968 18.001 11.9992 18.001C11.5024 18.001 11.0996 17.5974 11.0996 17.1006C11.0996 16.6038 11.5024 16.2002 11.9992 16.2002C12.4968 16.2002 12.8996 16.6038 12.8996 17.1006Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.5108 3.5501C13.3946 1.61676 10.6041 1.61676 9.48786 3.5501L1.69363 17.0501C0.577423 18.9834 1.97269 21.4001 4.20511 21.4001H19.7936C22.026 21.4001 23.4212 18.9834 22.305 17.0501L14.5108 3.5501ZM11.0467 4.4501C11.4701 3.71676 12.5286 3.71676 12.952 4.4501L20.7462 17.9501C21.1696 18.6834 20.6403 19.6001 19.7936 19.6001H4.20511C3.35833 19.6001 2.82909 18.6834 3.25248 17.9501L11.0467 4.4501Z",fill:"currentColor"},null,-1)])])}const dhe=kt({name:"kimi-warning",render:che}),fhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function phe(e,t){return b(),A("svg",fhe,[...t[0]||(t[0]=[C("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[C("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm11-2v16"}),C("path",{d:"m9 10l2 2l-2 2"})],-1)])])}const hhe=kt({name:"tabler-layout-sidebar-right-collapse",render:phe}),mhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function ghe(e,t){return b(),A("svg",mhe,[...t[0]||(t[0]=[C("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"},null,-1)])])}const vhe=kt({name:"tabler-paperclip",render:ghe}),yhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function khe(e,t){return b(),A("svg",yhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"},null,-1)])])}const bhe=kt({name:"ri-braces-line",render:khe}),Che={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function whe(e,t){return b(),A("svg",Che,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"},null,-1)])])}const _he=kt({name:"ri-calendar-close-line",render:whe}),xhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function She(e,t){return b(),A("svg",xhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"},null,-1)])])}const Ahe=kt({name:"ri-calendar-schedule-line",render:She}),Mhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function The(e,t){return b(),A("svg",Mhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"},null,-1)])])}const Ehe=kt({name:"ri-calendar-todo-line",render:The}),Ihe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Lhe(e,t){return b(),A("svg",Ihe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"},null,-1)])])}const $he=kt({name:"ri-code-line",render:Lhe}),Nhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Fhe(e,t){return b(),A("svg",Nhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-4-7h8a4 4 0 0 1-8 0m0-2a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m8 0a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3"},null,-1)])])}const Rhe=kt({name:"ri-emotion-line",render:Fhe}),Ohe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Phe(e,t){return b(),A("svg",Ohe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"},null,-1)])])}const Dhe=kt({name:"ri-external-link-line",render:Phe}),Bhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Hhe(e,t){return b(),A("svg",Bhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 3c5.392 0 9.878 3.88 10.819 9c-.94 5.12-5.427 9-10.819 9s-9.878-3.88-10.818-9C2.122 6.88 6.608 3 12 3m0 16a9.005 9.005 0 0 0 8.778-7a9.005 9.005 0 0 0-17.555 0A9.005 9.005 0 0 0 12 19m0-2.5a4.5 4.5 0 1 1 0-9a4.5 4.5 0 0 1 0 9m0-2a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5"},null,-1)])])}const zhe=kt({name:"ri-eye-line",render:Hhe}),Whe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Uhe(e,t){return b(),A("svg",Whe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M17.883 19.297A10.95 10.95 0 0 1 12 21c-5.392 0-9.878-3.88-10.818-9A11 11 0 0 1 4.52 5.935L1.394 2.808l1.414-1.414l19.799 19.798l-1.414 1.415zM5.936 7.35A8.97 8.97 0 0 0 3.223 12a9.005 9.005 0 0 0 13.201 5.838l-2.028-2.028A4.5 4.5 0 0 1 8.19 9.604zm6.978 6.978l-3.242-3.241a2.5 2.5 0 0 0 3.241 3.241m7.893 2.265l-1.431-1.431A8.9 8.9 0 0 0 20.778 12A9.005 9.005 0 0 0 9.552 5.338L7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.95 10.95 0 0 1-2.012 4.593m-9.084-9.084Q11.86 7.5 12 7.5a4.5 4.5 0 0 1 4.492 4.778z"},null,-1)])])}const jhe=kt({name:"ri-eye-off-line",render:Uhe}),Vhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function qhe(e,t){return b(),A("svg",Vhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"},null,-1)])])}const Khe=kt({name:"ri-file-add-line",render:qhe}),Zhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Ghe(e,t){return b(),A("svg",Zhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"},null,-1)])])}const Yhe=kt({name:"ri-flashlight-line",render:Ghe}),Xhe={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Jhe(e,t){return b(),A("svg",Xhe,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])}const Qhe=kt({name:"ri-folder-fill",render:Jhe}),eme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function tme(e,t){return b(),A("svg",eme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"},null,-1)])])}const nme=kt({name:"ri-git-fork-line",render:tme}),ome={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function sme(e,t){return b(),A("svg",ome,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"},null,-1)])])}const ime=kt({name:"ri-git-pull-request-line",render:sme}),rme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function lme(e,t){return b(),A("svg",rme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M2 18h7v2H2zm0-7h9v2H2zm0-7h20v2H2zm18.674 9.025l1.156-.391l1 1.732l-.916.805a4 4 0 0 1 0 1.658l.916.805l-1 1.732l-1.156-.391a4 4 0 0 1-1.435.83L19 21h-2l-.24-1.196a4 4 0 0 1-1.434-.83l-1.156.392l-1-1.732l.916-.805a4 4 0 0 1 0-1.658l-.916-.805l1-1.732l1.156.391c.41-.37.898-.655 1.435-.83L17 11h2l.24 1.196a4 4 0 0 1 1.434.83M18 18a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const ame=kt({name:"ri-list-settings-line",render:lme}),ume={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function cme(e,t){return b(),A("svg",ume,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8v2h5V9a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H8v6h5v-1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H7a1 1 0 0 1-1-1V8H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm9 16h-4v2h4zm0-8h-4v2h4zM9 4H5v2h4z"},null,-1)])])}const dme=kt({name:"ri-node-tree",render:cme}),fme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function pme(e,t){return b(),A("svg",fme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m13.827 1.69l8.486 8.485l-1.415 1.414l-.707-.707l-4.242 4.243l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243l1.414-1.414l3.536-.707l4.242-4.243l-.707-.707zm.707 3.536l-4.67 4.67l-2.822.565l6.5 6.5l.564-2.822l4.671-4.67z"},null,-1)])])}const hme=kt({name:"ri-pushpin-line",render:pme}),mme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function gme(e,t){return b(),A("svg",mme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"},null,-1)])])}const vme=kt({name:"ri-sort-desc",render:gme}),yme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function kme(e,t){return b(),A("svg",yme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"},null,-1)])])}const bme=kt({name:"ri-star-fill",render:kme}),Cme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function wme(e,t){return b(),A("svg",Cme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"},null,-1)])])}const _me=kt({name:"ri-star-line",render:wme}),xme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Sme(e,t){return b(),A("svg",xme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"},null,-1)])])}const Ame=kt({name:"ri-tools-line",render:Sme}),Mme={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Tme(e,t){return b(),A("svg",Mme,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m20.97 17.172l-1.414 1.414l-3.535-3.535l-.073.074l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243L5.34 8.761l3.536-.707l.073-.074l-3.536-3.536L6.828 3.03zM10.365 9.394l-.502.502l-2.822.565l6.5 6.5l.564-2.822l.502-.502zm8.411.074l-1.34 1.34l1.414 1.415l1.34-1.34l.707.707l1.415-1.415l-8.486-8.485l-1.414 1.414l.707.707l-1.34 1.34l1.414 1.415l1.34-1.34z"},null,-1)])])}const Eme=kt({name:"ri-unpin-line",render:Tme}),Ime=` - - -`,Lme=` - - - -`,$me=` - - - -`,Nme=` - - -`,Fme=` - - -`,Rme=` - - -`,Ome=` - - -`,Pme=` - - -`,Dme=` - - -`,Bme=` - - -`,Hme=` - - -`,zme=` - - - -`,Wme=` - - -`,Ume=` - - - -`,jme=` - - -`,Vme=` - - - -`,qme=` - - -`,Kme=` - - -`,Zme=` - - -`,Gme=` - - -`,J_=` - - - - -`,Yme=` - - - - -`,Xme=` - - -`,Jme=` - - - - -`,Qme=` - - - - - -`,ege=` - - -`,tge=` - - -`,nge=` - - -`,oge=` - - -`,sge=` - - -`,ige=` - - -`,rge=` - - - -`,lge=` - - - -`,age=` - - -`,uge=` - - - - -`,cge=` - - - - -`,dge=` - - - - - - - - - - - - -`,fge=` - - -`,pge=` - - -`,hge=` - - - - -`,mge=` - - -`,gge=` - - -`,vge=` - - - - -`,yge=` - - - - -`,kge=` - - - -`,bge=` - - -`,Cge=` - - -`,wge=` - - - - -`,_ge=` - - -`,xge=` - - -`,Sge=` - - -`,Age=` - - - -`,Mge=` - - - - -`,Tge=` - - -`,Ege=` - - -`,Ige='',Lge=` - - -`,$ge=` - - -`,Nge=` - - - - -`,Fge=` - - - - -`,Rge=` - - -`,Oge=` - - - - - - - -`,Pge=` - - - - -`,Dge=` - - - - - -`,Bge=` - - -`,Hge=` - - -`,zge=` - - - - -`,Wge='',Uge='',jge='',Vge='',qge='',Kge='',Zge='',Gge='',Yge='',Xge='',Jge='',Qge='',e2e='',t2e='',n2e='',o2e='',s2e='',i2e='',r2e='',l2e='',a2e='',u2e='',c2e='',d2e='',f2e={sm:14,md:16,lg:20};function xt(e,t){return{component:e,svg:t}}const m$={plus:xt(Ife,Ime),"chat-new":xt(Nfe,Lme),"calendar-close":xt(_he,Vge),"calendar-schedule":xt(Ahe,qge),"calendar-todo":xt(Ehe,Kge),close:xt(f1e,Wme),check:xt(Xfe,Pme),archive:xt(Ofe,$me),search:xt(h0e,xge),copy:xt(C1e,Vme),link:xt($pe,fge),"external-link":xt(Dhe,Yge),download:xt(M1e,Kme),undo:xt(ihe,Bge),send:xt(v0e,Sge),image:xt(hpe,rge),settings:xt(b0e,Age),sliders:xt($0e,Ige),"light-mode":xt(Epe,dge),"dark-mode":xt(x1e,qme),"follow-system":xt(Y1e,ege),"log-in":xt(A0e,Tge),"log-out":xt(E0e,Ege),hand:xt(ape,sge),"full-access":xt(Q1e,tge),"shield-question":xt(_0e,Mge),"chevron-down":xt(e1e,Dme),"chevron-right":xt(o1e,Bme),"chevron-up":xt(r1e,Hme),"arrow-up":xt(Zfe,Ome),"arrow-down":xt(Bfe,Nme),"arrow-right":xt(Vfe,Rme),"arrow-left":xt(Wfe,Fme),minus:xt(zpe,mge),microscope:xt(jpe,gge),"panel-collapse":xt(_pe,uge),"panel-collapse-right":xt(hhe,Wge),"panel-expand":xt(Ape,cge),expand:xt(N1e,Gme),collapse:xt(m1e,Ume),list:xt(Rpe,pge),"list-settings":xt(ame,s2e),"tree-view":xt(dme,i2e),sort:xt(vme,l2e),grip:xt(ipe,oge),folder:xt(j1e,Jme),"folder-closed":xt(z1e,Xme),"folder-plus":xt(K1e,Qme),"folder-solid":xt(Qhe,t2e),file:xt(X_,J_),"file-text":xt(D1e,Yme),"file-edit":xt(I1e,Zme),"file-plus":xt(Khe,Qge),"file-off":xt(X_,J_),attachment:xt(vhe,Uge),"image-off":xt(vpe,lge),eye:xt(zhe,Xge),"eye-off":xt(jhe,Jge),code:xt($he,Zge),terminal:xt(j0e,Fge),pencil:xt(n0e,bge),tool:xt(Ame,c2e),glob:xt(bhe,jge),globe:xt(npe,nge),translate:xt(Q0e,Pge),"check-list":xt(Y0e,Oge),bolt:xt(Yhe,e2e),trash:xt(nhe,Dge),"git-fork":xt(nme,n2e),"git-pull-request":xt(ime,o2e),message:xt(y1e,jme),mail:xt(Dpe,hge),user:xt(ahe,Hge),info:xt(bpe,age),"help-circle":xt(a0e,wge),"alert-triangle":xt(dhe,zge),clock:xt(u1e,zme),robot:xt(d0e,_ge),sparkles:xt(z0e,Nge),histogram:xt(dpe,ige),music:xt(Ype,yge),emoji:xt(Rhe,Gge),target:xt(D0e,$ge),pause:xt(Qpe,kge),play:xt(i0e,Cge),pin:xt(hme,r2e),stop:xt(R0e,Lge),star:xt(bme,a2e),"star-outline":xt(_me,u2e),unpin:xt(Eme,d2e),"dots-horizontal":xt(Kpe,vge),thinking:xt(K0e,Rge)};function p2e(e){return m$[e]}function h2e(e,t){return e.replace(/]*>/,n=>n.replace(/\s(?:width|height)="[^"]*"/g,"")).replace(/^
        ([\s\S]*?)<\/summary>/,G7e=/([\s\S]*?)<\/resume_hint>/,C4=/]*)>|<\/subagent>/g,Y7e="",Fx=/(completed|failed|aborted):\s*(\d+)/g,Rx=/([a-z_]+)="([^"]*)"/g;function X7e(e){return e.replaceAll(""",'"').replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function J7e(e){const t={};Rx.lastIndex=0;let n;for(;(n=Rx.exec(e))!==null;)t[n[1]]=X7e(n[2]);return t}function Q7e(e){const t={completed:0,failed:0,aborted:0};Fx.lastIndex=0;let n;for(;(n=Fx.exec(e))!==null;){const o=n[1];t[o]=Number(n[2])}return t}function eke(e,t){const n=J7e(e);return{outcome:n.outcome??"completed",item:n.item,agentId:n.agent_id,mode:n.mode,state:n.state,body:t.trim()}}function tke(e){const t=[],n=[];C4.lastIndex=0;let o;for(;(o=C4.exec(e))!==null;)if(o[0]===Y7e){if(n.length===0)continue;const s=n.pop();s&&n.length===0&&t.push(eke(s.attrs,e.slice(s.bodyStart,o.index)))}else n.length===0?n.push({attrs:o[1]??"",bodyStart:C4.lastIndex}):n.push(null);return t}function nke(e){if(e==null)return null;const t=Array.isArray(e)?e.join(` -`):e;if(!t.includes(""))return null;const n=Z7e.exec(t)?.[1]?.trim()??"",{completed:o,failed:s,aborted:i}=Q7e(n),r=G7e.exec(t)?.[1]?.trim(),l=tke(t),a=o+s+i;return{summary:n,completed:o,failed:s,aborted:i,total:a>0?a:l.length,subagents:l,resumeHint:r}}function Ox(e){return e?e.split(` -`).map(t=>t.trimEnd()).filter(Boolean).at(-1)??"":""}function oke(e){return e.suspendedReason||Ox(e.text)||Ox(e.outputLines?.join(` -`))||e.summary||""}function ske(e){return e.suspendedReason?e.suspendedReason:e.text?e.text:e.outputLines&&e.outputLines.length>0?e.outputLines.join(` -`):e.summary??""}function ike(e){return e==="completed"?"completed":e==="failed"||e==="aborted"?"failed":"working"}function Px(e,t){return{id:e.agentId??e.item??`result-${t}`,agentId:e.agentId,name:e.item??`subagent ${t+1}`,activity:e.body.split(` -`)[0]??"",phase:ike(e.outcome),body:e.body}}function rke(e,t){return!!(t.agentId&&e.agentId===t.agentId||t.item&&e.name.includes(t.item))}function lke(e,t){const n=e.map(s=>({id:s.id,agentId:s.agentId,name:s.name,activity:oke(s),phase:s.phase,body:ske(s)}));if(!t)return n;const o=t.subagents.filter(s=>(s.outcome==="aborted"||s.state==="not_started")&&!e.some(i=>rke(i,s))).map((s,i)=>Px(s,i));return n.length>0?[...n,...o]:t.subagents.map((s,i)=>Px(s,i))}const ake=["aria-expanded"],uke={class:"title"},cke={key:0,class:"meta"},dke={key:1,class:"sum-txt"},fke={class:"rt"},pke={class:"status"},hke={key:0,class:"chip"},mke={key:1,class:"tm"},gke={class:"body"},vke={class:"overview"},yke={class:"overview-line"},kke={class:"big"},bke={key:0,class:"lbl"},Cke={key:1,class:"lbl"},wke={key:2,class:"lbl"},_ke={key:3,class:"lbl"},xke={key:0,class:"seg","aria-hidden":"true"},Ske={key:1,class:"legend"},Ake=["disabled","aria-label","aria-expanded","onClick"],Mke={class:"mname"},Tke={class:"mact"},Eke={class:"mphase"},Ike=["aria-expanded","onClick"],Lke={key:1,class:"fallback-output"},$ke={key:2,class:"waiting"},Nke=tt({__name:"SwarmTool",props:{tool:{},mobile:{type:Boolean,default:!1}},emits:["openMedia","openFile","openAgent"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t;function i(F){if(!F)return{};try{const W=JSON.parse(F),z=Array.isArray(W.items)?W.items:void 0;return{description:typeof W.description=="string"?W.description:void 0,itemCount:z?.length}}catch{return{}}}const r=on("resolveSwarmMembers"),l=R(()=>i(o.tool.arg)),a=R(()=>Lc(o.tool.name)),u=R(()=>l.value.description??""),c=R(()=>r?.(o.tool.id)??[]),d=R(()=>nke(o.tool.output)),f=on("modelDisplay"),h=on("subagentEffort"),g=R(()=>{let F;for(const W of c.value){const z=f?.(W.model),U=h?.(W.thinkingEffort),q=[z,U].filter(ie=>ie!==void 0);if(q.length===0)continue;const K=q.join(" · ");if(F===void 0)F=K;else if(F!==K)return}return F}),m=R(()=>o.tool.status),w=R(()=>m.value==="running"?"running":m.value==="error"||(d.value?.failed??0)>0||(d.value?.aborted??0)>0?"error":"ok"),_=R(()=>lke(c.value,d.value)),v=R(()=>{const F={completed:0,working:0,suspended:0,queued:0,failed:0};for(const W of _.value)F[W.phase]++;return F}),k=R(()=>_.value.length||l.value.itemCount||0),y=R(()=>v.value.completed+v.value.failed),x=R(()=>v.value.working+v.value.suspended+v.value.queued),M=[{phase:"completed",cls:"s-ok"},{phase:"working",cls:"s-run"},{phase:"suspended",cls:"s-warn"},{phase:"failed",cls:"s-fail"},{phase:"queued",cls:"s-queue"}],$=R(()=>M.map(({phase:F,cls:W})=>({phase:F,count:v.value[F],cls:W})).filter(F=>F.count>0)),S=Z(m.value==="running"||x.value>0);function I(){S.value=!S.value}const P=R(()=>_.value.length>0||d.value||m.value==="running"?"":(o.tool.output??[]).join(` -`).trim()),D=Z(new Set);function T(F){return D.value.has(F)}function L(F){const W=new Set(D.value);W.has(F)?W.delete(F):W.add(F),D.value=W}function B(F){if(F.agentId){s("openAgent",F.agentId);return}F.body&&L(F.id)}function H(F){return F.agentId!==void 0&&F.body.length>0&&(F.phase==="completed"||F.phase==="failed")}function O(F){return n(`tools.swarm.phase${F[0].toUpperCase()}${F.slice(1)}`)}return(F,W)=>(b(),A("div",{class:Re(["swarm-card",{open:S.value,err:w.value==="error"}])},[C("button",{class:"head",type:"button","aria-expanded":S.value,onClick:I},[V(p(Ie),{class:"ic",name:"sparkles",size:"sm"}),C("span",uke,N(a.value),1),u.value?(b(),A("span",cke,"·")):te("",!0),u.value?(b(),A("span",dke,N(u.value),1)):te("",!0),C("span",fke,[C("span",pke,[w.value==="ok"?(b(),me(p(Ie),{key:0,name:"check",size:"sm"})):w.value==="error"?(b(),me(p(Ie),{key:1,name:"close",size:"sm"})):(b(),me(p(pc),{key:2,status:"running"}))]),y.value>0||k.value>0?(b(),A("span",hke,N(y.value)+" / "+N(k.value),1)):te("",!0),e.tool.timing?(b(),A("span",mke,N(e.tool.timing),1)):te("",!0)]),V(p(Ie),{class:"car",name:"chevron-right",size:"sm"})],8,ake),In(C("div",gke,[C("div",vke,[C("div",yke,[C("span",kke,N(p(n)("tools.swarm.progress",{done:y.value,total:k.value})),1),g.value?(b(),A("span",bke,N(g.value),1)):te("",!0),w.value==="running"&&k.value>0?(b(),A("span",Cke,N(p(n)("tools.swarm.runningSub",{count:x.value})),1)):d.value?(b(),A("span",wke,N(p(n)("tools.swarm.doneSub",{completed:d.value.completed,failed:d.value.failed+d.value.aborted})),1)):(b(),A("span",_ke,N(p(n)("tools.swarm.waiting")),1))]),k.value>0&&$.value.length>0?(b(),A("div",xke,[(b(!0),A(Pe,null,pt($.value,z=>(b(),A("span",{key:z.phase,class:Re(z.cls),style:Gt({flex:z.count})},null,6))),128))])):te("",!0),$.value.length>1?(b(),A("div",Ske,[(b(!0),A(Pe,null,pt($.value,z=>(b(),A("span",{key:z.phase},[C("i",{class:Re(["lg-dot",z.cls])},null,2),Ve(N(O(z.phase))+" "+N(z.count),1)]))),128))])):te("",!0)]),_.value.length>0?(b(!0),A(Pe,{key:0},pt(_.value,z=>(b(),A("div",{key:z.id,class:Re(["member",[`phase-${z.phase}`,{open:!z.agentId&&T(z.id)}]])},[C("button",{class:"member-head",type:"button",disabled:!z.agentId&&!z.body,"aria-label":z.agentId?p(n)("tasks.openDetail"):void 0,"aria-expanded":!z.agentId&&z.body?T(z.id):void 0,onClick:U=>B(z)},[V(p(pc),{class:"row-dot",status:z.phase},null,8,["status"]),V(p(Pn),{text:z.name},{default:ke(()=>[C("span",Mke,N(z.name),1)]),_:2},1032,["text"]),z.activity?(b(),me(p(Pn),{key:0,text:z.activity},{default:ke(()=>[C("span",Tke,N(z.activity),1)]),_:2},1032,["text"])):te("",!0),C("span",Eke,N(O(z.phase)),1),z.agentId?(b(),me(p(Ie),{key:1,class:"mcar",name:"arrow-right",size:"sm"})):z.body?(b(),me(p(Ie),{key:2,class:"mcar",name:"chevron-right",size:"sm"})):te("",!0)],8,Ake),H(z)?(b(),A("button",{key:0,class:"member-saved",type:"button","aria-expanded":T(z.id),onClick:U=>L(z.id)},[V(p(Ie),{class:Re(["member-saved-car",{open:T(z.id)}]),name:"chevron-right",size:"sm","aria-hidden":"true"},null,8,["class"]),C("span",null,N(p(n)("tools.output.saved")),1)],8,Ike)):te("",!0),z.body&&(!z.agentId||H(z))?In((b(),A("div",{key:1,class:"member-body"},N(z.body),513)),[[Es,T(z.id)]]):te("",!0)],2))),128)):P.value?(b(),A("div",Lke,N(P.value),1)):(b(),A("div",$ke,N(p(n)("tools.swarm.waiting")),1))],512),[[Es,S.value]])],2))}}),Fke=ht(Nke,[["__scopeId","data-v-acce1193"]]),Rke=tt({__name:"StatusGlyph",props:{status:{}},setup(e){const t=e;return(n,o)=>(b(),A("span",{class:Re(["status-glyph",`s-${t.status}`]),"aria-hidden":"true"},[t.status==="run"?(b(),me(p(pc),{key:0,status:"running"})):t.status==="pending"?(b(),me(p(pc),{key:1,status:"idle"})):t.status==="done"?(b(),me(p(Ie),{key:2,name:"check",size:"sm"})):(b(),me(p(Ie),{key:3,name:"close",size:"sm"}))],2))}}),G5=ht(Rke,[["__scopeId","data-v-5e37bd5c"]]),Oke={class:"tl-name"},Pke={key:0,class:"tl-dim"},Dke={key:0,class:"tl-chip"},Bke={key:1,class:"todo-bar","aria-hidden":"true"},Hke={key:0,class:"todo-list"},zke={class:"todo-title"},Wke=tt({__name:"TodoTool",props:{tool:{},mobile:{type:Boolean,default:!1}},setup(e){const t=e,{t:n}=Lt();function o(g){const m=mu(g),w=m&&Array.isArray(m.todos)?m.todos:m&&Array.isArray(m.items)?m.items:void 0;if(!w)return[];const _=[];for(const v of w){if(!v||typeof v!="object")continue;const k=v,y=zn(k.title)??zn(k.content)??zn(k.activeForm)??zn(k.text);if(!y)continue;const x=zn(k.status)??"pending";_.push({title:y,status:x==="in_progress"?"in_progress":x==="done"||x==="completed"?"done":"pending"})}return _}const s=R(()=>t.tool.status),i=R(()=>o(t.tool.arg)),r=R(()=>i.value.filter(g=>g.status==="done").length),l=R(()=>i.value.length),a=R(()=>i.value.find(g=>g.status==="in_progress")),u=R(()=>l.value>0?r.value/l.value:0),c=R(()=>!!t.tool.output&&t.tool.output.length>0),d=R(()=>l.value>0||c.value),f=Z(t.tool.defaultExpanded===!0&&d.value);et(()=>[t.tool.defaultExpanded,t.tool.status],()=>{t.tool.defaultExpanded===!0&&d.value&&(f.value=!0)});function h(g){return g.status==="in_progress"?"run":g.status}return(g,m)=>(b(),me(el,{status:s.value,open:f.value,expandable:d.value,onToggle:m[0]||(m[0]=w=>f.value=!f.value)},{leading:ke(()=>[V(p(Ie),{name:"check-list",size:"sm"})]),trailing:ke(()=>[l.value>0?(b(),A("span",Dke,N(r.value)+"/"+N(l.value),1)):te("",!0),l.value>0?(b(),A("span",Bke,[C("span",{class:"todo-fill",style:Gt({width:`${u.value*100}%`})},null,4)])):te("",!0)]),body:ke(()=>[l.value>0?(b(),A("div",Hke,[(b(!0),A(Pe,null,pt(i.value,(w,_)=>(b(),A("div",{key:_,class:Re(["todo-row",`s-${w.status}`])},[V(G5,{status:h(w)},null,8,["status"]),C("span",zke,N(w.title),1)],2))),128))])):c.value?(b(),me(ur,{key:1,lines:e.tool.output},null,8,["lines"])):te("",!0)]),default:ke(()=>[C("span",Oke,N(p(n)("tools.label.todo")),1),a.value?(b(),A("span",Pke,N(a.value.title),1)):te("",!0)]),_:1},8,["status","open","expandable"]))}}),Uke=ht(Wke,[["__scopeId","data-v-461db4c2"]]),jke={class:"tl-name"},Vke={key:0},qke={key:1,class:"tl-dim"},Kke={key:0,class:"fetch-url"},Zke=tt({__name:"WebFetchTool",props:{tool:{},mobile:{type:Boolean,default:!1}},setup(e){const t=e,{t:n}=Lt(),o=R(()=>t.tool.status),s=R(()=>{const u=mu(t.tool.arg);return zn(u?.url)??zn(u?.uri)??""}),i=R(()=>s.value?n6e(s.value):""),r=R(()=>!!t.tool.output&&t.tool.output.length>0),l=R(()=>r.value),a=Z(t.tool.defaultExpanded===!0&&l.value);return et(()=>[t.tool.defaultExpanded,t.tool.output?.length,t.tool.status],()=>{t.tool.defaultExpanded===!0&&l.value&&(a.value=!0)}),(u,c)=>(b(),me(el,{status:o.value,open:a.value,expandable:l.value,onToggle:c[0]||(c[0]=d=>a.value=!a.value)},{leading:ke(()=>[V(p(Ie),{name:"globe",size:"sm"})]),body:ke(()=>[s.value?(b(),A("div",Kke,N(s.value),1)):te("",!0),V(ur,{lines:e.tool.output,"empty-text":p(n)("tools.output.waiting")},null,8,["lines","empty-text"])]),default:ke(()=>[C("span",jke,N(p(n)("tools.label.web_fetch")),1),i.value?(b(),A("span",Vke,N(i.value),1)):(b(),A("span",qke,N(e.tool.arg),1))]),_:1},8,["status","open","expandable"]))}}),Gke=ht(Zke,[["__scopeId","data-v-d6dc5dd3"]]);function Yke(e){if(e.media&&e.status==="ok")return x7e;switch(Vs(e.name)){case"bash":return a6e;case"read":return K7e;case"edit":case"write":case"multi_edit":return $6e;case"grep":case"search":return m7e;case"glob":case"ls":return Y6e;case"web_fetch":return Gke;case"todo":return Uke;case"task":return S5e;case"agentswarm":return Fke;case"askuserquestion":return t6e;case"exitplanmode":return D7e;case"creategoal":case"getgoal":case"setgoalbudget":case"updategoal":return s7e;default:return H6e}}const Y5=tt({__name:"ToolCall",props:{tool:{},mobile:{type:Boolean,default:!1}},emits:["openMedia","openFile","openAgent"],setup(e,{emit:t}){const n=e,o=t,s=R(()=>Yke(n.tool));return(i,r)=>(b(),me(ys(s.value),{tool:e.tool,mobile:e.mobile,onOpenMedia:r[0]||(r[0]=l=>o("openMedia",l)),onOpenFile:r[1]||(r[1]=l=>o("openFile",l)),onOpenAgent:r[2]||(r[2]=l=>o("openAgent",l))},null,40,["tool","mobile"]))}});function Ml(e){if(e>=1024*1024)return`${Dx(e/(1024*1024))}M`;if(e>=1024){const t=e/1024;return`${t>=100?Math.round(t):Dx(t)}k`}return String(e)}function Dx(e){const t=e.toFixed(1);return t.endsWith(".0")?t.slice(0,-2):t}function _c(e){const t=Math.max(0,Math.floor(e/1e3));if(t<60)return t===0?"":`${t}s`;const n=Math.floor(t/60);if(n<60){const i=t%60;return i===0?`${n}m`:`${n}m${i}s`}const o=Math.floor(n/60),s=n%60;return s===0?`${o}h`:`${o}h${s}m`}function na(e){if(e.blocks)return e.blocks;const t=[];e.thinking&&t.push({kind:"thinking",thinking:e.thinking}),e.text&&t.push({kind:"text",text:e.text});for(const n of e.tools??[])t.push({kind:"tool",tool:n});return t}function _N(e){return!(e.tool.status==="ok"&&e.tool.media)}function Xke(e){const t=na(e),n=[];let o=[],s=null;const i=()=>{const[l]=o;o.length===1&&l?n.push(l):o.length>1&&n.push({kind:"activity-run",items:o}),o=[]},r=()=>{s&&n.push({kind:"notification",items:s.items,sourceIndex:s.sourceIndex}),s=null};return t.forEach((l,a)=>{if(l.kind==="notification"){i(),s?s.items.push(l.notification):s={items:[l.notification],sourceIndex:a};return}if(r(),l.kind==="thinking"){o.push({kind:"thinking",thinking:l.thinking,startedAt:l.startedAt,durationMs:l.durationMs,sourceIndex:a});return}if(l.kind==="tool"&&_N(l)){o.push({kind:"tool",tool:l.tool,sourceIndex:a});return}i(),l.kind==="text"?n.push({kind:"text",text:l.text,sourceIndex:a}):l.kind==="tool"&&n.push({kind:"tool",tool:l.tool,sourceIndex:a})}),i(),r(),n}function xN(e){const t=Xke(e);let n=-1;for(let r=t.length-1;r>=0;r--){const l=t[r];if(l?.kind==="text"&&l.text.trim().length>0){n=r;break}}if(n===-1){for(let r=0;rr.kind==="notification");return i.length>0?{folded:o.filter(r=>r.kind!=="notification"),visible:[...i,...s]}:{folded:o,visible:s}}function Jke(e){let t;for(const n of e){if(n.kind!=="thinking"||n.startedAt===void 0)continue;const o=Date.parse(n.startedAt);Number.isNaN(o)||(t===void 0||ot.kind==="text"&&t.text?[t.text]:[]).join(` - -`)}function tbe(e){const t=[];for(const n of na(e))if(n.kind==="thinking"&&n.thinking)t.push(`> **Thinking** -> ${n.thinking.split(` -`).join(` -> `)}`);else if(n.kind==="text"&&n.text)t.push(n.text);else if(n.kind==="tool"&&n.tool.output&&n.tool.output.length>0){const o=n.tool.output.join(` -`);t.push(`\`\`\` -[${n.tool.name}] -${o} -\`\`\``)}else if(n.kind==="notification"){const o=n.notification,s=[o.title,o.type,...o.body.split(` -`)].filter(i=>i!=="");s.length>0&&t.push(`> **Notification** -> ${s.join(` -> `)}`)}return t.join(` - -`)}function SN(e){return e.tool.id||`tool-${e.sourceIndex}`}function AN(e,t){return e.kind==="activity-run"?`activity-run-${e.items[0]?.sourceIndex??t}`:e.kind==="tool"?SN({tool:e.tool,sourceIndex:e.sourceIndex}):`${e.kind}-${e.sourceIndex}`}function nbe(e){const t=new Map;for(const n of na(e)){if(n.kind!=="tool"||n.tool.status==="error")continue;const o=n.tool,s=Vs(o.name);if(s!=="edit"&&s!=="multi_edit"&&s!=="write")continue;let i,r=0,l=0,a=!1,u=!1,c=null;if(s==="write")i=Nx(o),a=!0,u=!0;else if(c=wN(o),i=Nx(o),c){const h=C$(c);r=h.added,l=h.removed}else u=!0;if(!i)continue;const d=obe(i),f=t.get(d);if(f)if(f.added+=r,f.removed+=l,f.hasWrite||=a,f.statsIncomplete||=u,f.diff!==null&&c!==null){let h=0,g=0;for(const w of f.diff)w.oldNo!==void 0&&w.oldNo>h&&(h=w.oldNo),w.newNo!==void 0&&w.newNo>g&&(g=w.newNo);const m=c.map(w=>({...w,oldNo:w.oldNo!==void 0?w.oldNo+h:void 0,newNo:w.newNo!==void 0?w.newNo+g:void 0}));f.diff=[...f.diff,{type:"hunk",text:"···"},...m]}else f.diff=null;else t.set(d,{path:i,added:r,removed:l,hasWrite:a,statsIncomplete:u,diff:c})}return[...t.values()]}function obe(e){const t=e.replace(/\\/g,"/");let n="",o=t,s=!1;const i=/^\/\/([^/]+\/[^/]+)(\/|$)/.exec(t);i?(n=`//${i[1].toLowerCase()}/`,o=t.slice(i[0].length-(i[0].endsWith("/")?1:0)),s=!0):/^[a-zA-Z]:\//.test(t)?(n=`${t[0].toLowerCase()}:/`,o=t.slice(3),s=!0):t.startsWith("/")&&(n="/",o=t.slice(1));const r=n!=="",l=[];for(const c of o.split("/"))if(!(!c||c===".")){if(c===".."){l.length>0&&l[l.length-1]!==".."?l.pop():r||l.push(c);continue}l.push(c)}const a=l.join("/"),u=n+a;return s?u.toLowerCase():u}const sbe=2e3,c1=new Map;function ibe(e){const t=[];for(const n of na(e)){if(n.kind!=="tool")continue;const o=n.tool,s=Vs(o.name);s!=="edit"&&s!=="multi_edit"&&s!=="write"||t.push(`${o.id}:${o.status}:${o.arg.length}`)}return t.join("|")}function rbe(e){const t=ibe(e),n=c1.get(e.id);if(n&&n.key===t)return n.changes;const o=nbe(e);if(c1.set(e.id,{key:t,changes:o}),c1.size>sbe){const s=c1.keys().next().value;s!==void 0&&c1.delete(s)}return o}const lbe=["aria-expanded"],abe={class:"think-title"},ube={key:0,class:"think-time"},cbe=["inert"],dbe={class:"think-text"},fbe=tt({__name:"ThinkingBlock",props:{text:{},mobile:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1},startedAt:{default:void 0},durationMs:{default:void 0}},setup(e){const t=e,n=Z(!1),{t:o}=Lt();et(()=>t.streaming,(d,f)=>{f&&!d&&(n.value=!1)});const s=Z(Date.now());et(()=>[t.streaming,t.startedAt],([d,f],h,g)=>{if(!d||!f)return;s.value=Date.now();const m=setInterval(()=>{s.value=Date.now()},1e3);g(()=>clearInterval(m))},{immediate:!0});const i=R(()=>{if(t.streaming&&t.startedAt){const d=Date.parse(t.startedAt);return Number.isFinite(d)?_c(s.value-d):""}if(t.durationMs!==void 0){const d=_c(t.durationMs);return d?`· ${d}`:""}return""}),r=on("pinScroll",()=>{}),l=Z(null),a=Z(null),u=Z(!1);function c(){if(!n.value){const f=(a.value?.scrollHeight??0)>(typeof window<"u"?window.innerHeight:0);u.value=t.streaming&&f}if(n.value=!n.value,t.streaming)return;const d=l.value;d&&yt(()=>r(d))}return(d,f)=>(b(),A("div",{class:Re(["think",{mob:e.mobile,open:n.value,streaming:e.streaming}])},[C("button",{ref_key:"headEl",ref:l,class:"think-head",type:"button","aria-expanded":n.value,onClick:c},[V(p(Ie),{class:"think-bulb",name:"thinking",size:"sm"}),C("span",abe,N(e.streaming?p(o)("thinking.streaming"):p(o)("thinking.panelTitle")),1),i.value?(b(),A("span",ube,N(i.value),1)):te("",!0),V(p(Ie),{class:"think-car",name:"chevron-right",size:"sm"})],8,lbe),C("div",{class:Re(["think-body",{open:n.value,instant:u.value}]),inert:!n.value},[C("div",{ref_key:"bodyInnerEl",ref:a,class:"think-body-inner"},[C("pre",dbe,N(e.text),1)],512)],10,cbe)],2))}}),X5=ht(fbe,[["__scopeId","data-v-eddcd6b9"]]),Ha=Wn.global.t,MN=new Set(["read","bash","grep","search","glob","ls","web_fetch","edit","write"]);function TN(e){const t=Vs(e);return t==="multi_edit"?"edit":t}function EN(e){const t=[],n=new Map;for(const o of e){if(o.kind==="thinking")continue;const s=TN(o.tool.name);let i=n.get(s);i||(i={count:0,errors:0},n.set(s,i),t.push(s)),i.count++,o.tool.status==="error"&&i.errors++}return{order:t,byKind:n}}function IN(e,t){return MN.has(e)?Ha(`tools.group.typed.${e}.done`,{count:t}):Ha("tools.group.countOther",{count:t})}function LN(e){return{text:Ha("tools.activity.failedClause",{count:e}),tone:"danger"}}function $N(e){return e.map(t=>t.fragments.map(n=>n.text).join("")).join(" · ")}function pbe(e,t={}){const{order:n,byKind:o}=EN(e),s=[];let i=!1;for(const r of n){const l=o.get(r);if(!l)continue;const a=[{text:IN(r,l.count),tone:"normal"}];l.errors>0&&(i=!0,a.push(LN(l.errors))),s.push({fragments:a})}if(t.durationMs!==void 0){const r=_c(t.durationMs);r&&s.push({fragments:[{text:r,tone:"faint"}]})}return{clauses:s,plain:$N(s),hasError:i}}function hbe(e){if(e.kind==="thinking")return{fragments:[{text:Ha("thinking.streaming"),tone:"normal"}]};const t=TN(e.tool.name);let n=yg(e.tool.name,e.tool.arg);if(t==="write"&&n){const s=Ha("tools.chip.created");n.endsWith(s)&&(n=n.slice(0,n.length-s.length).trimEnd())}return{fragments:[{text:n&&MN.has(t)?Ha(`tools.activity.doing.${t}`,{subject:n}):Ha("tools.activity.busy"),tone:"normal"}]}}function mbe(e,t){const n=e.filter(u=>u!==t&&!(u.kind==="tool"&&u.tool.status==="running")),{order:o,byKind:s}=EN(n),i=Ha("tools.activity.liveDonePrefix"),r=[];for(const u of o){const c=s.get(u);if(!c)continue;const d=[{text:`${i}${IN(u,c.count)}`,tone:"faint"}];c.errors>0&&d.push(LN(c.errors)),r.push({fragments:d})}const l=t===null?null:hbe(t),a=l?[l,...r]:r;return{current:l,done:r,plain:$N(a)}}const gbe=["aria-expanded"],vbe=["aria-label"],ybe=["title"],kbe={key:0,class:"ar-sep"},bbe=["inert"],Cbe={class:"ar-body-inner"},wbe=tt({__name:"ActivityRun",props:{items:{},mobile:{type:Boolean,default:!1},streaming:{type:Boolean,default:!1}},emits:["openMedia","openFile","openAgent"],setup(e,{emit:t}){const n=e,o=t,s=R(()=>n.items.at(-1)),i=R(()=>{const S=s.value;if(n.streaming&&S?.kind==="thinking")return S;for(let I=n.items.length-1;I>=0;I--){const P=n.items[I];if(P?.kind==="tool"&&P.tool.status==="running")return P}return null}),r=R(()=>{if(n.streaming)return"running";for(const S of n.items)if(S.kind==="tool"&&S.tool.status==="running")return"running";for(const S of n.items)if(S.kind==="tool"&&S.tool.status==="error")return"error";return"done"}),l=Z(r.value==="running"),a=on("pinScroll",()=>{}),u=Z(null),c=Z(null),d=Z(void 0),f=Z(Date.now()),h=R(()=>{let S=null;for(const I of n.items)if(I.kind==="thinking"&&I.startedAt!==void 0){const P=Date.parse(I.startedAt);Number.isFinite(P)&&(S===null||P{if(S==="running"){I!==void 0&&I!=="running"&&(l.value=!0),c.value===null&&(c.value=h.value??Date.now()),d.value=void 0,f.value=Date.now();const D=setInterval(()=>{f.value=Date.now()},1e3);P(()=>clearInterval(D));return}I==="running"&&(l.value=!1,c.value!==null&&(d.value=Date.now()-c.value),c.value=null)},{immediate:!0});function g(){if(l.value=!l.value,n.streaming)return;const S=u.value;S&&yt(()=>a(S))}const m=R(()=>{if(r.value==="done")return"check";if(r.value==="error")return"close";const S=i.value??s.value;return S?S.kind==="thinking"?"thinking":g$(S.tool.name):"tool"}),w=R(()=>mbe(n.items,i.value)),_=R(()=>pbe(n.items,{durationMs:d.value})),v=R(()=>r.value!=="running"||c.value===null?"":_c(f.value-c.value)),k=R(()=>{if(r.value!=="running")return _.value.clauses;const S=[];return w.value.current&&S.push(w.value.current),S.push(...w.value.done),v.value&&S.push({fragments:[{text:v.value,tone:"faint"}]}),S}),y=R(()=>r.value!=="running"?_.value.plain:[w.value.plain,v.value].filter(Boolean).join(" · "));function x(S){if(S==="danger")return"ar-danger";if(S==="faint")return"ar-faint"}function M(S){return S.kind==="tool"?SN(S):`thinking-${S.sourceIndex}`}function $(S){return n.streaming&&S.kind==="thinking"&&S.durationMs===void 0&&S.sourceIndex===s.value?.sourceIndex}return(S,I)=>(b(),A("div",{class:Re(["activity-run",{open:l.value}])},[C("button",{ref_key:"headEl",ref:u,class:"ar-head",type:"button","aria-expanded":l.value,onClick:g},[C("span",{class:Re(["ar-glyph",{run:r.value==="running",err:r.value==="error",ok:r.value==="done"}]),role:"status","aria-label":r.value},[V(p(Ie),{name:m.value,size:"sm","aria-hidden":"true"},null,8,["name"])],10,vbe),C("span",{class:"ar-sum",title:y.value},[(b(!0),A(Pe,null,pt(k.value,(P,D)=>(b(),A(Pe,{key:D},[D>0?(b(),A("span",kbe," · ")):te("",!0),(b(!0),A(Pe,null,pt(P.fragments,(T,L)=>(b(),A("span",{key:L,class:Re(x(T.tone))},N(T.text),3))),128))],64))),128))],8,ybe),V(p(Ie),{class:"ar-car",name:"chevron-right",size:"sm","aria-hidden":"true"})],8,gbe),C("div",{class:Re(["ar-body",{open:l.value}]),inert:!l.value},[C("div",Cbe,[(b(!0),A(Pe,null,pt(e.items,P=>(b(),A(Pe,{key:M(P)},[P.kind==="thinking"?(b(),me(X5,{key:0,text:P.thinking,mobile:e.mobile,streaming:$(P),"started-at":P.startedAt,"duration-ms":P.durationMs},null,8,["text","mobile","streaming","started-at","duration-ms"])):(b(),me(Y5,{key:1,tool:P.tool,mobile:e.mobile,onOpenMedia:I[0]||(I[0]=D=>o("openMedia",D)),onOpenFile:I[1]||(I[1]=D=>o("openFile",D)),onOpenAgent:I[2]||(I[2]=D=>o("openAgent",D))},null,8,["tool","mobile"]))],64))),128))])],10,bbe)],2))}}),NN=ht(wbe,[["__scopeId","data-v-ad9927a0"]]);function _be(e,t){try{const n=new Date(e);if(Number.isNaN(n.getTime()))return e;const o=new Date,s=c=>String(c).padStart(2,"0"),i=`${s(n.getHours())}:${s(n.getMinutes())}`,r=n.getFullYear()===o.getFullYear(),l=n.getMonth()===o.getMonth(),a=n.getDate()===o.getDate();if(r&&l&&a)return i;const u=new Date(o);return u.setDate(o.getDate()-1),n.getFullYear()===u.getFullYear()&&n.getMonth()===u.getMonth()&&n.getDate()===u.getDate()?`${t} ${i}`:r?`${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`:`${n.getFullYear()}-${s(n.getMonth()+1)}-${s(n.getDate())} ${i}`}catch{return e}}const xbe={class:"msg-time"},Sbe=tt({__name:"MessageTime",props:{time:{}},setup(e){const t=e,{t:n}=Lt(),o=R(()=>_be(t.time,n("conversation.yesterday")));return(s,i)=>(b(),A("span",xbe,N(o.value),1))}}),Ng=ht(Sbe,[["__scopeId","data-v-c6ad4629"]]),Abe=["aria-expanded"],Mbe={class:"ntf-chip"},Tbe={class:"ntf-main"},Ebe={class:"ntf-title"},Ibe={class:"ntf-sub"},Lbe={class:"ntf-side"},$be={class:"ng-dots"},Nbe={class:"ng-list"},Fbe=["aria-expanded","onClick"],Rbe={class:"ntf-chip"},Obe={class:"ntf-main"},Pbe={class:"ntf-title"},Dbe={class:"ntf-sub"},Bbe={class:"ntf-side"},Hbe={class:"st"},zbe={class:"ntf-body"},Wbe={class:"ntf-body-in"},Ube={class:"nd-fields"},jbe={class:"k"},Vbe={class:"v"},qbe={class:"k"},Kbe={class:"v"},Zbe={class:"k"},Gbe={class:"v"},Ybe={key:0,class:"nd-body"},Xbe={key:1,class:"nd-out"},Jbe=["title"],Qbe=["onClick"],eCe={class:"nd-raw"},tCe=["aria-expanded"],nCe={class:"ntf-chip"},oCe={class:"ntf-main"},sCe={class:"ntf-title"},iCe={class:"ntf-sub"},rCe={class:"ntf-side"},lCe={class:"st"},aCe={class:"ntf-body"},uCe={class:"ntf-body-in"},cCe={class:"nd-fields"},dCe={class:"k"},fCe={class:"v"},pCe={class:"k"},hCe={class:"v"},mCe={class:"k"},gCe={class:"v"},vCe={key:0,class:"nd-body"},yCe={key:1,class:"nd-out"},kCe=["title"],bCe={class:"nd-raw"},CCe=tt({__name:"NotificationCard",props:{items:{}},setup(e){const t=e,{t:n}=Lt(),o=R(()=>t.items.length>1),s=Z(!1),i=Z(new Set);function r(k,y){return k.id!==""?`${k.id}#${y}`:`ntf-${y}`}function l(k){const y=new Set(i.value);y.has(k)?y.delete(k):y.add(k),i.value=y}const a={completed:"check",failed:"alert-triangle",timed_out:"clock",killed:"stop",lost:"alert-triangle",info:"info"};function u(k){const y=lm(k);return y==="info"&&k.sourceKind==="subagent"?"robot":a[y]}function c(k){return k.sourceKind==="subagent"?n("conversation.notification.kindSubagent"):n("conversation.notification.kindTask")}function d(k){return n(`conversation.notification.title.${lm(k)}`,{kind:c(k)})}function f(k){return n(`conversation.notification.status.${lm(k)}`)}function h(k){return f9e(k)}function g(k){return k==="ok"?"done":k==="err"?"error":k==="warn"?"warn":""}const m=R(()=>t.items.map(k=>k.title).filter(k=>k!=="").join(" · ")),w=Z(null);let _=null;async function v(k,y){await js(k)&&(w.value=y,_!==null&&clearTimeout(_),_=setTimeout(()=>{_=null,w.value=null},1200))}return(k,y)=>o.value?(b(),A("div",{key:0,class:Re(["ntf-group-card",{open:s.value}])},[C("button",{class:"ntf-head",type:"button","aria-expanded":s.value,onClick:y[0]||(y[0]=x=>s.value=!s.value)},[C("span",Mbe,[V(p(Ie),{name:"terminal",size:"sm"})]),C("span",Tbe,[C("span",Ebe,N(p(n)("conversation.notification.groupTitle",{n:e.items.length})),1),C("span",Ibe,N(m.value),1)]),C("span",Lbe,[C("span",$be,[(b(!0),A(Pe,null,pt(e.items,(x,M)=>(b(),A("span",{key:r(x,M),class:Re(["dot",g(h(x))])},null,2))),128))]),V(p(Ie),{class:"ntf-car",name:"chevron-right",size:"sm"})])],8,Abe),In(C("div",Nbe,[(b(!0),A(Pe,null,pt(e.items,(x,M)=>(b(),A("div",{key:r(x,M),class:Re(["ng-item",[h(x),{open:i.value.has(r(x,M))}]])},[C("button",{class:"ntf-head",type:"button","aria-expanded":i.value.has(r(x,M)),onClick:$=>l(r(x,M))},[C("span",Rbe,[V(p(Ie),{name:u(x),size:"sm"},null,8,["name"])]),C("span",Obe,[C("span",Pbe,N(d(x)),1),C("span",Dbe,N(x.title),1)]),C("span",Bbe,[C("span",Hbe,N(f(x)),1),x.createdAt?(b(),me(Ng,{key:0,time:x.createdAt},null,8,["time"])):te("",!0),V(p(Ie),{class:"ntf-car",name:"chevron-right",size:"sm"})])],8,Fbe),In(C("div",zbe,[C("div",Wbe,[C("div",Ube,[C("span",jbe,N(p(n)("conversation.notification.fields.type")),1),C("span",Vbe,N(x.type),1),C("span",qbe,N(p(n)("conversation.notification.fields.source")),1),C("span",Kbe,N(x.sourceKind)+" · "+N(x.sourceId),1),C("span",Zbe,N(p(n)("conversation.notification.fields.severity")),1),C("span",Gbe,N(x.severity||"—"),1)]),x.body?(b(),A("div",Ybe,N(x.body),1)):te("",!0),x.outputFile?(b(),A("div",Xbe,[V(p(Ie),{class:"nd-out-ic",name:"file-text",size:"sm"}),C("span",{class:"path",title:x.outputFile.path},N(x.outputFile.path),9,Jbe),C("button",{class:"nd-act",type:"button",onClick:Et($=>v(x.outputFile.path,r(x,M)),["stop"])},N(w.value===r(x,M)?p(n)("conversation.notification.copied"):p(n)("conversation.notification.copyPath")),9,Qbe)])):te("",!0),C("details",eCe,[C("summary",null,[V(p(Ie),{class:"nd-raw-car",name:"chevron-right",size:"sm"}),C("span",null,N(p(n)("conversation.notification.rawPayload")),1)]),C("pre",null,N(x.raw),1)])])],512),[[Es,i.value.has(r(x,M))]])],2))),128))],512),[[Es,s.value]])],2)):e.items[0]?(b(),A("div",{key:1,class:Re(["ntf",[h(e.items[0]),{open:i.value.has(r(e.items[0],0))}]])},[C("button",{class:"ntf-head",type:"button","aria-expanded":i.value.has(r(e.items[0],0)),onClick:y[1]||(y[1]=x=>l(r(e.items[0],0)))},[C("span",nCe,[V(p(Ie),{name:u(e.items[0]),size:"sm"},null,8,["name"])]),C("span",oCe,[C("span",sCe,N(d(e.items[0])),1),C("span",iCe,N(e.items[0].title),1)]),C("span",rCe,[C("span",lCe,N(f(e.items[0])),1),e.items[0].createdAt?(b(),me(Ng,{key:0,time:e.items[0].createdAt},null,8,["time"])):te("",!0),V(p(Ie),{class:"ntf-car",name:"chevron-right",size:"sm"})])],8,tCe),In(C("div",aCe,[C("div",uCe,[C("div",cCe,[C("span",dCe,N(p(n)("conversation.notification.fields.type")),1),C("span",fCe,N(e.items[0].type),1),C("span",pCe,N(p(n)("conversation.notification.fields.source")),1),C("span",hCe,N(e.items[0].sourceKind)+" · "+N(e.items[0].sourceId),1),C("span",mCe,N(p(n)("conversation.notification.fields.severity")),1),C("span",gCe,N(e.items[0].severity||"—"),1)]),e.items[0].body?(b(),A("div",vCe,N(e.items[0].body),1)):te("",!0),e.items[0].outputFile?(b(),A("div",yCe,[V(p(Ie),{class:"nd-out-ic",name:"file-text",size:"sm"}),C("span",{class:"path",title:e.items[0].outputFile.path},N(e.items[0].outputFile.path),9,kCe),C("button",{class:"nd-act",type:"button",onClick:y[2]||(y[2]=Et(x=>v(e.items[0].outputFile.path,r(e.items[0],0)),["stop"]))},N(w.value===r(e.items[0],0)?p(n)("conversation.notification.copied"):p(n)("conversation.notification.copyPath")),1)])):te("",!0),C("details",bCe,[C("summary",null,[V(p(Ie),{class:"nd-raw-car",name:"chevron-right",size:"sm"}),C("span",null,N(p(n)("conversation.notification.rawPayload")),1)]),C("pre",null,N(e.items[0].raw),1)])])],512),[[Es,i.value.has(r(e.items[0],0))]])],2)):te("",!0)}}),FN=ht(CCe,[["__scopeId","data-v-56e1f5ac"]]),wCe=["aria-expanded"],_Ce=["title"],xCe=["inert"],SCe={class:"tf-body-inner"},ACe={key:1,class:"msg"},MCe=tt({__name:"TurnFold",props:{items:{},mobile:{type:Boolean,default:!1},streamingTailIndex:{default:null},live:{type:Boolean,default:!1},parked:{type:Boolean,default:!1},seedMs:{default:void 0},createdMs:{default:void 0},endedMs:{default:void 0},durationMs:{default:void 0}},emits:["openMedia","openFile","openAgent"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>n.streamingTailIndex!==null),r=R(()=>n.live?n.parked?"parked":"live":"settled"),l=Z(!1),a=R(()=>i.value||l.value),u=on("pinScroll",()=>{}),c=Z(null),d=Z(Date.now());let f=null;function h(){f!==null&&(clearInterval(f),f=null)}kn(h),et(r,(y,x)=>{y!=="settled"?(d.value=Date.now(),f===null&&(f=setInterval(()=>{d.value=Date.now()},1e3))):h(),x==="live"&&y!=="live"&&(l.value=!1)},{immediate:!0});const g=R(()=>n.seedMs===void 0?n.createdMs:n.createdMs===void 0?n.seedMs:Math.min(n.seedMs,n.createdMs)),m=R(()=>Qke({startMs:g.value,endedMs:n.endedMs,durationMs:n.durationMs,state:r.value==="settled"?{phase:"settled"}:{phase:"live",nowMs:d.value}}));function w(){l.value=!l.value,yt(()=>{const y=c.value;y&&u(y)})}const _=R(()=>{const y=m.value===void 0?"":_c(m.value);return y?s("conversation.fold.worked",{duration:y}):s("conversation.fold.workedUnknown")});function v(y){return n.streamingTailIndex===null||y.kind==="thinking"&&y.durationMs!==void 0?!1:y.sourceIndex===n.streamingTailIndex}function k(y){if(n.streamingTailIndex===null)return!1;const x=y.items.at(-1);return x?.kind==="thinking"&&x.durationMs!==void 0?!1:x!==void 0&&x.sourceIndex===n.streamingTailIndex}return(y,x)=>e.items.length>0?(b(),A("div",{key:0,class:Re(["turn-fold",{open:a.value,streaming:i.value}])},[i.value?te("",!0):(b(),A("button",{key:0,ref_key:"headEl",ref:c,class:"tf-head",type:"button","aria-expanded":l.value,onClick:w},[C("span",{class:"tf-sum",title:_.value},N(_.value),9,_Ce),V(p(Ie),{class:"tf-car",name:"chevron-right",size:"sm","aria-hidden":"true"})],8,wCe)),C("div",{class:Re(["tf-body",{open:a.value}]),inert:!a.value},[C("div",SCe,[(b(!0),A(Pe,null,pt(e.items,(M,$)=>(b(),A(Pe,{key:p(AN)(M,$)},[M.kind==="thinking"?(b(),me(X5,{key:0,text:M.thinking,mobile:e.mobile,streaming:v(M),"started-at":M.startedAt,"duration-ms":M.durationMs},null,8,["text","mobile","streaming","started-at","duration-ms"])):M.kind==="text"&&M.text?(b(),A("div",ACe,[V(p(Ic),{text:M.text,streaming:v(M),"open-file":S=>o("openFile",S)},null,8,["text","streaming","open-file"])])):M.kind==="activity-run"?(b(),me(NN,{key:2,items:M.items,mobile:e.mobile,streaming:k(M),onOpenMedia:x[0]||(x[0]=S=>o("openMedia",S)),onOpenFile:x[1]||(x[1]=S=>o("openFile",S)),onOpenAgent:x[2]||(x[2]=S=>o("openAgent",S))},null,8,["items","mobile","streaming"])):M.kind==="tool"?(b(),me(Y5,{key:3,tool:M.tool,mobile:e.mobile,onOpenMedia:x[3]||(x[3]=S=>o("openMedia",S)),onOpenFile:x[4]||(x[4]=S=>o("openFile",S)),onOpenAgent:x[5]||(x[5]=S=>o("openAgent",S))},null,8,["tool","mobile"])):M.kind==="notification"?(b(),me(FN,{key:4,items:M.items},null,8,["items"])):te("",!0)],64))),128))])],10,xCe)],2)):te("",!0)}}),TCe=ht(MCe,[["__scopeId","data-v-56d78783"]]),ECe={class:"turn-files"},ICe={class:"tf-ic","aria-hidden":"true"},LCe={class:"tf-title"},$Ce={key:0,class:"tf-stats"},NCe={key:0,class:"tf-add"},FCe={key:1,class:"tf-del"},RCe={class:"diffbar","aria-hidden":"true"},OCe={class:"tf-list"},PCe={key:0,class:"tf-dir"},DCe={class:"tf-base"},BCe={key:0,class:"tf-stats"},HCe={key:0,class:"tf-add"},zCe={key:1,class:"tf-del"},w4=3,WCe=tt({__name:"TurnFilesSummary",props:{changes:{},cwd:{},interactive:{type:Boolean,default:!0}},emits:["openDiff","openFile"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>n.interactive!==!1),r=R(()=>{const y=n.changes.length;return s(y===1?"conversation.turnFiles.titleOne":"conversation.turnFiles.titleOther",{number:y})}),l=R(()=>n.changes.some(y=>y.statsIncomplete)),a=R(()=>{let y=0,x=0;for(const M of n.changes)y+=M.added,x+=M.removed;return{added:y,removed:x}}),u=R(()=>!l.value&&(a.value.added>0||a.value.removed>0)),c=Z(!1),d=R(()=>c.value?n.changes:n.changes.slice(0,w4)),f=R(()=>Math.max(0,n.changes.length-w4)),h=R(()=>n.changes.length>w4),g=R(()=>c.value?s("conversation.turnFiles.showLess"):f.value===1?s("conversation.turnFiles.moreOne"):s("conversation.turnFiles.more",{number:f.value}));function m(y){const x=n.cwd?F2(y,n.cwd):null;return x!==null?x||xf(y):y}function w(y){const x=m(y),M=Math.max(x.lastIndexOf("/"),x.lastIndexOf("\\"));return M>0?x.slice(0,M+1):""}function _(y){const x=m(y),M=Math.max(x.lastIndexOf("/"),x.lastIndexOf("\\"));return M>=0?x.slice(M+1):x}function v(y){return y.statsIncomplete||y.added===0&&y.removed===0?null:{added:y.added,removed:y.removed}}function k(y){y.hasWrite?o("openFile",{path:y.path}):o("openDiff",y)}return(y,x)=>(b(),A("div",ECe,[V(p(Gz),null,cA({head:ke(()=>[C("span",ICe,[V(p(Ie),{name:"pencil",size:"sm"})]),C("span",LCe,N(r.value),1),u.value?(b(),A("span",$Ce,[a.value.added>0?(b(),A("span",NCe,"+"+N(a.value.added),1)):te("",!0),a.value.removed>0?(b(),A("span",FCe,"−"+N(a.value.removed),1)):te("",!0),C("span",RCe,[C("span",{class:"seg-add",style:Gt({flexGrow:a.value.added})},null,4),C("span",{class:"seg-del",style:Gt({flexGrow:a.value.removed})},null,4)])])):te("",!0)]),default:ke(()=>[C("ul",OCe,[(b(!0),A(Pe,null,pt(d.value,M=>(b(),A("li",{key:M.path,class:"tf-row"},[(b(),me(ys(i.value?"button":"span"),{class:"tf-file",type:i.value?"button":void 0,onClick:$=>i.value&&k(M)},{default:ke(()=>[w(M.path)?(b(),A("span",PCe,N(w(M.path)),1)):te("",!0),C("span",DCe,N(_(M.path)),1)]),_:2},1032,["type","onClick"])),v(M)?(b(),A("span",BCe,[v(M).added>0?(b(),A("span",HCe,"+"+N(v(M).added),1)):te("",!0),v(M).removed>0?(b(),A("span",zCe,"−"+N(v(M).removed),1)):te("",!0)])):te("",!0)]))),128))])]),_:2},[h.value?{name:"foot",fn:ke(()=>[V(p(Ft),{variant:"ghost",size:"sm",class:"tf-more","aria-expanded":c.value,onClick:x[0]||(x[0]=M=>c.value=!c.value)},{default:ke(()=>[Ve(N(g.value)+" ",1),V(p(Ie),{class:Re(["tf-more-car",{open:c.value}]),name:"chevron-down",size:"sm","aria-hidden":"true"},null,8,["class"])]),_:1},8,["aria-expanded"])]),key:"0"}:void 0]),1024)]))}}),UCe=ht(WCe,[["__scopeId","data-v-4faa5c71"]]),jCe={class:"activity-notice",role:"status"},VCe={"aria-hidden":"true"},qCe={class:"an-label"},KCe=tt({__name:"ActivityNotice",props:{label:{}},setup(e){return(t,n)=>(b(),A("div",jCe,[C("span",VCe,[V(p(Ao),{size:"sm"})]),C("span",qCe,N(e.label),1)]))}}),ZCe=ht(KCe,[["__scopeId","data-v-13694e23"]]),GCe=["data-turn-id"],YCe=["title"],XCe={class:"cn-head-text"},JCe={key:0,class:"cn-bubble"},QCe={class:"cn-prompt"},ewe={key:1,class:"cn-meta"},twe=tt({__name:"CronNotice",props:{text:{},cron:{},turnId:{},createdAt:{}},setup(e){const t=e,{t:n}=Lt(),o=R(()=>t.cron),s=R(()=>o.value?.missedCount!==void 0),i=R(()=>s.value?n("conversation.cron.missed"):n("conversation.cron.fired")),r=R(()=>{const f=o.value;return!f?.cron||f.recurring===!1?"":f.cron}),l=R(()=>s.value?"error":"ok"),a=R(()=>{const f=o.value;if(!f)return"";const h=[];return f.recurring===!1&&h.push(n("conversation.cron.oneShot")),typeof f.coalescedCount=="number"&&f.coalescedCount>1&&h.push(n("conversation.cron.coalesced",{n:f.coalescedCount})),f.missedCount!==void 0&&h.push(n("conversation.cron.missedCount",{n:f.missedCount})),f.stale===!0&&h.push(n("conversation.cron.finalDelivery")),h.join(" · ")}),u=R(()=>{const f=[i.value];return r.value&&f.push(r.value),a.value&&f.push(a.value),f.join(" · ")}),c=R(()=>{const f=o.value?.jobId;return f?n("conversation.cron.job",{id:f}):void 0}),d=R(()=>t.text??"");return(f,h)=>(b(),A("div",{class:Re(["cn cron-notice",{"turn-anchor":!!e.turnId}]),"data-turn-id":e.turnId,role:"status"},[C("div",{class:Re(["cn-head",l.value]),title:c.value},[V(p(Ie),{name:"clock",size:"sm",class:"cn-head-ico","aria-hidden":"true"}),C("span",XCe,N(u.value),1)],10,YCe),d.value?(b(),A("div",JCe,[C("span",QCe,N(d.value),1)])):te("",!0),e.createdAt?(b(),A("div",ewe,[V(Ng,{time:e.createdAt},null,8,["time"])])):te("",!0)],10,GCe))}}),nwe=ht(twe,[["__scopeId","data-v-945035a6"]]);/*! - * PhotoSwipe 5.4.4 - https://photoswipe.com - * (c) 2024 Dmytro Semenov - */function Ji(e,t,n){const o=document.createElement(t);return e&&(o.className=e),n&&n.appendChild(o),o}function is(e,t){return e.x=t.x,e.y=t.y,t.id!==void 0&&(e.id=t.id),e}function RN(e){e.x=Math.round(e.x),e.y=Math.round(e.y)}function Cy(e,t){const n=Math.abs(e.x-t.x),o=Math.abs(e.y-t.y);return Math.sqrt(n*n+o*o)}function sp(e,t){return e.x===t.x&&e.y===t.y}function i0(e,t,n){return Math.min(Math.max(e,t),n)}function Np(e,t,n){let o=`translate3d(${e}px,${t||0}px,0)`;return n!==void 0&&(o+=` scale3d(${n},${n},1)`),o}function ec(e,t,n,o){e.style.transform=Np(t,n,o)}const owe="cubic-bezier(.4,0,.22,1)";function ON(e,t,n,o){e.style.transition=t?`${t} ${n}ms ${o||owe}`:"none"}function wy(e,t,n){e.style.width=typeof t=="number"?`${t}px`:t,e.style.height=typeof n=="number"?`${n}px`:n}function swe(e){ON(e)}function iwe(e){return"decode"in e?e.decode().catch(()=>{}):e.complete?Promise.resolve(e):new Promise((t,n)=>{e.onload=()=>t(e),e.onerror=n})}const mr={IDLE:"idle",LOADING:"loading",LOADED:"loaded",ERROR:"error"};function rwe(e){return"button"in e&&e.button===1||e.ctrlKey||e.metaKey||e.altKey||e.shiftKey}function lwe(e,t,n=document){let o=[];if(e instanceof Element)o=[e];else if(e instanceof NodeList||Array.isArray(e))o=Array.from(e);else{const s=typeof e=="string"?e:t;s&&(o=Array.from(n.querySelectorAll(s)))}return o}function Hx(){return!!(navigator.vendor&&navigator.vendor.match(/apple/i))}let PN=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{PN=!0}}))}catch{}class awe{constructor(){this._pool=[]}add(t,n,o,s){this._toggleListener(t,n,o,s)}remove(t,n,o,s){this._toggleListener(t,n,o,s,!0)}removeAll(){this._pool.forEach(t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)}),this._pool=[]}_toggleListener(t,n,o,s,i,r){if(!t)return;const l=i?"removeEventListener":"addEventListener";n.split(" ").forEach(u=>{if(u){r||(i?this._pool=this._pool.filter(d=>d.type!==u||d.listener!==o||d.target!==t):this._pool.push({target:t,type:u,listener:o,passive:s}));const c=PN?{passive:s||!1}:!1;t[l](u,o,c)}})}}function DN(e,t){if(e.getViewportSizeFn){const n=e.getViewportSizeFn(e,t);if(n)return n}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function L1(e,t,n,o,s){let i=0;if(t.paddingFn)i=t.paddingFn(n,o,s)[e];else if(t.padding)i=t.padding[e];else{const r="padding"+e[0].toUpperCase()+e.slice(1);t[r]&&(i=t[r])}return Number(i)||0}function BN(e,t,n,o){return{x:t.x-L1("left",e,t,n,o)-L1("right",e,t,n,o),y:t.y-L1("top",e,t,n,o)-L1("bottom",e,t,n,o)}}class uwe{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={x:0,y:0},this.max={x:0,y:0},this.min={x:0,y:0}}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const{pswp:n}=this.slide,o=this.slide[t==="x"?"width":"height"]*this.currZoomLevel,i=L1(t==="x"?"left":"top",n.options,n.viewportSize,this.slide.data,this.slide.index),r=this.slide.panAreaSize[t];this.center[t]=Math.round((r-o)/2)+i,this.max[t]=o>r?Math.round(r-o)+i:this.center[t],this.min[t]=o>r?i:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,n){return i0(n,this.max[t],this.min[t])}}const zx=4e3;class HN{constructor(t,n,o,s){this.pswp=s,this.options=t,this.itemData=n,this.index=o,this.panAreaSize=null,this.elementSize=null,this.fit=1,this.fill=1,this.vFill=1,this.initial=1,this.secondary=1,this.max=1,this.min=1}update(t,n,o){const s={x:t,y:n};this.elementSize=s,this.panAreaSize=o;const i=o.x/s.x,r=o.y/s.y;this.fit=Math.min(1,ir?i:r),this.vFill=Math.min(1,r),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary),this.pswp&&this.pswp.dispatch("zoomLevelsUpdate",{zoomLevels:this,slideData:this.itemData})}_parseZoomLevelOption(t){const n=t+"ZoomLevel",o=this.options[n];if(o)return typeof o=="function"?o(this):o==="fill"?this.fill:o==="fit"?this.fit:Number(o)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,this.fit*3),this.elementSize&&t*this.elementSize.x>zx&&(t=zx/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,this.fit*4)}}class cwe{constructor(t,n,o){this.data=t,this.index=n,this.pswp=o,this.isActive=n===o.currIndex,this.currentResolution=0,this.panAreaSize={x:0,y:0},this.pan={x:0,y:0},this.isFirstSlide=this.isActive&&!o.opener.isOpen,this.zoomLevels=new HN(o.options,t,n,o),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:n}),this.content=this.pswp.contentLoader.getContentBySlide(this),this.container=Ji("pswp__zoom-wrap","div"),this.holderElement=null,this.currZoomLevel=1,this.width=this.content.width,this.height=this.content.height,this.heavyAppended=!1,this.bounds=new uwe(this),this.prevDisplayedWidth=-1,this.prevDisplayedHeight=-1,this.pswp.dispatch("slideInit",{slide:this})}setIsActive(t){t&&!this.isActive?this.activate():!t&&this.isActive&&this.deactivate()}append(t){this.holderElement=t,this.container.style.transformOrigin="0 0",this.data&&(this.calculateSize(),this.load(),this.updateContentSize(),this.appendHeavy(),this.holderElement.appendChild(this.container),this.zoomAndPanToInitial(),this.pswp.dispatch("firstZoomPan",{slide:this}),this.applyCurrentZoomPan(),this.pswp.dispatch("afterSetContent",{slide:this}),this.isActive&&this.activate())}load(){this.content.load(!1),this.pswp.dispatch("slideLoad",{slide:this})}appendHeavy(){const{pswp:t}=this;this.heavyAppended||!t.opener.isOpen||t.mainScroll.isShifted()||!this.isActive&&!1||this.pswp.dispatch("appendHeavy",{slide:this}).defaultPrevented||(this.heavyAppended=!0,this.content.append(),this.pswp.dispatch("appendHeavyContent",{slide:this}))}activate(){this.isActive=!0,this.appendHeavy(),this.content.activate(),this.pswp.dispatch("slideActivate",{slide:this})}deactivate(){this.isActive=!1,this.content.deactivate(),this.currZoomLevel!==this.zoomLevels.initial&&this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize(),this.pswp.dispatch("slideDeactivate",{slide:this})}destroy(){this.content.hasSlide=!1,this.content.remove(),this.container.remove(),this.pswp.dispatch("slideDestroy",{slide:this})}resize(){this.currZoomLevel===this.zoomLevels.initial||!this.isActive?(this.calculateSize(),this.currentResolution=0,this.zoomAndPanToInitial(),this.applyCurrentZoomPan(),this.updateContentSize()):(this.calculateSize(),this.bounds.update(this.currZoomLevel),this.panTo(this.pan.x,this.pan.y))}updateContentSize(t){const n=this.currentResolution||this.zoomLevels.initial;if(!n)return;const o=Math.round(this.width*n)||this.pswp.viewportSize.x,s=Math.round(this.height*n)||this.pswp.viewportSize.y;!this.sizeChanged(o,s)&&!t||this.content.setDisplayedSize(o,s)}sizeChanged(t,n){return t!==this.prevDisplayedWidth||n!==this.prevDisplayedHeight?(this.prevDisplayedWidth=t,this.prevDisplayedHeight=n,!0):!1}getPlaceholderElement(){var t;return(t=this.content.placeholder)===null||t===void 0?void 0:t.element}zoomTo(t,n,o,s){const{pswp:i}=this;if(!this.isZoomable()||i.mainScroll.isShifted())return;i.dispatch("beforeZoomTo",{destZoomLevel:t,centerPoint:n,transitionDuration:o}),i.animations.stopAllPan();const r=this.currZoomLevel;s||(t=i0(t,this.zoomLevels.min,this.zoomLevels.max)),this.setZoomLevel(t),this.pan.x=this.calculateZoomToPanOffset("x",n,r),this.pan.y=this.calculateZoomToPanOffset("y",n,r),RN(this.pan);const l=()=>{this._setResolution(t),this.applyCurrentZoomPan()};o?i.animations.startTransition({isPan:!0,name:"zoomTo",target:this.container,transform:this.getCurrentTransform(),onComplete:l,duration:o,easing:i.options.easing}):l()}toggleZoom(t){this.zoomTo(this.currZoomLevel===this.zoomLevels.initial?this.zoomLevels.secondary:this.zoomLevels.initial,t,this.pswp.options.zoomAnimationDuration)}setZoomLevel(t){this.currZoomLevel=t,this.bounds.update(this.currZoomLevel)}calculateZoomToPanOffset(t,n,o){if(this.bounds.max[t]-this.bounds.min[t]===0)return this.bounds.center[t];n||(n=this.pswp.getViewportCenterPoint()),o||(o=this.zoomLevels.initial);const i=this.currZoomLevel/o;return this.bounds.correctPan(t,(this.pan[t]-n[t])*i+n[t])}panTo(t,n){this.pan.x=this.bounds.correctPan("x",t),this.pan.y=this.bounds.correctPan("y",n),this.applyCurrentZoomPan()}isPannable(){return!!this.width&&this.currZoomLevel>this.zoomLevels.fit}isZoomable(){return!!this.width&&this.content.isZoomable()}applyCurrentZoomPan(){this._applyZoomTransform(this.pan.x,this.pan.y,this.currZoomLevel),this===this.pswp.currSlide&&this.pswp.dispatch("zoomPanUpdate",{slide:this})}zoomAndPanToInitial(){this.currZoomLevel=this.zoomLevels.initial,this.bounds.update(this.currZoomLevel),is(this.pan,this.bounds.center),this.pswp.dispatch("initialZoomPan",{slide:this})}_applyZoomTransform(t,n,o){o/=this.currentResolution||this.zoomLevels.initial,ec(this.container,t,n,o)}calculateSize(){const{pswp:t}=this;is(this.panAreaSize,BN(t.options,t.viewportSize,this.data,this.index)),this.zoomLevels.update(this.width,this.height,this.panAreaSize),t.dispatch("calcSlideSize",{slide:this})}getCurrentTransform(){const t=this.currZoomLevel/(this.currentResolution||this.zoomLevels.initial);return Np(this.pan.x,this.pan.y,t)}_setResolution(t){t!==this.currentResolution&&(this.currentResolution=t,this.updateContentSize(),this.pswp.dispatch("resolutionChanged"))}}const dwe=.35,fwe=.6,Wx=.4,Ux=.5;function pwe(e,t){return e*t/(1-t)}class hwe{constructor(t){this.gestures=t,this.pswp=t.pswp,this.startPan={x:0,y:0}}start(){this.pswp.currSlide&&is(this.startPan,this.pswp.currSlide.pan),this.pswp.animations.stopAll()}change(){const{p1:t,prevP1:n,dragAxis:o}=this.gestures,{currSlide:s}=this.pswp;if(o==="y"&&this.pswp.options.closeOnVerticalDrag&&s&&s.currZoomLevel<=s.zoomLevels.fit&&!this.gestures.isMultitouch){const i=s.pan.y+(t.y-n.y);if(!this.pswp.dispatch("verticalDrag",{panY:i}).defaultPrevented){this._setPanWithFriction("y",i,fwe);const r=1-Math.abs(this._getVerticalDragRatio(s.pan.y));this.pswp.applyBgOpacity(r),s.applyCurrentZoomPan()}}else this._panOrMoveMainScroll("x")||(this._panOrMoveMainScroll("y"),s&&(RN(s.pan),s.applyCurrentZoomPan()))}end(){const{velocity:t}=this.gestures,{mainScroll:n,currSlide:o}=this.pswp;let s=0;if(this.pswp.animations.stopAll(),n.isShifted()){const r=(n.x-n.getCurrSlideX())/this.pswp.viewportSize.x;t.x<-Ux&&r<0||t.x<.1&&r<-.5?(s=1,t.x=Math.min(t.x,0)):(t.x>Ux&&r>0||t.x>-.1&&r>.5)&&(s=-1,t.x=Math.max(t.x,0)),n.moveIndexBy(s,!0,t.x)}o&&o.currZoomLevel>o.zoomLevels.max||this.gestures.isMultitouch?this.gestures.zoomLevels.correctZoomPan(!0):(this._finishPanGestureForAxis("x"),this._finishPanGestureForAxis("y"))}_finishPanGestureForAxis(t){const{velocity:n}=this.gestures,{currSlide:o}=this.pswp;if(!o)return;const{pan:s,bounds:i}=o,r=s[t],l=this.pswp.bgOpacity<1&&t==="y",u=r+pwe(n[t],.995);if(l){const g=this._getVerticalDragRatio(r),m=this._getVerticalDragRatio(u);if(g<0&&m<-Wx||g>0&&m>Wx){this.pswp.close();return}}const c=i.correctPan(t,u);if(r===c)return;const d=c===u?1:.82,f=this.pswp.bgOpacity,h=c-r;this.pswp.animations.startSpring({name:"panGesture"+t,isPan:!0,start:r,end:c,velocity:n[t],dampingRatio:d,onUpdate:g=>{if(l&&this.pswp.bgOpacity<1){const m=1-(c-g)/h;this.pswp.applyBgOpacity(i0(f+(1-f)*m,0,1))}s[t]=Math.floor(g),o.applyCurrentZoomPan()}})}_panOrMoveMainScroll(t){const{p1:n,dragAxis:o,prevP1:s,isMultitouch:i}=this.gestures,{currSlide:r,mainScroll:l}=this.pswp,a=n[t]-s[t],u=l.x+a;if(!a||!r)return!1;if(t==="x"&&!r.isPannable()&&!i)return l.moveTo(u,!0),!0;const{bounds:c}=r,d=r.pan[t]+a;if(this.pswp.options.allowPanToNext&&o==="x"&&t==="x"&&!i){const f=l.getCurrSlideX(),h=l.x-f,g=a>0,m=!g;if(d>c.min[t]&&g){if(c.min[t]<=this.startPan[t])return l.moveTo(u,!0),!0;this._setPanWithFriction(t,d)}else if(d0)return l.moveTo(Math.max(u,f),!0),!0;if(h<0)return l.moveTo(Math.min(u,f),!0),!0}else this._setPanWithFriction(t,d)}else t==="y"?!l.isShifted()&&c.min.y!==c.max.y&&this._setPanWithFriction(t,d):this._setPanWithFriction(t,d);return!1}_getVerticalDragRatio(t){var n,o;return(t-((n=(o=this.pswp.currSlide)===null||o===void 0?void 0:o.bounds.center.y)!==null&&n!==void 0?n:0))/(this.pswp.viewportSize.y/3)}_setPanWithFriction(t,n,o){const{currSlide:s}=this.pswp;if(!s)return;const{pan:i,bounds:r}=s;if(r.correctPan(t,n)!==n||o){const a=Math.round(n-i[t]);i[t]+=a*(o||dwe)}else i[t]=n}}const mwe=.05,gwe=.15;function jx(e,t,n){return e.x=(t.x+n.x)/2,e.y=(t.y+n.y)/2,e}class vwe{constructor(t){this.gestures=t,this._startPan={x:0,y:0},this._startZoomPoint={x:0,y:0},this._zoomPoint={x:0,y:0},this._wasOverFitZoomLevel=!1,this._startZoomLevel=1}start(){const{currSlide:t}=this.gestures.pswp;t&&(this._startZoomLevel=t.currZoomLevel,is(this._startPan,t.pan)),this.gestures.pswp.animations.stopAllPan(),this._wasOverFitZoomLevel=!1}change(){const{p1:t,startP1:n,p2:o,startP2:s,pswp:i}=this.gestures,{currSlide:r}=i;if(!r)return;const l=r.zoomLevels.min,a=r.zoomLevels.max;if(!r.isZoomable()||i.mainScroll.isShifted())return;jx(this._startZoomPoint,n,s),jx(this._zoomPoint,t,o);let u=1/Cy(n,s)*Cy(t,o)*this._startZoomLevel;if(u>r.zoomLevels.initial+r.zoomLevels.initial/15&&(this._wasOverFitZoomLevel=!0),ua&&(u=a+(u-a)*mwe);r.pan.x=this._calculatePanForZoomLevel("x",u),r.pan.y=this._calculatePanForZoomLevel("y",u),r.setZoomLevel(u),r.applyCurrentZoomPan()}end(){const{pswp:t}=this.gestures,{currSlide:n}=t;(!n||n.currZoomLevelo.zoomLevels.max?i=o.zoomLevels.max:(r=!1,i=s);const l=n.bgOpacity,a=n.bgOpacity<1,u=is({x:0,y:0},o.pan);let c=is({x:0,y:0},u);t&&(this._zoomPoint.x=0,this._zoomPoint.y=0,this._startZoomPoint.x=0,this._startZoomPoint.y=0,this._startZoomLevel=s,is(this._startPan,u)),r&&(c={x:this._calculatePanForZoomLevel("x",i),y:this._calculatePanForZoomLevel("y",i)}),o.setZoomLevel(i),c={x:o.bounds.correctPan("x",c.x),y:o.bounds.correctPan("y",c.y)},o.setZoomLevel(s);const d=!sp(c,u);if(!d&&!r&&!a){o._setResolution(i),o.applyCurrentZoomPan();return}n.animations.stopAllPan(),n.animations.startSpring({isPan:!0,start:0,end:1e3,velocity:0,dampingRatio:1,naturalFrequency:40,onUpdate:f=>{if(f/=1e3,d||r){if(d&&(o.pan.x=u.x+(c.x-u.x)*f,o.pan.y=u.y+(c.y-u.y)*f),r){const h=s+(i-s)*f;o.setZoomLevel(h)}o.applyCurrentZoomPan()}a&&n.bgOpacity<1&&n.applyBgOpacity(i0(l+(1-l)*f,0,1))},onComplete:()=>{o._setResolution(i),o.applyCurrentZoomPan()}})}}function Vx(e){return!!e.target.closest(".pswp__container")}class ywe{constructor(t){this.gestures=t}click(t,n){const o=n.target.classList,s=o.contains("pswp__img"),i=o.contains("pswp__item")||o.contains("pswp__zoom-wrap");s?this._doClickOrTapAction("imageClick",t,n):i&&this._doClickOrTapAction("bgClick",t,n)}tap(t,n){Vx(n)&&this._doClickOrTapAction("tap",t,n)}doubleTap(t,n){Vx(n)&&this._doClickOrTapAction("doubleTap",t,n)}_doClickOrTapAction(t,n,o){var s;const{pswp:i}=this.gestures,{currSlide:r}=i,l=t+"Action",a=i.options[l];if(!i.dispatch(l,{point:n,originalEvent:o}).defaultPrevented){if(typeof a=="function"){a.call(i,n,o);return}switch(a){case"close":case"next":i[a]();break;case"zoom":r?.toggleZoom(n);break;case"zoom-or-close":r!=null&&r.isZoomable()&&r.zoomLevels.secondary!==r.zoomLevels.initial?r.toggleZoom(n):i.options.clickToCloseNonZoomable&&i.close();break;case"toggle-controls":(s=this.gestures.pswp.element)===null||s===void 0||s.classList.toggle("pswp--ui-visible");break}}}}const kwe=10,bwe=300,Cwe=25;class wwe{constructor(t){this.pswp=t,this.dragAxis=null,this.p1={x:0,y:0},this.p2={x:0,y:0},this.prevP1={x:0,y:0},this.prevP2={x:0,y:0},this.startP1={x:0,y:0},this.startP2={x:0,y:0},this.velocity={x:0,y:0},this._lastStartP1={x:0,y:0},this._intervalP1={x:0,y:0},this._numActivePoints=0,this._ongoingPointers=[],this._touchEventEnabled="ontouchstart"in window,this._pointerEventEnabled=!!window.PointerEvent,this.supportsTouch=this._touchEventEnabled||this._pointerEventEnabled&&navigator.maxTouchPoints>1,this._numActivePoints=0,this._intervalTime=0,this._velocityCalculated=!1,this.isMultitouch=!1,this.isDragging=!1,this.isZooming=!1,this.raf=null,this._tapTimer=null,this.supportsTouch||(t.options.allowPanToNext=!1),this.drag=new hwe(this),this.zoomLevels=new vwe(this),this.tapHandler=new ywe(this),t.on("bindEvents",()=>{t.events.add(t.scrollWrap,"click",this._onClick.bind(this)),this._pointerEventEnabled?this._bindEvents("pointer","down","up","cancel"):this._touchEventEnabled?(this._bindEvents("touch","start","end","cancel"),t.scrollWrap&&(t.scrollWrap.ontouchmove=()=>{},t.scrollWrap.ontouchend=()=>{})):this._bindEvents("mouse","down","up")})}_bindEvents(t,n,o,s){const{pswp:i}=this,{events:r}=i,l=s?t+s:"";r.add(i.scrollWrap,t+n,this.onPointerDown.bind(this)),r.add(window,t+"move",this.onPointerMove.bind(this)),r.add(window,t+o,this.onPointerUp.bind(this)),l&&r.add(i.scrollWrap,l,this.onPointerUp.bind(this))}onPointerDown(t){const n=t.type==="mousedown"||t.pointerType==="mouse";if(n&&t.button>0)return;const{pswp:o}=this;if(!o.opener.isOpen){t.preventDefault();return}o.dispatch("pointerDown",{originalEvent:t}).defaultPrevented||(n&&(o.mouseDetected(),this._preventPointerEventBehaviour(t,"down")),o.animations.stopAll(),this._updatePoints(t,"down"),this._numActivePoints===1&&(this.dragAxis=null,is(this.startP1,this.p1)),this._numActivePoints>1?(this._clearTapTimer(),this.isMultitouch=!0):this.isMultitouch=!1)}onPointerMove(t){this._preventPointerEventBehaviour(t,"move"),this._numActivePoints&&(this._updatePoints(t,"move"),!this.pswp.dispatch("pointerMove",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===1&&!this.isDragging?(this.dragAxis||this._calculateDragDirection(),this.dragAxis&&!this.isDragging&&(this.isZooming&&(this.isZooming=!1,this.zoomLevels.end()),this.isDragging=!0,this._clearTapTimer(),this._updateStartPoints(),this._intervalTime=Date.now(),this._velocityCalculated=!1,is(this._intervalP1,this.p1),this.velocity.x=0,this.velocity.y=0,this.drag.start(),this._rafStopLoop(),this._rafRenderLoop())):this._numActivePoints>1&&!this.isZooming&&(this._finishDrag(),this.isZooming=!0,this._updateStartPoints(),this.zoomLevels.start(),this._rafStopLoop(),this._rafRenderLoop())))}_finishDrag(){this.isDragging&&(this.isDragging=!1,this._velocityCalculated||this._updateVelocity(!0),this.drag.end(),this.dragAxis=null)}onPointerUp(t){this._numActivePoints&&(this._updatePoints(t,"up"),!this.pswp.dispatch("pointerUp",{originalEvent:t}).defaultPrevented&&(this._numActivePoints===0&&(this._rafStopLoop(),this.isDragging?this._finishDrag():!this.isZooming&&!this.isMultitouch&&this._finishTap(t)),this._numActivePoints<2&&this.isZooming&&(this.isZooming=!1,this.zoomLevels.end(),this._numActivePoints===1&&(this.dragAxis=null,this._updateStartPoints()))))}_rafRenderLoop(){(this.isDragging||this.isZooming)&&(this._updateVelocity(),this.isDragging?sp(this.p1,this.prevP1)||this.drag.change():(!sp(this.p1,this.prevP1)||!sp(this.p2,this.prevP2))&&this.zoomLevels.change(),this._updatePrevPoints(),this.raf=requestAnimationFrame(this._rafRenderLoop.bind(this)))}_updateVelocity(t){const n=Date.now(),o=n-this._intervalTime;o<50&&!t||(this.velocity.x=this._getVelocity("x",o),this.velocity.y=this._getVelocity("y",o),this._intervalTime=n,is(this._intervalP1,this.p1),this._velocityCalculated=!0)}_finishTap(t){const{mainScroll:n}=this.pswp;if(n.isShifted()){n.moveIndexBy(0,!0);return}if(t.type.indexOf("cancel")>0)return;if(t.type==="mouseup"||t.pointerType==="mouse"){this.tapHandler.click(this.startP1,t);return}const o=this.pswp.options.doubleTapAction?bwe:0;this._tapTimer?(this._clearTapTimer(),Cy(this._lastStartP1,this.startP1){this.tapHandler.tap(this.startP1,t),this._clearTapTimer()},o))}_clearTapTimer(){this._tapTimer&&(clearTimeout(this._tapTimer),this._tapTimer=null)}_getVelocity(t,n){const o=this.p1[t]-this._intervalP1[t];return Math.abs(o)>1&&n>5?o/n:0}_rafStopLoop(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null)}_preventPointerEventBehaviour(t,n){this.pswp.applyFilters("preventPointerEvent",!0,t,n)&&t.preventDefault()}_updatePoints(t,n){if(this._pointerEventEnabled){const o=t,s=this._ongoingPointers.findIndex(i=>i.id===o.pointerId);n==="up"&&s>-1?this._ongoingPointers.splice(s,1):n==="down"&&s===-1?this._ongoingPointers.push(this._convertEventPosToPoint(o,{x:0,y:0})):s>-1&&this._convertEventPosToPoint(o,this._ongoingPointers[s]),this._numActivePoints=this._ongoingPointers.length,this._numActivePoints>0&&is(this.p1,this._ongoingPointers[0]),this._numActivePoints>1&&is(this.p2,this._ongoingPointers[1])}else{const o=t;this._numActivePoints=0,o.type.indexOf("touch")>-1?o.touches&&o.touches.length>0&&(this._convertEventPosToPoint(o.touches[0],this.p1),this._numActivePoints++,o.touches.length>1&&(this._convertEventPosToPoint(o.touches[1],this.p2),this._numActivePoints++)):(this._convertEventPosToPoint(t,this.p1),n==="up"?this._numActivePoints=0:this._numActivePoints++)}}_updatePrevPoints(){is(this.prevP1,this.p1),is(this.prevP2,this.p2)}_updateStartPoints(){is(this.startP1,this.p1),is(this.startP2,this.p2),this._updatePrevPoints()}_calculateDragDirection(){if(this.pswp.mainScroll.isShifted())this.dragAxis="x";else{const t=Math.abs(this.p1.x-this.startP1.x)-Math.abs(this.p1.y-this.startP1.y);if(t!==0){const n=t>0?"x":"y";Math.abs(this.p1[n]-this.startP1[n])>=kwe&&(this.dragAxis=n)}}}_convertEventPosToPoint(t,n){return n.x=t.pageX-this.pswp.offset.x,n.y=t.pageY-this.pswp.offset.y,"pointerId"in t?n.id=t.pointerId:t.identifier!==void 0&&(n.id=t.identifier),n}_onClick(t){this.pswp.mainScroll.isShifted()&&(t.preventDefault(),t.stopPropagation())}}const _we=.35;class xwe{constructor(t){this.pswp=t,this.x=0,this.slideWidth=0,this._currPositionIndex=0,this._prevPositionIndex=0,this._containerShiftIndex=-1,this.itemHolders=[]}resize(t){const{pswp:n}=this,o=Math.round(n.viewportSize.x+n.viewportSize.x*n.options.spacing),s=o!==this.slideWidth;s&&(this.slideWidth=o,this.moveTo(this.getCurrSlideX())),this.itemHolders.forEach((i,r)=>{s&&ec(i.el,(r+this._containerShiftIndex)*this.slideWidth),t&&i.slide&&i.slide.resize()})}resetPosition(){this._currPositionIndex=0,this._prevPositionIndex=0,this.slideWidth=0,this._containerShiftIndex=-1}appendHolders(){this.itemHolders=[];for(let t=0;t<3;t++){const n=Ji("pswp__item","div",this.pswp.container);n.setAttribute("role","group"),n.setAttribute("aria-roledescription","slide"),n.setAttribute("aria-hidden","true"),n.style.display=t===1?"block":"none",this.itemHolders.push({el:n})}}canBeSwiped(){return this.pswp.getNumItems()>1}moveIndexBy(t,n,o){const{pswp:s}=this;let i=s.potentialIndex+t;const r=s.getNumItems();if(s.canLoop()){i=s.getLoopedIndex(i);const a=(t+r)%r;a<=r/2?t=a:t=a-r}else i<0?i=0:i>=r&&(i=r-1),t=i-s.potentialIndex;s.potentialIndex=i,this._currPositionIndex-=t,s.animations.stopMainScroll();const l=this.getCurrSlideX();if(!n)this.moveTo(l),this.updateCurrItem();else{s.animations.startSpring({isMainScroll:!0,start:this.x,end:l,velocity:o||0,naturalFrequency:30,dampingRatio:1,onUpdate:u=>{this.moveTo(u)},onComplete:()=>{this.updateCurrItem(),s.appendHeavy()}});let a=s.potentialIndex-s.currIndex;if(s.canLoop()){const u=(a+r)%r;u<=r/2?a=u:a=u-r}Math.abs(a)>1&&this.updateCurrItem()}return!!t}getCurrSlideX(){return this.slideWidth*this._currPositionIndex}isShifted(){return this.x!==this.getCurrSlideX()}updateCurrItem(){var t;const{pswp:n}=this,o=this._prevPositionIndex-this._currPositionIndex;if(!o)return;this._prevPositionIndex=this._currPositionIndex,n.currIndex=n.potentialIndex;let s=Math.abs(o),i;s>=3&&(this._containerShiftIndex+=o+(o>0?-3:3),s=3,this.itemHolders.forEach(r=>{var l;(l=r.slide)===null||l===void 0||l.destroy(),r.slide=void 0}));for(let r=0;r0?(i=this.itemHolders.shift(),i&&(this.itemHolders[2]=i,this._containerShiftIndex++,ec(i.el,(this._containerShiftIndex+2)*this.slideWidth),n.setContent(i,n.currIndex-s+r+2))):(i=this.itemHolders.pop(),i&&(this.itemHolders.unshift(i),this._containerShiftIndex--,ec(i.el,this._containerShiftIndex*this.slideWidth),n.setContent(i,n.currIndex+s-r-2)));Math.abs(this._containerShiftIndex)>50&&!this.isShifted()&&(this.resetPosition(),this.resize()),n.animations.stopAllPan(),this.itemHolders.forEach((r,l)=>{r.slide&&r.slide.setIsActive(l===1)}),n.currSlide=(t=this.itemHolders[1])===null||t===void 0?void 0:t.slide,n.contentLoader.updateLazy(o),n.currSlide&&n.currSlide.applyCurrentZoomPan(),n.dispatch("change")}moveTo(t,n){if(!this.pswp.canLoop()&&n){let o=(this.slideWidth*this._currPositionIndex-t)/this.slideWidth;o+=this.pswp.currIndex;const s=Math.round(t-this.x);(o<0&&s>0||o>=this.pswp.getNumItems()-1&&s<0)&&(t=this.x+s*_we)}this.x=t,this.pswp.container&&ec(this.pswp.container,t),this.pswp.dispatch("moveMainScroll",{x:t,dragging:n??!1})}}const Swe={Escape:27,z:90,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Tab:9},Hu=(e,t)=>t?e:Swe[e];class Awe{constructor(t){this.pswp=t,this._wasFocused=!1,t.on("bindEvents",()=>{t.options.trapFocus&&(t.options.initialPointerPos||this._focusRoot(),t.events.add(document,"focusin",this._onFocusIn.bind(this))),t.events.add(document,"keydown",this._onKeyDown.bind(this))});const n=document.activeElement;t.on("destroy",()=>{t.options.returnFocus&&n&&this._wasFocused&&n.focus()})}_focusRoot(){!this._wasFocused&&this.pswp.element&&(this.pswp.element.focus(),this._wasFocused=!0)}_onKeyDown(t){const{pswp:n}=this;if(n.dispatch("keydown",{originalEvent:t}).defaultPrevented||rwe(t))return;let o,s,i=!1;const r="key"in t;switch(r?t.key:t.keyCode){case Hu("Escape",r):n.options.escKey&&(o="close");break;case Hu("z",r):o="toggleZoom";break;case Hu("ArrowLeft",r):s="x";break;case Hu("ArrowUp",r):s="y";break;case Hu("ArrowRight",r):s="x",i=!0;break;case Hu("ArrowDown",r):i=!0,s="y";break;case Hu("Tab",r):this._focusRoot();break}if(s){t.preventDefault();const{currSlide:l}=n;n.options.arrowKeys&&s==="x"&&n.getNumItems()>1?o=i?"next":"prev":l&&l.currZoomLevel>l.zoomLevels.fit&&(l.pan[s]+=i?-80:80,l.panTo(l.pan.x,l.pan.y))}o&&(t.preventDefault(),n[o]())}_onFocusIn(t){const{template:n}=this.pswp;n&&document!==t.target&&n!==t.target&&!n.contains(t.target)&&n.focus()}}const Mwe="cubic-bezier(.4,0,.22,1)";class Twe{constructor(t){var n;this.props=t;const{target:o,onComplete:s,transform:i,onFinish:r=()=>{},duration:l=333,easing:a=Mwe}=t;this.onFinish=r;const u=i?"transform":"opacity",c=(n=t[u])!==null&&n!==void 0?n:"";this._target=o,this._onComplete=s,this._finished=!1,this._onTransitionEnd=this._onTransitionEnd.bind(this),this._helperTimeout=setTimeout(()=>{ON(o,u,l,a),this._helperTimeout=setTimeout(()=>{o.addEventListener("transitionend",this._onTransitionEnd,!1),o.addEventListener("transitioncancel",this._onTransitionEnd,!1),this._helperTimeout=setTimeout(()=>{this._finalizeAnimation()},l+500),o.style[u]=c},30)},0)}_onTransitionEnd(t){t.target===this._target&&this._finalizeAnimation()}_finalizeAnimation(){this._finished||(this._finished=!0,this.onFinish(),this._onComplete&&this._onComplete())}destroy(){this._helperTimeout&&clearTimeout(this._helperTimeout),swe(this._target),this._target.removeEventListener("transitionend",this._onTransitionEnd,!1),this._target.removeEventListener("transitioncancel",this._onTransitionEnd,!1),this._finished||this._finalizeAnimation()}}const Ewe=12,Iwe=.75;class Lwe{constructor(t,n,o){this.velocity=t*1e3,this._dampingRatio=n||Iwe,this._naturalFrequency=o||Ewe,this._dampedFrequency=this._naturalFrequency,this._dampingRatio<1&&(this._dampedFrequency*=Math.sqrt(1-this._dampingRatio*this._dampingRatio))}easeFrame(t,n){let o=0,s;n/=1e3;const i=Math.E**(-this._dampingRatio*this._naturalFrequency*n);if(this._dampingRatio===1)s=this.velocity+this._naturalFrequency*t,o=(t+s*n)*i,this.velocity=o*-this._naturalFrequency+s*i;else if(this._dampingRatio<1){s=1/this._dampedFrequency*(this._dampingRatio*this._naturalFrequency*t+this.velocity);const r=Math.cos(this._dampedFrequency*n),l=Math.sin(this._dampedFrequency*n);o=i*(t*r+s*l),this.velocity=o*-this._naturalFrequency*this._dampingRatio+i*(-this._dampedFrequency*t*l+this._dampedFrequency*s*r)}return o}}class $we{constructor(t){this.props=t,this._raf=0;const{start:n,end:o,velocity:s,onUpdate:i,onComplete:r,onFinish:l=()=>{},dampingRatio:a,naturalFrequency:u}=t;this.onFinish=l;const c=new Lwe(s,a,u);let d=Date.now(),f=n-o;const h=()=>{this._raf&&(f=c.easeFrame(f,Date.now()-d),Math.abs(f)<1&&Math.abs(c.velocity)<50?(i(o),r&&r(),this.onFinish()):(d=Date.now(),i(f+o),this._raf=requestAnimationFrame(h)))};this._raf=requestAnimationFrame(h)}destroy(){this._raf>=0&&cancelAnimationFrame(this._raf),this._raf=0}}class Nwe{constructor(){this.activeAnimations=[]}startSpring(t){this._start(t,!0)}startTransition(t){this._start(t)}_start(t,n){const o=n?new $we(t):new Twe(t);return this.activeAnimations.push(o),o.onFinish=()=>this.stop(o),o}stop(t){t.destroy();const n=this.activeAnimations.indexOf(t);n>-1&&this.activeAnimations.splice(n,1)}stopAll(){this.activeAnimations.forEach(t=>{t.destroy()}),this.activeAnimations=[]}stopAllPan(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isPan?(t.destroy(),!1):!0)}stopMainScroll(){this.activeAnimations=this.activeAnimations.filter(t=>t.props.isMainScroll?(t.destroy(),!1):!0)}isPanRunning(){return this.activeAnimations.some(t=>t.props.isPan)}}class Fwe{constructor(t){this.pswp=t,t.events.add(t.element,"wheel",this._onWheel.bind(this))}_onWheel(t){t.preventDefault();const{currSlide:n}=this.pswp;let{deltaX:o,deltaY:s}=t;if(n&&!this.pswp.dispatch("wheel",{originalEvent:t}).defaultPrevented)if(t.ctrlKey||this.pswp.options.wheelToZoom){if(n.isZoomable()){let i=-s;t.deltaMode===1?i*=.05:i*=t.deltaMode?1:.002,i=2**i;const r=n.currZoomLevel*i;n.zoomTo(r,{x:t.clientX,y:t.clientY})}}else n.isPannable()&&(t.deltaMode===1&&(o*=18,s*=18),n.panTo(n.pan.x-o,n.pan.y-s))}}function Rwe(e){if(typeof e=="string")return e;if(!e||!e.isCustomSVG)return"";const t=e;let n='",n}class Owe{constructor(t,n){var o;const s=n.name||n.className;let i=n.html;if(t.options[s]===!1)return;typeof t.options[s+"SVG"]=="string"&&(i=t.options[s+"SVG"]),t.dispatch("uiElementCreate",{data:n});let r="";n.isButton?(r+="pswp__button ",r+=n.className||`pswp__button--${n.name}`):r+=n.className||`pswp__${n.name}`;let l=n.isButton?n.tagName||"button":n.tagName||"div";l=l.toLowerCase();const a=Ji(r,l);if(n.isButton){l==="button"&&(a.type="button");let{title:d}=n;const{ariaLabel:f}=n;typeof t.options[s+"Title"]=="string"&&(d=t.options[s+"Title"]),d&&(a.title=d);const h=f||d;h&&a.setAttribute("aria-label",h)}a.innerHTML=Rwe(i),n.onInit&&n.onInit(a,t),n.onClick&&(a.onclick=d=>{typeof n.onClick=="string"?t[n.onClick]():typeof n.onClick=="function"&&n.onClick(d,a,t)});const u=n.appendTo||"bar";let c=t.element;u==="bar"?(t.topBar||(t.topBar=Ji("pswp__top-bar pswp__hide-on-close","div",t.scrollWrap)),c=t.topBar):(a.classList.add("pswp__hide-on-close"),u==="wrapper"&&(c=t.scrollWrap)),(o=c)===null||o===void 0||o.appendChild(t.applyFilters("uiElement",a,n))}}function zN(e,t,n){e.classList.add("pswp__button--arrow"),e.setAttribute("aria-controls","pswp__items"),t.on("change",()=>{t.options.loop||(n?e.disabled=!(t.currIndex0))})}const Pwe={name:"arrowPrev",className:"pswp__button--arrow--prev",title:"Previous",order:10,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"prev",onInit:zN},Dwe={name:"arrowNext",className:"pswp__button--arrow--next",title:"Next",order:11,isButton:!0,appendTo:"wrapper",html:{isCustomSVG:!0,size:60,inner:'',outlineID:"pswp__icn-arrow"},onClick:"next",onInit:(e,t)=>{zN(e,t,!0)}},Bwe={name:"close",title:"Close",order:20,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-close"},onClick:"close"},Hwe={name:"zoom",title:"Zoom",order:10,isButton:!0,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-zoom"},onClick:"toggleZoom"},zwe={name:"preloader",appendTo:"bar",order:7,html:{isCustomSVG:!0,inner:'',outlineID:"pswp__icn-loading"},onInit:(e,t)=>{let n,o=null;const s=(l,a)=>{e.classList.toggle("pswp__preloader--"+l,a)},i=l=>{n!==l&&(n=l,s("active",l))},r=()=>{var l;if(!((l=t.currSlide)!==null&&l!==void 0&&l.content.isLoading())){i(!1),o&&(clearTimeout(o),o=null);return}o||(o=setTimeout(()=>{var a;i(!!(!((a=t.currSlide)===null||a===void 0)&&a.content.isLoading())),o=null},t.options.preloaderDelay))};t.on("change",r),t.on("loadComplete",l=>{t.currSlide===l.slide&&r()}),t.ui&&(t.ui.updatePreloaderVisibility=r)}},Wwe={name:"counter",order:5,onInit:(e,t)=>{t.on("change",()=>{e.innerText=t.currIndex+1+t.options.indexIndicatorSep+t.getNumItems()})}};function qx(e,t){e.classList.toggle("pswp--zoomed-in",t)}class Uwe{constructor(t){this.pswp=t,this.isRegistered=!1,this.uiElementsData=[],this.items=[],this.updatePreloaderVisibility=()=>{},this._lastUpdatedZoomLevel=void 0}init(){const{pswp:t}=this;this.isRegistered=!1,this.uiElementsData=[Bwe,Pwe,Dwe,Hwe,zwe,Wwe],t.dispatch("uiRegister"),this.uiElementsData.sort((n,o)=>(n.order||0)-(o.order||0)),this.items=[],this.isRegistered=!0,this.uiElementsData.forEach(n=>{this.registerElement(n)}),t.on("change",()=>{var n;(n=t.element)===null||n===void 0||n.classList.toggle("pswp--one-slide",t.getNumItems()===1)}),t.on("zoomPanUpdate",()=>this._onZoomPanUpdate())}registerElement(t){this.isRegistered?this.items.push(new Owe(this.pswp,t)):this.uiElementsData.push(t)}_onZoomPanUpdate(){const{template:t,currSlide:n,options:o}=this.pswp;if(this.pswp.opener.isClosing||!t||!n)return;let{currZoomLevel:s}=n;if(this.pswp.opener.isOpen||(s=n.zoomLevels.initial),s===this._lastUpdatedZoomLevel)return;this._lastUpdatedZoomLevel=s;const i=n.zoomLevels.initial-n.zoomLevels.secondary;if(Math.abs(i)<.01||!n.isZoomable()){qx(t,!1),t.classList.remove("pswp--zoom-allowed");return}t.classList.add("pswp--zoom-allowed");const r=s===n.zoomLevels.initial?n.zoomLevels.secondary:n.zoomLevels.initial;qx(t,r<=s),(o.imageClickAction==="zoom"||o.imageClickAction==="zoom-or-close")&&t.classList.add("pswp--click-to-zoom")}}function jwe(e){const t=e.getBoundingClientRect();return{x:t.left,y:t.top,w:t.width}}function Vwe(e,t,n){const o=e.getBoundingClientRect(),s=o.width/t,i=o.height/n,r=s>i?s:i,l=(o.width-t*r)/2,a=(o.height-n*r)/2,u={x:o.left+l,y:o.top+a,w:t*r};return u.innerRect={w:o.width,h:o.height,x:l,y:a},u}function qwe(e,t,n){const o=n.dispatch("thumbBounds",{index:e,itemData:t,instance:n});if(o.thumbBounds)return o.thumbBounds;const{element:s}=t;let i,r;if(s&&n.options.thumbSelector!==!1){const l=n.options.thumbSelector||"img";r=s.matches(l)?s:s.querySelector(l)}return r=n.applyFilters("thumbEl",r,t,e),r&&(t.thumbCropped?i=Vwe(r,t.width||t.w||0,t.height||t.h||0):i=jwe(r)),n.applyFilters("thumbBounds",i,t,e)}class Kwe{constructor(t,n){this.type=t,this.defaultPrevented=!1,n&&Object.assign(this,n)}preventDefault(){this.defaultPrevented=!0}}class Zwe{constructor(){this._listeners={},this._filters={},this.pswp=void 0,this.options=void 0}addFilter(t,n,o=100){var s,i,r;this._filters[t]||(this._filters[t]=[]),(s=this._filters[t])===null||s===void 0||s.push({fn:n,priority:o}),(i=this._filters[t])===null||i===void 0||i.sort((l,a)=>l.priority-a.priority),(r=this.pswp)===null||r===void 0||r.addFilter(t,n,o)}removeFilter(t,n){this._filters[t]&&(this._filters[t]=this._filters[t].filter(o=>o.fn!==n)),this.pswp&&this.pswp.removeFilter(t,n)}applyFilters(t,...n){var o;return(o=this._filters[t])===null||o===void 0||o.forEach(s=>{n[0]=s.fn.apply(this,n)}),n[0]}on(t,n){var o,s;this._listeners[t]||(this._listeners[t]=[]),(o=this._listeners[t])===null||o===void 0||o.push(n),(s=this.pswp)===null||s===void 0||s.on(t,n)}off(t,n){var o;this._listeners[t]&&(this._listeners[t]=this._listeners[t].filter(s=>n!==s)),(o=this.pswp)===null||o===void 0||o.off(t,n)}dispatch(t,n){var o;if(this.pswp)return this.pswp.dispatch(t,n);const s=new Kwe(t,n);return(o=this._listeners[t])===null||o===void 0||o.forEach(i=>{i.call(this,s)}),s}}class Gwe{constructor(t,n){if(this.element=Ji("pswp__img pswp__img--placeholder",t?"img":"div",n),t){const o=this.element;o.decoding="async",o.alt="",o.src=t,o.setAttribute("role","presentation")}this.element.setAttribute("aria-hidden","true")}setDisplayedSize(t,n){this.element&&(this.element.tagName==="IMG"?(wy(this.element,250,"auto"),this.element.style.transformOrigin="0 0",this.element.style.transform=Np(0,0,t/250)):wy(this.element,t,n))}destroy(){var t;(t=this.element)!==null&&t!==void 0&&t.parentNode&&this.element.remove(),this.element=null}}class Ywe{constructor(t,n,o){this.instance=n,this.data=t,this.index=o,this.element=void 0,this.placeholder=void 0,this.slide=void 0,this.displayedImageWidth=0,this.displayedImageHeight=0,this.width=Number(this.data.w)||Number(this.data.width)||0,this.height=Number(this.data.h)||Number(this.data.height)||0,this.isAttached=!1,this.hasSlide=!1,this.isDecoding=!1,this.state=mr.IDLE,this.data.type?this.type=this.data.type:this.data.src?this.type="image":this.type="html",this.instance.dispatch("contentInit",{content:this})}removePlaceholder(){this.placeholder&&!this.keepPlaceholder()&&setTimeout(()=>{this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0)},1e3)}load(t,n){if(this.slide&&this.usePlaceholder())if(this.placeholder){const o=this.placeholder.element;o&&!o.parentElement&&this.slide.container.prepend(o)}else{const o=this.instance.applyFilters("placeholderSrc",this.data.msrc&&this.slide.isFirstSlide?this.data.msrc:!1,this);this.placeholder=new Gwe(o,this.slide.container)}this.element&&!n||this.instance.dispatch("contentLoad",{content:this,isLazy:t}).defaultPrevented||(this.isImageContent()?(this.element=Ji("pswp__img","img"),this.displayedImageWidth&&this.loadImage(t)):(this.element=Ji("pswp__content","div"),this.element.innerHTML=this.data.html||""),n&&this.slide&&this.slide.updateContentSize(!0))}loadImage(t){var n,o;if(!this.isImageContent()||!this.element||this.instance.dispatch("contentLoadImage",{content:this,isLazy:t}).defaultPrevented)return;const s=this.element;this.updateSrcsetSizes(),this.data.srcset&&(s.srcset=this.data.srcset),s.src=(n=this.data.src)!==null&&n!==void 0?n:"",s.alt=(o=this.data.alt)!==null&&o!==void 0?o:"",this.state=mr.LOADING,s.complete?this.onLoaded():(s.onload=()=>{this.onLoaded()},s.onerror=()=>{this.onError()})}setSlide(t){this.slide=t,this.hasSlide=!0,this.instance=t.pswp}onLoaded(){this.state=mr.LOADED,this.slide&&this.element&&(this.instance.dispatch("loadComplete",{slide:this.slide,content:this}),this.slide.isActive&&this.slide.heavyAppended&&!this.element.parentNode&&(this.append(),this.slide.updateContentSize(!0)),(this.state===mr.LOADED||this.state===mr.ERROR)&&this.removePlaceholder())}onError(){this.state=mr.ERROR,this.slide&&(this.displayError(),this.instance.dispatch("loadComplete",{slide:this.slide,isError:!0,content:this}),this.instance.dispatch("loadError",{slide:this.slide,content:this}))}isLoading(){return this.instance.applyFilters("isContentLoading",this.state===mr.LOADING,this)}isError(){return this.state===mr.ERROR}isImageContent(){return this.type==="image"}setDisplayedSize(t,n){if(this.element&&(this.placeholder&&this.placeholder.setDisplayedSize(t,n),!this.instance.dispatch("contentResize",{content:this,width:t,height:n}).defaultPrevented&&(wy(this.element,t,n),this.isImageContent()&&!this.isError()))){const o=!this.displayedImageWidth&&t;this.displayedImageWidth=t,this.displayedImageHeight=n,o?this.loadImage(!1):this.updateSrcsetSizes(),this.slide&&this.instance.dispatch("imageSizeChange",{slide:this.slide,width:t,height:n,content:this})}}isZoomable(){return this.instance.applyFilters("isContentZoomable",this.isImageContent()&&this.state!==mr.ERROR,this)}updateSrcsetSizes(){if(!this.isImageContent()||!this.element||!this.data.srcset)return;const t=this.element,n=this.instance.applyFilters("srcsetSizesWidth",this.displayedImageWidth,this);(!t.dataset.largestUsedSize||n>parseInt(t.dataset.largestUsedSize,10))&&(t.sizes=n+"px",t.dataset.largestUsedSize=String(n))}usePlaceholder(){return this.instance.applyFilters("useContentPlaceholder",this.isImageContent(),this)}lazyLoad(){this.instance.dispatch("contentLazyLoad",{content:this}).defaultPrevented||this.load(!0)}keepPlaceholder(){return this.instance.applyFilters("isKeepingPlaceholder",this.isLoading(),this)}destroy(){this.hasSlide=!1,this.slide=void 0,!this.instance.dispatch("contentDestroy",{content:this}).defaultPrevented&&(this.remove(),this.placeholder&&(this.placeholder.destroy(),this.placeholder=void 0),this.isImageContent()&&this.element&&(this.element.onload=null,this.element.onerror=null,this.element=void 0))}displayError(){if(this.slide){var t,n;let o=Ji("pswp__error-msg","div");o.innerText=(t=(n=this.instance.options)===null||n===void 0?void 0:n.errorMsg)!==null&&t!==void 0?t:"",o=this.instance.applyFilters("contentErrorElement",o,this),this.element=Ji("pswp__content pswp__error-msg-container","div"),this.element.appendChild(o),this.slide.container.innerText="",this.slide.container.appendChild(this.element),this.slide.updateContentSize(!0),this.removePlaceholder()}}append(){if(this.isAttached||!this.element)return;if(this.isAttached=!0,this.state===mr.ERROR){this.displayError();return}if(this.instance.dispatch("contentAppend",{content:this}).defaultPrevented)return;const t="decode"in this.element;this.isImageContent()?t&&this.slide&&(!this.slide.isActive||Hx())?(this.isDecoding=!0,this.element.decode().catch(()=>{}).finally(()=>{this.isDecoding=!1,this.appendImage()})):this.appendImage():this.slide&&!this.element.parentNode&&this.slide.container.appendChild(this.element)}activate(){this.instance.dispatch("contentActivate",{content:this}).defaultPrevented||!this.slide||(this.isImageContent()&&this.isDecoding&&!Hx()?this.appendImage():this.isError()&&this.load(!1,!0),this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","false"))}deactivate(){this.instance.dispatch("contentDeactivate",{content:this}),this.slide&&this.slide.holderElement&&this.slide.holderElement.setAttribute("aria-hidden","true")}remove(){this.isAttached=!1,!this.instance.dispatch("contentRemove",{content:this}).defaultPrevented&&(this.element&&this.element.parentNode&&this.element.remove(),this.placeholder&&this.placeholder.element&&this.placeholder.element.remove())}appendImage(){this.isAttached&&(this.instance.dispatch("contentAppendImage",{content:this}).defaultPrevented||(this.slide&&this.element&&!this.element.parentNode&&this.slide.container.appendChild(this.element),(this.state===mr.LOADED||this.state===mr.ERROR)&&this.removePlaceholder()))}}const Xwe=5;function WN(e,t,n){const o=t.createContentFromData(e,n);let s;const{options:i}=t;if(i){s=new HN(i,e,-1);let r;t.pswp?r=t.pswp.viewportSize:r=DN(i,t);const l=BN(i,r,e,n);s.update(o.width,o.height,l)}return o.lazyLoad(),s&&o.setDisplayedSize(Math.ceil(o.width*s.initial),Math.ceil(o.height*s.initial)),o}function Jwe(e,t){const n=t.getItemData(e);if(!t.dispatch("lazyLoadSlide",{index:e,itemData:n}).defaultPrevented)return WN(n,t,e)}class Qwe{constructor(t){this.pswp=t,this.limit=Math.max(t.options.preload[0]+t.options.preload[1]+1,Xwe),this._cachedItems=[]}updateLazy(t){const{pswp:n}=this;if(n.dispatch("lazyLoad").defaultPrevented)return;const{preload:o}=n.options,s=t===void 0?!0:t>=0;let i;for(i=0;i<=o[1];i++)this.loadSlideByIndex(n.currIndex+(s?i:-i));for(i=1;i<=o[0];i++)this.loadSlideByIndex(n.currIndex+(s?-i:i))}loadSlideByIndex(t){const n=this.pswp.getLoopedIndex(t);let o=this.getContentByIndex(n);o||(o=Jwe(n,this.pswp),o&&this.addToCache(o))}getContentBySlide(t){let n=this.getContentByIndex(t.index);return n||(n=this.pswp.createContentFromData(t.data,t.index),this.addToCache(n)),n.setSlide(t),n}addToCache(t){if(this.removeByIndex(t.index),this._cachedItems.push(t),this._cachedItems.length>this.limit){const n=this._cachedItems.findIndex(o=>!o.isAttached&&!o.hasSlide);n!==-1&&this._cachedItems.splice(n,1)[0].destroy()}}removeByIndex(t){const n=this._cachedItems.findIndex(o=>o.index===t);n!==-1&&this._cachedItems.splice(n,1)}getContentByIndex(t){return this._cachedItems.find(n=>n.index===t)}destroy(){this._cachedItems.forEach(t=>t.destroy()),this._cachedItems=[]}}class e_e extends Zwe{getNumItems(){var t;let n=0;const o=(t=this.options)===null||t===void 0?void 0:t.dataSource;o&&"length"in o?n=o.length:o&&"gallery"in o&&(o.items||(o.items=this._getGalleryDOMElements(o.gallery)),o.items&&(n=o.items.length));const s=this.dispatch("numItems",{dataSource:o,numItems:n});return this.applyFilters("numItems",s.numItems,o)}createContentFromData(t,n){return new Ywe(t,this,n)}getItemData(t){var n;const o=(n=this.options)===null||n===void 0?void 0:n.dataSource;let s={};Array.isArray(o)?s=o[t]:o&&"gallery"in o&&(o.items||(o.items=this._getGalleryDOMElements(o.gallery)),s=o.items[t]);let i=s;i instanceof Element&&(i=this._domElementToItemData(i));const r=this.dispatch("itemData",{itemData:i||{},index:t});return this.applyFilters("itemData",r.itemData,t)}_getGalleryDOMElements(t){var n,o;return(n=this.options)!==null&&n!==void 0&&n.children||(o=this.options)!==null&&o!==void 0&&o.childSelector?lwe(this.options.children,this.options.childSelector,t)||[]:[t]}_domElementToItemData(t){const n={element:t},o=t.tagName==="A"?t:t.querySelector("a");if(o){n.src=o.dataset.pswpSrc||o.href,o.dataset.pswpSrcset&&(n.srcset=o.dataset.pswpSrcset),n.width=o.dataset.pswpWidth?parseInt(o.dataset.pswpWidth,10):0,n.height=o.dataset.pswpHeight?parseInt(o.dataset.pswpHeight,10):0,n.w=n.width,n.h=n.height,o.dataset.pswpType&&(n.type=o.dataset.pswpType);const i=t.querySelector("img");if(i){var s;n.msrc=i.currentSrc||i.src,n.alt=(s=i.getAttribute("alt"))!==null&&s!==void 0?s:""}(o.dataset.pswpCropped||o.dataset.cropped)&&(n.thumbCropped=!0)}return this.applyFilters("domItemData",n,t,o)}lazyLoadData(t,n){return WN(t,this,n)}}const d1=.003;class t_e{constructor(t){this.pswp=t,this.isClosed=!0,this.isOpen=!1,this.isClosing=!1,this.isOpening=!1,this._duration=void 0,this._useAnimation=!1,this._croppedZoom=!1,this._animateRootOpacity=!1,this._animateBgOpacity=!1,this._placeholder=void 0,this._opacityElement=void 0,this._cropContainer1=void 0,this._cropContainer2=void 0,this._thumbBounds=void 0,this._prepareOpen=this._prepareOpen.bind(this),t.on("firstZoomPan",this._prepareOpen)}open(){this._prepareOpen(),this._start()}close(){if(this.isClosed||this.isClosing||this.isOpening)return;const t=this.pswp.currSlide;this.isOpen=!1,this.isOpening=!1,this.isClosing=!0,this._duration=this.pswp.options.hideAnimationDuration,t&&t.currZoomLevel*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps(),setTimeout(()=>{this._start()},this._croppedZoom?30:0)}_prepareOpen(){if(this.pswp.off("firstZoomPan",this._prepareOpen),!this.isOpening){const t=this.pswp.currSlide;this.isOpening=!0,this.isClosing=!1,this._duration=this.pswp.options.showAnimationDuration,t&&t.zoomLevels.initial*t.width>=this.pswp.options.maxWidthToAnimate&&(this._duration=0),this._applyStartProps()}}_applyStartProps(){const{pswp:t}=this,n=this.pswp.currSlide,{options:o}=t;if(o.showHideAnimationType==="fade"?(o.showHideOpacity=!0,this._thumbBounds=void 0):o.showHideAnimationType==="none"?(o.showHideOpacity=!1,this._duration=0,this._thumbBounds=void 0):this.isOpening&&t._initialThumbBounds?this._thumbBounds=t._initialThumbBounds:this._thumbBounds=this.pswp.getThumbBounds(),this._placeholder=n?.getPlaceholderElement(),t.animations.stopAll(),this._useAnimation=!!(this._duration&&this._duration>50),this._animateZoom=!!this._thumbBounds&&n?.content.usePlaceholder()&&(!this.isClosing||!t.mainScroll.isShifted()),!this._animateZoom)this._animateRootOpacity=!0,this.isOpening&&n&&(n.zoomAndPanToInitial(),n.applyCurrentZoomPan());else{var s;this._animateRootOpacity=(s=o.showHideOpacity)!==null&&s!==void 0?s:!1}if(this._animateBgOpacity=!this._animateRootOpacity&&this.pswp.options.bgOpacity>d1,this._opacityElement=this._animateRootOpacity?t.element:t.bg,!this._useAnimation){this._duration=0,this._animateZoom=!1,this._animateBgOpacity=!1,this._animateRootOpacity=!0,this.isOpening&&(t.element&&(t.element.style.opacity=String(d1)),t.applyBgOpacity(1));return}if(this._animateZoom&&this._thumbBounds&&this._thumbBounds.innerRect){var i;this._croppedZoom=!0,this._cropContainer1=this.pswp.container,this._cropContainer2=(i=this.pswp.currSlide)===null||i===void 0?void 0:i.holderElement,t.container&&(t.container.style.overflow="hidden",t.container.style.width=t.viewportSize.x+"px")}else this._croppedZoom=!1;this.isOpening?(this._animateRootOpacity?(t.element&&(t.element.style.opacity=String(d1)),t.applyBgOpacity(1)):(this._animateBgOpacity&&t.bg&&(t.bg.style.opacity=String(d1)),t.element&&(t.element.style.opacity="1")),this._animateZoom&&(this._setClosedStateZoomPan(),this._placeholder&&(this._placeholder.style.willChange="transform",this._placeholder.style.opacity=String(d1)))):this.isClosing&&(t.mainScroll.itemHolders[0]&&(t.mainScroll.itemHolders[0].el.style.display="none"),t.mainScroll.itemHolders[2]&&(t.mainScroll.itemHolders[2].el.style.display="none"),this._croppedZoom&&t.mainScroll.x!==0&&(t.mainScroll.resetPosition(),t.mainScroll.resize()))}_start(){this.isOpening&&this._useAnimation&&this._placeholder&&this._placeholder.tagName==="IMG"?new Promise(t=>{let n=!1,o=!0;iwe(this._placeholder).finally(()=>{n=!0,o||t(!0)}),setTimeout(()=>{o=!1,n&&t(!0)},50),setTimeout(t,250)}).finally(()=>this._initiate()):this._initiate()}_initiate(){var t,n;(t=this.pswp.element)===null||t===void 0||t.style.setProperty("--pswp-transition-duration",this._duration+"ms"),this.pswp.dispatch(this.isOpening?"openingAnimationStart":"closingAnimationStart"),this.pswp.dispatch("initialZoom"+(this.isOpening?"In":"Out")),(n=this.pswp.element)===null||n===void 0||n.classList.toggle("pswp--ui-visible",this.isOpening),this.isOpening?(this._placeholder&&(this._placeholder.style.opacity="1"),this._animateToOpenState()):this.isClosing&&this._animateToClosedState(),this._useAnimation||this._onAnimationComplete()}_onAnimationComplete(){const{pswp:t}=this;if(this.isOpen=this.isOpening,this.isClosed=this.isClosing,this.isOpening=!1,this.isClosing=!1,t.dispatch(this.isOpen?"openingAnimationEnd":"closingAnimationEnd"),t.dispatch("initialZoom"+(this.isOpen?"InEnd":"OutEnd")),this.isClosed)t.destroy();else if(this.isOpen){var n;this._animateZoom&&t.container&&(t.container.style.overflow="visible",t.container.style.width="100%"),(n=t.currSlide)===null||n===void 0||n.applyCurrentZoomPan()}}_animateToOpenState(){const{pswp:t}=this;this._animateZoom&&(this._croppedZoom&&this._cropContainer1&&this._cropContainer2&&(this._animateTo(this._cropContainer1,"transform","translate3d(0,0,0)"),this._animateTo(this._cropContainer2,"transform","none")),t.currSlide&&(t.currSlide.zoomAndPanToInitial(),this._animateTo(t.currSlide.container,"transform",t.currSlide.getCurrentTransform()))),this._animateBgOpacity&&t.bg&&this._animateTo(t.bg,"opacity",String(t.options.bgOpacity)),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","1")}_animateToClosedState(){const{pswp:t}=this;this._animateZoom&&this._setClosedStateZoomPan(!0),this._animateBgOpacity&&t.bgOpacity>.01&&t.bg&&this._animateTo(t.bg,"opacity","0"),this._animateRootOpacity&&t.element&&this._animateTo(t.element,"opacity","0")}_setClosedStateZoomPan(t){if(!this._thumbBounds)return;const{pswp:n}=this,{innerRect:o}=this._thumbBounds,{currSlide:s,viewportSize:i}=n;if(this._croppedZoom&&o&&this._cropContainer1&&this._cropContainer2){const r=-i.x+(this._thumbBounds.x-o.x)+o.w,l=-i.y+(this._thumbBounds.y-o.y)+o.h,a=i.x-o.w,u=i.y-o.h;t?(this._animateTo(this._cropContainer1,"transform",Np(r,l)),this._animateTo(this._cropContainer2,"transform",Np(a,u))):(ec(this._cropContainer1,r,l),ec(this._cropContainer2,a,u))}s&&(is(s.pan,o||this._thumbBounds),s.currZoomLevel=this._thumbBounds.w/s.width,t?this._animateTo(s.container,"transform",s.getCurrentTransform()):s.applyCurrentZoomPan())}_animateTo(t,n,o){if(!this._duration){t.style[n]=o;return}const{animations:s}=this.pswp,i={duration:this._duration,easing:this.pswp.options.easing,onComplete:()=>{s.activeAnimations.length||this._onAnimationComplete()},target:t};i[n]=o,s.startTransition(i)}}const n_e={allowPanToNext:!0,spacing:.1,loop:!0,pinchToClose:!0,closeOnVerticalDrag:!0,hideAnimationDuration:333,showAnimationDuration:333,zoomAnimationDuration:333,escKey:!0,arrowKeys:!0,trapFocus:!0,returnFocus:!0,maxWidthToAnimate:4e3,clickToCloseNonZoomable:!0,imageClickAction:"zoom-or-close",bgClickAction:"close",tapAction:"toggle-controls",doubleTapAction:"zoom",indexIndicatorSep:" / ",preloaderDelay:2e3,bgOpacity:.8,index:0,errorMsg:"The image cannot be loaded",preload:[1,2],easing:"cubic-bezier(.4,0,.22,1)"};class o_e extends e_e{constructor(t){super(),this.options=this._prepareOptions(t||{}),this.offset={x:0,y:0},this._prevViewportSize={x:0,y:0},this.viewportSize={x:0,y:0},this.bgOpacity=1,this.currIndex=0,this.potentialIndex=0,this.isOpen=!1,this.isDestroying=!1,this.hasMouse=!1,this._initialItemData={},this._initialThumbBounds=void 0,this.topBar=void 0,this.element=void 0,this.template=void 0,this.container=void 0,this.scrollWrap=void 0,this.currSlide=void 0,this.events=new awe,this.animations=new Nwe,this.mainScroll=new xwe(this),this.gestures=new wwe(this),this.opener=new t_e(this),this.keyboard=new Awe(this),this.contentLoader=new Qwe(this)}init(){if(this.isOpen||this.isDestroying)return!1;this.isOpen=!0,this.dispatch("init"),this.dispatch("beforeOpen"),this._createMainStructure();let t="pswp--open";return this.gestures.supportsTouch&&(t+=" pswp--touch"),this.options.mainClass&&(t+=" "+this.options.mainClass),this.element&&(this.element.className+=" "+t),this.currIndex=this.options.index||0,this.potentialIndex=this.currIndex,this.dispatch("firstUpdate"),this.scrollWheel=new Fwe(this),(Number.isNaN(this.currIndex)||this.currIndex<0||this.currIndex>=this.getNumItems())&&(this.currIndex=0),this.gestures.supportsTouch||this.mouseDetected(),this.updateSize(),this.offset.y=window.pageYOffset,this._initialItemData=this.getItemData(this.currIndex),this.dispatch("gettingData",{index:this.currIndex,data:this._initialItemData,slide:void 0}),this._initialThumbBounds=this.getThumbBounds(),this.dispatch("initialLayout"),this.on("openingAnimationEnd",()=>{const{itemHolders:n}=this.mainScroll;n[0]&&(n[0].el.style.display="block",this.setContent(n[0],this.currIndex-1)),n[2]&&(n[2].el.style.display="block",this.setContent(n[2],this.currIndex+1)),this.appendHeavy(),this.contentLoader.updateLazy(),this.events.add(window,"resize",this._handlePageResize.bind(this)),this.events.add(window,"scroll",this._updatePageScrollOffset.bind(this)),this.dispatch("bindEvents")}),this.mainScroll.itemHolders[1]&&this.setContent(this.mainScroll.itemHolders[1],this.currIndex),this.dispatch("change"),this.opener.open(),this.dispatch("afterInit"),!0}getLoopedIndex(t){const n=this.getNumItems();return this.options.loop&&(t>n-1&&(t-=n),t<0&&(t+=n)),i0(t,0,n-1)}appendHeavy(){this.mainScroll.itemHolders.forEach(t=>{var n;(n=t.slide)===null||n===void 0||n.appendHeavy()})}goTo(t){this.mainScroll.moveIndexBy(this.getLoopedIndex(t)-this.potentialIndex)}next(){this.goTo(this.potentialIndex+1)}prev(){this.goTo(this.potentialIndex-1)}zoomTo(...t){var n;(n=this.currSlide)===null||n===void 0||n.zoomTo(...t)}toggleZoom(){var t;(t=this.currSlide)===null||t===void 0||t.toggleZoom()}close(){!this.opener.isOpen||this.isDestroying||(this.isDestroying=!0,this.dispatch("close"),this.events.removeAll(),this.opener.close())}destroy(){var t;if(!this.isDestroying){this.options.showHideAnimationType="none",this.close();return}this.dispatch("destroy"),this._listeners={},this.scrollWrap&&(this.scrollWrap.ontouchmove=null,this.scrollWrap.ontouchend=null),(t=this.element)===null||t===void 0||t.remove(),this.mainScroll.itemHolders.forEach(n=>{var o;(o=n.slide)===null||o===void 0||o.destroy()}),this.contentLoader.destroy(),this.events.removeAll()}refreshSlideContent(t){this.contentLoader.removeByIndex(t),this.mainScroll.itemHolders.forEach((n,o)=>{var s,i;let r=((s=(i=this.currSlide)===null||i===void 0?void 0:i.index)!==null&&s!==void 0?s:0)-1+o;if(this.canLoop()&&(r=this.getLoopedIndex(r)),r===t&&(this.setContent(n,t,!0),o===1)){var l;this.currSlide=n.slide,(l=n.slide)===null||l===void 0||l.setIsActive(!0)}}),this.dispatch("change")}setContent(t,n,o){if(this.canLoop()&&(n=this.getLoopedIndex(n)),t.slide){if(t.slide.index===n&&!o)return;t.slide.destroy(),t.slide=void 0}if(!this.canLoop()&&(n<0||n>=this.getNumItems()))return;const s=this.getItemData(n);t.slide=new cwe(s,n,this),n===this.currIndex&&(this.currSlide=t.slide),t.slide.append(t.el)}getViewportCenterPoint(){return{x:this.viewportSize.x/2,y:this.viewportSize.y/2}}updateSize(t){if(this.isDestroying)return;const n=DN(this.options,this);!t&&sp(n,this._prevViewportSize)||(is(this._prevViewportSize,n),this.dispatch("beforeResize"),is(this.viewportSize,this._prevViewportSize),this._updatePageScrollOffset(),this.dispatch("viewportSize"),this.mainScroll.resize(this.opener.isOpen),!this.hasMouse&&window.matchMedia("(any-hover: hover)").matches&&this.mouseDetected(),this.dispatch("resize"))}applyBgOpacity(t){this.bgOpacity=Math.max(t,0),this.bg&&(this.bg.style.opacity=String(this.bgOpacity*this.options.bgOpacity))}mouseDetected(){if(!this.hasMouse){var t;this.hasMouse=!0,(t=this.element)===null||t===void 0||t.classList.add("pswp--has_mouse")}}_handlePageResize(){this.updateSize(),/iPhone|iPad|iPod/i.test(window.navigator.userAgent)&&setTimeout(()=>{this.updateSize()},500)}_updatePageScrollOffset(){this.setScrollOffset(0,window.pageYOffset)}setScrollOffset(t,n){this.offset.x=t,this.offset.y=n,this.dispatch("updateScrollOffset")}_createMainStructure(){this.element=Ji("pswp","div"),this.element.setAttribute("tabindex","-1"),this.element.setAttribute("role","dialog"),this.template=this.element,this.bg=Ji("pswp__bg","div",this.element),this.scrollWrap=Ji("pswp__scroll-wrap","section",this.element),this.container=Ji("pswp__container","div",this.scrollWrap),this.scrollWrap.setAttribute("aria-roledescription","carousel"),this.container.setAttribute("aria-live","off"),this.container.setAttribute("id","pswp__items"),this.mainScroll.appendHolders(),this.ui=new Uwe(this),this.ui.init(),(this.options.appendToEl||document.body).appendChild(this.element)}getThumbBounds(){return qwe(this.currIndex,this.currSlide?this.currSlide.data:this._initialItemData,this)}canLoop(){return this.options.loop&&this.getNumItems()>2}_prepareOptions(t){return window.matchMedia("(prefers-reduced-motion), (update: slow)").matches&&(t.showHideAnimationType="none",t.zoomAnimationDuration=0),{...n_e,...t}}}function s_e(e){return new Promise(t=>{const n=new Image;n.onload=()=>t(n.naturalWidth>0?{w:n.naturalWidth,h:n.naturalHeight}:null),n.onerror=()=>t(null),n.src=e})}async function i_e(e,t){if(t?.currentSrc&&t.naturalWidth>0)return{src:t.currentSrc,w:t.naturalWidth,h:t.naturalHeight,objectUrl:null};let n=e.url,o=null;if(e.fileId)try{const i=await _t().getFileBlob(e.fileId);o=URL.createObjectURL(i),n=o}catch{}const s=await s_e(n);return s?{src:n,...s,objectUrl:o}:(o&&URL.revokeObjectURL(o),null)}function r_e(e){let t=!1,n=!1,o=null;return(async()=>{const s=await i_e(e.media,e.thumbImg);if(t){s?.objectUrl&&URL.revokeObjectURL(s.objectUrl);return}if(!s){e.onClose();return}const i=e.thumbImg?.currentSrc===s.src?e.thumbImg:null;o=new o_e({dataSource:[{src:s.src,w:s.w,h:s.h,thumbCropped:!0,...i?{msrc:i.currentSrc,element:i}:{}}],index:0,showHideAnimationType:i?"zoom":"fade",arrowPrev:!1,arrowNext:!1,counter:!1,close:!0,zoom:!0,wheelToZoom:!0,escKey:!0,closeTitle:e.labels.close,zoomTitle:e.labels.zoom,bgOpacity:1}),o.addFilter("thumbEl",l=>l?.isConnected?l:null);const r=e.media.path;o.on("uiRegister",()=>{const l=o?.ui;!l||!r||l.registerElement({name:"caption",className:"media-preview-caption",isButton:!1,appendTo:"root",onInit:a=>{a.textContent=r}})}),o.on("openingAnimationStart",()=>{ki.value+=1}),o.on("destroy",()=>{n=!0,ki.value=Math.max(0,ki.value-1),s.objectUrl&&URL.revokeObjectURL(s.objectUrl),e.onClose()}),o.init()})(),()=>{t=!0,o&&!n&&o.close()}}const l_e=["aria-label"],a_e={class:"media-lightbox-card"},u_e=["aria-label"],c_e={class:"media-lightbox-frame"},d_e={key:0,class:"media-lightbox-name"},f_e='button:not([disabled]), video[controls], [tabindex]:not([tabindex="-1"])',p_e=tt({__name:"MediaLightbox",props:{media:{},originImg:{}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>n.media.kind==="image"),r=R(()=>n.media.path??null),l=R(()=>r.value??(n.media.kind==="video"?s("composer.attachmentVideo"):s("composer.attachmentImage"))),a=Z(null),u=Z(null);let c=null,d=null;function f(h){if(h.key==="Escape"){h.preventDefault(),o("close");return}if(h.key!=="Tab"||!a.value)return;const g=a.value.querySelectorAll(f_e),m=g[0],w=g[g.length-1];!m||!w||(a.value.contains(document.activeElement)?h.shiftKey&&document.activeElement===m?(h.preventDefault(),w.focus()):!h.shiftKey&&document.activeElement===w&&(h.preventDefault(),m.focus()):(h.preventDefault(),(h.shiftKey?w:m).focus()))}return dn(()=>{if(i.value){d=r_e({media:n.media,thumbImg:n.originImg??null,labels:{close:s("model.close"),zoom:s("composer.previewZoom")},onClose:()=>o("close")});return}ki.value+=1,c=document.activeElement instanceof HTMLElement?document.activeElement:null,window.addEventListener("keydown",f),u.value?.focus()}),Un(()=>{if(d){d(),d=null;return}ki.value=Math.max(0,ki.value-1),window.removeEventListener("keydown",f),c?.focus()}),(h,g)=>i.value?te("",!0):(b(),me(Zr,{key:0,to:"body"},[C("div",{ref_key:"overlayRef",ref:a,class:"media-lightbox",role:"dialog","aria-modal":"true","aria-label":l.value,onMousedown:g[1]||(g[1]=Et(m=>o("close"),["self"]))},[C("div",a_e,[V(p(Pn),{text:p(s)("model.close")},{default:ke(()=>[C("button",{ref_key:"closeRef",ref:u,type:"button",class:"media-lightbox-close","aria-label":p(s)("model.close"),onClick:g[0]||(g[0]=m=>o("close"))},[V(p(Ie),{name:"close",size:"sm"})],8,u_e)]),_:1},8,["text"]),C("div",c_e,[V(s0,{url:e.media.url,kind:e.media.kind==="video"?"video":"image","file-id":e.media.fileId,"media-class":"media-lightbox-media",controls:e.media.kind==="video"},null,8,["url","kind","file-id","controls"])]),r.value?(b(),A("div",d_e,N(r.value),1)):te("",!0)])],40,l_e)]))}}),UN=ht(p_e,[["__scopeId","data-v-00e2f879"]]),h_e=["title","aria-label"],m_e={key:1,class:"media-thumb-media media-thumb-tile","aria-hidden":"true"},g_e={key:2,class:"media-thumb-badge","aria-hidden":"true"},v_e={key:3,class:"media-thumb-badge is-error","aria-hidden":"true"},y_e={key:4,class:"media-thumb-badge","aria-hidden":"true"},k_e=["aria-label"],b_e=tt({__name:"MediaThumb",props:{kind:{},name:{},url:{},fileId:{},uploading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},removeLabel:{}},emits:["activate","remove"],setup(e,{emit:t}){const n=e,o=t;function s(u){o("activate",u.currentTarget.querySelector("img"))}const{t:i}=Lt(),r=R(()=>n.name?n.name:n.kind==="video"?i("composer.attachmentVideo"):i("composer.attachmentImage")),l=R(()=>n.url?.startsWith("blob:")??!1),a=R(()=>!n.url||n.kind==="video"&&n.fileId!==void 0&&!l.value);return(u,c)=>(b(),A("span",{class:Re(["media-thumb",{"is-error":e.error,uploading:e.uploading}])},[C("button",{type:"button",class:"media-thumb-btn",title:r.value,"aria-label":r.value,onClick:s},[a.value?(b(),A("span",m_e)):(b(),me(s0,{key:0,url:e.url,kind:e.kind,"file-id":l.value?void 0:e.fileId,"media-class":"media-thumb-media",controls:!1,muted:""},null,8,["url","kind","file-id"])),e.uploading?(b(),A("span",g_e,[V(p(Ao),{size:"sm",label:p(i)("composer.uploading")},null,8,["label"])])):e.error?(b(),A("span",v_e,[V(p(Ie),{name:"info",size:"sm"})])):e.kind==="video"?(b(),A("span",y_e,[V(p(Ie),{name:"play",size:"sm"})])):te("",!0)],8,h_e),e.removable?(b(),me(p(Pn),{key:0,text:e.removeLabel??p(i)("composer.remove")},{default:ke(()=>[C("button",{type:"button",class:"media-thumb-rm","aria-label":e.removeLabel??p(i)("composer.remove"),onClick:c[0]||(c[0]=d=>o("remove"))},[V(p(Ie),{name:"close",size:"sm"})],8,k_e)]),_:1},8,["text"])):te("",!0)],2))}}),jN=ht(b_e,[["__scopeId","data-v-7a9b91d0"]]),C_e=["title","data-kind"],w_e=["aria-label"],__e={class:"att-tile"},x_e={class:"att-name"},S_e={key:1,class:"att-err"},A_e=["aria-label"],M_e=tt({__name:"AttachmentChip",props:{kind:{},name:{},url:{},fileId:{},mediaType:{},size:{},uploading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},removable:{type:Boolean,default:!1},removeLabel:{}},emits:["activate","remove"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>{const d=n.name?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]??n.mediaType?.split("/")[1]?.split("+")[0];return d?d.toUpperCase():void 0}),r=R(()=>{const c=i.value??"";return/^(txt|md|doc|docx|rtf|log)$/i.test(c)?"file-text":"file"}),l=R(()=>n.name?n.name:n.kind==="image"?s("composer.attachmentImage"):n.kind==="video"?s("composer.attachmentVideo"):s("composer.attachmentFile"));function a(c){return c<1024?`${c} B`:c<1024*1024?`${Math.round(c/1024)} KB`:`${(c/(1024*1024)).toFixed(1)} MB`}const u=R(()=>{const c=[l.value];return n.size!==void 0&&c.push(a(n.size)),c.join(" · ")});return(c,d)=>(b(),A("span",{class:Re(["att-chip",{"is-error":e.error,uploading:e.uploading}]),title:u.value,"data-kind":e.kind},[C("button",{type:"button",class:"att-activate","aria-label":u.value,onClick:d[0]||(d[0]=f=>o("activate"))},[C("span",__e,[e.kind==="image"&&e.url?(b(),me(s0,{key:0,url:e.url,kind:"image",alt:e.name,"file-id":e.fileId,"media-class":"att-thumb"},null,8,["url","alt","file-id"])):e.kind==="video"?(b(),me(p(Ie),{key:1,name:"play",size:"sm"})):e.kind==="image"?(b(),me(p(Ie),{key:2,name:"image",size:"sm"})):(b(),me(p(Ie),{key:3,name:r.value,size:"sm"},null,8,["name"]))]),C("span",x_e,N(l.value),1),e.uploading?(b(),me(p(Ao),{key:0,size:"sm",label:p(s)("composer.uploading")},null,8,["label"])):e.error?(b(),A("span",S_e,[V(p(Ie),{name:"info",size:"sm"})])):te("",!0)],8,w_e),e.removable?(b(),me(p(Pn),{key:0,text:e.removeLabel??p(s)("composer.remove")},{default:ke(()=>[C("button",{type:"button",class:"att-rm","aria-label":e.removeLabel??p(s)("composer.remove"),onClick:d[1]||(d[1]=f=>o("remove"))},[V(p(Ie),{name:"close",size:"sm"})],8,A_e)]),_:1},8,["text"])):te("",!0)],10,C_e))}}),VN=ht(M_e,[["__scopeId","data-v-d3ab6f87"]]),T_e="/assets/kimi_avatar_default-srYjF2HV.riv";function qN(e,t){for(const n of e.stateMachineNames){const o=(e.stateMachineInputs(n)??[]).find(s=>s.name===t);if(o!==void 0)return o}return null}function E_e(e,t){const n=qN(e,t);return n!==null&&typeof n.fire=="function"?(n.fire(),!0):!1}function Kx(e,t,n){const o=qN(e,t);return o!==null&&typeof o.value==typeof n?(o.value=n,!0):!1}const I_e={key:0,class:"mascot-fallback",viewBox:"5 0 240.776 240.776","aria-hidden":"true"},L_e="light/dark",$_e="click_avator",N_e="hoverspace",F_e=tt({__name:"KimiMascot",setup(e){const t=Z(!1),n=Z(null),o=p2();let s=null,i=null;function r(){s!==null&&Kx(s,L_e,o.value?1:0)}dn(async()=>{if(!window.matchMedia("(prefers-reduced-motion: reduce)").matches)try{const[{Rive:u,RuntimeLoader:c},d,f]=await Promise.all([Go(()=>import("./rive-CeXCFBdn.js").then(_=>_.r),__vite__mapDeps([10,3])),Go(()=>import("./rive-BxcgqsjB.js"),[]).then(_=>_.default),Go(()=>import("./rive_fallback-ByshBW-N.js"),[]).then(_=>_.default)]),h=n.value;if(!h)return;c.setWasmUrl(d),c.setWasmFallbackUrl(f);const g=new u({canvas:h,src:T_e,autoplay:!0,onLoad(){const _=g.stateMachineNames[0];_!==void 0&&g.play(_),requestAnimationFrame(()=>{n.value&&(r(),g.resizeDrawingSurfaceToCanvas(),t.value=!0)})}});s=g;const m=et(o,r),w=()=>g.resizeDrawingSurfaceToCanvas();window.addEventListener("resize",w),i=()=>{m(),window.removeEventListener("resize",w),g.cleanup(),s=null}}catch{}}),Un(()=>{i?.(),i=null});function l(u){s!==null&&Kx(s,N_e,u)}function a(){s!==null&&E_e(s,$_e)}return(u,c)=>(b(),A("div",{class:"mascot-host",role:"img","aria-label":"Kimi mascot",onPointerenter:c[0]||(c[0]=d=>l(!0)),onPointerleave:c[1]||(c[1]=d=>l(!1)),onClick:a},[t.value?te("",!0):(b(),A("svg",I_e,[...c[2]||(c[2]=[Ac('',3)])])),C("canvas",{ref_key:"canvasRef",ref:n,class:Re(["mascot-canvas",{ready:t.value}])},null,2)],32))}}),R_e=ht(F_e,[["__scopeId","data-v-0ec625c2"]]),O_e={class:"working-indicator",role:"status"},P_e={class:"wi-mascot","aria-hidden":"true"},D_e={class:"wi-label"},B_e=tt({__name:"WorkingIndicator",props:{label:{}},setup(e){return(t,n)=>(b(),A("div",O_e,[C("span",P_e,[V(R_e)]),C("span",D_e,N(e.label),1)]))}}),KN=ht(B_e,[["__scopeId","data-v-8abb44ef"]]),H_e=/^(application\/pdf|image\/(png|jpe?g|gif|webp|avif|bmp|x-icon|vnd\.microsoft\.icon)|video\/[\w.+-]+|audio\/[\w.+-]+)$/i,z_e=/^(txt|md|markdown|log|json|ya?ml|csv|tsv|ts|mts|tsx|jsx|css|py|go|rs|java|c|h|cc|cpp|hpp|sh|zsh|sql|toml|ini|cfg|conf|vue)$/i,W_e=/^(png|jpe?g|gif|webp|avif|bmp|ico)$/i,Zx="text/plain;charset=utf-8";function U_e(e,t){const n=(t??"").toLowerCase();if(H_e.test(n))return n;if(n.startsWith("text/"))return n==="text/html"?null:Zx;const o=e?.match(/\.([A-Za-z0-9]{1,8})$/)?.[1]?.toLowerCase();return o===void 0?null:z_e.test(o)?Zx:W_e.test(o)?`image/${o==="jpg"?"jpeg":o==="ico"?"x-icon":o}`:o==="pdf"?"application/pdf":null}async function ZN(e,t,n){const o=U_e(t,n);if(o===null)return"unsupported";const s=window.open("","_blank");s!==null&&(s.opener=null);const i=await _t().getFileBlob(e).catch(()=>null);if(i===null)return s?.close(),"failed";const r=URL.createObjectURL(new Blob([i],{type:o}));if(s!==null)s.location.href=r;else{const l=document.createElement("a");l.href=r,l.download=t??e,l.click()}return setTimeout(()=>{URL.revokeObjectURL(r)},6e4),"previewed"}const j_e={class:"chat"},V_e={key:0,class:"chat-loading"},q_e={class:"chat-loading-text"},K_e={key:1,class:"chat-empty"},Z_e={key:1,class:"top-sentinel-text"},G_e={key:0,class:"u-turn"},Y_e=["data-turn-id"],X_e={key:0,class:"u-media"},J_e={key:1,class:"u-atts"},Q_e={key:2,class:"skill-act"},exe={class:"skill-act-head"},txe={key:3,class:"skill-act"},nxe={class:"skill-act-head"},oxe=["aria-expanded","onClick"],sxe={key:0,class:"u-meta"},ixe=["aria-label","onClick"],rxe={class:"u-edit-hint"},lxe=["aria-label","onClick"],axe=["aria-label","onClick"],uxe=["data-turn-id"],cxe=["onClick"],dxe={class:"cd-view"},fxe={key:1,class:"cd-label"},pxe=["data-turn-id"],hxe={key:0,class:"goal-prov"},mxe={key:1,class:"msg"},gxe={key:3,class:"a-msg-ft"},vxe={key:0,class:"a-duration"},yxe=["aria-label","onClick"],kxe={key:4,class:"compact-divider",role:"separator"},bxe={class:"cd-label",role:"status"},Cxe={key:3,class:"turn-failed",role:"alert"},wxe={class:"tf-chip","aria-hidden":"true"},_xe={class:"tf-main"},xxe={class:"tf-title"},Sxe=["title"],Axe=["title"],Mxe={key:5,class:"sending-placeholder"},Txe={key:6,class:"q-stack"},Exe={class:"q-head"},Ixe={class:"q-title"},Lxe={class:"q-hint"},$xe=["onDragover","onDrop"],Nxe={class:"u-bub q-bub"},Fxe=["title","onDragstart"],Rxe=["title","onClick"],Oxe={key:0,class:"u-text q-text"},Pxe={key:1,class:"q-text q-text-placeholder"},Dxe=["aria-expanded","onClick"],Bxe={key:0,class:"q-imgs"},Hxe={key:0,class:"q-file"},zxe={key:1,class:"q-tag q-tag-next"},Wxe={key:2,class:"q-tag q-tag-idx"},Uxe=["aria-label","onClick"],jxe={key:0,class:"open-unsupported",role:"status"},Vxe=2500,qxe=10,Kxe=tt({__name:"ChatPane",props:{turns:{},cwd:{},turnFilesInteractive:{type:Boolean,default:!0},approvals:{default:()=>[]},questions:{default:()=>[]},turnActive:{type:Boolean,default:!1},working:{type:Boolean,default:!1},sessionLoading:{type:Boolean},compaction:{default:null},hasMoreMessages:{type:Boolean,default:!1},loadingMore:{type:Boolean,default:!1},loadingMoreError:{type:Boolean,default:!1},isFollowing:{type:Boolean,default:!1},readOnly:{type:Boolean,default:!1},queued:{default:()=>[]},undoHintTurnId:{default:null},interruptedTurnId:{default:null},turnFailed:{type:Boolean,default:!1},turnError:{default:null},turnRetry:{default:null}},emits:["openFile","openMedia","openTurnDiff","copyConversationCopied","openCompaction","openAgent","editMessage","armedUndo","loadOlderMessages","unqueue","editQueued","reorderQueue","resumeTurn"],setup(e,{expose:t,emit:n}){const{t:o}=Lt(),{confirm:s}=pu();kn(()=>{Y!==null&&(clearTimeout(Y),Y=null),W!==null&&(clearTimeout(W),W=null),B!==null&&(clearTimeout(B),B=null),st!==null&&(clearTimeout(st),st=null)});const i=e,r=Z(null);let l=null;function a(){!r.value||typeof IntersectionObserver>"u"||(l?.disconnect(),l=new IntersectionObserver(je=>{je[0]?.isIntersecting&&i.hasMoreMessages&&!i.loadingMore&&!i.loadingMoreError&&!i.sessionLoading&&!i.isFollowing&&m("loadOlderMessages")},{root:null,rootMargin:"200px 0px 0px 0px",threshold:0}),l.observe(r.value))}dn(a),kn(()=>{l?.disconnect(),l=null}),et(()=>[i.hasMoreMessages,i.loadingMore,i.loadingMoreError],()=>{yt().then(a)});const u=R(()=>{if(!i.turnActive||i.turns.length===0)return null;const je=i.turns.at(-1);return je.role==="assistant"?je.id:null}),c=R(()=>{const je=new Map;for(const Ke of i.turns){if(Ke.role!=="assistant"||Ke.id===u.value)continue;const Ze=rbe(Ke);Ze.length>0&&je.set(Ke.id,Ze)}return je}),d=R(()=>i.working),f=R(()=>{const je=i.turnRetry;if(je!=null)return o("conversation.workingRetry",{n:je.nextAttempt,max:je.maxAttempts});const Ke=i.turns.at(-1),Ze=Ke?.role==="assistant"&&(Ke.text.trim().length>0||(Ke.thinking?.trim().length??0)>0||(Ke.tools?.length??0)>0);return o(Ze?"conversation.working":"conversation.requesting")}),h=R(()=>i.turnError?.code==="loop.max_steps_exceeded"?o("conversation.turnFailedMaxSteps"):o("conversation.turnFailed")),g=R(()=>{const je=i.turnError;if(!je)return"";const Ke=[];return je.code!==void 0&&je.code.length>0&&Ke.push(je.code),je.statusCode!==void 0&&Ke.push(`HTTP ${je.statusCode}`),je.requestId!==void 0&&je.requestId.length>0&&Ke.push(je.requestId),Ke.join(" · ")}),m=n,w=Z(null),_=Z(null);function v(je){return(je.attachments?.length??0)>0}function k(je){m("editQueued",je)}function y(je,Ke){if(w.value=je,!Ke.dataTransfer)return;Ke.dataTransfer.effectAllowed="move",Ke.dataTransfer.setData("text/plain",String(je));const Ze=Ke.currentTarget?.closest(".q-turn");Ze&&Ke.dataTransfer.setDragImage(Ze,24,24)}function x(je,Ke){if(w.value===null)return;Ke.preventDefault(),Ke.dataTransfer&&(Ke.dataTransfer.dropEffect="move");const Ze=Ke.currentTarget.getBoundingClientRect(),zt=Ke.clientY{for(let je=i.turns.length-1;je>=0;je--){const Ke=i.turns[je];if(Ke.goalContinuation)return null;if(Ke.role==="user")return Ke.id}return null});function I(je){return!i.readOnly&&je.role==="user"&&je.id===S.value&&!i.working&&!je.skillActivation&&!je.pluginCommand}function P(je){const Ke=je.compaction,Ze=Ke?.trigger==="auto"?o("conversation.compactedAuto"):o("conversation.compactedPlain");return typeof Ke?.tokensBefore=="number"&&typeof Ke?.tokensAfter=="number"?Ze+o("conversation.compactedTokens",{before:Ml(Ke.tokensBefore),after:Ml(Ke.tokensAfter)}):Ze}const D=Z(null);function T(je){return je.durationMs===void 0?"":_c(je.durationMs)}const L=Z(null);let B=null;async function H(je){await s({title:o("conversation.undo"),message:o("conversation.undoConfirm"),variant:"primary"})&&O(je)}function O(je){L.value===null&&(L.value=je.id,m("editMessage",{text:je.text,attachments:je.attachments}),B=setTimeout(()=>{B=null,L.value=null},Vxe))}et(()=>i.turns,je=>{L.value!==null&&(je.some(Ke=>Ke.id===L.value)||(L.value=null,B!==null&&(clearTimeout(B),B=null)))},{flush:"post"});const F=Z(!1);let W=null;function z(){if(i.turns.length===0)return;const je=[];for(const Ze of i.turns){if(Ze.role==="compaction"||Ze.role==="cron")continue;const zt=Ze.role==="user"?"User":"Assistant",at=tbe(Ze);at.trim()&&je.push(`**${zt}** - -${at}`)}const Ke=je.join(` - ---- - -`);js(Ke).then(Ze=>{Ze&&(F.value=!0,m("copyConversationCopied"),W!==null&&clearTimeout(W),W=setTimeout(()=>{W=null,F.value=!1},2e3))}).catch(()=>{})}function U(je){const Ke=[];for(let Ze=je;Ze>=0;Ze--){const zt=i.turns[Ze];if(!zt||zt.role!=="assistant")break;Ke.unshift(zt)}return Ke}function q(je){return U(je).map(Ke=>ebe(Ke)).filter(Boolean).join(` - -`)}function K(){for(let je=i.turns.length-1;je>=0;je-=1)if(i.turns[je]?.role==="assistant")return q(je);return""}function ie(){const je=K();je.trim()&&js(je).then(Ke=>{Ke&&(F.value=!0,m("copyConversationCopied"),W!==null&&clearTimeout(W),W=setTimeout(()=>{W=null,F.value=!1},2e3))}).catch(()=>{})}t({copyConversation:z,copyFinalSummary:ie});function ne(je){const Ke=i.turns[je];if(!Ke||Ke.role!=="assistant")return!1;const Ze=i.turns[je+1];return!Ze||Ze.role!=="assistant"}let Y=null;function le(je){const Ke=i.turns[je];if(!Ke)return;const Ze=q(je);Ze.trim()&&js(Ze).then(zt=>{zt&&(D.value=Ke.id,Y!==null&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,D.value=null},1400))}).catch(()=>{})}function Ee(je){const Ke=je.text;Ke.trim()&&js(Ke).then(Ze=>{Ze&&(D.value=je.id,Y!==null&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,D.value=null},1400))}).catch(()=>{})}const de=Jo(new Set),he=Jo(new Set),pe=new Map,oe=new WeakMap,ve=on("pinScroll",()=>{}),G=new ResizeObserver(je=>{for(const Ke of je){const Ze=Ke.target,zt=oe.get(Ze);zt!==void 0&&X(zt,Ze)}});kn(()=>G.disconnect());function X(je,Ke){const Ze=parseFloat(getComputedStyle(Ke).lineHeight);if(!Number.isFinite(Ze)||Ze<=0)return;const at=(Ke.textContent??"").match(/\n+$/)?.[0].length??0;Ke.scrollHeight-Math.max(0,at-1)*Ze>Ze*qxe+1?de.add(je):de.delete(je)}function fe(je,Ke){if(!(Ke instanceof HTMLElement)||pe.get(je)===Ke)return;const Ze=pe.get(je);Ze!==void 0&&G.unobserve(Ze),pe.set(je,Ke),oe.set(Ke,je),G.observe(Ke),X(je,Ke)}function Ce(je){return`queue:${je.id}`}et([()=>i.turns,()=>i.queued],()=>{const je=new Set(i.turns.map(Ke=>Ke.id));for(const Ke of i.queued)je.add(Ce(Ke));for(const[Ke,Ze]of pe)je.has(Ke)||(G.unobserve(Ze),pe.delete(Ke),de.delete(Ke),he.delete(Ke))});function ge(je){return je.skillActivation?je.skillActivation.args||null:je.pluginCommand?je.pluginCommand.args||null:je.text||null}function Q(je){return je.skillActivation!==void 0||je.pluginCommand!==void 0}function ee(je){return de.has(je)&&!he.has(je)}function ce(je,Ke){const Ze=he.has(je);Ze&&Ke.currentTarget instanceof HTMLElement&&ve(Ke.currentTarget),Ze?he.delete(je):he.add(je)}function ue(je){return je.kind==="image"||je.kind==="video"}function Se(je){return(je.attachments??[]).filter(ue)}function Ue(je){return(je.attachments??[]).filter(Ke=>!ue(Ke))}function _e(je){return{kind:je.kind==="video"?"video":"image",url:je.url,path:je.name,fileId:je.fileId}}const Te=Z(null);let st=null;const Fe=Z(null),Oe=Z(null);function Ye(je,Ke){if(je.kind==="image"||je.kind==="video"){Oe.value=Ke??null,Fe.value=_e(je);return}je.fileId!==void 0&&ZN(je.fileId,je.name,je.mediaType).then(Ze=>{Ze==="unsupported"&&(Te.value=je.name??je.fileId??"",st!==null&&clearTimeout(st),st=setTimeout(()=>{st=null,Te.value=null},2400))})}function ft(je,Ke){return je.id!==u.value||Ke.kind==="thinking"&&Ke.durationMs!==void 0?!1:Ke.sourceIndex===na(je).length-1}function $t(je,Ke){if(je.id!==u.value)return!1;const Ze=Ke.items.at(-1);return Ze?.kind==="thinking"&&Ze.durationMs!==void 0?!1:Ze!==void 0&&Ze.sourceIndex===na(je).length-1}const Ht={folded:[],visible:[]};function Yt(je){return je.role!=="assistant"?Ht:xN(je)}function _n(je){if(je.id!==u.value)return null;const Ke=na(je),Ze=Ke.at(-1);if(Ze?.kind==="thinking"&&Ze.durationMs!==void 0)return null;if(Ze?.kind==="tool"&&Ze.tool.status==="running"){const zt=Ze.tool.id;if(i.approvals?.some(at=>at.toolCallId===zt)||i.questions?.some(at=>at.toolCallId===zt))return null}return Ke.length-1}return(je,Ke)=>(b(),A(Pe,null,[C("div",j_e,[e.sessionLoading?(b(),A("div",V_e,[V(p(Ao),{size:"sm"}),C("span",q_e,N(p(o)("conversation.loading")),1)])):e.turns.length===0&&(!e.approvals||e.approvals.length===0)?(b(),A("div",K_e)):te("",!0),e.hasMoreMessages||e.loadingMore?(b(),A("div",{key:2,ref_key:"topSentinelRef",ref:r,class:Re(["top-sentinel",{"top-sentinel-loading":e.loadingMore}])},[e.loadingMore?(b(),A("span",Z_e,[V(p(Ao),{size:"sm"}),Ve(" "+N(p(o)("conversation.loadingOlder")),1)])):(b(),A("button",{key:0,type:"button",class:"top-sentinel-btn",onClick:Ke[0]||(Ke[0]=Ze=>m("loadOlderMessages"))},N(p(o)("conversation.loadOlder")),1))],2)):te("",!0),(b(!0),A(Pe,null,pt(e.turns,(Ze,zt)=>(b(),A(Pe,{key:Ze.id},[Ze.role==="user"?(b(),A("div",G_e,[C("div",{class:Re(["u-bub turn-anchor",{undoing:L.value===Ze.id}]),"data-turn-id":Ze.id},[Se(Ze).length>0?(b(),A("div",X_e,[(b(!0),A(Pe,null,pt(Se(Ze),(at,tn)=>(b(),me(jN,{key:tn,kind:at.kind,name:at.name,url:at.url,"file-id":at.fileId,onActivate:Wt=>Ye(at,Wt)},null,8,["kind","name","url","file-id","onActivate"]))),128))])):te("",!0),Ue(Ze).length>0?(b(),A("div",J_e,[(b(!0),A(Pe,null,pt(Ue(Ze),(at,tn)=>(b(),me(VN,{key:tn,kind:at.kind,name:at.name,url:at.url,"file-id":at.fileId,"media-type":at.mediaType,size:at.size,onActivate:Wt=>Ye(at)},null,8,["kind","name","url","file-id","media-type","size","onActivate"]))),128))])):te("",!0),Ze.skillActivation?(b(),A("div",Q_e,[C("div",exe,[Ke[14]||(Ke[14]=C("span",{class:"skill-act-arrow"},"▶",-1)),C("span",null,N(p(o)("conversation.activatedSkill",{name:Ze.skillActivation.name})),1)])])):Ze.pluginCommand?(b(),A("div",txe,[C("div",nxe,[Ke[15]||(Ke[15]=C("span",{class:"skill-act-arrow"},"▶",-1)),C("span",null,"/"+N(Ze.pluginCommand.pluginId)+":"+N(Ze.pluginCommand.commandName),1)])])):te("",!0),ge(Ze)!==null?(b(),A("div",{key:4,class:Re(["u-text-wrap",{"is-clamped":ee(Ze.id),"u-text-wrap-args":Q(Ze)}])},[C("div",{class:Re(Q(Ze)?"skill-act-args":"u-text"),ref_for:!0,ref:at=>fe(Ze.id,at)},N(ge(Ze)),3),de.has(Ze.id)?(b(),A("button",{key:0,type:"button",class:"u-text-toggle","aria-expanded":!ee(Ze.id),onClick:at=>ce(Ze.id,at)},[C("span",null,N(ee(Ze.id)?p(o)("conversation.userMessage.expand"):p(o)("conversation.userMessage.collapse")),1),V(p(Ie),{class:"u-text-toggle-car",name:"chevron-down",size:"sm","aria-hidden":"true"})],8,oxe)):te("",!0)],2)):te("",!0)],10,Y_e),Ze.createdAt||I(Ze)||!e.readOnly&&e.undoHintTurnId===Ze.id?(b(),A("div",sxe,[I(Ze)||!e.readOnly&&e.undoHintTurnId===Ze.id?(b(),A("div",{key:0,class:Re(["u-edit-wrap",{undoing:L.value===Ze.id}])},[e.undoHintTurnId===Ze.id?(b(),A("button",{key:0,type:"button",class:"u-edit u-edit-armed","aria-label":p(o)("conversation.undoTooltip"),onClick:at=>m("armedUndo",Ze.id)},[V(p(Ie),{name:"undo",size:"sm"}),C("span",rxe,[Ve(N(p(o)("conversation.escUndoHintPre")),1),V(p(sa),{keys:["Esc"]}),Ve(N(p(o)("conversation.escUndoHintPost")),1)])],8,ixe)):(b(),A("button",{key:1,type:"button",class:"u-edit","aria-label":p(o)("conversation.undoTooltip"),onClick:at=>H(Ze)},[V(p(Ie),{name:"undo",size:"sm"})],8,lxe))],2)):te("",!0),Ze.text.trim().length>0?(b(),A("button",{key:1,type:"button",class:"u-copy","aria-label":p(o)("filePreview.copy"),onClick:Et(at=>Ee(Ze),["stop"])},[D.value!==Ze.id?(b(),me(p(Ie),{key:0,name:"copy",size:"sm"})):(b(),me(p(Ie),{key:1,name:"check",size:"sm"}))],8,axe)):te("",!0),Ze.createdAt?(b(),me(Ng,{key:2,time:Ze.createdAt},null,8,["time"])):te("",!0)])):te("",!0)])):Ze.role==="compaction"?(b(),A("div",{key:1,class:"compact-divider turn-anchor","data-turn-id":Ze.id,role:"separator"},[Ke[16]||(Ke[16]=C("span",{class:"cd-line","aria-hidden":"true"},null,-1)),Ze.text?(b(),A("button",{key:0,type:"button",class:"cd-label cd-btn",onClick:at=>m("openCompaction",{turnId:Ze.id})},[C("span",null,N(P(Ze)),1),C("span",dxe,N(p(o)("conversation.viewSummary")),1)],8,cxe)):(b(),A("span",fxe,N(P(Ze)),1)),Ke[17]||(Ke[17]=C("span",{class:"cd-line","aria-hidden":"true"},null,-1))],8,uxe)):Ze.role==="cron"?(b(),me(nwe,{key:2,text:Ze.text,cron:Ze.cron,"turn-id":Ze.id,"created-at":Ze.createdAt},null,8,["text","cron","turn-id","created-at"])):(b(),A("div",{key:3,class:"a-msg turn-anchor","data-turn-id":Ze.id},[Ze.goalContinuation?(b(),A("div",hxe,[V(p(Ie),{name:"target",size:"sm","aria-hidden":"true"}),C("span",null,N(p(o)("conversation.goal.continuation")),1)])):te("",!0),Yt(Ze).folded.length>0?(b(),me(TCe,{key:1,items:Yt(Ze).folded,mobile:"","streaming-tail-index":_n(Ze),live:Ze.id===u.value,parked:Ze.id===u.value&&_n(Ze)===null,"seed-ms":p(Jke)(p(na)(Ze)),"created-ms":p(Bx)(Ze.createdAt),"ended-ms":p(Bx)(Ze.endedAt),"duration-ms":Ze.durationMs,onOpenMedia:Ke[1]||(Ke[1]=at=>m("openMedia",at)),onOpenFile:Ke[2]||(Ke[2]=at=>m("openFile",at)),onOpenAgent:Ke[3]||(Ke[3]=at=>m("openAgent",at))},null,8,["items","streaming-tail-index","live","parked","seed-ms","created-ms","ended-ms","duration-ms"])):te("",!0),(b(!0),A(Pe,null,pt(Yt(Ze).visible,(at,tn)=>(b(),A(Pe,{key:p(AN)(at,tn)},[at.kind==="thinking"?(b(),me(X5,{key:0,text:at.thinking,mobile:"",streaming:ft(Ze,at),"started-at":at.startedAt,"duration-ms":at.durationMs},null,8,["text","streaming","started-at","duration-ms"])):at.kind==="text"&&at.text?(b(),A("div",mxe,[V(p(Ic),{text:at.text,streaming:ft(Ze,at),"open-file":Wt=>m("openFile",Wt)},null,8,["text","streaming","open-file"])])):at.kind==="activity-run"?(b(),me(NN,{key:2,items:at.items,mobile:"",streaming:$t(Ze,at),onOpenMedia:Ke[4]||(Ke[4]=Wt=>m("openMedia",Wt)),onOpenFile:Ke[5]||(Ke[5]=Wt=>m("openFile",Wt)),onOpenAgent:Ke[6]||(Ke[6]=Wt=>m("openAgent",Wt))},null,8,["items","streaming"])):at.kind==="tool"?(b(),me(Y5,{key:3,tool:at.tool,mobile:"",onOpenMedia:Ke[7]||(Ke[7]=Wt=>m("openMedia",Wt)),onOpenFile:Ke[8]||(Ke[8]=Wt=>m("openFile",Wt)),onOpenAgent:Ke[9]||(Ke[9]=Wt=>m("openAgent",Wt))},null,8,["tool"])):at.kind==="notification"?(b(),me(FN,{key:4,items:at.items},null,8,["items"])):te("",!0)],64))),128)),c.value.get(Ze.id)?(b(),me(UCe,{key:2,changes:c.value.get(Ze.id),cwd:i.cwd,interactive:e.turnFilesInteractive,onOpenDiff:Ke[10]||(Ke[10]=at=>m("openTurnDiff",at)),onOpenFile:Ke[11]||(Ke[11]=at=>m("openFile",at))},null,8,["changes","cwd","interactive"])):te("",!0),Ze.id!==u.value&&ne(zt)&&(q(zt).trim().length>0||T(Ze))?(b(),A("div",gxe,[T(Ze)?(b(),A("span",vxe,N(T(Ze)),1)):te("",!0),q(zt).trim().length>0?(b(),A("button",{key:1,class:"a-cpbtn","aria-label":p(o)("filePreview.copy"),onClick:at=>le(zt)},[D.value!==Ze.id?(b(),me(p(Ie),{key:0,name:"copy",size:"sm"})):(b(),me(p(Ie),{key:1,name:"check",size:"sm"}))],8,yxe)):te("",!0)])):te("",!0)],8,pxe)),Ze.role==="assistant"&&Ze.id===e.interruptedTurnId?(b(),A("div",kxe,[Ke[18]||(Ke[18]=C("span",{class:"cd-line","aria-hidden":"true"},null,-1)),C("span",bxe,N(p(o)("conversation.turnInterrupted")),1),Ke[19]||(Ke[19]=C("span",{class:"cd-line","aria-hidden":"true"},null,-1))])):te("",!0)],64))),128)),e.turnFailed?(b(),A("div",Cxe,[C("span",wxe,[V(p(Ie),{name:"alert-triangle",size:"sm"})]),C("div",_xe,[C("span",xxe,N(h.value),1),e.turnError?.message?(b(),A("span",{key:0,class:"tf-sub",title:e.turnError.message},N(e.turnError.message),9,Sxe)):te("",!0),g.value?(b(),A("span",{key:1,class:"tf-meta",title:g.value},N(g.value),9,Axe)):te("",!0)]),e.readOnly?te("",!0):(b(),me(p(Ft),{key:0,variant:"secondary",size:"sm",onClick:Ke[12]||(Ke[12]=Ze=>m("resumeTurn"))},{default:ke(()=>[Ve(N(p(o)("conversation.turnFailedResume")),1)]),_:1}))])):te("",!0),e.compaction?(b(),me(ZCe,{key:4,label:p(o)("conversation.compacting")},null,8,["label"])):te("",!0),d.value?(b(),A("div",Mxe,[V(KN,{label:f.value},null,8,["label"])])):te("",!0),e.queued.length>0?(b(),A("div",Txe,[C("div",Exe,[C("span",Ixe,[V(p(Ie),{name:"mail",size:"sm"}),Ve(" "+N(p(o)("composer.queueLabel"))+" · ",1),C("b",null,N(e.queued.length),1)]),C("span",Lxe,N(p(o)("composer.queueAutoDrain")),1)]),(b(!0),A(Pe,null,pt(e.queued,(Ze,zt)=>(b(),A("div",{key:Ze.id,class:Re(["u-turn q-turn",{"q-dragging":w.value===zt,"drop-before":_.value?.index===zt&&_.value.position==="before","drop-after":_.value?.index===zt&&_.value.position==="after"}]),onDragover:at=>x(zt,at),onDrop:at=>M(zt,at)},[C("div",Nxe,[C("span",{class:"q-grip",title:p(o)("composer.queueDragTitle"),draggable:"true",onDragstart:at=>y(zt,at),onDragend:$},[V(p(Ie),{name:"grip",size:"sm"})],40,Fxe),C("div",{class:Re(["q-clamp u-text-wrap",{"is-clamped":ee(Ce(Ze))}])},[C("button",{type:"button",class:"q-body",title:p(o)("composer.editQueued"),ref_for:!0,ref:at=>fe(Ce(Ze),at),onClick:at=>k(zt)},[Ze.text?(b(),A("span",Oxe,N(Ze.text),1)):(b(),A("span",Pxe,[V(p(Ie),{name:"file",size:"sm"}),Ve(" "+N(p(o)("composer.queuedAttachments",{n:Ze.attachments?.length??0})),1)]))],8,Rxe),de.has(Ce(Ze))?(b(),A("button",{key:0,type:"button",class:"u-text-toggle","aria-expanded":!ee(Ce(Ze)),onClick:at=>ce(Ce(Ze),at)},[C("span",null,N(ee(Ce(Ze))?p(o)("conversation.userMessage.expand"):p(o)("conversation.userMessage.collapse")),1),V(p(Ie),{class:"u-text-toggle-car",name:"chevron-down",size:"sm","aria-hidden":"true"})],8,Dxe)):te("",!0)],2),v(Ze)?(b(),A("div",Bxe,[(b(!0),A(Pe,null,pt(Ze.attachments,(at,tn)=>(b(),A(Pe,{key:tn},[at.kind==="file"?(b(),A("span",Hxe,[V(p(Ie),{name:"file",size:"sm"}),Ve(" "+N(at.name??at.fileId),1)])):(b(),me(s0,{key:1,url:at.url,kind:at.kind,"file-id":at.fileId,"media-class":"q-img",controls:!1,muted:""},null,8,["url","kind","file-id"]))],64))),128))])):te("",!0),zt===0?(b(),A("span",zxe,N(p(o)("composer.queueNext")),1)):(b(),A("span",Wxe,"#"+N(zt+1),1)),C("button",{type:"button",class:"q-rm","aria-label":p(o)("composer.remove"),onClick:Et(at=>m("unqueue",zt),["stop"])},[V(p(Ie),{name:"close",size:"sm"})],8,Uxe)])],42,$xe))),128))])):te("",!0)]),Te.value!==null?(b(),A("div",jxe,N(p(o)("composer.attachmentOpenUnsupported",{name:Te.value})),1)):te("",!0),Fe.value?(b(),me(UN,{key:1,media:Fe.value,"origin-img":Oe.value,onClose:Ke[13]||(Ke[13]=Ze=>{Fe.value=null,Oe.value=null})},null,8,["media","origin-img"])):te("",!0)],64))}}),J5=ht(Kxe,[["__scopeId","data-v-167cb739"]]),Zxe={class:"ch-id"},Gxe=["title"],Yxe={key:1,class:"ch-ws"},Xxe={key:2,class:"ch-sep"},Jxe=["onKeydown"],Qxe={class:"ch-ses"},eSe={key:0,class:"ch-pill ch-sync-pill"},tSe={key:0,class:"ch-ahead"},nSe={key:1,class:"ch-behind"},oSe={key:1,class:"ch-pill ch-diff-pill"},sSe={key:0,class:"ch-add"},iSe={key:1,class:"ch-del"},rSe=tt({__name:"ChatHeader",props:{sessionId:{},workspaceName:{},workspaceRoot:{},sessionTitle:{},branch:{},ahead:{},behind:{},changesCount:{},gitDiffStats:{},isGitRepo:{type:Boolean},pr:{},copied:{type:Boolean}},emits:["copyAll","copyFinalSummary","openChanges","openPr","renameSession","forkSession","archiveSession","exportSession"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=R(()=>o.ahead??0),r=R(()=>o.behind??0),l=R(()=>o.gitDiffStats?.totalAdditions??0),a=R(()=>o.gitDiffStats?.totalDeletions??0),u=R(()=>l.value>0||a.value>0),c={open:"header.prStatusOpen",closed:"header.prStatusClosed",merged:"header.prStatusMerged",draft:"header.prStatusDraft"};function d(ne){return ne.trim().toLowerCase().replaceAll("_","-")}function f(ne){const Y=d(ne);return c[Y]?`pr-${Y}`:"pr-unknown"}function h(ne){return n(c[d(ne)]??"header.prStatusUnknown")}const g=Z(!1),m=Z(null),w=Z(null),_=Z({});function v(ne){const Y=ne.target;w.value?.el?.contains(Y)||m.value?.el?.contains(Y)||x()}function k(){x()}async function y(ne){if(ne.stopPropagation(),g.value){x();return}g.value=!0,document.addEventListener("mousedown",v),window.addEventListener("resize",k),await yt();const Y=m.value?.el,le=w.value?.el;if(!Y||!le)return;const Ee=Y.getBoundingClientRect(),de=4,he=8,pe=le.offsetWidth,oe=le.offsetHeight;let ve=Ee.bottom+de,G=!1;ve+oe>window.innerHeight-he&&(ve=Math.max(he,Ee.top-oe-de),G=!0);let X=Ee.left,fe=!1;X+pe>window.innerWidth-he&&(X=Math.max(he,Ee.right-pe),fe=!0),_.value={top:`${Math.round(ve)}px`,left:`${Math.round(X)}px`,transformOrigin:`${G?"bottom":"top"} ${fe?"right":"left"}`,"--menu-pop-shift":G?"2px":"-2px"}}function x(){g.value=!1,document.removeEventListener("mousedown",v),window.removeEventListener("resize",k)}kn(()=>{document.removeEventListener("mousedown",v),window.removeEventListener("resize",k)});function M(){s("copyAll"),x()}function $(){s("copyFinalSummary"),x()}const S=Z(!1);function I(){o.sessionId&&js(o.sessionId).then(ne=>{ne&&(S.value=!0,setTimeout(()=>{S.value=!1},1200))})}const P=Z(!1),D=Z(""),T=Z(null),{handleCompositionStart:L,handleCompositionEnd:B,isComposingKeyEvent:H}=Sr();async function O(){if(x(),!!o.sessionId){P.value=!0,D.value=o.sessionTitle??"",await yt();try{T.value?.focus(),T.value?.select()}catch{}}}function F(){const ne=D.value.trim();ne&&o.sessionId&&ne!==(o.sessionTitle??"").trim()&&s("renameSession",o.sessionId,ne),P.value=!1}function W(ne){H(ne)||F()}function z(){P.value=!1}function U(){o.sessionId&&(x(),s("forkSession",o.sessionId))}function q(){o.sessionId&&(x(),s("exportSession",o.sessionId))}function K(){o.sessionId&&(x(),s("archiveSession",o.sessionId))}const ie=!1;return(ne,Y)=>(b(),A("header",{class:Re(["chat-header",{"macos-desktop":p(uc)}])},[C("div",Zxe,[p(ie)?(b(),A("span",{key:0,class:"ch-dev",title:p(n)("header.devBadge")},"DEV",8,Gxe)):te("",!0),e.workspaceName?(b(),A("span",Yxe,N(e.workspaceName),1)):te("",!0),e.workspaceName&&e.sessionTitle?(b(),A("span",Xxe,"/")):te("",!0),P.value?In((b(),A("input",{key:3,ref_key:"renameInputRef",ref:T,"onUpdate:modelValue":Y[0]||(Y[0]=le=>D.value=le),class:"ch-rename",type:"text",onKeydown:[xl(Et(W,["stop"]),["enter"]),xl(Et(z,["stop"]),["esc"])],onCompositionstart:Y[1]||(Y[1]=(...le)=>p(L)&&p(L)(...le)),onCompositionend:Y[2]||(Y[2]=(...le)=>p(B)&&p(B)(...le)),onBlur:F,onClick:Y[3]||(Y[3]=Et(()=>{},["stop"]))},null,40,Jxe)),[[ri,D.value]]):e.sessionTitle?(b(),me(p(Pn),{key:4,text:e.sessionTitle},{default:ke(()=>[C("span",Qxe,N(e.sessionTitle),1)]),_:1},8,["text"])):te("",!0)]),V(p(gn),{ref_key:"kebabRef",ref:m,class:Re(["ch-act-more",{open:g.value}]),label:p(n)("header.options"),"aria-expanded":g.value,"aria-haspopup":"menu",onClick:Y[4]||(Y[4]=Et(le=>y(le),["stop"]))},{default:ke(()=>[V(p(Ie),{name:"dots-horizontal",size:"sm"})]),_:1},8,["class","label","aria-expanded"]),V(as,{name:"menu-pop"},{default:ke(()=>[g.value?(b(),me(p(Cl),{key:0,ref_key:"menuRef",ref:w,class:"ch-menu",style:Gt(_.value),onClick:Y[5]||(Y[5]=Et(()=>{},["stop"]))},{default:ke(()=>[V(p(hn),{onClick:M},{default:ke(()=>[V(p(Ie),{name:e.copied?"check":"copy",size:"sm"},null,8,["name"]),Ve(" "+N(e.copied?p(n)("header.copied"):p(n)("header.copyAll")),1)]),_:1}),V(p(hn),{onClick:$},{default:ke(()=>[V(p(Ie),{name:"file-text",size:"sm"}),Ve(" "+N(p(n)("header.copyFinalSummary")),1)]),_:1}),e.sessionId?(b(),A(Pe,{key:0},[V(p(hn),{separator:""}),V(p(hn),{onClick:I},{default:ke(()=>[V(p(Ie),{name:S.value?"check":"copy",size:"sm"},null,8,["name"]),Ve(" "+N(S.value?p(n)("header.copied"):p(n)("header.copySessionId")),1)]),_:1}),V(p(hn),{onClick:O},{default:ke(()=>[V(p(Ie),{name:"pencil",size:"sm"}),Ve(" "+N(p(n)("header.renameSession")),1)]),_:1}),V(p(hn),{onClick:U},{default:ke(()=>[V(p(Ie),{name:"git-fork",size:"sm"}),Ve(" "+N(p(n)("header.forkSession")),1)]),_:1}),V(p(hn),{onClick:q},{default:ke(()=>[V(p(Ie),{name:"download",size:"sm"}),Ve(" "+N(p(n)("header.exportSession")),1)]),_:1}),V(p(hn),{onClick:K},{default:ke(()=>[V(p(Ie),{name:"archive",size:"sm"}),Ve(" "+N(p(n)("header.archiveSession")),1)]),_:1})],64)):te("",!0)]),_:1},8,["style"])):te("",!0)]),_:1}),Y[8]||(Y[8]=C("div",{class:"ch-spacer"},null,-1)),e.isGitRepo?(b(),A("button",{key:0,type:"button",class:"ch-git",onClick:Y[6]||(Y[6]=le=>s("openChanges"))},[V(p(Ie),{class:"ch-branch-icon",name:"git-fork",size:"sm"}),C("span",{class:Re(["ch-branch",{"ch-detached":!e.branch}])},N(e.branch||p(n)("header.detached")),3),i.value>0||r.value>0?(b(),A("span",eSe,[i.value>0?(b(),A("span",tSe,"↑"+N(i.value),1)):te("",!0),r.value>0?(b(),A("span",nSe,"↓"+N(r.value),1)):te("",!0)])):te("",!0),u.value?(b(),A("span",oSe,[l.value>0?(b(),A("span",sSe,"+"+N(l.value),1)):te("",!0),a.value>0?(b(),A("span",iSe,"-"+N(a.value),1)):te("",!0)])):te("",!0)])):te("",!0),e.pr?(b(),A("button",{key:1,type:"button",class:Re(["ch-pill ch-pr",f(e.pr.state)]),onClick:Y[7]||(Y[7]=le=>e.pr&&s("openPr",e.pr.url))},[V(p(Ie),{name:"git-pull-request",size:"sm"}),C("span",null,"PR #"+N(e.pr.number)+" · "+N(h(e.pr.state)),1)],2)):te("",!0)],2))}}),lSe=ht(rSe,[["__scopeId","data-v-88f3b874"]]),aSe=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],Gx=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function uSe(e){if(e<=255)return aSe[e];let t=0,n=Gx.length-1;for(;t<=n;){const o=t+n>>1,s=Gx[o];if(es[1]){t=o+1;continue}return s[2]}return"L"}function cSe(e){const t=e.length;if(t===0)return null;const n=new Array(t);let o=!1;for(let u=0;u=55296&&c<=56319&&u+1=56320&&g<=57343&&(d=(c-55296<<10)+(g-56320)+65536,f=2)}const h=uSe(d);(h==="R"||h==="AL"||h==="AN")&&(o=!0);for(let g=0;g=0&&n[c]==="ET";c--)n[c]="EN";for(c=u+1;c0?n[u-1]:l,f=c0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function gSe(e){return/[\r\f]/.test(e)?e.replace(/\r\n/g,` -`).replace(/[\r\f]/g,` -`):e}let _4=null,vSe;function ySe(){return _4===null&&(_4=new Intl.Segmenter(vSe,{granularity:"word"})),_4}const kSe=/\p{Script=Arabic}/u,gu=/\p{M}/u,Q5=/\p{Nd}/u;function Yx(e){return kSe.test(e)}function Xx(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function Tl(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&o<=57343){const s=(n-55296<<10)+(o-56320)+65536;if(Xx(s))return!0;t++;continue}}if(Xx(n))return!0}}return!1}function bSe(e){const t=r0(e);return t!==null&&(e6.has(t)||xc.has(t))}const CSe=new Set([" "," ","⁠","\uFEFF"]),wSe=new Set(["-","‐","–","—"]);function _Se(e){const t=r0(e);return t!==null&&CSe.has(t)}function xSe(e){const t=r0(e);return t!==null&&wSe.has(t)}function GN(e,t){return _Se(e)?!1:t?!(bSe(e)||xSe(e)):!0}const e6=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),H2=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),t6=new Set(["'","’"]),xc=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),SSe=new Set([":",".","،","؛"]),ASe=new Set(["၏"]),MSe=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function TSe(e){if(n6(e))return!0;let t=!1;for(const n of e){if(xc.has(n)||W2(n)){t=!0;continue}if(!(t&&gu.test(n)))return!1}return t}function ESe(e){for(const t of e)if(!e6.has(t)&&!xc.has(t))return!1;return e.length>0}function ISe(e){if(n6(e))return!0;for(const t of e)if(!H2.has(t)&&!t6.has(t)&&!gu.test(t)&&!W2(t))return!1;return e.length>0}function n6(e){let t=!1;for(const n of e)if(!(n==="\\"||gu.test(n))){if(H2.has(n)||xc.has(n)||t6.has(n)){t=!0;continue}return!1}return t}function z2(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function r0(e){if(e.length===0)return null;const t=z2(e,e.length);return e.slice(t)}function LSe(e){for(const t of e)if(!gu.test(t))return t;return null}function $Se(e){for(let t=e.length;t>0;){const n=z2(e,t),o=e.slice(n,t);if(!gu.test(o))return o;t=n}return null}const NSe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function FSe(e,t){for(let n=0;n=t[n]&&e<=t[n+1])return!0;return!1}function W2(e){const t=e.codePointAt(0);return t!==void 0&&FSe(t,NSe)}function RSe(e){const t=$Se(e);return t!==null&&W2(t)}function OSe(e){const t=LSe(e);return t!==null&&Q5.test(t)}function PSe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(gu.test(o)){n--;continue}if(H2.has(o)||t6.has(o)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function DSe(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="—"?e:null}function Jx(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function Qx(e,t){return e&&t!==null&&SSe.has(t)}function BSe(e){const t=r0(e);return t!==null&&ASe.has(t)}function HSe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return/^\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function _y(e){let t=e.length;for(;t>0;){const n=z2(e,t),o=e.slice(n,t);if(MSe.has(o))return!0;if(!xc.has(o))return!1;t=n}return!1}function zSe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` -`)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const WSe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function qr(e){return e.length===1?e[0]:e.join("")}function USe(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),qr(n)}function jSe(e,t,n,o){if(!WSe.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,u=0;for(const c of e){const d=zSe(c,o),f=d==="text"&&t;if(i!==null&&d===i&&f===a){r.push(c),u+=c.length;continue}i!==null&&s.push({text:qr(r),isWordLike:a,kind:i,start:l}),i=d,r=[c],l=n+u,a=f,u+=c.length}return i!==null&&s.push({text:qr(r),isWordLike:a,kind:i,start:l}),s}function xy(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const VSe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function qSe(e,t){const n=e.texts[t];return n.startsWith("www.")?!0:VSe.test(n)&&t+1=e.len||xy(e.kinds[l]))continue;const a=[],u=e.starts[l];let c=l;for(;c0&&(t.push(qr(a)),n.push(!0),o.push("text"),s.push(u),i=c-1)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}const YSe=new Set([":","-","/","×",",",".","+","–","—"]),XSe=/[\p{P}\p{S}\p{Co}]/u,JSe=/\p{Emoji_Presentation}/u,QSe=new Set(["?","֊","-","‐","‒","–","—","…","‼","‽","⁉"]);function eAe(e){return e>=33&&e<=47&&e!==45||e>=58&&e<=64&&e!==63||e>=91&&e<=96||e>=123&&e<=126}function YN(e){const t=e.charCodeAt(0);return t<128?eAe(t):!QSe.has(e)&&!JSe.test(e)&&XSe.test(e)}function eS(e){let t=!1;for(const n of e)if(!gu.test(n)){if(!YN(n))return!1;t=!0}return t}function tAe(e){for(let t=e.length;t>0;){const n=z2(e,t),o=e.slice(n,t);if(gu.test(o)){t=n;continue}return YN(o)||W2(o)}return!1}function nAe(e,t,n,o){const s=!t&&eS(e),i=!o&&eS(n),r=RSe(e),l=(t||r)&&tAe(e);return!s&&!i&&!l||Tl(e)||Tl(n)?!1:(t||s||r)&&(o||i)}function XN(e){for(const t of e)if(Q5.test(t))return!0;return!1}function Fg(e){if(e.length===0)return!1;for(const t of e)if(!(Q5.test(t)||YSe.has(t)))return!1;return!0}function oAe(e){const t=[],n=[],o=[],s=[];for(let i=0;ii+1){t.push(qr(u)),n.push(d),o.push("text"),s.push(e.starts[i]),i=c;continue}}t.push(r),n.push(a),o.push(l),s.push(e.starts[i]),i++}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:s}}function iAe(e){const t=[],n=[],o=[],s=[];for(let i=0;i1;for(let u=0;u0&&a[H]==="text"&&P&&f[H]&&g[H]||S&&s>0&&a[H]==="text"&&ESe($.text)&&f[H]||S&&s>0&&a[H]==="text"&&m[H]?O():S&&s>0&&a[H]==="text"&&$.isWordLike&&D&&w[H]?(O(),l[H]=!0):I!==null&&s>0&&a[H]==="text"&&c[H]===I?d[H]=(d[H]??1)+1:S&&!$.isWordLike&&s>0&&a[H]==="text"&&!f[H]&&(TSe($.text)||$.text==="-"&&l[H])?O():(i[s]=$.text,r[s]=[$.text],l[s]=$.isWordLike,a[s]=$.kind,u[s]=$.start,c[s]=I,d[s]=I===null?0:1,f[s]=P,h[s]=D,g[s]=L,m[s]=B,w[s]=Qx(D,T),s++)}for(let M=0;Mnull);let v=-1;for(let M=s-1;M>=0;M--){const $=i[M];if($.length!==0){if(a[M]==="text"&&!l[M]&&v>=0&&a[v]==="text"&&(ISe($)||$==="-"&&OSe(i[v]))){const S=_[v]??[];S.push($),_[v]=S,u[v]=u[M],i[M]="";continue}v=M}}for(let M=0;M=0&&!GN(t.texts[f-1],n)&&d(f),l<0&&(l=f),a=a||Tl(h);continue}d(f),o.push(h),s.push(t.isWordLike[f]),i.push(g),r.push(t.starts[f])}return d(t.len),{len:o.length,texts:o,isWordLike:s,kinds:i,starts:r}}function dAe(e,t,n="normal",o="normal"){const s=hSe(n),i=s.mode==="pre-wrap"?gSe(e):mSe(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=aAe(i,t,s),l=o==="keep-all"?cAe(i,r,t.breakKeepAllAfterPunctuation):r;return{normalized:i,chunks:uAe(l,s),...l}}let cd=null;const tS=new Map;let dd=null;const fAe=96,pAe=/\p{Emoji_Presentation}/u,hAe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let x4=null;const nS=new Map;function o6(){if(cd!==null)return cd;if(typeof OffscreenCanvas<"u")return cd=new OffscreenCanvas(1,1).getContext("2d"),cd;if(typeof document<"u")return cd=document.createElement("canvas").getContext("2d"),cd;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function mAe(e){let t=tS.get(e);return t||(t=new Map,tS.set(e,t)),t}function za(e,t){let n=t.get(e);return n===void 0&&(n={width:o6().measureText(e).width,containsCJK:Tl(e)},t.set(e,n)),n}function U2(){if(dd!==null)return dd;if(typeof navigator>"u")return dd={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},dd;const e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),o=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return dd={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:o,breakKeepAllAfterPunctuation:!n,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},dd}function gAe(e){const t=e.match(/(\d+(?:\.\d+)?)\s*px/);return t?parseFloat(t[1]):16}function JN(){return x4===null&&(x4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),x4}function vAe(e){return pAe.test(e)||e.includes("️")}function yAe(e){return hAe.test(e)}function kAe(e,t){let n=nS.get(e);if(n!==void 0)return n;const o=o6();o.font=e;const s=o.measureText("😀").width;if(n=0,s>t+.5&&typeof document<"u"&&document.body!==null){const i=document.createElement("span");i.style.font=e,i.style.display="inline-block",i.style.visibility="hidden",i.style.position="absolute",i.textContent="😀",document.body.appendChild(i);const r=i.getBoundingClientRect().width;document.body.removeChild(i),s-r>.5&&(n=s-r)}return nS.set(e,n),n}function bAe(e){let t=0;const n=JN();for(const o of n.segment(e))vAe(o.segment)&&t++;return t}function CAe(e,t){return t.emojiCount===void 0&&(t.emojiCount=bAe(e)),t.emojiCount}function tc(e,t,n){return n===0?t.width:t.width-CAe(e,t)*n}function wAe(e,t,n,o,s){if(t.breakableFitAdvances!==void 0&&t.breakableFitMode===s)return t.breakableFitAdvances;t.breakableFitMode=s;const i=JN(),r=[];for(const c of i.segment(e))r.push(c.segment);if(r.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(s==="sum-graphemes"){const c=[];for(const d of r){const f=za(d,n);c.push(tc(d,f,o))}return t.breakableFitAdvances=c,t.breakableFitAdvances}if(s==="pair-context"||r.length>fAe){const c=[];let d=null,f=0;for(const h of r){const g=za(h,n),m=tc(h,g,o);if(d===null)c.push(m);else{const w=d+h,_=za(w,n);c.push(tc(w,_,o)-f)}d=h,f=m}return t.breakableFitAdvances=c,t.breakableFitAdvances}const l=[];let a="",u=0;for(const c of r){a+=c;const d=za(a,n),f=tc(a,d,o);l.push(f-u),u=f}return t.breakableFitAdvances=l,t.breakableFitAdvances}function _Ae(e,t){const n=o6();n.font=e;const o=mAe(e),s=gAe(e),i=t?kAe(e,s):0;return{cache:o,fontSize:s,emojiCorrection:i}}function xAe(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function QN(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function eF(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function s6(e,t){return t===0?0:e+t}function MAe(e,t){return e.letterSpacing!==0&&e.spacingGraphemeCounts[t]>0?e.letterSpacing:0}function TAe(e,t,n,o,s){const i=t==="tab"?s+MAe(e,n):e.lineEndFitAdvances[n];return s6(o,i)}function oS(e,t,n,o){const s=t==="tab"?0:e.lineEndFitAdvances[n];return s6(o,s)}function sS(e,t,n,o,s){const i=t==="tab"?s:e.lineEndPaintAdvances[n];return s6(o,i)}function EAe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function IAe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function Rg(e,t,n){let o=t;for(;o0)return e.spacingGraphemeCounts[o]>0?e.letterSpacing:0;for(let i=o-1;i>=t;i--){const r=e.kinds[i];if(!(r==="space"||r==="zero-width-break"||r==="hard-break")){if(r==="soft-hyphen"){if(i===o-1)return 0;continue}return i===t&&n>0||e.spacingGraphemeCounts[i]>0?e.letterSpacing:0}}return 0}function $Ae(e,t,n,o,s,i){return t+LAe(e,n,o,s,i)}function NAe(e,t,n){const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r}=e;if(o.length===0)return 0;const a=U2().lineFitEpsilon,u=t+a;let c=0,d=0,f=!1,h=0,g=0,m=0,w=0,_=-1,v=0;function k(){_=-1,v=0}function y(P=m,D=w,T=d){c++,n?.(T,h,g,P,D),d=0,f=!1,k()}function x(P,D){f=!0,h=P,g=0,m=P+1,w=0,d=D}function M(P,D,T){f=!0,h=P,g=D,m=P,w=D+1,d=T}function $(P,D){if(!f){x(P,D);return}d+=D,m=P+1,w=0}function S(P,D){const T=i[P],L=r[P]??null;let B=L===null?-1:Rg(L,0,D+1),H=-1,O=0,F=D;for(;Fu){if(L!==null&&H>D){y(P,H,O),F=H,B=Rg(L,B,F+1),H=-1,O=0;continue}y(),M(P,F,W)}else d+=W,m=P,w=F+1;const z=F+1;L!==null&&L[B]===z&&(H=z,O=d,B++),F++}f&&m===P&&w===T.length&&(m=P+1,w=0)}let I=0;for(;I=o.length));){const P=o[I],D=s[I],T=QN(D);if(!f){P>u&&i[I]!==null?S(I,0):x(I,P),T&&(_=I+1,v=d-P),I++;continue}if(d+P>u){if(T){$(I,P),y(I+1,0,d-P),I++;continue}if(_>=0){if(m>_||m===_&&w>0){y();continue}y(_,0,v);continue}if(P>u&&i[I]!==null){y(),S(I,0),I++;continue}y();continue}$(I,P),T&&(_=I+1,v=d-P),I++}return f&&y(),c}function FAe(e,t,n){if(e.simpleLineWalkFastPath)return NAe(e,t,n);const{widths:o,kinds:s,breakableFitAdvances:i,breakablePreferredBreaks:r,discretionaryHyphenWidth:l,chunks:a}=e;if(o.length===0||a.length===0)return 0;const u=U2(),c=u.lineFitEpsilon,d=t+c;let f=0,h=0,g=!1,m=0,w=0,_=0,v=0,k=-1,y=0,x=0,M=null;function $(){k=-1,y=0,x=0,M=null}function S(){return M==="soft-hyphen"&&k===_&&v===0?x:h}function I(O=_,F=v,W){f++,n!==void 0&&n($Ae(e,W??S(),m,w,O,F),m,w,O,F),h=0,g=!1,$()}function P(O,F){g=!0,m=O,w=0,_=O+1,v=0,h=F}function D(O,F,W){g=!0,m=O,w=F,_=O,v=F+1,h=W}function T(O,F){if(!g){P(O,F);return}h+=F,_=O+1,v=0}function L(O,F,W,z,U,q){if(!F)return;const K=oS(e,O,W,U),ie=sS(e,O,W,U,z);k=W+1,y=h-q+K,x=h-q+ie,M=O}function B(O,F){const W=i[O],z=r[O]??null;let U=z===null?-1:Rg(z,0,F+1),q=-1,K=0,ie=F;for(;ied){if(z!==null&&q>F){I(O,q,K),ie=q,U=Rg(z,U,ie+1),q=-1,K=0;continue}I(),D(O,ie,ne)}else h=Ee,_=O,v=ie+1}const Y=ie+1;z!==null&&z[U]===Y&&(q=Y,K=h,U++),ie++}g&&_===O&&v===W.length&&(_=O+1,v=0)}function H(O){f++,n?.(0,O.startSegmentIndex,0,O.consumedEndSegmentIndex,0),$()}for(let O=0;O=F.endSegmentIndex));){const z=s[W],U=QN(z),q=AAe(e,g,W),K=z==="tab"?SAe(h+q,e.tabStopAdvance):o[W],ie=q+K,ne=TAe(e,z,W,q,K);if(z==="soft-hyphen"){g&&(_=W+1,v=0,k=W+1,y=h+l,x=h+l,M=z),W++;continue}if(!g){ne>d&&i[W]!==null?B(W,0):P(W,K),L(z,U,W,K,q,ie),W++;continue}if(h+ne>d){const le=h+oS(e,z,W,q),Ee=h+sS(e,z,W,q,K);if(M==="soft-hyphen"&&u.preferEarlySoftHyphenBreak&&y<=d){I(k,0,x);continue}if(U&&le<=d){T(W,ie),I(W+1,0,Ee),W++;continue}if(k>=0&&y<=d){if(_>k||_===k&&v>0){I();continue}const de=k;I(de,0,x),W=de;continue}if(ne>d&&i[W]!==null){I(),B(W,0),W++;continue}I();continue}T(W,ie),L(z,U,W,K,q,ie),W++}if(g){const z=k===F.consumedEndSegmentIndex?x:h;I(F.consumedEndSegmentIndex,0,z)}}return f}let S4=null;function i6(){return S4===null&&(S4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),S4}function RAe(e){return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}}function OAe(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function u(d,f,h){o=[d],s=f,i=h,r=_y(d),l=H2.has(d)}function c(d,f){o.push(d),i=i||f;const h=_y(d);d.length===1&&xc.has(d)?r=r||h:r=h,l=!1}for(const d of i6().segment(e)){const f=d.segment,h=Tl(f);if(o.length===0){u(f,d.index,h);continue}if(l||e6.has(f)||xc.has(f)||t.carryCJKAfterClosingQuote&&h&&r){c(f,h);continue}if(!i&&!h){c(f,h);continue}a(),u(f,d.index,h)}return a(),n}function PAe(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(a,u){const c=t[a].start,d=u=0&&!GN(t[a-1].text,n)&&l(a),s<0&&(s=a),i=i||Tl(u.text)}return l(t.length),o}function iS(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=i6();for(const s of o.segment(e))n++;return n}function DAe(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function BAe(e){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(e))return null;const t=[];let n=0;for(const o of i6().segment(e))n++,DAe(o.segment)&&t.push(n);return t.length===0?null:t}function HAe(e,t,n){return t>1?e+(t-1)*n:e}function zAe(e,t,n,o,s){const i=U2(),{cache:r,emojiCorrection:l}=_Ae(t,yAe(e.normalized)),a=tc("-",za("-",r),l)+(s===0?0:s*2),c=tc(" ",za(" ",r),l)*8,d=s!==0;if(e.len===0)return RAe();const f=[],h=[],g=[],m=[];let w=e.chunks.length<=1&&!d;const _=n?[]:null,v=[],k=[],y=[],x=n?[]:null,M=Array.from({length:e.len});function $(D,T,L,B,H,O,F,W,z){H!=="text"&&H!=="space"&&H!=="zero-width-break"&&(w=!1),f.push(T),h.push(L),g.push(B),m.push(H),_?.push(O),v.push(F),k.push(W),d&&y.push(z),x!==null&&x.push(D)}function S(D,T,L,B,H){const O=za(D,r),F=d?iS(D,T):0,W=HAe(tc(D,O,l),F,s),z=T==="space"||T==="preserved-space"||T==="zero-width-break"?0:W,U=z===0?0:z+(F>0?s:0),q=T==="space"||T==="zero-width-break"?0:W;if(H&&B&&D.length>1){let K="sum-graphemes";s!==0?K="segment-prefixes":Fg(D)?K="pair-context":i.preferPrefixWidthsForBreakableRuns&&(K="segment-prefixes");const ie=wAe(D,O,r,l,K),ne=ie===null||o==="keep-all"?null:BAe(D);$(D,W,U,q,T,L,ie,ne,F);return}$(D,W,U,q,T,L,null,null,F)}for(let D=0;D{n>t&&(t=n)}),t}const qAe={key:0,class:"slash-menu",role:"listbox"},KAe=["aria-selected","onMouseenter","onMousedown"],ZAe={class:"slash-name"},GAe={class:"slash-desc"},YAe=tt({__name:"SlashMenu",props:{items:{},activeIndex:{}},emits:["select","hover"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=Z([]);return et(()=>o.activeIndex,r=>{i.value[r]?.scrollIntoView({block:"nearest"})}),(r,l)=>e.items.length>0?(b(),A("div",qAe,[(b(!0),A(Pe,null,pt(e.items,(a,u)=>(b(),A("div",{ref_for:!0,ref:c=>{c&&(i.value[u]=c)},key:`${a.name}-${u}`,class:Re(["slash-item",{active:u===o.activeIndex}]),role:"option","aria-selected":u===o.activeIndex,onMouseenter:c=>s("hover",u),onMousedown:Et(c=>s("select",a),["prevent"])},[C("span",ZAe,N(a.name),1),C("span",GAe,N(a.isSkill?a.desc:p(n)(a.desc)),1)],42,KAe))),128))])):te("",!0)}}),XAe=ht(YAe,[["__scopeId","data-v-fc5ec690"]]),JAe={class:"mention-menu",role:"listbox"},QAe={key:0,class:"mention-state dim"},eMe={key:1,class:"mention-state dim"},tMe=["aria-selected","onMouseenter","onMousedown"],nMe=["innerHTML"],oMe={class:"mention-name"},sMe={class:"mention-path"},iMe=tt({__name:"MentionMenu",props:{items:{},activeIndex:{},loading:{type:Boolean}},emits:["select","hover"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=vd("folder","sm"),r=vd("code","sm"),l=vd("file-text","sm"),a=vd("image","sm"),u=vd("file","sm"),c=new Set(["ts","tsx","js","jsx","mjs","cjs","vue","json","py","go","rs","java","kt","c","h","cpp","cc","hpp","cs","rb","php","swift","sh","bash","zsh","css","scss","less","html","htm","xml","sql","yaml","yml","toml","lua","dart","scala","clj","ex","exs"]),d=new Set(["md","markdown","mdx","txt","rst","adoc","pdf","doc","docx"]),f=new Set(["png","jpg","jpeg","gif","svg","webp","bmp","ico","avif"]);function h(g){const m=g.path;if(m.endsWith("/"))return i;const w=g.name||m.split("/").pop()||m,_=w.lastIndexOf("."),v=_>0?w.slice(_+1).toLowerCase():"";return v?c.has(v)?r:d.has(v)?l:f.has(v)?a:u:u}return(g,m)=>(b(),A("div",JAe,[n.loading?(b(),A("div",QAe,N(p(s)("mention.searching")),1)):n.items.length===0?(b(),A("div",eMe,N(p(s)("mention.noMatch")),1)):(b(!0),A(Pe,{key:2},pt(n.items,(w,_)=>(b(),A("div",{key:w.path,class:Re(["mention-item",{active:_===n.activeIndex}]),role:"option","aria-selected":_===n.activeIndex,onMouseenter:v=>o("hover",_),onMousedown:Et(v=>o("select",w),["prevent"])},[C("span",{class:"mention-icon",innerHTML:h(w),"aria-hidden":"true"},null,8,nMe),C("span",oMe,N(w.name),1),C("span",sMe,N(w.path),1)],42,tMe))),128))]))}}),rMe=ht(iMe,[["__scopeId","data-v-d089b60a"]]),tF=[{name:"/new",desc:"commands.new.desc"},{name:"/clear",desc:"commands.clear.desc"},{name:"/login",desc:"commands.login.desc"},{name:"/plan",desc:"commands.plan.desc"},{name:"/swarm",desc:"commands.swarm.desc",acceptsInput:!0},{name:"/goal",desc:"commands.goal.desc",acceptsInput:!0},{name:"/btw",desc:"commands.btw.desc",acceptsInput:!0},{name:"/auto",desc:"commands.auto.desc"},{name:"/yolo",desc:"commands.yolo.desc"},{name:"/thinking",desc:"commands.thinking.desc"},{name:"/compact",desc:"commands.compact.desc",acceptsInput:!0},{name:"/undo",desc:"commands.undo.desc"},{name:"/fork",desc:"commands.fork.desc"},{name:"/export",desc:"commands.export.desc"},{name:"/status",desc:"commands.status.desc"}];function lMe(e){if(!e.startsWith("/"))return null;const t=e.indexOf(" ");return t===-1?{cmd:e,arg:""}:{cmd:e.slice(0,t),arg:e.slice(t+1)}}const Og="skill:";function aMe(e){return e.startsWith(Og)?e.slice(Og.length):e}function nF(e=[]){const t=e.map(n=>({name:n.source==="builtin"?`/${n.name}`:`/${Og}${n.name}`,desc:n.description,isSkill:!0,acceptsInput:!0}));return[...tF,...t]}function uMe(e,t=tF){const n=e.toLowerCase().trim().replace(/^\//,"");return n===""?t:t.map((o,s)=>{const i=o.name.toLowerCase().replace(/^\//,"");let r=0;return i===n?r=3:i.startsWith(n)?r=2:i.includes(n)&&(r=1),{item:o,index:s,score:r}}).filter(({score:o})=>o>0).sort((o,s)=>o.score!==s.score?s.score-o.score:o.index-s.index).map(({item:o})=>o)}const Pg=100;function cMe(e){const t=kf(cn.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>Pg?n.slice(-Pg):n,s={[e]:o};return Tc(cn.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function dMe(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=Z(cMe(s())),r=R(()=>i.value[s()??""]??[]);let l=-1,a="";function u(_){const v=s();if(l=-1,!v)return;const k=_.trim();if(!k)return;const y=i.value[v]??[];if(y.at(-1)===k)return;const x=[...y,k],M=x.length>Pg?x.slice(-Pg):x;i.value={...i.value,[v]:M},Tc(cn.inputHistory,i.value)}function c(){const _=n.value;return _?(_.selectionStart??0)===0:!1}function d(_){t.value=_,yt(()=>{const v=n.value;if(!v)return;o();const k=_.length;v.setSelectionRange(k,k)})}function f(){const _=r.value;if(_.length!==0){if(l===-1)a=t.value,l=_.length-1;else if(l>0)l-=1;else return;d(_[l])}}function h(){if(l===-1)return;const _=r.value;l<_.length-1?(l+=1,d(_[l])):(l=-1,d(a))}function g(){l=-1}function m(){return l!==-1}function w(){return r.value.length>0}return et(s,()=>{l=-1}),{push:u,caretAtTextStart:c,recallOlder:f,recallNewer:h,resetBrowsing:g,isBrowsing:m,hasHistory:w}}function fMe(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),u=Z([]),c=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(u.value=uMe(h,nF(s())),c.value=0,a.value=u.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const g=n.value;if(!g)return;const m=t.value.length;g.setSelectionRange(m,m),g.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:u,active:c,update:d,select:f}}function pMe(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let u=null;function c(){const h=t.value,g=n.value?.selectionStart??h.length;let m=g-1;for(;m>=0&&!/\s/.test(h[m]);)m--;m++;const w=h.slice(m,g);return w.startsWith("@")?{token:w.slice(1),start:m,end:g}:null}function d(){const h=c(),g=s();if(u!==null&&clearTimeout(u),!h||!g||h.token.length===0){i.value=!1,a.value=!1;return}const m=h.token;u=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;const w=()=>{const _=c();return _!==null&&_.token===m&&i.value};try{const _=await g(m);w()&&(r.value=_)}catch{w()&&(r.value=[])}finally{w()&&(a.value=!1)}},200)}function f(h){const g=c();if(!g)return;const m=t.value;t.value=m.slice(0,g.start)+h.path+m.slice(g.end),i.value=!1,yt(()=>{const w=n.value;if(!w)return;const _=g.start+h.path.length;w.setSelectionRange(_,_),w.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}function hMe(e){const{sessionId:t}=e;function n(u){return li(_b(u))??""}function o(u,c){const d=_b(u);c?Ls(d,c):lr(d)}const s=Z(n(t())),i=Z(null);function r(){const u=i.value;u&&(u.style.height="auto",u.style.height=`${u.scrollHeight}px`)}et(s,u=>{yt(r),o(t(),u)}),et(t,(u,c)=>{u!==c&&(o(c,s.value),s.value=n(u),yt(r))});function l(u){s.value=u,yt(()=>{const c=i.value;if(!c)return;c.focus();const d=u.length;c.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function mMe(e){const{uploadImage:t,sessionId:n,insertFolderPaths:o}=e,s=Z({}),i=R(()=>s.value[n()??""]??[]),r=Z(null),l=Z(null),a=Z(!1);let u=0;function c(){return`att_${++u}`}function d(z,U){s.value={...s.value,[z]:U}}function f(z){if(z.previewUrl!==void 0)try{URL.revokeObjectURL(z.previewUrl)}catch{}}function h(z){return z.startsWith("image/")?"image":z.startsWith("video/")?"video":"file"}async function g(z){const U=t();if(!U)return;const q=n()??"";if(z.length!==0)for(const K of z){const ie=h(K.type),ne=c(),Y=ie==="file"?void 0:URL.createObjectURL(K),le={localId:ne,name:K.name,kind:ie,previewUrl:Y,mediaType:K.type||"application/octet-stream",size:K.size,uploading:!0};d(q,[...s.value[q]??[],le]),U(K,K.name).then(Ee=>{const de=s.value[q]??[];d(q,de.map(he=>he.localId===ne?{...he,uploading:!1,fileId:Ee?.fileId,mediaType:Ee?.mediaType??he.mediaType,error:Ee===null}:he))}).catch(()=>{const Ee=s.value[q]??[];d(q,Ee.map(de=>de.localId===ne?{...de,uploading:!1,error:!0}:de))})}}function m(z){const U=n()??"",q=s.value[U]??[],K=q.find(ie=>ie.localId===z);r.value?.localId===z&&(r.value=null),K&&f(K),d(U,q.filter(ie=>ie.localId!==z))}function w(z){r.value=z}function _(){r.value=null}function v(){l.value?.click()}function k(z){const U=z.target,q=Array.from(U.files??[]);g(q),U.value=""}function y(z){if(!t())return;const U=z.clipboardData;if(!U)return;const q=[],K=new Set,ie=(ne,Y)=>{const le=`${ne.size}:${ne.type}:${Y}`;if(K.has(le))return;K.add(le);const Ee=ne.type.split("/")[1]??"png",de=Y.includes(".")?Y:`paste-${Date.now()}.${Ee}`;q.push(ne instanceof File?ne:new File([ne],de,{type:ne.type}))};for(const ne of Array.from(U.items))if(ne.kind==="file"){const Y=ne.getAsFile();Y&&ie(Y,Y.name||`paste-${Date.now()}.${ne.type.split("/")[1]??"png"}`)}for(const ne of Array.from(U.files))ie(ne,ne.name);q.length!==0&&(z.preventDefault(),g(q))}let x=0;function M(z){!t()||!Array.from(z.dataTransfer?.items??[]).some(q=>q.kind==="file")||(z.preventDefault(),z.stopPropagation(),a.value=!0)}function $(){a.value=!1}function S(z){x=0,a.value=!1;const{files:U,folderPaths:q}=h3(z);q.length>0&&(o?.(q),z.preventDefault(),z.stopPropagation()),t()&&(z.preventDefault(),z.stopPropagation(),g(U))}function I(z){return Array.from(z.dataTransfer?.items??[]).some(U=>U.kind==="file")}function P(z){!t()||!I(z)||(z.preventDefault(),x+=1,a.value=!0)}function D(z){!t()||!I(z)||z.preventDefault()}function T(z){!t()||!I(z)||(x=Math.max(0,x-1),x===0&&(a.value=!1))}function L(z){x=0,a.value=!1;const{files:U,folderPaths:q}=h3(z);q.length>0&&(o?.(q),z.preventDefault()),t()&&(z.preventDefault(),g(U))}function B(){const z=n()??"";for(const U of s.value[z]??[])f(U);d(z,[])}function H(){r.value=null,B()}function O(z,U,q){const K=s.value[z]??[];K.some(ie=>ie.localId===U)&&d(z,K.map(ie=>ie.localId===U?{...ie,...q}:ie))}function F(z){return fetch(z).then(U=>{if(!U.ok)throw new Error(`fetch failed: ${U.status}`);return U.blob()})}function W(z){const U=n()??"";for(const q of s.value[U]??[])f(q);d(U,[]);for(const q of z){const K=c(),ie=/^data:/i.test(q.url),ne=/^blob:/i.test(q.url),Y=q.name??q.kind;if(q.fileId){const le={localId:K,name:Y,kind:q.kind,previewUrl:q.kind==="file"?void 0:q.url,uploading:!1,fileId:q.fileId};d(U,[...s.value[U]??[],le]),q.kind==="image"&&!ie&&!ne&&_t().getFileBlob(q.fileId).then(Ee=>{const de=URL.createObjectURL(Ee);if(!(s.value[U]??[]).some(pe=>pe.localId===K)){URL.revokeObjectURL(de);return}O(U,K,{previewUrl:de})}).catch(()=>{})}else{if(!q.url)continue;const le=t();if(!le)continue;const Ee={localId:K,name:Y,kind:q.kind,previewUrl:q.url,uploading:!0};d(U,[...s.value[U]??[],Ee]),F(q.url).then(de=>{const he=Y.includes(".")?Y:`${Y}.${de.type.split("/")[1]??"bin"}`;return le(de,he)}).then(de=>{if(de===null){const he=s.value[U]??[];d(U,he.filter(pe=>pe.localId!==K));return}O(U,K,{uploading:!1,fileId:de.fileId})}).catch(()=>{const de=s.value[U]??[];d(U,de.filter(he=>he.localId!==K))})}}}return et(n,()=>{r.value=null}),dn(()=>{document.addEventListener("paste",y),document.addEventListener("dragenter",P),document.addEventListener("dragover",D),document.addEventListener("dragleave",T),document.addEventListener("drop",L)}),kn(()=>{document.removeEventListener("paste",y),document.removeEventListener("dragenter",P),document.removeEventListener("dragover",D),document.removeEventListener("dragleave",T),document.removeEventListener("drop",L);for(const z of Object.values(s.value))for(const U of z)f(U);r.value=null}),{attachments:i,previewAttachment:r,fileInputRef:l,isDragOver:a,removeAttachment:m,openAttachmentPreview:w,closeAttachmentPreview:_,openFilePicker:v,handleFileInputChange:k,handleDragOver:M,handleDragLeave:$,handleDrop:S,clearAfterSubmit:B,clearAttachments:H,loadAttachments:W}}const gMe={class:"composer-card"},vMe={key:0,class:"att-strip"},yMe={key:1,class:"att-row"},kMe={key:0,class:"att-more"},bMe={class:"cin-wrap"},CMe={class:"input-row"},wMe=["placeholder","disabled"],_Me=["aria-label"],xMe={class:"toolbar-left"},SMe=["aria-label","onKeydown"],AMe={class:"perm-pill-label"},MMe=["onClick"],TMe={class:"pd-info"},EMe={class:"pd-desc"},IMe={class:"pd-check"},LMe={class:"mode-label"},$Me={key:0,class:"mode-tag"},NMe={key:1,class:"mode-tag"},FMe={key:2,class:"mode-tag"},RMe={class:"mode-row-icon"},OMe={class:"mode-row-info"},PMe={class:"mode-row-name"},DMe={class:"mode-row-desc"},BMe={class:"mode-row-icon"},HMe={class:"mode-row-info"},zMe={class:"mode-row-name"},WMe={class:"mode-row-desc"},UMe={class:"mode-row-icon"},jMe={class:"mode-row-info"},VMe={class:"mode-row-name"},qMe={class:"mode-row-desc"},KMe={key:0,class:"mode-row-actions"},ZMe={class:"toolbar-right"},GMe=["aria-label"],YMe=["aria-expanded"],XMe={class:"mp-name"},JMe={key:0,class:"think-suffix"},QMe={class:"mp-name"},eTe={class:"mp-name"},tTe=["aria-label"],nTe=["aria-label","disabled"],oTe={class:"md-list"},sTe={key:0,class:"md-section"},iTe=["onClick"],rTe={class:"md-check"},lTe={class:"md-name"},aTe={class:"md-provider"},uTe={key:1,class:"md-divider"},cTe={key:2,class:"md-section"},dTe=["onClick"],fTe={class:"md-check"},pTe={class:"md-name"},hTe={key:0,class:"md-divider"},mTe={class:"md-thinking"},gTe={class:"md-name"},vTe={key:0,class:"md-note"},yTe={key:2,class:"md-note"},kTe={class:"md-cache-note"},bTe={class:"md-check md-more-icon"},CTe={class:"md-name"},wTe={key:1,class:"composer-footer"},_Te={class:"drop-card"},rS=36,xTe=tt({__name:"Composer",props:{running:{type:Boolean,default:!1},working:{type:Boolean,default:!1},starting:{type:Boolean,default:!1},sessionId:{},queued:{default:()=>[]},searchFiles:{type:Function,default:void 0},uploadImage:{type:Function,default:void 0},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},goal:{},activationBadges:{},models:{default:()=>[]},authReady:{type:Boolean},managedSignedIn:{type:Boolean},managedMembership:{},starredIds:{default:()=>[]},skills:{default:()=>[]},hideContext:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel","login"],setup(e,{expose:t,emit:n}){const o=e,s=R(()=>o.starting?r("composer.starting"):o.running?r("composer.placeholderRunning"):o.goalMode?r("status.goalPlaceholder"):r("composer.placeholder")),i=n,{t:r,locale:l}=Lt(),{text:a,textareaRef:u,autosize:c,loadForEdit:d,clearDraft:f}=hMe({sessionId:()=>o.sessionId}),h=Z(!1);function g(){h.value=!h.value,yt(()=>{c(),v(),u.value?.focus()})}function m(){h.value&&(h.value=!1,yt(c))}function w(J){if(typeof getComputedStyle>"u")return rS;const we=Number.parseFloat(getComputedStyle(J).minHeight);return Number.isFinite(we)&&we>0?we:rS}const _=Z(!1);function v(){const J=u.value;_.value=!!J&&J.scrollHeight>w(J)}et(a,()=>{yt(v)}),et(()=>o.sessionId,()=>{h.value=!1});const k=dMe({text:a,textareaRef:u,autosize:c,sessionId:()=>o.sessionId}),{open:y,items:x,active:M,update:$,select:S}=fMe({text:a,textareaRef:u,autosize:c,skills:()=>o.skills,emitCommand:J=>i("command",{cmd:J,attachments:[]}),historyPush:J=>k.push(J),clearDraft:f}),{open:I,items:P,active:D,loading:T,update:L,select:B}=pMe({text:a,textareaRef:u,autosize:c,searchFiles:()=>o.searchFiles});function H(){k.resetBrowsing(),$(),L()}function O(J){const we=J.map(Tt=>/\s/.test(Tt)?`"${Tt}"`:Tt).join(" "),$e=u.value,He=a.value,vt=$e&&document.activeElement===$e?$e.selectionStart:He.length,ut=vt>0&&!/\s/.test(He[vt-1])?" ":"",Pt=vt{const Tt=u.value;if(!Tt)return;const ln=vt+ut.length+we.length;Tt.setSelectionRange(ln,ln),Tt.focus(),c()})}const{attachments:F,previewAttachment:W,fileInputRef:z,isDragOver:U,removeAttachment:q,openAttachmentPreview:K,closeAttachmentPreview:ie,openFilePicker:ne,handleFileInputChange:Y,handleDragOver:le,handleDragLeave:Ee,handleDrop:de,clearAfterSubmit:he,clearAttachments:pe,loadAttachments:oe}=mMe({uploadImage:()=>o.uploadImage,sessionId:()=>o.sessionId,insertFolderPaths:O}),ve=J=>J.kind==="image"||J.kind==="video",G=R(()=>F.value.filter(ve)),X=R(()=>F.value.filter(J=>!ve(J))),fe=Z(null),Ce=Z(null),ge=Z(!1);function Q(){const J=fe.value,we=Ce.value;ge.value=J!==null&&we!==null&&we.scrollHeight>J.clientHeight+1}let ee=null;et(fe,J=>{if(ee?.disconnect(),ee=null,J){const we=new ResizeObserver(Q);we.observe(J),ee=we}Q()},{immediate:!0}),et(F,()=>void yt(Q),{deep:!0}),kn(()=>ee?.disconnect());const ce=Z(null);et(()=>[G.value.length,X.value.length],([J,we],[$e,He])=>{J<=$e&&we<=He||yt(()=>{const vt=fe.value;vt&&(J>$e&&ce.value?vt.scrollTop=ce.value.offsetHeight-vt.clientHeight:vt.scrollTop=vt.scrollHeight)})}),dn(()=>{a.value&&yt(()=>{c(),v()})}),kn(()=>{document.removeEventListener("mousedown",Lo),Ht()});function ue(){u.value?.focus({preventScroll:!0})}function Se(J){oe(J)}function Ue(J){return{fileId:J.fileId,kind:J.kind,name:J.name,mediaType:J.mediaType,size:J.size}}const _e=Z(null);function Te(J,we){if(J.kind==="file"){J.fileId!==void 0&&ZN(J.fileId,J.name,J.mediaType);return}_e.value=we??null,K(J)}const st=R(()=>{const J=W.value;return!J||!J.previewUrl?null:{kind:J.kind==="video"?"video":"image",url:J.previewUrl,path:J.name,fileId:J.previewUrl.startsWith("blob:")?void 0:J.fileId}}),Fe=R(()=>!F.value.some(J=>J.uploading)&&(a.value.trim()!==""||F.value.some(J=>!J.error&&J.fileId)));function Oe(){const J=a.value.trim();if(F.value.some(He=>He.uploading))return;const we=F.value.filter(He=>!He.uploading&&!He.error&&He.fileId);if(!J&&we.length===0)return;if(k.push(J),J){const He=lMe(J),vt=He?nF(o.skills).find(ut=>ut.name===He.cmd||ut.name===`/${Og}${He.cmd.slice(1)}`):void 0;if(He&&vt){const ut=He.arg?`${He.cmd} ${He.arg}`:He.cmd,Pt=vt.isSkill===!0;a.value="",f(),y.value=!1,m(),Pt?(W.value=null,_e.value=null,he(),I.value=!1,i("command",{cmd:ut,attachments:we.map(Tt=>Ue(Tt))})):i("command",{cmd:ut,attachments:[]});return}}const $e={text:J,attachments:we.map(He=>Ue(He))};W.value=null,_e.value=null,he(),a.value="",f(),y.value=!1,I.value=!1,m(),i("submit",$e)}function Ye(){if(!o.running||F.value.some(He=>He.uploading))return;const J=a.value.trim(),we=F.value.filter(He=>!He.uploading&&!He.error&&He.fileId);if(!J&&we.length===0&&o.queued.length===0)return;const $e={text:J,attachments:we.map(He=>Ue(He))};he(),k.push(J),a.value="",f(),y.value=!1,I.value=!1,m(),i("steer",$e)}let ft=!1,$t=null;function Ht(){$t!==null&&(clearTimeout($t),$t=null)}function Yt(){Ht(),ft=!0}function _n(){Ht(),$t=setTimeout(()=>{$t=null,ft=!1},0)}function je(J){return ft||J.isComposing||J.keyCode===229}function Ke(J){if(!je(J)){if(J.key==="Escape"){if(at.value){J.preventDefault(),Mn();return}if(tn.value){J.preventDefault(),Do();return}}if(y.value){if(J.key==="ArrowDown"){J.preventDefault(),M.value=(M.value+1)%x.value.length;return}if(J.key==="ArrowUp"){J.preventDefault(),M.value=(M.value-1+x.value.length)%x.value.length;return}if(J.key==="Enter"||J.key==="Tab"){J.preventDefault();const we=x.value[M.value];we&&S(we);return}if(J.key==="Escape"){J.preventDefault(),y.value=!1;return}}if(I.value&&!T.value){if(J.key==="Escape"){J.preventDefault(),I.value=!1;return}if(P.value.length>0){if(J.key==="ArrowDown"){J.preventDefault(),D.value=(D.value+1)%P.value.length;return}if(J.key==="ArrowUp"){J.preventDefault(),D.value=(D.value-1+P.value.length)%P.value.length;return}if(J.key==="Enter"||J.key==="Tab"){J.preventDefault();const we=P.value[D.value];we&&B(we);return}}}if(J.key==="s"&&(J.ctrlKey||J.metaKey)&&!J.shiftKey&&!J.altKey){o.running&&(J.preventDefault(),Ye());return}if(!h.value&&!y.value&&!I.value&&!J.shiftKey&&!J.altKey&&!J.metaKey&&!J.ctrlKey){const we=k.isBrowsing();if(J.key==="ArrowUp"&&k.hasHistory()&&(we||k.caretAtTextStart())){J.preventDefault(),k.recallOlder();return}if(J.key==="ArrowDown"&&we){J.preventDefault(),k.recallNewer();return}}if(J.key==="Enter"&&!J.shiftKey){if(h.value&&!(J.metaKey||J.ctrlKey))return;J.preventDefault(),Oe()}}}const Ze=R(()=>r("composer.send")),zt=R(()=>!!o.uploadImage),at=Z(!1),tn=Z(!1),Wt=Z(!1),fn=Z(null),Sn=Z(null),to=Z(null),An=Z(""),ao=R(()=>{const J={};return An.value&&(J.right=An.value),J}),Kt=R(()=>at.value||tn.value||Wt.value||y.value||I.value);t({loadForEdit:d,loadAttachmentsForEdit:Se,focus:ue,anyPopupOpen:Kt,isEmpty:()=>a.value.trim().length===0&&F.value.length===0});function Po(){at.value=!at.value,at.value?(Tr(),tn.value=!1,zo(),document.addEventListener("click",po,!0)):document.removeEventListener("click",po,!0)}function Mn(){at.value=!1,tn.value||document.removeEventListener("click",po,!0)}function bn(){tn.value=!tn.value,tn.value?(cr(),at.value=!1,zo(),document.addEventListener("click",po,!0)):document.removeEventListener("click",po,!0)}function Do(){tn.value=!1,at.value||document.removeEventListener("click",po,!0)}function po(J){fn.value&&!fn.value.contains(J.target)&&(Mn(),Do())}kn(()=>{document.removeEventListener("click",po,!0)});const At=R(()=>{const J=o.status?.ctxMax??0;return J<=0?0:Math.min(100,Math.max(0,Math.ceil((o.status?.ctxUsed??0)/J*100)))}),qs=R(()=>{const J=Ml(o.status?.ctxUsed??0),we=Ml(o.status?.ctxMax??0);return r("status.ctxTooltip",{used:J,max:we,pct:At.value})}),Bo=R(()=>At.value>=80),To=R(()=>o.models?.find(J=>J.id===o.status?.modelId)),ai=R(()=>$2(To.value)),Tn=R(()=>Jp(To.value)),no=R(()=>bg(To.value,o.thinking)),Ks=R(()=>Tn.value.includes(no.value)?no.value:""),ps=R(()=>X2e(no.value)),ui=R(()=>ai.value==="unsupported"||Tn.value.length<=1),$s=R(()=>{if(!ps.value)return"";const J=(To.value?.supportEfforts?.length??0)>0,we=no.value;return J&&we!=="on"?r("composer.thinkingSuffixEffort",{level:we}):r("composer.thinkingSuffix")});function yo(J){ui.value||i("setThinking",E5(To.value,J))}function oo(J){return J==="on"?r("status.thinkingOn"):J==="off"?r("status.thinkingOff"):oy(J)}const uo=R(()=>Tn.value.map(J=>({value:J,label:oo(J)}))),Xn=R(()=>o.planMode===!0),co=R(()=>o.swarmMode===!0),Qe=R(()=>o.goal?.status??o.activationBadges?.goal?.status??null),it=R(()=>Qe.value!==null&&Qe.value!=="complete"),Ct=R(()=>it.value||o.goalMode===!0),en=R(()=>Qe.value==="active"),yn=R(()=>Qe.value==="paused"||Qe.value==="blocked"),Ho=Z(null),Eo=Z(null),Io=Z({}),Zs=R(()=>Xn.value||co.value||Ct.value);function zo(){Wt.value=!1,document.removeEventListener("mousedown",Lo)}function Lo(J){const we=J.target;Ho.value?.contains(we)||Eo.value?.contains(we)||zo()}function Wo(){if(Wt.value){zo();return}Mn(),Do();const J=Ho.value?.getBoundingClientRect();J&&(Io.value={left:`${Math.round(J.left)}px`,bottom:`${Math.round(window.innerHeight-J.top+8)}px`}),Wt.value=!0,setTimeout(()=>document.addEventListener("mousedown",Lo),0)}const sn=[{mode:"manual",icon:"hand",color:"var(--color-text)",labelKey:"status.permissionManual",descKey:"status.permissionManualDesc"},{mode:"yolo",icon:"shield-question",color:"var(--color-warning)",labelKey:"status.permissionYolo",descKey:"status.permissionYoloDesc"},{mode:"auto",icon:"full-access",color:"var(--color-danger)",labelKey:"status.permissionAuto",descKey:"status.permissionAutoDesc"}],ws=["status.planDesc","status.swarmDesc","status.goalDesc"],Uo=Z(null),Mr=Z(""),Gs=Z(""),Vi=Z("");function Ys(J){const we={};return J&&(we["--composer-menu-desc-width"]=J),we}const jo=R(()=>({...Ys(Mr.value),...Gs.value?{left:Gs.value}:{}})),Vo=R(()=>Ys(Vi.value)),Il=R(()=>({...Io.value,...Vo.value}));function cr(){const J=Sn.value,we=fn.value;if(!J||!we){Gs.value="";return}Gs.value=`${Math.round(J.getBoundingClientRect().left-we.getBoundingClientRect().left)}px`}function Tr(){const J=to.value,we=fn.value;if(!J||!we){An.value="";return}An.value=`${Math.round(we.getBoundingClientRect().right-J.getBoundingClientRect().right)}px`}let ho=null;function ko(J){const we=Number.parseFloat(J);return Number.isFinite(we)?we:0}function qi(J){return`${J.fontStyle||"normal"} ${J.fontWeight||"400"} ${J.fontSize} ${J.fontFamily}`}function gt(J){return J.letterSpacing==="normal"?0:ko(J.letterSpacing)}function Le(J,we){if(!J)return 0;const $e=jAe(J,qi(we),{letterSpacing:gt(we)});return VAe($e)}function Ge(){const J=Uo.value?.querySelector(".pd-desc");if(!J)return;const we=getComputedStyle(J),$e=Math.max(0,...sn.map(vt=>Le(r(vt.descKey),we))),He=Math.max(0,...ws.map(vt=>Le(r(vt),we)));Mr.value=$e>0?`${Math.ceil($e)}px`:"",Vi.value=He>0?`${Math.ceil(He)}px`:""}function Xt(){typeof window>"u"||(ho!==null&&window.cancelAnimationFrame(ho),yt(()=>{ho=window.requestAnimationFrame(()=>{ho=null,Ge()})}))}et(l,Xt,{immediate:!0}),dn(()=>{Xt(),document.fonts?.ready.then(Xt)}),kn(()=>{ho!==null&&(window.cancelAnimationFrame(ho),ho=null)});function hs(J){i("setPermission",J),Do()}const ts=R(()=>sn.find(J=>J.mode===o.status?.permission)),Ll=R(()=>ts.value?r(ts.value.labelKey):""),tl=R(()=>ts.value?.icon??"hand"),Mi=R(()=>To.value?.provider??""),fo=R(()=>!Mi.value||!o.models?.length?[]:o.models.filter(J=>J.provider===Mi.value)),Ki=R(()=>(o.models?.length??0)>0),Er=R(()=>o.authReady===!1&&!Ki.value),ci=R(()=>Er.value&&!(o.managedSignedIn??!1)),$l=R(()=>Er.value&&(o.managedSignedIn??!1)&&o.managedMembership==="free"),qo=R(()=>new Set(o.starredIds??[]));function Ir(J){return qo.value.has(J)}const Xs=R(()=>o.models?.length?o.models.filter(J=>Ir(J.id)&&J.provider!==Mi.value):[]),di=Z(null);et(at,async J=>{if(!J)return;await yt(),(di.value?.querySelector(".md-row.is-current")??di.value?.querySelector(".md-row"))?.focus()});function se(J){if(J.key!=="ArrowDown"&&J.key!=="ArrowUp")return;const we=Array.from(di.value?.querySelectorAll(".md-row:not(:disabled)")??[]);if(!we.length)return;J.preventDefault();const $e=we.indexOf(document.activeElement),He=J.key==="ArrowDown"?($e+1)%we.length:($e-1+we.length)%we.length;we[He]?.focus()}function xe(J){i("selectModel",J),Mn()}return(J,we)=>(b(),A("div",{class:Re(["composer",{"drag-over":p(U),expanded:h.value}]),onDragover:we[19]||(we[19]=(...$e)=>p(le)&&p(le)(...$e)),onDragleave:we[20]||(we[20]=(...$e)=>p(Ee)&&p(Ee)(...$e)),onDrop:we[21]||(we[21]=(...$e)=>p(de)&&p(de)(...$e))},[st.value?(b(),me(UN,{key:0,media:st.value,"origin-img":_e.value,onClose:we[0]||(we[0]=$e=>{_e.value=null,p(ie)()})},null,8,["media","origin-img"])):te("",!0),C("div",gMe,[p(F).length>0?(b(),A("div",vMe,[C("div",{ref_key:"attScrollRef",ref:fe,class:Re(["att-scroll",{"is-overflowing":ge.value}])},[C("div",{ref_key:"attScrollContentRef",ref:Ce,class:"att-scroll-content"},[G.value.length>0?(b(),A("div",{key:0,ref_key:"attMediaRowRef",ref:ce,class:"att-row att-row-media"},[(b(!0),A(Pe,null,pt(G.value,$e=>(b(),me(jN,{key:$e.localId,kind:$e.kind,name:$e.name,url:$e.previewUrl,"file-id":$e.fileId,uploading:$e.uploading,error:$e.error,removable:"","remove-label":p(r)("composer.removeNamed",{name:$e.name}),onActivate:He=>Te($e,He),onRemove:He=>p(q)($e.localId)},null,8,["kind","name","url","file-id","uploading","error","remove-label","onActivate","onRemove"]))),128))],512)):te("",!0),X.value.length>0?(b(),A("div",yMe,[(b(!0),A(Pe,null,pt(X.value,$e=>(b(),me(VN,{key:$e.localId,kind:"file",name:$e.name,"media-type":$e.mediaType,size:$e.size,uploading:$e.uploading,error:$e.error,removable:"","remove-label":p(r)("composer.removeNamed",{name:$e.name}),onActivate:He=>Te($e),onRemove:He=>p(q)($e.localId)},null,8,["name","media-type","size","uploading","error","remove-label","onActivate","onRemove"]))),128))])):te("",!0)],512)],2),ge.value?(b(),A("span",kMe,N(p(r)("composer.attachmentCount",{n:p(F).length})),1)):te("",!0),p(F).length>=2?(b(),me(p(Pn),{key:1,text:p(r)("composer.clearAll")},{default:ke(()=>[V(p(gn),{class:"att-clear",size:"sm",label:p(r)("composer.clearAll"),onClick:p(pe)},{default:ke(()=>[V(p(Ie),{name:"trash"})]),_:1},8,["label","onClick"])]),_:1},8,["text"])):te("",!0)])):te("",!0),C("div",bMe,[p(y)?(b(),me(XAe,{key:0,items:p(x),"active-index":p(M),onSelect:p(S),onHover:we[1]||(we[1]=$e=>M.value=$e)},null,8,["items","active-index","onSelect"])):te("",!0),p(I)?(b(),me(rMe,{key:1,items:p(P),"active-index":p(D),loading:p(T),onSelect:p(B),onHover:we[2]||(we[2]=$e=>D.value=$e)},null,8,["items","active-index","loading","onSelect"])):te("",!0),C("div",CMe,[In(C("textarea",{ref_key:"textareaRef",ref:u,"onUpdate:modelValue":we[3]||(we[3]=$e=>es(a)?a.value=$e:null),class:"ph",placeholder:s.value,disabled:e.starting,autocomplete:"off",spellcheck:"false",rows:"1",onKeydown:Ke,onCompositionstart:Yt,onCompositionend:_n,onInput:H},null,40,wMe),[[ri,p(a)]]),h.value||_.value?(b(),A("button",{key:0,class:"expand-btn",type:"button","aria-label":h.value?p(r)("composer.collapseTitle"):p(r)("composer.expandTitle"),onClick:g},[h.value?(b(),me(p(Ie),{key:0,name:"collapse",size:"sm"})):(b(),me(p(Ie),{key:1,name:"expand",size:"sm"}))],8,_Me)):te("",!0)])]),zt.value?(b(),A("input",{key:1,ref_key:"fileInputRef",ref:z,type:"file",multiple:"",class:"file-input-hidden",onChange:we[4]||(we[4]=(...$e)=>p(Y)&&p(Y)(...$e))},null,544)):te("",!0),C("div",{ref_key:"toolbarRef",ref:fn,class:"toolbar"},[C("div",{ref_key:"menuMeasureRef",ref:Uo,class:"menu-measure","aria-hidden":"true"},[...we[22]||(we[22]=[C("span",{class:"pd-desc"},null,-1)])],512),C("div",xMe,[zt.value?(b(),me(p(gn),{key:0,class:"composer-attach",size:"md",label:p(r)("composer.attachFile"),onClick:p(ne)},{default:ke(()=>[V(p(Ie),{name:"attachment"})]),_:1},8,["label","onClick"])):te("",!0),e.status?(b(),A("span",{key:1,ref_key:"permPillRef",ref:Sn,class:Re(["perm-pill",["perm-"+e.status.permission,{open:tn.value}]]),role:"button",tabindex:"0","aria-label":Ll.value,onClick:Et(bn,["stop"]),onKeydown:[xl(bn,["enter"]),xl(Et(bn,["prevent"]),["space"])]},[V(p(Ie),{class:"perm-pill-icon",name:tl.value,size:"sm"},null,8,["name"]),C("span",AMe,N(Ll.value),1)],42,SMe)):te("",!0),V(as,{name:"composer-menu-pop"},{default:ke(()=>[tn.value&&e.status?(b(),A("div",{key:0,class:"perm-dropdown",style:Gt(jo.value),role:"menu",onClick:we[5]||(we[5]=Et(()=>{},["stop"]))},[(b(),A(Pe,null,pt(sn,$e=>C("button",{key:$e.mode,class:Re(["pd-row",{"is-current":$e.mode===e.status.permission}]),role:"menuitem",onClick:He=>hs($e.mode)},[C("span",{class:"pd-icon",style:Gt({color:$e.color})},[V(p(Ie),{name:$e.icon,size:"sm"},null,8,["name"])],4),C("span",TMe,[C("span",{class:"pd-name",style:Gt({color:$e.color})},N(p(r)($e.labelKey)),5),C("span",EMe,N(p(r)($e.descKey)),1)]),C("span",IMe,[$e.mode===e.status.permission?(b(),me(p(Ie),{key:0,name:"check",size:"sm"})):te("",!0)])],10,MMe)),64))],4)):te("",!0)]),_:1}),e.status?(b(),A("div",{key:2,ref_key:"modesRef",ref:Ho,class:"modes"},[C("button",{type:"button",class:Re(["mode-pill",{on:Zs.value,open:Wt.value}]),onClick:Et(Wo,["stop"])},[C("span",LMe,N(p(r)("status.modesLabel")),1),Xn.value?(b(),A("span",$Me,N(p(r)("status.planLabel")),1)):te("",!0),co.value?(b(),A("span",NMe,N(p(r)("status.swarmLabel")),1)):te("",!0),Ct.value?(b(),A("span",FMe,N(p(r)("status.goalLabel")),1)):te("",!0)],2),V(as,{name:"composer-menu-pop"},{default:ke(()=>[Wt.value?(b(),A("div",{key:0,ref_key:"modesMenuRef",ref:Eo,class:"modes-menu",style:Gt(Il.value),role:"menu"},[C("button",{type:"button",class:Re(["mode-row",{on:Xn.value}]),role:"menuitem",onClick:we[6]||(we[6]=$e=>i("togglePlan"))},[C("span",RMe,[V(p(Ie),{name:"file-edit",size:"sm"})]),C("span",OMe,[C("span",PMe,N(p(r)("status.planLabel")),1),C("span",DMe,N(p(r)("status.planDesc")),1)]),C("span",{class:Re(["mode-switch",{on:Xn.value}])},[...we[23]||(we[23]=[C("span",{class:"mode-knob"},null,-1)])],2)],2),C("button",{type:"button",class:Re(["mode-row",{on:co.value}]),role:"menuitem",onClick:we[7]||(we[7]=$e=>i("toggleSwarm"))},[C("span",BMe,[V(p(Ie),{name:"sparkles",size:"sm"})]),C("span",HMe,[C("span",zMe,N(p(r)("status.swarmLabel")),1),C("span",WMe,N(p(r)("status.swarmDesc")),1)]),C("span",{class:Re(["mode-switch",{on:co.value}])},[...we[24]||(we[24]=[C("span",{class:"mode-knob"},null,-1)])],2)],2),C("div",{class:Re(["mode-row mode-row-goal",{on:it.value||o.goalMode}])},[C("button",{type:"button",class:"mode-row-main",role:"menuitem",onClick:we[8]||(we[8]=$e=>it.value?i("focusGoal"):i("toggleGoal"))},[C("span",UMe,[V(p(Ie),{name:"target",size:"sm"})]),C("span",jMe,[C("span",VMe,N(p(r)("status.goalLabel")),1),C("span",qMe,N(p(r)("status.goalDesc")),1)]),it.value?te("",!0):(b(),A("span",{key:0,class:Re(["mode-switch",{on:o.goalMode}])},[...we[25]||(we[25]=[C("span",{class:"mode-knob"},null,-1)])],2))]),it.value?(b(),A("div",KMe,[en.value?(b(),me(p(Ft),{key:0,size:"sm",variant:"secondary",class:"mode-row-action",onClick:we[9]||(we[9]=$e=>i("controlGoal","pause"))},{default:ke(()=>[V(p(Ie),{name:"pause",size:"sm"}),C("span",null,N(p(r)("status.goalPause")),1)]),_:1})):te("",!0),yn.value?(b(),me(p(Ft),{key:1,size:"sm",variant:"primary",class:"mode-row-action",onClick:we[10]||(we[10]=$e=>i("controlGoal","resume"))},{default:ke(()=>[V(p(Ie),{name:"play",size:"sm"}),C("span",null,N(p(r)("status.goalResume")),1)]),_:1})):te("",!0),V(p(Ft),{size:"sm",variant:"danger-soft",class:"mode-row-action",onClick:we[11]||(we[11]=$e=>i("controlGoal","cancel"))},{default:ke(()=>[V(p(Ie),{name:"close",size:"sm"}),C("span",null,N(p(r)("status.goalCancel")),1)]),_:1})])):te("",!0)],2)],4)):te("",!0)]),_:1})],512)):te("",!0)]),C("div",ZMe,[Bo.value?(b(),A("button",{key:0,class:"compact-chip",onClick:we[12]||(we[12]=Et($e=>i("compact"),["stop"]))},"/compact")):te("",!0),V(p(Pn),{text:qs.value},{default:ke(()=>[e.status&&!e.hideContext?(b(),A("span",{key:0,class:"ctx-group",role:"img",tabindex:"0","aria-label":qs.value},[V(p(sW),{pct:At.value},null,8,["pct"])],8,GMe)):te("",!0)]),_:1},8,["text"]),e.status&&!ci.value&&!$l.value?(b(),A("button",{key:1,ref_key:"modelPillRef",ref:to,type:"button",class:Re(["model-pill",{open:at.value}]),"aria-haspopup":"menu","aria-expanded":at.value,onClick:Et(Po,["stop"])},[C("span",XMe,N(e.status.model),1),$s.value?(b(),A("span",JMe,N($s.value),1)):te("",!0),V(p(Ie),{class:"cv",name:"chevron-down",size:"sm"})],10,YMe)):e.status&&$l.value?(b(),A("button",{key:2,type:"button",class:"model-pill login-pill",onClick:we[13]||(we[13]=Et($e=>p(o0)(),["stop"]))},[V(p(Ie),{name:"music",size:"sm"}),C("span",QMe,N(p(r)("sidebar.upgrade")),1)])):e.status&&ci.value?(b(),A("button",{key:3,type:"button",class:"model-pill login-pill",onClick:we[14]||(we[14]=Et($e=>i("login"),["stop"]))},[V(p(Ie),{name:"log-in",size:"sm"}),C("span",eTe,N(p(r)("login.action")),1)])):te("",!0),e.working?(b(),me(p(Pn),{key:4,text:p(r)("composer.interruptTitle")},{default:ke(()=>[C("button",{class:"stop","aria-label":p(r)("composer.interrupt"),onClick:we[15]||(we[15]=$e=>i("interrupt"))},[V(p(Ie),{name:"stop",size:"sm"})],8,tTe)]),_:1},8,["text"])):te("",!0),C("button",{class:Re(["send",{"is-starting":e.starting}]),"aria-label":Ze.value,disabled:e.starting||!Fe.value,onClick:we[16]||(we[16]=$e=>Oe())},[e.starting?(b(),me(p(Ao),{key:0,size:"sm"})):(b(),me(p(Ie),{key:1,name:"send",size:"sm"}))],10,nTe)]),V(as,{name:"composer-menu-pop"},{default:ke(()=>[at.value&&e.status?(b(),A("div",{key:0,ref_key:"modelDropdownRef",ref:di,class:"model-dropdown",style:Gt(ao.value),role:"menu",onClick:we[18]||(we[18]=Et(()=>{},["stop"])),onKeydown:se},[C("div",oTe,[Xs.value.length>0?(b(),A("div",sTe,N(p(r)("status.starredModels")),1)):te("",!0),(b(!0),A(Pe,null,pt(Xs.value,$e=>(b(),A("button",{key:$e.id,class:Re(["md-row",{"is-current":$e.id===e.status.modelId}]),role:"menuitem",onClick:He=>xe($e.id)},[C("span",rTe,[$e.id===e.status.modelId?(b(),me(p(Ie),{key:0,name:"check",size:"sm"})):te("",!0)]),C("span",lTe,N($e.displayName??$e.model),1),C("span",aTe,N($e.provider),1),V(p(Ie),{class:"md-star",name:"star",size:"sm"})],10,iTe))),128)),Xs.value.length>0?(b(),A("div",uTe)):te("",!0),fo.value.length>0?(b(),A("div",cTe,N(Mi.value),1)):te("",!0),(b(!0),A(Pe,null,pt(fo.value,$e=>(b(),A("button",{key:$e.id,class:Re(["md-row",{"is-current":$e.id===e.status.modelId}]),role:"menuitem",onClick:He=>xe($e.id)},[C("span",fTe,[$e.id===e.status.modelId?(b(),me(p(Ie),{key:0,name:"check",size:"sm"})):te("",!0)]),C("span",pTe,N($e.displayName??$e.model),1),Ir($e.id)?(b(),me(p(Ie),{key:0,class:"md-star",name:"star",size:"sm"})):te("",!0)],10,dTe))),128))]),fo.value.length>0?(b(),A("div",hTe)):te("",!0),C("div",mTe,[C("span",gTe,N(p(r)("status.thinkingLabel")),1),ai.value==="unsupported"?(b(),A("span",vTe,N(p(r)("status.modeNotSupported")),1)):Tn.value.length>1?(b(),me(p(bi),{key:1,"model-value":Ks.value,options:uo.value,size:"xs","onUpdate:modelValue":yo},null,8,["model-value","options"])):(b(),A("span",yTe,N(oo(Tn.value[0]??no.value)),1))]),we[26]||(we[26]=C("div",{class:"md-divider"},null,-1)),C("div",kTe,N(p(r)("status.cacheNote")),1),we[27]||(we[27]=C("div",{class:"md-divider"},null,-1)),C("button",{class:"md-row md-row-more",role:"menuitem",onClick:we[17]||(we[17]=$e=>{Mn(),i("pickModel")})},[C("span",bTe,[V(p(Ie),{name:"list",size:"sm"})]),C("span",CTe,N(p(r)("status.moreModels")),1),V(p(Ie),{class:"md-more-arrow",name:"chevron-right",size:"sm"})])],36)):te("",!0)]),_:1})],512)]),J.$slots.footer?(b(),A("div",wTe,[Cn(J.$slots,"footer",{},void 0,!0)])):te("",!0),C("div",{class:Re(["drop-overlay",{show:p(U)}]),"aria-hidden":"true"},[C("div",_Te,[V(p(Ie),{name:"file-plus",size:"lg"}),C("span",null,N(p(r)("composer.dropToAttach")),1)])],2)],34))}}),oF=ht(xTe,[["__scopeId","data-v-fe3fe36b"]]),STe={class:"goal-panel"},ATe={class:"goal-full"},MTe={key:0,class:"goal-criterion"},TTe={class:"goal-criterion-label"},ETe=tt({__name:"GoalPanel",props:{goal:{}},setup(e){const{t}=Lt();return(n,o)=>(b(),A("div",STe,[C("div",ATe,N(e.goal.objective),1),e.goal.completionCriterion?(b(),A("div",MTe,[C("span",TTe,[V(p(Ie),{name:"check-list",size:"sm"}),Ve(" "+N(p(t)("status.goalDoneWhen")),1)]),C("p",null,N(e.goal.completionCriterion),1)])):te("",!0)]))}}),ITe=ht(ETe,[["__scopeId","data-v-ec169c9d"]]),LTe={key:0,class:"qh-chip"},$Te={class:"qtitle"},NTe={class:"qbody"},FTe={class:"qopts"},RTe=["onClick"],OTe={class:"qopt-key"},PTe={class:"qopt-text"},DTe={class:"qopt-label"},BTe={key:0,class:"qopt-desc"},HTe={class:"qopt-label"},zTe=["placeholder"],WTe={class:"qfoot"},UTe={class:"qbtns"},jTe={class:"qhint"},VTe=tt({__name:"QuestionCard",props:{question:{},busyKind:{}},emits:["answer","dismiss"],setup(e,{emit:t}){const n=e,{t:o}=Lt(),s=t,i=Z(0),r=Z(!1);function l(){r.value&&(r.value=!1)}const a=R(()=>n.question.questions[i.value]),u=R(()=>n.question.questions.length);function c(){i.value>0&&i.value--}function d(){i.value0:q.kind==="multiWithOther"?q.optionIds.length>0||q.otherText.trim().length>0:q.kind==="other"?q.text.trim().length>0:!0:!1}function h(){return f(a.value.id)}const g=Z({});function m(U){return U.recommended===!0?!0:/\b(?:recommended|recommend)\b|推荐/.test(`${U.label} ${U.description??""}`.toLowerCase())}function w(){const U={...g.value};let q=!1;for(const K of n.question.questions){if(U[K.id])continue;const ie=K.options.filter(m);ie.length!==0&&(U[K.id]=K.multiSelect?{kind:"multi",optionIds:ie.map(ne=>ne.id)}:{kind:"single",optionId:ie[0].id},q=!0)}q&&(g.value=U)}et(()=>n.question.questionId,()=>{i.value=0,r.value=!1,g.value={},k.value={}}),et(()=>n.question,()=>{i.value>=n.question.questions.length&&(i.value=0),w()},{immediate:!0,deep:!0});function _(U,q){const K=g.value[U];if(K&&K.kind==="single"&&K.optionId===q){const ie={...g.value};delete ie[U],g.value=ie}else g.value={...g.value,[U]:{kind:"single",optionId:q}}}function v(U,q){const K=g.value[U],ie=K&&(K.kind==="multi"||K.kind==="multiWithOther")?K.kind==="multi"?[...K.optionIds]:[...K.optionIds]:[],ne=ie.indexOf(q);ne>=0?ie.splice(ne,1):ie.push(q);const Y=g.value[U],le=Y&&Y.kind==="multiWithOther"?Y.otherText:"";le?g.value={...g.value,[U]:{kind:"multiWithOther",optionIds:ie,otherText:le}}:g.value={...g.value,[U]:{kind:"multi",optionIds:ie}}}const k=Z({}),y=Z(null);function x(U){const q=n.question.questions.find(ie=>ie.id===U),K=k.value[U]??"";if(q.multiSelect){const ie=g.value[U],ne=ie&&(ie.kind==="multi"||ie.kind==="multiWithOther")?ie.kind==="multi"?[...ie.optionIds]:[...ie.optionIds]:[];g.value={...g.value,[U]:{kind:"multiWithOther",optionIds:ne,otherText:K}}}else g.value={...g.value,[U]:{kind:"other",text:K}}}function M(U){x(U),yt(()=>y.value?.focus())}function $(U,q){const K=g.value[U];return K?K.kind==="single"?K.optionId===q:K.kind==="multi"||K.kind==="multiWithOther"?K.optionIds.includes(q):!1:!1}function S(U){const q=g.value[U];return!!(q&&(q.kind==="other"||q.kind==="multiWithOther"))}function I(){return n.question.questions.every(U=>f(U.id))}const P=R(()=>n.busyKind==="answer"),D=R(()=>n.busyKind==="dismiss"),T=R(()=>!!n.busyKind);function L(){if(T.value||!I())return;const U={answers:g.value,method:"click"};s("answer",n.question.questionId,U)}function B(){T.value||s("dismiss",n.question.questionId)}const H=Z(0);et([i,()=>n.question.questionId],()=>{H.value=0});const{handleCompositionStart:O,handleCompositionEnd:F,isComposingKeyEvent:W}=Sr();function z(U){const q=(document.activeElement?.tagName??"").toLowerCase(),K=q==="input"||q==="textarea";if(U.metaKey||U.ctrlKey||U.altKey||T.value||W(U)||ki.value>0)return;if(U.key==="Enter"){if(U.preventDefault(),r.value)return;i.value0||U.defaultPrevented)return;U.preventDefault(),B();return}if(r.value)return;if(U.key==="ArrowDown"||U.key==="ArrowUp"){const ne=a.value,Y=ne.options.length+(ne.allowOther?1:0);if(Y===0)return;U.preventDefault();const le=U.key==="ArrowDown"?1:-1,Ee=Math.min(Y-1,Math.max(0,H.value+le));if(Ee===H.value)return;H.value=Ee;const de=ne.options[H.value];de?ne.multiSelect||_(ne.id,de.id):ne.allowOther&&!ne.multiSelect&&x(ne.id);return}if(U.key===" "&&a.value.multiSelect){U.preventDefault();const ne=a.value,Y=ne.options[H.value];Y?v(ne.id,Y.id):ne.allowOther&&x(ne.id);return}const ie=parseInt(U.key,10);if(!isNaN(ie)&&ie>=1&&ie<=9){U.preventDefault();const ne=a.value,Y=ie-1,le=ne.options[Y];le&&(H.value=Y,ne.multiSelect?v(ne.id,le.id):_(ne.id,le.id))}}return dn(()=>document.addEventListener("keydown",z)),kn(()=>document.removeEventListener("keydown",z)),(U,q)=>(b(),A("div",{class:Re(["qcard",{minimized:r.value}])},[C("div",{class:Re(["qh",{clickable:r.value}]),onClick:l},[u.value>1?(b(),A("span",LTe,N(i.value+1),1)):te("",!0),C("span",$Te,N(a.value.question),1),V(p(gn),{class:"qmin",size:"sm",label:r.value?p(o)("question.expand"):p(o)("question.minimize"),onClick:q[0]||(q[0]=Et(K=>r.value=!r.value,["stop"]))},{default:ke(()=>[r.value?(b(),me(p(Ie),{key:0,name:"chevron-up",size:"md"})):(b(),me(p(Ie),{key:1,name:"minus",size:"md"}))]),_:1},8,["label"]),V(p(gn),{class:"qclose",size:"sm",label:p(o)("question.dismiss"),disabled:T.value,onClick:Et(B,["stop"])},{default:ke(()=>[V(p(Ie),{name:"close",size:"md"})]),_:1},8,["label","disabled"])],2),r.value?te("",!0):(b(),A(Pe,{key:0},[C("div",NTe,[a.value.body?(b(),me(p(Ic),{key:0,text:a.value.body,class:"qmdbody"},null,8,["text"])):te("",!0),C("div",FTe,[(b(!0),A(Pe,null,pt(a.value.options,(K,ie)=>(b(),A("label",{key:K.id,class:Re(["qopt",{selected:$(a.value.id,K.id),highlighted:a.value.multiSelect&&ie===H.value}]),onClick:Et(ne=>{H.value=ie,a.value.multiSelect?v(a.value.id,K.id):_(a.value.id,K.id)},["prevent"])},[C("span",OTe,N(ie+1),1),C("span",{class:Re(["qopt-glyph",a.value.multiSelect?"chk":"rad"])},null,2),C("span",PTe,[C("span",DTe,N(K.label),1),K.description?(b(),A("span",BTe,N(K.description),1)):te("",!0)])],10,RTe))),128)),a.value.allowOther?(b(),A("label",{key:0,class:Re(["qopt",{selected:S(a.value.id),highlighted:a.value.multiSelect&&H.value===a.value.options.length}]),onClick:q[6]||(q[6]=Et(K=>{H.value=a.value.options.length,M(a.value.id)},["prevent"]))},[q[7]||(q[7]=C("span",{class:"qopt-key"},null,-1)),C("span",{class:Re(["qopt-glyph",a.value.multiSelect?"chk":"rad"])},null,2),C("span",HTe,N(a.value.otherLabel??p(o)("question.otherDefault")),1),In(C("input",{ref_key:"otherInputEl",ref:y,"onUpdate:modelValue":q[1]||(q[1]=K=>k.value[a.value.id]=K),class:"other-input",type:"text",placeholder:a.value.otherLabel??p(o)("question.otherDefault"),onInput:q[2]||(q[2]=K=>x(a.value.id)),onFocus:q[3]||(q[3]=K=>x(a.value.id)),onCompositionstart:q[4]||(q[4]=(...K)=>p(O)&&p(O)(...K)),onCompositionend:q[5]||(q[5]=(...K)=>p(F)&&p(F)(...K))},null,40,zTe),[[ri,k.value[a.value.id]]])],2)):te("",!0)])]),C("div",WTe,[C("div",UTe,[i.value[Ve(N(p(o)("question.nextQuestion")),1)]),_:1},8,["disabled"])):(b(),me(p(Ft),{key:1,class:"qmain",size:"md",variant:"primary",disabled:!I(),loading:P.value,onClick:L},{default:ke(()=>[Ve(N(p(o)("question.submit")),1)]),_:1},8,["disabled","loading"])),u.value>1?(b(),me(p(Ft),{key:2,size:"md",variant:"ghost",disabled:i.value===0||T.value,onClick:c},{default:ke(()=>[Ve(N(p(o)("question.back")),1)]),_:1},8,["disabled"])):te("",!0),V(p(Ft),{size:"md",variant:"ghost",loading:D.value,disabled:T.value,onClick:B},{default:ke(()=>[Ve(N(p(o)("question.dismiss")),1)]),_:1},8,["loading","disabled"])]),C("span",jTe,N(p(o)("question.hint")),1)])],64))],2))}}),qTe=ht(VTe,[["__scopeId","data-v-0781cb78"]]),KTe={class:"akind"},ZTe={key:1,class:"apeek"},GTe={class:"ab"},YTe=["title"],XTe={class:"code-path"},JTe={key:2,class:"body-shell"},QTe={class:"shell-cmd"},eEe={key:0,class:"shell-cwd"},tEe={key:1,class:"shell-danger"},nEe={class:"code-path"},oEe={key:4,class:"body-chip"},sEe={class:"chip-label"},iEe={class:"chip-value"},rEe={key:0,class:"chip-detail"},lEe={key:5,class:"body-chip"},aEe={key:0,class:"chip-label"},uEe={class:"chip-value"},cEe={key:6,class:"body-chip"},dEe={class:"chip-label"},fEe={class:"chip-value"},pEe={key:0,class:"chip-detail"},hEe={key:7,class:"body-chip"},mEe={class:"chip-label"},gEe={class:"chip-value"},vEe={key:0,class:"chip-detail"},yEe={key:8,class:"body-todo"},kEe={class:"todo-glyph"},bEe={key:0,class:"plan-opts"},CEe=["disabled","onClick"],wEe={class:"popt-key"},_Ee={class:"popt-text"},xEe={class:"popt-label"},SEe={key:0,class:"popt-desc"},AEe={key:10,class:"body-generic"},MEe={class:"gen-text"},TEe={key:11,class:"feedback-wrap"},EEe=["placeholder"],IEe={class:"feedback-hint"},LEe={class:"af"},$Ee={class:"abtns"},NEe={key:0,class:"knum"},FEe={key:0,class:"knum"},REe=tt({__name:"ApprovalCard",props:{block:{},agentName:{},busy:{type:Boolean},openFile:{type:Function}},emits:["decide"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>{const K=n.block;return K.kind!=="plan_review"?null:{plan:K.plan,path:K.path,options:K.options??[]}}),r=Z(!1),l=Z(null),a=Z(!1);function u(){a.value=(l.value?.scrollTop??0)>0}function c(K){a.value=K.target.scrollTop>0}const d=Z(!1),f=R(()=>{const K=n.block.kind;return K==="plan_review"||K==="diff"||K==="file"});function h(){r.value&&(r.value=!1)}const g=["shell","diff","file","fileop","url","search","invocation","todo","plan_review","generic"];function m(){return g.includes(n.block.kind)?n.block.kind:"generic"}function w(){return s(`approval.title.${m()}`)}const _=R(()=>{const K=n.block;switch(K.kind){case"diff":case"file":case"fileop":return K.path;case"shell":return K.command;case"url":return K.url;case"search":return K.query;case"invocation":return K.name;case"generic":return K.summary;default:return""}}),v=Z(!1),k=Z(""),y=Z(null);function x(){n.busy||(v.value=!0,k.value="",setTimeout(()=>y.value?.focus(),0))}function M(){if(n.busy)return;const K=k.value.trim();i.value?L("feedback",{decision:"rejected",selectedLabel:"Revise",feedback:K||void 0}):L("feedback",{decision:"rejected",feedback:K||void 0}),v.value=!1,k.value=""}function $(){n.busy||(v.value=!1,k.value="")}const{handleCompositionStart:S,handleCompositionEnd:I,isComposingKeyEvent:P}=Sr();function D(K){P(K)||(K.key==="Enter"&&!K.shiftKey?(K.preventDefault(),M()):K.key==="Escape"&&(K.preventDefault(),$()))}const T=Z(null);et(()=>n.busy,K=>{K||(T.value=null)});function L(K,ie){n.busy||(T.value=K,o("decide",ie))}function B(){L("approve",{decision:"approved"})}function H(){L("approveSession",{decision:"approved",scope:"session"})}function O(){L("reject",{decision:"rejected"})}function F(){L("approvePlan",{decision:"approved"})}function W(K){L(`option:${K}`,{decision:"approved",selectedLabel:K})}function z(){n.busy||x()}function U(){L("rejectAndExit",{decision:"rejected",selectedLabel:"Reject and Exit"})}function q(K){const ie=(document.activeElement?.tagName??"").toLowerCase();if(ie==="input"||ie==="textarea"||K.metaKey||K.ctrlKey||K.altKey||ki.value>0||K.defaultPrevented)return;if(v.value){K.key==="Escape"&&(K.preventDefault(),$());return}if(n.busy||r.value)return;const ne=i.value;if(ne){if(ne.options.length===0){K.key==="1"?(K.preventDefault(),F()):K.key==="2"?(K.preventDefault(),z()):K.key==="3"&&(K.preventDefault(),U());return}K.key==="1"&&ne.options[0]?(K.preventDefault(),W(ne.options[0].label)):K.key==="2"&&ne.options[1]?(K.preventDefault(),W(ne.options[1].label)):K.key==="3"&&ne.options[2]&&(K.preventDefault(),W(ne.options[2].label));return}K.key==="1"?(K.preventDefault(),B()):K.key==="2"?(K.preventDefault(),H()):K.key==="3"?(K.preventDefault(),O()):K.key==="4"&&(K.preventDefault(),x())}return dn(()=>document.addEventListener("keydown",q)),kn(()=>document.removeEventListener("keydown",q)),Dp(u),(K,ie)=>(b(),A("div",{class:Re(["appr",{minimized:r.value}])},[C("div",{class:Re(["ah",{clickable:r.value}]),onClick:h},[C("span",KTe,N(w()),1),e.agentName&&!r.value?(b(),me(p(Vr),{key:0,variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(p(s)("approval.subagentBadge",{name:e.agentName})),1)]),_:1})):te("",!0),r.value&&_.value?(b(),A("span",ZTe,N(_.value),1)):te("",!0),f.value&&!r.value?(b(),me(p(gn),{key:2,class:"aexpand",size:"sm",label:d.value?p(s)("approval.collapsePlan"):p(s)("approval.expandPlan"),onClick:ie[0]||(ie[0]=ne=>d.value=!d.value)},{default:ke(()=>[V(p(Ie),{name:d.value?"collapse":"expand",size:"md"},null,8,["name"])]),_:1},8,["label"])):te("",!0),V(p(gn),{class:"amin",size:"sm",label:r.value?p(s)("question.expand"):p(s)("question.minimize"),onClick:ie[1]||(ie[1]=Et(ne=>r.value=!r.value,["stop"]))},{default:ke(()=>[r.value?(b(),me(p(Ie),{key:0,name:"chevron-up",size:"md"})):(b(),me(p(Ie),{key:1,name:"minus",size:"md"}))]),_:1},8,["label"])],2),r.value?te("",!0):(b(),A(Pe,{key:0},[C("div",GTe,[e.block.kind==="plan_review"&&e.block.path?(b(),A("button",{key:0,type:"button",class:"plan-path",title:e.block.path,onClick:ie[2]||(ie[2]=ne=>n.openFile?.({path:e.block.path,content:e.block.plan}))},N(e.block.path),9,YTe)):te("",!0),e.block.kind==="diff"?(b(),A("div",{key:1,class:Re(["body-code",{expanded:d.value}])},[C("div",XTe,N(e.block.path),1),e.block.diff.length>0?(b(),me(Ur,{key:0,lines:e.block.diff,path:e.block.path},null,8,["lines","path"])):te("",!0)],2)):e.block.kind==="shell"?(b(),A("div",JTe,[C("div",QTe,[ie[6]||(ie[6]=C("span",{class:"shell-dollar"},"$",-1)),Ve(" "+N(e.block.command),1)]),e.block.cwd?(b(),A("div",eEe,"cwd: "+N(e.block.cwd),1)):te("",!0),e.block.danger?(b(),A("div",tEe,[V(p(Ie),{name:"alert-triangle",size:"sm",class:"shell-danger-ic"}),C("span",null,N(p(s)("approval.danger",{detail:e.block.danger})),1)])):te("",!0)])):e.block.kind==="file"?(b(),A("div",{key:3,class:Re(["body-code",{expanded:d.value}])},[C("div",nEe,N(e.block.path),1),V(Ur,{code:e.block.content,path:e.block.path},null,8,["code","path"])],2)):e.block.kind==="fileop"?(b(),A("div",oEe,[C("span",sEe,N(e.block.op),1),C("span",iEe,N(e.block.path),1),e.block.detail?(b(),A("span",rEe,N(e.block.detail),1)):te("",!0)])):e.block.kind==="url"?(b(),A("div",lEe,[e.block.method?(b(),A("span",aEe,N(e.block.method),1)):te("",!0),C("span",uEe,N(e.block.url),1)])):e.block.kind==="search"?(b(),A("div",cEe,[C("span",dEe,N(p(s)("approval.searchQueryLabel")),1),C("span",fEe,N(e.block.query),1),e.block.scope?(b(),A("span",pEe,N(p(s)("approval.searchScope",{scope:e.block.scope})),1)):te("",!0)])):e.block.kind==="invocation"?(b(),A("div",hEe,[C("span",mEe,N(e.block.kind2),1),C("span",gEe,N(e.block.name),1),e.block.description?(b(),A("span",vEe,N(e.block.description),1)):te("",!0)])):e.block.kind==="todo"?(b(),A("div",yEe,[(b(!0),A(Pe,null,pt(e.block.items,(ne,Y)=>(b(),A("div",{key:Y,class:"todo-item"},[C("span",kEe,N(ne.status==="done"||ne.status==="completed"?"✓":"○"),1),C("span",{class:Re(["todo-title",{"todo-done":ne.status==="done"||ne.status==="completed"}])},N(ne.title),3)]))),128))])):e.block.kind==="plan_review"?(b(),A("div",{key:9,class:Re(["body-plan-wrap",{scrolled:a.value}])},[C("div",{ref_key:"planBodyEl",ref:l,class:Re(["body-plan",{expanded:d.value}]),onScroll:c},[V(p(Ic),{text:e.block.plan,"open-file":n.openFile},null,8,["text","open-file"])],34),i.value&&i.value.options.length>0?(b(),A("div",bEe,[(b(!0),A(Pe,null,pt(i.value.options,(ne,Y)=>(b(),A("button",{key:Y,type:"button",class:"popt",disabled:e.busy,onClick:le=>W(ne.label)},[C("span",wEe,N(Y+1),1),C("span",_Ee,[C("span",xEe,N(ne.label),1),ne.description?(b(),A("span",SEe,N(ne.description),1)):te("",!0)]),T.value===`option:${ne.label}`?(b(),me(p(Ao),{key:0,size:"sm",class:"popt-spin"})):te("",!0)],8,CEe))),128))])):te("",!0)],2)):(b(),A("div",AEe,[C("span",MEe,N(e.block.summary),1)])),v.value?(b(),A("div",TEe,[In(C("textarea",{ref_key:"feedbackRef",ref:y,"onUpdate:modelValue":ie[3]||(ie[3]=ne=>k.value=ne),class:"feedback-ta",placeholder:p(s)("approval.feedbackPlaceholder"),rows:"2",onKeydown:D,onCompositionstart:ie[4]||(ie[4]=(...ne)=>p(S)&&p(S)(...ne)),onCompositionend:ie[5]||(ie[5]=(...ne)=>p(I)&&p(I)(...ne))},null,40,EEe),[[ri,k.value]]),C("div",IEe,N(p(s)("approval.feedbackHint")),1)])):te("",!0)]),C("div",LEe,[C("div",$Ee,[v.value?(b(),A(Pe,{key:0},[V(p(Ft),{size:"md",variant:"danger-soft",loading:T.value==="feedback",disabled:e.busy,onClick:M},{default:ke(()=>[Ve(N(p(s)("approval.feedbackSubmit")),1)]),_:1},8,["loading","disabled"]),V(p(Ft),{size:"md",variant:"ghost",disabled:e.busy,onClick:$},{default:ke(()=>[Ve(N(p(s)("approval.feedbackCancel")),1)]),_:1},8,["disabled"])],64)):i.value?(b(),A(Pe,{key:1},[i.value.options.length===0?(b(),me(p(Ft),{key:0,class:"amain",size:"md",variant:"primary",loading:T.value==="approvePlan",disabled:e.busy,onClick:F},{default:ke(()=>[ie[7]||(ie[7]=C("span",{class:"knum"},"1",-1)),Ve(N(p(s)("approval.approvePlan")),1)]),_:1},8,["loading","disabled"])):te("",!0),V(p(Ft),{size:"md",variant:"ghost",disabled:e.busy,onClick:z},{default:ke(()=>[i.value.options.length===0?(b(),A("span",NEe,"2")):te("",!0),Ve(N(p(s)("approval.revise")),1)]),_:1},8,["disabled"]),V(p(Ft),{size:"md",variant:"ghost",loading:T.value==="rejectAndExit",disabled:e.busy,onClick:U},{default:ke(()=>[i.value.options.length===0?(b(),A("span",FEe,"3")):te("",!0),Ve(N(p(s)("approval.rejectAndExit")),1)]),_:1},8,["loading","disabled"])],64)):(b(),A(Pe,{key:2},[V(p(Ft),{class:"amain",size:"md",variant:"primary",loading:T.value==="approve",disabled:e.busy,onClick:B},{default:ke(()=>[ie[8]||(ie[8]=C("span",{class:"knum"},"1",-1)),Ve(N(p(s)("approval.approve")),1)]),_:1},8,["loading","disabled"]),V(p(Ft),{size:"md",variant:"ghost",loading:T.value==="approveSession",disabled:e.busy,onClick:H},{default:ke(()=>[ie[9]||(ie[9]=C("span",{class:"knum"},"2",-1)),Ve(N(p(s)("approval.approveSession")),1)]),_:1},8,["loading","disabled"]),V(p(Ft),{size:"md",variant:"ghost",loading:T.value==="reject",disabled:e.busy,onClick:O},{default:ke(()=>[ie[10]||(ie[10]=C("span",{class:"knum"},"3",-1)),Ve(N(p(s)("approval.reject")),1)]),_:1},8,["loading","disabled"]),V(p(Ft),{size:"md",variant:"ghost",disabled:e.busy,onClick:x},{default:ke(()=>[ie[11]||(ie[11]=C("span",{class:"knum"},"4",-1)),Ve(N(p(s)("approval.feedback")),1)]),_:1},8,["disabled"])],64))])])],64))],2))}}),OEe=ht(REe,[["__scopeId","data-v-a72de036"]]),PEe={class:"taskspane"},DEe={class:"tp-head"},BEe={class:"tp-title"},HEe={class:"tp-count"},zEe={class:"tp-list"},WEe={key:0,class:"tp-empty"},UEe=["role","onClick"],jEe={class:"tp-name"},VEe={key:0,class:"tp-model"},qEe={key:1,class:"tp-model"},KEe={class:"tp-time"},ZEe=["onClick"],GEe={key:0,class:"tp-detail"},YEe={key:0,class:"tp-codebox"},XEe=["onClick"],JEe={class:"tp-pre"},QEe={class:"tp-cmd"},eIe={key:1,class:"tp-codebox"},tIe=["onClick"],nIe={class:"tp-pre"},oIe=tt({__name:"TasksPane",props:{tasks:{}},emits:["cancel","open"],setup(e,{emit:t}){const n=t,{t:o}=Lt(),s=Jo(new Set),i=Jo(new Set),r=Jo(new Set);function l(v){return!!(v.output&&v.output.length>0||v.meta)}function a(v){if(v.kind==="subagent"&&v.agentId){n("open",v.agentId);return}l(v)&&(s.has(v.id)?s.delete(v.id):s.add(v.id))}function u(v){return!!(v.kind==="subagent"&&v.agentId||l(v))}function c(v){return v==="run"||v==="done"||v==="fail"?v:"pending"}const d=on("modelDisplay"),f=on("subagentEffort");function h(v){if(v.kind==="subagent")return d?.(v.model)}function g(v){if(v.kind==="subagent")return f?.(v.thinkingEffort)}async function m(v,k,y){await js(v)&&(y.add(k),setTimeout(()=>y.delete(k),1500))}async function w(v){v.meta&&await m(v.meta,v.id,i)}async function _(v){const k=v.output?.join(` -`)??"";k&&await m(k,v.id,r)}return(v,k)=>(b(),A("div",PEe,[C("div",DEe,[C("span",BEe,N(p(o)("tasks.tag")),1),C("span",HEe,N(e.tasks.length),1)]),C("div",zEe,[e.tasks.length===0?(b(),A("div",WEe,N(p(o)("tasks.emptyTasks")),1)):(b(!0),A(Pe,{key:1},pt(e.tasks,y=>(b(),A("div",{key:y.id,class:Re(["tp-row",{done:y.state==="done",fail:y.state==="fail",expandable:u(y)}])},[C("div",{class:"tp-main",role:u(y)?"button":void 0,onClick:x=>a(y)},[V(G5,{status:c(y.state)},null,8,["status"]),C("span",jEe,N(y.name),1),V(p(Vr),{variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(y.kind),1)]),_:2},1024),h(y)?(b(),A("span",VEe,N(h(y)),1)):te("",!0),g(y)?(b(),A("span",qEe,N(g(y)),1)):te("",!0),C("span",KEe,N(y.timing),1),y.state==="run"?(b(),A("button",{key:2,class:"tp-stop",onClick:Et(x=>n("cancel",y.id),["stop"])},N(p(o)("tasks.stop")),9,ZEe)):te("",!0),y.kind==="subagent"&&y.agentId?(b(),me(p(Ie),{key:3,class:"tp-chevron",name:"chevron-right",size:"sm"})):l(y)?(b(),me(p(Ie),{key:4,class:Re(["tp-chevron",{open:s.has(y.id)}]),name:"chevron-right",size:"sm"},null,8,["class"])):te("",!0)],8,UEe),s.has(y.id)&&l(y)?(b(),A("div",GEe,[y.meta?(b(),A("div",YEe,[C("button",{class:Re(["tp-copy",{copied:i.has(y.id)}]),onClick:Et(x=>w(y),["stop"])},N(i.has(y.id)?p(o)("tasks.copied"):p(o)("tasks.copy")),11,XEe),C("pre",JEe,[C("code",null,[C("span",QEe,N(y.meta),1)])])])):te("",!0),y.output&&y.output.length>0?(b(),A("div",eIe,[C("button",{class:Re(["tp-copy",{copied:r.has(y.id)}]),onClick:Et(x=>_(y),["stop"])},N(r.has(y.id)?p(o)("tasks.copied"):p(o)("tasks.copy")),11,tIe),C("pre",nIe,[C("code",null,[k[0]||(k[0]=Ve(` - `,-1)),(b(!0),A(Pe,null,pt(y.output,(x,M)=>(b(),A("span",{key:M,class:"tp-line"},N(x),1))),128)),k[1]||(k[1]=Ve(` - `,-1))])])])):te("",!0)])):te("",!0)],2))),128))])]))}}),lS=ht(oIe,[["__scopeId","data-v-c7412d09"]]),sIe={class:"todo-card"},iIe={key:0,class:"tc-empty"},rIe={class:"tc-name"},lIe=tt({__name:"TodoCard",props:{todos:{}},setup(e){const t=e,{t:n}=Lt();function o(s){return s==="in_progress"?"run":s}return(s,i)=>(b(),A("div",sIe,[t.todos.length===0?(b(),A("div",iIe,[i[0]||(i[0]=C("svg",{class:"tc-empty-ico",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[C("path",{d:"M9 11l2 2 4-4"}),C("rect",{x:"4",y:"4",width:"16",height:"16",rx:"3"})],-1)),C("span",null,N(p(n)("tasks.emptyTodo")),1)])):te("",!0),(b(!0),A(Pe,null,pt(t.todos,(r,l)=>(b(),A("div",{key:l,class:Re(["tc-row",`s-${r.status}`])},[V(G5,{status:o(r.status)},null,8,["status"]),C("span",rIe,N(r.title),1)],2))),128))]))}}),aIe=ht(lIe,[["__scopeId","data-v-01c65735"]]),uIe={class:"dock-work-head"},cIe={key:0,class:"dock-work-tab static"},dIe={key:1,class:"dock-work-tab static"},fIe={key:2,class:"dock-work-tab static"},pIe={key:3,class:"dock-work-tab static"},hIe={key:4,class:"dock-work-head-actions"},mIe={key:0,class:"dock-work-foot"},gIe={key:0},vIe={key:1},yIe={key:0,class:"dock-workbar"},kIe={class:"dw-count"},bIe={class:"dw-count"},CIe={class:"dw-count"},wIe=tt({__name:"ChatDock",props:{sessionId:{},running:{type:Boolean},working:{type:Boolean},starting:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},activationBadges:{},models:{},authReady:{type:Boolean},managedSignedIn:{type:Boolean},managedMembership:{},starredIds:{},skills:{},goal:{},dockPanel:{},bashTasks:{},subagentTasks:{},bashRunning:{},subagentRunning:{},todoDoneCount:{},hasDockWork:{type:Boolean},todos:{},pendingQuestion:{},questionBusyKind:{},pendingApproval:{},approvalBusy:{type:Boolean},openFile:{type:Function},mobile:{type:Boolean}},emits:["submit","steer","command","interrupt","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","openBtw","createGoal","controlGoal","focusGoal","focusSwarm","compact","pickModel","selectModel","login","answer","dismiss","approval","cancelTask","toggle-dock-panel","close-dock-panel","openAgent"],setup(e,{expose:t,emit:n}){const o=e,s=n,{t:i}=Lt(),{confirm:r}=pu(),l=R(()=>{switch(o.goal?.status){case"active":return i("status.goalStatusActive");case"paused":return i("status.goalStatusPaused");case"blocked":return i("status.goalStatusBlocked");case"complete":return i("status.goalStatusComplete");default:return""}}),a=R(()=>{const T=o.goal?.budget.tokenBudget;return!o.goal||!T||T<=0?0:Math.max(0,Math.min(100,Math.round(o.goal.tokensUsed/T*100)))}),u=R(()=>o.goal?_c(o.goal.wallClockMs):"");async function c(){await r({title:i("status.goalCancel"),message:i("status.goalCancelConfirm"),confirmLabel:i("status.goalCancelConfirmYes"),cancelLabel:i("status.goalCancelConfirmNo"),variant:"danger"})&&s("controlGoal","cancel")}const d=Z(null),f=R(()=>d.value?.anyPopupOpen===!0),h=Z(null),g=Z(null);function m(T){return d.value?(d.value.loadForEdit(T),!0):!1}function w(T){d.value?.loadAttachmentsForEdit(T)}function _(){d.value?.focus()}const v=()=>d.value?.isEmpty?.()??!1;function k(T){if(!o.dockPanel)return;const L=T.target;L&&(h.value?.contains(L)||L instanceof Element&&L.closest(".ui-pill")||s("close-dock-panel"))}const y=Z(null),x=Z(!1),M=Z(!1);function $(){const T=y.value;if(!T){x.value=!1,M.value=!1;return}x.value=T.scrollTop>0,M.value=T.scrollTop+T.clientHeight0,M.value=L.scrollTop+L.clientHeighto.dockPanel,async T=>{typeof document<"u"&&(document.removeEventListener("mousedown",k,!0),T&&document.addEventListener("mousedown",k,!0)),I?.disconnect(),I=null,T?(await yt(),$(),typeof ResizeObserver=="function"&&y.value&&(I=new ResizeObserver($),I.observe(y.value))):(x.value=!1,M.value=!1)},{immediate:!0});let P=null;function D(){const T=g.value?.offsetHeight??0;document.documentElement.style.setProperty("--dock-h",`${T}px`)}return dn(()=>{typeof ResizeObserver!="function"||!g.value||(P=new ResizeObserver(D),P.observe(g.value),D())}),kn(()=>{typeof document<"u"&&document.removeEventListener("mousedown",k,!0),P?.disconnect(),P=null,I?.disconnect(),I=null}),t({loadForEdit:m,loadAttachmentsForEdit:w,focus:_,anyPopupOpen:f,isEmpty:v}),(T,L)=>(b(),A("div",{ref_key:"dockRef",ref:g,class:Re(["chat-dock",[e.mobile?"align-mobile":"align-center",{"has-popup":f.value,"has-approval":!!e.pendingApproval&&!e.pendingQuestion}]]),onClick:L[31]||(L[31]=Et(()=>{},["stop"]))},[V(as,{name:"dock-panel"},{default:ke(()=>[e.dockPanel?(b(),A("div",{key:0,ref_key:"workPanelRef",ref:h,class:Re(["dock-work-panel",{"body-scrolled-up":x.value,"body-scrolled-down":M.value}]),onClick:L[5]||(L[5]=Et(()=>{},["stop"]))},[C("div",uIe,[e.dockPanel==="bash"?(b(),A("span",cIe,N(p(i)("tasks.dockBash"))+" · "+N(e.bashRunning)+" "+N(p(i)("tasks.running")),1)):e.dockPanel==="subagent"?(b(),A("span",dIe,N(p(i)("tasks.dockSubagent"))+" · "+N(e.subagentRunning)+" "+N(p(i)("tasks.running")),1)):e.dockPanel==="todos"?(b(),A("span",fIe,N(p(i)("tasks.dockTodos"))+" · "+N(e.todoDoneCount)+"/"+N(e.todos?.length??0),1)):e.dockPanel==="goal"?(b(),A("span",pIe,N(p(i)("status.goalLabel"))+" · "+N(l.value),1)):te("",!0),e.dockPanel==="goal"&&e.goal?(b(),A("span",hIe,[e.goal.status==="active"?(b(),me(p(Ft),{key:0,size:"sm",variant:"secondary",class:"dock-goal-action",onClick:L[0]||(L[0]=Et(B=>s("controlGoal","pause"),["stop"]))},{default:ke(()=>[V(p(Ie),{name:"pause",size:"md"}),C("span",null,N(p(i)("status.goalPause")),1)]),_:1})):te("",!0),e.goal.status==="paused"||e.goal.status==="blocked"?(b(),me(p(Ft),{key:1,size:"sm",variant:"primary",class:"dock-goal-action",onClick:L[1]||(L[1]=Et(B=>s("controlGoal","resume"),["stop"]))},{default:ke(()=>[V(p(Ie),{name:"play",size:"md"}),C("span",null,N(p(i)("status.goalResume")),1)]),_:1})):te("",!0),V(p(Ft),{size:"sm",variant:"danger-soft",class:"dock-goal-action",onClick:Et(c,["stop"])},{default:ke(()=>[V(p(Ie),{name:"close",size:"md"}),C("span",null,N(p(i)("status.goalCancel")),1)]),_:1})])):te("",!0)]),C("div",{ref_key:"workBodyRef",ref:y,class:"dock-work-body",onScroll:S},[e.dockPanel==="bash"?(b(),me(lS,{key:0,tasks:e.bashTasks,onCancel:L[2]||(L[2]=B=>s("cancelTask",B))},null,8,["tasks"])):e.dockPanel==="subagent"?(b(),me(lS,{key:1,tasks:e.subagentTasks,onCancel:L[3]||(L[3]=B=>s("cancelTask",B)),onOpen:L[4]||(L[4]=B=>s("openAgent",B))},null,8,["tasks"])):e.dockPanel==="todos"?(b(),me(aIe,{key:2,todos:e.todos??[]},null,8,["todos"])):e.dockPanel==="goal"&&e.goal?(b(),me(ITe,{key:3,goal:e.goal},null,8,["goal"])):te("",!0)],544),e.dockPanel==="goal"&&e.goal?(b(),A("div",mIe,[C("span",null,N(e.goal.turnsUsed)+" turns",1),C("span",null,N(p(Ml)(e.goal.tokensUsed))+" tokens",1),u.value?(b(),A("span",gIe,N(u.value),1)):te("",!0),e.goal.budget.tokenBudget!==null?(b(),A("span",vIe,N(a.value)+"% token budget",1)):te("",!0)])):te("",!0)],2)):te("",!0)]),_:1}),e.hasDockWork?(b(),A("div",yIe,[e.goal?(b(),me(p(G0),{key:0,active:e.dockPanel==="goal","aria-pressed":e.dockPanel==="goal",onClick:L[6]||(L[6]=B=>s("toggle-dock-panel","goal"))},{default:ke(()=>[V(p(Ie),{name:"target",size:"md"}),C("span",null,N(p(i)("status.goalLabel")),1),C("span",{class:Re(["dw-goal-status",`dw-goal-status--${e.goal.status}`])},N(l.value),3)]),_:1},8,["active","aria-pressed"])):te("",!0),e.bashTasks.length>0?(b(),me(p(G0),{key:1,active:e.dockPanel==="bash","aria-pressed":e.dockPanel==="bash",onClick:L[7]||(L[7]=B=>s("toggle-dock-panel","bash"))},{default:ke(()=>[V(p(Ie),{name:"clock",size:"md"}),C("span",null,N(p(i)("tasks.dockBash")),1),C("span",kIe,[L[32]||(L[32]=Ve("(",-1)),C("b",null,N(e.bashTasks.length),1),L[33]||(L[33]=Ve(")",-1))])]),_:1},8,["active","aria-pressed"])):te("",!0),e.subagentTasks.length>0?(b(),me(p(G0),{key:2,active:e.dockPanel==="subagent","aria-pressed":e.dockPanel==="subagent",onClick:L[8]||(L[8]=B=>s("toggle-dock-panel","subagent"))},{default:ke(()=>[V(p(Ie),{name:"sparkles",size:"md"}),C("span",null,N(p(i)("tasks.dockSubagent")),1),C("span",bIe,[L[34]||(L[34]=Ve("(",-1)),C("b",null,N(e.subagentTasks.length),1),L[35]||(L[35]=Ve(")",-1))])]),_:1},8,["active","aria-pressed"])):te("",!0),(e.todos?.length??0)>0?(b(),me(p(G0),{key:3,active:e.dockPanel==="todos","aria-pressed":e.dockPanel==="todos",onClick:L[9]||(L[9]=B=>s("toggle-dock-panel","todos"))},{default:ke(()=>[V(p(Ie),{name:"check-list",size:"md"}),C("span",null,N(p(i)("tasks.dockTodos")),1),C("span",CIe,[L[36]||(L[36]=Ve("(",-1)),C("b",null,N(e.todoDoneCount)+"/"+N(e.todos?.length??0),1),L[37]||(L[37]=Ve(")",-1))])]),_:1},8,["active","aria-pressed"])):te("",!0)])):te("",!0),e.pendingQuestion?(b(),me(qTe,{key:e.pendingQuestion.questionId,question:e.pendingQuestion,"busy-kind":e.questionBusyKind,onAnswer:L[10]||(L[10]=(B,H)=>s("answer",B,H)),onDismiss:L[11]||(L[11]=B=>s("dismiss",B))},null,8,["question","busy-kind"])):e.pendingApproval?(b(),me(OEe,{key:e.pendingApproval.approvalId,class:"dock-approval",block:e.pendingApproval.block,"agent-name":e.pendingApproval.agentName,busy:e.approvalBusy,"open-file":e.openFile,onDecide:L[12]||(L[12]=B=>s("approval",e.pendingApproval.approvalId,B))},null,8,["block","agent-name","busy","open-file"])):(b(),me(oF,{key:3,ref_key:"composerRef",ref:d,"session-id":e.sessionId,running:e.running,working:e.working,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"auth-ready":e.authReady,"managed-signed-in":e.managedSignedIn,"managed-membership":e.managedMembership,"starred-ids":e.starredIds,skills:e.skills,starting:e.starting,onSubmit:L[13]||(L[13]=B=>s("submit",B)),onSteer:L[14]||(L[14]=B=>s("steer",B)),onCommand:L[15]||(L[15]=B=>s("command",B)),onInterrupt:L[16]||(L[16]=B=>s("interrupt")),onSetPermission:L[17]||(L[17]=B=>s("setPermission",B)),onSetThinking:L[18]||(L[18]=B=>s("setThinking",B)),onTogglePlan:L[19]||(L[19]=B=>s("togglePlan")),onToggleSwarm:L[20]||(L[20]=B=>s("toggleSwarm")),onToggleGoal:L[21]||(L[21]=B=>s("toggleGoal")),onOpenBtw:L[22]||(L[22]=B=>s("openBtw")),onCreateGoal:L[23]||(L[23]=B=>s("createGoal",B)),onControlGoal:L[24]||(L[24]=B=>s("controlGoal",B)),onFocusGoal:L[25]||(L[25]=B=>s("focusGoal")),onFocusSwarm:L[26]||(L[26]=B=>s("focusSwarm")),onCompact:L[27]||(L[27]=B=>s("compact")),onPickModel:L[28]||(L[28]=B=>s("pickModel")),onSelectModel:L[29]||(L[29]=B=>s("selectModel",B)),onLogin:L[30]||(L[30]=B=>s("login"))},null,8,["session-id","running","working","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","goal","activation-badges","models","auth-ready","managed-signed-in","managed-membership","starred-ids","skills","starting"]))],2))}}),_Ie=ht(wIe,[["__scopeId","data-v-d7b4c5e6"]]),xIe=["aria-label","aria-hidden"],SIe={class:"toc-scroll"},AIe=["onClick"],MIe={class:"toc-label"},TIe=240,EIe=tt({__name:"ConversationToc",props:{items:{},activeTurnId:{},mobile:{type:Boolean},sessionLoading:{type:Boolean},occluded:{type:Boolean}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=Z(null),r=Z(!0);let l=null;function a(){const c=i.value,d=c?.offsetParent;if(!c||!d)return;const f=c.getBoundingClientRect().left,h=d.getBoundingClientRect().right;r.value=h-f>=TIe}const u=R(()=>!n.mobile&&!n.sessionLoading&&n.items.length>1);return et(u,c=>{l?.disconnect(),l=null,c&&yt(()=>{const d=i.value,f=d?.offsetParent;!d||!f||(typeof ResizeObserver<"u"&&(l=new ResizeObserver(a),l.observe(f)),a())})},{immediate:!0}),Un(()=>{l?.disconnect(),l=null}),(c,d)=>u.value?(b(),A("nav",{key:0,ref_key:"navRef",ref:i,class:Re(["conversation-toc",{"toc-clipped":!r.value||e.occluded}]),"aria-label":p(s)("conversation.toc"),"aria-hidden":r.value&&!e.occluded?void 0:!0},[C("div",SIe,[(b(!0),A(Pe,null,pt(e.items,f=>(b(),A("button",{key:f.id,type:"button",class:Re(["toc-row",{active:e.activeTurnId===f.id}]),onClick:h=>o("select",f.id)},[d[0]||(d[0]=C("span",{class:"toc-bar"},null,-1)),C("span",MIe,N(f.title),1)],10,AIe))),128))])],10,xIe)):te("",!0)}}),IIe=ht(EIe,[["__scopeId","data-v-b8ba267a"]]);function LIe(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const e=navigator.userAgentData;return e?.platform==="macOS"||e?.platform==="iOS"}function $Ie(e,t=LIe()){return(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey&&(e.code==="KeyF"||e.key.toLowerCase()==="f")&&!e.defaultPrevented}const NIe=new Map([["ς","σ"],["ß","ss"],["ſ","s"],["ff","ff"],["fi","fi"],["fl","fl"],["ffi","ffi"],["ffl","ffl"],["ſt","st"],["st","st"],["ʼn","ʼn"],["µ","μ"],["K","k"],["Å","å"],["Ω","ω"]]);function FIe(e){return e==="pre"||e==="pre-wrap"||e==="break-spaces"?"preserve":e==="pre-line"?"pre-line":"collapse"}function RIe(e,t){if(t==="preserve")return{text:e,map:Array.from({length:e.length},(r,l)=>l)};const n=t==="collapse"?/[\t\n\f\r ]/:/[\t ]/;let o="";const s=[];let i=!1;for(let r=0;raS(c.text)),o="\0";let s="";const i=[];for(let c=0;c0&&e[c].gapBefore&&(s+=o),i[c]=s.length,s+=n[c].folded;const r=DIe(aS(t).folded);if(r===null)return;const l=new RegExp(r,"g");function a(c){let d=0,f=i.length-1,h=0;for(;d<=f;){const g=d+f>>1;i[g]<=c?(h=g,d=g+1):f=g-1}return h}let u;for(;;){const c=l.exec(s);if(c===null)return;const d=c.index,f=d+c[0].length-1,h=a(d),g=a(f),m=n[h].map[d-i[h]],w=n[g].map[f-i[g]],_={startSeg:h,startOffset:m.start,endSeg:g,endOffset:w.start+w.length};u!==void 0&&u.startSeg===_.startSeg&&u.startOffset===_.startOffset&&u.endSeg===_.endSeg&&u.endOffset===_.endOffset||(u=_,yield _)}}const PIe=/[.*+?^${}()|[\]\\]/g;function DIe(e){const t=[];let n=0;for(;n=UIe)return{ranges:a,truncated:!0};a.push(f)}}return{ranges:a,truncated:!1}}const sF="kimi-transcript-search",Sy="kimi-transcript-search-current";function iF(){return globalThis.CSS?.highlights??null}function A4(e,t){const n=iF(),o=globalThis.Highlight;if(!n||!o)return;if(e.length===0){Ay();return}const s=new o;for(const r of e)s.add(r);n.set(sF,s);const i=e[t];if(i!==void 0){const r=new o;r.add(i),n.set(Sy,r)}else n.delete(Sy)}function Ay(){const e=iF();e?.delete(sF),e?.delete(Sy)}const VIe={class:"tsearch-main"},qIe=["placeholder"],KIe={key:0,class:"tsearch-spin"},ZIe=["inert"],GIe={class:"tsearch-foot"},YIe={class:"tsearch-count",role:"status"},XIe={class:"tsearch-rings","aria-hidden":"true"},JIe=800,QIe=400,eLe=1500,tLe=tt({__name:"TranscriptSearch",props:{pane:{},reveal:{},mobile:{type:Boolean,default:!1}},emits:["close"],setup(e,{expose:t,emit:n}){const o=e,s=n,{t:i}=Lt(),{handleCompositionStart:r,handleCompositionEnd:l,isComposingKeyEvent:a}=Sr(),u=Z(""),c=Z(!1),d=Z([]),f=Z(0),h=Z(null),g=R(()=>d.value.length),m=R(()=>u.value.trim()!==""&&!c.value),w=Z(!1),_=R(()=>{if(g.value===0)return i("conversation.search.noResults");const K={current:f.value+1,total:g.value};return w.value?i("conversation.search.resultsCapped",K):i("conversation.search.results",K)});let v=null,k=null,y=null,x=null,M=null,$=0;const S=Z([]);function I(){const K=o.pane,ie=d.value[f.value];if(!K||ie===void 0){S.value=[];return}const ne=K.getBoundingClientRect(),Y=[];for(const le of ie.getClientRects())Y.push({top:`${le.top-ne.top+K.scrollTop}px`,left:`${le.left-ne.left}px`,width:`${le.width}px`,height:`${le.height}px`});S.value=Y}function P(K,ie){return K.type==="attributes"&&K.target===ie?!0:D(K)}function D(K){const ie=ne=>ne instanceof Element&&(ne.classList.contains("tsearch-rings")||ne.closest(".tsearch-rings")!==null);if(ie(K.target))return!0;if(K.type==="childList"){const ne=[...K.addedNodes,...K.removedNodes];if(ne.length>0&&ne.every(ie))return!0}return!1}function T(){S.value.length!==0&&(M!==null&&clearTimeout(M),M=setTimeout(()=>{M=null,I()},120))}function L(){return o.pane?.querySelector(".chat")??null}function B(){if(v!==null&&(clearTimeout(v),v=null),u.value.trim()===""){c.value=!1,H();return}c.value=!0,v=setTimeout(H,JIe)}function H(K="first"){v!==null&&(clearTimeout(v),v=null),c.value=!1;const ie=L();if(u.value.trim()===""||ie===null){d.value=[],w.value=!1,f.value=0,Ay(),I();return}const ne=d.value[f.value],Y=ne?.startContainer??null,le=ne?.startOffset??0,Ee=jIe(ie,u.value.trim()),de=Ee.ranges;if(w.value=Ee.truncated,d.value=de,de.length===0){f.value=0,A4([],0),I();return}if(K!==!1){const pe=O(de);f.value=K==="backward"?(pe-1+de.length)%de.length:pe,F();return}const he=Y!==null?de.findIndex(pe=>pe.startContainer===Y&&pe.startOffset===le):-1;f.value=he>=0?he:O(de),A4(de,f.value),I()}function O(K){const ie=o.pane?.getBoundingClientRect().top??0,ne=K.findIndex(Y=>{const le=Y.getClientRects(),Ee=le[le.length-1];return Ee!==void 0&&Ee.bottom>=ie});return ne===-1?0:ne}function F(){const K=d.value[f.value];A4(d.value,f.value),K!==void 0&&o.reveal(K),I()}function W(K){g.value!==0&&(f.value=(f.value+K+g.value)%g.value,F())}function z(K){if(K.key==="Enter"&&!a(K)){if(K.preventDefault(),v!==null){H(K.shiftKey?"backward":"first");return}W(K.shiftKey?-1:1)}}function U(K){K.key==="Escape"&&(a(K)||(K.preventDefault(),K.stopPropagation(),s("close")))}function q(){const K=h.value;K&&(K.focus(),K.select())}return t({focusInput:q}),dn(()=>{yt(()=>h.value?.focus()),o.pane&&typeof MutationObserver=="function"&&(y=new MutationObserver(ie=>{if(u.value.trim()!==""&&!ie.every(ne=>P(ne,o.pane))&&v===null){if(Date.now()-$>=eLe){$=Date.now(),k!==null&&(clearTimeout(k),k=null),H(!1);return}k!==null&&clearTimeout(k),k=setTimeout(()=>{k=null,v===null&&($=Date.now(),H(!1))},QIe)}}),y.observe(o.pane,{subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeFilter:["inert","style","class"]})),o.pane?.addEventListener("scroll",T,{passive:!0});const K=[o.pane,o.pane?.querySelector(".content-wrap")??null];if(typeof ResizeObserver=="function"){x=new ResizeObserver(()=>I());for(const ie of K)ie&&x.observe(ie)}}),kn(()=>{v!==null&&clearTimeout(v),k!==null&&clearTimeout(k),M!==null&&clearTimeout(M),y?.disconnect(),y=null,x?.disconnect(),x=null,o.pane?.removeEventListener("scroll",T),Ay()}),(K,ie)=>(b(),A("div",{class:Re(["tsearch",{mobile:e.mobile}]),role:"search",onKeydown:U},[C("div",VIe,[V(p(Ie),{class:"tsearch-icon",name:"search",size:"sm","aria-hidden":"true"}),In(C("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":ie[0]||(ie[0]=ne=>u.value=ne),type:"text",class:"tsearch-input",placeholder:p(i)("conversation.search.placeholder"),autocapitalize:"off",autocomplete:"off",spellcheck:"false",onInput:B,onKeydown:z,onCompositionstart:ie[1]||(ie[1]=(...ne)=>p(r)&&p(r)(...ne)),onCompositionend:ie[2]||(ie[2]=(...ne)=>p(l)&&p(l)(...ne))},null,40,qIe),[[ri,u.value]]),c.value?(b(),A("span",KIe,[V(p(Ao),{size:"sm",label:p(i)("conversation.search.searching")},null,8,["label"])])):te("",!0),ie[6]||(ie[6]=C("span",{class:"tsearch-sep","aria-hidden":"true"},null,-1)),V(p(gn),{class:"tsearch-close",size:"sm",label:p(i)("conversation.search.close"),onClick:ie[3]||(ie[3]=ne=>s("close"))},{default:ke(()=>[V(p(Ie),{name:"close"})]),_:1},8,["label"])]),C("div",{class:Re(["tsearch-foot-wrap",{open:m.value}]),inert:!m.value},[C("div",GIe,[V(p(gn),{size:"sm",label:p(i)("conversation.search.previous"),disabled:g.value===0,onClick:ie[4]||(ie[4]=ne=>W(-1))},{default:ke(()=>[V(p(Ie),{name:"arrow-up"})]),_:1},8,["label","disabled"]),V(p(gn),{size:"sm",label:p(i)("conversation.search.next"),disabled:g.value===0,onClick:ie[5]||(ie[5]=ne=>W(1))},{default:ke(()=>[V(p(Ie),{name:"arrow-down"})]),_:1},8,["label","disabled"]),C("span",YIe,N(_.value),1)])],10,ZIe),e.pane?(b(),me(Zr,{key:0,to:e.pane},[C("div",XIe,[(b(!0),A(Pe,null,pt(S.value,(ne,Y)=>(b(),A("div",{key:Y,class:"tsearch-ring",style:Gt(ne)},null,4))),128))])],8,["to"])):te("",!0)],34))}}),nLe=ht(tLe,[["__scopeId","data-v-4efab220"]]),oLe="/assets/k3_doodle1-27EZ2HSw.riv",sLe={class:"doodle-host"},iLe={key:0,class:"doodle-fallback"},rLe=tt({__name:"KimiDoodle",setup(e){const t=Z(!1),n=Z(null),o=p2();let s=null;return dn(async()=>{if(!window.matchMedia("(prefers-reduced-motion: reduce)").matches)try{let i=function(){const g=d.stateMachineNames[0];if(!g)return;const m=(d.stateMachineInputs(g)??[]).find(w=>w.name==="light/dark");m&&(m.value=o.value?1:0)};const[{Rive:r,RuntimeLoader:l},a,u]=await Promise.all([Go(()=>import("./rive-CeXCFBdn.js").then(g=>g.r),__vite__mapDeps([10,3])),Go(()=>import("./rive-BxcgqsjB.js"),[]).then(g=>g.default),Go(()=>import("./rive_fallback-ByshBW-N.js"),[]).then(g=>g.default)]),c=n.value;if(!c)return;l.setWasmUrl(a),l.setWasmFallbackUrl(u);const d=new r({canvas:c,src:oLe,autoplay:!0,onLoad(){const g=d.stateMachineNames[0];g&&d.play(g),requestAnimationFrame(()=>{n.value&&(i(),d.resizeDrawingSurfaceToCanvas(),t.value=!0)})}}),f=et(o,i),h=()=>d.resizeDrawingSurfaceToCanvas();window.addEventListener("resize",h),s=()=>{f(),window.removeEventListener("resize",h),d.cleanup()}}catch{}}),Un(()=>{s?.(),s=null}),(i,r)=>(b(),A("div",sLe,[t.value?te("",!0):(b(),A("div",iLe,[Cn(i.$slots,"fallback",{},void 0,!0)])),C("canvas",{ref_key:"canvasRef",ref:n,class:Re(["doodle-canvas",{ready:t.value}]),role:"img","aria-label":"Kimi"},null,2)]))}}),lLe=ht(rLe,[["__scopeId","data-v-ca7d2c61"]]),aLe=5;function uLe(e,t,n,o=aLe){if(e.length<=o)return e;const s=e.slice(0,o);if(t&&!s.some(i=>i.id===t)){const i=e.find(r=>r.id===t);i&&(s[o-1]=i)}return s}function cLe(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const e=navigator.userAgentData;return e?.platform==="macOS"||e?.platform==="iOS"}function dLe(e,t=cLe()){return(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey&&(e.code==="KeyA"||e.key.toLowerCase()==="a")&&!e.defaultPrevented}function fLe(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement&&(e.isContentEditable||e.closest("input, textarea")!==null)}function pLe(e,t){return typeof Element>"u"||!(e instanceof Element)?null:e.closest(t)}function cS(e){e.ownerDocument.getSelection()?.selectAllChildren(e)}function hLe(e){return e?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0:!1}function mLe(e){const{sessionId:t,mobile:n,starting:o,dockedComposer:s,emptyComposer:i}=e,r=Z(!1);et(t,()=>{n()||(r.value=!0)}),et([r,s,i,o],()=>{if(!r.value)return;const l=s.value??i.value;if(!l)return;const a=typeof document<"u"?document.activeElement:null;if(hLe(a)){r.value=!1;return}l.focus(),(typeof document>"u"||document.activeElement!==a)&&(r.value=!1)},{flush:"post"})}const gLe={class:"empty-hint"},vLe={class:"empty-hint-title"},yLe={key:1,class:"empty-hint-title is-starting"},kLe={key:2,class:"empty-hint-text"},bLe={key:0,class:"upgrade-banner"},CLe={class:"upgrade-banner-text"},wLe={class:"ws-bar"},_Le={key:0,class:"ws-anchor"},xLe=["aria-expanded"],SLe={class:"ws-chip-name"},ALe={class:"ws-caption"},MLe=["onClick"],TLe={class:"ws-info"},ELe={class:"ws-name"},ILe={class:"ws-path"},LLe=["aria-label"],$Le={key:0,class:"undo-toast",role:"status","aria-live":"polite"},NLe={class:"undo-toast-text"},FLe=48,f1=80,dS=1e3,RLe=420,OLe=3e3,PLe=5e3,DLe=1e4,BLe=2500,HLe=tt({__name:"ConversationPane",props:{turns:{},sessionId:{},approvals:{},gitInfo:{},tasks:{},todos:{},goal:{},activationBadges:{},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},goalMode:{type:Boolean},questions:{},pendingQuestionActions:{},pendingApprovalActions:{},running:{type:Boolean},turnActive:{type:Boolean},queued:{},searchFiles:{type:Function},uploadImage:{type:Function},changes:{},fileReloadKey:{},working:{type:Boolean},lastTurnReason:{},turnError:{},turnRetry:{},overlayOpen:{type:Boolean},starting:{type:Boolean},mobile:{type:Boolean},sessionLoading:{type:Boolean},compaction:{},hasMoreMessages:{type:Boolean},loadingMore:{type:Boolean},loadingMoreError:{type:Boolean},loadOlderMessages:{type:Function},models:{},authReady:{type:Boolean},managedSignedIn:{type:Boolean},managedMembership:{},starredIds:{},skills:{},workspaceName:{},workspaceRoot:{},gitDiffStats:{},workspaces:{},activeWorkspaceId:{},sessionTitle:{},pr:{}},emits:["submit","steer","approval","cancelTask","answer","dismiss","command","interrupt","unqueue","editQueued","reorderQueue","setPermission","setThinking","togglePlan","toggleSwarm","toggleGoal","createGoal","controlGoal","compact","pickModel","selectModel","login","openFile","openMedia","openTurnDiff","openCompaction","openAgent","openChanges","refreshGitStatus","editMessage","selectWorkspace","addWorkspace","openPr","renameSession","forkSession","archiveSession","exportSession"],setup(e,{expose:t,emit:n}){const{t:o}=Lt(),s=e,i=n,r=Z(!1),l=Z(!1),a=Z(null),u=R(()=>s.workspaces?.find(Ae=>Ae.id===s.activeWorkspaceId)?.name??s.workspaceName??""),c=R(()=>(s.workspaces?.length??0)>0),d=R(()=>s.authReady===!1&&(s.models?.length??0)===0&&s.managedSignedIn===!0&&s.managedMembership==="free"),f=R(()=>uLe(s.workspaces??[],s.activeWorkspaceId));function h(ye){if(r.value){r.value=!1;return}const Ae=ye.currentTarget?.closest(".ws-anchor"),qe=Ae?.closest(".panes");if(Ae instanceof HTMLElement&&qe instanceof HTMLElement){const Mt=Ae.getBoundingClientRect(),Jt=qe.getBoundingClientRect(),an=Jt.bottom-Mt.bottom-4,$n=Mt.top-Jt.top-4;l.value=$n>an;const io=Math.max(0,Math.floor(l.value?$n:an));a.value=`min(calc(var(--space-8) * 10), ${io}px)`}else l.value=!1,a.value=null;r.value=!0}function g(ye){r.value=!1,ye!==s.activeWorkspaceId&&i("selectWorkspace",ye)}lr(cn.contentAlign);const m=Z(null),w=Z(null),_=Z(null),v=Z(!1);let k=null;function y(ye,Ae){const qe=_.value??w.value;return!qe||qe.loadForEdit(ye)===!1?!1:(qe.loadAttachmentsForEdit(Ae??[]),!0)}function x(){v.value=!0,k!==null&&clearTimeout(k),k=setTimeout(()=>{k=null,v.value=!1},2e3)}const M=R(()=>s.tasks.filter(ye=>ye.kind!=="subagent")),$=R(()=>s.tasks.filter(ye=>ye.kind==="subagent"&&ye.runInBackground)),S=R(()=>M.value.filter(ye=>ye.state==="run").length),I=R(()=>$.value.filter(ye=>ye.state==="run").length);function P(ye){const Ae=s.tasks,qe=Ae.find(Jt=>Jt.id===ye)??Ae.find(Jt=>Jt.parentToolCallId===ye);if(qe?.agentId)return qe.agentId;const Mt=Ae.filter(Jt=>Jt.kind==="subagent"&&!Jt.parentToolCallId&&Jt.agentId);if(Mt.length===1)return Mt[0].agentId}En("resolveAgentTaskId",P);const D=on("modelDisplay"),T=on("subagentEffort");function L(ye,Ae){const qe=Ae??P(ye);if(qe===void 0)return;const Mt=s.tasks.find($n=>$n.agentId===qe||$n.id===qe),Jt=D?.(Mt?.model),an=T?.(Mt?.thinkingEffort);if(!(Jt===void 0&&an===void 0))return{display:Jt,effort:an}}En("resolveAgentModel",L),En("pinScroll",Ho);const B=R(()=>(s.todos??[]).filter(ye=>ye.status==="done").length),H=R(()=>s.goal!=null||M.value.length>0||$.value.length>0||(s.todos?.length??0)>0||(s.queued?.length??0)>0),O=Z(null),F=R(()=>s.gitInfo?s.changes?.length??0:0);function W(ye){O.value=O.value===ye?null:ye}function z(){O.value=null}function U(){s.goal&&(O.value="goal")}et(()=>[s.goal,M.value.length,$.value.length,s.todos?.length],()=>{const ye=O.value;if(ye===null)return;ye==="goal"&&s.goal!=null||ye==="bash"&&M.value.length>0||ye==="subagent"&&$.value.length>0||ye==="todos"&&(s.todos?.length??0)>0||z()});function q(ye){if(ye.role==="compaction")return o("conversation.compactedPlain");if(ye.role==="user"){if(ye.skillActivation)return`/${ye.skillActivation.name}`;if(ye.pluginCommand)return`/${ye.pluginCommand.pluginId}:${ye.pluginCommand.commandName}`;const qe=ye.text.trim().replaceAll(/\s+/g," ");return qe.length>0?qe:"user"}const Ae=(ye.text||ye.thinking||"").trim().replaceAll(/\s+/g," ");return Ae.length>0?Ae:(ye.tools?.length??0)>0?`${ye.tools.length} tools`:"kimi"}const K=R(()=>s.turns.filter(ye=>ye.role==="user").map((ye,Ae)=>({id:ye.id,role:ye.role,no:Ae+1,title:q(ye)}))),ie=Z(null);function ne(){const ye=ee.value;if(!ye)return;const Ae=K.value;if(Ae.length===0)return;if(at()<=f1){ie.value=Ae[Ae.length-1].id;return}if(le||Y===null){const an=ye.scrollTop,$n=ye.getBoundingClientRect().top,io=[];for(const Fs of ye.querySelectorAll(".turn-anchor[data-turn-id]")){const yu=Fs.dataset.turnId;yu&&io.push({id:yu,top:Fs.getBoundingClientRect().top-$n+an})}Y=io,le=!1}const qe=new Set(Ae.map(an=>an.id)),Mt=ye.scrollTop+ye.clientHeight/2;let Jt=null;for(const an of Y)qe.has(an.id)&&an.top<=Mt&&(Jt=an.id);ie.value=Jt??Ae[0].id}let Y=null,le=!0;function Ee(){le=!0}let de=0;function he(){de||(de=uo(()=>{de=0,ne()}))}const pe=Z(!1);let oe=0;function ve(){oe||(oe=uo(()=>{oe=0,X()}))}function G(){ve(),Ee()}function X(){const ye=ee.value,Ae=!s.mobile&&ye?ye.closest(".con")?.querySelector(".conversation-toc"):null,qe=Ae?.querySelector(".toc-bar");let Mt=!1;if(ye&&Ae&&qe){const Jt=qe.getBoundingClientRect(),an=Ae.getBoundingClientRect(),$n=Jt.left+Jt.width/2;Mt=Array.from(ye.querySelectorAll(".table-node-wrapper")).some(io=>{const Fs=io.getBoundingClientRect();return Fs.left<=$n&&$n<=Fs.right&&Fs.topan.top})}pe.value!==Mt&&(pe.value=Mt)}const fe=R(()=>s.questions&&s.questions.length>0?s.questions[0]:void 0),Ce=R(()=>{const ye=fe.value;if(ye)return s.pendingQuestionActions?.[ye.questionId]}),ge=R(()=>s.approvals&&s.approvals.length>0?s.approvals[0]:void 0),Q=R(()=>{const ye=ge.value;return ye?!!s.pendingApprovalActions?.[ye.approvalId]:!1}),ee=Z(null),ce=Z(null),ue=Z(0),Se=Z(0),Ue=Z(!1),_e=Z(null);let Te=null;function st(){if(s.turns.length!==0){if(Ue.value){_e.value?.focusInput();return}Te=document.activeElement,Ue.value=!0}}function Fe(){Ue.value=!1,yt(()=>{Te instanceof HTMLElement&&Te.isConnected&&Te.focus(),Te=null})}et(()=>s.turns.length===0&&!s.sessionLoading,ye=>{ye&&Ue.value&&Fe()});const Oe=R(()=>({"--panes-scrollbar-width":`${ue.value}px`})),Ye=R(()=>({"--chat-dock-height":`${Se.value+FLe}px`}));function ft(ye){return ye instanceof HTMLElement?ye:ye&&"$el"in ye&&ye.$el instanceof HTMLElement?ye.$el:null}let $t=0;function Ht(){$t||($t=uo(()=>{$t=0;const ye=ee.value,Ae=ye?Math.max(0,ye.offsetWidth-ye.clientWidth):0;Ae!==ue.value&&(ue.value=Ae);const qe=ce.value?.offsetHeight??0;qe!==Se.value&&(Se.value=qe)}))}function Yt(ye){const Ae=ft(ye);Ae!==ee.value&&(ee.value=Ae,Ae&&xe())}function _n(ye){const Ae=ft(ye);Ae!==ce.value&&(ce.value=Ae??null,ye&&"loadForEdit"in ye&&typeof ye.loadForEdit=="function"&&"focus"in ye&&typeof ye.focus=="function"?_.value={loadForEdit:ye.loadForEdit.bind(ye),loadAttachmentsForEdit:"loadAttachmentsForEdit"in ye&&typeof ye.loadAttachmentsForEdit=="function"?ye.loadAttachmentsForEdit.bind(ye):()=>{},focus:ye.focus.bind(ye),get anyPopupOpen(){return"anyPopupOpen"in ye&&ye.anyPopupOpen===!0},isEmpty:"isEmpty"in ye&&typeof ye.isEmpty=="function"?ye.isEmpty.bind(ye):void 0}:_.value=null,se())}const je=Z(!0),Ke=Z(!1),Ze=Z(!1);let zt=null;function at(){const ye=ee.value;return ye?Le-ye.scrollTop-Ge:0}let tn=0,Wt=0,fn=0,Sn=0,to=0,An=0,ao=0;function Kt(){return Date.now(){Ze.value=!1,zt=null},900);const ye=ee.value;if(!ye)return;const Ae=ye.scrollTop;if(yn()){tn=Ae;return}if(performance.now()-fn<100){tn=Ae;return}const qe=at();if(Kt()){je.value=!0,Ke.value=!1,tn=Ae;return}Ae1?ye.scrollHeight-Ae-ye.clientHeight>1&&(je.value=!1,Ke.value=!0):qe<=f1&&Ae>tn+1&&Date.now()>=Sn&&(je.value=!0,Ke.value=!1),tn=Ae,he()}function Po(ye=!1){const Ae=ee.value;je.value=!0,Ke.value=!1,no(),Ae&&(!ye&&performance.now(){Mn=0;const an=Math.min(1,(performance.now()-Mt)/ye),$n=1-Math.pow(1-an,3);Ae.scrollTop=qe+(Ae.scrollHeight-qe)*$n,tn=Ae.scrollTop,an<1?Mn=uo(Jt):to=0};Mn=uo(Jt)}function Do(ye,Ae){return(Ae.closest("[inert]")?.closest(".tool-group, .activity-run, .turn-fold")??Ae).getBoundingClientRect().top-ye.getBoundingClientRect().top+ye.scrollTop}function po(ye,Ae){const qe=Array.from(ye.querySelectorAll(".turn-anchor[data-turn-id], [data-scroll-anchor-id]")).map(an=>({node:an,top:Do(ye,an)})),Mt=qe.findIndex(an=>an.top>=Ae),Jt=Mt<0?Math.max(0,qe.length-1):Mt;return qe.slice(Jt,Jt+2).flatMap(an=>{const $n=an.node.dataset.scrollAnchorId,io=$n??an.node.dataset.turnId;return io?[{kind:$n?"tool":"turn",id:io,top:an.top}]:[]})}const At=new Map;function qs(ye,Ae){for(const qe of Ae.anchors){const Mt=qe.kind==="tool"?"data-scroll-anchor-id":"data-turn-id",Jt=ye.querySelector(`[${Mt}="${ai(qe.id)}"]`);if(Jt)return Do(ye,Jt)-qe.top}return ye.scrollHeight-Ae.oldHeight}function Bo(ye,Ae,qe=ye.scrollTop){return ye.scrollTop=qe+qs(ye,Ae),tn=ye.scrollTop,ye.scrollTop}async function To(){if(!s.sessionId||!s.loadOlderMessages||s.loadingMore||ts.value||!s.hasMoreMessages)return;const ye=s.sessionId,Ae=ee.value,qe=Ae?.scrollTop??0,Mt={anchors:Ae?po(Ae,qe):[],oldHeight:Ae?.scrollHeight??0};Ll(ye,!0),Mi();try{if(await yt(),await s.loadOlderMessages(ye),await yt(),s.sessionId!==ye){At.set(ye,Mt);return}const Jt=ee.value;if(!Jt)return;Bo(Jt,Mt),At.delete(ye)}finally{Ll(ye,!1)}}function ai(ye){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(ye):ye.replaceAll(/["\\]/g,"\\$&")}let Tn=null;function no(){Tn!==null&&(clearTimeout(Tn),Tn=null)}function Ks(ye){fo(),je.value=!1,Ke.value=at()>f1,ye.scrollIntoView({behavior:"smooth",block:"center"}),no(),Tn=setTimeout(()=>{Tn=null;const Ae=ee.value;if(!Ae||!ye.isConnected)return;const qe=ye.getBoundingClientRect().top+ye.offsetHeight/2-(Ae.getBoundingClientRect().top+Ae.clientHeight/2);Math.abs(qe)>48&&(Ae.scrollTop+=qe)},480)}function ps(ye){const Ae=ee.value;if(!Ae)return;const qe=Ae.querySelector(`.turn-anchor[data-turn-id="${ai(ye)}"]`);qe&&Ks(qe)}function ui(ye,Ae){const qe=ye.startContainer.parentElement;if(qe!==null)for(let Mt=qe;Mt!==null&&Mt!==Ae;Mt=Mt.parentElement){const Jt=getComputedStyle(Mt),an=/(auto|scroll)/.test(Jt.overflowY)&&Mt.scrollHeight>Mt.clientHeight,$n=/(auto|scroll)/.test(Jt.overflowX)&&Mt.scrollWidth>Mt.clientWidth;if(!an&&!$n)continue;const io=ye.getClientRects()[0];if(!io)return;const Fs=Mt.getBoundingClientRect();an&&(Mt.scrollTop+=io.top+io.height/2-(Fs.top+Mt.clientHeight/2)),$n&&(Mt.scrollLeft+=io.left+io.width/2-(Fs.left+Mt.clientWidth/2))}}function $s(ye){const Ae=ee.value;if(!Ae)return;const qe=ye.startContainer.parentElement;fo(),je.value=!1,Ke.value=at()>f1,Sn=Date.now()+700;const Mt=qe?.closest(".u-text-wrap.is-clamped");if(Mt){Mt.querySelector(".u-text-toggle")?.click(),yt(()=>yo(ye,Ae));return}yo(ye,Ae)}function yo(ye,Ae){const qe=ye.startContainer.parentElement;ui(ye,Ae);const Mt=ye.getClientRects()[0];if(!Mt){qe instanceof HTMLElement&&Ks(qe);return}const Jt=Ae.getBoundingClientRect(),an=Mt.top+Mt.height/2-(Jt.top+Ae.clientHeight/2),$n=typeof window>"u"||!window.matchMedia("(prefers-reduced-motion: reduce)").matches;Ae.scrollTo({top:Ae.scrollTop+an,behavior:$n?"smooth":"auto"}),no(),Tn=setTimeout(()=>{Tn=null;const io=ee.value,Fs=ye.getClientRects()[0];if(!io||!Fs)return;const yu=io.getBoundingClientRect(),Mf=Fs.top+Fs.height/2-(yu.top+io.clientHeight/2);Math.abs(Mf)>48&&(io.scrollTop+=Mf)},480)}function oo(){const ye=ee.value;if(!ye)return"none";const Ae=ye.firstElementChild,qe=Ae instanceof HTMLElement?Ae.offsetHeight:0,Mt=ce.value?.offsetHeight??0;return`${ye.scrollHeight}:${ye.clientHeight}:${qe}:${Mt}`}function uo(ye){return typeof requestAnimationFrame=="function"?requestAnimationFrame(ye):setTimeout(ye,16)}function Xn(ye){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(ye):clearTimeout(ye)}let co=0,Qe=0,it=null,Ct=0;const en=Z(!1);function yn(){return performance.now(){if(Qe=0,!it)return;if(je.value){it=null,en.value=!1;return}if(performance.now()>=co){it=null,en.value=!1,Eo();return}const Jt=it.getBoundingClientRect().top-Ct;Jt&&(qe.scrollTop+=Jt),Qe=uo(Mt)};Qe=uo(Mt)}function Eo(){at()<=f1?(je.value=!0,Ke.value=!1):(je.value=!1,Ke.value=!0)}function Io(ye=36,Ae){if(!je.value&&!Kt()){Ae?.();return}const qe=++ao;let Mt="",Jt=0,an=0;An&&(Xn(An),An=0);const $n=()=>{if(An=0,qe!==ao)return;if(!je.value&&!Kt()){Ae?.();return}Po(!1);const io=oo();Jt=io===Mt?Jt+1:0,Mt=io,an++,Jt<3&&an0&&Ae.length>=ye.length&&ye.firstId!==Ae.firstId&&ye.lastId===Ae.lastId&&ye.lastTextLen===Ae.lastTextLen&&ye.lastThinkingLen===Ae.lastThinkingLen&&ye.lastToolsLen===Ae.lastToolsLen&&ye.approvalIds===Ae.approvalIds}const zo=R(()=>{const ye=(s.approvals??[]).map(an=>an.approvalId).join(","),Ae=s.turns,qe=Ae.at(-1),Mt=qe?.thinking?.length??0,Jt=qe?.tools?.reduce((an,$n)=>an+$n.name.length+($n.arg?.length??0)+($n.output?.join("").length??0),0)??0;return{length:Ae.length,firstId:Ae[0]?.id??"",lastId:qe?.id??"",lastTextLen:qe?.text.length??0,lastThinkingLen:Mt,lastToolsLen:Jt,approvalIds:ye}});let Lo=s.fileReloadKey;et(zo,async(ye,Ae)=>{const qe=s.fileReloadKey,Mt=qe!==Lo;if(Lo=qe,ts.value&&Zs(Ae,ye)){he();return}if(Mt){he();return}await yt(),je.value||Kt()?Po(ye.length{se()}),et(()=>s.mobile,async()=>{await yt(),Ht()});const Wo=new Map,sn=Z(!1);let ws=0,Uo=null;function Mr(){sn.value=!0,ws&&(Xn(ws),ws=0),Uo&&clearTimeout(Uo),Uo=setTimeout(()=>{sn.value=!1,Uo=null},1200)}function Gs(){if(!sn.value)return;let ye=2;const Ae=()=>{if(ws=0,ye--,ye>0){ws=uo(Ae);return}sn.value=!1,Uo&&(clearTimeout(Uo),Uo=null)};ws&&Xn(ws),ws=uo(Ae)}et(()=>s.fileReloadKey,async(ye,Ae)=>{const qe=ee.value;Ae&&qe&&Wo.set(String(Ae),{top:qe.scrollTop,following:je.value}),fo(),Mr(),await yt();const Mt=ee.value,Jt=ye?Wo.get(String(ye)):void 0;if(Jt&&Mt){const an=At.get(String(ye)),$n=an?Bo(Mt,an,Jt.top):Jt.top;an&&At.delete(String(ye)),je.value=Jt.following,Mt.scrollTop=$n,tn=Mt.scrollTop,Ke.value=!Jt.following&&at()>1,Jt.following?Io(36,Gs):Gs()}else je.value=!0,tn=0,Po(!1),Io(36,Gs);Ee(),ne()}),et(()=>s.sessionLoading,async(ye,Ae)=>{ye||!Ae||(je.value=!0,await yt(),Io(36,Gs),he())}),et(()=>s.turnActive,async(ye,Ae)=>{ye||!Ae||!je.value&&!Kt()||(await yt(),Io(48),he())});function Vi(){je.value=!0,Ke.value=!1,Wt=Date.now()+dS,yt(()=>{Po(!0),Io(16)})}function Ys(ye){Vi(),i("submit",ye)}function jo(ye){je.value=!0,Ke.value=!1,Wt=Date.now()+dS,i("editMessage",ye)}function Vo(ye){const Ae=s.queued?.[ye],qe=Ae?.text??"";y(qe,Ae?.attachments)&&i("editQueued",ye)}function Il(ye){i("reorderQueue",ye)}function cr(ye,Ae){Vi(),i("answer",ye,Ae)}function Tr(ye,Ae){!ye||!Ae||i("approval",ye,Ae)}let ho=null,ko=null,qi=null,gt=null,Le=0,Ge=0,Xt=0;const hs=Z(new Set),ts=R(()=>!!s.sessionId&&hs.value.has(s.sessionId));function Ll(ye,Ae){const qe=new Set(hs.value);Ae?qe.add(ye):qe.delete(ye),hs.value=qe}function tl(){ts.value||Xt||(Xt=uo(()=>{Xt=0,!ts.value&&(yn()||(je.value||Kt())&&Po(!1))}))}function Mi(){ao++,An&&(Xn(An),An=0),Xt&&(Xn(Xt),Xt=0)}function fo(){const ye=ee.value;if(Wt=0,Sn=0,Mi(),co=0,it=null,en.value=!1,Mn&&(Xn(Mn),Mn=0),no(),ye){const Ae=ye.scrollTop;typeof ye.scrollTo=="function"?ye.scrollTo({top:Ae,behavior:"auto"}):ye.scrollTop=Ae}to=0,fn=Number.NEGATIVE_INFINITY,ye&&(tn=ye.scrollTop)}function Ki(){const ye=ee.value;!ye||ye.scrollHeight-ye.clientHeight<=1&&!s.hasMoreMessages||(je.value=!1,fo(),ye.scrollHeight-ye.clientHeight>1&&(Ke.value=!0))}function Er(ye){const Ae=ee.value;if(!Ae)return!1;for(const qe of ye.composedPath()){if(qe===Ae)return!1;if(qe instanceof HTMLElement&&qe.scrollHeight>qe.clientHeight+1&&qe.scrollTop>1)return!0}return!1}function ci(ye){ye.defaultPrevented||ye.ctrlKey||ye.shiftKey||(no(),!(ye.deltaY>=0||Er(ye))&&Ki())}function $l(ye){const Ae=ee.value;if(!Ae||ye.defaultPrevented||ye.button!==0||ye.pointerType==="touch")return;const qe=Ae.getBoundingClientRect(),Mt=Ae.offsetWidth-Ae.clientWidth,Jt=Mt>0?Mt:12;ye.target===Ae&&ye.clientX>=qe.right-Jt&&Ki()}let qo=null;function Ir(ye){qo=ye.touches.length===1?ye.touches[0].clientY:null}function Xs(ye){const Ae=ye.touches.length===1?ye.touches[0].clientY:null;no(),Ae!==null&&qo!==null&&Ae>qo+2&&!Er(ye)&&Ki(),qo=Ae}function di(){if(!ko)return;const ye=ee.value?.firstElementChild??null;ye!==qi&&(qi&&ko.unobserve(qi),qi=ye,ye&&ko.observe(ye))}function se(){if(!ko)return;const ye=ce.value;ye!==gt&&(gt&&ko.unobserve(gt),gt=ye,ye&&ko.observe(ye))}function xe(){const ye=ee.value;Ht(),ho&&(ho.disconnect(),ye&&ho.observe(ye,{childList:!0,subtree:!0,characterData:!0})),ko&&(ko.disconnect(),qi=null,gt=null,ye&&ko.observe(ye),di(),se()),Le=ye?.scrollHeight??0,Ge=ye?.clientHeight??0,ve(),Ee()}function J(){di(),tl(),ve(),Ee()}function we(){typeof document>"u"||document.visibilityState==="visible"&&je.value&&Io()}const $e=Z(!1);let He=null;function vt(){$e.value=!0,He!==null&&clearTimeout(He),He=setTimeout(()=>{$e.value=!1},OLe)}const ut=Z(null);let Pt=null;const Tt=Z(null);let ln=null,so=!1;function Rt(){ut.value=null,Tt.value=null,so=!1,Pt!==null&&(clearTimeout(Pt),Pt=null),ln!==null&&(clearTimeout(ln),ln=null)}function Ot(){for(let ye=s.turns.length-1;ye>=0;ye--){const Ae=s.turns[ye];if(Ae.goalContinuation)return null;if(Ae.role==="user")return Ae}return null}function Zn(ye){return na(ye).some(Ae=>Ae.kind==="thinking"&&Ae.thinking.trim().length>0||Ae.kind==="text"&&Ae.text.trim().length>0||Ae.kind==="tool")}function bo(){if(ut.value!==null||Tt.value!==null||!s.working||(s.queued?.length??0)>0)return;const ye=Ot();if(ye===null||ye.skillActivation!==void 0||ye.pluginCommand!==void 0)return;s.turns.slice(s.turns.indexOf(ye)+1).every(qe=>qe.role==="assistant"&&!Zn(qe))?(Tt.value=ye.id,so=!1,ln=setTimeout(()=>{Tt.value=null},DLe)):ut.value=ye.id}let ms=!1,Ns=null;function Js(ye){if(ms)return;Rt();const Ae=s.turns.find(Mt=>Mt.id===ye);Ae===void 0||Ae.role!=="user"||Ot()?.id!==Ae.id||(_.value??w.value)?.isEmpty?.()===!1||(ms=!0,Ns=setTimeout(()=>{ms=!1,Ns=null},BLe),jo({text:Ae.text,attachments:Ae.attachments}))}function $c(){Tt.value===null||s.working||!so||Js(Tt.value)}et(()=>s.working,(ye,Ae)=>{if(!(Ae!==!0||ye)){if(Tt.value!==null){$c();return}ut.value!==null&&Pt===null&&(Pt=setTimeout(()=>{ut.value=null,Pt=null},PLe))}}),et(()=>Ot()?.id??null,(ye,Ae)=>{ye!==Ae&&Rt()}),et(()=>s.sessionId,Rt),et(()=>s.queued?.length,ye=>{(ye??0)>0&&Rt()});const V2=R(()=>{if(s.lastTurnReason!=="cancelled"||s.working||s.turnActive)return null;const ye=s.turns[s.turns.length-1];return ye?.role==="assistant"&&Zn(ye)?ye.id:null}),Nc=R(()=>s.lastTurnReason==="failed"&&!s.working&&!s.turnActive&&s.turns.length>0);function vu(){Vi(),i("submit",{text:o("conversation.turnFailedResumeText"),attachments:[]})}const Fc=R(()=>s.working?null:ut.value);function Rc(){i("interrupt")}function q2(){return(_.value?.anyPopupOpen??w.value?.anyPopupOpen)===!0}const{handleCompositionStart:Nl,handleCompositionEnd:fi,isComposingKeyEvent:Sf}=Sr();let l0=null;function a0(ye){l0=ye.target}function Af(ye){const Ae=ye instanceof Element&&ye!==document.body?ye:l0,qe=pLe(Ae,".global-preview");if(qe){cS(qe);return}const Mt=ee.value?.querySelector(".chat");Mt&&cS(Mt)}function u0(ye){if(!(ye.target instanceof Element&&ye.target.closest(".terminal-host")!==null)){if(ye.key==="Escape"&&!s.overlayOpen&&!q2()&&!ye.defaultPrevented&&!ye.repeat&&!Sf(ye)){Fc.value!==null?(ye.preventDefault(),Js(Fc.value)):s.working&&(ye.preventDefault(),bo(),Rc());return}if($Ie(ye)&&!s.overlayOpen&&s.turns.length>0){ye.preventDefault(),st();return}dLe(ye)&&!s.overlayOpen&&!fLe(ye.target)&&(ye.preventDefault(),Af(ye.target))}}function c0(){je.value&&tl()}dn(()=>{yt(()=>{typeof MutationObserver=="function"&&(ho=new MutationObserver(J)),typeof ResizeObserver=="function"&&(ko=new ResizeObserver(()=>{ve(),Ee(),Ht();const ye=ee.value;if(!ye)return;const{scrollHeight:Ae,clientHeight:qe}=ye,Mt=Ae>Le+1,Jt=qe{ee.value?.removeEventListener("kimi-table-layout",G),ho&&ho.disconnect(),ko&&ko.disconnect(),Xt&&Xn(Xt),An&&Xn(An),Qe&&Xn(Qe),Mn&&Xn(Mn),oe&&Xn(oe),de&&Xn(de),Tn!==null&&clearTimeout(Tn),zt&&clearTimeout(zt),He!==null&&clearTimeout(He),Pt!==null&&clearTimeout(Pt),ln!==null&&clearTimeout(ln),Ns!==null&&clearTimeout(Ns),k!==null&&(clearTimeout(k),k=null),typeof document<"u"&&(document.removeEventListener("visibilitychange",we),document.removeEventListener("keydown",u0),document.removeEventListener("pointerdown",a0,!0),document.removeEventListener("compositionstart",Nl),document.removeEventListener("compositionend",fi)),window.visualViewport?.removeEventListener("resize",c0)});function Oc(){(_.value??w.value)?.focus()}mLe({sessionId:()=>s.sessionId,mobile:()=>s.mobile===!0,starting:()=>s.starting===!0,dockedComposer:_,emptyComposer:w});function K2(){vt()}function Z2(ye){if(Tt.value!==null){if(!ye){so||Rt();return}so=!0,$c()}}return t({loadComposerForEdit:y,focusComposer:Oc,notifyUndone:K2,onAbortOutcome:Z2,selectAllRegion:Af}),(ye,Ae)=>(b(),A("section",{class:Re(["con",{mobile:e.mobile}])},[!e.mobile&&!(e.turns.length===0&&!e.sessionLoading)?(b(),me(lSe,{key:0,"session-id":e.sessionId,"workspace-name":e.workspaceName,"workspace-root":e.workspaceRoot,"session-title":e.sessionTitle,branch:e.gitInfo?.branch,ahead:e.gitInfo?.ahead,behind:e.gitInfo?.behind,"changes-count":F.value,"git-diff-stats":e.gitDiffStats,"is-git-repo":!!e.gitInfo,pr:e.pr,copied:v.value,onOpenChanges:Ae[0]||(Ae[0]=qe=>i("openChanges")),onCopyAll:Ae[1]||(Ae[1]=qe=>m.value?.copyConversation()),onCopyFinalSummary:Ae[2]||(Ae[2]=qe=>m.value?.copyFinalSummary()),onOpenPr:Ae[3]||(Ae[3]=qe=>e.pr&&i("openPr",e.pr.url)),onRenameSession:Ae[4]||(Ae[4]=(qe,Mt)=>i("renameSession",qe,Mt)),onForkSession:Ae[5]||(Ae[5]=qe=>i("forkSession",qe)),onArchiveSession:Ae[6]||(Ae[6]=qe=>i("archiveSession",qe)),onExportSession:Ae[7]||(Ae[7]=qe=>i("exportSession",qe))},null,8,["session-id","workspace-name","workspace-root","session-title","branch","ahead","behind","changes-count","git-diff-stats","is-git-repo","pr","copied"])):e.mobile?te("",!0):(b(),A("div",{key:1,class:Re(["empty-drag",{"macos-desktop":p(uc)}])},null,2)),V(IIe,{items:K.value,"active-turn-id":ie.value,mobile:e.mobile,"session-loading":e.sessionLoading,occluded:pe.value,onSelect:ps},null,8,["items","active-turn-id","mobile","session-loading","occluded"]),C("div",{class:"chat-layout",style:Gt(Ye.value)},[C("div",{ref:Yt,class:Re(["panes chat-scroll",{"is-following":je.value,"history-prepending":ts.value,"is-pinned":en.value,scrolling:Ze.value,"session-settling":sn.value}]),onScrollPassive:Co,onWheelPassive:ci,onPointerdownPassive:$l,onTouchstartPassive:Ir,onTouchmovePassive:Xs},[C("div",{class:Re(["content-wrap",[e.mobile?"align-mobile":"align-center"]])},[e.turns.length===0&&!e.sessionLoading?(b(),A(Pe,{key:0},[Ae[55]||(Ae[55]=C("div",{class:"empty-spacer"},null,-1)),C("div",gLe,[e.starting?(b(),A("span",yLe,[V(p(Ao),{size:"sm"}),C("span",null,N(p(o)("conversation.starting")),1)])):(b(),me(lLe,{key:0,class:"empty-doodle"},{fallback:ke(()=>[C("span",vLe,N(p(o)("composer.emptyConversationTitle")),1)]),_:1})),e.starting?te("",!0):(b(),A("span",kLe,N(p(o)("composer.emptyConversation")),1))]),d.value?(b(),A("div",bLe,[V(p(Ie),{class:"upgrade-banner-icon",name:"music",size:"sm"}),C("span",CLe,N(p(o)("composer.upgradeBanner")),1),C("button",{type:"button",class:"upgrade-banner-cta",onClick:Ae[8]||(Ae[8]=qe=>p(o0)())},N(p(o)("sidebar.upgrade")),1)])):te("",!0),V(oF,{ref_key:"emptyComposerRef",ref:w,class:"empty-composer","session-id":e.sessionId,running:e.running,working:e.working,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,goal:e.goal,"activation-badges":e.activationBadges,models:e.models,"auth-ready":e.authReady,"managed-signed-in":e.managedSignedIn,"managed-membership":e.managedMembership,"starred-ids":e.starredIds,skills:e.skills,starting:e.starting,"hide-context":"",onSubmit:Ys,onSteer:Ae[11]||(Ae[11]=qe=>i("steer",qe)),onCommand:Ae[12]||(Ae[12]=qe=>i("command",qe)),onInterrupt:Rc,onUnqueue:Ae[13]||(Ae[13]=qe=>i("unqueue",qe)),onEditQueued:Ae[14]||(Ae[14]=qe=>i("editQueued",qe)),onSetPermission:Ae[15]||(Ae[15]=qe=>i("setPermission",qe)),onSetThinking:Ae[16]||(Ae[16]=qe=>i("setThinking",qe)),onTogglePlan:Ae[17]||(Ae[17]=qe=>i("togglePlan")),onToggleSwarm:Ae[18]||(Ae[18]=qe=>i("toggleSwarm")),onToggleGoal:Ae[19]||(Ae[19]=qe=>i("toggleGoal")),onOpenBtw:Ae[20]||(Ae[20]=qe=>i("command",{cmd:"/btw",attachments:[]})),onCreateGoal:Ae[21]||(Ae[21]=qe=>i("createGoal",qe)),onControlGoal:Ae[22]||(Ae[22]=qe=>i("controlGoal",qe)),onFocusGoal:U,onCompact:Ae[23]||(Ae[23]=qe=>i("compact")),onPickModel:Ae[24]||(Ae[24]=qe=>i("pickModel")),onSelectModel:Ae[25]||(Ae[25]=qe=>i("selectModel",qe)),onLogin:Ae[26]||(Ae[26]=qe=>i("login"))},cA({_:2},[e.starting?void 0:{name:"footer",fn:ke(()=>[C("div",wLe,[c.value?(b(),A("div",_Le,[V(p(Pn),{text:p(o)("conversation.switchWorkspace")},{default:ke(()=>[C("button",{type:"button",class:Re(["ws-chip",{open:r.value}]),"aria-expanded":r.value,onClick:Et(h,["stop"])},[V(p(Ie),{name:"folder"}),C("span",SLe,N(u.value),1),V(p(Ie),{class:"ws-chip-chev",name:"chevron-down",size:"sm"})],10,xLe)]),_:1},8,["text"]),r.value?(b(),A("div",{key:0,class:Re(["ws-panel",{up:l.value}]),style:Gt(a.value?{maxHeight:a.value}:void 0),role:"menu"},[C("div",ALe,N(p(o)("workspace.recentLabel")),1),(b(!0),A(Pe,null,pt(f.value,qe=>(b(),A("button",{key:qe.id,type:"button",class:Re(["ws-row",{on:qe.id===e.activeWorkspaceId}]),role:"menuitem",onClick:Et(Mt=>g(qe.id),["stop"])},[V(p(Ie),{name:"folder"}),C("span",TLe,[C("span",ELe,N(qe.name),1),C("span",ILe,N(qe.shortPath),1)]),qe.id===e.activeWorkspaceId?(b(),me(p(Ie),{key:0,class:"ws-check",name:"check",size:"sm"})):te("",!0)],10,MLe))),128)),Ae[54]||(Ae[54]=C("div",{class:"ws-divider"},null,-1)),C("button",{type:"button",class:"ws-action",role:"menuitem",onClick:Ae[9]||(Ae[9]=Et(qe=>{r.value=!1,i("addWorkspace")},["stop"]))},[V(p(Ie),{name:"folder-plus"}),C("span",null,N(p(o)("conversation.pickFolder")),1)])],6)):te("",!0)])):(b(),A("button",{key:1,type:"button",class:"ws-chip ws-ghost",onClick:Ae[10]||(Ae[10]=qe=>i("addWorkspace"))},[V(p(Ie),{name:"folder-plus"}),C("span",null,N(p(o)("conversation.pickFolder")),1)]))])]),key:"0"}]),1032,["session-id","running","working","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","goal","activation-badges","models","auth-ready","managed-signed-in","managed-membership","starred-ids","skills","starting"]),r.value?(b(),A("div",{key:1,class:"ws-backdrop",onClick:Ae[27]||(Ae[27]=qe=>r.value=!1)})):te("",!0),Ae[56]||(Ae[56]=C("div",{class:"empty-spacer"},null,-1))],64)):(b(),me(J5,{ref_key:"chatPaneRef",ref:m,key:e.fileReloadKey??"no-session",turns:e.turns,cwd:e.status.cwd,approvals:e.approvals,questions:e.questions,"turn-active":e.turnActive,working:e.working,"session-loading":e.sessionLoading,compaction:e.compaction,"has-more-messages":e.hasMoreMessages,"loading-more":e.loadingMore,"loading-more-error":e.loadingMoreError,"is-following":je.value,queued:e.queued,"undo-hint-turn-id":Fc.value,"interrupted-turn-id":V2.value,"turn-failed":Nc.value,"turn-error":e.turnError??null,"turn-retry":e.turnRetry??null,onResumeTurn:vu,onOpenFile:Ae[28]||(Ae[28]=qe=>i("openFile",qe)),onOpenMedia:Ae[29]||(Ae[29]=qe=>i("openMedia",qe)),onOpenTurnDiff:Ae[30]||(Ae[30]=qe=>i("openTurnDiff",qe)),onCopyConversationCopied:x,onOpenCompaction:Ae[31]||(Ae[31]=qe=>i("openCompaction",qe)),onOpenAgent:Ae[32]||(Ae[32]=qe=>i("openAgent",qe)),onEditMessage:jo,onArmedUndo:Js,onLoadOlderMessages:To,onUnqueue:Ae[33]||(Ae[33]=qe=>i("unqueue",qe)),onEditQueued:Vo,onReorderQueue:Il},null,8,["turns","cwd","approvals","questions","turn-active","working","session-loading","compaction","has-more-messages","loading-more","loading-more-error","is-following","queued","undo-hint-turn-id","interrupted-turn-id","turn-failed","turn-error","turn-retry"]))],2)],34),e.turns.length===0&&!e.sessionLoading?te("",!0):(b(),me(_Ie,{key:0,ref:_n,style:Gt(Oe.value),"session-id":e.sessionId,running:e.running,working:e.working,starting:e.starting,queued:e.queued,"search-files":e.searchFiles,"upload-image":e.uploadImage,status:e.status,thinking:e.thinking,"plan-mode":e.planMode,"swarm-mode":e.swarmMode,"goal-mode":e.goalMode,"activation-badges":e.activationBadges,models:e.models,"auth-ready":e.authReady,"managed-signed-in":e.managedSignedIn,"managed-membership":e.managedMembership,"starred-ids":e.starredIds,skills:e.skills,goal:e.goal,"dock-panel":O.value,"bash-tasks":M.value,"subagent-tasks":$.value,"bash-running":S.value,"subagent-running":I.value,"todo-done-count":B.value,"has-dock-work":H.value,todos:e.todos,"pending-question":fe.value,"question-busy-kind":Ce.value,"pending-approval":ge.value,"approval-busy":Q.value,mobile:e.mobile,onToggleDockPanel:Ae[34]||(Ae[34]=qe=>W(qe)),onCloseDockPanel:Ae[35]||(Ae[35]=qe=>z()),onOpenAgent:Ae[36]||(Ae[36]=qe=>i("openAgent",qe)),"open-file":qe=>i("openFile",qe),onAnswer:cr,onDismiss:Ae[37]||(Ae[37]=qe=>i("dismiss",qe)),onApproval:Tr,onCancelTask:Ae[38]||(Ae[38]=qe=>i("cancelTask",qe)),onControlGoal:Ae[39]||(Ae[39]=qe=>i("controlGoal",qe)),onSubmit:Ys,onSteer:Ae[40]||(Ae[40]=qe=>i("steer",qe)),onCommand:Ae[41]||(Ae[41]=qe=>i("command",qe)),onInterrupt:Rc,onSetPermission:Ae[42]||(Ae[42]=qe=>i("setPermission",qe)),onSetThinking:Ae[43]||(Ae[43]=qe=>i("setThinking",qe)),onTogglePlan:Ae[44]||(Ae[44]=qe=>i("togglePlan")),onToggleSwarm:Ae[45]||(Ae[45]=qe=>i("toggleSwarm")),onToggleGoal:Ae[46]||(Ae[46]=qe=>i("toggleGoal")),onOpenBtw:Ae[47]||(Ae[47]=qe=>i("command",{cmd:"/btw",attachments:[]})),onCreateGoal:Ae[48]||(Ae[48]=qe=>i("createGoal",qe)),onFocusGoal:U,onCompact:Ae[49]||(Ae[49]=qe=>i("compact")),onPickModel:Ae[50]||(Ae[50]=qe=>i("pickModel")),onSelectModel:Ae[51]||(Ae[51]=qe=>i("selectModel",qe)),onLogin:Ae[52]||(Ae[52]=qe=>i("login"))},null,8,["style","session-id","running","working","starting","queued","search-files","upload-image","status","thinking","plan-mode","swarm-mode","goal-mode","activation-badges","models","auth-ready","managed-signed-in","managed-membership","starred-ids","skills","goal","dock-panel","bash-tasks","subagent-tasks","bash-running","subagent-running","todo-done-count","has-dock-work","todos","pending-question","question-busy-kind","pending-approval","approval-busy","mobile","open-file"]))],4),Ue.value?(b(),me(nLe,{key:2,ref_key:"transcriptSearchRef",ref:_e,pane:ee.value,mobile:e.mobile,reveal:$s,onClose:Fe},null,8,["pane","mobile"])):te("",!0),V(as,{name:"pill"},{default:ke(()=>[Ke.value?(b(),A("button",{key:0,class:"newmsg-pill",style:Gt({bottom:`${Se.value+12}px`}),"aria-label":p(o)("conversation.jumpToLatestAria"),onClick:Ae[53]||(Ae[53]=qe=>Po(!0))},[V(p(Ie),{class:"pill-chevron",name:"arrow-down",size:"sm"}),Ve(" "+N(p(o)("conversation.newMessages")),1)],12,LLe)):te("",!0)]),_:1}),V(as,{name:"undo-toast"},{default:ke(()=>[$e.value?(b(),A("div",$Le,[C("span",NLe,N(p(o)("conversation.undone")),1)])):te("",!0)]),_:1})],2))}}),zLe=ht(HLe,[["__scopeId","data-v-5c8c2c41"]]),WLe={key:0,class:"fp-empty fp-error"},ULe={key:1,class:"fp-empty"},jLe={key:2,class:"fp-loading"},VLe={class:"fp-path"},qLe={class:"fp-meta"},KLe={key:0,class:"fp-lines"},ZLe={class:"fp-size"},GLe={key:3,class:"fp-search"},YLe=["placeholder"],XLe={key:0,class:"fp-search-count"},JLe=["href","aria-label"],QLe={key:1,class:"fp-code"},e$e={key:1,class:"fp-body fp-code"},t$e={key:2,class:"fp-body"},n$e=["srcdoc","title"],o$e={key:1,class:"fp-code"},s$e={key:3,class:"fp-body fp-pdf-wrap"},i$e=["src","title"],r$e={key:1,class:"fp-binary-card"},l$e={class:"fp-binary-label"},a$e={key:4,class:"fp-body fp-table-wrap"},u$e={class:"fp-table"},c$e=["data-line"],d$e={key:5,class:"fp-body fp-image-wrap"},f$e=["src","alt"],p$e={key:1,class:"fp-binary-card"},h$e={class:"fp-binary-icon"},m$e={class:"fp-binary-label"},g$e={key:6,class:"fp-body fp-code"},v$e={key:7,class:"fp-body fp-binary-wrap"},y$e={class:"fp-binary-card"},k$e={class:"fp-binary-icon"},b$e={class:"fp-binary-label"},C$e=tt({__name:"FilePreview",props:{file:{},loading:{type:Boolean},error:{},line:{},downloadUrl:{},closable:{type:Boolean},externalActions:{type:Boolean},openFile:{type:Function}},emits:["close","openExternal","reveal"],setup(e,{emit:t}){const{t:n}=Lt();function o(de,he){const pe=he.startsWith("/"),oe=he.split("/").filter(Boolean);for(const ve of de.split("/"))ve===""||ve==="."||(ve===".."?oe.pop():oe.push(ve));return(pe?"/":"")+oe.join("/")}const s=on("resolveImage",async de=>de),i=R(()=>{const de=u.file?.path??"",he=de.lastIndexOf("/");return he>0?de.slice(0,he):""});function r(de){if(/^(https?:|data:|blob:)/i.test(de)||de.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(de)||de.startsWith("\\\\"))return de;const he=i.value;return he?o(de,he):de}async function l(de){const he=r(de);return s?s(he):he}En("resolveImage",l);function a(de){let he=de.path;if(/^(https?:|mailto:|tel:|data:|blob:|#)/i.test(he)||he.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(he)||he.startsWith("\\\\"))return de;for(const oe of["#","?"]){const ve=he.indexOf(oe);ve!==-1&&(he=he.slice(0,ve))}const pe=i.value;return{...de,path:o(he,pe)}}const u=e,c=t;function d(de){u.openFile?.(a(de))}const f=Z(null),h=R(()=>{const de=u.file;if(!de)return"binary";const he=de.mime??"",pe=de.languageId??"",oe=de.path.toLowerCase();return he==="text/markdown"||pe==="markdown"||pe==="md"||oe.endsWith(".mdx")?"markdown":he==="application/json"||pe==="json"?"json":he==="text/html"||pe==="html"||oe.endsWith(".html")||oe.endsWith(".htm")?"html":he==="application/pdf"||oe.endsWith(".pdf")?"pdf":he==="text/csv"||pe==="csv"||oe.endsWith(".csv")?"csv":he.startsWith("image/")?"image":de.isBinary?"binary":he.startsWith("text/")||pe!==""?"text":"binary"});function g(de){const he=atob(de),pe=Uint8Array.from(he,oe=>oe.charCodeAt(0));return new TextDecoder().decode(pe)}const m=R(()=>{const de=u.file;if(!de)return"";if(de.encoding==="base64")try{return g(de.content)}catch{return de.content}return de.content}),w=R(()=>{if(h.value!=="json"||!u.file)return"";try{return JSON.stringify(JSON.parse(m.value),null,2)}catch{return m.value}}),_=R(()=>u.file?(h.value==="json"?w.value:m.value).split(` -`):[]),v=R(()=>u.file?h.value==="json"?w.value:m.value:""),k=R(()=>_.value.map((de,he)=>he+1)),y=R(()=>u.file&&v.value.length<=uy?u.file.path:void 0),x=Z(""),M=Z(0),$=R(()=>{const de=x.value.trim().toLowerCase();if(!de)return[];const he=[];return _.value.forEach((pe,oe)=>{pe.toLowerCase().includes(de)&&he.push(oe+1)}),he});et(x,()=>{M.value=0});function S(de,he=!1){de&&yt(()=>{const pe=f.value?.querySelector(".fp-body"),oe=pe?.querySelector(`[data-line="${de}"]`);if(!pe||!oe)return;he&&(pe.scrollTop=0);const ve=pe.getBoundingClientRect(),G=oe.getBoundingClientRect(),X=G.top-ve.top+pe.scrollTop;pe.scrollTop=X-pe.clientHeight/2+G.height/2})}et(()=>[u.file?.path,u.line],()=>S(u.line,!0),{immediate:!0});function I(de){const he=$.value;he.length!==0&&(M.value=(M.value+de+he.length)%he.length,S(he[M.value]))}function P(de){const he=$.value;return{target:u.line===de,hit:he.includes(de),active:he[M.value]===de}}function D(de){return de<1024?`${de} B`:de<1024*1024?`${(de/1024).toFixed(1)} KB`:`${(de/(1024*1024)).toFixed(1)} MB`}const T=Z(!1),L=Z(!1);function B(){u.file&&js(v.value).then(de=>{de&&(T.value=!0,setTimeout(()=>{T.value=!1},1400))})}function H(){u.file&&js(u.file.path).then(de=>{de&&(L.value=!0,setTimeout(()=>{L.value=!1},1400))})}const O=Z("preview"),F=Z("preview"),W=Z("fit");function z(de){O.value=de}function U(de){F.value=de}function q(de){W.value=de}et(h,de=>{O.value=de==="html"?"preview":"source",F.value="preview",W.value="fit"});const K=R(()=>{const de=u.file;return!de||h.value!=="image"?null:de.sourceUrl?de.sourceUrl:de.encoding==="base64"?`data:${de.mime};base64,${de.content}`:de.mime==="image/svg+xml"?`data:${de.mime};charset=utf-8,${encodeURIComponent(de.content)}`:null}),ie=R(()=>{const de=u.file;return!de||h.value!=="pdf"?null:u.downloadUrl?u.downloadUrl:de.encoding==="base64"?`data:${de.mime};base64,${de.content}`:null}),ne=R(()=>u.file?["",'',``,m.value].join(""):"");function Y(de){const he=[];let pe="",oe=!1;for(let ve=0;ve_.value.slice(0,200).map(Y));function Ee(de,he=55){return!de||de.length<=he?de:"…"+de.slice(de.length-he+1)}return(de,he)=>(b(),A("div",{ref_key:"rootRef",ref:f,class:"file-preview"},[e.error&&!e.loading?(b(),A("div",WLe,[C("span",null,N(e.error),1),e.closable?(b(),me(p(Ft),{key:0,variant:"secondary",size:"sm",onClick:he[0]||(he[0]=pe=>c("close"))},{default:ke(()=>[Ve(N(p(n)("filePreview.close")),1)]),_:1})):te("",!0)])):!e.file&&!e.loading?(b(),A("div",ULe,N(p(n)("filePreview.empty")),1)):e.loading?(b(),A("div",jLe,[he[7]||(he[7]=C("span",{class:"spinner"},null,-1)),C("span",null,N(p(n)("filePreview.loading")),1)])):e.file?(b(),A(Pe,{key:3},[V(p(fc),{wrap:"",title:p(n)("common.preview"),closable:e.closable,"close-label":p(n)("filePreview.close"),onClose:he[6]||(he[6]=pe=>c("close"))},{default:ke(()=>[V(p(Pn),{text:e.file.path},{default:ke(()=>[C("span",VLe,N(Ee(e.file.path)),1)]),_:1},8,["text"]),C("span",qLe,[e.file.lineCount?(b(),A("span",KLe,N(p(n)("filePreview.lineCount",{count:e.file.lineCount})),1)):te("",!0),C("span",ZLe,N(D(e.file.size)),1)]),h.value==="html"?(b(),me(p(bi),{key:0,"model-value":O.value,size:"sm",options:[{value:"preview",label:p(n)("filePreview.preview")},{value:"source",label:p(n)("filePreview.source")}],"onUpdate:modelValue":z},null,8,["model-value","options"])):te("",!0),h.value==="markdown"?(b(),me(p(bi),{key:1,"model-value":F.value,size:"sm",options:[{value:"preview",label:p(n)("filePreview.preview")},{value:"source",label:p(n)("filePreview.source")}],"onUpdate:modelValue":U},null,8,["model-value","options"])):te("",!0),h.value==="image"?(b(),me(p(bi),{key:2,"model-value":W.value,size:"sm",options:[{value:"fit",label:p(n)("filePreview.fit")},{value:"actual",label:p(n)("filePreview.actual")}],"onUpdate:modelValue":q},null,8,["model-value","options"])):te("",!0),h.value==="text"||h.value==="json"||h.value==="html"||h.value==="csv"?(b(),A("div",GLe,[In(C("input",{"onUpdate:modelValue":he[1]||(he[1]=pe=>x.value=pe),class:"fp-search-input",type:"search",placeholder:p(n)("filePreview.search")},null,8,YLe),[[ri,x.value]]),x.value.trim()?(b(),A("span",XLe,N($.value.length),1)):te("",!0),V(p(gn),{size:"sm",disabled:$.value.length===0,label:p(n)("filePreview.prevMatch"),onClick:he[2]||(he[2]=pe=>I(-1))},{default:ke(()=>[V(p(Ie),{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),V(p(gn),{size:"sm",disabled:$.value.length===0,label:p(n)("filePreview.nextMatch"),onClick:he[3]||(he[3]=pe=>I(1))},{default:ke(()=>[V(p(Ie),{name:"arrow-down",size:"md"})]),_:1},8,["disabled","label"])])):te("",!0),V(p(gn),{size:"sm",class:Re({copied:L.value}),label:L.value?p(n)("filePreview.copied"):p(n)("filePreview.copyPath"),onClick:H},{default:ke(()=>[L.value?(b(),me(p(Ie),{key:1,class:"fp-check",name:"check",size:"md"})):(b(),me(p(Ie),{key:0,name:"link",size:"md"}))]),_:1},8,["class","label"]),e.externalActions?(b(),me(p(gn),{key:4,size:"sm",label:p(n)("filePreview.openInEditor"),onClick:he[4]||(he[4]=pe=>c("openExternal"))},{default:ke(()=>[V(p(Ie),{name:"external-link",size:"md"})]),_:1},8,["label"])):te("",!0),e.externalActions?(b(),me(p(gn),{key:5,size:"sm",label:p(n)("filePreview.reveal"),onClick:he[5]||(he[5]=pe=>c("reveal"))},{default:ke(()=>[V(p(Ie),{name:"folder",size:"md"})]),_:1},8,["label"])):te("",!0),e.downloadUrl?(b(),A("a",{key:6,class:"fp-download",href:e.downloadUrl,target:"_blank",rel:"noreferrer",download:"","aria-label":p(n)("filePreview.download")},[V(p(Ie),{name:"download",size:"md"})],8,JLe)):te("",!0),!e.file.isBinary&&h.value!=="image"?(b(),me(p(gn),{key:7,size:"sm",class:Re({copied:T.value}),label:T.value?p(n)("filePreview.copied"):p(n)("filePreview.copy"),onClick:B},{default:ke(()=>[T.value?(b(),me(p(Ie),{key:1,class:"fp-check",name:"check",size:"md"})):(b(),me(p(Ie),{key:0,name:"copy",size:"md"}))]),_:1},8,["class","label"])):te("",!0)]),_:1},8,["title","closable","close-label"]),h.value==="markdown"?(b(),A("div",{key:0,class:Re(["fp-body",{"fp-markdown":F.value==="preview"}])},[F.value==="preview"?(b(),me(p(Ic),{key:0,text:m.value,"open-file":u.openFile?d:void 0},null,8,["text","open-file"])):(b(),A("div",QLe,[V(Ur,{code:_.value,path:y.value,"line-numbers":k.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])]))],2)):h.value==="json"?(b(),A("div",e$e,[V(Ur,{code:_.value,path:y.value,"line-numbers":k.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])])):h.value==="html"?(b(),A("div",t$e,[O.value==="preview"?(b(),A("iframe",{key:0,class:"fp-html-frame",sandbox:"",srcdoc:ne.value,title:e.file.path},null,8,n$e)):(b(),A("div",o$e,[V(Ur,{code:_.value,path:y.value,"line-numbers":k.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])]))])):h.value==="pdf"?(b(),A("div",s$e,[ie.value?(b(),A("iframe",{key:0,class:"fp-pdf-frame",src:ie.value,title:e.file.path},null,8,i$e)):(b(),A("div",r$e,[C("span",l$e,N(p(n)("filePreview.pdfNoPreview")),1)]))])):h.value==="csv"?(b(),A("div",a$e,[C("table",u$e,[C("tbody",null,[(b(!0),A(Pe,null,pt(le.value,(pe,oe)=>(b(),A("tr",{key:oe,class:Re(P(oe+1)),"data-line":oe+1},[C("th",null,N(oe+1),1),(b(!0),A(Pe,null,pt(pe,(ve,G)=>(b(),A("td",{key:G},N(ve),1))),128))],10,c$e))),128))])])])):h.value==="image"?(b(),A("div",d$e,[K.value?(b(),A("img",{key:0,src:K.value,alt:e.file.path,class:Re(["fp-image",{actual:W.value==="actual"}])},null,10,f$e)):(b(),A("div",p$e,[C("span",h$e,[V(p(Ie),{name:"image-off",size:"lg"})]),C("span",m$e,N(p(n)("filePreview.imageNoPreview",{mime:e.file.mime,size:D(e.file.size)})),1)]))])):h.value==="text"?(b(),A("div",g$e,[V(Ur,{code:_.value,path:y.value,"line-numbers":k.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])])):(b(),A("div",v$e,[C("div",y$e,[C("span",k$e,[V(p(Ie),{name:"file-off",size:"lg"})]),C("span",b$e,N(p(n)("filePreview.binaryNoPreview",{mime:e.file.mime||p(n)("filePreview.unknownType"),size:D(e.file.size)})),1)])]))],64)):te("",!0)],512))}}),w$e=ht(C$e,[["__scopeId","data-v-72bb9faa"]]),_$e={class:"tp"},x$e=tt({__name:"ThinkingPanel",props:{text:{},subtitle:{}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=Z(null);return et(()=>n.text,()=>{const r=i.value;!r||!(r.scrollHeight-r.scrollTop-r.clientHeight<24)||yt(()=>{i.value&&(i.value.scrollTop=i.value.scrollHeight)})},{immediate:!0}),(r,l)=>(b(),A("div",_$e,[V(p(fc),{title:p(s)("common.preview"),subtitle:e.subtitle??p(s)("thinking.panelTitle"),"close-label":p(s)("thinking.close"),onClose:l[0]||(l[0]=a=>o("close"))},null,8,["title","subtitle","close-label"]),C("pre",{ref_key:"bodyEl",ref:i,class:"tp-body"},N(e.text),513)]))}}),S$e=ht(x$e,[["__scopeId","data-v-b154dd00"]]),A$e=24;function M$e(e){const t=Z(null),n=Z(!0);let o=null,s=null,i=null,r=0,l=0,a=!1,u=0;function c(){const w=t.value;w&&(w.scrollTop=Math.max(w.scrollTop,r))}function d(){const _=t.value?.firstElementChild??null;_!==i&&(i&&o?.unobserve(i),i=_,_&&o?.observe(_))}function f(){const w=t.value;!w||a||(n.value=r-w.scrollTop-lh(w));return}requestAnimationFrame(()=>{requestAnimationFrame(()=>h(w))})}function m(){const w=t.value;w&&(o?.disconnect(),s?.disconnect(),i=null,a=!1,u++,r=0,l=0,typeof ResizeObserver=="function"?(o=new ResizeObserver(()=>{const _=t.value;if(!_)return;const{scrollHeight:v,clientHeight:k}=_,y=v>r+1,x=k{n.value=!0,yt(m)}),et(t,()=>void yt(m)),dn(()=>void yt(m)),kn(()=>{u++,o?.disconnect(),s?.disconnect()}),{scroller:t,following:n,onScroll:f,pinScroll:g}}const T$e={class:"agent-panel"},E$e={key:0,class:"agent-fallback"},I$e={key:0,class:"agent-error"},L$e=tt({__name:"AgentDetailPanel",props:{member:{},turns:{},running:{type:Boolean},loading:{type:Boolean},loadError:{type:Boolean},hasMore:{type:Boolean},loadingMore:{type:Boolean},loadMoreError:{type:Boolean}},emits:["close","loadOlderMessages","openAgent","openFile","openMedia","openTurnDiff"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>n.member.id),{scroller:r,following:l,onScroll:a,pinScroll:u}=M$e(i),c=Z(!1);let d=null,f=null;function h(){d!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(d),f!==null&&clearTimeout(f),d=null,f=null}et(i,()=>{c.value=!1,h();const k=()=>{h(),c.value=!0};typeof requestAnimationFrame=="function"?d=requestAnimationFrame(()=>{d=requestAnimationFrame(k)}):f=setTimeout(k,32)},{immediate:!0}),Un(h);const g=R(()=>{const k=new Set,y=[];for(const x of[n.member.suspendedReason,n.member.text,n.member.outputLines?.join(` -`),n.member.summary]){const M=x?.trim();!M||k.has(M)||(k.add(M),y.push(M))}return y});En("pinScroll",()=>{r.value&&u()});function m(k){switch(k){case"queued":return s("tools.swarm.phaseQueued");case"working":return s("tools.swarm.phaseWorking");case"suspended":return s("tools.swarm.phaseSuspended");case"completed":return s("tools.swarm.phaseCompleted");case"failed":return s("tools.swarm.phaseFailed")}}const w=on("modelDisplay"),_=on("subagentEffort"),v=R(()=>{const k=[n.member.subagentType,w?.(n.member.model),_?.(n.member.thinkingEffort)].filter(y=>!!y);return k.length>0?k.join(" · "):void 0});return(k,y)=>(b(),A("div",T$e,[V(p(fc),{title:e.member.name,subtitle:v.value,"close-label":p(s)("thinking.close"),onClose:y[0]||(y[0]=x=>o("close"))},{default:ke(()=>[V(p(Vr),{variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(m(e.member.phase)),1)]),_:1})]),_:1},8,["title","subtitle","close-label"]),C("div",{ref_key:"scroller",ref:r,class:"agent-transcript",onScrollPassive:y[6]||(y[6]=(...x)=>p(a)&&p(a)(...x))},[c.value?(b(),A(Pe,{key:0},[e.turns.length===0&&!e.loading&&(e.loadError||g.value.length>0)?(b(),A("div",E$e,[e.loadError?(b(),A("div",I$e,N(p(s)("tasks.transcriptLoadError")),1)):te("",!0),g.value.length>0?(b(),me(ur,{key:1,lines:g.value},null,8,["lines"])):te("",!0)])):(b(),me(J5,{key:1,turns:e.turns,"turn-active":e.running,"session-loading":e.loading&&e.turns.length===0,"has-more-messages":e.hasMore,"loading-more":e.loadingMore,"loading-more-error":e.loadMoreError,"is-following":p(l),"read-only":"",onLoadOlderMessages:y[1]||(y[1]=x=>o("loadOlderMessages")),onOpenAgent:y[2]||(y[2]=x=>o("openAgent",x)),onOpenFile:y[3]||(y[3]=x=>o("openFile",x)),onOpenMedia:y[4]||(y[4]=x=>o("openMedia",x)),onOpenTurnDiff:y[5]||(y[5]=x=>o("openTurnDiff",x))},null,8,["turns","turn-active","session-loading","has-more-messages","loading-more","loading-more-error","is-following"]))],64)):te("",!0)],544)]))}}),$$e=ht(L$e,[["__scopeId","data-v-e6db79da"]]),N$e={class:"sc"},F$e={key:0,class:"sc-empty"},R$e={key:2,class:"sc-loading"},O$e={class:"sc-composer"},P$e=["placeholder"],D$e=["disabled"],B$e=tt({__name:"SideChatPanel",props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:["send","close"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>n.turns.find(x=>x.role==="user")?.text?.trim()??""),r=R(()=>n.title?.trim()||s("sideChat.title")),l=R(()=>n.subtitle?.trim()?n.subtitle.trim():i.value||s("sideChat.subtitle")),a=Z(""),u=Z(null),c=Z(null);function d(){const y=a.value.trim();y&&(o("send",y),a.value="",yt(()=>{u.value&&(u.value.style.height="auto"),f()}))}function f(){const y=c.value;y&&(y.scrollTop=y.scrollHeight)}En("pinScroll",y=>{const x=c.value;if(!x)return;const M=y.getBoundingClientRect().top;requestAnimationFrame(()=>{x.scrollTop+=y.getBoundingClientRect().top-M})});const h=R(()=>{const y=n.turns;if(y.length===0)return"0";const x=y.at(-1),M=x.thinking?.length??0,$=x.tools?.reduce((S,I)=>S+I.name.length+(I.arg?.length??0)+(I.output?.join("").length??0),0)??0;return`${y.length}:${x.text.length}:${M}:${$}`});et(h,async()=>{!n.running&&!n.sending||(await yt(),f())});const g=R(()=>n.sending?n.turns.at(-1)?.role==="user":!1),{handleCompositionStart:m,handleCompositionEnd:w,isComposingKeyEvent:_}=Sr();function v(y){y.key==="Enter"&&!y.shiftKey&&!_(y)&&(y.preventDefault(),d())}function k(){const y=u.value;y&&(y.style.height="auto",y.style.height=`${Math.min(y.scrollHeight,160)}px`)}return(y,x)=>(b(),A("div",N$e,[V(p(fc),{title:r.value,subtitle:l.value,"close-label":p(s)("thinking.close"),onClose:x[0]||(x[0]=M=>o("close"))},null,8,["title","subtitle","close-label"]),C("div",{ref_key:"bodyRef",ref:c,class:"sc-body"},[e.turns.length===0?(b(),A("div",F$e,N(p(s)("sideChat.empty")),1)):(b(),me(J5,{key:1,turns:e.turns,approvals:[],"turn-active":e.running,working:e.sending||e.running,"turn-files-interactive":!1},null,8,["turns","turn-active","working"])),g.value?(b(),A("div",R$e,[V(KN,{label:p(s)("conversation.requesting")},null,8,["label"])])):te("",!0)],512),C("div",O$e,[In(C("textarea",{ref_key:"inputRef",ref:u,"onUpdate:modelValue":x[1]||(x[1]=M=>a.value=M),class:"sc-input",rows:"1",placeholder:p(s)("sideChat.placeholder"),onInput:k,onKeydown:v,onCompositionstart:x[2]||(x[2]=(...M)=>p(m)&&p(m)(...M)),onCompositionend:x[3]||(x[3]=(...M)=>p(w)&&p(w)(...M))},null,40,P$e),[[ri,a.value]]),V(p(Pn),{text:p(s)("sideChat.send")},{default:ke(()=>[C("button",{type:"button",class:"sc-send",disabled:!a.value.trim(),onClick:d},[V(p(Ie),{name:"arrow-right",size:"sm"})],8,D$e)]),_:1},8,["text"])])]))}}),H$e=ht(B$e,[["__scopeId","data-v-b6455a56"]]),z$e={class:"changes-pane"},W$e={class:"dv-path"},U$e={class:"diff-head"},j$e={class:"back-label"},V$e={key:"loading",class:"empty-state diff-loading"},q$e={key:"lines",class:"dv-lines-wrap"},K$e={key:"empty",class:"empty-state"},Z$e={class:"dv-change-count"},G$e={class:"ch-head"},Y$e={class:"br-heading"},X$e={class:"br-label"},J$e={class:"br-name"},Q$e={key:0,class:"sync-info"},eNe={key:0,class:"ahead"},tNe={key:0,class:"behind"},nNe={key:1,class:"empty-head"},oNe={class:"ch-list-content"},sNe=["onClick"],iNe={class:"fpath"},rNe=["onClick"],lNe={class:"tree-name"},aNe=["onClick"],uNe={class:"tree-name"},cNe={key:2,class:"empty-state"},dNe={class:"empty-state-icon","aria-hidden":"true"},fNe={key:3,class:"empty-state"},pNe=tt({__name:"DiffView",props:{changes:{},gitInfo:{},fileDiff:{},fullTexts:{},emptyFile:{type:Boolean},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:"full"},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:["open","back","close"],setup(e,{emit:t}){const{t:n}=Lt();function o(L){return n(L===1?"diff.fileCountOne":"diff.fileCountOther",{number:L})}const s=e,i=t;function r(L){const B=L.toLowerCase();return B==="modified"?"modified":B==="added"?"added":B==="deleted"?"deleted":B==="renamed"?"renamed":B==="untracked"?"untracked":B==="conflicted"?"conflicted":B==="ignored"?"ignored":B==="clean"?"clean":"unknown"}const l={modified:"M",added:"+",deleted:"−",renamed:"→",untracked:"+",conflicted:"C",ignored:"I",clean:"·",unknown:"?"};function a(L){return l[r(L)]??"?"}function u(L,B=60){return L.length<=B?L:"…"+L.slice(L.length-B+1)}const c=R(()=>s.gitInfo!==null),d=R(()=>s.changes.length>0),f=R(()=>(s.selectedDiffPath??null)!==null),h=R(()=>s.mode==="detail"||s.mode==="full"&&f.value),g=R(()=>s.fileDiff??[]),m=R(()=>s.fileDiffLoading===!0);function w(L){i("open",L)}function _(){i("back")}function v(){i("close")}const k=Z("list");function y(L){k.value=L}function x(L){const B={children:[]},H=[...L].sort((O,F)=>O.path.localeCompare(F.path));for(const O of H){const F=O.path.endsWith("/"),W=O.path.split("/").filter(Boolean);if(W.length===0)continue;let z=B;for(let U=0;UY.name===q&&Y.kind===(K?"file":"folder"));ne||(ne={name:q,path:ie,kind:K?"file":"folder",status:K?O.status:void 0,children:[]},z.children.push(ne)),z=ne}}return B.children}const M=R(()=>x(s.changes)),$=Z(new Set);function S(L){return!$.value.has(L)}const I=R(()=>{const L=[];function B(H,O){for(const F of H)L.push({node:F,depth:O}),F.kind==="folder"&&S(F.path)&&B(F.children,O+1)}return B(M.value,0),L});function P(L){const B=new Set($.value);B.has(L.path)?B.delete(L.path):B.add(L.path),$.value=B}function D(L){return`calc(var(--tree-base-indent) + ${L} * var(--tree-indent-step))`}function T(L){return{paddingLeft:D(L),"--tree-depth":String(L)}}return(L,B)=>(b(),A("div",z$e,[h.value?(b(),A(Pe,{key:0},[V(p(fc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:v},{default:ke(()=>[V(p(Pn),{text:e.selectedDiffPath??""},{default:ke(()=>[C("span",W$e,N(u(e.selectedDiffPath??"",50)),1)]),_:1},8,["text"])]),_:1},8,["title","closable","close-label"]),C("div",U$e,[e.hideBack?te("",!0):(b(),me(p(Ft),{key:0,variant:"ghost",size:"sm",onClick:_},{default:ke(()=>[V(p(Ie),{name:"arrow-left",size:"sm"}),C("span",j$e,N(p(n)("diff.back")),1)]),_:1}))]),V(as,{name:"diff-content",mode:"out-in"},{default:ke(()=>[m.value?(b(),A("div",V$e,[V(p(Ao),{size:"md"}),C("span",null,N(p(n)("diff.loading")),1)])):g.value.length>0?(b(),A("div",q$e,[V(Ur,{lines:g.value,path:e.selectedDiffPath??void 0,"line-numbers":"",framed:!1,"full-texts":e.fullTexts??null},null,8,["lines","path","full-texts"])])):(b(),A("div",K$e,N(e.emptyFile?p(n)("diff.emptyFile"):p(n)("diff.noDiff")),1))]),_:1})],64)):(b(),A(Pe,{key:1},[V(p(fc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:v},{default:ke(()=>[C("span",Z$e,N(o(e.changes.length)),1),V(p(bi),{"model-value":k.value,size:"sm",options:[{value:"list",label:p(n)("diff.list"),icon:"list"},{value:"tree",label:p(n)("diff.tree"),icon:"tree-view"}],"onUpdate:modelValue":y},null,8,["model-value","options"])]),_:1},8,["title","closable","close-label"]),C("div",G$e,[c.value?(b(),A(Pe,{key:0},[C("span",Y$e,[V(p(Ie),{class:"br-icon",name:"git-fork",size:"sm"}),C("span",X$e,N(p(n)("diff.branch")),1)]),C("span",J$e,N(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(b(),A("span",Q$e,[V(p(Pn),{text:p(n)("diff.aheadTitle")},{default:ke(()=>[e.gitInfo.ahead>0?(b(),A("span",eNe,"↑"+N(e.gitInfo.ahead),1)):te("",!0)]),_:1},8,["text"]),V(p(Pn),{text:p(n)("diff.behindTitle")},{default:ke(()=>[e.gitInfo.behind>0?(b(),A("span",tNe,"↓"+N(e.gitInfo.behind),1)):te("",!0)]),_:1},8,["text"])])):te("",!0)],64)):(b(),A("span",nNe,N(p(n)("diff.empty")),1))]),d.value&&k.value==="list"?(b(),me(p(Ok),{key:0,class:"ch-list"},{default:ke(()=>[C("div",oNe,[(b(!0),A(Pe,null,pt(e.changes,H=>(b(),me(p(Pn),{key:H.path,text:H.path},{default:ke(()=>[C("button",{type:"button",class:"ch-row",onClick:O=>w(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",iNe,N(u(H.path)),1)],8,sNe)]),_:2},1032,["text"]))),128))])]),_:1})):d.value&&k.value==="tree"?(b(),me(p(Ok),{key:1,class:"ch-list ch-tree"},{default:ke(()=>[V(ZA,{name:"tree-collapse",tag:"ul",class:"tree-list ch-list-content"},{default:ke(()=>[(b(!0),A(Pe,null,pt(I.value,({node:H,depth:O})=>(b(),A("li",{key:H.path,class:"tree-node"},[H.kind==="folder"?(b(),A("button",{key:0,type:"button",class:"tree-row tree-folder",style:Gt(T(O)),onClick:F=>P(H)},[V(p(Ie),{class:"tree-icon",name:"folder-solid",size:"sm"}),C("span",lNe,N(H.name),1)],12,rNe)):(b(),me(p(Pn),{key:1,text:H.path},{default:ke(()=>[C("button",{type:"button",class:"tree-row tree-file",style:Gt(T(O)),onClick:F=>w(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",uNe,N(H.name),1)],12,aNe)]),_:2},1032,["text"]))]))),128))]),_:1})]),_:1})):c.value?(b(),A("div",cNe,[C("span",dNe,[V(p(Ie),{name:"check",size:"lg"})]),Ve(" "+N(p(n)("diff.clean")),1)])):(b(),A("div",fNe,N(p(n)("diff.empty")),1))],64))]))}}),hNe=ht(pNe,[["__scopeId","data-v-e1daffaf"]]),mNe={class:"td"},gNe={class:"td-path"},vNe={class:"td-body"},yNe={key:1,class:"td-empty"},kNe=tt({__name:"TurnDiffPanel",props:{change:{},cwd:{},closable:{type:Boolean}},emits:["close","openFile"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=R(()=>{const a=n.cwd?F2(n.change.path,n.cwd):null;return r(a??n.change.path)});function r(a,u=48){return!a||a.length<=u?a:"…"+a.slice(a.length-u+1)}const l=R(()=>n.change.diff!==null&&n.change.diff.length>0);return(a,u)=>(b(),A("div",mNe,[V(p(fc),{title:p(s)("conversation.turnFiles.diffTitle"),closable:e.closable,"close-label":p(s)("filePreview.close"),onClose:u[1]||(u[1]=c=>o("close"))},{default:ke(()=>[V(p(Pn),{text:e.change.path},{default:ke(()=>[C("span",gNe,N(i.value),1)]),_:1},8,["text"]),V(p(gn),{size:"sm",label:p(s)("conversation.turnFiles.openFile"),onClick:u[0]||(u[0]=c=>o("openFile",e.change.path))},{default:ke(()=>[V(p(Ie),{name:"external-link",size:"md"})]),_:1},8,["label"])]),_:1},8,["title","closable","close-label"]),C("div",vNe,[l.value?(b(),me(Ur,{key:0,lines:e.change.diff,path:e.change.path,framed:!1},null,8,["lines","path"])):(b(),A("div",yNe,[C("p",null,N(p(s)("conversation.turnFiles.diffUnavailable")),1),V(p(Ft),{variant:"ghost",size:"sm",onClick:u[2]||(u[2]=c=>o("openFile",e.change.path))},{default:ke(()=>[Ve(N(p(s)("conversation.turnFiles.openFile")),1)]),_:1})]))])]))}}),bNe=ht(kNe,[["__scopeId","data-v-da704fc4"]]);function rF(e,t){let n=null;dn(()=>{n=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,yt(()=>{const o=t?.value??e.value;try{o?.focus()}catch{}})}),Un(()=>{const o=n;if(n=null,!(!o||typeof document>"u"||!document.contains(o)))try{o.focus()}catch{}})}const CNe={class:"search-wrap"},wNe=["aria-label"],_Ne=["aria-label"],xNe=["aria-pressed","onClick"],SNe={key:1,class:"state-row"},ANe={key:2,class:"state-row unavail"},MNe=["aria-label"],TNe=["aria-selected","onClick","onMouseenter"],ENe={class:"model-main"},INe={class:"model-name"},LNe={class:"model-meta"},$Ne={class:"model-side"},NNe={key:0,class:"empty"},FNe={class:"footer-hint","aria-hidden":"true"},RNe=tt({__name:"ModelPicker",props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["select","toggle-star","close"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=R(()=>new Set(o.starredIds??[]));function r(D){return i.value.has(D)}const l=Z(""),a=Z(null),u=Z(null),c=Z(null),d=Z("all"),f={image_in:"model.capabilityImageInput",video_in:"model.capabilityVideoInput",tool_use:"model.capabilityToolUse",thinking:"model.capabilityThinking",always_thinking:"model.capabilityAlwaysThinking"};function h(D){const T=f[D];return T?n(T):D.replaceAll("_"," ")}function g(D){const T=[D.provider,n("model.contextSuffix",{size:Ml(D.maxContextSize)})];for(const L of D.capabilities??[])T.push(h(L));return T.join(" · ")}rF(u,a);const m=R(()=>{const D=new Set,T=[{id:"all",label:n("model.allTab")}];for(const L of o.models)D.has(L.provider)||(D.add(L.provider),T.push({id:L.provider,label:L.provider}));return T}),w=R(()=>{const D=l.value.toLowerCase().trim(),T=o.models.filter(L=>{if(d.value!=="all"&&L.provider!==d.value)return!1;const B=(L.displayName??L.model).toLowerCase().includes(D),H=L.provider.toLowerCase().includes(D),O=L.id.toLowerCase().includes(D);return!D||B||H||O});return d.value!=="all"?T:T.sort((L,B)=>{const H=r(L.id)?1:0;return(r(B.id)?1:0)-H})}),_=R(()=>w.value),v=Z(0);et([l,d],()=>{v.value=0}),et(m,D=>{D.some(T=>T.id===d.value)||(d.value="all")}),et(_,D=>{v.value=Math.min(v.value,Math.max(D.length-1,0))}),et(v,async()=>{await yt(),c.value?.querySelector(".model-row.is-selected")?.scrollIntoView({block:"nearest"})});const{handleCompositionStart:k,handleCompositionEnd:y,isComposingKeyEvent:x}=Sr();function M(D){if(!x(D)){if(D.key==="Escape"){s("close");return}if(D.key==="ArrowDown")D.preventDefault(),v.value=Math.min(v.value+1,_.value.length-1);else if(D.key==="ArrowUp")D.preventDefault(),v.value=Math.max(v.value-1,0);else if(D.key==="Enter"){const T=_.value[v.value];T&&s("select",T.id)}}}dn(()=>{document.addEventListener("keydown",M)}),kn(()=>{document.removeEventListener("keydown",M)});function $(D){s("select",D)}function S(){l.value="",a.value?.focus()}function I(D){return _.value.indexOf(D)}function P(D){d.value=D}return(D,T)=>(b(),me(p(ca),{open:!0,"close-on-esc":!1,title:p(n)("model.title"),size:"lg",height:"fixed",padded:!1,onClose:T[1]||(T[1]=L=>s("close"))},{default:ke(()=>[C("div",{ref_key:"dialogRef",ref:u,class:"mp"},[C("div",CNe,[V(p(zs),{ref_key:"searchRef",ref:a,modelValue:l.value,"onUpdate:modelValue":T[0]||(T[0]=L=>l.value=L),placeholder:p(n)("model.searchPlaceholder"),autocomplete:"off",spellcheck:"false",autofocus:"",onCompositionstart:p(k),onCompositionend:p(y)},null,8,["modelValue","placeholder","onCompositionstart","onCompositionend"]),C("button",{type:"button",class:Re(["search-clear",{"is-on":l.value.length>0}]),tabindex:"-1","aria-label":p(n)("model.clearSearch"),onClick:S},[V(p(Ie),{name:"close",size:"sm"})],10,wNe)]),m.value.length>1?(b(),A("div",{key:0,class:"chip-strip","aria-label":p(n)("model.providerTabs")},[(b(!0),A(Pe,null,pt(m.value,L=>(b(),A("button",{key:L.id,type:"button",class:Re(["chip",{"is-active":L.id===d.value}]),"aria-pressed":L.id===d.value,onClick:B=>P(L.id)},N(L.label),11,xNe))),128))],8,_Ne)):te("",!0),e.loading?(b(),A("div",SNe,[V(p(Ao),{size:"sm"}),C("span",null,N(p(n)("model.loading")),1)])):e.unavailable?(b(),A("div",ANe,[V(p(Ie),{name:"alert-triangle",size:"lg"}),C("span",null,N(p(n)("model.unavailable")),1)])):(b(),A("div",{key:3,ref_key:"listRef",ref:c,class:"model-list",role:"listbox","aria-label":p(n)("model.title")},[(b(!0),A(Pe,null,pt(_.value,L=>(b(),A("div",{key:L.id,class:Re(["model-row",{"is-current":L.id===e.current,"is-selected":I(L)===v.value}]),role:"option","aria-selected":L.id===e.current,onClick:B=>$(L.id),onMouseenter:B=>v.value=I(L)},[C("span",ENe,[C("span",INe,N(L.displayName??L.model),1),C("span",LNe,N(g(L)),1)]),C("span",$Ne,[L.id===e.current?(b(),me(p(Ie),{key:0,class:"model-check",name:"check",size:"sm"})):te("",!0),V(p(gn),{class:Re(["model-star",{"is-starred":r(L.id)}]),size:"sm",label:r(L.id)?p(n)("model.unstarTitle"):p(n)("model.starTitle"),onClick:Et(B=>s("toggle-star",L.id),["stop"])},{default:ke(()=>[r(L.id)?(b(),me(p(Ie),{key:0,name:"star",size:"md"})):(b(),me(p(Ie),{key:1,name:"star-outline",size:"md"}))]),_:2},1032,["class","label","onClick"])])],42,TNe))),128)),_.value.length===0?(b(),A("div",NNe,N(o.models.length===0?p(n)("model.emptyNoModels"):p(n)("model.emptyNoMatch")),1)):te("",!0)],8,MNe)),C("div",FNe,[V(p(sa),{keys:["↑","↓"]}),C("span",null,N(p(n)("model.hintNavigate")),1),T[2]||(T[2]=C("span",{class:"hint-dot"},"·",-1)),V(p(sa),{keys:["Enter"]}),C("span",null,N(p(n)("model.hintSelect")),1),T[3]||(T[3]=C("span",{class:"hint-dot"},"·",-1)),V(p(sa),{keys:["Esc"]}),C("span",null,N(p(n)("model.hintClose")),1)])],512)]),_:1},8,["title"]))}}),ONe=ht(RNe,[["__scopeId","data-v-d5ea4110"]]),PNe=3;function lF(e){const t=Z("starting"),n=Z(!1),o=Z(null),s=Z(0);let i=null,r=null,l=null,a=0,u=!1,c=!1;function d(){i&&(clearTimeout(i),i=null),r&&(clearInterval(r),r=null),l&&(clearTimeout(l),l=null)}function f(_){d(),t.value="success",l=setTimeout(()=>{l=null,e.onSuccess?.()},_)}function h(){r&&clearInterval(r),r=setInterval(()=>{s.value>0?s.value--:(r&&clearInterval(r),r=null)},1e3)}function g(_){i&&clearTimeout(i),i=setTimeout(async()=>{const v=await e.onPollOAuthLogin();if(!c){if(v===null){if(a+=1,a>=PNe){d(),n.value=!0,t.value="error";return}g(_);return}a=0,v.status==="authenticated"?f(1200):v.status==="expired"||v.status==="cancelled"?(d(),t.value="expired"):g(_)}},_*1e3)}async function m(){d(),o.value=null,n.value=!1,a=0,u=!1,t.value="starting";const _=await e.onStartOAuthLogin();if(c){_!==null&&_.status!=="authenticated"&&e.onCancelOAuthLogin();return}if(!_){t.value="error";return}if(_.status==="authenticated"){f(800);return}o.value={flowId:_.flowId,verificationUri:_.verificationUri,verificationUriComplete:_.verificationUriComplete,userCode:_.userCode,expiresIn:_.expiresIn,interval:_.interval},s.value=_.expiresIn,t.value="device-code",h(),g(_.interval)}function w(){t.value!=="success"&&(d(),t.value==="device-code"&&!u&&(u=!0,e.onCancelOAuthLogin()))}return Zg()&&pf(()=>{c=!0,w()}),{step:t,pollError:n,flow:o,secondsLeft:s,startFlow:m,cancelFlow:w}}const DNe={key:0,class:"center-body"},BNe={class:"center-text"},HNe={key:1,class:"nb"},zNe={class:"nb-lead"},WNe=["href"],UNe={class:"nb-code-row"},jNe=["title"],VNe={class:"nb-status"},qNe={class:"nb-status-text"},KNe={class:"nb-countdown"},ZNe={key:2,class:"center-body"},GNe={class:"center-text success-text"},YNe={class:"center-hint"},XNe={class:"center-body"},JNe={class:"center-text err-text"},QNe={class:"center-hint"},eFe={class:"actions"},tFe={class:"center-body"},nFe={class:"center-text warn-text"},oFe={class:"center-hint"},sFe={class:"actions"},iFe=tt({__name:"LoginDialog",props:{onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","close"],setup(e,{emit:t}){const{t:n}=Lt(),o=Z(!0),s=t,i=e,{step:r,pollError:l,flow:a,secondsLeft:u,startFlow:c,cancelFlow:d}=lF({onStartOAuthLogin:i.onStartOAuthLogin,onPollOAuthLogin:i.onPollOAuthLogin,onCancelOAuthLogin:i.onCancelOAuthLogin,onSuccess:()=>{s("success"),s("close")}}),f=Z(!1);dn(async()=>{await c()});async function h(){!a.value||!await js(a.value.verificationUriComplete)||(f.value=!0,setTimeout(()=>{f.value=!1},2e3))}async function g(){d(),s("close")}function m(w){const _=Math.floor(w/60),v=w%60;return`${_}:${String(v).padStart(2,"0")}`}return(w,_)=>(b(),me(p(ca),{open:o.value,"onUpdate:open":_[0]||(_[0]=v=>o.value=v),title:p(n)("login.title"),"close-on-overlay":!1,onClose:g},{default:ke(()=>[p(r)==="starting"?(b(),A("div",DNe,[V(p(Ao),{size:"md"}),C("span",BNe,N(p(n)("login.starting")),1)])):p(r)==="device-code"&&p(a)?(b(),A("div",HNe,[C("div",zNe,N(p(n)("login.lead")),1),C("a",{class:"nb-primary",href:p(a).verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[Ve(N(p(n)("login.authorizeInBrowser"))+" ",1),V(p(Ie),{name:"external-link",size:"sm"})],8,WNe),C("div",UNe,[C("span",{class:"nb-link",title:p(a).verificationUriComplete},N(p(a).verificationUriComplete),9,jNe),V(p(Ft),{class:Re(["nb-copy",{"is-copied":f.value}]),variant:"secondary",size:"sm",onClick:h},{default:ke(()=>[f.value?(b(),A(Pe,{key:0},[V(p(Ie),{name:"check",size:"sm"}),Ve(" "+N(p(n)("login.copied")),1)],64)):(b(),A(Pe,{key:1},[V(p(Ie),{name:"copy",size:"sm"}),Ve(" "+N(p(n)("login.copyLink")),1)],64))]),_:1},8,["class"])]),C("div",VNe,[V(p(Ao),{size:"sm",label:p(n)("login.waitingAuth")},null,8,["label"]),C("span",qNe,N(p(n)("login.waitingAutoClose")),1),C("span",KNe,N(m(p(u))),1)])])):p(r)==="success"?(b(),A("div",ZNe,[V(p(Bd),{kind:"success"}),C("span",GNe,N(p(n)("login.success")),1),C("span",YNe,N(p(n)("login.successHint")),1)])):p(r)==="expired"?(b(),A(Pe,{key:3},[C("div",XNe,[V(p(Bd),{kind:"expired"}),C("span",JNe,N(p(n)("login.expiredTitle")),1),C("span",QNe,N(p(n)("login.expiredHint")),1)]),C("div",eFe,[V(p(Ft),{variant:"primary",onClick:p(c)},{default:ke(()=>[Ve(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),V(p(Ft),{variant:"secondary",onClick:g},{default:ke(()=>[Ve(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):p(r)==="error"?(b(),A(Pe,{key:4},[C("div",tFe,[V(p(Bd),{kind:"error"}),C("span",nFe,N(p(l)?p(n)("login.pollErrorTitle"):p(n)("login.errorTitle")),1),C("span",oFe,N(p(l)?p(n)("login.pollErrorHint"):p(n)("login.errorHint")),1)]),C("div",sFe,[V(p(Ft),{variant:"primary",onClick:p(c)},{default:ke(()=>[Ve(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),V(p(Ft),{variant:"secondary",onClick:g},{default:ke(()=>[Ve(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):te("",!0)]),_:1},8,["open","title"]))}}),rFe=ht(iFe,[["__scopeId","data-v-aad4b9f1"]]),aF=tt({__name:"LanguageSwitcher",props:{size:{default:"md"}},setup(e){const{locale:t}=Lt(),n=mg.map(s=>({value:s.code,label:s.label}));function o(s){t.value!==s&&A5(s)}return(s,i)=>(b(),me(p(bi),{"model-value":p(t),options:p(n),size:e.size,"onUpdate:modelValue":o},null,8,["model-value","options","size"]))}}),lFe=["kimi","openai","openai_responses","anthropic","google-genai","vertexai"];function $h(){return{model:"",maxContextSize:"",displayName:"",capabilities:["tool_use","thinking"],supportEfforts:[],adaptiveThinking:!0}}function My(e,t){const n=[];for(const o of Object.values(t??{})){if(o===null||typeof o!="object")continue;const s=o;s.provider===e.id&&n.push({model:typeof s.model=="string"?s.model:"",maxContextSize:typeof s.maxContextSize=="number"?String(s.maxContextSize):"",displayName:typeof s.displayName=="string"?s.displayName:"",capabilities:Array.isArray(s.capabilities)?s.capabilities.filter(i=>typeof i=="string"):[],supportEfforts:Array.isArray(s.supportEfforts)?s.supportEfforts.filter(i=>typeof i=="string"):[],...typeof s.adaptiveThinking=="boolean"?{adaptiveThinking:s.adaptiveThinking}:{}})}return n}const uF=/^[\p{L}\p{N}][\p{L}\p{N}\-_ ]*$/u;function aFe(e,t={}){const n=e.id.trim();if(n==="")return"idRequired";if(!uF.test(n))return"idInvalid";if(t.requireApiKey===!0&&e.apiKey.trim()==="")return"apiKeyRequired";if(t.requireBaseUrl===!0&&e.baseUrl.trim()==="")return"baseUrlRequired";if(e.models.length===0)return"modelRequired";for(const o of e.models){if(o.model.trim()==="")return"modelRequired";const s=o.maxContextSize.trim();if(s==="")return"contextSizeRequired";if(!/^\d+$/.test(s)||Number(s)<1)return"contextSizeInvalid"}return null}function cF(e){return e.map(t=>{const n=t.displayName.trim();return{model:t.model.trim(),maxContextSize:Number(t.maxContextSize.trim()),...t.capabilities.length>0?{capabilities:[...t.capabilities]}:{},...t.supportEfforts.length>0?{supportEfforts:[...t.supportEfforts]}:{},...t.adaptiveThinking!==void 0?{adaptiveThinking:t.adaptiveThinking}:{},...n===""?{}:{displayName:n}}})}function uFe(e){const t=e.apiKey.trim(),n=e.baseUrl.trim();return{id:e.id.trim(),type:e.type,models:cF(e.models),...t===""?{}:{apiKey:t},...n===""?{}:{baseUrl:n}}}function cFe(e,t,n){const o=cF(e.models),s=e.id.trim(),i=e.apiKey.trim(),r=e.baseUrl.trim(),l=n?.existingDefaultModel?.trim()??"",a=l.indexOf("/")>=0?l.slice(l.indexOf("/")+1):l;return{...t!==void 0&&s!==""&&s!==t.id?{newId:s}:{},type:e.type,models:o,...i===""&&n?.includeBlankApiKey!==!0?{}:{apiKey:i},...r===""?{}:{baseUrl:r},...a!==""&&o.some(u=>u.model===a)?{defaultModel:a}:{}}}function dF(e){return e.id==="managed:kimi-code"&&e.type==="kimi"}const dFe={class:"msg"},fFe={class:"pf-field"},pFe={class:"pf-field-label"},hFe={class:"pf-field"},mFe={class:"pf-field-label"},gFe={class:"pf-field"},vFe={class:"pf-field-label"},yFe={class:"pf-key-wrap"},kFe={class:"pf-field"},bFe={class:"pf-field-label"},CFe={class:"pf-field"},wFe={class:"pf-field-label"},_Fe={class:"pf-models"},xFe={key:0,class:"pf-models-empty"},SFe={class:"pf-model-grid pf-model-head"},AFe={key:1},MFe={key:0},TFe={class:"pf-foot"},EFe={key:0,class:"pf-managed-note"},IFe={class:"pf-confirm-msg"},LFe=tt({__name:"ProviderForm",props:{mode:{},provider:{},guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","saved","deleting","deleted","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=hu(),r=Jo({id:"",type:"openai",apiKey:"",baseUrl:"",models:[$h()]}),l=Z(""),a=Z(!1),u=Z(!1),c=Z(!1),d=R(()=>n.mode==="add"),f=R(()=>n.provider!==void 0&&dF(n.provider)),h=R(()=>{const L=n.provider;return L===void 0?0:My(L,i.config.value?.models).length}),g=R(()=>f.value&&h.value===0),m=R(()=>lFe.map(L=>({value:L,label:s(`providers.types.${L}`)}))),w=R(()=>f.value?s("providers.apiKeyManaged"):!d.value&&n.provider?.hasApiKey===!0?s("providers.apiKeySet"):"sk-…");function _(){l.value="",u.value=!1;const L=n.provider;if(d.value||L===void 0){r.id="",r.type="openai",r.apiKey="",r.baseUrl="",r.models=[$h()];return}r.id=L.id,r.type=L.type,r.apiKey="",r.baseUrl=L.baseUrl??"";const B=My(L,i.config.value?.models);r.models=B.length>0?B:[$h()]}dn(()=>{_(),y()});const v=Z(!1),k=Z(!1);async function y(){const L=n.provider;if(!(d.value||L===void 0||f.value||L.hasApiKey!==!0))try{const B=await i.getProvider(L.id);if(k.value)return;B.apiKey!==void 0&&B.apiKey!==""&&(r.apiKey=B.apiKey,v.value=!0)}catch{}}function x(){o("dirtyChange",!0)}const M=Z(!1),$=Z();function S(L){l.value=L,yt(()=>$.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function I(){if(a.value)return;const L=aFe(r,{requireApiKey:d.value,requireBaseUrl:d.value});if(L!==null){S(s(`providers.error.${L}`));return}l.value="",a.value=!0;try{if(d.value){const B=await i.addProvider(uFe(r));if(B!==null){S(B);return}o("dirtyChange",!1),i.notify({severity:"success",title:s("providers.added")}),o("added",r.id.trim())}else{const B=n.provider;if(B===void 0)return;const H=i.config.value?.providers?.[B.id]?.defaultModel,O=await i.updateProvider(B.id,cFe(r,B,{includeBlankApiKey:v.value,existingDefaultModel:H}));if(O!==null){S(O);return}await i.checkAuth(),i.notify({severity:"success",title:s("providers.saved")}),o("dirtyChange",!1),o("saved",r.id.trim())}}finally{a.value=!1}}async function P(){const L=n.provider;if(!(L===void 0||c.value)){c.value=!0,o("deleting"),await new Promise(B=>setTimeout(B,300));try{if(await i.deleteProvider(L.id)===null){u.value=!1;return}o("dirtyChange",!1),o("deleted",L.id)}finally{c.value=!1}}}function D(){r.models.push($h()),x()}function T(L){r.models.length<=1||(r.models.splice(L,1),x())}return(L,B)=>(b(),A("div",{class:"pf-form",onInput:x},[e.guard?(b(),me(p(Vu),{key:0,variant:"warning",class:"pf-guard"},{default:ke(()=>[C("span",dFe,N(p(s)("providers.unsavedGuard")),1),V(p(Ft),{variant:"secondary",size:"sm",onClick:B[0]||(B[0]=H=>o("guardStay"))},{default:ke(()=>[Ve(N(p(s)("providers.guardStay")),1)]),_:1}),V(p(Ft),{variant:"danger",size:"sm",onClick:B[1]||(B[1]=H=>o("guardDiscard"))},{default:ke(()=>[Ve(N(p(s)("providers.guardDiscard")),1)]),_:1})]),_:1})):te("",!0),l.value?(b(),A("div",{key:1,ref_key:"errorBox",ref:$},[V(p(Vu),{variant:"danger"},{default:ke(()=>[Ve(N(l.value),1)]),_:1})],512)):te("",!0),C("div",fFe,[C("label",pFe,[Ve(N(p(s)("providers.fieldId")),1),B[11]||(B[11]=C("span",{class:"req"}," *",-1))]),V(p(zs),{modelValue:r.id,"onUpdate:modelValue":B[2]||(B[2]=H=>r.id=H),placeholder:"my-openai",disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","disabled"])]),C("div",hFe,[C("label",mFe,[Ve(N(p(s)("providers.fieldType")),1),B[12]||(B[12]=C("span",{class:"req"}," *",-1))]),V(p(o3),{"model-value":r.type,options:m.value,disabled:f.value,"onUpdate:modelValue":B[3]||(B[3]=H=>{r.type=H,x()})},null,8,["model-value","options","disabled"])]),C("div",gFe,[C("label",vFe,[Ve(N(p(s)("providers.fieldApiKey")),1),B[13]||(B[13]=C("span",{class:"req"}," *",-1))]),C("div",yFe,[V(p(zs),{modelValue:r.apiKey,"onUpdate:modelValue":B[4]||(B[4]=H=>r.apiKey=H),type:M.value?"text":"password",placeholder:w.value,disabled:f.value,autocomplete:"off",spellcheck:"false",onInput:B[5]||(B[5]=H=>k.value=!0)},null,8,["modelValue","type","placeholder","disabled"]),f.value?te("",!0):(b(),me(p(gn),{key:0,class:"pf-key-eye",size:"sm",label:p(s)(M.value?"providers.hideApiKey":"providers.showApiKey"),onClick:B[6]||(B[6]=H=>M.value=!M.value)},{default:ke(()=>[V(p(Ie),{name:M.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label"]))])]),C("div",kFe,[C("label",bFe,[Ve(N(p(s)("providers.fieldBaseUrl")),1),B[14]||(B[14]=C("span",{class:"req"}," *",-1))]),V(p(zs),{modelValue:r.baseUrl,"onUpdate:modelValue":B[7]||(B[7]=H=>r.baseUrl=H),placeholder:p(s)("providers.baseUrlPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder","disabled"])]),C("div",CFe,[C("label",wFe,[Ve(N(p(s)("providers.fieldModels")),1),B[15]||(B[15]=C("span",{class:"req"}," *",-1))]),C("div",_Fe,[g.value?(b(),A("div",xFe,N(p(s)("providers.noModels")),1)):(b(),A(Pe,{key:1},[C("div",SFe,[C("span",null,[Ve(N(p(s)("providers.colModelId")),1),B[16]||(B[16]=C("span",{class:"req"}," *",-1))]),C("span",null,[Ve(N(p(s)("providers.colContext")),1),B[17]||(B[17]=C("span",{class:"req"}," *",-1))]),C("span",null,N(p(s)("providers.colDisplayName")),1),B[18]||(B[18]=C("span",null,null,-1))]),(b(!0),A(Pe,null,pt(r.models,(H,O)=>(b(),A("div",{key:O,class:"pf-model-grid"},[V(p(zs),{modelValue:H.model,"onUpdate:modelValue":F=>H.model=F,placeholder:p(s)("providers.modelIdPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),V(p(zs),{modelValue:H.maxContextSize,"onUpdate:modelValue":F=>H.maxContextSize=F,inputmode:"numeric",placeholder:p(s)("providers.modelContextPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),V(p(zs),{modelValue:H.displayName,"onUpdate:modelValue":F=>H.displayName=F,placeholder:p(s)("providers.modelNamePlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),f.value?(b(),A("span",AFe)):(b(),me(p(gn),{key:0,size:"sm",label:p(s)("providers.removeModel"),disabled:r.models.length<=1,onClick:F=>T(O)},{default:ke(()=>[V(p(Ie),{name:"trash",size:"sm"})]),_:1},8,["label","disabled","onClick"]))]))),128)),f.value?te("",!0):(b(),A("div",MFe,[V(p(Ft),{variant:"ghost",size:"sm",onClick:D},{default:ke(()=>[V(p(Ie),{name:"plus",size:"sm"}),Ve(" "+N(p(s)("providers.addModel")),1)]),_:1})]))],64))])]),C("div",TFe,[f.value?(b(),A("span",EFe,N(p(s)("providers.managedHint")),1)):d.value?(b(),A(Pe,{key:1},[V(p(Ft),{variant:"secondary",size:"sm",onClick:B[8]||(B[8]=H=>o("cancel"))},{default:ke(()=>[Ve(N(p(s)("common.cancel")),1)]),_:1}),V(p(Ft),{variant:"primary",size:"sm",disabled:a.value,onClick:I},{default:ke(()=>[Ve(N(p(s)("providers.addProvider")),1)]),_:1},8,["disabled"])],64)):u.value&&n.provider!==void 0?(b(),A(Pe,{key:2},[C("span",IFe,N(p(s)("providers.deleteConfirm",{id:n.provider.id,count:h.value})),1),B[19]||(B[19]=C("span",{class:"spacer"},null,-1)),V(p(Ft),{variant:"secondary",size:"sm",disabled:c.value,onClick:B[9]||(B[9]=H=>u.value=!1)},{default:ke(()=>[Ve(N(p(s)("common.cancel")),1)]),_:1},8,["disabled"]),V(p(Ft),{variant:"danger",size:"sm",disabled:c.value,onClick:P},{default:ke(()=>[Ve(N(p(s)("providers.deleteConfirmYes")),1)]),_:1},8,["disabled"])],64)):(b(),A(Pe,{key:3},[V(p(Ft),{variant:"danger-soft",size:"sm",onClick:B[10]||(B[10]=H=>u.value=!0)},{default:ke(()=>[Ve(N(p(s)("providers.deleteProvider")),1)]),_:1}),B[20]||(B[20]=C("span",{class:"spacer"},null,-1)),V(p(Ft),{variant:"primary",size:"sm",disabled:a.value,onClick:I},{default:ke(()=>[Ve(N(p(s)("providers.save")),1)]),_:1},8,["disabled"])],64))])],32))}}),fF=ht(LFe,[["__scopeId","data-v-51214cd2"]]),$Fe={class:"af"},NFe={class:"msg"},FFe={key:2,class:"af-catalog"},RFe={key:0,class:"af-center"},OFe={key:1,class:"af-error"},PFe={class:"af-list"},DFe=["disabled","onClick"],BFe={class:"af-entry-name"},HFe={key:1,class:"af-entry-reason"},zFe={key:2,class:"af-entry-count"},WFe={key:0,class:"af-empty"},UFe={class:"af-field"},jFe={class:"af-label"},VFe={class:"af-field"},qFe={class:"af-label"},KFe={class:"af-key-wrap"},ZFe={key:0,class:"af-field"},GFe={class:"af-label"},YFe={class:"af-note"},XFe={class:"af-foot"},JFe={class:"af-hint"},QFe={class:"af-field"},eRe={class:"af-label"},tRe={class:"af-field"},nRe={class:"af-label"},oRe={class:"af-key-wrap"},sRe={class:"af-foot"},iRe={class:"af-manual"},rRe=tt({__name:"AddProviderFlow",props:{guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","cancel"],setup(e,{emit:t}){const n=t,{t:o,te:s}=Lt(),i=hu(),r=Z("catalog"),l=R(()=>[{value:"catalog",label:o("providers.catalog.sourceCatalog")},{value:"registry",label:o("providers.catalog.sourceRegistry")},{value:"manual",label:o("providers.catalog.sourceManual")}]),a=Z("loading"),u=Z([]);async function c(){a.value="loading";const W=await i.loadCatalogProviders();W.kind==="ok"?(u.value=W.items,a.value="ready"):W.kind==="unsupported"?(a.value="unsupported",r.value==="catalog"&&(r.value="manual")):a.value="error"}dn(c);const d=Z(""),f=R(()=>{const W=d.value.trim().toLowerCase();return W===""?u.value:u.value.filter(z=>z.name.toLowerCase().includes(W)||z.id.toLowerCase().includes(W))});function h(W){const z=W.rejectReason;return z!==null&&s(`providers.catalog.rejectReason.${z}`)?o(`providers.catalog.rejectReason.${z}`):o("providers.catalog.rejected")}const g=Z(null),m=Z({id:"",apiKey:"",baseUrl:""}),w=Z(!1),_=Z(!1),v=Z("");function k(W){g.value=W,m.value={id:W.id,apiKey:"",baseUrl:""},v.value="",w.value=!1}function y(){g.value=null,v.value="",n("dirtyChange",!1)}function x(){n("dirtyChange",!0)}const M=R(()=>{if(g.value===null)return!1;const z=m.value.id.trim();return z!==""&&i.providers.value.some(U=>U.id===z)}),$=Z();function S(W){v.value=W,yt(()=>$.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}function I(){const W=m.value,z=W.id.trim();return z===""?o("providers.error.idRequired"):uF.test(z)?W.apiKey.trim()===""?o("providers.error.apiKeyRequired"):g.value?.needsBaseUrl===!0&&W.baseUrl.trim()===""?o("providers.error.baseUrlRequired"):null:o("providers.error.idInvalid")}async function P(){const W=g.value;if(W===null||_.value)return;const z=I();if(z!==null){S(z);return}v.value="",_.value=!0;try{const U=m.value,q=U.id.trim(),K=U.baseUrl.trim(),ie=await i.importCatalogProvider({catalogId:W.id,apiKey:U.apiKey.trim(),...K===""?{}:{baseUrl:K},...q===W.id?{}:{id:q}});if(ie!==null){S(ie);return}i.notify({severity:"success",title:o("providers.added")}),n("dirtyChange",!1),n("added",q)}finally{_.value=!1}}const D=Z({url:"",apiKey:""}),T=Z(!1),L=Z(!1),B=Z(""),H=Z();function O(W){B.value=W,yt(()=>H.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function F(){if(L.value)return;const W=D.value.url.trim();if(W===""){O(o("providers.error.registryUrlRequired"));return}B.value="",L.value=!0;try{const z=D.value.apiKey.trim(),U=await i.importCustomRegistry({url:W,...z===""?{}:{apiKey:z}});if(typeof U=="string"){O(U);return}i.notify({severity:"success",title:o("providers.catalog.registryImported",{count:U.providers.length})}),n("dirtyChange",!1);const q=U.providers[0];q!==void 0?n("added",q.id):n("cancel")}finally{L.value=!1}}return(W,z)=>(b(),A("div",$Fe,[e.guard?(b(),me(p(Vu),{key:0,variant:"warning",class:"af-guard"},{default:ke(()=>[C("span",NFe,N(p(o)("providers.unsavedGuard")),1),V(p(Ft),{variant:"secondary",size:"sm",onClick:z[0]||(z[0]=U=>n("guardStay"))},{default:ke(()=>[Ve(N(p(o)("providers.guardStay")),1)]),_:1}),V(p(Ft),{variant:"danger",size:"sm",onClick:z[1]||(z[1]=U=>n("guardDiscard"))},{default:ke(()=>[Ve(N(p(o)("providers.guardDiscard")),1)]),_:1})]),_:1})):te("",!0),a.value!=="unsupported"?(b(),me(p(bi),{key:1,modelValue:r.value,"onUpdate:modelValue":z[2]||(z[2]=U=>r.value=U),size:"sm",options:l.value},null,8,["modelValue","options"])):te("",!0),a.value!=="unsupported"?In((b(),A("div",FFe,[a.value==="loading"?(b(),A("div",RFe,[V(p(Ao),{size:"sm"}),C("span",null,N(p(o)("providers.catalog.loading")),1)])):a.value==="error"?(b(),A("div",OFe,[V(p(Vu),{variant:"danger"},{default:ke(()=>[Ve(N(p(o)("providers.catalog.loadError")),1)]),_:1}),C("div",null,[V(p(Ft),{variant:"secondary",size:"sm",onClick:c},{default:ke(()=>[Ve(N(p(o)("providers.catalog.retry")),1)]),_:1})])])):g.value===null?(b(),A(Pe,{key:2},[V(p(zs),{modelValue:d.value,"onUpdate:modelValue":z[3]||(z[3]=U=>d.value=U),placeholder:p(o)("providers.catalog.searchPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"]),C("div",PFe,[(b(!0),A(Pe,null,pt(f.value,U=>(b(),A("button",{key:U.id,type:"button",class:"af-entry",disabled:U.rejected,onClick:q=>k(U)},[C("span",BFe,N(U.name),1),U.wireType!==null?(b(),me(p(Vr),{key:0,variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(U.wireType),1)]),_:2},1024)):te("",!0),z[16]||(z[16]=C("span",{class:"grow"},null,-1)),U.rejected?(b(),A("span",HFe,N(h(U)),1)):(b(),A("span",zFe,N(p(o)("providers.modelCount",{count:U.models.length})),1))],8,DFe))),128)),f.value.length===0?(b(),A("div",WFe,N(p(o)("providers.catalog.empty")),1)):te("",!0)])],64)):(b(),A("div",{key:3,class:"af-import",onInput:x},[C("button",{type:"button",class:"af-back",onClick:y},[V(p(Ie),{name:"arrow-left",size:"sm"}),Ve(" "+N(p(o)("providers.catalog.backToList")),1)]),C("div",UFe,[C("label",jFe,[Ve(N(p(o)("providers.fieldId")),1),z[17]||(z[17]=C("span",{class:"req"}," *",-1))]),V(p(zs),{modelValue:m.value.id,"onUpdate:modelValue":z[4]||(z[4]=U=>m.value.id=U),autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",VFe,[C("label",qFe,[Ve(N(p(o)("providers.fieldApiKey")),1),z[18]||(z[18]=C("span",{class:"req"}," *",-1))]),C("div",KFe,[V(p(zs),{modelValue:m.value.apiKey,"onUpdate:modelValue":z[5]||(z[5]=U=>m.value.apiKey=U),type:w.value?"text":"password",placeholder:"sk-…",autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type"]),V(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(w.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[6]||(z[6]=U=>w.value=!w.value)},{default:ke(()=>[V(p(Ie),{name:w.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label"])])]),g.value.needsBaseUrl?(b(),A("div",ZFe,[C("label",GFe,[Ve(N(p(o)("providers.fieldBaseUrl")),1),z[19]||(z[19]=C("span",{class:"req"}," *",-1))]),V(p(zs),{modelValue:m.value.baseUrl,"onUpdate:modelValue":z[7]||(z[7]=U=>m.value.baseUrl=U),placeholder:p(o)("providers.baseUrlPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])])):te("",!0),M.value?(b(),me(p(Vu),{key:1,variant:"warning"},{default:ke(()=>[Ve(N(p(o)("providers.catalog.overwriteWarning")),1)]),_:1})):te("",!0),C("div",YFe,N(p(o)("providers.catalog.willImport",{count:g.value.models.length})),1),v.value?(b(),A("div",{key:2,ref_key:"importErrorBox",ref:$},[V(p(Vu),{variant:"danger"},{default:ke(()=>[Ve(N(v.value),1)]),_:1})],512)):te("",!0),C("div",XFe,[V(p(Ft),{variant:"secondary",size:"sm",onClick:z[8]||(z[8]=U=>n("cancel"))},{default:ke(()=>[Ve(N(p(o)("common.cancel")),1)]),_:1}),V(p(Ft),{variant:"primary",size:"sm",disabled:_.value,onClick:P},{default:ke(()=>[Ve(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],32))],512)),[[Es,r.value==="catalog"]]):te("",!0),In(C("div",{class:"af-registry",onInput:x},[C("div",JFe,N(p(o)("providers.catalog.registryHint")),1),C("div",QFe,[C("label",eRe,[Ve(N(p(o)("providers.catalog.registryUrlLabel")),1),z[20]||(z[20]=C("span",{class:"req"}," *",-1))]),V(p(zs),{modelValue:D.value.url,"onUpdate:modelValue":z[9]||(z[9]=U=>D.value.url=U),placeholder:"https://example.com/api.json",autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",tRe,[C("label",nRe,N(p(o)("providers.fieldApiKey")),1),C("div",oRe,[V(p(zs),{modelValue:D.value.apiKey,"onUpdate:modelValue":z[10]||(z[10]=U=>D.value.apiKey=U),type:T.value?"text":"password",placeholder:p(o)("providers.modelNamePlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type","placeholder"]),V(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(T.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[11]||(z[11]=U=>T.value=!T.value)},{default:ke(()=>[V(p(Ie),{name:T.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label"])])]),B.value?(b(),A("div",{key:0,ref_key:"registryErrorBox",ref:H},[V(p(Vu),{variant:"danger"},{default:ke(()=>[Ve(N(B.value),1)]),_:1})],512)):te("",!0),C("div",sRe,[V(p(Ft),{variant:"secondary",size:"sm",onClick:z[12]||(z[12]=U=>n("cancel"))},{default:ke(()=>[Ve(N(p(o)("common.cancel")),1)]),_:1}),V(p(Ft),{variant:"primary",size:"sm",disabled:L.value,onClick:F},{default:ke(()=>[Ve(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],544),[[Es,r.value==="registry"]]),In(C("div",iRe,[V(fF,{mode:"add",guard:!1,onDirtyChange:z[13]||(z[13]=U=>n("dirtyChange",U)),onAdded:z[14]||(z[14]=U=>n("added",U)),onCancel:z[15]||(z[15]=U=>n("cancel"))})],512),[[Es,r.value==="manual"]])]))}}),lRe=ht(rRe,[["__scopeId","data-v-e6595b0c"]]),aRe={class:"pp"},uRe={class:"pp-head"},cRe={class:"pp-title"},dRe={key:0,class:"pp-loading"},fRe={key:1,class:"pp-group"},pRe={class:"pp-add-label"},hRe={class:"pp-chev"},mRe={class:"pp-acc"},gRe={class:"pp-acc-in"},vRe={key:1,class:"pp-empty"},yRe=["onClick"],kRe={class:"grow"},bRe={class:"pp-id"},CRe={class:"pp-count"},wRe={class:"pp-chev"},_Re={class:"pp-acc"},xRe={class:"pp-acc-in"},zu="$add",SRe=tt({__name:"ProvidersPanel",setup(e){const{t}=Lt(),n=hu(),o=Z(!0),s=Z(null),i=Z(null);let r=0;const l=Z(!1),a=Z(!1),u=Z(null),c=Z("");let d=0;const f=R(()=>[...n.providers.value].sort((M,$)=>M.id.localeCompare($.id)));function h(M){return My(M,n.config.value?.models).length}et(s,(M,$)=>{$!==null&&$!==M&&(i.value=$,window.clearTimeout(r),r=window.setTimeout(()=>{i.value=null},300)),l.value=!1}),et(l,M=>{M||(a.value=!1,u.value=null)}),kn(()=>{window.clearTimeout(r),window.clearTimeout(d)});const g=Z(!1);et(s,M=>{M===zu?(g.value=!1,yt(()=>requestAnimationFrame(()=>{g.value=!0}))):g.value=!1}),dn(async()=>{o.value=!0;try{await Promise.all([n.loadProviders(),n.loadModels(),n.loadConfig()])}finally{o.value=!1}});function m(M){const $=s.value===M?null:M;if(l.value){u.value=$,a.value=!0;return}s.value=$}function w(){a.value=!1,u.value=null}function _(){a.value=!1,s.value=u.value,u.value=null}function v(M){c.value=M,window.clearTimeout(d),d=window.setTimeout(()=>{c.value=""},1200)}function k(M){s.value=M}function y(M){s.value=M,v(M)}function x(){s.value=null}return(M,$)=>(b(),A("section",aRe,[C("div",uRe,[C("h3",cRe,N(p(t)("settings.tabs.providers")),1),V(p(Ft),{variant:"secondary",size:"sm",onClick:$[0]||($[0]=S=>m(zu))},{default:ke(()=>[V(p(Ie),{name:"plus",size:"sm"}),Ve(" "+N(p(t)("providers.addProvider")),1)]),_:1})]),o.value?(b(),A("div",dRe,[V(p(Ao),{size:"sm"}),C("span",null,N(p(t)("providers.loading")),1)])):(b(),A("div",fRe,[s.value===zu||i.value===zu?(b(),A("div",{key:0,class:Re(["pp-item pp-add-item",{open:s.value===zu&&g.value}])},[C("button",{type:"button",class:"pp-row pp-add-row",onClick:$[1]||($[1]=S=>m(zu))},[C("span",pRe,N(p(t)("providers.addProvider")),1),$[6]||($[6]=C("span",{class:"grow"},null,-1)),C("span",hRe,[V(p(Ie),{name:"chevron-right",size:"sm"})])]),C("div",mRe,[C("div",gRe,[V(lRe,{guard:a.value&&s.value===zu,onDirtyChange:$[2]||($[2]=S=>l.value=S),onGuardStay:w,onGuardDiscard:_,onAdded:y,onCancel:$[3]||($[3]=S=>s.value=null)},null,8,["guard"])])])],2)):te("",!0),f.value.length===0?(b(),A("div",vRe,N(p(t)("providers.empty")),1)):te("",!0),(b(!0),A(Pe,null,pt(f.value,S=>(b(),A("div",{key:S.id,class:Re(["pp-item",{open:s.value===S.id,flash:c.value===S.id}])},[C("button",{type:"button",class:"pp-row",onClick:I=>m(S.id)},[C("div",kRe,[C("span",bRe,N(S.id),1),V(p(Vr),{variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(S.type),1)]),_:2},1024),p(dF)(S)?(b(),me(p(Vr),{key:0,variant:"info",size:"sm"},{default:ke(()=>[Ve(N(p(t)("providers.managedBadge")),1)]),_:1})):te("",!0)]),C("span",CRe,N(p(t)("providers.modelCount",{count:h(S)})),1),C("span",wRe,[V(p(Ie),{name:"chevron-right",size:"sm"})])],8,yRe),C("div",_Re,[C("div",xRe,[s.value===S.id||i.value===S.id?(b(),me(fF,{key:0,mode:"edit",provider:S,guard:a.value&&s.value===S.id,onDirtyChange:$[4]||($[4]=I=>l.value=I),onGuardStay:w,onGuardDiscard:_,onSaved:k,onDeleting:$[5]||($[5]=I=>s.value=null),onDeleted:x},null,8,["provider","guard"])):te("",!0)])])],2))),128))]))]))}}),ARe=ht(SRe,[["__scopeId","data-v-2cfb5b3f"]]),MRe={class:"sec"},TRe={class:"sec-title"},ERe={class:"pu-group"},IRe={class:"pu-row"},LRe={class:"pu-main"},$Re={class:"pu-label"},NRe={class:"pu-hint"},FRe=tt({__name:"PlanUpgradeCard",setup(e){const{t}=Lt();return(n,o)=>(b(),A("section",MRe,[C("h3",TRe,N(p(t)("settings.planUsage.title")),1),C("div",ERe,[C("div",IRe,[C("span",LRe,[C("span",$Re,N(p(t)("settings.planUsage.freeTitle")),1),C("span",NRe,N(p(t)("settings.planUsage.freeHint")),1)]),V(p(Ft),{variant:"primary",size:"sm",onClick:o[0]||(o[0]=s=>p(o0)())},{default:ke(()=>[Ve(N(p(t)("sidebar.upgrade")),1)]),_:1})])])]))}}),pF=ht(FRe,[["__scopeId","data-v-fad87fe8"]]),RRe={class:"sec"},ORe={class:"sec-title"},PRe={class:"pu-group"},DRe={key:0,class:"pu-row pu-state"},BRe={key:1,class:"pu-row pu-state"},HRe={class:"pu-error-text"},zRe={key:2,class:"pu-row pu-state pu-empty"},WRe={class:"pu-main"},URe={class:"pu-label"},jRe={key:0,class:"pu-hint"},VRe={class:"pu-value"},qRe=["aria-valuenow","aria-valuemax"],KRe={key:0,class:"sec"},ZRe={class:"sec-title"},GRe={class:"pu-group"},YRe={class:"pu-row"},XRe={class:"pu-main"},JRe={class:"pu-label"},QRe={class:"pu-value"},eOe={key:0,class:"pu-value-sub"},tOe={key:0,class:"pu-meter"},nOe={class:"pu-row"},oOe={class:"pu-main"},sOe={class:"pu-label"},iOe={class:"pu-value"},rOe={class:"pu-row"},lOe={class:"pu-main"},aOe={class:"pu-label"},uOe={class:"pu-value"},cOe={class:"pu-value-sub"},dOe=tt({__name:"PlanUsageCard",props:{onFetchUsage:{type:Function}},setup(e){const t=e,{t:n}=Lt(),o=Z(!0),s=Z(null);async function i(){o.value=!0;try{s.value=await t.onFetchUsage()}finally{o.value=!1}}dn(i);const r=R(()=>s.value?.kind==="ok"?s.value:null),l=R(()=>r.value?.extraUsage??null),a=R(()=>{const m=r.value;return m===null?[]:m.summary===null?m.limits:[m.summary,...m.limits]}),u=R(()=>a.value.length>0),c=R(()=>s.value?.kind==="error"?s.value.message:n("settings.planUsage.loadFailed")),d=R(()=>s.value?.kind==="error"&&(s.value.status===402||s.value.status===403)),f=R(()=>l.value!==null&&l.value.monthlyChargeLimitEnabled&&l.value.monthlyChargeLimitCents>0);function h(m,w){const _=uye(m,w);return`${_.symbol}${_.number}`}function g(m){return m.resetAt===void 0?"":gN(m.resetAt,n)}return(m,w)=>d.value?(b(),me(pF,{key:0})):(b(),A(Pe,{key:1},[C("section",RRe,[C("h3",ORe,N(p(n)("settings.planUsage.title")),1),C("div",PRe,[o.value?(b(),A("div",DRe,[V(p(Ao),{size:"sm"})])):r.value===null?(b(),A("div",BRe,[C("span",HRe,N(c.value),1),V(p(Ft),{variant:"ghost",size:"sm",onClick:i},{default:ke(()=>[Ve(N(p(n)("settings.planUsage.retry")),1)]),_:1})])):u.value?(b(!0),A(Pe,{key:3},pt(a.value,(_,v)=>(b(),A("div",{key:v,class:"pu-row"},[C("span",WRe,[C("span",URe,N(p(mN)(_,p(n))),1),g(_)?(b(),A("span",jRe,N(g(_)),1)):te("",!0)]),C("span",VRe,N(p(n)("settings.planUsage.usedPct",{pct:p(um)(_.used,_.limit)})),1),C("span",{class:"pu-meter",role:"progressbar","aria-valuenow":_.used,"aria-valuemax":_.limit},[C("i",{class:Re(`sev-${p(by)(_.used,_.limit)}`),style:Gt({width:`${p(um)(_.used,_.limit)}%`})},null,6)],8,qRe)]))),128)):(b(),A("div",zRe,N(p(n)("settings.planUsage.empty")),1))])]),l.value!==null?(b(),A("section",KRe,[C("h3",ZRe,N(p(n)("settings.planUsage.boosterTitle")),1),C("div",GRe,[C("div",YRe,[C("span",XRe,[C("span",JRe,N(p(n)("settings.planUsage.monthlyUsed")),1)]),C("span",QRe,[Ve(N(h(l.value.monthlyUsedCents,l.value.currency)),1),f.value?(b(),A("span",eOe," / "+N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)):te("",!0)]),f.value?(b(),A("span",tOe,[C("i",{class:Re(`sev-${p(by)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}`),style:Gt({width:`${p(um)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}%`})},null,6)])):te("",!0)]),C("div",nOe,[C("span",oOe,[C("span",sOe,N(p(n)("settings.planUsage.monthlyLimit")),1)]),C("span",iOe,[f.value?(b(),A(Pe,{key:0},[Ve(N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)],64)):(b(),A(Pe,{key:1},[Ve(N(p(n)("settings.planUsage.unlimited")),1)],64))])]),C("div",rOe,[C("span",lOe,[C("span",aOe,N(p(n)("settings.planUsage.boosterBalance")),1)]),C("span",uOe,[Ve(N(h(l.value.balanceCents,l.value.currency)),1),C("span",cOe," / "+N(h(l.value.totalCents,l.value.currency)),1)])])])])):te("",!0)],64))}}),fOe=ht(dOe,[["__scopeId","data-v-582385f8"]]),pOe=["aria-expanded","aria-label"],hOe={class:"sm-picker__value-text"},mOe=["aria-label"],gOe=["aria-label"],vOe={class:"sm-picker__group"},yOe=["aria-selected","onMouseenter","onClick"],kOe={class:"sm-picker__option-label"},bOe=["aria-label"],COe={class:"sm-picker__group"},wOe=["aria-selected","onMouseenter","onClick"],_Oe={class:"sm-picker__option-label"},xOe=188,SOe=250,fS=8,AOe=tt({__name:"SecondaryModelPicker",props:{modelValue:{},effort:{},groups:{},modelInfoById:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt(),i=Z(null),r=Z(null),l=Z(null),a=new Map,u=Z(!1),c=Z(!1),d=Z({}),f=`sm-picker-${Math.random().toString(36).slice(2,9)}`,h=Z(""),g=Z(null),m=Z("right"),w=Z(0),_=Z("models"),v=Z(0),k=Z(0);let y=null;const x=R(()=>n.groups.flatMap(pe=>pe.options)),M=R(()=>n.modelValue?x.value.find(pe=>pe.id===n.modelValue)?.label??n.modelValue:""),$=R(()=>n.modelValue?n.effort?`${M.value} · ${n.effort}`:M.value:s("settings.noSecondaryModel")),S=R(()=>{const pe=g.value;if(pe===null)return[];const oe=Jp(n.modelInfoById[pe]),ve=n.effort===""?[null,...oe]:[...oe];return n.modelValue===pe&&n.effort!==""&&!oe.includes(n.effort)&&ve.push(n.effort),ve});function I(pe){return n.modelValue!==g.value?!1:pe===null?n.effort==="":n.effort===pe}function P(){const pe=S.value.findIndex(oe=>I(oe));return pe>=0?pe:0}function D(pe,oe){pe instanceof HTMLElement?a.set(oe,pe):a.delete(oe)}function T(){y!==null&&(clearTimeout(y),y=null)}function L(){T(),y=setTimeout(()=>{g.value=null,_.value==="efforts"&&(_.value="models")},SOe)}function B(pe){pe!==h.value&&(h.value=pe,v.value=Math.max(0,x.value.findIndex(oe=>oe.id===pe)))}function H(){const pe=r.value,oe=l.value;if(!pe||!oe)return;const ve=pe.getBoundingClientRect(),G=oe.offsetHeight,X=window.innerHeight-ve.bottom;c.value=XG;const fe=Math.max(fS,window.innerWidth-ve.right);d.value=c.value?{right:`${fe}px`,bottom:`${window.innerHeight-ve.top+4}px`,top:"auto"}:{right:`${fe}px`,top:`${ve.bottom+4}px`,bottom:"auto"}}function O(){const pe=l.value,oe=g.value===null?void 0:a.get(g.value);if(!pe||!oe)return;const ve=pe.getBoundingClientRect(),G=oe.getBoundingClientRect();w.value=Math.max(0,Math.min(G.top-ve.top-4,pe.offsetHeight-40));const X=window.innerWidth-ve.right,fe=ve.left;m.value=X>=xOe||X>=fe?"right":"left"}function F(pe,{moveFocus:oe=!1}={}){B(pe),T(),g.value=pe,oe&&(_.value="efforts",k.value=P()),yt(O)}function W(){g.value=null,_.value="models"}function z(){u.value||(u.value=!0,h.value=n.modelValue||(x.value[0]?.id??""),v.value=Math.max(0,x.value.findIndex(pe=>pe.id===h.value)),g.value=null,_.value="models",yt(H))}function U({restoreFocus:pe=!1}={}){u.value&&(T(),u.value=!1,g.value=null,pe&&yt(()=>r.value?.focus()))}function q(){u.value?U():z()}function K(pe){if(g.value===null)return;const oe={model:g.value,effort:pe??void 0};(oe.model!==n.modelValue||(oe.effort??"")!==n.effort)&&o("select",oe),U({restoreFocus:!0})}function ie(){yt(()=>{l.value?.querySelector(".sm-picker__option.is-kb-active")?.scrollIntoView({block:"nearest"})})}function ne(pe){const oe=x.value;if(oe.length===0)return;const ve=(v.value+pe+oe.length)%oe.length,G=oe[ve].id;B(G),g.value!==null&&F(G),ie()}function Y(pe){const oe=S.value;oe.length!==0&&(k.value=(k.value+pe+oe.length)%oe.length,ie())}function le(pe){if(!u.value){(pe.key==="Enter"||pe.key===" "||pe.key==="ArrowDown")&&(pe.preventDefault(),z());return}if(pe.key==="ArrowDown")pe.preventDefault(),_.value==="models"?ne(1):Y(1);else if(pe.key==="ArrowUp")pe.preventDefault(),_.value==="models"?ne(-1):Y(-1);else if(pe.key==="ArrowRight")pe.preventDefault(),F(h.value,{moveFocus:!0});else if(pe.key==="ArrowLeft")pe.preventDefault(),g.value!==null&&W();else if(pe.key==="Enter"||pe.key===" ")pe.preventDefault(),_.value==="models"?F(h.value,{moveFocus:!0}):K(S.value[k.value]??null);else if(pe.key==="Home"||pe.key==="End"){pe.preventDefault();const oe=pe.key==="Home";if(_.value==="models"){const ve=x.value;if(ve.length===0)return;const G=(oe?ve[0]:ve.at(-1)).id;B(G),g.value!==null&&F(G)}else k.value=oe?0:S.value.length-1;ie()}else pe.key==="Escape"&&(pe.preventDefault(),U({restoreFocus:!0}))}function Ee(pe){const oe=pe.target;i.value?.contains(oe)||l.value?.contains(oe)||U()}function de(pe){if(u.value){if(l.value?.contains(pe.target)){O();return}H(),O()}}function he(){U()}return dn(()=>{document.addEventListener("pointerdown",Ee),document.addEventListener("scroll",de,!0),window.addEventListener("resize",he)}),kn(()=>{document.removeEventListener("pointerdown",Ee),document.removeEventListener("scroll",de,!0),window.removeEventListener("resize",he),T()}),(pe,oe)=>(b(),A("div",{ref_key:"rootRef",ref:i,class:Re(["sm-picker",{"is-open":u.value}])},[C("button",{ref_key:"triggerRef",ref:r,class:"sm-picker__trigger",type:"button",role:"combobox","aria-controls":f,"aria-expanded":u.value,"aria-haspopup":"dialog","aria-label":p(s)("settings.secondaryModel"),onClick:q,onKeydown:le},[C("span",{class:Re(["sm-picker__value",{"is-placeholder":!e.modelValue}])},[C("span",hOe,N($.value),1)],2),V(p(Ie),{class:"sm-picker__chevron",name:"chevron-down",size:"sm"})],40,pOe),(b(),me(Zr,{to:"body"},[u.value?(b(),A("div",{key:0,id:f,ref_key:"menuRef",ref:l,class:Re(["sm-picker__menu",{"sm-picker__menu--up":c.value}]),style:Gt(d.value),role:"dialog","aria-label":p(s)("settings.secondaryModel")},[C("div",{class:"sm-picker__models",role:"listbox","aria-label":p(s)("settings.secondaryModel")},[(b(!0),A(Pe,null,pt(e.groups,ve=>(b(),A(Pe,{key:ve.provider},[C("div",vOe,N(ve.provider),1),(b(!0),A(Pe,null,pt(ve.options,G=>(b(),A("button",{key:G.id,ref_for:!0,ref:X=>D(X,G.id),class:Re(["sm-picker__option",{"is-selected":G.id===e.modelValue,"is-active":G.id===h.value,"is-kb-active":_.value==="models"&&G.id===h.value}]),type:"button",role:"option","aria-selected":G.id===e.modelValue,onMouseenter:X=>F(G.id),onMouseleave:L,onClick:X=>F(G.id,{moveFocus:!0})},[V(p(Ie),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",kOe,N(G.label),1),V(p(Ie),{class:"sm-picker__flyout-caret",name:"chevron-right",size:"sm"})],42,yOe))),128))],64))),128))],8,gOe),g.value!==null?(b(),A("div",{key:0,class:Re(["sm-picker__flyout",`sm-picker__flyout--${m.value}`]),style:Gt({top:`${w.value}px`}),role:"listbox","aria-label":p(s)("settings.secondaryModelEffort"),onMouseenter:T,onMouseleave:L},[C("div",COe,N(p(s)("settings.secondaryModelEffort")),1),(b(!0),A(Pe,null,pt(S.value,(ve,G)=>(b(),A("button",{key:ve??"__default__",class:Re(["sm-picker__option",{"is-selected":I(ve),"is-active":_.value==="efforts"&&G===k.value,"is-kb-active":_.value==="efforts"&&G===k.value,"is-muted":ve===null}]),type:"button",role:"option","aria-selected":I(ve),onMouseenter:X=>{_.value="efforts",k.value=G},onClick:X=>K(ve)},[V(p(Ie),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",_Oe,N(ve??p(s)("settings.secondaryModelEffortAuto")),1)],42,wOe))),128))],46,bOe)):te("",!0)],14,mOe)):te("",!0)]))],2))}}),MOe=ht(AOe,[["__scopeId","data-v-32518acf"]]),TOe=["aria-label"],EOe={class:"settings-tabs-header"},IOe={class:"settings-dialog-title"},LOe={class:"settings-tab-list"},$Oe=["aria-selected","onClick"],NOe={class:"settings-region"},FOe={class:"settings-region-header"},ROe={class:"panel"},OOe={class:"sec"},POe={class:"sec-title"},DOe={class:"settings-group"},BOe={class:"row"},HOe={class:"rlabel"},zOe={class:"hint"},WOe={class:"row language-row"},UOe={class:"rlabel"},jOe={class:"hint"},VOe={class:"row font-size-row"},qOe={class:"rlabel"},KOe={class:"hint"},ZOe={class:"sec notification-settings"},GOe={class:"sec-title"},YOe={class:"settings-group"},XOe={class:"row"},JOe={class:"rlabel"},QOe={class:"hint"},ePe={key:0,class:"hint"},tPe={class:"row"},nPe={class:"rlabel"},oPe={class:"hint"},sPe={class:"panel"},iPe={class:"sec"},rPe={class:"sec-title"},lPe={class:"settings-group"},aPe={class:"account-row"},uPe={class:"account-avatar","aria-hidden":"true"},cPe=["src"],dPe={class:"account-meta"},fPe={class:"account-name-row"},pPe={class:"account-name"},hPe={class:"account-sub"},mPe={key:0,class:"panel"},gPe={class:"panel"},vPe={class:"sec"},yPe={class:"sec-head"},kPe={class:"sec-title"},bPe={class:"settings-group"},CPe={class:"row"},wPe={class:"rlabel"},_Pe={class:"hint"},xPe={key:0,class:"select-wrap"},SPe={key:1,class:"rvalue mono"},APe={class:"row"},MPe={class:"rlabel"},TPe={class:"hint"},EPe={class:"row"},IPe={class:"rlabel"},LPe={class:"hint"},$Pe={class:"row"},NPe={class:"rlabel"},FPe={class:"hint"},RPe={key:1,class:"empty-config"},OPe={key:0,class:"sec"},PPe={class:"sec-head"},DPe={class:"sec-title"},BPe={class:"settings-group"},HPe={class:"row"},zPe={class:"rlabel"},WPe={class:"hint"},UPe={key:0,class:"select-wrap"},jPe={key:1,class:"rvalue mono"},VPe={class:"panel"},qPe={class:"sec"},KPe={class:"sec-title"},ZPe={class:"settings-group"},GPe={class:"row"},YPe={class:"rlabel"},XPe={class:"hint"},JPe={class:"rvalue"},QPe={class:"row"},eDe={class:"rlabel"},tDe={class:"hint"},nDe={class:"rvalue"},oDe={class:"row"},sDe={class:"rlabel"},iDe={class:"hint"},rDe={class:"rvalue"},lDe={key:0,class:"row"},aDe={class:"rlabel"},uDe={key:0,class:"hint"},cDe={key:1,class:"hint"},dDe={key:1,class:"row"},fDe={class:"rlabel"},pDe={class:"hint"},hDe={key:0,class:"sec"},mDe={class:"sec-title"},gDe={class:"settings-group"},vDe={class:"row"},yDe={class:"rlabel"},kDe={class:"hint"},bDe={class:"hint"},CDe={class:"sec"},wDe={class:"sec-title"},_De={class:"settings-group"},xDe={class:"row"},SDe={class:"rlabel"},ADe={class:"hint"},MDe={key:0,class:"hint"},TDe={class:"panel"},EDe={class:"panel-head"},IDe={class:"panel-title"},LDe={class:"panel-desc"},$De={class:"archive-toolbar"},NDe={class:"archive-search"},FDe=["placeholder"],RDe={key:0,class:"archive-empty"},ODe={key:0,class:"archive-list"},PDe={class:"archive-workspace"},DDe={class:"path"},BDe={class:"count"},HDe={class:"setting-card"},zDe={class:"archive-meta"},WDe={class:"archive-name"},UDe={class:"archive-time"},jDe={key:1,class:"archive-empty"},VDe=100,qDe=tt({__name:"SettingsDialog",props:{colorScheme:{},fontScale:{},initialTab:{},managedProviderStatus:{},managedUserInfo:{},onFetchUsage:{type:Function},notify:{type:Boolean},notifyPermission:{},notifySound:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},experimentalFlags:{}},emits:["setColorScheme","setFontScale","setNotify","setNotifySound","login","logout","updateConfig","close"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=R(()=>o.managedProviderStatus==="authenticated"),r=R(()=>i.value?o.managedUserInfo?.nickname||n("sidebar.defaultUserName"):n("sidebar.notSignedIn")),l=R(()=>o.managedUserInfo?.userLevelName?.trim()??""),a=Z(!1);et(()=>o.managedUserInfo?.avatar,()=>{a.value=!1});const u=R(()=>!!o.managedUserInfo?.avatar&&!a.value),c=R(()=>i.value?n("settings.signedIn"):n("settings.signedOutHint")),d=Z(o.initialTab??"general"),f=Z(!1);let h=null;function g(){f.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{f.value=!1,h=null},900)}const m=[{id:"general",labelKey:"settings.tabs.general",icon:"sliders"},{id:"agent",labelKey:"settings.tabs.agent",icon:"robot"},{id:"account",labelKey:"settings.tabs.account",icon:"user"},{id:"providers",labelKey:"settings.tabs.providers",icon:"bolt"},{id:"advanced",labelKey:"settings.tabs.advanced",icon:"microscope"},{id:"archived",labelKey:"settings.tabs.archived",icon:"archive"}],w=Sfe(),_=["manual","yolo","auto"],v={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},k=Z(null);rF(k);const{isConfirmOpen:y}=pu();function x(Fe){Fe.key==="Escape"&&!Fe.defaultPrevented&&!y.value&&s("close")}dn(()=>document.addEventListener("keydown",x)),kn(()=>{document.removeEventListener("keydown",x),h&&clearTimeout(h)});function M(){f$()}const $=(()=>{const Fe="0.33.0".trim()?"0.33.0":"";let Oe="";if("2026-08-06T11:31:37.779Z".trim()){const ft=new Date("2026-08-06T11:31:37.779Z");if(!Number.isNaN(ft.getTime())){const $t=Ht=>String(Ht).padStart(2,"0");Oe=`${ft.getFullYear()}-${$t(ft.getMonth()+1)}-${$t(ft.getDate())} ${$t(ft.getHours())}:${$t(ft.getMinutes())}`}}const Ye=Oe===""?Fe:`${Fe} · ${Oe}`;return Ye===""?"-":Ye})(),S=u$(),I=Z(!1),P=Z(null);async function D(){if(!I.value){I.value=!0,P.value=null;try{P.value=await S.check()}finally{I.value=!1}}}const T=R(()=>{const Fe=P.value;if(Fe===null)return"";switch(Fe.outcome){case"available":return S.status.value.state==="downloaded"?n("settings.updateCheckDownloaded",{version:Fe.version??""}):S.autoDownload.value?n("settings.updateCheckAvailableAuto",{version:Fe.version??""}):n("settings.updateCheckAvailable",{version:Fe.version??""});case"latest":return n("settings.updateCheckLatest");case"unsupported":return n("settings.updateCheckUnsupported");case"error":return n("settings.updateCheckFailed")}}),L=R(()=>{const Fe=new Map;for(const Oe of o.models??[])Fe.set(Oe.id,{id:Oe.id,label:Oe.displayName??Oe.model??Oe.id,provider:Oe.provider});for(const[Oe,Ye]of Object.entries(o.config?.models??{})){if(Fe.has(Oe))continue;const ft=F(Ye);Fe.set(Oe,{id:Oe,label:W(Oe,Ye,ft),provider:ft??Oe})}return Array.from(Fe.values())}),B=R(()=>{const Fe=new Map;for(const Oe of L.value){const Ye=Fe.get(Oe.provider)??[];Ye.push(Oe),Fe.set(Oe.provider,Ye)}for(const Oe of Fe.values())Oe.sort((Ye,ft)=>Ye.label.localeCompare(ft.label));return Array.from(Fe.entries()).toSorted(([Oe],[Ye])=>Oe.localeCompare(Ye)).map(([Oe,Ye])=>({provider:Oe,options:Ye}))}),H=R(()=>{const Fe=B.value.flatMap(Oe=>Oe.options.map(Ye=>({value:Ye.id,label:Ye.label,group:Oe.provider})));return o.config?.defaultModel||Fe.unshift({value:"",label:n("settings.noDefaultModel"),group:"",disabled:!0}),Fe}),O=R(()=>{const Fe=o.config?.defaultPermissionMode;return Fe==="auto"||Fe==="yolo"||Fe==="manual"?Fe:"manual"});function F(Fe){if(!Fe||typeof Fe!="object")return;const Oe=Fe;return typeof Oe.provider=="string"?Oe.provider:void 0}function W(Fe,Oe,Ye){if(!Oe||typeof Oe!="object")return Fe;const ft=Oe,$t=typeof ft.model=="string"?ft.model:void 0,Ht=Ye??F(Oe);return $t&&Ht?`${Fe} (${Ht}/${$t})`:$t?`${Fe} (${$t})`:Fe}function z(Fe){return Fe===!0}function U(Fe){!Fe||Fe===o.config?.defaultModel||s("updateConfig",{defaultModel:Fe})}function q(Fe){Fe!==O.value&&s("updateConfig",{defaultPermissionMode:Fe})}const K=R(()=>(o.experimentalFlags?.["secondary-model"]??o.config?.experimental?.["secondary-model"])===!0),ie=R(()=>o.config?.secondaryModel?.model??""),ne=R(()=>o.config?.secondaryModel?.defaultEffort??""),Y=R(()=>Object.fromEntries((o.models??[]).map(Fe=>[Fe.id,Fe])));function le(Fe){Fe.model===ie.value&&(Fe.effort??"")===ne.value||s("updateConfig",{secondaryModel:Fe.effort?{model:Fe.model,defaultEffort:Fe.effort}:{model:Fe.model}})}function Ee(Fe){const Oe=o.config?.[Fe];s("updateConfig",{[Fe]:!z(Oe)})}function de(){const Fe=o.config?.thinking;return!Fe||typeof Fe!="object"?!0:Fe.enabled!==!1}function he(){s("updateConfig",{thinking:{enabled:!de()}})}function pe(){const Fe=o.config?.telemetry!==!1;s("updateConfig",{telemetry:!Fe})}function oe(Fe){d.value=Fe}const ve=hu(),G=R(()=>i.value&&ve.managedMembership.value==="free"),X=Z([]),fe=Z(!1),Ce=Z(!1),ge=Z(""),Q=Z("all"),ee=Z("archived-desc");async function ce(){if(!(fe.value||Ce.value)){fe.value=!0;try{const Fe=[];let Oe;for(;;){const Ye=await ve.loadArchivedSessions({beforeId:Oe,pageSize:VDe});if(Fe.push(...Ye.items),!Ye.hasMore||Ye.items.length===0)break;const ft=Ye.items.at(-1)?.id;if(ft===void 0)break;Oe=ft}X.value=Fe,Ce.value=!0}catch(Fe){gl("loadAllArchived failed",Fe)}finally{fe.value=!1}}}et(d,Fe=>{Fe==="archived"&&!Ce.value&&ce()},{immediate:!0});const ue=R(()=>{const Fe=new Set;for(const Oe of X.value)Fe.add(Oe.cwd);return Array.from(Fe).sort((Oe,Ye)=>Oe.localeCompare(Ye))}),Se=R(()=>[{value:"all",label:n("settings.archivedAllWorkspaces")},...ue.value.map(Fe=>({value:Fe,label:Fe}))]),Ue=R(()=>{const Fe=ge.value.trim().toLowerCase();let Oe=X.value.filter(Ye=>Ye.archived===!0);return Q.value!=="all"&&(Oe=Oe.filter(Ye=>Ye.cwd===Q.value)),Fe&&(Oe=Oe.filter(Ye=>Ye.title.toLowerCase().includes(Fe))),Oe=Oe.slice(),ee.value==="archived-desc"?Oe.sort((Ye,ft)=>ft.updatedAt.localeCompare(Ye.updatedAt)):ee.value==="created-desc"?Oe.sort((Ye,ft)=>ft.createdAt.localeCompare(Ye.createdAt)):Oe.sort((Ye,ft)=>Ye.title.localeCompare(ft.title,"zh")),Oe}),_e=R(()=>{const Fe=new Map;for(const Oe of Ue.value){const Ye=Fe.get(Oe.cwd)??[];Ye.push(Oe),Fe.set(Oe.cwd,Ye)}return Array.from(Fe.entries()).map(([Oe,Ye])=>({cwd:Oe,items:Ye}))});async function Te(Fe){await ve.restoreSession(Fe)&&(X.value=X.value.filter(Ye=>Ye.id!==Fe))}function st(Fe){const Oe=new Date(Fe);if(Number.isNaN(Oe.getTime()))return Fe;const Ye=ft=>String(ft).padStart(2,"0");return`${Oe.getFullYear()}-${Ye(Oe.getMonth()+1)}-${Ye(Oe.getDate())} ${Ye(Oe.getHours())}:${Ye(Oe.getMinutes())}`}return(Fe,Oe)=>(b(),me(p(ca),{open:!0,"close-on-esc":!1,"aria-label":p(n)("settings.title"),size:"xl",height:"fixed",padded:!1,level:"grouped",onClose:Oe[16]||(Oe[16]=Ye=>s("close"))},{default:ke(()=>[C("div",{ref_key:"dialogRef",ref:k,class:"sd"},[C("nav",{class:"settings-tabs",role:"tablist","aria-label":p(n)("settings.title")},[C("header",EOe,[C("h2",IOe,N(p(n)("settings.title")),1)]),C("div",LOe,[(b(),A(Pe,null,pt(m,Ye=>C("button",{key:Ye.id,type:"button",class:Re(["tab",{on:d.value===Ye.id}]),role:"tab","aria-selected":d.value===Ye.id,onClick:ft=>oe(Ye.id)},[V(p(Ie),{name:Ye.icon,size:"md"},null,8,["name"]),C("span",null,N(p(n)(Ye.labelKey)),1)],10,$Oe)),64))])],8,TOe),C("section",NOe,[C("header",FOe,[V(p(gn),{size:"sm",label:p(n)("settings.close"),onClick:Oe[0]||(Oe[0]=Ye=>s("close"))},{default:ke(()=>[V(p(Ie),{name:"close",size:"md"})]),_:1},8,["label"])]),C("div",{class:Re(["body",{scrolling:f.value}]),onScroll:g},[In(C("section",ROe,[C("section",OOe,[C("h3",POe,N(p(n)("settings.appearance")),1),C("div",DOe,[C("div",BOe,[C("span",HOe,[Ve(N(p(n)("theme.colorSchemeLabel"))+" ",1),C("span",zOe,N(p(n)("settings.colorSchemeHint")),1)]),V(p(bi),{"model-value":e.colorScheme,options:[{value:"light",label:p(n)("theme.light"),icon:"light-mode"},{value:"dark",label:p(n)("theme.dark"),icon:"dark-mode"},{value:"system",label:p(n)("theme.system")}],"onUpdate:modelValue":Oe[1]||(Oe[1]=Ye=>s("setColorScheme",Ye))},null,8,["model-value","options"])]),C("div",WOe,[C("span",UOe,[Ve(N(p(n)("sidebar.language"))+" ",1),C("span",jOe,N(p(n)("settings.languageHint")),1)]),V(aF)]),C("div",VOe,[C("span",qOe,[Ve(N(p(n)("settings.uiFontSize"))+" ",1),C("span",KOe,N(p(n)("settings.uiFontSizeHint")),1)]),V(p(bi),{"model-value":e.fontScale,options:[{value:"small",label:"S"},{value:"medium",label:"M"},{value:"large",label:"L"},{value:"xlarge",label:"XL"}],"aria-label":p(n)("settings.uiFontSize"),"onUpdate:modelValue":Oe[2]||(Oe[2]=Ye=>s("setFontScale",Ye))},null,8,["model-value","aria-label"])])])]),C("section",ZOe,[C("h3",GOe,N(p(n)("settings.notifications")),1),C("div",YOe,[C("div",XOe,[C("span",JOe,[Ve(N(p(n)("settings.notifyEnabled"))+" ",1),C("span",QOe,N(p(n)("settings.notifyEnabledHint")),1),e.notifyPermission==="denied"?(b(),A("span",ePe,N(p(n)("settings.notifyDenied")),1)):te("",!0)]),V(p(td),{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:p(n)("settings.notifyEnabled"),"onUpdate:modelValue":Oe[3]||(Oe[3]=Ye=>s("setNotify",Ye))},null,8,["model-value","disabled","label"])]),C("div",tPe,[C("span",nPe,[Ve(N(p(n)("settings.notifySound"))+" ",1),C("span",oPe,N(p(n)("settings.notifySoundHint")),1)]),V(p(td),{"model-value":e.notifySound,label:p(n)("settings.notifySound"),"onUpdate:modelValue":Oe[4]||(Oe[4]=Ye=>s("setNotifySound",Ye))},null,8,["model-value","label"])])])])],512),[[Es,d.value==="general"]]),In(C("section",sPe,[C("section",iPe,[C("h3",rPe,N(p(n)("settings.account")),1),C("div",lPe,[C("div",aPe,[C("span",uPe,[u.value?(b(),A("img",{key:0,src:o.managedUserInfo?.avatar,alt:"",onError:Oe[5]||(Oe[5]=Ye=>a.value=!0)},null,40,cPe)):(b(),me(p(Ie),{key:1,name:"user",size:"md"}))]),C("span",dPe,[C("span",fPe,[C("span",pPe,N(r.value),1),l.value?(b(),me(p(Vr),{key:0,class:"account-level",variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(l.value),1)]),_:1})):te("",!0)]),C("span",hPe,N(c.value),1)]),i.value?(b(),me(p(Ft),{key:0,variant:"danger-soft",size:"sm",onClick:Oe[6]||(Oe[6]=Ye=>s("logout"))},{default:ke(()=>[Ve(N(p(n)("sidebar.signOut")),1)]),_:1})):(b(),me(p(Ft),{key:1,variant:"primary",size:"sm",onClick:Oe[7]||(Oe[7]=Ye=>s("login"))},{default:ke(()=>[Ve(N(p(n)("sidebar.signIn")),1)]),_:1}))])])]),G.value?(b(),me(pF,{key:0})):i.value?(b(),me(fOe,{key:1,"on-fetch-usage":o.onFetchUsage},null,8,["on-fetch-usage"])):te("",!0)],512),[[Es,d.value==="account"]]),d.value==="providers"?(b(),A("section",mPe,[V(ARe)])):te("",!0),In(C("section",gPe,[C("section",vPe,[C("div",yPe,[C("h3",kPe,N(p(n)("settings.agentDefaults")),1)]),C("div",bPe,[e.config?(b(),A(Pe,{key:0},[C("div",CPe,[C("span",wPe,[Ve(N(p(n)("settings.defaultModel"))+" ",1),C("span",_Pe,N(p(n)("settings.defaultModelHint")),1)]),B.value.length>0?(b(),A("div",xPe,[V(p(o3),{"model-value":e.config.defaultModel??"",options:H.value,"aria-label":p(n)("settings.defaultModel"),"onUpdate:modelValue":U},null,8,["model-value","options","aria-label"])])):(b(),A("span",SPe,N(e.config.defaultModel??p(n)("settings.noDefaultModel")),1))]),C("div",APe,[C("span",MPe,[Ve(N(p(n)("settings.defaultPermission"))+" ",1),C("span",TPe,N(p(n)("settings.defaultPermissionHint")),1)]),V(p(bi),{"model-value":O.value,options:_.map(Ye=>({value:Ye,label:p(n)(v[Ye])})),"onUpdate:modelValue":Oe[8]||(Oe[8]=Ye=>q(Ye))},null,8,["model-value","options"])]),C("div",EPe,[C("span",IPe,[Ve(N(p(n)("settings.defaultThinking"))+" ",1),C("span",LPe,N(p(n)("settings.defaultThinkingHint")),1)]),V(p(td),{"model-value":de(),label:p(n)("settings.defaultThinking"),"onUpdate:modelValue":Oe[9]||(Oe[9]=Ye=>he())},null,8,["model-value","label"])]),C("div",$Pe,[C("span",NPe,[Ve(N(p(n)("settings.defaultPlanMode"))+" ",1),C("span",FPe,N(p(n)("settings.defaultPlanModeHint")),1)]),V(p(td),{"model-value":z(e.config.defaultPlanMode),label:p(n)("settings.defaultPlanMode"),"onUpdate:modelValue":Oe[10]||(Oe[10]=Ye=>Ee("defaultPlanMode"))},null,8,["model-value","label"])])],64)):(b(),A("div",RPe,N(p(n)("settings.configUnavailable")),1))])]),e.config&&K.value?(b(),A("section",OPe,[C("div",PPe,[C("h3",DPe,N(p(n)("settings.secondaryModelSection")),1)]),C("div",BPe,[C("div",HPe,[C("span",zPe,[Ve(N(p(n)("settings.secondaryModel"))+" ",1),C("span",WPe,N(p(n)("settings.secondaryModelHint")),1)]),B.value.length>0?(b(),A("div",UPe,[V(MOe,{"model-value":ie.value,effort:ne.value,groups:B.value,"model-info-by-id":Y.value,onSelect:le},null,8,["model-value","effort","groups","model-info-by-id"])])):(b(),A("span",jPe,N(ie.value||p(n)("settings.noSecondaryModel")),1))])])])):te("",!0)],512),[[Es,d.value==="agent"]]),In(C("section",VPe,[C("section",qPe,[C("h3",KPe,N(p(n)("settings.versionAndUpdates")),1),C("div",ZPe,[C("div",GPe,[C("span",YPe,[Ve(N(p(n)("settings.appVersion"))+" ",1),C("span",XPe,N(p(n)("settings.appVersionHint")),1)]),C("span",JPe,N(p($)),1)]),C("div",QPe,[C("span",eDe,[Ve(N(p(n)("settings.serverVersion"))+" ",1),C("span",tDe,N(p(n)("settings.serverVersionHint")),1)]),C("span",nDe,N(e.serverVersion||"-"),1)]),C("div",oDe,[C("span",sDe,[Ve(N(p(n)("settings.serverAddress"))+" ",1),C("span",iDe,N(p(n)("settings.serverAddressHint")),1)]),C("span",rDe,N(p(w)),1)]),p(S).canCheck?(b(),A("div",lDe,[C("span",aDe,[Ve(N(p(n)("settings.checkUpdate"))+" ",1),T.value?(b(),A("span",uDe,N(T.value),1)):(b(),A("span",cDe,N(p(n)("settings.checkUpdateHint")),1))]),V(p(Ft),{variant:"secondary",size:"sm",disabled:I.value,onClick:D},{default:ke(()=>[Ve(N(I.value?p(n)("settings.updateChecking"):p(n)("settings.checkUpdateBtn")),1)]),_:1},8,["disabled"])])):te("",!0),p(S).canToggleAutoDownload?(b(),A("div",dDe,[C("span",fDe,[Ve(N(p(n)("settings.autoDownloadUpdate"))+" ",1),C("span",pDe,N(p(n)("settings.autoDownloadUpdateHint")),1)]),V(p(td),{"model-value":p(S).autoDownload.value,label:p(n)("settings.autoDownloadUpdate"),"onUpdate:modelValue":Oe[11]||(Oe[11]=Ye=>p(S).setAutoDownload(Ye))},null,8,["model-value","label"])])):te("",!0)])]),e.config?(b(),A("section",hDe,[C("h3",mDe,N(p(n)("settings.privacy")),1),C("div",gDe,[C("div",vDe,[C("span",yDe,[Ve(N(p(n)("settings.telemetry"))+" ",1),C("span",kDe,N(p(n)("settings.telemetryHint")),1),C("span",bDe,N(p(n)("settings.telemetryRestartHint")),1)]),V(p(td),{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:p(n)("settings.telemetry"),"onUpdate:modelValue":Oe[12]||(Oe[12]=Ye=>pe())},null,8,["model-value","disabled","label"])])])])):te("",!0),C("section",CDe,[C("h3",wDe,N(p(n)("settings.diagnostics")),1),C("div",_De,[C("div",xDe,[C("span",SDe,[Ve(N(p(n)("settings.exportLog"))+" ",1),C("span",ADe,N(p(n)("settings.exportLogHint")),1),p(Qr)()?te("",!0):(b(),A("span",MDe,N(p(n)("settings.logHint")),1))]),V(p(Ft),{variant:"secondary",size:"sm",onClick:M},{default:ke(()=>[Ve(N(p(n)("settings.exportLogBtn")),1)]),_:1})])])])],512),[[Es,d.value==="advanced"]]),In(C("section",TDe,[C("div",EDe,[C("h4",IDe,N(p(n)("settings.archivedTitle")),1),C("p",LDe,N(p(n)("settings.archivedDesc")),1)]),C("div",$De,[C("label",NDe,[Oe[17]||(Oe[17]=C("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[C("circle",{cx:"11",cy:"11",r:"7"}),C("path",{d:"m21 21-4.3-4.3"})],-1)),In(C("input",{"onUpdate:modelValue":Oe[13]||(Oe[13]=Ye=>ge.value=Ye),placeholder:p(n)("settings.archivedSearch")},null,8,FDe),[[ri,ge.value]])]),V(p(o3),{"model-value":Q.value,options:Se.value,size:"sm","aria-label":p(n)("settings.archivedAllWorkspaces"),"onUpdate:modelValue":Oe[14]||(Oe[14]=Ye=>Q.value=Ye)},null,8,["model-value","options","aria-label"]),V(p(bi),{size:"sm","model-value":ee.value,options:[{value:"archived-desc",label:p(n)("settings.archivedSortArchived"),icon:"clock"},{value:"created-desc",label:p(n)("settings.archivedSortCreated"),icon:"calendar-schedule"},{value:"name-asc",label:p(n)("settings.archivedSortName"),icon:"sort"}],"onUpdate:modelValue":Oe[15]||(Oe[15]=Ye=>ee.value=Ye)},null,8,["model-value","options"])]),fe.value?(b(),A("div",RDe,N(p(n)("settings.archivedLoadingAll")),1)):(b(),A(Pe,{key:1},[_e.value.length>0?(b(),A("div",ODe,[(b(!0),A(Pe,null,pt(_e.value,Ye=>(b(),A("section",{key:Ye.cwd,class:"archive-card"},[C("div",PDe,[V(p(Ie),{name:"folder-closed",size:"md"}),C("span",DDe,N(Ye.cwd),1),C("span",BDe,N(p(n)("settings.archivedSessionsCount",{count:Ye.items.length})),1)]),C("div",HDe,[(b(!0),A(Pe,null,pt(Ye.items,ft=>(b(),A("div",{key:ft.id,class:"archive-row"},[C("div",zDe,[C("div",WDe,N(ft.title),1),C("div",UDe,N(p(n)("settings.archivedAt",{time:st(ft.updatedAt)})),1)]),V(p(Ft),{variant:"secondary",size:"sm",onClick:$t=>Te(ft.id)},{default:ke(()=>[V(p(Ie),{name:"undo",size:"sm"}),C("span",null,N(p(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128))])]))),128))])):(b(),A("div",jDe,N(X.value.length===0?p(n)("settings.archivedEmpty"):p(n)("settings.archivedNoMatch")),1))],64))],512),[[Es,d.value==="archived"]])],34)])],512)]),_:1},8,["aria-label"]))}}),KDe=ht(qDe,[["__scopeId","data-v-1764f4b1"]]),ZDe={class:"aw"},GDe={class:"crumbbar"},YDe={class:"crumbs"},XDe={key:0,class:"crumb-sep"},JDe=["onClick"],QDe={key:0,class:"filterbar"},eBe=["placeholder"],tBe={class:"folder-list"},nBe={key:0,class:"fl-loading"},oBe=["onClick"],sBe={class:"folder-name search-rel"},iBe={key:0,class:"fl-empty"},rBe={key:1,class:"fl-loading"},lBe=["onClick"],aBe={class:"folder-name"},uBe={key:0,class:"fl-empty"},cBe={class:"paste-row"},dBe={class:"paste-input-wrap"},fBe={key:1,class:"add-error",role:"alert"},pBe={class:"actions"},hBe={class:"footer-hint"},mBe=600,gBe=6,pS=150,vBe=tt({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=Z(!0),r=Z(!1),l=Z(!1),a=Z(""),u=Z(null),c=Z([]),d=Z(""),f=Z(!1),h=Z([]),g=R(()=>d.value.trim().length>0);let m=0,w=null;function _(W,z){const U=W.toLowerCase(),q=z.toLowerCase();let K=0;for(let ie=0;ie0&&ne=pS))break;Y.depth+1{if(w&&clearTimeout(w),W.trim()===""){m++,h.value=[],f.value=!1;return}w=setTimeout(()=>void v(W),220)});const k=Z(!1),y=Z(""),x=R(()=>y.value.trim()),M=R(()=>{const W=a.value;if(!W)return[];const z=W.split("/").filter(Boolean),U=[{label:"/",path:"/"}];let q="";for(const K of z)q+=`/${K}`,U.push({label:K,path:q});return U}),$=R(()=>a.value.length>0);async function S(W){r.value=!0;try{const z=await o.browseFs(W);if(!z.path){l.value=!0;return}a.value=z.path,u.value=z.parent,c.value=z.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function I(W){W.isDir&&S(W.path)}function P(){u.value&&S(u.value)}function D(){$.value&&s("add",a.value)}function T(){x.value.length!==0&&s("add",x.value)}const{handleCompositionStart:L,handleCompositionEnd:B,isComposingKeyEvent:H}=Sr();function O(W){H(W)||T()}function F(W){W.key==="Escape"&&H(W)&&W.stopPropagation()}return dn(async()=>{r.value=!0;try{if(o.defaultPath&&(await S(o.defaultPath),!l.value))return;const W=await o.getFsHome();W.home?await S(W.home):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),kn(()=>{w&&clearTimeout(w)}),(W,z)=>(b(),me(p(ca),{open:i.value,"onUpdate:open":z[5]||(z[5]=U=>i.value=U),title:p(n)("workspace.addTitle"),size:"lg",height:"fixed",padded:!1,onClose:z[6]||(z[6]=U=>s("close"))},{default:ke(()=>[C("div",ZDe,[l.value?te("",!0):(b(),A(Pe,{key:0},[C("div",GDe,[V(p(gn),{size:"sm",disabled:!u.value,label:p(n)("workspace.up"),onClick:P},{default:ke(()=>[V(p(Ie),{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label"]),C("div",YDe,[(b(!0),A(Pe,null,pt(M.value,(U,q)=>(b(),A(Pe,{key:U.path},[q>1?(b(),A("span",XDe,"/")):te("",!0),C("button",{class:Re(["crumb",{last:q===M.value.length-1}]),onClick:K=>S(U.path)},N(U.label),11,JDe)],64))),128))])]),r.value?te("",!0):(b(),A("div",QDe,[V(p(Ie),{class:"filter-icon",name:"search",size:"md"}),In(C("input",{"onUpdate:modelValue":z[0]||(z[0]=U=>d.value=U),class:"filter-input",type:"text",placeholder:p(n)("workspace.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:z[1]||(z[1]=Et(()=>{},["stop"]))},null,40,eBe),[[ri,d.value]]),f.value?(b(),me(p(Ao),{key:0,size:"sm"})):te("",!0)])),C("div",tBe,[r.value?(b(),A("div",nBe,N(p(n)("workspace.browsing")),1)):g.value?(b(),A(Pe,{key:1},[(b(!0),A(Pe,null,pt(h.value,U=>(b(),A("button",{key:U.path,class:"folder-row",onClick:q=>S(U.path)},[V(p(Ie),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",sBe,N(U.rel),1)],8,oBe))),128)),!f.value&&h.value.length===0?(b(),A("div",iBe,N(p(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):f.value&&h.value.length===0?(b(),A("div",rBe,N(p(n)("workspace.searching")),1)):te("",!0)],64)):(b(),A(Pe,{key:2},[(b(!0),A(Pe,null,pt(c.value,U=>(b(),A("button",{key:U.path,class:"folder-row",onClick:q=>I(U)},[V(p(Ie),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",aBe,N(U.name),1)],8,lBe))),128)),c.value.length===0?(b(),A("div",uBe,N(p(n)("workspace.noSubfolders")),1)):te("",!0)],64))])],64)),C("div",{class:Re(["paste-section",{"paste-only":l.value}])},[!l.value&&!k.value?(b(),me(p(Ft),{key:0,variant:"ghost",size:"sm",onClick:z[2]||(z[2]=U=>k.value=!0)},{default:ke(()=>[Ve(N(p(n)("workspace.pasteToggle")),1)]),_:1})):(b(),me(p(xW),{key:1,label:p(n)("workspace.pathLabel")},{default:ke(()=>[C("div",cBe,[C("div",dBe,[V(p(zs),{modelValue:y.value,"onUpdate:modelValue":z[3]||(z[3]=U=>y.value=U),placeholder:p(n)("workspace.pathPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:[xl(Et(O,["stop"]),["enter"]),F],onCompositionstart:p(L),onCompositionend:p(B)},null,8,["modelValue","placeholder","onKeydown","onCompositionstart","onCompositionend"])]),V(p(gn),{disabled:x.value.length===0,label:p(n)("workspace.add"),onClick:T},{default:ke(()=>[V(p(Ie),{name:"plus",size:"md"})]),_:1},8,["disabled","label"])])]),_:1},8,["label"]))],2),e.error?(b(),A("div",fBe,N(e.error),1)):te("",!0),C("div",pBe,[V(p(Pn),{text:a.value},{default:ke(()=>[l.value?te("",!0):(b(),me(p(Ft),{key:0,variant:"primary",disabled:!$.value,onClick:D},{default:ke(()=>[Ve(N(p(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),V(p(Ft),{variant:"secondary",onClick:z[4]||(z[4]=U=>s("close"))},{default:ke(()=>[Ve(N(p(n)("workspace.cancel")),1)]),_:1})]),C("div",hBe,N(p(n)("workspace.browseHint")),1)])]),_:1},8,["open","title"]))}}),yBe=ht(vBe,[["__scopeId","data-v-9655d534"]]),kBe={key:0,class:"confirm-dialog__message"},bBe=tt({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt();function i(){n.loading||(o("update:open",!1),o("cancel"))}function r(l){if(l.key!=="Enter"||!n.open||n.loading)return;const a=l.target;a instanceof HTMLButtonElement||a instanceof HTMLAnchorElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLInputElement||(l.preventDefault(),o("confirm"))}return typeof window<"u"&&window.addEventListener("keydown",r),Un(()=>{typeof window<"u"&&window.removeEventListener("keydown",r)}),(l,a)=>(b(),me(p(ca),{open:e.open,title:e.title,height:"auto","initial-focus":".confirm-dialog__confirm","close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":a[1]||(a[1]=u=>o("update:open",u)),onClose:i},{foot:ke(()=>[V(p(Ft),{variant:"secondary",disabled:e.loading,onClick:i},{default:ke(()=>[Ve(N(e.cancelLabel??p(s)("common.cancel")),1)]),_:1},8,["disabled"]),V(p(Ft),{class:"confirm-dialog__confirm",variant:e.variant,loading:e.loading,onClick:a[0]||(a[0]=u=>o("confirm"))},{default:ke(()=>[Ve(N(e.confirmLabel??p(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:ke(()=>[e.message?(b(),A("p",kBe,N(e.message),1)):te("",!0)]),_:1},8,["open","title","close-on-esc","close-on-overlay"]))}}),CBe=ht(bBe,[["__scopeId","data-v-76fb3ee3"]]),wBe=tt({__name:"ConfirmDialogHost",setup(e){const{current:t,busy:n,settle:o,runAction:s}=pu();function i(){s()}return(r,l)=>p(t)!==null?(b(),me(CBe,{key:0,open:!0,title:p(t).title,message:p(t).message,"confirm-label":p(t).confirmLabel,"cancel-label":p(t).cancelLabel,variant:p(t).variant,loading:p(n),onConfirm:i,onCancel:l[0]||(l[0]=a=>p(o)(!1))},null,8,["title","message","confirm-label","cancel-label","variant","loading"])):te("",!0)}}),_Be={class:"rows"},xBe={class:"row"},SBe={class:"row"},ABe={class:"row"},MBe={class:"row"},TBe={class:"row"},EBe={class:"row"},IBe={class:"ctx-text"},LBe={key:0,class:"bar"},$Be={class:"row"},NBe=tt({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=Z(!0),r=R(()=>o.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100)))),l=R(()=>o.status.ctxMax>0?n("status.statusContextValue",{used:Ml(o.status.ctxUsed),max:Ml(o.status.ctxMax),pct:r.value}):n("status.statusNone"));function a(g){return n(g==="yolo"?"status.permissionYolo":g==="auto"?"status.permissionAuto":"status.permissionManual")}const u=R(()=>{const g=o.status.permission;return g==="auto"?"var(--color-danger)":g==="yolo"?"var(--color-warning)":"var(--color-text)"}),c=R(()=>o.planMode?n("status.planOn"):n("status.planOff")),d=R(()=>o.swarmMode?n("status.swarmOn"):n("status.swarmOff")),f=R(()=>typeof o.costUsd=="number"&&o.costUsd>0),h=R(()=>f.value?`$${o.costUsd.toFixed(4)}`:n("status.statusNone"));return(g,m)=>(b(),me(p(ca),{open:i.value,"onUpdate:open":m[0]||(m[0]=w=>i.value=w),title:p(n)("status.statusPanelTitle"),onClose:m[1]||(m[1]=w=>s("close"))},{default:ke(()=>[C("dl",_Be,[C("div",xBe,[C("dt",null,N(p(n)("status.statusModel")),1),C("dd",null,N(e.status.model),1)]),C("div",SBe,[C("dt",null,N(p(n)("status.statusThinking")),1),C("dd",null,N(e.thinking),1)]),C("div",ABe,[C("dt",null,N(p(n)("status.statusPermission")),1),C("dd",{style:Gt({color:u.value})},N(a(e.status.permission)),5)]),C("div",MBe,[C("dt",null,N(p(n)("status.statusPlanMode")),1),C("dd",{class:Re({"plan-on":e.planMode})},N(c.value),3)]),C("div",TBe,[C("dt",null,N(p(n)("status.statusSwarmMode")),1),C("dd",{class:Re({"swarm-on":e.swarmMode})},N(d.value),3)]),C("div",EBe,[C("dt",null,N(p(n)("status.statusContext")),1),C("dd",null,[C("span",IBe,N(l.value),1),e.status.ctxMax>0?(b(),A("span",LBe,[C("i",{style:Gt({width:r.value+"%"})},null,4)])):te("",!0)])]),C("div",$Be,[C("dt",null,N(p(n)("status.statusCost")),1),C("dd",null,N(h.value),1)])])]),_:1},8,["open","title"]))}}),FBe=ht(NBe,[["__scopeId","data-v-7c3d87c3"]]),RBe={key:0,class:"actions"},OBe=["onClick"],PBe=["onClick"],DBe={key:1,class:"details"},BBe=tt({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Lt();function i(I){return typeof I=="object"&&I!==null}function r(I){return i(I)?I.title:I}function l(I){return i(I)?I.message??"":""}function a(I){return i(I)?I.details:void 0}function u(I){return i(I)?I.severity==="error":I.startsWith(`${s("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(I)}function c(I){return i(I)?I.severity==="error"?"danger":I.severity==="success"?"success":I.severity==="info"?"info":"warning":u(I)?"danger":"warning"}function d(I){return i(I)?`notice:${I.severity}:${I.title}:${I.message??""}:${JSON.stringify(I.details??[])}`:`text:${I}`}function f(I){if(!i(I))return I;const P=[I.title];I.message&&P.push(I.message);const D=I.details??[];if(D.length>0){P.push("",`${s("warnings.diagnostics")}:`);for(const T of D)P.push(`${T.label}: ${T.value}`)}return P.join(` -`)}let h=1;const g=Z([]),m=new Map,w=new Map;function _(I){const P=u(I)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?P+5e3:P}function v(I,P){const D=m.get(I)??{handle:null,deadline:0,remaining:0};D.handle=setTimeout(()=>S(I),P),D.deadline=Date.now()+P,m.set(I,D)}function k(I){const P=m.get(I);P&&P.handle!==null&&clearTimeout(P.handle),m.delete(I)}function y(I){const P=m.get(I);!P||P.handle===null||(clearTimeout(P.handle),P.handle=null,P.remaining=Math.max(0,P.deadline-Date.now()))}function x(I){if(g.value.find(T=>T.id===I)?.detailsOpen)return;const D=m.get(I);!D||D.handle!==null||v(I,D.remaining)}function M(I){I.detailsOpen=!I.detailsOpen,I.detailsOpen?y(I.id):x(I.id)}async function $(I){if(!await js(f(I.warning)))return;I.copied=!0;const D=w.get(I.id);D&&clearTimeout(D),w.set(I.id,setTimeout(()=>{I.copied=!1,w.delete(I.id)},1400))}function S(I){k(I);const P=w.get(I);P&&clearTimeout(P),w.delete(I);const D=g.value.findIndex(T=>T.id===I);D!==-1&&(g.value=g.value.filter(T=>T.id!==I),o("dismiss",D))}return et(()=>n.warnings,I=>{const P=[...g.value];g.value=I.map(D=>{const T=d(D),L=P.findIndex(O=>O.key===T),B=L===-1?void 0:P.splice(L,1)[0];if(B)return B.warning=D,B;const H={id:h++,key:T,warning:D,detailsOpen:!1,copied:!1};return v(H.id,_(D)),H});for(const D of P){k(D.id);const T=w.get(D.id);T&&clearTimeout(T),w.delete(D.id)}},{immediate:!0,flush:"post"}),kn(()=>{m.forEach(I=>{I.handle!==null&&clearTimeout(I.handle)}),m.clear(),w.forEach(I=>clearTimeout(I)),w.clear()}),(I,P)=>(b(),me(ZA,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:ke(()=>[(b(!0),A(Pe,null,pt(g.value,D=>(b(),me(p(sU),{key:D.id,variant:c(D.warning),title:r(D.warning),message:l(D.warning),"dismiss-label":p(s)("warnings.dismiss"),onDismiss:T=>S(D.id),onPointerenter:T=>y(D.id),onPointerleave:T=>x(D.id)},{default:ke(()=>[a(D.warning)?.length?(b(),A("div",RBe,[C("button",{class:"link",type:"button",onClick:T=>M(D)},N(D.detailsOpen?p(s)("warnings.hideDetails"):p(s)("warnings.showDetails")),9,OBe),C("button",{class:"link",type:"button",onClick:T=>$(D)},N(D.copied?p(s)("warnings.copied"):p(s)("warnings.copyDetails")),9,PBe)])):te("",!0),D.detailsOpen&&a(D.warning)?.length?(b(),A("dl",DBe,[(b(!0),A(Pe,null,pt(a(D.warning),T=>(b(),A("div",{key:`${T.label}:${T.value}`,class:"detail-row"},[C("dt",null,N(T.label),1),C("dd",null,N(T.value),1)]))),128))])):te("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),HBe=ht(BBe,[["__scopeId","data-v-38645e9f"]]),zBe={class:"topbar"},WBe={class:"wsq"},UBe=["aria-label"],jBe={class:"tb-path"},VBe={class:"ws"},qBe={class:"se"},KBe={class:"tb-sub"},ZBe=tt({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=R(()=>{const a=o.workspace,c=(a?.name||a?.root||"").trim().charAt(0);return c?c.toUpperCase():"K"}),r=R(()=>o.workspace?.name??n("workspace.noWorkspace")),l=R(()=>o.running?n("mobile.running"):n("mobile.idle"));return(a,u)=>(b(),A("div",zBe,[C("span",WBe,N(i.value),1),C("button",{type:"button",class:"tb-mid","aria-label":p(n)("mobile.openSwitcher"),onClick:u[0]||(u[0]=c=>s("openSwitcher"))},[C("span",jBe,[C("span",VBe,N(r.value),1),e.sessionTitle?(b(),A(Pe,{key:0},[u[2]||(u[2]=C("span",{class:"sl"},"/",-1)),C("span",qBe,N(e.sessionTitle),1)],64)):te("",!0),u[3]||(u[3]=C("span",{class:"cv"},"⌄",-1))]),C("span",KBe,[C("span",{class:Re(["rd",{on:e.running}])},null,2),C("span",null,N(l.value),1),e.branch?(b(),A(Pe,{key:0},[Ve(" · "+N(e.branch),1)],64)):te("",!0),e.sessionCount>0?(b(),A(Pe,{key:1},[Ve(" · "+N(p(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):te("",!0)])],8,UBe),V(p(gn),{size:"lg",label:p(n)("mobile.openSettings"),onClick:u[1]||(u[1]=c=>s("openSettings"))},{default:ke(()=>[V(p(Ie),{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),GBe=ht(ZBe,[["__scopeId","data-v-0231ec69"]]),YBe={key:0,class:"sheet-root"},XBe=["aria-label"],JBe=["aria-label"],QBe={key:0,class:"sheet-head"},eHe={class:"sheet-title"},tHe={class:"sheet-body"},nHe=tt({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""},closeOnEsc:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t;function i(){s("update:modelValue",!1),s("close")}function r(l){l.key==="Escape"&&o.closeOnEsc&&i()}return et(()=>o.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),kn(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(b(),me(as,{name:"sheet"},{default:ke(()=>[e.modelValue?(b(),A("div",YBe,[C("div",{class:"sheet-scrim",onClick:i}),C("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||p(n)("mobile.sheetLabel")},[C("button",{type:"button",class:"sheet-grab","aria-label":p(n)("mobile.closeSheet"),onClick:i},null,8,JBe),e.title?(b(),A("div",QBe,[C("span",eHe,N(e.title),1)])):te("",!0),C("div",tHe,[Cn(l.$slots,"default",{},void 0,!0)])],8,XBe)])):te("",!0)]),_:3}))}}),hF=ht(nHe,[["__scopeId","data-v-c3d5dadc"]]),oHe={class:"mlist"},sHe={key:0,class:"mempty"},iHe=["onClick"],rHe={class:"mgh-main"},lHe={class:"mgh-name"},aHe={class:"mgh-path"},uHe={key:2,class:"att"},cHe={key:0,class:"mempty small"},dHe=["onClick"],fHe={class:"m"},pHe={class:"s"},hHe={key:0,class:"att"},mHe={key:1,class:"mshow-more-row"},gHe=["disabled","onClick"],vHe={key:1,class:"mshow-more-sep","aria-hidden":"true"},yHe=["onClick"],kHe=tt({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t;function i(){s("update:modelValue",!1)}function r(L){s("select",L),i()}function l(L){s("createInWorkspace",L),i()}function a(){s("create"),i()}function u(){s("addWorkspace"),i()}const c=Z(new Set);function d(L){return c.value.has(L)}function f(L){const B=new Set(c.value);B.has(L)?B.delete(L):B.add(L),c.value=B,x.value=null,I.value=null}const h=Z(new Map);function g(L){return h.value.get(L.workspace.id)??L.initialCount}function m(L){const B=L.sessions.slice(0,g(L));if(o.activeId&&!B.some(H=>H.id===o.activeId)){const H=L.sessions.find(O=>O.id===o.activeId);if(H)return[...B,H]}return B}function w(L){return L.sessions.length>g(L)||L.hasMore||L.loadingMore}function _(L){return g(L)>L.initialCount}function v(L){const B=o.groups.find(F=>F.workspace.id===L);if(!B)return;const H=g(B)+R5,O=new Map(h.value);O.set(L,H),h.value=O,B.sessions.length(b(),me(hF,{"model-value":e.modelValue,"onUpdate:modelValue":B[2]||(B[2]=H=>s("update:modelValue",H))},{default:ke(()=>[C("button",{type:"button",class:"newrow",onClick:a},[V(p(Ie),{name:"message",size:"sm"}),Ve(" "+N(p(n)("sidebar.newChat")),1)]),C("button",{type:"button",class:"newrow secondary",onClick:u},[V(p(Ie),{name:"folder",size:"sm"}),Ve(" "+N(p(n)("sidebar.newWorkspace")),1)]),C("div",oHe,[e.groups.length===0?(b(),A("div",sHe,N(p(n)("workspace.noWorkspace")),1)):te("",!0),(b(!0),A(Pe,null,pt(e.groups,H=>(b(),A("div",{key:H.workspace.id,class:"mgroup"},[C("div",{class:Re(["mgh",{on:H.workspace.id===e.activeWorkspaceId}]),onClick:O=>f(H.workspace.id)},[d(H.workspace.id)?(b(),me(p(Ie),{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(b(),me(p(Ie),{key:1,class:"mgh-folder",name:"folder",size:"sm"})),C("div",rHe,[C("span",lHe,N(H.workspace.name),1),V(p(Pn),{text:H.workspace.root},{default:ke(()=>[C("span",aHe,N(H.workspace.shortPath),1)]),_:2},1032,["text"])]),d(H.workspace.id)&&y(H.workspace.id)>0?(b(),A("span",uHe,N(y(H.workspace.id)),1)):te("",!0),V(p(gn),{size:"lg",class:"mgh-more",label:p(n)("sidebar.options"),onClick:Et(O=>P(H.workspace.id),["stop"])},{default:ke(()=>[V(p(Ie),{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),V(p(gn),{size:"lg",class:"mgh-add",label:p(n)("workspace.newInGroup"),onClick:Et(O=>l(H.workspace.id),["stop"])},{default:ke(()=>[V(p(Ie),{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),I.value===H.workspace.id?(b(),me(p(Cl),{key:3,class:"kmenu wsmenu",onClick:B[0]||(B[0]=Et(()=>{},["stop"]))},{default:ke(()=>[V(p(hn),{size:"lg",onClick:O=>D(H.workspace)},{default:ke(()=>[Ve(N(p(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),V(p(hn),{size:"lg",danger:"",onClick:O=>T(H.workspace)},{default:ke(()=>[Ve(N(p(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):te("",!0)],10,iHe),In(C("div",null,[H.sessions.length===0?(b(),A("div",cHe,N(p(n)("sidebar.noSessions")),1)):te("",!0),(b(!0),A(Pe,null,pt(m(H),O=>(b(),A("div",{key:O.id,class:Re(["srow",{cur:O.id===e.activeId}]),onClick:F=>r(O.id)},[C("div",fHe,[C("div",{class:Re(["t",{run:O.busy,aborted:!O.busy&&(e.attentionBySession[O.id]??0)===0&&O.lastTurnReason==="failed"}])},N(O.title),3),C("div",pHe,N(O.time),1)]),(e.attentionBySession[O.id]??0)>0?(b(),A("span",hHe,N(e.attentionBySession[O.id]),1)):te("",!0),V(p(gn),{size:"lg",class:"kb",label:p(n)("sidebar.options"),onClick:Et(F=>M(O.id),["stop"])},{default:ke(()=>[V(p(Ie),{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),x.value===O.id?(b(),me(p(Cl),{key:1,class:"kmenu",onClick:B[1]||(B[1]=Et(()=>{},["stop"]))},{default:ke(()=>[V(p(hn),{size:"lg",onClick:F=>$(O)},{default:ke(()=>[Ve(N(p(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),V(p(hn),{size:"lg",onClick:F=>S(O.id)},{default:ke(()=>[Ve(N(p(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):te("",!0)],10,dHe))),128)),w(H)||_(H)?(b(),A("div",mHe,[w(H)?(b(),A("button",{key:0,type:"button",class:"mshow-more",disabled:H.loadingMore,onClick:Et(O=>v(H.workspace.id),["stop"])},[V(p(Ie),{name:"chevron-down",size:"sm"}),Ve(" "+N(H.loadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.showMore")),1)],8,gHe)):te("",!0),w(H)&&_(H)?(b(),A("span",vHe,"·")):te("",!0),_(H)?(b(),A("button",{key:2,type:"button",class:"mshow-more",onClick:Et(O=>k(H.workspace.id),["stop"])},[V(p(Ie),{name:"chevron-up",size:"sm"}),Ve(" "+N(p(n)("sidebar.showLess")),1)],8,yHe)):te("",!0)])):te("",!0)],512),[[Es,!d(H.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),bHe=ht(kHe,[["__scopeId","data-v-47b8777b"]]),CHe={class:"group-title"},wHe={class:"srow-main"},_He={class:"srow-label"},xHe={class:"srow-sub"},SHe={class:"srow read-only"},AHe={class:"srow-main"},MHe={class:"srow-label"},THe={key:0,class:"srow-sub"},EHe={class:"cache-note"},IHe={class:"srow-main"},LHe={class:"srow-label"},$He={class:"srow-sub"},NHe=["aria-checked"],FHe={class:"srow-main"},RHe={class:"srow-label"},OHe={class:"srow-sub"},PHe=["aria-checked"],DHe={class:"srow-main"},BHe={class:"srow-label"},HHe={class:"srow read-only"},zHe={class:"srow-main"},WHe={class:"srow-label"},UHe={class:"srow-sub"},jHe=["aria-label"],VHe={class:"group-title"},qHe={class:"srow-main"},KHe={class:"srow-label"},ZHe={class:"srow-sub"},GHe={class:"srow read-only pref"},YHe={class:"srow-main"},XHe={class:"srow-label"},JHe={class:"srow read-only pref"},QHe={class:"srow-main"},eze={class:"srow-label"},tze={class:"srow read-only pref"},nze={class:"srow-main"},oze={class:"srow-label"},sze={key:0,class:"srow read-only acct-profile"},ize={class:"acct-avatar","aria-hidden":"true"},rze=["src"],lze={class:"srow-main"},aze={class:"acct-name-row"},uze={class:"srow-label"},cze={class:"srow-sub"},dze={class:"srow-main"},fze={class:"srow-label"},pze={class:"srow-main"},hze={class:"srow-label"},mze={key:3,class:"srow read-only"},gze={class:"srow-main"},vze={class:"srow-label"},yze={class:"srow-val dim"},kze={class:"arch-subhead"},bze={class:"arch-count"},Cze={class:"arch-tools"},wze={key:0,class:"arch-empty"},_ze={class:"arch-meta"},xze={class:"arch-name"},Sze={class:"arch-time"},Aze={key:2,class:"arch-empty"},Mze=100,Tze=tt({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},initialView:{},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},fontScale:{default:"medium"},managedProviderStatus:{default:null},managedUserInfo:{default:null},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setFontScale","login","logout"],setup(e,{emit:t}){const{t:n}=Lt(),{isConfirmOpen:o}=pu(),s=e,i=t;function r(Y){i("setColorScheme",Y)}const l=["manual","yolo","auto"],a=R(()=>s.models?.find(Y=>Y.id===s.status?.modelId)),u=R(()=>$2(a.value)),c=R(()=>Jp(a.value)),d=R(()=>bg(a.value,s.thinking)),f=R(()=>c.value.includes(d.value)?d.value:""),h=R(()=>c.value.map(Y=>({value:Y,label:oy(Y)}))),g=R(()=>s.planMode===!0),m=R(()=>s.swarmMode===!0),w=Z(!1);et(()=>s.managedUserInfo?.avatar,()=>{w.value=!1});const _=R(()=>!!s.managedUserInfo?.avatar&&!w.value),v=R(()=>s.managedUserInfo?.userLevelName?.trim()??""),k=R(()=>{const Y=s.status.permission;return Y==="auto"?"var(--color-danger)":Y==="yolo"?"var(--color-warning)":"var(--color-text-muted)"}),y=R(()=>{const Y=s.status.permission,le=n(Y==="yolo"?"mobile.permYoloSub":Y==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${Y} · ${le}`}),x=R(()=>s.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(s.status.ctxUsed/s.status.ctxMax*100))):0),M=R(()=>s.status.ctxMax>0?`${Ml(s.status.ctxUsed)}/${Ml(s.status.ctxMax)}`:n("status.statusNone"));function $(Y){i("setThinking",E5(a.value,Y))}function S(){const Y=l.indexOf(s.status.permission),le=l[(Y+1)%l.length];i("setPermission",le)}function I(){i("pickModel"),i("update:modelValue",!1)}function P(){i("login"),i("update:modelValue",!1)}function D(){i("logout"),i("update:modelValue",!1)}const T=hu(),L=Z("main"),B=Z([]),H=Z(!1),O=Z(!1),F=Z(""),W=Z("archived-desc");async function z(){if(!H.value){H.value=!0,O.value=!1;try{const Y=[];let le;for(;;){const Ee=await T.loadArchivedSessions({beforeId:le,pageSize:Mze});if(Y.push(...Ee.items),!Ee.hasMore||Ee.items.length===0)break;const de=Ee.items.at(-1)?.id;if(de===void 0)break;le=de}B.value=Y,O.value=!0}catch(Y){gl("loadAllArchived failed",Y)}finally{H.value=!1}}}function U(){L.value="archived",F.value="",z()}et(()=>s.modelValue,Y=>{Y&&s.initialView==="archived"&&U()});function q(){L.value="main"}const K=R(()=>{const Y=F.value.trim().toLowerCase();let le=B.value.filter(Ee=>Ee.archived===!0);return Y&&(le=le.filter(Ee=>Ee.title.toLowerCase().includes(Y))),le=le.slice(),W.value==="archived-desc"?le.sort((Ee,de)=>de.updatedAt.localeCompare(Ee.updatedAt)):W.value==="created-desc"?le.sort((Ee,de)=>de.createdAt.localeCompare(Ee.createdAt)):le.sort((Ee,de)=>Ee.title.localeCompare(de.title,"zh")),le});async function ie(Y){await T.restoreSession(Y)&&(B.value=B.value.filter(Ee=>Ee.id!==Y))}function ne(Y){const le=new Date(Y);if(Number.isNaN(le.getTime()))return Y;const Ee=de=>String(de).padStart(2,"0");return`${le.getFullYear()}-${Ee(le.getMonth()+1)}-${Ee(le.getDate())} ${Ee(le.getHours())}:${Ee(le.getMinutes())}`}return et(()=>s.modelValue,Y=>{Y||(L.value="main")}),(Y,le)=>(b(),me(hF,{"model-value":e.modelValue,title:p(n)("mobile.settingsTitle"),"close-on-esc":!p(o),"onUpdate:modelValue":le[6]||(le[6]=Ee=>i("update:modelValue",Ee))},{default:ke(()=>[L.value==="main"?(b(),A(Pe,{key:0},[C("div",CHe,N(p(n)("mobile.groupSession")),1),C("button",{type:"button",class:"srow",onClick:I},[C("span",wHe,[C("span",_He,N(p(n)("status.statusModel")),1),C("span",xHe,N(e.status.model),1)]),le[7]||(le[7]=C("span",{class:"chev"},"›",-1))]),C("div",SHe,[C("span",AHe,[C("span",MHe,N(p(n)("status.statusThinking")),1),u.value==="unsupported"?(b(),A("span",THe,N(p(n)("status.modeNotSupported")),1)):te("",!0)]),c.value.length>1?(b(),me(p(bi),{key:0,"model-value":f.value,options:h.value,size:"sm","onUpdate:modelValue":$},null,8,["model-value","options"])):(b(),A("span",{key:1,class:Re(["srow-val",{dim:d.value==="off"}])},N(d.value==="off"?p(n)("status.planOff"):p(oy)(d.value)),3))]),C("div",EHe,N(p(n)("status.cacheNote")),1),C("button",{type:"button",class:"srow",onClick:le[0]||(le[0]=Ee=>i("togglePlan"))},[C("span",IHe,[C("span",LHe,N(p(n)("status.statusPlanMode")),1),C("span",$He,N(p(n)("mobile.planModeSub")),1)]),C("span",{class:Re(["toggle",{on:g.value}]),role:"switch","aria-checked":g.value},null,10,NHe)]),C("button",{type:"button",class:"srow",onClick:le[1]||(le[1]=Ee=>i("toggleSwarm"))},[C("span",FHe,[C("span",RHe,N(p(n)("status.statusSwarmMode")),1),C("span",OHe,N(p(n)("mobile.swarmModeSub")),1)]),C("span",{class:Re(["toggle",{on:m.value}]),role:"switch","aria-checked":m.value},null,10,PHe)]),C("button",{type:"button",class:"srow",onClick:S},[C("span",DHe,[C("span",BHe,N(p(n)("status.statusPermission")),1),C("span",{class:"srow-sub",style:Gt({color:k.value})},N(y.value),5)]),le[8]||(le[8]=C("span",{class:"chev"},"›",-1))]),C("div",HHe,[C("span",zHe,[C("span",WHe,N(p(n)("status.statusContext")),1),C("span",UHe,N(M.value),1)]),C("span",{class:"ctx-meter","aria-label":M.value},[C("i",{style:Gt({width:x.value+"%"})},null,4)],8,jHe)]),C("div",VHe,N(p(n)("mobile.groupApp")),1),C("button",{type:"button",class:"srow",onClick:U},[C("span",qHe,[C("span",KHe,N(p(n)("mobile.archivedSessions")),1),C("span",ZHe,N(p(n)("mobile.archivedSessionsSub")),1)]),le[9]||(le[9]=C("span",{class:"chev"},"›",-1))]),C("div",GHe,[C("span",YHe,[C("span",XHe,N(p(n)("theme.colorSchemeLabel")),1)]),V(p(bi),{"model-value":e.colorScheme??"system",options:[{value:"light",label:p(n)("theme.light"),icon:"light-mode"},{value:"dark",label:p(n)("theme.dark"),icon:"dark-mode"},{value:"system",label:p(n)("theme.system")}],"onUpdate:modelValue":r},null,8,["model-value","options"])]),C("div",JHe,[C("span",QHe,[C("span",eze,N(p(n)("sidebar.language")),1)]),V(aF)]),C("div",tze,[C("span",nze,[C("span",oze,N(p(n)("settings.uiFontSize")),1)]),V(p(bi),{"model-value":e.fontScale,options:[{value:"small",label:"S"},{value:"medium",label:"M"},{value:"large",label:"L"},{value:"xlarge",label:"XL"}],"aria-label":p(n)("settings.uiFontSize"),"onUpdate:modelValue":le[2]||(le[2]=Ee=>i("setFontScale",Ee))},null,8,["model-value","aria-label"])]),e.managedProviderStatus==="authenticated"?(b(),A("div",sze,[C("span",ize,[_.value?(b(),A("img",{key:0,src:e.managedUserInfo?.avatar,alt:"",onError:le[3]||(le[3]=Ee=>w.value=!0)},null,40,rze)):(b(),me(p(Ie),{key:1,name:"user",size:"md"}))]),C("span",lze,[C("span",aze,[C("span",uze,N(e.managedUserInfo?.nickname||p(n)("sidebar.defaultUserName")),1),v.value?(b(),me(p(Vr),{key:0,class:"acct-level",variant:"neutral",size:"sm"},{default:ke(()=>[Ve(N(v.value),1)]),_:1})):te("",!0)]),C("span",cze,N(p(n)("settings.signedIn")),1)])])):te("",!0),e.managedProviderStatus==="authenticated"?(b(),A("button",{key:1,type:"button",class:"srow acct out",onClick:D},[C("span",dze,[C("span",fze,N(p(n)("sidebar.signOut")),1)])])):(b(),A("button",{key:2,type:"button",class:"srow acct in",onClick:P},[C("span",pze,[C("span",hze,N(p(n)("sidebar.signIn")),1)])])),e.serverVersion?(b(),A("div",mze,[C("span",gze,[C("span",vze,N(p(n)("settings.serverVersion")),1)]),C("span",yze,N(e.serverVersion),1)])):te("",!0)],64)):(b(),A(Pe,{key:1},[C("div",kze,[C("button",{type:"button",class:"arch-back",onClick:q},[le[10]||(le[10]=C("span",{class:"chev back"},"‹",-1)),Ve(" "+N(p(n)("mobile.archivedBack")),1)]),C("span",bze,N(p(n)("mobile.sessionCount",{n:K.value.length})),1)]),C("div",Cze,[V(p(zs),{class:"arch-search-input","model-value":F.value,size:"sm",placeholder:p(n)("settings.archivedSearch"),"onUpdate:modelValue":le[4]||(le[4]=Ee=>F.value=Ee)},null,8,["model-value","placeholder"]),V(p(bi),{size:"sm","model-value":W.value,options:[{value:"archived-desc",label:p(n)("settings.archivedSortArchived")},{value:"created-desc",label:p(n)("settings.archivedSortCreated")},{value:"name-asc",label:p(n)("settings.archivedSortName")}],"onUpdate:modelValue":le[5]||(le[5]=Ee=>W.value=Ee)},null,8,["model-value","options"])]),H.value?(b(),A("div",wze,N(p(n)("settings.archivedLoadingAll")),1)):K.value.length>0?(b(!0),A(Pe,{key:1},pt(K.value,Ee=>(b(),A("div",{key:Ee.id,class:"arch-row"},[C("div",_ze,[C("div",xze,N(Ee.title),1),C("div",Sze,N(p(n)("settings.archivedAt",{time:ne(Ee.updatedAt)})),1)]),V(p(Ft),{variant:"secondary",size:"sm",onClick:de=>ie(Ee.id)},{default:ke(()=>[Ve(N(p(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128)):(b(),A("div",Aze,N(B.value.length===0?p(n)("settings.archivedEmpty"):p(n)("settings.archivedNoMatch")),1))],64))]),_:1},8,["model-value","title","close-on-esc"]))}}),Eze=ht(Tze,[["__scopeId","data-v-ac7214c8"]]),Ize=["mask"],Lze=tt({__name:"BrandLogo",props:{size:{default:64}},setup(e){const t=`bl-eyes-${mO()}`,n=Z(null);let o;function s(){const i=n.value;i&&(i.classList.remove("blink-now"),i.getBoundingClientRect(),i.classList.add("blink-now"),clearTimeout(o),o=setTimeout(()=>i.classList.remove("blink-now"),300))}return Un(()=>clearTimeout(o)),(i,r)=>(b(),A("svg",{ref_key:"logoRef",ref:n,class:"brand-logo",style:Gt({width:`${e.size}px`,height:`${e.size*22/32}px`}),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:s},[C("defs",null,[C("mask",{id:t,maskUnits:"userSpaceOnUse"},[...r[0]||(r[0]=[C("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"},null,-1),C("g",{class:"ch-eyes",fill:"#000"},[C("rect",{class:"ch-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),C("rect",{class:"ch-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})],-1)])])]),C("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--logo)",mask:`url(#${t})`},null,8,Ize)],4))}}),Ty=ht(Lze,[["__scopeId","data-v-f04205a8"]]),$ze={key:0,class:"ls-done-card"},Nze={class:"ls-done-badge"},Fze={class:"ls-card-text"},Rze={class:"ls-card-title"},Oze={class:"ls-card-hint"},Pze={key:1,class:"ls-cards"},Dze={class:"ls-card-text"},Bze={class:"ls-card-title"},Hze={class:"ls-reco"},zze={class:"ls-card-hint"},Wze={class:"ls-card-logo ls-card-icon"},Uze={class:"ls-card-text"},jze={class:"ls-card-title"},Vze={class:"ls-card-hint"},qze={key:2,class:"ls-flow"},Kze={key:0,class:"ls-center"},Zze={class:"ls-center-text"},Gze={key:1,class:"ls-device"},Yze={class:"ls-lead"},Xze=["href"],Jze={class:"ls-code-row"},Qze=["title"],eWe={class:"ls-status"},tWe={class:"ls-status-text"},nWe={class:"ls-countdown"},oWe={key:2,class:"ls-center"},sWe={class:"ls-center-text ls-success-text"},iWe={class:"ls-center-hint"},rWe={class:"ls-center"},lWe={class:"ls-center-text ls-err-text"},aWe={class:"ls-center-hint"},uWe={class:"ls-actions"},cWe={class:"ls-center"},dWe={class:"ls-center-text ls-warn-text"},fWe={class:"ls-center-hint"},pWe={class:"ls-actions"},hWe=tt({__name:"OnboardingLoginStep",props:{authReady:{type:Boolean},onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","addProvider"],setup(e,{emit:t}){const{t:n}=Lt(),o=e,s=t,i=Z("choice"),{step:r,pollError:l,flow:a,secondsLeft:u,startFlow:c,cancelFlow:d}=lF({onStartOAuthLogin:o.onStartOAuthLogin,onPollOAuthLogin:o.onPollOAuthLogin,onCancelOAuthLogin:o.onCancelOAuthLogin,onSuccess:()=>s("success")}),f=Z(!1);function h(){i.value="flow",c()}function g(){d(),i.value="choice"}async function m(){!a.value||!await js(a.value.verificationUriComplete)||(f.value=!0,setTimeout(()=>{f.value=!1},2e3))}function w(_){const v=Math.floor(_/60),k=_%60;return`${v}:${String(k).padStart(2,"0")}`}return(_,v)=>e.authReady?(b(),A("div",$ze,[C("span",Nze,[V(p(Ie),{name:"check",size:"sm"})]),C("div",Fze,[C("div",Rze,N(p(n)("onboarding.login.loggedInTitle")),1),C("div",Oze,N(p(n)("onboarding.login.loggedInHint")),1)])])):i.value==="choice"?(b(),A("div",Pze,[C("button",{class:"ls-card",type:"button",onClick:h},[V(Ty,{size:40,class:"ls-card-logo"}),C("div",Dze,[C("div",Bze,[Ve(N(p(n)("onboarding.login.kimiTitle"))+" ",1),C("span",Hze,N(p(n)("onboarding.login.recommended")),1)]),C("div",zze,N(p(n)("onboarding.login.kimiHint")),1)]),V(p(Ie),{name:"chevron-right",size:"lg",class:"ls-card-chevron"})]),C("button",{class:"ls-card",type:"button",onClick:v[0]||(v[0]=k=>s("addProvider"))},[C("span",Wze,[V(p(Ie),{name:"bolt",size:"lg"})]),C("div",Uze,[C("div",jze,N(p(n)("onboarding.login.customProviderTitle")),1),C("div",Vze,N(p(n)("onboarding.login.customProviderHint")),1)]),V(p(Ie),{name:"chevron-right",size:"lg",class:"ls-card-chevron"})])])):(b(),A("div",qze,[p(r)==="starting"?(b(),A("div",Kze,[V(p(Ao),{size:"md"}),C("span",Zze,N(p(n)("login.starting")),1)])):p(r)==="device-code"&&p(a)?(b(),A("div",Gze,[C("div",Yze,N(p(n)("login.lead")),1),C("a",{class:"ls-primary",href:p(a).verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[Ve(N(p(n)("login.authorizeInBrowser"))+" ",1),V(p(Ie),{name:"external-link",size:"sm"})],8,Xze),C("div",Jze,[C("span",{class:"ls-link",title:p(a).verificationUriComplete},N(p(a).verificationUriComplete),9,Qze),V(p(Ft),{class:Re(["ls-copy",{"is-copied":f.value}]),variant:"secondary",size:"sm",onClick:m},{default:ke(()=>[f.value?(b(),A(Pe,{key:0},[V(p(Ie),{name:"check",size:"sm"}),Ve(" "+N(p(n)("login.copied")),1)],64)):(b(),A(Pe,{key:1},[V(p(Ie),{name:"copy",size:"sm"}),Ve(" "+N(p(n)("login.copyLink")),1)],64))]),_:1},8,["class"])]),C("div",eWe,[V(p(Ao),{size:"sm",label:p(n)("login.waitingAuth")},null,8,["label"]),C("span",tWe,N(p(n)("login.waitingAutoClose")),1),C("span",nWe,N(w(p(u))),1)])])):p(r)==="success"?(b(),A("div",oWe,[V(p(Bd),{kind:"success"}),C("span",sWe,N(p(n)("login.success")),1),C("span",iWe,N(p(n)("login.successHint")),1)])):p(r)==="expired"?(b(),A(Pe,{key:3},[C("div",rWe,[V(p(Bd),{kind:"expired"}),C("span",lWe,N(p(n)("login.expiredTitle")),1),C("span",aWe,N(p(n)("login.expiredHint")),1)]),C("div",uWe,[V(p(Ft),{variant:"secondary",onClick:g},{default:ke(()=>[Ve(N(p(n)("onboarding.back")),1)]),_:1}),V(p(Ft),{variant:"primary",onClick:p(c)},{default:ke(()=>[Ve(N(p(n)("login.retry")),1)]),_:1},8,["onClick"])])],64)):p(r)==="error"?(b(),A(Pe,{key:4},[C("div",cWe,[V(p(Bd),{kind:"error"}),C("span",dWe,N(p(l)?p(n)("login.pollErrorTitle"):p(n)("login.errorTitle")),1),C("span",fWe,N(p(l)?p(n)("login.pollErrorHint"):p(n)("login.errorHint")),1)]),C("div",pWe,[V(p(Ft),{variant:"secondary",onClick:g},{default:ke(()=>[Ve(N(p(n)("onboarding.back")),1)]),_:1}),V(p(Ft),{variant:"primary",onClick:p(c)},{default:ke(()=>[Ve(N(p(n)("login.retry")),1)]),_:1},8,["onClick"])])],64)):te("",!0)]))}}),mWe=ht(hWe,[["__scopeId","data-v-950977ea"]]),gWe=["aria-label"],vWe={class:"wiz-body"},yWe={key:0,class:"wiz-step"},kWe={class:"wiz-title"},bWe={class:"wiz-sub"},CWe={class:"pref-group"},wWe={class:"pref-label"},_We={class:"lang-cards"},xWe=["onClick"],SWe={class:"opt-label"},AWe={class:"pref-group"},MWe={class:"pref-label"},TWe={class:"theme-cards"},EWe=["onClick"],IWe={class:"opt-label"},LWe={key:1,class:"wiz-step"},$We={class:"wiz-title"},NWe={class:"wiz-sub"},FWe={class:"wiz-step-fill"},RWe={class:"wiz-foot"},OWe={class:"wiz-foot-ghost"},PWe=tt({__name:"OnboardingWizard",props:{authReady:{type:Boolean},onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["complete","loginSuccess","addProvider"],setup(e,{emit:t}){const{t:n,locale:o}=Lt(),s=e,i=t;function r(){i("addProvider")}const l=["preferences","login"],a=Z(0),u=R(()=>l[a.value]??"preferences");function c(){a.value0&&a.value--}function f(_){o.value!==_&&A5(_)}const{colorScheme:h,setColorScheme:g}=RT(),m=[{value:"system",labelKey:"theme.system"},{value:"light",labelKey:"theme.light"},{value:"dark",labelKey:"theme.dark"}];function w(){i("loginSuccess")}return(_,v)=>(b(),A("div",{class:"wizard",role:"dialog","aria-modal":"true","aria-label":p(n)("onboarding.welcome.title")},[C("div",vWe,[u.value==="preferences"?(b(),A("section",yWe,[V(Ty,{size:72}),C("h1",kWe,N(p(n)("onboarding.welcome.title")),1),C("p",bWe,N(p(n)("onboarding.welcome.subtitle")),1),C("div",CWe,[C("div",wWe,N(p(n)("onboarding.welcome.languageLabel")),1),C("div",_We,[(b(!0),A(Pe,null,pt(p(mg),k=>(b(),A("button",{key:k.code,class:Re(["opt-card lang-card",{selected:p(o)===k.code}]),type:"button",onClick:y=>f(k.code)},[C("span",{class:Re(["opt-radio",{on:p(o)===k.code}])},null,2),C("span",SWe,N(k.label),1)],10,xWe))),128))])]),C("div",AWe,[C("div",MWe,N(p(n)("onboarding.welcome.themeLabel")),1),C("div",TWe,[(b(),A(Pe,null,pt(m,k=>C("button",{key:k.value,class:Re(["opt-card theme-card",{selected:p(h)===k.value}]),type:"button",onClick:y=>p(g)(k.value)},[C("span",{class:Re(["tp",`tp-${k.value}`]),"aria-hidden":"true"},[k.value==="system"?(b(),A(Pe,{key:0},[v[2]||(v[2]=Ac('',2))],64)):(b(),A(Pe,{key:1},[v[3]||(v[3]=C("span",{class:"tp-side"},null,-1)),v[4]||(v[4]=C("span",{class:"tp-lines"},[C("span"),C("span"),C("span")],-1))],64))],2),C("span",IWe,N(p(n)(k.labelKey)),1)],10,EWe)),64))])])])):(b(),A("section",LWe,[V(Ty,{size:72}),C("h1",$We,N(p(n)("onboarding.login.title")),1),C("p",NWe,N(p(n)("onboarding.login.subtitle")),1),C("div",FWe,[V(mWe,{"auth-ready":s.authReady,"on-start-o-auth-login":s.onStartOAuthLogin,"on-poll-o-auth-login":s.onPollOAuthLogin,"on-cancel-o-auth-login":s.onCancelOAuthLogin,onSuccess:w,onAddProvider:r},null,8,["auth-ready","on-start-o-auth-login","on-poll-o-auth-login","on-cancel-o-auth-login"])])])),C("div",RWe,[u.value==="preferences"?(b(),me(p(Ft),{key:0,variant:"primary",size:"lg",class:"wiz-primary",onClick:c},{default:ke(()=>[Ve(N(p(n)("onboarding.continue")),1)]),_:1})):u.value==="login"&&s.authReady?(b(),me(p(Ft),{key:1,variant:"primary",size:"lg",class:"wiz-primary",onClick:v[0]||(v[0]=k=>i("complete"))},{default:ke(()=>[Ve(N(p(n)("onboarding.login.finish")),1)]),_:1})):te("",!0),C("div",OWe,[a.value>0?(b(),me(p(Ft),{key:0,variant:"ghost",onClick:d},{default:ke(()=>[Ve(N(p(n)("onboarding.back")),1)]),_:1})):te("",!0),u.value==="login"&&s.authReady?te("",!0):(b(),me(p(Ft),{key:1,variant:"ghost",onClick:v[1]||(v[1]=k=>i("complete"))},{default:ke(()=>[Ve(N(u.value==="login"?p(n)("onboarding.login.skip"):p(n)("onboarding.skip")),1)]),_:1}))])])])],8,gWe))}}),DWe=ht(PWe,[["__scopeId","data-v-dc402f98"]]),BWe=["aria-label"],HWe={class:"gload-box"},zWe={class:"gload-text"},WWe=tt({__name:"GlobalLoading",setup(e){const{t}=Lt();return(n,o)=>(b(),A("div",{class:"gload",role:"status","aria-label":p(t)("app.connecting")},[C("div",HWe,[o[0]||(o[0]=Ac('',1)),V(p(Ao),{size:"md",label:p(t)("app.connecting")},null,8,["label"]),C("div",zWe,N(p(t)("app.connecting")),1)])],8,BWe))}}),UWe=ht(WWe,[["__scopeId","data-v-3acabc65"]]),jWe={class:"kap-root"},VWe={class:"kap-head"},qWe={class:"kap-count"},KWe={class:"kap-head-actions"},ZWe={class:"kap-filters"},GWe=["value"],YWe={class:"kap-check"},XWe={class:"kap-check"},JWe={class:"kap-view-toggle",role:"group"},QWe={key:0,class:"kap-empty"},eUe=["onClick"],tUe={class:"kap-ts"},nUe={class:"kap-label"},oUe={key:0,class:"kap-detail"},sUe={class:"kap-detail-actions"},iUe=["onClick"],rUe={key:1,class:"kap-agg"},lUe={class:"mono"},aUe={class:"mono"},uUe={class:"num"},cUe={class:"num"},dUe={key:0},fUe={class:"mono"},pUe={class:"num"},hUe={class:"num"},mUe={key:0},gUe=tt({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,o=Z("all"),s=Z(""),i=Z(""),r=Z(!1),l=Z("timeline"),a=R(()=>(M5.value,[...qde()])),u=R(()=>{const I=new Set;for(const P of a.value)P.sessionId&&I.add(P.sessionId);return[...I].sort()});function c(I){return I.kind==="rest:error"||I.code!==void 0&&I.code!==0||I.eventType==="error"||I.eventType==="parse-error"}const d=R(()=>{const I=s.value.trim().toLowerCase();return a.value.filter(P=>!(o.value!=="all"&&P.source!==o.value||i.value&&P.sessionId!==i.value||r.value&&!c(P)||I&&!`${P.label} ${P.kind} ${P.eventType??""} ${P.sessionId??""} ${P.requestId??""}`.toLowerCase().includes(I)))}),f=R(()=>{const I=new Map;for(const P of d.value){if(P.kind!=="ws:in"&&P.kind!=="ws:out")continue;const D=P.kind==="ws:in"?"←":"→",T=`${D} ${P.eventType??"?"} @ ${P.sessionId??"-"}`,L=I.get(T)??{key:T,sessionId:P.sessionId??"-",eventType:P.eventType??"?",dir:D,count:0};L.count++,P.seq!==void 0&&(L.lastSeq=P.seq),I.set(T,L)}return[...I.values()].sort((P,D)=>D.count-P.count)}),h=R(()=>{const I=new Map;for(const P of d.value){if(P.source!=="rest"||P.kind==="rest:request")continue;const D=`${P.method??"?"} ${P.path??"?"}`,T=I.get(D)??{count:0,errors:0,totalMs:0,timed:0};T.count++,c(P)&&T.errors++,P.durationMs!==void 0&&(T.totalMs+=P.durationMs,T.timed++),I.set(D,T)}return[...I.entries()].map(([P,D])=>({key:P,count:D.count,errors:D.errors,avgMs:D.timed>0?Math.round(D.totalMs/D.timed):0})).sort((P,D)=>D.count-P.count)}),g=Z(null),m=Z(!0),w=Z(null),_=Z(null);et(()=>d.value.length,async()=>{if(!m.value||l.value!=="timeline")return;await yt();const I=w.value;I&&(I.scrollTop=I.scrollHeight)});function v(I){g.value=g.value===I?null:I}function k(I){const P=new Date(I),D=(T,L=2)=>String(T).padStart(L,"0");return`${D(P.getHours())}:${D(P.getMinutes())}:${D(P.getSeconds())}.${D(P.getMilliseconds(),3)}`}function y(I){return JSON.stringify(I,null,2)}async function x(I){await js(y(I))&&(_.value=I.id,setTimeout(()=>{_.value===I.id&&(_.value=null)},1500))}function M(){f$(d.value)}function $(I){return c(I)||I.source==="client"?"b-err":I.source==="rest"?"b-rest":I.kind==="ws:lifecycle"?"b-life":I.kind==="ws:out"?"b-out":"b-in"}function S(I){return I.source==="rest"?"REST":I.source==="client"?"APP":"WS"}return(I,P)=>(b(),A("section",jWe,[C("header",VWe,[P[11]||(P[11]=C("strong",null,"KAP debug",-1)),C("span",qWe,N(d.value.length)+"/"+N(a.value.length),1),C("div",KWe,[C("button",{type:"button",class:Re({on:p(T1)}),onClick:P[0]||(P[0]=D=>T1.value=!p(T1))},N(p(T1)?"resume":"pause"),3),C("button",{type:"button",onClick:P[1]||(P[1]=D=>p(Kde)())},"clear"),C("button",{type:"button",onClick:P[2]||(P[2]=D=>M())},"export jsonl"),V(p(Pn),{text:"Close window"},{default:ke(()=>[C("button",{type:"button",onClick:P[3]||(P[3]=D=>n("close"))},"✕")]),_:1})])]),C("div",ZWe,[In(C("select",{"onUpdate:modelValue":P[4]||(P[4]=D=>o.value=D),"aria-label":"Source filter"},[...P[12]||(P[12]=[C("option",{value:"all"},"rest + ws + app",-1),C("option",{value:"rest"},"rest",-1),C("option",{value:"ws"},"ws",-1),C("option",{value:"client"},"app errors",-1)])],512),[[q4,o.value]]),In(C("select",{"onUpdate:modelValue":P[5]||(P[5]=D=>i.value=D),"aria-label":"Session filter"},[P[13]||(P[13]=C("option",{value:""},"all sessions",-1)),(b(!0),A(Pe,null,pt(u.value,D=>(b(),A("option",{key:D,value:D},N(D),9,GWe))),128))],512),[[q4,i.value]]),In(C("input",{"onUpdate:modelValue":P[6]||(P[6]=D=>s.value=D),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[ri,s.value]]),C("label",YWe,[In(C("input",{"onUpdate:modelValue":P[7]||(P[7]=D=>r.value=D),type:"checkbox"},null,512),[[Em,r.value]]),P[14]||(P[14]=Ve(" errors",-1))]),C("label",XWe,[In(C("input",{"onUpdate:modelValue":P[8]||(P[8]=D=>m.value=D),type:"checkbox"},null,512),[[Em,m.value]]),P[15]||(P[15]=Ve(" follow",-1))]),C("div",JWe,[C("button",{type:"button",class:Re({on:l.value==="timeline"}),onClick:P[9]||(P[9]=D=>l.value="timeline")},"timeline",2),C("button",{type:"button",class:Re({on:l.value==="aggregate"}),onClick:P[10]||(P[10]=D=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(b(),A("div",{key:0,ref_key:"listRef",ref:w,class:"kap-list"},[d.value.length===0?(b(),A("div",QWe," No trace entries yet. REST calls and WS frames will appear here. ")):te("",!0),(b(!0),A(Pe,null,pt(d.value,D=>(b(),A("div",{key:D.id,class:"kap-row-wrap"},[C("button",{type:"button",class:Re(["kap-row",{expanded:g.value===D.id}]),onClick:T=>v(D.id)},[C("span",tUe,N(k(D.ts)),1),C("span",{class:Re(["kap-badge",$(D)])},N(S(D)),3),C("span",nUe,N(D.label),1)],10,eUe),g.value===D.id?(b(),A("div",oUe,[C("div",sUe,[C("button",{type:"button",onClick:T=>x(D)},N(_.value===D.id?"copied ✓":"copy json"),9,iUe)]),C("pre",null,N(y(D)),1)])):te("",!0)]))),128))],512)):(b(),A("div",rUe,[P[20]||(P[20]=C("h4",null,"WS frames by session / type",-1)),C("table",null,[P[17]||(P[17]=C("thead",null,[C("tr",null,[C("th",null,"dir"),C("th",null,"type"),C("th",null,"session"),C("th",null,"count"),C("th",null,"last seq")])],-1)),C("tbody",null,[(b(!0),A(Pe,null,pt(f.value,D=>(b(),A("tr",{key:D.key},[C("td",null,N(D.dir),1),C("td",lUe,N(D.eventType),1),C("td",aUe,N(D.sessionId),1),C("td",uUe,N(D.count),1),C("td",cUe,N(D.lastSeq??"—"),1)]))),128)),f.value.length===0?(b(),A("tr",dUe,[...P[16]||(P[16]=[C("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):te("",!0)])]),P[21]||(P[21]=C("h4",null,"REST by endpoint",-1)),C("table",null,[P[19]||(P[19]=C("thead",null,[C("tr",null,[C("th",null,"endpoint"),C("th",null,"count"),C("th",null,"errors"),C("th",null,"avg ms")])],-1)),C("tbody",null,[(b(!0),A(Pe,null,pt(h.value,D=>(b(),A("tr",{key:D.key},[C("td",fUe,N(D.key),1),C("td",pUe,N(D.count),1),C("td",{class:Re(["num",{err:D.errors>0}])},N(D.errors),3),C("td",hUe,N(D.avgMs),1)]))),128)),h.value.length===0?(b(),A("tr",mUe,[...P[18]||(P[18]=[C("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):te("",!0)])])]))]))}}),vUe=ht(gUe,[["__scopeId","data-v-04683f0d"]]),yUe=tt({__name:"DebugPanel",setup(e){const t=Z(!1);let n=null,o=null,s=null;const i=["data-color-scheme"];function r(c){const d=document.documentElement,f=c.documentElement;for(const h of i){const g=d.getAttribute(h);g!==null?f.setAttribute(h,g):f.removeAttribute(h)}}function l(c){const d=c.document;d.title="KAP debug";const f=d.createElement("base");f.href=location.href,d.head.appendChild(f);for(const g of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(g.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){s?.disconnect(),s=null;try{o?.unmount()}catch{}o=null,n=null,t.value=!1}function u(){if(n&&!n.closed){n.focus();return}const c=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!c)return;n=c;const d=l(c),f=Im(vUe,{onClose:()=>c.close()});f.mount(d),o=f,t.value=!0,s=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),s.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),c.addEventListener("pagehide",a),c.addEventListener("beforeunload",a)}return dn(()=>{u()}),Un(()=>{n&&!n.closed&&n.close(),a()}),(c,d)=>(b(),me(p(Pn),{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:ke(()=>[C("button",{class:"kap-fab",type:"button",onClick:u}," KAP ")]),_:1},8,["text"]))}}),kUe=ht(yUe,[["__scopeId","data-v-454fcd8d"]]);function bUe({running:e}){const t=["◐","◓","◑","◒"],n=Z(0);let o=null;function s(){o===null&&(n.value=0,o=setInterval(()=>{n.value=(n.value+1)%t.length},250))}function i(){o!==null&&(clearInterval(o),o=null),n.value=0}et(e,l=>{l?s():i()},{immediate:!0});const r=R(()=>`${e.value?`${t[n.value]} `:""}Kimi Code Web`);JS(()=>{typeof document<"u"&&(document.title=r.value)}),kn(()=>{i()})}function CUe(e,t,n){const o=e.items.filter(u=>u.kind==="turn"),s=o[0]?.turnId,i=o.length===1?s:void 0,r=new Map(e.tasks.map(u=>[u.taskId,u])),l=e.items.flatMap(u=>u.kind==="turn"?wUe(u,e.attachments,r,u.turnId===s?n?.createdAt:void 0,u.turnId===i?n?.disposedAt:void 0):[]),a=e.meta.activity==="turn";return E$(l,[],t,a).map(xUe)}function wUe(e,t,n,o,s){const i=[],r=new Map(t.map(d=>[d.attachmentId,d])),l=SUe([e.startedAt,...e.steps.map(d=>d.startedAt),o])??"",a=hS(e.endedAt)??hS(s),u=e.turnId;if(e.prompt!==void 0&&e.prompt.length>0){const d=[{type:"text",text:e.prompt}];for(const f of e.attachmentIds??[]){const h=AUe(r.get(f));h!==void 0&&d.push(h)}i.push({id:`${e.turnId}:input`,sessionId:"",role:"user",content:d,createdAt:l,promptId:u,metadata:e.origin.kind==="task"&&e.prompt.includes("f.role==="assistant");d>=0&&(i[d]={...i[d],durationMs:c})}return i}function _Ue(e,t,n){const[o="",...s]=t.split(` -`),i=n?.state??"info";return{id:`task:${e}:${i}`,category:"task",type:`task.${i}`,sourceKind:n?.kind==="subagent"?"subagent":"background_task",sourceId:e,agentId:n?.agentId,title:o.trim(),severity:i==="completed"?"info":"warning",body:s.join(` -`).trim(),raw:t}}function xUe(e){if(e.createdAt!==""&&e.endedAt!=="")return e;const t={...e};return t.createdAt===""&&delete t.createdAt,t.endedAt===""&&delete t.endedAt,t}function SUe(e){let t;for(const n of e){if(n===void 0)continue;const o=Date.parse(n);Number.isFinite(o)&&(t===void 0||o=0?n:void 0}const mF=Z(typeof window>"u"?0:window.innerWidth);let Nh=0,Dg=!1;function Ey(){mF.value=window.innerWidth}function MUe(){Dg||typeof window>"u"||(window.addEventListener("resize",Ey),Dg=!0,Ey())}function TUe(){!Dg||typeof window>"u"||(window.removeEventListener("resize",Ey),Dg=!1)}function gF(e,t,n){return Math.max(t,e-n)}function Iy(e,t,n){return Math.min(n,Math.max(t,e))}function vF(){return dn(()=>{Nh+=1,MUe()}),Un(()=>{Nh=Math.max(0,Nh-1),Nh===0&&TUe()}),{viewportWidth:mF}}const EUe="kimi-web.file-preview-width",kd=320;function IUe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=vF(),i=R(()=>Math.max(0,s.value-t.value)),r=R(()=>gF(i.value,kd,kd));function l(X){return Iy(Math.round(X),kd,r.value)}function a(){return l(i.value/2)}const u=R(()=>a()),c=Z(u.value),d=R(()=>Iy(c.value,kd,r.value)),f=Z(null),h=R(()=>{const X=f.value;if(!X)return null;const fe=e.turns.value.find(Ce=>Ce.id===X.turnId);return fe?.role==="compaction"&&fe.text?fe.text:null}),g=R(()=>h.value!==null);function m(X){if(f.value?.turnId===X.turnId){f.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",f.value=X}function w(){f.value=null,n.value==="compaction"&&(n.value=null)}const _=Z(null),v=R(()=>{const X=_.value;if(!X)return{entry:void 0,version:0};const fe=e.auxiliaryTranscripts.getEntry(X.sessionId,X.subagentId);return{entry:fe,version:fe?.version.value??0}});function k(X){const fe=e.turns.value.flatMap(Ce=>Ce.tools??[]).find(Ce=>Ce.agentId===X);if(!fe)return{};try{const Ce=JSON.parse(fe.arg);return{name:typeof Ce.description=="string"?Ce.description:void 0,subagentType:typeof Ce.subagent_type=="string"?Ce.subagent_type:void 0,status:fe.status,outputLines:fe.output}}catch{return{}}}const y=R(()=>{const X=_.value;if(!X)return null;const fe=e.activeAppTasks.value.find(Fe=>Fe.agentId===X.subagentId||Fe.id===X.subagentId);if(fe)return L9e(fe);const Ce=v.value.entry?.channel,ge=Ce?.agents.find(Fe=>Fe.agentId===X.subagentId),Q=Ce?.refreshError??!1,ee=Ce===void 0||Ce.loading,ce=Ce?.snapshot.meta.activity==="turn",ue=k(X.subagentId),Se=Ce?.snapshot.items.findLast(Fe=>Fe.kind==="turn"),Ue=Se?.kind==="turn"&&Se.state==="cancelled",_e=Se?.kind==="turn"&&Se.state==="failed"||ue.status==="error",Te=ce?"working":_e||Ue?"failed":ee?"queued":Q&&ue.status===void 0?"failed":"completed",st=ce?"running":Ue?"cancelled":_e?"failed":ee?"running":Q&&ue.status===void 0?"failed":"completed";return{id:X.subagentId,name:ge?.label??ue.name??X.subagentId,subagentType:ue.subagentType??(ge?.type==="sub"?"subagent":ge?.type),phase:Te,status:st,outputLines:ue.outputLines}}),x=R(()=>{const X=v.value.entry;if(!X)return[];const fe=_.value,Ce=X.channel.agents.find(ge=>ge.agentId===fe?.subagentId);return CUe(X.channel.snapshot,e.getFileUrl,Ce)}),M=R(()=>v.value.entry?.channel.loading??!1),$=R(()=>v.value.entry?.channel.refreshError??!1),S=R(()=>v.value.entry?.channel.loadingOlder??!1),I=R(()=>v.value.entry?.channel.loadOlderError??!1),P=R(()=>v.value.entry?.channel.snapshot.hasMoreOlder??!1),D=R(()=>v.value.entry?.channel.snapshot.meta.activity==="turn"),T=R(()=>y.value!==null);function L(X){const fe=e.activeSessionId.value;if(!(!X||!fe)){if(n.value==="agent"&&_.value?.sessionId===fe&&_.value.subagentId===X){B();return}_.value={sessionId:fe,subagentId:X},n.value="agent",e.auxiliaryTranscripts.activate(fe,X)}}function B(){const X=_.value;X&&e.auxiliaryTranscripts.deactivate(X.sessionId,X.subagentId),_.value=null,n.value==="agent"&&(n.value=null)}et(n,(X,fe)=>{if(fe!=="agent"||X==="agent")return;const Ce=_.value;Ce&&e.auxiliaryTranscripts.deactivate(Ce.sessionId,Ce.subagentId)});function H(){const X=v.value.entry;X&&X.channel.loadOlder().catch(()=>{})}const O=Z("list"),F=Z(null);function W(){if(n.value==="diff"){z();return}n.value="diff",O.value="list",F.value=null,e.loadGitStatus(e.activeSessionId.value)}function z(){n.value==="diff"&&(n.value=null),O.value="list",F.value=null,e.clearFileDiff()}async function U(X){O.value="detail",F.value=X,await e.loadFileDiff(X)}const q=Xr(null);function K(X){if(q.value===X&&n.value==="turn-diff"){ie();return}q.value=X,n.value="turn-diff"}function ie(){q.value=null,n.value==="turn-diff"&&(n.value=null)}async function ne(X){if(!e.activeSessionId.value&&e.activeWorkspaceId.value){const fe=await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,X);return n.value="btw",fe}return await e.openSideChat(X),n.value="btw",null}function Y(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function le(){n.value==="btw"&&(n.value=null)}const Ee=R(()=>e.sideChatVisible.value),de=R(()=>n.value!==null&&(n.value!=="compaction"||g.value)&&(n.value!=="agent"||T.value)&&(n.value!=="btw"||Ee.value)),he=Z(!1),pe=Z({});function oe(){switch(n.value){case"compaction":return f.value?{kind:"compaction",...f.value}:null;case"agent":return _.value?{kind:"agent",..._.value}:null;case"btw":return{kind:"btw"};default:return null}}function ve(X){if(X)switch(X.kind){case"compaction":f.value={turnId:X.turnId},n.value="compaction";break;case"agent":e.activeSessionId.value&&(_.value={sessionId:e.activeSessionId.value,subagentId:X.subagentId},n.value="agent",e.auxiliaryTranscripts.activate(e.activeSessionId.value,X.subagentId));break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="compaction"&&g.value?(w(),!0):n.value==="agent"&&T.value?(B(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(z(),!0):n.value==="turn-diff"?(ie(),!0):n.value==="btw"?(Y(),!0):!1}return et(e.activeSessionId,(X,fe)=>{if(fe){const Ce=oe();Ce?pe.value[fe]=Ce:delete pe.value[fe]}o(),w(),B(),z(),ie(),le(),X&&ve(pe.value[X])}),{PREVIEW_WIDTH_KEY:EUe,PREVIEW_MIN:kd,previewDefaultWidth:u,previewMax:r,previewWidth:c,previewPanelWidth:d,compactionPanelText:h,compactionPanelVisible:g,openCompactionPanel:m,closeCompactionPanel:w,agentPanelMember:y,agentPanelTurns:x,agentPanelLoading:M,agentPanelLoadError:$,agentPanelLoadingMore:S,agentPanelLoadMoreError:I,agentPanelHasMore:P,agentPanelRunning:D,agentPanelVisible:T,openAgentPanel:L,closeAgentPanel:B,loadOlderAgentMessages:H,detailDiffMode:O,detailDiffPath:F,openDiffDetail:W,closeDiffDetail:z,selectDiffFile:U,turnDiffChange:q,openTurnDiff:K,closeTurnDiff:ie,btwVisible:Ee,openSideChatTab:ne,closeSideChat:Y,hideSideChatPanel:le,sidePanelVisible:de,panelDragging:he,closeOpenSidePanel:G}}const LUe=cn.sidebarWidth,gS=cn.sidebarCollapsed,vS=270,M4=170,$Ue=480,NUe=320;function FUe(e={}){const{viewportWidth:t}=vF(),n=Z(vS),o=Z(!1),s=Z(!1),i=R(()=>{const c=NUe+(Rh(e.previewOpen)?kd:0);return Math.min($Ue,gF(t.value,M4,c))}),r=R(()=>Iy(n.value,M4,i.value));function l(){try{o.value=li(gS)==="true"}catch{o.value=!1}}function a(){try{Ls(gS,String(o.value))}catch{}}function u(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:LUe,SIDEBAR_DEFAULT:vS,SIDEBAR_MIN:M4,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:u}}const RUe=40409;function yS(e){return Hs(e)&&e.code===RUe}function kS(e){return e.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function bS(e){if(e.startsWith("\\\\"))return e;const t=/^[a-zA-Z]:/.test(e)?e.slice(0,2):"",n=[];for(const o of e.slice(t.length).split(/[\\/]+/))if(!(!o||o===".")){if(o===".."){n.pop();continue}n.push(o)}return t?`${t}/${n.join("/")}`:`/${n.join("/")}`}function OUe({client:e,detailTarget:t}){const{t:n}=Lt(),o=Z(null),s=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0,u=null;function c(){u!==null&&(URL.revokeObjectURL(u),u=null)}const d=R(()=>{const S=l.value;return S?e.getFileDownloadUrl(S):null}),f=R(()=>o.value!==null&&l.value!==null);function h(S){return S.length>1?S.replace(/\/+$/,""):S}function g(S){const I=F2(S,e.status.value.cwd);return I===null||I.split(/[\\/]+/).includes("..")?null:m(I)||null}function m(S){const I=[];for(const P of S.split(/[\\/]+/))if(!(!P||P===".")){if(P===".."){I.pop();continue}I.push(P)}return I.join("/")}function w(S){const I=S.trim();if(!I)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(I))return{error:n("filePreview.errors.unsupportedPath")};if(I.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const P=h(e.status.value.cwd);if(I.startsWith("/")){if(!P||I!==P&&!I.startsWith(`${P}/`))return{error:n("filePreview.errors.outsideWorkspace")};const T=I===P?"":I.slice(P.length+1);if(T.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const L=m(T);return L?{path:L}:{error:n("filePreview.errors.isDirectory")}}if(I.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const D=m(I);return D?{path:D}:{error:n("filePreview.errors.emptyPath")}}async function _(S){const I=o.value;if(t.value==="file"&&I&&I.path===S.path&&I.line===S.line){x();return}const P=++a;if(c(),t.value="file",s.value=null,r.value=null,i.value=!0,o.value=S,l.value=null,typeof S.content=="string"){i.value=!1,s.value={path:S.path,content:S.content,encoding:"utf-8",mime:"text/markdown",isBinary:!1,size:S.content.length};return}if(!kS(S.path)&&S.path.split(/[\\/]+/).includes("..")){const T=h(e.status.value.cwd);T&&(S={...S,path:bS(`${T}/${S.path}`)})}if(kS(S.path)){S={...S,path:bS(S.path)};const T=g(S.path);if(T!==null)S={...S,path:T};else{try{const L=await e.readHostFileContent(S.path);if(P!==a)return;l.value=null,s.value={path:S.path,content:L.content,encoding:L.encoding,mime:L.mime,isBinary:L.isBinary,size:L.size}}catch(L){if(P!==a)return;r.value=yS(L)?n("filePreview.errors.notFound"):lU(L)?n("filePreview.errors.tooLarge"):L instanceof Error?L.message:n("filePreview.errors.loadFailed")}finally{P===a&&(i.value=!1)}return}}const D=w(S.path);if("error"in D){i.value=!1,r.value=D.error;return}l.value=D.path;try{const T=await e.readFileContent(D.path);if(P!==a)return;T?s.value={...T,path:T.path||D.path}:r.value=n("filePreview.errors.loadFailed")}catch(T){if(P!==a)return;r.value=yS(T)?n("filePreview.errors.notFound"):T instanceof Error?T.message:n("filePreview.errors.loadFailed")}finally{P===a&&(i.value=!1)}}function v(S){return/^data:([^;,]+)/i.exec(S)?.[1]}function k(S){if(S.kind!=="image")return;const I=++a;c(),t.value="file",o.value=null,l.value=null,r.value=null;const P={path:S.path??"ReadMediaFile image",content:"",encoding:"utf-8",mime:S.mimeType??v(S.url)??"image/*",isBinary:!0,size:S.bytes??0};S.fileId?(i.value=!0,s.value=P,_t().getFileBlob(S.fileId).then(D=>{if(I===a){if(t.value!=="file"||!s.value){i.value=!1;return}u=URL.createObjectURL(D),s.value={...s.value,sourceUrl:u},i.value=!1}}).catch(()=>{I===a&&(s.value&&(s.value={...s.value,sourceUrl:S.url}),i.value=!1)})):(i.value=!1,s.value={...P,sourceUrl:S.url})}function y(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1,c()}function x(){y(),t.value==="file"&&(t.value=null)}et(t,(S,I)=>{I==="file"&&S!=="file"&&y()});function M(){const S=s.value?.path??o.value?.path;S&&e.openWorkspaceFile(S,o.value?.line)}function $(){const S=s.value?.path??o.value?.path;S&&e.revealWorkspaceFile(S)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:d,previewExternalActions:f,openFilePreview:_,openMediaPreview:k,closeFilePreview:x,openPreviewInEditor:M,revealPreviewFile:$}}const PUe=640,DUe=`(max-width: ${PUe}px)`;function BUe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(DUe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),kn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),kn(()=>t.removeListener(n))),e}const HUe=tt({__name:"ServerAuthDialog",setup(e){const t=Z(""),n=Z(null),o=Z(!1);dn(()=>{yt(()=>n.value?.focus())});function s(){const r=t.value;!r||o.value||(o.value=!0,p$(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),s())}return(r,l)=>(b(),me(p(ca),{open:!0,title:"Server token required","hide-close":!0,"close-on-overlay":!1,"close-on-esc":!1},{foot:ke(()=>[V(p(Ft),{variant:"primary",disabled:!t.value||o.value,loading:o.value,onClick:s},{default:ke(()=>[Ve(N(o.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])]),default:ke(()=>[l[1]||(l[1]=C("p",{class:"server-auth-hint"},[Ve(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),C("code",null,"KIMI_CODE_PASSWORD"),Ve("). ")],-1)),V(p(zs),{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:o.value,onKeydown:i},null,8,["modelValue","disabled"])]),_:1}))}}),zUe=ht(HUe,[["__scopeId","data-v-e3047f67"]]);function WUe(e,t){if(e===void 0||e.length===0)return;const n=t?.find(o=>o.id===e)??t?.find(o=>o.model===e);return n?.displayName||n?.model||(e.includes("/")?e.split("/").pop():e)}function UUe(e){if(!(e===void 0||e.length===0||e==="off"||e==="on"))return e}const jUe=["aria-label"],VUe=tt({__name:"InternalBuildBanner",setup(e){const{t}=Lt(),n=N2;return(o,s)=>p(n)?(b(),A("span",{key:0,class:"internal-build-tag",role:"note","aria-label":p(t)("app.internalBuildBanner")},[s[0]||(s[0]=C("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[C("path",{d:"M8 2 14 13H2L8 2Z"}),C("path",{d:"M8 6v3.5"}),C("path",{d:"M8 11.5h.01"})],-1)),C("span",null,N(p(t)("app.internalBuildBanner")),1)],8,jUe)):te("",!0)}}),qUe=ht(VUe,[["__scopeId","data-v-166b3735"]]),KUe={class:"app-shell"},ZUe=["inert"],GUe=["aria-label","aria-hidden"],YUe=tt({__name:"App",setup(e){hfe();const t=Z(!1);let n=null;const o=hu(),s=R(()=>!o.dangerousBypassAuth.value&&t.value);En("resolveImage",o.resolveImageUrl),En("resolveSwarmMembers",gt=>o.swarmMembersByToolCallId.value.get(gt)??[]),En("modelDisplay",gt=>WUe(gt,o.models.value));const{t:i}=Lt();En("subagentEffort",gt=>UUe(gt));const{confirm:r}=pu(),l=Qr(),a=BUe(),u=Z(!1),c=Z(!1),d=R(()=>{const gt=o.activeSessionId.value;return o.sessions.value.find(Le=>Le.id===gt)?.title??""}),f=R(()=>{const gt=o.activeSessionId.value;return o.sessions.value.find(Le=>Le.id===gt)?.lastTurnReason??null}),h=R(()=>o.visibleWorkspace.value?.sessionCount??0),g=R(()=>o.activity.value!=="idle");bUe({running:g});function m(gt){const Le=o.models.value.find(ts=>ts.id===o.status.value.modelId),Ge=Jp(Le),Xt=Ge.indexOf(bg(Le,gt)),hs=Ge[(Xt+1)%Ge.length]??Ge[0]??"off";return E5(Le,hs)}const w=R(()=>{const gt=o.models.value.find(Le=>Le.id===o.status.value.modelId);return bg(gt,o.thinking.value)}),_=Z(!o.onboarded.value);function v(){o.setOnboarded(!0),_.value=!1}function k(){v(),co.value="providers",po.value=!0}let y=0;function x(){const gt=window.visualViewport,Le=document.documentElement.style;Le.setProperty("--app-height",`${gt?.height??window.innerHeight}px`),Le.setProperty("--app-top",`${gt?.offsetTop??0}px`)}function M(){y||(y=requestAnimationFrame(()=>{y=0,x()}))}dn(()=>{n=yfe(()=>{t.value=!0,o.clearDangerousBypassAuth()}),o.load(),he(),x(),window.visualViewport?.addEventListener("resize",M),window.visualViewport?.addEventListener("scroll",M),window.addEventListener("resize",M),document.addEventListener("keydown",$,!0)}),kn(()=>{document.removeEventListener("keydown",$,!0),window.visualViewport?.removeEventListener("resize",M),window.visualViewport?.removeEventListener("scroll",M),window.removeEventListener("resize",M),y&&(cancelAnimationFrame(y),y=0),document.documentElement.style.removeProperty("--app-height"),document.documentElement.style.removeProperty("--app-top"),n!==null&&(n(),n=null)});function $(gt){gt.key==="Escape"&&(To.value||An()&&(gt.stopPropagation(),gt.preventDefault()))}const S=Z(null),{previewTarget:I,previewFile:P,previewLoading:D,previewError:T,previewDownloadUrl:L,previewExternalActions:B,openFilePreview:H,openMediaPreview:O,closeFilePreview:F,openPreviewInEditor:W,revealPreviewFile:z}=OUe({client:o,detailTarget:S}),U=R(()=>S.value!==null),{SIDEBAR_WIDTH_KEY:q,SIDEBAR_DEFAULT:K,SIDEBAR_MIN:ie,sidebarMax:ne,sessionColWidth:Y,sidebarCollapsed:le,sidebarDragging:Ee,sideWidth:de,loadSidebarCollapsed:he,toggleSidebarCollapse:pe}=FUe({previewOpen:U}),{PREVIEW_WIDTH_KEY:oe,PREVIEW_MIN:ve,previewDefaultWidth:G,previewMax:X,previewWidth:fe,previewPanelWidth:Ce,compactionPanelText:ge,compactionPanelVisible:Q,openCompactionPanel:ee,closeCompactionPanel:ce,agentPanelMember:ue,agentPanelTurns:Se,agentPanelLoading:Ue,agentPanelLoadError:_e,agentPanelLoadingMore:Te,agentPanelLoadMoreError:st,agentPanelHasMore:Fe,agentPanelRunning:Oe,openAgentPanel:Ye,closeAgentPanel:ft,loadOlderAgentMessages:$t,detailDiffMode:Ht,detailDiffPath:Yt,openDiffDetail:_n,closeDiffDetail:je,selectDiffFile:Ke,turnDiffChange:Ze,openTurnDiff:zt,closeTurnDiff:at,btwVisible:tn,openSideChatTab:Wt,closeSideChat:fn,sidePanelVisible:Sn,panelDragging:to,closeOpenSidePanel:An}=IUe({client:o,sideWidth:de,detailTarget:S,closeFilePreview:F}),ao=Z(null);function Kt(gt){ao.value?.style.setProperty("--preview-w",`${gt}px`)}et([ao,Ce],([gt,Le])=>gt?.style.setProperty("--preview-w",`${Le}px`),{immediate:!0});const Co=Z(null),Po=Z(!1),Mn=Z(!1),bn=Z(!1),Do=Z(!1),po=Z(!1);let At;dn(()=>{At=window.kimiDesktop?.onMenuAction?.(gt=>{gt==="open-settings"?po.value=!0:gt==="new-chat"&&ho()})}),kn(()=>{At?.()});const qs=Z(null),Bo=Z(null),To=R(()=>ki.value>0||Po.value||Mn.value||bn.value||Do.value||po.value||_.value||u.value||c.value),ai=Z(!1),Tn=Z(!1),no=Z(!1);async function Ks(){ai.value=!0,Tn.value=!1,Po.value=!0;try{await o.refreshAllProviders()}catch{Tn.value=!0}finally{ai.value=!1}}function ps(){Mn.value=!0}async function ui(){await r({title:i("sidebar.logoutConfirmTitle"),message:i("sidebar.logoutConfirmMessage"),variant:"danger",action:()=>o.logout()})}async function $s(gt){Po.value=!1,await yo(gt)}async function yo(gt){await o.setModel(gt)&>!==o.defaultModel.value&&o.updateConfig({defaultModel:gt})}const oo=Z(null);async function uo(gt){await o.archiveSession(gt),!o.sessionsForView.value.some(Le=>Le.id===gt)&&(oo.value={id:gt})}async function Xn(){const gt=oo.value;gt&&await o.restoreSession(gt.id)&&(oo.value=null)}const co=Z(void 0),Qe=Z(void 0);et(c,gt=>{gt||(Qe.value=void 0)});function it(){oo.value=null,a.value?(Qe.value="archived",c.value=!0):(co.value="archived",po.value=!0)}async function Ct(gt){const Le=o.workspacesView.value.find(Ge=>Ge.id===gt)?.name??gt;await r({title:i("sidebar.removeWorkspace"),message:i("workspace.removeWorkspaceConfirm",{name:Le}),variant:"danger",action:()=>o.deleteWorkspace(gt)})}async function en(gt){no.value=!0;try{await o.updateConfig(gt)&&await o.checkAuth()}finally{no.value=!1}}async function yn(){return o.startOAuthLogin()}async function Ho(){return o.pollOAuthLogin()}async function Eo(){return o.cancelOAuthLogin()}async function Io(){Mn.value=!1,await o.checkAuth(),await o.load()}async function Zs(){v(),await o.checkAuth(),await o.load()}async function zo(gt){await o.undo(1)!==null&&(await yt(),Co.value?.loadComposerForEdit(gt.text,gt.attachments),Co.value?.notifyUndone())}async function Lo(){const gt=await o.abortCurrentPrompt();Co.value?.onAbortOutcome(gt)}function Wo(gt){const Le=_t();return gt.map(Ge=>({kind:Ge.kind,url:Le.getFileUrl(Ge.fileId),fileId:Ge.fileId,name:Ge.name}))}async function sn(gt,Le){if(o.authReady.value)return!0;const Ge=o.managedProviderStatus.value==="authenticated";Ge&&o.managedMembership.value===null&&await o.probeManagedMembership();const Xt=Ge&&o.managedMembership.value==="free",hs=await r(Xt?{title:i("login.upgradeRequiredTitle"),message:i("login.upgradeRequiredMessage"),confirmLabel:i("sidebar.upgrade"),variant:"primary"}:{title:i("login.requiredTitle"),message:i("login.requiredMessage"),confirmLabel:i("login.goToLogin"),variant:"primary"});return Co.value?.loadComposerForEdit(gt,Wo(Le)),hs&&(Xt?o0():ps()),!1}async function ws(gt,Le=[]){if(o.activeSessionId.value||o.activeWorkspaceId.value)return!0;const Ge=await r({title:i("workspace.requiredTitle"),message:i("workspace.requiredMessage"),confirmLabel:i("conversation.pickFolder"),variant:"primary"});return Co.value?.loadComposerForEdit(gt,Wo(Le)),Ge&&(bn.value=!0),!1}async function Uo(gt,Le=[]){return await sn(gt,Le)?ws(gt,Le):!1}async function Mr(gt){const{cmd:Le,attachments:Ge}=gt;if(Le==="/compact"||Le.startsWith("/compact ")){if(!await Uo(Le))return;o.compact(Le.slice(8).trim()||void 0);return}if(Le==="/swarm"||Le.startsWith("/swarm ")){const Xt=Le.slice(6).trim();if(Xt==="on")o.setSwarmMode(!0);else if(Xt==="off")o.setSwarmMode(!1);else if(Xt){if(!await Uo(Le))return;o.setSwarmMode(!0),o.sendPrompt(Xt)}else o.toggleSwarmMode();return}if(Le==="/goal"||Le.startsWith("/goal ")){const Xt=Le.slice(5).trim();if(Xt==="pause"||Xt==="resume"||Xt==="cancel")o.controlGoal(Xt);else if(Xt){if(!await Uo(Le))return;o.createGoal(Xt)}else o.toggleGoalMode();return}if(Le==="/btw"||Le.startsWith("/btw ")){const Xt=Le.slice(4).trim();if(!Xt&&o.sideChatVisible.value)fn();else{if(Xt&&!await Uo(Le))return;Wt(Xt||void 0)}return}switch(Le){case"/new":case"/clear":ho();break;case"/fork":o.forkSession();break;case"/export":o.exportSession();break;case"/undo":o.undo();break;case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(m(o.thinking.value));break;case"/status":Do.value=!0;break;case"/login":ps();break;default:{const Xt=Le.indexOf(" "),hs=aMe((Xt===-1?Le:Le.slice(0,Xt)).slice(1)),ts=Xt===-1?void 0:Le.slice(Xt+1).trim()||void 0;if(!hs)break;if(!await Uo(Le,Ge))return;!o.activeSessionId.value&&o.activeWorkspaceId.value?o.startSessionAndActivateSkill(o.activeWorkspaceId.value,hs,ts,Ge):o.activateSkill(hs,ts,Ge);break}}}function Gs(gt){o.unqueue(gt)}function Vi(gt){o.unqueue(gt)}function Ys(gt){o.reorderQueue(gt.from,gt.to)}async function jo(gt){if(!await sn(gt.text,gt.attachments))return;const Le=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&Le){await o.startSessionAndSendPrompt(Le,gt.text,gt.attachments);return}if(!o.activeSessionId.value&&!Le){qs.value=gt,await r({title:i("workspace.requiredTitle"),message:i("workspace.requiredMessage"),confirmLabel:i("conversation.pickFolder"),variant:"primary"})?bn.value=!0:Vo();return}o.sendPrompt(gt.text,gt.attachments)}function Vo(){const gt=qs.value;qs.value=null,gt&&Co.value?.loadComposerForEdit(gt.text,Wo(gt.attachments))}async function Il(gt){if(Bo.value=null,!await o.addWorkspaceByPath(gt)){Bo.value=i("workspace.addFailed");return}bn.value=!1;const Ge=qs.value;qs.value=null;const Xt=o.activeWorkspaceId.value;Ge&&Xt&&await o.startSessionAndSendPrompt(Xt,Ge.text,Ge.attachments)}function cr(){Vo(),Bo.value=null,bn.value=!1}function Tr(){yt(()=>{Co.value?.focusComposer()})}function ho(){const gt=o.activeWorkspaceId.value;gt?o.openWorkspaceDraft(gt):o.clearActiveSession(),Tr()}function ko(gt){o.openWorkspaceDraft(gt),Tr()}function qi(gt){gt&&window.open(gt,"_blank","noopener")}return(gt,Le)=>(b(),A("div",KUe,[s.value?(b(),me(zUe,{key:0})):te("",!0),C("div",{class:Re(["app",{mobile:p(a),"sidebar-collapsed":p(le)&&!p(a),"macos-desktop":p(uc)}]),inert:_.value},[p(a)?(b(),me(GBe,{key:1,workspace:p(o).visibleWorkspace.value,"session-title":d.value,running:g.value,branch:p(o).status.value.branch,"session-count":h.value,onOpenSwitcher:Le[22]||(Le[22]=Ge=>u.value=!0),onOpenSettings:Le[23]||(Le[23]=Ge=>c.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(b(),A(Pe,{key:0},[V(a5e,{collapsed:p(le),dragging:p(Ee),"col-width":p(de),"active-workspace":p(o).visibleWorkspace.value,"active-workspace-id":p(o).activeWorkspaceId.value,sessions:p(o).sessionsForView.value,groups:p(o).workspaceGroups.value,"pinned-sessions":p(o).pinnedSessions.value,"flat-sessions":p(o).flatSessions.value,"flat-has-more":p(o).flatSessionsHasMore.value,"flat-loading-more":p(o).flatSessionsLoadingMore.value,initialized:p(o).initialized.value,"active-id":p(o).activeSessionId.value,"attention-by-session":p(o).attentionBySession.value,"pending-by-session":p(o).pendingBySession.value,"unread-by-session":p(o).unreadBySession.value,onSelect:Le[0]||(Le[0]=Ge=>p(o).selectSession(Ge)),onCreate:ho,onCreateInWorkspace:Le[1]||(Le[1]=Ge=>ko(Ge)),onSelectWorkspace:Le[2]||(Le[2]=Ge=>p(o).openWorkspace(Ge)),onAddWorkspace:Le[3]||(Le[3]=Ge=>bn.value=!0),onRename:Le[4]||(Le[4]=(Ge,Xt)=>p(o).renameSession(Ge,Xt)),onArchive:Le[5]||(Le[5]=Ge=>uo(Ge)),onFork:Le[6]||(Le[6]=Ge=>p(o).forkSession(Ge)),onExport:Le[7]||(Le[7]=Ge=>p(o).exportSession(Ge)),onPin:Le[8]||(Le[8]=Ge=>p(o).togglePinSession(Ge)),onUnpin:Le[9]||(Le[9]=Ge=>p(o).unpinSession(Ge)),onReorderPinned:Le[10]||(Le[10]=Ge=>p(o).reorderPinnedSessions(Ge)),onPinAt:Le[11]||(Le[11]=(Ge,Xt,hs)=>p(o).pinSessionAt(Ge,Xt,hs)),onRenameWorkspace:Le[12]||(Le[12]=(Ge,Xt)=>p(o).renameWorkspace(Ge,Xt)),onDeleteWorkspace:Le[13]||(Le[13]=Ge=>Ct(Ge)),onReorderWorkspaces:Le[14]||(Le[14]=Ge=>p(o).reorderWorkspaces(Ge)),onLoadMoreSessions:Le[15]||(Le[15]=Ge=>void p(o).loadMoreSessions(Ge)),onLoadAllSessions:Le[16]||(Le[16]=Ge=>void p(o).loadAllSessions()),onEnsureFlatSessions:Le[17]||(Le[17]=Ge=>void p(o).ensureFlatSessions()),onLoadMoreFlatSessions:Le[18]||(Le[18]=Ge=>void p(o).loadMoreFlatSessions()),onOpenSettings:Le[19]||(Le[19]=Ge=>po.value=!0),onLogin:ps,onCollapse:p(pe)},null,8,["collapsed","dragging","col-width","active-workspace","active-workspace-id","sessions","groups","pinned-sessions","flat-sessions","flat-has-more","flat-loading-more","initialized","active-id","attention-by-session","pending-by-session","unread-by-session","onCollapse"]),In(V($x,{class:"side-handle","storage-key":p(q),"default-width":p(K),min:p(ie),max:p(ne),"onUpdate:width":Le[20]||(Le[20]=Ge=>Y.value=Ge),"onUpdate:dragging":Le[21]||(Le[21]=Ge=>Ee.value=Ge)},null,8,["storage-key","default-width","min","max"]),[[Es,!p(le)]])],64)),V(zLe,{ref_key:"conversationPaneRef",ref:Co,mobile:p(a),turns:p(o).turns.value,"session-id":p(o).activeSessionId.value,approvals:p(o).pendingApprovals.value,changes:p(o).changes.value,"git-info":p(o).gitInfo.value,tasks:p(o).tasks.value,todos:p(o).todos.value,goal:p(o).goal.value,"activation-badges":p(o).activationBadges.value,status:p(o).status.value,thinking:p(o).thinking.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"goal-mode":p(o).goalMode.value,models:p(o).models.value,"auth-ready":p(o).authReady.value,"managed-signed-in":p(o).managedProviderStatus.value==="authenticated","managed-membership":p(o).managedMembership.value,"starred-ids":p(o).starredModelIds.value,skills:p(o).skills.value,questions:p(o).questions.value,"pending-question-actions":p(o).pendingQuestionActions,"pending-approval-actions":p(o).pendingApprovalActions,running:g.value,"overlay-open":To.value,"turn-active":p(o).turnActive.value,queued:p(o).queued.value,"search-files":p(o).searchFiles,"upload-image":p(o).uploadImage,working:p(o).working.value,"last-turn-reason":f.value,"turn-error":p(o).activeTurnError.value??null,"turn-retry":p(o).activeTurnRetry.value??null,starting:p(o).isStartingFirstPrompt.value,"file-reload-key":p(o).activeSessionId.value,"session-loading":p(o).sessionLoading.value,compaction:p(o).compaction.value,"has-more-messages":p(o).hasMoreMessages.value,"loading-more":p(o).loadingMoreMessages.value,"loading-more-error":p(o).loadMoreMessagesError.value,"load-older-messages":p(o).loadOlderMessages,"workspace-name":p(o).visibleWorkspace.value?.name,"workspace-root":p(o).visibleWorkspace.value?.root??p(o).status.value.cwd,"git-diff-stats":p(o).gitDiffStats.value,workspaces:p(o).workspacesView.value,"active-workspace-id":p(o).activeWorkspaceId.value,"session-title":d.value,pr:p(o).activePullRequest.value,onOpenChanges:Le[24]||(Le[24]=Ge=>p(_n)()),onSelectWorkspace:Le[25]||(Le[25]=Ge=>ko(Ge)),onAddWorkspace:Le[26]||(Le[26]=Ge=>bn.value=!0),onOpenPr:qi,onSubmit:Le[27]||(Le[27]=Ge=>jo(Ge)),onLogin:Le[28]||(Le[28]=Ge=>ps()),onSteer:Le[29]||(Le[29]=Ge=>p(o).steerPrompt(Ge.text,Ge.attachments)),onApproval:Le[30]||(Le[30]=(Ge,Xt)=>p(o).respondApproval(Ge,Xt)),onCancelTask:Le[31]||(Le[31]=Ge=>p(o).cancelTask(Ge)),onAnswer:Le[32]||(Le[32]=(Ge,Xt)=>p(o).respondQuestion(Ge,Xt)),onDismiss:Le[33]||(Le[33]=Ge=>p(o).dismissQuestion(Ge)),onCommand:Mr,onInterrupt:Lo,onUnqueue:Gs,onEditQueued:Vi,onReorderQueue:Ys,onSetPermission:Le[34]||(Le[34]=Ge=>p(o).setPermission(Ge)),onSetThinking:Le[35]||(Le[35]=Ge=>p(o).setThinking(Ge)),onTogglePlan:Le[36]||(Le[36]=Ge=>p(o).togglePlanMode()),onToggleSwarm:Le[37]||(Le[37]=Ge=>p(o).toggleSwarmMode()),onToggleGoal:Le[38]||(Le[38]=Ge=>p(o).toggleGoalMode()),onCreateGoal:Le[39]||(Le[39]=Ge=>p(o).createGoal(Ge)),onControlGoal:Le[40]||(Le[40]=Ge=>p(o).controlGoal(Ge)),onRefreshGitStatus:Le[41]||(Le[41]=Ge=>p(o).activeSessionId.value&&p(o).loadGitStatus(p(o).activeSessionId.value)),onRenameSession:Le[42]||(Le[42]=(Ge,Xt)=>p(o).renameSession(Ge,Xt)),onForkSession:Le[43]||(Le[43]=Ge=>p(o).forkSession(Ge)),onArchiveSession:Le[44]||(Le[44]=Ge=>uo(Ge)),onExportSession:Le[45]||(Le[45]=Ge=>p(o).exportSession(Ge)),onCompact:Le[46]||(Le[46]=Ge=>p(o).compact()),onPickModel:Le[47]||(Le[47]=Ge=>Ks()),onSelectModel:Le[48]||(Le[48]=Ge=>yo(Ge)),onOpenFile:Le[49]||(Le[49]=Ge=>p(H)(Ge)),onOpenMedia:Le[50]||(Le[50]=Ge=>p(O)(Ge)),onOpenTurnDiff:Le[51]||(Le[51]=Ge=>p(zt)(Ge)),onOpenCompaction:Le[52]||(Le[52]=Ge=>p(ee)(Ge)),onOpenAgent:Le[53]||(Le[53]=Ge=>p(Ye)(Ge)),onEditMessage:zo},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","auth-ready","managed-signed-in","managed-membership","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","overlay-open","turn-active","queued","search-files","upload-image","working","last-turn-reason","turn-error","turn-retry","starting","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr"]),!p(a)&&(p(uc)||p(le))?(b(),me(p(gn),{key:2,class:"sidebar-toggle-btn",size:"sm",label:p(le)?p(i)("sidebar.expandSidebar"):p(i)("sidebar.collapseSidebar"),onClick:p(pe)},{default:ke(()=>[V(p(Ie),{name:p(le)?"panel-expand":"panel-collapse"},null,8,["name"])]),_:1},8,["label","onClick"])):te("",!0),!p(a)&&p(le)?(b(),me(p(gn),{key:3,class:"new-chat-btn",size:"sm",label:p(i)("sidebar.newChat"),onClick:ho},{default:ke(()=>[V(p(Ie),{name:"chat-new"})]),_:1},8,["label"])):te("",!0),p(Sn)&&!p(a)?(b(),me($x,{key:4,class:"preview-handle","storage-key":p(oe),"default-width":p(G),min:p(ve),max:p(X),reverse:"","aria-label":p(i)("layout.resizePreviewAria"),"apply-live":Kt,"onUpdate:width":Le[54]||(Le[54]=Ge=>fe.value=Ge),"onUpdate:dragging":Le[55]||(Le[55]=Ge=>to.value=Ge)},null,8,["storage-key","default-width","min","max","aria-label"])):te("",!0),!p(a)||p(Sn)?(b(),A("aside",{key:5,ref_key:"previewPanelEl",ref:ao,class:Re(["global-preview",{open:p(Sn),mobile:p(a)}]),role:"complementary","aria-label":p(i)("layout.detailPanelAria"),"aria-hidden":!p(Sn)},[S.value==="compaction"&&p(Q)?(b(),me(S$e,{key:0,text:p(ge)??"",subtitle:p(i)("conversation.summaryTitle"),onClose:p(ce)},null,8,["text","subtitle","onClose"])):S.value==="agent"&&p(ue)?(b(),me($$e,{key:1,member:p(ue),turns:p(Se),running:p(Oe),loading:p(Ue),"load-error":p(_e),"has-more":p(Fe),"loading-more":p(Te),"load-more-error":p(st),onClose:p(ft),onLoadOlderMessages:p($t),onOpenAgent:p(Ye),onOpenFile:p(H),onOpenMedia:p(O),onOpenTurnDiff:Le[56]||(Le[56]=Ge=>p(zt)(Ge))},null,8,["member","turns","running","loading","load-error","has-more","loading-more","load-more-error","onClose","onLoadOlderMessages","onOpenAgent","onOpenFile","onOpenMedia"])):S.value==="btw"&&p(tn)?(b(),me(H$e,{key:2,turns:p(o).sideChatTurns.value,running:p(o).sideChatRunning.value,sending:p(o).sideChatSending.value,onSend:Le[57]||(Le[57]=Ge=>p(o).sendSideChatPrompt(Ge)),onClose:p(fn)},null,8,["turns","running","sending","onClose"])):S.value==="diff"?(b(),me(hNe,{key:3,mode:p(Ht),changes:p(o).changes.value,"git-info":p(o).gitInfo.value,"file-diff":p(o).fileDiff.value,"full-texts":p(o).fileDiffTexts.value,"empty-file":p(o).fileDiffEmptyFile.value,"selected-diff-path":p(o).selectedDiffPath.value,"file-diff-loading":p(o).fileDiffLoading.value,closable:"",onOpen:p(Ke),onBack:Le[58]||(Le[58]=Ge=>{Ht.value="list",Yt.value=null,p(o).clearFileDiff()}),onClose:p(je)},null,8,["mode","changes","git-info","file-diff","full-texts","empty-file","selected-diff-path","file-diff-loading","onOpen","onClose"])):S.value==="file"?(b(),me(w$e,{key:4,file:p(P),loading:p(D),error:p(T),line:p(I)?.line,"download-url":p(L),closable:"","external-actions":p(B),"open-file":p(H),onClose:p(F),onOpenExternal:p(W),onReveal:p(z)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):S.value==="turn-diff"&&p(Ze)?(b(),me(bNe,{key:5,change:p(Ze),cwd:p(o).status.value.cwd,closable:"",onClose:p(at),onOpenFile:Le[59]||(Le[59]=Ge=>p(H)({path:Ge}))},null,8,["change","cwd","onClose"])):te("",!0)],10,GUe)):te("",!0),V(qUe,{class:"internal-build-fab"}),Po.value?(b(),me(ONe,{key:6,models:p(o).models.value,current:p(o).status.value.modelId,"starred-ids":p(o).starredModelIds.value,loading:ai.value,unavailable:Tn.value,onSelect:Le[60]||(Le[60]=Ge=>$s(Ge)),onToggleStar:Le[61]||(Le[61]=Ge=>p(o).toggleStarModel(Ge)),onClose:Le[62]||(Le[62]=Ge=>Po.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):te("",!0),po.value?(b(),me(KDe,{key:7,"color-scheme":p(o).colorScheme.value,"font-scale":p(o).fontScale.value,"managed-provider-status":p(o).managedProviderStatus.value,"managed-user-info":p(o).managedUserInfo.value,"on-fetch-usage":p(o).getUsage,notify:p(o).notifyEnabled.value,"notify-permission":p(o).notifyPermission.value,"notify-sound":p(o).notifySound.value,config:p(o).config.value,models:p(o).models.value,"config-saving":no.value,"server-version":p(o).serverVersion.value,backend:p(o).backend.value,"experimental-flags":p(o).experimentalFlags.value,"initial-tab":co.value,onSetColorScheme:Le[63]||(Le[63]=Ge=>p(o).setColorScheme(Ge)),onSetFontScale:Le[64]||(Le[64]=Ge=>p(o).setFontScale(Ge)),onSetNotify:Le[65]||(Le[65]=Ge=>p(o).setNotifyEnabled(Ge)),onSetNotifySound:Le[66]||(Le[66]=Ge=>p(o).setNotifySound(Ge)),onUpdateConfig:Le[67]||(Le[67]=Ge=>en(Ge)),onLogin:Le[68]||(Le[68]=()=>{po.value=!1,ps()}),onLogout:ui,onClose:Le[69]||(Le[69]=Ge=>{po.value=!1,co.value=void 0})},null,8,["color-scheme","font-scale","managed-provider-status","managed-user-info","on-fetch-usage","notify","notify-permission","notify-sound","config","models","config-saving","server-version","backend","experimental-flags","initial-tab"])):te("",!0),Do.value?(b(),me(FBe,{key:8,status:p(o).status.value,thinking:w.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"cost-usd":p(o).sessionCost.value,onClose:Le[70]||(Le[70]=Ge=>Do.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):te("",!0),bn.value?(b(),me(yBe,{key:9,"browse-fs":p(o).browseFs,"get-fs-home":p(o).getFsHome,"default-path":p(o).visibleWorkspace.value?.root??p(o).status.value.cwd,error:Bo.value,onAdd:Le[71]||(Le[71]=Ge=>Il(Ge)),onClose:cr},null,8,["browse-fs","get-fs-home","default-path","error"])):te("",!0),V(as,{name:"gload-fade"},{default:ke(()=>[p(o).initialized.value?te("",!0):(b(),me(UWe,{key:0,issue:p(o).connectIssue.value},null,8,["issue"]))]),_:1}),V(HBe,{warnings:p(o).warnings.value,onDismiss:p(o).dismissWarning},null,8,["warnings","onDismiss"]),(b(),me(Zr,{to:"body"},[V(as,{name:"action-toast"},{default:ke(()=>[oo.value?(b(),me(p(Lz),{key:oo.value.id,onDismiss:Le[72]||(Le[72]=Ge=>oo.value=null)},{default:ke(()=>[C("button",{type:"button",onClick:Xn},N(p(i)("sidebar.archiveToastUndo")),1),Ve(" "+N(p(i)("sidebar.archiveToastMid"))+" ",1),C("button",{type:"button",onClick:it},N(p(i)("sidebar.archiveToastSettings")),1),Ve(" "+N(p(i)("sidebar.archiveToastTail")),1)]),_:1})):te("",!0)]),_:1})])),p(l)?(b(),me(kUe,{key:10})):te("",!0),V(wBe),p(a)?(b(),me(bHe,{key:11,modelValue:u.value,"onUpdate:modelValue":Le[73]||(Le[73]=Ge=>u.value=Ge),groups:p(o).mobileWorkspaceGroups.value,"active-workspace-id":p(o).activeWorkspaceId.value,"active-id":p(o).activeSessionId.value,"attention-by-session":p(o).attentionBySession.value,"attention-by-workspace":p(o).attentionByWorkspace.value,onSelect:Le[74]||(Le[74]=Ge=>p(o).selectSession(Ge)),onCreate:ho,onCreateInWorkspace:Le[75]||(Le[75]=Ge=>ko(Ge)),onAddWorkspace:Le[76]||(Le[76]=Ge=>bn.value=!0),onRename:Le[77]||(Le[77]=(Ge,Xt)=>p(o).renameSession(Ge,Xt)),onArchive:Le[78]||(Le[78]=Ge=>uo(Ge)),onDeleteWorkspace:Le[79]||(Le[79]=Ge=>Ct(Ge)),onLoadMore:Le[80]||(Le[80]=Ge=>void p(o).loadMoreSessions(Ge))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):te("",!0),p(a)?(b(),me(Eze,{key:12,modelValue:c.value,"onUpdate:modelValue":Le[81]||(Le[81]=Ge=>c.value=Ge),"initial-view":Qe.value,status:p(o).status.value,thinking:p(o).thinking.value,models:p(o).models.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"color-scheme":p(o).colorScheme.value,"font-scale":p(o).fontScale.value,"managed-provider-status":p(o).managedProviderStatus.value,"managed-user-info":p(o).managedUserInfo.value,"server-version":p(o).serverVersion.value,onPickModel:Le[82]||(Le[82]=Ge=>Ks()),onSetThinking:Le[83]||(Le[83]=Ge=>p(o).setThinking(Ge)),onTogglePlan:Le[84]||(Le[84]=Ge=>p(o).togglePlanMode()),onToggleSwarm:Le[85]||(Le[85]=Ge=>p(o).toggleSwarmMode()),onSetPermission:Le[86]||(Le[86]=Ge=>p(o).setPermission(Ge)),onSetColorScheme:Le[87]||(Le[87]=Ge=>p(o).setColorScheme(Ge)),onSetFontScale:Le[88]||(Le[88]=Ge=>p(o).setFontScale(Ge)),onLogin:Le[89]||(Le[89]=()=>{c.value=!1,ps()}),onLogout:ui},null,8,["modelValue","initial-view","status","thinking","models","plan-mode","swarm-mode","color-scheme","font-scale","managed-provider-status","managed-user-info","server-version"])):te("",!0)],10,ZUe),p(o).initialized.value&&_.value?(b(),me(DWe,{key:1,"auth-ready":p(o).managedProviderStatus.value==="authenticated","on-start-o-auth-login":yn,"on-poll-o-auth-login":Ho,"on-cancel-o-auth-login":Eo,onComplete:v,onLoginSuccess:Zs,onAddProvider:k},null,8,["auth-ready"])):te("",!0),Mn.value?(b(),me(rFe,{key:2,"on-start-o-auth-login":yn,"on-poll-o-auth-login":Ho,"on-cancel-o-auth-login":Eo,onSuccess:Io,onClose:Le[90]||(Le[90]=Ge=>Mn.value=!1)})):te("",!0)]))}}),XUe=ht(YUe,[["__scopeId","data-v-d4e01871"]]);sfe();const j2=Im(XUe).use(Wn),JUe={t:(e,t)=>Wn.global.t(e,t)};j2.provide(LM,JUe);j2.provide($M,e=>p2e(e)?.component);j2.provide(KG,hu());j2.mount("#app");if(N2){const e=window.kimiDesktop;if(e){const t=()=>{const n=document.documentElement.dataset.colorScheme;e.setTheme(n==="light"||n==="dark"?n:"system")};new MutationObserver(t).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),t()}}export{SR as $,cA as A,hO as B,rs as C,Zje as D,MS as E,Pe as F,Ac as G,Ve as H,V as I,ZR as J,kje as K,zr as L,tt as M,VP as N,_je as O,xje as P,Mje as Q,dm as R,Pd as S,Zr as T,Sje as U,Zy as V,wje as W,Yje as X,Aje as Y,Uje as Z,QUe as _,oA as a,ys as a$,ds as a0,Zg as a1,rje as a2,Py as a3,FA as a4,nn as a5,hf as a6,fje as a7,Qje as a8,mje as a9,aA,EO as aB,RO as aC,dn as aD,FO as aE,NO as aF,pf as aG,$O as aH,kn as aI,Dp as aJ,QR as aK,b as aL,WP as aM,cje as aN,En as aO,VS as aP,uje as aQ,mm as aR,Jo as aS,L4 as aT,Z as aU,Pje as aV,rD as aW,pt as aX,Cn as aY,PO as aZ,bje as a_,yje as aa,vje as ab,gje as ac,Bje as ad,eVe as ae,on as af,kP as ag,Qg as ah,Wa as ai,ra as aj,es as ak,Dje as al,Qi as am,Ga as an,kt as ao,Ije as ap,Lje as aq,Dn as ar,yt as as,xP as at,Re as au,bR as av,Gt as aw,TO as ax,LO as ay,Un as az,aje as b,Gle as b$,qje as b0,up as b1,wm as b2,jje as b3,Za as b4,US as b5,tje as b6,Xr as b7,rO as b8,Vje as b9,ri as bA,Es as bB,bP as bC,zje as bD,et as bE,JS as bF,pje as bG,aO as bH,Nje as bI,ke as bJ,Tje as bK,In as bL,xl as bM,Hje as bN,Et as bO,dje as bP,Kn as bQ,Go as bR,iVe as bS,rVe as bT,_L as bU,lVe as bV,hle as bW,wL as bX,F3 as bY,dVe as bZ,Jle as b_,eje as ba,N as bb,Fh as bc,Cje as bd,Rn as be,oje as bf,nje as bg,Rh as bh,Oje as bi,VR as bj,p as bk,mf as bl,Jje as bm,Gje as bn,KP as bo,mO as bp,Fje as bq,lO as br,Xje as bs,Eje as bt,hje as bu,nA as bv,Em as bw,tD as bx,YA as by,q4 as bz,Wje as c,p5 as c0,d5 as c1,f5 as c2,pVe as c3,ig as c4,Td as c5,og as c6,Vle as c7,qle as c8,hVe as c9,UCe as cA,ht as cB,fVe as ca,nVe as cb,mVe as cc,M2 as cd,Ri as ce,aae as cf,lae as cg,lle as ch,sVe as ci,ole as cj,sle as ck,oVe as cl,h5 as cm,uae as cn,e_ as co,Fw as cp,gle as cq,sg as cr,ng as cs,aVe as ct,cVe as cu,tVe as cv,uVe as cw,Ie as cx,gVe as cy,KN as cz,Rje as d,Ua as e,sje as f,as as g,ZA as h,ije as i,lje as j,_r as k,Rp as l,Cs as m,jg as n,la as o,Kje as p,R as q,Im as r,me as s,te as t,A as u,C as v,iP as w,$je as x,sP as y,lD as z}; diff --git a/apps/kimi-code/dist-web/assets/index-B2KLv33G.js b/apps/kimi-code/dist-web/assets/index-ZmzTmhry.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index-B2KLv33G.js rename to apps/kimi-code/dist-web/assets/index-ZmzTmhry.js index 01bbabe2cd4..68d0a62c816 100644 --- a/apps/kimi-code/dist-web/assets/index-B2KLv33G.js +++ b/apps/kimi-code/dist-web/assets/index-ZmzTmhry.js @@ -1,4 +1,4 @@ -import{t as pe,b as Ln,n as Or,c as Nr,a as Fr,d as zr,s as Ur,g as Vr,e as Br}from"./index-V37-dq86.js";import{f as Ld}from"./index-V37-dq86.js";import{bR as k}from"./index-HRJ6xRtC.js";const Ei="diffs-container",$r=(()=>{try{return!1}catch{return!1}})(),Wr=/(?=^From [a-f0-9]+ .+$)/m,Ti=/(?=^diff --git)/gm,Ul=/(?=^---\s+\S)/gm,Vl=/(?=^@@ )/gm,Gr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,jr=/(?<=\n)/,qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Bl=/^<{7,}(?:\s.*)?$/,$l=/^\|{7,}(?:\s.*)?$/,Wl=/^={7,}$/,Gl=/^>{7,}(?:\s.*)?$/,on="header-prefix",sn="header-metadata",an="header-custom",_={dark:"pierre-dark",light:"pierre-light"},Ii="data-theme-css",Ri="data-unsafe-css",Qr="data-core-css",Jr="data-diffs-scrollbar-measure",Ai="--diffs-scrollbar-gutter-measured",jl=1,Zr=1e5,ln={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},_e={...ln,hunkLineCount:1},eo={paddingTop:8,paddingBottom:8,gap:8},to={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},no=Object.freeze({fromStart:0,fromEnd:0}),Ae={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Hi={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ie=new Set;let Re=null;function Y(e){Ie.add(e),Re??=requestAnimationFrame(Mi)}function io(e){Ie.delete(e),Ie.size===0&&Re!=null&&(cancelAnimationFrame(Re),Re=null)}function Mi(e){const t=new Set(Ie);Ie.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ie.size>0?Re=requestAnimationFrame(Mi):Re=null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function De(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function dn(e,t){const n=e?.theme??_,i=t?.theme??_,r=kn(e),o=kn(t);return De(n,i)&&He(e,t,["theme","parseDiffOptions"])&&He(r,o)}function kn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Wt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(e){return{type:"text",value:e}}function A({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function pt({name:e,width:t=16,height:n=16,properties:i}){return A({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[A({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function oo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ee(e){return A({tagName:"div",properties:{"data-gutter":""},children:e})}function Di(e,t,n,i={}){return A({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[A({tagName:"span",properties:{"data-line-number-content":""},children:[W(`${t}`)]})]:void 0})}function j(e,t,n){return A({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function so(){return A({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[pt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ao(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Pi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Wt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&et(e.composedPath())||(he(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(he(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(he(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){he(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();he(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);he(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const g=Tt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Tt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(co(r)&&f!=null){f(r);break}if(ho(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Tt(r))break;ut(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:g}=this.options,b=g!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||b;y&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,he(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const m=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",p=this.pointerSession.mode==="gutterSelecting";(!f&&m||!b&&p)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();et(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(ao(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=pe(so());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Ve(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Ze(r));if(Ve(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Ve(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Ve(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&et(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Ze(e);if(t&&et(n))return;const i=fo(e);return i!=null?Ze(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=go(po(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Ze(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Wt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;cs)break;if(g==null||gNumber.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ke({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p},C,v,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:lo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p,getLineIndex:v}}function lo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Ve(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function Tt(e){return Ve(e)||ut(e)}function ho(e){return"type"in e&&e.type==="line-info"}function co(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function wn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ze(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function po(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function go(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function Tn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function In(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function et(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function he(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var _i=class ue{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ue.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let g=o.get(u);if(g!=null){this.observedNodes.set(u,g),this.observedNodes.set(f,g),o.delete(u),o.delete(f);continue}const b=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;g={type:"annotations",column1:{container:h,child:u,childHeight:b},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:g,newHeight:Math.max(b,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?bo(l):Co(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ue,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ue,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?mo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?vo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function mo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function vo(e){return Math.max(Math.ceil(e),0)}function bo(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const Se=new Map,It=new Map,jt=new Map,gt=new Set;function mt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!gt.has(t))return!1;return!0}function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(gt.has(n.name))continue;let i=Se.get(n.name);i==null&&(i=n,Se.set(n.name,i)),gt.add(i.name),t.loadLanguageSync(i.data)}}function So(){Se.clear(),gt.clear()}function Oi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Ni(e){if(Oi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=It.get(e);if(t!=null)return t;try{let n=jt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Ln,e)&&(n=Ln[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Se.has(e)||Se.set(e,o),o});return It.set(e,i),await i}finally{It.delete(e)}}function Fi(e){return Se.get(e)??Ni(e)}const vt=new Set;function Ye(e){const t=[],n=new Set;for(const c of yo(e.themes)){const u=zi(c)?c.getThemes():[c];for(const f of u){if(n.has(f.name))throw new Error(`Theme collection already contains theme "${f.name}"`);n.add(f.name),t.push(f)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),d=Object.freeze(o.map(c=>c.name));function h(c){if(c==null)return i;const{colorScheme:u,collection:f}=c;return f==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==f?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return h(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?d:l:h(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return Ye({themes:i.map((u,f)=>({descriptor:u,index:f})).sort((u,f)=>{const g=c(u.descriptor,f.descriptor);return g!==0?g:u.index-f.index}).map(u=>u.descriptor)})},pick(c){const u=[],f=new Set;for(const g of c){if(f.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);f.add(g);const b=s.get(g);if(b==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(b)}return Ye({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function yo(e){return xo(e)?[e]:e}function xo(e){return zi(e)||Lo(e)}function Lo(e){return typeof e.name=="string"&&typeof e.load=="function"}function zi(e){return typeof e.getThemes=="function"}function Ui(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Vi=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ko=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(){const e=new Map,t=new Map,n=new Map;let i=0;function r(m,p){if(e.has(m))throw new Vi(m);e.set(m,p)}function o(m,p){return e.has(m)?!1:(e.set(m,p),!0)}function s(m){return e.has(m)}function l(m){const p=t.get(m);if(p!==void 0)return Promise.resolve(p);const C=n.get(m);if(C!==void 0)return C;const v=e.get(m);if(v===void 0)return Promise.reject(new ko(m));const x=i,S=v().then(L=>{const E=Ui(L);return x===i&&t.set(m,E),n.get(m)===S&&n.delete(m),E}).catch(L=>{throw n.get(m)===S&&n.delete(m),L});return n.set(m,S),S}function a(m){return Promise.all(m.map(p=>l(p)))}function d(m,p){t.set(m,p)}function h(m){for(const[p,C]of m)d(p,C)}function c(m){return t.get(m)}function u(m){const p=[];for(const C of m){const v=t.get(C);if(v===void 0)throw new wo(C);p.push(v)}return p}function f(m){return t.has(m)}function g(m){for(const p of m)if(!t.has(p))return!1;return!0}function b(m){const p=t.get(m);return p!==void 0?p:l(m)}function y(){i++,t.clear(),n.clear()}return{clearResolvedThemes:y,getResolvedOrResolveTheme:b,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:f,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:d,seedResolvedThemes:h}}const X=Eo();function An(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=X.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,X.getResolvedTheme(n)==null&&X.seedResolvedTheme(n,i);vt.has(n)||(vt.add(n),t.loadThemeSync(i))}}function To(){X.clearResolvedThemes(),vt.clear()}function hn({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Io(t)}}function Io(e){return async()=>Or(Ui(await e()))}const Ro="pierre",Ao=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Bi=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Ho=[...Bi,...Ao],Mo=new Set(Bi);function Do(e){return Mo.has(e)?"light":"dark"}const Po={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},_o={"pierre-dark":()=>k(()=>import("./pierre-dark-CyvmCCZW.js"),[]),"pierre-dark-soft":()=>k(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[]),"pierre-dark-vibrant":()=>k(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[]),"pierre-dark-tritanopia":()=>k(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[]),"pierre-light":()=>k(()=>import("./pierre-light-480U9XYS.js"),[]),"pierre-light-soft":()=>k(()=>import("./pierre-light-soft-CVdyfjmI.js"),[]),"pierre-light-vibrant":()=>k(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[]),"pierre-light-tritanopia":()=>k(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[])};function Oo(e){return hn({name:e,collection:Ro,colorScheme:Do(e),displayName:Po[e],load:_o[e]})}const $i=Ye({themes:Ho.map(e=>Oo(e))}),No="shiki",Wi=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Fo=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],zo=new Set(Wi);function Uo(e){return zo.has(e)?"light":"dark"}const Vo={andromeeda:()=>k(()=>import("./andromeeda-C4gqWexZ.js"),[]),"aurora-x":()=>k(()=>import("./aurora-x-D-2ljcwZ.js"),[]),"ayu-dark":()=>k(()=>import("./ayu-dark-DYE7WIF3.js"),[]),"ayu-light":()=>k(()=>import("./ayu-light-BA47KaF1.js"),[]),"ayu-mirage":()=>k(()=>import("./ayu-mirage-32ctXXKs.js"),[]),"catppuccin-frappe":()=>k(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]),"catppuccin-latte":()=>k(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]),"catppuccin-macchiato":()=>k(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]),"catppuccin-mocha":()=>k(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]),"dark-plus":()=>k(()=>import("./dark-plus-C3mMm8J8.js"),[]),dracula:()=>k(()=>import("./dracula-BzJJZx-M.js"),[]),"dracula-soft":()=>k(()=>import("./dracula-soft-BXkSAIEj.js"),[]),"everforest-dark":()=>k(()=>import("./everforest-dark-BgDCqdQA.js"),[]),"everforest-light":()=>k(()=>import("./everforest-light-C8M2exoo.js"),[]),"github-dark":()=>k(()=>import("./github-dark-DHJKELXO.js"),[]),"github-dark-default":()=>k(()=>import("./github-dark-default-Cuk6v7N8.js"),[]),"github-dark-dimmed":()=>k(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]),"github-dark-high-contrast":()=>k(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]),"github-light":()=>k(()=>import("./github-light-DAi9KRSo.js"),[]),"github-light-default":()=>k(()=>import("./github-light-default-D7oLnXFd.js"),[]),"github-light-high-contrast":()=>k(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]),"gruvbox-dark-hard":()=>k(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]),"gruvbox-dark-medium":()=>k(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]),"gruvbox-dark-soft":()=>k(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]),"gruvbox-light-hard":()=>k(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]),"gruvbox-light-medium":()=>k(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]),"gruvbox-light-soft":()=>k(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]),horizon:()=>k(()=>import("./horizon-BUw7H-hv.js"),[]),"horizon-bright":()=>k(()=>import("./horizon-bright-CUuTKBJd.js"),[]),houston:()=>k(()=>import("./houston-DnULxvSX.js"),[]),"kanagawa-dragon":()=>k(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]),"kanagawa-lotus":()=>k(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]),"kanagawa-wave":()=>k(()=>import("./kanagawa-wave-DWedfzmr.js"),[]),laserwave:()=>k(()=>import("./laserwave-DUszq2jm.js"),[]),"light-plus":()=>k(()=>import("./light-plus-B7mTdjB0.js"),[]),"material-theme":()=>k(()=>import("./material-theme-D5KoaKCx.js"),[]),"material-theme-darker":()=>k(()=>import("./material-theme-darker-BfHTSMKl.js"),[]),"material-theme-lighter":()=>k(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]),"material-theme-ocean":()=>k(()=>import("./material-theme-ocean-CyktbL80.js"),[]),"material-theme-palenight":()=>k(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]),"min-dark":()=>k(()=>import("./min-dark-CafNBF8u.js"),[]),"min-light":()=>k(()=>import("./min-light-CTRr51gU.js"),[]),monokai:()=>k(()=>import("./monokai-D4h5O-jR.js"),[]),"night-owl":()=>k(()=>import("./night-owl-C39BiMTA.js"),[]),"night-owl-light":()=>k(()=>import("./night-owl-light-CMTm3GFP.js"),[]),nord:()=>k(()=>import("./nord-Ddv68eIx.js"),[]),"one-dark-pro":()=>k(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]),"one-light":()=>k(()=>import("./one-light-C3Wv6jpd.js"),[]),plastic:()=>k(()=>import("./plastic-3e1v2bzS.js"),[]),poimandres:()=>k(()=>import("./poimandres-CS3Unz2-.js"),[]),red:()=>k(()=>import("./red-bN70gL4F.js"),[]),"rose-pine":()=>k(()=>import("./rose-pine-qdsjHGoJ.js"),[]),"rose-pine-dawn":()=>k(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]),"rose-pine-moon":()=>k(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]),"slack-dark":()=>k(()=>import("./slack-dark-BthQWCQV.js"),[]),"slack-ochin":()=>k(()=>import("./slack-ochin-DqwNpetd.js"),[]),"snazzy-light":()=>k(()=>import("./snazzy-light-Bw305WKR.js"),[]),"solarized-dark":()=>k(()=>import("./solarized-dark-DXbdFlpD.js"),[]),"solarized-light":()=>k(()=>import("./solarized-light-L9t79GZl.js"),[]),"synthwave-84":()=>k(()=>import("./synthwave-84-CbfX1IO0.js"),[]),"tokyo-night":()=>k(()=>import("./tokyo-night-hegEt444.js"),[]),vesper:()=>k(()=>import("./vesper-DRje8inN.js"),[]),"vitesse-black":()=>k(()=>import("./vitesse-black-Bkuqu6BP.js"),[]),"vitesse-dark":()=>k(()=>import("./vitesse-dark-D0r3Knsf.js"),[]),"vitesse-light":()=>k(()=>import("./vitesse-light-CVO1_9PV.js"),[])};function Hn(e){return hn({name:e,collection:No,colorScheme:Uo(e),load:Vo[e]})}const Gi=Ye({themes:Object.freeze([...Wi.map(e=>Hn(e)),...Fo.map(e=>Hn(e))])});Ye({themes:[$i,Gi]});function ji(e){if(Oi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(X.hasRegisteredTheme(e))return;const t=Gi.getTheme(e);if(t!=null){X.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function qi(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Bo(e){ji(e);const t=await X.resolveTheme(e);return qi(e,t),t}function $o(e){return X.getResolvedTheme(e)??Bo(e)}let $;async function xt({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=Nr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fr(k(()=>import("./wasm-CG6Dc4jp.js"),[])):zr()});const i=Wo($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Fi(s);"then"in l?r.push(l):Rn(l,i)}const o=[];for(const s of e){const l=$o(s);"then"in l?o.push(l):An(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{Rn(s,i)}),Promise.all(o).then(s=>{An(s,i)})]),i}function ql(e=$){return e!=null&&!("then"in e)}function Ki(){if($!=null&&!("then"in $))return $}function Wo(e=$){return e!=null&&"then"in e}function Kl(e=$){return e==null}async function Yl(e){await xt(e)}async function Xl(){$!=null&&((await $).dispose(),So(),To(),$=void 0)}for(const e of $i.getThemes())X.registerThemeIfAbsent(e.name,e.load);function cn(e=_){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Ge(e){for(const t of cn(e))if(!vt.has(t))return!1;return!0}function Go(e){return X.hasResolvedThemes(e)}function Oe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ae(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lt(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function qt(e){return A({tagName:"div",children:[A({tagName:"div",children:e.annotations?.map(t=>A({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jo(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Yi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return A({tagName:"div",children:[t==="custom"?A({tagName:"slot",properties:{name:an}}):qo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Ko(i)]],properties:r})}function qo({name:e,prevName:t,iconType:n}){const i=[A({tagName:"slot",properties:{name:on}}),pt({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(t)]})],properties:{"data-prev-name":""}})),i.push(pt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(e)]})],properties:{"data-title":""}})),A({tagName:"div",children:i,properties:{"data-header-content":""}})}function Ko(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(A({tagName:"span",children:[W(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(A({tagName:"span",children:[W(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(A({tagName:"slot",properties:{name:sn}})),A({tagName:"div",children:t,properties:{"data-metadata":""}})}function Xi(e){return A({tagName:"pre",properties:Yo(e)})}function Yo({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Z=new Map;let bt=0;const Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Q(e){if(Z.has(e))return Z.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z.has(t[1]))return Z.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Z.has(n)?Z.get(n)??"text":Ne[n]??"text"}function Ql(e,t){if(e<=bt)return!1;Z.clear();for(const n in t){const i=t[n];i!=null&&Z.set(n,i)}return bt=e,!0}function Jl(){return bt}function Xo(e,t){const n=Z.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),Z.set(e,t),bt++,!0)}function Zl(){return Object.fromEntries(Z)}function un(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:cn(t),preferredHighlighter:n}}function ge(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function xe(e){return e.replace(/\n$|\r\n$/,"")}function Qo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(W(` +import{t as pe,b as Ln,n as Or,c as Nr,a as Fr,d as zr,s as Ur,g as Vr,e as Br}from"./index-BZFTzQ6y.js";import{f as Ld}from"./index-BZFTzQ6y.js";import{bR as k}from"./index-D-7nOosq.js";const Ei="diffs-container",$r=(()=>{try{return!1}catch{return!1}})(),Wr=/(?=^From [a-f0-9]+ .+$)/m,Ti=/(?=^diff --git)/gm,Ul=/(?=^---\s+\S)/gm,Vl=/(?=^@@ )/gm,Gr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,jr=/(?<=\n)/,qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Bl=/^<{7,}(?:\s.*)?$/,$l=/^\|{7,}(?:\s.*)?$/,Wl=/^={7,}$/,Gl=/^>{7,}(?:\s.*)?$/,on="header-prefix",sn="header-metadata",an="header-custom",_={dark:"pierre-dark",light:"pierre-light"},Ii="data-theme-css",Ri="data-unsafe-css",Qr="data-core-css",Jr="data-diffs-scrollbar-measure",Ai="--diffs-scrollbar-gutter-measured",jl=1,Zr=1e5,ln={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},_e={...ln,hunkLineCount:1},eo={paddingTop:8,paddingBottom:8,gap:8},to={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},no=Object.freeze({fromStart:0,fromEnd:0}),Ae={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Hi={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ie=new Set;let Re=null;function Y(e){Ie.add(e),Re??=requestAnimationFrame(Mi)}function io(e){Ie.delete(e),Ie.size===0&&Re!=null&&(cancelAnimationFrame(Re),Re=null)}function Mi(e){const t=new Set(Ie);Ie.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ie.size>0?Re=requestAnimationFrame(Mi):Re=null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function De(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function dn(e,t){const n=e?.theme??_,i=t?.theme??_,r=kn(e),o=kn(t);return De(n,i)&&He(e,t,["theme","parseDiffOptions"])&&He(r,o)}function kn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Wt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(e){return{type:"text",value:e}}function A({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function pt({name:e,width:t=16,height:n=16,properties:i}){return A({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[A({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function oo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ee(e){return A({tagName:"div",properties:{"data-gutter":""},children:e})}function Di(e,t,n,i={}){return A({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[A({tagName:"span",properties:{"data-line-number-content":""},children:[W(`${t}`)]})]:void 0})}function j(e,t,n){return A({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function so(){return A({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[pt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ao(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Pi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Wt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&et(e.composedPath())||(he(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(he(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(he(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){he(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();he(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);he(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const g=Tt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Tt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(co(r)&&f!=null){f(r);break}if(ho(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Tt(r))break;ut(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:g}=this.options,b=g!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||b;y&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,he(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const m=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",p=this.pointerSession.mode==="gutterSelecting";(!f&&m||!b&&p)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();et(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(ao(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=pe(so());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Ve(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Ze(r));if(Ve(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Ve(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Ve(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&et(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Ze(e);if(t&&et(n))return;const i=fo(e);return i!=null?Ze(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=go(po(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Ze(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Wt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;cs)break;if(g==null||gNumber.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ke({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p},C,v,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:lo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p,getLineIndex:v}}function lo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Ve(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function Tt(e){return Ve(e)||ut(e)}function ho(e){return"type"in e&&e.type==="line-info"}function co(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function wn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ze(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function po(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function go(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function Tn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function In(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function et(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function he(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var _i=class ue{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ue.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let g=o.get(u);if(g!=null){this.observedNodes.set(u,g),this.observedNodes.set(f,g),o.delete(u),o.delete(f);continue}const b=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;g={type:"annotations",column1:{container:h,child:u,childHeight:b},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:g,newHeight:Math.max(b,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?bo(l):Co(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ue,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ue,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?mo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?vo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function mo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function vo(e){return Math.max(Math.ceil(e),0)}function bo(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const Se=new Map,It=new Map,jt=new Map,gt=new Set;function mt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!gt.has(t))return!1;return!0}function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(gt.has(n.name))continue;let i=Se.get(n.name);i==null&&(i=n,Se.set(n.name,i)),gt.add(i.name),t.loadLanguageSync(i.data)}}function So(){Se.clear(),gt.clear()}function Oi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Ni(e){if(Oi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=It.get(e);if(t!=null)return t;try{let n=jt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Ln,e)&&(n=Ln[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Se.has(e)||Se.set(e,o),o});return It.set(e,i),await i}finally{It.delete(e)}}function Fi(e){return Se.get(e)??Ni(e)}const vt=new Set;function Ye(e){const t=[],n=new Set;for(const c of yo(e.themes)){const u=zi(c)?c.getThemes():[c];for(const f of u){if(n.has(f.name))throw new Error(`Theme collection already contains theme "${f.name}"`);n.add(f.name),t.push(f)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),d=Object.freeze(o.map(c=>c.name));function h(c){if(c==null)return i;const{colorScheme:u,collection:f}=c;return f==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==f?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return h(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?d:l:h(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return Ye({themes:i.map((u,f)=>({descriptor:u,index:f})).sort((u,f)=>{const g=c(u.descriptor,f.descriptor);return g!==0?g:u.index-f.index}).map(u=>u.descriptor)})},pick(c){const u=[],f=new Set;for(const g of c){if(f.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);f.add(g);const b=s.get(g);if(b==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(b)}return Ye({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function yo(e){return xo(e)?[e]:e}function xo(e){return zi(e)||Lo(e)}function Lo(e){return typeof e.name=="string"&&typeof e.load=="function"}function zi(e){return typeof e.getThemes=="function"}function Ui(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Vi=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ko=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(){const e=new Map,t=new Map,n=new Map;let i=0;function r(m,p){if(e.has(m))throw new Vi(m);e.set(m,p)}function o(m,p){return e.has(m)?!1:(e.set(m,p),!0)}function s(m){return e.has(m)}function l(m){const p=t.get(m);if(p!==void 0)return Promise.resolve(p);const C=n.get(m);if(C!==void 0)return C;const v=e.get(m);if(v===void 0)return Promise.reject(new ko(m));const x=i,S=v().then(L=>{const E=Ui(L);return x===i&&t.set(m,E),n.get(m)===S&&n.delete(m),E}).catch(L=>{throw n.get(m)===S&&n.delete(m),L});return n.set(m,S),S}function a(m){return Promise.all(m.map(p=>l(p)))}function d(m,p){t.set(m,p)}function h(m){for(const[p,C]of m)d(p,C)}function c(m){return t.get(m)}function u(m){const p=[];for(const C of m){const v=t.get(C);if(v===void 0)throw new wo(C);p.push(v)}return p}function f(m){return t.has(m)}function g(m){for(const p of m)if(!t.has(p))return!1;return!0}function b(m){const p=t.get(m);return p!==void 0?p:l(m)}function y(){i++,t.clear(),n.clear()}return{clearResolvedThemes:y,getResolvedOrResolveTheme:b,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:f,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:d,seedResolvedThemes:h}}const X=Eo();function An(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=X.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,X.getResolvedTheme(n)==null&&X.seedResolvedTheme(n,i);vt.has(n)||(vt.add(n),t.loadThemeSync(i))}}function To(){X.clearResolvedThemes(),vt.clear()}function hn({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Io(t)}}function Io(e){return async()=>Or(Ui(await e()))}const Ro="pierre",Ao=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Bi=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Ho=[...Bi,...Ao],Mo=new Set(Bi);function Do(e){return Mo.has(e)?"light":"dark"}const Po={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},_o={"pierre-dark":()=>k(()=>import("./pierre-dark-CyvmCCZW.js"),[]),"pierre-dark-soft":()=>k(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[]),"pierre-dark-vibrant":()=>k(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[]),"pierre-dark-tritanopia":()=>k(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[]),"pierre-light":()=>k(()=>import("./pierre-light-480U9XYS.js"),[]),"pierre-light-soft":()=>k(()=>import("./pierre-light-soft-CVdyfjmI.js"),[]),"pierre-light-vibrant":()=>k(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[]),"pierre-light-tritanopia":()=>k(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[])};function Oo(e){return hn({name:e,collection:Ro,colorScheme:Do(e),displayName:Po[e],load:_o[e]})}const $i=Ye({themes:Ho.map(e=>Oo(e))}),No="shiki",Wi=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Fo=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],zo=new Set(Wi);function Uo(e){return zo.has(e)?"light":"dark"}const Vo={andromeeda:()=>k(()=>import("./andromeeda-C4gqWexZ.js"),[]),"aurora-x":()=>k(()=>import("./aurora-x-D-2ljcwZ.js"),[]),"ayu-dark":()=>k(()=>import("./ayu-dark-DYE7WIF3.js"),[]),"ayu-light":()=>k(()=>import("./ayu-light-BA47KaF1.js"),[]),"ayu-mirage":()=>k(()=>import("./ayu-mirage-32ctXXKs.js"),[]),"catppuccin-frappe":()=>k(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]),"catppuccin-latte":()=>k(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]),"catppuccin-macchiato":()=>k(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]),"catppuccin-mocha":()=>k(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]),"dark-plus":()=>k(()=>import("./dark-plus-C3mMm8J8.js"),[]),dracula:()=>k(()=>import("./dracula-BzJJZx-M.js"),[]),"dracula-soft":()=>k(()=>import("./dracula-soft-BXkSAIEj.js"),[]),"everforest-dark":()=>k(()=>import("./everforest-dark-BgDCqdQA.js"),[]),"everforest-light":()=>k(()=>import("./everforest-light-C8M2exoo.js"),[]),"github-dark":()=>k(()=>import("./github-dark-DHJKELXO.js"),[]),"github-dark-default":()=>k(()=>import("./github-dark-default-Cuk6v7N8.js"),[]),"github-dark-dimmed":()=>k(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]),"github-dark-high-contrast":()=>k(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]),"github-light":()=>k(()=>import("./github-light-DAi9KRSo.js"),[]),"github-light-default":()=>k(()=>import("./github-light-default-D7oLnXFd.js"),[]),"github-light-high-contrast":()=>k(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]),"gruvbox-dark-hard":()=>k(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]),"gruvbox-dark-medium":()=>k(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]),"gruvbox-dark-soft":()=>k(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]),"gruvbox-light-hard":()=>k(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]),"gruvbox-light-medium":()=>k(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]),"gruvbox-light-soft":()=>k(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]),horizon:()=>k(()=>import("./horizon-BUw7H-hv.js"),[]),"horizon-bright":()=>k(()=>import("./horizon-bright-CUuTKBJd.js"),[]),houston:()=>k(()=>import("./houston-DnULxvSX.js"),[]),"kanagawa-dragon":()=>k(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]),"kanagawa-lotus":()=>k(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]),"kanagawa-wave":()=>k(()=>import("./kanagawa-wave-DWedfzmr.js"),[]),laserwave:()=>k(()=>import("./laserwave-DUszq2jm.js"),[]),"light-plus":()=>k(()=>import("./light-plus-B7mTdjB0.js"),[]),"material-theme":()=>k(()=>import("./material-theme-D5KoaKCx.js"),[]),"material-theme-darker":()=>k(()=>import("./material-theme-darker-BfHTSMKl.js"),[]),"material-theme-lighter":()=>k(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]),"material-theme-ocean":()=>k(()=>import("./material-theme-ocean-CyktbL80.js"),[]),"material-theme-palenight":()=>k(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]),"min-dark":()=>k(()=>import("./min-dark-CafNBF8u.js"),[]),"min-light":()=>k(()=>import("./min-light-CTRr51gU.js"),[]),monokai:()=>k(()=>import("./monokai-D4h5O-jR.js"),[]),"night-owl":()=>k(()=>import("./night-owl-C39BiMTA.js"),[]),"night-owl-light":()=>k(()=>import("./night-owl-light-CMTm3GFP.js"),[]),nord:()=>k(()=>import("./nord-Ddv68eIx.js"),[]),"one-dark-pro":()=>k(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]),"one-light":()=>k(()=>import("./one-light-C3Wv6jpd.js"),[]),plastic:()=>k(()=>import("./plastic-3e1v2bzS.js"),[]),poimandres:()=>k(()=>import("./poimandres-CS3Unz2-.js"),[]),red:()=>k(()=>import("./red-bN70gL4F.js"),[]),"rose-pine":()=>k(()=>import("./rose-pine-qdsjHGoJ.js"),[]),"rose-pine-dawn":()=>k(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]),"rose-pine-moon":()=>k(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]),"slack-dark":()=>k(()=>import("./slack-dark-BthQWCQV.js"),[]),"slack-ochin":()=>k(()=>import("./slack-ochin-DqwNpetd.js"),[]),"snazzy-light":()=>k(()=>import("./snazzy-light-Bw305WKR.js"),[]),"solarized-dark":()=>k(()=>import("./solarized-dark-DXbdFlpD.js"),[]),"solarized-light":()=>k(()=>import("./solarized-light-L9t79GZl.js"),[]),"synthwave-84":()=>k(()=>import("./synthwave-84-CbfX1IO0.js"),[]),"tokyo-night":()=>k(()=>import("./tokyo-night-hegEt444.js"),[]),vesper:()=>k(()=>import("./vesper-DRje8inN.js"),[]),"vitesse-black":()=>k(()=>import("./vitesse-black-Bkuqu6BP.js"),[]),"vitesse-dark":()=>k(()=>import("./vitesse-dark-D0r3Knsf.js"),[]),"vitesse-light":()=>k(()=>import("./vitesse-light-CVO1_9PV.js"),[])};function Hn(e){return hn({name:e,collection:No,colorScheme:Uo(e),load:Vo[e]})}const Gi=Ye({themes:Object.freeze([...Wi.map(e=>Hn(e)),...Fo.map(e=>Hn(e))])});Ye({themes:[$i,Gi]});function ji(e){if(Oi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(X.hasRegisteredTheme(e))return;const t=Gi.getTheme(e);if(t!=null){X.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function qi(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Bo(e){ji(e);const t=await X.resolveTheme(e);return qi(e,t),t}function $o(e){return X.getResolvedTheme(e)??Bo(e)}let $;async function xt({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=Nr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fr(k(()=>import("./wasm-CG6Dc4jp.js"),[])):zr()});const i=Wo($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Fi(s);"then"in l?r.push(l):Rn(l,i)}const o=[];for(const s of e){const l=$o(s);"then"in l?o.push(l):An(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{Rn(s,i)}),Promise.all(o).then(s=>{An(s,i)})]),i}function ql(e=$){return e!=null&&!("then"in e)}function Ki(){if($!=null&&!("then"in $))return $}function Wo(e=$){return e!=null&&"then"in e}function Kl(e=$){return e==null}async function Yl(e){await xt(e)}async function Xl(){$!=null&&((await $).dispose(),So(),To(),$=void 0)}for(const e of $i.getThemes())X.registerThemeIfAbsent(e.name,e.load);function cn(e=_){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Ge(e){for(const t of cn(e))if(!vt.has(t))return!1;return!0}function Go(e){return X.hasResolvedThemes(e)}function Oe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ae(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lt(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function qt(e){return A({tagName:"div",children:[A({tagName:"div",children:e.annotations?.map(t=>A({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jo(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Yi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return A({tagName:"div",children:[t==="custom"?A({tagName:"slot",properties:{name:an}}):qo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Ko(i)]],properties:r})}function qo({name:e,prevName:t,iconType:n}){const i=[A({tagName:"slot",properties:{name:on}}),pt({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(t)]})],properties:{"data-prev-name":""}})),i.push(pt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(e)]})],properties:{"data-title":""}})),A({tagName:"div",children:i,properties:{"data-header-content":""}})}function Ko(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(A({tagName:"span",children:[W(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(A({tagName:"span",children:[W(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(A({tagName:"slot",properties:{name:sn}})),A({tagName:"div",children:t,properties:{"data-metadata":""}})}function Xi(e){return A({tagName:"pre",properties:Yo(e)})}function Yo({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Z=new Map;let bt=0;const Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Q(e){if(Z.has(e))return Z.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z.has(t[1]))return Z.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Z.has(n)?Z.get(n)??"text":Ne[n]??"text"}function Ql(e,t){if(e<=bt)return!1;Z.clear();for(const n in t){const i=t[n];i!=null&&Z.set(n,i)}return bt=e,!0}function Jl(){return bt}function Xo(e,t){const n=Z.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),Z.set(e,t),bt++,!0)}function Zl(){return Object.fromEntries(Z)}function un(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:cn(t),preferredHighlighter:n}}function ge(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function xe(e){return e.replace(/\n$|\r\n$/,"")}function Qo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(W(` `)),e}const tt=Symbol("no-token"),Rt=Symbol("multiple-tokens");function Qi(e){const t=Jo(e);if(t!=null)return t;let n=tt;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Zo(a,o);for(const d of a.children)ft(d)}else ft(a);i.push(a),r=[],o=void 0;return}for(const a of r)ft(a);i.push(A({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==tt){if(a===Rt){n=Rt;return}if(n===tt){n=a;return}n!==a&&(n=Rt)}};for(const a of e.children){const d=a.type==="element"?Qi(a):tt;if(l(d),typeof d!="number"){s(),i.push(a);continue}o!=null&&o!==d&&s(),o??=d,r.push(a)}return s(),e.children=i,n}function Jo(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function ft(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)ft(t)}}function Zo(e,t){e.properties["data-char"]=t}function es(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,d])=>`${a}:${d}`).join(";")}function s(l){let a=t+ts(typeof l=="string"?l:o(l))+n;return a=i(a),r.has(a)||r.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const d of a){if(!d.htmlStyle)continue;const h=s(d.htmlStyle);d.htmlStyle={},d.htmlAttrs||={},d.htmlAttrs.class?d.htmlAttrs.class+=` ${h}`:d.htmlAttrs.class=h}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,d]of r.entries())l+=`.${a}{${typeof d=="string"?d:o(d)}}`;return l},clearRegistry(){r.clear()}}}function ts(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function Ji(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=oo(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&Qi(a),s.push(Qo(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const d=a.__lineChar;return d!=null&&(r.properties["data-char"]=d),r}return r}}:null}];return t&&i.push(ns,Mn),{state:n,transformers:i,toClass:Mn}}const Mn=es({classPrefix:"hl-"}),ns={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function B(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const is=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,rs=/^0(?:\.0+)?%?$/;function os(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function ss(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function At(e){if(e==null)return null;const t=ss(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Dn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||is.test(t))return!0;const n=os(t);return n!=null&&rs.test(n)}function as(e,t,n){if(t==null||n==null)return!1;const i=At(e),r=At(t),o=At(n);return i==null||r==null||o==null?!1:Math.abs(i-o){const s=e.at(-1);return s===""||s===` `||s===`\r `||s==="\r"?Math.max(0,e.length-2):e.length-1})();for(let s=t;s0||l<1/0,{state:h,transformers:c}=Ji(r),u=o?"text":e.lang??Q(e.name),f=typeof n=="string"?t.getTheme(n).type:void 0,g=fn({theme:n,highlighter:t});h.lineInfo=p=>({type:"context",lineIndex:p-1+s,lineNumber:p+s});const b=typeof n=="string"?{lang:u,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:u,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},y=Kt(t.codeToHast(d?cs(a??St(e.contents),s,l):xe(e.contents),b)),m=d?new Array(s):y;return d&&m.push(...y),{code:m,themeStyles:g,baseThemeType:f}}function cs(e,t,n){let i="";return Ct({lines:e,startingLine:t,totalLines:n,callback({content:r}){i+=r}}),i}const Zi="-1,-1";function Yt(e){return e?.some(t=>t.lineNumber===0)??!1}function Xt(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function kt(e){return e.startingLine===0&&e.totalLines>0}function er(e,t){return A({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Qt(e){return(e.lang??Q(e.name))==="text"}function tr(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}let us=-1;var fs=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++us}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(e={theme:_},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Ge(e.theme??_)?Ki():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(const t of e){const n=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=n,n.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){const{options:t}=this.getRenderOptions(e),n=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let i=this.workerManager?.getFileResultCache(e);i!=null&&!Oe(t,i.options)&&(i=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Qt(e),result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter==null&&(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();const{theme:i=_,tokenizeMaxLineLength:r=1e3}=this.options;return{theme:i,useTokenTransformer:tr(this.options),tokenizeMaxLineLength:r}})(),{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!ae(e,n.file)||!Oe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,St(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:St(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Ae){if(e==null)return;let{options:n,forceHighlight:i}=this.getRenderOptions(e);const r=this.getMatchingWorkerResultCache(e,n);r!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...r},i=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};const o=this.getOrCreateLineCache(e),s=e.contents.length>0,l=!s||Qt(e)||Pt(o.length,this.getTokenizeMaxLength()),a=!ae(e,this.renderCache.file),d=!Lt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||d))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||a||d||i)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,o)),this.renderCache.renderRange=t),!l&&s&&(!this.renderCache.highlighted||i)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Q(e.name);const h=this.highlighter!=null&&Ge(n.theme),c=this.highlighter!=null&&mt(this.computedLang),u=!l&&c;if(this.highlighter!=null&&h&&(i||l||!this.renderCache.highlighted&&u||this.renderCache.result==null)){const{result:f,options:g}=this.renderFileWithHighlighter(e,this.highlighter,l||!c);this.renderCache={file:e,options:g,highlighted:u,result:f,renderRange:void 0}}(!h||!l&&!c)&&this.asyncHighlight(e).then(({result:f,options:g})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,f,g,!l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=Ae){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){const t=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Q(e.name);const n=this.highlighter!=null&&Go(cn(this.options.theme)),i=t||this.highlighter!=null&&mt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:hs(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{disableFileHeader:o=!1}=this.options,s=[],l=Ee(),a=this.getOrCreateLineCache(e);let d=0;const h=kt(t)?Xt(this.lineAnnotations):void 0;return h!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:-1,lineIndex:-1,annotations:h.map(c=>ge(c))})),d++),Ct({lines:a,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:c,lineNumber:u})=>{const f=n[c];if(f==null){const g="FileRenderer.processFileResult: Line doesnt exist";throw console.error(g,{name:e.name,lineIndex:c,lineNumber:u,lines:a}),new Error(g)}if(f!=null){l.children.push(Di("context",u,`${c}`)),s.push(f),d++;const g=this.lineAnnotations[u];g!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:0,lineIndex:u,annotations:g.map(b=>ge(b))})),d++)}}}),l.properties.style=`grid-row: span ${d}`,{gutterAST:l.children??[],contentAST:s,preAST:this.createPreElement(a.length),headerAST:o?void 0:this.renderHeader(e),totalLines:a.length,rowCount:d,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return Yi({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return pe(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(A({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=Ee();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,er(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?pe(A({tagName:"code",children:e,properties:{"data-code":""}})):pe(e)}async initializeHighlighter(){return this.highlighter=await xt(un(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!ae(e,this.renderCache.file)||!this.renderCache.highlighted||!Oe(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Oe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ae(e,n.file)&&Oe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return Xi({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Pt(e,t){return e>t}const nr=`
        Failed to render infographic: ${m instanceof Error?m.message:"Unknown error"}
        `)):(L.value=pe,S.value=Xe,pe&&p.value&&(p.value.innerHTML=w))}finally{if(me=!1,le(f))if(oe){const m=G;oe=!1,G=!1,U(()=>{Pe(m)})}else(function(){re(this,null,function*(){const m=E;m&&(E="",yield U(),(function(Z=be.value){Z&&$.value&&x?.reportHeight(Z,$.value.offsetHeight)})(m),x?.markSettled(m))})})()}})}function O(n=!1){q||!P.value||k.value||c.value||U(()=>{q||Pe(n)})}B(()=>z.value,()=>{O(!0)}),B(()=>l.loading,(n,e)=>{e&&!n&&O(!0)}),B(()=>k.value,n=>{n||O(!0)}),B(()=>c.value,n=>{n||O()}),B(()=>l.maxHeight,()=>{U(()=>{Me()})}),B([()=>l.estimatedPreviewHeightPx,()=>z.value],()=>{L.value||k.value||(ce.value=`${ue.value}px`)}),B(()=>P.value,n=>{!n||k.value||c.value||O()}),n1(()=>{!ye.value&&Ze(),O()}),o1(()=>{var n,e;if(q=!0,he+=1,oe=!1,G=!1,(n=A.value)==null||n.destroy(),A.value=null,(function(){const o=E;o&&(E="",x?.markSettled(o))})(),g&&((e=g.destroy)==null||e.call(g),g=null),te="",typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}});const Ee=T(()=>!0),ae=T(()=>k.value||c.value),Ue=T(()=>k.value?"fallback":S.value?"error":L.value?"preview":"pending"),ze=T(()=>({transform:`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}));return B(ze,n=>{j.value&&K.value&&(K.value.style.transform=n.transform)}),(n,e)=>(r(),u("div",{ref_key:"viewportTarget",ref:$,class:b(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":l.loading,dark:l.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Ue.value},[l.showHeader?(r(),u("div",f1,[n.$slots["header-left"]?(r(),u("div",w1,[ge(n.$slots,"header-left",{},void 0,!0)])):(r(),u("div",g1,[t("span",{class:"icon-slot action-icon shrink-0",innerHTML:s(` +import{bQ as Re,M as Ae,b$ as Ge,c0 as qe,c1 as Je,c2 as Qe,aU as d,bl as Ke,af as We,bY as e1,bE as B,as as U,aD as n1,c3 as Ze,az as o1,aL as r,u,aY as ge,v as t,bk as s,bb as X,au as b,t as F,aw as Ce,bL as t1,bB as l1,s as a1,I as i1,bJ as r1,bO as s1,g as u1,T as c1,q as T,c4 as Ve,c5 as ie,c6 as d1,c7 as De,c8 as v1,c9 as m1,b_ as h1}from"./index-D-7nOosq.js";var re=(R,xe,l)=>new Promise((a,J)=>{var V=c=>{try{H(l.next(c))}catch($){J($)}},Q=c=>{try{H(l.throw(c))}catch($){J($)}},H=c=>c.done?a(c.value):Promise.resolve(c.value).then(V,Q);H((l=l.apply(R,xe)).next())});const p1=["data-markstream-mode"],f1={key:0,class:"infographic-block-header flex justify-between items-center border-b"},w1={key:0},g1={key:1,class:"flex items-center gap-x-2 overflow-hidden"},C1=["innerHTML"],k1={key:2},x1={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},y1=["disabled"],b1={class:"flex items-center gap-x-1"},M1={class:"flex items-center gap-x-1"},B1={key:4},F1={key:5,class:"infographic-header-actions flex items-center"},T1=["aria-pressed"],H1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},$1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},j1=["disabled"],L1=["disabled"],P1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},E1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},z1={key:0,class:"infographic-source"},S1={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},Z1={key:1,class:"relative"},V1={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},D1={class:"flex items-center gap-2 backdrop-blur rounded-lg"},N1={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},Y1={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},_1={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},se="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",ke=Re(Ae({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(R,{emit:xe}){const l=R,{t:a}=Ge(),J=qe(),V=Je(),Q=Qe(),H=d(!1),c=d(!1),$=d(),p=d(),k=d(!0),ye=d(!1),j=d(!1),D=d(),K=d(null),L=d(!1),S=d(!1),A=d(null),P=d(typeof window>"u"||!Q.value),Ne=Ke(),x=We(e1,null);let E="";const be=T(()=>h1(l,Ne));typeof window<"u"&&B([()=>$.value,Q],([n,e])=>{var o,i,C;if((o=A.value)==null||o.destroy(),A.value=null,!e||P.value)return void(P.value=!0);if(!n)return void(P.value=!1);const f=(C=(i=V?.value.heavyBlockMargin)!=null?i:V?.value.rootMargin)!=null?C:"160px",w=J(n,{rootMargin:f,allowIdle:!1});A.value=w,P.value=w.isVisible.value,w.whenVisible.then(()=>{P.value=!0})},{immediate:!0});const z=T(()=>l.node.code),ue=T(()=>{var n;return(function(e){if(l.maxHeight==="none")return Ve(e,void 0,null);const o=ie(l.maxHeight);return Ve(e,void 0,o)})((n=ie(l.estimatedPreviewHeightPx))!=null?n:d1(z.value))}),ce=d(`${ue.value}px`),Ye=T(()=>ie(l.estimatedPreviewHeightPx)!=null);function Me(){var n;if(!p.value||Ye.value)return;const e=p.value.scrollHeight;if(e>0){const o=(n=ie((function(i){if(l.maxHeight==="none")return`${i}px`;if(l.maxHeight!=null){const f=Number.parseFloat(String(l.maxHeight));if(Number.isFinite(f))return`${Math.min(i,f)}px`}const C=p.value;if(C){const f=getComputedStyle(C).getPropertyValue("--ms-size-code-max-height").trim(),w=Number.parseFloat(f);if(Number.isFinite(w))return`${Math.min(i,w)}px`}return`${Math.min(i,500)}px`})(e)))!=null?n:e;ce.value=`${Math.max(o,ue.value)}px`}}const M=d(1),N=d(0),Y=d(0),_=d(!1),W=d({x:0,y:0}),Be=T(()=>z.value);function Fe(n){return!n||n.disabled}function h(n,e,o="top"){if(Fe(n.currentTarget))return;const i=n,C=i?.clientX!=null&&i?.clientY!=null?{x:i.clientX,y:i.clientY}:void 0;De(n.currentTarget,e,o,!1,C,l.isDark)}function v(){v1()}function Te(n){if(Fe(n.currentTarget))return;const e=H.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=n,i=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;De(n.currentTarget,e,"top",!1,i,l.isDark)}function _e(){return re(this,null,function*(){try{const n=z.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(n)),H.value=!0,setTimeout(()=>{H.value=!1},1e3)}catch(n){console.error("Failed to copy:",n)}})}function He(n){(n!=="preview"||Ze())&&(ye.value=!0,k.value=n==="source")}function Ie(){var n;const e=(n=p.value)==null?void 0:n.querySelector("svg");e?(function(o){re(this,null,function*(){try{const i=new XMLSerializer().serializeToString(o),C=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(C);if(typeof document<"u"){const w=document.createElement("a");w.href=f,w.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(w),w.click(),document.body.removeChild(w)}catch{}URL.revokeObjectURL(f)}}catch(i){console.error("Failed to export SVG:",i)}})})(e):console.error("SVG element not found")}function de(n){n.key==="Escape"&&j.value&&ve()}function ve(){if(j.value=!1,D.value&&(D.value.innerHTML=""),K.value=null,typeof document<"u")try{document.body.style.overflow=""}catch{}if(typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}}function Oe(){(function(){if(j.value=!0,typeof document<"u")try{document.body.style.overflow="hidden"}catch{}if(typeof window<"u")try{window.addEventListener("keydown",de)}catch{}U(()=>{if(p.value&&D.value){D.value.innerHTML="";const n=document.createElement("div");n.style.transition="transform 0.1s ease",n.style.transformOrigin="center center",n.style.width="100%",n.style.height="100%",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center";const e=p.value.cloneNode(!0);e.classList.add("fullscreen"),e.style.height="auto",n.appendChild(e),D.value.appendChild(n),K.value=n,n.style.transform=`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}})})()}function $e(){M.value<3&&(M.value+=.1)}function je(){M.value>.5&&(M.value-=.1)}function Le(){M.value=1,N.value=0,Y.value=0}function ee(n){_.value=!0,n instanceof MouseEvent?W.value={x:n.clientX-N.value,y:n.clientY-Y.value}:W.value={x:n.touches[0].clientX-N.value,y:n.touches[0].clientY-Y.value}}function ne(n){if(!_.value)return;let e,o;n instanceof MouseEvent?(e=n.clientX,o=n.clientY):(e=n.touches[0].clientX,o=n.touches[0].clientY),N.value=e-W.value.x,Y.value=o-W.value.y}function I(){_.value=!1}let g=null,me=!1,oe=!1,G=!1,te="",q=!1,he=0;function le(n){return!q&&n===he}function Pe(n=!1){return re(this,null,function*(){var e,o;if(q||!P.value||!p.value)return;if(me)return oe=!0,void(G=G||n);const i=Be.value;if(!n&&i===te&&L.value)return;const C=l.loading===!1,f=++he;me=!0,(function(){const m=be.value;m&&E!==m&&(E&&x?.markSettled(E),E=m,x?.markPending(m))})();const w=p.value.innerHTML,pe=L.value,Xe=S.value;S.value=!1;try{const m=yield m1();if(!le(f))return;if(!m)return void console.warn("Infographic library failed to load.");const Z=p.value;if(!Z)return;g&&((e=g.destroy)==null||e.call(g),g=null),Z.innerHTML="",g=new m({container:Z,width:"100%",height:"100%"});let fe="";if((o=g.on)==null||o.call(g,"error",we=>{fe=(Array.isArray(we)?we:[we]).map(y=>{var Se;return y instanceof Error?y.message:typeof y=="string"?y:String(y&&typeof y=="object"&&"message"in y?(Se=y.message)!=null?Se:"":y??"")}).filter(Boolean).join("; ")}),g.render(z.value),fe)throw new Error(fe);if(!Z.childNodes.length)throw new Error("Infographic render returned empty output.");L.value=!0,S.value=!1,te=i,U(()=>{le(f)&&Me()})}catch(m){if(!le(f))return;C&&l.loading===!1&&i===Be.value?(console.error("Failed to render infographic:",m),L.value=!1,S.value=!0,te="",p.value&&(p.value.innerHTML=`
        Failed to render infographic: ${m instanceof Error?m.message:"Unknown error"}
        `)):(L.value=pe,S.value=Xe,pe&&p.value&&(p.value.innerHTML=w))}finally{if(me=!1,le(f))if(oe){const m=G;oe=!1,G=!1,U(()=>{Pe(m)})}else(function(){re(this,null,function*(){const m=E;m&&(E="",yield U(),(function(Z=be.value){Z&&$.value&&x?.reportHeight(Z,$.value.offsetHeight)})(m),x?.markSettled(m))})})()}})}function O(n=!1){q||!P.value||k.value||c.value||U(()=>{q||Pe(n)})}B(()=>z.value,()=>{O(!0)}),B(()=>l.loading,(n,e)=>{e&&!n&&O(!0)}),B(()=>k.value,n=>{n||O(!0)}),B(()=>c.value,n=>{n||O()}),B(()=>l.maxHeight,()=>{U(()=>{Me()})}),B([()=>l.estimatedPreviewHeightPx,()=>z.value],()=>{L.value||k.value||(ce.value=`${ue.value}px`)}),B(()=>P.value,n=>{!n||k.value||c.value||O()}),n1(()=>{!ye.value&&Ze(),O()}),o1(()=>{var n,e;if(q=!0,he+=1,oe=!1,G=!1,(n=A.value)==null||n.destroy(),A.value=null,(function(){const o=E;o&&(E="",x?.markSettled(o))})(),g&&((e=g.destroy)==null||e.call(g),g=null),te="",typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}});const Ee=T(()=>!0),ae=T(()=>k.value||c.value),Ue=T(()=>k.value?"fallback":S.value?"error":L.value?"preview":"pending"),ze=T(()=>({transform:`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}));return B(ze,n=>{j.value&&K.value&&(K.value.style.transform=n.transform)}),(n,e)=>(r(),u("div",{ref_key:"viewportTarget",ref:$,class:b(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":l.loading,dark:l.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Ue.value},[l.showHeader?(r(),u("div",f1,[n.$slots["header-left"]?(r(),u("div",w1,[ge(n.$slots,"header-left",{},void 0,!0)])):(r(),u("div",g1,[t("span",{class:"icon-slot action-icon shrink-0",innerHTML:s(` `)},null,8,C1),e[21]||(e[21]=t("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),n.$slots["header-center"]?(r(),u("div",k1,[ge(n.$slots,"header-center",{},void 0,!0)])):l.showModeToggle?(r(),u("div",x1,[t("button",{class:b(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[k.value?"":"is-active",Ee.value?"opacity-50 cursor-not-allowed":""]]),disabled:Ee.value,onClick:e[0]||(e[0]=()=>He("preview")),onMouseenter:e[1]||(e[1]=o=>h(o,s(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>h(o,s(a)("common.preview")||"Preview")),onMouseleave:v,onBlur:v},[t("div",b1,[e[22]||(e[22]=t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),t("circle",{cx:"12",cy:"12",r:"3"})])],-1)),t("span",null,X(s(a)("common.preview")||"Preview"),1)])],42,y1),t("button",{class:b(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[k.value?"is-active":""]]),onClick:e[3]||(e[3]=()=>He("source")),onMouseenter:e[4]||(e[4]=o=>h(o,s(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>h(o,s(a)("common.source")||"Source")),onMouseleave:v,onBlur:v},[t("div",M1,[e[23]||(e[23]=t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),t("span",null,X(s(a)("common.source")||"Source"),1)])],34)])):F("",!0),n.$slots["header-right"]?(r(),u("div",B1,[ge(n.$slots,"header-right",{},void 0,!0)])):(r(),u("div",F1,[l.showCollapseButton?(r(),u("button",{key:0,class:b(se),"aria-pressed":c.value,onClick:e[6]||(e[6]=o=>c.value=!c.value),onMouseenter:e[7]||(e[7]=o=>h(o,c.value?s(a)("common.expand")||"Expand":s(a)("common.collapse")||"Collapse")),onFocus:e[8]||(e[8]=o=>h(o,c.value?s(a)("common.expand")||"Expand":s(a)("common.collapse")||"Collapse")),onMouseleave:v,onBlur:v},[(r(),u("svg",{style:Ce({rotate:c.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[24]||(e[24]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,T1)):F("",!0),l.showCopyButton?(r(),u("button",{key:1,class:b(se),onClick:_e,onMouseenter:e[9]||(e[9]=o=>Te(o)),onFocus:e[10]||(e[10]=o=>Te(o)),onMouseleave:v,onBlur:v},[H.value?(r(),u("svg",$1,[...e[26]||(e[26]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(r(),u("svg",H1,[...e[25]||(e[25]=[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):F("",!0),l.showExportButton?(r(),u("button",{key:2,class:b(`${se} ${ae.value?"opacity-50 cursor-not-allowed":""}`),disabled:ae.value,onClick:Ie,onMouseenter:e[11]||(e[11]=o=>h(o,s(a)("common.export")||"Export")),onFocus:e[12]||(e[12]=o=>h(o,s(a)("common.export")||"Export")),onMouseleave:v,onBlur:v},[...e[27]||(e[27]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,j1)):F("",!0),l.showFullscreenButton?(r(),u("button",{key:3,class:b(`${se} ${ae.value?"opacity-50 cursor-not-allowed":""}`),disabled:ae.value,onClick:Oe,onMouseenter:e[13]||(e[13]=o=>h(o,j.value?s(a)("common.minimize")||"Minimize":s(a)("common.open")||"Open")),onFocus:e[14]||(e[14]=o=>h(o,j.value?s(a)("common.minimize")||"Minimize":s(a)("common.open")||"Open")),onMouseleave:v,onBlur:v},[j.value?(r(),u("svg",E1,[...e[29]||(e[29]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(r(),u("svg",P1,[...e[28]||(e[28]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,L1)):F("",!0)]))])):F("",!0),t1(t("div",null,[k.value?(r(),u("div",z1,[t("pre",S1,X(z.value),1)])):(r(),u("div",Z1,[l.showZoomControls?(r(),u("div",V1,[t("div",D1,[t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:$e,onMouseenter:e[15]||(e[15]=o=>h(o,s(a)("common.zoomIn")||"Zoom in")),onFocus:e[16]||(e[16]=o=>h(o,s(a)("common.zoomIn")||"Zoom in")),onMouseleave:v,onBlur:v},[...e[30]||(e[30]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:je,onMouseenter:e[17]||(e[17]=o=>h(o,s(a)("common.zoomOut")||"Zoom out")),onFocus:e[18]||(e[18]=o=>h(o,s(a)("common.zoomOut")||"Zoom out")),onMouseleave:v,onBlur:v},[...e[31]||(e[31]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:Le,onMouseenter:e[19]||(e[19]=o=>h(o,s(a)("common.resetZoom")||"Reset zoom")),onFocus:e[20]||(e[20]=o=>h(o,s(a)("common.resetZoom")||"Reset zoom")),onMouseleave:v,onBlur:v},X(Math.round(100*M.value))+"% ",33)])])):F("",!0),t("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:Ce({height:ce.value}),onMousedown:ee,onMousemove:ne,onMouseup:I,onMouseleave:I,onTouchstartPassive:ee,onTouchmovePassive:ne,onTouchendPassive:I},[L.value||S.value?F("",!0):(r(),u("pre",N1,X(z.value),1)),t("div",{class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":_.value}]),style:Ce(ze.value)},[t("div",{ref_key:"infographicContainer",ref:p,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[l1,!c.value]]),(r(),a1(c1,{to:"body"},[t("div",{class:b(["markstream-vue",{dark:l.isDark}])},[i1(u1,{name:"infographic-dialog",appear:""},{default:r1(()=>[j.value?(r(),u("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:s1(ve,["self"])},[t("div",Y1,[t("div",_1,[t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:$e},[...e[32]||(e[32]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:je},[...e[33]||(e[33]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:Le},X(Math.round(100*M.value))+"% ",1),t("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:ve},[...e[34]||(e[34]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),t("div",{ref_key:"modalContent",ref:D,class:b(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!_.value,"cursor-grabbing":_.value}]),onMousedown:ee,onMousemove:ne,onMouseup:I,onMouseleave:I,onTouchstartPassive:ee,onTouchmovePassive:ne,onTouchendPassive:I},null,34)])])):F("",!0)]),_:1})],2)]))],10,p1))}}),[["__scopeId","data-v-de34ec4b"]]);ke.install=R=>{R.component(ke.__name,ke)};export{ke as default}; diff --git a/apps/kimi-code/dist-web/assets/index11-DvlSNaLO.js b/apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index11-DvlSNaLO.js rename to apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js index d086fe64aea..6e015695854 100644 --- a/apps/kimi-code/dist-web/assets/index11-DvlSNaLO.js +++ b/apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js @@ -1,4 +1,4 @@ -import{cq as _t,bQ as _n,M as Hn,c2 as Nn,c1 as In,b$ as Yn,c0 as qn,aU as f,bl as Wn,af as Xn,bY as Vn,bE as I,az as Un,c8 as wn,aD as Zn,as as Y,aI as Kn,aL as M,u as C,aY as Rt,v as u,bk as w,bb as Ke,au as ae,t as pe,aw as Ft,bL as Gn,bB as Jn,ar as yn,bd as kn,s as Qn,I as el,bJ as tl,bO as nl,g as ll,T as rl,q as F,c7 as xn,c5 as zt,cr as ol,cs as al,ct as il,cu as ul,cv as sl,b_ as cl,cw as dl}from"./index-HRJ6xRtC.js";import{i as At}from"./safeRaf-DGuzXxDK.js";function vl(d,m){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(d.slice(Math.max(0,m-12),m))}function Cn(d){return d.includes("->")||d.includes("-->")||d.includes("->>")||d.includes("-->>")||d.includes("-x")||d.includes("--x")||d.includes("-)")||d.includes("--)")||d.includes("-+")||d.includes("--+")}function fl(d){const m=d.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(m)||(function(y){const z=y.split(";",1)[0],a=z.indexOf(":");return a>0&&Cn(z.slice(0,a))})(m)}function ml(d){if(!d.includes(";"))return d;const m=d.indexOf(":");if(m===-1||!(function($,Q){const k=$.slice(0,Q);return/^\s*Note\b/i.test(k)||Cn(k)})(d,m))return d;const y=d.slice(0,m+1),z=d.slice(m+1),a=(function($){let Q="",k=!1;for(let P=0;P<$.length;P++){const ee=$[P];ee!==";"||vl($,P)||fl($.slice(P+1))?Q+=ee:(Q+="#59;",k=!0)}return k?Q:$})(z);return a===z?d:`${y}${a}`}function Lt(d){if(_t(d)!=="sequencediagram")return d;const m=d.split(/(\r\n|\n|\r)/);let y=!1;for(let z=0;zm in d?hl(d,m,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[m]=y,Tn=(d,m)=>{for(var y in m||(m={}))wl.call(m,y)&&Mn(d,y,m[y]);if(bn)for(var y of bn(m))yl.call(m,y)&&Mn(d,y,m[y]);return d},T=(d,m,y)=>new Promise((z,a)=>{var $=P=>{try{k(y.next(P))}catch(ee){a(ee)}},Q=P=>{try{k(y.throw(P))}catch(ee){a(ee)}},k=P=>P.done?z(P.value):Promise.resolve(P.value).then($,Q);k((y=y.apply(d,m)).next())});const xl=["data-markstream-mode","data-markstream-pending"],bl={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},Ml={key:0},Tl={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Cl=["innerHTML"],Bl={key:2},El={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},Ol={class:"flex items-center gap-x-1"},Sl={class:"flex items-center gap-x-1"},$l={key:4},Pl={key:5,class:"mermaid-header-actions flex items-center"},Dl=["aria-pressed"],Rl={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Fl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zl=["aria-label","disabled"],Al=["aria-label","disabled"],Ll={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},jl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},_l={key:0,class:"mermaid-source-panel"},Hl={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Nl={key:1,class:"relative"},Il={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Yl={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ql={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Wl={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pt="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",jt=_n(Hn({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(d,{emit:m}){var y,z;const a=d,$=m,Q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},k=f(!1),P=f(typeof window>"u"),ee=Nn(),Ht=In(),Le=F(()=>a.isStrict?"strict":"loose"),Bn=F(()=>({startOnLoad:!1,securityLevel:Le.value,dompurifyConfig:Le.value==="strict"?Q:void 0,flowchart:Le.value==="strict"?{htmlLabels:!1}:void 0}));function we(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Ee(e,t,n={}){if(!e)return null;const l=(function(r,o){if(!r)return null;const c=sl(o);if(!c)return null;const h=(function(i,s){const p=Array.from(i.childNodes),E=document.createElement("div");return E.dataset.mermaidSvgLayer="1",E.style.zIndex="1",E.appendChild(s),i.insertBefore(E,i.firstChild),p.length>0&&(function(W){const j=()=>{var X;for(const J of W)(X=J.parentNode)==null||X.removeChild(J)};typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>{requestAnimationFrame(j)}):setTimeout(j,32)})(p),E})(r,c);return{svg:c.outerHTML,bindTarget:h}})(e,t);return l||n.keepPreviousOnFailure||we(e),l}let ie=null;function ye(e){if(a.enableMermaidInteractions&&e?.querySelector("svg"))try{ie?.(e)}catch{}}const{t:g}=Yn();let ue=!1,ke=0;function Ge(){return T(this,null,function*(){try{const e=yield il();return ue?null:(k.value=!!e,e)}catch(e){throw ue||(k.value=!1),e}finally{ue||(P.value=!0)}})}const Je=f(!1),V=f(!1),Qe=f(),Z=f(),v=f(),se=f(),et=f(null),En=qn(),je=f(null),xe=f(typeof window>"u"||!ee.value),On=Wn(),te=Xn(Vn,null);let ce="",be=0,tt=0;const Nt=F(()=>cl(a,On));function wt(){const e=Nt.value;e&&(ce&&ce!==e&&(te?.markSettled(ce),be=0),ce=e,be+=1,tt+=1,be===1&&te?.markPending(e))}function yt(){return T(this,null,function*(){const e=ce;if(!e||(be=Math.max(0,be-1),be>0))return;ce="";const t=++tt;yield Y(),t===tt&&((function(n=Nt.value){n&&Qe.value&&te?.reportHeight(n,Qe.value.offsetHeight)})(e),te?.markSettled(e))})}function It(){const e=ce;e&&(ce="",be=0,tt+=1,te?.markSettled(e))}const Yt=f(),D=F(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function Sn(e,t=D.value){const n=t,l={theme:e==="dark"?"dark":"default"};Le.value==="strict"&&(l.flowchart={htmlLabels:!1});const r=`%%{init: ${JSON.stringify(l)}}%% +import{cq as _t,bQ as _n,M as Hn,c2 as Nn,c1 as In,b$ as Yn,c0 as qn,aU as f,bl as Wn,af as Xn,bY as Vn,bE as I,az as Un,c8 as wn,aD as Zn,as as Y,aI as Kn,aL as M,u as C,aY as Rt,v as u,bk as w,bb as Ke,au as ae,t as pe,aw as Ft,bL as Gn,bB as Jn,ar as yn,bd as kn,s as Qn,I as el,bJ as tl,bO as nl,g as ll,T as rl,q as F,c7 as xn,c5 as zt,cr as ol,cs as al,ct as il,cu as ul,cv as sl,b_ as cl,cw as dl}from"./index-D-7nOosq.js";import{i as At}from"./safeRaf-DGuzXxDK.js";function vl(d,m){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(d.slice(Math.max(0,m-12),m))}function Cn(d){return d.includes("->")||d.includes("-->")||d.includes("->>")||d.includes("-->>")||d.includes("-x")||d.includes("--x")||d.includes("-)")||d.includes("--)")||d.includes("-+")||d.includes("--+")}function fl(d){const m=d.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(m)||(function(y){const z=y.split(";",1)[0],a=z.indexOf(":");return a>0&&Cn(z.slice(0,a))})(m)}function ml(d){if(!d.includes(";"))return d;const m=d.indexOf(":");if(m===-1||!(function($,Q){const k=$.slice(0,Q);return/^\s*Note\b/i.test(k)||Cn(k)})(d,m))return d;const y=d.slice(0,m+1),z=d.slice(m+1),a=(function($){let Q="",k=!1;for(let P=0;P<$.length;P++){const ee=$[P];ee!==";"||vl($,P)||fl($.slice(P+1))?Q+=ee:(Q+="#59;",k=!0)}return k?Q:$})(z);return a===z?d:`${y}${a}`}function Lt(d){if(_t(d)!=="sequencediagram")return d;const m=d.split(/(\r\n|\n|\r)/);let y=!1;for(let z=0;zm in d?hl(d,m,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[m]=y,Tn=(d,m)=>{for(var y in m||(m={}))wl.call(m,y)&&Mn(d,y,m[y]);if(bn)for(var y of bn(m))yl.call(m,y)&&Mn(d,y,m[y]);return d},T=(d,m,y)=>new Promise((z,a)=>{var $=P=>{try{k(y.next(P))}catch(ee){a(ee)}},Q=P=>{try{k(y.throw(P))}catch(ee){a(ee)}},k=P=>P.done?z(P.value):Promise.resolve(P.value).then($,Q);k((y=y.apply(d,m)).next())});const xl=["data-markstream-mode","data-markstream-pending"],bl={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},Ml={key:0},Tl={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Cl=["innerHTML"],Bl={key:2},El={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},Ol={class:"flex items-center gap-x-1"},Sl={class:"flex items-center gap-x-1"},$l={key:4},Pl={key:5,class:"mermaid-header-actions flex items-center"},Dl=["aria-pressed"],Rl={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Fl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zl=["aria-label","disabled"],Al=["aria-label","disabled"],Ll={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},jl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},_l={key:0,class:"mermaid-source-panel"},Hl={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Nl={key:1,class:"relative"},Il={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Yl={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ql={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Wl={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pt="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",jt=_n(Hn({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(d,{emit:m}){var y,z;const a=d,$=m,Q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},k=f(!1),P=f(typeof window>"u"),ee=Nn(),Ht=In(),Le=F(()=>a.isStrict?"strict":"loose"),Bn=F(()=>({startOnLoad:!1,securityLevel:Le.value,dompurifyConfig:Le.value==="strict"?Q:void 0,flowchart:Le.value==="strict"?{htmlLabels:!1}:void 0}));function we(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Ee(e,t,n={}){if(!e)return null;const l=(function(r,o){if(!r)return null;const c=sl(o);if(!c)return null;const h=(function(i,s){const p=Array.from(i.childNodes),E=document.createElement("div");return E.dataset.mermaidSvgLayer="1",E.style.zIndex="1",E.appendChild(s),i.insertBefore(E,i.firstChild),p.length>0&&(function(W){const j=()=>{var X;for(const J of W)(X=J.parentNode)==null||X.removeChild(J)};typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>{requestAnimationFrame(j)}):setTimeout(j,32)})(p),E})(r,c);return{svg:c.outerHTML,bindTarget:h}})(e,t);return l||n.keepPreviousOnFailure||we(e),l}let ie=null;function ye(e){if(a.enableMermaidInteractions&&e?.querySelector("svg"))try{ie?.(e)}catch{}}const{t:g}=Yn();let ue=!1,ke=0;function Ge(){return T(this,null,function*(){try{const e=yield il();return ue?null:(k.value=!!e,e)}catch(e){throw ue||(k.value=!1),e}finally{ue||(P.value=!0)}})}const Je=f(!1),V=f(!1),Qe=f(),Z=f(),v=f(),se=f(),et=f(null),En=qn(),je=f(null),xe=f(typeof window>"u"||!ee.value),On=Wn(),te=Xn(Vn,null);let ce="",be=0,tt=0;const Nt=F(()=>cl(a,On));function wt(){const e=Nt.value;e&&(ce&&ce!==e&&(te?.markSettled(ce),be=0),ce=e,be+=1,tt+=1,be===1&&te?.markPending(e))}function yt(){return T(this,null,function*(){const e=ce;if(!e||(be=Math.max(0,be-1),be>0))return;ce="";const t=++tt;yield Y(),t===tt&&((function(n=Nt.value){n&&Qe.value&&te?.reportHeight(n,Qe.value.offsetHeight)})(e),te?.markSettled(e))})}function It(){const e=ce;e&&(ce="",be=0,tt+=1,te?.markSettled(e))}const Yt=f(),D=F(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function Sn(e,t=D.value){const n=t,l={theme:e==="dark"?"dark":"default"};Le.value==="strict"&&(l.flowchart={htmlLabels:!1});const r=`%%{init: ${JSON.stringify(l)}}%% `;return n.trim().startsWith("%%{")?n:r+n}function qt(){var e;return(function(t){const n=(function(){var r;const o=Z.value?getComputedStyle(Z.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return(r=zt(o))!=null?r:360})(),l=un();return ol(t,n,l)})((e=zt(a.estimatedPreviewHeightPx))!=null?e:al(D.value))}function Wt(){return`${qt()}px`}const _e=f(null);function kt(){var e;return!!((e=v.value)!=null&&e.querySelector("svg"))}function Xt(){return a.loading!==!1&&(kt()||!!_e.value)}const B=f(1),_=f(0),H=f(0),nt=f(!1),lt=f({x:0,y:0}),x=f(!0),rt=f(!1),re=f(!1),de=f(null);let xt="",bt=!1,ve="";const ot=f(0),Mt=f(!1),$n=F(()=>{var e;return Math.max(0,(e=a.renderDebounceMs)!=null?e:300)}),Pn=F(()=>{var e;return Math.max(0,(e=a.contentStableDelayMs)!=null?e:500)}),He=F(()=>{var e;return Math.max(120,(e=a.previewPollDelayMs)!=null?e:800)}),Dn=F(()=>{var e;return Math.max(He.value,(e=a.previewPollMaxDelayMs)!=null?e:4e3)}),Vt=F(()=>{var e;return Math.max(1,Math.trunc((e=a.previewPollMaxAttempts)!=null?e:12))}),fe=F(()=>a.loading!==!1);let Ne=null,Ie=null,Oe=null,Se=null,Ye=0;const Ut=(y=globalThis.requestIdleCallback)!=null?y:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Zt=(z=globalThis.cancelIdleCallback)!=null?z:e=>clearTimeout(e);function b(e=ke){return!ue&&e===ke}function A(){return b()&&xe.value&&!V.value}function Tt(){Oe!=null&&(globalThis.clearTimeout(Oe),Oe=null),Se!=null&&(Zt(Se),Se=null)}function qe(){ue||Oe==null&&Se==null&&(Oe=globalThis.setTimeout(()=>{Oe=null,A()&&(Se=Ut(()=>{Se=null,A()&&gn()},{timeout:500}))},$n.value))}function We(){Ie!=null&&(globalThis.clearTimeout(Ie),Ie=null)}function Kt(e=600){if(typeof globalThis>"u"||ue)return;const t=Math.max(0,e);We(),Ie=globalThis.setTimeout(()=>{if(Ie=null,!ue){if(a.loading||re.value||!A())return void Kt(Math.min(1200,Math.max(300,1.2*t)));qe()}},t)}const q=f(Wt()),at=f(q.value);let $e=null;const O=f(!1),K=f(!1),me=f({}),he=f(0);let U=null,Pe=null;const N=f(!1),Rn=F(()=>{var e,t;return!(V.value||x.value||P.value&&!re.value&&!de.value&&(O.value||N.value&&((t=(e=v.value)==null?void 0:e.textContent)!=null&&t.trim())))}),Me=f({zoom:1,translateX:0,translateY:0,containerHeight:q.value}),Gt=F(()=>a.enableWheelZoom?{wheel:Fn}:{}),G=F(()=>{var e,t,n,l;return{worker:(e=a.workerTimeoutMs)!=null?e:1400,parse:(t=a.parseTimeoutMs)!=null?t:1800,render:(n=a.renderTimeoutMs)!=null?n:2500,fullRender:(l=a.fullRenderTimeoutMs)!=null?l:4e3}});let De=null,it=null,Re=!1,Te=He.value,ne=null,ut=0,Ct=!0,st=0;function Ce(e,t){const n=t?.timeoutMs,l=t?.signal;if(l?.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let r=null,o=!1,c=null;return new Promise((h,i)=>{const s=()=>{r!=null&&clearTimeout(r),c&&l&&l.removeEventListener("abort",c)};n&&n>0&&(r=globalThis.setTimeout(()=>{o||(o=!0,s(),i(new Error("Operation timed out")))},n)),l&&(c=()=>{o||(o=!0,s(),i(new DOMException("Aborted","AbortError")))},l.addEventListener("abort",c)),e().then(p=>{o||(o=!0,s(),h(p))}).catch(p=>{o||(o=!0,s(),i(p))})})}function Jt(e){if(typeof document>"u"||!v.value)return;if(typeof a.onRenderError=="function"&&a.onRenderError(e,D.value,v.value)===!0)return N.value=!0,void L();const t=document.createElement("div");t.style.padding="var(--ms-inset-panel-body)",t.style.color="hsl(var(--ms-destructive))",t.textContent="Failed to render diagram: ";const n=document.createElement("span");n.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(n),we(v.value),v.value.appendChild(t);const l=v.value?getComputedStyle(v.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";q.value=l||"360px",at.value=q.value,N.value=!0,L()}function Qt(e){const t=typeof e=="string"?e:typeof e?.message=="string"?e.message:"";return typeof t=="string"&&/timed out/i.test(t)}function en(e){return e?.name==="AbortError"}function Bt(e){return!Qt(e)&&!en(e)}typeof window<"u"&&I([()=>Qe.value,ee],([e,t])=>{var n;if((n=je.value)==null||n.destroy(),je.value=null,!t||xe.value)return void(xe.value=!0);if(!e)return void(xe.value=!1);const l=En(e,{rootMargin:Ht?.value.heavyBlockMargin,allowIdle:!1});je.value=l,xe.value=l.isVisible.value,l.whenVisible.then(()=>{xe.value=!0})},{immediate:!0}),Un(()=>{var e;ue=!0,ke+=1,he.value+=1,(e=je.value)==null||e.destroy(),je.value=null,It(),Tt()});const ct=F(()=>a.showTooltips!==!1);function tn(e){return!e||e.disabled}function R(e,t,n="top"){if(!ct.value||tn(e.currentTarget))return;const l=e,r=l?.clientX!=null&&l?.clientY!=null?{x:l.clientX,y:l.clientY}:void 0;xn(e.currentTarget,t,n,!1,r,a.isDark)}function S(){ct.value&&wn()}function nn(e){if(!ct.value||tn(e.currentTarget))return;const t=Je.value?g("common.copied")||"Copied":g("common.copy")||"Copy",n=e,l=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;xn(e.currentTarget,t,"top",!1,l,a.isDark)}function ln(e,t){const n={theme:t==="dark"?"dark":"default"};Le.value==="strict"&&(n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%% `;return e.trimStart().startsWith("%%{")?e:l+e}function dt(){return Ct&&!x.value&&!O.value&&!N.value}function rn(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function Et(e){if(_t(e)==="gantt")return(function(n){var l;const r=n.split(/\r?\n/);for(!/\r?\n$/.test(n)&&r.length>0&&r.pop();r.length>0;){const o=(l=r[r.length-1])==null?void 0:l.trim();if(o&&!o.startsWith("%%")){if(rn(o))break;r.pop()}else r.pop()}return r.some(rn)?r.join(` `):""})(e);const t=e.split(/\r?\n/);for(;t.length>0;){const n=t[t.length-1].trimEnd();if(n!==""){if(!(/^[-=~>|<\s]+$/.test(n.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(n)||/[-|><]$/.test(n)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(n)))break;t.pop()}else t.pop()}return t.join(` diff --git a/apps/kimi-code/dist-web/assets/index5-DRizs5us.js b/apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js similarity index 95% rename from apps/kimi-code/dist-web/assets/index5-DRizs5us.js rename to apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js index 4786bec994e..1e6ee74e9ed 100644 --- a/apps/kimi-code/dist-web/assets/index5-DRizs5us.js +++ b/apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js @@ -1 +1 @@ -import c from"./CodeBlockNode-ZZ-0lk3E.js";import{M as v,bl as g,aL as P,s as C,A as b,bJ as i,aY as d,av as k,a4 as x,ar as S,bk as T,q as O}from"./index-HRJ6xRtC.js";import"./safeRaf-DGuzXxDK.js";var H=Object.defineProperty,z=Object.defineProperties,j=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,m=(o,s,e)=>s in o?H(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;const h=v({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:["previewCode","copy"],setup(o,{emit:s}){const e=o,p=s,w=c,f=g(),y=O(()=>{return t=((a,n)=>{for(var r in n||(n={}))F.call(n,r)&&m(a,r,n[r]);if(u)for(var r of u(n))W.call(n,r)&&m(a,r,n[r]);return a})({},f),l={node:e.node,loading:e.loading,stream:e.stream,darkTheme:e.darkTheme,lightTheme:e.lightTheme,isDark:e.isDark,isShowPreview:e.isShowPreview,enableFontSizeControl:e.enableFontSizeControl,minWidth:e.minWidth,maxWidth:e.maxWidth,themes:e.themes,showHeader:e.showHeader,showCopyButton:e.showCopyButton,showExpandButton:e.showExpandButton,showPreviewButton:e.showPreviewButton,showCollapseButton:e.showCollapseButton,showFontSizeButtons:e.showFontSizeButtons,showTooltips:e.showTooltips,estimatedHeightPx:e.estimatedHeightPx,estimatedContentHeightPx:e.estimatedContentHeightPx},z(t,j(l));var t,l});function B(t){p("previewCode",{type:t.artifactType,content:e.node.code,title:t.artifactTitle})}return(t,l)=>(P(),C(T(w),S(y.value,{onPreviewCode:B,onCopy:l[0]||(l[0]=a=>p("copy",a))}),b({_:2},[t.$slots["header-left"]?{name:"header-left",fn:i(()=>[d(t.$slots,"header-left")]),key:"0"}:void 0,t.$slots["header-right"]?{name:"header-right",fn:i(()=>[d(t.$slots,"header-right")]),key:"1"}:void 0,t.$slots.loading?{name:"loading",fn:i(a=>[d(t.$slots,"loading",k(x(a)))]),key:"2"}:void 0]),1040))}});h.install=o=>{o.component(h.__name,h)};export{h as default}; +import c from"./CodeBlockNode-BAtAs_qm.js";import{M as v,bl as g,aL as P,s as C,A as b,bJ as i,aY as d,av as k,a4 as x,ar as S,bk as T,q as O}from"./index-D-7nOosq.js";import"./safeRaf-DGuzXxDK.js";var H=Object.defineProperty,z=Object.defineProperties,j=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,m=(o,s,e)=>s in o?H(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;const h=v({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:["previewCode","copy"],setup(o,{emit:s}){const e=o,p=s,w=c,f=g(),y=O(()=>{return t=((a,n)=>{for(var r in n||(n={}))F.call(n,r)&&m(a,r,n[r]);if(u)for(var r of u(n))W.call(n,r)&&m(a,r,n[r]);return a})({},f),l={node:e.node,loading:e.loading,stream:e.stream,darkTheme:e.darkTheme,lightTheme:e.lightTheme,isDark:e.isDark,isShowPreview:e.isShowPreview,enableFontSizeControl:e.enableFontSizeControl,minWidth:e.minWidth,maxWidth:e.maxWidth,themes:e.themes,showHeader:e.showHeader,showCopyButton:e.showCopyButton,showExpandButton:e.showExpandButton,showPreviewButton:e.showPreviewButton,showCollapseButton:e.showCollapseButton,showFontSizeButtons:e.showFontSizeButtons,showTooltips:e.showTooltips,estimatedHeightPx:e.estimatedHeightPx,estimatedContentHeightPx:e.estimatedContentHeightPx},z(t,j(l));var t,l});function B(t){p("previewCode",{type:t.artifactType,content:e.node.code,title:t.artifactTitle})}return(t,l)=>(P(),C(T(w),S(y.value,{onPreviewCode:B,onCopy:l[0]||(l[0]=a=>p("copy",a))}),b({_:2},[t.$slots["header-left"]?{name:"header-left",fn:i(()=>[d(t.$slots,"header-left")]),key:"0"}:void 0,t.$slots["header-right"]?{name:"header-right",fn:i(()=>[d(t.$slots,"header-right")]),key:"1"}:void 0,t.$slots.loading?{name:"loading",fn:i(a=>[d(t.$slots,"loading",k(x(a)))]),key:"2"}:void 0]),1040))}});h.install=o=>{o.component(h.__name,h)};export{h as default}; diff --git a/apps/kimi-code/dist-web/assets/index6-BS7x8iLz.js b/apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js similarity index 98% rename from apps/kimi-code/dist-web/assets/index6-BS7x8iLz.js rename to apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js index 740cad63694..29f5d93ae07 100644 --- a/apps/kimi-code/dist-web/assets/index6-BS7x8iLz.js +++ b/apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js @@ -1 +1 @@ -import{bQ as Q,M as Y,af as Z,bY as G,a0 as ee,bS as ne,bT as A,aU as _,bZ as te,bE as P,aD as ae,az as le,aL as I,u as O,I as oe,bJ as re,t as ie,v as ue,g as se,au as F,bb as ce,aw as de,q as X,bU as ve,as as j,bV as fe,bW as me,bX as he,b_ as ge}from"./index-HRJ6xRtC.js";var q=(S,B,b)=>new Promise((t,s)=>{var i=c=>{try{T(b.next(c))}catch(d){s(d)}},k=c=>{try{T(b.throw(c))}catch(d){s(d)}},T=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,k);T((b=b.apply(S,B)).next())});const pe=["data-markstream-mode","data-markstream-pending"],ye={key:0,class:"math-loading-overlay"},be=["innerHTML"],ke={key:1,class:"math-block__fallback text-left"},N=Q(Y({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(S){var B,b;const t=S,s=_(null),i=Z(G,null),k=X(()=>ve(t.node.content)),T=((b=(B=ee())==null?void 0:B.vnode.el)==null?void 0:b.nodeType)===1,c=X(()=>ge(t,{})),d=(function(){if(!t.node.content)return{html:"",text:t.node.raw,loading:!1};if(t.node.loading)return{html:"",text:"",loading:!0};const e=ne();if(!e){const n=typeof window>"u"||T;return{html:"",text:n?t.node.raw:"",loading:!n}}try{const n=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return A(k.value,!0,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:t.node.loading?"":t.node.raw,loading:t.node.loading}}})(),u=_(d.html),f=_(d.text);let E=!1,x=0,v=!1,$=null;const m=te();let R=null,h="";const g=_(d.loading),K=_(!1),p=_(D());function H(e){e!=null&&e!==x||(K.value=!1)}function W(){var e;if(t.indexKey==null)return"";const n=(e=t.cacheScope)!=null?e:m?.scope;return`${n!=null&&String(n).length>0?`${String(n)}:`:""}math-block:${String(t.indexKey)}`}function D(){var e;const n=W();return n&&(e=m?.cache.get(n))!=null?e:0}function M(){if(p.value===0)return;p.value=0;const e=W();e&&m?.cache.set(e,0)}function L(e){if(u.value)return void M();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(p.value,e);if(n===p.value)return;p.value=n;const a=W();a&&m?.cache.set(a,n)}function w(){j(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)})}function z(){const e=h;i&&e&&(h="",i.markSettled(e))}function U(){return q(this,null,function*(){if(v)return z(),void H();$&&($.abort(),$=null);const e=++x;if(!t.node.content)return z(),H(),g.value=!1,u.value="",f.value=t.node.raw,E=!1,void w();const n=new AbortController;$=n,K.value=!0,v||e!==x||n.signal.aborted?v||H(e):((function(){const a=c.value;i&&a&&h!==a&&(h&&i.markSettled(h),h=a,i.markPending(a))})(),fe(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(a=>{v||e!==x||(u.value=a,f.value="",E=!0,g.value=!1,M(),w())}).catch(a=>q(null,null,function*(){if(v||e!==x)return;const r=a?.code||a?.name,l=r==="KATEX_DISABLED";if(r==="WORKER_INIT_ERROR"||a?.fallbackToRenderer||(r===me||r==="WORKER_TIMEOUT")&&!t.node.loading){const o=yield he();if(v||e!==x)return;if(o){try{const y=o.renderToString(k.value,{throwOnError:t.node.loading,displayMode:!0});u.value=y,f.value="",E=!0,g.value=!1,M(),w(),A(k.value,!0,y)}catch{}return}}if(l||!t.node.loading)return g.value=!1,u.value="",f.value=t.node.raw,void w();E||(g.value=!0)})).finally(()=>{v||e!==x||(H(e),(function(){const a=h;i&&a&&(h="",j(()=>{var r,l;if(!v){const o=(l=(r=s.value)==null?void 0:r.offsetHeight)!=null?l:0;o>0&&i.reportHeight(a,o)}i.markSettled(a)}))})())}))})}d.html&&(E=!0),d.html&&M();const J=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function V(e,n){return(function(r){const l=String(r??"");for(const{family:o,open:y,close:C}of J)if((y!=="$"||!l.startsWith("$$")&&!l.endsWith("$$"))&&l.length>=y.length+C.length&&l.startsWith(y)&&l.endsWith(C))return{family:o,inner:l.slice(y.length,l.length-C.length),trusted:!0};return null})(e)||{family:"content",inner:String(n??""),trusted:!1}}return P(()=>[t.node.content,t.node.loading,t.node.raw],([e,,n],[a,,r])=>{var l,o;l=V(r,a),o=V(n,e),l.inner===""||l.family===o.family&&(l.trusted&&o.trusted?o.inner.startsWith(l.inner):o.inner===l.inner)||M(),U()},{flush:"post"}),P([()=>t.indexKey,()=>t.cacheScope],()=>{p.value=D(),w()}),ae(()=>{typeof ResizeObserver<"u"&&s.value&&(R=new ResizeObserver(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)}),R.observe(s.value)),w(),u.value||U()}),le(()=>{v=!0,z(),$&&($.abort(),$=null),R?.disconnect(),R=null}),(e,n)=>(I(),O("div",{ref_key:"containerEl",ref:s,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":u.value?"katex":f.value?"fallback":"loading","data-markstream-pending":K.value?"true":void 0,style:de(p.value?{minHeight:`${p.value}px`}:void 0)},[oe(se,{name:"math-fade"},{default:re(()=>[!g.value||u.value||f.value?ie("",!0):(I(),O("div",ye,[...n[0]||(n[0]=[ue("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),u.value?(I(),O("div",{key:0,class:F(["math-block__content",{"math-rendering":g.value}]),innerHTML:u.value},null,10,be)):f.value?(I(),O("pre",ke,ce(f.value),1)):(I(),O("div",{key:2,class:F(["math-block__content",{"math-rendering":g.value}])},null,2))],12,pe))}}),[["__scopeId","data-v-939191ad"]]);N.install=S=>{S.component(N.__name,N)};export{N as default}; +import{bQ as Q,M as Y,af as Z,bY as G,a0 as ee,bS as ne,bT as A,aU as _,bZ as te,bE as P,aD as ae,az as le,aL as I,u as O,I as oe,bJ as re,t as ie,v as ue,g as se,au as F,bb as ce,aw as de,q as X,bU as ve,as as j,bV as fe,bW as me,bX as he,b_ as ge}from"./index-D-7nOosq.js";var q=(S,B,b)=>new Promise((t,s)=>{var i=c=>{try{T(b.next(c))}catch(d){s(d)}},k=c=>{try{T(b.throw(c))}catch(d){s(d)}},T=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,k);T((b=b.apply(S,B)).next())});const pe=["data-markstream-mode","data-markstream-pending"],ye={key:0,class:"math-loading-overlay"},be=["innerHTML"],ke={key:1,class:"math-block__fallback text-left"},N=Q(Y({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(S){var B,b;const t=S,s=_(null),i=Z(G,null),k=X(()=>ve(t.node.content)),T=((b=(B=ee())==null?void 0:B.vnode.el)==null?void 0:b.nodeType)===1,c=X(()=>ge(t,{})),d=(function(){if(!t.node.content)return{html:"",text:t.node.raw,loading:!1};if(t.node.loading)return{html:"",text:"",loading:!0};const e=ne();if(!e){const n=typeof window>"u"||T;return{html:"",text:n?t.node.raw:"",loading:!n}}try{const n=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return A(k.value,!0,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:t.node.loading?"":t.node.raw,loading:t.node.loading}}})(),u=_(d.html),f=_(d.text);let E=!1,x=0,v=!1,$=null;const m=te();let R=null,h="";const g=_(d.loading),K=_(!1),p=_(D());function H(e){e!=null&&e!==x||(K.value=!1)}function W(){var e;if(t.indexKey==null)return"";const n=(e=t.cacheScope)!=null?e:m?.scope;return`${n!=null&&String(n).length>0?`${String(n)}:`:""}math-block:${String(t.indexKey)}`}function D(){var e;const n=W();return n&&(e=m?.cache.get(n))!=null?e:0}function M(){if(p.value===0)return;p.value=0;const e=W();e&&m?.cache.set(e,0)}function L(e){if(u.value)return void M();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(p.value,e);if(n===p.value)return;p.value=n;const a=W();a&&m?.cache.set(a,n)}function w(){j(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)})}function z(){const e=h;i&&e&&(h="",i.markSettled(e))}function U(){return q(this,null,function*(){if(v)return z(),void H();$&&($.abort(),$=null);const e=++x;if(!t.node.content)return z(),H(),g.value=!1,u.value="",f.value=t.node.raw,E=!1,void w();const n=new AbortController;$=n,K.value=!0,v||e!==x||n.signal.aborted?v||H(e):((function(){const a=c.value;i&&a&&h!==a&&(h&&i.markSettled(h),h=a,i.markPending(a))})(),fe(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(a=>{v||e!==x||(u.value=a,f.value="",E=!0,g.value=!1,M(),w())}).catch(a=>q(null,null,function*(){if(v||e!==x)return;const r=a?.code||a?.name,l=r==="KATEX_DISABLED";if(r==="WORKER_INIT_ERROR"||a?.fallbackToRenderer||(r===me||r==="WORKER_TIMEOUT")&&!t.node.loading){const o=yield he();if(v||e!==x)return;if(o){try{const y=o.renderToString(k.value,{throwOnError:t.node.loading,displayMode:!0});u.value=y,f.value="",E=!0,g.value=!1,M(),w(),A(k.value,!0,y)}catch{}return}}if(l||!t.node.loading)return g.value=!1,u.value="",f.value=t.node.raw,void w();E||(g.value=!0)})).finally(()=>{v||e!==x||(H(e),(function(){const a=h;i&&a&&(h="",j(()=>{var r,l;if(!v){const o=(l=(r=s.value)==null?void 0:r.offsetHeight)!=null?l:0;o>0&&i.reportHeight(a,o)}i.markSettled(a)}))})())}))})}d.html&&(E=!0),d.html&&M();const J=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function V(e,n){return(function(r){const l=String(r??"");for(const{family:o,open:y,close:C}of J)if((y!=="$"||!l.startsWith("$$")&&!l.endsWith("$$"))&&l.length>=y.length+C.length&&l.startsWith(y)&&l.endsWith(C))return{family:o,inner:l.slice(y.length,l.length-C.length),trusted:!0};return null})(e)||{family:"content",inner:String(n??""),trusted:!1}}return P(()=>[t.node.content,t.node.loading,t.node.raw],([e,,n],[a,,r])=>{var l,o;l=V(r,a),o=V(n,e),l.inner===""||l.family===o.family&&(l.trusted&&o.trusted?o.inner.startsWith(l.inner):o.inner===l.inner)||M(),U()},{flush:"post"}),P([()=>t.indexKey,()=>t.cacheScope],()=>{p.value=D(),w()}),ae(()=>{typeof ResizeObserver<"u"&&s.value&&(R=new ResizeObserver(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)}),R.observe(s.value)),w(),u.value||U()}),le(()=>{v=!0,z(),$&&($.abort(),$=null),R?.disconnect(),R=null}),(e,n)=>(I(),O("div",{ref_key:"containerEl",ref:s,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":u.value?"katex":f.value?"fallback":"loading","data-markstream-pending":K.value?"true":void 0,style:de(p.value?{minHeight:`${p.value}px`}:void 0)},[oe(se,{name:"math-fade"},{default:re(()=>[!g.value||u.value||f.value?ie("",!0):(I(),O("div",ye,[...n[0]||(n[0]=[ue("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),u.value?(I(),O("div",{key:0,class:F(["math-block__content",{"math-rendering":g.value}]),innerHTML:u.value},null,10,be)):f.value?(I(),O("pre",ke,ce(f.value),1)):(I(),O("div",{key:2,class:F(["math-block__content",{"math-rendering":g.value}])},null,2))],12,pe))}}),[["__scopeId","data-v-939191ad"]]);N.install=S=>{S.component(N.__name,N)};export{N as default}; diff --git a/apps/kimi-code/dist-web/assets/index7-CjjTl3F3.js b/apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js similarity index 98% rename from apps/kimi-code/dist-web/assets/index7-CjjTl3F3.js rename to apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js index 5900e7760c4..c35fdf6071a 100644 --- a/apps/kimi-code/dist-web/assets/index7-CjjTl3F3.js +++ b/apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js @@ -1 +1 @@ -import{bQ as C,M as D,a0 as N,bS as U,bT as L,aU as h,bE as A,aD as K,az as W,aL as y,u as x,bb as z,s as H,bJ as P,v as M,aY as V,g as X,t as j,q as O,bU as q,bV as F,bW as J,bX as Q}from"./index-HRJ6xRtC.js";var S=(f,b,r)=>new Promise((e,k)=>{var i=l=>{try{p(r.next(l))}catch(t){k(t)}},d=l=>{try{p(r.throw(l))}catch(t){k(t)}},p=l=>l.done?e(l.value):Promise.resolve(l.value).then(i,d);p((r=r.apply(f,b)).next())});const Y=["data-markstream-mode","data-markstream-pending"],G=["innerHTML"],Z={key:1,class:"math-inline math-inline--fallback"},ee={class:"math-inline__loading",role:"status","aria-live":"polite"},R=C(D({__name:"MathInlineNode",props:{node:{}},setup(f){var b,r;const e=f,k=h(null),i=O(()=>e.node.markup==="$$"),d=O(()=>q(e.node.content)),p=((r=(b=N())==null?void 0:b.vnode.el)==null?void 0:r.nodeType)===1,l=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const a=U();if(!a){const n=typeof window>"u"||p;return{html:"",text:n?e.node.raw:"",loading:!n}}try{const n=a.renderToString(d.value,{throwOnError:!1,displayMode:i.value});return L(d.value,i.value,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),t=h(l.html),u=h(l.text);let g=!1,m=0,s=!1,c=null;const v=h(l.loading),_=h(!1);function T(a){a!=null&&a!==m||(_.value=!1)}function B(){return S(this,null,function*(){if(s)return;c&&(c.abort(),c=null);const a=++m;if(!e.node.content)return T(),t.value="",u.value=e.node.loading?"":e.node.raw,v.value=e.node.loading,void(g=!1);const n=new AbortController;c=n,_.value=!0,s||a!==m||n.signal.aborted?T(a):F(d.value,i.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(o=>{s||a!==m||(t.value=o,u.value="",v.value=!1,g=!0)}).catch(o=>S(null,null,function*(){if(s||a!==m)return;const w=o?.code||o?.name,$=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||(w===J||w==="WORKER_TIMEOUT")&&!e.node.loading){const I=yield Q();if(s||a!==m)return;if(I){try{const E=I.renderToString(d.value,{throwOnError:e.node.loading,displayMode:i.value});t.value=E,u.value="",v.value=!1,g=!0,L(d.value,i.value,E)}catch{}return}}if($||!e.node.loading)return v.value=!1,t.value="",void(u.value=e.node.raw);g||(v.value=!0)})).finally(()=>{s||T(a)})})}return l.html&&(g=!0),A(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{B()}),K(()=>{t.value||B()}),W(()=>{s=!0,c&&(c.abort(),c=null)}),(a,n)=>(y(),x("span",{ref_key:"containerEl",ref:k,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":u.value?"fallback":"loading","data-markstream-pending":_.value?"true":void 0},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,G)):u.value?(y(),x("span",Z,z(u.value),1)):v.value?(y(),H(X,{key:2,name:"table-node-fade"},{default:P(()=>[M("span",ee,[V(a.$slots,"loading",{isLoading:v.value},()=>[n[0]||(n[0]=M("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),n[1]||(n[1]=M("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):j("",!0)],8,Y))}}),[["__scopeId","data-v-6c556261"]]);R.install=f=>{f.component(R.__name,R)};export{R as default}; +import{bQ as C,M as D,a0 as N,bS as U,bT as L,aU as h,bE as A,aD as K,az as W,aL as y,u as x,bb as z,s as H,bJ as P,v as M,aY as V,g as X,t as j,q as O,bU as q,bV as F,bW as J,bX as Q}from"./index-D-7nOosq.js";var S=(f,b,r)=>new Promise((e,k)=>{var i=l=>{try{p(r.next(l))}catch(t){k(t)}},d=l=>{try{p(r.throw(l))}catch(t){k(t)}},p=l=>l.done?e(l.value):Promise.resolve(l.value).then(i,d);p((r=r.apply(f,b)).next())});const Y=["data-markstream-mode","data-markstream-pending"],G=["innerHTML"],Z={key:1,class:"math-inline math-inline--fallback"},ee={class:"math-inline__loading",role:"status","aria-live":"polite"},R=C(D({__name:"MathInlineNode",props:{node:{}},setup(f){var b,r;const e=f,k=h(null),i=O(()=>e.node.markup==="$$"),d=O(()=>q(e.node.content)),p=((r=(b=N())==null?void 0:b.vnode.el)==null?void 0:r.nodeType)===1,l=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const a=U();if(!a){const n=typeof window>"u"||p;return{html:"",text:n?e.node.raw:"",loading:!n}}try{const n=a.renderToString(d.value,{throwOnError:!1,displayMode:i.value});return L(d.value,i.value,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),t=h(l.html),u=h(l.text);let g=!1,m=0,s=!1,c=null;const v=h(l.loading),_=h(!1);function T(a){a!=null&&a!==m||(_.value=!1)}function B(){return S(this,null,function*(){if(s)return;c&&(c.abort(),c=null);const a=++m;if(!e.node.content)return T(),t.value="",u.value=e.node.loading?"":e.node.raw,v.value=e.node.loading,void(g=!1);const n=new AbortController;c=n,_.value=!0,s||a!==m||n.signal.aborted?T(a):F(d.value,i.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(o=>{s||a!==m||(t.value=o,u.value="",v.value=!1,g=!0)}).catch(o=>S(null,null,function*(){if(s||a!==m)return;const w=o?.code||o?.name,$=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||(w===J||w==="WORKER_TIMEOUT")&&!e.node.loading){const I=yield Q();if(s||a!==m)return;if(I){try{const E=I.renderToString(d.value,{throwOnError:e.node.loading,displayMode:i.value});t.value=E,u.value="",v.value=!1,g=!0,L(d.value,i.value,E)}catch{}return}}if($||!e.node.loading)return v.value=!1,t.value="",void(u.value=e.node.raw);g||(v.value=!0)})).finally(()=>{s||T(a)})})}return l.html&&(g=!0),A(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{B()}),K(()=>{t.value||B()}),W(()=>{s=!0,c&&(c.abort(),c=null)}),(a,n)=>(y(),x("span",{ref_key:"containerEl",ref:k,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":u.value?"fallback":"loading","data-markstream-pending":_.value?"true":void 0},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,G)):u.value?(y(),x("span",Z,z(u.value),1)):v.value?(y(),H(X,{key:2,name:"table-node-fade"},{default:P(()=>[M("span",ee,[V(a.$slots,"loading",{isLoading:v.value},()=>[n[0]||(n[0]=M("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),n[1]||(n[1]=M("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):j("",!0)],8,Y))}}),[["__scopeId","data-v-6c556261"]]);R.install=f=>{f.component(R.__name,R)};export{R as default}; diff --git a/apps/kimi-code/dist-web/assets/index8-BwJHsPMm.js b/apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index8-BwJHsPMm.js rename to apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js index 61dece76342..769f0e8ceec 100644 --- a/apps/kimi-code/dist-web/assets/index8-BwJHsPMm.js +++ b/apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js @@ -1 +1 @@ -import{bQ as ot,M as lt,bl as at,af as rt,bY as ut,b$ as it,c0 as st,c1 as ct,c2 as dt,aU as d,bE as Z,as as fe,aD as vt,az as mt,aL as v,u as m,v as u,bk as f,au as pe,bb as N,t as T,aw as ge,bL as ft,bB as pt,q as D,c7 as Se,c8 as gt,ca as ht,b_ as yt}from"./index-HRJ6xRtC.js";var wt=Object.defineProperty,Le=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,Ne=(p,n,i)=>n in p?wt(p,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[n]=i,he=(p,n)=>{for(var i in n||(n={}))bt.call(n,i)&&Ne(p,i,n[i]);if(Le)for(var i of Le(n))kt.call(n,i)&&Ne(p,i,n[i]);return p},ye=(p,n,i)=>new Promise((w,a)=>{var A=h=>{try{g(i.next(h))}catch(s){a(s)}},k=h=>{try{g(i.throw(h))}catch(s){a(s)}},g=h=>h.done?w(h.value):Promise.resolve(h.value).then(A,k);g((i=i.apply(p,n)).next())});const xt=["data-markstream-mode","data-markstream-pending"],Bt={key:0,class:"d2-block-header flex justify-between items-center border-b"},Dt={class:"d2-header-actions flex items-center"},Ct={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},Mt=["aria-label"],Et={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tt={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},At=["aria-label"],jt=["aria-pressed"],Ot={key:0,class:"d2-source"},Ft={class:"d2-code"},It={key:0,class:"d2-error mt-2 text-xs"},Ht={key:1},St={key:0,class:"d2-source"},Lt={class:"d2-code"},Nt={key:0,class:"d2-error mt-2 text-xs"},Pt=["innerHTML"],Rt={key:0,class:"d2-error px-4 pb-3 text-xs"},we=ot(lt({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(p){const n=p,i=at(),w=rt(ut,null),{t:a}=it(),A=d(!1),k=d(!1),g=d(!1),h=d(!1),s=d(null),W=d(!1),j=d(""),ae=d(""),re=d(0),P=d(""),R=d(""),ee=d(null),ue=d(null),ie=d(null),Pe=st(),te=ct(),be=dt(),Y=d(null),ke=typeof window<"u",xe=d(!1),O=d(typeof window>"u"||!be.value),F=D(()=>{var t;return(t=n.node.code)!=null?t:""}),Re=D(()=>yt(n,i)),se=D(()=>{var t,e;return[n.isDark?"dark":"light",(t=n.themeId)!=null?t:"auto",(e=n.darkThemeId)!=null?e:"auto",F.value].join(":")}),ne=D(()=>!!j.value&&ae.value===se.value),Be=D(()=>{if(!xe.value||!F.value||g.value)return!1;const t=se.value;return!!W.value||P.value!==t&&(!s.value||R.value!==t)}),De=D(()=>ne.value||!!j.value&&Be.value),oe=D(()=>g.value||!h.value||!De.value),_e=D(()=>{if(oe.value&&ue.value)return{minHeight:`${ue.value}px`}}),Ue=D(()=>n.maxHeight==="none"?{maxHeight:"none"}:n.maxHeight!=null?{maxHeight:typeof n.maxHeight=="number"?`${n.maxHeight}px`:String(n.maxHeight)}:void 0);let x=null,ce=!1,_=!1,Ce=0,U=null,I=!1,$=null,C="";typeof window<"u"&&Z([()=>ie.value,be],([t,e])=>{var o,c,H;if((o=Y.value)==null||o.destroy(),Y.value=null,!e||O.value)return void(O.value=!0);if(!t)return void(O.value=!1);const S=(H=(c=te?.value.heavyBlockMargin)!=null?c:te?.value.rootMargin)!=null?H:"160px",V=Pe(t,{rootMargin:S,allowIdle:!1});Y.value=V,O.value=V.isVisible.value,V.whenVisible.then(()=>{O.value=!0})},{immediate:!0});const Ve={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Me(t){return!t||t.disabled}function M(t,e,o="top"){if(Me(t.currentTarget))return;const c=t,H=c?.clientX!=null&&c?.clientY!=null?{x:c.clientX,y:c.clientY}:void 0;Se(t.currentTarget,e,o,!1,H,n.isDark)}function b(){gt()}function Ee(t){if(Me(t.currentTarget))return;const e=A.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=t,c=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;Se(t.currentTarget,e,"top",!1,c,n.isDark)}function ze(){return ye(this,null,function*(){try{const t=F.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(t)),A.value=!0,setTimeout(()=>{A.value=!1},1e3)}catch(t){console.error("Copy failed:",t)}})}function Ye(){k.value=!k.value}function Te(t){g.value=t==="source"}const $e=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Xe(t){if(!t)return"";const e=t.trim();return qe.test(e)?e:""}function Ae(){j.value="",ae.value=""}function q(t){return _||t!==re.value}function Ge(){return ye(this,null,function*(){var t,e,o,c,H;if(!ke||_||!O.value||n.loading&&!n.progressiveRender)return;const S=se.value;if(S===P.value&&!s.value&&ne.value)return h.value=!0,void(n.loading&&(g.value=!1));const V=F.value;if(!V)return Ae(),s.value=null,P.value="",void(R.value="");const G=++re.value;W.value=!0,s.value=null,R.value="",(function(){const r=Re.value;w&&r&&C!==r&&(C&&w.markSettled(C),C=r,w.markPending(r))})();try{const r=yield(function(){return ye(this,null,function*(){if(x)return x;const l=yield ht();if(_||!l)return null;if(typeof l=="function"){const Q=new l;return Q&&typeof Q.compile=="function"?x=Q:typeof l.compile=="function"&&(x=l),x}return l?.D2&&typeof l.D2=="function"?(x=new l.D2,x):(typeof l.compile=="function"&&(x=l),x)})})();if(q(G))return;if(!r)return h.value=!1,g.value=!0,Ae(),s.value="D2 is not available.",void(R.value=S);if(typeof r.compile!="function"||typeof r.render!="function")throw new TypeError("D2 instance is missing compile/render methods.");h.value=!0;const y=yield r.compile(V);if(q(G))return;const le=(t=y?.diagram)!=null?t:y,B=(o=(e=y?.renderOptions)!=null?e:y?.options)!=null?o:{},Qe=(c=n.themeId)!=null?c:B.themeID,je=(H=n.darkThemeId)!=null?H:B.darkThemeID,J=he({},B);if(J.themeID=n.isDark&&je!=null?je:Qe,J.darkThemeID=null,J.darkThemeOverrides=null,n.isDark){const l=B.themeOverrides&&typeof B.themeOverrides=="object"?B.themeOverrides:null;J.themeOverrides=he(he({},Ve),l||{})}const Ke=yield r.render(le,J);if(q(G))return;const Oe=(function(l){return l?typeof l=="string"?l:typeof l.svg=="string"?l.svg:typeof l.data=="string"?l.data:"":""})(Ke);if(!Oe)throw new Error("D2 render returned empty output.");(function(l,Q){const Fe=(function(Ie){if(typeof window>"u"||typeof DOMParser>"u"||!Ie)return"";const Ze=Ie.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),ve=new DOMParser().parseFromString(Ze,"image/svg+xml").documentElement;if(!ve||ve.nodeName.toLowerCase()!=="svg")return"";const me=ve;return(function(He){const We=new Set(["script"]),et=[He,...Array.from(He.querySelectorAll("*"))];for(const L of et){if(We.has(L.tagName.toLowerCase())){L.remove();continue}const tt=Array.from(L.attributes);for(const z of tt){const E=z.name;if(/^on/i.test(E))L.removeAttribute(E);else{if(E==="style"&&z.value){const K=z.value;if($e.some(nt=>nt.test(K))){L.removeAttribute(E);continue}}if((E==="href"||E==="xlink:href")&&z.value){const K=Xe(z.value);if(!K){L.removeAttribute(E);continue}K!==z.value&&L.setAttribute(E,K)}}}}})(me),me.classList.add("markstream-d2-root-svg"),me.outerHTML})(l);j.value=Fe||"",ae.value=Fe?Q:""})(Oe,S),P.value=S,R.value="",n.loading&&(g.value=!1),s.value=null}catch(r){if(q(G))return;const y=r?.message?String(r.message):"D2 render failed.";n.loading||(s.value=y,R.value=S),P.value="",y.includes("@terrastruct/d2")&&(h.value=!1,g.value=!0)}finally{q(G)||(W.value=!1,I?(I=!1,X()):(function(){const r=C;w&&r&&(C="",fe(()=>{var y,le;if(!_){const B=(le=(y=ie.value)==null?void 0:y.offsetHeight)!=null?le:0;B>0&&w.reportHeight(r,B)}w.markSettled(r)}))})())}})}function X(t=!1){if(ce||!ke||_)return;if(W.value)return void(I=!0);const e=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-Ce;if(!t&&o{U=null,I&&(I=!1,X(!0))},Math.max(0,e-o))));ce=!0;const c=()=>{ce=!1,Ce=Date.now(),Ge()};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(c):setTimeout(c,0)}function Je(){if(ne.value)try{const t=new Blob([j.value],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t);if(typeof document<"u"){const o=document.createElement("a");o.href=e,o.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}URL.revokeObjectURL(e)}catch(t){console.error("Failed to export SVG:",t)}}function de(){const t=ee.value;if(!t)return;const e=t.getBoundingClientRect().height;e>0&&(ue.value=e)}return Z(()=>[n.node.code,n.loading,n.isDark,n.themeId,n.darkThemeId],()=>{X()},{immediate:!0}),Z(()=>n.loading,(t,e)=>{e&&!t&&X(!0)}),Z(()=>O.value,t=>{t&&X(!0)}),Z(()=>[oe.value,j.value,F.value],()=>{fe(()=>{de()})}),vt(()=>{xe.value=!0,fe(()=>{de()}),typeof ResizeObserver<"u"&&($=new ResizeObserver(()=>{de()}),ee.value&&$.observe(ee.value))}),mt(()=>{var t;_=!0,re.value+=1,I=!1,(function(){const e=C;w&&e&&(C="",w.markSettled(e))})(),P.value="",(t=Y.value)==null||t.destroy(),Y.value=null,U!=null&&(clearTimeout(U),U=null),$?.disconnect(),$=null}),(t,e)=>(v(),m("div",{ref_key:"viewportTarget",ref:ie,class:pe(["d2-block-container rounded-lg border overflow-hidden",{dark:n.isDark}]),"data-markstream-d2":"1","data-markstream-mode":oe.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[n.showHeader?(v(),m("div",Bt,[e[16]||(e[16]=u("div",{class:"flex items-center gap-x-2"},[u("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),u("div",Dt,[n.showModeToggle?(v(),m("div",Ct,[u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"":"is-active"]),onClick:e[0]||(e[0]=o=>Te("preview")),onMouseenter:e[1]||(e[1]=o=>M(o,f(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>M(o,f(a)("common.preview")||"Preview")),onMouseleave:b,onBlur:b},N(f(a)("common.preview")||"Preview"),35),u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"is-active":""]),onClick:e[3]||(e[3]=o=>Te("source")),onMouseenter:e[4]||(e[4]=o=>M(o,f(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>M(o,f(a)("common.source")||"Source")),onMouseleave:b,onBlur:b},N(f(a)("common.source")||"Source"),35)])):T("",!0),n.showCopyButton?(v(),m("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":A.value?f(a)("common.copied")||"Copied":f(a)("common.copy")||"Copy",onClick:ze,onMouseenter:e[6]||(e[6]=o=>Ee(o)),onFocus:e[7]||(e[7]=o=>Ee(o)),onMouseleave:b,onBlur:b},[A.value?(v(),m("svg",Tt,[...e[13]||(e[13]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),m("svg",Et,[...e[12]||(e[12]=[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),u("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Mt)):T("",!0),n.showExportButton&&ne.value?(v(),m("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":f(a)("common.export")||"Export",onClick:Je,onMouseenter:e[8]||(e[8]=o=>M(o,f(a)("common.export")||"Export")),onFocus:e[9]||(e[9]=o=>M(o,f(a)("common.export")||"Export")),onMouseleave:b,onBlur:b},[...e[14]||(e[14]=[u("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,At)):T("",!0),n.showCollapseButton?(v(),m("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":k.value,onClick:Ye,onMouseenter:e[10]||(e[10]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onFocus:e[11]||(e[11]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onMouseleave:b,onBlur:b},[(v(),m("svg",{style:ge({rotate:k.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[15]||(e[15]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,jt)):T("",!0)])])):T("",!0),ft(u("div",{ref_key:"bodyRef",ref:ee,class:"d2-block-body",style:ge(_e.value)},[n.loading&&!De.value?(v(),m("div",Ot,[u("pre",Ft,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",It,N(s.value),1)):T("",!0)])):(v(),m("div",Ht,[oe.value?(v(),m("div",St,[u("pre",Lt,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",Nt,N(s.value),1)):T("",!0)])):(v(),m("div",{key:1,class:"d2-render",style:ge(Ue.value)},[u("div",{class:"d2-svg",innerHTML:j.value},null,8,Pt),s.value?(v(),m("p",Rt,N(s.value),1)):T("",!0)],4))]))],4),[[pt,!k.value]])],10,xt))}}),[["__scopeId","data-v-3b434cf5"]]);we.install=p=>{p.component(we.__name,we)};export{we as default}; +import{bQ as ot,M as lt,bl as at,af as rt,bY as ut,b$ as it,c0 as st,c1 as ct,c2 as dt,aU as d,bE as Z,as as fe,aD as vt,az as mt,aL as v,u as m,v as u,bk as f,au as pe,bb as N,t as T,aw as ge,bL as ft,bB as pt,q as D,c7 as Se,c8 as gt,ca as ht,b_ as yt}from"./index-D-7nOosq.js";var wt=Object.defineProperty,Le=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,Ne=(p,n,i)=>n in p?wt(p,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[n]=i,he=(p,n)=>{for(var i in n||(n={}))bt.call(n,i)&&Ne(p,i,n[i]);if(Le)for(var i of Le(n))kt.call(n,i)&&Ne(p,i,n[i]);return p},ye=(p,n,i)=>new Promise((w,a)=>{var A=h=>{try{g(i.next(h))}catch(s){a(s)}},k=h=>{try{g(i.throw(h))}catch(s){a(s)}},g=h=>h.done?w(h.value):Promise.resolve(h.value).then(A,k);g((i=i.apply(p,n)).next())});const xt=["data-markstream-mode","data-markstream-pending"],Bt={key:0,class:"d2-block-header flex justify-between items-center border-b"},Dt={class:"d2-header-actions flex items-center"},Ct={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},Mt=["aria-label"],Et={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tt={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},At=["aria-label"],jt=["aria-pressed"],Ot={key:0,class:"d2-source"},Ft={class:"d2-code"},It={key:0,class:"d2-error mt-2 text-xs"},Ht={key:1},St={key:0,class:"d2-source"},Lt={class:"d2-code"},Nt={key:0,class:"d2-error mt-2 text-xs"},Pt=["innerHTML"],Rt={key:0,class:"d2-error px-4 pb-3 text-xs"},we=ot(lt({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(p){const n=p,i=at(),w=rt(ut,null),{t:a}=it(),A=d(!1),k=d(!1),g=d(!1),h=d(!1),s=d(null),W=d(!1),j=d(""),ae=d(""),re=d(0),P=d(""),R=d(""),ee=d(null),ue=d(null),ie=d(null),Pe=st(),te=ct(),be=dt(),Y=d(null),ke=typeof window<"u",xe=d(!1),O=d(typeof window>"u"||!be.value),F=D(()=>{var t;return(t=n.node.code)!=null?t:""}),Re=D(()=>yt(n,i)),se=D(()=>{var t,e;return[n.isDark?"dark":"light",(t=n.themeId)!=null?t:"auto",(e=n.darkThemeId)!=null?e:"auto",F.value].join(":")}),ne=D(()=>!!j.value&&ae.value===se.value),Be=D(()=>{if(!xe.value||!F.value||g.value)return!1;const t=se.value;return!!W.value||P.value!==t&&(!s.value||R.value!==t)}),De=D(()=>ne.value||!!j.value&&Be.value),oe=D(()=>g.value||!h.value||!De.value),_e=D(()=>{if(oe.value&&ue.value)return{minHeight:`${ue.value}px`}}),Ue=D(()=>n.maxHeight==="none"?{maxHeight:"none"}:n.maxHeight!=null?{maxHeight:typeof n.maxHeight=="number"?`${n.maxHeight}px`:String(n.maxHeight)}:void 0);let x=null,ce=!1,_=!1,Ce=0,U=null,I=!1,$=null,C="";typeof window<"u"&&Z([()=>ie.value,be],([t,e])=>{var o,c,H;if((o=Y.value)==null||o.destroy(),Y.value=null,!e||O.value)return void(O.value=!0);if(!t)return void(O.value=!1);const S=(H=(c=te?.value.heavyBlockMargin)!=null?c:te?.value.rootMargin)!=null?H:"160px",V=Pe(t,{rootMargin:S,allowIdle:!1});Y.value=V,O.value=V.isVisible.value,V.whenVisible.then(()=>{O.value=!0})},{immediate:!0});const Ve={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Me(t){return!t||t.disabled}function M(t,e,o="top"){if(Me(t.currentTarget))return;const c=t,H=c?.clientX!=null&&c?.clientY!=null?{x:c.clientX,y:c.clientY}:void 0;Se(t.currentTarget,e,o,!1,H,n.isDark)}function b(){gt()}function Ee(t){if(Me(t.currentTarget))return;const e=A.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=t,c=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;Se(t.currentTarget,e,"top",!1,c,n.isDark)}function ze(){return ye(this,null,function*(){try{const t=F.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(t)),A.value=!0,setTimeout(()=>{A.value=!1},1e3)}catch(t){console.error("Copy failed:",t)}})}function Ye(){k.value=!k.value}function Te(t){g.value=t==="source"}const $e=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Xe(t){if(!t)return"";const e=t.trim();return qe.test(e)?e:""}function Ae(){j.value="",ae.value=""}function q(t){return _||t!==re.value}function Ge(){return ye(this,null,function*(){var t,e,o,c,H;if(!ke||_||!O.value||n.loading&&!n.progressiveRender)return;const S=se.value;if(S===P.value&&!s.value&&ne.value)return h.value=!0,void(n.loading&&(g.value=!1));const V=F.value;if(!V)return Ae(),s.value=null,P.value="",void(R.value="");const G=++re.value;W.value=!0,s.value=null,R.value="",(function(){const r=Re.value;w&&r&&C!==r&&(C&&w.markSettled(C),C=r,w.markPending(r))})();try{const r=yield(function(){return ye(this,null,function*(){if(x)return x;const l=yield ht();if(_||!l)return null;if(typeof l=="function"){const Q=new l;return Q&&typeof Q.compile=="function"?x=Q:typeof l.compile=="function"&&(x=l),x}return l?.D2&&typeof l.D2=="function"?(x=new l.D2,x):(typeof l.compile=="function"&&(x=l),x)})})();if(q(G))return;if(!r)return h.value=!1,g.value=!0,Ae(),s.value="D2 is not available.",void(R.value=S);if(typeof r.compile!="function"||typeof r.render!="function")throw new TypeError("D2 instance is missing compile/render methods.");h.value=!0;const y=yield r.compile(V);if(q(G))return;const le=(t=y?.diagram)!=null?t:y,B=(o=(e=y?.renderOptions)!=null?e:y?.options)!=null?o:{},Qe=(c=n.themeId)!=null?c:B.themeID,je=(H=n.darkThemeId)!=null?H:B.darkThemeID,J=he({},B);if(J.themeID=n.isDark&&je!=null?je:Qe,J.darkThemeID=null,J.darkThemeOverrides=null,n.isDark){const l=B.themeOverrides&&typeof B.themeOverrides=="object"?B.themeOverrides:null;J.themeOverrides=he(he({},Ve),l||{})}const Ke=yield r.render(le,J);if(q(G))return;const Oe=(function(l){return l?typeof l=="string"?l:typeof l.svg=="string"?l.svg:typeof l.data=="string"?l.data:"":""})(Ke);if(!Oe)throw new Error("D2 render returned empty output.");(function(l,Q){const Fe=(function(Ie){if(typeof window>"u"||typeof DOMParser>"u"||!Ie)return"";const Ze=Ie.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),ve=new DOMParser().parseFromString(Ze,"image/svg+xml").documentElement;if(!ve||ve.nodeName.toLowerCase()!=="svg")return"";const me=ve;return(function(He){const We=new Set(["script"]),et=[He,...Array.from(He.querySelectorAll("*"))];for(const L of et){if(We.has(L.tagName.toLowerCase())){L.remove();continue}const tt=Array.from(L.attributes);for(const z of tt){const E=z.name;if(/^on/i.test(E))L.removeAttribute(E);else{if(E==="style"&&z.value){const K=z.value;if($e.some(nt=>nt.test(K))){L.removeAttribute(E);continue}}if((E==="href"||E==="xlink:href")&&z.value){const K=Xe(z.value);if(!K){L.removeAttribute(E);continue}K!==z.value&&L.setAttribute(E,K)}}}}})(me),me.classList.add("markstream-d2-root-svg"),me.outerHTML})(l);j.value=Fe||"",ae.value=Fe?Q:""})(Oe,S),P.value=S,R.value="",n.loading&&(g.value=!1),s.value=null}catch(r){if(q(G))return;const y=r?.message?String(r.message):"D2 render failed.";n.loading||(s.value=y,R.value=S),P.value="",y.includes("@terrastruct/d2")&&(h.value=!1,g.value=!0)}finally{q(G)||(W.value=!1,I?(I=!1,X()):(function(){const r=C;w&&r&&(C="",fe(()=>{var y,le;if(!_){const B=(le=(y=ie.value)==null?void 0:y.offsetHeight)!=null?le:0;B>0&&w.reportHeight(r,B)}w.markSettled(r)}))})())}})}function X(t=!1){if(ce||!ke||_)return;if(W.value)return void(I=!0);const e=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-Ce;if(!t&&o{U=null,I&&(I=!1,X(!0))},Math.max(0,e-o))));ce=!0;const c=()=>{ce=!1,Ce=Date.now(),Ge()};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(c):setTimeout(c,0)}function Je(){if(ne.value)try{const t=new Blob([j.value],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t);if(typeof document<"u"){const o=document.createElement("a");o.href=e,o.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}URL.revokeObjectURL(e)}catch(t){console.error("Failed to export SVG:",t)}}function de(){const t=ee.value;if(!t)return;const e=t.getBoundingClientRect().height;e>0&&(ue.value=e)}return Z(()=>[n.node.code,n.loading,n.isDark,n.themeId,n.darkThemeId],()=>{X()},{immediate:!0}),Z(()=>n.loading,(t,e)=>{e&&!t&&X(!0)}),Z(()=>O.value,t=>{t&&X(!0)}),Z(()=>[oe.value,j.value,F.value],()=>{fe(()=>{de()})}),vt(()=>{xe.value=!0,fe(()=>{de()}),typeof ResizeObserver<"u"&&($=new ResizeObserver(()=>{de()}),ee.value&&$.observe(ee.value))}),mt(()=>{var t;_=!0,re.value+=1,I=!1,(function(){const e=C;w&&e&&(C="",w.markSettled(e))})(),P.value="",(t=Y.value)==null||t.destroy(),Y.value=null,U!=null&&(clearTimeout(U),U=null),$?.disconnect(),$=null}),(t,e)=>(v(),m("div",{ref_key:"viewportTarget",ref:ie,class:pe(["d2-block-container rounded-lg border overflow-hidden",{dark:n.isDark}]),"data-markstream-d2":"1","data-markstream-mode":oe.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[n.showHeader?(v(),m("div",Bt,[e[16]||(e[16]=u("div",{class:"flex items-center gap-x-2"},[u("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),u("div",Dt,[n.showModeToggle?(v(),m("div",Ct,[u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"":"is-active"]),onClick:e[0]||(e[0]=o=>Te("preview")),onMouseenter:e[1]||(e[1]=o=>M(o,f(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>M(o,f(a)("common.preview")||"Preview")),onMouseleave:b,onBlur:b},N(f(a)("common.preview")||"Preview"),35),u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"is-active":""]),onClick:e[3]||(e[3]=o=>Te("source")),onMouseenter:e[4]||(e[4]=o=>M(o,f(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>M(o,f(a)("common.source")||"Source")),onMouseleave:b,onBlur:b},N(f(a)("common.source")||"Source"),35)])):T("",!0),n.showCopyButton?(v(),m("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":A.value?f(a)("common.copied")||"Copied":f(a)("common.copy")||"Copy",onClick:ze,onMouseenter:e[6]||(e[6]=o=>Ee(o)),onFocus:e[7]||(e[7]=o=>Ee(o)),onMouseleave:b,onBlur:b},[A.value?(v(),m("svg",Tt,[...e[13]||(e[13]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),m("svg",Et,[...e[12]||(e[12]=[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),u("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Mt)):T("",!0),n.showExportButton&&ne.value?(v(),m("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":f(a)("common.export")||"Export",onClick:Je,onMouseenter:e[8]||(e[8]=o=>M(o,f(a)("common.export")||"Export")),onFocus:e[9]||(e[9]=o=>M(o,f(a)("common.export")||"Export")),onMouseleave:b,onBlur:b},[...e[14]||(e[14]=[u("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,At)):T("",!0),n.showCollapseButton?(v(),m("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":k.value,onClick:Ye,onMouseenter:e[10]||(e[10]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onFocus:e[11]||(e[11]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onMouseleave:b,onBlur:b},[(v(),m("svg",{style:ge({rotate:k.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[15]||(e[15]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,jt)):T("",!0)])])):T("",!0),ft(u("div",{ref_key:"bodyRef",ref:ee,class:"d2-block-body",style:ge(_e.value)},[n.loading&&!De.value?(v(),m("div",Ot,[u("pre",Ft,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",It,N(s.value),1)):T("",!0)])):(v(),m("div",Ht,[oe.value?(v(),m("div",St,[u("pre",Lt,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",Nt,N(s.value),1)):T("",!0)])):(v(),m("div",{key:1,class:"d2-render",style:ge(Ue.value)},[u("div",{class:"d2-svg",innerHTML:j.value},null,8,Pt),s.value?(v(),m("p",Rt,N(s.value),1)):T("",!0)],4))]))],4),[[pt,!k.value]])],10,xt))}}),[["__scopeId","data-v-3b434cf5"]]);we.install=p=>{p.component(we.__name,we)};export{we as default}; diff --git a/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-D1xLYfmf.js b/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js similarity index 69% rename from apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-D1xLYfmf.js rename to apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js index 6157f3f73b7..a37e1ec6400 100644 --- a/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-D1xLYfmf.js +++ b/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js @@ -1,2 +1,2 @@ -import{_ as a,l as s,F as n,e as i}from"./mermaid.core-Cahi9cr1.js";import{p}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var g={parse:a(async r=>{const e=await p("info",r);s.debug(e)},"parse")},v={version:"11.16.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,o)=>{s.debug(`rendering info diagram +import{_ as a,l as s,F as n,e as i}from"./mermaid.core-CJB1tAev.js";import{p}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var g={parse:a(async r=>{const e=await p("info",r);s.debug(e)},"parse")},v={version:"11.16.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,o)=>{s.debug(`rendering info diagram `+r);const t=n(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),l={draw:c},w={parser:g,db:m,renderer:l};export{w as diagram}; diff --git a/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BpjBlRoK.js b/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js similarity index 99% rename from apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BpjBlRoK.js rename to apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js index 6b72f81f895..45e219b383b 100644 --- a/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BpjBlRoK.js +++ b/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js @@ -1,4 +1,4 @@ -import{_ as l,c as lt,a1 as ct,F as ut,al as dt,q as yt,k as ft,o as et,a as pt,b as gt,g as kt,s as mt,p as wt,e as _t}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var Q=(function(){var t=l(function(T,e,s,i){for(s=s||{},i=T.length;i--;s[T[i]]=e);return s},"o"),d=[1,4],n=[1,14],a=[1,12],o=[1,13],y=[6,7,8],p=[1,20],u=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],D={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:l(function(e,s,i,h,f,r,v){var w=r.length-1;switch(f){case 6:case 7:return h;case 15:h.addNode(r[w-1].length,r[w].trim());break;case 16:h.addNode(0,r[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:d},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:d},{6:n,7:[1,10],9:9,12:11,13:a,14:o},t(y,[2,3]),{1:[2,2]},t(y,[2,4]),t(y,[2,5]),{1:[2,6],6:n,12:15,13:a,14:o},{6:n,9:16,12:11,13:a,14:o},{6:p,7:u,10:17,11:m},t(c,[2,18],{14:[1,21]}),t(c,[2,16]),t(c,[2,17]),{6:p,7:u,10:22,11:m},{1:[2,7],6:n,12:15,13:a,14:o},t(k,[2,14],{7:g,11:_}),t(x,[2,8]),t(x,[2,9]),t(x,[2,10]),t(c,[2,15]),t(k,[2,13],{7:g,11:_}),t(x,[2,11]),t(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(e,s){if(s.recoverable)this.trace(e);else{var i=new Error(e);throw i.hash=s,i}},"parseError"),parse:l(function(e){var s=this,i=[0],h=[],f=[null],r=[],v=this.table,w="",I=0,$=0,L=2,A=1,C=r.slice.call(arguments,1),b=Object.create(this.lexer),S={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(S.yy[P]=this.yy[P]);b.setInput(e,S.yy),S.yy.lexer=b,S.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var R=b.yylloc;r.push(R);var H=b.options&&b.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(B){i.length=i.length-2*B,f.length=f.length-B,r.length=r.length-B}l(X,"popStack");function J(){var B;return B=h.pop()||b.lex()||A,typeof B!="number"&&(B instanceof Array&&(h=B,B=h.pop()),B=s.symbols_[B]||B),B}l(J,"lex");for(var M,F,N,Y,W={},G,V,tt,U;;){if(F=i[i.length-1],this.defaultActions[F]?N=this.defaultActions[F]:((M===null||typeof M>"u")&&(M=J()),N=v[F]&&v[F][M]),typeof N>"u"||!N.length||!N[0]){var q="";U=[];for(G in v[F])this.terminals_[G]&&G>L&&U.push("'"+this.terminals_[G]+"'");b.showPosition?q="Parse error on line "+(I+1)+`: +import{_ as l,c as lt,a1 as ct,F as ut,al as dt,q as yt,k as ft,o as et,a as pt,b as gt,g as kt,s as mt,p as wt,e as _t}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var Q=(function(){var t=l(function(T,e,s,i){for(s=s||{},i=T.length;i--;s[T[i]]=e);return s},"o"),d=[1,4],n=[1,14],a=[1,12],o=[1,13],y=[6,7,8],p=[1,20],u=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],D={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:l(function(e,s,i,h,f,r,v){var w=r.length-1;switch(f){case 6:case 7:return h;case 15:h.addNode(r[w-1].length,r[w].trim());break;case 16:h.addNode(0,r[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:d},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:d},{6:n,7:[1,10],9:9,12:11,13:a,14:o},t(y,[2,3]),{1:[2,2]},t(y,[2,4]),t(y,[2,5]),{1:[2,6],6:n,12:15,13:a,14:o},{6:n,9:16,12:11,13:a,14:o},{6:p,7:u,10:17,11:m},t(c,[2,18],{14:[1,21]}),t(c,[2,16]),t(c,[2,17]),{6:p,7:u,10:22,11:m},{1:[2,7],6:n,12:15,13:a,14:o},t(k,[2,14],{7:g,11:_}),t(x,[2,8]),t(x,[2,9]),t(x,[2,10]),t(c,[2,15]),t(k,[2,13],{7:g,11:_}),t(x,[2,11]),t(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(e,s){if(s.recoverable)this.trace(e);else{var i=new Error(e);throw i.hash=s,i}},"parseError"),parse:l(function(e){var s=this,i=[0],h=[],f=[null],r=[],v=this.table,w="",I=0,$=0,L=2,A=1,C=r.slice.call(arguments,1),b=Object.create(this.lexer),S={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(S.yy[P]=this.yy[P]);b.setInput(e,S.yy),S.yy.lexer=b,S.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var R=b.yylloc;r.push(R);var H=b.options&&b.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(B){i.length=i.length-2*B,f.length=f.length-B,r.length=r.length-B}l(X,"popStack");function J(){var B;return B=h.pop()||b.lex()||A,typeof B!="number"&&(B instanceof Array&&(h=B,B=h.pop()),B=s.symbols_[B]||B),B}l(J,"lex");for(var M,F,N,Y,W={},G,V,tt,U;;){if(F=i[i.length-1],this.defaultActions[F]?N=this.defaultActions[F]:((M===null||typeof M>"u")&&(M=J()),N=v[F]&&v[F][M]),typeof N>"u"||!N.length||!N[0]){var q="";U=[];for(G in v[F])this.terminals_[G]&&G>L&&U.push("'"+this.terminals_[G]+"'");b.showPosition?q="Parse error on line "+(I+1)+`: `+b.showPosition()+` Expecting `+U.join(", ")+", got '"+(this.terminals_[M]||M)+"'":q="Parse error on line "+(I+1)+": Unexpected "+(M==A?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(q,{text:b.match,token:this.terminals_[M]||M,line:b.yylineno,loc:R,expected:U})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+F+", token: "+M);switch(N[0]){case 1:i.push(M),f.push(b.yytext),r.push(b.yylloc),i.push(N[1]),M=null,$=b.yyleng,w=b.yytext,I=b.yylineno,R=b.yylloc;break;case 2:if(V=this.productions_[N[1]][1],W.$=f[f.length-V],W._$={first_line:r[r.length-(V||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(V||1)].first_column,last_column:r[r.length-1].last_column},H&&(W._$.range=[r[r.length-(V||1)].range[0],r[r.length-1].range[1]]),Y=this.performAction.apply(W,[w,$,I,S.yy,N[1],f,r].concat(C)),typeof Y<"u")return Y;V&&(i=i.slice(0,-1*V*2),f=f.slice(0,-1*V),r=r.slice(0,-1*V)),i.push(this.productions_[N[1]][0]),f.push(W.$),r.push(W._$),tt=v[i[i.length-2]][i[i.length-1]],i.push(tt);break;case 3:return!0}}return!0},"parse")},O=(function(){var T={EOF:1,parseError:l(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:l(function(e,s){return this.yy=s||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var s=e.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},"input"),unput:l(function(e){var s=e.length,i=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var h=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===h.length?this.yylloc.first_column:0)+h[h.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(e){this.unput(this.match.slice(e))},"less"),pastInput:l(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var e=this.pastInput(),s=new Array(e.length+1).join("-");return e+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DW8NrHP6.js b/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js similarity index 98% rename from apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DW8NrHP6.js rename to apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js index 5cb46c5002d..81454d20249 100644 --- a/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DW8NrHP6.js +++ b/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js @@ -1,4 +1,4 @@ -import{g as gt}from"./chunk-5VM5RSS4-CfD0Yt-O.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-32BRIVSS-DAsxL712.js";import{g as _t,s as vt,a as bt,b as wt,p as Tt,o as St,_ as s,c as R,d as X,e as $t,q as Mt}from"./mermaid.core-Cahi9cr1.js";import{d as it}from"./arc-E_7M-TWh.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +import{g as gt}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-32BRIVSS-DUDRPqmY.js";import{g as _t,s as vt,a as bt,b as wt,p as Tt,o as St,_ as s,c as R,d as X,e as $t,q as Mt}from"./mermaid.core-CJB1tAev.js";import{d as it}from"./arc-IkhU3FHH.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: `+_.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-DBZtJFK7.js b/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js similarity index 99% rename from apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-DBZtJFK7.js rename to apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js index e4081f2b882..a53d9abeab9 100644 --- a/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-DBZtJFK7.js +++ b/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js @@ -1,4 +1,4 @@ -import{_ as o,l as te,c as H,F as fe,af as ye,ag as be,ah as me,ad as _e,D as Y,i as j,Y as ke,Z as Ee,aa as Se,ab as ce,ac as le}from"./mermaid.core-Cahi9cr1.js";import{g as Ne}from"./chunk-5VM5RSS4-CfD0Yt-O.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var $=(function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),h=[1,4],p=[1,13],s=[1,12],d=[1,15],_=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],k=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,u,t,U){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(k,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(k,[2,19]),e(k,[2,21],{15:30,24:G}),e(k,[2,22]),e(k,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(k,[2,16],{15:37,24:G}),e(k,[2,17]),e(k,[2,18]),e(k,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(k,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],u=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(i,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Z=b.yylloc;t.push(Z);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var E,P,x,q,F={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=ae()),x=U[P]&&U[P][E]),typeof x>"u"||!x.length||!x[0]){var Q="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Q="Parse error on line "+(W+1)+`: +import{_ as o,l as te,c as H,F as fe,af as ye,ag as be,ah as me,ad as _e,D as Y,i as j,Y as ke,Z as Ee,aa as Se,ab as ce,ac as le}from"./mermaid.core-CJB1tAev.js";import{g as Ne}from"./chunk-5VM5RSS4-yyj9cAyF.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var $=(function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),h=[1,4],p=[1,13],s=[1,12],d=[1,15],_=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],k=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,u,t,U){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(k,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(k,[2,19]),e(k,[2,21],{15:30,24:G}),e(k,[2,22]),e(k,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(k,[2,16],{15:37,24:G}),e(k,[2,17]),e(k,[2,18]),e(k,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(k,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],u=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(i,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Z=b.yylloc;t.push(Z);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var E,P,x,q,F={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=ae()),x=U[P]&&U[P][E]),typeof x>"u"||!x.length||!x[0]){var Q="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Q="Parse error on line "+(W+1)+`: `+b.showPosition()+` Expecting `+X.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Q="Parse error on line "+(W+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[E]||E,line:b.yylineno,loc:Z,expected:X})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(x[0]){case 1:r.push(E),u.push(b.yytext),t.push(b.yylloc),r.push(x[1]),E=null,se=b.yyleng,c=b.yytext,W=b.yylineno,Z=b.yylloc;break;case 2:if(C=this.productions_[x[1]][1],F.$=u[u.length-C],F._$={first_line:t[t.length-(C||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(C||1)].first_column,last_column:t[t.length-1].last_column},de&&(F._$.range=[t[t.length-(C||1)].range[0],t[t.length-1].range[1]]),q=this.performAction.apply(F,[c,se,W,R.yy,x[1],u,t].concat(ge)),typeof q<"u")return q;C&&(r=r.slice(0,-1*C*2),u=u.slice(0,-1*C),t=t.slice(0,-1*C)),r.push(this.productions_[x[1]][0]),u.push(F.$),t.push(F._$),oe=U[r[r.length-2]][r[r.length-1]],r.push(oe);break;case 3:return!0}}return!0},"parse")},K=(function(){var O={EOF:1,parseError:o(function(n,r){if(this.yy.parser)this.yy.parser.parseError(n,r);else throw new Error(n)},"parseError"),setInput:o(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var n=i.length,r=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/linear-DHRafvZW.js b/apps/kimi-code/dist-web/assets/linear-DH49UJnN.js similarity index 98% rename from apps/kimi-code/dist-web/assets/linear-DHRafvZW.js rename to apps/kimi-code/dist-web/assets/linear-DH49UJnN.js index e0eca7d3d62..e3bd183a14b 100644 --- a/apps/kimi-code/dist-web/assets/linear-DHRafvZW.js +++ b/apps/kimi-code/dist-web/assets/linear-DH49UJnN.js @@ -1 +1 @@ -import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core-Cahi9cr1.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; +import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core-CJB1tAev.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; diff --git a/apps/kimi-code/dist-web/assets/mermaid.core-Cahi9cr1.js b/apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js similarity index 99% rename from apps/kimi-code/dist-web/assets/mermaid.core-Cahi9cr1.js rename to apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js index 0a0042e8954..9cd1ef69115 100644 --- a/apps/kimi-code/dist-web/assets/mermaid.core-Cahi9cr1.js +++ b/apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-VKFMJZFB-CDFnWuZ_.js","assets/chunk-RYQCIY6F-BHZEnq1y.js","assets/graph-DOmOIIwC.js","assets/map-DxJ2ADlA.js","assets/layout-D-LzfAck.js","assets/index-HRJ6xRtC.js","assets/index-vdPxBs-i.css","assets/_commonjsHelpers-CqkleIqs.js","assets/swimlanes-5IMT3BWC-DIbCJfLo.js","assets/cose-bilkent-JH36ORCC-B4N3AGR7.js","assets/cytoscape.esm-OyMbaexL.js","assets/c4Diagram-LMCZKHZV-BvJQmgsI.js","assets/chunk-32BRIVSS-DAsxL712.js","assets/flowDiagram-23GEKE2U-BJ9xq3_H.js","assets/chunk-5VM5RSS4-CfD0Yt-O.js","assets/chunk-XXDRQBXY-BmzWd-kT.js","assets/chunk-VR4S4FIN-he8WxbY-.js","assets/channel-Bob_1R_C.js","assets/swimlanesDiagram-G3AALYLV-DRwlvM9F.js","assets/erDiagram-Q63AITRT-MX1lpdtV.js","assets/gitGraphDiagram-IHSO6WYX-BO6zli_L.js","assets/chunk-2Q5K7J3B-B47YykJY.js","assets/chunk-JWPE2WC7-DTx-f56M.js","assets/cynefin-VYW2F7L2-C5gNr-Q4.js","assets/ganttDiagram-NO4QXBWP-UHBCrlBo.js","assets/linear-DHRafvZW.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-FWYZ7A6U-D1xLYfmf.js","assets/pieDiagram-ENE6RG2P-D4ADRI8d.js","assets/arc-E_7M-TWh.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-ABIIQ3AL-DM_U-KIt.js","assets/xychartDiagram-FW5EYKEG-DJUplk_O.js","assets/requirementDiagram-TGXJPOKE-CxBcxos4.js","assets/sequenceDiagram-DBY2YBRQ-ne5mKmWY.js","assets/classDiagram-OUVF2IWQ-FzVd5qC_.js","assets/chunk-V7JOEXUC-DjiRieSh.js","assets/classDiagram-v2-EOCWNBFH-FzVd5qC_.js","assets/stateDiagram-2N3HPSRC-wqCW5C6q.js","assets/chunk-EX3LRPZG-DGM3fHaz.js","assets/stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js","assets/journeyDiagram-5HDEW3XC-DW8NrHP6.js","assets/timeline-definition-FHXFAJF6-DRuJB2Ns.js","assets/mindmap-definition-LN4V7U3C-FiRh3KHx.js","assets/kanban-definition-HUTT4EX6-DBZtJFK7.js","assets/sankeyDiagram-HTMAVEWB-DQOKpLQv.js","assets/diagram-NH7WQ7WH-iqDRMohg.js","assets/diagram-WEI45ONY-lGPhYqjp.js","assets/blockDiagram-677ZJIJ3-CpvS2-LC.js","assets/diagram-OA4YK3LP-DSnuTLFG.js","assets/architectureDiagram-ZJ3FMSHR-CEA-tR1m.js","assets/diagram-FQU43EPY-Cqley8W-.js","assets/ishikawaDiagram-FXEZZL3T-BpjBlRoK.js","assets/vennDiagram-L72KCM5P-DtEwf89X.js","assets/diagram-G47NLZAW-jJWknpV7.js","assets/wardleyDiagram-EHGQE667-BQgMNH39.js","assets/cynefinDiagram-TSTJHNR4-DZWywj_D.js","assets/railroadDiagram-RFXS5EU6-DemW1ILD.js","assets/chunk-MOJQB5TN-hIDvr-8C.js","assets/ebnfDiagram-CCIWWBDH-DWQayqTx.js","assets/abnfDiagram-VRR7QNED-D_3zPyPt.js","assets/pegDiagram-2B236MQR-DCy00Y6H.js"])))=>i.map(i=>d[i]); -import{bR as nt}from"./index-HRJ6xRtC.js";import{g as gy}from"./_commonjsHelpers-CqkleIqs.js";var _c=Object.defineProperty,p=(e,t)=>_c(e,"name",{value:t,configurable:!0}),my=(e,t)=>{for(var r in t)_c(e,r,{get:t[r],enumerable:!0})},So={exports:{}},yy=So.exports,zl;function Cy(){return zl||(zl=1,(function(e,t){(function(r,i){e.exports=i()})(yy,(function(){var r=1e3,i=6e4,o=36e5,s="millisecond",a="second",n="minute",l="hour",c="day",h="week",d="month",f="quarter",u="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var A=["th","st","nd","rd"],F=$%100;return"["+$+(A[(F-20)%10]||A[F]||A[0])+"]"}},k=function($,A,F){var D=String($);return!D||D.length>=A?$:""+Array(A+1-D.length).join(F)+$},T={s:k,z:function($){var A=-$.utcOffset(),F=Math.abs(A),D=Math.floor(F/60),M=F%60;return(A<=0?"+":"-")+k(D,2,"0")+":"+k(M,2,"0")},m:function $(A,F){if(A.date()1)return $(Y[0])}else{var G=A.name;_[G]=A,M=G}return!D&&M&&(S=M),M||!D&&S},R=function($,A){if(v($))return $.clone();var F=typeof A=="object"?A:{};return F.date=$,F.args=arguments,new z(F)},P=T;P.l=N,P.i=v,P.w=function($,A){return R($,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var z=(function(){function $(F){this.$L=N(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[L]=!0}var A=$.prototype;return A.parse=function(F){this.$d=(function(D){var M=D.date,H=D.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(y);if(Y){var G=Y[2]-1||0,lt=(Y[7]||"0").substring(0,3);return H?new Date(Date.UTC(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)):new Date(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)}}return new Date(M)})(F),this.init()},A.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},A.$utils=function(){return P},A.isValid=function(){return this.$d.toString()!==m},A.isSame=function(F,D){var M=R(F);return this.startOf(D)<=M&&M<=this.endOf(D)},A.isAfter=function(F,D){return R(F){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Cn=p(function(e="fatal"){let t=Ne.fatal;typeof e=="string"?e.toLowerCase()in Ne&&(t=Ne[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=Ne.fatal&&(q.fatal=console.error?console.error.bind(console,he("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",he("FATAL"))),t<=Ne.error&&(q.error=console.error?console.error.bind(console,he("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",he("ERROR"))),t<=Ne.warn&&(q.warn=console.warn?console.warn.bind(console,he("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",he("WARN"))),t<=Ne.info&&(q.info=console.info?console.info.bind(console,he("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",he("INFO"))),t<=Ne.debug&&(q.debug=console.debug?console.debug.bind(console,he("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("DEBUG"))),t<=Ne.trace&&(q.trace=console.debug?console.debug.bind(console,he("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("TRACE")))},"setLogLevel"),he=p(e=>`%c${by().format("ss.SSS")} : ${e} : `,"format");const _o={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const o=r<.5?r*(1+t):r+t-r*t,s=2*r-o;switch(i){case"r":return _o.hue2rgb(s,o,e+1/3)*255;case"g":return _o.hue2rgb(s,o,e)*255;case"b":return _o.hue2rgb(s,o,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const o=Math.max(e,t,r),s=Math.min(e,t,r),a=(o+s)/2;if(i==="l")return a*100;if(o===s)return 0;const n=o-s,l=a>.5?n/(2-o-s):n/(o+s);if(i==="s")return l*100;switch(o){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},wy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},at={channel:_o,lang:ky,unit:wy},Je={};for(let e=0;e<=255;e++)Je[e]=at.unit.dec2hex(e);const Gt={ALL:0,RGB:1,HSL:2};class Ty{constructor(){this.type=Gt.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Gt.ALL}is(t){return this.type===t}}class Sy{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Ty}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Gt.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:o}=t;r===void 0&&(t.h=at.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=at.channel.rgb2hsl(t,"s")),o===void 0&&(t.l=at.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:o}=t;r===void 0&&(t.r=at.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=at.channel.hsl2rgb(t,"g")),o===void 0&&(t.b=at.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Gt.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Gt.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Gt.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Gt.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Gt.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Gt.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const gs=new Sy({r:0,g:0,b:0,a:0},"transparent"),Xr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Xr.re);if(!t)return;const r=t[1],i=parseInt(r,16),o=r.length,s=o%4===0,a=o>4,n=a?1:17,l=a?8:4,c=s?0:-1,h=a?255:15;return gs.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:s?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}${Je[Math.round(o*255)]}`:`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}`}},Cr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Cr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return at.channel.clamp.h(parseFloat(r)*.9);case"rad":return at.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return at.channel.clamp.h(parseFloat(r)*360)}}return at.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Cr.re);if(!r)return;const[,i,o,s,a,n]=r;return gs.set({h:Cr._hue2deg(i),s:at.channel.clamp.s(parseFloat(o)),l:at.channel.clamp.l(parseFloat(s)),a:a?at.channel.clamp.a(n?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:o}=e;return o<1?`hsla(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%, ${o})`:`hsl(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%)`}},Ei={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Ei.colors[e];if(t)return Xr.parse(t)},stringify:e=>{const t=Xr.stringify(e);for(const r in Ei.colors)if(Ei.colors[r]===t)return r}},wi={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(wi.re);if(!r)return;const[,i,o,s,a,n,l,c,h]=r;return gs.set({r:at.channel.clamp.r(o?parseFloat(i)*2.55:parseFloat(i)),g:at.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:at.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?at.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`rgba(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)}, ${at.lang.round(o)})`:`rgb(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)})`}},Ee={format:{keyword:Ei,hex:Xr,rgb:wi,rgba:wi,hsl:Cr,hsla:Cr},parse:e=>{if(typeof e!="string")return e;const t=Xr.parse(e)||wi.parse(e)||Cr.parse(e)||Ei.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Gt.HSL)||e.data.r===void 0?Cr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?wi.stringify(e):Xr.stringify(e)},Bc=(e,t)=>{const r=Ee.parse(e);for(const i in t)r[i]=at.channel.clamp[i](t[i]);return Ee.stringify(r)},or=(e,t,r=0,i=1)=>{if(typeof e!="number")return Bc(e,{a:t});const o=gs.set({r:at.channel.clamp.r(e),g:at.channel.clamp.g(t),b:at.channel.clamp.b(r),a:at.channel.clamp.a(i)});return Ee.stringify(o)},_y=e=>{const{r:t,g:r,b:i}=Ee.parse(e),o=.2126*at.channel.toLinear(t)+.7152*at.channel.toLinear(r)+.0722*at.channel.toLinear(i);return at.lang.round(o)},By=e=>_y(e)>=.5,ke=e=>!By(e),vc=(e,t,r)=>{const i=Ee.parse(e),o=i[t],s=at.channel.clamp[t](o+r);return o!==s&&(i[t]=s),Ee.stringify(i)},O=(e,t)=>vc(e,"l",t),I=(e,t)=>vc(e,"l",-t),x=(e,t)=>{const r=Ee.parse(e),i={};for(const o in t)t[o]&&(i[o]=r[o]+t[o]);return Bc(e,i)},vy=(e,t,r=50)=>{const{r:i,g:o,b:s,a}=Ee.parse(e),{r:n,g:l,b:c,a:h}=Ee.parse(t),d=r/100,f=d*2-1,u=a-h,m=((f*u===-1?f:(f+u)/(1+f*u))+1)/2,y=1-m,C=i*m+n*y,b=o*m+l*y,k=s*m+c*y,T=a*d+h*(1-d);return or(C,b,k,T)},B=(e,t=100)=>{const r=Ee.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,vy(r,e,t)};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Hl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);ri.map(i=>d[i]); +import{bR as nt}from"./index-D-7nOosq.js";import{g as gy}from"./_commonjsHelpers-CqkleIqs.js";var _c=Object.defineProperty,p=(e,t)=>_c(e,"name",{value:t,configurable:!0}),my=(e,t)=>{for(var r in t)_c(e,r,{get:t[r],enumerable:!0})},So={exports:{}},yy=So.exports,zl;function Cy(){return zl||(zl=1,(function(e,t){(function(r,i){e.exports=i()})(yy,(function(){var r=1e3,i=6e4,o=36e5,s="millisecond",a="second",n="minute",l="hour",c="day",h="week",d="month",f="quarter",u="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var A=["th","st","nd","rd"],F=$%100;return"["+$+(A[(F-20)%10]||A[F]||A[0])+"]"}},k=function($,A,F){var D=String($);return!D||D.length>=A?$:""+Array(A+1-D.length).join(F)+$},T={s:k,z:function($){var A=-$.utcOffset(),F=Math.abs(A),D=Math.floor(F/60),M=F%60;return(A<=0?"+":"-")+k(D,2,"0")+":"+k(M,2,"0")},m:function $(A,F){if(A.date()1)return $(Y[0])}else{var G=A.name;_[G]=A,M=G}return!D&&M&&(S=M),M||!D&&S},R=function($,A){if(v($))return $.clone();var F=typeof A=="object"?A:{};return F.date=$,F.args=arguments,new z(F)},P=T;P.l=N,P.i=v,P.w=function($,A){return R($,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var z=(function(){function $(F){this.$L=N(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[L]=!0}var A=$.prototype;return A.parse=function(F){this.$d=(function(D){var M=D.date,H=D.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(y);if(Y){var G=Y[2]-1||0,lt=(Y[7]||"0").substring(0,3);return H?new Date(Date.UTC(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)):new Date(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)}}return new Date(M)})(F),this.init()},A.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},A.$utils=function(){return P},A.isValid=function(){return this.$d.toString()!==m},A.isSame=function(F,D){var M=R(F);return this.startOf(D)<=M&&M<=this.endOf(D)},A.isAfter=function(F,D){return R(F){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Cn=p(function(e="fatal"){let t=Ne.fatal;typeof e=="string"?e.toLowerCase()in Ne&&(t=Ne[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=Ne.fatal&&(q.fatal=console.error?console.error.bind(console,he("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",he("FATAL"))),t<=Ne.error&&(q.error=console.error?console.error.bind(console,he("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",he("ERROR"))),t<=Ne.warn&&(q.warn=console.warn?console.warn.bind(console,he("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",he("WARN"))),t<=Ne.info&&(q.info=console.info?console.info.bind(console,he("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",he("INFO"))),t<=Ne.debug&&(q.debug=console.debug?console.debug.bind(console,he("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("DEBUG"))),t<=Ne.trace&&(q.trace=console.debug?console.debug.bind(console,he("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("TRACE")))},"setLogLevel"),he=p(e=>`%c${by().format("ss.SSS")} : ${e} : `,"format");const _o={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const o=r<.5?r*(1+t):r+t-r*t,s=2*r-o;switch(i){case"r":return _o.hue2rgb(s,o,e+1/3)*255;case"g":return _o.hue2rgb(s,o,e)*255;case"b":return _o.hue2rgb(s,o,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const o=Math.max(e,t,r),s=Math.min(e,t,r),a=(o+s)/2;if(i==="l")return a*100;if(o===s)return 0;const n=o-s,l=a>.5?n/(2-o-s):n/(o+s);if(i==="s")return l*100;switch(o){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},wy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},at={channel:_o,lang:ky,unit:wy},Je={};for(let e=0;e<=255;e++)Je[e]=at.unit.dec2hex(e);const Gt={ALL:0,RGB:1,HSL:2};class Ty{constructor(){this.type=Gt.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Gt.ALL}is(t){return this.type===t}}class Sy{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Ty}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Gt.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:o}=t;r===void 0&&(t.h=at.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=at.channel.rgb2hsl(t,"s")),o===void 0&&(t.l=at.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:o}=t;r===void 0&&(t.r=at.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=at.channel.hsl2rgb(t,"g")),o===void 0&&(t.b=at.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Gt.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Gt.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Gt.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Gt.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Gt.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Gt.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const gs=new Sy({r:0,g:0,b:0,a:0},"transparent"),Xr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Xr.re);if(!t)return;const r=t[1],i=parseInt(r,16),o=r.length,s=o%4===0,a=o>4,n=a?1:17,l=a?8:4,c=s?0:-1,h=a?255:15;return gs.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:s?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}${Je[Math.round(o*255)]}`:`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}`}},Cr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Cr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return at.channel.clamp.h(parseFloat(r)*.9);case"rad":return at.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return at.channel.clamp.h(parseFloat(r)*360)}}return at.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Cr.re);if(!r)return;const[,i,o,s,a,n]=r;return gs.set({h:Cr._hue2deg(i),s:at.channel.clamp.s(parseFloat(o)),l:at.channel.clamp.l(parseFloat(s)),a:a?at.channel.clamp.a(n?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:o}=e;return o<1?`hsla(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%, ${o})`:`hsl(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%)`}},Ei={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Ei.colors[e];if(t)return Xr.parse(t)},stringify:e=>{const t=Xr.stringify(e);for(const r in Ei.colors)if(Ei.colors[r]===t)return r}},wi={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(wi.re);if(!r)return;const[,i,o,s,a,n,l,c,h]=r;return gs.set({r:at.channel.clamp.r(o?parseFloat(i)*2.55:parseFloat(i)),g:at.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:at.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?at.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`rgba(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)}, ${at.lang.round(o)})`:`rgb(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)})`}},Ee={format:{keyword:Ei,hex:Xr,rgb:wi,rgba:wi,hsl:Cr,hsla:Cr},parse:e=>{if(typeof e!="string")return e;const t=Xr.parse(e)||wi.parse(e)||Cr.parse(e)||Ei.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Gt.HSL)||e.data.r===void 0?Cr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?wi.stringify(e):Xr.stringify(e)},Bc=(e,t)=>{const r=Ee.parse(e);for(const i in t)r[i]=at.channel.clamp[i](t[i]);return Ee.stringify(r)},or=(e,t,r=0,i=1)=>{if(typeof e!="number")return Bc(e,{a:t});const o=gs.set({r:at.channel.clamp.r(e),g:at.channel.clamp.g(t),b:at.channel.clamp.b(r),a:at.channel.clamp.a(i)});return Ee.stringify(o)},_y=e=>{const{r:t,g:r,b:i}=Ee.parse(e),o=.2126*at.channel.toLinear(t)+.7152*at.channel.toLinear(r)+.0722*at.channel.toLinear(i);return at.lang.round(o)},By=e=>_y(e)>=.5,ke=e=>!By(e),vc=(e,t,r)=>{const i=Ee.parse(e),o=i[t],s=at.channel.clamp[t](o+r);return o!==s&&(i[t]=s),Ee.stringify(i)},O=(e,t)=>vc(e,"l",t),I=(e,t)=>vc(e,"l",-t),x=(e,t)=>{const r=Ee.parse(e),i={};for(const o in t)t[o]&&(i[o]=r[o]+t[o]);return Bc(e,i)},vy=(e,t,r=50)=>{const{r:i,g:o,b:s,a}=Ee.parse(e),{r:n,g:l,b:c,a:h}=Ee.parse(t),d=r/100,f=d*2-1,u=a-h,m=((f*u===-1?f:(f+u)/(1+f*u))+1)/2,y=1-m,C=i*m+n*y,b=o*m+l*y,k=s*m+c*y,T=a*d+h*(1-d);return or(C,b,k,T)},B=(e,t=100)=>{const r=Ee.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,vy(r,e,t)};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Hl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r2?i-2:0),s=2;s1?r-1:0),o=1;o"u"?null:Ot(BigInt.prototype.toString),Vl=typeof Symbol>"u"?null:Ot(Symbol.prototype.toString),Nt=Ot(Object.prototype.hasOwnProperty),pi=Ot(Object.prototype.toString),zt=Ot(RegExp.prototype.test),fr=Wy(TypeError);function Ot(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:Ti;if(Yl&&Yl(e,null),!er(t))return e;let i=t.length;for(;i--;){let o=t[i];if(typeof o=="string"){const s=r(o);s!==o&&($y(t)||(t[i]=s),o=s)}e[o]=!0}return e}function zy(e){for(let t=0;t/g),Vy=jt(/\${[\w\W]*/g),Zy=jt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ky=jt(/^aria-[\-\w]+$/),th=jt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qy=jt(/^(?:\w+script|data):/i),Jy=jt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),t0=jt(/^html$/i),e0=jt(/^[a-z][.\w]*(-[.\w]+)+$/i),eh=jt(/<[/\w!]/g),r0=jt(/<[/\w]/g),i0=jt(/<\/no(script|embed|frames)/i),o0=jt(/\/>/i),_e={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},s0=function(){return typeof window>"u"?null:window},a0=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(i=r.getAttribute(o));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},rh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Qe=function(t,r,i,o){return Nt(t,r)&&er(t[r])?mt(o.base?Qt(o.base):{},t[r],o.transform):i};function Ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s0();const t=j=>Ac(j);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==_e.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const i=r,o=i.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,a=e.Node,n=e.Element,l=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,d=e.trustedTypes,f=n.prototype,u=Be(f,"cloneNode"),g=Be(f,"remove"),m=Be(f,"nextSibling"),y=Be(f,"childNodes"),C=Be(f,"parentNode"),b=Be(f,"shadowRoot"),k=Be(f,"attributes"),T=a&&a.prototype?Be(a.prototype,"nodeType"):null,S=a&&a.prototype?Be(a.prototype,"nodeName"):null;if(typeof s=="function"){const j=r.createElement("template");j.content&&j.content.ownerDocument&&(r=j.content.ownerDocument)}let _,L="",v,N=!1,R=0;const P=function(){if(R>0)throw fr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},z=function(w){P(),R++;try{return _.createHTML(w)}finally{R--}},W=function(w){P(),R++;try{return _.createScriptURL(w)}finally{R--}},$=function(){return N||(v=a0(d,o),N=!0),v},A=r,F=A.implementation,D=A.createNodeIterator,M=A.createDocumentFragment,H=A.getElementsByTagName,Y=i.importNode;let G=rh();t.isSupported=typeof Lc=="function"&&typeof C=="function"&&F&&F.createHTMLDocument!==void 0;const lt=Gy,ht=Xy,dt=Vy,bt=Zy,et=Ky,ft=Qy,kt=Jy,Bt=e0;let St=th,ut=null;const de=mt({},[...Zl,...Qs,...Js,...ta,...Kl]);let Tt=null;const Mr=mt({},[...Ql,...ea,...Jl,...uo]);let Lt=Object.seal(zr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),li=null,bl=null;const Ve=Object.seal(zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let kl=!0,Os=!0,wl=!1,Tl=!0,Ze=!1,hi=!0,dr=!1,Is=!1,Ds=null,Ps=null,Rs=!1,$r=!1,oo=!1,so=!1,Sl=!0,_l=!1;const Bl="user-content-";let Ns=!0,qs=!1,Or={},Te=null;const Ws=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let vl=null;const Ll=mt({},["audio","video","img","source","image","track"]);let zs=null;const Fl=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ao="http://www.w3.org/1998/Math/MathML",no="http://www.w3.org/2000/svg",Se="http://www.w3.org/1999/xhtml";let Ir=Se,Hs=!1,Ys=null;const Jm=mt({},[ao,no,Se],Ks),Al=Ut(["mi","mo","mn","ms","mtext"]);let Us=mt({},Al);const El=Ut(["annotation-xml"]);let js=mt({},El);const ty=mt({},["title","style","font","a","script"]);let ci=null;const ey=["application/xhtml+xml","text/html"],ry="text/html";let Ft=null,Dr=null;const iy=r.createElement("form"),Ml=function(w){return w instanceof RegExp||w instanceof Function},Gs=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Dr&&Dr===w)return;(!w||typeof w!="object")&&(w={}),w=Qt(w),ci=ey.indexOf(w.PARSER_MEDIA_TYPE)===-1?ry:w.PARSER_MEDIA_TYPE,Ft=ci==="application/xhtml+xml"?Ks:Ti,ut=Qe(w,"ALLOWED_TAGS",de,{transform:Ft}),Tt=Qe(w,"ALLOWED_ATTR",Mr,{transform:Ft}),Ys=Qe(w,"ALLOWED_NAMESPACES",Jm,{transform:Ks}),zs=Qe(w,"ADD_URI_SAFE_ATTR",Fl,{transform:Ft,base:Fl}),vl=Qe(w,"ADD_DATA_URI_TAGS",Ll,{transform:Ft,base:Ll}),Te=Qe(w,"FORBID_CONTENTS",Ws,{transform:Ft}),li=Qe(w,"FORBID_TAGS",Qt({}),{transform:Ft}),bl=Qe(w,"FORBID_ATTR",Qt({}),{transform:Ft}),Or=Nt(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Qt(w.USE_PROFILES):w.USE_PROFILES:!1,kl=w.ALLOW_ARIA_ATTR!==!1,Os=w.ALLOW_DATA_ATTR!==!1,wl=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Tl=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ze=w.SAFE_FOR_TEMPLATES||!1,hi=w.SAFE_FOR_XML!==!1,dr=w.WHOLE_DOCUMENT||!1,$r=w.RETURN_DOM||!1,oo=w.RETURN_DOM_FRAGMENT||!1,so=w.RETURN_TRUSTED_TYPE||!1,Rs=w.FORCE_BODY||!1,Sl=w.SANITIZE_DOM!==!1,_l=w.SANITIZE_NAMED_PROPS||!1,Ns=w.KEEP_CONTENT!==!1,qs=w.IN_PLACE||!1,St=Yy(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:th,Ir=typeof w.NAMESPACE=="string"?w.NAMESPACE:Se,Us=Nt(w,"MATHML_TEXT_INTEGRATION_POINTS")&&w.MATHML_TEXT_INTEGRATION_POINTS&&typeof w.MATHML_TEXT_INTEGRATION_POINTS=="object"?Qt(w.MATHML_TEXT_INTEGRATION_POINTS):mt({},Al),js=Nt(w,"HTML_INTEGRATION_POINTS")&&w.HTML_INTEGRATION_POINTS&&typeof w.HTML_INTEGRATION_POINTS=="object"?Qt(w.HTML_INTEGRATION_POINTS):mt({},El);const E=Nt(w,"CUSTOM_ELEMENT_HANDLING")&&w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING=="object"?Qt(w.CUSTOM_ELEMENT_HANDLING):zr(null);if(Lt=zr(null),Nt(E,"tagNameCheck")&&Ml(E.tagNameCheck)&&(Lt.tagNameCheck=E.tagNameCheck),Nt(E,"attributeNameCheck")&&Ml(E.attributeNameCheck)&&(Lt.attributeNameCheck=E.attributeNameCheck),Nt(E,"allowCustomizedBuiltInElements")&&typeof E.allowCustomizedBuiltInElements=="boolean"&&(Lt.allowCustomizedBuiltInElements=E.allowCustomizedBuiltInElements),jt(Lt),Ze&&(Os=!1),oo&&($r=!0),Or&&(ut=mt({},Kl),Tt=zr(null),Or.html===!0&&(mt(ut,Zl),mt(Tt,Ql)),Or.svg===!0&&(mt(ut,Qs),mt(Tt,ea),mt(Tt,uo)),Or.svgFilters===!0&&(mt(ut,Js),mt(Tt,ea),mt(Tt,uo)),Or.mathMl===!0&&(mt(ut,ta),mt(Tt,Jl),mt(Tt,uo))),Ve.tagCheck=null,Ve.attributeCheck=null,Nt(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Ve.tagCheck=w.ADD_TAGS:er(w.ADD_TAGS)&&(ut===de&&(ut=Qt(ut)),mt(ut,w.ADD_TAGS,Ft))),Nt(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Ve.attributeCheck=w.ADD_ATTR:er(w.ADD_ATTR)&&(Tt===Mr&&(Tt=Qt(Tt)),mt(Tt,w.ADD_ATTR,Ft))),Nt(w,"ADD_URI_SAFE_ATTR")&&er(w.ADD_URI_SAFE_ATTR)&&mt(zs,w.ADD_URI_SAFE_ATTR,Ft),Nt(w,"FORBID_CONTENTS")&&er(w.FORBID_CONTENTS)&&(Te===Ws&&(Te=Qt(Te)),mt(Te,w.FORBID_CONTENTS,Ft)),Nt(w,"ADD_FORBID_CONTENTS")&&er(w.ADD_FORBID_CONTENTS)&&(Te===Ws&&(Te=Qt(Te)),mt(Te,w.ADD_FORBID_CONTENTS,Ft)),Ns&&(ut["#text"]=!0),dr&&mt(ut,["html","head","body"]),ut.table&&(mt(ut,["tbody"]),delete li.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw fr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw fr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const U=_;_=w.TRUSTED_TYPES_POLICY;try{L=z("")}catch(J){throw _=U,J}}else w.TRUSTED_TYPES_POLICY===null?(_=void 0,L=""):(_===void 0&&(_=$()),_&&typeof L=="string"&&(L=z("")));Ut&&Ut(w),Dr=w},$l=mt({},[...Qs,...Js,...Uy]),Ol=mt({},[...ta,...jy]),oy=function(w,E,U){return E.namespaceURI===Se?w==="svg":E.namespaceURI===ao?w==="svg"&&(U==="annotation-xml"||Us[U]):!!$l[w]},sy=function(w,E,U){return E.namespaceURI===Se?w==="math":E.namespaceURI===no?w==="math"&&js[U]:!!Ol[w]},ay=function(w,E,U){return E.namespaceURI===no&&!js[U]||E.namespaceURI===ao&&!Us[U]?!1:!Ol[w]&&(ty[w]||!$l[w])},ny=function(w){let E=C(w);(!E||!E.tagName)&&(E={namespaceURI:Ir,tagName:"template"});const U=Ti(w.tagName),J=Ti(E.tagName);return Ys[w.namespaceURI]?w.namespaceURI===no?oy(U,E,J):w.namespaceURI===ao?sy(U,E,J):w.namespaceURI===Se?ay(U,E,J):!!(ci==="application/xhtml+xml"&&Ys[w.namespaceURI]):!1},Ke=function(w){Rr(t.removed,{element:w});try{C(w).removeChild(w)}catch{if(g(w),!C(w))throw fr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Il=function(w){const E=y(w);if(E){const J=[];ui(E,pt=>{Rr(J,pt)}),ui(J,pt=>{try{g(pt)}catch{}})}const U=k(w);if(U)for(let J=U.length-1;J>=0;--J){const pt=U[J],yt=pt&&pt.name;if(typeof yt=="string")try{w.removeAttribute(yt)}catch{}}},ur=function(w,E){try{Rr(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Rr(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if($r||oo)try{Ke(E)}catch{}else try{E.setAttribute(w,"")}catch{}},ly=function(w){const E=k(w);if(E)for(let U=E.length-1;U>=0;--U){const J=E[U],pt=J&&J.name;if(!(typeof pt!="string"||Tt[Ft(pt)]))try{w.removeAttribute(pt)}catch{}}},hy=function(w){const E=[w];for(;E.length>0;){const U=E.pop();(T?T(U):U.nodeType)===_e.element&&ly(U);const pt=y(U);if(pt)for(let yt=pt.length-1;yt>=0;--yt)E.push(pt[yt])}},Dl=function(w){let E=null,U=null;if(Rs)w=""+w;else{const yt=jl(w,/^[\r\n\t ]+/);U=yt&&yt[0]}ci==="application/xhtml+xml"&&Ir===Se&&(w=''+w+"");const J=_?z(w):w;if(Ir===Se)try{E=new h().parseFromString(J,ci)}catch{}if(!E||!E.documentElement){E=F.createDocument(Ir,"template",null);try{E.documentElement.innerHTML=Hs?L:J}catch{}}const pt=E.body||E.documentElement;return w&&U&&pt.insertBefore(r.createTextNode(U),pt.childNodes[0]||null),Ir===Se?H.call(E,dr?"html":"body")[0]:dr?E.documentElement:pt},Pl=function(w){return D.call(w.ownerDocument||w,w,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},lo=function(w){return w=fi(w,lt," "),w=fi(w,ht," "),w=fi(w,dt," "),w},Xs=function(w){var E;w.normalize();const U=D.call(w.ownerDocument||w,w,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let J=U.nextNode();for(;J;)J.data=lo(J.data),J=U.nextNode();const pt=(E=w.querySelectorAll)===null||E===void 0?void 0:E.call(w,"template");pt&&ui(pt,yt=>{Pr(yt.content)&&Xs(yt.content)})},ho=function(w){const E=S?S(w):null;return typeof E!="string"||Ft(E)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==k(w)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==T(w)||w.childNodes!==y(w)},Pr=function(w){if(!T||typeof w!="object"||w===null)return!1;try{return T(w)===_e.documentFragment}catch{return!1}},di=function(w){if(!T||typeof w!="object"||w===null)return!1;try{return typeof T(w)=="number"}catch{return!1}};function Re(j,w,E){j.length!==0&&ui(j,U=>{U.call(t,w,E,Dr)})}const cy=function(w,E){return!!(hi&&w.hasChildNodes()&&!di(w.firstElementChild)&&zt(eh,w.textContent)&&zt(eh,w.innerHTML)||hi&&w.namespaceURI===Se&&E==="style"&&di(w.firstElementChild)||w.nodeType===_e.processingInstruction||hi&&w.nodeType===_e.comment&&zt(r0,w.data))},dy=function(w,E){if(!li[E]&&ql(E)&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,E)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(E)))return!1;if(Ns&&!Te[E]){const U=C(w),J=y(w);if(J&&U){const pt=J.length;for(let yt=pt-1;yt>=0;--yt){const Rt=qs?J[yt]:u(J[yt],!0);U.insertBefore(Rt,m(w))}}}return Ke(w),!0},Rl=function(w){if(Re(G.beforeSanitizeElements,w,null),ho(w))return Ke(w),!0;const E=Ft(S?S(w):w.nodeName);if(Re(G.uponSanitizeElement,w,{tagName:E,allowedTags:ut}),cy(w,E))return Ke(w),!0;if(li[E]||!(Ve.tagCheck instanceof Function&&Ve.tagCheck(E))&&!ut[E])return dy(w,E);if((T?T(w):w.nodeType)===_e.element&&!ny(w)||(E==="noscript"||E==="noembed"||E==="noframes")&&zt(i0,w.innerHTML))return Ke(w),!0;if(Ze&&w.nodeType===_e.text){const J=lo(w.textContent);w.textContent!==J&&(Rr(t.removed,{element:w.cloneNode()}),w.textContent=J)}return Re(G.afterSanitizeElements,w,null),!1},Nl=function(w,E,U){if(bl[E]||Sl&&(E==="id"||E==="name")&&(U in r||U in iy))return!1;const J=Tt[E]||Ve.attributeCheck instanceof Function&&Ve.attributeCheck(E,w);if(!(Os&&zt(bt,E))){if(!(kl&&zt(et,E))){if(J){if(!zs[E]){if(!zt(St,fi(U,kt,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Gl(U,"data:")===0&&vl[w])){if(!(wl&&!zt(ft,fi(U,kt,"")))){if(U)return!1}}}}}else if(!(ql(w)&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,w)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(w))&&(Lt.attributeNameCheck instanceof RegExp&&zt(Lt.attributeNameCheck,E)||Lt.attributeNameCheck instanceof Function&&Lt.attributeNameCheck(E,w))||E==="is"&&Lt.allowCustomizedBuiltInElements&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,U)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(U))))return!1}}return!0},uy=mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ql=function(w){return!uy[Ti(w)]&&zt(Bt,w)},fy=function(w,E,U,J){if(_&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!U)switch(d.getAttributeType(w,E)){case"TrustedHTML":return z(J);case"TrustedScriptURL":return W(J)}return J},py=function(w,E,U,J){try{U?w.setAttributeNS(U,E,J):w.setAttribute(E,J),ho(w)?Ke(w):Ul(t.removed)}catch{ur(E,w)}},Wl=function(w){Re(G.beforeSanitizeAttributes,w,null);const E=w.attributes;if(!E||ho(w))return;const U={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Tt,forceKeepAttr:void 0};let J=E.length;const pt=Ft(w.nodeName);for(;J--;){const yt=E[J],Rt=yt.name,Mt=yt.namespaceURI,le=yt.value,ue=Ft(Rt),Zs=le;let Kt=Rt==="value"?Zs:Ry(Zs);if(U.attrName=ue,U.attrValue=Kt,U.keepAttr=!0,U.forceKeepAttr=void 0,Re(G.uponSanitizeAttribute,w,U),Kt=U.attrValue,_l&&(ue==="id"||ue==="name")&&Gl(Kt,Bl)!==0&&(ur(Rt,w),Kt=Bl+Kt),hi&&zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Kt)){ur(Rt,w);continue}if(ue==="attributename"&&jl(Kt,"href")){ur(Rt,w);continue}if(!U.forceKeepAttr){if(!U.keepAttr){ur(Rt,w);continue}if(!Tl&&zt(o0,Kt)){ur(Rt,w);continue}if(Ze&&(Kt=lo(Kt)),!Nl(pt,ue,Kt)){ur(Rt,w);continue}Kt=fy(pt,ue,Mt,Kt),Kt!==Zs&&py(w,Rt,Mt,Kt)}}Re(G.afterSanitizeAttributes,w,null)},co=function(w){let E=null;const U=Pl(w);for(Re(G.beforeSanitizeShadowDOM,w,null);E=U.nextNode();)if(Re(G.uponSanitizeShadowNode,E,null),Rl(E),Wl(E),Pr(E.content)&&co(E.content),(T?T(E):E.nodeType)===_e.element){const pt=b(E);Pr(pt)&&(Vs(pt),co(pt))}Re(G.afterSanitizeShadowDOM,w,null)},Vs=function(w){const E=[{node:w,shadow:null}];for(;E.length>0;){const U=E.pop();if(U.shadow){co(U.shadow);continue}const J=U.node,yt=(T?T(J):J.nodeType)===_e.element,Rt=y(J);if(Rt)for(let Mt=Rt.length-1;Mt>=0;--Mt)E.push({node:Rt[Mt],shadow:null});if(yt){const Mt=S?S(J):null;if(typeof Mt=="string"&&Ft(Mt)==="template"){const le=J.content;Pr(le)&&E.push({node:le,shadow:null})}}if(yt){const Mt=b(J);Pr(Mt)&&E.push({node:null,shadow:Mt},{node:Mt,shadow:null})}}};return t.sanitize=function(j){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,U=null,J=null,pt=null;if(Hs=!j,Hs&&(j=""),typeof j!="string"&&!di(j)&&(j=Hy(j),typeof j!="string"))throw fr("dirty is not a string, aborting");if(!t.isSupported)return j;Is?(ut=Ds,Tt=Ps):Gs(w),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(ut=Qt(ut)),G.uponSanitizeAttribute.length>0&&(Tt=Qt(Tt)),t.removed=[];const yt=qs&&typeof j!="string"&&di(j);if(yt){const le=S?S(j):j.nodeName;if(typeof le=="string"){const ue=Ft(le);if(!ut[ue]||li[ue])throw fr("root node is forbidden and cannot be sanitized in-place")}if(ho(j))throw fr("root node is clobbered and cannot be sanitized in-place");try{Vs(j)}catch(ue){throw Il(j),ue}}else if(di(j))E=Dl(""),U=E.ownerDocument.importNode(j,!0),U.nodeType===_e.element&&U.nodeName==="BODY"||U.nodeName==="HTML"?E=U:E.appendChild(U),Vs(U);else{if(!$r&&!Ze&&!dr&&j.indexOf("<")===-1)return _&&so?z(j):j;if(E=Dl(j),!E)return $r?null:so?L:""}E&&Rs&&Ke(E.firstChild);const Rt=Pl(yt?j:E);try{for(;J=Rt.nextNode();)Rl(J),Wl(J),Pr(J.content)&&co(J.content)}catch(le){throw yt&&Il(j),le}if(yt)return ui(t.removed,le=>{le.element&&hy(le.element)}),Ze&&Xs(j),j;if($r){if(Ze&&Xs(E),oo)for(pt=M.call(E.ownerDocument);E.firstChild;)pt.appendChild(E.firstChild);else pt=E;return(Tt.shadowroot||Tt.shadowrootmode)&&(pt=Y.call(i,pt,!0)),pt}let Mt=dr?E.outerHTML:E.innerHTML;return dr&&ut["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&zt(t0,E.ownerDocument.doctype.name)&&(Mt=" `+Mt),Ze&&(Mt=lo(Mt)),_&&so?z(Mt):Mt},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gs(j),Is=!0,Ds=ut,Ps=Tt},t.clearConfig=function(){Dr=null,Is=!1,Ds=null,Ps=null,_=v,L=""},t.isValidAttribute=function(j,w,E){Dr||Gs({});const U=Ft(j),J=Ft(w);return Nl(U,J,E)},t.addHook=function(j,w){typeof w=="function"&&Nt(G,j)&&Rr(G[j],w)},t.removeHook=function(j,w){if(Nt(G,j)){if(w!==void 0){const E=Dy(G[j],w);return E===-1?void 0:Py(G[j],E,1)[0]}return Ul(G[j])}},t.removeHooks=function(j){Nt(G,j)&&(G[j]=[])},t.removeAllHooks=function(){G=rh()},t}var Kr=Ac(),xa=p((e,t,{depth:r=2,clobber:i=!1}={})=>{const o={depth:r,clobber:i};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(s=>xa(e,s,o)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(s=>{e.includes(s)||e.push(s)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(s=>{typeof t[s]=="object"&&t[s]!==null&&(e[s]===void 0||typeof e[s]=="object")?(e[s]===void 0&&(e[s]=Array.isArray(t[s])?[]:{}),e[s]=xa(e[s],t[s],{depth:r-1,clobber:i})):(i||typeof e[s]!="object"&&typeof t[s]!="object")&&(e[s]=t[s])}),e)},"assignWithDepth"),Dt=xa,$e="#ffffff",Oe="#f2f2f2",st=p((e,t)=>t?x(e,{s:-40,l:10}):x(e,{s:-40,l:-10}),"mkBorder"),n0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||I(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||I(this.mainBkg,10)):(this.rowOdd=this.rowOdd||O(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||O(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},l0=p(e=>{const t=new n0;return t.calculate(e),t},"getThemeVariables"),h0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=I("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=I(this.sectionBkgColor,10),this.taskBorderColor=or(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=or(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||O(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||I(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){this.secondBkg=O(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=O(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=O(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=B(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=x(this.primaryColor,{h:64}),this.fillType3=x(this.secondaryColor,{h:64}),this.fillType4=x(this.primaryColor,{h:-64}),this.fillType5=x(this.secondaryColor,{h:-64}),this.fillType6=x(this.primaryColor,{h:128}),this.fillType7=x(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330});for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},c0=p(e=>{const t=new h0;return t.calculate(e),t},"getThemeVariables"),d0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=x(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=or(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||I(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||I(this.tertiaryColor,40);for(let e=0;e{this[r]==="calculated"&&(this[r]=void 0)}),typeof e!="object"){this.updateColors();return}const t=Object.keys(e);t.forEach(r=>{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},u0=p(e=>{const t=new d0;return t.calculate(e),t},"getThemeVariables"),f0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=O("#cde498",10),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.primaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){this.actorBorder=I(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||I(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||I(this.tertiaryColor,40);for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},p0=p(e=>{const t=new f0;return t.calculate(e),t},"getThemeVariables"),g0=class{static{p(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=O(this.contrast,55),this.background="#ffffff",this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||O(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){this.secondBkg=O(this.contrast,55),this.border2=this.contrast,this.actorBorder=O(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},m0=p(e=>{const t=new g0;return t.calculate(e),t},"getThemeVariables"),y0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||t,this.cScale2=this.cScale2||r,this.cScale3=this.cScale3||x(e,{h:30}),this.cScale4=this.cScale4||x(e,{h:60}),this.cScale5=this.cScale5||x(e,{h:90}),this.cScale6=this.cScale6||x(e,{h:120}),this.cScale7=this.cScale7||x(e,{h:150}),this.cScale8=this.cScale8||x(e,{h:210,l:150}),this.cScale9=this.cScale9||x(e,{h:270}),this.cScale10=this.cScale10||x(e,{h:300}),this.cScale11=this.cScale11||x(e,{h:330}),this.darkMode)for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},C0=p(e=>{const t=new y0;return t.calculate(e),t},"getThemeVariables"),x0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},b0=p(e=>{const t=new x0;return t.calculate(e),t},"getThemeVariables"),k0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=st("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},w0=p(e=>{const t=new k0;return t.calculate(e),t},"getThemeVariables"),T0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},S0=p(e=>{const t=new T0;return t.calculate(e),t},"getThemeVariables"),_0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},B0=p(e=>{const t=new _0;return t.calculate(e),t},"getThemeVariables"),v0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},L0=p(e=>{const t=new v0;return t.calculate(e),t},"getThemeVariables"),He={base:{getThemeVariables:l0},dark:{getThemeVariables:c0},default:{getThemeVariables:u0},forest:{getThemeVariables:p0},neutral:{getThemeVariables:m0},neo:{getThemeVariables:C0},"neo-dark":{getThemeVariables:b0},redux:{getThemeVariables:w0},"redux-dark":{getThemeVariables:S0},"redux-color":{getThemeVariables:B0},"redux-dark-color":{getThemeVariables:L0}},Wt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Ec={...Wt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:He.default.getThemeVariables(),sequence:{...Wt.sequence,messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:p(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:p(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Wt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Wt.c4,useWidth:void 0,personFont:p(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Wt.flowchart,inheritDir:!1},external_personFont:p(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:p(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:p(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:p(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:p(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:p(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:p(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:p(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:p(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:p(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:p(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:p(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:p(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:p(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:p(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:p(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:p(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:p(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:p(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:p(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Wt.pie,useWidth:984},xyChart:{...Wt.xyChart,useWidth:void 0},requirement:{...Wt.requirement,useWidth:void 0},packet:{...Wt.packet},eventmodeling:{...Wt.eventmodeling},treeView:{...Wt.treeView,useWidth:void 0},radar:{...Wt.radar},railroad:{...Wt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Wt.ishikawa},sankey:{...Wt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Wt.venn},cynefin:{...Wt.cynefin}},Mc=p((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Mc(e[i],"")]:[...r,t+i],[]),"keyify"),F0=new Set(Mc(Ec,"")),$c=Ec,A0={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},E0=p((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(q.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Ro=p(e=>{if(q.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Ro(t));return}for(const t of Object.keys(e)){if(q.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!F0.has(t)||e[t]==null){q.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=A0[t];i?E0(e[t],i):(q.debug("sanitizing object",t),Ro(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(q.debug("sanitizing css option",t),e[t]=Oc(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}q.debug("After sanitization",e)}},"sanitizeDirective"),Oc=p(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ie=Dt({},Qr),No,Tr=[],Mi=Dt({},Qr),ms=p((e,t)=>{let r=Dt({},e),i={};for(const o of t)Pc(o),i=Dt(i,o);if(r=Dt(r,i),i.theme&&i.theme in He){const o=Dt({},No),s=Dt(o.themeVariables||{},i.themeVariables);r.theme&&r.theme in He&&(r.themeVariables=He[r.theme].getThemeVariables(s))}return Mi=r,Nc(Mi),Mi},"updateCurrentConfig"),M0=p(e=>(ie=Dt({},Qr),ie=Dt(ie,e),e.theme&&He[e.theme]&&(ie.themeVariables=He[e.theme].getThemeVariables(e.themeVariables)),ms(ie,Tr),ie),"setSiteConfig"),$0=p(e=>{No=Dt({},e)},"saveConfigFromInitialize"),O0=p(e=>(ie=Dt(ie,e),ms(ie,Tr),ie),"updateSiteConfig"),Ic=p(()=>Dt({},ie),"getSiteConfig"),Dc=p(e=>(Nc(e),Dt(Mi,e),vt()),"setConfig"),vt=p(()=>Dt({},Mi),"getConfig"),Pc=p(e=>{e&&(["secure",...ie.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(q.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Pc(e[t])}))},"sanitize"),I0=p(e=>{Ro(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Tr.push(e),ms(ie,Tr)},"addDirective"),qo=p((e=ie)=>{Tr=[],ms(e,Tr)},"reset"),D0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},ih={},Rc=p(e=>{ih[e]||(q.warn(D0[e]),ih[e]=!0)},"issueWarning"),Nc=p(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Rc("LAZY_LOAD_DEPRECATED")},"checkConfig"),kL=p(()=>{let e={};No&&(e=Dt(e,No));for(const t of Tr)e=Dt(e,t);return e},"getUserDefinedConfig"),ee=p(e=>(e.flowchart?.htmlLabels!=null&&Rc("FLOWCHART_HTML_LABELS_DEPRECATED"),Ie(e.htmlLabels??e.flowchart?.htmlLabels??!0)),"getEffectiveHtmlLabels"),qc=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,$i=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,P0=/\s*%%.*\n/gm,Wc=class extends Error{static{p(this,"UnknownDiagramError")}constructor(e){super(e),this.name="UnknownDiagramError"}},Sr={},xn=p(function(e,t){e=e.replace(qc,"").replace($i,"").replace(P0,` `);for(const[r,{detector:i}]of Object.entries(Sr))if(i(e,t))return r;throw new Wc(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),ba=p((...e)=>{for(const{id:t,detector:r,loader:i}of e)zc(t,r,i)},"registerLazyLoadedDiagrams"),zc=p((e,t,r)=>{Sr[e]&&q.warn(`Detector with key ${e} already exists. Overwriting.`),Sr[e]={detector:t,loader:r},q.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),R0=p(e=>Sr[e].loader,"getDiagramLoader"),Vi=//gi,N0=p(e=>e?Uc(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),q0=(()=>{let e=!1;return()=>{e||(Hc(),e=!0)}})();function Hc(){const e="data-temp-href-target";Kr.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Kr.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}p(Hc,"setupDompurifyHooks");var Yc=p(e=>(q0(),Kr.sanitize(e)),"removeScript"),oh=p((e,t)=>{if(ee(t)){const r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Yc(e):r!=="loose"&&(e=Uc(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=Y0(e))}return e},"sanitizeMore"),be=p((e,t)=>e&&(t.dompurifyConfig?e=Kr.sanitize(oh(e,t),t.dompurifyConfig).toString():e=Kr.sanitize(oh(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),W0=p((e,t)=>typeof e=="string"?be(e,t):e.flat().map(r=>be(r,t)),"sanitizeTextOrArray"),z0=p(e=>Vi.test(e),"hasBreaks"),H0=p(e=>e.split(Vi),"splitBreaks"),Y0=p(e=>e.replace(/#br#/g,"
        "),"placeholderToBreak"),Uc=p(e=>e.replace(Vi,"#br#"),"breakToPlaceholder"),U0=p(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),j0=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),G0=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),sh=p(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),X0=p((e,t)=>{const r=ka(e,"~"),i=ka(t,"~");return r===1&&i===1},"shouldCombineSets"),V0=p(e=>{const t=ka(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let o=i.indexOf("~"),s=i.lastIndexOf("~");for(;o!==-1&&s!==-1&&o!==s;)i[o]="<",i[s]=">",o=i.indexOf("~"),s=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),ah=p(()=>window.MathMLElement!==void 0,"isMathMLSupported"),wa=/\$\$(.*?)\$\$/g,Pi=p(e=>(e.match(wa)?.length??0)>0,"hasKatex"),wL=p(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await jc(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);const o={width:r.clientWidth,height:r.clientHeight};return r.remove(),o},"calculateMathMLDimensions"),Z0=p(async(e,t)=>{if(!Pi(e))return e;if(!(ah()||t.legacyMathML||t.forceLegacyMathML))return e.replace(wa,"MathML is unsupported in this environment.");{const{default:r}=await nt(async()=>{const{default:o}=await import("./katex-HP8lGamR.js");return{default:o}},[]),i=t.forceLegacyMathML||!ah()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(Vi).map(o=>Pi(o)?`
        ${o}
        `:`
        ${o}
        `).join("").replace(wa,(o,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),jc=p(async(e,t)=>be(await Z0(e,t),t),"renderKatexSanitized"),Zi={getRows:N0,sanitizeText:be,sanitizeTextOrArray:W0,hasBreaks:z0,splitBreaks:H0,lineBreakRegex:Vi,removeScript:Yc,getUrl:U0,evaluate:Ie,getMax:j0,getMin:G0},K0=p(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),Q0=p(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Gc=p(function(e,t,r,i){const o=Q0(t,r,i);K0(e,o)},"configureSvgSize"),J0=p(function(e,t,r,i){const o=t.node().getBBox(),s=o.width,a=o.height;q.info(`SVG bounds: ${s}x${a}`,o);let n=0,l=0;q.info(`Graph bounds: ${n}x${l}`,e),n=s+r*2,l=a+r*2,q.info(`Calculated bounds: ${n}x${l}`),Gc(t,l,n,i);const c=`${o.x-r} ${o.y-r} ${o.width+2*r} ${o.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Bo={};function Ta(e){return[...e.cssRules].map(t=>t.cssText).join(` @@ -300,8 +300,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let o="

        An error L0,20`)},"requirement_arrow"),LS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),FS=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),AS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o,a=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");a.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),a.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),a.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),a.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),ES={extension:hS,composition:cS,aggregation:dS,dependency:uS,lollipop:fS,point:pS,circle:gS,cross:mS,barb:yS,barbNeo:CS,only_one:xS,zero_or_one:bS,one_or_more:kS,zero_or_more:wS,only_one_neo:TS,zero_or_one_neo:SS,one_or_more_neo:_S,zero_or_more_neo:BS,requirement_arrow:vS,requirement_contains:FS,requirement_arrow_neo:LS,requirement_contains_neo:AS},MS=lS,$S={common:Zi,getConfig:vt,insertCluster:LT,insertEdge:nS,insertEdgeLabel:tS,insertMarkers:MS,insertNode:Hg,interpolateToCurve:Vn,labelHelper:it,log:q,positionEdgeLabel:eS},Gi={},Gg=p(e=>{for(const t of e)Gi[t.name]=t},"registerLayoutLoaders"),OS=p(()=>{Gg([{name:"dagre",loader:p(async()=>await nt(()=>import("./dagre-VKFMJZFB-CDFnWuZ_.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"swimlane",loader:p(async()=>await nt(()=>import("./swimlanes-5IMT3BWC-DIbCJfLo.js"),__vite__mapDeps([8,5,6,1,2,3,7])),"loader")},{name:"cose-bilkent",loader:p(async()=>await nt(()=>import("./cose-bilkent-JH36ORCC-B4N3AGR7.js"),__vite__mapDeps([9,10,7,5,6])),"loader")}])},"registerDefaultLayoutLoaders");OS();var GL=p(async(e,t,r)=>{if(!(e.layoutAlgorithm in Gi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const i=Gi[e.layoutAlgorithm],o=await i.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),n){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return o.render(e,t,$S,{algorithm:i.algorithm},r)},"render"),XL=p((e="",{fallback:t="dagre"}={})=>{if(e in Gi)return e;if(t in Gi)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),ml="comm",Xg="rule",Vg="decl",IS="@media",DS="@import",PS="@supports",RS="@namespace",un="@keyframes",Zg="@layer",NS="@scope",qS=Math.abs,Di=String.fromCharCode;function Kg(e){return e.trim()}function fn(e,t,r){return e.replace(t,r)}function Zr(e,t){return e.charCodeAt(t)|0}function ii(e,t,r){return e.slice(t,r)}function Fe(e){return e.length}function Qg(e){return e.length}function To(e,t){return t.push(e),e}var Es=1,oi=1,Jg=0,ce=0,$t=0,ni="";function yl(e,t,r,i,o,s,a,n){return{value:e,root:t,parent:r,type:i,props:o,children:s,line:Es,column:oi,length:a,return:"",siblings:n}}function WS(){return $t}function zS(){return $t=ce>0?Zr(ni,--ce):0,oi--,$t===10&&(oi=1,Es--),$t}function xe(){return $t=ce2||Xi($t)>3?"":" "}function jS(e,t){for(;--t&&xe()&&!($t<48||$t>102||$t>57&&$t<65||$t>70&&$t<97););return Ms(e,Do()+(t<6&&ir()==32&&xe()==32))}function pn(e){for(;xe();)switch($t){case e:return ce;case 34:case 39:e!==34&&e!==39&&pn($t);break;case 40:e===41&&pn(e);break;case 92:xe();break}return ce}function GS(e,t){for(;xe()&&e+$t!==57;)if(e+$t===84&&ir()===47)break;return"/*"+Ms(t,ce-1)+"*"+Di(e===47?e:xe())}function XS(e){for(;!Xi(ir());)xe();return Ms(e,ce)}function VS(e){return YS(Po("",null,null,null,[""],e=HS(e),0,[0],e))}function Po(e,t,r,i,o,s,a,n,l){for(var c=0,h=0,d=a,f=0,u=0,g=0,m=1,y=1,C=1,b=0,k=0,T="",S=o,_=s,L=i,v=T;y;)switch(g=k,k=xe()){case 40:g!=108&&Zr(v,d-1)==58?(b++,v+="("):v+=ga(k);break;case 41:b--,v+=")";break;case 34:case 39:case 91:v+=ga(k);break;case 9:case 10:case 13:case 32:if(b>0){v+=Di(k);break}v+=US(g);break;case 92:v+=jS(Do()-1,7);continue;case 47:switch(ir()){case 42:case 47:To(ZS(GS(xe(),Do()),t,r,l),l),(Xi(g||1)==5||Xi(ir()||1)==5)&&Fe(v)&&ii(v,-1,void 0)!==" "&&(v+=" ");break;default:v+="/"}break;case 123*m:n[c++]=Fe(v)*C;case 125*m:case 59:case 0:if(b>0&&k){v+=Di(k);break}switch(k){case 0:case 125:y=0;case 59+h:C==-1&&(v=fn(v,/\f/g,"")),u>0&&(Fe(v)-d||m===0)&&To(u>32?bc(v+";",i,r,d-1,l):bc(fn(v," ","")+";",i,r,d-2,l),l);break;case 59:v+=";";default:if(To(L=xc(v,t,r,c,h,o,n,T,S=[],_=[],d,s),s),k===123)if(h===0)Po(v,t,L,L,S,s,d,n,_);else{switch(f){case 99:if(Zr(v,3)===110)break;case 108:if(Zr(v,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Po(e,L,L,i&&To(xc(e,L,L,0,0,o,n,T,o,S=[],d,_),_),o,_,d,n,i?S:_):Po(v,L,L,L,[""],_,0,n,_)}}c=h=u=0,m=C=1,T=v="",d=a;break;case 58:d=1+Fe(v),u=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&zS()==125)continue}switch(v+=Di(k),k*m){case 38:C=h>0?1:(v+="\f",-1);break;case 44:if(b>0)break;n[c++]=(Fe(v)-1)*C,C=1;break;case 64:ir()===45&&(v+=ga(xe())),f=ir(),h=d=Fe(T=v+=XS(Do())),k++;break;case 45:g===45&&Fe(v)==2&&(m=0)}}return s}function xc(e,t,r,i,o,s,a,n,l,c,h,d){for(var f=o-1,u=o===0?s:[""],g=Qg(u),m=0,y=0,C=0;m0?u[b]+" "+k:fn(k,/&\f/g,u[b])))&&(l[C++]=T);return yl(e,t,r,o===0?Xg:n,l,c,h,d)}function ZS(e,t,r,i){return yl(e,t,r,ml,Di(WS()),ii(e,2,-2),0,i)}function bc(e,t,r,i,o){return yl(e,t,r,Vg,ii(e,0,i),ii(e,i+1,-1),i,o)}function gn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),t_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-BvJQmgsI.js");return{diagram:t}},__vite__mapDeps([11,12,5,6,7]));return{id:tm,diagram:e}},"loader"),e_={id:tm,detector:JS,loader:t_},r_=e_,em="flowchart",i_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),o_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-BJ9xq3_H.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:em,diagram:e}},"loader"),s_={id:em,detector:i_,loader:o_},a_=s_,rm="flowchart-v2",n_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),l_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-BJ9xq3_H.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:rm,diagram:e}},"loader"),h_={id:rm,detector:n_,loader:l_},c_=h_,im="swimlane",d_=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),u_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-DRwlvM9F.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,16,12,17,5,6,7]));return{id:im,diagram:e}},"loader"),f_={id:im,detector:d_,loader:u_},p_=f_,om="er",g_=p(e=>/^\s*erDiagram/.test(e),"detector"),m_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-MX1lpdtV.js");return{diagram:t}},__vite__mapDeps([19,15,16,17,5,6,7]));return{id:om,diagram:e}},"loader"),y_={id:om,detector:g_,loader:m_},C_=y_,sm="gitGraph",x_=p(e=>/^\s*gitGraph/.test(e),"detector"),b_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-BO6zli_L.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,5,6,7]));return{id:sm,diagram:e}},"loader"),k_={id:sm,detector:x_,loader:b_},w_=k_,am="gantt",T_=p(e=>/^\s*gantt/.test(e),"detector"),S_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-UHBCrlBo.js");return{diagram:t}},__vite__mapDeps([24,7,25,26,27,5,6]));return{id:am,diagram:e}},"loader"),__={id:am,detector:T_,loader:S_},B_=__,nm="info",v_=p(e=>/^\s*info/.test(e),"detector"),L_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-D1xLYfmf.js");return{diagram:t}},__vite__mapDeps([28,23,5,6,7]));return{id:nm,diagram:e}},"loader"),F_={id:nm,detector:v_,loader:L_},lm="pie",A_=p(e=>/^\s*pie/.test(e),"detector"),E_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-D4ADRI8d.js");return{diagram:t}},__vite__mapDeps([29,22,23,5,6,30,31,26,7]));return{id:lm,diagram:e}},"loader"),M_={id:lm,detector:A_,loader:E_},hm="quadrantChart",$_=p(e=>/^\s*quadrantChart/.test(e),"detector"),O_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-DM_U-KIt.js");return{diagram:t}},__vite__mapDeps([32,25,26,27,5,6,7]));return{id:hm,diagram:e}},"loader"),I_={id:hm,detector:$_,loader:O_},D_=I_,cm="xychart",P_=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),R_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-DJUplk_O.js");return{diagram:t}},__vite__mapDeps([33,26,31,25,27,5,6,7]));return{id:cm,diagram:e}},"loader"),N_={id:cm,detector:P_,loader:R_},q_=N_,dm="requirement",W_=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-CxBcxos4.js");return{diagram:t}},__vite__mapDeps([34,15,16,5,6,7]));return{id:dm,diagram:e}},"loader"),H_={id:dm,detector:W_,loader:z_},Y_=H_,um="sequence",U_=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),j_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-ne5mKmWY.js");return{diagram:t}},__vite__mapDeps([35,21,12,5,6,7]));return{id:um,diagram:e}},"loader"),G_={id:um,detector:U_,loader:j_},X_=G_,fm="class",V_=p((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-FzVd5qC_.js");return{diagram:t}},__vite__mapDeps([36,37,14,15,16,12,5,6,7]));return{id:fm,diagram:e}},"loader"),K_={id:fm,detector:V_,loader:Z_},Q_=K_,pm="classDiagram",J_=p((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),tB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-FzVd5qC_.js");return{diagram:t}},__vite__mapDeps([38,37,14,15,16,12,5,6,7]));return{id:pm,diagram:e}},"loader"),eB={id:pm,detector:J_,loader:tB},rB=eB,gm="state",iB=p((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-wqCW5C6q.js");return{diagram:t}},__vite__mapDeps([39,40,15,16,12,2,4,3,5,6,7]));return{id:gm,diagram:e}},"loader"),sB={id:gm,detector:iB,loader:oB},aB=sB,mm="stateDiagram",nB=p((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),lB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js");return{diagram:t}},__vite__mapDeps([41,40,15,16,12,5,6,7]));return{id:mm,diagram:e}},"loader"),hB={id:mm,detector:nB,loader:lB},cB=hB,ym="journey",dB=p(e=>/^\s*journey/.test(e),"detector"),uB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-DW8NrHP6.js");return{diagram:t}},__vite__mapDeps([42,14,12,30,5,6,7]));return{id:ym,diagram:e}},"loader"),fB={id:ym,detector:dB,loader:uB},pB=fB,gB=p((e,t,r)=>{q.debug(`rendering svg for syntax error -`);const i=Yk(t),o=i.append("g");i.attr("viewBox","0 0 2412 512"),Gc(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Cm={draw:gB},mB=Cm,yB={db:{},renderer:Cm,parser:{parse:p(()=>{},"parse")}},CB=yB,xm="flowchart-elk",xB=p((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),bB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-BJ9xq3_H.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:xm,diagram:e}},"loader"),kB={id:xm,detector:xB,loader:bB},wB=kB,bm="timeline",TB=p(e=>/^\s*timeline/.test(e),"detector"),SB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-DRuJB2Ns.js");return{diagram:t}},__vite__mapDeps([43,30,5,6,7]));return{id:bm,diagram:e}},"loader"),_B={id:bm,detector:TB,loader:SB},BB=_B,km="mindmap",vB=p(e=>/^\s*mindmap/.test(e),"detector"),LB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-FiRh3KHx.js");return{diagram:t}},__vite__mapDeps([44,15,16,5,6,7]));return{id:km,diagram:e}},"loader"),FB={id:km,detector:vB,loader:LB},AB=FB,wm="kanban",EB=p(e=>/^\s*kanban/.test(e),"detector"),MB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-DBZtJFK7.js");return{diagram:t}},__vite__mapDeps([45,14,5,6,7]));return{id:wm,diagram:e}},"loader"),$B={id:wm,detector:EB,loader:MB},OB=$B,Tm="sankey",IB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),DB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-DQOKpLQv.js");return{diagram:t}},__vite__mapDeps([46,31,26,5,6,7]));return{id:Tm,diagram:e}},"loader"),PB={id:Tm,detector:IB,loader:DB},RB=PB,Sm="packet",NB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),qB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-iqDRMohg.js");return{diagram:t}},__vite__mapDeps([47,22,23,5,6,7]));return{id:Sm,diagram:e}},"loader"),WB={id:Sm,detector:NB,loader:qB},_m="radar",zB=p(e=>/^\s*radar-beta/.test(e),"detector"),HB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-lGPhYqjp.js");return{diagram:t}},__vite__mapDeps([48,22,23,5,6,7]));return{id:_m,diagram:e}},"loader"),YB={id:_m,detector:zB,loader:HB},Bm="block",UB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-CpvS2-LC.js");return{diagram:t}},__vite__mapDeps([49,14,2,17,5,6,7]));return{id:Bm,diagram:e}},"loader"),GB={id:Bm,detector:UB,loader:jB},XB=GB,vm="treeView",VB=p(e=>/^\s*treeView-beta/.test(e),"detector"),ZB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP-DSnuTLFG.js");return{diagram:t}},__vite__mapDeps([50,21,22,23,5,6,7]));return{id:vm,diagram:e}},"loader"),KB={id:vm,detector:VB,loader:ZB},QB=KB,Lm="architecture",JB=p(e=>/^\s*architecture/.test(e),"detector"),tv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-CEA-tR1m.js");return{diagram:t}},__vite__mapDeps([51,22,23,5,6,10,7]));return{id:Lm,diagram:e}},"loader"),ev={id:Lm,detector:JB,loader:tv},rv=ev,Fm="eventmodeling",iv=p(e=>/^\s*eventmodeling/.test(e),"detector"),ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-Cqley8W-.js");return{diagram:t}},__vite__mapDeps([52,22,23,5,6,7]));return{id:Fm,diagram:e}},"loader"),sv={id:Fm,detector:iv,loader:ov},av=sv,Am="ishikawa",nv=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-BpjBlRoK.js");return{diagram:t}},__vite__mapDeps([53,5,6,7]));return{id:Am,diagram:e}},"loader"),hv={id:Am,detector:nv,loader:lv},Em="venn",cv=p(e=>/^\s*venn-beta/.test(e),"detector"),dv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-DtEwf89X.js");return{diagram:t}},__vite__mapDeps([54,5,6,7]));return{id:Em,diagram:e}},"loader"),uv={id:Em,detector:cv,loader:dv},fv=uv,Mm="treemap",pv=p(e=>/^\s*treemap/.test(e),"detector"),gv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-jJWknpV7.js");return{diagram:t}},__vite__mapDeps([55,22,16,23,5,6,27,31,26,7]));return{id:Mm,diagram:e}},"loader"),mv={id:Mm,detector:pv,loader:gv},$m="wardley",yv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),Cv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-BQgMNH39.js");return{diagram:t}},__vite__mapDeps([56,22,23,5,6,7]));return{id:$m,diagram:e}},"loader"),xv={id:$m,detector:yv,loader:Cv},bv=xv,Om="cynefin",kv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),wv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-DZWywj_D.js");return{diagram:t}},__vite__mapDeps([57,22,23,5,6,7]));return{id:Om,diagram:e}},"loader"),Tv={id:Om,detector:kv,loader:wv},Im="railroad",Sv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-DemW1ILD.js");return{diagram:t}},__vite__mapDeps([58,59,22,23,5,6,7]));return{id:Im,diagram:e}},"loader"),Bv={id:Im,detector:Sv,loader:_v},Dm="railroadEbnf",vv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-DWQayqTx.js");return{diagram:t}},__vite__mapDeps([60,59,22,23,5,6,7]));return{id:Dm,diagram:e}},"loader"),Fv={id:Dm,detector:vv,loader:Lv},Pm="railroadAbnf",Av=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Ev=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-D_3zPyPt.js");return{diagram:t}},__vite__mapDeps([61,59,22,23,5,6,7]));return{id:Pm,diagram:e}},"loader"),Mv={id:Pm,detector:Av,loader:Ev},Rm="railroadPeg",$v=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),Ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-DCy00Y6H.js");return{diagram:t}},__vite__mapDeps([62,59,22,23,5,6,7]));return{id:Rm,diagram:e}},"loader"),Iv={id:Rm,detector:$v,loader:Ov},kc=!1,$s=p(()=>{kc||(kc=!0,zo("error",CB,e=>e.toLowerCase().trim()==="error"),zo("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ba(wB,AB,rv),ba(r_,OB,rB,Q_,C_,B_,F_,M_,Y_,X_,p_,c_,a_,BB,w_,cB,aB,pB,D_,RB,WB,q_,XB,av,QB,YB,hv,mv,Bv,Fv,Mv,Iv,fv,bv,Tv))},"addDiagrams"),Dv=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Sr).map(async([r,{detector:i,loader:o}])=>{if(o)try{Sa(r)}catch{try{const{diagram:s,id:a}=await o();zo(a,s,i)}catch(s){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Sr[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Pv="graphics-document document";function Nm(e,t){e.attr("role",Pv),t!==""&&e.attr("aria-roledescription",t)}p(Nm,"setA11yDiagramInfo");function qm(e,t,r,i){if(e.insert!==void 0){if(r){const o=`chart-desc-${i}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(r)}if(t){const o=`chart-title-${i}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(t)}}}p(qm,"addSVGa11yTitleDescription");var mn=class Wm{constructor(t,r,i,o,s){this.type=t,this.text=r,this.db=i,this.parser=o,this.renderer=s}static{p(this,"Diagram")}static async fromText(t,r={}){const i=vt(),o=xn(t,i);t=Z2(t)+` + L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),FS=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),AS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o,a=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");a.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),a.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),a.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),a.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),ES={extension:hS,composition:cS,aggregation:dS,dependency:uS,lollipop:fS,point:pS,circle:gS,cross:mS,barb:yS,barbNeo:CS,only_one:xS,zero_or_one:bS,one_or_more:kS,zero_or_more:wS,only_one_neo:TS,zero_or_one_neo:SS,one_or_more_neo:_S,zero_or_more_neo:BS,requirement_arrow:vS,requirement_contains:FS,requirement_arrow_neo:LS,requirement_contains_neo:AS},MS=lS,$S={common:Zi,getConfig:vt,insertCluster:LT,insertEdge:nS,insertEdgeLabel:tS,insertMarkers:MS,insertNode:Hg,interpolateToCurve:Vn,labelHelper:it,log:q,positionEdgeLabel:eS},Gi={},Gg=p(e=>{for(const t of e)Gi[t.name]=t},"registerLayoutLoaders"),OS=p(()=>{Gg([{name:"dagre",loader:p(async()=>await nt(()=>import("./dagre-VKFMJZFB-D8gdq5tS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"swimlane",loader:p(async()=>await nt(()=>import("./swimlanes-5IMT3BWC-D6xMtJ1E.js"),__vite__mapDeps([8,5,6,1,2,3,7])),"loader")},{name:"cose-bilkent",loader:p(async()=>await nt(()=>import("./cose-bilkent-JH36ORCC-TWQPJk-P.js"),__vite__mapDeps([9,10,7,5,6])),"loader")}])},"registerDefaultLayoutLoaders");OS();var GL=p(async(e,t,r)=>{if(!(e.layoutAlgorithm in Gi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const i=Gi[e.layoutAlgorithm],o=await i.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),n){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return o.render(e,t,$S,{algorithm:i.algorithm},r)},"render"),XL=p((e="",{fallback:t="dagre"}={})=>{if(e in Gi)return e;if(t in Gi)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),ml="comm",Xg="rule",Vg="decl",IS="@media",DS="@import",PS="@supports",RS="@namespace",un="@keyframes",Zg="@layer",NS="@scope",qS=Math.abs,Di=String.fromCharCode;function Kg(e){return e.trim()}function fn(e,t,r){return e.replace(t,r)}function Zr(e,t){return e.charCodeAt(t)|0}function ii(e,t,r){return e.slice(t,r)}function Fe(e){return e.length}function Qg(e){return e.length}function To(e,t){return t.push(e),e}var Es=1,oi=1,Jg=0,ce=0,$t=0,ni="";function yl(e,t,r,i,o,s,a,n){return{value:e,root:t,parent:r,type:i,props:o,children:s,line:Es,column:oi,length:a,return:"",siblings:n}}function WS(){return $t}function zS(){return $t=ce>0?Zr(ni,--ce):0,oi--,$t===10&&(oi=1,Es--),$t}function xe(){return $t=ce2||Xi($t)>3?"":" "}function jS(e,t){for(;--t&&xe()&&!($t<48||$t>102||$t>57&&$t<65||$t>70&&$t<97););return Ms(e,Do()+(t<6&&ir()==32&&xe()==32))}function pn(e){for(;xe();)switch($t){case e:return ce;case 34:case 39:e!==34&&e!==39&&pn($t);break;case 40:e===41&&pn(e);break;case 92:xe();break}return ce}function GS(e,t){for(;xe()&&e+$t!==57;)if(e+$t===84&&ir()===47)break;return"/*"+Ms(t,ce-1)+"*"+Di(e===47?e:xe())}function XS(e){for(;!Xi(ir());)xe();return Ms(e,ce)}function VS(e){return YS(Po("",null,null,null,[""],e=HS(e),0,[0],e))}function Po(e,t,r,i,o,s,a,n,l){for(var c=0,h=0,d=a,f=0,u=0,g=0,m=1,y=1,C=1,b=0,k=0,T="",S=o,_=s,L=i,v=T;y;)switch(g=k,k=xe()){case 40:g!=108&&Zr(v,d-1)==58?(b++,v+="("):v+=ga(k);break;case 41:b--,v+=")";break;case 34:case 39:case 91:v+=ga(k);break;case 9:case 10:case 13:case 32:if(b>0){v+=Di(k);break}v+=US(g);break;case 92:v+=jS(Do()-1,7);continue;case 47:switch(ir()){case 42:case 47:To(ZS(GS(xe(),Do()),t,r,l),l),(Xi(g||1)==5||Xi(ir()||1)==5)&&Fe(v)&&ii(v,-1,void 0)!==" "&&(v+=" ");break;default:v+="/"}break;case 123*m:n[c++]=Fe(v)*C;case 125*m:case 59:case 0:if(b>0&&k){v+=Di(k);break}switch(k){case 0:case 125:y=0;case 59+h:C==-1&&(v=fn(v,/\f/g,"")),u>0&&(Fe(v)-d||m===0)&&To(u>32?bc(v+";",i,r,d-1,l):bc(fn(v," ","")+";",i,r,d-2,l),l);break;case 59:v+=";";default:if(To(L=xc(v,t,r,c,h,o,n,T,S=[],_=[],d,s),s),k===123)if(h===0)Po(v,t,L,L,S,s,d,n,_);else{switch(f){case 99:if(Zr(v,3)===110)break;case 108:if(Zr(v,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Po(e,L,L,i&&To(xc(e,L,L,0,0,o,n,T,o,S=[],d,_),_),o,_,d,n,i?S:_):Po(v,L,L,L,[""],_,0,n,_)}}c=h=u=0,m=C=1,T=v="",d=a;break;case 58:d=1+Fe(v),u=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&zS()==125)continue}switch(v+=Di(k),k*m){case 38:C=h>0?1:(v+="\f",-1);break;case 44:if(b>0)break;n[c++]=(Fe(v)-1)*C,C=1;break;case 64:ir()===45&&(v+=ga(xe())),f=ir(),h=d=Fe(T=v+=XS(Do())),k++;break;case 45:g===45&&Fe(v)==2&&(m=0)}}return s}function xc(e,t,r,i,o,s,a,n,l,c,h,d){for(var f=o-1,u=o===0?s:[""],g=Qg(u),m=0,y=0,C=0;m0?u[b]+" "+k:fn(k,/&\f/g,u[b])))&&(l[C++]=T);return yl(e,t,r,o===0?Xg:n,l,c,h,d)}function ZS(e,t,r,i){return yl(e,t,r,ml,Di(WS()),ii(e,2,-2),0,i)}function bc(e,t,r,i,o){return yl(e,t,r,Vg,ii(e,0,i),ii(e,i+1,-1),i,o)}function gn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),t_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-CUyKVoVi.js");return{diagram:t}},__vite__mapDeps([11,12,5,6,7]));return{id:tm,diagram:e}},"loader"),e_={id:tm,detector:JS,loader:t_},r_=e_,em="flowchart",i_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),o_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:em,diagram:e}},"loader"),s_={id:em,detector:i_,loader:o_},a_=s_,rm="flowchart-v2",n_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),l_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:rm,diagram:e}},"loader"),h_={id:rm,detector:n_,loader:l_},c_=h_,im="swimlane",d_=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),u_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-DKIx012r.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,16,12,17,5,6,7]));return{id:im,diagram:e}},"loader"),f_={id:im,detector:d_,loader:u_},p_=f_,om="er",g_=p(e=>/^\s*erDiagram/.test(e),"detector"),m_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-DVzumNgk.js");return{diagram:t}},__vite__mapDeps([19,15,16,17,5,6,7]));return{id:om,diagram:e}},"loader"),y_={id:om,detector:g_,loader:m_},C_=y_,sm="gitGraph",x_=p(e=>/^\s*gitGraph/.test(e),"detector"),b_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-D7UBC8np.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,5,6,7]));return{id:sm,diagram:e}},"loader"),k_={id:sm,detector:x_,loader:b_},w_=k_,am="gantt",T_=p(e=>/^\s*gantt/.test(e),"detector"),S_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-B2lfrNfh.js");return{diagram:t}},__vite__mapDeps([24,7,25,26,27,5,6]));return{id:am,diagram:e}},"loader"),__={id:am,detector:T_,loader:S_},B_=__,nm="info",v_=p(e=>/^\s*info/.test(e),"detector"),L_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-DASw56fH.js");return{diagram:t}},__vite__mapDeps([28,23,5,6,7]));return{id:nm,diagram:e}},"loader"),F_={id:nm,detector:v_,loader:L_},lm="pie",A_=p(e=>/^\s*pie/.test(e),"detector"),E_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-f3F4At6v.js");return{diagram:t}},__vite__mapDeps([29,22,23,5,6,30,31,26,7]));return{id:lm,diagram:e}},"loader"),M_={id:lm,detector:A_,loader:E_},hm="quadrantChart",$_=p(e=>/^\s*quadrantChart/.test(e),"detector"),O_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-3t7sFhfl.js");return{diagram:t}},__vite__mapDeps([32,25,26,27,5,6,7]));return{id:hm,diagram:e}},"loader"),I_={id:hm,detector:$_,loader:O_},D_=I_,cm="xychart",P_=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),R_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-yQImOWPy.js");return{diagram:t}},__vite__mapDeps([33,26,31,25,27,5,6,7]));return{id:cm,diagram:e}},"loader"),N_={id:cm,detector:P_,loader:R_},q_=N_,dm="requirement",W_=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-Bzvt0v7J.js");return{diagram:t}},__vite__mapDeps([34,15,16,5,6,7]));return{id:dm,diagram:e}},"loader"),H_={id:dm,detector:W_,loader:z_},Y_=H_,um="sequence",U_=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),j_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-CnV0H-kS.js");return{diagram:t}},__vite__mapDeps([35,21,12,5,6,7]));return{id:um,diagram:e}},"loader"),G_={id:um,detector:U_,loader:j_},X_=G_,fm="class",V_=p((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-ClMG95L0.js");return{diagram:t}},__vite__mapDeps([36,37,14,15,16,12,5,6,7]));return{id:fm,diagram:e}},"loader"),K_={id:fm,detector:V_,loader:Z_},Q_=K_,pm="classDiagram",J_=p((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),tB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-ClMG95L0.js");return{diagram:t}},__vite__mapDeps([38,37,14,15,16,12,5,6,7]));return{id:pm,diagram:e}},"loader"),eB={id:pm,detector:J_,loader:tB},rB=eB,gm="state",iB=p((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-GIVsAB2M.js");return{diagram:t}},__vite__mapDeps([39,40,15,16,12,2,4,3,5,6,7]));return{id:gm,diagram:e}},"loader"),sB={id:gm,detector:iB,loader:oB},aB=sB,mm="stateDiagram",nB=p((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),lB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB-0KuGlzV7.js");return{diagram:t}},__vite__mapDeps([41,40,15,16,12,5,6,7]));return{id:mm,diagram:e}},"loader"),hB={id:mm,detector:nB,loader:lB},cB=hB,ym="journey",dB=p(e=>/^\s*journey/.test(e),"detector"),uB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-BShuBRgf.js");return{diagram:t}},__vite__mapDeps([42,14,12,30,5,6,7]));return{id:ym,diagram:e}},"loader"),fB={id:ym,detector:dB,loader:uB},pB=fB,gB=p((e,t,r)=>{q.debug(`rendering svg for syntax error +`);const i=Yk(t),o=i.append("g");i.attr("viewBox","0 0 2412 512"),Gc(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Cm={draw:gB},mB=Cm,yB={db:{},renderer:Cm,parser:{parse:p(()=>{},"parse")}},CB=yB,xm="flowchart-elk",xB=p((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),bB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:xm,diagram:e}},"loader"),kB={id:xm,detector:xB,loader:bB},wB=kB,bm="timeline",TB=p(e=>/^\s*timeline/.test(e),"detector"),SB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-5u0AN8o0.js");return{diagram:t}},__vite__mapDeps([43,30,5,6,7]));return{id:bm,diagram:e}},"loader"),_B={id:bm,detector:TB,loader:SB},BB=_B,km="mindmap",vB=p(e=>/^\s*mindmap/.test(e),"detector"),LB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-HXhM1kRL.js");return{diagram:t}},__vite__mapDeps([44,15,16,5,6,7]));return{id:km,diagram:e}},"loader"),FB={id:km,detector:vB,loader:LB},AB=FB,wm="kanban",EB=p(e=>/^\s*kanban/.test(e),"detector"),MB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-_UoHLqzR.js");return{diagram:t}},__vite__mapDeps([45,14,5,6,7]));return{id:wm,diagram:e}},"loader"),$B={id:wm,detector:EB,loader:MB},OB=$B,Tm="sankey",IB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),DB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-B5WnWxzh.js");return{diagram:t}},__vite__mapDeps([46,31,26,5,6,7]));return{id:Tm,diagram:e}},"loader"),PB={id:Tm,detector:IB,loader:DB},RB=PB,Sm="packet",NB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),qB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-DUn2m-AO.js");return{diagram:t}},__vite__mapDeps([47,22,23,5,6,7]));return{id:Sm,diagram:e}},"loader"),WB={id:Sm,detector:NB,loader:qB},_m="radar",zB=p(e=>/^\s*radar-beta/.test(e),"detector"),HB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-CFwFRAWa.js");return{diagram:t}},__vite__mapDeps([48,22,23,5,6,7]));return{id:_m,diagram:e}},"loader"),YB={id:_m,detector:zB,loader:HB},Bm="block",UB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-BNXb88Fr.js");return{diagram:t}},__vite__mapDeps([49,14,2,17,5,6,7]));return{id:Bm,diagram:e}},"loader"),GB={id:Bm,detector:UB,loader:jB},XB=GB,vm="treeView",VB=p(e=>/^\s*treeView-beta/.test(e),"detector"),ZB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP-BOIp7TNe.js");return{diagram:t}},__vite__mapDeps([50,21,22,23,5,6,7]));return{id:vm,diagram:e}},"loader"),KB={id:vm,detector:VB,loader:ZB},QB=KB,Lm="architecture",JB=p(e=>/^\s*architecture/.test(e),"detector"),tv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-CBluWNBt.js");return{diagram:t}},__vite__mapDeps([51,22,23,5,6,10,7]));return{id:Lm,diagram:e}},"loader"),ev={id:Lm,detector:JB,loader:tv},rv=ev,Fm="eventmodeling",iv=p(e=>/^\s*eventmodeling/.test(e),"detector"),ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-D2bRXH1a.js");return{diagram:t}},__vite__mapDeps([52,22,23,5,6,7]));return{id:Fm,diagram:e}},"loader"),sv={id:Fm,detector:iv,loader:ov},av=sv,Am="ishikawa",nv=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-CcPuml-k.js");return{diagram:t}},__vite__mapDeps([53,5,6,7]));return{id:Am,diagram:e}},"loader"),hv={id:Am,detector:nv,loader:lv},Em="venn",cv=p(e=>/^\s*venn-beta/.test(e),"detector"),dv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-ozNTLnJz.js");return{diagram:t}},__vite__mapDeps([54,5,6,7]));return{id:Em,diagram:e}},"loader"),uv={id:Em,detector:cv,loader:dv},fv=uv,Mm="treemap",pv=p(e=>/^\s*treemap/.test(e),"detector"),gv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-BF9x_uf7.js");return{diagram:t}},__vite__mapDeps([55,22,16,23,5,6,27,31,26,7]));return{id:Mm,diagram:e}},"loader"),mv={id:Mm,detector:pv,loader:gv},$m="wardley",yv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),Cv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-BuQJYWm-.js");return{diagram:t}},__vite__mapDeps([56,22,23,5,6,7]));return{id:$m,diagram:e}},"loader"),xv={id:$m,detector:yv,loader:Cv},bv=xv,Om="cynefin",kv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),wv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-zQaCQNIP.js");return{diagram:t}},__vite__mapDeps([57,22,23,5,6,7]));return{id:Om,diagram:e}},"loader"),Tv={id:Om,detector:kv,loader:wv},Im="railroad",Sv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-W9nf8fYD.js");return{diagram:t}},__vite__mapDeps([58,59,22,23,5,6,7]));return{id:Im,diagram:e}},"loader"),Bv={id:Im,detector:Sv,loader:_v},Dm="railroadEbnf",vv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-B4NTctc_.js");return{diagram:t}},__vite__mapDeps([60,59,22,23,5,6,7]));return{id:Dm,diagram:e}},"loader"),Fv={id:Dm,detector:vv,loader:Lv},Pm="railroadAbnf",Av=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Ev=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-C0Afmuc1.js");return{diagram:t}},__vite__mapDeps([61,59,22,23,5,6,7]));return{id:Pm,diagram:e}},"loader"),Mv={id:Pm,detector:Av,loader:Ev},Rm="railroadPeg",$v=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),Ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-_6D7zUy-.js");return{diagram:t}},__vite__mapDeps([62,59,22,23,5,6,7]));return{id:Rm,diagram:e}},"loader"),Iv={id:Rm,detector:$v,loader:Ov},kc=!1,$s=p(()=>{kc||(kc=!0,zo("error",CB,e=>e.toLowerCase().trim()==="error"),zo("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ba(wB,AB,rv),ba(r_,OB,rB,Q_,C_,B_,F_,M_,Y_,X_,p_,c_,a_,BB,w_,cB,aB,pB,D_,RB,WB,q_,XB,av,QB,YB,hv,mv,Bv,Fv,Mv,Iv,fv,bv,Tv))},"addDiagrams"),Dv=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Sr).map(async([r,{detector:i,loader:o}])=>{if(o)try{Sa(r)}catch{try{const{diagram:s,id:a}=await o();zo(a,s,i)}catch(s){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Sr[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Pv="graphics-document document";function Nm(e,t){e.attr("role",Pv),t!==""&&e.attr("aria-roledescription",t)}p(Nm,"setA11yDiagramInfo");function qm(e,t,r,i){if(e.insert!==void 0){if(r){const o=`chart-desc-${i}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(r)}if(t){const o=`chart-title-${i}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(t)}}}p(qm,"addSVGa11yTitleDescription");var mn=class Wm{constructor(t,r,i,o,s){this.type=t,this.text=r,this.db=i,this.parser=o,this.renderer=s}static{p(this,"Diagram")}static async fromText(t,r={}){const i=vt(),o=xn(t,i);t=Z2(t)+` `;try{Sa(o)}catch{const c=R0(o);if(!c)throw new Wc(`Diagram ${o} not found.`);const{id:h,diagram:d}=await c();zo(h,d)}const{db:s,parser:a,renderer:n,init:l}=Sa(o);return a.parser&&(a.parser.yy=s),s.clear?.(),l?.(i),r.title&&s.setDiagramTitle?.(r.title),await a.parse(t),new Wm(o,t,s,a,n)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},wc=[],Rv=p(()=>{wc.forEach(e=>{e()}),wc=[]},"attachFunctions"),Nv=p(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function zm(e){const t=e.match(qc);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(` `).map(a=>a.startsWith(r)?a.slice(r.length):a).join(` `):t[2];let o=K1(i,{schema:Z1})??{};o=typeof o=="object"&&!Array.isArray(o)?o:{};const s={};return o.displayMode&&(s.displayMode=o.displayMode.toString()),o.title&&(s.title=o.title.toString()),o.config&&(s.config=o.config),{text:e.slice(t[0].length),metadata:s}}p(zm,"extractFrontMatter");var qv=p(e=>e.replace(/\r\n?/g,` diff --git a/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-FiRh3KHx.js b/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js similarity index 98% rename from apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-FiRh3KHx.js rename to apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js index 2560315029c..75b39e1c16c 100644 --- a/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-FiRh3KHx.js +++ b/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js @@ -1,4 +1,4 @@ -import{g as oe}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as ae}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as l,l as C,v as ce,x as le,z as he,D as G,c as B,i as F,b6 as de,aa as ge,ab as ue,ac as pe}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";const E=[];for(let e=0;e<256;++e)E.push((e+256).toString(16).slice(1));function fe(e,n=0){return(E[e[n+0]]+E[e[n+1]]+E[e[n+2]]+E[e[n+3]]+"-"+E[e[n+4]]+E[e[n+5]]+"-"+E[e[n+6]]+E[e[n+7]]+"-"+E[e[n+8]]+E[e[n+9]]+"-"+E[e[n+10]]+E[e[n+11]]+E[e[n+12]]+E[e[n+13]]+E[e[n+14]]+E[e[n+15]]).toLowerCase()}const me=new Uint8Array(16);function ye(){return crypto.getRandomValues(me)}function Ee(e,n,g){return crypto.randomUUID?crypto.randomUUID():_e(e)}function _e(e,n,g){e=e||{};const a=e.random??e.rng?.()??ye();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,fe(a)}var Y=(function(){var e=l(function(D,s,i,o){for(i=i||{},o=D.length;o--;i[D[o]]=s);return i},"o"),n=[1,4],g=[1,13],a=[1,12],t=[1,15],h=[1,16],f=[1,20],m=[1,19],_=[6,7,8],T=[1,26],I=[1,24],w=[1,25],d=[6,7,11],R=[1,6,13,15,16,19,22],q=[1,33],J=[1,34],A=[1,6,7,11,13,15,16,19,22],j={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,i,o,c,p,r,$){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:g,7:[1,10],9:9,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(_,[2,3]),{1:[2,2]},e(_,[2,4]),e(_,[2,5]),{1:[2,6],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:g,9:22,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:T,7:I,10:23,11:w},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:m}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:T,7:I,10:32,11:w},{1:[2,7],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(R,[2,14],{7:q,11:J}),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(R,[2,13],{7:q,11:J}),e(A,[2,11]),e(A,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:l(function(s){var i=this,o=[0],c=[],p=[null],r=[],$=this.table,u="",M=0,K=0,ne=2,Q=1,ie=r.slice.call(arguments,1),y=Object.create(this.lexer),L={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(L.yy[H]=this.yy[H]);y.setInput(s,L.yy),L.yy.lexer=y,L.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var z=y.yylloc;r.push(z);var se=y.options&&y.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(k){o.length=o.length-2*k,p.length=p.length-k,r.length=r.length-k}l(re,"popStack");function Z(){var k;return k=c.pop()||y.lex()||Q,typeof k!="number"&&(k instanceof Array&&(c=k,k=c.pop()),k=i.symbols_[k]||k),k}l(Z,"lex");for(var b,v,S,W,O={},U,x,ee,V;;){if(v=o[o.length-1],this.defaultActions[v]?S=this.defaultActions[v]:((b===null||typeof b>"u")&&(b=Z()),S=$[v]&&$[v][b]),typeof S>"u"||!S.length||!S[0]){var X="";V=[];for(U in $[v])this.terminals_[U]&&U>ne&&V.push("'"+this.terminals_[U]+"'");y.showPosition?X="Parse error on line "+(M+1)+`: +import{g as oe}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as ae}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as l,l as C,v as ce,x as le,z as he,D as G,c as B,i as F,b6 as de,aa as ge,ab as ue,ac as pe}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";const E=[];for(let e=0;e<256;++e)E.push((e+256).toString(16).slice(1));function fe(e,n=0){return(E[e[n+0]]+E[e[n+1]]+E[e[n+2]]+E[e[n+3]]+"-"+E[e[n+4]]+E[e[n+5]]+"-"+E[e[n+6]]+E[e[n+7]]+"-"+E[e[n+8]]+E[e[n+9]]+"-"+E[e[n+10]]+E[e[n+11]]+E[e[n+12]]+E[e[n+13]]+E[e[n+14]]+E[e[n+15]]).toLowerCase()}const me=new Uint8Array(16);function ye(){return crypto.getRandomValues(me)}function Ee(e,n,g){return crypto.randomUUID?crypto.randomUUID():_e(e)}function _e(e,n,g){e=e||{};const a=e.random??e.rng?.()??ye();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,fe(a)}var Y=(function(){var e=l(function(D,s,i,o){for(i=i||{},o=D.length;o--;i[D[o]]=s);return i},"o"),n=[1,4],g=[1,13],a=[1,12],t=[1,15],h=[1,16],f=[1,20],m=[1,19],_=[6,7,8],T=[1,26],I=[1,24],w=[1,25],d=[6,7,11],R=[1,6,13,15,16,19,22],q=[1,33],J=[1,34],A=[1,6,7,11,13,15,16,19,22],j={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,i,o,c,p,r,$){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:g,7:[1,10],9:9,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(_,[2,3]),{1:[2,2]},e(_,[2,4]),e(_,[2,5]),{1:[2,6],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:g,9:22,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:T,7:I,10:23,11:w},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:m}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:T,7:I,10:32,11:w},{1:[2,7],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(R,[2,14],{7:q,11:J}),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(R,[2,13],{7:q,11:J}),e(A,[2,11]),e(A,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:l(function(s){var i=this,o=[0],c=[],p=[null],r=[],$=this.table,u="",M=0,K=0,ne=2,Q=1,ie=r.slice.call(arguments,1),y=Object.create(this.lexer),L={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(L.yy[H]=this.yy[H]);y.setInput(s,L.yy),L.yy.lexer=y,L.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var z=y.yylloc;r.push(z);var se=y.options&&y.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(k){o.length=o.length-2*k,p.length=p.length-k,r.length=r.length-k}l(re,"popStack");function Z(){var k;return k=c.pop()||y.lex()||Q,typeof k!="number"&&(k instanceof Array&&(c=k,k=c.pop()),k=i.symbols_[k]||k),k}l(Z,"lex");for(var b,v,S,W,O={},U,x,ee,V;;){if(v=o[o.length-1],this.defaultActions[v]?S=this.defaultActions[v]:((b===null||typeof b>"u")&&(b=Z()),S=$[v]&&$[v][b]),typeof S>"u"||!S.length||!S[0]){var X="";V=[];for(U in $[v])this.terminals_[U]&&U>ne&&V.push("'"+this.terminals_[U]+"'");y.showPosition?X="Parse error on line "+(M+1)+`: `+y.showPosition()+` Expecting `+V.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(M+1)+": Unexpected "+(b==Q?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:y.match,token:this.terminals_[b]||b,line:y.yylineno,loc:z,expected:V})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+b);switch(S[0]){case 1:o.push(b),p.push(y.yytext),r.push(y.yylloc),o.push(S[1]),b=null,K=y.yyleng,u=y.yytext,M=y.yylineno,z=y.yylloc;break;case 2:if(x=this.productions_[S[1]][1],O.$=p[p.length-x],O._$={first_line:r[r.length-(x||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(x||1)].first_column,last_column:r[r.length-1].last_column},se&&(O._$.range=[r[r.length-(x||1)].range[0],r[r.length-1].range[1]]),W=this.performAction.apply(O,[u,K,M,L.yy,S[1],p,r].concat(ie)),typeof W<"u")return W;x&&(o=o.slice(0,-1*x*2),p=p.slice(0,-1*x),r=r.slice(0,-1*x)),o.push(this.productions_[S[1]][0]),p.push(O.$),r.push(O._$),ee=$[o[o.length-2]][o[o.length-1]],o.push(ee);break;case 3:return!0}}return!0},"parse")},te=(function(){var D={EOF:1,parseError:l(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:l(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var i=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-DCy00Y6H.js b/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js similarity index 87% rename from apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-DCy00Y6H.js rename to apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js index 077e7485b8e..c2c272efd75 100644 --- a/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-DCy00Y6H.js +++ b/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js @@ -1 +1 @@ -import{g as l,r as m,d as a}from"./chunk-MOJQB5TN-hIDvr-8C.js";import{p}from"./chunk-JWPE2WC7-DTx-f56M.js";import{_ as t,l as o}from"./mermaid.core-Cahi9cr1.js";import{M as u,d as c}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; +import{g as l,r as m,d as a}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as t,l as o}from"./mermaid.core-CJB1tAev.js";import{M as u,d as c}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; diff --git a/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-D4ADRI8d.js b/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js similarity index 94% rename from apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-D4ADRI8d.js rename to apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js index e5bb5bae38c..b9b4f579b25 100644 --- a/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-D4ADRI8d.js +++ b/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js @@ -1,4 +1,4 @@ -import{p as at}from"./chunk-JWPE2WC7-DTx-f56M.js";import{K as T,N as B,b5 as rt,g as nt,s as it,a as ot,b as st,p as lt,o as ct,_ as g,l as G,c as ut,B as dt,F as gt,a1 as pt,e as ht,q as ft,D as mt}from"./mermaid.core-Cahi9cr1.js";import{p as vt}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import{d as X}from"./arc-E_7M-TWh.js";import{o as xt}from"./ordinal-Cboi1Yqb.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function St(t,n){return nt?1:n>=t?0:NaN}function yt(t){return t}function wt(){var t=yt,n=St,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=rt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,F=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=F*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:F};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var At=mt.pie,I={sections:new Map,showData:!1},W=I.sections,V=I.showData,Ct=structuredClone(At),$t=g(()=>structuredClone(Ct),"getConfig"),Dt=g(()=>{W=new Map,V=I.showData,ft()},"clear"),Tt=g(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);W.has(t)||(W.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),bt=g(()=>W,"getSections"),kt=g(t=>{V=t},"setShowData"),zt=g(()=>V,"getShowData"),Z={getConfig:$t,clear:Dt,setDiagramTitle:ct,getDiagramTitle:lt,setAccTitle:st,getAccTitle:ot,setAccDescription:it,getAccDescription:nt,addSection:Tt,getSections:bt,setShowData:kt,getShowData:zt},Et=g((t,n)=>{at(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Mt={parse:g(async t=>{const n=await vt("pie",t);G.debug(n),Et(n,Z)},"parse")},Rt=g(t=>` +import{p as at}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{K as T,N as B,b5 as rt,g as nt,s as it,a as ot,b as st,p as lt,o as ct,_ as g,l as G,c as ut,B as dt,F as gt,a1 as pt,e as ht,q as ft,D as mt}from"./mermaid.core-CJB1tAev.js";import{p as vt}from"./cynefin-VYW2F7L2-BIlq342y.js";import{d as X}from"./arc-IkhU3FHH.js";import{o as xt}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function St(t,n){return nt?1:n>=t?0:NaN}function yt(t){return t}function wt(){var t=yt,n=St,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=rt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,F=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=F*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:F};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var At=mt.pie,I={sections:new Map,showData:!1},W=I.sections,V=I.showData,Ct=structuredClone(At),$t=g(()=>structuredClone(Ct),"getConfig"),Dt=g(()=>{W=new Map,V=I.showData,ft()},"clear"),Tt=g(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);W.has(t)||(W.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),bt=g(()=>W,"getSections"),kt=g(t=>{V=t},"setShowData"),zt=g(()=>V,"getShowData"),Z={getConfig:$t,clear:Dt,setDiagramTitle:ct,getDiagramTitle:lt,setAccTitle:st,getAccTitle:ot,setAccDescription:it,getAccDescription:nt,addSection:Tt,getSections:bt,setShowData:kt,getShowData:zt},Et=g((t,n)=>{at(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Mt={parse:g(async t=>{const n=await vt("pie",t);G.debug(n),Et(n,Z)},"parse")},Rt=g(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; diff --git a/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-DM_U-KIt.js b/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js similarity index 99% rename from apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-DM_U-KIt.js rename to apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js index b5fad2c44c4..3f7c3054a53 100644 --- a/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-DM_U-KIt.js +++ b/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js @@ -1,4 +1,4 @@ -import{s as Se,g as _e,p as ee,o as Ae,a as ke,b as Fe,_ as r,c as Et,l as qt,d as vt,e as Pe,q as ve,D as z,i as Ce,W as Le}from"./mermaid.core-Cahi9cr1.js";import{l as te}from"./linear-DHRafvZW.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Ct=(function(){var t=r(function(Y,s,l,u){for(l=l||{},u=Y.length;u--;l[Y[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],k=[1,45],ct=[1,14],dt=[1,23],ut=[1,18],xt=[1,19],ot=[1,20],bt=[1,21],lt=[1,22],i=[1,24],Dt=[1,25],zt=[1,26],Vt=[1,27],It=[1,28],wt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],jt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],St=[1,103],Gt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(_,[2,34]),{27:46,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(c,[2,45]),t(c,[2,46]),{18:[1,51]},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:65,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,21:64},t(c,[2,53],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(c,[2,56],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(c,[2,57],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,58],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,59],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,60],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(c,[2,52],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,55],{58:31,43:85,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(c,[2,51],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,54],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(c,[2,29],{10:St}),t(Gt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(c,[2,50],{10:St}),t(Gt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Kt=0,Te=2,Zt=1,qe=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(j.yy[At]=this.yy[At]);D.setInput(s,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var kt=D.yylloc;e.push(kt);var me=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(R){u.length=u.length-2*R,A.length=A.length-R,e.length=e.length-R}r(be,"popStack");function Jt(){var R;return R=d.pop()||D.lex()||Zt,typeof R!="number"&&(R instanceof Array&&(d=R,R=d.pop()),R=l.symbols_[R]||R),R}r(Jt,"lex");for(var B,G,W,Ft,rt={},pt,M,$t,yt;;){if(G=u[u.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=Jt()),W=ht[G]&&ht[G][B]),typeof W>"u"||!W.length||!W[0]){var Pt="";yt=[];for(pt in ht[G])this.terminals_[pt]&&pt>Te&&yt.push("'"+this.terminals_[pt]+"'");D.showPosition?Pt="Parse error on line "+(gt+1)+`: +import{s as Se,g as _e,p as ee,o as Ae,a as ke,b as Fe,_ as r,c as Et,l as qt,d as vt,e as Pe,q as ve,D as z,i as Ce,W as Le}from"./mermaid.core-CJB1tAev.js";import{l as te}from"./linear-DH49UJnN.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Ct=(function(){var t=r(function(Y,s,l,u){for(l=l||{},u=Y.length;u--;l[Y[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],k=[1,45],ct=[1,14],dt=[1,23],ut=[1,18],xt=[1,19],ot=[1,20],bt=[1,21],lt=[1,22],i=[1,24],Dt=[1,25],zt=[1,26],Vt=[1,27],It=[1,28],wt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],jt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],St=[1,103],Gt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(_,[2,34]),{27:46,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(c,[2,45]),t(c,[2,46]),{18:[1,51]},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:65,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,21:64},t(c,[2,53],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(c,[2,56],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(c,[2,57],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,58],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,59],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,60],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(c,[2,52],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,55],{58:31,43:85,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(c,[2,51],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,54],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(c,[2,29],{10:St}),t(Gt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(c,[2,50],{10:St}),t(Gt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Kt=0,Te=2,Zt=1,qe=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(j.yy[At]=this.yy[At]);D.setInput(s,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var kt=D.yylloc;e.push(kt);var me=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(R){u.length=u.length-2*R,A.length=A.length-R,e.length=e.length-R}r(be,"popStack");function Jt(){var R;return R=d.pop()||D.lex()||Zt,typeof R!="number"&&(R instanceof Array&&(d=R,R=d.pop()),R=l.symbols_[R]||R),R}r(Jt,"lex");for(var B,G,W,Ft,rt={},pt,M,$t,yt;;){if(G=u[u.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=Jt()),W=ht[G]&&ht[G][B]),typeof W>"u"||!W.length||!W[0]){var Pt="";yt=[];for(pt in ht[G])this.terminals_[pt]&&pt>Te&&yt.push("'"+this.terminals_[pt]+"'");D.showPosition?Pt="Parse error on line "+(gt+1)+`: `+D.showPosition()+` Expecting `+yt.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(B==Zt?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Pt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:kt,expected:yt})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+B);switch(W[0]){case 1:u.push(B),A.push(D.yytext),e.push(D.yylloc),u.push(W[1]),B=null,Kt=D.yyleng,n=D.yytext,gt=D.yylineno,kt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],rt.$=A[A.length-M],rt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},me&&(rt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(rt,[n,Kt,gt,j.yy,W[1],A,e].concat(qe)),typeof Ft<"u")return Ft;M&&(u=u.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),u.push(this.productions_[W[1]][0]),A.push(rt.$),e.push(rt._$),$t=ht[u[u.length-2]][u[u.length-1]],u.push($t);break;case 3:return!0}}return!0},"parse")},ye=(function(){var Y={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DemW1ILD.js b/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js similarity index 84% rename from apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DemW1ILD.js rename to apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js index b96e459e48a..757f3d68334 100644 --- a/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DemW1ILD.js +++ b/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js @@ -1 +1 @@ -import{g as s,r as l,d as t}from"./chunk-MOJQB5TN-hIDvr-8C.js";import{p as m}from"./chunk-JWPE2WC7-DTx-f56M.js";import{_ as n,l as i}from"./mermaid.core-Cahi9cr1.js";import{M as p,c as u}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; +import{g as s,r as l,d as t}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p as m}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as n,l as i}from"./mermaid.core-CJB1tAev.js";import{M as p,c as u}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; diff --git a/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-CxBcxos4.js b/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js similarity index 99% rename from apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-CxBcxos4.js rename to apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js index bb6576f6dad..7eb6523fe0b 100644 --- a/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-CxBcxos4.js +++ b/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js @@ -1,4 +1,4 @@ -import{g as ze}from"./chunk-XXDRQBXY-BmzWd-kT.js";import{s as Ge}from"./chunk-VR4S4FIN-he8WxbY-.js";import{_ as h,z as Ye,b as Xe,a as Je,s as Ze,g as et,o as tt,p as st,c as Te,l as Ne,q as it,u as rt,v as nt,x as at,y as lt}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var qe=(function(){var e=h(function($,r,a,c){for(a=a||{},c=$.length;c--;a[$[c]]=r);return a},"o"),u=[1,3],o=[1,4],n=[1,5],i=[1,6],f=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],_=[1,22],E=[2,7],g=[1,26],S=[1,27],k=[1,28],q=[1,29],C=[1,33],A=[1,34],V=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],p=[1,39],R=[1,40],d=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ce=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],de=[27,29],Ae=[1,70],Ve=[1,71],ve=[1,72],Le=[1,73],xe=[1,74],Oe=[1,75],we=[1,76],Z=[1,83],U=[1,80],ee=[1,84],te=[1,85],se=[1,86],ie=[1,87],re=[1,88],ne=[1,89],ae=[1,90],le=[1,91],ce=[1,92],Ee=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],De=[1,101],Me=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],oe=[1,116],he=[1,117],ue=[1,114],fe=[1,115],_e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:h(function(r,a,c,s,m,t,me){var l=t.length-1;switch(m){case 4:this.$=t[l].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[l].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[l-3],t[l-4]);break;case 22:s.addRequirement(t[l-5],t[l-6]),s.setClass([t[l-5]],t[l-3]);break;case 23:s.setNewReqId(t[l-2]);break;case 24:s.setNewReqText(t[l-2]);break;case 25:s.setNewReqRisk(t[l-2]);break;case 26:s.setNewReqVerifyMethod(t[l-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[l-3]);break;case 43:s.addElement(t[l-5]),s.setClass([t[l-5]],t[l-3]);break;case 44:s.setNewElementType(t[l-2]);break;case 45:s.setNewElementDocRef(t[l-2]);break;case 48:s.addRelationship(t[l-2],t[l],t[l-4]);break;case 49:s.addRelationship(t[l-2],t[l-4],t[l]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[l-2],s.defineClass(t[l-1],t[l]);break;case 58:s.setClass(t[l-1],t[l]);break;case 59:s.setClass([t[l-2]],t[l]);break;case 60:case 62:this.$=[t[l]];break;case 61:case 63:this.$=t[l-2].concat([t[l]]);break;case 64:this.$=t[l-2],s.setCssStyle(t[l-1],t[l]);break;case 65:this.$=[t[l]];break;case 66:t[l-2].push(t[l]),this.$=t[l-2];break;case 68:this.$=t[l-1]+t[l];break}},"anonymous"),table:[{3:1,4:2,6:u,9:o,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:u,9:o,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(f,[2,6]),{3:12,4:2,6:u,9:o,11:n,13:i},{1:[2,2]},{4:17,5:_,7:13,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},e(f,[2,4]),e(f,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:_,7:42,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:43,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:44,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:45,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:46,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:47,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:48,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:49,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:50,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(d,[2,17]),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),{30:60,33:62,75:P,89:p,90:R},{30:63,33:62,75:P,89:p,90:R},{30:64,33:62,75:P,89:p,90:R},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ce,[2,81]),e(Ce,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(de,[2,79]),e(de,[2,80]),{27:[1,67],29:[1,68]},e(de,[2,85]),e(de,[2,86]),{62:69,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{62:77,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{30:78,33:62,75:P,89:p,90:R},{73:79,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,60]),e(Ee,[2,62]),{73:93,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},{30:94,33:62,75:P,76:U,89:p,90:R},{5:[1,95]},{30:96,33:62,75:P,89:p,90:R},{5:[1,97]},{30:98,33:62,75:P,89:p,90:R},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(d,[2,59],{76:U}),e(d,[2,64],{76:De}),{33:103,75:[1,102],89:p,90:R},e(Me,[2,65],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),e(T,[2,67]),e(T,[2,69]),e(T,[2,70]),e(T,[2,71]),e(T,[2,72]),e(T,[2,73]),e(T,[2,74]),e(T,[2,75]),e(T,[2,76]),e(T,[2,77]),e(T,[2,78]),e(d,[2,57],{76:De}),e(d,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:oe,40:he,56:113,57:ue,59:fe},{27:[1,118],76:U},{33:119,89:p,90:R},{33:120,89:p,90:R},{75:Z,78:121,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,61]),e(Ee,[2,63]),e(T,[2,68]),e(d,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(d,[2,28]),{5:[1,127]},e(d,[2,42]),{32:[1,128]},{32:[1,129]},{5:oe,40:he,56:130,57:ue,59:fe},e(d,[2,47]),{5:[1,131]},e(d,[2,48]),e(d,[2,49]),e(Me,[2,66],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),{33:132,89:p,90:R},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(d,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(d,[2,46]),{5:oe,40:he,56:152,57:ue,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(d,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(d,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:oe,40:he,56:163,57:ue,59:fe},{5:oe,40:he,56:164,57:ue,59:fe},e(d,[2,23]),e(d,[2,24]),e(d,[2,25]),e(d,[2,26]),e(d,[2,44]),e(d,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:h(function(r,a){if(a.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=a,c}},"parseError"),parse:h(function(r){var a=this,c=[0],s=[],m=[null],t=[],me=this.table,l="",Re=0,Fe=0,He=2,$e=1,Ke=t.slice.call(arguments,1),y=Object.create(this.lexer),z={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(z.yy[Se]=this.yy[Se]);y.setInput(r,z.yy),z.yy.lexer=y,z.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var be=y.yylloc;t.push(be);var We=y.options&&y.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(I){c.length=c.length-2*I,m.length=m.length-I,t.length=t.length-I}h(je,"popStack");function Pe(){var I;return I=s.pop()||y.lex()||$e,typeof I!="number"&&(I instanceof Array&&(s=I,I=s.pop()),I=a.symbols_[I]||I),I}h(Pe,"lex");for(var b,G,N,Ie,J={},ge,F,Ue,ye;;){if(G=c[c.length-1],this.defaultActions[G]?N=this.defaultActions[G]:((b===null||typeof b>"u")&&(b=Pe()),N=me[G]&&me[G][b]),typeof N>"u"||!N.length||!N[0]){var ke="";ye=[];for(ge in me[G])this.terminals_[ge]&&ge>He&&ye.push("'"+this.terminals_[ge]+"'");y.showPosition?ke="Parse error on line "+(Re+1)+`: +import{g as ze}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Ge}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as h,z as Ye,b as Xe,a as Je,s as Ze,g as et,o as tt,p as st,c as Te,l as Ne,q as it,u as rt,v as nt,x as at,y as lt}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var qe=(function(){var e=h(function($,r,a,c){for(a=a||{},c=$.length;c--;a[$[c]]=r);return a},"o"),u=[1,3],o=[1,4],n=[1,5],i=[1,6],f=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],_=[1,22],E=[2,7],g=[1,26],S=[1,27],k=[1,28],q=[1,29],C=[1,33],A=[1,34],V=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],p=[1,39],R=[1,40],d=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ce=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],de=[27,29],Ae=[1,70],Ve=[1,71],ve=[1,72],Le=[1,73],xe=[1,74],Oe=[1,75],we=[1,76],Z=[1,83],U=[1,80],ee=[1,84],te=[1,85],se=[1,86],ie=[1,87],re=[1,88],ne=[1,89],ae=[1,90],le=[1,91],ce=[1,92],Ee=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],De=[1,101],Me=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],oe=[1,116],he=[1,117],ue=[1,114],fe=[1,115],_e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:h(function(r,a,c,s,m,t,me){var l=t.length-1;switch(m){case 4:this.$=t[l].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[l].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[l-3],t[l-4]);break;case 22:s.addRequirement(t[l-5],t[l-6]),s.setClass([t[l-5]],t[l-3]);break;case 23:s.setNewReqId(t[l-2]);break;case 24:s.setNewReqText(t[l-2]);break;case 25:s.setNewReqRisk(t[l-2]);break;case 26:s.setNewReqVerifyMethod(t[l-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[l-3]);break;case 43:s.addElement(t[l-5]),s.setClass([t[l-5]],t[l-3]);break;case 44:s.setNewElementType(t[l-2]);break;case 45:s.setNewElementDocRef(t[l-2]);break;case 48:s.addRelationship(t[l-2],t[l],t[l-4]);break;case 49:s.addRelationship(t[l-2],t[l-4],t[l]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[l-2],s.defineClass(t[l-1],t[l]);break;case 58:s.setClass(t[l-1],t[l]);break;case 59:s.setClass([t[l-2]],t[l]);break;case 60:case 62:this.$=[t[l]];break;case 61:case 63:this.$=t[l-2].concat([t[l]]);break;case 64:this.$=t[l-2],s.setCssStyle(t[l-1],t[l]);break;case 65:this.$=[t[l]];break;case 66:t[l-2].push(t[l]),this.$=t[l-2];break;case 68:this.$=t[l-1]+t[l];break}},"anonymous"),table:[{3:1,4:2,6:u,9:o,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:u,9:o,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(f,[2,6]),{3:12,4:2,6:u,9:o,11:n,13:i},{1:[2,2]},{4:17,5:_,7:13,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},e(f,[2,4]),e(f,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:_,7:42,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:43,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:44,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:45,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:46,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:47,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:48,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:49,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:50,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(d,[2,17]),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),{30:60,33:62,75:P,89:p,90:R},{30:63,33:62,75:P,89:p,90:R},{30:64,33:62,75:P,89:p,90:R},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ce,[2,81]),e(Ce,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(de,[2,79]),e(de,[2,80]),{27:[1,67],29:[1,68]},e(de,[2,85]),e(de,[2,86]),{62:69,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{62:77,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{30:78,33:62,75:P,89:p,90:R},{73:79,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,60]),e(Ee,[2,62]),{73:93,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},{30:94,33:62,75:P,76:U,89:p,90:R},{5:[1,95]},{30:96,33:62,75:P,89:p,90:R},{5:[1,97]},{30:98,33:62,75:P,89:p,90:R},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(d,[2,59],{76:U}),e(d,[2,64],{76:De}),{33:103,75:[1,102],89:p,90:R},e(Me,[2,65],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),e(T,[2,67]),e(T,[2,69]),e(T,[2,70]),e(T,[2,71]),e(T,[2,72]),e(T,[2,73]),e(T,[2,74]),e(T,[2,75]),e(T,[2,76]),e(T,[2,77]),e(T,[2,78]),e(d,[2,57],{76:De}),e(d,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:oe,40:he,56:113,57:ue,59:fe},{27:[1,118],76:U},{33:119,89:p,90:R},{33:120,89:p,90:R},{75:Z,78:121,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,61]),e(Ee,[2,63]),e(T,[2,68]),e(d,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(d,[2,28]),{5:[1,127]},e(d,[2,42]),{32:[1,128]},{32:[1,129]},{5:oe,40:he,56:130,57:ue,59:fe},e(d,[2,47]),{5:[1,131]},e(d,[2,48]),e(d,[2,49]),e(Me,[2,66],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),{33:132,89:p,90:R},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(d,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(d,[2,46]),{5:oe,40:he,56:152,57:ue,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(d,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(d,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:oe,40:he,56:163,57:ue,59:fe},{5:oe,40:he,56:164,57:ue,59:fe},e(d,[2,23]),e(d,[2,24]),e(d,[2,25]),e(d,[2,26]),e(d,[2,44]),e(d,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:h(function(r,a){if(a.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=a,c}},"parseError"),parse:h(function(r){var a=this,c=[0],s=[],m=[null],t=[],me=this.table,l="",Re=0,Fe=0,He=2,$e=1,Ke=t.slice.call(arguments,1),y=Object.create(this.lexer),z={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(z.yy[Se]=this.yy[Se]);y.setInput(r,z.yy),z.yy.lexer=y,z.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var be=y.yylloc;t.push(be);var We=y.options&&y.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(I){c.length=c.length-2*I,m.length=m.length-I,t.length=t.length-I}h(je,"popStack");function Pe(){var I;return I=s.pop()||y.lex()||$e,typeof I!="number"&&(I instanceof Array&&(s=I,I=s.pop()),I=a.symbols_[I]||I),I}h(Pe,"lex");for(var b,G,N,Ie,J={},ge,F,Ue,ye;;){if(G=c[c.length-1],this.defaultActions[G]?N=this.defaultActions[G]:((b===null||typeof b>"u")&&(b=Pe()),N=me[G]&&me[G][b]),typeof N>"u"||!N.length||!N[0]){var ke="";ye=[];for(ge in me[G])this.terminals_[ge]&&ge>He&&ye.push("'"+this.terminals_[ge]+"'");y.showPosition?ke="Parse error on line "+(Re+1)+`: `+y.showPosition()+` Expecting `+ye.join(", ")+", got '"+(this.terminals_[b]||b)+"'":ke="Parse error on line "+(Re+1)+": Unexpected "+(b==$e?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(ke,{text:y.match,token:this.terminals_[b]||b,line:y.yylineno,loc:be,expected:ye})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+b);switch(N[0]){case 1:c.push(b),m.push(y.yytext),t.push(y.yylloc),c.push(N[1]),b=null,Fe=y.yyleng,l=y.yytext,Re=y.yylineno,be=y.yylloc;break;case 2:if(F=this.productions_[N[1]][1],J.$=m[m.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},We&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),Ie=this.performAction.apply(J,[l,Fe,Re,z.yy,N[1],m,t].concat(Ke)),typeof Ie<"u")return Ie;F&&(c=c.slice(0,-1*F*2),m=m.slice(0,-1*F),t=t.slice(0,-1*F)),c.push(this.productions_[N[1]][0]),m.push(J.$),t.push(J._$),Ue=me[c[c.length-2]][c[c.length-1]],c.push(Ue);break;case 3:return!0}}return!0},"parse")},Qe=(function(){var $={EOF:1,parseError:h(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:h(function(r,a){return this.yy=a||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var a=r.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:h(function(r){var a=r.length,c=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===s.length?this.yylloc.first_column:0)+s[s.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(r){this.unput(this.match.slice(r))},"less"),pastInput:h(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var r=this.pastInput(),a=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-DQOKpLQv.js b/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js similarity index 99% rename from apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-DQOKpLQv.js rename to apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js index 51cfd5ae7c8..03db105c527 100644 --- a/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-DQOKpLQv.js +++ b/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js @@ -1,4 +1,4 @@ -import{o as kt,p as mt,s as xt,g as _t,b as vt,a as bt,_ as y,c as ot,b8 as St,d as G,ad as wt,q as Lt,k as Et}from"./mermaid.core-Cahi9cr1.js";import{o as At}from"./ordinal-Cboi1Yqb.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Tt(t){for(var i=t.length/6|0,s=new Array(i),l=0;l=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s=u)&&(s=u)}return s}function dt(t,i){let s;if(i===void 0)for(const l of t)l!=null&&(s>l||s===void 0&&l>=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function J(t,i){let s=0;if(i===void 0)for(let l of t)(l=+l)&&(s+=l);else{let l=-1;for(let u of t)(u=+i(u,++l,t))&&(s+=u)}return s}function Nt(t){return t.target.depth}function Ct(t){return t.depth}function Pt(t,i){return i-1-t.height}function gt(t,i){return t.sourceLinks.length?t.depth:i-1}function It(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dt(t.sourceLinks,Nt)-1:0}function Y(t){return function(){return t}}function lt(t,i){return q(t.source,i.source)||t.index-i.index}function ct(t,i){return q(t.target,i.target)||t.index-i.index}function q(t,i){return t.y0-i.y0}function tt(t){return t.value}function Ot(t){return t.index}function $t(t){return t.nodes}function Dt(t){return t.links}function ut(t,i){const s=t.get(i);if(!s)throw new Error("missing: "+i);return s}function ht({nodes:t}){for(const i of t){let s=i.y0,l=s;for(const u of i.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of i.targetLinks)u.y1=l+u.width/2,l+=u.width}}function jt(){let t=0,i=0,s=1,l=1,u=24,x=8,g,k=Ot,o=gt,a,h,m=$t,_=Dt,d=6;function v(){const n={nodes:m.apply(null,arguments),links:_.apply(null,arguments)};return T(n),A(n),M(n),I(n),S(n),ht(n),n}v.update=function(n){return ht(n),n},v.nodeId=function(n){return arguments.length?(k=typeof n=="function"?n:Y(n),v):k},v.nodeAlign=function(n){return arguments.length?(o=typeof n=="function"?n:Y(n),v):o},v.nodeSort=function(n){return arguments.length?(a=n,v):a},v.nodeWidth=function(n){return arguments.length?(u=+n,v):u},v.nodePadding=function(n){return arguments.length?(x=g=+n,v):x},v.nodes=function(n){return arguments.length?(m=typeof n=="function"?n:Y(n),v):m},v.links=function(n){return arguments.length?(_=typeof n=="function"?n:Y(n),v):_},v.linkSort=function(n){return arguments.length?(h=n,v):h},v.size=function(n){return arguments.length?(t=i=0,s=+n[0],l=+n[1],v):[s-t,l-i]},v.extent=function(n){return arguments.length?(t=+n[0][0],s=+n[1][0],i=+n[0][1],l=+n[1][1],v):[[t,i],[s,l]]},v.iterations=function(n){return arguments.length?(d=+n,v):d};function T({nodes:n,links:f}){for(const[e,r]of n.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(n.map((e,r)=>[k(e,r,n),e]));for(const[e,r]of f.entries()){r.index=e;let{source:p,target:b}=r;typeof p!="object"&&(p=r.source=ut(c,p)),typeof b!="object"&&(b=r.target=ut(c,b)),p.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of n)e.sort(h),r.sort(h)}function A({nodes:n}){for(const f of n)f.value=f.fixedValue===void 0?Math.max(J(f.sourceLinks,tt),J(f.targetLinks,tt)):f.fixedValue}function M({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.depth=r;for(const{target:b}of p.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.height=r;for(const{source:b}of p.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:n}){const f=at(n,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of n){const p=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=p,r.x0=t+p*c,r.x1=r.x0+u,e[p]?e[p].push(r):e[p]=[r]}if(a)for(const r of e)r.sort(a);return e}function $(n){const f=dt(n,c=>(l-i-(c.length-1)*g)/J(c,tt));for(const c of n){let e=i;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+g;for(const p of r.sourceLinks)p.width=p.value*f}e=(l-e+g)/(c.length+1);for(let r=0;rc.length)-1)),$(f);for(let c=0;c0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function F(n,f,c){for(let e=n.length,r=e-2;r>=0;--r){const p=n[r];for(const b of p){let L=0,z=0;for(const{target:W,value:Z}of b.sourceLinks){let U=Z*(W.layer-b.layer);L+=E(b,W)*U,z+=U}if(!(z>0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function D(n,f){const c=n.length>>1,e=n[c];O(n,e.y0-g,c-1,f),R(n,e.y1+g,c+1,f),O(n,l,n.length-1,f),R(n,i,0,f)}function R(n,f,c,e){for(;c1e-6&&(r.y0+=p,r.y1+=p),f=r.y1+g}}function O(n,f,c,e){for(;c>=0;--c){const r=n[c],p=(r.y1-f)*e;p>1e-6&&(r.y0-=p,r.y1-=p),f=r.y0-g}}function j({sourceLinks:n,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ct);for(const{target:{targetLinks:c}}of n)c.sort(lt)}}function w(n){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of n)f.sort(ct),c.sort(lt)}function P(n,f){let c=n.y0-(n.sourceLinks.length-1)*g/2;for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c+=r+g}for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c-=r}return c}function E(n,f){let c=f.y0-(f.targetLinks.length-1)*g/2;for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c+=r+g}for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c-=r}return c}return v}var et=Math.PI,nt=2*et,B=1e-6,zt=nt-B;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function pt(){return new it}it.prototype=pt.prototype={constructor:it,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,l){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+l)},bezierCurveTo:function(t,i,s,l,u,x){this._+="C"+ +t+","+ +i+","+ +s+","+ +l+","+(this._x1=+u)+","+(this._y1=+x)},arcTo:function(t,i,s,l,u){t=+t,i=+i,s=+s,l=+l,u=+u;var x=this._x1,g=this._y1,k=s-t,o=l-i,a=x-t,h=g-i,m=a*a+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(m>B)if(!(Math.abs(h*k-o*a)>B)||!u)this._+="L"+(this._x1=t)+","+(this._y1=i);else{var _=s-x,d=l-g,v=k*k+o*o,T=_*_+d*d,A=Math.sqrt(v),M=Math.sqrt(m),I=u*Math.tan((et-Math.acos((v+m-T)/(2*A*M)))/2),N=I/M,$=I/A;Math.abs(N-1)>B&&(this._+="L"+(t+N*a)+","+(i+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>a*d)+","+(this._x1=t+$*k)+","+(this._y1=i+$*o)}},arc:function(t,i,s,l,u,x){t=+t,i=+i,s=+s,x=!!x;var g=s*Math.cos(l),k=s*Math.sin(l),o=t+g,a=i+k,h=1^x,m=x?l-u:u-l;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+a:(Math.abs(this._x1-o)>B||Math.abs(this._y1-a)>B)&&(this._+="L"+o+","+a),s&&(m<0&&(m=m%nt+nt),m>zt?this._+="A"+s+","+s+",0,1,"+h+","+(t-g)+","+(i-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=a):m>B&&(this._+="A"+s+","+s+",0,"+ +(m>=et)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=i+s*Math.sin(u))))},rect:function(t,i,s,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +l+"h"+-s+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Bt(t){return t[0]}function Ft(t){return t[1]}var Rt=Array.prototype.slice;function Vt(t){return t.source}function Wt(t){return t.target}function Ut(t){var i=Vt,s=Wt,l=Bt,u=Ft,x=null;function g(){var k,o=Rt.call(arguments),a=i.apply(this,o),h=s.apply(this,o);if(x||(x=k=pt()),t(x,+l.apply(this,(o[0]=a,o)),+u.apply(this,o),+l.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return x=null,k+""||null}return g.source=function(k){return arguments.length?(i=k,g):i},g.target=function(k){return arguments.length?(s=k,g):s},g.x=function(k){return arguments.length?(l=typeof k=="function"?k:ft(+k),g):l},g.y=function(k){return arguments.length?(u=typeof k=="function"?k:ft(+k),g):u},g.context=function(k){return arguments.length?(x=k??null,g):x},g}function Gt(t,i,s,l,u){t.moveTo(i,s),t.bezierCurveTo(i=(i+l)/2,s,i,u,l,u)}function Yt(){return Ut(Gt)}function qt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Yt().source(qt).target(Ht)}var rt=(function(){var t=y(function(k,o,a,h){for(a=a||{},h=k.length;h--;a[k[h]]=o);return a},"o"),i=[1,9],s=[1,10],l=[1,5,10,12],u={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:y(function(o,a,h,m,_,d,v){var T=d.length-1;switch(_){case 7:const A=m.findOrCreateNode(d[T-4].trim().replaceAll('""','"')),M=m.findOrCreateNode(d[T-2].trim().replaceAll('""','"')),I=parseFloat(d[T].trim());m.addLink(A,M,I);break;case 8:case 9:case 11:this.$=d[T];break;case 10:this.$=d[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:i,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:i,20:s},{15:18,16:7,17:8,18:i,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:i,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:y(function(o,a){if(a.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=a,h}},"parseError"),parse:y(function(o){var a=this,h=[0],m=[],_=[null],d=[],v=this.table,T="",A=0,M=0,I=2,N=1,$=d.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;d.push(D);var R=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,d.length=d.length-L}y(O,"popStack");function j(){var L;return L=m.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(m=L,L=m.pop()),L=a.symbols_[L]||L),L}y(j,"lex");for(var w,P,E,n,f={},c,e,r,p;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=j()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";p=[];for(c in v[P])this.terminals_[c]&&c>I&&p.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: +import{o as kt,p as mt,s as xt,g as _t,b as vt,a as bt,_ as y,c as ot,b8 as St,d as G,ad as wt,q as Lt,k as Et}from"./mermaid.core-CJB1tAev.js";import{o as At}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Tt(t){for(var i=t.length/6|0,s=new Array(i),l=0;l=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s=u)&&(s=u)}return s}function dt(t,i){let s;if(i===void 0)for(const l of t)l!=null&&(s>l||s===void 0&&l>=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function J(t,i){let s=0;if(i===void 0)for(let l of t)(l=+l)&&(s+=l);else{let l=-1;for(let u of t)(u=+i(u,++l,t))&&(s+=u)}return s}function Nt(t){return t.target.depth}function Ct(t){return t.depth}function Pt(t,i){return i-1-t.height}function gt(t,i){return t.sourceLinks.length?t.depth:i-1}function It(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dt(t.sourceLinks,Nt)-1:0}function Y(t){return function(){return t}}function lt(t,i){return q(t.source,i.source)||t.index-i.index}function ct(t,i){return q(t.target,i.target)||t.index-i.index}function q(t,i){return t.y0-i.y0}function tt(t){return t.value}function Ot(t){return t.index}function $t(t){return t.nodes}function Dt(t){return t.links}function ut(t,i){const s=t.get(i);if(!s)throw new Error("missing: "+i);return s}function ht({nodes:t}){for(const i of t){let s=i.y0,l=s;for(const u of i.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of i.targetLinks)u.y1=l+u.width/2,l+=u.width}}function jt(){let t=0,i=0,s=1,l=1,u=24,x=8,g,k=Ot,o=gt,a,h,m=$t,_=Dt,d=6;function v(){const n={nodes:m.apply(null,arguments),links:_.apply(null,arguments)};return T(n),A(n),M(n),I(n),S(n),ht(n),n}v.update=function(n){return ht(n),n},v.nodeId=function(n){return arguments.length?(k=typeof n=="function"?n:Y(n),v):k},v.nodeAlign=function(n){return arguments.length?(o=typeof n=="function"?n:Y(n),v):o},v.nodeSort=function(n){return arguments.length?(a=n,v):a},v.nodeWidth=function(n){return arguments.length?(u=+n,v):u},v.nodePadding=function(n){return arguments.length?(x=g=+n,v):x},v.nodes=function(n){return arguments.length?(m=typeof n=="function"?n:Y(n),v):m},v.links=function(n){return arguments.length?(_=typeof n=="function"?n:Y(n),v):_},v.linkSort=function(n){return arguments.length?(h=n,v):h},v.size=function(n){return arguments.length?(t=i=0,s=+n[0],l=+n[1],v):[s-t,l-i]},v.extent=function(n){return arguments.length?(t=+n[0][0],s=+n[1][0],i=+n[0][1],l=+n[1][1],v):[[t,i],[s,l]]},v.iterations=function(n){return arguments.length?(d=+n,v):d};function T({nodes:n,links:f}){for(const[e,r]of n.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(n.map((e,r)=>[k(e,r,n),e]));for(const[e,r]of f.entries()){r.index=e;let{source:p,target:b}=r;typeof p!="object"&&(p=r.source=ut(c,p)),typeof b!="object"&&(b=r.target=ut(c,b)),p.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of n)e.sort(h),r.sort(h)}function A({nodes:n}){for(const f of n)f.value=f.fixedValue===void 0?Math.max(J(f.sourceLinks,tt),J(f.targetLinks,tt)):f.fixedValue}function M({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.depth=r;for(const{target:b}of p.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.height=r;for(const{source:b}of p.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:n}){const f=at(n,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of n){const p=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=p,r.x0=t+p*c,r.x1=r.x0+u,e[p]?e[p].push(r):e[p]=[r]}if(a)for(const r of e)r.sort(a);return e}function $(n){const f=dt(n,c=>(l-i-(c.length-1)*g)/J(c,tt));for(const c of n){let e=i;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+g;for(const p of r.sourceLinks)p.width=p.value*f}e=(l-e+g)/(c.length+1);for(let r=0;rc.length)-1)),$(f);for(let c=0;c0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function F(n,f,c){for(let e=n.length,r=e-2;r>=0;--r){const p=n[r];for(const b of p){let L=0,z=0;for(const{target:W,value:Z}of b.sourceLinks){let U=Z*(W.layer-b.layer);L+=E(b,W)*U,z+=U}if(!(z>0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function D(n,f){const c=n.length>>1,e=n[c];O(n,e.y0-g,c-1,f),R(n,e.y1+g,c+1,f),O(n,l,n.length-1,f),R(n,i,0,f)}function R(n,f,c,e){for(;c1e-6&&(r.y0+=p,r.y1+=p),f=r.y1+g}}function O(n,f,c,e){for(;c>=0;--c){const r=n[c],p=(r.y1-f)*e;p>1e-6&&(r.y0-=p,r.y1-=p),f=r.y0-g}}function j({sourceLinks:n,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ct);for(const{target:{targetLinks:c}}of n)c.sort(lt)}}function w(n){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of n)f.sort(ct),c.sort(lt)}function P(n,f){let c=n.y0-(n.sourceLinks.length-1)*g/2;for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c+=r+g}for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c-=r}return c}function E(n,f){let c=f.y0-(f.targetLinks.length-1)*g/2;for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c+=r+g}for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c-=r}return c}return v}var et=Math.PI,nt=2*et,B=1e-6,zt=nt-B;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function pt(){return new it}it.prototype=pt.prototype={constructor:it,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,l){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+l)},bezierCurveTo:function(t,i,s,l,u,x){this._+="C"+ +t+","+ +i+","+ +s+","+ +l+","+(this._x1=+u)+","+(this._y1=+x)},arcTo:function(t,i,s,l,u){t=+t,i=+i,s=+s,l=+l,u=+u;var x=this._x1,g=this._y1,k=s-t,o=l-i,a=x-t,h=g-i,m=a*a+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(m>B)if(!(Math.abs(h*k-o*a)>B)||!u)this._+="L"+(this._x1=t)+","+(this._y1=i);else{var _=s-x,d=l-g,v=k*k+o*o,T=_*_+d*d,A=Math.sqrt(v),M=Math.sqrt(m),I=u*Math.tan((et-Math.acos((v+m-T)/(2*A*M)))/2),N=I/M,$=I/A;Math.abs(N-1)>B&&(this._+="L"+(t+N*a)+","+(i+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>a*d)+","+(this._x1=t+$*k)+","+(this._y1=i+$*o)}},arc:function(t,i,s,l,u,x){t=+t,i=+i,s=+s,x=!!x;var g=s*Math.cos(l),k=s*Math.sin(l),o=t+g,a=i+k,h=1^x,m=x?l-u:u-l;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+a:(Math.abs(this._x1-o)>B||Math.abs(this._y1-a)>B)&&(this._+="L"+o+","+a),s&&(m<0&&(m=m%nt+nt),m>zt?this._+="A"+s+","+s+",0,1,"+h+","+(t-g)+","+(i-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=a):m>B&&(this._+="A"+s+","+s+",0,"+ +(m>=et)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=i+s*Math.sin(u))))},rect:function(t,i,s,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +l+"h"+-s+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Bt(t){return t[0]}function Ft(t){return t[1]}var Rt=Array.prototype.slice;function Vt(t){return t.source}function Wt(t){return t.target}function Ut(t){var i=Vt,s=Wt,l=Bt,u=Ft,x=null;function g(){var k,o=Rt.call(arguments),a=i.apply(this,o),h=s.apply(this,o);if(x||(x=k=pt()),t(x,+l.apply(this,(o[0]=a,o)),+u.apply(this,o),+l.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return x=null,k+""||null}return g.source=function(k){return arguments.length?(i=k,g):i},g.target=function(k){return arguments.length?(s=k,g):s},g.x=function(k){return arguments.length?(l=typeof k=="function"?k:ft(+k),g):l},g.y=function(k){return arguments.length?(u=typeof k=="function"?k:ft(+k),g):u},g.context=function(k){return arguments.length?(x=k??null,g):x},g}function Gt(t,i,s,l,u){t.moveTo(i,s),t.bezierCurveTo(i=(i+l)/2,s,i,u,l,u)}function Yt(){return Ut(Gt)}function qt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Yt().source(qt).target(Ht)}var rt=(function(){var t=y(function(k,o,a,h){for(a=a||{},h=k.length;h--;a[k[h]]=o);return a},"o"),i=[1,9],s=[1,10],l=[1,5,10,12],u={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:y(function(o,a,h,m,_,d,v){var T=d.length-1;switch(_){case 7:const A=m.findOrCreateNode(d[T-4].trim().replaceAll('""','"')),M=m.findOrCreateNode(d[T-2].trim().replaceAll('""','"')),I=parseFloat(d[T].trim());m.addLink(A,M,I);break;case 8:case 9:case 11:this.$=d[T];break;case 10:this.$=d[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:i,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:i,20:s},{15:18,16:7,17:8,18:i,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:i,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:y(function(o,a){if(a.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=a,h}},"parseError"),parse:y(function(o){var a=this,h=[0],m=[],_=[null],d=[],v=this.table,T="",A=0,M=0,I=2,N=1,$=d.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;d.push(D);var R=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,d.length=d.length-L}y(O,"popStack");function j(){var L;return L=m.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(m=L,L=m.pop()),L=a.symbols_[L]||L),L}y(j,"lex");for(var w,P,E,n,f={},c,e,r,p;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=j()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";p=[];for(c in v[P])this.terminals_[c]&&c>I&&p.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: `+S.showPosition()+` Expecting `+p.join(", ")+", got '"+(this.terminals_[w]||w)+"'":b="Parse error on line "+(A+1)+": Unexpected "+(w==N?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(b,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:D,expected:p})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+w);switch(E[0]){case 1:h.push(w),_.push(S.yytext),d.push(S.yylloc),h.push(E[1]),w=null,M=S.yyleng,T=S.yytext,A=S.yylineno,D=S.yylloc;break;case 2:if(e=this.productions_[E[1]][1],f.$=_[_.length-e],f._$={first_line:d[d.length-(e||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(e||1)].first_column,last_column:d[d.length-1].last_column},R&&(f._$.range=[d[d.length-(e||1)].range[0],d[d.length-1].range[1]]),n=this.performAction.apply(f,[T,M,A,C.yy,E[1],_,d].concat($)),typeof n<"u")return n;e&&(h=h.slice(0,-1*e*2),_=_.slice(0,-1*e),d=d.slice(0,-1*e)),h.push(this.productions_[E[1]][0]),_.push(f.$),d.push(f._$),r=v[h[h.length-2]][h[h.length-1]],h.push(r);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:y(function(a,h){if(this.yy.parser)this.yy.parser.parseError(a,h);else throw new Error(a)},"parseError"),setInput:y(function(o,a){return this.yy=a||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var a=o.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:y(function(o){var a=o.length,h=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===m.length?this.yylloc.first_column:0)+m[m.length-h.length].length-h[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(o){this.unput(this.match.slice(o))},"less"),pastInput:y(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var o=this.pastInput(),a=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-ne5mKmWY.js b/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js similarity index 99% rename from apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-ne5mKmWY.js rename to apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js index 02185b709fd..4cd153b7788 100644 --- a/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-ne5mKmWY.js +++ b/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js @@ -1,4 +1,4 @@ -import{I as tr}from"./chunk-2Q5K7J3B-B47YykJY.js";import{_ as x,X as er,c as $,d as Vt,l as at,j as Ce,e as rr,f as ar,k as N,b as ke,s as sr,o as ir,a as nr,g as or,p as cr,Y as lr,Z as hr,q as dr,i as Yt,y as Z,$ as Q,a0 as Pt,a1 as Me,a2 as Tr,z as Kt,a3 as pr,a4 as Be}from"./mermaid.core-Cahi9cr1.js";import{a as Er,b as ae,g as dt,d as ur,c as se,e as ie}from"./chunk-32BRIVSS-DAsxL712.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var te=(function(){var e=x(function(ut,S,v,P){for(v=v||{},P=ut.length;P--;v[ut[P]]=S);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],u=[1,14],d=[1,15],p=[1,17],_=[1,18],E=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],w=[1,32],A=[1,33],D=[1,34],M=[1,35],V=[1,36],W=[1,37],U=[1,38],G=[1,39],X=[1,40],nt=[1,42],j=[1,43],H=[1,44],st=[1,45],tt=[1,46],Y=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],At=[1,74],kt=[1,80],m=[1,81],k=[1,82],lt=[1,83],et=[1,84],K=[1,85],Ot=[1,86],ne=[1,87],oe=[1,88],ce=[1,89],le=[1,90],he=[1,91],de=[1,92],Te=[1,93],pe=[1,94],Ee=[1,95],ue=[1,96],fe=[1,97],_e=[1,98],ge=[1,99],xe=[1,100],Ie=[1,101],ye=[1,102],Re=[1,103],Oe=[1,104],Le=[1,105],be=[2,78],St=[4,5,17,51,53,54],Dt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],me=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Ut=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Ae=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Gt=[5,52],F=[70,71,72,73],ot=[1,151],Xt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(S,v,P,y,z,c,wt){var h=c.length-1;switch(z){case 3:return y.apply(c[h]),c[h];case 4:case 10:this.$=[];break;case 5:case 11:c[h-1].push(c[h]),this.$=c[h-1];break;case 6:case 7:case 12:case 13:this.$=c[h];break;case 8:case 9:case 14:this.$=[];break;case 16:c[h].type="createParticipant",this.$=c[h];break;case 17:c[h-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[h-2])}),c[h-1].push({type:"boxEnd",boxText:c[h-2]}),this.$=c[h-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-2]),sequenceIndexStep:Number(c[h-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-1].actor};break;case 30:y.setDiagramTitle(c[h].substring(6)),this.$=c[h].substring(6);break;case 31:y.setDiagramTitle(c[h].substring(7)),this.$=c[h].substring(7);break;case 32:this.$=c[h].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[h].trim(),y.setAccDescription(this.$);break;case 35:c[h-1].unshift({type:"loopStart",loopText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.LOOP_START}),c[h-1].push({type:"loopEnd",loopText:c[h-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[h-1];break;case 36:c[h-1].unshift({type:"rectStart",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_START}),c[h-1].push({type:"rectEnd",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[h-1];break;case 37:c[h-1].unshift({type:"optStart",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_START}),c[h-1].push({type:"optEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[h-1];break;case 38:c[h-1].unshift({type:"altStart",altText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.ALT_START}),c[h-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[h-1];break;case 39:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 40:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 41:c[h-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.CRITICAL_START}),c[h-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[h-1];break;case 42:c[h-1].unshift({type:"breakStart",breakText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_START}),c[h-1].push({type:"breakEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[h-1];break;case 44:this.$=c[h-3].concat([{type:"option",optionText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[h]]);break;case 46:this.$=c[h-3].concat([{type:"and",parText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.PAR_AND},c[h]]);break;case 48:this.$=c[h-3].concat([{type:"else",altText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.ALT_ELSE},c[h]]);break;case 49:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 50:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 51:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 52:case 57:c[h-1].draw="actor",c[h-1].type="addParticipant",this.$=c[h-1];break;case 53:c[h-1].type="destroyParticipant",this.$=c[h-1];break;case 54:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 55:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 56:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 58:this.$=[c[h-1],{type:"addNote",placement:c[h-2],actor:c[h-1].actor,text:c[h]}];break;case 59:c[h-2]=[].concat(c[h-1],c[h-1]).slice(0,2),c[h-2][0]=c[h-2][0].actor,c[h-2][1]=c[h-2][1].actor,this.$=[c[h-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[h-2].slice(0,2),text:c[h]}];break;case 60:this.$=[c[h-1],{type:"addLinks",actor:c[h-1].actor,text:c[h]}];break;case 61:this.$=[c[h-1],{type:"addALink",actor:c[h-1].actor,text:c[h]}];break;case 62:this.$=[c[h-1],{type:"addProperties",actor:c[h-1].actor,text:c[h]}];break;case 63:this.$=[c[h-1],{type:"addDetails",actor:c[h-1].actor,text:c[h]}];break;case 66:this.$=[c[h-2],c[h]];break;case 67:this.$=c[h];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor}];break;case 71:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-4].actor}];break;case 72:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor}];break;case 73:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-4].actor}];break;case 74:this.$=[c[h-5],c[h-1],{type:"addMessage",from:c[h-5].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-5].actor}];break;case 75:this.$=[c[h-3],c[h-1],{type:"addMessage",from:c[h-3].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h]}];break;case 76:this.$={type:"addParticipant",actor:c[h-1],config:c[h]};break;case 77:this.$=c[h-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[h]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[h].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,5]),{9:48,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:U,53:G,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:Y},{23:56,73:Y},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:At},{23:75,55:76,73:At},{23:77,73:Y},{69:78,72:[1,79],78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:Y},{23:111,73:Y},{23:112,73:Y},{23:113,73:Y},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],be),e(C,[2,6]),e(C,[2,16]),e(St,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(Dt,i,{7:120}),e(Dt,i,{7:121}),e(Dt,i,{7:122}),e(me,i,{41:123,7:124}),e(Ut,i,{43:125,7:126}),e(Ut,i,{7:126,43:127}),e(Ae,i,{46:128,7:129}),e(Dt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Gt,be,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:Y},{69:146,78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},e(F,[2,79]),e(F,[2,80]),e(F,[2,81]),e(F,[2,82]),e(F,[2,83]),e(F,[2,84]),e(F,[2,85]),e(F,[2,86]),e(F,[2,87]),e(F,[2,88]),e(F,[2,89]),e(F,[2,90]),e(F,[2,91]),e(F,[2,92]),e(F,[2,93]),e(F,[2,94]),e(F,[2,95]),e(F,[2,96]),e(F,[2,97]),e(F,[2,98]),e(F,[2,99]),e(F,[2,100]),e(F,[2,101]),e(F,[2,102]),e(F,[2,103]),e(F,[2,104]),{23:147,73:Y},{23:149,60:148,73:Y},{73:[2,68]},{73:[2,69]},{58:150,104:ot},{58:152,104:ot},{58:153,104:ot},{58:154,104:ot},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:U,53:G,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,161],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,162],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,163],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,47],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,50:[1,165],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,45],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,49:[1,167],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,43],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,48:[1,170],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,171],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Gt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:Y},{23:178,73:Y},{23:179,73:Y},{58:180,104:ot},{23:181,72:[1,182],73:Y},{58:183,104:ot},{58:184,104:ot},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(St,[2,11]),{13:186,51:U,53:G,54:X},e(St,[2,13]),e(St,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ot},{58:196,104:ot},{58:197,104:ot},{5:[2,75]},{58:198,104:ot},{23:199,73:Y},{5:[2,58]},{5:[2,59]},{23:200,73:Y},e(St,[2,12]),e(me,i,{7:124,41:201}),e(Ut,i,{7:126,43:202}),e(Ae,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Gt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ot},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(S,v){if(v.recoverable)this.trace(S);else{var P=new Error(S);throw P.hash=v,P}},"parseError"),parse:x(function(S){var v=this,P=[0],y=[],z=[null],c=[],wt=this.table,h="",Ct=0,Se=0,Ze=2,we=1,Qe=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Jt)&&(gt.yy[Jt]=this.yy[Jt]);J.setInput(S,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Zt=J.yylloc;c.push(Zt);var $e=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(it){P.length=P.length-2*it,z.length=z.length-it,c.length=c.length-it}x(je,"popStack");function Ne(){var it;return it=y.pop()||J.lex()||we,typeof it!="number"&&(it instanceof Array&&(y=it,it=y.pop()),it=v.symbols_[it]||it),it}x(Ne,"lex");for(var rt,xt,ct,Qt,Lt={},Mt,Tt,Pe,Bt;;){if(xt=P[P.length-1],this.defaultActions[xt]?ct=this.defaultActions[xt]:((rt===null||typeof rt>"u")&&(rt=Ne()),ct=wt[xt]&&wt[xt][rt]),typeof ct>"u"||!ct.length||!ct[0]){var $t="";Bt=[];for(Mt in wt[xt])this.terminals_[Mt]&&Mt>Ze&&Bt.push("'"+this.terminals_[Mt]+"'");J.showPosition?$t="Parse error on line "+(Ct+1)+`: +import{I as tr}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{_ as x,X as er,c as $,d as Vt,l as at,j as Ce,e as rr,f as ar,k as N,b as ke,s as sr,o as ir,a as nr,g as or,p as cr,Y as lr,Z as hr,q as dr,i as Yt,y as Z,$ as Q,a0 as Pt,a1 as Me,a2 as Tr,z as Kt,a3 as pr,a4 as Be}from"./mermaid.core-CJB1tAev.js";import{a as Er,b as ae,g as dt,d as ur,c as se,e as ie}from"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var te=(function(){var e=x(function(ut,S,v,P){for(v=v||{},P=ut.length;P--;v[ut[P]]=S);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],u=[1,14],d=[1,15],p=[1,17],_=[1,18],E=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],w=[1,32],A=[1,33],D=[1,34],M=[1,35],V=[1,36],W=[1,37],U=[1,38],G=[1,39],X=[1,40],nt=[1,42],j=[1,43],H=[1,44],st=[1,45],tt=[1,46],Y=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],At=[1,74],kt=[1,80],m=[1,81],k=[1,82],lt=[1,83],et=[1,84],K=[1,85],Ot=[1,86],ne=[1,87],oe=[1,88],ce=[1,89],le=[1,90],he=[1,91],de=[1,92],Te=[1,93],pe=[1,94],Ee=[1,95],ue=[1,96],fe=[1,97],_e=[1,98],ge=[1,99],xe=[1,100],Ie=[1,101],ye=[1,102],Re=[1,103],Oe=[1,104],Le=[1,105],be=[2,78],St=[4,5,17,51,53,54],Dt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],me=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Ut=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Ae=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Gt=[5,52],F=[70,71,72,73],ot=[1,151],Xt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(S,v,P,y,z,c,wt){var h=c.length-1;switch(z){case 3:return y.apply(c[h]),c[h];case 4:case 10:this.$=[];break;case 5:case 11:c[h-1].push(c[h]),this.$=c[h-1];break;case 6:case 7:case 12:case 13:this.$=c[h];break;case 8:case 9:case 14:this.$=[];break;case 16:c[h].type="createParticipant",this.$=c[h];break;case 17:c[h-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[h-2])}),c[h-1].push({type:"boxEnd",boxText:c[h-2]}),this.$=c[h-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-2]),sequenceIndexStep:Number(c[h-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-1].actor};break;case 30:y.setDiagramTitle(c[h].substring(6)),this.$=c[h].substring(6);break;case 31:y.setDiagramTitle(c[h].substring(7)),this.$=c[h].substring(7);break;case 32:this.$=c[h].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[h].trim(),y.setAccDescription(this.$);break;case 35:c[h-1].unshift({type:"loopStart",loopText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.LOOP_START}),c[h-1].push({type:"loopEnd",loopText:c[h-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[h-1];break;case 36:c[h-1].unshift({type:"rectStart",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_START}),c[h-1].push({type:"rectEnd",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[h-1];break;case 37:c[h-1].unshift({type:"optStart",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_START}),c[h-1].push({type:"optEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[h-1];break;case 38:c[h-1].unshift({type:"altStart",altText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.ALT_START}),c[h-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[h-1];break;case 39:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 40:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 41:c[h-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.CRITICAL_START}),c[h-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[h-1];break;case 42:c[h-1].unshift({type:"breakStart",breakText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_START}),c[h-1].push({type:"breakEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[h-1];break;case 44:this.$=c[h-3].concat([{type:"option",optionText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[h]]);break;case 46:this.$=c[h-3].concat([{type:"and",parText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.PAR_AND},c[h]]);break;case 48:this.$=c[h-3].concat([{type:"else",altText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.ALT_ELSE},c[h]]);break;case 49:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 50:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 51:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 52:case 57:c[h-1].draw="actor",c[h-1].type="addParticipant",this.$=c[h-1];break;case 53:c[h-1].type="destroyParticipant",this.$=c[h-1];break;case 54:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 55:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 56:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 58:this.$=[c[h-1],{type:"addNote",placement:c[h-2],actor:c[h-1].actor,text:c[h]}];break;case 59:c[h-2]=[].concat(c[h-1],c[h-1]).slice(0,2),c[h-2][0]=c[h-2][0].actor,c[h-2][1]=c[h-2][1].actor,this.$=[c[h-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[h-2].slice(0,2),text:c[h]}];break;case 60:this.$=[c[h-1],{type:"addLinks",actor:c[h-1].actor,text:c[h]}];break;case 61:this.$=[c[h-1],{type:"addALink",actor:c[h-1].actor,text:c[h]}];break;case 62:this.$=[c[h-1],{type:"addProperties",actor:c[h-1].actor,text:c[h]}];break;case 63:this.$=[c[h-1],{type:"addDetails",actor:c[h-1].actor,text:c[h]}];break;case 66:this.$=[c[h-2],c[h]];break;case 67:this.$=c[h];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor}];break;case 71:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-4].actor}];break;case 72:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor}];break;case 73:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-4].actor}];break;case 74:this.$=[c[h-5],c[h-1],{type:"addMessage",from:c[h-5].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-5].actor}];break;case 75:this.$=[c[h-3],c[h-1],{type:"addMessage",from:c[h-3].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h]}];break;case 76:this.$={type:"addParticipant",actor:c[h-1],config:c[h]};break;case 77:this.$=c[h-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[h]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[h].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,5]),{9:48,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:U,53:G,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:Y},{23:56,73:Y},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:At},{23:75,55:76,73:At},{23:77,73:Y},{69:78,72:[1,79],78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:Y},{23:111,73:Y},{23:112,73:Y},{23:113,73:Y},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],be),e(C,[2,6]),e(C,[2,16]),e(St,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(Dt,i,{7:120}),e(Dt,i,{7:121}),e(Dt,i,{7:122}),e(me,i,{41:123,7:124}),e(Ut,i,{43:125,7:126}),e(Ut,i,{7:126,43:127}),e(Ae,i,{46:128,7:129}),e(Dt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Gt,be,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:Y},{69:146,78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},e(F,[2,79]),e(F,[2,80]),e(F,[2,81]),e(F,[2,82]),e(F,[2,83]),e(F,[2,84]),e(F,[2,85]),e(F,[2,86]),e(F,[2,87]),e(F,[2,88]),e(F,[2,89]),e(F,[2,90]),e(F,[2,91]),e(F,[2,92]),e(F,[2,93]),e(F,[2,94]),e(F,[2,95]),e(F,[2,96]),e(F,[2,97]),e(F,[2,98]),e(F,[2,99]),e(F,[2,100]),e(F,[2,101]),e(F,[2,102]),e(F,[2,103]),e(F,[2,104]),{23:147,73:Y},{23:149,60:148,73:Y},{73:[2,68]},{73:[2,69]},{58:150,104:ot},{58:152,104:ot},{58:153,104:ot},{58:154,104:ot},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:U,53:G,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,161],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,162],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,163],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,47],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,50:[1,165],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,45],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,49:[1,167],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,43],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,48:[1,170],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,171],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Gt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:Y},{23:178,73:Y},{23:179,73:Y},{58:180,104:ot},{23:181,72:[1,182],73:Y},{58:183,104:ot},{58:184,104:ot},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(St,[2,11]),{13:186,51:U,53:G,54:X},e(St,[2,13]),e(St,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ot},{58:196,104:ot},{58:197,104:ot},{5:[2,75]},{58:198,104:ot},{23:199,73:Y},{5:[2,58]},{5:[2,59]},{23:200,73:Y},e(St,[2,12]),e(me,i,{7:124,41:201}),e(Ut,i,{7:126,43:202}),e(Ae,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Gt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ot},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(S,v){if(v.recoverable)this.trace(S);else{var P=new Error(S);throw P.hash=v,P}},"parseError"),parse:x(function(S){var v=this,P=[0],y=[],z=[null],c=[],wt=this.table,h="",Ct=0,Se=0,Ze=2,we=1,Qe=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Jt)&&(gt.yy[Jt]=this.yy[Jt]);J.setInput(S,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Zt=J.yylloc;c.push(Zt);var $e=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(it){P.length=P.length-2*it,z.length=z.length-it,c.length=c.length-it}x(je,"popStack");function Ne(){var it;return it=y.pop()||J.lex()||we,typeof it!="number"&&(it instanceof Array&&(y=it,it=y.pop()),it=v.symbols_[it]||it),it}x(Ne,"lex");for(var rt,xt,ct,Qt,Lt={},Mt,Tt,Pe,Bt;;){if(xt=P[P.length-1],this.defaultActions[xt]?ct=this.defaultActions[xt]:((rt===null||typeof rt>"u")&&(rt=Ne()),ct=wt[xt]&&wt[xt][rt]),typeof ct>"u"||!ct.length||!ct[0]){var $t="";Bt=[];for(Mt in wt[xt])this.terminals_[Mt]&&Mt>Ze&&Bt.push("'"+this.terminals_[Mt]+"'");J.showPosition?$t="Parse error on line "+(Ct+1)+`: `+J.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[rt]||rt)+"'":$t="Parse error on line "+(Ct+1)+": Unexpected "+(rt==we?"end of input":"'"+(this.terminals_[rt]||rt)+"'"),this.parseError($t,{text:J.match,token:this.terminals_[rt]||rt,line:J.yylineno,loc:Zt,expected:Bt})}if(ct[0]instanceof Array&&ct.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+rt);switch(ct[0]){case 1:P.push(rt),z.push(J.yytext),c.push(J.yylloc),P.push(ct[1]),rt=null,Se=J.yyleng,h=J.yytext,Ct=J.yylineno,Zt=J.yylloc;break;case 2:if(Tt=this.productions_[ct[1]][1],Lt.$=z[z.length-Tt],Lt._$={first_line:c[c.length-(Tt||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(Tt||1)].first_column,last_column:c[c.length-1].last_column},$e&&(Lt._$.range=[c[c.length-(Tt||1)].range[0],c[c.length-1].range[1]]),Qt=this.performAction.apply(Lt,[h,Se,Ct,gt.yy,ct[1],z,c].concat(Qe)),typeof Qt<"u")return Qt;Tt&&(P=P.slice(0,-1*Tt*2),z=z.slice(0,-1*Tt),c=c.slice(0,-1*Tt)),P.push(this.productions_[ct[1]][0]),z.push(Lt.$),c.push(Lt._$),Pe=wt[P[P.length-2]][P[P.length-1]],P.push(Pe);break;case 3:return!0}}return!0},"parse")},Je=(function(){var ut={EOF:1,parseError:x(function(v,P){if(this.yy.parser)this.yy.parser.parseError(v,P);else throw new Error(v)},"parseError"),setInput:x(function(S,v){return this.yy=v||this.yy||{},this._input=S,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:x(function(){var S=this._input[0];this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S;var v=S.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),S},"input"),unput:x(function(S){var v=S.length,P=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),P.length-1&&(this.yylineno-=P.length-1);var z=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:P?(P.length===y.length?this.yylloc.first_column:0)+y[y.length-P.length].length-P[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[z[0],z[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:x(function(){return this._more=!0,this},"more"),reject:x(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:x(function(S){this.unput(this.match.slice(S))},"less"),pastInput:x(function(){var S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:x(function(){var S=this.match;return S.length<20&&(S+=this._input.substr(0,20-S.length)),(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:x(function(){var S=this.pastInput(),v=new Array(S.length+1).join("-");return S+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CseHvhng.js b/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js similarity index 86% rename from apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CseHvhng.js rename to apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js index 1b6f1cb5924..93fea43c459 100644 --- a/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CseHvhng.js +++ b/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js @@ -1 +1 @@ -import{_ as o}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var p=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function c(){return!!i()?.mermaidCaptureSizes}o(c,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:p,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,c as shouldCaptureSizes}; +import{_ as o}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var p=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function c(){return!!i()?.mermaidCaptureSizes}o(c,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:p,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,c as shouldCaptureSizes}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-wqCW5C6q.js b/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js similarity index 96% rename from apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-wqCW5C6q.js rename to apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js index 935a81e5593..e01e907e999 100644 --- a/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-wqCW5C6q.js +++ b/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js @@ -1 +1 @@ -import{s as R,a as W,S as N}from"./chunk-EX3LRPZG-DGM3fHaz.js";import{_ as f,c as t,d as H,l as S,e as P,k as z,a7 as _,a8 as U,a3 as C,y as F}from"./mermaid.core-Cahi9cr1.js";import{G as O}from"./graph-DOmOIIwC.js";import{l as J}from"./layout-D-LzfAck.js";import"./chunk-XXDRQBXY-BmzWd-kT.js";import"./chunk-VR4S4FIN-he8WxbY-.js";import"./chunk-32BRIVSS-DAsxL712.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./map-DxJ2ADlA.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),Z=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),j=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
        ");p=p.replace(/\n/g,"
        ");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),K=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=j(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&Z(n,i),i.type==="note"&&K(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,Q=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=_().x(function(s){return s.x}).y(function(s){return s.y}).curve(U),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new O({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),Q(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; +import{s as R,a as W,S as N}from"./chunk-EX3LRPZG-BCWDroXJ.js";import{_ as f,c as t,d as H,l as S,e as P,k as z,a7 as _,a8 as U,a3 as C,y as F}from"./mermaid.core-CJB1tAev.js";import{G as O}from"./graph-DOmOIIwC.js";import{l as J}from"./layout-D-LzfAck.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./map-DxJ2ADlA.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),Z=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),j=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
        ");p=p.replace(/\n/g,"
        ");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),K=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=j(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&Z(n,i),i.type==="note"&&K(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,Q=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=_().x(function(s){return s.x}).y(function(s){return s.y}).curve(U),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new O({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),Q(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js new file mode 100644 index 00000000000..cc6c7d04222 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as s}from"./chunk-EX3LRPZG-BCWDroXJ.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js deleted file mode 100644 index c80918b1711..00000000000 --- a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-Dd3wUpwT.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,b as e,a,S as s}from"./chunk-EX3LRPZG-DGM3fHaz.js";import{_ as i}from"./mermaid.core-Cahi9cr1.js";import"./chunk-XXDRQBXY-BmzWd-kT.js";import"./chunk-VR4S4FIN-he8WxbY-.js";import"./chunk-32BRIVSS-DAsxL712.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-DIbCJfLo.js b/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js similarity index 99% rename from apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-DIbCJfLo.js rename to apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js index 5000e186f17..f67834e7fd0 100644 --- a/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-DIbCJfLo.js +++ b/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-CseHvhng.js","assets/mermaid.core-Cahi9cr1.js","assets/index-HRJ6xRtC.js","assets/index-vdPxBs-i.css","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); -import{bR as Er}from"./index-HRJ6xRtC.js";import{c as Tr}from"./chunk-RYQCIY6F-BHZEnq1y.js";import{am as wr,an as Ar,ao as Rr,ap as Nr,l as Ke,c as Or,ag as Pr,af as Br,ah as kr,at as _r,av as Fr,z as Dr,as as Hr,aw as Xr,y as Oe,ax as Ye,_ as d,ay as Ao}from"./mermaid.core-Cahi9cr1.js";import{G as Yr}from"./graph-DOmOIIwC.js";import"./map-DxJ2ADlA.js";import"./_commonjsHelpers-CqkleIqs.js";async function _o(t,e){const n=new Yr({multigraph:!0,compound:!0}),o=[...e.edges],s=Or(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),c=r.insert("g").attr("class","edges edgePath"),a=r.insert("g").attr("class","edgeLabels"),l=r.insert("g").attr("class","nodes"),g=new Map,x=t.node()!=null;await Promise.all(e.nodes.map(async I=>{if(I.isGroup)n.setNode(I.id,{...I});else{if(x){const u=await Pr(l,I,{config:s,dir:I.dir}),p=u.node()?.getBBox()??{width:0,height:0};g.set(I.id,u),I.width=p.width,I.height=p.height}n.setNode(I.id,{...I})}}));for(const I of o)n.setEdge(I.start,I.end,{...I},I.id),e.edges.some(p=>p.id===I.id)||e.edges.push(I);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:I}=await Er(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-CseHvhng.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3,4]));I(t,e)}return{graph:n,groups:{clusters:i,edgePaths:c,edgeLabels:a,nodes:l,rootGroups:r},nodeElements:g}}d(_o,"createGraphWithElements");var Ro=5,Ge=1e-5,$e=1e-6;function qe(t){const e=[];for(let n=0;n=1-$e||I<=$e||I>=1-$e?null:{point:{x:t.x+x*s,y:t.y+x*r},tA:x,tB:I}}d(Fo,"segmentIntersection");function vn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(vn,"isHorizontalSeg");function Do(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Ho,"getArcSweepFlag");var Gr=.001;function Xo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Ao[e.arrowTypeStart];if(o){const r=t[0],i=t[1],c=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(c),n[0].y=r.y+o*Math.sin(c)}const s=e.arrowTypeEnd&&Ao[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],c=t[r-1],a=Math.atan2(c.y-i.y,c.x-i.x);n[r-1].x=c.x-s*Math.cos(a),n[r-1].y=c.y-s*Math.sin(a)}return n}d(Xo,"applyMarkerOffsets");function Yo(t,e,n,o,s){const r=t.point.x,i=t.point.y,c={x:r-e*t.r,y:i-n*t.r},a={x:r+e*t.r,y:i+n*t.r},l=[`L${we(c)}`];return s==="arc"?l.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${we(a)}`):l.push(`M${we(a)}`),l}d(Yo,"emitJump");function Ln(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,c=n.y-e.y,a=Math.hypot(s,r),l=Math.hypot(i,c);if(a0){const E=Ln(s[l-1],s[l],s[l+1]??s[l],Ro);E&&(f=E.cutLen)}let y=x,v=null;r&&lE.t-T.t);for(const E of M)E.r=Math.min(E.r,E.d-f,y-E.d);for(let E=0;ET){const m=T/2;M[E].r=Math.min(M[E].r,m),M[E+1].r=Math.min(M[E+1].r,m)}}for(const E of M)E.r=2?o:null}catch{return null}}d(Vo,"decodeDataPoints");function jo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const l of e)s.set(l.id,l);const r=[],i=new Map;for(const l of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(l.id):l.id,x=o.querySelector(`path[data-id="${g}"]`);if(!x)continue;i.set(l.id,x);const u=Vo(x.getAttribute("data-points"))??l.points;r.push({...l,points:u})}const c=Do(r);if(c.length===0)return;const a=new Map;for(const l of c){const g=a.get(l.jumpEdgeId)??[];g.push(l),a.set(l.jumpEdgeId,g)}for(const l of r){const g=a.get(l.id);if(!g||g.length===0)continue;const I=s.get(l.id)?.curve;if(I!==void 0&&!zo(I))continue;const u=i.get(l.id);if(!u)continue;if(I===void 0){const E=u.getAttribute("d")??"";if(!$o(E))continue}const p=u.getAttribute("style")??"",f=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),y=f?Number.parseFloat(f[1]):null,v=f?Number.parseFloat(f[2]):null,M=Go(l,g,n);if(u.setAttribute("d",M),y!==null&&v!==null&&typeof u.getTotalLength=="function"){const E=u.getTotalLength(),T=Math.max(0,E-y-v),m=`0 ${y} ${T} ${v}`,S=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${m};`).replace(/;\s*;+/g,";");u.setAttribute("style",S)}}}d(jo,"applyLineJumpsToSvg");async function Uo(t,e){for(const s of t.nodes)s.isGroup?await Br(e.clusters,s):kr(s);const n=new Map;for(const s of t.nodes)s?.id&&n.set(s.id,s);for(const s of t.edges){const r=s.start?n.get(s.start)??{}:{},i=s.end?n.get(s.end)??{}:{},c=_r(e.edgePaths,{...s},{},t.type,r,i,t.diagramId);s.label&&await Fr(e.rootGroups,s),s.label&&Wo(s,c)}const o=t.config?.swimlane?.lineHops;if(o!==!1){const s=o==="gap"?"gap":"arc",r=t.edges.filter(i=>Array.isArray(i.points)&&i.points.length>=2).map(i=>({id:i.id,points:i.points,curve:i.curve,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));jo(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}}d(Uo,"adjustLayout");function Wo(t,e){const n=e?.updatedPath??e?.originalPath,o=Dr(),{subGraphTitleTotalMargin:s}=Hr({flowchart:o.flowchart??{}});if(t.label){const r=Xr.get(t.id);let i=t.x,c=t.y;if(n){const a=Oe.calcLabelPosition(n);Ke.debug("Moving label "+t.label+" from (",i,",",c,") to (",a.x,",",a.y,") abc88"),e&&(i=a.x,c=a.y)}r.attr("transform",`translate(${i}, ${c+s/2})`)}if(t?.startLabelLeft){const r=Ye.get(t.id).startLeft;let i=t?.x,c=t?.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.startLabelRight){const r=Ye.get(t.id).startRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelLeft){const r=Ye.get(t.id).endLeft;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelRight){const r=Ye.get(t.id).endRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}}d(Wo,"positionEdgeLabel");var Mn="__swimlane_default__",$r=21,No=20;function En(t){return Math.max(t.padding??No,No)}d(En,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,c=Math.min(r,n+s/2),a=Math.min($r,Math.max(0,c-i)),l=i+a;if(l<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:l}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===Mn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:Mn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=Mn}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const a of t.nodes??[])e.set(a.id,a);const n=[];for(const a of t.edges??[]){const l=typeof a.start=="string"?a.start:void 0,g=typeof a.end=="string"?a.end:void 0;!l||!g||a.labelNodeId||n.push({id:a.id,src:l,dst:g,ref:a})}const o=t.nodes??[],s=o.filter(a=>a.isGroup),r=o.filter(a=>!a.isGroup);return{nodes:[...[...s].reverse(),...r].map(a=>a.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,c=o?.nodeGap??40;let a=0;for(const I of e.layers){let u=0;for(const p of I){const f=r.get(p);if(!f){u++;continue}f.layer=a,f.order=u;const y=n.x[p]??u*c,v=n.y[p]??a*i;f.x=y,f.y=v,u++}a++}const l=s.nodes??[],g=new Map,x=[];for(const I of l){if(!I?.isGroup)continue;I.parentId||x.push(I);const u=l.filter(M=>M.parentId===I.id);let p=1/0,f=-1/0,y=1/0,v=-1/0;for(const M of u){const E=M.x??n.x[M.id],T=M.y??n.y[M.id],m=M.width??0,S=M.height??0;E!=null&&T!=null&&(p=Math.min(p,E-m/2),f=Math.max(f,E+m/2),y=Math.min(y,T-S/2),v=Math.max(v,T+S/2))}if(p===1/0||y===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const M=I.padding??20,E=I.parentId?M:2*En(I),T=M,m=Math.max(0,f-p)+E,S=Math.max(0,v-y)+T,A=(p+f)/2,R=(y+v)/2;I.x=A,I.y=R,I.width=m,I.height=S,g.set(I.id,{minX:p,maxX:f,minY:y,maxY:v})}}if(x.length>0&&g.size>0){let I=1/0,u=-1/0,p=0;for(const f of x){const y=f.padding??20;y>p&&(p=y);const v=g.get(f.id);v&&(I=Math.min(I,v.minY),u=Math.max(u,v.maxY))}if(I!==1/0&&u!==-1/0){const f=Math.max(0,u-I),v=Math.max(p,36),M=f+2*v,E=(I+u)/2;for(const k of x)k.y=E,k.height=M,k.swimlaneContentTop=I;const T=[...x].sort((k,O)=>{const _=k.x??0,H=O.x??0;return _-H}),m=[],S=[],A=[];for(const k of T){const O=g.get(k.id);if(!O)continue;const _=Math.max(0,O.maxX-O.minX)+2*En(k),H=(O.minX+O.maxX)/2;m.push(k.id),S.push(H),A.push(_)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],A[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Ae(e,n,o,s)}:void 0}d(oo,"measuredNodeRect");function so(t){if(t.isGroup)return;const e=oo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(so,"nodeBoundsInfoFor");function oe(t,e,n=Ft){return Math.abs(t.x-e.x)n}d(Tt,"isHorizontalSegment");function wt(t,e,n=Ft){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}d(wt,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(zt,"overlapLength");function ce(t,e,n=Ft){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(ce,"sameAxisSegmentOverlapLength");function Re(t,e=Ft){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(pt,"dedupeConsecutivePoints");function ro(t,e=Ft){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Tt(n,o,e)&&wt(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:wt(n,o,e)&&Tt(o,s,e)&&wt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(ro,"classifyThreeSegmentRoute");function cn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),c=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&ie.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Je(t,e){return t.lefte.left&&t.tope.top}d(Je,"rectsOverlap");function Tn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Tn,"inflateRect");function Ae(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Ae,"rectFromCenterSize");function qt(t){return oo(t)?.rect}d(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Ie,"portForRectSide");function co(t,e,n,o,s,r=Ft){const i=e==="left"||e==="right",c=o==="left"||o==="right";if(i&&c){if(e==="right"&&o==="left"&&t.xn.x){if(ht(t,n,r))return[t,n];const x=(t.x+n.x)/2;return[t,{x,y:t.y},{x,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const x=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x,y:t.y},{x,y:n.y},n]}return}if(!i&&!c){if(e===o){if(ft(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(ft(t,n,r))return[t,n];const x=(t.y+n.y)/2;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(i&&!c){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&x?[t,{x:n.x,y:t.y},n]:void 0}const a=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return a&&l?[t,{x:t.x,y:n.y},n]:void 0}d(co,"buildOrthogonalPortPath");function ao(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ao,"buildSameSideTrackPath");function an(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=so(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(an,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=so(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,c=o.height??0;n.push({nodeId:o.id,...Ae(s,r,i,c)})}return n}d(es,"collectLayoutNodeRects");function lo(t,e,n=Ft){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)p||Iv)return!1;const M=Math.abs(f-g.a.x)s:r&&c&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Ze(t,e,n,o,{epsilon:s=Ft,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const c=i.points;if(!(!c||c.length<2))for(let a=0;aI+s&&pf+s&&xo+Ft&&t=2?e[e.length-2]:void 0,a=(i?ft(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(a)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}d(Qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ae,"simplifyPolyline");var nt=.001,Vr=.5,Oo=4;function uo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=rs(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(An,"clipEndpoint");function is(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=An(s,o.srcRect,!0)),o.dstRect&&(s=An(s,o.dstRect,!1)),s=ae(Qe(s)),s=ho(s,o.srcRect,o.dstRect),o.edge.points=ae(Qe(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function Rn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.yn.bottom+nt)return e;if(o){if(t.xn.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.xn.right+nt)return e;if(o){if(t.yn.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Rn,"snapEndpointToBoundary");function tn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function On(t,e){return e==="left"||e==="right"?en(t.top,t.bottom):en(t.left,t.right)}d(On,"clearanceRangeForSide");function nn(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function Pn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,c=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(c-i)({...c}));for(let c=e;c>=0&&c=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)o.bottom+nt;case"left":return ht(e,n,nt)&&n.xo.right+nt}}d(_n,"leavesOutward");function Fn(t,e,n){if(t.length<3)return t;if(n){const r=kn(t[0],t[1],e);return r&&_n(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=kn(t[o-1],t[o],e);return s&&_n(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Fn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=tn(o,0,1);if(r){const i=Rn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Fn(o,e,!0)}if(n){const r=o.length-1,i=tn(o,r,-1);if(i){const c=Rn(i,o[r],n,!0);c!==o[r]&&(o=[...o.slice(0,r),c])}o=Fn(o,n,!1)}const s=ho(o,e,n);return s!==o||o.length===2?s:(e&&(o=Bn(o,e,!0)),n&&(o=Bn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Dn(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;const s=pt(o.points,nt),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Dn,"prepareEdgeEndpointsForRenderer");function go(t){return new Map(t.map(e=>[e.id,e]))}d(go,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Hn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}d(Hn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,c=r.y;if(typeof i!="number"||typeof c!="number")continue;const a=r.width??0,l=r.height??0;e=Math.min(e,i-a/2),n=Math.max(n,i+a/2),o=Math.min(o,c-l/2),s=Math.max(s,c+l/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=go(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Hn(s,e)-Hn(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function on(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);let r=1/0,i=-1/0;for(const a of s){const l=a[e];typeof l=="number"&&(r=Math.min(r,l),i=Math.max(i,l))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const c=d(a=>r+i-a,"mirror");for(const a of n){const l=a[e];typeof l=="number"&&(a[e]=c(l));const g=a.groupTitleRect;g&&(a.groupTitleRect=e==="x"?{...g,left:c(g.right),right:c(g.left)}:{...g,top:c(g.bottom),bottom:c(g.top)})}for(const a of o)for(const l of a.points??[])l[e]=c(l[e]);return!0}d(on,"mirrorAxis");function ps(t){return(t.nodes??[]).some(n=>!n.isGroup)?on(t,"y"):!0}d(ps,"applyBtDirectionTransform");function ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/x):1;for(const P of s){const G=P.x??0,J=((P.y??0)-i)*I+c,dt=G-r;P.x=J,P.y=dt}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,dt=(G.y-i)*I+c,mt=j-r;G.x=dt,G.y=mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&on(t,"x"),!0;const p=go(n),f=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,p);if(!G)continue;const j=f.get(G)??[];j.push(P),f.set(G,j)}let y=0;for(const P of u){const G=P.padding??0;G>y&&(y=G)}const v=[];let M=1/0,E=-1/0;for(const P of u){const G=f.get(P.id)??[],j=po(G);j&&(M=Math.min(M,j.minX),E=Math.max(E,j.maxX),v.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(M===1/0||E===-1/0)return!0;const T=Math.max(0,E-M),m=Math.max(y,10),S=T+2*m,A=c+S,O=(M+E)/2-S/2-c,_=O+A/2,H=Math.max(y,c);v.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?v.bottom:v.top,H=I.cx+M;if(H<=v.left+se||H>=v.right-se)continue;E={x:H,y:_},T={x:H,y:c.y},m={x:c.x,y:c.y}}else{const _=u.cx>I.cx?v.right:v.left,H=I.cy+M;if(H<=v.top+se||H>=v.bottom-se)continue;E={x:_,y:H},T={x:c.x,y:H},m={x:c.x,y:c.y}}const S=oe(E,T,se),A=oe(T,m,se);if(S&&A||!S&&At(E,T,o,[g],1)||!A&&At(T,m,o,[x],1))continue;const R=!S&&Ze(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!A&&Ze(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){S?y=[T,m]:A?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}d(ys,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const c of t){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<4)continue;const l=pt(a,.001);if(l.length<4)continue;const g=l.length-1,x=l[g],I=l[g-1],u=l[g-2],p=x.x-I.x,f=x.y-I.y,y=Math.hypot(p,f);if(y>=10||y<.001)continue;const v=I.x-u.x,M=I.y-u.y;if(Math.hypot(v,M)<.001)continue;const T=Tt(I,x,.001),m=wt(I,x,.001),S=Tt(u,I,.001),A=wt(u,I,.001);if(!(T&&A||m&&S))continue;const R=c.end,k=c.start,O=R?e.get(R):void 0;if(!O)continue;const _=O.x??0,H=O.y??0,P=qt(O);if(!P)continue;let G,j;if(A){const W=M<0;G={x:_,y:u.y},j={x:_,y:W?P.bottom:P.top}}else{const W=v>0;G={x:u.x,y:H},j={x:W?P.right:P.left,y:H}}if(At(G,j,r,R?[R]:[],-2)||At(G,j,i,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&io(G,et,2))continue}const J=d((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W{for(const at of t){if(at===c||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt=0){const W=l[g-3],et=[k,R].filter(at=>!!at);if(At(W,G,r,et,-2)||mt(W,G))continue}const Pt=[...l.slice(0,g-2),G,j];c.points=Pt;const Q=c.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt=et+2||de&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}d(xs,"collapseShortTerminalStub");var Z=.001,_t=8,it=Re,In=d((t,e)=>ft(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function bs(t,e){const s=d((u,p)=>{const f=u.x??0,y=u.y??0,v=p.x-f,M=p.y-y;let E=(u.width??0)/2,T=(u.height??0)/2;return Math.abs(M)*E>Math.abs(v)*T?(M<0&&(T=-T),{x:f+(M===0?0:T*v/M),y:y+T}):(v<0&&(E=-E),{x:f+E,y:y+(v===0?0:E*M/v)})},"rectIntersect"),r=d((u,p)=>{const f=pt(u.points??[]);if(f.length<2)return;const y=p?u.start:u.end,v=y?e.get(y):void 0,M=v?qt(v):void 0;if(!v||!y||!M)return;const E=p?f[0]:f[f.length-1],T=p?f[1]:f[f.length-2],m=s(v,E);let S=E;if(In(T,m)&&(S=T),ft(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"V",coord:m.x,min:Math.min(m.y,S.y),max:Math.max(m.y,S.y),boundary:m,railEnd:S,rect:M};if(ht(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"H",coord:m.y,min:Math.min(m.x,S.x),max:Math.max(m.x,S.x),boundary:m,railEnd:S,rect:M}},"terminalLaneFor"),i=d((u,p)=>Math.max(0,Math.min(u.max,p.max)-Math.max(u.min,p.min)),"projectedOverlapLength"),c=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&ft(u.boundary,p.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ht(u.boundary,p.boundary,1),"sameTerminalFace"),a=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:i(u,p)>=_t&&Math.abs(u.coord-p.coord)<.5,"exactTerminalLaneConflict"),l=d((u,p)=>{if(u.nodeId!==p.nodeId||u.orientation!==p.orientation||u.orientation!=="H"||u.atStart===p.atStart)return!1;const f=i(u,p);if(f<_t)return!1;const y=u.rect.bottom-u.rect.top;return f2*y?!1:c(u,p)&&Math.abs(u.coord-p.coord)<16},"nearTerminalLaneConflict"),g=d((u,p)=>{const f=pt(u.edge.points??[]);if(f.length<2)return;const y=u.orientation==="V"?{x:u.boundary.x+p,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+p},v=u.orientation==="V"?{x:u.railEnd.x+p,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+p};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ht(y,u.boundary,Z)&&y.x>=u.rect.left+1&&y.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?ft(y,u.boundary,Z)&&y.y>=u.rect.top+1&&y.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const S=f.length>1&&oe(f[1],u.railEnd,Z),A=f.slice(S?2:1),R=A[0];return R&&!In(R,v)?void 0:[y,v,...A]}const E=f.length>1&&oe(f[f.length-2],u.railEnd,Z),T=f.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!In(m,v)))return[...T,v,y]},"shiftedCandidate"),x=d(u=>{const p=u.edge,f=pt(p.points??[]);if(f.length!==2)return!1;const y=p.start,v=p.end,M=y?e.get(y):void 0,E=v?e.get(v):void 0;if(!M||!E)return!1;const T=M.x??0,m=M.y??0,S=E.x??0,A=E.y??0,[R,k]=f;return ht(R,k,Z)&&Math.abs(m-A)<1&&Math.abs(T-S)>1||ft(R,k,Z)&&Math.abs(T-S)<1&&Math.abs(m-A)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const p=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let f=!1;for(let y=0;y{const R=x(S),k=x(A);return R!==k?Number(R)-Number(k):+!A.atStart-+!S.atStart});for(const S of m){for(const A of I){const R=g(S,A);if(!R)continue;const k=r({...S.edge,points:R},S.atStart);if(!(!k||p.some(O=>O.edge!==S.edge&&(a(k,O)||T&&l(k,O))))){S.edge.points=R,f=!0;break}}if(f)break}}if(!f)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=d((c,a)=>{const l=c.start,g=c.end,x=it(a);if(x.length!==a.length-1)return!1;const I=[l,g].filter(u=>!!u);for(const u of x)if(At(u.a,u.b,o,I,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===c||u.isLayoutOnly)continue;const p=u.points;if(!(!p||p.length<2)){for(const f of x)for(const y of it(pt(p)))if(ce(f,y,.5)>=_t||le(f.a,f.b,y.a,y.b,Z))return!1}}return!0},"candidateIsSafe"),i=d((c,a)=>{if(a+4>=c.length)return;const l=c[a],g=c[a+1],x=c[a+2],I=c[a+3],u=c[a+4],p=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&ft(l,I,Z)&&ft(l,u,Z)&&ft(g,x,Z)&&(g.x-l.x)*(I.x-x.x)<0,f=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&ht(l,I,Z)&&ht(l,u,Z)&&ht(g,x,Z)&&(g.y-l.y)*(I.y-x.y)<0;if(p||f)return pt([...c.slice(0,a+1),u,...c.slice(a+5)]);if(a+5>=c.length)return;const y=c[a+5],v=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&wt(u,y)&&ft(l,u,Z)&&ft(l,y,Z)&&ft(x,I,Z)&&(x.x-g.x)*(u.x-I.x)<0,M=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&Tt(u,y)&&ht(l,u,Z)&&ht(l,y,Z)&&ht(x,I,Z)&&(x.y-g.y)*(u.y-I.y)<0;if(!(!v&&!M))return pt([...c.slice(0,a+1),y,...c.slice(a+6)])},"withoutDogleg");for(let c=0;c<8;c++){let a=!1;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(let x=0;x<=g.length-5;x++){const I=i(g,x);if(!(!I||!r(l,I))){l.points=I,a=!0;break}}if(a)break}if(!a)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Xn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(p=>!p.isLayoutOnly),a=d((p,f,y)=>pt(p===f?y??[]:p.points??[]),"pointsFor"),l=d((p,f)=>{let y=0;for(let v=0;v{const f=it(p);if(f.length!==3)return;const y=f[1];if(!(f[0].horizontal===y.horizontal||f[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),x=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);return r.filter(v=>{if(y.includes(v.id))return!1;const M=v.rect;return f.horizontal?zt(f.a.x,f.b.x,M.left,M.right)>=_t&&f.a.y>=M.top-2&&f.a.y<=M.bottom+2:zt(f.a.y,f.b.y,M.top,M.bottom)>=_t&&f.a.x>=M.left-2&&f.a.x<=M.right+2})},"blockingRectsFor"),I=d((p,f,y)=>{const v=p.map(E=>({...E}));if(f.horizontal)v[f.index].y=y,v[f.index+1].y=y;else if(f.vertical)v[f.index].x=y,v[f.index+1].x=y;else return;const M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),u=d((p,f,y)=>{const v=[p.start,p.end].filter(E=>!!E),M=it(f);if(M.length!==f.length-1)return!1;for(const E of M)if(At(E.a,E.b,r,v,-2)||At(E.a,E.b,i,[],-2))return!1;for(const E of c)if(E!==p){for(const T of M)for(const m of it(a(E)))if(ce(T,m,.5)>=_t)return!1}return l(p,f)<=y},"candidateIsSafe");for(let p=0;p<8;p++){const f=l();let y=!1;for(const v of c){const M=a(v),E=g(M);if(!E)continue;const T=x(v,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(S=>S.rect.top))-20,Math.max(...T.map(S=>S.rect.bottom))+20]:[Math.min(...T.map(S=>S.rect.left))-20,Math.max(...T.map(S=>S.rect.right))+20];for(const S of m){const A=I(M,E.segment,S);if(!(!A||!u(v,A,f))){v.points=A,y=!0;break}}if(y)break}if(!y)return}}d(Xn,"liftObstacleHuggingSameSideRails");function Yn(t,e){const o=d(a=>{const l=a.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),s=d(a=>{if(!a.isGroup||a.parentId)return;const l=a.direction,g=typeof l=="string"?l.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const x=o(a),I=a.y,u=a.height;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(f<=0||p{if(!a.horizontal)return!1;const g=a.a.y;return g<=l.top+Z||g>=l.bottom-Z?!1:zt(a.a.x,a.b.x,l.left,l.right)>=_t},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(a=>!!a);if(i.length===0)return;let c=0;for(const a of t){if(a.isLayoutOnly)continue;const l=pt(a.points??[]);for(const g of it(l))for(const x of i)r(g,x.rect)&&(c=Math.max(c,x.rect.bottom-g.a.y+4))}if(!(c<=Z))for(const a of i){const l=a.node.y,g=a.node.height;typeof l!="number"||typeof g!="number"||!Number.isFinite(l)||!Number.isFinite(g)||g<=0||(a.node.y=l-c/2,a.node.height=g+c,a.node.groupTitleRect={...a.rect,top:a.rect.top-c,bottom:a.rect.bottom-c})}}d(Yn,"liftTopLaneTitleBandsAboveRails");function Gn(t,e){const o=d(l=>{const g=l.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId||l.direction!=="LR")return;const x=o(l),I=l.x,u=l.width;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(p<=0||f{if(!l.vertical)return!1;const x=l.a.x;return x<=g.left+Z||x>=g.right-Z?!1:zt(l.a.y,l.b.y,g.top,g.bottom)>=_t},"verticalSegmentIntersectsTitle"),i=d((l,g)=>{if(!l.horizontal)return!1;const x=l.a.y;return x<=g.top+Z||x>=g.bottom-Z?!1:zt(l.a.x,l.b.x,g.left,g.right)>=_t},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(l=>!!l);if(c.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(const x of it(g))for(const I of c)if(r(x,I.rect))a=Math.max(a,I.rect.right-x.a.x+4);else if(i(x,I.rect)){const u=Math.min(x.a.x,x.b.x);a=Math.max(a,I.rect.right-u+4)}}if(!(a<=Z))for(const l of c){const g=l.node.x,x=l.node.width;typeof g!="number"||typeof x!="number"||!Number.isFinite(g)||!Number.isFinite(x)||x<=0||(l.node.x=g-a/2,l.node.width=x+a,l.node.groupTitleRect={...l.rect,left:l.rect.left-a,right:l.rect.right-a})}}d(Gn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(p=>!p.isLayoutOnly),r=d((p,f=new Map)=>pt(f.get(p)??p.points??[]),"replacementPointsFor"),i=d((p=new Map)=>{let f=0;for(let y=0;ys.reduce((f,y)=>f+Qt(r(y,p)),0),"totalBends"),a=d(p=>{const f=r(p);if(f.length<4)return;const y=f[f.length-2],v=f[f.length-1];if(!(!Tt(y,v,Z)&&!wt(y,v,Z)))return{tailStart:y,terminal:v}},"terminalTailFor"),l=d((p,f)=>{const y=r(p);if(y.length<3)return;const v=y[0],M=y[1];let E;if(Tt(v,M,Z))E={x:M.x,y:f.tailStart.y};else if(wt(v,M,Z))E={x:f.tailStart.x,y:M.y};else return;const T=ae(pt([v,M,E,f.tailStart,f.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),g=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);for(const v of it(f))if(At(v.a,v.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),x=d((p,f,y)=>{for(const v of s)if(v!==p){for(const M of it(f))for(const E of it(r(v,y)))if(ce(M,E,.5)>=_t)return!0}return!1},"pathHasSharedTrack"),I=d((p,f,y)=>!g(p,f)&&!x(p,f,y),"candidateIsSafe"),u=d(()=>{const p=new Map;for(const f of s){const y=f.end;if(!y||!e.has(y)||r(f).length<4)continue;const M=p.get(y)??[];M.push(f),p.set(y,M)}return p},"edgesByDestination");for(let p=0;p<4;p++){const f=i();if(f===0)return;const y=c();let v,M=f,E=y;for(const T of u().values())for(let m=0;m=f||G>M||G===M&&j>=E||(v=P,M=G,E=j)}if(!v)return;for(const[T,m]of v)T.points=m}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(T=>!T.isLayoutOnly),a=d((T,m=new Map)=>pt(m.get(T)??T.points??[]),"replacementPointsFor"),l=d((T=new Map)=>{let m=0;for(let S=0;Sc.reduce((m,S)=>m+Qt(a(S,T)),0),"totalBends"),x=d(T=>{const m=T.start,S=T.end,A=m?e.get(m):void 0,R=S?e.get(S):void 0,k=A?qt(A):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),I=d((T,m,S)=>{if(S.index<=0||S.index+1>=m.length-1)return;const A=x(T);if(A){if(S.vertical){const R=S.a.x,k=Math.min(A.src.left,A.dst.left),O=Math.max(A.src.right,A.dst.right),_=RO+Z?"right":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"vertical",side:_,coord:R,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){const R=S.a.y,k=Math.min(A.src.top,A.dst.top),O=Math.max(A.src.bottom,A.dst.bottom),_=RO+Z?"bottom":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"horizontal",side:_,coord:R,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const T=[];for(const m of c){const S=a(m);for(const A of it(S)){const R=I(m,S,A);R&&T.push(R)}}return T},"collectExternalRails"),p=d((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&zt(T.min,T.max,m.min,m.max)>=_t,"railsInteract"),f=d(T=>{const m=[],S=new Set;for(const A of T){if(S.has(A))continue;const R=[A],k=[];for(S.add(A);R.length>0;){const O=R.pop();k.push(O);for(const _ of T)!S.has(_)&&p(O,_)&&(S.add(_),R.push(_))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=d(T=>{const m=[];for(const S of T)m.some(A=>Math.abs(A-S.coord){const m=T.map(R=>R.coord),S=y(T),A=[];if(T.length<=6){const R=new Array(S.length).fill(!1),k=[],O=d(()=>{if(k.length===T.length){k.some((_,H)=>Math.abs(_-m[H])>=Z)&&A.push([...k]);return}for(const[_,H]of S.entries())R[_]||(R[_]=!0,k.push(H),O(),k.pop(),R[_]=!1)},"visit");return O(),A}for(let R=0;R{const S=new Map;for(const[R,k]of T.entries()){const O=m[R],_=S.get(k.edge)??k.points.map(H=>({x:H.x,y:H.y}));k.axis==="vertical"?(_[k.segmentIndex].x=O,_[k.segmentIndex+1].x=O):(_[k.segmentIndex].y=O,_[k.segmentIndex+1].y=O),S.set(k.edge,_)}const A=new Map;for(const[R,k]of S){const O=ae(pt(k));if(it(O).length!==O.length-1)return;A.set(R,O)}return A},"replacementsForAssignment"),E=d(T=>{for(const[m,S]of T){const A=[m.start,m.end].filter(R=>!!R);for(const R of it(S))if(At(R.a,R.b,r,A,-2)||At(R.a,R.b,i,[],-2))return!1}for(let m=0;m=_t)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=l();if(m===0)return;let S,A=m,R=g(),k=Number.POSITIVE_INFINITY;for(const O of f(u()))for(const _ of v(O)){const H=M(O,_);if(!H||!E(H))continue;const P=l(H);if(P>=m)continue;const G=g(H),j=O.reduce((J,dt,mt)=>J+Math.abs(_[mt]-dt.coord),0);P>A||P===A&&(G>R||G===R&&j>=k)||(S=H,A=P,R=G,k=j)}if(!S)return;for(const[O,_]of S)O.points=_}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,p,f)=>pt(u===p?f??[]:u.points??[]),"pointsFor"),c=d(u=>it(u).reduce((p,f)=>{const y=f.a.x-f.b.x,v=f.a.y-f.b.y;return p+Math.hypot(y,v)},0),"pathLength"),a=d((u,p)=>{let f=0;for(let y=0;y{if(u.horizontal){const f=u.a.y;return(Math.abs(f-p.top)<1||Math.abs(f-p.bottom)<1)&&zt(u.a.x,u.b.x,p.left,p.right)>=_t}if(u.vertical){const f=u.a.x;return(Math.abs(f-p.left)<1||Math.abs(f-p.right)<1)&&zt(u.a.y,u.b.y,p.top,p.bottom)>=_t}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const p=[u.start,u.end].filter(y=>!!y),f=[];for(const y of p){const v=e.get(y),M=v?qt(v):void 0;M&&f.push(M)}return f},"endpointRectsFor"),x=d((u,p)=>{if(p+3>=u.length)return[];const f=u[p],y=u[p+1],v=u[p+2],M=u[p+3],E=Tt(f,y,Z)&&wt(y,v,Z)&&Tt(v,M,Z),T=wt(f,y,Z)&&Tt(y,v,Z)&&wt(v,M,Z);if(!E&&!T)return[];if(!(E?Math.sign(y.x-f.x)!==Math.sign(M.x-v.x):Math.sign(y.y-f.y)!==Math.sign(M.y-v.y)))return[];const S=ft(f,M,Z)||ht(f,M,Z)?[]:[{x:f.x,y:M.y},{x:M.x,y:f.y}],A=S.length===0?[[...u.slice(0,p+1),...u.slice(p+3)]]:S.map(k=>[...u.slice(0,p+1),k,...u.slice(p+3)]),R=new Set;return A.map(k=>ae(pt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(_=>oe(_,M,Z)))return!1;const O=k.map(_=>`${_.x.toFixed(3)},${_.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,p,f)=>{const y=[u.start,u.end].filter(M=>!!M),v=g(u);for(const M of it(p))if(At(M.a,M.b,o,y,-2)||At(M.a,M.b,s,[],-2)||v.some(E=>l(M,E)))return!1;for(const M of r)if(M!==u){for(const E of it(p))for(const T of it(i(M)))if(ce(E,T,.5)>=_t)return!1}return a(u,p)<=f},"candidateIsSafe");for(let u=0;u<8;u++){const p=a();let f,y,v=p,M=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=i(T),S=Qt(m,Z),A=c(m);for(let R=0;R<=m.length-4;R++)for(const k of x(m,R)){const O=Qt(k,Z),_=c(k);if(!(Ov||P===v&&(O>M||O===M&&_>=E)||(f=T,y=k,v=P,M=O,E=_)}}if(!f||!y)return;f.points=y}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const i=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const F=N.x??0,D=N.y??0,V=qt(N);V&&i.push({id:String(N.id??""),cx:F,cy:D,rect:V})}if(i.length===0)return;const c=new Map(i.map(N=>[N.id,N])),a=i.map(N=>({id:N.id,rect:N.rect})),l=["top","bottom","left","right"],g={top:Math.min(...i.map(N=>N.rect.top))-20,bottom:Math.max(...i.map(N=>N.rect.bottom))+20,left:Math.min(...i.map(N=>N.rect.left))-20,right:Math.max(...i.map(N=>N.rect.right))+20},x=t.filter(N=>!N.isLayoutOnly),I=new Map(x.map((N,F)=>[N,F])),u=d(N=>{const F=N==="left"||N==="top"?-1:1,D=[];for(let V=0;V<=2;V++)D.push(g[N]+F*20*V);return D},"outwardTracksForSide"),p=d((N,F=new Map)=>pt(F.get(N)??N.points??[]),"replacementPointsFor"),f=d((N,F)=>{let D=0;for(const V of N)for(const h of F)le(V.a,V.b,h.a,h.b,Z)&&D++;return D},"crossingCountBetweenSegments"),y=d((N,F)=>f(it(N),it(F)),"crossingCountBetweenPaths"),v=d((N=new Map)=>{let F=0;const D=[],V=new Set,h=[],b=d(C=>{V.has(C)||(V.add(C),h.push(C))},"addEdge");for(let C=0;C0&&(F+=q,D.push({first:L,second:U,count:q}),b(L),b(U))}}return h.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),{count:F,pairs:D,edgeSet:V,edges:h}},"crossingSnapshot"),M=d((N,F)=>{const D=new Set(F.keys());if(D.size===0)return N.count;let V=0;for(const b of N.pairs)(D.has(b.first)||D.has(b.second))&&(V+=b.count);let h=0;for(let b=0;b{const F=new Map;for(const h of N.pairs){const b=F.get(h.first)??new Set;b.add(h.second),F.set(h.first,b);const C=F.get(h.second)??new Set;C.add(h.first),F.set(h.second,C)}const D=[],V=new Set;for(const h of N.edges){if(V.has(h))continue;const b=[h],C=[];for(V.add(h);b.length>0;){const L=b.pop();C.push(L);for(const w of F.get(L)??[])V.has(w)||(V.add(w),b.push(w))}C.sort((L,w)=>(I.get(L)??0)-(I.get(w)??0)),C.length>1&&D.push(C)}return D},"crossingComponents"),T=d(N=>[N.start,N.end].filter(F=>!!F),"endpointIdsFor"),m=d(N=>{const F=[];for(const D of E(N)){const V=new Set(D),h=new Set(D.flatMap(C=>T(C))),b=[...D];for(const C of x)V.has(C)||T(C).some(L=>h.has(L))&&b.push(C);b.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),F.push(b)}return F},"pairSearchGroups"),S=d((N,F,D)=>M(N,new Map([[F,D]])),"crossingCountWithSingleReplacement"),A=d(N=>{const F=new Map;for(const D of N.pairs)F.set(D.first,(F.get(D.first)??0)+D.count),F.set(D.second,(F.get(D.second)??0)+D.count);return F},"currentCrossingsByEdge"),R=d(N=>N.slice(1).reduce((F,D,V)=>{const h=N[V];return F+Math.abs(D.x-h.x)+Math.abs(D.y-h.y)},0),"pathLength"),k=d((N=new Map)=>x.reduce((F,D)=>F+Qt(p(D,N)),0),"totalBends"),O=d((N=new Map)=>x.reduce((F,D)=>F+R(p(D,N)),0),"totalLength"),_=d((N,F,D=new Map)=>{const V=it(F);for(const h of x)if(h!==N){for(const b of V)for(const C of it(p(h,D)))if(ce(b,C,.5)>=_t)return!0}return!1},"pathHasSegmentConflict"),H=d((N,F)=>{const D=[N.start,N.end].filter(V=>!!V);for(const V of it(F))if(At(V.a,V.b,a,D,-2))return!0;return!1},"pathHitsNode"),P=d((N,F)=>{const D=ae(pt(F));it(D).length===D.length-1&&N.push(D)},"pushOrthogonalCandidate"),G=d(N=>N==="left"||N==="right","sideIsHorizontal"),j=d((N,F,D)=>{switch(F){case"left":return Math.min(N.x,D.x)-20;case"right":return Math.max(N.x,D.x)+20;case"top":return Math.min(N.y,D.y)-20;case"bottom":return Math.max(N.y,D.y)+20}},"localTrackForSameSide"),J=d((N,F,D,V)=>{const h=D==="left"||D==="top"?-1:1,b=[j(F,D,V),g[D]];for(const C of b)for(let L=0;L<=2;L++)P(N,ao(F,D,V,C+h*20*L))},"addSameSideCandidates"),dt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:b,y:F.y},{x:b,y:C},{x:V.x,y:C},V])},"addHorizontalToVerticalCandidates"),mt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:F.x,y:b},{x:C,y:b},{x:C,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=d((N,F,D,V,h)=>{const b=[...u("top"),...u("bottom")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:C,y:F.y},{x:C,y:w},{x:L,y:w},{x:L,y:V.y},V])},"addHorizontalPairCandidates"),Pt=d((N,F,D,V,h)=>{const b=[...u("left"),...u("right")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:F.x,y:C},{x:w,y:C},{x:w,y:L},{x:V.x,y:L},V])},"addVerticalPairCandidates"),Q=d(N=>{const F=new Set;return N.map(D=>pt(D)).filter(D=>{const V=D.map(h=>`${h.x.toFixed(3)},${h.y.toFixed(3)}`).join("|");return F.has(V)||D.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),W=d((N,F,D,V)=>{const h=[],b=co(N,F,D,V,20,Z);b&&P(h,b),F===V&&J(h,N,F,D);const C=G(F),L=G(V);return C&&!L?dt(h,N,F,D,V):!C&&L?mt(h,N,F,D,V):C?kt(h,N,F,D,V):Pt(h,N,F,D,V),Q(h)},"buildCandidatesForSides"),et=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="top"||C==="bottom"?u(C):b;for(const B of h){P(N,[F,D,{x:B,y:D.y},{x:B,y:L.y},L]);for(const U of w)P(N,[F,D,{x:B,y:D.y},{x:B,y:U},{x:L.x,y:U},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="left"||C==="right"?u(C):h;for(const B of b){P(N,[F,D,{x:D.x,y:B},{x:L.x,y:B},L]);for(const U of w)P(N,[F,D,{x:D.x,y:B},{x:U,y:B},{x:U,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=d(N=>{const F=N.start,D=N.end,V=D?c.get(D):void 0;if(!F||!V)return[];const h=pt(N.points??[]);if(h.length<4)return[];const b=h[0],C=h[1],L=[];return wt(b,C,Z)?et(L,b,C,V):Tt(b,C,Z)&&at(L,b,C,V),L},"terminalPreservingOuterTrackCandidates"),xt=d(N=>{const F=N.start,D=N.end,V=F?c.get(F):void 0,h=D?c.get(D):void 0;if(!V||!h)return[];const b=[];for(const C of l){const L=Ie(V,C);for(const w of l)b.push(...W(L,C,Ie(h,w),w))}return b.push(...gt(N)),b},"candidatePathsFor"),vt=d(()=>new Map(x.map(N=>[N,it(p(N))])),"currentSegmentsByEdge"),Vt=d((N,F,D)=>{const V=new Set;for(const h of x){if(h===N)continue;const b=D.get(h)??it(p(h));F.some(C=>b.some(L=>ce(C,L,.5)>=_t))&&V.add(h)}return V},"sharedTrackConflictsFor"),jt=d((N,F,D,V)=>{const h=new Set;return xt(N).map(C=>ae(pt(C))).filter(C=>{if(H(N,C))return!1;const L=C.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return h.has(L)||C.length<2?!1:(h.add(L),!0)}).map(C=>{const L=it(C);let w=0;for(const B of x)B!==N&&(w+=f(L,D.get(B)??it(p(B))));return{candidate:C,candidateSegments:L,crossings:F.count-(V.get(N)??0)+w,bends:Qt(C,Z),totalBends:Qt(C),length:R(C)}}).filter(({crossings:C})=>C<=F.count).sort((C,L)=>C.crossings-L.crossings||C.bends-L.bends||C.length-L.length).slice(0,48).map(C=>({path:C.candidate,segments:C.candidateSegments,sharedTrackConflicts:Vt(N,C.candidateSegments,D),totalBends:C.totalBends,length:C.length}))},"pairCandidatesFor"),Ut=d((N,F,D,V,h,b)=>{let C=0;for(const w of N.pairs)(w.first===F||w.second===F||w.first===V||w.second===V)&&(C+=w.count);let L=f(D.segments,h.segments);for(const w of x){if(w===F||w===V)continue;const B=b.get(w)??it(p(w));L+=f(D.segments,B)+f(h.segments,B)}return N.count-C+L},"pairCrossingCount"),te=d((N,F)=>{for(const D of N.sharedTrackConflicts)if(D!==F)return!1;return!0},"conflictsOnlyWith"),Se=d((N,F)=>N.segments.some(D=>F.segments.some(V=>ce(D,V,.5)>=_t)),"candidatesShareTrack"),de=d((N,F,D,V)=>te(F,D.edge)&&te(V,N.edge)&&!Se(F,V),"pairCandidatesAreCompatible"),Ce=d((N,F,D,V,h)=>{const b=Ut(N.current,F.edge,D,V.edge,h,N.baseSegments);if(!(b>=N.current.count))return{replacements:new Map([[F.edge,D.path],[V.edge,h.path]]),crossings:b,bends:N.currentBends-(N.baseBendsByEdge.get(F.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+D.totalBends+h.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(F.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+D.length+h.length}},"scorePairReplacement"),dn=d((N,F)=>N.crossings{let h=V;for(const b of F.candidates)for(const C of D.candidates){if(!de(F,b,D,C))continue;const L=Ce(N,F,b,D,C);L&&dn(L,h)&&(h=L)}return h},"bestScoreForOptionPair"),hn=d(N=>{const F=k(),D=O(),V=vt(),h=A(N),b=new Map(x.map(q=>[q,Qt(p(q))])),C=new Map(x.map(q=>[q,R(p(q))])),L=new Map,w=m(N);for(const q of w)for(const z of q){if(L.has(z))continue;const Y=jt(z,N,V,h);Y.length>0&&L.set(z,{edge:z,candidates:Y})}let B={replacements:new Map,crossings:N.count,bends:F,length:D};const U={current:N,currentBends:F,currentLength:D,baseBendsByEdge:b,baseLengthByEdge:C,baseSegments:V};for(const q of w){const z=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>L.get(ot)).filter(ot=>!!ot);for(let ot=0;ot0?B.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const F=v(),D=F.count;if(D===0)return;let V,h,b=D,C=Number.POSITIVE_INFINITY;for(const w of F.edges){const B=Qt(p(w),Z);for(const U of xt(w)){const q=H(w,U),z=!q&&_(w,U),Y=S(F,w,U),ot=Qt(U,Z);q||z||!(Yb||Y===b&&ot>=C||(V=w,h=U,b=Y,C=ot)}}if(V&&h){V.points=h;continue}const L=hn(F);if(!L)return;for(const[w,B]of L)w.points=B}}d(vs,"resolveRenderedOrthogonalCrossings");var pe=.001,Wr=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=an(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(f=>f.rect.top))-r,bottom:Math.max(...o.map(f=>f.rect.bottom))+r,left:Math.min(...o.map(f=>f.rect.left))-r,right:Math.max(...o.map(f=>f.rect.right))+r},c=d((f,y,v,M)=>{const E=[],T=co(f,y,v,M,r,pe);return T&&E.push(T),y===M&&E.push(ao(f,y,v,i[y])),E},"buildOrthogonalPathCandidates"),a=d((f,y)=>{for(let v=0;v{let M=0;const E=Re(f,pe),T=y.start,m=y.end;for(const S of t){if(S===y||S.isLayoutOnly)continue;const A=S.start,R=S.end;if(!v&&T&&m&&(A===T||A===m||R===T||R===m))continue;const k=S.points;if(!(!k||k.length<2))for(const O of E)for(const _ of Re(k,pe)){if(fo(O.a,O.b,_.a,_.b,pe,pe)){M++;continue}ce(O,_,pe)>=Wr&&M++}}return M},"pathConflictCount"),g=4,x=d((f,y)=>{const v=Math.abs(f.y-y.rect.top),M=Math.abs(f.y-y.rect.bottom),E=Math.abs(f.x-y.rect.left),T=Math.abs(f.x-y.rect.right);let m="top",S=v;return M{const M=I.get(f)??[];M.push({side:y,edgeId:v}),I.set(f,M)},"addFaceClaim");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points??[];if(y.length<1)continue;const v=f.id??"",M=f.start,E=f.end;if(M){const T=n.get(M);T&&u(M,x(y[0],T),v)}if(E){const T=n.get(E);T&&u(E,x(y[y.length-1],T),v)}}const p=d((f,y,v)=>I.get(f)?.some(M=>M.edgeId!==v&&M.side===y)??!1,"faceIsClaimed");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points;if(!y||y.length<2)continue;const v=Qt(y,pe);if(v0){const mt=l(J,f,!0);if(mt>O||mt===O&&dt>=_)continue;O=mt,_=dt,k=J;continue}l(J,f)>R||dt<_&&(_=dt,k=J)}}}if(k){f.points=k;const H=I.get(M);H&&I.set(M,H.filter(G=>G.edgeId!==S));const P=I.get(E);P&&I.set(E,P.filter(G=>G.edgeId!==S)),u(M,x(k[0],T),S),u(E,x(k[k.length-1],m),S)}}}d(Ls,"simplifyDetouredEdges");var Kt=.001,Po=10,Ve=7;function $n(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,c=r.y-s.y;if(!(Math.abs(i)+Math.abs(c)r&&Je(t,Es(r)))}d(zn,"labelOverlapsOwnMarker");function Ue(t,e){const n=[];for(const p of t){if(p.isLayoutOnly)continue;const f=p.points;if(!(!f||f.length<2))for(let y=0;y{const y=Tn(f,r);for(const{nodeId:v,rect:M}of o)if(v!==p&&Je(y,M))return!0;return!1},"labelOverlapsForeignNode"),l=d((p,f)=>{const y=Tn(f,r);for(const v of n)if(v.edgeId!==p&&cn(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),g=d((p,f,y)=>a(p,y)||l(f,y),"labelOverlapsAnything"),x=[],I=d(p=>{for(const{id:f,rect:y}of s)if(ts(y,p))return f},"findContainingLane"),u=d((p,f)=>x.some(y=>y.labelId!==p&&Je(f,y.rect)),"overlapsPlacedLabel");for(const p of t){if(p.isLayoutOnly)continue;const f=p.labelNodeId;if(!f)continue;const y=e.get(f);if(!y)continue;const v=p.points;if(!v||v.length<2)continue;const M=y.width??0,E=y.height??0;if(M<=0||E<=0)continue;const T=[];for(let Q=0;Q=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx0?m:T,A=M>=E?"horizontal":"vertical",R=d(Q=>[...Q].sort((W,et)=>{const at=W.orientation===A,gt=et.orientation===A;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?M:E)+2,vt=et.length>=(et.orientation==="horizontal"?M:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((Q,W)=>{const et=v[Q.idx],at=v[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),P=d((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=d((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=d(Q=>{const W=Ae(Q.midX,Q.midY,M,E),et=I(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+M/2+i,xt=at.rect.right-M/2-i,vt=at.rect.top+E/2+i,Vt=at.rect.bottom-E/2-i;if(gt>xt||vt>Vt)return;const jt={midX:P(Q.midX,gt,xt),midY:P(Q.midY,vt,Vt)},Ut=Ae(jt.midX,jt.midY,M,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),J=d((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=d((Q,W)=>{const at=(Q.orientation==="horizontal"?M/2:E/2)+c;if(Q===k){const gt=v[Q.idx];if(J(Q,W,gt)+Kt{const W=R(Q);for(const et of W)for(const at of _){const gt=H(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!zn(xt.rect,v)&&!u(f,xt.rect)&&!g(f,p.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=d((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!zn(vt.rect,v)&&!u(f,vt.rect)&&!a(f,vt.rect)&&(et||!l(p.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(S)??(S.lengthet.labelId===f);W>=0?x[W]={labelId:f,rect:Q}:x.push({labelId:f,rect:Q})}}}d(Ue,"anchorLabelsToPolyline");var Sn=1e-6,Kr=8,Bo=Kr/2,qr=3;function Vn(t,e){return t{const g=Vn(c,a);let x=0;const I=d(u=>{if(!u)return;const p=s.get(u);if(!p)return;const f=l==="x"?p.w/2:p.h/2;f>x&&(x=f)},"consider");I(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const p=u.start,f=u.end;!p||!f||Vn(p,f)===g&&I(u.labelNodeId)}return x>0?x+qr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const c=i.points;if(!ro(c,Sn))continue;const a=lo(i,n,Sn);if(!a)continue;const{srcId:l,dstId:g,srcInfo:x,dstInfo:I,collinearX:u,collinearY:p}=a;if(u===p)continue;let f,y;if(u){const m=I.cy>x.cy;f={x:x.cx,y:m?x.rect.bottom:x.rect.top},y={x:I.cx,y:m?I.rect.top:I.rect.bottom}}else{const m=I.cx>x.cx;f={x:m?x.rect.right:x.rect.left,y:x.cy},y={x:m?I.rect.left:I.rect.right,y:I.cy}}if(At(f,y,o,[l,g],1))continue;const M=r(i,l,g,u?"x":"y"),E=M>Bo?M:Bo,T=[0,E,-E];for(const m of T){const S={...f},A={...y};if(u){if(S.x+=m,A.x+=m,S.x<=x.rect.left||S.x>=x.rect.right||A.x<=I.rect.left||A.x>=I.rect.right)continue}else if(S.y+=m,A.y+=m,S.y<=x.rect.top||S.y>=x.rect.bottom||A.y<=I.rect.top||A.y>=I.rect.bottom)continue;if(!At(S,A,o,[l,g],1)&&!Ze(S,A,t,i,{epsilon:Sn})){i.points=[S,A];break}}}}d(Ts,"straightenCollinearSiblingDetours");function jn(t,e){const{realNodeRects:a,labelNodeRects:l}=me(e.values()),g=d((m,S)=>Re(S,.001).map(A=>({...A,edge:m,interior:A.index>=1&&A.index<=S.length-3})),"segmentsFor"),x=d(()=>{const m=[];for(const S of t){if(S.isLayoutOnly)continue;const A=S.points;!A||A.length<2||m.push(...g(S,pt(A)))}return m},"allSegments"),I=d((m,S)=>m.horizontal&&S.horizontal?zt(m.a.x,m.b.x,S.a.x,S.b.x)>=8&&Math.abs(m.a.y-S.a.y)<7:m.vertical&&S.vertical?zt(m.a.y,m.b.y,S.a.y,S.b.y)>=8&&Math.abs(m.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((m,S)=>{const A=m.start,R=m.end,k=g(m,S);if(k.length!==S.length-1)return!1;const O=[A,R].filter(H=>!!H),_=m.labelNodeId?[m.labelNodeId]:[];for(const H of k)if(At(H.a,H.b,a,O,-2)||At(H.a,H.b,l,_,-2))return!1;for(const H of t){if(H===m||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of k)for(const j of g(H,pt(P)))if(I(G,j)||le(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),p=d((m,S)=>{const A=pt(m.edge.points??[]);if(A.length<4||m.index>=A.length-1)return;const R=A.map(k=>({...k}));if(m.horizontal)R[m.index].y+=S,R[m.index+1].y+=S;else if(m.vertical)R[m.index].x+=S,R[m.index+1].x+=S;else return;return g(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),f=d((m,S)=>({x:m.x??(S.left+S.right)/2,y:m.y??(S.top+S.bottom)/2}),"nodeCenter"),y=d(m=>{const S=m.edge,A=pt(S.points??[]);if(A.length!==4||m.index!==1)return;const R=S.start?e.get(S.start):void 0,k=S.end?e.get(S.end):void 0,O=R?qt(R):void 0,_=k?qt(k):void 0,H=A.slice(m.index+2);if(!(!R||!k||!O||!_||H.length===0))return{sourceCenter:f(R,O),targetCenter:f(k,_),sourceRect:O,tail:H}},"sourceDetourContextFor"),v=d((m,S,A,R,k,O)=>{const _=R.y>=A.y,H=_?k.bottom:k.top,P=H+(_?20:-20);if(_&&m.b.y<=P+.001||!_&&m.b.y>=P-.001)return;const G=m.a.x+S;return pt([{x:A.x,y:H},{x:A.x,y:P},{x:G,y:P},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),M=d((m,S,A,R,k,O)=>{const _=R.x>=A.x,H=_?k.right:k.left,P=H+(_?20:-20);if(_&&m.b.x<=P+.001||!_&&m.b.x>=P-.001)return;const G=m.a.y+S;return pt([{x:H,y:A.y},{x:P,y:A.y},{x:P,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=d((m,S)=>{const A=y(m);if(A){if(m.vertical)return v(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(m.horizontal)return M(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const S=x();let A=!1;for(let R=0;RP.interior);for(const P of H){for(const G of T){const j=p(P,G);if(j&&u(P.edge,j)){P.edge.points=j,A=!0;break}const J=E(P,G);if(J&&u(P.edge,J)){P.edge.points=J,A=!0;break}}if(A)break}}if(!A)return}}d(jn,"nudgeSharedInteriorSubpaths");function ws(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,c=o.y-n.y,a=s*c-r*i;if(Math.abs(a)<1e-10)return!1;const l=n.x-t.x,g=n.y-t.y,x=(l*c-g*i)/a,I=(l*r-g*s)/a,u=.01;return x>u&&x<1-u&&I>u&&I<1-u}d(ws,"segmentsIntersect");function As(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const c of n){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<2)continue;const l=c.start,g=c.end,x=c.labelNodeId,I=c.id??`${l}->${g}`;for(const u of s)if(!(u.nodeId===l||u.nodeId===g)&&!(x&&u.nodeId===x)){for(let p=0;p0){const c=o.filter(l=>l.type==="edge-node-overlap").length,a=o.filter(l=>l.type==="edge-edge-crossing").length;Ke.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${a} edge crossing(s)`);for(const l of o)Ke.warn(`[SWIMLANE_VALIDATE] ${l.type}: ${l.detail}`)}return o}d(As,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ms(t,e)||e==="BT"&&s.length>0&&!ps(t))return;for(const c of o){if(c.isLayoutOnly)continue;const a=c.points;!a||a.length<2||(c.points=ae(Qe(a)))}Ls(o,n),Ts(o,n),ys(o,n);const r=new Map;for(const c of n)r.set(String(c.id),c);Ue(o,r),is(o,r),xs(o,r),jn(o,r),bs(o,r),Ms(o,r),Xn(o,r),Is(o,r);const i=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ue(o,r),Dn(o,r),Xn(o,r),Ue(o,r),Dn(o,r)},"finalizeRenderedEdges");i(),jn(o,r),i(),Yn(o,r),Gn(o,r),Yn(o,r),Gn(o,r)}d(Rs,"postProcessSwimlaneLayout");function ye(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(ye,"normalizeGraph");function mo(t,e){return t.edges.filter(n=>n.dst===e)}d(mo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function yo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(yo,"buildSortedSuccessorMap");function xo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(xo,"buildInDegreeMap");function bo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(bo,"sortedZeroInDegreeNodes");function ln(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(ln,"buildPredecessorSuccessorMaps");function Mo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}d(Mo,"buildLayersFromRanks");function Be(t){const e=xo(t),n=bo(e),o=[],s=yo(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let c=0;for(;c{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),c=o,a=r,l=o;for(;c=s||cx.dst===I.dst?x.id.localeCompare(I.id):x.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const x of n.get(g)??[]){const I=x.dst;o[I]===0?r(I):o[I]===1&&s.push(x)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,x)=>g.localeCompare(x));for(const g of i)o[g]===0&&r(g);const c=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),a=e.edges.map(g=>c.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:a,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const c=n(r)??r;return e.set(o,c),c},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function fe(t){const e=Ps(t);return n=>e.get(n)??null}d(fe,"createTopLaneResolver");function fn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(fn,"buildTopLaneOrder");function So(t,e){const n=fn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(So,"resolveTopLaneOrder");var Jr={EPSILON:1e-6},sn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},ko={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=ln(n);for(const m of r.values())m.sort((S,A)=>S.localeCompare(A));const i=Be(n)??[...n.nodes].sort((m,S)=>m.localeCompare(S)),c=new Map;for(const[m,S]of i.entries())c.set(S,m);const a=new Map,l=new Map;for(const m of n.nodes)l.set(m,[]);for(const m of i){const S=(r.get(m)??[]).filter(A=>a.has(A));if(S.length>0){const A=ks(m,S,{laneOf:o,rankHint:s,topoIndex:c});a.set(m,A),l.get(A).push(m)}else a.has(m)||a.set(m,null)}for(const m of n.nodes)a.has(m)||a.set(m,null);const g=new Set;for(const m of n.nodes)(a.get(m)??null)===null&&g.add(m);const x=[...g].sort((m,S)=>{const A=c.get(m)??0,R=c.get(S)??0;return A===R?m.localeCompare(S):A-R}),I=_s(n),u=new Map;for(const[m,S]of I.entries())u.set(m,[...S].sort((A,R)=>A.localeCompare(R)));const p=Fs(u),f=Ds(u),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of f)for(const S of m.nodes){const A=y.get(S);A?A.push(m.id):y.set(S,[m.id])}const v=[],M=[],E=new Set,T=d(m=>{if(!E.has(m)){E.add(m),v.push(m);for(const S of l.get(m)??[])T(S);M.push(m)}},"walk");for(const m of x)T(m);for(const m of i)T(m);return{parent:a,children:l,roots:x,componentOf:p,blocks:f,nodeBlocks:y,adjacency:u,preorder:v,postorder:M,topologicalOrder:i}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{const c=n.laneOf(r),a=n.laneOf(i),l=c!=null&&c===o,g=a!=null&&a===o;if(l!==g)return l?-1:1;const x=n.rankHint?.[r],I=n.rankHint?.[i];if(x!=null&&I!=null&&x!==I)return I-x;const u=n.topoIndex.get(r)??0,p=n.topoIndex.get(i)??0;return u!==p?u-p:r.localeCompare(i)})[0]}d(ks,"chooseParent");function _s(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(_s,"buildAdjacency");function Fs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Fs,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((c,a)=>{e.set(c,++r),n.set(c,r);for(const l of t.get(c)??[])l!==a&&(e.has(l)?(e.get(l)??0)<(e.get(c)??0)&&(o.push([c,l]),n.set(c,Math.min(n.get(c)??r,e.get(l)??r))):(o.push([c,l]),i(l,c),n.set(c,Math.min(n.get(c)??r,n.get(l)??r)),(n.get(l)??0)>=(e.get(c)??0)&&s.push(Hs(c,l,o,s.length))))},"visit");for(const c of t.keys())e.has(c)||i(c,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[M,E]of o.entries())s.set(E,M);const r=o.length,i=new Array(r).fill(-1),c=new Array(r).fill(0),a=[],l=new Set;for(const M of o){const E=n.parent.get(M)??null,T=s.get(M);T!=null&&E==null&&(i[T]=-1,c[T]=0,l.has(M)||(l.add(M),a.push(M)))}for(;a.length>0;){const M=a.shift(),E=s.get(M);if(E==null)continue;const T=n.children.get(M)??[];for(const m of T){if(l.has(m))continue;const S=s.get(m);S!=null&&(i[S]=E,c[S]=c[E]+1,l.add(m),a.push(m))}}for(const M of o){if(l.has(M))continue;const E=s.get(M);E!=null&&(i[E]=-1,c[E]=0,l.add(M))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),x=Array.from({length:g},()=>new Array(r).fill(-1));for(let M=0;M{if(M===-1||E===-1)return-1;c[M]>m&1&&(M=x[m][M],M===-1))return-1;if(M===E)return M;for(let m=g-1;m>=0;m--){const S=x[m][M],A=x[m][E];S===-1||A===-1||S!==A&&(M=S,E=A)}return x[0][M]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const M of t.edges){let E=M.src,T=M.dst,m=e[E],S=e[T];if(m==null||S==null||(m>S&&([E,T]=[T,E],[m,S]=[S,m]),m==null||S==null||m===S))continue;const A=s.get(E),R=s.get(T);if(A==null||R==null)continue;const k=I(A,R);if(k===-1)continue;const O=u[k];for(let _=m;_{if(E.size!==0)for(const[T,m]of E)M.set(T,(M.get(T)??0)+m)},"mergeInto"),y=new Set,v=d(M=>{const E=s.get(M);y.add(M);const T=E==null?void 0:u[E],m=T?new Map(T):new Map,S=n.children.get(M)??[];for(const A of S){const R=v(A),k=e[M];if(k!=null){let O=p.get(M);O||(O=new Map,p.set(M,O));let _=R.get(k)??0;const H=e[A];H!=null&&H>k&&(_+=1),O.set(A,_)}f(m,R)}return m},"dfs");for(const M of n.roots)y.has(M)||v(M);for(const M of o)y.has(M)||v(M);return p}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const c=[...e.get(r)??[]];c.sort(Co(n));for(const a of c){s(a);const l=o.get(a);l!=null&&(i=Math.min(i,l))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Co(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Co,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const a of e){const l=n[a]??0;l>s&&(s=l)}const r=Array.from({length:s+1},()=>[]),i=new Set,c=d(a=>{if(i.has(a))return;i.add(a);const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a);for(const g of o(a))c(g)},"emit");for(const a of t)c(a);for(const a of e)if(!i.has(a)){const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a),i.add(a)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,c=[],a=[],l=n.get(s);for(const g of r){const x=o.get(g)??i;x>i?c.push({child:g,min:x}):a.push(g)}return c.sort((g,x)=>g.min===x.min?g.child.localeCompare(x.child):g.min-x.min),a.sort((g,x)=>{const I=l?.get(g)??0,u=l?.get(x)??0;if(I!==u)return I-u;const p=o.get(g)??i,f=o.get(x)??i;return p!==f?p-f:g.localeCompare(x)}),[...c.map(g=>g.child),...a]}}d(zs,"createChildOrderer");function rn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const x of t.nodes)s.has(x)||s.set(x,[]);const i=Xs(t,e,o),c=[...r].sort(Co(e)),a=Ys(c,s,e),l=zs(s,e,i,a);let g=Gs(c,t.nodes,e,l);return g=$s(g),g}d(rn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(e),i=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&i.push(r.get(c.dst));return Io(i)}d(Vs,"countCrossingsBetweenAdjacent");function Un(t,e,n){const o=[];for(const r of e){const i=n[r.src],c=n[r.dst];if(i==null||c==null||i===c)continue;let a=r.src,l=r.dst,g=i,x=c;i>c&&(a=r.dst,l=r.src,g=c,x=i);for(let I=g;I(n[I]??0)-(n[x]??0));for(const x of g){const I=n[x]??0;if(I===0)continue;let u=0;for(const v of o.get(x)??[])u=Math.max(u,(n[v]??0)+1);if(u>=I)continue;const p=I;n[x]=u;const f=rn(t,n,s),y=Un(f,t.edges,n);y(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(f=>f.src===s);if(i.length===0)continue;let c=!1,a=0;for(const f of i){const y=n(f.dst);y==null||y===r?c=!0:a++}if(a===0||c)continue;let l=0,g=!1;for(const f of t.edges){if(f.dst!==s)continue;const y=n(f.src);y&&(y===r?g=!0:l++)}if(l>0||!g)continue;const x=e[s]??0,I=x+a;let u=0;for(const f of t.edges)f.dst===s&&(u=Math.max(u,(e[f.src]??0)+1));const p=Math.max(x,u,I);p!==x&&(e[s]=p)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=ye(t),o=Be(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n);let i=Object.create(null);for(const a of o){const l=mo(n,a),g=e?.ignoreCrossLaneEdges?l.filter(x=>{const I=r(x.src),u=r(a);return!I||!u?!0:I===u}):l;if(g.length===0)i[a]=0;else if(s&&g.length===1){const x=g[0].src,I=r(x),u=r(a);I!==u?i[a]=i[x]??0:i[a]=(i[x]??0)+1}else{let x=-1/0;for(const I of g)x=Math.max(x,(i[I.src]??0)+1);i[a]=x===-1/0?0:x}}return(e?.optimizeRanksByCrossings??!1)&&(i=js(n,i)),e?.ignoreCrossLaneEdges&&Us(n,i),{layers:rn(n,i,r),rankOf:i,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=ye(t),s={...Ws(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:c}=ln(n,p=>{if(e?.ignoreCrossLaneEdges){const f=r(p.src),y=r(p.dst);if(f&&y&&f!==y)return!1}return!0}),a=Be(n)??[...n.nodes],l=[...a].reverse(),g=d((p,f)=>{let y=0;for(const E of i.get(p)??[])y=Math.max(y,(s[E]??0)+1);let v=Number.POSITIVE_INFINITY;const M=c.get(p)??[];return M.length>0&&(v=Math.min(...M.map(E=>(s[E]??0)-1))),Number.isFinite(v)||(v=Math.max(y,f)),Math.min(Math.max(f,y),v)},"clampFeasible"),x=sn.GRAVITY_ITERATIONS,I=d(p=>{let f=!1;for(const y of p){const v=i.get(y)??[],M=c.get(y)??[];if(v.length===0&&M.length===0)continue;const E=v.length>0?v.reduce((A,R)=>A+(s[R]??0)+1,0)/v.length:s[y]??0,T=M.length>0?M.reduce((A,R)=>A+(s[R]??0)-1,0)/M.length:s[y]??0,m=Math.round((E+T)/2),S=g(y,m);S!==s[y]&&(s[y]=S,f=!0)}return f},"relaxOrder");for(let p=0;p0){const y=Math.min(...f.map(v=>(s[v]??0)-1));(s[p]??0)>y&&(s[p]=y)}}return{layers:Mo(n,a,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=xo(t),n=yo(t);let o=bo(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const c of n.get(i)??[])e.set(c,(e.get(c)??0)-1),(e.get(c)??0)===0&&r.push(c)}o=r.sort((i,c)=>i.localeCompare(c))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=ye(t),o=e?.direction==="LR"?qs(n)??[...n.nodes].sort():Be(n)??[...n.nodes].sort(),s=fe(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),c=new Map,a=d((g,x)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(x)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const I=mo(n,g);let u=0;if(I.length>0)for(const v of I){const M=v.src,E=i[M]??0;u=Math.max(u,E+a(M,g))}const p=r(g),f=c.get(p)??0,y=Math.max(u,f);i[g]=y,c.set(p,y+1)}return{layers:Mo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=ye(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const c=new Map(n.nodeById),a=d(u=>{const p=`placeholder-${i++}`,f={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(p,f),r.add(p);s.length<=u;)s.push([]);return s[u].push(p),o[p]=u,p},"addDummyAt"),l=[...n.edges].sort((u,p)=>u.id===p.id?u.src===p.src?u.dst.localeCompare(p.dst):u.src.localeCompare(p.src):u.id.localeCompare(p.id)),g=[];for(const u of l){const p=o[u.src]??0,f=o[u.dst]??0;if(f-p<=1){g.push(u);continue}let y=u.src;for(let M=p+1,E=0;M!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:c};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function Wn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Wn,"median");function Kn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Kn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function qn(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(t),i=Ne(e),c=[];for(const l of n)o.has(l.src)&&s.has(l.dst)&&c.push({u:r.get(l.src),v:i.get(l.dst)});c.sort((l,g)=>l.u===g.u?l.v-g.v:l.u-g.u);const a=c.map(l=>l.v);return Io(a)}d(qn,"countCrossingsBetweenAdjacent");function We(t,e,n){return[...t].sort((o,s)=>{const r=Wn(e.get(o)??[]),i=Wn(e.get(s)??[]);return r===i?tr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(We,"sortByHeuristic");function Jn(t,e,n,o,s,r){const i=Ne(t),c=Ne(e),a=Qs(e,i,n,o);if(!s||!r||r.length===0)return We(e,a,c);const l=new Map;for(const I of e){const u=s(I),p=l.get(u)??[];p.push(I),l.set(u,p)}const g=[];for(const I of r){const u=l.get(I);if(!u||u.length===0)continue;const p=We(u,a,c);g.push(...p)}const x=l.get(null);if(x&&x.length>0){const I=We(x,a,c);for(const u of I){const p=Kn(a.get(u)??[]);let f=g.length;if(isFinite(p))for(const[y,v]of g.entries()){const M=Kn(a.get(v)??[]);if(pi.has(f.src)&&c.has(f.dst)),g=a?n.filter(f=>c.has(f.src)&&a.has(f.dst)):void 0,x=d(f=>{let y=qn(t,f,l);return g&&o&&(y+=qn(f,o,g)),y},"crossingScore"),I=s?new Map:null;if(s&&I)for(const f of e)I.set(f,s(f));let u=!0,p=x(r);for(;u;){u=!1;for(let f=0;f+1[...c]),s=e.edges,r=fe(e),i=So(e,n?.laneOrder);for(let c=0;c<3;c++){for(let a=1;a=0;a--)o[a]=Jn(o[a+1],o[a],s,"up",r,i),o[a]=Zn(o[a+1],o[a],s,o[a-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=n?.layerGap??ko.DEFAULT_LAYER_GAP,s=n?.nodeGap??ko.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",c=i==="LR"||i==="RL",a=t.layers,l=Object.create(null),g=Object.create(null),x=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>x(O)?.width??0,"getWidth"),u=d(O=>x(O)?.height??0,"getHeight"),p=fe(e),f=So(e,n?.laneOrder),y=a.map(O=>O.reduce((_,H)=>Math.max(_,u(H)),0)),v=[];if(c)for(let O=0;O+1Math.max(mt,I(kt)),0),H=a[O+1].reduce((mt,kt)=>Math.max(mt,I(kt)),0),P=y[O],G=y[O+1],j=P/2+G/2,J=(_+H)/2,dt=Math.max(0,J-j-o);v.push(dt)}const M=new Set;for(const O of a)for(const _ of O)M.add(p(_));const E=M.has(null),T=f.filter(O=>M.has(O)),m=[...E?[null]:[],...T],S=Object.create(null);for(const O of T)S[O]=0;E&&(S.null=0);for(const O of a){const _=Object.create(null),H=[];for(const P of O){const G=p(P);G===null?H.push(P):(_[G]||=[]).push(P)}for(const[P,G]of Object.entries(_)){const j=G.reduce((J,dt)=>J+I(dt),0)+s*Math.max(0,G.length-1);S[P]=Math.max(S[P]??0,j)}if(E&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);S.null=Math.max(S.null??0,P)}}const A=new Map;{const O=m.map(P=>(P===null?S.null:S[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,m.length-1))/2;for(let P=0;PI(Q)),kt=mt.reduce((Q,W)=>Q+W,0)+s*(J.length-1);let Pt=dt-kt/2;for(const[Q,W]of J.entries()){const et=mt[Q];l[W]=Pt+et/2,g[W]=R+H/2,Pt+=et+s}}}const G=v[O]??0;R+=H+o+G}const k=new Map;for(const O of e.edges){const _=O.ref.id;k.has(_)||k.set(_,[]),k.get(_).push(O)}for(const[,O]of k){if(O.length===0)continue;const _=O[0].ref,H=_.start,P=_.end;if(H==null||P==null)continue;const G=Math.round(((l[H]??0)+(l[P]??0))/2),j=new Set;for(const J of O)j.add(J.src),j.add(J.dst);for(const J of j){if(J===H||J===P)continue;e.nodeById.get(J)?.isDummy&&(l[J]=G)}}return{x:l,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function Qn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const c=n.get(s),a=n.get(r);c==null||a==null||(o+=i*Math.abs(c-a))}return o}d(Qn,"laneArrangementCost");function ar(t){const e=fn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=fe(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,c=typeof r.end=="string"?r.end:void 0;if(!i||!c||!t.nodeById.has(i)||!t.nodeById.has(c))continue;const a=o(i),l=o(c);if(!a||!l||a===l)continue;const g=n.get(a),x=n.get(l);if(g==null||x==null)continue;const[I,u]=g<=x?[a,l]:[l,a],p=`${I}\0${u}`,f=s.get(p);f?f.weight++:s.set(p,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function to(t,e,n){const o=[...t];let s=Qn(o,e),r=!0,i=0;const c=Math.max(1,o.length);for(;r&&is.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=fn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((c,a)=>[c,a]));let r=to(n,o,s);const i=Math.max(0,e.restarts??or);for(let c=0;cct&&a*3>=c?i>0?"bottom":"top":c>ct?r>0?"right":"left":n}d(eo,"chooseOrthogonalSide");function no(t,e){return Math.abs(t.to-e.from)h.isGroup&&!h.parentId);for(const h of l){const b={id:h.id},C=d(L=>{i.set(L.id,b),n.filter(w=>w.parentId===L.id).forEach(C)},"assignLane");C(h)}const g=n.filter(h=>!h.isGroup&&!h.isEdgeLabel).map(h=>{const b=h.width??10,C=h.height??10,L=h.x??0,w=h.y??0,B=Zr;return{nodeId:h.id,minX:L-b/2-B,maxX:L+b/2+B,minY:w-C/2-B,maxY:w+C/2+B,visualXHalfExtent:a?C/2+B:b/2+B}}),x=d((h,b,C,L)=>{let w=c.find(B=>B.orientation===h&&Math.abs(B.coord-b)<1);return w||(w={id:`pipe-${h}-${b.toFixed(0)}`,orientation:h,coord:b,spanMin:C,spanMax:L,tracks:[]},c.push(w)),w.spanMin=Math.min(w.spanMin,C),w.spanMax=Math.max(w.spanMax,L),w},"getOrAddPipe"),I=d((h,b)=>{const C=h.width??10,L=h.height??10,w=h.x??0,B=h.y??0;switch(b){case"top":return{x:w,y:B-L/2};case"bottom":return{x:w,y:B+L/2};case"left":return{x:w-C/2,y:B};case"right":return{x:w+C/2,y:B}}},"portForSide"),u=d((h,b,C)=>I(h,eo(h,b,C?"bottom":"top")),"getOrthogonalPort"),p=[],f=[],y=new Set,v=1e3,M=d((h,b,C)=>{if(p.length===0)return 0;const L=Math.abs(b.y-C.y)z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}else if(w){const U=b.x,q=Math.min(b.y,C.y)-ct,z=Math.max(b.y,C.y)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===h||Y.orientation!=="horizontal"||Y.pipe.coordz||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}return B},"crossingPenalty"),E=s.map((h,b)=>{if(!h.start||!h.end)return{idx:b,crossLane:0,dx:0,dy:0};const C=r.get(h.start),L=r.get(h.end),w=i.get(h.start),B=i.get(h.end),U=w&&B&&w.id!==B.id?1:0,q=C&&L?Math.abs((L.x??0)-(C.x??0)):0,z=C&&L?Math.abs((L.y??0)-(C.y??0)):0;return{idx:b,crossLane:U,dx:q,dy:z}}).sort((h,b)=>{if(h.crossLane!==b.crossLane)return b.crossLane-h.crossLane;const C=h.dx+h.dy,L=b.dx+b.dy;return Math.abs(C-L)>1?C-L:h.idx-b.idx}).map(h=>h.idx),T=d((h,b,C,L)=>{const w=Math.min(h.x,b.x),B=Math.max(h.x,b.x),U=Math.min(h.y,b.y),q=Math.max(h.y,b.y);return!!g.find(Y=>C&&Y.nodeId===C||L&&Y.nodeId===L?!1:Math.abs(h.x-b.x)>ct?Y.minYh.y&&Y.maxX>w&&Y.minXh.x&&Y.maxY>U&&Y.minYeo(h,b,"bottom"),"determineSide"),R=new Map;for(const[h,b]of s.entries()){if(!b.start||!b.end||b.start===b.end||b.points&&b.points.length>0)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const w=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);R.set(h,{edgeIdx:h,srcId:b.start,dstId:b.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(w),absDy:Math.abs(B),dxSign:Math.sign(w),dySign:Math.sign(B)})}const k=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.absDx===0?1/0:h.absDy/h.absDx:h.absDy===0?1/0:h.absDx/h.absDy,"preferenceStrength"),O=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.dxSign>=0?"right":"left":h.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const h of R.values()){const b=`${h.srcId}:${h.srcSide}`;_.has(b)||_.set(b,[]),_.get(b).push(h)}const H=new Map,P=d((h,b)=>`${h}:${b}`,"loadKey");for(const h of R.values())H.set(P(h.srcId,h.srcSide),(H.get(P(h.srcId,h.srcSide))??0)+1),H.set(P(h.dstId,h.dstSide),(H.get(P(h.dstId,h.dstSide))??0)+1);for(const h of _.values())if(!(h.length<2)){h.sort((b,C)=>{const L=k(b),w=k(C);return Math.abs(L-w)>1e-9?w-L:b.edgeIdx-C.edgeIdx});for(let b=1;b=w||(H.set(P(C.srcId,C.srcSide),w-1),H.set(P(C.srcId,L),B+1),C.srcSide=L)}}const G=d(h=>{const b=h?.shape;return b==="question"||b==="diamond"},"isDiamondNode"),j=new Map;for(const h of R.values())j.has(h.dstId)||j.set(h.dstId,new Set),j.get(h.dstId).add(h.dstSide);for(const h of R.values()){if(!G(r.get(h.srcId)))continue;const b=j.get(h.srcId);if(!b?.has(h.srcSide))continue;const C=O(h);if(b.has(C)||(H.get(P(h.srcId,C))??0)>0)continue;const L=H.get(P(h.srcId,h.srcSide))??0;H.set(P(h.srcId,h.srcSide),Math.max(0,L-1)),H.set(P(h.srcId,C),1),h.srcSide=C}for(const h of R.values()){const{edgeIdx:b,srcId:C,dstId:L,srcSide:w,dstSide:B}=h,U=r.get(C),q=r.get(L),z=`${C}:${w}:src`,Y=w==="top"||w==="bottom"?q.x??0:q.y??0;m.has(z)||m.set(z,[]),m.get(z).push({edgeIdx:b,oppositeCoord:Y});const ot=`${L}:${B}:dst`,rt=B==="top"||B==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:b,oppositeCoord:rt})}const J=new Map,dt=8;for(const[h,b]of m){if(b.length<2)continue;b.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);const C=h.split(":"),L=C.slice(0,-2).join(":"),w=C[C.length-2],B=C[C.length-1],U=r.get(L);if(!U)continue;const z=w==="left"||w==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?z*.3:z,tt=Math.min(20,Math.max(dt,rt/(b.length+1))),Rt=-(tt*(b.length-1))/2;for(const[Lt,Dt]of b.entries()){const Jt=Rt+Lt*tt,gn=`${Dt.edgeIdx}:${B}`;J.set(gn,Jt)}}const mt=d(h=>!!s[h]?.labelNodeId,"edgeHasLabelNode"),kt=d((h,b)=>h?(m.get(`${h}:${b}:src`)??[]).some(({edgeIdx:C})=>mt(C))||(m.get(`${h}:${b}:dst`)??[]).some(({edgeIdx:C})=>mt(C)):!1,"faceHasLabelNode"),Pt=d((h,b,C)=>b==="top"||b==="bottom"?{x:h.x+C,y:h.y}:{x:h.x,y:h.y+C},"applyPortOffset"),Q=d((h,b,C)=>{const L=R.get(h),w={x:C.x??0,y:C.y??0},B={x:b.x??0,y:b.y??0},U=L?.srcSide??A(b,w),q=L?.dstSide??A(C,B);let z=L?I(b,L.srcSide):u(b,w,!0),Y=L?I(C,L.dstSide):u(C,B,!1);const ot=J.get(`${h}:src`),rt=J.get(`${h}:dst`);return ot!==void 0&&(z=Pt(z,U,ot)),rt!==void 0&&(Y=Pt(Y,q,rt)),{pSrcPort:z,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const h of E){const b=s[h];if(f[h]=[],!b.start||!b.end||b.points&&b.points.length>0||b.start===b.end)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const{pSrcPort:w,pDstPort:B,srcSide:U,dstSide:q}=Q(h,C,L),z={...w},Y={...B},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=w.y>(C.y??0);z.y=X?w.y+ne:w.y-ne}else{const X=w.x>(C.x??0);z.x=X?w.x+ne:w.x-ne}if(rt){const X=B.y>(L.y??0);Y.y=X?B.y+ne:B.y-ne}else{const X=B.x>(L.x??0);Y.x=X?B.x+ne:B.x-ne}const st=d((X,$)=>{for(const K of g)if(!$.includes(K.nodeId)&&X.x>K.minX&&X.xK.minY&&X.y{if(Ct){const Nt=X.y>($.y??0);return{x:(K.x??0)>=X.x?lt.maxX+be:lt.minX-be,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>($.x??0),Et=(K.y??0)>=X.y;return{x:bt?lt.maxX+be:lt.minX-be,y:Et?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[b.start,b.end],Lt=st(z,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const $=tt(w,C,L,X,!0);z.x=$.x,z.y=$.y;const K=$.leavesPositiveSide?Math.min(X.minY-2,w.y+ne):Math.max(X.maxY+2,w.y-ne);yt=[{x:w.x,y:K},{x:$.x,y:K},{x:$.x,y:$.y}]}else{const $=tt(w,C,L,X,!1),K=$.leavesPositiveSide?Math.min(X.minX-2,w.x+ne):Math.max(X.maxX+2,w.x-ne);z.x=$.x,z.y=$.y,yt=[{x:K,y:w.y},{x:K,y:$.y},{x:$.x,y:$.y}]}}let Dt=[];const Jt=st(Y,Rt);if(Jt.inside&&Jt.obstacle){const X=Jt.obstacle;if(rt){const $=tt(B,L,C,X,!0);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:B.x,y:$.y}]}else{const $=tt(B,L,C,X,!1);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:$.x,y:B.y}]}}if(yt.length===0&&Dt.length===0){const X=be,$=Math.abs(z.x-Y.x)1||bt>1,Nt=S.get(b.start??"")??0,ut=S.get(b.end??"")??0,Yt=Ct>1&&kt(b.start,U)||bt>1&&kt(b.end,q),ee=Ct<=1||Nt<=2,Bt=bt<=1||ut<=2;if(($||K)&&!lt&&(!Et||Et&&!Yt&&ee&&Bt)&&!T(w,B,b.start,b.end)){b.points=[{...w},{...z},{...Y},{...B}],y.add(h);const Mt=K?"horizontal":"vertical",$t=K?w.y:w.x,It=K?Math.min(w.x,B.x):Math.min(w.y,B.y),St=K?Math.max(w.x,B.x):Math.max(w.y,B.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${h}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};p.push({edgeIndex:h,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}const gn=x("vertical",z.x,z.y,z.y);z.x=gn.coord;const mr=x("vertical",Y.x,Y.y,Y.y);Y.x=mr.coord;let ue=Math.min(z.x,Y.x)-50,he=Math.max(z.x,Y.x)+50,ve=Math.min(z.y,Y.y)-50,Le=Math.max(z.y,Y.y)+50;for(const X of g){const $=Math.min(z.x,Y.x),K=Math.max(z.x,Y.x),lt=Math.min(z.y,Y.y),Ct=Math.max(z.y,Y.y);X.minX$&&X.minYlt&&(ue=Math.min(ue,X.minX-je),he=Math.max(he,X.maxX+je),ve=Math.min(ve,X.minY-je),Le=Math.max(Le,X.maxY+je))}for(const X of g){if(X.maxXhe||X.maxYLe)continue;const $=be;x("horizontal",X.minY-$,ue,he),x("horizontal",X.maxY+$,ue,he);const K=Te;x("vertical",X.minX-K,ve,Le),x("vertical",X.maxX+K,ve,Le)}x("horizontal",z.y,ue,he),x("horizontal",Y.y,ue,he);const yr=c.filter(X=>X.orientation==="horizontal"&&X.coord>=ve&&X.coord<=Le),xr=c.filter(X=>X.orientation==="vertical"&&X.coord>=ue&&X.coord<=he),ke=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),_e=ke(z.x,z.y),vo=ke(Y.x,Y.y),Fe=new Map,pn=new Map,mn=new Map,De=new Set,xe=[];Fe.set(_e,0),mn.set(_e,"n"),xe.push({key:_e,f:Math.hypot(Y.x-z.x,Y.y-z.y),pt:z}),De.add(_e);let Ht=[];const ge=d((X,$)=>T(X,$,b.start,b.end),"checkSegmentBlocked"),yn={x:Y.x,y:z.y},br=ge(z,yn),Mr=ge(yn,Y),Ir=br||Mr,xn={x:z.x,y:Y.y},Sr=ge(z,xn),Cr=ge(xn,Y);if(Ir?Sr||Cr||(Math.abs(z.x-Y.x)0;){xe.sort((ut,Yt)=>ut.f-Yt.f);const X=xe.shift();if(De.delete(X.key),X.key===vo){let ut=vo,Yt=Y;for(Ht=[Yt];pn.has(ut);){const ee=pn.get(ut);Ht.unshift(ee),Yt=ee,ut=ke(ee.x,ee.y)}break}const $=X.pt.x,K=X.pt.y,lt=xr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-$)<1),bt=yr.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct0&&Nt.push({x:$,y:bt[Et-1].coord}),Et>=0&&EtZt.nodeId===b.start||Zt.nodeId===b.end?!1:Yt!==ee?Zt.minYK&&Zt.maxX>Yt&&Zt.minX$&&Zt.maxY>Bt&&Zt.minY10&&bn<-5||Ee<-10&&bn>5)&&(St=Math.abs(bn)*100),(Wt>10&&He<-5||Wt<-10&&He>5)&&(St+=Math.abs(He)*50);let Lo=0;const Eo=mn.get(X.key)??"n",To=Math.abs(He)>ct?"h":"v";Eo!=="n"&&Eo!==To&&(Lo=50);const vr=$t+It+St+Lo,Xe=(Fe.get(X.key)??1/0)+vr,wo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(Xe<(Fe.get(Mt)??1/0))if(pn.set(Mt,X.pt),Fe.set(Mt,Xe),mn.set(Mt,To),!De.has(Mt))xe.push({key:Mt,f:Xe+wo,pt:ut}),De.add(Mt);else{const Zt=xe.findIndex(Lr=>Lr.key===Mt);Zt!==-1&&(xe[Zt].f=Xe+wo)}}}if(Ht.length===0&&(Ht=[z,{x:z.x,y:Y.y},Y]),Ht.length>4){const X=Ht[0],$=Ht[Ht.length-1];let K=Math.min(X.x,$.x),lt=Math.max(X.x,$.x),Ct=Math.min(X.y,$.y),bt=Math.max(X.y,$.y);for(const Bt of Ht)K=Math.min(K,Bt.x),lt=Math.max(lt,Bt.x),Ct=Math.min(Ct,Bt.y),bt=Math.max(bt,Bt.y);const Et=lt>Math.max(X.x,$.x),Nt=KIt.minXGt&&It.minYOt);if($t.length>0){let It=Math.max(X.x,$.x);for(const St of $t){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Ee=Wt+St.visualXHalfExtent+Bt;It=Math.max(It,Ee)}isNaN(It)||(lt=It)}}if(Nt){const Gt=g.filter(Ot=>Ot.minXMath.min(X.y,$.y));if(Gt.length>0){let Ot=Math.min(X.x,$.x);for(const Mt of Gt){const It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Bt;Ot=Math.min(Ot,It)}K=Ot}}}const ut=d(Bt=>{const Gt=$.y>X.y,Ot=g.filter(It=>{const St=Math.min(X.x,$.x)It.minX,Wt=Math.min(X.y,$.y)It.minY;return St&&Wt});let Mt=Ot;if(a&&Ot.length>0){const It=Ot.filter(St=>St.minXBt);It.length>0&&(Mt=It)}if(Mt.length===0)return $.y;const $t=be;if(Gt){const St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<$.y-ct)return St}else{const St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>$.y+ct)return St}return $.y},"findBestReturnY"),Yt=d(Bt=>{const Gt=ut(Bt),Ot={x:Bt,y:X.y},Mt={x:Bt,y:Gt},$t={x:$.x,y:Gt},It=ge(X,Ot),St=ge(Ot,Mt),Wt=ge(Mt,$t),Ee=Gt!==$.y?ge($t,$):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-$.y)=3){const X=Xt[Xt.length-1],$=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-$.y)Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign($.y-K.y),Et=Math.sign(X.y-K.y);bt!==0&&bt===Et&&Math.abs($.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const ie=[Xt[0]];for(let X=1;X$.x,bt=lt.x>K.x;if(Ct!==bt){ie.push(K);continue}continue}if(Math.abs($.x-K.x)$.y,bt=lt.y>K.y;if(Ct!==bt){ie.push(K);continue}continue}ie.push(K)}ie.push(Xt[Xt.length-1]);for(let X=0;Xh.from{const w=!L.segments.some(U=>(U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex)&&W(U,h)),B=!C.segments.some(U=>(U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex)&&W(U,b));return w&&B?(h.trackIndex=L.index,b.trackIndex=C.index,C.segments=[...C.segments.filter(U=>U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex),{edgeIndex:b.edgeIndex,segmentIndex:b.segmentIndex,from:b.from,to:b.to}],L.segments=[...L.segments.filter(U=>U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex),{edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=d(h=>{const b=h.tracks.length;return h.tracks[b]={index:b,coord:h.coord,segments:[]},b},"createNewTrack"),gt=d((h,b)=>{const C=h.pipe.tracks[h.trackIndex];C.segments=C.segments.filter(w=>w.edgeIndex!==h.edgeIndex||w.segmentIndex!==h.segmentIndex),h.trackIndex=b,h.pipe.tracks[b].segments.push({edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to})},"moveSegmentToTrack"),xt=d((h,b)=>{const C=f[h.edgeIndex];for(const L of C){const w=p[L];w.pipe===h.pipe&>(w,b)}},"moveSegmentChainToTrack"),vt=d(h=>{const b=f[h.edgeIndex],C=b.indexOf(p.indexOf(h)),L=[];return C>0&&L.push(p[b[C-1]]),C{if(h.orientation===b.orientation)return!1;const C=h.orientation==="horizontal"?h:b,L=h.orientation==="horizontal"?b:h;return L.pipe.coord>C.from&&L.pipe.coordL.from&&C.pipe.coord{for(const C of h.tracks)if(!C.segments.some(w=>(w.edgeIndex!==b.edgeIndex||w.segmentIndex!==b.segmentIndex)&&W(w,b)))return C.index;return-1},"findAvailableTrack"),Ut=d((h,b)=>{if(h.trackIndex===b.trackIndex)return W(h,b);const C=vt(h),L=vt(b);return C.some(w=>L.some(B=>Vt(w,B)))},"segmentsConflict"),te=d((h,b,C)=>{if(et(h,b,h.pipe.tracks[h.trackIndex],b.pipe.tracks[b.trackIndex]))return;const L=jt(h.pipe,b);C(b,L!==-1?L:at(h.pipe))},"resolveTrackConflict"),Se=d(h=>{let b=0;for(let C=0;C{if(de.has(h))return de.get(h);const b=f[h];if(b.length===0){const q={dest:0,deviation:0,base:0,delta:0};return de.set(h,q),q}const L=p[b[0]].pipe.coord;let w=L;for(let q=1;qMath.abs(ot-L)?Y:ot;break}}const B=Math.abs(w-L),U={dest:w,deviation:B,base:L,delta:w-L};return de.set(h,U),U},"getDestInfo"),dn=d(()=>{let h=0;const b=new Map;for(const[L,w]of s.entries())f[L].length!==0&&w.start&&(b.has(w.start)||b.set(w.start,[]),b.get(w.start).push(L));const C=d(L=>{const w=s[L];if(!w.start||!w.end)return 0;const B=r.get(w.start),U=r.get(w.end);if(!B||!U)return 0;const q=(U.x??0)-(B.x??0),z=(U.y??0)-(B.y??0);return Math.abs(q)+Math.abs(z)},"getEdgeDistance");for(const L of b.values()){L.sort((B,U)=>{const q=Ce(B),z=Ce(U);if(Math.abs(q.deviation-z.deviation)>1)return q.deviation-z.deviation;if(Math.abs(q.dest-z.dest)>1)return q.dest-z.dest;const Y=C(B),ot=C(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=f[B].length,st=f[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=f[B][0],yt=f[U][0];if(p[tt]&&p[yt]){const Rt=p[tt],Lt=p[yt],Dt=Math.abs(Rt.to-Rt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});const w=L.map(B=>p[f[B][0]]);h+=Se(w)}return h},"fixSourceHandleCrossings"),un=d(()=>{let h=0;const b=new Map;for(const[C,L]of s.entries())f[C].length!==0&&L.end&&(b.has(L.end)||b.set(L.end,[]),b.get(L.end).push(C));for(const C of b.values()){C.sort((w,B)=>{const U=d(Y=>{const ot=f[Y];if(ot.length<2)return 0;const rt=p[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(w),z=U(B);return Math.abs(q-z)>.1?q-z:w-B});const L=C.map(w=>p[f[w][f[w].length-1]]);h+=Se(L)}return h},"fixTargetHandleCrossings"),hn=d(()=>{let h=0;for(const b of c){const C=[];for(const L of b.tracks)for(const w of L.segments){const B=f[w.edgeIndex].find(U=>p[U].segmentIndex===w.segmentIndex);B!==void 0&&C.push(p[B])}C.sort((L,w)=>L.edgeIndex-w.edgeIndex||L.segmentIndex-w.segmentIndex);for(let L=0;L{L.segments.forEach(w=>{b.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:L.index,from:w.from,to:w.to})})}),b.sort((L,w)=>L.from-w.from);const C=[];if(b.length>0){let L=[b[0]],w=b[0].to;for(let B=1;Bw.add(tt.trackIndex));const B=new Map;L.forEach(tt=>{const yt=Ce(tt.edgeIndex);B.set(tt.trackIndex,(B.get(tt.trackIndex)??0)+yt.delta)});const U=[...w].filter(tt=>(B.get(tt)??0)<-1),q=[...w].filter(tt=>(B.get(tt)??0)>1),z=[...w].filter(tt=>Math.abs(B.get(tt)??0)<=1);U.sort((tt,yt)=>(B.get(yt)??0)-(B.get(tt)??0)),q.sort((tt,yt)=>(B.get(tt)??0)-(B.get(yt)??0));const Y=d((tt,yt)=>{L.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?h.coord:yt;D.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,h.coord-ot*Cn);if(z.length===0&&w.size>0){const tt=[...w].sort((Lt,Dt)=>Math.abs(B.get(Lt)??0)-Math.abs(B.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),z.push(tt)}let rt=0;for(const tt of z){if(rt===0)Y(tt,h.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,h.coord+yt*Rt*Cn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,h.coord+st*Cn)}}for(const[h,b]of s.entries()){const C=f[h]??[];if(C.length===0)continue;const L=[],w=r.get(b.start),B=r.get(b.end),{pSrcPort:U,pDstPort:q}=Q(h,w,B),z=C.map(rt=>{const st=p[rt],tt=D.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});L.push(U);for(let rt=0;rtct&&L.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Jt=st.orient==="vertical"?(yt+Lt.from)/2:no(st,Lt);L.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===z.length-2)&&L.push(Me(st,no(st,Lt)));else if(Dt)L.push(Me(st,Lt.coord));else{const Jt=Math.abs(st.from-yt)ct||Math.abs(Y.y-q.y)>ct)&&L.push(q);const ot=[];L.length>0&&ot.push(L[0]);for(let rt=1;rtct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}b.points=ot}for(const h of s){const b=h.__originalEdge;b&&h.points&&(b.points=h.points)}t.edges=(t.edges??[]).filter(h=>!h.isLayoutOnly);const V=d((h,b)=>{const C=b.x??0,L=b.y??0,w=b.width??0,B=b.height??0;if(w<=0||B<=0)return h;const U=C-w/2,q=C+w/2,z=L-B/2,Y=L+B/2;if(h.xq||h.yY)return h;const ot=h.x-U,rt=q-h.x,st=h.y-z,tt=Y-h.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:h.y}:yt===rt?{x:q,y:h.y}:yt===st?{x:h.x,y:z}:{x:h.x,y:Y}},"nodeBoundaryClamp");for(const h of t.edges){const b=h.points;if(!b||b.length<2)continue;const C=h.start,L=h.end,w=C?r.get(C):void 0,B=L?r.get(L):void 0;w&&(b[0]=V(b[0],w)),B&&(b[b.length-1]=V(b[b.length-1],B))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function pr(t){const e=Jo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,c=gr(t),{ordered:a,coordinates:l}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:c});Zo(e,a,l,{nodeGap:n,layerGap:o});for(const g of t.edges??[])delete g.points;hr(t,c);for(const g of t.edges??[])(!g.curve||g.curve==="basis")&&(g.curve="rounded");return Rs(t,c),As(t),c}d(pr,"runSwimlaneLayoutCore");async function Qr(t,e){const n=e.select("g");wr(n,t.markers,t.type,t.diagramId),Ar(),Rr(),Nr(),Tr(),qo(t);const o=Qo(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await _o(n,t);pr(t),await Uo(t,s)}d(Qr,"render");export{Qr as render}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js","assets/mermaid.core-CJB1tAev.js","assets/index-D-7nOosq.js","assets/index-DGHD7Bg9.css","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); +import{bR as Er}from"./index-D-7nOosq.js";import{c as Tr}from"./chunk-RYQCIY6F-Df2V79id.js";import{am as wr,an as Ar,ao as Rr,ap as Nr,l as Ke,c as Or,ag as Pr,af as Br,ah as kr,at as _r,av as Fr,z as Dr,as as Hr,aw as Xr,y as Oe,ax as Ye,_ as d,ay as Ao}from"./mermaid.core-CJB1tAev.js";import{G as Yr}from"./graph-DOmOIIwC.js";import"./map-DxJ2ADlA.js";import"./_commonjsHelpers-CqkleIqs.js";async function _o(t,e){const n=new Yr({multigraph:!0,compound:!0}),o=[...e.edges],s=Or(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),c=r.insert("g").attr("class","edges edgePath"),a=r.insert("g").attr("class","edgeLabels"),l=r.insert("g").attr("class","nodes"),g=new Map,x=t.node()!=null;await Promise.all(e.nodes.map(async I=>{if(I.isGroup)n.setNode(I.id,{...I});else{if(x){const u=await Pr(l,I,{config:s,dir:I.dir}),p=u.node()?.getBBox()??{width:0,height:0};g.set(I.id,u),I.width=p.width,I.height=p.height}n.setNode(I.id,{...I})}}));for(const I of o)n.setEdge(I.start,I.end,{...I},I.id),e.edges.some(p=>p.id===I.id)||e.edges.push(I);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:I}=await Er(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-D5GqjpM0.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3,4]));I(t,e)}return{graph:n,groups:{clusters:i,edgePaths:c,edgeLabels:a,nodes:l,rootGroups:r},nodeElements:g}}d(_o,"createGraphWithElements");var Ro=5,Ge=1e-5,$e=1e-6;function qe(t){const e=[];for(let n=0;n=1-$e||I<=$e||I>=1-$e?null:{point:{x:t.x+x*s,y:t.y+x*r},tA:x,tB:I}}d(Fo,"segmentIntersection");function vn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(vn,"isHorizontalSeg");function Do(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Ho,"getArcSweepFlag");var Gr=.001;function Xo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Ao[e.arrowTypeStart];if(o){const r=t[0],i=t[1],c=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(c),n[0].y=r.y+o*Math.sin(c)}const s=e.arrowTypeEnd&&Ao[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],c=t[r-1],a=Math.atan2(c.y-i.y,c.x-i.x);n[r-1].x=c.x-s*Math.cos(a),n[r-1].y=c.y-s*Math.sin(a)}return n}d(Xo,"applyMarkerOffsets");function Yo(t,e,n,o,s){const r=t.point.x,i=t.point.y,c={x:r-e*t.r,y:i-n*t.r},a={x:r+e*t.r,y:i+n*t.r},l=[`L${we(c)}`];return s==="arc"?l.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${we(a)}`):l.push(`M${we(a)}`),l}d(Yo,"emitJump");function Ln(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,c=n.y-e.y,a=Math.hypot(s,r),l=Math.hypot(i,c);if(a0){const E=Ln(s[l-1],s[l],s[l+1]??s[l],Ro);E&&(f=E.cutLen)}let y=x,v=null;r&&lE.t-T.t);for(const E of M)E.r=Math.min(E.r,E.d-f,y-E.d);for(let E=0;ET){const m=T/2;M[E].r=Math.min(M[E].r,m),M[E+1].r=Math.min(M[E+1].r,m)}}for(const E of M)E.r=2?o:null}catch{return null}}d(Vo,"decodeDataPoints");function jo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const l of e)s.set(l.id,l);const r=[],i=new Map;for(const l of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(l.id):l.id,x=o.querySelector(`path[data-id="${g}"]`);if(!x)continue;i.set(l.id,x);const u=Vo(x.getAttribute("data-points"))??l.points;r.push({...l,points:u})}const c=Do(r);if(c.length===0)return;const a=new Map;for(const l of c){const g=a.get(l.jumpEdgeId)??[];g.push(l),a.set(l.jumpEdgeId,g)}for(const l of r){const g=a.get(l.id);if(!g||g.length===0)continue;const I=s.get(l.id)?.curve;if(I!==void 0&&!zo(I))continue;const u=i.get(l.id);if(!u)continue;if(I===void 0){const E=u.getAttribute("d")??"";if(!$o(E))continue}const p=u.getAttribute("style")??"",f=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),y=f?Number.parseFloat(f[1]):null,v=f?Number.parseFloat(f[2]):null,M=Go(l,g,n);if(u.setAttribute("d",M),y!==null&&v!==null&&typeof u.getTotalLength=="function"){const E=u.getTotalLength(),T=Math.max(0,E-y-v),m=`0 ${y} ${T} ${v}`,S=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${m};`).replace(/;\s*;+/g,";");u.setAttribute("style",S)}}}d(jo,"applyLineJumpsToSvg");async function Uo(t,e){for(const s of t.nodes)s.isGroup?await Br(e.clusters,s):kr(s);const n=new Map;for(const s of t.nodes)s?.id&&n.set(s.id,s);for(const s of t.edges){const r=s.start?n.get(s.start)??{}:{},i=s.end?n.get(s.end)??{}:{},c=_r(e.edgePaths,{...s},{},t.type,r,i,t.diagramId);s.label&&await Fr(e.rootGroups,s),s.label&&Wo(s,c)}const o=t.config?.swimlane?.lineHops;if(o!==!1){const s=o==="gap"?"gap":"arc",r=t.edges.filter(i=>Array.isArray(i.points)&&i.points.length>=2).map(i=>({id:i.id,points:i.points,curve:i.curve,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));jo(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}}d(Uo,"adjustLayout");function Wo(t,e){const n=e?.updatedPath??e?.originalPath,o=Dr(),{subGraphTitleTotalMargin:s}=Hr({flowchart:o.flowchart??{}});if(t.label){const r=Xr.get(t.id);let i=t.x,c=t.y;if(n){const a=Oe.calcLabelPosition(n);Ke.debug("Moving label "+t.label+" from (",i,",",c,") to (",a.x,",",a.y,") abc88"),e&&(i=a.x,c=a.y)}r.attr("transform",`translate(${i}, ${c+s/2})`)}if(t?.startLabelLeft){const r=Ye.get(t.id).startLeft;let i=t?.x,c=t?.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.startLabelRight){const r=Ye.get(t.id).startRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelLeft){const r=Ye.get(t.id).endLeft;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelRight){const r=Ye.get(t.id).endRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}}d(Wo,"positionEdgeLabel");var Mn="__swimlane_default__",$r=21,No=20;function En(t){return Math.max(t.padding??No,No)}d(En,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,c=Math.min(r,n+s/2),a=Math.min($r,Math.max(0,c-i)),l=i+a;if(l<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:l}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===Mn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:Mn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=Mn}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const a of t.nodes??[])e.set(a.id,a);const n=[];for(const a of t.edges??[]){const l=typeof a.start=="string"?a.start:void 0,g=typeof a.end=="string"?a.end:void 0;!l||!g||a.labelNodeId||n.push({id:a.id,src:l,dst:g,ref:a})}const o=t.nodes??[],s=o.filter(a=>a.isGroup),r=o.filter(a=>!a.isGroup);return{nodes:[...[...s].reverse(),...r].map(a=>a.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,c=o?.nodeGap??40;let a=0;for(const I of e.layers){let u=0;for(const p of I){const f=r.get(p);if(!f){u++;continue}f.layer=a,f.order=u;const y=n.x[p]??u*c,v=n.y[p]??a*i;f.x=y,f.y=v,u++}a++}const l=s.nodes??[],g=new Map,x=[];for(const I of l){if(!I?.isGroup)continue;I.parentId||x.push(I);const u=l.filter(M=>M.parentId===I.id);let p=1/0,f=-1/0,y=1/0,v=-1/0;for(const M of u){const E=M.x??n.x[M.id],T=M.y??n.y[M.id],m=M.width??0,S=M.height??0;E!=null&&T!=null&&(p=Math.min(p,E-m/2),f=Math.max(f,E+m/2),y=Math.min(y,T-S/2),v=Math.max(v,T+S/2))}if(p===1/0||y===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const M=I.padding??20,E=I.parentId?M:2*En(I),T=M,m=Math.max(0,f-p)+E,S=Math.max(0,v-y)+T,A=(p+f)/2,R=(y+v)/2;I.x=A,I.y=R,I.width=m,I.height=S,g.set(I.id,{minX:p,maxX:f,minY:y,maxY:v})}}if(x.length>0&&g.size>0){let I=1/0,u=-1/0,p=0;for(const f of x){const y=f.padding??20;y>p&&(p=y);const v=g.get(f.id);v&&(I=Math.min(I,v.minY),u=Math.max(u,v.maxY))}if(I!==1/0&&u!==-1/0){const f=Math.max(0,u-I),v=Math.max(p,36),M=f+2*v,E=(I+u)/2;for(const k of x)k.y=E,k.height=M,k.swimlaneContentTop=I;const T=[...x].sort((k,O)=>{const _=k.x??0,H=O.x??0;return _-H}),m=[],S=[],A=[];for(const k of T){const O=g.get(k.id);if(!O)continue;const _=Math.max(0,O.maxX-O.minX)+2*En(k),H=(O.minX+O.maxX)/2;m.push(k.id),S.push(H),A.push(_)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],A[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Ae(e,n,o,s)}:void 0}d(oo,"measuredNodeRect");function so(t){if(t.isGroup)return;const e=oo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(so,"nodeBoundsInfoFor");function oe(t,e,n=Ft){return Math.abs(t.x-e.x)n}d(Tt,"isHorizontalSegment");function wt(t,e,n=Ft){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}d(wt,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(zt,"overlapLength");function ce(t,e,n=Ft){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(ce,"sameAxisSegmentOverlapLength");function Re(t,e=Ft){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(pt,"dedupeConsecutivePoints");function ro(t,e=Ft){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Tt(n,o,e)&&wt(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:wt(n,o,e)&&Tt(o,s,e)&&wt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(ro,"classifyThreeSegmentRoute");function cn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),c=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&ie.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Je(t,e){return t.lefte.left&&t.tope.top}d(Je,"rectsOverlap");function Tn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Tn,"inflateRect");function Ae(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Ae,"rectFromCenterSize");function qt(t){return oo(t)?.rect}d(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Ie,"portForRectSide");function co(t,e,n,o,s,r=Ft){const i=e==="left"||e==="right",c=o==="left"||o==="right";if(i&&c){if(e==="right"&&o==="left"&&t.xn.x){if(ht(t,n,r))return[t,n];const x=(t.x+n.x)/2;return[t,{x,y:t.y},{x,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const x=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x,y:t.y},{x,y:n.y},n]}return}if(!i&&!c){if(e===o){if(ft(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(ft(t,n,r))return[t,n];const x=(t.y+n.y)/2;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(i&&!c){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&x?[t,{x:n.x,y:t.y},n]:void 0}const a=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return a&&l?[t,{x:t.x,y:n.y},n]:void 0}d(co,"buildOrthogonalPortPath");function ao(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ao,"buildSameSideTrackPath");function an(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=so(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(an,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=so(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,c=o.height??0;n.push({nodeId:o.id,...Ae(s,r,i,c)})}return n}d(es,"collectLayoutNodeRects");function lo(t,e,n=Ft){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)p||Iv)return!1;const M=Math.abs(f-g.a.x)s:r&&c&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Ze(t,e,n,o,{epsilon:s=Ft,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const c=i.points;if(!(!c||c.length<2))for(let a=0;aI+s&&pf+s&&xo+Ft&&t=2?e[e.length-2]:void 0,a=(i?ft(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(a)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}d(Qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ae,"simplifyPolyline");var nt=.001,Vr=.5,Oo=4;function uo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=rs(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(An,"clipEndpoint");function is(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=An(s,o.srcRect,!0)),o.dstRect&&(s=An(s,o.dstRect,!1)),s=ae(Qe(s)),s=ho(s,o.srcRect,o.dstRect),o.edge.points=ae(Qe(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function Rn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.yn.bottom+nt)return e;if(o){if(t.xn.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.xn.right+nt)return e;if(o){if(t.yn.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Rn,"snapEndpointToBoundary");function tn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function On(t,e){return e==="left"||e==="right"?en(t.top,t.bottom):en(t.left,t.right)}d(On,"clearanceRangeForSide");function nn(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function Pn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,c=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(c-i)({...c}));for(let c=e;c>=0&&c=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)o.bottom+nt;case"left":return ht(e,n,nt)&&n.xo.right+nt}}d(_n,"leavesOutward");function Fn(t,e,n){if(t.length<3)return t;if(n){const r=kn(t[0],t[1],e);return r&&_n(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=kn(t[o-1],t[o],e);return s&&_n(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Fn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=tn(o,0,1);if(r){const i=Rn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Fn(o,e,!0)}if(n){const r=o.length-1,i=tn(o,r,-1);if(i){const c=Rn(i,o[r],n,!0);c!==o[r]&&(o=[...o.slice(0,r),c])}o=Fn(o,n,!1)}const s=ho(o,e,n);return s!==o||o.length===2?s:(e&&(o=Bn(o,e,!0)),n&&(o=Bn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Dn(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;const s=pt(o.points,nt),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Dn,"prepareEdgeEndpointsForRenderer");function go(t){return new Map(t.map(e=>[e.id,e]))}d(go,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Hn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}d(Hn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,c=r.y;if(typeof i!="number"||typeof c!="number")continue;const a=r.width??0,l=r.height??0;e=Math.min(e,i-a/2),n=Math.max(n,i+a/2),o=Math.min(o,c-l/2),s=Math.max(s,c+l/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=go(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Hn(s,e)-Hn(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function on(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);let r=1/0,i=-1/0;for(const a of s){const l=a[e];typeof l=="number"&&(r=Math.min(r,l),i=Math.max(i,l))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const c=d(a=>r+i-a,"mirror");for(const a of n){const l=a[e];typeof l=="number"&&(a[e]=c(l));const g=a.groupTitleRect;g&&(a.groupTitleRect=e==="x"?{...g,left:c(g.right),right:c(g.left)}:{...g,top:c(g.bottom),bottom:c(g.top)})}for(const a of o)for(const l of a.points??[])l[e]=c(l[e]);return!0}d(on,"mirrorAxis");function ps(t){return(t.nodes??[]).some(n=>!n.isGroup)?on(t,"y"):!0}d(ps,"applyBtDirectionTransform");function ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/x):1;for(const P of s){const G=P.x??0,J=((P.y??0)-i)*I+c,dt=G-r;P.x=J,P.y=dt}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,dt=(G.y-i)*I+c,mt=j-r;G.x=dt,G.y=mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&on(t,"x"),!0;const p=go(n),f=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,p);if(!G)continue;const j=f.get(G)??[];j.push(P),f.set(G,j)}let y=0;for(const P of u){const G=P.padding??0;G>y&&(y=G)}const v=[];let M=1/0,E=-1/0;for(const P of u){const G=f.get(P.id)??[],j=po(G);j&&(M=Math.min(M,j.minX),E=Math.max(E,j.maxX),v.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(M===1/0||E===-1/0)return!0;const T=Math.max(0,E-M),m=Math.max(y,10),S=T+2*m,A=c+S,O=(M+E)/2-S/2-c,_=O+A/2,H=Math.max(y,c);v.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?v.bottom:v.top,H=I.cx+M;if(H<=v.left+se||H>=v.right-se)continue;E={x:H,y:_},T={x:H,y:c.y},m={x:c.x,y:c.y}}else{const _=u.cx>I.cx?v.right:v.left,H=I.cy+M;if(H<=v.top+se||H>=v.bottom-se)continue;E={x:_,y:H},T={x:c.x,y:H},m={x:c.x,y:c.y}}const S=oe(E,T,se),A=oe(T,m,se);if(S&&A||!S&&At(E,T,o,[g],1)||!A&&At(T,m,o,[x],1))continue;const R=!S&&Ze(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!A&&Ze(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){S?y=[T,m]:A?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}d(ys,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const c of t){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<4)continue;const l=pt(a,.001);if(l.length<4)continue;const g=l.length-1,x=l[g],I=l[g-1],u=l[g-2],p=x.x-I.x,f=x.y-I.y,y=Math.hypot(p,f);if(y>=10||y<.001)continue;const v=I.x-u.x,M=I.y-u.y;if(Math.hypot(v,M)<.001)continue;const T=Tt(I,x,.001),m=wt(I,x,.001),S=Tt(u,I,.001),A=wt(u,I,.001);if(!(T&&A||m&&S))continue;const R=c.end,k=c.start,O=R?e.get(R):void 0;if(!O)continue;const _=O.x??0,H=O.y??0,P=qt(O);if(!P)continue;let G,j;if(A){const W=M<0;G={x:_,y:u.y},j={x:_,y:W?P.bottom:P.top}}else{const W=v>0;G={x:u.x,y:H},j={x:W?P.right:P.left,y:H}}if(At(G,j,r,R?[R]:[],-2)||At(G,j,i,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&io(G,et,2))continue}const J=d((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W{for(const at of t){if(at===c||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt=0){const W=l[g-3],et=[k,R].filter(at=>!!at);if(At(W,G,r,et,-2)||mt(W,G))continue}const Pt=[...l.slice(0,g-2),G,j];c.points=Pt;const Q=c.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt=et+2||de&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}d(xs,"collapseShortTerminalStub");var Z=.001,_t=8,it=Re,In=d((t,e)=>ft(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function bs(t,e){const s=d((u,p)=>{const f=u.x??0,y=u.y??0,v=p.x-f,M=p.y-y;let E=(u.width??0)/2,T=(u.height??0)/2;return Math.abs(M)*E>Math.abs(v)*T?(M<0&&(T=-T),{x:f+(M===0?0:T*v/M),y:y+T}):(v<0&&(E=-E),{x:f+E,y:y+(v===0?0:E*M/v)})},"rectIntersect"),r=d((u,p)=>{const f=pt(u.points??[]);if(f.length<2)return;const y=p?u.start:u.end,v=y?e.get(y):void 0,M=v?qt(v):void 0;if(!v||!y||!M)return;const E=p?f[0]:f[f.length-1],T=p?f[1]:f[f.length-2],m=s(v,E);let S=E;if(In(T,m)&&(S=T),ft(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"V",coord:m.x,min:Math.min(m.y,S.y),max:Math.max(m.y,S.y),boundary:m,railEnd:S,rect:M};if(ht(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"H",coord:m.y,min:Math.min(m.x,S.x),max:Math.max(m.x,S.x),boundary:m,railEnd:S,rect:M}},"terminalLaneFor"),i=d((u,p)=>Math.max(0,Math.min(u.max,p.max)-Math.max(u.min,p.min)),"projectedOverlapLength"),c=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&ft(u.boundary,p.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ht(u.boundary,p.boundary,1),"sameTerminalFace"),a=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:i(u,p)>=_t&&Math.abs(u.coord-p.coord)<.5,"exactTerminalLaneConflict"),l=d((u,p)=>{if(u.nodeId!==p.nodeId||u.orientation!==p.orientation||u.orientation!=="H"||u.atStart===p.atStart)return!1;const f=i(u,p);if(f<_t)return!1;const y=u.rect.bottom-u.rect.top;return f2*y?!1:c(u,p)&&Math.abs(u.coord-p.coord)<16},"nearTerminalLaneConflict"),g=d((u,p)=>{const f=pt(u.edge.points??[]);if(f.length<2)return;const y=u.orientation==="V"?{x:u.boundary.x+p,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+p},v=u.orientation==="V"?{x:u.railEnd.x+p,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+p};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ht(y,u.boundary,Z)&&y.x>=u.rect.left+1&&y.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?ft(y,u.boundary,Z)&&y.y>=u.rect.top+1&&y.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const S=f.length>1&&oe(f[1],u.railEnd,Z),A=f.slice(S?2:1),R=A[0];return R&&!In(R,v)?void 0:[y,v,...A]}const E=f.length>1&&oe(f[f.length-2],u.railEnd,Z),T=f.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!In(m,v)))return[...T,v,y]},"shiftedCandidate"),x=d(u=>{const p=u.edge,f=pt(p.points??[]);if(f.length!==2)return!1;const y=p.start,v=p.end,M=y?e.get(y):void 0,E=v?e.get(v):void 0;if(!M||!E)return!1;const T=M.x??0,m=M.y??0,S=E.x??0,A=E.y??0,[R,k]=f;return ht(R,k,Z)&&Math.abs(m-A)<1&&Math.abs(T-S)>1||ft(R,k,Z)&&Math.abs(T-S)<1&&Math.abs(m-A)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const p=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let f=!1;for(let y=0;y{const R=x(S),k=x(A);return R!==k?Number(R)-Number(k):+!A.atStart-+!S.atStart});for(const S of m){for(const A of I){const R=g(S,A);if(!R)continue;const k=r({...S.edge,points:R},S.atStart);if(!(!k||p.some(O=>O.edge!==S.edge&&(a(k,O)||T&&l(k,O))))){S.edge.points=R,f=!0;break}}if(f)break}}if(!f)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=d((c,a)=>{const l=c.start,g=c.end,x=it(a);if(x.length!==a.length-1)return!1;const I=[l,g].filter(u=>!!u);for(const u of x)if(At(u.a,u.b,o,I,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===c||u.isLayoutOnly)continue;const p=u.points;if(!(!p||p.length<2)){for(const f of x)for(const y of it(pt(p)))if(ce(f,y,.5)>=_t||le(f.a,f.b,y.a,y.b,Z))return!1}}return!0},"candidateIsSafe"),i=d((c,a)=>{if(a+4>=c.length)return;const l=c[a],g=c[a+1],x=c[a+2],I=c[a+3],u=c[a+4],p=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&ft(l,I,Z)&&ft(l,u,Z)&&ft(g,x,Z)&&(g.x-l.x)*(I.x-x.x)<0,f=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&ht(l,I,Z)&&ht(l,u,Z)&&ht(g,x,Z)&&(g.y-l.y)*(I.y-x.y)<0;if(p||f)return pt([...c.slice(0,a+1),u,...c.slice(a+5)]);if(a+5>=c.length)return;const y=c[a+5],v=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&wt(u,y)&&ft(l,u,Z)&&ft(l,y,Z)&&ft(x,I,Z)&&(x.x-g.x)*(u.x-I.x)<0,M=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&Tt(u,y)&&ht(l,u,Z)&&ht(l,y,Z)&&ht(x,I,Z)&&(x.y-g.y)*(u.y-I.y)<0;if(!(!v&&!M))return pt([...c.slice(0,a+1),y,...c.slice(a+6)])},"withoutDogleg");for(let c=0;c<8;c++){let a=!1;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(let x=0;x<=g.length-5;x++){const I=i(g,x);if(!(!I||!r(l,I))){l.points=I,a=!0;break}}if(a)break}if(!a)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Xn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(p=>!p.isLayoutOnly),a=d((p,f,y)=>pt(p===f?y??[]:p.points??[]),"pointsFor"),l=d((p,f)=>{let y=0;for(let v=0;v{const f=it(p);if(f.length!==3)return;const y=f[1];if(!(f[0].horizontal===y.horizontal||f[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),x=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);return r.filter(v=>{if(y.includes(v.id))return!1;const M=v.rect;return f.horizontal?zt(f.a.x,f.b.x,M.left,M.right)>=_t&&f.a.y>=M.top-2&&f.a.y<=M.bottom+2:zt(f.a.y,f.b.y,M.top,M.bottom)>=_t&&f.a.x>=M.left-2&&f.a.x<=M.right+2})},"blockingRectsFor"),I=d((p,f,y)=>{const v=p.map(E=>({...E}));if(f.horizontal)v[f.index].y=y,v[f.index+1].y=y;else if(f.vertical)v[f.index].x=y,v[f.index+1].x=y;else return;const M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),u=d((p,f,y)=>{const v=[p.start,p.end].filter(E=>!!E),M=it(f);if(M.length!==f.length-1)return!1;for(const E of M)if(At(E.a,E.b,r,v,-2)||At(E.a,E.b,i,[],-2))return!1;for(const E of c)if(E!==p){for(const T of M)for(const m of it(a(E)))if(ce(T,m,.5)>=_t)return!1}return l(p,f)<=y},"candidateIsSafe");for(let p=0;p<8;p++){const f=l();let y=!1;for(const v of c){const M=a(v),E=g(M);if(!E)continue;const T=x(v,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(S=>S.rect.top))-20,Math.max(...T.map(S=>S.rect.bottom))+20]:[Math.min(...T.map(S=>S.rect.left))-20,Math.max(...T.map(S=>S.rect.right))+20];for(const S of m){const A=I(M,E.segment,S);if(!(!A||!u(v,A,f))){v.points=A,y=!0;break}}if(y)break}if(!y)return}}d(Xn,"liftObstacleHuggingSameSideRails");function Yn(t,e){const o=d(a=>{const l=a.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),s=d(a=>{if(!a.isGroup||a.parentId)return;const l=a.direction,g=typeof l=="string"?l.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const x=o(a),I=a.y,u=a.height;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(f<=0||p{if(!a.horizontal)return!1;const g=a.a.y;return g<=l.top+Z||g>=l.bottom-Z?!1:zt(a.a.x,a.b.x,l.left,l.right)>=_t},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(a=>!!a);if(i.length===0)return;let c=0;for(const a of t){if(a.isLayoutOnly)continue;const l=pt(a.points??[]);for(const g of it(l))for(const x of i)r(g,x.rect)&&(c=Math.max(c,x.rect.bottom-g.a.y+4))}if(!(c<=Z))for(const a of i){const l=a.node.y,g=a.node.height;typeof l!="number"||typeof g!="number"||!Number.isFinite(l)||!Number.isFinite(g)||g<=0||(a.node.y=l-c/2,a.node.height=g+c,a.node.groupTitleRect={...a.rect,top:a.rect.top-c,bottom:a.rect.bottom-c})}}d(Yn,"liftTopLaneTitleBandsAboveRails");function Gn(t,e){const o=d(l=>{const g=l.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId||l.direction!=="LR")return;const x=o(l),I=l.x,u=l.width;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(p<=0||f{if(!l.vertical)return!1;const x=l.a.x;return x<=g.left+Z||x>=g.right-Z?!1:zt(l.a.y,l.b.y,g.top,g.bottom)>=_t},"verticalSegmentIntersectsTitle"),i=d((l,g)=>{if(!l.horizontal)return!1;const x=l.a.y;return x<=g.top+Z||x>=g.bottom-Z?!1:zt(l.a.x,l.b.x,g.left,g.right)>=_t},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(l=>!!l);if(c.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(const x of it(g))for(const I of c)if(r(x,I.rect))a=Math.max(a,I.rect.right-x.a.x+4);else if(i(x,I.rect)){const u=Math.min(x.a.x,x.b.x);a=Math.max(a,I.rect.right-u+4)}}if(!(a<=Z))for(const l of c){const g=l.node.x,x=l.node.width;typeof g!="number"||typeof x!="number"||!Number.isFinite(g)||!Number.isFinite(x)||x<=0||(l.node.x=g-a/2,l.node.width=x+a,l.node.groupTitleRect={...l.rect,left:l.rect.left-a,right:l.rect.right-a})}}d(Gn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(p=>!p.isLayoutOnly),r=d((p,f=new Map)=>pt(f.get(p)??p.points??[]),"replacementPointsFor"),i=d((p=new Map)=>{let f=0;for(let y=0;ys.reduce((f,y)=>f+Qt(r(y,p)),0),"totalBends"),a=d(p=>{const f=r(p);if(f.length<4)return;const y=f[f.length-2],v=f[f.length-1];if(!(!Tt(y,v,Z)&&!wt(y,v,Z)))return{tailStart:y,terminal:v}},"terminalTailFor"),l=d((p,f)=>{const y=r(p);if(y.length<3)return;const v=y[0],M=y[1];let E;if(Tt(v,M,Z))E={x:M.x,y:f.tailStart.y};else if(wt(v,M,Z))E={x:f.tailStart.x,y:M.y};else return;const T=ae(pt([v,M,E,f.tailStart,f.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),g=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);for(const v of it(f))if(At(v.a,v.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),x=d((p,f,y)=>{for(const v of s)if(v!==p){for(const M of it(f))for(const E of it(r(v,y)))if(ce(M,E,.5)>=_t)return!0}return!1},"pathHasSharedTrack"),I=d((p,f,y)=>!g(p,f)&&!x(p,f,y),"candidateIsSafe"),u=d(()=>{const p=new Map;for(const f of s){const y=f.end;if(!y||!e.has(y)||r(f).length<4)continue;const M=p.get(y)??[];M.push(f),p.set(y,M)}return p},"edgesByDestination");for(let p=0;p<4;p++){const f=i();if(f===0)return;const y=c();let v,M=f,E=y;for(const T of u().values())for(let m=0;m=f||G>M||G===M&&j>=E||(v=P,M=G,E=j)}if(!v)return;for(const[T,m]of v)T.points=m}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(T=>!T.isLayoutOnly),a=d((T,m=new Map)=>pt(m.get(T)??T.points??[]),"replacementPointsFor"),l=d((T=new Map)=>{let m=0;for(let S=0;Sc.reduce((m,S)=>m+Qt(a(S,T)),0),"totalBends"),x=d(T=>{const m=T.start,S=T.end,A=m?e.get(m):void 0,R=S?e.get(S):void 0,k=A?qt(A):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),I=d((T,m,S)=>{if(S.index<=0||S.index+1>=m.length-1)return;const A=x(T);if(A){if(S.vertical){const R=S.a.x,k=Math.min(A.src.left,A.dst.left),O=Math.max(A.src.right,A.dst.right),_=RO+Z?"right":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"vertical",side:_,coord:R,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){const R=S.a.y,k=Math.min(A.src.top,A.dst.top),O=Math.max(A.src.bottom,A.dst.bottom),_=RO+Z?"bottom":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"horizontal",side:_,coord:R,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const T=[];for(const m of c){const S=a(m);for(const A of it(S)){const R=I(m,S,A);R&&T.push(R)}}return T},"collectExternalRails"),p=d((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&zt(T.min,T.max,m.min,m.max)>=_t,"railsInteract"),f=d(T=>{const m=[],S=new Set;for(const A of T){if(S.has(A))continue;const R=[A],k=[];for(S.add(A);R.length>0;){const O=R.pop();k.push(O);for(const _ of T)!S.has(_)&&p(O,_)&&(S.add(_),R.push(_))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=d(T=>{const m=[];for(const S of T)m.some(A=>Math.abs(A-S.coord){const m=T.map(R=>R.coord),S=y(T),A=[];if(T.length<=6){const R=new Array(S.length).fill(!1),k=[],O=d(()=>{if(k.length===T.length){k.some((_,H)=>Math.abs(_-m[H])>=Z)&&A.push([...k]);return}for(const[_,H]of S.entries())R[_]||(R[_]=!0,k.push(H),O(),k.pop(),R[_]=!1)},"visit");return O(),A}for(let R=0;R{const S=new Map;for(const[R,k]of T.entries()){const O=m[R],_=S.get(k.edge)??k.points.map(H=>({x:H.x,y:H.y}));k.axis==="vertical"?(_[k.segmentIndex].x=O,_[k.segmentIndex+1].x=O):(_[k.segmentIndex].y=O,_[k.segmentIndex+1].y=O),S.set(k.edge,_)}const A=new Map;for(const[R,k]of S){const O=ae(pt(k));if(it(O).length!==O.length-1)return;A.set(R,O)}return A},"replacementsForAssignment"),E=d(T=>{for(const[m,S]of T){const A=[m.start,m.end].filter(R=>!!R);for(const R of it(S))if(At(R.a,R.b,r,A,-2)||At(R.a,R.b,i,[],-2))return!1}for(let m=0;m=_t)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=l();if(m===0)return;let S,A=m,R=g(),k=Number.POSITIVE_INFINITY;for(const O of f(u()))for(const _ of v(O)){const H=M(O,_);if(!H||!E(H))continue;const P=l(H);if(P>=m)continue;const G=g(H),j=O.reduce((J,dt,mt)=>J+Math.abs(_[mt]-dt.coord),0);P>A||P===A&&(G>R||G===R&&j>=k)||(S=H,A=P,R=G,k=j)}if(!S)return;for(const[O,_]of S)O.points=_}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,p,f)=>pt(u===p?f??[]:u.points??[]),"pointsFor"),c=d(u=>it(u).reduce((p,f)=>{const y=f.a.x-f.b.x,v=f.a.y-f.b.y;return p+Math.hypot(y,v)},0),"pathLength"),a=d((u,p)=>{let f=0;for(let y=0;y{if(u.horizontal){const f=u.a.y;return(Math.abs(f-p.top)<1||Math.abs(f-p.bottom)<1)&&zt(u.a.x,u.b.x,p.left,p.right)>=_t}if(u.vertical){const f=u.a.x;return(Math.abs(f-p.left)<1||Math.abs(f-p.right)<1)&&zt(u.a.y,u.b.y,p.top,p.bottom)>=_t}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const p=[u.start,u.end].filter(y=>!!y),f=[];for(const y of p){const v=e.get(y),M=v?qt(v):void 0;M&&f.push(M)}return f},"endpointRectsFor"),x=d((u,p)=>{if(p+3>=u.length)return[];const f=u[p],y=u[p+1],v=u[p+2],M=u[p+3],E=Tt(f,y,Z)&&wt(y,v,Z)&&Tt(v,M,Z),T=wt(f,y,Z)&&Tt(y,v,Z)&&wt(v,M,Z);if(!E&&!T)return[];if(!(E?Math.sign(y.x-f.x)!==Math.sign(M.x-v.x):Math.sign(y.y-f.y)!==Math.sign(M.y-v.y)))return[];const S=ft(f,M,Z)||ht(f,M,Z)?[]:[{x:f.x,y:M.y},{x:M.x,y:f.y}],A=S.length===0?[[...u.slice(0,p+1),...u.slice(p+3)]]:S.map(k=>[...u.slice(0,p+1),k,...u.slice(p+3)]),R=new Set;return A.map(k=>ae(pt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(_=>oe(_,M,Z)))return!1;const O=k.map(_=>`${_.x.toFixed(3)},${_.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,p,f)=>{const y=[u.start,u.end].filter(M=>!!M),v=g(u);for(const M of it(p))if(At(M.a,M.b,o,y,-2)||At(M.a,M.b,s,[],-2)||v.some(E=>l(M,E)))return!1;for(const M of r)if(M!==u){for(const E of it(p))for(const T of it(i(M)))if(ce(E,T,.5)>=_t)return!1}return a(u,p)<=f},"candidateIsSafe");for(let u=0;u<8;u++){const p=a();let f,y,v=p,M=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=i(T),S=Qt(m,Z),A=c(m);for(let R=0;R<=m.length-4;R++)for(const k of x(m,R)){const O=Qt(k,Z),_=c(k);if(!(Ov||P===v&&(O>M||O===M&&_>=E)||(f=T,y=k,v=P,M=O,E=_)}}if(!f||!y)return;f.points=y}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const i=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const F=N.x??0,D=N.y??0,V=qt(N);V&&i.push({id:String(N.id??""),cx:F,cy:D,rect:V})}if(i.length===0)return;const c=new Map(i.map(N=>[N.id,N])),a=i.map(N=>({id:N.id,rect:N.rect})),l=["top","bottom","left","right"],g={top:Math.min(...i.map(N=>N.rect.top))-20,bottom:Math.max(...i.map(N=>N.rect.bottom))+20,left:Math.min(...i.map(N=>N.rect.left))-20,right:Math.max(...i.map(N=>N.rect.right))+20},x=t.filter(N=>!N.isLayoutOnly),I=new Map(x.map((N,F)=>[N,F])),u=d(N=>{const F=N==="left"||N==="top"?-1:1,D=[];for(let V=0;V<=2;V++)D.push(g[N]+F*20*V);return D},"outwardTracksForSide"),p=d((N,F=new Map)=>pt(F.get(N)??N.points??[]),"replacementPointsFor"),f=d((N,F)=>{let D=0;for(const V of N)for(const h of F)le(V.a,V.b,h.a,h.b,Z)&&D++;return D},"crossingCountBetweenSegments"),y=d((N,F)=>f(it(N),it(F)),"crossingCountBetweenPaths"),v=d((N=new Map)=>{let F=0;const D=[],V=new Set,h=[],b=d(C=>{V.has(C)||(V.add(C),h.push(C))},"addEdge");for(let C=0;C0&&(F+=q,D.push({first:L,second:U,count:q}),b(L),b(U))}}return h.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),{count:F,pairs:D,edgeSet:V,edges:h}},"crossingSnapshot"),M=d((N,F)=>{const D=new Set(F.keys());if(D.size===0)return N.count;let V=0;for(const b of N.pairs)(D.has(b.first)||D.has(b.second))&&(V+=b.count);let h=0;for(let b=0;b{const F=new Map;for(const h of N.pairs){const b=F.get(h.first)??new Set;b.add(h.second),F.set(h.first,b);const C=F.get(h.second)??new Set;C.add(h.first),F.set(h.second,C)}const D=[],V=new Set;for(const h of N.edges){if(V.has(h))continue;const b=[h],C=[];for(V.add(h);b.length>0;){const L=b.pop();C.push(L);for(const w of F.get(L)??[])V.has(w)||(V.add(w),b.push(w))}C.sort((L,w)=>(I.get(L)??0)-(I.get(w)??0)),C.length>1&&D.push(C)}return D},"crossingComponents"),T=d(N=>[N.start,N.end].filter(F=>!!F),"endpointIdsFor"),m=d(N=>{const F=[];for(const D of E(N)){const V=new Set(D),h=new Set(D.flatMap(C=>T(C))),b=[...D];for(const C of x)V.has(C)||T(C).some(L=>h.has(L))&&b.push(C);b.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),F.push(b)}return F},"pairSearchGroups"),S=d((N,F,D)=>M(N,new Map([[F,D]])),"crossingCountWithSingleReplacement"),A=d(N=>{const F=new Map;for(const D of N.pairs)F.set(D.first,(F.get(D.first)??0)+D.count),F.set(D.second,(F.get(D.second)??0)+D.count);return F},"currentCrossingsByEdge"),R=d(N=>N.slice(1).reduce((F,D,V)=>{const h=N[V];return F+Math.abs(D.x-h.x)+Math.abs(D.y-h.y)},0),"pathLength"),k=d((N=new Map)=>x.reduce((F,D)=>F+Qt(p(D,N)),0),"totalBends"),O=d((N=new Map)=>x.reduce((F,D)=>F+R(p(D,N)),0),"totalLength"),_=d((N,F,D=new Map)=>{const V=it(F);for(const h of x)if(h!==N){for(const b of V)for(const C of it(p(h,D)))if(ce(b,C,.5)>=_t)return!0}return!1},"pathHasSegmentConflict"),H=d((N,F)=>{const D=[N.start,N.end].filter(V=>!!V);for(const V of it(F))if(At(V.a,V.b,a,D,-2))return!0;return!1},"pathHitsNode"),P=d((N,F)=>{const D=ae(pt(F));it(D).length===D.length-1&&N.push(D)},"pushOrthogonalCandidate"),G=d(N=>N==="left"||N==="right","sideIsHorizontal"),j=d((N,F,D)=>{switch(F){case"left":return Math.min(N.x,D.x)-20;case"right":return Math.max(N.x,D.x)+20;case"top":return Math.min(N.y,D.y)-20;case"bottom":return Math.max(N.y,D.y)+20}},"localTrackForSameSide"),J=d((N,F,D,V)=>{const h=D==="left"||D==="top"?-1:1,b=[j(F,D,V),g[D]];for(const C of b)for(let L=0;L<=2;L++)P(N,ao(F,D,V,C+h*20*L))},"addSameSideCandidates"),dt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:b,y:F.y},{x:b,y:C},{x:V.x,y:C},V])},"addHorizontalToVerticalCandidates"),mt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:F.x,y:b},{x:C,y:b},{x:C,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=d((N,F,D,V,h)=>{const b=[...u("top"),...u("bottom")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:C,y:F.y},{x:C,y:w},{x:L,y:w},{x:L,y:V.y},V])},"addHorizontalPairCandidates"),Pt=d((N,F,D,V,h)=>{const b=[...u("left"),...u("right")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:F.x,y:C},{x:w,y:C},{x:w,y:L},{x:V.x,y:L},V])},"addVerticalPairCandidates"),Q=d(N=>{const F=new Set;return N.map(D=>pt(D)).filter(D=>{const V=D.map(h=>`${h.x.toFixed(3)},${h.y.toFixed(3)}`).join("|");return F.has(V)||D.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),W=d((N,F,D,V)=>{const h=[],b=co(N,F,D,V,20,Z);b&&P(h,b),F===V&&J(h,N,F,D);const C=G(F),L=G(V);return C&&!L?dt(h,N,F,D,V):!C&&L?mt(h,N,F,D,V):C?kt(h,N,F,D,V):Pt(h,N,F,D,V),Q(h)},"buildCandidatesForSides"),et=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="top"||C==="bottom"?u(C):b;for(const B of h){P(N,[F,D,{x:B,y:D.y},{x:B,y:L.y},L]);for(const U of w)P(N,[F,D,{x:B,y:D.y},{x:B,y:U},{x:L.x,y:U},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="left"||C==="right"?u(C):h;for(const B of b){P(N,[F,D,{x:D.x,y:B},{x:L.x,y:B},L]);for(const U of w)P(N,[F,D,{x:D.x,y:B},{x:U,y:B},{x:U,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=d(N=>{const F=N.start,D=N.end,V=D?c.get(D):void 0;if(!F||!V)return[];const h=pt(N.points??[]);if(h.length<4)return[];const b=h[0],C=h[1],L=[];return wt(b,C,Z)?et(L,b,C,V):Tt(b,C,Z)&&at(L,b,C,V),L},"terminalPreservingOuterTrackCandidates"),xt=d(N=>{const F=N.start,D=N.end,V=F?c.get(F):void 0,h=D?c.get(D):void 0;if(!V||!h)return[];const b=[];for(const C of l){const L=Ie(V,C);for(const w of l)b.push(...W(L,C,Ie(h,w),w))}return b.push(...gt(N)),b},"candidatePathsFor"),vt=d(()=>new Map(x.map(N=>[N,it(p(N))])),"currentSegmentsByEdge"),Vt=d((N,F,D)=>{const V=new Set;for(const h of x){if(h===N)continue;const b=D.get(h)??it(p(h));F.some(C=>b.some(L=>ce(C,L,.5)>=_t))&&V.add(h)}return V},"sharedTrackConflictsFor"),jt=d((N,F,D,V)=>{const h=new Set;return xt(N).map(C=>ae(pt(C))).filter(C=>{if(H(N,C))return!1;const L=C.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return h.has(L)||C.length<2?!1:(h.add(L),!0)}).map(C=>{const L=it(C);let w=0;for(const B of x)B!==N&&(w+=f(L,D.get(B)??it(p(B))));return{candidate:C,candidateSegments:L,crossings:F.count-(V.get(N)??0)+w,bends:Qt(C,Z),totalBends:Qt(C),length:R(C)}}).filter(({crossings:C})=>C<=F.count).sort((C,L)=>C.crossings-L.crossings||C.bends-L.bends||C.length-L.length).slice(0,48).map(C=>({path:C.candidate,segments:C.candidateSegments,sharedTrackConflicts:Vt(N,C.candidateSegments,D),totalBends:C.totalBends,length:C.length}))},"pairCandidatesFor"),Ut=d((N,F,D,V,h,b)=>{let C=0;for(const w of N.pairs)(w.first===F||w.second===F||w.first===V||w.second===V)&&(C+=w.count);let L=f(D.segments,h.segments);for(const w of x){if(w===F||w===V)continue;const B=b.get(w)??it(p(w));L+=f(D.segments,B)+f(h.segments,B)}return N.count-C+L},"pairCrossingCount"),te=d((N,F)=>{for(const D of N.sharedTrackConflicts)if(D!==F)return!1;return!0},"conflictsOnlyWith"),Se=d((N,F)=>N.segments.some(D=>F.segments.some(V=>ce(D,V,.5)>=_t)),"candidatesShareTrack"),de=d((N,F,D,V)=>te(F,D.edge)&&te(V,N.edge)&&!Se(F,V),"pairCandidatesAreCompatible"),Ce=d((N,F,D,V,h)=>{const b=Ut(N.current,F.edge,D,V.edge,h,N.baseSegments);if(!(b>=N.current.count))return{replacements:new Map([[F.edge,D.path],[V.edge,h.path]]),crossings:b,bends:N.currentBends-(N.baseBendsByEdge.get(F.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+D.totalBends+h.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(F.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+D.length+h.length}},"scorePairReplacement"),dn=d((N,F)=>N.crossings{let h=V;for(const b of F.candidates)for(const C of D.candidates){if(!de(F,b,D,C))continue;const L=Ce(N,F,b,D,C);L&&dn(L,h)&&(h=L)}return h},"bestScoreForOptionPair"),hn=d(N=>{const F=k(),D=O(),V=vt(),h=A(N),b=new Map(x.map(q=>[q,Qt(p(q))])),C=new Map(x.map(q=>[q,R(p(q))])),L=new Map,w=m(N);for(const q of w)for(const z of q){if(L.has(z))continue;const Y=jt(z,N,V,h);Y.length>0&&L.set(z,{edge:z,candidates:Y})}let B={replacements:new Map,crossings:N.count,bends:F,length:D};const U={current:N,currentBends:F,currentLength:D,baseBendsByEdge:b,baseLengthByEdge:C,baseSegments:V};for(const q of w){const z=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>L.get(ot)).filter(ot=>!!ot);for(let ot=0;ot0?B.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const F=v(),D=F.count;if(D===0)return;let V,h,b=D,C=Number.POSITIVE_INFINITY;for(const w of F.edges){const B=Qt(p(w),Z);for(const U of xt(w)){const q=H(w,U),z=!q&&_(w,U),Y=S(F,w,U),ot=Qt(U,Z);q||z||!(Yb||Y===b&&ot>=C||(V=w,h=U,b=Y,C=ot)}}if(V&&h){V.points=h;continue}const L=hn(F);if(!L)return;for(const[w,B]of L)w.points=B}}d(vs,"resolveRenderedOrthogonalCrossings");var pe=.001,Wr=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=an(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(f=>f.rect.top))-r,bottom:Math.max(...o.map(f=>f.rect.bottom))+r,left:Math.min(...o.map(f=>f.rect.left))-r,right:Math.max(...o.map(f=>f.rect.right))+r},c=d((f,y,v,M)=>{const E=[],T=co(f,y,v,M,r,pe);return T&&E.push(T),y===M&&E.push(ao(f,y,v,i[y])),E},"buildOrthogonalPathCandidates"),a=d((f,y)=>{for(let v=0;v{let M=0;const E=Re(f,pe),T=y.start,m=y.end;for(const S of t){if(S===y||S.isLayoutOnly)continue;const A=S.start,R=S.end;if(!v&&T&&m&&(A===T||A===m||R===T||R===m))continue;const k=S.points;if(!(!k||k.length<2))for(const O of E)for(const _ of Re(k,pe)){if(fo(O.a,O.b,_.a,_.b,pe,pe)){M++;continue}ce(O,_,pe)>=Wr&&M++}}return M},"pathConflictCount"),g=4,x=d((f,y)=>{const v=Math.abs(f.y-y.rect.top),M=Math.abs(f.y-y.rect.bottom),E=Math.abs(f.x-y.rect.left),T=Math.abs(f.x-y.rect.right);let m="top",S=v;return M{const M=I.get(f)??[];M.push({side:y,edgeId:v}),I.set(f,M)},"addFaceClaim");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points??[];if(y.length<1)continue;const v=f.id??"",M=f.start,E=f.end;if(M){const T=n.get(M);T&&u(M,x(y[0],T),v)}if(E){const T=n.get(E);T&&u(E,x(y[y.length-1],T),v)}}const p=d((f,y,v)=>I.get(f)?.some(M=>M.edgeId!==v&&M.side===y)??!1,"faceIsClaimed");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points;if(!y||y.length<2)continue;const v=Qt(y,pe);if(v0){const mt=l(J,f,!0);if(mt>O||mt===O&&dt>=_)continue;O=mt,_=dt,k=J;continue}l(J,f)>R||dt<_&&(_=dt,k=J)}}}if(k){f.points=k;const H=I.get(M);H&&I.set(M,H.filter(G=>G.edgeId!==S));const P=I.get(E);P&&I.set(E,P.filter(G=>G.edgeId!==S)),u(M,x(k[0],T),S),u(E,x(k[k.length-1],m),S)}}}d(Ls,"simplifyDetouredEdges");var Kt=.001,Po=10,Ve=7;function $n(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,c=r.y-s.y;if(!(Math.abs(i)+Math.abs(c)r&&Je(t,Es(r)))}d(zn,"labelOverlapsOwnMarker");function Ue(t,e){const n=[];for(const p of t){if(p.isLayoutOnly)continue;const f=p.points;if(!(!f||f.length<2))for(let y=0;y{const y=Tn(f,r);for(const{nodeId:v,rect:M}of o)if(v!==p&&Je(y,M))return!0;return!1},"labelOverlapsForeignNode"),l=d((p,f)=>{const y=Tn(f,r);for(const v of n)if(v.edgeId!==p&&cn(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),g=d((p,f,y)=>a(p,y)||l(f,y),"labelOverlapsAnything"),x=[],I=d(p=>{for(const{id:f,rect:y}of s)if(ts(y,p))return f},"findContainingLane"),u=d((p,f)=>x.some(y=>y.labelId!==p&&Je(f,y.rect)),"overlapsPlacedLabel");for(const p of t){if(p.isLayoutOnly)continue;const f=p.labelNodeId;if(!f)continue;const y=e.get(f);if(!y)continue;const v=p.points;if(!v||v.length<2)continue;const M=y.width??0,E=y.height??0;if(M<=0||E<=0)continue;const T=[];for(let Q=0;Q=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx0?m:T,A=M>=E?"horizontal":"vertical",R=d(Q=>[...Q].sort((W,et)=>{const at=W.orientation===A,gt=et.orientation===A;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?M:E)+2,vt=et.length>=(et.orientation==="horizontal"?M:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((Q,W)=>{const et=v[Q.idx],at=v[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),P=d((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=d((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=d(Q=>{const W=Ae(Q.midX,Q.midY,M,E),et=I(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+M/2+i,xt=at.rect.right-M/2-i,vt=at.rect.top+E/2+i,Vt=at.rect.bottom-E/2-i;if(gt>xt||vt>Vt)return;const jt={midX:P(Q.midX,gt,xt),midY:P(Q.midY,vt,Vt)},Ut=Ae(jt.midX,jt.midY,M,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),J=d((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=d((Q,W)=>{const at=(Q.orientation==="horizontal"?M/2:E/2)+c;if(Q===k){const gt=v[Q.idx];if(J(Q,W,gt)+Kt{const W=R(Q);for(const et of W)for(const at of _){const gt=H(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!zn(xt.rect,v)&&!u(f,xt.rect)&&!g(f,p.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=d((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!zn(vt.rect,v)&&!u(f,vt.rect)&&!a(f,vt.rect)&&(et||!l(p.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(S)??(S.lengthet.labelId===f);W>=0?x[W]={labelId:f,rect:Q}:x.push({labelId:f,rect:Q})}}}d(Ue,"anchorLabelsToPolyline");var Sn=1e-6,Kr=8,Bo=Kr/2,qr=3;function Vn(t,e){return t{const g=Vn(c,a);let x=0;const I=d(u=>{if(!u)return;const p=s.get(u);if(!p)return;const f=l==="x"?p.w/2:p.h/2;f>x&&(x=f)},"consider");I(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const p=u.start,f=u.end;!p||!f||Vn(p,f)===g&&I(u.labelNodeId)}return x>0?x+qr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const c=i.points;if(!ro(c,Sn))continue;const a=lo(i,n,Sn);if(!a)continue;const{srcId:l,dstId:g,srcInfo:x,dstInfo:I,collinearX:u,collinearY:p}=a;if(u===p)continue;let f,y;if(u){const m=I.cy>x.cy;f={x:x.cx,y:m?x.rect.bottom:x.rect.top},y={x:I.cx,y:m?I.rect.top:I.rect.bottom}}else{const m=I.cx>x.cx;f={x:m?x.rect.right:x.rect.left,y:x.cy},y={x:m?I.rect.left:I.rect.right,y:I.cy}}if(At(f,y,o,[l,g],1))continue;const M=r(i,l,g,u?"x":"y"),E=M>Bo?M:Bo,T=[0,E,-E];for(const m of T){const S={...f},A={...y};if(u){if(S.x+=m,A.x+=m,S.x<=x.rect.left||S.x>=x.rect.right||A.x<=I.rect.left||A.x>=I.rect.right)continue}else if(S.y+=m,A.y+=m,S.y<=x.rect.top||S.y>=x.rect.bottom||A.y<=I.rect.top||A.y>=I.rect.bottom)continue;if(!At(S,A,o,[l,g],1)&&!Ze(S,A,t,i,{epsilon:Sn})){i.points=[S,A];break}}}}d(Ts,"straightenCollinearSiblingDetours");function jn(t,e){const{realNodeRects:a,labelNodeRects:l}=me(e.values()),g=d((m,S)=>Re(S,.001).map(A=>({...A,edge:m,interior:A.index>=1&&A.index<=S.length-3})),"segmentsFor"),x=d(()=>{const m=[];for(const S of t){if(S.isLayoutOnly)continue;const A=S.points;!A||A.length<2||m.push(...g(S,pt(A)))}return m},"allSegments"),I=d((m,S)=>m.horizontal&&S.horizontal?zt(m.a.x,m.b.x,S.a.x,S.b.x)>=8&&Math.abs(m.a.y-S.a.y)<7:m.vertical&&S.vertical?zt(m.a.y,m.b.y,S.a.y,S.b.y)>=8&&Math.abs(m.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((m,S)=>{const A=m.start,R=m.end,k=g(m,S);if(k.length!==S.length-1)return!1;const O=[A,R].filter(H=>!!H),_=m.labelNodeId?[m.labelNodeId]:[];for(const H of k)if(At(H.a,H.b,a,O,-2)||At(H.a,H.b,l,_,-2))return!1;for(const H of t){if(H===m||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of k)for(const j of g(H,pt(P)))if(I(G,j)||le(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),p=d((m,S)=>{const A=pt(m.edge.points??[]);if(A.length<4||m.index>=A.length-1)return;const R=A.map(k=>({...k}));if(m.horizontal)R[m.index].y+=S,R[m.index+1].y+=S;else if(m.vertical)R[m.index].x+=S,R[m.index+1].x+=S;else return;return g(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),f=d((m,S)=>({x:m.x??(S.left+S.right)/2,y:m.y??(S.top+S.bottom)/2}),"nodeCenter"),y=d(m=>{const S=m.edge,A=pt(S.points??[]);if(A.length!==4||m.index!==1)return;const R=S.start?e.get(S.start):void 0,k=S.end?e.get(S.end):void 0,O=R?qt(R):void 0,_=k?qt(k):void 0,H=A.slice(m.index+2);if(!(!R||!k||!O||!_||H.length===0))return{sourceCenter:f(R,O),targetCenter:f(k,_),sourceRect:O,tail:H}},"sourceDetourContextFor"),v=d((m,S,A,R,k,O)=>{const _=R.y>=A.y,H=_?k.bottom:k.top,P=H+(_?20:-20);if(_&&m.b.y<=P+.001||!_&&m.b.y>=P-.001)return;const G=m.a.x+S;return pt([{x:A.x,y:H},{x:A.x,y:P},{x:G,y:P},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),M=d((m,S,A,R,k,O)=>{const _=R.x>=A.x,H=_?k.right:k.left,P=H+(_?20:-20);if(_&&m.b.x<=P+.001||!_&&m.b.x>=P-.001)return;const G=m.a.y+S;return pt([{x:H,y:A.y},{x:P,y:A.y},{x:P,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=d((m,S)=>{const A=y(m);if(A){if(m.vertical)return v(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(m.horizontal)return M(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const S=x();let A=!1;for(let R=0;RP.interior);for(const P of H){for(const G of T){const j=p(P,G);if(j&&u(P.edge,j)){P.edge.points=j,A=!0;break}const J=E(P,G);if(J&&u(P.edge,J)){P.edge.points=J,A=!0;break}}if(A)break}}if(!A)return}}d(jn,"nudgeSharedInteriorSubpaths");function ws(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,c=o.y-n.y,a=s*c-r*i;if(Math.abs(a)<1e-10)return!1;const l=n.x-t.x,g=n.y-t.y,x=(l*c-g*i)/a,I=(l*r-g*s)/a,u=.01;return x>u&&x<1-u&&I>u&&I<1-u}d(ws,"segmentsIntersect");function As(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const c of n){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<2)continue;const l=c.start,g=c.end,x=c.labelNodeId,I=c.id??`${l}->${g}`;for(const u of s)if(!(u.nodeId===l||u.nodeId===g)&&!(x&&u.nodeId===x)){for(let p=0;p0){const c=o.filter(l=>l.type==="edge-node-overlap").length,a=o.filter(l=>l.type==="edge-edge-crossing").length;Ke.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${a} edge crossing(s)`);for(const l of o)Ke.warn(`[SWIMLANE_VALIDATE] ${l.type}: ${l.detail}`)}return o}d(As,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ms(t,e)||e==="BT"&&s.length>0&&!ps(t))return;for(const c of o){if(c.isLayoutOnly)continue;const a=c.points;!a||a.length<2||(c.points=ae(Qe(a)))}Ls(o,n),Ts(o,n),ys(o,n);const r=new Map;for(const c of n)r.set(String(c.id),c);Ue(o,r),is(o,r),xs(o,r),jn(o,r),bs(o,r),Ms(o,r),Xn(o,r),Is(o,r);const i=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ue(o,r),Dn(o,r),Xn(o,r),Ue(o,r),Dn(o,r)},"finalizeRenderedEdges");i(),jn(o,r),i(),Yn(o,r),Gn(o,r),Yn(o,r),Gn(o,r)}d(Rs,"postProcessSwimlaneLayout");function ye(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(ye,"normalizeGraph");function mo(t,e){return t.edges.filter(n=>n.dst===e)}d(mo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function yo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(yo,"buildSortedSuccessorMap");function xo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(xo,"buildInDegreeMap");function bo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(bo,"sortedZeroInDegreeNodes");function ln(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(ln,"buildPredecessorSuccessorMaps");function Mo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}d(Mo,"buildLayersFromRanks");function Be(t){const e=xo(t),n=bo(e),o=[],s=yo(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let c=0;for(;c{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),c=o,a=r,l=o;for(;c=s||cx.dst===I.dst?x.id.localeCompare(I.id):x.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const x of n.get(g)??[]){const I=x.dst;o[I]===0?r(I):o[I]===1&&s.push(x)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,x)=>g.localeCompare(x));for(const g of i)o[g]===0&&r(g);const c=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),a=e.edges.map(g=>c.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:a,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const c=n(r)??r;return e.set(o,c),c},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function fe(t){const e=Ps(t);return n=>e.get(n)??null}d(fe,"createTopLaneResolver");function fn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(fn,"buildTopLaneOrder");function So(t,e){const n=fn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(So,"resolveTopLaneOrder");var Jr={EPSILON:1e-6},sn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},ko={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=ln(n);for(const m of r.values())m.sort((S,A)=>S.localeCompare(A));const i=Be(n)??[...n.nodes].sort((m,S)=>m.localeCompare(S)),c=new Map;for(const[m,S]of i.entries())c.set(S,m);const a=new Map,l=new Map;for(const m of n.nodes)l.set(m,[]);for(const m of i){const S=(r.get(m)??[]).filter(A=>a.has(A));if(S.length>0){const A=ks(m,S,{laneOf:o,rankHint:s,topoIndex:c});a.set(m,A),l.get(A).push(m)}else a.has(m)||a.set(m,null)}for(const m of n.nodes)a.has(m)||a.set(m,null);const g=new Set;for(const m of n.nodes)(a.get(m)??null)===null&&g.add(m);const x=[...g].sort((m,S)=>{const A=c.get(m)??0,R=c.get(S)??0;return A===R?m.localeCompare(S):A-R}),I=_s(n),u=new Map;for(const[m,S]of I.entries())u.set(m,[...S].sort((A,R)=>A.localeCompare(R)));const p=Fs(u),f=Ds(u),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of f)for(const S of m.nodes){const A=y.get(S);A?A.push(m.id):y.set(S,[m.id])}const v=[],M=[],E=new Set,T=d(m=>{if(!E.has(m)){E.add(m),v.push(m);for(const S of l.get(m)??[])T(S);M.push(m)}},"walk");for(const m of x)T(m);for(const m of i)T(m);return{parent:a,children:l,roots:x,componentOf:p,blocks:f,nodeBlocks:y,adjacency:u,preorder:v,postorder:M,topologicalOrder:i}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{const c=n.laneOf(r),a=n.laneOf(i),l=c!=null&&c===o,g=a!=null&&a===o;if(l!==g)return l?-1:1;const x=n.rankHint?.[r],I=n.rankHint?.[i];if(x!=null&&I!=null&&x!==I)return I-x;const u=n.topoIndex.get(r)??0,p=n.topoIndex.get(i)??0;return u!==p?u-p:r.localeCompare(i)})[0]}d(ks,"chooseParent");function _s(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(_s,"buildAdjacency");function Fs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Fs,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((c,a)=>{e.set(c,++r),n.set(c,r);for(const l of t.get(c)??[])l!==a&&(e.has(l)?(e.get(l)??0)<(e.get(c)??0)&&(o.push([c,l]),n.set(c,Math.min(n.get(c)??r,e.get(l)??r))):(o.push([c,l]),i(l,c),n.set(c,Math.min(n.get(c)??r,n.get(l)??r)),(n.get(l)??0)>=(e.get(c)??0)&&s.push(Hs(c,l,o,s.length))))},"visit");for(const c of t.keys())e.has(c)||i(c,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[M,E]of o.entries())s.set(E,M);const r=o.length,i=new Array(r).fill(-1),c=new Array(r).fill(0),a=[],l=new Set;for(const M of o){const E=n.parent.get(M)??null,T=s.get(M);T!=null&&E==null&&(i[T]=-1,c[T]=0,l.has(M)||(l.add(M),a.push(M)))}for(;a.length>0;){const M=a.shift(),E=s.get(M);if(E==null)continue;const T=n.children.get(M)??[];for(const m of T){if(l.has(m))continue;const S=s.get(m);S!=null&&(i[S]=E,c[S]=c[E]+1,l.add(m),a.push(m))}}for(const M of o){if(l.has(M))continue;const E=s.get(M);E!=null&&(i[E]=-1,c[E]=0,l.add(M))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),x=Array.from({length:g},()=>new Array(r).fill(-1));for(let M=0;M{if(M===-1||E===-1)return-1;c[M]>m&1&&(M=x[m][M],M===-1))return-1;if(M===E)return M;for(let m=g-1;m>=0;m--){const S=x[m][M],A=x[m][E];S===-1||A===-1||S!==A&&(M=S,E=A)}return x[0][M]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const M of t.edges){let E=M.src,T=M.dst,m=e[E],S=e[T];if(m==null||S==null||(m>S&&([E,T]=[T,E],[m,S]=[S,m]),m==null||S==null||m===S))continue;const A=s.get(E),R=s.get(T);if(A==null||R==null)continue;const k=I(A,R);if(k===-1)continue;const O=u[k];for(let _=m;_{if(E.size!==0)for(const[T,m]of E)M.set(T,(M.get(T)??0)+m)},"mergeInto"),y=new Set,v=d(M=>{const E=s.get(M);y.add(M);const T=E==null?void 0:u[E],m=T?new Map(T):new Map,S=n.children.get(M)??[];for(const A of S){const R=v(A),k=e[M];if(k!=null){let O=p.get(M);O||(O=new Map,p.set(M,O));let _=R.get(k)??0;const H=e[A];H!=null&&H>k&&(_+=1),O.set(A,_)}f(m,R)}return m},"dfs");for(const M of n.roots)y.has(M)||v(M);for(const M of o)y.has(M)||v(M);return p}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const c=[...e.get(r)??[]];c.sort(Co(n));for(const a of c){s(a);const l=o.get(a);l!=null&&(i=Math.min(i,l))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Co(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Co,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const a of e){const l=n[a]??0;l>s&&(s=l)}const r=Array.from({length:s+1},()=>[]),i=new Set,c=d(a=>{if(i.has(a))return;i.add(a);const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a);for(const g of o(a))c(g)},"emit");for(const a of t)c(a);for(const a of e)if(!i.has(a)){const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a),i.add(a)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,c=[],a=[],l=n.get(s);for(const g of r){const x=o.get(g)??i;x>i?c.push({child:g,min:x}):a.push(g)}return c.sort((g,x)=>g.min===x.min?g.child.localeCompare(x.child):g.min-x.min),a.sort((g,x)=>{const I=l?.get(g)??0,u=l?.get(x)??0;if(I!==u)return I-u;const p=o.get(g)??i,f=o.get(x)??i;return p!==f?p-f:g.localeCompare(x)}),[...c.map(g=>g.child),...a]}}d(zs,"createChildOrderer");function rn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const x of t.nodes)s.has(x)||s.set(x,[]);const i=Xs(t,e,o),c=[...r].sort(Co(e)),a=Ys(c,s,e),l=zs(s,e,i,a);let g=Gs(c,t.nodes,e,l);return g=$s(g),g}d(rn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(e),i=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&i.push(r.get(c.dst));return Io(i)}d(Vs,"countCrossingsBetweenAdjacent");function Un(t,e,n){const o=[];for(const r of e){const i=n[r.src],c=n[r.dst];if(i==null||c==null||i===c)continue;let a=r.src,l=r.dst,g=i,x=c;i>c&&(a=r.dst,l=r.src,g=c,x=i);for(let I=g;I(n[I]??0)-(n[x]??0));for(const x of g){const I=n[x]??0;if(I===0)continue;let u=0;for(const v of o.get(x)??[])u=Math.max(u,(n[v]??0)+1);if(u>=I)continue;const p=I;n[x]=u;const f=rn(t,n,s),y=Un(f,t.edges,n);y(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(f=>f.src===s);if(i.length===0)continue;let c=!1,a=0;for(const f of i){const y=n(f.dst);y==null||y===r?c=!0:a++}if(a===0||c)continue;let l=0,g=!1;for(const f of t.edges){if(f.dst!==s)continue;const y=n(f.src);y&&(y===r?g=!0:l++)}if(l>0||!g)continue;const x=e[s]??0,I=x+a;let u=0;for(const f of t.edges)f.dst===s&&(u=Math.max(u,(e[f.src]??0)+1));const p=Math.max(x,u,I);p!==x&&(e[s]=p)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=ye(t),o=Be(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n);let i=Object.create(null);for(const a of o){const l=mo(n,a),g=e?.ignoreCrossLaneEdges?l.filter(x=>{const I=r(x.src),u=r(a);return!I||!u?!0:I===u}):l;if(g.length===0)i[a]=0;else if(s&&g.length===1){const x=g[0].src,I=r(x),u=r(a);I!==u?i[a]=i[x]??0:i[a]=(i[x]??0)+1}else{let x=-1/0;for(const I of g)x=Math.max(x,(i[I.src]??0)+1);i[a]=x===-1/0?0:x}}return(e?.optimizeRanksByCrossings??!1)&&(i=js(n,i)),e?.ignoreCrossLaneEdges&&Us(n,i),{layers:rn(n,i,r),rankOf:i,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=ye(t),s={...Ws(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:c}=ln(n,p=>{if(e?.ignoreCrossLaneEdges){const f=r(p.src),y=r(p.dst);if(f&&y&&f!==y)return!1}return!0}),a=Be(n)??[...n.nodes],l=[...a].reverse(),g=d((p,f)=>{let y=0;for(const E of i.get(p)??[])y=Math.max(y,(s[E]??0)+1);let v=Number.POSITIVE_INFINITY;const M=c.get(p)??[];return M.length>0&&(v=Math.min(...M.map(E=>(s[E]??0)-1))),Number.isFinite(v)||(v=Math.max(y,f)),Math.min(Math.max(f,y),v)},"clampFeasible"),x=sn.GRAVITY_ITERATIONS,I=d(p=>{let f=!1;for(const y of p){const v=i.get(y)??[],M=c.get(y)??[];if(v.length===0&&M.length===0)continue;const E=v.length>0?v.reduce((A,R)=>A+(s[R]??0)+1,0)/v.length:s[y]??0,T=M.length>0?M.reduce((A,R)=>A+(s[R]??0)-1,0)/M.length:s[y]??0,m=Math.round((E+T)/2),S=g(y,m);S!==s[y]&&(s[y]=S,f=!0)}return f},"relaxOrder");for(let p=0;p0){const y=Math.min(...f.map(v=>(s[v]??0)-1));(s[p]??0)>y&&(s[p]=y)}}return{layers:Mo(n,a,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=xo(t),n=yo(t);let o=bo(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const c of n.get(i)??[])e.set(c,(e.get(c)??0)-1),(e.get(c)??0)===0&&r.push(c)}o=r.sort((i,c)=>i.localeCompare(c))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=ye(t),o=e?.direction==="LR"?qs(n)??[...n.nodes].sort():Be(n)??[...n.nodes].sort(),s=fe(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),c=new Map,a=d((g,x)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(x)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const I=mo(n,g);let u=0;if(I.length>0)for(const v of I){const M=v.src,E=i[M]??0;u=Math.max(u,E+a(M,g))}const p=r(g),f=c.get(p)??0,y=Math.max(u,f);i[g]=y,c.set(p,y+1)}return{layers:Mo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=ye(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const c=new Map(n.nodeById),a=d(u=>{const p=`placeholder-${i++}`,f={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(p,f),r.add(p);s.length<=u;)s.push([]);return s[u].push(p),o[p]=u,p},"addDummyAt"),l=[...n.edges].sort((u,p)=>u.id===p.id?u.src===p.src?u.dst.localeCompare(p.dst):u.src.localeCompare(p.src):u.id.localeCompare(p.id)),g=[];for(const u of l){const p=o[u.src]??0,f=o[u.dst]??0;if(f-p<=1){g.push(u);continue}let y=u.src;for(let M=p+1,E=0;M!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:c};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function Wn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Wn,"median");function Kn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Kn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function qn(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(t),i=Ne(e),c=[];for(const l of n)o.has(l.src)&&s.has(l.dst)&&c.push({u:r.get(l.src),v:i.get(l.dst)});c.sort((l,g)=>l.u===g.u?l.v-g.v:l.u-g.u);const a=c.map(l=>l.v);return Io(a)}d(qn,"countCrossingsBetweenAdjacent");function We(t,e,n){return[...t].sort((o,s)=>{const r=Wn(e.get(o)??[]),i=Wn(e.get(s)??[]);return r===i?tr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(We,"sortByHeuristic");function Jn(t,e,n,o,s,r){const i=Ne(t),c=Ne(e),a=Qs(e,i,n,o);if(!s||!r||r.length===0)return We(e,a,c);const l=new Map;for(const I of e){const u=s(I),p=l.get(u)??[];p.push(I),l.set(u,p)}const g=[];for(const I of r){const u=l.get(I);if(!u||u.length===0)continue;const p=We(u,a,c);g.push(...p)}const x=l.get(null);if(x&&x.length>0){const I=We(x,a,c);for(const u of I){const p=Kn(a.get(u)??[]);let f=g.length;if(isFinite(p))for(const[y,v]of g.entries()){const M=Kn(a.get(v)??[]);if(pi.has(f.src)&&c.has(f.dst)),g=a?n.filter(f=>c.has(f.src)&&a.has(f.dst)):void 0,x=d(f=>{let y=qn(t,f,l);return g&&o&&(y+=qn(f,o,g)),y},"crossingScore"),I=s?new Map:null;if(s&&I)for(const f of e)I.set(f,s(f));let u=!0,p=x(r);for(;u;){u=!1;for(let f=0;f+1[...c]),s=e.edges,r=fe(e),i=So(e,n?.laneOrder);for(let c=0;c<3;c++){for(let a=1;a=0;a--)o[a]=Jn(o[a+1],o[a],s,"up",r,i),o[a]=Zn(o[a+1],o[a],s,o[a-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=n?.layerGap??ko.DEFAULT_LAYER_GAP,s=n?.nodeGap??ko.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",c=i==="LR"||i==="RL",a=t.layers,l=Object.create(null),g=Object.create(null),x=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>x(O)?.width??0,"getWidth"),u=d(O=>x(O)?.height??0,"getHeight"),p=fe(e),f=So(e,n?.laneOrder),y=a.map(O=>O.reduce((_,H)=>Math.max(_,u(H)),0)),v=[];if(c)for(let O=0;O+1Math.max(mt,I(kt)),0),H=a[O+1].reduce((mt,kt)=>Math.max(mt,I(kt)),0),P=y[O],G=y[O+1],j=P/2+G/2,J=(_+H)/2,dt=Math.max(0,J-j-o);v.push(dt)}const M=new Set;for(const O of a)for(const _ of O)M.add(p(_));const E=M.has(null),T=f.filter(O=>M.has(O)),m=[...E?[null]:[],...T],S=Object.create(null);for(const O of T)S[O]=0;E&&(S.null=0);for(const O of a){const _=Object.create(null),H=[];for(const P of O){const G=p(P);G===null?H.push(P):(_[G]||=[]).push(P)}for(const[P,G]of Object.entries(_)){const j=G.reduce((J,dt)=>J+I(dt),0)+s*Math.max(0,G.length-1);S[P]=Math.max(S[P]??0,j)}if(E&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);S.null=Math.max(S.null??0,P)}}const A=new Map;{const O=m.map(P=>(P===null?S.null:S[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,m.length-1))/2;for(let P=0;PI(Q)),kt=mt.reduce((Q,W)=>Q+W,0)+s*(J.length-1);let Pt=dt-kt/2;for(const[Q,W]of J.entries()){const et=mt[Q];l[W]=Pt+et/2,g[W]=R+H/2,Pt+=et+s}}}const G=v[O]??0;R+=H+o+G}const k=new Map;for(const O of e.edges){const _=O.ref.id;k.has(_)||k.set(_,[]),k.get(_).push(O)}for(const[,O]of k){if(O.length===0)continue;const _=O[0].ref,H=_.start,P=_.end;if(H==null||P==null)continue;const G=Math.round(((l[H]??0)+(l[P]??0))/2),j=new Set;for(const J of O)j.add(J.src),j.add(J.dst);for(const J of j){if(J===H||J===P)continue;e.nodeById.get(J)?.isDummy&&(l[J]=G)}}return{x:l,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function Qn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const c=n.get(s),a=n.get(r);c==null||a==null||(o+=i*Math.abs(c-a))}return o}d(Qn,"laneArrangementCost");function ar(t){const e=fn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=fe(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,c=typeof r.end=="string"?r.end:void 0;if(!i||!c||!t.nodeById.has(i)||!t.nodeById.has(c))continue;const a=o(i),l=o(c);if(!a||!l||a===l)continue;const g=n.get(a),x=n.get(l);if(g==null||x==null)continue;const[I,u]=g<=x?[a,l]:[l,a],p=`${I}\0${u}`,f=s.get(p);f?f.weight++:s.set(p,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function to(t,e,n){const o=[...t];let s=Qn(o,e),r=!0,i=0;const c=Math.max(1,o.length);for(;r&&is.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=fn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((c,a)=>[c,a]));let r=to(n,o,s);const i=Math.max(0,e.restarts??or);for(let c=0;cct&&a*3>=c?i>0?"bottom":"top":c>ct?r>0?"right":"left":n}d(eo,"chooseOrthogonalSide");function no(t,e){return Math.abs(t.to-e.from)h.isGroup&&!h.parentId);for(const h of l){const b={id:h.id},C=d(L=>{i.set(L.id,b),n.filter(w=>w.parentId===L.id).forEach(C)},"assignLane");C(h)}const g=n.filter(h=>!h.isGroup&&!h.isEdgeLabel).map(h=>{const b=h.width??10,C=h.height??10,L=h.x??0,w=h.y??0,B=Zr;return{nodeId:h.id,minX:L-b/2-B,maxX:L+b/2+B,minY:w-C/2-B,maxY:w+C/2+B,visualXHalfExtent:a?C/2+B:b/2+B}}),x=d((h,b,C,L)=>{let w=c.find(B=>B.orientation===h&&Math.abs(B.coord-b)<1);return w||(w={id:`pipe-${h}-${b.toFixed(0)}`,orientation:h,coord:b,spanMin:C,spanMax:L,tracks:[]},c.push(w)),w.spanMin=Math.min(w.spanMin,C),w.spanMax=Math.max(w.spanMax,L),w},"getOrAddPipe"),I=d((h,b)=>{const C=h.width??10,L=h.height??10,w=h.x??0,B=h.y??0;switch(b){case"top":return{x:w,y:B-L/2};case"bottom":return{x:w,y:B+L/2};case"left":return{x:w-C/2,y:B};case"right":return{x:w+C/2,y:B}}},"portForSide"),u=d((h,b,C)=>I(h,eo(h,b,C?"bottom":"top")),"getOrthogonalPort"),p=[],f=[],y=new Set,v=1e3,M=d((h,b,C)=>{if(p.length===0)return 0;const L=Math.abs(b.y-C.y)z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}else if(w){const U=b.x,q=Math.min(b.y,C.y)-ct,z=Math.max(b.y,C.y)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===h||Y.orientation!=="horizontal"||Y.pipe.coordz||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}return B},"crossingPenalty"),E=s.map((h,b)=>{if(!h.start||!h.end)return{idx:b,crossLane:0,dx:0,dy:0};const C=r.get(h.start),L=r.get(h.end),w=i.get(h.start),B=i.get(h.end),U=w&&B&&w.id!==B.id?1:0,q=C&&L?Math.abs((L.x??0)-(C.x??0)):0,z=C&&L?Math.abs((L.y??0)-(C.y??0)):0;return{idx:b,crossLane:U,dx:q,dy:z}}).sort((h,b)=>{if(h.crossLane!==b.crossLane)return b.crossLane-h.crossLane;const C=h.dx+h.dy,L=b.dx+b.dy;return Math.abs(C-L)>1?C-L:h.idx-b.idx}).map(h=>h.idx),T=d((h,b,C,L)=>{const w=Math.min(h.x,b.x),B=Math.max(h.x,b.x),U=Math.min(h.y,b.y),q=Math.max(h.y,b.y);return!!g.find(Y=>C&&Y.nodeId===C||L&&Y.nodeId===L?!1:Math.abs(h.x-b.x)>ct?Y.minYh.y&&Y.maxX>w&&Y.minXh.x&&Y.maxY>U&&Y.minYeo(h,b,"bottom"),"determineSide"),R=new Map;for(const[h,b]of s.entries()){if(!b.start||!b.end||b.start===b.end||b.points&&b.points.length>0)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const w=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);R.set(h,{edgeIdx:h,srcId:b.start,dstId:b.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(w),absDy:Math.abs(B),dxSign:Math.sign(w),dySign:Math.sign(B)})}const k=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.absDx===0?1/0:h.absDy/h.absDx:h.absDy===0?1/0:h.absDx/h.absDy,"preferenceStrength"),O=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.dxSign>=0?"right":"left":h.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const h of R.values()){const b=`${h.srcId}:${h.srcSide}`;_.has(b)||_.set(b,[]),_.get(b).push(h)}const H=new Map,P=d((h,b)=>`${h}:${b}`,"loadKey");for(const h of R.values())H.set(P(h.srcId,h.srcSide),(H.get(P(h.srcId,h.srcSide))??0)+1),H.set(P(h.dstId,h.dstSide),(H.get(P(h.dstId,h.dstSide))??0)+1);for(const h of _.values())if(!(h.length<2)){h.sort((b,C)=>{const L=k(b),w=k(C);return Math.abs(L-w)>1e-9?w-L:b.edgeIdx-C.edgeIdx});for(let b=1;b=w||(H.set(P(C.srcId,C.srcSide),w-1),H.set(P(C.srcId,L),B+1),C.srcSide=L)}}const G=d(h=>{const b=h?.shape;return b==="question"||b==="diamond"},"isDiamondNode"),j=new Map;for(const h of R.values())j.has(h.dstId)||j.set(h.dstId,new Set),j.get(h.dstId).add(h.dstSide);for(const h of R.values()){if(!G(r.get(h.srcId)))continue;const b=j.get(h.srcId);if(!b?.has(h.srcSide))continue;const C=O(h);if(b.has(C)||(H.get(P(h.srcId,C))??0)>0)continue;const L=H.get(P(h.srcId,h.srcSide))??0;H.set(P(h.srcId,h.srcSide),Math.max(0,L-1)),H.set(P(h.srcId,C),1),h.srcSide=C}for(const h of R.values()){const{edgeIdx:b,srcId:C,dstId:L,srcSide:w,dstSide:B}=h,U=r.get(C),q=r.get(L),z=`${C}:${w}:src`,Y=w==="top"||w==="bottom"?q.x??0:q.y??0;m.has(z)||m.set(z,[]),m.get(z).push({edgeIdx:b,oppositeCoord:Y});const ot=`${L}:${B}:dst`,rt=B==="top"||B==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:b,oppositeCoord:rt})}const J=new Map,dt=8;for(const[h,b]of m){if(b.length<2)continue;b.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);const C=h.split(":"),L=C.slice(0,-2).join(":"),w=C[C.length-2],B=C[C.length-1],U=r.get(L);if(!U)continue;const z=w==="left"||w==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?z*.3:z,tt=Math.min(20,Math.max(dt,rt/(b.length+1))),Rt=-(tt*(b.length-1))/2;for(const[Lt,Dt]of b.entries()){const Jt=Rt+Lt*tt,gn=`${Dt.edgeIdx}:${B}`;J.set(gn,Jt)}}const mt=d(h=>!!s[h]?.labelNodeId,"edgeHasLabelNode"),kt=d((h,b)=>h?(m.get(`${h}:${b}:src`)??[]).some(({edgeIdx:C})=>mt(C))||(m.get(`${h}:${b}:dst`)??[]).some(({edgeIdx:C})=>mt(C)):!1,"faceHasLabelNode"),Pt=d((h,b,C)=>b==="top"||b==="bottom"?{x:h.x+C,y:h.y}:{x:h.x,y:h.y+C},"applyPortOffset"),Q=d((h,b,C)=>{const L=R.get(h),w={x:C.x??0,y:C.y??0},B={x:b.x??0,y:b.y??0},U=L?.srcSide??A(b,w),q=L?.dstSide??A(C,B);let z=L?I(b,L.srcSide):u(b,w,!0),Y=L?I(C,L.dstSide):u(C,B,!1);const ot=J.get(`${h}:src`),rt=J.get(`${h}:dst`);return ot!==void 0&&(z=Pt(z,U,ot)),rt!==void 0&&(Y=Pt(Y,q,rt)),{pSrcPort:z,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const h of E){const b=s[h];if(f[h]=[],!b.start||!b.end||b.points&&b.points.length>0||b.start===b.end)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const{pSrcPort:w,pDstPort:B,srcSide:U,dstSide:q}=Q(h,C,L),z={...w},Y={...B},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=w.y>(C.y??0);z.y=X?w.y+ne:w.y-ne}else{const X=w.x>(C.x??0);z.x=X?w.x+ne:w.x-ne}if(rt){const X=B.y>(L.y??0);Y.y=X?B.y+ne:B.y-ne}else{const X=B.x>(L.x??0);Y.x=X?B.x+ne:B.x-ne}const st=d((X,$)=>{for(const K of g)if(!$.includes(K.nodeId)&&X.x>K.minX&&X.xK.minY&&X.y{if(Ct){const Nt=X.y>($.y??0);return{x:(K.x??0)>=X.x?lt.maxX+be:lt.minX-be,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>($.x??0),Et=(K.y??0)>=X.y;return{x:bt?lt.maxX+be:lt.minX-be,y:Et?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[b.start,b.end],Lt=st(z,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const $=tt(w,C,L,X,!0);z.x=$.x,z.y=$.y;const K=$.leavesPositiveSide?Math.min(X.minY-2,w.y+ne):Math.max(X.maxY+2,w.y-ne);yt=[{x:w.x,y:K},{x:$.x,y:K},{x:$.x,y:$.y}]}else{const $=tt(w,C,L,X,!1),K=$.leavesPositiveSide?Math.min(X.minX-2,w.x+ne):Math.max(X.maxX+2,w.x-ne);z.x=$.x,z.y=$.y,yt=[{x:K,y:w.y},{x:K,y:$.y},{x:$.x,y:$.y}]}}let Dt=[];const Jt=st(Y,Rt);if(Jt.inside&&Jt.obstacle){const X=Jt.obstacle;if(rt){const $=tt(B,L,C,X,!0);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:B.x,y:$.y}]}else{const $=tt(B,L,C,X,!1);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:$.x,y:B.y}]}}if(yt.length===0&&Dt.length===0){const X=be,$=Math.abs(z.x-Y.x)1||bt>1,Nt=S.get(b.start??"")??0,ut=S.get(b.end??"")??0,Yt=Ct>1&&kt(b.start,U)||bt>1&&kt(b.end,q),ee=Ct<=1||Nt<=2,Bt=bt<=1||ut<=2;if(($||K)&&!lt&&(!Et||Et&&!Yt&&ee&&Bt)&&!T(w,B,b.start,b.end)){b.points=[{...w},{...z},{...Y},{...B}],y.add(h);const Mt=K?"horizontal":"vertical",$t=K?w.y:w.x,It=K?Math.min(w.x,B.x):Math.min(w.y,B.y),St=K?Math.max(w.x,B.x):Math.max(w.y,B.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${h}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};p.push({edgeIndex:h,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}const gn=x("vertical",z.x,z.y,z.y);z.x=gn.coord;const mr=x("vertical",Y.x,Y.y,Y.y);Y.x=mr.coord;let ue=Math.min(z.x,Y.x)-50,he=Math.max(z.x,Y.x)+50,ve=Math.min(z.y,Y.y)-50,Le=Math.max(z.y,Y.y)+50;for(const X of g){const $=Math.min(z.x,Y.x),K=Math.max(z.x,Y.x),lt=Math.min(z.y,Y.y),Ct=Math.max(z.y,Y.y);X.minX$&&X.minYlt&&(ue=Math.min(ue,X.minX-je),he=Math.max(he,X.maxX+je),ve=Math.min(ve,X.minY-je),Le=Math.max(Le,X.maxY+je))}for(const X of g){if(X.maxXhe||X.maxYLe)continue;const $=be;x("horizontal",X.minY-$,ue,he),x("horizontal",X.maxY+$,ue,he);const K=Te;x("vertical",X.minX-K,ve,Le),x("vertical",X.maxX+K,ve,Le)}x("horizontal",z.y,ue,he),x("horizontal",Y.y,ue,he);const yr=c.filter(X=>X.orientation==="horizontal"&&X.coord>=ve&&X.coord<=Le),xr=c.filter(X=>X.orientation==="vertical"&&X.coord>=ue&&X.coord<=he),ke=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),_e=ke(z.x,z.y),vo=ke(Y.x,Y.y),Fe=new Map,pn=new Map,mn=new Map,De=new Set,xe=[];Fe.set(_e,0),mn.set(_e,"n"),xe.push({key:_e,f:Math.hypot(Y.x-z.x,Y.y-z.y),pt:z}),De.add(_e);let Ht=[];const ge=d((X,$)=>T(X,$,b.start,b.end),"checkSegmentBlocked"),yn={x:Y.x,y:z.y},br=ge(z,yn),Mr=ge(yn,Y),Ir=br||Mr,xn={x:z.x,y:Y.y},Sr=ge(z,xn),Cr=ge(xn,Y);if(Ir?Sr||Cr||(Math.abs(z.x-Y.x)0;){xe.sort((ut,Yt)=>ut.f-Yt.f);const X=xe.shift();if(De.delete(X.key),X.key===vo){let ut=vo,Yt=Y;for(Ht=[Yt];pn.has(ut);){const ee=pn.get(ut);Ht.unshift(ee),Yt=ee,ut=ke(ee.x,ee.y)}break}const $=X.pt.x,K=X.pt.y,lt=xr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-$)<1),bt=yr.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct0&&Nt.push({x:$,y:bt[Et-1].coord}),Et>=0&&EtZt.nodeId===b.start||Zt.nodeId===b.end?!1:Yt!==ee?Zt.minYK&&Zt.maxX>Yt&&Zt.minX$&&Zt.maxY>Bt&&Zt.minY10&&bn<-5||Ee<-10&&bn>5)&&(St=Math.abs(bn)*100),(Wt>10&&He<-5||Wt<-10&&He>5)&&(St+=Math.abs(He)*50);let Lo=0;const Eo=mn.get(X.key)??"n",To=Math.abs(He)>ct?"h":"v";Eo!=="n"&&Eo!==To&&(Lo=50);const vr=$t+It+St+Lo,Xe=(Fe.get(X.key)??1/0)+vr,wo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(Xe<(Fe.get(Mt)??1/0))if(pn.set(Mt,X.pt),Fe.set(Mt,Xe),mn.set(Mt,To),!De.has(Mt))xe.push({key:Mt,f:Xe+wo,pt:ut}),De.add(Mt);else{const Zt=xe.findIndex(Lr=>Lr.key===Mt);Zt!==-1&&(xe[Zt].f=Xe+wo)}}}if(Ht.length===0&&(Ht=[z,{x:z.x,y:Y.y},Y]),Ht.length>4){const X=Ht[0],$=Ht[Ht.length-1];let K=Math.min(X.x,$.x),lt=Math.max(X.x,$.x),Ct=Math.min(X.y,$.y),bt=Math.max(X.y,$.y);for(const Bt of Ht)K=Math.min(K,Bt.x),lt=Math.max(lt,Bt.x),Ct=Math.min(Ct,Bt.y),bt=Math.max(bt,Bt.y);const Et=lt>Math.max(X.x,$.x),Nt=KIt.minXGt&&It.minYOt);if($t.length>0){let It=Math.max(X.x,$.x);for(const St of $t){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Ee=Wt+St.visualXHalfExtent+Bt;It=Math.max(It,Ee)}isNaN(It)||(lt=It)}}if(Nt){const Gt=g.filter(Ot=>Ot.minXMath.min(X.y,$.y));if(Gt.length>0){let Ot=Math.min(X.x,$.x);for(const Mt of Gt){const It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Bt;Ot=Math.min(Ot,It)}K=Ot}}}const ut=d(Bt=>{const Gt=$.y>X.y,Ot=g.filter(It=>{const St=Math.min(X.x,$.x)It.minX,Wt=Math.min(X.y,$.y)It.minY;return St&&Wt});let Mt=Ot;if(a&&Ot.length>0){const It=Ot.filter(St=>St.minXBt);It.length>0&&(Mt=It)}if(Mt.length===0)return $.y;const $t=be;if(Gt){const St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<$.y-ct)return St}else{const St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>$.y+ct)return St}return $.y},"findBestReturnY"),Yt=d(Bt=>{const Gt=ut(Bt),Ot={x:Bt,y:X.y},Mt={x:Bt,y:Gt},$t={x:$.x,y:Gt},It=ge(X,Ot),St=ge(Ot,Mt),Wt=ge(Mt,$t),Ee=Gt!==$.y?ge($t,$):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-$.y)=3){const X=Xt[Xt.length-1],$=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-$.y)Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign($.y-K.y),Et=Math.sign(X.y-K.y);bt!==0&&bt===Et&&Math.abs($.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const ie=[Xt[0]];for(let X=1;X$.x,bt=lt.x>K.x;if(Ct!==bt){ie.push(K);continue}continue}if(Math.abs($.x-K.x)$.y,bt=lt.y>K.y;if(Ct!==bt){ie.push(K);continue}continue}ie.push(K)}ie.push(Xt[Xt.length-1]);for(let X=0;Xh.from{const w=!L.segments.some(U=>(U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex)&&W(U,h)),B=!C.segments.some(U=>(U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex)&&W(U,b));return w&&B?(h.trackIndex=L.index,b.trackIndex=C.index,C.segments=[...C.segments.filter(U=>U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex),{edgeIndex:b.edgeIndex,segmentIndex:b.segmentIndex,from:b.from,to:b.to}],L.segments=[...L.segments.filter(U=>U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex),{edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=d(h=>{const b=h.tracks.length;return h.tracks[b]={index:b,coord:h.coord,segments:[]},b},"createNewTrack"),gt=d((h,b)=>{const C=h.pipe.tracks[h.trackIndex];C.segments=C.segments.filter(w=>w.edgeIndex!==h.edgeIndex||w.segmentIndex!==h.segmentIndex),h.trackIndex=b,h.pipe.tracks[b].segments.push({edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to})},"moveSegmentToTrack"),xt=d((h,b)=>{const C=f[h.edgeIndex];for(const L of C){const w=p[L];w.pipe===h.pipe&>(w,b)}},"moveSegmentChainToTrack"),vt=d(h=>{const b=f[h.edgeIndex],C=b.indexOf(p.indexOf(h)),L=[];return C>0&&L.push(p[b[C-1]]),C{if(h.orientation===b.orientation)return!1;const C=h.orientation==="horizontal"?h:b,L=h.orientation==="horizontal"?b:h;return L.pipe.coord>C.from&&L.pipe.coordL.from&&C.pipe.coord{for(const C of h.tracks)if(!C.segments.some(w=>(w.edgeIndex!==b.edgeIndex||w.segmentIndex!==b.segmentIndex)&&W(w,b)))return C.index;return-1},"findAvailableTrack"),Ut=d((h,b)=>{if(h.trackIndex===b.trackIndex)return W(h,b);const C=vt(h),L=vt(b);return C.some(w=>L.some(B=>Vt(w,B)))},"segmentsConflict"),te=d((h,b,C)=>{if(et(h,b,h.pipe.tracks[h.trackIndex],b.pipe.tracks[b.trackIndex]))return;const L=jt(h.pipe,b);C(b,L!==-1?L:at(h.pipe))},"resolveTrackConflict"),Se=d(h=>{let b=0;for(let C=0;C{if(de.has(h))return de.get(h);const b=f[h];if(b.length===0){const q={dest:0,deviation:0,base:0,delta:0};return de.set(h,q),q}const L=p[b[0]].pipe.coord;let w=L;for(let q=1;qMath.abs(ot-L)?Y:ot;break}}const B=Math.abs(w-L),U={dest:w,deviation:B,base:L,delta:w-L};return de.set(h,U),U},"getDestInfo"),dn=d(()=>{let h=0;const b=new Map;for(const[L,w]of s.entries())f[L].length!==0&&w.start&&(b.has(w.start)||b.set(w.start,[]),b.get(w.start).push(L));const C=d(L=>{const w=s[L];if(!w.start||!w.end)return 0;const B=r.get(w.start),U=r.get(w.end);if(!B||!U)return 0;const q=(U.x??0)-(B.x??0),z=(U.y??0)-(B.y??0);return Math.abs(q)+Math.abs(z)},"getEdgeDistance");for(const L of b.values()){L.sort((B,U)=>{const q=Ce(B),z=Ce(U);if(Math.abs(q.deviation-z.deviation)>1)return q.deviation-z.deviation;if(Math.abs(q.dest-z.dest)>1)return q.dest-z.dest;const Y=C(B),ot=C(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=f[B].length,st=f[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=f[B][0],yt=f[U][0];if(p[tt]&&p[yt]){const Rt=p[tt],Lt=p[yt],Dt=Math.abs(Rt.to-Rt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});const w=L.map(B=>p[f[B][0]]);h+=Se(w)}return h},"fixSourceHandleCrossings"),un=d(()=>{let h=0;const b=new Map;for(const[C,L]of s.entries())f[C].length!==0&&L.end&&(b.has(L.end)||b.set(L.end,[]),b.get(L.end).push(C));for(const C of b.values()){C.sort((w,B)=>{const U=d(Y=>{const ot=f[Y];if(ot.length<2)return 0;const rt=p[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(w),z=U(B);return Math.abs(q-z)>.1?q-z:w-B});const L=C.map(w=>p[f[w][f[w].length-1]]);h+=Se(L)}return h},"fixTargetHandleCrossings"),hn=d(()=>{let h=0;for(const b of c){const C=[];for(const L of b.tracks)for(const w of L.segments){const B=f[w.edgeIndex].find(U=>p[U].segmentIndex===w.segmentIndex);B!==void 0&&C.push(p[B])}C.sort((L,w)=>L.edgeIndex-w.edgeIndex||L.segmentIndex-w.segmentIndex);for(let L=0;L{L.segments.forEach(w=>{b.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:L.index,from:w.from,to:w.to})})}),b.sort((L,w)=>L.from-w.from);const C=[];if(b.length>0){let L=[b[0]],w=b[0].to;for(let B=1;Bw.add(tt.trackIndex));const B=new Map;L.forEach(tt=>{const yt=Ce(tt.edgeIndex);B.set(tt.trackIndex,(B.get(tt.trackIndex)??0)+yt.delta)});const U=[...w].filter(tt=>(B.get(tt)??0)<-1),q=[...w].filter(tt=>(B.get(tt)??0)>1),z=[...w].filter(tt=>Math.abs(B.get(tt)??0)<=1);U.sort((tt,yt)=>(B.get(yt)??0)-(B.get(tt)??0)),q.sort((tt,yt)=>(B.get(tt)??0)-(B.get(yt)??0));const Y=d((tt,yt)=>{L.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?h.coord:yt;D.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,h.coord-ot*Cn);if(z.length===0&&w.size>0){const tt=[...w].sort((Lt,Dt)=>Math.abs(B.get(Lt)??0)-Math.abs(B.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),z.push(tt)}let rt=0;for(const tt of z){if(rt===0)Y(tt,h.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,h.coord+yt*Rt*Cn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,h.coord+st*Cn)}}for(const[h,b]of s.entries()){const C=f[h]??[];if(C.length===0)continue;const L=[],w=r.get(b.start),B=r.get(b.end),{pSrcPort:U,pDstPort:q}=Q(h,w,B),z=C.map(rt=>{const st=p[rt],tt=D.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});L.push(U);for(let rt=0;rtct&&L.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Jt=st.orient==="vertical"?(yt+Lt.from)/2:no(st,Lt);L.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===z.length-2)&&L.push(Me(st,no(st,Lt)));else if(Dt)L.push(Me(st,Lt.coord));else{const Jt=Math.abs(st.from-yt)ct||Math.abs(Y.y-q.y)>ct)&&L.push(q);const ot=[];L.length>0&&ot.push(L[0]);for(let rt=1;rtct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}b.points=ot}for(const h of s){const b=h.__originalEdge;b&&h.points&&(b.points=h.points)}t.edges=(t.edges??[]).filter(h=>!h.isLayoutOnly);const V=d((h,b)=>{const C=b.x??0,L=b.y??0,w=b.width??0,B=b.height??0;if(w<=0||B<=0)return h;const U=C-w/2,q=C+w/2,z=L-B/2,Y=L+B/2;if(h.xq||h.yY)return h;const ot=h.x-U,rt=q-h.x,st=h.y-z,tt=Y-h.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:h.y}:yt===rt?{x:q,y:h.y}:yt===st?{x:h.x,y:z}:{x:h.x,y:Y}},"nodeBoundaryClamp");for(const h of t.edges){const b=h.points;if(!b||b.length<2)continue;const C=h.start,L=h.end,w=C?r.get(C):void 0,B=L?r.get(L):void 0;w&&(b[0]=V(b[0],w)),B&&(b[b.length-1]=V(b[b.length-1],B))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function pr(t){const e=Jo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,c=gr(t),{ordered:a,coordinates:l}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:c});Zo(e,a,l,{nodeGap:n,layerGap:o});for(const g of t.edges??[])delete g.points;hr(t,c);for(const g of t.edges??[])(!g.curve||g.curve==="basis")&&(g.curve="rounded");return Rs(t,c),As(t),c}d(pr,"runSwimlaneLayoutCore");async function Qr(t,e){const n=e.select("g");wr(n,t.markers,t.type,t.diagramId),Ar(),Rr(),Nr(),Tr(),qo(t);const o=Qo(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await _o(n,t);pr(t),await Uo(t,s)}d(Qr,"render");export{Qr as render}; diff --git a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js new file mode 100644 index 00000000000..03ec388fe36 --- /dev/null +++ b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js @@ -0,0 +1,8 @@ +import{c as r,s as e}from"./flowDiagram-23GEKE2U-CzI-GKO4.js";import{_ as a}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var o=a(t=>`${e(t)} + .swimlane.cluster rect { + stroke: ${t.clusterBorder} !important; + } + [data-look="neo"].cluster rect { + filter: none; + } +`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DRwlvM9F.js b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DRwlvM9F.js deleted file mode 100644 index 82211d3f990..00000000000 --- a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DRwlvM9F.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as r,s as e}from"./flowDiagram-23GEKE2U-BJ9xq3_H.js";import{_ as a}from"./mermaid.core-Cahi9cr1.js";import"./chunk-5VM5RSS4-CfD0Yt-O.js";import"./chunk-XXDRQBXY-BmzWd-kT.js";import"./chunk-VR4S4FIN-he8WxbY-.js";import"./chunk-32BRIVSS-DAsxL712.js";import"./channel-Bob_1R_C.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var o=a(t=>`${e(t)} - .swimlane.cluster rect { - stroke: ${t.clusterBorder} !important; - } - [data-look="neo"].cluster rect { - filter: none; - } -`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DRuJB2Ns.js b/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js similarity index 99% rename from apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DRuJB2Ns.js rename to apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js index 354f15b31be..6787e09bf0b 100644 --- a/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DRuJB2Ns.js +++ b/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js @@ -1,4 +1,4 @@ -import{_ as o,z as pt,aa as Rt,ab as Ct,ac as Wt,c as gt,l as E,F as Pt,a1 as Bt,ad as ft,d as U,u as Vt,ae as Ft,q as zt}from"./mermaid.core-Cahi9cr1.js";import{d as ot}from"./arc-E_7M-TWh.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`: +import{_ as o,z as pt,aa as Rt,ab as Ct,ac as Wt,c as gt,l as E,F as Pt,a1 as Bt,ad as ft,d as U,u as Vt,ae as Ft,q as zt}from"./mermaid.core-CJB1tAev.js";import{d as ot}from"./arc-IkhU3FHH.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`: `+w.showPosition()+` Expecting `+Z.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(I+1)+": Unexpected "+(_==O?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:w.match,token:this.terminals_[_]||_,line:w.yylineno,loc:F,expected:Z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+_);switch(T[0]){case 1:l.push(_),x.push(w.yytext),u.push(w.yylloc),l.push(T[1]),_=null,R=w.yyleng,v=w.yytext,I=w.yylineno,F=w.yylloc;break;case 2:if(B=this.productions_[T[1]][1],C.$=x[x.length-B],C._$={first_line:u[u.length-(B||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(B||1)].first_column,last_column:u[u.length-1].last_column},K&&(C._$.range=[u[u.length-(B||1)].range[0],u[u.length-1].range[1]]),P=this.performAction.apply(C,[v,R,I,H.yy,T[1],x,u].concat(L)),typeof P<"u")return P;B&&(l=l.slice(0,-1*B*2),x=x.slice(0,-1*B),u=u.slice(0,-1*B)),l.push(this.productions_[T[1]][0]),x.push(C.$),u.push(C._$),X=S[l[l.length-2]][l[l.length-1]],l.push(X);break;case 3:return!0}}return!0},"parse")},m=(function(){var k={EOF:1,parseError:o(function(d,l){if(this.yy.parser)this.yy.parser.parseError(d,l);else throw new Error(d)},"parseError"),setInput:o(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:o(function(s){var d=s.length,l=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===p.length?this.yylloc.first_column:0)+p[p.length-l.length].length-l[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(s){this.unput(this.match.slice(s))},"less"),pastInput:o(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-DtEwf89X.js b/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js similarity index 99% rename from apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-DtEwf89X.js rename to apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js index 5ea024641f7..5780512f09f 100644 --- a/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-DtEwf89X.js +++ b/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js @@ -1,4 +1,4 @@ -import{b4 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as w,z as wt,F as Qt,d as ot,al as $t,aa as te,ab as ee,ac as ne,e as se,q as ie,B as oe,D as re}from"./mermaid.core-Cahi9cr1.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let f=e[e.length-1];for(let u=0;up.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(f)ct(n))}function $(t,n){let s=0;for(let e=0;ev.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx=1)break;for(let d=1;dl+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a{const y={};for(let h=0;hxt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;ul===f?0:lo.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;hy.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;bt[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(F=>D.has(F)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let T=!1;O.selectAll(".venn-area path").each(function(k){const F=this.getAttribute("d");k.sets.length==1&&F&&!b&&(T=!0,R[k.sets[0]]=Me(F))});function A(k){return F=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-F)+Z.x*F,y:Y.y*(1-F)+Z.y*F,radius:Y.radius*(1-F)+Z.radius*F}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(F=>I[F])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=K(G.exit()).remove();typeof G.transition=="function"&&j.selectAll("path").attrTween("d",A);const X=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` +import{b4 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as w,z as wt,F as Qt,d as ot,al as $t,aa as te,ab as ee,ac as ne,e as se,q as ie,B as oe,D as re}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let f=e[e.length-1];for(let u=0;up.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(f)ct(n))}function $(t,n){let s=0;for(let e=0;ev.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx=1)break;for(let d=1;dl+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a{const y={};for(let h=0;hxt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;ul===f?0:lo.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;hy.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;bt[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(F=>D.has(F)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let T=!1;O.selectAll(".venn-area path").each(function(k){const F=this.getAttribute("d");k.sets.length==1&&F&&!b&&(T=!0,R[k.sets[0]]=Me(F))});function A(k){return F=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-F)+Z.x*F,y:Y.y*(1-F)+Z.y*F,radius:Y.radius*(1-F)+Z.radius*F}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(F=>I[F])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=K(G.exit()).remove();typeof G.transition=="function"&&j.selectAll("path").attrTween("d",A);const X=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` M`,t,n),e.push(` m`,-s,0),e.push(` a`,s,s,0,1,0,s*2,0),e.push(` diff --git a/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-BX4cWW2k.js b/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js similarity index 98% rename from apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-BX4cWW2k.js rename to apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js index 6f08794ad30..6f6ac377fa3 100644 --- a/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-BX4cWW2k.js +++ b/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js @@ -1,4 +1,4 @@ -import{B as t,a as o,C as r,D as n,E as i,b as c,c as l,F as d,K as p,R as b,S as m,d as f,T as u,e as h,f as S,g as y,h as R,i as v,V as C,j as g,k as w,l as T,m as E,n as x,o as M,p as k,q as D,r as P,s as V,t as A,u as B,v as H,w as N,x as O,y as I,z,A as F,G as U,H as K,I as W,J as j,L as q,M as G,N as L,O as J,P as Q,Q as X,U as Y,W as Z,X as _,Y as $,Z as aa,_ as ea,$ as sa,a0 as ta,a1 as oa,a2 as ra,a3 as na,a4 as ia,a5 as ca,a6 as la,a7 as da,a8 as pa,a9 as ba,aa as ma,ab as fa,ac as ua,ad as ha,ae as Sa,af as ya,ag as Ra,ah as va,ai as Ca,aj as ga,ak as wa,al as Ta,am as Ea,an as xa,ao as Ma,ap as ka,aq as Da,ar as Pa,as as Va,at as Aa,au as Ba,av as Ha,aw as Na,ax as Oa,ay as Ia,az as za,aA as Fa,aB as Ua,aC as Ka,aD as Wa,aE as ja,aF as qa,aG as Ga,aH as La,aI as Ja,aJ as Qa,aK as Xa,aL as Ya,aM as Za,aN as _a,aO as $a,aP as ae,aQ as ee,aR as se,aS as te,aT as oe,aU as re,aV as ne,aW as ie,aX as ce,aY as le,aZ as de,a_ as pe,a$ as be,b0 as me,b1 as fe,b2 as ue,b3 as he,b4 as Se,b5 as ye,b6 as Re,b7 as ve,b8 as Ce,b9 as ge,ba as we,bb as Te,bc as Ee,bd as xe,be as Me,bf as ke,bg as De,bh as Pe,bi as Ve,bj as Ae,bk as Be,bl as He,bm as Ne,bn as Oe,bo as Ie,bp as ze,bq as Fe,br as Ue,bs as Ke,bt as We,bu as je,bv as qe,bw as Ge,bx as Le,by as Je,bz as Qe,bA as Xe,bB as Ye,bC as Ze,bD as _e,bE as $e,bF as as,bG as es,bH as ss,bI as ts,bJ as os,bK as rs,bL as ns,bM as is,bN as cs,bO as ls,bP as ds}from"./index-HRJ6xRtC.js";/** +import{B as t,a as o,C as r,D as n,E as i,b as c,c as l,F as d,K as p,R as b,S as m,d as f,T as u,e as h,f as S,g as y,h as R,i as v,V as C,j as g,k as w,l as T,m as E,n as x,o as M,p as k,q as D,r as P,s as V,t as A,u as B,v as H,w as N,x as O,y as I,z,A as F,G as U,H as K,I as W,J as j,L as q,M as G,N as L,O as J,P as Q,Q as X,U as Y,W as Z,X as _,Y as $,Z as aa,_ as ea,$ as sa,a0 as ta,a1 as oa,a2 as ra,a3 as na,a4 as ia,a5 as ca,a6 as la,a7 as da,a8 as pa,a9 as ba,aa as ma,ab as fa,ac as ua,ad as ha,ae as Sa,af as ya,ag as Ra,ah as va,ai as Ca,aj as ga,ak as wa,al as Ta,am as Ea,an as xa,ao as Ma,ap as ka,aq as Da,ar as Pa,as as Va,at as Aa,au as Ba,av as Ha,aw as Na,ax as Oa,ay as Ia,az as za,aA as Fa,aB as Ua,aC as Ka,aD as Wa,aE as ja,aF as qa,aG as Ga,aH as La,aI as Ja,aJ as Qa,aK as Xa,aL as Ya,aM as Za,aN as _a,aO as $a,aP as ae,aQ as ee,aR as se,aS as te,aT as oe,aU as re,aV as ne,aW as ie,aX as ce,aY as le,aZ as de,a_ as pe,a$ as be,b0 as me,b1 as fe,b2 as ue,b3 as he,b4 as Se,b5 as ye,b6 as Re,b7 as ve,b8 as Ce,b9 as ge,ba as we,bb as Te,bc as Ee,bd as xe,be as Me,bf as ke,bg as De,bh as Pe,bi as Ve,bj as Ae,bk as Be,bl as He,bm as Ne,bn as Oe,bo as Ie,bp as ze,bq as Fe,br as Ue,bs as Ke,bt as We,bu as je,bv as qe,bw as Ge,bx as Le,by as Je,bz as Qe,bA as Xe,bB as Ye,bC as Ze,bD as _e,bE as $e,bF as as,bG as es,bH as ss,bI as ts,bJ as os,bK as rs,bL as ns,bM as is,bN as cs,bO as ls,bP as ds}from"./index-D-7nOosq.js";/** * vue v3.5.39 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT diff --git a/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BQgMNH39.js b/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js similarity index 99% rename from apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BQgMNH39.js rename to apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js index df9e4a583d4..51ea343973f 100644 --- a/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BQgMNH39.js +++ b/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js @@ -1,4 +1,4 @@ -import{p as St}from"./chunk-JWPE2WC7-DTx-f56M.js";import{s as Mt,g as Nt,p as zt,o as Lt,a as Tt,b as At,_ as u,W as Xt,z as Et,B as U,l as K,F as Yt,e as It,q as Bt,c as j}from"./mermaid.core-Cahi9cr1.js";import{p as Ft}from"./cynefin-VYW2F7L2-C5gNr-Q4.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";var D=u((e,n)=>{const r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${n} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),A=u((e,n,r)=>({x:D(n,`${r} evolution`),y:D(e,`${r} visibility`)}),"toCoordinates"),J=u(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),Rt=u(e=>{if(!e?.startsWith("+"))return{};const r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),Ot=u((e,n)=>{if(St(e,n),e.size&&n.setSize(e.size.width,e.size.height),e.evolution){const r=e.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),x=e.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);n.updateAxes({stages:r,stageBoundaries:x})}if(e.anchors.forEach(r=>{const x=A(r.visibility,r.evolution,`Anchor "${r.name}"`);n.addNode(r.name,r.name,x.x,x.y,"anchor")}),e.components.forEach(r=>{const x=A(r.visibility,r.evolution,`Component "${r.name}"`),a=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,d=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,w=r.decorator?.strategy;n.addNode(r.name,r.name,x.x,x.y,"component",a,d,r.inertia,w)}),e.notes.forEach(r=>{const x=A(r.visibility,r.evolution,`Note "${r.text}"`);n.addNote(r.text,x.x,x.y)}),e.pipelines.forEach(r=>{const x=n.getNode(r.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);const a=x.y;n.startPipeline(r.parent),r.components.forEach(d=>{const w=`${r.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,F=D(d.evolution,`Pipeline component "${d.name}" evolution`);n.addNode(w,d.name,F,a,"pipeline-component",C,g),n.addPipelineComponent(r.parent,w)})}),e.links.forEach(r=>{const x=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-."));let a=J(r.fromPort)??J(r.toPort);const{flow:d,label:w}=Rt(r.arrow);!a&&d&&(a=d);const C=r.linkLabel,g=w??C;n.addLink(n.resolveNodeId(r.from),n.resolveNodeId(r.to),x,g,a)}),e.evolves.forEach(r=>{const x=n.getNode(r.component);if(x?.y!==void 0){const a=D(r.target,`Evolve target for "${r.component}"`);n.addTrend(r.component,a,x.y)}}),e.annotations.length>0){const r=e.annotations[0],x=A(r.x,r.y,"Annotations box");n.setAnnotationsBox(x.x,x.y)}e.annotation.forEach(r=>{const x=A(r.x,r.y,`Annotation ${r.number}`);n.addAnnotation(r.number,[{x:x.x,y:x.y}],r.text)}),e.accelerators.forEach(r=>{const x=A(r.x,r.y,`Accelerator "${r.name}"`);n.addAccelerator(r.name,x.x,x.y)}),e.deaccelerators.forEach(r=>{const x=A(r.x,r.y,`Deaccelerator "${r.name}"`);n.addDeaccelerator(r.name,x.x,x.y)})},"populateDb"),Q={parser:{yy:void 0},parse:u(async e=>{const n=await Ft("wardley",e);K.debug(n);const r=Q.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ot(n,r)},"parse")},Wt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{u(this,"WardleyBuilder")}addNode(e){const n=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...n,...e,className:e.className??n.className,labelOffsetX:e.labelOffsetX??n.labelOffsetX,labelOffsetY:e.labelOffsetY??n.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});const n=this.nodes.get(e);n&&(n.isPipelineParent=!0)}addPipelineComponent(e,n){const r=this.pipelines.get(e);r&&r.componentIds.push(n);const x=this.nodes.get(n);x&&(x.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,n){this.annotationsBox={x:e,y:n}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,n){this.size={width:e,height:n}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(const[n,r]of this.nodes)if(r.label===e)return n;return e}build(){const e=[];for(const n of this.nodes.values()){if(typeof n.x!="number"||typeof n.y!="number")throw new Error(`Node "${n.label}" is missing coordinates`);e.push(n)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},k=new Wt;function tt(){return j()["wardley-beta"]}u(tt,"getConfig");function et(e,n,r,x,a,d,w,C,g){k.addNode({id:e,label:n,x:r,y:x,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(et,"addNode");function at(e,n,r=!1,x,a){k.addLink({source:e,target:n,dashed:r,label:x,flow:a})}u(at,"addLink");function rt(e,n,r){k.addTrend({nodeId:e,targetX:n,targetY:r})}u(rt,"addTrend");function ot(e,n,r){k.addAnnotation({number:e,coordinates:n,text:r})}u(ot,"addAnnotation");function nt(e,n,r){k.addNote({text:e,x:n,y:r})}u(nt,"addNote");function st(e,n,r){k.addAccelerator({name:e,x:n,y:r})}u(st,"addAccelerator");function it(e,n,r){k.addDeaccelerator({name:e,x:n,y:r})}u(it,"addDeaccelerator");function dt(e,n){k.setAnnotationsBox(e,n)}u(dt,"setAnnotationsBox");function lt(e,n){k.setSize(e,n)}u(lt,"setSize");function ct(e){k.startPipeline(e)}u(ct,"startPipeline");function pt(e,n){k.addPipelineComponent(e,n)}u(pt,"addPipelineComponent");function ft(e){k.setAxes(e)}u(ft,"updateAxes");function ht(e){return k.getNode(e)}u(ht,"getNode");function xt(e){return k.resolveNodeId(e)}u(xt,"resolveNodeId");function gt(){return k.build()}u(gt,"getWardleyData");function yt(){k.clear(),Bt()}u(yt,"clear");var Dt={getConfig:tt,addNode:et,addLink:at,addTrend:rt,addAnnotation:ot,addNote:nt,addAccelerator:st,addDeaccelerator:it,setAnnotationsBox:dt,setSize:lt,startPipeline:ct,addPipelineComponent:pt,updateAxes:ft,getNode:ht,resolveNodeId:xt,getWardleyData:gt,clear:yt,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},Gt=["Genesis","Custom Built","Product","Commodity"],qt=u(()=>{const{themeVariables:e}=j();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),Ht=u(()=>{const e=j()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),jt=u((e,n,r,x)=>{K.debug(`Rendering Wardley map +import{p as St}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{s as Mt,g as Nt,p as zt,o as Lt,a as Tt,b as At,_ as u,W as Xt,z as Et,B as U,l as K,F as Yt,e as It,q as Bt,c as j}from"./mermaid.core-CJB1tAev.js";import{p as Ft}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var D=u((e,n)=>{const r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${n} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),A=u((e,n,r)=>({x:D(n,`${r} evolution`),y:D(e,`${r} visibility`)}),"toCoordinates"),J=u(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),Rt=u(e=>{if(!e?.startsWith("+"))return{};const r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),Ot=u((e,n)=>{if(St(e,n),e.size&&n.setSize(e.size.width,e.size.height),e.evolution){const r=e.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),x=e.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);n.updateAxes({stages:r,stageBoundaries:x})}if(e.anchors.forEach(r=>{const x=A(r.visibility,r.evolution,`Anchor "${r.name}"`);n.addNode(r.name,r.name,x.x,x.y,"anchor")}),e.components.forEach(r=>{const x=A(r.visibility,r.evolution,`Component "${r.name}"`),a=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,d=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,w=r.decorator?.strategy;n.addNode(r.name,r.name,x.x,x.y,"component",a,d,r.inertia,w)}),e.notes.forEach(r=>{const x=A(r.visibility,r.evolution,`Note "${r.text}"`);n.addNote(r.text,x.x,x.y)}),e.pipelines.forEach(r=>{const x=n.getNode(r.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);const a=x.y;n.startPipeline(r.parent),r.components.forEach(d=>{const w=`${r.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,F=D(d.evolution,`Pipeline component "${d.name}" evolution`);n.addNode(w,d.name,F,a,"pipeline-component",C,g),n.addPipelineComponent(r.parent,w)})}),e.links.forEach(r=>{const x=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-."));let a=J(r.fromPort)??J(r.toPort);const{flow:d,label:w}=Rt(r.arrow);!a&&d&&(a=d);const C=r.linkLabel,g=w??C;n.addLink(n.resolveNodeId(r.from),n.resolveNodeId(r.to),x,g,a)}),e.evolves.forEach(r=>{const x=n.getNode(r.component);if(x?.y!==void 0){const a=D(r.target,`Evolve target for "${r.component}"`);n.addTrend(r.component,a,x.y)}}),e.annotations.length>0){const r=e.annotations[0],x=A(r.x,r.y,"Annotations box");n.setAnnotationsBox(x.x,x.y)}e.annotation.forEach(r=>{const x=A(r.x,r.y,`Annotation ${r.number}`);n.addAnnotation(r.number,[{x:x.x,y:x.y}],r.text)}),e.accelerators.forEach(r=>{const x=A(r.x,r.y,`Accelerator "${r.name}"`);n.addAccelerator(r.name,x.x,x.y)}),e.deaccelerators.forEach(r=>{const x=A(r.x,r.y,`Deaccelerator "${r.name}"`);n.addDeaccelerator(r.name,x.x,x.y)})},"populateDb"),Q={parser:{yy:void 0},parse:u(async e=>{const n=await Ft("wardley",e);K.debug(n);const r=Q.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ot(n,r)},"parse")},Wt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{u(this,"WardleyBuilder")}addNode(e){const n=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...n,...e,className:e.className??n.className,labelOffsetX:e.labelOffsetX??n.labelOffsetX,labelOffsetY:e.labelOffsetY??n.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});const n=this.nodes.get(e);n&&(n.isPipelineParent=!0)}addPipelineComponent(e,n){const r=this.pipelines.get(e);r&&r.componentIds.push(n);const x=this.nodes.get(n);x&&(x.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,n){this.annotationsBox={x:e,y:n}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,n){this.size={width:e,height:n}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(const[n,r]of this.nodes)if(r.label===e)return n;return e}build(){const e=[];for(const n of this.nodes.values()){if(typeof n.x!="number"||typeof n.y!="number")throw new Error(`Node "${n.label}" is missing coordinates`);e.push(n)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},k=new Wt;function tt(){return j()["wardley-beta"]}u(tt,"getConfig");function et(e,n,r,x,a,d,w,C,g){k.addNode({id:e,label:n,x:r,y:x,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(et,"addNode");function at(e,n,r=!1,x,a){k.addLink({source:e,target:n,dashed:r,label:x,flow:a})}u(at,"addLink");function rt(e,n,r){k.addTrend({nodeId:e,targetX:n,targetY:r})}u(rt,"addTrend");function ot(e,n,r){k.addAnnotation({number:e,coordinates:n,text:r})}u(ot,"addAnnotation");function nt(e,n,r){k.addNote({text:e,x:n,y:r})}u(nt,"addNote");function st(e,n,r){k.addAccelerator({name:e,x:n,y:r})}u(st,"addAccelerator");function it(e,n,r){k.addDeaccelerator({name:e,x:n,y:r})}u(it,"addDeaccelerator");function dt(e,n){k.setAnnotationsBox(e,n)}u(dt,"setAnnotationsBox");function lt(e,n){k.setSize(e,n)}u(lt,"setSize");function ct(e){k.startPipeline(e)}u(ct,"startPipeline");function pt(e,n){k.addPipelineComponent(e,n)}u(pt,"addPipelineComponent");function ft(e){k.setAxes(e)}u(ft,"updateAxes");function ht(e){return k.getNode(e)}u(ht,"getNode");function xt(e){return k.resolveNodeId(e)}u(xt,"resolveNodeId");function gt(){return k.build()}u(gt,"getWardleyData");function yt(){k.clear(),Bt()}u(yt,"clear");var Dt={getConfig:tt,addNode:et,addLink:at,addTrend:rt,addAnnotation:ot,addNote:nt,addAccelerator:st,addDeaccelerator:it,setAnnotationsBox:dt,setSize:lt,startPipeline:ct,addPipelineComponent:pt,updateAxes:ft,getNode:ht,resolveNodeId:xt,getWardleyData:gt,clear:yt,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},Gt=["Genesis","Custom Built","Product","Commodity"],qt=u(()=>{const{themeVariables:e}=j();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),Ht=u(()=>{const e=j()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),jt=u((e,n,r,x)=>{K.debug(`Rendering Wardley map `+e);const a=Ht(),d=qt(),w=a.nodeRadius*1.6,C=x.db,g=C.getWardleyData(),F=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,E=Yt(n);E.selectAll("*").remove(),It(E,b,S,a.useMaxWidth),E.attr("viewBox",`0 0 ${S} ${b}`);const v=E.append("g").attr("class","wardley-map"),G=E.append("defs");G.append("marker").attr("id",`arrow-${n}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-end-${n}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-start-${n}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const Y=S-a.padding*2,I=b-a.padding*2;F&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(F);const z=u(t=>a.padding+t/100*Y,"projectX"),L=u(t=>b-a.padding-t/100*I,"projectY"),R=v.append("g").attr("class","wardley-axes");R.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),R.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const ut=g.axes.xLabel??"Evolution",wt=g.axes.yLabel??"Visibility";R.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+Y/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(ut),R.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+I/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+I/2})`).text(wt);const B=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:Gt;if(B.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,o=[];if(s&&s.length===B.length){let i=0;s.forEach(p=>{o.push({start:i,end:p}),i=p})}else{const i=1/B.length;B.forEach((p,l)=>{o.push({start:l*i,end:(l+1)*i})})}B.forEach((i,p)=>{const l=o[p],f=a.padding+l.start*Y,h=a.padding+l.end*Y,y=(f+h)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const o=s/4,i=a.padding+Y*o;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-I*o).attr("y2",b-a.padding-I*o).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(o=>{if(o.componentIds.length===0)return;const i=o.componentIds.map(h=>({id:h,pos:c.get(h),node:g.nodes.find(y=>y.id===h)})).filter(h=>h.pos&&h.node).sort((h,y)=>h.node.x-y.node.x);for(let h=0;h{const y=c.get(h);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,m=f-y/2,P=c.get(o.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=m-w/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",m).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const V=v.append("g").attr("class","wardley-links"),_=new Map;g.pipelines.forEach(t=>{_.set(t.nodeId,new Set(t.componentIds))});const Z=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||_.get(t.target)?.has(t.source)));V.selectAll("line").data(Z).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.x+l/h*p}).attr("y1",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.y+f/h*p}).attr("x2",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.x+l/h*p}).attr("y2",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.y+f/h*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${n})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${n})`:null),V.selectAll("text").data(Z.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=o.y-s.y,l=o.x-s.x,f=Math.sqrt(l*l+p*p),h=8,y=p/f;return i+y*h}).attr("y",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.y+o.y)/2,p=o.x-s.x,l=o.y-s.y,f=Math.sqrt(p*p+l*l),h=8,y=-p/f;return i+y*h}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=(s.y+o.y)/2,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f),y=8,m=f/h,P=-l/h,N=i+m*y,O=p+P*y;let X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${O})`}).text(t=>t.label);const mt=v.append("g").attr("class","wardley-trends"),kt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const o=z(t.targetX),i=L(t.targetY),p=o-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),h=a.nodeRadius+2,y=f>h?o-p/f*h:o,m=f>h?i-l/f*h:i;return{origin:s,targetX:o,targetY:i,adjustedX2:y,adjustedY2:m}}).filter(t=>t!==null);mt.selectAll("line").data(kt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${n})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const q=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-w/2).attr("y",t=>c.get(t.id).y-w/2).attr("width",w).attr("height",w).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let o=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y1",t=>{const s=c.get(t.id),o=t.isPipelineParent?w:a.nodeRadius*2;return s.y-o/2}).attr("x2",t=>{const s=c.get(t.id);let o=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y2",t=>{const s=c.get(t.id),o=t.isPipelineParent?w:a.nodeRadius*2;return s.y+o/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let o=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(o+=10);const i=t.labelOffsetX??o;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let o=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(o-=10);const i=t.labelOffsetY??o;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const o=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(o.length>1)for(let i=0;i{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),o=L(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),h=[...g.annotations].filter(m=>m.text).sort((m,P)=>m.number-P.number),y=[];if(h.forEach((m,P)=>{const N=f.append("text").attr("x",s+i).attr("y",o+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${m.number}. ${m.text}`);y.push(N)}),y.length>0){let m=0,P=0;y.forEach(H=>{const W=H.node(),Pt=W.getComputedTextLength();m=Math.max(m,Pt);const Ct=W.getBBox();P=Math.max(P,Ct.height)});const N=m+i*2+105,O=h.length*p+i*2+P/2,X=a.padding,bt=S-a.padding-N,$t=a.padding,vt=b-a.padding-O;s=Math.max(X,Math.min(s,bt)),o=Math.max($t,Math.min(o,vt)),y.forEach((H,W)=>{H.attr("x",s+i).attr("y",o+i+(W+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",o).attr("width",N).attr("height",O).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const o=z(s.x),i=L(s.y);t.append("text").attr("x",o).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const o=z(s.x),i=L(s.y),p=60,l=30,f=20,h=` M ${o} ${i-l/2} L ${o+p-f} ${i-l/2} diff --git a/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-DJUplk_O.js b/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js similarity index 99% rename from apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-DJUplk_O.js rename to apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js index aab1b0fb0c0..71acb3f139a 100644 --- a/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-DJUplk_O.js +++ b/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js @@ -1,4 +1,4 @@ -import{s as si,g as ai,p as Et,o as ni,a as oi,b as ri,_ as n,l as It,F as hi,e as li,q as ci,z as pt,i as ui,B as Mt,D as gi,W as xi,az as di,a7 as Dt}from"./mermaid.core-Cahi9cr1.js";import{i as fi}from"./init-Gi6I4Gst.js";import{o as pi}from"./ordinal-Cboi1Yqb.js";import{l as vt}from"./linear-DHRafvZW.js";import"./index-HRJ6xRtC.js";import"./_commonjsHelpers-CqkleIqs.js";import"./defaultLocale-DX6XiGOO.js";function mi(t,i,e){t=+t,i=+i,e=(a=arguments.length)<2?(i=t,t=0,1):a<3?1:+e;for(var s=-1,a=Math.max(0,Math.ceil((i-t)/e))|0,c=new Array(a);++s"u"&&(D.yylloc={});var ht=D.yylloc;o.push(ht);var ii=D.options&&D.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ei(z){g.length=g.length-2*z,w.length=w.length-z,o.length=o.length-z}n(ei,"popStack");function kt(){var z;return z=x.pop()||D.lex()||_t,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=u.symbols_[z]||z),z}n(kt,"lex");for(var M,$,O,lt,G={},st,N,Tt,at;;){if($=g[g.length-1],this.defaultActions[$]?O=this.defaultActions[$]:((M===null||typeof M>"u")&&(M=kt()),O=K[$]&&K[$][M]),typeof O>"u"||!O.length||!O[0]){var ct="";at=[];for(st in K[$])this.terminals_[st]&&st>Jt&&at.push("'"+this.terminals_[st]+"'");D.showPosition?ct="Parse error on line "+(et+1)+`: +import{s as si,g as ai,p as Et,o as ni,a as oi,b as ri,_ as n,l as It,F as hi,e as li,q as ci,z as pt,i as ui,B as Mt,D as gi,W as xi,az as di,a7 as Dt}from"./mermaid.core-CJB1tAev.js";import{i as fi}from"./init-Gi6I4Gst.js";import{o as pi}from"./ordinal-Cboi1Yqb.js";import{l as vt}from"./linear-DH49UJnN.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./defaultLocale-DX6XiGOO.js";function mi(t,i,e){t=+t,i=+i,e=(a=arguments.length)<2?(i=t,t=0,1):a<3?1:+e;for(var s=-1,a=Math.max(0,Math.ceil((i-t)/e))|0,c=new Array(a);++s"u"&&(D.yylloc={});var ht=D.yylloc;o.push(ht);var ii=D.options&&D.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ei(z){g.length=g.length-2*z,w.length=w.length-z,o.length=o.length-z}n(ei,"popStack");function kt(){var z;return z=x.pop()||D.lex()||_t,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=u.symbols_[z]||z),z}n(kt,"lex");for(var M,$,O,lt,G={},st,N,Tt,at;;){if($=g[g.length-1],this.defaultActions[$]?O=this.defaultActions[$]:((M===null||typeof M>"u")&&(M=kt()),O=K[$]&&K[$][M]),typeof O>"u"||!O.length||!O[0]){var ct="";at=[];for(st in K[$])this.terminals_[st]&&st>Jt&&at.push("'"+this.terminals_[st]+"'");D.showPosition?ct="Parse error on line "+(et+1)+`: `+D.showPosition()+` Expecting `+at.join(", ")+", got '"+(this.terminals_[M]||M)+"'":ct="Parse error on line "+(et+1)+": Unexpected "+(M==_t?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(ct,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:ht,expected:at})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+M);switch(O[0]){case 1:g.push(M),w.push(D.yytext),o.push(D.yylloc),g.push(O[1]),M=null,Rt=D.yyleng,d=D.yytext,et=D.yylineno,ht=D.yylloc;break;case 2:if(N=this.productions_[O[1]][1],G.$=w[w.length-N],G._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},ii&&(G._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),lt=this.performAction.apply(G,[d,Rt,et,U.yy,O[1],w,o].concat(ti)),typeof lt<"u")return lt;N&&(g=g.slice(0,-1*N*2),w=w.slice(0,-1*N),o=o.slice(0,-1*N)),g.push(this.productions_[O[1]][0]),w.push(G.$),o.push(G._$),Tt=K[g[g.length-2]][g[g.length-1]],g.push(Tt);break;case 3:return!0}}return!0},"parse")},Q=(function(){var F={EOF:1,parseError:n(function(u,g){if(this.yy.parser)this.yy.parser.parseError(u,g);else throw new Error(u)},"parseError"),setInput:n(function(r,u){return this.yy=u||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var u=r.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:n(function(r){var u=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(r){this.unput(this.match.slice(r))},"less"),pastInput:n(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var r=this.pastInput(),u=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/boot.js b/apps/kimi-code/dist-web/boot.js index f1f26b8a9a3..c7f5f5c9cfd 100644 --- a/apps/kimi-code/dist-web/boot.js +++ b/apps/kimi-code/dist-web/boot.js @@ -4,7 +4,7 @@ if (v === 'light' || v === 'dark' || v === 'system') { document.documentElement.dataset.colorScheme = v; } - // Font scale, with the same migration rules as useAppearance (web-core): + // Font scale, with the same migration rules as useAppearance (app-core): // the retired 'xxlarge' lands on 'xlarge', and a legacy px key maps onto // the nearest step — seeded pre-paint so a non-Medium user never flashes // the Medium scale before the bundle runs. diff --git a/apps/kimi-code/dist-web/index.html b/apps/kimi-code/dist-web/index.html index 38875bc3f31..f98318975c8 100644 --- a/apps/kimi-code/dist-web/index.html +++ b/apps/kimi-code/dist-web/index.html @@ -14,8 +14,8 @@ the server's Content-Security-Policy forbids inline scripts. --> Kimi Code Web - - + +

        From 101c4d199746bf2ed4f26375b65a6fcb6cba2a60 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Wed, 12 Aug 2026 11:41:02 +0800 Subject: [PATCH 15/50] feat(agent-core-v2): remove Agent and AgentSwarm from builtin profile tool lists (#2837) * feat(agent-core-v2): remove Agent and AgentSwarm from builtin profile tool lists The builtin agent and coder profiles no longer expose the Agent and AgentSwarm tools, so sessions on the v2 engine do not offer subagent delegation by default. The tools themselves remain registered; profiles that list them explicitly can still opt in. * feat(agent-core): remove Agent and AgentSwarm from builtin profile tool lists Align the v1 builtin agent/coder profiles with the v2 change: the default profiles no longer offer subagent delegation, while the tools stay registered for profiles that list them explicitly. The parity projection drops v1's inactive Agent/AgentSwarm roster entries: v1 reports registered-but-inactive builtin tools where v2 only registers the tools a profile lists, so an inactive entry has no v2 counterpart. Active entries still compare in full. * fix: keep Agent and AgentSwarm in the builtin agent profile Scope the removal to the coder subagent profile on both engines: the main agent keeps Agent/AgentSwarm so default sessions can still delegate, while coder subagents no longer spawn nested subagents by default. Snapshots and token counts shift only for the embedded coder tool list; the v1 parity projection needs no change since the main agent rosters match again. --- .changeset/v2-profile-drop-agent-tools.md | 5 + .../agentLifecycle/profile/profiles.ts | 2 - .../fullCompaction/fullCompaction.test.ts | 16 +- .../test/agent/loop/loop.test.ts | 4 +- packages/agent-core-v2/test/tool/tool.test.ts | 12 +- .../agent-core/src/profile/default/coder.yaml | 2 - .../test/harness/coder-subagent-tools.test.ts | 144 +++++++----------- .../test/profile/agent-profile-loader.test.ts | 2 - 8 files changed, 73 insertions(+), 114 deletions(-) create mode 100644 .changeset/v2-profile-drop-agent-tools.md diff --git a/.changeset/v2-profile-drop-agent-tools.md b/.changeset/v2-profile-drop-agent-tools.md new file mode 100644 index 00000000000..1bb796d5abd --- /dev/null +++ b/.changeset/v2-profile-drop-agent-tools.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Remove the Agent and AgentSwarm tools from the built-in coder subagent profile, so coder subagents no longer delegate further by default. Custom profiles that list these tools explicitly can still opt in. diff --git a/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts b/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts index 04b898f4989..5da3a73a529 100644 --- a/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts +++ b/packages/agent-core-v2/src/session/agentLifecycle/profile/profiles.ts @@ -49,8 +49,6 @@ const AGENT_TOOLS = [ ] as const; const CODER_TOOLS = [ - 'Agent', - 'AgentSwarm', 'Bash', 'CronCreate', 'CronDelete', diff --git a/packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts b/packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts index f32a9c1959c..69e844bbcce 100644 --- a/packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts +++ b/packages/agent-core-v2/test/agent/fullCompaction/fullCompaction.test.ts @@ -303,7 +303,7 @@ describe('FullCompaction', () => { properties: expect.objectContaining({ agent_id: 'main', source: 'manual', - tokens_before: 3_299, + tokens_before: 3_294, tokens_after: expect.any(Number), duration_ms: expect.any(Number), compacted_count: 6, @@ -544,7 +544,7 @@ describe('FullCompaction', () => { session_id: 'test-session', cwd: dir, trigger: 'auto', - token_count: 3_299, + token_count: 3_294, }); expect(post).toMatchObject({ hook_event_name: 'PostCompact', @@ -630,7 +630,7 @@ describe('FullCompaction', () => { event: 'compaction_finished', properties: expect.objectContaining({ source: 'manual', - tokens_before: 14_365, + tokens_before: 14_360, retry_count: 1, trace_id: 'trace-compact-1', }), @@ -1013,7 +1013,7 @@ describe('FullCompaction', () => { properties: expect.objectContaining({ agent_id: 'main', source: 'manual', - tokens_before: 14_365, + tokens_before: 14_360, duration_ms: expect.any(Number), round: 1, retry_count: 0, @@ -1238,7 +1238,7 @@ describe('FullCompaction', () => { event: 'compaction_failed', properties: expect.objectContaining({ source: 'manual', - tokens_before: 14_365, + tokens_before: 14_360, duration_ms: expect.any(Number), retry_count: 4, error_type: 'APIConnectionError', @@ -1613,12 +1613,12 @@ describe('FullCompaction', () => { event: 'compaction_finished', properties: expect.objectContaining({ source: 'auto', - tokens_before: 3_306, - // 3260 estimated request-overhead tokens (system prompt + tools) + + tokens_before: 3_301, + // 3255 estimated request-overhead tokens (system prompt + tools) + // 9 measured summary output tokens (scripted compaction exchange) + // 21 estimated tokens for the kept user messages — the summary // component is the REAL provider count, not a text estimate. - tokens_after: 3_290, + tokens_after: 3_285, compacted_count: 7, retry_count: 0, }), diff --git a/packages/agent-core-v2/test/agent/loop/loop.test.ts b/packages/agent-core-v2/test/agent/loop/loop.test.ts index 6ed1e1c4f6c..3c3f1274ed5 100644 --- a/packages/agent-core-v2/test/agent/loop/loop.test.ts +++ b/packages/agent-core-v2/test/agent/loop/loop.test.ts @@ -121,8 +121,8 @@ describe('Agent loop', () => { [emit] turn.step.started { "turnId": 0, "step": 1, "stepId": "" } [emit] agent.activity.updated { "lifecycle": "ready", "turn": { "turnId": 0, "origin": { "kind": "user" }, "phase": "running", "step": 1, "ending": false, "pendingApprovals": [], "activeToolCalls": [], "since": "
        ',1)),a("main",H,[a("div",L,[e[42]||(e[42]=t('
        ● Design System · v1.0

        Kimi Web Design System

        This document defines the visual language and component specification for Kimi Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

        Scope apps/kimi-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
        i
        This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
        01

        Design Principles

        Every UI decision traces back to the following principles. Kimi Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

        • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
        • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
        • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
        • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
        • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
        • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
        • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
        Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
        i
        Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
        ',2)),a("section",E,[e[7]||(e[7]=t(`
        02

        Design Tokens

        Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

        i
        Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

        Color

        Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

        i
        The table below shows the semantic tokens. Each ships a light value in :root and a dark override in the data-color-scheme blocks — for example --color-bg is #ffffff in light and #121212 in dark; --color-accent is the brand blue (#1783ff light / #1a88ff dark). The semantic status colors (success / warning / danger / info) are independent palettes, one set each for light / dark.
        bg
        #ffffff / #121212
        surface
        #f5f5f5 / #1f1f1f
        surface-sunken
        #f5f5f5 / #121212
        well
        #f5f5f5 / #1f1f1f
        surface-deep
        #f5f5f5 / #0d0d0d
        surface-overlay
        #ffffff / rgba(255,255,255,.1)
        selected
        rgba(0,0,0,.05) / rgba(255,255,255,.1)
        fg
        rgba(0,0,0,.9) / rgba(255,255,255,.84)
        fg-muted
        rgba(0,0,0,.6) / rgba(255,255,255,.56)
        line
        rgba(0,0,0,.13) / rgba(255,255,255,.12)
        subtle
        rgba(0,0,0,.05) / rgba(255,255,255,.05)
        accent (KMBlue)
        #1783ff / #1a88ff
        accent-soft
        #e8f3ff / rgba(26,136,255,.1)
        TokenLightDarkUsage
        --color-bg#ffffff#121212Page background
        --color-surface#f5f5f5#1f1f1fPanel / sidebar / card head
        --color-surface-raised#ffffff#292929Raised card / dialog / input
        --color-menu-bgrgba(255,255,255,.95)rgba(41,41,41,.95)Floating menu panel — frosted glass over --p-menu-backdrop blur
        --color-surface-overlay#ffffffrgba(255,255,255,.1)Field-control fill on raised cards (selects, steppers) — top rung; light tops out at white (the level is carried by the border), dark steps one rung above raised. Floating layers stay at raised
        --color-well#f5f5f5#1f1f1fContent well on the page (code blocks, tool-output panels, match/file lists, media thumbnails) — light reuses the sunken recess; dark lifts one rung ABOVE the page, because a true recess (#121212) vanishes into the page there
        --color-surface-deep#f5f5f5#0d0d0dDeep chrome plane one step BELOW the page (panel headers, diff gutters) — dark drops under --color-bg so chrome framing stays darker than the content it frames
        --color-textrgba(0,0,0,.9)rgba(255,255,255,.84)Body text / headings
        --color-text-strong#000000#ffffffMax foreground emphasis — menu-row label & icon on hover
        --color-text-mutedrgba(0,0,0,.6)rgba(255,255,255,.56)Secondary text / placeholder
        --color-linergba(0,0,0,.13)rgba(255,255,255,.12)Divider / card border
        --color-subtlergba(0,0,0,.05)rgba(255,255,255,.05)Subtle hairline — tertiary separators below --color-line (diff-gutter column rules, quiet dividers inside wells)
        --color-selectedrgba(0,0,0,.05)rgba(255,255,255,.1)Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
        --color-hoverrgba(0,0,0,.03)rgba(255,255,255,.05)Row hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface. The global hover rule: transparent-base controls overlay this f1 wash (hover never darkens — never sunken); filled controls use their own hover token (accent-hover, send-bg-hover)
        --color-inline-code-bgrgba(0,0,0,.03)rgba(255,255,255,.1)Inline-code chip fill — fills.f1 / fills.f2; dark lifts off any dark surface (sunken == bg there)
        --color-media-alpha-bg-1≈#858585≈#76797eCheckerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
        --color-media-alpha-bg-2≈#6b6b6b≈#8c8f93Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
        --color-sidebar-bg#f9fbfc#0d0d0dSidebar surface — one step off --color-bg (just under white in light, one step BELOW the page in dark) so the session column reads as its own plane and never brighter than the reading surface
        --color-scrimrgba(0,0,0,.4)rgba(0,0,0,.6)Modal scrim — the dark veil behind dialogs/lightboxes (mask.base; legacy hardcoded overlays can migrate here)
        --color-scrim-strongrgba(0,0,0,.6)rgba(0,0,0,.75)Stronger scrim for full-screen media previews (mask.strong — the PhotoSwipe image preview backdrop)
        --color-text-on-scrim#ffffffsameText drawn on the scrim (captions over the media lightbox)
        --color-accent#1783ff#1a88ffPrimary action / link / focus
        --color-success#0e7a38#3fb950Success / pass
        --color-warning#a9610a#d29922Warning / pending
        --color-danger#c0392b#f85149Danger / error / abort

        Palette

        The palette is the production kimi.com palette (design tokens tokens.json): neutral-gray surfaces, an alpha-based label / fill / separator ramp (labels.* / fills.* / separator.s1), the KMBlue accent, and a true neutral dark ladder (#121212 → #1f1f1f → #292929; the deep chrome plane and sidebar derive one step below at #0d0d0d — the palette has nothing darker than primary).

        The ONE deliberate exception is the status hues: success / warning / danger / done keep the app's own WCAG-tuned ramp (≥4.5:1 on the neutral surfaces) — the production status colours (positiveGreen #16c456, orange #ff9500, danger red #ff3849) are too bright against it. Diff add/del bands happen to coincide (both use the production 25% fills in light, 14% in dark).

        Surface usage

        The surface layers each have a role — choose by "field overlay / raised layer / content well / default flat layer / sunken layer / page background / deep chrome", and avoid treating --p-surface-raised as a universal background. In dark, elevation = lighter: floating layers sit above the content, content wells sit above the page, and chrome planes (sidebar, panel headers) sit below it — never the reverse. One consequence: on the page itself, never use --color-surface-sunken for a content carrier — it equals --color-bg in dark and the fill vanishes; use --color-well. Sunken stays correct INSIDE surface / raised cards, where it is a genuine recess. Field controls (selects, steppers) on a raised card use --color-surface-overlay, the top fill rung; floating layers keep --color-surface-raised — their elevation is shadow + hairline, not a lighter fill.

        TokenLightDarkUsage
        --p-surface-overlay#ffffff#22272eField controls on raised cards — select, stepper (top fill rung; light = white)
        --p-surface-raised#ffffff#1c2128Raised card / dialog / input (raised layer)
        --p-well#f3f5f8#13181eCode block / tool output / list carrier directly on the page (content well — light: recessed, dark: one rung above the page)
        --p-surface#fafbfc#13181ePanel / sidebar / card head (default flat layer)
        --p-surface-sunken#f3f5f8#0d1117Recessed area INSIDE a surface / raised card — never a content carrier on the page (sunken layer)
        --p-bg#ffffff#0d1117Page background
        --p-surface-deep#fafbfc#0a0d12Panel header / diff gutter (deep chrome layer — below the page in dark)

        Borders & hairlines

        Three line tokens, three jobs: --color-line is the default structural separator, --color-subtle the tertiary separator that must stay quieter (diff-gutter column rules, quiet dividers inside wells), and --color-line-strong the edge of interactive controls (inputs, selects, secondary buttons). Width is one: 0.5px — every stroke is the same hairline, on static structural edges (card rims, plane seams, header dividers), interactive control rims and floating layers alike. Separation comes from luminance first — planes one rung apart already read as distinct in dark, so their shared edge stays a 0.5px hairline rather than a heavier border; same-rung neighbours (list rows, card head / body) are exactly where a hairline is required. In dark, drop shadows fade on near-black surfaces, so a floating layer's edge IS its hairline — never ship a shadow-only floating surface. (Legacy --line / --line2 alias --color-line / --color-subtle for one cycle; new work references the v2 names.)

        Focus ring

        All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

        TokenValueUsage
        --p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
        --p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

        Text selection

        The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

        Disabled state

        All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

        Font families

        Kimi Web uses two font tokens: --font-ui (UI and body, with Schibsted Grotesk for Latin and Noto Sans SC for Simplified Chinese) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

        --font-ui · UI & body (Schibsted Grotesk + Noto Sans SC)

        Body and UI use self-hosted Schibsted Grotesk for Latin text and self-hosted Noto Sans SC Variable for Simplified Chinese. Platform fonts remain as fallbacks:

        --font-ui
        --font-ui: "Schibsted Grotesk Variable", "Helvetica Neue", Arial,
        +import{M as T,aD as z,aI as q,aL as o,u as i,v as a,G as t,H as d,F as p,aX as w,bb as y,I as c,bk as f,cx as h,cy as B,cz as k,cA as A,cB as M}from"./index-Bxn5yOTB.js";const I={class:"ds-page"},V={class:"layout"},H={class:"content"},L={class:"content-inner"},E={id:"tokens"},D={class:"icon-sizes"},O={class:"sz"},W={class:"p-ic",style:{width:"14px",height:"14px"},viewBox:"0 0 24 24",fill:"currentColor"},R={class:"sz"},N={class:"p-ic",style:{width:"16px",height:"16px"},viewBox:"0 0 24 24",fill:"currentColor"},U={class:"sz"},P={class:"p-ic",style:{width:"20px",height:"20px"},viewBox:"0 0 24 24",fill:"currentColor"},F={class:"icon-grid"},j={class:"icon-group-label"},K={class:"ic-name"},G={id:"primitives"},_={class:"stage-wrap"},J={class:"stage p"},Q={class:"p-pill",style:{color:"var(--p-warning)"}},Y={class:"stage-wrap"},Z={class:"stage p col"},X={class:"demo-row"},$={class:"p-btn primary disabled"},ee={class:"p-spinner sm",viewBox:"0 0 24 24",style:{"--p-accent":"#fff","--p-line":"rgba(255,255,255,.35)"}},ae={class:"stage-wrap"},te={class:"stage p col"},de={class:"demo-row"},se={class:"stage-wrap"},oe={class:"stage p col",style:{gap:"0",background:"var(--p-surface)",padding:"0","max-width":"300px","align-items":"stretch"}},ie={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},ne={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},le={style:{display:"flex","align-items":"center",gap:"8px",padding:"7px 10px",margin:"1px 6px","border-radius":"8px",color:"var(--p-text)","font-size":"13px"}},re={style:{color:"var(--d-fg-faint)",flex:"none"},width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor"},ce={id:"chat"},ve={class:"stage-wrap"},fe={class:"stage p col"},pe={style:{"max-width":"560px",width:"100%"}},he={class:"stage-wrap"},ue={class:"stage p col",style:{"align-items":"center",background:"#fff"}},ge={class:"p-composer",style:{width:"100%","max-width":"620px"}},be={class:"p-composer-bar"},me={class:"p-composer-left"},we={class:"p-pill",style:{color:"var(--p-warning)"}},ye="/repo",ke=T({__name:"DesignSystemView",emits:["close"],setup(xe,{emit:x}){const C=[{path:"/repo/apps/web/src/components/chat/TurnFilesSummary.vue",added:19,removed:4,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/composables/useFilePreview.ts",added:8,removed:1,hasWrite:!1,statsIncomplete:!1,diff:null},{path:"/repo/apps/web/src/components/chatTurnRendering.ts",added:0,removed:0,hasWrite:!0,statsIncomplete:!0,diff:null},{path:"/repo/apps/web/src/lib/toolDiff.ts",added:3,removed:2,hasWrite:!1,statsIncomplete:!1,diff:null}];function u(){}const S=x;function g(){S("close")}let v=null;function b(r){r.key==="Escape"&&g()}return z(()=>{document.addEventListener("keydown",b);const r=Array.prototype.slice.call(document.querySelectorAll('#nav a[href^="#"]')),e=new Map;r.forEach(l=>{const s=l.getAttribute("href");if(!s)return;const m=document.getElementById(s.slice(1));m&&e.set(m,l)});let n=null;v=new IntersectionObserver(l=>{l.forEach(s=>{s.isIntersecting&&(n&&n.classList.remove("active"),n=e.get(s.target)??null,n&&n.classList.add("active"))})},{rootMargin:"-20% 0px -70% 0px",threshold:0}),e.forEach((l,s)=>v.observe(s)),r.length&&r[0].classList.add("active")}),q(()=>{document.removeEventListener("keydown",b),v&&(v.disconnect(),v=null)}),(r,e)=>(o(),i("div",I,[a("div",{class:"ds-topbar"},[a("button",{class:"ds-back",type:"button",onClick:g},"← Back"),e[0]||(e[0]=a("span",{class:"ds-topbar-title"},"Design system",-1))]),a("div",V,[e[44]||(e[44]=t('',1)),a("main",H,[a("div",L,[e[42]||(e[42]=t('
        ● Design System · v1.0

        Kimi Web Design System

        This document defines the visual language and component specification for Kimi Web — design tokens, component primitives, the chat interface, theming, and style rules. All UI work is grounded in it: unified, restrained, token-driven, and themeable.

        Scope apps/kimi-webComponent primitivesTheme 1 set · 4 customizable colorsLight / dark mode
        i
        This spec is the single reference when changing the web UI. Before adding or modifying a component, style, layout, or theme, read this document first; color, font, radius, spacing, shadow, z-index, and motion always use the §02 tokens, components reuse the §03 primitives, and the §06 style rules are followed.
        01

        Design Principles

        Every UI decision traces back to the following principles. Kimi Web is a local Agent tool for developers: quick scanning, long stretches of staring, often in the dark — the design serves the task, and is restrained, clinical, and density-first.

        • Consistency —— The same semantics use the same component. The primary button, dialog, input, and badge should each have exactly "one" correct way to be written across the entire site.
        • Hierarchy —— Build a clear hierarchy through size, weight, color, and whitespace; emphasize through "restraint" rather than "bolder and bigger".
        • Proximity —— Group related elements, leave whitespace between unrelated ones. A card's padding, line spacing, and group spacing all come from the same spacing scale.
        • Feedback —— hover / active / focus / loading / success / error all have visible states, and the state language is unified.
        • Breathing room —— Control density with the spacing scale rather than arbitrary pixels; prefer restrained whitespace over cramming controls together.
        • Accessibility (A11y) —— Text contrast ≥ 4.5:1, visible focus rings, touch targets ≥ 32px, and states that don't rely on color alone.
        • Reduction —— The number of colors, radii, shadow levels, and type sizes all converge to a finite set of tokens; delete stray values.
        Brand tone (the do-not list): calm, clinical, never exaggerated. Reject purple gradients, glassmorphism, glowing shadows, AI purple / blue glows, endlessly looping fussy micro-animations, "Boost your productivity"-style marketing copy, and using emoji as icons. These are all common tells of AI-generated interfaces (an "AI tell"), deliberately avoided.
        i
        Declare design intent first (Design Read): before adding a component / page, write one sentence describing its scenario, audience, and tone (for example, "a lightweight tool card embedded in a conversation, for developers, calm and restrained"), then build. If the intent isn't clear, ask one question first rather than defaulting to the nearest existing style.
        ',2)),a("section",E,[e[7]||(e[7]=t(`
        02

        Design Tokens

        Collapse every visual decision into tokens. Color tokens keep the existing short names and fill out the semantics (lowering migration cost), while spacing, z-index, motion, and font-weight fill in the scales that are currently missing. Every token has: name, light value, dark value, and usage.

        i
        Naming convention: --<category>-<role>-<state>. For example --color-text-muted, --radius-md, --space-4. To reduce churn, the existing short names (--bg / --ink / --line / --blue …) are kept as compatibility aliases for one release cycle.

        Color

        Semantic-first, in three layers: background / text / border + accent + status colors. All colors are defined in light / dark pairs, with contrast ≥ 4.5:1.

        i
        The table below shows the semantic tokens. Each ships a light value in :root and a dark override in the data-color-scheme blocks — for example --color-bg is #ffffff in light and #121212 in dark; --color-accent is the brand blue (#1783ff light / #1a88ff dark). The semantic status colors (success / warning / danger / info) are independent palettes, one set each for light / dark.
        bg
        #ffffff / #121212
        surface
        #f5f5f5 / #1f1f1f
        surface-sunken
        #f5f5f5 / #121212
        well
        #f5f5f5 / #1f1f1f
        surface-deep
        #f5f5f5 / #0d0d0d
        surface-overlay
        #ffffff / rgba(255,255,255,.1)
        selected
        rgba(0,0,0,.05) / rgba(255,255,255,.1)
        fg
        rgba(0,0,0,.9) / rgba(255,255,255,.84)
        fg-muted
        rgba(0,0,0,.6) / rgba(255,255,255,.56)
        line
        rgba(0,0,0,.13) / rgba(255,255,255,.12)
        subtle
        rgba(0,0,0,.05) / rgba(255,255,255,.05)
        accent (KMBlue)
        #1783ff / #1a88ff
        accent-soft
        #e8f3ff / rgba(26,136,255,.1)
        TokenLightDarkUsage
        --color-bg#ffffff#121212Page background
        --color-surface#f5f5f5#1f1f1fPanel / sidebar / card head
        --color-surface-raised#ffffff#292929Raised card / dialog / input
        --color-menu-bgrgba(255,255,255,.95)rgba(41,41,41,.95)Floating menu panel — frosted glass over --p-menu-backdrop blur
        --color-surface-overlay#ffffffrgba(255,255,255,.1)Field-control fill on raised cards (selects, steppers) — top rung; light tops out at white (the level is carried by the border), dark steps one rung above raised. Floating layers stay at raised
        --color-well#f5f5f5#1f1f1fContent well on the page (code blocks, tool-output panels, match/file lists, media thumbnails) — light reuses the sunken recess; dark lifts one rung ABOVE the page, because a true recess (#121212) vanishes into the page there
        --color-surface-deep#f5f5f5#0d0d0dDeep chrome plane one step BELOW the page (panel headers, diff gutters) — dark drops under --color-bg so chrome framing stays darker than the content it frames
        --color-textrgba(0,0,0,.9)rgba(255,255,255,.84)Body text / headings
        --color-text-strong#000000#ffffffMax foreground emphasis — menu-row label & icon on hover
        --color-text-mutedrgba(0,0,0,.6)rgba(255,255,255,.56)Secondary text / placeholder
        --color-linergba(0,0,0,.13)rgba(255,255,255,.12)Divider / card border
        --color-subtlergba(0,0,0,.05)rgba(255,255,255,.05)Subtle hairline — tertiary separators below --color-line (diff-gutter column rules, quiet dividers inside wells)
        --color-selectedrgba(0,0,0,.05)rgba(255,255,255,.1)Neutral selected fill (sidebar rows, list pickers) — translucent, never accent-tinted
        --color-hoverrgba(0,0,0,.03)rgba(255,255,255,.05)Row hover wash — lighter than the selected fill (hover < selected); translucent, sits on any surface. The global hover rule: transparent-base controls overlay this f1 wash (hover never darkens — never sunken); filled controls use their own hover token (accent-hover, send-bg-hover)
        --color-inline-code-bgrgba(0,0,0,.03)rgba(255,255,255,.1)Inline-code chip fill — fills.f1 / fills.f2; dark lifts off any dark surface (sunken == bg there)
        --color-media-alpha-bg-1≈#858585≈#76797eCheckerboard square A of the <img> alpha canvas — color-mix of --color-bg/--color-text (52/48); applied via --media-alpha-canvas (16px period)
        --color-media-alpha-bg-2≈#6b6b6b≈#8c8f93Checkerboard square B (42/58) — both squares stay ≥3:1 against white and black; opaque images cover the canvas
        --color-sidebar-bg#f9fbfc#0d0d0dSidebar surface — one step off --color-bg (just under white in light, one step BELOW the page in dark) so the session column reads as its own plane and never brighter than the reading surface
        --color-scrimrgba(0,0,0,.4)rgba(0,0,0,.6)Modal scrim — the dark veil behind dialogs/lightboxes (mask.base; legacy hardcoded overlays can migrate here)
        --color-scrim-strongrgba(0,0,0,.6)rgba(0,0,0,.75)Stronger scrim for full-screen media previews (mask.strong — the PhotoSwipe image preview backdrop)
        --color-text-on-scrim#ffffffsameText drawn on the scrim (captions over the media lightbox)
        --color-accent#1783ff#1a88ffPrimary action / link / focus
        --color-success#0e7a38#3fb950Success / pass
        --color-warning#a9610a#d29922Warning / pending
        --color-danger#c0392b#f85149Danger / error / abort

        Palette

        The palette is the production kimi.com palette (design tokens tokens.json): neutral-gray surfaces, an alpha-based label / fill / separator ramp (labels.* / fills.* / separator.s1), the KMBlue accent, and a true neutral dark ladder (#121212 → #1f1f1f → #292929; the deep chrome plane and sidebar derive one step below at #0d0d0d — the palette has nothing darker than primary).

        The ONE deliberate exception is the status hues: success / warning / danger / done keep the app's own WCAG-tuned ramp (≥4.5:1 on the neutral surfaces) — the production status colours (positiveGreen #16c456, orange #ff9500, danger red #ff3849) are too bright against it. Diff add/del bands happen to coincide (both use the production 25% fills in light, 14% in dark).

        Surface usage

        The surface layers each have a role — choose by "field overlay / raised layer / content well / default flat layer / sunken layer / page background / deep chrome", and avoid treating --p-surface-raised as a universal background. In dark, elevation = lighter: floating layers sit above the content, content wells sit above the page, and chrome planes (sidebar, panel headers) sit below it — never the reverse. One consequence: on the page itself, never use --color-surface-sunken for a content carrier — it equals --color-bg in dark and the fill vanishes; use --color-well. Sunken stays correct INSIDE surface / raised cards, where it is a genuine recess. Field controls (selects, steppers) on a raised card use --color-surface-overlay, the top fill rung; floating layers keep --color-surface-raised — their elevation is shadow + hairline, not a lighter fill.

        TokenLightDarkUsage
        --p-surface-overlay#ffffff#22272eField controls on raised cards — select, stepper (top fill rung; light = white)
        --p-surface-raised#ffffff#1c2128Raised card / dialog / input (raised layer)
        --p-well#f3f5f8#13181eCode block / tool output / list carrier directly on the page (content well — light: recessed, dark: one rung above the page)
        --p-surface#fafbfc#13181ePanel / sidebar / card head (default flat layer)
        --p-surface-sunken#f3f5f8#0d1117Recessed area INSIDE a surface / raised card — never a content carrier on the page (sunken layer)
        --p-bg#ffffff#0d1117Page background
        --p-surface-deep#fafbfc#0a0d12Panel header / diff gutter (deep chrome layer — below the page in dark)

        Borders & hairlines

        Three line tokens, three jobs: --color-line is the default structural separator, --color-subtle the tertiary separator that must stay quieter (diff-gutter column rules, quiet dividers inside wells), and --color-line-strong the edge of interactive controls (inputs, selects, secondary buttons). Width is one: 0.5px — every stroke is the same hairline, on static structural edges (card rims, plane seams, header dividers), interactive control rims and floating layers alike. Separation comes from luminance first — planes one rung apart already read as distinct in dark, so their shared edge stays a 0.5px hairline rather than a heavier border; same-rung neighbours (list rows, card head / body) are exactly where a hairline is required. In dark, drop shadows fade on near-black surfaces, so a floating layer's edge IS its hairline — never ship a shadow-only floating surface. (Legacy --line / --line2 alias --color-line / --color-subtle for one cycle; new work references the v2 names.)

        Focus ring

        All focusable controls (button, input, link, menu item, switch, checkbox) use the focus-ring token uniformly; do not hand-write a box-shadow focus ring.

        TokenValueUsage
        --p-focus-ring0 0 0 3px var(--p-accent-soft)Default focus ring (link, menu item, switch, checkbox)
        --p-focus-ring-strong0 0 0 3px var(--p-accent-soft), 0 0 0 1px var(--p-accent)Strong focus ring (button, primary action)

        Text selection

        The text-selection color uses --p-selection uniformly (light rgba(23,131,255,.18) / dark rgba(88,166,255,.32)), applied by the global ::selection rule; do not set a separate highlight background.

        Disabled state

        All disabled controls use opacity:.5 + cursor:not-allowed uniformly; do not separately grey out or recolor.

        Font families

        Kimi Web uses two font tokens: --font-ui (UI and body, with Schibsted Grotesk for Latin and Noto Sans SC for Simplified Chinese) and --font-mono (code and monospace). Components always reference the variables; do not hard-code font names.

        --font-ui · UI & body (Schibsted Grotesk + Noto Sans SC)

        Body and UI use self-hosted Schibsted Grotesk for Latin text and self-hosted Noto Sans SC Variable for Simplified Chinese. Platform fonts remain as fallbacks:

        --font-ui
        --font-ui: "Schibsted Grotesk Variable", "Helvetica Neue", Arial,
               "Noto Sans SC Variable", "Noto Sans SC", "PingFang SC",
               "Microsoft YaHei",
               -apple-system, BlinkMacSystemFont, "Segoe UI",
        diff --git a/apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js b/apps/kimi-code/dist-web/assets/Tooltip-BCySsRbJ.js
        similarity index 98%
        rename from apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js
        rename to apps/kimi-code/dist-web/assets/Tooltip-BCySsRbJ.js
        index 2977411a41f..74825c6ed1a 100644
        --- a/apps/kimi-code/dist-web/assets/Tooltip-DbYQWF1U.js
        +++ b/apps/kimi-code/dist-web/assets/Tooltip-BCySsRbJ.js
        @@ -1 +1 @@
        -import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-D-7nOosq.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default};
        +import{bQ as A,M as H,aU as b,bE as V,az as J,aL as O,s as Q,v as R,I as F,bJ as G,bL as K,aw as L,H as W,bb as Z,bB as ee,g as te,au as le,T as ae,as as B,bR as ne}from"./index-Bxn5yOTB.js";var k=(h,E,e)=>new Promise((o,p)=>{var i=a=>{try{d(e.next(a))}catch(c){p(c)}},y=a=>{try{d(e.throw(a))}catch(c){p(c)}},d=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,y);d((e=e.apply(h,E)).next())});const oe=["id"],ie=["data-placement"],ue=A(H({__name:"Tooltip",props:{visible:{type:Boolean},anchorEl:{},content:{},placement:{},offset:{},originX:{},originY:{},id:{},isDark:{type:[Boolean,null]}},setup(h){var E;const e=h,o=b(null),p=b(null),i=b({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),y=b({}),d=b((E=e.placement)!=null?E:"top"),a=b(!1);let c=null,$=null,T=null,C=null,w=null,s=0;function X(){return C?Promise.resolve(C):(w||(w=ne(()=>import("./floating-ui.dom-xGUaHE3m.js"),[]).then(l=>(C=l,l)).catch(l=>{throw w=null,l})),w)}function D(){c&&(c(),c=null),$=null,T=null}function P(l){return k(this,null,function*(){const t=e.anchorEl,n=o.value;if(!e.visible||!t||!n||$===t&&T===n)return;const{autoUpdate:r}=yield X();l()&&e.visible&&e.anchorEl===t&&o.value===n&&(D(),$=t,T=n,c=r(t,n,()=>{N().catch(()=>{_()})}))})}function N(){return k(this,null,function*(){var l,t;const n=e.anchorEl,r=o.value;if(!e.visible||!n||!r)return!1;const{arrow:u,computePosition:m,flip:v,offset:f,shift:x}=yield X();if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;const g=[f((l=e.offset)!=null?l:6),v(),x({padding:6}),...p.value?[u({element:p.value,padding:4})]:[]],{x:S,y:j,placement:Y,middlewareData:z}=yield m(n,r,{placement:(t=e.placement)!=null?t:"top",middleware:g,strategy:"fixed"});if(!e.visible||e.anchorEl!==n||o.value!==r)return!1;if(i.value.transform=`translate3d(${Math.round(S)}px, ${Math.round(j)}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=Y,z.arrow&&p.value){const{x:I,y:U}=z.arrow,q={top:"bottom",bottom:"top",left:"right",right:"left"}[Y.split("-")[0]];y.value={left:I!=null?`${I}px`:"",top:U!=null?`${U}px`:"",[q]:"-3px"}}return!0})}function _(){var l,t;const n=e.anchorEl,r=o.value;if(!n||!r)return!1;const u=n.getBoundingClientRect(),m=r.getBoundingClientRect(),v=(l=e.offset)!=null?l:6,f=(t=e.placement)!=null?t:"top";let x=u.left,g=u.top;return f==="bottom"?g=u.bottom+v:f==="left"?x=u.left-m.width-v:f==="right"?x=u.right+v:g=u.top-m.height-v,i.value.transform=`translate3d(${Math.round(Math.max(0,x))}px, ${Math.round(Math.max(0,g))}px, 0)`,i.value.left="0px",i.value.top="0px",d.value=f,y.value={},!0}V(()=>e.visible,l=>k(null,null,function*(){const t=++s;if(l){if(a.value=!1,yield B(),t!==s||!e.visible)return;if(e.anchorEl&&o.value)try{const n=e.anchorEl,r=o.value,u=n.getBoundingClientRect();if(!(yield N())||t!==s||!e.visible||e.anchorEl!==n||o.value!==r)return;const m=i.value.transform;if(e.originX!=null&&e.originY!=null){const v=Math.abs(Number(e.originX)-u.left),f=Math.abs(Number(e.originY)-u.top);if(Math.hypot(v,f)>120){if(i.value.transform=`translate3d(${Math.round(e.originX)}px, ${Math.round(e.originY)}px, 0)`,yield B(),t!==s||!e.visible||(a.value=!0,yield B(),t!==s||!e.visible))return;i.value.transform=m}else a.value=!0}else a.value=!0;yield P(()=>t===s)}catch{if(t!==s||!e.visible)return;if(a.value=_(),e.anchorEl&&o.value)try{yield P(()=>t===s)}catch{}}else a.value=!0}else a.value=!1,D()}));let M=0;return V([()=>e.anchorEl,()=>e.placement,()=>e.content],()=>k(null,null,function*(){const l=++M;if(e.visible&&e.anchorEl&&o.value){if(yield B(),l!==M||!e.visible||!e.anchorEl||!o.value)return;try{const t=yield N();if(l!==M||!e.visible||!e.anchorEl||!o.value)return;t||_()}catch{_()}yield P(()=>l===M)}})),J(()=>{s+=1,D()}),(l,t)=>(O(),Q(ae,{to:"body"},[R("div",{class:le(["markstream-vue",{dark:h.isDark}])},[F(te,{name:"tooltip",appear:""},{default:G(()=>[K(R("div",{id:e.id,ref_key:"tooltip",ref:o,style:L({position:"fixed",left:i.value.left,top:i.value.top,transform:i.value.transform,visibility:a.value?"visible":"hidden",pointerEvents:a.value?void 0:"none"}),class:"tooltip-element",role:"tooltip"},[W(Z(h.content)+" ",1),R("div",{ref_key:"arrowEl",ref:p,class:"tooltip-arrow","data-placement":d.value,style:L(y.value)},null,12,ie)],12,oe),[[ee,h.visible]])]),_:1})],2)]))}}),[["__scopeId","data-v-c606ee4c"]]);export{ue as default};
        diff --git a/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js b/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-LUo2ybd4.js
        similarity index 86%
        rename from apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js
        rename to apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-LUo2ybd4.js
        index e0a31a7b014..543b25cf48b 100644
        --- a/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-C0Afmuc1.js
        +++ b/apps/kimi-code/dist-web/assets/abnfDiagram-VRR7QNED-LUo2ybd4.js
        @@ -1 +1 @@
        -import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p as f}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as n,l as o}from"./mermaid.core-CJB1tAev.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram};
        +import{g as p,r as u,d as a}from"./chunk-MOJQB5TN-CuHpGhX-.js";import{p as f}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as n,l as o}from"./mermaid.core-CsZwh_jB.js";import{M as c,b as d}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var v=d().RailroadAbnf.parser.LangiumParser,i=n(e=>{const r=e.alternatives.map(g);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),g=n(e=>{const r=e.elements.map(y);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),b=n(e=>{if(e.includes("*")){const[t,s]=e.split("*"),l=t?parseInt(t,10):0,m=s?parseInt(s,10):1/0;return{min:l,max:m}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),y=n(e=>{const r=A(e.primary);if(!e.repeat)return r;const{min:t,max:s}=b(e.repeat);return t===0&&s===1?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:s}},"transformElement"),A=n(e=>{switch(e.$type){case"AbnfStringLiteral":return{type:"terminal",value:e.value};case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return i(e.element);case"AbnfOptionalGroup":return{type:"optional",element:i(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),P=n(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=n(e=>{f(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(P(r)))},"populateDb"),R={parse:n(e=>{a.clear(),o.debug("[ABNF Parser] Starting Langium parse");const r=v.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new c(r);const t=r.value;o.debug("[ABNF Parser] Parsed rules:",t.rules.length),h(t),o.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:a}},F={parser:R,db:a,renderer:u,styles:p};export{F as diagram};
        diff --git a/apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js b/apps/kimi-code/dist-web/assets/arc-HTdwJ95y.js
        similarity index 98%
        rename from apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js
        rename to apps/kimi-code/dist-web/assets/arc-HTdwJ95y.js
        index 2c68be080a7..90f8fbb2972 100644
        --- a/apps/kimi-code/dist-web/assets/arc-IkhU3FHH.js
        +++ b/apps/kimi-code/dist-web/assets/arc-HTdwJ95y.js
        @@ -1 +1 @@
        -import{G as ln,H as un,I as N,J as I,K as J,L as an,M as y,N as tn,O as j,P as _,Q as rn,R as o,S as on,T as sn,V as fn}from"./mermaid.core-CJB1tAev.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function dn(l){return l.endAngle}function mn(l){return l&&l.padAngle}function pn(l,h,q,O,v,R,K,u){var D=q-l,i=O-h,n=K-v,d=u-R,a=d*D-n*i;if(!(a*ar*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),sy))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(Ly?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),pr*r+M*M&&(G=w,H=p),{cx:G,cy:H,x01:-n,y01:-d,x11:G*(v/T-1),y11:H*(v/T-1)}}function hn(){var l=cn,h=yn,q=J(0),O=null,v=gn,R=dn,K=mn,u=null,D=ln(i);function i(){var n,d,a=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,L=rn(c-f),t=c>f;if(u||(u=n=D()),sy))u.moveTo(0,0);else if(L>tn-y)u.moveTo(s*N(f),s*I(f)),u.arc(0,0,s,f,c,!t),a>y&&(u.moveTo(a*N(c),a*I(c)),u.arc(0,0,a,c,f,t));else{var m=f,g=c,A=f,T=c,P=L,E=L,G=K.apply(this,arguments)/2,H=G>y&&(O?+O.apply(this,arguments):j(a*a+s*s)),w=_(rn(s-a)/2,+q.apply(this,arguments)),p=w,x=w,e,r;if(H>y){var M=sn(H/a*I(G)),z=sn(H/s*I(G));(P-=M*2)>y?(M*=t?1:-1,A+=M,T-=M):(P=0,A=T=(f+c)/2),(E-=z*2)>y?(z*=t?1:-1,m+=z,g-=z):(E=0,m=g=(f+c)/2)}var Q=s*N(m),V=s*I(m),B=a*N(T),C=a*I(T);if(w>y){var F=s*N(g),U=s*I(g),X=a*N(A),Y=a*I(A),S;if(Ly?x>y?(e=W(X,Y,Q,V,s,x,t),r=W(F,U,B,C,s,x,t),u.moveTo(e.cx+e.x01,e.cy+e.y01),xy)||!(P>y)?u.lineTo(B,C):p>y?(e=W(B,C,F,U,a,-p,t),r=W(Q,V,X,Y,a,-p,t),u.lineTo(e.cx+e.x01,e.cy+e.y01),ps?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=e}),(function(A,G,N){var v=N(0);function h(){}for(var i in v)h[i]=v[i];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,A.exports=h}),(function(A,G,N){function v(h,i){h==null&&i==null?(this.x=0,this.y=0):(this.x=h,this.y=i)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(h){this.x=h},v.prototype.setY=function(h){this.y=h},v.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(0),r=N(7),a=N(3),f=N(1),e=N(13),u=N(12),t=N(11);function s(c,l,T){v.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,l,T){if(l==null&&T==null){var g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var d=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(d.source=l,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),l.edges.push(d),T!=l&&T.edges.push(d),d)}},s.prototype.remove=function(c){var l=c;if(c instanceof a){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),g,d=T.length,C=0;C-1&&P>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(w,1),g.target!=g.source&&g.target.edges.splice(P,1);var S=g.source.owner.getEdges().indexOf(g);if(S==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(S,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,g,d,C=this.getNodes(),S=C.length,w=0;wT&&(c=T),l>g&&(l=g)}return c==h.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?d=C[0].getParent().paddingLeft:d=this.margin,this.left=l-d,this.top=c-d,new u(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,d=-h.MAX_VALUE,C,S,w,P,B,U=this.nodes,V=U.length,M=0;MC&&(l=C),Tw&&(g=w),dC&&(l=C),Tw&&(g=w),d=this.nodes.length){var V=0;T.forEach(function(M){M.owner==c&&V++}),V==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,G,N){var v,h=N(1);function i(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var r=this.layout.newGraph(),a=this.layout.newNode(null),f=this.add(r,a);return this.setRootGraph(f),this.rootGraph},i.prototype.add=function(r,a,f,e,u){if(f==null&&e==null&&u==null){if(r==null)throw"Graph is null!";if(a==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(a.child!=null)throw"Already has a child!";return r.parent=a,a.child=r,r}else{u=f,e=a,f=r;var t=e.getOwner(),s=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,u);if(f.isInterGraph=!0,f.source=e,f.target=u,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},i.prototype.remove=function(r){if(r instanceof v){var a=r;if(a.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(a==this.rootGraph||a.parent!=null&&a.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(a.getEdges());for(var e,u=f.length,t=0;t=r.getRight()?a[0]+=Math.min(r.getX()-i.getX(),i.getRight()-r.getRight()):r.getX()<=i.getX()&&r.getRight()>=i.getRight()&&(a[0]+=Math.min(i.getX()-r.getX(),r.getRight()-i.getRight())),i.getY()<=r.getY()&&i.getBottom()>=r.getBottom()?a[1]+=Math.min(r.getY()-i.getY(),i.getBottom()-r.getBottom()):r.getY()<=i.getY()&&r.getBottom()>=i.getBottom()&&(a[1]+=Math.min(i.getY()-r.getY(),r.getBottom()-i.getBottom()));var u=Math.abs((r.getCenterY()-i.getCenterY())/(r.getCenterX()-i.getCenterX()));r.getCenterY()===i.getCenterY()&&r.getCenterX()===i.getCenterX()&&(u=1);var t=u*a[0],s=a[1]/u;a[0]t)return a[0]=f,a[1]=o,a[2]=u,a[3]=U,!1;if(eu)return a[0]=s,a[1]=e,a[2]=P,a[3]=t,!1;if(fu?(a[0]=l,a[1]=T,n=!0):(a[0]=c,a[1]=o,n=!0):p===y&&(f>u?(a[0]=s,a[1]=o,n=!0):(a[0]=g,a[1]=T,n=!0)),-m===y?u>f?(a[2]=B,a[3]=U,E=!0):(a[2]=P,a[3]=w,E=!0):m===y&&(u>f?(a[2]=S,a[3]=w,E=!0):(a[2]=V,a[3]=U,E=!0)),n&&E)return!1;if(f>u?e>t?(I=this.getCardinalDirection(p,y,4),O=this.getCardinalDirection(m,y,2)):(I=this.getCardinalDirection(-p,y,3),O=this.getCardinalDirection(-m,y,1)):e>t?(I=this.getCardinalDirection(-p,y,1),O=this.getCardinalDirection(-m,y,3)):(I=this.getCardinalDirection(p,y,2),O=this.getCardinalDirection(m,y,4)),!n)switch(I){case 1:W=o,R=f+-C/y,a[0]=R,a[1]=W;break;case 2:R=g,W=e+d*y,a[0]=R,a[1]=W;break;case 3:W=T,R=f+C/y,a[0]=R,a[1]=W;break;case 4:R=l,W=e+-d*y,a[0]=R,a[1]=W;break}if(!E)switch(O){case 1:Q=w,x=u+-_/y,a[2]=x,a[3]=Q;break;case 2:x=V,Q=t+M*y,a[2]=x,a[3]=Q;break;case 3:Q=U,x=u+_/y,a[2]=x,a[3]=Q;break;case 4:x=B,Q=t+-M*y,a[2]=x,a[3]=Q;break}}return!1},h.getCardinalDirection=function(i,r,a){return i>r?a:1+a%4},h.getIntersection=function(i,r,a,f){if(f==null)return this.getIntersection2(i,r,a);var e=i.x,u=i.y,t=r.x,s=r.y,o=a.x,c=a.y,l=f.x,T=f.y,g=void 0,d=void 0,C=void 0,S=void 0,w=void 0,P=void 0,B=void 0,U=void 0,V=void 0;return C=s-u,w=e-t,B=t*u-e*s,S=T-c,P=o-l,U=l*c-o*T,V=C*P-S*w,V===0?null:(g=(w*U-P*B)/V,d=(S*B-C*U)/V,new v(g,d))},h.angleOfVector=function(i,r,a,f){var e=void 0;return i!==a?(e=Math.atan((f-r)/(a-i)),a=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),g=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:d}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,A.exports=h}),(function(A,G,N){function v(){}v.sign=function(h){return h>0?1:h<0?-1:0},v.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},v.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},A.exports=v}),(function(A,G,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,A.exports=v}),(function(A,G,N){var v=(function(){function e(u,t){for(var s=0;s"u"?"undefined":v(i);return i==null||r!="object"&&r!="function"},A.exports=h}),(function(A,G,N){function v(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c0&&c;){for(C.push(w[0]);C.length>0&&c;){var P=C[0];C.splice(0,1),d.add(P);for(var B=P.getEdges(),g=0;g-1&&w.splice(_,1)}d=new Set,S=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(l),g=0;g=0&&c.splice(U,1);var V=S.getNeighborsList();V.forEach(function(n){if(l.indexOf(n)<0){var E=T.get(n),p=E-1;p==1&&P.push(n),T.set(n,p)}})}l=l.concat(P),(c.length==1||c.length==2)&&(g=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,G,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},A.exports=v}),(function(A,G,N){var v=N(5);function h(i,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(i){this.lworldExtX=i},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(i){this.lworldExtY=i},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},h.prototype.transformX=function(i){var r=0,a=this.lworldExtX;return a!=0&&(r=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/a),r},h.prototype.transformY=function(i){var r=0,a=this.lworldExtY;return a!=0&&(r=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/a),r},h.prototype.inverseTransformX=function(i){var r=0,a=this.ldeviceExtX;return a!=0&&(r=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/a),r},h.prototype.inverseTransformY=function(i){var r=0,a=this.ldeviceExtY;return a!=0&&(r=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/a),r},h.prototype.inverseTransformPoint=function(i){var r=new v(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return r},A.exports=h}),(function(A,G,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);si.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,g=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oC||d>C)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(C=s.getEstimatedSize()*this.compoundGravityRangeFactor,(g>C||d>C)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||C>=g[0].length)){for(var S=0;Se}}]),a})();A.exports=r}),(function(A,G,N){function v(){}v.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var i=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function Bt(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),a=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,e=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,Ct){return Tt&&Ct})(z0;){var J=void 0,It=void 0;for(J=n-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==n?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===n-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[n-2];r[n-2]=0;for(var ut=n-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),wt=this.s[ut]/Et,Ot=it/Et;this.s[ut]=Et,ut!==J&&(it=-Ot*r[ut-1],r[ut-1]=wt*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(i)?(r=i/h,r=Math.abs(h)*Math.sqrt(1+r*r)):i!=0?(r=h/i,r=Math.abs(i)*Math.sqrt(1+r*r)):r=0,r},A.exports=v}),(function(A,G,N){var v=(function(){function r(a,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,r),this.sequence1=a,this.sequence2=f,this.match_score=e,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=a.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;a--){var f=this.listeners[a];f.event===i&&f.callback===r&&this.listeners.splice(a,1)}},h.emit=function(i,r){for(var a=0;a{var G={45:((i,r,a)=>{var f={};f.layoutBase=a(551),f.CoSEConstants=a(806),f.CoSEEdge=a(767),f.CoSEGraph=a(880),f.CoSEGraphManager=a(578),f.CoSELayout=a(765),f.CoSENode=a(991),f.ConstraintHandler=a(902),i.exports=f}),806:((i,r,a)=>{var f=a(551).FDLayoutConstants;function e(){}for(var u in f)e[u]=f[u];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,i.exports=e}),767:((i,r,a)=>{var f=a(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),880:((i,r,a)=>{var f=a(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),578:((i,r,a)=>{var f=a(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),765:((i,r,a)=>{var f=a(551).FDLayout,e=a(578),u=a(880),t=a(991),s=a(767),o=a(806),c=a(902),l=a(551).FDLayoutConstants,T=a(551).LayoutConstants,g=a(551).Point,d=a(551).PointD,C=a(551).DimensionD,S=a(551).Layout,w=a(551).Integer,P=a(551).IGeometry,B=a(551).LGraph,U=a(551).Transform,V=a(551).LinkedList;function M(){f.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(f.prototype);for(var _ in f)M[_]=f[_];M.prototype.newGraphManager=function(){var n=new e(this);return this.graphManager=n,n},M.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},M.prototype.newNode=function(n){return new t(this.graphManager,n)},M.prototype.newEdge=function(n){return new s(null,null,n)},M.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return E.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var O=new Map,R=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(D){n.fixedNodesOnHorizontal.add(D),n.fixedNodesOnVertical.add(D)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*D.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=D[tt],D[tt]=D[H],D[H]=k;return D},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes(k)||(n.nodesInRelativeHorizontal.push(k),n.nodeToRelativeConstraintMapHorizontal.set(k,[]),n.dummyToNodeForVerticalAlignment.has(k)?n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(k).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:D.gap}),n.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:D.gap})}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;n.nodesInRelativeVertical.includes(tt)||(n.nodesInRelativeVertical.push(tt),n.nodeToRelativeConstraintMapVertical.set(tt,[]),n.dummyToNodeForHorizontalAlignment.has(tt)?n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(tt).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:D.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:D.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new V,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(wt){It.has(wt)||(J.push(wt),It.add(wt),tt[Nt].push(wt))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,n.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},M.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var D=n.idToNodeMap.get($.nodeId);D.displacementX=0,D.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var R;for(R=0;Rm&&(m=Math.floor(O.y)),I=Math.floor(O.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-O.x/2,T.WORLD_CENTER_Y-O.y/2))},M.radialLayout=function(n,E,p){var m=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(E,null,0,359,0,m);var y=B.calculateBounds(n),I=new U;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var O=0;O1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?D=(z.indexOf(H[0])+1)%$:D=0;for(var ht=Math.abs(m-p)/X,J=D;rt!=X;J=++J%$){var It=z[J].getOtherEnd(n);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;M.branchRadialLayout(It,n,Nt,vt,y+I,I),rt++}}},M.maxDiagonalInTree=function(n){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var n=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[R]=[]),E[R]=E[R].concat(I)}Object.keys(E).forEach(function(W){if(E[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=E[W];var Q=E[W][0].getParent(),z=new t(n.graphManager);z.id=x,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,n.idToDummyNode[x]=z;var X=n.getGraphManager().add(n.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(I+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>I?(m.rect.y-=(m.labelHeight-I)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-I)/2):m.labelPosVertical=="bottom"&&m.setHeight(I+m.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var E=this.compoundOrder[n],p=E.id,m=E.paddingLeft,y=E.paddingTop,I=E.labelMarginLeft,O=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,I,O)}},M.prototype.repopulateZeroDegreeMembers=function(){var n=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=n.idToDummyNode[p],y=m.paddingLeft,I=m.paddingTop,O=m.labelMarginLeft,R=m.labelMarginTop;n.adjustLocations(E[p],m.rect.x,m.rect.y,y,I,O,R)})},M.prototype.getToBeTiled=function(n){var E=n.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=n.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},M.prototype.getNodeDegree=function(n){n.id;for(var E=n.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+n.verticalPadding}},M.prototype.tileCompoundMembers=function(n,E){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(n[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,O=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(O+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>O?(y.rect.y-=(y.labelHeight-O)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-O)/2):y.labelPosVertical=="bottom"&&y.setHeight(O+y.labelHeight))}})},M.prototype.tileNodes=function(n,E){var p=this.tileNodesByFavoringDim(n,E,!0),m=this.tileNodesByFavoringDim(n,E,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(m),O;return IR&&(R=$.getWidth())});var W=I/y,x=O/y,Q=Math.pow(p-m,2)+4*(W+m)*(x+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return R>rt&&(rt=R),rt+=m*2,rt},M.prototype.tileNodesByFavoringDim=function(n,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,I=o.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};I&&(O.idealRowWidth=this.calcIdealRowWidth(n,p));var R=function(D){return D.rect.width*D.rect.height},W=function(D,H){return R(H)-R(D)};n.sort(function($,D){var H=W;return O.idealRowWidth?(H=I,H($.id,D.id)):H($,D)});for(var x=0,Q=0,z=0;z0&&(O+=n.horizontalPadding),n.rowWidth[p]=O,n.width0&&(R+=n.verticalPadding);var W=0;R>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=R,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(E)},M.prototype.getShortestRowIndex=function(n){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=n.rowWidth[m]);return E},M.prototype.canAddHorizontal=function(n,E,p){if(n.idealRowWidth){var m=n.rows.length-1,y=n.rowWidth[m];return y+E+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var O=n.rowWidth[I];if(O+n.horizontalPadding+E<=n.width)return!0;var R=0;n.rowHeight[I]0&&(R=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-O>=E+n.horizontalPadding?W=(n.height+R)/(O+E+n.horizontalPadding):W=(n.height+R)/n.width,R=p+n.verticalPadding;var x;return n.widthI&&E!=p){m.splice(-1,1),n.rows[p].push(y),n.rowWidth[E]=n.rowWidth[E]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=m[R].height);E>0&&(O+=n.verticalPadding);var W=n.rowHeight[E]+n.rowHeight[p];n.rowHeight[E]=O,n.rowHeight[p]0)for(var rt=y;rt<=I;rt++)X[0]+=this.grid[rt][O-1].length+this.grid[rt][O].length-1;if(I0)for(var rt=O;rt<=R;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,D,H,k=0;k{var f=a(551).FDLayoutNode,e=a(551).IMath;function u(s,o,c,l){f.call(this,s,o,c,l)}u.prototype=Object.create(f.prototype);for(var t in f)u[t]=f[t];u.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),l,T=0;T{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,g.has(st)?d[g.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,g.has(st)?C[g.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=g.has(st)?d[g.get(st)]:q.get(st):ft+=g.has(st)?C[g.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var At=function(){var ot=dt.shift(),Lt=Y.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,Bt=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw Bt}}var fe=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),ne;!(Qt=(ne=Jt.next()).done);Qt=!0){var te=ne.value;et.set(te,et.get(te)+fe)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},_=function(Y){var Z=0,K=0,q=0,at=0;if(Y.forEach(function(j){j.left?d[g.get(j.left)]-d[g.get(j.right)]>=0?Z++:K++:C[g.get(j.top)]-C[g.get(j.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var et=0;et1)l.fixedNodeConstraint.forEach(function(F,Y){m[Y]=[F.position.x,F.position.y],y[Y]=[d[g.get(F.nodeId)],C[g.get(F.nodeId)]]}),I=!0;else if(l.alignmentConstraint)(function(){var F=0;if(l.alignmentConstraint.vertical){for(var Y=l.alignmentConstraint.vertical,Z=function(et){var j=new Set;Y[et].forEach(function(pt){j.add(pt)});var dt=new Set([].concat(f(j)).filter(function(pt){return R.has(pt)})),At=void 0;dt.size>0?At=d[g.get(dt.values().next().value)]:At=V(j).x,Y[et].forEach(function(pt){m[F]=[At,C[g.get(pt)]],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},K=0;K0?At=d[g.get(dt.values().next().value)]:At=V(j).y,q[et].forEach(function(pt){m[F]=[d[g.get(pt)],At],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},ct=0;ctz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(F,Y){var Z={x:d[g.get(F.nodeId)],y:C[g.get(F.nodeId)]},K=F.position,q=U(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,d.forEach(function(F,Y){d[Y]+=mt.x}),C.forEach(function(F,Y){C[Y]+=mt.y}),l.fixedNodeConstraint.forEach(function(F){d[g.get(F.nodeId)]=F.position.x,C[g.get(F.nodeId)]=F.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(Y){var Z=new Set;Dt[Y].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return R.has(at)})),q=void 0;K.size>0?q=d[g.get(K.values().next().value)]:q=V(Z).x,Z.forEach(function(at){R.has(at)||(d[g.get(at)]=q)})},Ht=0;Ht0?q=C[g.get(K.values().next().value)]:q=V(Z).y,Z.forEach(function(at){R.has(at)||(C[g.get(at)]=q)})},Ft=0;Ft{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(45);return h})()})})(he)),he.exports}var pr=se.exports,De;function yr(){return De||(De=1,(function(L,b){(function(G,N){L.exports=N(vr())})(pr,function(A){return(()=>{var G={658:(i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var a=arguments.length,f=Array(a>1?a-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],l=!0,T=!1,g=void 0;try{for(var d=s[Symbol.iterator](),C;!(l=(C=d.next()).done)&&(c.push(C.value),!(o&&c.length===o));l=!0);}catch(S){T=!0,g=S}finally{try{!l&&d.return&&d.return()}finally{if(T)throw g}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=a(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var s={},o=0;o0&&I.merge(x)});for(var O=0;O1){C=g[0],S=C.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),B),U},u.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,C=!1,S=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),P;!(d=(P=w.next()).done);d=!0){var B=P.value,U=f(B,2),V=U[0],M=U[1],_=o.cy.getElementById(V);if(_){var n=_.boundingBox(),E=s.xCoords[M]-n.w/2,p=s.xCoords[M]+n.w/2,m=s.yCoords[M]-n.h/2,y=s.yCoords[M]+n.h/2;El&&(l=p),mg&&(g=y)}}}catch(x){C=!0,S=x}finally{try{!d&&w.return&&w.return()}finally{if(C)throw S}}var I=t.x-(l+c)/2,O=t.y-(g+T)/2;s.xCoords=s.xCoords.map(function(x){return x+I}),s.yCoords=s.yCoords.map(function(x){return x+O})}else{Object.keys(s).forEach(function(x){var Q=s[x],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zl&&(l=X),rtg&&(g=$)});var R=t.x-(l+c)/2,W=t.y-(g+T)/2;Object.keys(s).forEach(function(x){var Q=s[x];Q.setCenter(Q.getCenterX()+R,Q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,s,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,C=void 0,S=void 0,w=void 0,P=void 0,B=t.descendants().not(":parent"),U=B.length,V=0;VC&&(l=C),Tw&&(g=w),d{var f=a(548),e=a(140).CoSELayout,u=a(140).CoSENode,t=a(140).layoutBase.PointD,s=a(140).layoutBase.DimensionD,o=a(140).layoutBase.LayoutConstants,c=a(140).layoutBase.FDLayoutConstants,l=a(140).CoSEConstants,T=function(d,C){var S=d.cy,w=d.eles,P=w.nodes(),B=w.edges(),U=void 0,V=void 0,M=void 0,_={};d.randomize&&(U=C.nodeIndexes,V=C.xCoords,M=C.yCoords);var n=function(x){return typeof x=="function"},E=function(x,Q){return n(x)?x(Q):x},p=f.calcParentsWithoutChildren(S,w),m=function W(x,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(x,Q,z){for(var X=0,rt=0,$=0;$0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:n(d.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,Q){Q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(x.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,l.TILE=d.tile,l.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),d.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),d.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new e,R=O.newGraphManager();return m(R.addRoot(),f.getTopMostNodes(P),O,d),y(O,R,B),I(O,d),O.runLayout(),_};i.exports={coseLayout:T}}),212:((i,r,a)=>{var f=(function(){function d(C,S){for(var w=0;w0)if(p){var I=t.getTopMostNodes(w.eles.nodes());if(M=t.connectComponents(P,w.eles,I),M.forEach(function(vt){var it=vt.boundingBox();_.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&M.forEach(function(vt){w.eles=vt,U.push(o(w))}),w.quality=="default"||w.quality=="proof"){var O=P.collection();if(w.tile){var R=new Map,W=[],x=[],Q=0,z={nodeIndexes:R,xCoords:W,yCoords:x},X=[];if(M.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){O.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),O.length>1){var rt=O.boundingBox();_.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),M.push(O),U.push(z);for(var $=X.length-1;$>=0;$--)M.splice(X[$],1),U.splice(X[$],1),_.splice(X[$],1)}}M.forEach(function(vt,it){w.eles=vt,V.push(l(w,U[it])),t.relocateComponent(_[it],V[it],w)})}else M.forEach(function(vt,it){t.relocateComponent(_[it],U[it],w)});var D=new Set;if(M.length>1){var H=[],k=B.filter(function(vt){return vt.css("display")=="none"});M.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=U[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var wt=void 0;vt.nodes().not(k).forEach(function(Ot){if(w.quality=="draft")if(!Ot.isParent())wt=ut.get(Ot.id()),Et.nodes.push({x:U[it].xCoords[wt]-Ot.boundingbox().w/2,y:U[it].yCoords[wt]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var mt=t.calcBoundingBox(Ot,U[it].xCoords,U[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else V[it][Ot.id()]&&Et.nodes.push({x:V[it][Ot.id()].getLeft(),y:V[it][Ot.id()].getTop(),width:V[it][Ot.id()].getWidth(),height:V[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var mt=Ot.source(),Dt=Ot.target();if(mt.css("display")!="none"&&Dt.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Dt.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,U[it].xCoords,U[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[it].xCoords[Rt]),Ut.push(U[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[it].xCoords,U[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[it].xCoords[Ht]),Pt.push(U[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else V[it][mt.id()]&&V[it][Dt.id()]&&Et.edges.push({startX:V[it][mt.id()].getCenterX(),startY:V[it][mt.id()].getCenterY(),endX:V[it][Dt.id()].getCenterX(),endY:V[it][Dt.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),D.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")U.forEach(function(vt,it){var ut=vt.xCoords.map(function(wt){return wt+tt[it].dx}),Et=vt.yCoords.map(function(wt){return wt+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;D.forEach(function(vt){Object.keys(V[vt]).forEach(function(it){var ut=V[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(_.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);U.push(y)}w.quality=="default"||w.quality=="proof"?(V.push(l(w,U[0])),t.relocateComponent(_[0],V[0],w)):t.relocateComponent(_[0],U[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,wt=void 0,Ot=it.data("id");return V.forEach(function(Dt){Ot in Dt&&(Et={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},wt=Dt[Ot])}),w.nodeDimensionsIncludeLabels&&(wt.labelWidth&&(wt.labelPosHorizontal=="left"?Et.x+=wt.labelWidth/2:wt.labelPosHorizontal=="right"&&(Et.x-=wt.labelWidth/2)),wt.labelHeight&&(wt.labelPosVertical=="top"?Et.y+=wt.labelHeight/2:wt.labelPosVertical=="bottom"&&(Et.y-=wt.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(P,B),Nt=B.filter(function(vt){return vt.css("display")=="none"});w.eles=B.not(Nt),B.nodes().not(":parent").not(Nt).layoutPositions(S,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();i.exports=g}),657:((i,r,a)=>{var f=a(548),e=a(140).layoutBase.Matrix,u=a(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),g=l.nodes(":parent"),d=new Map,C=new Map,S=new Map,w=[],P=[],B=[],U=[],V=[],M=[],_=[],n=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,I=o.samplingType,O=o.nodeSeparation,R=void 0,W=function(){for(var Y=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=V[Lt],At=Lt)}return At},Q=function(Y){var Z=void 0;if(Y){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;j=et}for(var pt=0;pt=1)break;j=et}for(var lt=0;lt0&&(Z.isParent()?w[Y].push(S.get(Z.id())):w[Y].push(Z.id()))})});var Nt=function(Y){var Z=C.get(Y),K=void 0;d.get(Y).forEach(function(q){c.getElementById(q).isParent()?K=S.get(q):K=q,w[Z].push(K),w[C.get(K)].push(Y)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),wt;!(vt=(wt=Et.next()).done);vt=!0){var Ot=wt.value;Nt(Ot)}}catch(F){it=!0,ut=F}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=C.size;var mt=void 0;if(E>2){R=E{var f=a(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),i.exports=e}),140:(i=>{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(579);return h})()})})(se)),se.exports}var mr=yr();const Er=cr(mr);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:gt(L=>`${L},${L/2} 0,${L} 0,0`,"L"),R:gt(L=>`0,${L/2} ${L},0 ${L},${L}`,"R"),T:gt(L=>`0,0 ${L},0 ${L/2},${L}`,"T"),B:gt(L=>`${L/2},0 ${L},${L} 0,${L}`,"B")},oe={L:gt((L,b)=>L-b+2,"L"),R:gt((L,b)=>L-2,"R"),T:gt((L,b)=>L-b+2,"T"),B:gt((L,b)=>L-2,"B")},Tr=gt(function(L){return Wt(L)?L==="L"?"R":"L":L==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=gt(function(L){const b=L;return b==="L"||b==="R"||b==="T"||b==="B"},"isArchitectureDirection"),Wt=gt(function(L){const b=L;return b==="L"||b==="R"},"isArchitectureDirectionX"),qt=gt(function(L){const b=L;return b==="T"||b==="B"},"isArchitectureDirectionY"),Te=gt(function(L,b){const A=Wt(L)&&qt(b),G=qt(L)&&Wt(b);return A||G},"isArchitectureDirectionXY"),Nr=gt(function(L){const b=L[0],A=L[1],G=Wt(b)&&qt(A),N=qt(b)&&Wt(A);return G||N},"isArchitecturePairXY"),Lr=gt(function(L){return L!=="LL"&&L!=="RR"&&L!=="TT"&&L!=="BB"},"isValidArchitectureDirectionPair"),pe=gt(function(L,b){const A=`${L}${b}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=gt(function([L,b],A){const G=A[0],N=A[1];return Wt(G)?qt(N)?[L+(G==="L"?-1:1),b+(N==="T"?1:-1)]:[L+(G==="L"?-1:1),b]:Wt(N)?[L+(N==="L"?1:-1),b+(G==="T"?1:-1)]:[L,b+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),wr=gt(function(L){return L==="LT"||L==="TL"?[1,1]:L==="BL"||L==="LB"?[1,-1]:L==="BR"||L==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Ar=gt(function(L,b){return Te(L,b)?"bend":Wt(L)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=gt(function(L){return L.type==="service"},"isArchitectureService"),Or=gt(function(L){return L.type==="junction"},"isArchitectureJunction"),be=gt(L=>L.data(),"edgeData"),ie=gt(L=>L.data(),"nodeData"),Dr=ar.architecture,Pe=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Qe,this.getAccTitle=Je,this.setDiagramTitle=Ke,this.getDiagramTitle=je,this.getAccDescription=_e,this.setAccDescription=tr,this.clear()}static{gt(this,"ArchitectureDB")}setDiagramId(L){this.diagramId=L}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",er()}addService({id:L,icon:b,in:A,title:G,iconText:N}){if(this.registeredIds[L]!==void 0)throw new Error(`The service id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The service [${L}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The service [${L}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[A]==="node")throw new Error(`The service [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"service",icon:b,iconText:N,title:G,edges:[],in:A}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:L,in:b}){if(this.registeredIds[L]!==void 0)throw new Error(`The junction id [${L}] is already in use by another ${this.registeredIds[L]}`);if(b!==void 0){if(L===b)throw new Error(`The junction [${L}] cannot be placed within itself`);if(this.registeredIds[b]===void 0)throw new Error(`The junction [${L}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[b]==="node")throw new Error(`The junction [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"junction",edges:[],in:b}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(L){return this.nodes[L]??null}addGroup({id:L,icon:b,in:A,title:G}){if(this.registeredIds?.[L]!==void 0)throw new Error(`The group id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The group [${L}] cannot be placed within itself`);if(this.registeredIds?.[A]===void 0)throw new Error(`The group [${L}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[A]==="node")throw new Error(`The group [${L}]'s parent is not a group`)}this.registeredIds[L]="group",this.groups[L]={id:L,icon:b,title:G,in:A}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:L,rhsId:b,lhsDir:A,rhsDir:G,lhsInto:N,rhsInto:v,lhsGroup:h,rhsGroup:i,title:r}){if(!Re(A))throw new Error(`Invalid direction given for left hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(A)}`);if(!Re(G))throw new Error(`Invalid direction given for right hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(G)}`);if(this.nodes[L]===void 0&&this.groups[L]===void 0)throw new Error(`The left-hand id [${L}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[b]===void 0&&this.groups[b]===void 0)throw new Error(`The right-hand id [${b}] does not yet exist. Please create the service/group before declaring an edge to it.`);const a=this.nodes[L].in,f=this.nodes[b].in;if(h&&a&&f&&a==f)throw new Error(`The left-hand id [${L}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(i&&a&&f&&a==f)throw new Error(`The right-hand id [${b}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const e={lhsId:L,lhsDir:A,lhsInto:N,lhsGroup:h,rhsId:b,rhsDir:G,rhsInto:v,rhsGroup:i,title:r};this.edges.push(e),this.nodes[L]&&this.nodes[b]&&(this.nodes[L].edges.push(this.edges[this.edges.length-1]),this.nodes[b].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(L){if(L.members.length<2)throw new Error(`An align directive requires at least two members; got ${L.members.length}`);const b=new Set;L.members.forEach(A=>{if(this.registeredIds[A]!=="node")throw new Error(`align ${L.direction} references [${A}], which is not a service or junction`);if(b.has(A))throw new Error(`align ${L.direction} lists [${A}] more than once`);b.add(A)}),this.layoutHints.push(L)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const L={},b=Object.entries(this.nodes).reduce((i,[r,a])=>(i[r]=a.edges.reduce((f,e)=>{const u=this.getNode(e.lhsId)?.in,t=this.getNode(e.rhsId)?.in;if(u&&t&&u!==t){const s=Ar(e.lhsDir,e.rhsDir);s!=="bend"&&(L[u]??={},L[u][t]=s,L[t]??={},L[t][u]=s)}if(e.lhsId===r){const s=pe(e.lhsDir,e.rhsDir);s&&(f[s]=e.rhsId)}else{const s=pe(e.rhsDir,e.lhsDir);s&&(f[s]=e.lhsId)}return f},{}),i),{}),A=Object.keys(b)[0],G={[A]:1},N=Object.keys(b).reduce((i,r)=>r===A?i:{...i,[r]:1},{}),v=gt(i=>{const r={[i]:[0,0]},a=[i];for(;a.length>0;){const f=a.shift();if(f){G[f]=1,delete N[f];const e=b[f],[u,t]=r[f];Object.entries(e).forEach(([s,o])=>{G[o]||(r[o]=Cr([u,t],s),a.push(o))})}}return r},"BFS"),h=[v(A)];for(;Object.keys(N).length>0;)h.push(v(Object.keys(N)[0]));this.dataStructures={adjList:b,spatialMaps:h,groupAlignments:L}}return this.dataStructures}setElementForId(L,b){this.elements[L]=b}getElementById(L){return this.elements[L]}getConfig(){return rr({...Dr,...ir().architecture})}getConfigField(L){return this.getConfig()[L]}},xr=gt((L,b)=>{ke(L,b),L.groups.map(A=>b.addGroup(A)),L.services.map(A=>b.addService({...A,type:"service"})),L.junctions.map(A=>b.addJunction({...A,type:"junction"})),L.edges.map(A=>b.addEdge(A)),L.alignments?.map(A=>b.addLayoutHint({direction:A.direction,members:[...A.members]}))},"populateDb"),Ge={parser:{yy:void 0},parse:gt(async L=>{const b=await fr("architecture",L);Se.debug(b);const A=Ge.parser?.yy;if(!(A instanceof Pe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");xr(b,A)},"parse")},Ir=gt(L=>`
        +import{p as ke}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as gt,F as Ze,ad as qe,l as Se,b as Qe,a as Je,o as Ke,p as je,g as _e,s as tr,q as er,B as rr,z as ir,D as ar,c as me,a$ as Ee,ai as ve,i as nr,d as or,r as sr,aj as hr,b7 as lr}from"./mermaid.core-CsZwh_jB.js";import{p as fr}from"./cynefin-VYW2F7L2-CD6doQLg.js";import{c as Fe}from"./cytoscape.esm-OyMbaexL.js";import{g as cr}from"./_commonjsHelpers-CqkleIqs.js";import"./index-Bxn5yOTB.js";var se={exports:{}},he={exports:{}},le={exports:{}},gr=le.exports,Me;function ur(){return Me||(Me=1,(function(L,b){(function(G,N){L.exports=N()})(gr,function(){return(function(A){var G={};function N(v){if(G[v])return G[v].exports;var h=G[v]={i:v,l:!1,exports:{}};return A[v].call(h.exports,h,h.exports,N),h.l=!0,h.exports}return N.m=A,N.c=G,N.i=function(v){return v},N.d=function(v,h,i){N.o(v,h)||Object.defineProperty(v,h,{configurable:!1,enumerable:!0,get:i})},N.n=function(v){var h=v&&v.__esModule?function(){return v.default}:function(){return v};return N.d(h,"a",h),h},N.o=function(v,h){return Object.prototype.hasOwnProperty.call(v,h)},N.p="",N(N.s=28)})([(function(A,G,N){function v(){}v.QUALITY=1,v.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,v.DEFAULT_INCREMENTAL=!1,v.DEFAULT_ANIMATION_ON_LAYOUT=!0,v.DEFAULT_ANIMATION_DURING_LAYOUT=!1,v.DEFAULT_ANIMATION_PERIOD=50,v.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,v.DEFAULT_GRAPH_MARGIN=15,v.NODE_DIMENSIONS_INCLUDE_LABELS=!1,v.SIMPLE_NODE_SIZE=40,v.SIMPLE_NODE_HALF_SIZE=v.SIMPLE_NODE_SIZE/2,v.EMPTY_COMPOUND_NODE_SIZE=40,v.MIN_EDGE_LENGTH=1,v.WORLD_BOUNDARY=1e6,v.INITIAL_WORLD_BOUNDARY=v.WORLD_BOUNDARY/1e3,v.WORLD_CENTER_X=1200,v.WORLD_CENTER_Y=900,A.exports=v}),(function(A,G,N){var v=N(2),h=N(8),i=N(9);function r(f,e,u){v.call(this,u),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=u,this.bendpoints=[],this.source=f,this.target=e}r.prototype=Object.create(v.prototype);for(var a in v)r[a]=v[a];r.prototype.getSource=function(){return this.source},r.prototype.getTarget=function(){return this.target},r.prototype.isInterGraph=function(){return this.isInterGraph},r.prototype.getLength=function(){return this.length},r.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},r.prototype.getBendpoints=function(){return this.bendpoints},r.prototype.getLca=function(){return this.lca},r.prototype.getSourceInLca=function(){return this.sourceInLca},r.prototype.getTargetInLca=function(){return this.targetInLca},r.prototype.getOtherEnd=function(f){if(this.source===f)return this.target;if(this.target===f)return this.source;throw"Node is not incident with this edge"},r.prototype.getOtherEndInGraph=function(f,e){for(var u=this.getOtherEnd(f),t=e.getGraphManager().getRoot();;){if(u.getOwner()==e)return u;if(u.getOwner()==t)break;u=u.getOwner().getParent()}return null},r.prototype.updateLength=function(){var f=new Array(4);this.isOverlapingSourceAndTarget=h.getIntersection(this.target.getRect(),this.source.getRect(),f),this.isOverlapingSourceAndTarget||(this.lengthX=f[0]-f[2],this.lengthY=f[1]-f[3],Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},r.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=i.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=i.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},A.exports=r}),(function(A,G,N){function v(h){this.vGraphObject=h}A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(13),r=N(0),a=N(16),f=N(5);function e(t,s,o,c){o==null&&c==null&&(c=s),v.call(this,c),t.graphManager!=null&&(t=t.graphManager),this.estimatedSize=h.MIN_VALUE,this.inclusionTreeDepth=h.MAX_VALUE,this.vGraphObject=c,this.edges=[],this.graphManager=t,o!=null&&s!=null?this.rect=new i(s.x,s.y,o.width,o.height):this.rect=new i}e.prototype=Object.create(v.prototype);for(var u in v)e[u]=v[u];e.prototype.getEdges=function(){return this.edges},e.prototype.getChild=function(){return this.child},e.prototype.getOwner=function(){return this.owner},e.prototype.getWidth=function(){return this.rect.width},e.prototype.setWidth=function(t){this.rect.width=t},e.prototype.getHeight=function(){return this.rect.height},e.prototype.setHeight=function(t){this.rect.height=t},e.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},e.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},e.prototype.getCenter=function(){return new f(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},e.prototype.getLocation=function(){return new f(this.rect.x,this.rect.y)},e.prototype.getRect=function(){return this.rect},e.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},e.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},e.prototype.setRect=function(t,s){this.rect.x=t.x,this.rect.y=t.y,this.rect.width=s.width,this.rect.height=s.height},e.prototype.setCenter=function(t,s){this.rect.x=t-this.rect.width/2,this.rect.y=s-this.rect.height/2},e.prototype.setLocation=function(t,s){this.rect.x=t,this.rect.y=s},e.prototype.moveBy=function(t,s){this.rect.x+=t,this.rect.y+=s},e.prototype.getEdgeListToNode=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(c.target==t){if(c.source!=o)throw"Incorrect edge source!";s.push(c)}}),s},e.prototype.getEdgesBetween=function(t){var s=[],o=this;return o.edges.forEach(function(c){if(!(c.source==o||c.target==o))throw"Incorrect edge source and/or target";(c.target==t||c.source==t)&&s.push(c)}),s},e.prototype.getNeighborsList=function(){var t=new Set,s=this;return s.edges.forEach(function(o){if(o.source==s)t.add(o.target);else{if(o.target!=s)throw"Incorrect incidency!";t.add(o.source)}}),t},e.prototype.withChildren=function(){var t=new Set,s,o;if(t.add(this),this.child!=null)for(var c=this.child.getNodes(),l=0;ls?(this.rect.x-=(this.labelWidth-s)/2,this.setWidth(this.labelWidth)):this.labelPosHorizontal=="right"&&this.setWidth(s+this.labelWidth)),this.labelHeight&&(this.labelPosVertical=="top"?(this.rect.y-=this.labelHeight,this.setHeight(o+this.labelHeight)):this.labelPosVertical=="center"&&this.labelHeight>o?(this.rect.y-=(this.labelHeight-o)/2,this.setHeight(this.labelHeight)):this.labelPosVertical=="bottom"&&this.setHeight(o+this.labelHeight))}}},e.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==h.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},e.prototype.transform=function(t){var s=this.rect.x;s>r.WORLD_BOUNDARY?s=r.WORLD_BOUNDARY:s<-r.WORLD_BOUNDARY&&(s=-r.WORLD_BOUNDARY);var o=this.rect.y;o>r.WORLD_BOUNDARY?o=r.WORLD_BOUNDARY:o<-r.WORLD_BOUNDARY&&(o=-r.WORLD_BOUNDARY);var c=new f(s,o),l=t.inverseTransformPoint(c);this.setLocation(l.x,l.y)},e.prototype.getLeft=function(){return this.rect.x},e.prototype.getRight=function(){return this.rect.x+this.rect.width},e.prototype.getTop=function(){return this.rect.y},e.prototype.getBottom=function(){return this.rect.y+this.rect.height},e.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},A.exports=e}),(function(A,G,N){var v=N(0);function h(){}for(var i in v)h[i]=v[i];h.MAX_ITERATIONS=2500,h.DEFAULT_EDGE_LENGTH=50,h.DEFAULT_SPRING_STRENGTH=.45,h.DEFAULT_REPULSION_STRENGTH=4500,h.DEFAULT_GRAVITY_STRENGTH=.4,h.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,h.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,h.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,h.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,h.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,h.COOLING_ADAPTATION_FACTOR=.33,h.ADAPTATION_LOWER_NODE_LIMIT=1e3,h.ADAPTATION_UPPER_NODE_LIMIT=5e3,h.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,h.MAX_NODE_DISPLACEMENT=h.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,h.MIN_REPULSION_DIST=h.DEFAULT_EDGE_LENGTH/10,h.CONVERGENCE_CHECK_PERIOD=100,h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,h.MIN_EDGE_LENGTH=1,h.GRID_CALCULATION_CHECK_PERIOD=10,A.exports=h}),(function(A,G,N){function v(h,i){h==null&&i==null?(this.x=0,this.y=0):(this.x=h,this.y=i)}v.prototype.getX=function(){return this.x},v.prototype.getY=function(){return this.y},v.prototype.setX=function(h){this.x=h},v.prototype.setY=function(h){this.y=h},v.prototype.getDifference=function(h){return new DimensionD(this.x-h.x,this.y-h.y)},v.prototype.getCopy=function(){return new v(this.x,this.y)},v.prototype.translate=function(h){return this.x+=h.width,this.y+=h.height,this},A.exports=v}),(function(A,G,N){var v=N(2),h=N(10),i=N(0),r=N(7),a=N(3),f=N(1),e=N(13),u=N(12),t=N(11);function s(c,l,T){v.call(this,T),this.estimatedSize=h.MIN_VALUE,this.margin=i.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=c,l!=null&&l instanceof r?this.graphManager=l:l!=null&&l instanceof Layout&&(this.graphManager=l.graphManager)}s.prototype=Object.create(v.prototype);for(var o in v)s[o]=v[o];s.prototype.getNodes=function(){return this.nodes},s.prototype.getEdges=function(){return this.edges},s.prototype.getGraphManager=function(){return this.graphManager},s.prototype.getParent=function(){return this.parent},s.prototype.getLeft=function(){return this.left},s.prototype.getRight=function(){return this.right},s.prototype.getTop=function(){return this.top},s.prototype.getBottom=function(){return this.bottom},s.prototype.isConnected=function(){return this.isConnected},s.prototype.add=function(c,l,T){if(l==null&&T==null){var g=c;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(g)>-1)throw"Node already in graph!";return g.owner=this,this.getNodes().push(g),g}else{var d=c;if(!(this.getNodes().indexOf(l)>-1&&this.getNodes().indexOf(T)>-1))throw"Source or target not in graph!";if(!(l.owner==T.owner&&l.owner==this))throw"Both owners must be this graph!";return l.owner!=T.owner?null:(d.source=l,d.target=T,d.isInterGraph=!1,this.getEdges().push(d),l.edges.push(d),T!=l&&T.edges.push(d),d)}},s.prototype.remove=function(c){var l=c;if(c instanceof a){if(l==null)throw"Node is null!";if(!(l.owner!=null&&l.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var T=l.edges.slice(),g,d=T.length,C=0;C-1&&P>-1))throw"Source and/or target doesn't know this edge!";g.source.edges.splice(w,1),g.target!=g.source&&g.target.edges.splice(P,1);var S=g.source.owner.getEdges().indexOf(g);if(S==-1)throw"Not in owner's edge list!";g.source.owner.getEdges().splice(S,1)}},s.prototype.updateLeftTop=function(){for(var c=h.MAX_VALUE,l=h.MAX_VALUE,T,g,d,C=this.getNodes(),S=C.length,w=0;wT&&(c=T),l>g&&(l=g)}return c==h.MAX_VALUE?null:(C[0].getParent().paddingLeft!=null?d=C[0].getParent().paddingLeft:d=this.margin,this.left=l-d,this.top=c-d,new u(this.left,this.top))},s.prototype.updateBounds=function(c){for(var l=h.MAX_VALUE,T=-h.MAX_VALUE,g=h.MAX_VALUE,d=-h.MAX_VALUE,C,S,w,P,B,U=this.nodes,V=U.length,M=0;MC&&(l=C),Tw&&(g=w),dC&&(l=C),Tw&&(g=w),d=this.nodes.length){var V=0;T.forEach(function(M){M.owner==c&&V++}),V==this.nodes.length&&(this.isConnected=!0)}},A.exports=s}),(function(A,G,N){var v,h=N(1);function i(r){v=N(6),this.layout=r,this.graphs=[],this.edges=[]}i.prototype.addRoot=function(){var r=this.layout.newGraph(),a=this.layout.newNode(null),f=this.add(r,a);return this.setRootGraph(f),this.rootGraph},i.prototype.add=function(r,a,f,e,u){if(f==null&&e==null&&u==null){if(r==null)throw"Graph is null!";if(a==null)throw"Parent node is null!";if(this.graphs.indexOf(r)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(r),r.parent!=null)throw"Already has a parent!";if(a.child!=null)throw"Already has a child!";return r.parent=a,a.child=r,r}else{u=f,e=a,f=r;var t=e.getOwner(),s=u.getOwner();if(!(t!=null&&t.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(s!=null&&s.getGraphManager()==this))throw"Target not in this graph mgr!";if(t==s)return f.isInterGraph=!1,t.add(f,e,u);if(f.isInterGraph=!0,f.source=e,f.target=u,this.edges.indexOf(f)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(f),!(f.source!=null&&f.target!=null))throw"Edge source and/or target is null!";if(!(f.source.edges.indexOf(f)==-1&&f.target.edges.indexOf(f)==-1))throw"Edge already in source and/or target incidency list!";return f.source.edges.push(f),f.target.edges.push(f),f}},i.prototype.remove=function(r){if(r instanceof v){var a=r;if(a.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(a==this.rootGraph||a.parent!=null&&a.parent.graphManager==this))throw"Invalid parent node!";var f=[];f=f.concat(a.getEdges());for(var e,u=f.length,t=0;t=r.getRight()?a[0]+=Math.min(r.getX()-i.getX(),i.getRight()-r.getRight()):r.getX()<=i.getX()&&r.getRight()>=i.getRight()&&(a[0]+=Math.min(i.getX()-r.getX(),r.getRight()-i.getRight())),i.getY()<=r.getY()&&i.getBottom()>=r.getBottom()?a[1]+=Math.min(r.getY()-i.getY(),i.getBottom()-r.getBottom()):r.getY()<=i.getY()&&r.getBottom()>=i.getBottom()&&(a[1]+=Math.min(i.getY()-r.getY(),r.getBottom()-i.getBottom()));var u=Math.abs((r.getCenterY()-i.getCenterY())/(r.getCenterX()-i.getCenterX()));r.getCenterY()===i.getCenterY()&&r.getCenterX()===i.getCenterX()&&(u=1);var t=u*a[0],s=a[1]/u;a[0]t)return a[0]=f,a[1]=o,a[2]=u,a[3]=U,!1;if(eu)return a[0]=s,a[1]=e,a[2]=P,a[3]=t,!1;if(fu?(a[0]=l,a[1]=T,n=!0):(a[0]=c,a[1]=o,n=!0):p===y&&(f>u?(a[0]=s,a[1]=o,n=!0):(a[0]=g,a[1]=T,n=!0)),-m===y?u>f?(a[2]=B,a[3]=U,E=!0):(a[2]=P,a[3]=w,E=!0):m===y&&(u>f?(a[2]=S,a[3]=w,E=!0):(a[2]=V,a[3]=U,E=!0)),n&&E)return!1;if(f>u?e>t?(I=this.getCardinalDirection(p,y,4),O=this.getCardinalDirection(m,y,2)):(I=this.getCardinalDirection(-p,y,3),O=this.getCardinalDirection(-m,y,1)):e>t?(I=this.getCardinalDirection(-p,y,1),O=this.getCardinalDirection(-m,y,3)):(I=this.getCardinalDirection(p,y,2),O=this.getCardinalDirection(m,y,4)),!n)switch(I){case 1:W=o,R=f+-C/y,a[0]=R,a[1]=W;break;case 2:R=g,W=e+d*y,a[0]=R,a[1]=W;break;case 3:W=T,R=f+C/y,a[0]=R,a[1]=W;break;case 4:R=l,W=e+-d*y,a[0]=R,a[1]=W;break}if(!E)switch(O){case 1:Q=w,x=u+-_/y,a[2]=x,a[3]=Q;break;case 2:x=V,Q=t+M*y,a[2]=x,a[3]=Q;break;case 3:Q=U,x=u+_/y,a[2]=x,a[3]=Q;break;case 4:x=B,Q=t+-M*y,a[2]=x,a[3]=Q;break}}return!1},h.getCardinalDirection=function(i,r,a){return i>r?a:1+a%4},h.getIntersection=function(i,r,a,f){if(f==null)return this.getIntersection2(i,r,a);var e=i.x,u=i.y,t=r.x,s=r.y,o=a.x,c=a.y,l=f.x,T=f.y,g=void 0,d=void 0,C=void 0,S=void 0,w=void 0,P=void 0,B=void 0,U=void 0,V=void 0;return C=s-u,w=e-t,B=t*u-e*s,S=T-c,P=o-l,U=l*c-o*T,V=C*P-S*w,V===0?null:(g=(w*U-P*B)/V,d=(S*B-C*U)/V,new v(g,d))},h.angleOfVector=function(i,r,a,f){var e=void 0;return i!==a?(e=Math.atan((f-r)/(a-i)),a=0){var T=(-o+Math.sqrt(o*o-4*s*c))/(2*s),g=(-o-Math.sqrt(o*o-4*s*c))/(2*s),d=null;return T>=0&&T<=1?[T]:g>=0&&g<=1?[g]:d}else return null},h.HALF_PI=.5*Math.PI,h.ONE_AND_HALF_PI=1.5*Math.PI,h.TWO_PI=2*Math.PI,h.THREE_PI=3*Math.PI,A.exports=h}),(function(A,G,N){function v(){}v.sign=function(h){return h>0?1:h<0?-1:0},v.floor=function(h){return h<0?Math.ceil(h):Math.floor(h)},v.ceil=function(h){return h<0?Math.floor(h):Math.ceil(h)},A.exports=v}),(function(A,G,N){function v(){}v.MAX_VALUE=2147483647,v.MIN_VALUE=-2147483648,A.exports=v}),(function(A,G,N){var v=(function(){function e(u,t){for(var s=0;s"u"?"undefined":v(i);return i==null||r!="object"&&r!="function"},A.exports=h}),(function(A,G,N){function v(o){if(Array.isArray(o)){for(var c=0,l=Array(o.length);c0&&c;){for(C.push(w[0]);C.length>0&&c;){var P=C[0];C.splice(0,1),d.add(P);for(var B=P.getEdges(),g=0;g-1&&w.splice(_,1)}d=new Set,S=new Map}}return o},s.prototype.createDummyNodesForBendpoints=function(o){for(var c=[],l=o.source,T=this.graphManager.calcLowestCommonAncestor(o.source,o.target),g=0;g0){for(var T=this.edgeToDummyNodes.get(l),g=0;g=0&&c.splice(U,1);var V=S.getNeighborsList();V.forEach(function(n){if(l.indexOf(n)<0){var E=T.get(n),p=E-1;p==1&&P.push(n),T.set(n,p)}})}l=l.concat(P),(c.length==1||c.length==2)&&(g=!0,d=c[0])}return d},s.prototype.setGraphManager=function(o){this.graphManager=o},A.exports=s}),(function(A,G,N){function v(){}v.seed=1,v.x=0,v.nextDouble=function(){return v.x=Math.sin(v.seed++)*1e4,v.x-Math.floor(v.x)},A.exports=v}),(function(A,G,N){var v=N(5);function h(i,r){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}h.prototype.getWorldOrgX=function(){return this.lworldOrgX},h.prototype.setWorldOrgX=function(i){this.lworldOrgX=i},h.prototype.getWorldOrgY=function(){return this.lworldOrgY},h.prototype.setWorldOrgY=function(i){this.lworldOrgY=i},h.prototype.getWorldExtX=function(){return this.lworldExtX},h.prototype.setWorldExtX=function(i){this.lworldExtX=i},h.prototype.getWorldExtY=function(){return this.lworldExtY},h.prototype.setWorldExtY=function(i){this.lworldExtY=i},h.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},h.prototype.setDeviceOrgX=function(i){this.ldeviceOrgX=i},h.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},h.prototype.setDeviceOrgY=function(i){this.ldeviceOrgY=i},h.prototype.getDeviceExtX=function(){return this.ldeviceExtX},h.prototype.setDeviceExtX=function(i){this.ldeviceExtX=i},h.prototype.getDeviceExtY=function(){return this.ldeviceExtY},h.prototype.setDeviceExtY=function(i){this.ldeviceExtY=i},h.prototype.transformX=function(i){var r=0,a=this.lworldExtX;return a!=0&&(r=this.ldeviceOrgX+(i-this.lworldOrgX)*this.ldeviceExtX/a),r},h.prototype.transformY=function(i){var r=0,a=this.lworldExtY;return a!=0&&(r=this.ldeviceOrgY+(i-this.lworldOrgY)*this.ldeviceExtY/a),r},h.prototype.inverseTransformX=function(i){var r=0,a=this.ldeviceExtX;return a!=0&&(r=this.lworldOrgX+(i-this.ldeviceOrgX)*this.lworldExtX/a),r},h.prototype.inverseTransformY=function(i){var r=0,a=this.ldeviceExtY;return a!=0&&(r=this.lworldOrgY+(i-this.ldeviceOrgY)*this.lworldExtY/a),r},h.prototype.inverseTransformPoint=function(i){var r=new v(this.inverseTransformX(i.x),this.inverseTransformY(i.y));return r},A.exports=h}),(function(A,G,N){function v(t){if(Array.isArray(t)){for(var s=0,o=Array(t.length);si.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*i.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-i.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT_INCREMENTAL):(t>i.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(i.COOLING_ADAPTATION_FACTOR,1-(t-i.ADAPTATION_LOWER_NODE_LIMIT)/(i.ADAPTATION_UPPER_NODE_LIMIT-i.ADAPTATION_LOWER_NODE_LIMIT)*(1-i.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=i.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.displacementThresholdPerNode=3*i.DEFAULT_EDGE_LENGTH/100,this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},e.prototype.calcSpringForces=function(){for(var t=this.getAllEdges(),s,o=0;o0&&arguments[0]!==void 0?arguments[0]:!0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,o,c,l,T,g=this.getAllNodes(),d;if(this.useFRGridVariant)for(this.totalIterations%i.GRID_CALCULATION_CHECK_PERIOD==1&&t&&this.updateGrid(),d=new Set,o=0;oC||d>C)&&(t.gravitationForceX=-this.gravityConstant*l,t.gravitationForceY=-this.gravityConstant*T)):(C=s.getEstimatedSize()*this.compoundGravityRangeFactor,(g>C||d>C)&&(t.gravitationForceX=-this.gravityConstant*l*this.compoundGravityConstant,t.gravitationForceY=-this.gravityConstant*T*this.compoundGravityConstant))},e.prototype.isConverged=function(){var t,s=!1;return this.totalIterations>this.maxIterations/3&&(s=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),t=this.totalDisplacement=g.length||C>=g[0].length)){for(var S=0;Se}}]),a})();A.exports=r}),(function(A,G,N){function v(){}v.svd=function(h){this.U=null,this.V=null,this.s=null,this.m=0,this.n=0,this.m=h.length,this.n=h[0].length;var i=Math.min(this.m,this.n);this.s=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(Math.min(this.m+1,this.n)),this.U=(function(Tt){var Ct=function Bt(bt){if(bt.length==0)return 0;for(var zt=[],St=0;St0;)Ct.push(0);return Ct})(this.n),a=(function(Tt){for(var Ct=[];Tt-- >0;)Ct.push(0);return Ct})(this.m),f=!0,e=Math.min(this.m-1,this.n),u=Math.max(0,Math.min(this.n-2,this.m)),t=0;t=0;m--)if(this.s[m]!==0){for(var y=m+1;y=0;z--){if((function(Tt,Ct){return Tt&&Ct})(z0;){var J=void 0,It=void 0;for(J=n-2;J>=-1&&J!==-1;J--)if(Math.abs(r[J])<=ht+tt*(Math.abs(this.s[J])+Math.abs(this.s[J+1]))){r[J]=0;break}if(J===n-2)It=4;else{var Nt=void 0;for(Nt=n-1;Nt>=J&&Nt!==J;Nt--){var vt=(Nt!==n?Math.abs(r[Nt]):0)+(Nt!==J+1?Math.abs(r[Nt-1]):0);if(Math.abs(this.s[Nt])<=ht+tt*vt){this.s[Nt]=0;break}}Nt===J?It=3:Nt===n-1?It=1:(It=2,J=Nt)}switch(J++,It){case 1:{var it=r[n-2];r[n-2]=0;for(var ut=n-2;ut>=J;ut--){var Et=v.hypot(this.s[ut],it),wt=this.s[ut]/Et,Ot=it/Et;this.s[ut]=Et,ut!==J&&(it=-Ot*r[ut-1],r[ut-1]=wt*r[ut-1]);for(var mt=0;mt=this.s[J+1]);){var Lt=this.s[J];if(this.s[J]=this.s[J+1],this.s[J+1]=Lt,JMath.abs(i)?(r=i/h,r=Math.abs(h)*Math.sqrt(1+r*r)):i!=0?(r=h/i,r=Math.abs(i)*Math.sqrt(1+r*r)):r=0,r},A.exports=v}),(function(A,G,N){var v=(function(){function r(a,f){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:1,u=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,t=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;h(this,r),this.sequence1=a,this.sequence2=f,this.match_score=e,this.mismatch_penalty=u,this.gap_penalty=t,this.iMax=a.length+1,this.jMax=f.length+1,this.grid=new Array(this.iMax);for(var s=0;s=0;a--){var f=this.listeners[a];f.event===i&&f.callback===r&&this.listeners.splice(a,1)}},h.emit=function(i,r){for(var a=0;a{var G={45:((i,r,a)=>{var f={};f.layoutBase=a(551),f.CoSEConstants=a(806),f.CoSEEdge=a(767),f.CoSEGraph=a(880),f.CoSEGraphManager=a(578),f.CoSELayout=a(765),f.CoSENode=a(991),f.ConstraintHandler=a(902),i.exports=f}),806:((i,r,a)=>{var f=a(551).FDLayoutConstants;function e(){}for(var u in f)e[u]=f[u];e.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,e.DEFAULT_RADIAL_SEPARATION=f.DEFAULT_EDGE_LENGTH,e.DEFAULT_COMPONENT_SEPERATION=60,e.TILE=!0,e.TILING_PADDING_VERTICAL=10,e.TILING_PADDING_HORIZONTAL=10,e.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,e.ENFORCE_CONSTRAINTS=!0,e.APPLY_LAYOUT=!0,e.RELAX_MOVEMENT_ON_CONSTRAINTS=!0,e.TREE_REDUCTION_ON_INCREMENTAL=!0,e.PURE_INCREMENTAL=e.DEFAULT_INCREMENTAL,i.exports=e}),767:((i,r,a)=>{var f=a(551).FDLayoutEdge;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),880:((i,r,a)=>{var f=a(551).LGraph;function e(t,s,o){f.call(this,t,s,o)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),578:((i,r,a)=>{var f=a(551).LGraphManager;function e(t){f.call(this,t)}e.prototype=Object.create(f.prototype);for(var u in f)e[u]=f[u];i.exports=e}),765:((i,r,a)=>{var f=a(551).FDLayout,e=a(578),u=a(880),t=a(991),s=a(767),o=a(806),c=a(902),l=a(551).FDLayoutConstants,T=a(551).LayoutConstants,g=a(551).Point,d=a(551).PointD,C=a(551).DimensionD,S=a(551).Layout,w=a(551).Integer,P=a(551).IGeometry,B=a(551).LGraph,U=a(551).Transform,V=a(551).LinkedList;function M(){f.call(this),this.toBeTiled={},this.constraints={}}M.prototype=Object.create(f.prototype);for(var _ in f)M[_]=f[_];M.prototype.newGraphManager=function(){var n=new e(this);return this.graphManager=n,n},M.prototype.newGraph=function(n){return new u(null,this.graphManager,n)},M.prototype.newNode=function(n){return new t(this.graphManager,n)},M.prototype.newEdge=function(n){return new s(null,null,n)},M.prototype.initParameters=function(){f.prototype.initParameters.call(this,arguments),this.isSubLayout||(o.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=o.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1)},M.prototype.initSpringEmbedder=function(){f.prototype.initSpringEmbedder.call(this),this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=.04,this.coolingAdjuster=1},M.prototype.layout=function(){var n=T.DEFAULT_CREATE_BENDS_AS_NEEDED;return n&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},M.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),this.incremental){if(o.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(I){return E.has(I)});this.graphManager.setAllNodesToApplyGravitation(p)}}else{var n=this.getFlatForest();if(n.length>0)this.positionNodesRadially(n);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var E=new Set(this.getAllNodes()),p=this.nodesWithGravity.filter(function(m){return E.has(m)});this.graphManager.setAllNodesToApplyGravitation(p),this.positionNodesRandomly()}}return Object.keys(this.constraints).length>0&&(c.handleConstraints(this),this.initConstraintVariables()),this.initSpringEmbedder(),o.APPLY_LAYOUT&&this.runSpringEmbedder(),!0},M.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var n=new Set(this.getAllNodes()),E=this.nodesWithGravity.filter(function(y){return n.has(y)});this.graphManager.setAllNodesToApplyGravitation(E),this.graphManager.updateBounds(),this.updateGrid(),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2:this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),o.PURE_INCREMENTAL?this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL/2*((100-this.afterGrowthIterations)/100):this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var p=!this.isTreeGrowing&&!this.isGrowthFinished,m=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(p,m),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},M.prototype.getPositionsData=function(){for(var n=this.graphManager.getAllNodes(),E={},p=0;p0&&this.updateDisplacements();for(var p=0;p0&&(m.fixedNodeWeight=I)}}if(this.constraints.relativePlacementConstraint){var O=new Map,R=new Map;if(this.dummyToNodeForVerticalAlignment=new Map,this.dummyToNodeForHorizontalAlignment=new Map,this.fixedNodesOnHorizontal=new Set,this.fixedNodesOnVertical=new Set,this.fixedNodeSet.forEach(function(D){n.fixedNodesOnHorizontal.add(D),n.fixedNodesOnVertical.add(D)}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var W=this.constraints.alignmentConstraint.vertical,p=0;p=2*D.length/3;tt--)H=Math.floor(Math.random()*(tt+1)),k=D[tt],D[tt]=D[H],D[H]=k;return D},this.nodesInRelativeHorizontal=[],this.nodesInRelativeVertical=[],this.nodeToRelativeConstraintMapHorizontal=new Map,this.nodeToRelativeConstraintMapVertical=new Map,this.nodeToTempPositionMapHorizontal=new Map,this.nodeToTempPositionMapVertical=new Map,this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;n.nodesInRelativeHorizontal.includes(H)||(n.nodesInRelativeHorizontal.push(H),n.nodeToRelativeConstraintMapHorizontal.set(H,[]),n.dummyToNodeForVerticalAlignment.has(H)?n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(H,n.idToNodeMap.get(H).getCenterX())),n.nodesInRelativeHorizontal.includes(k)||(n.nodesInRelativeHorizontal.push(k),n.nodeToRelativeConstraintMapHorizontal.set(k,[]),n.dummyToNodeForVerticalAlignment.has(k)?n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(k)[0]).getCenterX()):n.nodeToTempPositionMapHorizontal.set(k,n.idToNodeMap.get(k).getCenterX())),n.nodeToRelativeConstraintMapHorizontal.get(H).push({right:k,gap:D.gap}),n.nodeToRelativeConstraintMapHorizontal.get(k).push({left:H,gap:D.gap})}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;n.nodesInRelativeVertical.includes(tt)||(n.nodesInRelativeVertical.push(tt),n.nodeToRelativeConstraintMapVertical.set(tt,[]),n.dummyToNodeForHorizontalAlignment.has(tt)?n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(tt)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(tt,n.idToNodeMap.get(tt).getCenterY())),n.nodesInRelativeVertical.includes(ht)||(n.nodesInRelativeVertical.push(ht),n.nodeToRelativeConstraintMapVertical.set(ht,[]),n.dummyToNodeForHorizontalAlignment.has(ht)?n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(ht)[0]).getCenterY()):n.nodeToTempPositionMapVertical.set(ht,n.idToNodeMap.get(ht).getCenterY())),n.nodeToRelativeConstraintMapVertical.get(tt).push({bottom:ht,gap:D.gap}),n.nodeToRelativeConstraintMapVertical.get(ht).push({top:tt,gap:D.gap})}});else{var Q=new Map,z=new Map;this.constraints.relativePlacementConstraint.forEach(function(D){if(D.left){var H=O.has(D.left)?O.get(D.left):D.left,k=O.has(D.right)?O.get(D.right):D.right;Q.has(H)?Q.get(H).push(k):Q.set(H,[k]),Q.has(k)?Q.get(k).push(H):Q.set(k,[H])}else{var tt=R.has(D.top)?R.get(D.top):D.top,ht=R.has(D.bottom)?R.get(D.bottom):D.bottom;z.has(tt)?z.get(tt).push(ht):z.set(tt,[ht]),z.has(ht)?z.get(ht).push(tt):z.set(ht,[tt])}});var X=function(H,k){var tt=[],ht=[],J=new V,It=new Set,Nt=0;return H.forEach(function(vt,it){if(!It.has(it)){tt[Nt]=[],ht[Nt]=!1;var ut=it;for(J.push(ut),It.add(ut),tt[Nt].push(ut);J.length!=0;){ut=J.shift(),k.has(ut)&&(ht[Nt]=!0);var Et=H.get(ut);Et.forEach(function(wt){It.has(wt)||(J.push(wt),It.add(wt),tt[Nt].push(wt))})}Nt++}}),{components:tt,isFixed:ht}},rt=X(Q,n.fixedNodesOnHorizontal);this.componentsOnHorizontal=rt.components,this.fixedComponentsOnHorizontal=rt.isFixed;var $=X(z,n.fixedNodesOnVertical);this.componentsOnVertical=$.components,this.fixedComponentsOnVertical=$.isFixed}}},M.prototype.updateDisplacements=function(){var n=this;if(this.constraints.fixedNodeConstraint&&this.constraints.fixedNodeConstraint.forEach(function($){var D=n.idToNodeMap.get($.nodeId);D.displacementX=0,D.displacementY=0}),this.constraints.alignmentConstraint){if(this.constraints.alignmentConstraint.vertical)for(var E=this.constraints.alignmentConstraint.vertical,p=0;p1){var R;for(R=0;Rm&&(m=Math.floor(O.y)),I=Math.floor(O.x+o.DEFAULT_COMPONENT_SEPERATION)}this.transform(new d(T.WORLD_CENTER_X-O.x/2,T.WORLD_CENTER_Y-O.y/2))},M.radialLayout=function(n,E,p){var m=Math.max(this.maxDiagonalInTree(n),o.DEFAULT_RADIAL_SEPARATION);M.branchRadialLayout(E,null,0,359,0,m);var y=B.calculateBounds(n),I=new U;I.setDeviceOrgX(y.getMinX()),I.setDeviceOrgY(y.getMinY()),I.setWorldOrgX(p.x),I.setWorldOrgY(p.y);for(var O=0;O1;){var k=H[0];H.splice(0,1);var tt=z.indexOf(k);tt>=0&&z.splice(tt,1),$--,X--}E!=null?D=(z.indexOf(H[0])+1)%$:D=0;for(var ht=Math.abs(m-p)/X,J=D;rt!=X;J=++J%$){var It=z[J].getOtherEnd(n);if(It!=E){var Nt=(p+rt*ht)%360,vt=(Nt+ht)%360;M.branchRadialLayout(It,n,Nt,vt,y+I,I),rt++}}},M.maxDiagonalInTree=function(n){for(var E=w.MIN_VALUE,p=0;pE&&(E=y)}return E},M.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},M.prototype.groupZeroDegreeMembers=function(){var n=this,E={};this.memberGroups={},this.idToDummyNode={};for(var p=[],m=this.graphManager.getAllNodes(),y=0;y"u"&&(E[R]=[]),E[R]=E[R].concat(I)}Object.keys(E).forEach(function(W){if(E[W].length>1){var x="DummyCompound_"+W;n.memberGroups[x]=E[W];var Q=E[W][0].getParent(),z=new t(n.graphManager);z.id=x,z.paddingLeft=Q.paddingLeft||0,z.paddingRight=Q.paddingRight||0,z.paddingBottom=Q.paddingBottom||0,z.paddingTop=Q.paddingTop||0,n.idToDummyNode[x]=z;var X=n.getGraphManager().add(n.newGraph(),z),rt=Q.getChild();rt.add(z);for(var $=0;$y?(m.rect.x-=(m.labelWidth-y)/2,m.setWidth(m.labelWidth),m.labelMarginLeft=(m.labelWidth-y)/2):m.labelPosHorizontal=="right"&&m.setWidth(y+m.labelWidth)),m.labelHeight&&(m.labelPosVertical=="top"?(m.rect.y-=m.labelHeight,m.setHeight(I+m.labelHeight),m.labelMarginTop=m.labelHeight):m.labelPosVertical=="center"&&m.labelHeight>I?(m.rect.y-=(m.labelHeight-I)/2,m.setHeight(m.labelHeight),m.labelMarginTop=(m.labelHeight-I)/2):m.labelPosVertical=="bottom"&&m.setHeight(I+m.labelHeight))}})},M.prototype.repopulateCompounds=function(){for(var n=this.compoundOrder.length-1;n>=0;n--){var E=this.compoundOrder[n],p=E.id,m=E.paddingLeft,y=E.paddingTop,I=E.labelMarginLeft,O=E.labelMarginTop;this.adjustLocations(this.tiledMemberPack[p],E.rect.x,E.rect.y,m,y,I,O)}},M.prototype.repopulateZeroDegreeMembers=function(){var n=this,E=this.tiledZeroDegreePack;Object.keys(E).forEach(function(p){var m=n.idToDummyNode[p],y=m.paddingLeft,I=m.paddingTop,O=m.labelMarginLeft,R=m.labelMarginTop;n.adjustLocations(E[p],m.rect.x,m.rect.y,y,I,O,R)})},M.prototype.getToBeTiled=function(n){var E=n.id;if(this.toBeTiled[E]!=null)return this.toBeTiled[E];var p=n.getChild();if(p==null)return this.toBeTiled[E]=!1,!1;for(var m=p.getNodes(),y=0;y0)return this.toBeTiled[E]=!1,!1;if(I.getChild()==null){this.toBeTiled[I.id]=!1;continue}if(!this.getToBeTiled(I))return this.toBeTiled[E]=!1,!1}return this.toBeTiled[E]=!0,!0},M.prototype.getNodeDegree=function(n){n.id;for(var E=n.getEdges(),p=0,m=0;mQ&&(Q=X.rect.height)}p+=Q+n.verticalPadding}},M.prototype.tileCompoundMembers=function(n,E){var p=this;this.tiledMemberPack=[],Object.keys(n).forEach(function(m){var y=E[m];if(p.tiledMemberPack[m]=p.tileNodes(n[m],y.paddingLeft+y.paddingRight),y.rect.width=p.tiledMemberPack[m].width,y.rect.height=p.tiledMemberPack[m].height,y.setCenter(p.tiledMemberPack[m].centerX,p.tiledMemberPack[m].centerY),y.labelMarginLeft=0,y.labelMarginTop=0,o.NODE_DIMENSIONS_INCLUDE_LABELS){var I=y.rect.width,O=y.rect.height;y.labelWidth&&(y.labelPosHorizontal=="left"?(y.rect.x-=y.labelWidth,y.setWidth(I+y.labelWidth),y.labelMarginLeft=y.labelWidth):y.labelPosHorizontal=="center"&&y.labelWidth>I?(y.rect.x-=(y.labelWidth-I)/2,y.setWidth(y.labelWidth),y.labelMarginLeft=(y.labelWidth-I)/2):y.labelPosHorizontal=="right"&&y.setWidth(I+y.labelWidth)),y.labelHeight&&(y.labelPosVertical=="top"?(y.rect.y-=y.labelHeight,y.setHeight(O+y.labelHeight),y.labelMarginTop=y.labelHeight):y.labelPosVertical=="center"&&y.labelHeight>O?(y.rect.y-=(y.labelHeight-O)/2,y.setHeight(y.labelHeight),y.labelMarginTop=(y.labelHeight-O)/2):y.labelPosVertical=="bottom"&&y.setHeight(O+y.labelHeight))}})},M.prototype.tileNodes=function(n,E){var p=this.tileNodesByFavoringDim(n,E,!0),m=this.tileNodesByFavoringDim(n,E,!1),y=this.getOrgRatio(p),I=this.getOrgRatio(m),O;return IR&&(R=$.getWidth())});var W=I/y,x=O/y,Q=Math.pow(p-m,2)+4*(W+m)*(x+p)*y,z=(m-p+Math.sqrt(Q))/(2*(W+m)),X;E?(X=Math.ceil(z),X==z&&X++):X=Math.floor(z);var rt=X*(W+m)-m;return R>rt&&(rt=R),rt+=m*2,rt},M.prototype.tileNodesByFavoringDim=function(n,E,p){var m=o.TILING_PADDING_VERTICAL,y=o.TILING_PADDING_HORIZONTAL,I=o.TILING_COMPARE_BY,O={rows:[],rowWidth:[],rowHeight:[],width:0,height:E,verticalPadding:m,horizontalPadding:y,centerX:0,centerY:0};I&&(O.idealRowWidth=this.calcIdealRowWidth(n,p));var R=function(D){return D.rect.width*D.rect.height},W=function(D,H){return R(H)-R(D)};n.sort(function($,D){var H=W;return O.idealRowWidth?(H=I,H($.id,D.id)):H($,D)});for(var x=0,Q=0,z=0;z0&&(O+=n.horizontalPadding),n.rowWidth[p]=O,n.width0&&(R+=n.verticalPadding);var W=0;R>n.rowHeight[p]&&(W=n.rowHeight[p],n.rowHeight[p]=R,W=n.rowHeight[p]-W),n.height+=W,n.rows[p].push(E)},M.prototype.getShortestRowIndex=function(n){for(var E=-1,p=Number.MAX_VALUE,m=0;mp&&(E=m,p=n.rowWidth[m]);return E},M.prototype.canAddHorizontal=function(n,E,p){if(n.idealRowWidth){var m=n.rows.length-1,y=n.rowWidth[m];return y+E+n.horizontalPadding<=n.idealRowWidth}var I=this.getShortestRowIndex(n);if(I<0)return!0;var O=n.rowWidth[I];if(O+n.horizontalPadding+E<=n.width)return!0;var R=0;n.rowHeight[I]0&&(R=p+n.verticalPadding-n.rowHeight[I]);var W;n.width-O>=E+n.horizontalPadding?W=(n.height+R)/(O+E+n.horizontalPadding):W=(n.height+R)/n.width,R=p+n.verticalPadding;var x;return n.widthI&&E!=p){m.splice(-1,1),n.rows[p].push(y),n.rowWidth[E]=n.rowWidth[E]-I,n.rowWidth[p]=n.rowWidth[p]+I,n.width=n.rowWidth[instance.getLongestRowIndex(n)];for(var O=Number.MIN_VALUE,R=0;RO&&(O=m[R].height);E>0&&(O+=n.verticalPadding);var W=n.rowHeight[E]+n.rowHeight[p];n.rowHeight[E]=O,n.rowHeight[p]0)for(var rt=y;rt<=I;rt++)X[0]+=this.grid[rt][O-1].length+this.grid[rt][O].length-1;if(I0)for(var rt=O;rt<=R;rt++)X[3]+=this.grid[y-1][rt].length+this.grid[y][rt].length-1;for(var $=w.MAX_VALUE,D,H,k=0;k{var f=a(551).FDLayoutNode,e=a(551).IMath;function u(s,o,c,l){f.call(this,s,o,c,l)}u.prototype=Object.create(f.prototype);for(var t in f)u[t]=f[t];u.prototype.calculateDisplacement=function(){var s=this.graphManager.getLayout();this.getChild()!=null&&this.fixedNodeWeight?(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.fixedNodeWeight,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.fixedNodeWeight):(this.displacementX+=s.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY+=s.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren),Math.abs(this.displacementX)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementX=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementX)),Math.abs(this.displacementY)>s.coolingFactor*s.maxNodeDisplacement&&(this.displacementY=s.coolingFactor*s.maxNodeDisplacement*e.sign(this.displacementY)),this.child&&this.child.getNodes().length>0&&this.propogateDisplacementToChildren(this.displacementX,this.displacementY)},u.prototype.propogateDisplacementToChildren=function(s,o){for(var c=this.getChild().getNodes(),l,T=0;T{function f(c){if(Array.isArray(c)){for(var l=0,T=Array(c.length);l0){var Lt=0;ot.forEach(function(st){Z=="horizontal"?(et.set(st,g.has(st)?d[g.get(st)]:q.get(st)),Lt+=et.get(st)):(et.set(st,g.has(st)?C[g.get(st)]:q.get(st)),Lt+=et.get(st))}),Lt=Lt/ot.length,lt.forEach(function(st){K.has(st)||et.set(st,Lt)})}else{var ft=0;lt.forEach(function(st){Z=="horizontal"?ft+=g.has(st)?d[g.get(st)]:q.get(st):ft+=g.has(st)?C[g.get(st)]:q.get(st)}),ft=ft/lt.length,lt.forEach(function(st){et.set(st,ft)})}});for(var At=function(){var ot=dt.shift(),Lt=Y.get(ot);Lt.forEach(function(ft){if(et.get(ft.id)st&&(st=kt),KtXt&&(Xt=Kt)}}catch(ee){Ct=!0,Bt=ee}finally{try{!Tt&&bt.return&&bt.return()}finally{if(Ct)throw Bt}}var fe=(Lt+st)/2-(ft+Xt)/2,Qt=!0,jt=!1,_t=void 0;try{for(var Jt=lt[Symbol.iterator](),ne;!(Qt=(ne=Jt.next()).done);Qt=!0){var te=ne.value;et.set(te,et.get(te)+fe)}}catch(ee){jt=!0,_t=ee}finally{try{!Qt&&Jt.return&&Jt.return()}finally{if(jt)throw _t}}})}return et},_=function(Y){var Z=0,K=0,q=0,at=0;if(Y.forEach(function(j){j.left?d[g.get(j.left)]-d[g.get(j.right)]>=0?Z++:K++:C[g.get(j.top)]-C[g.get(j.bottom)]>=0?q++:at++}),Z>K&&q>at)for(var ct=0;ctK)for(var nt=0;ntat)for(var et=0;et1)l.fixedNodeConstraint.forEach(function(F,Y){m[Y]=[F.position.x,F.position.y],y[Y]=[d[g.get(F.nodeId)],C[g.get(F.nodeId)]]}),I=!0;else if(l.alignmentConstraint)(function(){var F=0;if(l.alignmentConstraint.vertical){for(var Y=l.alignmentConstraint.vertical,Z=function(et){var j=new Set;Y[et].forEach(function(pt){j.add(pt)});var dt=new Set([].concat(f(j)).filter(function(pt){return R.has(pt)})),At=void 0;dt.size>0?At=d[g.get(dt.values().next().value)]:At=V(j).x,Y[et].forEach(function(pt){m[F]=[At,C[g.get(pt)]],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},K=0;K0?At=d[g.get(dt.values().next().value)]:At=V(j).y,q[et].forEach(function(pt){m[F]=[d[g.get(pt)],At],y[F]=[d[g.get(pt)],C[g.get(pt)]],F++})},ct=0;ctz&&(z=Q[rt].length,X=rt);if(z0){var mt={x:0,y:0};l.fixedNodeConstraint.forEach(function(F,Y){var Z={x:d[g.get(F.nodeId)],y:C[g.get(F.nodeId)]},K=F.position,q=U(K,Z);mt.x+=q.x,mt.y+=q.y}),mt.x/=l.fixedNodeConstraint.length,mt.y/=l.fixedNodeConstraint.length,d.forEach(function(F,Y){d[Y]+=mt.x}),C.forEach(function(F,Y){C[Y]+=mt.y}),l.fixedNodeConstraint.forEach(function(F){d[g.get(F.nodeId)]=F.position.x,C[g.get(F.nodeId)]=F.position.y})}if(l.alignmentConstraint){if(l.alignmentConstraint.vertical)for(var Dt=l.alignmentConstraint.vertical,Rt=function(Y){var Z=new Set;Dt[Y].forEach(function(at){Z.add(at)});var K=new Set([].concat(f(Z)).filter(function(at){return R.has(at)})),q=void 0;K.size>0?q=d[g.get(K.values().next().value)]:q=V(Z).x,Z.forEach(function(at){R.has(at)||(d[g.get(at)]=q)})},Ht=0;Ht0?q=C[g.get(K.values().next().value)]:q=V(Z).y,Z.forEach(function(at){R.has(at)||(C[g.get(at)]=q)})},Ft=0;Ft{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(45);return h})()})})(he)),he.exports}var pr=se.exports,De;function yr(){return De||(De=1,(function(L,b){(function(G,N){L.exports=N(vr())})(pr,function(A){return(()=>{var G={658:(i=>{i.exports=Object.assign!=null?Object.assign.bind(Object):function(r){for(var a=arguments.length,f=Array(a>1?a-1:0),e=1;e{var f=(function(){function t(s,o){var c=[],l=!0,T=!1,g=void 0;try{for(var d=s[Symbol.iterator](),C;!(l=(C=d.next()).done)&&(c.push(C.value),!(o&&c.length===o));l=!0);}catch(S){T=!0,g=S}finally{try{!l&&d.return&&d.return()}finally{if(T)throw g}}return c}return function(s,o){if(Array.isArray(s))return s;if(Symbol.iterator in Object(s))return t(s,o);throw new TypeError("Invalid attempt to destructure non-iterable instance")}})(),e=a(140).layoutBase.LinkedList,u={};u.getTopMostNodes=function(t){for(var s={},o=0;o0&&I.merge(x)});for(var O=0;O1){C=g[0],S=C.connectedEdges().length,g.forEach(function(y){y.connectedEdges().length0&&c.set("dummy"+(c.size+1),B),U},u.relocateComponent=function(t,s,o){if(!o.fixedNodeConstraint){var c=Number.POSITIVE_INFINITY,l=Number.NEGATIVE_INFINITY,T=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;if(o.quality=="draft"){var d=!0,C=!1,S=void 0;try{for(var w=s.nodeIndexes[Symbol.iterator](),P;!(d=(P=w.next()).done);d=!0){var B=P.value,U=f(B,2),V=U[0],M=U[1],_=o.cy.getElementById(V);if(_){var n=_.boundingBox(),E=s.xCoords[M]-n.w/2,p=s.xCoords[M]+n.w/2,m=s.yCoords[M]-n.h/2,y=s.yCoords[M]+n.h/2;El&&(l=p),mg&&(g=y)}}}catch(x){C=!0,S=x}finally{try{!d&&w.return&&w.return()}finally{if(C)throw S}}var I=t.x-(l+c)/2,O=t.y-(g+T)/2;s.xCoords=s.xCoords.map(function(x){return x+I}),s.yCoords=s.yCoords.map(function(x){return x+O})}else{Object.keys(s).forEach(function(x){var Q=s[x],z=Q.getRect().x,X=Q.getRect().x+Q.getRect().width,rt=Q.getRect().y,$=Q.getRect().y+Q.getRect().height;zl&&(l=X),rtg&&(g=$)});var R=t.x-(l+c)/2,W=t.y-(g+T)/2;Object.keys(s).forEach(function(x){var Q=s[x];Q.setCenter(Q.getCenterX()+R,Q.getCenterY()+W)})}}},u.calcBoundingBox=function(t,s,o,c){for(var l=Number.MAX_SAFE_INTEGER,T=Number.MIN_SAFE_INTEGER,g=Number.MAX_SAFE_INTEGER,d=Number.MIN_SAFE_INTEGER,C=void 0,S=void 0,w=void 0,P=void 0,B=t.descendants().not(":parent"),U=B.length,V=0;VC&&(l=C),Tw&&(g=w),d{var f=a(548),e=a(140).CoSELayout,u=a(140).CoSENode,t=a(140).layoutBase.PointD,s=a(140).layoutBase.DimensionD,o=a(140).layoutBase.LayoutConstants,c=a(140).layoutBase.FDLayoutConstants,l=a(140).CoSEConstants,T=function(d,C){var S=d.cy,w=d.eles,P=w.nodes(),B=w.edges(),U=void 0,V=void 0,M=void 0,_={};d.randomize&&(U=C.nodeIndexes,V=C.xCoords,M=C.yCoords);var n=function(x){return typeof x=="function"},E=function(x,Q){return n(x)?x(Q):x},p=f.calcParentsWithoutChildren(S,w),m=function W(x,Q,z,X){for(var rt=Q.length,$=0;$0){var J=void 0;J=z.getGraphManager().add(z.newGraph(),k),W(J,H,z,X)}}},y=function(x,Q,z){for(var X=0,rt=0,$=0;$0?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=X/rt:n(d.idealEdgeLength)?l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=50:l.DEFAULT_EDGE_LENGTH=c.DEFAULT_EDGE_LENGTH=d.idealEdgeLength,l.MIN_REPULSION_DIST=c.MIN_REPULSION_DIST=c.DEFAULT_EDGE_LENGTH/10,l.DEFAULT_RADIAL_SEPARATION=c.DEFAULT_EDGE_LENGTH)},I=function(x,Q){Q.fixedNodeConstraint&&(x.constraints.fixedNodeConstraint=Q.fixedNodeConstraint),Q.alignmentConstraint&&(x.constraints.alignmentConstraint=Q.alignmentConstraint),Q.relativePlacementConstraint&&(x.constraints.relativePlacementConstraint=Q.relativePlacementConstraint)};d.nestingFactor!=null&&(l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=d.nestingFactor),d.gravity!=null&&(l.DEFAULT_GRAVITY_STRENGTH=c.DEFAULT_GRAVITY_STRENGTH=d.gravity),d.numIter!=null&&(l.MAX_ITERATIONS=c.MAX_ITERATIONS=d.numIter),d.gravityRange!=null&&(l.DEFAULT_GRAVITY_RANGE_FACTOR=c.DEFAULT_GRAVITY_RANGE_FACTOR=d.gravityRange),d.gravityCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_STRENGTH=c.DEFAULT_COMPOUND_GRAVITY_STRENGTH=d.gravityCompound),d.gravityRangeCompound!=null&&(l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=d.gravityRangeCompound),d.initialEnergyOnIncremental!=null&&(l.DEFAULT_COOLING_FACTOR_INCREMENTAL=c.DEFAULT_COOLING_FACTOR_INCREMENTAL=d.initialEnergyOnIncremental),d.tilingCompareBy!=null&&(l.TILING_COMPARE_BY=d.tilingCompareBy),d.quality=="proof"?o.QUALITY=2:o.QUALITY=0,l.NODE_DIMENSIONS_INCLUDE_LABELS=c.NODE_DIMENSIONS_INCLUDE_LABELS=o.NODE_DIMENSIONS_INCLUDE_LABELS=d.nodeDimensionsIncludeLabels,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!d.randomize,l.ANIMATE=c.ANIMATE=o.ANIMATE=d.animate,l.TILE=d.tile,l.TILING_PADDING_VERTICAL=typeof d.tilingPaddingVertical=="function"?d.tilingPaddingVertical.call():d.tilingPaddingVertical,l.TILING_PADDING_HORIZONTAL=typeof d.tilingPaddingHorizontal=="function"?d.tilingPaddingHorizontal.call():d.tilingPaddingHorizontal,l.DEFAULT_INCREMENTAL=c.DEFAULT_INCREMENTAL=o.DEFAULT_INCREMENTAL=!0,l.PURE_INCREMENTAL=!d.randomize,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=d.uniformNodeDimensions,d.step=="transformed"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!1),d.step=="enforced"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!1),d.step=="cose"&&(l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!1,l.APPLY_LAYOUT=!0),d.step=="all"&&(d.randomize?l.TRANSFORM_ON_CONSTRAINT_HANDLING=!0:l.TRANSFORM_ON_CONSTRAINT_HANDLING=!1,l.ENFORCE_CONSTRAINTS=!0,l.APPLY_LAYOUT=!0),d.fixedNodeConstraint||d.alignmentConstraint||d.relativePlacementConstraint?l.TREE_REDUCTION_ON_INCREMENTAL=!1:l.TREE_REDUCTION_ON_INCREMENTAL=!0;var O=new e,R=O.newGraphManager();return m(R.addRoot(),f.getTopMostNodes(P),O,d),y(O,R,B),I(O,d),O.runLayout(),_};i.exports={coseLayout:T}}),212:((i,r,a)=>{var f=(function(){function d(C,S){for(var w=0;w0)if(p){var I=t.getTopMostNodes(w.eles.nodes());if(M=t.connectComponents(P,w.eles,I),M.forEach(function(vt){var it=vt.boundingBox();_.push({x:it.x1+it.w/2,y:it.y1+it.h/2})}),w.randomize&&M.forEach(function(vt){w.eles=vt,U.push(o(w))}),w.quality=="default"||w.quality=="proof"){var O=P.collection();if(w.tile){var R=new Map,W=[],x=[],Q=0,z={nodeIndexes:R,xCoords:W,yCoords:x},X=[];if(M.forEach(function(vt,it){vt.edges().length==0&&(vt.nodes().forEach(function(ut,Et){O.merge(vt.nodes()[Et]),ut.isParent()||(z.nodeIndexes.set(vt.nodes()[Et].id(),Q++),z.xCoords.push(vt.nodes()[0].position().x),z.yCoords.push(vt.nodes()[0].position().y))}),X.push(it))}),O.length>1){var rt=O.boundingBox();_.push({x:rt.x1+rt.w/2,y:rt.y1+rt.h/2}),M.push(O),U.push(z);for(var $=X.length-1;$>=0;$--)M.splice(X[$],1),U.splice(X[$],1),_.splice(X[$],1)}}M.forEach(function(vt,it){w.eles=vt,V.push(l(w,U[it])),t.relocateComponent(_[it],V[it],w)})}else M.forEach(function(vt,it){t.relocateComponent(_[it],U[it],w)});var D=new Set;if(M.length>1){var H=[],k=B.filter(function(vt){return vt.css("display")=="none"});M.forEach(function(vt,it){var ut=void 0;if(w.quality=="draft"&&(ut=U[it].nodeIndexes),vt.nodes().not(k).length>0){var Et={};Et.edges=[],Et.nodes=[];var wt=void 0;vt.nodes().not(k).forEach(function(Ot){if(w.quality=="draft")if(!Ot.isParent())wt=ut.get(Ot.id()),Et.nodes.push({x:U[it].xCoords[wt]-Ot.boundingbox().w/2,y:U[it].yCoords[wt]-Ot.boundingbox().h/2,width:Ot.boundingbox().w,height:Ot.boundingbox().h});else{var mt=t.calcBoundingBox(Ot,U[it].xCoords,U[it].yCoords,ut);Et.nodes.push({x:mt.topLeftX,y:mt.topLeftY,width:mt.width,height:mt.height})}else V[it][Ot.id()]&&Et.nodes.push({x:V[it][Ot.id()].getLeft(),y:V[it][Ot.id()].getTop(),width:V[it][Ot.id()].getWidth(),height:V[it][Ot.id()].getHeight()})}),vt.edges().forEach(function(Ot){var mt=Ot.source(),Dt=Ot.target();if(mt.css("display")!="none"&&Dt.css("display")!="none")if(w.quality=="draft"){var Rt=ut.get(mt.id()),Ht=ut.get(Dt.id()),Ut=[],Pt=[];if(mt.isParent()){var Ft=t.calcBoundingBox(mt,U[it].xCoords,U[it].yCoords,ut);Ut.push(Ft.topLeftX+Ft.width/2),Ut.push(Ft.topLeftY+Ft.height/2)}else Ut.push(U[it].xCoords[Rt]),Ut.push(U[it].yCoords[Rt]);if(Dt.isParent()){var Yt=t.calcBoundingBox(Dt,U[it].xCoords,U[it].yCoords,ut);Pt.push(Yt.topLeftX+Yt.width/2),Pt.push(Yt.topLeftY+Yt.height/2)}else Pt.push(U[it].xCoords[Ht]),Pt.push(U[it].yCoords[Ht]);Et.edges.push({startX:Ut[0],startY:Ut[1],endX:Pt[0],endY:Pt[1]})}else V[it][mt.id()]&&V[it][Dt.id()]&&Et.edges.push({startX:V[it][mt.id()].getCenterX(),startY:V[it][mt.id()].getCenterY(),endX:V[it][Dt.id()].getCenterX(),endY:V[it][Dt.id()].getCenterY()})}),Et.nodes.length>0&&(H.push(Et),D.add(it))}});var tt=E.packComponents(H,w.randomize).shifts;if(w.quality=="draft")U.forEach(function(vt,it){var ut=vt.xCoords.map(function(wt){return wt+tt[it].dx}),Et=vt.yCoords.map(function(wt){return wt+tt[it].dy});vt.xCoords=ut,vt.yCoords=Et});else{var ht=0;D.forEach(function(vt){Object.keys(V[vt]).forEach(function(it){var ut=V[vt][it];ut.setCenter(ut.getCenterX()+tt[ht].dx,ut.getCenterY()+tt[ht].dy)}),ht++})}}}else{var m=w.eles.boundingBox();if(_.push({x:m.x1+m.w/2,y:m.y1+m.h/2}),w.randomize){var y=o(w);U.push(y)}w.quality=="default"||w.quality=="proof"?(V.push(l(w,U[0])),t.relocateComponent(_[0],V[0],w)):t.relocateComponent(_[0],U[0],w)}var J=function(it,ut){if(w.quality=="default"||w.quality=="proof"){typeof it=="number"&&(it=ut);var Et=void 0,wt=void 0,Ot=it.data("id");return V.forEach(function(Dt){Ot in Dt&&(Et={x:Dt[Ot].getRect().getCenterX(),y:Dt[Ot].getRect().getCenterY()},wt=Dt[Ot])}),w.nodeDimensionsIncludeLabels&&(wt.labelWidth&&(wt.labelPosHorizontal=="left"?Et.x+=wt.labelWidth/2:wt.labelPosHorizontal=="right"&&(Et.x-=wt.labelWidth/2)),wt.labelHeight&&(wt.labelPosVertical=="top"?Et.y+=wt.labelHeight/2:wt.labelPosVertical=="bottom"&&(Et.y-=wt.labelHeight/2))),Et==null&&(Et={x:it.position("x"),y:it.position("y")}),{x:Et.x,y:Et.y}}else{var mt=void 0;return U.forEach(function(Dt){var Rt=Dt.nodeIndexes.get(it.id());Rt!=null&&(mt={x:Dt.xCoords[Rt],y:Dt.yCoords[Rt]})}),mt==null&&(mt={x:it.position("x"),y:it.position("y")}),{x:mt.x,y:mt.y}}};if(w.quality=="default"||w.quality=="proof"||w.randomize){var It=t.calcParentsWithoutChildren(P,B),Nt=B.filter(function(vt){return vt.css("display")=="none"});w.eles=B.not(Nt),B.nodes().not(":parent").not(Nt).layoutPositions(S,w,J),It.length>0&&It.forEach(function(vt){vt.position(J(vt))})}else console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'.")}}]),d})();i.exports=g}),657:((i,r,a)=>{var f=a(548),e=a(140).layoutBase.Matrix,u=a(140).layoutBase.SVD,t=function(o){var c=o.cy,l=o.eles,T=l.nodes(),g=l.nodes(":parent"),d=new Map,C=new Map,S=new Map,w=[],P=[],B=[],U=[],V=[],M=[],_=[],n=[],E=void 0,p=1e8,m=1e-9,y=o.piTol,I=o.samplingType,O=o.nodeSeparation,R=void 0,W=function(){for(var Y=0,Z=0,K=!1;Z=at;){nt=q[at++];for(var xt=w[nt],lt=0;ltdt&&(dt=V[Lt],At=Lt)}return At},Q=function(Y){var Z=void 0;if(Y){Z=Math.floor(Math.random()*E);for(var q=0;q=1)break;j=et}for(var pt=0;pt=1)break;j=et}for(var lt=0;lt0&&(Z.isParent()?w[Y].push(S.get(Z.id())):w[Y].push(Z.id()))})});var Nt=function(Y){var Z=C.get(Y),K=void 0;d.get(Y).forEach(function(q){c.getElementById(q).isParent()?K=S.get(q):K=q,w[Z].push(K),w[C.get(K)].push(Y)})},vt=!0,it=!1,ut=void 0;try{for(var Et=d.keys()[Symbol.iterator](),wt;!(vt=(wt=Et.next()).done);vt=!0){var Ot=wt.value;Nt(Ot)}}catch(F){it=!0,ut=F}finally{try{!vt&&Et.return&&Et.return()}finally{if(it)throw ut}}E=C.size;var mt=void 0;if(E>2){R=E{var f=a(212),e=function(t){t&&t("layout","fcose",f)};typeof cytoscape<"u"&&e(cytoscape),i.exports=e}),140:(i=>{i.exports=A})},N={};function v(i){var r=N[i];if(r!==void 0)return r.exports;var a=N[i]={exports:{}};return G[i](a,a.exports,v),a.exports}var h=v(579);return h})()})})(se)),se.exports}var mr=yr();const Er=cr(mr);var xe={L:"left",R:"right",T:"top",B:"bottom"},Ie={L:gt(L=>`${L},${L/2} 0,${L} 0,0`,"L"),R:gt(L=>`0,${L/2} ${L},0 ${L},${L}`,"R"),T:gt(L=>`0,0 ${L},0 ${L/2},${L}`,"T"),B:gt(L=>`${L/2},0 ${L},${L} 0,${L}`,"B")},oe={L:gt((L,b)=>L-b+2,"L"),R:gt((L,b)=>L-2,"R"),T:gt((L,b)=>L-b+2,"T"),B:gt((L,b)=>L-2,"B")},Tr=gt(function(L){return Wt(L)?L==="L"?"R":"L":L==="T"?"B":"T"},"getOppositeArchitectureDirection"),Re=gt(function(L){const b=L;return b==="L"||b==="R"||b==="T"||b==="B"},"isArchitectureDirection"),Wt=gt(function(L){const b=L;return b==="L"||b==="R"},"isArchitectureDirectionX"),qt=gt(function(L){const b=L;return b==="T"||b==="B"},"isArchitectureDirectionY"),Te=gt(function(L,b){const A=Wt(L)&&qt(b),G=qt(L)&&Wt(b);return A||G},"isArchitectureDirectionXY"),Nr=gt(function(L){const b=L[0],A=L[1],G=Wt(b)&&qt(A),N=qt(b)&&Wt(A);return G||N},"isArchitecturePairXY"),Lr=gt(function(L){return L!=="LL"&&L!=="RR"&&L!=="TT"&&L!=="BB"},"isValidArchitectureDirectionPair"),pe=gt(function(L,b){const A=`${L}${b}`;return Lr(A)?A:void 0},"getArchitectureDirectionPair"),Cr=gt(function([L,b],A){const G=A[0],N=A[1];return Wt(G)?qt(N)?[L+(G==="L"?-1:1),b+(N==="T"?1:-1)]:[L+(G==="L"?-1:1),b]:Wt(N)?[L+(N==="L"?1:-1),b+(G==="T"?1:-1)]:[L,b+(G==="T"?1:-1)]},"shiftPositionByArchitectureDirectionPair"),wr=gt(function(L){return L==="LT"||L==="TL"?[1,1]:L==="BL"||L==="LB"?[1,-1]:L==="BR"||L==="RB"?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),Ar=gt(function(L,b){return Te(L,b)?"bend":Wt(L)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),Mr=gt(function(L){return L.type==="service"},"isArchitectureService"),Or=gt(function(L){return L.type==="junction"},"isArchitectureJunction"),be=gt(L=>L.data(),"edgeData"),ie=gt(L=>L.data(),"nodeData"),Dr=ar.architecture,Pe=class{constructor(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.elements={},this.diagramId="",this.setAccTitle=Qe,this.getAccTitle=Je,this.setDiagramTitle=Ke,this.getDiagramTitle=je,this.getAccDescription=_e,this.setAccDescription=tr,this.clear()}static{gt(this,"ArchitectureDB")}setDiagramId(L){this.diagramId=L}getDiagramId(){return this.diagramId}clear(){this.nodes={},this.groups={},this.edges=[],this.layoutHints=[],this.registeredIds={},this.dataStructures=void 0,this.elements={},this.diagramId="",er()}addService({id:L,icon:b,in:A,title:G,iconText:N}){if(this.registeredIds[L]!==void 0)throw new Error(`The service id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The service [${L}] cannot be placed within itself`);if(this.registeredIds[A]===void 0)throw new Error(`The service [${L}]'s parent does not exist. Please make sure the parent is created before this service`);if(this.registeredIds[A]==="node")throw new Error(`The service [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"service",icon:b,iconText:N,title:G,edges:[],in:A}}getServices(){return Object.values(this.nodes).filter(Mr)}addJunction({id:L,in:b}){if(this.registeredIds[L]!==void 0)throw new Error(`The junction id [${L}] is already in use by another ${this.registeredIds[L]}`);if(b!==void 0){if(L===b)throw new Error(`The junction [${L}] cannot be placed within itself`);if(this.registeredIds[b]===void 0)throw new Error(`The junction [${L}]'s parent does not exist. Please make sure the parent is created before this junction`);if(this.registeredIds[b]==="node")throw new Error(`The junction [${L}]'s parent is not a group`)}this.registeredIds[L]="node",this.nodes[L]={id:L,type:"junction",edges:[],in:b}}getJunctions(){return Object.values(this.nodes).filter(Or)}getNodes(){return Object.values(this.nodes)}getNode(L){return this.nodes[L]??null}addGroup({id:L,icon:b,in:A,title:G}){if(this.registeredIds?.[L]!==void 0)throw new Error(`The group id [${L}] is already in use by another ${this.registeredIds[L]}`);if(A!==void 0){if(L===A)throw new Error(`The group [${L}] cannot be placed within itself`);if(this.registeredIds?.[A]===void 0)throw new Error(`The group [${L}]'s parent does not exist. Please make sure the parent is created before this group`);if(this.registeredIds?.[A]==="node")throw new Error(`The group [${L}]'s parent is not a group`)}this.registeredIds[L]="group",this.groups[L]={id:L,icon:b,title:G,in:A}}getGroups(){return Object.values(this.groups)}addEdge({lhsId:L,rhsId:b,lhsDir:A,rhsDir:G,lhsInto:N,rhsInto:v,lhsGroup:h,rhsGroup:i,title:r}){if(!Re(A))throw new Error(`Invalid direction given for left hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(A)}`);if(!Re(G))throw new Error(`Invalid direction given for right hand side of edge ${L}--${b}. Expected (L,R,T,B) got ${String(G)}`);if(this.nodes[L]===void 0&&this.groups[L]===void 0)throw new Error(`The left-hand id [${L}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(this.nodes[b]===void 0&&this.groups[b]===void 0)throw new Error(`The right-hand id [${b}] does not yet exist. Please create the service/group before declaring an edge to it.`);const a=this.nodes[L].in,f=this.nodes[b].in;if(h&&a&&f&&a==f)throw new Error(`The left-hand id [${L}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(i&&a&&f&&a==f)throw new Error(`The right-hand id [${b}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);const e={lhsId:L,lhsDir:A,lhsInto:N,lhsGroup:h,rhsId:b,rhsDir:G,rhsInto:v,rhsGroup:i,title:r};this.edges.push(e),this.nodes[L]&&this.nodes[b]&&(this.nodes[L].edges.push(this.edges[this.edges.length-1]),this.nodes[b].edges.push(this.edges[this.edges.length-1]))}getEdges(){return this.edges}addLayoutHint(L){if(L.members.length<2)throw new Error(`An align directive requires at least two members; got ${L.members.length}`);const b=new Set;L.members.forEach(A=>{if(this.registeredIds[A]!=="node")throw new Error(`align ${L.direction} references [${A}], which is not a service or junction`);if(b.has(A))throw new Error(`align ${L.direction} lists [${A}] more than once`);b.add(A)}),this.layoutHints.push(L)}getLayoutHints(){return this.layoutHints}getDataStructures(){if(this.dataStructures===void 0){const L={},b=Object.entries(this.nodes).reduce((i,[r,a])=>(i[r]=a.edges.reduce((f,e)=>{const u=this.getNode(e.lhsId)?.in,t=this.getNode(e.rhsId)?.in;if(u&&t&&u!==t){const s=Ar(e.lhsDir,e.rhsDir);s!=="bend"&&(L[u]??={},L[u][t]=s,L[t]??={},L[t][u]=s)}if(e.lhsId===r){const s=pe(e.lhsDir,e.rhsDir);s&&(f[s]=e.rhsId)}else{const s=pe(e.rhsDir,e.lhsDir);s&&(f[s]=e.lhsId)}return f},{}),i),{}),A=Object.keys(b)[0],G={[A]:1},N=Object.keys(b).reduce((i,r)=>r===A?i:{...i,[r]:1},{}),v=gt(i=>{const r={[i]:[0,0]},a=[i];for(;a.length>0;){const f=a.shift();if(f){G[f]=1,delete N[f];const e=b[f],[u,t]=r[f];Object.entries(e).forEach(([s,o])=>{G[o]||(r[o]=Cr([u,t],s),a.push(o))})}}return r},"BFS"),h=[v(A)];for(;Object.keys(N).length>0;)h.push(v(Object.keys(N)[0]));this.dataStructures={adjList:b,spatialMaps:h,groupAlignments:L}}return this.dataStructures}setElementForId(L,b){this.elements[L]=b}getElementById(L){return this.elements[L]}getConfig(){return rr({...Dr,...ir().architecture})}getConfigField(L){return this.getConfig()[L]}},xr=gt((L,b)=>{ke(L,b),L.groups.map(A=>b.addGroup(A)),L.services.map(A=>b.addService({...A,type:"service"})),L.junctions.map(A=>b.addJunction({...A,type:"junction"})),L.edges.map(A=>b.addEdge(A)),L.alignments?.map(A=>b.addLayoutHint({direction:A.direction,members:[...A.members]}))},"populateDb"),Ge={parser:{yy:void 0},parse:gt(async L=>{const b=await fr("architecture",L);Se.debug(b);const A=Ge.parser?.yy;if(!(A instanceof Pe))throw new Error("parser.parser?.yy was not a ArchitectureDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");xr(b,A)},"parse")},Ir=gt(L=>`
           .edge {
             stroke-width: ${L.archEdgeWidth};
             stroke: ${L.archEdgeColor};
        diff --git a/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js b/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CRh0VMzc.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js
        rename to apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CRh0VMzc.js
        index 6e3062b7898..7d7aa250745 100644
        --- a/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-BNXb88Fr.js
        +++ b/apps/kimi-code/dist-web/assets/blockDiagram-677ZJIJ3-CRh0VMzc.js
        @@ -1,4 +1,4 @@
        -import{g as de}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{aA as pe,aB as Kt,aC as fe,aD as xe,aE as ye,aF as be,aG as we,aH as me,aI as Se,aJ as Le,aK as ke,aL as ve,aM as Ee,aN as _e,aO as Te,aP as De,aQ as Be,aR as Ne,aS as Ie,aT as Ce,aU as Oe,aV as Re,aW as Ae,aX as ze,aY as Me,_ as g,z as rt,d as D,e as Pe,l as k,q as Fe,t as We,c as R,aZ as Ye,a7 as He,a8 as Ke,a3 as Ue,a_ as M,a$ as kt,b0 as Q,as as Xe,y as $,k as Ve,b1 as je,i as Ct,b2 as Ot,b3 as Ge}from"./mermaid.core-CJB1tAev.js";import{G as Ze}from"./graph-DOmOIIwC.js";import{c as qe}from"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";function Je(e){return Array.isArray(e)}function Qe(e){if(pe(e))return e;const t=Kt(e);if(!$e(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(fe(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?er(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return rr(a,e),xt(a,e),tr(a,e),a}function $e(e){switch(Kt(e)){case Me:case ze:case Ae:case Re:case Oe:case Ce:case Ie:case Ne:case Be:case De:case Te:case _e:case Ee:case ve:case ke:case Le:case Se:case me:case we:case be:case ye:case xe:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function tr(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s=a)&&(e[s]=t[s])}function rr(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var bt=(function(){var e=g(function(T,m,p,x){for(p=p||{},x=T.length;x--;p[T[x]]=m);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],d=[1,23],b=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],S={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(m,p,x,L,E,o,F){var f=o.length-1;switch(E){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",o[f-1]),L.setHierarchy(o[f-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",o[f]),typeof o[f].length=="number"?this.$=o[f]:this.$=[o[f]];break;case 13:L.getLogger().debug("Rule: statement #2: ",o[f-1]),this.$=[o[f-1]].concat(o[f]);break;case 14:L.getLogger().debug("Rule: link: ",o[f],m),this.$={edgeTypeStr:o[f],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",o[f-3],o[f-1],o[f]),this.$={edgeTypeStr:o[f],label:o[f-1]};break;case 18:const C=parseInt(o[f]),Z=L.generateId();this.$={id:Z,type:"space",label:"",width:C,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",o[f-2],o[f-1],o[f]," typestr: ",o[f-1].edgeTypeStr);const V=L.edgeStrToEdgeData(o[f-1].edgeTypeStr),at=L.edgeStrToEdgeStartData(o[f-1].edgeTypeStr),gt=L.edgeStrToThickness(o[f-1].edgeTypeStr),O=L.edgeStrToPattern(o[f-1].edgeTypeStr);this.$=[{id:o[f-2].id,label:o[f-2].label,type:o[f-2].type,directions:o[f-2].directions},{id:o[f-2].id+"-"+o[f].id,start:o[f-2].id,end:o[f].id,label:o[f-1].label,type:"edge",thickness:gt,pattern:O,directions:o[f].directions,arrowTypeEnd:V,arrowTypeStart:at},{id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[f-1],o[f]),this.$={id:o[f-1].id,label:o[f-1].label,type:L.typeStr2Type(o[f-1].typeStr),directions:o[f-1].directions,widthInColumns:parseInt(o[f],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",o[f]),this.$={id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",o[f]),this.$={type:"column-setting",columns:o[f]==="auto"?-1:parseInt(o[f])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",o[f-2],o[f-1]),L.generateId(),this.$={...o[f-2],type:"composite",children:o[f-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",o[f-2],o[f-1],o[f]);const j=L.generateId();this.$={id:j,type:"composite",label:"",children:o[f-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",o[f]),this.$={id:o[f]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[f-1],o[f]),this.$={id:o[f-1],label:o[f].label,typeStr:o[f].typeStr,directions:o[f].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",o[f]),this.$=[o[f]];break;case 32:L.getLogger().debug("Rule: dirList: ",o[f-1],o[f]),this.$=[o[f-1]].concat(o[f]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",o[f-2],o[f-1],o[f]),this.$={typeStr:o[f-2]+o[f],label:o[f-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[f-3],o[f-2]," #3:",o[f-1],o[f]),this.$={typeStr:o[f-3]+o[f],label:o[f-2],directions:o[f-1]};break;case 35:case 36:this.$={type:"classDef",id:o[f-1].trim(),css:o[f].trim()};break;case 37:this.$={type:"applyClass",id:o[f-1].trim(),styleClass:o[f].trim()};break;case 38:this.$={type:"applyStyles",id:o[f-1].trim(),stylesStr:o[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(h,[2,16],{14:22,15:d,16:b}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(w,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:t,11:37,13:4,14:22,15:d,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(h,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(m,p){if(p.recoverable)this.trace(m);else{var x=new Error(m);throw x.hash=p,x}},"parseError"),parse:g(function(m){var p=this,x=[0],L=[],E=[null],o=[],F=this.table,f="",C=0,Z=0,V=2,at=1,gt=o.slice.call(arguments,1),O=Object.create(this.lexer),j={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(j.yy[ut]=this.yy[ut]);O.setInput(m,j.yy),j.yy.lexer=O,j.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var dt=O.yylloc;o.push(dt);var ge=O.options&&O.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ue(W){x.length=x.length-2*W,E.length=E.length-W,o.length=o.length-W}g(ue,"popStack");function Nt(){var W;return W=L.pop()||O.lex()||at,typeof W!="number"&&(W instanceof Array&&(L=W,W=L.pop()),W=p.symbols_[W]||W),W}g(Nt,"lex");for(var P,q,H,pt,J={},st,G,It,it;;){if(q=x[x.length-1],this.defaultActions[q]?H=this.defaultActions[q]:((P===null||typeof P>"u")&&(P=Nt()),H=F[q]&&F[q][P]),typeof H>"u"||!H.length||!H[0]){var ft="";it=[];for(st in F[q])this.terminals_[st]&&st>V&&it.push("'"+this.terminals_[st]+"'");O.showPosition?ft="Parse error on line "+(C+1)+`:
        +import{g as de}from"./chunk-5VM5RSS4-CqIxm4fU.js";import{aA as pe,aB as Kt,aC as fe,aD as xe,aE as ye,aF as be,aG as we,aH as me,aI as Se,aJ as Le,aK as ke,aL as ve,aM as Ee,aN as _e,aO as Te,aP as De,aQ as Be,aR as Ne,aS as Ie,aT as Ce,aU as Oe,aV as Re,aW as Ae,aX as ze,aY as Me,_ as g,z as rt,d as D,e as Pe,l as k,q as Fe,t as We,c as R,aZ as Ye,a7 as He,a8 as Ke,a3 as Ue,a_ as M,a$ as kt,b0 as Q,as as Xe,y as $,k as Ve,b1 as je,i as Ct,b2 as Ot,b3 as Ge}from"./mermaid.core-CsZwh_jB.js";import{G as Ze}from"./graph-DOmOIIwC.js";import{c as qe}from"./channel-Dk_xUHM6.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";function Je(e){return Array.isArray(e)}function Qe(e){if(pe(e))return e;const t=Kt(e);if(!$e(e))return{};if(Je(e)){const s=Array.from(e);return e.length>0&&typeof e[0]=="string"&&Object.hasOwn(e,"index")&&(s.index=e.index,s.input=e.input),s}if(fe(e)){const s=e,i=s.constructor;return new i(s.buffer,s.byteOffset,s.length)}if(t==="[object ArrayBuffer]")return new ArrayBuffer(e.byteLength);if(t==="[object DataView]"){const s=e,i=s.buffer,c=s.byteOffset,r=s.byteLength,n=new ArrayBuffer(r),l=new Uint8Array(i,c,r);return new Uint8Array(n).set(l),new DataView(n)}if(t==="[object Boolean]"||t==="[object Number]"||t==="[object String]"){const s=e.constructor,i=new s(e.valueOf());return t==="[object String]"?er(i,e):xt(i,e),i}if(t==="[object Date]")return new Date(Number(e));if(t==="[object RegExp]"){const s=e,i=new RegExp(s.source,s.flags);return i.lastIndex=s.lastIndex,i}if(t==="[object Symbol]")return Object(Symbol.prototype.valueOf.call(e));if(t==="[object Map]"){const s=e,i=new Map;return s.forEach((c,r)=>{i.set(r,c)}),i}if(t==="[object Set]"){const s=e,i=new Set;return s.forEach(c=>{i.add(c)}),i}if(t==="[object Arguments]"){const s=e,i={};return xt(i,s),i.length=s.length,i[Symbol.iterator]=s[Symbol.iterator],i}const a={};return rr(a,e),xt(a,e),tr(a,e),a}function $e(e){switch(Kt(e)){case Me:case ze:case Ae:case Re:case Oe:case Ce:case Ie:case Ne:case Be:case De:case Te:case _e:case Ee:case ve:case ke:case Le:case Se:case me:case we:case be:case ye:case xe:return!0;default:return!1}}function xt(e,t){for(const a in t)Object.hasOwn(t,a)&&(e[a]=t[a])}function tr(e,t){const a=Object.getOwnPropertySymbols(t);for(let s=0;s=a)&&(e[s]=t[s])}function rr(e,t){const a=Object.getPrototypeOf(t);a!==null&&typeof t.constructor=="function"&&Object.setPrototypeOf(e,a)}var bt=(function(){var e=g(function(T,m,p,x){for(p=p||{},x=T.length;x--;p[T[x]]=m);return p},"o"),t=[1,15],a=[1,7],s=[1,13],i=[1,14],c=[1,19],r=[1,16],n=[1,17],l=[1,18],u=[8,30],h=[8,10,21,28,29,30,31,39,43,46],d=[1,23],b=[1,24],w=[8,10,15,16,21,28,29,30,31,39,43,46],y=[8,10,15,16,21,27,28,29,30,31,39,43,46],v=[1,49],S={trace:g(function(){},"trace"),yy:{},symbols_:{error:2,spaceLines:3,SPACELINE:4,NL:5,separator:6,SPACE:7,EOF:8,start:9,BLOCK_DIAGRAM_KEY:10,document:11,stop:12,statement:13,link:14,LINK:15,START_LINK:16,LINK_LABEL:17,STR:18,nodeStatement:19,columnsStatement:20,SPACE_BLOCK:21,blockStatement:22,classDefStatement:23,cssClassStatement:24,styleStatement:25,node:26,SIZE:27,COLUMNS:28,"id-block":29,end:30,NODE_ID:31,nodeShapeNLabel:32,dirList:33,DIR:34,NODE_DSTART:35,NODE_DEND:36,BLOCK_ARROW_START:37,BLOCK_ARROW_END:38,classDef:39,CLASSDEF_ID:40,CLASSDEF_STYLEOPTS:41,DEFAULT:42,class:43,CLASSENTITY_IDS:44,STYLECLASS:45,style:46,STYLE_ENTITY_IDS:47,STYLE_DEFINITION_DATA:48,$accept:0,$end:1},terminals_:{2:"error",4:"SPACELINE",5:"NL",7:"SPACE",8:"EOF",10:"BLOCK_DIAGRAM_KEY",15:"LINK",16:"START_LINK",17:"LINK_LABEL",18:"STR",21:"SPACE_BLOCK",27:"SIZE",28:"COLUMNS",29:"id-block",30:"end",31:"NODE_ID",34:"DIR",35:"NODE_DSTART",36:"NODE_DEND",37:"BLOCK_ARROW_START",38:"BLOCK_ARROW_END",39:"classDef",40:"CLASSDEF_ID",41:"CLASSDEF_STYLEOPTS",42:"DEFAULT",43:"class",44:"CLASSENTITY_IDS",45:"STYLECLASS",46:"style",47:"STYLE_ENTITY_IDS",48:"STYLE_DEFINITION_DATA"},productions_:[0,[3,1],[3,2],[3,2],[6,1],[6,1],[6,1],[9,3],[12,1],[12,1],[12,2],[12,2],[11,1],[11,2],[14,1],[14,4],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[19,3],[19,2],[19,1],[20,1],[22,4],[22,3],[26,1],[26,2],[33,1],[33,2],[32,3],[32,4],[23,3],[23,3],[24,3],[25,3]],performAction:g(function(m,p,x,L,E,o,F){var f=o.length-1;switch(E){case 4:L.getLogger().debug("Rule: separator (NL) ");break;case 5:L.getLogger().debug("Rule: separator (Space) ");break;case 6:L.getLogger().debug("Rule: separator (EOF) ");break;case 7:L.getLogger().debug("Rule: hierarchy: ",o[f-1]),L.setHierarchy(o[f-1]);break;case 8:L.getLogger().debug("Stop NL ");break;case 9:L.getLogger().debug("Stop EOF ");break;case 10:L.getLogger().debug("Stop NL2 ");break;case 11:L.getLogger().debug("Stop EOF2 ");break;case 12:L.getLogger().debug("Rule: statement: ",o[f]),typeof o[f].length=="number"?this.$=o[f]:this.$=[o[f]];break;case 13:L.getLogger().debug("Rule: statement #2: ",o[f-1]),this.$=[o[f-1]].concat(o[f]);break;case 14:L.getLogger().debug("Rule: link: ",o[f],m),this.$={edgeTypeStr:o[f],label:""};break;case 15:L.getLogger().debug("Rule: LABEL link: ",o[f-3],o[f-1],o[f]),this.$={edgeTypeStr:o[f],label:o[f-1]};break;case 18:const C=parseInt(o[f]),Z=L.generateId();this.$={id:Z,type:"space",label:"",width:C,children:[]};break;case 23:L.getLogger().debug("Rule: (nodeStatement link node) ",o[f-2],o[f-1],o[f]," typestr: ",o[f-1].edgeTypeStr);const V=L.edgeStrToEdgeData(o[f-1].edgeTypeStr),at=L.edgeStrToEdgeStartData(o[f-1].edgeTypeStr),gt=L.edgeStrToThickness(o[f-1].edgeTypeStr),O=L.edgeStrToPattern(o[f-1].edgeTypeStr);this.$=[{id:o[f-2].id,label:o[f-2].label,type:o[f-2].type,directions:o[f-2].directions},{id:o[f-2].id+"-"+o[f].id,start:o[f-2].id,end:o[f].id,label:o[f-1].label,type:"edge",thickness:gt,pattern:O,directions:o[f].directions,arrowTypeEnd:V,arrowTypeStart:at},{id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions}];break;case 24:L.getLogger().debug("Rule: nodeStatement (abc88 node size) ",o[f-1],o[f]),this.$={id:o[f-1].id,label:o[f-1].label,type:L.typeStr2Type(o[f-1].typeStr),directions:o[f-1].directions,widthInColumns:parseInt(o[f],10)};break;case 25:L.getLogger().debug("Rule: nodeStatement (node) ",o[f]),this.$={id:o[f].id,label:o[f].label,type:L.typeStr2Type(o[f].typeStr),directions:o[f].directions,widthInColumns:1};break;case 26:L.getLogger().debug("APA123",this?this:"na"),L.getLogger().debug("COLUMNS: ",o[f]),this.$={type:"column-setting",columns:o[f]==="auto"?-1:parseInt(o[f])};break;case 27:L.getLogger().debug("Rule: id-block statement : ",o[f-2],o[f-1]),L.generateId(),this.$={...o[f-2],type:"composite",children:o[f-1]};break;case 28:L.getLogger().debug("Rule: blockStatement : ",o[f-2],o[f-1],o[f]);const j=L.generateId();this.$={id:j,type:"composite",label:"",children:o[f-1]};break;case 29:L.getLogger().debug("Rule: node (NODE_ID separator): ",o[f]),this.$={id:o[f]};break;case 30:L.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ",o[f-1],o[f]),this.$={id:o[f-1],label:o[f].label,typeStr:o[f].typeStr,directions:o[f].directions};break;case 31:L.getLogger().debug("Rule: dirList: ",o[f]),this.$=[o[f]];break;case 32:L.getLogger().debug("Rule: dirList: ",o[f-1],o[f]),this.$=[o[f-1]].concat(o[f]);break;case 33:L.getLogger().debug("Rule: nodeShapeNLabel: ",o[f-2],o[f-1],o[f]),this.$={typeStr:o[f-2]+o[f],label:o[f-1]};break;case 34:L.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ",o[f-3],o[f-2]," #3:",o[f-1],o[f]),this.$={typeStr:o[f-3]+o[f],label:o[f-2],directions:o[f-1]};break;case 35:case 36:this.$={type:"classDef",id:o[f-1].trim(),css:o[f].trim()};break;case 37:this.$={type:"applyClass",id:o[f-1].trim(),styleClass:o[f].trim()};break;case 38:this.$={type:"applyStyles",id:o[f-1].trim(),stylesStr:o[f].trim()};break}},"anonymous"),table:[{9:1,10:[1,2]},{1:[3]},{10:t,11:3,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{8:[1,20]},e(u,[2,12],{13:4,19:5,20:6,22:8,23:9,24:10,25:11,26:12,11:21,10:t,21:a,28:s,29:i,31:c,39:r,43:n,46:l}),e(h,[2,16],{14:22,15:d,16:b}),e(h,[2,17]),e(h,[2,18]),e(h,[2,19]),e(h,[2,20]),e(h,[2,21]),e(h,[2,22]),e(w,[2,25],{27:[1,25]}),e(h,[2,26]),{19:26,26:12,31:c},{10:t,11:27,13:4,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{40:[1,28],42:[1,29]},{44:[1,30]},{47:[1,31]},e(y,[2,29],{32:32,35:[1,33],37:[1,34]}),{1:[2,7]},e(u,[2,13]),{26:35,31:c},{31:[2,14]},{17:[1,36]},e(w,[2,24]),{10:t,11:37,13:4,14:22,15:d,16:b,19:5,20:6,21:a,22:8,23:9,24:10,25:11,26:12,28:s,29:i,31:c,39:r,43:n,46:l},{30:[1,38]},{41:[1,39]},{41:[1,40]},{45:[1,41]},{48:[1,42]},e(y,[2,30]),{18:[1,43]},{18:[1,44]},e(w,[2,23]),{18:[1,45]},{30:[1,46]},e(h,[2,28]),e(h,[2,35]),e(h,[2,36]),e(h,[2,37]),e(h,[2,38]),{36:[1,47]},{33:48,34:v},{15:[1,50]},e(h,[2,27]),e(y,[2,33]),{38:[1,51]},{33:52,34:v,38:[2,31]},{31:[2,15]},e(y,[2,34]),{38:[2,32]}],defaultActions:{20:[2,7],23:[2,14],50:[2,15],52:[2,32]},parseError:g(function(m,p){if(p.recoverable)this.trace(m);else{var x=new Error(m);throw x.hash=p,x}},"parseError"),parse:g(function(m){var p=this,x=[0],L=[],E=[null],o=[],F=this.table,f="",C=0,Z=0,V=2,at=1,gt=o.slice.call(arguments,1),O=Object.create(this.lexer),j={yy:{}};for(var ut in this.yy)Object.prototype.hasOwnProperty.call(this.yy,ut)&&(j.yy[ut]=this.yy[ut]);O.setInput(m,j.yy),j.yy.lexer=O,j.yy.parser=this,typeof O.yylloc>"u"&&(O.yylloc={});var dt=O.yylloc;o.push(dt);var ge=O.options&&O.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ue(W){x.length=x.length-2*W,E.length=E.length-W,o.length=o.length-W}g(ue,"popStack");function Nt(){var W;return W=L.pop()||O.lex()||at,typeof W!="number"&&(W instanceof Array&&(L=W,W=L.pop()),W=p.symbols_[W]||W),W}g(Nt,"lex");for(var P,q,H,pt,J={},st,G,It,it;;){if(q=x[x.length-1],this.defaultActions[q]?H=this.defaultActions[q]:((P===null||typeof P>"u")&&(P=Nt()),H=F[q]&&F[q][P]),typeof H>"u"||!H.length||!H[0]){var ft="";it=[];for(st in F[q])this.terminals_[st]&&st>V&&it.push("'"+this.terminals_[st]+"'");O.showPosition?ft="Parse error on line "+(C+1)+`:
         `+O.showPosition()+`
         Expecting `+it.join(", ")+", got '"+(this.terminals_[P]||P)+"'":ft="Parse error on line "+(C+1)+": Unexpected "+(P==at?"end of input":"'"+(this.terminals_[P]||P)+"'"),this.parseError(ft,{text:O.match,token:this.terminals_[P]||P,line:O.yylineno,loc:dt,expected:it})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+q+", token: "+P);switch(H[0]){case 1:x.push(P),E.push(O.yytext),o.push(O.yylloc),x.push(H[1]),P=null,Z=O.yyleng,f=O.yytext,C=O.yylineno,dt=O.yylloc;break;case 2:if(G=this.productions_[H[1]][1],J.$=E[E.length-G],J._$={first_line:o[o.length-(G||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(G||1)].first_column,last_column:o[o.length-1].last_column},ge&&(J._$.range=[o[o.length-(G||1)].range[0],o[o.length-1].range[1]]),pt=this.performAction.apply(J,[f,Z,C,j.yy,H[1],E,o].concat(gt)),typeof pt<"u")return pt;G&&(x=x.slice(0,-1*G*2),E=E.slice(0,-1*G),o=o.slice(0,-1*G)),x.push(this.productions_[H[1]][0]),E.push(J.$),o.push(J._$),It=F[x[x.length-2]][x[x.length-1]],x.push(It);break;case 3:return!0}}return!0},"parse")},N=(function(){var T={EOF:1,parseError:g(function(p,x){if(this.yy.parser)this.yy.parser.parseError(p,x);else throw new Error(p)},"parseError"),setInput:g(function(m,p){return this.yy=p||this.yy||{},this._input=m,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:g(function(){var m=this._input[0];this.yytext+=m,this.yyleng++,this.offset++,this.match+=m,this.matched+=m;var p=m.match(/(?:\r\n?|\n).*/g);return p?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),m},"input"),unput:g(function(m){var p=m.length,x=m.split(/(?:\r\n?|\n)/g);this._input=m+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-p),this.offset-=p;var L=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===L.length?this.yylloc.first_column:0)+L[L.length-x.length].length-x[0].length:this.yylloc.first_column-p},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-p]),this.yyleng=this.yytext.length,this},"unput"),more:g(function(){return this._more=!0,this},"more"),reject:g(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
         `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:g(function(m){this.unput(this.match.slice(m))},"less"),pastInput:g(function(){var m=this.matched.substr(0,this.matched.length-this.match.length);return(m.length>20?"...":"")+m.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:g(function(){var m=this.match;return m.length<20&&(m+=this._input.substr(0,20-m.length)),(m.substr(0,20)+(m.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:g(function(){var m=this.pastInput(),p=new Array(m.length+1).join("-");return m+this.upcomingInput()+`
        diff --git a/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js b/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-0GQGcOcv.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js
        rename to apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-0GQGcOcv.js
        index c44d1d79294..a0a2d3c5832 100644
        --- a/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-CUyKVoVi.js
        +++ b/apps/kimi-code/dist-web/assets/c4Diagram-LMCZKHZV-0GQGcOcv.js
        @@ -1,4 +1,4 @@
        -import{g as Oe,d as Re}from"./chunk-32BRIVSS-DUDRPqmY.js";import{s as Se,g as De,a as Pe,b as Be,_ as y,c as Dt,d as Nt,l as he,e as Ie,f as Me,h as Tt,i as pe,j as Le,w as Ne,k as Jt,m as ue}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var jt=(function(){var e=y(function(_t,x,v,E){for(v=v||{},E=_t.length;E--;v[_t[E]]=x);return v},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],r=[1,28],a=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],p=[1,68],g=[1,69],m=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],st=[1,47],rt=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Xt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],A=[1,82],k=[1,83],C=[1,84],w=[1,85],T=[12,14,42],se=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],vt=[12,33],Wt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:y(function(x,v,E,b,R,h,Rt){var f=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[f-3]);break;case 19:b.setTitle(h[f].substring(6)),this.$=h[f].substring(6);break;case 20:b.setAccDescription(h[f].substring(15)),this.$=h[f].substring(15);break;case 21:this.$=h[f].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[f].trim(),b.setAccDescription(this.$);break;case 28:h[f].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 29:h[f].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 30:b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 31:h[f].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[f]),this.$=h[f];break;case 32:b.addDeploymentNode("node",...h[f]),this.$=h[f];break;case 33:b.addDeploymentNode("nodeL",...h[f]),this.$=h[f];break;case 34:b.addDeploymentNode("nodeR",...h[f]),this.$=h[f];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[f]),this.$=h[f];break;case 40:b.addPersonOrSystem("external_person",...h[f]),this.$=h[f];break;case 41:b.addPersonOrSystem("system",...h[f]),this.$=h[f];break;case 42:b.addPersonOrSystem("system_db",...h[f]),this.$=h[f];break;case 43:b.addPersonOrSystem("system_queue",...h[f]),this.$=h[f];break;case 44:b.addPersonOrSystem("external_system",...h[f]),this.$=h[f];break;case 45:b.addPersonOrSystem("external_system_db",...h[f]),this.$=h[f];break;case 46:b.addPersonOrSystem("external_system_queue",...h[f]),this.$=h[f];break;case 47:b.addContainer("container",...h[f]),this.$=h[f];break;case 48:b.addContainer("container_db",...h[f]),this.$=h[f];break;case 49:b.addContainer("container_queue",...h[f]),this.$=h[f];break;case 50:b.addContainer("external_container",...h[f]),this.$=h[f];break;case 51:b.addContainer("external_container_db",...h[f]),this.$=h[f];break;case 52:b.addContainer("external_container_queue",...h[f]),this.$=h[f];break;case 53:b.addComponent("component",...h[f]),this.$=h[f];break;case 54:b.addComponent("component_db",...h[f]),this.$=h[f];break;case 55:b.addComponent("component_queue",...h[f]),this.$=h[f];break;case 56:b.addComponent("external_component",...h[f]),this.$=h[f];break;case 57:b.addComponent("external_component_db",...h[f]),this.$=h[f];break;case 58:b.addComponent("external_component_queue",...h[f]),this.$=h[f];break;case 60:b.addRel("rel",...h[f]),this.$=h[f];break;case 61:b.addRel("birel",...h[f]),this.$=h[f];break;case 62:b.addRel("rel_u",...h[f]),this.$=h[f];break;case 63:b.addRel("rel_d",...h[f]),this.$=h[f];break;case 64:b.addRel("rel_l",...h[f]),this.$=h[f];break;case 65:b.addRel("rel_r",...h[f]),this.$=h[f];break;case 66:b.addRel("rel_b",...h[f]),this.$=h[f];break;case 67:h[f].splice(0,1),b.addRel("rel",...h[f]),this.$=h[f];break;case 68:b.updateElStyle("update_el_style",...h[f]),this.$=h[f];break;case 69:b.updateRelStyle("update_rel_style",...h[f]),this.$=h[f];break;case 70:b.updateLayoutConfig("update_layout_config",...h[f]),this.$=h[f];break;case 71:this.$=[h[f]];break;case 72:h[f].unshift(h[f-1]),this.$=h[f];break;case 73:case 75:this.$=h[f].trim();break;case 74:let Et={};Et[h[f-1].trim()]=h[f].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ct,[2,14]),e(Xt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(Ot,[2,19]),e(Ot,[2,20]),{25:[1,78]},{27:[1,79]},e(Ot,[2,23]),{35:80,75:81,76:A,77:k,79:C,80:w},{35:86,75:81,76:A,77:k,79:C,80:w},{35:87,75:81,76:A,77:k,79:C,80:w},{35:88,75:81,76:A,77:k,79:C,80:w},{35:89,75:81,76:A,77:k,79:C,80:w},{35:90,75:81,76:A,77:k,79:C,80:w},{35:91,75:81,76:A,77:k,79:C,80:w},{35:92,75:81,76:A,77:k,79:C,80:w},{35:93,75:81,76:A,77:k,79:C,80:w},{35:94,75:81,76:A,77:k,79:C,80:w},{35:95,75:81,76:A,77:k,79:C,80:w},{35:96,75:81,76:A,77:k,79:C,80:w},{35:97,75:81,76:A,77:k,79:C,80:w},{35:98,75:81,76:A,77:k,79:C,80:w},{35:99,75:81,76:A,77:k,79:C,80:w},{35:100,75:81,76:A,77:k,79:C,80:w},{35:101,75:81,76:A,77:k,79:C,80:w},{35:102,75:81,76:A,77:k,79:C,80:w},{35:103,75:81,76:A,77:k,79:C,80:w},{35:104,75:81,76:A,77:k,79:C,80:w},e(T,[2,59]),{35:105,75:81,76:A,77:k,79:C,80:w},{35:106,75:81,76:A,77:k,79:C,80:w},{35:107,75:81,76:A,77:k,79:C,80:w},{35:108,75:81,76:A,77:k,79:C,80:w},{35:109,75:81,76:A,77:k,79:C,80:w},{35:110,75:81,76:A,77:k,79:C,80:w},{35:111,75:81,76:A,77:k,79:C,80:w},{35:112,75:81,76:A,77:k,79:C,80:w},{35:113,75:81,76:A,77:k,79:C,80:w},{35:114,75:81,76:A,77:k,79:C,80:w},{35:115,75:81,76:A,77:k,79:C,80:w},{20:116,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:A,77:k,79:C,80:w},{35:120,75:81,76:A,77:k,79:C,80:w},{35:121,75:81,76:A,77:k,79:C,80:w},{35:122,75:81,76:A,77:k,79:C,80:w},{35:123,75:81,76:A,77:k,79:C,80:w},{35:124,75:81,76:A,77:k,79:C,80:w},{35:125,75:81,76:A,77:k,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Xt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:r}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:r,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ot,[2,21]),e(Ot,[2,22]),e(T,[2,39]),e(se,[2,71],{75:81,35:132,76:A,77:k,79:C,80:w}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(T,[2,40]),e(T,[2,41]),e(T,[2,42]),e(T,[2,43]),e(T,[2,44]),e(T,[2,45]),e(T,[2,46]),e(T,[2,47]),e(T,[2,48]),e(T,[2,49]),e(T,[2,50]),e(T,[2,51]),e(T,[2,52]),e(T,[2,53]),e(T,[2,54]),e(T,[2,55]),e(T,[2,56]),e(T,[2,57]),e(T,[2,58]),e(T,[2,60]),e(T,[2,61]),e(T,[2,62]),e(T,[2,63]),e(T,[2,64]),e(T,[2,65]),e(T,[2,66]),e(T,[2,67]),e(T,[2,68]),e(T,[2,69]),e(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(vt,[2,28]),e(vt,[2,29]),e(vt,[2,30]),e(vt,[2,31]),e(vt,[2,32]),e(vt,[2,33]),e(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Xt,[2,18]),e(Ct,[2,38]),e(se,[2,72]),e(Bt,[2,74]),e(T,[2,24]),e(T,[2,35]),e(Wt,[2,25]),e(Wt,[2,26],{12:[1,138]}),e(Wt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:y(function(x,v){if(v.recoverable)this.trace(x);else{var E=new Error(x);throw E.hash=v,E}},"parseError"),parse:y(function(x){var v=this,E=[0],b=[],R=[null],h=[],Rt=this.table,f="",Et=0,re=0,ke=2,le=1,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),At={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(At.yy[Ht]=this.yy[Ht]);D.setInput(x,At.yy),At.yy.lexer=D,At.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;typeof At.yy.parseError=="function"?this.parseError=At.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(L){E.length=E.length-2*L,R.length=R.length-L,h.length=h.length-L}y(Te,"popStack");function oe(){var L;return L=b.pop()||D.lex()||le,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=v.symbols_[L]||L),L}y(oe,"lex");for(var I,kt,N,Gt,wt={},Mt,W,ce,Lt;;){if(kt=E[E.length-1],this.defaultActions[kt]?N=this.defaultActions[kt]:((I===null||typeof I>"u")&&(I=oe()),N=Rt[kt]&&Rt[kt][I]),typeof N>"u"||!N.length||!N[0]){var Kt="";Lt=[];for(Mt in Rt[kt])this.terminals_[Mt]&&Mt>ke&&Lt.push("'"+this.terminals_[Mt]+"'");D.showPosition?Kt="Parse error on line "+(Et+1)+`:
        +import{g as Oe,d as Re}from"./chunk-32BRIVSS-DNJ_Bmzz.js";import{s as Se,g as De,a as Pe,b as Be,_ as y,c as Dt,d as Nt,l as he,e as Ie,f as Me,h as Tt,i as pe,j as Le,w as Ne,k as Jt,m as ue}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var jt=(function(){var e=y(function(_t,x,v,E){for(v=v||{},E=_t.length;E--;v[_t[E]]=x);return v},"o"),t=[1,24],s=[1,25],o=[1,26],l=[1,27],r=[1,28],a=[1,63],n=[1,64],i=[1,65],u=[1,66],d=[1,67],p=[1,68],g=[1,69],m=[1,29],O=[1,30],S=[1,31],P=[1,32],M=[1,33],U=[1,34],H=[1,35],q=[1,36],G=[1,37],K=[1,38],J=[1,39],Z=[1,40],$=[1,41],tt=[1,42],et=[1,43],at=[1,44],it=[1,45],nt=[1,46],st=[1,47],rt=[1,48],lt=[1,50],ot=[1,51],ct=[1,52],ht=[1,53],ut=[1,54],dt=[1,55],ft=[1,56],pt=[1,57],yt=[1,58],gt=[1,59],bt=[1,60],Ct=[14,42],Xt=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Ot=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],A=[1,82],k=[1,83],C=[1,84],w=[1,85],T=[12,14,42],se=[12,14,33,42],Bt=[12,14,33,42,76,77,79,80],vt=[12,33],Wt=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Qt={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:y(function(x,v,E,b,R,h,Rt){var f=h.length-1;switch(R){case 3:b.setDirection("TB");break;case 4:b.setDirection("BT");break;case 5:b.setDirection("RL");break;case 6:b.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:b.setC4Type(h[f-3]);break;case 19:b.setTitle(h[f].substring(6)),this.$=h[f].substring(6);break;case 20:b.setAccDescription(h[f].substring(15)),this.$=h[f].substring(15);break;case 21:this.$=h[f].trim(),b.setTitle(this.$);break;case 22:case 23:this.$=h[f].trim(),b.setAccDescription(this.$);break;case 28:h[f].splice(2,0,"ENTERPRISE"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 29:h[f].splice(2,0,"SYSTEM"),b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 30:b.addPersonOrSystemBoundary(...h[f]),this.$=h[f];break;case 31:h[f].splice(2,0,"CONTAINER"),b.addContainerBoundary(...h[f]),this.$=h[f];break;case 32:b.addDeploymentNode("node",...h[f]),this.$=h[f];break;case 33:b.addDeploymentNode("nodeL",...h[f]),this.$=h[f];break;case 34:b.addDeploymentNode("nodeR",...h[f]),this.$=h[f];break;case 35:b.popBoundaryParseStack();break;case 39:b.addPersonOrSystem("person",...h[f]),this.$=h[f];break;case 40:b.addPersonOrSystem("external_person",...h[f]),this.$=h[f];break;case 41:b.addPersonOrSystem("system",...h[f]),this.$=h[f];break;case 42:b.addPersonOrSystem("system_db",...h[f]),this.$=h[f];break;case 43:b.addPersonOrSystem("system_queue",...h[f]),this.$=h[f];break;case 44:b.addPersonOrSystem("external_system",...h[f]),this.$=h[f];break;case 45:b.addPersonOrSystem("external_system_db",...h[f]),this.$=h[f];break;case 46:b.addPersonOrSystem("external_system_queue",...h[f]),this.$=h[f];break;case 47:b.addContainer("container",...h[f]),this.$=h[f];break;case 48:b.addContainer("container_db",...h[f]),this.$=h[f];break;case 49:b.addContainer("container_queue",...h[f]),this.$=h[f];break;case 50:b.addContainer("external_container",...h[f]),this.$=h[f];break;case 51:b.addContainer("external_container_db",...h[f]),this.$=h[f];break;case 52:b.addContainer("external_container_queue",...h[f]),this.$=h[f];break;case 53:b.addComponent("component",...h[f]),this.$=h[f];break;case 54:b.addComponent("component_db",...h[f]),this.$=h[f];break;case 55:b.addComponent("component_queue",...h[f]),this.$=h[f];break;case 56:b.addComponent("external_component",...h[f]),this.$=h[f];break;case 57:b.addComponent("external_component_db",...h[f]),this.$=h[f];break;case 58:b.addComponent("external_component_queue",...h[f]),this.$=h[f];break;case 60:b.addRel("rel",...h[f]),this.$=h[f];break;case 61:b.addRel("birel",...h[f]),this.$=h[f];break;case 62:b.addRel("rel_u",...h[f]),this.$=h[f];break;case 63:b.addRel("rel_d",...h[f]),this.$=h[f];break;case 64:b.addRel("rel_l",...h[f]),this.$=h[f];break;case 65:b.addRel("rel_r",...h[f]),this.$=h[f];break;case 66:b.addRel("rel_b",...h[f]),this.$=h[f];break;case 67:h[f].splice(0,1),b.addRel("rel",...h[f]),this.$=h[f];break;case 68:b.updateElStyle("update_el_style",...h[f]),this.$=h[f];break;case 69:b.updateRelStyle("update_rel_style",...h[f]),this.$=h[f];break;case 70:b.updateLayoutConfig("update_layout_config",...h[f]),this.$=h[f];break;case 71:this.$=[h[f]];break;case 72:h[f].unshift(h[f-1]),this.$=h[f];break;case 73:case 75:this.$=h[f].trim();break;case 74:let Et={};Et[h[f-1].trim()]=h[f].trim(),this.$=Et;break;case 76:this.$="";break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:70,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:71,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:72,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{13:73,19:20,20:21,21:22,22:t,23:s,24:o,26:l,28:r,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{14:[1,74]},e(Ct,[2,13],{43:23,29:49,30:61,32:62,20:75,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ct,[2,14]),e(Xt,[2,16],{12:[1,76]}),e(Ct,[2,36],{12:[1,77]}),e(Ot,[2,19]),e(Ot,[2,20]),{25:[1,78]},{27:[1,79]},e(Ot,[2,23]),{35:80,75:81,76:A,77:k,79:C,80:w},{35:86,75:81,76:A,77:k,79:C,80:w},{35:87,75:81,76:A,77:k,79:C,80:w},{35:88,75:81,76:A,77:k,79:C,80:w},{35:89,75:81,76:A,77:k,79:C,80:w},{35:90,75:81,76:A,77:k,79:C,80:w},{35:91,75:81,76:A,77:k,79:C,80:w},{35:92,75:81,76:A,77:k,79:C,80:w},{35:93,75:81,76:A,77:k,79:C,80:w},{35:94,75:81,76:A,77:k,79:C,80:w},{35:95,75:81,76:A,77:k,79:C,80:w},{35:96,75:81,76:A,77:k,79:C,80:w},{35:97,75:81,76:A,77:k,79:C,80:w},{35:98,75:81,76:A,77:k,79:C,80:w},{35:99,75:81,76:A,77:k,79:C,80:w},{35:100,75:81,76:A,77:k,79:C,80:w},{35:101,75:81,76:A,77:k,79:C,80:w},{35:102,75:81,76:A,77:k,79:C,80:w},{35:103,75:81,76:A,77:k,79:C,80:w},{35:104,75:81,76:A,77:k,79:C,80:w},e(T,[2,59]),{35:105,75:81,76:A,77:k,79:C,80:w},{35:106,75:81,76:A,77:k,79:C,80:w},{35:107,75:81,76:A,77:k,79:C,80:w},{35:108,75:81,76:A,77:k,79:C,80:w},{35:109,75:81,76:A,77:k,79:C,80:w},{35:110,75:81,76:A,77:k,79:C,80:w},{35:111,75:81,76:A,77:k,79:C,80:w},{35:112,75:81,76:A,77:k,79:C,80:w},{35:113,75:81,76:A,77:k,79:C,80:w},{35:114,75:81,76:A,77:k,79:C,80:w},{35:115,75:81,76:A,77:k,79:C,80:w},{20:116,29:49,30:61,32:62,34:a,36:n,37:i,38:u,39:d,40:p,41:g,43:23,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt},{12:[1,118],33:[1,117]},{35:119,75:81,76:A,77:k,79:C,80:w},{35:120,75:81,76:A,77:k,79:C,80:w},{35:121,75:81,76:A,77:k,79:C,80:w},{35:122,75:81,76:A,77:k,79:C,80:w},{35:123,75:81,76:A,77:k,79:C,80:w},{35:124,75:81,76:A,77:k,79:C,80:w},{35:125,75:81,76:A,77:k,79:C,80:w},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},e(Ct,[2,15]),e(Xt,[2,17],{21:22,19:130,22:t,23:s,24:o,26:l,28:r}),e(Ct,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:t,23:s,24:o,26:l,28:r,34:a,36:n,37:i,38:u,39:d,40:p,41:g,44:m,45:O,46:S,47:P,48:M,49:U,50:H,51:q,52:G,53:K,54:J,55:Z,56:$,57:tt,58:et,59:at,60:it,61:nt,62:st,63:rt,64:lt,65:ot,66:ct,67:ht,68:ut,69:dt,70:ft,71:pt,72:yt,73:gt,74:bt}),e(Ot,[2,21]),e(Ot,[2,22]),e(T,[2,39]),e(se,[2,71],{75:81,35:132,76:A,77:k,79:C,80:w}),e(Bt,[2,73]),{78:[1,133]},e(Bt,[2,75]),e(Bt,[2,76]),e(T,[2,40]),e(T,[2,41]),e(T,[2,42]),e(T,[2,43]),e(T,[2,44]),e(T,[2,45]),e(T,[2,46]),e(T,[2,47]),e(T,[2,48]),e(T,[2,49]),e(T,[2,50]),e(T,[2,51]),e(T,[2,52]),e(T,[2,53]),e(T,[2,54]),e(T,[2,55]),e(T,[2,56]),e(T,[2,57]),e(T,[2,58]),e(T,[2,60]),e(T,[2,61]),e(T,[2,62]),e(T,[2,63]),e(T,[2,64]),e(T,[2,65]),e(T,[2,66]),e(T,[2,67]),e(T,[2,68]),e(T,[2,69]),e(T,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},e(vt,[2,28]),e(vt,[2,29]),e(vt,[2,30]),e(vt,[2,31]),e(vt,[2,32]),e(vt,[2,33]),e(vt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},e(Xt,[2,18]),e(Ct,[2,38]),e(se,[2,72]),e(Bt,[2,74]),e(T,[2,24]),e(T,[2,35]),e(Wt,[2,25]),e(Wt,[2,26],{12:[1,138]}),e(Wt,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:y(function(x,v){if(v.recoverable)this.trace(x);else{var E=new Error(x);throw E.hash=v,E}},"parseError"),parse:y(function(x){var v=this,E=[0],b=[],R=[null],h=[],Rt=this.table,f="",Et=0,re=0,ke=2,le=1,Ce=h.slice.call(arguments,1),D=Object.create(this.lexer),At={yy:{}};for(var Ht in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ht)&&(At.yy[Ht]=this.yy[Ht]);D.setInput(x,At.yy),At.yy.lexer=D,At.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var qt=D.yylloc;h.push(qt);var we=D.options&&D.options.ranges;typeof At.yy.parseError=="function"?this.parseError=At.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Te(L){E.length=E.length-2*L,R.length=R.length-L,h.length=h.length-L}y(Te,"popStack");function oe(){var L;return L=b.pop()||D.lex()||le,typeof L!="number"&&(L instanceof Array&&(b=L,L=b.pop()),L=v.symbols_[L]||L),L}y(oe,"lex");for(var I,kt,N,Gt,wt={},Mt,W,ce,Lt;;){if(kt=E[E.length-1],this.defaultActions[kt]?N=this.defaultActions[kt]:((I===null||typeof I>"u")&&(I=oe()),N=Rt[kt]&&Rt[kt][I]),typeof N>"u"||!N.length||!N[0]){var Kt="";Lt=[];for(Mt in Rt[kt])this.terminals_[Mt]&&Mt>ke&&Lt.push("'"+this.terminals_[Mt]+"'");D.showPosition?Kt="Parse error on line "+(Et+1)+`:
         `+D.showPosition()+`
         Expecting `+Lt.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Kt="Parse error on line "+(Et+1)+": Unexpected "+(I==le?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Kt,{text:D.match,token:this.terminals_[I]||I,line:D.yylineno,loc:qt,expected:Lt})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+kt+", token: "+I);switch(N[0]){case 1:E.push(I),R.push(D.yytext),h.push(D.yylloc),E.push(N[1]),I=null,re=D.yyleng,f=D.yytext,Et=D.yylineno,qt=D.yylloc;break;case 2:if(W=this.productions_[N[1]][1],wt.$=R[R.length-W],wt._$={first_line:h[h.length-(W||1)].first_line,last_line:h[h.length-1].last_line,first_column:h[h.length-(W||1)].first_column,last_column:h[h.length-1].last_column},we&&(wt._$.range=[h[h.length-(W||1)].range[0],h[h.length-1].range[1]]),Gt=this.performAction.apply(wt,[f,re,Et,At.yy,N[1],R,h].concat(Ce)),typeof Gt<"u")return Gt;W&&(E=E.slice(0,-1*W*2),R=R.slice(0,-1*W),h=h.slice(0,-1*W)),E.push(this.productions_[N[1]][0]),R.push(wt.$),h.push(wt._$),ce=Rt[E[E.length-2]][E[E.length-1]],E.push(ce);break;case 3:return!0}}return!0},"parse")},Ae=(function(){var _t={EOF:1,parseError:y(function(v,E){if(this.yy.parser)this.yy.parser.parseError(v,E);else throw new Error(v)},"parseError"),setInput:y(function(x,v){return this.yy=v||this.yy||{},this._input=x,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var v=x.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:y(function(x){var v=x.length,E=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var b=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),E.length-1&&(this.yylineno-=E.length-1);var R=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:E?(E.length===b.length?this.yylloc.first_column:0)+b[b.length-E.length].length-E[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[R[0],R[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
         `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(x){this.unput(this.match.slice(x))},"less"),pastInput:y(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var x=this.pastInput(),v=new Array(x.length+1).join("-");return x+this.upcomingInput()+`
        diff --git a/apps/kimi-code/dist-web/assets/channel-Dk_xUHM6.js b/apps/kimi-code/dist-web/assets/channel-Dk_xUHM6.js
        new file mode 100644
        index 00000000000..be58f9825f9
        --- /dev/null
        +++ b/apps/kimi-code/dist-web/assets/channel-Dk_xUHM6.js
        @@ -0,0 +1 @@
        +import{U as a,C as n}from"./mermaid.core-CsZwh_jB.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
        diff --git a/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js b/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js
        deleted file mode 100644
        index 3838ae21631..00000000000
        --- a/apps/kimi-code/dist-web/assets/channel-xkK6nTGq.js
        +++ /dev/null
        @@ -1 +0,0 @@
        -import{U as a,C as n}from"./mermaid.core-CJB1tAev.js";const t=(r,o)=>a.lang.round(n.parse(r)[o]);export{t as c};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js b/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-Dntoz8YC.js
        similarity index 67%
        rename from apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js
        rename to apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-Dntoz8YC.js
        index 09a3ced2a38..40ef09f401c 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-DsAC7dRk.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-2Q5K7J3B-Dntoz8YC.js
        @@ -1 +1 @@
        -import{_ as i}from"./mermaid.core-CJB1tAev.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I};
        +import{_ as i}from"./mermaid.core-CsZwh_jB.js";var r=class{constructor(t){this.init=t,this.records=this.init()}static{i(this,"ImperativeState")}reset(){this.records=this.init()}};export{r as I};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js b/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DNJ_Bmzz.js
        similarity index 96%
        rename from apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js
        rename to apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DNJ_Bmzz.js
        index 24d8ca128c6..222bfab0bb4 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DUDRPqmY.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-32BRIVSS-DNJ_Bmzz.js
        @@ -1 +1 @@
        -import{_ as i,d as l,n as d,j as o}from"./mermaid.core-CJB1tAev.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h};
        +import{_ as i,d as l,n as d,j as o}from"./mermaid.core-CsZwh_jB.js";var x=i((r,t)=>{const e=r.append("rect");if(e.attr("x",t.x),e.attr("y",t.y),e.attr("fill",t.fill),e.attr("stroke",t.stroke),e.attr("width",t.width),e.attr("height",t.height),t.name&&e.attr("name",t.name),t.rx&&e.attr("rx",t.rx),t.ry&&e.attr("ry",t.ry),t.attrs!==void 0)for(const s in t.attrs)e.attr(s,t.attrs[s]);return t.class&&e.attr("class",t.class),e},"drawRect"),p=i((r,t)=>{const e={x:t.startx,y:t.starty,width:t.stopx-t.startx,height:t.stopy-t.starty,fill:t.fill,stroke:t.stroke,class:"rect"};x(r,e).lower()},"drawBackgroundRect"),y=i((r,t)=>{const e=t.text.replace(d," "),s=r.append("text");s.attr("x",t.x),s.attr("y",t.y),s.attr("class","legend"),s.style("text-anchor",t.anchor),t.class&&s.attr("class",t.class);const a=s.append("tspan");return a.attr("x",t.x+t.textMargin*2),a.text(e),s},"drawText"),m=i((r,t,e,s)=>{const a=r.append("image");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",n)},"drawImage"),g=i((r,t,e,s)=>{const a=r.append("use");a.attr("x",t),a.attr("y",e);const n=o.sanitizeUrl(s);a.attr("xlink:href",`#${n}`)},"drawEmbeddedImage"),h=i(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),f=i(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),w=i(()=>{let r=l(".mermaidTooltip");return r.empty()&&(r=l("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),r},"createTooltip");export{p as a,f as b,g as c,x as d,m as e,w as f,h as g,y as h};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js b/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CqIxm4fU.js
        similarity index 83%
        rename from apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js
        rename to apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CqIxm4fU.js
        index 5798bdcabf1..4f764e658d8 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-yyj9cAyF.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-5VM5RSS4-CqIxm4fU.js
        @@ -1,4 +1,4 @@
        -import{_ as e}from"./mermaid.core-CJB1tAev.js";var l=e(()=>`
        +import{_ as e}from"./mermaid.core-CsZwh_jB.js";var l=e(()=>`
           /* Font Awesome icon styling - consolidated */
           .label-icon {
             display: inline-block;
        diff --git a/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js b/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-6_hx8rcm.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js
        rename to apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-6_hx8rcm.js
        index e9fc7746854..bcb9251b654 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-BCWDroXJ.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-EX3LRPZG-6_hx8rcm.js
        @@ -1,4 +1,4 @@
        -import{g as te}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as ee}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as f,l as _,c as $,x as se,y as ie,a as re,b as ae,g as ne,s as oe,o as le,p as ce,a9 as he,k as j,q as ue,d as bt,a5 as de}from"./mermaid.core-CJB1tAev.js";import{f as fe}from"./chunk-32BRIVSS-DUDRPqmY.js";var vt=(function(){var t=f(function(V,a,d,r){for(d=d||{},r=V.length;r--;d[V[r]]=a);return d},"o"),e=[1,2],o=[1,3],s=[1,4],c=[2,4],h=[1,9],p=[1,11],y=[1,16],n=[1,17],T=[1,18],m=[1,19],O=[1,33],x=[1,20],k=[1,21],u=[1,22],L=[1,23],I=[1,24],v=[1,26],F=[1,27],C=[1,28],P=[1,29],w=[1,30],H=[1,31],it=[1,32],rt=[1,35],at=[1,36],nt=[1,37],ot=[1,38],z=[1,34],S=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],lt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],xt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],yt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:f(function(a,d,r,g,E,i,B){var l=i.length-1;switch(E){case 3:return g.setRootDoc(i[l]),i[l];case 4:this.$=[];break;case 5:i[l]!="nl"&&(i[l-1].push(i[l]),this.$=i[l-1]);break;case 6:case 7:this.$=i[l];break;case 8:this.$="nl";break;case 12:this.$=i[l];break;case 13:const Q=i[l-1];Q.description=g.trimColon(i[l]),this.$=Q;break;case 14:this.$={stmt:"relation",state1:i[l-2],state2:i[l]};break;case 15:const gt=g.trimColon(i[l]);this.$={stmt:"relation",state1:i[l-3],state2:i[l-1],description:gt};break;case 19:this.$={stmt:"state",id:i[l-3],type:"default",description:"",doc:i[l-1]};break;case 20:var Y=i[l],K=i[l-2].trim();if(i[l].match(":")){var ht=i[l].split(":");Y=ht[0],K=[K,ht[1]]}this.$={stmt:"state",id:Y,type:"default",description:K};break;case 21:this.$={stmt:"state",id:i[l-3],type:"default",description:i[l-5],doc:i[l-1]};break;case 22:this.$={stmt:"state",id:i[l],type:"fork"};break;case 23:this.$={stmt:"state",id:i[l],type:"join"};break;case 24:this.$={stmt:"state",id:i[l],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[l-1].trim(),note:{position:i[l-2].trim(),text:i[l].trim()}};break;case 29:this.$=i[l].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=i[l].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[l-3],url:i[l-2],tooltip:i[l-1]};break;case 33:this.$={stmt:"click",id:i[l-3],url:i[l-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[l-1].trim(),classes:i[l].trim()};break;case 36:this.$={stmt:"style",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 37:this.$={stmt:"applyClass",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[l].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:o,6:s},{1:[3]},{3:5,4:e,5:o,6:s},{3:6,4:e,5:o,6:s},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],c,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,7]),t(S,[2,8]),t(S,[2,9]),t(S,[2,10]),t(S,[2,11]),t(S,[2,12],{14:[1,40],15:[1,41]}),t(S,[2,16]),{18:[1,42]},t(S,[2,18],{20:[1,43]}),{23:[1,44]},t(S,[2,22]),t(S,[2,23]),t(S,[2,24]),t(S,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(S,[2,28]),{34:[1,49]},{36:[1,50]},t(S,[2,31]),{13:51,24:O,57:z},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(lt,[2,44],{58:[1,56]}),t(lt,[2,45],{58:[1,57]}),t(S,[2,38]),t(S,[2,39]),t(S,[2,40]),t(S,[2,41]),t(S,[2,6]),t(S,[2,13]),{13:58,24:O,57:z},t(S,[2,17]),t(xt,c,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(S,[2,29]),t(S,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(S,[2,14],{14:[1,71]}),{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,72],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(S,[2,37]),t(lt,[2,46]),t(lt,[2,47]),t(S,[2,15]),t(S,[2,19]),t(xt,c,{7:78}),t(S,[2,26]),t(S,[2,27]),{5:[1,79]},{5:[1,80]},{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,81],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,32]),t(S,[2,33]),t(S,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(a,d){if(d.recoverable)this.trace(a);else{var r=new Error(a);throw r.hash=d,r}},"parseError"),parse:f(function(a){var d=this,r=[0],g=[],E=[null],i=[],B=this.table,l="",Y=0,K=0,ht=2,Q=1,gt=i.slice.call(arguments,1),b=Object.create(this.lexer),U={yy:{}};for(var Tt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Tt)&&(U.yy[Tt]=this.yy[Tt]);b.setInput(a,U.yy),U.yy.lexer=b,U.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Et=b.yylloc;i.push(Et);var Qt=b.options&&b.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(N){r.length=r.length-2*N,E.length=E.length-N,i.length=i.length-N}f(Zt,"popStack");function Lt(){var N;return N=g.pop()||b.lex()||Q,typeof N!="number"&&(N instanceof Array&&(g=N,N=g.pop()),N=d.symbols_[N]||N),N}f(Lt,"lex");for(var A,W,R,_t,X={},ut,G,It,dt;;){if(W=r[r.length-1],this.defaultActions[W]?R=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=Lt()),R=B[W]&&B[W][A]),typeof R>"u"||!R.length||!R[0]){var mt="";dt=[];for(ut in B[W])this.terminals_[ut]&&ut>ht&&dt.push("'"+this.terminals_[ut]+"'");b.showPosition?mt="Parse error on line "+(Y+1)+`:
        +import{g as te}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as ee}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as f,l as _,c as $,x as se,y as ie,a as re,b as ae,g as ne,s as oe,o as le,p as ce,a9 as he,k as j,q as ue,d as bt,a5 as de}from"./mermaid.core-CsZwh_jB.js";import{f as fe}from"./chunk-32BRIVSS-DNJ_Bmzz.js";var vt=(function(){var t=f(function(V,a,d,r){for(d=d||{},r=V.length;r--;d[V[r]]=a);return d},"o"),e=[1,2],o=[1,3],s=[1,4],c=[2,4],h=[1,9],p=[1,11],y=[1,16],n=[1,17],T=[1,18],m=[1,19],O=[1,33],x=[1,20],k=[1,21],u=[1,22],L=[1,23],I=[1,24],v=[1,26],F=[1,27],C=[1,28],P=[1,29],w=[1,30],H=[1,31],it=[1,32],rt=[1,35],at=[1,36],nt=[1,37],ot=[1,38],z=[1,34],S=[1,4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],lt=[1,4,5,14,15,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,39,40,41,45,48,51,52,53,54,57],xt=[4,5,16,17,19,21,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],yt={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NL:5,SD:6,document:7,line:8,statement:9,classDefStatement:10,styleStatement:11,cssClassStatement:12,idStatement:13,DESCR:14,"-->":15,HIDE_EMPTY:16,scale:17,WIDTH:18,COMPOSIT_STATE:19,STRUCT_START:20,STRUCT_STOP:21,STATE_DESCR:22,AS:23,ID:24,FORK:25,JOIN:26,CHOICE:27,CONCURRENT:28,note:29,notePosition:30,NOTE_TEXT:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,CLICK:38,STRING:39,HREF:40,classDef:41,CLASSDEF_ID:42,CLASSDEF_STYLEOPTS:43,DEFAULT:44,style:45,STYLE_IDS:46,STYLEDEF_STYLEOPTS:47,class:48,CLASSENTITY_IDS:49,STYLECLASS:50,direction_tb:51,direction_bt:52,direction_rl:53,direction_lr:54,eol:55,";":56,EDGE_STATE:57,STYLE_SEPARATOR:58,left_of:59,right_of:60,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NL",6:"SD",14:"DESCR",15:"-->",16:"HIDE_EMPTY",17:"scale",18:"WIDTH",19:"COMPOSIT_STATE",20:"STRUCT_START",21:"STRUCT_STOP",22:"STATE_DESCR",23:"AS",24:"ID",25:"FORK",26:"JOIN",27:"CHOICE",28:"CONCURRENT",29:"note",31:"NOTE_TEXT",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",38:"CLICK",39:"STRING",40:"HREF",41:"classDef",42:"CLASSDEF_ID",43:"CLASSDEF_STYLEOPTS",44:"DEFAULT",45:"style",46:"STYLE_IDS",47:"STYLEDEF_STYLEOPTS",48:"class",49:"CLASSENTITY_IDS",50:"STYLECLASS",51:"direction_tb",52:"direction_bt",53:"direction_rl",54:"direction_lr",56:";",57:"EDGE_STATE",58:"STYLE_SEPARATOR",59:"left_of",60:"right_of"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,3],[9,4],[9,1],[9,2],[9,1],[9,4],[9,3],[9,6],[9,1],[9,1],[9,1],[9,1],[9,4],[9,4],[9,1],[9,2],[9,2],[9,1],[9,5],[9,5],[10,3],[10,3],[11,3],[12,3],[32,1],[32,1],[32,1],[32,1],[55,1],[55,1],[13,1],[13,1],[13,3],[13,3],[30,1],[30,1]],performAction:f(function(a,d,r,g,E,i,B){var l=i.length-1;switch(E){case 3:return g.setRootDoc(i[l]),i[l];case 4:this.$=[];break;case 5:i[l]!="nl"&&(i[l-1].push(i[l]),this.$=i[l-1]);break;case 6:case 7:this.$=i[l];break;case 8:this.$="nl";break;case 12:this.$=i[l];break;case 13:const Q=i[l-1];Q.description=g.trimColon(i[l]),this.$=Q;break;case 14:this.$={stmt:"relation",state1:i[l-2],state2:i[l]};break;case 15:const gt=g.trimColon(i[l]);this.$={stmt:"relation",state1:i[l-3],state2:i[l-1],description:gt};break;case 19:this.$={stmt:"state",id:i[l-3],type:"default",description:"",doc:i[l-1]};break;case 20:var Y=i[l],K=i[l-2].trim();if(i[l].match(":")){var ht=i[l].split(":");Y=ht[0],K=[K,ht[1]]}this.$={stmt:"state",id:Y,type:"default",description:K};break;case 21:this.$={stmt:"state",id:i[l-3],type:"default",description:i[l-5],doc:i[l-1]};break;case 22:this.$={stmt:"state",id:i[l],type:"fork"};break;case 23:this.$={stmt:"state",id:i[l],type:"join"};break;case 24:this.$={stmt:"state",id:i[l],type:"choice"};break;case 25:this.$={stmt:"state",id:g.getDividerId(),type:"divider"};break;case 26:this.$={stmt:"state",id:i[l-1].trim(),note:{position:i[l-2].trim(),text:i[l].trim()}};break;case 29:this.$=i[l].trim(),g.setAccTitle(this.$);break;case 30:case 31:this.$=i[l].trim(),g.setAccDescription(this.$);break;case 32:this.$={stmt:"click",id:i[l-3],url:i[l-2],tooltip:i[l-1]};break;case 33:this.$={stmt:"click",id:i[l-3],url:i[l-1],tooltip:""};break;case 34:case 35:this.$={stmt:"classDef",id:i[l-1].trim(),classes:i[l].trim()};break;case 36:this.$={stmt:"style",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 37:this.$={stmt:"applyClass",id:i[l-1].trim(),styleClass:i[l].trim()};break;case 38:g.setDirection("TB"),this.$={stmt:"dir",value:"TB"};break;case 39:g.setDirection("BT"),this.$={stmt:"dir",value:"BT"};break;case 40:g.setDirection("RL"),this.$={stmt:"dir",value:"RL"};break;case 41:g.setDirection("LR"),this.$={stmt:"dir",value:"LR"};break;case 44:case 45:this.$={stmt:"state",id:i[l].trim(),type:"default",description:""};break;case 46:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break;case 47:this.$={stmt:"state",id:i[l-2].trim(),classes:[i[l].trim()],type:"default",description:""};break}},"anonymous"),table:[{3:1,4:e,5:o,6:s},{1:[3]},{3:5,4:e,5:o,6:s},{3:6,4:e,5:o,6:s},t([1,4,5,16,17,19,22,24,25,26,27,28,29,33,35,37,38,41,45,48,51,52,53,54,57],c,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,5]),{9:39,10:12,11:13,12:14,13:15,16:y,17:n,19:T,22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,7]),t(S,[2,8]),t(S,[2,9]),t(S,[2,10]),t(S,[2,11]),t(S,[2,12],{14:[1,40],15:[1,41]}),t(S,[2,16]),{18:[1,42]},t(S,[2,18],{20:[1,43]}),{23:[1,44]},t(S,[2,22]),t(S,[2,23]),t(S,[2,24]),t(S,[2,25]),{30:45,31:[1,46],59:[1,47],60:[1,48]},t(S,[2,28]),{34:[1,49]},{36:[1,50]},t(S,[2,31]),{13:51,24:O,57:z},{42:[1,52],44:[1,53]},{46:[1,54]},{49:[1,55]},t(lt,[2,44],{58:[1,56]}),t(lt,[2,45],{58:[1,57]}),t(S,[2,38]),t(S,[2,39]),t(S,[2,40]),t(S,[2,41]),t(S,[2,6]),t(S,[2,13]),{13:58,24:O,57:z},t(S,[2,17]),t(xt,c,{7:59}),{24:[1,60]},{24:[1,61]},{23:[1,62]},{24:[2,48]},{24:[2,49]},t(S,[2,29]),t(S,[2,30]),{39:[1,63],40:[1,64]},{43:[1,65]},{43:[1,66]},{47:[1,67]},{50:[1,68]},{24:[1,69]},{24:[1,70]},t(S,[2,14],{14:[1,71]}),{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,72],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,20],{20:[1,73]}),{31:[1,74]},{24:[1,75]},{39:[1,76]},{39:[1,77]},t(S,[2,34]),t(S,[2,35]),t(S,[2,36]),t(S,[2,37]),t(lt,[2,46]),t(lt,[2,47]),t(S,[2,15]),t(S,[2,19]),t(xt,c,{7:78}),t(S,[2,26]),t(S,[2,27]),{5:[1,79]},{5:[1,80]},{4:h,5:p,8:8,9:10,10:12,11:13,12:14,13:15,16:y,17:n,19:T,21:[1,81],22:m,24:O,25:x,26:k,27:u,28:L,29:I,32:25,33:v,35:F,37:C,38:P,41:w,45:H,48:it,51:rt,52:at,53:nt,54:ot,57:z},t(S,[2,32]),t(S,[2,33]),t(S,[2,21])],defaultActions:{5:[2,1],6:[2,2],47:[2,48],48:[2,49]},parseError:f(function(a,d){if(d.recoverable)this.trace(a);else{var r=new Error(a);throw r.hash=d,r}},"parseError"),parse:f(function(a){var d=this,r=[0],g=[],E=[null],i=[],B=this.table,l="",Y=0,K=0,ht=2,Q=1,gt=i.slice.call(arguments,1),b=Object.create(this.lexer),U={yy:{}};for(var Tt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Tt)&&(U.yy[Tt]=this.yy[Tt]);b.setInput(a,U.yy),U.yy.lexer=b,U.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Et=b.yylloc;i.push(Et);var Qt=b.options&&b.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Zt(N){r.length=r.length-2*N,E.length=E.length-N,i.length=i.length-N}f(Zt,"popStack");function Lt(){var N;return N=g.pop()||b.lex()||Q,typeof N!="number"&&(N instanceof Array&&(g=N,N=g.pop()),N=d.symbols_[N]||N),N}f(Lt,"lex");for(var A,W,R,_t,X={},ut,G,It,dt;;){if(W=r[r.length-1],this.defaultActions[W]?R=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=Lt()),R=B[W]&&B[W][A]),typeof R>"u"||!R.length||!R[0]){var mt="";dt=[];for(ut in B[W])this.terminals_[ut]&&ut>ht&&dt.push("'"+this.terminals_[ut]+"'");b.showPosition?mt="Parse error on line "+(Y+1)+`:
         `+b.showPosition()+`
         Expecting `+dt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":mt="Parse error on line "+(Y+1)+": Unexpected "+(A==Q?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(mt,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:Et,expected:dt})}if(R[0]instanceof Array&&R.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(R[0]){case 1:r.push(A),E.push(b.yytext),i.push(b.yylloc),r.push(R[1]),A=null,K=b.yyleng,l=b.yytext,Y=b.yylineno,Et=b.yylloc;break;case 2:if(G=this.productions_[R[1]][1],X.$=E[E.length-G],X._$={first_line:i[i.length-(G||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(G||1)].first_column,last_column:i[i.length-1].last_column},Qt&&(X._$.range=[i[i.length-(G||1)].range[0],i[i.length-1].range[1]]),_t=this.performAction.apply(X,[l,K,Y,U.yy,R[1],E,i].concat(gt)),typeof _t<"u")return _t;G&&(r=r.slice(0,-1*G*2),E=E.slice(0,-1*G),i=i.slice(0,-1*G)),r.push(this.productions_[R[1]][0]),E.push(X.$),i.push(X._$),It=B[r[r.length-2]][r[r.length-1]],r.push(It);break;case 3:return!0}}return!0},"parse")},qt=(function(){var V={EOF:1,parseError:f(function(d,r){if(this.yy.parser)this.yy.parser.parseError(d,r);else throw new Error(d)},"parseError"),setInput:f(function(a,d){return this.yy=d||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var d=a.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},"input"),unput:f(function(a){var d=a.length,r=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var E=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===g.length?this.yylloc.first_column:0)+g[g.length-r.length].length-r[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[E[0],E[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
         `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(a){this.unput(this.match.slice(a))},"less"),pastInput:f(function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var a=this.pastInput(),d=new Array(a.length+1).join("-");return a+this.upcomingInput()+`
        diff --git a/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js b/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-R8L-LjRL.js
        similarity index 71%
        rename from apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js
        rename to apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-R8L-LjRL.js
        index ef3bb13e542..d95151b3ba8 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-Dsg3gA8l.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-JWPE2WC7-R8L-LjRL.js
        @@ -1 +1 @@
        -import{_ as i}from"./mermaid.core-CJB1tAev.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p};
        +import{_ as i}from"./mermaid.core-CsZwh_jB.js";function t(c,e){c.accDescr&&e.setAccDescription?.(c.accDescr),c.accTitle&&e.setAccTitle?.(c.accTitle),c.title&&e.setDiagramTitle?.(c.title)}i(t,"populateCommonDb");export{t as p};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js b/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-CuHpGhX-.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js
        rename to apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-CuHpGhX-.js
        index ca6d13d0a1d..8d9c8f42d85 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-JQ2kJR9W.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-MOJQB5TN-CuHpGhX-.js
        @@ -1,4 +1,4 @@
        -import{_ as p,l as w,F as L,z as E,q as I,W as X,e as q,i as H,c as G}from"./mermaid.core-CJB1tAev.js";var z="",b="",N="",A=[],R=new Map,k=p(e=>H(e,G()),"sanitizeText"),F=p(e=>{switch(e.type){case"terminal":return{...e,value:k(e.value)};case"nonterminal":return{...e,name:k(e.name)};case"sequence":return{...e,elements:e.elements.map(F)};case"choice":return{...e,alternatives:e.alternatives.map(F)};case"optional":return{...e,element:F(e.element)};case"repetition":return{...e,element:F(e.element),separator:e.separator?F(e.separator):void 0};case"special":return{...e,text:k(e.text)}}},"sanitizeAstNode"),U=p(()=>{z="",b="",N="",A.length=0,R.clear(),I(),w.debug("[Railroad] Database cleared")},"clear"),W=p(e=>{z=k(e),w.debug("[Railroad] Title set:",e)},"setTitle"),_=p(()=>z,"getTitle"),j=p(e=>{const i={...e,name:k(e.name),definition:F(e.definition),comment:e.comment?k(e.comment):void 0};w.debug("[Railroad] Adding rule:",i.name),R.has(i.name)&&w.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),A.push(i),R.set(i.name,i)},"addRule"),K=p(()=>A,"getRules"),J=p(e=>R.get(e),"getRule"),Q=p(e=>{b=k(e).replace(/^\s+/g,""),w.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),Z=p(()=>b,"getAccTitle"),V=p(e=>{N=k(e).replace(/\n\s+/g,`
        +import{_ as p,l as w,F as L,z as E,q as I,W as X,e as q,i as H,c as G}from"./mermaid.core-CsZwh_jB.js";var z="",b="",N="",A=[],R=new Map,k=p(e=>H(e,G()),"sanitizeText"),F=p(e=>{switch(e.type){case"terminal":return{...e,value:k(e.value)};case"nonterminal":return{...e,name:k(e.name)};case"sequence":return{...e,elements:e.elements.map(F)};case"choice":return{...e,alternatives:e.alternatives.map(F)};case"optional":return{...e,element:F(e.element)};case"repetition":return{...e,element:F(e.element),separator:e.separator?F(e.separator):void 0};case"special":return{...e,text:k(e.text)}}},"sanitizeAstNode"),U=p(()=>{z="",b="",N="",A.length=0,R.clear(),I(),w.debug("[Railroad] Database cleared")},"clear"),W=p(e=>{z=k(e),w.debug("[Railroad] Title set:",e)},"setTitle"),_=p(()=>z,"getTitle"),j=p(e=>{const i={...e,name:k(e.name),definition:F(e.definition),comment:e.comment?k(e.comment):void 0};w.debug("[Railroad] Adding rule:",i.name),R.has(i.name)&&w.warn(`[Railroad] Rule '${i.name}' is already defined. Overwriting.`),A.push(i),R.set(i.name,i)},"addRule"),K=p(()=>A,"getRules"),J=p(e=>R.get(e),"getRule"),Q=p(e=>{b=k(e).replace(/^\s+/g,""),w.debug("[Railroad] Accessibility title set:",e)},"setAccTitle"),Z=p(()=>b,"getAccTitle"),V=p(e=>{N=k(e).replace(/\n\s+/g,`
         `),w.debug("[Railroad] Accessibility description set:",e)},"setAccDescription"),ee=p(()=>N,"getAccDescription"),te=W,re=_,ie={clear:U,setTitle:W,getTitle:_,addRule:j,getRules:K,getRule:J,setAccTitle:Q,getAccTitle:Z,setAccDescription:V,getAccDescription:ee,setDiagramTitle:te,getDiagramTitle:re},g={compactMode:!1,padding:10,verticalSeparation:8,horizontalSeparation:10,arcRadius:10,fontSize:14,fontFamily:"monospace",terminalFill:"#FFFFC0",terminalStroke:"#000000",terminalTextColor:"#000000",nonTerminalFill:"#FFFFFF",nonTerminalStroke:"#000000",nonTerminalTextColor:"#000000",lineColor:"#000000",strokeWidth:2,markerFill:"#000000",commentFill:"#E8E8E8",commentStroke:"#888888",commentTextColor:"#666666",specialFill:"#F0E0FF",specialStroke:"#8800CC",ruleNameColor:"#000066",showMarkers:!0,markerRadius:5},ne=/^#(?:[\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$|^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch)\([\d\s%+,./-]+\)$|^[a-z]+$/i,ae=/^[\w "',.-]+$/,oe=new Set(["compactMode","padding","verticalSeparation","horizontalSeparation","arcRadius","fontSize","fontFamily","terminalFill","terminalStroke","terminalTextColor","nonTerminalFill","nonTerminalStroke","nonTerminalTextColor","lineColor","strokeWidth","markerFill","commentFill","commentStroke","commentTextColor","specialFill","specialStroke","ruleNameColor","showMarkers","markerRadius"]),B=p(e=>e?Object.keys(e).every(i=>i==="railroad"||oe.has(i)):!1,"isRailroadStyleOptions"),le=p(e=>e?"railroad"in e&&e.railroad?e.railroad:B(e)?e:{}:{},"extractRailroadOverrides"),se=p(e=>{if(!e||B(e))return{};const{railroad:i,svgId:a,theme:r,look:t,...n}=e;return n},"extractThemeOverrides"),m=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return ne.test(a)?a:i},"sanitizeColorValue"),Y=p((e,i)=>{if(typeof e!="string")return i;const a=e.trim();return ae.test(a)?a:i},"sanitizeFontFamilyValue"),S=p((e,i)=>{const a=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(a)&&a>=0?a:i},"sanitizeNumberValue"),de=p(e=>{const i=typeof e=="number"?e:typeof e=="string"?Number.parseFloat(e):Number.NaN;return Number.isFinite(i)&&i>0?i:void 0},"parseThemeFontSize"),ce=p(e=>{const i=Y(e.fontFamily,g.fontFamily),a=de(e.fontSize)??g.fontSize;return{...g,fontFamily:i,fontSize:a,terminalFill:m(e.secondBkg??e.secondaryColor,g.terminalFill),terminalStroke:m(e.secondaryBorderColor??e.lineColor,g.terminalStroke),terminalTextColor:m(e.secondaryTextColor??e.textColor,g.terminalTextColor),nonTerminalFill:m(e.mainBkg??e.background,g.nonTerminalFill),nonTerminalStroke:m(e.primaryBorderColor??e.lineColor,g.nonTerminalStroke),nonTerminalTextColor:m(e.primaryTextColor??e.textColor,g.nonTerminalTextColor),lineColor:m(e.lineColor,g.lineColor),markerFill:m(e.lineColor,g.markerFill),commentFill:m(e.labelBackground??e.tertiaryColor,g.commentFill),commentStroke:m(e.tertiaryBorderColor??e.lineColor,g.commentStroke),commentTextColor:m(e.tertiaryTextColor??e.textColor,g.commentTextColor),specialFill:m(e.tertiaryColor??e.secondaryColor,g.specialFill),specialStroke:m(e.tertiaryBorderColor??e.secondaryBorderColor,g.specialStroke),ruleNameColor:m(e.titleColor??e.textColor,g.ruleNameColor)}},"buildThemeDefaults"),M=p(e=>{const i=E(),a={...X(),...i.themeVariables??{},...se(e)},r=ce(a),t={...i.railroad??{},...le(e)};return{compactMode:t.compactMode??r.compactMode,padding:S(t.padding,r.padding),verticalSeparation:S(t.verticalSeparation,r.verticalSeparation),horizontalSeparation:S(t.horizontalSeparation,r.horizontalSeparation),arcRadius:S(t.arcRadius,r.arcRadius),fontSize:S(t.fontSize,r.fontSize),fontFamily:Y(t.fontFamily,r.fontFamily),terminalFill:m(t.terminalFill,r.terminalFill),terminalStroke:m(t.terminalStroke,r.terminalStroke),terminalTextColor:m(t.terminalTextColor,r.terminalTextColor),nonTerminalFill:m(t.nonTerminalFill,r.nonTerminalFill),nonTerminalStroke:m(t.nonTerminalStroke,r.nonTerminalStroke),nonTerminalTextColor:m(t.nonTerminalTextColor,r.nonTerminalTextColor),lineColor:m(t.lineColor,r.lineColor),strokeWidth:S(t.strokeWidth,r.strokeWidth),markerFill:m(t.markerFill,r.markerFill),commentFill:m(t.commentFill,r.commentFill),commentStroke:m(t.commentStroke,r.commentStroke),commentTextColor:m(t.commentTextColor,r.commentTextColor),specialFill:m(t.specialFill,r.specialFill),specialStroke:m(t.specialStroke,r.specialStroke),ruleNameColor:m(t.ruleNameColor,r.ruleNameColor),showMarkers:t.showMarkers??r.showMarkers,markerRadius:S(t.markerRadius,r.markerRadius)}},"buildRailroadStyleOptions"),ue=p(e=>{const{fontFamily:i,fontSize:a,terminalFill:r,terminalStroke:t,terminalTextColor:n,nonTerminalFill:h,nonTerminalStroke:s,nonTerminalTextColor:o,lineColor:u,strokeWidth:c,markerFill:d,commentFill:x,commentStroke:l,commentTextColor:f,specialFill:y,specialStroke:v,ruleNameColor:C}=M(e);return`
           .railroad-diagram {
             font-family: ${i};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js b/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Dm138b37.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js
        rename to apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Dm138b37.js
        index b0c5afb3cbb..d603548eb69 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Df2V79id.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-RYQCIY6F-Dm138b37.js
        @@ -1 +1 @@
        -import{_ as u,l as i}from"./mermaid.core-CJB1tAev.js";import{i as m,G as y}from"./graph-DOmOIIwC.js";import{b as _,m as X}from"./map-DxJ2ADlA.js";var j=4;function p(e){return _(e,j)}function C(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:F(e),edges:M(e)};return m(e.graph())||(r.value=p(e.graph())),r}function F(e){return X(e.nodes(),function(r){var n=e.node(r),s=e.parent(r),t={v:r};return m(n)||(t.value=n),m(s)||(t.parent=s),t})}function M(e){return X(e.edges(),function(r){var n=e.edge(r),s={v:r.v,w:r.w};return m(r.name)||(s.name=r.name),m(n)||(s.value=n),s})}var c=new Map,w=new Map,A=new Map,J=u(()=>{w.clear(),A.clear(),c.clear()},"clear"),v=u((e,r)=>{const n=w.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),R=u((e,r)=>{const n=w.get(r)||[];return i.info("Descendants of ",r," is ",n),i.info("Edge is ",e),e.v===r||e.w===r?!1:n?n.includes(e.v)||v(e.v,r)||v(e.w,r)||n.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1)},"edgeInCluster"),b=u((e,r,n,s)=>{i.warn("Copying children of ",e,"root",s,"data",r.node(e),s);const t=r.children(e)||[];e!==s&&t.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",t),t.forEach(o=>{if(r.children(o).length>0)b(o,r,n,s);else{const l=r.node(o);i.info("cp ",o," to ",s," with parent ",e),n.setNode(o,l),s!==r.parent(o)&&(i.warn("Setting parent",o,r.parent(o)),n.setParent(o,r.parent(o))),e!==s&&o!==e?(i.debug("Setting parent",o,e),n.setParent(o,e)):(i.info("In copy ",e,"root",s,"data",r.node(e),s),i.debug("Not Setting parent for node=",o,"cluster!==rootId",e!==s,"node!==clusterId",o!==e));const f=r.edges(o);i.debug("Copying Edges",f),f.forEach(a=>{i.info("Edge",a);const d=r.edge(a.v,a.w,a.name);i.info("Edge data",d,s);try{if(R(a,s)){const g=w.get(s)||[],E=g.includes(a.v)||v(a.v,s)||a.v===s,x=g.includes(a.w)||v(a.w,s)||a.w===s;if(E&&x)i.info("Copying as ",a.v,a.w,d,a.name),n.setEdge(a.v,a.w,d,a.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else{const N=E?s:a.v,h=x?s:a.w;i.info("Rebinding cross-boundary edge as ",N,h,d,a.name),r.setEdge(N,h,d,a.name)}}else i.info("Skipping copy of edge ",a.v,"-->",a.w," rootId: ",s," clusterId:",e)}catch(g){i.error(g)}})}i.debug("Removing node",o),r.removeNode(o)})},"copy"),O=u((e,r)=>{const n=r.children(e);let s=[...n];for(const t of n)A.set(t,e),s=[...s,...O(t,r)];return s},"extractDescendants"),P=u((e,r,n)=>{const s=e.edges().filter(a=>a.v===r||a.w===r),t=e.edges().filter(a=>a.v===n||a.w===n),o=s.map(a=>({v:a.v===r?n:a.v,w:a.w===r?r:a.w})),l=t.map(a=>({v:a.v,w:a.w}));return o.filter(a=>l.some(d=>a.v===d.v&&a.w===d.w))},"findCommonEdges"),D=u((e,r,n)=>{const s=r.children(e);if(i.trace("Searching children of id ",e,s),s.length<1)return e;let t;for(const o of s){const l=D(o,r,n),f=P(r,n,l);if(l)if(f.length>0)t=l;else return l}return t},"findNonClusterChild"),S=u(e=>!c.has(e)||!c.get(e).externalConnections?e:c.has(e)?c.get(e).id:e,"getAnchorId"),U=u((e,r)=>{if(!e||r>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),w.set(n,O(n,e)),c.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const s=e.children(n),t=e.edges();s.length>0?(i.debug("Cluster identified",n,w),t.forEach(o=>{const l=v(o.v,n),f=v(o.w,n);l^f&&(i.warn("Edge: ",o," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",w.get(n)),c.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,w)});for(let n of c.keys()){const s=c.get(n).id,t=e.parent(s);t!==n&&c.has(t)&&!c.get(t).externalConnections&&(c.get(n).id=t);const o=e.edges().some(l=>l.v===n);if(s&&c.get(n)?.externalConnections&&o&&L(e,s,n)){const l=T(e,n,e.parent(s));l&&(c.get(n).id=l)}}e.edges().forEach(function(n){const s=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let t=n.v,o=n.w;if(i.warn("Fix XXX",c,"ids:",n.v,n.w,"Translating: ",c.get(n.v)," --- ",c.get(n.w)),c.get(n.v)||c.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),t=S(n.v),o=S(n.w),e.removeEdge(n.v,n.w,n.name),t!==n.v){const l=e.parent(t);c.get(l).externalConnections=!0,s.fromCluster=n.v}if(o!==n.w){const l=e.parent(o);c.get(l).externalConnections=!0,s.toCluster=n.w}i.warn("Fix Replacing with XXX",t,o,n.name),e.setEdge(t,o,s,n.name)}}),i.warn("Adjusted Graph",C(e)),k(e,0),i.trace(c)},"adjustClustersAndEdges"),k=u((e,r)=>{if(i.warn("extractor - ",r,C(e),e.children("D")),r>10){i.error("Bailing out");return}let n=e.nodes(),s=!1;for(const t of n){const o=e.children(t);s=s||o.length>0}if(!s){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,r);for(const t of n)if(i.debug("Extracting node",t,c,c.has(t)&&!c.get(t).externalConnections,!e.parent(t),e.node(t),e.children("D")," Depth ",r),!c.has(t))i.debug("Not a cluster",t,r);else if(c.get(t)?.clusterData?.explicitDir&&e.children(t)&&e.children(t).length>0){i.warn("Cluster with explicit dir, creating subgraph for children",t,r);const o=c.get(t).clusterData.dir,l=new y({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,l,t);const f=e.node(t)||{};e.setNode(t,{...f,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:l}),i.warn("Subgraph for cluster with explicit dir created:",t,C(l))}else if(!c.get(t).externalConnections&&e.children(t)&&e.children(t).length>0){i.warn("Cluster without external connections, without a parent and with children",t,r);let l=e.graph().rankdir==="TB"?"LR":"TB";c.get(t)?.clusterData?.dir&&(l=c.get(t).clusterData.dir,i.warn("Fixing dir",c.get(t).clusterData.dir,l));const f=new y({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,f,t);const a=e.node(t)||{};e.setNode(t,{...a,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:f}),i.debug("Old graph after copy",C(e))}else i.warn("Cluster ** ",t," **not meeting the criteria !externalConnections:",!c.get(t).externalConnections," no parent: ",!e.parent(t)," children ",e.children(t)&&e.children(t).length>0,e.children("D"),r),i.debug(c);n=e.nodes(),i.warn("New list of nodes",n);for(const t of n){const o=e.node(t);i.warn(" Now next level",t,o),o?.clusterNode&&k(o.graph,r+1)}},"extractor"),B=u((e,r)=>{if(r.length===0)return[];let n=Object.assign([],r);return r.forEach(s=>{const t=e.children(s),o=B(e,t);n=[...n,...o]}),n},"sorter"),W=u(e=>B(e,e.children()),"sortNodesByHierarchy"),L=u((e,r,n)=>{let s=e.parent(r);for(;s&&s!==n;){const t=c.get(s);if(t&&!t.externalConnections)return!0;s=e.parent(s)}return!1},"isNodeInExtractableCluster"),T=u((e,r,n)=>{const s=e.children(r)??[];for(const t of s){if(t===n||v(t,n))continue;const o=D(t,e,r);if(o&&!L(e,o,r))return o}return null},"findSafeAnchorNode");export{U as a,c as b,J as c,D as f,W as s,C as w};
        +import{_ as u,l as i}from"./mermaid.core-CsZwh_jB.js";import{i as m,G as y}from"./graph-DOmOIIwC.js";import{b as _,m as X}from"./map-DxJ2ADlA.js";var j=4;function p(e){return _(e,j)}function C(e){var r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:F(e),edges:M(e)};return m(e.graph())||(r.value=p(e.graph())),r}function F(e){return X(e.nodes(),function(r){var n=e.node(r),s=e.parent(r),t={v:r};return m(n)||(t.value=n),m(s)||(t.parent=s),t})}function M(e){return X(e.edges(),function(r){var n=e.edge(r),s={v:r.v,w:r.w};return m(r.name)||(s.name=r.name),m(n)||(s.value=n),s})}var c=new Map,w=new Map,A=new Map,J=u(()=>{w.clear(),A.clear(),c.clear()},"clear"),v=u((e,r)=>{const n=w.get(r)||[];return i.trace("In isDescendant",r," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),R=u((e,r)=>{const n=w.get(r)||[];return i.info("Descendants of ",r," is ",n),i.info("Edge is ",e),e.v===r||e.w===r?!1:n?n.includes(e.v)||v(e.v,r)||v(e.w,r)||n.includes(e.w):(i.debug("Tilt, ",r,",not in descendants"),!1)},"edgeInCluster"),b=u((e,r,n,s)=>{i.warn("Copying children of ",e,"root",s,"data",r.node(e),s);const t=r.children(e)||[];e!==s&&t.push(e),i.warn("Copying (nodes) clusterId",e,"nodes",t),t.forEach(o=>{if(r.children(o).length>0)b(o,r,n,s);else{const l=r.node(o);i.info("cp ",o," to ",s," with parent ",e),n.setNode(o,l),s!==r.parent(o)&&(i.warn("Setting parent",o,r.parent(o)),n.setParent(o,r.parent(o))),e!==s&&o!==e?(i.debug("Setting parent",o,e),n.setParent(o,e)):(i.info("In copy ",e,"root",s,"data",r.node(e),s),i.debug("Not Setting parent for node=",o,"cluster!==rootId",e!==s,"node!==clusterId",o!==e));const f=r.edges(o);i.debug("Copying Edges",f),f.forEach(a=>{i.info("Edge",a);const d=r.edge(a.v,a.w,a.name);i.info("Edge data",d,s);try{if(R(a,s)){const g=w.get(s)||[],E=g.includes(a.v)||v(a.v,s)||a.v===s,x=g.includes(a.w)||v(a.w,s)||a.w===s;if(E&&x)i.info("Copying as ",a.v,a.w,d,a.name),n.setEdge(a.v,a.w,d,a.name),i.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]));else{const N=E?s:a.v,h=x?s:a.w;i.info("Rebinding cross-boundary edge as ",N,h,d,a.name),r.setEdge(N,h,d,a.name)}}else i.info("Skipping copy of edge ",a.v,"-->",a.w," rootId: ",s," clusterId:",e)}catch(g){i.error(g)}})}i.debug("Removing node",o),r.removeNode(o)})},"copy"),O=u((e,r)=>{const n=r.children(e);let s=[...n];for(const t of n)A.set(t,e),s=[...s,...O(t,r)];return s},"extractDescendants"),P=u((e,r,n)=>{const s=e.edges().filter(a=>a.v===r||a.w===r),t=e.edges().filter(a=>a.v===n||a.w===n),o=s.map(a=>({v:a.v===r?n:a.v,w:a.w===r?r:a.w})),l=t.map(a=>({v:a.v,w:a.w}));return o.filter(a=>l.some(d=>a.v===d.v&&a.w===d.w))},"findCommonEdges"),D=u((e,r,n)=>{const s=r.children(e);if(i.trace("Searching children of id ",e,s),s.length<1)return e;let t;for(const o of s){const l=D(o,r,n),f=P(r,n,l);if(l)if(f.length>0)t=l;else return l}return t},"findNonClusterChild"),S=u(e=>!c.has(e)||!c.get(e).externalConnections?e:c.has(e)?c.get(e).id:e,"getAnchorId"),U=u((e,r)=>{if(!e||r>10){i.debug("Opting out, no graph ");return}else i.debug("Opting in, graph ");e.nodes().forEach(function(n){e.children(n).length>0&&(i.warn("Cluster identified",n," Replacement id in edges: ",D(n,e,n)),w.set(n,O(n,e)),c.set(n,{id:D(n,e,n),clusterData:e.node(n)}))}),e.nodes().forEach(function(n){const s=e.children(n),t=e.edges();s.length>0?(i.debug("Cluster identified",n,w),t.forEach(o=>{const l=v(o.v,n),f=v(o.w,n);l^f&&(i.warn("Edge: ",o," leaves cluster ",n),i.warn("Descendants of XXX ",n,": ",w.get(n)),c.get(n).externalConnections=!0)})):i.debug("Not a cluster ",n,w)});for(let n of c.keys()){const s=c.get(n).id,t=e.parent(s);t!==n&&c.has(t)&&!c.get(t).externalConnections&&(c.get(n).id=t);const o=e.edges().some(l=>l.v===n);if(s&&c.get(n)?.externalConnections&&o&&L(e,s,n)){const l=T(e,n,e.parent(s));l&&(c.get(n).id=l)}}e.edges().forEach(function(n){const s=e.edge(n);i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(n)),i.warn("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(e.edge(n)));let t=n.v,o=n.w;if(i.warn("Fix XXX",c,"ids:",n.v,n.w,"Translating: ",c.get(n.v)," --- ",c.get(n.w)),c.get(n.v)||c.get(n.w)){if(i.warn("Fixing and trying - removing XXX",n.v,n.w,n.name),t=S(n.v),o=S(n.w),e.removeEdge(n.v,n.w,n.name),t!==n.v){const l=e.parent(t);c.get(l).externalConnections=!0,s.fromCluster=n.v}if(o!==n.w){const l=e.parent(o);c.get(l).externalConnections=!0,s.toCluster=n.w}i.warn("Fix Replacing with XXX",t,o,n.name),e.setEdge(t,o,s,n.name)}}),i.warn("Adjusted Graph",C(e)),k(e,0),i.trace(c)},"adjustClustersAndEdges"),k=u((e,r)=>{if(i.warn("extractor - ",r,C(e),e.children("D")),r>10){i.error("Bailing out");return}let n=e.nodes(),s=!1;for(const t of n){const o=e.children(t);s=s||o.length>0}if(!s){i.debug("Done, no node has children",e.nodes());return}i.debug("Nodes = ",n,r);for(const t of n)if(i.debug("Extracting node",t,c,c.has(t)&&!c.get(t).externalConnections,!e.parent(t),e.node(t),e.children("D")," Depth ",r),!c.has(t))i.debug("Not a cluster",t,r);else if(c.get(t)?.clusterData?.explicitDir&&e.children(t)&&e.children(t).length>0){i.warn("Cluster with explicit dir, creating subgraph for children",t,r);const o=c.get(t).clusterData.dir,l=new y({multigraph:!0,compound:!0}).setGraph({rankdir:o,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,l,t);const f=e.node(t)||{};e.setNode(t,{...f,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:l}),i.warn("Subgraph for cluster with explicit dir created:",t,C(l))}else if(!c.get(t).externalConnections&&e.children(t)&&e.children(t).length>0){i.warn("Cluster without external connections, without a parent and with children",t,r);let l=e.graph().rankdir==="TB"?"LR":"TB";c.get(t)?.clusterData?.dir&&(l=c.get(t).clusterData.dir,i.warn("Fixing dir",c.get(t).clusterData.dir,l));const f=new y({multigraph:!0,compound:!0}).setGraph({rankdir:l,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});b(t,e,f,t);const a=e.node(t)||{};e.setNode(t,{...a,clusterNode:!0,id:t,clusterData:c.get(t).clusterData,label:c.get(t).label,graph:f}),i.debug("Old graph after copy",C(e))}else i.warn("Cluster ** ",t," **not meeting the criteria !externalConnections:",!c.get(t).externalConnections," no parent: ",!e.parent(t)," children ",e.children(t)&&e.children(t).length>0,e.children("D"),r),i.debug(c);n=e.nodes(),i.warn("New list of nodes",n);for(const t of n){const o=e.node(t);i.warn(" Now next level",t,o),o?.clusterNode&&k(o.graph,r+1)}},"extractor"),B=u((e,r)=>{if(r.length===0)return[];let n=Object.assign([],r);return r.forEach(s=>{const t=e.children(s),o=B(e,t);n=[...n,...o]}),n},"sorter"),W=u(e=>B(e,e.children()),"sortNodesByHierarchy"),L=u((e,r,n)=>{let s=e.parent(r);for(;s&&s!==n;){const t=c.get(s);if(t&&!t.externalConnections)return!0;s=e.parent(s)}return!1},"isNodeInExtractableCluster"),T=u((e,r,n)=>{const s=e.children(r)??[];for(const t of s){if(t===n||v(t,n))continue;const o=D(t,e,r);if(o&&!L(e,o,r))return o}return null},"findSafeAnchorNode");export{U as a,c as b,J as c,D as f,W as s,C as w};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js b/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-bFBk02SY.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js
        rename to apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-bFBk02SY.js
        index 2943bac3ee9..1fa4ce28a4a 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-B4q9plWN.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-V7JOEXUC-bFBk02SY.js
        @@ -1,4 +1,4 @@
        -import{g as tt}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{g as st}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as it}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as f,l as Ie,c as F,v as at,x as nt,y as Oe,d as de,a5 as rt,b as ut,a as lt,s as ct,g as ot,o as ht,p as dt,k as I,q as pt,r as At,i as ft,a6 as G}from"./mermaid.core-CJB1tAev.js";import{f as gt}from"./chunk-32BRIVSS-DUDRPqmY.js";var we=(function(){var t=f(function(O,o,h,p){for(h=h||{},p=O.length;p--;h[O[p]]=o);return h},"o"),i=[1,18],a=[1,19],n=[1,20],r=[1,41],c=[1,26],u=[1,42],d=[1,24],m=[1,25],g=[1,32],N=[1,33],Ae=[1,34],b=[1,45],fe=[1,35],ge=[1,36],me=[1,37],Ce=[1,38],be=[1,27],ke=[1,28],Ee=[1,29],Te=[1,30],ye=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],De=[1,9],A=[1,8,9],Z=[1,58],$=[1,59],ee=[1,60],te=[1,61],se=[1,62],Fe=[1,63],Be=[1,64],_=[1,8,9,41],Pe=[1,77],M=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ie=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ae=[13,60,86,100,102,103],U=[13,60,73,74,86,100,102,103],Me=[13,60,68,69,70,71,72,86,100,102,103],ne=[1,103],z=[1,121],Y=[1,117],K=[1,113],W=[1,119],Q=[1,114],j=[1,115],X=[1,116],q=[1,118],H=[1,120],Re=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],re=[12,39],_e=[1,8,9,39,41,44,46],ue=[1,8,9,22],Ue=[1,153],ze=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Se={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:f(function(o,h,p,l,C,e,J){var s=e.length-1;switch(C){case 8:this.$=e[s-1];break;case 9:case 10:case 13:case 15:this.$=e[s];break;case 11:case 14:this.$=e[s-2]+"."+e[s];break;case 12:case 16:this.$=e[s-1]+e[s];break;case 17:case 18:this.$=e[s-1]+"~"+e[s]+"~";break;case 19:l.addRelation(e[s]);break;case 20:e[s-1].title=l.cleanupLabel(e[s]),l.addRelation(e[s-1]);break;case 31:this.$=e[s].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[s].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[s-3],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[s-4],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[s]);break;case 37:this.$=l.addNamespace(e[s-1],e[s]);break;case 38:this.$=[[e[s]],[]];break;case 39:this.$=[[e[s-1]],[]];break;case 40:e[s][0].unshift(e[s-2]),this.$=e[s];break;case 41:this.$=[[],[e[s]]];break;case 42:this.$=[[],[e[s-1]]];break;case 43:e[s][1].unshift(e[s-2]),this.$=e[s];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[s];break;case 48:l.setCssClass(e[s-2],e[s]);break;case 49:l.addMembers(e[s-3],e[s-1]);break;case 51:l.setCssClass(e[s-5],e[s-3]),l.addMembers(e[s-5],e[s-1]);break;case 52:l.addAnnotation(e[s-3],e[s-1]);break;case 53:l.addAnnotation(e[s-6],e[s-4]),l.addMembers(e[s-6],e[s-1]);break;case 54:l.addAnnotation(e[s-5],e[s-3]);break;case 55:this.$=e[s],l.addClass(e[s]);break;case 56:this.$=e[s-1],l.addClass(e[s-1]),l.setClassLabel(e[s-1],e[s]);break;case 60:l.addAnnotation(e[s],e[s-2]);break;case 61:case 74:this.$=[e[s]];break;case 62:e[s].push(e[s-1]),this.$=e[s];break;case 63:break;case 64:l.addMember(e[s-1],l.cleanupLabel(e[s]));break;case 65:break;case 66:break;case 67:this.$={id1:e[s-2],id2:e[s],relation:e[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[s-3],id2:e[s],relation:e[s-1],relationTitle1:e[s-2],relationTitle2:"none"};break;case 69:this.$={id1:e[s-3],id2:e[s],relation:e[s-2],relationTitle1:"none",relationTitle2:e[s-1]};break;case 70:this.$={id1:e[s-4],id2:e[s],relation:e[s-2],relationTitle1:e[s-3],relationTitle2:e[s-1]};break;case 71:this.$=l.addNote(e[s],e[s-1]);break;case 72:this.$=l.addNote(e[s]);break;case 73:this.$=e[s-2],l.defineClass(e[s-1],e[s]);break;case 75:this.$=e[s-2].concat([e[s]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[s-2],type2:e[s],lineType:e[s-1]};break;case 81:this.$={type1:"none",type2:e[s],lineType:e[s-1]};break;case 82:this.$={type1:e[s-1],type2:"none",lineType:e[s]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[s]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[s-2],l.setClickEvent(e[s-1],e[s]);break;case 92:case 98:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 93:this.$=e[s-2],l.setLink(e[s-1],e[s]);break;case 94:this.$=e[s-3],l.setLink(e[s-2],e[s-1],e[s]);break;case 95:this.$=e[s-3],l.setLink(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 96:this.$=e[s-4],l.setLink(e[s-3],e[s-2],e[s]),l.setTooltip(e[s-3],e[s-1]);break;case 99:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1],e[s]);break;case 100:this.$=e[s-4],l.setClickEvent(e[s-3],e[s-2],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 101:this.$=e[s-3],l.setLink(e[s-2],e[s]);break;case 102:this.$=e[s-4],l.setLink(e[s-3],e[s-1],e[s]);break;case 103:this.$=e[s-4],l.setLink(e[s-3],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 104:this.$=e[s-5],l.setLink(e[s-4],e[s-2],e[s]),l.setTooltip(e[s-4],e[s-1]);break;case 105:this.$=e[s-2],l.setCssStyle(e[s-1],e[s]);break;case 106:l.setCssClass(e[s-1],e[s]);break;case 107:this.$=[e[s]];break;case 108:e[s-2].push(e[s]),this.$=e[s-2];break;case 110:this.$=e[s-1]+e[s];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(De,[2,5],{8:[1,48]}),{8:[1,49]},t(A,[2,19],{22:[1,50]}),t(A,[2,21]),t(A,[2,22]),t(A,[2,23]),t(A,[2,24]),t(A,[2,25]),t(A,[2,26]),t(A,[2,27]),t(A,[2,28]),t(A,[2,29]),t(A,[2,30]),{34:[1,51]},{36:[1,52]},t(A,[2,33]),t(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be}),{39:[1,65]},t(_,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),t(A,[2,65]),t(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Pe,55:76},{58:78,60:[1,79]},t(A,[2,76]),t(A,[2,77]),t(A,[2,78]),t(A,[2,79]),t(M,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),t(M,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},t(ie,[2,133]),t(ie,[2,134]),t(ie,[2,135]),t(ie,[2,136]),t([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),t(De,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:n,42:r,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},t(A,[2,20]),t(A,[2,31]),t(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be},t(A,[2,64]),{67:93,73:Fe,74:Be},t(ae,[2,83],{66:94,68:Z,69:$,70:ee,71:te,72:se}),t(U,[2,84]),t(U,[2,85]),t(U,[2,86]),t(U,[2,87]),t(U,[2,88]),t(Me,[2,89]),t(Me,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:r,43:23,48:u,54:g,56:N},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:ne},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:z,50:Y,59:110,60:K,82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},{60:[1,122]},{13:Pe,55:123},t(_,[2,72]),t(_,[2,138]),{22:z,50:Y,59:124,60:K,61:[1,125],82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},t(Re,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},t(M,[2,16]),t(M,[2,17]),t(M,[2,18]),{11:127,12:Ge,39:[2,36]},t(re,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),t(re,[2,10]),t(_e,[2,55],{11:131,12:Ge}),t(De,[2,7]),{9:[1,132]},t(ue,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},t(ae,[2,82],{66:136,68:Z,69:$,70:ee,71:te,72:se}),t(ae,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:r,43:23,48:u,54:g,56:N},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},t(_,[2,48],{39:[1,142]}),{41:[1,143]},t(_,[2,50]),{41:[2,61],45:144,51:ne},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},t(A,[2,91],{13:[1,147]}),t(A,[2,93],{13:[1,149],77:[1,148]}),t(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},t(A,[2,105],{61:Ue}),t(ze,[2,107],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(x,[2,109]),t(x,[2,111]),t(x,[2,112]),t(x,[2,113]),t(x,[2,114]),t(x,[2,115]),t(x,[2,116]),t(x,[2,117]),t(x,[2,118]),t(x,[2,119]),t(A,[2,106]),t(_,[2,71]),t(A,[2,73],{61:Ue}),{60:[1,155]},t(M,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},t(re,[2,12]),t(_e,[2,56]),{1:[2,4]},t(ue,[2,69]),t(ue,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},t(ae,[2,80]),t(_,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:r,43:23,48:u,54:g,56:N},{45:163,51:ne},t(_,[2,49]),{41:[2,62]},t(_,[2,52],{39:[1,164]}),t(A,[2,60]),t(A,[2,92]),t(A,[2,94]),t(A,[2,95],{77:[1,165]}),t(A,[2,98]),t(A,[2,99],{13:[1,166]}),t(A,[2,101],{13:[1,168],77:[1,167]}),{22:z,50:Y,60:K,82:W,84:169,85:112,86:Q,87:j,88:X,89:q,90:H},t(x,[2,110]),t(Re,[2,75]),{14:[1,170]},t(re,[2,11]),t(ue,[2,70]),t(_,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:ne},t(A,[2,96]),t(A,[2,100]),t(A,[2,102]),t(A,[2,103],{77:[1,174]}),t(ze,[2,108],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(_e,[2,8]),t(_,[2,51]),{41:[1,175]},t(_,[2,54]),t(A,[2,104]),t(_,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:f(function(o,h){if(h.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=h,p}},"parseError"),parse:f(function(o){var h=this,p=[0],l=[],C=[null],e=[],J=this.table,s="",ce=0,Ye=0,Je=2,Ke=1,Ze=e.slice.call(arguments,1),D=Object.create(this.lexer),w={yy:{}};for(var Ne in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ne)&&(w.yy[Ne]=this.yy[Ne]);D.setInput(o,w.yy),w.yy.lexer=D,w.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Le=D.yylloc;e.push(Le);var $e=D.options&&D.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function et(S){p.length=p.length-2*S,C.length=C.length-S,e.length=e.length-S}f(et,"popStack");function We(){var S;return S=l.pop()||D.lex()||Ke,typeof S!="number"&&(S instanceof Array&&(l=S,S=l.pop()),S=h.symbols_[S]||S),S}f(We,"lex");for(var B,V,L,xe,R={},oe,v,Qe,he;;){if(V=p[p.length-1],this.defaultActions[V]?L=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=We()),L=J[V]&&J[V][B]),typeof L>"u"||!L.length||!L[0]){var ve="";he=[];for(oe in J[V])this.terminals_[oe]&&oe>Je&&he.push("'"+this.terminals_[oe]+"'");D.showPosition?ve="Parse error on line "+(ce+1)+`:
        +import{g as tt}from"./chunk-5VM5RSS4-CqIxm4fU.js";import{g as st}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as it}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as f,l as Ie,c as F,v as at,x as nt,y as Oe,d as de,a5 as rt,b as ut,a as lt,s as ct,g as ot,o as ht,p as dt,k as I,q as pt,r as At,i as ft,a6 as G}from"./mermaid.core-CsZwh_jB.js";import{f as gt}from"./chunk-32BRIVSS-DNJ_Bmzz.js";var we=(function(){var t=f(function(O,o,h,p){for(h=h||{},p=O.length;p--;h[O[p]]=o);return h},"o"),i=[1,18],a=[1,19],n=[1,20],r=[1,41],c=[1,26],u=[1,42],d=[1,24],m=[1,25],g=[1,32],N=[1,33],Ae=[1,34],b=[1,45],fe=[1,35],ge=[1,36],me=[1,37],Ce=[1,38],be=[1,27],ke=[1,28],Ee=[1,29],Te=[1,30],ye=[1,31],k=[1,44],E=[1,46],T=[1,43],y=[1,47],De=[1,9],A=[1,8,9],Z=[1,58],$=[1,59],ee=[1,60],te=[1,61],se=[1,62],Fe=[1,63],Be=[1,64],_=[1,8,9,41],Pe=[1,77],M=[1,8,9,12,13,22,39,41,44,46,68,69,70,71,72,73,74,79,81],ie=[1,8,9,12,13,18,20,22,39,41,44,46,47,60,68,69,70,71,72,73,74,79,81,86,100,102,103],ae=[13,60,86,100,102,103],U=[13,60,73,74,86,100,102,103],Me=[13,60,68,69,70,71,72,86,100,102,103],ne=[1,103],z=[1,121],Y=[1,117],K=[1,113],W=[1,119],Q=[1,114],j=[1,115],X=[1,116],q=[1,118],H=[1,120],Re=[22,50,60,61,82,86,87,88,89,90],Ge=[1,128],re=[12,39],_e=[1,8,9,39,41,44,46],ue=[1,8,9,22],Ue=[1,153],ze=[1,8,9,61],x=[1,8,9,22,50,60,61,82,86,87,88,89,90],Se={trace:f(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,statements:5,graphConfig:6,CLASS_DIAGRAM:7,NEWLINE:8,EOF:9,statement:10,classLabel:11,SQS:12,STR:13,SQE:14,namespaceName:15,alphaNumToken:16,classLiteralName:17,DOT:18,className:19,GENERICTYPE:20,relationStatement:21,LABEL:22,namespaceStatement:23,classStatement:24,memberStatement:25,annotationStatement:26,clickStatement:27,styleStatement:28,cssClassStatement:29,noteStatement:30,classDefStatement:31,direction:32,acc_title:33,acc_title_value:34,acc_descr:35,acc_descr_value:36,acc_descr_multiline_value:37,namespaceIdentifier:38,STRUCT_START:39,classStatements:40,STRUCT_STOP:41,NAMESPACE:42,classIdentifier:43,STYLE_SEPARATOR:44,members:45,ANNOTATION_START:46,ANNOTATION_END:47,CLASS:48,emptyBody:49,SPACE:50,MEMBER:51,SEPARATOR:52,relation:53,NOTE_FOR:54,noteText:55,NOTE:56,CLASSDEF:57,classList:58,stylesOpt:59,ALPHA:60,COMMA:61,direction_tb:62,direction_bt:63,direction_rl:64,direction_lr:65,relationType:66,lineType:67,AGGREGATION:68,EXTENSION:69,COMPOSITION:70,DEPENDENCY:71,LOLLIPOP:72,LINE:73,DOTTED_LINE:74,CALLBACK:75,LINK:76,LINK_TARGET:77,CLICK:78,CALLBACK_NAME:79,CALLBACK_ARGS:80,HREF:81,STYLE:82,CSSCLASS:83,style:84,styleComponent:85,NUM:86,COLON:87,UNIT:88,BRKT:89,PCT:90,commentToken:91,textToken:92,graphCodeTokens:93,textNoTagsToken:94,TAGSTART:95,TAGEND:96,"==":97,"--":98,DEFAULT:99,MINUS:100,keywords:101,UNICODE_TEXT:102,BQUOTE_STR:103,$accept:0,$end:1},terminals_:{2:"error",7:"CLASS_DIAGRAM",8:"NEWLINE",9:"EOF",12:"SQS",13:"STR",14:"SQE",18:"DOT",20:"GENERICTYPE",22:"LABEL",33:"acc_title",34:"acc_title_value",35:"acc_descr",36:"acc_descr_value",37:"acc_descr_multiline_value",39:"STRUCT_START",41:"STRUCT_STOP",42:"NAMESPACE",44:"STYLE_SEPARATOR",46:"ANNOTATION_START",47:"ANNOTATION_END",48:"CLASS",50:"SPACE",51:"MEMBER",52:"SEPARATOR",54:"NOTE_FOR",56:"NOTE",57:"CLASSDEF",60:"ALPHA",61:"COMMA",62:"direction_tb",63:"direction_bt",64:"direction_rl",65:"direction_lr",68:"AGGREGATION",69:"EXTENSION",70:"COMPOSITION",71:"DEPENDENCY",72:"LOLLIPOP",73:"LINE",74:"DOTTED_LINE",75:"CALLBACK",76:"LINK",77:"LINK_TARGET",78:"CLICK",79:"CALLBACK_NAME",80:"CALLBACK_ARGS",81:"HREF",82:"STYLE",83:"CSSCLASS",86:"NUM",87:"COLON",88:"UNIT",89:"BRKT",90:"PCT",93:"graphCodeTokens",95:"TAGSTART",96:"TAGEND",97:"==",98:"--",99:"DEFAULT",100:"MINUS",101:"keywords",102:"UNICODE_TEXT",103:"BQUOTE_STR"},productions_:[0,[3,1],[3,1],[4,1],[6,4],[5,1],[5,2],[5,3],[11,3],[15,1],[15,1],[15,3],[15,2],[19,1],[19,3],[19,1],[19,2],[19,2],[19,2],[10,1],[10,2],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,1],[10,2],[10,2],[10,1],[23,4],[23,5],[38,2],[38,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[40,1],[40,2],[40,3],[24,1],[24,3],[24,4],[24,3],[24,6],[24,4],[24,7],[24,6],[43,2],[43,3],[49,0],[49,2],[49,2],[26,4],[45,1],[45,2],[25,1],[25,2],[25,1],[25,1],[21,3],[21,4],[21,4],[21,5],[30,3],[30,2],[31,3],[58,1],[58,3],[32,1],[32,1],[32,1],[32,1],[53,3],[53,2],[53,2],[53,1],[66,1],[66,1],[66,1],[66,1],[66,1],[67,1],[67,1],[27,3],[27,4],[27,3],[27,4],[27,4],[27,5],[27,3],[27,4],[27,4],[27,5],[27,4],[27,5],[27,5],[27,6],[28,3],[29,3],[59,1],[59,3],[84,1],[84,2],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[85,1],[91,1],[91,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[92,1],[94,1],[94,1],[94,1],[94,1],[16,1],[16,1],[16,1],[16,1],[17,1],[55,1]],performAction:f(function(o,h,p,l,C,e,J){var s=e.length-1;switch(C){case 8:this.$=e[s-1];break;case 9:case 10:case 13:case 15:this.$=e[s];break;case 11:case 14:this.$=e[s-2]+"."+e[s];break;case 12:case 16:this.$=e[s-1]+e[s];break;case 17:case 18:this.$=e[s-1]+"~"+e[s]+"~";break;case 19:l.addRelation(e[s]);break;case 20:e[s-1].title=l.cleanupLabel(e[s]),l.addRelation(e[s-1]);break;case 31:this.$=e[s].trim(),l.setAccTitle(this.$);break;case 32:case 33:this.$=e[s].trim(),l.setAccDescription(this.$);break;case 34:l.addClassesToNamespace(e[s-3],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 35:l.addClassesToNamespace(e[s-4],e[s-1][0],e[s-1][1]),l.popNamespace();break;case 36:this.$=l.addNamespace(e[s]);break;case 37:this.$=l.addNamespace(e[s-1],e[s]);break;case 38:this.$=[[e[s]],[]];break;case 39:this.$=[[e[s-1]],[]];break;case 40:e[s][0].unshift(e[s-2]),this.$=e[s];break;case 41:this.$=[[],[e[s]]];break;case 42:this.$=[[],[e[s-1]]];break;case 43:e[s][1].unshift(e[s-2]),this.$=e[s];break;case 44:case 45:this.$=[[],[]];break;case 46:this.$=e[s];break;case 48:l.setCssClass(e[s-2],e[s]);break;case 49:l.addMembers(e[s-3],e[s-1]);break;case 51:l.setCssClass(e[s-5],e[s-3]),l.addMembers(e[s-5],e[s-1]);break;case 52:l.addAnnotation(e[s-3],e[s-1]);break;case 53:l.addAnnotation(e[s-6],e[s-4]),l.addMembers(e[s-6],e[s-1]);break;case 54:l.addAnnotation(e[s-5],e[s-3]);break;case 55:this.$=e[s],l.addClass(e[s]);break;case 56:this.$=e[s-1],l.addClass(e[s-1]),l.setClassLabel(e[s-1],e[s]);break;case 60:l.addAnnotation(e[s],e[s-2]);break;case 61:case 74:this.$=[e[s]];break;case 62:e[s].push(e[s-1]),this.$=e[s];break;case 63:break;case 64:l.addMember(e[s-1],l.cleanupLabel(e[s]));break;case 65:break;case 66:break;case 67:this.$={id1:e[s-2],id2:e[s],relation:e[s-1],relationTitle1:"none",relationTitle2:"none"};break;case 68:this.$={id1:e[s-3],id2:e[s],relation:e[s-1],relationTitle1:e[s-2],relationTitle2:"none"};break;case 69:this.$={id1:e[s-3],id2:e[s],relation:e[s-2],relationTitle1:"none",relationTitle2:e[s-1]};break;case 70:this.$={id1:e[s-4],id2:e[s],relation:e[s-2],relationTitle1:e[s-3],relationTitle2:e[s-1]};break;case 71:this.$=l.addNote(e[s],e[s-1]);break;case 72:this.$=l.addNote(e[s]);break;case 73:this.$=e[s-2],l.defineClass(e[s-1],e[s]);break;case 75:this.$=e[s-2].concat([e[s]]);break;case 76:l.setDirection("TB");break;case 77:l.setDirection("BT");break;case 78:l.setDirection("RL");break;case 79:l.setDirection("LR");break;case 80:this.$={type1:e[s-2],type2:e[s],lineType:e[s-1]};break;case 81:this.$={type1:"none",type2:e[s],lineType:e[s-1]};break;case 82:this.$={type1:e[s-1],type2:"none",lineType:e[s]};break;case 83:this.$={type1:"none",type2:"none",lineType:e[s]};break;case 84:this.$=l.relationType.AGGREGATION;break;case 85:this.$=l.relationType.EXTENSION;break;case 86:this.$=l.relationType.COMPOSITION;break;case 87:this.$=l.relationType.DEPENDENCY;break;case 88:this.$=l.relationType.LOLLIPOP;break;case 89:this.$=l.lineType.LINE;break;case 90:this.$=l.lineType.DOTTED_LINE;break;case 91:case 97:this.$=e[s-2],l.setClickEvent(e[s-1],e[s]);break;case 92:case 98:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 93:this.$=e[s-2],l.setLink(e[s-1],e[s]);break;case 94:this.$=e[s-3],l.setLink(e[s-2],e[s-1],e[s]);break;case 95:this.$=e[s-3],l.setLink(e[s-2],e[s-1]),l.setTooltip(e[s-2],e[s]);break;case 96:this.$=e[s-4],l.setLink(e[s-3],e[s-2],e[s]),l.setTooltip(e[s-3],e[s-1]);break;case 99:this.$=e[s-3],l.setClickEvent(e[s-2],e[s-1],e[s]);break;case 100:this.$=e[s-4],l.setClickEvent(e[s-3],e[s-2],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 101:this.$=e[s-3],l.setLink(e[s-2],e[s]);break;case 102:this.$=e[s-4],l.setLink(e[s-3],e[s-1],e[s]);break;case 103:this.$=e[s-4],l.setLink(e[s-3],e[s-1]),l.setTooltip(e[s-3],e[s]);break;case 104:this.$=e[s-5],l.setLink(e[s-4],e[s-2],e[s]),l.setTooltip(e[s-4],e[s-1]);break;case 105:this.$=e[s-2],l.setCssStyle(e[s-1],e[s]);break;case 106:l.setCssClass(e[s-1],e[s]);break;case 107:this.$=[e[s]];break;case 108:e[s-2].push(e[s]),this.$=e[s-2];break;case 110:this.$=e[s-1]+e[s];break}},"anonymous"),table:[{3:1,4:2,5:3,6:4,7:[1,6],10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,3]},t(De,[2,5],{8:[1,48]}),{8:[1,49]},t(A,[2,19],{22:[1,50]}),t(A,[2,21]),t(A,[2,22]),t(A,[2,23]),t(A,[2,24]),t(A,[2,25]),t(A,[2,26]),t(A,[2,27]),t(A,[2,28]),t(A,[2,29]),t(A,[2,30]),{34:[1,51]},{36:[1,52]},t(A,[2,33]),t(A,[2,63],{53:53,66:56,67:57,13:[1,54],22:[1,55],68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be}),{39:[1,65]},t(_,[2,47],{39:[1,67],44:[1,66],46:[1,68]}),t(A,[2,65]),t(A,[2,66]),{16:69,60:b,86:k,100:E,102:T},{16:39,17:40,19:70,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:71,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:72,60:b,86:k,100:E,102:T,103:y},{60:[1,73]},{13:[1,74]},{16:39,17:40,19:75,60:b,86:k,100:E,102:T,103:y},{13:Pe,55:76},{58:78,60:[1,79]},t(A,[2,76]),t(A,[2,77]),t(A,[2,78]),t(A,[2,79]),t(M,[2,13],{16:39,17:40,19:81,18:[1,80],20:[1,82],60:b,86:k,100:E,102:T,103:y}),t(M,[2,15],{20:[1,83]}),{15:84,16:85,17:86,60:b,86:k,100:E,102:T,103:y},{16:39,17:40,19:87,60:b,86:k,100:E,102:T,103:y},t(ie,[2,133]),t(ie,[2,134]),t(ie,[2,135]),t(ie,[2,136]),t([1,8,9,12,13,20,22,39,41,44,46,68,69,70,71,72,73,74,79,81],[2,137]),t(De,[2,6],{10:5,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,19:21,38:22,43:23,16:39,17:40,5:88,33:i,35:a,37:n,42:r,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y}),{5:89,10:5,16:39,17:40,19:21,21:7,23:8,24:9,25:10,26:11,27:12,28:13,29:14,30:15,31:16,32:17,33:i,35:a,37:n,38:22,42:r,43:23,46:c,48:u,51:d,52:m,54:g,56:N,57:Ae,60:b,62:fe,63:ge,64:me,65:Ce,75:be,76:ke,78:Ee,82:Te,83:ye,86:k,100:E,102:T,103:y},t(A,[2,20]),t(A,[2,31]),t(A,[2,32]),{13:[1,91],16:39,17:40,19:90,60:b,86:k,100:E,102:T,103:y},{53:92,66:56,67:57,68:Z,69:$,70:ee,71:te,72:se,73:Fe,74:Be},t(A,[2,64]),{67:93,73:Fe,74:Be},t(ae,[2,83],{66:94,68:Z,69:$,70:ee,71:te,72:se}),t(U,[2,84]),t(U,[2,85]),t(U,[2,86]),t(U,[2,87]),t(U,[2,88]),t(Me,[2,89]),t(Me,[2,90]),{8:[1,96],23:99,24:97,30:98,38:22,40:95,42:r,43:23,48:u,54:g,56:N},{16:100,60:b,86:k,100:E,102:T},{41:[1,102],45:101,51:ne},{16:104,60:b,86:k,100:E,102:T},{47:[1,105]},{13:[1,106]},{13:[1,107]},{79:[1,108],81:[1,109]},{22:z,50:Y,59:110,60:K,82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},{60:[1,122]},{13:Pe,55:123},t(_,[2,72]),t(_,[2,138]),{22:z,50:Y,59:124,60:K,61:[1,125],82:W,84:111,85:112,86:Q,87:j,88:X,89:q,90:H},t(Re,[2,74]),{16:39,17:40,19:126,60:b,86:k,100:E,102:T,103:y},t(M,[2,16]),t(M,[2,17]),t(M,[2,18]),{11:127,12:Ge,39:[2,36]},t(re,[2,9],{16:85,17:86,15:130,18:[1,129],60:b,86:k,100:E,102:T,103:y}),t(re,[2,10]),t(_e,[2,55],{11:131,12:Ge}),t(De,[2,7]),{9:[1,132]},t(ue,[2,67]),{16:39,17:40,19:133,60:b,86:k,100:E,102:T,103:y},{13:[1,135],16:39,17:40,19:134,60:b,86:k,100:E,102:T,103:y},t(ae,[2,82],{66:136,68:Z,69:$,70:ee,71:te,72:se}),t(ae,[2,81]),{41:[1,137]},{23:99,24:97,30:98,38:22,40:138,42:r,43:23,48:u,54:g,56:N},{8:[1,139],41:[2,38]},{8:[1,140],41:[2,41]},{8:[1,141],41:[2,44]},t(_,[2,48],{39:[1,142]}),{41:[1,143]},t(_,[2,50]),{41:[2,61],45:144,51:ne},{47:[1,145]},{16:39,17:40,19:146,60:b,86:k,100:E,102:T,103:y},t(A,[2,91],{13:[1,147]}),t(A,[2,93],{13:[1,149],77:[1,148]}),t(A,[2,97],{13:[1,150],80:[1,151]}),{13:[1,152]},t(A,[2,105],{61:Ue}),t(ze,[2,107],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(x,[2,109]),t(x,[2,111]),t(x,[2,112]),t(x,[2,113]),t(x,[2,114]),t(x,[2,115]),t(x,[2,116]),t(x,[2,117]),t(x,[2,118]),t(x,[2,119]),t(A,[2,106]),t(_,[2,71]),t(A,[2,73],{61:Ue}),{60:[1,155]},t(M,[2,14]),{39:[2,37]},{13:[1,156]},{15:157,16:85,17:86,60:b,86:k,100:E,102:T,103:y},t(re,[2,12]),t(_e,[2,56]),{1:[2,4]},t(ue,[2,69]),t(ue,[2,68]),{16:39,17:40,19:158,60:b,86:k,100:E,102:T,103:y},t(ae,[2,80]),t(_,[2,34]),{41:[1,159]},{23:99,24:97,30:98,38:22,40:160,41:[2,39],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:161,41:[2,42],42:r,43:23,48:u,54:g,56:N},{23:99,24:97,30:98,38:22,40:162,41:[2,45],42:r,43:23,48:u,54:g,56:N},{45:163,51:ne},t(_,[2,49]),{41:[2,62]},t(_,[2,52],{39:[1,164]}),t(A,[2,60]),t(A,[2,92]),t(A,[2,94]),t(A,[2,95],{77:[1,165]}),t(A,[2,98]),t(A,[2,99],{13:[1,166]}),t(A,[2,101],{13:[1,168],77:[1,167]}),{22:z,50:Y,60:K,82:W,84:169,85:112,86:Q,87:j,88:X,89:q,90:H},t(x,[2,110]),t(Re,[2,75]),{14:[1,170]},t(re,[2,11]),t(ue,[2,70]),t(_,[2,35]),{41:[2,40]},{41:[2,43]},{41:[2,46]},{41:[1,171]},{41:[1,173],45:172,51:ne},t(A,[2,96]),t(A,[2,100]),t(A,[2,102]),t(A,[2,103],{77:[1,174]}),t(ze,[2,108],{85:154,22:z,50:Y,60:K,82:W,86:Q,87:j,88:X,89:q,90:H}),t(_e,[2,8]),t(_,[2,51]),{41:[1,175]},t(_,[2,54]),t(A,[2,104]),t(_,[2,53])],defaultActions:{2:[2,1],3:[2,2],4:[2,3],127:[2,37],132:[2,4],144:[2,62],160:[2,40],161:[2,43],162:[2,46]},parseError:f(function(o,h){if(h.recoverable)this.trace(o);else{var p=new Error(o);throw p.hash=h,p}},"parseError"),parse:f(function(o){var h=this,p=[0],l=[],C=[null],e=[],J=this.table,s="",ce=0,Ye=0,Je=2,Ke=1,Ze=e.slice.call(arguments,1),D=Object.create(this.lexer),w={yy:{}};for(var Ne in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Ne)&&(w.yy[Ne]=this.yy[Ne]);D.setInput(o,w.yy),w.yy.lexer=D,w.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var Le=D.yylloc;e.push(Le);var $e=D.options&&D.options.ranges;typeof w.yy.parseError=="function"?this.parseError=w.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function et(S){p.length=p.length-2*S,C.length=C.length-S,e.length=e.length-S}f(et,"popStack");function We(){var S;return S=l.pop()||D.lex()||Ke,typeof S!="number"&&(S instanceof Array&&(l=S,S=l.pop()),S=h.symbols_[S]||S),S}f(We,"lex");for(var B,V,L,xe,R={},oe,v,Qe,he;;){if(V=p[p.length-1],this.defaultActions[V]?L=this.defaultActions[V]:((B===null||typeof B>"u")&&(B=We()),L=J[V]&&J[V][B]),typeof L>"u"||!L.length||!L[0]){var ve="";he=[];for(oe in J[V])this.terminals_[oe]&&oe>Je&&he.push("'"+this.terminals_[oe]+"'");D.showPosition?ve="Parse error on line "+(ce+1)+`:
         `+D.showPosition()+`
         Expecting `+he.join(", ")+", got '"+(this.terminals_[B]||B)+"'":ve="Parse error on line "+(ce+1)+": Unexpected "+(B==Ke?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(ve,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:Le,expected:he})}if(L[0]instanceof Array&&L.length>1)throw new Error("Parse Error: multiple actions possible at state: "+V+", token: "+B);switch(L[0]){case 1:p.push(B),C.push(D.yytext),e.push(D.yylloc),p.push(L[1]),B=null,Ye=D.yyleng,s=D.yytext,ce=D.yylineno,Le=D.yylloc;break;case 2:if(v=this.productions_[L[1]][1],R.$=C[C.length-v],R._$={first_line:e[e.length-(v||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(v||1)].first_column,last_column:e[e.length-1].last_column},$e&&(R._$.range=[e[e.length-(v||1)].range[0],e[e.length-1].range[1]]),xe=this.performAction.apply(R,[s,Ye,ce,w.yy,L[1],C,e].concat(Ze)),typeof xe<"u")return xe;v&&(p=p.slice(0,-1*v*2),C=C.slice(0,-1*v),e=e.slice(0,-1*v)),p.push(this.productions_[L[1]][0]),C.push(R.$),e.push(R._$),Qe=J[p[p.length-2]][p[p.length-1]],p.push(Qe);break;case 3:return!0}}return!0},"parse")},He=(function(){var O={EOF:1,parseError:f(function(h,p){if(this.yy.parser)this.yy.parser.parseError(h,p);else throw new Error(h)},"parseError"),setInput:f(function(o,h){return this.yy=h||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:f(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var h=o.match(/(?:\r\n?|\n).*/g);return h?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:f(function(o){var h=o.length,p=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-h),this.offset-=h;var l=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),p.length-1&&(this.yylineno-=p.length-1);var C=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:p?(p.length===l.length?this.yylloc.first_column:0)+l[l.length-p.length].length-p[0].length:this.yylloc.first_column-h},this.options.ranges&&(this.yylloc.range=[C[0],C[0]+this.yyleng-h]),this.yyleng=this.yytext.length,this},"unput"),more:f(function(){return this._more=!0,this},"more"),reject:f(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
         `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:f(function(o){this.unput(this.match.slice(o))},"less"),pastInput:f(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:f(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:f(function(){var o=this.pastInput(),h=new Array(o.length+1).join("-");return o+this.upcomingInput()+`
        diff --git a/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js b/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-Crv01XIW.js
        similarity index 87%
        rename from apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js
        rename to apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-Crv01XIW.js
        index 2d8f67ed12b..2b84ef06d38 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-CEH7JYJn.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-VR4S4FIN-Crv01XIW.js
        @@ -1 +1 @@
        -import{_ as a,e as w,l as x}from"./mermaid.core-CJB1tAev.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s};
        +import{_ as a,e as w,l as x}from"./mermaid.core-CsZwh_jB.js";var d=a((e,t,i,r)=>{e.attr("class",i);const{width:o,height:h,x:n,y:c}=u(e,t);w(e,h,o,r);const s=l(n,c,o,h,t);e.attr("viewBox",s),x.debug(`viewBox configured: ${s} with padding: ${t}`)},"setupViewPortForSVG"),u=a((e,t)=>{const i=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:i.width+t*2,height:i.height+t*2,x:i.x,y:i.y}},"calculateDimensionsWithPadding"),l=a((e,t,i,r,o)=>`${e-o} ${t-o} ${i} ${r}`,"createViewBox");export{d as s};
        diff --git a/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js b/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-B7Une-L7.js
        similarity index 72%
        rename from apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js
        rename to apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-B7Une-L7.js
        index 146d773226a..0b29f6dd4db 100644
        --- a/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-5rh7CWvm.js
        +++ b/apps/kimi-code/dist-web/assets/chunk-XXDRQBXY-B7Une-L7.js
        @@ -1 +1 @@
        -import{_ as a,d as o}from"./mermaid.core-CJB1tAev.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g};
        +import{_ as a,d as o}from"./mermaid.core-CsZwh_jB.js";var d=a((t,e)=>{let n;return e==="sandbox"&&(n=o("#i"+t)),(e==="sandbox"?o(n.nodes()[0].contentDocument.body):o("body")).select(`[id="${t}"]`)},"getDiagramElement");export{d as g};
        diff --git a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js
        deleted file mode 100644
        index 75377c626f9..00000000000
        --- a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-ClMG95L0.js
        +++ /dev/null
        @@ -1 +0,0 @@
        -import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B4q9plWN.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
        diff --git a/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-DM4TZiKk.js b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-DM4TZiKk.js
        new file mode 100644
        index 00000000000..efa1b1949fc
        --- /dev/null
        +++ b/apps/kimi-code/dist-web/assets/classDiagram-OUVF2IWQ-DM4TZiKk.js
        @@ -0,0 +1 @@
        +import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-bFBk02SY.js";import{_ as i}from"./mermaid.core-CsZwh_jB.js";import"./chunk-5VM5RSS4-CqIxm4fU.js";import"./chunk-XXDRQBXY-B7Une-L7.js";import"./chunk-VR4S4FIN-Crv01XIW.js";import"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
        diff --git a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js
        deleted file mode 100644
        index 75377c626f9..00000000000
        --- a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js
        +++ /dev/null
        @@ -1 +0,0 @@
        -import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-B4q9plWN.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
        diff --git a/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-DM4TZiKk.js b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-DM4TZiKk.js
        new file mode 100644
        index 00000000000..efa1b1949fc
        --- /dev/null
        +++ b/apps/kimi-code/dist-web/assets/classDiagram-v2-EOCWNBFH-DM4TZiKk.js
        @@ -0,0 +1 @@
        +import{s as a,c as s,a as e,C as t}from"./chunk-V7JOEXUC-bFBk02SY.js";import{_ as i}from"./mermaid.core-CsZwh_jB.js";import"./chunk-5VM5RSS4-CqIxm4fU.js";import"./chunk-XXDRQBXY-B7Une-L7.js";import"./chunk-VR4S4FIN-Crv01XIW.js";import"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var f={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{f as diagram};
        diff --git a/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js b/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-kIdO2NbL.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js
        rename to apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-kIdO2NbL.js
        index 7c650885bc9..2aa2e3e7bb2 100644
        --- a/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-TWQPJk-P.js
        +++ b/apps/kimi-code/dist-web/assets/cose-bilkent-JH36ORCC-kIdO2NbL.js
        @@ -1 +1 @@
        -import{_ as V,l as k,d as lt}from"./mermaid.core-CJB1tAev.js";import{c as tt}from"./cytoscape.esm-OyMbaexL.js";import{g as gt}from"./_commonjsHelpers-CqkleIqs.js";import"./index-D-7nOosq.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,L){G.exports=L()})(ut,function(){return(function(N){var I={};function L(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,L),e.l=!0,e.exports}return L.m=N,L.c=I,L.i=function(o){return o},L.d=function(o,e,t){L.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},L.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return L.d(e,"a",e),e},L.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},L.p="",L(L.s=26)})([(function(N,I,L){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,L){var o=L(2),e=L(8),t=L(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,L){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(13),i=L(0),l=L(16),g=L(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,L){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(0),i=L(6),l=L(3),g=L(1),n=L(13),d=L(12),r=L(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var T=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(T.source=v,T.target=D,T.isInterGraph=!1,this.getEdges().push(T),v.edges.push(T),D!=v&&D.edges.push(T),T)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,T=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,T,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?T=y[0].getParent().paddingLeft:T=this.margin,this.left=v-T,this.top=p-T,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,T=-e.MAX_VALUE,y,O,s,f,c,E=this.nodes,A=E.length,m=0;my&&(v=y),Ds&&(u=s),Ty&&(v=y),Ds&&(u=s),T=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,L){var o,e=L(1);function t(i){o=L(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=E,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=E,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=E,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+T*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-T*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=E,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,T=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,E=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,E=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*E-f*c)/A,T=(O*c-y*E)/A,new o(u,T))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,L){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,L){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,L){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),T.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}T=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(E,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,T=p[0])}return T},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,L){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,L){var o=L(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,L){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,a=0;ay||T>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||T>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,L){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(E){return f.has(E)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RE&&(E=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var E=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,E);var A=u.calculateBounds(s),m=new T;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(E-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],E=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,E=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,E,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var E=s.idToDummyNode[c],A=E.paddingLeft,m=E.paddingTop;s.adjustLocations(f[c],E.rect.x,E.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var E=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,E=0;EM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var A=f[E];c.tiledMemberPack[E]=c.tileNodes(s[E],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[E].width,A.rect.height=c.tiledMemberPack[E].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,E=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:E};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,E=0;Ec&&(f=E,c=s.rowWidth[E]);return f},y.prototype.canAddHorizontal=function(s,f,c){var E=this.getShortestRowIndex(s);if(E<0)return!0;var A=s.rowWidth[E];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[E]0&&(m=c+s.verticalPadding-s.rowHeight[E]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){E.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=E[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=T.getGraphManager().add(T.newGraph(),c),this.processChildrenList(R,f,T)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(L=>{["id","label","height","width","padding","x","y"].includes(L)||(I[L]=N[L])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(L=>{["id","start","end"].includes(L)||(I[L]=N[L])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const L={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(L).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),L={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(L[o]=N[o])}),L})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,L={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(L[o]=N[o])}),L})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),L=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${L.length} edges`),{nodes:I,edges:L}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:L,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const T={...u};n[u.id]=T,g[u.id]=T,await N(r,u)}else{const T={...u};g[u.id]=T;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();T.width=O.width,T.height=O.height,T.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const T=g[u.id];return{...u,width:T.width,height:T.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const T=g[u.id];T?.domId&&(T.domId.attr("transform",`translate(${u.x}, ${u.y})`),T.x=u.x,T.y=u.y,t.debug(`Positioned node ${T.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const T=G.edges.find(y=>y.id===u.id);T&&(T.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await L(a,u);const T=g[u.start??""],y=g[u.end??""];if(T&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:T.x||0,y:T.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render};
        +import{_ as V,l as k,d as lt}from"./mermaid.core-CsZwh_jB.js";import{c as tt}from"./cytoscape.esm-OyMbaexL.js";import{g as gt}from"./_commonjsHelpers-CqkleIqs.js";import"./index-Bxn5yOTB.js";var Z={exports:{}},$={exports:{}},Q={exports:{}},ut=Q.exports,j;function ft(){return j||(j=1,(function(G,b){(function(I,L){G.exports=L()})(ut,function(){return(function(N){var I={};function L(o){if(I[o])return I[o].exports;var e=I[o]={i:o,l:!1,exports:{}};return N[o].call(e.exports,e,e.exports,L),e.l=!0,e.exports}return L.m=N,L.c=I,L.i=function(o){return o},L.d=function(o,e,t){L.o(o,e)||Object.defineProperty(o,e,{configurable:!1,enumerable:!0,get:t})},L.n=function(o){var e=o&&o.__esModule?function(){return o.default}:function(){return o};return L.d(e,"a",e),e},L.o=function(o,e){return Object.prototype.hasOwnProperty.call(o,e)},L.p="",L(L.s=26)})([(function(N,I,L){function o(){}o.QUALITY=1,o.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,o.DEFAULT_INCREMENTAL=!1,o.DEFAULT_ANIMATION_ON_LAYOUT=!0,o.DEFAULT_ANIMATION_DURING_LAYOUT=!1,o.DEFAULT_ANIMATION_PERIOD=50,o.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,o.DEFAULT_GRAPH_MARGIN=15,o.NODE_DIMENSIONS_INCLUDE_LABELS=!1,o.SIMPLE_NODE_SIZE=40,o.SIMPLE_NODE_HALF_SIZE=o.SIMPLE_NODE_SIZE/2,o.EMPTY_COMPOUND_NODE_SIZE=40,o.MIN_EDGE_LENGTH=1,o.WORLD_BOUNDARY=1e6,o.INITIAL_WORLD_BOUNDARY=o.WORLD_BOUNDARY/1e3,o.WORLD_CENTER_X=1200,o.WORLD_CENTER_Y=900,N.exports=o}),(function(N,I,L){var o=L(2),e=L(8),t=L(9);function i(g,n,d){o.call(this,d),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=d,this.bendpoints=[],this.source=g,this.target=n}i.prototype=Object.create(o.prototype);for(var l in o)i[l]=o[l];i.prototype.getSource=function(){return this.source},i.prototype.getTarget=function(){return this.target},i.prototype.isInterGraph=function(){return this.isInterGraph},i.prototype.getLength=function(){return this.length},i.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},i.prototype.getBendpoints=function(){return this.bendpoints},i.prototype.getLca=function(){return this.lca},i.prototype.getSourceInLca=function(){return this.sourceInLca},i.prototype.getTargetInLca=function(){return this.targetInLca},i.prototype.getOtherEnd=function(g){if(this.source===g)return this.target;if(this.target===g)return this.source;throw"Node is not incident with this edge"},i.prototype.getOtherEndInGraph=function(g,n){for(var d=this.getOtherEnd(g),r=n.getGraphManager().getRoot();;){if(d.getOwner()==n)return d;if(d.getOwner()==r)break;d=d.getOwner().getParent()}return null},i.prototype.updateLength=function(){var g=new Array(4);this.isOverlapingSourceAndTarget=e.getIntersection(this.target.getRect(),this.source.getRect(),g),this.isOverlapingSourceAndTarget||(this.lengthX=g[0]-g[2],this.lengthY=g[1]-g[3],Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},i.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=t.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=t.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},N.exports=i}),(function(N,I,L){function o(e){this.vGraphObject=e}N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(13),i=L(0),l=L(16),g=L(4);function n(r,h,a,p){a==null&&p==null&&(p=h),o.call(this,p),r.graphManager!=null&&(r=r.graphManager),this.estimatedSize=e.MIN_VALUE,this.inclusionTreeDepth=e.MAX_VALUE,this.vGraphObject=p,this.edges=[],this.graphManager=r,a!=null&&h!=null?this.rect=new t(h.x,h.y,a.width,a.height):this.rect=new t}n.prototype=Object.create(o.prototype);for(var d in o)n[d]=o[d];n.prototype.getEdges=function(){return this.edges},n.prototype.getChild=function(){return this.child},n.prototype.getOwner=function(){return this.owner},n.prototype.getWidth=function(){return this.rect.width},n.prototype.setWidth=function(r){this.rect.width=r},n.prototype.getHeight=function(){return this.rect.height},n.prototype.setHeight=function(r){this.rect.height=r},n.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},n.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},n.prototype.getCenter=function(){return new g(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},n.prototype.getLocation=function(){return new g(this.rect.x,this.rect.y)},n.prototype.getRect=function(){return this.rect},n.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},n.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},n.prototype.setRect=function(r,h){this.rect.x=r.x,this.rect.y=r.y,this.rect.width=h.width,this.rect.height=h.height},n.prototype.setCenter=function(r,h){this.rect.x=r-this.rect.width/2,this.rect.y=h-this.rect.height/2},n.prototype.setLocation=function(r,h){this.rect.x=r,this.rect.y=h},n.prototype.moveBy=function(r,h){this.rect.x+=r,this.rect.y+=h},n.prototype.getEdgeListToNode=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(p.target==r){if(p.source!=a)throw"Incorrect edge source!";h.push(p)}}),h},n.prototype.getEdgesBetween=function(r){var h=[],a=this;return a.edges.forEach(function(p){if(!(p.source==a||p.target==a))throw"Incorrect edge source and/or target";(p.target==r||p.source==r)&&h.push(p)}),h},n.prototype.getNeighborsList=function(){var r=new Set,h=this;return h.edges.forEach(function(a){if(a.source==h)r.add(a.target);else{if(a.target!=h)throw"Incorrect incidency!";r.add(a.source)}}),r},n.prototype.withChildren=function(){var r=new Set,h,a;if(r.add(this),this.child!=null)for(var p=this.child.getNodes(),v=0;vh&&(this.rect.x-=(this.labelWidth-h)/2,this.setWidth(this.labelWidth)),this.labelHeight>a&&(this.labelPos=="center"?this.rect.y-=(this.labelHeight-a)/2:this.labelPos=="top"&&(this.rect.y-=this.labelHeight-a),this.setHeight(this.labelHeight))}}},n.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==e.MAX_VALUE)throw"assert failed";return this.inclusionTreeDepth},n.prototype.transform=function(r){var h=this.rect.x;h>i.WORLD_BOUNDARY?h=i.WORLD_BOUNDARY:h<-i.WORLD_BOUNDARY&&(h=-i.WORLD_BOUNDARY);var a=this.rect.y;a>i.WORLD_BOUNDARY?a=i.WORLD_BOUNDARY:a<-i.WORLD_BOUNDARY&&(a=-i.WORLD_BOUNDARY);var p=new g(h,a),v=r.inverseTransformPoint(p);this.setLocation(v.x,v.y)},n.prototype.getLeft=function(){return this.rect.x},n.prototype.getRight=function(){return this.rect.x+this.rect.width},n.prototype.getTop=function(){return this.rect.y},n.prototype.getBottom=function(){return this.rect.y+this.rect.height},n.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},N.exports=n}),(function(N,I,L){function o(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}o.prototype.getX=function(){return this.x},o.prototype.getY=function(){return this.y},o.prototype.setX=function(e){this.x=e},o.prototype.setY=function(e){this.y=e},o.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},o.prototype.getCopy=function(){return new o(this.x,this.y)},o.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},N.exports=o}),(function(N,I,L){var o=L(2),e=L(10),t=L(0),i=L(6),l=L(3),g=L(1),n=L(13),d=L(12),r=L(11);function h(p,v,D){o.call(this,D),this.estimatedSize=e.MIN_VALUE,this.margin=t.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=p,v!=null&&v instanceof i?this.graphManager=v:v!=null&&v instanceof Layout&&(this.graphManager=v.graphManager)}h.prototype=Object.create(o.prototype);for(var a in o)h[a]=o[a];h.prototype.getNodes=function(){return this.nodes},h.prototype.getEdges=function(){return this.edges},h.prototype.getGraphManager=function(){return this.graphManager},h.prototype.getParent=function(){return this.parent},h.prototype.getLeft=function(){return this.left},h.prototype.getRight=function(){return this.right},h.prototype.getTop=function(){return this.top},h.prototype.getBottom=function(){return this.bottom},h.prototype.isConnected=function(){return this.isConnected},h.prototype.add=function(p,v,D){if(v==null&&D==null){var u=p;if(this.graphManager==null)throw"Graph has no graph mgr!";if(this.getNodes().indexOf(u)>-1)throw"Node already in graph!";return u.owner=this,this.getNodes().push(u),u}else{var T=p;if(!(this.getNodes().indexOf(v)>-1&&this.getNodes().indexOf(D)>-1))throw"Source or target not in graph!";if(!(v.owner==D.owner&&v.owner==this))throw"Both owners must be this graph!";return v.owner!=D.owner?null:(T.source=v,T.target=D,T.isInterGraph=!1,this.getEdges().push(T),v.edges.push(T),D!=v&&D.edges.push(T),T)}},h.prototype.remove=function(p){var v=p;if(p instanceof l){if(v==null)throw"Node is null!";if(!(v.owner!=null&&v.owner==this))throw"Owner graph is invalid!";if(this.graphManager==null)throw"Owner graph manager is invalid!";for(var D=v.edges.slice(),u,T=D.length,y=0;y-1&&f>-1))throw"Source and/or target doesn't know this edge!";u.source.edges.splice(s,1),u.target!=u.source&&u.target.edges.splice(f,1);var O=u.source.owner.getEdges().indexOf(u);if(O==-1)throw"Not in owner's edge list!";u.source.owner.getEdges().splice(O,1)}},h.prototype.updateLeftTop=function(){for(var p=e.MAX_VALUE,v=e.MAX_VALUE,D,u,T,y=this.getNodes(),O=y.length,s=0;sD&&(p=D),v>u&&(v=u)}return p==e.MAX_VALUE?null:(y[0].getParent().paddingLeft!=null?T=y[0].getParent().paddingLeft:T=this.margin,this.left=v-T,this.top=p-T,new d(this.left,this.top))},h.prototype.updateBounds=function(p){for(var v=e.MAX_VALUE,D=-e.MAX_VALUE,u=e.MAX_VALUE,T=-e.MAX_VALUE,y,O,s,f,c,E=this.nodes,A=E.length,m=0;my&&(v=y),Ds&&(u=s),Ty&&(v=y),Ds&&(u=s),T=this.nodes.length){var A=0;D.forEach(function(m){m.owner==p&&A++}),A==this.nodes.length&&(this.isConnected=!0)}},N.exports=h}),(function(N,I,L){var o,e=L(1);function t(i){o=L(5),this.layout=i,this.graphs=[],this.edges=[]}t.prototype.addRoot=function(){var i=this.layout.newGraph(),l=this.layout.newNode(null),g=this.add(i,l);return this.setRootGraph(g),this.rootGraph},t.prototype.add=function(i,l,g,n,d){if(g==null&&n==null&&d==null){if(i==null)throw"Graph is null!";if(l==null)throw"Parent node is null!";if(this.graphs.indexOf(i)>-1)throw"Graph already in this graph mgr!";if(this.graphs.push(i),i.parent!=null)throw"Already has a parent!";if(l.child!=null)throw"Already has a child!";return i.parent=l,l.child=i,i}else{d=g,n=l,g=i;var r=n.getOwner(),h=d.getOwner();if(!(r!=null&&r.getGraphManager()==this))throw"Source not in this graph mgr!";if(!(h!=null&&h.getGraphManager()==this))throw"Target not in this graph mgr!";if(r==h)return g.isInterGraph=!1,r.add(g,n,d);if(g.isInterGraph=!0,g.source=n,g.target=d,this.edges.indexOf(g)>-1)throw"Edge already in inter-graph edge list!";if(this.edges.push(g),!(g.source!=null&&g.target!=null))throw"Edge source and/or target is null!";if(!(g.source.edges.indexOf(g)==-1&&g.target.edges.indexOf(g)==-1))throw"Edge already in source and/or target incidency list!";return g.source.edges.push(g),g.target.edges.push(g),g}},t.prototype.remove=function(i){if(i instanceof o){var l=i;if(l.getGraphManager()!=this)throw"Graph not in this graph mgr";if(!(l==this.rootGraph||l.parent!=null&&l.parent.graphManager==this))throw"Invalid parent node!";var g=[];g=g.concat(l.getEdges());for(var n,d=g.length,r=0;r=i.getRight()?l[0]+=Math.min(i.getX()-t.getX(),t.getRight()-i.getRight()):i.getX()<=t.getX()&&i.getRight()>=t.getRight()&&(l[0]+=Math.min(t.getX()-i.getX(),i.getRight()-t.getRight())),t.getY()<=i.getY()&&t.getBottom()>=i.getBottom()?l[1]+=Math.min(i.getY()-t.getY(),t.getBottom()-i.getBottom()):i.getY()<=t.getY()&&i.getBottom()>=t.getBottom()&&(l[1]+=Math.min(t.getY()-i.getY(),i.getBottom()-t.getBottom()));var d=Math.abs((i.getCenterY()-t.getCenterY())/(i.getCenterX()-t.getCenterX()));i.getCenterY()===t.getCenterY()&&i.getCenterX()===t.getCenterX()&&(d=1);var r=d*l[0],h=l[1]/d;l[0]r)return l[0]=g,l[1]=a,l[2]=d,l[3]=E,!1;if(nd)return l[0]=h,l[1]=n,l[2]=f,l[3]=r,!1;if(gd?(l[0]=v,l[1]=D,R=!0):(l[0]=p,l[1]=a,R=!0):S===w&&(g>d?(l[0]=h,l[1]=a,R=!0):(l[0]=u,l[1]=D,R=!0)),-Y===w?d>g?(l[2]=c,l[3]=E,M=!0):(l[2]=f,l[3]=s,M=!0):Y===w&&(d>g?(l[2]=O,l[3]=s,M=!0):(l[2]=A,l[3]=E,M=!0)),R&&M)return!1;if(g>d?n>r?(x=this.getCardinalDirection(S,w,4),F=this.getCardinalDirection(Y,w,2)):(x=this.getCardinalDirection(-S,w,3),F=this.getCardinalDirection(-Y,w,1)):n>r?(x=this.getCardinalDirection(-S,w,1),F=this.getCardinalDirection(-Y,w,3)):(x=this.getCardinalDirection(S,w,2),F=this.getCardinalDirection(Y,w,4)),!R)switch(x){case 1:P=a,U=g+-y/w,l[0]=U,l[1]=P;break;case 2:U=u,P=n+T*w,l[0]=U,l[1]=P;break;case 3:P=D,U=g+y/w,l[0]=U,l[1]=P;break;case 4:U=v,P=n+-T*w,l[0]=U,l[1]=P;break}if(!M)switch(F){case 1:X=s,_=d+-C/w,l[2]=_,l[3]=X;break;case 2:_=A,X=r+m*w,l[2]=_,l[3]=X;break;case 3:X=E,_=d+C/w,l[2]=_,l[3]=X;break;case 4:_=c,X=r+-m*w,l[2]=_,l[3]=X;break}}return!1},e.getCardinalDirection=function(t,i,l){return t>i?l:1+l%4},e.getIntersection=function(t,i,l,g){if(g==null)return this.getIntersection2(t,i,l);var n=t.x,d=t.y,r=i.x,h=i.y,a=l.x,p=l.y,v=g.x,D=g.y,u=void 0,T=void 0,y=void 0,O=void 0,s=void 0,f=void 0,c=void 0,E=void 0,A=void 0;return y=h-d,s=n-r,c=r*d-n*h,O=D-p,f=a-v,E=v*p-a*D,A=y*f-O*s,A===0?null:(u=(s*E-f*c)/A,T=(O*c-y*E)/A,new o(u,T))},e.angleOfVector=function(t,i,l,g){var n=void 0;return t!==l?(n=Math.atan((g-i)/(l-t)),l0?1:e<0?-1:0},o.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},o.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},N.exports=o}),(function(N,I,L){function o(){}o.MAX_VALUE=2147483647,o.MIN_VALUE=-2147483648,N.exports=o}),(function(N,I,L){var o=(function(){function n(d,r){for(var h=0;h"u"?"undefined":o(t);return t==null||i!="object"&&i!="function"},N.exports=e}),(function(N,I,L){function o(a){if(Array.isArray(a)){for(var p=0,v=Array(a.length);p0&&p;){for(y.push(s[0]);y.length>0&&p;){var f=y[0];y.splice(0,1),T.add(f);for(var c=f.getEdges(),u=0;u-1&&s.splice(C,1)}T=new Set,O=new Map}}return a},h.prototype.createDummyNodesForBendpoints=function(a){for(var p=[],v=a.source,D=this.graphManager.calcLowestCommonAncestor(a.source,a.target),u=0;u0){for(var D=this.edgeToDummyNodes.get(v),u=0;u=0&&p.splice(E,1);var A=O.getNeighborsList();A.forEach(function(R){if(v.indexOf(R)<0){var M=D.get(R),S=M-1;S==1&&f.push(R),D.set(R,S)}})}v=v.concat(f),(p.length==1||p.length==2)&&(u=!0,T=p[0])}return T},h.prototype.setGraphManager=function(a){this.graphManager=a},N.exports=h}),(function(N,I,L){function o(){}o.seed=1,o.x=0,o.nextDouble=function(){return o.x=Math.sin(o.seed++)*1e4,o.x-Math.floor(o.x)},N.exports=o}),(function(N,I,L){var o=L(4);function e(t,i){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}e.prototype.getWorldOrgX=function(){return this.lworldOrgX},e.prototype.setWorldOrgX=function(t){this.lworldOrgX=t},e.prototype.getWorldOrgY=function(){return this.lworldOrgY},e.prototype.setWorldOrgY=function(t){this.lworldOrgY=t},e.prototype.getWorldExtX=function(){return this.lworldExtX},e.prototype.setWorldExtX=function(t){this.lworldExtX=t},e.prototype.getWorldExtY=function(){return this.lworldExtY},e.prototype.setWorldExtY=function(t){this.lworldExtY=t},e.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},e.prototype.setDeviceOrgX=function(t){this.ldeviceOrgX=t},e.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},e.prototype.setDeviceOrgY=function(t){this.ldeviceOrgY=t},e.prototype.getDeviceExtX=function(){return this.ldeviceExtX},e.prototype.setDeviceExtX=function(t){this.ldeviceExtX=t},e.prototype.getDeviceExtY=function(){return this.ldeviceExtY},e.prototype.setDeviceExtY=function(t){this.ldeviceExtY=t},e.prototype.transformX=function(t){var i=0,l=this.lworldExtX;return l!=0&&(i=this.ldeviceOrgX+(t-this.lworldOrgX)*this.ldeviceExtX/l),i},e.prototype.transformY=function(t){var i=0,l=this.lworldExtY;return l!=0&&(i=this.ldeviceOrgY+(t-this.lworldOrgY)*this.ldeviceExtY/l),i},e.prototype.inverseTransformX=function(t){var i=0,l=this.ldeviceExtX;return l!=0&&(i=this.lworldOrgX+(t-this.ldeviceOrgX)*this.lworldExtX/l),i},e.prototype.inverseTransformY=function(t){var i=0,l=this.ldeviceExtY;return l!=0&&(i=this.lworldOrgY+(t-this.ldeviceOrgY)*this.lworldExtY/l),i},e.prototype.inverseTransformPoint=function(t){var i=new o(this.inverseTransformX(t.x),this.inverseTransformY(t.y));return i},N.exports=e}),(function(N,I,L){function o(r){if(Array.isArray(r)){for(var h=0,a=Array(r.length);ht.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*t.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-t.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT_INCREMENTAL):(r>t.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(t.COOLING_ADAPTATION_FACTOR,1-(r-t.ADAPTATION_LOWER_NODE_LIMIT)/(t.ADAPTATION_UPPER_NODE_LIMIT-t.ADAPTATION_LOWER_NODE_LIMIT)*(1-t.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=t.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},n.prototype.calcSpringForces=function(){for(var r=this.getAllEdges(),h,a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a,p,v,D,u=this.getAllNodes(),T;if(this.useFRGridVariant)for(this.totalIterations%t.GRID_CALCULATION_CHECK_PERIOD==1&&r&&this.updateGrid(),T=new Set,a=0;ay||T>y)&&(r.gravitationForceX=-this.gravityConstant*v,r.gravitationForceY=-this.gravityConstant*D)):(y=h.getEstimatedSize()*this.compoundGravityRangeFactor,(u>y||T>y)&&(r.gravitationForceX=-this.gravityConstant*v*this.compoundGravityConstant,r.gravitationForceY=-this.gravityConstant*D*this.compoundGravityConstant))},n.prototype.isConverged=function(){var r,h=!1;return this.totalIterations>this.maxIterations/3&&(h=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),r=this.totalDisplacement=u.length||y>=u[0].length)){for(var O=0;On}}]),l})();N.exports=i}),(function(N,I,L){var o=(function(){function i(l,g){for(var n=0;n2&&arguments[2]!==void 0?arguments[2]:1,d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,r=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;e(this,i),this.sequence1=l,this.sequence2=g,this.match_score=n,this.mismatch_penalty=d,this.gap_penalty=r,this.iMax=l.length+1,this.jMax=g.length+1,this.grid=new Array(this.iMax);for(var h=0;h=0;l--){var g=this.listeners[l];g.event===t&&g.callback===i&&this.listeners.splice(l,1)}},e.emit=function(t,i){for(var l=0;lg.coolingFactor*g.maxNodeDisplacement&&(this.displacementX=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementX)),Math.abs(this.displacementY)>g.coolingFactor*g.maxNodeDisplacement&&(this.displacementY=g.coolingFactor*g.maxNodeDisplacement*t.sign(this.displacementY)),this.child==null?this.moveBy(this.displacementX,this.displacementY):this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),g.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},i.prototype.propogateDisplacementToChildren=function(g,n){for(var d=this.getChild().getNodes(),r,h=0;h0)this.positionNodesRadially(s);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var f=new Set(this.getAllNodes()),c=this.nodesWithGravity.filter(function(E){return f.has(E)});this.graphManager.setAllNodesToApplyGravitation(c),this.positionNodesRandomly()}}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},y.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%d.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-Math.pow(this.coolingCycle,Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var s=new Set(this.getAllNodes()),f=this.nodesWithGravity.filter(function(A){return s.has(A)});this.graphManager.setAllNodesToApplyGravitation(f),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=d.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var c=!this.isTreeGrowing&&!this.isGrowthFinished,E=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(c,E),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},y.prototype.getPositionsData=function(){for(var s=this.graphManager.getAllNodes(),f={},c=0;c1){var R;for(R=0;RE&&(E=Math.floor(C.y)),m=Math.floor(C.x+n.DEFAULT_COMPONENT_SEPERATION)}this.transform(new a(r.WORLD_CENTER_X-C.x/2,r.WORLD_CENTER_Y-C.y/2))},y.radialLayout=function(s,f,c){var E=Math.max(this.maxDiagonalInTree(s),n.DEFAULT_RADIAL_SEPARATION);y.branchRadialLayout(f,null,0,359,0,E);var A=u.calculateBounds(s),m=new T;m.setDeviceOrgX(A.getMinX()),m.setDeviceOrgY(A.getMinY()),m.setWorldOrgX(c.x),m.setWorldOrgY(c.y);for(var C=0;C1;){var X=_[0];_.splice(0,1);var H=w.indexOf(X);H>=0&&w.splice(H,1),U--,x--}f!=null?P=(w.indexOf(_[0])+1)%U:P=0;for(var W=Math.abs(E-c)/x,B=P;F!=x;B=++B%U){var K=w[B].getOtherEnd(s);if(K!=f){var q=(c+F*W)%360,ht=(q+W)%360;y.branchRadialLayout(K,s,q,ht,A+m,m),F++}}},y.maxDiagonalInTree=function(s){for(var f=v.MIN_VALUE,c=0;cf&&(f=A)}return f},y.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},y.prototype.groupZeroDegreeMembers=function(){var s=this,f={};this.memberGroups={},this.idToDummyNode={};for(var c=[],E=this.graphManager.getAllNodes(),A=0;A"u"&&(f[R]=[]),f[R]=f[R].concat(m)}Object.keys(f).forEach(function(M){if(f[M].length>1){var S="DummyCompound_"+M;s.memberGroups[S]=f[M];var Y=f[M][0].getParent(),w=new l(s.graphManager);w.id=S,w.paddingLeft=Y.paddingLeft||0,w.paddingRight=Y.paddingRight||0,w.paddingBottom=Y.paddingBottom||0,w.paddingTop=Y.paddingTop||0,s.idToDummyNode[S]=w;var x=s.getGraphManager().add(s.newGraph(),w),F=Y.getChild();F.add(w);for(var U=0;U=0;s--){var f=this.compoundOrder[s],c=f.id,E=f.paddingLeft,A=f.paddingTop;this.adjustLocations(this.tiledMemberPack[c],f.rect.x,f.rect.y,E,A)}},y.prototype.repopulateZeroDegreeMembers=function(){var s=this,f=this.tiledZeroDegreePack;Object.keys(f).forEach(function(c){var E=s.idToDummyNode[c],A=E.paddingLeft,m=E.paddingTop;s.adjustLocations(f[c],E.rect.x,E.rect.y,A,m)})},y.prototype.getToBeTiled=function(s){var f=s.id;if(this.toBeTiled[f]!=null)return this.toBeTiled[f];var c=s.getChild();if(c==null)return this.toBeTiled[f]=!1,!1;for(var E=c.getNodes(),A=0;A0)return this.toBeTiled[f]=!1,!1;if(m.getChild()==null){this.toBeTiled[m.id]=!1;continue}if(!this.getToBeTiled(m))return this.toBeTiled[f]=!1,!1}return this.toBeTiled[f]=!0,!0},y.prototype.getNodeDegree=function(s){s.id;for(var f=s.getEdges(),c=0,E=0;EM&&(M=Y.rect.height)}c+=M+s.verticalPadding}},y.prototype.tileCompoundMembers=function(s,f){var c=this;this.tiledMemberPack=[],Object.keys(s).forEach(function(E){var A=f[E];c.tiledMemberPack[E]=c.tileNodes(s[E],A.paddingLeft+A.paddingRight),A.rect.width=c.tiledMemberPack[E].width,A.rect.height=c.tiledMemberPack[E].height})},y.prototype.tileNodes=function(s,f){var c=n.TILING_PADDING_VERTICAL,E=n.TILING_PADDING_HORIZONTAL,A={rows:[],rowWidth:[],rowHeight:[],width:0,height:f,verticalPadding:c,horizontalPadding:E};s.sort(function(R,M){return R.rect.width*R.rect.height>M.rect.width*M.rect.height?-1:R.rect.width*R.rect.height0&&(C+=s.horizontalPadding),s.rowWidth[c]=C,s.width0&&(R+=s.verticalPadding);var M=0;R>s.rowHeight[c]&&(M=s.rowHeight[c],s.rowHeight[c]=R,M=s.rowHeight[c]-M),s.height+=M,s.rows[c].push(f)},y.prototype.getShortestRowIndex=function(s){for(var f=-1,c=Number.MAX_VALUE,E=0;Ec&&(f=E,c=s.rowWidth[E]);return f},y.prototype.canAddHorizontal=function(s,f,c){var E=this.getShortestRowIndex(s);if(E<0)return!0;var A=s.rowWidth[E];if(A+s.horizontalPadding+f<=s.width)return!0;var m=0;s.rowHeight[E]0&&(m=c+s.verticalPadding-s.rowHeight[E]);var C;s.width-A>=f+s.horizontalPadding?C=(s.height+m)/(A+f+s.horizontalPadding):C=(s.height+m)/s.width,m=c+s.verticalPadding;var R;return s.widthm&&f!=c){E.splice(-1,1),s.rows[c].push(A),s.rowWidth[f]=s.rowWidth[f]-m,s.rowWidth[c]=s.rowWidth[c]+m,s.width=s.rowWidth[instance.getLongestRowIndex(s)];for(var C=Number.MIN_VALUE,R=0;RC&&(C=E[R].height);f>0&&(C+=s.verticalPadding);var M=s.rowHeight[f]+s.rowHeight[c];s.rowHeight[f]=C,s.rowHeight[c]0)for(var F=A;F<=m;F++)x[0]+=this.grid[F][C-1].length+this.grid[F][C].length-1;if(m0)for(var F=C;F<=R;F++)x[3]+=this.grid[A-1][F].length+this.grid[A][F].length-1;for(var U=v.MAX_VALUE,P,_,X=0;X0){var R;R=T.getGraphManager().add(T.newGraph(),c),this.processChildrenList(R,f,T)}}},a.prototype.stop=function(){return this.stopped=!0,this};var v=function(u){u("layout","cose-bilkent",a)};typeof cytoscape<"u"&&v(cytoscape),I.exports=v})])})})(Z)),Z.exports}var yt=vt();const Et=gt(yt);tt.use(Et);function et(G,b){G.forEach(N=>{const I={id:N.id,labelText:N.label,height:N.height,width:N.width,padding:N.padding??0};Object.keys(N).forEach(L=>{["id","label","height","width","padding","x","y"].includes(L)||(I[L]=N[L])}),b.add({group:"nodes",data:I,position:{x:N.x??0,y:N.y??0}})})}V(et,"addNodes");function rt(G,b){G.forEach(N=>{const I={id:N.id,source:N.start,target:N.end};Object.keys(N).forEach(L=>{["id","start","end"].includes(L)||(I[L]=N[L])}),b.add({group:"edges",data:I})})}V(rt,"addEdges");function it(G){return new Promise(b=>{const N=lt("body").append("div").attr("id","cy").attr("style","display:none"),I=tt({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"bezier"}}]});N.remove(),et(G.nodes,I),rt(G.edges,I),I.nodes().forEach(function(o){o.layoutDimensions=()=>{const e=o.data();return{w:e.width,h:e.height}}});const L={name:"cose-bilkent",quality:"proof",styleEnabled:!1,animate:!1};I.layout(L).run(),I.ready(o=>{k.info("Cytoscape ready",o),b(I)})})}V(it,"createCytoscapeInstance");function nt(G){return G.nodes().map(b=>{const N=b.data(),I=b.position(),L={id:N.id,x:I.x,y:I.y};return Object.keys(N).forEach(o=>{o!=="id"&&(L[o]=N[o])}),L})}V(nt,"extractPositionedNodes");function ot(G){return G.edges().map(b=>{const N=b.data(),I=b._private.rscratch,L={id:N.id,source:N.source,target:N.target,startX:I.startX,startY:I.startY,midX:I.midX,midY:I.midY,endX:I.endX,endY:I.endY};return Object.keys(N).forEach(o=>{["id","source","target"].includes(o)||(L[o]=N[o])}),L})}V(ot,"extractPositionedEdges");async function st(G,b){k.debug("Starting cose-bilkent layout algorithm");try{at(G);const N=await it(G),I=nt(N),L=ot(N);return k.debug(`Layout completed: ${I.length} nodes, ${L.length} edges`),{nodes:I,edges:L}}catch(N){throw k.error("Error in cose-bilkent layout algorithm:",N),N}}V(st,"executeCoseBilkentLayout");function at(G){if(!G)throw new Error("Layout data is required");if(!G.config)throw new Error("Configuration is required in layout data");if(!G.rootNode)throw new Error("Root node is required");if(!G.nodes||!Array.isArray(G.nodes))throw new Error("No nodes found in layout data");if(!Array.isArray(G.edges))throw new Error("Edges array is required in layout data");return!0}V(at,"validateLayoutData");var Lt=V(async(G,b,{insertCluster:N,insertEdge:I,insertEdgeLabel:L,insertMarkers:o,insertNode:e,log:t,positionEdgeLabel:i},{algorithm:l})=>{const g={},n={},d=b.select("g");o(d,G.markers,G.type,G.diagramId);const r=d.insert("g").attr("class","subgraphs"),h=d.insert("g").attr("class","edgePaths"),a=d.insert("g").attr("class","edgeLabels"),p=d.insert("g").attr("class","nodes");t.debug("Inserting nodes into DOM for dimension calculation"),await Promise.all(G.nodes.map(async u=>{if(u.isGroup){const T={...u};n[u.id]=T,g[u.id]=T,await N(r,u)}else{const T={...u};g[u.id]=T;const y=await e(p,u,{config:G.config,dir:G.direction||"TB"}),O=y.node().getBBox();T.width=O.width,T.height=O.height,T.domId=y,t.debug(`Node ${u.id} dimensions: ${O.width}x${O.height}`)}})),t.debug("Running cose-bilkent layout algorithm");const v={...G,nodes:G.nodes.map(u=>{const T=g[u.id];return{...u,width:T.width,height:T.height}})},D=await st(v,G.config);t.debug("Positioning nodes based on layout results"),D.nodes.forEach(u=>{const T=g[u.id];T?.domId&&(T.domId.attr("transform",`translate(${u.x}, ${u.y})`),T.x=u.x,T.y=u.y,t.debug(`Positioned node ${T.id} at center (${u.x}, ${u.y})`))}),D.edges.forEach(u=>{const T=G.edges.find(y=>y.id===u.id);T&&(T.points=[{x:u.startX,y:u.startY},{x:u.midX,y:u.midY},{x:u.endX,y:u.endY}])}),t.debug("Inserting and positioning edges"),await Promise.all(G.edges.map(async u=>{await L(a,u);const T=g[u.start??""],y=g[u.end??""];if(T&&y){const O=D.edges.find(s=>s.id===u.id);if(O){t.debug("APA01 positionedEdge",O);const s={...u},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}else{const s={...u,points:[{x:T.x||0,y:T.y||0},{x:y.x||0,y:y.y||0}]},f=I(h,s,n,G.type,T,y,G.diagramId);i(s,f)}}})),t.debug("Cose-bilkent rendering completed")},"render"),Ot=Lt;export{Ot as render};
        diff --git a/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js b/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-CD6doQLg.js
        similarity index 99%
        rename from apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js
        rename to apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-CD6doQLg.js
        index 465b4ad8556..5390deec450 100644
        --- a/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-BIlq342y.js
        +++ b/apps/kimi-code/dist-web/assets/cynefin-VYW2F7L2-CD6doQLg.js
        @@ -1,4 +1,4 @@
        -import{bR as et}from"./index-D-7nOosq.js";var RI=Object.create,Ds=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyNames,EI=Object.getPrototypeOf,CI=Object.prototype.hasOwnProperty,i=(e,t)=>Ds(e,"name",{value:t,configurable:!0}),bI=(e,t)=>function(){return e&&(t=(0,e[Ad(e)[0]])(e=0)),t},H=(e,t)=>function(){return t||(0,e[Ad(e)[0]])((t={exports:{}}).exports,t),t.exports},Vr=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},Ed=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ad(t))!CI.call(e,a)&&a!==r&&Ds(e,a,{get:()=>t[a],enumerable:!(n=AI(t,a))||n.enumerable});return e},Ll=(e,t,r)=>(Ed(e,t,"default"),r),Cd=(e,t,r)=>(r=e!=null?RI(EI(e)):{},Ed(Ds(r,"default",{value:e,enumerable:!0}),e)),bd=e=>Ed(Ds({},"__esModule",{value:!0}),e),Dl={};Vr(Dl,{AnnotatedTextEdit:()=>mr,ChangeAnnotation:()=>an,ChangeAnnotationIdentifier:()=>Ke,CodeAction:()=>ef,CodeActionContext:()=>Qc,CodeActionKind:()=>Zc,CodeActionTriggerKind:()=>Xi,CodeDescription:()=>Nc,CodeLens:()=>tf,Color:()=>Co,ColorInformation:()=>Cc,ColorPresentation:()=>bc,Command:()=>nn,CompletionItem:()=>zc,CompletionItemKind:()=>Lc,CompletionItemLabelDetails:()=>Fc,CompletionItemTag:()=>xc,CompletionList:()=>jc,CreateFile:()=>ya,DeleteFile:()=>va,Diagnostic:()=>Vi,DiagnosticRelatedInformation:()=>bo,DiagnosticSeverity:()=>wc,DiagnosticTag:()=>Ic,DocumentHighlight:()=>Vc,DocumentHighlightKind:()=>Wc,DocumentLink:()=>nf,DocumentSymbol:()=>Jc,DocumentUri:()=>Rc,EOL:()=>zg,FoldingRange:()=>Sc,FoldingRangeKind:()=>_c,FormattingOptions:()=>rf,Hover:()=>Bc,InlayHint:()=>pf,InlayHintKind:()=>wo,InlayHintLabelPart:()=>Io,InlineCompletionContext:()=>Tf,InlineCompletionItem:()=>hf,InlineCompletionList:()=>yf,InlineCompletionTriggerKind:()=>gf,InlineValueContext:()=>df,InlineValueEvaluatableExpression:()=>ff,InlineValueText:()=>uf,InlineValueVariableLookup:()=>cf,InsertReplaceEdit:()=>Mc,InsertTextFormat:()=>Dc,InsertTextMode:()=>Gc,Location:()=>Wi,LocationLink:()=>Ec,MarkedString:()=>Yi,MarkupContent:()=>Ta,MarkupKind:()=>So,OptionalVersionedTextDocumentIdentifier:()=>Hi,ParameterInformation:()=>Uc,Position:()=>ie,Range:()=>Q,RenameFile:()=>ga,SelectedCompletionInfo:()=>vf,SelectionRange:()=>af,SemanticTokenModifiers:()=>of,SemanticTokenTypes:()=>sf,SemanticTokens:()=>lf,SignatureInformation:()=>Kc,StringValue:()=>mf,SymbolInformation:()=>Yc,SymbolKind:()=>qc,SymbolTag:()=>Hc,TextDocument:()=>Rf,TextDocumentEdit:()=>qi,TextDocumentIdentifier:()=>Pc,TextDocumentItem:()=>Oc,TextEdit:()=>Yt,URI:()=>Eo,VersionedTextDocumentIdentifier:()=>kc,WorkspaceChange:()=>Fg,WorkspaceEdit:()=>_o,WorkspaceFolder:()=>$f,WorkspaceSymbol:()=>Xc,integer:()=>Ac,uinteger:()=>Ki});var Rc,Eo,Ac,Ki,ie,Q,Wi,Ec,Co,Cc,bc,_c,Sc,bo,wc,Ic,Nc,Vi,nn,Yt,an,Ke,mr,qi,ya,ga,va,_o,ki,Ku,Fg,Pc,kc,Hi,Oc,So,Ta,Lc,Dc,xc,Mc,Gc,Fc,zc,jc,Yi,Bc,Uc,Kc,Wc,Vc,qc,Hc,Yc,Xc,Jc,Zc,Xi,Qc,ef,tf,rf,nf,af,sf,of,lf,uf,cf,ff,df,wo,Io,pf,mf,hf,yf,gf,vf,Tf,$f,zg,Rf,lh,A,xs=bI({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Rc||(Rc={})),(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Eo||(Eo={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ac||(Ac={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ki||(Ki={})),(function(e){function t(n,a){return n===Number.MAX_VALUE&&(n=Ki.MAX_VALUE),a===Number.MAX_VALUE&&(a=Ki.MAX_VALUE),{line:n,character:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&A.uinteger(a.line)&&A.uinteger(a.character)}i(r,"is"),e.is=r})(ie||(ie={})),(function(e){function t(n,a,s,o){if(A.uinteger(n)&&A.uinteger(a)&&A.uinteger(s)&&A.uinteger(o))return{start:ie.create(n,a),end:ie.create(s,o)};if(ie.is(n)&&ie.is(a))return{start:n,end:a};throw new Error(`Range#create called with invalid arguments[${n}, ${a}, ${s}, ${o}]`)}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&ie.is(a.start)&&ie.is(a.end)}i(r,"is"),e.is=r})(Q||(Q={})),(function(e){function t(n,a){return{uri:n,range:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(A.string(a.uri)||A.undefined(a.uri))}i(r,"is"),e.is=r})(Wi||(Wi={})),(function(e){function t(n,a,s,o){return{targetUri:n,targetRange:a,targetSelectionRange:s,originSelectionRange:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.targetRange)&&A.string(a.targetUri)&&Q.is(a.targetSelectionRange)&&(Q.is(a.originSelectionRange)||A.undefined(a.originSelectionRange))}i(r,"is"),e.is=r})(Ec||(Ec={})),(function(e){function t(n,a,s,o){return{red:n,green:a,blue:s,alpha:o}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.numberRange(a.red,0,1)&&A.numberRange(a.green,0,1)&&A.numberRange(a.blue,0,1)&&A.numberRange(a.alpha,0,1)}i(r,"is"),e.is=r})(Co||(Co={})),(function(e){function t(n,a){return{range:n,color:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&Q.is(a.range)&&Co.is(a.color)}i(r,"is"),e.is=r})(Cc||(Cc={})),(function(e){function t(n,a,s){return{label:n,textEdit:a,additionalTextEdits:s}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.undefined(a.textEdit)||Yt.is(a))&&(A.undefined(a.additionalTextEdits)||A.typedArray(a.additionalTextEdits,Yt.is))}i(r,"is"),e.is=r})(bc||(bc={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(_c||(_c={})),(function(e){function t(n,a,s,o,l,u){const c={startLine:n,endLine:a};return A.defined(s)&&(c.startCharacter=s),A.defined(o)&&(c.endCharacter=o),A.defined(l)&&(c.kind=l),A.defined(u)&&(c.collapsedText=u),c}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.uinteger(a.startLine)&&A.uinteger(a.startLine)&&(A.undefined(a.startCharacter)||A.uinteger(a.startCharacter))&&(A.undefined(a.endCharacter)||A.uinteger(a.endCharacter))&&(A.undefined(a.kind)||A.string(a.kind))}i(r,"is"),e.is=r})(Sc||(Sc={})),(function(e){function t(n,a){return{location:n,message:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Wi.is(a.location)&&A.string(a.message)}i(r,"is"),e.is=r})(bo||(bo={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(wc||(wc={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(Ic||(Ic={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&A.string(n.href)}i(t,"is"),e.is=t})(Nc||(Nc={})),(function(e){function t(n,a,s,o,l,u){let c={range:n,message:a};return A.defined(s)&&(c.severity=s),A.defined(o)&&(c.code=o),A.defined(l)&&(c.source=l),A.defined(u)&&(c.relatedInformation=u),c}i(t,"create"),e.create=t;function r(n){var a;let s=n;return A.defined(s)&&Q.is(s.range)&&A.string(s.message)&&(A.number(s.severity)||A.undefined(s.severity))&&(A.integer(s.code)||A.string(s.code)||A.undefined(s.code))&&(A.undefined(s.codeDescription)||A.string((a=s.codeDescription)===null||a===void 0?void 0:a.href))&&(A.string(s.source)||A.undefined(s.source))&&(A.undefined(s.relatedInformation)||A.typedArray(s.relatedInformation,bo.is))}i(r,"is"),e.is=r})(Vi||(Vi={})),(function(e){function t(n,a,...s){let o={title:n,command:a};return A.defined(s)&&s.length>0&&(o.arguments=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.title)&&A.string(a.command)}i(r,"is"),e.is=r})(nn||(nn={})),(function(e){function t(s,o){return{range:s,newText:o}}i(t,"replace"),e.replace=t;function r(s,o){return{range:{start:s,end:s},newText:o}}i(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}i(n,"del"),e.del=n;function a(s){const o=s;return A.objectLiteral(o)&&A.string(o.newText)&&Q.is(o.range)}i(a,"is"),e.is=a})(Yt||(Yt={})),(function(e){function t(n,a,s){const o={label:n};return a!==void 0&&(o.needsConfirmation=a),s!==void 0&&(o.description=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.boolean(a.needsConfirmation)||a.needsConfirmation===void 0)&&(A.string(a.description)||a.description===void 0)}i(r,"is"),e.is=r})(an||(an={})),(function(e){function t(r){const n=r;return A.string(n)}i(t,"is"),e.is=t})(Ke||(Ke={})),(function(e){function t(s,o,l){return{range:s,newText:o,annotationId:l}}i(t,"replace"),e.replace=t;function r(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}i(r,"insert"),e.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}i(n,"del"),e.del=n;function a(s){const o=s;return Yt.is(o)&&(an.is(o.annotationId)||Ke.is(o.annotationId))}i(a,"is"),e.is=a})(mr||(mr={})),(function(e){function t(n,a){return{textDocument:n,edits:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Hi.is(a.textDocument)&&Array.isArray(a.edits)}i(r,"is"),e.is=r})(qi||(qi={})),(function(e){function t(n,a,s){let o={kind:"create",uri:n};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="create"&&A.string(a.uri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ya||(ya={})),(function(e){function t(n,a,s,o){let l={kind:"rename",oldUri:n,newUri:a};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="rename"&&A.string(a.oldUri)&&A.string(a.newUri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ga||(ga={})),(function(e){function t(n,a,s){let o={kind:"delete",uri:n};return a!==void 0&&(a.recursive!==void 0||a.ignoreIfNotExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="delete"&&A.string(a.uri)&&(a.options===void 0||(a.options.recursive===void 0||A.boolean(a.options.recursive))&&(a.options.ignoreIfNotExists===void 0||A.boolean(a.options.ignoreIfNotExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(va||(va={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(a=>A.string(a.kind)?ya.is(a)||ga.is(a)||va.is(a):qi.is(a)))}i(t,"is"),e.is=t})(_o||(_o={})),ki=class{static{i(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,a;if(r===void 0?n=Yt.insert(e,t):Ke.is(r)?(a=r,n=mr.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.insert(e,t,a)),this.edits.push(n),a!==void 0)return a}replace(e,t,r){let n,a;if(r===void 0?n=Yt.replace(e,t):Ke.is(r)?(a=r,n=mr.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.replace(e,t,a)),this.edits.push(n),a!==void 0)return a}delete(e,t){let r,n;if(t===void 0?r=Yt.del(e):Ke.is(t)?(n=t,r=mr.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=mr.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},Ku=class{static{i(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(Ke.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Fg=class{static{i(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Ku(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(qi.is(t)){const r=new ki(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new ki(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Hi.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const n=[],a={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(a),r=new ki(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new ki(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ku,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=ya.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=ya.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let a;an.is(r)||Ke.is(r)?a=r:n=r;let s,o;if(a===void 0?s=ga.create(e,t,n):(o=Ke.is(a)?a:this._changeAnnotations.manage(a),s=ga.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=va.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=va.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}},(function(e){function t(n){return{uri:n}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)}i(r,"is"),e.is=r})(Pc||(Pc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.integer(a.version)}i(r,"is"),e.is=r})(kc||(kc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&(a.version===null||A.integer(a.version))}i(r,"is"),e.is=r})(Hi||(Hi={})),(function(e){function t(n,a,s,o){return{uri:n,languageId:a,version:s,text:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.string(a.languageId)&&A.integer(a.version)&&A.string(a.text)}i(r,"is"),e.is=r})(Oc||(Oc={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){const n=r;return n===e.PlainText||n===e.Markdown}i(t,"is"),e.is=t})(So||(So={})),(function(e){function t(r){const n=r;return A.objectLiteral(r)&&So.is(n.kind)&&A.string(n.value)}i(t,"is"),e.is=t})(Ta||(Ta={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Lc||(Lc={})),(function(e){e.PlainText=1,e.Snippet=2})(Dc||(Dc={})),(function(e){e.Deprecated=1})(xc||(xc={})),(function(e){function t(n,a,s){return{newText:n,insert:a,replace:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a&&A.string(a.newText)&&Q.is(a.insert)&&Q.is(a.replace)}i(r,"is"),e.is=r})(Mc||(Mc={})),(function(e){e.asIs=1,e.adjustIndentation=2})(Gc||(Gc={})),(function(e){function t(r){const n=r;return n&&(A.string(n.detail)||n.detail===void 0)&&(A.string(n.description)||n.description===void 0)}i(t,"is"),e.is=t})(Fc||(Fc={})),(function(e){function t(r){return{label:r}}i(t,"create"),e.create=t})(zc||(zc={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}i(t,"create"),e.create=t})(jc||(jc={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i(t,"fromPlainText"),e.fromPlainText=t;function r(n){const a=n;return A.string(a)||A.objectLiteral(a)&&A.string(a.language)&&A.string(a.value)}i(r,"is"),e.is=r})(Yi||(Yi={})),(function(e){function t(r){let n=r;return!!n&&A.objectLiteral(n)&&(Ta.is(n.contents)||Yi.is(n.contents)||A.typedArray(n.contents,Yi.is))&&(r.range===void 0||Q.is(r.range))}i(t,"is"),e.is=t})(Bc||(Bc={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}i(t,"create"),e.create=t})(Uc||(Uc={})),(function(e){function t(r,n,...a){let s={label:r};return A.defined(n)&&(s.documentation=n),A.defined(a)?s.parameters=a:s.parameters=[],s}i(t,"create"),e.create=t})(Kc||(Kc={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(Wc||(Wc={})),(function(e){function t(r,n){let a={range:r};return A.number(n)&&(a.kind=n),a}i(t,"create"),e.create=t})(Vc||(Vc={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(qc||(qc={})),(function(e){e.Deprecated=1})(Hc||(Hc={})),(function(e){function t(r,n,a,s,o){let l={name:r,kind:n,location:{uri:s,range:a}};return o&&(l.containerName=o),l}i(t,"create"),e.create=t})(Yc||(Yc={})),(function(e){function t(r,n,a,s){return s!==void 0?{name:r,kind:n,location:{uri:a,range:s}}:{name:r,kind:n,location:{uri:a}}}i(t,"create"),e.create=t})(Xc||(Xc={})),(function(e){function t(n,a,s,o,l,u){let c={name:n,detail:a,kind:s,range:o,selectionRange:l};return u!==void 0&&(c.children=u),c}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.name)&&A.number(a.kind)&&Q.is(a.range)&&Q.is(a.selectionRange)&&(a.detail===void 0||A.string(a.detail))&&(a.deprecated===void 0||A.boolean(a.deprecated))&&(a.children===void 0||Array.isArray(a.children))&&(a.tags===void 0||Array.isArray(a.tags))}i(r,"is"),e.is=r})(Jc||(Jc={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(Zc||(Zc={})),(function(e){e.Invoked=1,e.Automatic=2})(Xi||(Xi={})),(function(e){function t(n,a,s){let o={diagnostics:n};return a!=null&&(o.only=a),s!=null&&(o.triggerKind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.typedArray(a.diagnostics,Vi.is)&&(a.only===void 0||A.typedArray(a.only,A.string))&&(a.triggerKind===void 0||a.triggerKind===Xi.Invoked||a.triggerKind===Xi.Automatic)}i(r,"is"),e.is=r})(Qc||(Qc={})),(function(e){function t(n,a,s){let o={title:n},l=!0;return typeof a=="string"?(l=!1,o.kind=a):nn.is(a)?o.command=a:o.edit=a,l&&s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.title)&&(a.diagnostics===void 0||A.typedArray(a.diagnostics,Vi.is))&&(a.kind===void 0||A.string(a.kind))&&(a.edit!==void 0||a.command!==void 0)&&(a.command===void 0||nn.is(a.command))&&(a.isPreferred===void 0||A.boolean(a.isPreferred))&&(a.edit===void 0||_o.is(a.edit))}i(r,"is"),e.is=r})(ef||(ef={})),(function(e){function t(n,a){let s={range:n};return A.defined(a)&&(s.data=a),s}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.command)||nn.is(a.command))}i(r,"is"),e.is=r})(tf||(tf={})),(function(e){function t(n,a){return{tabSize:n,insertSpaces:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.uinteger(a.tabSize)&&A.boolean(a.insertSpaces)}i(r,"is"),e.is=r})(rf||(rf={})),(function(e){function t(n,a,s){return{range:n,target:a,data:s}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.target)||A.string(a.target))}i(r,"is"),e.is=r})(nf||(nf={})),(function(e){function t(n,a){return{range:n,parent:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(a.parent===void 0||e.is(a.parent))}i(r,"is"),e.is=r})(af||(af={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(sf||(sf={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(of||(of={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i(t,"is"),e.is=t})(lf||(lf={})),(function(e){function t(n,a){return{range:n,text:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.string(a.text)}i(r,"is"),e.is=r})(uf||(uf={})),(function(e){function t(n,a,s){return{range:n,variableName:a,caseSensitiveLookup:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.boolean(a.caseSensitiveLookup)&&(A.string(a.variableName)||a.variableName===void 0)}i(r,"is"),e.is=r})(cf||(cf={})),(function(e){function t(n,a){return{range:n,expression:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&(A.string(a.expression)||a.expression===void 0)}i(r,"is"),e.is=r})(ff||(ff={})),(function(e){function t(n,a){return{frameId:n,stoppedLocation:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.defined(a)&&Q.is(n.stoppedLocation)}i(r,"is"),e.is=r})(df||(df={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}i(t,"is"),e.is=t})(wo||(wo={})),(function(e){function t(n){return{value:n}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.location===void 0||Wi.is(a.location))&&(a.command===void 0||nn.is(a.command))}i(r,"is"),e.is=r})(Io||(Io={})),(function(e){function t(n,a,s){const o={position:n,label:a};return s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&ie.is(a.position)&&(A.string(a.label)||A.typedArray(a.label,Io.is))&&(a.kind===void 0||wo.is(a.kind))&&a.textEdits===void 0||A.typedArray(a.textEdits,Yt.is)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.paddingLeft===void 0||A.boolean(a.paddingLeft))&&(a.paddingRight===void 0||A.boolean(a.paddingRight))}i(r,"is"),e.is=r})(pf||(pf={})),(function(e){function t(r){return{kind:"snippet",value:r}}i(t,"createSnippet"),e.createSnippet=t})(mf||(mf={})),(function(e){function t(r,n,a,s){return{insertText:r,filterText:n,range:a,command:s}}i(t,"create"),e.create=t})(hf||(hf={})),(function(e){function t(r){return{items:r}}i(t,"create"),e.create=t})(yf||(yf={})),(function(e){e.Invoked=0,e.Automatic=1})(gf||(gf={})),(function(e){function t(r,n){return{range:r,text:n}}i(t,"create"),e.create=t})(vf||(vf={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}i(t,"create"),e.create=t})(Tf||(Tf={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&Eo.is(n.uri)&&A.string(n.name)}i(t,"is"),e.is=t})($f||($f={})),zg=[`
        +import{bR as et}from"./index-Bxn5yOTB.js";var RI=Object.create,Ds=Object.defineProperty,AI=Object.getOwnPropertyDescriptor,Ad=Object.getOwnPropertyNames,EI=Object.getPrototypeOf,CI=Object.prototype.hasOwnProperty,i=(e,t)=>Ds(e,"name",{value:t,configurable:!0}),bI=(e,t)=>function(){return e&&(t=(0,e[Ad(e)[0]])(e=0)),t},H=(e,t)=>function(){return t||(0,e[Ad(e)[0]])((t={exports:{}}).exports,t),t.exports},Vr=(e,t)=>{for(var r in t)Ds(e,r,{get:t[r],enumerable:!0})},Ed=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ad(t))!CI.call(e,a)&&a!==r&&Ds(e,a,{get:()=>t[a],enumerable:!(n=AI(t,a))||n.enumerable});return e},Ll=(e,t,r)=>(Ed(e,t,"default"),r),Cd=(e,t,r)=>(r=e!=null?RI(EI(e)):{},Ed(Ds(r,"default",{value:e,enumerable:!0}),e)),bd=e=>Ed(Ds({},"__esModule",{value:!0}),e),Dl={};Vr(Dl,{AnnotatedTextEdit:()=>mr,ChangeAnnotation:()=>an,ChangeAnnotationIdentifier:()=>Ke,CodeAction:()=>ef,CodeActionContext:()=>Qc,CodeActionKind:()=>Zc,CodeActionTriggerKind:()=>Xi,CodeDescription:()=>Nc,CodeLens:()=>tf,Color:()=>Co,ColorInformation:()=>Cc,ColorPresentation:()=>bc,Command:()=>nn,CompletionItem:()=>zc,CompletionItemKind:()=>Lc,CompletionItemLabelDetails:()=>Fc,CompletionItemTag:()=>xc,CompletionList:()=>jc,CreateFile:()=>ya,DeleteFile:()=>va,Diagnostic:()=>Vi,DiagnosticRelatedInformation:()=>bo,DiagnosticSeverity:()=>wc,DiagnosticTag:()=>Ic,DocumentHighlight:()=>Vc,DocumentHighlightKind:()=>Wc,DocumentLink:()=>nf,DocumentSymbol:()=>Jc,DocumentUri:()=>Rc,EOL:()=>zg,FoldingRange:()=>Sc,FoldingRangeKind:()=>_c,FormattingOptions:()=>rf,Hover:()=>Bc,InlayHint:()=>pf,InlayHintKind:()=>wo,InlayHintLabelPart:()=>Io,InlineCompletionContext:()=>Tf,InlineCompletionItem:()=>hf,InlineCompletionList:()=>yf,InlineCompletionTriggerKind:()=>gf,InlineValueContext:()=>df,InlineValueEvaluatableExpression:()=>ff,InlineValueText:()=>uf,InlineValueVariableLookup:()=>cf,InsertReplaceEdit:()=>Mc,InsertTextFormat:()=>Dc,InsertTextMode:()=>Gc,Location:()=>Wi,LocationLink:()=>Ec,MarkedString:()=>Yi,MarkupContent:()=>Ta,MarkupKind:()=>So,OptionalVersionedTextDocumentIdentifier:()=>Hi,ParameterInformation:()=>Uc,Position:()=>ie,Range:()=>Q,RenameFile:()=>ga,SelectedCompletionInfo:()=>vf,SelectionRange:()=>af,SemanticTokenModifiers:()=>of,SemanticTokenTypes:()=>sf,SemanticTokens:()=>lf,SignatureInformation:()=>Kc,StringValue:()=>mf,SymbolInformation:()=>Yc,SymbolKind:()=>qc,SymbolTag:()=>Hc,TextDocument:()=>Rf,TextDocumentEdit:()=>qi,TextDocumentIdentifier:()=>Pc,TextDocumentItem:()=>Oc,TextEdit:()=>Yt,URI:()=>Eo,VersionedTextDocumentIdentifier:()=>kc,WorkspaceChange:()=>Fg,WorkspaceEdit:()=>_o,WorkspaceFolder:()=>$f,WorkspaceSymbol:()=>Xc,integer:()=>Ac,uinteger:()=>Ki});var Rc,Eo,Ac,Ki,ie,Q,Wi,Ec,Co,Cc,bc,_c,Sc,bo,wc,Ic,Nc,Vi,nn,Yt,an,Ke,mr,qi,ya,ga,va,_o,ki,Ku,Fg,Pc,kc,Hi,Oc,So,Ta,Lc,Dc,xc,Mc,Gc,Fc,zc,jc,Yi,Bc,Uc,Kc,Wc,Vc,qc,Hc,Yc,Xc,Jc,Zc,Xi,Qc,ef,tf,rf,nf,af,sf,of,lf,uf,cf,ff,df,wo,Io,pf,mf,hf,yf,gf,vf,Tf,$f,zg,Rf,lh,A,xs=bI({"../../node_modules/.pnpm/vscode-languageserver-types@3.17.5/node_modules/vscode-languageserver-types/lib/esm/main.js"(){(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Rc||(Rc={})),(function(e){function t(r){return typeof r=="string"}i(t,"is"),e.is=t})(Eo||(Eo={})),(function(e){e.MIN_VALUE=-2147483648,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ac||(Ac={})),(function(e){e.MIN_VALUE=0,e.MAX_VALUE=2147483647;function t(r){return typeof r=="number"&&e.MIN_VALUE<=r&&r<=e.MAX_VALUE}i(t,"is"),e.is=t})(Ki||(Ki={})),(function(e){function t(n,a){return n===Number.MAX_VALUE&&(n=Ki.MAX_VALUE),a===Number.MAX_VALUE&&(a=Ki.MAX_VALUE),{line:n,character:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&A.uinteger(a.line)&&A.uinteger(a.character)}i(r,"is"),e.is=r})(ie||(ie={})),(function(e){function t(n,a,s,o){if(A.uinteger(n)&&A.uinteger(a)&&A.uinteger(s)&&A.uinteger(o))return{start:ie.create(n,a),end:ie.create(s,o)};if(ie.is(n)&&ie.is(a))return{start:n,end:a};throw new Error(`Range#create called with invalid arguments[${n}, ${a}, ${s}, ${o}]`)}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&ie.is(a.start)&&ie.is(a.end)}i(r,"is"),e.is=r})(Q||(Q={})),(function(e){function t(n,a){return{uri:n,range:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(A.string(a.uri)||A.undefined(a.uri))}i(r,"is"),e.is=r})(Wi||(Wi={})),(function(e){function t(n,a,s,o){return{targetUri:n,targetRange:a,targetSelectionRange:s,originSelectionRange:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.targetRange)&&A.string(a.targetUri)&&Q.is(a.targetSelectionRange)&&(Q.is(a.originSelectionRange)||A.undefined(a.originSelectionRange))}i(r,"is"),e.is=r})(Ec||(Ec={})),(function(e){function t(n,a,s,o){return{red:n,green:a,blue:s,alpha:o}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.numberRange(a.red,0,1)&&A.numberRange(a.green,0,1)&&A.numberRange(a.blue,0,1)&&A.numberRange(a.alpha,0,1)}i(r,"is"),e.is=r})(Co||(Co={})),(function(e){function t(n,a){return{range:n,color:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&Q.is(a.range)&&Co.is(a.color)}i(r,"is"),e.is=r})(Cc||(Cc={})),(function(e){function t(n,a,s){return{label:n,textEdit:a,additionalTextEdits:s}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.undefined(a.textEdit)||Yt.is(a))&&(A.undefined(a.additionalTextEdits)||A.typedArray(a.additionalTextEdits,Yt.is))}i(r,"is"),e.is=r})(bc||(bc={})),(function(e){e.Comment="comment",e.Imports="imports",e.Region="region"})(_c||(_c={})),(function(e){function t(n,a,s,o,l,u){const c={startLine:n,endLine:a};return A.defined(s)&&(c.startCharacter=s),A.defined(o)&&(c.endCharacter=o),A.defined(l)&&(c.kind=l),A.defined(u)&&(c.collapsedText=u),c}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.uinteger(a.startLine)&&A.uinteger(a.startLine)&&(A.undefined(a.startCharacter)||A.uinteger(a.startCharacter))&&(A.undefined(a.endCharacter)||A.uinteger(a.endCharacter))&&(A.undefined(a.kind)||A.string(a.kind))}i(r,"is"),e.is=r})(Sc||(Sc={})),(function(e){function t(n,a){return{location:n,message:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Wi.is(a.location)&&A.string(a.message)}i(r,"is"),e.is=r})(bo||(bo={})),(function(e){e.Error=1,e.Warning=2,e.Information=3,e.Hint=4})(wc||(wc={})),(function(e){e.Unnecessary=1,e.Deprecated=2})(Ic||(Ic={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&A.string(n.href)}i(t,"is"),e.is=t})(Nc||(Nc={})),(function(e){function t(n,a,s,o,l,u){let c={range:n,message:a};return A.defined(s)&&(c.severity=s),A.defined(o)&&(c.code=o),A.defined(l)&&(c.source=l),A.defined(u)&&(c.relatedInformation=u),c}i(t,"create"),e.create=t;function r(n){var a;let s=n;return A.defined(s)&&Q.is(s.range)&&A.string(s.message)&&(A.number(s.severity)||A.undefined(s.severity))&&(A.integer(s.code)||A.string(s.code)||A.undefined(s.code))&&(A.undefined(s.codeDescription)||A.string((a=s.codeDescription)===null||a===void 0?void 0:a.href))&&(A.string(s.source)||A.undefined(s.source))&&(A.undefined(s.relatedInformation)||A.typedArray(s.relatedInformation,bo.is))}i(r,"is"),e.is=r})(Vi||(Vi={})),(function(e){function t(n,a,...s){let o={title:n,command:a};return A.defined(s)&&s.length>0&&(o.arguments=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.title)&&A.string(a.command)}i(r,"is"),e.is=r})(nn||(nn={})),(function(e){function t(s,o){return{range:s,newText:o}}i(t,"replace"),e.replace=t;function r(s,o){return{range:{start:s,end:s},newText:o}}i(r,"insert"),e.insert=r;function n(s){return{range:s,newText:""}}i(n,"del"),e.del=n;function a(s){const o=s;return A.objectLiteral(o)&&A.string(o.newText)&&Q.is(o.range)}i(a,"is"),e.is=a})(Yt||(Yt={})),(function(e){function t(n,a,s){const o={label:n};return a!==void 0&&(o.needsConfirmation=a),s!==void 0&&(o.description=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&A.string(a.label)&&(A.boolean(a.needsConfirmation)||a.needsConfirmation===void 0)&&(A.string(a.description)||a.description===void 0)}i(r,"is"),e.is=r})(an||(an={})),(function(e){function t(r){const n=r;return A.string(n)}i(t,"is"),e.is=t})(Ke||(Ke={})),(function(e){function t(s,o,l){return{range:s,newText:o,annotationId:l}}i(t,"replace"),e.replace=t;function r(s,o,l){return{range:{start:s,end:s},newText:o,annotationId:l}}i(r,"insert"),e.insert=r;function n(s,o){return{range:s,newText:"",annotationId:o}}i(n,"del"),e.del=n;function a(s){const o=s;return Yt.is(o)&&(an.is(o.annotationId)||Ke.is(o.annotationId))}i(a,"is"),e.is=a})(mr||(mr={})),(function(e){function t(n,a){return{textDocument:n,edits:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Hi.is(a.textDocument)&&Array.isArray(a.edits)}i(r,"is"),e.is=r})(qi||(qi={})),(function(e){function t(n,a,s){let o={kind:"create",uri:n};return a!==void 0&&(a.overwrite!==void 0||a.ignoreIfExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="create"&&A.string(a.uri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ya||(ya={})),(function(e){function t(n,a,s,o){let l={kind:"rename",oldUri:n,newUri:a};return s!==void 0&&(s.overwrite!==void 0||s.ignoreIfExists!==void 0)&&(l.options=s),o!==void 0&&(l.annotationId=o),l}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="rename"&&A.string(a.oldUri)&&A.string(a.newUri)&&(a.options===void 0||(a.options.overwrite===void 0||A.boolean(a.options.overwrite))&&(a.options.ignoreIfExists===void 0||A.boolean(a.options.ignoreIfExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(ga||(ga={})),(function(e){function t(n,a,s){let o={kind:"delete",uri:n};return a!==void 0&&(a.recursive!==void 0||a.ignoreIfNotExists!==void 0)&&(o.options=a),s!==void 0&&(o.annotationId=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&a.kind==="delete"&&A.string(a.uri)&&(a.options===void 0||(a.options.recursive===void 0||A.boolean(a.options.recursive))&&(a.options.ignoreIfNotExists===void 0||A.boolean(a.options.ignoreIfNotExists)))&&(a.annotationId===void 0||Ke.is(a.annotationId))}i(r,"is"),e.is=r})(va||(va={})),(function(e){function t(r){let n=r;return n&&(n.changes!==void 0||n.documentChanges!==void 0)&&(n.documentChanges===void 0||n.documentChanges.every(a=>A.string(a.kind)?ya.is(a)||ga.is(a)||va.is(a):qi.is(a)))}i(t,"is"),e.is=t})(_o||(_o={})),ki=class{static{i(this,"TextEditChangeImpl")}constructor(e,t){this.edits=e,this.changeAnnotations=t}insert(e,t,r){let n,a;if(r===void 0?n=Yt.insert(e,t):Ke.is(r)?(a=r,n=mr.insert(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.insert(e,t,a)),this.edits.push(n),a!==void 0)return a}replace(e,t,r){let n,a;if(r===void 0?n=Yt.replace(e,t):Ke.is(r)?(a=r,n=mr.replace(e,t,r)):(this.assertChangeAnnotations(this.changeAnnotations),a=this.changeAnnotations.manage(r),n=mr.replace(e,t,a)),this.edits.push(n),a!==void 0)return a}delete(e,t){let r,n;if(t===void 0?r=Yt.del(e):Ke.is(t)?(n=t,r=mr.del(e,t)):(this.assertChangeAnnotations(this.changeAnnotations),n=this.changeAnnotations.manage(t),r=mr.del(e,n)),this.edits.push(r),n!==void 0)return n}add(e){this.edits.push(e)}all(){return this.edits}clear(){this.edits.splice(0,this.edits.length)}assertChangeAnnotations(e){if(e===void 0)throw new Error("Text edit change is not configured to manage change annotations.")}},Ku=class{static{i(this,"ChangeAnnotations")}constructor(e){this._annotations=e===void 0?Object.create(null):e,this._counter=0,this._size=0}all(){return this._annotations}get size(){return this._size}manage(e,t){let r;if(Ke.is(e)?r=e:(r=this.nextId(),t=e),this._annotations[r]!==void 0)throw new Error(`Id ${r} is already in use.`);if(t===void 0)throw new Error(`No annotation provided for id ${r}`);return this._annotations[r]=t,this._size++,r}nextId(){return this._counter++,this._counter.toString()}},Fg=class{static{i(this,"WorkspaceChange")}constructor(e){this._textEditChanges=Object.create(null),e!==void 0?(this._workspaceEdit=e,e.documentChanges?(this._changeAnnotations=new Ku(e.changeAnnotations),e.changeAnnotations=this._changeAnnotations.all(),e.documentChanges.forEach(t=>{if(qi.is(t)){const r=new ki(t.edits,this._changeAnnotations);this._textEditChanges[t.textDocument.uri]=r}})):e.changes&&Object.keys(e.changes).forEach(t=>{const r=new ki(e.changes[t]);this._textEditChanges[t]=r})):this._workspaceEdit={}}get edit(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit}getTextEditChange(e){if(Hi.is(e)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");const t={uri:e.uri,version:e.version};let r=this._textEditChanges[t.uri];if(!r){const n=[],a={textDocument:t,edits:n};this._workspaceEdit.documentChanges.push(a),r=new ki(n,this._changeAnnotations),this._textEditChanges[t.uri]=r}return r}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");let t=this._textEditChanges[e];if(!t){let r=[];this._workspaceEdit.changes[e]=r,t=new ki(r),this._textEditChanges[e]=t}return t}}initDocumentChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Ku,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())}initChanges(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))}createFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=ya.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=ya.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}renameFile(e,t,r,n){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let a;an.is(r)||Ke.is(r)?a=r:n=r;let s,o;if(a===void 0?s=ga.create(e,t,n):(o=Ke.is(a)?a:this._changeAnnotations.manage(a),s=ga.create(e,t,n,o)),this._workspaceEdit.documentChanges.push(s),o!==void 0)return o}deleteFile(e,t,r){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");let n;an.is(t)||Ke.is(t)?n=t:r=t;let a,s;if(n===void 0?a=va.create(e,r):(s=Ke.is(n)?n:this._changeAnnotations.manage(n),a=va.create(e,r,s)),this._workspaceEdit.documentChanges.push(a),s!==void 0)return s}},(function(e){function t(n){return{uri:n}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)}i(r,"is"),e.is=r})(Pc||(Pc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.integer(a.version)}i(r,"is"),e.is=r})(kc||(kc={})),(function(e){function t(n,a){return{uri:n,version:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&(a.version===null||A.integer(a.version))}i(r,"is"),e.is=r})(Hi||(Hi={})),(function(e){function t(n,a,s,o){return{uri:n,languageId:a,version:s,text:o}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.string(a.uri)&&A.string(a.languageId)&&A.integer(a.version)&&A.string(a.text)}i(r,"is"),e.is=r})(Oc||(Oc={})),(function(e){e.PlainText="plaintext",e.Markdown="markdown";function t(r){const n=r;return n===e.PlainText||n===e.Markdown}i(t,"is"),e.is=t})(So||(So={})),(function(e){function t(r){const n=r;return A.objectLiteral(r)&&So.is(n.kind)&&A.string(n.value)}i(t,"is"),e.is=t})(Ta||(Ta={})),(function(e){e.Text=1,e.Method=2,e.Function=3,e.Constructor=4,e.Field=5,e.Variable=6,e.Class=7,e.Interface=8,e.Module=9,e.Property=10,e.Unit=11,e.Value=12,e.Enum=13,e.Keyword=14,e.Snippet=15,e.Color=16,e.File=17,e.Reference=18,e.Folder=19,e.EnumMember=20,e.Constant=21,e.Struct=22,e.Event=23,e.Operator=24,e.TypeParameter=25})(Lc||(Lc={})),(function(e){e.PlainText=1,e.Snippet=2})(Dc||(Dc={})),(function(e){e.Deprecated=1})(xc||(xc={})),(function(e){function t(n,a,s){return{newText:n,insert:a,replace:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a&&A.string(a.newText)&&Q.is(a.insert)&&Q.is(a.replace)}i(r,"is"),e.is=r})(Mc||(Mc={})),(function(e){e.asIs=1,e.adjustIndentation=2})(Gc||(Gc={})),(function(e){function t(r){const n=r;return n&&(A.string(n.detail)||n.detail===void 0)&&(A.string(n.description)||n.description===void 0)}i(t,"is"),e.is=t})(Fc||(Fc={})),(function(e){function t(r){return{label:r}}i(t,"create"),e.create=t})(zc||(zc={})),(function(e){function t(r,n){return{items:r||[],isIncomplete:!!n}}i(t,"create"),e.create=t})(jc||(jc={})),(function(e){function t(n){return n.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}i(t,"fromPlainText"),e.fromPlainText=t;function r(n){const a=n;return A.string(a)||A.objectLiteral(a)&&A.string(a.language)&&A.string(a.value)}i(r,"is"),e.is=r})(Yi||(Yi={})),(function(e){function t(r){let n=r;return!!n&&A.objectLiteral(n)&&(Ta.is(n.contents)||Yi.is(n.contents)||A.typedArray(n.contents,Yi.is))&&(r.range===void 0||Q.is(r.range))}i(t,"is"),e.is=t})(Bc||(Bc={})),(function(e){function t(r,n){return n?{label:r,documentation:n}:{label:r}}i(t,"create"),e.create=t})(Uc||(Uc={})),(function(e){function t(r,n,...a){let s={label:r};return A.defined(n)&&(s.documentation=n),A.defined(a)?s.parameters=a:s.parameters=[],s}i(t,"create"),e.create=t})(Kc||(Kc={})),(function(e){e.Text=1,e.Read=2,e.Write=3})(Wc||(Wc={})),(function(e){function t(r,n){let a={range:r};return A.number(n)&&(a.kind=n),a}i(t,"create"),e.create=t})(Vc||(Vc={})),(function(e){e.File=1,e.Module=2,e.Namespace=3,e.Package=4,e.Class=5,e.Method=6,e.Property=7,e.Field=8,e.Constructor=9,e.Enum=10,e.Interface=11,e.Function=12,e.Variable=13,e.Constant=14,e.String=15,e.Number=16,e.Boolean=17,e.Array=18,e.Object=19,e.Key=20,e.Null=21,e.EnumMember=22,e.Struct=23,e.Event=24,e.Operator=25,e.TypeParameter=26})(qc||(qc={})),(function(e){e.Deprecated=1})(Hc||(Hc={})),(function(e){function t(r,n,a,s,o){let l={name:r,kind:n,location:{uri:s,range:a}};return o&&(l.containerName=o),l}i(t,"create"),e.create=t})(Yc||(Yc={})),(function(e){function t(r,n,a,s){return s!==void 0?{name:r,kind:n,location:{uri:a,range:s}}:{name:r,kind:n,location:{uri:a}}}i(t,"create"),e.create=t})(Xc||(Xc={})),(function(e){function t(n,a,s,o,l,u){let c={name:n,detail:a,kind:s,range:o,selectionRange:l};return u!==void 0&&(c.children=u),c}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.name)&&A.number(a.kind)&&Q.is(a.range)&&Q.is(a.selectionRange)&&(a.detail===void 0||A.string(a.detail))&&(a.deprecated===void 0||A.boolean(a.deprecated))&&(a.children===void 0||Array.isArray(a.children))&&(a.tags===void 0||Array.isArray(a.tags))}i(r,"is"),e.is=r})(Jc||(Jc={})),(function(e){e.Empty="",e.QuickFix="quickfix",e.Refactor="refactor",e.RefactorExtract="refactor.extract",e.RefactorInline="refactor.inline",e.RefactorRewrite="refactor.rewrite",e.Source="source",e.SourceOrganizeImports="source.organizeImports",e.SourceFixAll="source.fixAll"})(Zc||(Zc={})),(function(e){e.Invoked=1,e.Automatic=2})(Xi||(Xi={})),(function(e){function t(n,a,s){let o={diagnostics:n};return a!=null&&(o.only=a),s!=null&&(o.triggerKind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.typedArray(a.diagnostics,Vi.is)&&(a.only===void 0||A.typedArray(a.only,A.string))&&(a.triggerKind===void 0||a.triggerKind===Xi.Invoked||a.triggerKind===Xi.Automatic)}i(r,"is"),e.is=r})(Qc||(Qc={})),(function(e){function t(n,a,s){let o={title:n},l=!0;return typeof a=="string"?(l=!1,o.kind=a):nn.is(a)?o.command=a:o.edit=a,l&&s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){let a=n;return a&&A.string(a.title)&&(a.diagnostics===void 0||A.typedArray(a.diagnostics,Vi.is))&&(a.kind===void 0||A.string(a.kind))&&(a.edit!==void 0||a.command!==void 0)&&(a.command===void 0||nn.is(a.command))&&(a.isPreferred===void 0||A.boolean(a.isPreferred))&&(a.edit===void 0||_o.is(a.edit))}i(r,"is"),e.is=r})(ef||(ef={})),(function(e){function t(n,a){let s={range:n};return A.defined(a)&&(s.data=a),s}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.command)||nn.is(a.command))}i(r,"is"),e.is=r})(tf||(tf={})),(function(e){function t(n,a){return{tabSize:n,insertSpaces:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&A.uinteger(a.tabSize)&&A.boolean(a.insertSpaces)}i(r,"is"),e.is=r})(rf||(rf={})),(function(e){function t(n,a,s){return{range:n,target:a,data:s}}i(t,"create"),e.create=t;function r(n){let a=n;return A.defined(a)&&Q.is(a.range)&&(A.undefined(a.target)||A.string(a.target))}i(r,"is"),e.is=r})(nf||(nf={})),(function(e){function t(n,a){return{range:n,parent:a}}i(t,"create"),e.create=t;function r(n){let a=n;return A.objectLiteral(a)&&Q.is(a.range)&&(a.parent===void 0||e.is(a.parent))}i(r,"is"),e.is=r})(af||(af={})),(function(e){e.namespace="namespace",e.type="type",e.class="class",e.enum="enum",e.interface="interface",e.struct="struct",e.typeParameter="typeParameter",e.parameter="parameter",e.variable="variable",e.property="property",e.enumMember="enumMember",e.event="event",e.function="function",e.method="method",e.macro="macro",e.keyword="keyword",e.modifier="modifier",e.comment="comment",e.string="string",e.number="number",e.regexp="regexp",e.operator="operator",e.decorator="decorator"})(sf||(sf={})),(function(e){e.declaration="declaration",e.definition="definition",e.readonly="readonly",e.static="static",e.deprecated="deprecated",e.abstract="abstract",e.async="async",e.modification="modification",e.documentation="documentation",e.defaultLibrary="defaultLibrary"})(of||(of={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&(n.resultId===void 0||typeof n.resultId=="string")&&Array.isArray(n.data)&&(n.data.length===0||typeof n.data[0]=="number")}i(t,"is"),e.is=t})(lf||(lf={})),(function(e){function t(n,a){return{range:n,text:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.string(a.text)}i(r,"is"),e.is=r})(uf||(uf={})),(function(e){function t(n,a,s){return{range:n,variableName:a,caseSensitiveLookup:s}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&A.boolean(a.caseSensitiveLookup)&&(A.string(a.variableName)||a.variableName===void 0)}i(r,"is"),e.is=r})(cf||(cf={})),(function(e){function t(n,a){return{range:n,expression:a}}i(t,"create"),e.create=t;function r(n){const a=n;return a!=null&&Q.is(a.range)&&(A.string(a.expression)||a.expression===void 0)}i(r,"is"),e.is=r})(ff||(ff={})),(function(e){function t(n,a){return{frameId:n,stoppedLocation:a}}i(t,"create"),e.create=t;function r(n){const a=n;return A.defined(a)&&Q.is(n.stoppedLocation)}i(r,"is"),e.is=r})(df||(df={})),(function(e){e.Type=1,e.Parameter=2;function t(r){return r===1||r===2}i(t,"is"),e.is=t})(wo||(wo={})),(function(e){function t(n){return{value:n}}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.location===void 0||Wi.is(a.location))&&(a.command===void 0||nn.is(a.command))}i(r,"is"),e.is=r})(Io||(Io={})),(function(e){function t(n,a,s){const o={position:n,label:a};return s!==void 0&&(o.kind=s),o}i(t,"create"),e.create=t;function r(n){const a=n;return A.objectLiteral(a)&&ie.is(a.position)&&(A.string(a.label)||A.typedArray(a.label,Io.is))&&(a.kind===void 0||wo.is(a.kind))&&a.textEdits===void 0||A.typedArray(a.textEdits,Yt.is)&&(a.tooltip===void 0||A.string(a.tooltip)||Ta.is(a.tooltip))&&(a.paddingLeft===void 0||A.boolean(a.paddingLeft))&&(a.paddingRight===void 0||A.boolean(a.paddingRight))}i(r,"is"),e.is=r})(pf||(pf={})),(function(e){function t(r){return{kind:"snippet",value:r}}i(t,"createSnippet"),e.createSnippet=t})(mf||(mf={})),(function(e){function t(r,n,a,s){return{insertText:r,filterText:n,range:a,command:s}}i(t,"create"),e.create=t})(hf||(hf={})),(function(e){function t(r){return{items:r}}i(t,"create"),e.create=t})(yf||(yf={})),(function(e){e.Invoked=0,e.Automatic=1})(gf||(gf={})),(function(e){function t(r,n){return{range:r,text:n}}i(t,"create"),e.create=t})(vf||(vf={})),(function(e){function t(r,n){return{triggerKind:r,selectedCompletionInfo:n}}i(t,"create"),e.create=t})(Tf||(Tf={})),(function(e){function t(r){const n=r;return A.objectLiteral(n)&&Eo.is(n.uri)&&A.string(n.name)}i(t,"is"),e.is=t})($f||($f={})),zg=[`
         `,`\r
         `,"\r"],(function(e){function t(s,o,l,u){return new lh(s,o,l,u)}i(t,"create"),e.create=t;function r(s){let o=s;return!!(A.defined(o)&&A.string(o.uri)&&(A.undefined(o.languageId)||A.string(o.languageId))&&A.uinteger(o.lineCount)&&A.func(o.getText)&&A.func(o.positionAt)&&A.func(o.offsetAt))}i(r,"is"),e.is=r;function n(s,o){let l=s.getText(),u=a(o,(f,d)=>{let m=f.range.start.line-d.range.start.line;return m===0?f.range.start.character-d.range.start.character:m}),c=l.length;for(let f=u.length-1;f>=0;f--){let d=u[f],m=s.offsetAt(d.range.start),g=s.offsetAt(d.range.end);if(g<=c)l=l.substring(0,m)+d.newText+l.substring(g,l.length);else throw new Error("Overlapping edit");c=m}return l}i(n,"applyEdits"),e.applyEdits=n;function a(s,o){if(s.length<=1)return s;const l=s.length/2|0,u=s.slice(0,l),c=s.slice(l);a(u,o),a(c,o);let f=0,d=0,m=0;for(;f({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,G=-x/C,ht=$/C,et=M+G*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Vt={draw:_t},Et=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
        +import{p as xt}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{s as gt,g as $t,p as bt,o as wt,a as Ct,b as vt,_ as s,l as O,F as Dt,e as kt,q as Tt,B as U,z as Q,D as At,W as ot}from"./mermaid.core-CsZwh_jB.js";import{p as Bt}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var rt=s(()=>({domains:new Map,transitions:[]}),"createDefaultData"),H=rt(),St=s(()=>H.domains,"getDomains"),Mt=s(()=>H.transitions,"getTransitions"),zt=s(t=>{if(t)for(const e of t){const n=e.domain,a=(e.items??[]).map(c=>({label:c.label}));H.domains.set(n,{name:n,items:a})}},"setDomains"),Lt=s(t=>{t&&(H.transitions=t.filter(e=>e.from===e.to?(O.warn(`Cynefin: self-loop transition on domain "${e.from}" is not meaningful and will be skipped.`),!1):!0).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))},"setTransitions"),Nt=s(()=>U({...At.cynefin,...Q().cynefin}),"getConfig"),Pt=s(()=>{Tt(),H=rt()},"clear"),Y={getDomains:St,getTransitions:Mt,setDomains:zt,setTransitions:Lt,getConfig:Nt,clear:Pt,setAccTitle:vt,getAccTitle:Ct,setDiagramTitle:wt,getDiagramTitle:bt,getAccDescription:$t,setAccDescription:gt},Wt=s(t=>{xt(t,Y),Y.setDomains(t.domains),Y.setTransitions(t.transitions)},"populate"),It={parse:s(async t=>{const e=await Bt("cynefin",t);O.debug(e),Wt(e)},"parse")};function E(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}s(E,"seededRandom");function st(t){let e=0;for(let n=0;n{const n=t/2,a=e/2;return{complex:{cx:n/2,cy:a/2,x:0,y:0,w:n,h:a},complicated:{cx:n+n/2,cy:a/2,x:n,y:0,w:n,h:a},chaotic:{cx:n/2,cy:a+a/2,x:0,y:a,w:n,h:a},clear:{cx:n+n/2,cy:a+a/2,x:n,y:a,w:n,h:a},confusion:{cx:n,cy:a,x:n*.7,y:a*.7,w:n*.6,h:a*.6}}},"getDomainLayouts"),Rt=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinDomainColors"),q=3,_t=s((t,e,n,a)=>{const c=a.db,m=c.getDomains(),v=c.getTransitions(),I=c.getDiagramTitle(),d=c.getAccTitle(),D=c.getAccDescription(),o=c.getConfig(),p=Rt();O.debug("Rendering Cynefin diagram");const i=o.width,f=o.height,b=o.padding,h=o.showDomainDescriptions,F=o.boundaryAmplitude,R=i+b*2,_=f+b*2,z={complex:p.complexBg,complicated:p.complicatedBg,clear:p.clearBg,chaotic:p.chaoticBg,confusion:p.confusionBg},k=Dt(e);kt(k,_,R,o.useMaxWidth??!0),k.attr("viewBox",`0 0 ${R} ${_}`),d&&k.append("title").text(d),D&&k.append("desc").text(D);const T=k.append("g").attr("transform",`translate(${b}, ${b})`),V=Ft(i,f),Z=it(o.seed,e),mt=T.append("g").attr("class","cynefin-backgrounds"),X=["complex","complicated","chaotic","clear"];for(const l of X){const r=V[l];mt.append("rect").attr("class","cynefinDomain").attr("x",r.x).attr("y",r.y).attr("width",r.w).attr("height",r.h).attr("fill",z[l]).attr("fill-opacity",.4).attr("stroke","none")}const j=T.append("g").attr("class","cynefin-boundaries");j.append("path").attr("class","cynefinBoundary").attr("d",ct(i,f,Z,F)).attr("fill","none"),j.append("path").attr("class","cynefinBoundary").attr("d",lt(i,f,Z+100,F)).attr("fill","none"),j.append("path").attr("class","cynefinCliff").attr("d",dt(i,f)).attr("fill","none");const pt=i*.15,yt=f*.15;T.append("path").attr("class","cynefinConfusion").attr("d",ft(i/2,f/2,pt,yt)).attr("fill",z.confusion).attr("fill-opacity",.5);const J=T.append("g").attr("class","cynefin-labels");for(const l of X){const r=V[l];J.append("text").attr("class","cynefinDomainLabel").attr("x",r.cx).attr("y",h?r.cy-30:r.cy).attr("text-anchor","middle").attr("dominant-baseline","middle").text(l.charAt(0).toUpperCase()+l.slice(1))}if(J.append("text").attr("class","cynefinDomainLabel").attr("x",i/2).attr("y",h?f/2-10:f/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text("Confusion"),h){const l=T.append("g").attr("class","cynefin-subtitles");for(const r of X){const u=V[r],y=at[r];l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy-10).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.model),l.append("text").attr("class","cynefinSubtitle").attr("x",u.cx).attr("y",u.cy+5).attr("text-anchor","middle").attr("dominant-baseline","middle").text(y.practice)}l.append("text").attr("class","cynefinSubtitle").attr("x",i/2).attr("y",f/2+8).attr("text-anchor","middle").attr("dominant-baseline","middle").text(at.confusion.practice)}const K=T.append("g").attr("class","cynefin-items"),A=26,tt=10,ut=["complex","complicated","chaotic","clear","confusion"];for(const l of ut){const r=m.get(l);if(!r||r.items.length===0)continue;const u=V[l],y=l==="confusion";let L=r.items,N=0;y&&r.items.length>q&&(N=r.items.length-q,L=r.items.slice(0,q));let B;if(y){const g=h?22:14;B=u.cy+g}else B=u.cy+(h?25:15);if([...L].forEach((g,S)=>{const w=B+S*(A+4),M=K.append("g"),P=M.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(g.label);let $=g.label.length*7;const x=P.node();if(x&&typeof x.getBBox=="function"){const G=x.getBBox();G.width>0&&($=G.width)}const C=$+tt*2,W=u.cx-C/2;M.attr("transform",`translate(${W}, ${w})`),M.insert("rect","text").attr("class","cynefinItem").attr("x",0).attr("y",0).attr("width",C).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.95),P.attr("x",C/2).attr("y",A/2)}),N>0){const g=B+L.length*(A+4),S=`+${N} more`,w=K.append("g"),M=w.append("text").attr("class","cynefinItemText").attr("x",0).attr("y",A/2).attr("text-anchor","middle").attr("dominant-baseline","central").text(S);let P=S.length*7;const $=M.node();if($&&typeof $.getBBox=="function"){const W=$.getBBox();W.width>0&&(P=W.width)}const x=P+tt*2,C=u.cx-x/2;w.attr("transform",`translate(${C}, ${g})`),w.insert("rect","text").attr("class","cynefinItemOverflow").attr("x",0).attr("y",0).attr("width",x).attr("height",A).attr("rx",4).attr("ry",4).attr("fill",z[l]).attr("fill-opacity",.6),M.attr("x",x/2).attr("y",A/2)}}if(v.length>0){const l=k.select("defs").empty()?k.append("defs"):k.select("defs"),r=`cynefin-arrow-${e}`;l.append("marker").attr("id",r).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","cynefinArrowHead");const u=T.append("g").attr("class","cynefin-arrows");v.forEach(y=>{const L=V[y.from],N=V[y.to];if(!L||!N)return;if(y.from===y.to){O.warn(`Cynefin renderer: skipping self-loop on domain "${y.from}"`);return}const B=L.cx,g=L.cy,S=N.cx,w=N.cy,M=(B+S)/2,P=(g+w)/2,$=S-B,x=w-g,C=Math.sqrt($*$+x*x),W=C*.15,G=-x/C,ht=$/C,et=M+G*W,nt=P+ht*W;u.append("path").attr("class","cynefinArrowLine").attr("d",`M${B},${g} Q${et},${nt} ${S},${w}`).attr("fill","none").attr("marker-end",`url(#${r})`),y.label&&u.append("text").attr("class","cynefinArrowLabel").attr("x",et).attr("y",nt-6).attr("text-anchor","middle").attr("dominant-baseline","auto").text(y.label)})}I&&T.append("text").attr("class","cynefinTitle").attr("x",i/2).attr("y",-b/2).attr("text-anchor","middle").attr("dominant-baseline","middle").text(I)},"draw"),Vt={draw:_t},Et=s(()=>{const t=ot(),e=Q();return U(t,e.themeVariables).cynefin},"getCynefinTheme"),Ht=s(()=>{const t=Et();return`
         	.cynefinDomain {
         		stroke: none;
         	}
        diff --git a/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js b/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CxsYi2pz.js
        similarity index 97%
        rename from apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js
        rename to apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CxsYi2pz.js
        index b6eae6b18c3..35f3b783341 100644
        --- a/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-D8gdq5tS.js
        +++ b/apps/kimi-code/dist-web/assets/dagre-VKFMJZFB-CxsYi2pz.js
        @@ -1,4 +1,4 @@
        -import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-Df2V79id.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-CJB1tAev.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,m,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==m&&r.add(i),n!==m&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,m=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(m,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",m=0,c={})=>{const r=s.x,f=s.y-m,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const m=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;m.has(h)||m.set(h,[]),m.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),m.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},y=Z(s,n,r,i.start,o),X=ee(n,y,t,p.width??0),S=te(n,X,y,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,m,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX
        +import{c as O,w as I,a as J,f as P,b as E,s as A}from"./chunk-RYQCIY6F-Dm138b37.js";import{_ as w,am as v,an as D,ao as H,ap as Y,l,c as _,aq as W,ar as $,ag as j,as as q,ah as R,af as F,at as z,au as K,av as G}from"./mermaid.core-CsZwh_jB.js";import{G as Q}from"./graph-DOmOIIwC.js";import{l as U}from"./layout-D-LzfAck.js";import"./map-DxJ2ADlA.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var C=w((s,t,g)=>Math.max(t,Math.min(g,s)),"clamp"),B=w((s="TB")=>{switch(s){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";case"TB":default:return"top"}},"getDefaultSelfLoopSide"),V=w(s=>s==="flowchart"||s==="flowchart-v2"||s==="stateDiagram","shouldMergeSelfLoopSegments"),Z=w((s,t,g,m,c)=>{const o=[],r=new Set;if(g.forEach(({start:i,end:n})=>{i!==m&&r.add(i),n!==m&&r.add(n)}),r.forEach(i=>{const n=s.node(i);typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)}),o.length===0&&g.forEach(({edge:i})=>{(i.points??[]).forEach(n=>{typeof n?.x=="number"&&typeof n?.y=="number"&&o.push(n)})}),o.length===0)return B(c);const f=o.reduce((i,n)=>({x:i.x+n.x/o.length,y:i.y+n.y/o.length}),{x:0,y:0}),h=f.x-t.x,a=f.y-t.y;return Math.abs(h)>Math.abs(a)?h>0?"right":"left":Math.abs(a)>0?a>0?"bottom":"top":B(c)},"getSelfLoopSide"),ee=w((s,t="top",g=0,m=0)=>{const c=s.x,o=s.y-g,r=s.width/2,f=s.height/2,h=Math.max(36,Math.min(100,s.width*.8)),a=C(Math.max(m,s.width*.35),36,h),i=C(Math.min(s.width,s.height)*.45,24,48);switch(t){case"bottom":{const n=o+f;return[{x:c-a/2,y:n},{x:c-a/2,y:n+i},{x:c+a/2,y:n+i},{x:c+a/2,y:n}]}case"right":{const n=c+r;return[{x:n,y:o-a/2},{x:n+i,y:o-a/2},{x:n+i,y:o+a/2},{x:n,y:o+a/2}]}case"left":{const n=c-r;return[{x:n,y:o-a/2},{x:n-i,y:o-a/2},{x:n-i,y:o+a/2},{x:n,y:o+a/2}]}case"top":default:{const n=o-f;return[{x:c-a/2,y:n},{x:c-a/2,y:n-i},{x:c+a/2,y:n-i},{x:c+a/2,y:n}]}}},"getSelfLoopPoints"),te=w((s,t,g="top",m=0,c={})=>{const r=s.x,f=s.y-m,h=c.width??0,a=c.height??0;switch(g){case"bottom":return{x:r,y:Math.max(...t.map(i=>i.y))+a/2+4};case"right":return{x:Math.max(...t.map(i=>i.x))+h/2+4,y:f};case"left":return{x:Math.min(...t.map(i=>i.x))-h/2-4,y:f};case"top":default:return{x:r,y:Math.min(...t.map(i=>i.y))-a/2-4}}},"getSelfLoopLabelPosition"),ne=w((s,t=0,{mergeSelfLoops:g=!0}={})=>{const m=new Map,c=[],o=s.graph()?.rankdir;return s.edges().forEach(r=>{const f=s.edge(r);if(g&&f.selfLoop){const h=f.selfLoop.id;m.has(h)||m.set(h,[]),m.get(h).push({edge:f,start:r.v,end:r.w})}else c.push({edge:f,start:r.v,end:r.w})}),m.forEach(r=>{if(r.length!==3){r.forEach(L=>c.push(L));return}r.sort((L,d)=>L.edge.selfLoop.order-d.edge.selfLoop.order);const[f,h,a]=r,i=f.edge.originalEdge??h.edge.originalEdge??a.edge.originalEdge??h.edge,n=s.node(i.start);if(!n){r.forEach(L=>c.push(L));return}const p={width:h.edge.width,height:h.edge.height},y=Z(s,n,r,i.start,o),X=ee(n,y,t,p.width??0),S=te(n,X,y,t,p),b={...h.edge,...i,id:i.id,points:X,start:i.start,end:i.end,x:S.x,y:S.y,width:p.width,height:p.height,labelStyle:h.edge.labelStyle,fromCluster:f.edge.fromCluster??h.edge.fromCluster??a.edge.fromCluster,toCluster:f.edge.toCluster??h.edge.toCluster??a.edge.toCluster};delete b.selfLoop,delete b.originalEdge,c.push({edge:b,start:b.start,end:b.end})}),c},"getEdgesToRender"),T=w(async(s,t,g,m,c,o)=>{l.warn("Graph in recursive render:XAX",I(t),c);const r=t.graph().rankdir;l.trace("Dir in recursive render - dir:",r);const f=s.insert("g").attr("class","root");t.nodes()?l.info("Recursive render XXX",t.nodes()):l.info("No nodes found for",t),t.edges().length>0&&l.info("Recursive edges",t.edge(t.edges()[0]));const h=f.insert("g").attr("class","clusters"),a=f.insert("g").attr("class","edgePaths"),i=f.insert("g").attr("class","edgeLabels"),n=f.insert("g").attr("class","nodes"),p=V(g);await Promise.all(t.nodes().map(async function(d){const e=t.node(d);if(c!==void 0){const u=JSON.parse(JSON.stringify(c.clusterData));l.trace(`Setting data for parent cluster XXX
          Node.id = `,d,`
          data=`,u.height,`
         Parent cluster`,c.height),t.setNode(c.id,u),t.parent(d)||(l.trace("Setting parent",d,c.id),t.setParent(d,c.id,u))}if(l.info("(Insert) Node XXX"+d+": "+JSON.stringify(t.node(d))),e?.clusterNode){l.info("Cluster identified XBX",d,e.width,t.node(d));const{ranksep:u,nodesep:x}=t.graph();e.graph.setGraph({...e.graph.graph(),ranksep:u+25,nodesep:x});const N=await T(n,e.graph,g,m,t.node(d),o),M=N.elem;W(e,M),e.diff=N.diff||0,l.info("New compound node after recursive render XAX",d,"width",e.width,"height",e.height),$(M,e)}else t.children(d).length>0?(l.trace("Cluster - the non recursive path XBX",d,e.id,e,e.width,"Graph:",t),l.trace(P(e.id,t)),E.set(e.id,{id:P(e.id,t),node:e})):(l.trace("Node - the non recursive path XAX",d,n,t.node(d),r),await j(n,t.node(d),{config:o,dir:r}))})),await w(async()=>{const d=t.edges().map(async function(e){const u=t.edge(e.v,e.w,e.name);if(l.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),l.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),l.info("Fix",E,"ids:",e.v,e.w,"Translating: ",E.get(e.v),E.get(e.w)),p&&u.selfLoop){if(u.selfLoop.order!==1)return;const x=u.id;u.id=u.selfLoop.id,await G(i,u),u.id=x;return}await G(i,u)});await Promise.all(d)},"processEdges")(),l.info("Graph before layout:",JSON.stringify(I(t))),l.info("############################################# XXX"),l.info("###                Layout                 ### XXX"),l.info("############################################# XXX"),U(t),l.info("Graph after layout:",JSON.stringify(I(t)));let X=0,{subGraphTitleTotalMargin:S}=q(o);await Promise.all(A(t).map(async function(d){const e=t.node(d);if(l.info("Position XBX => "+d+": ("+e.x,","+e.y,") width: ",e.width," height: ",e.height),e?.clusterNode)e.y+=S,l.info("A tainted cluster node XBX1",d,e.id,e.width,e.height,e.x,e.y,t.parent(d)),E.get(e.id).node=e,R(e);else if(t.children(d).length>0){l.info("A pure cluster node XBX1",d,e.id,e.x,e.y,e.width,e.height,t.parent(d)),e.height+=S,t.node(e.parentId);const u=e?.padding/2||0,x=e?.labelBBox?.height||0,N=x-u||0;l.debug("OffsetY",N,"labelHeight",x,"halfPadding",u),await F(h,e),E.get(e.id).node=e}else{const u=t.node(e.parentId);e.y+=S/2,l.info("A regular node XBX1 - using the padding",e.id,"parent",e.parentId,e.width,e.height,e.x,e.y,"offsetY",e.offsetY,"parent",u,u?.offsetY,e),R(e)}}));const b=S/2;return ne(t,b,{mergeSelfLoops:p}).forEach(function({edge:d,start:e,end:u}){l.info("Edge "+e+" -> "+u+": "+JSON.stringify(d),d),d.points.forEach(k=>k.y+=b);const x=t.node(e),N=t.node(u),M=z(a,d,E,g,x,N,m);K(d,M)}),t.nodes().forEach(function(d){const e=t.node(d);l.info(d,e.type,e.diff),e.isGroup&&(X=e.diff)}),l.warn("Returning from recursive render XAX",f,X),{elem:f,diff:X}},"recursiveRender"),le=w(async(s,t)=>{const g=new Q({multigraph:!0,compound:!0}).setGraph({rankdir:s.direction,nodesep:s.config?.nodeSpacing||s.config?.flowchart?.nodeSpacing||s.nodeSpacing,ranksep:s.config?.rankSpacing||s.config?.flowchart?.rankSpacing||s.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),m=t.select("g");v(m,s.markers,s.type,s.diagramId),D(),H(),Y(),O(),s.nodes.forEach(o=>{g.setNode(o.id,{...o}),o.parentId&&g.setParent(o.id,o.parentId)}),l.debug("Edges:",s.edges),s.edges.forEach(o=>{if(o.start===o.end){const r=o.start,f=r+"---"+r+"---1",h=r+"---"+r+"---2",a=g.node(r);g.setNode(f,{domId:f,id:f,parentId:a.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),g.setParent(f,a.parentId),g.setNode(h,{domId:h,id:h,parentId:a.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),g.setParent(h,a.parentId);const i=structuredClone(o),n=structuredClone(o),p=structuredClone(o),y=structuredClone(o);n.originalEdge=i,n.selfLoop={id:i.id,order:0},p.originalEdge=i,p.selfLoop={id:i.id,order:1},y.originalEdge=i,y.selfLoop={id:i.id,order:2},n.label="",n.arrowTypeEnd="none",n.endLabelLeft="",n.endLabelRight="",n.startLabelLeft="",n.id=r+"-cyclic-special-1",p.startLabelRight="",p.startLabelLeft="",p.endLabelLeft="",p.endLabelRight="",p.arrowTypeStart="none",p.arrowTypeEnd="none",p.id=r+"-cyclic-special-mid",y.label="",y.startLabelRight="",y.startLabelLeft="",y.arrowTypeStart="none",a.isGroup&&(n.fromCluster=r,y.toCluster=r),y.id=r+"-cyclic-special-2",y.arrowTypeStart="none",g.setEdge(r,f,n,r+"-cyclic-special-0"),g.setEdge(f,h,p,r+"-cyclic-special-1"),g.setEdge(h,r,y,r+"-cyclic-special-2")}else g.setEdge(o.start,o.end,{...o},o.id)}),l.warn("Graph at first:",JSON.stringify(I(g))),J(g),l.warn("Graph after XAX:",JSON.stringify(I(g)));const c=_();await T(m,g,s.type,s.diagramId,void 0,c)},"render");export{ne as getEdgesToRender,le as render};
        diff --git a/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js b/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-BxnsH35m.js
        similarity index 98%
        rename from apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js
        rename to apps/kimi-code/dist-web/assets/diagram-FQU43EPY-BxnsH35m.js
        index f0cf49a2553..8db61b31dc8 100644
        --- a/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-D2bRXH1a.js
        +++ b/apps/kimi-code/dist-web/assets/diagram-FQU43EPY-BxnsH35m.js
        @@ -1,3 +1,3 @@
        -import{p as re}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{p as oe,o as se,s as de,g as le,a as ce,b as me,_ as o,l as g,c as D,d as ue,A as xe,q as fe,B as ge,z as M,D as he,i as y,w as P,ak as pe}from"./mermaid.core-CJB1tAev.js";import{p as be,i as ve}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var T="position frame",$="frame positioned",S="position relation",N="relation positioned",we=o(function(e){g.debug("options str",e)},"setOptions"),ye=o(function(){return{}},"getOptions"),Pe=o(function(){C(),fe()},"clear");function C(){B={}}o(C,"reset");var Se=he.eventmodeling,ke=o(()=>ge({...Se,...M().eventmodeling}),"getConfig"),B={};function O(){let e=Fe;const{ast:n}=B,t=E();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=v(e,{$kind:T,index:a,frame:i,textProps:r});let d;K(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=v(e,{$kind:S,index:a,frame:i,sourceFrame:l})})):e=v(e,{$kind:S,index:a,frame:i})}),e={...e,sortedSwimlanesArray:A(e.swimlanes)},e}o(O,"getState");function I(e){B.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function E(){return s}o(E,"getDiagramProps");var Fe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function W(e){const n=e.split(".");if(n.length===2)return n[0]}o(W,"extractNamespace");function H(e){const n=e.split(".");return n.length===2?n[1]:e}o(H,"extractName");function U(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(U,"findSwimlaneByNamespace");function b(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(b,"findNextAvailableIndex");function _(e,n){const t=W(e.entityIdentifier),i=U(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:b(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:b(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:b(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=M();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function G(e,n,t){const i=M(),a=y(H(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
        "};let c=`${P(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(w=>w.name===e.dataReference?.$refText);p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ +import{p as re}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{p as oe,o as se,s as de,g as le,a as ce,b as me,_ as o,l as g,c as D,d as ue,A as xe,q as fe,B as ge,z as M,D as he,i as y,w as P,ak as pe}from"./mermaid.core-CsZwh_jB.js";import{p as be,i as ve}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var T="position frame",$="frame positioned",S="position relation",N="relation positioned",we=o(function(e){g.debug("options str",e)},"setOptions"),ye=o(function(){return{}},"getOptions"),Pe=o(function(){C(),fe()},"clear");function C(){B={}}o(C,"reset");var Se=he.eventmodeling,ke=o(()=>ge({...Se,...M().eventmodeling}),"getConfig"),B={};function O(){let e=Fe;const{ast:n}=B,t=E();if(!n)throw new Error("No data for EventModel");return n.frames.forEach((i,a)=>{const r=G(i,n.dataEntities,t);e=v(e,{$kind:T,index:a,frame:i,textProps:r});let d;K(i)?(g.debug("source frame",i.sourceFrames),d=n.frames.filter(l=>i.sourceFrames.some(c=>c.$refText===l.name)),d.forEach(l=>{e=v(e,{$kind:S,index:a,frame:i,sourceFrame:l})})):e=v(e,{$kind:S,index:a,frame:i})}),e={...e,sortedSwimlanesArray:A(e.swimlanes)},e}o(O,"getState");function I(e){B.ast=e}o(I,"setAst");var s={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:"bold",boxTextPadding:10,swimlaneTextFontWeight:"bold",labelUiAutomation:"UI/Automation",labelUiAutomationPrefix:"UI/A: ",labelCommandReadModel:"Command/Read Model",labelCommandReadModelPrefix:"C/RM: ",labelEvents:"Events",labelEventsPrefix:"Stream: "};function E(){return s}o(E,"getDiagramProps");var Fe={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function W(e){const n=e.split(".");if(n.length===2)return n[0]}o(W,"extractNamespace");function H(e){const n=e.split(".");return n.length===2?n[1]:e}o(H,"extractName");function U(e,n){if(!(!n||n.length===0))return Object.values(e).find(t=>t.namespace===n)}o(U,"findSwimlaneByNamespace");function b(e,n,t){return Math.max(n,...Object.keys(e).filter(i=>{const a=Number.parseInt(i);return a>n&&aNumber.parseInt(i)))+1}o(b,"findNextAvailableIndex");function _(e,n){const t=W(e.entityIdentifier),i=U(n,t);switch(e.modelEntityType){case"ui":case"pcr":case"processor":return i?{index:i.index,label:i.namespace||s.labelUiAutomation}:t?{index:b(n,0,100),label:s.labelUiAutomationPrefix+t}:{index:0,label:s.labelUiAutomation};case"rmo":case"readmodel":case"cmd":case"command":return i?{index:i.index,label:i.namespace||s.labelCommandReadModel}:t?{index:b(n,100,200),label:s.labelCommandReadModelPrefix+t}:{index:100,label:s.labelCommandReadModel};case"evt":case"event":default:return i?{index:i.index,label:i.namespace||s.labelEvents}:t?{index:b(n,200,300),label:s.labelEventsPrefix+t}:{index:200,label:s.labelEvents}}}o(_,"calculateSwimlaneProps");function L(e){const{themeVariables:n}=M();switch(e.modelEntityType){case"ui":return{fill:n.emUiFill??"white",stroke:n.emUiStroke??"#dbdada"};case"pcr":case"processor":return{fill:n.emProcessorFill??"#edb3f6",stroke:n.emProcessorStroke??"#b88cbf"};case"rmo":case"readmodel":return{fill:n.emReadModelFill??"#d3f1a2",stroke:n.emReadModelStroke??"#a3b732"};case"cmd":case"command":return{fill:n.emCommandFill??"#bcd6fe",stroke:n.emCommandStroke??"#679ac3"};case"evt":case"event":return{fill:n.emEventFill??"#ffb778",stroke:n.emEventStroke??"#c19a0f"};default:return{fill:"red",stroke:"black"}}}o(L,"calculateEntityVisualProps");function G(e,n,t){const i=M(),a=y(H(e.entityIdentifier)??"",i);let r;const d={fontSize:16,fontWeight:700,fontFamily:'"trebuchet ms", verdana, arial, sans-serif',joinWith:"
        "};let c=`${P(a,t.textMaxWidth,d)}`;if(e.dataInlineValue&&(r=e.dataInlineValue,r=r.substring(r.indexOf("{")+1),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," ")),e.dataReference){const p=n.find(w=>w.name===e.dataReference?.$refText);p&&(r=p.dataBlockValue,r=r.substring(r.indexOf(`{ `)+2),r=r.substring(0,r.lastIndexOf("}")-1),r=y(r,i),r=P(r,t.textMaxWidth,d),r=r.replaceAll(" "," "),r+="
        ")}const m=r!==void 0;m&&(c+=`

        ${r}`);const x={fontSize:d.fontSize,fontWeight:d.fontWeight,fontFamily:d.fontFamily},u=pe(c,x),h=m?u.width/3:u.width,f={content:c,width:h,height:u.height};return g.debug(`[${e.name}] ${e.entityIdentifier} text`,f),f}o(G,"calculateTextProps");function V(e,n){const t=n,i=L(t.frame),a={width:t.textProps.width+2*s.boxTextPadding,height:t.textProps.height+2*s.boxTextPadding};return[{$kind:$,frame:t.frame,index:t.index,visual:i,dimension:a,textProps:t.textProps}]}o(V,"decidePositionFrame");function X(e,n,t){return n===void 0?s.contentStartX:n.index===e.index&&e.r?e.r+s.boxPadding:t===void 0?s.contentStartX:t.r-s.boxOverlap+s.boxPadding}o(X,"calculateX");function j(e,n){const t=[...e.map(i=>i.r),n];return Math.max(...t)}o(j,"calculateMaxRight");function A(e){return Object.values(e).sort((n,t)=>n.index-t.index)}o(A,"sortedSwimlanesArray");function Y(e,n){const t=n,i=_(t.frame,e.swimlanes);let a;i.index in e.swimlanes?a=e.swimlanes[i.index]:a={index:i.index,label:i.label,r:0,y:i.index*s.swimlaneMinHeight+s.swimlaneGap,height:s.swimlaneMinHeight,maxHeight:s.swimlaneMinHeight};const r=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,d=e.previousSwimlaneNumber!==void 0?e.swimlanes[e.previousSwimlaneNumber]:void 0,l={width:Math.max(s.boxMinWidth,Math.min(s.boxMaxWidth,t.dimension.width))+2*s.boxPadding,height:Math.max(s.boxMinHeight,Math.min(s.boxMaxHeight,t.dimension.height))+2*s.boxPadding},c=X(a,d,r),m=c+l.width+s.boxPadding,x=j(Object.values(e.swimlanes),m);a.r=c+l.width,a.maxHeight=Math.max(a.maxHeight,l.height),a.height=Math.max(s.swimlaneMinHeight,a.maxHeight)+2*s.swimlanePadding;const u={x:c,y:s.swimlanePadding+a.y,r:m,dimension:l,leftSibling:!1,swimlane:a,visual:t.visual,text:t.textProps.content,frame:t.frame,index:t.index},h={...e,boxes:[...e.boxes,u],swimlanes:{...e.swimlanes,[`${a.index}`]:a},previousSwimlaneNumber:i.index,previousFrame:t.frame,maxR:x},f=A(h.swimlanes);f.length>0&&(f[0].y=0);for(let p=1;p0}o(K,"hasSourceFrame");function k(e,n){if(n!=null)return e.find(t=>t.frame.name===n.name)}o(k,"findBoxByFrame");function q(e,n,t){if(!(t<0))for(let i=t;i>=0;i--){const a=e[i];if(a.swimlane.index!==n)return a}}o(q,"findBoxByLineIndex");function J(e,n){const t=n;if(ve(t.frame)||z(t.index,t.frame))return[];const i=k(e.boxes,t.frame);if(i===void 0)throw new Error(`Target box not found for frame ${t.frame.name}`);let a;return t.sourceFrame?a=k(e.boxes,t.sourceFrame):a=q(e.boxes,i.swimlane.index,t.index-1),a===void 0?[]:[{$kind:N,frame:t.frame,index:t.index,sourceBox:a,targetBox:i}]}o(J,"decidePositionRelation");function Q(e,n){const t=n,i={visual:{fill:"none",stroke:"#000"},source:{x:t.sourceBox.x,y:t.sourceBox.y},target:{x:t.targetBox.x,y:t.targetBox.y},sourceBox:t.sourceBox,targetBox:t.targetBox};return{...e,relations:[...e.relations,i]}}o(Q,"evolveRelationPositioned");var Me={[T]:V,[S]:J},Be={[$]:Y,[N]:Q};function Z(e,n){const t=Me[n.$kind];if(t==null)return[];const i=t(e,n);return g.debug("decided events",i),i}o(Z,"decide");function ee(e,n){const t=n.reduce((i,a)=>{const r=Be[a.$kind];return r==null?i:r(i,a)},e);return g.debug("evolve events",{state:e,newState:t,events:n}),t}o(ee,"evolve");function v(e,n){const t=Z(e,n);return ee(e,t)}o(v,"dispatch");var F={getConfig:ke,setOptions:we,getOptions:ye,clear:Pe,setAccTitle:me,getAccTitle:ce,getAccDescription:le,setAccDescription:de,setDiagramTitle:se,getDiagramTitle:oe,setAst:I,getDiagramProps:E,getState:O},Ee={parse:o(async e=>{const n=await be("eventmodeling",e);g.debug(n),F.setAst(n),re(n,F)},"parse")},Ae=D(),Re=Ae?.eventmodeling;function te(e,n){return t=>{const i=t.swimlane.y+n.swimlanePadding,a=e.append("g").attr("class","em-box");a.append("rect").attr("x",t.x).attr("y",i).attr("rx","3").attr("width",t.dimension.width).attr("height",t.dimension.height).attr("stroke",t.visual.stroke).attr("fill",t.visual.fill),a.append("foreignObject").attr("x",t.x+n.boxPadding).attr("y",i+10).attr("width",t.dimension.width-2*n.boxPadding).attr("height",t.dimension.height-2*n.boxPadding).append("xhtml:div").style("display","table").style("height","100%").style("width","100%").append("span").style("display","table-cell").style("text-align","center").style("vertical-align","middle").html(t.text)}}o(te,"renderD3Box");function ne(e,n){return e>n}o(ne,"dirUpwards");function ie(e,n,t,i){return a=>{const r=a.sourceBox.swimlane.y+n.swimlanePadding,d=a.targetBox.swimlane.y+n.swimlanePadding,l=ne(r,d),c=a.sourceBox.x+a.sourceBox.dimension.width*2/3,m=a.targetBox.x+a.targetBox.dimension.width/3;let x,u;g.debug(`rendering relation up=${l} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),l?(x=r,u=d+a.targetBox.dimension.height):(x=r+a.sourceBox.dimension.height,u=d);const h=i.emRelationStroke??a.visual.stroke;e.append("path").attr("class","em-relation").attr("fill",a.visual.fill).attr("stroke",h).attr("stroke-width","1").attr("marker-end",`url(#${t})`).attr("d",`M${c} ${x} L${m} ${u}`)}}o(ie,"renderD3Relation");function ae(e,n,t,i){return a=>{const r=e.append("g").attr("class","em-swimlane"),d=i.emSwimlaneBackgroundOdd??"rgb(250,250,250)",l=i.emSwimlaneBackgroundStroke??"rgb(240,240,240)";r.append("rect").attr("x",0).attr("y",a.y).attr("rx","3").attr("width",n+t.swimlanePadding).attr("height",a.height).attr("fill",d).attr("stroke",l),r.append("text").attr("font-weight",t.swimlaneTextFontWeight).attr("x",30).attr("y",a.y+30).text(a.label)}}o(ae,"renderD3Swimlane");var De=o(function(e,n,t,i){if(g.debug("in eventmodeling renderer",e+` `,"id:",n,t),!Re)throw new Error("EventModeling config not found");const a=i.db,{themeVariables:r,eventmodeling:d}=D(),l=ue(`[id="${n}"]`),c=a.getDiagramProps(),m=a.getState(),x=`em-arrowhead-${n}`,u=r.emArrowhead??"#000000";m.sortedSwimlanesArray.forEach(ae(l,m.maxR,c,r)),m.boxes.forEach(te(l,c)),m.relations.forEach(ie(l,c,x,r)),l.append("defs").append("marker").attr("id",x).attr("markerWidth","10").attr("markerHeight","7").attr("refX","10").attr("refY","3.5").attr("orient","auto").append("polygon").attr("points","0 0, 10 3.5, 0 7").attr("fill",u),xe(void 0,l,d?.padding??30,d?.useMaxWidth)},"draw"),Te={draw:De},$e=o(e=>"","getStyles"),Ne=$e,Ue={parser:Ee,db:F,renderer:Te,styles:Ne};export{Ue as diagram}; diff --git a/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js b/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-CAmFU1Cj.js similarity index 97% rename from apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js rename to apps/kimi-code/dist-web/assets/diagram-G47NLZAW-CAmFU1Cj.js index 646a8516187..ca7869de6dc 100644 --- a/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-BF9x_uf7.js +++ b/apps/kimi-code/dist-web/assets/diagram-G47NLZAW-CAmFU1Cj.js @@ -1,4 +1,4 @@ -import{p as me}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as w,W as ge,z as te,B as Q,F as ye,e as Se,l as ee,be as B,d as j,b as ve,a as xe,o as be,p as we,g as Ce,s as Te,D as Le,bf as $e,q as Ae}from"./mermaid.core-CJB1tAev.js";import{s as Fe}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{p as Ne}from"./cynefin-VYW2F7L2-BIlq342y.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Me(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function _e(){return this.eachAfter(Me)}function ke(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function ze(e,a){for(var n=this,l=[n],r,o,h=-1;n=l.pop();)if(e.call(a,n,++h,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ve(e,a){for(var n=this,l=[n],r=[],o,h,d,g=-1;n=l.pop();)if(r.push(n),o=n.children)for(h=0,d=o.length;h=0;)n+=l[r].value;a.value=n})}function Be(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function We(e){for(var a=this,n=Ee(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function Ee(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function Re(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function He(){return Array.from(this)}function Ie(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Oe(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*qe(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r=0;--d)r.push(o=h[d]=new U(h[d])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ue)}function Ge(){return ae(this).eachBefore(je)}function Xe(e){return e.children}function Ye(e){return Array.isArray(e)?e[1]:null}function je(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ue(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=ae.prototype={constructor:U,count:_e,each:ke,eachAfter:Ve,eachBefore:ze,find:De,sum:Pe,sort:Be,path:We,ancestors:Re,descendants:He,leaves:Ie,links:Oe,copy:Ge,[Symbol.iterator]:qe};function Ze(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function q(e){return function(){return e}}function Je(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ke(e,a,n,l,r){for(var o=e.children,h,d=-1,g=o.length,c=e.value&&(l-a)/e.value;++dN&&(N=c),M=u*u*E,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?l:1)},n})(et);function nt(){var e=at,a=!1,n=1,l=1,r=[0],o=O,h=O,d=O,g=O,c=O;function p(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u{$e(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Ae(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function oe(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(oe,"buildHierarchy");var lt=w((e,a)=>{me(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const h=o.item;if(!h)continue;const d=o.indent?parseInt(o.indent):0,g=rt(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};n.push(b)}const l=oe(n),r=w((o,h)=>{for(const d of o)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(l,0)},"populate"),rt=w(e=>e.name?String(e.name):"","getItemName"),ce={parser:{yy:void 0},parse:w(async e=>{try{const n=await Ne("treemap",e);ee.debug("Treemap AST:",n);const l=ce.parser?.yy;if(!(l instanceof ie))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");lt(n,l)}catch(a){throw ee.error("Error parsing treemap:",a),a}},"parse")},st=10,W=10,G=25,it=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),h=o.padding??st,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=te();if(!g)return;const p=d?30:0,b=ye(a),s=o.nodeWidth?o.nodeWidth*W:960,x=o.nodeHeight?o.nodeHeight*W:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),Se(b,v,S,o.useMaxWidth);let u;try{const t=o.valueFormat||",";if(t==="$0,0")u=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";u=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);u=w(f=>"$"+I(i||"")(f),"valueFormat")}else u=I(t)}catch(t){ee.error("Error creating format function:",t),u=I(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),E=ae(g).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),ne=nt().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?G+W:0).paddingInner(h).paddingLeft(t=>t.children&&t.children.length>0?W:0).paddingRight(t=>t.children&&t.children.length>0?W:0).paddingBottom(t=>t.children&&t.children.length>0?W:0).round(!0)(E),he=ne.descendants().filter(t=>t.children&&t.children.length>0),R=V.selectAll(".treemapSection").data(he).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",G),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>y(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>N(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=B({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("clip-path",(t,i)=>`url(#clip-section-${a}-${i})`).attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=j(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let T;o.showValues!==!1&&t.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=i.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){i.text("..."),_.getComputedTextLength()>m&&i.text("");break}if(i.text(z+"..."),_.getComputedTextLength()<=m)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?u(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const le=ne.leaves(),A=le.length>20,de=A?16:38,X=A?14:28,D=A?4:8,H=A?4:6,Z=A?2:4,re=A?8:10,J=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(le).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);Y.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("style",t=>B({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i=`text-anchor: middle; dominant-baseline: middle; font-size: ${de}px;fill:`+$(t.data.name)+";",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=j(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),T=f-2*Z,P=C-2*Z;if(TT&&m>D;)m--,i.style("font-size",`${m}px`);let F=Math.max(H,Math.min(X,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(H,Math.min(X,Math.round(m*_))),!(FT||m(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${X}px;fill:`+$(i.data.name)+";",C=B({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?u(i.value):"").each(function(i){const f=j(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=j(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(H,Math.min(X,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(i.y1-i.y0)/2+T/2+J;f.attr("y",F);const k=i.x1-i.x0,se=i.y1-i.y0-4,fe=k-2*Z;f.node().getComputedTextLength()>fe||F+m>se||m{const a=ge(),n=te(),l=Q(a,n.themeVariables),r=Q(ht,e),o=r.titleColor??l.titleColor,h=r.labelColor??l.textColor,d=r.valueColor??l.textColor;return` +import{p as me}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as w,W as ge,z as te,B as Q,F as ye,e as Se,l as ee,be as B,d as j,b as ve,a as xe,o as be,p as we,g as Ce,s as Te,D as Le,bf as $e,q as Ae}from"./mermaid.core-CsZwh_jB.js";import{s as Fe}from"./chunk-VR4S4FIN-Crv01XIW.js";import{p as Ne}from"./cynefin-VYW2F7L2-CD6doQLg.js";import{b as I}from"./defaultLocale-DX6XiGOO.js";import{o as K}from"./ordinal-Cboi1Yqb.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Me(e){var a=0,n=e.children,l=n&&n.length;if(!l)a=1;else for(;--l>=0;)a+=n[l].value;e.value=a}function _e(){return this.eachAfter(Me)}function ke(e,a){let n=-1;for(const l of this)e.call(a,l,++n,this);return this}function ze(e,a){for(var n=this,l=[n],r,o,h=-1;n=l.pop();)if(e.call(a,n,++h,this),r=n.children)for(o=r.length-1;o>=0;--o)l.push(r[o]);return this}function Ve(e,a){for(var n=this,l=[n],r=[],o,h,d,g=-1;n=l.pop();)if(r.push(n),o=n.children)for(h=0,d=o.length;h=0;)n+=l[r].value;a.value=n})}function Be(e){return this.eachBefore(function(a){a.children&&a.children.sort(e)})}function We(e){for(var a=this,n=Ee(a,e),l=[a];a!==n;)a=a.parent,l.push(a);for(var r=l.length;e!==n;)l.splice(r,0,e),e=e.parent;return l}function Ee(e,a){if(e===a)return e;var n=e.ancestors(),l=a.ancestors(),r=null;for(e=n.pop(),a=l.pop();e===a;)r=e,e=n.pop(),a=l.pop();return r}function Re(){for(var e=this,a=[e];e=e.parent;)a.push(e);return a}function He(){return Array.from(this)}function Ie(){var e=[];return this.eachBefore(function(a){a.children||e.push(a)}),e}function Oe(){var e=this,a=[];return e.each(function(n){n!==e&&a.push({source:n.parent,target:n})}),a}function*qe(){var e=this,a,n=[e],l,r,o;do for(a=n.reverse(),n=[];e=a.pop();)if(yield e,l=e.children)for(r=0,o=l.length;r=0;--d)r.push(o=h[d]=new U(h[d])),o.parent=l,o.depth=l.depth+1;return n.eachBefore(Ue)}function Ge(){return ae(this).eachBefore(je)}function Xe(e){return e.children}function Ye(e){return Array.isArray(e)?e[1]:null}function je(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function Ue(e){var a=0;do e.height=a;while((e=e.parent)&&e.height<++a)}function U(e){this.data=e,this.depth=this.height=0,this.parent=null}U.prototype=ae.prototype={constructor:U,count:_e,each:ke,eachAfter:Ve,eachBefore:ze,find:De,sum:Pe,sort:Be,path:We,ancestors:Re,descendants:He,leaves:Ie,links:Oe,copy:Ge,[Symbol.iterator]:qe};function Ze(e){if(typeof e!="function")throw new Error;return e}function O(){return 0}function q(e){return function(){return e}}function Je(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Ke(e,a,n,l,r){for(var o=e.children,h,d=-1,g=o.length,c=e.value&&(l-a)/e.value;++dN&&(N=c),M=u*u*E,$=Math.max(N/M,M/y),$>V){u-=c;break}V=$}h.push(g={value:u,dice:x1?l:1)},n})(et);function nt(){var e=at,a=!1,n=1,l=1,r=[0],o=O,h=O,d=O,g=O,c=O;function p(s){return s.x0=s.y0=0,s.x1=n,s.y1=l,s.eachBefore(b),r=[0],a&&s.eachBefore(Je),s}function b(s){var x=r[s.depth],S=s.x0+x,v=s.y0+x,u=s.x1-x,y=s.y1-x;u{$e(r)&&(n?.textStyles?n.textStyles.push(r):n.textStyles=[r]),n?.styles?n.styles.push(r):n.styles=[r]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){Ae(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function oe(e){if(!e.length)return[];const a=[],n=[];return e.forEach(l=>{const r={name:l.name,children:l.type==="Leaf"?void 0:[]};for(r.classSelector=l?.classSelector,l?.cssCompiledStyles&&(r.cssCompiledStyles=l.cssCompiledStyles),l.type==="Leaf"&&l.value!==void 0&&(r.value=l.value);n.length>0&&n[n.length-1].level>=l.level;)n.pop();if(n.length===0)a.push(r);else{const o=n[n.length-1].node;o.children?o.children.push(r):o.children=[r]}l.type!=="Leaf"&&n.push({node:r,level:l.level})}),a}w(oe,"buildHierarchy");var lt=w((e,a)=>{me(e,a);const n=[];for(const o of e.TreemapRows??[])o.$type==="ClassDefStatement"&&a.addClass(o.className??"",o.styleText??"");for(const o of e.TreemapRows??[]){const h=o.item;if(!h)continue;const d=o.indent?parseInt(o.indent):0,g=rt(h),c=h.classSelector?a.getStylesForClass(h.classSelector):[],p=c.length>0?c:void 0,b={level:d,name:g,type:h.$type,value:h.value,classSelector:h.classSelector,cssCompiledStyles:p};n.push(b)}const l=oe(n),r=w((o,h)=>{for(const d of o)a.addNode(d,h),d.children&&d.children.length>0&&r(d.children,h+1)},"addNodesRecursively");r(l,0)},"populate"),rt=w(e=>e.name?String(e.name):"","getItemName"),ce={parser:{yy:void 0},parse:w(async e=>{try{const n=await Ne("treemap",e);ee.debug("Treemap AST:",n);const l=ce.parser?.yy;if(!(l instanceof ie))throw new Error("parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");lt(n,l)}catch(a){throw ee.error("Error parsing treemap:",a),a}},"parse")},st=10,W=10,G=25,it=w((e,a,n,l)=>{const r=l.db,o=r.getConfig(),h=o.padding??st,d=r.getDiagramTitle(),g=r.getRoot(),{themeVariables:c}=te();if(!g)return;const p=d?30:0,b=ye(a),s=o.nodeWidth?o.nodeWidth*W:960,x=o.nodeHeight?o.nodeHeight*W:500,S=s,v=x+p;b.attr("viewBox",`0 0 ${S} ${v}`),Se(b,v,S,o.useMaxWidth);let u;try{const t=o.valueFormat||",";if(t==="$0,0")u=w(i=>"$"+I(",")(i),"valueFormat");else if(t.startsWith("$")&&t.includes(",")){const i=/\.\d+/.exec(t),f=i?i[0]:"";u=w(C=>"$"+I(","+f)(C),"valueFormat")}else if(t.startsWith("$")){const i=t.substring(1);u=w(f=>"$"+I(i||"")(f),"valueFormat")}else u=I(t)}catch(t){ee.error("Error creating format function:",t),u=I(",")}const y=K().range(["transparent",c.cScale0,c.cScale1,c.cScale2,c.cScale3,c.cScale4,c.cScale5,c.cScale6,c.cScale7,c.cScale8,c.cScale9,c.cScale10,c.cScale11]),N=K().range(["transparent",c.cScalePeer0,c.cScalePeer1,c.cScalePeer2,c.cScalePeer3,c.cScalePeer4,c.cScalePeer5,c.cScalePeer6,c.cScalePeer7,c.cScalePeer8,c.cScalePeer9,c.cScalePeer10,c.cScalePeer11]),$=K().range([c.cScaleLabel0,c.cScaleLabel1,c.cScaleLabel2,c.cScaleLabel3,c.cScaleLabel4,c.cScaleLabel5,c.cScaleLabel6,c.cScaleLabel7,c.cScaleLabel8,c.cScaleLabel9,c.cScaleLabel10,c.cScaleLabel11]);d&&b.append("text").attr("x",S/2).attr("y",p/2).attr("class","treemapTitle").attr("text-anchor","middle").attr("dominant-baseline","middle").text(d);const V=b.append("g").attr("transform",`translate(0, ${p})`).attr("class","treemapContainer"),E=ae(g).sum(t=>t.value??0).sort((t,i)=>(i.value??0)-(t.value??0)),ne=nt().size([s,x]).paddingTop(t=>t.children&&t.children.length>0?G+W:0).paddingInner(h).paddingLeft(t=>t.children&&t.children.length>0?W:0).paddingRight(t=>t.children&&t.children.length>0?W:0).paddingBottom(t=>t.children&&t.children.length>0?W:0).round(!0)(E),he=ne.descendants().filter(t=>t.children&&t.children.length>0),R=V.selectAll(".treemapSection").data(he).enter().append("g").attr("class","treemapSection").attr("transform",t=>`translate(${t.x0},${t.y0})`);R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",G).attr("class","treemapSectionHeader").attr("fill","none").attr("fill-opacity",.6).attr("stroke-width",.6).attr("style",t=>t.depth===0?"display: none;":""),R.append("clipPath").attr("id",(t,i)=>`clip-section-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-12)).attr("height",G),R.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class",(t,i)=>`treemapSection section${i}`).attr("fill",t=>y(t.data.name)).attr("fill-opacity",.6).attr("stroke",t=>N(t.data.name)).attr("stroke-width",2).attr("stroke-opacity",.4).attr("style",t=>{if(t.depth===0)return"display: none;";const i=B({cssCompiledStyles:t.data.cssCompiledStyles});return i.nodeStyles+";"+i.borderStyles.join(";")}),R.append("text").attr("class","treemapSectionLabel").attr("x",6).attr("y",G/2).attr("dominant-baseline","middle").text(t=>t.depth===0?"":t.data.name).attr("font-weight","bold").attr("clip-path",(t,i)=>`url(#clip-section-${a}-${i})`).attr("style",t=>{if(t.depth===0)return"display: none;";const i="dominant-baseline: middle; font-size: 12px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).each(function(t){if(t.depth===0)return;const i=j(this),f=t.data.name;i.text(f);const C=t.x1-t.x0,L=6;let T;o.showValues!==!1&&t.value?T=C-10-30-10-L:T=C-L-6;const m=Math.max(15,T),_=i.node();if(_.getComputedTextLength()>m){let z=f;for(;z.length>0;){if(z=f.substring(0,z.length-1),z.length===0){i.text("..."),_.getComputedTextLength()>m&&i.text("");break}if(i.text(z+"..."),_.getComputedTextLength()<=m)break}}}),o.showValues!==!1&&R.append("text").attr("class","treemapSectionValue").attr("x",t=>t.x1-t.x0-10).attr("y",G/2).attr("text-anchor","end").attr("dominant-baseline","middle").text(t=>t.value?u(t.value):"").attr("font-style","italic").attr("style",t=>{if(t.depth===0)return"display: none;";const i="text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:"+$(t.data.name)+"; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")});const le=ne.leaves(),A=le.length>20,de=A?16:38,X=A?14:28,D=A?4:8,H=A?4:6,Z=A?2:4,re=A?8:10,J=A?1:2,Y=V.selectAll(".treemapLeafGroup").data(le).enter().append("g").attr("class",(t,i)=>`treemapNode treemapLeafGroup leaf${i}${t.data.classSelector?` ${t.data.classSelector}`:""}x`).attr("transform",t=>`translate(${t.x0},${t.y0})`);Y.append("rect").attr("width",t=>t.x1-t.x0).attr("height",t=>t.y1-t.y0).attr("class","treemapLeaf").attr("fill",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("style",t=>B({cssCompiledStyles:t.data.cssCompiledStyles}).nodeStyles).attr("fill-opacity",.3).attr("stroke",t=>t.parent?y(t.parent.data.name):y(t.data.name)).attr("stroke-width",3),Y.append("clipPath").attr("id",(t,i)=>`clip-${a}-${i}`).append("rect").attr("width",t=>Math.max(0,t.x1-t.x0-4)).attr("height",t=>Math.max(0,t.y1-t.y0-4)),Y.append("text").attr("class","treemapLabel").attr("x",t=>(t.x1-t.x0)/2).attr("y",t=>(t.y1-t.y0)/2).attr("style",t=>{const i=`text-anchor: middle; dominant-baseline: middle; font-size: ${de}px;fill:`+$(t.data.name)+";",f=B({cssCompiledStyles:t.data.cssCompiledStyles});return i+f.labelStyles.replace("color:","fill:")}).attr("clip-path",(t,i)=>`url(#clip-${a}-${i})`).text(t=>t.data.name).each(function(t){const i=j(this),f=t.x1-t.x0,C=t.y1-t.y0,L=i.node(),T=f-2*Z,P=C-2*Z;if(TT&&m>D;)m--,i.style("font-size",`${m}px`);let F=Math.max(H,Math.min(X,Math.round(m*_))),k=m+J+F;for(;k>P&&m>D&&(m--,F=Math.max(H,Math.min(X,Math.round(m*_))),!(FT||m(i.x1-i.x0)/2).attr("y",function(i){return(i.y1-i.y0)/2}).attr("style",i=>{const f=`text-anchor: middle; dominant-baseline: hanging; font-size: ${X}px;fill:`+$(i.data.name)+";",C=B({cssCompiledStyles:i.data.cssCompiledStyles});return f+C.labelStyles.replace("color:","fill:")}).attr("clip-path",(i,f)=>`url(#clip-${a}-${f})`).text(i=>i.value?u(i.value):"").each(function(i){const f=j(this),C=this.parentNode;if(!C){f.style("display","none");return}const L=j(C).select(".treemapLabel");if(L.empty()||L.style("display")==="none"){f.style("display","none");return}const T=parseFloat(L.style("font-size")),m=Math.max(H,Math.min(X,Math.round(T*.6)));f.style("font-size",`${m}px`);const F=(i.y1-i.y0)/2+T/2+J;f.attr("y",F);const k=i.x1-i.x0,se=i.y1-i.y0-4,fe=k-2*Z;f.node().getComputedTextLength()>fe||F+m>se||m{const a=ge(),n=te(),l=Q(a,n.themeVariables),r=Q(ht,e),o=r.titleColor??l.titleColor,h=r.labelColor??l.textColor,d=r.valueColor??l.textColor;return` .treemapNode.section { stroke: ${r.sectionStrokeColor}; stroke-width: ${r.sectionStrokeWidth}; diff --git a/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js b/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-Db_YtFB_.js similarity index 93% rename from apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js rename to apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-Db_YtFB_.js index bc899383c68..7a947fef915 100644 --- a/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-DUn2m-AO.js +++ b/apps/kimi-code/dist-web/assets/diagram-NH7WQ7WH-Db_YtFB_.js @@ -1,4 +1,4 @@ -import{p as B}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as b,B as u,F as $,e as C,l as m,b as S,a as D,o as T,p as z,g as F,s as P,z as E,D as A,q as W}from"./mermaid.core-CJB1tAev.js";import{p as _}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var N=A.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=z,this.getAccDescription=F,this.setAccDescription=P}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),j={draw:I},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},G=b(({packet:t}={})=>{const e=u(q,t);return` +import{p as B}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as b,B as u,F as $,e as C,l as m,b as S,a as D,o as T,p as z,g as F,s as P,z as E,D as A,q as W}from"./mermaid.core-CsZwh_jB.js";import{p as _}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var N=A.packet,w=class{constructor(){this.packet=[],this.setAccTitle=S,this.getAccTitle=D,this.setDiagramTitle=T,this.getDiagramTitle=z,this.getAccDescription=F,this.setAccDescription=P}static{b(this,"PacketDB")}getConfig(){const t=u({...N,...E().packet});return t.showBits&&(t.paddingY+=10),t}getPacket(){return this.packet}pushWord(t){t.length>0&&this.packet.push(t)}clear(){W(),this.packet=[]}},L=1e4,M=b((t,e)=>{B(t,e);let r=-1,o=[],n=1;const{bitsPerRow:l}=e.getConfig();for(let{start:a,end:i,bits:d,label:c}of t.blocks){if(a!==void 0&&i!==void 0&&i{if(t.start===void 0)throw new Error("start should have been set during first phase");if(t.end===void 0)throw new Error("end should have been set during first phase");if(t.start>t.end)throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`);if(t.end+1<=e*r)return[t,void 0];const o=e*r-1,n=e*r;return[{start:t.start,end:o,label:t.label,bits:o-t.start},{start:n,end:t.end,label:t.label,bits:t.end-n}]},"getNextFittingBlock"),v={parser:{yy:void 0},parse:b(async t=>{const e=await _("packet",t),r=v.parser?.yy;if(!(r instanceof w))throw new Error("parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");m.debug(e),M(e,r)},"parse")},I=b((t,e,r,o)=>{const n=o.db,l=n.getConfig(),{rowHeight:a,paddingY:i,bitWidth:d,bitsPerRow:c}=l,p=n.getPacket(),s=n.getDiagramTitle(),h=a+i,g=h*(p.length+1)-(s?0:a),k=d*c+2,f=$(e);f.attr("viewBox",`0 0 ${k} ${g}`),C(f,g,k,l.useMaxWidth);for(const[x,y]of p.entries())O(f,y,x,l);f.append("text").text(s).attr("x",k/2).attr("y",g-h/2).attr("dominant-baseline","middle").attr("text-anchor","middle").attr("class","packetTitle")},"draw"),O=b((t,e,r,{rowHeight:o,paddingX:n,paddingY:l,bitWidth:a,bitsPerRow:i,showBits:d})=>{const c=t.append("g"),p=r*(o+l)+l;for(const s of e){const h=s.start%i*a+1,g=(s.end-s.start+1)*a-n;if(c.append("rect").attr("x",h).attr("y",p).attr("width",g).attr("height",o).attr("class","packetBlock"),c.append("text").attr("x",h+g/2).attr("y",p+o/2).attr("class","packetLabel").attr("dominant-baseline","middle").attr("text-anchor","middle").text(s.label),!d)continue;const k=s.end===s.start,f=p-2;c.append("text").attr("x",h+(k?g/2:0)).attr("y",f).attr("class","packetByte start").attr("dominant-baseline","auto").attr("text-anchor",k?"middle":"start").text(s.start),k||c.append("text").attr("x",h+g).attr("y",f).attr("class","packetByte end").attr("dominant-baseline","auto").attr("text-anchor","end").text(s.end)}},"drawWord"),j={draw:I},q={byteFontSize:"10px",startByteColor:"black",endByteColor:"black",labelColor:"black",labelFontSize:"12px",titleColor:"black",titleFontSize:"14px",blockStrokeColor:"black",blockStrokeWidth:"1",blockFillColor:"#efefef"},G=b(({packet:t}={})=>{const e=u(q,t);return` .packetByte { font-size: ${e.byteFontSize}; } diff --git a/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js b/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP--Kd1fr8_.js similarity index 96% rename from apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js rename to apps/kimi-code/dist-web/assets/diagram-OA4YK3LP--Kd1fr8_.js index dd7fa5554fd..6252456c78f 100644 --- a/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP-BOIp7TNe.js +++ b/apps/kimi-code/dist-web/assets/diagram-OA4YK3LP--Kd1fr8_.js @@ -1,4 +1,4 @@ -import{I as X}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{p as O}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{o as G,b as Y,s as F,p as P,g as j,a as q,_ as f,B as A,l as D,F as Z,e as U,z as N,q as J,i as K,ai as Q,D as ee,aj as te}from"./mermaid.core-CJB1tAev.js";import{p as ne}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(` +import{I as X}from"./chunk-2Q5K7J3B-Dntoz8YC.js";import{p as O}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{o as G,b as Y,s as F,p as P,g as j,a as q,_ as f,B as A,l as D,F as Z,e as U,z as N,q as J,i as K,ai as Q,D as ee,aj as te}from"./mermaid.core-CsZwh_jB.js";import{p as ne}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var E=/[─━│┃└┗├┣]/,S=/[└┗├┣]/,re=/[─━]/,V=/^[\s│┃]+$/,$=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,k=/^\s*%%/,ie=" ";function L(n){return n.some(e=>E.test(e))}f(L,"isBoxDrawingFormat");function _(n){for(const e of n){const t=S.exec(e);if(t?.index&&t.index>0)return t.index}return 4}f(_,"inferSegmentWidth");function M(n,e){return n.replace(/\bline\s+(\d+)\b/gi,(t,r)=>{const i=parseInt(r,10),a=e.get(i);return a?`line ${a}`:t})}f(M,"remapErrorLines");function R(n){const e=n.split(` `),t=new Map;let r=-1;for(const[s,o]of e.entries())if(o.trim()==="treeView-beta"){r=s;break}if(r===-1)return{text:n,lineMap:t};const i=[];for(let s=r+1;s({cnt:1,stack:[{id:0,level:-1,name:"/",nodeType:"directory",children:[]}]})),oe=f(()=>{x.reset(),J()},"clear"),se=f(()=>x.records.stack[0],"getRoot"),ae=f(()=>x.records.cnt,"getCount"),ce=ee.treeView,le=f(()=>A(ce,N().treeView),"getConfig"),de=f((n,e,t,r,i,a)=>{for(;n<=x.records.stack[x.records.stack.length-1].level;)x.records.stack.pop();const c={id:x.records.cnt++,level:n,name:e,nodeType:t,icon:i,cssClass:r,description:a,children:[]};x.records.stack[x.records.stack.length-1].children.push(c),x.records.stack.push(c)},"addNode"),he={clear:oe,addNode:de,getRoot:se,getCount:ae,getConfig:le,getAccTitle:q,getAccDescription:j,getDiagramTitle:P,setAccDescription:F,setAccTitle:Y,setDiagramTitle:G},I=he,pe=f(n=>{O(n,I);for(const e of n.nodes){const t=typeof e.indent=="number"?e.indent:0;let r=e.name;const i=r.endsWith("/");i&&(r=r.slice(0,-1));const a=i?"directory":"file",c=e.classAnnotation||void 0,l=e.iconAnnotation,s=l!==void 0?l||"none":void 0,o=e.descAnnotation||void 0,h=o?K(o,N()):void 0;I.addNode(t,r,a,c,s,h)}},"populate"),fe={parse:f(async n=>{const{text:e,lineMap:t}=R(n);try{const r=await ne("treeView",e);D.debug(r),pe(r)}catch(r){throw t.size>0&&r instanceof Error&&(r.message=M(r.message,t)),r}},"parse")},b={prefix:"mermaid-treeview",height:24,width:24,icons:{folder:{body:''},file:{body:''}}};function z(n,e){const t=e?.filenameIcons?.[n];if(t)return t;const r=n.lastIndexOf(".");if(r>0){const i=n.substring(r).toLowerCase(),a=e?.extensionIcons;return a?.[i]??a?.[i.slice(1)]}}f(z,"detectIcon");function C(n,e){return n.includes(":")?n:n in b.icons||!e?`${b.prefix}:${n}`:`${e}:${n}`}f(C,"qualifyIcon");function B(n,e){if(n.icon!=="none"){if(n.icon)return C(n.icon,e.defaultIconPack);if(e.showIcons){if(n.nodeType==="file"){const t=z(n.name,e);if(t==="none")return;if(t)return C(t,e.defaultIconPack)}return`${b.prefix}:${n.nodeType==="directory"?"folder":"file"}`}}}f(B,"getNodeIcon");te([{name:b.prefix,icons:b}]);var y=14,ge=4,ue=16,H=f((n,e)=>`tv-icon-${n}-${e.replace(/[^\w-]/g,"-")}`,"iconSymbolId"),we=f(async(n,e,t,r)=>{const i=new Set,a=f(s=>{const o=B(s,t);o&&i.add(o),s.children.forEach(a)},"collect");if(a(e),i.size===0)return;const c=await Promise.all([...i].map(async s=>({icon:s,svg:await Q(s,{height:y,width:y})}))),l=n.append("defs");for(const{icon:s,svg:o}of c)l.append("g").attr("id",H(r,s)).html(o)},"injectIconDefs"),me=f((n,e,t,r,i,a)=>{const c=r.append("g");let l="treeView-node-label";t.nodeType==="directory"&&(l+=" treeView-node-dir"),t.cssClass&&(l+=` ${t.cssClass}`);const s=y+ge,o=B(t,i),h=o!==void 0;o&&c.append("use").attr("xlink:href",`#${H(a,o)}`).attr("x",n+i.paddingX).attr("y",e+i.paddingY).attr("class","treeView-node-icon");const p=c.append("text").text(t.name).attr("dominant-baseline","middle").attr("class",l),{height:d,width:w}=p.node().getBBox(),g=d+i.paddingY*2,m=n+i.paddingX+(h?s:0);p.attr("x",m),p.attr("y",e+g/2);const u=m+w,v=w+i.paddingX*2+(h?s:0);return t.BBox={x:n,y:e,width:v,height:g},t.cssClass?.split(/\s+/).includes("highlight")&&c.insert("rect",":first-child").attr("x",n).attr("y",e+1).attr("width",0).attr("height",g-2).attr("rx",3).attr("class","treeView-highlight-bg"),{node:t,nodeGroup:c,labelRightEdge:u,centerY:e+g/2}},"positionLabel"),T=f((n,e,t,r,i,a)=>n.append("line").attr("x1",e).attr("y1",t).attr("x2",r).attr("y2",i).attr("stroke-width",a).attr("class","treeView-node-line"),"positionLine"),xe=f((n,e,t,r)=>{let i=0,a=0;const c=[],l=f((h,p,d,w)=>{const g=w*(d.rowIndent+d.paddingX),m=me(g,i,p,h,d,r);c.push(m);const{height:u,width:v}=p.BBox;T(h,g-d.rowIndent,i+u/2,g,i+u/2,d.lineThickness),a=Math.max(a,g+v),i+=u},"drawNode"),s=f((h,p=0)=>{l(n,h,t,p),h.children.forEach(m=>{s(m,p+1)});const{x:d,y:w,height:g}=h.BBox;if(h.children.length){const{y:m,height:u}=h.children[h.children.length-1].BBox;T(n,d+t.paddingX,w+g,d+t.paddingX,m+u/2+t.lineThickness/2,t.lineThickness)}},"processNode");s(e);const o=c.filter(h=>h.node.description);if(o.length>0){const p=Math.max(...c.map(d=>d.labelRightEdge))+ue;for(const d of o){const g=d.nodeGroup.append("text").text(d.node.description).attr("dominant-baseline","middle").attr("class","treeView-node-description").attr("x",p).attr("y",d.centerY).node().getBBox();a=Math.max(a,p+g.width+t.paddingX)}}for(const h of c)if(h.node.cssClass?.split(/\s+/).includes("highlight")){const p=h.nodeGroup.select(".treeView-highlight-bg");if(!p.empty()){const d=a-h.node.BBox.x+8;p.attr("width",d),a=Math.max(a,h.node.BBox.x+d+2)}}return{totalHeight:i,totalWidth:a}},"drawTree"),ve=f(async(n,e,t,r)=>{D.debug(`Rendering treeView diagram `+n);const i=r.db,a=i.getRoot(),c=i.getConfig(),l=Z(e);await we(l,a,c,e);const s=l.append("g");s.attr("class","tree-view");const{totalHeight:o,totalWidth:h}=xe(s,a,c,e);l.attr("viewBox",`-${c.lineThickness/2} 0 ${h} ${o}`),U(l,o,h,c.useMaxWidth)},"draw"),be={draw:ve},Ie=be,Ce={labelFontSize:"16px",labelColor:"black",lineColor:"black",iconColor:"#546e7a",descriptionColor:"#6a9955",highlightBg:"rgba(255, 193, 7, 0.15)",highlightStroke:"#ffc107"},ye=f(({treeView:n})=>{const{labelFontSize:e,labelColor:t,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:c,highlightStroke:l}=A(Ce,n);return` diff --git a/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js b/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-QxbY7aVv.js similarity index 95% rename from apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js rename to apps/kimi-code/dist-web/assets/diagram-WEI45ONY-QxbY7aVv.js index b2a80168d0f..118ab97a729 100644 --- a/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-CFwFRAWa.js +++ b/apps/kimi-code/dist-web/assets/diagram-WEI45ONY-QxbY7aVv.js @@ -1,4 +1,4 @@ -import{p as k}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{s as R,g as F,p as I,o as _,a as D,b as E,_ as c,F as z,q as P,B as y,z as C,D as G,l as B,W,e as V}from"./mermaid.core-CJB1tAev.js";import{p as H}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var m={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"},w={axes:[],curves:[],options:m},x=structuredClone(w),j=G.radar,q=c(()=>y({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),N=c(()=>x.curves,"getCurves"),U=c(()=>x.options,"getOptions"),X=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{P(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:J,getConfig:q,clear:K,setAccTitle:E,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:F,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=z(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;ry({...j,...C().radar}),"getConfig"),b=c(()=>x.axes,"getAxes"),N=c(()=>x.curves,"getCurves"),U=c(()=>x.options,"getOptions"),X=c(a=>{x.axes=a.map(t=>({name:t.name,label:t.label??t.name}))},"setAxes"),Y=c(a=>{x.curves=a.map(t=>({name:t.name,label:t.label??t.name,entries:Z(t.entries)}))},"setCurves"),Z=c(a=>{if(a[0].axis==null)return a.map(e=>e.value);const t=b();if(t.length===0)throw new Error("Axes must be populated before curves for reference entries");return t.map(e=>{const r=a.find(s=>s.axis?.$refText===e.name);if(r===void 0)throw new Error("Missing entry for axis "+e.label);return r.value})},"computeCurveEntries"),J=c(a=>{const t=a.reduce((e,r)=>(e[r.name]=r,e),{});x.options={showLegend:t.showLegend?.value??m.showLegend,ticks:t.ticks?.value??m.ticks,max:t.max?.value??m.max,min:t.min?.value??m.min,graticule:t.graticule?.value??m.graticule}},"setOptions"),K=c(()=>{P(),x=structuredClone(w)},"clear"),$={getAxes:b,getCurves:N,getOptions:U,setAxes:X,setCurves:Y,setOptions:J,getConfig:q,clear:K,setAccTitle:E,getAccTitle:D,setDiagramTitle:_,getDiagramTitle:I,getAccDescription:F,setAccDescription:R},Q=c(a=>{k(a,$);const{axes:t,curves:e,options:r}=a;$.setAxes(t),$.setCurves(e),$.setOptions(r)},"populate"),tt={parse:c(async a=>{const t=await H("radar",a);B.debug(t),Q(t)},"parse")},et=c((a,t,e,r)=>{const s=r.db,i=s.getAxes(),l=s.getCurves(),n=s.getOptions(),o=s.getConfig(),d=s.getDiagramTitle(),p=z(t),u=at(p,o),g=n.max??Math.max(...l.map(f=>Math.max(...f.entries))),h=n.min,v=Math.min(o.width,o.height)/2;rt(u,i,v,n.ticks,n.graticule),st(u,i,v,o),A(u,i,l,h,g,n.graticule,o),T(u,l,n.showLegend,o),u.append("text").attr("class","radarTitle").text(d).attr("x",0).attr("y",-o.height/2-o.marginTop)},"draw"),at=c((a,t)=>{const e=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,s={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return V(a,r,e,t.useMaxWidth??!0),a.attr("viewBox",`0 0 ${e} ${r}`).attr("overflow","visible"),a.append("g").attr("transform",`translate(${s.x}, ${s.y})`)},"drawFrame"),rt=c((a,t,e,r,s)=>{if(s==="circle")for(let i=0;i{const u=2*p*Math.PI/i-Math.PI/2,g=n*Math.cos(u),h=n*Math.sin(u);return`${g},${h}`}).join(" ");a.append("polygon").attr("points",o).attr("class","radarGraticule")}}},"drawGraticule"),st=c((a,t,e,r)=>{const s=t.length;for(let i=0;i.01?"start":o<-.01?"end":"middle",u=d>.01?"hanging":d<-.01?"auto":"central",g=4;a.append("text").text(l).attr("x",e*r.axisLabelFactor*o+g*o).attr("y",e*r.axisLabelFactor*d+g*d).attr("text-anchor",p).attr("dominant-baseline",u).attr("class","radarAxisLabel")}},"drawAxes");function A(a,t,e,r,s,i,l){const n=t.length,o=Math.min(l.width,l.height)/2;e.forEach((d,p)=>{if(d.entries.length!==n)return;const u=d.entries.map((g,h)=>{const v=2*Math.PI*h/n-Math.PI/2,f=M(g,r,s,o),S=f*Math.cos(v),O=f*Math.sin(v);return{x:S,y:O}});i==="circle"?a.append("path").attr("d",L(u,l.curveTension)).attr("class",`radarCurve-${p}`):i==="polygon"&&a.append("polygon").attr("points",u.map(g=>`${g.x},${g.y}`).join(" ")).attr("class",`radarCurve-${p}`)})}c(A,"drawCurves");function M(a,t,e,r){const s=Math.min(Math.max(a,t),e);return r*(s-t)/(e-t)}c(M,"relativeRadius");function L(a,t){const e=a.length;let r=`M${a[0].x},${a[0].y}`;for(let s=0;s{const d=a.append("g").attr("transform",`translate(${s}, ${i+o*l})`);d.append("rect").attr("width",12).attr("height",12).attr("class",`radarLegendBox-${o}`),d.append("text").attr("x",16).attr("y",0).attr("class","radarLegendText").text(n.label)})}c(T,"drawLegend");var nt={draw:et},ot=c((a,t)=>{let e="";for(let r=0;r{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; +import{g as l,r as m,d as n}from"./chunk-MOJQB5TN-CuHpGhX-.js";import{p}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as t,l as o}from"./mermaid.core-CsZwh_jB.js";import{M as u,a as f}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var c=f().RailroadEbnf.parser.LangiumParser,s=t(e=>{const r=e.alternatives.map(E);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformChoice"),E=t(e=>{const r=e.elements.map(d);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),i=t(e=>{switch(e.$type){case"EbnfTerminal":return{type:"terminal",value:e.value};case"EbnfNonTerminal":return{type:"nonterminal",name:e.name};case"EbnfSpecial":return{type:"special",text:e.text};case"EbnfGroup":return s(e.element);case"EbnfOptional":return{type:"optional",element:s(e.element)};case"EbnfRepetition":return{type:"repetition",element:s(e.element),min:0,max:1/0};default:throw new Error(`Unsupported EBNF primary node: ${e.$type}`)}},"transformPrimary"),b=t((e,r)=>{switch(r.$type){case"EbnfOptionalPostfix":return{type:"optional",element:e};case"EbnfZeroOrMorePostfix":return{type:"repetition",element:e,min:0,max:1/0};case"EbnfOneOrMorePostfix":return{type:"repetition",element:e,min:1,max:1/0};case"EbnfExceptionPostfix":return{type:"sequence",elements:[e,{type:"terminal",value:"-"},i(r.except)]};default:throw new Error(`Unsupported EBNF postfix node: ${r.$type}`)}},"transformPostfix"),d=t(e=>e.postfixes.reduce((r,a)=>b(r,a),i(e.base)),"transformTerm"),y=t(e=>({name:e.name,definition:s(e.definition)}),"transformRule"),v=t(e=>{p(e,n),e.title&&n.setTitle(e.title),e.rules.map(r=>n.addRule(y(r)))},"populateDb"),g={parse:t(e=>{n.clear(),o.debug("[EBNF Parser] Starting Langium parse");const r=c.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const a=r.value;o.debug("[EBNF Parser] Parsed rules:",a.rules.length),v(a),o.debug("[EBNF Parser] Parse complete")},"parse"),parser:{yy:n}},S={parser:g,db:n,renderer:m,styles:l};export{S as diagram}; diff --git a/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js b/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-CKt0tq4n.js similarity index 99% rename from apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js rename to apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-CKt0tq4n.js index 317317275ff..21939aaa8f7 100644 --- a/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-DVzumNgk.js +++ b/apps/kimi-code/dist-web/assets/erDiagram-Q63AITRT-CKt0tq4n.js @@ -1,4 +1,4 @@ -import{g as Mt}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Bt}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as l,b as Ft,a as Yt,s as Pt,g as zt,o as Gt,p as Kt,c as it,l as V,q as Ut,r as Zt,t as jt,u as Wt,v as qt,x as Qt,d as Xt,y as Ht}from"./mermaid.core-CJB1tAev.js";import{c as Jt}from"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var _t=(function(){var e=l(function(I,n,c,o){for(c=c||{},o=I.length;o--;c[I[o]]=n);return c},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],h=[1,10],a=[1,11],u=[1,12],d=[1,13],y=[1,23],f=[1,24],m=[1,25],j=[1,26],W=[1,27],S=[1,19],q=[1,28],M=[1,29],D=[1,20],R=[1,18],T=[1,21],C=[1,22],nt=[1,36],at=[1,37],ct=[1,38],ot=[1,39],lt=[1,40],B=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],O=[1,45],N=[1,46],F=[1,55],Y=[40,48,50,51,52,71,72],P=[1,66],z=[1,64],A=[1,61],G=[1,65],K=[1,67],Q=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],gt=[66,67,68,69,70],bt=[1,85],kt=[1,84],mt=[1,82],Et=[1,83],St=[6,10,42,47],L=[6,10,13,41,42,47,48,49],X=[1,93],H=[1,92],J=[1,91],U=[19,58],Tt=[1,102],Ot=[1,101],ht=[19,58,61,63],ut={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:l(function(n,c,o,r,p,t,Z){var s=t.length-1;switch(p){case 1:break;case 2:this.$=[];break;case 3:t[s-1].push(t[s]),this.$=t[s-1];break;case 4:case 5:this.$=t[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[s-4]),r.addEntity(t[s-2]),r.addRelationship(t[s-4],t[s],t[s-2],t[s-3]);break;case 9:r.addEntity(t[s-8]),r.addEntity(t[s-4]),r.addRelationship(t[s-8],t[s],t[s-4],t[s-5]),r.setClass([t[s-8]],t[s-6]),r.setClass([t[s-4]],t[s-2]);break;case 10:r.addEntity(t[s-6]),r.addEntity(t[s-2]),r.addRelationship(t[s-6],t[s],t[s-2],t[s-3]),r.setClass([t[s-6]],t[s-4]);break;case 11:r.addEntity(t[s-6]),r.addEntity(t[s-4]),r.addRelationship(t[s-6],t[s],t[s-4],t[s-5]),r.setClass([t[s-4]],t[s-2]);break;case 12:r.addEntity(t[s-3]),r.addAttributes(t[s-3],t[s-1]);break;case 13:r.addEntity(t[s-5]),r.addAttributes(t[s-5],t[s-1]),r.setClass([t[s-5]],t[s-3]);break;case 14:r.addEntity(t[s-2]);break;case 15:r.addEntity(t[s-4]),r.setClass([t[s-4]],t[s-2]);break;case 16:r.addEntity(t[s]);break;case 17:r.addEntity(t[s-2]),r.setClass([t[s-2]],t[s]);break;case 18:r.addEntity(t[s-6],t[s-4]),r.addAttributes(t[s-6],t[s-1]);break;case 19:r.addEntity(t[s-8],t[s-6]),r.addAttributes(t[s-8],t[s-1]),r.setClass([t[s-8]],t[s-3]);break;case 20:r.addEntity(t[s-5],t[s-3]);break;case 21:r.addEntity(t[s-7],t[s-5]),r.setClass([t[s-7]],t[s-2]);break;case 22:r.addEntity(t[s-3],t[s-1]);break;case 23:r.addEntity(t[s-5],t[s-3]),r.setClass([t[s-5]],t[s]);break;case 24:case 25:this.$=t[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[s-3],r.addClass(t[s-2],t[s-1]);break;case 37:case 38:case 59:case 68:this.$=[t[s]];break;case 39:case 40:this.$=t[s-2].concat([t[s]]);break;case 41:this.$=t[s-2],r.setClass(t[s-1],t[s]);break;case 42:this.$=t[s-3],r.addCssStyles(t[s-2],t[s-1]);break;case 43:this.$=[t[s]];break;case 44:t[s-2].push(t[s]),this.$=t[s-2];break;case 46:this.$=t[s-1]+t[s];break;case 54:case 80:case 81:this.$=t[s].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=t[s];break;case 60:t[s].push(t[s-1]),this.$=t[s];break;case 61:this.$={type:t[s-1],name:t[s]};break;case 62:this.$={type:t[s-2],name:t[s-1],keys:t[s]};break;case 63:this.$={type:t[s-2],name:t[s-1],comment:t[s]};break;case 64:this.$={type:t[s-3],name:t[s-2],keys:t[s-1],comment:t[s]};break;case 65:case 67:case 70:this.$=t[s];break;case 66:this.$=t[s-1]+t[s];break;case 69:t[s-2].push(t[s]),this.$=t[s-2];break;case 71:this.$=t[s].replace(/"/g,"");break;case 72:this.$={cardA:t[s],relType:t[s-1],cardB:t[s-2]};break;case 73:this.$=r.Cardinality.ZERO_OR_ONE;break;case 74:this.$=r.Cardinality.ZERO_OR_MORE;break;case 75:this.$=r.Cardinality.ONE_OR_MORE;break;case 76:this.$=r.Cardinality.ONLY_ONE;break;case 77:this.$=r.Cardinality.MD_PARENT;break;case 78:this.$=r.Identification.NON_IDENTIFYING;break;case 79:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,7],{1:[2,1]}),e(i,[2,3]),{9:30,11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,5]),e(i,[2,6]),e(i,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:nt,67:at,68:ct,69:ot,70:lt}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(i,[2,27]),e(i,[2,28]),e(i,[2,29]),e(i,[2,30]),e(i,[2,31]),e(B,[2,54]),e(B,[2,55]),e(B,[2,56]),e(B,[2,57]),e(B,[2,58]),e(i,[2,32]),e(i,[2,33]),e(i,[2,34]),e(i,[2,35]),{16:44,40:O,41:N},{16:47,40:O,41:N},{16:48,40:O,41:N},e(i,[2,4]),{11:49,40:S,48:D,50:R,51:T,52:C},{16:50,40:O,41:N},{18:51,19:[1,52],53:53,54:54,58:F},{11:56,40:S,48:D,50:R,51:T,52:C},{65:57,71:[1,58],72:[1,59]},e(Y,[2,73]),e(Y,[2,74]),e(Y,[2,75]),e(Y,[2,76]),e(Y,[2,77]),e(i,[2,24]),e(i,[2,25]),e(i,[2,26]),{13:P,38:60,41:z,42:A,45:62,46:63,48:G,49:K},e(Q,[2,37]),e(Q,[2,38]),{16:68,40:O,41:N,42:A},{13:P,38:69,41:z,42:A,45:62,46:63,48:G,49:K},{13:[1,70],15:[1,71]},e(i,[2,17],{64:35,12:72,17:[1,73],42:A,66:nt,67:at,68:ct,69:ot,70:lt}),{19:[1,74]},e(i,[2,14]),{18:75,19:[2,59],53:53,54:54,58:F},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:nt,67:at,68:ct,69:ot,70:lt},e(gt,[2,78]),e(gt,[2,79]),{6:bt,10:kt,39:81,42:mt,47:Et},{40:[1,86],41:[1,87]},e(St,[2,43],{46:88,13:P,41:z,48:G,49:K}),e(L,[2,45]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(i,[2,41],{42:A}),{6:bt,10:kt,39:89,42:mt,47:Et},{14:90,40:X,50:H,73:J},{16:94,40:O,41:N},{11:95,40:S,48:D,50:R,51:T,52:C},{18:96,19:[1,97],53:53,54:54,58:F},e(i,[2,12]),{19:[2,60]},e(U,[2,61],{56:98,57:99,60:100,62:Tt,63:Ot}),e([19,58,62,63],[2,67]),{58:[2,66]},e(i,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(i,[2,36]),{13:P,41:z,45:105,46:63,48:G,49:K},e(i,[2,47]),e(i,[2,48]),e(i,[2,49]),e(Q,[2,39]),e(Q,[2,40]),e(L,[2,46]),e(i,[2,42]),e(i,[2,8]),e(i,[2,80]),e(i,[2,81]),e(i,[2,82]),{13:[1,106],42:A},{13:[1,108],15:[1,107]},{19:[1,109]},e(i,[2,15]),e(U,[2,62],{57:110,61:[1,111],63:Ot}),e(U,[2,63]),e(ht,[2,68]),e(U,[2,71]),e(ht,[2,70]),{18:112,19:[1,113],53:53,54:54,58:F},{16:114,40:O,41:N},e(St,[2,44],{46:88,13:P,41:z,48:G,49:K}),{14:115,40:X,50:H,73:J},{16:116,40:O,41:N},{14:117,40:X,50:H,73:J},e(i,[2,13]),e(U,[2,64]),{60:118,62:Tt},{19:[1,119]},e(i,[2,20]),e(i,[2,23],{17:[1,120],42:A}),e(i,[2,11]),{13:[1,121],42:A},e(i,[2,10]),e(ht,[2,69]),e(i,[2,18]),{18:122,19:[1,123],53:53,54:54,58:F},{14:124,40:X,50:H,73:J},{19:[1,125]},e(i,[2,21]),e(i,[2,9]),e(i,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:l(function(n,c){if(c.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=c,o}},"parseError"),parse:l(function(n){var c=this,o=[0],r=[],p=[null],t=[],Z=this.table,s="",tt=0,Nt=0,Dt=2,At=1,Lt=t.slice.call(arguments,1),_=Object.create(this.lexer),x={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(x.yy[dt]=this.yy[dt]);_.setInput(n,x.yy),x.yy.lexer=_,x.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var pt=_.yylloc;t.push(pt);var wt=_.options&&_.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Vt(b){o.length=o.length-2*b,p.length=p.length-b,t.length=t.length-b}l(Vt,"popStack");function It(){var b;return b=r.pop()||_.lex()||At,typeof b!="number"&&(b instanceof Array&&(r=b,b=r.pop()),b=c.symbols_[b]||b),b}l(It,"lex");for(var g,v,k,ft,w={},et,E,Rt,st;;){if(v=o[o.length-1],this.defaultActions[v]?k=this.defaultActions[v]:((g===null||typeof g>"u")&&(g=It()),k=Z[v]&&Z[v][g]),typeof k>"u"||!k.length||!k[0]){var yt="";st=[];for(et in Z[v])this.terminals_[et]&&et>Dt&&st.push("'"+this.terminals_[et]+"'");_.showPosition?yt="Parse error on line "+(tt+1)+`: +import{g as Mt}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as Bt}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as l,b as Ft,a as Yt,s as Pt,g as zt,o as Gt,p as Kt,c as it,l as V,q as Ut,r as Zt,t as jt,u as Wt,v as qt,x as Qt,d as Xt,y as Ht}from"./mermaid.core-CsZwh_jB.js";import{c as Jt}from"./channel-Dk_xUHM6.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var _t=(function(){var e=l(function(I,n,c,o){for(c=c||{},o=I.length;o--;c[I[o]]=n);return c},"o"),i=[6,8,10,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52],h=[1,10],a=[1,11],u=[1,12],d=[1,13],y=[1,23],f=[1,24],m=[1,25],j=[1,26],W=[1,27],S=[1,19],q=[1,28],M=[1,29],D=[1,20],R=[1,18],T=[1,21],C=[1,22],nt=[1,36],at=[1,37],ct=[1,38],ot=[1,39],lt=[1,40],B=[6,8,10,13,15,17,20,21,22,24,26,28,33,34,35,36,37,40,43,44,48,50,51,52,66,67,68,69,70],O=[1,45],N=[1,46],F=[1,55],Y=[40,48,50,51,52,71,72],P=[1,66],z=[1,64],A=[1,61],G=[1,65],K=[1,67],Q=[6,8,10,13,17,22,24,26,28,33,34,35,36,37,40,41,42,43,44,48,49,50,51,52,66,67,68,69,70],gt=[66,67,68,69,70],bt=[1,85],kt=[1,84],mt=[1,82],Et=[1,83],St=[6,10,42,47],L=[6,10,13,41,42,47,48,49],X=[1,93],H=[1,92],J=[1,91],U=[19,58],Tt=[1,102],Ot=[1,101],ht=[19,58,61,63],ut={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ER_DIAGRAM:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,entityName:11,relSpec:12,COLON:13,role:14,STYLE_SEPARATOR:15,idList:16,BLOCK_START:17,attributes:18,BLOCK_STOP:19,SQS:20,SQE:21,title:22,title_value:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,direction:29,classDefStatement:30,classStatement:31,styleStatement:32,direction_tb:33,direction_bt:34,direction_rl:35,direction_lr:36,CLASSDEF:37,stylesOpt:38,separator:39,UNICODE_TEXT:40,STYLE_TEXT:41,COMMA:42,CLASS:43,STYLE:44,style:45,styleComponent:46,SEMI:47,NUM:48,BRKT:49,ENTITY_NAME:50,DECIMAL_NUM:51,ENTITY_ONE:52,attribute:53,attributeType:54,attributeName:55,attributeKeyTypeList:56,attributeComment:57,ATTRIBUTE_WORD:58,"?":59,attributeKeyType:60,",":61,ATTRIBUTE_KEY:62,COMMENT:63,cardinality:64,relType:65,ZERO_OR_ONE:66,ZERO_OR_MORE:67,ONE_OR_MORE:68,ONLY_ONE:69,MD_PARENT:70,NON_IDENTIFYING:71,IDENTIFYING:72,WORD:73,$accept:0,$end:1},terminals_:{2:"error",4:"ER_DIAGRAM",6:"EOF",8:"SPACE",10:"NEWLINE",13:"COLON",15:"STYLE_SEPARATOR",17:"BLOCK_START",19:"BLOCK_STOP",20:"SQS",21:"SQE",22:"title",23:"title_value",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"direction_tb",34:"direction_bt",35:"direction_rl",36:"direction_lr",37:"CLASSDEF",40:"UNICODE_TEXT",41:"STYLE_TEXT",42:"COMMA",43:"CLASS",44:"STYLE",47:"SEMI",48:"NUM",49:"BRKT",50:"ENTITY_NAME",51:"DECIMAL_NUM",52:"ENTITY_ONE",58:"ATTRIBUTE_WORD",59:"?",61:",",62:"ATTRIBUTE_KEY",63:"COMMENT",66:"ZERO_OR_ONE",67:"ZERO_OR_MORE",68:"ONE_OR_MORE",69:"ONLY_ONE",70:"MD_PARENT",71:"NON_IDENTIFYING",72:"IDENTIFYING",73:"WORD"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,5],[9,9],[9,7],[9,7],[9,4],[9,6],[9,3],[9,5],[9,1],[9,3],[9,7],[9,9],[9,6],[9,8],[9,4],[9,6],[9,2],[9,2],[9,2],[9,1],[9,1],[9,1],[9,1],[9,1],[29,1],[29,1],[29,1],[29,1],[30,4],[16,1],[16,1],[16,3],[16,3],[31,3],[32,4],[38,1],[38,3],[45,1],[45,2],[39,1],[39,1],[39,1],[46,1],[46,1],[46,1],[46,1],[11,1],[11,1],[11,1],[11,1],[11,1],[18,1],[18,2],[53,2],[53,3],[53,3],[53,4],[54,1],[54,2],[55,1],[56,1],[56,3],[60,1],[57,1],[12,3],[64,1],[64,1],[64,1],[64,1],[64,1],[65,1],[65,1],[14,1],[14,1],[14,1]],performAction:l(function(n,c,o,r,p,t,Z){var s=t.length-1;switch(p){case 1:break;case 2:this.$=[];break;case 3:t[s-1].push(t[s]),this.$=t[s-1];break;case 4:case 5:this.$=t[s];break;case 6:case 7:this.$=[];break;case 8:r.addEntity(t[s-4]),r.addEntity(t[s-2]),r.addRelationship(t[s-4],t[s],t[s-2],t[s-3]);break;case 9:r.addEntity(t[s-8]),r.addEntity(t[s-4]),r.addRelationship(t[s-8],t[s],t[s-4],t[s-5]),r.setClass([t[s-8]],t[s-6]),r.setClass([t[s-4]],t[s-2]);break;case 10:r.addEntity(t[s-6]),r.addEntity(t[s-2]),r.addRelationship(t[s-6],t[s],t[s-2],t[s-3]),r.setClass([t[s-6]],t[s-4]);break;case 11:r.addEntity(t[s-6]),r.addEntity(t[s-4]),r.addRelationship(t[s-6],t[s],t[s-4],t[s-5]),r.setClass([t[s-4]],t[s-2]);break;case 12:r.addEntity(t[s-3]),r.addAttributes(t[s-3],t[s-1]);break;case 13:r.addEntity(t[s-5]),r.addAttributes(t[s-5],t[s-1]),r.setClass([t[s-5]],t[s-3]);break;case 14:r.addEntity(t[s-2]);break;case 15:r.addEntity(t[s-4]),r.setClass([t[s-4]],t[s-2]);break;case 16:r.addEntity(t[s]);break;case 17:r.addEntity(t[s-2]),r.setClass([t[s-2]],t[s]);break;case 18:r.addEntity(t[s-6],t[s-4]),r.addAttributes(t[s-6],t[s-1]);break;case 19:r.addEntity(t[s-8],t[s-6]),r.addAttributes(t[s-8],t[s-1]),r.setClass([t[s-8]],t[s-3]);break;case 20:r.addEntity(t[s-5],t[s-3]);break;case 21:r.addEntity(t[s-7],t[s-5]),r.setClass([t[s-7]],t[s-2]);break;case 22:r.addEntity(t[s-3],t[s-1]);break;case 23:r.addEntity(t[s-5],t[s-3]),r.setClass([t[s-5]],t[s]);break;case 24:case 25:this.$=t[s].trim(),r.setAccTitle(this.$);break;case 26:case 27:this.$=t[s].trim(),r.setAccDescription(this.$);break;case 32:r.setDirection("TB");break;case 33:r.setDirection("BT");break;case 34:r.setDirection("RL");break;case 35:r.setDirection("LR");break;case 36:this.$=t[s-3],r.addClass(t[s-2],t[s-1]);break;case 37:case 38:case 59:case 68:this.$=[t[s]];break;case 39:case 40:this.$=t[s-2].concat([t[s]]);break;case 41:this.$=t[s-2],r.setClass(t[s-1],t[s]);break;case 42:this.$=t[s-3],r.addCssStyles(t[s-2],t[s-1]);break;case 43:this.$=[t[s]];break;case 44:t[s-2].push(t[s]),this.$=t[s-2];break;case 46:this.$=t[s-1]+t[s];break;case 54:case 80:case 81:this.$=t[s].replace(/"/g,"");break;case 55:case 56:case 57:case 58:case 82:this.$=t[s];break;case 60:t[s].push(t[s-1]),this.$=t[s];break;case 61:this.$={type:t[s-1],name:t[s]};break;case 62:this.$={type:t[s-2],name:t[s-1],keys:t[s]};break;case 63:this.$={type:t[s-2],name:t[s-1],comment:t[s]};break;case 64:this.$={type:t[s-3],name:t[s-2],keys:t[s-1],comment:t[s]};break;case 65:case 67:case 70:this.$=t[s];break;case 66:this.$=t[s-1]+t[s];break;case 69:t[s-2].push(t[s]),this.$=t[s-2];break;case 71:this.$=t[s].replace(/"/g,"");break;case 72:this.$={cardA:t[s],relType:t[s-1],cardB:t[s-2]};break;case 73:this.$=r.Cardinality.ZERO_OR_ONE;break;case 74:this.$=r.Cardinality.ZERO_OR_MORE;break;case 75:this.$=r.Cardinality.ONE_OR_MORE;break;case 76:this.$=r.Cardinality.ONLY_ONE;break;case 77:this.$=r.Cardinality.MD_PARENT;break;case 78:this.$=r.Identification.NON_IDENTIFYING;break;case 79:this.$=r.Identification.IDENTIFYING;break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},e(i,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,7],{1:[2,1]}),e(i,[2,3]),{9:30,11:9,22:h,24:a,26:u,28:d,29:14,30:15,31:16,32:17,33:y,34:f,35:m,36:j,37:W,40:S,43:q,44:M,48:D,50:R,51:T,52:C},e(i,[2,5]),e(i,[2,6]),e(i,[2,16],{12:31,64:35,15:[1,32],17:[1,33],20:[1,34],66:nt,67:at,68:ct,69:ot,70:lt}),{23:[1,41]},{25:[1,42]},{27:[1,43]},e(i,[2,27]),e(i,[2,28]),e(i,[2,29]),e(i,[2,30]),e(i,[2,31]),e(B,[2,54]),e(B,[2,55]),e(B,[2,56]),e(B,[2,57]),e(B,[2,58]),e(i,[2,32]),e(i,[2,33]),e(i,[2,34]),e(i,[2,35]),{16:44,40:O,41:N},{16:47,40:O,41:N},{16:48,40:O,41:N},e(i,[2,4]),{11:49,40:S,48:D,50:R,51:T,52:C},{16:50,40:O,41:N},{18:51,19:[1,52],53:53,54:54,58:F},{11:56,40:S,48:D,50:R,51:T,52:C},{65:57,71:[1,58],72:[1,59]},e(Y,[2,73]),e(Y,[2,74]),e(Y,[2,75]),e(Y,[2,76]),e(Y,[2,77]),e(i,[2,24]),e(i,[2,25]),e(i,[2,26]),{13:P,38:60,41:z,42:A,45:62,46:63,48:G,49:K},e(Q,[2,37]),e(Q,[2,38]),{16:68,40:O,41:N,42:A},{13:P,38:69,41:z,42:A,45:62,46:63,48:G,49:K},{13:[1,70],15:[1,71]},e(i,[2,17],{64:35,12:72,17:[1,73],42:A,66:nt,67:at,68:ct,69:ot,70:lt}),{19:[1,74]},e(i,[2,14]),{18:75,19:[2,59],53:53,54:54,58:F},{55:76,58:[1,77]},{58:[2,65],59:[1,78]},{21:[1,79]},{64:80,66:nt,67:at,68:ct,69:ot,70:lt},e(gt,[2,78]),e(gt,[2,79]),{6:bt,10:kt,39:81,42:mt,47:Et},{40:[1,86],41:[1,87]},e(St,[2,43],{46:88,13:P,41:z,48:G,49:K}),e(L,[2,45]),e(L,[2,50]),e(L,[2,51]),e(L,[2,52]),e(L,[2,53]),e(i,[2,41],{42:A}),{6:bt,10:kt,39:89,42:mt,47:Et},{14:90,40:X,50:H,73:J},{16:94,40:O,41:N},{11:95,40:S,48:D,50:R,51:T,52:C},{18:96,19:[1,97],53:53,54:54,58:F},e(i,[2,12]),{19:[2,60]},e(U,[2,61],{56:98,57:99,60:100,62:Tt,63:Ot}),e([19,58,62,63],[2,67]),{58:[2,66]},e(i,[2,22],{15:[1,104],17:[1,103]}),e([40,48,50,51,52],[2,72]),e(i,[2,36]),{13:P,41:z,45:105,46:63,48:G,49:K},e(i,[2,47]),e(i,[2,48]),e(i,[2,49]),e(Q,[2,39]),e(Q,[2,40]),e(L,[2,46]),e(i,[2,42]),e(i,[2,8]),e(i,[2,80]),e(i,[2,81]),e(i,[2,82]),{13:[1,106],42:A},{13:[1,108],15:[1,107]},{19:[1,109]},e(i,[2,15]),e(U,[2,62],{57:110,61:[1,111],63:Ot}),e(U,[2,63]),e(ht,[2,68]),e(U,[2,71]),e(ht,[2,70]),{18:112,19:[1,113],53:53,54:54,58:F},{16:114,40:O,41:N},e(St,[2,44],{46:88,13:P,41:z,48:G,49:K}),{14:115,40:X,50:H,73:J},{16:116,40:O,41:N},{14:117,40:X,50:H,73:J},e(i,[2,13]),e(U,[2,64]),{60:118,62:Tt},{19:[1,119]},e(i,[2,20]),e(i,[2,23],{17:[1,120],42:A}),e(i,[2,11]),{13:[1,121],42:A},e(i,[2,10]),e(ht,[2,69]),e(i,[2,18]),{18:122,19:[1,123],53:53,54:54,58:F},{14:124,40:X,50:H,73:J},{19:[1,125]},e(i,[2,21]),e(i,[2,9]),e(i,[2,19])],defaultActions:{75:[2,60],78:[2,66]},parseError:l(function(n,c){if(c.recoverable)this.trace(n);else{var o=new Error(n);throw o.hash=c,o}},"parseError"),parse:l(function(n){var c=this,o=[0],r=[],p=[null],t=[],Z=this.table,s="",tt=0,Nt=0,Dt=2,At=1,Lt=t.slice.call(arguments,1),_=Object.create(this.lexer),x={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(x.yy[dt]=this.yy[dt]);_.setInput(n,x.yy),x.yy.lexer=_,x.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var pt=_.yylloc;t.push(pt);var wt=_.options&&_.options.ranges;typeof x.yy.parseError=="function"?this.parseError=x.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Vt(b){o.length=o.length-2*b,p.length=p.length-b,t.length=t.length-b}l(Vt,"popStack");function It(){var b;return b=r.pop()||_.lex()||At,typeof b!="number"&&(b instanceof Array&&(r=b,b=r.pop()),b=c.symbols_[b]||b),b}l(It,"lex");for(var g,v,k,ft,w={},et,E,Rt,st;;){if(v=o[o.length-1],this.defaultActions[v]?k=this.defaultActions[v]:((g===null||typeof g>"u")&&(g=It()),k=Z[v]&&Z[v][g]),typeof k>"u"||!k.length||!k[0]){var yt="";st=[];for(et in Z[v])this.terminals_[et]&&et>Dt&&st.push("'"+this.terminals_[et]+"'");_.showPosition?yt="Parse error on line "+(tt+1)+`: `+_.showPosition()+` Expecting `+st.join(", ")+", got '"+(this.terminals_[g]||g)+"'":yt="Parse error on line "+(tt+1)+": Unexpected "+(g==At?"end of input":"'"+(this.terminals_[g]||g)+"'"),this.parseError(yt,{text:_.match,token:this.terminals_[g]||g,line:_.yylineno,loc:pt,expected:st})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+g);switch(k[0]){case 1:o.push(g),p.push(_.yytext),t.push(_.yylloc),o.push(k[1]),g=null,Nt=_.yyleng,s=_.yytext,tt=_.yylineno,pt=_.yylloc;break;case 2:if(E=this.productions_[k[1]][1],w.$=p[p.length-E],w._$={first_line:t[t.length-(E||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(E||1)].first_column,last_column:t[t.length-1].last_column},wt&&(w._$.range=[t[t.length-(E||1)].range[0],t[t.length-1].range[1]]),ft=this.performAction.apply(w,[s,Nt,tt,x.yy,k[1],p,t].concat(Lt)),typeof ft<"u")return ft;E&&(o=o.slice(0,-1*E*2),p=p.slice(0,-1*E),t=t.slice(0,-1*E)),o.push(this.productions_[k[1]][0]),p.push(w.$),t.push(w._$),Rt=Z[o[o.length-2]][o[o.length-1]],o.push(Rt);break;case 3:return!0}}return!0},"parse")},vt=(function(){var I={EOF:1,parseError:l(function(c,o){if(this.yy.parser)this.yy.parser.parseError(c,o);else throw new Error(c)},"parseError"),setInput:l(function(n,c){return this.yy=c||this.yy||{},this._input=n,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var n=this._input[0];this.yytext+=n,this.yyleng++,this.offset++,this.match+=n,this.matched+=n;var c=n.match(/(?:\r\n?|\n).*/g);return c?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),n},"input"),unput:l(function(n){var c=n.length,o=n.split(/(?:\r\n?|\n)/g);this._input=n+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-c),this.offset-=c;var r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===r.length?this.yylloc.first_column:0)+r[r.length-o.length].length-o[0].length:this.yylloc.first_column-c},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-c]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(n){this.unput(this.match.slice(n))},"less"),pastInput:l(function(){var n=this.matched.substr(0,this.matched.length-this.match.length);return(n.length>20?"...":"")+n.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var n=this.match;return n.length<20&&(n+=this._input.substr(0,20-n.length)),(n.substr(0,20)+(n.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var n=this.pastInput(),c=new Array(n.length+1).join("-");return n+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js b/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CB0TxYKC.js similarity index 99% rename from apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js rename to apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CB0TxYKC.js index c717156e91c..73a9846500b 100644 --- a/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CzI-GKO4.js +++ b/apps/kimi-code/dist-web/assets/flowDiagram-23GEKE2U-CB0TxYKC.js @@ -1,4 +1,4 @@ -import{g as He}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{g as Xe}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Qe}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as b,b6 as Ze,X as Oe,l as Z,c as g1,v as Je,x as $e,y as ie,b as et,s as tt,o as st,a as it,g as rt,p as at,k as nt,Y as ut,Z as ot,bo as lt,r as te,d as se,a5 as ct,q as ht,b8 as dt,t as pt}from"./mermaid.core-CJB1tAev.js";import{f as ft}from"./chunk-32BRIVSS-DUDRPqmY.js";import{c as gt}from"./channel-xkK6nTGq.js";var bt="flowchart-",At=class{constructor(){this.vertexCounter=0,this.config=g1(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=et,this.setAccDescription=tt,this.setDiagramTitle=st,this.getAccTitle=it,this.getAccDescription=rt,this.getDiagramTitle=at,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return nt.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(const i of this.vertices.values())if(i.id===e)return this.diagramId?`${this.diagramId}-${i.domId}`:i.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,i,r,a,o,d,l={},A){if(!e||e.trim().length===0)return;let n;if(A!==void 0){let k;A.includes(` +import{g as He}from"./chunk-5VM5RSS4-CqIxm4fU.js";import{g as Xe}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as Qe}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as b,b6 as Ze,X as Oe,l as Z,c as g1,v as Je,x as $e,y as ie,b as et,s as tt,o as st,a as it,g as rt,p as at,k as nt,Y as ut,Z as ot,bo as lt,r as te,d as se,a5 as ct,q as ht,b8 as dt,t as pt}from"./mermaid.core-CsZwh_jB.js";import{f as ft}from"./chunk-32BRIVSS-DNJ_Bmzz.js";import{c as gt}from"./channel-Dk_xUHM6.js";var bt="flowchart-",At=class{constructor(){this.vertexCounter=0,this.config=g1(),this.diagramId="",this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.funs=[],this.setAccTitle=et,this.setAccDescription=tt,this.setDiagramTitle=st,this.getAccTitle=it,this.getAccDescription=rt,this.getDiagramTitle=at,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen("gen-2")}static{b(this,"FlowDB")}sanitizeText(e){return nt.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case"markdown":case"string":case"text":return e;default:return"markdown"}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(const i of this.vertices.values())if(i.id===e)return this.diagramId?`${this.diagramId}-${i.domId}`:i.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,i,r,a,o,d,l={},A){if(!e||e.trim().length===0)return;let n;if(A!==void 0){let k;A.includes(` `)?k=A+` `:k=`{ `+A+` diff --git a/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js b/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-BkswX2CL.js similarity index 99% rename from apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js rename to apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-BkswX2CL.js index 7552e3c8e0c..f25710481ea 100644 --- a/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js +++ b/apps/kimi-code/dist-web/assets/ganttDiagram-NO4QXBWP-BkswX2CL.js @@ -1,4 +1,4 @@ -import{bg as on,bh as On,bi as cn,bj as un,bk as ln,bl as ue,bm as Hn,g as Nn,s as Pn,p as Vn,o as Rn,a as zn,b as qn,_ as d,c as Yt,d as Zt,e as Bn,bn as it,l as Tt,k as Zn,j as Xn,q as Gn,y as jn}from"./mermaid.core-CJB1tAev.js";import{g as oe}from"./_commonjsHelpers-CqkleIqs.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-DH49UJnN.js";import{i as er}from"./init-Gi6I4Gst.js";import"./index-D-7nOosq.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: +import{bg as on,bh as On,bi as cn,bj as un,bk as ln,bl as ue,bm as Hn,g as Nn,s as Pn,p as Vn,o as Rn,a as zn,b as qn,_ as d,c as Yt,d as Zt,e as Bn,bn as it,l as Tt,k as Zn,j as Xn,q as Gn,y as jn}from"./mermaid.core-CsZwh_jB.js";import{g as oe}from"./_commonjsHelpers-CqkleIqs.js";import{b as Qn,t as Ne,c as Jn,a as Kn,l as tr}from"./linear-CV4KY8w2.js";import{i as er}from"./init-Gi6I4Gst.js";import"./index-Bxn5yOTB.js";import"./defaultLocale-DX6XiGOO.js";function nr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n=i)&&(n=i)}return n}function rr(t,e){let n;if(e===void 0)for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of t)(i=e(i,++r,t))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function ir(t){return t}var Gt=1,le=2,xe=3,Xt=4,Pe=1e-6;function sr(t){return"translate("+t+",0)"}function ar(t){return"translate(0,"+t+")"}function or(t){return e=>+t(e)}function cr(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function ur(){return!this.__axis}function fn(t,e){var n=[],r=null,i=null,s=6,a=6,y=3,F=typeof window<"u"&&window.devicePixelRatio>1?0:.5,S=t===Gt||t===Xt?-1:1,w=t===Xt||t===le?"x":"y",P=t===Gt||t===xe?sr:ar;function _(Y){var X=r??(e.ticks?e.ticks.apply(e,n):e.domain()),B=i??(e.tickFormat?e.tickFormat.apply(e,n):ir),v=Math.max(s,0)+y,U=e.range(),R=+U[0]+F,E=+U[U.length-1]+F,z=(e.bandwidth?cr:or)(e.copy(),F),G=Y.selection?Y.selection():Y,T=G.selectAll(".domain").data([null]),k=G.selectAll(".tick").data(X,e).order(),p=k.exit(),L=k.enter().append("g").attr("class","tick"),x=k.select("line"),C=k.select("text");T=T.merge(T.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),k=k.merge(L),x=x.merge(L.append("line").attr("stroke","currentColor").attr(w+"2",S*s)),C=C.merge(L.append("text").attr("fill","currentColor").attr(w,S*v).attr("dy",t===Gt?"0em":t===xe?"0.71em":"0.32em")),Y!==G&&(T=T.transition(Y),k=k.transition(Y),x=x.transition(Y),C=C.transition(Y),p=p.transition(Y).attr("opacity",Pe).attr("transform",function(M){return isFinite(M=z(M))?P(M+F):this.getAttribute("transform")}),L.attr("opacity",Pe).attr("transform",function(M){var D=this.parentNode.__axis;return P((D&&isFinite(D=D(M))?D:z(M))+F)})),p.remove(),T.attr("d",t===Xt||t===le?a?"M"+S*a+","+R+"H"+F+"V"+E+"H"+S*a:"M"+F+","+R+"V"+E:a?"M"+R+","+S*a+"V"+F+"H"+E+"V"+S*a:"M"+R+","+F+"H"+E),k.attr("opacity",1).attr("transform",function(M){return P(z(M)+F)}),x.attr(w+"2",S*s),C.attr(w,S*v).text(B),G.filter(ur).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===le?"start":t===Xt?"end":"middle"),G.each(function(){this.__axis=z})}return _.scale=function(Y){return arguments.length?(e=Y,_):e},_.ticks=function(){return n=Array.from(arguments),_},_.tickArguments=function(Y){return arguments.length?(n=Y==null?[]:Array.from(Y),_):n.slice()},_.tickValues=function(Y){return arguments.length?(r=Y==null?null:Array.from(Y),_):r&&r.slice()},_.tickFormat=function(Y){return arguments.length?(i=Y,_):i},_.tickSize=function(Y){return arguments.length?(s=a=+Y,_):s},_.tickSizeInner=function(Y){return arguments.length?(s=+Y,_):s},_.tickSizeOuter=function(Y){return arguments.length?(a=+Y,_):a},_.tickPadding=function(Y){return arguments.length?(y=+Y,_):y},_.offset=function(Y){return arguments.length?(F=+Y,_):F},_}function lr(t){return fn(Gt,t)}function fr(t){return fn(xe,t)}const dr=Math.PI/180,hr=180/Math.PI,ne=18,dn=.96422,hn=1,mn=.82521,gn=4/29,Ft=6/29,yn=3*Ft*Ft,mr=Ft*Ft*Ft;function kn(t){if(t instanceof ft)return new ft(t.l,t.a,t.b,t.opacity);if(t instanceof ht)return pn(t);t instanceof on||(t=On(t));var e=me(t.r),n=me(t.g),r=me(t.b),i=fe((.2225045*e+.7168786*n+.0606169*r)/hn),s,a;return e===n&&n===r?s=a=i:(s=fe((.4360747*e+.3850649*n+.1430804*r)/dn),a=fe((.0139322*e+.0971045*n+.7141733*r)/mn)),new ft(116*i-16,500*(s-i),200*(i-a),t.opacity)}function gr(t,e,n,r){return arguments.length===1?kn(t):new ft(t,e,n,r??1)}function ft(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}cn(ft,gr,un(ln,{brighter(t){return new ft(this.l+ne*(t??1),this.a,this.b,this.opacity)},darker(t){return new ft(this.l-ne*(t??1),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return e=dn*de(e),t=hn*de(t),n=mn*de(n),new on(he(3.1338561*e-1.6168667*t-.4906146*n),he(-.9787684*e+1.9161415*t+.033454*n),he(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}}));function fe(t){return t>mr?Math.pow(t,1/3):t/yn+gn}function de(t){return t>Ft?t*t*t:yn*(t-gn)}function he(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function me(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function yr(t){if(t instanceof ht)return new ht(t.h,t.c,t.l,t.opacity);if(t instanceof ft||(t=kn(t)),t.a===0&&t.b===0)return new ht(NaN,0(t(s=new Date(+s)),s),i.ceil=s=>(t(s=new Date(s-1)),e(s,1),t(s),s),i.round=s=>{const a=i(s),y=i.ceil(s);return s-a(e(s=new Date(+s),a==null?1:Math.floor(a)),s),i.range=(s,a,y)=>{const F=[];if(s=i.ceil(s),y=y==null?1:Math.floor(y),!(s0))return F;let S;do F.push(S=new Date(+s)),e(s,y),t(s);while(Snt(a=>{if(a>=a)for(;t(a),!s(a);)a.setTime(a-1)},(a,y)=>{if(a>=a)if(y<0)for(;++y<=0;)for(;e(a,-1),!s(a););else for(;--y>=0;)for(;e(a,1),!s(a););}),n&&(i.count=(s,a)=>(ge.setTime(+s),ye.setTime(+a),t(ge),t(ye),Math.floor(n(ge,ye))),i.every=s=>(s=Math.floor(s),!isFinite(s)||!(s>0)?null:s>1?i.filter(r?a=>r(a)%s===0:a=>i.count(0,a)%s===0):i)),i}const Et=nt(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Et.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?nt(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Et);Et.range;const mt=1e3,ct=mt*60,gt=ct*60,yt=gt*24,Se=yt*7,Ve=yt*30,ke=yt*365,vt=nt(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*mt)},(t,e)=>(e-t)/mt,t=>t.getUTCSeconds());vt.range;const Nt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getMinutes());Nt.range;const Tr=nt(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*ct)},(t,e)=>(e-t)/ct,t=>t.getUTCMinutes());Tr.range;const Pt=nt(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*mt-t.getMinutes()*ct)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getHours());Pt.range;const xr=nt(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*gt)},(t,e)=>(e-t)/gt,t=>t.getUTCHours());xr.range;const xt=nt(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*ct)/yt,t=>t.getDate()-1);xt.range;const _e=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>t.getUTCDate()-1);_e.range;const br=nt(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/yt,t=>Math.floor(t/yt));br.range;function Dt(t){return nt(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*ct)/Se)}const zt=Dt(0),Vt=Dt(1),vn=Dt(2),Tn=Dt(3),bt=Dt(4),xn=Dt(5),bn=Dt(6);zt.range;Vt.range;vn.range;Tn.range;bt.range;xn.range;bn.range;function Mt(t){return nt(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/Se)}const wn=Mt(0),re=Mt(1),wr=Mt(2),Dr=Mt(3),It=Mt(4),Mr=Mt(5),Cr=Mt(6);wn.range;re.range;wr.range;Dr.range;It.range;Mr.range;Cr.range;const Rt=nt(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());Rt.range;const Sr=nt(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());Sr.range;const kt=nt(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());kt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});kt.range;const wt=nt(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());wt.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:nt(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});wt.range;function _r(t,e,n,r,i,s){const a=[[vt,1,mt],[vt,5,5*mt],[vt,15,15*mt],[vt,30,30*mt],[s,1,ct],[s,5,5*ct],[s,15,15*ct],[s,30,30*ct],[i,1,gt],[i,3,3*gt],[i,6,6*gt],[i,12,12*gt],[r,1,yt],[r,2,2*yt],[n,1,Se],[e,1,Ve],[e,3,3*Ve],[t,1,ke]];function y(S,w,P){const _=wv).right(a,_);if(Y===a.length)return t.every(Ne(S/ke,w/ke,P));if(Y===0)return Et.every(Math.max(Ne(S,w,P),1));const[X,B]=a[_/a[Y-1][2]53)return null;"w"in f||(f.w=1),"Z"in f?(A=ve($t(f.y,0,1)),Q=A.getUTCDay(),A=Q>4||Q===0?re.ceil(A):re(A),A=_e.offset(A,(f.V-1)*7),f.y=A.getUTCFullYear(),f.m=A.getUTCMonth(),f.d=A.getUTCDate()+(f.w+6)%7):(A=pe($t(f.y,0,1)),Q=A.getDay(),A=Q>4||Q===0?Vt.ceil(A):Vt(A),A=xt.offset(A,(f.V-1)*7),f.y=A.getFullYear(),f.m=A.getMonth(),f.d=A.getDate()+(f.w+6)%7)}else("W"in f||"U"in f)&&("w"in f||(f.w="u"in f?f.u%7:"W"in f?1:0),Q="Z"in f?ve($t(f.y,0,1)).getUTCDay():pe($t(f.y,0,1)).getDay(),f.m=0,f.d="W"in f?(f.w+6)%7+f.W*7-(Q+5)%7:f.w+f.U*7-(Q+6)%7);return"Z"in f?(f.H+=f.Z/100|0,f.M+=f.Z%100,ve(f)):pe(f)}}function p(h,N,V,f){for(var tt=0,A=N.length,Q=V.length,Z,st;tt=Q)return-1;if(Z=N.charCodeAt(tt++),Z===37){if(Z=N.charAt(tt++),st=G[Z in Re?N.charAt(tt++):Z],!st||(f=st(h,V,f))<0)return-1}else if(Z!=V.charCodeAt(f++))return-1}return f}function L(h,N,V){var f=S.exec(N.slice(V));return f?(h.p=w.get(f[0].toLowerCase()),V+f[0].length):-1}function x(h,N,V){var f=Y.exec(N.slice(V));return f?(h.w=X.get(f[0].toLowerCase()),V+f[0].length):-1}function C(h,N,V){var f=P.exec(N.slice(V));return f?(h.w=_.get(f[0].toLowerCase()),V+f[0].length):-1}function M(h,N,V){var f=U.exec(N.slice(V));return f?(h.m=R.get(f[0].toLowerCase()),V+f[0].length):-1}function D(h,N,V){var f=B.exec(N.slice(V));return f?(h.m=v.get(f[0].toLowerCase()),V+f[0].length):-1}function c(h,N,V){return p(h,e,N,V)}function g(h,N,V){return p(h,n,N,V)}function b(h,N,V){return p(h,r,N,V)}function m(h){return a[h.getDay()]}function I(h){return s[h.getDay()]}function o(h){return F[h.getMonth()]}function W(h){return y[h.getMonth()]}function u(h){return i[+(h.getHours()>=12)]}function K(h){return 1+~~(h.getMonth()/3)}function l(h){return a[h.getUTCDay()]}function $(h){return s[h.getUTCDay()]}function O(h){return F[h.getUTCMonth()]}function j(h){return y[h.getUTCMonth()]}function H(h){return i[+(h.getUTCHours()>=12)]}function J(h){return 1+~~(h.getUTCMonth()/3)}return{format:function(h){var N=T(h+="",E);return N.toString=function(){return h},N},parse:function(h){var N=k(h+="",!1);return N.toString=function(){return h},N},utcFormat:function(h){var N=T(h+="",z);return N.toString=function(){return h},N},utcParse:function(h){var N=k(h+="",!0);return N.toString=function(){return h},N}}}var Re={"-":"",_:" ",0:"0"},rt=/^\s*\d+/,Er=/^%/,Ir=/[\\^$*+?|[\]().{}]/g;function q(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s[e.toLowerCase(),n]))}function Ar(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function Wr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function $r(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function Or(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function Hr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function ze(t,e,n){var r=rt.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function qe(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Nr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function Pr(t,e,n){var r=rt.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function Vr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Be(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Rr(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ze(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function zr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function qr(t,e,n){var r=rt.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Br(t,e,n){var r=rt.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Zr(t,e,n){var r=rt.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Xr(t,e,n){var r=Er.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Gr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function jr(t,e,n){var r=rt.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Xe(t,e){return q(t.getDate(),e,2)}function Qr(t,e){return q(t.getHours(),e,2)}function Jr(t,e){return q(t.getHours()%12||12,e,2)}function Kr(t,e){return q(1+xt.count(kt(t),t),e,3)}function Dn(t,e){return q(t.getMilliseconds(),e,3)}function ti(t,e){return Dn(t,e)+"000"}function ei(t,e){return q(t.getMonth()+1,e,2)}function ni(t,e){return q(t.getMinutes(),e,2)}function ri(t,e){return q(t.getSeconds(),e,2)}function ii(t){var e=t.getDay();return e===0?7:e}function si(t,e){return q(zt.count(kt(t)-1,t),e,2)}function Mn(t){var e=t.getDay();return e>=4||e===0?bt(t):bt.ceil(t)}function ai(t,e){return t=Mn(t),q(bt.count(kt(t),t)+(kt(t).getDay()===4),e,2)}function oi(t){return t.getDay()}function ci(t,e){return q(Vt.count(kt(t)-1,t),e,2)}function ui(t,e){return q(t.getFullYear()%100,e,2)}function li(t,e){return t=Mn(t),q(t.getFullYear()%100,e,2)}function fi(t,e){return q(t.getFullYear()%1e4,e,4)}function di(t,e){var n=t.getDay();return t=n>=4||n===0?bt(t):bt.ceil(t),q(t.getFullYear()%1e4,e,4)}function hi(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+q(e/60|0,"0",2)+q(e%60,"0",2)}function Ge(t,e){return q(t.getUTCDate(),e,2)}function mi(t,e){return q(t.getUTCHours(),e,2)}function gi(t,e){return q(t.getUTCHours()%12||12,e,2)}function yi(t,e){return q(1+_e.count(wt(t),t),e,3)}function Cn(t,e){return q(t.getUTCMilliseconds(),e,3)}function ki(t,e){return Cn(t,e)+"000"}function pi(t,e){return q(t.getUTCMonth()+1,e,2)}function vi(t,e){return q(t.getUTCMinutes(),e,2)}function Ti(t,e){return q(t.getUTCSeconds(),e,2)}function xi(t){var e=t.getUTCDay();return e===0?7:e}function bi(t,e){return q(wn.count(wt(t)-1,t),e,2)}function Sn(t){var e=t.getUTCDay();return e>=4||e===0?It(t):It.ceil(t)}function wi(t,e){return t=Sn(t),q(It.count(wt(t),t)+(wt(t).getUTCDay()===4),e,2)}function Di(t){return t.getUTCDay()}function Mi(t,e){return q(re.count(wt(t)-1,t),e,2)}function Ci(t,e){return q(t.getUTCFullYear()%100,e,2)}function Si(t,e){return t=Sn(t),q(t.getUTCFullYear()%100,e,2)}function _i(t,e){return q(t.getUTCFullYear()%1e4,e,4)}function Yi(t,e){var n=t.getUTCDay();return t=n>=4||n===0?It(t):It.ceil(t),q(t.getUTCFullYear()%1e4,e,4)}function Fi(){return"+0000"}function je(){return"%"}function Qe(t){return+t}function Je(t){return Math.floor(+t/1e3)}var St,ie;Ui({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function Ui(t){return St=Ur(t),ie=St.format,St.parse,St.utcFormat,St.utcParse,St}function Ei(t){return new Date(t)}function Ii(t){return t instanceof Date?+t:+new Date(+t)}function _n(t,e,n,r,i,s,a,y,F,S){var w=Jn(),P=w.invert,_=w.domain,Y=S(".%L"),X=S(":%S"),B=S("%I:%M"),v=S("%I %p"),U=S("%a %d"),R=S("%b %d"),E=S("%B"),z=S("%Y");function G(T){return(F(T)4&&(Y+=7),_.add(Y,n));return X.diff(B,"week")+1},y.isoWeekday=function(S){return this.$utils().u(S)?this.day()||7:this.day(this.day()%7?S:S-7)};var F=y.startOf;y.startOf=function(S,w){var P=this.$utils(),_=!!P.u(w)||w;return P.p(S)==="isoweek"?_?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):F.bind(this)(S,w)}}}))})(jt)),jt.exports}var $i=Wi();const Oi=oe($i);var Qt={exports:{}},Hi=Qt.exports,tn;function Ni(){return tn||(tn=1,(function(t,e){(function(n,r){t.exports=r()})(Hi,(function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},r=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,i=/\d/,s=/\d\d/,a=/\d\d?/,y=/\d*[^-_:/,()\s\d]+/,F={},S=function(v){return(v=+v)+(v>68?1900:2e3)},w=function(v){return function(U){this[v]=+U}},P=[/[+-]\d\d:?(\d\d)?|Z/,function(v){(this.zone||(this.zone={})).offset=(function(U){if(!U||U==="Z")return 0;var R=U.match(/([+-]|\d\d)/g),E=60*R[1]+(+R[2]||0);return E===0?0:R[0]==="+"?-E:E})(v)}],_=function(v){var U=F[v];return U&&(U.indexOf?U:U.s.concat(U.f))},Y=function(v,U){var R,E=F.meridiem;if(E){for(var z=1;z<=24;z+=1)if(v.indexOf(E(z,0,U))>-1){R=z>12;break}}else R=v===(U?"pm":"PM");return R},X={A:[y,function(v){this.afternoon=Y(v,!1)}],a:[y,function(v){this.afternoon=Y(v,!0)}],Q:[i,function(v){this.month=3*(v-1)+1}],S:[i,function(v){this.milliseconds=100*+v}],SS:[s,function(v){this.milliseconds=10*+v}],SSS:[/\d{3}/,function(v){this.milliseconds=+v}],s:[a,w("seconds")],ss:[a,w("seconds")],m:[a,w("minutes")],mm:[a,w("minutes")],H:[a,w("hours")],h:[a,w("hours")],HH:[a,w("hours")],hh:[a,w("hours")],D:[a,w("day")],DD:[s,w("day")],Do:[y,function(v){var U=F.ordinal,R=v.match(/\d+/);if(this.day=R[0],U)for(var E=1;E<=31;E+=1)U(E).replace(/\[|\]/g,"")===v&&(this.day=E)}],w:[a,w("week")],ww:[s,w("week")],M:[a,w("month")],MM:[s,w("month")],MMM:[y,function(v){var U=_("months"),R=(_("monthsShort")||U.map((function(E){return E.slice(0,3)}))).indexOf(v)+1;if(R<1)throw new Error;this.month=R%12||R}],MMMM:[y,function(v){var U=_("months").indexOf(v)+1;if(U<1)throw new Error;this.month=U%12||U}],Y:[/[+-]?\d+/,w("year")],YY:[s,function(v){this.year=S(v)}],YYYY:[/\d{4}/,w("year")],Z:P,ZZ:P};function B(v){var U,R;U=v,R=F&&F.formats;for(var E=(v=U.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(x,C,M){var D=M&&M.toUpperCase();return C||R[M]||n[M]||R[D].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(c,g,b){return g||b.slice(1)}))}))).match(r),z=E.length,G=0;G-1)return new Date((I==="X"?1e3:1)*m);var u=B(I)(m),K=u.year,l=u.month,$=u.day,O=u.hours,j=u.minutes,H=u.seconds,J=u.milliseconds,h=u.zone,N=u.week,V=new Date,f=$||(K||l?1:V.getDate()),tt=K||V.getFullYear(),A=0;K&&!l||(A=l>0?l-1:V.getMonth());var Q,Z=O||0,st=j||0,at=H||0,pt=J||0;return h?new Date(Date.UTC(tt,A,f,Z,st,at,pt+60*h.offset*1e3)):o?new Date(Date.UTC(tt,A,f,Z,st,at,pt)):(Q=new Date(tt,A,f,Z,st,at,pt),N&&(Q=W(Q).week(N).toDate()),Q)}catch{return new Date("")}})(T,L,k,R),this.init(),D&&D!==!0&&(this.$L=this.locale(D).$L),M&&T!=this.format(L)&&(this.$d=new Date("")),F={}}else if(L instanceof Array)for(var c=L.length,g=1;g<=c;g+=1){p[1]=L[g-1];var b=R.apply(this,p);if(b.isValid()){this.$d=b.$d,this.$L=b.$L,this.init();break}g===c&&(this.$d=new Date(""))}else z.call(this,G)}}}))})(Qt)),Qt.exports}var Pi=Ni();const Vi=oe(Pi);var Jt={exports:{}},Ri=Jt.exports,en;function zi(){return en||(en=1,(function(t,e){(function(n,r){t.exports=r()})(Ri,(function(){return function(n,r){var i=r.prototype,s=i.format;i.format=function(a){var y=this,F=this.$locale();if(!this.isValid())return s.bind(this)(a);var S=this.$utils(),w=(a||"YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,(function(P){switch(P){case"Q":return Math.ceil((y.$M+1)/3);case"Do":return F.ordinal(y.$D);case"gggg":return y.weekYear();case"GGGG":return y.isoWeekYear();case"wo":return F.ordinal(y.week(),"W");case"w":case"ww":return S.s(y.week(),P==="w"?1:2,"0");case"W":case"WW":return S.s(y.isoWeek(),P==="W"?1:2,"0");case"k":case"kk":return S.s(String(y.$H===0?24:y.$H),P==="k"?1:2,"0");case"X":return Math.floor(y.$d.getTime()/1e3);case"x":return y.$d.getTime();case"z":return"["+y.offsetName()+"]";case"zzz":return"["+y.offsetName("long")+"]";default:return P}}));return s.bind(this)(w)}}}))})(Jt)),Jt.exports}var qi=zi();const Bi=oe(qi);var Kt={exports:{}},Zi=Kt.exports,nn;function Xi(){return nn||(nn=1,(function(t,e){(function(n,r){t.exports=r()})(Zi,(function(){var n,r,i=1e3,s=6e4,a=36e5,y=864e5,F=31536e6,S=2628e6,w=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,P=/\[([^\]]+)]|YYYY|YY|Y|M{1,2}|D{1,2}|H{1,2}|m{1,2}|s{1,2}|SSS/g,_={years:F,months:S,days:y,hours:a,minutes:s,seconds:i,milliseconds:1,weeks:6048e5},Y=function(T){return T instanceof z},X=function(T,k,p){return new z(T,p,k.$l)},B=function(T){return r.p(T)+"s"},v=function(T){return T<0},U=function(T){return v(T)?Math.ceil(T):Math.floor(T)},R=function(T){return Math.abs(T)},E=function(T,k){return T?v(T)?{negative:!0,format:""+R(T)+k}:{negative:!1,format:""+T+k}:{negative:!1,format:""}},z=(function(){function T(p,L,x){var C=this;if(this.$d={},this.$l=x,p===void 0&&(this.$ms=0,this.parseFromMilliseconds()),L)return X(p*_[B(L)],this);if(typeof p=="number")return this.$ms=p,this.parseFromMilliseconds(),this;if(typeof p=="object")return Object.keys(p).forEach((function(c){C.$d[B(c)]=p[c]})),this.calMilliseconds(),this;if(typeof p=="string"){var M=p.match(w);if(M){var D=M.slice(2).map((function(c){return c!=null?Number(c):0}));return this.$d.years=D[0],this.$d.months=D[1],this.$d.weeks=D[2],this.$d.days=D[3],this.$d.hours=D[4],this.$d.minutes=D[5],this.$d.seconds=D[6],this.calMilliseconds(),this}}return this}var k=T.prototype;return k.calMilliseconds=function(){var p=this;this.$ms=Object.keys(this.$d).reduce((function(L,x){return L+(p.$d[x]||0)*_[x]}),0)},k.parseFromMilliseconds=function(){var p=this.$ms;this.$d.years=U(p/F),p%=F,this.$d.months=U(p/S),p%=S,this.$d.days=U(p/y),p%=y,this.$d.hours=U(p/a),p%=a,this.$d.minutes=U(p/s),p%=s,this.$d.seconds=U(p/i),p%=i,this.$d.milliseconds=p},k.toISOString=function(){var p=E(this.$d.years,"Y"),L=E(this.$d.months,"M"),x=+this.$d.days||0;this.$d.weeks&&(x+=7*this.$d.weeks);var C=E(x,"D"),M=E(this.$d.hours,"H"),D=E(this.$d.minutes,"M"),c=this.$d.seconds||0;this.$d.milliseconds&&(c+=this.$d.milliseconds/1e3,c=Math.round(1e3*c)/1e3);var g=E(c,"S"),b=p.negative||L.negative||C.negative||M.negative||D.negative||g.negative,m=M.format||D.format||g.format?"T":"",I=(b?"-":"")+"P"+p.format+L.format+C.format+m+M.format+D.format+g.format;return I==="P"||I==="-P"?"P0D":I},k.toJSON=function(){return this.toISOString()},k.format=function(p){var L=p||"YYYY-MM-DDTHH:mm:ss",x={Y:this.$d.years,YY:r.s(this.$d.years,2,"0"),YYYY:r.s(this.$d.years,4,"0"),M:this.$d.months,MM:r.s(this.$d.months,2,"0"),D:this.$d.days,DD:r.s(this.$d.days,2,"0"),H:this.$d.hours,HH:r.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:r.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:r.s(this.$d.seconds,2,"0"),SSS:r.s(this.$d.milliseconds,3,"0")};return L.replace(P,(function(C,M){return M||String(x[C])}))},k.as=function(p){return this.$ms/_[B(p)]},k.get=function(p){var L=this.$ms,x=B(p);return x==="milliseconds"?L%=1e3:L=x==="weeks"?U(L/_[x]):this.$d[x],L||0},k.add=function(p,L,x){var C;return C=L?p*_[B(L)]:Y(p)?p.$ms:X(p,this).$ms,X(this.$ms+C*(x?-1:1),this)},k.subtract=function(p,L){return this.add(p,L,!0)},k.locale=function(p){var L=this.clone();return L.$l=p,L},k.clone=function(){return X(this.$ms,this)},k.humanize=function(p){return n().add(this.$ms,"ms").locale(this.$l).fromNow(!p)},k.valueOf=function(){return this.asMilliseconds()},k.milliseconds=function(){return this.get("milliseconds")},k.asMilliseconds=function(){return this.as("milliseconds")},k.seconds=function(){return this.get("seconds")},k.asSeconds=function(){return this.as("seconds")},k.minutes=function(){return this.get("minutes")},k.asMinutes=function(){return this.as("minutes")},k.hours=function(){return this.get("hours")},k.asHours=function(){return this.as("hours")},k.days=function(){return this.get("days")},k.asDays=function(){return this.as("days")},k.weeks=function(){return this.get("weeks")},k.asWeeks=function(){return this.as("weeks")},k.months=function(){return this.get("months")},k.asMonths=function(){return this.as("months")},k.years=function(){return this.get("years")},k.asYears=function(){return this.as("years")},T})(),G=function(T,k,p){return T.add(k.years()*p,"y").add(k.months()*p,"M").add(k.days()*p,"d").add(k.hours()*p,"h").add(k.minutes()*p,"m").add(k.seconds()*p,"s").add(k.milliseconds()*p,"ms")};return function(T,k,p){n=p,r=p().$utils(),p.duration=function(C,M){var D=p.locale();return X(C,{$l:D},M)},p.isDuration=Y;var L=k.prototype.add,x=k.prototype.subtract;k.prototype.add=function(C,M){return Y(C)?G(this,C,1):L.bind(this)(C,M)},k.prototype.subtract=function(C,M){return Y(C)?G(this,C,-1):x.bind(this)(C,M)}}}))})(Kt)),Kt.exports}var Gi=Xi();const ji=oe(Gi);var we=(function(){var t=d(function(D,c,g,b){for(g=g||{},b=D.length;b--;g[D[b]]=c);return g},"o"),e=[6,8,10,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,33,35,36,38,40],n=[1,26],r=[1,27],i=[1,28],s=[1,29],a=[1,30],y=[1,31],F=[1,32],S=[1,33],w=[1,34],P=[1,9],_=[1,10],Y=[1,11],X=[1,12],B=[1,13],v=[1,14],U=[1,15],R=[1,16],E=[1,19],z=[1,20],G=[1,21],T=[1,22],k=[1,23],p=[1,25],L=[1,35],x={trace:d(function(){},"trace"),yy:{},symbols_:{error:2,start:3,gantt:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NL:10,weekday:11,weekday_monday:12,weekday_tuesday:13,weekday_wednesday:14,weekday_thursday:15,weekday_friday:16,weekday_saturday:17,weekday_sunday:18,weekend:19,weekend_friday:20,weekend_saturday:21,dateFormat:22,inclusiveEndDates:23,topAxis:24,axisFormat:25,tickInterval:26,excludes:27,includes:28,todayMarker:29,title:30,acc_title:31,acc_title_value:32,acc_descr:33,acc_descr_value:34,acc_descr_multiline_value:35,section:36,clickStatement:37,taskTxt:38,taskData:39,click:40,callbackname:41,callbackargs:42,href:43,clickStatementDebug:44,$accept:0,$end:1},terminals_:{2:"error",4:"gantt",6:"EOF",8:"SPACE",10:"NL",12:"weekday_monday",13:"weekday_tuesday",14:"weekday_wednesday",15:"weekday_thursday",16:"weekday_friday",17:"weekday_saturday",18:"weekday_sunday",20:"weekend_friday",21:"weekend_saturday",22:"dateFormat",23:"inclusiveEndDates",24:"topAxis",25:"axisFormat",26:"tickInterval",27:"excludes",28:"includes",29:"todayMarker",30:"title",31:"acc_title",32:"acc_title_value",33:"acc_descr",34:"acc_descr_value",35:"acc_descr_multiline_value",36:"section",38:"taskTxt",39:"taskData",40:"click",41:"callbackname",42:"callbackargs",43:"href"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[11,1],[19,1],[19,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,1],[9,2],[37,2],[37,3],[37,3],[37,4],[37,3],[37,4],[37,2],[44,2],[44,3],[44,3],[44,4],[44,3],[44,4],[44,2]],performAction:d(function(c,g,b,m,I,o,W){var u=o.length-1;switch(I){case 1:return o[u-1];case 2:this.$=[];break;case 3:o[u-1].push(o[u]),this.$=o[u-1];break;case 4:case 5:this.$=o[u];break;case 6:case 7:this.$=[];break;case 8:m.setWeekday("monday");break;case 9:m.setWeekday("tuesday");break;case 10:m.setWeekday("wednesday");break;case 11:m.setWeekday("thursday");break;case 12:m.setWeekday("friday");break;case 13:m.setWeekday("saturday");break;case 14:m.setWeekday("sunday");break;case 15:m.setWeekend("friday");break;case 16:m.setWeekend("saturday");break;case 17:m.setDateFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 18:m.enableInclusiveEndDates(),this.$=o[u].substr(18);break;case 19:m.TopAxis(),this.$=o[u].substr(8);break;case 20:m.setAxisFormat(o[u].substr(11)),this.$=o[u].substr(11);break;case 21:m.setTickInterval(o[u].substr(13)),this.$=o[u].substr(13);break;case 22:m.setExcludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 23:m.setIncludes(o[u].substr(9)),this.$=o[u].substr(9);break;case 24:m.setTodayMarker(o[u].substr(12)),this.$=o[u].substr(12);break;case 27:m.setDiagramTitle(o[u].substr(6)),this.$=o[u].substr(6);break;case 28:this.$=o[u].trim(),m.setAccTitle(this.$);break;case 29:case 30:this.$=o[u].trim(),m.setAccDescription(this.$);break;case 31:m.addSection(o[u].substr(8)),this.$=o[u].substr(8);break;case 33:m.addTask(o[u-1],o[u]),this.$="task";break;case 34:this.$=o[u-1],m.setClickEvent(o[u-1],o[u],null);break;case 35:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],o[u]);break;case 36:this.$=o[u-2],m.setClickEvent(o[u-2],o[u-1],null),m.setLink(o[u-2],o[u]);break;case 37:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-2],o[u-1]),m.setLink(o[u-3],o[u]);break;case 38:this.$=o[u-2],m.setClickEvent(o[u-2],o[u],null),m.setLink(o[u-2],o[u-1]);break;case 39:this.$=o[u-3],m.setClickEvent(o[u-3],o[u-1],o[u]),m.setLink(o[u-3],o[u-2]);break;case 40:this.$=o[u-1],m.setLink(o[u-1],o[u]);break;case 41:case 47:this.$=o[u-1]+" "+o[u];break;case 42:case 43:case 45:this.$=o[u-2]+" "+o[u-1]+" "+o[u];break;case 44:case 46:this.$=o[u-3]+" "+o[u-2]+" "+o[u-1]+" "+o[u];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:36,11:17,12:n,13:r,14:i,15:s,16:a,17:y,18:F,19:18,20:S,21:w,22:P,23:_,24:Y,25:X,26:B,27:v,28:U,29:R,30:E,31:z,33:G,35:T,36:k,37:24,38:p,40:L},t(e,[2,5]),t(e,[2,6]),t(e,[2,17]),t(e,[2,18]),t(e,[2,19]),t(e,[2,20]),t(e,[2,21]),t(e,[2,22]),t(e,[2,23]),t(e,[2,24]),t(e,[2,25]),t(e,[2,26]),t(e,[2,27]),{32:[1,37]},{34:[1,38]},t(e,[2,30]),t(e,[2,31]),t(e,[2,32]),{39:[1,39]},t(e,[2,8]),t(e,[2,9]),t(e,[2,10]),t(e,[2,11]),t(e,[2,12]),t(e,[2,13]),t(e,[2,14]),t(e,[2,15]),t(e,[2,16]),{41:[1,40],43:[1,41]},t(e,[2,4]),t(e,[2,28]),t(e,[2,29]),t(e,[2,33]),t(e,[2,34],{42:[1,42],43:[1,43]}),t(e,[2,40],{41:[1,44]}),t(e,[2,35],{43:[1,45]}),t(e,[2,36]),t(e,[2,38],{42:[1,46]}),t(e,[2,37]),t(e,[2,39])],defaultActions:{},parseError:d(function(c,g){if(g.recoverable)this.trace(c);else{var b=new Error(c);throw b.hash=g,b}},"parseError"),parse:d(function(c){var g=this,b=[0],m=[],I=[null],o=[],W=this.table,u="",K=0,l=0,$=2,O=1,j=o.slice.call(arguments,1),H=Object.create(this.lexer),J={yy:{}};for(var h in this.yy)Object.prototype.hasOwnProperty.call(this.yy,h)&&(J.yy[h]=this.yy[h]);H.setInput(c,J.yy),J.yy.lexer=H,J.yy.parser=this,typeof H.yylloc>"u"&&(H.yylloc={});var N=H.yylloc;o.push(N);var V=H.options&&H.options.ranges;typeof J.yy.parseError=="function"?this.parseError=J.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function f(ot){b.length=b.length-2*ot,I.length=I.length-ot,o.length=o.length-ot}d(f,"popStack");function tt(){var ot;return ot=m.pop()||H.lex()||O,typeof ot!="number"&&(ot instanceof Array&&(m=ot,ot=m.pop()),ot=g.symbols_[ot]||ot),ot}d(tt,"lex");for(var A,Q,Z,st,at={},pt,ut,He,Bt;;){if(Q=b[b.length-1],this.defaultActions[Q]?Z=this.defaultActions[Q]:((A===null||typeof A>"u")&&(A=tt()),Z=W[Q]&&W[Q][A]),typeof Z>"u"||!Z.length||!Z[0]){var ce="";Bt=[];for(pt in W[Q])this.terminals_[pt]&&pt>$&&Bt.push("'"+this.terminals_[pt]+"'");H.showPosition?ce="Parse error on line "+(K+1)+`: `+H.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[A]||A)+"'":ce="Parse error on line "+(K+1)+": Unexpected "+(A==O?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(ce,{text:H.match,token:this.terminals_[A]||A,line:H.yylineno,loc:N,expected:Bt})}if(Z[0]instanceof Array&&Z.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Q+", token: "+A);switch(Z[0]){case 1:b.push(A),I.push(H.yytext),o.push(H.yylloc),b.push(Z[1]),A=null,l=H.yyleng,u=H.yytext,K=H.yylineno,N=H.yylloc;break;case 2:if(ut=this.productions_[Z[1]][1],at.$=I[I.length-ut],at._$={first_line:o[o.length-(ut||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(ut||1)].first_column,last_column:o[o.length-1].last_column},V&&(at._$.range=[o[o.length-(ut||1)].range[0],o[o.length-1].range[1]]),st=this.performAction.apply(at,[u,l,K,J.yy,Z[1],I,o].concat(j)),typeof st<"u")return st;ut&&(b=b.slice(0,-1*ut*2),I=I.slice(0,-1*ut),o=o.slice(0,-1*ut)),b.push(this.productions_[Z[1]][0]),I.push(at.$),o.push(at._$),He=W[b[b.length-2]][b[b.length-1]],b.push(He);break;case 3:return!0}}return!0},"parse")},C=(function(){var D={EOF:1,parseError:d(function(g,b){if(this.yy.parser)this.yy.parser.parseError(g,b);else throw new Error(g)},"parseError"),setInput:d(function(c,g){return this.yy=g||this.yy||{},this._input=c,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:d(function(){var c=this._input[0];this.yytext+=c,this.yyleng++,this.offset++,this.match+=c,this.matched+=c;var g=c.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),c},"input"),unput:d(function(c){var g=c.length,b=c.split(/(?:\r\n?|\n)/g);this._input=c+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),b.length-1&&(this.yylineno-=b.length-1);var I=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:b?(b.length===m.length?this.yylloc.first_column:0)+m[m.length-b.length].length-b[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[I[0],I[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(c){this.unput(this.match.slice(c))},"less"),pastInput:d(function(){var c=this.matched.substr(0,this.matched.length-this.match.length);return(c.length>20?"...":"")+c.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var c=this.match;return c.length<20&&(c+=this._input.substr(0,20-c.length)),(c.substr(0,20)+(c.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var c=this.pastInput(),g=new Array(c.length+1).join("-");return c+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js b/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-9OkgrWLV.js similarity index 99% rename from apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js rename to apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-9OkgrWLV.js index 131bb563844..56d622a1354 100644 --- a/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js +++ b/apps/kimi-code/dist-web/assets/gitGraphDiagram-IHSO6WYX-9OkgrWLV.js @@ -1,4 +1,4 @@ -import{I as le}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{p as he}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{p as $e,o as fe,s as ge,g as ue,a as ye,b as xe,_ as h,z as J,l as w,d as me,c as W,y as pe,A as be,q as we,k as B,B as ke,D as ve,E as Ce}from"./mermaid.core-CJB1tAev.js";import{p as Ee}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var m={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Be=ve.gitGraph,S=h(()=>ke({...Be,...J().gitGraph}),"getConfig"),d=new le(()=>{const e=S(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function Y(){return Ce({length:7})}h(Y,"getID");function te(e,r){const t=Object.create(null);return e.reduce((s,o)=>{const i=r(o);return t[i]||(t[i]=!0,s.push(o)),s},[])}h(te,"uniqBy");var Te=h(function(e){d.records.direction=e},"setDirection"),Le=h(function(e){w.debug("options str",e),e=e?.trim(),e=e||"{}";try{d.records.options=JSON.parse(e)}catch(r){w.error("error while parsing gitGraph options",r.message)}},"setOptions"),Me=h(function(){return d.records.options},"getOptions"),Re=h(function(e){let r=e.msg,t=e.id;const s=e.type;let o=e.tags;w.info("commit",r,t,s,o),w.debug("Entering commit:",r,t,s,o);const i=S();t=B.sanitizeText(t,i),r=B.sanitizeText(r,i),o=o?.map(a=>B.sanitizeText(a,i));const n={id:t||d.records.seq+"-"+Y(),message:r,seq:d.records.seq++,type:s??m.NORMAL,tags:o??[],parents:d.records.head==null?[]:[d.records.head.id],branch:d.records.currBranch};d.records.head=n,w.info("main branch",i.mainBranchName),d.records.commits.has(n.id)&&w.warn(`Commit ID ${n.id} already exists`),d.records.commits.set(n.id,n),d.records.branches.set(d.records.currBranch,n.id),w.debug("in pushCommit "+n.id)},"commit"),Ie=h(function(e){let r=e.name;const t=e.order;if(r=B.sanitizeText(r,S()),d.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);d.records.branches.set(r,d.records.head!=null?d.records.head.id:null),d.records.branchConfig.set(r,{name:r,order:t}),ae(r),w.debug("in createBranch")},"branch"),Oe=h(e=>{let r=e.branch,t=e.id;const s=e.type,o=e.tags,i=S();r=B.sanitizeText(r,i),t&&(t=B.sanitizeText(t,i));const n=d.records.branches.get(d.records.currBranch),a=d.records.branches.get(r),l=n?d.records.commits.get(n):void 0,f=a?d.records.commits.get(a):void 0;if(l&&f&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(d.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!d.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(f===void 0||!f){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===f){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&d.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${s} ${o?.join(" ")}`,token:`merge ${r} ${t} ${s} ${o?.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`]},c}const g=a||"",$={id:t||`${d.records.seq}-${Y()}`,message:`merged branch ${r} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,g],branch:d.records.currBranch,type:m.MERGE,customType:s,customId:!!t,tags:o??[]};d.records.head=$,d.records.commits.set($.id,$),d.records.branches.set(d.records.currBranch,$.id),w.debug(d.records.branches),w.debug("in mergeBranch")},"merge"),_e=h(function(e){let r=e.id,t=e.targetId,s=e.tags,o=e.parent;w.debug("Entering cherryPick:",r,t,s);const i=S();if(r=B.sanitizeText(r,i),t=B.sanitizeText(t,i),s=s?.map(l=>B.sanitizeText(l,i)),o=B.sanitizeText(o,i),!r||!d.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=d.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&!(Array.isArray(n.parents)&&n.parents.includes(o)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===m.MERGE&&!o)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!d.records.commits.has(t)){if(a===d.records.currBranch){const $=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const l=d.records.branches.get(d.records.currBranch);if(l===void 0||!l){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const f=d.records.commits.get(l);if(f===void 0||!f){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const g={id:d.records.seq+"-"+Y(),message:`cherry-picked ${n?.message} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,n.id],branch:d.records.currBranch,type:m.CHERRY_PICK,tags:s?s.filter(Boolean):[`cherry-pick:${n.id}${n.type===m.MERGE?`|parent:${o}`:""}`]};d.records.head=g,d.records.commits.set(g.id,g),d.records.branches.set(d.records.currBranch,g.id),w.debug(d.records.branches),w.debug("in cherryPick")}},"cherryPick"),ae=h(function(e){if(e=B.sanitizeText(e,S()),d.records.branches.has(e)){d.records.currBranch=e;const r=d.records.branches.get(d.records.currBranch);r===void 0||!r?d.records.head=null:d.records.head=d.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function V(e,r,t){const s=e.indexOf(r);s===-1?e.push(t):e.splice(s,1,t)}h(V,"upsert");function Q(e){const r=e.reduce((o,i)=>o.seq>i.seq?o:i,e[0]);let t="";e.forEach(function(o){o===r?t+=" *":t+=" |"});const s=[t,r.id,r.seq];for(const o in d.records.branches)d.records.branches.get(o)===r.id&&s.push(o);if(w.debug(s.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const o=d.records.commits.get(r.parents[0]);V(e,r,o),r.parents[1]&&e.push(d.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const o=d.records.commits.get(r.parents[0]);V(e,r,o)}}e=te(e,o=>o.id),Q(e)}h(Q,"prettyPrintCommitHistory");var Ge=h(function(){w.debug(d.records.commits);const e=ne()[0];Q([e])},"prettyPrint"),He=h(function(){d.reset(),we()},"clear"),Se=h(function(){return[...d.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ae=h(function(){return d.records.branches},"getBranches"),De=h(function(){return d.records.commits},"getCommits"),ne=h(function(){const e=[...d.records.commits.values()];return e.forEach(function(r){w.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),qe=h(function(){return d.records.currBranch},"getCurrentBranch"),Pe=h(function(){return d.records.direction},"getDirection"),We=h(function(){return d.records.head},"getHead"),se={commitType:m,getConfig:S,setDirection:Te,setOptions:Le,getOptions:Me,commit:Re,branch:Ie,merge:Oe,cherryPick:_e,checkout:ae,prettyPrint:Ge,clear:He,getBranchesAsObjArray:Se,getBranches:Ae,getCommits:De,getCommitsArray:ne,getCurrentBranch:qe,getDirection:Pe,getHead:We,setAccTitle:xe,getAccTitle:ye,getAccDescription:ue,setAccDescription:ge,setDiagramTitle:fe,getDiagramTitle:$e},Ne=h((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)Fe(t,r)},"populate"),Fe=h((e,r)=>{const s={Commit:h(o=>r.commit(ze(o)),"Commit"),Branch:h(o=>r.branch(Ye(o)),"Branch"),Merge:h(o=>r.merge(je(o)),"Merge"),Checkout:h(o=>r.checkout(Ue(o)),"Checkout"),CherryPicking:h(o=>r.cherryPick(Ke(o)),"CherryPicking")}[e.$type];s?s(e):w.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),ze=h(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?m[e.type]:m.NORMAL,tags:e.tags??void 0}),"parseCommit"),Ye=h(e=>({name:e.name,order:e.order??0}),"parseBranch"),je=h(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?m[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ue=h(e=>e.branch,"parseCheckout"),Ke=h(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ve={parse:h(async e=>{const r=await Ee("gitGraph",e);w.debug(r),Ne(r,se)},"parse")},O=10,_=40,L=4,R=2,G=8,j=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),X=12,Z=new Set(["redux-color","redux-dark-color"]),Xe=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),H=h((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,E=new Map,F=30,q=new Map,z=[],I=0,y="LR",Je=h(()=>{C.clear(),E.clear(),q.clear(),I=0,z=[],y="LR"},"clear"),oe=h(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(s=>{const o=document.createElementNS("http://www.w3.org/2000/svg","tspan");o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),o.setAttribute("dy","1em"),o.setAttribute("x","0"),o.setAttribute("class","row"),o.textContent=s.trim(),r.appendChild(o)}),r},"drawText"),ce=h(e=>{let r,t,s;return y==="BT"?(t=h((o,i)=>o<=i,"comparisonFunc"),s=1/0):(t=h((o,i)=>o>=i,"comparisonFunc"),s=0),e.forEach(o=>{const i=y==="TB"||y=="BT"?E.get(o)?.y:E.get(o)?.x;i!==void 0&&t(i,s)&&(r=o,s=i)}),r},"findClosestParent"),Qe=h(e=>{let r="",t=1/0;return e.forEach(s=>{const o=E.get(s).y;o<=t&&(r=s,t=o)}),r||void 0},"findClosestParentBT"),Ze=h((e,r,t)=>{let s=t,o=t;const i=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(s=rr(a),o=Math.max(s,o)):i.push(a),tr(a,s)}),s=o,i.forEach(n=>{ar(n,s,t)}),e.forEach(n=>{const a=r.get(n);if(a?.parents.length){const l=Qe(a.parents);s=E.get(l).y-_,s<=o&&(o=s);const f=C.get(a.branch).pos,g=s-O;E.set(a.id,{x:f,y:g})}})},"setParallelBTPos"),er=h(e=>{const r=ce(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=E.get(r)?.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),rr=h(e=>er(e)+_,"calculateCommitPosition"),tr=h((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const s=t.pos,o=r+O;return E.set(e.id,{x:s,y:o}),{x:s,y:o}},"setCommitPosition"),ar=h((e,r,t)=>{const s=C.get(e.branch);if(!s)throw new Error(`Branch not found for commit ${e.id}`);const o=r+t,i=s.pos;E.set(e.id,{x:i,y:o})},"setRootPosition"),nr=h((e,r,t,s,o,i)=>{const{theme:n}=W(),a=j.has(n??""),l=Z.has(n??""),f=Xe.has(n??"");if(i===m.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${H(o,G,l)} ${s}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${H(o,G,l)} ${s}-inner`);else if(i===m.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${H(o,G,l)}`),i===m.MERGE){const $=e.append("circle");$.attr("cx",t.x),$.attr("cy",t.y),$.attr("r",a?5:6),$.attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}if(i===m.REVERSE){const $=e.append("path"),c=a?4:5;$.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}}},"drawCommitBullet"),sr=h((e,r,t,s,o)=>{if(r.type!==m.CHERRY_PICK&&(r.customId&&r.type===m.MERGE||r.type!==m.MERGE)&&o.showCommitLabel){const i=e.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),a=i.append("text").attr("x",s).attr("y",t.y+25).attr("class","commit-label").text(r.id),l=a.node()?.getBBox();if(l&&(n.attr("x",t.posWithOffset-l.width/2-R).attr("y",t.y+13.5).attr("width",l.width+2*R).attr("height",l.height+2*R),y==="TB"||y==="BT"?(n.attr("x",t.x-(l.width+4*L+5)).attr("y",t.y-12),a.attr("x",t.x-(l.width+4*L)).attr("y",t.y+l.height-12)):a.attr("x",t.posWithOffset-l.width/2),o.rotateCommitLabel))if(y==="TB"||y==="BT")a.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),n.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const f=-7.5-(l.width+10)/25*9.5,g=10+l.width/25*8.5;i.attr("transform","translate("+f+", "+g+") rotate(-45, "+s+", "+t.y+")")}}},"drawCommitLabel"),or=h((e,r,t,s)=>{if(r.tags.length>0){let o=0,i=0,n=0;const a=[];for(const l of r.tags.reverse()){const f=e.insert("polygon"),g=e.append("circle"),$=e.append("text").attr("y",t.y-16-o).attr("class","tag-label").text(l),c=$.node()?.getBBox();if(!c)throw new Error("Tag bbox not found");i=Math.max(i,c.width),n=Math.max(n,c.height),$.attr("x",t.posWithOffset-c.width/2),a.push({tag:$,hole:g,rect:f,yOffset:o}),o+=20}for(const{tag:l,hole:f,rect:g,yOffset:$}of a){const c=n/2,x=t.y-19.2-$;if(g.attr("class","tag-label-bkg").attr("points",` +import{I as le}from"./chunk-2Q5K7J3B-Dntoz8YC.js";import{p as he}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{p as $e,o as fe,s as ge,g as ue,a as ye,b as xe,_ as h,z as J,l as w,d as me,c as W,y as pe,A as be,q as we,k as B,B as ke,D as ve,E as Ce}from"./mermaid.core-CsZwh_jB.js";import{p as Ee}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var m={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},Be=ve.gitGraph,S=h(()=>ke({...Be,...J().gitGraph}),"getConfig"),d=new le(()=>{const e=S(),r=e.mainBranchName,t=e.mainBranchOrder;return{mainBranchName:r,commits:new Map,head:null,branchConfig:new Map([[r,{name:r,order:t}]]),branches:new Map([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});function Y(){return Ce({length:7})}h(Y,"getID");function te(e,r){const t=Object.create(null);return e.reduce((s,o)=>{const i=r(o);return t[i]||(t[i]=!0,s.push(o)),s},[])}h(te,"uniqBy");var Te=h(function(e){d.records.direction=e},"setDirection"),Le=h(function(e){w.debug("options str",e),e=e?.trim(),e=e||"{}";try{d.records.options=JSON.parse(e)}catch(r){w.error("error while parsing gitGraph options",r.message)}},"setOptions"),Me=h(function(){return d.records.options},"getOptions"),Re=h(function(e){let r=e.msg,t=e.id;const s=e.type;let o=e.tags;w.info("commit",r,t,s,o),w.debug("Entering commit:",r,t,s,o);const i=S();t=B.sanitizeText(t,i),r=B.sanitizeText(r,i),o=o?.map(a=>B.sanitizeText(a,i));const n={id:t||d.records.seq+"-"+Y(),message:r,seq:d.records.seq++,type:s??m.NORMAL,tags:o??[],parents:d.records.head==null?[]:[d.records.head.id],branch:d.records.currBranch};d.records.head=n,w.info("main branch",i.mainBranchName),d.records.commits.has(n.id)&&w.warn(`Commit ID ${n.id} already exists`),d.records.commits.set(n.id,n),d.records.branches.set(d.records.currBranch,n.id),w.debug("in pushCommit "+n.id)},"commit"),Ie=h(function(e){let r=e.name;const t=e.order;if(r=B.sanitizeText(r,S()),d.records.branches.has(r))throw new Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);d.records.branches.set(r,d.records.head!=null?d.records.head.id:null),d.records.branchConfig.set(r,{name:r,order:t}),ae(r),w.debug("in createBranch")},"branch"),Oe=h(e=>{let r=e.branch,t=e.id;const s=e.type,o=e.tags,i=S();r=B.sanitizeText(r,i),t&&(t=B.sanitizeText(t,i));const n=d.records.branches.get(d.records.currBranch),a=d.records.branches.get(r),l=n?d.records.commits.get(n):void 0,f=a?d.records.commits.get(a):void 0;if(l&&f&&l.branch===r)throw new Error(`Cannot merge branch '${r}' into itself.`);if(d.records.currBranch===r){const c=new Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(l===void 0||!l){const c=new Error(`Incorrect usage of "merge". Current branch (${d.records.currBranch})has no commits`);throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},c}if(!d.records.branches.has(r)){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},c}if(f===void 0||!f){const c=new Error('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},c}if(l===f){const c=new Error('Incorrect usage of "merge". Both branches have same head');throw c.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},c}if(t&&d.records.commits.has(t)){const c=new Error('Incorrect usage of "merge". Commit with id:'+t+" already exists, use different custom id");throw c.hash={text:`merge ${r} ${t} ${s} ${o?.join(" ")}`,token:`merge ${r} ${t} ${s} ${o?.join(" ")}`,expected:[`merge ${r} ${t}_UNIQUE ${s} ${o?.join(" ")}`]},c}const g=a||"",$={id:t||`${d.records.seq}-${Y()}`,message:`merged branch ${r} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,g],branch:d.records.currBranch,type:m.MERGE,customType:s,customId:!!t,tags:o??[]};d.records.head=$,d.records.commits.set($.id,$),d.records.branches.set(d.records.currBranch,$.id),w.debug(d.records.branches),w.debug("in mergeBranch")},"merge"),_e=h(function(e){let r=e.id,t=e.targetId,s=e.tags,o=e.parent;w.debug("Entering cherryPick:",r,t,s);const i=S();if(r=B.sanitizeText(r,i),t=B.sanitizeText(t,i),s=s?.map(l=>B.sanitizeText(l,i)),o=B.sanitizeText(o,i),!r||!d.records.commits.has(r)){const l=new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw l.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},l}const n=d.records.commits.get(r);if(n===void 0||!n)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&!(Array.isArray(n.parents)&&n.parents.includes(o)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const a=n.branch;if(n.type===m.MERGE&&!o)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!t||!d.records.commits.has(t)){if(a===d.records.currBranch){const $=new Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const l=d.records.branches.get(d.records.currBranch);if(l===void 0||!l){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const f=d.records.commits.get(l);if(f===void 0||!f){const $=new Error(`Incorrect usage of "cherry-pick". Current branch (${d.records.currBranch})has no commits`);throw $.hash={text:`cherryPick ${r} ${t}`,token:`cherryPick ${r} ${t}`,expected:["cherry-pick abc"]},$}const g={id:d.records.seq+"-"+Y(),message:`cherry-picked ${n?.message} into ${d.records.currBranch}`,seq:d.records.seq++,parents:d.records.head==null?[]:[d.records.head.id,n.id],branch:d.records.currBranch,type:m.CHERRY_PICK,tags:s?s.filter(Boolean):[`cherry-pick:${n.id}${n.type===m.MERGE?`|parent:${o}`:""}`]};d.records.head=g,d.records.commits.set(g.id,g),d.records.branches.set(d.records.currBranch,g.id),w.debug(d.records.branches),w.debug("in cherryPick")}},"cherryPick"),ae=h(function(e){if(e=B.sanitizeText(e,S()),d.records.branches.has(e)){d.records.currBranch=e;const r=d.records.branches.get(d.records.currBranch);r===void 0||!r?d.records.head=null:d.records.head=d.records.commits.get(r)??null}else{const r=new Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw r.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},r}},"checkout");function V(e,r,t){const s=e.indexOf(r);s===-1?e.push(t):e.splice(s,1,t)}h(V,"upsert");function Q(e){const r=e.reduce((o,i)=>o.seq>i.seq?o:i,e[0]);let t="";e.forEach(function(o){o===r?t+=" *":t+=" |"});const s=[t,r.id,r.seq];for(const o in d.records.branches)d.records.branches.get(o)===r.id&&s.push(o);if(w.debug(s.join(" ")),r.parents&&r.parents.length==2&&r.parents[0]&&r.parents[1]){const o=d.records.commits.get(r.parents[0]);V(e,r,o),r.parents[1]&&e.push(d.records.commits.get(r.parents[1]))}else{if(r.parents.length==0)return;if(r.parents[0]){const o=d.records.commits.get(r.parents[0]);V(e,r,o)}}e=te(e,o=>o.id),Q(e)}h(Q,"prettyPrintCommitHistory");var Ge=h(function(){w.debug(d.records.commits);const e=ne()[0];Q([e])},"prettyPrint"),He=h(function(){d.reset(),we()},"clear"),Se=h(function(){return[...d.records.branchConfig.values()].map((r,t)=>r.order!==null&&r.order!==void 0?r:{...r,order:parseFloat(`0.${t}`)}).sort((r,t)=>(r.order??0)-(t.order??0)).map(({name:r})=>({name:r}))},"getBranchesAsObjArray"),Ae=h(function(){return d.records.branches},"getBranches"),De=h(function(){return d.records.commits},"getCommits"),ne=h(function(){const e=[...d.records.commits.values()];return e.forEach(function(r){w.debug(r.id)}),e.sort((r,t)=>r.seq-t.seq),e},"getCommitsArray"),qe=h(function(){return d.records.currBranch},"getCurrentBranch"),Pe=h(function(){return d.records.direction},"getDirection"),We=h(function(){return d.records.head},"getHead"),se={commitType:m,getConfig:S,setDirection:Te,setOptions:Le,getOptions:Me,commit:Re,branch:Ie,merge:Oe,cherryPick:_e,checkout:ae,prettyPrint:Ge,clear:He,getBranchesAsObjArray:Se,getBranches:Ae,getCommits:De,getCommitsArray:ne,getCurrentBranch:qe,getDirection:Pe,getHead:We,setAccTitle:xe,getAccTitle:ye,getAccDescription:ue,setAccDescription:ge,setDiagramTitle:fe,getDiagramTitle:$e},Ne=h((e,r)=>{he(e,r),e.dir&&r.setDirection(e.dir);for(const t of e.statements)Fe(t,r)},"populate"),Fe=h((e,r)=>{const s={Commit:h(o=>r.commit(ze(o)),"Commit"),Branch:h(o=>r.branch(Ye(o)),"Branch"),Merge:h(o=>r.merge(je(o)),"Merge"),Checkout:h(o=>r.checkout(Ue(o)),"Checkout"),CherryPicking:h(o=>r.cherryPick(Ke(o)),"CherryPicking")}[e.$type];s?s(e):w.error(`Unknown statement type: ${e.$type}`)},"parseStatement"),ze=h(e=>({id:e.id,msg:e.message??"",type:e.type!==void 0?m[e.type]:m.NORMAL,tags:e.tags??void 0}),"parseCommit"),Ye=h(e=>({name:e.name,order:e.order??0}),"parseBranch"),je=h(e=>({branch:e.branch,id:e.id??"",type:e.type!==void 0?m[e.type]:void 0,tags:e.tags??void 0}),"parseMerge"),Ue=h(e=>e.branch,"parseCheckout"),Ke=h(e=>({id:e.id,targetId:"",tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),"parseCherryPicking"),Ve={parse:h(async e=>{const r=await Ee("gitGraph",e);w.debug(r),Ne(r,se)},"parse")},O=10,_=40,L=4,R=2,G=8,j=new Set(["redux","redux-dark","redux-color","redux-dark-color"]),X=12,Z=new Set(["redux-color","redux-dark-color"]),Xe=new Set(["dark","redux-dark","redux-dark-color","neo-dark"]),H=h((e,r,t=!1)=>t&&e>0?(e-1)%(r-1)+1:e%r,"calcColorIndex"),C=new Map,E=new Map,F=30,q=new Map,z=[],I=0,y="LR",Je=h(()=>{C.clear(),E.clear(),q.clear(),I=0,z=[],y="LR"},"clear"),oe=h(e=>{const r=document.createElementNS("http://www.w3.org/2000/svg","text");return(typeof e=="string"?e.split(/\\n|\n|/gi):e).forEach(s=>{const o=document.createElementNS("http://www.w3.org/2000/svg","tspan");o.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),o.setAttribute("dy","1em"),o.setAttribute("x","0"),o.setAttribute("class","row"),o.textContent=s.trim(),r.appendChild(o)}),r},"drawText"),ce=h(e=>{let r,t,s;return y==="BT"?(t=h((o,i)=>o<=i,"comparisonFunc"),s=1/0):(t=h((o,i)=>o>=i,"comparisonFunc"),s=0),e.forEach(o=>{const i=y==="TB"||y=="BT"?E.get(o)?.y:E.get(o)?.x;i!==void 0&&t(i,s)&&(r=o,s=i)}),r},"findClosestParent"),Qe=h(e=>{let r="",t=1/0;return e.forEach(s=>{const o=E.get(s).y;o<=t&&(r=s,t=o)}),r||void 0},"findClosestParentBT"),Ze=h((e,r,t)=>{let s=t,o=t;const i=[];e.forEach(n=>{const a=r.get(n);if(!a)throw new Error(`Commit not found for key ${n}`);a.parents.length?(s=rr(a),o=Math.max(s,o)):i.push(a),tr(a,s)}),s=o,i.forEach(n=>{ar(n,s,t)}),e.forEach(n=>{const a=r.get(n);if(a?.parents.length){const l=Qe(a.parents);s=E.get(l).y-_,s<=o&&(o=s);const f=C.get(a.branch).pos,g=s-O;E.set(a.id,{x:f,y:g})}})},"setParallelBTPos"),er=h(e=>{const r=ce(e.parents.filter(s=>s!==null));if(!r)throw new Error(`Closest parent not found for commit ${e.id}`);const t=E.get(r)?.y;if(t===void 0)throw new Error(`Closest parent position not found for commit ${e.id}`);return t},"findClosestParentPos"),rr=h(e=>er(e)+_,"calculateCommitPosition"),tr=h((e,r)=>{const t=C.get(e.branch);if(!t)throw new Error(`Branch not found for commit ${e.id}`);const s=t.pos,o=r+O;return E.set(e.id,{x:s,y:o}),{x:s,y:o}},"setCommitPosition"),ar=h((e,r,t)=>{const s=C.get(e.branch);if(!s)throw new Error(`Branch not found for commit ${e.id}`);const o=r+t,i=s.pos;E.set(e.id,{x:i,y:o})},"setRootPosition"),nr=h((e,r,t,s,o,i)=>{const{theme:n}=W(),a=j.has(n??""),l=Z.has(n??""),f=Xe.has(n??"");if(i===m.HIGHLIGHT)e.append("rect").attr("x",t.x-10+(a?3:0)).attr("y",t.y-10+(a?3:0)).attr("width",a?14:20).attr("height",a?14:20).attr("class",`commit ${r.id} commit-highlight${H(o,G,l)} ${s}-outer`),e.append("rect").attr("x",t.x-6+(a?2:0)).attr("y",t.y-6+(a?2:0)).attr("width",a?8:12).attr("height",a?8:12).attr("class",`commit ${r.id} commit${H(o,G,l)} ${s}-inner`);else if(i===m.CHERRY_PICK)e.append("circle").attr("cx",t.x).attr("cy",t.y).attr("r",a?7:10).attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x-3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("circle").attr("cx",t.x+3).attr("cy",t.y+2).attr("r",a?2.5:2.75).attr("fill",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x+3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`),e.append("line").attr("x1",t.x-3).attr("y1",t.y+1).attr("x2",t.x).attr("y2",t.y-5).attr("stroke",f?"#000000":"#fff").attr("class",`commit ${r.id} ${s}`);else{const g=e.append("circle");if(g.attr("cx",t.x),g.attr("cy",t.y),g.attr("r",a?7:10),g.attr("class",`commit ${r.id} commit${H(o,G,l)}`),i===m.MERGE){const $=e.append("circle");$.attr("cx",t.x),$.attr("cy",t.y),$.attr("r",a?5:6),$.attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}if(i===m.REVERSE){const $=e.append("path"),c=a?4:5;$.attr("d",`M ${t.x-c},${t.y-c}L${t.x+c},${t.y+c}M${t.x-c},${t.y+c}L${t.x+c},${t.y-c}`).attr("class",`commit ${s} ${r.id} commit${H(o,G,l)}`)}}},"drawCommitBullet"),sr=h((e,r,t,s,o)=>{if(r.type!==m.CHERRY_PICK&&(r.customId&&r.type===m.MERGE||r.type!==m.MERGE)&&o.showCommitLabel){const i=e.append("g"),n=i.insert("rect").attr("class","commit-label-bkg"),a=i.append("text").attr("x",s).attr("y",t.y+25).attr("class","commit-label").text(r.id),l=a.node()?.getBBox();if(l&&(n.attr("x",t.posWithOffset-l.width/2-R).attr("y",t.y+13.5).attr("width",l.width+2*R).attr("height",l.height+2*R),y==="TB"||y==="BT"?(n.attr("x",t.x-(l.width+4*L+5)).attr("y",t.y-12),a.attr("x",t.x-(l.width+4*L)).attr("y",t.y+l.height-12)):a.attr("x",t.posWithOffset-l.width/2),o.rotateCommitLabel))if(y==="TB"||y==="BT")a.attr("transform","rotate(-45, "+t.x+", "+t.y+")"),n.attr("transform","rotate(-45, "+t.x+", "+t.y+")");else{const f=-7.5-(l.width+10)/25*9.5,g=10+l.width/25*8.5;i.attr("transform","translate("+f+", "+g+") rotate(-45, "+s+", "+t.y+")")}}},"drawCommitLabel"),or=h((e,r,t,s)=>{if(r.tags.length>0){let o=0,i=0,n=0;const a=[];for(const l of r.tags.reverse()){const f=e.insert("polygon"),g=e.append("circle"),$=e.append("text").attr("y",t.y-16-o).attr("class","tag-label").text(l),c=$.node()?.getBBox();if(!c)throw new Error("Tag bbox not found");i=Math.max(i,c.width),n=Math.max(n,c.height),$.attr("x",t.posWithOffset-c.width/2),a.push({tag:$,hole:g,rect:f,yOffset:o}),o+=20}for(const{tag:l,hole:f,rect:g,yOffset:$}of a){const c=n/2,x=t.y-19.2-$;if(g.attr("class","tag-label-bkg").attr("points",` ${s-i/2-L/2},${x+R} ${s-i/2-L/2},${x-R} ${t.posWithOffset-i/2-L},${x-c-R} diff --git a/apps/kimi-code/dist-web/assets/index-ZmzTmhry.js b/apps/kimi-code/dist-web/assets/index-B1mxH1U6.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index-ZmzTmhry.js rename to apps/kimi-code/dist-web/assets/index-B1mxH1U6.js index 68d0a62c816..c56dbd551bc 100644 --- a/apps/kimi-code/dist-web/assets/index-ZmzTmhry.js +++ b/apps/kimi-code/dist-web/assets/index-B1mxH1U6.js @@ -1,4 +1,4 @@ -import{t as pe,b as Ln,n as Or,c as Nr,a as Fr,d as zr,s as Ur,g as Vr,e as Br}from"./index-BZFTzQ6y.js";import{f as Ld}from"./index-BZFTzQ6y.js";import{bR as k}from"./index-D-7nOosq.js";const Ei="diffs-container",$r=(()=>{try{return!1}catch{return!1}})(),Wr=/(?=^From [a-f0-9]+ .+$)/m,Ti=/(?=^diff --git)/gm,Ul=/(?=^---\s+\S)/gm,Vl=/(?=^@@ )/gm,Gr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,jr=/(?<=\n)/,qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Bl=/^<{7,}(?:\s.*)?$/,$l=/^\|{7,}(?:\s.*)?$/,Wl=/^={7,}$/,Gl=/^>{7,}(?:\s.*)?$/,on="header-prefix",sn="header-metadata",an="header-custom",_={dark:"pierre-dark",light:"pierre-light"},Ii="data-theme-css",Ri="data-unsafe-css",Qr="data-core-css",Jr="data-diffs-scrollbar-measure",Ai="--diffs-scrollbar-gutter-measured",jl=1,Zr=1e5,ln={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},_e={...ln,hunkLineCount:1},eo={paddingTop:8,paddingBottom:8,gap:8},to={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},no=Object.freeze({fromStart:0,fromEnd:0}),Ae={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Hi={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ie=new Set;let Re=null;function Y(e){Ie.add(e),Re??=requestAnimationFrame(Mi)}function io(e){Ie.delete(e),Ie.size===0&&Re!=null&&(cancelAnimationFrame(Re),Re=null)}function Mi(e){const t=new Set(Ie);Ie.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ie.size>0?Re=requestAnimationFrame(Mi):Re=null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function De(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function dn(e,t){const n=e?.theme??_,i=t?.theme??_,r=kn(e),o=kn(t);return De(n,i)&&He(e,t,["theme","parseDiffOptions"])&&He(r,o)}function kn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Wt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(e){return{type:"text",value:e}}function A({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function pt({name:e,width:t=16,height:n=16,properties:i}){return A({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[A({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function oo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ee(e){return A({tagName:"div",properties:{"data-gutter":""},children:e})}function Di(e,t,n,i={}){return A({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[A({tagName:"span",properties:{"data-line-number-content":""},children:[W(`${t}`)]})]:void 0})}function j(e,t,n){return A({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function so(){return A({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[pt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ao(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Pi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Wt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&et(e.composedPath())||(he(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(he(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(he(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){he(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();he(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);he(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const g=Tt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Tt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(co(r)&&f!=null){f(r);break}if(ho(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Tt(r))break;ut(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:g}=this.options,b=g!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||b;y&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,he(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const m=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",p=this.pointerSession.mode==="gutterSelecting";(!f&&m||!b&&p)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();et(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(ao(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=pe(so());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Ve(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Ze(r));if(Ve(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Ve(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Ve(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&et(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Ze(e);if(t&&et(n))return;const i=fo(e);return i!=null?Ze(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=go(po(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Ze(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Wt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;cs)break;if(g==null||gNumber.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ke({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p},C,v,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:lo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p,getLineIndex:v}}function lo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Ve(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function Tt(e){return Ve(e)||ut(e)}function ho(e){return"type"in e&&e.type==="line-info"}function co(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function wn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ze(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function po(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function go(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function Tn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function In(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function et(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function he(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var _i=class ue{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ue.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let g=o.get(u);if(g!=null){this.observedNodes.set(u,g),this.observedNodes.set(f,g),o.delete(u),o.delete(f);continue}const b=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;g={type:"annotations",column1:{container:h,child:u,childHeight:b},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:g,newHeight:Math.max(b,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?bo(l):Co(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ue,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ue,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?mo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?vo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function mo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function vo(e){return Math.max(Math.ceil(e),0)}function bo(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const Se=new Map,It=new Map,jt=new Map,gt=new Set;function mt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!gt.has(t))return!1;return!0}function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(gt.has(n.name))continue;let i=Se.get(n.name);i==null&&(i=n,Se.set(n.name,i)),gt.add(i.name),t.loadLanguageSync(i.data)}}function So(){Se.clear(),gt.clear()}function Oi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Ni(e){if(Oi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=It.get(e);if(t!=null)return t;try{let n=jt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Ln,e)&&(n=Ln[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Se.has(e)||Se.set(e,o),o});return It.set(e,i),await i}finally{It.delete(e)}}function Fi(e){return Se.get(e)??Ni(e)}const vt=new Set;function Ye(e){const t=[],n=new Set;for(const c of yo(e.themes)){const u=zi(c)?c.getThemes():[c];for(const f of u){if(n.has(f.name))throw new Error(`Theme collection already contains theme "${f.name}"`);n.add(f.name),t.push(f)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),d=Object.freeze(o.map(c=>c.name));function h(c){if(c==null)return i;const{colorScheme:u,collection:f}=c;return f==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==f?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return h(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?d:l:h(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return Ye({themes:i.map((u,f)=>({descriptor:u,index:f})).sort((u,f)=>{const g=c(u.descriptor,f.descriptor);return g!==0?g:u.index-f.index}).map(u=>u.descriptor)})},pick(c){const u=[],f=new Set;for(const g of c){if(f.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);f.add(g);const b=s.get(g);if(b==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(b)}return Ye({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function yo(e){return xo(e)?[e]:e}function xo(e){return zi(e)||Lo(e)}function Lo(e){return typeof e.name=="string"&&typeof e.load=="function"}function zi(e){return typeof e.getThemes=="function"}function Ui(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Vi=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ko=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(){const e=new Map,t=new Map,n=new Map;let i=0;function r(m,p){if(e.has(m))throw new Vi(m);e.set(m,p)}function o(m,p){return e.has(m)?!1:(e.set(m,p),!0)}function s(m){return e.has(m)}function l(m){const p=t.get(m);if(p!==void 0)return Promise.resolve(p);const C=n.get(m);if(C!==void 0)return C;const v=e.get(m);if(v===void 0)return Promise.reject(new ko(m));const x=i,S=v().then(L=>{const E=Ui(L);return x===i&&t.set(m,E),n.get(m)===S&&n.delete(m),E}).catch(L=>{throw n.get(m)===S&&n.delete(m),L});return n.set(m,S),S}function a(m){return Promise.all(m.map(p=>l(p)))}function d(m,p){t.set(m,p)}function h(m){for(const[p,C]of m)d(p,C)}function c(m){return t.get(m)}function u(m){const p=[];for(const C of m){const v=t.get(C);if(v===void 0)throw new wo(C);p.push(v)}return p}function f(m){return t.has(m)}function g(m){for(const p of m)if(!t.has(p))return!1;return!0}function b(m){const p=t.get(m);return p!==void 0?p:l(m)}function y(){i++,t.clear(),n.clear()}return{clearResolvedThemes:y,getResolvedOrResolveTheme:b,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:f,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:d,seedResolvedThemes:h}}const X=Eo();function An(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=X.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,X.getResolvedTheme(n)==null&&X.seedResolvedTheme(n,i);vt.has(n)||(vt.add(n),t.loadThemeSync(i))}}function To(){X.clearResolvedThemes(),vt.clear()}function hn({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Io(t)}}function Io(e){return async()=>Or(Ui(await e()))}const Ro="pierre",Ao=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Bi=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Ho=[...Bi,...Ao],Mo=new Set(Bi);function Do(e){return Mo.has(e)?"light":"dark"}const Po={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},_o={"pierre-dark":()=>k(()=>import("./pierre-dark-CyvmCCZW.js"),[]),"pierre-dark-soft":()=>k(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[]),"pierre-dark-vibrant":()=>k(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[]),"pierre-dark-tritanopia":()=>k(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[]),"pierre-light":()=>k(()=>import("./pierre-light-480U9XYS.js"),[]),"pierre-light-soft":()=>k(()=>import("./pierre-light-soft-CVdyfjmI.js"),[]),"pierre-light-vibrant":()=>k(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[]),"pierre-light-tritanopia":()=>k(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[])};function Oo(e){return hn({name:e,collection:Ro,colorScheme:Do(e),displayName:Po[e],load:_o[e]})}const $i=Ye({themes:Ho.map(e=>Oo(e))}),No="shiki",Wi=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Fo=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],zo=new Set(Wi);function Uo(e){return zo.has(e)?"light":"dark"}const Vo={andromeeda:()=>k(()=>import("./andromeeda-C4gqWexZ.js"),[]),"aurora-x":()=>k(()=>import("./aurora-x-D-2ljcwZ.js"),[]),"ayu-dark":()=>k(()=>import("./ayu-dark-DYE7WIF3.js"),[]),"ayu-light":()=>k(()=>import("./ayu-light-BA47KaF1.js"),[]),"ayu-mirage":()=>k(()=>import("./ayu-mirage-32ctXXKs.js"),[]),"catppuccin-frappe":()=>k(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]),"catppuccin-latte":()=>k(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]),"catppuccin-macchiato":()=>k(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]),"catppuccin-mocha":()=>k(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]),"dark-plus":()=>k(()=>import("./dark-plus-C3mMm8J8.js"),[]),dracula:()=>k(()=>import("./dracula-BzJJZx-M.js"),[]),"dracula-soft":()=>k(()=>import("./dracula-soft-BXkSAIEj.js"),[]),"everforest-dark":()=>k(()=>import("./everforest-dark-BgDCqdQA.js"),[]),"everforest-light":()=>k(()=>import("./everforest-light-C8M2exoo.js"),[]),"github-dark":()=>k(()=>import("./github-dark-DHJKELXO.js"),[]),"github-dark-default":()=>k(()=>import("./github-dark-default-Cuk6v7N8.js"),[]),"github-dark-dimmed":()=>k(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]),"github-dark-high-contrast":()=>k(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]),"github-light":()=>k(()=>import("./github-light-DAi9KRSo.js"),[]),"github-light-default":()=>k(()=>import("./github-light-default-D7oLnXFd.js"),[]),"github-light-high-contrast":()=>k(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]),"gruvbox-dark-hard":()=>k(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]),"gruvbox-dark-medium":()=>k(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]),"gruvbox-dark-soft":()=>k(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]),"gruvbox-light-hard":()=>k(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]),"gruvbox-light-medium":()=>k(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]),"gruvbox-light-soft":()=>k(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]),horizon:()=>k(()=>import("./horizon-BUw7H-hv.js"),[]),"horizon-bright":()=>k(()=>import("./horizon-bright-CUuTKBJd.js"),[]),houston:()=>k(()=>import("./houston-DnULxvSX.js"),[]),"kanagawa-dragon":()=>k(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]),"kanagawa-lotus":()=>k(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]),"kanagawa-wave":()=>k(()=>import("./kanagawa-wave-DWedfzmr.js"),[]),laserwave:()=>k(()=>import("./laserwave-DUszq2jm.js"),[]),"light-plus":()=>k(()=>import("./light-plus-B7mTdjB0.js"),[]),"material-theme":()=>k(()=>import("./material-theme-D5KoaKCx.js"),[]),"material-theme-darker":()=>k(()=>import("./material-theme-darker-BfHTSMKl.js"),[]),"material-theme-lighter":()=>k(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]),"material-theme-ocean":()=>k(()=>import("./material-theme-ocean-CyktbL80.js"),[]),"material-theme-palenight":()=>k(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]),"min-dark":()=>k(()=>import("./min-dark-CafNBF8u.js"),[]),"min-light":()=>k(()=>import("./min-light-CTRr51gU.js"),[]),monokai:()=>k(()=>import("./monokai-D4h5O-jR.js"),[]),"night-owl":()=>k(()=>import("./night-owl-C39BiMTA.js"),[]),"night-owl-light":()=>k(()=>import("./night-owl-light-CMTm3GFP.js"),[]),nord:()=>k(()=>import("./nord-Ddv68eIx.js"),[]),"one-dark-pro":()=>k(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]),"one-light":()=>k(()=>import("./one-light-C3Wv6jpd.js"),[]),plastic:()=>k(()=>import("./plastic-3e1v2bzS.js"),[]),poimandres:()=>k(()=>import("./poimandres-CS3Unz2-.js"),[]),red:()=>k(()=>import("./red-bN70gL4F.js"),[]),"rose-pine":()=>k(()=>import("./rose-pine-qdsjHGoJ.js"),[]),"rose-pine-dawn":()=>k(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]),"rose-pine-moon":()=>k(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]),"slack-dark":()=>k(()=>import("./slack-dark-BthQWCQV.js"),[]),"slack-ochin":()=>k(()=>import("./slack-ochin-DqwNpetd.js"),[]),"snazzy-light":()=>k(()=>import("./snazzy-light-Bw305WKR.js"),[]),"solarized-dark":()=>k(()=>import("./solarized-dark-DXbdFlpD.js"),[]),"solarized-light":()=>k(()=>import("./solarized-light-L9t79GZl.js"),[]),"synthwave-84":()=>k(()=>import("./synthwave-84-CbfX1IO0.js"),[]),"tokyo-night":()=>k(()=>import("./tokyo-night-hegEt444.js"),[]),vesper:()=>k(()=>import("./vesper-DRje8inN.js"),[]),"vitesse-black":()=>k(()=>import("./vitesse-black-Bkuqu6BP.js"),[]),"vitesse-dark":()=>k(()=>import("./vitesse-dark-D0r3Knsf.js"),[]),"vitesse-light":()=>k(()=>import("./vitesse-light-CVO1_9PV.js"),[])};function Hn(e){return hn({name:e,collection:No,colorScheme:Uo(e),load:Vo[e]})}const Gi=Ye({themes:Object.freeze([...Wi.map(e=>Hn(e)),...Fo.map(e=>Hn(e))])});Ye({themes:[$i,Gi]});function ji(e){if(Oi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(X.hasRegisteredTheme(e))return;const t=Gi.getTheme(e);if(t!=null){X.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function qi(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Bo(e){ji(e);const t=await X.resolveTheme(e);return qi(e,t),t}function $o(e){return X.getResolvedTheme(e)??Bo(e)}let $;async function xt({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=Nr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fr(k(()=>import("./wasm-CG6Dc4jp.js"),[])):zr()});const i=Wo($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Fi(s);"then"in l?r.push(l):Rn(l,i)}const o=[];for(const s of e){const l=$o(s);"then"in l?o.push(l):An(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{Rn(s,i)}),Promise.all(o).then(s=>{An(s,i)})]),i}function ql(e=$){return e!=null&&!("then"in e)}function Ki(){if($!=null&&!("then"in $))return $}function Wo(e=$){return e!=null&&"then"in e}function Kl(e=$){return e==null}async function Yl(e){await xt(e)}async function Xl(){$!=null&&((await $).dispose(),So(),To(),$=void 0)}for(const e of $i.getThemes())X.registerThemeIfAbsent(e.name,e.load);function cn(e=_){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Ge(e){for(const t of cn(e))if(!vt.has(t))return!1;return!0}function Go(e){return X.hasResolvedThemes(e)}function Oe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ae(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lt(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function qt(e){return A({tagName:"div",children:[A({tagName:"div",children:e.annotations?.map(t=>A({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jo(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Yi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return A({tagName:"div",children:[t==="custom"?A({tagName:"slot",properties:{name:an}}):qo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Ko(i)]],properties:r})}function qo({name:e,prevName:t,iconType:n}){const i=[A({tagName:"slot",properties:{name:on}}),pt({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(t)]})],properties:{"data-prev-name":""}})),i.push(pt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(e)]})],properties:{"data-title":""}})),A({tagName:"div",children:i,properties:{"data-header-content":""}})}function Ko(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(A({tagName:"span",children:[W(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(A({tagName:"span",children:[W(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(A({tagName:"slot",properties:{name:sn}})),A({tagName:"div",children:t,properties:{"data-metadata":""}})}function Xi(e){return A({tagName:"pre",properties:Yo(e)})}function Yo({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Z=new Map;let bt=0;const Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Q(e){if(Z.has(e))return Z.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z.has(t[1]))return Z.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Z.has(n)?Z.get(n)??"text":Ne[n]??"text"}function Ql(e,t){if(e<=bt)return!1;Z.clear();for(const n in t){const i=t[n];i!=null&&Z.set(n,i)}return bt=e,!0}function Jl(){return bt}function Xo(e,t){const n=Z.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),Z.set(e,t),bt++,!0)}function Zl(){return Object.fromEntries(Z)}function un(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:cn(t),preferredHighlighter:n}}function ge(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function xe(e){return e.replace(/\n$|\r\n$/,"")}function Qo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(W(` +import{t as pe,b as Ln,n as Or,c as Nr,a as Fr,d as zr,s as Ur,g as Vr,e as Br}from"./index-DyqF2DF6.js";import{f as Ld}from"./index-DyqF2DF6.js";import{bR as k}from"./index-Bxn5yOTB.js";const Ei="diffs-container",$r=(()=>{try{return!1}catch{return!1}})(),Wr=/(?=^From [a-f0-9]+ .+$)/m,Ti=/(?=^diff --git)/gm,Ul=/(?=^---\s+\S)/gm,Vl=/(?=^@@ )/gm,Gr=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,jr=/(?<=\n)/,qr=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Kr=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Yr=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Xr=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Bl=/^<{7,}(?:\s.*)?$/,$l=/^\|{7,}(?:\s.*)?$/,Wl=/^={7,}$/,Gl=/^>{7,}(?:\s.*)?$/,on="header-prefix",sn="header-metadata",an="header-custom",_={dark:"pierre-dark",light:"pierre-light"},Ii="data-theme-css",Ri="data-unsafe-css",Qr="data-core-css",Jr="data-diffs-scrollbar-measure",Ai="--diffs-scrollbar-gutter-measured",jl=1,Zr=1e5,ln={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,spacing:8},_e={...ln,hunkLineCount:1},eo={paddingTop:8,paddingBottom:8,gap:8},to={omega:.015,positionEpsilon:.5,velocityEpsilon:.05},no=Object.freeze({fromStart:0,fromEnd:0}),Ae={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Hi={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ie=new Set;let Re=null;function Y(e){Ie.add(e),Re??=requestAnimationFrame(Mi)}function io(e){Ie.delete(e),Ie.size===0&&Re!=null&&(cancelAnimationFrame(Re),Re=null)}function Mi(e){const t=new Set(Ie);Ie.clear();for(const n of t)try{n(e)}catch(i){console.error(i)}Ie.size>0?Re=requestAnimationFrame(Mi):Re=null}function He(e,t,n){if(e===t||e==null||t==null)return e===t;const i=new Set(n),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!i.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!i.has(s))return!1;return!0}function De(e,t){return e==null||t==null||typeof e=="string"||typeof t=="string"?e===t:e.dark===t.dark&&e.light===t.light}function dn(e,t){const n=e?.theme??_,i=t?.theme??_,r=kn(e),o=kn(t);return De(n,i)&&He(e,t,["theme","parseDiffOptions"])&&He(r,o)}function kn(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Wt(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Gt({scrollTop:e,scrollHeight:t,height:n,fitPerfectly:i=!1,fitPerfectlyOverscroll:r=0,overscrollSize:o}){const s=n+o*2,l=i?n+r*2:s;if(t=Math.max(t,l),s>=t||i){const h=Math.max(e-r,0),c=Math.min(e+l,t);return{top:h,bottom:Math.max(c,h)}}let a=e+n/2-s/2,d=a+s;return a<0&&(a=0),d>t&&(d=t),a=Math.floor(Math.max(a,0)),{top:a,bottom:Math.ceil(Math.max(Math.min(d,t),a))}}function ro(){return typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(e){return{type:"text",value:e}}function A({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function pt({name:e,width:t=16,height:n=16,properties:i}){return A({tagName:"svg",properties:{width:t,height:n,viewBox:"0 0 16 16",...i},children:[A({tagName:"use",properties:{href:`#${e.replace(/^#/,"")}`}})]})}function oo(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function Ee(e){return A({tagName:"div",properties:{"data-gutter":""},children:e})}function Di(e,t,n,i={}){return A({tagName:"div",properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...i},children:t!=null?[A({tagName:"span",properties:{"data-line-number-content":""},children:[W(`${t}`)]})]:void 0})}function j(e,t,n){return A({tagName:"div",properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t==="annotation"?void 0:e,style:t==="annotation"?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function so(){return A({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[pt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ao(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}var Pi=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;proposedSelectedRange;renderedSelectionRange;selectionAnchor;queuedSelectionRender;pointerSession={mode:"idle"};constructor(e,t){this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectionRange=void 0}isSelectionDirty(){return this.renderedSelectionRange===null}setSelection(e,t){const n=!(e===this.selectedRange||Wt(e??void 0,this.selectedRange??void 0));!this.isSelectionDirty()&&!n||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted())}getSelection(){return this.selectedRange}getHoveredLine=()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}};handlePointerClick=e=>{const{onHunkExpand:t,onLineClick:n,onLineNumberClick:i,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&n==null&&i==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&et(e.composedPath())||(he(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))};handlePointerMove=e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:n,onLineLeave:i,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&n==null&&i==null&&r==null&&o==null||(he(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))};handlePointerLeave=e=>{const{__debugPointerEvents:t}=this.options;if(he(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){he(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()};handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:n}=this.options,i=t.composedPath();he(n,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:i});const r=this.resolvePointerTarget(i);he(n,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:d,onTokenEnter:h,onTokenLeave:c,onHunkExpand:u,onMergeConflictActionClick:f}=this.options;switch(e){case"move":{const g=Tt(r)&&this.hoveredLine?.lineElement===r.lineElement;ut(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(c?.(this.hoveredToken,t),this.clearHoveredToken()),ut(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),h?.(this.hoveredToken,t))),g||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),Tt(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(co(r)&&f!=null){f(r);break}if(ho(r)&&u!=null){u(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!Tt(r))break;ut(r)&&d!=null&&d(this.toTokenEventBaseProps(r),t);const g=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...g,event:t}):o?.({...g,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:n="disabled",onLineClick:i,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:d,onHunkExpand:h,onMergeConflictActionClick:c,enableGutterUtility:u=!1,enableLineSelection:f=!1,onGutterUtilityClick:g}=this.options,b=g!=null,y=n!=="disabled"||i!=null||r!=null||o!=null||s!=null||l!=null||a!=null||d!=null||h!=null||c!=null||u||f||b;y&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,he(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const C=[];return(t==="both"||t==="click")&&(i!=null&&C.push("onLineClick"),r!=null&&C.push("onLineNumberClick"),h!=null&&C.push("expandable hunk separators"),c!=null&&C.push("merge conflict actions")),C})()),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),he(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!y&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const m=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",p=this.pointerSession.mode==="gutterSelecting";(!f&&m||!b&&p)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,i=e!=null,r=t!=null||n;i&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!i&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();et(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const n=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(n==null)return;const{pre:i}=this;if(i==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=n;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,i.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;if(n==null)return;const i=this.currentSelectionEnds(),r=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),o=i?.top??r;r==null||o==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:o,current:r},t&&(this.selectionAnchor={lineNumber:o.lineNumber,side:o.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange())),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{const{enableLineSelection:t=!1}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(n==null)return;this.pointerSession.current=n,t===!0&&this.updateSelection(n.lineNumber,n.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;this.updateSelection(n.lineNumber,n.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const n=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(n==null||this.selectionAnchor==null)return;const i={lineNumber:n.lineNumber,side:n.eventSide};if(ao(this.pointerSession.pending,i))return;this.updateSelection(n.lineNumber,n.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{const{enableLineSelection:t=!1,onGutterUtilityClick:n}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const i=this.resolveSelectionPoint(e,{source:"coordinates-first"});i!=null&&(this.pointerSession.current=i,t&&this.updateSelection(i.lineNumber,i.side)),n?.(this.buildSelectedLineRange(this.pointerSession.anchor,this.pointerSession.current)),this.selectionAnchor=void 0,t&&(this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(),this.clearProposedSelection()}};handleDocumentPointerCancel=e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=pe(so());const n=t.firstElementChild;if(!(n instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");n.remove(),this.gutterUtilityButton=n}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Ve(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},i=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(n);if(!(i==null||r==null))return i>r?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const n=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,i=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(const r of i){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(Ze(r));if(Ve(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const n=this.resolvePointerTarget(e);if(Ve(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode==="diff"?n.side:void 0}}resolveSelectionInfo(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionInfoFromPath(n,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Ve(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const n=this.resolveSelectionPath(e,t);return n!=null?this.selectionPointFromPath(n):void 0}resolveSelectionPath(e,t){const n=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),n);case"coordinates-first":{const i=this.pathFromCoordinates(e,n);return i!==void 0?i??void 0:this.pathFromEventPath(e.composedPath(),n)}}}pathFromCoordinates(e,t){const n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&et(e))){for(const n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){const n=Ze(e);if(t&&et(n))return;const i=fo(e);return i!=null?Ze(i):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=go(po(e));if(t==null)return;const n=this.targetForSelectionPoint(t);return n!=null?Ze(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),n=En(t)?t:En(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:n}=this.options;return n!=null?n(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){const i=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Wt(i??void 0,r??void 0)||(this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,this.queuedSelectionRender??=requestAnimationFrame(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const n=this.getLineIndex(e.start,e.side),i=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&i!=null?{start:t?n[1]:n[0],end:t?i[1]:i[0]}:void 0}renderSelection=()=>{if(this.queuedSelectionRender!=null&&(cancelAnimationFrame(this.queuedSelectionRender),this.queuedSelectionRender=void 0),this.pre==null||this.renderedSelectionRange===this.selectedRange)return;const e=this.pre.querySelectorAll("[data-selected-line]");for(const l of e)l.removeAttribute("data-selected-line");if(this.renderedSelectionRange=this.selectedRange,this.selectedRange==null)return;const{children:t}=this.pre;if(t.length===0)return;if(t.length>2)throw console.error(t),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const n=this.pre.getAttribute("data-diff-type")==="split",i=this.getIndexesFromSelection(this.selectedRange,n);if(i==null)throw console.error({rowRange:i,selectedRange:this.selectedRange}),new Error("InteractionManager.renderSelection: No valid rowRange");const r=i.start===i.end,o=Math.min(i.start,i.end),s=Math.max(i.start,i.end);for(const l of t){const[a,d]=l.children,h=d.children.length;if(h!==a.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");for(let c=0;cs)break;if(g==null||gNumber.parseInt(i,10)).filter(i=>!Number.isNaN(i));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function Ke({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:i,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,renderGutterUtility:c,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p},C,v,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:lo({enableGutterUtility:t,renderGutterUtility:c,onGutterUtilityClick:i}),usesCustomGutterUtility:c!=null,lineHoverHighlight:n,onGutterUtilityClick:i,onHunkExpand:C,onMergeConflictActionClick:x,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:d,onTokenLeave:h,__debugPointerEvents:u,enableLineSelection:f,controlledSelection:g,onLineSelected:b,onLineSelectionStart:y,onLineSelectionChange:m,onLineSelectionEnd:p,getLineIndex:v}}function lo({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Ve(e){return e!=null&&"kind"in e&&e.kind==="line"}function ut(e){return e!=null&&"kind"in e&&e.kind==="token"}function Tt(e){return Ve(e)||ut(e)}function ho(e){return"type"in e&&e.type==="line-info"}function co(e){return"kind"in e&&e.kind==="merge-conflict-action"}function uo(e){return e==="current"||e==="incoming"||e==="both"}function wn(e,t){const n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function Ze(e){const t=[];let n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function fo(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const n=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(n instanceof HTMLElement))return;const i=n.previousElementSibling;return i instanceof HTMLElement&&(i.hasAttribute("data-line")||i.hasAttribute("data-column-number"))?i:void 0}function po(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const n=e.getAttribute("name")??void 0;return n!=null&&n.startsWith("annotation-")?n:void 0}}function go(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function Tn(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function In(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function et(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}function he(e="none",t,...n){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return;break}console.log(...n)}var _i=class ue{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const n=new Map;for(const i of t){const r=ue.managersByElement.get(i.target);if(r==null)continue;const o=n.get(r);o==null?n.set(r,[i]):o.push(i)}for(const[i,r]of n)i.handleResizeEntries(r)}observedNodes=new Map;setup(t,n){const i=new Set;let r=0;const o=new Map(this.observedNodes);this.observedNodes.clear();for(const s of t.children){if(r===2)break;const l=(()=>{if(s instanceof HTMLElement&&s.tagName==="CODE")return s})();if(l==null)continue;r++;let a=o.get(l);if(a!=null&&a.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let d=l.firstElementChild;d instanceof HTMLElement||(d=null),a!=null?(this.observedNodes.set(l,a),o.delete(l),a.numberElement!==d?(a.numberElement!=null&&(this.unobserve(a.numberElement),o.delete(a.numberElement)),d!=null&&(this.observe(d),o.delete(d),this.observedNodes.set(d,a)),a.numberElement=d,a.numberWidth=0):a.numberElement!=null?(o.delete(a.numberElement),this.observedNodes.set(a.numberElement,a)):a.numberWidth=0):(a={type:"code",codeElement:l,numberElement:d,codeWidth:"auto",numberWidth:0},this.observedNodes.set(l,a),this.observe(l),d!=null&&(this.observedNodes.set(d,a),this.observe(d)))}if(r>1&&!n){const s=t.querySelectorAll('[data-line-annotation*=","]'),l=new Map;for(const a of s){if(!(a instanceof HTMLElement))continue;const d=a.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(d)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:d,element:a});continue}let h=l.get(d);h==null&&(h=[],l.set(d,h)),h.push(a)}for(const[a,d]of l){if(d.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",a,d);continue}const[h,c]=d,u=h.firstElementChild,f=c.firstElementChild;if(!(h instanceof HTMLElement)||!(c instanceof HTMLElement)||!(u instanceof HTMLElement)||!(f instanceof HTMLElement))continue;let g=o.get(u);if(g!=null){this.observedNodes.set(u,g),this.observedNodes.set(f,g),o.delete(u),o.delete(f);continue}const b=u.getBoundingClientRect().height,y=f.getBoundingClientRect().height;g={type:"annotations",column1:{container:h,child:u,childHeight:b},column2:{container:c,child:f,childHeight:y},currentHeight:"auto"},i.add({child1:u,child2:f,item:g,newHeight:Math.max(b,y)})}for(const a of i)this.applyNewHeight(a.item,a.newHeight),this.observedNodes.set(a.child1,a.item),this.observedNodes.set(a.child2,a.item),this.observe(a.child1),this.observe(a.child2);i.clear()}for(const[s,l]of o)this.unobserve(s),l.type==="code"?bo(l):Co(l);o.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:n}=ue,i=n.get(t);if(i!==this){if(i!=null&&i!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");n.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:n,resizeObserver:i}=ue,r=n.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");n.delete(t),i?.unobserve(t),i!=null&&n.size===0&&(i.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const n=new Map,i=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const d=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(d==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}d.childHeight=s[0].blockSize,i.add(a)}else if(a.type==="code"){const d=n.get(a)??{},h=l[0].inlineSize;o===a.codeElement?d.codeInlineSize=h:o===a.numberElement&&(d.numberInlineSize=h),n.set(a,d)}}this.applyAnnotationUpdates(i),i.clear(),this.applyColumnUpdates(n),n.clear()}applyAnnotationUpdates(t){for(const n of t)this.applyNewHeight(n,Math.max(n.column1.childHeight,n.column2.childHeight))}applyColumnUpdates=t=>{for(const[n,i]of t){const r=i.codeInlineSize!=null?mo(i.codeInlineSize):n.codeWidth,o=i.numberInlineSize!=null?vo(i.numberInlineSize):n.numberWidth,s=r!==n.codeWidth,l=o!==n.numberWidth;if(!(!s&&!l)&&(n.codeWidth=r,n.numberWidth=o,s&&n.codeElement.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),l&&n.codeElement.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),s||l&&r!=="auto")){const a=typeof r=="number"?Math.max(r-o,0):0;n.codeElement.style.setProperty("--diffs-column-content-width",`${a>0?`${a}px`:"auto"}`)}}};applyNewHeight(t,n){n!==t.currentHeight&&(t.currentHeight=Math.max(n,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}};function mo(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function vo(e){return Math.max(Math.ceil(e),0)}function bo(e){e.codeElement.isConnected&&(e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width"))}function Co(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}const Se=new Map,It=new Map,jt=new Map,gt=new Set;function mt(e){for(const t of Array.isArray(e)?e:[e])if(!(t==="text"||t==="ansi")&&!gt.has(t))return!1;return!0}function Rn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(gt.has(n.name))continue;let i=Se.get(n.name);i==null&&(i=n,Se.set(n.name,i)),gt.add(i.name),t.loadLanguageSync(i.data)}}function So(){Se.clear(),gt.clear()}function Oi(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}async function Ni(e){if(Oi())throw new Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);const t=It.get(e);if(t!=null)return t;try{let n=jt.get(e);if(n==null&&Object.prototype.hasOwnProperty.call(Ln,e)&&(n=Ln[e]),n==null)throw new Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);const i=n().then(({default:r})=>{const o={name:e,data:r};return Se.has(e)||Se.set(e,o),o});return It.set(e,i),await i}finally{It.delete(e)}}function Fi(e){return Se.get(e)??Ni(e)}const vt=new Set;function Ye(e){const t=[],n=new Set;for(const c of yo(e.themes)){const u=zi(c)?c.getThemes():[c];for(const f of u){if(n.has(f.name))throw new Error(`Theme collection already contains theme "${f.name}"`);n.add(f.name),t.push(f)}}const i=Object.freeze([...t]),r=Object.freeze(i.filter(c=>c.colorScheme==="light")),o=Object.freeze(i.filter(c=>c.colorScheme==="dark")),s=new Map(i.map(c=>[c.name,c])),l=Object.freeze(i.map(c=>c.name)),a=Object.freeze(r.map(c=>c.name)),d=Object.freeze(o.map(c=>c.name));function h(c){if(c==null)return i;const{colorScheme:u,collection:f}=c;return f==null?u==="light"?r:u==="dark"?o:i:i.filter(g=>g.collection!==f?!1:u==null||g.colorScheme===u)}return{getTheme(c){return s.get(c)},getThemes(c){return h(c)},getThemeNames(c){return c?.collection==null?c?.colorScheme==="light"?a:c?.colorScheme==="dark"?d:l:h(c).map(u=>u.name)},hasTheme(c){return s.has(c)},orderBy(c){return Ye({themes:i.map((u,f)=>({descriptor:u,index:f})).sort((u,f)=>{const g=c(u.descriptor,f.descriptor);return g!==0?g:u.index-f.index}).map(u=>u.descriptor)})},pick(c){const u=[],f=new Set;for(const g of c){if(f.has(g))throw new Error(`Theme collection pick already includes theme "${g}"`);f.add(g);const b=s.get(g);if(b==null)throw new Error(`Theme collection does not contain theme "${g}"`);u.push(b)}return Ye({themes:u})},registerInto(c){for(const u of i)c.registerThemeIfAbsent(u.name,u.load)}}}function yo(e){return xo(e)?[e]:e}function xo(e){return zi(e)||Lo(e)}function Lo(e){return typeof e.name=="string"&&typeof e.load=="function"}function zi(e){return typeof e.getThemes=="function"}function Ui(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Vi=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},ko=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},wo=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function Eo(){const e=new Map,t=new Map,n=new Map;let i=0;function r(m,p){if(e.has(m))throw new Vi(m);e.set(m,p)}function o(m,p){return e.has(m)?!1:(e.set(m,p),!0)}function s(m){return e.has(m)}function l(m){const p=t.get(m);if(p!==void 0)return Promise.resolve(p);const C=n.get(m);if(C!==void 0)return C;const v=e.get(m);if(v===void 0)return Promise.reject(new ko(m));const x=i,S=v().then(L=>{const E=Ui(L);return x===i&&t.set(m,E),n.get(m)===S&&n.delete(m),E}).catch(L=>{throw n.get(m)===S&&n.delete(m),L});return n.set(m,S),S}function a(m){return Promise.all(m.map(p=>l(p)))}function d(m,p){t.set(m,p)}function h(m){for(const[p,C]of m)d(p,C)}function c(m){return t.get(m)}function u(m){const p=[];for(const C of m){const v=t.get(C);if(v===void 0)throw new wo(C);p.push(v)}return p}function f(m){return t.has(m)}function g(m){for(const p of m)if(!t.has(p))return!1;return!0}function b(m){const p=t.get(m);return p!==void 0?p:l(m)}function y(){i++,t.clear(),n.clear()}return{clearResolvedThemes:y,getResolvedOrResolveTheme:b,getResolvedTheme:c,getResolvedThemes:u,hasRegisteredTheme:s,hasResolvedTheme:f,hasResolvedThemes:g,registerTheme:r,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:d,seedResolvedThemes:h}}const X=Eo();function An(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let i;if(typeof n=="string"){if(i=X.getResolvedTheme(n),i==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else i=n,n=n.name,X.getResolvedTheme(n)==null&&X.seedResolvedTheme(n,i);vt.has(n)||(vt.add(n),t.loadThemeSync(i))}}function To(){X.clearResolvedThemes(),vt.clear()}function hn({name:e,load:t,colorScheme:n,collection:i,displayName:r}){return{name:e,colorScheme:n,collection:i,displayName:r,load:Io(t)}}function Io(e){return async()=>Or(Ui(await e()))}const Ro="pierre",Ao=["pierre-dark","pierre-dark-soft","pierre-dark-vibrant","pierre-dark-protanopia-deuteranopia","pierre-dark-tritanopia"],Bi=["pierre-light","pierre-light-soft","pierre-light-vibrant","pierre-light-protanopia-deuteranopia","pierre-light-tritanopia"],Ho=[...Bi,...Ao],Mo=new Set(Bi);function Do(e){return Mo.has(e)?"light":"dark"}const Po={"pierre-dark":"Pierre Dark","pierre-dark-soft":"Pierre Dark Soft","pierre-dark-vibrant":"Pierre Dark Vibrant","pierre-dark-protanopia-deuteranopia":"Pierre Dark Protanopia & Deuteranopia","pierre-dark-tritanopia":"Pierre Dark Tritanopia","pierre-light":"Pierre Light","pierre-light-soft":"Pierre Light Soft","pierre-light-vibrant":"Pierre Light Vibrant","pierre-light-protanopia-deuteranopia":"Pierre Light Protanopia & Deuteranopia","pierre-light-tritanopia":"Pierre Light Tritanopia"},_o={"pierre-dark":()=>k(()=>import("./pierre-dark-CyvmCCZW.js"),[]),"pierre-dark-soft":()=>k(()=>import("./pierre-dark-soft-BHGpRqa4.js"),[]),"pierre-dark-vibrant":()=>k(()=>import("./pierre-dark-vibrant-BWBVywrn.js"),[]),"pierre-dark-protanopia-deuteranopia":()=>k(()=>import("./pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js"),[]),"pierre-dark-tritanopia":()=>k(()=>import("./pierre-dark-tritanopia-Beq2gCRQ.js"),[]),"pierre-light":()=>k(()=>import("./pierre-light-480U9XYS.js"),[]),"pierre-light-soft":()=>k(()=>import("./pierre-light-soft-CVdyfjmI.js"),[]),"pierre-light-vibrant":()=>k(()=>import("./pierre-light-vibrant-DdTDNdfJ.js"),[]),"pierre-light-protanopia-deuteranopia":()=>k(()=>import("./pierre-light-protanopia-deuteranopia-CaVOBURG.js"),[]),"pierre-light-tritanopia":()=>k(()=>import("./pierre-light-tritanopia-B4_gpKOM.js"),[])};function Oo(e){return hn({name:e,collection:Ro,colorScheme:Do(e),displayName:Po[e],load:_o[e]})}const $i=Ye({themes:Ho.map(e=>Oo(e))}),No="shiki",Wi=["ayu-light","catppuccin-latte","everforest-light","github-light","github-light-default","github-light-high-contrast","gruvbox-light-hard","gruvbox-light-medium","gruvbox-light-soft","horizon-bright","kanagawa-lotus","light-plus","material-theme-lighter","min-light","night-owl-light","one-light","rose-pine-dawn","slack-ochin","snazzy-light","solarized-light","vitesse-light"],Fo=["andromeeda","aurora-x","ayu-dark","ayu-mirage","catppuccin-frappe","catppuccin-macchiato","catppuccin-mocha","dark-plus","dracula","dracula-soft","everforest-dark","github-dark","github-dark-default","github-dark-dimmed","github-dark-high-contrast","gruvbox-dark-hard","gruvbox-dark-medium","gruvbox-dark-soft","horizon","houston","kanagawa-dragon","kanagawa-wave","laserwave","material-theme","material-theme-darker","material-theme-ocean","material-theme-palenight","min-dark","monokai","night-owl","nord","one-dark-pro","plastic","poimandres","red","rose-pine","rose-pine-moon","slack-dark","solarized-dark","synthwave-84","tokyo-night","vesper","vitesse-black","vitesse-dark"],zo=new Set(Wi);function Uo(e){return zo.has(e)?"light":"dark"}const Vo={andromeeda:()=>k(()=>import("./andromeeda-C4gqWexZ.js"),[]),"aurora-x":()=>k(()=>import("./aurora-x-D-2ljcwZ.js"),[]),"ayu-dark":()=>k(()=>import("./ayu-dark-DYE7WIF3.js"),[]),"ayu-light":()=>k(()=>import("./ayu-light-BA47KaF1.js"),[]),"ayu-mirage":()=>k(()=>import("./ayu-mirage-32ctXXKs.js"),[]),"catppuccin-frappe":()=>k(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]),"catppuccin-latte":()=>k(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]),"catppuccin-macchiato":()=>k(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]),"catppuccin-mocha":()=>k(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]),"dark-plus":()=>k(()=>import("./dark-plus-C3mMm8J8.js"),[]),dracula:()=>k(()=>import("./dracula-BzJJZx-M.js"),[]),"dracula-soft":()=>k(()=>import("./dracula-soft-BXkSAIEj.js"),[]),"everforest-dark":()=>k(()=>import("./everforest-dark-BgDCqdQA.js"),[]),"everforest-light":()=>k(()=>import("./everforest-light-C8M2exoo.js"),[]),"github-dark":()=>k(()=>import("./github-dark-DHJKELXO.js"),[]),"github-dark-default":()=>k(()=>import("./github-dark-default-Cuk6v7N8.js"),[]),"github-dark-dimmed":()=>k(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]),"github-dark-high-contrast":()=>k(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]),"github-light":()=>k(()=>import("./github-light-DAi9KRSo.js"),[]),"github-light-default":()=>k(()=>import("./github-light-default-D7oLnXFd.js"),[]),"github-light-high-contrast":()=>k(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]),"gruvbox-dark-hard":()=>k(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]),"gruvbox-dark-medium":()=>k(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]),"gruvbox-dark-soft":()=>k(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]),"gruvbox-light-hard":()=>k(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]),"gruvbox-light-medium":()=>k(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]),"gruvbox-light-soft":()=>k(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]),horizon:()=>k(()=>import("./horizon-BUw7H-hv.js"),[]),"horizon-bright":()=>k(()=>import("./horizon-bright-CUuTKBJd.js"),[]),houston:()=>k(()=>import("./houston-DnULxvSX.js"),[]),"kanagawa-dragon":()=>k(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]),"kanagawa-lotus":()=>k(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]),"kanagawa-wave":()=>k(()=>import("./kanagawa-wave-DWedfzmr.js"),[]),laserwave:()=>k(()=>import("./laserwave-DUszq2jm.js"),[]),"light-plus":()=>k(()=>import("./light-plus-B7mTdjB0.js"),[]),"material-theme":()=>k(()=>import("./material-theme-D5KoaKCx.js"),[]),"material-theme-darker":()=>k(()=>import("./material-theme-darker-BfHTSMKl.js"),[]),"material-theme-lighter":()=>k(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]),"material-theme-ocean":()=>k(()=>import("./material-theme-ocean-CyktbL80.js"),[]),"material-theme-palenight":()=>k(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]),"min-dark":()=>k(()=>import("./min-dark-CafNBF8u.js"),[]),"min-light":()=>k(()=>import("./min-light-CTRr51gU.js"),[]),monokai:()=>k(()=>import("./monokai-D4h5O-jR.js"),[]),"night-owl":()=>k(()=>import("./night-owl-C39BiMTA.js"),[]),"night-owl-light":()=>k(()=>import("./night-owl-light-CMTm3GFP.js"),[]),nord:()=>k(()=>import("./nord-Ddv68eIx.js"),[]),"one-dark-pro":()=>k(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]),"one-light":()=>k(()=>import("./one-light-C3Wv6jpd.js"),[]),plastic:()=>k(()=>import("./plastic-3e1v2bzS.js"),[]),poimandres:()=>k(()=>import("./poimandres-CS3Unz2-.js"),[]),red:()=>k(()=>import("./red-bN70gL4F.js"),[]),"rose-pine":()=>k(()=>import("./rose-pine-qdsjHGoJ.js"),[]),"rose-pine-dawn":()=>k(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]),"rose-pine-moon":()=>k(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]),"slack-dark":()=>k(()=>import("./slack-dark-BthQWCQV.js"),[]),"slack-ochin":()=>k(()=>import("./slack-ochin-DqwNpetd.js"),[]),"snazzy-light":()=>k(()=>import("./snazzy-light-Bw305WKR.js"),[]),"solarized-dark":()=>k(()=>import("./solarized-dark-DXbdFlpD.js"),[]),"solarized-light":()=>k(()=>import("./solarized-light-L9t79GZl.js"),[]),"synthwave-84":()=>k(()=>import("./synthwave-84-CbfX1IO0.js"),[]),"tokyo-night":()=>k(()=>import("./tokyo-night-hegEt444.js"),[]),vesper:()=>k(()=>import("./vesper-DRje8inN.js"),[]),"vitesse-black":()=>k(()=>import("./vitesse-black-Bkuqu6BP.js"),[]),"vitesse-dark":()=>k(()=>import("./vitesse-dark-D0r3Knsf.js"),[]),"vitesse-light":()=>k(()=>import("./vitesse-light-CVO1_9PV.js"),[])};function Hn(e){return hn({name:e,collection:No,colorScheme:Uo(e),load:Vo[e]})}const Gi=Ye({themes:Object.freeze([...Wi.map(e=>Hn(e)),...Fo.map(e=>Hn(e))])});Ye({themes:[$i,Gi]});function ji(e){if(Oi())throw new Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(X.hasRegisteredTheme(e))return;const t=Gi.getTheme(e);if(t!=null){X.registerThemeIfAbsent(t.name,t.load);return}throw new Error(`No valid theme loader registered for "${e}"`)}function qi(e,t){if(t.name!==e)throw new Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function Bo(e){ji(e);const t=await X.resolveTheme(e);return qi(e,t),t}function $o(e){return X.getResolvedTheme(e)??Bo(e)}let $;async function xt({themes:e,langs:t,preferredHighlighter:n="shiki-js"}){$??=Nr({themes:[],langs:["text"],engine:n==="shiki-wasm"?Fr(k(()=>import("./wasm-CG6Dc4jp.js"),[])):zr()});const i=Wo($)?await $:$;$=i;const r=[];for(const s of t){if(s==="text"||s==="ansi")continue;const l=Fi(s);"then"in l?r.push(l):Rn(l,i)}const o=[];for(const s of e){const l=$o(s);"then"in l?o.push(l):An(l,$)}return(r.length>0||o.length>0)&&await Promise.all([Promise.all(r).then(s=>{Rn(s,i)}),Promise.all(o).then(s=>{An(s,i)})]),i}function ql(e=$){return e!=null&&!("then"in e)}function Ki(){if($!=null&&!("then"in $))return $}function Wo(e=$){return e!=null&&"then"in e}function Kl(e=$){return e==null}async function Yl(e){await xt(e)}async function Xl(){$!=null&&((await $).dispose(),So(),To(),$=void 0)}for(const e of $i.getThemes())X.registerThemeIfAbsent(e.name,e.load);function cn(e=_){const t=[];return typeof e=="string"?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Ge(e){for(const t of cn(e))if(!vt.has(t))return!1;return!0}function Go(e){return X.hasResolvedThemes(e)}function Oe(e,t){return De(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength}function ae(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function Lt(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function qt(e){return A({tagName:"div",children:[A({tagName:"div",children:e.annotations?.map(t=>A({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jo(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function Yi({fileOrDiff:e,mode:t,stickyHeader:n}){const i="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":i?.type,"data-sticky":n?"":void 0};return A({tagName:"div",children:[t==="custom"?A({tagName:"slot",properties:{name:an}}):qo({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:i?.type??"file"}),...t==="custom"?[]:[Ko(i)]],properties:r})}function qo({name:e,prevName:t,iconType:n}){const i=[A({tagName:"slot",properties:{name:on}}),pt({name:jo(n),properties:{"data-change-icon":n}})];return t!=null&&(i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(t)]})],properties:{"data-prev-name":""}})),i.push(pt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),i.push(A({tagName:"div",children:[A({tagName:"bdi",children:[W(e)]})],properties:{"data-title":""}})),A({tagName:"div",children:i,properties:{"data-header-content":""}})}function Ko(e){const t=[];if(e!=null){let n=0,i=0;for(const r of e.hunks)n+=r.additionLines,i+=r.deletionLines;(i>0||n===0)&&t.push(A({tagName:"span",children:[W(`-${i}`)],properties:{"data-deletions-count":""}})),(n>0||i===0)&&t.push(A({tagName:"span",children:[W(`+${n}`)],properties:{"data-additions-count":""}}))}return t.push(A({tagName:"slot",properties:{name:sn}})),A({tagName:"div",children:t,properties:{"data-metadata":""}})}function Xi(e){return A({tagName:"pre",properties:Yo(e)})}function Yo({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:i,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":i,"data-disable-line-numbers":n?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}const Z=new Map;let bt=0;const Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function Q(e){if(Z.has(e))return Z.get(e)??"text";if(Ne[e]!=null)return Ne[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Z.has(t[1]))return Z.get(t[1])??"text";if(Ne[t[1]]!=null)return Ne[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return Z.has(n)?Z.get(n)??"text":Ne[n]??"text"}function Ql(e,t){if(e<=bt)return!1;Z.clear();for(const n in t){const i=t[n];i!=null&&Z.set(n,i)}return bt=e,!0}function Jl(){return bt}function Xo(e,t){const n=Z.get(e);return n===t?!1:(n!=null&&console.warn(`setCustomExtension: overriding custom mapping for "${e}" from "${n}" to "${t}"`),Z.set(e,t),bt++,!0)}function Zl(){return Object.fromEntries(Z)}function un(e,{theme:t,preferredHighlighter:n="shiki-js"}){return{langs:[e??"text"],themes:cn(t),preferredHighlighter:n}}function ge(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function xe(e){return e.replace(/\n$|\r\n$/,"")}function Qo(e,t,n){const i=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(i==null){const r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),new Error(r)}return e.tagName="div",e.properties["data-line"]=i.lineNumber,e.properties["data-alt-line"]=i.altLineNumber,e.properties["data-line-type"]=i.type,e.properties["data-line-index"]=i.lineIndex,e.children.length===0&&e.children.push(W(` `)),e}const tt=Symbol("no-token"),Rt=Symbol("multiple-tokens");function Qi(e){const t=Jo(e);if(t!=null)return t;let n=tt;const i=[];let r=[],o;const s=()=>{if(r.length===0||o==null){r=[],o=void 0;return}if(r.length===1){const a=r[0];if(a?.type==="element"){Zo(a,o);for(const d of a.children)ft(d)}else ft(a);i.push(a),r=[],o=void 0;return}for(const a of r)ft(a);i.push(A({tagName:"span",properties:{"data-char":o},children:r})),r=[],o=void 0},l=a=>{if(a!==tt){if(a===Rt){n=Rt;return}if(n===tt){n=a;return}n!==a&&(n=Rt)}};for(const a of e.children){const d=a.type==="element"?Qi(a):tt;if(l(d),typeof d!="number"){s(),i.push(a);continue}o!=null&&o!==d&&s(),o??=d,r.push(a)}return s(),e.children=i,n}function Jo(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function ft(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)ft(t)}}function Zo(e,t){e.properties["data-char"]=t}function es(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:i=l=>l}=e,r=new Map;function o(l){return Object.entries(l).map(([a,d])=>`${a}:${d}`).join(";")}function s(l){let a=t+ts(typeof l=="string"?l:o(l))+n;return a=i(a),r.has(a)||r.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=s(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const d of a){if(!d.htmlStyle)continue;const h=s(d.htmlStyle);d.htmlStyle={},d.htmlAttrs||={},d.htmlAttrs.class?d.htmlAttrs.class+=` ${h}`:d.htmlAttrs.class=h}},getClassRegistry(){return r},getCSS(){let l="";for(const[a,d]of r.entries())l+=`.${a}{${typeof d=="string"?d:o(d)}}`;return l},clearRegistry(){r.clear()}}}function ts(e,t=0){let n=3735928559^t,i=1103547991^t;for(let r=0,o;r>>16,2246822507),n^=Math.imul(i^i>>>13,3266489909),i=Math.imul(i^i>>>16,2246822507),i^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&i)+(n>>>0)).toString(36).slice(0,6)}function Ji(e=!1,t=!1){const n={lineInfo:[]},i=[{line(r){return delete r.properties.class,r},pre(r){const o=oo(r),s=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&Qi(a),s.push(Qo(a,l,n)),l++);o.children=s}return r},...e?{tokens(r){for(const o of r){let s=0;for(const l of o){const a=l;a.__lineChar??=s,s+=l.content.length}}},preprocess(r,o){o.mergeWhitespaces="never"},span(r,o,s,l,a){if(a?.offset!=null&&a.content!=null){const d=a.__lineChar;return d!=null&&(r.properties["data-char"]=d),r}return r}}:null}];return t&&i.push(ns,Mn),{state:n,transformers:i,toClass:Mn}}const Mn=es({classPrefix:"hl-"}),ns={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const i={};n.color!=null&&(i.color=n.color),n.bgColor!=null&&(i["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(i["font-style"]="italic"),(n.fontStyle&2)!==0&&(i["font-weight"]="bold"),(n.fontStyle&4)!==0&&(i["text-decoration"]="underline")),Object.keys(i).length>0&&(n.htmlStyle=i)}}};function B(e){return`--${e==="token"?"diffs-token":"diffs"}-`}const is=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,rs=/^0(?:\.0+)?%?$/;function os(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const i=e.slice(t+1,-1).trim();if(i.length===0)return;const r=i.lastIndexOf("/");if(r!==-1)return i.slice(r+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=i.split(",");if(o.length===4)return o[3]?.trim()}}function ss(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let i,r=1;return n.length===3?i=n.split("").map(o=>o+o).join(""):n.length===6?i=n:(i=n.slice(0,6),r=parseInt(n.slice(6,8),16)/255),[parseInt(i.slice(0,2),16),parseInt(i.slice(2,4),16),parseInt(i.slice(4,6),16),r]}function At(e){if(e==null)return null;const t=ss(e);if(t==null)return null;const n=t[0]/255,i=t[1]/255,r=t[2]/255,o=s=>s<=.03928?s/12.92:((s+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(i)+.0722*o(r)}function Dn(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||is.test(t))return!0;const n=os(t);return n!=null&&rs.test(n)}function as(e,t,n){if(t==null||n==null)return!1;const i=At(e),r=At(t),o=At(n);return i==null||r==null||o==null?!1:Math.abs(i-o){const s=e.at(-1);return s===""||s===` `||s===`\r `||s==="\r"?Math.max(0,e.length-2):e.length-1})();for(let s=t;s0||l<1/0,{state:h,transformers:c}=Ji(r),u=o?"text":e.lang??Q(e.name),f=typeof n=="string"?t.getTheme(n).type:void 0,g=fn({theme:n,highlighter:t});h.lineInfo=p=>({type:"context",lineIndex:p-1+s,lineNumber:p+s});const b=typeof n=="string"?{lang:u,theme:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0}:{lang:u,themes:n,transformers:c,defaultColor:!1,cssVariablePrefix:B("token"),tokenizeMaxLineLength:i,tokenizeTimeLimit:0},y=Kt(t.codeToHast(d?cs(a??St(e.contents),s,l):xe(e.contents),b)),m=d?new Array(s):y;return d&&m.push(...y),{code:m,themeStyles:g,baseThemeType:f}}function cs(e,t,n){let i="";return Ct({lines:e,startingLine:t,totalLines:n,callback({content:r}){i+=r}}),i}const Zi="-1,-1";function Yt(e){return e?.some(t=>t.lineNumber===0)??!1}function Xt(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function kt(e){return e.startingLine===0&&e.totalLines>0}function er(e,t){return A({tagName:"div",children:e,properties:{"data-content":"",style:`grid-row: span ${t}`}})}function Qt(e){return(e.lang??Q(e.name))==="text"}function tr(e){return e.useTokenTransformer===!0||e.onTokenClick!=null||e.onTokenEnter!=null||e.onTokenLeave!=null}let us=-1;var fs=class{options;onRenderUpdate;workerManager;__id=`file-renderer:${++us}`;highlighter;renderCache;computedLang="text";lineAnnotations={};lineCache;constructor(e={theme:_},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Ge(e.theme??_)?Ki():void 0)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}setLineAnnotations(e){this.lineAnnotations={};for(const t of e){const n=this.lineAnnotations[t.lineNumber]??[];this.lineAnnotations[t.lineNumber]=n,n.push(t)}}cleanUp(){this.recycle(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.clearRenderCache(),this.highlighter=void 0,this.workerManager?.cleanUpTasks(this),this.lineCache=void 0}clearRenderCache(){this.renderCache=void 0}hydrate(e){const{options:t}=this.getRenderOptions(e),n=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());let i=this.workerManager?.getFileResultCache(e);i!=null&&!Oe(t,i.options)&&(i=void 0),this.renderCache??={file:e,options:t,highlighted:!n&&!Qt(e),result:n?void 0:i?.result,renderRange:void 0},this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightFileAST(this,e):this.highlighter==null&&(this.computedLang=e.lang??Q(e.name),this.initializeHighlighter())}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0)return this.workerManager.getFileRenderOptions();const{theme:i=_,tokenizeMaxLineLength:r=1e3}=this.options;return{theme:i,useTokenTransformer:tr(this.options),tokenizeMaxLineLength:r}})(),{renderCache:n}=this;return n?.result==null?{options:t,forceHighlight:!0}:!ae(e,n.file)||!Oe(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getOrCreateLineCache(e){if(e.cacheKey==null)return this.lineCache=void 0,St(e.contents);let{lineCache:t}=this;return(t==null||t.cacheKey!==e.cacheKey)&&(t={cacheKey:e.cacheKey,lines:St(e.contents)}),this.lineCache=t,t.lines}renderFile(e=this.renderCache?.file,t=Ae){if(e==null)return;let{options:n,forceHighlight:i}=this.getRenderOptions(e);const r=this.getMatchingWorkerResultCache(e,n);r!=null&&!this.hasHighlightedRenderCache(e,n)&&(this.renderCache={file:e,highlighted:!0,renderRange:void 0,...r},i=!1),this.renderCache??={file:e,highlighted:!1,options:n,result:void 0,renderRange:void 0};const o=this.getOrCreateLineCache(e),s=e.contents.length>0,l=!s||Qt(e)||Pt(o.length,this.getTokenizeMaxLength()),a=!ae(e,this.renderCache.file),d=!Lt(this.renderCache.renderRange,t);if(this.workerManager?.isWorkingPool()===!0)(l||this.renderCache.result==null||!this.renderCache.highlighted&&(a||d))&&(this.renderCache.file=e,this.renderCache.options=n,this.renderCache.highlighted=!1,(this.renderCache.result==null||a||d||i)&&(this.renderCache.result=this.workerManager.getPlainFileAST(e,t.startingLine,t.totalLines,o)),this.renderCache.renderRange=t),!l&&s&&(!this.renderCache.highlighted||i)&&this.workerManager.highlightFileAST(this,e);else{this.computedLang=e.lang??Q(e.name);const h=this.highlighter!=null&&Ge(n.theme),c=this.highlighter!=null&&mt(this.computedLang),u=!l&&c;if(this.highlighter!=null&&h&&(i||l||!this.renderCache.highlighted&&u||this.renderCache.result==null)){const{result:f,options:g}=this.renderFileWithHighlighter(e,this.highlighter,l||!c);this.renderCache={file:e,options:g,highlighted:u,result:f,renderRange:void 0}}(!h||!l&&!c)&&this.asyncHighlight(e).then(({result:f,options:g})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.onHighlightSuccess(e,f,g,!l)})}return this.renderCache.result!=null?this.processFileResult(this.renderCache.file,t,this.renderCache.result):void 0}async asyncRender(e,t=Ae){const{result:n}=await this.asyncHighlight(e);return this.processFileResult(e,t,n)}async asyncHighlight(e){const t=Pt(this.getOrCreateLineCache(e).length,this.getTokenizeMaxLength());this.computedLang=t?"text":e.lang??Q(e.name);const n=this.highlighter!=null&&Go(cn(this.options.theme)),i=t||this.highlighter!=null&&mt(this.computedLang);return(this.highlighter==null||!n||!i)&&(this.highlighter=await this.initializeHighlighter()),this.renderFileWithHighlighter(e,this.highlighter,t)}renderFileWithHighlighter(e,t,n=!1){const{options:i}=this.getRenderOptions(e);return{result:hs(e,t,i,{forcePlainText:n}),options:i}}processFileResult(e,t,{code:n,themeStyles:i,baseThemeType:r}){const{disableFileHeader:o=!1}=this.options,s=[],l=Ee(),a=this.getOrCreateLineCache(e);let d=0;const h=kt(t)?Xt(this.lineAnnotations):void 0;return h!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:-1,lineIndex:-1,annotations:h.map(c=>ge(c))})),d++),Ct({lines:a,startingLine:t.startingLine,totalLines:t.totalLines,callback:({lineIndex:c,lineNumber:u})=>{const f=n[c];if(f==null){const g="FileRenderer.processFileResult: Line doesnt exist";throw console.error(g,{name:e.name,lineIndex:c,lineNumber:u,lines:a}),new Error(g)}if(f!=null){l.children.push(Di("context",u,`${c}`)),s.push(f),d++;const g=this.lineAnnotations[u];g!=null&&(l.children.push(j("context","annotation",1)),s.push(qt({hunkIndex:0,lineIndex:u,annotations:g.map(b=>ge(b))})),d++)}}}),l.properties.style=`grid-row: span ${d}`,{gutterAST:l.children??[],contentAST:s,preAST:this.createPreElement(a.length),headerAST:o?void 0:this.renderHeader(e),totalLines:a.length,rowCount:d,themeStyles:i,baseThemeType:r,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderHeader(e){const{headerRenderMode:t="default",stickyHeader:n=!1}=this.options;return Yi({fileOrDiff:e,mode:t,stickyHeader:n})}renderFullHTML(e){return pe(this.renderFullAST(e))}renderFullAST(e,t=[]){return t.push(A({tagName:"code",children:this.renderCodeAST(e),properties:{"data-code":""}})),{...e.preAST,children:t}}renderCodeAST(e){const t=Ee();return t.children=e.gutterAST,t.properties.style=`grid-row: span ${e.rowCount}`,[t,er(e.contentAST,e.rowCount)]}renderPartialHTML(e,t=!1){return t?pe(A({tagName:"code",children:e,properties:{"data-code":""}})):pe(e)}async initializeHighlighter(){return this.highlighter=await xt(un(this.computedLang,this.options)),this.highlighter}onHighlightSuccess(e,t,n,i=!0){if(this.renderCache==null)return;const r=!ae(e,this.renderCache.file)||!this.renderCache.highlighted||!Oe(n,this.renderCache.options);this.renderCache={file:e,options:n,highlighted:i,result:t,renderRange:void 0},r&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){const n=this.workerManager?.getFileResultCache(e);if(!(n==null||!Oe(t,n.options)))return n}hasHighlightedRenderCache(e,t){const{renderCache:n}=this;return n?.result!=null&&n.highlighted&&ae(e,n.file)&&Oe(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}createPreElement(e){const{disableLineNumbers:t=!1,overflow:n="scroll"}=this.options;return Xi({type:"file",diffIndicators:"none",disableBackground:!0,disableLineNumbers:t,overflow:n,split:!1,totalLines:e})}};function Pt(e,t){return e>t}const nr=`
        -
        `};const u=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,d=m=>{if(!m.startsWith("["))return!1;const v=c.exec(m);if(!v)return m!=="["&&!/^\[\d+$/.test(m);const k=String(v[1]??"");return m.slice(v[0].length).startsWith("(")?!1:!/^\d+$/.test(k)},f=(m,v)=>{const k=m;if(k.src[k.pos]!=="[")return!1;const w=u.exec(k.src.slice(k.pos));if(!w)return!1;const b=k.src.slice(Math.max(0,k.pos-120),k.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(b))return!1;const _=k.src.slice(k.pos+w[0].length);if(_.startsWith("](")||_.startsWith("(")||d(_))return!1;if(!v){const g=w[1],x=k.push("reference","span",0);x.content=g,x.markup=w[0],x.raw=w[0]}return k.pos+=w[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(m,v)=>{const w=String(m[v].content??"");return`${w}`};const h=n.use.bind(n);return n.use=((...m)=>(o.__markstreamHasCustomParserExtensions=!0,h(...m))),n}function Sce({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function t$({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Sce({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const Ace={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Mce(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function n$(e){const t=Mce(e);return Ace[t]??t}function Tce(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>n$(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Ece(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Ice(e){return Ece(e)?.join("\0")??""}function Lce(e,t){return`${Ice(e)}\0\0${Tce(t)?.join("\0")??""}`}function rd(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function a_(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var $ce=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const m=u_();this.startedAt=f&&this.hasStarted?m-this.normalizedStartDelayMs:m,this.lastTick=m,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=u_();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,k=Oce(m/Math.max(.001,v/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(k-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const w=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),b=Rce(this.source.slice(this.visible.length),w,this.segmenter);b.text&&(this.visible+=b.text,this.charBudget=Math.max(0,this.charBudget-b.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:u=80,flushOnFinish:c=!1}=e;this.minCharsPerSecond=rd(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,rd(o,1e3,1)),this.normalizedTargetLatencyMs=rd(s,900,1),this.normalizedCatchUpLatencyMs=rd(i,350,1),this.normalizedCatchUpThreshold=a_(r,600),this.normalizedStartDelayMs=a_(a,80),this.maxCommitFps=Math.trunc(rd(l,30,1)),this.maxCharsPerCommit=Math.trunc(rd(u,80,1)),this.flushOnFinish=c,this.segmenter=Fce(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function Nce(e={},t){const n=new $ce(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Fce(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function Rce(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function u_(){return typeof performance<"u"?performance.now():Date.now()}function Oce(e,t,n){return Math.min(n,Math.max(t,e))}var Pce=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const G3=Symbol.for("markstream-vue:node-lifecycle");function wVe(){}const c5=new Map;let o$="material";const Ad=new Map,c_=new Map;let Y3=null;function Dce(e){c5.set(e.id,e)}function Bce(e){const t=c5.get(o$);if(!t)return;const n=t.core[e];if(n)return n;const o=Ad.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Ad.has(t.id)&&zce(t)}function Hce(){var e,t;return(t=(e=c5.get(o$))==null?void 0:e.fallback)!=null?t:""}function zce(e){return Pce(this,null,function*(){var t,n,o;if(Ad.has(e.id))return(t=Ad.get(e.id))!=null?t:null;let s=c_.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Ad.set(e.id,i),Y3?.(),i)).catch(()=>(Ad.set(e.id,null),null)),c_.set(e.id,s)),s})}const d_='',f_='',Wce={id:"material",core:{"":f_,plain:'',text:f_,javascript:'',typescript:'',jsx:'',tsx:'',html:'',css:'',scss:'',json:'',python:'',ruby:'',go:'',java:'',kotlin:'',c:'',cpp:'',cs:d_,csharp:d_,php:'',shell:'',powershell:'',sql:'',yaml:'',markdown:'',xml:'',rust:'',vue:'',mermaid:''},fallback:'',loadExtended:()=>jo(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},Uce=Xr(0);Y3=()=>{Uce.value++},Dce(Wce);const jce={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function T2(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=jce[n])!=null?t:n}function _Ve(e){const t=T2(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function xVe(e){return Bce(T2(e))||Hce()}const p_={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var E2=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let ki=null,Qu=!1,ec=null,I2=f5;function Jp(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function d5(){try{const e=globalThis;return Jp(e?.katex)}catch{return null}}function f5(){return E2(null,null,function*(){const e=d5();if(e)return e;const t=yield jo(()=>import("./katex-DnlPpQZa.js"),[]);try{yield jo(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([0,1]))}catch{}return Jp(t)})}function s$(e){const t=Promise.resolve(e).then(n=>{var o;return ec===t&&n?(ki=(o=Jp(n))!=null?o:n,ki):null}).catch(()=>null).finally(()=>{ec===t&&(ec=null)});return ec=t,Qu=!0,t}function Vce(e){I2=e,ki=null,Qu=!1,ec=null}function qce(e){Vce(f5)}function i$(){return typeof I2=="function"}function SVe(){var e;const t=I2;if(!t||t===f5)return null;if(ki)return ki;const n=d5();if(n)return ki=n,ki;if(Qu)return null;try{const o=t();return o?typeof o?.then=="function"?(s$(o),null):(ki=(e=Jp(o))!=null?e:o,ki):null}catch{return null}}function r$(){return E2(this,null,function*(){var e;const t=d5();if(t)return ki=t,ki;if(ki)return ki;if(ec)return ec;if(Qu)return null;const n=I2;if(!n)return Qu=!0,null;try{const o=n();if(typeof o?.then=="function")return s$(o);if(o)return ki=(e=Jp(o))!=null?e:o,Qu=!0,ki}catch{}return Qu=!0,null})}function l$(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Ha=null,Na=null;const Ws=new Map,ea=new Map;let Lp=5;const uc=new Set;function Gf(){if(Ws.size{const{id:n,html:o,error:s}=t.data,i=Ws.get(n);if(i)if(Ws.delete(n),clearTimeout(i.timeoutId),i.cleanup(),Gf(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(ea.set(a,o),ea.size>200){const u=ea.keys().next().value;ea.delete(u)}}i.aborted||i.resolve(o)}},Ha.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Ws.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Ws.clear(),a$()}}function Zce(){var e;for(const t of Ws.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Ws.clear(),a$(),Ha&&((e=Ha.terminate)==null||e.call(Ha)),Ha=null,Na=null}function Gce(e,t=!0,n=2e3,o){return E2(this,null,function*(){performance.now();const s=l$(e);if(!i$()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if(Na)return Promise.reject(Na);const i=`${t?"d":"i"}:${s}`,r=ea.get(i);if(r)return Gf(),Promise.resolve(r);const l=Ha||(Na=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Na.name="WorkerInitError",Na.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Na);if(Ws.size>=Lp){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Ws.size,a.max=Lp,Promise.reject(a)}return new Promise((a,u)=>{if(o?.aborted){const v=new Error("Aborted");return v.name="AbortError",void u(v)}const c=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const v=Ws.get(c);if(!v)return;Ws.delete(c),v.cleanup();const k=new Error("Worker render timed out");k.name="WorkerTimeout",k.code="WORKER_TIMEOUT",v.aborted||v.reject(k),Gf()},n);d=()=>{const v=Ws.get(c);if(!v||v.aborted)return;v.aborted=!0,v.cleanup();const k=new Error("Aborted");k.name="AbortError",u(k)},o&&o.addEventListener("abort",d,{once:!0});const h=a,m=u;Ws.set(c,{resolve:v=>{h(v)},reject:v=>{m(v)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:c,content:s,displayMode:t})}catch(v){const k=Ws.get(c);Ws.delete(c),clearTimeout(f),k?.cleanup(),k?.reject(v),Gf()}})})}function AVe(e,t=!0,n){const o=`${t?"d":"i"}:${l$(e)}`;if(ea.set(o,n),ea.size>200){const s=ea.keys().next().value;ea.delete(s)}}const Yce="WORKER_BUSY";function Xce(e=2e3,t){return Ws.size{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),uc.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},uc.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const u=new Error("Wait for worker slot timed out");u.name="WorkerBusyTimeout",u.code="WORKER_BUSY_TIMEOUT",o(u)},e),queueMicrotask(()=>Gf()),t&&(r=()=>{if(i)return;i=!0,a();const u=new Error("Aborted");u.name="AbortError",o(u)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const sf={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function MVe(e){return E2(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!i$()){const v=new Error("KaTeX rendering disabled");throw v.name="KaTeXDisabled",v.code="KATEX_DISABLED",v}const a=(s=o.timeout)!=null?s:sf.timeout,u=(i=o.waitTimeout)!=null?i:sf.waitTimeout,c=(r=o.backoffMs)!=null?r:sf.backoffMs,d=(l=o.maxRetries)!=null?l:sf.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):sf.maxRetries,h=o.signal;let m=0;for(;;){if(h?.aborted){const v=new Error("Aborted");throw v.name="AbortError",v}try{return yield Gce(t,n,a,h)}catch(v){if(v?.code!==Yce||m>=f)throw v;if(m++,yield Xce(u,h).catch(()=>{}),h?.aborted){const k=new Error("Aborted");throw k.name="AbortError",k}c>0&&(yield new Promise(k=>globalThis.setTimeout(k,c*m)))}}})}function Md(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Jce(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function ig(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=Jce(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function rg(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function u$(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function lg(e,t=360,n=500){return u$(e,t,n)}function ag(e,t=360,n=500){return u$(e,t,n)}var Qce=Object.defineProperty,ede=Object.defineProperties,tde=Object.getOwnPropertyDescriptors,h_=Object.getOwnPropertySymbols,nde=Object.prototype.hasOwnProperty,ode=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Qce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c$=(e,t)=>{for(var n in t||(t={}))nde.call(t,n)&&m_(e,n,t[n]);if(h_)for(var n of h_(t))ode.call(t,n)&&m_(e,n,t[n]);return e},g_=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const ug=()=>jo(()=>import("./mermaid.core-CJB1tAev.js").then(e=>e.bp),__vite__mapDeps([2,3]));let Ul=null,Td=ug,xf=null,X3=!1,J3=!1,Sf=0;function sde(e){Td=e,Sf++,Ul=null,xf=null,X3=!1,J3=!1}function ide(e){sde(ug)}function v_(){return typeof Td=="function"}function y_(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=c$({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},ede(n,tde(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function k_(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=c$({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function TVe(){return g_(this,null,function*(){if(Ul)return Ul;const e=(function(){try{const o=globalThis;return y_(o?.mermaid)}catch{return null}})();if(e)return Ul=e,k_(Ul),Ul;const t=Td,n=Sf;return t?t===ug&&X3?null:xf||(xf=g_(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===ug)return n===Sf&&t===Td&&(X3=!0,(function(i){J3||(J3=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===Sf&&t===Td&&(xf=null)}return n!==Sf||t!==Td?null:o?(Ul=y_(o),k_(Ul),Ul):null}),xf):null})}let Oi=null,Fa=null;const Dr=new Map,Uu=new Map;function Jh(e){for(const t of Dr.values())t.reject(e);Dr.clear(),Uu.clear()}let b_=5,C_=!1;const rde="WORKER_BUSY",w_="MERMAID_DISABLED";function lde(e){if(Oi&&Oi!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Jh(n)}Oi=e,Fa=null;const t=e;Oi.onmessage=n=>{if(Oi!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Dr.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Oi.onerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Jh(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Oi.onmessageerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Jh(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function ade(){var e;if(Oi)try{Jh(new Error("Worker cleared")),(e=Oi.terminate)==null||e.call(Oi)}catch{}Oi=null,Fa=null}function d$(e,t,n,o){if(!v_()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=w_,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=Uu.get(s);return i||(i=(function(r,l,a=1400){if(!v_()){const c=new Error("Mermaid rendering disabled");return c.name="MermaidDisabled",c.code=w_,Promise.reject(c)}if(Fa)return Promise.reject(Fa);const u=Oi||(Fa=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Fa.name="WorkerInitError",Fa.code="WORKER_INIT_ERROR",null);if(!u)return Promise.reject(Fa);if(Dr.size>=b_){const c=new Error("Worker busy");return c.name="WorkerBusy",c.code=rde,c.inFlight=Dr.size,c.max=b_,Promise.reject(c)}return new Promise((c,d)=>{const f=Math.random().toString(36).slice(2);let h,m=!1;const v=()=>{m||(m=!0,h!=null&&globalThis.clearTimeout(h),Dr.delete(f))},k={resolve:w=>{v(),c(w)},reject:w=>{v(),d(w)}};Dr.set(f,k);try{u.postMessage({id:f,action:r,payload:l})}catch(w){return Dr.delete(f),void d(w)}h=globalThis.setTimeout(()=>{const w=new Error("Worker call timed out");w.name="WorkerTimeout",w.code="WORKER_TIMEOUT";const b=Dr.get(f);b&&b.reject(w)},a)})})(e,t,n),Uu.set(s,i),i.then(()=>{Uu.get(s)===i&&Uu.delete(s)},()=>{Uu.get(s)===i&&Uu.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,u)=>{let c=()=>{};const d=()=>l.removeEventListener("abort",c);c=()=>{d();const f=new Error("Aborted");f.name="AbortError",u(f)},l.addEventListener("abort",c,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),u(f)})})})(i,o)}function EVe(e,t,n=1400,o){return d$("canParse",{code:e,theme:t},n,o)}function IVe(e,t,n=1400,o){return d$("findPrefix",{code:e,theme:t},n,o)}var ude=Object.defineProperty,cde=Object.defineProperties,dde=Object.getOwnPropertyDescriptors,__=Object.getOwnPropertySymbols,fde=Object.prototype.hasOwnProperty,pde=Object.prototype.propertyIsEnumerable,x_=(e,t,n)=>t in e?ude(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))fde.call(t,n)&&x_(e,n,t[n]);if(__)for(var n of __(t))pde.call(t,n)&&x_(e,n,t[n]);return e},rn=(e,t)=>cde(e,dde(t)),mo=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const hde="__global__",q9="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Q3=(()=>{const e=globalThis;if(e[q9])return e[q9];const t={scopedCustomComponents:{},revision:Xr(0)};return e[q9]=t,t})(),S_=Q3.revision,mde=Symbol("markstreamCustomComponents"),gde=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Qp(e){return gde.has(String(e).trim().toLowerCase())}function vde(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function K9(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([Sr(n),Sr(vde(n))]))!s||Qp(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function fs(e){const t=nn(mde,null);return R(()=>{var n;return S_.value,(function(o,s={}){return S_.value,mt(mt(mt({},K9(Q3.scopedCustomComponents[hde]||{})),K9(s)),K9((function(i){return i&&Q3.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const yde=["aria-label"],kde={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},bde={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Gn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},nr=Gn(et({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(y(),M("svg",bde,[...n[1]||(n[1]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),C("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(y(),M("svg",kde,[...n[0]||(n[0]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,yde))}),[["__scopeId","data-v-be21ab83"]]);nr.install=e=>{e.component(nr.__name,nr)};const Cde={class:"emoji-node"},zi=Gn(et({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",Cde,N(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);zi.install=e=>{e.component(zi.__name,zi)};const wde=["id"],_de=["title"],or=Gn(et({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(y(),M("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[C("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+N(e.node.id)+"]",9,_de)],8,wde))}}),[["__scopeId","data-v-c1463a29"]]);or.install=e=>{e.component(or.__name,or)};const f$=(()=>{try{return!1}catch{}return!1})();function Z9(e){f$&&console.warn(e)}function A_(e,t="safe",n){return u5(e,t,n)}function p$(e){return oce(e)}function G9(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function p5(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Xh((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),G9(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),G9(r.value)]):Object.entries(s).map(([r,l])=>[r,G9(l)]):null,t,n);var s;if(!o)return;const i=p$(Zf(o));return Object.keys(i).length>0?i:void 0}function M_(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function rf(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Y9(e,t,n,o,s,i,r=!1){const l=(function(d,f){return YL(d,f)})(e,o);if(Zp.has(e.toLowerCase())||!l&&qL(e,i))return null;if(!l&&a5(e,i))return r?[M_(e,t,!0)]:[M_(e,t),...n,``];const a=u5(t,i,e),u=a.key,c=u!=null&&u!==""?u:s;if(l){const d=o[e]||o[e.toLowerCase()],f=p$(a);return tn(d,rn(mt({},f),{key:c}),n.length>0?n:void 0)}return tn(e,rn(mt({},a),{innerHTML:void 0,key:c}),n.length>0?n:void 0)}function h$(e,t){return rce(e,t)}function cg(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const u=[],c=[];for(const d of i)if(d.type==="text")(u.length>0?u[u.length-1].children:c).push(d.content);else if(d.type==="self_closing"){const f=Y9(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);rf(u.length>0?u[u.length-1].children:c,f)}else if(d.type==="tag_open")u.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let m=u.length-1;m>=0;m--)if(u[m].tagName.toLowerCase()===f){h=m;break}if(h!==-1)for(;u.length>h;){const m=u.pop(),v=Y9(m.tagName,m.attrs||{},m.children,r,m.autoKey,l);u.length>0?rf(u[u.length-1].children,v):rf(c,v),m.tagName.toLowerCase()!==f&&u.length>h&&Z9(`Auto-closing unclosed tag: <${m.tagName}>`)}else Z9(`Ignoring closing tag with no matching opening tag: `)}for(;u.length>0;){const d=u.pop(),f=Y9(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);u.length>0?rf(u[u.length-1].children,f):rf(c,f),Z9(`Auto-closing unclosed tag: <${d.tagName}>`)}return c})(XL(e),t,n)}catch(s){return o=s,f$&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xde=["innerHTML"],sr=Gn(et({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=R(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=fs(()=>t.customId),i=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=R(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:jd(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const u=cg(l,s.value,o.value);if(u!==null)return{mode:"dynamic",nodes:u}}if(!h$(l,s.value))return{mode:"html",content:jd(l,o.value)};const a=cg(l,s.value,o.value);return a===null?{mode:"html",content:jd(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(y(),M("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[j(p(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(y(),M("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},N(r.value.content),3)):(y(),M("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,xde))}}),[["__scopeId","data-v-d17f12b0"]]);sr.install=e=>{e.component(sr.__name,sr)};const Sde={class:"inline-code"},Ade={key:0},li=Gn(et({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const b=n.fade;return b===""||b===!0||b==="true"||b!==!1&&b!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var b;return String((b=t.node.code)!=null?b:"")}),u=R(()=>!l.value),c=R(()=>{var b;const _=(b=n["index-key"])!=null?b:n.indexKey;return _==null||_===""?"":String(_)}),d=Z(t.node.code),f=Z(""),h=Z(0);let m;function v(){m?.(),m=void 0}function k(){v(),f.value&&(d.value=d.value+f.value,f.value="")}Je([()=>t.node.code,c,l],([b])=>{const _=String(b??""),g=c.value,x=t$({nextContent:_,persistedContent:g?s?.get(g):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=x.settledContent,f.value=x.streamedDelta,x.appended?(h.value+=1,(function(){if(!f.value||m||!i)return;const S=i.value;m=Je(()=>i.value,T=>{T!==S&&k()},{flush:"sync"})})()):f.value||v(),g&&s?.set(g,_)},{immediate:!0}),d1(v);const w=R(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(b,_)=>(y(),M("code",Sde,[u.value?(y(),M(Pe,{key:0},[qe(N(a.value),1)],64)):(y(),M(Pe,{key:1},[d.value?(y(),M("span",Ade,N(d.value),1)):ee("",!0),f.value?(y(),M("span",{key:1,class:Re(["inline-code-stream-delta",[w.value]]),onAnimationend:k},N(f.value),35)):ee("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);li.install=e=>{e.component(li.__name,li)};const e8=Z(!1),T_=Z(""),E_=Z("top"),Yf=Z(null),Xf=Z(null),t8=Z(null),n8=Z(null),I_=Z(null);let Qh=null,em=null,o8=0;function m$(){Qh&&(clearTimeout(Qh),Qh=null),em&&(clearTimeout(em),em=null)}let bh=!1,Ch=null,L_=!1;function Mde(e,t,n="top",o=!1,s,i){if(!e)return;const r=++o8;m$();const l=()=>mo(null,null,function*(){var a,u;if(yield(function(){return mo(this,null,function*(){if(!bh&&!L_&&typeof document<"u"){Ch!=null||(Ch=mo(null,null,function*(){const[{createApp:c,h:d},{default:f}]=yield Promise.all([jo(()=>import("./vue.runtime.esm-bundler-J0WjtLlK.js"),[]),jo(()=>import("./Tooltip-DbYQWF1U.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),c({setup:()=>()=>{var m;return d(f,{visible:e8.value,"anchor-el":Yf.value,content:T_.value,placement:E_.value,id:Xf.value,originX:t8.value,originY:n8.value,isDark:(m=I_.value)!=null?m:void 0})}}).mount(h),bh=!0}));try{yield Ch}catch(c){bh=!1,Ch=null,L_=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",c)}}})})(),bh&&r===o8){Xf.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Yf.value=e,T_.value=t,E_.value=n,t8.value=(a=s?.x)!=null?a:null,n8.value=(u=s?.y)!=null?u:null,I_.value=typeof i=="boolean"?i:null,e8.value=!0;try{e.setAttribute("aria-describedby",Xf.value)}catch{}}});o?l():Qh=setTimeout(l,80)}function Tde(e=!1){o8+=1,m$();const t=()=>{if(Yf.value&&Xf.value)try{Yf.value.removeAttribute("aria-describedby")}catch{}e8.value=!1,Yf.value=null,Xf.value=null,t8.value=null,n8.value=null};e?t():em=setTimeout(t,120)}const Ede={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Ide=Symbol("markstreamI18nFallback");function g$(e,t){var n;return(n=t?.[e])!=null?n:Ede[e]}const s8=(e,t)=>{var n;return(n=g$(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function $_(e,t){return{t(n){const o=g$(n,t);if(e.te&&o!=null&&!e.te(n))return s8(n,t);const s=e.t(n);return s===n&&o!=null?s8(n,t):s}}}function Lde(){const e=(function(){var n,o,s;try{const i=ds(),r=Ide,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=ds(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const u=i?.$te;return{t:r.bind(i),te:typeof u=="function"?u.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const u=l?.$te;return{t:a.bind(l),te:typeof u=="function"?u.bind(l):void 0}}}catch{}return null})();if(t)return $_(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return $_({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>s8(n,e)}}const v$=Symbol("ViewportPriority"),y$=Symbol("ViewportPriorityOptions"),k$=Symbol("OffscreenHeavyNodeDeferral"),$de=R(()=>!1),yc="400px";function h5(){return nn(y$,void 0)}function m5(){return nn(k$,$de)}function Nde(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=s?(n=window.requestIdleCallback)!=null?n:T=>window.setTimeout(()=>T({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:T=>window.clearTimeout(T):null,a=new WeakMap;let u=1;const c=new Map,d=new Map,f=new Set;let h=null,m=null;function v(T){if(!T)return"viewport";let A=a.get(T);return A||(A=u++,a.set(T,A)),String(A)}function k(){if(h!=null){try{l?.(h)}catch{}h=null}}function w(T){if(T){const A=c.get(T);if(A&&!A.targets.size){try{A.io.disconnect()}catch{}c.delete(T)}}d.size||f.size||k()}function b(T){const A=d.get(T);if(!A)return;const E=c.get(A.bucketKey);if(!A.visible.value){A.visible.value=!0;try{A.resolve()}catch{}}try{E?.io.unobserve(T)}catch{}E?.targets.delete(T),d.delete(T),f.delete(T),w(A.bucketKey)}function _(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const T=f.values().next().value;T&&(f.delete(T),b(T),f.size&&_())},{timeout:1200}))}function g(T,A){if(!s||typeof IntersectionObserver>"u")return null;const E=(function(H,O){var F,U,z;return{root:(F=e?.(H??null))!=null?F:null,rootMargin:(U=O?.rootMargin)!=null?U:yc,threshold:(z=O?.threshold)!=null?z:0}})(T,A),P=[v((D=E).root),D.rootMargin,D.threshold].join("\0");var D;const I=c.get(P);if(I)return{key:P,bucket:I};let $;try{$=new IntersectionObserver(H=>{for(const O of H)(O.isIntersecting||O.intersectionRatio>0)&&b(O.target)},{root:E.root,rootMargin:E.rootMargin,threshold:E.threshold})}catch{return null}const B={io:$,targets:new Map};return c.set(P,B),{key:P,bucket:B}}function x(){if(s&&i.value)for(const[T,A]of Array.from(d.entries())){const E=g(T,A.opts);if(!E){b(T);continue}if(E.key===A.bucketKey)continue;const P=A.bucketKey,D=c.get(P);try{D?.io.unobserve(T)}catch{}D?.targets.delete(T),A.bucketKey=E.key,E.bucket.targets.set(T,A),E.bucket.io.observe(T),w(P)}}Je(i,T=>{if(!T){for(const A of Array.from(d.keys()))b(A);k()}},{flush:"sync"});const S=(T,A)=>{const E=Z(!1);let P,D=!1;const I=new Promise(O=>{P=()=>{D||(D=!0,O())}}),$=()=>{const O=d.get(T);if(!O)return f.delete(T),void w();const F=c.get(O.bucketKey);try{F?.io.unobserve(T)}catch{}F?.targets.delete(T),d.delete(T),f.delete(T),w(O.bucketKey)};if(!s||!i.value)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const B=g(T,A);if(!B)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const H={resolve:P,visible:E,bucketKey:B.key,opts:A};return d.set(T,H),B.bucket.targets.set(T,H),B.bucket.io.observe(T),s&&m==null&&(m=window.requestAnimationFrame(()=>{m=null,x()})),A?.allowIdle!==!1&&(f.add(T),_()),{isVisible:E,whenVisible:I,destroy:$}};return S.refresh=x,Ln(v$,S),S}function g5(){var e,t;const n=nn(v$,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,u=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},c=h=>{if(!h)return;const m=s.get(h);if(m&&!m.targets.size){try{m.io.disconnect()}catch{}s.delete(h)}},d=h=>{const m=o.get(h);if(!m)return;const v=s.get(m.bucketKey);if(!m.visible.value){m.visible.value=!0;try{m.resolve()}catch{}}try{v?.io.unobserve(h)}catch{}o.delete(h),v?.targets.delete(h),i.delete(h),c(m.bucketKey),i.size||u()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,m)=>{const v=Z(!1);let k,w=!1;const b=new Promise(x=>{k=()=>{w||(w=!0,x())}}),_=()=>{const x=o.get(h);if(!x)return i.delete(h),void(i.size||u());const S=s.get(x.bucketKey);try{S?.io.unobserve(h)}catch{}o.delete(h),S?.targets.delete(h),i.delete(h),c(x.bucketKey),i.size||u()},g=(x=>{var S,T;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const A=($=>{var B,H;return[(B=$?.rootMargin)!=null?B:yc,(H=$?.threshold)!=null?H:0].join("\0")})(x),E=s.get(A);if(E)return{key:A,bucket:E};const P=(S=x?.rootMargin)!=null?S:yc;let D;try{D=new IntersectionObserver($=>{for(const B of $)(B.isIntersecting||B.intersectionRatio>0)&&d(B.target)},{root:null,rootMargin:P,threshold:(T=x?.threshold)!=null?T:0})}catch{return null}const I={io:D,targets:new Set};return s.set(A,I),{key:A,bucket:I}})(m);return g?(o.set(h,{resolve:k,visible:v,bucketKey:g.key}),g.bucket.targets.add(h),g.bucket.io.observe(h),m?.allowIdle!==!1&&(i.add(h),f()),{isVisible:v,whenVisible:b,destroy:_}):(v.value=!0,k(),{isVisible:v,whenVisible:b,destroy:_})}}function Fde(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const Rde=["data-markstream-viewport-pending"],Ode=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Pde={key:1,class:"image-placeholder"},Dde={key:1,class:"image-node__raw-text"},Bde={key:2,class:"image-shimmer-overlay"},Hde={key:1,class:"image-node__raw-text"},zde={key:3,class:"image-error"},Va=Gn(et({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=Z(!1),a=Z(!1),u=Z(""),c=Z("primary"),d=Z(null),f=p1(),h=nn(G3,null),m=g5(),v=h5(),k=m5(),w=R(()=>nw(i.node.src)),b=R(()=>nw(i.fallbackSrc)),_=(s=(o=(n=ds())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),g=typeof window<"u"&&_?.getAttribute("src")===(w.value||b.value),x=Z(typeof window>"u"||g||!k.value),S=Xr(null);let T="",A=null;const E=R(()=>u.value),P=R(()=>!i.lazy),D=R(()=>typeof window<"u"&&k.value&&!g),I=R(()=>!D.value||x.value),$=R(()=>I.value?E.value:""),B=R(()=>{var de,pe;return(pe=(de=v?.value.heavyBlockMargin)!=null?de:v?.value.rootMargin)!=null?pe:yc}),H=R(()=>!i.node.loading&&c.value!=="failed"&&u.value.length>0),O=R(()=>c.value==="failed"),F=R(()=>(!P.value||D.value&&!x.value)&&!l.value&&!a.value&&c.value!=="failed"&&u.value.length>0),U=R(()=>Fde(i,f));function z(de=U.value){de&&d.value&&h?.reportHeight(de,d.value.offsetHeight)}function W(de=U.value){de&&yt(()=>{z(de)})}function K(){A&&(clearTimeout(A),A=null)}function V(){const de=U.value;de&&T!==de&&(T&&h?.markSettled(T),K(),T=de,h?.markPending(de),typeof window<"u"&&(A=window.setTimeout(()=>{T===de&&(W(de),ie())},8e3)))}function ie(){return mo(this,null,function*(){const de=T;de&&(K(),T="",yield yt(),z(de),h?.markSettled(de))})}function ne(){if(c.value==="primary"&&b.value&&b.value!==u.value)return c.value="fallback",u.value=b.value,l.value=!1,a.value=!1,void W();c.value="failed",a.value=!0,r("error",u.value),W()}function X(){l.value=!0,a.value=!1,r("load",E.value),W()}function le(de){de.preventDefault(),l.value&&!a.value&&r("click",[de,E.value])}const{t:Ie}=Lde();return Je([w,b,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||w.value?(u.value=w.value,void(c.value="primary")):b.value?(u.value=b.value,void(c.value="fallback")):(u.value="",c.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&Je([d,D],([de,pe],ve,oe)=>{var ye;if((ye=S.value)==null||ye.destroy(),S.value=null,!pe||x.value)return void(x.value=!0);if(!de)return void(x.value=!1);let G=!0;const Y=m(de,{rootMargin:B.value,allowIdle:!1});S.value=Y,x.value=Y.isVisible.value,Y.whenVisible.then(()=>{G&&S.value===Y&&(x.value=!0)}),oe(()=>{G=!1,Y.destroy(),S.value===Y&&(S.value=null)})},{immediate:!0}),Je([H,l,a,E,()=>i.lazy,I],([de,pe,ve,oe,ye,G])=>de&&oe&&!ve&&G?pe?(ie(),void W()):ye?(V(),void W()):void(pe||ve||V()):(ie(),void W()),{flush:"post",immediate:!0}),Vn(()=>{var de;(de=S.value)==null||de.destroy(),S.value=null,(function(){const pe=T;pe&&(K(),T="",h?.markSettled(pe))})()}),(de,pe)=>{var ve,oe,ye,G,Y;return y(),M("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":D.value&&!x.value?"true":void 0},[H.value?(y(),M("img",{key:0,src:$.value||void 0,alt:String((oe=(ve=i.node.alt)!=null?ve:i.node.title)!=null?oe:""),title:String((G=(ye=i.node.title)!=null?ye:i.node.alt)!=null?G:""),class:Re(["image-node__img",{"is-loading":!P.value&&!l.value,"is-loaded":P.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:P.value?"high":void 0,decoding:P.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(Y=i.node.alt)!=null?Y:p(Ie)("image.preview"),onError:ne,onLoad:X,onClick:le},null,42,Ode)):ee("",!0),e.node.loading&&!a.value?(y(),M("span",Pde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[0]||(pe[0]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Dde,N(e.node.raw),1))])):ee("",!0),F.value&&!e.node.loading?(y(),M("span",Bde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[1]||(pe[1]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Hde,N(e.node.raw),1))])):ee("",!0),O.value?(y(),M("span",zde,[xn(de.$slots,"error",{node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[2]||(pe[2]=C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[C("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),C("span",null,N(p(Ie)("image.loadError")),1)],!0)])):ee("",!0)],8,Rde)}}}),[["__scopeId","data-v-046e82ac"]]);Va.install=e=>{e.component(Va.__name,Va)};const Wde={key:2},El=et({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamNestedRendererProps",void 0),i=R(()=>{var m;return(m=o?.value)!=null?m:"safe"}),r=R(()=>{var m,v;const k=(m=s?.value)!=null?m:{};return rn(mt({},k),{customId:(v=t.customId)!=null?v:k.customId,htmlPolicy:i.value})}),l=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),a=R(()=>t.components[String(t.node.type)]),u=R(()=>!!(a.value&&n.value[t.node.type]&&!Qp(String(t.node.type)))),c=R(()=>u.value?p5(t.node,i.value):void 0),d=R(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=R(()=>{var m;return String((m=t.node.content)!=null?m:"")}),h=R(()=>{var m,v;return String((v=(m=t.node.content)!=null?m:t.node.raw)!=null?v:"")});return(m,v)=>a.value&&u.value?(y(),he(bs(a.value),zn({key:0},c.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:me(()=>[d.value?(y(),he(p(l),zn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(y(),he(p(l),zn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(y(),he(bs(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(y(),M("span",Wde,N(h.value),1)):ee("",!0)}}),N_=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Ude(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return rn(mt(mt({},N_),n),{enabled:(t=n.enabled)==null||t})}return mt({},N_)}function v5(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function b$(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function F_(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function jde(e){var t;return e.diff===!0||F_(e.language)||F_(b$(String((t=e.raw)!=null?t:"")))}function Vde(e,t,n){const o=(function(s){const i=b$(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const u=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(u&&/[./\\-]/.test(u))return u}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const qde=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Kde={key:0,translate:"no",class:"markstream-pre__diff-code"},Zde={class:"markstream-pre__diff-pane-content"},Gde={class:"markstream-pre__diff-number","aria-hidden":"true"},Yde={class:"markstream-pre__diff-content"},Xde={class:"markstream-pre__diff-content-inner"},Jde={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Qde=["textContent"],e1e=["textContent"],Pi=et({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(X,le){const Ie=String(X??"");return le?Ie:Ie.replace(/\r\n$|\n$|\r$/,"")}const o=R(()=>{var X,le,Ie;const de=String((le=(X=t.node)==null?void 0:X.language)!=null?le:"");return String((Ie=String(de).split(/\s+/g)[0])!=null?Ie:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=R(()=>`language-${o.value}`),i=R(()=>{var X;return t.loading===!0||((X=t.node)==null?void 0:X.loading)===!0}),r=R(()=>{var X;return n((X=t.node)==null?void 0:X.code,i.value)});let l="",a=1;const u=R(()=>(function(X){let le=0,Ie=1;X.startsWith(l)&&(le=l.length,Ie=a,le>0&&X[le-1]==="\r"&&X[le]===` + `};const u=/^\[(\d+)\]/,c=/^\[([^\]\n]+)\]/,d=m=>{if(!m.startsWith("["))return!1;const v=c.exec(m);if(!v)return m!=="["&&!/^\[\d+$/.test(m);const k=String(v[1]??"");return m.slice(v[0].length).startsWith("(")?!1:!/^\d+$/.test(k)},f=(m,v)=>{const k=m;if(k.src[k.pos]!=="[")return!1;const w=u.exec(k.src.slice(k.pos));if(!w)return!1;const b=k.src.slice(Math.max(0,k.pos-120),k.pos);if(/"[^"\n]{1,80}"\s*:\s*$/.test(b))return!1;const _=k.src.slice(k.pos+w[0].length);if(_.startsWith("](")||_.startsWith("(")||d(_))return!1;if(!v){const g=w[1],x=k.push("reference","span",0);x.content=g,x.markup=w[0],x.raw=w[0]}return k.pos+=w[0].length,!0};n.inline.ruler.before("escape","reference",f),n.renderer.rules.reference=(m,v)=>{const w=String(m[v].content??"");return`${w}`};const h=n.use.bind(n);return n.use=((...m)=>(o.__markstreamHasCustomParserExtensions=!0,h(...m))),n}function Sce({nextContent:e,previousContent:t,typewriterEnabled:n}){return n?e===t?{settledContent:e,streamedDelta:"",appended:!1}:t&&e.startsWith(t)&&e.length>t.length?{settledContent:t,streamedDelta:e.slice(t.length),appended:!0}:{settledContent:e,streamedDelta:"",appended:!1}:{settledContent:e,streamedDelta:"",appended:!1}}function t$({nextContent:e,persistedContent:t,currentState:n,typewriterEnabled:o,streamRenderVersionChanged:s=!1}){const i=`${n.settledContent}${n.streamedDelta}`;return o?n.streamedDelta&&i===e?s?{settledContent:i,streamedDelta:"",appended:!1}:{settledContent:n.settledContent,streamedDelta:n.streamedDelta,appended:!1}:Sce({nextContent:e,previousContent:t??i,typewriterEnabled:o}):{settledContent:e,streamedDelta:"",appended:!1}}const Ace={plain:"plaintext",text:"plaintext",txt:"plaintext",js:"javascript",mjs:"javascript",cjs:"javascript",ts:"typescript",mts:"typescript",cts:"typescript",golang:"go",py:"python",rb:"ruby",rs:"rust",kt:"kotlin",kts:"kotlin",md:"markdown",yml:"yaml",sh:"shellscript",bash:"shellscript",zsh:"shellscript",shell:"shellscript",shellscript:"shellscript",ps:"powershell",ps1:"powershell",pwsh:"powershell","c++":"cpp","c#":"csharp",cs:"csharp",objc:"objective-c",objectivec:"objective-c","objective-c":"objective-c",objectivecpp:"objective-cpp","objective-c++":"objective-cpp","objective-cpp":"objective-cpp"};function Mce(e){const t=String(e??"").trim();if(!t)return"";const[n=""]=t.split(/\s+/);return n.split(":")[0]?.trim().toLowerCase()??""}function n$(e){const t=Mce(e);return Ace[t]??t}function Tce(e){if(!Array.isArray(e))return;const t=e.filter(o=>typeof o=="string").map(o=>n$(o)).filter(Boolean),n=Array.from(new Set(t)).sort();return n.length>0?n:void 0}function Ece(e){if(!Array.isArray(e))return;const t=[],n=new Set;for(const o of e){if(typeof o!="string")continue;const s=o.trim();!s||n.has(s)||(n.add(s),t.push(s))}return t.length>0?t:void 0}function Ice(e){return Ece(e)?.join("\0")??""}function Lce(e,t){return`${Ice(e)}\0\0${Tce(t)?.join("\0")??""}`}function rd(e,t,n=1){const o=Number(e);return Number.isFinite(o)?Math.max(n,o):t}function a_(e,t){const n=Number(e);return Number.isFinite(n)?Math.max(0,n):t}var $ce=class{constructor(e={},t){this.source="",this.visible="",this.done=!1,this.paused=!1,this.listeners=new Set,this.rafId=0,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.hasStarted=!1,this.destroyed=!1,this.getSnapshot=()=>({source:this.source,visible:this.visible,done:this.done,paused:this.paused,pendingChars:this.pendingChars,caughtUp:this.caughtUp,final:this.final}),this.subscribe=d=>this.destroyed?()=>{}:(this.listeners.add(d),()=>{this.listeners.delete(d)}),this.enqueue=d=>{if(this.destroyed||!d)return;this.done&&(this.done=!1);const f=this.source.length>0,h=this.pendingChars<=0;if(this.source+=d,h){const m=u_();this.startedAt=f&&this.hasStarted?m-this.normalizedStartDelayMs:m,this.lastTick=m,this.charBudget=0}this.hasStarted=!0,this.emit(),this.ensureLoop()},this.finish=(d={})=>{if(!this.destroyed){if(this.done=!0,d.flush??this.flushOnFinish){this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit();return}this.emit(),this.ensureLoop()}},this.flush=()=>{this.destroyed||(this.visible=this.source,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.cancelLoop(),this.emit())},this.reset=(d="")=>{this.destroyed||(this.cancelLoop(),this.source=d,this.visible=d,this.done=!1,this.paused=!1,this.hasStarted=!1,this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond,this.emit())},this.pause=()=>{this.destroyed||this.paused||(this.paused=!0,this.cancelLoop(),this.emit())},this.resume=()=>{if(this.destroyed||!this.paused)return;this.paused=!1;const d=u_();this.lastTick=d,this.startedAt||=d,this.emit(),this.ensureLoop()},this.destroy=()=>{this.destroyed||(this.destroyed=!0,this.cancelLoop(),this.listeners.clear())},this.dispose=()=>{this.destroy()},this.tick=d=>{if(this.rafId=0,this.destroyed||this.paused)return;if(this.pendingChars<=0){this.startedAt=0,this.lastTick=0,this.charBudget=0,this.currentCps=this.minCharsPerSecond;return}if(d-this.startedAtthis.normalizedCatchUpThreshold?this.normalizedCatchUpLatencyMs:this.normalizedTargetLatencyMs,k=Oce(m/Math.max(.001,v/1e3),this.minCharsPerSecond,this.maxCharsPerSecond);if(this.currentCps+=(k-this.currentCps)*.2,this.charBudget+=this.currentCps*(h/1e3),this.charBudget<1){this.ensureLoop();return}const w=Math.min(Math.floor(this.charBudget),this.maxCharsPerCommit),b=Rce(this.source.slice(this.visible.length),w,this.segmenter);b.text&&(this.visible+=b.text,this.charBudget=Math.max(0,this.charBudget-b.graphemeCount),this.emit()),this.ensureLoop()};const{minCharsPerSecond:n=40,maxCharsPerSecond:o=1e3,targetLatencyMs:s=900,catchUpLatencyMs:i=350,catchUpThreshold:r=600,maxCommitFps:l=30,startDelayMs:a=80,maxCharsPerCommit:u=80,flushOnFinish:c=!1}=e;this.minCharsPerSecond=rd(n,40,1),this.maxCharsPerSecond=Math.max(this.minCharsPerSecond,rd(o,1e3,1)),this.normalizedTargetLatencyMs=rd(s,900,1),this.normalizedCatchUpLatencyMs=rd(i,350,1),this.normalizedCatchUpThreshold=a_(r,600),this.normalizedStartDelayMs=a_(a,80),this.maxCommitFps=Math.trunc(rd(l,30,1)),this.maxCharsPerCommit=Math.trunc(rd(u,80,1)),this.flushOnFinish=c,this.segmenter=Fce(),t&&this.listeners.add(t),this.currentCps=this.minCharsPerSecond}get pendingChars(){return Math.max(0,this.source.length-this.visible.length)}get caughtUp(){return this.pendingChars===0}get final(){return this.done&&this.caughtUp}ensureLoop(){if(!(this.destroyed||this.rafId||this.paused||this.pendingChars<=0)){if(typeof requestAnimationFrame!="function"){this.flush();return}this.rafId=requestAnimationFrame(this.tick)}}cancelLoop(){this.rafId&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.rafId),this.rafId=0)}emit(){if(!this.destroyed)for(const e of this.listeners)e()}};function Nce(e={},t){const n=new $ce(e,t);return{getSnapshot:n.getSnapshot,subscribe:n.subscribe,enqueue:n.enqueue,finish:n.finish,flush:n.flush,reset:n.reset,pause:n.pause,resume:n.resume,destroy:n.destroy,dispose:n.dispose}}function Fce(){if(typeof Intl>"u")return null;const e=Intl.Segmenter;return e?new e(void 0,{granularity:"grapheme"}):null}function Rce(e,t,n){if(!e||t<=0)return{text:"",graphemeCount:0};if(!n){const i=Array.from(e).slice(0,t);return{text:i.join(""),graphemeCount:i.length}}let o="",s=0;for(const i of n.segment(e)){if(s>=t)break;o+=i.segment,s++}return{text:o,graphemeCount:s}}function u_(){return typeof performance<"u"?performance.now():Date.now()}function Oce(e,t,n){return Math.min(n,Math.max(t,e))}var Pce=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const G3=Symbol.for("markstream-vue:node-lifecycle");function wVe(){}const c5=new Map;let o$="material";const Ad=new Map,c_=new Map;let Y3=null;function Dce(e){c5.set(e.id,e)}function Bce(e){const t=c5.get(o$);if(!t)return;const n=t.core[e];if(n)return n;const o=Ad.get(t.id);if(o){const s=o[e];if(s)return s}t.loadExtended&&!Ad.has(t.id)&&zce(t)}function Hce(){var e,t;return(t=(e=c5.get(o$))==null?void 0:e.fallback)!=null?t:""}function zce(e){return Pce(this,null,function*(){var t,n,o;if(Ad.has(e.id))return(t=Ad.get(e.id))!=null?t:null;let s=c_.get(e.id);return s||(s=((o=(n=e.loadExtended)==null?void 0:n.call(e))!=null?o:Promise.resolve(null)).then(i=>(Ad.set(e.id,i),Y3?.(),i)).catch(()=>(Ad.set(e.id,null),null)),c_.set(e.id,s)),s})}const d_='',f_='',Wce={id:"material",core:{"":f_,plain:'',text:f_,javascript:'',typescript:'',jsx:'',tsx:'',html:'',css:'',scss:'',json:'',python:'',ruby:'',go:'',java:'',kotlin:'',c:'',cpp:'',cs:d_,csharp:d_,php:'',shell:'',powershell:'',sql:'',yaml:'',markdown:'',xml:'',rust:'',vue:'',mermaid:''},fallback:'',loadExtended:()=>jo(()=>import("./extended-p72mFE2C.js"),[]).then(e=>e.materialExtendedMap)},Uce=Xr(0);Y3=()=>{Uce.value++},Dce(Wce);const jce={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",golang:"go",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",bat:"shell",batch:"shell",ps1:"powershell",plaintext:"plain",text:"plain",txt:"plain","c++":"cpp","c#":"csharp",cs:"csharp","objective-c":"objectivec","objective-c++":"objectivecpp",yml:"yaml",md:"markdown",rs:"rust",kt:"kotlin"};function T2(e){var t;const n=(function(o){if(!o)return"";const s=o.trim();if(!s)return"";const[i]=s.split(/\s+/),[r]=i.split(":");return r.toLowerCase()})(e);return(t=jce[n])!=null?t:n}function _Ve(e){const t=T2(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";case"objectivec":return"objective-c";case"objectivecpp":return"objective-cpp";default:return t}}function xVe(e){return Bce(T2(e))||Hce()}const p_={js:"JavaScript",javascript:"JavaScript",ts:"TypeScript",jsx:"JSX",tsx:"TSX",html:"HTML",css:"CSS",scss:"SCSS",json:"JSON",py:"Python",python:"Python",rb:"Ruby",go:"Go",java:"Java",c:"C",cpp:"C++",cs:"C#",csharp:"C#",php:"PHP",sh:"Shell",bash:"Bash",sql:"SQL",yaml:"YAML",md:"Markdown",d2:"D2",d2lang:"D2","":"Plain Text",plain:"Plain Text"};var E2=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});let ki=null,Qu=!1,ec=null,I2=f5;function Jp(e){var t;const n=(t=e?.default)!=null?t:e;return n&&typeof n.renderToString=="function"?n:null}function d5(){try{const e=globalThis;return Jp(e?.katex)}catch{return null}}function f5(){return E2(null,null,function*(){const e=d5();if(e)return e;const t=yield jo(()=>import("./katex-DnlPpQZa.js"),[]);try{yield jo(()=>import("./mhchem-DtR62fUK.js"),__vite__mapDeps([0,1]))}catch{}return Jp(t)})}function s$(e){const t=Promise.resolve(e).then(n=>{var o;return ec===t&&n?(ki=(o=Jp(n))!=null?o:n,ki):null}).catch(()=>null).finally(()=>{ec===t&&(ec=null)});return ec=t,Qu=!0,t}function Vce(e){I2=e,ki=null,Qu=!1,ec=null}function qce(e){Vce(f5)}function i$(){return typeof I2=="function"}function SVe(){var e;const t=I2;if(!t||t===f5)return null;if(ki)return ki;const n=d5();if(n)return ki=n,ki;if(Qu)return null;try{const o=t();return o?typeof o?.then=="function"?(s$(o),null):(ki=(e=Jp(o))!=null?e:o,ki):null}catch{return null}}function r$(){return E2(this,null,function*(){var e;const t=d5();if(t)return ki=t,ki;if(ki)return ki;if(ec)return ec;if(Qu)return null;const n=I2;if(!n)return Qu=!0,null;try{const o=n();if(typeof o?.then=="function")return s$(o);if(o)return ki=(e=Jp(o))!=null?e:o,Qu=!0,ki}catch{}return Qu=!0,null})}function l$(e){return e?e.replace(/·/g,"⋅").replace(/℃/g,"°C"):""}let Ha=null,Na=null;const Ws=new Map,ea=new Map;let Lp=5;const uc=new Set;function Gf(){if(Ws.size{const{id:n,html:o,error:s}=t.data,i=Ws.get(n);if(i)if(Ws.delete(n),clearTimeout(i.timeoutId),i.cleanup(),Gf(),s)i.aborted||i.reject(new Error(s));else{const{content:r,displayMode:l}=t.data;if(r){const a=`${l?"d":"i"}:${r}`;if(ea.set(a,o),ea.size>200){const u=ea.keys().next().value;ea.delete(u)}}i.aborted||i.resolve(o)}},Ha.onerror=t=>{console.error("[katexWorkerClient] Worker error:",t);for(const[n,o]of Ws.entries())clearTimeout(o.timeoutId),o.cleanup(),o.aborted||o.reject(new Error(`Worker error: ${t.message}`));Ws.clear(),a$()}}function Zce(){var e;for(const t of Ws.values())clearTimeout(t.timeoutId),t.cleanup(),t.aborted||t.reject(new Error("Worker cleared"));Ws.clear(),a$(),Ha&&((e=Ha.terminate)==null||e.call(Ha)),Ha=null,Na=null}function Gce(e,t=!0,n=2e3,o){return E2(this,null,function*(){performance.now();const s=l$(e);if(!i$()){const a=new Error("KaTeX rendering disabled");return a.name="KaTeXDisabled",a.code="KATEX_DISABLED",Promise.reject(a)}if(Na)return Promise.reject(Na);const i=`${t?"d":"i"}:${s}`,r=ea.get(i);if(r)return Gf(),Promise.resolve(r);const l=Ha||(Na=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Na.name="WorkerInitError",Na.code="WORKER_INIT_ERROR",null);if(!l)return Promise.reject(Na);if(Ws.size>=Lp){const a=new Error("Worker busy");return a.name="WorkerBusy",a.code="WORKER_BUSY",a.busy=!0,a.inFlight=Ws.size,a.max=Lp,Promise.reject(a)}return new Promise((a,u)=>{if(o?.aborted){const v=new Error("Aborted");return v.name="AbortError",void u(v)}const c=Math.random().toString(36).slice(2);let d=null;const f=globalThis.setTimeout(()=>{const v=Ws.get(c);if(!v)return;Ws.delete(c),v.cleanup();const k=new Error("Worker render timed out");k.name="WorkerTimeout",k.code="WORKER_TIMEOUT",v.aborted||v.reject(k),Gf()},n);d=()=>{const v=Ws.get(c);if(!v||v.aborted)return;v.aborted=!0,v.cleanup();const k=new Error("Aborted");k.name="AbortError",u(k)},o&&o.addEventListener("abort",d,{once:!0});const h=a,m=u;Ws.set(c,{resolve:v=>{h(v)},reject:v=>{m(v)},timeoutId:f,aborted:!1,cleanup:()=>{o&&d&&o.removeEventListener("abort",d),d=null}});try{l.postMessage({id:c,content:s,displayMode:t})}catch(v){const k=Ws.get(c);Ws.delete(c),clearTimeout(f),k?.cleanup(),k?.reject(v),Gf()}})})}function AVe(e,t=!0,n){const o=`${t?"d":"i"}:${l$(e)}`;if(ea.set(o,n),ea.size>200){const s=ea.keys().next().value;ea.delete(s)}}const Yce="WORKER_BUSY";function Xce(e=2e3,t){return Ws.size{let s,i=!1,r=null,l=()=>{};const a=()=>{s&&globalThis.clearTimeout(s),uc.delete(l),t&&r&&t.removeEventListener("abort",r),r=null};l=()=>{i||(i=!0,a(),n())},uc.add(l),s=globalThis.setTimeout(()=>{if(i)return;i=!0,a();const u=new Error("Wait for worker slot timed out");u.name="WorkerBusyTimeout",u.code="WORKER_BUSY_TIMEOUT",o(u)},e),queueMicrotask(()=>Gf()),t&&(r=()=>{if(i)return;i=!0,a();const u=new Error("Aborted");u.name="AbortError",o(u)},t.aborted?r():t.addEventListener("abort",r,{once:!0}))})}const sf={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function MVe(e){return E2(this,arguments,function*(t,n=!0,o={}){var s,i,r,l;if(!i$()){const v=new Error("KaTeX rendering disabled");throw v.name="KaTeXDisabled",v.code="KATEX_DISABLED",v}const a=(s=o.timeout)!=null?s:sf.timeout,u=(i=o.waitTimeout)!=null?i:sf.waitTimeout,c=(r=o.backoffMs)!=null?r:sf.backoffMs,d=(l=o.maxRetries)!=null?l:sf.maxRetries,f=Number.isFinite(d)?Math.max(0,Math.min(Math.floor(d),8)):sf.maxRetries,h=o.signal;let m=0;for(;;){if(h?.aborted){const v=new Error("Aborted");throw v.name="AbortError",v}try{return yield Gce(t,n,a,h)}catch(v){if(v?.code!==Yce||m>=f)throw v;if(m++,yield Xce(u,h).catch(()=>{}),h?.aborted){const k=new Error("Aborted");throw k.name="AbortError",k}c>0&&(yield new Promise(k=>globalThis.setTimeout(k,c*m)))}}})}function Md(e){const t=typeof e=="number"?e:Number.parseFloat(String(e??""));return Number.isFinite(t)&&t>0?t:null}function Jce(e){var t;for(const n of e.split(/\r?\n/)){const o=n.trim();if(!o||o.startsWith("%%"))continue;const s=o.match(/^([A-Z][\w-]*)\b/i);return((t=s?.[1])==null?void 0:t.toLowerCase())||""}return""}function ig(e){const t=e.split(/\r?\n/).map(s=>s.trim()).filter(s=>s&&!s.startsWith("%%")),n=Math.max(1,t.length),o=Jce(e);return o==="gantt"?220+28*n:o==="sequencediagram"?180+26*n:o==="classdiagram"||o==="statediagram"||o==="erdiagram"?180+24*n:o==="flowchart"||o==="graph"?170+28*n:200+22*n}function rg(e){const t=e.split(/\r?\n/).filter(n=>/^\s*-\s+/.test(n)).length;return t>=3?500:t>0?280+60*t:360}function u$(e,t=360,n=500){return n==null?Math.max(t,e):Math.min(Math.max(t,e),n)}function lg(e,t=360,n=500){return u$(e,t,n)}function ag(e,t=360,n=500){return u$(e,t,n)}var Qce=Object.defineProperty,ede=Object.defineProperties,tde=Object.getOwnPropertyDescriptors,h_=Object.getOwnPropertySymbols,nde=Object.prototype.hasOwnProperty,ode=Object.prototype.propertyIsEnumerable,m_=(e,t,n)=>t in e?Qce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,c$=(e,t)=>{for(var n in t||(t={}))nde.call(t,n)&&m_(e,n,t[n]);if(h_)for(var n of h_(t))ode.call(t,n)&&m_(e,n,t[n]);return e},g_=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const ug=()=>jo(()=>import("./mermaid.core-CsZwh_jB.js").then(e=>e.bp),__vite__mapDeps([2,3]));let Ul=null,Td=ug,xf=null,X3=!1,J3=!1,Sf=0;function sde(e){Td=e,Sf++,Ul=null,xf=null,X3=!1,J3=!1}function ide(e){sde(ug)}function v_(){return typeof Td=="function"}function y_(e){if(!e)return e;const t=e&&e.default?e.default:e;if(t&&(typeof t.render=="function"||typeof t.parse=="function"||typeof t.initialize=="function"))return t;if(t&&t.mermaidAPI&&(typeof t.mermaidAPI.render=="function"||typeof t.mermaidAPI.parse=="function")){const s=t.mermaidAPI;return n=c$({},t),o={render:s.render.bind(s),parse:s.parse?s.parse.bind(s):void 0,initialize:i=>typeof t.initialize=="function"?t.initialize(i):s.initialize?s.initialize(i):void 0},ede(n,tde(o))}var n,o;return e.mermaid&&typeof e.mermaid.render=="function"?e.mermaid:t}function k_(e){if(e)try{const t=e?.initialize;e.initialize=n=>{const o=c$({suppressErrorRendering:!0},n||{});return typeof t=="function"?t.call(e,o):e?.mermaidAPI&&typeof e.mermaidAPI.initialize=="function"?e.mermaidAPI.initialize(o):void 0}}catch{}}function TVe(){return g_(this,null,function*(){if(Ul)return Ul;const e=(function(){try{const o=globalThis;return y_(o?.mermaid)}catch{return null}})();if(e)return Ul=e,k_(Ul),Ul;const t=Td,n=Sf;return t?t===ug&&X3?null:xf||(xf=g_(null,null,function*(){let o;try{o=yield t()}catch(s){if(t===ug)return n===Sf&&t===Td&&(X3=!0,(function(i){J3||(J3=!0,console.warn('[markstream-vue] Optional dependency "mermaid" is not installed. Mermaid blocks will render as source.',i))})(s)),null;throw s}finally{n===Sf&&t===Td&&(xf=null)}return n!==Sf||t!==Td?null:o?(Ul=y_(o),k_(Ul),Ul):null}),xf):null})}let Oi=null,Fa=null;const Dr=new Map,Uu=new Map;function Jh(e){for(const t of Dr.values())t.reject(e);Dr.clear(),Uu.clear()}let b_=5,C_=!1;const rde="WORKER_BUSY",w_="MERMAID_DISABLED";function lde(e){if(Oi&&Oi!==e){const n=new Error("Worker replaced");n.code="WORKER_REPLACED",Jh(n)}Oi=e,Fa=null;const t=e;Oi.onmessage=n=>{if(Oi!==t)return;const{id:o,ok:s,result:i,error:r}=n.data,l=Dr.get(o);l&&(s===!1||r?l.reject(new Error(r||"Unknown error")):l.resolve(i))},Oi.onerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker error:",n?.message||n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker error:",n?.message||n)}catch{}Jh(new Error(`Worker error: ${n.message}`))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker error (no pending):",n?.message||n)},Oi.onmessageerror=n=>{var o,s;if(Oi===t)if(Dr.size!==0){try{C_?console.error("[mermaidWorkerClient] Worker messageerror:",n):(s=console.debug)==null||s.call(console,"[mermaidWorkerClient] Worker messageerror:",n)}catch{}Jh(new Error("Worker messageerror"))}else(o=console.debug)==null||o.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",n)}}function ade(){var e;if(Oi)try{Jh(new Error("Worker cleared")),(e=Oi.terminate)==null||e.call(Oi)}catch{}Oi=null,Fa=null}function d$(e,t,n,o){if(!v_()){const r=new Error("Mermaid rendering disabled");return r.name="MermaidDisabled",r.code=w_,Promise.reject(r)}const s=`${e}\0${t.theme}\0${n}\0${t.code}`;let i=Uu.get(s);return i||(i=(function(r,l,a=1400){if(!v_()){const c=new Error("Mermaid rendering disabled");return c.name="MermaidDisabled",c.code=w_,Promise.reject(c)}if(Fa)return Promise.reject(Fa);const u=Oi||(Fa=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),Fa.name="WorkerInitError",Fa.code="WORKER_INIT_ERROR",null);if(!u)return Promise.reject(Fa);if(Dr.size>=b_){const c=new Error("Worker busy");return c.name="WorkerBusy",c.code=rde,c.inFlight=Dr.size,c.max=b_,Promise.reject(c)}return new Promise((c,d)=>{const f=Math.random().toString(36).slice(2);let h,m=!1;const v=()=>{m||(m=!0,h!=null&&globalThis.clearTimeout(h),Dr.delete(f))},k={resolve:w=>{v(),c(w)},reject:w=>{v(),d(w)}};Dr.set(f,k);try{u.postMessage({id:f,action:r,payload:l})}catch(w){return Dr.delete(f),void d(w)}h=globalThis.setTimeout(()=>{const w=new Error("Worker call timed out");w.name="WorkerTimeout",w.code="WORKER_TIMEOUT";const b=Dr.get(f);b&&b.reject(w)},a)})})(e,t,n),Uu.set(s,i),i.then(()=>{Uu.get(s)===i&&Uu.delete(s)},()=>{Uu.get(s)===i&&Uu.delete(s)})),(function(r,l){if(!l)return r;if(l.aborted){const a=new Error("Aborted");return a.name="AbortError",Promise.reject(a)}return new Promise((a,u)=>{let c=()=>{};const d=()=>l.removeEventListener("abort",c);c=()=>{d();const f=new Error("Aborted");f.name="AbortError",u(f)},l.addEventListener("abort",c,{once:!0}),r.then(f=>{d(),a(f)},f=>{d(),u(f)})})})(i,o)}function EVe(e,t,n=1400,o){return d$("canParse",{code:e,theme:t},n,o)}function IVe(e,t,n=1400,o){return d$("findPrefix",{code:e,theme:t},n,o)}var ude=Object.defineProperty,cde=Object.defineProperties,dde=Object.getOwnPropertyDescriptors,__=Object.getOwnPropertySymbols,fde=Object.prototype.hasOwnProperty,pde=Object.prototype.propertyIsEnumerable,x_=(e,t,n)=>t in e?ude(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,mt=(e,t)=>{for(var n in t||(t={}))fde.call(t,n)&&x_(e,n,t[n]);if(__)for(var n of __(t))pde.call(t,n)&&x_(e,n,t[n]);return e},rn=(e,t)=>cde(e,dde(t)),mo=(e,t,n)=>new Promise((o,s)=>{var i=a=>{try{l(n.next(a))}catch(u){s(u)}},r=a=>{try{l(n.throw(a))}catch(u){s(u)}},l=a=>a.done?o(a.value):Promise.resolve(a.value).then(i,r);l((n=n.apply(e,t)).next())});const hde="__global__",q9="__MARKSTREAM_VUE_CUSTOM_COMPONENTS_STORE__",Q3=(()=>{const e=globalThis;if(e[q9])return e[q9];const t={scopedCustomComponents:{},revision:Xr(0)};return e[q9]=t,t})(),S_=Q3.revision,mde=Symbol("markstreamCustomComponents"),gde=new Set(["text","paragraph","heading","code_block","list","list_item","blockquote","table","table_row","table_cell","definition_list","definition_item","footnote","footnote_reference","footnote_anchor","admonition","hardbreak","link","image","thematic_break","math_inline","math_block","strong","emphasis","strikethrough","highlight","insert","subscript","superscript","emoji","checkbox","checkbox_input","inline_code","html_inline","html_block","reference","mermaid","infographic","d2","vmr_container"]);function Qp(e){return gde.has(String(e).trim().toLowerCase())}function vde(e){return e.trim().replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[_\s]+/g,"-").toLowerCase()}function K9(e={}){const t={};for(const[n,o]of Object.entries(e))if(o!=null){t[n]=o;for(const s of new Set([Sr(n),Sr(vde(n))]))!s||Qp(s)||Object.prototype.hasOwnProperty.call(t,s)||(t[s]=o)}return t}function fs(e){const t=nn(mde,null);return R(()=>{var n;return S_.value,(function(o,s={}){return S_.value,mt(mt(mt({},K9(Q3.scopedCustomComponents[hde]||{})),K9(s)),K9((function(i){return i&&Q3.scopedCustomComponents[i]||{}})(o)))})(e?.(),(n=t?.value)!=null?n:{})})}const yde=["aria-label"],kde={key:0,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-unchecked"},bde={key:1,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",class:"checkbox-icon checkbox-checked"},Gn=(e,t)=>{const n=e.__vccOpts||e;for(const[o,s]of t)n[o]=s;return n},nr=Gn(et({__name:"CheckboxNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",{class:"checkbox-node",role:"img","aria-label":e.node.checked?"checked":"unchecked"},[e.node.checked?(y(),M("svg",bde,[...n[1]||(n[1]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",fill:"currentColor"},null,-1),C("path",{d:"M9 12l2 2 4-4",stroke:"hsl(var(--ms-background))","stroke-width":"2.5","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(y(),M("svg",kde,[...n[0]||(n[0]=[C("rect",{x:"3",y:"3",width:"18",height:"18",rx:"4",stroke:"currentColor","stroke-width":"2"},null,-1)])]))],8,yde))}),[["__scopeId","data-v-be21ab83"]]);nr.install=e=>{e.component(nr.__name,nr)};const Cde={class:"emoji-node"},zi=Gn(et({__name:"EmojiNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("span",Cde,N(e.node.name),1))}),[["__scopeId","data-v-de55dc97"]]);zi.install=e=>{e.component(zi.__name,zi)};const wde=["id"],_de=["title"],or=Gn(et({__name:"FootnoteReferenceNode",props:{node:{}},setup(e){const t=`#fnref--${e.node.id}`;function n(){if(typeof document>"u")return;const o=document.querySelector(t);o?o.scrollIntoView({behavior:"smooth"}):console.warn(`Element with href: ${t} not found`)}return(o,s)=>(y(),M("sup",{id:`fnref-${e.node.id}`,class:"footnote-reference",onClick:n},[C("span",{href:t,title:`查看脚注 ${e.node.id}`,class:"footnote-link cursor-pointer"},"["+N(e.node.id)+"]",9,_de)],8,wde))}}),[["__scopeId","data-v-c1463a29"]]);or.install=e=>{e.component(or.__name,or)};const f$=(()=>{try{return!1}catch{}return!1})();function Z9(e){f$&&console.warn(e)}function A_(e,t="safe",n){return u5(e,t,n)}function p$(e){return oce(e)}function G9(e){return e===!0?"":e===!1?"false":e==null?null:String(e)}function p5(e,t="safe"){const n=String(e.tag||e.type||"").trim(),o=Xh((s=e.attrs)?Array.isArray(s)?s.every(Array.isArray)?s.map(([r,l])=>[String(r),G9(l)]):s.filter(r=>r&&typeof r=="object"&&!Array.isArray(r)&&"name"in r).map(r=>[String(r.name),G9(r.value)]):Object.entries(s).map(([r,l])=>[r,G9(l)]):null,t,n);var s;if(!o)return;const i=p$(Zf(o));return Object.keys(i).length>0?i:void 0}function M_(e,t,n=!1){const o=Object.entries(t??{}),s=o.length>0?o.map(([i,r])=>r===""?` ${i}`:` ${i}="${r}"`).join(""):"";return n?`<${e}${s} />`:`<${e}${s}>`}function rf(e,t){Array.isArray(t)?e.push(...t):t!=null&&e.push(t)}function Y9(e,t,n,o,s,i,r=!1){const l=(function(d,f){return YL(d,f)})(e,o);if(Zp.has(e.toLowerCase())||!l&&qL(e,i))return null;if(!l&&a5(e,i))return r?[M_(e,t,!0)]:[M_(e,t),...n,``];const a=u5(t,i,e),u=a.key,c=u!=null&&u!==""?u:s;if(l){const d=o[e]||o[e.toLowerCase()],f=p$(a);return tn(d,rn(mt({},f),{key:c}),n.length>0?n:void 0)}return tn(e,rn(mt({},a),{innerHTML:void 0,key:c}),n.length>0?n:void 0)}function h$(e,t){return rce(e,t)}function cg(e,t,n="safe"){if(!e)return[];try{return(function(i,r,l="safe"){let a=0;const u=[],c=[];for(const d of i)if(d.type==="text")(u.length>0?u[u.length-1].children:c).push(d.content);else if(d.type==="self_closing"){const f=Y9(d.tagName,d.attrs||{},[],r,"ms-html-"+a++,l,!0);rf(u.length>0?u[u.length-1].children:c,f)}else if(d.type==="tag_open")u.push({tagName:d.tagName,children:[],attrs:d.attrs,autoKey:"ms-html-"+a++});else if(d.type==="tag_close"){const f=d.tagName.toLowerCase();let h=-1;for(let m=u.length-1;m>=0;m--)if(u[m].tagName.toLowerCase()===f){h=m;break}if(h!==-1)for(;u.length>h;){const m=u.pop(),v=Y9(m.tagName,m.attrs||{},m.children,r,m.autoKey,l);u.length>0?rf(u[u.length-1].children,v):rf(c,v),m.tagName.toLowerCase()!==f&&u.length>h&&Z9(`Auto-closing unclosed tag: <${m.tagName}>`)}else Z9(`Ignoring closing tag with no matching opening tag: `)}for(;u.length>0;){const d=u.pop(),f=Y9(d.tagName,d.attrs||{},d.children,r,d.autoKey,l);u.length>0?rf(u[u.length-1].children,f):rf(c,f),Z9(`Auto-closing unclosed tag: <${d.tagName}>`)}return c})(XL(e),t,n)}catch(s){return o=s,f$&&console.error("Failed to parse HTML to VNodes:",o),null}var o}const xde=["innerHTML"],sr=Gn(et({__name:"HtmlInlineNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=R(()=>{var l,a;return(a=(l=t.htmlPolicy)!=null?l:n?.value)!=null?a:"safe"}),s=fs(()=>t.customId),i=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),r=R(()=>{const l=t.node.content;if(!l)return{mode:"html",content:""};if(o.value==="escape")return{mode:"html",content:jd(l,o.value)};if(t.node.loading&&!t.node.autoClosed)return{mode:"text",content:l};if(t.node.loading&&t.node.autoClosed){const u=cg(l,s.value,o.value);if(u!==null)return{mode:"dynamic",nodes:u}}if(!h$(l,s.value))return{mode:"html",content:jd(l,o.value)};const a=cg(l,s.value,o.value);return a===null?{mode:"html",content:jd(l,o.value)}:{mode:"dynamic",nodes:a}});return(l,a)=>r.value.mode==="dynamic"?(y(),M("span",{key:0,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},[j(p(i),{nodes:r.value.nodes},null,8,["nodes"])],2)):r.value.mode==="text"?(y(),M("span",{key:1,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}])},N(r.value.content),3)):(y(),M("span",{key:2,class:Re(["html-inline-node",{"html-inline-node--loading":t.node.loading}]),innerHTML:r.value.content},null,10,xde))}}),[["__scopeId","data-v-d17f12b0"]]);sr.install=e=>{e.component(sr.__name,sr)};const Sde={class:"inline-code"},Ade={key:0},li=Gn(et({__name:"InlineCodeNode",props:{node:{}},setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const b=n.fade;return b===""||b===!0||b==="true"||b!==!1&&b!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var b;return String((b=t.node.code)!=null?b:"")}),u=R(()=>!l.value),c=R(()=>{var b;const _=(b=n["index-key"])!=null?b:n.indexKey;return _==null||_===""?"":String(_)}),d=Z(t.node.code),f=Z(""),h=Z(0);let m;function v(){m?.(),m=void 0}function k(){v(),f.value&&(d.value=d.value+f.value,f.value="")}Je([()=>t.node.code,c,l],([b])=>{const _=String(b??""),g=c.value,x=t$({nextContent:_,persistedContent:g?s?.get(g):void 0,currentState:{settledContent:d.value,streamedDelta:f.value},typewriterEnabled:l.value});d.value=x.settledContent,f.value=x.streamedDelta,x.appended?(h.value+=1,(function(){if(!f.value||m||!i)return;const S=i.value;m=Je(()=>i.value,T=>{T!==S&&k()},{flush:"sync"})})()):f.value||v(),g&&s?.set(g,_)},{immediate:!0}),d1(v);const w=R(()=>h.value%2==0?"inline-code-stream-delta--a":"inline-code-stream-delta--b");return(b,_)=>(y(),M("code",Sde,[u.value?(y(),M(Pe,{key:0},[qe(N(a.value),1)],64)):(y(),M(Pe,{key:1},[d.value?(y(),M("span",Ade,N(d.value),1)):ee("",!0),f.value?(y(),M("span",{key:1,class:Re(["inline-code-stream-delta",[w.value]]),onAnimationend:k},N(f.value),35)):ee("",!0)],64))]))}}),[["__scopeId","data-v-4e331c97"]]);li.install=e=>{e.component(li.__name,li)};const e8=Z(!1),T_=Z(""),E_=Z("top"),Yf=Z(null),Xf=Z(null),t8=Z(null),n8=Z(null),I_=Z(null);let Qh=null,em=null,o8=0;function m$(){Qh&&(clearTimeout(Qh),Qh=null),em&&(clearTimeout(em),em=null)}let bh=!1,Ch=null,L_=!1;function Mde(e,t,n="top",o=!1,s,i){if(!e)return;const r=++o8;m$();const l=()=>mo(null,null,function*(){var a,u;if(yield(function(){return mo(this,null,function*(){if(!bh&&!L_&&typeof document<"u"){Ch!=null||(Ch=mo(null,null,function*(){const[{createApp:c,h:d},{default:f}]=yield Promise.all([jo(()=>import("./vue.runtime.esm-bundler-D20WEMcO.js"),[]),jo(()=>import("./Tooltip-BCySsRbJ.js"),[])]),h=document.createElement("div");h.setAttribute("data-singleton-tooltip","1"),document.body.appendChild(h),c({setup:()=>()=>{var m;return d(f,{visible:e8.value,"anchor-el":Yf.value,content:T_.value,placement:E_.value,id:Xf.value,originX:t8.value,originY:n8.value,isDark:(m=I_.value)!=null?m:void 0})}}).mount(h),bh=!0}));try{yield Ch}catch(c){bh=!1,Ch=null,L_=!0,console.warn("[markstream-vue] Failed to mount Tooltip component. Tooltips will be disabled.",c)}}})})(),bh&&r===o8){Xf.value=`tooltip-${Date.now()}-${Math.floor(1e3*Math.random())}`,Yf.value=e,T_.value=t,E_.value=n,t8.value=(a=s?.x)!=null?a:null,n8.value=(u=s?.y)!=null?u:null,I_.value=typeof i=="boolean"?i:null,e8.value=!0;try{e.setAttribute("aria-describedby",Xf.value)}catch{}}});o?l():Qh=setTimeout(l,80)}function Tde(e=!1){o8+=1,m$();const t=()=>{if(Yf.value&&Xf.value)try{Yf.value.removeAttribute("aria-describedby")}catch{}e8.value=!1,Yf.value=null,Xf.value=null,t8.value=null,n8.value=null};e?t():em=setTimeout(t,120)}const Ede={"common.copy":"Copy","common.copied":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.minimize":"Minimize","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."},Ide=Symbol("markstreamI18nFallback");function g$(e,t){var n;return(n=t?.[e])!=null?n:Ede[e]}const s8=(e,t)=>{var n;return(n=g$(e,t))!=null?n:(function(o){return(o.split(".").pop()||o).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,s=>s.toUpperCase()).trim()})(e)};function $_(e,t){return{t(n){const o=g$(n,t);if(e.te&&o!=null&&!e.te(n))return s8(n,t);const s=e.t(n);return s===n&&o!=null?s8(n,t):s}}}function Lde(){const e=(function(){var n,o,s;try{const i=ds(),r=Ide,l=i?.provides,a=(n=i?.appContext)==null?void 0:n.provides;return(s=(o=l?.[r])!=null?o:a?.[r])!=null?s:null}catch{}return null})(),t=(function(){var n,o;try{const s=ds(),i=s?.proxy,r=i?.$t;if(typeof r=="function"){const u=i?.$te;return{t:r.bind(i),te:typeof u=="function"?u.bind(i):void 0}}const l=(o=(n=s?.appContext)==null?void 0:n.config)==null?void 0:o.globalProperties,a=l?.$t;if(typeof a=="function"){const u=l?.$te;return{t:a.bind(l),te:typeof u=="function"?u.bind(l):void 0}}}catch{}return null})();if(t)return $_(t,e);try{const n=globalThis.$vueI18nUse||null;if(n&&typeof n=="function")try{const o=n();if(o&&typeof o.t=="function")return $_({t:o.t.bind(o),te:typeof o.te=="function"?o.te.bind(o):void 0},e)}catch{}}catch{}return{t:n=>s8(n,e)}}const v$=Symbol("ViewportPriority"),y$=Symbol("ViewportPriorityOptions"),k$=Symbol("OffscreenHeavyNodeDeferral"),$de=R(()=>!1),yc="400px";function h5(){return nn(y$,void 0)}function m5(){return nn(k$,$de)}function Nde(e,t){var n,o;const s=typeof window<"u"&&typeof document<"u",i=typeof t=="boolean"?Z(t):t,r=s?(n=window.requestIdleCallback)!=null?n:T=>window.setTimeout(()=>T({didTimeout:!0,timeRemaining:()=>0}),16):null,l=s?(o=window.cancelIdleCallback)!=null?o:T=>window.clearTimeout(T):null,a=new WeakMap;let u=1;const c=new Map,d=new Map,f=new Set;let h=null,m=null;function v(T){if(!T)return"viewport";let A=a.get(T);return A||(A=u++,a.set(T,A)),String(A)}function k(){if(h!=null){try{l?.(h)}catch{}h=null}}function w(T){if(T){const A=c.get(T);if(A&&!A.targets.size){try{A.io.disconnect()}catch{}c.delete(T)}}d.size||f.size||k()}function b(T){const A=d.get(T);if(!A)return;const E=c.get(A.bucketKey);if(!A.visible.value){A.visible.value=!0;try{A.resolve()}catch{}}try{E?.io.unobserve(T)}catch{}E?.targets.delete(T),d.delete(T),f.delete(T),w(A.bucketKey)}function _(){window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&r&&h==null&&f.size&&(h=r(()=>{h=null;const T=f.values().next().value;T&&(f.delete(T),b(T),f.size&&_())},{timeout:1200}))}function g(T,A){if(!s||typeof IntersectionObserver>"u")return null;const E=(function(H,O){var F,U,z;return{root:(F=e?.(H??null))!=null?F:null,rootMargin:(U=O?.rootMargin)!=null?U:yc,threshold:(z=O?.threshold)!=null?z:0}})(T,A),P=[v((D=E).root),D.rootMargin,D.threshold].join("\0");var D;const I=c.get(P);if(I)return{key:P,bucket:I};let $;try{$=new IntersectionObserver(H=>{for(const O of H)(O.isIntersecting||O.intersectionRatio>0)&&b(O.target)},{root:E.root,rootMargin:E.rootMargin,threshold:E.threshold})}catch{return null}const B={io:$,targets:new Map};return c.set(P,B),{key:P,bucket:B}}function x(){if(s&&i.value)for(const[T,A]of Array.from(d.entries())){const E=g(T,A.opts);if(!E){b(T);continue}if(E.key===A.bucketKey)continue;const P=A.bucketKey,D=c.get(P);try{D?.io.unobserve(T)}catch{}D?.targets.delete(T),A.bucketKey=E.key,E.bucket.targets.set(T,A),E.bucket.io.observe(T),w(P)}}Je(i,T=>{if(!T){for(const A of Array.from(d.keys()))b(A);k()}},{flush:"sync"});const S=(T,A)=>{const E=Z(!1);let P,D=!1;const I=new Promise(O=>{P=()=>{D||(D=!0,O())}}),$=()=>{const O=d.get(T);if(!O)return f.delete(T),void w();const F=c.get(O.bucketKey);try{F?.io.unobserve(T)}catch{}F?.targets.delete(T),d.delete(T),f.delete(T),w(O.bucketKey)};if(!s||!i.value)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const B=g(T,A);if(!B)return E.value=!0,P(),{isVisible:E,whenVisible:I,destroy:$};const H={resolve:P,visible:E,bucketKey:B.key,opts:A};return d.set(T,H),B.bucket.targets.set(T,H),B.bucket.io.observe(T),s&&m==null&&(m=window.requestAnimationFrame(()=>{m=null,x()})),A?.allowIdle!==!1&&(f.add(T),_()),{isVisible:E,whenVisible:I,destroy:$}};return S.refresh=x,Ln(v$,S),S}function g5(){var e,t;const n=nn(v$,void 0);if(n)return n;const o=new WeakMap,s=new Map,i=new Set;let r=null;const l=typeof window<"u"?(e=window.requestIdleCallback)!=null?e:h=>window.setTimeout(()=>h({didTimeout:!0,timeRemaining:()=>0}),16):null,a=typeof window<"u"?(t=window.cancelIdleCallback)!=null?t:h=>window.clearTimeout(h):null,u=()=>{if(r!=null){try{a?.(r)}catch{}r=null}},c=h=>{if(!h)return;const m=s.get(h);if(m&&!m.targets.size){try{m.io.disconnect()}catch{}s.delete(h)}},d=h=>{const m=o.get(h);if(!m)return;const v=s.get(m.bucketKey);if(!m.visible.value){m.visible.value=!0;try{m.resolve()}catch{}}try{v?.io.unobserve(h)}catch{}o.delete(h),v?.targets.delete(h),i.delete(h),c(m.bucketKey),i.size||u()},f=()=>{window.__MARKSTREAM_DISABLE_VIEWPORT_PRIORITY_IDLE_DRAIN__!==!0&&l&&r==null&&i.size&&(r=l(()=>{r=null;const h=i.values().next().value;h&&(i.delete(h),d(h),i.size&&f())},{timeout:1200}))};return(h,m)=>{const v=Z(!1);let k,w=!1;const b=new Promise(x=>{k=()=>{w||(w=!0,x())}}),_=()=>{const x=o.get(h);if(!x)return i.delete(h),void(i.size||u());const S=s.get(x.bucketKey);try{S?.io.unobserve(h)}catch{}o.delete(h),S?.targets.delete(h),i.delete(h),c(x.bucketKey),i.size||u()},g=(x=>{var S,T;if(typeof window>"u"||typeof IntersectionObserver>"u")return null;const A=($=>{var B,H;return[(B=$?.rootMargin)!=null?B:yc,(H=$?.threshold)!=null?H:0].join("\0")})(x),E=s.get(A);if(E)return{key:A,bucket:E};const P=(S=x?.rootMargin)!=null?S:yc;let D;try{D=new IntersectionObserver($=>{for(const B of $)(B.isIntersecting||B.intersectionRatio>0)&&d(B.target)},{root:null,rootMargin:P,threshold:(T=x?.threshold)!=null?T:0})}catch{return null}const I={io:D,targets:new Set};return s.set(A,I),{key:A,bucket:I}})(m);return g?(o.set(h,{resolve:k,visible:v,bucketKey:g.key}),g.bucket.targets.add(h),g.bucket.io.observe(h),m?.allowIdle!==!1&&(i.add(h),f()),{isVisible:v,whenVisible:b,destroy:_}):(v.value=!0,k(),{isVisible:v,whenVisible:b,destroy:_})}}function Fde(e,t){var n,o;const s=(o=(n=e.indexKey)!=null?n:t["index-key"])!=null?o:t.indexKey;return s==null||s===""?"":String(s)}const Rde=["data-markstream-viewport-pending"],Ode=["src","alt","title","loading","fetchpriority","decoding","tabindex","aria-label"],Pde={key:1,class:"image-placeholder"},Dde={key:1,class:"image-node__raw-text"},Bde={key:2,class:"image-shimmer-overlay"},Hde={key:1,class:"image-node__raw-text"},zde={key:3,class:"image-error"},Va=Gn(et({__name:"ImageNode",props:{node:{},fallbackSrc:{default:""},lazy:{type:Boolean,default:!1},usePlaceholder:{type:Boolean,default:!0}},emits:["load","error","click"],setup(e,{emit:t}){var n,o,s;const i=e,r=t,l=Z(!1),a=Z(!1),u=Z(""),c=Z("primary"),d=Z(null),f=p1(),h=nn(G3,null),m=g5(),v=h5(),k=m5(),w=R(()=>nw(i.node.src)),b=R(()=>nw(i.fallbackSrc)),_=(s=(o=(n=ds())==null?void 0:n.vnode.el)==null?void 0:o.querySelector)==null?void 0:s.call(o,"img"),g=typeof window<"u"&&_?.getAttribute("src")===(w.value||b.value),x=Z(typeof window>"u"||g||!k.value),S=Xr(null);let T="",A=null;const E=R(()=>u.value),P=R(()=>!i.lazy),D=R(()=>typeof window<"u"&&k.value&&!g),I=R(()=>!D.value||x.value),$=R(()=>I.value?E.value:""),B=R(()=>{var de,pe;return(pe=(de=v?.value.heavyBlockMargin)!=null?de:v?.value.rootMargin)!=null?pe:yc}),H=R(()=>!i.node.loading&&c.value!=="failed"&&u.value.length>0),O=R(()=>c.value==="failed"),F=R(()=>(!P.value||D.value&&!x.value)&&!l.value&&!a.value&&c.value!=="failed"&&u.value.length>0),U=R(()=>Fde(i,f));function z(de=U.value){de&&d.value&&h?.reportHeight(de,d.value.offsetHeight)}function W(de=U.value){de&&yt(()=>{z(de)})}function K(){A&&(clearTimeout(A),A=null)}function V(){const de=U.value;de&&T!==de&&(T&&h?.markSettled(T),K(),T=de,h?.markPending(de),typeof window<"u"&&(A=window.setTimeout(()=>{T===de&&(W(de),ie())},8e3)))}function ie(){return mo(this,null,function*(){const de=T;de&&(K(),T="",yield yt(),z(de),h?.markSettled(de))})}function ne(){if(c.value==="primary"&&b.value&&b.value!==u.value)return c.value="fallback",u.value=b.value,l.value=!1,a.value=!1,void W();c.value="failed",a.value=!0,r("error",u.value),W()}function X(){l.value=!0,a.value=!1,r("load",E.value),W()}function le(de){de.preventDefault(),l.value&&!a.value&&r("click",[de,E.value])}const{t:Ie}=Lde();return Je([w,b,()=>i.node.loading],()=>(l.value=!1,a.value=!1,i.node.loading||w.value?(u.value=w.value,void(c.value="primary")):b.value?(u.value=b.value,void(c.value="fallback")):(u.value="",c.value="failed",void(a.value=!0))),{immediate:!0}),typeof window<"u"&&Je([d,D],([de,pe],ve,oe)=>{var ye;if((ye=S.value)==null||ye.destroy(),S.value=null,!pe||x.value)return void(x.value=!0);if(!de)return void(x.value=!1);let G=!0;const Y=m(de,{rootMargin:B.value,allowIdle:!1});S.value=Y,x.value=Y.isVisible.value,Y.whenVisible.then(()=>{G&&S.value===Y&&(x.value=!0)}),oe(()=>{G=!1,Y.destroy(),S.value===Y&&(S.value=null)})},{immediate:!0}),Je([H,l,a,E,()=>i.lazy,I],([de,pe,ve,oe,ye,G])=>de&&oe&&!ve&&G?pe?(ie(),void W()):ye?(V(),void W()):void(pe||ve||V()):(ie(),void W()),{flush:"post",immediate:!0}),Vn(()=>{var de;(de=S.value)==null||de.destroy(),S.value=null,(function(){const pe=T;pe&&(K(),T="",h?.markSettled(pe))})()}),(de,pe)=>{var ve,oe,ye,G,Y;return y(),M("span",{ref_key:"rootRef",ref:d,class:"image-node-container","data-markstream-viewport-pending":D.value&&!x.value?"true":void 0},[H.value?(y(),M("img",{key:0,src:$.value||void 0,alt:String((oe=(ve=i.node.alt)!=null?ve:i.node.title)!=null?oe:""),title:String((G=(ye=i.node.title)!=null?ye:i.node.alt)!=null?G:""),class:Re(["image-node__img",{"is-loading":!P.value&&!l.value,"is-loaded":P.value||l.value,"has-natural-size":l.value,"cursor-pointer":l.value}]),loading:i.lazy?"lazy":void 0,fetchpriority:P.value?"high":void 0,decoding:P.value?"sync":"async",tabindex:l.value?0:-1,"aria-label":(Y=i.node.alt)!=null?Y:p(Ie)("image.preview"),onError:ne,onLoad:X,onClick:le},null,42,Ode)):ee("",!0),e.node.loading&&!a.value?(y(),M("span",Pde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[0]||(pe[0]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Dde,N(e.node.raw),1))])):ee("",!0),F.value&&!e.node.loading?(y(),M("span",Bde,[i.usePlaceholder?xn(de.$slots,"placeholder",{key:0,node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[1]||(pe[1]=C("span",{class:"image-shimmer"},null,-1))],!0):(y(),M("span",Hde,N(e.node.raw),1))])):ee("",!0),O.value?(y(),M("span",zde,[xn(de.$slots,"error",{node:i.node,displaySrc:E.value,imageLoaded:l.value,hasError:a.value,fallbackSrc:i.fallbackSrc,lazy:i.lazy},()=>[pe[2]||(pe[2]=C("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24"},[C("path",{fill:"currentColor",d:"M2 2h20v10h-2V4H4v9.586l5-5L14.414 14L13 15.414l-4-4l-5 5V20h8v2H2zm13.547 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-3 1a3 3 0 1 1 6 0a3 3 0 0 1-6 0m3.625 6.757L19 17.586l2.828-2.829l1.415 1.415L20.414 19l2.829 2.828l-1.415 1.415L19 20.414l-2.828 2.829l-1.415-1.415L17.586 19l-2.829-2.828z"})],-1)),C("span",null,N(p(Ie)("image.loadError")),1)],!0)])):ee("",!0)],8,Rde)}}}),[["__scopeId","data-v-046e82ac"]]);Va.install=e=>{e.component(Va.__name,Va)};const Wde={key:2},El=et({__name:"NodeChildRenderer",props:{node:{},components:{},customId:{},indexKey:{},fallbackToText:{type:Boolean,default:!1}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamNestedRendererProps",void 0),i=R(()=>{var m;return(m=o?.value)!=null?m:"safe"}),r=R(()=>{var m,v;const k=(m=s?.value)!=null?m:{};return rn(mt({},k),{customId:(v=t.customId)!=null?v:k.customId,htmlPolicy:i.value})}),l=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),a=R(()=>t.components[String(t.node.type)]),u=R(()=>!!(a.value&&n.value[t.node.type]&&!Qp(String(t.node.type)))),c=R(()=>u.value?p5(t.node,i.value):void 0),d=R(()=>Array.isArray(t.node.children)&&t.node.children.length>0),f=R(()=>{var m;return String((m=t.node.content)!=null?m:"")}),h=R(()=>{var m,v;return String((v=(m=t.node.content)!=null?m:t.node.raw)!=null?v:"")});return(m,v)=>a.value&&u.value?(y(),he(bs(a.value),zn({key:0},c.value,{node:e.node,loading:e.node.loading,"index-key":e.indexKey,"custom-id":e.customId,"is-dark":r.value.isDark}),{default:me(()=>[d.value?(y(),he(p(l),zn({key:0},r.value,{nodes:e.node.children,"index-key":e.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):f.value?(y(),he(p(l),zn({key:1},r.value,{content:f.value,final:!e.node.loading,"index-key":`${e.indexKey||"child"}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:1},16,["node","loading","index-key","custom-id","is-dark"])):a.value?(y(),he(bs(a.value),{key:1,node:e.node,"custom-id":e.customId,"index-key":e.indexKey},null,8,["node","custom-id","index-key"])):e.fallbackToText?(y(),M("span",Wde,N(h.value),1)):ee("",!0)}}),N_=Object.freeze({enabled:!0,contextLineCount:2,minimumLineCount:4,revealLineCount:5});function Ude(e){var t;if(typeof e=="boolean")return e;if(e&&typeof e=="object"){const n=e;return rn(mt(mt({},N_),n),{enabled:(t=n.enabled)==null||t})}return mt({},N_)}function v5(e,t){if(e.renderSideBySide===!1)return!0;if(e.useInlineViewWhenSpaceIsLimited!==!0)return!1;const n=e.renderSideBySideInlineBreakpoint,o=typeof n=="number"&&Number.isFinite(n)?n:900;return t>0&&t<=o}function b$(e){var t,n;const o=(n=(t=String(e??"").split(/\r?\n/,1)[0])==null?void 0:t.trim())!=null?n:"";if(o.length<3)return"";const s=o[0];if(s!=="`"&&s!=="~"||o[1]!==s||o[2]!==s)return"";let i=3;for(;o[i]===s;)i+=1;return o.slice(i).trim()}function F_(e){var t;return((t=String(e??"").trim().split(/\s+/,1)[0])!=null?t:"")==="diff"}function jde(e){var t;return e.diff===!0||F_(e.language)||F_(b$(String((t=e.raw)!=null?t:"")))}function Vde(e,t,n){const o=(function(s){const i=b$(s);if(!i)return"";const r=i.split(/\s+/).filter(Boolean);if(!r.length)return"";const l=r[0]==="diff"?r.slice(1):r;for(const a of l){const u=a.includes(":")?a.slice(a.indexOf(":")+1):a;if(u&&/[./\\-]/.test(u))return u}return""})(e);return{title:o||t,caption:o?n?`Diff / ${t}`:t:""}}const qde=["aria-busy","aria-label","data-language","data-markstream-line-numbers"],Kde={key:0,translate:"no",class:"markstream-pre__diff-code"},Zde={class:"markstream-pre__diff-pane-content"},Gde={class:"markstream-pre__diff-number","aria-hidden":"true"},Yde={class:"markstream-pre__diff-content"},Xde={class:"markstream-pre__diff-content-inner"},Jde={key:0,class:"markstream-pre__line-numbers","aria-hidden":"true"},Qde=["textContent"],e1e=["textContent"],Pi=et({__name:"PreCodeNode",props:{node:{},loading:{type:Boolean},showLineNumbers:{type:Boolean},diffInline:{type:Boolean},diffHideUnchangedRegions:{type:[Boolean,Object]},reservedHeightPx:{}},setup(e){const t=e;function n(X,le){const Ie=String(X??"");return le?Ie:Ie.replace(/\r\n$|\n$|\r$/,"")}const o=R(()=>{var X,le,Ie;const de=String((le=(X=t.node)==null?void 0:X.language)!=null?le:"");return String((Ie=String(de).split(/\s+/g)[0])!=null?Ie:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}),s=R(()=>`language-${o.value}`),i=R(()=>{var X;return t.loading===!0||((X=t.node)==null?void 0:X.loading)===!0}),r=R(()=>{var X;return n((X=t.node)==null?void 0:X.code,i.value)});let l="",a=1;const u=R(()=>(function(X){let le=0,Ie=1;X.startsWith(l)&&(le=l.length,Ie=a,le>0&&X[le-1]==="\r"&&X[le]===` `&&le++);for(let de=le;der.value.split(/\r\n|\n|\r/));let d=0,f="";const h=R(()=>{const X=u.value;X{var X;return t.showLineNumbers===!0&&((X=t.node)==null?void 0:X.diff)===!0}),v=R(()=>m.value&&t.diffInline===!0),k=R(()=>{const X=Number(t.reservedHeightPx);if(!Number.isFinite(X)||X<=0)return;const le=`${Math.ceil(X)}px`;return i.value?{maxHeight:le,overflow:"auto"}:{height:le,minHeight:le,maxHeight:le,overflow:"auto"}}),w=["diff ","index ","--- ","+++ ","@@ "];function b(X){return String(X??"").trim().length===0}function _(X,le="context",Ie={}){const de=b(X);return{code:X,kind:de&&le!=="hunk"&&le!=="spacer"&&!Ie.preserveBlankKind?"context":le,empty:de}}function g(X){const le=n(X,i.value);return le?le.split(/\r\n|\n|\r/):[]}function x(X,le){return!b(X[le])||lew.some(Ie=>le.startsWith(Ie)))}function E(X,le){return le||!X.startsWith(" ")||X.startsWith(" ")?X:` ${X}`}function P(X,le){const Ie=X.length,de=le.length,pe=[];let ve=0;for(;ve=ve&&G>=ve&&X[ye]===le[G];)oe.unshift({originalIndex:ye,modifiedIndex:G}),ye--,G--;const Y=ye-ve+1,fe=G-ve+1;if(Y<=0||fe<=0||i.value||(Y+1)*(fe+1)>15e5)return pe.concat(oe);const we=fe+1,ge=new Uint32Array((Y+1)*(fe+1));for(let ue=Y-1;ue>=0;ue--)for(let Se=fe-1;Se>=0;Se--){const ze=ue*we+Se;if(X[ve+ue]===le[ve+Se])ge[ze]=ge[(ue+1)*we+Se+1]+1;else{const _e=ge[(ue+1)*we+Se],Ee=ge[ue*we+Se+1];ge[ze]=_e>=Ee?_e:Ee}}const Q=[];let te=0,ce=0;for(;te=ge[te*we+ce+1]?te++:ce++;return pe.concat(Q,oe)}function D(X){var le;const Ie=(function(){var G,Y;const fe=t.diffHideUnchangedRegions;if(fe==null||fe===!1)return null;const we=fe===!0?{}:fe;return we.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((G=we.contextLineCount)!=null?G:2)),minimumLineCount:Math.max(1,Math.floor((Y=we.minimumLineCount)!=null?Y:4))}})();if(!Ie||X.length<1||X.length>2||X.length===2&&X[0].lines.length!==X[1].lines.length)return X;const de=X[0].lines,pe=(le=X[1])==null?void 0:le.lines,ve=G=>de[G].kind==="context"&&(pe===void 0||pe[G].kind==="context"&&de[G].code===pe[G].code),oe=[];let ye=0;for(;ye=Ie.minimumLineCount){const fe=G+(G===0?0:Ie.contextLineCount),we=Y-(Y===de.length?0:Ie.contextLineCount);we-fe>=Ie.minimumLineCount&&oe.push({start:fe,end:we})}ye===G&&ye++}return oe.length?X.map((G,Y)=>{const fe=[];let we=0;for(const ge of oe)fe.push(...G.lines.slice(we,ge.start)),fe.push({code:Y===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${G.key}-collapsed-${ge.start}-${ge.end}`,number:""}),we=ge.end;return fe.push(...G.lines.slice(we)),rn(mt({},G),{lines:fe})}):X}const I=R(()=>{var X,le,Ie,de;if(!m.value)return[];const pe=(function(Y){const fe=Y.some(ge=>S(ge)),we=Y.some(ge=>T(ge));return fe&&we||(function(){var ge,Q,te,ce;if(o.value==="diff")return!0;const ue=(ce=(te=String((Q=(ge=t.node)==null?void 0:ge.raw)!=null?Q:"").split(/\r?\n/,1)[0])==null?void 0:te.trim())!=null?ce:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ue)})()&&(fe||we)})(c.value),ve=(function(){var Y,fe;return((Y=t.node)==null?void 0:Y.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(v.value){const Y=ve?(function(fe,we){const ge=g(fe),Q=g(we),te=P(ge,Q);if(te.length>0){const Ee=[];let it=0,Fe=0;for(const Oe of te){for(;it=ue&&ze>=ue&&ge[Se]===Q[ze];)_e.unshift(rn(mt({},_(Q[ze])),{key:`inline-suffix-${ze}`,number:ze+1})),Se--,ze--;for(let Ee=ue;Ee<=Se;Ee++)ce.push(rn(mt({},_(ge[Ee],"removed",{preserveBlankKind:x(ge,Ee)})),{key:`inline-removed-source-${Ee}`,number:Ee+1}));for(let Ee=ue;Ee<=ze;Ee++)ce.push(rn(mt({},_(Q[Ee],"added",{preserveBlankKind:x(Q,Ee)})),{key:`inline-added-source-${Ee}`,number:Ee+1}));return ce.concat(_e)})((X=t.node)==null?void 0:X.originalCode,(le=t.node)==null?void 0:le.updatedCode):(function(fe){const we=[];let ge=1,Q=1;const te=A(fe);for(const[ce,ue]of fe.entries())if(ue.startsWith("@@")){const Se=ue.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Se&&(ge=Number(Se[1]),Q=Number(Se[2])),we.push(rn(mt({},_(ue,"hunk")),{key:`inline-hunk-${ce}`,number:""}))}else if(S(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${ce}`,number:ge++}));else if(T(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"added",{preserveBlankKind:!0})),{key:`inline-added-${ce}`,number:Q++}));else{const Se=te&&ue.startsWith(" ")?ue.slice(1):ue;we.push(rn(mt({},_(Se)),{key:`inline-context-${ce}`,number:Q})),ge++,Q++}return we})(c.value);return D([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Y}])}if(!pe&&ve)return(function(Y,fe){const we=g(Y),ge=g(fe),Q=P(we,ge),te=[],ce=[];let ue=0,Se=0,ze=0;const _e=(Ee,it)=>{const Fe=Math.max(Ee-ue,it-Se);for(let Oe=0;Oern(mt({},Y),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:ye.map((Y,fe)=>rn(mt({},Y),{key:`modified-${fe}`,number:fe+1}))}])}),$=R(()=>I.value.some(X=>X.lines.some(le=>le.kind==="collapsed"))),B=R(()=>{const X=o.value;return X?`Code block: ${X}`:"Code block"}),H=Z(null),O=Z([]);let F=null,U=!1,z=null;function W(X){const le=Number.parseFloat(String(X??""));return Number.isFinite(le)&&le>0?le:0}function K(X,le){var Ie;if(!X)return le;if(X.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const de=X.querySelector(".markstream-pre__diff-content"),pe=de?.getBoundingClientRect(),ve=(Ie=pe?.height)!=null?Ie:0;return Math.max(le,Math.ceil(ve))}function V(){U||typeof window>"u"||(F!=null&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>{F=null,U||(function(){var X,le;F=null;const Ie=H.value;if(!Ie||!m.value||v.value||!Ie.classList.contains("is-wrap"))return void(O.value.length&&(O.value=[]));const de=(function(fe){const we=window.getComputedStyle(fe),ge=W(we.getPropertyValue("--markstream-pre-diff-line-height"));if(ge>0)return ge;const Q=W(we.lineHeight);return Q>0?Q:18})(Ie),pe=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),ve=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),oe=Math.max(pe.length,ve.length),ye=[];for(let fe=0;fe{const ge=Y[we];return ge&&Math.abs(fe.rowHeight-ge.rowHeight)<=.5&&Math.abs(fe.originalHeight-ge.originalHeight)<=.5&&Math.abs(fe.modifiedHeight-ge.modifiedHeight)<=.5})||(O.value=ye)})()}))}function ie(X){z?.disconnect(),z=null,X&&m.value&&!v.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{V()}),z.observe(X))}function ne(X,le){const Ie=O.value[X];if(!Ie)return;const de=le==="original"?Ie.originalHeight:Ie.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(Ie.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(de)}px`}}return Je(H,X=>{ie(X),yt(()=>V())},{flush:"post"}),Je([m,v,I],()=>{ie(H.value),yt(()=>V())},{flush:"post",immediate:!0}),Vn(()=>{U=!0,F!=null&&(window.cancelAnimationFrame(F),F=null),z?.disconnect(),z=null}),(X,le)=>(y(),M("pre",{ref_key:"preRef",ref:H,style:Zt(k.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":m.value,"markstream-pre--diff-inline":v.value,"markstream-pre--diff-collapsed":$.value}]),"aria-busy":i.value,"aria-label":B.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[m.value?(y(),M("code",Kde,[(y(!0),M(Pe,null,pt(I.value,Ie=>(y(),M("span",{key:Ie.key,class:Re(["markstream-pre__diff-pane",Ie.className])},[C("span",Zde,[(y(!0),M(Pe,null,pt(Ie.lines,(de,pe)=>(y(),M("span",{key:de.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${de.kind}`,{"markstream-pre__diff-line--empty":de.empty}]]),style:Zt(ne(pe,Ie.key))},[le[0]||(le[0]=C("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),C("span",Gde,N(de.number),1),C("span",Yde,[C("span",Xde,N(de.code),1)])],6))),128))])],2))),128))])):(y(),M(Pe,{key:1},[t.showLineNumbers?(y(),M("span",Jde,[C("span",{class:"markstream-pre__line-numbers-text",textContent:N(h.value)},null,8,Qde)])):ee("",!0),C("code",{translate:"no",class:"markstream-pre__code",textContent:N(r.value)},null,8,e1e)],64))],14,qde))}});Pi.install=e=>{e.component(Pi.__name,Pi)};const t1e={key:0},qo=Gn(et({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const k=n.fade;return k===""||k===!0||k==="true"||k!==!1&&k!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var k;const w=(k=n["index-key"])!=null?k:n.indexKey;return w==null||w===""?"":String(w)}),u=Z(t.node.content),c=Z(""),d=Z(0);let f;function h(){f?.(),f=void 0}function m(){h(),c.value&&(u.value=u.value+c.value,c.value="")}Je([()=>t.node.content,a,l],([k])=>{const w=String(k??""),b=a.value,_=t$({nextContent:w,persistedContent:b?s?.get(b):void 0,currentState:{settledContent:u.value,streamedDelta:c.value},typewriterEnabled:l.value});u.value=_.settledContent,c.value=_.streamedDelta,_.appended?(d.value+=1,(function(){if(!c.value||f||!i)return;const g=i.value;f=Je(()=>i.value,x=>{x!==g&&m()},{flush:"sync"})})()):c.value||h(),b&&s?.set(b,w)},{immediate:!0}),d1(h);const v=R(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(k,w)=>(y(),M("span",{class:Re([[e.node.center?"text-node-center":""],"text-node"])},[u.value?(y(),M("span",t1e,N(u.value),1)):ee("",!0),c.value?(y(),M("span",{key:1,class:Re(["text-node-stream-delta",[v.value]]),onAnimationend:m},N(c.value),35)):ee("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function Af(e,t,n){return et({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=g5(),u=h5(),c=m5(),d=typeof window<"u"&&((l=(r=ds())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=Z(typeof window>"u"||d||!c.value),h=Xr(null);let m=null;function v(k){const w=k&&"$el"in k?k.$el:k;h.value=w instanceof HTMLElement?w:null}return typeof window<"u"&&Je([h,c],([k,w],b,_)=>{if(m?.destroy(),m=null,!w||f.value)return void(f.value=!0);if(!k)return;let g=!0;const x=a(k,{rootMargin:u?.value.heavyBlockMargin,allowIdle:!1});m=x,f.value=x.isVisible.value,x.whenVisible.then(()=>{g&&m===x&&(f.value=!0)}),_(()=>{g=!1,x.destroy(),m===x&&(m=null)})},{immediate:!0}),Vn(()=>{m?.destroy(),m=null}),()=>tn(f.value?t:n,rn(mt({},s),{ref:v}),i)}})}qo.install=e=>{e.component(qo.__name,qo)};const dg=et({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,u;const c=T2(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=p_[c]||(c?c.charAt(0).toUpperCase()+c.slice(1):p_[""]),f=jde(n.node),h=Vde(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),m=n.monacoOptions,v=f&&((l=n.estimatedDiffInline)!=null?l:v5(m??{},typeof window>"u"?0:window.innerWidth)),k=m?.diffAppearance,w=k==="dark"||k!=="light"&&n.isDark===!0,b=typeof m?.fontSize=="number"&&Number.isFinite(m.fontSize)&&m.fontSize>0?m.fontSize:12,_=typeof m?.lineHeight=="number"&&Number.isFinite(m.lineHeight)&&m.lineHeight>0?m.lineHeight:b===12?18:Math.max(12,Math.round(1.5*b)),g=typeof m?.tabSize=="number"&&Number.isFinite(m.tabSize)&&m.tabSize>0?m.tabSize:4,x=f?0:8,S=typeof((a=m?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(m.padding.top)&&m.padding.top>=0?m.padding.top:x,T=typeof((u=m?.padding)==null?void 0:u.bottom)=="number"&&Number.isFinite(m.padding.bottom)&&m.padding.bottom>=0?m.padding.bottom:x,A=typeof m?.fontFamily=="string"?m.fontFamily.trim():"",E=mt(mt({fontSize:`${b}px`,lineHeight:`${_}px`,tabSize:g,paddingTop:`${S}px`,paddingBottom:`${T}px`,"--markstream-pre-line-number-top":`${S}px`},f?{"--markstream-pre-diff-line-height":`${_}px`}:{}),A?{"--markstream-code-font-family":A}:{}),P=()=>tn("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[tn("svg",{class:"action-icon"})]),D=n.isShowPreview!==!1&&(c==="html"||c==="svg"),I=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||D&&n.showPreviewButton!==!1,$=H=>{if(H!=null)return typeof H=="number"?`${H}px`:String(H)},B=mt(mt(mt({"--markstream-code-layout-character-width":"1ch"},$(n.minWidth)?{minWidth:$(n.minWidth)}:{}),$(n.maxWidth)?{maxWidth:$(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return tn("div",rn(mt({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":w,"is-diff":f,"is-plain-text":c===""||c==="plaintext"||c==="text"},t.class],style:[B,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:tn("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[tn("div",{class:"code-header-main"},[tn("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),tn("div",{class:"code-header-copy"},[tn("div",{class:"code-header-title"},h.title),h.caption?tn("div",{class:"code-header-caption"},h.caption):null])]),tn("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?tn("div",{class:"code-diff-stats","aria-hidden":"true"},[tn("span",{class:"code-diff-stat removed"},"-0"),tn("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:P(),n.showCollapseButton===!1?null:P(),I?tn("div",{class:"relative"},[P()]):null])]),tn("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[tn(Pi,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:v,diffHideUnchangedRegions:f?Ude(m?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:E,"data-markstream-code-loading":"1"})]),tn("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[tn("div",{class:"loading-skeleton"},[tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line short"})])]),tn("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),X9=Af("ViewportDeferredCodeBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./CodeBlockNode-BAtAs_qm.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Pi}}),loadingComponent:dg,delay:0,suspensible:!1}),dg),Jr=zr(()=>mo(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield r$(),(yield jo(()=>import("./index7-BT2SBznQ.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),C$=zr(()=>mo(null,null,function*(){try{return yield r$(),(yield jo(()=>import("./index6-D4fZsFMu.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return tn(qo,rn(mt({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),xi=Gn(et({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(y(),M("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},N(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);xi.install=e=>{e.component(xi.__name,xi)};const n1e={class:"superscript-node"},Wi=Gn(et({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sup",n1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Wi.install=e=>{e.component(Wi.__name,Wi)};const o1e={class:"subscript-node"},Ui=Gn(et({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,superscript:Wi,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sub",o1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Ui.install=e=>{e.component(Ui.__name,Ui)};const s1e={class:"strong-node"},Si=Gn(et({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("strong",s1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Si.install=e=>{e.component(Si.__name,Si)};const i1e={class:"strikethrough-node"},Ai=Gn(et({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("del",i1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);Ai.install=e=>{e.component(Ai.__name,Ai)};const r1e=["href","title","aria-label","aria-hidden","target","rel"],l1e=["aria-hidden"],a1e={class:"link-text-wrapper relative inline-flex"},u1e={class:"leading-[normal] link-text"},Mi=Gn(et({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=nn("markstreamShowTooltips",void 0),o=R(()=>{const w=n?.value;return typeof w=="boolean"?w:t.showTooltip}),s=R(()=>{var w,b,_,g,x;const S=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",T=(w=t.animationOpacity)!=null?w:.35,A=Math.max(.12,Math.min(.5*T,T)),E={"--underline-height":`${(b=t.underlineHeight)!=null?b:2}px`,"--underline-bottom":S,"--underline-opacity":String(T),"--underline-rest-opacity":String(A),"--underline-duration":`${(_=t.animationDuration)!=null?_:1.6}s`,"--underline-timing":(g=t.animationTiming)!=null?g:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(x=t.animationIteration)!=null?x:"infinite"};return t.color&&(E["--link-color"]=t.color),E}),i=fs(()=>t.customId),r=R(()=>mt({text:qo,strong:Si,strikethrough:Ai,emphasis:Ti,image:Va,html_inline:sr,inline_code:li},i.value)),l=p1(),a=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.attrs;if(!_||typeof _!="object")return{};const g={};if(Array.isArray(_))for(const x of _)Array.isArray(x)&&x[0]&&(g[String(x[0])]=String((b=x[1])!=null?b:""));else for(const[x,S]of Object.entries(_))x&&S!=null&&S!==!1&&(g[x]=S===!0?"":String(S));return A_(g,"safe","a")}),u=R(()=>mt(mt({},l),a.value)),c=R(()=>{var w,b;return A_({href:String((b=(w=t.node)==null?void 0:w.href)!=null?b:"")},"safe","a").href}),d=R(()=>{if(!c.value)return;const w=u.value.target;return(typeof w=="string"?w.trim():String(w??"").trim())||(sie(c.value)?"_blank":void 0)}),f=R(()=>{var w;return String((w=d.value)!=null?w:"").trim().toLowerCase()==="_blank"}),h=R(()=>{if(!c.value)return;const w=u.value.rel,b=new Set((typeof w=="string"?w:String(w??"")).split(/\s+/).filter(Boolean)),_=new Set(Array.from(b).filter(g=>g.toLowerCase()!=="opener"));return f.value&&(_.add("noopener"),_.add("noreferrer")),_.size>0?Array.from(_).join(" "):void 0}),m=R(()=>{const w=mt({},u.value);return delete w.title,delete w.href,delete w.target,delete w.rel,w});function v(){o.value&&Tde()}const k=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.title;return typeof _=="string"&&_.trim().length>0?_:String((b=c.value)!=null?b:"")});return(w,b)=>{var _,g;return e.node.loading?(y(),M("span",zn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},p(l),{style:s.value}),[C("span",a1e,[C("span",u1e,[j(p(qo),{class:"leading-[normal] link-text",node:{type:"text",content:String((_=e.node.text)!=null?_:""),raw:String((g=e.node.text)!=null?g:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),b[1]||(b[1]=C("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,l1e)):(y(),M("a",zn({key:0,class:"link-node",href:c.value,title:o.value?"":k.value,"aria-label":`Link: ${k.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},m.value,{style:s.value,onMouseenter:b[0]||(b[0]=x=>(function(S){var T,A,E,P;if(!o.value)return;const D=S,I=D?.clientX!=null&&D?.clientY!=null?{x:D.clientX,y:D.clientY}:void 0,$=((T=t.node)==null?void 0:T.title)||((A=c.value)!=null&&A.includes("xn--")&&((P=(E=t.node)==null?void 0:E.text)!=null&&P.includes("://"))?t.node.text:c.value)||"";Mde(S.currentTarget,$,"top",!1,I)})(x)),onMouseleave:v}),[(y(!0),M(Pe,null,pt(e.node.children,(x,S)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${S}`,components:r.value,node:x,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${S}`},null,8,["components","node","custom-id","index-key"]))),128))],16,r1e))}}}),[["__scopeId","data-v-367e6ca4"]]);Mi.install=e=>{e.component(Mi.__name,Mi)};const c1e={class:"insert-node"},ji=Gn(et({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("ins",c1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);ji.install=e=>{e.component(ji.__name,ji)};const d1e={class:"highlight-node"},ir=Gn(et({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("mark",d1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);ir.install=e=>{e.component(ir.__name,ir)};const f1e={class:"emphasis-node"},Ti=Gn(et({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("em",f1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ti.install=e=>{e.component(Ti.__name,Ti)};const p1e={class:"hard-break"},qa=Gn(et({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("br",p1e))}),[["__scopeId","data-v-50c58f70"]]);qa.install=e=>{e.component(qa.__name,qa)};const $p=et({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=kt({checkbox:nr,checkbox_input:nr,emoji:zi,emphasis:Ti,hardbreak:qa,highlight:ir,inline_code:li,insert:ji,link:Mi,reference:xi,strikethrough:Ai,strong:Si,subscript:Ui,superscript:Wi,text:qo}),o=fs(()=>t.customId),s=R(()=>{const i=o.value;return Object.keys(i).length>0?mt(mt({},n),i):n});return(i,r)=>(y(!0),M(Pe,null,pt(e.nodes,(l,a)=>(y(),he(p(El),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function i8(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(i8)}function fg(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(i8))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(i8)?s:null}function kc(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const h1e=["cite"],m1e={key:0,dir:"auto",class:"paragraph-node"},g1e=["custom-id"],tm=Gn(et({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>!!n.value.paragraph),s=R(()=>!!n.value.text),i=R(()=>fg(t.node.children,!o.value)),r=R(()=>t.fade!==!1||s.value?null:kc(i.value));return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(l,a)=>(y(),M("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(y(),M("p",m1e,[r.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(r.value),9,g1e)):(y(),he(p($p),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(y(),he(p(Vi),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=u=>l.$emit("copy",u))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,h1e))}}),[["__scopeId","data-v-abfecebc"]]);tm.install=e=>{e.component(tm.__name,tm)};const v1e={class:"definition-list"},y1e={class:"definition-term"},k1e={class:"definition-desc"},nm=Gn(et({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("dl",v1e,[(y(!0),M(Pe,null,pt(t.node.items,(s,i)=>(y(),M(Pe,{key:i},[C("dt",y1e,[j(p(Vi),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),C("dd",k1e,[j(p(Vi),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);nm.install=e=>{e.component(nm.__name,nm)};const b1e=["href","title"],Jf=Gn(et({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(y(),M("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,b1e))}}),[["__scopeId","data-v-e1eb37b6"]]);Jf.install=e=>{e.component(Jf.__name,Jf)};const C1e=["id"],w1e={class:"flex-1"},om=et({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[C("div",w1e,[j(p(Vi),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,C1e))}});om.install=e=>{e.component(om.__name,om)};const _1e=["custom-id"],r8=Gn(et({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamFade",void 0),s=R(()=>o?.value!==!1||n.value.text?null:kc(t.node.children)),i=R(()=>mt({text:qo,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,footnote_reference:or,hardbreak:qa,math_inline:Jr,reference:xi},n.value));return(r,l)=>(y(),he(bs(`h${e.node.level}`),zn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:me(()=>[s.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(s.value),9,_1e)):(y(!0),M(Pe,{key:1},pt(e.node.children,(a,u)=>(y(),he(p(El),{key:u,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${u}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),L2=r8;L2.install=e=>{e.component(r8.__name,r8)};const x1e={key:0,dir:"auto",class:"paragraph-node"},S1e=["custom-id"],A1e={dir:"auto",class:"paragraph-node"},M1e=["custom-id"],Vd=Gn(et({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var h;return(h=t.node)!=null?h:t.item}),o=fs(()=>t.customId),s=R(()=>!!o.value.paragraph),i=R(()=>!!o.value.text),r=R(()=>{var h;return fg((h=n.value)==null?void 0:h.children,!s.value)}),l=R(()=>{var h;if(s.value)return null;const m=(h=n.value)==null?void 0:h.children;if(!Array.isArray(m)||m.length<2)return null;const v=m[0];if(v?.type!=="paragraph"||!Array.isArray(v.children))return null;const k=m.slice(1);if(!k.every(b=>b?.type==="list"))return null;const w=fg([v]);return w?{paragraphChildren:w,nestedLists:k}:null});function a(){return t.fade===!1&&!i.value}const u=R(()=>a()?kc(r.value):null),c=R(()=>{var h;return a()?kc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=R(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(h,m)=>{var v,k;return y(),M("li",zn({class:"list-item",dir:"auto"},f.value),[r.value?(y(),M("p",x1e,[u.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(u.value),9,S1e)):(y(),he(p($p),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(y(),M(Pe,{key:1},[C("p",A1e,[c.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(c.value),9,M1e)):(y(),he(p($p),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(y(!0),M(Pe,null,pt(l.value.nestedLists,(w,b)=>(y(),he(p(Vi),{key:b,nodes:[w],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${b}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:m[0]||(m[0]=_=>h.$emit("copy",_))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(y(),he(p(Vi),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(k=(v=n.value)==null?void 0:v.children)!=null?k:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:m[1]||(m[1]=w=>h.$emit("copy",w))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);Vd.install=e=>{e.component(Vd.__name,Vd)};const qd=Gn(et({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=fs(()=>e.customId),n=R(()=>t.value.list_item||Vd);return(o,s)=>(y(),he(bs(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:me(()=>[(y(!0),M(Pe,null,pt(e.node.items,(i,r)=>{var l;return y(),he(bs(n.value),zn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);qd.install=e=>{e.component(qd.__name,qd)};const T1e={key:2,class:"html-block-node__raw"},E1e=["innerHTML"],I1e={key:1,class:"html-block-node__placeholder"},Qf=Gn(et({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=nn("markstreamNestedRendererProps",void 0),s=R(()=>{var I,$;return($=(I=t.htmlPolicy)!=null?I:n?.value)!=null?$:"safe"}),i=R(()=>{var I,$;const B=(I=o?.value)!=null?I:{};return rn(mt({},B),{customId:($=t.customId)!=null?$:B.customId,htmlPolicy:s.value})}),r=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),l=R(()=>{const I=Xh(t.node.attrs,s.value);if(!I)return;const $=Zf(I);return Object.keys($).length>0?$:void 0}),a=R(()=>{const I=String(t.node.tag||"").trim(),$=Xh(t.node.attrs,s.value,I);if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),u=fs(()=>t.customId),c=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),f=Z(typeof window>"u"),h=Z(t.node.content),m=R(()=>Array.isArray(t.node.children)?t.node.children:[]),v=R(()=>String(t.node.tag||"div")),k=R(()=>{var I;if(v.value.trim().toLowerCase()!=="details"||(I=t.node.attrs)!=null&&I.some(([B])=>String(B).toLowerCase()==="open"))return null;const $=m.value[0];return $?.type==="html_block"&&String($.tag||"").toLowerCase()==="summary"?$:null}),w=R(()=>{var I;return kc((I=k.value)==null?void 0:I.children)}),b=R(()=>{const I=k.value;if(!I)return;const $=Xh(I.attrs,s.value,"summary");if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),_=R(()=>w.value==null?m.value:m.value.slice(1)),g=R(()=>{const I=v.value.trim().toLowerCase();return UI.has(I)||a5(I,s.value)}),x=R(()=>m.value.length>0&&!!t.node.tag&&!g.value),S=R(()=>{var I,$,B;if(x.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(I=h.value)!=null?I:""};const H=($=h.value)!=null?$:t.node.content;if(!H)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:jd(H,s.value)};if(t.node.loading){const F=cg(H,u.value,s.value);return F===null?{mode:"text",content:(B=t.node.raw)!=null?B:H}:{mode:"dynamic",nodes:F}}if(!h$(H,u.value))return{mode:"html",content:jd(H,s.value)};const O=cg(H,u.value,s.value);return O===null?{mode:"html",content:jd(H,s.value)}:{mode:"dynamic",nodes:O}}),T=g5(),A=h5(),E=m5(),P=Xr(null),D=!!t.node.loading;return typeof window<"u"?(Je([()=>d.value,()=>A?.value.heavyBlockMargin,()=>A?.value.rootMargin],([I],$,B)=>{var H,O,F,U;if((O=(H=P.value)==null?void 0:H.destroy)==null||O.call(H),P.value=null,!D)return f.value=!0,void(h.value=t.node.content);if(!I)return void(f.value=!1);let z=!0;const W=(U=(F=A?.value.heavyBlockMargin)!=null?F:A?.value.rootMargin)!=null?U:yc,K=T(I,{rootMargin:W,allowIdle:!E.value});P.value=K,f.value=f.value||K.isVisible.value,K.whenVisible.then(()=>{z&&P.value===K&&(f.value=!0)}),B(()=>{z=!1,K.destroy(),P.value===K&&(P.value=null)})},{immediate:!0}),Je(()=>t.node.content,I=>{D&&!f.value||(h.value=I)})):f.value=!0,Vn(()=>{var I,$;($=(I=P.value)==null?void 0:I.destroy)==null||$.call(I),P.value=null}),(I,$)=>(y(),he(bs(x.value?v.value:"div"),zn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":p(E)&&!f.value?"true":void 0},x.value?a.value:void 0),{default:me(()=>[f.value?(y(),M(Pe,{key:0},[S.value.mode==="structured"?(y(),M(Pe,{key:0},[w.value!==null?(y(),M(Pe,{key:0},[C("summary",xR(OA(b.value)),N(w.value),17),_.value.length?(y(),he(p(r),zn({key:0},i.value,{nodes:_.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):ee("",!0)],64)):(y(),he(p(r),zn({key:1},i.value,{nodes:m.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):S.value.mode==="dynamic"?(y(),he(p(c),{key:1,nodes:S.value.nodes},null,8,["nodes"])):S.value.mode==="text"?(y(),M("pre",T1e,N(S.value.content),1)):(y(),M("div",zn({key:3},l.value,{innerHTML:S.value.content}),null,16,E1e))],64)):(y(),M("div",I1e,[xn(I.$slots,"placeholder",{node:e.node},()=>[$[0]||($[0]=C("span",{class:"html-block-node__placeholder-bar"},null,-1)),$[1]||($[1]=C("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),$[2]||($[2]=C("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Qf.install=e=>{e.component(Qf.__name,Qf)};const L1e={dir:"auto",class:"paragraph-node"},$1e=["custom-id"],cc=Gn(et({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamFade",void 0),i=nn("markstreamParseOptions",void 0),r=nn("markstreamCustomMarkdownIt",void 0),l=nn("markstreamNestedRendererProps",void 0),a=R(()=>{var A;return(A=o?.value)!=null?A:"safe"}),u=R(()=>{var A;return(A=t.parseOptions)!=null?A:i?.value}),c=R(()=>{var A;return(A=t.customMarkdownIt)!=null?A:r?.value}),d=R(()=>{var A,E;return(E=t.customHtmlTags)!=null?E:(A=l?.value)==null?void 0:A.customHtmlTags}),f=R(()=>{var A,E;const P=(A=l?.value)!=null?A:{};return rn(mt({},P),{customId:(E=t.customId)!=null?E:P.customId,customHtmlTags:d.value,parseOptions:u.value,customMarkdownIt:c.value,htmlPolicy:a.value})}),h=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1});function m(A){var E;return A.type==="text"&&String((E=A.content)!=null?E:"").trim()===""}const v=R(()=>t.node.children.filter(A=>!m(A))),k=R(()=>v.value.length>0&&v.value.every(A=>A.type==="image"||(function(E){var P;const D=(function(I){return I.type==="link"&&Array.isArray(I.children)?I.children.filter($=>!m($)):[]})(E);return D.length===1&&((P=D[0])==null?void 0:P.type)==="image"})(A))),w=R(()=>new Set(Ec(d.value))),b=R(()=>{if(!k.value||v.value.length<=1)return t.node.children;const A=[];for(let E=0;E0,I=t.node.children.slice(E+1).some($=>!m($));D&&I&&A.push(rn(mt({},P),{content:" ",raw:" "}))}return A}),_=R(()=>s?.value===!1&&!n.value.text),g=R(()=>_.value?kc(b.value):null);function x(A,E){return{node:A,"index-key":`${t.indexKey}-${E}`,"custom-id":t.customId,"custom-html-tags":d.value}}const S=R(()=>mt({inline_code:li,image:Va,link:Mi,hardbreak:qa,emphasis:Ti,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,html_inline:sr,html_block:Qf,emoji:zi,checkbox:nr,math_inline:Jr,checkbox_input:nr,reference:xi,footnote_anchor:Jf,footnote_reference:or,text:qo},n.value)),T=R(()=>b.value.map((A,E)=>{var P;const D=(function(I){var $,B,H,O;if(I.type==="html_block"||I.type==="html_inline"){const F=String(($=I.tag)!=null?$:"").trim().toLowerCase()||ZI(I.content);if(F&&!w.value.has(F)&&GI((B=I.content)!=null?B:I.raw,F)){const U=String((O=(H=I.content)!=null?H:I.raw)!=null?O:"");return{child:{type:"text",content:U,raw:U},component:qo,isCustomComponent:!1}}}return{child:I,component:S.value[I.type],isCustomComponent:!!(n.value[I.type]&&!Qp(String(I.type)))}})(A);return rn(mt({},D),{index:E,key:`${t.indexKey||"paragraph"}-${E}`,customAttrs:D.isCustomComponent?p5(D.child,a.value):void 0,hasSlotChildren:Array.isArray(D.child.children)&&D.child.children.length>0,slotContent:String((P=D.child.content)!=null?P:""),originalChild:A})}));return(A,E)=>(y(),M("p",L1e,[g.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(g.value),9,$1e)):(y(!0),M(Pe,{key:1},pt(T.value,P=>{return y(),M(Pe,{key:P.key},[k.value&&m(P.originalChild)?(y(),M(Pe,{key:0},[qe(N((D=P.originalChild,String((I=D.content)!=null?I:""))),1)],64)):P.isCustomComponent?(y(),he(bs(P.component),zn({key:1,ref_for:!0},P.customAttrs,{node:P.child,loading:P.child.loading,"index-key":P.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:me(()=>[P.hasSlotChildren?(y(),he(p(h),zn({key:0,ref_for:!0},f.value,{nodes:P.child.children,"index-key":P.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):P.slotContent?(y(),he(p(h),zn({key:1,ref_for:!0},f.value,{content:P.slotContent,final:!P.child.loading,"index-key":`${P.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(y(),he(bs(P.component),zn({key:2,ref_for:!0},x(P.child,P.index)),null,16))],64);var D,I}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);cc.install=e=>{e.component(cc.__name,cc)};const N1e={class:"table-node-wrapper"},F1e=["aria-busy"],R1e={key:0},O1e=["custom-id"],P1e=["aria-label","onPointerdown"],D1e=["custom-id"],B1e={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ep=Gn(et({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var w;return(w=t.node.loading)!=null&&w}),o=R(()=>{var w;return(w=t.node.rows)!=null?w:[]}),s=Z(null),i=Z([]);let r=null;const l=R(()=>t.node.header.cells.length),a=R(()=>i.value.some(w=>Number.isFinite(w)&&w>0)),u=R(()=>a.value?i.value.map(w=>w>0?{width:`${w}px`}:void 0):[]);Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade));const c=fs(()=>t.customId),d=R(()=>!!c.value.text),f=R(()=>!!c.value.paragraph),h=new WeakMap;function m(w){const b=t.fade===!1&&!d.value,_=!f.value,g=h.get(w);if(g?.children===w.children&&g.textFastPath===b&&g.paragraphFastPath===_)return g.info;const x=fg(w.children,_,!0),S={simpleChildren:x,plainText:x&&b?kc(x):null};return h.set(w,{children:w.children,textFastPath:b,paragraphFastPath:_,info:S}),S}function v(w){if(!r)return;w.preventDefault();const b=r.startWidth+r.nextStartWidth,_=Math.min(48,Math.floor(b/2)),g=Math.max(_,Math.min(b-_,Math.round(r.startWidth+w.clientX-r.startX))),x=[...r.widths];x[r.index]=g,x[r.index+1]=b-g,i.value=x}function k(){r&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k),r=null)}return Je(l,()=>{k(),i.value=[]}),Vn(k),(w,b)=>(y(),M("div",N1e,[C("table",{ref_key:"tableRef",ref:s,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(y(),M("colgroup",R1e,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("col",{key:g,style:Zt(u.value[g])},null,4))),128))])):ee("",!0),C("thead",null,[C("tr",null,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("th",{key:g,dir:"auto",class:Re([_.align==="right"?"text-right":_.align==="center"?"text-center":"text-left"])},[m(_).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(_).plainText),9,O1e)):m(_).simpleChildren?(y(),he(p($p),{key:1,nodes:m(_).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${g}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:_.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[0]||(b[0]=x=>w.$emit("copy",x))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),g(function(S,T){if(T.button!==0)return;const A=(function(){var D;const I=(D=s.value)==null?void 0:D.querySelectorAll("thead th");return Array.from(I??[],$=>Math.round($.getBoundingClientRect().width))})(),E=A[S],P=A[S+1];E&&P&&(T.preventDefault(),r={index:S,startX:T.clientX,startWidth:E,nextStartWidth:P,widths:A},i.value=A,window.addEventListener("pointermove",v),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k))})(g,x)},null,40,P1e)):ee("",!0)],2))),128))])]),C("tbody",null,[(y(!0),M(Pe,null,pt(o.value,(_,g)=>(y(),M("tr",{key:g},[(y(!0),M(Pe,null,pt(_.cells,(x,S)=>(y(),M("td",{key:S,class:Re([x.align==="right"?"text-right":x.align==="center"?"text-center":"text-left"]),dir:"auto"},[m(x).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(x).plainText),9,D1e)):m(x).simpleChildren?(y(),he(p($p),{key:1,nodes:m(x).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${g}-${S}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:x.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[1]||(b[1]=T=>w.$emit("copy",T))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,F1e),j(as,{name:"table-node-fade"},{default:me(()=>[n.value?(y(),M("div",B1e,[xn(w.$slots,"loading",{isLoading:n.value},()=>[b[2]||(b[2]=C("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),b[3]||(b[3]=C("span",{class:"sr-only"},"Loading",-1))],!0)])):ee("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);ep.install=e=>{e.component(ep.__name,ep)};const H1e={class:"hr-node"},sm=Gn({},[["render",function(e,t){return y(),M("hr",H1e)}],["__scopeId","data-v-39b2349c"]]);sm.install=e=>{e.component(sm.__name,sm)};const z1e={class:"unknown-node"},l8=et({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(y(),M("div",z1e,N(e.node.raw),1))}),im=Gn(et({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=R(()=>`vmr-container vmr-container-${t.node.name}`),o=fs(()=>t.customId),s=R(()=>mt({text:qo,paragraph:cc,heading:L2,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,checkbox:nr,checkbox_input:nr,hardbreak:qa,math_inline:Jr,reference:xi,list:qd,math_block:C$,table:ep},o.value));return(i,r)=>(y(),M("div",zn({class:n.value},e.node.attrs),[(y(!0),M(Pe,null,pt(e.node.children,(l,a)=>{return y(),he(bs((u=l.type,s.value[u]||l8)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var u}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);im.install=e=>{e.component(im.__name,im)};const W1e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],R_=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function U1e(e){if(e<=255)return W1e[e];let t=0,n=R_.length-1;for(;t<=n;){const o=t+n>>1,s=R_[o];if(es[1]))return s[2];t=o+1}}return"L"}const j1e=/[ \t\n\r\f]+/g,V1e=/[\t\n\r\f]| {2,}|^ | $/;let J9=null;const q1e=new RegExp("\\p{Script=Arabic}","u"),ou=new RegExp("\\p{M}","u"),y5=new RegExp("\\p{Nd}","u");function O_(e){return q1e.test(e)}function P_(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function kl(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&o<=57343){if(P_(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(P_(n))return!0}}return!1}const K1e=new Set([" "," ","⁠","\uFEFF"]),Z1e=new Set(["-","‐","–","—"]);function w$(e,t){return!((function(n){const o=tp(n);return o!==null&&K1e.has(o)})(e)||t&&((function(n){const o=tp(n);return o!==null&&(k5.has(o)||bc.has(o))})(e)||(function(n){const o=tp(n);return o!==null&&Z1e.has(o)})(e)))}const k5=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),$2=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),b5=new Set(["'","’"]),bc=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),G1e=new Set([":",".","،","؛"]),Y1e=new Set(["၏"]),X1e=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function J1e(e){if(C5(e))return!0;let t=!1;for(const n of e)if(bc.has(n)||hg(n))t=!0;else if(!t||!ou.test(n))return!1;return t}function Q1e(e){for(const t of e)if(!k5.has(t)&&!bc.has(t))return!1;return e.length>0}function efe(e){if(C5(e))return!0;for(const t of e)if(!($2.has(t)||b5.has(t)||ou.test(t)||hg(t)))return!1;return e.length>0}function C5(e){let t=!1;for(const n of e)if(n!=="\\"&&!ou.test(n)){if(!($2.has(n)||bc.has(n)||b5.has(n)))return!1;t=!0}return t}function pg(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function tp(e){if(e.length===0)return null;const t=pg(e,e.length);return e.slice(t)}const tfe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function hg(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s=o[s]&&n<=o[s+1])return!0;return!1})(t,tfe)}function nfe(e){const t=(function(n){for(const o of n)if(!ou.test(o))return o;return null})(e);return t!==null&&y5.test(t)}function ofe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ou.test(o))n--;else{if(!$2.has(o)&&!b5.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function sfe(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function D_(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function B_(e,t){return e&&t!==null&&G1e.has(t)}function ife(e){const t=tp(e);return t!==null&&Y1e.has(t)}function rfe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function a8(e){let t=e.length;for(;t>0;){const n=pg(e,t),o=e.slice(n,t);if(X1e.has(o))return!0;if(!bc.has(o))return!1;t=n}return!1}function lfe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` +`:""}${le}`;return d=X,f}),m=R(()=>{var X;return t.showLineNumbers===!0&&((X=t.node)==null?void 0:X.diff)===!0}),v=R(()=>m.value&&t.diffInline===!0),k=R(()=>{const X=Number(t.reservedHeightPx);if(!Number.isFinite(X)||X<=0)return;const le=`${Math.ceil(X)}px`;return i.value?{maxHeight:le,overflow:"auto"}:{height:le,minHeight:le,maxHeight:le,overflow:"auto"}}),w=["diff ","index ","--- ","+++ ","@@ "];function b(X){return String(X??"").trim().length===0}function _(X,le="context",Ie={}){const de=b(X);return{code:X,kind:de&&le!=="hunk"&&le!=="spacer"&&!Ie.preserveBlankKind?"context":le,empty:de}}function g(X){const le=n(X,i.value);return le?le.split(/\r\n|\n|\r/):[]}function x(X,le){return!b(X[le])||lew.some(Ie=>le.startsWith(Ie)))}function E(X,le){return le||!X.startsWith(" ")||X.startsWith(" ")?X:` ${X}`}function P(X,le){const Ie=X.length,de=le.length,pe=[];let ve=0;for(;ve=ve&&G>=ve&&X[ye]===le[G];)oe.unshift({originalIndex:ye,modifiedIndex:G}),ye--,G--;const Y=ye-ve+1,fe=G-ve+1;if(Y<=0||fe<=0||i.value||(Y+1)*(fe+1)>15e5)return pe.concat(oe);const we=fe+1,ge=new Uint32Array((Y+1)*(fe+1));for(let ue=Y-1;ue>=0;ue--)for(let Se=fe-1;Se>=0;Se--){const ze=ue*we+Se;if(X[ve+ue]===le[ve+Se])ge[ze]=ge[(ue+1)*we+Se+1]+1;else{const _e=ge[(ue+1)*we+Se],Ee=ge[ue*we+Se+1];ge[ze]=_e>=Ee?_e:Ee}}const Q=[];let te=0,ce=0;for(;te=ge[te*we+ce+1]?te++:ce++;return pe.concat(Q,oe)}function D(X){var le;const Ie=(function(){var G,Y;const fe=t.diffHideUnchangedRegions;if(fe==null||fe===!1)return null;const we=fe===!0?{}:fe;return we.enabled===!1?null:{contextLineCount:Math.max(0,Math.floor((G=we.contextLineCount)!=null?G:2)),minimumLineCount:Math.max(1,Math.floor((Y=we.minimumLineCount)!=null?Y:4))}})();if(!Ie||X.length<1||X.length>2||X.length===2&&X[0].lines.length!==X[1].lines.length)return X;const de=X[0].lines,pe=(le=X[1])==null?void 0:le.lines,ve=G=>de[G].kind==="context"&&(pe===void 0||pe[G].kind==="context"&&de[G].code===pe[G].code),oe=[];let ye=0;for(;ye=Ie.minimumLineCount){const fe=G+(G===0?0:Ie.contextLineCount),we=Y-(Y===de.length?0:Ie.contextLineCount);we-fe>=Ie.minimumLineCount&&oe.push({start:fe,end:we})}ye===G&&ye++}return oe.length?X.map((G,Y)=>{const fe=[];let we=0;for(const ge of oe)fe.push(...G.lines.slice(we,ge.start)),fe.push({code:Y===0?"Unmodified lines":"",kind:"collapsed",empty:!1,key:`${G.key}-collapsed-${ge.start}-${ge.end}`,number:""}),we=ge.end;return fe.push(...G.lines.slice(we)),rn(mt({},G),{lines:fe})}):X}const I=R(()=>{var X,le,Ie,de;if(!m.value)return[];const pe=(function(Y){const fe=Y.some(ge=>S(ge)),we=Y.some(ge=>T(ge));return fe&&we||(function(){var ge,Q,te,ce;if(o.value==="diff")return!0;const ue=(ce=(te=String((Q=(ge=t.node)==null?void 0:ge.raw)!=null?Q:"").split(/\r?\n/,1)[0])==null?void 0:te.trim())!=null?ce:"";return/^`{3,}\s*diff(?:\s|$)|^~{3,}\s*diff(?:\s|$)/.test(ue)})()&&(fe||we)})(c.value),ve=(function(){var Y,fe;return((Y=t.node)==null?void 0:Y.originalCode)!=null||((fe=t.node)==null?void 0:fe.updatedCode)!=null})();if(v.value){const Y=ve?(function(fe,we){const ge=g(fe),Q=g(we),te=P(ge,Q);if(te.length>0){const Ee=[];let it=0,Fe=0;for(const Oe of te){for(;it=ue&&ze>=ue&&ge[Se]===Q[ze];)_e.unshift(rn(mt({},_(Q[ze])),{key:`inline-suffix-${ze}`,number:ze+1})),Se--,ze--;for(let Ee=ue;Ee<=Se;Ee++)ce.push(rn(mt({},_(ge[Ee],"removed",{preserveBlankKind:x(ge,Ee)})),{key:`inline-removed-source-${Ee}`,number:Ee+1}));for(let Ee=ue;Ee<=ze;Ee++)ce.push(rn(mt({},_(Q[Ee],"added",{preserveBlankKind:x(Q,Ee)})),{key:`inline-added-source-${Ee}`,number:Ee+1}));return ce.concat(_e)})((X=t.node)==null?void 0:X.originalCode,(le=t.node)==null?void 0:le.updatedCode):(function(fe){const we=[];let ge=1,Q=1;const te=A(fe);for(const[ce,ue]of fe.entries())if(ue.startsWith("@@")){const Se=ue.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/);Se&&(ge=Number(Se[1]),Q=Number(Se[2])),we.push(rn(mt({},_(ue,"hunk")),{key:`inline-hunk-${ce}`,number:""}))}else if(S(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"removed",{preserveBlankKind:!0})),{key:`inline-removed-${ce}`,number:ge++}));else if(T(ue))we.push(rn(mt({},_(E(ue.slice(1),te),"added",{preserveBlankKind:!0})),{key:`inline-added-${ce}`,number:Q++}));else{const Se=te&&ue.startsWith(" ")?ue.slice(1):ue;we.push(rn(mt({},_(Se)),{key:`inline-context-${ce}`,number:Q})),ge++,Q++}return we})(c.value);return D([{key:"inline",className:"markstream-pre__diff-pane--inline",lines:Y}])}if(!pe&&ve)return(function(Y,fe){const we=g(Y),ge=g(fe),Q=P(we,ge),te=[],ce=[];let ue=0,Se=0,ze=0;const _e=(Ee,it)=>{const Fe=Math.max(Ee-ue,it-Se);for(let Oe=0;Oern(mt({},Y),{key:`original-${fe}`,number:fe+1}))},{key:"modified",className:"markstream-pre__diff-pane--modified",lines:ye.map((Y,fe)=>rn(mt({},Y),{key:`modified-${fe}`,number:fe+1}))}])}),$=R(()=>I.value.some(X=>X.lines.some(le=>le.kind==="collapsed"))),B=R(()=>{const X=o.value;return X?`Code block: ${X}`:"Code block"}),H=Z(null),O=Z([]);let F=null,U=!1,z=null;function W(X){const le=Number.parseFloat(String(X??""));return Number.isFinite(le)&&le>0?le:0}function K(X,le){var Ie;if(!X)return le;if(X.classList.contains("markstream-pre__diff-line--collapsed"))return 32;const de=X.querySelector(".markstream-pre__diff-content"),pe=de?.getBoundingClientRect(),ve=(Ie=pe?.height)!=null?Ie:0;return Math.max(le,Math.ceil(ve))}function V(){U||typeof window>"u"||(F!=null&&window.cancelAnimationFrame(F),F=window.requestAnimationFrame(()=>{F=null,U||(function(){var X,le;F=null;const Ie=H.value;if(!Ie||!m.value||v.value||!Ie.classList.contains("is-wrap"))return void(O.value.length&&(O.value=[]));const de=(function(fe){const we=window.getComputedStyle(fe),ge=W(we.getPropertyValue("--markstream-pre-diff-line-height"));if(ge>0)return ge;const Q=W(we.lineHeight);return Q>0?Q:18})(Ie),pe=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--original .markstream-pre__diff-line")),ve=Array.from(Ie.querySelectorAll(".markstream-pre__diff-pane--modified .markstream-pre__diff-line")),oe=Math.max(pe.length,ve.length),ye=[];for(let fe=0;fe{const ge=Y[we];return ge&&Math.abs(fe.rowHeight-ge.rowHeight)<=.5&&Math.abs(fe.originalHeight-ge.originalHeight)<=.5&&Math.abs(fe.modifiedHeight-ge.modifiedHeight)<=.5})||(O.value=ye)})()}))}function ie(X){z?.disconnect(),z=null,X&&m.value&&!v.value&&typeof ResizeObserver<"u"&&(z=new ResizeObserver(()=>{V()}),z.observe(X))}function ne(X,le){const Ie=O.value[X];if(!Ie)return;const de=le==="original"?Ie.originalHeight:Ie.modifiedHeight;return{"--markstream-pre-diff-synced-row-height":`${Math.ceil(Ie.rowHeight)}px`,"--markstream-pre-diff-content-height":`${Math.ceil(de)}px`}}return Je(H,X=>{ie(X),yt(()=>V())},{flush:"post"}),Je([m,v,I],()=>{ie(H.value),yt(()=>V())},{flush:"post",immediate:!0}),Vn(()=>{U=!0,F!=null&&(window.cancelAnimationFrame(F),F=null),z?.disconnect(),z=null}),(X,le)=>(y(),M("pre",{ref_key:"preRef",ref:H,style:Zt(k.value),class:Re([s.value,{"markstream-pre--line-numbers":t.showLineNumbers,"markstream-pre--diff-preview":m.value,"markstream-pre--diff-inline":v.value,"markstream-pre--diff-collapsed":$.value}]),"aria-busy":i.value,"aria-label":B.value,"data-language":o.value,"data-markstream-line-numbers":t.showLineNumbers?"1":void 0,"data-markstream-pre":"1",tabindex:"0"},[m.value?(y(),M("code",Kde,[(y(!0),M(Pe,null,pt(I.value,Ie=>(y(),M("span",{key:Ie.key,class:Re(["markstream-pre__diff-pane",Ie.className])},[C("span",Zde,[(y(!0),M(Pe,null,pt(Ie.lines,(de,pe)=>(y(),M("span",{key:de.key,class:Re(["markstream-pre__diff-line",[`markstream-pre__diff-line--${de.kind}`,{"markstream-pre__diff-line--empty":de.empty}]]),style:Zt(ne(pe,Ie.key))},[le[0]||(le[0]=C("span",{class:"markstream-pre__diff-rail","aria-hidden":"true"},null,-1)),C("span",Gde,N(de.number),1),C("span",Yde,[C("span",Xde,N(de.code),1)])],6))),128))])],2))),128))])):(y(),M(Pe,{key:1},[t.showLineNumbers?(y(),M("span",Jde,[C("span",{class:"markstream-pre__line-numbers-text",textContent:N(h.value)},null,8,Qde)])):ee("",!0),C("code",{translate:"no",class:"markstream-pre__code",textContent:N(r.value)},null,8,e1e)],64))],14,qde))}});Pi.install=e=>{e.component(Pi.__name,Pi)};const t1e={key:0},qo=Gn(et({__name:"TextNode",props:{node:{}},emits:["copy"],setup(e){const t=e,n=p1(),o=nn("markstreamFade",void 0),s=nn("markstreamTextStreamState",void 0),i=nn("markstreamStreamVersion",void 0),r=R(()=>{const k=n.fade;return k===""||k===!0||k==="true"||k!==!1&&k!=="false"&&void 0}),l=R(()=>typeof r.value=="boolean"?r.value:typeof o?.value!="boolean"||o.value),a=R(()=>{var k;const w=(k=n["index-key"])!=null?k:n.indexKey;return w==null||w===""?"":String(w)}),u=Z(t.node.content),c=Z(""),d=Z(0);let f;function h(){f?.(),f=void 0}function m(){h(),c.value&&(u.value=u.value+c.value,c.value="")}Je([()=>t.node.content,a,l],([k])=>{const w=String(k??""),b=a.value,_=t$({nextContent:w,persistedContent:b?s?.get(b):void 0,currentState:{settledContent:u.value,streamedDelta:c.value},typewriterEnabled:l.value});u.value=_.settledContent,c.value=_.streamedDelta,_.appended?(d.value+=1,(function(){if(!c.value||f||!i)return;const g=i.value;f=Je(()=>i.value,x=>{x!==g&&m()},{flush:"sync"})})()):c.value||h(),b&&s?.set(b,w)},{immediate:!0}),d1(h);const v=R(()=>d.value%2==0?"text-node-stream-delta--a":"text-node-stream-delta--b");return(k,w)=>(y(),M("span",{class:Re([[e.node.center?"text-node-center":""],"text-node"])},[u.value?(y(),M("span",t1e,N(u.value),1)):ee("",!0),c.value?(y(),M("span",{key:1,class:Re(["text-node-stream-delta",[v.value]]),onAnimationend:m},N(c.value),35)):ee("",!0)],2))}}),[["__scopeId","data-v-a7e90764"]]);function Af(e,t,n){return et({name:e,inheritAttrs:!1,setup(o,{attrs:s,slots:i}){var r,l;const a=g5(),u=h5(),c=m5(),d=typeof window<"u"&&((l=(r=ds())==null?void 0:r.vnode.el)==null?void 0:l.nodeType)===1,f=Z(typeof window>"u"||d||!c.value),h=Xr(null);let m=null;function v(k){const w=k&&"$el"in k?k.$el:k;h.value=w instanceof HTMLElement?w:null}return typeof window<"u"&&Je([h,c],([k,w],b,_)=>{if(m?.destroy(),m=null,!w||f.value)return void(f.value=!0);if(!k)return;let g=!0;const x=a(k,{rootMargin:u?.value.heavyBlockMargin,allowIdle:!1});m=x,f.value=x.isVisible.value,x.whenVisible.then(()=>{g&&m===x&&(f.value=!0)}),_(()=>{g=!1,x.destroy(),m===x&&(m=null)})},{immediate:!0}),Vn(()=>{m?.destroy(),m=null}),()=>tn(f.value?t:n,rn(mt({},s),{ref:v}),i)}})}qo.install=e=>{e.component(qo.__name,qo)};const dg=et({name:"CodeBlockNodeLoading",inheritAttrs:!1,props:["node","isDark","loading","stream","theme","darkTheme","lightTheme","isShowPreview","monacoOptions","enableFontSizeControl","minWidth","maxWidth","themes","showHeader","showCopyButton","showExpandButton","showPreviewButton","showCollapseButton","showFontSizeButtons","showTooltips","htmlPreviewAllowScripts","htmlPreviewSandbox","customId","estimatedHeightPx","estimatedContentHeightPx","estimatedDiffInline"],emits:["previewCode","copy"],setup(e,{attrs:t}){const n=e;return()=>{var o,s,i,r,l,a,u;const c=T2(String((s=(o=n.node)==null?void 0:o.language)!=null?s:"")),d=p_[c]||(c?c.charAt(0).toUpperCase()+c.slice(1):p_[""]),f=jde(n.node),h=Vde(String((r=(i=n.node)==null?void 0:i.raw)!=null?r:""),d,f),m=n.monacoOptions,v=f&&((l=n.estimatedDiffInline)!=null?l:v5(m??{},typeof window>"u"?0:window.innerWidth)),k=m?.diffAppearance,w=k==="dark"||k!=="light"&&n.isDark===!0,b=typeof m?.fontSize=="number"&&Number.isFinite(m.fontSize)&&m.fontSize>0?m.fontSize:12,_=typeof m?.lineHeight=="number"&&Number.isFinite(m.lineHeight)&&m.lineHeight>0?m.lineHeight:b===12?18:Math.max(12,Math.round(1.5*b)),g=typeof m?.tabSize=="number"&&Number.isFinite(m.tabSize)&&m.tabSize>0?m.tabSize:4,x=f?0:8,S=typeof((a=m?.padding)==null?void 0:a.top)=="number"&&Number.isFinite(m.padding.top)&&m.padding.top>=0?m.padding.top:x,T=typeof((u=m?.padding)==null?void 0:u.bottom)=="number"&&Number.isFinite(m.padding.bottom)&&m.padding.bottom>=0?m.padding.bottom:x,A=typeof m?.fontFamily=="string"?m.fontFamily.trim():"",E=mt(mt({fontSize:`${b}px`,lineHeight:`${_}px`,tabSize:g,paddingTop:`${S}px`,paddingBottom:`${T}px`,"--markstream-pre-line-number-top":`${S}px`},f?{"--markstream-pre-diff-line-height":`${_}px`}:{}),A?{"--markstream-code-font-family":A}:{}),P=()=>tn("button",{class:"code-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded leading-none shrink-0","aria-hidden":"true",disabled:!0,tabindex:-1,type:"button"},[tn("svg",{class:"action-icon"})]),D=n.isShowPreview!==!1&&(c==="html"||c==="svg"),I=n.showFontSizeButtons!==!1&&n.enableFontSizeControl!==!1||n.showExpandButton!==!1||D&&n.showPreviewButton!==!1,$=H=>{if(H!=null)return typeof H=="number"?`${H}px`:String(H)},B=mt(mt(mt({"--markstream-code-layout-character-width":"1ch"},$(n.minWidth)?{minWidth:$(n.minWidth)}:{}),$(n.maxWidth)?{maxWidth:$(n.maxWidth)}:{}),f?{}:{color:"var(--vscode-editor-foreground, var(--markstream-code-fallback-fg, var(--code-fg)))",backgroundColor:"var(--vscode-editor-background, var(--markstream-code-fallback-bg, var(--code-bg)))",borderColor:"var(--markstream-code-border-color, var(--code-border))"});return tn("div",rn(mt({},t),{class:["code-block-container","rounded-lg","border",{dark:n.isDark===!0,"is-rendering":n.loading!==!1,"is-dark":w,"is-diff":f,"is-plain-text":c===""||c==="plaintext"||c==="text"},t.class],style:[B,t.style],"data-markstream-code-block":"1","data-markstream-enhanced":"false","data-markstream-code-block-state":n.loading?"streaming":"settled","data-markstream-code-loading":"1"}),[n.showHeader===!1?null:tn("div",{class:"code-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)] border-[var(--code-border)] bg-[var(--code-header-bg)] text-[var(--code-fg)]"},[tn("div",{class:"code-header-main"},[tn("span",{class:"icon-slot h-4 w-4 flex-shrink-0"}),tn("div",{class:"code-header-copy"},[tn("div",{class:"code-header-title"},h.title),h.caption?tn("div",{class:"code-header-caption"},h.caption):null])]),tn("div",{class:"flex items-center gap-0.5",style:{visibility:"hidden"}},[f?tn("div",{class:"code-diff-stats","aria-hidden":"true"},[tn("span",{class:"code-diff-stat removed"},"-0"),tn("span",{class:"code-diff-stat added"},"+0")]):null,n.showCopyButton===!1?null:P(),n.showCollapseButton===!1?null:P(),I?tn("div",{class:"relative"},[P()]):null])]),tn("div",{class:"code-block-shell-content",style:n.stream!==!1||n.loading===!1?void 0:{display:"none"}},[tn(Pi,{node:n.node,loading:n.loading,showLineNumbers:!0,reservedHeightPx:f?void 0:n.estimatedContentHeightPx,diffInline:v,diffHideUnchangedRegions:f?Ude(m?.diffHideUnchangedRegions):void 0,class:"code-pre-fallback",style:E,"data-markstream-code-loading":"1"})]),tn("div",{class:"code-loading-placeholder",style:n.stream===!1&&n.loading!==!1?void 0:{display:"none"}},[tn("div",{class:"loading-skeleton"},[tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line"}),tn("div",{class:"skeleton-line short"})])]),tn("span",{class:"sr-only","aria-live":"polite",role:"status"})])}}}),X9=Af("ViewportDeferredCodeBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./CodeBlockNode-Do73mQqg.js"),__vite__mapDeps([4,5]))).default}catch(e){return console.warn('[markstream-vue] Optional peer dependency stream-diffs is missing. Falling back to preformatted code rendering. To enable enhanced code block features, please install "stream-diffs".',e),Pi}}),loadingComponent:dg,delay:0,suspensible:!1}),dg),Jr=zr(()=>mo(null,null,function*(){var e;if(((e=(function(){const t=Reflect.get(globalThis,"process");return t?.env})())==null?void 0:e.NODE_ENV)==="test"&&typeof window<"u")return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))};try{return yield r$(),(yield jo(()=>import("./index7-CG7TPx8g.js"),[])).default}catch(t){console.warn('[markstream-vue] Optional peer dependencies for MathInlineNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',t)}return t=>{var n,o,s,i;return tn(qo,rn(mt({},t),{node:{type:"text",content:(o=t.node.raw)!=null?o:`$${(n=t.node.content)!=null?n:""}$`,raw:(i=t.node.raw)!=null?i:`$${(s=t.node.content)!=null?s:""}$`}}))}})),C$=zr(()=>mo(null,null,function*(){try{return yield r$(),(yield jo(()=>import("./index6-CXJ_z4n5.js"),[])).default}catch(e){console.warn('[markstream-vue] Optional peer dependencies for MathBlockNode are missing. Falling back to text rendering. To enable full math rendering features, please install "katex".',e)}return e=>{var t,n,o,s;return tn(qo,rn(mt({},e),{node:{type:"text",content:(n=e.node.raw)!=null?n:`$$${(t=e.node.content)!=null?t:""}$$`,raw:(s=e.node.raw)!=null?s:`$$${(o=e.node.content)!=null?o:""}$$`}}))}})),xi=Gn(et({__name:"ReferenceNode",props:{node:{},messageId:{},threadId:{}},emits:["click","mouseEnter","mouseLeave"],setup:e=>(t,n)=>(y(),M("span",{class:"reference-node cursor-pointer text-xs rounded-md px-1.5 mx-0.5",role:"button",tabindex:"0",onClick:n[0]||(n[0]=o=>t.$emit("click",o,e.node.id,e.messageId,e.threadId)),onMouseenter:n[1]||(n[1]=o=>t.$emit("mouseEnter",o,e.node.id,e.messageId,e.threadId)),onMouseleave:n[2]||(n[2]=o=>t.$emit("mouseLeave",o,e.node.id,e.messageId,e.threadId))},N(e.node.id),33))}),[["__scopeId","data-v-775c65e4"]]);xi.install=e=>{e.component(xi.__name,xi)};const n1e={class:"superscript-node"},Wi=Gn(et({__name:"SuperscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sup",n1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"superscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"superscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-24160b22"]]);Wi.install=e=>{e.component(Wi.__name,Wi)};const o1e={class:"subscript-node"},Ui=Gn(et({__name:"SubscriptNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,footnote_reference:or,strikethrough:Ai,highlight:ir,insert:ji,superscript:Wi,emoji:zi,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("sub",o1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"subscript"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"subscript"}-${l}`,"fallback-to-text":""},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-197fa13b"]]);Ui.install=e=>{e.component(Ui.__name,Ui)};const s1e={class:"strong-node"},Si=Gn(et({__name:"StrongNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("strong",s1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strong"}-${l}`,components:o.value,node:r,"index-key":`${e.indexKey||"strong"}-${l}`,"custom-id":t.customId},null,8,["components","node","index-key","custom-id"]))),128))]))}}),[["__scopeId","data-v-a8647104"]]);Si.install=e=>{e.component(Si.__name,Si)};const i1e={class:"strikethrough-node"},Ai=Gn(et({__name:"StrikethroughNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("del",i1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"strikethrough"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"strikethrough"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-b7a531fa"]]);Ai.install=e=>{e.component(Ai.__name,Ai)};const r1e=["href","title","aria-label","aria-hidden","target","rel"],l1e=["aria-hidden"],a1e={class:"link-text-wrapper relative inline-flex"},u1e={class:"leading-[normal] link-text"},Mi=Gn(et({__name:"LinkNode",props:{node:{},indexKey:{},customId:{},showTooltip:{type:Boolean,default:!0},color:{},underlineHeight:{},underlineBottom:{},animationDuration:{},animationOpacity:{},animationTiming:{},animationIteration:{}},setup(e){const t=e,n=nn("markstreamShowTooltips",void 0),o=R(()=>{const w=n?.value;return typeof w=="boolean"?w:t.showTooltip}),s=R(()=>{var w,b,_,g,x;const S=t.underlineBottom!==void 0?typeof t.underlineBottom=="number"?`${t.underlineBottom}px`:String(t.underlineBottom):"-3px",T=(w=t.animationOpacity)!=null?w:.35,A=Math.max(.12,Math.min(.5*T,T)),E={"--underline-height":`${(b=t.underlineHeight)!=null?b:2}px`,"--underline-bottom":S,"--underline-opacity":String(T),"--underline-rest-opacity":String(A),"--underline-duration":`${(_=t.animationDuration)!=null?_:1.6}s`,"--underline-timing":(g=t.animationTiming)!=null?g:"ease-in-out","--underline-iteration":typeof t.animationIteration=="number"?String(t.animationIteration):(x=t.animationIteration)!=null?x:"infinite"};return t.color&&(E["--link-color"]=t.color),E}),i=fs(()=>t.customId),r=R(()=>mt({text:qo,strong:Si,strikethrough:Ai,emphasis:Ti,image:Va,html_inline:sr,inline_code:li},i.value)),l=p1(),a=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.attrs;if(!_||typeof _!="object")return{};const g={};if(Array.isArray(_))for(const x of _)Array.isArray(x)&&x[0]&&(g[String(x[0])]=String((b=x[1])!=null?b:""));else for(const[x,S]of Object.entries(_))x&&S!=null&&S!==!1&&(g[x]=S===!0?"":String(S));return A_(g,"safe","a")}),u=R(()=>mt(mt({},l),a.value)),c=R(()=>{var w,b;return A_({href:String((b=(w=t.node)==null?void 0:w.href)!=null?b:"")},"safe","a").href}),d=R(()=>{if(!c.value)return;const w=u.value.target;return(typeof w=="string"?w.trim():String(w??"").trim())||(sie(c.value)?"_blank":void 0)}),f=R(()=>{var w;return String((w=d.value)!=null?w:"").trim().toLowerCase()==="_blank"}),h=R(()=>{if(!c.value)return;const w=u.value.rel,b=new Set((typeof w=="string"?w:String(w??"")).split(/\s+/).filter(Boolean)),_=new Set(Array.from(b).filter(g=>g.toLowerCase()!=="opener"));return f.value&&(_.add("noopener"),_.add("noreferrer")),_.size>0?Array.from(_).join(" "):void 0}),m=R(()=>{const w=mt({},u.value);return delete w.title,delete w.href,delete w.target,delete w.rel,w});function v(){o.value&&Tde()}const k=R(()=>{var w,b;const _=(w=t.node)==null?void 0:w.title;return typeof _=="string"&&_.trim().length>0?_:String((b=c.value)!=null?b:"")});return(w,b)=>{var _,g;return e.node.loading?(y(),M("span",zn({key:1,class:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":e.node.loading?"false":"true"},p(l),{style:s.value}),[C("span",a1e,[C("span",u1e,[j(p(qo),{class:"leading-[normal] link-text",node:{type:"text",content:String((_=e.node.text)!=null?_:""),raw:String((g=e.node.text)!=null?g:"")},"index-key":`${e.indexKey||"link-text"}-loading`},null,8,["node","index-key"])]),b[1]||(b[1]=C("span",{class:"link-loading-indicator","aria-hidden":"true"},null,-1))])],16,l1e)):(y(),M("a",zn({key:0,class:"link-node",href:c.value,title:o.value?"":k.value,"aria-label":`Link: ${k.value}`,"aria-hidden":e.node.loading?"true":"false",target:d.value,rel:h.value},m.value,{style:s.value,onMouseenter:b[0]||(b[0]=x=>(function(S){var T,A,E,P;if(!o.value)return;const D=S,I=D?.clientX!=null&&D?.clientY!=null?{x:D.clientX,y:D.clientY}:void 0,$=((T=t.node)==null?void 0:T.title)||((A=c.value)!=null&&A.includes("xn--")&&((P=(E=t.node)==null?void 0:E.text)!=null&&P.includes("://"))?t.node.text:c.value)||"";Mde(S.currentTarget,$,"top",!1,I)})(x)),onMouseleave:v}),[(y(!0),M(Pe,null,pt(e.node.children,(x,S)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${S}`,components:r.value,node:x,"custom-id":t.customId,"index-key":`${e.indexKey||"link-text"}-${S}`},null,8,["components","node","custom-id","index-key"]))),128))],16,r1e))}}}),[["__scopeId","data-v-367e6ca4"]]);Mi.install=e=>{e.component(Mi.__name,Mi)};const c1e={class:"insert-node"},ji=Gn(et({__name:"InsertNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("ins",c1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"insert"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"insert"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-1e2c29d4"]]);ji.install=e=>{e.component(ji.__name,ji)};const d1e={class:"highlight-node"},ir=Gn(et({__name:"HighlightNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("mark",d1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"highlight"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"highlight"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-7a62982a"]]);ir.install=e=>{e.component(ir.__name,ir)};const f1e={class:"emphasis-node"},Ti=Gn(et({__name:"EmphasisNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>mt({text:qo,inline_code:li,link:Mi,html_inline:sr,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,footnote_reference:or,math_inline:Jr,reference:xi},n.value));return(s,i)=>(y(),M("em",f1e,[(y(!0),M(Pe,null,pt(e.node.children,(r,l)=>(y(),he(p(El),{key:`${e.indexKey||"emphasis"}-${l}`,components:o.value,node:r,"custom-id":t.customId,"index-key":`${e.indexKey||"emphasis"}-${l}`},null,8,["components","node","custom-id","index-key"]))),128))]))}}),[["__scopeId","data-v-2a5aafbf"]]);Ti.install=e=>{e.component(Ti.__name,Ti)};const p1e={class:"hard-break"},qa=Gn(et({__name:"HardBreakNode",props:{node:{}},setup:e=>(t,n)=>(y(),M("br",p1e))}),[["__scopeId","data-v-50c58f70"]]);qa.install=e=>{e.component(qa.__name,qa)};const $p=et({__name:"SimpleInlineRenderer",props:{nodes:{},customId:{},indexKey:{}},setup(e){const t=e,n=kt({checkbox:nr,checkbox_input:nr,emoji:zi,emphasis:Ti,hardbreak:qa,highlight:ir,inline_code:li,insert:ji,link:Mi,reference:xi,strikethrough:Ai,strong:Si,subscript:Ui,superscript:Wi,text:qo}),o=fs(()=>t.customId),s=R(()=>{const i=o.value;return Object.keys(i).length>0?mt(mt({},n),i):n});return(i,r)=>(y(!0),M(Pe,null,pt(e.nodes,(l,a)=>(y(),he(p(El),{key:a,components:s.value,node:l,"custom-id":t.customId,"index-key":`${e.indexKey||"inline"}-${a}`},null,8,["components","node","custom-id","index-key"]))),128))}});function i8(e){if(!e||typeof e!="object")return!1;const t=`|${e.type}|`;if(!"|checkbox|checkbox_input|emoji|emphasis|hardbreak|highlight|inline_code|insert|link|reference|strikethrough|strong|subscript|superscript|text|".includes(t))return!1;if(!"|emphasis|highlight|insert|link|strikethrough|strong|subscript|superscript|".includes(t))return!0;const n=e.children;return Array.isArray(n)&&n.every(i8)}function fg(e,t=!0,n=!1){if(!e||!n&&e.length===0)return null;if(e.every(i8))return e;if(!t||e.length!==1)return null;const o=e[0];if(o?.type!=="paragraph"||!Array.isArray(o.children))return null;const s=o.children;return(n||s.length>0)&&s.every(i8)?s:null}function kc(e){var t,n;if(!e?.length)return null;let o="";for(const s of e){if(s?.type!=="text"||s.center===!0)return null;o+=String((n=(t=s.content)!=null?t:s.raw)!=null?n:"")}return o}const h1e=["cite"],m1e={key:0,dir:"auto",class:"paragraph-node"},g1e=["custom-id"],tm=Gn(et({__name:"BlockquoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=fs(()=>t.customId),o=R(()=>!!n.value.paragraph),s=R(()=>!!n.value.text),i=R(()=>fg(t.node.children,!o.value)),r=R(()=>t.fade!==!1||s.value?null:kc(i.value));return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(l,a)=>(y(),M("blockquote",{class:"blockquote blockquote-node",dir:"auto",cite:e.node.cite},[i.value?(y(),M("p",m1e,[r.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(r.value),9,g1e)):(y(),he(p($p),{key:1,nodes:i.value,"custom-id":t.customId,"index-key":`blockquote-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):(y(),he(p(Vi),{key:1,"show-tooltips":t.showTooltips,"index-key":`blockquote-${t.indexKey}`,nodes:t.node.children||[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:a[0]||(a[0]=u=>l.$emit("copy",u))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade"]))],8,h1e))}}),[["__scopeId","data-v-abfecebc"]]);tm.install=e=>{e.component(tm.__name,tm)};const v1e={class:"definition-list"},y1e={class:"definition-term"},k1e={class:"definition-desc"},nm=Gn(et({__name:"DefinitionListNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("dl",v1e,[(y(!0),M(Pe,null,pt(t.node.items,(s,i)=>(y(),M(Pe,{key:i},[C("dt",y1e,[j(p(Vi),{"index-key":`definition-term-${t.indexKey}-${i}`,nodes:s.term,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])]),C("dd",k1e,[j(p(Vi),{"index-key":`definition-desc-${t.indexKey}-${i}`,nodes:s.definition,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[1]||(o[1]=r=>n.$emit("copy",r))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],64))),128))]))}}),[["__scopeId","data-v-4e103b30"]]);nm.install=e=>{e.component(nm.__name,nm)};const b1e=["href","title"],Jf=Gn(et({__name:"FootnoteAnchorNode",props:{node:{}},setup(e){const t=e;function n(o){var s;if(o.preventDefault(),typeof document>"u")return;const i=`fnref-${String((s=t.node.id)!=null?s:"")}`,r=document.getElementById(i);r&&r.scrollIntoView({behavior:"smooth",block:"center"})}return(o,s)=>(y(),M("a",{class:"footnote-anchor text-sm hover:underline cursor-pointer",href:`#fnref-${e.node.id}`,title:`返回引用 ${e.node.id}`,onClick:n}," ↩︎ ",8,b1e))}}),[["__scopeId","data-v-e1eb37b6"]]);Jf.install=e=>{e.component(Jf.__name,Jf)};const C1e=["id"],w1e={class:"flex-1"},om=et({__name:"FootnoteNode",props:{node:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e){const t=e;return(n,o)=>(y(),M("div",{id:`fnref--${e.node.id}`,class:"footnote-node flex text-sm leading-relaxed border-t border-[var(--footnote-border)] pt-2"},[C("div",w1e,[j(p(Vi),{"index-key":`footnote-${t.indexKey}`,nodes:t.node.children,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,onCopy:o[0]||(o[0]=s=>n.$emit("copy",s))},null,8,["index-key","nodes","custom-id","typewriter","fade"])])],8,C1e))}});om.install=e=>{e.component(om.__name,om)};const _1e=["custom-id"],r8=Gn(et({__name:"HeadingNode",props:{node:{},customId:{},indexKey:{}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamFade",void 0),s=R(()=>o?.value!==!1||n.value.text?null:kc(t.node.children)),i=R(()=>mt({text:qo,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,footnote_reference:or,hardbreak:qa,math_inline:Jr,reference:xi},n.value));return(r,l)=>(y(),he(bs(`h${e.node.level}`),zn({class:["heading-node",[`heading-${e.node.level}`]],dir:"auto"},e.node.attrs),{default:me(()=>[s.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(s.value),9,_1e)):(y(!0),M(Pe,{key:1},pt(e.node.children,(a,u)=>(y(),he(p(El),{key:u,components:i.value,"custom-id":t.customId,node:a,"index-key":`${e.indexKey||"heading"}-${u}`},null,8,["components","custom-id","node","index-key"]))),128))]),_:1},16,["class"]))}}),[["__scopeId","data-v-7122dbe1"]]),L2=r8;L2.install=e=>{e.component(r8.__name,r8)};const x1e={key:0,dir:"auto",class:"paragraph-node"},S1e=["custom-id"],A1e={dir:"auto",class:"paragraph-node"},M1e=["custom-id"],Vd=Gn(et({__name:"ListItemNode",props:{node:{},item:{},indexKey:{},customId:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},value:{},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var h;return(h=t.node)!=null?h:t.item}),o=fs(()=>t.customId),s=R(()=>!!o.value.paragraph),i=R(()=>!!o.value.text),r=R(()=>{var h;return fg((h=n.value)==null?void 0:h.children,!s.value)}),l=R(()=>{var h;if(s.value)return null;const m=(h=n.value)==null?void 0:h.children;if(!Array.isArray(m)||m.length<2)return null;const v=m[0];if(v?.type!=="paragraph"||!Array.isArray(v.children))return null;const k=m.slice(1);if(!k.every(b=>b?.type==="list"))return null;const w=fg([v]);return w?{paragraphChildren:w,nestedLists:k}:null});function a(){return t.fade===!1&&!i.value}const u=R(()=>a()?kc(r.value):null),c=R(()=>{var h;return a()?kc((h=l.value)==null?void 0:h.paragraphChildren):null}),d=Object.freeze({}),f=R(()=>{const{value:h}=t;return typeof h=="number"&&Number.isFinite(h)?{value:h}:d});return Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade)),(h,m)=>{var v,k;return y(),M("li",zn({class:"list-item",dir:"auto"},f.value),[r.value?(y(),M("p",x1e,[u.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(u.value),9,S1e)):(y(),he(p($p),{key:1,nodes:r.value,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))])):l.value?(y(),M(Pe,{key:1},[C("p",A1e,[c.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(c.value),9,M1e)):(y(),he(p($p),{key:1,nodes:l.value.paragraphChildren,"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-paragraph`},null,8,["nodes","custom-id","index-key"]))]),(y(!0),M(Pe,null,pt(l.value.nestedLists,(w,b)=>(y(),he(p(Vi),{key:b,nodes:[w],"custom-id":t.customId,"index-key":`list-item-${t.indexKey}-nested-${b}`,"show-tooltips":t.showTooltips,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0,onCopy:m[0]||(m[0]=_=>h.$emit("copy",_))},null,8,["nodes","custom-id","index-key","show-tooltips","typewriter","fade","is-dark"]))),128))],64)):(y(),he(p(Vi),{key:2,"show-tooltips":t.showTooltips,"index-key":`list-item-${t.indexKey}`,nodes:(k=(v=n.value)==null?void 0:v.children)!=null?k:[],"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"is-dark":t.isDark,"batch-rendering":!1,onCopy:m[1]||(m[1]=w=>h.$emit("copy",w))},null,8,["show-tooltips","index-key","nodes","custom-id","typewriter","fade","is-dark"]))],16)}}}),[["__scopeId","data-v-617214f9"]]);Vd.install=e=>{e.component(Vd.__name,Vd)};const qd=Gn(et({__name:"ListNode",props:{node:{},customId:{},indexKey:{},typewriter:{type:Boolean},fade:{type:Boolean},showTooltips:{type:Boolean},isDark:{type:Boolean}},emits:["copy"],setup(e){const t=fs(()=>e.customId),n=R(()=>t.value.list_item||Vd);return(o,s)=>(y(),he(bs(e.node.ordered?"ol":"ul"),{class:Re(["list-node",{"list-decimal":e.node.ordered,"list-disc":!e.node.ordered}])},{default:me(()=>[(y(!0),M(Pe,null,pt(e.node.items,(i,r)=>{var l;return y(),he(bs(n.value),zn({key:`${e.indexKey||"list"}-${r}`},{ref_for:!0},{showTooltips:e.showTooltips},{node:i,"custom-id":e.customId,"index-key":`${e.indexKey||"list"}-${r}`,typewriter:e.typewriter,fade:e.fade,"is-dark":e.isDark,value:e.node.ordered?((l=e.node.start)!=null?l:1)+r:void 0,onCopy:s[0]||(s[0]=a=>o.$emit("copy",a))}),null,16,["node","custom-id","index-key","typewriter","fade","is-dark","value"])}),128))]),_:1},8,["class"]))}}),[["__scopeId","data-v-99cb95e0"]]);qd.install=e=>{e.component(qd.__name,qd)};const T1e={key:2,class:"html-block-node__raw"},E1e=["innerHTML"],I1e={key:1,class:"html-block-node__placeholder"},Qf=Gn(et({__name:"HtmlBlockNode",props:{node:{},customId:{},htmlPolicy:{}},setup(e){const t=e,n=nn("markstreamHtmlPolicy",void 0),o=nn("markstreamNestedRendererProps",void 0),s=R(()=>{var I,$;return($=(I=t.htmlPolicy)!=null?I:n?.value)!=null?$:"safe"}),i=R(()=>{var I,$;const B=(I=o?.value)!=null?I:{};return rn(mt({},B),{customId:($=t.customId)!=null?$:B.customId,htmlPolicy:s.value})}),r=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1}),l=R(()=>{const I=Xh(t.node.attrs,s.value);if(!I)return;const $=Zf(I);return Object.keys($).length>0?$:void 0}),a=R(()=>{const I=String(t.node.tag||"").trim(),$=Xh(t.node.attrs,s.value,I);if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),u=fs(()=>t.customId),c=et({name:"DynamicRenderer",props:{nodes:{type:Array,required:!0}},render(){return this.nodes}}),d=Z(null),f=Z(typeof window>"u"),h=Z(t.node.content),m=R(()=>Array.isArray(t.node.children)?t.node.children:[]),v=R(()=>String(t.node.tag||"div")),k=R(()=>{var I;if(v.value.trim().toLowerCase()!=="details"||(I=t.node.attrs)!=null&&I.some(([B])=>String(B).toLowerCase()==="open"))return null;const $=m.value[0];return $?.type==="html_block"&&String($.tag||"").toLowerCase()==="summary"?$:null}),w=R(()=>{var I;return kc((I=k.value)==null?void 0:I.children)}),b=R(()=>{const I=k.value;if(!I)return;const $=Xh(I.attrs,s.value,"summary");if(!$)return;const B=Zf($);return Object.keys(B).length>0?B:void 0}),_=R(()=>w.value==null?m.value:m.value.slice(1)),g=R(()=>{const I=v.value.trim().toLowerCase();return UI.has(I)||a5(I,s.value)}),x=R(()=>m.value.length>0&&!!t.node.tag&&!g.value),S=R(()=>{var I,$,B;if(x.value)return{mode:"structured"};if(!f.value)return{mode:"html",content:(I=h.value)!=null?I:""};const H=($=h.value)!=null?$:t.node.content;if(!H)return{mode:"html",content:""};if(s.value==="escape")return{mode:"html",content:jd(H,s.value)};if(t.node.loading){const F=cg(H,u.value,s.value);return F===null?{mode:"text",content:(B=t.node.raw)!=null?B:H}:{mode:"dynamic",nodes:F}}if(!h$(H,u.value))return{mode:"html",content:jd(H,s.value)};const O=cg(H,u.value,s.value);return O===null?{mode:"html",content:jd(H,s.value)}:{mode:"dynamic",nodes:O}}),T=g5(),A=h5(),E=m5(),P=Xr(null),D=!!t.node.loading;return typeof window<"u"?(Je([()=>d.value,()=>A?.value.heavyBlockMargin,()=>A?.value.rootMargin],([I],$,B)=>{var H,O,F,U;if((O=(H=P.value)==null?void 0:H.destroy)==null||O.call(H),P.value=null,!D)return f.value=!0,void(h.value=t.node.content);if(!I)return void(f.value=!1);let z=!0;const W=(U=(F=A?.value.heavyBlockMargin)!=null?F:A?.value.rootMargin)!=null?U:yc,K=T(I,{rootMargin:W,allowIdle:!E.value});P.value=K,f.value=f.value||K.isVisible.value,K.whenVisible.then(()=>{z&&P.value===K&&(f.value=!0)}),B(()=>{z=!1,K.destroy(),P.value===K&&(P.value=null)})},{immediate:!0}),Je(()=>t.node.content,I=>{D&&!f.value||(h.value=I)})):f.value=!0,Vn(()=>{var I,$;($=(I=P.value)==null?void 0:I.destroy)==null||$.call(I),P.value=null}),(I,$)=>(y(),he(bs(x.value?v.value:"div"),zn({ref_key:"htmlRef",ref:d,class:"html-block-node","data-markstream-viewport-pending":p(E)&&!f.value?"true":void 0},x.value?a.value:void 0),{default:me(()=>[f.value?(y(),M(Pe,{key:0},[S.value.mode==="structured"?(y(),M(Pe,{key:0},[w.value!==null?(y(),M(Pe,{key:0},[C("summary",xR(OA(b.value)),N(w.value),17),_.value.length?(y(),he(p(r),zn({key:0},i.value,{nodes:_.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"])):ee("",!0)],64)):(y(),he(p(r),zn({key:1},i.value,{nodes:m.value,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes"]))],64)):S.value.mode==="dynamic"?(y(),he(p(c),{key:1,nodes:S.value.nodes},null,8,["nodes"])):S.value.mode==="text"?(y(),M("pre",T1e,N(S.value.content),1)):(y(),M("div",zn({key:3},l.value,{innerHTML:S.value.content}),null,16,E1e))],64)):(y(),M("div",I1e,[xn(I.$slots,"placeholder",{node:e.node},()=>[$[0]||($[0]=C("span",{class:"html-block-node__placeholder-bar"},null,-1)),$[1]||($[1]=C("span",{class:"html-block-node__placeholder-bar w-4/5"},null,-1)),$[2]||($[2]=C("span",{class:"html-block-node__placeholder-bar w-2/3"},null,-1))],!0)]))]),_:3},16,["data-markstream-viewport-pending"]))}}),[["__scopeId","data-v-e140a874"]]);Qf.install=e=>{e.component(Qf.__name,Qf)};const L1e={dir:"auto",class:"paragraph-node"},$1e=["custom-id"],cc=Gn(et({__name:"ParagraphNode",props:{node:{},customId:{},indexKey:{},customHtmlTags:{},parseOptions:{},customMarkdownIt:{type:Function}},setup(e){const t=e,n=fs(()=>t.customId),o=nn("markstreamHtmlPolicy",void 0),s=nn("markstreamFade",void 0),i=nn("markstreamParseOptions",void 0),r=nn("markstreamCustomMarkdownIt",void 0),l=nn("markstreamNestedRendererProps",void 0),a=R(()=>{var A;return(A=o?.value)!=null?A:"safe"}),u=R(()=>{var A;return(A=t.parseOptions)!=null?A:i?.value}),c=R(()=>{var A;return(A=t.customMarkdownIt)!=null?A:r?.value}),d=R(()=>{var A,E;return(E=t.customHtmlTags)!=null?E:(A=l?.value)==null?void 0:A.customHtmlTags}),f=R(()=>{var A,E;const P=(A=l?.value)!=null?A:{};return rn(mt({},P),{customId:(E=t.customId)!=null?E:P.customId,customHtmlTags:d.value,parseOptions:u.value,customMarkdownIt:c.value,htmlPolicy:a.value})}),h=zr({loader:()=>Promise.resolve().then(()=>M5),suspensible:!1});function m(A){var E;return A.type==="text"&&String((E=A.content)!=null?E:"").trim()===""}const v=R(()=>t.node.children.filter(A=>!m(A))),k=R(()=>v.value.length>0&&v.value.every(A=>A.type==="image"||(function(E){var P;const D=(function(I){return I.type==="link"&&Array.isArray(I.children)?I.children.filter($=>!m($)):[]})(E);return D.length===1&&((P=D[0])==null?void 0:P.type)==="image"})(A))),w=R(()=>new Set(Ec(d.value))),b=R(()=>{if(!k.value||v.value.length<=1)return t.node.children;const A=[];for(let E=0;E0,I=t.node.children.slice(E+1).some($=>!m($));D&&I&&A.push(rn(mt({},P),{content:" ",raw:" "}))}return A}),_=R(()=>s?.value===!1&&!n.value.text),g=R(()=>_.value?kc(b.value):null);function x(A,E){return{node:A,"index-key":`${t.indexKey}-${E}`,"custom-id":t.customId,"custom-html-tags":d.value}}const S=R(()=>mt({inline_code:li,image:Va,link:Mi,hardbreak:qa,emphasis:Ti,strong:Si,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,html_inline:sr,html_block:Qf,emoji:zi,checkbox:nr,math_inline:Jr,checkbox_input:nr,reference:xi,footnote_anchor:Jf,footnote_reference:or,text:qo},n.value)),T=R(()=>b.value.map((A,E)=>{var P;const D=(function(I){var $,B,H,O;if(I.type==="html_block"||I.type==="html_inline"){const F=String(($=I.tag)!=null?$:"").trim().toLowerCase()||ZI(I.content);if(F&&!w.value.has(F)&&GI((B=I.content)!=null?B:I.raw,F)){const U=String((O=(H=I.content)!=null?H:I.raw)!=null?O:"");return{child:{type:"text",content:U,raw:U},component:qo,isCustomComponent:!1}}}return{child:I,component:S.value[I.type],isCustomComponent:!!(n.value[I.type]&&!Qp(String(I.type)))}})(A);return rn(mt({},D),{index:E,key:`${t.indexKey||"paragraph"}-${E}`,customAttrs:D.isCustomComponent?p5(D.child,a.value):void 0,hasSlotChildren:Array.isArray(D.child.children)&&D.child.children.length>0,slotContent:String((P=D.child.content)!=null?P:""),originalChild:A})}));return(A,E)=>(y(),M("p",L1e,[g.value!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(g.value),9,$1e)):(y(!0),M(Pe,{key:1},pt(T.value,P=>{return y(),M(Pe,{key:P.key},[k.value&&m(P.originalChild)?(y(),M(Pe,{key:0},[qe(N((D=P.originalChild,String((I=D.content)!=null?I:""))),1)],64)):P.isCustomComponent?(y(),he(bs(P.component),zn({key:1,ref_for:!0},P.customAttrs,{node:P.child,loading:P.child.loading,"index-key":P.key,"custom-id":t.customId,"custom-html-tags":d.value,"is-dark":f.value.isDark}),{default:me(()=>[P.hasSlotChildren?(y(),he(p(h),zn({key:0,ref_for:!0},f.value,{nodes:P.child.children,"index-key":P.key,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):P.slotContent?(y(),he(p(h),zn({key:1,ref_for:!0},f.value,{content:P.slotContent,final:!P.child.loading,"index-key":`${P.key}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","custom-html-tags","is-dark"])):(y(),he(bs(P.component),zn({key:2,ref_for:!0},x(P.child,P.index)),null,16))],64);var D,I}),128))]))}}),[["__scopeId","data-v-c59ff506"]]);cc.install=e=>{e.component(cc.__name,cc)};const N1e={class:"table-node-wrapper"},F1e=["aria-busy"],R1e={key:0},O1e=["custom-id"],P1e=["aria-label","onPointerdown"],D1e=["custom-id"],B1e={key:0,class:"table-node__loading",role:"status","aria-live":"polite"},ep=Gn(et({__name:"TableNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{},showTooltips:{type:Boolean}},emits:["copy"],setup(e){const t=e,n=R(()=>{var w;return(w=t.node.loading)!=null&&w}),o=R(()=>{var w;return(w=t.node.rows)!=null?w:[]}),s=Z(null),i=Z([]);let r=null;const l=R(()=>t.node.header.cells.length),a=R(()=>i.value.some(w=>Number.isFinite(w)&&w>0)),u=R(()=>a.value?i.value.map(w=>w>0?{width:`${w}px`}:void 0):[]);Ln("markstreamShowTooltips",R(()=>t.showTooltips)),Ln("markstreamFade",R(()=>t.fade));const c=fs(()=>t.customId),d=R(()=>!!c.value.text),f=R(()=>!!c.value.paragraph),h=new WeakMap;function m(w){const b=t.fade===!1&&!d.value,_=!f.value,g=h.get(w);if(g?.children===w.children&&g.textFastPath===b&&g.paragraphFastPath===_)return g.info;const x=fg(w.children,_,!0),S={simpleChildren:x,plainText:x&&b?kc(x):null};return h.set(w,{children:w.children,textFastPath:b,paragraphFastPath:_,info:S}),S}function v(w){if(!r)return;w.preventDefault();const b=r.startWidth+r.nextStartWidth,_=Math.min(48,Math.floor(b/2)),g=Math.max(_,Math.min(b-_,Math.round(r.startWidth+w.clientX-r.startX))),x=[...r.widths];x[r.index]=g,x[r.index+1]=b-g,i.value=x}function k(){r&&(window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k),r=null)}return Je(l,()=>{k(),i.value=[]}),Vn(k),(w,b)=>(y(),M("div",N1e,[C("table",{ref_key:"tableRef",ref:s,class:Re(["table-node",{"table-node--loading":n.value}]),"aria-busy":n.value},[a.value?(y(),M("colgroup",R1e,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("col",{key:g,style:Zt(u.value[g])},null,4))),128))])):ee("",!0),C("thead",null,[C("tr",null,[(y(!0),M(Pe,null,pt(e.node.header.cells,(_,g)=>(y(),M("th",{key:g,dir:"auto",class:Re([_.align==="right"?"text-right":_.align==="center"?"text-center":"text-left"])},[m(_).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(_).plainText),9,O1e)):m(_).simpleChildren?(y(),he(p($p),{key:1,nodes:m(_).simpleChildren,"custom-id":t.customId,"index-key":`table-th-${t.indexKey}-${g}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:_.children,"index-key":`table-th-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[0]||(b[0]=x=>w.$emit("copy",x))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"])),g(function(S,T){if(T.button!==0)return;const A=(function(){var D;const I=(D=s.value)==null?void 0:D.querySelectorAll("thead th");return Array.from(I??[],$=>Math.round($.getBoundingClientRect().width))})(),E=A[S],P=A[S+1];E&&P&&(T.preventDefault(),r={index:S,startX:T.clientX,startWidth:E,nextStartWidth:P,widths:A},i.value=A,window.addEventListener("pointermove",v),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k))})(g,x)},null,40,P1e)):ee("",!0)],2))),128))])]),C("tbody",null,[(y(!0),M(Pe,null,pt(o.value,(_,g)=>(y(),M("tr",{key:g},[(y(!0),M(Pe,null,pt(_.cells,(x,S)=>(y(),M("td",{key:S,class:Re([x.align==="right"?"text-right":x.align==="center"?"text-center":"text-left"]),dir:"auto"},[m(x).plainText!==null?(y(),M("span",{key:0,class:"text-node","custom-id":t.customId},N(m(x).plainText),9,D1e)):m(x).simpleChildren?(y(),he(p($p),{key:1,nodes:m(x).simpleChildren,"custom-id":t.customId,"index-key":`table-td-${t.indexKey}-${g}-${S}`},null,8,["nodes","custom-id","index-key"])):(y(),he(p(Vi),{key:2,nodes:x.children,"index-key":`table-td-${t.indexKey}`,"custom-id":t.customId,typewriter:t.typewriter,fade:t.fade,"show-tooltips":t.showTooltips,onCopy:b[1]||(b[1]=T=>w.$emit("copy",T))},null,8,["nodes","index-key","custom-id","typewriter","fade","show-tooltips"]))],2))),128))]))),128))])],10,F1e),j(as,{name:"table-node-fade"},{default:me(()=>[n.value?(y(),M("div",B1e,[xn(w.$slots,"loading",{isLoading:n.value},()=>[b[2]||(b[2]=C("span",{class:"table-node__spinner animate-spin","aria-hidden":"true"},null,-1)),b[3]||(b[3]=C("span",{class:"sr-only"},"Loading",-1))],!0)])):ee("",!0)]),_:3})]))}}),[["__scopeId","data-v-39f87b5d"]]);ep.install=e=>{e.component(ep.__name,ep)};const H1e={class:"hr-node"},sm=Gn({},[["render",function(e,t){return y(),M("hr",H1e)}],["__scopeId","data-v-39b2349c"]]);sm.install=e=>{e.component(sm.__name,sm)};const z1e={class:"unknown-node"},l8=et({__name:"FallbackComponent",props:{node:{}},setup:e=>(t,n)=>(y(),M("div",z1e,N(e.node.raw),1))}),im=Gn(et({__name:"VmrContainerNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},setup(e){const t=e,n=R(()=>`vmr-container vmr-container-${t.node.name}`),o=fs(()=>t.customId),s=R(()=>mt({text:qo,paragraph:cc,heading:L2,inline_code:li,link:Mi,image:Va,strong:Si,emphasis:Ti,strikethrough:Ai,insert:ji,subscript:Ui,superscript:Wi,checkbox:nr,checkbox_input:nr,hardbreak:qa,math_inline:Jr,reference:xi,list:qd,math_block:C$,table:ep},o.value));return(i,r)=>(y(),M("div",zn({class:n.value},e.node.attrs),[(y(!0),M(Pe,null,pt(e.node.children,(l,a)=>{return y(),he(bs((u=l.type,s.value[u]||l8)),{key:`${e.indexKey||"vmr-container"}-${a}`,"custom-id":t.customId,node:l,"index-key":`${e.indexKey||"vmr-container"}-${a}`,typewriter:t.typewriter,fade:t.fade},null,8,["custom-id","node","index-key","typewriter","fade"]);var u}),128))],16))}}),[["__scopeId","data-v-911e41c4"]]);im.install=e=>{e.component(im.__name,im)};const W1e=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],R_=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function U1e(e){if(e<=255)return W1e[e];let t=0,n=R_.length-1;for(;t<=n;){const o=t+n>>1,s=R_[o];if(es[1]))return s[2];t=o+1}}return"L"}const j1e=/[ \t\n\r\f]+/g,V1e=/[\t\n\r\f]| {2,}|^ | $/;let J9=null;const q1e=new RegExp("\\p{Script=Arabic}","u"),ou=new RegExp("\\p{M}","u"),y5=new RegExp("\\p{Nd}","u");function O_(e){return q1e.test(e)}function P_(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=12592&&e<=12687||e>=44032&&e<=55215||e>=65280&&e<=65519}function kl(e){for(let t=0;t=55296&&n<=56319&&t+1=56320&&o<=57343){if(P_(o-56320+(n-55296<<10)+65536))return!0;t++;continue}}if(P_(n))return!0}}return!1}const K1e=new Set([" "," ","⁠","\uFEFF"]),Z1e=new Set(["-","‐","–","—"]);function w$(e,t){return!((function(n){const o=tp(n);return o!==null&&K1e.has(o)})(e)||t&&((function(n){const o=tp(n);return o!==null&&(k5.has(o)||bc.has(o))})(e)||(function(n){const o=tp(n);return o!==null&&Z1e.has(o)})(e)))}const k5=new Set([",",".","!",":",";","?","、","。","・",")","〕","〉","》","」","』","】","〗","〙","〛","ー","々","〻","ゝ","ゞ","ヽ","ヾ"]),$2=new Set(['"',"(","[","{","¡","¿","“","‘","‚","„","«","‹","⸘","(","〔","〈","《","「","『","【","〖","〘","〚"]),b5=new Set(["'","’"]),bc=new Set([".",",","!","?",":",";","،","؛","؟","।","॥","၊","။","၌","၍","၏",")","]","}","%",'"',"”","’","»","›","…"]),G1e=new Set([":",".","،","؛"]),Y1e=new Set(["၏"]),X1e=new Set(["”","’","»","›","」","』","】","》","〉","〕",")"]);function J1e(e){if(C5(e))return!0;let t=!1;for(const n of e)if(bc.has(n)||hg(n))t=!0;else if(!t||!ou.test(n))return!1;return t}function Q1e(e){for(const t of e)if(!k5.has(t)&&!bc.has(t))return!1;return e.length>0}function efe(e){if(C5(e))return!0;for(const t of e)if(!($2.has(t)||b5.has(t)||ou.test(t)||hg(t)))return!1;return e.length>0}function C5(e){let t=!1;for(const n of e)if(n!=="\\"&&!ou.test(n)){if(!($2.has(n)||bc.has(n)||b5.has(n)))return!1;t=!0}return t}function pg(e,t){const n=t-1;if(n<=0)return Math.max(n,0);const o=e.charCodeAt(n);if(o<56320||o>57343)return n;const s=n-1;if(s<0)return n;const i=e.charCodeAt(s);return i>=55296&&i<=56319?s:n}function tp(e){if(e.length===0)return null;const t=pg(e,e.length);return e.slice(t)}const tfe=[36,37,43,43,92,92,162,165,176,177,1423,1423,1545,1547,1642,1642,2046,2047,2546,2547,2553,2555,2801,2801,3065,3065,3449,3449,3647,3647,6107,6107,8240,8247,8279,8279,8352,8399,8451,8451,8457,8457,8470,8470,8722,8723,43064,43064,65020,65020,65129,65130,65284,65285,65504,65505,65509,65510,73693,73696,123647,123647,126124,126124,126128,126128];function hg(e){const t=e.codePointAt(0);return t!==void 0&&(function(n,o){for(let s=0;s=o[s]&&n<=o[s+1])return!0;return!1})(t,tfe)}function nfe(e){const t=(function(n){for(const o of n)if(!ou.test(o))return o;return null})(e);return t!==null&&y5.test(t)}function ofe(e){const t=Array.from(e);let n=t.length;for(;n>0;){const o=t[n-1];if(ou.test(o))n--;else{if(!$2.has(o)&&!b5.has(o))break;n--}}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function sfe(e,t,n){return n!=="text"||t||e.length!==1||e==="-"||e==="—"?null:e}function D_(e,t,n,o){const s=t[o],i=e[o];if(s==null)return i;const r=n[o];if(i.length===r)return i;const l=s.repeat(r);return e[o]=l,l}function B_(e,t){return e&&t!==null&&G1e.has(t)}function ife(e){const t=tp(e);return t!==null&&Y1e.has(t)}function rfe(e){if(e.length<2||e[0]!==" ")return null;const t=e.slice(1);return new RegExp("^\\p{M}+$","u").test(t)?{space:" ",marks:t}:null}function a8(e){let t=e.length;for(;t>0;){const n=pg(e,t),o=e.slice(n,t);if(X1e.has(o))return!0;if(!bc.has(o))return!1;t=n}return!1}function lfe(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===` `)return"hard-break"}return e===" "?"space":e===" "||e===" "||e==="⁠"||e==="\uFEFF"?"glue":e==="​"?"zero-width-break":e==="­"?"soft-hyphen":"text"}const afe=/[\x20\t\n\xA0\xAD\u200B\u202F\u2060\uFEFF]/;function Or(e){return e.length===1?e[0]:e.join("")}function ufe(e,t){const n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),Or(n)}function cfe(e,t,n,o){if(!afe.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];const s=[];let i=null,r=[],l=n,a=!1,u=0;for(const c of e){const d=lfe(c,o),f=d==="text"&&t;i===null||d!==i||f!==a?(i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),i=d,r=[c],l=n+u,a=f,u+=c.length):(r.push(c),u+=c.length)}return i!==null&&s.push({text:Or(r),isWordLike:a,kind:i,start:l}),s}function Q9(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}const dfe=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function ffe(e,t){const n=e.texts[t];return!!n.startsWith("www.")||dfe.test(n)&&t+1=33&&n<=47&&n!==45||n>=58&&n<=64&&n!==63||n>=91&&n<=96||n>=123&&n<=126})(t):!vfe.has(e)&&!gfe.test(e)&&mfe.test(e)}function H_(e){let t=!1;for(const n of e)if(!ou.test(n)){if(!_$(n))return!1;t=!0}return t}function yfe(e,t,n,o){const s=!t&&H_(e),i=!o&&H_(n),r=(function(a){const u=(function(c){for(let d=c.length;d>0;){const f=pg(c,d),h=c.slice(f,d);if(!ou.test(h))return h;d=f}return null})(a);return u!==null&&hg(u)})(e),l=(t||r)&&(function(a){for(let u=a.length;u>0;){const c=pg(a,u),d=a.slice(c,u);if(!ou.test(d))return _$(d)||hg(d);u=c}return!1})(e);return!!(s||i||l)&&!kl(e)&&!kl(n)&&(t||s||r)&&(o||i)}function z_(e){for(const t of e)if(y5.test(t))return!0;return!1}function rm(e){if(e.length===0)return!1;for(const t of e)if(!y5.test(t)&&!hfe.has(t))return!1;return!0}function kfe(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];const n=[];let o=0;for(let s=0;s0&&u.charCodeAt(u.length-1)===32&&(u=u.slice(0,-1)),u})(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};const r=(function(a,u,c){var d,f,h;const m=(J9===null&&(J9=new Intl.Segmenter(void 0,{granularity:"word"})),J9);let v=0;const k=[],w=[],b=[],_=[],g=[],x=[],S=[],T=[],A=[],E=[],P=[],D=[];for(const O of m.segment(a))for(const F of cfe(O.segment,(d=O.isWordLike)!=null&&d,O.index,c)){let U=function(){x[le]!==null&&(w[le]=[D_(k,x,S,le)],x[le]=null),w[le].push(F.text),b[le]=b[le]||F.isWordLike,T[le]=T[le]||K,A[le]=A[le]||V,E[le]=ne,P[le]=X,D[le]=B_(A[le],ie)};const z=F.kind==="text",W=sfe(F.text,F.isWordLike,F.kind),K=kl(F.text),V=O_(F.text),ie=tp(F.text),ne=a8(F.text),X=ife(F.text),le=v-1;u.carryCJKAfterClosingQuote&&z&&v>0&&_[le]==="text"&&K&&T[le]&&E[le]||z&&v>0&&_[le]==="text"&&Q1e(F.text)&&T[le]||z&&v>0&&_[le]==="text"&&P[le]?U():z&&v>0&&_[le]==="text"&&F.isWordLike&&V&&D[le]?(U(),b[le]=!0):W!==null&&v>0&&_[le]==="text"&&x[le]===W?S[le]=((f=S[le])!=null?f:1)+1:z&&!F.isWordLike&&v>0&&_[le]==="text"&&!T[le]&&(J1e(F.text)||F.text==="-"&&b[le])?U():(k[v]=F.text,w[v]=[F.text],b[v]=F.isWordLike,_[v]=F.kind,g[v]=F.start,x[v]=W,S[v]=W===null?0:1,T[v]=K,A[v]=V,E[v]=ne,P[v]=X,D[v]=B_(V,ie),v++)}for(let O=0;Onull);let $=-1;for(let O=v-1;O>=0;O--){const F=k[O];if(F.length!==0){if(_[O]==="text"&&!b[O]&&$>=0&&_[$]==="text"&&(efe(F)||F==="-"&&nfe(k[$]))){const U=(h=I[$])!=null?h:[];U.push(F),I[$]=U,g[$]=g[O],k[O]="";continue}$=O}}for(let O=0;OK+1){F.push(Or(X)),U.push(Ie),z.push("text"),W.push(O.starts[K]),K=le;continue}}F.push(V),U.push(ne),z.push(ie),W.push(O.starts[K]),K++}return{len:F.length,texts:F,isWordLike:U,kinds:z,starts:W}})((function(O){const F=[],U=[],z=[],W=[];for(let K=0;K1;for(let X=0;X=O.len||Q9(O.kinds[ie]))continue;const ne=[],X=O.starts[ie];let le=ie;for(;le0&&(F.push(Or(ne)),U.push(!0),z.push("text"),W.push(X),K=le-1)}return{len:F.length,texts:F,isWordLike:U,kinds:z,starts:W}})((function(O){const F=O.texts.slice(),U=O.isWordLike.slice(),z=O.kinds.slice(),W=O.starts.slice();for(let V=0;V=0&&!w$(u.texts[_-1],c)&&b(_),v<0&&(v=_),k=k||kl(g))}return b(u.len),{len:d.length,texts:d,isWordLike:f,kinds:h,starts:m}})(i,r,t.breakKeepAllAfterPunctuation):r;return mt({normalized:i,chunks:kfe(l,s)},l)}let ld=null;const W_=new Map;let ad=null;const Cfe=new RegExp("\\p{Emoji_Presentation}","u"),wfe=/[\p{Emoji_Presentation}\p{Extended_Pictographic}\p{Regional_Indicator}\uFE0F\u20E3]/u;let e4=null;const U_=new Map;function u8(){if(ld!==null)return ld;if(typeof OffscreenCanvas<"u")return ld=new OffscreenCanvas(1,1).getContext("2d"),ld;if(typeof document<"u")return ld=document.createElement("canvas").getContext("2d"),ld;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function Sa(e,t){let n=t.get(e);return n===void 0&&(n={width:u8().measureText(e).width,containsCJK:kl(e)},t.set(e,n)),n}function mg(){if(ad!==null)return ad;if(typeof navigator>"u")return ad={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,breakKeepAllAfterPunctuation:!0,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ad;const e=navigator.userAgent,t=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),n=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return ad={lineFitEpsilon:t?1/64:.005,carryCJKAfterClosingQuote:n,breakKeepAllAfterPunctuation:!t,preferPrefixWidthsForBreakableRuns:t,preferEarlySoftHyphenBreak:t},ad}function x$(){return e4===null&&(e4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),e4}function _fe(e){return Cfe.test(e)||e.includes("️")}function Ou(e,t,n){return n===0?t.width:t.width-(function(o,s){return s.emojiCount===void 0&&(s.emojiCount=(function(i){let r=0;const l=x$();for(const a of l.segment(i))_fe(a.segment)&&r++;return r})(o)),s.emojiCount})(e,t)*n}function xfe(e){return e==="space"||e==="zero-width-break"||e==="soft-hyphen"}function j_(e){return e==="space"||e==="preserved-space"||e==="tab"||e==="zero-width-break"||e==="soft-hyphen"}function V_(e,t,n=e.widths.length){for(;t0?e.letterSpacing:0}function w5(e,t){return t===0?0:e+t}function Mfe(e,t,n,o,s){return w5(o,t==="tab"?s+(function(i,r){return i.letterSpacing!==0&&i.spacingGraphemeCounts[r]>0?i.letterSpacing:0})(e,n):e.lineEndFitAdvances[n])}function q_(e,t,n,o){return w5(o,t==="tab"?0:e.lineEndFitAdvances[n])}function K_(e,t,n,o,s){return w5(o,t==="tab"?s:e.lineEndPaintAdvances[n])}function Tfe(e,t,n){return e.letterSpacing!==0&&t?n+e.letterSpacing:n}function Efe(e,t){return e.letterSpacing===0?t:t+e.letterSpacing}function wh(e,t,n){let o=t;for(;oU){if(we!==null&&Q>G){le(ye,Q,te),ce=Q,ge=wh(we,ge,ce+1),Q=-1,te=0;continue}le(),de(ye,ce,ue)}else W+=ue,V=ye,ie=ce+1;else de(ye,ce,ue);const Se=ce+1;we!==null&&we[ge]===Se&&(Q=Se,te=W,ge++),ce++}K&&V===ye&&ie===fe.length&&(V=ye+1,ie=0)}let oe=0;for(;oe=B.length)));){const ye=B[oe],G=j_(H[oe]);if(K)if(W+ye>U){if(G){pe(oe,ye),le(oe+1,0,W-ye),oe++;continue}if(ne>=0){if(V>ne||V===ne&&ie>0){le();continue}le(ne,0,X);continue}if(ye>U&&O[oe]!==null){le(),ve(oe,0),oe++;continue}le()}else pe(oe,ye),G&&(ne=oe+1,X=W-ye),oe++;else ye>U&&O[oe]!==null?ve(oe,0):Ie(oe,ye),G&&(ne=oe+1,X=W-ye),oe++}return K&&le(),z})(n,o);const{widths:s,kinds:i,breakableFitAdvances:r,breakablePreferredBreaks:l,discretionaryHyphenWidth:a,chunks:u}=n;if(s.length===0||u.length===0)return 0;const c=mg(),d=o+c.lineFitEpsilon;let f=0,h=0,m=!1,v=0,k=0,w=-1,b=0,_=null;function g(){w=-1,b=0,_=null}function x(I=v,$=k,B){f++,h=0,m=!1,g()}function S(I,$){m=!0,v=I+1,k=0,h=$}function T(I,$,B){m=!0,v=I,k=$+1,h=B}function A(I,$){m?(h+=$,v=I+1,k=0):S(I,$)}function E(I,$,B,H,O,F){if(!$)return;const U=q_(n,I,B,O);K_(n,I,B,O,H),w=B+1,b=h-F+U,_=I}function P(I,$){var B;const H=r[I],O=(B=l[I])!=null?B:null;let F=O===null?-1:wh(O,0,$+1),U=-1,z=$;for(;zd){if(O!==null&&U>$){x(I,U),z=U,F=wh(O,F,z+1),U=-1;continue}x(),T(I,z,W)}else h=ie,v=I,k=z+1}else T(I,z,W);const K=z+1;O!==null&&O[F]===K&&(U=K,F++),z++}m&&v===I&&k===H.length&&(v=I+1,k=0)}function D(I){f++,g()}for(let I=0;I=$.endSegmentIndex)));){const H=i[B],O=j_(H),F=Afe(n,m,B),U=H==="tab"?Sfe(h+F,n.tabStopAdvance):s[B],z=F+U,W=Mfe(n,H,B,F,U);if(H!=="soft-hyphen")if(m){if(h+W>d){const K=h+q_(n,H,B,F);if(K_(n,H,B,F,U),_==="soft-hyphen"&&c.preferEarlySoftHyphenBreak&&b<=d){x(w,0);continue}if(O&&K<=d){A(B,z),x(B+1,0),B++;continue}if(w>=0&&b<=d){if(v>w||v===w&&k>0){x();continue}const V=w;x(V,0),B=V;continue}if(W>d&&r[B]!==null){x(),P(B,0),B++;continue}x();continue}A(B,z),E(H,O,B,U,F,z),B++}else W>d&&r[B]!==null?P(B,0):S(B,U),E(H,O,B,U,F,z),B++;else m&&(v=B+1,k=0,w=B+1,b=h+a,_=H),B++}m&&($.consumedEndSegmentIndex,x($.consumedEndSegmentIndex,0))}return f})(e,t)}let t4=null;function _5(){return t4===null&&(t4=new Intl.Segmenter(void 0,{granularity:"grapheme"})),t4}function Lfe(e,t){const n=[];let o=[],s=0,i=!1,r=!1,l=!1;function a(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:s}),o=[],i=!1,r=!1,l=!1)}function u(d,f,h){o=[d],s=f,i=h,r=a8(d),l=$2.has(d)}function c(d,f){o.push(d),i=i||f;const h=a8(d);r=d.length===1&&bc.has(d)&&r||h,l=!1}for(const d of _5().segment(e)){const f=d.segment,h=kl(f);o.length!==0?l||k5.has(f)||bc.has(f)||t.carryCJKAfterClosingQuote&&h&&r?c(f,h):i||h?(a(),u(f,d.index,h)):c(f,h):u(f,d.index,h)}return a(),n}function $fe(e,t,n){if(t.length<=1)return t;const o=[];let s=-1,i=!1;function r(l){if(!(s<0)){if(i)s+1===l?o.push(t[s]):(function(a,u){const c=t[a].start,d=u=0&&!w$(t[l-1].text,n)&&r(l),s<0&&(s=l),i=i||kl(a.text)}return r(t.length),o}function Z_(e,t){if(t==="zero-width-break"||t==="soft-hyphen"||t==="hard-break")return 0;if(t==="tab")return 1;let n=0;const o=_5();for(const s of o.segment(e))n++;return n}function Nfe(e){return e==="-"||e==="֊"||e==="‐"||e==="‒"||e==="–"||e==="—"}function Ffe(e,t,n,o,s){const i=mg(),{cache:r,emojiCorrection:l}=(function(D,I){u8().font=D;const $=(function(O){let F=W_.get(O);return F||(F=new Map,W_.set(O,F)),F})(D),B=(function(O){const F=O.match(/(\d+(?:\.\d+)?)\s*px/);return F?parseFloat(F[1]):16})(D),H=I?(function(O,F){let U=U_.get(O);if(U!==void 0)return U;const z=u8();z.font=O;const W=z.measureText("😀").width;if(U=0,W>F+.5&&typeof document<"u"&&document.body!==null){const K=document.createElement("span");K.style.font=O,K.style.display="inline-block",K.style.visibility="hidden",K.style.position="absolute",K.textContent="😀",document.body.appendChild(K);const V=K.getBoundingClientRect().width;document.body.removeChild(K),W-V>.5&&(U=W-V)}return U_.set(O,U),U})(D,B):0;return{cache:$,fontSize:B,emojiCorrection:H}})(t,(a=e.normalized,wfe.test(a)));var a;const u=Ou("-",Sa("-",r),l)+(s===0?0:2*s),c=8*Ou(" ",Sa(" ",r),l),d=s!==0;if(e.len===0)return{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],breakablePreferredBreaks:[],letterSpacing:0,spacingGraphemeCounts:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]};const f=[],h=[],m=[],v=[];let k=e.chunks.length<=1&&!d;const w=null,b=[],_=[],g=[],x=null,S=Array.from({length:e.len});function T(D,I,$,B,H,O,F,U,z){H!=="text"&&H!=="space"&&H!=="zero-width-break"&&(k=!1),f.push(I),h.push($),m.push(B),v.push(H),b.push(F),_.push(U),d&&g.push(z)}function A(D,I,$,B,H){const O=Sa(D,r),F=d?Z_(D,I):0,U=(function(V,ie,ne){return ie>1?V+(ie-1)*ne:V})(Ou(D,O,l),F,s),z=I==="space"||I==="preserved-space"||I==="zero-width-break"?0:U,W=z===0?0:z+(F>0?s:0),K=I==="space"||I==="zero-width-break"?0:U;if(H&&B&&D.length>1){let V="sum-graphemes";s!==0?V="segment-prefixes":rm(D)?V="pair-context":i.preferPrefixWidthsForBreakableRuns&&(V="segment-prefixes");const ie=(function(X,le,Ie,de,pe){if(le.breakableFitAdvances!==void 0&&le.breakableFitMode===pe)return le.breakableFitAdvances;le.breakableFitMode=pe;const ve=x$(),oe=[];for(const fe of ve.segment(X))oe.push(fe.segment);if(oe.length<=1)return le.breakableFitAdvances=null,le.breakableFitAdvances;if(pe==="sum-graphemes"){const fe=[];for(const we of oe){const ge=Sa(we,Ie);fe.push(Ou(we,ge,de))}return le.breakableFitAdvances=fe,le.breakableFitAdvances}if(pe==="pair-context"||oe.length>96){const fe=[];let we=null,ge=0;for(const Q of oe){const te=Ou(Q,Sa(Q,Ie),de);if(we===null)fe.push(te);else{const ce=we+Q,ue=Sa(ce,Ie);fe.push(Ou(ce,ue,de)-ge)}we=Q,ge=te}return le.breakableFitAdvances=fe,le.breakableFitAdvances}const ye=[];let G="",Y=0;for(const fe of oe){G+=fe;const we=Ou(G,Sa(G,Ie),de);ye.push(we-Y),Y=we}return le.breakableFitAdvances=ye,le.breakableFitAdvances})(D,O,r,l,V),ne=ie===null||o==="keep-all"?null:(function(X){if(!/[-\u058A\u2010\u2012\u2013\u2014]/u.test(X))return null;const le=[];let Ie=0;for(const de of _5().segment(X))Ie++,Nfe(de.segment)&&le.push(Ie);return le.length===0?null:le})(D);return void T(D,U,W,K,I,$,ie,ne,F)}T(D,U,W,K,I,$,null,null,F)}for(let D=0;D=55296&&X<=56319&&ne+1=56320&&pe<=57343&&(le=pe-56320+(X-55296<<10)+65536,Ie=2)}const de=U1e(le);de!=="R"&&de!=="AL"&&de!=="AN"||(U=!0);for(let pe=0;pe=0&&F[X]==="ET";X--)F[X]="EN";for(X=ne+1;X0?F[ne-1]:V)!=="L"?"R":"L";if(le===((X{const e=globalThis;if(e[n4])return e[n4];const t={configs:{},controllers:{},revision:Xr(0),preparedCache:new Map,blockEstimateCache:new Map};return e[n4]=t,t})();let lf=null;const o4=ys.revision;function G_(e){var t;return e&&(t=ys.configs[e])!=null?t:null}function Y_(e,t){const n=Number.parseFloat(String(e??""));return Number.isFinite(n)&&n>0?n:t}function Ofe(e){return e?.type==="text"||e?.type==="emoji"||e?.type==="hardbreak"}function s4(e){var t,n,o;if(!Array.isArray(e)||e.length===0)return null;let s="";for(const i of e){if(!Ofe(i))return null;i.type==="text"?s+=String((t=i.content)!=null?t:""):i.type==="emoji"?s+=String((o=(n=i.name)!=null?n:i.raw)!=null?o:""):i.type==="hardbreak"&&(s+=` @@ -321,14 +321,14 @@ ${_}`);c+=T}else c+=S;c+=w,d=h?f+1:e.length}return c}function Yue(e,t){if(!e||!t `,t-1)+1;return e.slice(n,t).trim()}function lx(e){const t=I$(e);return t.length>=2&&t.every(n=>{const o=n.trim();return o.length>=1&&o.replace(/^:/,"").replace(/:$/,"").split("").every(s=>s==="-")})}function I$(e){return e.includes("|")?e.replace(/^\|/,"").replace(/\|$/,"").split("|"):[]}function L$(e){let t=2166136261;for(let n=0;n>>0).toString(36)}function x5(e){const t=String(e??"");return`${t.length}:${L$(t)}`}function d8(e,t=new WeakMap,n=0){if(e==null||typeof e=="number"||typeof e=="boolean")return String(e);if(typeof e=="string")return`s:${(function(r){return r.length<=8192?x5(r):`${r.length}:${L$(r.slice(0,8192))}:truncated`})(e)}`;if(typeof e=="function")return`fn:${Qi(e)}`;if(typeof e!="object")return typeof e;const o=e,s=t.get(o);if(s)return`cycle:${s}`;if(n>=6)return`object:${Qi(o)}`;const i=Qi(o);if(t.set(o,i),Array.isArray(e)){const r=e.slice(0,200);return`a:${e.length}:${r.map(l=>d8(l,t,n+1)).join(",")}`}if(typeof e=="object"){const r=e,l=Object.keys(r).sort(),a=l.slice(0,80);return`o:${l.length}:${a.sort().map(u=>`${u}:${d8(r[u],t,n+1)}`).join(";")}`}return typeof e}function gg(e){return typeof e=="object"&&e!==null&&typeof e.type=="string"&&typeof e.raw=="string"}function $$(e,t=new WeakMap,n=0){return Array.isArray(e)?`a:${e.length}:${e.slice(0,200).map(o=>gg(o)?su(o,t,n+1):$$(o,t,n+1)).join(",")}`:gg(e)?su(e,t,n):d8(e,t,n)}function Kfe(e,t,n){return Object.keys(e).sort().filter(o=>o!=="children"&&!E$.includes(o)).map(o=>{const s=e[o];return typeof s=="string"?`${o}=s:${x5(s)}`:typeof s=="number"||typeof s=="boolean"||s==null?`${o}=${String(s)}`:typeof s=="function"?`${o}=fn:${Qi(s)}`:Vfe.has(o)&&(Array.isArray(s)||typeof s=="object")?`${o}=${$$(s,t,n+1)}`:s&&typeof s=="object"?`${o}=object:${Qi(s)}`:""}).filter(Boolean).join(";")}function Zfe(e){return E$.map(t=>{const n=e[t];return typeof n=="string"?`${t}=s:${x5(n)}`:""}).filter(Boolean).join(";")}function su(e,t=new WeakMap,n=0){const o=ox.get(e);if(o)return o;const s=e,i=t.get(s);if(i)return`node-cycle:${i}`;if(n>=6)return`node:${e.type}:${Qi(s)}`;const r=Qi(s);t.set(s,r);const l=(function(a,u,c){const d=a,f=Array.isArray(d.children)?d.children:[],h=f.length?f.slice(0,200).map(m=>su(m,u,c+1)).join("|"):"";return[a.type,Zfe(d),Kfe(d,u,c),f.length,h].join(":")})(e,t,n);return ox.set(s,l),l}function N$(e,t){return su(e)===su(t)}function S5(e,t,n){const o=Rr(),s=t==="stabilizeSignatureMs"?"stabilizeSignatureCallCount":"primeSignatureCallCount";try{return n()}finally{e[t]+=Rr()-o,e[s]+=1,e.signatureMs=e.stabilizeSignatureMs+e.primeSignatureMs,e.signatureCallCount=e.stabilizeSignatureCallCount+e.primeSignatureCallCount}}function ax(e,t,n){return S5(t,n,()=>su(e))}function F$(e,t,n){return ax(e,n,"stabilizeSignatureMs")===ax(t,n,"stabilizeSignatureMs")}function _h(e){return{reusedNodeCount:0,dirtyStartIndex:e>0?0:-1,stablePrefixNodeCount:0,dirtyTailNodeCount:e}}function ux(e,t,n){return e<0?0:Math.max(t.length,n.length)-e}function cx(e){return e.__markstreamHasCustomParserExtensions===!0||(function(t){var n;return Number((n=t.__markstreamRegisteredPluginCount)!=null?n:0)>0})(e)}function Gfe(e,t){return e.length===t.length&&e===t}function A5(e,t,n=0){if(n>=4)return null;if(e.type!==t.type)return!1;const o=e,s=t,i=Object.keys(o).filter(c=>c!=="type"&&c!=="children").sort(),r=Object.keys(s).filter(c=>c!=="type"&&c!=="children").sort();if(i.length!==r.length)return!1;for(let c=0;c{o=A5(e,t)}),o??F$(e,t,n)}function Jfe(e,t){const n={};for(const o of Ufe){const s=e[o],i=t?.[o];typeof s=="number"&&(n[o]=s-(typeof i=="number"?i:0))}return n}function Qfe(e,t){var n;const o=l_(t.instanceMsgId),s=new Map,i=(n=t.smoothStreamingEnabled)!=null?n:R(()=>!1),r=Z(t.renderContent.value);let l=[],a="",u="",c="",d=!1;const f=(function(){let B="",H=0,O=!1,F=!1,U=!1,z=!1;function W(){B="",H=0,O=!1,F=!1,U=!1,z=!1}function K(V){let ie=!1;for(let ne=0;ne{if(!V||!ie.startsWith(V)||ie.length<=V.length)return W(),[!0,0];let ne=0;B!==V&&(W(),K(V),ne=V.length);const X=ie.slice(V.length),le=K(X);return B=ie,[le,ne+X.length]}})();let h,m=0,v=0,k=Rr(),w=-1,b=0;function _(B){w=Number.isInteger(B)?B:0,b+=1}function g(){h&&(clearTimeout(h),h=void 0)}function x(){g();const B=t.renderContent.value;r.value!==B&&(r.value=B),k=Rr()}Je([t.renderContent,t.effectiveFinal,i],([B,H,O])=>{r.value!==B&&(!O||H||(function(F,U){if(!F&&U||U.length<=80||U.length\s*|`{3,}|~{3,})/.test(z))||z.endsWith(` -`)&&!(function(W){const K=rx(W);if(lx(K))return!1;const V=I$(K);return V.length>=2&&V.some(ie=>ie.trim())})(U))})(r.value,B)?x():(function(){if(v+=1,h)return;const F=Math.max(0,(function(U){const z=U.parseCoalesceMs;return typeof z=="number"&&Number.isFinite(z)&&z>=0?z:80})(e)-(Rr()-k));F<=0?x():h=setTimeout(x,F)})())},{flush:"sync",immediate:!0}),d1(g);const S=R(()=>{var B,H,O,F;return cie(e.customHtmlTags,(B=e.parseOptions)==null?void 0:B.customHtmlTags,(F=(O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{},Object.entries(F).map(([U,z])=>{const W=Sr(U);return z==null||!W||Qp(W)||WI.has(W)||Zp.has(W)?"":W}).filter(Boolean)))}),T=R(()=>{const{key:B,tags:H}=die(S.value);if(!B)return o;const O=s.get(B);if(O)return O;const F=l_(t.instanceMsgId,{customHtmlTags:H});return s.set(B,F),F}),A=R(()=>{const B=T.value;if(!e.customMarkdownIt)return B;const H=e.customMarkdownIt(B);return B.__markstreamHasCustomParserExtensions=!0,H.__markstreamHasCustomParserExtensions=!0,H}),E=R(()=>{var B,H;const O=(B=e.parseOptions)!=null?B:{},F=t.effectiveFinal.value,U=S.value,z=F!=null,W=U.length>0;return z||W||O.streamParse==null?mt(mt(rn(mt({},O),{streamParse:(H=O.streamParse)==null||H}),z?{final:F}:{}),W?{customHtmlTags:U}:{}):O}),P=R(()=>{var B;return new Set(((B=E.value.customHtmlTags)!=null?B:[]).map(H=>String(H).trim().toLowerCase()).filter(Boolean))}),D=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!0})),I=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!1}));Je([D,I],([B,H],[O,F])=>{O&&(B===O&&H===F||(x(),H!==F&&(l=[],c="")))},{flush:"sync"});const $=R(()=>{var B,H,O,F,U,z,W,K,V,ie,ne;if((B=e.nodes)!=null&&B.length)return l=[],c="",_(0),kt(e.nodes.slice());const X=r.value;if(!X)return l=[],c="",_(-1),[];const le=t.debugPerformanceEnabled.value,Ie=le?Rr():0,de=A.value,pe=D.value,ve=I.value;a&&pe!==a&&(function(Fe){var Oe,Ge;(Ge=(Oe=Fe.stream)==null?void 0:Oe.reset)==null||Ge.call(Oe)})(de),u&&ve!==u&&(l=[],c="");const oe=Object.keys((O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{}).length>0||typeof E.value.postTransformNodes=="function";oe!==d&&(l=[],c="");const ye=!oe&&l.length>0&&X.startsWith(c)&&ve===u,G=le?sx(de):null,Y=le?{}:void 0,fe=cx(de),we=!fe&&!oe,ge=mt(mt(rn(mt({},E.value),{__reuseStableTopLevelNodes:we}),fe?{__disableStreamParse:!0}:{}),Y?{__timing:Y}:{}),Q=UL(X,de,ge),te=le?Rr():0,ce=le?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ue,Se=le?_h(Q.length):void 0,ze=0,_e=0,Ee=0;if(ye){const Fe=le?Rr():0,[Oe,Ge]=(function(Tt){var Bt,Yt;const[Sn,on]=Tt.scanGlobalReferenceAppend(Tt.previousContent,Tt.content),en=Tt.parseOptions;return[Tt.previousDirtyStartIndex>0&&en.final!==!0&&!Tt.customMarkdownIt&&!cx(Tt.md)&&!Sn&&typeof en.preTransformTokens!="function"&&typeof en.postTransformTokens!="function"&&typeof en.postTransformNodes!="function"&&((Yt=(Bt=en.customHtmlTags)==null?void 0:Bt.length)!=null?Yt:0)===0?Tt.previousDirtyStartIndex:0,on]})({content:X,previousContent:c,previousDirtyStartIndex:w,parseOptions:E.value,customMarkdownIt:e.customMarkdownIt,md:de,scanGlobalReferenceAppend:f});Ee=Ge;const at=Oe<=0;if(ce){const Tt=(function(Bt,Yt,Sn,on={}){var en;if(!Yt.length)return{nodes:Bt,metrics:_h(Bt.length)};const Cn=(en=on.scanStartIndex)!=null?en:0,Mn=on.reuseDirtyTail!==!1,We=(function(Lt,gt,wn,yn=0){const go=Math.min(Lt.length,gt.length);for(let qt=Math.min(go,Math.max(0,yn));qtsu(Fe[at]))})(ue,ce,_e):(function(Fe,Oe=0){for(let Ge=Math.max(0,Oe);Ge((U=G?.total)!=null?U:0);t.logPerf(Oe?"parse(stream)":"parse(sync)",mt(mt(mt({rendererId:t.instanceMsgId,ms:Math.round(Rr()-Ie),nodes:ue.length,contentLength:X.length,parseCommitCount:m,parseCoalescedCount:v,nodeReuseMs:it,referenceDefinitionScanChars:Ee,signatureMs:(z=ce?.signatureMs)!=null?z:0,stabilizeSignatureMs:(W=ce?.stabilizeSignatureMs)!=null?W:0,primeSignatureMs:(K=ce?.primeSignatureMs)!=null?K:0,signatureCallCount:(V=ce?.signatureCallCount)!=null?V:0,stabilizeSignatureCallCount:(ie=ce?.stabilizeSignatureCallCount)!=null?ie:0,primeSignatureCallCount:(ne=ce?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:ze},Se??{}),Y?Object.fromEntries(jfe.map(Ge=>{var at;return[Ge,(at=Y[Ge])!=null?at:0]})):{}),Fe?{streamMode:Fe.lastMode,streamDelta:Jfe(Fe,G),streamStats:Fe}:{}))}return kt(ue)});return{effectiveCustomHtmlTags:S,effectiveCustomHtmlTagsSet:P,mdBase:T,mdInstance:A,mergedParseOptions:E,getParsedNodesDirtyStartIndex:()=>w,getParsedNodesRevision:()=>b,parsedNodes:$}}function epe(e){const{isClient:t}=e,n=Z(new Set),o=new Map,s=new Map,i=new Map;function r(u){if(!t)return;const c=i.get(u);c!=null&&(window.clearTimeout(c),i.delete(u))}function l(){if(t)for(const u of i.values())window.clearTimeout(u);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(u,c=!0){var d;c&&r(u),(function(f,h){if((v=(m=e.shouldTrackVisibleNodeIndices)==null?void 0:m.call(e))!=null&&!v)return;var m,v;const k=n.value,w=k.has(f);if(h){if(w)return;const _=new Set(k);return _.add(f),void(n.value=_)}if(!w)return;const b=new Set(k);b.delete(f),n.value=b})(u,c),c&&((d=e.onNodeMarkedVisible)==null||d.call(e,u))},resetNodeVisibleState:a,cleanupNodeVisibility:function(u){var c;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f{const c=s.getSnapshot();t.value=c.source,n.value=c.visible,o.value=c.done},r=s.subscribe(i);i();const l=R(()=>Math.max(0,t.value.length-n.value.length)),a=R(()=>l.value===0),u=R(()=>o.value&&a.value);return Kg()&&d1(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:u,caughtUp:a,pendingChars:l,enqueue:c=>s.enqueue(c),finish:c=>s.finish(c),flush:()=>s.flush(),reset:c=>s.reset(c),pause:()=>s.pause(),resume:()=>s.resume()}}const npe={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},dx=/auto|scroll|overlay/i;function ope(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return dx.test(t)||dx.test(n)}function spe(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const ipe={class:"m-0 p-0"},rpe=["data-probe"],lpe=Gn(et(rn(mt({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(y(),M("div",{class:"height-estimation-probes",style:Zt({width:`${e.width}px`}),"aria-hidden":"true"},[C("div",{ref:i=>e.setParagraphWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[j(p(cc),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),C("div",{ref:i=>e.setListItemWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[C("ul",ipe,[j(p(Vd),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),C("div",{ref:i=>e.setListWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[j(p(qd),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(y(),M(Pe,null,pt(6,i=>C("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[j(p(L2),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,rpe)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),fx=et({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return ag((o=Md(e.estimatedPreviewHeightPx))!=null?o:rg(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),tn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),tn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,tn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"absolute inset-0"},[tn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),px=et({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return lg((o=Md(e.estimatedPreviewHeightPx))!=null?o:ig(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),tn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[tn("span",{class:"action-icon block"})])))]):null,tn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),ape={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function As(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const upe=["data-custom-id"],cpe=["data-node-index","data-node-type"],hx="typewriter-simple-cursor-target",R$=Gn(et(rn(mt({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(L){if(!(typeof Event<"u"&&L instanceof Event))return typeof L=="string"&&s("copy-code",L),void s("copy",L)}const r=ds(),l=nn("markstreamNestedRendererProps",void 0);function a(L){const q=r?.vnode.props;return!!q&&(Object.prototype.hasOwnProperty.call(q,L)||Object.prototype.hasOwnProperty.call(q,String(L).replace(/[A-Z]/g,re=>`-${re.toLowerCase()}`)))}function u(L){var q,re;const ae=o[L];return a(L)?ae:(re=(q=l?.value)==null?void 0:q[L])!=null?re:ae}const c=R(()=>{return(L=u("mode"))==="chat"||L==="minimal"||L==="docs"?L:"docs";var L}),d=R(()=>ex(u("typewriter"))),f=R(()=>d.value!=="off"),h=R(()=>u("domMode")==="minimal"?"minimal":"full"),m=R(()=>{return(L={mode:c.value,codeRenderer:u("codeRenderer"),renderCodeBlocksAsPre:u("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":L.codeRenderer==="pre"||L.codeRenderer==="shiki"||L.codeRenderer==="monaco"?L.codeRenderer:L.renderCodeBlocksAsPre===!1||L.mode==="docs"?"monaco":"pre";var L}),v=R(()=>ape[c.value]),k=R(()=>{var L;return(L=u("showTooltips"))!=null?L:v.value.showTooltips}),w=R(()=>{var L;return(L=u("fade"))!=null?L:v.value.fade}),b=R(()=>{var L;return(L=u("batchRendering"))!=null?L:v.value.batchRendering}),_=R(()=>{var L;return(L=u("initialRenderBatchSize"))!=null?L:v.value.initialRenderBatchSize}),g=R(()=>{var L;return(L=u("renderBatchSize"))!=null?L:v.value.renderBatchSize}),x=R(()=>{var L;return(L=u("renderBatchDelay"))!=null?L:v.value.renderBatchDelay}),S=R(()=>{var L;return(L=u("renderBatchBudgetMs"))!=null?L:v.value.renderBatchBudgetMs}),T=R(()=>{var L;return(L=u("renderBatchIdleTimeoutMs"))!=null?L:v.value.renderBatchIdleTimeoutMs}),A=R(()=>{var L;return(L=u("deferNodesUntilVisible"))!=null?L:v.value.deferNodesUntilVisible}),E=R(()=>{var L;return(L=u("maxLiveNodes"))!=null?L:v.value.maxLiveNodes}),P=R(()=>{var L;return(L=u("liveNodeBuffer"))!=null?L:v.value.liveNodeBuffer}),D=R(()=>{var L;return(L=u("nodeVirtual"))!=null?L:v.value.nodeVirtual}),I={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return u("parseOptions")},get customMarkdownIt(){return u("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return u("customHtmlTags")},get mode(){return u("mode")},get domMode(){return h.value},get htmlPolicy(){return u("htmlPolicy")},get viewportPriority(){return u("viewportPriority")},get viewportPriorityOptions(){return u("viewportPriorityOptions")},get codeBlockStream(){return u("codeBlockStream")},get codeBlockDarkTheme(){return u("codeBlockDarkTheme")},get codeBlockLightTheme(){return u("codeBlockLightTheme")},get codeBlockMonacoOptions(){return u("codeBlockMonacoOptions")},get codeRenderer(){return u("codeRenderer")},get renderCodeBlocksAsPre(){return u("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return u("codeBlockMinWidth")},get codeBlockMaxWidth(){return u("codeBlockMaxWidth")},get codeBlockProps(){return u("codeBlockProps")},get mermaidProps(){return u("mermaidProps")},get d2Props(){return u("d2Props")},get infographicProps(){return u("infographicProps")},get showTooltips(){return k.value},get themes(){return u("themes")},get langs(){return u("langs")},get isDark(){return u("isDark")},get customId(){return u("customId")},get indexKey(){return o.indexKey},get typewriter(){return u("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return u("smoothStreamingOptions")},get parseCoalesceMs(){return u("parseCoalesceMs")},get fade(){return w.value},get batchRendering(){return b.value},get initialRenderBatchSize(){return _.value},get renderBatchSize(){return g.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return S.value},get renderBatchIdleTimeoutMs(){return T.value},get deferNodesUntilVisible(){return A.value},get maxLiveNodes(){return E.value},get liveNodeBuffer(){return P.value},get nodeVirtual(){return D.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function $(L){s("height-change",L)}function B(L){s("virtual-state-change",L)}function H(L){s("anchor-change",L)}const O=Z(),F=Z(null),U=Z(null),z=Z(null),W=Go({1:null,2:null,3:null,4:null,5:null,6:null}),K=Z(!1),V=new Map,ie=Z(0),ne=Z(0),X=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function le(L,q){return typeof L!="string"?q:L.trim()||q}function Ie(L){const q=Number(L);return Number.isFinite(q)&&q>0?Math.max(1,Math.trunc(q)):640}const de=R(()=>{var L;const q=(L=I.viewportPriorityOptions)!=null?L:{},re=le(q.rootMargin,yc);return{rootMargin:re,heavyBlockMargin:le(q.heavyBlockMargin,re),maxTargets:Ie(q.maxTargets)}}),pe=R(()=>{var L;return(L=de.value.rootMargin)!=null?L:yc}),ve=R(()=>{var L;return(L=de.value.maxTargets)!=null?L:640});function oe(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.enabled)!==!0)return null;const re=(q=o.virtualScroll)==null?void 0:q.scrollRoot;return ye(typeof re=="function"?re():re)}function ye(L){return L?typeof HTMLElement<"u"&&L instanceof HTMLElement?L:typeof L=="object"&&"value"in L?ye(L.value):typeof L=="object"&&"$el"in L?ye(L.$el):null:null}Ln(y$,de);const{isClient:G,renderAsFragment:Y,debugPerformanceEnabled:fe,resolvedShowTooltips:we,resolvedHtmlPolicy:ge,inheritedSmoothStreaming:Q,ownsTypewriterCursor:te}=(function(L){const q=typeof window<"u",re=p1(),ae=nn("markstreamHtmlPolicy",void 0),be=nn("markstreamTypewriterCursor",void 0),Ne=nn("markstreamSmoothStreaming",void 0),De=R(()=>L.renderAsFragment===!0),je=R(()=>!!(L.debugPerformance&&q&&typeof console<"u")),ot=R(()=>{var nt;if(typeof L.showTooltips=="boolean")return L.showTooltips;const Be=(nt=re.showTooltips)!=null?nt:re["show-tooltips"];return Be===""||Be===!0||Be==="true"||Be!==!1&&Be!=="false"&&void 0}),Ve=R(()=>{var nt,Be;return(Be=(nt=L.htmlPolicy)!=null?nt:ae?.value)!=null?Be:"safe"}),Ye=R(()=>be?.value!==!0);return{isClient:q,renderAsFragment:De,debugPerformanceEnabled:je,resolvedShowTooltips:ot,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:Ne,inheritedTypewriterCursor:be,ownsTypewriterCursor:Ye}})(I),{resolveViewportRoot:ce,resolveScrollContainer:ue,isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e}=(function(L,q){function re(){var je,ot;return(ot=(je=q.scrollRoot)==null?void 0:je.call(q))!=null?ot:null}function ae(je){if(typeof window>"u")return null;const ot=re();if(ot)return ot;const Ve=je??L.value;if(!Ve)return null;const Ye=Ve.ownerDocument||document,nt=Ye.scrollingElement||Ye.documentElement;let Be=Ve;for(;Be&&Be!==Ye.body&&Be!==nt;){if(ope(window.getComputedStyle(Be))&&spe(Be))return Be;Be=Be.parentElement}return null}function be(je){if(!q.isClient)return!1;try{const ot=window.getComputedStyle(je);return!!(ot.display||"").toLowerCase().includes("flex")&&(ot.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function Ne(je,ot,Ve){var Ye,nt;if(Ve)return De(ot);const Be=je.scrollTop;if(!be(je))return Be;const Xe=Be<0?-Be:Be;return Math.max(0,((Ye=je.scrollHeight)!=null?Ye:0)-((nt=je.clientHeight)!=null?nt:0))-Xe}function De(je){var ot,Ve,Ye,nt,Be;const Xe=Number((ot=je.scrollingElement)==null?void 0:ot.scrollTop),lt=Number((Ye=(Ve=je.documentElement)==null?void 0:Ve.scrollTop)!=null?Ye:0),rt=Number((Be=(nt=je.body)==null?void 0:nt.scrollTop)!=null?Be:0);return Math.max(0,Number.isFinite(Xe)?Xe:0,Number.isFinite(lt)?lt:0,Number.isFinite(rt)?rt:0)}return{resolveViewportRoot:ae,resolveScrollContainer:function(je){var ot,Ve,Ye,nt;const Be=re();if(Be)return Be;const Xe=ae((ot=je??L.value)!=null?ot:null);if(Xe)return Xe;const lt=(nt=(Ye=je?.ownerDocument)!=null?Ye:(Ve=L.value)==null?void 0:Ve.ownerDocument)!=null?nt:typeof document<"u"?document:null;return lt?.scrollingElement||lt?.documentElement||null},isReverseFlexScrollRoot:be,getNormalizedScrollTop:Ne,getOffsetTopWithinRoot:function(je,ot){const Ve=ot.ownerDocument||je.ownerDocument||document;if((function(Xe,lt){return Xe===lt.documentElement||Xe===lt.body||Xe===lt.scrollingElement})(ot,Ve))return je.getBoundingClientRect().top+De(Ve);const Ye=ot.getBoundingClientRect(),nt=je.getBoundingClientRect(),Be=Ne(ot,Ve,!1);return nt.top-Ye.top+Be}}})(O,{isClient:G,scrollRoot:oe});Ln("markstreamShowTooltips",we),Ln("markstreamHtmlPolicy",ge),Ln("markstreamTypewriter",f),Ln("markstreamFade",R(()=>I.fade!==!1)),Ln("markstreamTypewriterCursor",R(()=>!0)),Ln("markstreamTextStreamState",V),Ln("markstreamStreamVersion",ie),Ln("markstreamParseOptions",R(()=>I.parseOptions)),Ln("markstreamCustomMarkdownIt",R(()=>I.customMarkdownIt));const{smoothStreamingEnabled:Ee,renderContent:it,requestedFinal:Fe,effectiveFinal:Oe}=(function(L,q){const re=tpe(mt(mt({},npe),L.smoothStreamingOptions)),ae=R(()=>{var Be,Xe,lt;return L.smoothStreaming!==!1&&!((Be=L.nodes)!=null&&Be.length)&&(L.smoothStreaming===!0||!((Xe=q.inheritedSmoothStreaming)!=null&&Xe.value))&&(L.smoothStreaming===!0||ex(L.typewriter)!=="off"||((lt=L.maxLiveNodes)!=null?lt:0)<=0)}),be=Z(!q.isClient||L.smoothStreaming===!0);dn(()=>{be.value=!0});const Ne=R(()=>be.value&&ae.value),De=R(()=>{var Be;return Ne.value?re.visible.value:(Be=L.content)!=null?Be:""}),je=R(()=>{var Be,Xe;const lt=(Be=L.parseOptions)!=null?Be:{};return(Xe=L.final)!=null?Xe:lt.final}),ot=R(()=>{const Be=je.value;return Ne.value&&Be!=null?!!Be&&re.caughtUp.value:Be});let Ve=0,Ye=!1;function nt(){Ve=0,Ye=!1}return Je([()=>L.content,()=>L.nodes,Ne,je],([Be,Xe,lt,rt])=>{if(Xe?.length)return nt(),void re.reset("");const wt=Be??"";if(!lt)return nt(),re.reset(wt),void(rt&&re.finish({flush:!0}));const dt=re.source.value;if(wt){if(wt!==dt)if(wt.startsWith(dt)){const Ft=wt.slice(dt.length),Ht=re.pendingChars.value;Ft.length<=8?(Ve++,Ye||Ve>=2&&Ht<=8?(Ye=!0,re.reset(wt)):re.enqueue(Ft)):(nt(),re.enqueue(Ft))}else nt(),re.reset(wt)}else nt(),re.reset("");rt&&re.finish()},{immediate:!0}),{smoothStream:re,smoothStreamingEligible:ae,smoothStreamingEnabled:Ne,renderContent:De,requestedFinal:je,effectiveFinal:ot}})(I,{isClient:G,inheritedSmoothStreaming:Q}),Ge=Fe.value===!0;Ln("markstreamSmoothStreaming",Ee);const at=Z(!1),Tt=Z(!1),Bt=Z(!1);let Yt="",Sn=!1,on=null;function en(){G&&on!=null&&(window.clearTimeout(on),on=null)}function Cn(){at.value=!1,en()}function Mn(L,q){if(!fe.value)return;const re=(function(){if(!fe.value)return null;const ae=gt(We),be=gt(tt),Ne=Math.max(Lt,be);if(ae<=0&&Ne<=0)return null;const De={total:ae,maxPerFrame:Ne,byLabel:(je=We,Object.fromEntries(Array.from(je.entries()).sort((ot,Ve)=>Ve[1]-ot[1]||ot[0].localeCompare(Ve[0]))))};var je;return We.clear(),tt.clear(),Lt=0,De})();console.info(`[markstream-vue][perf] ${L}`,re?rn(mt({},q),{layoutReads:re}):q)}Je([()=>I.indexKey,()=>I.customId],()=>{var L,q;Cn(),Tt.value=!1,Bt.value=!((L=o.nodes)!=null&&L.length)&&Fe.value!==!0&&!!o.content,Yt=(q=it.value)!=null?q:"",Sn=Yt.length>0},{flush:"sync"}),Je([()=>o.content,()=>o.nodes,Fe],([L,q,re])=>{!q?.length&&re!==!0&&L&&(Bt.value=!0)},{flush:"sync",immediate:!0}),Je([it,()=>o.nodes,Fe],([L,q,re])=>{const ae=L??"";return q?.length||re===!0?(Cn(),Tt.value=!1,Yt=ae,void(Sn=!0)):(ae.length>0&&(Bt.value=!0),Sn?(Yt&&ae.length>Yt.length&&ae.startsWith(Yt)?(at.value=!0,Tt.value=!0,G&&(en(),on=window.setTimeout(()=>{var be;on=null,Oe.value===!0||(be=o.nodes)!=null&&be.length||(qc(),at.value=!1,Ol())},1200))):(ae.length"u")return null;const Ne=window;if(Ne.__markstreamLayoutReadPerformance)return Ne.__markstreamLayoutReadPerformance;const De={total:0,maxPerFrame:0,byLabel:{}};return Ne.__markstreamLayoutReadPerformance=De,De})();be&&(be.total=Number(be.total||0)+1,be.byLabel[ae]=Number(be.byLabel[ae]||0)+1,be.currentFrameTotal=Number(be.currentFrameTotal||0)+1,be.frameScheduled||(be.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>yn(be),0):queueMicrotask(()=>yn(be)):window.requestAnimationFrame(()=>yn(be))))})(L),Ue||(Ue=!0,G&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(wn):typeof queueMicrotask!="function"?setTimeout(wn,0):queueMicrotask(wn)))}function qt(L,q){return go(L),q()}const ps=I.customId?`renderer-${I.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,xs=(function(L){const q=new Map;return{scope:L,cache:q,clear:()=>q.clear()}})(ps),_n=ps;Ln(A$,xs);const In=fs(()=>I.customId),{effectiveCustomHtmlTagsSet:To,mergedParseOptions:lo,parsedNodes:St,getParsedNodesDirtyStartIndex:hs,getParsedNodesRevision:Jo}=Qfe(I,{instanceMsgId:ps,renderContent:it,effectiveFinal:Oe,smoothStreamingEnabled:Ee,debugPerformanceEnabled:fe,customComponentsMap:In,logPerf:Mn});Je(St,()=>{at.value||xs.clear(),ie.value+=1},{immediate:!0});const uo=R(()=>({customId:I.customId,customHtmlTags:lo.value.customHtmlTags,parseOptions:I.parseOptions,customMarkdownIt:I.customMarkdownIt,htmlPolicy:ge.value,viewportPriority:I.viewportPriority,viewportPriorityOptions:de.value,mode:c.value,domMode:I.domMode,codeRenderer:m.value,codeBlockStream:I.codeBlockStream,codeBlockDarkTheme:I.codeBlockDarkTheme,codeBlockLightTheme:I.codeBlockLightTheme,codeBlockMonacoOptions:I.codeBlockMonacoOptions,renderCodeBlocksAsPre:I.renderCodeBlocksAsPre,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockProps:I.codeBlockProps,mermaidProps:I.mermaidProps,d2Props:I.d2Props,infographicProps:I.infographicProps,showTooltips:we.value,themes:I.themes,langs:I.langs,isDark:I.isDark,typewriter:f.value,smoothStreamingOptions:I.smoothStreamingOptions,parseCoalesceMs:I.parseCoalesceMs,fade:I.fade}));Ln("markstreamNestedRendererProps",uo);const Ys=R(()=>St.value),Nn=R(()=>St.value.length),no=Z(null),$s=Z(null),Xs=Z(null),ci=Z(null),Oo=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),vo=!Oo&&I.customId?G_(I.customId):null,Po=R(()=>vo?(o4.value,G_(I.customId)):null),co=R(()=>{var L;return!!(!Y.value&&I.customId&&!Oo&&((L=Po.value)!=null&&L.enabled))}),Tn=R(()=>!!(G&&co.value)),fo=R(()=>{var L;return!!(!Y.value&&((L=o.virtualScroll)!=null&&L.enabled))}),Qe=R(()=>fo.value),st=Z(!1);dn(()=>{st.value=!0});const Ct=R(()=>!!(G&&fo.value));Ln("markstreamHostScrollManaged",Ct);const Qt=R(()=>!!(st.value&&Ct.value)),kn=R(()=>Tn.value||Ct.value),Ko=R(()=>Tn.value||Qt.value),Eo=R(()=>{var L;return kn.value&&((L=Po.value)==null?void 0:L.textEstimation)!==!1});function bo(){const L=ne.value||qt("getMeasuredContainerWidth.clientWidth",()=>{var q;return((q=O.value)==null?void 0:q.clientWidth)||0});return Number.isFinite(L)&&L>0?L:0}const Ns=R(()=>{const L=bo();return L>0?Math.max(1,Math.round(L)):640}),Do=R(()=>{var L,q;return!(Oe.value!==!0||fo.value||c.value!=="chat"&&c.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(L=o.nodes)!=null&&L.length||Bt.value||!(((q=I.maxLiveNodes)!=null?q:0)<=0))}),Io=R(()=>{var L;return Do.value?50:Math.max(1,(L=I.maxLiveNodes)!=null?L:320)}),Qo=R(()=>{var L;return Do.value?16:Math.max(0,(L=I.liveNodeBuffer)!=null?L:60)}),sn=R(()=>{var L;return!Y.value&&I.nodeVirtual!==!1&&!(((L=I.maxLiveNodes)!=null?L:0)<=0&&!Do.value)&&(I.nodeVirtual===!0?St.value.length>0:St.value.length>Io.value)}),es=R(()=>sn.value||Tn.value||Ct.value),ms=R(()=>I.viewportPriority!==!1),Tr=R(()=>!!ms.value&&!K.value);var ts;ts=R(()=>ms.value),Ln(k$,ts);const Ki=R(()=>{var L;return!(Y.value||I.deferNodesUntilVisible===!1||((L=I.maxLiveNodes)!=null?L:0)<=0||sn.value||St.value.length>900||I.viewportPriority===!1)}),Js=Nde(L=>{var q;return ce((q=L??O.value)!=null?q:null)},ms),{requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,isTestEnv:Zi}=(function(L){const q=L.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,re=L.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,ae=L.isClient&&typeof window.requestIdleCallback=="function",be=(function(){var Ne;if(typeof globalThis>"u"||!("process"in globalThis))return;const De=(Ne=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:Ne.value;return De?.env})();return{requestFrame:q,cancelFrame:re,hasIdleCallback:ae,isTestEnv:be?.NODE_ENV==="test"}})({isClient:G}),tl=R(()=>Oe.value===!0&&!fo.value),{resolvedBatchSize:Ho,resolvedInitialBatch:Co,batchingEnabled:Fs,incrementalRenderingActive:Rs,renderedCount:yo,previousRenderContext:ht,adaptiveBatchSize:Le,previousBatchConfig:Ze}=(function(L,q){var re;const ae=R(()=>{var nt;const Be=Math.trunc((nt=L.renderBatchSize)!=null?nt:80);return Number.isFinite(Be)?Math.max(0,Be):0}),be=R(()=>{var nt;const Be=Math.trunc((nt=L.initialRenderBatchSize)!=null?nt:ae.value);return Number.isFinite(Be)?Math.max(0,Be):ae.value}),Ne=R(()=>!q.renderAsFragment.value&&L.batchRendering!==!1&&ae.value>0&&q.isClient&&!q.isTestEnv),De=Z(0),je=Z({key:L.indexKey,total:0}),ot=Z(Math.max(1,ae.value||1)),Ve=R(()=>{var nt,Be,Xe;return Ne.value&&!((nt=q.continuousStreaming)!=null&&nt.value)&&!((Be=q.forceFullRenderFinalContent)!=null&&Be.value)&&((Xe=L.maxLiveNodes)!=null?Xe:0)<=0}),Ye=Z({batchSize:ae.value,initial:be.value,delay:(re=L.renderBatchDelay)!=null?re:16,enabled:Ve.value});return{resolvedBatchSize:ae,resolvedInitialBatch:be,batchingEnabled:Ne,incrementalRenderingActive:Ve,renderedCount:De,previousRenderContext:je,adaptiveBatchSize:ot,previousBatchConfig:Ye}})(I,{isClient:G,isTestEnv:Zi,renderAsFragment:Y,forceFullRenderFinalContent:tl,continuousStreaming:R(()=>Tt.value&&Oe.value!==!0)}),Xt=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&!Zi&&((L=I.maxLiveNodes)!=null?L:0)<=0&&!tl.value}),gs=R(()=>Xt.value),di=R(()=>kn.value||gs.value),Ei=R(()=>{var L;return di.value&&((L=Po.value)==null?void 0:L.codeBlockEstimation)!==!1}),ao=new Map,Gi=new Map,Er=new WeakMap;let fi=null;const Ll=new WeakMap,zo=new Map,Ir=[];let Qs=[],pi=[],se=-1;const xe=Xr(Ir),J=new Set,Ce=Z(0);let $e=0;const He=Z(0),vt=R(()=>(He.value,Array.from(ao.entries()).sort((L,q)=>L[0]-q[0]))),ut=Z(null),Dt=Z(null);let Et,ln=null,oo=0,Ot=null;function Pt(){Et.markFallbackHeightPrefixDirty()}function Yn(L){return Et.getFallbackNodeHeight(L)}function ko(L,q){return Et.estimateHeightRange(L,q)}function vs(L){return Et.estimateIndexForOffset(L)}const{activeRestoreAnchor:Os,getRelativeScrollTopWithinContainer:ei,setRelativeScrollTopWithinContainer:Lc,resolveAnchorOffset:U2,clearRestoreReconcile:$c,scheduleRestoreReconcile:yu,captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2}=(function(L){const{isClient:q,containerRef:re,parsedNodeCount:ae,requestFrame:be,cancelFrame:Ne,resolveScrollContainer:De,getNormalizedScrollTop:je,getOffsetTopWithinRoot:ot,isReverseFlexScrollRoot:Ve,estimateIndexForOffset:Ye,estimateHeightRange:nt,getFallbackNodeHeight:Be,clamp:Xe}=L,lt=Z(null);let rt=null,wt=[];function dt(){const Kt=De(),fn=re.value;if(!Kt||!fn)return null;const vn=Kt.ownerDocument||fn.ownerDocument||document;if(Kt===vn.documentElement||Kt===vn.body||Kt===vn.scrollingElement){const Qn=fn.getBoundingClientRect();return Math.max(0,-Qn.top)}return Math.max(0,je(Kt,vn,!1)-ot(fn,Kt))}function Ft(Kt){var fn;const vn=De(),Qn=re.value;if(!vn||!Qn)return;const Hs=Math.max(0,Kt),Ss=vn.ownerDocument||Qn.ownerDocument||document,$r=Ss.defaultView||(typeof window<"u"?window:null);if(vn===Ss.documentElement||vn===Ss.body||vn===Ss.scrollingElement){const il=je(vn,Ss,!0)+Qn.getBoundingClientRect().top;return void((fn=$r?.scrollTo)==null||fn.call($r,0,Math.max(0,il+Hs)))}J_(vn,Ss,ot(Qn,vn)+Hs,{isReverseFlexScrollRoot:il=>{var K1;return(K1=Ve?.(il))!=null&&K1},getNormalizedScrollTop:je})}function Ht(Kt){const fn=ae.value,vn=Xe(Kt.nodeIndex,0,Math.max(0,fn-1));return nt(0,vn)+Math.max(0,Kt.offsetWithinNodePx)}function Vt(){if(rt!=null&&(Ne?.(rt),rt=null),q)for(const Kt of wt)window.clearTimeout(Kt);wt=[]}function Wt(Kt){const fn=Ht(Kt),vn=dt();vn!=null&&Math.abs(vn-fn)<=.5||Ft(fn)}return{activeRestoreAnchor:lt,getRelativeScrollTopWithinContainer:dt,setRelativeScrollTopWithinContainer:Ft,resolveAnchorOffset:Ht,clearRestoreReconcile:Vt,applyRestoreAnchor:Wt,scheduleRestoreReconcile:function(){lt.value&&q&&rt==null&&(rt=be?be(()=>{rt=null,lt.value&&Wt(lt.value)}):null,rt==null&<.value&&Wt(lt.value))},captureRestoreAnchor:function(){const Kt=dt(),fn=ae.value;if(Kt==null||fn<=0)return null;const vn=Xe(Ye(Kt+1),0,fn-1),Qn=nt(0,vn),Hs=Be(vn);return{nodeIndex:vn,offsetWithinNodePx:Xe(Kt-Qn,0,Math.max(0,Hs-1))}},restoreAnchor:function(Kt){const fn=ae.value;if(lt.value={nodeIndex:Xe(Kt.nodeIndex,0,Math.max(0,fn-1)),offsetWithinNodePx:Math.max(0,Kt.offsetWithinNodePx)},Vt(),Wt(lt.value),q)for(const vn of[0,120,280,480])wt.push(window.setTimeout(()=>{lt.value&&Wt(lt.value)},vn))},getAnchorDrift:function(Kt){const fn=dt();return fn==null?null:fn-Ht(Kt)}}})({isClient:G,containerRef:O,parsedNodeCount:Nn,requestFrame:Bo,cancelFrame:Zo,resolveScrollContainer:()=>ut.value||ue(),getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e,isReverseFlexScrollRoot:Se,estimateIndexForOffset:vs,estimateHeightRange:ko,getFallbackNodeHeight:Yn,clamp:Bs}),{nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,resetHeightMeasurements:c0,pruneHeightMeasurements:d0,rebuildHeightTrees:Rc,recordNodeHeight:V2,removeNodeHeights:q2,exportHeightCache:ke,importHeightCache:Ae,fenwickRangeSum:Ke}=(function(L={}){const q=Go({}),re=Go({total:0,count:0}),ae=Z(0),be=Z([]),Ne=Z([]);function De(){for(const Be of Object.keys(q))delete q[Number(Be)];re.total=0,re.count=0,ae.value=0,be.value=[],Ne.value=[]}function je(Be,Xe,lt){for(let rt=Xe+1;rt0;rt-=rt&-rt)lt+=Be[rt];return lt}function Ve(Be){ae.value=Be;const Xe=new Array(Be+1).fill(0),lt=new Array(Be+1).fill(0);for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0||(je(Xe,dt,Ft),je(lt,dt,1))}be.value=Xe,Ne.value=lt}function Ye(Be){if(!Number.isInteger(Be)||Be<0)return!1;const Xe=q[Be];if(!Number.isFinite(Xe)||Xe<=0)return!1;if(delete q[Be],re.total=Math.max(0,re.total-Xe),re.count=Math.max(0,re.count-1),ae.value>Be){const lt=be.value,rt=Ne.value;lt.length&&rt.length&&(je(lt,Be,-Xe),je(rt,Be,-1))}return!0}const nt=R(()=>re.count>0?Math.max(12,re.total/re.count):32);return{nodeHeights:q,heightStats:re,heightTreeSize:ae,heightSumTree:be,heightKnownTree:Ne,averageNodeHeight:nt,resetHeightMeasurements:De,pruneHeightMeasurements:function(Be){if(Be<=0)return void De();let Xe=0,lt=0;for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0?delete q[dt]:(Xe+=Ft,lt++)}re.total=Xe,re.count=lt},rebuildHeightTrees:Ve,recordNodeHeight:function(Be,Xe,lt={}){(function(rt,wt,dt={}){var Ft;if(!Number.isFinite(wt)||wt<=0)return!1;const Ht=q[rt];if(Ht&&(dt.allowShrink===!1&&wtrt){const Vt=be.value,Wt=Ne.value;if(Vt.length&&Wt.length)if(Ht){const Kt=wt-Ht;Kt!==0&&je(Vt,rt,Kt)}else je(Vt,rt,wt),je(Wt,rt,1)}dt.notify!==!1&&((Ft=L.onHeightRecorded)==null||Ft.call(L))})(Be,Xe,rn(mt({},lt),{notify:!0}))},removeNodeHeight:function(Be,Xe={}){var lt;const rt=Ye(Be);return rt&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},removeNodeHeights:function(Be,Xe={}){var lt;let rt=0;for(const wt of Be)Ye(Number(wt))&&rt++;return rt>0&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},exportHeightCache:function(){return Object.entries(q).map(([Be,Xe])=>({index:Number(Be),height:Number(Xe)})).filter(Be=>Number.isFinite(Be.index)&&Be.index>=0&&Number.isFinite(Be.height)&&Be.height>0).sort((Be,Xe)=>Be.index-Xe.index)},importHeightCache:function(Be,Xe={}){var lt;if(!Array.isArray(Be))return;const rt=ae.value;let wt=!1;if(Xe.mode!=="merge"){const dt=Object.keys(q);if(dt.length>0){for(const Ft of dt)delete q[Number(Ft)];wt=!0}}for(const dt of Be){const Ft=Number(dt.index),Ht=Number(dt.height);if(!Number.isInteger(Ft)||Ft<0||rt>0&&Ft>=rt||!Number.isFinite(Ht)||Ht<=0)continue;const Vt=q[Ft];Vt&&Math.abs(Vt-Ht)<=1||(q[Ft]=Ht,wt=!0)}wt&&((function(){let dt=0,Ft=0;const Ht=ae.value;for(const[Vt,Wt]of Object.entries(q)){const Kt=Number(Vt),fn=Number(Wt);!Number.isFinite(Kt)||Kt<0||Ht>0&&Kt>=Ht||!Number.isFinite(fn)||fn<=0?delete q[Kt]:(dt+=fn,Ft++)}re.total=dt,re.count=Ft})(),rt>0&&Ve(rt),(lt=L.onHeightRecorded)==null||lt.call(L))},fenwickRangeSum:function(Be,Xe,lt){if(lt<=Xe)return 0;const rt=ot(Be,lt-1);return Xe<=0?rt:rt-ot(Be,Xe-1)}}})({onHeightRecorded:()=>{Pt(),Ct.value&&z1(),Os.value&&yu(),Dt.value&&Uc(),po("node-resize")}});function Mt(L){Number.isInteger(L)&&L>=0&&J.add(L)}function Gt(L){for(const q of L)Mt(Number(q))}function an(L){$e++;let q=!0;try{const re=L();return q=re!==!1,re}finally{$e--,$e===0&&q&&Ce.value++}}function Fn(){Qs=[],pi=[],se=-1,J.clear(),xe.value=Ir}function so(){Fn(),an(()=>c0()),zo.clear()}function Ps(L){!Number.isInteger(L)||L<0||L>=St.value.length||zo.set(L,I1(L))}function ku(L,q,re={}){const ae=$l[L];Mt(L),V2(L,q,re);const be=$l[L];return Object.is(ae,be)?(J.delete(L),!1):(be&&be>0?Ps(L):ae&&zo.delete(L),!0)}function A1(L,q){const re=qt("getNodeLayoutHeight.slot.offsetHeight",()=>{var ae,be;return(be=(ae=ao.get(L))==null?void 0:ae.offsetHeight)!=null?be:0});return re>0?re:qt("getNodeLayoutHeight.content.offsetHeight",()=>q.offsetHeight)}function a6(L,q={}){q.mode!=="merge"?Fn():Gt(L.map(re=>re.index)),an(()=>Ae(L,q)),bv()}const nl=R(()=>Ki.value&&Tr.value),wF=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&((L=I.maxLiveNodes)!=null?L:0)<=0}),_F=R(()=>!Y.value&&Ge&&Oe.value===!0&&!sn.value&&!fo.value&&!co.value&&!nl.value&&!wF.value),u6=R(()=>!!Js&&nl.value),c6=R(()=>sn.value||Ct.value),{focusIndex:Nl,liveRange:Ds,updateLiveRange:M1}=(function(L,q){const{parsedNodeCount:re,virtualizationEnabled:ae,maxLiveNodesResolved:be,liveNodeBufferResolved:Ne,clamp:De}=q,je=Ne??R(()=>{var Ye;return Math.max(0,(Ye=L.liveNodeBuffer)!=null?Ye:60)}),ot=Z(0),Ve=Go({start:0,end:0});return{liveNodeBufferResolved:je,focusIndex:ot,liveRange:Ve,updateLiveRange:function(){const Ye=re.value;if(!ae.value||Ye===0)return Ve.start=0,void(Ve.end=Ye);const nt=Math.min(be.value,Ye),Be=je.value,Xe=De(ot.value-Be,0,Math.max(0,Ye-nt));Ve.start=Xe,Ve.end=Math.min(Ye,Xe+nt)}}})(I,{parsedNodeCount:Nn,virtualizationEnabled:sn,maxLiveNodesResolved:Io,liveNodeBufferResolved:Qo,clamp:Bs}),ol=new Map,bu=new Map,da=new Map,f0=[],Fl=new Map,fa=new Set,d6=Z(0);let K2=!1;const f6=R(()=>(d6.value,fa.size)),Yi=new Map,sl=new Map,p6=Z(0),Z2=R(()=>{p6.value;let L=0;for(const q of Yi.values())L+=Math.max(0,q);return L});let Xi=null;const p0=R(()=>{if(!sn.value)return St.value.length;const L=Qo.value,q=Math.max(Ds.end+L,Co.value),re=Math.min(St.value.length,q);return Math.max(yo.value,re)});function h0(){K2||(K2=!0,queueMicrotask(()=>{K2=!1,d6.value+=1}))}function h6(L,q,re="node-resize"){if(!G||typeof window>"u")return null;const ae=window.setTimeout(()=>{fa.delete(ae)&&h0();try{q()}finally{po(re)}},Math.max(0,L));return fa.add(ae),h0(),ae}function m0(L){G&&L!=null&&(fa.delete(L)&&h0(),window.clearTimeout(L))}function m6(){if(G&&typeof window<"u")for(const L of fa)window.clearTimeout(L);fa.size&&(fa.clear(),h0()),f0.length=0,da.clear()}function xF(L){F.value=L}function SF(L){U.value=L}function AF(L){z.value=L}const{cancelScheduledFocusSync:G2,scheduleFocusSync:Lr}=(function(L){const{isClient:q,containerRef:re,virtualizationEnabled:ae,requestFrame:be,cancelFrame:Ne,syncFocusToScroll:De}=L;let je=null;function ot(){var Ye,nt,Be;return(Be=(nt=(Ye=re.value)==null?void 0:Ye.ownerDocument)==null?void 0:nt.defaultView)!=null?Be:typeof window<"u"?window:null}function Ve(){if(!je)return;const Ye=ot();je.viaTimeout?Ye?Ye.clearTimeout(je.id):clearTimeout(je.id):Ne?.(je.id),je=null}return{cancelScheduledFocusSync:Ve,scheduleFocusSync:function(Ye={}){if(!ae.value)return;if(!q)return void De(!0);if(Ye.immediate)return Ve(),void De(!0);if(je)return;const nt=()=>{je=null,De()};if(be)return void(je={id:be(nt),viaTimeout:!1});const Be=ot();je={id:Be?Be.setTimeout(nt,16):setTimeout(nt,16),viaTimeout:!0}}}})({isClient:G,containerRef:O,virtualizationEnabled:sn,requestFrame:Bo,cancelFrame:Zo,syncFocusToScroll:function(L=!1){var q;if(!sn.value)return;const re=ut.value||ue();if(!re)return;const ae=re.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,be=ae?.defaultView||(typeof window<"u"?window:null),Ne=re===ae?.documentElement||re===ae?.body,De=St.value.length;if(De<=0)return;if(!Ne&&De>0&&Se(re)){const rt=qt("syncFocusToScroll.clientHeight",()=>re.clientHeight||0),wt=qt("syncFocusToScroll.scrollTop",()=>re.scrollTop),dt=wt<0?-wt:wt;return void y0(Bs((je=Math.max(0,dt)+.5*Math.max(0,rt),Et.estimateIndexForOffsetFromEnd(je)),0,Math.max(0,De-1)),L)}var je;const ot=(function(rt,wt,dt,Ft){const Ht=O.value;if(!Ht)return null;const Vt=Ft?0:qt("syncFocusToScroll.model.root.getBoundingClientRect",()=>rt.getBoundingClientRect().top),Wt=qt("syncFocusToScroll.model.container.getBoundingClientRect",()=>Ht.getBoundingClientRect().top),Kt=Math.max(0,Vt-Wt),fn=Ft?qt("syncFocusToScroll.model.viewport.clientHeight",()=>{var vn,Qn,Hs,Ss;return(Ss=(Hs=(Qn=dt?.innerHeight)!=null?Qn:(vn=wt.documentElement)==null?void 0:vn.clientHeight)!=null?Hs:rt.clientHeight)!=null?Ss:0}):qt("syncFocusToScroll.model.root.clientHeight",()=>rt.clientHeight);return Bs(vs(Kt+.5*Math.max(0,fn)),0,Math.max(0,St.value.length-1))})(re,ae,be,Ne);if(ot!=null)return void y0(ot,L);const Ve=Ne?null:qt("syncFocusToScroll.root.getBoundingClientRect",()=>re.getBoundingClientRect()),Ye=Ne?0:Ve.top,nt=Ne?qt("syncFocusToScroll.viewport.clientHeight",()=>{var rt,wt;return(wt=(rt=be?.innerHeight)!=null?rt:re.clientHeight)!=null?wt:0}):Ve.bottom,Be=vt.value;let Xe=null,lt=null;for(const[rt,wt]of Be){if(!wt)continue;const dt=qt("syncFocusToScroll.slot.getBoundingClientRect",()=>wt.getBoundingClientRect());dt.bottom<=Ye||dt.top>=nt||(Xe==null&&(Xe=rt),lt=rt)}if(Xe==null||lt==null){const rt=O.value;if(!rt)return;const wt=Ne?{top:0}:qt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>re.getBoundingClientRect()),dt=qt("syncFocusToScroll.fallback.scrollTop",()=>ze(re,ae,Ne)),Ft=Ne?(()=>{const Vt=qt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>rt.getBoundingClientRect()),Wt=(Ne?0:wt.top)-Vt.top;return Math.max(0,Wt)})():(()=>{const Vt=_e(rt,re);return Math.max(0,dt-Vt)})(),Ht=Ne?qt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var Vt,Wt,Kt,fn;return(fn=(Kt=(Wt=be?.innerHeight)!=null?Wt:(Vt=ae?.documentElement)==null?void 0:Vt.clientHeight)!=null?Kt:re.clientHeight)!=null?fn:0}):qt("syncFocusToScroll.fallback.root.clientHeight",()=>re.clientHeight);return void y0(Bs(vs(Ft+.5*Math.max(0,Ht)),0,Math.max(0,St.value.length-1)),!0)}y0(Math.round((Xe+lt)/2),L)}}),{visibleNodeIndices:Y2,nodeVisibilityHandles:Oc,nodeVisibilityWatchStops:g0,nodeVisibilityFallbackTimers:g6,clearVisibilityFallback:v0,markNodeVisible:pa,cleanupNodeVisibility:MF,destroyNodeVisibilityState:X2}=epe({isClient:G,shouldTrackVisibleNodeIndices:()=>nl.value,shouldCleanupNodeVisibility:()=>sn.value,onNodeMarkedVisible:L=>{sn.value?Lr():Nl.value=Bs(L,0,Math.max(0,St.value.length-1))},onNodeVisibilityCleaned:L=>{ao.delete(L)&&j6()}}),{cleanupScrollListener:v6,setupScrollListener:TF}=(function(L){const{isClient:q,virtualizationEnabled:re,listenerEnabled:ae,scrollRootElement:be,resolveScrollContainer:Ne,scheduleFocusSync:De,onScroll:je}=L;let ot=null,Ve=null;function Ye(){ot&&(ot(),ot=null),Ve=null,be.value=null}function nt(Be){const Xe=L.getScrollTop?L.getScrollTop(Be):Be.scrollTop;return Math.max(0,Number.isFinite(Xe)?Math.abs(Xe):0)}return{cleanupScrollListener:Ye,setupScrollListener:function(){if(!q)return;if(!((Be=ae?.value)!=null?Be:re.value))return void Ye();var Be;const Xe=Ne();if(!Xe)return void Ye();if(be.value===Xe&&ot)return;Ye(),Ve=nt(Xe);const lt=()=>{if(je?.(),re.value){const rt=(function(wt){const dt=nt(wt),Ft=Ve;Ve=dt;const Ht=Math.max(480,.75*(wt.clientHeight||0));return Ft==null?dt>Ht?{immediate:!0}:void 0:Math.abs(dt-Ft)>Ht?{immediate:!0}:void 0})(Xe);rt?De(rt):De()}};Xe.addEventListener("scroll",lt,{passive:!0}),be.value=Xe,ot=()=>{Xe.removeEventListener("scroll",lt)}}}})({isClient:G,virtualizationEnabled:sn,listenerEnabled:c6,scrollRootElement:ut,resolveScrollContainer:ue,scheduleFocusSync:Lr,onScroll:function(){const L=Dt.value;if(!L)return;const q=E1();if(!q||(function(ae){if(R1()>=oo)return Ot=null,!1;const be=Ot;if(be==null)return!0;const Ne=Math.abs(ae.scrollTop-be)<=2;return Ne||(Ot=null),Ne})(q))return;const re=$6(q);re!=null?(re<-32||Math.abs(Math.max(0,re)-Math.max(0,L.distanceFromBottomPx))>32)&&Wc("restore"):Wc("restore")},getScrollTop:L=>{var q;const re=L.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement;return qt("scrollListener.getScrollTop",()=>ze(L,re,ae))}});function y0(L,q=!1){const re=Bs(L,0,Math.max(0,St.value.length-1));!q&&Math.abs(re-Nl.value)<=1||(Nl.value=re,M1())}function Bs(L,q,re){return Math.min(Math.max(L,q),re)}function J2(L=St.value.length){const q=hs();return!Number.isInteger(q)||q<0?L:Bs(q,0,L)}function Q2(L){return L?.firstElementChild}function y6(L,q){var re;return L?(re=L.matches)!=null&&re.call(L,q)?L:L.querySelector(q):null}function EF(L,q){L<1||L>6||(W[L]=q)}function k6(){if(!kn.value)return void(ne.value=0);const L=qt("updateExperimentContainerWidth.clientWidth",()=>{var q,re;return(re=(q=O.value)==null?void 0:q.clientWidth)!=null?re:0});ne.value=L>0?L:0}let T1=null;function ev(){T1?.disconnect(),T1=null}const b6=Af("ViewportDeferredMarkdownCodeBlockNode",zr({loader:()=>mo(null,null,function*(){return(yield jo(()=>import("./index5-Cn2jfVMX.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:dg,delay:0,suspensible:!1}),dg);function C6(L){return L===b6}const w6=R(()=>m.value==="pre"?Pi:m.value==="shiki"?b6:X9);function _6(){var L;return((L=I.codeBlockProps)==null?void 0:L.showHeader)!==!1}function x6(L,q,re){const ae=$l[q],be=typeof ae=="number"&&ae>0;if(Eo.value&&!be&&!(function(Ne){return!!In.value.paragraph&&(Ne.type==="paragraph"||Ne.type==="list_item"||Ne.type==="list")})(L)){const Ne=S$(L,re,X.value);if(Ne)return Ne}if(Ei.value&&L.type==="code_block"){const Ne=(function(De){if(De.type!=="code_block")return null;const je=n7(De,T0(De));return C6(je)?"markdown":je===Pi?"pre":je===w6.value||je===X9?"monaco":null})(L);if(Ne==="monaco"||Ne==="markdown"||Ne==="pre")return(function(De,je){var ot,Ve,Ye;if(!De||De.type!=="code_block")return null;const nt=je.rendererKind,Be=nt!=="pre"&&je.showHeader!==!1,Xe=!!De.diff;let lt=0,rt=500;if(nt==="monaco"){const dt=(ot=je.monacoOptions)!=null?ot:{},Ft=r4(De,dt,je.width),Ht=(function(Wt){const Kt=typeof Wt?.fontSize=="number"&&Wt.fontSize>0?Wt.fontSize:12;return typeof Wt?.lineHeight=="number"&&Wt.lineHeight>0?Wt.lineHeight:Math.round(1.5*Kt)})(dt),Vt=(function(Wt,Kt){var fn,vn;const Qn=typeof((fn=Wt?.padding)==null?void 0:fn.top)=="number"?Wt.padding.top:Kt?0:8,Hs=typeof((vn=Wt?.padding)==null?void 0:vn.bottom)=="number"?Wt.padding.bottom:Kt?0:8;return Math.max(0,Qn)+Math.max(0,Hs)})(dt,Xe);rt=typeof dt.MAX_HEIGHT=="number"&&dt.MAX_HEIGHT>0?dt.MAX_HEIGHT:500,lt=Math.round(Ft*Ht+Vt)}else if(nt==="markdown"){const dt=r4(De);lt=Math.round(21*dt+32)}else{const dt=r4(De);lt=Math.round(28*dt),rt=Number.POSITIVE_INFINITY}const wt=Math.max(1,Math.min(lt,rt));return mt({kind:"code-block",height:Math.round(wt+(Be?40:0)),contentHeight:wt,rendererKind:nt},Xe&&nt==="monaco"?{diffInline:v5((Ve=je.monacoOptions)!=null?Ve:{},(Ye=je.width)!=null?Ye:0)}:{})})(L,{rendererKind:Ne,monacoOptions:I.codeBlockMonacoOptions,showHeader:_6(),width:re})}return null}I4(()=>{if(Ce.value,$e>0)return;const L=St.value,q=Jo();if(!L.length||!di.value)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const re=ne.value||qt("estimatedNodeHeights.clientWidth",()=>{var Ve;return((Ve=O.value)==null?void 0:Ve.clientWidth)||0});if(!Number.isFinite(re)||re<=0)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const ae=(function(Ve){return[Math.round(Ve),Eo.value,Ei.value,X.value,I.codeBlockMonacoOptions,_6(),m.value,In.value,o4.value]})(re),be=Qs.length<=L.length&&(De=ae,(Ne=pi).length===De.length&&Ne.every((Ve,Ye)=>Object.is(Ve,De[Ye])));var Ne,De;const je=be&&se===q?L.length:be?J2(L.length):0,ot=be?Array.from(J):[];Qs.length=L.length;for(let Ve=je;Ve=0&&Vexe.value);Et=(function(L){let q=!0,re=[0],ae="";function be(Ye){var nt;const Be=L.nodeHeights[Ye];if(Number.isFinite(Be)&&Be>0)return Be;const Xe=L.parsedNodes.value[Ye],lt=Xe?.type,rt=!!((nt=L.hasCustomParagraphComponent)!=null&&nt.call(L)),wt=L.estimatedNodeHeights.value[Ye],dt=wt?.height;if(!(function(Ht,Vt,Wt){return!!(Wt&&Vt?.kind==="simple-text"&&(Ht==="paragraph"||Ht==="list_item"||Ht==="list"))})(lt,wt,rt)&&Number.isFinite(dt)&&dt>0)return dt;const Ft=Wfe(Xe,L.getContainerWidth()||640);return lt==="heading"||lt==="paragraph"&&Ft<=28&&(function(Ht,Vt){if(Vt)return!1;const Wt=Ht.children;return!Array.isArray(Wt)||!Wt.length||Wt.every(M$)})(Xe,rt)?Ft:Math.max(L.averageNodeHeight.value,Ft)}function Ne(){var Ye;const nt=L.parsedNodes.value.length,Be=L.getPrefixCacheKeyParts().join(":");if(!q&&ae===Be)return re;const Xe=new Array(nt+1);Xe[0]=0;for(let lt=0;lt=((nt=lt[Xe])!=null?nt:0))return Xe-1;let rt=0,wt=Xe-1,dt=Xe-1;for(;rt<=wt;){const Ft=rt+wt>>1;((Be=lt[Ft+1])!=null?Be:0)>=Ye?(dt=Ft,wt=Ft-1):rt=Ft+1}return dt}function je(Ye,nt){var Be,Xe;if(Ye>=nt)return 0;if(L.heightEstimationActive.value)return(function(wt,dt){var Ft,Ht;const Vt=L.parsedNodes.value.length,Wt=tx(Math.trunc(wt),0,Vt),Kt=tx(Math.trunc(dt),Wt,Vt);if(Wt>=Kt)return 0;const fn=Ne();return((Ft=fn[Kt])!=null?Ft:0)-((Ht=fn[Wt])!=null?Ht:0)})(Ye,nt);if(L.heightTreeSize.value!==L.parsedNodes.value.length){let wt=0;for(let dt=Ye;dtWt<=0?0:L.fenwickRangeSum(rt,0,Wt)+(Wt-L.fenwickRangeSum(wt,0,Wt))*lt;let Ft=0,Ht=Be.length-1,Vt=Be.length-1;for(;Ft<=Ht;){const Wt=Ft+Ht>>1;dt(Wt+1)>=Ye?(Vt=Wt,Ht=Wt-1):Ft=Wt+1}return Vt}let Xe=Ye;for(let lt=0;lt0||Ye++}return Ye}return{markFallbackHeightPrefixDirty:function(){q=!0},getFallbackNodeHeight:be,estimateHeightRange:je,estimateIndexForOffset:ot,estimateIndexForOffsetFromEnd:function(Ye){var nt,Be;const Xe=L.parsedNodes.value;if(!Xe.length)return 0;if(Ye<=0)return Math.max(0,Xe.length-1);if(L.heightEstimationActive.value){const rt=(nt=Ne()[Xe.length])!=null?nt:0;return De(Math.max(0,rt-Ye))}if(L.heightTreeSize.value===Xe.length){const rt=je(0,Xe.length);return ot(Math.max(0,rt-Ye))}let lt=Ye;for(let rt=Xe.length-1;rt>=0;rt--){const wt=(Be=L.nodeHeights[rt])!=null?Be:L.averageNodeHeight.value;if(lt<=wt)return rt;lt-=wt}return 0},getEstimatedNodeHeightCount:Ve,buildVirtualHeightSummary:function(Ye){var nt;const Be=L.parsedNodes.value.length;return{totalNodes:Be,measuredCount:L.heightStats.count,estimatedCount:Ve(),averageNodeHeight:L.averageNodeHeight.value,topSpacerHeight:Ye.topSpacerHeight,bottomSpacerHeight:Ye.bottomSpacerHeight,estimatedTotalHeight:je(0,Be),width:(nt=Ye.width)!=null?nt:L.getContainerWidth()}}}})({parsedNodes:St,nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,heightEstimationActive:kn,estimatedNodeHeights:Pc,getContainerWidth:bo,hasCustomParagraphComponent:()=>!!In.value.paragraph,getPrefixCacheKeyParts:()=>{var L;const q=uf(ne.value||qt("getFallbackHeightPrefix.clientWidth",()=>{var ae;return((ae=O.value)==null?void 0:ae.clientWidth)||0})),re=((L=o.virtualScroll)==null?void 0:L.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[St.value.length,hi.count,Math.round(hi.total),Math.round(100*S1.value),re,q,kn.value?1:0,o4.value,ie.value,In.value.paragraph?1:0]},fenwickRangeSum:Ke}),Je(()=>St.value.length,L=>{var q;Pt(),L<=0?so():(Ld0(q))),L!==x1.value&&Rc(L))},{immediate:!0});const IF=R(()=>{if(!sn.value)return St.value.map((ae,be)=>({node:ae,index:be}));const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);return St.value.slice(q,re).map((ae,be)=>({node:ae,index:q+be}))}),tv=R(()=>sn.value?ko(0,Math.min(Ds.start,St.value.length)):0),nv=R(()=>{if(!sn.value)return 0;const L=St.value.length;return ko(Math.min(Ds.end,L),L)});function S6(){return Et.buildVirtualHeightSummary({topSpacerHeight:tv.value,bottomSpacerHeight:nv.value,width:Cu()})}function LF(){const L=St.value,q=S6();return rn(mt({},q),{probe:{paragraphReady:!!X.value.paragraph,listItemReady:!!X.value.listItem,listWrapperOverhead:X.value.listWrapperOverhead,headingReadyLevels:Object.entries(X.value.headings).filter(([,re])=>!!re).map(([re])=>Number(re))},nodes:L.map((re,ae)=>{var be,Ne,De,je,ot,Ve,Ye,nt,Be;return{index:ae,type:re.type,estimateKind:(Ne=(be=Pc.value[ae])==null?void 0:be.kind)!=null?Ne:null,rendererKind:(je=(De=Pc.value[ae])==null?void 0:De.rendererKind)!=null?je:null,estimatedHeight:(Ve=(ot=Pc.value[ae])==null?void 0:ot.height)!=null?Ve:null,estimatedContentHeight:(nt=(Ye=Pc.value[ae])==null?void 0:Ye.contentHeight)!=null?nt:null,measuredHeight:(Be=$l[ae])!=null?Be:null}})})}function ov(){return o.indexKey!=null?String(o.indexKey):fo.value?`virtual-${wo()}`:"markdown-renderer"}function A6(L){const q=String(L),re=`${ov()}-`;if(!q.startsWith(re))return null;const ae=q.slice(re.length).match(/^(\d+)(?:$|-)/);if(!ae)return null;const be=Number(ae[1]);return!Number.isInteger(be)||be<0||be>=St.value.length?null:be}function wo(){var L,q,re;const ae=(L=o.virtualScroll)==null?void 0:L.sessionKey;return String(ae!=null&&ae!==""?ae:(re=(q=o.indexKey)!=null?q:I.customId)!=null?re:ps)}function ns(){var L;const q=(L=o.virtualScroll)==null?void 0:L.threadKey;return q==null||q===""?void 0:String(q)}const $F=R(()=>{var L,q,re;return(re=ns())!=null?re:String((q=(L=o.indexKey)!=null?L:I.customId)!=null?q:ps)});function sv(L){var q;return(L??"")===((q=ns())!=null?q:"")}function Rl(){var L,q,re;return q=(L=o.virtualScroll)==null?void 0:L.measurementKey,re=(function(){const ae=m.value;return(function(be){var Ne,De;const je=be.renderer,ot=je==="monaco"?be.codeBlockMonacoOptions:void 0,Ve=be.codeBlockProps,Ye=je==="shiki";return[be.isDark?"dark":"light",je==="monaco"?"code-rich":je==="pre"?"code-pre":"code-shiki",be.codeBlockStream===!1?"code-static":"code-stream",As(be.codeBlockMinWidth),As(be.codeBlockMaxWidth),...Ye?[Lce((Ne=Ve?.themes)!=null?Ne:be.themes,(De=Ve?.langs)!=null?De:be.langs)]:[],As(ot?.fontSize),As(ot?.lineHeight),As(ot?.fontFamily),As(ot?.tabSize),As(ot?.MAX_HEIGHT),As(ot?.wordWrap),As(ot?.wrappingIndent),As(ot?.padding),As(Ve?.showHeader),As(Ve?.showCopyButton),As(Ve?.showExpandButton),As(Ve?.showPreviewButton),As(Ve?.showCollapseButton),As(Ve?.showFontSizeButtons)].join("\0")})({renderer:ae,isDark:I.isDark,codeBlockStream:I.codeBlockStream,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockMonacoOptions:ae==="monaco"?I.codeBlockMonacoOptions:void 0,codeBlockProps:I.codeBlockProps,themes:ae==="shiki"?I.themes:void 0,langs:ae==="shiki"?I.langs:void 0})})(),[q==null?"":String(q),re].join("\0")}function Cu(){return bo()}const k0=R(()=>uf(Cu())),Ji=R(()=>[Rl(),k0.value].join("\0")),NF=R(()=>{var L;return fo.value?["virtual",(L=ns())!=null?L:"",wo(),Ji.value].join("\0"):o.indexKey});function Dc(){p6.value+=1}function iv(L){return!(!L||!Number.isInteger(L.index)||L.index<0||L.index>=St.value.length||L.sessionKey!==wo()||L.threadKey!==ns()||L.layoutEpochKey!==Ji.value)}function M6(L){const q=String(L),re=sl.get(q);return re?iv(re)?re.index:null:A6(q)}function T6(L="async-node"){(Yi.size||sl.size)&&(Yi.clear(),sl.clear(),Dc(),po(L))}const Bc=nn(G3,null),rv={reportHeight(L,q){if(!Ct.value)return;const re=M6(L);if(re==null)return;const ae=ol.get(re);if(!ae)return;const be=Number(q),Ne=A1(re,ae);(function(De,je,ot={}){an(()=>ku(De,je,ot))})(re,Number.isFinite(be)&&be>0?Math.max(be,Ne||0):Ne)},markPending(L){if(!Ct.value)return;const q=A6(L);q!=null&&(function(re,ae){var be;const Ne=sl.get(re);if(Ne&&iv(Ne))return Yi.set(re,Math.max(0,(be=Yi.get(re))!=null?be:0)+1),Dc(),void po("async-node");Yi.set(re,1),sl.set(re,(function(De){return{index:De,sessionKey:wo(),threadKey:ns(),layoutEpochKey:Ji.value}})(ae)),Dc(),po("async-node")})(String(L),q)},markSettled(L){if(!Ct.value)return;const q=String(L),re=M6(L);(re!=null||(function(ae){return Yi.has(String(ae))})(q))&&(function(ae){var be;const Ne=(be=Yi.get(ae))!=null?be:0;return!(Ne<=0||(Ne<=1?(Yi.delete(ae),sl.delete(ae)):Yi.set(ae,Ne-1),Dc(),Ne===1&&po("async-node"),0))})(q)&&re!=null&&Ol()}};function FF(){let L=0;for(const q of ol.values())L+=qt("getVisibleDomHeight.offsetHeight",()=>{var re;return(re=q?.offsetHeight)!=null?re:0});return Math.ceil(Math.max(0,L))}Ln(G3,{reportHeight(L,q){rv.reportHeight(L,q),Bc?.reportHeight(L,q)},markPending(L){rv.markPending(L),Bc?.markPending(L)},markSettled(L){rv.markSettled(L),Bc?.markSettled(L)}});let lv,av=null,Hc=null;function b0(L){return L!==!1&&L!=null&&L!==""}function E6(){return sn.value?(function(){if(!sn.value)return!0;const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);if(q>=re)return!0;for(let ae=q;ae=p0.value}function uv(){return Oe.value===!0&&!at.value&&Z2.value===0&&fa.size===0&&Fl.size===0&&Xi==null&&E6()}function I6(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.settleMode)!=="manual"||av===wo()&&lv===ns())return!0;const re=(q=o.virtualScroll)==null?void 0:q.settledToken;return!!b0(re)&&Hc===W1(re)}function cv(){return uv()&&I6()}function RF(L,q){return q.totalNodes<=0?L==="final"?"final":"estimate":q.measuredCount>=q.totalNodes?L==="final"?"final":"measured":q.measuredCount>0||q.estimatedCount>0?"mixed":"estimate"}function wu(L="manual",q){const re=S6(),ae=(function(be){return be||(Oe.value!==!0?St.value.length>0?"streaming":"estimating":!E6()||Fl.size>0||Xi!=null?"measuring":cv()?"settled":"settling")})(q);return{sessionKey:wo(),threadKey:ns(),phase:ae,nodeCount:re.totalNodes,liveRange:{start:Ds.start,end:Ds.end},renderedCount:yo.value,measuredCount:re.measuredCount,estimatedCount:re.estimatedCount,averageNodeHeight:re.averageNodeHeight,topSpacerHeight:re.topSpacerHeight,bottomSpacerHeight:re.bottomSpacerHeight,visibleDomHeight:FF(),totalHeight:L6(),width:re.width,final:Oe.value===!0,stable:cv(),confidence:RF(ae,re),reason:L}}function E1(){const L=ut.value||ue(),q=O.value;if(!L||!q)return null;const re=L.ownerDocument||q.ownerDocument||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement,be=qt("getScrollBox.scrollTop",()=>ze(L,re,ae)),Ne=qt("getScrollBox.scrollHeight",()=>{var je,ot,Ve,Ye,nt;return ae?Math.max((ot=(je=re.documentElement)==null?void 0:je.scrollHeight)!=null?ot:0,(Ye=(Ve=re.body)==null?void 0:Ve.scrollHeight)!=null?Ye:0,(nt=L.scrollHeight)!=null?nt:0):L.scrollHeight}),De=qt("getScrollBox.clientHeight",()=>{var je;return ae?((je=re.documentElement)==null?void 0:je.clientHeight)||L.clientHeight||0:L.clientHeight});return{root:L,doc:re,isViewportRoot:ae,scrollTop:be,scrollHeight:Ne,clientHeight:De}}function L6(){const L=St.value.length,q=Math.max(0,ko(0,L)),re=qt("getRendererLogicalHeight.offsetHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.offsetHeight)!=null?Ne:0}),ae=Math.max(0,re>0?re:qt("getRendererLogicalHeight.scrollHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.scrollHeight)!=null?Ne:0}));return L<=0?Math.ceil(re):sn.value?q>0?Math.max(1,Math.ceil(q),(function(){let be=tv.value+nv.value;for(const Ne of ao.values())Ne&&(be+=Math.max(0,qt("getVirtualizedDomLogicalHeight.offsetHeight",()=>Ne.offsetHeight||0)));return Math.ceil(Math.max(0,be))})(),(function(be,Ne){return be<=0||Ne<=0?0:Ne<=be+Math.max(512,.05*be)?Math.ceil(Ne):0})(q,ae)):Math.max(1,Math.ceil(ae)):Ct.value?q>0||hi.count>0||Et.getEstimatedNodeHeightCount()>0?(Rs.value&&yo.value,Math.max(1,Math.ceil(ae),Math.ceil(q))):Math.ceil(ae):Math.max(1,Math.ceil(ae),Math.ceil(q))}function $6(L){const q=O.value;if(!q)return null;const re=qt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>q.getBoundingClientRect());return(function(be){return be.isViewportRoot?be.clientHeight:qt("getViewportBottomInRoot.getBoundingClientRect",()=>be.root.getBoundingClientRect().bottom)})(L)-re.bottom}function OF(L={}){const q=L.requireViewport!==!1,re=(function(Ne=64){const De=E1(),je=O.value;if(!De||!je)return!1;const ot=(function(Ye){if(Ye.isViewportRoot)return{top:0,bottom:Ye.clientHeight};const nt=qt("getVirtualViewportRect.getBoundingClientRect",()=>Ye.root.getBoundingClientRect());return{top:nt.top,bottom:nt.bottom}})(De),Ve=qt("isRendererNearVirtualViewport.getBoundingClientRect",()=>je.getBoundingClientRect());return Ve.bottom>=ot.top-Ne&&Ve.top<=ot.bottom+Ne})();if(q&&!re)return null;const ae=(function(){const Ne=E1(),De=O.value;if(!Ne||!De||Math.max(0,Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight)>64)return null;const je=$6(Ne);return je==null?null:je>=-8&&je<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,je)}:null})();if(ae)return{anchor:ae,captured:!0};const be=Nc();if(be)return{anchor:{type:"node",nodeIndex:be.nodeIndex,offsetWithinNodePx:be.offsetWithinNodePx},captured:re};if(L.allowFallback===!0){const Ne=(function(){const De=St.value.length;return De<=0?null:{type:"node",nodeIndex:Bs(Nl.value,0,Math.max(0,De-1)),offsetWithinNodePx:0}})();return Ne?{anchor:Ne,captured:!1}:null}return null}function dv(L){let q=2166136261;for(let re=0;re>>0).toString(36)}function PF(L,q){let re=L;for(let ae=0;ae8192?`${ae.slice(0,8192)}...${ae.length}`:ae;return`${ae.length}:${dv(be)}`})(L)}`;if(typeof L=="function")return"fn";if(typeof L!="object")return typeof L;if(q.has(L))return"cycle";if(re>=6)return"max-depth";q.add(L);try{if(Array.isArray(L)){if(L.length<=160){const Ve=[];for(let Ye=0;Ye=je&&De.push(Ye)}return[`a:${L.length}`,`h=${Ne.join(",")}`,`t=${De.join(",")}`,`all=${(ot>>>0).toString(36)}`].join(":")}const ae=L,be=Object.keys(ae).filter(Ne=>{const De=ae[Ne];return Ne!=="parent"&&Ne!=="el"&&Ne!=="component"&&(De==null||typeof De=="string"||typeof De=="number"||typeof De=="boolean"||DF.has(Ne))}).sort();return`o:${be.length}:${be.map(Ne=>`${Ne}=${C0(ae[Ne],q,re+1)}`).join(";")}`}finally{q.delete(L)}}let fv=-1,pv="",_u=[2166136261];function I1(L){const q=St.value[L];return q?dv(C0(q)):""}function BF(L,q){let re=L;for(let ae=0;ae>>0}function hv(){var L,q;const re=ie.value;if(fv===re)return pv;const ae=St.value.length;let be=J2(ae);(fv!==re-1||be>ae||_u.length>>0).toString(36),fv=re,pv}function zc(L,q={}){var re;const ae=q.includeHeightCache===!0,be=(re=q.includeContentHash)!=null?re:ae,Ne=ae?(function(je){const ot=(function(){var rt,wt;const dt=Number((wt=(rt=o.virtualScroll)==null?void 0:rt.heightCacheLimit)!=null?wt:5e3);return!Number.isFinite(dt)||dt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(dt))})();if(!Number.isFinite(ot)||je.length<=ot)return je;const Ve=new Map,Ye=rt=>{!rt||Ve.size>=ot||Ve.set(rt.index,rt)},nt=St.value.length,Be=Bs(Ds.start-2*Qo.value,0,nt),Xe=Bs(Ds.end+2*Qo.value,Be,nt);for(const rt of je)rt.index>=Be&&rt.index=0&&Ve.sizert.index-wt.index).slice(0,ot)})(ke().map(je=>{var ot;const Ve=St.value[je.index];return Ve?rn(mt({},je),{nodeType:String((ot=Ve.type)!=null?ot:""),signature:I1(je.index)}):null}).filter(je=>!!je)):[],De=OF({allowFallback:q.allowAnchorFallback===!0,requireViewport:q.requireViewport});return De||Ne.length||q.includeEmptyState===!0?rn(mt({sessionKey:L.sessionKey,threadKey:L.threadKey},De?{anchor:De.anchor,anchorCaptured:De.captured}:{anchorCaptured:!1}),{metrics:L,width:L.width,contentHash:be?hv():void 0,measurementKey:Rl()||void 0,heightCache:Ne.length?Ne:void 0}):null}function mv(L){var q,re;const ae=E1();if(!ae)return;const be=(function(je){const ot=O.value;if(!ot)return null;const Ve=_e(ot,je.root),Ye=St.value.length,nt=qt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>ot.offsetHeight||0),Be=Math.max(0,nt>0?nt:Ye>0?qt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>ot.scrollHeight||0):0),Xe=L6();return Ve+Math.max(Be,Xe)})(ae);if(be==null)return;const Ne=Math.max(0,L.distanceFromBottomPx),De=Math.max(0,be-ae.clientHeight-Ne);(function(je){oo=R1()+120,Ot=je})(De),ae.isViewportRoot?(re=(q=ae.doc.defaultView)==null?void 0:q.scrollTo)==null||re.call(q,0,De):J_(ae.root,ae.doc,De,{isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze})}const gv=[];function N6(){if(G)for(ln!=null&&(Zo?.(ln),ln=null);gv.length;){const L=gv.pop();L!=null&&window.clearTimeout(L)}}function Wc(L){const q=!!Dt.value;Dt.value=null,oo=0,Ot=null,N6(),q&&L&&po(L)}function Uc(){if(!Dt.value||!G||ln!=null)return;const L=()=>{ln=null;const q=Dt.value;q&&mv(q)};ln=Bo?Bo(L):null,ln==null&&L()}function F6(L,q={}){const re=St.value.length;return re<=0?[]:L.filter(ae=>!(!Number.isInteger(ae.index)||ae.index<0||ae.index>=re)&&!(!Number.isFinite(ae.height)||ae.height<=0)&&!(q.requireSignature&&!ae.signature)&&!(q.requireCompatibilityMetadata&&!ae.nodeType&&!ae.signature)&&(function(be){var Ne;const De=St.value[be.index];return!(!De||be.nodeType&&be.nodeType!==String((Ne=De.type)!=null?Ne:"")||be.signature&&be.signature!==I1(be.index))})(ae))}function R6(L){const q=uf(Cu()),re=uf(L);return q!==-1&&re!==-1&&q===re}function vv(L){var q;const re=Number(L?.width);if(Number.isFinite(re)&&re>0)return re;const ae=Number((q=L?.metrics)==null?void 0:q.width);return Number.isFinite(ae)&&ae>0?ae:null}function O6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&((q=L.measurementKey)!=null?q:"")===Rl()&&!!R6(vv(L))&&!!(function(re){const ae=re.heightCache;return!!ae?.length&&(P6(re)?ae.some(be=>!!(be.nodeType||be.signature)):ae.some(be=>!!be.signature))})(L)}function P6(L){return!!(L.contentHash&&L.contentHash===hv())}function HF(L){return!P6(L)}let xu=null,Su=null,w0=null,L1=null,$1=null;function yv(L){var q;const re=L.map(be=>{var Ne,De;return[be.index,Math.round(10*be.height),(Ne=be.nodeType)!=null?Ne:"",(De=be.signature)!=null?De:""].join("")}).join(""),ae=uf(Cu());return[(q=ns())!=null?q:"",wo(),Rl(),St.value.length,ae,L.length,dv(re)].join(":")}function D6(L=(q=>(q=o.virtualScroll)==null?void 0:q.heightCache)()){if(!Ct.value||!L?.length||St.value.length<=0||!R6((q=o.virtualScroll)==null?void 0:q.heightCacheWidth))return!1;var q;const re=F6(L,{requireSignature:!0});if(!re.length)return!1;const ae=yv(re);return ae===xu?(Su="standalone",!0):(a6(re,{mode:"merge"}),Pt(),xu=ae,Su="standalone",P1(),po("restore"),!0)}function kv(L,q={}){var re,ae,be;if(!Ct.value||!L||L.sessionKey!==wo()||!sv(L.threadKey)||St.value.length<=0)return!1;const Ne=!!((re=L.heightCache)!=null&&re.length)&&!_0(),De=!L.anchor||L.anchorCaptured===!1&&q.allowUncapturedAnchor!==!0?null:L.anchor,je=q.restoreAnchor===!0&&!!De&&!_0()&&Number(vv(L))>0;let ot=!1;if((ae=L.heightCache)!=null&&ae.length&&O6(L)){const Ye=F6(L.heightCache,{requireCompatibilityMetadata:!L.contentHash,requireSignature:HF(L)});Ye.length&&(a6(Ye,{mode:"merge"}),Pt(),xu=yv(Ye),Su="restore",P1(),ot=!0)}if(Ne||je)return!1;if(!q.restoreAnchor||!De)return ot&&po("restore"),!0;const Ve=(function(Ye,nt){var Be;const Xe=Ye.anchor,lt=Xe?Xe.type==="bottom"?`bottom:${Math.round(Xe.distanceFromBottomPx)}`:`node:${Xe.nodeIndex}:${Math.round(Xe.offsetWithinNodePx)}`:"none";return[(Be=ns())!=null?Be:"",wo(),Rl(),k0.value,nt,lt].join(":")})(L,(be=q.restoreToken)!=null?be:"imperative");return w0===Ve?(ot&&po("restore"),!0):(w0=Ve,(function(Ye){const nt=()=>{if(Ye.type==="node")return Wc(),void Fc({nodeIndex:Ye.nodeIndex,offsetWithinNodePx:Ye.offsetWithinNodePx});if($c(),Os.value=null,Dt.value=Ye,N6(),mv(Ye),G)for(const Be of[0,120,280,480])gv.push(window.setTimeout(()=>{const Xe=Dt.value;Xe&&mv(Xe)},Be))};(function(Be){if(!sn.value)return!1;const Xe=St.value.length;return!(Xe<=0||(Nl.value=Be.type==="node"?Bs(Be.nodeIndex,0,Xe-1):Xe-1,M1(),0))})(Ye)?yt(nt):nt()})(De),po("restore"),!0)}function _0(){const L=Cu();return Number.isFinite(L)&&L>0}function B6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&(St.value.length<=0||!(!((q=L.heightCache)!=null&&q.length)||_0())||!(!(L.anchor&&Number(vv(L))>0)||_0()))}function bv(){zo.clear();for(const L of Object.keys($l)){const q=Number(L);Number.isInteger(q)&&q>=0&&q{let q=!1,re=null;const ae=()=>{q||(q=!0,re!=null&&window.clearTimeout(re),L())};if(Bo)return Bo(ae),void(re=window.setTimeout(ae,50));re=window.setTimeout(ae,0)})}function Cv(L,q=ns(),re=Ji.value){return wo()===L&&ns()===q&&Ji.value===re}function wv(){return mo(this,arguments,function*(L={}){var q,re,ae,be,Ne;const De=wo(),je=ns(),ot=Ji.value,Ve=(q=L.frames)!=null?q:2,Ye=(re=L.timeoutMs)!=null?re:120,nt=(ae=L.reason)!=null?ae:"manual",Be=L.expectedSettledTokenKey,Xe=L.flushPendingTimers===!0,lt=wu(nt),rt=()=>rn(mt({},lt),{phase:lt.final?"settling":lt.phase,stable:!1,confidence:lt.confidence==="final"?"mixed":lt.confidence,reason:nt}),wt=()=>Cv(De,je,ot)&&(Be==null||O1()===Be);for(let Vt=0;Vtwindow.setTimeout(Wt,Vt))})(Ye),!wt()||(Xe&&m6(),Ol(),N1(),!wt()))return rt();const dt=uv();dt&&(av=De,lv=je,((be=o.virtualScroll)==null?void 0:be.settleMode)==="manual"&&Be!=null&&b0((Ne=o.virtualScroll)==null?void 0:Ne.settledToken)&&O1()===Be&&(Hc=W1(o.virtualScroll.settledToken)));const Ft=wt()&&dt&&I6(),Ht=wu(nt,Ft?"final":void 0);return Mv(Ht,!0),Ht})}let _v="content",Au=null,Mu=null,xv=0,F1=null,jc=null,Sv=null,Av=null;function R1(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function z6(L){var q,re;const ae=F1;if(!ae)return!0;const be=(re=(q=o.virtualScroll)==null?void 0:q.heightDiffThresholdPx)!=null?re:1;return Math.abs(L.totalHeight-ae.totalHeight)>be||L.sessionKey!==ae.sessionKey||L.phase!==ae.phase||L.stable!==ae.stable||L.final!==ae.final||L.threadKey!==ae.threadKey||L.nodeCount!==ae.nodeCount||L.measuredCount!==ae.measuredCount||L.width!==ae.width}function O1(L=(q=>(q=o.virtualScroll)==null?void 0:q.settledToken)()){return As(L)}function W6(L,q){var re,ae;return[L,q.sessionKey,(re=q.threadKey)!=null?re:"",Rl(),hv(),As((ae=o.virtualScroll)==null?void 0:ae.settledToken),Math.round(q.totalHeight),Math.round(q.width)].join("\0")}function P1(){Sv=null,Av=null,jc=null}function zF(L){const q=L.heightCache;return q?.length?yv(q):""}function D1(L){var q,re,ae;const be=L.metrics,Ne=L.anchor?(De=L.anchor).type==="bottom"?`bottom:${Math.round(De.distanceFromBottomPx)}`:`node:${De.nodeIndex}:${Math.round(De.offsetWithinNodePx)}`:"none";var De;return[L.sessionKey,(q=L.threadKey)!=null?q:"",(re=L.measurementKey)!=null?re:Rl(),(ae=L.contentHash)!=null?ae:"",zF(L),Ne,L.anchorCaptured?1:0,be.liveRange.start,be.liveRange.end,be.renderedCount,be.nodeCount,Math.round(be.totalHeight),Math.round(be.width),be.phase,be.stable?1:0].join("\0")}function Mv(L,q=!1){if(!Ct.value||(function(De=!1){return!De&&fo.value&&!Qt.value})(q))return;const re=q||z6(L),ae=(function(De,je=!1){return je||De.stable||De.phase==="final"?{state:zc(De,{includeHeightCache:!0})}:{state:zc(De)}})(L,q),be=ae.state,Ne=!!(be&&(re||(function(De,je=!1){return!!je||D1(De)!==jc})(be,q)));if(re&&($(L),F1=L,xv=R1()),be&&Ne&&(B(be),be.anchor&&H(be.anchor),jc=D1(be)),L.stable){const De=W6("settled",L);if(De!==Sv){Sv=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-settled",ot)})(L)}}if(L.phase==="final"){const De=W6("final",L);if(De!==Av){Av=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-final",ot)})(L)}}}function Tv(){Au!=null&&(Zo?.(Au),Au=null),Mu!=null&&G&&(window.clearTimeout(Mu),Mu=null)}function U6(){Au=null,Mu=null,(function(L){if(Fl.size>0||Xi!=null)return!0;switch(L){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(_v)&&(Ol(),N1()),Mv(wu(_v))}function po(L){var q,re;if(!Ct.value||(_v=L,Au!=null||Mu!=null))return;const ae=Math.max(0,(re=(q=o.virtualScroll)==null?void 0:q.emitIntervalMs)!=null?re:32),be=Math.max(0,ae-(R1()-xv)),Ne=()=>{Mu=null,Au=Bo?Bo(U6):null,Au==null&&U6()};G&&be>0?Mu=window.setTimeout(Ne,be):Ne()}function j6(){He.value+=1}function x0(L){if(Rs.value&&L>=yo.value){const q=St.value[L],re=Fe.value===!0&&Oe.value!==!0&&L>=St.value.length-2,ae=q?.type==="code_block"||q?.type==="image"||q?.type==="mermaid"||q?.type==="infographic";if(!re||ae)return!1}return!nl.value||L=ve.value&&(K.value||(K.value=!0,X2()),!u6.value||!Js))return Vc(L),void(q&&pa(L,!0));if(L{if(g6.delete(Ne),!nl.value||Y2.value.has(Ne))return;const ot=ao.get(Ne);if(!ot)return;const Ve=ue(ot),Ye=ot.ownerDocument||document,nt=Ye.defaultView||window,Be=!Ve||Ve===Ye.documentElement||Ve===Ye.body,Xe=!Be&&Ve?qt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Ve.getBoundingClientRect()):null,lt=Be?0:Xe.top,rt=Be?qt("nodeVisibilityFallback.clientHeight",()=>{var dt,Ft;return(Ft=(dt=nt.innerHeight)!=null?dt:Ve?.clientHeight)!=null?Ft:0}):Xe.bottom,wt=qt("nodeVisibilityFallback.node.getBoundingClientRect",()=>ot.getBoundingClientRect());wt.bottom>=lt-500&&wt.top<=rt+500&&pa(Ne,!0)},1800+De);g6.set(Ne,je)})(L);let be=null;be=Je(()=>ae.isVisible.value,Ne=>{if(Ne){v0(L),pa(L,!0),be?.(),g0.delete(L),Oc.get(L)===ae&&Oc.delete(L);try{ae.destroy()}catch{}}},{immediate:!0}),g0.set(L,be),sn.value&&Lr()}function Ev(){Xi=null,an(()=>{let L=!1;for(const[q,re]of Fl)Fl.delete(q),ol.get(q)===re.el&&bu.get(q)===re.version&&(L=ku(q,re.height,{allowShrink:re.allowShrink})||L);return L})}function qc(){Xi!=null&&(Zo?.(Xi),Xi=null),Fl.clear()}function A0(L,q){(function(re,ae,be){var Ne;if(!Number.isFinite(be)||be<=0||ol.get(re)!==ae)return;const De=bu.get(re);if(De==null)return;const je=St.value[re],ot=at.value&&Oe.value!==!0&&!((Ne=o.nodes)!=null&&Ne.length)&&re>=St.value.length-2,Ve=!(je?.loading===!0||ot),Ye=Fl.get(re),nt=Ye?Ye.allowShrink&&Ve:Ve,Be=Ye&&!nt?Math.max(Ye.height,be):be;Fl.set(re,{height:Be,allowShrink:nt,version:De,el:ae}),Xi==null&&(Xi=Bo?Bo(Ev):null,Xi==null&&Ev())})(L,q,A1(L,q))}function Ol(){for(const[L,q]of ol)q&&A0(L,q)}function V6(){fi?.disconnect(),fi=null,Gi.clear()}function Iv(){for(;f0.length;)m0(f0.pop())}Je(Qt,L=>{L&&po("content")},{flush:"post"}),t({getVirtualMetrics:wu,captureVirtualState:function(L={}){var q;return zc(wu("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:L.allowFallbackAnchor===!0,requireViewport:L.requireViewport===!0,includeEmptyState:(q=L.includeEmptyState)==null||q})},restoreVirtualState:function(L,q={}){const re=q.restoreAnchor===!0,ae=q.restoreToken==null?"imperative":String(q.restoreToken);L1=L,$1={restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0},!kv(L,{restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0})&&B6(L)||(L1=null,$1=null)},forceMeasure:function(L="manual"){return mo(this,null,function*(){yield yt(),yield H6(),Ol(),N1(),yield yt();const q=wu(L);return Mv(q,!0),q})},settle:wv,scrollToNode:function(L,q="start"){Wc(),$c();const re=St.value.length;if(re<=0)return;const ae=Bs(L,0,re-1),be=()=>{var Ne;const De=U2({nodeIndex:ae,offsetWithinNodePx:0}),je=Yn(ae),ot=E1(),Ve=(Ne=ot?.clientHeight)!=null?Ne:0,Ye=ei();let nt=De;if(q==="center")nt=De-Ve/2+je/2;else if(q==="end")nt=De-Ve+je;else if(q==="nearest"&&Ye!=null){if(De>=Ye&&De+je<=Ye+Ve)return;nt=Dees.value,L=>{if(!L){V6();for(const q of da.values())for(const re of q)m0(re);da.clear(),bu.clear(),Iv(),qc()}},{immediate:!0}),Je(Oe,L=>{L&&(function(){if(G&&Oe.value&&ol.size){Iv();for(const q of[80,240,640]){const re=h6(q,()=>{for(const[ae,be]of ol)be&&A0(ae,be)},"final");re!=null&&f0.push(re)}}})(),po(L?"final":"content")});const WF=Q_(()=>po("content"),16),UF=Q_(()=>po("batch"),16);Je([()=>St.value.length,()=>yo.value],()=>{Dt.value&&Uc(),WF()},{flush:"post",immediate:!0}),Je([()=>Ds.start,()=>Ds.end],()=>{UF()},{flush:"post"});const{cleanupBatchScheduler:jF}=(function(L){const{props:q,isClient:re,isTestEnv:ae,parsedNodesIdentity:be,parsedNodeCount:Ne,desiredRenderedCount:De,datasetKey:je,batchingEnabled:ot,incrementalRenderingActive:Ve,resolvedBatchSize:Ye,resolvedInitialBatch:nt,renderedCount:Be,adaptiveBatchSize:Xe,previousRenderContext:lt,previousBatchConfig:rt,requestFrame:wt,cancelFrame:dt,hasIdleCallback:Ft,cleanupNodeVisibility:Ht,onDatasetKeyChanged:Vt,onDatasetChanged:Wt}=L;let Kt=null,fn="raf",vn=null,Qn=0,Hs=!1,Ss=!1;const $r=new Set,il=new Set;function K1(){if(re){Kt!=null&&(fn==="raf"&&dt?dt(Kt):fn==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Kt):fn==="timeout"&&window.clearTimeout(Kt),Kt=null),Qn+=1;for(const ti of $r)dt&&dt(ti);for(const ti of il)window.clearTimeout(ti);$r.clear(),il.clear(),vn=null,Hs=!1,Ss=!1}}function R0(){return typeof performance<"u"?performance.now():Date.now()}function u7(ti){(function(Pl){var ma;if(!Ve.value)return;const Dl=Math.max(2,(ma=q.renderBatchBudgetMs)!=null?ma:6),Bl=Math.max(1,Ye.value||1),Nr=Math.max(1,Math.floor(Bl/4));Pl>1.5*Dl?Xe.value=Math.max(Nr,Math.floor(.8*Xe.value)):Pl<.6*Dl&&Xe.value=Dl)return;const Bl=Math.max(1,ti),Nr=()=>{const Gc=R0();Kt=null;const Z1=vn??Bl;vn=null;const Yc=R0();Be.value=Math.min(Dl,Be.value+Z1),Ht(Be.value),(function(Pv,O0){if(!re)return void u7(O0);Hs=!0;const p7=++Qn;yt().then(()=>{var h7;if(p7!==Qn)return;const dR=R0(),fR=Math.max(O0,dR-Pv),m7=()=>{p7===Qn&&u7(fR)};if(wt){let Eu=null,Xc=null,v7=!1;const y7=()=>{v7||(v7=!0,Eu!==null&&($r.delete(Eu),Eu=null),Xc!==null&&(il.delete(Xc),window.clearTimeout(Xc),Xc=null),m7())};return Eu=wt(()=>{y7()}),$r.add(Eu),Xc=window.setTimeout(()=>{Eu!==null&&dt&&dt(Eu),y7()},Math.max(32,(h7=q.renderBatchIdleTimeoutMs)!=null?h7:120)),void il.add(Xc)}const g7=window.setTimeout(()=>{il.delete(g7),m7()},0);il.add(g7)})})(Gc,R0()-Yc)};if(!re||Li.immediate)return void Nr();const ga=Math.max(0,(Pl=q.renderBatchDelay)!=null?Pl:16);if(vn=vn!=null?Math.max(vn,Bl):Bl,Kt==null){if(!ae&&Ft&&window.requestIdleCallback){const Gc=Math.max(0,(ma=q.renderBatchIdleTimeoutMs)!=null?ma:120);return fn="idle",void(Kt=window.requestIdleCallback(()=>Nr(),{timeout:Gc}))}if(wt&&!ae)return fn="raf",void(Kt=wt(()=>{ga===0?Nr():(fn="timeout",Kt=window.setTimeout(()=>Nr(),ga))}));fn="timeout",Kt=window.setTimeout(()=>Nr(),ga)}}function d7(ti,Li={}){Hs?Ss=!0:ti==null?f7():c7(ti,Li)}function f7(){Ve.value&&c7(ot.value?Math.max(1,Math.round(Xe.value)):Math.max(1,Ye.value))}return Je([be,Ne,je,Ve,Ye,nt,()=>q.renderBatchDelay],()=>{var ti;const Li=Ne.value,Pl=lt.value,ma=je.value,Dl=!Object.is(ma,Pl.key),Bl=Li!==Pl.total,Nr=Dl||Bl;lt.value={key:ma,total:Li};const ga=rt.value,Gc=(ti=q.renderBatchDelay)!=null?ti:16,Z1=ga.batchSize!==Ye.value||ga.initial!==nt.value||ga.delay!==Gc||ga.enabled!==Ve.value;rt.value={batchSize:Ye.value,initial:nt.value,delay:Gc,enabled:Ve.value},Dl&&Vt(Li),(Nr||Z1||!Ve.value)&&K1(),(Nr||Z1)&&(Xe.value=Math.max(1,Ye.value||1)),Nr&&Wt();const Yc=De.value;if(!Li)return Be.value=0,void Ht(0);if(!Ve.value)return Be.value=Yc,void Ht(Be.value);const Pv=Dl||Pl.total===0;Be.value=Pv||Z1?Math.min(Yc,nt.value):Math.min(Be.value,Yc);const O0=Math.max(1,nt.value||Ye.value||Li);Be.value{Ve.value&&(typeof Li=="number"&&ti<=Li||ti>Be.value&&d7())}),{cleanupBatchScheduler:K1}})({props:I,isClient:G,isTestEnv:Zi,parsedNodesIdentity:Ys,parsedNodeCount:Nn,desiredRenderedCount:p0,datasetKey:NF,batchingEnabled:Fs,incrementalRenderingActive:Rs,resolvedBatchSize:Ho,resolvedInitialBatch:Co,renderedCount:yo,adaptiveBatchSize:Le,previousRenderContext:ht,previousBatchConfig:Ze,requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,cleanupNodeVisibility:MF,onDatasetKeyChanged:L=>{qc(),so(),Pt(),P1(),L>0&&Rc(L)},onDatasetChanged:()=>{sn.value&&Lr({immediate:!0})}});Je([c6,sn,()=>O.value,()=>oe()],([L,q])=>{if(!L)return v6(),void G2();TF(),q?Lr({immediate:!0}):G2()},{flush:"post",immediate:!0}),Je([()=>St.value.length,()=>sn.value],L=>mo(null,[L],function*([q,re]){re&&q&&G&&(yield yt(),Lr({immediate:!0}))}),{flush:"post"}),Je(kn,L=>{L&&(function(){var q;if(no.value&&$s.value&&Xs.value&&((q=ci.value)!=null&&q[1]))return;const re=kt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),ae=kt({type:"list_item",children:[re],raw:"- Probe paragraph text"}),be=kt({type:"list",ordered:!1,items:[ae],raw:"- Probe paragraph text"});no.value=re,$s.value=ae,Xs.value=be;const Ne={1:null,2:null,3:null,4:null,5:null,6:null};for(let De=1;De<=6;De++)Ne[De]=kt({type:"heading",level:De,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(De)} Probe heading`});ci.value=Ne})()},{immediate:!0}),Je([()=>O.value,kn],()=>{if(!kn.value)return ev(),void(ne.value=0);k6(),ev(),kn.value&&O.value&&typeof ResizeObserver<"u"&&(T1=new ResizeObserver(()=>{k6(),Os.value&&yu(),Dt.value&&Uc(),po("resize")}),T1.observe(O.value))},{immediate:!0}),Je([kn,Ns,Ji],()=>mo(null,null,function*(){if(!kn.value)return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();yield yt(),(function(){if(!kn.value||typeof window>"u")return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();const L={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},q=y6(Q2(F.value),".paragraph-node");L.paragraph=l4(F.value,q,"pre-wrap");const re=Q2(U.value),ae=re?.querySelector(".paragraph-node");L.listItem=l4(U.value,ae,"pre-wrap");const be=qt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var De,je;return(je=(De=z.value)==null?void 0:De.offsetHeight)!=null?je:0}),Ne=qt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var De,je;return(je=(De=U.value)==null?void 0:De.offsetHeight)!=null?je:0});L.listWrapperOverhead=Math.max(0,be-Ne);for(let De=1;De<=6;De++){const je=y6(Q2(W[De]),`h${De}`);L.headings[De]=l4(W[De],je,"pre-wrap")}X.value=L,Pt()})()}),{flush:"post",immediate:!0}),Je(()=>St.value.length,()=>{sn.value&&Lr({immediate:!0})}),Je([kn,ne],()=>{Pt(),sn.value&&Lr({immediate:!0}),Os.value&&yu(),Dt.value&&Uc(),po("resize")},{immediate:!1}),Je(()=>nl.value,L=>{if(L)for(const[q,re]of ao)S0(q,re);else if(X2(),sn.value)Lr({immediate:!0});else for(const[q,re]of ao)re&&pa(q,!0)},{immediate:!1}),Je([pe,ve,()=>oe()],()=>{var L;(L=Js.refresh)==null||L.call(Js);for(const[q,re]of ao)S0(q,re)},{immediate:!1}),Je([()=>I.viewportPriority,()=>St.value.length,ve],([L,q,re])=>{if(L!==!1){if(K.value&&(q<=200||q<=re)){K.value=!1;for(const[ae,be]of ao)S0(ae,be)}}else K.value=!1}),Je(()=>yo.value,()=>{sn.value&&Lr({immediate:!0})}),Je([Nl,Io,Qo,()=>St.value.length,sn],()=>{M1()},{immediate:!0});let B1=null,H1=!1,Kc=null;function z1(){B1=null,av=null,lv=void 0,Hc=null,P1()}function Lv(){qc(),so(),Pt(),zo.clear();const L=St.value.length;L>0&&Rc(L),bv()}function $v(){Tv(),m6(),F1=null,xu=null,Su=null,w0=null,L1=null,$1=null,H1=!1,z1(),T6("restore"),$c(),Wc()}function W1(L){var q;return[(q=ns())!=null?q:"",wo(),Rl(),k0.value,O1(L),St.value.length,Math.round(ko(0,St.value.length)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")}function q6(){return mo(this,null,function*(){var L,q,re,ae;const be=(L=o.virtualScroll)==null?void 0:L.settledToken,Ne=O1(be),De=wo(),je=ns(),ot=Ji.value;if(Ct.value&&((q=o.virtualScroll)==null?void 0:q.settleMode)==="manual"&&b0(be))if(uv()){if(W1(be)!==Hc&&!H1){H1=!0;try{const Ve=yield wv({reason:"manual",expectedSettledTokenKey:Ne}),Ye=O1()===Ne;Cv(De,je,ot)&&Ve.sessionKey===De&&Ve.threadKey===je&&Ye&&Ve.stable&&Ve.phase==="final"&&(Hc=W1((re=o.virtualScroll)==null?void 0:re.settledToken))}finally{H1=!1,yield yt();const Ve=(ae=o.virtualScroll)==null?void 0:ae.settledToken,Ye=b0(Ve)?W1(Ve):"";Cv(De,je,ot)&&Ye&&Hc!==Ye&&q6()}}}else po("manual")})}Je(Ct,(L,q)=>{if(L!==q){if(!L)return $v(),void Tv();$v(),Lv(),Kc=Ji.value,po("content")}},{flush:"post"}),Je([Ct,Ji],([L,q])=>{L?Kc!=null?Kc!==q&&(Kc=q,(function(re="resize"){qc(),so(),Pt(),zo.clear();const ae=St.value.length;ae>0&&Rc(ae),bv(),xu=null,Su=null,w0=null,F1=null,H1=!1,z1(),D6(),yt(()=>{Ol(),Os.value&&yu(),Dt.value&&Uc(),po(re)})})("resize")):Kc=q:Kc=null},{flush:"post",immediate:!0}),Je([Ct,()=>wo(),()=>ns()],([L])=>{L&&($v(),Lv(),T6("content"),po("content"))}),Je([Ct,()=>wo(),()=>ns(),Ji,()=>St.value.length],([L])=>{L&&(function(q="async-node"){let re=!1;for(const[ae,be]of Array.from(sl.entries()))iv(be)||(sl.delete(ae),Yi.delete(ae),re=!0);re&&(Dc(),po(q))})("async-node")},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.sessionKey},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>o.indexKey,()=>ie.value],([L])=>{L&&(P1(),(function(q="content"){if(!Ct.value)return;const re=[],ae=St.value.length,be=J2(ae);for(const Ne of Array.from(zo.keys())){if(Ne>=ae){re.push(Ne);continue}if(Ne=ae&&zo.delete(Ne);re.length&&((function(Ne,De={}){const je=Array.from(Ne,Number);Gt(je);let ot=0;if(an(()=>(ot=q2(je,De),ot>0)),ot>0)(function(Ve){for(const Ye of Ve)zo.delete(Ye)})(je);else for(const Ve of je)J.delete(Ve)})(re,{notify:!1}),Pt(),z1(),Os.value&&yu(),Dt.value&&Uc(),po(q))})("content"))},{flush:"post",immediate:!0}),Je([Ct,()=>St.value.length,()=>wo(),()=>ns()],([L,q,re,ae],[be,Ne,De,je])=>{L&&be&&re===De&&ae===je&&q!==Ne&&z1()},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCache},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCacheWidth},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],()=>{D6()},{flush:"post",immediate:!0}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreAnchor},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q,re]){if(!q||!re)return;yield yt();const ae=(function(){var be;const Ne=(be=o.virtualScroll)==null?void 0:be.restoreAnchor;return Ne==null||Ne===!1?null:Ne===!0?"true":String(Ne)})();kv(re,{restoreAnchor:ae!=null,restoreToken:ae??void 0})}),{flush:"post",immediate:!0}),Je([Ct,ne,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey}],([L])=>{var q;if(!L)return;const re=(q=o.virtualScroll)==null?void 0:q.restoreState;re&&xu&&Su==="restore"&&(O6(re)||(Lv(),xu=null,Su=null,po("resize")))},{flush:"post"}),Je([Ct,()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q]){var re;const ae=L1,be=$1;q&&ae&&(yield yt(),!kv(ae,{restoreAnchor:be?.restoreAnchor===!0,restoreToken:(re=be?.restoreToken)!=null?re:"imperative",allowUncapturedAnchor:be?.allowUncapturedAnchor===!0})&&B6(ae)||(L1=null,$1=null))}),{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>hi.count,()=>hi.total],([L,q,re])=>{if(!L||q!==!0||re==="manual"||!cv())return;const ae=(function(){var be;const Ne=St.value.length;return[(be=ns())!=null?be:"",wo(),Rl(),k0.value,Ne,Math.round(ko(0,Ne)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")})();B1!==ae&&(B1=ae,wv({reason:"final"}).then(be=>{be.stable||B1!==ae||(B1=null)}))},{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settledToken},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>St.value.length,()=>hi.count,()=>hi.total],()=>{q6()},{flush:"post",immediate:!0}),Je([()=>St.value.length,sn,Io,Qo,()=>Ds.start,()=>Ds.end],([L,q,re,ae,be,Ne])=>{fe.value&&Mn("virtualization",{nodes:L,virtualization:q,maxLiveNodes:re,buffer:ae,focusIndex:Nl.value,scroll:q?(()=>{const De=ut.value||ue();return De?{reverse:Se(De),scrollTop:Math.round(De.scrollTop),scrollTopAbs:Math.round(Math.abs(De.scrollTop)),scrollHeight:Math.round(De.scrollHeight),clientHeight:Math.round(De.clientHeight)}:null})():null,liveRange:{start:be,end:Ne},rendered:yo.value})}),Je([()=>I.customId],([L],q,re)=>{if(!L||Oo)return;const ae=(function(be,Ne){return be?(ys.controllers[be]=Ne,()=>{ys.controllers[be]===Ne&&delete ys.controllers[be]}):()=>{}})(L,{captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2,getReport:LF});re(()=>{ae()})},{immediate:!0}),Vn(()=>{(function(){if(Ct.value)try{Ol(),N1();const L=wu("manual");z6(L)&&($(L),F1=L,xv=R1());const q=zc(L,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});q&&(B(q),q.anchor&&H(q.anchor),jc=D1(q))}catch{}})(),jF(),X2(),en(),V6();for(const L of da.values())for(const q of L)m0(q);da.clear(),bu.clear(),zo.clear(),Iv(),qc(),ev(),$c(),Wc(),Tv(),v6(),G2()});const VF=Af("ViewportDeferredMermaidBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index11-Ci8_PlMN.js"),__vite__mapDeps([7,5]))).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',L),Pi}}),loadingComponent:px,delay:0}),px),qF=Af("ViewportDeferredInfographicBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index10-BCo1_xRY.js"),[])).default}catch(L){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',L),Pi}}),loadingComponent:fx,delay:0}),fx),KF=Af("ViewportDeferredD2BlockNode",zr(()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index8-BaK3y7fN.js"),[])).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',L),Pi}})),Pi),K6={text:qo,paragraph:cc,heading:L2,code_block:X9,list:qd,list_item:Vd,blockquote:tm,table:ep,definition_list:nm,footnote:om,footnote_reference:or,footnote_anchor:Jf,admonition:lm,vmr_container:im,hardbreak:qa,link:Mi,image:Va,thematic_break:sm,math_inline:Jr,math_block:C$,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,inline_code:li,html_inline:sr,reference:xi,html_block:Qf},ZF=R(()=>ov()),Z6=R(()=>X_(I.codeBlockProps)),GF=R(()=>X_(I.codeBlockProps,{omit:["langs"]})),G6=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,monacoOptions:I.codeBlockMonacoOptions,themes:I.themes,langs:m.value==="shiki"?I.langs:void 0,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),GF.value)),Y6=R(()=>mt(rn(mt({},G6.value),{langs:I.langs}),Z6.value));function X6(L){return typeof L=="boolean"?L:void 0}const YF=R(()=>{const L=I.codeBlockProps||{},q={},re=X6(L.showLineNumbers);re!==void 0&&(q.showLineNumbers=re);const ae=X6(L.diffInline);ae!==void 0&&(q.diffInline=ae);const be=(function(Ne){const De=Number(Ne);return Number.isFinite(De)&&De>0?De:void 0})(L.reservedHeightPx);return be!==void 0&&(q.reservedHeightPx=be),q}),XF=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,themes:I.themes,langs:I.langs,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),Z6.value)),JF=R(()=>mt({},I.mermaidProps||{})),J6=R(()=>mt({},I.d2Props||{})),QF=R(()=>mt({},I.infographicProps||{})),U1=R(()=>({typewriter:f.value,fade:I.fade,customHtmlTags:lo.value.customHtmlTags})),eR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltip:we.value}:{})),tR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),nR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),oR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{}));function sR(L){return Array.isArray(L.children)&&L.children.length>0}const M0=R(()=>IF.value.map(L=>{var q,re,ae,be,Ne,De,je,ot;let Ve=(function(dt){var Ft,Ht,Vt,Wt,Kt,fn,vn;if(dt.type!=="code_block")return dt;const Qn=dt,Hs=[String((Ft=Qn.language)!=null?Ft:""),String((Ht=Qn.loading)!=null?Ht:""),String((Vt=Qn.diff)!=null?Vt:""),String((Wt=Qn.code)!=null?Wt:""),String((Kt=Qn.originalCode)!=null?Kt:""),String((fn=Qn.updatedCode)!=null?fn:""),String((vn=Qn.raw)!=null?vn:"")].join("\0"),Ss=Ll.get(Qn);if(Ss&&Ss.signature===Hs)return Ss.node;const $r=mt({},Qn);return Ll.set(Qn,{signature:Hs,node:$r}),$r})(L.node);const Ye=T0(Ve);let nt=n7(Ve,Ye);if((Ve.type==="html_block"||Ve.type==="html_inline")&&nt===K6[Ve.type]){const dt=Ve,Ft=String((q=dt.tag)!=null?q:"").trim().toLowerCase()||ZI(dt.content);if(Ft){const Ht=In.value[Ft];if(To.value.has(Ft)&&Ht)nt=Ht,Ve=rn(mt({},dt),{type:Ft,tag:Ft,content:pie(dt.content,Ft)});else if(GI((re=dt.content)!=null?re:dt.raw,Ft)){const Vt=String((be=(ae=dt.content)!=null?ae:dt.raw)!=null?be:"");Ve.type==="html_inline"?(nt=qo,Ve={type:"text",content:Vt,raw:Vt}):(nt=cc,Ve={type:"paragraph",children:[{type:"text",content:Vt,raw:Vt}],raw:Vt})}}}const Be=Ve.type==="code_block"&&m.value==="pre"&&nt===Pi&&!Nv(In.value,Ye);let Xe=mt({},(function(dt,Ft,Ht){const Vt=Ft??T0(dt);if(dt.type==="code_block"){const Wt=Vt?Nv(In.value,Vt):void 0;if(Ht&&m.value==="pre"&&!Wt&&Ht===Pi)return YF.value;if(Ht&&Vt&&Ht===Wt)return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:Y6.value;if(Ht&&Ht===In.value.code_block)return Y6.value;if(C6(Ht))return XF.value}return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:dt.type==="link"?eR.value:dt.type==="list"?tR.value:dt.type==="blockquote"?nR.value:dt.type==="table"?oR.value:dt.type==="code_block"?G6.value:U1.value})(Ve,Ye,nt));const lt=kn.value?Pc.value[L.index]:null;Ve.type==="code_block"&<?.kind==="code-block"&&(Xe=rn(mt({},Xe),Be?{reservedHeightPx:(Ne=lt.height)!=null?Ne:lt.contentHeight}:{estimatedHeightPx:lt.height,estimatedContentHeightPx:lt.contentHeight,estimatedDiffInline:lt.diffInline})),Be||Ve.type!=="code_block"||Ye!=="mermaid"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:lg(ig(String((De=Ve.code)!=null?De:"")))})),Be||Ve.type!=="code_block"||Ye!=="infographic"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:ag(rg(String((je=Ve.code)!=null?je:"")))})),Ve.type==="math_block"&&(Xe=rn(mt({},Xe),{cacheScope:_n}));const rt=(function(dt,Ft){const Ht=String(dt.type);return!Qp(Ht)&&In.value[Ht]===Ft})(Ve,nt),wt=rt?p5(Ve,ge.value):void 0;return rn(mt({},L),{node:Ve,component:nt,bindings:Xe,customBindings:mt(mt({},wt??{}),Xe),rendersCustomNode:rt,hasSlotChildren:sR(Ve),slotContent:String((ot=Ve.content)!=null?ot:""),isCodeBlock:Ve.type==="code_block",indexKey:`${ZF.value}-${L.index}`,vnodeKey:`${$F.value}\0${L.index}\0${Ve.type}`})}));function T0(L){var q;return L?.type==="code_block"?String((q=L.language)!=null?q:"").trim().toLowerCase():""}function Nv(L,q){const re=q.trim().toLowerCase();if(re)for(const ae of[re,T2(re),n$(re)]){const be=ae&&L[ae];if(be)return be}}function Q6(L,q,re,ae){var be,Ne;const De=mt({},L.value);return Md(De.estimatedPreviewHeightPx)==null&&(De.estimatedPreviewHeightPx=ae(re(String((be=q?.code)!=null?be:"")),void 0,De.maxHeight==="none"?null:(Ne=Md(De.maxHeight))!=null?Ne:void 0)),De}function e7(L){return Q6(JF,L,ig,lg)}function t7(L){return Q6(QF,L,rg,ag)}function n7(L,q){if(!L)return l8;const re=In.value,ae=re[String(L.type)];if(L.type==="code_block"){const be=q??T0(L),Ne=be?Nv(re,be):void 0;return Ne||(m.value==="pre"?re.code_block||Pi:be==="mermaid"?re.mermaid||VF:be==="infographic"?re.infographic||qF:be==="d2"||be==="d2lang"?re.d2||KF:ae||re.code_block||w6.value)}return ae||K6[String(L.type)]||l8}function Fv(L){s("click",L)}function iR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseover",L)}function rR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseout",L)}function o7(L){s("mouseover",L)}function s7(L){s("mouseout",L)}const Tu=Z(null),Ii=Z(!1),j1=Z(null),lR=R(()=>!(I.domMode!=="minimal"||Y.value||I.fade!==!1||f.value||Ii.value||Xt.value||sn.value||Qe.value||co.value||Ki.value||Object.keys(In.value).length!==0));let V1,Zc=null,Rv=0,E0=0,I0=0;const i7=["code_block","admonition","table","math_block","html_block","image","thematic_break"],aR=new Set(i7),r7=[".typewriter-cursor",".height-estimation-probes",...i7.map(L=>`[data-node-type="${L}"]`),"script","style"].join(",");function l7(L){if(!L||typeof L!="object")return!1;const q=L.type;return typeof q=="string"&&aR.has(q)}function L0(L){var q,re;if(!L||typeof L!="object")return 0;const ae=L,be=(re=(q=ae.raw)!=null?q:ae.content)!=null?re:ae.code;if(typeof be=="string")return be.length;const Ne=ae.children;if(Array.isArray(Ne))return Ne.reduce((je,ot)=>je+L0(ot),0);const De=ae.items;return Array.isArray(De)?De.reduce((je,ot)=>je+L0(ot),0):0}function $0(){V1&&(clearTimeout(V1),V1=void 0)}function Ov(){Rv+=1,Zc!=null&&(Zo?.(Zc),Zc=null)}function q1(){Ov(),ha(),Tu.value&&(Tu.value.style.visibility="hidden")}function uR(L){var q;if(L.nodeType!==Node.TEXT_NODE||!((q=L.textContent)!=null?q:"").trim())return!1;const re=L.parentElement;return!!re&&!re.closest(r7)}function cR(L){let q=L.lastChild;for(;q;){if(uR(q))return q;if(q.nodeType===Node.ELEMENT_NODE){const re=q;if(!re.matches(r7)&&re.lastChild){q=re.lastChild;continue}}for(;q&&q!==L&&!q.previousSibling;)q=q.parentNode;if(!q||q===L)break;q=q.previousSibling}return null}function a7(){const L=M0.value;for(let q=L.length-1;q>=0;q--){const re=L[q];if(!re||l7(re.node)||!x0(re.index))continue;const ae=ao.get(re.index);if(!ae)continue;const be=cR(ae);if(be)return be}return null}function ha(){j1.value&&(j1.value.classList.remove(hx),j1.value=null)}function N0(){if(d.value!=="simple"||!G||!Ii.value||!O.value)return void ha();const L=a7(),q=L?(function(re){var ae;const be=(ae=re.parentElement)==null?void 0:ae.closest(".text-node");return be instanceof HTMLElement?be:re.parentElement})(L):null;q!==j1.value&&(ha(),q&&(q.classList.add(hx),j1.value=q))}function F0(){if(d.value!=="precise"||!G||!Ii.value||Zc!=null)return;const L=Rv,q=()=>{Zc=null,L===Rv&&(function(){var re,ae;if(d.value!=="precise"||!(G&&Ii.value&&O.value&&Tu.value))return;const be=O.value,Ne=Tu.value;Ne.style.visibility="hidden";const De=a7();if(!De)return;let je=0,ot=0,Ve=20,Ye=!1;if(De?.textContent){const nt=De.textContent.length,Be=document.createRange();Be.setStart(De,Math.max(0,nt-1)),Be.setEnd(De,nt);const Xe=typeof Be.getClientRects=="function"?Be.getClientRects():void 0,lt=(ae=Xe?.[Xe.length-1])!=null?ae:(re=De.parentElement)==null?void 0:re.getBoundingClientRect();if(lt){const rt=qt("typewriterCursor.root.getBoundingClientRect",()=>be.getBoundingClientRect());je=lt.right-rt.left+be.scrollLeft,ot=lt.top-rt.top+be.scrollTop,Ve=lt.height||Ve,Ye=!0}Be.detach()}Ye&&(Ne.style.transform=`translate(${Math.max(0,je)}px, ${Math.max(0,ot)}px)`,Ne.style.height=`${Ve}px`,Ne.style.visibility="visible")})()};Bo?Zc=Bo(q):q()}return Je([it,()=>o.content,()=>o.nodes,()=>I.typewriter,Oe],()=>mo(null,null,function*(){var L,q;if(!G||Y.value||!te.value)return;if(Oe.value)return Ii.value=!1,$0(),void q1();if((L=o.nodes)!=null&&L.length)return Ii.value=!1,$0(),q1(),E0=((q=o.content)!=null?q:"").length,void(I0=it.value.length);const re=(function(){var je,ot;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((Ve,Ye)=>Ve+L0(Ye),0):((ot=o.content)!=null?ot:"").length})(),ae=(function(){var je;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((ot,Ve)=>ot+L0(Ve),0):it.value.length})(),be=!l7(St.value[St.value.length-1]),Ne=re>E0,De=ae>I0;if(!f.value||!be||!Ne&&!De)return f.value&&be||(Ii.value=!1,q1()),E0=re,void(I0=ae);E0=re,I0=ae,Ii.value=!0,d.value==="precise"&&Tu.value&&(Tu.value.style.visibility="hidden"),$0(),yield yt(),d.value==="simple"?N0():(ha(),F0()),V1=setTimeout(()=>{V1=void 0,Ii.value=!1},3e3)}),{flush:"post",immediate:!0}),Je(Ii,L=>mo(null,null,function*(){L?(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0()):q1()}),{flush:"post"}),Je(d,()=>mo(null,null,function*(){if(G&&!Y.value&&te.value&&Ii.value){if(yield yt(),d.value==="simple")return Ov(),void N0();ha(),d.value!=="precise"?q1():F0()}}),{flush:"post"}),Je([()=>yo.value,()=>Ds.start,()=>Ds.end],()=>mo(null,null,function*(){G&&!Y.value&&te.value&&Ii.value&&(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0())}),{flush:"post"}),Vn(()=>{$0(),Ov(),ha(),xs.clear()}),(L,q)=>{const re=zO("NodeRenderer",!0);return p(Y)?(y(!0),M(Pe,{key:0},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[0]||(q[0]=be=>i(be)),onHandleArtifactClick:q[1]||(q[1]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[2]||(q[2]=be=>i(be)),onHandleArtifactClick:q[3]||(q[3]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(y(),M("div",{key:1,ref_key:"containerRef",ref:O,class:Re(["markstream-vue markdown-renderer",[{dark:I.isDark},{virtualized:sn.value},{"virtual-scroll-coordinated":Qt.value},{"stable-layout":_F.value},{"typewriter-simple-cursor":Ii.value&&d.value==="simple"}]]),"data-custom-id":I.customId,onClick:Fv,onMouseover:iR,onMouseout:rR},[Ko.value||sn.value?(y(),M(Pe,{key:0},[Ko.value?(y(),he(lpe,{key:0,width:Ns.value,"flow-root":sn.value||Qt.value,"paragraph-node":no.value,"list-item-node":$s.value,"list-node":Xs.value,"heading-nodes":ci.value,"set-paragraph-wrapper":xF,"set-list-item-wrapper":SF,"set-list-wrapper":AF,"set-heading-wrapper":EF},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):ee("",!0),sn.value?(y(),M("div",{key:1,class:"node-spacer",style:Zt({height:`${tv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],64)):ee("",!0),lR.value?(y(!0),M(Pe,{key:1},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[x0(ae.index)?(y(),he(bs(ae.component),zn({key:0,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onMouseover:q[4]||(q[4]=be=>s("mouseover",be)),onMouseout:q[5]||(q[5]=be=>s("mouseout",be)),onCopy:q[6]||(q[6]=be=>i(be)),onHandleArtifactClick:q[7]||(q[7]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):ee("",!0)],64))),128)):(y(!0),M(Pe,{key:2},pt(M0.value,ae=>(y(),M("div",{key:ae.vnodeKey,ref_for:!0,ref:be=>S0(ae.index,be),class:"node-slot","data-node-index":ae.index,"data-node-type":ae.node.type},[x0(ae.index)?(y(),M("div",{key:0,ref_for:!0,ref:be=>(function(Ne,De){var je;De||(function(nt){const Be=`${ov()}-${nt}`;let Xe=!1;for(const lt of Array.from(Yi.keys())){const rt=sl.get(lt);(rt?.index===nt||lt===Be||lt.startsWith(`${Be}-`))&&(Yi.delete(lt),sl.delete(lt),Xe=!0)}Xe&&(Dc(),po("async-node"))})(Ne),Fl.delete(Ne),(function(nt){var Be;const Xe=((Be=bu.get(nt))!=null?Be:0)+1;bu.set(nt,Xe)})(Ne);const ot=da.get(Ne);if(ot){for(const nt of ot)m0(nt);da.delete(Ne)}if((function(nt){const Be=Gi.get(nt);Be&&(fi?.unobserve(Be),Er.delete(Be),Gi.delete(nt))})(Ne),!De||!es.value)return ol.delete(Ne),void bu.delete(Ne);ol.set(Ne,De);const Ve=()=>{A0(Ne,De)};queueMicrotask(Ve);const Ye=(fi||typeof ResizeObserver>"u"||(fi=new ResizeObserver(nt=>{if(nt.length)for(const Be of nt){const Xe=Er.get(Be.target),lt=Gi.get(Xe??-1);Xe!=null&<&&A0(Xe,lt)}else Ol()})),fi);if(Ye&&(Gi.set(Ne,De),Er.set(De,Ne),Ye.observe(De)),typeof window<"u"){const nt=((je=St.value[Ne])==null?void 0:je.type)==="code_block"?[16,80,240,800]:Oe.value?[80]:[];if(nt.length){const Be=nt.map(Xe=>h6(Xe,Ve,"node-resize")).filter(Xe=>Xe!=null);Be.length&&da.set(Ne,Be)}}})(ae.index,be),class:"node-content"},[ae.isCodeBlock?ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:1,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[12]||(q[12]=be=>i(be)),onHandleArtifactClick:q[13]||(q[13]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:2,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[14]||(q[14]=be=>i(be)),onHandleArtifactClick:q[15]||(q[15]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(y(),he(as,{key:0,name:"fade",css:I.fade!==!1,appear:I.fade!==!1},{default:me(()=>[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[8]||(q[8]=be=>i(be)),onHandleArtifactClick:q[9]||(q[9]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[10]||(q[10]=be=>i(be)),onHandleArtifactClick:q[11]||(q[11]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(y(),M("div",{key:1,class:"node-placeholder",style:Zt({height:`${Yn(ae.index)}px`})},null,4))],8,cpe))),128)),Ii.value&&d.value==="precise"?(y(),M("span",{key:3,ref_key:"typewriterCursorRef",ref:Tu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ee("",!0),sn.value?(y(),M("div",{key:4,class:"node-spacer",style:Zt({height:`${nv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],42,upe))}}})),[["__scopeId","data-v-a9489508"]]),Vi=R$;Vi.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",Vi.__name,Vi.name].filter(n=>!!n));for(const n of t)e.component(n,R$)};const M5=Object.freeze(Object.defineProperty({__proto__:null,default:Vi},Symbol.toStringTag,{value:"Module"})),dpe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},fpe={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},ppe={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},hpe={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},mpe={class:"admonition-title"},gpe=["aria-expanded","aria-controls"],vpe=["id"],lm=Gn(et({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=R(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const u=o.node.kind||"note";return u.charAt(0).toUpperCase()+u.slice(1)}),r=Z(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(u,c)=>(y(),M("div",{class:Re(["admonition",[`admonition-${o.node.kind}`]])},[C("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(y(),M("svg",dpe,[...c[1]||(c[1]=[C("circle",{cx:"12",cy:"12",r:"10"},null,-1),C("path",{d:"M12 16v-4"},null,-1),C("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(y(),M("svg",fpe,[...c[2]||(c[2]=[C("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),C("path",{d:"M9 18h6"},null,-1),C("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(y(),M("svg",ppe,[...c[3]||(c[3]=[C("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"},null,-1),C("path",{d:"M12 9v4"},null,-1),C("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(y(),M("svg",hpe,[...c[4]||(c[4]=[C("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),C("path",{d:"M12 8v4"},null,-1),C("path",{d:"M12 16h.01"},null,-1)])])):ee("",!0),C("span",mpe,N(i.value),1),o.node.collapsible?(y(),M("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(y(),M("svg",{style:Zt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...c[5]||(c[5]=[C("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,gpe)):ee("",!0)]),Bn(C("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[j(p(Vi),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:c[0]||(c[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,vpe),[[qs,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);lm.install=e=>{e.component(lm.__name,lm)};const f8=()=>jo(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let xh=null,Sh=f8,Ah=null,mx=!1,gx=!1;function $Ve(){return mo(this,null,function*(){if(xh)return xh;const e=Sh;return e?e===f8&&mx?null:Ah||(Ah=mo(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===f8)return e===Sh&&(mx=!0,(function(o){gx||(gx=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===Sh&&(Ah=null)}return e!==Sh?null:t?(xh=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),xh):null}),Ah):null})}let Mh=null,O$=null,Th=null;function NVe(){return typeof O$=="function"}function FVe(){return mo(this,null,function*(){if(Mh)return Mh;const e=O$;return e?Th||(Th=mo(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(Mh=n,Mh):null}).finally(()=>{Th=null}),Th):null})}const RVe=Symbol("markstreamLanguageIconResolver"),P$=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],ype=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),p8=[...P$].sort((e,t)=>t.length-e.length).join("|"),a4=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${p8}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${p8})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),D$=/[),.;!?,。;!?)]+$/;function kpe(e){const t=e.toLowerCase();return P$.some(n=>t.endsWith(`.${n}`))}function bpe(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${p8}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Cpe(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(D$,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=ype.has(i),a=kpe(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const u=o[2]??o[3],c=u?Number(u):void 0;return{path:s,line:c!==void 0&&Number.isFinite(c)&&c>0?c:void 0}}function wpe(e,t={}){const n=[];a4.lastIndex=0;let o;for(;(o=a4.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const u=a.replace(D$,""),c=a.length-u.length;a=u;const d=Cpe(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),c>0&&(a4.lastIndex-=c)}return n}function u4(e,t){let n=0,o=t-1;for(;o>=0&&e[o]==="\\";)n++,o--;return n%2===1}const _pe=/\s/,xpe=/\p{Nd}/u;function Cc(e,t){const n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function Spe(e,t){if(t<=0)return;const n=e.charCodeAt(t-1),o=n>=56320&&n<=57343&&t>1?t-2:t-1,s=e.codePointAt(o);return s===void 0?void 0:String.fromCodePoint(s)}function vx(e){return e!==void 0&&_pe.test(e)}function a1(e){return e!==void 0&&xpe.test(e)}function Ape(e,t){const n=e[t+1];return a1(Cc(e,t+1))?!0:(n==="-"||n==="+"||n==="."||n==="−"||n==="+"||n==="-")&&a1(Cc(e,t+2))}function vg(e){return e!==void 0&&e>="A"&&e<="Z"}const B$=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function Mpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))||a1(Cc(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")&&!/\p{L}/u.test(Cc(e,t+1)??"")}function Tpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")}const Epe=/^[-–—,,、;;::~~(([【//]$/;function Ipe(e,t){const n=e[t+1];if(n!=="-"&&n!=="+"&&n!=="."||!a1(Cc(e,t+2)))return!1;const o=e[t-1];return o!==void 0&&Epe.test(o)}function Lpe(e){const t=String.raw`[、,,;;::~~\-–—至到//\s()()=*×=]|和|跟|与|及|或|and|or`;let n=e.replace(new RegExp(String.raw`^(?:${t})+`,"u"),"");for(;;){const s=n.replace(new RegExp(String.raw`^\p{L}+(?:${t})+`,"u"),"").replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,"");if(s===n)break;n=s}if(!/\p{Nd}/u.test(n))return!1;const o=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${o}(?:\p{L}+)?(?:(?:${t})+${o}(?:\p{L}+)?)*$`,"u").test(n)}const ul=-1,yx=1,kx=2,bx=3;function $pe(e){const t=e.length,n=new Uint8Array(t),o=new Int32Array(t+1).fill(ul),s=new Int32Array(t+1),i=new Int32Array(t+1),r=[],l=[];{const F=[];for(let K=0;K{for(;a=(l[a]?.[1]??0);)a++;const U=l[a];return U!==void 0&&F>=U[0]},c=new Set(' \n\r)。,、;:!?"<>`「」『』【】〔〕()*—–“”‘’'),d=[];for(const F of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))d.push(F.index);for(const F of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))d.push(F.index);for(const F of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(F.index===0||!/[\w~/.-]/.test(e[F.index-1]))&&d.push(F.index);d.sort((F,U)=>F-U);let f=-1;for(const F of d){if(FF+7&&!/[\w/?#@~.+&=%-]/.test(e[U+1]??""))break}U++}r.push([F,U]),f=U}const h=[];for(let F=0;F]/.test(K))continue;let V=U,ie=ul,ne=ul;for(;V"){ne=V;break}if(!z&&X==="/"&&e[V+1]===">"){ne=V+1;break}if(!/\s/.test(X)){ie=V;break}for(;V"){ne=V;break}if(z){ie=V;break}if(le==="/"&&e[V+1]===">"){ne=V+1;break}const Ie=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(V));if(!Ie){ie=V;break}V+=Ie[0].length;let de=V;for(;de`]+/.exec(e.slice(de));if(!ve){ie=de;break}V=de+ve[0].length}}}if(ne!==ul)h.push([F,ne+1]),F=ne;else if(ie!==ul){const X=e.indexOf("<",F+1);F=(X!==-1&&X",F+2);ie===-1?v=!1:(h.push([F,ie+2]),F=ie+1,z=!0)}else if(U==="!"){if(e[F+2]==="-"&&e[F+3]==="-"){if(m){const ie=e.indexOf("-->",F+4);ie===-1?m=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(e.startsWith("[CDATA[",F+2)){if(k){const ie=e.indexOf("]]>",F+9);ie===-1?k=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(w&&/[A-Z]/.test(e[F+2]??"")){const ie=e.indexOf(">",F+3);ie===-1?w=!1:(h.push([F,ie+1]),F=ie,z=!0)}}if(z)continue;if(U!==void 0&&/[a-zA-Z]/.test(U)){const ie=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(F+1));if(ie){let ne=F+1+ie[0].length;for(;ne"&&e[ne]!=="<"&&!/\s/.test(e[ne]);)ne++;if(e[ne]===">"){h.push([F,ne+1]),F=ne;continue}}}if(U===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(U))continue;let W=F+1;for(;W"&&(h.push([F,W+1]),F=W)}}h.sort((F,U)=>F[0]-U[0]);const b=[];for(const[F,U]of h){const z=b[b.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):b.push([F,U])}r.push(...b);let _=0;const g=F=>{for(;_=(b[_]?.[1]??0);)_++;const U=b[_];return U!==void 0&&F>=U[0]},x=[];let S=null,T=0,A=!1;for(let F=0;F"&&(A=!1);else if(!(u(F)||g(F))){if(S!==null)e[F]===S&&(S=null);else if(x.length>0&&(e[F]==='"'||e[F]==="'")&&F>0&&/\s/.test(e[F-1]))S=e[F];else if(e[F]==="[")T++;else if(e[F]==="]")T>0&&e[F+1]==="("&&(x.push(F),A=e[F+2]==="<",F++),T=Math.max(0,T-1);else if(e[F]==="("&&x.length>0)x.push(-1);else if(e[F]===")"&&x.length>0){const U=x.pop();if(U!==void 0&&U>=0){const z=e.slice(U+2,F);(/\s/.exec(z)===null||z.startsWith("<")&&/^<(?:\\[<>]|[^<>])*>$/.test(z)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(z))&&r.push([U,F+1])}}}r.sort((F,U)=>F[0]-U[0]);const E=[];for(const[F,U]of r){const z=E[E.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):E.push([F,U])}const P=F=>{let U=0,z=E.length-1;for(;U<=z;){const W=U+z>>1,K=E[W];if(K===void 0)return!1;if(F=K[1])U=W+1;else return!0}return!1};for(let F=0;F=0;F--)n[F]===bx&&(D=F),o[F]=D;const I=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,$=/[^\p{L}\p{Nd}\s]$/u,B=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,H=/(?:^|\s)[a-z]{2,}/,O=(F,U)=>{const z=Cc(e,F+1);if(z===void 0||!I.test(z))return!1;const W=o[F+1]??ul;if(W!==ul){const K=e.slice(F+1,W);return!(K.length===((K.codePointAt(0)??0)>65535?2:1))&&B.test(K)||/[,;:!?]$/.test(K)||/^[a-z]{2,}$/.test(K)?!1:(s[W]??0)-(s[F+1]??0)===0&&(i[W]??0)-(i[F+1]??0)===0}return $.test(U)||B.test(U)||H.test(U)};return(F,U=-1)=>{if(e[F]!=="$"||n[F]===yx||e[F+1]==="$"||e[F-1]==="$"&&U!==F||Mpe(e,F)||F+1>=t||vx(e[F+1]))return null;const z=o[F+1]??ul;if(z===ul||(s[z]??0)-(s[F+1]??0)>0||(i[z]??0)-(i[F+1]??0)>0)return null;const W=e.slice(F+1,z);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(W)||e[z+1]==="{"&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(W)||a1(Spe(e,F))&&Lpe(W)||Ape(e,F)&&(O(z,W)||Tpe(e,z)||/\s/.test(W)&&/\p{Nd}$/u.test(W)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(W)||e[z+1]==="$"&&!/\p{L}/u.test(W)&&/[^\p{L}\p{Nd}\s]$/u.test(W))?null:{content:W,end:z+1}}}const Cx=new WeakMap;function Npe(e,t){if(e.src[e.pos]!=="$")return!1;let n=Cx.get(e);(!n||n.src!==e.src)&&(n={src:e.src,match:$pe(e.src),lastEnd:-1},Cx.set(e,n));const o=n.match(e.pos,n.lastEnd);if(!o||o.end>e.posMax)return!1;if(n.lastEnd=o.end,t)return e.pos=o.end,!0;const s=e.push("math_inline","math",0);return s.content=o.content,s.markup="$",s.raw=e.src.slice(e.pos,o.end),s.loading=!1,e.pos=o.end,!0}function Fpe(e){return e.inline.ruler.disable("math"),e.inline.ruler.before("escape","math",Npe),e}const Rpe=12e4,Ope=6e4,Ppe=32,Dpe=3e4,wx=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function Bpe(e){let t=0,n=0,o=0;wx.lastIndex=0;let s;for(;(s=wx.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=Rpe||n>=Ope||t>=Ppe||o>=Dpe?"pre":"shiki",codeFenceCount:t,codeChars:n}}async function H$(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return zpe(e)}function Hpe(e){if(typeof e!="string")return;const t=typeof navigator<"u"?navigator.clipboard:void 0;t&&typeof t.writeText=="function"||H$(e)}function zpe(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}const z$="md-table-wide",W$="md-table-toggle",U$="md-table-fade",_x="md-table-toggle--show",Wpe="md-table-at-end",Upe="kimi-table-layout",j$='',jpe='';function e0(e){return e.querySelector(`button.${W$}`)}function V$(e){return e.querySelector(`.${U$}`)}const Vpe=26;function qpe(e){const t=e0(e);if(!t)return;const n=e.querySelector("thead tr")??e.querySelector("tr");if(!n)return;const o=n.getBoundingClientRect(),s=e.getBoundingClientRect().top,i=Math.max(2,Math.round(o.top-s+(o.height-Vpe)/2));t.style.top=`${i}px`,t.style.right=`${i}px`}function Kpe(e){return e.closest(".a-msg .msg")!==null}function Zpe(e){const t=e.querySelector("table");return t!==null&&t.scrollWidth>e.clientWidth+1}function q$(e){const t=`translateX(${e.scrollLeft}px)`,n=V$(e);n&&(n.style.transform=t);const o=e0(e);o&&(o.style.transform=t);const s=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(Wpe,s)}function Gpe(e,t){const n=e0(e);if(n)return n;if(!Kpe(e))return null;const o=document.createElement("div");o.className=U$,o.setAttribute("aria-hidden","true");const s=document.createElement("button");return s.type="button",s.className=W$,s.innerHTML=j$,s.setAttribute("aria-label",t.widen),s.title=t.widen,s.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),Ype(e,t)}),e.appendChild(o),e.appendChild(s),e.addEventListener("scroll",()=>q$(e),{passive:!0}),T5(e),s}function Ype(e,t){const n=e.classList.toggle(z$),o=e0(e);if(o){o.innerHTML=n?jpe:j$;const s=n?t.restore:t.widen;o.setAttribute("aria-label",s),o.title=s}T5(e),e.dispatchEvent(new CustomEvent(Upe,{bubbles:!0}))}function T5(e){const t=e0(e);if(!t)return;const n=Zpe(e),o=e.classList.contains(z$);t.classList.toggle(_x,n||o);const s=V$(e);s&&s.classList.toggle(_x,n),qpe(e),q$(e)}function Xpe(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function Jpe(e){return new Worker("/assets/mermaidParser.worker-BFSlSHEW.js",{type:"module",name:e?.name})}const Qpe={key:1,class:"diff-wrap"},e0e={class:"diff-bar"},t0e=["aria-label","onClick"],n0e={class:"diff-pre"},o0e={key:0,class:"diff-sign"},s0e={class:"diff-text"},i0e="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",xx="github-light",Sx="github-dark",r0e=et({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){qce(),ide(),Zce(),ade(),Kce(new Xpe),lde(new Jpe);const{t}=m1(),n=nn("resolveImage"),o=Z(null),s=e,i=R(()=>!s.streaming),r=R(()=>bpe(s.text??"")),l=R(()=>s.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:Bpe(s.text??"")),a=f2(),u=R(()=>!s.streaming),c=Go(new Map),d=new Set,f=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,h=/(]*?\bsrc=")([^"]+)(")/gi;function m(F){return!/^(https?:|data:|blob:)/i.test(F)}function v(F){if(!n)return;const U=[];for(const z of[f,h]){z.lastIndex=0;let W;for(;(W=z.exec(F))!==null;)U.push(W[2]??"")}for(const z of U)!z||!m(z)||c.has(z)||d.has(z)||(d.add(z),n(z).then(W=>{c.set(z,W!==z?W:"")}).catch(()=>{c.set(z,"")}).finally(()=>{d.delete(z)}))}function k(F){if(!n)return F;const U=z=>{if(!m(z))return null;const W=c.get(z);return W===void 0?i0e:W===""?null:W};return F.replace(f,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`}).replace(h,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`})}Je(()=>s.text,F=>v(F??""),{immediate:!0});function w(){if(!o.value||!s.openFile||s.streaming)return;const F=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),U=[];let z=F.nextNode();for(;z;){const W=z,K=W.parentElement;K&&!K.closest("a, pre, .md-file-link, svg")&&W.data.trim().length>0&&U.push(W),z=F.nextNode()}for(const W of U){const K=wpe(W.data,{aliases:r.value});if(K.length===0||!W.parentNode)continue;const V=document.createDocumentFragment();let ie=0;for(const ne of K){ne.start>ie&&V.append(document.createTextNode(W.data.slice(ie,ne.start)));const X=document.createElement("button");X.type="button",X.className="md-file-link",X.textContent=ne.text,X.title=ne.line?`${ne.path}:${ne.line}`:ne.path,X.addEventListener("click",le=>{le.preventDefault(),le.stopPropagation(),s.openFile?.({path:ne.path,line:ne.line})}),V.append(X),ie=ne.end}ie{W.preventDefault(),W.stopPropagation(),s.openFile?.({path:_(z)})}))}}function x(){return{widen:t("conversation.widenTable"),restore:t("conversation.restoreTableWidth")}}function S(){if(!o.value||s.streaming)return;const F=x();for(const U of o.value.querySelectorAll(".table-node-wrapper"))Gpe(U,F)}function T(){if(!(!o.value||s.streaming))for(const F of o.value.querySelectorAll(".table-node-wrapper"))T5(F)}function A(){yt().then(()=>{w(),g(),S()})}Je(()=>s.text,A),Je(()=>s.streaming,A);let E=null,P=null;dn(()=>{A(),o.value&&(E=new MutationObserver(A),E.observe(o.value,{childList:!0,subtree:!0}),P=new ResizeObserver(T),P.observe(o.value))}),bn(()=>{E?.disconnect(),P?.disconnect()});const D={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},I=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,$=R(()=>{const F=k(s.text??""),U=[];let z=0;I.lastIndex=0;let W;for(;(W=I.exec(F))!==null;){const V=W[1]??"",ie=F.slice(z,W.index)+(V||"");ie.trim()&&U.push({kind:"md",text:ie}),U.push({kind:"diff",code:W[2]??""}),z=I.lastIndex}const K=F.slice(z);return(K.trim()||U.length===0)&&U.push({kind:"md",text:K}),U});function B(F){return F.split(` -`).map(U=>U.startsWith("@@")?{type:"hunk",sign:"",text:U}:/^\+(?!\+\+)/.test(U)?{type:"add",sign:"+",text:U.slice(1)}:/^-(?!--)/.test(U)?{type:"del",sign:"-",text:U.slice(1)}:U.startsWith(" ")?{type:"ctx",sign:"",text:U.slice(1)}:{type:"ctx",sign:"",text:U})}const H=Z(null);function O(F,U){H$(F).then(z=>{z&&(H.value=U,setTimeout(()=>{H.value=null},1400))})}return(F,U)=>(y(),M("div",{ref_key:"mdRef",ref:o,class:"md"},[(y(!0),M(Pe,null,pt($.value,(z,W)=>(y(),M(Pe,{key:W},[z.kind==="md"?(y(),he(p(Vi),{key:0,content:z.text,"custom-markdown-it":p(Fpe),mode:"chat","code-renderer":l.value.codeRenderer,"is-dark":p(a),"code-block-light-theme":xx,"code-block-dark-theme":Sx,themes:[xx,Sx],"code-block-props":D,final:i.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1,onCopy:p(Hpe)},null,8,["content","custom-markdown-it","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering","onCopy"])):(y(),M("div",Qpe,[C("div",e0e,[U[0]||(U[0]=C("span",{class:"diff-lang"},"diff",-1)),j(p(pn),{text:p(t)("filePreview.copyCode")},{default:me(()=>[C("button",{class:"diff-copy","aria-label":p(t)("filePreview.copyCode"),onClick:K=>O(z.code,W)},[j(p(Te),{name:H.value===W?"check":"copy",size:"sm"},null,8,["name"])],8,t0e)]),_:2},1032,["text"])]),C("pre",n0e,[C("code",null,[(y(!0),M(Pe,null,pt(B(z.code),(K,V)=>(y(),M("span",{key:V,class:Re(["diff-line",`diff-${K.type}`])},[K.type!=="hunk"?(y(),M("span",o0e,N(K.sign),1)):ee("",!0),C("span",s0e,N(K.text),1)],2))),128))])])]))],64))),128))],512))}}),Ic=ft(r0e,[["__scopeId","data-v-2a3e373d"]]),l0e={state:"idle"};function a0e(e){const t=Z(l0e),n=Z(ui(cn.updateSkippedVersion)),o=Z(!1);if(typeof e?.getUpdateAutoDownload=="function"&&e.getUpdateAutoDownload().then(i=>{o.value=i}).catch(()=>{}),e!==void 0){let i=!1;e.onUpdateStatus(r=>{i=!0,t.value=r}),e.getUpdateStatus().then(r=>{i||(t.value=r)}).catch(()=>{})}const s=R(()=>{const i=t.value;return!(i.state==="idle"||i.state==="available"&&i.version!==void 0&&i.version===n.value)});return{status:t,visible:s,canCheck:typeof e?.checkForUpdates=="function",autoDownload:o,canToggleAutoDownload:typeof e?.getUpdateAutoDownload=="function"&&typeof e?.setUpdateAutoDownload=="function",setAutoDownload:i=>{o.value=i,e?.setUpdateAutoDownload?.(i).catch(()=>{})},skipVersion:()=>{const i=t.value.version;t.value.state==="available"&&i!==void 0&&(n.value=i,Ls(cn.updateSkippedVersion,i))},check:async()=>{if(typeof e?.checkForUpdates!="function")return Promise.resolve({outcome:"unsupported"});const i=await e.checkForUpdates().catch(()=>({outcome:"error",message:"bridge call failed"}));return i.outcome==="available"&&i.version!==void 0&&i.version===n.value&&(n.value=null,ur(cn.updateSkippedVersion)),i},download:()=>{e?.downloadUpdate().catch(()=>{})},install:()=>{e?.installUpdate().catch(()=>{})}}}let c4=null;function K$(){return c4===null&&(c4=a0e(window.kimiDesktop)),c4}const u0e=["data-state"],c0e=["aria-label"],d0e={class:"upd-pill-text"},f0e={key:0,class:"upd-meta"},p0e={key:1,class:"upd-notes"},h0e={class:"upd-notes-title"},m0e={key:2,class:"upd-progress"},g0e={key:3,class:"upd-message"},v0e={class:"upd-foot"},y0e={class:"upd-foot-actions"},k0e=et({__name:"UpdateIndicator",setup(e){const{t,locale:n}=Nt(),{status:o,visible:s,skipVersion:i,download:r,install:l,autoDownload:a,setAutoDownload:u,canToggleAutoDownload:c}=K$(),d=Z(!1),f="0.33.0".trim()?"0.33.0":"",h=R(()=>{switch(o.value.state){case"available":return t("sidebar.update");case"downloading":return`${o.value.percent??0}%`;case"downloaded":return t("sidebar.updateDone");case"error":return t("sidebar.updateFailed");default:return""}}),m=R(()=>{switch(o.value.state){case"available":return t("sidebar.updateAvailable",{version:o.value.version??""});case"downloading":return t("sidebar.updateDownloading",{percent:o.value.percent??0});case"downloaded":return t("sidebar.updateReady",{version:o.value.version??""});case"error":return t("sidebar.updateFailed");default:return""}}),v=R(()=>{const T=o.value.releaseDate;if(T===void 0||T==="")return"";const A=new Date(T),E=Number.isNaN(A.getTime())?T:A.toLocaleDateString();return t("sidebar.updateReleaseDate",{date:E})}),k=R(()=>{const T=[];return v.value!==""&&T.push(v.value),f!==""&&T.push(t("sidebar.updateCurrentVersion",{version:f})),T.join(" · ")}),w=R(()=>o.value.percent??0),b=R(()=>{const T=o.value.releaseNotes;return T===void 0?"":((n.value.toLowerCase().startsWith("zh")?T.zh:T.en)??T.zh??T.en??"").trim()}),_=R(()=>{switch(o.value.state){case"error":return"alert-triangle";default:return"download"}});function g(){r()}function x(){i(),d.value=!1}function S(){l(),d.value=!1}return(T,A)=>p(s)?(y(),M("span",{key:0,class:"upd","data-state":p(o).state},[C("button",{class:"upd-pill",type:"button","aria-label":h.value,onClick:A[0]||(A[0]=E=>d.value=!0)},[j(p(Te),{class:"upd-pill-icon",name:_.value,size:"sm"},null,8,["name"]),C("span",d0e,N(h.value),1)],8,c0e),j(p(ua),{open:d.value,title:m.value,size:"lg","onUpdate:open":A[4]||(A[4]=E=>d.value=E)},{foot:me(()=>[C("div",v0e,[C("div",y0e,[p(o).state==="available"?(y(),M(Pe,{key:0},[j(p(Rt),{variant:"ghost",onClick:x},{default:me(()=>[qe(N(p(t)("sidebar.updateSkip")),1)]),_:1}),j(p(Rt),{onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateDownloadNow")),1)]),_:1})],64)):p(o).state==="downloading"?(y(),he(p(Rt),{key:1,variant:"secondary",onClick:A[1]||(A[1]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateBackground")),1)]),_:1})):p(o).state==="downloaded"?(y(),M(Pe,{key:2},[j(p(Rt),{variant:"ghost",onClick:A[2]||(A[2]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartLater")),1)]),_:1}),j(p(Rt),{onClick:S},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartNow")),1)]),_:1})],64)):p(o).state==="error"?(y(),he(p(Rt),{key:3,variant:"danger-soft",onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateRetry")),1)]),_:1})):ee("",!0)]),p(c)?(y(),he(p(rW),{key:0,class:"upd-auto","model-value":p(a),"onUpdate:modelValue":A[3]||(A[3]=E=>p(u)(E))},{default:me(()=>[qe(N(p(t)("sidebar.updateAutoDownload")),1)]),_:1},8,["model-value"])):ee("",!0)])]),default:me(()=>[(p(o).state==="available"||p(o).state==="downloaded")&&k.value?(y(),M("p",f0e,N(k.value),1)):ee("",!0),b.value?(y(),M("section",p0e,[C("h4",h0e,N(p(t)("sidebar.updateWhatsNew")),1),j(p(Ic),{text:b.value},null,8,["text"])])):ee("",!0),p(o).state==="downloading"?(y(),M("div",m0e,[C("div",{class:"upd-progress-fill",style:Zt({width:`${w.value}%`})},null,4)])):ee("",!0),p(o).state==="error"&&p(o).message?(y(),M("p",g0e,N(p(o).message),1)):ee("",!0)]),_:1},8,["open","title"])],8,u0e)):ee("",!0)}}),b0e=ft(k0e,[["__scopeId","data-v-c0a4acce"]]),yg=[{code:"en",label:"English"},{code:"zh",label:"简体中文"}],Hn=Mz({locale:$M()});function E5(e){Hn.global.locale.value=e,Ls(cn.locale,e)}const C0e=["app:load:start","app:load:complete","export:start","export:accepted","export:failed","prompt:start","prompt:accepted","prompt:failed","session:snapshot:start","session:snapshot:accepted","session:snapshot:failed","operation:failed","window:error","window:unhandled-rejection","ws:connection","ws:error","ws:resync","ws:stale-reconnect"],Z$=500,kg=256*1024,Ax=200,d4=16384,f4=500,p4=50,h4=50,w0e=6,_0e=/api[_-]?key|authorization|token|secret|password|cookie|credential|email|phone|nickname|avatar/i,x0e=/^[A-Za-z0-9+/=_-]{200,}$/;let m4=null;function Qr(){if(m4!==null)return m4;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=ui(cn.debug)==="1"),m4=e,e}const Ka=[],Ed=[];let Mf=0;const Yu=[];let Tf=0,S0e=1;const bg=new TextEncoder,A0e=new Set(C0e),I5=Z(0),Ef=Xr(!1);function M0e(){return Ka}function T0e(){Ka.length=0,Ed.length=0,Mf=0,Yu.length=0,Tf=0,I5.value++}function ca(e){if(!Ef.value){try{const t={id:S0e++,ts:Date.now(),source:e.source,kind:String(Kd(e.kind)),label:String(Kd(e.label)),sessionId:e.sessionId===void 0?void 0:String(Kd(e.sessionId)),method:e.method,path:e.path,eventType:e.eventType,seq:e.seq,offset:e.offset,status:e.status,code:e.code,requestId:e.requestId,durationMs:e.durationMs,detail:pu(e.detail)},n=JSON.stringify(t),o=bg.encode(n).byteLength;if(o>kg)return;for(Ka.push(t),Ed.push(n),Mf+=o+(Ed.length>1?1:0);Ka.length>Z$||Mf>kg;){const s=Ed.shift();Ka.shift(),s!==void 0&&(Mf-=bg.encode(s).byteLength,Ed.length>0&&(Mf-=1))}}catch{return}I5.value++}}function Bu(e){if(typeof e=="string")return e.length<=Ax?e:e.slice(0,Ax)}function mr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function E0e(e,t){if(A0e.has(e))try{const n={ts:Date.now(),event:e,sessionId:Bu(t?.sessionId),status:Bu(t?.status),operation:Bu(t?.operation),seq:mr(t?.seq),durationMs:mr(t?.durationMs),messageCount:mr(t?.messageCount),contentCount:mr(t?.contentCount),mediaCount:mr(t?.mediaCount),sessionCount:mr(t?.sessionCount),workspaceCount:mr(t?.workspaceCount),promptId:Bu(t?.promptId),zipBytes:mr(t?.zipBytes),errorName:Bu(t?.errorName),errorCode:mr(t?.errorCode),requestId:Bu(t?.requestId),phase:Bu(t?.phase),httpStatus:mr(t?.httpStatus),fatal:typeof t?.fatal=="boolean"?t.fatal:void 0,line:mr(t?.line),col:mr(t?.col)},o=JSON.stringify(n),s=bg.encode(o).byteLength;if(s>kg)return;for(Yu.push(o),Tf+=s+(Yu.length>1?1:0);Yu.length>Z$||Tf>kg;){const i=Yu.shift();i!==void 0&&(Tf-=bg.encode(i).byteLength,Yu.length>0&&(Tf-=1))}}catch{return}}function Kd(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const i=e;return x0e.test(i)?`[base64-like, ${i.length} chars omitted]`:i.length>f4?`${i.slice(0,f4)}… [+${i.length-f4} chars]`:i}if(n!=="object")return String(e);if(t>=w0e)return"[max depth]";if(Array.isArray(e)){const i=e.slice(0,p4).map(r=>Kd(r,t+1));return e.length>p4&&i.push(`[+${e.length-p4} more items]`),i}const o={},s=Object.entries(e);for(const[i,r]of s.slice(0,h4))o[i]=_0e.test(i)?"[redacted]":Kd(r,t+1);return s.length>h4&&(o._truncatedKeys=s.length-h4),o}function pu(e){if(e===void 0)return;const t=Kd(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>d4)return{_truncated:`detail JSON was ${n.length} chars; first ${d4} kept`,preview:n.slice(0,d4)}}catch{return"[unserializable detail]"}return t}function I0e(e){Qr()&&ca({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:pu(e.body)}})}function L0e(e){if(!Qr())return;const t=e.code!==0;ca({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:pu(e.data)}})}function $0e(e){Qr()&&ca({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function N0e(e,t){Qr()&&ca({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:pu(t)})}function F0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=t.payload,s=typeof o?.session_id=="string"?o.session_id:void 0;ca({source:"ws",kind:"ws:out",eventType:n,sessionId:s,label:`→ ${n}`,detail:pu(e)})}function R0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,s=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[o,s!==void 0?`seq=${s}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);ca({source:"ws",kind:"ws:in",eventType:n,sessionId:o,seq:s,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:pu(t.payload)})}const O0e={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function P0e(e,t,n){Qr()&&ca({source:"client",kind:`client:${e}`,label:`${O0e[e]} ${t}`,detail:pu(n)})}function D0e(e,t){Qr()&&ca({source:"client",kind:"client:event",label:`· ${e}`,detail:pu(t)})}function bi(e,t){E0e(e,t),ca({source:"client",kind:"client:key",label:e,sessionId:typeof t?.sessionId=="string"?t.sessionId:void 0,seq:typeof t?.seq=="number"?t.seq:void 0,durationMs:typeof t?.durationMs=="number"?t.durationMs:void 0,detail:t})}let g4=!1,Eh=null;function B0e(){if(g4)return()=>Eh?.();g4=!0;const e=[];try{if(typeof window<"u"){const n=s=>{bi("window:error",{status:"failed",errorName:s.error instanceof Error?s.error.name:"Error",line:s.lineno,col:s.colno}),Xl(`[kimi-web] window error: ${s.message}`,s.error instanceof Error?s.error.stack:void 0)},o=s=>{const i=s.reason;bi("window:unhandled-rejection",{status:"failed",errorName:i instanceof Error?i.name:typeof i}),Xl(`[kimi-web] unhandled rejection: ${z0e(i)}`,i instanceof Error?i.stack:void 0)};window.addEventListener("error",n),window.addEventListener("unhandledrejection",o),e.push(()=>{window.removeEventListener("error",n)}),e.push(()=>{window.removeEventListener("unhandledrejection",o)})}}catch{}if(Qr())for(const n of["error","warn","log","info","debug"]){const o=console[n];if(typeof o!="function")continue;const s=(...i)=>{try{P0e(n,i.map(H0e).join(" "),i.length>1?i:i[0])}catch{}o.apply(console,i)};console[n]=s,e.push(()=>{console[n]===s&&(console[n]=o)})}const t=()=>{if(Eh===t){for(const n of e.toReversed())n();Eh=null,g4=!1}};return Eh=t,t}function H0e(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function z0e(e){if(e instanceof Error)return e.message;try{return String(e)}catch{return"[unstringifiable reason]"}}function G$(e=Ka){if(typeof document>"u")return;const t=new Blob([W0e(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t);let o;try{o=document.createElement("a"),o.href=n,o.download=`kimi-web-log-${new Date().toISOString().replaceAll(/[:.]/g,"-")}.jsonl`,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(n)}catch{}},0)}}function W0e(e=Ka){return e===Ka?Ed.join(` +`)&&!(function(W){const K=rx(W);if(lx(K))return!1;const V=I$(K);return V.length>=2&&V.some(ie=>ie.trim())})(U))})(r.value,B)?x():(function(){if(v+=1,h)return;const F=Math.max(0,(function(U){const z=U.parseCoalesceMs;return typeof z=="number"&&Number.isFinite(z)&&z>=0?z:80})(e)-(Rr()-k));F<=0?x():h=setTimeout(x,F)})())},{flush:"sync",immediate:!0}),d1(g);const S=R(()=>{var B,H,O,F;return cie(e.customHtmlTags,(B=e.parseOptions)==null?void 0:B.customHtmlTags,(F=(O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{},Object.entries(F).map(([U,z])=>{const W=Sr(U);return z==null||!W||Qp(W)||WI.has(W)||Zp.has(W)?"":W}).filter(Boolean)))}),T=R(()=>{const{key:B,tags:H}=die(S.value);if(!B)return o;const O=s.get(B);if(O)return O;const F=l_(t.instanceMsgId,{customHtmlTags:H});return s.set(B,F),F}),A=R(()=>{const B=T.value;if(!e.customMarkdownIt)return B;const H=e.customMarkdownIt(B);return B.__markstreamHasCustomParserExtensions=!0,H.__markstreamHasCustomParserExtensions=!0,H}),E=R(()=>{var B,H;const O=(B=e.parseOptions)!=null?B:{},F=t.effectiveFinal.value,U=S.value,z=F!=null,W=U.length>0;return z||W||O.streamParse==null?mt(mt(rn(mt({},O),{streamParse:(H=O.streamParse)==null||H}),z?{final:F}:{}),W?{customHtmlTags:U}:{}):O}),P=R(()=>{var B;return new Set(((B=E.value.customHtmlTags)!=null?B:[]).map(H=>String(H).trim().toLowerCase()).filter(Boolean))}),D=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!0})),I=R(()=>ix(E.value,A.value,e.customMarkdownIt,{includeFinal:!1}));Je([D,I],([B,H],[O,F])=>{O&&(B===O&&H===F||(x(),H!==F&&(l=[],c="")))},{flush:"sync"});const $=R(()=>{var B,H,O,F,U,z,W,K,V,ie,ne;if((B=e.nodes)!=null&&B.length)return l=[],c="",_(0),kt(e.nodes.slice());const X=r.value;if(!X)return l=[],c="",_(-1),[];const le=t.debugPerformanceEnabled.value,Ie=le?Rr():0,de=A.value,pe=D.value,ve=I.value;a&&pe!==a&&(function(Fe){var Oe,Ge;(Ge=(Oe=Fe.stream)==null?void 0:Oe.reset)==null||Ge.call(Oe)})(de),u&&ve!==u&&(l=[],c="");const oe=Object.keys((O=(H=t.customComponentsMap)==null?void 0:H.value)!=null?O:{}).length>0||typeof E.value.postTransformNodes=="function";oe!==d&&(l=[],c="");const ye=!oe&&l.length>0&&X.startsWith(c)&&ve===u,G=le?sx(de):null,Y=le?{}:void 0,fe=cx(de),we=!fe&&!oe,ge=mt(mt(rn(mt({},E.value),{__reuseStableTopLevelNodes:we}),fe?{__disableStreamParse:!0}:{}),Y?{__timing:Y}:{}),Q=UL(X,de,ge),te=le?Rr():0,ce=le?{signatureMs:0,stabilizeSignatureMs:0,primeSignatureMs:0,signatureCallCount:0,stabilizeSignatureCallCount:0,primeSignatureCallCount:0}:void 0;let ue,Se=le?_h(Q.length):void 0,ze=0,_e=0,Ee=0;if(ye){const Fe=le?Rr():0,[Oe,Ge]=(function(Tt){var Bt,Yt;const[Sn,on]=Tt.scanGlobalReferenceAppend(Tt.previousContent,Tt.content),en=Tt.parseOptions;return[Tt.previousDirtyStartIndex>0&&en.final!==!0&&!Tt.customMarkdownIt&&!cx(Tt.md)&&!Sn&&typeof en.preTransformTokens!="function"&&typeof en.postTransformTokens!="function"&&typeof en.postTransformNodes!="function"&&((Yt=(Bt=en.customHtmlTags)==null?void 0:Bt.length)!=null?Yt:0)===0?Tt.previousDirtyStartIndex:0,on]})({content:X,previousContent:c,previousDirtyStartIndex:w,parseOptions:E.value,customMarkdownIt:e.customMarkdownIt,md:de,scanGlobalReferenceAppend:f});Ee=Ge;const at=Oe<=0;if(ce){const Tt=(function(Bt,Yt,Sn,on={}){var en;if(!Yt.length)return{nodes:Bt,metrics:_h(Bt.length)};const Cn=(en=on.scanStartIndex)!=null?en:0,Mn=on.reuseDirtyTail!==!1,We=(function(Lt,gt,wn,yn=0){const go=Math.min(Lt.length,gt.length);for(let qt=Math.min(go,Math.max(0,yn));qtsu(Fe[at]))})(ue,ce,_e):(function(Fe,Oe=0){for(let Ge=Math.max(0,Oe);Ge((U=G?.total)!=null?U:0);t.logPerf(Oe?"parse(stream)":"parse(sync)",mt(mt(mt({rendererId:t.instanceMsgId,ms:Math.round(Rr()-Ie),nodes:ue.length,contentLength:X.length,parseCommitCount:m,parseCoalescedCount:v,nodeReuseMs:it,referenceDefinitionScanChars:Ee,signatureMs:(z=ce?.signatureMs)!=null?z:0,stabilizeSignatureMs:(W=ce?.stabilizeSignatureMs)!=null?W:0,primeSignatureMs:(K=ce?.primeSignatureMs)!=null?K:0,signatureCallCount:(V=ce?.signatureCallCount)!=null?V:0,stabilizeSignatureCallCount:(ie=ce?.stabilizeSignatureCallCount)!=null?ie:0,primeSignatureCallCount:(ne=ce?.primeSignatureCallCount)!=null?ne:0,stabilizeMs:ze},Se??{}),Y?Object.fromEntries(jfe.map(Ge=>{var at;return[Ge,(at=Y[Ge])!=null?at:0]})):{}),Fe?{streamMode:Fe.lastMode,streamDelta:Jfe(Fe,G),streamStats:Fe}:{}))}return kt(ue)});return{effectiveCustomHtmlTags:S,effectiveCustomHtmlTagsSet:P,mdBase:T,mdInstance:A,mergedParseOptions:E,getParsedNodesDirtyStartIndex:()=>w,getParsedNodesRevision:()=>b,parsedNodes:$}}function epe(e){const{isClient:t}=e,n=Z(new Set),o=new Map,s=new Map,i=new Map;function r(u){if(!t)return;const c=i.get(u);c!=null&&(window.clearTimeout(c),i.delete(u))}function l(){if(t)for(const u of i.values())window.clearTimeout(u);i.clear()}function a(){n.value=new Set}return{visibleNodeIndices:n,nodeVisibilityHandles:o,nodeVisibilityWatchStops:s,nodeVisibilityFallbackTimers:i,clearVisibilityFallback:r,clearAllVisibilityFallbacks:l,markNodeVisible:function(u,c=!0){var d;c&&r(u),(function(f,h){if((v=(m=e.shouldTrackVisibleNodeIndices)==null?void 0:m.call(e))!=null&&!v)return;var m,v;const k=n.value,w=k.has(f);if(h){if(w)return;const _=new Set(k);return _.add(f),void(n.value=_)}if(!w)return;const b=new Set(k);b.delete(f),n.value=b})(u,c),c&&((d=e.onNodeMarkedVisible)==null||d.call(e,u))},resetNodeVisibleState:a,cleanupNodeVisibility:function(u){var c;if(e.shouldCleanupNodeVisibility&&!e.shouldCleanupNodeVisibility())return;for(const[f,h]of s.entries())f{const c=s.getSnapshot();t.value=c.source,n.value=c.visible,o.value=c.done},r=s.subscribe(i);i();const l=R(()=>Math.max(0,t.value.length-n.value.length)),a=R(()=>l.value===0),u=R(()=>o.value&&a.value);return Kg()&&d1(()=>{r(),s.destroy()}),{source:t,visible:n,done:o,final:u,caughtUp:a,pendingChars:l,enqueue:c=>s.enqueue(c),finish:c=>s.finish(c),flush:()=>s.flush(),reset:c=>s.reset(c),pause:()=>s.pause(),resume:()=>s.resume()}}const npe={maxCharsPerSecond:3e3,maxCommitFps:20,maxCharsPerCommit:160,catchUpLatencyMs:220,catchUpThreshold:400},dx=/auto|scroll|overlay/i;function ope(e){if(!e)return!1;const t=(e.overflowY||"").toLowerCase(),n=(e.overflow||"").toLowerCase();return dx.test(t)||dx.test(n)}function spe(e){const t=Math.ceil(e.scrollHeight)>Math.ceil(e.clientHeight)+1,n=Math.ceil(e.scrollWidth)>Math.ceil(e.clientWidth)+1;return t||n}const ipe={class:"m-0 p-0"},rpe=["data-probe"],lpe=Gn(et(rn(mt({},{name:"HeightEstimationProbes"}),{__name:"HeightEstimationProbes",props:{width:{},flowRoot:{type:Boolean},paragraphNode:{},listItemNode:{},listNode:{},headingNodes:{},setParagraphWrapper:{type:Function},setListItemWrapper:{type:Function},setListWrapper:{type:Function},setHeadingWrapper:{type:Function}},setup(e){const t=e;function n(o){var s,i;return(i=(s=t.headingNodes)==null?void 0:s[o])!=null?i:null}return(o,s)=>(y(),M("div",{class:"height-estimation-probes",style:Zt({width:`${e.width}px`}),"aria-hidden":"true"},[C("div",{ref:i=>e.setParagraphWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"paragraph"},[j(p(cc),{node:e.paragraphNode,"index-key":"probe-paragraph"},null,8,["node"])],2),C("div",{ref:i=>e.setListItemWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list-item"},[C("ul",ipe,[j(p(Vd),{node:e.listItemNode,"index-key":"probe-list-item"},null,8,["node"])])],2),C("div",{ref:i=>e.setListWrapper(i),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":"list"},[j(p(qd),{node:e.listNode,"index-key":"probe-list"},null,8,["node"])],2),(y(),M(Pe,null,pt(6,i=>C("div",{key:`probe-heading-${i}`,ref_for:!0,ref:r=>e.setHeadingWrapper(i,r),class:Re(["node-content",{"node-content-flow-root":e.flowRoot}]),"data-probe":`heading-${i}`},[j(p(L2),{node:n(i),"index-key":`probe-heading-${i}`},null,8,["node","index-key"])],10,rpe)),64))],4))}})),[["__scopeId","data-v-3e0766e2"]]),fx=et({name:"InfographicBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return ag((o=Md(e.estimatedPreviewHeightPx))!=null?o:rg(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"infographic-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",background:"var(--diagram-bg)",borderColor:"var(--diagram-border)",color:"hsl(var(--ms-foreground))"},"data-markstream-infographic":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"infographic-block-header flex justify-between items-center border-b",style:{padding:"var(--ms-inset-panel-y) var(--ms-inset-panel-x)",background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)",minHeight:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding) + var(--ms-inset-panel-y) + var(--ms-inset-panel-y) + 1px)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"icon-slot action-icon shrink-0",style:{display:"inline-flex",width:"var(--ms-action-btn-icon)",height:"var(--ms-action-btn-icon)"}}),tn("span",{class:"infographic-label font-medium font-mono truncate",style:{fontSize:"var(--ms-text-label)",color:"hsl(var(--ms-muted-foreground))"}},"Infographic")]),tn("div",{class:"infographic-header-actions flex items-center opacity-0 pointer-events-none",style:{gap:"var(--ms-gap-header-actions)"},"aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",style:{width:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))",height:"calc(var(--ms-action-btn-icon) + var(--ms-action-btn-padding) + var(--ms-action-btn-padding))"}})))]):null,tn("div",{class:"infographic-preview relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",zIndex:"1",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"absolute inset-0"},[tn("div",{class:"w-full text-center flex items-center justify-center min-h-full"})])])])}}}),px=et({name:"MermaidBlockNodeLoading",props:{node:{type:Object,required:!0},showHeader:{type:Boolean,default:!0},estimatedPreviewHeightPx:{type:Number,default:void 0}},setup(e){const t=R(()=>{var n,o;return lg((o=Md(e.estimatedPreviewHeightPx))!=null?o:ig(String((n=e.node.code)!=null?n:"")))});return()=>{var n;return tn("div",{class:"mermaid-block-container rounded-lg border overflow-hidden",style:{margin:"var(--ms-flow-diagram-y) 0",borderColor:"var(--diagram-border)"},"data-markstream-mermaid":"1","data-markstream-mode":"pending"},[e.showHeader?tn("div",{class:"mermaid-block-header flex justify-between items-center border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]",style:{background:"var(--diagram-header-bg)",borderColor:"var(--diagram-border)"}},[tn("div",{class:"flex items-center gap-x-2 overflow-hidden"},[tn("span",{class:"mermaid-label-text text-[length:var(--ms-text-label)] font-medium font-mono truncate",style:{color:"var(--code-action-fg)"}},"Mermaid")]),tn("div",{class:"mermaid-header-actions flex items-center gap-[var(--ms-gap-header-actions)] opacity-0 pointer-events-none","aria-hidden":"true"},Array.from({length:4},()=>tn("span",{class:"mermaid-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded"},[tn("span",{class:"action-icon block"})])))]):null,tn("div",{class:"mermaid-preview-area relative overflow-hidden block",style:{height:`${t.value}px`,minHeight:"var(--ms-size-diagram-min-height)",background:"var(--diagram-bg)"}},[tn("pre",{class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap",style:{position:"absolute",inset:"0",margin:"0",padding:"var(--ms-inset-panel-body)",overflow:"auto",textAlign:"left"}},String((n=e.node.code)!=null?n:"")),tn("div",{class:"_mermaid w-full text-center flex items-center justify-center min-h-full",style:{fontFamily:"inherit",contentVisibility:"auto",contain:"content",containIntrinsicSize:"var(--ms-size-diagram-min-height) 240px"}})])])}}}),ape={docs:{showTooltips:!0,fade:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:220,liveNodeBuffer:60,nodeVirtual:"auto"},chat:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"},minimal:{showTooltips:!1,fade:!1,batchRendering:!0,initialRenderBatchSize:32,renderBatchSize:48,renderBatchDelay:6,renderBatchBudgetMs:8,renderBatchIdleTimeoutMs:60,deferNodesUntilVisible:!0,maxLiveNodes:0,liveNodeBuffer:0,nodeVirtual:"auto"}};function As(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}const upe=["data-custom-id"],cpe=["data-node-index","data-node-type"],hx="typewriter-simple-cursor-target",R$=Gn(et(rn(mt({},{name:"NodeRenderer"}),{__name:"NodeRenderer",props:{content:{},nodes:{},final:{type:Boolean},parseOptions:{},customMarkdownIt:{},debugPerformance:{type:Boolean,default:!1},customHtmlTags:{},mode:{},domMode:{},htmlPolicy:{},viewportPriority:{type:Boolean,default:void 0},viewportPriorityOptions:{},codeBlockStream:{type:Boolean,default:!0},codeBlockDarkTheme:{},codeBlockLightTheme:{},codeBlockMonacoOptions:{},codeRenderer:{},renderCodeBlocksAsPre:{type:Boolean,default:void 0},codeBlockMinWidth:{},codeBlockMaxWidth:{},codeBlockProps:{},mermaidProps:{},d2Props:{},infographicProps:{},showTooltips:{type:Boolean,default:void 0},themes:{},langs:{},isDark:{type:Boolean},customId:{},indexKey:{},typewriter:{type:[Boolean,String],default:!1},smoothStreaming:{type:[Boolean,String],default:"auto"},smoothStreamingOptions:{},parseCoalesceMs:{},fade:{type:Boolean,default:void 0},batchRendering:{type:Boolean,default:void 0},initialRenderBatchSize:{},renderBatchSize:{},renderBatchDelay:{},renderBatchBudgetMs:{},renderBatchIdleTimeoutMs:{},deferNodesUntilVisible:{type:Boolean,default:void 0},maxLiveNodes:{},liveNodeBuffer:{},nodeVirtual:{type:[Boolean,String],default:void 0},virtualScroll:{},renderAsFragment:{type:Boolean}},emits:["copy","copy-code","handleArtifactClick","click","mouseover","mouseout","virtual-state-change","height-change","render-settled","render-final","anchor-change"],setup(e,{expose:t,emit:n}){const o=e,s=n;function i(L){if(!(typeof Event<"u"&&L instanceof Event))return typeof L=="string"&&s("copy-code",L),void s("copy",L)}const r=ds(),l=nn("markstreamNestedRendererProps",void 0);function a(L){const q=r?.vnode.props;return!!q&&(Object.prototype.hasOwnProperty.call(q,L)||Object.prototype.hasOwnProperty.call(q,String(L).replace(/[A-Z]/g,re=>`-${re.toLowerCase()}`)))}function u(L){var q,re;const ae=o[L];return a(L)?ae:(re=(q=l?.value)==null?void 0:q[L])!=null?re:ae}const c=R(()=>{return(L=u("mode"))==="chat"||L==="minimal"||L==="docs"?L:"docs";var L}),d=R(()=>ex(u("typewriter"))),f=R(()=>d.value!=="off"),h=R(()=>u("domMode")==="minimal"?"minimal":"full"),m=R(()=>{return(L={mode:c.value,codeRenderer:u("codeRenderer"),renderCodeBlocksAsPre:u("renderCodeBlocksAsPre")}).renderCodeBlocksAsPre===!0?"pre":L.codeRenderer==="pre"||L.codeRenderer==="shiki"||L.codeRenderer==="monaco"?L.codeRenderer:L.renderCodeBlocksAsPre===!1||L.mode==="docs"?"monaco":"pre";var L}),v=R(()=>ape[c.value]),k=R(()=>{var L;return(L=u("showTooltips"))!=null?L:v.value.showTooltips}),w=R(()=>{var L;return(L=u("fade"))!=null?L:v.value.fade}),b=R(()=>{var L;return(L=u("batchRendering"))!=null?L:v.value.batchRendering}),_=R(()=>{var L;return(L=u("initialRenderBatchSize"))!=null?L:v.value.initialRenderBatchSize}),g=R(()=>{var L;return(L=u("renderBatchSize"))!=null?L:v.value.renderBatchSize}),x=R(()=>{var L;return(L=u("renderBatchDelay"))!=null?L:v.value.renderBatchDelay}),S=R(()=>{var L;return(L=u("renderBatchBudgetMs"))!=null?L:v.value.renderBatchBudgetMs}),T=R(()=>{var L;return(L=u("renderBatchIdleTimeoutMs"))!=null?L:v.value.renderBatchIdleTimeoutMs}),A=R(()=>{var L;return(L=u("deferNodesUntilVisible"))!=null?L:v.value.deferNodesUntilVisible}),E=R(()=>{var L;return(L=u("maxLiveNodes"))!=null?L:v.value.maxLiveNodes}),P=R(()=>{var L;return(L=u("liveNodeBuffer"))!=null?L:v.value.liveNodeBuffer}),D=R(()=>{var L;return(L=u("nodeVirtual"))!=null?L:v.value.nodeVirtual}),I={get content(){return o.content},get nodes(){return o.nodes},get final(){return o.final},get parseOptions(){return u("parseOptions")},get customMarkdownIt(){return u("customMarkdownIt")},get debugPerformance(){return o.debugPerformance},get customHtmlTags(){return u("customHtmlTags")},get mode(){return u("mode")},get domMode(){return h.value},get htmlPolicy(){return u("htmlPolicy")},get viewportPriority(){return u("viewportPriority")},get viewportPriorityOptions(){return u("viewportPriorityOptions")},get codeBlockStream(){return u("codeBlockStream")},get codeBlockDarkTheme(){return u("codeBlockDarkTheme")},get codeBlockLightTheme(){return u("codeBlockLightTheme")},get codeBlockMonacoOptions(){return u("codeBlockMonacoOptions")},get codeRenderer(){return u("codeRenderer")},get renderCodeBlocksAsPre(){return u("renderCodeBlocksAsPre")},get codeBlockMinWidth(){return u("codeBlockMinWidth")},get codeBlockMaxWidth(){return u("codeBlockMaxWidth")},get codeBlockProps(){return u("codeBlockProps")},get mermaidProps(){return u("mermaidProps")},get d2Props(){return u("d2Props")},get infographicProps(){return u("infographicProps")},get showTooltips(){return k.value},get themes(){return u("themes")},get langs(){return u("langs")},get isDark(){return u("isDark")},get customId(){return u("customId")},get indexKey(){return o.indexKey},get typewriter(){return u("typewriter")},get smoothStreaming(){return o.smoothStreaming},get smoothStreamingOptions(){return u("smoothStreamingOptions")},get parseCoalesceMs(){return u("parseCoalesceMs")},get fade(){return w.value},get batchRendering(){return b.value},get initialRenderBatchSize(){return _.value},get renderBatchSize(){return g.value},get renderBatchDelay(){return x.value},get renderBatchBudgetMs(){return S.value},get renderBatchIdleTimeoutMs(){return T.value},get deferNodesUntilVisible(){return A.value},get maxLiveNodes(){return E.value},get liveNodeBuffer(){return P.value},get nodeVirtual(){return D.value},get virtualScroll(){return o.virtualScroll},get renderAsFragment(){return o.renderAsFragment}};function $(L){s("height-change",L)}function B(L){s("virtual-state-change",L)}function H(L){s("anchor-change",L)}const O=Z(),F=Z(null),U=Z(null),z=Z(null),W=Go({1:null,2:null,3:null,4:null,5:null,6:null}),K=Z(!1),V=new Map,ie=Z(0),ne=Z(0),X=Z({paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}});function le(L,q){return typeof L!="string"?q:L.trim()||q}function Ie(L){const q=Number(L);return Number.isFinite(q)&&q>0?Math.max(1,Math.trunc(q)):640}const de=R(()=>{var L;const q=(L=I.viewportPriorityOptions)!=null?L:{},re=le(q.rootMargin,yc);return{rootMargin:re,heavyBlockMargin:le(q.heavyBlockMargin,re),maxTargets:Ie(q.maxTargets)}}),pe=R(()=>{var L;return(L=de.value.rootMargin)!=null?L:yc}),ve=R(()=>{var L;return(L=de.value.maxTargets)!=null?L:640});function oe(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.enabled)!==!0)return null;const re=(q=o.virtualScroll)==null?void 0:q.scrollRoot;return ye(typeof re=="function"?re():re)}function ye(L){return L?typeof HTMLElement<"u"&&L instanceof HTMLElement?L:typeof L=="object"&&"value"in L?ye(L.value):typeof L=="object"&&"$el"in L?ye(L.$el):null:null}Ln(y$,de);const{isClient:G,renderAsFragment:Y,debugPerformanceEnabled:fe,resolvedShowTooltips:we,resolvedHtmlPolicy:ge,inheritedSmoothStreaming:Q,ownsTypewriterCursor:te}=(function(L){const q=typeof window<"u",re=p1(),ae=nn("markstreamHtmlPolicy",void 0),be=nn("markstreamTypewriterCursor",void 0),Ne=nn("markstreamSmoothStreaming",void 0),De=R(()=>L.renderAsFragment===!0),je=R(()=>!!(L.debugPerformance&&q&&typeof console<"u")),ot=R(()=>{var nt;if(typeof L.showTooltips=="boolean")return L.showTooltips;const Be=(nt=re.showTooltips)!=null?nt:re["show-tooltips"];return Be===""||Be===!0||Be==="true"||Be!==!1&&Be!=="false"&&void 0}),Ve=R(()=>{var nt,Be;return(Be=(nt=L.htmlPolicy)!=null?nt:ae?.value)!=null?Be:"safe"}),Ye=R(()=>be?.value!==!0);return{isClient:q,renderAsFragment:De,debugPerformanceEnabled:je,resolvedShowTooltips:ot,resolvedHtmlPolicy:Ve,inheritedSmoothStreaming:Ne,inheritedTypewriterCursor:be,ownsTypewriterCursor:Ye}})(I),{resolveViewportRoot:ce,resolveScrollContainer:ue,isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e}=(function(L,q){function re(){var je,ot;return(ot=(je=q.scrollRoot)==null?void 0:je.call(q))!=null?ot:null}function ae(je){if(typeof window>"u")return null;const ot=re();if(ot)return ot;const Ve=je??L.value;if(!Ve)return null;const Ye=Ve.ownerDocument||document,nt=Ye.scrollingElement||Ye.documentElement;let Be=Ve;for(;Be&&Be!==Ye.body&&Be!==nt;){if(ope(window.getComputedStyle(Be))&&spe(Be))return Be;Be=Be.parentElement}return null}function be(je){if(!q.isClient)return!1;try{const ot=window.getComputedStyle(je);return!!(ot.display||"").toLowerCase().includes("flex")&&(ot.flexDirection||"").toLowerCase().endsWith("reverse")}catch{return!1}}function Ne(je,ot,Ve){var Ye,nt;if(Ve)return De(ot);const Be=je.scrollTop;if(!be(je))return Be;const Xe=Be<0?-Be:Be;return Math.max(0,((Ye=je.scrollHeight)!=null?Ye:0)-((nt=je.clientHeight)!=null?nt:0))-Xe}function De(je){var ot,Ve,Ye,nt,Be;const Xe=Number((ot=je.scrollingElement)==null?void 0:ot.scrollTop),lt=Number((Ye=(Ve=je.documentElement)==null?void 0:Ve.scrollTop)!=null?Ye:0),rt=Number((Be=(nt=je.body)==null?void 0:nt.scrollTop)!=null?Be:0);return Math.max(0,Number.isFinite(Xe)?Xe:0,Number.isFinite(lt)?lt:0,Number.isFinite(rt)?rt:0)}return{resolveViewportRoot:ae,resolveScrollContainer:function(je){var ot,Ve,Ye,nt;const Be=re();if(Be)return Be;const Xe=ae((ot=je??L.value)!=null?ot:null);if(Xe)return Xe;const lt=(nt=(Ye=je?.ownerDocument)!=null?Ye:(Ve=L.value)==null?void 0:Ve.ownerDocument)!=null?nt:typeof document<"u"?document:null;return lt?.scrollingElement||lt?.documentElement||null},isReverseFlexScrollRoot:be,getNormalizedScrollTop:Ne,getOffsetTopWithinRoot:function(je,ot){const Ve=ot.ownerDocument||je.ownerDocument||document;if((function(Xe,lt){return Xe===lt.documentElement||Xe===lt.body||Xe===lt.scrollingElement})(ot,Ve))return je.getBoundingClientRect().top+De(Ve);const Ye=ot.getBoundingClientRect(),nt=je.getBoundingClientRect(),Be=Ne(ot,Ve,!1);return nt.top-Ye.top+Be}}})(O,{isClient:G,scrollRoot:oe});Ln("markstreamShowTooltips",we),Ln("markstreamHtmlPolicy",ge),Ln("markstreamTypewriter",f),Ln("markstreamFade",R(()=>I.fade!==!1)),Ln("markstreamTypewriterCursor",R(()=>!0)),Ln("markstreamTextStreamState",V),Ln("markstreamStreamVersion",ie),Ln("markstreamParseOptions",R(()=>I.parseOptions)),Ln("markstreamCustomMarkdownIt",R(()=>I.customMarkdownIt));const{smoothStreamingEnabled:Ee,renderContent:it,requestedFinal:Fe,effectiveFinal:Oe}=(function(L,q){const re=tpe(mt(mt({},npe),L.smoothStreamingOptions)),ae=R(()=>{var Be,Xe,lt;return L.smoothStreaming!==!1&&!((Be=L.nodes)!=null&&Be.length)&&(L.smoothStreaming===!0||!((Xe=q.inheritedSmoothStreaming)!=null&&Xe.value))&&(L.smoothStreaming===!0||ex(L.typewriter)!=="off"||((lt=L.maxLiveNodes)!=null?lt:0)<=0)}),be=Z(!q.isClient||L.smoothStreaming===!0);dn(()=>{be.value=!0});const Ne=R(()=>be.value&&ae.value),De=R(()=>{var Be;return Ne.value?re.visible.value:(Be=L.content)!=null?Be:""}),je=R(()=>{var Be,Xe;const lt=(Be=L.parseOptions)!=null?Be:{};return(Xe=L.final)!=null?Xe:lt.final}),ot=R(()=>{const Be=je.value;return Ne.value&&Be!=null?!!Be&&re.caughtUp.value:Be});let Ve=0,Ye=!1;function nt(){Ve=0,Ye=!1}return Je([()=>L.content,()=>L.nodes,Ne,je],([Be,Xe,lt,rt])=>{if(Xe?.length)return nt(),void re.reset("");const wt=Be??"";if(!lt)return nt(),re.reset(wt),void(rt&&re.finish({flush:!0}));const dt=re.source.value;if(wt){if(wt!==dt)if(wt.startsWith(dt)){const Ft=wt.slice(dt.length),Ht=re.pendingChars.value;Ft.length<=8?(Ve++,Ye||Ve>=2&&Ht<=8?(Ye=!0,re.reset(wt)):re.enqueue(Ft)):(nt(),re.enqueue(Ft))}else nt(),re.reset(wt)}else nt(),re.reset("");rt&&re.finish()},{immediate:!0}),{smoothStream:re,smoothStreamingEligible:ae,smoothStreamingEnabled:Ne,renderContent:De,requestedFinal:je,effectiveFinal:ot}})(I,{isClient:G,inheritedSmoothStreaming:Q}),Ge=Fe.value===!0;Ln("markstreamSmoothStreaming",Ee);const at=Z(!1),Tt=Z(!1),Bt=Z(!1);let Yt="",Sn=!1,on=null;function en(){G&&on!=null&&(window.clearTimeout(on),on=null)}function Cn(){at.value=!1,en()}function Mn(L,q){if(!fe.value)return;const re=(function(){if(!fe.value)return null;const ae=gt(We),be=gt(tt),Ne=Math.max(Lt,be);if(ae<=0&&Ne<=0)return null;const De={total:ae,maxPerFrame:Ne,byLabel:(je=We,Object.fromEntries(Array.from(je.entries()).sort((ot,Ve)=>Ve[1]-ot[1]||ot[0].localeCompare(Ve[0]))))};var je;return We.clear(),tt.clear(),Lt=0,De})();console.info(`[markstream-vue][perf] ${L}`,re?rn(mt({},q),{layoutReads:re}):q)}Je([()=>I.indexKey,()=>I.customId],()=>{var L,q;Cn(),Tt.value=!1,Bt.value=!((L=o.nodes)!=null&&L.length)&&Fe.value!==!0&&!!o.content,Yt=(q=it.value)!=null?q:"",Sn=Yt.length>0},{flush:"sync"}),Je([()=>o.content,()=>o.nodes,Fe],([L,q,re])=>{!q?.length&&re!==!0&&L&&(Bt.value=!0)},{flush:"sync",immediate:!0}),Je([it,()=>o.nodes,Fe],([L,q,re])=>{const ae=L??"";return q?.length||re===!0?(Cn(),Tt.value=!1,Yt=ae,void(Sn=!0)):(ae.length>0&&(Bt.value=!0),Sn?(Yt&&ae.length>Yt.length&&ae.startsWith(Yt)?(at.value=!0,Tt.value=!0,G&&(en(),on=window.setTimeout(()=>{var be;on=null,Oe.value===!0||(be=o.nodes)!=null&&be.length||(qc(),at.value=!1,Ol())},1200))):(ae.length"u")return null;const Ne=window;if(Ne.__markstreamLayoutReadPerformance)return Ne.__markstreamLayoutReadPerformance;const De={total:0,maxPerFrame:0,byLabel:{}};return Ne.__markstreamLayoutReadPerformance=De,De})();be&&(be.total=Number(be.total||0)+1,be.byLabel[ae]=Number(be.byLabel[ae]||0)+1,be.currentFrameTotal=Number(be.currentFrameTotal||0)+1,be.frameScheduled||(be.frameScheduled=!0,typeof window.requestAnimationFrame!="function"?typeof queueMicrotask!="function"?setTimeout(()=>yn(be),0):queueMicrotask(()=>yn(be)):window.requestAnimationFrame(()=>yn(be))))})(L),Ue||(Ue=!0,G&&typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(wn):typeof queueMicrotask!="function"?setTimeout(wn,0):queueMicrotask(wn)))}function qt(L,q){return go(L),q()}const ps=I.customId?`renderer-${I.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,xs=(function(L){const q=new Map;return{scope:L,cache:q,clear:()=>q.clear()}})(ps),_n=ps;Ln(A$,xs);const In=fs(()=>I.customId),{effectiveCustomHtmlTagsSet:To,mergedParseOptions:lo,parsedNodes:St,getParsedNodesDirtyStartIndex:hs,getParsedNodesRevision:Jo}=Qfe(I,{instanceMsgId:ps,renderContent:it,effectiveFinal:Oe,smoothStreamingEnabled:Ee,debugPerformanceEnabled:fe,customComponentsMap:In,logPerf:Mn});Je(St,()=>{at.value||xs.clear(),ie.value+=1},{immediate:!0});const uo=R(()=>({customId:I.customId,customHtmlTags:lo.value.customHtmlTags,parseOptions:I.parseOptions,customMarkdownIt:I.customMarkdownIt,htmlPolicy:ge.value,viewportPriority:I.viewportPriority,viewportPriorityOptions:de.value,mode:c.value,domMode:I.domMode,codeRenderer:m.value,codeBlockStream:I.codeBlockStream,codeBlockDarkTheme:I.codeBlockDarkTheme,codeBlockLightTheme:I.codeBlockLightTheme,codeBlockMonacoOptions:I.codeBlockMonacoOptions,renderCodeBlocksAsPre:I.renderCodeBlocksAsPre,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockProps:I.codeBlockProps,mermaidProps:I.mermaidProps,d2Props:I.d2Props,infographicProps:I.infographicProps,showTooltips:we.value,themes:I.themes,langs:I.langs,isDark:I.isDark,typewriter:f.value,smoothStreamingOptions:I.smoothStreamingOptions,parseCoalesceMs:I.parseCoalesceMs,fade:I.fade}));Ln("markstreamNestedRendererProps",uo);const Ys=R(()=>St.value),Nn=R(()=>St.value.length),no=Z(null),$s=Z(null),Xs=Z(null),ci=Z(null),Oo=o.indexKey!=null&&String(o.indexKey).startsWith("list-item-"),vo=!Oo&&I.customId?G_(I.customId):null,Po=R(()=>vo?(o4.value,G_(I.customId)):null),co=R(()=>{var L;return!!(!Y.value&&I.customId&&!Oo&&((L=Po.value)!=null&&L.enabled))}),Tn=R(()=>!!(G&&co.value)),fo=R(()=>{var L;return!!(!Y.value&&((L=o.virtualScroll)!=null&&L.enabled))}),Qe=R(()=>fo.value),st=Z(!1);dn(()=>{st.value=!0});const Ct=R(()=>!!(G&&fo.value));Ln("markstreamHostScrollManaged",Ct);const Qt=R(()=>!!(st.value&&Ct.value)),kn=R(()=>Tn.value||Ct.value),Ko=R(()=>Tn.value||Qt.value),Eo=R(()=>{var L;return kn.value&&((L=Po.value)==null?void 0:L.textEstimation)!==!1});function bo(){const L=ne.value||qt("getMeasuredContainerWidth.clientWidth",()=>{var q;return((q=O.value)==null?void 0:q.clientWidth)||0});return Number.isFinite(L)&&L>0?L:0}const Ns=R(()=>{const L=bo();return L>0?Math.max(1,Math.round(L)):640}),Do=R(()=>{var L,q;return!(Oe.value!==!0||fo.value||c.value!=="chat"&&c.value!=="minimal"||a("maxLiveNodes")||a("liveNodeBuffer")||(L=o.nodes)!=null&&L.length||Bt.value||!(((q=I.maxLiveNodes)!=null?q:0)<=0))}),Io=R(()=>{var L;return Do.value?50:Math.max(1,(L=I.maxLiveNodes)!=null?L:320)}),Qo=R(()=>{var L;return Do.value?16:Math.max(0,(L=I.liveNodeBuffer)!=null?L:60)}),sn=R(()=>{var L;return!Y.value&&I.nodeVirtual!==!1&&!(((L=I.maxLiveNodes)!=null?L:0)<=0&&!Do.value)&&(I.nodeVirtual===!0?St.value.length>0:St.value.length>Io.value)}),es=R(()=>sn.value||Tn.value||Ct.value),ms=R(()=>I.viewportPriority!==!1),Tr=R(()=>!!ms.value&&!K.value);var ts;ts=R(()=>ms.value),Ln(k$,ts);const Ki=R(()=>{var L;return!(Y.value||I.deferNodesUntilVisible===!1||((L=I.maxLiveNodes)!=null?L:0)<=0||sn.value||St.value.length>900||I.viewportPriority===!1)}),Js=Nde(L=>{var q;return ce((q=L??O.value)!=null?q:null)},ms),{requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,isTestEnv:Zi}=(function(L){const q=L.isClient&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):null,re=L.isClient&&typeof window.cancelAnimationFrame=="function"?window.cancelAnimationFrame.bind(window):null,ae=L.isClient&&typeof window.requestIdleCallback=="function",be=(function(){var Ne;if(typeof globalThis>"u"||!("process"in globalThis))return;const De=(Ne=Object.getOwnPropertyDescriptor(globalThis,"process"))==null?void 0:Ne.value;return De?.env})();return{requestFrame:q,cancelFrame:re,hasIdleCallback:ae,isTestEnv:be?.NODE_ENV==="test"}})({isClient:G}),tl=R(()=>Oe.value===!0&&!fo.value),{resolvedBatchSize:Ho,resolvedInitialBatch:Co,batchingEnabled:Fs,incrementalRenderingActive:Rs,renderedCount:yo,previousRenderContext:ht,adaptiveBatchSize:Le,previousBatchConfig:Ze}=(function(L,q){var re;const ae=R(()=>{var nt;const Be=Math.trunc((nt=L.renderBatchSize)!=null?nt:80);return Number.isFinite(Be)?Math.max(0,Be):0}),be=R(()=>{var nt;const Be=Math.trunc((nt=L.initialRenderBatchSize)!=null?nt:ae.value);return Number.isFinite(Be)?Math.max(0,Be):ae.value}),Ne=R(()=>!q.renderAsFragment.value&&L.batchRendering!==!1&&ae.value>0&&q.isClient&&!q.isTestEnv),De=Z(0),je=Z({key:L.indexKey,total:0}),ot=Z(Math.max(1,ae.value||1)),Ve=R(()=>{var nt,Be,Xe;return Ne.value&&!((nt=q.continuousStreaming)!=null&&nt.value)&&!((Be=q.forceFullRenderFinalContent)!=null&&Be.value)&&((Xe=L.maxLiveNodes)!=null?Xe:0)<=0}),Ye=Z({batchSize:ae.value,initial:be.value,delay:(re=L.renderBatchDelay)!=null?re:16,enabled:Ve.value});return{resolvedBatchSize:ae,resolvedInitialBatch:be,batchingEnabled:Ne,incrementalRenderingActive:Ve,renderedCount:De,previousRenderContext:je,adaptiveBatchSize:ot,previousBatchConfig:Ye}})(I,{isClient:G,isTestEnv:Zi,renderAsFragment:Y,forceFullRenderFinalContent:tl,continuousStreaming:R(()=>Tt.value&&Oe.value!==!0)}),Xt=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&!Zi&&((L=I.maxLiveNodes)!=null?L:0)<=0&&!tl.value}),gs=R(()=>Xt.value),di=R(()=>kn.value||gs.value),Ei=R(()=>{var L;return di.value&&((L=Po.value)==null?void 0:L.codeBlockEstimation)!==!1}),ao=new Map,Gi=new Map,Er=new WeakMap;let fi=null;const Ll=new WeakMap,zo=new Map,Ir=[];let Qs=[],pi=[],se=-1;const xe=Xr(Ir),J=new Set,Ce=Z(0);let $e=0;const He=Z(0),vt=R(()=>(He.value,Array.from(ao.entries()).sort((L,q)=>L[0]-q[0]))),ut=Z(null),Dt=Z(null);let Et,ln=null,oo=0,Ot=null;function Pt(){Et.markFallbackHeightPrefixDirty()}function Yn(L){return Et.getFallbackNodeHeight(L)}function ko(L,q){return Et.estimateHeightRange(L,q)}function vs(L){return Et.estimateIndexForOffset(L)}const{activeRestoreAnchor:Os,getRelativeScrollTopWithinContainer:ei,setRelativeScrollTopWithinContainer:Lc,resolveAnchorOffset:U2,clearRestoreReconcile:$c,scheduleRestoreReconcile:yu,captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2}=(function(L){const{isClient:q,containerRef:re,parsedNodeCount:ae,requestFrame:be,cancelFrame:Ne,resolveScrollContainer:De,getNormalizedScrollTop:je,getOffsetTopWithinRoot:ot,isReverseFlexScrollRoot:Ve,estimateIndexForOffset:Ye,estimateHeightRange:nt,getFallbackNodeHeight:Be,clamp:Xe}=L,lt=Z(null);let rt=null,wt=[];function dt(){const Kt=De(),fn=re.value;if(!Kt||!fn)return null;const vn=Kt.ownerDocument||fn.ownerDocument||document;if(Kt===vn.documentElement||Kt===vn.body||Kt===vn.scrollingElement){const Qn=fn.getBoundingClientRect();return Math.max(0,-Qn.top)}return Math.max(0,je(Kt,vn,!1)-ot(fn,Kt))}function Ft(Kt){var fn;const vn=De(),Qn=re.value;if(!vn||!Qn)return;const Hs=Math.max(0,Kt),Ss=vn.ownerDocument||Qn.ownerDocument||document,$r=Ss.defaultView||(typeof window<"u"?window:null);if(vn===Ss.documentElement||vn===Ss.body||vn===Ss.scrollingElement){const il=je(vn,Ss,!0)+Qn.getBoundingClientRect().top;return void((fn=$r?.scrollTo)==null||fn.call($r,0,Math.max(0,il+Hs)))}J_(vn,Ss,ot(Qn,vn)+Hs,{isReverseFlexScrollRoot:il=>{var K1;return(K1=Ve?.(il))!=null&&K1},getNormalizedScrollTop:je})}function Ht(Kt){const fn=ae.value,vn=Xe(Kt.nodeIndex,0,Math.max(0,fn-1));return nt(0,vn)+Math.max(0,Kt.offsetWithinNodePx)}function Vt(){if(rt!=null&&(Ne?.(rt),rt=null),q)for(const Kt of wt)window.clearTimeout(Kt);wt=[]}function Wt(Kt){const fn=Ht(Kt),vn=dt();vn!=null&&Math.abs(vn-fn)<=.5||Ft(fn)}return{activeRestoreAnchor:lt,getRelativeScrollTopWithinContainer:dt,setRelativeScrollTopWithinContainer:Ft,resolveAnchorOffset:Ht,clearRestoreReconcile:Vt,applyRestoreAnchor:Wt,scheduleRestoreReconcile:function(){lt.value&&q&&rt==null&&(rt=be?be(()=>{rt=null,lt.value&&Wt(lt.value)}):null,rt==null&<.value&&Wt(lt.value))},captureRestoreAnchor:function(){const Kt=dt(),fn=ae.value;if(Kt==null||fn<=0)return null;const vn=Xe(Ye(Kt+1),0,fn-1),Qn=nt(0,vn),Hs=Be(vn);return{nodeIndex:vn,offsetWithinNodePx:Xe(Kt-Qn,0,Math.max(0,Hs-1))}},restoreAnchor:function(Kt){const fn=ae.value;if(lt.value={nodeIndex:Xe(Kt.nodeIndex,0,Math.max(0,fn-1)),offsetWithinNodePx:Math.max(0,Kt.offsetWithinNodePx)},Vt(),Wt(lt.value),q)for(const vn of[0,120,280,480])wt.push(window.setTimeout(()=>{lt.value&&Wt(lt.value)},vn))},getAnchorDrift:function(Kt){const fn=dt();return fn==null?null:fn-Ht(Kt)}}})({isClient:G,containerRef:O,parsedNodeCount:Nn,requestFrame:Bo,cancelFrame:Zo,resolveScrollContainer:()=>ut.value||ue(),getNormalizedScrollTop:ze,getOffsetTopWithinRoot:_e,isReverseFlexScrollRoot:Se,estimateIndexForOffset:vs,estimateHeightRange:ko,getFallbackNodeHeight:Yn,clamp:Bs}),{nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,resetHeightMeasurements:c0,pruneHeightMeasurements:d0,rebuildHeightTrees:Rc,recordNodeHeight:V2,removeNodeHeights:q2,exportHeightCache:ke,importHeightCache:Ae,fenwickRangeSum:Ke}=(function(L={}){const q=Go({}),re=Go({total:0,count:0}),ae=Z(0),be=Z([]),Ne=Z([]);function De(){for(const Be of Object.keys(q))delete q[Number(Be)];re.total=0,re.count=0,ae.value=0,be.value=[],Ne.value=[]}function je(Be,Xe,lt){for(let rt=Xe+1;rt0;rt-=rt&-rt)lt+=Be[rt];return lt}function Ve(Be){ae.value=Be;const Xe=new Array(Be+1).fill(0),lt=new Array(Be+1).fill(0);for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0||(je(Xe,dt,Ft),je(lt,dt,1))}be.value=Xe,Ne.value=lt}function Ye(Be){if(!Number.isInteger(Be)||Be<0)return!1;const Xe=q[Be];if(!Number.isFinite(Xe)||Xe<=0)return!1;if(delete q[Be],re.total=Math.max(0,re.total-Xe),re.count=Math.max(0,re.count-1),ae.value>Be){const lt=be.value,rt=Ne.value;lt.length&&rt.length&&(je(lt,Be,-Xe),je(rt,Be,-1))}return!0}const nt=R(()=>re.count>0?Math.max(12,re.total/re.count):32);return{nodeHeights:q,heightStats:re,heightTreeSize:ae,heightSumTree:be,heightKnownTree:Ne,averageNodeHeight:nt,resetHeightMeasurements:De,pruneHeightMeasurements:function(Be){if(Be<=0)return void De();let Xe=0,lt=0;for(const[rt,wt]of Object.entries(q)){const dt=Number(rt),Ft=Number(wt);!Number.isFinite(dt)||dt<0||dt>=Be||!Number.isFinite(Ft)||Ft<=0?delete q[dt]:(Xe+=Ft,lt++)}re.total=Xe,re.count=lt},rebuildHeightTrees:Ve,recordNodeHeight:function(Be,Xe,lt={}){(function(rt,wt,dt={}){var Ft;if(!Number.isFinite(wt)||wt<=0)return!1;const Ht=q[rt];if(Ht&&(dt.allowShrink===!1&&wtrt){const Vt=be.value,Wt=Ne.value;if(Vt.length&&Wt.length)if(Ht){const Kt=wt-Ht;Kt!==0&&je(Vt,rt,Kt)}else je(Vt,rt,wt),je(Wt,rt,1)}dt.notify!==!1&&((Ft=L.onHeightRecorded)==null||Ft.call(L))})(Be,Xe,rn(mt({},lt),{notify:!0}))},removeNodeHeight:function(Be,Xe={}){var lt;const rt=Ye(Be);return rt&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},removeNodeHeights:function(Be,Xe={}){var lt;let rt=0;for(const wt of Be)Ye(Number(wt))&&rt++;return rt>0&&Xe.notify!==!1&&((lt=L.onHeightRecorded)==null||lt.call(L)),rt},exportHeightCache:function(){return Object.entries(q).map(([Be,Xe])=>({index:Number(Be),height:Number(Xe)})).filter(Be=>Number.isFinite(Be.index)&&Be.index>=0&&Number.isFinite(Be.height)&&Be.height>0).sort((Be,Xe)=>Be.index-Xe.index)},importHeightCache:function(Be,Xe={}){var lt;if(!Array.isArray(Be))return;const rt=ae.value;let wt=!1;if(Xe.mode!=="merge"){const dt=Object.keys(q);if(dt.length>0){for(const Ft of dt)delete q[Number(Ft)];wt=!0}}for(const dt of Be){const Ft=Number(dt.index),Ht=Number(dt.height);if(!Number.isInteger(Ft)||Ft<0||rt>0&&Ft>=rt||!Number.isFinite(Ht)||Ht<=0)continue;const Vt=q[Ft];Vt&&Math.abs(Vt-Ht)<=1||(q[Ft]=Ht,wt=!0)}wt&&((function(){let dt=0,Ft=0;const Ht=ae.value;for(const[Vt,Wt]of Object.entries(q)){const Kt=Number(Vt),fn=Number(Wt);!Number.isFinite(Kt)||Kt<0||Ht>0&&Kt>=Ht||!Number.isFinite(fn)||fn<=0?delete q[Kt]:(dt+=fn,Ft++)}re.total=dt,re.count=Ft})(),rt>0&&Ve(rt),(lt=L.onHeightRecorded)==null||lt.call(L))},fenwickRangeSum:function(Be,Xe,lt){if(lt<=Xe)return 0;const rt=ot(Be,lt-1);return Xe<=0?rt:rt-ot(Be,Xe-1)}}})({onHeightRecorded:()=>{Pt(),Ct.value&&z1(),Os.value&&yu(),Dt.value&&Uc(),po("node-resize")}});function Mt(L){Number.isInteger(L)&&L>=0&&J.add(L)}function Gt(L){for(const q of L)Mt(Number(q))}function an(L){$e++;let q=!0;try{const re=L();return q=re!==!1,re}finally{$e--,$e===0&&q&&Ce.value++}}function Fn(){Qs=[],pi=[],se=-1,J.clear(),xe.value=Ir}function so(){Fn(),an(()=>c0()),zo.clear()}function Ps(L){!Number.isInteger(L)||L<0||L>=St.value.length||zo.set(L,I1(L))}function ku(L,q,re={}){const ae=$l[L];Mt(L),V2(L,q,re);const be=$l[L];return Object.is(ae,be)?(J.delete(L),!1):(be&&be>0?Ps(L):ae&&zo.delete(L),!0)}function A1(L,q){const re=qt("getNodeLayoutHeight.slot.offsetHeight",()=>{var ae,be;return(be=(ae=ao.get(L))==null?void 0:ae.offsetHeight)!=null?be:0});return re>0?re:qt("getNodeLayoutHeight.content.offsetHeight",()=>q.offsetHeight)}function a6(L,q={}){q.mode!=="merge"?Fn():Gt(L.map(re=>re.index)),an(()=>Ae(L,q)),bv()}const nl=R(()=>Ki.value&&Tr.value),wF=R(()=>{var L;return!Y.value&&I.batchRendering!==!1&&Ho.value>0&&((L=I.maxLiveNodes)!=null?L:0)<=0}),_F=R(()=>!Y.value&&Ge&&Oe.value===!0&&!sn.value&&!fo.value&&!co.value&&!nl.value&&!wF.value),u6=R(()=>!!Js&&nl.value),c6=R(()=>sn.value||Ct.value),{focusIndex:Nl,liveRange:Ds,updateLiveRange:M1}=(function(L,q){const{parsedNodeCount:re,virtualizationEnabled:ae,maxLiveNodesResolved:be,liveNodeBufferResolved:Ne,clamp:De}=q,je=Ne??R(()=>{var Ye;return Math.max(0,(Ye=L.liveNodeBuffer)!=null?Ye:60)}),ot=Z(0),Ve=Go({start:0,end:0});return{liveNodeBufferResolved:je,focusIndex:ot,liveRange:Ve,updateLiveRange:function(){const Ye=re.value;if(!ae.value||Ye===0)return Ve.start=0,void(Ve.end=Ye);const nt=Math.min(be.value,Ye),Be=je.value,Xe=De(ot.value-Be,0,Math.max(0,Ye-nt));Ve.start=Xe,Ve.end=Math.min(Ye,Xe+nt)}}})(I,{parsedNodeCount:Nn,virtualizationEnabled:sn,maxLiveNodesResolved:Io,liveNodeBufferResolved:Qo,clamp:Bs}),ol=new Map,bu=new Map,da=new Map,f0=[],Fl=new Map,fa=new Set,d6=Z(0);let K2=!1;const f6=R(()=>(d6.value,fa.size)),Yi=new Map,sl=new Map,p6=Z(0),Z2=R(()=>{p6.value;let L=0;for(const q of Yi.values())L+=Math.max(0,q);return L});let Xi=null;const p0=R(()=>{if(!sn.value)return St.value.length;const L=Qo.value,q=Math.max(Ds.end+L,Co.value),re=Math.min(St.value.length,q);return Math.max(yo.value,re)});function h0(){K2||(K2=!0,queueMicrotask(()=>{K2=!1,d6.value+=1}))}function h6(L,q,re="node-resize"){if(!G||typeof window>"u")return null;const ae=window.setTimeout(()=>{fa.delete(ae)&&h0();try{q()}finally{po(re)}},Math.max(0,L));return fa.add(ae),h0(),ae}function m0(L){G&&L!=null&&(fa.delete(L)&&h0(),window.clearTimeout(L))}function m6(){if(G&&typeof window<"u")for(const L of fa)window.clearTimeout(L);fa.size&&(fa.clear(),h0()),f0.length=0,da.clear()}function xF(L){F.value=L}function SF(L){U.value=L}function AF(L){z.value=L}const{cancelScheduledFocusSync:G2,scheduleFocusSync:Lr}=(function(L){const{isClient:q,containerRef:re,virtualizationEnabled:ae,requestFrame:be,cancelFrame:Ne,syncFocusToScroll:De}=L;let je=null;function ot(){var Ye,nt,Be;return(Be=(nt=(Ye=re.value)==null?void 0:Ye.ownerDocument)==null?void 0:nt.defaultView)!=null?Be:typeof window<"u"?window:null}function Ve(){if(!je)return;const Ye=ot();je.viaTimeout?Ye?Ye.clearTimeout(je.id):clearTimeout(je.id):Ne?.(je.id),je=null}return{cancelScheduledFocusSync:Ve,scheduleFocusSync:function(Ye={}){if(!ae.value)return;if(!q)return void De(!0);if(Ye.immediate)return Ve(),void De(!0);if(je)return;const nt=()=>{je=null,De()};if(be)return void(je={id:be(nt),viaTimeout:!1});const Be=ot();je={id:Be?Be.setTimeout(nt,16):setTimeout(nt,16),viaTimeout:!0}}}})({isClient:G,containerRef:O,virtualizationEnabled:sn,requestFrame:Bo,cancelFrame:Zo,syncFocusToScroll:function(L=!1){var q;if(!sn.value)return;const re=ut.value||ue();if(!re)return;const ae=re.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,be=ae?.defaultView||(typeof window<"u"?window:null),Ne=re===ae?.documentElement||re===ae?.body,De=St.value.length;if(De<=0)return;if(!Ne&&De>0&&Se(re)){const rt=qt("syncFocusToScroll.clientHeight",()=>re.clientHeight||0),wt=qt("syncFocusToScroll.scrollTop",()=>re.scrollTop),dt=wt<0?-wt:wt;return void y0(Bs((je=Math.max(0,dt)+.5*Math.max(0,rt),Et.estimateIndexForOffsetFromEnd(je)),0,Math.max(0,De-1)),L)}var je;const ot=(function(rt,wt,dt,Ft){const Ht=O.value;if(!Ht)return null;const Vt=Ft?0:qt("syncFocusToScroll.model.root.getBoundingClientRect",()=>rt.getBoundingClientRect().top),Wt=qt("syncFocusToScroll.model.container.getBoundingClientRect",()=>Ht.getBoundingClientRect().top),Kt=Math.max(0,Vt-Wt),fn=Ft?qt("syncFocusToScroll.model.viewport.clientHeight",()=>{var vn,Qn,Hs,Ss;return(Ss=(Hs=(Qn=dt?.innerHeight)!=null?Qn:(vn=wt.documentElement)==null?void 0:vn.clientHeight)!=null?Hs:rt.clientHeight)!=null?Ss:0}):qt("syncFocusToScroll.model.root.clientHeight",()=>rt.clientHeight);return Bs(vs(Kt+.5*Math.max(0,fn)),0,Math.max(0,St.value.length-1))})(re,ae,be,Ne);if(ot!=null)return void y0(ot,L);const Ve=Ne?null:qt("syncFocusToScroll.root.getBoundingClientRect",()=>re.getBoundingClientRect()),Ye=Ne?0:Ve.top,nt=Ne?qt("syncFocusToScroll.viewport.clientHeight",()=>{var rt,wt;return(wt=(rt=be?.innerHeight)!=null?rt:re.clientHeight)!=null?wt:0}):Ve.bottom,Be=vt.value;let Xe=null,lt=null;for(const[rt,wt]of Be){if(!wt)continue;const dt=qt("syncFocusToScroll.slot.getBoundingClientRect",()=>wt.getBoundingClientRect());dt.bottom<=Ye||dt.top>=nt||(Xe==null&&(Xe=rt),lt=rt)}if(Xe==null||lt==null){const rt=O.value;if(!rt)return;const wt=Ne?{top:0}:qt("syncFocusToScroll.fallback.root.getBoundingClientRect",()=>re.getBoundingClientRect()),dt=qt("syncFocusToScroll.fallback.scrollTop",()=>ze(re,ae,Ne)),Ft=Ne?(()=>{const Vt=qt("syncFocusToScroll.fallback.container.getBoundingClientRect",()=>rt.getBoundingClientRect()),Wt=(Ne?0:wt.top)-Vt.top;return Math.max(0,Wt)})():(()=>{const Vt=_e(rt,re);return Math.max(0,dt-Vt)})(),Ht=Ne?qt("syncFocusToScroll.fallback.viewport.clientHeight",()=>{var Vt,Wt,Kt,fn;return(fn=(Kt=(Wt=be?.innerHeight)!=null?Wt:(Vt=ae?.documentElement)==null?void 0:Vt.clientHeight)!=null?Kt:re.clientHeight)!=null?fn:0}):qt("syncFocusToScroll.fallback.root.clientHeight",()=>re.clientHeight);return void y0(Bs(vs(Ft+.5*Math.max(0,Ht)),0,Math.max(0,St.value.length-1)),!0)}y0(Math.round((Xe+lt)/2),L)}}),{visibleNodeIndices:Y2,nodeVisibilityHandles:Oc,nodeVisibilityWatchStops:g0,nodeVisibilityFallbackTimers:g6,clearVisibilityFallback:v0,markNodeVisible:pa,cleanupNodeVisibility:MF,destroyNodeVisibilityState:X2}=epe({isClient:G,shouldTrackVisibleNodeIndices:()=>nl.value,shouldCleanupNodeVisibility:()=>sn.value,onNodeMarkedVisible:L=>{sn.value?Lr():Nl.value=Bs(L,0,Math.max(0,St.value.length-1))},onNodeVisibilityCleaned:L=>{ao.delete(L)&&j6()}}),{cleanupScrollListener:v6,setupScrollListener:TF}=(function(L){const{isClient:q,virtualizationEnabled:re,listenerEnabled:ae,scrollRootElement:be,resolveScrollContainer:Ne,scheduleFocusSync:De,onScroll:je}=L;let ot=null,Ve=null;function Ye(){ot&&(ot(),ot=null),Ve=null,be.value=null}function nt(Be){const Xe=L.getScrollTop?L.getScrollTop(Be):Be.scrollTop;return Math.max(0,Number.isFinite(Xe)?Math.abs(Xe):0)}return{cleanupScrollListener:Ye,setupScrollListener:function(){if(!q)return;if(!((Be=ae?.value)!=null?Be:re.value))return void Ye();var Be;const Xe=Ne();if(!Xe)return void Ye();if(be.value===Xe&&ot)return;Ye(),Ve=nt(Xe);const lt=()=>{if(je?.(),re.value){const rt=(function(wt){const dt=nt(wt),Ft=Ve;Ve=dt;const Ht=Math.max(480,.75*(wt.clientHeight||0));return Ft==null?dt>Ht?{immediate:!0}:void 0:Math.abs(dt-Ft)>Ht?{immediate:!0}:void 0})(Xe);rt?De(rt):De()}};Xe.addEventListener("scroll",lt,{passive:!0}),be.value=Xe,ot=()=>{Xe.removeEventListener("scroll",lt)}}}})({isClient:G,virtualizationEnabled:sn,listenerEnabled:c6,scrollRootElement:ut,resolveScrollContainer:ue,scheduleFocusSync:Lr,onScroll:function(){const L=Dt.value;if(!L)return;const q=E1();if(!q||(function(ae){if(R1()>=oo)return Ot=null,!1;const be=Ot;if(be==null)return!0;const Ne=Math.abs(ae.scrollTop-be)<=2;return Ne||(Ot=null),Ne})(q))return;const re=$6(q);re!=null?(re<-32||Math.abs(Math.max(0,re)-Math.max(0,L.distanceFromBottomPx))>32)&&Wc("restore"):Wc("restore")},getScrollTop:L=>{var q;const re=L.ownerDocument||((q=O.value)==null?void 0:q.ownerDocument)||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement;return qt("scrollListener.getScrollTop",()=>ze(L,re,ae))}});function y0(L,q=!1){const re=Bs(L,0,Math.max(0,St.value.length-1));!q&&Math.abs(re-Nl.value)<=1||(Nl.value=re,M1())}function Bs(L,q,re){return Math.min(Math.max(L,q),re)}function J2(L=St.value.length){const q=hs();return!Number.isInteger(q)||q<0?L:Bs(q,0,L)}function Q2(L){return L?.firstElementChild}function y6(L,q){var re;return L?(re=L.matches)!=null&&re.call(L,q)?L:L.querySelector(q):null}function EF(L,q){L<1||L>6||(W[L]=q)}function k6(){if(!kn.value)return void(ne.value=0);const L=qt("updateExperimentContainerWidth.clientWidth",()=>{var q,re;return(re=(q=O.value)==null?void 0:q.clientWidth)!=null?re:0});ne.value=L>0?L:0}let T1=null;function ev(){T1?.disconnect(),T1=null}const b6=Af("ViewportDeferredMarkdownCodeBlockNode",zr({loader:()=>mo(null,null,function*(){return(yield jo(()=>import("./index5-BZK7AFSJ.js"),__vite__mapDeps([6,4,5]))).default}),loadingComponent:dg,delay:0,suspensible:!1}),dg);function C6(L){return L===b6}const w6=R(()=>m.value==="pre"?Pi:m.value==="shiki"?b6:X9);function _6(){var L;return((L=I.codeBlockProps)==null?void 0:L.showHeader)!==!1}function x6(L,q,re){const ae=$l[q],be=typeof ae=="number"&&ae>0;if(Eo.value&&!be&&!(function(Ne){return!!In.value.paragraph&&(Ne.type==="paragraph"||Ne.type==="list_item"||Ne.type==="list")})(L)){const Ne=S$(L,re,X.value);if(Ne)return Ne}if(Ei.value&&L.type==="code_block"){const Ne=(function(De){if(De.type!=="code_block")return null;const je=n7(De,T0(De));return C6(je)?"markdown":je===Pi?"pre":je===w6.value||je===X9?"monaco":null})(L);if(Ne==="monaco"||Ne==="markdown"||Ne==="pre")return(function(De,je){var ot,Ve,Ye;if(!De||De.type!=="code_block")return null;const nt=je.rendererKind,Be=nt!=="pre"&&je.showHeader!==!1,Xe=!!De.diff;let lt=0,rt=500;if(nt==="monaco"){const dt=(ot=je.monacoOptions)!=null?ot:{},Ft=r4(De,dt,je.width),Ht=(function(Wt){const Kt=typeof Wt?.fontSize=="number"&&Wt.fontSize>0?Wt.fontSize:12;return typeof Wt?.lineHeight=="number"&&Wt.lineHeight>0?Wt.lineHeight:Math.round(1.5*Kt)})(dt),Vt=(function(Wt,Kt){var fn,vn;const Qn=typeof((fn=Wt?.padding)==null?void 0:fn.top)=="number"?Wt.padding.top:Kt?0:8,Hs=typeof((vn=Wt?.padding)==null?void 0:vn.bottom)=="number"?Wt.padding.bottom:Kt?0:8;return Math.max(0,Qn)+Math.max(0,Hs)})(dt,Xe);rt=typeof dt.MAX_HEIGHT=="number"&&dt.MAX_HEIGHT>0?dt.MAX_HEIGHT:500,lt=Math.round(Ft*Ht+Vt)}else if(nt==="markdown"){const dt=r4(De);lt=Math.round(21*dt+32)}else{const dt=r4(De);lt=Math.round(28*dt),rt=Number.POSITIVE_INFINITY}const wt=Math.max(1,Math.min(lt,rt));return mt({kind:"code-block",height:Math.round(wt+(Be?40:0)),contentHeight:wt,rendererKind:nt},Xe&&nt==="monaco"?{diffInline:v5((Ve=je.monacoOptions)!=null?Ve:{},(Ye=je.width)!=null?Ye:0)}:{})})(L,{rendererKind:Ne,monacoOptions:I.codeBlockMonacoOptions,showHeader:_6(),width:re})}return null}I4(()=>{if(Ce.value,$e>0)return;const L=St.value,q=Jo();if(!L.length||!di.value)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const re=ne.value||qt("estimatedNodeHeights.clientWidth",()=>{var Ve;return((Ve=O.value)==null?void 0:Ve.clientWidth)||0});if(!Number.isFinite(re)||re<=0)return Qs=[],pi=[],se=-1,J.clear(),void(xe.value=Ir);const ae=(function(Ve){return[Math.round(Ve),Eo.value,Ei.value,X.value,I.codeBlockMonacoOptions,_6(),m.value,In.value,o4.value]})(re),be=Qs.length<=L.length&&(De=ae,(Ne=pi).length===De.length&&Ne.every((Ve,Ye)=>Object.is(Ve,De[Ye])));var Ne,De;const je=be&&se===q?L.length:be?J2(L.length):0,ot=be?Array.from(J):[];Qs.length=L.length;for(let Ve=je;Ve=0&&Vexe.value);Et=(function(L){let q=!0,re=[0],ae="";function be(Ye){var nt;const Be=L.nodeHeights[Ye];if(Number.isFinite(Be)&&Be>0)return Be;const Xe=L.parsedNodes.value[Ye],lt=Xe?.type,rt=!!((nt=L.hasCustomParagraphComponent)!=null&&nt.call(L)),wt=L.estimatedNodeHeights.value[Ye],dt=wt?.height;if(!(function(Ht,Vt,Wt){return!!(Wt&&Vt?.kind==="simple-text"&&(Ht==="paragraph"||Ht==="list_item"||Ht==="list"))})(lt,wt,rt)&&Number.isFinite(dt)&&dt>0)return dt;const Ft=Wfe(Xe,L.getContainerWidth()||640);return lt==="heading"||lt==="paragraph"&&Ft<=28&&(function(Ht,Vt){if(Vt)return!1;const Wt=Ht.children;return!Array.isArray(Wt)||!Wt.length||Wt.every(M$)})(Xe,rt)?Ft:Math.max(L.averageNodeHeight.value,Ft)}function Ne(){var Ye;const nt=L.parsedNodes.value.length,Be=L.getPrefixCacheKeyParts().join(":");if(!q&&ae===Be)return re;const Xe=new Array(nt+1);Xe[0]=0;for(let lt=0;lt=((nt=lt[Xe])!=null?nt:0))return Xe-1;let rt=0,wt=Xe-1,dt=Xe-1;for(;rt<=wt;){const Ft=rt+wt>>1;((Be=lt[Ft+1])!=null?Be:0)>=Ye?(dt=Ft,wt=Ft-1):rt=Ft+1}return dt}function je(Ye,nt){var Be,Xe;if(Ye>=nt)return 0;if(L.heightEstimationActive.value)return(function(wt,dt){var Ft,Ht;const Vt=L.parsedNodes.value.length,Wt=tx(Math.trunc(wt),0,Vt),Kt=tx(Math.trunc(dt),Wt,Vt);if(Wt>=Kt)return 0;const fn=Ne();return((Ft=fn[Kt])!=null?Ft:0)-((Ht=fn[Wt])!=null?Ht:0)})(Ye,nt);if(L.heightTreeSize.value!==L.parsedNodes.value.length){let wt=0;for(let dt=Ye;dtWt<=0?0:L.fenwickRangeSum(rt,0,Wt)+(Wt-L.fenwickRangeSum(wt,0,Wt))*lt;let Ft=0,Ht=Be.length-1,Vt=Be.length-1;for(;Ft<=Ht;){const Wt=Ft+Ht>>1;dt(Wt+1)>=Ye?(Vt=Wt,Ht=Wt-1):Ft=Wt+1}return Vt}let Xe=Ye;for(let lt=0;lt0||Ye++}return Ye}return{markFallbackHeightPrefixDirty:function(){q=!0},getFallbackNodeHeight:be,estimateHeightRange:je,estimateIndexForOffset:ot,estimateIndexForOffsetFromEnd:function(Ye){var nt,Be;const Xe=L.parsedNodes.value;if(!Xe.length)return 0;if(Ye<=0)return Math.max(0,Xe.length-1);if(L.heightEstimationActive.value){const rt=(nt=Ne()[Xe.length])!=null?nt:0;return De(Math.max(0,rt-Ye))}if(L.heightTreeSize.value===Xe.length){const rt=je(0,Xe.length);return ot(Math.max(0,rt-Ye))}let lt=Ye;for(let rt=Xe.length-1;rt>=0;rt--){const wt=(Be=L.nodeHeights[rt])!=null?Be:L.averageNodeHeight.value;if(lt<=wt)return rt;lt-=wt}return 0},getEstimatedNodeHeightCount:Ve,buildVirtualHeightSummary:function(Ye){var nt;const Be=L.parsedNodes.value.length;return{totalNodes:Be,measuredCount:L.heightStats.count,estimatedCount:Ve(),averageNodeHeight:L.averageNodeHeight.value,topSpacerHeight:Ye.topSpacerHeight,bottomSpacerHeight:Ye.bottomSpacerHeight,estimatedTotalHeight:je(0,Be),width:(nt=Ye.width)!=null?nt:L.getContainerWidth()}}}})({parsedNodes:St,nodeHeights:$l,heightStats:hi,heightTreeSize:x1,heightSumTree:a0,heightKnownTree:u0,averageNodeHeight:S1,heightEstimationActive:kn,estimatedNodeHeights:Pc,getContainerWidth:bo,hasCustomParagraphComponent:()=>!!In.value.paragraph,getPrefixCacheKeyParts:()=>{var L;const q=uf(ne.value||qt("getFallbackHeightPrefix.clientWidth",()=>{var ae;return((ae=O.value)==null?void 0:ae.clientWidth)||0})),re=((L=o.virtualScroll)==null?void 0:L.measurementKey)==null?"":String(o.virtualScroll.measurementKey);return[St.value.length,hi.count,Math.round(hi.total),Math.round(100*S1.value),re,q,kn.value?1:0,o4.value,ie.value,In.value.paragraph?1:0]},fenwickRangeSum:Ke}),Je(()=>St.value.length,L=>{var q;Pt(),L<=0?so():(Ld0(q))),L!==x1.value&&Rc(L))},{immediate:!0});const IF=R(()=>{if(!sn.value)return St.value.map((ae,be)=>({node:ae,index:be}));const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);return St.value.slice(q,re).map((ae,be)=>({node:ae,index:q+be}))}),tv=R(()=>sn.value?ko(0,Math.min(Ds.start,St.value.length)):0),nv=R(()=>{if(!sn.value)return 0;const L=St.value.length;return ko(Math.min(Ds.end,L),L)});function S6(){return Et.buildVirtualHeightSummary({topSpacerHeight:tv.value,bottomSpacerHeight:nv.value,width:Cu()})}function LF(){const L=St.value,q=S6();return rn(mt({},q),{probe:{paragraphReady:!!X.value.paragraph,listItemReady:!!X.value.listItem,listWrapperOverhead:X.value.listWrapperOverhead,headingReadyLevels:Object.entries(X.value.headings).filter(([,re])=>!!re).map(([re])=>Number(re))},nodes:L.map((re,ae)=>{var be,Ne,De,je,ot,Ve,Ye,nt,Be;return{index:ae,type:re.type,estimateKind:(Ne=(be=Pc.value[ae])==null?void 0:be.kind)!=null?Ne:null,rendererKind:(je=(De=Pc.value[ae])==null?void 0:De.rendererKind)!=null?je:null,estimatedHeight:(Ve=(ot=Pc.value[ae])==null?void 0:ot.height)!=null?Ve:null,estimatedContentHeight:(nt=(Ye=Pc.value[ae])==null?void 0:Ye.contentHeight)!=null?nt:null,measuredHeight:(Be=$l[ae])!=null?Be:null}})})}function ov(){return o.indexKey!=null?String(o.indexKey):fo.value?`virtual-${wo()}`:"markdown-renderer"}function A6(L){const q=String(L),re=`${ov()}-`;if(!q.startsWith(re))return null;const ae=q.slice(re.length).match(/^(\d+)(?:$|-)/);if(!ae)return null;const be=Number(ae[1]);return!Number.isInteger(be)||be<0||be>=St.value.length?null:be}function wo(){var L,q,re;const ae=(L=o.virtualScroll)==null?void 0:L.sessionKey;return String(ae!=null&&ae!==""?ae:(re=(q=o.indexKey)!=null?q:I.customId)!=null?re:ps)}function ns(){var L;const q=(L=o.virtualScroll)==null?void 0:L.threadKey;return q==null||q===""?void 0:String(q)}const $F=R(()=>{var L,q,re;return(re=ns())!=null?re:String((q=(L=o.indexKey)!=null?L:I.customId)!=null?q:ps)});function sv(L){var q;return(L??"")===((q=ns())!=null?q:"")}function Rl(){var L,q,re;return q=(L=o.virtualScroll)==null?void 0:L.measurementKey,re=(function(){const ae=m.value;return(function(be){var Ne,De;const je=be.renderer,ot=je==="monaco"?be.codeBlockMonacoOptions:void 0,Ve=be.codeBlockProps,Ye=je==="shiki";return[be.isDark?"dark":"light",je==="monaco"?"code-rich":je==="pre"?"code-pre":"code-shiki",be.codeBlockStream===!1?"code-static":"code-stream",As(be.codeBlockMinWidth),As(be.codeBlockMaxWidth),...Ye?[Lce((Ne=Ve?.themes)!=null?Ne:be.themes,(De=Ve?.langs)!=null?De:be.langs)]:[],As(ot?.fontSize),As(ot?.lineHeight),As(ot?.fontFamily),As(ot?.tabSize),As(ot?.MAX_HEIGHT),As(ot?.wordWrap),As(ot?.wrappingIndent),As(ot?.padding),As(Ve?.showHeader),As(Ve?.showCopyButton),As(Ve?.showExpandButton),As(Ve?.showPreviewButton),As(Ve?.showCollapseButton),As(Ve?.showFontSizeButtons)].join("\0")})({renderer:ae,isDark:I.isDark,codeBlockStream:I.codeBlockStream,codeBlockMinWidth:I.codeBlockMinWidth,codeBlockMaxWidth:I.codeBlockMaxWidth,codeBlockMonacoOptions:ae==="monaco"?I.codeBlockMonacoOptions:void 0,codeBlockProps:I.codeBlockProps,themes:ae==="shiki"?I.themes:void 0,langs:ae==="shiki"?I.langs:void 0})})(),[q==null?"":String(q),re].join("\0")}function Cu(){return bo()}const k0=R(()=>uf(Cu())),Ji=R(()=>[Rl(),k0.value].join("\0")),NF=R(()=>{var L;return fo.value?["virtual",(L=ns())!=null?L:"",wo(),Ji.value].join("\0"):o.indexKey});function Dc(){p6.value+=1}function iv(L){return!(!L||!Number.isInteger(L.index)||L.index<0||L.index>=St.value.length||L.sessionKey!==wo()||L.threadKey!==ns()||L.layoutEpochKey!==Ji.value)}function M6(L){const q=String(L),re=sl.get(q);return re?iv(re)?re.index:null:A6(q)}function T6(L="async-node"){(Yi.size||sl.size)&&(Yi.clear(),sl.clear(),Dc(),po(L))}const Bc=nn(G3,null),rv={reportHeight(L,q){if(!Ct.value)return;const re=M6(L);if(re==null)return;const ae=ol.get(re);if(!ae)return;const be=Number(q),Ne=A1(re,ae);(function(De,je,ot={}){an(()=>ku(De,je,ot))})(re,Number.isFinite(be)&&be>0?Math.max(be,Ne||0):Ne)},markPending(L){if(!Ct.value)return;const q=A6(L);q!=null&&(function(re,ae){var be;const Ne=sl.get(re);if(Ne&&iv(Ne))return Yi.set(re,Math.max(0,(be=Yi.get(re))!=null?be:0)+1),Dc(),void po("async-node");Yi.set(re,1),sl.set(re,(function(De){return{index:De,sessionKey:wo(),threadKey:ns(),layoutEpochKey:Ji.value}})(ae)),Dc(),po("async-node")})(String(L),q)},markSettled(L){if(!Ct.value)return;const q=String(L),re=M6(L);(re!=null||(function(ae){return Yi.has(String(ae))})(q))&&(function(ae){var be;const Ne=(be=Yi.get(ae))!=null?be:0;return!(Ne<=0||(Ne<=1?(Yi.delete(ae),sl.delete(ae)):Yi.set(ae,Ne-1),Dc(),Ne===1&&po("async-node"),0))})(q)&&re!=null&&Ol()}};function FF(){let L=0;for(const q of ol.values())L+=qt("getVisibleDomHeight.offsetHeight",()=>{var re;return(re=q?.offsetHeight)!=null?re:0});return Math.ceil(Math.max(0,L))}Ln(G3,{reportHeight(L,q){rv.reportHeight(L,q),Bc?.reportHeight(L,q)},markPending(L){rv.markPending(L),Bc?.markPending(L)},markSettled(L){rv.markSettled(L),Bc?.markSettled(L)}});let lv,av=null,Hc=null;function b0(L){return L!==!1&&L!=null&&L!==""}function E6(){return sn.value?(function(){if(!sn.value)return!0;const L=St.value.length,q=Bs(Ds.start,0,L),re=Bs(Ds.end,q,L);if(q>=re)return!0;for(let ae=q;ae=p0.value}function uv(){return Oe.value===!0&&!at.value&&Z2.value===0&&fa.size===0&&Fl.size===0&&Xi==null&&E6()}function I6(){var L,q;if(((L=o.virtualScroll)==null?void 0:L.settleMode)!=="manual"||av===wo()&&lv===ns())return!0;const re=(q=o.virtualScroll)==null?void 0:q.settledToken;return!!b0(re)&&Hc===W1(re)}function cv(){return uv()&&I6()}function RF(L,q){return q.totalNodes<=0?L==="final"?"final":"estimate":q.measuredCount>=q.totalNodes?L==="final"?"final":"measured":q.measuredCount>0||q.estimatedCount>0?"mixed":"estimate"}function wu(L="manual",q){const re=S6(),ae=(function(be){return be||(Oe.value!==!0?St.value.length>0?"streaming":"estimating":!E6()||Fl.size>0||Xi!=null?"measuring":cv()?"settled":"settling")})(q);return{sessionKey:wo(),threadKey:ns(),phase:ae,nodeCount:re.totalNodes,liveRange:{start:Ds.start,end:Ds.end},renderedCount:yo.value,measuredCount:re.measuredCount,estimatedCount:re.estimatedCount,averageNodeHeight:re.averageNodeHeight,topSpacerHeight:re.topSpacerHeight,bottomSpacerHeight:re.bottomSpacerHeight,visibleDomHeight:FF(),totalHeight:L6(),width:re.width,final:Oe.value===!0,stable:cv(),confidence:RF(ae,re),reason:L}}function E1(){const L=ut.value||ue(),q=O.value;if(!L||!q)return null;const re=L.ownerDocument||q.ownerDocument||document,ae=L===re.documentElement||L===re.body||L===re.scrollingElement,be=qt("getScrollBox.scrollTop",()=>ze(L,re,ae)),Ne=qt("getScrollBox.scrollHeight",()=>{var je,ot,Ve,Ye,nt;return ae?Math.max((ot=(je=re.documentElement)==null?void 0:je.scrollHeight)!=null?ot:0,(Ye=(Ve=re.body)==null?void 0:Ve.scrollHeight)!=null?Ye:0,(nt=L.scrollHeight)!=null?nt:0):L.scrollHeight}),De=qt("getScrollBox.clientHeight",()=>{var je;return ae?((je=re.documentElement)==null?void 0:je.clientHeight)||L.clientHeight||0:L.clientHeight});return{root:L,doc:re,isViewportRoot:ae,scrollTop:be,scrollHeight:Ne,clientHeight:De}}function L6(){const L=St.value.length,q=Math.max(0,ko(0,L)),re=qt("getRendererLogicalHeight.offsetHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.offsetHeight)!=null?Ne:0}),ae=Math.max(0,re>0?re:qt("getRendererLogicalHeight.scrollHeight",()=>{var be,Ne;return(Ne=(be=O.value)==null?void 0:be.scrollHeight)!=null?Ne:0}));return L<=0?Math.ceil(re):sn.value?q>0?Math.max(1,Math.ceil(q),(function(){let be=tv.value+nv.value;for(const Ne of ao.values())Ne&&(be+=Math.max(0,qt("getVirtualizedDomLogicalHeight.offsetHeight",()=>Ne.offsetHeight||0)));return Math.ceil(Math.max(0,be))})(),(function(be,Ne){return be<=0||Ne<=0?0:Ne<=be+Math.max(512,.05*be)?Math.ceil(Ne):0})(q,ae)):Math.max(1,Math.ceil(ae)):Ct.value?q>0||hi.count>0||Et.getEstimatedNodeHeightCount()>0?(Rs.value&&yo.value,Math.max(1,Math.ceil(ae),Math.ceil(q))):Math.ceil(ae):Math.max(1,Math.ceil(ae),Math.ceil(q))}function $6(L){const q=O.value;if(!q)return null;const re=qt("getRendererBottomDistanceFromViewport.getBoundingClientRect",()=>q.getBoundingClientRect());return(function(be){return be.isViewportRoot?be.clientHeight:qt("getViewportBottomInRoot.getBoundingClientRect",()=>be.root.getBoundingClientRect().bottom)})(L)-re.bottom}function OF(L={}){const q=L.requireViewport!==!1,re=(function(Ne=64){const De=E1(),je=O.value;if(!De||!je)return!1;const ot=(function(Ye){if(Ye.isViewportRoot)return{top:0,bottom:Ye.clientHeight};const nt=qt("getVirtualViewportRect.getBoundingClientRect",()=>Ye.root.getBoundingClientRect());return{top:nt.top,bottom:nt.bottom}})(De),Ve=qt("isRendererNearVirtualViewport.getBoundingClientRect",()=>je.getBoundingClientRect());return Ve.bottom>=ot.top-Ne&&Ve.top<=ot.bottom+Ne})();if(q&&!re)return null;const ae=(function(){const Ne=E1(),De=O.value;if(!Ne||!De||Math.max(0,Ne.scrollHeight-Ne.scrollTop-Ne.clientHeight)>64)return null;const je=$6(Ne);return je==null?null:je>=-8&&je<=160?{type:"bottom",distanceFromBottomPx:Math.max(0,je)}:null})();if(ae)return{anchor:ae,captured:!0};const be=Nc();if(be)return{anchor:{type:"node",nodeIndex:be.nodeIndex,offsetWithinNodePx:be.offsetWithinNodePx},captured:re};if(L.allowFallback===!0){const Ne=(function(){const De=St.value.length;return De<=0?null:{type:"node",nodeIndex:Bs(Nl.value,0,Math.max(0,De-1)),offsetWithinNodePx:0}})();return Ne?{anchor:Ne,captured:!1}:null}return null}function dv(L){let q=2166136261;for(let re=0;re>>0).toString(36)}function PF(L,q){let re=L;for(let ae=0;ae8192?`${ae.slice(0,8192)}...${ae.length}`:ae;return`${ae.length}:${dv(be)}`})(L)}`;if(typeof L=="function")return"fn";if(typeof L!="object")return typeof L;if(q.has(L))return"cycle";if(re>=6)return"max-depth";q.add(L);try{if(Array.isArray(L)){if(L.length<=160){const Ve=[];for(let Ye=0;Ye=je&&De.push(Ye)}return[`a:${L.length}`,`h=${Ne.join(",")}`,`t=${De.join(",")}`,`all=${(ot>>>0).toString(36)}`].join(":")}const ae=L,be=Object.keys(ae).filter(Ne=>{const De=ae[Ne];return Ne!=="parent"&&Ne!=="el"&&Ne!=="component"&&(De==null||typeof De=="string"||typeof De=="number"||typeof De=="boolean"||DF.has(Ne))}).sort();return`o:${be.length}:${be.map(Ne=>`${Ne}=${C0(ae[Ne],q,re+1)}`).join(";")}`}finally{q.delete(L)}}let fv=-1,pv="",_u=[2166136261];function I1(L){const q=St.value[L];return q?dv(C0(q)):""}function BF(L,q){let re=L;for(let ae=0;ae>>0}function hv(){var L,q;const re=ie.value;if(fv===re)return pv;const ae=St.value.length;let be=J2(ae);(fv!==re-1||be>ae||_u.length>>0).toString(36),fv=re,pv}function zc(L,q={}){var re;const ae=q.includeHeightCache===!0,be=(re=q.includeContentHash)!=null?re:ae,Ne=ae?(function(je){const ot=(function(){var rt,wt;const dt=Number((wt=(rt=o.virtualScroll)==null?void 0:rt.heightCacheLimit)!=null?wt:5e3);return!Number.isFinite(dt)||dt<=0?Number.POSITIVE_INFINITY:Math.max(1,Math.trunc(dt))})();if(!Number.isFinite(ot)||je.length<=ot)return je;const Ve=new Map,Ye=rt=>{!rt||Ve.size>=ot||Ve.set(rt.index,rt)},nt=St.value.length,Be=Bs(Ds.start-2*Qo.value,0,nt),Xe=Bs(Ds.end+2*Qo.value,Be,nt);for(const rt of je)rt.index>=Be&&rt.index=0&&Ve.sizert.index-wt.index).slice(0,ot)})(ke().map(je=>{var ot;const Ve=St.value[je.index];return Ve?rn(mt({},je),{nodeType:String((ot=Ve.type)!=null?ot:""),signature:I1(je.index)}):null}).filter(je=>!!je)):[],De=OF({allowFallback:q.allowAnchorFallback===!0,requireViewport:q.requireViewport});return De||Ne.length||q.includeEmptyState===!0?rn(mt({sessionKey:L.sessionKey,threadKey:L.threadKey},De?{anchor:De.anchor,anchorCaptured:De.captured}:{anchorCaptured:!1}),{metrics:L,width:L.width,contentHash:be?hv():void 0,measurementKey:Rl()||void 0,heightCache:Ne.length?Ne:void 0}):null}function mv(L){var q,re;const ae=E1();if(!ae)return;const be=(function(je){const ot=O.value;if(!ot)return null;const Ve=_e(ot,je.root),Ye=St.value.length,nt=qt("getRendererBottomOffsetWithinRoot.offsetHeight",()=>ot.offsetHeight||0),Be=Math.max(0,nt>0?nt:Ye>0?qt("getRendererBottomOffsetWithinRoot.scrollHeight",()=>ot.scrollHeight||0):0),Xe=L6();return Ve+Math.max(Be,Xe)})(ae);if(be==null)return;const Ne=Math.max(0,L.distanceFromBottomPx),De=Math.max(0,be-ae.clientHeight-Ne);(function(je){oo=R1()+120,Ot=je})(De),ae.isViewportRoot?(re=(q=ae.doc.defaultView)==null?void 0:q.scrollTo)==null||re.call(q,0,De):J_(ae.root,ae.doc,De,{isReverseFlexScrollRoot:Se,getNormalizedScrollTop:ze})}const gv=[];function N6(){if(G)for(ln!=null&&(Zo?.(ln),ln=null);gv.length;){const L=gv.pop();L!=null&&window.clearTimeout(L)}}function Wc(L){const q=!!Dt.value;Dt.value=null,oo=0,Ot=null,N6(),q&&L&&po(L)}function Uc(){if(!Dt.value||!G||ln!=null)return;const L=()=>{ln=null;const q=Dt.value;q&&mv(q)};ln=Bo?Bo(L):null,ln==null&&L()}function F6(L,q={}){const re=St.value.length;return re<=0?[]:L.filter(ae=>!(!Number.isInteger(ae.index)||ae.index<0||ae.index>=re)&&!(!Number.isFinite(ae.height)||ae.height<=0)&&!(q.requireSignature&&!ae.signature)&&!(q.requireCompatibilityMetadata&&!ae.nodeType&&!ae.signature)&&(function(be){var Ne;const De=St.value[be.index];return!(!De||be.nodeType&&be.nodeType!==String((Ne=De.type)!=null?Ne:"")||be.signature&&be.signature!==I1(be.index))})(ae))}function R6(L){const q=uf(Cu()),re=uf(L);return q!==-1&&re!==-1&&q===re}function vv(L){var q;const re=Number(L?.width);if(Number.isFinite(re)&&re>0)return re;const ae=Number((q=L?.metrics)==null?void 0:q.width);return Number.isFinite(ae)&&ae>0?ae:null}function O6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&((q=L.measurementKey)!=null?q:"")===Rl()&&!!R6(vv(L))&&!!(function(re){const ae=re.heightCache;return!!ae?.length&&(P6(re)?ae.some(be=>!!(be.nodeType||be.signature)):ae.some(be=>!!be.signature))})(L)}function P6(L){return!!(L.contentHash&&L.contentHash===hv())}function HF(L){return!P6(L)}let xu=null,Su=null,w0=null,L1=null,$1=null;function yv(L){var q;const re=L.map(be=>{var Ne,De;return[be.index,Math.round(10*be.height),(Ne=be.nodeType)!=null?Ne:"",(De=be.signature)!=null?De:""].join("")}).join(""),ae=uf(Cu());return[(q=ns())!=null?q:"",wo(),Rl(),St.value.length,ae,L.length,dv(re)].join(":")}function D6(L=(q=>(q=o.virtualScroll)==null?void 0:q.heightCache)()){if(!Ct.value||!L?.length||St.value.length<=0||!R6((q=o.virtualScroll)==null?void 0:q.heightCacheWidth))return!1;var q;const re=F6(L,{requireSignature:!0});if(!re.length)return!1;const ae=yv(re);return ae===xu?(Su="standalone",!0):(a6(re,{mode:"merge"}),Pt(),xu=ae,Su="standalone",P1(),po("restore"),!0)}function kv(L,q={}){var re,ae,be;if(!Ct.value||!L||L.sessionKey!==wo()||!sv(L.threadKey)||St.value.length<=0)return!1;const Ne=!!((re=L.heightCache)!=null&&re.length)&&!_0(),De=!L.anchor||L.anchorCaptured===!1&&q.allowUncapturedAnchor!==!0?null:L.anchor,je=q.restoreAnchor===!0&&!!De&&!_0()&&Number(vv(L))>0;let ot=!1;if((ae=L.heightCache)!=null&&ae.length&&O6(L)){const Ye=F6(L.heightCache,{requireCompatibilityMetadata:!L.contentHash,requireSignature:HF(L)});Ye.length&&(a6(Ye,{mode:"merge"}),Pt(),xu=yv(Ye),Su="restore",P1(),ot=!0)}if(Ne||je)return!1;if(!q.restoreAnchor||!De)return ot&&po("restore"),!0;const Ve=(function(Ye,nt){var Be;const Xe=Ye.anchor,lt=Xe?Xe.type==="bottom"?`bottom:${Math.round(Xe.distanceFromBottomPx)}`:`node:${Xe.nodeIndex}:${Math.round(Xe.offsetWithinNodePx)}`:"none";return[(Be=ns())!=null?Be:"",wo(),Rl(),k0.value,nt,lt].join(":")})(L,(be=q.restoreToken)!=null?be:"imperative");return w0===Ve?(ot&&po("restore"),!0):(w0=Ve,(function(Ye){const nt=()=>{if(Ye.type==="node")return Wc(),void Fc({nodeIndex:Ye.nodeIndex,offsetWithinNodePx:Ye.offsetWithinNodePx});if($c(),Os.value=null,Dt.value=Ye,N6(),mv(Ye),G)for(const Be of[0,120,280,480])gv.push(window.setTimeout(()=>{const Xe=Dt.value;Xe&&mv(Xe)},Be))};(function(Be){if(!sn.value)return!1;const Xe=St.value.length;return!(Xe<=0||(Nl.value=Be.type==="node"?Bs(Be.nodeIndex,0,Xe-1):Xe-1,M1(),0))})(Ye)?yt(nt):nt()})(De),po("restore"),!0)}function _0(){const L=Cu();return Number.isFinite(L)&&L>0}function B6(L){var q;return L.sessionKey===wo()&&!!sv(L.threadKey)&&(St.value.length<=0||!(!((q=L.heightCache)!=null&&q.length)||_0())||!(!(L.anchor&&Number(vv(L))>0)||_0()))}function bv(){zo.clear();for(const L of Object.keys($l)){const q=Number(L);Number.isInteger(q)&&q>=0&&q{let q=!1,re=null;const ae=()=>{q||(q=!0,re!=null&&window.clearTimeout(re),L())};if(Bo)return Bo(ae),void(re=window.setTimeout(ae,50));re=window.setTimeout(ae,0)})}function Cv(L,q=ns(),re=Ji.value){return wo()===L&&ns()===q&&Ji.value===re}function wv(){return mo(this,arguments,function*(L={}){var q,re,ae,be,Ne;const De=wo(),je=ns(),ot=Ji.value,Ve=(q=L.frames)!=null?q:2,Ye=(re=L.timeoutMs)!=null?re:120,nt=(ae=L.reason)!=null?ae:"manual",Be=L.expectedSettledTokenKey,Xe=L.flushPendingTimers===!0,lt=wu(nt),rt=()=>rn(mt({},lt),{phase:lt.final?"settling":lt.phase,stable:!1,confidence:lt.confidence==="final"?"mixed":lt.confidence,reason:nt}),wt=()=>Cv(De,je,ot)&&(Be==null||O1()===Be);for(let Vt=0;Vtwindow.setTimeout(Wt,Vt))})(Ye),!wt()||(Xe&&m6(),Ol(),N1(),!wt()))return rt();const dt=uv();dt&&(av=De,lv=je,((be=o.virtualScroll)==null?void 0:be.settleMode)==="manual"&&Be!=null&&b0((Ne=o.virtualScroll)==null?void 0:Ne.settledToken)&&O1()===Be&&(Hc=W1(o.virtualScroll.settledToken)));const Ft=wt()&&dt&&I6(),Ht=wu(nt,Ft?"final":void 0);return Mv(Ht,!0),Ht})}let _v="content",Au=null,Mu=null,xv=0,F1=null,jc=null,Sv=null,Av=null;function R1(){return typeof performance<"u"&&typeof performance.now=="function"?performance.now():Date.now()}function z6(L){var q,re;const ae=F1;if(!ae)return!0;const be=(re=(q=o.virtualScroll)==null?void 0:q.heightDiffThresholdPx)!=null?re:1;return Math.abs(L.totalHeight-ae.totalHeight)>be||L.sessionKey!==ae.sessionKey||L.phase!==ae.phase||L.stable!==ae.stable||L.final!==ae.final||L.threadKey!==ae.threadKey||L.nodeCount!==ae.nodeCount||L.measuredCount!==ae.measuredCount||L.width!==ae.width}function O1(L=(q=>(q=o.virtualScroll)==null?void 0:q.settledToken)()){return As(L)}function W6(L,q){var re,ae;return[L,q.sessionKey,(re=q.threadKey)!=null?re:"",Rl(),hv(),As((ae=o.virtualScroll)==null?void 0:ae.settledToken),Math.round(q.totalHeight),Math.round(q.width)].join("\0")}function P1(){Sv=null,Av=null,jc=null}function zF(L){const q=L.heightCache;return q?.length?yv(q):""}function D1(L){var q,re,ae;const be=L.metrics,Ne=L.anchor?(De=L.anchor).type==="bottom"?`bottom:${Math.round(De.distanceFromBottomPx)}`:`node:${De.nodeIndex}:${Math.round(De.offsetWithinNodePx)}`:"none";var De;return[L.sessionKey,(q=L.threadKey)!=null?q:"",(re=L.measurementKey)!=null?re:Rl(),(ae=L.contentHash)!=null?ae:"",zF(L),Ne,L.anchorCaptured?1:0,be.liveRange.start,be.liveRange.end,be.renderedCount,be.nodeCount,Math.round(be.totalHeight),Math.round(be.width),be.phase,be.stable?1:0].join("\0")}function Mv(L,q=!1){if(!Ct.value||(function(De=!1){return!De&&fo.value&&!Qt.value})(q))return;const re=q||z6(L),ae=(function(De,je=!1){return je||De.stable||De.phase==="final"?{state:zc(De,{includeHeightCache:!0})}:{state:zc(De)}})(L,q),be=ae.state,Ne=!!(be&&(re||(function(De,je=!1){return!!je||D1(De)!==jc})(be,q)));if(re&&($(L),F1=L,xv=R1()),be&&Ne&&(B(be),be.anchor&&H(be.anchor),jc=D1(be)),L.stable){const De=W6("settled",L);if(De!==Sv){Sv=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-settled",ot)})(L)}}if(L.phase==="final"){const De=W6("final",L);if(De!==Av){Av=De;const je=zc(L,{includeHeightCache:!0});je&&(B(je),jc=D1(je)),(function(ot){s("render-final",ot)})(L)}}}function Tv(){Au!=null&&(Zo?.(Au),Au=null),Mu!=null&&G&&(window.clearTimeout(Mu),Mu=null)}function U6(){Au=null,Mu=null,(function(L){if(Fl.size>0||Xi!=null)return!0;switch(L){case"node-resize":case"async-node":case"resize":case"restore":case"final":case"manual":return!0;default:return!1}})(_v)&&(Ol(),N1()),Mv(wu(_v))}function po(L){var q,re;if(!Ct.value||(_v=L,Au!=null||Mu!=null))return;const ae=Math.max(0,(re=(q=o.virtualScroll)==null?void 0:q.emitIntervalMs)!=null?re:32),be=Math.max(0,ae-(R1()-xv)),Ne=()=>{Mu=null,Au=Bo?Bo(U6):null,Au==null&&U6()};G&&be>0?Mu=window.setTimeout(Ne,be):Ne()}function j6(){He.value+=1}function x0(L){if(Rs.value&&L>=yo.value){const q=St.value[L],re=Fe.value===!0&&Oe.value!==!0&&L>=St.value.length-2,ae=q?.type==="code_block"||q?.type==="image"||q?.type==="mermaid"||q?.type==="infographic";if(!re||ae)return!1}return!nl.value||L=ve.value&&(K.value||(K.value=!0,X2()),!u6.value||!Js))return Vc(L),void(q&&pa(L,!0));if(L{if(g6.delete(Ne),!nl.value||Y2.value.has(Ne))return;const ot=ao.get(Ne);if(!ot)return;const Ve=ue(ot),Ye=ot.ownerDocument||document,nt=Ye.defaultView||window,Be=!Ve||Ve===Ye.documentElement||Ve===Ye.body,Xe=!Be&&Ve?qt("nodeVisibilityFallback.root.getBoundingClientRect",()=>Ve.getBoundingClientRect()):null,lt=Be?0:Xe.top,rt=Be?qt("nodeVisibilityFallback.clientHeight",()=>{var dt,Ft;return(Ft=(dt=nt.innerHeight)!=null?dt:Ve?.clientHeight)!=null?Ft:0}):Xe.bottom,wt=qt("nodeVisibilityFallback.node.getBoundingClientRect",()=>ot.getBoundingClientRect());wt.bottom>=lt-500&&wt.top<=rt+500&&pa(Ne,!0)},1800+De);g6.set(Ne,je)})(L);let be=null;be=Je(()=>ae.isVisible.value,Ne=>{if(Ne){v0(L),pa(L,!0),be?.(),g0.delete(L),Oc.get(L)===ae&&Oc.delete(L);try{ae.destroy()}catch{}}},{immediate:!0}),g0.set(L,be),sn.value&&Lr()}function Ev(){Xi=null,an(()=>{let L=!1;for(const[q,re]of Fl)Fl.delete(q),ol.get(q)===re.el&&bu.get(q)===re.version&&(L=ku(q,re.height,{allowShrink:re.allowShrink})||L);return L})}function qc(){Xi!=null&&(Zo?.(Xi),Xi=null),Fl.clear()}function A0(L,q){(function(re,ae,be){var Ne;if(!Number.isFinite(be)||be<=0||ol.get(re)!==ae)return;const De=bu.get(re);if(De==null)return;const je=St.value[re],ot=at.value&&Oe.value!==!0&&!((Ne=o.nodes)!=null&&Ne.length)&&re>=St.value.length-2,Ve=!(je?.loading===!0||ot),Ye=Fl.get(re),nt=Ye?Ye.allowShrink&&Ve:Ve,Be=Ye&&!nt?Math.max(Ye.height,be):be;Fl.set(re,{height:Be,allowShrink:nt,version:De,el:ae}),Xi==null&&(Xi=Bo?Bo(Ev):null,Xi==null&&Ev())})(L,q,A1(L,q))}function Ol(){for(const[L,q]of ol)q&&A0(L,q)}function V6(){fi?.disconnect(),fi=null,Gi.clear()}function Iv(){for(;f0.length;)m0(f0.pop())}Je(Qt,L=>{L&&po("content")},{flush:"post"}),t({getVirtualMetrics:wu,captureVirtualState:function(L={}){var q;return zc(wu("manual"),{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:L.allowFallbackAnchor===!0,requireViewport:L.requireViewport===!0,includeEmptyState:(q=L.includeEmptyState)==null||q})},restoreVirtualState:function(L,q={}){const re=q.restoreAnchor===!0,ae=q.restoreToken==null?"imperative":String(q.restoreToken);L1=L,$1={restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0},!kv(L,{restoreAnchor:re,restoreToken:ae,allowUncapturedAnchor:q.allowUncapturedAnchor===!0})&&B6(L)||(L1=null,$1=null)},forceMeasure:function(L="manual"){return mo(this,null,function*(){yield yt(),yield H6(),Ol(),N1(),yield yt();const q=wu(L);return Mv(q,!0),q})},settle:wv,scrollToNode:function(L,q="start"){Wc(),$c();const re=St.value.length;if(re<=0)return;const ae=Bs(L,0,re-1),be=()=>{var Ne;const De=U2({nodeIndex:ae,offsetWithinNodePx:0}),je=Yn(ae),ot=E1(),Ve=(Ne=ot?.clientHeight)!=null?Ne:0,Ye=ei();let nt=De;if(q==="center")nt=De-Ve/2+je/2;else if(q==="end")nt=De-Ve+je;else if(q==="nearest"&&Ye!=null){if(De>=Ye&&De+je<=Ye+Ve)return;nt=Dees.value,L=>{if(!L){V6();for(const q of da.values())for(const re of q)m0(re);da.clear(),bu.clear(),Iv(),qc()}},{immediate:!0}),Je(Oe,L=>{L&&(function(){if(G&&Oe.value&&ol.size){Iv();for(const q of[80,240,640]){const re=h6(q,()=>{for(const[ae,be]of ol)be&&A0(ae,be)},"final");re!=null&&f0.push(re)}}})(),po(L?"final":"content")});const WF=Q_(()=>po("content"),16),UF=Q_(()=>po("batch"),16);Je([()=>St.value.length,()=>yo.value],()=>{Dt.value&&Uc(),WF()},{flush:"post",immediate:!0}),Je([()=>Ds.start,()=>Ds.end],()=>{UF()},{flush:"post"});const{cleanupBatchScheduler:jF}=(function(L){const{props:q,isClient:re,isTestEnv:ae,parsedNodesIdentity:be,parsedNodeCount:Ne,desiredRenderedCount:De,datasetKey:je,batchingEnabled:ot,incrementalRenderingActive:Ve,resolvedBatchSize:Ye,resolvedInitialBatch:nt,renderedCount:Be,adaptiveBatchSize:Xe,previousRenderContext:lt,previousBatchConfig:rt,requestFrame:wt,cancelFrame:dt,hasIdleCallback:Ft,cleanupNodeVisibility:Ht,onDatasetKeyChanged:Vt,onDatasetChanged:Wt}=L;let Kt=null,fn="raf",vn=null,Qn=0,Hs=!1,Ss=!1;const $r=new Set,il=new Set;function K1(){if(re){Kt!=null&&(fn==="raf"&&dt?dt(Kt):fn==="idle"&&typeof window.cancelIdleCallback=="function"?window.cancelIdleCallback(Kt):fn==="timeout"&&window.clearTimeout(Kt),Kt=null),Qn+=1;for(const ti of $r)dt&&dt(ti);for(const ti of il)window.clearTimeout(ti);$r.clear(),il.clear(),vn=null,Hs=!1,Ss=!1}}function R0(){return typeof performance<"u"?performance.now():Date.now()}function u7(ti){(function(Pl){var ma;if(!Ve.value)return;const Dl=Math.max(2,(ma=q.renderBatchBudgetMs)!=null?ma:6),Bl=Math.max(1,Ye.value||1),Nr=Math.max(1,Math.floor(Bl/4));Pl>1.5*Dl?Xe.value=Math.max(Nr,Math.floor(.8*Xe.value)):Pl<.6*Dl&&Xe.value=Dl)return;const Bl=Math.max(1,ti),Nr=()=>{const Gc=R0();Kt=null;const Z1=vn??Bl;vn=null;const Yc=R0();Be.value=Math.min(Dl,Be.value+Z1),Ht(Be.value),(function(Pv,O0){if(!re)return void u7(O0);Hs=!0;const p7=++Qn;yt().then(()=>{var h7;if(p7!==Qn)return;const dR=R0(),fR=Math.max(O0,dR-Pv),m7=()=>{p7===Qn&&u7(fR)};if(wt){let Eu=null,Xc=null,v7=!1;const y7=()=>{v7||(v7=!0,Eu!==null&&($r.delete(Eu),Eu=null),Xc!==null&&(il.delete(Xc),window.clearTimeout(Xc),Xc=null),m7())};return Eu=wt(()=>{y7()}),$r.add(Eu),Xc=window.setTimeout(()=>{Eu!==null&&dt&&dt(Eu),y7()},Math.max(32,(h7=q.renderBatchIdleTimeoutMs)!=null?h7:120)),void il.add(Xc)}const g7=window.setTimeout(()=>{il.delete(g7),m7()},0);il.add(g7)})})(Gc,R0()-Yc)};if(!re||Li.immediate)return void Nr();const ga=Math.max(0,(Pl=q.renderBatchDelay)!=null?Pl:16);if(vn=vn!=null?Math.max(vn,Bl):Bl,Kt==null){if(!ae&&Ft&&window.requestIdleCallback){const Gc=Math.max(0,(ma=q.renderBatchIdleTimeoutMs)!=null?ma:120);return fn="idle",void(Kt=window.requestIdleCallback(()=>Nr(),{timeout:Gc}))}if(wt&&!ae)return fn="raf",void(Kt=wt(()=>{ga===0?Nr():(fn="timeout",Kt=window.setTimeout(()=>Nr(),ga))}));fn="timeout",Kt=window.setTimeout(()=>Nr(),ga)}}function d7(ti,Li={}){Hs?Ss=!0:ti==null?f7():c7(ti,Li)}function f7(){Ve.value&&c7(ot.value?Math.max(1,Math.round(Xe.value)):Math.max(1,Ye.value))}return Je([be,Ne,je,Ve,Ye,nt,()=>q.renderBatchDelay],()=>{var ti;const Li=Ne.value,Pl=lt.value,ma=je.value,Dl=!Object.is(ma,Pl.key),Bl=Li!==Pl.total,Nr=Dl||Bl;lt.value={key:ma,total:Li};const ga=rt.value,Gc=(ti=q.renderBatchDelay)!=null?ti:16,Z1=ga.batchSize!==Ye.value||ga.initial!==nt.value||ga.delay!==Gc||ga.enabled!==Ve.value;rt.value={batchSize:Ye.value,initial:nt.value,delay:Gc,enabled:Ve.value},Dl&&Vt(Li),(Nr||Z1||!Ve.value)&&K1(),(Nr||Z1)&&(Xe.value=Math.max(1,Ye.value||1)),Nr&&Wt();const Yc=De.value;if(!Li)return Be.value=0,void Ht(0);if(!Ve.value)return Be.value=Yc,void Ht(Be.value);const Pv=Dl||Pl.total===0;Be.value=Pv||Z1?Math.min(Yc,nt.value):Math.min(Be.value,Yc);const O0=Math.max(1,nt.value||Ye.value||Li);Be.value{Ve.value&&(typeof Li=="number"&&ti<=Li||ti>Be.value&&d7())}),{cleanupBatchScheduler:K1}})({props:I,isClient:G,isTestEnv:Zi,parsedNodesIdentity:Ys,parsedNodeCount:Nn,desiredRenderedCount:p0,datasetKey:NF,batchingEnabled:Fs,incrementalRenderingActive:Rs,resolvedBatchSize:Ho,resolvedInitialBatch:Co,renderedCount:yo,adaptiveBatchSize:Le,previousRenderContext:ht,previousBatchConfig:Ze,requestFrame:Bo,cancelFrame:Zo,hasIdleCallback:Il,cleanupNodeVisibility:MF,onDatasetKeyChanged:L=>{qc(),so(),Pt(),P1(),L>0&&Rc(L)},onDatasetChanged:()=>{sn.value&&Lr({immediate:!0})}});Je([c6,sn,()=>O.value,()=>oe()],([L,q])=>{if(!L)return v6(),void G2();TF(),q?Lr({immediate:!0}):G2()},{flush:"post",immediate:!0}),Je([()=>St.value.length,()=>sn.value],L=>mo(null,[L],function*([q,re]){re&&q&&G&&(yield yt(),Lr({immediate:!0}))}),{flush:"post"}),Je(kn,L=>{L&&(function(){var q;if(no.value&&$s.value&&Xs.value&&((q=ci.value)!=null&&q[1]))return;const re=kt({type:"paragraph",children:[{type:"text",content:"Probe paragraph text",raw:"Probe paragraph text"}],raw:"Probe paragraph text"}),ae=kt({type:"list_item",children:[re],raw:"- Probe paragraph text"}),be=kt({type:"list",ordered:!1,items:[ae],raw:"- Probe paragraph text"});no.value=re,$s.value=ae,Xs.value=be;const Ne={1:null,2:null,3:null,4:null,5:null,6:null};for(let De=1;De<=6;De++)Ne[De]=kt({type:"heading",level:De,text:"Probe heading",children:[{type:"text",content:"Probe heading",raw:"Probe heading"}],raw:`${"#".repeat(De)} Probe heading`});ci.value=Ne})()},{immediate:!0}),Je([()=>O.value,kn],()=>{if(!kn.value)return ev(),void(ne.value=0);k6(),ev(),kn.value&&O.value&&typeof ResizeObserver<"u"&&(T1=new ResizeObserver(()=>{k6(),Os.value&&yu(),Dt.value&&Uc(),po("resize")}),T1.observe(O.value))},{immediate:!0}),Je([kn,Ns,Ji],()=>mo(null,null,function*(){if(!kn.value)return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();yield yt(),(function(){if(!kn.value||typeof window>"u")return X.value={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},void Pt();const L={paragraph:null,listItem:null,listWrapperOverhead:0,headings:{1:null,2:null,3:null,4:null,5:null,6:null}},q=y6(Q2(F.value),".paragraph-node");L.paragraph=l4(F.value,q,"pre-wrap");const re=Q2(U.value),ae=re?.querySelector(".paragraph-node");L.listItem=l4(U.value,ae,"pre-wrap");const be=qt("readSimpleTextProbeProfile.list.offsetHeight",()=>{var De,je;return(je=(De=z.value)==null?void 0:De.offsetHeight)!=null?je:0}),Ne=qt("readSimpleTextProbeProfile.listItem.offsetHeight",()=>{var De,je;return(je=(De=U.value)==null?void 0:De.offsetHeight)!=null?je:0});L.listWrapperOverhead=Math.max(0,be-Ne);for(let De=1;De<=6;De++){const je=y6(Q2(W[De]),`h${De}`);L.headings[De]=l4(W[De],je,"pre-wrap")}X.value=L,Pt()})()}),{flush:"post",immediate:!0}),Je(()=>St.value.length,()=>{sn.value&&Lr({immediate:!0})}),Je([kn,ne],()=>{Pt(),sn.value&&Lr({immediate:!0}),Os.value&&yu(),Dt.value&&Uc(),po("resize")},{immediate:!1}),Je(()=>nl.value,L=>{if(L)for(const[q,re]of ao)S0(q,re);else if(X2(),sn.value)Lr({immediate:!0});else for(const[q,re]of ao)re&&pa(q,!0)},{immediate:!1}),Je([pe,ve,()=>oe()],()=>{var L;(L=Js.refresh)==null||L.call(Js);for(const[q,re]of ao)S0(q,re)},{immediate:!1}),Je([()=>I.viewportPriority,()=>St.value.length,ve],([L,q,re])=>{if(L!==!1){if(K.value&&(q<=200||q<=re)){K.value=!1;for(const[ae,be]of ao)S0(ae,be)}}else K.value=!1}),Je(()=>yo.value,()=>{sn.value&&Lr({immediate:!0})}),Je([Nl,Io,Qo,()=>St.value.length,sn],()=>{M1()},{immediate:!0});let B1=null,H1=!1,Kc=null;function z1(){B1=null,av=null,lv=void 0,Hc=null,P1()}function Lv(){qc(),so(),Pt(),zo.clear();const L=St.value.length;L>0&&Rc(L),bv()}function $v(){Tv(),m6(),F1=null,xu=null,Su=null,w0=null,L1=null,$1=null,H1=!1,z1(),T6("restore"),$c(),Wc()}function W1(L){var q;return[(q=ns())!=null?q:"",wo(),Rl(),k0.value,O1(L),St.value.length,Math.round(ko(0,St.value.length)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")}function q6(){return mo(this,null,function*(){var L,q,re,ae;const be=(L=o.virtualScroll)==null?void 0:L.settledToken,Ne=O1(be),De=wo(),je=ns(),ot=Ji.value;if(Ct.value&&((q=o.virtualScroll)==null?void 0:q.settleMode)==="manual"&&b0(be))if(uv()){if(W1(be)!==Hc&&!H1){H1=!0;try{const Ve=yield wv({reason:"manual",expectedSettledTokenKey:Ne}),Ye=O1()===Ne;Cv(De,je,ot)&&Ve.sessionKey===De&&Ve.threadKey===je&&Ye&&Ve.stable&&Ve.phase==="final"&&(Hc=W1((re=o.virtualScroll)==null?void 0:re.settledToken))}finally{H1=!1,yield yt();const Ve=(ae=o.virtualScroll)==null?void 0:ae.settledToken,Ye=b0(Ve)?W1(Ve):"";Cv(De,je,ot)&&Ye&&Hc!==Ye&&q6()}}}else po("manual")})}Je(Ct,(L,q)=>{if(L!==q){if(!L)return $v(),void Tv();$v(),Lv(),Kc=Ji.value,po("content")}},{flush:"post"}),Je([Ct,Ji],([L,q])=>{L?Kc!=null?Kc!==q&&(Kc=q,(function(re="resize"){qc(),so(),Pt(),zo.clear();const ae=St.value.length;ae>0&&Rc(ae),bv(),xu=null,Su=null,w0=null,F1=null,H1=!1,z1(),D6(),yt(()=>{Ol(),Os.value&&yu(),Dt.value&&Uc(),po(re)})})("resize")):Kc=q:Kc=null},{flush:"post",immediate:!0}),Je([Ct,()=>wo(),()=>ns()],([L])=>{L&&($v(),Lv(),T6("content"),po("content"))}),Je([Ct,()=>wo(),()=>ns(),Ji,()=>St.value.length],([L])=>{L&&(function(q="async-node"){let re=!1;for(const[ae,be]of Array.from(sl.entries()))iv(be)||(sl.delete(ae),Yi.delete(ae),re=!0);re&&(Dc(),po(q))})("async-node")},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.sessionKey},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>o.indexKey,()=>ie.value],([L])=>{L&&(P1(),(function(q="content"){if(!Ct.value)return;const re=[],ae=St.value.length,be=J2(ae);for(const Ne of Array.from(zo.keys())){if(Ne>=ae){re.push(Ne);continue}if(Ne=ae&&zo.delete(Ne);re.length&&((function(Ne,De={}){const je=Array.from(Ne,Number);Gt(je);let ot=0;if(an(()=>(ot=q2(je,De),ot>0)),ot>0)(function(Ve){for(const Ye of Ve)zo.delete(Ye)})(je);else for(const Ve of je)J.delete(Ve)})(re,{notify:!1}),Pt(),z1(),Os.value&&yu(),Dt.value&&Uc(),po(q))})("content"))},{flush:"post",immediate:!0}),Je([Ct,()=>St.value.length,()=>wo(),()=>ns()],([L,q,re,ae],[be,Ne,De,je])=>{L&&be&&re===De&&ae===je&&q!==Ne&&z1()},{flush:"post"}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCache},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.heightCacheWidth},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],()=>{D6()},{flush:"post",immediate:!0}),Je([Ct,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreAnchor},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey},()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q,re]){if(!q||!re)return;yield yt();const ae=(function(){var be;const Ne=(be=o.virtualScroll)==null?void 0:be.restoreAnchor;return Ne==null||Ne===!1?null:Ne===!0?"true":String(Ne)})();kv(re,{restoreAnchor:ae!=null,restoreToken:ae??void 0})}),{flush:"post",immediate:!0}),Je([Ct,ne,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.restoreState},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.measurementKey}],([L])=>{var q;if(!L)return;const re=(q=o.virtualScroll)==null?void 0:q.restoreState;re&&xu&&Su==="restore"&&(O6(re)||(Lv(),xu=null,Su=null,po("resize")))},{flush:"post"}),Je([Ct,()=>St.value.length,()=>wo(),ne],L=>mo(null,[L],function*([q]){var re;const ae=L1,be=$1;q&&ae&&(yield yt(),!kv(ae,{restoreAnchor:be?.restoreAnchor===!0,restoreToken:(re=be?.restoreToken)!=null?re:"imperative",allowUncapturedAnchor:be?.allowUncapturedAnchor===!0})&&B6(ae)||(L1=null,$1=null))}),{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>hi.count,()=>hi.total],([L,q,re])=>{if(!L||q!==!0||re==="manual"||!cv())return;const ae=(function(){var be;const Ne=St.value.length;return[(be=ns())!=null?be:"",wo(),Rl(),k0.value,Ne,Math.round(ko(0,Ne)),Math.round(Cu()),hi.count,Math.round(hi.total)].join(":")})();B1!==ae&&(B1=ae,wv({reason:"final"}).then(be=>{be.stable||B1!==ae||(B1=null)}))},{flush:"post",immediate:!0}),Je([Ct,Oe,()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settleMode},()=>{var L;return(L=o.virtualScroll)==null?void 0:L.settledToken},()=>wo(),()=>ns(),Ji,Z2,f6,()=>yo.value,p0,()=>St.value.length,()=>hi.count,()=>hi.total],()=>{q6()},{flush:"post",immediate:!0}),Je([()=>St.value.length,sn,Io,Qo,()=>Ds.start,()=>Ds.end],([L,q,re,ae,be,Ne])=>{fe.value&&Mn("virtualization",{nodes:L,virtualization:q,maxLiveNodes:re,buffer:ae,focusIndex:Nl.value,scroll:q?(()=>{const De=ut.value||ue();return De?{reverse:Se(De),scrollTop:Math.round(De.scrollTop),scrollTopAbs:Math.round(Math.abs(De.scrollTop)),scrollHeight:Math.round(De.scrollHeight),clientHeight:Math.round(De.clientHeight)}:null})():null,liveRange:{start:be,end:Ne},rendered:yo.value})}),Je([()=>I.customId],([L],q,re)=>{if(!L||Oo)return;const ae=(function(be,Ne){return be?(ys.controllers[be]=Ne,()=>{ys.controllers[be]===Ne&&delete ys.controllers[be]}):()=>{}})(L,{captureRestoreAnchor:Nc,restoreAnchor:Fc,getAnchorDrift:j2,getReport:LF});re(()=>{ae()})},{immediate:!0}),Vn(()=>{(function(){if(Ct.value)try{Ol(),N1();const L=wu("manual");z6(L)&&($(L),F1=L,xv=R1());const q=zc(L,{includeHeightCache:!0,includeContentHash:!0,allowAnchorFallback:!1,requireViewport:!0,includeEmptyState:!0});q&&(B(q),q.anchor&&H(q.anchor),jc=D1(q))}catch{}})(),jF(),X2(),en(),V6();for(const L of da.values())for(const q of L)m0(q);da.clear(),bu.clear(),zo.clear(),Iv(),qc(),ev(),$c(),Wc(),Tv(),v6(),G2()});const VF=Af("ViewportDeferredMermaidBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index11-TEhD5dop.js"),__vite__mapDeps([7,5]))).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for MermaidBlockNode are missing. Falling back to preformatted code rendering. To enable Mermaid rendering, please install "mermaid".',L),Pi}}),loadingComponent:px,delay:0}),px),qF=Af("ViewportDeferredInfographicBlockNode",zr({loader:()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index10-DKtGUVwa.js"),[])).default}catch(L){return console.warn('[markstream-vue] Failed to load InfographicBlockNode. Falling back to preformatted code rendering. To enable Infographic rendering, install "@antv/infographic" and configure setInfographicLoader with a dynamic loader.',L),Pi}}),loadingComponent:fx,delay:0}),fx),KF=Af("ViewportDeferredD2BlockNode",zr(()=>mo(null,null,function*(){try{return(yield jo(()=>import("./index8-B9apTeKj.js"),[])).default}catch(L){return console.warn('[markstream-vue] Optional peer dependencies for D2BlockNode are missing. Falling back to preformatted code rendering. To enable D2 rendering, please install "@terrastruct/d2".',L),Pi}})),Pi),K6={text:qo,paragraph:cc,heading:L2,code_block:X9,list:qd,list_item:Vd,blockquote:tm,table:ep,definition_list:nm,footnote:om,footnote_reference:or,footnote_anchor:Jf,admonition:lm,vmr_container:im,hardbreak:qa,link:Mi,image:Va,thematic_break:sm,math_inline:Jr,math_block:C$,strong:Si,emphasis:Ti,strikethrough:Ai,highlight:ir,insert:ji,subscript:Ui,superscript:Wi,emoji:zi,checkbox:nr,checkbox_input:nr,inline_code:li,html_inline:sr,reference:xi,html_block:Qf},ZF=R(()=>ov()),Z6=R(()=>X_(I.codeBlockProps)),GF=R(()=>X_(I.codeBlockProps,{omit:["langs"]})),G6=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,monacoOptions:I.codeBlockMonacoOptions,themes:I.themes,langs:m.value==="shiki"?I.langs:void 0,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),GF.value)),Y6=R(()=>mt(rn(mt({},G6.value),{langs:I.langs}),Z6.value));function X6(L){return typeof L=="boolean"?L:void 0}const YF=R(()=>{const L=I.codeBlockProps||{},q={},re=X6(L.showLineNumbers);re!==void 0&&(q.showLineNumbers=re);const ae=X6(L.diffInline);ae!==void 0&&(q.diffInline=ae);const be=(function(Ne){const De=Number(Ne);return Number.isFinite(De)&&De>0?De:void 0})(L.reservedHeightPx);return be!==void 0&&(q.reservedHeightPx=be),q}),XF=R(()=>mt(mt({stream:I.codeBlockStream,darkTheme:I.codeBlockDarkTheme,lightTheme:I.codeBlockLightTheme,themes:I.themes,langs:I.langs,minWidth:I.codeBlockMinWidth,maxWidth:I.codeBlockMaxWidth},typeof we.value=="boolean"?{showTooltips:we.value}:{}),Z6.value)),JF=R(()=>mt({},I.mermaidProps||{})),J6=R(()=>mt({},I.d2Props||{})),QF=R(()=>mt({},I.infographicProps||{})),U1=R(()=>({typewriter:f.value,fade:I.fade,customHtmlTags:lo.value.customHtmlTags})),eR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltip:we.value}:{})),tR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),nR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{})),oR=R(()=>mt(mt({},U1.value),typeof we.value=="boolean"?{showTooltips:we.value}:{}));function sR(L){return Array.isArray(L.children)&&L.children.length>0}const M0=R(()=>IF.value.map(L=>{var q,re,ae,be,Ne,De,je,ot;let Ve=(function(dt){var Ft,Ht,Vt,Wt,Kt,fn,vn;if(dt.type!=="code_block")return dt;const Qn=dt,Hs=[String((Ft=Qn.language)!=null?Ft:""),String((Ht=Qn.loading)!=null?Ht:""),String((Vt=Qn.diff)!=null?Vt:""),String((Wt=Qn.code)!=null?Wt:""),String((Kt=Qn.originalCode)!=null?Kt:""),String((fn=Qn.updatedCode)!=null?fn:""),String((vn=Qn.raw)!=null?vn:"")].join("\0"),Ss=Ll.get(Qn);if(Ss&&Ss.signature===Hs)return Ss.node;const $r=mt({},Qn);return Ll.set(Qn,{signature:Hs,node:$r}),$r})(L.node);const Ye=T0(Ve);let nt=n7(Ve,Ye);if((Ve.type==="html_block"||Ve.type==="html_inline")&&nt===K6[Ve.type]){const dt=Ve,Ft=String((q=dt.tag)!=null?q:"").trim().toLowerCase()||ZI(dt.content);if(Ft){const Ht=In.value[Ft];if(To.value.has(Ft)&&Ht)nt=Ht,Ve=rn(mt({},dt),{type:Ft,tag:Ft,content:pie(dt.content,Ft)});else if(GI((re=dt.content)!=null?re:dt.raw,Ft)){const Vt=String((be=(ae=dt.content)!=null?ae:dt.raw)!=null?be:"");Ve.type==="html_inline"?(nt=qo,Ve={type:"text",content:Vt,raw:Vt}):(nt=cc,Ve={type:"paragraph",children:[{type:"text",content:Vt,raw:Vt}],raw:Vt})}}}const Be=Ve.type==="code_block"&&m.value==="pre"&&nt===Pi&&!Nv(In.value,Ye);let Xe=mt({},(function(dt,Ft,Ht){const Vt=Ft??T0(dt);if(dt.type==="code_block"){const Wt=Vt?Nv(In.value,Vt):void 0;if(Ht&&m.value==="pre"&&!Wt&&Ht===Pi)return YF.value;if(Ht&&Vt&&Ht===Wt)return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:Y6.value;if(Ht&&Ht===In.value.code_block)return Y6.value;if(C6(Ht))return XF.value}return Vt==="mermaid"?e7(dt):Vt==="infographic"?t7(dt):Vt==="d2"||Vt==="d2lang"?J6.value:dt.type==="link"?eR.value:dt.type==="list"?tR.value:dt.type==="blockquote"?nR.value:dt.type==="table"?oR.value:dt.type==="code_block"?G6.value:U1.value})(Ve,Ye,nt));const lt=kn.value?Pc.value[L.index]:null;Ve.type==="code_block"&<?.kind==="code-block"&&(Xe=rn(mt({},Xe),Be?{reservedHeightPx:(Ne=lt.height)!=null?Ne:lt.contentHeight}:{estimatedHeightPx:lt.height,estimatedContentHeightPx:lt.contentHeight,estimatedDiffInline:lt.diffInline})),Be||Ve.type!=="code_block"||Ye!=="mermaid"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:lg(ig(String((De=Ve.code)!=null?De:"")))})),Be||Ve.type!=="code_block"||Ye!=="infographic"||Md(Xe.estimatedPreviewHeightPx)!=null||(Xe=rn(mt({},Xe),{estimatedPreviewHeightPx:ag(rg(String((je=Ve.code)!=null?je:"")))})),Ve.type==="math_block"&&(Xe=rn(mt({},Xe),{cacheScope:_n}));const rt=(function(dt,Ft){const Ht=String(dt.type);return!Qp(Ht)&&In.value[Ht]===Ft})(Ve,nt),wt=rt?p5(Ve,ge.value):void 0;return rn(mt({},L),{node:Ve,component:nt,bindings:Xe,customBindings:mt(mt({},wt??{}),Xe),rendersCustomNode:rt,hasSlotChildren:sR(Ve),slotContent:String((ot=Ve.content)!=null?ot:""),isCodeBlock:Ve.type==="code_block",indexKey:`${ZF.value}-${L.index}`,vnodeKey:`${$F.value}\0${L.index}\0${Ve.type}`})}));function T0(L){var q;return L?.type==="code_block"?String((q=L.language)!=null?q:"").trim().toLowerCase():""}function Nv(L,q){const re=q.trim().toLowerCase();if(re)for(const ae of[re,T2(re),n$(re)]){const be=ae&&L[ae];if(be)return be}}function Q6(L,q,re,ae){var be,Ne;const De=mt({},L.value);return Md(De.estimatedPreviewHeightPx)==null&&(De.estimatedPreviewHeightPx=ae(re(String((be=q?.code)!=null?be:"")),void 0,De.maxHeight==="none"?null:(Ne=Md(De.maxHeight))!=null?Ne:void 0)),De}function e7(L){return Q6(JF,L,ig,lg)}function t7(L){return Q6(QF,L,rg,ag)}function n7(L,q){if(!L)return l8;const re=In.value,ae=re[String(L.type)];if(L.type==="code_block"){const be=q??T0(L),Ne=be?Nv(re,be):void 0;return Ne||(m.value==="pre"?re.code_block||Pi:be==="mermaid"?re.mermaid||VF:be==="infographic"?re.infographic||qF:be==="d2"||be==="d2lang"?re.d2||KF:ae||re.code_block||w6.value)}return ae||K6[String(L.type)]||l8}function Fv(L){s("click",L)}function iR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseover",L)}function rR(L){var q;(q=L.target)!=null&&q.closest("[data-node-index]")&&s("mouseout",L)}function o7(L){s("mouseover",L)}function s7(L){s("mouseout",L)}const Tu=Z(null),Ii=Z(!1),j1=Z(null),lR=R(()=>!(I.domMode!=="minimal"||Y.value||I.fade!==!1||f.value||Ii.value||Xt.value||sn.value||Qe.value||co.value||Ki.value||Object.keys(In.value).length!==0));let V1,Zc=null,Rv=0,E0=0,I0=0;const i7=["code_block","admonition","table","math_block","html_block","image","thematic_break"],aR=new Set(i7),r7=[".typewriter-cursor",".height-estimation-probes",...i7.map(L=>`[data-node-type="${L}"]`),"script","style"].join(",");function l7(L){if(!L||typeof L!="object")return!1;const q=L.type;return typeof q=="string"&&aR.has(q)}function L0(L){var q,re;if(!L||typeof L!="object")return 0;const ae=L,be=(re=(q=ae.raw)!=null?q:ae.content)!=null?re:ae.code;if(typeof be=="string")return be.length;const Ne=ae.children;if(Array.isArray(Ne))return Ne.reduce((je,ot)=>je+L0(ot),0);const De=ae.items;return Array.isArray(De)?De.reduce((je,ot)=>je+L0(ot),0):0}function $0(){V1&&(clearTimeout(V1),V1=void 0)}function Ov(){Rv+=1,Zc!=null&&(Zo?.(Zc),Zc=null)}function q1(){Ov(),ha(),Tu.value&&(Tu.value.style.visibility="hidden")}function uR(L){var q;if(L.nodeType!==Node.TEXT_NODE||!((q=L.textContent)!=null?q:"").trim())return!1;const re=L.parentElement;return!!re&&!re.closest(r7)}function cR(L){let q=L.lastChild;for(;q;){if(uR(q))return q;if(q.nodeType===Node.ELEMENT_NODE){const re=q;if(!re.matches(r7)&&re.lastChild){q=re.lastChild;continue}}for(;q&&q!==L&&!q.previousSibling;)q=q.parentNode;if(!q||q===L)break;q=q.previousSibling}return null}function a7(){const L=M0.value;for(let q=L.length-1;q>=0;q--){const re=L[q];if(!re||l7(re.node)||!x0(re.index))continue;const ae=ao.get(re.index);if(!ae)continue;const be=cR(ae);if(be)return be}return null}function ha(){j1.value&&(j1.value.classList.remove(hx),j1.value=null)}function N0(){if(d.value!=="simple"||!G||!Ii.value||!O.value)return void ha();const L=a7(),q=L?(function(re){var ae;const be=(ae=re.parentElement)==null?void 0:ae.closest(".text-node");return be instanceof HTMLElement?be:re.parentElement})(L):null;q!==j1.value&&(ha(),q&&(q.classList.add(hx),j1.value=q))}function F0(){if(d.value!=="precise"||!G||!Ii.value||Zc!=null)return;const L=Rv,q=()=>{Zc=null,L===Rv&&(function(){var re,ae;if(d.value!=="precise"||!(G&&Ii.value&&O.value&&Tu.value))return;const be=O.value,Ne=Tu.value;Ne.style.visibility="hidden";const De=a7();if(!De)return;let je=0,ot=0,Ve=20,Ye=!1;if(De?.textContent){const nt=De.textContent.length,Be=document.createRange();Be.setStart(De,Math.max(0,nt-1)),Be.setEnd(De,nt);const Xe=typeof Be.getClientRects=="function"?Be.getClientRects():void 0,lt=(ae=Xe?.[Xe.length-1])!=null?ae:(re=De.parentElement)==null?void 0:re.getBoundingClientRect();if(lt){const rt=qt("typewriterCursor.root.getBoundingClientRect",()=>be.getBoundingClientRect());je=lt.right-rt.left+be.scrollLeft,ot=lt.top-rt.top+be.scrollTop,Ve=lt.height||Ve,Ye=!0}Be.detach()}Ye&&(Ne.style.transform=`translate(${Math.max(0,je)}px, ${Math.max(0,ot)}px)`,Ne.style.height=`${Ve}px`,Ne.style.visibility="visible")})()};Bo?Zc=Bo(q):q()}return Je([it,()=>o.content,()=>o.nodes,()=>I.typewriter,Oe],()=>mo(null,null,function*(){var L,q;if(!G||Y.value||!te.value)return;if(Oe.value)return Ii.value=!1,$0(),void q1();if((L=o.nodes)!=null&&L.length)return Ii.value=!1,$0(),q1(),E0=((q=o.content)!=null?q:"").length,void(I0=it.value.length);const re=(function(){var je,ot;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((Ve,Ye)=>Ve+L0(Ye),0):((ot=o.content)!=null?ot:"").length})(),ae=(function(){var je;return(je=o.nodes)!=null&&je.length?o.nodes.reduce((ot,Ve)=>ot+L0(Ve),0):it.value.length})(),be=!l7(St.value[St.value.length-1]),Ne=re>E0,De=ae>I0;if(!f.value||!be||!Ne&&!De)return f.value&&be||(Ii.value=!1,q1()),E0=re,void(I0=ae);E0=re,I0=ae,Ii.value=!0,d.value==="precise"&&Tu.value&&(Tu.value.style.visibility="hidden"),$0(),yield yt(),d.value==="simple"?N0():(ha(),F0()),V1=setTimeout(()=>{V1=void 0,Ii.value=!1},3e3)}),{flush:"post",immediate:!0}),Je(Ii,L=>mo(null,null,function*(){L?(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0()):q1()}),{flush:"post"}),Je(d,()=>mo(null,null,function*(){if(G&&!Y.value&&te.value&&Ii.value){if(yield yt(),d.value==="simple")return Ov(),void N0();ha(),d.value!=="precise"?q1():F0()}}),{flush:"post"}),Je([()=>yo.value,()=>Ds.start,()=>Ds.end],()=>mo(null,null,function*(){G&&!Y.value&&te.value&&Ii.value&&(yield yt(),d.value!=="simple"?(ha(),d.value==="precise"&&F0()):N0())}),{flush:"post"}),Vn(()=>{$0(),Ov(),ha(),xs.clear()}),(L,q)=>{const re=zO("NodeRenderer",!0);return p(Y)?(y(!0),M(Pe,{key:0},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[0]||(q[0]=be=>i(be)),onHandleArtifactClick:q[1]||(q[1]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onClick:Fv,onMouseover:o7,onMouseout:s7,onCopy:q[2]||(q[2]=be=>i(be)),onHandleArtifactClick:q[3]||(q[3]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))],64))),128)):(y(),M("div",{key:1,ref_key:"containerRef",ref:O,class:Re(["markstream-vue markdown-renderer",[{dark:I.isDark},{virtualized:sn.value},{"virtual-scroll-coordinated":Qt.value},{"stable-layout":_F.value},{"typewriter-simple-cursor":Ii.value&&d.value==="simple"}]]),"data-custom-id":I.customId,onClick:Fv,onMouseover:iR,onMouseout:rR},[Ko.value||sn.value?(y(),M(Pe,{key:0},[Ko.value?(y(),he(lpe,{key:0,width:Ns.value,"flow-root":sn.value||Qt.value,"paragraph-node":no.value,"list-item-node":$s.value,"list-node":Xs.value,"heading-nodes":ci.value,"set-paragraph-wrapper":xF,"set-list-item-wrapper":SF,"set-list-wrapper":AF,"set-heading-wrapper":EF},null,8,["width","flow-root","paragraph-node","list-item-node","list-node","heading-nodes"])):ee("",!0),sn.value?(y(),M("div",{key:1,class:"node-spacer",style:Zt({height:`${tv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],64)):ee("",!0),lR.value?(y(!0),M(Pe,{key:1},pt(M0.value,ae=>(y(),M(Pe,{key:ae.vnodeKey},[x0(ae.index)?(y(),he(bs(ae.component),zn({key:0,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onMouseover:q[4]||(q[4]=be=>s("mouseover",be)),onMouseout:q[5]||(q[5]=be=>s("mouseout",be)),onCopy:q[6]||(q[6]=be=>i(be)),onHandleArtifactClick:q[7]||(q[7]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):ee("",!0)],64))),128)):(y(!0),M(Pe,{key:2},pt(M0.value,ae=>(y(),M("div",{key:ae.vnodeKey,ref_for:!0,ref:be=>S0(ae.index,be),class:"node-slot","data-node-index":ae.index,"data-node-type":ae.node.type},[x0(ae.index)?(y(),M("div",{key:0,ref_for:!0,ref:be=>(function(Ne,De){var je;De||(function(nt){const Be=`${ov()}-${nt}`;let Xe=!1;for(const lt of Array.from(Yi.keys())){const rt=sl.get(lt);(rt?.index===nt||lt===Be||lt.startsWith(`${Be}-`))&&(Yi.delete(lt),sl.delete(lt),Xe=!0)}Xe&&(Dc(),po("async-node"))})(Ne),Fl.delete(Ne),(function(nt){var Be;const Xe=((Be=bu.get(nt))!=null?Be:0)+1;bu.set(nt,Xe)})(Ne);const ot=da.get(Ne);if(ot){for(const nt of ot)m0(nt);da.delete(Ne)}if((function(nt){const Be=Gi.get(nt);Be&&(fi?.unobserve(Be),Er.delete(Be),Gi.delete(nt))})(Ne),!De||!es.value)return ol.delete(Ne),void bu.delete(Ne);ol.set(Ne,De);const Ve=()=>{A0(Ne,De)};queueMicrotask(Ve);const Ye=(fi||typeof ResizeObserver>"u"||(fi=new ResizeObserver(nt=>{if(nt.length)for(const Be of nt){const Xe=Er.get(Be.target),lt=Gi.get(Xe??-1);Xe!=null&<&&A0(Xe,lt)}else Ol()})),fi);if(Ye&&(Gi.set(Ne,De),Er.set(De,Ne),Ye.observe(De)),typeof window<"u"){const nt=((je=St.value[Ne])==null?void 0:je.type)==="code_block"?[16,80,240,800]:Oe.value?[80]:[];if(nt.length){const Be=nt.map(Xe=>h6(Xe,Ve,"node-resize")).filter(Xe=>Xe!=null);Be.length&&da.set(Ne,Be)}}})(ae.index,be),class:"node-content"},[ae.isCodeBlock?ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:1,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[12]||(q[12]=be=>i(be)),onHandleArtifactClick:q[13]||(q[13]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:2,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[14]||(q[14]=be=>i(be)),onHandleArtifactClick:q[15]||(q[15]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"])):(y(),he(as,{key:0,name:"fade",css:I.fade!==!1,appear:I.fade!==!1},{default:me(()=>[ae.rendersCustomNode?(y(),he(bs(ae.component),zn({key:0,ref_for:!0},ae.customBindings,{node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey,"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[8]||(q[8]=be=>i(be)),onHandleArtifactClick:q[9]||(q[9]=be=>s("handleArtifactClick",be))}),{default:me(()=>[ae.hasSlotChildren?(y(),he(re,zn({key:0,ref_for:!0},uo.value,{nodes:ae.node.children,"index-key":ae.indexKey,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["nodes","index-key"])):ae.slotContent?(y(),he(re,zn({key:1,ref_for:!0},uo.value,{content:ae.slotContent,final:!ae.node.loading,"index-key":`${ae.indexKey}-content`,"smooth-streaming":!1,"batch-rendering":!1,"defer-nodes-until-visible":!1,"render-as-fragment":!0}),null,16,["content","final","index-key"])):ee("",!0)]),_:2},1040,["node","loading","index-key","custom-id","is-dark"])):(y(),he(bs(ae.component),zn({key:1,node:ae.node,loading:ae.node.loading,"index-key":ae.indexKey},{ref_for:!0},ae.bindings,{"custom-id":I.customId,"is-dark":I.isDark,onCopy:q[10]||(q[10]=be=>i(be)),onHandleArtifactClick:q[11]||(q[11]=be=>s("handleArtifactClick",be))}),null,16,["node","loading","index-key","custom-id","is-dark"]))]),_:2},1032,["css","appear"]))],512)):(y(),M("div",{key:1,class:"node-placeholder",style:Zt({height:`${Yn(ae.index)}px`})},null,4))],8,cpe))),128)),Ii.value&&d.value==="precise"?(y(),M("span",{key:3,ref_key:"typewriterCursorRef",ref:Tu,class:"typewriter-cursor","aria-hidden":"true"},null,512)):ee("",!0),sn.value?(y(),M("div",{key:4,class:"node-spacer",style:Zt({height:`${nv.value}px`}),"aria-hidden":"true"},null,4)):ee("",!0)],42,upe))}}})),[["__scopeId","data-v-a9489508"]]),Vi=R$;Vi.install=e=>{const t=new Set(["MarkdownRender","NodeRenderer",Vi.__name,Vi.name].filter(n=>!!n));for(const n of t)e.component(n,R$)};const M5=Object.freeze(Object.defineProperty({__proto__:null,default:Vi},Symbol.toStringTag,{value:"Module"})),dpe={key:0,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},fpe={key:1,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},ppe={key:2,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},hpe={key:3,xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"admonition-icon"},mpe={class:"admonition-title"},gpe=["aria-expanded","aria-controls"],vpe=["id"],lm=Gn(et({__name:"AdmonitionNode",props:{node:{},indexKey:{},isDark:{type:Boolean},typewriter:{type:Boolean},fade:{type:Boolean},customId:{}},emits:["copy"],setup(e,{emit:t}){var n;const o=e,s=t,i=R(()=>{if(o.node.title&&o.node.title.trim().length)return o.node.title;const u=o.node.kind||"note";return u.charAt(0).toUpperCase()+u.slice(1)}),r=Z(!!o.node.collapsible&&!((n=o.node.open)==null||n));function l(){o.node.collapsible&&(r.value=!r.value)}const a=`admonition-${Math.random().toString(36).slice(2,9)}`;return(u,c)=>(y(),M("div",{class:Re(["admonition",[`admonition-${o.node.kind}`]])},[C("div",{id:a,class:"admonition-legend"},[o.node.kind==="note"||o.node.kind==="info"?(y(),M("svg",dpe,[...c[1]||(c[1]=[C("circle",{cx:"12",cy:"12",r:"10"},null,-1),C("path",{d:"M12 16v-4"},null,-1),C("path",{d:"M12 8h.01"},null,-1)])])):o.node.kind==="tip"?(y(),M("svg",fpe,[...c[2]||(c[2]=[C("path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5"},null,-1),C("path",{d:"M9 18h6"},null,-1),C("path",{d:"M10 22h4"},null,-1)])])):o.node.kind==="warning"||o.node.kind==="caution"?(y(),M("svg",ppe,[...c[3]||(c[3]=[C("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"},null,-1),C("path",{d:"M12 9v4"},null,-1),C("path",{d:"M12 17h.01"},null,-1)])])):o.node.kind==="danger"||o.node.kind==="error"?(y(),M("svg",hpe,[...c[4]||(c[4]=[C("polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2"},null,-1),C("path",{d:"M12 8v4"},null,-1),C("path",{d:"M12 16h.01"},null,-1)])])):ee("",!0),C("span",mpe,N(i.value),1),o.node.collapsible?(y(),M("button",{key:4,class:"admonition-toggle","aria-expanded":!r.value,"aria-controls":`${a}-content`,onClick:l},[(y(),M("svg",{style:Zt({rotate:r.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[...c[5]||(c[5]=[C("path",{d:"m9 18 6-6-6-6"},null,-1)])],4))],8,gpe)):ee("",!0)]),Bn(C("div",{id:`${a}-content`,class:"admonition-content","aria-labelledby":a},[j(p(Vi),{"index-key":`admonition-${e.indexKey}`,nodes:o.node.children,"custom-id":o.customId,typewriter:o.typewriter,fade:o.fade,onCopy:c[0]||(c[0]=d=>s("copy",d))},null,8,["index-key","nodes","custom-id","typewriter","fade"])],8,vpe),[[qs,!r.value]])],2))}}),[["__scopeId","data-v-a83480e1"]]);lm.install=e=>{e.component(lm.__name,lm)};const f8=()=>jo(()=>import("./d2_markstream-vue-yoD6TSFD.js"),[]);let xh=null,Sh=f8,Ah=null,mx=!1,gx=!1;function $Ve(){return mo(this,null,function*(){if(xh)return xh;const e=Sh;return e?e===f8&&mx?null:Ah||(Ah=mo(null,null,function*(){let t;try{t=yield e()}catch(n){if(e===f8)return e===Sh&&(mx=!0,(function(o){gx||(gx=!0,console.warn('[markstream-vue] Optional dependency "@terrastruct/d2" is not installed. D2 blocks will render as source.',o))})(n)),null;throw n}finally{e===Sh&&(Ah=null)}return e!==Sh?null:t?(xh=(function(n){var o;if(!n)return n;if(n.D2&&typeof n.D2=="function")return n.D2;if(n.default&&n.default.D2&&typeof n.default.D2=="function")return n.default.D2;const s=(o=n.default)!=null?o:n;return typeof s=="function"?s:s?.D2&&typeof s.D2=="function"?s.D2:s})(t),xh):null}),Ah):null})}let Mh=null,O$=null,Th=null;function NVe(){return typeof O$=="function"}function FVe(){return mo(this,null,function*(){if(Mh)return Mh;const e=O$;return e?Th||(Th=mo(null,null,function*(){const t=yield e(),n=(function(o){var s,i,r;if(!o)return null;const l=(s=o.default)!=null?s:o,a=typeof l=="function"&&typeof((i=l.prototype)==null?void 0:i.render)=="function"?l:(r=o.Infographic)!=null?r:l?.Infographic;return typeof a=="function"?a:null})(t);return n?(Mh=n,Mh):null}).finally(()=>{Th=null}),Th):null})}const RVe=Symbol("markstreamLanguageIconResolver"),P$=["cjs","css","csv","gif","htm","html","jpeg","jpg","js","json","jsx","log","md","mjs","pdf","png","scss","svg","ts","tsx","txt","vue","webp","xml","yaml","yml"],ype=new Set(["AGENTS.md","CHANGELOG.md","Dockerfile","LICENSE","Makefile","README.md","package.json","pnpm-lock.yaml","pnpm-workspace.yaml","tsconfig.json","vite.config.ts"]),p8=[...P$].sort((e,t)=>t.length-e.length).join("|"),a4=new RegExp([String.raw`(?:^|[\s([{"'`+"`"+String.raw`])`,String.raw`(`,String.raw`(?:~|\.{1,2}|/)?(?:[A-Za-z0-9_.@+()[\]-]+/)+[A-Za-z0-9_.@+()[\]-]+(?:\.(?:${p8}))?`,String.raw`|`,String.raw`[A-Za-z0-9_.@+()[\]-]+\.(?:${p8})`,String.raw`)`,String.raw`(?:#L?(\d+)|:(\d+))?`,String.raw`(?=$|[\s)"'\]}>.,;!?,。;!?)])`].join(""),"gi"),D$=/[),.;!?,。;!?)]+$/;function kpe(e){const t=e.toLowerCase();return P$.some(n=>t.endsWith(`.${n}`))}function bpe(e){const t=new Map,n=new RegExp(String.raw`\b(?:path|src)=["'](\/[^"']+\.(?:${p8}))["']`,"gi");let o;for(;(o=n.exec(e))!==null;){const s=o[1];if(!s)continue;const i=s.split("/").pop();i&&t.set(i,s)}return t}function Cpe(e,t={}){const n=e.trim();if(!n||/^[a-z][a-z0-9+.-]*:\/\//i.test(n))return null;const o=n.match(/^(.*?)(?:#L?(\d+)|:(\d+))?$/i);if(!o)return null;let s=(o[1]??"").replace(D$,"");if(!s)return null;const i=s.split("/").pop()??s,r=s.includes("/"),l=ype.has(i),a=kpe(i);if(r&&!l&&!a)return null;if(!r&&!l){const d=t.aliases?.get(i);if(!d)return null;s=d}const u=o[2]??o[3],c=u?Number(u):void 0;return{path:s,line:c!==void 0&&Number.isFinite(c)&&c>0?c:void 0}}function wpe(e,t={}){const n=[];a4.lastIndex=0;let o;for(;(o=a4.exec(e))!==null;){const s=o[0]??"",i=o[1]??"",r=s.indexOf(i);if(r<0)continue;const l=o[2]??o[3];let a=i+(l?s.slice(r+i.length):"");const u=a.replace(D$,""),c=a.length-u.length;a=u;const d=Cpe(a,t);if(!d)continue;const f=o.index+r,h=f+a.length;n.push({...d,start:f,end:h,text:a}),c>0&&(a4.lastIndex-=c)}return n}function u4(e,t){let n=0,o=t-1;for(;o>=0&&e[o]==="\\";)n++,o--;return n%2===1}const _pe=/\s/,xpe=/\p{Nd}/u;function Cc(e,t){const n=e.codePointAt(t);return n===void 0?void 0:String.fromCodePoint(n)}function Spe(e,t){if(t<=0)return;const n=e.charCodeAt(t-1),o=n>=56320&&n<=57343&&t>1?t-2:t-1,s=e.codePointAt(o);return s===void 0?void 0:String.fromCodePoint(s)}function vx(e){return e!==void 0&&_pe.test(e)}function a1(e){return e!==void 0&&xpe.test(e)}function Ape(e,t){const n=e[t+1];return a1(Cc(e,t+1))?!0:(n==="-"||n==="+"||n==="."||n==="−"||n==="+"||n==="-")&&a1(Cc(e,t+2))}function vg(e){return e!==void 0&&e>="A"&&e<="Z"}const B$=new RegExp(String.raw`^(?:AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BRL|BSD|BTN|BWP|BYN|BZD|CAD|CDF|CHF|CLF|CLP|CNY|COP|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRU|MUR|MVR|MWK|MXN|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLE|SLL|SOS|SRD|SSP|STN|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|UYU|UZS|VED|VES|VND|VUV|WST|XAF|XCD|XOF|XPF|YER|ZAR|ZMW|ZWL|HK|US|SG|AU|CA|NZ|NT|TW|RMB|MEX|TT|BZ|EU|UK)$`);function Mpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))||a1(Cc(e,t+1))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")&&!/\p{L}/u.test(Cc(e,t+1)??"")}function Tpe(e,t){if(!vg(e[t-1]))return!1;let n=t-1;for(;n>0&&vg(e[n-1]);)n--;return B$.test(e.slice(n,t))?!0:t-n<=2&&!/[\p{L}\p{Nd}]/u.test(e[n-1]??"")}const Epe=/^[-–—,,、;;::~~(([【//]$/;function Ipe(e,t){const n=e[t+1];if(n!=="-"&&n!=="+"&&n!=="."||!a1(Cc(e,t+2)))return!1;const o=e[t-1];return o!==void 0&&Epe.test(o)}function Lpe(e){const t=String.raw`[、,,;;::~~\-–—至到//\s()()=*×=]|和|跟|与|及|或|and|or`;let n=e.replace(new RegExp(String.raw`^(?:${t})+`,"u"),"");for(;;){const s=n.replace(new RegExp(String.raw`^\p{L}+(?:${t})+`,"u"),"").replace(/^[\p{L}][\p{L} ]*(?=\p{Nd})/u,"");if(s===n)break;n=s}if(!/\p{Nd}/u.test(n))return!1;const o=String.raw`[-+]?[\p{Nd}][\p{Nd},.'’]*`;return new RegExp(String.raw`^${o}(?:\p{L}+)?(?:(?:${t})+${o}(?:\p{L}+)?)*$`,"u").test(n)}const ul=-1,yx=1,kx=2,bx=3;function $pe(e){const t=e.length,n=new Uint8Array(t),o=new Int32Array(t+1).fill(ul),s=new Int32Array(t+1),i=new Int32Array(t+1),r=[],l=[];{const F=[];for(let K=0;K{for(;a=(l[a]?.[1]??0);)a++;const U=l[a];return U!==void 0&&F>=U[0]},c=new Set(' \n\r)。,、;:!?"<>`「」『』【】〔〕()*—–“”‘’'),d=[];for(const F of e.matchAll(/\b(?:https?:\/\/|ftp:\/\/|mailto:|www\.)/gi))d.push(F.index);for(const F of e.matchAll(/\b(?:localhost|(?:\d{1,3}\.){3}\d{1,3}|[\w-]+(?:\.[\w-]+)*\.[a-zA-Z]{2,})(?=(?:\/|\?|:\d))/gi))d.push(F.index);for(const F of e.matchAll(/(?:\.{1,2})?\/[\p{L}\p{Nd}._-]+(?:\/[\p{L}\p{Nd}._-]*)*\?/gu))(F.index===0||!/[\w~/.-]/.test(e[F.index-1]))&&d.push(F.index);d.sort((F,U)=>F-U);let f=-1;for(const F of d){if(FF+7&&!/[\w/?#@~.+&=%-]/.test(e[U+1]??""))break}U++}r.push([F,U]),f=U}const h=[];for(let F=0;F]/.test(K))continue;let V=U,ie=ul,ne=ul;for(;V"){ne=V;break}if(!z&&X==="/"&&e[V+1]===">"){ne=V+1;break}if(!/\s/.test(X)){ie=V;break}for(;V"){ne=V;break}if(z){ie=V;break}if(le==="/"&&e[V+1]===">"){ne=V+1;break}const Ie=/^[a-zA-Z_:][\w:.-]*/.exec(e.slice(V));if(!Ie){ie=V;break}V+=Ie[0].length;let de=V;for(;de`]+/.exec(e.slice(de));if(!ve){ie=de;break}V=de+ve[0].length}}}if(ne!==ul)h.push([F,ne+1]),F=ne;else if(ie!==ul){const X=e.indexOf("<",F+1);F=(X!==-1&&X",F+2);ie===-1?v=!1:(h.push([F,ie+2]),F=ie+1,z=!0)}else if(U==="!"){if(e[F+2]==="-"&&e[F+3]==="-"){if(m){const ie=e.indexOf("-->",F+4);ie===-1?m=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(e.startsWith("[CDATA[",F+2)){if(k){const ie=e.indexOf("]]>",F+9);ie===-1?k=!1:(h.push([F,ie+3]),F=ie+2,z=!0)}}else if(w&&/[A-Z]/.test(e[F+2]??"")){const ie=e.indexOf(">",F+3);ie===-1?w=!1:(h.push([F,ie+1]),F=ie,z=!0)}}if(z)continue;if(U!==void 0&&/[a-zA-Z]/.test(U)){const ie=/^[a-zA-Z][a-zA-Z0-9+.-]{1,31}:/.exec(e.slice(F+1));if(ie){let ne=F+1+ie[0].length;for(;ne"&&e[ne]!=="<"&&!/\s/.test(e[ne]);)ne++;if(e[ne]===">"){h.push([F,ne+1]),F=ne;continue}}}if(U===void 0||!/[\w.!#$%&'*+/=?^`{|}~-]/.test(U))continue;let W=F+1;for(;W"&&(h.push([F,W+1]),F=W)}}h.sort((F,U)=>F[0]-U[0]);const b=[];for(const[F,U]of h){const z=b[b.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):b.push([F,U])}r.push(...b);let _=0;const g=F=>{for(;_=(b[_]?.[1]??0);)_++;const U=b[_];return U!==void 0&&F>=U[0]},x=[];let S=null,T=0,A=!1;for(let F=0;F"&&(A=!1);else if(!(u(F)||g(F))){if(S!==null)e[F]===S&&(S=null);else if(x.length>0&&(e[F]==='"'||e[F]==="'")&&F>0&&/\s/.test(e[F-1]))S=e[F];else if(e[F]==="[")T++;else if(e[F]==="]")T>0&&e[F+1]==="("&&(x.push(F),A=e[F+2]==="<",F++),T=Math.max(0,T-1);else if(e[F]==="("&&x.length>0)x.push(-1);else if(e[F]===")"&&x.length>0){const U=x.pop();if(U!==void 0&&U>=0){const z=e.slice(U+2,F);(/\s/.exec(z)===null||z.startsWith("<")&&/^<(?:\\[<>]|[^<>])*>$/.test(z)||/^[^\s]*\s+("([^"\\]|\\.)*"|'([^'\\]|\\.)*'|\(([^()\\]|\\.)*\))$/.test(z))&&r.push([U,F+1])}}}r.sort((F,U)=>F[0]-U[0]);const E=[];for(const[F,U]of r){const z=E[E.length-1];z&&F<=z[1]?z[1]=Math.max(z[1],U):E.push([F,U])}const P=F=>{let U=0,z=E.length-1;for(;U<=z;){const W=U+z>>1,K=E[W];if(K===void 0)return!1;if(F=K[1])U=W+1;else return!0}return!1};for(let F=0;F=0;F--)n[F]===bx&&(D=F),o[F]=D;const I=/^[\p{L}\p{Nd}\\|{([+.¬°-±×÷′-″←-⇿∀-⋿^_<>=-]$/u,$=/[^\p{L}\p{Nd}\s]$/u,B=/[^\s\u0020-\u007E\u0370-\u03FF\u{1D400}-\u{1D7FF}\p{Nd}¬°-±×÷′-″←-⇿∀-⋿]/u,H=/(?:^|\s)[a-z]{2,}/,O=(F,U)=>{const z=Cc(e,F+1);if(z===void 0||!I.test(z))return!1;const W=o[F+1]??ul;if(W!==ul){const K=e.slice(F+1,W);return!(K.length===((K.codePointAt(0)??0)>65535?2:1))&&B.test(K)||/[,;:!?]$/.test(K)||/^[a-z]{2,}$/.test(K)?!1:(s[W]??0)-(s[F+1]??0)===0&&(i[W]??0)-(i[F+1]??0)===0}return $.test(U)||B.test(U)||H.test(U)};return(F,U=-1)=>{if(e[F]!=="$"||n[F]===yx||e[F+1]==="$"||e[F-1]==="$"&&U!==F||Mpe(e,F)||F+1>=t||vx(e[F+1]))return null;const z=o[F+1]??ul;if(z===ul||(s[z]??0)-(s[F+1]??0)>0||(i[z]??0)-(i[F+1]??0)>0)return null;const W=e.slice(F+1,z);return/^\{[A-Z_][A-Z0-9_]*(?:\}$|[:-])/.test(W)||e[z+1]==="{"&&/^\{[A-Za-z_][A-Za-z0-9_]*(?:[:-][^{}]*)?\}$/.test(W)||a1(Spe(e,F))&&Lpe(W)||Ape(e,F)&&(O(z,W)||Tpe(e,z)||/\s/.test(W)&&/\p{Nd}$/u.test(W)&&!/[+\-*/^=_<>|\\¬°-±×÷′-″←-⇿∀-⋿]/.test(W)||e[z+1]==="$"&&!/\p{L}/u.test(W)&&/[^\p{L}\p{Nd}\s]$/u.test(W))?null:{content:W,end:z+1}}}const Cx=new WeakMap;function Npe(e,t){if(e.src[e.pos]!=="$")return!1;let n=Cx.get(e);(!n||n.src!==e.src)&&(n={src:e.src,match:$pe(e.src),lastEnd:-1},Cx.set(e,n));const o=n.match(e.pos,n.lastEnd);if(!o||o.end>e.posMax)return!1;if(n.lastEnd=o.end,t)return e.pos=o.end,!0;const s=e.push("math_inline","math",0);return s.content=o.content,s.markup="$",s.raw=e.src.slice(e.pos,o.end),s.loading=!1,e.pos=o.end,!0}function Fpe(e){return e.inline.ruler.disable("math"),e.inline.ruler.before("escape","math",Npe),e}const Rpe=12e4,Ope=6e4,Ppe=32,Dpe=3e4,wx=/(^|\n)(`{3,}|~{3,})[^\n]*\n([\s\S]*?)(?:\n)?\2(?=\n|$)/g;function Bpe(e){let t=0,n=0,o=0;wx.lastIndex=0;let s;for(;(s=wx.exec(e))!==null;){const r=s[3]??"";t+=1,n+=r.length,o=Math.max(o,r.length)}return{codeRenderer:e.length>=Rpe||n>=Ope||t>=Ppe||o>=Dpe?"pre":"shiki",codeFenceCount:t,codeChars:n}}async function H$(e){const t=typeof navigator<"u"?navigator.clipboard:void 0;if(t&&typeof t.writeText=="function")try{return await t.writeText(e),!0}catch{}return zpe(e)}function Hpe(e){if(typeof e!="string")return;const t=typeof navigator<"u"?navigator.clipboard:void 0;t&&typeof t.writeText=="function"||H$(e)}function zpe(e){if(typeof document>"u"||typeof document.execCommand!="function")return!1;const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-9999px",t.style.left="-9999px",t.style.opacity="0",document.body.appendChild(t);let n=!1;try{t.focus(),t.select(),n=document.execCommand("copy")}catch{n=!1}finally{document.body.removeChild(t)}return n}const z$="md-table-wide",W$="md-table-toggle",U$="md-table-fade",_x="md-table-toggle--show",Wpe="md-table-at-end",Upe="kimi-table-layout",j$='',jpe='';function e0(e){return e.querySelector(`button.${W$}`)}function V$(e){return e.querySelector(`.${U$}`)}const Vpe=26;function qpe(e){const t=e0(e);if(!t)return;const n=e.querySelector("thead tr")??e.querySelector("tr");if(!n)return;const o=n.getBoundingClientRect(),s=e.getBoundingClientRect().top,i=Math.max(2,Math.round(o.top-s+(o.height-Vpe)/2));t.style.top=`${i}px`,t.style.right=`${i}px`}function Kpe(e){return e.closest(".a-msg .msg")!==null}function Zpe(e){const t=e.querySelector("table");return t!==null&&t.scrollWidth>e.clientWidth+1}function q$(e){const t=`translateX(${e.scrollLeft}px)`,n=V$(e);n&&(n.style.transform=t);const o=e0(e);o&&(o.style.transform=t);const s=e.scrollLeft+e.clientWidth>=e.scrollWidth-2;e.classList.toggle(Wpe,s)}function Gpe(e,t){const n=e0(e);if(n)return n;if(!Kpe(e))return null;const o=document.createElement("div");o.className=U$,o.setAttribute("aria-hidden","true");const s=document.createElement("button");return s.type="button",s.className=W$,s.innerHTML=j$,s.setAttribute("aria-label",t.widen),s.title=t.widen,s.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),Ype(e,t)}),e.appendChild(o),e.appendChild(s),e.addEventListener("scroll",()=>q$(e),{passive:!0}),T5(e),s}function Ype(e,t){const n=e.classList.toggle(z$),o=e0(e);if(o){o.innerHTML=n?jpe:j$;const s=n?t.restore:t.widen;o.setAttribute("aria-label",s),o.title=s}T5(e),e.dispatchEvent(new CustomEvent(Upe,{bubbles:!0}))}function T5(e){const t=e0(e);if(!t)return;const n=Zpe(e),o=e.classList.contains(z$);t.classList.toggle(_x,n||o);const s=V$(e);s&&s.classList.toggle(_x,n),qpe(e),q$(e)}function Xpe(e){return new Worker("/assets/katexRenderer.worker-CO_gEm4q.js",{type:"module",name:e?.name})}function Jpe(e){return new Worker("/assets/mermaidParser.worker-BFSlSHEW.js",{type:"module",name:e?.name})}const Qpe={key:1,class:"diff-wrap"},e0e={class:"diff-bar"},t0e=["aria-label","onClick"],n0e={class:"diff-pre"},o0e={key:0,class:"diff-sign"},s0e={class:"diff-text"},i0e="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",xx="github-light",Sx="github-dark",r0e=et({__name:"Markdown",props:{text:{},openFile:{},streaming:{type:Boolean,default:!1}},setup(e){qce(),ide(),Zce(),ade(),Kce(new Xpe),lde(new Jpe);const{t}=m1(),n=nn("resolveImage"),o=Z(null),s=e,i=R(()=>!s.streaming),r=R(()=>bpe(s.text??"")),l=R(()=>s.streaming?{codeRenderer:"shiki",codeFenceCount:0,codeChars:0}:Bpe(s.text??"")),a=f2(),u=R(()=>!s.streaming),c=Go(new Map),d=new Set,f=/(!\[[^\]]*\]\()\s*([^)\s]+)([^)]*\))/g,h=/(]*?\bsrc=")([^"]+)(")/gi;function m(F){return!/^(https?:|data:|blob:)/i.test(F)}function v(F){if(!n)return;const U=[];for(const z of[f,h]){z.lastIndex=0;let W;for(;(W=z.exec(F))!==null;)U.push(W[2]??"")}for(const z of U)!z||!m(z)||c.has(z)||d.has(z)||(d.add(z),n(z).then(W=>{c.set(z,W!==z?W:"")}).catch(()=>{c.set(z,"")}).finally(()=>{d.delete(z)}))}function k(F){if(!n)return F;const U=z=>{if(!m(z))return null;const W=c.get(z);return W===void 0?i0e:W===""?null:W};return F.replace(f,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`}).replace(h,(z,W,K,V)=>{const ie=U(K);return ie===null?z:`${W}${ie}${V}`})}Je(()=>s.text,F=>v(F??""),{immediate:!0});function w(){if(!o.value||!s.openFile||s.streaming)return;const F=document.createTreeWalker(o.value,NodeFilter.SHOW_TEXT),U=[];let z=F.nextNode();for(;z;){const W=z,K=W.parentElement;K&&!K.closest("a, pre, .md-file-link, svg")&&W.data.trim().length>0&&U.push(W),z=F.nextNode()}for(const W of U){const K=wpe(W.data,{aliases:r.value});if(K.length===0||!W.parentNode)continue;const V=document.createDocumentFragment();let ie=0;for(const ne of K){ne.start>ie&&V.append(document.createTextNode(W.data.slice(ie,ne.start)));const X=document.createElement("button");X.type="button",X.className="md-file-link",X.textContent=ne.text,X.title=ne.line?`${ne.path}:${ne.line}`:ne.path,X.addEventListener("click",le=>{le.preventDefault(),le.stopPropagation(),s.openFile?.({path:ne.path,line:ne.line})}),V.append(X),ie=ne.end}ie{W.preventDefault(),W.stopPropagation(),s.openFile?.({path:_(z)})}))}}function x(){return{widen:t("conversation.widenTable"),restore:t("conversation.restoreTableWidth")}}function S(){if(!o.value||s.streaming)return;const F=x();for(const U of o.value.querySelectorAll(".table-node-wrapper"))Gpe(U,F)}function T(){if(!(!o.value||s.streaming))for(const F of o.value.querySelectorAll(".table-node-wrapper"))T5(F)}function A(){yt().then(()=>{w(),g(),S()})}Je(()=>s.text,A),Je(()=>s.streaming,A);let E=null,P=null;dn(()=>{A(),o.value&&(E=new MutationObserver(A),E.observe(o.value,{childList:!0,subtree:!0}),P=new ResizeObserver(T),P.observe(o.value))}),bn(()=>{E?.disconnect(),P?.disconnect()});const D={showHeader:!0,showCopyButton:!0,showExpandButton:!1,showPreviewButton:!1,showCollapseButton:!1,showFontSizeButtons:!1,loading:!1,monacoOptions:{lineNumbers:!1,fontSize:13,fontFamily:"var(--font-mono)",padding:{top:12,bottom:12}}},I=/(^|\n)(?:```|~~~)diff\b[^\n]*\n([\s\S]*?)(?:\n)?(?:```|~~~)(?=\n|$)/g,$=R(()=>{const F=k(s.text??""),U=[];let z=0;I.lastIndex=0;let W;for(;(W=I.exec(F))!==null;){const V=W[1]??"",ie=F.slice(z,W.index)+(V||"");ie.trim()&&U.push({kind:"md",text:ie}),U.push({kind:"diff",code:W[2]??""}),z=I.lastIndex}const K=F.slice(z);return(K.trim()||U.length===0)&&U.push({kind:"md",text:K}),U});function B(F){return F.split(` +`).map(U=>U.startsWith("@@")?{type:"hunk",sign:"",text:U}:/^\+(?!\+\+)/.test(U)?{type:"add",sign:"+",text:U.slice(1)}:/^-(?!--)/.test(U)?{type:"del",sign:"-",text:U.slice(1)}:U.startsWith(" ")?{type:"ctx",sign:"",text:U.slice(1)}:{type:"ctx",sign:"",text:U})}const H=Z(null);function O(F,U){H$(F).then(z=>{z&&(H.value=U,setTimeout(()=>{H.value=null},1400))})}return(F,U)=>(y(),M("div",{ref_key:"mdRef",ref:o,class:"md"},[(y(!0),M(Pe,null,pt($.value,(z,W)=>(y(),M(Pe,{key:W},[z.kind==="md"?(y(),he(p(Vi),{key:0,content:z.text,"custom-markdown-it":p(Fpe),mode:"chat","code-renderer":l.value.codeRenderer,"is-dark":p(a),"code-block-light-theme":xx,"code-block-dark-theme":Sx,themes:[xx,Sx],"code-block-props":D,final:i.value,"smooth-streaming":e.streaming,"batch-rendering":u.value,"defer-nodes-until-visible":!1,onCopy:p(Hpe)},null,8,["content","custom-markdown-it","code-renderer","is-dark","themes","final","smooth-streaming","batch-rendering","onCopy"])):(y(),M("div",Qpe,[C("div",e0e,[U[0]||(U[0]=C("span",{class:"diff-lang"},"diff",-1)),j(p(pn),{text:p(t)("filePreview.copyCode")},{default:me(()=>[C("button",{class:"diff-copy","aria-label":p(t)("filePreview.copyCode"),onClick:K=>O(z.code,W)},[j(p(Te),{name:H.value===W?"check":"copy",size:"sm"},null,8,["name"])],8,t0e)]),_:2},1032,["text"])]),C("pre",n0e,[C("code",null,[(y(!0),M(Pe,null,pt(B(z.code),(K,V)=>(y(),M("span",{key:V,class:Re(["diff-line",`diff-${K.type}`])},[K.type!=="hunk"?(y(),M("span",o0e,N(K.sign),1)):ee("",!0),C("span",s0e,N(K.text),1)],2))),128))])])]))],64))),128))],512))}}),Ic=ft(r0e,[["__scopeId","data-v-2a3e373d"]]),l0e={state:"idle"};function a0e(e){const t=Z(l0e),n=Z(ui(cn.updateSkippedVersion)),o=Z(!1);if(typeof e?.getUpdateAutoDownload=="function"&&e.getUpdateAutoDownload().then(i=>{o.value=i}).catch(()=>{}),e!==void 0){let i=!1;e.onUpdateStatus(r=>{i=!0,t.value=r}),e.getUpdateStatus().then(r=>{i||(t.value=r)}).catch(()=>{})}const s=R(()=>{const i=t.value;return!(i.state==="idle"||i.state==="available"&&i.version!==void 0&&i.version===n.value)});return{status:t,visible:s,canCheck:typeof e?.checkForUpdates=="function",autoDownload:o,canToggleAutoDownload:typeof e?.getUpdateAutoDownload=="function"&&typeof e?.setUpdateAutoDownload=="function",setAutoDownload:i=>{o.value=i,e?.setUpdateAutoDownload?.(i).catch(()=>{})},skipVersion:()=>{const i=t.value.version;t.value.state==="available"&&i!==void 0&&(n.value=i,Ls(cn.updateSkippedVersion,i))},check:async()=>{if(typeof e?.checkForUpdates!="function")return Promise.resolve({outcome:"unsupported"});const i=await e.checkForUpdates().catch(()=>({outcome:"error",message:"bridge call failed"}));return i.outcome==="available"&&i.version!==void 0&&i.version===n.value&&(n.value=null,ur(cn.updateSkippedVersion)),i},download:()=>{e?.downloadUpdate().catch(()=>{})},install:()=>{e?.installUpdate().catch(()=>{})}}}let c4=null;function K$(){return c4===null&&(c4=a0e(window.kimiDesktop)),c4}const u0e=["data-state"],c0e=["aria-label"],d0e={class:"upd-pill-text"},f0e={key:0,class:"upd-meta"},p0e={key:1,class:"upd-notes"},h0e={class:"upd-notes-title"},m0e={key:2,class:"upd-progress"},g0e={key:3,class:"upd-message"},v0e={class:"upd-foot"},y0e={class:"upd-foot-actions"},k0e=et({__name:"UpdateIndicator",setup(e){const{t,locale:n}=Nt(),{status:o,visible:s,skipVersion:i,download:r,install:l,autoDownload:a,setAutoDownload:u,canToggleAutoDownload:c}=K$(),d=Z(!1),f="0.35.0".trim()?"0.35.0":"",h=R(()=>{switch(o.value.state){case"available":return t("sidebar.update");case"downloading":return`${o.value.percent??0}%`;case"downloaded":return t("sidebar.updateDone");case"error":return t("sidebar.updateFailed");default:return""}}),m=R(()=>{switch(o.value.state){case"available":return t("sidebar.updateAvailable",{version:o.value.version??""});case"downloading":return t("sidebar.updateDownloading",{percent:o.value.percent??0});case"downloaded":return t("sidebar.updateReady",{version:o.value.version??""});case"error":return t("sidebar.updateFailed");default:return""}}),v=R(()=>{const T=o.value.releaseDate;if(T===void 0||T==="")return"";const A=new Date(T),E=Number.isNaN(A.getTime())?T:A.toLocaleDateString();return t("sidebar.updateReleaseDate",{date:E})}),k=R(()=>{const T=[];return v.value!==""&&T.push(v.value),f!==""&&T.push(t("sidebar.updateCurrentVersion",{version:f})),T.join(" · ")}),w=R(()=>o.value.percent??0),b=R(()=>{const T=o.value.releaseNotes;return T===void 0?"":((n.value.toLowerCase().startsWith("zh")?T.zh:T.en)??T.zh??T.en??"").trim()}),_=R(()=>{switch(o.value.state){case"error":return"alert-triangle";default:return"download"}});function g(){r()}function x(){i(),d.value=!1}function S(){l(),d.value=!1}return(T,A)=>p(s)?(y(),M("span",{key:0,class:"upd","data-state":p(o).state},[C("button",{class:"upd-pill",type:"button","aria-label":h.value,onClick:A[0]||(A[0]=E=>d.value=!0)},[j(p(Te),{class:"upd-pill-icon",name:_.value,size:"sm"},null,8,["name"]),C("span",d0e,N(h.value),1)],8,c0e),j(p(ua),{open:d.value,title:m.value,size:"lg","onUpdate:open":A[4]||(A[4]=E=>d.value=E)},{foot:me(()=>[C("div",v0e,[C("div",y0e,[p(o).state==="available"?(y(),M(Pe,{key:0},[j(p(Rt),{variant:"ghost",onClick:x},{default:me(()=>[qe(N(p(t)("sidebar.updateSkip")),1)]),_:1}),j(p(Rt),{onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateDownloadNow")),1)]),_:1})],64)):p(o).state==="downloading"?(y(),he(p(Rt),{key:1,variant:"secondary",onClick:A[1]||(A[1]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateBackground")),1)]),_:1})):p(o).state==="downloaded"?(y(),M(Pe,{key:2},[j(p(Rt),{variant:"ghost",onClick:A[2]||(A[2]=E=>d.value=!1)},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartLater")),1)]),_:1}),j(p(Rt),{onClick:S},{default:me(()=>[qe(N(p(t)("sidebar.updateRestartNow")),1)]),_:1})],64)):p(o).state==="error"?(y(),he(p(Rt),{key:3,variant:"danger-soft",onClick:g},{default:me(()=>[qe(N(p(t)("sidebar.updateRetry")),1)]),_:1})):ee("",!0)]),p(c)?(y(),he(p(rW),{key:0,class:"upd-auto","model-value":p(a),"onUpdate:modelValue":A[3]||(A[3]=E=>p(u)(E))},{default:me(()=>[qe(N(p(t)("sidebar.updateAutoDownload")),1)]),_:1},8,["model-value"])):ee("",!0)])]),default:me(()=>[(p(o).state==="available"||p(o).state==="downloaded")&&k.value?(y(),M("p",f0e,N(k.value),1)):ee("",!0),b.value?(y(),M("section",p0e,[C("h4",h0e,N(p(t)("sidebar.updateWhatsNew")),1),j(p(Ic),{text:b.value},null,8,["text"])])):ee("",!0),p(o).state==="downloading"?(y(),M("div",m0e,[C("div",{class:"upd-progress-fill",style:Zt({width:`${w.value}%`})},null,4)])):ee("",!0),p(o).state==="error"&&p(o).message?(y(),M("p",g0e,N(p(o).message),1)):ee("",!0)]),_:1},8,["open","title"])],8,u0e)):ee("",!0)}}),b0e=ft(k0e,[["__scopeId","data-v-c0a4acce"]]),yg=[{code:"en",label:"English"},{code:"zh",label:"简体中文"}],Hn=Mz({locale:$M()});function E5(e){Hn.global.locale.value=e,Ls(cn.locale,e)}const C0e=["app:load:start","app:load:complete","export:start","export:accepted","export:failed","prompt:start","prompt:accepted","prompt:failed","session:snapshot:start","session:snapshot:accepted","session:snapshot:failed","operation:failed","window:error","window:unhandled-rejection","ws:connection","ws:error","ws:resync","ws:stale-reconnect"],Z$=500,kg=256*1024,Ax=200,d4=16384,f4=500,p4=50,h4=50,w0e=6,_0e=/api[_-]?key|authorization|token|secret|password|cookie|credential|email|phone|nickname|avatar/i,x0e=/^[A-Za-z0-9+/=_-]{200,}$/;let m4=null;function Qr(){if(m4!==null)return m4;let e=!1;try{if(typeof location<"u"){const t=new URLSearchParams(location.search).get("debug");(t==="1"||t==="true")&&(e=!0)}}catch{}return e||(e=ui(cn.debug)==="1"),m4=e,e}const Ka=[],Ed=[];let Mf=0;const Yu=[];let Tf=0,S0e=1;const bg=new TextEncoder,A0e=new Set(C0e),I5=Z(0),Ef=Xr(!1);function M0e(){return Ka}function T0e(){Ka.length=0,Ed.length=0,Mf=0,Yu.length=0,Tf=0,I5.value++}function ca(e){if(!Ef.value){try{const t={id:S0e++,ts:Date.now(),source:e.source,kind:String(Kd(e.kind)),label:String(Kd(e.label)),sessionId:e.sessionId===void 0?void 0:String(Kd(e.sessionId)),method:e.method,path:e.path,eventType:e.eventType,seq:e.seq,offset:e.offset,status:e.status,code:e.code,requestId:e.requestId,durationMs:e.durationMs,detail:pu(e.detail)},n=JSON.stringify(t),o=bg.encode(n).byteLength;if(o>kg)return;for(Ka.push(t),Ed.push(n),Mf+=o+(Ed.length>1?1:0);Ka.length>Z$||Mf>kg;){const s=Ed.shift();Ka.shift(),s!==void 0&&(Mf-=bg.encode(s).byteLength,Ed.length>0&&(Mf-=1))}}catch{return}I5.value++}}function Bu(e){if(typeof e=="string")return e.length<=Ax?e:e.slice(0,Ax)}function mr(e){return typeof e=="number"&&Number.isFinite(e)?e:void 0}function E0e(e,t){if(A0e.has(e))try{const n={ts:Date.now(),event:e,sessionId:Bu(t?.sessionId),status:Bu(t?.status),operation:Bu(t?.operation),seq:mr(t?.seq),durationMs:mr(t?.durationMs),messageCount:mr(t?.messageCount),contentCount:mr(t?.contentCount),mediaCount:mr(t?.mediaCount),sessionCount:mr(t?.sessionCount),workspaceCount:mr(t?.workspaceCount),promptId:Bu(t?.promptId),zipBytes:mr(t?.zipBytes),errorName:Bu(t?.errorName),errorCode:mr(t?.errorCode),requestId:Bu(t?.requestId),phase:Bu(t?.phase),httpStatus:mr(t?.httpStatus),fatal:typeof t?.fatal=="boolean"?t.fatal:void 0,line:mr(t?.line),col:mr(t?.col)},o=JSON.stringify(n),s=bg.encode(o).byteLength;if(s>kg)return;for(Yu.push(o),Tf+=s+(Yu.length>1?1:0);Yu.length>Z$||Tf>kg;){const i=Yu.shift();i!==void 0&&(Tf-=bg.encode(i).byteLength,Yu.length>0&&(Tf-=1))}}catch{return}}function Kd(e,t=0){if(e==null)return e;const n=typeof e;if(n==="number"||n==="boolean")return e;if(n==="string"){const i=e;return x0e.test(i)?`[base64-like, ${i.length} chars omitted]`:i.length>f4?`${i.slice(0,f4)}… [+${i.length-f4} chars]`:i}if(n!=="object")return String(e);if(t>=w0e)return"[max depth]";if(Array.isArray(e)){const i=e.slice(0,p4).map(r=>Kd(r,t+1));return e.length>p4&&i.push(`[+${e.length-p4} more items]`),i}const o={},s=Object.entries(e);for(const[i,r]of s.slice(0,h4))o[i]=_0e.test(i)?"[redacted]":Kd(r,t+1);return s.length>h4&&(o._truncatedKeys=s.length-h4),o}function pu(e){if(e===void 0)return;const t=Kd(e);try{const n=JSON.stringify(t);if(n!==void 0&&n.length>d4)return{_truncated:`detail JSON was ${n.length} chars; first ${d4} kept`,preview:n.slice(0,d4)}}catch{return"[unserializable detail]"}return t}function I0e(e){Qr()&&ca({source:"rest",kind:"rest:request",label:`→ ${e.method} ${e.path}`,method:e.method,path:e.path,requestId:e.requestId,detail:{url:e.url,body:pu(e.body)}})}function L0e(e){if(!Qr())return;const t=e.code!==0;ca({source:"rest",kind:t?"rest:error":"rest:response",label:`← ${e.method} ${e.path} ${e.status} code=${e.code}${t?` "${e.msg}"`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,code:e.code,durationMs:e.durationMs,detail:{envelope:{code:e.code,msg:e.msg,request_id:e.envelopeRequestId},data:pu(e.data)}})}function $0e(e){Qr()&&ca({source:"rest",kind:"rest:error",label:`✕ ${e.method} ${e.path} ${e.phase} error${e.status!==void 0?` (HTTP ${e.status})`:""} ${Math.round(e.durationMs)}ms`,method:e.method,path:e.path,requestId:e.requestId,status:e.status,durationMs:e.durationMs,detail:{phase:e.phase,error:String(e.error)}})}function N0e(e,t){Qr()&&ca({source:"ws",kind:"ws:lifecycle",eventType:e,label:`ws ${e}`,detail:pu(t)})}function F0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=t.payload,s=typeof o?.session_id=="string"?o.session_id:void 0;ca({source:"ws",kind:"ws:out",eventType:n,sessionId:s,label:`→ ${n}`,detail:pu(e)})}function R0e(e){if(!Qr())return;const t=e??{},n=typeof t.type=="string"?t.type:"(unknown)",o=typeof t.session_id=="string"?t.session_id:typeof t.payload?.session_id=="string"?t.payload.session_id:void 0,s=typeof t.seq=="number"?t.seq:void 0,i=typeof t.offset=="number"?t.offset:void 0,r=[o,s!==void 0?`seq=${s}`:void 0,i!==void 0?`offset=${i}`:void 0,t.volatile===!0?"volatile":void 0].filter(Boolean);ca({source:"ws",kind:"ws:in",eventType:n,sessionId:o,seq:s,offset:i,label:`← ${n}${r.length>0?` (${r.join(" ")})`:""}`,detail:pu(t.payload)})}const O0e={error:"✕",warn:"⚠",info:"ℹ",debug:"·",log:"·"};function P0e(e,t,n){Qr()&&ca({source:"client",kind:`client:${e}`,label:`${O0e[e]} ${t}`,detail:pu(n)})}function D0e(e,t){Qr()&&ca({source:"client",kind:"client:event",label:`· ${e}`,detail:pu(t)})}function bi(e,t){E0e(e,t),ca({source:"client",kind:"client:key",label:e,sessionId:typeof t?.sessionId=="string"?t.sessionId:void 0,seq:typeof t?.seq=="number"?t.seq:void 0,durationMs:typeof t?.durationMs=="number"?t.durationMs:void 0,detail:t})}let g4=!1,Eh=null;function B0e(){if(g4)return()=>Eh?.();g4=!0;const e=[];try{if(typeof window<"u"){const n=s=>{bi("window:error",{status:"failed",errorName:s.error instanceof Error?s.error.name:"Error",line:s.lineno,col:s.colno}),Xl(`[kimi-web] window error: ${s.message}`,s.error instanceof Error?s.error.stack:void 0)},o=s=>{const i=s.reason;bi("window:unhandled-rejection",{status:"failed",errorName:i instanceof Error?i.name:typeof i}),Xl(`[kimi-web] unhandled rejection: ${z0e(i)}`,i instanceof Error?i.stack:void 0)};window.addEventListener("error",n),window.addEventListener("unhandledrejection",o),e.push(()=>{window.removeEventListener("error",n)}),e.push(()=>{window.removeEventListener("unhandledrejection",o)})}}catch{}if(Qr())for(const n of["error","warn","log","info","debug"]){const o=console[n];if(typeof o!="function")continue;const s=(...i)=>{try{P0e(n,i.map(H0e).join(" "),i.length>1?i:i[0])}catch{}o.apply(console,i)};console[n]=s,e.push(()=>{console[n]===s&&(console[n]=o)})}const t=()=>{if(Eh===t){for(const n of e.toReversed())n();Eh=null,g4=!1}};return Eh=t,t}function H0e(e){if(typeof e=="string")return e;if(e instanceof Error)return`${e.name}: ${e.message}`;try{return JSON.stringify(e)}catch{return String(e)}}function z0e(e){if(e instanceof Error)return e.message;try{return String(e)}catch{return"[unstringifiable reason]"}}function G$(e=Ka){if(typeof document>"u")return;const t=new Blob([W0e(e)],{type:"application/x-ndjson"}),n=URL.createObjectURL(t);let o;try{o=document.createElement("a"),o.href=n,o.download=`kimi-web-log-${new Date().toISOString().replaceAll(/[:.]/g,"-")}.jsonl`,document.body.append(o),o.click()}finally{o?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(n)}catch{}},0)}}function W0e(e=Ka){return e===Ka?Ed.join(` `):e.map(t=>JSON.stringify(t)).join(` `)}function U0e(){return Yu.join(` -`)}const Mx=cn.clientId,j0e="kimi-code-web",V0e="web";function q0e(){return{serverHttpUrl:Z0e(),clientId:Y0e(),clientName:j0e,clientVersion:X0e(),clientUiMode:V0e}}function K0e(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function Z0e(){const e=Y$();return h8(e||void 0)}const Tx="kimi-desktop-server-origin";function Y$(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("kimi_origin");try{return e?(window.sessionStorage.setItem(Tx,e),e):window.sessionStorage.getItem(Tx)??void 0}catch{return e??void 0}}function h8(e){const t=e&&e.trim()?e:K0e(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function Ex(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function G0e(){if(typeof window<"u"){const t=Y$();if(t)return Ex(h8(t))}const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return Ex(e)}function Y0e(){const e=ui(Mx);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return Ls(Mx,t),t}function X0e(){return"0.33.0".trim()?"0.33.0":"0.0.0-dev"}const J0e={restRequest:e=>I0e(e),restResponse:e=>L0e(e),restFailure:e=>$0e(e),wsEvent:e=>{switch(e.kind){case"lifecycle":N0e(e.event,e.detail);break;case"in":R0e(e.frame);break;case"out":F0e(e.frame);break}},traceKeyEvent:(e,t)=>bi(e,t)},Q0e={getToken:eQ,markAuthRequired:sQ},ehe=(e,t)=>t===void 0?Hn.global.t(e):Hn.global.t(e,t);function the(){const e=q0e();return eY({origin:e.serverHttpUrl,identity:{clientId:e.clientId,clientName:e.clientName,clientVersion:e.clientVersion,clientUiMode:e.clientUiMode},tracer:J0e,credentialStore:Q0e,t:ehe})}const nhe=the();function _t(){return nhe}function ohe(e,t,n){return e==="idle"&&!t&&!n}function X$(e,t){const n=ui(e);return n===null?t:n==="1"}const Cg=Z(X$(cn.notifyEnabled,!0)),L5=Z(X$(cn.notifySound,!0)),$5=Z(typeof Notification<"u"?Notification.permission:"denied"),she="/favicon.ico";async function ihe(e){if(!e){Cg.value=!1,Ls(cn.notifyEnabled,"0");return}if(typeof Notification>"u")return;let t=Notification.permission;if(t==="default")try{t=await Notification.requestPermission()}catch{}$5.value=t,t==="granted"&&(Cg.value=!0,Ls(cn.notifyEnabled,"1"))}function rhe(e){L5.value=e,Ls(cn.notifySound,e?"1":"0")}function N5(...e){for(const t of e){const n=t?.trim();if(n)return n}return""}function lhe(e){return{title:Hn.global.t("settings.notifyTitle"),body:N5(e,Hn.global.t("settings.notifyFallback"))}}function ahe(e,t){return{title:Hn.global.t("settings.notifyQuestionTitle"),body:N5(t,e,Hn.global.t("settings.notifyQuestionFallback"))}}function uhe(e,t){return{title:Hn.global.t("settings.notifyApprovalTitle"),body:N5(t,e,Hn.global.t("settings.notifyApprovalFallback"))}}function F5(e,t,n){if(!Cg.value||typeof Notification>"u")return;const o=Notification.permission;if(o!=="denied"){if(o==="default"){Notification.requestPermission().then(s=>{$5.value=s,s==="granted"&&Ix(e,t,n)});return}Ix(e,t,n)}}function Ix(e,t,n){if(!e.isUserWatching)try{const o=new Notification(t.title,{body:t.body,tag:n,icon:she,silent:!L5.value});o.onclick=()=>{try{window.kimiDesktop?.showWindow?.(),window.focus()}catch{}e.onClick(),o.close()}}catch{}}function che(e,t){F5(t,lhe(t.sessionTitle),`kimi-complete-${e}-${t.promptId??Date.now()}`)}function dhe(e){F5(e,ahe(e.sessionTitle,e.questionPreview),`kimi-question-${e.questionId}`)}function fhe(e){F5(e,uhe(e.sessionTitle,e.toolName),`kimi-approval-${e.approvalId}`)}function phe(){return{notifyEnabled:Cg,notifySound:L5,notifyPermission:$5,setNotifyEnabled:ihe,setNotifySound:rhe,maybeNotifyCompletion:che,maybeNotifyQuestion:dhe,maybeNotifyApproval:fhe}}const hhe=1e3,mhe=4096,Lx=32*1024;function ghe(e,t){let n=null,o;const s=new Set;async function i(f){try{const m=await _t().listTasks(f);e.tasksBySession={...e.tasksBySession,[f]:nC(m,e.tasksBySession[f]??[])},await r(f,m)}catch{}}async function r(f,h){if(e.activeSessionId!==f)return;const m=h??e.tasksBySession[f]??[],v=_t(),k=new Map;if(await Promise.all(m.map(async b=>{if((b.status==="completed"||b.status==="failed"||b.status==="cancelled")&&!s.has(b.id)&&!((b.outputLines?.length??0)>0))try{const g=await v.getTask(f,b.id,{withOutput:!0,outputBytes:Lx});g.outputPreview!==void 0&&k.set(b.id,{preview:g.outputPreview,bytes:g.outputBytes}),s.add(b.id)}catch{}})),k.size===0)return;const w=e.tasksBySession[f]??[];e.tasksBySession={...e.tasksBySession,[f]:w.map(b=>{const _=k.get(b.id)??(b.backgroundTaskId!==void 0?k.get(b.backgroundTaskId):void 0);return _?{...b,outputPreview:_.preview,outputBytes:_.bytes}:b})}}async function l(f){if(e.activeSessionId!==f)return;const h=_t();let m;try{m=await h.listTasks(f)}catch{return}const v=new Map;await Promise.all(m.map(async _=>{const g=_.status==="running",x=_.status==="completed"||_.status==="failed"||_.status==="cancelled";if(!(!g&&!x)&&!(x&&(s.has(_.id)||(_.outputLines?.length??0)>0)))try{const S=await h.getTask(f,_.id,{withOutput:!0,outputBytes:g?mhe:Lx});S.outputPreview!==void 0&&v.set(_.id,{preview:S.outputPreview,bytes:S.outputBytes}),x&&s.add(_.id)}catch{}}));const k=e.tasksBySession[f]??[],w=new Map(k.map(_=>[_.id,_])),b=m.map(_=>{const g=w.get(_.id),x=v.get(_.id);return{..._,outputLines:g?.outputLines,text:g?.text,outputPreview:x?.preview??g?.outputPreview,outputBytes:x?.bytes??g?.outputBytes}});e.tasksBySession={...e.tasksBySession,[f]:nC(b,k)}}function a(f){n!==null&&o===f||(u(),o=f,l(f),n=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||(e.activeSessionId===f?l(f):u())},hhe))}function u(){n!==null&&(clearInterval(n),n=null),o=void 0,s.clear()}const c=Z(0);let d=null;return Je(()=>t.value.some(f=>f.status==="running"),f=>{f&&d===null?d=setInterval(()=>{c.value=(c.value+1)%Number.MAX_SAFE_INTEGER},1e3):!f&&d!==null&&(clearInterval(d),d=null)},{immediate:!0}),Je(()=>{const f=e.activeSessionId;if(!f)return{sid:void 0,hasRunning:!1};const h=e.tasksBySession[f]??[];return{sid:f,hasRunning:h.some(m=>m.status==="running")}},({sid:f,hasRunning:h},m,v)=>{let k;h&&f!==void 0?a(f):f!==void 0?k=setTimeout(()=>{(e.tasksBySession[f]??[]).some(b=>b.status==="running")||u()},1500):u(),v(()=>{k!==void 0&&clearTimeout(k)})},{deep:!0,immediate:!0}),{taskClock:R(()=>c.value),loadTasksForSession:i}}function m8(e){const t=[];for(const n of e??[])n.kind==="video"?t.push({type:"video",source:{kind:"file",fileId:n.fileId}}):n.kind==="file"?t.push({type:"file",fileId:n.fileId,name:n.name??"",mediaType:n.mediaType||"application/octet-stream",size:n.size??0}):t.push({type:"image",source:{kind:"file",fileId:n.fileId}});return t}const vhe=640,yhe=`(max-width: ${vhe}px)`;function khe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(yhe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),bn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),bn(()=>t.removeListener(n))),e}const J$=Z(typeof window>"u"?0:window.innerWidth);let Ih=0,wg=!1;function g8(){J$.value=window.innerWidth}function bhe(){wg||typeof window>"u"||(window.addEventListener("resize",g8),wg=!0,g8())}function Che(){!wg||typeof window>"u"||(window.removeEventListener("resize",g8),wg=!1)}function Q$(e,t,n){return Math.max(t,e-n)}function v8(e,t,n){return Math.min(n,Math.max(t,e))}function eN(){return dn(()=>{Ih+=1,bhe()}),Vn(()=>{Ih=Math.max(0,Ih-1),Ih===0&&Che()}),{viewportWidth:J$}}const whe=24;function _he(e){const t=Z(null),n=Z(!0);let o=null,s=null,i=null,r=0,l=0,a=!1,u=0;function c(){const k=t.value;k&&(k.scrollTop=Math.max(k.scrollTop,r))}function d(){const w=t.value?.firstElementChild??null;w!==i&&(i&&o?.unobserve(i),i=w,w&&o?.observe(w))}function f(){const k=t.value;!k||a||(n.value=r-k.scrollTop-lh(k));return}requestAnimationFrame(()=>{requestAnimationFrame(()=>h(k))})}function v(){const k=t.value;k&&(o?.disconnect(),s?.disconnect(),i=null,a=!1,u++,r=0,l=0,typeof ResizeObserver=="function"?(o=new ResizeObserver(()=>{const w=t.value;if(!w)return;const{scrollHeight:b,clientHeight:_}=w,g=b>r+1,x=_{n.value=!0,yt(v)}),Je(t,()=>void yt(v)),dn(()=>void yt(v)),bn(()=>{u++,o?.disconnect(),s?.disconnect()}),{scroller:t,following:n,onScroll:f,pinScroll:m}}function xhe(e){try{const t=ui(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function $x(e,t){try{Ls(e,String(t))}catch{}}function She(e){const{storageKey:t,defaultWidth:n,min:o,max:s,reverse:i=!1,axis:r="x",applyLive:l}=e;function a(D){return Number.isFinite(D)?Math.min(Rh(s),Math.max(o,Math.round(D))):n}const u=Z(a(xhe(t)??n)),c=Z(!1);function d(D){const I=D<=o,$=D>=Rh(s),B=r==="x"?"col-resize":"row-resize";if(I&&$)return B;const[H,O]=r==="x"?["e-resize","w-resize"]:["s-resize","n-resize"];return $?i?H:O:I?i?O:H:B}const f=Z(null),h=R(()=>d(f.value??u.value));function m(D){typeof document>"u"||(document.body.style.cursor=d(D))}function v(D){const I=a(D);u.value=I,$x(t,I)}Je(()=>Rh(s),D=>{!c.value&&u.value>D&&v(D)});let k=0,w=0,b=null,_=-1,g=0,x=0,S=0;function T(){if(x=0,!c.value)return;const D=g-k;S=a(w+(i?-D:D)),f.value=S,m(S),l?l(S):u.value=S}function A(D){if(c.value&&(g=r==="x"?D.clientX:D.clientY,x===0)){if(typeof requestAnimationFrame!="function"){T();return}x=requestAnimationFrame(T)}}function E(){if(c.value){if(x!==0&&(cancelAnimationFrame(x),T()),c.value=!1,l?v(S):$x(t,u.value),f.value=null,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),b){try{b.releasePointerCapture(_)}catch{}b.removeEventListener("pointermove",A),b.removeEventListener("pointerup",E),b.removeEventListener("pointercancel",E)}b=null,_=-1}}function P(D){D.preventDefault(),c.value=!0,k=r==="x"?D.clientX:D.clientY,w=a(u.value),S=w,b=D.currentTarget,_=D.pointerId,typeof document<"u"&&(document.body.style.userSelect="none"),m(w);try{b.setPointerCapture(_)}catch{}b.addEventListener("pointermove",A),b.addEventListener("pointerup",E),b.addEventListener("pointercancel",E)}return Vn(E),{width:u,dragging:c,cursor:h,clamp:a,setWidth:v,onPointerDown:P}}const Hr=Z(null),Zd=Z(!1),Ahe=R(()=>Hr.value!==null);function R5(e){const t=Hr.value;!t||Zd.value||(Hr.value=null,t.resolve(e))}async function Mhe(){const e=Hr.value;if(!(!e||Zd.value)){if(!e.action){R5(!0);return}Zd.value=!0;try{await e.action(),Hr.value===e&&(Hr.value=null),e.resolve(!0)}catch(t){Hr.value===e&&(Hr.value=null),e.reject(t)}finally{Zd.value=!1}}}function The(e){return Zd.value?Promise.resolve(!1):(Hr.value&&R5(!1),new Promise((t,n)=>{Hr.value={...e,resolve:t,reject:n}}))}function hu(){return{current:Hr,busy:Zd,isConfirmOpen:Ahe,confirm:The,settle:R5,runAction:Mhe}}function Ehe(e){const{sessionId:t}=e;function n(u){return ui(eC(u))??""}function o(u,c){const d=eC(u);c?Ls(d,c):ur(d)}const s=Z(n(t())),i=Z(null);function r(){const u=i.value;u&&(u.style.height="auto",u.style.height=`${u.scrollHeight}px`)}Je(s,u=>{yt(r),o(t(),u)}),Je(t,(u,c)=>{u!==c&&(o(c,s.value),s.value=n(u),yt(r))});function l(u){s.value=u,yt(()=>{const c=i.value;if(!c)return;c.focus();const d=u.length;c.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function Ihe(e){return e?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0:!1}function Lhe(e){const{sessionId:t,mobile:n,starting:o,dockedComposer:s,emptyComposer:i}=e,r=Z(!1);Je(t,()=>{n()||(r.value=!0)}),Je([r,s,i,o],()=>{if(!r.value)return;const l=s.value??i.value;if(!l)return;const a=typeof document<"u"?document.activeElement:null;if(Ihe(a)){r.value=!1;return}l.focus(),(typeof document>"u"||document.activeElement!==a)&&(r.value=!1)},{flush:"post"})}const _g=100;function $he(e){const t=y1(cn.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>_g?n.slice(-_g):n,s={[e]:o};return Tc(cn.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function Nhe(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=Z($he(s())),r=R(()=>i.value[s()??""]??[]);let l=-1,a="";function u(w){const b=s();if(l=-1,!b)return;const _=w.trim();if(!_)return;const g=i.value[b]??[];if(g.at(-1)===_)return;const x=[...g,_],S=x.length>_g?x.slice(-_g):x;i.value={...i.value,[b]:S},Tc(cn.inputHistory,i.value)}function c(){const w=n.value;return w?(w.selectionStart??0)===0:!1}function d(w){t.value=w,yt(()=>{const b=n.value;if(!b)return;o();const _=w.length;b.setSelectionRange(_,_)})}function f(){const w=r.value;if(w.length!==0){if(l===-1)a=t.value,l=w.length-1;else if(l>0)l-=1;else return;d(w[l])}}function h(){if(l===-1)return;const w=r.value;l0}return Je(s,()=>{l=-1}),{push:u,caretAtTextStart:c,recallOlder:f,recallNewer:h,resetBrowsing:m,isBrowsing:v,hasHistory:k}}function Fhe(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),u=Z([]),c=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(u.value=mQ(h,CE(s())),c.value=0,a.value=u.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const m=n.value;if(!m)return;const v=t.value.length;m.setSelectionRange(v,v),m.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:u,active:c,update:d,select:f}}function Rhe(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let u=null;function c(){const h=t.value,m=n.value?.selectionStart??h.length;let v=m-1;for(;v>=0&&!/\s/.test(h[v]);)v--;v++;const k=h.slice(v,m);return k.startsWith("@")?{token:k.slice(1),start:v,end:m}:null}function d(){const h=c(),m=s();if(u!==null&&clearTimeout(u),!h||!m||h.token.length===0){i.value=!1,a.value=!1;return}const v=h.token;u=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;const k=()=>{const w=c();return w!==null&&w.token===v&&i.value};try{const w=await m(v);k()&&(r.value=w)}catch{k()&&(r.value=[])}finally{k()&&(a.value=!1)}},200)}function f(h){const m=c();if(!m)return;const v=t.value;t.value=v.slice(0,m.start)+h.path+v.slice(m.end),i.value=!1,yt(()=>{const k=n.value;if(!k)return;const w=m.start+h.path.length;k.setSelectionRange(w,w),k.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}const Ohe="kimi-web.file-preview-width",gd=320;function Phe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=eN(),i=R(()=>Math.max(0,s.value-t.value)),r=R(()=>Q$(i.value,gd,gd));function l(Y){return v8(Math.round(Y),gd,r.value)}function a(){return l(i.value/2)}const u=R(()=>a()),c=Z(u.value),d=R(()=>v8(c.value,gd,r.value)),f=Z(null),h=R(()=>{const Y=f.value;if(!Y)return null;const fe=e.turns.value.find(we=>we.id===Y.turnId);return fe?.role==="compaction"&&fe.text?fe.text:null}),m=R(()=>h.value!==null);function v(Y){if(f.value?.turnId===Y.turnId){f.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",f.value=Y}function k(){f.value=null,n.value==="compaction"&&(n.value=null)}const w=Z(null),b=R(()=>{const Y=w.value;if(!Y)return{entry:void 0,version:0};const fe=e.auxiliaryTranscripts.getEntry(Y.sessionId,Y.subagentId);return{entry:fe,version:fe?.version.value??0}});function _(Y){const fe=e.turns.value.flatMap(we=>we.tools??[]).find(we=>we.agentId===Y);if(!fe)return{};try{const we=JSON.parse(fe.arg);return{name:typeof we.description=="string"?we.description:void 0,subagentType:typeof we.subagent_type=="string"?we.subagent_type:void 0,status:fe.status,outputLines:fe.output}}catch{return{}}}const g=R(()=>{const Y=w.value;if(!Y)return null;const fe=e.activeAppTasks.value.find(Fe=>Fe.agentId===Y.subagentId||Fe.id===Y.subagentId);if(fe)return UY(fe);const we=b.value.entry?.channel,ge=we?.agents.find(Fe=>Fe.agentId===Y.subagentId),Q=we?.refreshError??!1,te=we===void 0||we.loading,ce=we?.snapshot.meta.activity==="turn",ue=_(Y.subagentId),Se=we?.snapshot.items.findLast(Fe=>Fe.kind==="turn"),ze=Se?.kind==="turn"&&Se.state==="cancelled",_e=Se?.kind==="turn"&&Se.state==="failed"||ue.status==="error",Ee=ce?"working":_e||ze?"failed":te?"queued":Q&&ue.status===void 0?"failed":"completed",it=ce?"running":ze?"cancelled":_e?"failed":te?"running":Q&&ue.status===void 0?"failed":"completed";return{id:Y.subagentId,name:ge?.label??ue.name??Y.subagentId,subagentType:ue.subagentType??(ge?.type==="sub"?"subagent":ge?.type),phase:Ee,status:it,outputLines:ue.outputLines}}),x=R(()=>{const Y=b.value.entry;if(!Y)return[];const fe=w.value,we=Y.channel.agents.find(ge=>ge.agentId===fe?.subagentId);return nX(Y.channel.snapshot,e.getFileUrl,we)}),S=R(()=>b.value.entry?.channel.loading??!1),T=R(()=>b.value.entry?.channel.refreshError??!1),A=R(()=>b.value.entry?.channel.loadingOlder??!1),E=R(()=>b.value.entry?.channel.loadOlderError??!1),P=R(()=>b.value.entry?.channel.snapshot.hasMoreOlder??!1),D=R(()=>b.value.entry?.channel.snapshot.meta.activity==="turn"),I=R(()=>g.value!==null);function $(Y){const fe=e.activeSessionId.value;if(!(!Y||!fe)){if(n.value==="agent"&&w.value?.sessionId===fe&&w.value.subagentId===Y){B();return}w.value={sessionId:fe,subagentId:Y},n.value="agent",e.auxiliaryTranscripts.activate(fe,Y)}}function B(){const Y=w.value;Y&&e.auxiliaryTranscripts.deactivate(Y.sessionId,Y.subagentId),w.value=null,n.value==="agent"&&(n.value=null)}Je(n,(Y,fe)=>{if(fe!=="agent"||Y==="agent")return;const we=w.value;we&&e.auxiliaryTranscripts.deactivate(we.sessionId,we.subagentId)});function H(){const Y=b.value.entry;Y&&Y.channel.loadOlder().catch(()=>{})}const O=Z("list"),F=Z(null);function U(){if(n.value==="diff"){z();return}n.value="diff",O.value="list",F.value=null,e.loadGitStatus(e.activeSessionId.value)}function z(){n.value==="diff"&&(n.value=null),O.value="list",F.value=null,e.clearFileDiff()}async function W(Y){O.value="detail",F.value=Y,await e.loadFileDiff(Y)}const K=Xr(null);function V(Y){if(K.value===Y&&n.value==="turn-diff"){ie();return}K.value=Y,n.value="turn-diff"}function ie(){K.value=null,n.value==="turn-diff"&&(n.value=null)}async function ne(Y){if(!e.activeSessionId.value&&e.activeWorkspaceId.value){const fe=await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,Y);return n.value="btw",fe}return await e.openSideChat(Y),n.value="btw",null}function X(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function le(){n.value==="btw"&&(n.value=null)}const Ie=R(()=>e.sideChatVisible.value),de=R(()=>n.value!==null&&(n.value!=="compaction"||m.value)&&(n.value!=="agent"||I.value)&&(n.value!=="btw"||Ie.value)),pe=Z(!1),ve=Z({});function oe(){switch(n.value){case"compaction":return f.value?{kind:"compaction",...f.value}:null;case"agent":return w.value?{kind:"agent",...w.value}:null;case"btw":return{kind:"btw"};default:return null}}function ye(Y){if(Y)switch(Y.kind){case"compaction":f.value={turnId:Y.turnId},n.value="compaction";break;case"agent":e.activeSessionId.value&&(w.value={sessionId:e.activeSessionId.value,subagentId:Y.subagentId},n.value="agent",e.auxiliaryTranscripts.activate(e.activeSessionId.value,Y.subagentId));break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="compaction"&&m.value?(k(),!0):n.value==="agent"&&I.value?(B(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(z(),!0):n.value==="turn-diff"?(ie(),!0):n.value==="btw"?(X(),!0):!1}return Je(e.activeSessionId,(Y,fe)=>{if(fe){const we=oe();we?ve.value[fe]=we:delete ve.value[fe]}o(),k(),B(),z(),ie(),le(),Y&&ye(ve.value[Y])}),{PREVIEW_WIDTH_KEY:Ohe,PREVIEW_MIN:gd,previewDefaultWidth:u,previewMax:r,previewWidth:c,previewPanelWidth:d,compactionPanelText:h,compactionPanelVisible:m,openCompactionPanel:v,closeCompactionPanel:k,agentPanelMember:g,agentPanelTurns:x,agentPanelLoading:S,agentPanelLoadError:T,agentPanelLoadingMore:A,agentPanelLoadMoreError:E,agentPanelHasMore:P,agentPanelRunning:D,agentPanelVisible:I,openAgentPanel:$,closeAgentPanel:B,loadOlderAgentMessages:H,detailDiffMode:O,detailDiffPath:F,openDiffDetail:U,closeDiffDetail:z,selectDiffFile:W,turnDiffChange:K,openTurnDiff:V,closeTurnDiff:ie,btwVisible:Ie,openSideChatTab:ne,closeSideChat:X,hideSideChatPanel:le,sidePanelVisible:de,panelDragging:pe,closeOpenSidePanel:G}}const Dhe=cn.sidebarWidth,Nx=cn.sidebarCollapsed,Fx=270,v4=220,Bhe=480,Hhe=320;function zhe(e={}){const{viewportWidth:t}=eN(),n=Z(Fx),o=Z(!1),s=Z(!1),i=R(()=>{const c=Hhe+(Rh(e.previewOpen)?gd:0);return Math.min(Bhe,Q$(t.value,v4,c))}),r=R(()=>v8(n.value,v4,i.value));function l(){try{o.value=ui(Nx)==="true"}catch{o.value=!1}}function a(){try{Ls(Nx,String(o.value))}catch{}}function u(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:Dhe,SIDEBAR_DEFAULT:Fx,SIDEBAR_MIN:v4,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:u}}const Whe=40409;function Rx(e){return Us(e)&&e.code===Whe}function Ox(e){return e.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function Px(e){if(e.startsWith("\\\\"))return e;const t=/^[a-zA-Z]:/.test(e)?e.slice(0,2):"",n=[];for(const o of e.slice(t.length).split(/[\\/]+/))if(!(!o||o===".")){if(o===".."){n.pop();continue}n.push(o)}return t?`${t}/${n.join("/")}`:`/${n.join("/")}`}function Uhe({client:e,detailTarget:t,t:n}){const o=Z(null),s=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0;const u=R(()=>{const g=l.value;return g?e.getFileDownloadUrl(g):null}),c=R(()=>o.value!==null&&l.value!==null);function d(g){return g.length>1?g.replace(/\/+$/,""):g}function f(g){const x=h2(g,e.status.value.cwd);return x===null||x.split(/[\\/]+/).includes("..")?null:h(x)||null}function h(g){const x=[];for(const S of g.split(/[\\/]+/))if(!(!S||S===".")){if(S===".."){x.pop();continue}x.push(S)}return x.join("/")}function m(g){const x=g.trim();if(!x)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(x))return{error:n("filePreview.errors.unsupportedPath")};if(x.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const S=d(e.status.value.cwd);if(x.startsWith("/")){if(!S||x!==S&&!x.startsWith(`${S}/`))return{error:n("filePreview.errors.outsideWorkspace")};const A=x===S?"":x.slice(S.length+1);if(A.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const E=h(A);return E?{path:E}:{error:n("filePreview.errors.isDirectory")}}if(x.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const T=h(x);return T?{path:T}:{error:n("filePreview.errors.emptyPath")}}async function v(g){const x=o.value;if(t.value==="file"&&x&&x.path===g.path&&x.line===g.line){w();return}const S=++a;if(t.value="file",s.value=null,r.value=null,i.value=!0,o.value=g,l.value=null,typeof g.content=="string"){i.value=!1,s.value={path:g.path,content:g.content,encoding:"utf-8",mime:"text/markdown",isBinary:!1,size:g.content.length};return}if(!Ox(g.path)&&g.path.split(/[\\/]+/).includes("..")){const A=d(e.status.value.cwd);A&&(g={...g,path:Px(`${A}/${g.path}`)})}if(Ox(g.path)){g={...g,path:Px(g.path)};const A=f(g.path);if(A!==null)g={...g,path:A};else{try{const E=await e.readHostFileContent(g.path);if(S!==a)return;l.value=null,s.value={path:g.path,content:E.content,encoding:E.encoding,mime:E.mime,isBinary:E.isBinary,size:E.size}}catch(E){if(S!==a)return;r.value=Rx(E)?n("filePreview.errors.notFound"):pU(E)?n("filePreview.errors.tooLarge"):E instanceof Error?E.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}return}}const T=m(g.path);if("error"in T){i.value=!1,r.value=T.error;return}l.value=T.path;try{const A=await e.readFileContent(T.path);if(S!==a)return;A?s.value={...A,path:A.path||T.path}:r.value=n("filePreview.errors.loadFailed")}catch(A){if(S!==a)return;r.value=Rx(A)?n("filePreview.errors.notFound"):A instanceof Error?A.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}}function k(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1}function w(){k(),t.value==="file"&&(t.value=null)}Je(t,(g,x)=>{x==="file"&&g!=="file"&&k()});function b(){const g=s.value?.path??o.value?.path;g&&e.openWorkspaceFile(g,o.value?.line)}function _(){const g=s.value?.path??o.value?.path;g&&e.revealWorkspaceFile(g)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:u,previewExternalActions:c,openFilePreview:v,closeFilePreview:w,openPreviewInEditor:b,revealPreviewFile:_}}function jhe({running:e,title:t="Kimi Code"}){if(Wp){I4(()=>{typeof document<"u"&&(document.title=t)});return}const n=["◐","◓","◑","◒"],o=Z(0);let s=null;function i(){s===null&&(o.value=0,s=setInterval(()=>{o.value=(o.value+1)%n.length},250))}function r(){s!==null&&(clearInterval(s),s=null),o.value=0}Je(e,a=>{a?i():r()},{immediate:!0});const l=R(()=>`${e.value?`${n[o.value]} `:""}${t}`);I4(()=>{typeof document<"u"&&(document.title=l.value)}),bn(()=>{r()})}const Vhe=50,am=5,O5=5,xg=50,qhe=40401,Khe=40402,Zhe=40410,Ghe=40409,Yhe=40902,Xhe=2e3,Jhe=10;function y4(e){return Us(e)&&e.code===Yhe}const Qhe=40904;function eme(e){return Us(e)&&e.code===Qhe}const Hu=Go({}),Lh=Go({}),k4=Go({}),cl=Go(new Set),N2=new Map,wc=new Map,Sg=new Map;let tme=0;const ju=new Map,nme=3;let Dx=0;function ome(){return Dx+=1,`${Date.now().toString(36)}-${Dx}`}function sme(e){return{generation:N2.get(e)??0,pending:(wc.get(e)?.size??0)>0}}function y8(e){const t=++tme;N2.set(e,t);const n=wc.get(e)??new Set;return n.add(t),wc.set(e,n),t}function k8(e,t){const n=wc.get(e);if(n===void 0||(n.delete(t),n.size>0))return;wc.delete(e);const o=Sg.get(e);Sg.delete(e),o?.()}function ime(e){N2.delete(e),wc.delete(e),Sg.delete(e),ju.delete(e)}function rme(e,t){return!t.pending&&t.generation===(N2.get(e)??0)}function lme(e,t){if((wc.get(e)?.size??0)===0){t();return}Sg.set(e,t)}function ame(e,t){const{t:n}=Hn.global,{confirm:o}=hu(),{taskPoller:s,sideChat:i,modelProvider:r,pushOperationFailure:l,activity:a,sessionsKnownEmpty:u,setSessions:c,updateSession:d,upsertSessionFront:f,appendSession:h,forgetSession:m,unpinSessions:v,setActiveSessionId:k,updateSessionMessages:w,nextOptimisticMsgId:b,getEventConn:_,syncSessionFromSnapshot:g,reopenSession:x,hasLoadedMessages:S,refreshSessionStatus:T,refreshSessionGoal:A,refreshSessionPlans:E,persistSessionProfile:P,mergedWorkspaces:D,workspacesView:I,status:$,workspaceIdForSession:B,savePermissionToStorage:H,savePlanModeToStorage:O,saveSwarmModeToStorage:F,saveGoalModeToStorage:U,draftModes:z,saveUnread:W,saveActiveWorkspaceToStorage:K,saveHiddenWorkspacesToStorage:V,goalErrorMessage:ie,initialized:ne,connectIssue:X,selectedDiffPath:le,fileDiffLines:Ie,fileDiffLoading:de,fileDiffTexts:pe,fileDiffEmptyFile:ve}=t;let oe=!1,ye=0;function G(se,xe,J,Ce){w(se,$e=>{const He=$e.findIndex(Et=>Et.id===xe);if(He===-1)return $e;const vt=$e.findIndex((Et,ln)=>ln!==He&&Et.role==="user"&&(Et.id===Ce||Et.userMessageId===Ce||Et.promptId===J)),ut=$e[He],Dt=vt===-1?ut:$e[vt];return $e.flatMap((Et,ln)=>ln===vt?[]:ln!==He?[Et]:[{...Dt,id:ut.id,promptId:J,userMessageId:Ce,metadata:{...Dt.metadata,...ut.metadata}}])})}async function Y(se){if(e.messagesLoadingMoreBySession[se])return;const xe=e.messagesBySession[se];if(!xe||xe.length===0)return;const J=xe[0].id;e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!0},e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!1};try{const Ce=await _t().listMessages(se,{beforeId:J,pageSize:Vhe}),$e=[...Ce.items].reverse();w(se,He=>[...$e,...He]),e.messagesHasMoreBySession={...e.messagesHasMoreBySession,[se]:Ce.hasMore}}catch(Ce){e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!0},l("loadOlderMessages",Ce,{sessionId:se})}finally{e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!1}}}function fe(se,xe){s.loadTasksForSession(se),Q(se),xe?.skipStatus!==!0&&T(se),A(se),E(se),Object.prototype.hasOwnProperty.call(r.skillsBySession.value,se)||r.loadSkillsForSession(se)}async function we(se){const xe=e.activeSessionId;if(xe){le.value=se,Ie.value=[],pe.value=null,ve.value=!1,de.value=!0;try{const Ce=await _t().getFileDiff(xe,se);if(le.value!==se||e.activeSessionId!==xe)return;const $e=wX(Ce.diff);if(Ie.value=$e,$e.length===0){const vt=await Ei(se).catch(()=>null);if(le.value!==se||e.activeSessionId!==xe)return;ve.value=vt!==null&&vt.size===0;return}de.value=!1;const He=await cX($e,{truncated:Ce.truncated,readNewText:async()=>{const vt=await Ei(se).catch(()=>null);return!vt||vt.isBinary||vt.encoding!=="utf-8"?null:vt.content}});if(le.value!==se||e.activeSessionId!==xe)return;pe.value=He}catch(J){le.value===se&&(Ie.value=[]),gl("[loadFileDiff] diff unavailable for",se,J)}finally{le.value===se&&(de.value=!1)}}}function ge(){le.value=null,Ie.value=[],pe.value=null,ve.value=!1,de.value=!1}async function Q(se){try{const J=await _t().getGitStatus(se);e.gitStatusBySession={...e.gitStatusBySession,[se]:J}}catch{}}let te=0;async function ce(se){try{const xe=await _t().getUserInfo();if(se!==te||e.managedProviderStatus!=="authenticated")return;e.managedUserInfo=xe.kind==="ok"?xe.userInfo:null,xe.kind==="ok"?e.managedMembership=xe.userInfo.userLevel===Jhe?"free":"member":e.managedMembership=xe.status===402?"free":null}catch{if(se!==te)return;e.managedProviderStatus==="authenticated"&&(e.managedUserInfo=null,e.managedMembership=null)}}async function ue(){e.managedProviderStatus==="authenticated"&&await ce(++te)}async function Se(){const se=++te;try{const J=await _t().getAuth();return e.authReady=J.ready,e.defaultModel=J.defaultModel,e.managedProviderStatus=J.managedProvider?.status??null,e.managedProviderStatus==="authenticated"?ce(se):(e.managedUserInfo=null,e.managedMembership=null),X.value=null,"proceed"}catch(xe){return Us(xe)&&(xe.code===401||xe.code===PM)?(X.value=null,"server-auth-required"):(X.value=(xe instanceof Error?xe.message:String(xe)).slice(0,140),"retry")}}async function ze(){let se=!0;for(;;){const xe=await Se();if(xe!=="retry")return xe;se&&(X.value=null,se=!1),await new Promise(J=>{setTimeout(J,Xhe)})}}async function _e(){try{const se=_t();e.config=await se.getConfig()}catch{}}async function Ee(se){try{const J=await _t().setConfig(se);return e.config=J,e.defaultModel=J.defaultModel??null,!0}catch(xe){return l("setConfig",xe),!1}}const it=100,Fe=720*60*1e3;async function Oe(se){const xe=_t(),J=[];let Ce,$e;for(;se?.shouldContinue?.()!==!1;){let He;try{He=await xe.listSessions({pageSize:it,beforeId:Ce,excludeEmpty:!0})}catch(vt){if(J.length===0)throw vt;$e=vt;break}if(J.push(...He.items),!He.hasMore||He.items.length===0)break;Ce=He.items[He.items.length-1].id}return{sessions:J,error:$e}}function Ge(se){const xe=new Map(e.sessions.map(J=>[J.id,J]));c(se.map(J=>{const Ce=xe.get(J.id);if(Ce===void 0)return J;const $e=o3(J.usage)&&!o3(Ce.usage),He=J.pullRequest??Ce.pullRequest;return!$e&&He===J.pullRequest?J:{...J,usage:$e?Ce.usage:J.usage,pullRequest:He}}))}function at(se){const xe=[...se],J=new Set(xe.map(Ce=>Ce.id));for(const Ce of e.sessions)J.has(Ce.id)||(xe.push(Ce),J.add(Ce.id));return xe.sort((Ce,$e)=>new Date($e.updatedAt).getTime()-new Date(Ce.updatedAt).getTime()),xe}async function Tt(se){const xe=_t(),J=[],Ce=Date.now(),$e=Et=>Ce-new Date(Et.updatedAt).getTime();let He,vt=!1,ut=!0,Dt;for(;;){let Et;try{Et=await xe.listSessions({workspaceId:se,pageSize:am,beforeId:He,excludeEmpty:!0})}catch(Ot){if(ut)throw Ot;Dt=Ot,vt=!0;break}if(vt=Et.hasMore,Et.items.length===0)break;const ln=Et.items[Et.items.length-1],oo=$e(ln)>=Fe;if(!ut&&oo){const Ot=Et.items.findIndex(Yn=>$e(Yn)>=Fe),Pt=Ot>=0?Ot+1:Et.items.length;J.push(...Et.items.slice(0,Pt)),vt=Et.hasMore||PtTt(Ot.id))),J=[],Ce=new Set,$e=new Map,He=new Set;let vt;for(let Ot=0;OtHe.has(Ot.id)).map(Ot=>Ot.root)),Dt=new Set(se.map(Ot=>Ot.id));for(const Ot of e.sessions)!(Ot.workspaceId!==void 0&&Dt.has(Ot.workspaceId)?He.has(Ot.workspaceId):ut.has(Ot.cwd)||He.has(B(Ot)))||Ce.has(Ot.id)||(J.push(Ot),Ce.add(Ot.id));const Et={},ln={},oo={};for(const{id:Ot}of se){const Pt=$e.get(Ot);if(Pt===void 0){const Yn=e.sessionsHasMoreByWorkspace[Ot],ko=e.sessionsCursorByWorkspace[Ot],vs=e.sessionsInitialCountByWorkspace[Ot];Yn!==void 0&&(Et[Ot]=Yn),ko!==void 0&&(ln[Ot]=ko),vs!==void 0&&(oo[Ot]=vs);continue}Et[Ot]=Pt.hasMore,ln[Ot]=Pt.items.length>0?Pt.items[Pt.items.length-1].id:void 0,oo[Ot]=Math.max(Pt.items.length,am)}return e.sessionsHasMoreByWorkspace=Et,e.sessionsCursorByWorkspace=ln,e.sessionsInitialCountByWorkspace=oo,e.sessionsFullyLoaded=!1,J.sort((Ot,Pt)=>new Date(Pt.updatedAt).getTime()-new Date(Ot.updatedAt).getTime()),He.size>0&&l("load",vt),J}async function Yt(se){if(!e.sessionsLoadingMoreByWorkspace[se]&&e.sessionsHasMoreByWorkspace[se]!==!1&&e.sessionsCursorByWorkspace[se]!==void 0){e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!0};try{let xe=e.sessionsCursorByWorkspace[se],J;for(let He=0;He<3&&xe!==void 0&&(J=await _t().listSessions({workspaceId:se,pageSize:O5,beforeId:xe,excludeEmpty:!0}),e.sessionsCursorByWorkspace[se]!==xe);He+=1)J=void 0,xe=e.sessionsCursorByWorkspace[se];if(J===void 0)return;const Ce=new Set(e.sessions.map(He=>He.id)),$e=J.items.filter(He=>!Ce.has(He.id));$e.length>0&&c([...e.sessions,...$e]),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:J.items.length>0?J.items[J.items.length-1].id:xe},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:J.hasMore}}catch(xe){l("loadMoreSessions",xe)}finally{e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!1}}}}function Sn(se){return e.sessions.filter(xe=>!xe.parentSessionId&&B(xe)===se)}const on=5;function en(se,xe){const J=new Set(e.sessions.map(He=>He.id)),Ce=se.items.filter(He=>!J.has(He.id)&&(He.meta.last_prompt??"").length>0).map(kU);Ce.length>0&&c([...e.sessions,...Ce]);for(const He of se.items)if(J.has(He.id)&&He.git!==void 0){const vt=He.git.pull_request;d(He.id,ut=>ut.pullRequest===vt?ut:{...ut,pullRequest:vt})}if(se.items.length>0){const He=Math.min(...se.items.map(vt=>vt.meta.updated_at));e.flatSessionsFrontier=xe?.resetFrontier===!0||e.flatSessionsFrontier===null?He:Math.min(e.flatSessionsFrontier,He)}e.flatSessionsNextPageToken=se.nextPageToken,e.flatSessionsHasMore=se.hasMore;const $e=new Set(I.value.map(He=>He.id));return se.items.filter(He=>(He.meta.last_prompt??"").length>0&&$e.has(B({workspaceId:He.workspace.id,cwd:He.workspace.cwd??""}))).length}async function Cn(){const se=await _t().listSessionsV2({pageSize:xg,include:"git"});en(se,{resetFrontier:!0}),e.flatSessionsSeeded=!0}async function Mn(){if(!(e.flatSessionsSeeded||e.flatSessionsLoading)){e.flatSessionsLoading=!0;try{await Cn()}catch(se){l("ensureFlatSessions",se)}finally{e.flatSessionsLoading=!1}}}async function We(){if(!(e.flatSessionsLoading||e.flatSessionsLoadingMore)&&e.flatSessionsHasMore){e.flatSessionsLoadingMore=!0;try{if(!e.flatSessionsSeeded){await Cn();return}if(e.flatSessionsNextPageToken===null)return;for(let se=0;se0)break}}catch(se){l("loadMoreFlatSessions",se)}finally{e.flatSessionsLoadingMore=!1}}}async function tt(se,xe,J,Ce){if(e.sessionsCursorByWorkspace[se]===xe){const He=new Date(J).getTime();let vt;for(const ut of e.sessions){if(B(ut)!==se)continue;const Dt=new Date(ut.updatedAt).getTime();Dt<=He||(vt===void 0||Dt0&&Sn(se).lengthln.id)),Et=ut.items.filter(ln=>!Dt.has(ln.id));Et.length>0&&c([...e.sessions,...Et].sort((ln,oo)=>new Date(oo.updatedAt).getTime()-new Date(ln.updatedAt).getTime())),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:ut.items.length>0?ut.items[ut.items.length-1].id:void 0},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:ut.hasMore}}catch(ut){l("loadMoreSessions",ut);break}else await Yt(se);if($e-=1,Sn(se).length===vt&&e.sessionsCursorByWorkspace[se]===He)break}}async function Ue(){if(e.sessionsFullyLoaded)return;const se=await Oe().catch(Ce=>(gl("[kimi-web] loadAllSessions failed; search covers only loaded sessions",Ce),null));if(se===null)return;const xe=se.error===void 0?se.sessions:at(se.sessions);if(Ge(xe),e.sessionsFullyLoaded=se.error===void 0,se.error!==void 0)return;const J={};for(const Ce of e.workspaces)J[Ce.id]=!1;e.sessionsHasMoreByWorkspace=J}async function Lt(){const se=await _t().getMeta().catch(()=>null);se!==null&&(e.serverVersion=se.serverVersion,e.availableOpenInApps=se.openInApps,e.dangerousBypassAuth=se.dangerousBypassAuth,e.experimentalFlags=se.experimentalFlags,e.backend=se.backend)}async function gt(){const se=Date.now();let xe="accepted";bi("app:load:start"),e.loading=!0;const J=!ne.value;let Ce=!0;try{if(J&&await ze()==="server-auth-required"){Ce=!1,xe="auth-required";return}const $e=_t();await Promise.all([$e.getHealth().catch(()=>null),Lt(),r.loadModels()]),J||await Se(),await _e(),await wn();const He=await Bt(),vt=He??e.sessions;if(He!==void 0&&Ge(He),!J&&He!==void 0&&e.flatSessionsSeeded){e.flatSessionsSeeded=!1,e.flatSessionsNextPageToken=null,e.flatSessionsHasMore=!0,e.flatSessionsFrontier=null;try{await Cn()}catch(Ot){l("ensureFlatSessions",Ot)}}const ut=_E().filter(Ot=>!e.sessions.some(Pt=>Pt.id===Ot));if(ut.length>0){const Ot=await Promise.all(ut.map(Yn=>$s(Yn))),Pt=ut.filter((Yn,ko)=>Ot[ko]==="stale");Pt.length>0&&v(Pt)}const Dt=vt[0],Et=e.activeWorkspaceId;!(Et!==null&&D.value.some(Ot=>Ot.id===Et))&&Dt&&go(B(Dt)),Oo();const oo=typeof window<"u"?Qb(window.location):void 0;!e.activeSessionId&&oo!==void 0&&(e.sessions.some(Pt=>Pt.id===oo)||await no(oo))&&await vo(oo,{urlMode:"replace"}),!e.activeSessionId&&vt.length>0&&await vo(vt[0].id,{urlMode:"replace"})}catch($e){xe="failed",l("load",$e)}finally{e.loading=!1,Ce&&(ne.value=!0),bi("app:load:complete",{status:xe,sessionId:e.activeSessionId,sessionCount:e.sessions.length,workspaceCount:e.workspaces.length,durationMs:Date.now()-se})}}async function wn(){try{const se=_t(),[xe,J]=await Promise.all([se.listWorkspaces().catch(()=>[]),se.getFsHome().catch(()=>({home:"",recentRoots:[]}))]);e.workspaces=yn(xe),e.fsHome=J.home||null,e.recentRoots=J.recentRoots}catch{}}function yn(se){const xe=lh();return Object.keys(xe).length===0?se:se.map(J=>{const Ce=xe[J.root];return Ce!==void 0?{...J,name:Ce}:J})}function go(se){e.activeWorkspaceId=se,K(se)}function qt(se){go(se);const xe=e.sessions.filter(J=>B(J)===se);if(xe.length>0){const J=xe[0];J&&J.id!==e.activeSessionId&&vo(J.id)}else k(void 0),Nn(void 0,"push")}function ps(se){const xe=lh()[se.root],J=xe!==void 0?{...se,name:xe}:se,Ce=Pr(J.root);e.hiddenWorkspaceRoots.some(vt=>Pr(vt)===Ce)&&(e.hiddenWorkspaceRoots=e.hiddenWorkspaceRoots.filter(vt=>Pr(vt)!==Ce),V(e.hiddenWorkspaceRoots));const $e=e.workspaces.findIndex(vt=>vt.id===J.id||vt.root===J.root);if($e===-1){e.workspaces=[J,...e.workspaces];return}const He=[...e.workspaces];He[$e]=J,e.workspaces=He}function xs(se){if(se.type==="workspaceCreated"||se.type==="workspaceUpdated"){ps(se.workspace);return}const xe=e.workspaces.find(Ce=>Ce.id===se.workspaceId)?.root??se.root;if(xe&&!e.hiddenWorkspaceRoots.includes(xe)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,xe],V(e.hiddenWorkspaceRoots)),e.workspaces=e.workspaces.filter(Ce=>Ce.id!==se.workspaceId&&Ce.root!==xe),e.activeWorkspaceId===se.workspaceId||e.activeWorkspaceId===xe){const Ce=I.value[0]?.id??null;if(e.activeWorkspaceId=Ce,Ce)K(Ce);else try{ur(cn.activeWorkspace)}catch{}k(void 0),e.sessionLoading=!1,ge(),Nn(void 0,"replace")}}function _n(){k(void 0),Nn(void 0,"push")}function In(se){go(se),_n(),ge()}async function To(se){const xe=D.value.find(ln=>ln.id===se);if(!xe)return null;const J=e.thinking,Ce=_t();let $e,He=xe.root;try{const ln=await Ce.addWorkspace({root:xe.root});$e=ln.id,He=ln.root,ps(ln)}catch{}const vt=r.draftModel.value??void 0,ut=await Ce.createSession({workspaceId:$e,cwd:He,model:vt});r.draftModel.value=null;const Dt=vt!==void 0&&(!ut.model||ut.model.length===0)?{...ut,model:vt}:ut;f(Dt);const Et=ut.id;return J!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[Et]:J},k3(e,Et)),go(ut.workspaceId??$e??se),await vo(ut.id,{skipStatusRefresh:!0}),z.planMode&&(e.planModeBySession={...e.planModeBySession,[Et]:!0},O()),z.swarmMode&&(e.swarmModeBySession={...e.swarmModeBySession,[Et]:!0},F()),z.goalMode&&(e.goalModeBySession={...e.goalModeBySession,[Et]:!0},U()),z.planMode=!1,z.swarmMode=!1,z.goalMode=!1,Et}async function lo(se,xe,J){if(cl.has(se))return null;cl.add(se);let Ce=null;try{const $e=await To(se);return $e?(Ce=$e,await Po($e,xe,J),$e):null}catch($e){return l("startSessionAndSendPrompt",$e),Ce}finally{cl.delete(se)}}async function St(se,xe,J,Ce){if(cl.has(se))return null;cl.add(se);let $e=null;try{const He=await To(se);if(!He)return null;$e=He;const vt=e.planModeBySession[He]??!1,ut=e.swarmModeBySession[He]??!1,Dt=e.sessions.find(Ot=>Ot.id===He),Et=(Dt?.model&&Dt.model.length>0?Dt.model:e.defaultModel)??void 0,ln=await r.resolveThinkingForPrompt(He,Et)??e.thinking;return await P({model:Et,planMode:vt,swarmMode:ut,permissionMode:e.permission,thinking:ln},He)&&await r.activateSkill(xe,J,Ce,He,{skipThinkingPersist:!0}),He}catch(He){return l("startSessionAndActivateSkill",He),$e}finally{cl.delete(se)}}async function hs(se,xe){if(cl.has(se))return null;cl.add(se);let J=null;try{const Ce=await To(se);return Ce?(J=Ce,await i.openSideChatOn(Ce,xe),Ce):null}catch(Ce){return l("startSessionAndOpenSideChat",Ce),J}finally{cl.delete(se)}}async function Jo(se){const xe=se.trim();if(!xe)return!1;const J=_t();try{const Ce=await J.addWorkspace({root:xe});return ps(Ce),In(Ce.id),!0}catch(Ce){return gl("[kimi-web] addWorkspaceByPath failed for",xe,Ce),!1}}async function uo(se){try{return await _t().browseFs(se)}catch{return{path:"",parent:null,entries:[]}}}async function Ys(){try{return await _t().getFsHome()}catch{return{home:"",recentRoots:[]}}}function Nn(se,xe){if(xe==="none"||typeof window>"u"||!window.history)return;const J=fQ(se);if(window.location.pathname!==J)try{xe==="push"?window.history.pushState(null,"",J):window.history.replaceState(null,"",J)}catch{}}async function no(se){try{const xe=await _t().getSession(se);return e.sessions.some(J=>J.id===xe.id)||h(xe),!0}catch{return!1}}async function $s(se){try{const xe=await _t().getSession(se);return xe.archived?"stale":(e.sessions.some(J=>J.id===xe.id)||h(xe),"ok")}catch(xe){return Us(xe)&&xe.code===qhe?"stale":"retry"}}function Xs(){const se=Qb(window.location);if(se===void 0){k(void 0);return}if(se!==e.activeSessionId){if(e.sessions.some(xe=>xe.id===se)){vo(se,{urlMode:"none"});return}(async()=>{if(await no(se)){await vo(se,{urlMode:"none"});return}const xe=e.sessions[0];xe?await vo(xe.id,{urlMode:"replace"}):(k(void 0),Nn(void 0,"replace"))})()}}let ci=!1;function Oo(){ci||typeof window>"u"||(ci=!0,window.addEventListener("popstate",Xs))}async function vo(se,xe){if(!e.sessions.some($e=>$e.id===se)){const $e=++ye;if(!await no(se)||$e!==ye)return}const J=S(se),Ce=!J&&u.has(se);u.delete(se);try{Nn(se,xe?.urlMode??"push"),e.sessionLoading=!J&&!Ce,k(se),e.unreadBySession[se]&&(e.unreadBySession={...e.unreadBySession,[se]:!1},W({[se]:!1})),ge();const $e=e.sessions.find(He=>He.id===se);if($e){const He=B($e);e.activeWorkspaceId!==He&&go(He)}if(J){if(await x(se)==="not-found")return}else if(await g(se,{skipStatusRefresh:xe?.skipStatusRefresh===!0})==="not-found")return;fe(se,{skipStatus:xe?.skipStatusRefresh===!0})}catch($e){l("selectSession",$e,{sessionId:se})}finally{e.activeSessionId===se&&(e.sessionLoading=!1)}}async function Po(se,xe,J){const Ce=y8(se);e.inFlightBySession={...e.inFlightBySession,[se]:!0};const $e=b();let He=e.pendingThinkingBySession[se];try{const vt=_t(),ut=[];if(xe&&ut.push({type:"text",text:xe}),ut.push(...m8(J)),ut.length===0)return e.inFlightBySession={...e.inFlightBySession,[se]:!1},"rejected";const Dt={id:$e,sessionId:se,role:"user",content:ut,createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};w(se,vs=>[...vs,Dt]);const Et=e.sessions.find(vs=>vs.id===se),ln=(Et?.model&&Et.model.length>0?Et.model:e.defaultModel)??void 0,oo=e.planModeBySession[se]??!1,Ot=e.swarmModeBySession[se]??!1,Pt=e.goalModeBySession[se]??!1;if(Pt&&xe)try{await vt.updateSession(se,{goalObjective:xe.trim()})}catch(vs){return vl(e,se,He)&&T(se),l("createGoal",vs,{sessionId:se}),e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,Os=>Os.some(ei=>ei.id===$e)?Os.filter(ei=>ei.id!==$e):Os),"rejected"}const Yn=await r.resolveThinkingForPrompt(se,ln)??e.thinking;He=e.pendingThinkingBySession[se];const ko=await vt.submitPrompt(se,{content:ut,model:ln,thinking:Yn,permissionMode:e.permission,planMode:oo,swarmMode:Ot});return Yn!==void 0&&vl(e,se,He),Pt&&(e.goalModeBySession={...e.goalModeBySession,[se]:!1},U()),e.promptIdBySession={...e.promptIdBySession,[se]:ko.promptId},G(se,$e,ko.promptId,ko.userMessageId),_()?.bindNextPromptId(se,ko.promptId),"ok"}catch(vt){return e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,ut=>ut.some(Dt=>Dt.id===$e)?ut.filter(Dt=>Dt.id!==$e||Dt.promptId!==void 0||Dt.userMessageId!==void 0):ut),vl(e,se,He)&&T(se),l("sendPrompt",vt,{sessionId:se}),Us(vt)?"rejected":"uncertain"}finally{k8(se,Ce)}}async function co(se,xe){const J=e.activeSessionId;if(J){if(a.value!=="idle"||e.inFlightBySession[J]){Qe(se,xe);return}if((e.queuedBySession[J]?.length??0)>0){Qe(se,xe),st(J);return}await Po(J,se,xe)}}async function Tn(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[],$e=[],He=[];for(const Pt of Ce){const Yn=Pt.text.trim();Yn&&$e.push(Yn),Pt.attachments?.length&&He.push(...Pt.attachments)}const vt=se.trim();if(vt&&$e.push(vt),xe?.length&&He.push(...xe),$e.length===0&&He.length===0)return;Ce.length>0&&(e.queuedBySession={...e.queuedBySession,[J]:[]});const ut=$e.join(` +`)}const Mx=cn.clientId,j0e="kimi-code-web",V0e="web";function q0e(){return{serverHttpUrl:Z0e(),clientId:Y0e(),clientName:j0e,clientVersion:X0e(),clientUiMode:V0e}}function K0e(){return typeof window<"u"&&window.location?.origin?window.location.origin:"http://127.0.0.1:58627"}function Z0e(){const e=Y$();return h8(e||void 0)}const Tx="kimi-desktop-server-origin";function Y$(){if(typeof window>"u")return;const e=new URLSearchParams(window.location.search).get("kimi_origin");try{return e?(window.sessionStorage.setItem(Tx,e),e):window.sessionStorage.getItem(Tx)??void 0}catch{return e??void 0}}function h8(e){const t=e&&e.trim()?e:K0e(),n=new URL(t);return n.pathname=n.pathname.replace(/\/v1\/?$/,"").replace(/\/$/,""),n.search="",n.hash="",n.toString().replace(/\/$/,"")}function Ex(e){return e.replace(/^https?:\/\//,"").replace(/\/$/,"")}function G0e(){if(typeof window<"u"){const t=Y$();if(t)return Ex(h8(t))}const e=typeof window<"u"&&window.location?.origin?window.location.origin:"";return Ex(e)}function Y0e(){const e=ui(Mx);if(e)return e;const t=`web_${globalThis.crypto?.randomUUID?.()||Math.random().toString(36).slice(2)}`;return Ls(Mx,t),t}function X0e(){return"0.35.0".trim()?"0.35.0":"0.0.0-dev"}const J0e={restRequest:e=>I0e(e),restResponse:e=>L0e(e),restFailure:e=>$0e(e),wsEvent:e=>{switch(e.kind){case"lifecycle":N0e(e.event,e.detail);break;case"in":R0e(e.frame);break;case"out":F0e(e.frame);break}},traceKeyEvent:(e,t)=>bi(e,t)},Q0e={getToken:eQ,markAuthRequired:sQ},ehe=(e,t)=>t===void 0?Hn.global.t(e):Hn.global.t(e,t);function the(){const e=q0e();return eY({origin:e.serverHttpUrl,identity:{clientId:e.clientId,clientName:e.clientName,clientVersion:e.clientVersion,clientUiMode:e.clientUiMode},tracer:J0e,credentialStore:Q0e,t:ehe})}const nhe=the();function _t(){return nhe}function ohe(e,t,n){return e==="idle"&&!t&&!n}function X$(e,t){const n=ui(e);return n===null?t:n==="1"}const Cg=Z(X$(cn.notifyEnabled,!0)),L5=Z(X$(cn.notifySound,!0)),$5=Z(typeof Notification<"u"?Notification.permission:"denied"),she="/favicon.ico";async function ihe(e){if(!e){Cg.value=!1,Ls(cn.notifyEnabled,"0");return}if(typeof Notification>"u")return;let t=Notification.permission;if(t==="default")try{t=await Notification.requestPermission()}catch{}$5.value=t,t==="granted"&&(Cg.value=!0,Ls(cn.notifyEnabled,"1"))}function rhe(e){L5.value=e,Ls(cn.notifySound,e?"1":"0")}function N5(...e){for(const t of e){const n=t?.trim();if(n)return n}return""}function lhe(e){return{title:Hn.global.t("settings.notifyTitle"),body:N5(e,Hn.global.t("settings.notifyFallback"))}}function ahe(e,t){return{title:Hn.global.t("settings.notifyQuestionTitle"),body:N5(t,e,Hn.global.t("settings.notifyQuestionFallback"))}}function uhe(e,t){return{title:Hn.global.t("settings.notifyApprovalTitle"),body:N5(t,e,Hn.global.t("settings.notifyApprovalFallback"))}}function F5(e,t,n){if(!Cg.value||typeof Notification>"u")return;const o=Notification.permission;if(o!=="denied"){if(o==="default"){Notification.requestPermission().then(s=>{$5.value=s,s==="granted"&&Ix(e,t,n)});return}Ix(e,t,n)}}function Ix(e,t,n){if(!e.isUserWatching)try{const o=new Notification(t.title,{body:t.body,tag:n,icon:she,silent:!L5.value});o.onclick=()=>{try{window.kimiDesktop?.showWindow?.(),window.focus()}catch{}e.onClick(),o.close()}}catch{}}function che(e,t){F5(t,lhe(t.sessionTitle),`kimi-complete-${e}-${t.promptId??Date.now()}`)}function dhe(e){F5(e,ahe(e.sessionTitle,e.questionPreview),`kimi-question-${e.questionId}`)}function fhe(e){F5(e,uhe(e.sessionTitle,e.toolName),`kimi-approval-${e.approvalId}`)}function phe(){return{notifyEnabled:Cg,notifySound:L5,notifyPermission:$5,setNotifyEnabled:ihe,setNotifySound:rhe,maybeNotifyCompletion:che,maybeNotifyQuestion:dhe,maybeNotifyApproval:fhe}}const hhe=1e3,mhe=4096,Lx=32*1024;function ghe(e,t){let n=null,o;const s=new Set;async function i(f){try{const m=await _t().listTasks(f);e.tasksBySession={...e.tasksBySession,[f]:nC(m,e.tasksBySession[f]??[])},await r(f,m)}catch{}}async function r(f,h){if(e.activeSessionId!==f)return;const m=h??e.tasksBySession[f]??[],v=_t(),k=new Map;if(await Promise.all(m.map(async b=>{if((b.status==="completed"||b.status==="failed"||b.status==="cancelled")&&!s.has(b.id)&&!((b.outputLines?.length??0)>0))try{const g=await v.getTask(f,b.id,{withOutput:!0,outputBytes:Lx});g.outputPreview!==void 0&&k.set(b.id,{preview:g.outputPreview,bytes:g.outputBytes}),s.add(b.id)}catch{}})),k.size===0)return;const w=e.tasksBySession[f]??[];e.tasksBySession={...e.tasksBySession,[f]:w.map(b=>{const _=k.get(b.id)??(b.backgroundTaskId!==void 0?k.get(b.backgroundTaskId):void 0);return _?{...b,outputPreview:_.preview,outputBytes:_.bytes}:b})}}async function l(f){if(e.activeSessionId!==f)return;const h=_t();let m;try{m=await h.listTasks(f)}catch{return}const v=new Map;await Promise.all(m.map(async _=>{const g=_.status==="running",x=_.status==="completed"||_.status==="failed"||_.status==="cancelled";if(!(!g&&!x)&&!(x&&(s.has(_.id)||(_.outputLines?.length??0)>0)))try{const S=await h.getTask(f,_.id,{withOutput:!0,outputBytes:g?mhe:Lx});S.outputPreview!==void 0&&v.set(_.id,{preview:S.outputPreview,bytes:S.outputBytes}),x&&s.add(_.id)}catch{}}));const k=e.tasksBySession[f]??[],w=new Map(k.map(_=>[_.id,_])),b=m.map(_=>{const g=w.get(_.id),x=v.get(_.id);return{..._,outputLines:g?.outputLines,text:g?.text,outputPreview:x?.preview??g?.outputPreview,outputBytes:x?.bytes??g?.outputBytes}});e.tasksBySession={...e.tasksBySession,[f]:nC(b,k)}}function a(f){n!==null&&o===f||(u(),o=f,l(f),n=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||(e.activeSessionId===f?l(f):u())},hhe))}function u(){n!==null&&(clearInterval(n),n=null),o=void 0,s.clear()}const c=Z(0);let d=null;return Je(()=>t.value.some(f=>f.status==="running"),f=>{f&&d===null?d=setInterval(()=>{c.value=(c.value+1)%Number.MAX_SAFE_INTEGER},1e3):!f&&d!==null&&(clearInterval(d),d=null)},{immediate:!0}),Je(()=>{const f=e.activeSessionId;if(!f)return{sid:void 0,hasRunning:!1};const h=e.tasksBySession[f]??[];return{sid:f,hasRunning:h.some(m=>m.status==="running")}},({sid:f,hasRunning:h},m,v)=>{let k;h&&f!==void 0?a(f):f!==void 0?k=setTimeout(()=>{(e.tasksBySession[f]??[]).some(b=>b.status==="running")||u()},1500):u(),v(()=>{k!==void 0&&clearTimeout(k)})},{deep:!0,immediate:!0}),{taskClock:R(()=>c.value),loadTasksForSession:i}}function m8(e){const t=[];for(const n of e??[])n.kind==="video"?t.push({type:"video",source:{kind:"file",fileId:n.fileId}}):n.kind==="file"?t.push({type:"file",fileId:n.fileId,name:n.name??"",mediaType:n.mediaType||"application/octet-stream",size:n.size??0}):t.push({type:"image",source:{kind:"file",fileId:n.fileId}});return t}const vhe=640,yhe=`(max-width: ${vhe}px)`;function khe(){const e=Z(!1);if(typeof window>"u"||typeof window.matchMedia!="function")return e;const t=window.matchMedia(yhe);e.value=t.matches;const n=o=>{e.value=o.matches};return typeof t.addEventListener=="function"?(t.addEventListener("change",n),bn(()=>t.removeEventListener("change",n))):typeof t.addListener=="function"&&(t.addListener(n),bn(()=>t.removeListener(n))),e}const J$=Z(typeof window>"u"?0:window.innerWidth);let Ih=0,wg=!1;function g8(){J$.value=window.innerWidth}function bhe(){wg||typeof window>"u"||(window.addEventListener("resize",g8),wg=!0,g8())}function Che(){!wg||typeof window>"u"||(window.removeEventListener("resize",g8),wg=!1)}function Q$(e,t,n){return Math.max(t,e-n)}function v8(e,t,n){return Math.min(n,Math.max(t,e))}function eN(){return dn(()=>{Ih+=1,bhe()}),Vn(()=>{Ih=Math.max(0,Ih-1),Ih===0&&Che()}),{viewportWidth:J$}}const whe=24;function _he(e){const t=Z(null),n=Z(!0);let o=null,s=null,i=null,r=0,l=0,a=!1,u=0;function c(){const k=t.value;k&&(k.scrollTop=Math.max(k.scrollTop,r))}function d(){const w=t.value?.firstElementChild??null;w!==i&&(i&&o?.unobserve(i),i=w,w&&o?.observe(w))}function f(){const k=t.value;!k||a||(n.value=r-k.scrollTop-lh(k));return}requestAnimationFrame(()=>{requestAnimationFrame(()=>h(k))})}function v(){const k=t.value;k&&(o?.disconnect(),s?.disconnect(),i=null,a=!1,u++,r=0,l=0,typeof ResizeObserver=="function"?(o=new ResizeObserver(()=>{const w=t.value;if(!w)return;const{scrollHeight:b,clientHeight:_}=w,g=b>r+1,x=_{n.value=!0,yt(v)}),Je(t,()=>void yt(v)),dn(()=>void yt(v)),bn(()=>{u++,o?.disconnect(),s?.disconnect()}),{scroller:t,following:n,onScroll:f,pinScroll:m}}function xhe(e){try{const t=ui(e);if(t===null)return null;const n=Number(t);return Number.isFinite(n)?n:null}catch{return null}}function $x(e,t){try{Ls(e,String(t))}catch{}}function She(e){const{storageKey:t,defaultWidth:n,min:o,max:s,reverse:i=!1,axis:r="x",applyLive:l}=e;function a(D){return Number.isFinite(D)?Math.min(Rh(s),Math.max(o,Math.round(D))):n}const u=Z(a(xhe(t)??n)),c=Z(!1);function d(D){const I=D<=o,$=D>=Rh(s),B=r==="x"?"col-resize":"row-resize";if(I&&$)return B;const[H,O]=r==="x"?["e-resize","w-resize"]:["s-resize","n-resize"];return $?i?H:O:I?i?O:H:B}const f=Z(null),h=R(()=>d(f.value??u.value));function m(D){typeof document>"u"||(document.body.style.cursor=d(D))}function v(D){const I=a(D);u.value=I,$x(t,I)}Je(()=>Rh(s),D=>{!c.value&&u.value>D&&v(D)});let k=0,w=0,b=null,_=-1,g=0,x=0,S=0;function T(){if(x=0,!c.value)return;const D=g-k;S=a(w+(i?-D:D)),f.value=S,m(S),l?l(S):u.value=S}function A(D){if(c.value&&(g=r==="x"?D.clientX:D.clientY,x===0)){if(typeof requestAnimationFrame!="function"){T();return}x=requestAnimationFrame(T)}}function E(){if(c.value){if(x!==0&&(cancelAnimationFrame(x),T()),c.value=!1,l?v(S):$x(t,u.value),f.value=null,typeof document<"u"&&(document.body.style.userSelect="",document.body.style.cursor=""),b){try{b.releasePointerCapture(_)}catch{}b.removeEventListener("pointermove",A),b.removeEventListener("pointerup",E),b.removeEventListener("pointercancel",E)}b=null,_=-1}}function P(D){D.preventDefault(),c.value=!0,k=r==="x"?D.clientX:D.clientY,w=a(u.value),S=w,b=D.currentTarget,_=D.pointerId,typeof document<"u"&&(document.body.style.userSelect="none"),m(w);try{b.setPointerCapture(_)}catch{}b.addEventListener("pointermove",A),b.addEventListener("pointerup",E),b.addEventListener("pointercancel",E)}return Vn(E),{width:u,dragging:c,cursor:h,clamp:a,setWidth:v,onPointerDown:P}}const Hr=Z(null),Zd=Z(!1),Ahe=R(()=>Hr.value!==null);function R5(e){const t=Hr.value;!t||Zd.value||(Hr.value=null,t.resolve(e))}async function Mhe(){const e=Hr.value;if(!(!e||Zd.value)){if(!e.action){R5(!0);return}Zd.value=!0;try{await e.action(),Hr.value===e&&(Hr.value=null),e.resolve(!0)}catch(t){Hr.value===e&&(Hr.value=null),e.reject(t)}finally{Zd.value=!1}}}function The(e){return Zd.value?Promise.resolve(!1):(Hr.value&&R5(!1),new Promise((t,n)=>{Hr.value={...e,resolve:t,reject:n}}))}function hu(){return{current:Hr,busy:Zd,isConfirmOpen:Ahe,confirm:The,settle:R5,runAction:Mhe}}function Ehe(e){const{sessionId:t}=e;function n(u){return ui(eC(u))??""}function o(u,c){const d=eC(u);c?Ls(d,c):ur(d)}const s=Z(n(t())),i=Z(null);function r(){const u=i.value;u&&(u.style.height="auto",u.style.height=`${u.scrollHeight}px`)}Je(s,u=>{yt(r),o(t(),u)}),Je(t,(u,c)=>{u!==c&&(o(c,s.value),s.value=n(u),yt(r))});function l(u){s.value=u,yt(()=>{const c=i.value;if(!c)return;c.focus();const d=u.length;c.setSelectionRange(d,d),r()})}function a(){o(t(),"")}return{text:s,textareaRef:i,autosize:r,loadForEdit:l,clearDraft:a}}function Ihe(e){return e?e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0:!1}function Lhe(e){const{sessionId:t,mobile:n,starting:o,dockedComposer:s,emptyComposer:i}=e,r=Z(!1);Je(t,()=>{n()||(r.value=!0)}),Je([r,s,i,o],()=>{if(!r.value)return;const l=s.value??i.value;if(!l)return;const a=typeof document<"u"?document.activeElement:null;if(Ihe(a)){r.value=!1;return}l.focus(),(typeof document>"u"||document.activeElement!==a)&&(r.value=!1)},{flush:"post"})}const _g=100;function $he(e){const t=y1(cn.inputHistory);if(Array.isArray(t)){const n=t.filter(i=>typeof i=="string"&&i.length>0);if(!e||n.length===0)return{};const o=n.length>_g?n.slice(-_g):n,s={[e]:o};return Tc(cn.inputHistory,s),s}return t&&typeof t=="object"?t:{}}function Nhe(e){const{text:t,textareaRef:n,autosize:o,sessionId:s}=e,i=Z($he(s())),r=R(()=>i.value[s()??""]??[]);let l=-1,a="";function u(w){const b=s();if(l=-1,!b)return;const _=w.trim();if(!_)return;const g=i.value[b]??[];if(g.at(-1)===_)return;const x=[...g,_],S=x.length>_g?x.slice(-_g):x;i.value={...i.value,[b]:S},Tc(cn.inputHistory,i.value)}function c(){const w=n.value;return w?(w.selectionStart??0)===0:!1}function d(w){t.value=w,yt(()=>{const b=n.value;if(!b)return;o();const _=w.length;b.setSelectionRange(_,_)})}function f(){const w=r.value;if(w.length!==0){if(l===-1)a=t.value,l=w.length-1;else if(l>0)l-=1;else return;d(w[l])}}function h(){if(l===-1)return;const w=r.value;l0}return Je(s,()=>{l=-1}),{push:u,caretAtTextStart:c,recallOlder:f,recallNewer:h,resetBrowsing:m,isBrowsing:v,hasHistory:k}}function Fhe(e){const{text:t,textareaRef:n,autosize:o,skills:s,emitCommand:i,historyPush:r,clearDraft:l}=e,a=Z(!1),u=Z([]),c=Z(0);function d(){const h=t.value;h.startsWith("/")&&!h.includes(" ")?(u.value=mQ(h,CE(s())),c.value=0,a.value=u.value.length>0):a.value=!1}function f(h){if(a.value=!1,h.acceptsInput){t.value=`${h.name} `,yt(()=>{const m=n.value;if(!m)return;const v=t.value.length;m.setSelectionRange(v,v),m.focus(),o()});return}t.value="",l?.(),r(h.name),i(h.name)}return{open:a,items:u,active:c,update:d,select:f}}function Rhe(e){const{text:t,textareaRef:n,autosize:o,searchFiles:s}=e,i=Z(!1),r=Z([]),l=Z(0),a=Z(!1);let u=null;function c(){const h=t.value,m=n.value?.selectionStart??h.length;let v=m-1;for(;v>=0&&!/\s/.test(h[v]);)v--;v++;const k=h.slice(v,m);return k.startsWith("@")?{token:k.slice(1),start:v,end:m}:null}function d(){const h=c(),m=s();if(u!==null&&clearTimeout(u),!h||!m||h.token.length===0){i.value=!1,a.value=!1;return}const v=h.token;u=setTimeout(async()=>{a.value=!0,i.value=!0,l.value=0;const k=()=>{const w=c();return w!==null&&w.token===v&&i.value};try{const w=await m(v);k()&&(r.value=w)}catch{k()&&(r.value=[])}finally{k()&&(a.value=!1)}},200)}function f(h){const m=c();if(!m)return;const v=t.value;t.value=v.slice(0,m.start)+h.path+v.slice(m.end),i.value=!1,yt(()=>{const k=n.value;if(!k)return;const w=m.start+h.path.length;k.setSelectionRange(w,w),k.focus(),o()})}return{open:i,items:r,active:l,loading:a,update:d,select:f}}const Ohe="kimi-web.file-preview-width",gd=320;function Phe({client:e,sideWidth:t,detailTarget:n,closeFilePreview:o}){const{viewportWidth:s}=eN(),i=R(()=>Math.max(0,s.value-t.value)),r=R(()=>Q$(i.value,gd,gd));function l(Y){return v8(Math.round(Y),gd,r.value)}function a(){return l(i.value/2)}const u=R(()=>a()),c=Z(u.value),d=R(()=>v8(c.value,gd,r.value)),f=Z(null),h=R(()=>{const Y=f.value;if(!Y)return null;const fe=e.turns.value.find(we=>we.id===Y.turnId);return fe?.role==="compaction"&&fe.text?fe.text:null}),m=R(()=>h.value!==null);function v(Y){if(f.value?.turnId===Y.turnId){f.value=null,n.value==="compaction"&&(n.value=null);return}n.value="compaction",f.value=Y}function k(){f.value=null,n.value==="compaction"&&(n.value=null)}const w=Z(null),b=R(()=>{const Y=w.value;if(!Y)return{entry:void 0,version:0};const fe=e.auxiliaryTranscripts.getEntry(Y.sessionId,Y.subagentId);return{entry:fe,version:fe?.version.value??0}});function _(Y){const fe=e.turns.value.flatMap(we=>we.tools??[]).find(we=>we.agentId===Y);if(!fe)return{};try{const we=JSON.parse(fe.arg);return{name:typeof we.description=="string"?we.description:void 0,subagentType:typeof we.subagent_type=="string"?we.subagent_type:void 0,status:fe.status,outputLines:fe.output}}catch{return{}}}const g=R(()=>{const Y=w.value;if(!Y)return null;const fe=e.activeAppTasks.value.find(Fe=>Fe.agentId===Y.subagentId||Fe.id===Y.subagentId);if(fe)return UY(fe);const we=b.value.entry?.channel,ge=we?.agents.find(Fe=>Fe.agentId===Y.subagentId),Q=we?.refreshError??!1,te=we===void 0||we.loading,ce=we?.snapshot.meta.activity==="turn",ue=_(Y.subagentId),Se=we?.snapshot.items.findLast(Fe=>Fe.kind==="turn"),ze=Se?.kind==="turn"&&Se.state==="cancelled",_e=Se?.kind==="turn"&&Se.state==="failed"||ue.status==="error",Ee=ce?"working":_e||ze?"failed":te?"queued":Q&&ue.status===void 0?"failed":"completed",it=ce?"running":ze?"cancelled":_e?"failed":te?"running":Q&&ue.status===void 0?"failed":"completed";return{id:Y.subagentId,name:ge?.label??ue.name??Y.subagentId,subagentType:ue.subagentType??(ge?.type==="sub"?"subagent":ge?.type),phase:Ee,status:it,outputLines:ue.outputLines}}),x=R(()=>{const Y=b.value.entry;if(!Y)return[];const fe=w.value,we=Y.channel.agents.find(ge=>ge.agentId===fe?.subagentId);return nX(Y.channel.snapshot,e.getFileUrl,we)}),S=R(()=>b.value.entry?.channel.loading??!1),T=R(()=>b.value.entry?.channel.refreshError??!1),A=R(()=>b.value.entry?.channel.loadingOlder??!1),E=R(()=>b.value.entry?.channel.loadOlderError??!1),P=R(()=>b.value.entry?.channel.snapshot.hasMoreOlder??!1),D=R(()=>b.value.entry?.channel.snapshot.meta.activity==="turn"),I=R(()=>g.value!==null);function $(Y){const fe=e.activeSessionId.value;if(!(!Y||!fe)){if(n.value==="agent"&&w.value?.sessionId===fe&&w.value.subagentId===Y){B();return}w.value={sessionId:fe,subagentId:Y},n.value="agent",e.auxiliaryTranscripts.activate(fe,Y)}}function B(){const Y=w.value;Y&&e.auxiliaryTranscripts.deactivate(Y.sessionId,Y.subagentId),w.value=null,n.value==="agent"&&(n.value=null)}Je(n,(Y,fe)=>{if(fe!=="agent"||Y==="agent")return;const we=w.value;we&&e.auxiliaryTranscripts.deactivate(we.sessionId,we.subagentId)});function H(){const Y=b.value.entry;Y&&Y.channel.loadOlder().catch(()=>{})}const O=Z("list"),F=Z(null);function U(){if(n.value==="diff"){z();return}n.value="diff",O.value="list",F.value=null,e.loadGitStatus(e.activeSessionId.value)}function z(){n.value==="diff"&&(n.value=null),O.value="list",F.value=null,e.clearFileDiff()}async function W(Y){O.value="detail",F.value=Y,await e.loadFileDiff(Y)}const K=Xr(null);function V(Y){if(K.value===Y&&n.value==="turn-diff"){ie();return}K.value=Y,n.value="turn-diff"}function ie(){K.value=null,n.value==="turn-diff"&&(n.value=null)}async function ne(Y){if(!e.activeSessionId.value&&e.activeWorkspaceId.value){const fe=await e.startSessionAndOpenSideChat(e.activeWorkspaceId.value,Y);return n.value="btw",fe}return await e.openSideChat(Y),n.value="btw",null}function X(){e.closeSideChat(),n.value==="btw"&&(n.value=null)}function le(){n.value==="btw"&&(n.value=null)}const Ie=R(()=>e.sideChatVisible.value),de=R(()=>n.value!==null&&(n.value!=="compaction"||m.value)&&(n.value!=="agent"||I.value)&&(n.value!=="btw"||Ie.value)),pe=Z(!1),ve=Z({});function oe(){switch(n.value){case"compaction":return f.value?{kind:"compaction",...f.value}:null;case"agent":return w.value?{kind:"agent",...w.value}:null;case"btw":return{kind:"btw"};default:return null}}function ye(Y){if(Y)switch(Y.kind){case"compaction":f.value={turnId:Y.turnId},n.value="compaction";break;case"agent":e.activeSessionId.value&&(w.value={sessionId:e.activeSessionId.value,subagentId:Y.subagentId},n.value="agent",e.auxiliaryTranscripts.activate(e.activeSessionId.value,Y.subagentId));break;case"btw":e.sideChatVisible.value&&(n.value="btw");break}}function G(){return n.value==="compaction"&&m.value?(k(),!0):n.value==="agent"&&I.value?(B(),!0):n.value==="file"?(o(),!0):n.value==="diff"?(z(),!0):n.value==="turn-diff"?(ie(),!0):n.value==="btw"?(X(),!0):!1}return Je(e.activeSessionId,(Y,fe)=>{if(fe){const we=oe();we?ve.value[fe]=we:delete ve.value[fe]}o(),k(),B(),z(),ie(),le(),Y&&ye(ve.value[Y])}),{PREVIEW_WIDTH_KEY:Ohe,PREVIEW_MIN:gd,previewDefaultWidth:u,previewMax:r,previewWidth:c,previewPanelWidth:d,compactionPanelText:h,compactionPanelVisible:m,openCompactionPanel:v,closeCompactionPanel:k,agentPanelMember:g,agentPanelTurns:x,agentPanelLoading:S,agentPanelLoadError:T,agentPanelLoadingMore:A,agentPanelLoadMoreError:E,agentPanelHasMore:P,agentPanelRunning:D,agentPanelVisible:I,openAgentPanel:$,closeAgentPanel:B,loadOlderAgentMessages:H,detailDiffMode:O,detailDiffPath:F,openDiffDetail:U,closeDiffDetail:z,selectDiffFile:W,turnDiffChange:K,openTurnDiff:V,closeTurnDiff:ie,btwVisible:Ie,openSideChatTab:ne,closeSideChat:X,hideSideChatPanel:le,sidePanelVisible:de,panelDragging:pe,closeOpenSidePanel:G}}const Dhe=cn.sidebarWidth,Nx=cn.sidebarCollapsed,Fx=270,v4=220,Bhe=480,Hhe=320;function zhe(e={}){const{viewportWidth:t}=eN(),n=Z(Fx),o=Z(!1),s=Z(!1),i=R(()=>{const c=Hhe+(Rh(e.previewOpen)?gd:0);return Math.min(Bhe,Q$(t.value,v4,c))}),r=R(()=>v8(n.value,v4,i.value));function l(){try{o.value=ui(Nx)==="true"}catch{o.value=!1}}function a(){try{Ls(Nx,String(o.value))}catch{}}function u(){o.value=!o.value,a()}return{SIDEBAR_WIDTH_KEY:Dhe,SIDEBAR_DEFAULT:Fx,SIDEBAR_MIN:v4,sidebarMax:i,sessionColWidth:n,sidebarCollapsed:o,sidebarDragging:s,sideWidth:r,loadSidebarCollapsed:l,toggleSidebarCollapse:u}}const Whe=40409;function Rx(e){return Us(e)&&e.code===Whe}function Ox(e){return e.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function Px(e){if(e.startsWith("\\\\"))return e;const t=/^[a-zA-Z]:/.test(e)?e.slice(0,2):"",n=[];for(const o of e.slice(t.length).split(/[\\/]+/))if(!(!o||o===".")){if(o===".."){n.pop();continue}n.push(o)}return t?`${t}/${n.join("/")}`:`/${n.join("/")}`}function Uhe({client:e,detailTarget:t,t:n}){const o=Z(null),s=Z(null),i=Z(!1),r=Z(null),l=Z(null);let a=0;const u=R(()=>{const g=l.value;return g?e.getFileDownloadUrl(g):null}),c=R(()=>o.value!==null&&l.value!==null);function d(g){return g.length>1?g.replace(/\/+$/,""):g}function f(g){const x=h2(g,e.status.value.cwd);return x===null||x.split(/[\\/]+/).includes("..")?null:h(x)||null}function h(g){const x=[];for(const S of g.split(/[\\/]+/))if(!(!S||S===".")){if(S===".."){x.pop();continue}x.push(S)}return x.join("/")}function m(g){const x=g.trim();if(!x)return{error:n("filePreview.errors.emptyPath")};if(/^[a-z][a-z0-9+.-]*:\/\//i.test(x))return{error:n("filePreview.errors.unsupportedPath")};if(x.startsWith("~"))return{error:n("filePreview.errors.outsideWorkspace")};const S=d(e.status.value.cwd);if(x.startsWith("/")){if(!S||x!==S&&!x.startsWith(`${S}/`))return{error:n("filePreview.errors.outsideWorkspace")};const A=x===S?"":x.slice(S.length+1);if(A.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const E=h(A);return E?{path:E}:{error:n("filePreview.errors.isDirectory")}}if(x.split(/[\\/]+/).includes(".."))return{error:n("filePreview.errors.outsideWorkspace")};const T=h(x);return T?{path:T}:{error:n("filePreview.errors.emptyPath")}}async function v(g){const x=o.value;if(t.value==="file"&&x&&x.path===g.path&&x.line===g.line){w();return}const S=++a;if(t.value="file",s.value=null,r.value=null,i.value=!0,o.value=g,l.value=null,typeof g.content=="string"){i.value=!1,s.value={path:g.path,content:g.content,encoding:"utf-8",mime:"text/markdown",isBinary:!1,size:g.content.length};return}if(!Ox(g.path)&&g.path.split(/[\\/]+/).includes("..")){const A=d(e.status.value.cwd);A&&(g={...g,path:Px(`${A}/${g.path}`)})}if(Ox(g.path)){g={...g,path:Px(g.path)};const A=f(g.path);if(A!==null)g={...g,path:A};else{try{const E=await e.readHostFileContent(g.path);if(S!==a)return;l.value=null,s.value={path:g.path,content:E.content,encoding:E.encoding,mime:E.mime,isBinary:E.isBinary,size:E.size}}catch(E){if(S!==a)return;r.value=Rx(E)?n("filePreview.errors.notFound"):pU(E)?n("filePreview.errors.tooLarge"):E instanceof Error?E.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}return}}const T=m(g.path);if("error"in T){i.value=!1,r.value=T.error;return}l.value=T.path;try{const A=await e.readFileContent(T.path);if(S!==a)return;A?s.value={...A,path:A.path||T.path}:r.value=n("filePreview.errors.loadFailed")}catch(A){if(S!==a)return;r.value=Rx(A)?n("filePreview.errors.notFound"):A instanceof Error?A.message:n("filePreview.errors.loadFailed")}finally{S===a&&(i.value=!1)}}function k(){a+=1,o.value=null,l.value=null,s.value=null,r.value=null,i.value=!1}function w(){k(),t.value==="file"&&(t.value=null)}Je(t,(g,x)=>{x==="file"&&g!=="file"&&k()});function b(){const g=s.value?.path??o.value?.path;g&&e.openWorkspaceFile(g,o.value?.line)}function _(){const g=s.value?.path??o.value?.path;g&&e.revealWorkspaceFile(g)}return{previewTarget:o,previewFile:s,previewLoading:i,previewError:r,previewDownloadUrl:u,previewExternalActions:c,openFilePreview:v,closeFilePreview:w,openPreviewInEditor:b,revealPreviewFile:_}}function jhe({running:e,title:t="Kimi Code"}){if(Wp){I4(()=>{typeof document<"u"&&(document.title=t)});return}const n=["◐","◓","◑","◒"],o=Z(0);let s=null;function i(){s===null&&(o.value=0,s=setInterval(()=>{o.value=(o.value+1)%n.length},250))}function r(){s!==null&&(clearInterval(s),s=null),o.value=0}Je(e,a=>{a?i():r()},{immediate:!0});const l=R(()=>`${e.value?`${n[o.value]} `:""}${t}`);I4(()=>{typeof document<"u"&&(document.title=l.value)}),bn(()=>{r()})}const Vhe=50,am=5,O5=5,xg=50,qhe=40401,Khe=40402,Zhe=40410,Ghe=40409,Yhe=40902,Xhe=2e3,Jhe=10;function y4(e){return Us(e)&&e.code===Yhe}const Qhe=40904;function eme(e){return Us(e)&&e.code===Qhe}const Hu=Go({}),Lh=Go({}),k4=Go({}),cl=Go(new Set),N2=new Map,wc=new Map,Sg=new Map;let tme=0;const ju=new Map,nme=3;let Dx=0;function ome(){return Dx+=1,`${Date.now().toString(36)}-${Dx}`}function sme(e){return{generation:N2.get(e)??0,pending:(wc.get(e)?.size??0)>0}}function y8(e){const t=++tme;N2.set(e,t);const n=wc.get(e)??new Set;return n.add(t),wc.set(e,n),t}function k8(e,t){const n=wc.get(e);if(n===void 0||(n.delete(t),n.size>0))return;wc.delete(e);const o=Sg.get(e);Sg.delete(e),o?.()}function ime(e){N2.delete(e),wc.delete(e),Sg.delete(e),ju.delete(e)}function rme(e,t){return!t.pending&&t.generation===(N2.get(e)??0)}function lme(e,t){if((wc.get(e)?.size??0)===0){t();return}Sg.set(e,t)}function ame(e,t){const{t:n}=Hn.global,{confirm:o}=hu(),{taskPoller:s,sideChat:i,modelProvider:r,pushOperationFailure:l,activity:a,sessionsKnownEmpty:u,setSessions:c,updateSession:d,upsertSessionFront:f,appendSession:h,forgetSession:m,unpinSessions:v,setActiveSessionId:k,updateSessionMessages:w,nextOptimisticMsgId:b,getEventConn:_,syncSessionFromSnapshot:g,reopenSession:x,hasLoadedMessages:S,refreshSessionStatus:T,refreshSessionGoal:A,refreshSessionPlans:E,persistSessionProfile:P,mergedWorkspaces:D,workspacesView:I,status:$,workspaceIdForSession:B,savePermissionToStorage:H,savePlanModeToStorage:O,saveSwarmModeToStorage:F,saveGoalModeToStorage:U,draftModes:z,saveUnread:W,saveActiveWorkspaceToStorage:K,saveHiddenWorkspacesToStorage:V,goalErrorMessage:ie,initialized:ne,connectIssue:X,selectedDiffPath:le,fileDiffLines:Ie,fileDiffLoading:de,fileDiffTexts:pe,fileDiffEmptyFile:ve}=t;let oe=!1,ye=0;function G(se,xe,J,Ce){w(se,$e=>{const He=$e.findIndex(Et=>Et.id===xe);if(He===-1)return $e;const vt=$e.findIndex((Et,ln)=>ln!==He&&Et.role==="user"&&(Et.id===Ce||Et.userMessageId===Ce||Et.promptId===J)),ut=$e[He],Dt=vt===-1?ut:$e[vt];return $e.flatMap((Et,ln)=>ln===vt?[]:ln!==He?[Et]:[{...Dt,id:ut.id,promptId:J,userMessageId:Ce,metadata:{...Dt.metadata,...ut.metadata}}])})}async function Y(se){if(e.messagesLoadingMoreBySession[se])return;const xe=e.messagesBySession[se];if(!xe||xe.length===0)return;const J=xe[0].id;e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!0},e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!1};try{const Ce=await _t().listMessages(se,{beforeId:J,pageSize:Vhe}),$e=[...Ce.items].reverse();w(se,He=>[...$e,...He]),e.messagesHasMoreBySession={...e.messagesHasMoreBySession,[se]:Ce.hasMore}}catch(Ce){e.messagesLoadMoreErrorBySession={...e.messagesLoadMoreErrorBySession,[se]:!0},l("loadOlderMessages",Ce,{sessionId:se})}finally{e.messagesLoadingMoreBySession={...e.messagesLoadingMoreBySession,[se]:!1}}}function fe(se,xe){s.loadTasksForSession(se),Q(se),xe?.skipStatus!==!0&&T(se),A(se),E(se),Object.prototype.hasOwnProperty.call(r.skillsBySession.value,se)||r.loadSkillsForSession(se)}async function we(se){const xe=e.activeSessionId;if(xe){le.value=se,Ie.value=[],pe.value=null,ve.value=!1,de.value=!0;try{const Ce=await _t().getFileDiff(xe,se);if(le.value!==se||e.activeSessionId!==xe)return;const $e=wX(Ce.diff);if(Ie.value=$e,$e.length===0){const vt=await Ei(se).catch(()=>null);if(le.value!==se||e.activeSessionId!==xe)return;ve.value=vt!==null&&vt.size===0;return}de.value=!1;const He=await cX($e,{truncated:Ce.truncated,readNewText:async()=>{const vt=await Ei(se).catch(()=>null);return!vt||vt.isBinary||vt.encoding!=="utf-8"?null:vt.content}});if(le.value!==se||e.activeSessionId!==xe)return;pe.value=He}catch(J){le.value===se&&(Ie.value=[]),gl("[loadFileDiff] diff unavailable for",se,J)}finally{le.value===se&&(de.value=!1)}}}function ge(){le.value=null,Ie.value=[],pe.value=null,ve.value=!1,de.value=!1}async function Q(se){try{const J=await _t().getGitStatus(se);e.gitStatusBySession={...e.gitStatusBySession,[se]:J}}catch{}}let te=0;async function ce(se){try{const xe=await _t().getUserInfo();if(se!==te||e.managedProviderStatus!=="authenticated")return;e.managedUserInfo=xe.kind==="ok"?xe.userInfo:null,xe.kind==="ok"?e.managedMembership=xe.userInfo.userLevel===Jhe?"free":"member":e.managedMembership=xe.status===402?"free":null}catch{if(se!==te)return;e.managedProviderStatus==="authenticated"&&(e.managedUserInfo=null,e.managedMembership=null)}}async function ue(){e.managedProviderStatus==="authenticated"&&await ce(++te)}async function Se(){const se=++te;try{const J=await _t().getAuth();return e.authReady=J.ready,e.defaultModel=J.defaultModel,e.managedProviderStatus=J.managedProvider?.status??null,e.managedProviderStatus==="authenticated"?ce(se):(e.managedUserInfo=null,e.managedMembership=null),X.value=null,"proceed"}catch(xe){return Us(xe)&&(xe.code===401||xe.code===PM)?(X.value=null,"server-auth-required"):(X.value=(xe instanceof Error?xe.message:String(xe)).slice(0,140),"retry")}}async function ze(){let se=!0;for(;;){const xe=await Se();if(xe!=="retry")return xe;se&&(X.value=null,se=!1),await new Promise(J=>{setTimeout(J,Xhe)})}}async function _e(){try{const se=_t();e.config=await se.getConfig()}catch{}}async function Ee(se){try{const J=await _t().setConfig(se);return e.config=J,e.defaultModel=J.defaultModel??null,!0}catch(xe){return l("setConfig",xe),!1}}const it=100,Fe=720*60*1e3;async function Oe(se){const xe=_t(),J=[];let Ce,$e;for(;se?.shouldContinue?.()!==!1;){let He;try{He=await xe.listSessions({pageSize:it,beforeId:Ce,excludeEmpty:!0})}catch(vt){if(J.length===0)throw vt;$e=vt;break}if(J.push(...He.items),!He.hasMore||He.items.length===0)break;Ce=He.items[He.items.length-1].id}return{sessions:J,error:$e}}function Ge(se){const xe=new Map(e.sessions.map(J=>[J.id,J]));c(se.map(J=>{const Ce=xe.get(J.id);if(Ce===void 0)return J;const $e=o3(J.usage)&&!o3(Ce.usage),He=J.pullRequest??Ce.pullRequest;return!$e&&He===J.pullRequest?J:{...J,usage:$e?Ce.usage:J.usage,pullRequest:He}}))}function at(se){const xe=[...se],J=new Set(xe.map(Ce=>Ce.id));for(const Ce of e.sessions)J.has(Ce.id)||(xe.push(Ce),J.add(Ce.id));return xe.sort((Ce,$e)=>new Date($e.updatedAt).getTime()-new Date(Ce.updatedAt).getTime()),xe}async function Tt(se){const xe=_t(),J=[],Ce=Date.now(),$e=Et=>Ce-new Date(Et.updatedAt).getTime();let He,vt=!1,ut=!0,Dt;for(;;){let Et;try{Et=await xe.listSessions({workspaceId:se,pageSize:am,beforeId:He,excludeEmpty:!0})}catch(Ot){if(ut)throw Ot;Dt=Ot,vt=!0;break}if(vt=Et.hasMore,Et.items.length===0)break;const ln=Et.items[Et.items.length-1],oo=$e(ln)>=Fe;if(!ut&&oo){const Ot=Et.items.findIndex(Yn=>$e(Yn)>=Fe),Pt=Ot>=0?Ot+1:Et.items.length;J.push(...Et.items.slice(0,Pt)),vt=Et.hasMore||PtTt(Ot.id))),J=[],Ce=new Set,$e=new Map,He=new Set;let vt;for(let Ot=0;OtHe.has(Ot.id)).map(Ot=>Ot.root)),Dt=new Set(se.map(Ot=>Ot.id));for(const Ot of e.sessions)!(Ot.workspaceId!==void 0&&Dt.has(Ot.workspaceId)?He.has(Ot.workspaceId):ut.has(Ot.cwd)||He.has(B(Ot)))||Ce.has(Ot.id)||(J.push(Ot),Ce.add(Ot.id));const Et={},ln={},oo={};for(const{id:Ot}of se){const Pt=$e.get(Ot);if(Pt===void 0){const Yn=e.sessionsHasMoreByWorkspace[Ot],ko=e.sessionsCursorByWorkspace[Ot],vs=e.sessionsInitialCountByWorkspace[Ot];Yn!==void 0&&(Et[Ot]=Yn),ko!==void 0&&(ln[Ot]=ko),vs!==void 0&&(oo[Ot]=vs);continue}Et[Ot]=Pt.hasMore,ln[Ot]=Pt.items.length>0?Pt.items[Pt.items.length-1].id:void 0,oo[Ot]=Math.max(Pt.items.length,am)}return e.sessionsHasMoreByWorkspace=Et,e.sessionsCursorByWorkspace=ln,e.sessionsInitialCountByWorkspace=oo,e.sessionsFullyLoaded=!1,J.sort((Ot,Pt)=>new Date(Pt.updatedAt).getTime()-new Date(Ot.updatedAt).getTime()),He.size>0&&l("load",vt),J}async function Yt(se){if(!e.sessionsLoadingMoreByWorkspace[se]&&e.sessionsHasMoreByWorkspace[se]!==!1&&e.sessionsCursorByWorkspace[se]!==void 0){e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!0};try{let xe=e.sessionsCursorByWorkspace[se],J;for(let He=0;He<3&&xe!==void 0&&(J=await _t().listSessions({workspaceId:se,pageSize:O5,beforeId:xe,excludeEmpty:!0}),e.sessionsCursorByWorkspace[se]!==xe);He+=1)J=void 0,xe=e.sessionsCursorByWorkspace[se];if(J===void 0)return;const Ce=new Set(e.sessions.map(He=>He.id)),$e=J.items.filter(He=>!Ce.has(He.id));$e.length>0&&c([...e.sessions,...$e]),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:J.items.length>0?J.items[J.items.length-1].id:xe},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:J.hasMore}}catch(xe){l("loadMoreSessions",xe)}finally{e.sessionsLoadingMoreByWorkspace={...e.sessionsLoadingMoreByWorkspace,[se]:!1}}}}function Sn(se){return e.sessions.filter(xe=>!xe.parentSessionId&&B(xe)===se)}const on=5;function en(se,xe){const J=new Set(e.sessions.map(He=>He.id)),Ce=se.items.filter(He=>!J.has(He.id)&&(He.meta.last_prompt??"").length>0).map(kU);Ce.length>0&&c([...e.sessions,...Ce]);for(const He of se.items)if(J.has(He.id)&&He.git!==void 0){const vt=He.git.pull_request;d(He.id,ut=>ut.pullRequest===vt?ut:{...ut,pullRequest:vt})}if(se.items.length>0){const He=Math.min(...se.items.map(vt=>vt.meta.updated_at));e.flatSessionsFrontier=xe?.resetFrontier===!0||e.flatSessionsFrontier===null?He:Math.min(e.flatSessionsFrontier,He)}e.flatSessionsNextPageToken=se.nextPageToken,e.flatSessionsHasMore=se.hasMore;const $e=new Set(I.value.map(He=>He.id));return se.items.filter(He=>(He.meta.last_prompt??"").length>0&&$e.has(B({workspaceId:He.workspace.id,cwd:He.workspace.cwd??""}))).length}async function Cn(){const se=await _t().listSessionsV2({pageSize:xg,include:"git"});en(se,{resetFrontier:!0}),e.flatSessionsSeeded=!0}async function Mn(){if(!(e.flatSessionsSeeded||e.flatSessionsLoading)){e.flatSessionsLoading=!0;try{await Cn()}catch(se){l("ensureFlatSessions",se)}finally{e.flatSessionsLoading=!1}}}async function We(){if(!(e.flatSessionsLoading||e.flatSessionsLoadingMore)&&e.flatSessionsHasMore){e.flatSessionsLoadingMore=!0;try{if(!e.flatSessionsSeeded){await Cn();return}if(e.flatSessionsNextPageToken===null)return;for(let se=0;se0)break}}catch(se){l("loadMoreFlatSessions",se)}finally{e.flatSessionsLoadingMore=!1}}}async function tt(se,xe,J,Ce){if(e.sessionsCursorByWorkspace[se]===xe){const He=new Date(J).getTime();let vt;for(const ut of e.sessions){if(B(ut)!==se)continue;const Dt=new Date(ut.updatedAt).getTime();Dt<=He||(vt===void 0||Dt0&&Sn(se).lengthln.id)),Et=ut.items.filter(ln=>!Dt.has(ln.id));Et.length>0&&c([...e.sessions,...Et].sort((ln,oo)=>new Date(oo.updatedAt).getTime()-new Date(ln.updatedAt).getTime())),e.sessionsCursorByWorkspace={...e.sessionsCursorByWorkspace,[se]:ut.items.length>0?ut.items[ut.items.length-1].id:void 0},e.sessionsHasMoreByWorkspace={...e.sessionsHasMoreByWorkspace,[se]:ut.hasMore}}catch(ut){l("loadMoreSessions",ut);break}else await Yt(se);if($e-=1,Sn(se).length===vt&&e.sessionsCursorByWorkspace[se]===He)break}}async function Ue(){if(e.sessionsFullyLoaded)return;const se=await Oe().catch(Ce=>(gl("[kimi-web] loadAllSessions failed; search covers only loaded sessions",Ce),null));if(se===null)return;const xe=se.error===void 0?se.sessions:at(se.sessions);if(Ge(xe),e.sessionsFullyLoaded=se.error===void 0,se.error!==void 0)return;const J={};for(const Ce of e.workspaces)J[Ce.id]=!1;e.sessionsHasMoreByWorkspace=J}async function Lt(){const se=await _t().getMeta().catch(()=>null);se!==null&&(e.serverVersion=se.serverVersion,e.availableOpenInApps=se.openInApps,e.dangerousBypassAuth=se.dangerousBypassAuth,e.experimentalFlags=se.experimentalFlags,e.backend=se.backend)}async function gt(){const se=Date.now();let xe="accepted";bi("app:load:start"),e.loading=!0;const J=!ne.value;let Ce=!0;try{if(J&&await ze()==="server-auth-required"){Ce=!1,xe="auth-required";return}const $e=_t();await Promise.all([$e.getHealth().catch(()=>null),Lt(),r.loadModels()]),J||await Se(),await _e(),await wn();const He=await Bt(),vt=He??e.sessions;if(He!==void 0&&Ge(He),!J&&He!==void 0&&e.flatSessionsSeeded){e.flatSessionsSeeded=!1,e.flatSessionsNextPageToken=null,e.flatSessionsHasMore=!0,e.flatSessionsFrontier=null;try{await Cn()}catch(Ot){l("ensureFlatSessions",Ot)}}const ut=_E().filter(Ot=>!e.sessions.some(Pt=>Pt.id===Ot));if(ut.length>0){const Ot=await Promise.all(ut.map(Yn=>$s(Yn))),Pt=ut.filter((Yn,ko)=>Ot[ko]==="stale");Pt.length>0&&v(Pt)}const Dt=vt[0],Et=e.activeWorkspaceId;!(Et!==null&&D.value.some(Ot=>Ot.id===Et))&&Dt&&go(B(Dt)),Oo();const oo=typeof window<"u"?Qb(window.location):void 0;!e.activeSessionId&&oo!==void 0&&(e.sessions.some(Pt=>Pt.id===oo)||await no(oo))&&await vo(oo,{urlMode:"replace"}),!e.activeSessionId&&vt.length>0&&await vo(vt[0].id,{urlMode:"replace"})}catch($e){xe="failed",l("load",$e)}finally{e.loading=!1,Ce&&(ne.value=!0),bi("app:load:complete",{status:xe,sessionId:e.activeSessionId,sessionCount:e.sessions.length,workspaceCount:e.workspaces.length,durationMs:Date.now()-se})}}async function wn(){try{const se=_t(),[xe,J]=await Promise.all([se.listWorkspaces().catch(()=>[]),se.getFsHome().catch(()=>({home:"",recentRoots:[]}))]);e.workspaces=yn(xe),e.fsHome=J.home||null,e.recentRoots=J.recentRoots}catch{}}function yn(se){const xe=lh();return Object.keys(xe).length===0?se:se.map(J=>{const Ce=xe[J.root];return Ce!==void 0?{...J,name:Ce}:J})}function go(se){e.activeWorkspaceId=se,K(se)}function qt(se){go(se);const xe=e.sessions.filter(J=>B(J)===se);if(xe.length>0){const J=xe[0];J&&J.id!==e.activeSessionId&&vo(J.id)}else k(void 0),Nn(void 0,"push")}function ps(se){const xe=lh()[se.root],J=xe!==void 0?{...se,name:xe}:se,Ce=Pr(J.root);e.hiddenWorkspaceRoots.some(vt=>Pr(vt)===Ce)&&(e.hiddenWorkspaceRoots=e.hiddenWorkspaceRoots.filter(vt=>Pr(vt)!==Ce),V(e.hiddenWorkspaceRoots));const $e=e.workspaces.findIndex(vt=>vt.id===J.id||vt.root===J.root);if($e===-1){e.workspaces=[J,...e.workspaces];return}const He=[...e.workspaces];He[$e]=J,e.workspaces=He}function xs(se){if(se.type==="workspaceCreated"||se.type==="workspaceUpdated"){ps(se.workspace);return}const xe=e.workspaces.find(Ce=>Ce.id===se.workspaceId)?.root??se.root;if(xe&&!e.hiddenWorkspaceRoots.includes(xe)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,xe],V(e.hiddenWorkspaceRoots)),e.workspaces=e.workspaces.filter(Ce=>Ce.id!==se.workspaceId&&Ce.root!==xe),e.activeWorkspaceId===se.workspaceId||e.activeWorkspaceId===xe){const Ce=I.value[0]?.id??null;if(e.activeWorkspaceId=Ce,Ce)K(Ce);else try{ur(cn.activeWorkspace)}catch{}k(void 0),e.sessionLoading=!1,ge(),Nn(void 0,"replace")}}function _n(){k(void 0),Nn(void 0,"push")}function In(se){go(se),_n(),ge()}async function To(se){const xe=D.value.find(ln=>ln.id===se);if(!xe)return null;const J=e.thinking,Ce=_t();let $e,He=xe.root;try{const ln=await Ce.addWorkspace({root:xe.root});$e=ln.id,He=ln.root,ps(ln)}catch{}const vt=r.draftModel.value??void 0,ut=await Ce.createSession({workspaceId:$e,cwd:He,model:vt});r.draftModel.value=null;const Dt=vt!==void 0&&(!ut.model||ut.model.length===0)?{...ut,model:vt}:ut;f(Dt);const Et=ut.id;return J!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[Et]:J},k3(e,Et)),go(ut.workspaceId??$e??se),await vo(ut.id,{skipStatusRefresh:!0}),z.planMode&&(e.planModeBySession={...e.planModeBySession,[Et]:!0},O()),z.swarmMode&&(e.swarmModeBySession={...e.swarmModeBySession,[Et]:!0},F()),z.goalMode&&(e.goalModeBySession={...e.goalModeBySession,[Et]:!0},U()),z.planMode=!1,z.swarmMode=!1,z.goalMode=!1,Et}async function lo(se,xe,J){if(cl.has(se))return null;cl.add(se);let Ce=null;try{const $e=await To(se);return $e?(Ce=$e,await Po($e,xe,J),$e):null}catch($e){return l("startSessionAndSendPrompt",$e),Ce}finally{cl.delete(se)}}async function St(se,xe,J,Ce){if(cl.has(se))return null;cl.add(se);let $e=null;try{const He=await To(se);if(!He)return null;$e=He;const vt=e.planModeBySession[He]??!1,ut=e.swarmModeBySession[He]??!1,Dt=e.sessions.find(Ot=>Ot.id===He),Et=(Dt?.model&&Dt.model.length>0?Dt.model:e.defaultModel)??void 0,ln=await r.resolveThinkingForPrompt(He,Et)??e.thinking;return await P({model:Et,planMode:vt,swarmMode:ut,permissionMode:e.permission,thinking:ln},He)&&await r.activateSkill(xe,J,Ce,He,{skipThinkingPersist:!0}),He}catch(He){return l("startSessionAndActivateSkill",He),$e}finally{cl.delete(se)}}async function hs(se,xe){if(cl.has(se))return null;cl.add(se);let J=null;try{const Ce=await To(se);return Ce?(J=Ce,await i.openSideChatOn(Ce,xe),Ce):null}catch(Ce){return l("startSessionAndOpenSideChat",Ce),J}finally{cl.delete(se)}}async function Jo(se){const xe=se.trim();if(!xe)return!1;const J=_t();try{const Ce=await J.addWorkspace({root:xe});return ps(Ce),In(Ce.id),!0}catch(Ce){return gl("[kimi-web] addWorkspaceByPath failed for",xe,Ce),!1}}async function uo(se){try{return await _t().browseFs(se)}catch{return{path:"",parent:null,entries:[]}}}async function Ys(){try{return await _t().getFsHome()}catch{return{home:"",recentRoots:[]}}}function Nn(se,xe){if(xe==="none"||typeof window>"u"||!window.history)return;const J=fQ(se);if(window.location.pathname!==J)try{xe==="push"?window.history.pushState(null,"",J):window.history.replaceState(null,"",J)}catch{}}async function no(se){try{const xe=await _t().getSession(se);return e.sessions.some(J=>J.id===xe.id)||h(xe),!0}catch{return!1}}async function $s(se){try{const xe=await _t().getSession(se);return xe.archived?"stale":(e.sessions.some(J=>J.id===xe.id)||h(xe),"ok")}catch(xe){return Us(xe)&&xe.code===qhe?"stale":"retry"}}function Xs(){const se=Qb(window.location);if(se===void 0){k(void 0);return}if(se!==e.activeSessionId){if(e.sessions.some(xe=>xe.id===se)){vo(se,{urlMode:"none"});return}(async()=>{if(await no(se)){await vo(se,{urlMode:"none"});return}const xe=e.sessions[0];xe?await vo(xe.id,{urlMode:"replace"}):(k(void 0),Nn(void 0,"replace"))})()}}let ci=!1;function Oo(){ci||typeof window>"u"||(ci=!0,window.addEventListener("popstate",Xs))}async function vo(se,xe){if(!e.sessions.some($e=>$e.id===se)){const $e=++ye;if(!await no(se)||$e!==ye)return}const J=S(se),Ce=!J&&u.has(se);u.delete(se);try{Nn(se,xe?.urlMode??"push"),e.sessionLoading=!J&&!Ce,k(se),e.unreadBySession[se]&&(e.unreadBySession={...e.unreadBySession,[se]:!1},W({[se]:!1})),ge();const $e=e.sessions.find(He=>He.id===se);if($e){const He=B($e);e.activeWorkspaceId!==He&&go(He)}if(J){if(await x(se)==="not-found")return}else if(await g(se,{skipStatusRefresh:xe?.skipStatusRefresh===!0})==="not-found")return;fe(se,{skipStatus:xe?.skipStatusRefresh===!0})}catch($e){l("selectSession",$e,{sessionId:se})}finally{e.activeSessionId===se&&(e.sessionLoading=!1)}}async function Po(se,xe,J){const Ce=y8(se);e.inFlightBySession={...e.inFlightBySession,[se]:!0};const $e=b();let He=e.pendingThinkingBySession[se];try{const vt=_t(),ut=[];if(xe&&ut.push({type:"text",text:xe}),ut.push(...m8(J)),ut.length===0)return e.inFlightBySession={...e.inFlightBySession,[se]:!1},"rejected";const Dt={id:$e,sessionId:se,role:"user",content:ut,createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};w(se,vs=>[...vs,Dt]);const Et=e.sessions.find(vs=>vs.id===se),ln=(Et?.model&&Et.model.length>0?Et.model:e.defaultModel)??void 0,oo=e.planModeBySession[se]??!1,Ot=e.swarmModeBySession[se]??!1,Pt=e.goalModeBySession[se]??!1;if(Pt&&xe)try{await vt.updateSession(se,{goalObjective:xe.trim()})}catch(vs){return vl(e,se,He)&&T(se),l("createGoal",vs,{sessionId:se}),e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,Os=>Os.some(ei=>ei.id===$e)?Os.filter(ei=>ei.id!==$e):Os),"rejected"}const Yn=await r.resolveThinkingForPrompt(se,ln)??e.thinking;He=e.pendingThinkingBySession[se];const ko=await vt.submitPrompt(se,{content:ut,model:ln,thinking:Yn,permissionMode:e.permission,planMode:oo,swarmMode:Ot});return Yn!==void 0&&vl(e,se,He),Pt&&(e.goalModeBySession={...e.goalModeBySession,[se]:!1},U()),e.promptIdBySession={...e.promptIdBySession,[se]:ko.promptId},G(se,$e,ko.promptId,ko.userMessageId),_()?.bindNextPromptId(se,ko.promptId),"ok"}catch(vt){return e.inFlightBySession={...e.inFlightBySession,[se]:!1},w(se,ut=>ut.some(Dt=>Dt.id===$e)?ut.filter(Dt=>Dt.id!==$e||Dt.promptId!==void 0||Dt.userMessageId!==void 0):ut),vl(e,se,He)&&T(se),l("sendPrompt",vt,{sessionId:se}),Us(vt)?"rejected":"uncertain"}finally{k8(se,Ce)}}async function co(se,xe){const J=e.activeSessionId;if(J){if(a.value!=="idle"||e.inFlightBySession[J]){Qe(se,xe);return}if((e.queuedBySession[J]?.length??0)>0){Qe(se,xe),st(J);return}await Po(J,se,xe)}}async function Tn(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[],$e=[],He=[];for(const Pt of Ce){const Yn=Pt.text.trim();Yn&&$e.push(Yn),Pt.attachments?.length&&He.push(...Pt.attachments)}const vt=se.trim();if(vt&&$e.push(vt),xe?.length&&He.push(...xe),$e.length===0&&He.length===0)return;Ce.length>0&&(e.queuedBySession={...e.queuedBySession,[J]:[]});const ut=$e.join(` `),Dt=()=>{if(Ce.length===0)return;const Pt=e.queuedBySession[J]??[];e.queuedBySession={...e.queuedBySession,[J]:[...Ce,...Pt]}};if(a.value==="idle"&&!e.inFlightBySession[J]){await Po(J,ut,He)==="rejected"&&Dt();return}const Et=[];ut&&Et.push({type:"text",text:ut});for(const Pt of He)Pt.kind==="video"?Et.push({type:"video",source:{kind:"file",fileId:Pt.fileId}}):Pt.kind==="file"?Et.push({type:"file",fileId:Pt.fileId,name:Pt.name??"",mediaType:Pt.mediaType||"application/octet-stream",size:Pt.size??0}):Et.push({type:"image",source:{kind:"file",fileId:Pt.fileId}});const ln=b(),oo={id:ln,sessionId:J,role:"user",content:Et,createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};w(J,Pt=>[...Pt,oo]);const Ot=y8(J);try{const Pt=_t(),Yn=e.sessions.find(Lc=>Lc.id===J),ko=(Yn?.model&&Yn.model.length>0?Yn.model:e.defaultModel)??void 0,vs=await r.resolveThinkingForPrompt(J,ko)??e.thinking,Os=e.pendingThinkingBySession[J],ei=await Pt.submitPrompt(J,{content:Et,model:ko,thinking:vs,permissionMode:e.permission,planMode:e.planModeBySession[J]??!1,swarmMode:e.swarmModeBySession[J]??!1});if(vs!==void 0&&vl(e,J,Os),G(J,ln,ei.promptId,ei.userMessageId),ei.status!=="queued"){e.promptIdBySession={...e.promptIdBySession,[J]:ei.promptId},_()?.bindNextPromptId(J,ei.promptId);return}try{await Pt.steerPrompts(J,[ei.promptId])}catch{}}catch(Pt){w(J,Yn=>Yn.filter(ko=>ko.id!==ln||ko.promptId!==void 0||ko.userMessageId!==void 0)),Us(Pt)&&Dt(),l("steer",Pt,{sessionId:J})}finally{k8(J,Ot)}}async function fo(se,xe){try{const Ce=await _t().uploadFile({file:se,name:xe});return{fileId:Ce.id,name:Ce.name,mediaType:Ce.mediaType}}catch(J){return l("uploadImage",J),null}}function Qe(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[],$e={text:se,attachments:xe,id:ome()};e.queuedBySession={...e.queuedBySession,[J]:[...Ce,$e]}}function st(se){const[xe,...J]=e.queuedBySession[se]??[];xe!==void 0&&(e.queuedBySession={...e.queuedBySession,[se]:J},Po(se,xe.text,xe.attachments).then(Ce=>{if(Ce==="ok"){ju.delete(se);return}if(Ce==="uncertain"){ju.delete(se);return}if(!e.sessions.some(Dt=>Dt.id===se)){ju.delete(se);return}const $e=xe.id??xe.text,He=ju.get(se),vt=He!==void 0&&He.key===$e?He.count+1:1;if(vt>=nme){ju.delete(se),(e.queuedBySession[se]?.length??0)>0&&st(se);return}ju.set(se,{key:$e,count:vt});const ut=e.queuedBySession[se]??[];e.queuedBySession={...e.queuedBySession,[se]:[xe,...ut]}}))}function Ct(se,xe){const J=e.inFlightBySession[se]===!0;if(e.inFlightBySession={...e.inFlightBySession,[se]:!1},e.promptIdBySession[se]!==void 0){const $e={...e.promptIdBySession};delete $e[se],e.promptIdBySession=$e}return(J||xe?.turnWasActive===!0||(e.turnActiveBySession[se]??!1))&&st(se),J}function Qt(se,xe){xe.inFlightTurn!==null&&xe.busy||Ct(se)}async function kn(){const se=e.activeSessionId;if(!se)return!1;const xe=e.sessions.find(ut=>ut.id===se);let J=e.promptIdBySession[se];if(J===void 0){const ut=xe?.currentPromptId;ut!==void 0&&ut.length>0&&!ut.startsWith("pr_")&&(J=ut)}const Ce=_t();let $e=!1;const He=()=>{e.inFlightBySession={...e.inFlightBySession,[se]:!1},e.turnActiveBySession={...e.turnActiveBySession,[se]:!1}};if(J!==void 0)try{if((await Ce.abortPrompt(se,J)).aborted)return!0;$e=!0;const Dt={...e.promptIdBySession};delete Dt[se],e.promptIdBySession=Dt,He()}catch(ut){if(Us(ut)&&ut.code===Khe){$e=!0;const Dt={...e.promptIdBySession};delete Dt[se],e.promptIdBySession=Dt,He()}else return l("abortCurrentPrompt",ut,{sessionId:se}),!1}if($e||!((e.inFlightBySession[se]??!1)||(e.turnActiveBySession[se]??!1)||(xe?.mainTurnActive??!1)))return!1;try{return(await Ce.abortSession(se)).aborted===!0}catch(ut){return l("abortCurrentPrompt",ut,{sessionId:se}),!1}}function Ko(se,xe){const J=e.approvalsBySession[se]??[];e.approvalsBySession={...e.approvalsBySession,[se]:J.filter(Ce=>Ce.approvalId!==xe)}}function Eo(se,xe){const J=e.questionsBySession[se]??[];e.questionsBySession={...e.questionsBySession,[se]:J.filter(Ce=>Ce.questionId!==xe)}}async function bo(se,xe){const J=e.activeSessionId;if(!J||Lh[se])return;Lh[se]=!0;const Ce=e.approvalsBySession[J]?.find($e=>$e.approvalId===se&&$e.toolName==="ExitPlanMode")?.toolCallId;try{const $e=_t(),He={decision:xe.decision,scope:xe.scope,feedback:xe.feedback,selectedLabel:xe.selectedLabel};await $e.respondApproval(J,se,He),Ko(J,se),Ce!==void 0&&E(J,Ce)}catch($e){y4($e)?(Ko(J,se),Ce!==void 0&&E(J,Ce)):l("respondApproval",$e,{sessionId:J})}finally{delete Lh[se]}}async function Ns(se,xe){const J=e.activeSessionId;if(J&&!Hu[se]){Hu[se]="answer";try{await _t().respondQuestion(J,se,xe),Eo(J,se)}catch(Ce){y4(Ce)?Eo(J,se):l("respondQuestion",Ce,{sessionId:J})}finally{delete Hu[se]}}}async function Do(se){const xe=e.activeSessionId;if(xe&&!Hu[se]){Hu[se]="dismiss";try{await _t().dismissQuestion(xe,se),Eo(xe,se)}catch(J){y4(J)?Eo(xe,se):l("dismissQuestion",J,{sessionId:xe})}finally{delete Hu[se]}}}async function Io(se){const xe=e.activeSessionId;if(xe&&!k4[se]){k4[se]=!0;try{const J=_t(),Ce=(e.tasksBySession[xe]??[]).find(He=>He.id===se)?.backgroundTaskId;await J.cancelTask(xe,Ce??se);const $e=e.tasksBySession[xe]??[];e.tasksBySession={...e.tasksBySession,[xe]:$e.map(He=>He.id===se?{...He,status:"cancelled"}:He)}}catch(J){eme(J)||l("cancelTask",J,{sessionId:xe})}finally{delete k4[se]}}}function Qo(se){const xe=e.activeSessionId;xe?(e.planModeBySession={...e.planModeBySession,[xe]:se},O(),P({planMode:se})):z.planMode=se}function sn(){const se=e.activeSessionId,xe=se?e.planModeBySession[se]??!1:z.planMode;Qo(!xe)}function es(se){const xe=e.activeSessionId;xe?(e.swarmModeBySession={...e.swarmModeBySession,[xe]:se},F(),P({swarmMode:se})):z.swarmMode=se}async function ms(){const se=e.activeSessionId,J=!(se?e.swarmModeBySession[se]??!1:z.swarmMode);J&&e.permission==="manual"&&!await o({title:n("workspace.swarmEnableTitle"),message:n("workspace.swarmEnableConfirm"),variant:"primary"})||es(J)}function Tr(se){const xe=e.activeSessionId;xe?(e.goalModeBySession={...e.goalModeBySession,[xe]:se},U()):z.goalMode=se}function ts(){const se=e.activeSessionId,xe=se?e.goalModeBySession[se]??!1:z.goalMode;Tr(!xe)}async function Ki(se){const xe=se.trim();if(!xe||e.permission==="manual"&&!await o({title:n("workspace.goalStartTitle"),message:n("workspace.goalStartConfirm",{objective:xe}),variant:"primary"}))return null;let J=e.activeSessionId,Ce=null;if(!J){const $e=e.activeWorkspaceId,He=$e&&I.value.some(vt=>vt.id===$e)?$e:I.value[0]?.id??null;if(!He)return null;try{J=await To(He)??void 0,Ce=J??null}catch(vt){return l("createGoal",vt),null}if(!J)return null}try{await _t().updateSession(J,{goalObjective:xe})}catch($e){return l("createGoal",$e,{sessionId:J,message:ie($e)}),Ce}return e.goalModeBySession[J]&&(e.goalModeBySession={...e.goalModeBySession,[J]:!1},U()),e.activeSessionId===J?await co(xe):await Po(J,xe),Ce}function Js(se){const xe=e.activeSessionId;xe&&Promise.resolve(_t().updateSession(xe,{goalControl:se})).catch(J=>{l("controlGoal",J,{sessionId:xe,message:ie(J)})})}function Bo(se){e.permission=se,H(se),P({permissionMode:se})}function Zo(se){const xe=[...e.warnings];xe.splice(se,1),e.warnings=xe}async function Il(se,xe){try{await _t().updateSession(se,{title:xe}),d(se,Ce=>({...Ce,title:xe}))}catch(J){l("renameSession",J,{sessionId:se})}}async function Zi(se,xe){const J=e.workspaces.find($e=>$e.id===se)?.root,Ce=()=>{e.workspaces=e.workspaces.map($e=>$e.id===se?{...$e,name:xe}:$e)};try{if(await _t().updateWorkspace(se,{name:xe}),J!==void 0){const $e=lh();J in $e&&(delete $e[J],tC($e))}Ce()}catch($e){if(J!==void 0&&Us($e)&&$e.code===Zhe){tC({...lh(),[J]:xe}),Ce();return}l("renameWorkspace",$e)}}async function tl(se){const xe=e.workspaces.find(He=>He.id===se)?.root??D.value.find(He=>He.id===se)?.root??se,J=e.activeSessionId?e.sessions.find(He=>He.id===e.activeSessionId):void 0,Ce=e.activeWorkspaceId===se||e.activeWorkspaceId===xe,$e=!!(J&&(J.cwd===xe||J.workspaceId===se||B(J)===se));xe&&!e.hiddenWorkspaceRoots.includes(xe)&&(e.hiddenWorkspaceRoots=[...e.hiddenWorkspaceRoots,xe],V(e.hiddenWorkspaceRoots));try{await _t().deleteWorkspace(se)}catch(He){gl("[kimi-web] deleteWorkspace registry cleanup failed for",se,He)}if(e.workspaces=e.workspaces.filter(He=>He.id!==se&&He.root!==xe),Ce||$e){const He=I.value[0]?.id??null;if(e.activeWorkspaceId=He,He)K(He);else try{ur(cn.activeWorkspace)}catch{}}(Ce||$e)&&(k(void 0),e.sessionLoading=!1,ge(),Nn(void 0,"replace"))}async function Ho(se){try{const xe=_t(),J=e.sessions.find(ut=>ut.id===se),Ce=J!==void 0?B(J):void 0,$e=Ce!==void 0?Sn(Ce).length:0;await xe.archiveSession(se),m(se),J!==void 0&&Ce!==void 0&&tt(Ce,se,J.updatedAt,$e),i.clearSideChatForSession(se);const{[se]:He,...vt}=e.sideChatUserMessageIdsBySession;if(e.sideChatUserMessageIdsBySession=vt,e.activeSessionId===se){const ut=e.sessions[0];ut?await vo(ut.id,{urlMode:"replace"}):(k(void 0),Nn(void 0,"replace"))}}catch(xe){l("archiveSession",xe,{sessionId:se})}}async function Co(se){if(oe)return;const xe=se??e.activeSessionId;if(!xe){const Ce=n("commands.export.noSession");bi("export:failed",{status:"no-session"}),l("exportSession",new Error(Ce),{message:Ce});return}oe=!0;const J=Date.now();bi("export:start",{sessionId:xe});try{const Ce=U0e(),{blob:$e,fileName:He}=await _t().exportSession(xe,Ce,{desktop:Wp});if(typeof document>"u")throw new Error("Document is unavailable");const vt=URL.createObjectURL($e);let ut;try{ut=document.createElement("a"),ut.href=vt,ut.download=He,document.body.append(ut),ut.click()}finally{ut?.remove(),setTimeout(()=>{try{URL.revokeObjectURL(vt)}catch{}},0)}bi("export:accepted",{sessionId:xe,status:"accepted",zipBytes:$e.size,durationMs:Date.now()-J})}catch(Ce){const $e=typeof Ce=="object"&&Ce!==null?Ce:void 0;bi("export:failed",{sessionId:xe,status:"failed",durationMs:Date.now()-J,errorName:typeof $e?.name=="string"?$e.name:typeof Ce,errorCode:typeof $e?.code=="number"?$e.code:void 0,requestId:typeof $e?.requestId=="string"?$e.requestId:void 0,phase:typeof $e?.phase=="string"?$e.phase:void 0,httpStatus:typeof $e?.status=="number"?$e.status:void 0}),l("exportSession",Ce,{sessionId:xe})}finally{oe=!1}}async function Fs(se){try{const xe=await _t().restoreSession(se);return f(xe),!0}catch(xe){return l("restoreSession",xe,{sessionId:se}),!1}}function Rs(se){return _t().listSessions({archivedOnly:!0,beforeId:se?.beforeId,pageSize:se?.pageSize??50})}async function yo(){try{await _t().logout(),await Se(),await gt()}catch(se){l("logout",se)}}function ht(se){const xe=e.activeSessionId;xe&&_t().compactSession(xe,se).catch(J=>{l("compact",J,{sessionId:xe})})}async function Le(se){const xe=se??e.activeSessionId;if(xe)try{const J=await _t().forkSession(xe);f(J),await vo(J.id)}catch(J){l("fork",J,{sessionId:xe})}}async function Ze(se=1){const xe=e.activeSessionId;if(!xe)return null;const J=e.messagesBySession[xe]??[];let Ce=-1;for(let ut=J.length-1;ut>=0;ut--){const Dt=J[ut];if(Dt.role==="user"&&!(Dt.metadata?.origin&&Dt.metadata.origin.kind!=="user")){Ce=ut;break}}const $e=Ce>=0?J[Ce].content.filter(ut=>ut.type==="text").map(ut=>ut.text).join(` -`):null,He=se===1&&Ce>=0&&J.slice(Ce+1).every(ut=>ut.role!=="user"),vt=He?e.sessions.find(ut=>ut.id===xe):void 0;if(He&&(e.messagesBySession={...e.messagesBySession,[xe]:J.slice(0,Ce)},vt!==void 0)){const ut={...vt};delete ut.lastTurnReason,f(ut)}try{return await _t().undoSession(xe,se),await g(xe),{text:$e}}catch(ut){return He&&(e.messagesBySession={...e.messagesBySession,[xe]:J},vt!==void 0&&f(vt),await g(xe).catch(()=>{})),l("undo",ut,{sessionId:xe}),null}}function Xt(se){const xe=e.activeSessionId;if(!xe)return;const J=e.queuedBySession[xe]??[];if(se<0||se>=J.length)return;const Ce=[...J];Ce.splice(se,1),e.queuedBySession={...e.queuedBySession,[xe]:Ce}}function gs(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[];if(se===xe||se<0||se>=Ce.length||xe<0||xe>=Ce.length)return;const $e=[...Ce],[He]=$e.splice(se,1);He!==void 0&&($e.splice(xe,0,He),e.queuedBySession={...e.queuedBySession,[J]:$e})}async function di(se){const xe=e.activeSessionId;if(!xe)return[];try{return(await _t().listDirectory(xe,{path:se,includeGitStatus:!0})).items}catch{return[]}}async function Ei(se){const xe=e.activeSessionId;if(!xe)return null;try{const Ce=await _t().readFile(xe,{path:se});return{path:Ce.path,content:Ce.content,encoding:Ce.encoding,mime:Ce.mime,languageId:Ce.languageId,isBinary:Ce.isBinary,size:Ce.size,lineCount:Ce.lineCount}}catch(J){if(gl("[kimi-web] readFileContent failed for",se,J),Us(J)&&J.code===Ghe)throw J;return null}}async function ao(se){return _t().readHostFileContent(se)}const Gi=10485760;function Er(se){const xe=e.activeSessionId;return xe?_t().getFileDownloadUrl(xe,se):null}async function fi(se,xe){const J=e.activeSessionId;if(!J)return!1;try{return await _t().openFile(J,{path:se,line:xe}),!0}catch(Ce){return l("openFile",Ce,{sessionId:J}),!1}}async function Ll(se){const xe=e.activeSessionId;if(!xe)return;const J=$.value.cwd||".";try{await _t().openInApp(xe,se,J)}catch(Ce){l("openInApp",Ce,{sessionId:xe})}}async function zo(se){const xe=e.activeSessionId;if(!xe)return!1;try{return await _t().revealFile(xe,{path:se}),!0}catch(J){return l("revealFile",J,{sessionId:xe}),!1}}function Ir(se){return se.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(se)||se.startsWith("\\\\")}async function Qs(se){if(/^(https?:|data:|blob:)/i.test(se))return se;const xe=e.activeSessionId;if(!xe)return se;let J=se;if(Ir(J)){const Ce=e.sessions.find(He=>He.id===xe)?.cwd,$e=Ce?h2(J,Ce):null;if($e)J=$e;else try{const He=await ao(J);return!He.isBinary||He.encoding!=="base64"?se:`data:${He.mime};base64,${He.content}`}catch{return se}}try{const $e=await _t().readFile(xe,{path:J,length:Gi});return!$e.isBinary||$e.encoding!=="base64"||$e.truncated?se:`data:${$e.mime};base64,${$e.content}`}catch{return se}}async function pi(se){const xe=e.sessions.find(Ce=>Ce.id===e.activeSessionId),J=xe===void 0?e.activeWorkspaceId:B(xe);if(!J)return[];try{return(await _t().searchFiles(J,{query:se,limit:20})).items.map(He=>({path:He.path,name:He.name}))}catch{return[]}}return{loadFileDiff:we,clearFileDiff:ge,loadGitStatus:Q,checkAuth:Se,probeManagedMembership:ue,loadConfig:_e,updateConfig:Ee,listAllSessionsGlobal:Oe,load:gt,refreshServerMeta:Lt,loadWorkspaces:wn,loadMoreSessions:Yt,loadAllSessions:Ue,ensureFlatSessions:Mn,loadMoreFlatSessions:We,selectWorkspace:go,openWorkspace:qt,upsertWorkspacePreserveOrder:ps,applyWorkspaceEvent:xs,clearActiveSession:_n,openWorkspaceDraft:In,startSessionAndSendPrompt:lo,startSessionAndActivateSkill:St,startSessionAndOpenSideChat:hs,addWorkspaceByPath:Jo,browseFs:uo,getFsHome:Ys,writeSessionUrl:Nn,fetchSessionIntoList:no,onSessionRoutePopState:Xs,bindSessionRoute:Oo,selectSession:vo,submitPromptInternal:Po,finishPromptLocal:Ct,localTurnStartState:sme,isLocalTurnSnapshotCurrent:rme,afterLocalTurnStartsSettle:lme,handleSessionSnapshot:Qt,sendPrompt:co,steerPrompt:Tn,uploadImage:fo,enqueue:Qe,unqueue:Xt,reorderQueue:gs,abortCurrentPrompt:kn,respondApproval:bo,respondQuestion:Ns,dismissQuestion:Do,pendingQuestionActions:Hu,pendingApprovalActions:Lh,cancelTask:Io,setPlanMode:Qo,togglePlanMode:sn,setSwarmMode:es,toggleSwarmMode:ms,setGoalMode:Tr,toggleGoalMode:ts,createGoal:Ki,controlGoal:Js,setPermission:Bo,dismissWarning:Zo,renameSession:Il,renameWorkspace:Zi,deleteWorkspace:tl,archiveSession:Ho,exportSession:Co,restoreSession:Fs,loadArchivedSessions:Rs,logout:yo,compact:ht,forkSession:Le,undo:Ze,listDir:di,readFileContent:Ei,readHostFileContent:ao,getFileDownloadUrl:Er,openWorkspaceFile:fi,openInApp:Ll,revealWorkspaceFile:zo,resolveImageUrl:Qs,searchFiles:pi,loadOlderMessages:Y,refreshSessionSidecars:fe,isStartingFirstPrompt:()=>cl.size>0}}const tN=cn.starredModels,Bx=new Error("profile persist failed");function ume(){try{const e=ui(tN);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t)&&t.every(n=>typeof n=="string"))return t}catch{}return[]}function cme(e){try{Ls(tN,JSON.stringify(e))}catch{}}function dme(e,t){const{pushOperationFailure:n,refreshSessionStatus:o,persistSessionProfile:s,activity:i,updateSession:r,updateSessionMessages:l,loadConfig:a,checkAuth:u}=t,c=Z([]),d=Z(ume()),f=Z({}),h=Z({}),m=Z([]),v=Z(null);function k(pe){if(!(pe==null||pe.length===0))return c.value.find(ve=>ve.id===pe)??c.value.find(ve=>ve.model===pe)}function w(){const pe=e.activeSessionId?e.sessions.find(oe=>oe.id===e.activeSessionId):void 0,ve=pe===void 0?v.value??e.defaultModel:pe.model||e.defaultModel;return k(ve)?.id??ve??void 0}function b(pe){if(pe===void 0)return;const ve=k(pe);return ve===void 0?void 0:bp(ve)}function _(pe,ve){const oe=pe==null?void 0:e.thinkingBySession[pe];return oe!==void 0&&gJ(ve,oe)?oe:bp(ve)}function g(pe,ve){if(ve===void 0)return;const oe=k(ve);return oe===void 0?void 0:_(pe,oe)}async function x(pe,ve){return pe!=null&&e.thinkingBySession[pe]===void 0&&await o(pe),g(pe,ve)}function S(pe){e.thinking=pe;const ve=e.activeSessionId;return pe!==void 0&&ve!==null&&ve!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:pe},k3(e,ve)),pe}Je([()=>e.activeSessionId,()=>w(),()=>{const pe=e.activeSessionId;return pe==null?void 0:e.thinkingBySession[pe]}],()=>{const pe=k(w());pe!==void 0&&(e.thinking=_(e.activeSessionId,pe))});function T(pe){_t().setConfig({thinking:vJ(pe,k(w())?.supportEfforts)}).catch(ve=>n("setConfig",ve))}async function A(pe){try{const oe=await _t().listSkills(pe);f.value={...f.value,[pe]:oe}}catch{}}async function E(pe){try{const oe=await _t().listSkillsForWorkspace(pe);h.value={...h.value,[pe]:oe}}catch{}}async function P(){try{const pe=_t();c.value=await pe.listModels();const ve=k(w());ve!==void 0&&(e.thinking=_(e.activeSessionId,ve))}catch(pe){n("loadModels",pe)}}async function D(){try{const pe=_t();m.value=await pe.listProviders()}catch(pe){n("loadProviders",pe)}}async function I(pe){const ve=e.activeSessionId,oe=k(pe),ye=e.thinking,G=ve?e.sessions.find(ge=>ge.id===ve)?.model:void 0,Y=w()!==(oe?.id??pe),fe=yJ(oe,ye,Y);if(!ve)return v.value=pe,e.thinking=fe,fe!==ye&&fe!==void 0&&T(fe),!0;r(ve,ge=>({...ge,model:pe}));let we;fe!==ye&&(e.thinking=fe,fe!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:fe},we=k3(e,ve)));try{await _t().updateSession(ve,{model:pe,thinking:fe!==ye?fe:void 0})}catch(ge){return r(ve,Q=>({...Q,model:G??Q.model})),fe!==ye&&(e.thinking=ye,ye!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:ye}),vl(e,ve,we)&&o(ve)),n("setModel",ge,{sessionId:ve}),!1}return fe!==ye&&fe!==void 0&&T(fe),vl(e,ve,we),await o(ve),!0}function $(pe){const ve=new Set(d.value);ve.has(pe)?ve.delete(pe):ve.add(pe),d.value=Array.from(ve),cme(d.value)}async function B(pe,ve,oe,ye,G){const Y=ye??e.activeSessionId;if(!Y)return;const fe=i.value==="idle"&&!e.inFlightBySession[Y],we=`msg_skill_opt_${Date.now().toString(36)}`,ge=fe?y8(Y):void 0;if(fe){e.inFlightBySession={...e.inFlightBySession,[Y]:!0};const Q={id:we,sessionId:Y,role:"user",content:[{type:"text",text:`/${pe}${ve?` ${ve}`:""}`},...m8(oe)],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0,origin:{kind:"skill_activation",trigger:"user-slash",skillName:pe,skillArgs:ve}}};l(Y,te=>[...te,Q])}try{if(G?.skipThinkingPersist!==!0){const Q=e.sessions.find(ue=>ue.id===Y)?.model,te=(Q&&Q.length>0?Q:e.defaultModel)??void 0;if(!await s({thinking:await x(Y,te)??e.thinking},Y))throw Bx}await _t().activateSkill(Y,pe,ve,m8(oe))}catch(Q){fe&&(e.inFlightBySession={...e.inFlightBySession,[Y]:!1},l(Y,te=>te.filter(ce=>ce.id!==we))),Q!==Bx&&n("activateSkill",Q,{sessionId:Y})}finally{ge!==void 0&&k8(Y,ge)}}async function H(pe){return _t().getProvider(pe)}async function O(pe){try{return await _t().addProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: addProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function F(pe,ve){try{return await _t().updateProvider(pe,ve),await Promise.all([D(),P(),a()]),null}catch(oe){return Xl("[kimi-web] operation failed: updateProvider",oe),oe instanceof Error?oe.message:String(oe)}}async function U(pe){try{const oe=await _t().deleteProvider(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return n("deleteProvider",ve),null}}async function z(pe){try{const ve=await _t().refreshProvider(pe);for(const oe of ve.failed)n("refreshProvider",new Error(oe.reason),{message:oe.provider});await Promise.all([D(),P(),a()])}catch(ve){n("refreshProvider",ve)}}async function W(){try{const pe=await _t().refreshAllProviders();for(const ve of pe.failed)n("refreshAllProviders",new Error(ve.reason),{message:ve.provider});await Promise.all([D(),P(),a()])}catch(pe){n("refreshAllProviders",pe)}}async function K(){try{return{kind:"ok",items:await _t().listCatalogProviders()}}catch(pe){return pe instanceof wd&&pe.code===void 0?{kind:"unsupported"}:(Xl("[kimi-web] operation failed: loadCatalogProviders",pe),{kind:"error"})}}async function V(pe){try{return await _t().importCatalogProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: importCatalogProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function ie(pe){try{const oe=await _t().importCustomRegistry(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return Xl("[kimi-web] operation failed: importCustomRegistry",ve),ve instanceof Error?ve.message:String(ve)}}async function ne(){try{return await _t().startOAuthLogin()}catch{return null}}async function X(){try{return await _t().pollOAuthLogin()}catch(pe){return gl("[kimi-web] pollOAuthLogin failed",pe),null}}async function le(){try{await _t().cancelOAuthLogin()}catch{}}async function Ie(){try{return await _t().getUsage()}catch(pe){return{kind:"error",message:pe instanceof Error?pe.message:String(pe)}}}function de(pe){const ve=S(pe);s({thinking:ve}),ve!==void 0&&T(ve)}return{models:c,starredModelIds:d,providers:m,draftModel:v,skillsBySession:f,skillsByWorkspace:h,loadSkillsForSession:A,loadSkillsForWorkspace:E,loadModels:P,loadProviders:D,setModel:I,thinkingLevelForModelId:b,thinkingLevelForSessionId:g,resolveThinkingForPrompt:x,toggleStarModel:$,activateSkill:B,addProvider:O,updateProvider:F,deleteProvider:U,getProvider:H,loadCatalogProviders:K,importCatalogProvider:V,importCustomRegistry:ie,refreshProvider:z,refreshAllProviders:W,startOAuthLogin:ne,pollOAuthLogin:X,cancelOAuthLogin:le,getUsage:Ie,setThinking:de}}function fme(e,t){const{pushOperationFailure:n,nextOptimisticMsgId:o,connectEventsIfNeeded:s,getEventConn:i,resolveThinkingForPrompt:r,refreshSessionStatus:l}=t,a=Z({}),u=R(()=>{const O=e.activeSessionId;if(!O)return null;const F=a.value[O];return F?{parentId:O,agentId:F.agentId}:null}),c=R(()=>u.value?.parentId??null),d=R(()=>u.value!==null),f=R(()=>{const O=u.value;return O?!!e.sideChatSendingByAgent[O.agentId]:!1}),h=R(()=>{const O=u.value;return O?e.sideChatSendingByAgent[O.agentId]?!0:(e.tasksBySession[O.parentId]??[]).some(F=>F.id===O.agentId&&F.status==="running"):!1}),m=O=>_t().getFileUrl(O),v=[],k=KT(),w=R(()=>{const O=u.value;return O?k({messages:e.sideChatMessagesByAgent[O.agentId]??[],approvals:v,getFileUrl:m,sessionActive:h.value}):[]});function b(O,F){e.sideChatMessagesByAgent[O]=F(e.sideChatMessagesByAgent[O]??[])}function _(O,F){b(O,U=>[...U,F])}function g(O,F){b(O,U=>{const z=U.find(W=>W.id===F);return z?.promptId!==void 0||z?.userMessageId!==void 0?U:U.filter(W=>W.id!==F)})}function x(O,F){const U=e.sideChatUserMessageIdsBySession[O]??[];U.includes(F)||(e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[O]:[...U,F]})}function S(O,F,U,z){b(O,W=>{const K=W.findIndex(X=>X.id===F);if(K===-1)return W;const V=W.findIndex((X,le)=>le!==K&&X.role==="user"&&(X.id===z||X.userMessageId===z||X.promptId===U)),ie=W[K],ne=V===-1?ie:W[V];return W.flatMap((X,le)=>le===V?[]:le!==K?[X]:[{...ne,id:ie.id,promptId:U,userMessageId:z,metadata:{...ne.metadata,...ie.metadata}}])})}function T(O,F){x(F.sessionId,F.userMessageId??F.id),b(O,U=>{const z=U.findIndex(V=>V.role==="user"&&(V.userMessageId===(F.userMessageId??F.id)||V.promptId!==void 0&&V.promptId===F.promptId));if(z===-1)return[...U,F];const W=U[z],K=[...U];return K[z]={...F,id:W.id,promptId:F.promptId??W.promptId,userMessageId:F.userMessageId??F.id,metadata:{...F.metadata,...W.metadata}},K})}function A(O,F,U){U&&b(O,z=>{const W=z.at(-1);if(W?.role==="assistant"){const K=W.content[0],V=K?.type==="text"?K.text:"";return[...z.slice(0,-1),{...W,content:[{type:"text",text:`${V}${U}`}]}]}return[...z,{id:o(),sessionId:F,role:"assistant",content:[{type:"text",text:U}],createdAt:new Date().toISOString()}]})}function E(O,F,U){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[O]:!1},!U)return;const W=(e.sideChatMessagesByAgent[O]??[]).at(-1);(W?.role==="assistant"&&W.content[0]?.type==="text"?W.content[0].text:"").trim().length>0||A(O,F,U)}async function P(O){const F=e.activeSessionId;F&&await D(F,O)}async function D(O,F){if(!a.value[O]){let U;try{({agentId:U}=await _t().startBtw(O))}catch(z){n("openSideChat",z,{sessionId:O});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[U]:e.sideChatMessagesByAgent[U]??[]},a.value={...a.value,[O]:{agentId:U}},s(),i()?.markSideChannelAgent(O,U)}F&&F.trim()&&await I(O,F.trim())}async function I(O,F){const U=a.value[O],z=F.trim();if(!U||!z)return;const W=O,K=U.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!0};const V=o(),ie={id:V,sessionId:W,role:"user",content:[{type:"text",text:z}],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};_(K,ie);let ne;try{const X=e.sessions.find(pe=>pe.id===W),le=(X?.model&&X.model.length>0?X.model:e.defaultModel)??void 0,Ie=await r(W,le)??e.thinking;ne=e.pendingThinkingBySession[W];const de=await _t().submitPrompt(W,{content:[{type:"text",text:z}],agentId:K,model:le,thinking:Ie,permissionMode:e.permission,planMode:e.planModeBySession[W]??!1,swarmMode:e.swarmModeBySession[W]??!1});Ie!==void 0&&vl(e,W,ne),S(K,V,de.promptId,de.userMessageId),x(W,de.userMessageId)}catch(X){vl(e,W,ne)&&l(W),n("sendSideChatPrompt",X,{sessionId:W}),g(K,V),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!1}}}function $(){const O=e.activeSessionId;if(!O)return;const{[O]:F,...U}=a.value;a.value=U}async function B(O){const F=u.value;F&&await I(F.parentId,O)}function H(O){if(!a.value[O])return;const{[O]:F,...U}=a.value;a.value=U}return{sideChatTargetBySession:a,sideChatSessionId:c,sideChatVisible:d,sideChatSending:f,sideChatRunning:h,sideChatTurns:w,appendSideChatAssistantText:A,finishSideChatAgent:E,reconcileSideChatUserMessage:T,openSideChat:P,openSideChatOn:D,closeSideChat:$,sendSideChatPrompt:B,clearSideChatForSession:H}}class pme{transcript;sessionId;agentId;fetchPage;pageSize;onChange;onGap;refreshPromise=null;buffered=[];agents_=[];seq_;loadingOlder_=!1;loadOlderError_=!1;refreshError_=!1;constructor(t){this.sessionId=t.sessionId,this.agentId=t.agentId,this.transcript=new tj(t.agentId),this.fetchPage=t.fetchPage,this.pageSize=t.pageSize??20,this.onChange=t.onChange,this.onGap=t.onGap}get snapshot(){return this.transcript.snapshot()}get seq(){return this.seq_}get agents(){return this.agents_}get loading(){return this.refreshPromise!==null}get loadingOlder(){return this.loadingOlder_}get loadOlderError(){return this.loadOlderError_}get refreshError(){return this.refreshError_}refresh(){if(this.refreshPromise!==null)return this.refreshPromise;this.refreshError_=!1;const t=this.fetchPage({pageSize:this.pageSize}).then(n=>this.applyPage(n,!0)).catch(n=>{throw this.refreshError_=!0,n}).finally(()=>{this.refreshPromise=null;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()});return this.refreshPromise=t,this.onChange?.(),t}receiveReset(t,n){this.transcript.receive([{op:"reset",agentId:this.agentId,snapshot:t}]),n!==void 0&&(this.seq_=n),this.refreshError_=!1,this.onChange?.()}applyOps(t,n){if(this.refreshPromise!==null||this.loadingOlder_)return this.buffered.push({ops:t,...n!==void 0?{seq:n}:{}}),!1;if(n!==void 0&&this.seq_!==void 0){if(n<=this.seq_)return!0;if(n!==this.seq_+1)return this.onGap?.(),!1}const o=this.transcript.apply(t);return n!==void 0&&(this.seq_=n),o.gap!==void 0&&this.onGap?.(),o.accepted.length>0&&this.onChange?.(),o.gap===void 0}async loadOlder(){if(!this.snapshot.hasMoreOlder||this.loadingOlder_)return;const t=this.snapshot.items.find(n=>n.kind==="turn");if(t?.kind==="turn"){this.loadingOlder_=!0,this.loadOlderError_=!1,this.onChange?.();try{const n=await this.fetchPage({beforeTurn:t.turnId,pageSize:this.pageSize});this.applyPage(n,!1)}catch(n){throw this.loadOlderError_=!0,n}finally{this.loadingOlder_=!1;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()}}}applyPage(t,n){this.agents_=t.agents;const o=this.snapshot,s=n?t:{...t,items:hme(t.items,o.items),hasMoreOlder:t.hasMoreOlder};this.receiveReset(s,n?t.seq:void 0)}}function hme(e,t){const n=new Set,o=[];for(const s of[...e,...t]){const i=s.kind==="turn"?s.turnId:s.kind==="marker"?s.markerId:s.refId;n.has(i)||(n.add(i),o.push(s))}return o}function mme(e){const t=qS(new Map),n=new Map,o=new Map,s=new Set;let i=null,r=null;function l(){i!==null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(i),i=null),r!==null&&(clearTimeout(r),r=null);for(const _ of s)_.version.value+=1;s.clear()}function a(_){s.add(_),!(i!==null||r!==null)&&(typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(l)),r=setTimeout(l,50))}function u(_,g){return`${_}\0${g}`}function c(_,g,x){const S=e.getEventConnection();S!==null&&(S.subscribeTranscript(_,g,x),o.set(_,g))}function d(_,g){const x=u(_,g),S=t.get(x);if(S!==void 0)return S;const T={channel:new pme({sessionId:_,agentId:g,fetchPage:A=>e.api.getSessionTranscript(_,{...A,agentId:g}),onChange:()=>{a(T)},onGap:()=>{f(T)}}),version:Z(0),baselineLoaded:!1,resumePromise:null};return t.set(x,T),T}async function f(_){if(_.resumePromise!==null)return _.resumePromise;const g=h(_).finally(()=>{_.resumePromise===g&&(_.resumePromise=null)});return _.resumePromise=g,g}async function h(_){try{await _.channel.refresh(),_.baselineLoaded=!0,n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId,_.channel.seq)}catch{n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId)}}function m(_,g){e.connectEventsIfNeeded(),n.set(_,g);const x=d(_,g);return x.baselineLoaded?c(_,g,x.channel.seq):f(x),x}function v(_,g){if(n.get(_)!==g)return;n.delete(_);const x=o.get(_);x!==void 0&&(e.getEventConnection()?.unsubscribeTranscript(_,[x]),o.delete(_))}function k(_,g,x,S){if(n.get(_)!==g)return;const T=d(_,g);T.channel.receiveReset(x,S),T.baselineLoaded=!0}function w(_,g,x,S){return n.get(_)!==g?!0:d(_,g).channel.applyOps(x,S)}function b(_){n.delete(_),o.delete(_)&&e.getEventConnection()?.unsubscribeTranscript(_);for(const[g,x]of t)x.channel.sessionId===_&&(t.delete(g),s.delete(x))}return{getEntry:(_,g)=>t.get(u(_,g)),activate:m,deactivate:v,receiveReset:k,applyOps:w,forgetSession:b}}const $h=XT(),Da=phe(),nN=cn.permission,oN=cn.activeWorkspace,sN=cn.planMode,iN=cn.swarmMode,rN=cn.goalMode,Hx=40401,Ag=cn.onboarded;ur(cn.codeFont);ur(cn.accent);ur(cn.theme);ur(cn.thinking);ur(cn.notifyOnComplete);ur(cn.notifyOnQuestion);ur(cn.notifyOnApproval);ur(cn.soundOnComplete);function gme(){try{const e=ui(nN);if(e==="auto"||e==="yolo"||e==="manual")return e}catch{}return"manual"}function vme(e){try{Ls(nN,e)}catch{}}function b4(e){const t=ui(e);if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const o={};for(const[s,i]of Object.entries(n))i===!0&&(o[s]=!0);return o}catch{return{}}}function P5(e,t){try{const n={};for(const[o,s]of Object.entries(t))s&&(n[o]=!0);Ls(e,JSON.stringify(n))}catch{}}function lN(){P5(sN,Me.planModeBySession)}function aN(){P5(iN,Me.swarmModeBySession)}function uN(){P5(rN,Me.goalModeBySession)}function yme(){try{return ui(oN)}catch{return null}}const cN=cn.hiddenWorkspaces;function kme(){try{const e=ui(cN);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function bme(e){try{Ls(cN,JSON.stringify(e))}catch{}}function Cme(e){try{Ls(oN,e)}catch{}}function wme(e,t){if(t&&e.startsWith(t)){const o=e.slice(t.length);return o?`~${o}`:"~"}const n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??""}`:e}const Me=Go({...oY(),connected:!1,serverVersion:"",dangerousBypassAuth:!1,backend:"v1",experimentalFlags:{},workspaceName:"kimi-web",connection:"disconnected",permission:gme(),thinking:void 0,thinkingBySession:{},pendingThinkingBySession:{},planModeBySession:b4(sN),swarmModeBySession:b4(iN),goalModeBySession:b4(rN),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:Ey(),authReady:!1,defaultModel:null,managedProviderStatus:null,managedUserInfo:null,managedMembership:null,workspaces:[],activeWorkspaceId:yme(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:kme(),availableOpenInApps:[],config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1,flatSessionsNextPageToken:null,flatSessionsHasMore:!0,flatSessionsLoading:!1,flatSessionsLoadingMore:!1,flatSessionsSeeded:!1,flatSessionsFrontier:null}),Mg=Go({}),np=new Map,If=new Map;function _me(e,t){return`${e}\0${t??"*"}`}async function b8(e,t){const n=_me(e,t),o=(np.get(n)??0)+1;np.set(n,o),t!==void 0&&If.set(e,(If.get(e)??0)+1);const s=If.get(e)??0;try{const i=await _t().getSessionPlans(e,{agentId:"main",toolCallId:t});if(np.get(n)!==o||t===void 0&&(If.get(e)??0)!==s||!Me.sessions.some(l=>l.id===e))return;const r=Object.fromEntries(i.map(l=>[l.toolCallId,l]));Mg[e]=t===void 0?r:{...Mg[e],...r}}catch(i){gl("[refreshSessionPlans] plan history unavailable for",e,i)}}function xme(e){const t=`${e}\0`;for(const n of np.keys())n.startsWith(t)&&np.delete(n);If.delete(e),delete Mg[e]}const F2=Go({planMode:!1,swarmMode:!1,goalMode:!1});function D5(e){Me.sessions=e}function R2(e,t){Me.sessions=Me.sessions.map(n=>n.id===e?t(n):n)}function Sme(e){Me.sessions=[e,...Me.sessions.filter(t=>t.id!==e.id)]}function Ame(e){Me.sessions=[...Me.sessions,e]}function Mme(e){Me.sessions=Me.sessions.filter(t=>t.id!==e)}function dN(){const e=Me.activeSessionId;e&&Me.unreadBySession[e]&&typeof document<"u"&&document.visibilityState==="visible"&&(Me.unreadBySession[e]=!1,Iy({[e]:!1}))}typeof window<"u"&&window.addEventListener("storage",e=>{e.key===cn.unread&&(Me.unreadBySession=Ey(),dN())});function C8(){if(rr===null||!rr.health().stale)return;bi("ws:stale-reconnect",{sessionId:Me.activeSessionId,status:"stale"}),D0e("ws: stale socket on focus, reconnecting",{activeSessionId:Me.activeSessionId}),rr.reconnect();const e=Me.activeSessionId;e&&Lg.request(e)}typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(dN(),C8())});typeof window<"u"&&(window.addEventListener("focus",C8),window.addEventListener("online",C8));function B5(e){Me.activeSessionId=e}function Tme(e){Ni(Me.messagesBySession,e)}function Eme(e,t){Me.messagesBySession[e]=t}function fN(e,t){Me.messagesBySession[e]=t(Me.messagesBySession[e]??[])}function Ime(e){delete Me.messagesBySession[e]}function pN(e){rr?.unsubscribe(e),Tg.forgetSession(e),ege(e),Gd.discard(({meta:t})=>t.sessionId===e),Mme(e),Ime(e),xme(e),delete Me.approvalsBySession[e],delete Me.questionsBySession[e],delete Me.tasksBySession[e],delete Me.goalBySession[e],delete Me.gitStatusBySession[e],delete Me.lastSeqBySession[e],delete Me.compactionBySession[e],delete Me.messagesLoadingMoreBySession[e],delete Me.messagesHasMoreBySession[e],delete Me.messagesLoadMoreErrorBySession[e],delete w8[e],Ig.delete(e),um.delete(e),MN.delete(e),ime(e),delete Me.queuedBySession[e],delete Me.promptIdBySession[e],delete Me.inFlightBySession[e],delete Me.turnActiveBySession[e],delete Me.turnEndedPromptIdBySession[e],delete Me.turnErrorBySession[e],delete Me.turnRetryBySession[e],delete Me.planModeBySession[e],delete Me.swarmModeBySession[e],delete Me.goalModeBySession[e],delete Me.thinkingBySession[e],delete Me.pendingThinkingBySession[e],lN(),aN(),uN(),Yo.value.includes(e)&&(Yo.value=uE(Yo.value,e),k1(Yo.value))}const hN=Z(null),mN=Z([]),gN=Z(!1),vN=Z(null),yN=Z(!1),kN=Z(!1),bN=Z(null);async function _c(e){let t;try{t=await _t().getSessionStatus(e)}catch{return}R2(e,n=>({...n,model:t.model||n.model,usage:{...n.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),Me.swarmModeBySession[e]=t.swarmMode,Me.planModeBySession[e]=t.planMode,t.thinkingEffort.length>0&&rE(Me,e,t.thinkingEffort)}async function Lme(e){const t=Me.goalVersionBySession[e]??0;let n;try{n=await _t().getSessionGoal(e)}catch{return}(Me.goalVersionBySession[e]??0)===t&&(n===null||n.status==="complete"?delete Me.goalBySession[e]:Me.goalBySession[e]=n)}function CN(e,t){const n=t??Me.activeSessionId;if(!n)return Promise.resolve(!1);const o=e.thinking!==void 0?Me.pendingThinkingBySession[n]:void 0;return Promise.resolve(_t().updateSession(n,e)).then(()=>(vl(Me,n,o),_c(n))).then(()=>!0).catch(s=>(vl(Me,n,o)&&_c(n),t0("persistSessionProfile",s,{sessionId:n}),!1))}function wN(e){try{return ui(e)??""}catch{return""}}function $me(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("kimi_onboarded")==="1"}const _N=$me();if(_N&&wN(Ag)!=="1")try{Ls(Ag,"1")}catch{}const xN=Z(_N||wN(Ag)==="1");function Nme(e){xN.value=e;try{Ls(Ag,e?"1":"0")}catch{}e&&window.kimiDesktop?.setOnboarded?.()}let rr=null;const Tg=mme({api:_t(),connectEventsIfNeeded:H5,getEventConnection:()=>rr});let zx=0;function SN(){return zx+=1,`msg_opt_${Date.now().toString(36)}_${zx}`}function Wx(e,t,n){const o={sessions:Me.sessions,activeSessionId:Me.activeSessionId,messagesBySession:Me.messagesBySession,approvalsBySession:Me.approvalsBySession,planReviewByToolCallId:Me.planReviewByToolCallId,questionsBySession:Me.questionsBySession,tasksBySession:Me.tasksBySession,goalBySession:Me.goalBySession,goalVersionBySession:Me.goalVersionBySession,lastSeqBySession:Me.lastSeqBySession,turnActiveBySession:Me.turnActiveBySession,turnEndedPromptIdBySession:Me.turnEndedPromptIdBySession,turnErrorBySession:Me.turnErrorBySession,turnRetryBySession:Me.turnRetryBySession,compactionBySession:Me.compactionBySession,config:Me.config,warnings:Me.warnings},s=fY(o,e,{sessionId:t,seq:n},{t:(i,r)=>r===void 0?Hn.global.t(i):Hn.global.t(i,r)});s.sessions!==o.sessions&&D5(s.sessions),s.activeSessionId!==o.activeSessionId&&B5(s.activeSessionId),Tme(s.messagesBySession),Ni(Me.approvalsBySession,s.approvalsBySession),Ni(Me.planReviewByToolCallId,s.planReviewByToolCallId),Ni(Me.questionsBySession,s.questionsBySession),Ni(Me.tasksBySession,s.tasksBySession),Ni(Me.goalBySession,s.goalBySession),Ni(Me.goalVersionBySession,s.goalVersionBySession),Ni(Me.lastSeqBySession,s.lastSeqBySession),Ni(Me.turnActiveBySession,s.turnActiveBySession),Ni(Me.turnEndedPromptIdBySession,s.turnEndedPromptIdBySession),Ni(Me.turnErrorBySession,s.turnErrorBySession),Ni(Me.turnRetryBySession,s.turnRetryBySession),Ni(Me.compactionBySession,s.compactionBySession),s.config!==o.config&&(Me.config=s.config??null),pY(s.warnings,o.warnings)||(Me.warnings=s.warnings),e.type==="configChanged"&&(Me.defaultModel=e.config.defaultModel??null),e.type==="modelCatalogChanged"&&(Rn.loadModels(),Rn.loadProviders()),e.type==="sessionUsageUpdated"&&(e.swarmMode!==void 0&&(Me.swarmModeBySession[e.sessionId]=e.swarmMode),e.planMode!==void 0&&(Me.planModeBySession[e.sessionId]=e.planMode),e.thinking!==void 0&&rE(Me,e.sessionId,e.thinking)),e.type==="sessionDeleted"&&V5(e.sessionId)}function Fme(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return;if(n.role==="assistant")for(let o=n.content.length-1;o>=0;o--){const s=n.content[o];if(s.type==="toolUse"&&s.toolName==="ExitPlanMode")return s.toolCallId}}}function Rme(e,t){const n=Me.lastSeqBySession[t.sessionId]??0,o=Me.turnActiveBySession[t.sessionId]??!1,s=e.type==="approvalResolved"||e.type==="approvalExpired"?Me.approvalsBySession[t.sessionId]?.find(r=>r.approvalId===e.approvalId&&r.toolName==="ExitPlanMode")?.toolCallId:void 0,i=si.sideChatTargetBySession.value[t.sessionId];if(e.type==="messageCreated"&&e.message.role==="user"&&e.agentId!==void 0&&Object.prototype.hasOwnProperty.call(Me.sideChatMessagesByAgent,e.agentId)){Wx({type:"unknown",raw:{_noop:!0}},t.sessionId,t.seq),si.reconcileSideChatUserMessage(e.agentId,e.message);return}if(Wx(e,t.sessionId,t.seq),i){const{agentId:r}=i,l=t.sessionId;e.type==="agentDelta"&&e.agentId===r?e.delta.text&&si.appendSideChatAssistantText(r,l,e.delta.text):e.type==="agentTurnEnded"&&e.agentId===r?si.finishSideChatAgent(r,l):e.type==="taskProgress"&&e.taskId===r?si.appendSideChatAssistantText(r,l,e.outputChunk):e.type==="taskCompleted"&&e.taskId===r&&si.finishSideChatAgent(r,l,e.outputPreview)}if(e.type==="messageCreated"&&e.message.role==="user"&&e.message.promptId!==void 0){const r=e.message.sessionId;Me.promptIdBySession[r]!==e.message.promptId&&(Me.promptIdBySession[r]=e.message.promptId)}if(e.type==="turnActiveChanged"&&!e.active&&t.seq>n){const r=e.reason;y2e(e.sessionId,r==="cancelled"||r==="failed"||r==="blocked"?"aborted":"idle",o);const l=Fme(Me.messagesBySession[e.sessionId]??[]);l!==void 0&&b8(e.sessionId,l)}e.type==="sessionWorkChanged"&&(e.mainTurnActive===!1&&o||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&v2e(e.sessionId),(e.type==="promptAborted"||e.type==="promptCompleted"&&e.reason==="blocked")&&t.seq>n&&Me.promptIdBySession[e.sessionId]===e.promptId&&At.finishPromptLocal(e.sessionId),e.type==="questionRequested"&&k2e(e.sessionId,e.question),e.type==="approvalRequested"&&b2e(e.sessionId,e.approval),s!==void 0&&b8(t.sessionId,s)}const Gd=gX(({appEvent:e,meta:t})=>Rme(e,t),({appEvent:e})=>fX(e),{coalesce:yX}),Ome=3e4;let Ux=0,oi=null;const op=new Map;let Eg=0,Yd=null;function Pme(){Yd!==null&&(clearTimeout(Yd),Yd=null)}function jx(e){if(!Me.connected||Yd!==null)return;const t=Math.min(Ome,1e3*2**Eg);Eg+=1,gl("[kimi-web] session work reconciliation incomplete; retrying",e),Yd=setTimeout(()=>{Yd=null,Me.connected&&AN()},t)}function Dme(e,t){const n=new Map(e.map(u=>[u.id,u]));let o=!1,s=!1;const i={...Me.turnActiveBySession},r=[],l=new Map,a=Me.sessions.map(u=>{const c=n.get(u.id);if(c===void 0)return u;const d=t.workEventSeqBySession.get(u.id)??0,f=t.turnEventSeqBySession.get(u.id)??0,h=t.pendingEventBySession.get(u.id),m=d>c.lastSeq,v=f>c.lastSeq,k=h!==void 0&&h.seq>c.lastSeq,w=m||v&&u.mainTurnActive===!0?u.busy||u.mainTurnActive===!0:c.busy,b=m||v?u.mainTurnActive:c.mainTurnActive??(w?u.mainTurnActive:!1),_=k?h.source==="work"?u.pendingInteraction:(Me.approvalsBySession[u.id]?.length??0)>0?"approval":(Me.questionsBySession[u.id]?.length??0)>0?"question":"none":c.pendingInteraction??(w?u.pendingInteraction:"none");(k&&h.source==="work"||!k&&(c.pendingInteraction!==void 0||c.busy===!1))&&_!==void 0&&l.set(u.id,_);const g=m?u.lastTurnReason:c.lastTurnReason;op.set(u.id,Math.max(op.get(u.id)??0,c.lastSeq));const x=t.turnStartBySession.get(u.id);return(b===!1||b===void 0&&!w)&&t.witnessedTurnBySession.has(u.id)&&x!==void 0&&At.isLocalTurnSnapshotCurrent(u.id,x)&&r.push(u.id),b===!0&&!i[u.id]?(i[u.id]=!0,s=!0):(b===!1||!w)&&i[u.id]&&(delete i[u.id],s=!0),u.busy===w&&u.mainTurnActive===b&&u.pendingInteraction===_&&u.lastTurnReason===g?u:(o=!0,{...u,busy:w,mainTurnActive:b,pendingInteraction:_,lastTurnReason:g})});o&&D5(a),s&&Ni(Me.turnActiveBySession,i);for(const[u,c]of l)c==="none"?(delete Me.approvalsBySession[u],delete Me.questionsBySession[u]):c==="question"&&delete Me.approvalsBySession[u];for(const u of r)At.finishPromptLocal(u,{turnWasActive:!0})}async function AN(){const e={workEventSeqBySession:new Map,turnEventSeqBySession:new Map,pendingEventBySession:new Map,turnStartBySession:new Map(Me.sessions.map(t=>[t.id,At.localTurnStartState(t.id)])),witnessedTurnBySession:new Set(Me.sessions.filter(t=>Me.inFlightBySession[t.id]||Me.turnActiveBySession[t.id]).map(t=>t.id))};oi=e;try{const t=await At.listAllSessionsGlobal({shouldContinue:()=>oi===e&&Me.connected});if(oi!==e||!Me.connected)return;Gd.flush(),Dme(t.sessions,e),oi=null,t.error!==void 0?jx(t.error):Eg=0}catch(t){if(oi!==e||!Me.connected)return;oi=null,jx(t)}}function H5(){if(rr!==null||typeof WebSocket>"u")return;bi("ws:connection",{status:"connecting"}),Me.connection="connecting",rr=_t().connectEvents({onEvent(t,n){if(t.type==="workspaceCreated"||t.type==="workspaceUpdated"||t.type==="workspaceDeleted"){At.applyWorkspaceEvent(t);return}const o=t.type==="sessionWorkChanged",s=t.type==="turnActiveChanged",i=t.type==="approvalRequested"||t.type==="approvalResolved"||t.type==="approvalExpired"||t.type==="questionRequested"||t.type==="questionAnswered"||t.type==="questionDismissed";if((o||s||i)&&n.seq>0){const r=op.get(n.sessionId)??0;if(n.seq<=r)return;op.set(n.sessionId,n.seq)}if(oi!==null&&(o||s||i))if(o){const r=oi.workEventSeqBySession.get(n.sessionId)??0;if(n.seq>r&&oi.workEventSeqBySession.set(n.sessionId,n.seq),t.pendingInteraction!==void 0||!t.busy){const l=oi.pendingEventBySession.get(n.sessionId);(l===void 0||n.seq>l.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"work"})}}else if(s){const r=oi.turnEventSeqBySession.get(n.sessionId)??0;n.seq>r&&oi.turnEventSeqBySession.set(n.sessionId,n.seq)}else{const r=oi.pendingEventBySession.get(n.sessionId);(r===void 0||n.seq>r.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"interaction"})}for(const r of vX({appEvent:t,meta:n}))Gd(r)},onResync(t,n,o){bi("ws:resync",{sessionId:t,status:"required",seq:n}),Gd.flush(),Ig.add(t),Lg.request(t)},onError(t,n,o){bi("ws:error",{status:"failed",errorCode:t,fatal:o}),O2({severity:"error",title:Hn.global.t("warnings.wsTitle"),message:n,details:[Lo("message",n)].filter(s=>s!==void 0)})},onConnectionChange(t){bi("ws:connection",{status:t?"connected":"disconnected"}),Me.connected=t,Me.connection=t?"connected":"disconnected",t||(oi=null,op.clear(),Pme(),Eg=0),t&&(Ux+=1,qme(),At.refreshServerMeta())},onReplayComplete(){Gd.flush(),Ux>1&&AN()},onTranscriptReset(t,n,o,s){Tg.receiveReset(t,n,o,s)},onTranscriptOps(t,n,o,s){return Tg.applyOps(t,n,o,s)}})}const w8={},Ig=new Set,um=new Set,MN=new Set;function Bme(e){return Us(e)&&e.code===Hx?!0:typeof e=="object"&&e!==null&&e.code===Hx}function Lo(e,t){if(!(t==null||t===""))return{label:Hn.global.t(`warnings.details.${e}`),value:TN(t)}}function TN(e){if(e instanceof Error)return typeof e.stack=="string"&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Hme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.name=="string"?e.name:void 0}function zme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.message=="string"?e.message:void 0}function Wme(e){return e instanceof Error&&typeof e.stack=="string"&&e.stack?e.stack:void 0}function Ume(e){if(!(typeof e!="number"||!Number.isFinite(e)))return new Date(e).toISOString()}function Vx(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`${Math.round(e)}ms`}function jme(e,t,n){const o=iy(t),s=Us(t),i=o||s?t.timestamp:void 0,r=o||s?t.durationMs:void 0,l=[Lo("operation",e),Lo("sessionId",n??Me.activeSessionId),Lo("connection",Me.connection),Lo("timestamp",Ume(i??Date.now()))];return o?l.push(Lo("duration",Vx(r)),Lo("request",`${t.method} ${t.path}`),Lo("endpoint",t.url),Lo("requestId",t.requestId),Lo("phase",t.phase),Lo("timeout",`${t.timeoutMs}ms`),Lo("status",t.status===void 0?void 0:`${t.status} ${t.statusText??""}`.trim()),Lo("contentType",t.contentType),Lo("responsePreview",t.bodyPreview),Lo("cause",t.cause)):s?l.push(Lo("duration",Vx(r)),Lo("code",t.code),Lo("requestId",t.requestId),Lo("message",t.message),Lo("details",t.details)):l.push(Lo("errorName",Hme(t)),Lo("message",zme(t)??TN(t)),Lo("stack",Wme(t))),l.filter(a=>a!==void 0)}function Vme(e,t,n={}){const o=iy(t),s=Us(t),i=n.title??(o?Hn.global.t("warnings.daemonNetworkTitle"):s?Hn.global.t("warnings.daemonApiTitle"):Hn.global.t("warnings.operationFailedTitle")),r=n.message??(o?Hn.global.t("warnings.daemonNetworkMessage"):s?t.message:Hn.global.t("warnings.operationFailedMessage"));return{severity:"error",title:i,message:r,details:jme(e,t,n.sessionId)}}function O2(e){Me.warnings=[...Me.warnings,e]}function qme(){const e=Hn.global.t("warnings.wsTitle"),t=Me.warnings.filter(n=>!(typeof n=="object"&&n!==null&&n.severity==="error"&&n.title===e));t.length!==Me.warnings.length&&(Me.warnings=t)}function t0(e,t,n){Xl(`[kimi-web] operation failed: ${e}`,t);const o=Us(t),s=iy(t);bi("operation:failed",{sessionId:n?.sessionId,status:"failed",operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:o?t.code:void 0,requestId:o||s?t.requestId:void 0,phase:s?t.phase:void 0,httpStatus:s?t.status:void 0}),O2(Vme(e,t,n))}const Kme={40913:"warnings.goal.alreadyExists",40914:"warnings.goal.notFound",40915:"warnings.goal.statusInvalid",40916:"warnings.goal.notResumable",40918:"warnings.goal.objectiveTooLong"};function Zme(e){if(!Us(e)||e.code===void 0)return;const t=Kme[e.code];return t?Hn.global.t(t):void 0}async function Gme(e){if(pN(e),Me.activeSessionId!==e)return;const t=Me.sessions[0];t?await At.selectSession(t.id,{urlMode:"replace"}):(B5(void 0),Me.sessionLoading=!1,At.writeSessionUrl(void 0,"replace"))}const qx=new Set;async function Yme(e){if(!qx.has(e)){qx.add(e);try{const t=await _t().getSessionWarnings(e),n=Hn.global.t("warnings.noteLabel");for(const o of t)O2(`${n}: ${o.message}`)}catch{}}}async function z5(e,t){const n=At.localTurnStartState(e);try{const s=await _t().getSessionSnapshot(e);if(!Me.sessions.some(c=>c.id===e))return"ok";Gd.flush();const i=Me.lastSeqBySession[e]??0,r=w8[e],l=Ig.has(e)||$g.has(e);if(!l&&r!==void 0&&r===s.epoch&&i>s.asOfSeq)return um.delete(e)||(um.add(e),Lg.request(e)),"ok";if(!At.isLocalTurnSnapshotCurrent(e,n))return At.afterLocalTurnStartsSettle(e,()=>{Lg.request(e)}),"ok";const a=Me.turnRetryBySession[e];a!==void 0&&a.turnId!==s.inFlightTurn?.turnId&&delete Me.turnRetryBySession[e],(l||s.session.lastTurnReason!=="failed")&&delete Me.turnErrorBySession[e];const u=o3(s.session.usage);R2(e,c=>({...s.session,model:s.session.model&&s.session.model.length>0?s.session.model:c.model,usage:u?c.usage:s.session.usage,updatedAt:!s.session.mainTurnActive&&s.session.updatedAt>c.updatedAt?s.session.updatedAt:c.updatedAt})),Eme(e,gQ(Me.messagesBySession[e]??[],s.messages)),Me.tasksBySession[e]=_Q(s.subagents,Me.tasksBySession[e]??[]),Me.messagesHasMoreBySession[e]=s.hasMoreMessages,Me.approvalsBySession[e]=s.pendingApprovals;for(const c of s.pendingApprovals){const d=c.display;d?.kind==="plan_review"&&typeof d.plan=="string"&&d.plan.length>0&&(Me.planReviewByToolCallId[c.toolCallId]={plan:d.plan,path:typeof d.path=="string"?d.path:void 0})}return Me.questionsBySession[e]=s.pendingQuestions,Me.lastSeqBySession[e]=s.asOfSeq,w8[e]=s.epoch,Ig.delete(e),um.delete(e),At.handleSessionSnapshot(e,{inFlightTurn:s.inFlightTurn,busy:s.session.busy}),s.session.mainTurnActive??(s.inFlightTurn!==null&&s.session.busy)?Me.turnActiveBySession[e]=!0:delete Me.turnActiveBySession[e],H5(),rr&&(rr.seedSnapshot(e,s),rr.subscribe(e,{seq:s.asOfSeq,epoch:s.epoch}),Qme(e)),$g.delete(e),u&&t?.skipStatusRefresh!==!0&&_c(e),Yme(e),"ok"}catch(o){return Bme(o)?(await Gme(e),"not-found"):(t0("getSessionSnapshot",o,{title:Hn.global.t("warnings.sessionSnapshotTitle"),message:Hn.global.t("warnings.sessionSnapshotMessage"),sessionId:e}),"failed")}}const Lg=vQ(z5);function Xme(e){return Object.prototype.hasOwnProperty.call(Me.messagesBySession,e)}const Jme=4,ql=[],$g=new Set;function Qme(e){const t=ql.indexOf(e);for(t!==-1&&ql.splice(t,1),ql.unshift(e);ql.length>Jme;){let n=-1;for(let s=ql.length-1;s>=0;s--)if(ql[s]!==Me.activeSessionId){n=s;break}if(n===-1)break;const[o]=ql.splice(n,1);if(o===void 0)break;rr?.unsubscribe(o),$g.add(o)}}function ege(e){const t=ql.indexOf(e);t!==-1&&ql.splice(t,1),$g.delete(e)}async function tge(e){return z5(e)}function u1(e,t){return(Me.inFlightBySession[e]??!1)||(Me.turnActiveBySession[e]??!1)||(t??Me.sessions.find(n=>n.id===e)?.mainTurnActive??!1)}function n0(e){try{const t=new Date(e),o=Date.now()-t.getTime(),s=o/36e5;if(o<6e4)return Hn.global.t("sessions.justNow");if(s<1)return`${Math.round(o/6e4)}m`;if(s<24)return`${Math.round(s)}h`;const i=o/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}const nge=3e4,xc=Z(0);let C4=null;function oge(){C4===null&&(C4=setInterval(()=>{xc.value=(xc.value+1)%Number.MAX_SAFE_INTEGER},nge),C4.unref?.())}function sge(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";if(Array.isArray(t.diff))return{kind:"diff",path:o,diff:t.diff};const s=typeof t.old_text=="string"?t.old_text:typeof t.before=="string"?t.before:void 0,i=typeof t.new_text=="string"?t.new_text:typeof t.after=="string"?t.after:void 0;if(s!==void 0&&i!==void 0){const r=r1(s,i)??Pm(s,i);return{kind:"diff",path:o,diff:r}}return{kind:"diff",path:o,diff:[]}}if(n==="file_io"){const o=typeof t.path=="string"?t.path:"",s=typeof t.operation=="string"?t.operation:"";if(s==="write"&&typeof t.content=="string")return{kind:"file",path:o,content:t.content};if(s==="edit"&&typeof t.before=="string"&&typeof t.after=="string"){const r=r1(t.before,t.after)??Pm(t.before,t.after);return{kind:"diff",path:o,diff:r}}const i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s||n,path:o,detail:i}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action,s=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:DT(o);return{kind:"shell",command:o,cwd:s,danger:i}}if(n==="file_content"||n==="file"){const o=typeof t.path=="string"?t.path:"",s=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:o,content:s,language:i}}if(n==="file_op"||n==="fileop"){const o=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,s=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:o,path:s,detail:i}}if(n==="url_fetch"||n==="url"){const o=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:o}}if(n==="search"){const o=typeof t.query=="string"?t.query:e.action,s=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:o,scope:s}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const o=typeof t.kind=="string"?t.kind:n,s=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:o,name:s,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},u=typeof a.label=="string"?a.label:"";if(!u)return null;const c=typeof a.description=="string"?a.description:void 0;return{label:u,description:c}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function ige(e){return{questionId:e.questionId,sessionId:e.sessionId,toolCallId:e.toolCallId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function rge(e){const t=Me.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const s of t)if(s.role==="assistant")for(const i of s.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const o=`task_id: ${e.id}`;for(const s of t)if(s.role==="tool")for(const i of s.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(o)){const l=n.get(i.toolCallId);if(l)return l}}}function lge(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Hn.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Hn.global.t("tasks.timingDone",{sec:r})}else n=e.status;const o=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,s=e.command??rge(e),i=e.kind==="bash"&&s?`$ ${s}`:void 0;return{id:e.id,agentId:e.agentId,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:o,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId,model:e.model,thinkingEffort:e.thinkingEffort}}const age=R(()=>{const e=Me.sessions.find(n=>n.id===Me.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:Me.workspaceName,branch:t}}),uge=R(()=>(xc.value,Me.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:n0(e.updatedAt),busy:u1(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason,workspaceId:Ml(e),cwd:e.cwd})))),cge=R(()=>Me.activeSessionId??""),dge=R(()=>{const e=Me.activeSessionId;if(e)return Rn.skillsBySession.value[e]??[];const t=P2.value;return t?Rn.skillsByWorkspace.value[t]??[]:[]}),W5=R(()=>{const e=Me.activeSessionId;return e?Me.inFlightBySession[e]??!1:!1}),fge=R(()=>At.isStartingFirstPrompt()),si=fme(Me,{pushOperationFailure:t0,nextOptimisticMsgId:SN,connectEventsIfNeeded:H5,getEventConn:()=>rr,resolveThinkingForPrompt:(e,t)=>Rn.resolveThinkingForPrompt(e,t),refreshSessionStatus:_c}),o0=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=si.sideChatTargetBySession.value[e]?.agentId;return(Me.tasksBySession[e]??[]).filter(n=>n.id!==t)}),EN=ghe(Me,o0),s0=R(()=>{const e=Me.activeSessionId;return e?(Me.turnActiveBySession[e]??!1)||(Me.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),pge=R(()=>{const e=Me.activeSessionId;if(e)return Me.turnErrorBySession[e]}),hge=R(()=>{const e=Me.activeSessionId;if(e&&s0.value)return Me.turnRetryBySession[e]}),IN=e=>_t().getFileUrl(e),mge=[],gge=KT(),vge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=new Set(Me.sideChatUserMessageIdsBySession[e]??[]);return gge({messages:(Me.messagesBySession[e]??[]).filter(n=>!t.has(n.id)),approvals:Me.approvalsBySession[e]??mge,getFileUrl:IN,sessionActive:s0.value,planReviewByToolCallId:Me.planReviewByToolCallId,plansByToolCallId:Mg[e]})}),yge=R(()=>W5.value||s0.value),kge=R(()=>(EN.taskClock.value,o0.value.map(lge))),LN=R(()=>IX(o0.value)),bge=R(()=>$X(o0.value)),vd=R(()=>{const e=Me.activeSessionId;return e?Me.goalBySession[e]??null:null}),Cge=R(()=>{const e=Me.activeSessionId;return e?bX(Me.messagesBySession[e]??[]):[]}),wge=R(()=>{const e=Me.activeSessionId;return e?Me.compactionBySession[e]??null:null}),_ge=R(()=>Me.connection),xge=R(()=>Me.loading),Sge=R(()=>Me.sessionLoading),Age=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadingMoreBySession[e]??!1:!1}),Mge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesHasMoreBySession[e]??!1:!1}),Tge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadMoreErrorBySession[e]??!1:!1}),Ege=R(()=>Me.serverVersion),Ige=R(()=>Me.experimentalFlags),Lge=R(()=>Me.backend),$ge=R(()=>Me.dangerousBypassAuth);function Nge(){Me.dangerousBypassAuth=!1}const Fge=R(()=>Me.permission),Rge=R(()=>Me.thinking),$N=R(()=>{const e=Me.activeSessionId;return e?Me.planModeBySession[e]??!1:F2.planMode}),Oge=R(()=>{const e=Me.activeSessionId;return e?Me.swarmModeBySession[e]??!1:F2.swarmMode}),Pge=R(()=>{const e=Me.activeSessionId;return e?Me.goalModeBySession[e]??!1:F2.goalMode}),Dge=R(()=>{const e=LX(LN.value);return{plan:$N.value,goal:vd.value&&vd.value.status!=="complete"?{status:vd.value.status,turnsUsed:vd.value.turnsUsed,elapsedMs:vd.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Bge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=_t();return(Me.queuedBySession[e]??[]).map(n=>({id:n.id??n.text,text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(o=>({fileId:o.fileId,kind:o.kind,url:t.getFileUrl(o.fileId),name:o.name}))}))}),Hge=R(()=>Me.warnings),zge=R(()=>{const e=Me.activeSessionId;return e?(Me.questionsBySession[e]??[]).map(ige):[]}),Wge=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:sge(t),agentName:t.agentName,toolCallId:t.toolCallId})):[]}),U5=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).length>0?"awaiting-approval":(Me.questionsBySession[e]??[]).length>0?"awaiting-question":W5.value||s0.value?"running":"idle":"idle"}),Rn=dme(Me,{pushOperationFailure:t0,refreshSessionStatus:_c,persistSessionProfile:CN,activity:U5,updateSession:R2,updateSessionMessages:fN,loadConfig:()=>At.loadConfig(),checkAuth:()=>At.checkAuth()}),_8=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),Uge=R(()=>{const e=Me.activeSessionId;return e?Me.gitStatusBySession[e]?.pullRequest??null:null}),jge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=Me.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,o])=>({path:n,status:o})).sort((n,o)=>n.path.localeCompare(o.path)):[]}),Vge=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),NN=R(()=>{const e=Me.sessions.find(r=>r.id===Me.activeSessionId),t=_8.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Rn.draftModel.value:null,o=(e?.model&&e.model.length>0?e.model:n??Me.defaultModel)??"—",s=Rn.models.value.find(r=>r.id===o)??Rn.models.value.find(r=>r.model===o);return{model:s?.displayName||s?.model||(o.includes("/")?o.split("/").pop():o),modelId:s?.id??o,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:Me.permission,branch:t,cwd:e?.cwd??"",isGitRepo:_8.value!==null}}),qge=R(()=>mN.value),Kge=R(()=>Me.sessions.find(t=>t.id===Me.activeSessionId)?.usage.totalCostUsd??0),Zge=R(()=>Me.authReady),Gge=R(()=>Me.defaultModel),Yge=R(()=>Me.managedProviderStatus),Xge=R(()=>Me.managedUserInfo),Jge=R(()=>Me.managedMembership),Qge=R(()=>Me.config),e2e=R(()=>{const e=Me.activeSessionId;if(!e)return{};const t=Me.gitStatusBySession[e];return t?{...t.entries}:{}}),t2e=R(()=>{const e=new Map;for(const t of Me.workspaces){const n=Pr(t.root);e.has(n)||e.set(n,t.id)}return e});function Ml(e){return t2e.value.get(Pr(e.cwd))??e.workspaceId??e.cwd}const j5=R(()=>dJ({workspaces:Me.workspaces,sessions:Me.sessions,hiddenWorkspaceRoots:Me.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:Me.sessionsHasMoreByWorkspace})),Ng=Z(wQ());Je(()=>[j5.value.map(e=>e.id).join("\0"),Me.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],o=UQ(n,Ng.value);o!==null&&(Ng.value=o,wE(o))});const Yo=Z(_E());function FN(e){const t=LJ(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function V5(e){const t=uE(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function n2e(e){const t=new Set(e),n=Yo.value.filter(o=>!t.has(o));n.length!==Yo.value.length&&(Yo.value=n,k1(n))}function o2e(e){Yo.value.includes(e)?V5(e):FN(e)}function s2e(e){const t=cE(e,Yo.value);Yo.value=t,k1(t)}function i2e(e,t,n){const o=ON.value.map(r=>r.id),s=NJ(o,e,t,n),i=cE(s,Yo.value);Yo.value=i,k1(i)}const Yr=R(()=>{const e=j5.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:wme(t.root,Me.fsHome),sessionCount:t.sessionCount}));return jQ(e,Ng.value)}),P2=R(()=>{const e=Me.activeWorkspaceId,t=Yr.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null});Je(P2,e=>{e&&(Object.prototype.hasOwnProperty.call(Rn.skillsByWorkspace.value,e)||Rn.loadSkillsForWorkspace(e))},{immediate:!0});const r2e=R(()=>{const e=P2.value;return e?Yr.value.find(t=>t.id===e)??null:null}),l2e=R(()=>{xc.value;const e=new Set(Yr.value.map(n=>n.id)),t=new Map(Yr.value.map(n=>[n.id,n.name]));return Me.sessions.filter(n=>!n.parentSessionId&&e.has(Ml(n))).map(n=>{const o=Ml(n);return{id:n.id,title:n.title,time:n0(n.updatedAt),busy:u1(n.id,n.mainTurnActive),pendingInteraction:n.pendingInteraction,lastTurnReason:n.lastTurnReason,lastPrompt:n.lastPrompt,workspaceId:o,workspaceName:t.get(o)}})}),Fg=Z(xg),q5=R(()=>{xc.value;const e=new Set(Yr.value.map(l=>l.id)),t=new Map(Yr.value.map(l=>[l.id,l.name])),n=new Set(Yo.value),o=(l,a)=>new Date(a.updatedAt).getTime()-new Date(l.updatedAt).getTime(),s=Me.flatSessionsFrontier,i=[],r=[];for(const l of Me.sessions){if(l.parentSessionId||l.archived||n.has(l.id)||!e.has(Ml(l)))continue;if(kE({busy:u1(l.id,l.mainTurnActive),unread:DN.value[l.id]??!1,renaming:!1,questionCount:x8.value[l.id]?.questions??0,approvalCount:x8.value[l.id]?.approvals??0,pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason}).hasStatus){i.push(l);continue}s!==null&&new Date(l.updatedAt).getTime(){const a=Ml(l);return{id:l.id,title:l.title,time:n0(l.updatedAt),busy:u1(l.id,l.mainTurnActive),pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason,lastPrompt:l.lastPrompt,updatedAt:l.updatedAt,workspaceId:a,workspaceName:t.get(a),cwdLabel:l.cwd?v1(l.cwd):"-",pullRequest:l.pullRequest}})}),a2e=R(()=>q5.value.slice(0,Fg.value)),u2e=R(()=>Me.flatSessionsHasMore||Fg.valueq5.value.length&&Me.flatSessionsHasMore&&At.loadMoreFlatSessions()}function RN(e){xc.value;const t=new Set(Yo.value),n=new Map,o=new Map;for(const s of Me.sessions.toSorted((i,r)=>new Date(r.updatedAt).getTime()-new Date(i.updatedAt).getTime())){if(s.parentSessionId)continue;const i=Ml(s);if(e&&t.has(s.id)){o.set(i,(o.get(i)??0)+1);continue}const r={id:s.id,title:s.title,time:n0(s.updatedAt),busy:u1(s.id,s.mainTurnActive),pendingInteraction:s.pendingInteraction,lastTurnReason:s.lastTurnReason,updatedAt:s.updatedAt},l=n.get(i)??[];l.push(r),n.set(i,l)}return Yr.value.map(s=>({workspace:s,sessions:n.get(s.id)??[],pinnedCount:o.get(s.id)??0,hasMore:Me.sessionsHasMoreByWorkspace[s.id]??!1,loadingMore:Me.sessionsLoadingMoreByWorkspace[s.id]??!1,initialCount:Me.sessionsInitialCountByWorkspace[s.id]??am}))}const d2e=R(()=>RN(!0)),f2e=R(()=>RN(!1)),ON=R(()=>{xc.value;const e=new Set(Yr.value.map(o=>o.id)),t=new Map(Yr.value.map(o=>[o.id,o.name])),n=Me.sessions.filter(o=>!o.parentSessionId&&!o.archived&&e.has(Ml(o)));return $J(n,Yo.value).pinned.map(o=>{const s=Ml(o);return{id:o.id,title:o.title,time:n0(o.updatedAt),busy:u1(o.id,o.mainTurnActive),pendingInteraction:o.pendingInteraction,lastTurnReason:o.lastTurnReason,updatedAt:o.updatedAt,workspaceId:s,workspaceName:t.get(s),pinned:!0,cwdLabel:o.cwd?v1(o.cwd):"-",pullRequest:o.pullRequest}})});function p2e(e){Ng.value=e,wE(e)}const PN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),x8=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),DN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.unreadBySession))n&&(e[t]=!0);return e}),h2e=R(()=>{const e={},t=PN.value;for(const n of Me.sessions){const o=t[n.id]??0;if(o<=0)continue;const s=Ml(n);e[s]=(e[s]??0)+o}return e}),m2e=R(()=>Me.recentRoots),g2e=R(()=>Me.availableOpenInApps),At=ame(Me,{taskPoller:EN,sideChat:si,modelProvider:Rn,pushOperationFailure:t0,activity:U5,sessionsKnownEmpty:MN,setSessions:D5,updateSession:R2,upsertSessionFront:Sme,appendSession:Ame,forgetSession:pN,unpinSessions:n2e,setActiveSessionId:B5,updateSessionMessages:fN,nextOptimisticMsgId:SN,getEventConn:()=>rr,syncSessionFromSnapshot:z5,reopenSession:tge,hasLoadedMessages:Xme,refreshSessionStatus:_c,refreshSessionGoal:Lme,refreshSessionPlans:b8,persistSessionProfile:CN,mergedWorkspaces:j5,workspacesView:Yr,status:NN,workspaceIdForSession:Ml,savePermissionToStorage:vme,savePlanModeToStorage:lN,saveSwarmModeToStorage:aN,saveGoalModeToStorage:uN,draftModes:F2,saveUnread:Iy,saveActiveWorkspaceToStorage:Cme,saveHiddenWorkspacesToStorage:bme,goalErrorMessage:Zme,initialized:kN,connectIssue:bN,selectedDiffPath:hN,fileDiffLines:mN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN});function K5(e){return e===Me.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible"&&document.hasFocus()}function v2e(e){Me.turnActiveBySession[e]&&delete Me.turnActiveBySession[e],Me.inFlightBySession[e]&&(Me.inFlightBySession[e]=!1)}function y2e(e,t,n){const o=Me.promptIdBySession[e];At.finishPromptLocal(e,{turnWasActive:n}),e===Me.activeSessionId?(At.loadGitStatus(e),_c(e)):t==="idle"&&(Me.unreadBySession[e]=!0,Iy({[e]:!0}));const s=(Me.approvalsBySession[e]??[]).length>0,i=(Me.questionsBySession[e]??[]).length>0;ohe(t,s,i)&&Da.maybeNotifyCompletion(e,{isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",promptId:o,onClick:()=>{At.selectSession(e)}})}function k2e(e,t){const n=t.questions[0],o=n?.header?.trim()??"",s=n?.question?.trim()??"",i=o&&s?`${o}: ${s}`:s||o;Da.maybeNotifyQuestion({isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,questionId:t.questionId,onClick:()=>{At.selectSession(e)}})}function b2e(e,t){Da.maybeNotifyApproval({isUserWatching:K5(e),sessionTitle:Me.sessions.find(n=>n.id===e)?.title??"",toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{At.selectSession(e)}})}function mu(){return oge(),{workspace:age,sessions:uge,activeSessionId:cge,workspacesView:Yr,visibleWorkspace:r2e,activeWorkspaceId:P2,sessionsForView:l2e,workspaceGroups:d2e,mobileWorkspaceGroups:f2e,pinnedSessions:ON,flatSessions:a2e,flatSessionsHasMore:u2e,flatSessionsLoadingMore:R(()=>Me.flatSessionsLoadingMore),attentionBySession:PN,pendingBySession:x8,attentionByWorkspace:h2e,unreadBySession:DN,recentRoots:m2e,turns:vge,tasks:kge,activeAppTasks:o0,auxiliaryTranscripts:Tg,getFileUrl:IN,todos:Cge,goal:vd,swarms:LN,swarmMembersByToolCallId:bge,activationBadges:Dge,compaction:wge,status:NN,sessionCost:Kge,fileDiff:qge,selectedDiffPath:hN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN,changes:jge,gitInfo:_8,gitDiffStats:Vge,activePullRequest:Uge,changesByPath:e2e,pendingApprovals:Wge,availableOpenInApps:g2e,connection:_ge,loading:xge,sessionLoading:Sge,loadingMoreMessages:Age,hasMoreMessages:Mge,loadMoreMessagesError:Tge,serverVersion:Ege,backend:Lge,dangerousBypassAuth:$ge,experimentalFlags:Ige,clearDangerousBypassAuth:Nge,initialized:kN,connectIssue:bN,permission:Fge,thinking:Rge,planMode:$N,swarmMode:Oge,goalMode:Pge,queued:Bge,warnings:Hge,questions:zge,activity:U5,turnActive:s0,activeTurnError:pge,activeTurnRetry:hge,inFlight:W5,working:yge,isStartingFirstPrompt:fge,models:Rn.models,starredModelIds:Rn.starredModelIds,providers:Rn.providers,fontScale:$h.fontScale,setFontScale:$h.setFontScale,colorScheme:$h.colorScheme,setColorScheme:$h.setColorScheme,notifyEnabled:Da.notifyEnabled,notifySound:Da.notifySound,notifyPermission:Da.notifyPermission,setNotifyEnabled:Da.setNotifyEnabled,setNotifySound:Da.setNotifySound,onboarded:xN,setOnboarded:Nme,load:At.load,selectSession:At.selectSession,clearActiveSession:At.clearActiveSession,loadOlderMessages:At.loadOlderMessages,loadWorkspaces:At.loadWorkspaces,loadMoreSessions:At.loadMoreSessions,loadAllSessions:At.loadAllSessions,ensureFlatSessions:At.ensureFlatSessions,loadMoreFlatSessions:c2e,selectWorkspace:At.selectWorkspace,openWorkspace:At.openWorkspace,openWorkspaceDraft:At.openWorkspaceDraft,startSessionAndSendPrompt:At.startSessionAndSendPrompt,startSessionAndActivateSkill:At.startSessionAndActivateSkill,startSessionAndOpenSideChat:At.startSessionAndOpenSideChat,addWorkspaceByPath:At.addWorkspaceByPath,browseFs:At.browseFs,getFsHome:At.getFsHome,sendPrompt:At.sendPrompt,steerPrompt:At.steerPrompt,sideChatVisible:si.sideChatVisible,sideChatSessionId:si.sideChatSessionId,sideChatTurns:si.sideChatTurns,sideChatRunning:si.sideChatRunning,sideChatSending:si.sideChatSending,openSideChat:si.openSideChat,closeSideChat:si.closeSideChat,sendSideChatPrompt:si.sendSideChatPrompt,uploadImage:At.uploadImage,abortCurrentPrompt:At.abortCurrentPrompt,respondApproval:At.respondApproval,respondQuestion:At.respondQuestion,dismissQuestion:At.dismissQuestion,pendingQuestionActions:At.pendingQuestionActions,pendingApprovalActions:At.pendingApprovalActions,cancelTask:At.cancelTask,setPermission:At.setPermission,setThinking:Rn.setThinking,setPlanMode:At.setPlanMode,togglePlanMode:At.togglePlanMode,setSwarmMode:At.setSwarmMode,toggleSwarmMode:At.toggleSwarmMode,setGoalMode:At.setGoalMode,toggleGoalMode:At.toggleGoalMode,createGoal:At.createGoal,controlGoal:At.controlGoal,enqueue:At.enqueue,dismissWarning:At.dismissWarning,renameSession:At.renameSession,renameWorkspace:At.renameWorkspace,deleteWorkspace:At.deleteWorkspace,reorderWorkspaces:p2e,pinSession:FN,unpinSession:V5,togglePinSession:o2e,reorderPinnedSessions:s2e,pinSessionAt:i2e,archiveSession:At.archiveSession,exportSession:At.exportSession,restoreSession:At.restoreSession,loadArchivedSessions:At.loadArchivedSessions,compact:At.compact,forkSession:At.forkSession,undo:At.undo,unqueue:At.unqueue,reorderQueue:At.reorderQueue,searchFiles:At.searchFiles,loadGitStatus:At.loadGitStatus,loadFileDiff:At.loadFileDiff,clearFileDiff:At.clearFileDiff,listDir:At.listDir,readFileContent:At.readFileContent,readHostFileContent:At.readHostFileContent,getFileDownloadUrl:At.getFileDownloadUrl,openWorkspaceFile:At.openWorkspaceFile,openInApp:At.openInApp,revealWorkspaceFile:At.revealWorkspaceFile,resolveImageUrl:At.resolveImageUrl,loadModels:Rn.loadModels,loadProviders:Rn.loadProviders,skills:dge,activateSkill:Rn.activateSkill,setModel:Rn.setModel,toggleStarModel:Rn.toggleStarModel,addProvider:Rn.addProvider,updateProvider:Rn.updateProvider,getProvider:Rn.getProvider,deleteProvider:Rn.deleteProvider,refreshProvider:Rn.refreshProvider,refreshAllProviders:Rn.refreshAllProviders,loadCatalogProviders:Rn.loadCatalogProviders,importCatalogProvider:Rn.importCatalogProvider,importCustomRegistry:Rn.importCustomRegistry,authReady:Zge,defaultModel:Gge,managedProviderStatus:Yge,managedUserInfo:Xge,managedMembership:Jge,notify:O2,config:Qge,loadConfig:At.loadConfig,updateConfig:At.updateConfig,checkAuth:At.checkAuth,probeManagedMembership:At.probeManagedMembership,startOAuthLogin:Rn.startOAuthLogin,pollOAuthLogin:Rn.pollOAuthLogin,cancelOAuthLogin:Rn.cancelOAuthLogin,getUsage:Rn.getUsage,logout:At.logout}}const C2e=["aria-expanded"],w2e={class:"user-menu-avatar","aria-hidden":"true"},_2e=["src"],x2e={class:"user-menu-name"},S2e={class:"user-menu-name"},A2e={class:"user-menu-item-label"},M2e={class:"user-menu-item-label"},T2e={class:"user-menu-item-label user-menu-login-label"},E2e={class:"user-menu-item-label"},I2e={class:"user-menu-row-value"},L2e={class:"user-menu-item-label"},$2e={class:"user-menu-row-value"},N2e={class:"user-menu-item-label"},F2e={key:0,class:"user-menu-usage"},R2e={key:0,class:"user-menu-usage-state"},O2e={key:1,class:"user-menu-usage-state"},P2e={class:"user-menu-usage-error"},D2e={key:2,class:"user-menu-usage-state user-menu-usage-empty"},B2e={class:"user-menu-usage-main"},H2e={class:"user-menu-usage-label"},z2e={key:0,class:"user-menu-usage-hint"},W2e={class:"user-menu-item-label"},U2e={class:"user-menu-item-label"},j2e=et({__name:"UserMenu",emits:["login","openSettings"],setup(e,{emit:t}){const n=t,{t:o,locale:s}=Nt(),i=mu(),{confirm:r}=hu(),l=R(()=>i.managedProviderStatus.value==="authenticated"),a=i.managedUserInfo,u=i.managedMembership,c=R(()=>a.value?.nickname||o("sidebar.defaultUserName")),d=R(()=>u.value==="free"||OJ(a.value?.userLevel)),f=R(()=>u.value!=="free"),h=Z(!1);Je(()=>a.value?.avatar,()=>{h.value=!1});const m=R(()=>!!a.value?.avatar&&!h.value),v=i.colorScheme,k=R(()=>o(`theme.${v.value}`)),w=R(()=>v.value==="light"?"light-mode":v.value==="dark"?"dark-mode":"follow-system"),b=[{value:"light",labelKey:"theme.light",icon:"light-mode"},{value:"dark",labelKey:"theme.dark",icon:"dark-mode"},{value:"system",labelKey:"theme.system",icon:"follow-system"}];function _(te){i.setColorScheme(te)}const g=R(()=>yg.find(te=>te.code===s.value)?.label??s.value);function x(te){s.value!==te&&E5(te)}const S=Z(!1),T=Z({}),A=Z(null),E=Z(null);let P=null;function D(te){const ce=te.target;ce.closest(".user-menu")||ce.closest(".user-menu-trigger")||ce.closest(".user-submenu")||O()}function I(te){te.key==="Escape"&&(te.stopPropagation(),O())}async function $(){if(S.value){O();return}S.value=!0,document.addEventListener("mousedown",D),document.addEventListener("keydown",I,!0),window.addEventListener("resize",O),l.value&&oe(),await yt(),B();const te=E.value;te&&(P=new ResizeObserver(H),P.observe(te))}function B(){const te=E.value,ce=A.value?.el;if(!te||!ce)return;const ue=te.getBoundingClientRect(),Se=4,ze=8,_e=ce.offsetHeight,Ee={left:`${Math.round(ue.left)}px`,width:`${Math.round(ue.width)}px`};ue.top-_e-Se{W[te]=ce instanceof HTMLElement?ce:ce?.$el??null}}function ie(te){le(),F.value!==te&&(F.value=te,yt(Ie))}function ne(te,ce){te.key!=="Enter"&&te.key!==" "&&te.key!=="ArrowRight"||(te.preventDefault(),ie(ce))}function X(){le(),K=setTimeout(()=>{F.value=null,K=null},250)}function le(){K!==null&&(clearTimeout(K),K=null)}function Ie(){const te=F.value,ce=A.value?.el,ue=z.value?.el,Se=te!==null?W[te]:null;if(!ce||!ue||!Se)return;const ze=4,_e=8,Ee=ce.getBoundingClientRect(),it=Se.getBoundingClientRect(),Fe=ue.offsetHeight,Oe=Math.min(ue.offsetWidth,Ee.width);let Ge=Ee.right+ze,at=!1;Ge+Oe>window.innerWidth-_e&&(Ge=Math.max(_e,Ee.left-Oe-ze),at=!0);const Tt=Math.max(_e,Math.min(it.top,window.innerHeight-Fe-_e));U.value={top:`${Math.round(Tt)}px`,left:`${Math.round(Ge)}px`,maxWidth:`${Math.round(Ee.width)}px`,transformOrigin:at?"top right":"top left","--menu-pop-shift":"-2px"}}const de=Z(!1),pe=Z(null);let ve=0;async function oe(){const te=++ve;de.value=!0;try{const ce=await i.getUsage();te===ve&&(pe.value=ce)}finally{te===ve&&(de.value=!1)}}const ye=R(()=>{if(pe.value?.kind!=="ok")return[];const{summary:te,limits:ce}=pe.value,ue=FJ(ce,5,"hour");return[te,ue].filter(Se=>Se!=null)}),G=R(()=>pe.value?.kind==="error"?pe.value.message:o("settings.planUsage.loadFailed"));function Y(te){return te.resetAt===void 0?"":fE(te.resetAt,o)}function fe(){O(),jp()}function we(){O(),n("login")}function ge(){O(),n("openSettings")}async function Q(){O(),await r({title:o("sidebar.logoutConfirmTitle"),message:o("sidebar.logoutConfirmMessage"),variant:"danger",action:()=>i.logout()})}return(te,ce)=>(y(),M(Pe,null,[C("button",{ref_key:"triggerRef",ref:E,class:"user-menu-trigger",type:"button","aria-haspopup":"menu","aria-expanded":S.value,onClick:It($,["stop"])},[l.value?(y(),M(Pe,{key:0},[C("span",w2e,[m.value?(y(),M("img",{key:0,src:p(a)?.avatar,alt:"",onError:ce[0]||(ce[0]=ue=>h.value=!0)},null,40,_2e)):(y(),he(p(Te),{key:1,name:"user",size:"sm"}))]),C("span",x2e,N(c.value),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"user"}),C("span",S2e,N(p(o)("sidebar.notSignedIn")),1)],64))],8,C2e),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[S.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:A,class:"user-menu",style:Zt(T.value),onClick:ce[14]||(ce[14]=It(()=>{},["stop"]))},{default:me(()=>[l.value?(y(),M(Pe,{key:0},[f.value?(y(),he(p(hn),{key:0,ref:V("usage"),"aria-haspopup":"true","aria-expanded":F.value==="usage",onMouseenter:ce[1]||(ce[1]=ue=>ie("usage")),onMouseleave:X,onFocus:ce[2]||(ce[2]=ue=>ie("usage")),onBlur:X,onClick:ce[3]||(ce[3]=ue=>ie("usage")),onKeydown:ce[4]||(ce[4]=ue=>ne(ue,"usage"))},{default:me(()=>[j(p(Te),{name:"histogram",size:"sm"}),C("span",A2e,N(p(o)("settings.planUsage.title")),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"])):ee("",!0),d.value?(y(),he(p(hn),{key:1,onClick:fe,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"music",size:"sm"}),C("span",M2e,N(p(o)("sidebar.upgrade")),1),j(p(Te),{name:"external-link",size:"sm"})]),_:1})):ee("",!0),j(p(hn),{separator:""})],64)):(y(),M(Pe,{key:1},[j(p(hn),{class:"user-menu-login",onClick:we,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-in",size:"sm"}),C("span",T2e,N(p(o)("sidebar.signIn")),1)]),_:1}),j(p(hn),{separator:""})],64)),j(p(hn),{ref:V("theme"),"aria-haspopup":"true","aria-expanded":F.value==="theme",onMouseenter:ce[5]||(ce[5]=ue=>ie("theme")),onMouseleave:X,onFocus:ce[6]||(ce[6]=ue=>ie("theme")),onBlur:X,onClick:ce[7]||(ce[7]=ue=>ie("theme")),onKeydown:ce[8]||(ce[8]=ue=>ne(ue,"theme"))},{default:me(()=>[j(p(Te),{name:w.value,size:"sm"},null,8,["name"]),C("span",E2e,N(p(o)("theme.colorSchemeLabel")),1),C("span",I2e,N(k.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{ref:V("language"),"aria-haspopup":"true","aria-expanded":F.value==="language",onMouseenter:ce[9]||(ce[9]=ue=>ie("language")),onMouseleave:X,onFocus:ce[10]||(ce[10]=ue=>ie("language")),onBlur:X,onClick:ce[11]||(ce[11]=ue=>ie("language")),onKeydown:ce[12]||(ce[12]=ue=>ne(ue,"language"))},{default:me(()=>[j(p(Te),{name:"translate",size:"sm"}),C("span",L2e,N(p(o)("sidebar.language")),1),C("span",$2e,N(g.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{onClick:ge,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"settings",size:"sm"}),C("span",N2e,N(p(o)("settings.title")),1)]),_:1}),l.value?(y(),M(Pe,{key:2},[j(p(hn),{separator:""}),j(p(hn),{onClick:ce[13]||(ce[13]=ue=>void Q()),onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-out",size:"sm"}),qe(" "+N(p(o)("sidebar.signOut")),1)]),_:1})],64)):ee("",!0)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[F.value!==null?(y(),he(p(Cl),{key:0,ref_key:"submenuRef",ref:z,class:"user-submenu",style:Zt(U.value),role:F.value==="usage"?"dialog":"menu",onClick:ce[16]||(ce[16]=It(()=>{},["stop"])),onMouseenter:le,onMouseleave:X,onFocusin:le,onFocusout:X},{default:me(()=>[F.value==="usage"?(y(),M("div",F2e,[de.value?(y(),M("div",R2e,[j(p(Ao),{size:"sm"})])):pe.value?.kind!=="ok"?(y(),M("div",O2e,[C("span",P2e,N(G.value),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:ce[15]||(ce[15]=ue=>void oe())},{default:me(()=>[qe(N(p(o)("settings.planUsage.retry")),1)]),_:1})])):ye.value.length===0?(y(),M("span",D2e,N(p(o)("settings.planUsage.empty")),1)):(y(!0),M(Pe,{key:3},pt(ye.value,(ue,Se)=>(y(),M("div",{key:Se,class:"user-menu-usage-row"},[C("span",B2e,[C("span",H2e,N(p(dE)(ue,p(o))),1),Y(ue)?(y(),M("span",z2e,N(Y(ue)),1)):ee("",!0)]),C("span",{class:Re(["user-menu-usage-value",`sev-${p(C3)(ue.used,ue.limit)}`])},N(p(Wh)(ue.used,ue.limit))+"% ",3)]))),128))])):F.value==="theme"?(y(),M(Pe,{key:1},pt(b,ue=>j(p(hn),{key:ue.value,onClick:Se=>_(ue.value)},{default:me(()=>[j(p(Te),{name:ue.icon,size:"sm"},null,8,["name"]),C("span",W2e,N(p(o)(ue.labelKey)),1),p(v)===ue.value?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"])),64)):(y(!0),M(Pe,{key:2},pt(p(yg),ue=>(y(),he(p(hn),{key:ue.code,onClick:Se=>x(ue.code)},{default:me(()=>[C("span",U2e,N(ue.label),1),p(s)===ue.code?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"]))),128))]),_:1},8,["style","role"])):ee("",!0)]),_:1})]))],64))}}),V2e=ft(j2e,[["__scopeId","data-v-06f13413"]]),q2e={class:"ep-search"},K2e=["placeholder"],Z2e={class:"ep-scroll"},G2e={key:0,class:"ep-grid"},Y2e=["onClick"],X2e={key:1,class:"ep-empty"},J2e={class:"ep-label"},Q2e={class:"ep-grid"},eve=["onClick"],tve={class:"ep-label"},nve={class:"ep-grid"},ove=["onClick"],Kx="kimi-web.recent-emojis",sve=et({__name:"SessionEmojiPicker",props:{current:{default:null},removable:{type:Boolean,default:!0}},emits:["pick"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),{handleCompositionStart:s,handleCompositionEnd:i,isComposingKeyEvent:r}=Ar(),l=e,a=n,u=["⏳","⚠️","🐛","✨","🔥","🚀","🎯","🧪","📝","🔍","🛠️","💡","📦","🎨","🔒","📈","🧹","🚧","✅","❓","🌙","☕","🐳","🗂️","📊","🤖","🧩","⚙️","🌱","📌","💥","🕐"],c={faces:"sidebar.emojiGroupFaces",nature:"sidebar.emojiGroupNature",food:"sidebar.emojiGroupFood",activity:"sidebar.emojiGroupActivity",objects:"sidebar.emojiGroupObjects",symbols:"sidebar.emojiGroupSymbols"},d=sJ.map(S=>({id:S,labelKey:c[S],emojis:sE.filter(T=>T.group===S).map(T=>T.emoji)})),f=Z(h());function h(){try{const S=JSON.parse(localStorage.getItem(Kx)??"[]");return Array.isArray(S)?S.filter(T=>typeof T=="string"):[]}catch{return[]}}function m(S){f.value=aJ(f.value,S);try{localStorage.setItem(Kx,JSON.stringify(f.value))}catch{}a("pick",S)}const v=Z(""),k=R(()=>v.value.trim().length>0),w=R(()=>rJ(v.value)),b=Z(null);dn(()=>b.value?.focus());function _(S){if(r(S))return;const T=w.value[0];k.value&&T&&m(T)}function g(){let S=l.current??void 0;for(;S===void 0||S===l.current;)S=u[Math.floor(Math.random()*u.length)];m(S)}const x=Z(null);return t({el:R(()=>x.value?.el),isComposingKeyEvent:r}),(S,T)=>(y(),he(p(Cl),{ref_key:"menuRef",ref:x,class:"emoji-picker",role:"dialog","aria-label":p(o)("sidebar.sessionEmojiTitle"),onKeydown:T[4]||(T[4]=It(()=>{},["stop"]))},{default:me(()=>[C("div",q2e,[j(p(Te),{name:"search",size:"sm"}),Bn(C("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":T[0]||(T[0]=A=>v.value=A),class:"ep-input",type:"text",placeholder:p(o)("sidebar.searchEmoji"),autocomplete:"off",spellcheck:"false",onKeydown:xl(_,["enter"]),onCompositionstart:T[1]||(T[1]=(...A)=>p(s)&&p(s)(...A)),onCompositionend:T[2]||(T[2]=(...A)=>p(i)&&p(i)(...A))},null,40,K2e),[[ai,v.value]])]),C("div",Z2e,[k.value?(y(),M(Pe,{key:0},[w.value.length?(y(),M("div",G2e,[(y(!0),M(Pe,null,pt(w.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,Y2e))),128))])):(y(),M("div",X2e,N(p(o)("sidebar.noEmojiResults")),1))],64)):(y(),M(Pe,{key:1},[f.value.length?(y(),M(Pe,{key:0},[C("div",J2e,N(p(o)("sidebar.recentEmojis")),1),C("div",Q2e,[(y(!0),M(Pe,null,pt(f.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,eve))),128))])],64)):ee("",!0),(y(!0),M(Pe,null,pt(p(d),A=>(y(),M(Pe,{key:A.id},[C("div",tve,N(p(o)(A.labelKey)),1),C("div",nve,[(y(!0),M(Pe,null,pt(A.emojis,E=>(y(),M("button",{key:E,class:Re(["ep-e",{sel:E===e.current}]),type:"button",onClick:P=>m(E)},N(E),11,ove))),128))])],64))),128))],64))]),j(p(hn),{separator:""}),j(p(hn),{role:"button",disabled:!(e.current&&e.removable),onClick:T[3]||(T[3]=A=>a("pick",null))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(o)("sidebar.removeEmoji")),1)]),_:1},8,["disabled"]),j(p(hn),{role:"button",onClick:g},{default:me(()=>[j(p(Te),{name:"sparkles",size:"sm"}),qe(" "+N(p(o)("sidebar.randomEmoji")),1)]),_:1})]),_:1},8,["aria-label"]))}}),ive=ft(sve,[["__scopeId","data-v-05e46bbb"]]),rve={class:"row"},lve={key:0,class:"lead","aria-hidden":"true"},ave={key:1,class:"unread-dot"},uve={class:"left"},cve=["onKeydown"],dve=["aria-label"],fve={class:"act"},pve={key:0,class:"ts"},hve={key:1,class:"st"},mve={key:1,class:"unread-dot"},gve={key:2,class:"ha"},vve={key:0,class:"sub"},yve={class:"sub-text"},kve=["aria-label"],bve={class:"menu-time"},Cve=et({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","renameStateChange","archive","fork","export","pin"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n;function r(ue){const Se=new Date(ue);if(Number.isNaN(Se.getTime()))return ue;const ze=_e=>String(_e).padStart(2,"0");return`${Se.getFullYear()}-${ze(Se.getMonth()+1)}-${ze(Se.getDate())} ${ze(Se.getHours())}:${ze(Se.getMinutes())}`}const l=R(()=>s.session.updatedAt?r(s.session.updatedAt):s.session.time),a=R(()=>s.session.cwdLabel!==void 0),u=R(()=>kE({busy:s.session.busy,unread:s.unread,renaming:W.value,questionCount:s.questionCount,approvalCount:s.approvalCount,pendingInteraction:s.session.pendingInteraction,lastTurnReason:s.session.lastTurnReason})),c=R(()=>u.value.showQuestionBadge),d=R(()=>u.value.showApprovalBadge),f=R(()=>u.value.showAbortedBadge),h=R(()=>u.value.showBusySpinner),m=R(()=>u.value.hasStatus),v=Z(!1),k=Z(null),w=Z({});function b(ue){const Se=ue.target;k.value?.el?.contains(Se)||g()}async function _(){$(),v.value=!0,setTimeout(()=>document.addEventListener("mousedown",b),0),window.addEventListener("resize",g),await yt()}function g(){v.value=!1,document.removeEventListener("mousedown",b),window.removeEventListener("resize",g)}bn(()=>{document.removeEventListener("mousedown",b),document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",g),window.removeEventListener("resize",$)});const x=R(()=>yE(s.session.title)),S=R(()=>{const ue=x.value.emoji;return ue?s.session.title.slice(ue.length):s.session.title}),T=Z(!1),A=Z(null),E=Z({});let P=null;function D(ue,Se,ze){const _e=A.value?.el,Ee=4,it=8,Fe=_e?.offsetHeight??0,Oe=_e?.offsetWidth??0;let Ge=ue.bottom+Ee,at=!1;Ge+Fe>window.innerHeight-it&&(Ge=Math.max(it,ue.top-Fe-Ee),at=!0);const Tt=ze??(Se==="left"?ue.left:ue.right-Oe),Bt=Math.max(it,Math.min(Tt,window.innerWidth-Oe-it)),Yt=ze===void 0?Se:`${Math.round(Math.min(Math.max(ze-Bt,0),Oe))}px`;E.value={top:`${Math.round(Ge)}px`,left:`${Math.round(Bt)}px`,transformOrigin:`${Yt} ${at?"bottom":"top"}`,"--menu-pop-shift":at?"2px":"-2px"}}async function I(ue,Se,ze="left",_e){const Ee=Se??ue?.getBoundingClientRect();if(Ee){if(T.value){$();return}g(),P=ue??null,T.value=!0,setTimeout(()=>document.addEventListener("mousedown",B),0),window.addEventListener("keydown",H,!0),window.addEventListener("resize",$),await yt(),D(Ee,ze,_e)}}function $(){T.value=!1,P=null,document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",$)}function B(ue){const Se=ue.target;A.value?.el?.contains(Se)||P?.contains(Se)||$()}function H(ue){ue.key==="Escape"&&(A.value?.isComposingKeyEvent(ue)||(ue.preventDefault(),ue.stopPropagation(),$()))}function O(ue){return ue.clientX||ue.clientY?new DOMRect(ue.clientX,ue.clientY,0,0):void 0}function F(ue){ue.stopPropagation();const Se=ue;I(Se.currentTarget,O(Se),"left",Se.clientX||void 0)}function U(ue){const Se=k.value?.el,ze=ue,_e=O(ze)??Se?.getBoundingClientRect();g(),I(Se,_e,"left",ze.clientX||void 0)}function z(ue){if($(),ue===x.value.emoji)return;const Se=dQ(s.session.title,ue);Se&&Se!==s.session.title&&i("rename",s.session.id,Se)}const W=Z(!1),K=Z(""),V=Z(null),{handleCompositionStart:ie,handleCompositionEnd:ne,isComposingKeyEvent:X}=Ar();async function le(){g(),$(),W.value=!0,K.value=s.session.title,await yt();try{V.value?.focus(),V.value?.select()}catch{}}function Ie(){const ue=K.value.trim();ue&&ue!==s.session.title&&i("rename",s.session.id,ue),W.value=!1}function de(ue){X(ue)||Ie()}function pe(ue){X(ue)||ve()}function ve(){W.value=!1}Je(W,ue=>i("renameStateChange",ue));async function oe(ue){W.value||(ue.preventDefault(),ue.stopPropagation(),v.value&&g(),await _(),ye(ue))}function ye(ue){const Se=k.value?.el,ze=8,_e=Se?.offsetHeight??0,Ee=Se?.offsetWidth??0;let it=ue.clientY,Fe=!1;it+_e>window.innerHeight-ze&&(it=Math.max(ze,ue.clientY-_e),Fe=!0);let Oe=ue.clientX,Ge=!1;Oe+Ee>window.innerWidth-ze&&(Oe=Math.max(ze,ue.clientX-Ee),Ge=!0),w.value={top:`${Math.round(it)}px`,left:`${Math.round(Oe)}px`,transformOrigin:`${Fe?"bottom":"top"} ${Ge?"right":"left"}`,"--menu-pop-shift":Fe?"2px":"-2px"}}const G=Z(!1),Y=Z(!1);async function fe(){const ue=await Zs(s.session.id);G.value=ue,Y.value=!ue,setTimeout(()=>{G.value=!1,Y.value=!1,g()},1500)}function we(){g(),i("fork",s.session.id)}function ge(){g(),i("export",s.session.id)}function Q(){g(),i("pin",s.session.id)}function te(){g(),i("archive",s.session.id)}t({closeMenu:g});function ce(){const ue=s.session.pullRequest?.url;ue&&window.open(ue,"_blank","noopener")}return(ue,Se)=>(y(),M("div",{class:Re(["se",{on:e.active,flat:a.value}]),onClick:Se[7]||(Se[7]=ze=>i("select",e.session.id)),onContextmenu:oe},[C("div",rve,[a.value?ee("",!0):(y(),M("span",lve,[e.session.busy?(y(),he(p(Ao),{key:0,size:"sm"})):e.unread?(y(),M("span",ave)):ee("",!0)])),C("div",uve,[W.value?Bn((y(),M("input",{key:0,ref_key:"renameInputRef",ref:V,"onUpdate:modelValue":Se[0]||(Se[0]=ze=>K.value=ze),class:"rename-input",onClick:Se[1]||(Se[1]=It(()=>{},["stop"])),onKeydown:[xl(It(de,["stop"]),["enter"]),xl(It(pe,["stop"]),["esc"])],onCompositionstart:Se[2]||(Se[2]=(...ze)=>p(ie)&&p(ie)(...ze)),onCompositionend:Se[3]||(Se[3]=(...ze)=>p(ne)&&p(ne)(...ze)),onBlur:Ie},null,40,cve)),[[ai,K.value]]):(y(),M("span",{key:1,class:"t",onDblclick:It(le,["stop"])},[x.value.emoji?(y(),M("button",{key:0,type:"button",class:"emoji","aria-label":p(o)("sidebar.setEmoji"),onClick:It(F,["stop"]),onDblclick:Se[4]||(Se[4]=It(()=>{},["stop"]))},N(x.value.emoji),41,dve)):ee("",!0),qe(N(S.value),1)],32))]),C("span",fve,[j(p(pn),{text:p(o)("workspace.awaitingAnswerTitle")},{default:me(()=>[c.value?(y(),he(p(Vr),{key:0,variant:"info",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingAnswer")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.awaitingPermissionTitle")},{default:me(()=>[d.value?(y(),he(p(Vr),{key:0,variant:"warning",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingPermission")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.abortedTitle")},{default:me(()=>[f.value?(y(),he(p(Vr),{key:0,variant:"danger",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.aborted")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),!a.value||!m.value?(y(),M("span",pve,N(e.session.time),1)):h.value||e.unread?(y(),M("span",hve,[h.value?(y(),he(p(Ao),{key:0,size:"sm"})):(y(),M("span",mve))])):ee("",!0),W.value?ee("",!0):(y(),M("span",gve,[j(p(pn),{text:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")},{default:me(()=>[j(p(gn),{class:"pin-btn",size:"sm",label:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin"),onClick:It(Q,["stop"])},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin"},null,8,["name"])]),_:1},8,["label"])]),_:1},8,["text"]),j(p(pn),{text:p(o)("sidebar.archive")},{default:me(()=>[j(p(gn),{class:"archive-btn",size:"sm",label:p(o)("sidebar.archive"),onClick:It(te,["stop"])},{default:me(()=>[j(p(Te),{name:"archive"})]),_:1},8,["label"])]),_:1},8,["text"])]))])]),e.session.cwdLabel!==void 0?(y(),M("div",vve,[j(p(Te),{class:"sub-icon",name:"folder-closed",size:"sm"}),C("span",yve,N(e.session.cwdLabel),1),e.session.pullRequest?(y(),M("button",{key:0,type:"button",class:Re(["pr",`pr--${e.session.pullRequest.state}`]),"aria-label":`PR #${e.session.pullRequest.number}`,onClick:It(ce,["stop"])},[j(p(Te),{name:"git-pull-request",size:"sm"}),C("span",null,"#"+N(e.session.pullRequest.number),1)],10,kve)):ee("",!0)])):ee("",!0),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[v.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:k,class:"menu",style:Zt(w.value),onClick:Se[5]||(Se[5]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{danger:Y.value,onClick:fe},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(Y.value?p(o)("sidebar.copyFailed"):G.value?p(o)("sidebar.copied"):p(o)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),j(p(hn),{separator:""}),j(p(hn),{onClick:le},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(o)("sidebar.rename")),1)]),_:1}),j(p(hn),{onClick:U},{default:me(()=>[j(p(Te),{name:"emoji",size:"sm"}),qe(" "+N(p(o)("sidebar.setEmoji")),1)]),_:1}),j(p(hn),{onClick:we},{default:me(()=>[j(p(Te),{name:"git-fork",size:"sm"}),qe(" "+N(p(o)("sidebar.fork")),1)]),_:1}),j(p(hn),{onClick:ge},{default:me(()=>[j(p(Te),{name:"download",size:"sm"}),qe(" "+N(p(o)("sidebar.export")),1)]),_:1}),j(p(hn),{onClick:Q},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin",size:"sm"},null,8,["name"]),qe(" "+N(e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")),1)]),_:1}),j(p(hn),{onClick:te},{default:me(()=>[j(p(Te),{name:"archive",size:"sm"}),qe(" "+N(p(o)("sidebar.archive")),1)]),_:1}),j(p(hn),{separator:""}),C("div",bve,N(l.value),1)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[T.value?(y(),he(ive,{key:0,ref_key:"pickerRef",ref:A,class:"picker",style:Zt(E.value),current:x.value.emoji,removable:x.value.rest.length>0,onClick:Se[6]||(Se[6]=It(()=>{},["stop"])),onPick:z},null,8,["style","current","removable"])):ee("",!0)]),_:1})]))],34))}}),Z5=ft(Cve,[["__scopeId","data-v-341acfa2"]]),wve=["draggable"],_ve={class:"gh-top"},xve={class:"gh-name"},Sve=["inert"],Ave={key:0,class:"show-more-row"},Mve=["disabled"],Tve={class:"show-more-label"},Eve={key:1,class:"show-more-sep","aria-hidden":"true"},Ive={class:"show-more-label"},Lve={key:1,class:"group-empty"},$ve=et({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},isCollapsed:{type:Function},visibleLimit:{type:Function},pinnedDragSession:{}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","dropPinnedSession","expand","collapse","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R({get:()=>o.renameValue,set:P=>s("updateRenameValue",P)}),r=Z(!1),l=R(()=>o.pinnedDragSession!=null),a=R(()=>o.pinnedDragSession?.workspaceId===o.group.workspace.id);function u(P){if(o.pinnedDragSession!=null){if(!a.value){P.dataTransfer&&(P.dataTransfer.dropEffect="none");return}P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),r.value=!0}}function c(P){o.pinnedDragSession==null||!a.value||(P.preventDefault(),r.value=!1,s("dropPinnedSession",o.pinnedDragSession.id))}function d(P){P.currentTarget.contains(P.relatedTarget)||(r.value=!1)}const f=R(()=>o.visibleLimit(o.group.workspace.id)??o.group.initialCount),h=R(()=>{const P=o.group.sessions.slice(0,f.value);if(o.activeId&&!P.some(D=>D.id===o.activeId)){const D=o.group.sessions.find(I=>I.id===o.activeId);if(D)return[...P,D]}return P}),m=R(()=>o.group.sessions.length>f.value||o.group.hasMore||o.group.loadingMore),v=R(()=>f.value>o.group.initialCount);function k(P){o.renameInputRef.value=P instanceof HTMLInputElement?P:null}const{handleCompositionStart:w,handleCompositionEnd:b,isComposingKeyEvent:_}=Ar();function g(P){_(P)||s("confirmRename")}function x(P){_(P)||s("cancelRename")}const S=Z(null);function T(P){o.renamingId!==o.group.workspace.id&&s("groupContextmenu",o.group.workspace,P)}function A(P){P.dataTransfer&&(P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",o.group.workspace.id),s("wsDragstart",o.group.workspace.id))}function E(P,D){D.dataTransfer&&(D.dataTransfer.effectAllowed="move",D.dataTransfer.setData(Bf,P),D.dataTransfer.setData("text/plain",P))}return(P,D)=>(y(),M("div",{class:Re(["group",{dragging:e.dragging,"pinned-drag-active":l.value&&a.value,"pinned-drop-hover":r.value,"pinned-drop-blocked":l.value&&!a.value}]),onDragover:u,onDrop:c,onDragleave:d},[C("div",{class:Re(["gh",{on:e.group.workspace.id===e.activeWorkspaceId&&e.activeId==="",collapsed:e.isCollapsed(e.group.workspace.id)}]),draggable:e.renamingId!==e.group.workspace.id,onClick:D[7]||(D[7]=It(I=>s("groupClick",e.group.workspace.id,I),["stop"])),onContextmenu:T,onDragstart:A,onDragend:D[8]||(D[8]=I=>s("wsDragend"))},[C("div",_ve,[e.isCollapsed(e.group.workspace.id)?(y(),he(p(Te),{key:0,class:"gh-folder",name:"folder-closed"})):(y(),he(p(Te),{key:1,class:"gh-folder",name:"folder"})),e.renamingId!==e.group.workspace.id?(y(),he(p(pn),{key:2,text:e.group.workspace.root},{default:me(()=>[C("span",xve,N(e.group.workspace.name),1)]),_:1},8,["text"])):Bn((y(),M("input",{key:3,ref:k,"onUpdate:modelValue":D[0]||(D[0]=I=>i.value=I),class:"gh-rename",type:"text",onKeydown:[xl(g,["enter"]),xl(x,["esc"])],onCompositionstart:D[1]||(D[1]=(...I)=>p(w)&&p(w)(...I)),onCompositionend:D[2]||(D[2]=(...I)=>p(b)&&p(b)(...I)),onBlur:D[3]||(D[3]=I=>s("cancelRename")),onClick:D[4]||(D[4]=It(()=>{},["stop"]))},null,544)),[[ai,i.value]]),e.renamingId!==e.group.workspace.id?(y(),M("div",{key:4,class:Re(["gh-actions",{open:e.wsMenuOpenId===e.group.workspace.id}])},[j(p(gn),{class:Re(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:p(n)("sidebar.options"),tooltip:p(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:D[5]||(D[5]=It(I=>s("toggleWsMenu",e.group.workspace,I),["stop"]))},{default:me(()=>[j(p(Te),{name:"dots-horizontal"})]),_:1},8,["class","label","tooltip","aria-expanded"]),j(p(gn),{class:"gh-add",size:"sm",label:p(n)("workspace.newInGroup"),tooltip:p(n)("workspace.newInGroup"),onClick:D[6]||(D[6]=It(I=>s("createInWorkspace",e.group.workspace.id),["stop"]))},{default:me(()=>[j(p(Te),{name:"chat-new"})]),_:1},8,["label","tooltip"])],2)):ee("",!0)])],42,wve),C("div",{class:Re(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(y(!0),M(Pe,null,pt(h.value,I=>(y(),he(Z5,{key:I.id,session:I,active:I.id===e.activeId,"approval-count":e.pendingBySession[I.id]?.approvals??0,"question-count":e.pendingBySession[I.id]?.questions??0,unread:e.unreadBySession[I.id]??!1,draggable:S.value!==I.id,onDragstart:$=>E(I.id,$),onRenameStateChange:$=>S.value=$?I.id:null,onSelect:D[9]||(D[9]=$=>s("selectSession",$)),onRename:D[10]||(D[10]=($,B)=>s("renameSession",$,B)),onArchive:D[11]||(D[11]=$=>s("archiveSession",$)),onFork:D[12]||(D[12]=$=>s("forkSession",$)),onExport:D[13]||(D[13]=$=>s("exportSession",$)),onPin:D[14]||(D[14]=$=>s("pinSession",$))},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),m.value||v.value?(y(),M("div",Ave,[m.value?(y(),M("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:D[15]||(D[15]=It(I=>s("expand",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-down",size:"sm"}),C("span",Tve,N(e.group.loadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.showMore")),1)],8,Mve)):ee("",!0),m.value&&v.value?(y(),M("span",Eve,"·")):ee("",!0),v.value?(y(),M("button",{key:2,class:"show-more",onClick:D[16]||(D[16]=It(I=>s("collapse",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-up",size:"sm"}),C("span",Ive,N(p(n)("sidebar.showLess")),1)])):ee("",!0)])):ee("",!0),e.group.sessions.length===0?(y(),M("div",Lve,N(e.group.pinnedCount>0?p(n)("sidebar.allPinned",{count:e.group.pinnedCount}):p(n)("sidebar.noSessions")),1)):ee("",!0)],10,Sve)],34))}}),Nve=ft($ve,[["__scopeId","data-v-9586bfbe"]]),Fve={class:"pinned-label"},Rve={class:"pinned-title"},Ove={key:0,class:"pinned-rows"},Pve=["draggable","onDragstart","onDragover","onDrop"],Dve=et({__name:"PinnedSessionList",props:{sessions:{},activeId:{},pendingBySession:{},unreadBySession:{}},emits:["selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","pinSessionAt","sessionDragStart","sessionDragEnd","reorder"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n,r=Z(kQ());function l(){r.value=!r.value,M3(r.value)}function a(){r.value&&(r.value=!1,M3(!1))}t({expand:a});const u=Z(null),c=Z(null),d=Z(null);function f(x,S){if(!S.dataTransfer)return;S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",x),u.value=x;const T=s.sessions.find(A=>A.id===x)?.workspaceId;T!==void 0&&i("sessionDragStart",x,T)}function h(){u.value=null,c.value=null,i("sessionDragEnd")}Je(()=>s.sessions,x=>{u.value!==null&&!x.some(S=>S.id===u.value)&&(u.value=null,c.value=null)});function m(x){const S=x.currentTarget.getBoundingClientRect();return x.clientYP.id),T,x,A));return}const E=S.dataTransfer?.getData(Bf);E&&i("pinSessionAt",E,x,A)}function b(x){if(u.value===null&&!v(x))return;x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="move");const S=s.sessions[s.sessions.length-1];S!==void 0&&(c.value={id:S.id,position:"after"})}function _(x){const S=s.sessions.map(E=>E.id),T=u.value;if(c.value=null,u.value=null,T!==null){const E=S[S.length-1];E!==void 0&&T!==E&&i("reorder",[...S.filter(P=>P!==T),T]);return}const A=x.dataTransfer?.getData(Bf);A&&i("pinSessionAt",A,S[S.length-1]??null,"after")}function g(x){x.currentTarget.contains(x.relatedTarget)||(c.value=null)}return(x,S)=>(y(),M("div",{class:"pinned",onDragover:b,onDrop:_,onDragleave:g},[C("div",Fve,[C("span",Rve,N(p(o)("sidebar.pinned")),1),j(p(gn),{class:Re(["pinned-toggle",{"pinned-toggle--on":r.value}]),size:"sm",label:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),tooltip:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),onClick:It(l,["stop"])},{default:me(()=>[r.value?(y(),he(p(Te),{key:0,name:"chevron-right"})):(y(),he(p(Te),{key:1,name:"chevron-down"}))]),_:1},8,["class","label","tooltip"])]),r.value?ee("",!0):(y(),M("div",Ove,[(y(!0),M(Pe,null,pt(e.sessions,T=>(y(),M("div",{key:T.id,class:Re(["pin-drop-target",{dragging:u.value===T.id,"drop-before":c.value?.id===T.id&&c.value.position==="before","drop-after":c.value?.id===T.id&&c.value.position==="after"}]),draggable:d.value!==T.id,onDragstart:A=>f(T.id,A),onDragend:h,onDragover:It(A=>k(A,T.id),["stop"]),onDrop:It(A=>w(T.id,A),["stop"])},[j(Z5,{session:T,active:T.id===e.activeId,"approval-count":e.pendingBySession[T.id]?.approvals??0,"question-count":e.pendingBySession[T.id]?.questions??0,unread:e.unreadBySession[T.id]??!1,onRenameStateChange:A=>d.value=A?T.id:null,onSelect:S[0]||(S[0]=A=>i("selectSession",A)),onRename:S[1]||(S[1]=(A,E)=>i("renameSession",A,E)),onArchive:S[2]||(S[2]=A=>i("archiveSession",A)),onFork:S[3]||(S[3]=A=>i("forkSession",A)),onExport:S[4]||(S[4]=A=>i("exportSession",A)),onPin:S[5]||(S[5]=A=>i("pinSession",A))},null,8,["session","active","approval-count","question-count","unread","onRenameStateChange"])],42,Pve))),128))]))],32))}}),Bve=ft(Dve,[["__scopeId","data-v-aec340eb"]]),Hve={class:"ch"},zve={class:"ch-brand"},Wve={class:"ch-tail"},Uve={class:"search-input"},jve={class:"side-section-label"},Vve={class:"side-section-title"},qve={class:"side-section-actions"},Kve={key:0,class:"empty"},Zve=["onDragover","onDrop"],Gve={key:0,class:"empty"},Yve={key:1,class:"show-more-row"},Xve=["disabled"],Jve={class:"show-more-label"},Qve={class:"folder-drop-card"},e9e={class:"view-menu-label"},t9e={class:"view-menu-check"},n9e={class:"view-menu-check"},o9e=!1,s9e=1e3,i9e=et({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},pinnedSessions:{default:()=>[]},flatSessions:{default:()=>[]},flatHasMore:{type:Boolean,default:!1},flatLoadingMore:{type:Boolean,default:!1},initialized:{type:Boolean,default:!1},activeId:{},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220},collapsed:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","addWorkspacePaths","rename","archive","fork","export","pin","reorderPinned","pinAt","unpin","renameWorkspace","deleteWorkspace","reorderWorkspaces","loadMoreSessions","loadAllSessions","ensureFlatSessions","loadMoreFlatSessions","openSettings","login","collapse"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!1),r=c()?["⌘","K"]:["Ctrl","K"],l=c()?["⌃","⇧","O"]:["Ctrl","Shift","O"];function a(){s("loadAllSessions"),i.value=!0}function u(Qe){(Qe.metaKey||Qe.ctrlKey)&&(Qe.key.toLowerCase()==="k"?(Qe.preventDefault(),a()):!Qe.metaKey&&Qe.ctrlKey&&Qe.shiftKey&&Qe.key.toLowerCase()==="o"&&(Qe.preventDefault(),s("create")))}dn(()=>window.addEventListener("keydown",u)),Vn(()=>window.removeEventListener("keydown",u));function c(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const Qe=navigator.userAgentData;return Qe?.platform==="macOS"||Qe?.platform==="iOS"}const d=Z(null),f=Z(!1),h=Z(!1),m=Z(!1);let v=null;function k(Qe=d.value){Qe&&(f.value=Qe.scrollTop>0,h.value=Qe.scrollTop+Qe.clientHeight{m.value=!1,v=null},900)}let b=null;dn(()=>{yt(()=>{k(),typeof ResizeObserver=="function"&&d.value&&(b=new ResizeObserver(()=>k()),b.observe(d.value))})}),Dp(()=>k()),Vn(()=>{b?.disconnect(),v&&clearTimeout(v)});const _=Z(new Set(yQ()));function g(Qe){return _.value.has(Qe)}function x(Qe){const st=new Set(_.value);st.has(Qe)?st.delete(Qe):st.add(Qe),_.value=st,p9(st)}function S(){const Qe=new Set(o.groups.map(st=>st.workspace.id));_.value=Qe,p9(Qe)}function T(){const Qe=new Set;_.value=Qe,p9(Qe)}const A=R(()=>o.groups.length>0&&o.groups.every(Qe=>_.value.has(Qe.workspace.id))),E=Z(new Map);function P(Qe){return E.value.get(Qe)}function D(Qe){const st=o.groups.find(kn=>kn.workspace.id===Qe);if(!st)return;const Ct=(E.value.get(Qe)??st.initialCount)+O5,Qt=new Map(E.value);Qt.set(Qe,Ct),E.value=Qt,st.sessions.lengthkn.workspace.id),st,Qe,Ct);s("reorderWorkspaces",Qt)}const W=Z(null);function K(Qe,st){W.value={id:Qe,workspaceId:st}}function V(){W.value=null}function ie(Qe){W.value=null,s("unpin",Qe)}const ne=Z(bQ());function X(Qe){ne.value!==Qe&&(ne.value=Qe,CQ(Qe),Qe==="flat"&&s("ensureFlatSessions"))}Je(()=>o.initialized,Qe=>{Qe&&ne.value==="flat"&&s("ensureFlatSessions")},{immediate:!0});const le=Z(!1),Ie=Z({}),de=Z(null);function pe(Qe){const st=Qe.target;st.closest(".view-menu")||st.closest(".side-section-view")||oe()}async function ve(Qe){if(le.value){oe();return}const st=Qe.currentTarget;le.value=!0,document.addEventListener("mousedown",pe),window.addEventListener("resize",oe),await yt();const Ct=de.value?.el,Qt=st.getBoundingClientRect(),kn=4,Ko=8,Eo=Ct?.offsetHeight??0,bo=Ct?.offsetWidth??0;let Ns=Qt.bottom+kn,Do=!1;Ns+Eo>window.innerHeight-Ko&&(Ns=Math.max(Ko,Qt.top-Eo-kn),Do=!0);let Io=Qt.right-bo;IoSn.value?.focus())}function Cn(){const Qe=Tt.value,st=Bt.value.trim();Qe&&st&&st!==Yt.value&&s("renameWorkspace",Qe,st),Tt.value=null}function Mn(){Tt.value=null}function We(Qe){Bt.value=Qe}const tt=Z(!1),Ue=Z(null),Lt=Z({}),gt=Z(null);function wn(Qe){gt.value?.el&&!gt.value.el.contains(Qe.target)&&go()}function yn(Qe,st){st.preventDefault(),st.stopPropagation(),Ue.value=Qe,Lt.value={top:`${st.clientY}px`,left:`${st.clientX}px`,transformOrigin:"top left","--menu-pop-shift":"-2px"},tt.value=!0,document.addEventListener("mousedown",wn,!0)}function go(){tt.value=!1,document.removeEventListener("mousedown",wn,!0),Ue.value=null}function qt(){Ue.value&&Zs(Ue.value.root),go()}function ps(){Ue.value&&en(Ue.value.id,Ue.value.name),go()}function xs(){const Qe=Ue.value;Qe&&(go(),s("deleteWorkspace",Qe.id))}const _n=Z(null),In=Z(null),To=Z({}),lo=Z(null);function St(Qe){const st=Qe.target;st.closest(".gh-more")||st.closest(".ws-menu")||Jo()}async function hs(Qe,st){if(_n.value===Qe.id){Jo();return}const Ct=st.currentTarget;In.value=Qe,_n.value=Qe.id,document.addEventListener("mousedown",St),window.addEventListener("resize",Jo),await yt();const Qt=lo.value?.el,kn=Ct.getBoundingClientRect(),Ko=4,Eo=8,bo=Qt?.offsetHeight??0,Ns=Qt?.offsetWidth??0;let Do=kn.bottom+Ko,Io=!1;Do+bo>window.innerHeight-Eo&&(Do=Math.max(Eo,kn.top-bo-Ko),Io=!0);let Qo=kn.right-Ns;Qo{document.removeEventListener("mousedown",wn,!0),document.removeEventListener("mousedown",St),document.removeEventListener("mousedown",pe),window.removeEventListener("resize",Jo),window.removeEventListener("resize",oe)});const no=Z(null);let $s;function Xs(){const Qe=no.value;Qe&&(Qe.classList.remove("blink-now"),Qe.getBoundingClientRect(),Qe.classList.add("blink-now"),clearTimeout($s),$s=setTimeout(()=>Qe.classList.remove("blink-now"),300))}const ci=zr(()=>jo(()=>import("./DesignSystemView-CTUhpkDe.js"),__vite__mapDeps([8,9]))),Oo=Z(!1);let vo,Po=!1;function co(Qe){Po=!1,clearTimeout(vo),Qe.currentTarget.setPointerCapture?.(Qe.pointerId),vo=setTimeout(()=>{Po=!0,Oo.value=!0},s9e)}function Tn(Qe){clearTimeout(vo);const st=Qe.currentTarget;st.hasPointerCapture?.(Qe.pointerId)&&st.releasePointerCapture(Qe.pointerId)}function fo(){if(Po){Po=!1;return}Xs()}return Vn(()=>{clearTimeout(vo)}),(Qe,st)=>(y(),M("aside",{class:Re(["side",{"macos-desktop":p(rc),collapsed:e.collapsed,"no-anim":e.dragging}]),style:Zt({width:e.collapsed?"0px":e.colWidth+"px"})},[C("div",{class:"col",style:Zt({width:e.colWidth+"px"}),onDragenter:Fe,onDragover:Oe,onDragleave:Ge,onDrop:at},[C("div",Hve,[C("div",zve,[p(rc)?ee("",!0):(y(),M(Pe,{key:0},[(y(),M("svg",{ref_key:"logoRef",ref:no,class:"ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:fo,onPointerdown:co,onPointerup:Tn,onPointercancel:Tn},[...st[31]||(st[31]=[iu('',2)])],544)),st[32]||(st[32]=C("span",{class:"ch-name"},"Kimi Code",-1))],64))]),C("div",Wve,[p(rc)?ee("",!0):(y(),he(p(gn),{key:0,class:"ch-collapse",size:"sm",label:p(n)("sidebar.collapseSidebar"),tooltip:p(n)("sidebar.collapseSidebar"),onClick:st[0]||(st[0]=It(Ct=>s("collapse"),["stop"]))},{default:me(()=>[j(p(Te),{name:"panel-collapse"})]),_:1},8,["label","tooltip"])),j(b0e)])]),C("div",{class:Re(["sidebar-actions",{"sidebar-actions--has-workspace-action":o9e}])},[C("button",{class:"btn-new-chat",type:"button",onClick:st[1]||(st[1]=It(Ct=>s("create"),["stop"]))},[j(p(Te),{name:"chat-new"}),C("span",null,N(p(n)("sidebar.newChat")),1),j(p(oa),{keys:p(l)},null,8,["keys"])]),ee("",!0),C("button",{class:"search",type:"button",onClick:a},[j(p(Te),{class:"search-icon",name:"search"}),C("span",Uve,N(p(n)("sidebar.search")),1),j(p(oa),{keys:p(r)},null,8,["keys"])])],2),ne.value==="flat"||e.groups.length>0?(y(),M("div",{key:0,class:Re(["sessions-head",{"sessions-head--scrolled":f.value}])},[e.pinnedSessions.length>0?(y(),he(Bve,{key:0,ref_key:"pinnedListRef",ref:ue,sessions:e.pinnedSessions,"active-id":e.activeId,"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,onSelectSession:ce,onRenameSession:st[3]||(st[3]=(Ct,Qt)=>s("rename",Ct,Qt)),onArchiveSession:st[4]||(st[4]=Ct=>s("archive",Ct)),onForkSession:st[5]||(st[5]=Ct=>s("fork",Ct)),onExportSession:st[6]||(st[6]=Ct=>s("export",Ct)),onPinSession:Se,onPinSessionAt:ze,onSessionDragStart:K,onSessionDragEnd:V,onReorder:st[7]||(st[7]=Ct=>s("reorderPinned",Ct))},null,8,["sessions","active-id","pending-by-session","unread-by-session"])):ee("",!0),C("div",jve,[C("span",Vve,N(p(n)("sidebar.sessionsHeader")),1),C("div",qve,[ne.value==="grouped"?(y(),he(p(gn),{key:0,class:"side-section-toggle",size:"sm",label:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),tooltip:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),onClick:st[8]||(st[8]=It(Ct=>A.value?T():S(),["stop"]))},{default:me(()=>[A.value?(y(),he(p(Te),{key:0,name:"expand"})):(y(),he(p(Te),{key:1,name:"collapse"}))]),_:1},8,["label","tooltip"])):ee("",!0),j(p(pn),{text:p(n)("sidebar.viewSwitcher")},{default:me(()=>[j(p(gn),{class:"side-section-toggle side-section-view",size:"sm",label:p(n)("sidebar.viewSwitcher"),onClick:It(ve,["stop"])},{default:me(()=>[j(p(Te),{name:"list-settings"})]),_:1},8,["label"])]),_:1},8,["text"])])])],2)):ee("",!0),C("div",{ref_key:"sessionsEl",ref:d,class:Re(["sessions",{scrolling:m.value,"pinned-drag-active":ne.value==="flat"&&W.value!==null,"flat-pinned-drop-hover":fe.value}]),onScroll:w,onDragover:we,onDrop:ge,onDragleave:Q},[ne.value==="grouped"?(y(),M(Pe,{key:0},[e.groups.length===0?(y(),M("div",Kve,N(p(n)("workspace.noWorkspace")),1)):(y(!0),M(Pe,{key:1},pt(e.groups,Ct=>(y(),M("div",{key:Ct.workspace.id,class:Re(["ws-drop-target",{"drop-before":B.value?.id===Ct.workspace.id&&B.value.position==="before","drop-after":B.value?.id===Ct.workspace.id&&B.value.position==="after"}]),onDragover:Qt=>U(Qt,Ct.workspace.id),onDrop:Qt=>z(Ct.workspace.id)},[j(Nve,{group:Ct,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":Tt.value,"rename-value":Bt.value,"rename-input-ref":on(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":_n.value,dragging:$.value===Ct.workspace.id,"is-collapsed":g,"visible-limit":P,"pinned-drag-session":W.value,onGroupClick:te,onGroupContextmenu:yn,onToggleWsMenu:hs,onCreateInWorkspace:st[9]||(st[9]=Qt=>s("createInWorkspace",Qt)),onSelectSession:ce,onRenameSession:st[10]||(st[10]=(Qt,kn)=>s("rename",Qt,kn)),onArchiveSession:st[11]||(st[11]=Qt=>s("archive",Qt)),onForkSession:st[12]||(st[12]=Qt=>s("fork",Qt)),onExportSession:st[13]||(st[13]=Qt=>s("export",Qt)),onPinSession:Se,onDropPinnedSession:ie,onExpand:D,onCollapse:I,onConfirmRename:Cn,onCancelRename:Mn,onUpdateRenameValue:We,onWsDragstart:H,onWsDragend:O},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging","pinned-drag-session"])],42,Zve))),128))],64)):(y(),M(Pe,{key:1},[(y(!0),M(Pe,null,pt(e.flatSessions,Ct=>(y(),he(Z5,{key:Ct.id,session:Ct,active:Ct.id===e.activeId,"approval-count":e.pendingBySession[Ct.id]?.approvals??0,"question-count":e.pendingBySession[Ct.id]?.questions??0,unread:e.unreadBySession[Ct.id]??!1,draggable:G.value!==Ct.id,onDragstart:Qt=>Y(Ct.id,Qt),onRenameStateChange:Qt=>G.value=Qt?Ct.id:null,onSelect:ce,onRename:st[14]||(st[14]=(Qt,kn)=>s("rename",Qt,kn)),onArchive:st[15]||(st[15]=Qt=>s("archive",Qt)),onFork:st[16]||(st[16]=Qt=>s("fork",Qt)),onExport:st[17]||(st[17]=Qt=>s("export",Qt)),onPin:Se},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),e.flatSessions.length===0&&!e.flatHasMore&&e.pinnedSessions.length===0?(y(),M("div",Gve,N(p(n)("sidebar.noSessions")),1)):ee("",!0),e.flatHasMore?(y(),M("div",Yve,[C("button",{class:"show-more",disabled:e.flatLoadingMore,onClick:st[18]||(st[18]=It(Ct=>s("loadMoreFlatSessions"),["stop"]))},[C("span",Jve,N(e.flatLoadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.loadMore")),1),j(p(Te),{name:"chevron-down",size:"sm"})],8,Xve)])):ee("",!0)],64))],34),C("div",{class:Re(["side-footer",{"side-footer--shadowed":h.value}])},[j(V2e,{onLogin:st[19]||(st[19]=Ct=>s("login")),onOpenSettings:st[20]||(st[20]=Ct=>s("openSettings"))})],2),C("div",{class:Re(["folder-drop-overlay",{show:Ee.value}]),"aria-hidden":"true"},[C("div",Qve,[j(p(Te),{name:"folder",size:"lg"}),C("span",null,N(p(n)("sidebar.dropToAddWorkspace")),1)])],2)],36),j(as,{name:"menu-pop"},{default:me(()=>[tt.value?(y(),he(p(Cl),{key:0,ref_key:"ghMenuRef",ref:gt,class:"gh-menu",style:Zt(Lt.value),onClick:st[21]||(st[21]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:qt},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:ps},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:xs},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[_n.value!==null&&In.value?(y(),he(p(Cl),{key:0,ref_key:"wsMenuRef",ref:lo,class:"ws-menu",style:Zt(To.value),onClick:st[25]||(st[25]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:st[22]||(st[22]=Ct=>uo(In.value))},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:st[23]||(st[23]=Ct=>Ys(In.value))},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:st[24]||(st[24]=Ct=>Nn(In.value))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[le.value?(y(),he(p(Cl),{key:0,ref_key:"viewMenuRef",ref:de,class:"view-menu",style:Zt(Ie.value),onClick:st[28]||(st[28]=It(()=>{},["stop"]))},{default:me(()=>[C("div",e9e,N(p(n)("sidebar.viewGroup")),1),j(p(hn),{onClick:st[26]||(st[26]=Ct=>ye("flat"))},{default:me(()=>[j(p(Te),{name:"list",size:"sm"}),qe(" "+N(p(n)("sidebar.viewFlat"))+" ",1),C("span",t9e,[ne.value==="flat"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1}),j(p(hn),{onClick:st[27]||(st[27]=Ct=>ye("grouped"))},{default:me(()=>[j(p(Te),{name:"tree-view",size:"sm"}),qe(" "+N(p(n)("sidebar.viewGrouped"))+" ",1),C("span",n9e,[ne.value==="grouped"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),i.value?(y(),he(uee,{key:0,sessions:e.sessions,"active-id":e.activeId,onSelect:ce,onClose:st[29]||(st[29]=Ct=>i.value=!1)},null,8,["sessions","active-id"])):ee("",!0),(y(),he(Zr,{to:"body"},[Oo.value?(y(),he(p(ci),{key:0,onClose:st[30]||(st[30]=Ct=>Oo.value=!1)})):ee("",!0)]))],6))}}),r9e=ft(i9e,[["__scopeId","data-v-a80a4ba6"]]),l9e=["aria-label"],a9e=et({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{},applyLive:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),{width:i,dragging:r,cursor:l,onPointerDown:a}=She({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse,applyLive:n.applyLive});return o("update:width",i.value),Je(i,u=>o("update:width",u)),Je(r,u=>o("update:dragging",u)),(u,c)=>(y(),M("div",{class:Re(["rh",{dragging:p(r)}]),style:Zt({cursor:p(l)}),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??p(s)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...d)=>p(a)&&p(a)(...d))},[...c[1]||(c[1]=[C("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],46,l9e))}}),Zx=ft(a9e,[["__scopeId","data-v-1c6dfdc5"]]),u9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c9e(e,t){return y(),M("svg",u9e,[...t[0]||(t[0]=[C("path",{d:"M12.0684 2.03418C12.5654 2.03421 12.9687 2.43755 12.9688 2.93457V11.0996H21.0654C21.5625 11.0996 21.9658 11.503 21.9658 12C21.9658 12.497 21.5625 12.9004 21.0654 12.9004H12.9688V21.0654C12.9687 21.5624 12.5654 21.9658 12.0684 21.9658C11.5713 21.9658 11.168 21.5625 11.168 21.0654V12.9004H2.93457C2.43751 12.9004 2.03418 12.4971 2.03418 12C2.03418 11.5029 2.43751 11.0996 2.93457 11.0996H11.168V2.93457C11.168 2.43753 11.5713 2.03418 12.0684 2.03418Z",fill:"currentColor"},null,-1)])])}const d9e=kt({name:"kimi-add",render:c9e}),f9e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function p9e(e,t){return y(),M("svg",f9e,[...t[0]||(t[0]=[C("path",{id:"p0",d:"M 0 -9.9 C -5.468 -9.9 -9.9 -5.468 -9.9 0 C -9.9 1.923 -9.351 3.719 -8.402 5.239 C -8.402 5.239 -9.483 7.821 -9.483 7.821 C -9.896 8.809 -9.171 9.9 -8.099 9.9 C -8.099 9.9 0 9.9 0 9.9 C 5.468 9.9 9.9 5.468 9.9 0 C 9.9 -5.468 5.468 -9.9 0 -9.9 Z M -8.1 0 C -8.1 -4.474 -4.474 -8.1 0 -8.1 C 4.473 -8.1 8.1 -4.474 8.1 0 C 8.1 4.473 4.473 8.1 -0.001 8.1 C -0.001 8.1 -7.648 8.1 -7.648 8.1 L -6.365 5.035 C -6.365 5.035 -6.648 4.629 -6.648 4.629 C -7.563 3.317 -8.1 1.723 -8.1 0 Z",transform:"matrix(1 0 0 1 12 12)",fill:"currentColor","fill-rule":"evenodd"},null,-1),C("path",{id:"p1",d:"M 3.6 0.5 L -2.6 0.5 M 0.5 -2.573 L 0.5 3.573",transform:"translate(11.5 11.5)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},null,-1)])])}const h9e=kt({name:"kimi-add-conversation",render:p9e}),m9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g9e(e,t){return y(),M("svg",m9e,[...t[0]||(t[0]=[C("path",{d:"M15.0996 12C15.5967 12 16 12.4033 16 12.9004C15.9998 13.3973 15.5965 13.7998 15.0996 13.7998H8.90039C8.40346 13.7998 8.00021 13.3973 8 12.9004C8 12.4033 8.40333 12 8.90039 12H15.0996Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19 3.2002C20.5464 3.2002 21.7998 4.4536 21.7998 6V7C21.7998 8.03565 21.2363 8.93754 20.4004 9.42188V17C20.4004 19.1539 18.6539 20.9004 16.5 20.9004H7.5C5.34609 20.9004 3.59961 19.1539 3.59961 17V9.42188C2.76374 8.93754 2.2002 8.03565 2.2002 7V6C2.2002 4.4536 3.4536 3.2002 5 3.2002H19ZM5.40039 17C5.40039 18.1598 6.3402 19.0996 7.5 19.0996H16.5C17.6598 19.0996 18.5996 18.1598 18.5996 17V9.7998H5.40039V17ZM4.89746 5.00488C4.39333 5.05621 4 5.48232 4 6V7L4.00488 7.10254C4.05278 7.57297 4.42703 7.94722 4.89746 7.99512L5 8H19C19.5523 8 20 7.55228 20 7V6C20 5.44772 19.5523 5 19 5H5L4.89746 5.00488Z",fill:"currentColor"},null,-1)])])}const v9e=kt({name:"kimi-archive",render:g9e}),y9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function k9e(e,t){return y(),M("svg",y9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 21.6387C11.7378 21.988 12.3059 21.987 12.6565 21.6364L18.1949 16.098C18.5464 15.7465 18.5464 15.1766 18.1949 14.8252C17.8434 14.4737 17.2736 14.4737 16.9221 14.8252L12.9201 18.8272V3.00002C12.9201 2.50297 12.5171 2.10003 12.0201 2.10003C11.523 2.10003 11.1201 2.50297 11.1201 3.00002V18.8383L7.07554 14.8229C6.7228 14.4727 6.15295 14.4747 5.80275 14.8275C5.45255 15.1802 5.45461 15.7501 5.80735 16.1003L11.386 21.6387Z",fill:"currentColor"},null,-1)])])}const b9e=kt({name:"kimi-arrow-down",render:k9e}),C9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function w9e(e,t){return y(),M("svg",C9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.16127 12.814C1.81197 12.4622 1.81299 11.8941 2.16357 11.5435L7.70203 6.00506C8.0535 5.65359 8.62335 5.65359 8.97482 6.00506C9.32629 6.35653 9.32629 6.92638 8.97482 7.27785L4.97276 11.2799H20.8C21.297 11.2799 21.7 11.6829 21.7 12.1799C21.7 12.677 21.297 13.0799 20.8 13.0799H4.96171L8.97712 17.1244C9.32732 17.4772 9.32526 18.047 8.97252 18.3972C8.61978 18.7474 8.04993 18.7454 7.69973 18.3926L2.16127 12.814Z",fill:"currentColor"},null,-1)])])}const _9e=kt({name:"kimi-arrow-left",render:w9e}),x9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function S9e(e,t){return y(),M("svg",x9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.4387 12.814C21.788 12.4622 21.787 11.8941 21.4364 11.5436L15.8979 6.0051C15.5464 5.65363 14.9766 5.65363 14.6251 6.0051C14.2737 6.35657 14.2737 6.92642 14.6251 7.27789L18.6272 11.28H2.79998C2.30293 11.28 1.89998 11.6829 1.89998 12.18C1.89998 12.677 2.30293 13.08 2.79998 13.08H18.6382L14.6228 17.1245C14.2726 17.4772 14.2747 18.0471 14.6274 18.3973C14.9802 18.7475 15.55 18.7454 15.9002 18.3927L21.4387 12.814Z",fill:"currentColor"},null,-1)])])}const A9e=kt({name:"kimi-arrow-right",render:S9e}),M9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T9e(e,t){return y(),M("svg",M9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 2.36129C11.7378 2.01198 12.3059 2.013 12.6565 2.36358L18.1949 7.90204C18.5464 8.25351 18.5464 8.82336 18.1949 9.17483C17.8434 9.52631 17.2736 9.52631 16.9221 9.17483L12.9201 5.17277V21C12.9201 21.497 12.5171 21.9 12.0201 21.9C11.523 21.9 11.1201 21.497 11.1201 21V5.16172L7.07554 9.17713C6.7228 9.52733 6.15295 9.52527 5.80275 9.17253C5.45255 8.81979 5.45461 8.24995 5.80735 7.89975L11.386 2.36129Z",fill:"currentColor"},null,-1)])])}const E9e=kt({name:"kimi-arrow-up",render:T9e}),I9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function L9e(e,t){return y(),M("svg",I9e,[...t[0]||(t[0]=[C("path",{d:"M19.3027 5.9053C19.6542 5.55397 20.2247 5.55388 20.5761 5.9053C20.9273 6.25675 20.9273 6.82734 20.5761 7.17874L9.65911 18.0948C9.30773 18.4461 8.73814 18.446 8.38665 18.0948L3.42376 13.1328C3.0726 12.7814 3.07263 12.2118 3.42376 11.8604C3.77524 11.509 4.34575 11.5089 4.6972 11.8604L9.02239 16.1856L19.3027 5.9053Z",fill:"currentColor"},null,-1)])])}const $9e=kt({name:"kimi-check",render:L9e}),N9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function F9e(e,t){return y(),M("svg",N9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 16.7134C11.743 17.0627 12.3111 17.0617 12.6617 16.7111L19.6364 9.73641C19.9878 9.38494 19.9878 8.81509 19.6364 8.46362C19.2849 8.11215 18.7151 8.11215 18.3636 8.46362L12.023 14.8042L5.63407 8.46132C5.28133 8.11112 4.71149 8.11318 4.36129 8.46592C4.01109 8.81866 4.01314 9.3885 4.36588 9.73871L11.3912 16.7134Z",fill:"currentColor"},null,-1)])])}const R9e=kt({name:"kimi-chevron-down",render:F9e}),O9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function P9e(e,t){return y(),M("svg",O9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.1261 12.6088C16.4754 12.257 16.4743 11.6889 16.1238 11.3383L9.14904 4.36363C8.79757 4.01216 8.22772 4.01216 7.87625 4.36363C7.52477 4.7151 7.52477 5.28495 7.87625 5.63642L14.2169 11.977L7.87395 18.3659C7.52375 18.7187 7.52581 19.2885 7.87855 19.6387C8.23129 19.9889 8.80113 19.9869 9.15133 19.6341L16.1261 12.6088Z",fill:"currentColor"},null,-1)])])}const D9e=kt({name:"kimi-chevron-right",render:P9e}),B9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H9e(e,t){return y(),M("svg",B9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 8.46132C11.743 8.11202 12.3111 8.11304 12.6617 8.46362L19.6364 15.4383C19.9878 15.7898 19.9878 16.3597 19.6364 16.7111C19.2849 17.0626 18.7151 17.0626 18.3636 16.7111L12.023 10.3705L5.63407 16.7134C5.28133 17.0636 4.71149 17.0616 4.36129 16.7088C4.01109 16.3561 4.01314 15.7862 4.36588 15.436L11.3912 8.46132Z",fill:"currentColor"},null,-1)])])}const z9e=kt({name:"kimi-chevron-up",render:H9e}),W9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function U9e(e,t){return y(),M("svg",W9e,[...t[0]||(t[0]=[C("path",{d:"M11.8999 6.79965C12.397 6.79965 12.7997 7.20235 12.7997 7.69941V11.7266L14.7359 13.6629C15.0873 14.0143 15.0879 14.584 14.7366 14.9355C14.3852 15.287 13.8148 15.287 13.4633 14.9355L11.2632 12.7355C11.0947 12.5668 11.0002 12.338 11.0001 12.0995V7.69941C11.0001 7.20238 11.4029 6.7997 11.8999 6.79965Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 1.89893C17.4677 1.89893 21.9001 6.33147 21.9002 11.7991C21.9002 17.2669 17.4678 21.6993 12 21.6993C6.53228 21.6993 2.09985 17.2669 2.09985 11.7991C2.09998 6.33147 6.53236 1.89893 12 1.89893ZM20.1 11.7998C20.1 7.32616 16.4737 3.69984 12 3.69984C7.5264 3.69984 3.90008 7.32616 3.90008 11.7998C3.90032 16.2732 7.52655 19.8998 12 19.8998C16.4735 19.8998 20.0998 16.2732 20.1 11.7998Z",fill:"currentColor"},null,-1)])])}const j9e=kt({name:"kimi-clock",render:U9e}),V9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q9e(e,t){return y(),M("svg",V9e,[...t[0]||(t[0]=[C("path",{d:"M17.9542 4.77253C18.3056 4.42106 18.8761 4.42106 19.2276 4.77253C19.579 5.12401 19.579 5.69452 19.2276 6.04597L13.2735 12.0001L19.2276 17.9542C19.5791 18.3056 19.5791 18.8761 19.2276 19.2276C18.8761 19.5791 18.3056 19.5791 17.9542 19.2276L12.0001 13.2735L6.04595 19.2276C5.69451 19.5791 5.12399 19.579 4.77252 19.2276C4.42104 18.8761 4.42104 18.3056 4.77252 17.9542L10.7266 12.0001L4.77252 6.04597C4.42104 5.6945 4.42104 5.124 4.77252 4.77253C5.12399 4.42107 5.69448 4.42106 6.04595 4.77253L12.0001 10.7266L17.9542 4.77253Z",fill:"currentColor"},null,-1)])])}const K9e=kt({name:"kimi-close",render:q9e}),Z9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G9e(e,t){return y(),M("svg",Z9e,[...t[0]||(t[0]=[C("path",{d:"M9.85815 11.957C10.9074 11.957 11.7583 12.8083 11.7585 13.8574V19.8574C11.7585 20.3545 11.3552 20.7578 10.8582 20.7578C10.3611 20.7578 9.95776 20.3545 9.95776 19.8574V13.8574C9.95755 13.8024 9.91325 13.7578 9.85815 13.7578H3.85815C3.3611 13.7578 2.95776 13.3545 2.95776 12.8574C2.95798 12.3605 3.36123 11.957 3.85815 11.957H9.85815Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8582 2.95703C13.3551 2.95703 13.7583 3.36054 13.7585 3.85742V9.85742C13.7585 9.91265 13.8029 9.95703 13.8582 9.95703H19.8582C20.3551 9.95703 20.7583 10.3605 20.7585 10.8574C20.7585 11.3545 20.3552 11.7578 19.8582 11.7578H13.8582C12.8088 11.7578 11.9578 10.9068 11.9578 9.85742V3.85742C11.958 3.36054 12.3612 2.95703 12.8582 2.95703Z",fill:"currentColor"},null,-1)])])}const Y9e=kt({name:"kimi-collapse",render:G9e}),X9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J9e(e,t){return y(),M("svg",X9e,[...t[0]||(t[0]=[C("path",{d:"M11.9004 2.19995C17.3678 2.20016 21.7998 6.63285 21.7998 12.1003C21.7996 17.5677 17.3677 21.9995 11.9004 21.9998H3.80078C2.72946 21.9996 2.00334 20.9089 2.41699 19.9207L3.49805 17.3386C2.54871 15.8189 2.00007 14.0226 2 12.1003C2 6.63272 6.43277 2.19995 11.9004 2.19995ZM11.9004 3.99976C7.42688 3.99976 3.7998 7.62684 3.7998 12.1003C3.79989 13.8228 4.33669 15.4175 5.25195 16.7292L5.53516 17.1345L4.25195 20.2H11.8994C16.3727 20.1999 19.9998 16.5736 20 12.1003C20 7.62697 16.3737 3.99997 11.9004 3.99976ZM8.9541 10.8005C9.75473 10.8006 10.4041 11.4491 10.4043 12.2498C10.4043 13.0505 9.75482 13.6998 8.9541 13.7C8.15329 13.7 7.50391 13.0506 7.50391 12.2498C7.50406 11.4491 8.15339 10.8005 8.9541 10.8005ZM15.1533 10.8005C15.9539 10.8006 16.6034 11.4491 16.6035 12.2498C16.6035 13.0505 15.954 13.6998 15.1533 13.7C14.3525 13.7 13.7031 13.0506 13.7031 12.2498C13.7033 11.4491 14.3526 10.8005 15.1533 10.8005Z",fill:"currentColor"},null,-1)])])}const Q9e=kt({name:"kimi-comment",render:J9e}),e4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function t4e(e,t){return y(),M("svg",e4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 7.09961C19.1539 7.09961 20.9004 8.84609 20.9004 11V17C20.9004 19.1539 19.1539 20.9004 17 20.9004H11C8.84609 20.9004 7.09961 19.1539 7.09961 17V11C7.09961 8.84609 8.84609 7.09961 11 7.09961H17ZM11 8.90039C9.8402 8.90039 8.90039 9.8402 8.90039 11V17C8.90039 18.1598 9.8402 19.0996 11 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V11C19.0996 9.8402 18.1598 8.90039 17 8.90039H11Z",fill:"currentColor"},null,-1),C("path",{d:"M13 3.09961C14.4447 3.09961 15.705 3.88644 16.3779 5.0498C16.6265 5.47999 16.4789 6.03049 16.0488 6.2793C15.6186 6.52781 15.0681 6.38029 14.8193 5.9502C14.4548 5.32041 13.776 4.90039 13 4.90039H7C5.8402 4.90039 4.90039 5.8402 4.90039 7V13C4.90039 13.776 5.32041 14.4548 5.9502 14.8193C6.38029 15.0681 6.52781 15.6186 6.2793 16.0488C6.03049 16.4789 5.47999 16.6265 5.0498 16.3779C3.88644 15.705 3.09961 14.4447 3.09961 13V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H13Z",fill:"currentColor"},null,-1)])])}const n4e=kt({name:"kimi-copy",render:t4e}),o4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function s4e(e,t){return y(),M("svg",o4e,[...t[0]||(t[0]=[C("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 10.2797 2.43414 8.66074 3.19922 7.24707C3.20172 7.24246 3.20453 7.23801 3.20703 7.2334C3.33385 6.99995 3.47181 6.77351 3.61621 6.55176C3.73214 6.37355 3.85079 6.19744 3.97754 6.02734C5.35905 4.17471 7.36856 2.81959 9.68945 2.27051C9.69952 2.26813 9.70965 2.26602 9.71973 2.26367C9.85224 2.23276 9.98563 2.2043 10.1201 2.17871C10.1542 2.17221 10.1884 2.16631 10.2227 2.16016C10.3466 2.13791 10.4712 2.11724 10.5967 2.09961C10.6301 2.09489 10.6637 2.0913 10.6973 2.08691C10.8216 2.07073 10.9465 2.05552 11.0723 2.04395C11.1125 2.04022 11.153 2.0384 11.1934 2.03516C11.4595 2.0139 11.7284 2 12 2ZM11.9941 3.7998C11.9968 3.86623 12 3.93292 12 4C12 6.76142 9.76142 9 7 9C6.14209 9 5.33517 8.78324 4.62988 8.40234C4.09862 9.48861 3.7998 10.7093 3.7998 12C3.7998 12.4438 3.83644 12.8791 3.9043 13.3037C4.52807 12.5673 5.45945 12.0996 6.5 12.0996C8.37777 12.0996 9.90039 13.6222 9.90039 15.5C9.90039 17.0702 8.83532 18.3903 7.38867 18.7812C8.70267 19.6765 10.2901 20.2002 12 20.2002C12.468 20.2002 12.9264 20.1583 13.373 20.083C13.1323 19.4342 13 18.7327 13 18C13 14.6863 15.6863 12 19 12C19.4098 12 19.8098 12.0416 20.1963 12.1201C20.1969 12.0801 20.2002 12.0401 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998H11.9941ZM19 13.7998C16.6804 13.7998 14.7998 15.6804 14.7998 18C14.7998 18.5617 14.9112 19.0972 15.1113 19.5869C17.5225 18.597 19.3558 16.4929 19.9727 13.9141C19.6605 13.8399 19.3349 13.7998 19 13.7998ZM6.5 13.9004C5.61634 13.9004 4.90039 14.6163 4.90039 15.5C4.90039 16.3837 5.61634 17.0996 6.5 17.0996C7.38366 17.0996 8.09961 16.3837 8.09961 15.5C8.09961 14.6163 7.38366 13.9004 6.5 13.9004ZM15.5 6.09961C16.8255 6.09961 17.9004 7.17452 17.9004 8.5C17.9004 9.82548 16.8255 10.9004 15.5 10.9004C14.1745 10.9004 13.0996 9.82548 13.0996 8.5C13.0996 7.17452 14.1745 6.09961 15.5 6.09961ZM15.5 7.90039C15.1686 7.90039 14.9004 8.16863 14.9004 8.5C14.9004 8.83137 15.1686 9.09961 15.5 9.09961C15.8314 9.09961 16.0996 8.83137 16.0996 8.5C16.0996 8.16863 15.8314 7.90039 15.5 7.90039ZM10.1992 4C8.35326 4.41375 6.74333 5.44923 5.59961 6.87598C6.02235 7.08306 6.49716 7.2002 7 7.2002C8.76731 7.2002 10.1992 5.76731 10.1992 4Z",fill:"currentColor"},null,-1)])])}const i4e=kt({name:"kimi-dark-mode",render:s4e}),r4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l4e(e,t){return y(),M("svg",r4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.90002C12.4971 2.90002 12.9 3.30297 12.9 3.80002V12.2939L15.8081 9.38585C16.1595 9.03438 16.7294 9.03438 17.0808 9.38585C17.4323 9.73732 17.4323 10.3072 17.0808 10.6586L12.6364 15.1031C12.4676 15.2719 12.2387 15.3667 12 15.3667C11.7613 15.3667 11.5324 15.2719 11.3636 15.1031L6.91917 10.6586C6.5677 10.3072 6.5677 9.73732 6.91917 9.38585C7.27064 9.03438 7.84049 9.03438 8.19196 9.38585L11.1 12.2939V3.80002C11.1 3.30297 11.503 2.90002 12 2.90002ZM4.00001 13.5874C4.49706 13.5874 4.90001 13.9903 4.90001 14.4874V18.043C4.90001 18.2758 4.99249 18.499 5.1571 18.6636C5.32172 18.8282 5.54498 18.9207 5.77778 18.9207H18.2222C18.455 18.9207 18.6783 18.8283 18.8429 18.6636C19.0075 18.499 19.1 18.2758 19.1 18.043V14.4874C19.1 13.9903 19.5029 13.5874 20 13.5874C20.4971 13.5874 20.9 13.9903 20.9 14.4874V18.043C20.9 18.7531 20.6179 19.4342 20.1157 19.9364C19.6135 20.4386 18.9324 20.7207 18.2222 20.7207H5.77778C5.06759 20.7207 4.38649 20.4386 3.88431 19.9364C3.38213 19.4342 3.10001 18.7531 3.10001 18.043V14.4874C3.10001 13.9903 3.50295 13.5874 4.00001 13.5874Z",fill:"currentColor"},null,-1)])])}const a4e=kt({name:"kimi-download",render:l4e}),u4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c4e(e,t){return y(),M("svg",u4e,[...t[0]||(t[0]=[C("path",{d:"M18.0179 3.09998C18.3963 3.10003 18.7709 3.17491 19.1205 3.31971C19.4701 3.46454 19.7884 3.67614 20.056 3.94373C20.3237 4.21144 20.5362 4.52965 20.681 4.87928C20.8258 5.22887 20.8997 5.60423 20.8997 5.9828C20.8997 6.36118 20.8257 6.73591 20.681 7.08533C20.5362 7.43497 20.3237 7.75317 20.056 8.02088L17.639 10.4379L9.15756 18.9183C8.5296 19.5463 7.74274 19.992 6.8812 20.2074L4.21811 20.8734C3.91148 20.95 3.5871 20.8596 3.36362 20.6361C3.14017 20.4126 3.05063 20.0883 3.12729 19.7816L3.79233 17.1185C4.00771 16.257 4.45344 15.4701 5.08139 14.8422L15.9798 3.94373C16.5203 3.40346 17.2536 3.09998 18.0179 3.09998ZM19.0003 19.1C19.4972 19.1002 19.8997 19.5034 19.8997 20.0004C19.8995 20.4971 19.4971 20.8996 19.0003 20.8998H12.0003C11.5034 20.8998 11.1001 20.4973 11.0999 20.0004C11.0999 19.5033 11.5033 19.1 12.0003 19.1H19.0003ZM18.0179 4.89979C17.7309 4.89979 17.4553 5.01417 17.2523 5.21717L6.35385 16.1146C5.95661 16.5119 5.67469 17.01 5.53842 17.5551L5.23666 18.7631L6.44467 18.4613C6.98971 18.3251 7.48782 18.0431 7.8851 17.6459L18.7826 6.74744C18.883 6.64702 18.9635 6.52821 19.0179 6.39686C19.0723 6.26558 19.0999 6.1247 19.0999 5.9828C19.0999 5.84075 19.0723 5.69916 19.0179 5.56776C18.9635 5.43645 18.883 5.31757 18.7826 5.21717C18.6821 5.11678 18.5631 5.03716 18.432 4.9828C18.3008 4.92845 18.16 4.89983 18.0179 4.89979Z",fill:"currentColor"},null,-1)])])}const d4e=kt({name:"kimi-edit",render:c4e}),f4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function p4e(e,t){return y(),M("svg",f4e,[...t[0]||(t[0]=[C("path",{d:"M5 11.0996C5.49693 11.0996 5.90018 11.5031 5.90039 12V18C5.90039 18.0552 5.94477 18.0996 6 18.0996H12C12.4969 18.0996 12.9002 18.5031 12.9004 19C12.9004 19.4971 12.4971 19.9004 12 19.9004H6C4.95066 19.9004 4.09961 19.0493 4.09961 18V12C4.09982 11.5031 4.50307 11.0996 5 11.0996ZM18 4.09961C19.0492 4.09961 19.9002 4.95084 19.9004 6V12C19.9004 12.4971 19.4971 12.9004 19 12.9004C18.5029 12.9004 18.0996 12.4971 18.0996 12V6C18.0994 5.94495 18.0551 5.90039 18 5.90039H12C11.5029 5.90039 11.0996 5.49706 11.0996 5C11.0998 4.50312 11.5031 4.09961 12 4.09961H18Z",fill:"currentColor"},null,-1)])])}const h4e=kt({name:"kimi-expand",render:p4e}),m4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g4e(e,t){return y(),M("svg",m4e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1723 2.1001C13.9413 2.10018 14.6793 2.40592 15.2231 2.94971L19.0512 6.77783C19.595 7.32162 19.9007 8.0596 19.9008 8.82861V18.0005C19.9008 20.1544 18.1543 21.9009 16.0004 21.9009H8.0004C5.84649 21.9009 4.10001 20.1544 4.10001 18.0005V6.00049C4.10001 3.84658 5.84649 2.1001 8.0004 2.1001H13.1723ZM8.0004 3.90088C6.8406 3.90088 5.90079 4.84069 5.90079 6.00049V18.0005C5.90079 19.1603 6.8406 20.1001 8.0004 20.1001H16.0004C17.1602 20.1001 18.1 19.1603 18.1 18.0005V9.90088H15.0004C13.3988 9.90088 12.1 8.60211 12.1 7.00049V3.90088H8.0004ZM13.9008 7.00049C13.9008 7.608 14.3929 8.1001 15.0004 8.1001H17.8217C17.8072 8.08375 17.7933 8.06681 17.7777 8.05127L13.9496 4.22314C13.9339 4.20745 13.9173 4.19286 13.9008 4.17822V7.00049Z",fill:"currentColor"})],-1)])])}const Gx=kt({name:"kimi-file",render:g4e}),v4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y4e(e,t){return y(),M("svg",v4e,[...t[0]||(t[0]=[C("path",{d:"M15.4795 15.4971C15.9765 15.4971 16.3799 15.9004 16.3799 16.3975C16.3799 16.8945 15.9765 17.2978 15.4795 17.2979H8.52051C8.02345 17.2979 7.62012 16.8945 7.62012 16.3975C7.62012 15.9004 8.02345 15.4971 8.52051 15.4971H15.4795Z",fill:"currentColor"},null,-1),C("path",{d:"M12.3359 11.0996C12.8329 11.0997 13.2354 11.503 13.2354 12C13.2354 12.497 12.8329 12.9003 12.3359 12.9004H8.52051C8.02345 12.9004 7.62012 12.4971 7.62012 12C7.62012 11.5029 8.02345 11.0996 8.52051 11.0996H12.3359Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1719 2.09961C13.9408 2.09969 14.6789 2.40555 15.2227 2.94922L19.0508 6.77734C19.5946 7.32113 19.9003 8.05911 19.9004 8.82812V18C19.9004 20.1539 18.1539 21.9004 16 21.9004H8C5.84626 21.9002 4.09961 20.1538 4.09961 18V6C4.09961 3.84621 5.84626 2.09981 8 2.09961H13.1719ZM8 3.90039C6.84037 3.90059 5.90039 4.84032 5.90039 6V18C5.90039 19.1597 6.84037 20.0994 8 20.0996H16C17.1598 20.0996 18.0996 19.1598 18.0996 18V9.90039H15C13.3985 9.90019 12.0996 8.6015 12.0996 7V3.90039H8ZM13.9004 7C13.9004 7.60739 14.3927 8.09941 15 8.09961H17.8213C17.8068 8.08333 17.7928 8.06626 17.7773 8.05078L13.9492 4.22266C13.9335 4.20696 13.9169 4.19237 13.9004 4.17773V7Z",fill:"currentColor"},null,-1)])])}const k4e=kt({name:"kimi-file-text",render:y4e}),b4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C4e(e,t){return y(),M("svg",b4e,[...t[0]||(t[0]=[C("path",{d:"M9.2373 3.7002C10.4169 3.7002 11.5297 4.24779 12.249 5.18262L12.4424 5.43359H18C20.0987 5.43359 21.7998 7.13472 21.7998 9.2334V16.5C21.7998 18.5987 20.0987 20.2998 18 20.2998H6C3.90132 20.2998 2.2002 18.5987 2.2002 16.5V7.5C2.2002 5.40132 3.90132 3.7002 6 3.7002H9.2373ZM6 5.5C4.89543 5.5 4 6.39543 4 7.5V16.5C4 17.6046 4.89543 18.5 6 18.5H18C19.0357 18.5 19.887 17.7128 19.9893 16.7041L20 16.5V9.2334C20 8.19775 19.2128 7.34641 18.2041 7.24414L18 7.2334H12.0479L11.9326 7.22656C11.666 7.19561 11.4205 7.05812 11.2549 6.84277L10.8223 6.28027C10.4437 5.78834 9.85808 5.5 9.2373 5.5H6ZM16 9.59961C16.4971 9.59961 16.9004 10.0029 16.9004 10.5C16.9004 10.9971 16.4971 11.4004 16 11.4004H8C7.50294 11.4004 7.09961 10.9971 7.09961 10.5C7.09961 10.0029 7.50294 9.59961 8 9.59961H16Z",fill:"currentColor"},null,-1)])])}const w4e=kt({name:"kimi-folder",render:C4e}),_4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x4e(e,t){return y(),M("svg",_4e,[...t[0]||(t[0]=[C("g",null,[C("path",{d:"M18.3623 9.99976L18.209 8.48999C18.2031 8.43161 18.2004 8.37289 18.2002 8.31421C18.1988 8.31196 18.1956 8.30842 18.1904 8.30347C18.1718 8.28559 18.1302 8.26245 18.0713 8.26245H11C10.261 8.26245 9.59753 7.81016 9.32617 7.1228L8.9082 6.06421C8.88101 5.9953 8.85737 5.92501 8.83887 5.85327C8.83778 5.85099 8.833 5.84268 8.81836 5.83179C8.79454 5.81475 8.7549 5.79939 8.70605 5.80054H3.92871C3.86986 5.80054 3.82825 5.82368 3.80957 5.84155C3.80816 5.8429 3.80675 5.84428 3.80566 5.84546L4.47559 14.0955L3.62109 17.5154L5.12109 11.5154C5.34367 10.6251 6.1438 9.99977 7.06152 9.99976H18.3623ZM7.06152 11.7996C6.96976 11.7996 6.88944 11.8629 6.86719 11.9519L5.36719 17.9519C5.33598 18.078 5.43158 18.1999 5.56152 18.2H19.4385C19.5302 18.1999 19.6106 18.1376 19.6328 18.0486L21.1328 12.0486C21.1644 11.9224 21.0686 11.7996 20.9385 11.7996H7.06152ZM20.9385 9.99976C22.2396 9.99977 23.1945 11.2228 22.8789 12.4851L21.3789 18.4851C21.1563 19.3754 20.3562 19.9997 19.4385 19.9998H4.92871C4.41722 19.9998 3.92613 19.8059 3.56445 19.4597C3.20281 19.1135 3.00004 18.6436 3 18.1541L2 5.84644C2.00006 5.35711 2.20311 4.88786 2.56445 4.54175C2.92613 4.19554 3.41722 4.00073 3.92871 4.00073H8.66406C9.10133 3.99051 9.5296 4.1225 9.87793 4.37573C10.2285 4.63118 10.4767 4.99457 10.582 5.40405L11 6.46167H18.0713C18.5828 6.46167 19.0739 6.65648 19.4355 7.00269C19.7971 7.34888 20 7.81883 20 8.30835L20.1719 9.99976H20.9385Z",fill:"currentColor"})],-1)])])}const S4e=kt({name:"kimi-folder-open",render:x4e}),A4e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function M4e(e,t){return y(),M("svg",A4e,[...t[0]||(t[0]=[C("path",{id:"af-p0",d:"M -2.619 -8.3 C -1.815 -8.3 -1.048 -7.97 -0.499 -7.39 C -0.499 -7.39 0.141 -6.712 0.141 -6.712 C 0.141 -6.712 5.75 -6.712 5.75 -6.712 C 7.904 -6.712 9.65 -4.986 9.65 -2.858 C 9.65 -2.858 9.65 -1.71 9.65 -1.71 C 9.65 -1.219 9.247 -0.821 8.75 -0.821 C 8.253 -0.821 7.85 -1.219 7.85 -1.71 C 7.85 -1.71 7.85 -2.858 7.85 -2.858 C 7.849 -4.004 6.91 -4.934 5.75 -4.934 C 5.75 -4.934 -0.207 -4.934 -0.207 -4.934 C -0.484 -4.934 -0.749 -5.047 -0.938 -5.247 C -0.938 -5.247 -1.815 -6.177 -1.815 -6.177 C -2.023 -6.397 -2.315 -6.521 -2.619 -6.521 C -2.619 -6.521 -6.25 -6.521 -6.25 -6.521 C -7.41 -6.521 -8.35 -5.592 -8.35 -4.446 C -8.35 -4.446 -8.35 4.446 -8.35 4.446 C -8.35 5.592 -7.41 6.521 -6.25 6.521 C -6.25 6.521 1.25 6.521 1.25 6.521 C 1.747 6.521 2.15 6.919 2.15 7.41 C 2.15 7.901 1.747 8.3 1.25 8.3 C 1.25 8.3 -6.25 8.3 -6.25 8.3 C -8.404 8.3 -10.15 6.574 -10.15 4.446 C -10.15 4.446 -10.15 -4.446 -10.15 -4.446 C -10.15 -6.574 -8.404 -8.3 -6.25 -8.3 C -6.25 -8.3 -2.619 -8.3 -2.619 -8.3 Z M 3.75 -2.5 C 4.247 -2.5 4.65 -2.097 4.65 -1.6 C 4.65 -1.103 4.247 -0.699 3.75 -0.699 C 3.75 -0.699 -4.25 -0.699 -4.25 -0.699 C -4.747 -0.699 -5.15 -1.103 -5.15 -1.6 C -5.15 -2.097 -4.747 -2.5 -4.25 -2.5 C -4.25 -2.5 3.75 -2.5 3.75 -2.5 Z",transform:"matrix(1 0 0 1 11.75 12)",fill:"currentColor"},null,-1),C("g",{id:"af-p1"},[C("path",{d:"M 2.635 0 L -2.635 0 M 0 -2.635 L 0 2.635",transform:"matrix(1 0 0 1 18.4 16.3)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"})],-1)])])}const T4e=kt({name:"kimi-folder-plus",render:M4e}),E4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I4e(e,t){return y(),M("svg",E4e,[...t[0]||(t[0]=[C("path",{d:"M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3ZM12 19.2002C15.9764 19.2002 19.2002 15.9764 19.2002 12C19.2002 8.02355 15.9764 4.7998 12 4.7998V19.2002Z",fill:"currentColor"},null,-1)])])}const L4e=kt({name:"kimi-follow-system",render:I4e}),$4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N4e(e,t){return y(),M("svg",$4e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7ZM12 15.6992C12.4968 15.6992 12.8994 16.1028 12.8994 16.5996C12.8994 17.0964 12.4968 17.5 12 17.5C11.5024 17.5 11.0996 17.0964 11.0996 16.5996C11.0996 16.1028 11.5024 15.6992 12 15.6992ZM12 6.49902C12.4969 6.49922 12.8994 6.86908 12.8994 7.3252V13.6729C12.8994 14.129 12.4969 14.4988 12 14.499C11.5029 14.499 11.0996 14.1291 11.0996 13.6729V7.3252C11.0996 6.86896 11.5029 6.49902 12 6.49902Z",fill:"currentColor"},null,-1)])])}const F4e=kt({name:"kimi-full-access",render:N4e}),R4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O4e(e,t){return y(),M("svg",R4e,[...t[0]||(t[0]=[C("path",{d:"M12.5092 2.11279C17.7402 2.37781 21.8998 6.70364 21.8998 12.0005C21.8996 17.4153 17.5524 21.8108 12.1576 21.895C12.1056 21.898 12.0532 21.8999 12.0004 21.8999C11.948 21.8999 11.8954 21.8968 11.8432 21.896L11.8422 21.895C6.44751 21.8107 2.10022 17.4152 2.10001 12.0005C2.10001 6.53287 6.53278 2.1001 12.0004 2.1001L12.5092 2.11279ZM8.92715 13.0005C9.02896 14.9787 9.42581 16.721 9.99356 17.9985C10.3249 18.7441 10.6971 19.292 11.0639 19.6411C11.4259 19.9855 11.741 20.1001 12.0004 20.1001C12.2598 20.1 12.5749 19.9856 12.9369 19.6411C13.3037 19.292 13.6749 18.7441 14.0063 17.9985C14.574 16.721 14.9718 14.9788 15.0736 13.0005H8.92715ZM3.96329 13.0005C4.31462 15.8522 6.14714 18.2427 8.66837 19.3823C8.55544 19.1733 8.44916 18.9552 8.34903 18.73C7.66574 17.1926 7.22657 15.1926 7.12344 13.0005H3.96329ZM16.8764 13.0005C16.7732 15.1926 16.3341 17.1926 15.6508 18.73C15.5506 18.9554 15.4435 19.1732 15.3305 19.3823C17.8522 18.2429 19.6851 15.8525 20.0365 13.0005H16.8764ZM8.66934 4.6167C6.08869 5.78266 4.22826 8.25964 3.93985 11.1997H7.11661C7.20176 8.92954 7.64512 6.85497 8.34903 5.271C8.4494 5.04516 8.5561 4.82619 8.66934 4.6167ZM12.0004 3.8999C11.7411 3.8999 11.4259 4.01454 11.0639 4.35889C10.6971 4.70797 10.3249 5.25587 9.99356 6.00146C9.40671 7.32188 9.00186 9.13885 8.91739 11.1997H15.0834C14.9989 9.13884 14.5931 7.32189 14.0063 6.00146C13.6749 5.2559 13.3037 4.70796 12.9369 4.35889C12.5749 4.0144 12.2598 3.90002 12.0004 3.8999ZM15.3295 4.61572C15.443 4.82559 15.5502 5.04471 15.6508 5.271C16.3547 6.85498 16.799 8.92949 16.8842 11.1997H20.06C19.7715 8.25914 17.9108 5.78143 15.3295 4.61572Z",fill:"currentColor"},null,-1)])])}const P4e=kt({name:"kimi-globe",render:O4e}),D4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B4e(e,t){return y(),M("svg",D4e,[...t[0]||(t[0]=[C("path",{d:"M8 17C8.82834 17 9.5 17.6717 9.5 18.5C9.5 19.3283 8.82834 20 8 20C7.17166 20 6.5 19.3283 6.5 18.5C6.5 17.6717 7.17166 17 8 17ZM16 17C16.8283 17 17.5 17.6717 17.5 18.5C17.5 19.3283 16.8283 20 16 20C15.1717 20 14.5 19.3283 14.5 18.5C14.5 17.6717 15.1717 17 16 17ZM8 10.5C8.82834 10.5 9.5 11.1717 9.5 12C9.5 12.8283 8.82834 13.5 8 13.5C7.17166 13.5 6.5 12.8283 6.5 12C6.5 11.1717 7.17166 10.5 8 10.5ZM16 10.5C16.8283 10.5 17.5 11.1717 17.5 12C17.5 12.8283 16.8283 13.5 16 13.5C15.1717 13.5 14.5 12.8283 14.5 12C14.5 11.1717 15.1717 10.5 16 10.5ZM8 4C8.82834 4 9.5 4.67166 9.5 5.5C9.5 6.32834 8.82834 7 8 7C7.17166 7 6.5 6.32834 6.5 5.5C6.5 4.67166 7.17166 4 8 4ZM16 4C16.8283 4 17.5 4.67166 17.5 5.5C17.5 6.32834 16.8283 7 16 7C15.1717 7 14.5 6.32834 14.5 5.5C14.5 4.67166 15.1717 4 16 4Z",fill:"currentColor"},null,-1)])])}const H4e=kt({name:"kimi-grip",render:B4e}),z4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W4e(e,t){return y(),M("svg",z4e,[...t[0]||(t[0]=[C("path",{d:"M7.22264 6.10352C7.22264 5.5078 7.48259 4.95449 7.91405 4.56055C8.34271 4.16918 8.90831 3.96198 9.48241 3.96191C9.64155 3.96191 9.80001 3.97936 9.95507 4.01074C10.0127 3.5042 10.2586 3.04178 10.6338 2.69922C11.0625 2.30778 11.6279 2.09961 12.2021 2.09961C12.7763 2.09966 13.3418 2.30783 13.7705 2.69922C13.9947 2.90401 14.1709 3.15244 14.29 3.42676C14.4947 3.37044 14.7071 3.34182 14.9209 3.3418C15.4951 3.3418 16.0605 3.549 16.4892 3.94043C16.8644 4.28293 17.1093 4.74548 17.167 5.25195C17.3223 5.22045 17.4812 5.20312 17.6406 5.20312C18.2147 5.20318 18.7803 5.41135 19.209 5.80273C19.6402 6.19663 19.9004 6.74922 19.9004 7.34473V14.6543C19.9004 17.413 19.2914 19.0434 18.0137 20.21C16.82 21.2998 15.2175 21.9004 13.5615 21.9004C11.7538 21.9004 10.2315 21.5696 8.95702 20.8535C7.67664 20.1341 6.71683 19.0652 5.97362 17.708L3.3496 12.916C3.18848 12.6213 3.10112 12.2914 3.0996 11.9531C3.09812 11.6147 3.18309 11.2835 3.34179 10.9873C3.5001 10.692 3.72639 10.4416 3.99706 10.251C4.26771 10.0604 4.57776 9.93235 4.90136 9.87305C5.56617 9.75102 6.25934 9.84517 6.86425 10.1445C6.9942 10.2088 7.11461 10.2788 7.22264 10.3477V6.10352ZM9.02343 12.7969C9.02336 13.1912 8.76624 13.5395 8.38964 13.6562C8.0129 13.773 7.60387 13.6309 7.38085 13.3057L6.53514 12.0723C6.51218 12.0529 6.48411 12.0282 6.45018 12.002C6.34595 11.9213 6.20986 11.8289 6.06639 11.7578C5.81525 11.6335 5.51637 11.5904 5.22655 11.6436H5.22557C5.15055 11.6573 5.08558 11.6865 5.03417 11.7227C4.98289 11.7588 4.94815 11.7998 4.92772 11.8379C4.90762 11.8755 4.90023 11.9122 4.90038 11.9453C4.90057 11.9782 4.9084 12.0144 4.9287 12.0518L7.55272 16.8438C8.16912 17.9693 8.90989 18.7622 9.83886 19.2842C10.7737 19.8094 11.9704 20.0996 13.5615 20.0996C14.7902 20.0996 15.9536 19.6533 16.7998 18.8809C17.5619 18.185 18.0996 17.1383 18.0996 14.6543V7.34473C18.0996 7.28204 18.0734 7.20342 17.9951 7.13184C17.9139 7.05771 17.7875 7.00396 17.6406 7.00391C17.4937 7.00391 17.3674 7.05771 17.2861 7.13184C17.2077 7.20347 17.1807 7.28199 17.1807 7.34473V11.0693C17.1805 11.5661 16.778 11.9685 16.2812 11.9688C15.7843 11.9688 15.381 11.5662 15.3808 11.0693V5.48242C15.3808 5.41973 15.3537 5.34107 15.2754 5.26953C15.1941 5.19547 15.0677 5.1416 14.9209 5.1416C14.774 5.14166 14.6476 5.19541 14.5664 5.26953C14.4881 5.34105 14.462 5.41974 14.4619 5.48242V11.0693C14.4617 11.5662 14.0584 11.9688 13.5615 11.9688C13.0646 11.9687 12.6613 11.5662 12.6611 11.0693V4.24121C12.6611 4.17852 12.635 4.09989 12.5566 4.02832C12.4754 3.95419 12.349 3.90045 12.2021 3.90039C12.0552 3.90039 11.9289 3.95421 11.8476 4.02832C11.7692 4.09992 11.7422 4.17849 11.7422 4.24121V11.0693C11.742 11.5661 11.3395 11.9685 10.8428 11.9688C10.3458 11.9688 9.94257 11.5662 9.94237 11.0693V6.10352L9.93651 6.05371C9.92534 6.00177 9.89573 5.94433 9.8369 5.89062C9.75567 5.81647 9.62938 5.76172 9.48241 5.76172C9.33554 5.76179 9.2091 5.81651 9.12792 5.89062C9.04964 5.96222 9.02343 6.04084 9.02343 6.10352V12.7969Z",fill:"currentColor"},null,-1)])])}const U4e=kt({name:"kimi-hand",render:W4e}),j4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V4e(e,t){return y(),M("svg",j4e,[...t[0]||(t[0]=[C("path",{d:"M4 3.33203C4.55224 3.33203 4.99993 3.7798 5 4.33203V18.0908H20.0674C20.6195 18.0908 21.0671 18.5388 21.0674 19.0908C21.0674 19.6431 20.6197 20.0908 20.0674 20.0908H5C3.89543 20.0908 3 19.1954 3 18.0908V4.33203C3.00007 3.7798 3.44776 3.33203 4 3.33203ZM8.19922 9.28418C8.7515 9.28418 9.19922 9.73189 9.19922 10.2842V15.6045C9.19908 16.1567 8.75142 16.6045 8.19922 16.6045C7.64719 16.6043 7.19936 16.1565 7.19922 15.6045V10.2842C7.19922 9.73202 7.6471 9.28438 8.19922 9.28418ZM17.2227 6.85645C17.7748 6.85658 18.2226 7.3043 18.2227 7.85645V15.6045C18.2225 16.1566 17.7747 16.6044 17.2227 16.6045C16.6705 16.6045 16.2228 16.1566 16.2227 15.6045V7.85645C16.2227 7.30422 16.6704 6.85645 17.2227 6.85645ZM12.7109 3.96387C13.2631 3.96387 13.7107 4.41175 13.7109 4.96387V15.6035C13.7109 16.1558 13.2632 16.6035 12.7109 16.6035C12.1587 16.6035 11.7109 16.1558 11.7109 15.6035V4.96387C11.7111 4.41175 12.1588 3.96387 12.7109 3.96387Z",fill:"currentColor"},null,-1)])])}const q4e=kt({name:"kimi-histogram",render:V4e}),K4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z4e(e,t){return y(),M("svg",K4e,[...t[0]||(t[0]=[C("path",{d:"M8.00916 7.50488C8.47326 7.50488 8.91828 7.68943 9.24646 8.01758C9.57465 8.34577 9.75916 8.79075 9.75916 9.25488C9.75916 9.71901 9.57465 10.164 9.24646 10.4922C8.91828 10.8203 8.47326 11.0049 8.00916 11.0049C7.54507 11.0049 7.10001 10.8203 6.77185 10.4922C6.4437 10.164 6.25916 9.71898 6.25916 9.25488C6.25916 8.79078 6.4437 8.34576 6.77185 8.01758C7.10001 7.68942 7.54507 7.50492 8.00916 7.50488Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17.8998 4.09961C20.0537 4.09961 21.8002 5.84609 21.8002 8V16C21.8002 18.1539 20.0537 19.9004 17.8998 19.9004H5.89978C3.74598 19.9003 1.99939 18.1538 1.99939 16V8C1.99939 5.84617 3.74598 4.09974 5.89978 4.09961H17.8998ZM15.4867 12.2539C15.448 12.2184 15.3885 12.2192 15.351 12.2559L11.7338 15.8027C11.0146 16.5079 9.87305 16.5222 9.13708 15.835L6.98669 13.8262C6.95049 13.7924 6.89516 13.791 6.85681 13.8223L3.82361 16.2988C3.96873 17.3168 4.84165 18.0995 5.89978 18.0996H17.8998C18.9375 18.0996 19.7964 17.3466 19.9662 16.3574L15.4867 12.2539ZM5.89978 5.90039C4.74009 5.90052 3.80017 6.84028 3.80017 8V14.002L5.73181 12.4238C6.46046 11.8286 7.51253 11.8634 8.20056 12.5059L10.351 14.5146C10.3897 14.5508 10.4498 14.5497 10.4877 14.5127L14.1049 10.9658C14.819 10.2656 15.9506 10.2466 16.6879 10.9219L19.9994 13.9551V8C19.9994 6.8402 19.0596 5.90039 17.8998 5.90039H5.89978Z",fill:"currentColor"},null,-1)])])}const G4e=kt({name:"kimi-image",render:Z4e}),Y4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X4e(e,t){return y(),M("svg",Y4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.09375 2.81174C5.4825 2.50796 6.04376 2.56488 6.34766 2.93869L20.1855 19.9602C20.4895 20.3341 20.421 20.8836 20.0322 21.1877C19.6435 21.4917 19.0823 21.4355 18.7783 21.0617L17.9971 20.1008H5.99609C3.84224 20.1008 2.0958 18.3552 2.0957 16.2014V8.13889C2.09589 6.26755 3.41429 4.70428 5.17285 4.32639L4.93945 4.03928C4.63577 3.66536 4.7051 3.11573 5.09375 2.81174ZM7.13184 14.1096C7.09416 14.0738 7.03659 14.0713 6.99609 14.1037L3.92871 16.5569C4.09761 17.5472 4.95753 18.301 5.99609 18.301H16.5342L13.373 14.4133L11.9072 15.9455C11.1531 16.7324 9.92202 16.7621 9.13281 16.0119L7.13184 14.1096ZM5.99609 6.03928C4.83643 6.03928 3.89669 6.97927 3.89648 8.13889V14.1408L5.83496 12.5901C6.60469 11.9742 7.69929 12.022 8.41504 12.7024L10.416 14.6037C10.4575 14.6431 10.5218 14.642 10.5615 14.6008L12.1641 12.926L9.78906 10.0051C9.70282 10.2646 9.55682 10.5038 9.35645 10.7004C9.02202 11.0285 8.56767 11.2131 8.09473 11.2131C7.62195 11.213 7.1683 11.0284 6.83398 10.7004C6.49961 10.3724 6.31152 9.92701 6.31152 9.46311C6.3116 8.99941 6.49981 8.55474 6.83398 8.22678C7.12986 7.93654 7.51931 7.75901 7.93262 7.7219L6.56543 6.03928H5.99609Z",fill:"currentColor"},null,-1),C("path",{d:"M18.0049 4.31272C20.1587 4.31288 21.9043 6.0593 21.9043 8.21311V13.718C21.9039 15.4743 19.7248 16.2906 18.5713 14.966L14.9141 10.7658C14.5882 10.3912 14.6278 9.82271 15.002 9.49631C15.3768 9.16994 15.9451 9.20948 16.2715 9.5842L19.9287 13.7844C19.9528 13.812 19.9696 13.8167 19.9775 13.8186C19.9908 13.8216 20.0141 13.8213 20.04 13.8117C20.0655 13.8021 20.0826 13.7875 20.0908 13.7766C20.0955 13.7702 20.1044 13.7552 20.1045 13.718V8.21311C20.1045 7.05341 19.1645 6.11366 18.0049 6.1135H10.6328C10.1361 6.11327 9.73267 5.70981 9.73242 5.21311C9.73242 4.71619 10.136 4.31295 10.6328 4.31272H18.0049Z",fill:"currentColor"},null,-1)])])}const J4e=kt({name:"kimi-image-failed",render:X4e}),Q4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e3e(e,t){return y(),M("svg",Q4e,[...t[0]||(t[0]=[C("path",{d:"M12 2.1001C17.4676 2.10031 21.8994 6.53286 21.8994 12.0005C21.8992 17.4679 17.4674 21.8997 12 21.8999C6.53237 21.8999 2.09982 17.4681 2.09961 12.0005C2.09961 6.53273 6.53224 2.1001 12 2.1001ZM12 3.8999C7.52636 3.8999 3.89941 7.52684 3.89941 12.0005C3.89963 16.474 7.52649 20.1001 12 20.1001C16.4733 20.0999 20.0994 16.4738 20.0996 12.0005C20.0996 7.52697 16.4735 3.90011 12 3.8999ZM12 9.50049C12.4969 9.50068 12.8994 9.87055 12.8994 10.3267V16.6743C12.8992 17.1303 12.4968 17.5003 12 17.5005C11.503 17.5005 11.0998 17.1304 11.0996 16.6743V10.3267C11.0996 9.87043 11.5029 9.50049 12 9.50049ZM12 6.49951C12.4968 6.49951 12.8994 6.90313 12.8994 7.3999C12.8992 7.8965 12.4966 8.30029 12 8.30029C11.5025 8.30028 11.0998 7.8965 11.0996 7.3999C11.0996 6.90313 11.5024 6.49952 12 6.49951Z",fill:"currentColor"},null,-1)])])}const t3e=kt({name:"kimi-info",render:e3e}),n3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o3e(e,t){return y(),M("svg",n3e,[...t[0]||(t[0]=[iu('',10)])])}const s3e=kt({name:"kimi-keyboard",render:o3e}),i3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function r3e(e,t){return y(),M("svg",i3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const l3e=kt({name:"kimi-left-panel",render:r3e}),a3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function u3e(e,t){return y(),M("svg",a3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow-expand",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const c3e=kt({name:"kimi-left-panel-expand",render:u3e}),d3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f3e(e,t){return y(),M("svg",d3e,[...t[0]||(t[0]=[iu('',1)])])}const p3e=kt({name:"kimi-light-mode",render:f3e}),h3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m3e(e,t){return y(),M("svg",h3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.97427 8.06961C4.99348 7.33581 6.18946 7.1 7.00001 7.1H9.00001C9.49706 7.1 9.90001 7.50294 9.90001 8C9.90001 8.49706 9.49706 8.9 9.00001 8.9H7.00001C6.47755 8.9 5.67353 9.06419 5.02599 9.53039C4.42434 9.96356 3.90001 10.6934 3.90001 12C3.90001 13.3066 4.42434 14.0364 5.02599 14.4696C5.67353 14.9358 6.47755 15.1 7.00001 15.1H9.00001C9.49706 15.1 9.90001 15.5029 9.90001 16C9.90001 16.4971 9.49706 16.9 9.00001 16.9H7.00001C6.18946 16.9 4.99348 16.6642 3.97427 15.9304C2.90917 15.1636 2.10001 13.8934 2.10001 12C2.10001 10.1066 2.90917 8.83644 3.97427 8.06961ZM14.1 8C14.1 7.50294 14.5029 7.1 15 7.1H17C17.8105 7.1 19.0065 7.33581 20.0257 8.06961C21.0908 8.83644 21.9 10.1066 21.9 12C21.9 13.8934 21.0908 15.1636 20.0257 15.9304C19.0065 16.6642 17.8105 16.9 17 16.9H15C14.5029 16.9 14.1 16.4971 14.1 16C14.1 15.5029 14.5029 15.1 15 15.1H17C17.5225 15.1 18.3265 14.9358 18.974 14.4696C19.5757 14.0364 20.1 13.3066 20.1 12C20.1 10.6934 19.5757 9.96356 18.974 9.53039C18.3265 9.06419 17.5225 8.9 17 8.9H15C14.5029 8.9 14.1 8.49706 14.1 8ZM7.10001 12C7.10001 11.5029 7.50295 11.1 8.00001 11.1H16C16.4971 11.1 16.9 11.5029 16.9 12C16.9 12.4971 16.4971 12.9 16 12.9H8.00001C7.50295 12.9 7.10001 12.4971 7.10001 12Z",fill:"currentColor"},null,-1)])])}const g3e=kt({name:"kimi-link",render:m3e}),v3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y3e(e,t){return y(),M("svg",v3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.10001 5.99998C4.10001 5.50292 4.50295 5.09998 5.00001 5.09998H19C19.4971 5.09998 19.9 5.50292 19.9 5.99998C19.9 6.49703 19.4971 6.89998 19 6.89998H5.00001C4.50295 6.89998 4.10001 6.49703 4.10001 5.99998ZM4.10001 12C4.10001 11.5029 4.50295 11.1 5.00001 11.1H19C19.4971 11.1 19.9 11.5029 19.9 12C19.9 12.497 19.4971 12.9 19 12.9H5.00001C4.50295 12.9 4.10001 12.497 4.10001 12ZM4.10001 18C4.10001 17.5029 4.50295 17.1 5.00001 17.1H19C19.4971 17.1 19.9 17.5029 19.9 18C19.9 18.497 19.4971 18.9 19 18.9H5.00001C4.50295 18.9 4.10001 18.497 4.10001 18Z",fill:"currentColor"},null,-1)])])}const k3e=kt({name:"kimi-list",render:y3e}),b3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C3e(e,t){return y(),M("svg",b3e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 4.09961C20.1539 4.09961 21.9004 5.84609 21.9004 8V16C21.9004 18.1539 20.1539 19.9004 18 19.9004H6C3.84609 19.9004 2.09961 18.1539 2.09961 16V8C2.09961 5.84609 3.84609 4.09961 6 4.09961H18ZM3.90039 16C3.90039 17.1598 4.8402 18.0996 6 18.0996H18C19.1598 18.0996 20.0996 17.1598 20.0996 16V9.49805L13.5361 13.5361C12.5955 14.1147 11.4075 14.1084 10.4727 13.5205L3.90039 9.38672V16ZM6 5.90039C5.0746 5.90039 4.29039 6.49909 4.01074 7.33008L11.4316 11.9971C11.7861 12.2199 12.2361 12.2222 12.5928 12.0029L20.0195 7.43457C19.7725 6.54993 18.9636 5.90039 18 5.90039H6Z",fill:"currentColor"})],-1)])])}const w3e=kt({name:"kimi-mail",render:C3e}),_3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x3e(e,t){return y(),M("svg",_3e,[...t[0]||(t[0]=[C("path",{d:"M17 11.0996C17.4971 11.0996 17.9004 11.5029 17.9004 12C17.9004 12.4971 17.4971 12.9004 17 12.9004H7C6.50294 12.9004 6.09961 12.4971 6.09961 12C6.09961 11.5029 6.50294 11.0996 7 11.0996H17Z",fill:"currentColor"},null,-1)])])}const S3e=kt({name:"kimi-minus",render:x3e}),A3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M3e(e,t){return y(),M("svg",A3e,[...t[0]||(t[0]=[C("path",{d:"M15.182 3.32802C15.9304 2.72235 17.0309 2.76978 17.724 3.46767L18.5424 4.29189L18.6722 4.43642C19.2377 5.13495 19.234 6.1404 18.6635 6.83486L18.5326 6.97841L18.0248 7.48232C17.9549 7.55172 17.8793 7.61254 17.8021 7.66884C17.9794 8.18027 17.9316 8.7498 17.6595 9.22841C17.6847 9.24522 17.7091 9.2635 17.7328 9.2831L17.8002 9.3456L17.9847 9.53798C19.8515 11.5442 20.4549 14.0022 19.6224 16.2196C19.1921 17.3657 18.4025 18.3827 17.2992 19.203H19.0873L19.1801 19.2079C19.6337 19.2542 19.9877 19.6375 19.9877 20.1034C19.9876 20.5692 19.6337 20.9527 19.1801 20.9989L19.0873 21.0028H13.0385C13.0244 21.0033 13.0104 21.0031 12.9965 21.0028H4.9115C4.41448 21.0028 4.01117 20.6004 4.01111 20.1034C4.01111 19.6064 4.41444 19.203 4.9115 19.203H12.9047C15.7614 18.5471 17.3679 17.1023 17.9369 15.5868C18.4678 14.1726 18.179 12.4782 16.807 10.9188L16.5189 10.6093L16.4574 10.5399C16.4549 10.5368 16.453 10.5333 16.4506 10.5302L12.3011 14.6522C11.6031 15.3454 10.5023 15.3845 9.75818 14.7733L9.61365 14.6425L7.31091 12.3231C6.5717 11.5786 6.57617 10.376 7.32068 9.63662L12.3676 4.62392L12.5121 4.49404C13.0358 4.06988 13.7318 3.96755 14.3402 4.18251C14.3969 4.10597 14.4591 4.03197 14.5287 3.96279L15.0365 3.45791L15.182 3.32802ZM4.83044 12.9335C5.16112 12.6052 5.68305 12.5863 6.03552 12.8759L6.10291 12.9384L9.07361 15.9286L9.13513 15.997C9.42218 16.3514 9.3992 16.8727 9.06873 17.2011C8.7381 17.5294 8.21712 17.5482 7.86462 17.2587L7.79626 17.1972L4.82654 14.2069L4.76501 14.1376C4.47792 13.7831 4.49979 13.2619 4.83044 12.9335ZM13.6693 5.87978L13.6361 5.90126L8.58826 10.914C8.54935 10.9529 8.54943 11.0165 8.58826 11.0556L10.891 13.3739L10.9242 13.3964C10.9602 13.4111 11.0032 13.404 11.0326 13.3749L16.0795 8.3622L16.1019 8.329C16.1117 8.3049 16.1117 8.2779 16.1019 8.2538L16.0804 8.2206L13.7777 5.90224C13.7486 5.87289 13.7054 5.86535 13.6693 5.87978ZM16.3383 4.71376L16.3051 4.73525L15.7972 5.24013C15.7584 5.27904 15.7585 5.34166 15.7972 5.38076L16.6146 6.20498L16.6478 6.22744C16.6838 6.24221 16.7268 6.23487 16.7562 6.20595L17.264 5.70107L17.2865 5.66787C17.2962 5.64382 17.2963 5.61672 17.2865 5.59267L17.265 5.55947L16.4467 4.73623C16.4174 4.70681 16.3744 4.6992 16.3383 4.71376Z",fill:"currentColor"},null,-1)])])}const T3e=kt({name:"kimi-microscope",render:M3e}),E3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I3e(e,t){return y(),M("svg",E3e,[...t[0]||(t[0]=[C("path",{d:"M6 12C6 12.8283 5.32834 13.5 4.5 13.5C3.67166 13.5 3 12.8283 3 12C3 11.1717 3.67166 10.5 4.5 10.5C5.32834 10.5 6 11.1717 6 12Z",fill:"currentColor"},null,-1),C("path",{d:"M13.5 12C13.5 12.8283 12.8283 13.5 12 13.5C11.1717 13.5 10.5 12.8283 10.5 12C10.5 11.1717 11.1717 10.5 12 10.5C12.8283 10.5 13.5 11.1717 13.5 12Z",fill:"currentColor"},null,-1),C("path",{d:"M19.5002 13.5C20.3287 13.5 21 12.8287 21 12.0002C21 11.1718 20.3287 10.5 19.5002 10.5C18.6718 10.5 18 11.1718 18 12.0002C18 12.8287 18.6718 13.5 19.5002 13.5Z",fill:"currentColor"},null,-1)])])}const L3e=kt({name:"kimi-more",render:I3e}),$3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N3e(e,t){return y(),M("svg",$3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 12.0993C8.49691 12.0993 8.90016 12.5028 8.90039 12.9997V17.9997C8.90039 19.6013 7.60163 20.9001 6 20.9001C4.39837 20.9001 3.09961 19.6013 3.09961 17.9997C3.09984 16.3982 4.39852 15.0993 6 15.0993C6.38939 15.0993 6.76033 15.1778 7.09961 15.317V12.9997C7.09984 12.5028 7.50309 12.0993 8 12.0993ZM6 16.9001C5.39263 16.9001 4.90062 17.3923 4.90039 17.9997C4.90039 18.6072 5.39249 19.0993 6 19.0993C6.60751 19.0993 7.09961 18.6072 7.09961 17.9997C7.09938 17.3923 6.60737 16.9001 6 16.9001Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.627 3.35611C19.8025 3.12106 20.9001 4.02068 20.9004 5.21939V15.9997C20.9004 17.6013 19.6016 18.9001 18 18.9001C16.3984 18.9001 15.0996 17.6013 15.0996 15.9997C15.0998 14.3982 16.3985 13.0993 18 13.0993C18.3894 13.0993 18.7603 13.1778 19.0996 13.317V9.21939C19.0993 9.15657 19.0421 9.10946 18.9805 9.12173L12.6768 10.3825C12.1894 10.4799 11.7148 10.1637 11.6172 9.67642C11.52 9.18922 11.8361 8.71439 12.3232 8.61685L18.627 7.35611C18.7868 7.32415 18.9452 7.31502 19.0996 7.32291V5.21939C19.0993 5.15657 19.0421 5.10946 18.9805 5.12173L12.6768 6.38248C12.1894 6.47994 11.7148 6.16372 11.6172 5.67642C11.52 5.18922 11.8361 4.71439 12.3232 4.61685L18.627 3.35611ZM18 14.9001C17.3926 14.9001 16.9006 15.3923 16.9004 15.9997C16.9004 16.6072 17.3925 17.0993 18 17.0993C18.6075 17.0993 19.0996 16.6072 19.0996 15.9997C19.0994 15.3923 18.6074 14.9001 18 14.9001Z",fill:"currentColor"},null,-1),C("path",{d:"M7.32422 5.38931C7.61669 4.87032 8.38346 4.87015 8.67578 5.38931L8.73047 5.50845L8.89551 5.95376L8.97949 6.1481C9.19937 6.58817 9.57968 6.93145 10.0459 7.10415L10.4912 7.26919C11.127 7.50461 11.1666 8.36217 10.6104 8.67544L10.4912 8.73013L10.0459 8.89517C9.5799 9.06783 9.19939 9.41141 8.97949 9.85123L8.89551 10.0456L8.73047 10.4909C8.49495 11.1267 7.63737 11.1665 7.32422 10.61L7.26953 10.4909L7.10449 10.0456C6.93172 9.57931 6.58767 9.19898 6.14746 8.97916L5.9541 8.89517L5.50879 8.73013C4.83054 8.47903 4.83061 7.52037 5.50879 7.26919L5.9541 7.10415L6.14746 7.02017C6.58757 6.80032 6.93176 6.41995 7.10449 5.95376L7.26953 5.50845L7.32422 5.38931Z",fill:"currentColor"},null,-1)])])}const F3e=kt({name:"kimi-music",render:N3e}),R3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O3e(e,t){return y(),M("svg",R3e,[...t[0]||(t[0]=[C("path",{d:"M17.9551 6.32648C17.955 5.82951 17.5517 5.42706 17.0547 5.42706H15.4844C14.9875 5.42717 14.5851 5.82958 14.585 6.32648V17.6732C14.585 18.1701 14.9874 18.5734 15.4844 18.5735H17.0547C17.5518 18.5735 17.9551 18.1702 17.9551 17.6732V6.32648ZM19.7549 17.6732C19.7549 19.1643 18.5459 20.3734 17.0547 20.3734H15.4844C13.9933 20.3732 12.7842 19.1643 12.7842 17.6732V6.32648C12.7843 4.83546 13.9934 3.62639 15.4844 3.62628H17.0547C18.5458 3.62628 19.7548 4.8354 19.7549 6.32648V17.6732Z",fill:"currentColor"},null,-1),C("path",{d:"M9.41571 6.32648C9.41561 5.82951 9.01231 5.42706 8.51532 5.42706H6.94501C6.44811 5.42717 6.0457 5.82958 6.04559 6.32648V17.6732C6.04559 18.1701 6.44804 18.5734 6.94501 18.5735H8.51532C9.01238 18.5735 9.41571 18.1702 9.41571 17.6732V6.32648ZM11.2155 17.6732C11.2155 19.1643 10.0065 20.3734 8.51532 20.3734H6.94501C5.45393 20.3732 4.24481 19.1643 4.24481 17.6732V6.32648C4.24492 4.83546 5.45399 3.62639 6.94501 3.62628H8.51532C10.0064 3.62628 11.2154 4.8354 11.2155 6.32648V17.6732Z",fill:"currentColor"},null,-1)])])}const P3e=kt({name:"kimi-pause",render:O3e}),D3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B3e(e,t){return y(),M("svg",D3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.0176 4.89998C17.7305 4.89998 17.4552 5.014 17.2522 5.217L6.35429 16.1149C5.957 16.5122 5.67517 17.01 5.53889 17.5551L5.23691 18.763L6.44486 18.4611C6.98994 18.3248 7.48773 18.0429 7.88502 17.6456L18.783 6.74773C18.8834 6.64728 18.9631 6.52797 19.0176 6.39658C19.072 6.26517 19.1 6.12441 19.1 5.98236C19.1 5.84031 19.072 5.69956 19.0176 5.56815C18.9631 5.43676 18.8834 5.31745 18.783 5.217C18.6825 5.11649 18.5631 5.03676 18.4318 4.98237C18.3005 4.92798 18.1597 4.89998 18.0176 4.89998ZM15.9794 3.94421C16.52 3.40366 17.2531 3.09998 18.0176 3.09998C18.3961 3.09998 18.7709 3.17452 19.1207 3.31938C19.4704 3.46424 19.7881 3.67656 20.0558 3.94421C20.3235 4.21192 20.5357 4.52969 20.6805 4.87932C20.8254 5.22895 20.9 5.60375 20.9 5.98236C20.9 6.36098 20.8254 6.73578 20.6805 7.08541C20.5357 7.43504 20.3235 7.75281 20.0558 8.02052L17.6385 10.4378L9.15781 18.9184C8.52984 19.5464 7.74301 19.9919 6.88142 20.2073L4.21828 20.8731C3.91158 20.9498 3.58714 20.8599 3.3636 20.6364C3.14006 20.4128 3.05019 20.0884 3.12686 19.7817L3.79264 17.1185C4.00803 16.257 4.45351 15.4701 5.0815 14.8421L15.9794 3.94421Z",fill:"currentColor"},null,-1)])])}const H3e=kt({name:"kimi-pencil",render:B3e}),z3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W3e(e,t){return y(),M("svg",z3e,[...t[0]||(t[0]=[C("path",{d:"M7.76251 3.10547C8.25776 3.10552 8.74422 3.23849 9.17072 3.49023L19.533 9.60742C20.8536 10.3869 21.2922 12.0901 20.5174 13.4121C20.2785 13.8195 19.9398 14.1604 19.533 14.4004L9.16974 20.5156C7.84721 21.2958 6.14595 20.8511 5.36993 19.5273C5.1196 19.1003 4.98719 18.6142 4.98712 18.1191V5.88672C4.98716 4.3537 6.2273 3.10547 7.76251 3.10547ZM6.7879 18.1191C6.78797 18.2945 6.8343 18.4664 6.92267 18.6172C7.19638 19.0841 7.79336 19.2377 8.25568 18.9648L18.618 12.8496C18.7607 12.7654 18.8803 12.6458 18.9647 12.502C19.2393 12.0334 19.082 11.4311 18.618 11.1572L8.25568 5.04102C8.1061 4.95273 7.93562 4.9063 7.76251 4.90625C7.22703 4.90625 6.78794 5.34218 6.7879 5.88672V18.1191Z",fill:"currentColor"},null,-1)])])}const U3e=kt({name:"kimi-play",render:W3e}),j3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V3e(e,t){return y(),M("svg",j3e,[...t[0]||(t[0]=[C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 3.7998C7.47126 3.7998 3.7998 7.47126 3.7998 12C3.7998 16.5287 7.47126 20.2002 12 20.2002C16.5287 20.2002 20.2002 16.5287 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998Z",fill:"currentColor"},null,-1)])])}const q3e=kt({name:"kimi-question",render:V3e}),K3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z3e(e,t){return y(),M("svg",K3e,[...t[0]||(t[0]=[C("path",{d:"M12 2C13.1046 2 14 2.89543 14 4C14 4.78019 13.552 5.45353 12.9004 5.7832V7H16.5C18.1569 7 19.5 8.34315 19.5 10V17C19.5 18.6051 18.2394 19.9158 16.6543 19.9961L16.5 20H7.5L7.3457 19.9961C5.81166 19.9184 4.58163 18.6883 4.50391 17.1543L4.5 17V10C4.5 8.34315 5.84315 7 7.5 7H11.0996V5.7832C10.448 5.45353 10 4.78019 10 4C10 2.89543 10.8954 2 12 2ZM7.5 8.7998C6.83726 8.7998 6.2998 9.33726 6.2998 10V17C6.2998 17.6627 6.83726 18.2002 7.5 18.2002H16.5C17.1627 18.2002 17.7002 17.6627 17.7002 17V10C17.7002 9.33726 17.1627 8.7998 16.5 8.7998H7.5ZM3 10.7666C3.49706 10.7666 3.90039 11.1699 3.90039 11.667V15C3.90039 15.4971 3.49706 15.9004 3 15.9004C2.50294 15.9004 2.09961 15.4971 2.09961 15V11.667C2.09961 11.1699 2.50294 10.7666 3 10.7666ZM21 10.7666C21.4971 10.7666 21.9004 11.1699 21.9004 11.667V15C21.9004 15.4971 21.4971 15.9004 21 15.9004C20.5029 15.9004 20.0996 15.4971 20.0996 15V11.667C20.0996 11.1699 20.5029 10.7666 21 10.7666ZM9.5 11.0996C9.99706 11.0996 10.4004 11.5029 10.4004 12V14.5C10.4004 14.9971 9.99706 15.4004 9.5 15.4004C9.00294 15.4004 8.59961 14.9971 8.59961 14.5V12C8.59961 11.5029 9.00294 11.0996 9.5 11.0996ZM14.5 11.0996C14.9971 11.0996 15.4004 11.5029 15.4004 12V14.5C15.4004 14.9971 14.9971 15.4004 14.5 15.4004C14.0029 15.4004 13.5996 14.9971 13.5996 14.5V12C13.5996 11.5029 14.0029 11.0996 14.5 11.0996ZM12 3.5C11.7239 3.5 11.5 3.72386 11.5 4C11.5 4.27614 11.7239 4.5 12 4.5C12.2761 4.5 12.5 4.27614 12.5 4C12.5 3.72386 12.2761 3.5 12 3.5Z",fill:"currentColor"},null,-1)])])}const G3e=kt({name:"kimi-robot",render:Z3e}),Y3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X3e(e,t){return y(),M("svg",Y3e,[...t[0]||(t[0]=[C("path",{d:"M11.5 3C16.1944 3 20 6.80558 20 11.5C20 13.523 19.2933 15.381 18.1132 16.8404L21.1364 19.8636C21.4879 20.2151 21.4879 20.7849 21.1364 21.1364C20.7849 21.4879 20.2151 21.4879 19.8636 21.1364L16.8404 18.1132C15.381 19.2933 13.523 20 11.5 20C6.80558 20 3 16.1944 3 11.5C3 6.80558 6.80558 3 11.5 3ZM11.5 18.2C15.2003 18.2 18.2 15.2003 18.2 11.5C18.2 7.79969 15.2003 4.8 11.5 4.8C7.79969 4.8 4.8 7.79969 4.8 11.5C4.8 15.2003 7.79969 18.2 11.5 18.2Z",fill:"currentColor"},null,-1)])])}const J3e=kt({name:"kimi-search",render:X3e}),Q3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e8e(e,t){return y(),M("svg",Q3e,[...t[0]||(t[0]=[C("path",{d:"M16.5364 10.1636C16.8879 10.5151 16.8879 11.0849 16.5364 11.4364C16.1849 11.7879 15.6151 11.7879 15.2636 11.4364L12.9 9.07281V17.1C12.9 17.597 12.4971 18 12 18C11.503 18 11.1 17.597 11.1 17.1V9.07281L8.73641 11.4364C8.38494 11.7879 7.81509 11.7879 7.46362 11.4364C7.11214 11.0849 7.11214 10.5151 7.46362 10.1636L11.3636 6.2636C11.7151 5.91211 12.2849 5.91211 12.6364 6.2636L16.5364 10.1636Z",fill:"currentColor"},null,-1)])])}const t8e=kt({name:"kimi-send",render:e8e}),n8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o8e(e,t){return y(),M("svg",n8e,[...t[0]||(t[0]=[C("path",{d:"M16.0404 12C16.0404 9.76874 14.2313 7.9596 12.0001 7.9596C9.76883 7.9596 7.95972 9.76874 7.95972 12C7.95972 14.2313 9.76883 16.0404 12.0001 16.0404C14.2313 16.0404 16.0404 14.2313 16.0404 12ZM14.2222 12C14.2222 13.2271 13.2271 14.2222 12 14.2222C10.7729 14.2222 9.77783 13.2271 9.77783 12C9.77783 10.7729 10.7729 9.77778 12 9.77778C13.2271 9.77778 14.2222 10.7729 14.2222 12Z",fill:"currentColor"},null,-1),C("path",{d:"M9.91145 21.8009C9.29001 21.6797 8.76914 21.2612 8.50632 20.6922L8.07372 19.7556C7.88838 19.3544 7.43553 19.1048 6.95371 19.1549L5.89572 19.2647C5.2733 19.3293 4.64823 19.114 4.22298 18.6611C3.74343 18.1504 3.32454 17.6037 2.97033 17.0181C2.61571 16.4318 2.32839 15.8106 2.10407 15.1566C1.89769 14.5549 2.02148 13.8954 2.4089 13.3902L3.0376 12.5704C3.30043 12.2277 3.30042 11.7722 3.03758 11.4295L2.40413 10.6035C2.01474 10.0958 1.891 9.43198 2.10208 8.82826C2.55037 7.54612 3.27017 6.35997 4.22 5.34259C4.64518 4.8872 5.27275 4.67067 5.89701 4.73544L6.95383 4.84514C7.43561 4.89515 7.88844 4.6456 8.07377 4.24441L8.50266 3.31593C8.76494 2.74818 9.28448 2.33019 9.90423 2.20761C11.2916 1.9332 12.7148 1.93127 14.0885 2.19913C14.7099 2.32029 15.2308 2.73881 15.4937 3.3078L15.9263 4.24441C16.1116 4.6456 16.5644 4.89514 17.0462 4.84514L18.1043 4.73532C18.7267 4.67072 19.3518 4.88603 19.777 5.33886C20.2566 5.84953 20.6755 6.3963 21.0297 6.98193C21.3843 7.56823 21.6716 8.18942 21.8959 8.84339C22.1023 9.44509 21.9785 10.1046 21.5911 10.6098L20.9624 11.4295C20.6996 11.7722 20.6996 12.2278 20.9624 12.5705L21.5959 13.3964C21.9853 13.9042 22.109 14.568 21.8979 15.1717C21.4497 16.4538 20.7299 17.6399 19.7801 18.6573C19.3549 19.1128 18.7273 19.3294 18.103 19.2646L17.0462 19.1549C16.5645 19.1049 16.1116 19.3544 15.9263 19.7556L15.4974 20.6841C15.2351 21.2518 14.7156 21.6698 14.0958 21.7924C12.7083 22.0668 11.2852 22.0687 9.91145 21.8009ZM13.7432 20.0088C13.7844 20.0006 13.8259 19.9673 13.847 19.9216L14.2758 18.9931C14.7915 17.8768 15.9886 17.2171 17.2341 17.3464L18.2909 17.4561C18.3649 17.4638 18.4272 17.4423 18.4512 17.4166C19.2296 16.5828 19.8171 15.6146 20.1817 14.5716C20.1845 14.5636 20.1796 14.5373 20.1532 14.5029L19.5198 13.677C18.7564 12.6815 18.7564 11.3185 19.5198 10.323L20.1485 9.5033C20.1746 9.46927 20.1795 9.4429 20.1762 9.43327C19.9932 8.89965 19.7603 8.39623 19.4741 7.92293C19.1873 7.4489 18.846 7.00333 18.4517 6.58351C18.4272 6.55739 18.3656 6.53616 18.2921 6.54378L17.234 6.65361C15.9886 6.78287 14.7915 6.12317 14.2758 5.00689L13.8432 4.07027C13.822 4.02448 13.7811 3.9916 13.7406 3.98371C12.5983 3.76097 11.4132 3.76258 10.2571 3.99124C10.2158 3.99941 10.1744 4.03271 10.1533 4.07842L9.72441 5.00689C9.20875 6.12317 8.01164 6.7829 6.76619 6.6536L5.70942 6.54391C5.63535 6.53623 5.573 6.55774 5.54905 6.5834C4.77067 7.41713 4.18312 8.38534 3.81845 9.42835C3.81564 9.43637 3.82054 9.46265 3.84693 9.49706L4.48038 10.323C5.24381 11.3185 5.24383 12.6815 4.48041 13.6769L3.85171 14.4967C3.82561 14.5307 3.82066 14.5571 3.82396 14.5667C4.00701 15.1004 4.23986 15.6038 4.52613 16.0771C4.81284 16.5511 5.15421 16.9967 5.54845 17.4165C5.57298 17.4426 5.63461 17.4638 5.70811 17.4562L6.76608 17.3464C8.01157 17.2171 9.20871 17.8768 9.72438 18.9932L10.157 19.9297C10.1781 19.9755 10.2191 20.0084 10.2595 20.0163C11.4018 20.239 12.587 20.2374 13.7432 20.0088Z",fill:"currentColor"},null,-1)])])}const s8e=kt({name:"kimi-setting",render:o8e}),i8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function r8e(e,t){return y(),M("svg",i8e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1)])])}const l8e=kt({name:"kimi-shield-question",render:r8e}),a8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function u8e(e,t){return y(),M("svg",a8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.90005 12C2.90005 11.503 3.303 11.1 3.80005 11.1H12.2939L9.38588 8.19197C9.03441 7.8405 9.03441 7.27065 9.38588 6.91918C9.73735 6.56771 10.3072 6.56771 10.6587 6.91918L15.1031 11.3636C15.2719 11.5324 15.3667 11.7613 15.3667 12C15.3667 12.2387 15.2719 12.4676 15.1031 12.6364L10.6587 17.0809C10.3072 17.4323 9.73735 17.4323 9.38588 17.0809C9.03441 16.7294 9.03441 16.1595 9.38588 15.8081L12.2939 12.9H3.80005C3.303 12.9 2.90005 12.4971 2.90005 12ZM13.5874 20C13.5874 19.503 13.9904 19.1 14.4874 19.1H18.043C18.2758 19.1 18.4991 19.0075 18.6637 18.8429C18.8283 18.6783 18.9208 18.455 18.9208 18.2222V5.7778C18.9208 5.545 18.8283 5.32174 18.6637 5.15712C18.499 4.9925 18.2758 4.90002 18.043 4.90002H14.4874C13.9904 4.90002 13.5874 4.49708 13.5874 4.00002C13.5874 3.50297 13.9904 3.10003 14.4874 3.10003H18.043C18.7532 3.10003 19.4343 3.38215 19.9365 3.88433C20.4386 4.38651 20.7208 5.06761 20.7208 5.7778V18.2222C20.7208 18.9324 20.4386 19.6135 19.9365 20.1157C19.4343 20.6179 18.7532 20.9 18.043 20.9H14.4874C13.9904 20.9 13.5874 20.4971 13.5874 20Z",fill:"currentColor"},null,-1)])])}const c8e=kt({name:"kimi-sign-in",render:u8e}),d8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f8e(e,t){return y(),M("svg",d8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20.6364 11.3636C20.9879 11.7151 20.9879 12.2849 20.6364 12.6364L16.1919 17.0808C15.8405 17.4323 15.2706 17.4323 14.9192 17.0808C14.5677 16.7293 14.5677 16.1595 14.9192 15.808L17.8272 12.9H9.33333C8.83627 12.9 8.43333 12.497 8.43333 12C8.43333 11.5029 8.83627 11.1 9.33333 11.1H17.8272L14.9192 8.19193C14.5677 7.84046 14.5677 7.27061 14.9192 6.91914C15.2706 6.56766 15.8405 6.56766 16.1919 6.91914L20.6364 11.3636ZM10.2333 3.99998C10.2333 4.49703 9.83038 4.89998 9.33333 4.89998H5.77777C5.54497 4.89998 5.3217 4.99246 5.15709 5.15707C4.99247 5.32169 4.89999 5.54495 4.89999 5.77775V18.2222C4.89999 18.455 4.99247 18.6783 5.15709 18.8429C5.32171 19.0075 5.54497 19.1 5.77777 19.1H9.33333C9.83038 19.1 10.2333 19.5029 10.2333 20C10.2333 20.497 9.83038 20.9 9.33333 20.9H5.77777C5.06758 20.9 4.38648 20.6179 3.8843 20.1157C3.38212 19.6135 3.09999 18.9324 3.09999 18.2222V5.77775C3.09999 5.06756 3.38212 4.38646 3.8843 3.88428C4.38648 3.3821 5.06758 3.09998 5.77777 3.09998H9.33333C9.83038 3.09998 10.2333 3.50292 10.2333 3.99998Z",fill:"currentColor"},null,-1)])])}const p8e=kt({name:"kimi-sign-out",render:f8e}),h8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m8e(e,t){return y(),M("svg",h8e,[...t[0]||(t[0]=[iu('',9)])])}const g8e=kt({name:"kimi-sliders",render:m8e}),v8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y8e(e,t){return y(),M("svg",v8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.78027 8.90405C7.5 9.45411 7.5 10.1742 7.5 11.6144V12.3856C7.5 13.8258 7.5 14.5459 7.78027 15.096C8.02681 15.5798 8.42019 15.9732 8.90405 16.2197C9.45411 16.5 10.1742 16.5 11.6144 16.5H12.3856C13.8258 16.5 14.5459 16.5 15.096 16.2197C15.5798 15.9732 15.9732 15.5798 16.2197 15.096C16.5 14.5459 16.5 13.8258 16.5 12.3856V11.6144C16.5 10.1742 16.5 9.45411 16.2197 8.90405C15.9732 8.42019 15.5798 8.02681 15.096 7.78027C14.5459 7.5 13.8258 7.5 12.3856 7.5H11.6144C10.1742 7.5 9.45411 7.5 8.90405 7.78027C8.42019 8.02681 8.02681 8.42019 7.78027 8.90405Z",fill:"currentColor"},null,-1)])])}const k8e=kt({name:"kimi-stop",render:y8e}),b8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C8e(e,t){return y(),M("svg",b8e,[...t[0]||(t[0]=[C("path",{d:"M7.01562 3.41459C7.4446 3.16449 7.9954 3.30924 8.24609 3.73784C8.49645 4.167 8.35189 4.71868 7.92285 4.96928C5.51497 6.37506 3.90054 8.98498 3.90039 11.9703C3.90076 16.4435 7.52672 20.0699 12 20.0699C16.4733 20.0699 20.0992 16.4435 20.0996 11.9703C20.0996 11.2291 20 10.5116 19.8145 9.83159C19.6838 9.35222 19.967 8.85702 20.4463 8.72612C20.9256 8.59541 21.4207 8.87778 21.5518 9.35698C21.7792 10.1901 21.9004 11.0674 21.9004 11.9703C21.9 17.4376 17.4674 21.8697 12 21.8697C6.53261 21.8697 2.09998 17.4376 2.09961 11.9703C2.09976 8.31904 4.07782 5.12972 7.01562 3.41459ZM8.39258 8.24077C8.75015 7.89591 9.3199 7.90591 9.66504 8.26323C10.01 8.62076 9.99985 9.19051 9.64258 9.53569C9.00203 10.1541 8.60558 11.02 8.60547 11.979C8.60584 13.8536 10.1253 15.3736 12 15.3736C13.8746 15.3735 15.3942 13.8536 15.3945 11.979C15.3945 11.6847 15.3577 11.3989 15.2881 11.1285C15.1646 10.6474 15.4536 10.1568 15.9346 10.0328C16.4158 9.9089 16.9071 10.1991 17.0312 10.6802C17.1383 11.096 17.1943 11.5321 17.1943 11.979C17.194 14.8477 14.8688 17.1733 12 17.1734C9.1312 17.1734 6.80506 14.8478 6.80469 11.979C6.8048 10.5117 7.41519 9.18431 8.39258 8.24077ZM11.5459 1.12651C11.8216 0.965605 12.1631 0.963306 12.4414 1.11967L19.1953 4.91752C19.4859 5.08108 19.662 5.39277 19.6533 5.72612C19.6443 6.05972 19.4515 6.36154 19.1523 6.50932L12.9004 9.5933V12.2583C12.9004 12.7554 12.4971 13.1587 12 13.1587C11.5029 13.1587 11.0996 12.7554 11.0996 12.2583V1.90385C11.0999 1.58444 11.2702 1.2878 11.5459 1.12651ZM12.9004 7.58549L16.8252 5.64897L12.9004 3.44194V7.58549Z",fill:"currentColor"},null,-1)])])}const w8e=kt({name:"kimi-target",render:C8e}),_8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x8e(e,t){return y(),M("svg",_8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.9893 6.60743C20.5897 6.60757 21.8877 7.8926 21.8877 9.47736C21.8877 10.7416 21.0607 11.8129 19.9141 12.1955V14.257C19.914 15.8428 18.6152 17.1288 17.0137 17.1289H12.8438V20.1381C12.8437 20.6301 12.4412 21.0293 11.9443 21.0296C11.4473 21.0296 11.044 20.6302 11.0439 20.1381V16.4356C11.0441 15.8343 11.5363 15.3461 12.1436 15.3458H17.0137C17.6211 15.3457 18.1133 14.8585 18.1133 14.257V12.2129C16.9408 11.8451 16.0909 10.7598 16.0908 9.47736C16.0908 7.89251 17.3887 6.60743 18.9893 6.60743ZM18.9893 8.38953C18.3828 8.38953 17.8906 8.87684 17.8906 9.47736C17.8907 10.0778 18.3828 10.5642 18.9893 10.5642C19.5956 10.5641 20.0869 10.0777 20.0869 9.47736C20.0869 8.87693 19.5956 8.38967 18.9893 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.89844 6.60743C6.49899 6.60747 7.79688 7.89254 7.79688 9.47736C7.79684 10.7388 6.97371 11.8078 5.83105 12.1926V14.4021C5.83105 15.0036 6.32315 15.4918 6.93066 15.4918H8.37109C8.86789 15.492 9.27038 15.8905 9.27051 16.3824C9.27051 16.8744 8.86797 17.2737 8.37109 17.2739H6.93066C5.32904 17.2739 4.03027 15.9879 4.03027 14.4021V12.2158C2.85382 11.8504 2.00004 10.7627 2 9.47736C2 7.89251 3.29784 6.60743 4.89844 6.60743ZM4.89844 8.38953C4.29196 8.38953 3.7998 8.87684 3.7998 9.47736C3.79985 10.0778 4.29198 10.5642 4.89844 10.5642C5.50485 10.5642 5.99605 10.0778 5.99609 9.47736C5.99609 8.87687 5.50488 8.38958 4.89844 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.9434 2.9707C13.5439 2.97075 14.8418 4.25581 14.8418 5.84063C14.8418 7.11413 14.0035 8.1923 12.8438 8.56745V13.0135C12.8436 13.5056 12.4403 13.9041 11.9434 13.9041C11.4466 13.9039 11.0431 13.5055 11.043 13.0135V8.56745C9.8836 8.19209 9.04496 7.11387 9.04492 5.84063C9.04492 4.25592 10.343 2.97093 11.9434 2.9707ZM11.9434 4.75281C11.3371 4.75303 10.8447 5.24026 10.8447 5.84063C10.8448 6.44097 11.3371 6.92726 11.9434 6.92749C12.5498 6.92745 13.041 6.44108 13.041 5.84063C13.041 5.24014 12.5498 4.75285 11.9434 4.75281Z",fill:"currentColor"},null,-1)])])}const S8e=kt({name:"kimi-task",render:x8e}),A8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M8e(e,t){return y(),M("svg",A8e,[...t[0]||(t[0]=[C("path",{d:"M16.5293 15.0596C16.9496 15.1021 17.2772 15.4572 17.2773 15.8887C17.2773 16.3202 16.9497 16.6753 16.5293 16.7178L16.4443 16.7217H12C11.5399 16.7216 11.167 16.3488 11.167 15.8887C11.1671 15.4286 11.54 15.0558 12 15.0557H16.4443L16.5293 15.0596Z",fill:"currentColor"},null,-1),C("path",{d:"M6.96582 7.52246C7.27077 7.21751 7.75375 7.1983 8.08105 7.46484L8.14453 7.52246L10.8232 10.2002C11.5102 10.8872 11.5102 12.0014 10.8232 12.6885L8.14453 15.3672L8.08105 15.4248C7.75377 15.6913 7.27075 15.6721 6.96582 15.3672C6.66114 15.0621 6.64234 14.5791 6.90918 14.252L6.96582 14.1885L9.64453 11.5098C9.68057 11.4736 9.68062 11.415 9.64453 11.3789L6.96582 8.7002C6.64116 8.37488 6.6411 7.84774 6.96582 7.52246Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 3.09961C19.1539 3.09966 20.9004 4.84612 20.9004 7V17C20.9004 19.1539 19.1539 20.9003 17 20.9004H7C4.84609 20.9004 3.09961 19.1539 3.09961 17V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H17ZM7 4.90039C5.8402 4.90039 4.90039 5.8402 4.90039 7V17C4.90039 18.1598 5.8402 19.0996 7 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V7C19.0996 5.84024 18.1598 4.90044 17 4.90039H7Z",fill:"currentColor"},null,-1)])])}const T8e=kt({name:"kimi-terminal",render:M8e}),E8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I8e(e,t){return y(),M("svg",E8e,[...t[0]||(t[0]=[C("path",{d:"M16.9971 3.90597C15.9799 2.99725 14.7342 2.38312 13.394 2.12966C12.0538 1.8762 10.6699 1.99301 9.39111 2.46751C8.11236 2.94202 6.98721 3.75626 6.13676 4.82261C5.2863 5.88896 4.74274 7.16703 4.56457 8.5193C4.40455 9.70501 4.53253 10.9118 4.93767 12.0376C5.34281 13.1634 6.01318 14.175 6.89207 14.9868C7.43557 15.4634 7.87413 16.0477 8.17997 16.7027C8.48581 17.3577 8.65224 18.0691 8.66873 18.7918V18.926C8.66962 19.7412 8.99387 20.5229 9.57035 21.0993C10.1468 21.6758 10.9285 22.0001 11.7437 22.001H12.2604C13.0757 22.0001 13.8573 21.6758 14.4338 21.0993C15.0103 20.5229 15.3345 19.7412 15.3354 18.926V18.4685C15.3479 17.8297 15.4982 17.2011 15.7761 16.6258C16.0539 16.0505 16.4528 15.542 16.9454 15.1351C17.7442 14.4355 18.3853 13.5741 18.826 12.608C19.2668 11.642 19.4973 10.5932 19.5022 9.53136C19.5071 8.46948 19.2863 7.41869 18.8544 6.4486C18.4225 5.4785 17.7894 4.61125 16.9971 3.9043V3.90597ZM12.2604 20.3343H11.7437C11.3704 20.3339 11.0124 20.1853 10.7484 19.9213C10.4844 19.6573 10.3358 19.2993 10.3354 18.926C10.3354 18.926 10.3296 18.7093 10.3287 18.6676H13.6687V18.926C13.6683 19.2993 13.5198 19.6573 13.2558 19.9213C12.9917 20.1853 12.6338 20.3339 12.2604 20.3343ZM15.8437 13.8835C14.8949 14.7064 14.2097 15.7908 13.8737 17.001H12.8354V11.0143C13.3212 10.8426 13.742 10.5249 14.0403 10.1049C14.3387 9.68482 14.4999 9.18285 14.5021 8.66763C14.5021 8.44662 14.4143 8.23466 14.258 8.07838C14.1017 7.9221 13.8897 7.8343 13.6687 7.8343C13.4477 7.8343 13.2358 7.9221 13.0795 8.07838C12.9232 8.23466 12.8354 8.44662 12.8354 8.66763C12.8354 8.88865 12.7476 9.10061 12.5913 9.25689C12.435 9.41317 12.2231 9.50097 12.0021 9.50097C11.7811 9.50097 11.5691 9.41317 11.4128 9.25689C11.2565 9.10061 11.1687 8.88865 11.1687 8.66763C11.1687 8.44662 11.0809 8.23466 10.9247 8.07838C10.7684 7.9221 10.5564 7.8343 10.3354 7.8343C10.1144 7.8343 9.90242 7.9221 9.74614 8.07838C9.58986 8.23466 9.50207 8.44662 9.50207 8.66763C9.5042 9.18285 9.66547 9.68482 9.96381 10.1049C10.2621 10.5249 10.683 10.8426 11.1687 11.0143V17.001H10.0671C9.69123 15.7586 8.98633 14.6411 8.02707 13.7668C7.21286 13.0081 6.63267 12.0324 6.35496 10.9547C6.07725 9.87703 6.1136 8.7424 6.45974 7.68471C6.80588 6.62702 7.44735 5.69042 8.30846 4.98543C9.16956 4.28045 10.2144 3.83649 11.3196 3.70597C11.5487 3.68039 11.779 3.66759 12.0096 3.66763C13.4409 3.66338 14.8226 4.19149 15.8862 5.1493C16.5026 5.69896 16.9952 6.37337 17.3312 7.12782C17.6672 7.88227 17.839 8.69952 17.8352 9.5254C17.8314 10.3513 17.6522 11.1669 17.3092 11.9183C16.9663 12.6696 16.4677 13.3395 15.8462 13.8835H15.8437Z",fill:"currentColor"},null,-1)])])}const L8e=kt({name:"kimi-thinking",render:I8e}),$8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N8e(e,t){return y(),M("svg",$8e,[...t[0]||(t[0]=[iu('',6)])])}const F8e=kt({name:"kimi-todo",render:N8e}),R8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O8e(e,t){return y(),M("svg",R8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.09752 2.19507C8.5421 1.97278 9.08271 2.15298 9.305 2.59756L10.0562 4.10005H13.5C13.9971 4.10005 14.4 4.50299 14.4 5.00005C14.4 5.49711 13.9971 5.90005 13.5 5.90005H12.3106C12.2556 6.2319 12.1667 6.64073 12.0226 7.0987C11.7254 8.04355 11.191 9.20402 10.2334 10.3239C11.4166 11.196 12.5606 11.7524 13.4512 12.0987C13.978 12.3036 14.4136 12.434 14.7124 12.5122L14.7348 12.5181L15.695 10.5976C15.8475 10.2927 16.1591 10.1 16.5 10.1C16.8409 10.1 17.1525 10.2927 17.305 10.5976L20.7969 17.5814L20.8044 17.5959L20.8137 17.615L21.805 19.5976C22.0273 20.0421 21.8471 20.5827 21.4025 20.805C20.9579 21.0273 20.4173 20.8471 20.195 20.4025L19.4438 18.9H13.5562L12.805 20.4025C12.5827 20.8471 12.0421 21.0273 11.5975 20.805C11.1529 20.5827 10.9727 20.0421 11.195 19.5976L12.1863 17.615C12.1917 17.6036 12.1973 17.5924 12.2031 17.5814L13.9146 14.1583C13.6034 14.0667 13.2256 13.9423 12.7988 13.7764C11.7294 13.3605 10.3442 12.6802 8.92538 11.5924C7.79753 12.5167 6.69473 13.0764 5.83285 13.4112C5.33899 13.603 4.92286 13.7216 4.62401 13.7931C4.47449 13.8288 4.35399 13.8529 4.26741 13.8684C4.2241 13.8762 4.18924 13.8818 4.16343 13.8858L4.13156 13.8904L4.12084 13.8919L4.11682 13.8924L4.11514 13.8927C4.11514 13.8927 4.11368 13.8928 4.00001 13L4.11368 13.8928C3.62061 13.9556 3.17 13.6068 3.10722 13.1137C3.0446 12.6219 3.39148 12.1723 3.88256 12.1077L3.94947 12.0967C4.00428 12.0869 4.09114 12.0698 4.20543 12.0424C4.43422 11.9877 4.77156 11.8924 5.18106 11.7334C5.84103 11.477 6.68484 11.0564 7.56458 10.3753C7.15054 9.93496 6.78945 9.48388 6.50421 9.10102C6.26672 8.78224 6.07517 8.50172 5.94227 8.29973C5.87571 8.19858 5.82359 8.11671 5.78748 8.05909C5.76942 8.03027 5.75535 8.00749 5.74545 7.99135L5.73377 7.9722L5.73032 7.96651L5.72864 7.96371C5.71133 7.9349 5.69582 7.9055 5.68208 7.87566C5.49265 7.46416 5.6393 6.96717 6.03659 6.72853C6.09037 6.69623 6.14617 6.6702 6.20315 6.65023C6.59739 6.51205 7.04758 6.66421 7.27129 7.03623L7.27266 7.0385L7.28001 7.05054C7.28695 7.06186 7.29793 7.07964 7.31274 7.10328C7.34239 7.15059 7.38731 7.2212 7.44595 7.31032C7.56343 7.48886 7.73484 7.73997 7.94765 8.02562C8.21085 8.37889 8.52772 8.77187 8.8756 9.14201C9.64226 8.24147 10.0681 7.3133 10.3056 6.55854C10.381 6.3186 10.4372 6.09683 10.4791 5.90005H9.51951C9.50696 5.90031 9.49442 5.90031 9.48191 5.90005H4.00001C3.50296 5.90005 3.10001 5.49711 3.10001 5.00005C3.10001 4.50299 3.50296 4.10005 4.00001 4.10005H8.04378L7.69503 3.40254C7.67314 3.35877 7.65516 3.31407 7.64094 3.26883C7.51078 2.8546 7.69671 2.39547 8.09752 2.19507ZM16.5 13.0125L18.5438 17.1H14.4562L16.5 13.0125Z",fill:"currentColor"},null,-1),C("path",{d:"M15.1 4.00007C15.1 3.50301 15.5029 3.10007 16 3.10007H18C19.6016 3.10007 20.9 4.39844 20.9 6.00007V8.00007C20.9 8.49712 20.497 8.90007 20 8.90007C19.5029 8.90007 19.1 8.49712 19.1 8.00007V6.00007C19.1 5.39255 18.6075 4.90007 18 4.90007H16C15.5029 4.90007 15.1 4.49712 15.1 4.00007Z",fill:"currentColor"},null,-1),C("path",{d:"M3.99998 15.1001C4.49703 15.1001 4.89998 15.503 4.89998 16.0001V18.0001C4.89998 18.6076 5.39246 19.1001 5.99998 19.1001H7.99998C8.49703 19.1001 8.89998 19.503 8.89998 20.0001C8.89998 20.4971 8.49703 20.9001 7.99998 20.9001H5.99998C4.39835 20.9001 3.09998 19.6017 3.09998 18.0001V16.0001C3.09998 15.503 3.50292 15.1001 3.99998 15.1001Z",fill:"currentColor"},null,-1)])])}const P8e=kt({name:"kimi-translate",render:O8e}),D8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B8e(e,t){return y(),M("svg",D8e,[...t[0]||(t[0]=[C("path",{d:"M8.10001 3C8.10001 2.50294 8.50295 2.1 9.00001 2.1H15C15.4971 2.1 15.9 2.50294 15.9 3C15.9 3.49706 15.4971 3.9 15 3.9H9.00001C8.50295 3.9 8.10001 3.49706 8.10001 3Z",fill:"currentColor"},null,-1),C("path",{d:"M10 15.9C9.50295 15.9 9.10001 15.4971 9.10001 15L9.10001 10C9.10001 9.50294 9.50295 9.1 10 9.1C10.4971 9.1 10.9 9.50294 10.9 10L10.9 15C10.9 15.4971 10.4971 15.9 10 15.9Z",fill:"currentColor"},null,-1),C("path",{d:"M13.1 15C13.1 15.4971 13.5029 15.9 14 15.9C14.4971 15.9 14.9 15.4971 14.9 15L14.9 10C14.9 9.50294 14.4971 9.1 14 9.1C13.5029 9.1 13.1 9.50294 13.1 10V15Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.10001 6C2.10001 5.50294 2.50295 5.1 3.00001 5.1H4.99152C4.99785 5.09993 5.00417 5.09993 5.01048 5.1H18.9895C18.9958 5.09993 19.0021 5.09993 19.0085 5.1H21C21.4971 5.1 21.9 5.50294 21.9 6C21.9 6.49706 21.4971 6.9 21 6.9H19.8281L18.8448 18.6993C18.7412 19.9432 17.7013 20.9 16.4531 20.9H7.54686C6.29865 20.9 5.25881 19.9432 5.15515 18.6993L4.17188 6.9H3.00001C2.50295 6.9 2.10001 6.49706 2.10001 6ZM5.97811 6.9L18.0219 6.9L17.0511 18.5498C17.0251 18.8608 16.7652 19.1 16.4531 19.1H7.54686C7.23481 19.1 6.97485 18.8608 6.94893 18.5498L5.97811 6.9Z",fill:"currentColor"},null,-1)])])}const H8e=kt({name:"kimi-trash",render:B8e}),z8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W8e(e,t){return y(),M("svg",z8e,[...t[0]||(t[0]=[C("path",{d:"M7.36336 3.3634C7.71483 3.01192 8.28533 3.01192 8.6368 3.3634C8.98817 3.71488 8.98824 4.2854 8.6368 4.63683L6.17391 7.09972H15.0001C18.2585 7.09977 20.9005 9.74166 20.9005 13.0001C20.9004 16.2585 18.2585 18.9005 15.0001 18.9005H7.00008C6.50307 18.9005 6.09976 18.4971 6.09969 18.0001C6.09969 17.5031 6.50302 17.0997 7.00008 17.0997H15.0001C17.2644 17.0997 19.0996 15.2644 19.0997 13.0001C19.0997 10.7358 17.2644 8.90055 15.0001 8.90051H6.17391L8.6368 11.3634L8.69832 11.4318C8.98668 11.7853 8.96632 12.3073 8.6368 12.6368C8.30728 12.9663 7.78521 12.9867 7.43172 12.6984L7.36336 12.6368L3.36336 8.63683C3.33098 8.60445 3.30286 8.56908 3.27645 8.53332C3.25597 8.50559 3.23607 8.47741 3.21883 8.44738C3.20492 8.42311 3.19221 8.39837 3.18074 8.37316C3.1764 8.36365 3.17109 8.35453 3.16707 8.34484C3.1627 8.33427 3.1593 8.32331 3.15535 8.31261C3.12946 8.24274 3.11237 8.16872 3.10457 8.09191C3.09258 7.97426 3.10262 7.85446 3.1368 7.74035C3.14281 7.72035 3.15094 7.70114 3.15828 7.68176C3.16165 7.67283 3.16341 7.66325 3.16707 7.65441C3.17216 7.64216 3.17806 7.63025 3.18367 7.61828C3.19055 7.60356 3.19744 7.58874 3.20516 7.57433C3.24709 7.49624 3.3012 7.42556 3.36336 7.3634L7.36336 3.3634Z",fill:"currentColor"},null,-1)])])}const U8e=kt({name:"kimi-undo",render:W8e}),j8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V8e(e,t){return y(),M("svg",j8e,[...t[0]||(t[0]=[C("path",{d:"M11.9997 12.8779C16.0197 12.878 19.4393 15.3848 20.7048 18.8828C21.0812 19.9234 20.2782 20.8962 19.2038 21.0137L18.9861 21.0264H5.0134L4.79562 21.0137C3.7213 20.8961 2.91743 19.9233 3.29367 18.8828C4.55905 15.3847 7.9797 12.8781 11.9997 12.8779ZM11.9997 14.6777C8.84467 14.6779 6.17462 16.5794 5.09152 19.2256H18.9079C17.8248 16.5793 15.1549 14.6778 11.9997 14.6777ZM12.2312 3.00586C14.6088 3.1264 16.4997 5.09239 16.4997 7.5L16.4939 7.73145C16.3734 10.1091 14.4073 11.9999 11.9997 12C9.59225 11.9998 7.62604 10.109 7.50558 7.73145L7.49973 7.5C7.49973 5.01485 9.51462 3.00021 11.9997 3L12.2312 3.00586ZM11.9997 4.7998C10.5087 4.80001 9.29953 6.00896 9.29953 7.5C9.29953 8.99104 10.5087 10.2 11.9997 10.2002C13.4908 10.2001 14.6999 8.99112 14.6999 7.5C14.6999 6.00888 13.4908 4.79989 11.9997 4.7998Z",fill:"currentColor"},null,-1)])])}const q8e=kt({name:"kimi-user",render:V8e}),K8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z8e(e,t){return y(),M("svg",K8e,[...t[0]||(t[0]=[C("path",{d:"M11.9996 7C11.5026 7 11.0996 7.36985 11.0996 7.82609V14.1739C11.0996 14.6301 11.5026 15 11.9996 15C12.4967 15 12.8996 14.6301 12.8996 14.1739V7.82609C12.8996 7.36985 12.4967 7 11.9996 7Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8996 17.1006C12.8996 17.5974 12.4968 18.001 11.9992 18.001C11.5024 18.001 11.0996 17.5974 11.0996 17.1006C11.0996 16.6038 11.5024 16.2002 11.9992 16.2002C12.4968 16.2002 12.8996 16.6038 12.8996 17.1006Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.5108 3.5501C13.3946 1.61676 10.6041 1.61676 9.48786 3.5501L1.69363 17.0501C0.577423 18.9834 1.97269 21.4001 4.20511 21.4001H19.7936C22.026 21.4001 23.4212 18.9834 22.305 17.0501L14.5108 3.5501ZM11.0467 4.4501C11.4701 3.71676 12.5286 3.71676 12.952 4.4501L20.7462 17.9501C21.1696 18.6834 20.6403 19.6001 19.7936 19.6001H4.20511C3.35833 19.6001 2.82909 18.6834 3.25248 17.9501L11.0467 4.4501Z",fill:"currentColor"},null,-1)])])}const G8e=kt({name:"kimi-warning",render:Z8e}),Y8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function X8e(e,t){return y(),M("svg",Y8e,[...t[0]||(t[0]=[C("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[C("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm11-2v16"}),C("path",{d:"m9 10l2 2l-2 2"})],-1)])])}const J8e=kt({name:"tabler-layout-sidebar-right-collapse",render:X8e}),Q8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eye(e,t){return y(),M("svg",Q8e,[...t[0]||(t[0]=[C("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"},null,-1)])])}const tye=kt({name:"tabler-paperclip",render:eye}),nye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function oye(e,t){return y(),M("svg",nye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"},null,-1)])])}const sye=kt({name:"ri-braces-line",render:oye}),iye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rye(e,t){return y(),M("svg",iye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"},null,-1)])])}const lye=kt({name:"ri-calendar-close-line",render:rye}),aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function uye(e,t){return y(),M("svg",aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"},null,-1)])])}const cye=kt({name:"ri-calendar-schedule-line",render:uye}),dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fye(e,t){return y(),M("svg",dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"},null,-1)])])}const pye=kt({name:"ri-calendar-todo-line",render:fye}),hye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function mye(e,t){return y(),M("svg",hye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"},null,-1)])])}const gye=kt({name:"ri-code-line",render:mye}),vye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yye(e,t){return y(),M("svg",vye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-4-7h8a4 4 0 0 1-8 0m0-2a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m8 0a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3"},null,-1)])])}const kye=kt({name:"ri-emotion-line",render:yye}),bye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cye(e,t){return y(),M("svg",bye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"},null,-1)])])}const wye=kt({name:"ri-external-link-line",render:Cye}),_ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xye(e,t){return y(),M("svg",_ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 3c5.392 0 9.878 3.88 10.819 9c-.94 5.12-5.427 9-10.819 9s-9.878-3.88-10.818-9C2.122 6.88 6.608 3 12 3m0 16a9.005 9.005 0 0 0 8.778-7a9.005 9.005 0 0 0-17.555 0A9.005 9.005 0 0 0 12 19m0-2.5a4.5 4.5 0 1 1 0-9a4.5 4.5 0 0 1 0 9m0-2a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5"},null,-1)])])}const Sye=kt({name:"ri-eye-line",render:xye}),Aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mye(e,t){return y(),M("svg",Aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M17.883 19.297A10.95 10.95 0 0 1 12 21c-5.392 0-9.878-3.88-10.818-9A11 11 0 0 1 4.52 5.935L1.394 2.808l1.414-1.414l19.799 19.798l-1.414 1.415zM5.936 7.35A8.97 8.97 0 0 0 3.223 12a9.005 9.005 0 0 0 13.201 5.838l-2.028-2.028A4.5 4.5 0 0 1 8.19 9.604zm6.978 6.978l-3.242-3.241a2.5 2.5 0 0 0 3.241 3.241m7.893 2.265l-1.431-1.431A8.9 8.9 0 0 0 20.778 12A9.005 9.005 0 0 0 9.552 5.338L7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.95 10.95 0 0 1-2.012 4.593m-9.084-9.084Q11.86 7.5 12 7.5a4.5 4.5 0 0 1 4.492 4.778z"},null,-1)])])}const Tye=kt({name:"ri-eye-off-line",render:Mye}),Eye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Iye(e,t){return y(),M("svg",Eye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"},null,-1)])])}const Lye=kt({name:"ri-file-add-line",render:Iye}),$ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nye(e,t){return y(),M("svg",$ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"},null,-1)])])}const Fye=kt({name:"ri-flashlight-line",render:Nye}),Rye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Oye(e,t){return y(),M("svg",Rye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])}const Pye=kt({name:"ri-folder-fill",render:Oye}),Dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bye(e,t){return y(),M("svg",Dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"},null,-1)])])}const Hye=kt({name:"ri-git-fork-line",render:Bye}),zye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wye(e,t){return y(),M("svg",zye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"},null,-1)])])}const Uye=kt({name:"ri-git-pull-request-line",render:Wye}),jye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vye(e,t){return y(),M("svg",jye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M2 18h7v2H2zm0-7h9v2H2zm0-7h20v2H2zm18.674 9.025l1.156-.391l1 1.732l-.916.805a4 4 0 0 1 0 1.658l.916.805l-1 1.732l-1.156-.391a4 4 0 0 1-1.435.83L19 21h-2l-.24-1.196a4 4 0 0 1-1.434-.83l-1.156.392l-1-1.732l.916-.805a4 4 0 0 1 0-1.658l-.916-.805l1-1.732l1.156.391c.41-.37.898-.655 1.435-.83L17 11h2l.24 1.196a4 4 0 0 1 1.434.83M18 18a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const qye=kt({name:"ri-list-settings-line",render:Vye}),Kye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zye(e,t){return y(),M("svg",Kye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8v2h5V9a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H8v6h5v-1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H7a1 1 0 0 1-1-1V8H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm9 16h-4v2h4zm0-8h-4v2h4zM9 4H5v2h4z"},null,-1)])])}const Gye=kt({name:"ri-node-tree",render:Zye}),Yye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xye(e,t){return y(),M("svg",Yye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m13.827 1.69l8.486 8.485l-1.415 1.414l-.707-.707l-4.242 4.243l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243l1.414-1.414l3.536-.707l4.242-4.243l-.707-.707zm.707 3.536l-4.67 4.67l-2.822.565l6.5 6.5l.564-2.822l4.671-4.67z"},null,-1)])])}const Jye=kt({name:"ri-pushpin-line",render:Xye}),Qye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function e5e(e,t){return y(),M("svg",Qye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"},null,-1)])])}const t5e=kt({name:"ri-sort-desc",render:e5e}),n5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o5e(e,t){return y(),M("svg",n5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"},null,-1)])])}const s5e=kt({name:"ri-star-fill",render:o5e}),i5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function r5e(e,t){return y(),M("svg",i5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"},null,-1)])])}const l5e=kt({name:"ri-star-line",render:r5e}),a5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function u5e(e,t){return y(),M("svg",a5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"},null,-1)])])}const c5e=kt({name:"ri-tools-line",render:u5e}),d5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function f5e(e,t){return y(),M("svg",d5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m20.97 17.172l-1.414 1.414l-3.535-3.535l-.073.074l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243L5.34 8.761l3.536-.707l.073-.074l-3.536-3.536L6.828 3.03zM10.365 9.394l-.502.502l-2.822.565l6.5 6.5l.564-2.822l.502-.502zm8.411.074l-1.34 1.34l1.414 1.415l1.34-1.34l.707.707l1.415-1.415l-8.486-8.485l-1.414 1.414l.707.707l-1.34 1.34l1.414 1.415l1.34-1.34z"},null,-1)])])}const p5e=kt({name:"ri-unpin-line",render:f5e}),h5e=` +`):null,He=se===1&&Ce>=0&&J.slice(Ce+1).every(ut=>ut.role!=="user"),vt=He?e.sessions.find(ut=>ut.id===xe):void 0;if(He&&(e.messagesBySession={...e.messagesBySession,[xe]:J.slice(0,Ce)},vt!==void 0)){const ut={...vt};delete ut.lastTurnReason,f(ut)}try{return await _t().undoSession(xe,se),await g(xe),{text:$e}}catch(ut){return He&&(e.messagesBySession={...e.messagesBySession,[xe]:J},vt!==void 0&&f(vt),await g(xe).catch(()=>{})),l("undo",ut,{sessionId:xe}),null}}function Xt(se){const xe=e.activeSessionId;if(!xe)return;const J=e.queuedBySession[xe]??[];if(se<0||se>=J.length)return;const Ce=[...J];Ce.splice(se,1),e.queuedBySession={...e.queuedBySession,[xe]:Ce}}function gs(se,xe){const J=e.activeSessionId;if(!J)return;const Ce=e.queuedBySession[J]??[];if(se===xe||se<0||se>=Ce.length||xe<0||xe>=Ce.length)return;const $e=[...Ce],[He]=$e.splice(se,1);He!==void 0&&($e.splice(xe,0,He),e.queuedBySession={...e.queuedBySession,[J]:$e})}async function di(se){const xe=e.activeSessionId;if(!xe)return[];try{return(await _t().listDirectory(xe,{path:se,includeGitStatus:!0})).items}catch{return[]}}async function Ei(se){const xe=e.activeSessionId;if(!xe)return null;try{const Ce=await _t().readFile(xe,{path:se});return{path:Ce.path,content:Ce.content,encoding:Ce.encoding,mime:Ce.mime,languageId:Ce.languageId,isBinary:Ce.isBinary,size:Ce.size,lineCount:Ce.lineCount}}catch(J){if(gl("[kimi-web] readFileContent failed for",se,J),Us(J)&&J.code===Ghe)throw J;return null}}async function ao(se){return _t().readHostFileContent(se)}const Gi=10485760;function Er(se){const xe=e.activeSessionId;return xe?_t().getFileDownloadUrl(xe,se):null}async function fi(se,xe){const J=e.activeSessionId;if(!J)return!1;try{return await _t().openFile(J,{path:se,line:xe}),!0}catch(Ce){return l("openFile",Ce,{sessionId:J}),!1}}async function Ll(se){const xe=e.activeSessionId;if(!xe)return;const J=$.value.cwd||".";try{await _t().openInApp(xe,se,J)}catch(Ce){l("openInApp",Ce,{sessionId:xe})}}async function zo(se){const xe=e.activeSessionId;if(!xe)return!1;try{return await _t().revealFile(xe,{path:se}),!0}catch(J){return l("revealFile",J,{sessionId:xe}),!1}}function Ir(se){return se.startsWith("/")||/^[a-zA-Z]:[\\/]/.test(se)||se.startsWith("\\\\")}async function Qs(se){if(/^(https?:|data:|blob:)/i.test(se))return se;const xe=e.activeSessionId;if(!xe)return se;let J=se;if(Ir(J)){const Ce=e.sessions.find(He=>He.id===xe)?.cwd,$e=Ce?h2(J,Ce):null;if($e)J=$e;else try{const He=await ao(J);return!He.isBinary||He.encoding!=="base64"?se:`data:${He.mime};base64,${He.content}`}catch{return se}}try{const $e=await _t().readFile(xe,{path:J,length:Gi});return!$e.isBinary||$e.encoding!=="base64"||$e.truncated?se:`data:${$e.mime};base64,${$e.content}`}catch{return se}}async function pi(se){const xe=e.sessions.find(Ce=>Ce.id===e.activeSessionId),J=xe===void 0?e.activeWorkspaceId:B(xe);if(!J)return[];try{return(await _t().searchFiles(J,{query:se,limit:20})).items.map(He=>({path:He.path,name:He.name}))}catch{return[]}}return{loadFileDiff:we,clearFileDiff:ge,loadGitStatus:Q,checkAuth:Se,probeManagedMembership:ue,loadConfig:_e,updateConfig:Ee,listAllSessionsGlobal:Oe,load:gt,refreshServerMeta:Lt,loadWorkspaces:wn,loadMoreSessions:Yt,loadAllSessions:Ue,ensureFlatSessions:Mn,loadMoreFlatSessions:We,selectWorkspace:go,openWorkspace:qt,upsertWorkspacePreserveOrder:ps,applyWorkspaceEvent:xs,clearActiveSession:_n,openWorkspaceDraft:In,startSessionAndSendPrompt:lo,startSessionAndActivateSkill:St,startSessionAndOpenSideChat:hs,addWorkspaceByPath:Jo,browseFs:uo,getFsHome:Ys,writeSessionUrl:Nn,fetchSessionIntoList:no,onSessionRoutePopState:Xs,bindSessionRoute:Oo,selectSession:vo,submitPromptInternal:Po,finishPromptLocal:Ct,localTurnStartState:sme,isLocalTurnSnapshotCurrent:rme,afterLocalTurnStartsSettle:lme,handleSessionSnapshot:Qt,sendPrompt:co,steerPrompt:Tn,uploadImage:fo,enqueue:Qe,unqueue:Xt,reorderQueue:gs,abortCurrentPrompt:kn,respondApproval:bo,respondQuestion:Ns,dismissQuestion:Do,pendingQuestionActions:Hu,pendingApprovalActions:Lh,cancelTask:Io,setPlanMode:Qo,togglePlanMode:sn,setSwarmMode:es,toggleSwarmMode:ms,setGoalMode:Tr,toggleGoalMode:ts,createGoal:Ki,controlGoal:Js,setPermission:Bo,dismissWarning:Zo,renameSession:Il,renameWorkspace:Zi,deleteWorkspace:tl,archiveSession:Ho,exportSession:Co,restoreSession:Fs,loadArchivedSessions:Rs,logout:yo,compact:ht,forkSession:Le,undo:Ze,listDir:di,readFileContent:Ei,readHostFileContent:ao,getFileDownloadUrl:Er,openWorkspaceFile:fi,openInApp:Ll,revealWorkspaceFile:zo,resolveImageUrl:Qs,searchFiles:pi,loadOlderMessages:Y,refreshSessionSidecars:fe,isStartingFirstPrompt:()=>cl.size>0}}const tN=cn.starredModels,Bx=new Error("profile persist failed");function ume(){try{const e=ui(tN);if(!e)return[];const t=JSON.parse(e);if(Array.isArray(t)&&t.every(n=>typeof n=="string"))return t}catch{}return[]}function cme(e){try{Ls(tN,JSON.stringify(e))}catch{}}function dme(e,t){const{pushOperationFailure:n,refreshSessionStatus:o,persistSessionProfile:s,activity:i,updateSession:r,updateSessionMessages:l,loadConfig:a,checkAuth:u}=t,c=Z([]),d=Z(ume()),f=Z({}),h=Z({}),m=Z([]),v=Z(null);function k(pe){if(!(pe==null||pe.length===0))return c.value.find(ve=>ve.id===pe)??c.value.find(ve=>ve.model===pe)}function w(){const pe=e.activeSessionId?e.sessions.find(oe=>oe.id===e.activeSessionId):void 0,ve=pe===void 0?v.value??e.defaultModel:pe.model||e.defaultModel;return k(ve)?.id??ve??void 0}function b(pe){if(pe===void 0)return;const ve=k(pe);return ve===void 0?void 0:bp(ve)}function _(pe,ve){const oe=pe==null?void 0:e.thinkingBySession[pe];return oe!==void 0&&gJ(ve,oe)?oe:bp(ve)}function g(pe,ve){if(ve===void 0)return;const oe=k(ve);return oe===void 0?void 0:_(pe,oe)}async function x(pe,ve){return pe!=null&&e.thinkingBySession[pe]===void 0&&await o(pe),g(pe,ve)}function S(pe){e.thinking=pe;const ve=e.activeSessionId;return pe!==void 0&&ve!==null&&ve!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:pe},k3(e,ve)),pe}Je([()=>e.activeSessionId,()=>w(),()=>{const pe=e.activeSessionId;return pe==null?void 0:e.thinkingBySession[pe]}],()=>{const pe=k(w());pe!==void 0&&(e.thinking=_(e.activeSessionId,pe))});function T(pe){_t().setConfig({thinking:vJ(pe,k(w())?.supportEfforts)}).catch(ve=>n("setConfig",ve))}async function A(pe){try{const oe=await _t().listSkills(pe);f.value={...f.value,[pe]:oe}}catch{}}async function E(pe){try{const oe=await _t().listSkillsForWorkspace(pe);h.value={...h.value,[pe]:oe}}catch{}}async function P(){try{const pe=_t();c.value=await pe.listModels();const ve=k(w());ve!==void 0&&(e.thinking=_(e.activeSessionId,ve))}catch(pe){n("loadModels",pe)}}async function D(){try{const pe=_t();m.value=await pe.listProviders()}catch(pe){n("loadProviders",pe)}}async function I(pe){const ve=e.activeSessionId,oe=k(pe),ye=e.thinking,G=ve?e.sessions.find(ge=>ge.id===ve)?.model:void 0,Y=w()!==(oe?.id??pe),fe=yJ(oe,ye,Y);if(!ve)return v.value=pe,e.thinking=fe,fe!==ye&&fe!==void 0&&T(fe),!0;r(ve,ge=>({...ge,model:pe}));let we;fe!==ye&&(e.thinking=fe,fe!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:fe},we=k3(e,ve)));try{await _t().updateSession(ve,{model:pe,thinking:fe!==ye?fe:void 0})}catch(ge){return r(ve,Q=>({...Q,model:G??Q.model})),fe!==ye&&(e.thinking=ye,ye!==void 0&&(e.thinkingBySession={...e.thinkingBySession,[ve]:ye}),vl(e,ve,we)&&o(ve)),n("setModel",ge,{sessionId:ve}),!1}return fe!==ye&&fe!==void 0&&T(fe),vl(e,ve,we),await o(ve),!0}function $(pe){const ve=new Set(d.value);ve.has(pe)?ve.delete(pe):ve.add(pe),d.value=Array.from(ve),cme(d.value)}async function B(pe,ve,oe,ye,G){const Y=ye??e.activeSessionId;if(!Y)return;const fe=i.value==="idle"&&!e.inFlightBySession[Y],we=`msg_skill_opt_${Date.now().toString(36)}`,ge=fe?y8(Y):void 0;if(fe){e.inFlightBySession={...e.inFlightBySession,[Y]:!0};const Q={id:we,sessionId:Y,role:"user",content:[{type:"text",text:`/${pe}${ve?` ${ve}`:""}`},...m8(oe)],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0,origin:{kind:"skill_activation",trigger:"user-slash",skillName:pe,skillArgs:ve}}};l(Y,te=>[...te,Q])}try{if(G?.skipThinkingPersist!==!0){const Q=e.sessions.find(ue=>ue.id===Y)?.model,te=(Q&&Q.length>0?Q:e.defaultModel)??void 0;if(!await s({thinking:await x(Y,te)??e.thinking},Y))throw Bx}await _t().activateSkill(Y,pe,ve,m8(oe))}catch(Q){fe&&(e.inFlightBySession={...e.inFlightBySession,[Y]:!1},l(Y,te=>te.filter(ce=>ce.id!==we))),Q!==Bx&&n("activateSkill",Q,{sessionId:Y})}finally{ge!==void 0&&k8(Y,ge)}}async function H(pe){return _t().getProvider(pe)}async function O(pe){try{return await _t().addProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: addProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function F(pe,ve){try{return await _t().updateProvider(pe,ve),await Promise.all([D(),P(),a()]),null}catch(oe){return Xl("[kimi-web] operation failed: updateProvider",oe),oe instanceof Error?oe.message:String(oe)}}async function U(pe){try{const oe=await _t().deleteProvider(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return n("deleteProvider",ve),null}}async function z(pe){try{const ve=await _t().refreshProvider(pe);for(const oe of ve.failed)n("refreshProvider",new Error(oe.reason),{message:oe.provider});await Promise.all([D(),P(),a()])}catch(ve){n("refreshProvider",ve)}}async function W(){try{const pe=await _t().refreshAllProviders();for(const ve of pe.failed)n("refreshAllProviders",new Error(ve.reason),{message:ve.provider});await Promise.all([D(),P(),a()])}catch(pe){n("refreshAllProviders",pe)}}async function K(){try{return{kind:"ok",items:await _t().listCatalogProviders()}}catch(pe){return pe instanceof wd&&pe.code===void 0?{kind:"unsupported"}:(Xl("[kimi-web] operation failed: loadCatalogProviders",pe),{kind:"error"})}}async function V(pe){try{return await _t().importCatalogProvider(pe),await Promise.all([D(),P(),a()]),await u(),null}catch(ve){return Xl("[kimi-web] operation failed: importCatalogProvider",ve),ve instanceof Error?ve.message:String(ve)}}async function ie(pe){try{const oe=await _t().importCustomRegistry(pe);return await Promise.all([D(),P(),a()]),await u(),oe}catch(ve){return Xl("[kimi-web] operation failed: importCustomRegistry",ve),ve instanceof Error?ve.message:String(ve)}}async function ne(){try{return await _t().startOAuthLogin()}catch{return null}}async function X(){try{return await _t().pollOAuthLogin()}catch(pe){return gl("[kimi-web] pollOAuthLogin failed",pe),null}}async function le(){try{await _t().cancelOAuthLogin()}catch{}}async function Ie(){try{return await _t().getUsage()}catch(pe){return{kind:"error",message:pe instanceof Error?pe.message:String(pe)}}}function de(pe){const ve=S(pe);s({thinking:ve}),ve!==void 0&&T(ve)}return{models:c,starredModelIds:d,providers:m,draftModel:v,skillsBySession:f,skillsByWorkspace:h,loadSkillsForSession:A,loadSkillsForWorkspace:E,loadModels:P,loadProviders:D,setModel:I,thinkingLevelForModelId:b,thinkingLevelForSessionId:g,resolveThinkingForPrompt:x,toggleStarModel:$,activateSkill:B,addProvider:O,updateProvider:F,deleteProvider:U,getProvider:H,loadCatalogProviders:K,importCatalogProvider:V,importCustomRegistry:ie,refreshProvider:z,refreshAllProviders:W,startOAuthLogin:ne,pollOAuthLogin:X,cancelOAuthLogin:le,getUsage:Ie,setThinking:de}}function fme(e,t){const{pushOperationFailure:n,nextOptimisticMsgId:o,connectEventsIfNeeded:s,getEventConn:i,resolveThinkingForPrompt:r,refreshSessionStatus:l}=t,a=Z({}),u=R(()=>{const O=e.activeSessionId;if(!O)return null;const F=a.value[O];return F?{parentId:O,agentId:F.agentId}:null}),c=R(()=>u.value?.parentId??null),d=R(()=>u.value!==null),f=R(()=>{const O=u.value;return O?!!e.sideChatSendingByAgent[O.agentId]:!1}),h=R(()=>{const O=u.value;return O?e.sideChatSendingByAgent[O.agentId]?!0:(e.tasksBySession[O.parentId]??[]).some(F=>F.id===O.agentId&&F.status==="running"):!1}),m=O=>_t().getFileUrl(O),v=[],k=KT(),w=R(()=>{const O=u.value;return O?k({messages:e.sideChatMessagesByAgent[O.agentId]??[],approvals:v,getFileUrl:m,sessionActive:h.value}):[]});function b(O,F){e.sideChatMessagesByAgent[O]=F(e.sideChatMessagesByAgent[O]??[])}function _(O,F){b(O,U=>[...U,F])}function g(O,F){b(O,U=>{const z=U.find(W=>W.id===F);return z?.promptId!==void 0||z?.userMessageId!==void 0?U:U.filter(W=>W.id!==F)})}function x(O,F){const U=e.sideChatUserMessageIdsBySession[O]??[];U.includes(F)||(e.sideChatUserMessageIdsBySession={...e.sideChatUserMessageIdsBySession,[O]:[...U,F]})}function S(O,F,U,z){b(O,W=>{const K=W.findIndex(X=>X.id===F);if(K===-1)return W;const V=W.findIndex((X,le)=>le!==K&&X.role==="user"&&(X.id===z||X.userMessageId===z||X.promptId===U)),ie=W[K],ne=V===-1?ie:W[V];return W.flatMap((X,le)=>le===V?[]:le!==K?[X]:[{...ne,id:ie.id,promptId:U,userMessageId:z,metadata:{...ne.metadata,...ie.metadata}}])})}function T(O,F){x(F.sessionId,F.userMessageId??F.id),b(O,U=>{const z=U.findIndex(V=>V.role==="user"&&(V.userMessageId===(F.userMessageId??F.id)||V.promptId!==void 0&&V.promptId===F.promptId));if(z===-1)return[...U,F];const W=U[z],K=[...U];return K[z]={...F,id:W.id,promptId:F.promptId??W.promptId,userMessageId:F.userMessageId??F.id,metadata:{...F.metadata,...W.metadata}},K})}function A(O,F,U){U&&b(O,z=>{const W=z.at(-1);if(W?.role==="assistant"){const K=W.content[0],V=K?.type==="text"?K.text:"";return[...z.slice(0,-1),{...W,content:[{type:"text",text:`${V}${U}`}]}]}return[...z,{id:o(),sessionId:F,role:"assistant",content:[{type:"text",text:U}],createdAt:new Date().toISOString()}]})}function E(O,F,U){if(e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[O]:!1},!U)return;const W=(e.sideChatMessagesByAgent[O]??[]).at(-1);(W?.role==="assistant"&&W.content[0]?.type==="text"?W.content[0].text:"").trim().length>0||A(O,F,U)}async function P(O){const F=e.activeSessionId;F&&await D(F,O)}async function D(O,F){if(!a.value[O]){let U;try{({agentId:U}=await _t().startBtw(O))}catch(z){n("openSideChat",z,{sessionId:O});return}e.sideChatMessagesByAgent={...e.sideChatMessagesByAgent,[U]:e.sideChatMessagesByAgent[U]??[]},a.value={...a.value,[O]:{agentId:U}},s(),i()?.markSideChannelAgent(O,U)}F&&F.trim()&&await I(O,F.trim())}async function I(O,F){const U=a.value[O],z=F.trim();if(!U||!z)return;const W=O,K=U.agentId;e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!0};const V=o(),ie={id:V,sessionId:W,role:"user",content:[{type:"text",text:z}],createdAt:new Date().toISOString(),metadata:{"kimiWeb.optimisticUserMessage":!0}};_(K,ie);let ne;try{const X=e.sessions.find(pe=>pe.id===W),le=(X?.model&&X.model.length>0?X.model:e.defaultModel)??void 0,Ie=await r(W,le)??e.thinking;ne=e.pendingThinkingBySession[W];const de=await _t().submitPrompt(W,{content:[{type:"text",text:z}],agentId:K,model:le,thinking:Ie,permissionMode:e.permission,planMode:e.planModeBySession[W]??!1,swarmMode:e.swarmModeBySession[W]??!1});Ie!==void 0&&vl(e,W,ne),S(K,V,de.promptId,de.userMessageId),x(W,de.userMessageId)}catch(X){vl(e,W,ne)&&l(W),n("sendSideChatPrompt",X,{sessionId:W}),g(K,V),e.sideChatSendingByAgent={...e.sideChatSendingByAgent,[K]:!1}}}function $(){const O=e.activeSessionId;if(!O)return;const{[O]:F,...U}=a.value;a.value=U}async function B(O){const F=u.value;F&&await I(F.parentId,O)}function H(O){if(!a.value[O])return;const{[O]:F,...U}=a.value;a.value=U}return{sideChatTargetBySession:a,sideChatSessionId:c,sideChatVisible:d,sideChatSending:f,sideChatRunning:h,sideChatTurns:w,appendSideChatAssistantText:A,finishSideChatAgent:E,reconcileSideChatUserMessage:T,openSideChat:P,openSideChatOn:D,closeSideChat:$,sendSideChatPrompt:B,clearSideChatForSession:H}}class pme{transcript;sessionId;agentId;fetchPage;pageSize;onChange;onGap;refreshPromise=null;buffered=[];agents_=[];seq_;loadingOlder_=!1;loadOlderError_=!1;refreshError_=!1;constructor(t){this.sessionId=t.sessionId,this.agentId=t.agentId,this.transcript=new tj(t.agentId),this.fetchPage=t.fetchPage,this.pageSize=t.pageSize??20,this.onChange=t.onChange,this.onGap=t.onGap}get snapshot(){return this.transcript.snapshot()}get seq(){return this.seq_}get agents(){return this.agents_}get loading(){return this.refreshPromise!==null}get loadingOlder(){return this.loadingOlder_}get loadOlderError(){return this.loadOlderError_}get refreshError(){return this.refreshError_}refresh(){if(this.refreshPromise!==null)return this.refreshPromise;this.refreshError_=!1;const t=this.fetchPage({pageSize:this.pageSize}).then(n=>this.applyPage(n,!0)).catch(n=>{throw this.refreshError_=!0,n}).finally(()=>{this.refreshPromise=null;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()});return this.refreshPromise=t,this.onChange?.(),t}receiveReset(t,n){this.transcript.receive([{op:"reset",agentId:this.agentId,snapshot:t}]),n!==void 0&&(this.seq_=n),this.refreshError_=!1,this.onChange?.()}applyOps(t,n){if(this.refreshPromise!==null||this.loadingOlder_)return this.buffered.push({ops:t,...n!==void 0?{seq:n}:{}}),!1;if(n!==void 0&&this.seq_!==void 0){if(n<=this.seq_)return!0;if(n!==this.seq_+1)return this.onGap?.(),!1}const o=this.transcript.apply(t);return n!==void 0&&(this.seq_=n),o.gap!==void 0&&this.onGap?.(),o.accepted.length>0&&this.onChange?.(),o.gap===void 0}async loadOlder(){if(!this.snapshot.hasMoreOlder||this.loadingOlder_)return;const t=this.snapshot.items.find(n=>n.kind==="turn");if(t?.kind==="turn"){this.loadingOlder_=!0,this.loadOlderError_=!1,this.onChange?.();try{const n=await this.fetchPage({beforeTurn:t.turnId,pageSize:this.pageSize});this.applyPage(n,!1)}catch(n){throw this.loadOlderError_=!0,n}finally{this.loadingOlder_=!1;const n=this.buffered;this.buffered=[];for(const o of n)this.applyOps(o.ops,o.seq);this.onChange?.()}}}applyPage(t,n){this.agents_=t.agents;const o=this.snapshot,s=n?t:{...t,items:hme(t.items,o.items),hasMoreOlder:t.hasMoreOlder};this.receiveReset(s,n?t.seq:void 0)}}function hme(e,t){const n=new Set,o=[];for(const s of[...e,...t]){const i=s.kind==="turn"?s.turnId:s.kind==="marker"?s.markerId:s.refId;n.has(i)||(n.add(i),o.push(s))}return o}function mme(e){const t=qS(new Map),n=new Map,o=new Map,s=new Set;let i=null,r=null;function l(){i!==null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(i),i=null),r!==null&&(clearTimeout(r),r=null);for(const _ of s)_.version.value+=1;s.clear()}function a(_){s.add(_),!(i!==null||r!==null)&&(typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(l)),r=setTimeout(l,50))}function u(_,g){return`${_}\0${g}`}function c(_,g,x){const S=e.getEventConnection();S!==null&&(S.subscribeTranscript(_,g,x),o.set(_,g))}function d(_,g){const x=u(_,g),S=t.get(x);if(S!==void 0)return S;const T={channel:new pme({sessionId:_,agentId:g,fetchPage:A=>e.api.getSessionTranscript(_,{...A,agentId:g}),onChange:()=>{a(T)},onGap:()=>{f(T)}}),version:Z(0),baselineLoaded:!1,resumePromise:null};return t.set(x,T),T}async function f(_){if(_.resumePromise!==null)return _.resumePromise;const g=h(_).finally(()=>{_.resumePromise===g&&(_.resumePromise=null)});return _.resumePromise=g,g}async function h(_){try{await _.channel.refresh(),_.baselineLoaded=!0,n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId,_.channel.seq)}catch{n.get(_.channel.sessionId)===_.channel.agentId&&c(_.channel.sessionId,_.channel.agentId)}}function m(_,g){e.connectEventsIfNeeded(),n.set(_,g);const x=d(_,g);return x.baselineLoaded?c(_,g,x.channel.seq):f(x),x}function v(_,g){if(n.get(_)!==g)return;n.delete(_);const x=o.get(_);x!==void 0&&(e.getEventConnection()?.unsubscribeTranscript(_,[x]),o.delete(_))}function k(_,g,x,S){if(n.get(_)!==g)return;const T=d(_,g);T.channel.receiveReset(x,S),T.baselineLoaded=!0}function w(_,g,x,S){return n.get(_)!==g?!0:d(_,g).channel.applyOps(x,S)}function b(_){n.delete(_),o.delete(_)&&e.getEventConnection()?.unsubscribeTranscript(_);for(const[g,x]of t)x.channel.sessionId===_&&(t.delete(g),s.delete(x))}return{getEntry:(_,g)=>t.get(u(_,g)),activate:m,deactivate:v,receiveReset:k,applyOps:w,forgetSession:b}}const $h=XT(),Da=phe(),nN=cn.permission,oN=cn.activeWorkspace,sN=cn.planMode,iN=cn.swarmMode,rN=cn.goalMode,Hx=40401,Ag=cn.onboarded;ur(cn.codeFont);ur(cn.accent);ur(cn.theme);ur(cn.thinking);ur(cn.notifyOnComplete);ur(cn.notifyOnQuestion);ur(cn.notifyOnApproval);ur(cn.soundOnComplete);function gme(){try{const e=ui(nN);if(e==="auto"||e==="yolo"||e==="manual")return e}catch{}return"manual"}function vme(e){try{Ls(nN,e)}catch{}}function b4(e){const t=ui(e);if(!t)return{};try{const n=JSON.parse(t);if(!n||typeof n!="object"||Array.isArray(n))return{};const o={};for(const[s,i]of Object.entries(n))i===!0&&(o[s]=!0);return o}catch{return{}}}function P5(e,t){try{const n={};for(const[o,s]of Object.entries(t))s&&(n[o]=!0);Ls(e,JSON.stringify(n))}catch{}}function lN(){P5(sN,Me.planModeBySession)}function aN(){P5(iN,Me.swarmModeBySession)}function uN(){P5(rN,Me.goalModeBySession)}function yme(){try{return ui(oN)}catch{return null}}const cN=cn.hiddenWorkspaces;function kme(){try{const e=ui(cN);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(n=>typeof n=="string"):[]}catch{return[]}}function bme(e){try{Ls(cN,JSON.stringify(e))}catch{}}function Cme(e){try{Ls(oN,e)}catch{}}function wme(e,t){if(t&&e.startsWith(t)){const o=e.slice(t.length);return o?`~${o}`:"~"}const n=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)?$/);return n?`~${n[1]??""}`:e}const Me=Go({...oY(),connected:!1,serverVersion:"",dangerousBypassAuth:!1,backend:"v1",experimentalFlags:{},workspaceName:"kimi-web",connection:"disconnected",permission:gme(),thinking:void 0,thinkingBySession:{},pendingThinkingBySession:{},planModeBySession:b4(sN),swarmModeBySession:b4(iN),goalModeBySession:b4(rN),loading:!1,sessionLoading:!1,queuedBySession:{},gitStatusBySession:{},promptIdBySession:{},inFlightBySession:{},unreadBySession:Ey(),authReady:!1,defaultModel:null,managedProviderStatus:null,managedUserInfo:null,managedMembership:null,workspaces:[],activeWorkspaceId:yme(),fsHome:null,recentRoots:[],hiddenWorkspaceRoots:kme(),availableOpenInApps:[],config:null,sideChatMessagesByAgent:{},sideChatSendingByAgent:{},sideChatUserMessageIdsBySession:{},messagesLoadingMoreBySession:{},messagesHasMoreBySession:{},messagesLoadMoreErrorBySession:{},sessionsHasMoreByWorkspace:{},sessionsLoadingMoreByWorkspace:{},sessionsCursorByWorkspace:{},sessionsInitialCountByWorkspace:{},sessionsFullyLoaded:!1,flatSessionsNextPageToken:null,flatSessionsHasMore:!0,flatSessionsLoading:!1,flatSessionsLoadingMore:!1,flatSessionsSeeded:!1,flatSessionsFrontier:null}),Mg=Go({}),np=new Map,If=new Map;function _me(e,t){return`${e}\0${t??"*"}`}async function b8(e,t){const n=_me(e,t),o=(np.get(n)??0)+1;np.set(n,o),t!==void 0&&If.set(e,(If.get(e)??0)+1);const s=If.get(e)??0;try{const i=await _t().getSessionPlans(e,{agentId:"main",toolCallId:t});if(np.get(n)!==o||t===void 0&&(If.get(e)??0)!==s||!Me.sessions.some(l=>l.id===e))return;const r=Object.fromEntries(i.map(l=>[l.toolCallId,l]));Mg[e]=t===void 0?r:{...Mg[e],...r}}catch(i){gl("[refreshSessionPlans] plan history unavailable for",e,i)}}function xme(e){const t=`${e}\0`;for(const n of np.keys())n.startsWith(t)&&np.delete(n);If.delete(e),delete Mg[e]}const F2=Go({planMode:!1,swarmMode:!1,goalMode:!1});function D5(e){Me.sessions=e}function R2(e,t){Me.sessions=Me.sessions.map(n=>n.id===e?t(n):n)}function Sme(e){Me.sessions=[e,...Me.sessions.filter(t=>t.id!==e.id)]}function Ame(e){Me.sessions=[...Me.sessions,e]}function Mme(e){Me.sessions=Me.sessions.filter(t=>t.id!==e)}function dN(){const e=Me.activeSessionId;e&&Me.unreadBySession[e]&&typeof document<"u"&&document.visibilityState==="visible"&&(Me.unreadBySession[e]=!1,Iy({[e]:!1}))}typeof window<"u"&&window.addEventListener("storage",e=>{e.key===cn.unread&&(Me.unreadBySession=Ey(),dN())});function C8(){if(rr===null||!rr.health().stale)return;bi("ws:stale-reconnect",{sessionId:Me.activeSessionId,status:"stale"}),D0e("ws: stale socket on focus, reconnecting",{activeSessionId:Me.activeSessionId}),rr.reconnect();const e=Me.activeSessionId;e&&Lg.request(e)}typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&(dN(),C8())});typeof window<"u"&&(window.addEventListener("focus",C8),window.addEventListener("online",C8));function B5(e){Me.activeSessionId=e}function Tme(e){Ni(Me.messagesBySession,e)}function Eme(e,t){Me.messagesBySession[e]=t}function fN(e,t){Me.messagesBySession[e]=t(Me.messagesBySession[e]??[])}function Ime(e){delete Me.messagesBySession[e]}function pN(e){rr?.unsubscribe(e),Tg.forgetSession(e),ege(e),Gd.discard(({meta:t})=>t.sessionId===e),Mme(e),Ime(e),xme(e),delete Me.approvalsBySession[e],delete Me.questionsBySession[e],delete Me.tasksBySession[e],delete Me.goalBySession[e],delete Me.gitStatusBySession[e],delete Me.lastSeqBySession[e],delete Me.compactionBySession[e],delete Me.messagesLoadingMoreBySession[e],delete Me.messagesHasMoreBySession[e],delete Me.messagesLoadMoreErrorBySession[e],delete w8[e],Ig.delete(e),um.delete(e),MN.delete(e),ime(e),delete Me.queuedBySession[e],delete Me.promptIdBySession[e],delete Me.inFlightBySession[e],delete Me.turnActiveBySession[e],delete Me.turnEndedPromptIdBySession[e],delete Me.turnErrorBySession[e],delete Me.turnRetryBySession[e],delete Me.planModeBySession[e],delete Me.swarmModeBySession[e],delete Me.goalModeBySession[e],delete Me.thinkingBySession[e],delete Me.pendingThinkingBySession[e],lN(),aN(),uN(),Yo.value.includes(e)&&(Yo.value=uE(Yo.value,e),k1(Yo.value))}const hN=Z(null),mN=Z([]),gN=Z(!1),vN=Z(null),yN=Z(!1),kN=Z(!1),bN=Z(null);async function _c(e){let t;try{t=await _t().getSessionStatus(e)}catch{return}R2(e,n=>({...n,model:t.model||n.model,usage:{...n.usage,contextTokens:t.contextTokens,contextLimit:t.maxContextTokens}})),Me.swarmModeBySession[e]=t.swarmMode,Me.planModeBySession[e]=t.planMode,t.thinkingEffort.length>0&&rE(Me,e,t.thinkingEffort)}async function Lme(e){const t=Me.goalVersionBySession[e]??0;let n;try{n=await _t().getSessionGoal(e)}catch{return}(Me.goalVersionBySession[e]??0)===t&&(n===null||n.status==="complete"?delete Me.goalBySession[e]:Me.goalBySession[e]=n)}function CN(e,t){const n=t??Me.activeSessionId;if(!n)return Promise.resolve(!1);const o=e.thinking!==void 0?Me.pendingThinkingBySession[n]:void 0;return Promise.resolve(_t().updateSession(n,e)).then(()=>(vl(Me,n,o),_c(n))).then(()=>!0).catch(s=>(vl(Me,n,o)&&_c(n),t0("persistSessionProfile",s,{sessionId:n}),!1))}function wN(e){try{return ui(e)??""}catch{return""}}function $me(){return typeof window>"u"?!1:new URLSearchParams(window.location.search).get("kimi_onboarded")==="1"}const _N=$me();if(_N&&wN(Ag)!=="1")try{Ls(Ag,"1")}catch{}const xN=Z(_N||wN(Ag)==="1");function Nme(e){xN.value=e;try{Ls(Ag,e?"1":"0")}catch{}e&&window.kimiDesktop?.setOnboarded?.()}let rr=null;const Tg=mme({api:_t(),connectEventsIfNeeded:H5,getEventConnection:()=>rr});let zx=0;function SN(){return zx+=1,`msg_opt_${Date.now().toString(36)}_${zx}`}function Wx(e,t,n){const o={sessions:Me.sessions,activeSessionId:Me.activeSessionId,messagesBySession:Me.messagesBySession,approvalsBySession:Me.approvalsBySession,planReviewByToolCallId:Me.planReviewByToolCallId,questionsBySession:Me.questionsBySession,tasksBySession:Me.tasksBySession,goalBySession:Me.goalBySession,goalVersionBySession:Me.goalVersionBySession,lastSeqBySession:Me.lastSeqBySession,turnActiveBySession:Me.turnActiveBySession,turnEndedPromptIdBySession:Me.turnEndedPromptIdBySession,turnErrorBySession:Me.turnErrorBySession,turnRetryBySession:Me.turnRetryBySession,compactionBySession:Me.compactionBySession,config:Me.config,warnings:Me.warnings},s=fY(o,e,{sessionId:t,seq:n},{t:(i,r)=>r===void 0?Hn.global.t(i):Hn.global.t(i,r)});s.sessions!==o.sessions&&D5(s.sessions),s.activeSessionId!==o.activeSessionId&&B5(s.activeSessionId),Tme(s.messagesBySession),Ni(Me.approvalsBySession,s.approvalsBySession),Ni(Me.planReviewByToolCallId,s.planReviewByToolCallId),Ni(Me.questionsBySession,s.questionsBySession),Ni(Me.tasksBySession,s.tasksBySession),Ni(Me.goalBySession,s.goalBySession),Ni(Me.goalVersionBySession,s.goalVersionBySession),Ni(Me.lastSeqBySession,s.lastSeqBySession),Ni(Me.turnActiveBySession,s.turnActiveBySession),Ni(Me.turnEndedPromptIdBySession,s.turnEndedPromptIdBySession),Ni(Me.turnErrorBySession,s.turnErrorBySession),Ni(Me.turnRetryBySession,s.turnRetryBySession),Ni(Me.compactionBySession,s.compactionBySession),s.config!==o.config&&(Me.config=s.config??null),pY(s.warnings,o.warnings)||(Me.warnings=s.warnings),e.type==="configChanged"&&(Me.defaultModel=e.config.defaultModel??null),e.type==="modelCatalogChanged"&&(Rn.loadModels(),Rn.loadProviders()),e.type==="sessionUsageUpdated"&&(e.swarmMode!==void 0&&(Me.swarmModeBySession[e.sessionId]=e.swarmMode),e.planMode!==void 0&&(Me.planModeBySession[e.sessionId]=e.planMode),e.thinking!==void 0&&rE(Me,e.sessionId,e.thinking)),e.type==="sessionDeleted"&&V5(e.sessionId)}function Fme(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n.role==="user")return;if(n.role==="assistant")for(let o=n.content.length-1;o>=0;o--){const s=n.content[o];if(s.type==="toolUse"&&s.toolName==="ExitPlanMode")return s.toolCallId}}}function Rme(e,t){const n=Me.lastSeqBySession[t.sessionId]??0,o=Me.turnActiveBySession[t.sessionId]??!1,s=e.type==="approvalResolved"||e.type==="approvalExpired"?Me.approvalsBySession[t.sessionId]?.find(r=>r.approvalId===e.approvalId&&r.toolName==="ExitPlanMode")?.toolCallId:void 0,i=si.sideChatTargetBySession.value[t.sessionId];if(e.type==="messageCreated"&&e.message.role==="user"&&e.agentId!==void 0&&Object.prototype.hasOwnProperty.call(Me.sideChatMessagesByAgent,e.agentId)){Wx({type:"unknown",raw:{_noop:!0}},t.sessionId,t.seq),si.reconcileSideChatUserMessage(e.agentId,e.message);return}if(Wx(e,t.sessionId,t.seq),i){const{agentId:r}=i,l=t.sessionId;e.type==="agentDelta"&&e.agentId===r?e.delta.text&&si.appendSideChatAssistantText(r,l,e.delta.text):e.type==="agentTurnEnded"&&e.agentId===r?si.finishSideChatAgent(r,l):e.type==="taskProgress"&&e.taskId===r?si.appendSideChatAssistantText(r,l,e.outputChunk):e.type==="taskCompleted"&&e.taskId===r&&si.finishSideChatAgent(r,l,e.outputPreview)}if(e.type==="messageCreated"&&e.message.role==="user"&&e.message.promptId!==void 0){const r=e.message.sessionId;Me.promptIdBySession[r]!==e.message.promptId&&(Me.promptIdBySession[r]=e.message.promptId)}if(e.type==="turnActiveChanged"&&!e.active&&t.seq>n){const r=e.reason;y2e(e.sessionId,r==="cancelled"||r==="failed"||r==="blocked"?"aborted":"idle",o);const l=Fme(Me.messagesBySession[e.sessionId]??[]);l!==void 0&&b8(e.sessionId,l)}e.type==="sessionWorkChanged"&&(e.mainTurnActive===!1&&o||e.mainTurnActive===void 0&&!e.busy)&&t.seq>n&&v2e(e.sessionId),(e.type==="promptAborted"||e.type==="promptCompleted"&&e.reason==="blocked")&&t.seq>n&&Me.promptIdBySession[e.sessionId]===e.promptId&&At.finishPromptLocal(e.sessionId),e.type==="questionRequested"&&k2e(e.sessionId,e.question),e.type==="approvalRequested"&&b2e(e.sessionId,e.approval),s!==void 0&&b8(t.sessionId,s)}const Gd=gX(({appEvent:e,meta:t})=>Rme(e,t),({appEvent:e})=>fX(e),{coalesce:yX}),Ome=3e4;let Ux=0,oi=null;const op=new Map;let Eg=0,Yd=null;function Pme(){Yd!==null&&(clearTimeout(Yd),Yd=null)}function jx(e){if(!Me.connected||Yd!==null)return;const t=Math.min(Ome,1e3*2**Eg);Eg+=1,gl("[kimi-web] session work reconciliation incomplete; retrying",e),Yd=setTimeout(()=>{Yd=null,Me.connected&&AN()},t)}function Dme(e,t){const n=new Map(e.map(u=>[u.id,u]));let o=!1,s=!1;const i={...Me.turnActiveBySession},r=[],l=new Map,a=Me.sessions.map(u=>{const c=n.get(u.id);if(c===void 0)return u;const d=t.workEventSeqBySession.get(u.id)??0,f=t.turnEventSeqBySession.get(u.id)??0,h=t.pendingEventBySession.get(u.id),m=d>c.lastSeq,v=f>c.lastSeq,k=h!==void 0&&h.seq>c.lastSeq,w=m||v&&u.mainTurnActive===!0?u.busy||u.mainTurnActive===!0:c.busy,b=m||v?u.mainTurnActive:c.mainTurnActive??(w?u.mainTurnActive:!1),_=k?h.source==="work"?u.pendingInteraction:(Me.approvalsBySession[u.id]?.length??0)>0?"approval":(Me.questionsBySession[u.id]?.length??0)>0?"question":"none":c.pendingInteraction??(w?u.pendingInteraction:"none");(k&&h.source==="work"||!k&&(c.pendingInteraction!==void 0||c.busy===!1))&&_!==void 0&&l.set(u.id,_);const g=m?u.lastTurnReason:c.lastTurnReason;op.set(u.id,Math.max(op.get(u.id)??0,c.lastSeq));const x=t.turnStartBySession.get(u.id);return(b===!1||b===void 0&&!w)&&t.witnessedTurnBySession.has(u.id)&&x!==void 0&&At.isLocalTurnSnapshotCurrent(u.id,x)&&r.push(u.id),b===!0&&!i[u.id]?(i[u.id]=!0,s=!0):(b===!1||!w)&&i[u.id]&&(delete i[u.id],s=!0),u.busy===w&&u.mainTurnActive===b&&u.pendingInteraction===_&&u.lastTurnReason===g?u:(o=!0,{...u,busy:w,mainTurnActive:b,pendingInteraction:_,lastTurnReason:g})});o&&D5(a),s&&Ni(Me.turnActiveBySession,i);for(const[u,c]of l)c==="none"?(delete Me.approvalsBySession[u],delete Me.questionsBySession[u]):c==="question"&&delete Me.approvalsBySession[u];for(const u of r)At.finishPromptLocal(u,{turnWasActive:!0})}async function AN(){const e={workEventSeqBySession:new Map,turnEventSeqBySession:new Map,pendingEventBySession:new Map,turnStartBySession:new Map(Me.sessions.map(t=>[t.id,At.localTurnStartState(t.id)])),witnessedTurnBySession:new Set(Me.sessions.filter(t=>Me.inFlightBySession[t.id]||Me.turnActiveBySession[t.id]).map(t=>t.id))};oi=e;try{const t=await At.listAllSessionsGlobal({shouldContinue:()=>oi===e&&Me.connected});if(oi!==e||!Me.connected)return;Gd.flush(),Dme(t.sessions,e),oi=null,t.error!==void 0?jx(t.error):Eg=0}catch(t){if(oi!==e||!Me.connected)return;oi=null,jx(t)}}function H5(){if(rr!==null||typeof WebSocket>"u")return;bi("ws:connection",{status:"connecting"}),Me.connection="connecting",rr=_t().connectEvents({onEvent(t,n){if(t.type==="workspaceCreated"||t.type==="workspaceUpdated"||t.type==="workspaceDeleted"){At.applyWorkspaceEvent(t);return}const o=t.type==="sessionWorkChanged",s=t.type==="turnActiveChanged",i=t.type==="approvalRequested"||t.type==="approvalResolved"||t.type==="approvalExpired"||t.type==="questionRequested"||t.type==="questionAnswered"||t.type==="questionDismissed";if((o||s||i)&&n.seq>0){const r=op.get(n.sessionId)??0;if(n.seq<=r)return;op.set(n.sessionId,n.seq)}if(oi!==null&&(o||s||i))if(o){const r=oi.workEventSeqBySession.get(n.sessionId)??0;if(n.seq>r&&oi.workEventSeqBySession.set(n.sessionId,n.seq),t.pendingInteraction!==void 0||!t.busy){const l=oi.pendingEventBySession.get(n.sessionId);(l===void 0||n.seq>l.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"work"})}}else if(s){const r=oi.turnEventSeqBySession.get(n.sessionId)??0;n.seq>r&&oi.turnEventSeqBySession.set(n.sessionId,n.seq)}else{const r=oi.pendingEventBySession.get(n.sessionId);(r===void 0||n.seq>r.seq)&&oi.pendingEventBySession.set(n.sessionId,{seq:n.seq,source:"interaction"})}for(const r of vX({appEvent:t,meta:n}))Gd(r)},onResync(t,n,o){bi("ws:resync",{sessionId:t,status:"required",seq:n}),Gd.flush(),Ig.add(t),Lg.request(t)},onError(t,n,o){bi("ws:error",{status:"failed",errorCode:t,fatal:o}),O2({severity:"error",title:Hn.global.t("warnings.wsTitle"),message:n,details:[Lo("message",n)].filter(s=>s!==void 0)})},onConnectionChange(t){bi("ws:connection",{status:t?"connected":"disconnected"}),Me.connected=t,Me.connection=t?"connected":"disconnected",t||(oi=null,op.clear(),Pme(),Eg=0),t&&(Ux+=1,qme(),At.refreshServerMeta())},onReplayComplete(){Gd.flush(),Ux>1&&AN()},onTranscriptReset(t,n,o,s){Tg.receiveReset(t,n,o,s)},onTranscriptOps(t,n,o,s){return Tg.applyOps(t,n,o,s)}})}const w8={},Ig=new Set,um=new Set,MN=new Set;function Bme(e){return Us(e)&&e.code===Hx?!0:typeof e=="object"&&e!==null&&e.code===Hx}function Lo(e,t){if(!(t==null||t===""))return{label:Hn.global.t(`warnings.details.${e}`),value:TN(t)}}function TN(e){if(e instanceof Error)return typeof e.stack=="string"&&e.stack?e.stack:e.message?`${e.name}: ${e.message}`:e.name;if(typeof e=="string")return e;if(typeof e=="number"||typeof e=="boolean"||typeof e=="bigint")return String(e);try{return JSON.stringify(e)}catch{return String(e)}}function Hme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.name=="string"?e.name:void 0}function zme(e){return e instanceof Error||typeof e=="object"&&e!==null&&typeof e.message=="string"?e.message:void 0}function Wme(e){return e instanceof Error&&typeof e.stack=="string"&&e.stack?e.stack:void 0}function Ume(e){if(!(typeof e!="number"||!Number.isFinite(e)))return new Date(e).toISOString()}function Vx(e){if(!(typeof e!="number"||!Number.isFinite(e)))return`${Math.round(e)}ms`}function jme(e,t,n){const o=iy(t),s=Us(t),i=o||s?t.timestamp:void 0,r=o||s?t.durationMs:void 0,l=[Lo("operation",e),Lo("sessionId",n??Me.activeSessionId),Lo("connection",Me.connection),Lo("timestamp",Ume(i??Date.now()))];return o?l.push(Lo("duration",Vx(r)),Lo("request",`${t.method} ${t.path}`),Lo("endpoint",t.url),Lo("requestId",t.requestId),Lo("phase",t.phase),Lo("timeout",`${t.timeoutMs}ms`),Lo("status",t.status===void 0?void 0:`${t.status} ${t.statusText??""}`.trim()),Lo("contentType",t.contentType),Lo("responsePreview",t.bodyPreview),Lo("cause",t.cause)):s?l.push(Lo("duration",Vx(r)),Lo("code",t.code),Lo("requestId",t.requestId),Lo("message",t.message),Lo("details",t.details)):l.push(Lo("errorName",Hme(t)),Lo("message",zme(t)??TN(t)),Lo("stack",Wme(t))),l.filter(a=>a!==void 0)}function Vme(e,t,n={}){const o=iy(t),s=Us(t),i=n.title??(o?Hn.global.t("warnings.daemonNetworkTitle"):s?Hn.global.t("warnings.daemonApiTitle"):Hn.global.t("warnings.operationFailedTitle")),r=n.message??(o?Hn.global.t("warnings.daemonNetworkMessage"):s?t.message:Hn.global.t("warnings.operationFailedMessage"));return{severity:"error",title:i,message:r,details:jme(e,t,n.sessionId)}}function O2(e){Me.warnings=[...Me.warnings,e]}function qme(){const e=Hn.global.t("warnings.wsTitle"),t=Me.warnings.filter(n=>!(typeof n=="object"&&n!==null&&n.severity==="error"&&n.title===e));t.length!==Me.warnings.length&&(Me.warnings=t)}function t0(e,t,n){Xl(`[kimi-web] operation failed: ${e}`,t);const o=Us(t),s=iy(t);bi("operation:failed",{sessionId:n?.sessionId,status:"failed",operation:e,errorName:t instanceof Error?t.name:typeof t,errorCode:o?t.code:void 0,requestId:o||s?t.requestId:void 0,phase:s?t.phase:void 0,httpStatus:s?t.status:void 0}),O2(Vme(e,t,n))}const Kme={40913:"warnings.goal.alreadyExists",40914:"warnings.goal.notFound",40915:"warnings.goal.statusInvalid",40916:"warnings.goal.notResumable",40918:"warnings.goal.objectiveTooLong"};function Zme(e){if(!Us(e)||e.code===void 0)return;const t=Kme[e.code];return t?Hn.global.t(t):void 0}async function Gme(e){if(pN(e),Me.activeSessionId!==e)return;const t=Me.sessions[0];t?await At.selectSession(t.id,{urlMode:"replace"}):(B5(void 0),Me.sessionLoading=!1,At.writeSessionUrl(void 0,"replace"))}const qx=new Set;async function Yme(e){if(!qx.has(e)){qx.add(e);try{const t=await _t().getSessionWarnings(e),n=Hn.global.t("warnings.noteLabel");for(const o of t)O2(`${n}: ${o.message}`)}catch{}}}async function z5(e,t){const n=At.localTurnStartState(e);try{const s=await _t().getSessionSnapshot(e);if(!Me.sessions.some(c=>c.id===e))return"ok";Gd.flush();const i=Me.lastSeqBySession[e]??0,r=w8[e],l=Ig.has(e)||$g.has(e);if(!l&&r!==void 0&&r===s.epoch&&i>s.asOfSeq)return um.delete(e)||(um.add(e),Lg.request(e)),"ok";if(!At.isLocalTurnSnapshotCurrent(e,n))return At.afterLocalTurnStartsSettle(e,()=>{Lg.request(e)}),"ok";const a=Me.turnRetryBySession[e];a!==void 0&&a.turnId!==s.inFlightTurn?.turnId&&delete Me.turnRetryBySession[e],(l||s.session.lastTurnReason!=="failed")&&delete Me.turnErrorBySession[e];const u=o3(s.session.usage);R2(e,c=>({...s.session,model:s.session.model&&s.session.model.length>0?s.session.model:c.model,usage:u?c.usage:s.session.usage,updatedAt:!s.session.mainTurnActive&&s.session.updatedAt>c.updatedAt?s.session.updatedAt:c.updatedAt})),Eme(e,gQ(Me.messagesBySession[e]??[],s.messages)),Me.tasksBySession[e]=_Q(s.subagents,Me.tasksBySession[e]??[]),Me.messagesHasMoreBySession[e]=s.hasMoreMessages,Me.approvalsBySession[e]=s.pendingApprovals;for(const c of s.pendingApprovals){const d=c.display;d?.kind==="plan_review"&&typeof d.plan=="string"&&d.plan.length>0&&(Me.planReviewByToolCallId[c.toolCallId]={plan:d.plan,path:typeof d.path=="string"?d.path:void 0})}return Me.questionsBySession[e]=s.pendingQuestions,Me.lastSeqBySession[e]=s.asOfSeq,w8[e]=s.epoch,Ig.delete(e),um.delete(e),At.handleSessionSnapshot(e,{inFlightTurn:s.inFlightTurn,busy:s.session.busy}),s.session.mainTurnActive??(s.inFlightTurn!==null&&s.session.busy)?Me.turnActiveBySession[e]=!0:delete Me.turnActiveBySession[e],H5(),rr&&(rr.seedSnapshot(e,s),rr.subscribe(e,{seq:s.asOfSeq,epoch:s.epoch}),Qme(e)),$g.delete(e),u&&t?.skipStatusRefresh!==!0&&_c(e),Yme(e),"ok"}catch(o){return Bme(o)?(await Gme(e),"not-found"):(t0("getSessionSnapshot",o,{title:Hn.global.t("warnings.sessionSnapshotTitle"),message:Hn.global.t("warnings.sessionSnapshotMessage"),sessionId:e}),"failed")}}const Lg=vQ(z5);function Xme(e){return Object.prototype.hasOwnProperty.call(Me.messagesBySession,e)}const Jme=4,ql=[],$g=new Set;function Qme(e){const t=ql.indexOf(e);for(t!==-1&&ql.splice(t,1),ql.unshift(e);ql.length>Jme;){let n=-1;for(let s=ql.length-1;s>=0;s--)if(ql[s]!==Me.activeSessionId){n=s;break}if(n===-1)break;const[o]=ql.splice(n,1);if(o===void 0)break;rr?.unsubscribe(o),$g.add(o)}}function ege(e){const t=ql.indexOf(e);t!==-1&&ql.splice(t,1),$g.delete(e)}async function tge(e){return z5(e)}function u1(e,t){return(Me.inFlightBySession[e]??!1)||(Me.turnActiveBySession[e]??!1)||(t??Me.sessions.find(n=>n.id===e)?.mainTurnActive??!1)}function n0(e){try{const t=new Date(e),o=Date.now()-t.getTime(),s=o/36e5;if(o<6e4)return Hn.global.t("sessions.justNow");if(s<1)return`${Math.round(o/6e4)}m`;if(s<24)return`${Math.round(s)}h`;const i=o/864e5;return i<7?`${Math.round(i)}d`:i<30?`${Math.round(i/7)}w`:i<365?`${Math.round(i/30)}mo`:`${Math.round(i/365)}y`}catch{return e}}const nge=3e4,xc=Z(0);let C4=null;function oge(){C4===null&&(C4=setInterval(()=>{xc.value=(xc.value+1)%Number.MAX_SAFE_INTEGER},nge),C4.unref?.())}function sge(e){const t=e.display??{},n=typeof t.kind=="string"?t.kind:"";if(n==="diff"){const o=typeof t.path=="string"?t.path:"";if(Array.isArray(t.diff))return{kind:"diff",path:o,diff:t.diff};const s=typeof t.old_text=="string"?t.old_text:typeof t.before=="string"?t.before:void 0,i=typeof t.new_text=="string"?t.new_text:typeof t.after=="string"?t.after:void 0;if(s!==void 0&&i!==void 0){const r=r1(s,i)??Pm(s,i);return{kind:"diff",path:o,diff:r}}return{kind:"diff",path:o,diff:[]}}if(n==="file_io"){const o=typeof t.path=="string"?t.path:"",s=typeof t.operation=="string"?t.operation:"";if(s==="write"&&typeof t.content=="string")return{kind:"file",path:o,content:t.content};if(s==="edit"&&typeof t.before=="string"&&typeof t.after=="string"){const r=r1(t.before,t.after)??Pm(t.before,t.after);return{kind:"diff",path:o,diff:r}}const i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:s||n,path:o,detail:i}}if(n==="shell"||n==="command"){const o=typeof t.command=="string"?t.command:e.action,s=typeof t.cwd=="string"?t.cwd:void 0,i=typeof t.danger=="string"?t.danger:DT(o);return{kind:"shell",command:o,cwd:s,danger:i}}if(n==="file_content"||n==="file"){const o=typeof t.path=="string"?t.path:"",s=typeof t.content=="string"?t.content:"",i=typeof t.language=="string"?t.language:void 0;return{kind:"file",path:o,content:s,language:i}}if(n==="file_op"||n==="fileop"){const o=typeof t.operation=="string"?t.operation:typeof t.op=="string"?t.op:n,s=typeof t.path=="string"?t.path:"",i=typeof t.detail=="string"?t.detail:void 0;return{kind:"fileop",op:o,path:s,detail:i}}if(n==="url_fetch"||n==="url"){const o=typeof t.url=="string"?t.url:e.action;return{kind:"url",method:typeof t.method=="string"?t.method:void 0,url:o}}if(n==="search"){const o=typeof t.query=="string"?t.query:e.action,s=typeof t.scope=="string"?t.scope:void 0;return{kind:"search",query:o,scope:s}}if(n==="invocation"||n==="agent_call"||n==="skill_call"){const o=typeof t.kind=="string"?t.kind:n,s=typeof t.name=="string"?t.name:e.toolName,i=typeof t.description=="string"?t.description:void 0;return{kind:"invocation",kind2:o,name:s,description:i}}if(n==="todo"||n==="todo_list")return{kind:"todo",items:(Array.isArray(t.items)?t.items:[]).map(i=>{const r=i??{};return{title:typeof r.title=="string"?r.title:"",status:typeof r.status=="string"?r.status:"pending"}})};if(n==="plan_review"){const o=typeof t.plan=="string"?t.plan:"",s=typeof t.path=="string"?t.path:void 0,r=(Array.isArray(t.options)?t.options:[]).map(l=>{const a=l??{},u=typeof a.label=="string"?a.label:"";if(!u)return null;const c=typeof a.description=="string"?a.description:void 0;return{label:u,description:c}}).filter(l=>l!==null);return{kind:"plan_review",plan:o,path:s,options:r.length>0?r:void 0}}return{kind:"generic",summary:e.action}}function ige(e){return{questionId:e.questionId,sessionId:e.sessionId,toolCallId:e.toolCallId,questions:e.questions.map(t=>({id:t.id,question:t.question,header:t.header,body:t.body,options:t.options.map(n=>({id:n.id,label:n.label,description:n.description,recommended:n.recommended})),multiSelect:t.multiSelect,allowOther:t.allowOther,otherLabel:t.otherLabel}))}}function rge(e){const t=Me.messagesBySession[e.sessionId];if(!t||t.length===0)return;const n=new Map;for(const s of t)if(s.role==="assistant")for(const i of s.content){if(i.type!=="toolUse"||i.toolName!=="Bash"&&i.toolName!=="bash")continue;const r=i.input,l=r&&typeof r.command=="string"?r.command:void 0;l&&n.set(i.toolCallId,l)}if(n.size===0)return;const o=`task_id: ${e.id}`;for(const s of t)if(s.role==="tool")for(const i of s.content){if(i.type!=="toolResult")continue;if((typeof i.output=="string"?i.output:i.output!==void 0?JSON.stringify(i.output):"").includes(o)){const l=n.get(i.toolCallId);if(l)return l}}}function lge(e){let t;e.status==="running"?t="run":e.status==="completed"?t="done":t="fail";let n="";if(e.status==="running"&&e.startedAt){const r=Math.round((Date.now()-new Date(e.startedAt).getTime())/1e3),l=Math.floor(r/60),a=r%60;n=Hn.global.t("tasks.timingRunning",{time:`${l}:${String(a).padStart(2,"0")}`})}else if(e.completedAt&&e.startedAt){const r=Math.round((new Date(e.completedAt).getTime()-new Date(e.startedAt).getTime())/1e3);n=Hn.global.t("tasks.timingDone",{sec:r})}else n=e.status;const o=e.outputLines&&e.outputLines.length>0?e.outputLines:e.outputPreview?e.outputPreview.split(/\r?\n/):void 0,s=e.command??rge(e),i=e.kind==="bash"&&s?`$ ${s}`:void 0;return{id:e.id,agentId:e.agentId,name:e.description,kind:e.kind,state:t,timing:n,meta:i,output:o,runInBackground:e.runInBackground,parentToolCallId:e.parentToolCallId,model:e.model,thinkingEffort:e.thinkingEffort}}const age=R(()=>{const e=Me.sessions.find(n=>n.id===Me.activeSessionId),t=e?e.cwd.split("/").pop()??e.cwd:"main";return{name:Me.workspaceName,branch:t}}),uge=R(()=>(xc.value,Me.sessions.toSorted((e,t)=>new Date(t.updatedAt).getTime()-new Date(e.updatedAt).getTime()).map(e=>({id:e.id,title:e.title,time:n0(e.updatedAt),busy:u1(e.id,e.mainTurnActive),pendingInteraction:e.pendingInteraction,lastTurnReason:e.lastTurnReason,workspaceId:Ml(e),cwd:e.cwd})))),cge=R(()=>Me.activeSessionId??""),dge=R(()=>{const e=Me.activeSessionId;if(e)return Rn.skillsBySession.value[e]??[];const t=P2.value;return t?Rn.skillsByWorkspace.value[t]??[]:[]}),W5=R(()=>{const e=Me.activeSessionId;return e?Me.inFlightBySession[e]??!1:!1}),fge=R(()=>At.isStartingFirstPrompt()),si=fme(Me,{pushOperationFailure:t0,nextOptimisticMsgId:SN,connectEventsIfNeeded:H5,getEventConn:()=>rr,resolveThinkingForPrompt:(e,t)=>Rn.resolveThinkingForPrompt(e,t),refreshSessionStatus:_c}),o0=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=si.sideChatTargetBySession.value[e]?.agentId;return(Me.tasksBySession[e]??[]).filter(n=>n.id!==t)}),EN=ghe(Me,o0),s0=R(()=>{const e=Me.activeSessionId;return e?(Me.turnActiveBySession[e]??!1)||(Me.sessions.find(t=>t.id===e)?.mainTurnActive??!1):!1}),pge=R(()=>{const e=Me.activeSessionId;if(e)return Me.turnErrorBySession[e]}),hge=R(()=>{const e=Me.activeSessionId;if(e&&s0.value)return Me.turnRetryBySession[e]}),IN=e=>_t().getFileUrl(e),mge=[],gge=KT(),vge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=new Set(Me.sideChatUserMessageIdsBySession[e]??[]);return gge({messages:(Me.messagesBySession[e]??[]).filter(n=>!t.has(n.id)),approvals:Me.approvalsBySession[e]??mge,getFileUrl:IN,sessionActive:s0.value,planReviewByToolCallId:Me.planReviewByToolCallId,plansByToolCallId:Mg[e]})}),yge=R(()=>W5.value||s0.value),kge=R(()=>(EN.taskClock.value,o0.value.map(lge))),LN=R(()=>IX(o0.value)),bge=R(()=>$X(o0.value)),vd=R(()=>{const e=Me.activeSessionId;return e?Me.goalBySession[e]??null:null}),Cge=R(()=>{const e=Me.activeSessionId;return e?bX(Me.messagesBySession[e]??[]):[]}),wge=R(()=>{const e=Me.activeSessionId;return e?Me.compactionBySession[e]??null:null}),_ge=R(()=>Me.connection),xge=R(()=>Me.loading),Sge=R(()=>Me.sessionLoading),Age=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadingMoreBySession[e]??!1:!1}),Mge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesHasMoreBySession[e]??!1:!1}),Tge=R(()=>{const e=Me.activeSessionId;return e?Me.messagesLoadMoreErrorBySession[e]??!1:!1}),Ege=R(()=>Me.serverVersion),Ige=R(()=>Me.experimentalFlags),Lge=R(()=>Me.backend),$ge=R(()=>Me.dangerousBypassAuth);function Nge(){Me.dangerousBypassAuth=!1}const Fge=R(()=>Me.permission),Rge=R(()=>Me.thinking),$N=R(()=>{const e=Me.activeSessionId;return e?Me.planModeBySession[e]??!1:F2.planMode}),Oge=R(()=>{const e=Me.activeSessionId;return e?Me.swarmModeBySession[e]??!1:F2.swarmMode}),Pge=R(()=>{const e=Me.activeSessionId;return e?Me.goalModeBySession[e]??!1:F2.goalMode}),Dge=R(()=>{const e=LX(LN.value);return{plan:$N.value,goal:vd.value&&vd.value.status!=="complete"?{status:vd.value.status,turnsUsed:vd.value.turnsUsed,elapsedMs:vd.value.wallClockMs}:null,swarm:e.total>0?e:null}}),Bge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=_t();return(Me.queuedBySession[e]??[]).map(n=>({id:n.id??n.text,text:n.text,attachmentCount:n.attachments?.length??0,attachments:n.attachments?.map(o=>({fileId:o.fileId,kind:o.kind,url:t.getFileUrl(o.fileId),name:o.name}))}))}),Hge=R(()=>Me.warnings),zge=R(()=>{const e=Me.activeSessionId;return e?(Me.questionsBySession[e]??[]).map(ige):[]}),Wge=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).map(t=>({approvalId:t.approvalId,block:sge(t),agentName:t.agentName,toolCallId:t.toolCallId})):[]}),U5=R(()=>{const e=Me.activeSessionId;return e?(Me.approvalsBySession[e]??[]).length>0?"awaiting-approval":(Me.questionsBySession[e]??[]).length>0?"awaiting-question":W5.value||s0.value?"running":"idle":"idle"}),Rn=dme(Me,{pushOperationFailure:t0,refreshSessionStatus:_c,persistSessionProfile:CN,activity:U5,updateSession:R2,updateSessionMessages:fN,loadConfig:()=>At.loadConfig(),checkAuth:()=>At.checkAuth()}),_8=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{branch:t.branch,ahead:t.ahead,behind:t.behind}:null}),Uge=R(()=>{const e=Me.activeSessionId;return e?Me.gitStatusBySession[e]?.pullRequest??null:null}),jge=R(()=>{const e=Me.activeSessionId;if(!e)return[];const t=Me.gitStatusBySession[e];return t?Object.entries(t.entries).map(([n,o])=>({path:n,status:o})).sort((n,o)=>n.path.localeCompare(o.path)):[]}),Vge=R(()=>{const e=Me.activeSessionId;if(!e)return null;const t=Me.gitStatusBySession[e];return t?{totalAdditions:t.additions,totalDeletions:t.deletions}:null}),NN=R(()=>{const e=Me.sessions.find(r=>r.id===Me.activeSessionId),t=_8.value?.branch??(e?e.cwd.split("/").pop()??e.cwd:"main"),n=e===void 0?Rn.draftModel.value:null,o=(e?.model&&e.model.length>0?e.model:n??Me.defaultModel)??"—",s=Rn.models.value.find(r=>r.id===o)??Rn.models.value.find(r=>r.model===o);return{model:s?.displayName||s?.model||(o.includes("/")?o.split("/").pop():o),modelId:s?.id??o,ctxUsed:e?.usage.contextTokens??0,ctxMax:e?.usage.contextLimit??0,permission:Me.permission,branch:t,cwd:e?.cwd??"",isGitRepo:_8.value!==null}}),qge=R(()=>mN.value),Kge=R(()=>Me.sessions.find(t=>t.id===Me.activeSessionId)?.usage.totalCostUsd??0),Zge=R(()=>Me.authReady),Gge=R(()=>Me.defaultModel),Yge=R(()=>Me.managedProviderStatus),Xge=R(()=>Me.managedUserInfo),Jge=R(()=>Me.managedMembership),Qge=R(()=>Me.config),e2e=R(()=>{const e=Me.activeSessionId;if(!e)return{};const t=Me.gitStatusBySession[e];return t?{...t.entries}:{}}),t2e=R(()=>{const e=new Map;for(const t of Me.workspaces){const n=Pr(t.root);e.has(n)||e.set(n,t.id)}return e});function Ml(e){return t2e.value.get(Pr(e.cwd))??e.workspaceId??e.cwd}const j5=R(()=>dJ({workspaces:Me.workspaces,sessions:Me.sessions,hiddenWorkspaceRoots:Me.hiddenWorkspaceRoots,sessionsHasMoreByWorkspace:Me.sessionsHasMoreByWorkspace})),Ng=Z(wQ());Je(()=>[j5.value.map(e=>e.id).join("\0"),Me.loading],([e,t])=>{if(t)return;const n=e?e.split("\0"):[],o=UQ(n,Ng.value);o!==null&&(Ng.value=o,wE(o))});const Yo=Z(_E());function FN(e){const t=LJ(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function V5(e){const t=uE(Yo.value,e);t!==Yo.value&&(Yo.value=t,k1(t))}function n2e(e){const t=new Set(e),n=Yo.value.filter(o=>!t.has(o));n.length!==Yo.value.length&&(Yo.value=n,k1(n))}function o2e(e){Yo.value.includes(e)?V5(e):FN(e)}function s2e(e){const t=cE(e,Yo.value);Yo.value=t,k1(t)}function i2e(e,t,n){const o=ON.value.map(r=>r.id),s=NJ(o,e,t,n),i=cE(s,Yo.value);Yo.value=i,k1(i)}const Yr=R(()=>{const e=j5.value.map(t=>({id:t.id,name:t.name,root:t.root,shortPath:wme(t.root,Me.fsHome),sessionCount:t.sessionCount}));return jQ(e,Ng.value)}),P2=R(()=>{const e=Me.activeWorkspaceId,t=Yr.value;return e&&t.some(n=>n.id===e)?e:t[0]?.id??null});Je(P2,e=>{e&&(Object.prototype.hasOwnProperty.call(Rn.skillsByWorkspace.value,e)||Rn.loadSkillsForWorkspace(e))},{immediate:!0});const r2e=R(()=>{const e=P2.value;return e?Yr.value.find(t=>t.id===e)??null:null}),l2e=R(()=>{xc.value;const e=new Set(Yr.value.map(n=>n.id)),t=new Map(Yr.value.map(n=>[n.id,n.name]));return Me.sessions.filter(n=>!n.parentSessionId&&e.has(Ml(n))).map(n=>{const o=Ml(n);return{id:n.id,title:n.title,time:n0(n.updatedAt),busy:u1(n.id,n.mainTurnActive),pendingInteraction:n.pendingInteraction,lastTurnReason:n.lastTurnReason,lastPrompt:n.lastPrompt,workspaceId:o,workspaceName:t.get(o)}})}),Fg=Z(xg),q5=R(()=>{xc.value;const e=new Set(Yr.value.map(l=>l.id)),t=new Map(Yr.value.map(l=>[l.id,l.name])),n=new Set(Yo.value),o=(l,a)=>new Date(a.updatedAt).getTime()-new Date(l.updatedAt).getTime(),s=Me.flatSessionsFrontier,i=[],r=[];for(const l of Me.sessions){if(l.parentSessionId||l.archived||n.has(l.id)||!e.has(Ml(l)))continue;if(kE({busy:u1(l.id,l.mainTurnActive),unread:DN.value[l.id]??!1,renaming:!1,questionCount:x8.value[l.id]?.questions??0,approvalCount:x8.value[l.id]?.approvals??0,pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason}).hasStatus){i.push(l);continue}s!==null&&new Date(l.updatedAt).getTime(){const a=Ml(l);return{id:l.id,title:l.title,time:n0(l.updatedAt),busy:u1(l.id,l.mainTurnActive),pendingInteraction:l.pendingInteraction,lastTurnReason:l.lastTurnReason,lastPrompt:l.lastPrompt,updatedAt:l.updatedAt,workspaceId:a,workspaceName:t.get(a),cwdLabel:l.cwd?v1(l.cwd):"-",pullRequest:l.pullRequest}})}),a2e=R(()=>q5.value.slice(0,Fg.value)),u2e=R(()=>Me.flatSessionsHasMore||Fg.valueq5.value.length&&Me.flatSessionsHasMore&&At.loadMoreFlatSessions()}function RN(e){xc.value;const t=new Set(Yo.value),n=new Map,o=new Map;for(const s of Me.sessions.toSorted((i,r)=>new Date(r.updatedAt).getTime()-new Date(i.updatedAt).getTime())){if(s.parentSessionId)continue;const i=Ml(s);if(e&&t.has(s.id)){o.set(i,(o.get(i)??0)+1);continue}const r={id:s.id,title:s.title,time:n0(s.updatedAt),busy:u1(s.id,s.mainTurnActive),pendingInteraction:s.pendingInteraction,lastTurnReason:s.lastTurnReason,updatedAt:s.updatedAt},l=n.get(i)??[];l.push(r),n.set(i,l)}return Yr.value.map(s=>({workspace:s,sessions:n.get(s.id)??[],pinnedCount:o.get(s.id)??0,hasMore:Me.sessionsHasMoreByWorkspace[s.id]??!1,loadingMore:Me.sessionsLoadingMoreByWorkspace[s.id]??!1,initialCount:Me.sessionsInitialCountByWorkspace[s.id]??am}))}const d2e=R(()=>RN(!0)),f2e=R(()=>RN(!1)),ON=R(()=>{xc.value;const e=new Set(Yr.value.map(o=>o.id)),t=new Map(Yr.value.map(o=>[o.id,o.name])),n=Me.sessions.filter(o=>!o.parentSessionId&&!o.archived&&e.has(Ml(o)));return $J(n,Yo.value).pinned.map(o=>{const s=Ml(o);return{id:o.id,title:o.title,time:n0(o.updatedAt),busy:u1(o.id,o.mainTurnActive),pendingInteraction:o.pendingInteraction,lastTurnReason:o.lastTurnReason,updatedAt:o.updatedAt,workspaceId:s,workspaceName:t.get(s),pinned:!0,cwdLabel:o.cwd?v1(o.cwd):"-",pullRequest:o.pullRequest}})});function p2e(e){Ng.value=e,wE(e)}const PN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&(e[t]=(e[t]??0)+n.length);return e}),x8=R(()=>{const e={};for(const[t,n]of Object.entries(Me.approvalsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).approvals=n.length);for(const[t,n]of Object.entries(Me.questionsBySession))n.length>0&&((e[t]??={approvals:0,questions:0}).questions=n.length);return e}),DN=R(()=>{const e={};for(const[t,n]of Object.entries(Me.unreadBySession))n&&(e[t]=!0);return e}),h2e=R(()=>{const e={},t=PN.value;for(const n of Me.sessions){const o=t[n.id]??0;if(o<=0)continue;const s=Ml(n);e[s]=(e[s]??0)+o}return e}),m2e=R(()=>Me.recentRoots),g2e=R(()=>Me.availableOpenInApps),At=ame(Me,{taskPoller:EN,sideChat:si,modelProvider:Rn,pushOperationFailure:t0,activity:U5,sessionsKnownEmpty:MN,setSessions:D5,updateSession:R2,upsertSessionFront:Sme,appendSession:Ame,forgetSession:pN,unpinSessions:n2e,setActiveSessionId:B5,updateSessionMessages:fN,nextOptimisticMsgId:SN,getEventConn:()=>rr,syncSessionFromSnapshot:z5,reopenSession:tge,hasLoadedMessages:Xme,refreshSessionStatus:_c,refreshSessionGoal:Lme,refreshSessionPlans:b8,persistSessionProfile:CN,mergedWorkspaces:j5,workspacesView:Yr,status:NN,workspaceIdForSession:Ml,savePermissionToStorage:vme,savePlanModeToStorage:lN,saveSwarmModeToStorage:aN,saveGoalModeToStorage:uN,draftModes:F2,saveUnread:Iy,saveActiveWorkspaceToStorage:Cme,saveHiddenWorkspacesToStorage:bme,goalErrorMessage:Zme,initialized:kN,connectIssue:bN,selectedDiffPath:hN,fileDiffLines:mN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN});function K5(e){return e===Me.activeSessionId&&typeof document<"u"&&document.visibilityState==="visible"&&document.hasFocus()}function v2e(e){Me.turnActiveBySession[e]&&delete Me.turnActiveBySession[e],Me.inFlightBySession[e]&&(Me.inFlightBySession[e]=!1)}function y2e(e,t,n){const o=Me.promptIdBySession[e];At.finishPromptLocal(e,{turnWasActive:n}),e===Me.activeSessionId?(At.loadGitStatus(e),_c(e)):t==="idle"&&(Me.unreadBySession[e]=!0,Iy({[e]:!0}));const s=(Me.approvalsBySession[e]??[]).length>0,i=(Me.questionsBySession[e]??[]).length>0;ohe(t,s,i)&&Da.maybeNotifyCompletion(e,{isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",promptId:o,onClick:()=>{At.selectSession(e)}})}function k2e(e,t){const n=t.questions[0],o=n?.header?.trim()??"",s=n?.question?.trim()??"",i=o&&s?`${o}: ${s}`:s||o;Da.maybeNotifyQuestion({isUserWatching:K5(e),sessionTitle:Me.sessions.find(r=>r.id===e)?.title??"",questionPreview:i,questionId:t.questionId,onClick:()=>{At.selectSession(e)}})}function b2e(e,t){Da.maybeNotifyApproval({isUserWatching:K5(e),sessionTitle:Me.sessions.find(n=>n.id===e)?.title??"",toolName:t.toolName,approvalId:t.approvalId,onClick:()=>{At.selectSession(e)}})}function mu(){return oge(),{workspace:age,sessions:uge,activeSessionId:cge,workspacesView:Yr,visibleWorkspace:r2e,activeWorkspaceId:P2,sessionsForView:l2e,workspaceGroups:d2e,mobileWorkspaceGroups:f2e,pinnedSessions:ON,flatSessions:a2e,flatSessionsHasMore:u2e,flatSessionsLoadingMore:R(()=>Me.flatSessionsLoadingMore),attentionBySession:PN,pendingBySession:x8,attentionByWorkspace:h2e,unreadBySession:DN,recentRoots:m2e,turns:vge,tasks:kge,activeAppTasks:o0,auxiliaryTranscripts:Tg,getFileUrl:IN,todos:Cge,goal:vd,swarms:LN,swarmMembersByToolCallId:bge,activationBadges:Dge,compaction:wge,status:NN,sessionCost:Kge,fileDiff:qge,selectedDiffPath:hN,fileDiffLoading:gN,fileDiffTexts:vN,fileDiffEmptyFile:yN,changes:jge,gitInfo:_8,gitDiffStats:Vge,activePullRequest:Uge,changesByPath:e2e,pendingApprovals:Wge,availableOpenInApps:g2e,connection:_ge,loading:xge,sessionLoading:Sge,loadingMoreMessages:Age,hasMoreMessages:Mge,loadMoreMessagesError:Tge,serverVersion:Ege,backend:Lge,dangerousBypassAuth:$ge,experimentalFlags:Ige,clearDangerousBypassAuth:Nge,initialized:kN,connectIssue:bN,permission:Fge,thinking:Rge,planMode:$N,swarmMode:Oge,goalMode:Pge,queued:Bge,warnings:Hge,questions:zge,activity:U5,turnActive:s0,activeTurnError:pge,activeTurnRetry:hge,inFlight:W5,working:yge,isStartingFirstPrompt:fge,models:Rn.models,starredModelIds:Rn.starredModelIds,providers:Rn.providers,fontScale:$h.fontScale,setFontScale:$h.setFontScale,colorScheme:$h.colorScheme,setColorScheme:$h.setColorScheme,notifyEnabled:Da.notifyEnabled,notifySound:Da.notifySound,notifyPermission:Da.notifyPermission,setNotifyEnabled:Da.setNotifyEnabled,setNotifySound:Da.setNotifySound,onboarded:xN,setOnboarded:Nme,load:At.load,selectSession:At.selectSession,clearActiveSession:At.clearActiveSession,loadOlderMessages:At.loadOlderMessages,loadWorkspaces:At.loadWorkspaces,loadMoreSessions:At.loadMoreSessions,loadAllSessions:At.loadAllSessions,ensureFlatSessions:At.ensureFlatSessions,loadMoreFlatSessions:c2e,selectWorkspace:At.selectWorkspace,openWorkspace:At.openWorkspace,openWorkspaceDraft:At.openWorkspaceDraft,startSessionAndSendPrompt:At.startSessionAndSendPrompt,startSessionAndActivateSkill:At.startSessionAndActivateSkill,startSessionAndOpenSideChat:At.startSessionAndOpenSideChat,addWorkspaceByPath:At.addWorkspaceByPath,browseFs:At.browseFs,getFsHome:At.getFsHome,sendPrompt:At.sendPrompt,steerPrompt:At.steerPrompt,sideChatVisible:si.sideChatVisible,sideChatSessionId:si.sideChatSessionId,sideChatTurns:si.sideChatTurns,sideChatRunning:si.sideChatRunning,sideChatSending:si.sideChatSending,openSideChat:si.openSideChat,closeSideChat:si.closeSideChat,sendSideChatPrompt:si.sendSideChatPrompt,uploadImage:At.uploadImage,abortCurrentPrompt:At.abortCurrentPrompt,respondApproval:At.respondApproval,respondQuestion:At.respondQuestion,dismissQuestion:At.dismissQuestion,pendingQuestionActions:At.pendingQuestionActions,pendingApprovalActions:At.pendingApprovalActions,cancelTask:At.cancelTask,setPermission:At.setPermission,setThinking:Rn.setThinking,setPlanMode:At.setPlanMode,togglePlanMode:At.togglePlanMode,setSwarmMode:At.setSwarmMode,toggleSwarmMode:At.toggleSwarmMode,setGoalMode:At.setGoalMode,toggleGoalMode:At.toggleGoalMode,createGoal:At.createGoal,controlGoal:At.controlGoal,enqueue:At.enqueue,dismissWarning:At.dismissWarning,renameSession:At.renameSession,renameWorkspace:At.renameWorkspace,deleteWorkspace:At.deleteWorkspace,reorderWorkspaces:p2e,pinSession:FN,unpinSession:V5,togglePinSession:o2e,reorderPinnedSessions:s2e,pinSessionAt:i2e,archiveSession:At.archiveSession,exportSession:At.exportSession,restoreSession:At.restoreSession,loadArchivedSessions:At.loadArchivedSessions,compact:At.compact,forkSession:At.forkSession,undo:At.undo,unqueue:At.unqueue,reorderQueue:At.reorderQueue,searchFiles:At.searchFiles,loadGitStatus:At.loadGitStatus,loadFileDiff:At.loadFileDiff,clearFileDiff:At.clearFileDiff,listDir:At.listDir,readFileContent:At.readFileContent,readHostFileContent:At.readHostFileContent,getFileDownloadUrl:At.getFileDownloadUrl,openWorkspaceFile:At.openWorkspaceFile,openInApp:At.openInApp,revealWorkspaceFile:At.revealWorkspaceFile,resolveImageUrl:At.resolveImageUrl,loadModels:Rn.loadModels,loadProviders:Rn.loadProviders,skills:dge,activateSkill:Rn.activateSkill,setModel:Rn.setModel,toggleStarModel:Rn.toggleStarModel,addProvider:Rn.addProvider,updateProvider:Rn.updateProvider,getProvider:Rn.getProvider,deleteProvider:Rn.deleteProvider,refreshProvider:Rn.refreshProvider,refreshAllProviders:Rn.refreshAllProviders,loadCatalogProviders:Rn.loadCatalogProviders,importCatalogProvider:Rn.importCatalogProvider,importCustomRegistry:Rn.importCustomRegistry,authReady:Zge,defaultModel:Gge,managedProviderStatus:Yge,managedUserInfo:Xge,managedMembership:Jge,notify:O2,config:Qge,loadConfig:At.loadConfig,updateConfig:At.updateConfig,checkAuth:At.checkAuth,probeManagedMembership:At.probeManagedMembership,startOAuthLogin:Rn.startOAuthLogin,pollOAuthLogin:Rn.pollOAuthLogin,cancelOAuthLogin:Rn.cancelOAuthLogin,getUsage:Rn.getUsage,logout:At.logout}}const C2e=["aria-expanded"],w2e={class:"user-menu-avatar","aria-hidden":"true"},_2e=["src"],x2e={class:"user-menu-name"},S2e={class:"user-menu-name"},A2e={class:"user-menu-item-label"},M2e={class:"user-menu-item-label"},T2e={class:"user-menu-item-label user-menu-login-label"},E2e={class:"user-menu-item-label"},I2e={class:"user-menu-row-value"},L2e={class:"user-menu-item-label"},$2e={class:"user-menu-row-value"},N2e={class:"user-menu-item-label"},F2e={key:0,class:"user-menu-usage"},R2e={key:0,class:"user-menu-usage-state"},O2e={key:1,class:"user-menu-usage-state"},P2e={class:"user-menu-usage-error"},D2e={key:2,class:"user-menu-usage-state user-menu-usage-empty"},B2e={class:"user-menu-usage-main"},H2e={class:"user-menu-usage-label"},z2e={key:0,class:"user-menu-usage-hint"},W2e={class:"user-menu-item-label"},U2e={class:"user-menu-item-label"},j2e=et({__name:"UserMenu",emits:["login","openSettings"],setup(e,{emit:t}){const n=t,{t:o,locale:s}=Nt(),i=mu(),{confirm:r}=hu(),l=R(()=>i.managedProviderStatus.value==="authenticated"),a=i.managedUserInfo,u=i.managedMembership,c=R(()=>a.value?.nickname||o("sidebar.defaultUserName")),d=R(()=>u.value==="free"||OJ(a.value?.userLevel)),f=R(()=>u.value!=="free"),h=Z(!1);Je(()=>a.value?.avatar,()=>{h.value=!1});const m=R(()=>!!a.value?.avatar&&!h.value),v=i.colorScheme,k=R(()=>o(`theme.${v.value}`)),w=R(()=>v.value==="light"?"light-mode":v.value==="dark"?"dark-mode":"follow-system"),b=[{value:"light",labelKey:"theme.light",icon:"light-mode"},{value:"dark",labelKey:"theme.dark",icon:"dark-mode"},{value:"system",labelKey:"theme.system",icon:"follow-system"}];function _(te){i.setColorScheme(te)}const g=R(()=>yg.find(te=>te.code===s.value)?.label??s.value);function x(te){s.value!==te&&E5(te)}const S=Z(!1),T=Z({}),A=Z(null),E=Z(null);let P=null;function D(te){const ce=te.target;ce.closest(".user-menu")||ce.closest(".user-menu-trigger")||ce.closest(".user-submenu")||O()}function I(te){te.key==="Escape"&&(te.stopPropagation(),O())}async function $(){if(S.value){O();return}S.value=!0,document.addEventListener("mousedown",D),document.addEventListener("keydown",I,!0),window.addEventListener("resize",O),l.value&&oe(),await yt(),B();const te=E.value;te&&(P=new ResizeObserver(H),P.observe(te))}function B(){const te=E.value,ce=A.value?.el;if(!te||!ce)return;const ue=te.getBoundingClientRect(),Se=4,ze=8,_e=ce.offsetHeight,Ee={left:`${Math.round(ue.left)}px`,width:`${Math.round(ue.width)}px`};ue.top-_e-Se{W[te]=ce instanceof HTMLElement?ce:ce?.$el??null}}function ie(te){le(),F.value!==te&&(F.value=te,yt(Ie))}function ne(te,ce){te.key!=="Enter"&&te.key!==" "&&te.key!=="ArrowRight"||(te.preventDefault(),ie(ce))}function X(){le(),K=setTimeout(()=>{F.value=null,K=null},250)}function le(){K!==null&&(clearTimeout(K),K=null)}function Ie(){const te=F.value,ce=A.value?.el,ue=z.value?.el,Se=te!==null?W[te]:null;if(!ce||!ue||!Se)return;const ze=4,_e=8,Ee=ce.getBoundingClientRect(),it=Se.getBoundingClientRect(),Fe=ue.offsetHeight,Oe=Math.min(ue.offsetWidth,Ee.width);let Ge=Ee.right+ze,at=!1;Ge+Oe>window.innerWidth-_e&&(Ge=Math.max(_e,Ee.left-Oe-ze),at=!0);const Tt=Math.max(_e,Math.min(it.top,window.innerHeight-Fe-_e));U.value={top:`${Math.round(Tt)}px`,left:`${Math.round(Ge)}px`,maxWidth:`${Math.round(Ee.width)}px`,transformOrigin:at?"top right":"top left","--menu-pop-shift":"-2px"}}const de=Z(!1),pe=Z(null);let ve=0;async function oe(){const te=++ve;de.value=!0;try{const ce=await i.getUsage();te===ve&&(pe.value=ce)}finally{te===ve&&(de.value=!1)}}const ye=R(()=>{if(pe.value?.kind!=="ok")return[];const{summary:te,limits:ce}=pe.value,ue=FJ(ce,5,"hour");return[te,ue].filter(Se=>Se!=null)}),G=R(()=>pe.value?.kind==="error"?pe.value.message:o("settings.planUsage.loadFailed"));function Y(te){return te.resetAt===void 0?"":fE(te.resetAt,o)}function fe(){O(),jp()}function we(){O(),n("login")}function ge(){O(),n("openSettings")}async function Q(){O(),await r({title:o("sidebar.logoutConfirmTitle"),message:o("sidebar.logoutConfirmMessage"),variant:"danger",action:()=>i.logout()})}return(te,ce)=>(y(),M(Pe,null,[C("button",{ref_key:"triggerRef",ref:E,class:"user-menu-trigger",type:"button","aria-haspopup":"menu","aria-expanded":S.value,onClick:It($,["stop"])},[l.value?(y(),M(Pe,{key:0},[C("span",w2e,[m.value?(y(),M("img",{key:0,src:p(a)?.avatar,alt:"",onError:ce[0]||(ce[0]=ue=>h.value=!0)},null,40,_2e)):(y(),he(p(Te),{key:1,name:"user",size:"sm"}))]),C("span",x2e,N(c.value),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"user"}),C("span",S2e,N(p(o)("sidebar.notSignedIn")),1)],64))],8,C2e),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[S.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:A,class:"user-menu",style:Zt(T.value),onClick:ce[14]||(ce[14]=It(()=>{},["stop"]))},{default:me(()=>[l.value?(y(),M(Pe,{key:0},[f.value?(y(),he(p(hn),{key:0,ref:V("usage"),"aria-haspopup":"true","aria-expanded":F.value==="usage",onMouseenter:ce[1]||(ce[1]=ue=>ie("usage")),onMouseleave:X,onFocus:ce[2]||(ce[2]=ue=>ie("usage")),onBlur:X,onClick:ce[3]||(ce[3]=ue=>ie("usage")),onKeydown:ce[4]||(ce[4]=ue=>ne(ue,"usage"))},{default:me(()=>[j(p(Te),{name:"histogram",size:"sm"}),C("span",A2e,N(p(o)("settings.planUsage.title")),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"])):ee("",!0),d.value?(y(),he(p(hn),{key:1,onClick:fe,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"music",size:"sm"}),C("span",M2e,N(p(o)("sidebar.upgrade")),1),j(p(Te),{name:"external-link",size:"sm"})]),_:1})):ee("",!0),j(p(hn),{separator:""})],64)):(y(),M(Pe,{key:1},[j(p(hn),{class:"user-menu-login",onClick:we,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-in",size:"sm"}),C("span",T2e,N(p(o)("sidebar.signIn")),1)]),_:1}),j(p(hn),{separator:""})],64)),j(p(hn),{ref:V("theme"),"aria-haspopup":"true","aria-expanded":F.value==="theme",onMouseenter:ce[5]||(ce[5]=ue=>ie("theme")),onMouseleave:X,onFocus:ce[6]||(ce[6]=ue=>ie("theme")),onBlur:X,onClick:ce[7]||(ce[7]=ue=>ie("theme")),onKeydown:ce[8]||(ce[8]=ue=>ne(ue,"theme"))},{default:me(()=>[j(p(Te),{name:w.value,size:"sm"},null,8,["name"]),C("span",E2e,N(p(o)("theme.colorSchemeLabel")),1),C("span",I2e,N(k.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{ref:V("language"),"aria-haspopup":"true","aria-expanded":F.value==="language",onMouseenter:ce[9]||(ce[9]=ue=>ie("language")),onMouseleave:X,onFocus:ce[10]||(ce[10]=ue=>ie("language")),onBlur:X,onClick:ce[11]||(ce[11]=ue=>ie("language")),onKeydown:ce[12]||(ce[12]=ue=>ne(ue,"language"))},{default:me(()=>[j(p(Te),{name:"translate",size:"sm"}),C("span",L2e,N(p(o)("sidebar.language")),1),C("span",$2e,N(g.value),1),j(p(Te),{name:"chevron-right",size:"sm"})]),_:1},8,["aria-expanded"]),j(p(hn),{onClick:ge,onMouseenter:X},{default:me(()=>[j(p(Te),{name:"settings",size:"sm"}),C("span",N2e,N(p(o)("settings.title")),1)]),_:1}),l.value?(y(),M(Pe,{key:2},[j(p(hn),{separator:""}),j(p(hn),{onClick:ce[13]||(ce[13]=ue=>void Q()),onMouseenter:X},{default:me(()=>[j(p(Te),{name:"log-out",size:"sm"}),qe(" "+N(p(o)("sidebar.signOut")),1)]),_:1})],64)):ee("",!0)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[F.value!==null?(y(),he(p(Cl),{key:0,ref_key:"submenuRef",ref:z,class:"user-submenu",style:Zt(U.value),role:F.value==="usage"?"dialog":"menu",onClick:ce[16]||(ce[16]=It(()=>{},["stop"])),onMouseenter:le,onMouseleave:X,onFocusin:le,onFocusout:X},{default:me(()=>[F.value==="usage"?(y(),M("div",F2e,[de.value?(y(),M("div",R2e,[j(p(Ao),{size:"sm"})])):pe.value?.kind!=="ok"?(y(),M("div",O2e,[C("span",P2e,N(G.value),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:ce[15]||(ce[15]=ue=>void oe())},{default:me(()=>[qe(N(p(o)("settings.planUsage.retry")),1)]),_:1})])):ye.value.length===0?(y(),M("span",D2e,N(p(o)("settings.planUsage.empty")),1)):(y(!0),M(Pe,{key:3},pt(ye.value,(ue,Se)=>(y(),M("div",{key:Se,class:"user-menu-usage-row"},[C("span",B2e,[C("span",H2e,N(p(dE)(ue,p(o))),1),Y(ue)?(y(),M("span",z2e,N(Y(ue)),1)):ee("",!0)]),C("span",{class:Re(["user-menu-usage-value",`sev-${p(C3)(ue.used,ue.limit)}`])},N(p(Wh)(ue.used,ue.limit))+"% ",3)]))),128))])):F.value==="theme"?(y(),M(Pe,{key:1},pt(b,ue=>j(p(hn),{key:ue.value,onClick:Se=>_(ue.value)},{default:me(()=>[j(p(Te),{name:ue.icon,size:"sm"},null,8,["name"]),C("span",W2e,N(p(o)(ue.labelKey)),1),p(v)===ue.value?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"])),64)):(y(!0),M(Pe,{key:2},pt(p(yg),ue=>(y(),he(p(hn),{key:ue.code,onClick:Se=>x(ue.code)},{default:me(()=>[C("span",U2e,N(ue.label),1),p(s)===ue.code?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)]),_:2},1032,["onClick"]))),128))]),_:1},8,["style","role"])):ee("",!0)]),_:1})]))],64))}}),V2e=ft(j2e,[["__scopeId","data-v-06f13413"]]),q2e={class:"ep-search"},K2e=["placeholder"],Z2e={class:"ep-scroll"},G2e={key:0,class:"ep-grid"},Y2e=["onClick"],X2e={key:1,class:"ep-empty"},J2e={class:"ep-label"},Q2e={class:"ep-grid"},eve=["onClick"],tve={class:"ep-label"},nve={class:"ep-grid"},ove=["onClick"],Kx="kimi-web.recent-emojis",sve=et({__name:"SessionEmojiPicker",props:{current:{default:null},removable:{type:Boolean,default:!0}},emits:["pick"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),{handleCompositionStart:s,handleCompositionEnd:i,isComposingKeyEvent:r}=Ar(),l=e,a=n,u=["⏳","⚠️","🐛","✨","🔥","🚀","🎯","🧪","📝","🔍","🛠️","💡","📦","🎨","🔒","📈","🧹","🚧","✅","❓","🌙","☕","🐳","🗂️","📊","🤖","🧩","⚙️","🌱","📌","💥","🕐"],c={faces:"sidebar.emojiGroupFaces",nature:"sidebar.emojiGroupNature",food:"sidebar.emojiGroupFood",activity:"sidebar.emojiGroupActivity",objects:"sidebar.emojiGroupObjects",symbols:"sidebar.emojiGroupSymbols"},d=sJ.map(S=>({id:S,labelKey:c[S],emojis:sE.filter(T=>T.group===S).map(T=>T.emoji)})),f=Z(h());function h(){try{const S=JSON.parse(localStorage.getItem(Kx)??"[]");return Array.isArray(S)?S.filter(T=>typeof T=="string"):[]}catch{return[]}}function m(S){f.value=aJ(f.value,S);try{localStorage.setItem(Kx,JSON.stringify(f.value))}catch{}a("pick",S)}const v=Z(""),k=R(()=>v.value.trim().length>0),w=R(()=>rJ(v.value)),b=Z(null);dn(()=>b.value?.focus());function _(S){if(r(S))return;const T=w.value[0];k.value&&T&&m(T)}function g(){let S=l.current??void 0;for(;S===void 0||S===l.current;)S=u[Math.floor(Math.random()*u.length)];m(S)}const x=Z(null);return t({el:R(()=>x.value?.el),isComposingKeyEvent:r}),(S,T)=>(y(),he(p(Cl),{ref_key:"menuRef",ref:x,class:"emoji-picker",role:"dialog","aria-label":p(o)("sidebar.sessionEmojiTitle"),onKeydown:T[4]||(T[4]=It(()=>{},["stop"]))},{default:me(()=>[C("div",q2e,[j(p(Te),{name:"search",size:"sm"}),Bn(C("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":T[0]||(T[0]=A=>v.value=A),class:"ep-input",type:"text",placeholder:p(o)("sidebar.searchEmoji"),autocomplete:"off",spellcheck:"false",onKeydown:xl(_,["enter"]),onCompositionstart:T[1]||(T[1]=(...A)=>p(s)&&p(s)(...A)),onCompositionend:T[2]||(T[2]=(...A)=>p(i)&&p(i)(...A))},null,40,K2e),[[ai,v.value]])]),C("div",Z2e,[k.value?(y(),M(Pe,{key:0},[w.value.length?(y(),M("div",G2e,[(y(!0),M(Pe,null,pt(w.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,Y2e))),128))])):(y(),M("div",X2e,N(p(o)("sidebar.noEmojiResults")),1))],64)):(y(),M(Pe,{key:1},[f.value.length?(y(),M(Pe,{key:0},[C("div",J2e,N(p(o)("sidebar.recentEmojis")),1),C("div",Q2e,[(y(!0),M(Pe,null,pt(f.value,A=>(y(),M("button",{key:A,class:Re(["ep-e",{sel:A===e.current}]),type:"button",onClick:E=>m(A)},N(A),11,eve))),128))])],64)):ee("",!0),(y(!0),M(Pe,null,pt(p(d),A=>(y(),M(Pe,{key:A.id},[C("div",tve,N(p(o)(A.labelKey)),1),C("div",nve,[(y(!0),M(Pe,null,pt(A.emojis,E=>(y(),M("button",{key:E,class:Re(["ep-e",{sel:E===e.current}]),type:"button",onClick:P=>m(E)},N(E),11,ove))),128))])],64))),128))],64))]),j(p(hn),{separator:""}),j(p(hn),{role:"button",disabled:!(e.current&&e.removable),onClick:T[3]||(T[3]=A=>a("pick",null))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(o)("sidebar.removeEmoji")),1)]),_:1},8,["disabled"]),j(p(hn),{role:"button",onClick:g},{default:me(()=>[j(p(Te),{name:"sparkles",size:"sm"}),qe(" "+N(p(o)("sidebar.randomEmoji")),1)]),_:1})]),_:1},8,["aria-label"]))}}),ive=ft(sve,[["__scopeId","data-v-05e46bbb"]]),rve={class:"row"},lve={key:0,class:"lead","aria-hidden":"true"},ave={key:1,class:"unread-dot"},uve={class:"left"},cve=["onKeydown"],dve=["aria-label"],fve={class:"act"},pve={key:0,class:"ts"},hve={key:1,class:"st"},mve={key:1,class:"unread-dot"},gve={key:2,class:"ha"},vve={key:0,class:"sub"},yve={class:"sub-text"},kve=["aria-label"],bve={class:"menu-time"},Cve=et({__name:"SessionRow",props:{session:{},active:{type:Boolean},approvalCount:{default:0},questionCount:{default:0},unread:{type:Boolean,default:!1}},emits:["select","rename","renameStateChange","archive","fork","export","pin"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n;function r(ue){const Se=new Date(ue);if(Number.isNaN(Se.getTime()))return ue;const ze=_e=>String(_e).padStart(2,"0");return`${Se.getFullYear()}-${ze(Se.getMonth()+1)}-${ze(Se.getDate())} ${ze(Se.getHours())}:${ze(Se.getMinutes())}`}const l=R(()=>s.session.updatedAt?r(s.session.updatedAt):s.session.time),a=R(()=>s.session.cwdLabel!==void 0),u=R(()=>kE({busy:s.session.busy,unread:s.unread,renaming:W.value,questionCount:s.questionCount,approvalCount:s.approvalCount,pendingInteraction:s.session.pendingInteraction,lastTurnReason:s.session.lastTurnReason})),c=R(()=>u.value.showQuestionBadge),d=R(()=>u.value.showApprovalBadge),f=R(()=>u.value.showAbortedBadge),h=R(()=>u.value.showBusySpinner),m=R(()=>u.value.hasStatus),v=Z(!1),k=Z(null),w=Z({});function b(ue){const Se=ue.target;k.value?.el?.contains(Se)||g()}async function _(){$(),v.value=!0,setTimeout(()=>document.addEventListener("mousedown",b),0),window.addEventListener("resize",g),await yt()}function g(){v.value=!1,document.removeEventListener("mousedown",b),window.removeEventListener("resize",g)}bn(()=>{document.removeEventListener("mousedown",b),document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",g),window.removeEventListener("resize",$)});const x=R(()=>yE(s.session.title)),S=R(()=>{const ue=x.value.emoji;return ue?s.session.title.slice(ue.length):s.session.title}),T=Z(!1),A=Z(null),E=Z({});let P=null;function D(ue,Se,ze){const _e=A.value?.el,Ee=4,it=8,Fe=_e?.offsetHeight??0,Oe=_e?.offsetWidth??0;let Ge=ue.bottom+Ee,at=!1;Ge+Fe>window.innerHeight-it&&(Ge=Math.max(it,ue.top-Fe-Ee),at=!0);const Tt=ze??(Se==="left"?ue.left:ue.right-Oe),Bt=Math.max(it,Math.min(Tt,window.innerWidth-Oe-it)),Yt=ze===void 0?Se:`${Math.round(Math.min(Math.max(ze-Bt,0),Oe))}px`;E.value={top:`${Math.round(Ge)}px`,left:`${Math.round(Bt)}px`,transformOrigin:`${Yt} ${at?"bottom":"top"}`,"--menu-pop-shift":at?"2px":"-2px"}}async function I(ue,Se,ze="left",_e){const Ee=Se??ue?.getBoundingClientRect();if(Ee){if(T.value){$();return}g(),P=ue??null,T.value=!0,setTimeout(()=>document.addEventListener("mousedown",B),0),window.addEventListener("keydown",H,!0),window.addEventListener("resize",$),await yt(),D(Ee,ze,_e)}}function $(){T.value=!1,P=null,document.removeEventListener("mousedown",B),window.removeEventListener("keydown",H,!0),window.removeEventListener("resize",$)}function B(ue){const Se=ue.target;A.value?.el?.contains(Se)||P?.contains(Se)||$()}function H(ue){ue.key==="Escape"&&(A.value?.isComposingKeyEvent(ue)||(ue.preventDefault(),ue.stopPropagation(),$()))}function O(ue){return ue.clientX||ue.clientY?new DOMRect(ue.clientX,ue.clientY,0,0):void 0}function F(ue){ue.stopPropagation();const Se=ue;I(Se.currentTarget,O(Se),"left",Se.clientX||void 0)}function U(ue){const Se=k.value?.el,ze=ue,_e=O(ze)??Se?.getBoundingClientRect();g(),I(Se,_e,"left",ze.clientX||void 0)}function z(ue){if($(),ue===x.value.emoji)return;const Se=dQ(s.session.title,ue);Se&&Se!==s.session.title&&i("rename",s.session.id,Se)}const W=Z(!1),K=Z(""),V=Z(null),{handleCompositionStart:ie,handleCompositionEnd:ne,isComposingKeyEvent:X}=Ar();async function le(){g(),$(),W.value=!0,K.value=s.session.title,await yt();try{V.value?.focus(),V.value?.select()}catch{}}function Ie(){const ue=K.value.trim();ue&&ue!==s.session.title&&i("rename",s.session.id,ue),W.value=!1}function de(ue){X(ue)||Ie()}function pe(ue){X(ue)||ve()}function ve(){W.value=!1}Je(W,ue=>i("renameStateChange",ue));async function oe(ue){W.value||(ue.preventDefault(),ue.stopPropagation(),v.value&&g(),await _(),ye(ue))}function ye(ue){const Se=k.value?.el,ze=8,_e=Se?.offsetHeight??0,Ee=Se?.offsetWidth??0;let it=ue.clientY,Fe=!1;it+_e>window.innerHeight-ze&&(it=Math.max(ze,ue.clientY-_e),Fe=!0);let Oe=ue.clientX,Ge=!1;Oe+Ee>window.innerWidth-ze&&(Oe=Math.max(ze,ue.clientX-Ee),Ge=!0),w.value={top:`${Math.round(it)}px`,left:`${Math.round(Oe)}px`,transformOrigin:`${Fe?"bottom":"top"} ${Ge?"right":"left"}`,"--menu-pop-shift":Fe?"2px":"-2px"}}const G=Z(!1),Y=Z(!1);async function fe(){const ue=await Zs(s.session.id);G.value=ue,Y.value=!ue,setTimeout(()=>{G.value=!1,Y.value=!1,g()},1500)}function we(){g(),i("fork",s.session.id)}function ge(){g(),i("export",s.session.id)}function Q(){g(),i("pin",s.session.id)}function te(){g(),i("archive",s.session.id)}t({closeMenu:g});function ce(){const ue=s.session.pullRequest?.url;ue&&window.open(ue,"_blank","noopener")}return(ue,Se)=>(y(),M("div",{class:Re(["se",{on:e.active,flat:a.value}]),onClick:Se[7]||(Se[7]=ze=>i("select",e.session.id)),onContextmenu:oe},[C("div",rve,[a.value?ee("",!0):(y(),M("span",lve,[e.session.busy?(y(),he(p(Ao),{key:0,size:"sm"})):e.unread?(y(),M("span",ave)):ee("",!0)])),C("div",uve,[W.value?Bn((y(),M("input",{key:0,ref_key:"renameInputRef",ref:V,"onUpdate:modelValue":Se[0]||(Se[0]=ze=>K.value=ze),class:"rename-input",onClick:Se[1]||(Se[1]=It(()=>{},["stop"])),onKeydown:[xl(It(de,["stop"]),["enter"]),xl(It(pe,["stop"]),["esc"])],onCompositionstart:Se[2]||(Se[2]=(...ze)=>p(ie)&&p(ie)(...ze)),onCompositionend:Se[3]||(Se[3]=(...ze)=>p(ne)&&p(ne)(...ze)),onBlur:Ie},null,40,cve)),[[ai,K.value]]):(y(),M("span",{key:1,class:"t",onDblclick:It(le,["stop"])},[x.value.emoji?(y(),M("button",{key:0,type:"button",class:"emoji","aria-label":p(o)("sidebar.setEmoji"),onClick:It(F,["stop"]),onDblclick:Se[4]||(Se[4]=It(()=>{},["stop"]))},N(x.value.emoji),41,dve)):ee("",!0),qe(N(S.value),1)],32))]),C("span",fve,[j(p(pn),{text:p(o)("workspace.awaitingAnswerTitle")},{default:me(()=>[c.value?(y(),he(p(Vr),{key:0,variant:"info",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingAnswer")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.awaitingPermissionTitle")},{default:me(()=>[d.value?(y(),he(p(Vr),{key:0,variant:"warning",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.awaitingPermission")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(o)("workspace.abortedTitle")},{default:me(()=>[f.value?(y(),he(p(Vr),{key:0,variant:"danger",size:"sm"},{default:me(()=>[qe(N(p(o)("workspace.aborted")),1)]),_:1})):ee("",!0)]),_:1},8,["text"]),!a.value||!m.value?(y(),M("span",pve,N(e.session.time),1)):h.value||e.unread?(y(),M("span",hve,[h.value?(y(),he(p(Ao),{key:0,size:"sm"})):(y(),M("span",mve))])):ee("",!0),W.value?ee("",!0):(y(),M("span",gve,[j(p(pn),{text:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")},{default:me(()=>[j(p(gn),{class:"pin-btn",size:"sm",label:e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin"),onClick:It(Q,["stop"])},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin"},null,8,["name"])]),_:1},8,["label"])]),_:1},8,["text"]),j(p(pn),{text:p(o)("sidebar.archive")},{default:me(()=>[j(p(gn),{class:"archive-btn",size:"sm",label:p(o)("sidebar.archive"),onClick:It(te,["stop"])},{default:me(()=>[j(p(Te),{name:"archive"})]),_:1},8,["label"])]),_:1},8,["text"])]))])]),e.session.cwdLabel!==void 0?(y(),M("div",vve,[j(p(Te),{class:"sub-icon",name:"folder-closed",size:"sm"}),C("span",yve,N(e.session.cwdLabel),1),e.session.pullRequest?(y(),M("button",{key:0,type:"button",class:Re(["pr",`pr--${e.session.pullRequest.state}`]),"aria-label":`PR #${e.session.pullRequest.number}`,onClick:It(ce,["stop"])},[j(p(Te),{name:"git-pull-request",size:"sm"}),C("span",null,"#"+N(e.session.pullRequest.number),1)],10,kve)):ee("",!0)])):ee("",!0),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[v.value?(y(),he(p(Cl),{key:0,ref_key:"menuRef",ref:k,class:"menu",style:Zt(w.value),onClick:Se[5]||(Se[5]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{danger:Y.value,onClick:fe},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(Y.value?p(o)("sidebar.copyFailed"):G.value?p(o)("sidebar.copied"):p(o)("sidebar.copySessionId")),1)]),_:1},8,["danger"]),j(p(hn),{separator:""}),j(p(hn),{onClick:le},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(o)("sidebar.rename")),1)]),_:1}),j(p(hn),{onClick:U},{default:me(()=>[j(p(Te),{name:"emoji",size:"sm"}),qe(" "+N(p(o)("sidebar.setEmoji")),1)]),_:1}),j(p(hn),{onClick:we},{default:me(()=>[j(p(Te),{name:"git-fork",size:"sm"}),qe(" "+N(p(o)("sidebar.fork")),1)]),_:1}),j(p(hn),{onClick:ge},{default:me(()=>[j(p(Te),{name:"download",size:"sm"}),qe(" "+N(p(o)("sidebar.export")),1)]),_:1}),j(p(hn),{onClick:Q},{default:me(()=>[j(p(Te),{name:e.session.pinned?"unpin":"pin",size:"sm"},null,8,["name"]),qe(" "+N(e.session.pinned?p(o)("sidebar.unpin"):p(o)("sidebar.pin")),1)]),_:1}),j(p(hn),{onClick:te},{default:me(()=>[j(p(Te),{name:"archive",size:"sm"}),qe(" "+N(p(o)("sidebar.archive")),1)]),_:1}),j(p(hn),{separator:""}),C("div",bve,N(l.value),1)]),_:1},8,["style"])):ee("",!0)]),_:1})])),(y(),he(Zr,{to:"body"},[j(as,{name:"menu-pop"},{default:me(()=>[T.value?(y(),he(ive,{key:0,ref_key:"pickerRef",ref:A,class:"picker",style:Zt(E.value),current:x.value.emoji,removable:x.value.rest.length>0,onClick:Se[6]||(Se[6]=It(()=>{},["stop"])),onPick:z},null,8,["style","current","removable"])):ee("",!0)]),_:1})]))],34))}}),Z5=ft(Cve,[["__scopeId","data-v-341acfa2"]]),wve=["draggable"],_ve={class:"gh-top"},xve={class:"gh-name"},Sve=["inert"],Ave={key:0,class:"show-more-row"},Mve=["disabled"],Tve={class:"show-more-label"},Eve={key:1,class:"show-more-sep","aria-hidden":"true"},Ive={class:"show-more-label"},Lve={key:1,class:"group-empty"},$ve=et({__name:"WorkspaceGroup",props:{group:{},activeWorkspaceId:{},activeId:{},renamingId:{},renameValue:{},renameInputRef:{},pendingBySession:{},unreadBySession:{},wsMenuOpenId:{},dragging:{type:Boolean},isCollapsed:{type:Function},visibleLimit:{type:Function},pinnedDragSession:{}},emits:["groupClick","groupContextmenu","toggleWsMenu","createInWorkspace","selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","dropPinnedSession","expand","collapse","confirmRename","cancelRename","updateRenameValue","wsDragstart","wsDragend"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R({get:()=>o.renameValue,set:P=>s("updateRenameValue",P)}),r=Z(!1),l=R(()=>o.pinnedDragSession!=null),a=R(()=>o.pinnedDragSession?.workspaceId===o.group.workspace.id);function u(P){if(o.pinnedDragSession!=null){if(!a.value){P.dataTransfer&&(P.dataTransfer.dropEffect="none");return}P.preventDefault(),P.dataTransfer&&(P.dataTransfer.dropEffect="move"),r.value=!0}}function c(P){o.pinnedDragSession==null||!a.value||(P.preventDefault(),r.value=!1,s("dropPinnedSession",o.pinnedDragSession.id))}function d(P){P.currentTarget.contains(P.relatedTarget)||(r.value=!1)}const f=R(()=>o.visibleLimit(o.group.workspace.id)??o.group.initialCount),h=R(()=>{const P=o.group.sessions.slice(0,f.value);if(o.activeId&&!P.some(D=>D.id===o.activeId)){const D=o.group.sessions.find(I=>I.id===o.activeId);if(D)return[...P,D]}return P}),m=R(()=>o.group.sessions.length>f.value||o.group.hasMore||o.group.loadingMore),v=R(()=>f.value>o.group.initialCount);function k(P){o.renameInputRef.value=P instanceof HTMLInputElement?P:null}const{handleCompositionStart:w,handleCompositionEnd:b,isComposingKeyEvent:_}=Ar();function g(P){_(P)||s("confirmRename")}function x(P){_(P)||s("cancelRename")}const S=Z(null);function T(P){o.renamingId!==o.group.workspace.id&&s("groupContextmenu",o.group.workspace,P)}function A(P){P.dataTransfer&&(P.dataTransfer.effectAllowed="move",P.dataTransfer.setData("text/plain",o.group.workspace.id),s("wsDragstart",o.group.workspace.id))}function E(P,D){D.dataTransfer&&(D.dataTransfer.effectAllowed="move",D.dataTransfer.setData(Bf,P),D.dataTransfer.setData("text/plain",P))}return(P,D)=>(y(),M("div",{class:Re(["group",{dragging:e.dragging,"pinned-drag-active":l.value&&a.value,"pinned-drop-hover":r.value,"pinned-drop-blocked":l.value&&!a.value}]),onDragover:u,onDrop:c,onDragleave:d},[C("div",{class:Re(["gh",{on:e.group.workspace.id===e.activeWorkspaceId&&e.activeId==="",collapsed:e.isCollapsed(e.group.workspace.id)}]),draggable:e.renamingId!==e.group.workspace.id,onClick:D[7]||(D[7]=It(I=>s("groupClick",e.group.workspace.id,I),["stop"])),onContextmenu:T,onDragstart:A,onDragend:D[8]||(D[8]=I=>s("wsDragend"))},[C("div",_ve,[e.isCollapsed(e.group.workspace.id)?(y(),he(p(Te),{key:0,class:"gh-folder",name:"folder-closed"})):(y(),he(p(Te),{key:1,class:"gh-folder",name:"folder"})),e.renamingId!==e.group.workspace.id?(y(),he(p(pn),{key:2,text:e.group.workspace.root},{default:me(()=>[C("span",xve,N(e.group.workspace.name),1)]),_:1},8,["text"])):Bn((y(),M("input",{key:3,ref:k,"onUpdate:modelValue":D[0]||(D[0]=I=>i.value=I),class:"gh-rename",type:"text",onKeydown:[xl(g,["enter"]),xl(x,["esc"])],onCompositionstart:D[1]||(D[1]=(...I)=>p(w)&&p(w)(...I)),onCompositionend:D[2]||(D[2]=(...I)=>p(b)&&p(b)(...I)),onBlur:D[3]||(D[3]=I=>s("cancelRename")),onClick:D[4]||(D[4]=It(()=>{},["stop"]))},null,544)),[[ai,i.value]]),e.renamingId!==e.group.workspace.id?(y(),M("div",{key:4,class:Re(["gh-actions",{open:e.wsMenuOpenId===e.group.workspace.id}])},[j(p(gn),{class:Re(["gh-more",{open:e.wsMenuOpenId===e.group.workspace.id}]),size:"sm",label:p(n)("sidebar.options"),tooltip:p(n)("sidebar.options"),"aria-haspopup":"menu","aria-expanded":e.wsMenuOpenId===e.group.workspace.id,onClick:D[5]||(D[5]=It(I=>s("toggleWsMenu",e.group.workspace,I),["stop"]))},{default:me(()=>[j(p(Te),{name:"dots-horizontal"})]),_:1},8,["class","label","tooltip","aria-expanded"]),j(p(gn),{class:"gh-add",size:"sm",label:p(n)("workspace.newInGroup"),tooltip:p(n)("workspace.newInGroup"),onClick:D[6]||(D[6]=It(I=>s("createInWorkspace",e.group.workspace.id),["stop"]))},{default:me(()=>[j(p(Te),{name:"chat-new"})]),_:1},8,["label","tooltip"])],2)):ee("",!0)])],42,wve),C("div",{class:Re(["group-sessions",{collapsed:e.isCollapsed(e.group.workspace.id)}]),inert:e.isCollapsed(e.group.workspace.id)},[(y(!0),M(Pe,null,pt(h.value,I=>(y(),he(Z5,{key:I.id,session:I,active:I.id===e.activeId,"approval-count":e.pendingBySession[I.id]?.approvals??0,"question-count":e.pendingBySession[I.id]?.questions??0,unread:e.unreadBySession[I.id]??!1,draggable:S.value!==I.id,onDragstart:$=>E(I.id,$),onRenameStateChange:$=>S.value=$?I.id:null,onSelect:D[9]||(D[9]=$=>s("selectSession",$)),onRename:D[10]||(D[10]=($,B)=>s("renameSession",$,B)),onArchive:D[11]||(D[11]=$=>s("archiveSession",$)),onFork:D[12]||(D[12]=$=>s("forkSession",$)),onExport:D[13]||(D[13]=$=>s("exportSession",$)),onPin:D[14]||(D[14]=$=>s("pinSession",$))},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),m.value||v.value?(y(),M("div",Ave,[m.value?(y(),M("button",{key:0,class:"show-more",disabled:e.group.loadingMore,onClick:D[15]||(D[15]=It(I=>s("expand",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-down",size:"sm"}),C("span",Tve,N(e.group.loadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.showMore")),1)],8,Mve)):ee("",!0),m.value&&v.value?(y(),M("span",Eve,"·")):ee("",!0),v.value?(y(),M("button",{key:2,class:"show-more",onClick:D[16]||(D[16]=It(I=>s("collapse",e.group.workspace.id),["stop"]))},[j(p(Te),{name:"chevron-up",size:"sm"}),C("span",Ive,N(p(n)("sidebar.showLess")),1)])):ee("",!0)])):ee("",!0),e.group.sessions.length===0?(y(),M("div",Lve,N(e.group.pinnedCount>0?p(n)("sidebar.allPinned",{count:e.group.pinnedCount}):p(n)("sidebar.noSessions")),1)):ee("",!0)],10,Sve)],34))}}),Nve=ft($ve,[["__scopeId","data-v-9586bfbe"]]),Fve={class:"pinned-label"},Rve={class:"pinned-title"},Ove={key:0,class:"pinned-rows"},Pve=["draggable","onDragstart","onDragover","onDrop"],Dve=et({__name:"PinnedSessionList",props:{sessions:{},activeId:{},pendingBySession:{},unreadBySession:{}},emits:["selectSession","renameSession","archiveSession","forkSession","exportSession","pinSession","pinSessionAt","sessionDragStart","sessionDragEnd","reorder"],setup(e,{expose:t,emit:n}){const{t:o}=Nt(),s=e,i=n,r=Z(kQ());function l(){r.value=!r.value,M3(r.value)}function a(){r.value&&(r.value=!1,M3(!1))}t({expand:a});const u=Z(null),c=Z(null),d=Z(null);function f(x,S){if(!S.dataTransfer)return;S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("text/plain",x),u.value=x;const T=s.sessions.find(A=>A.id===x)?.workspaceId;T!==void 0&&i("sessionDragStart",x,T)}function h(){u.value=null,c.value=null,i("sessionDragEnd")}Je(()=>s.sessions,x=>{u.value!==null&&!x.some(S=>S.id===u.value)&&(u.value=null,c.value=null)});function m(x){const S=x.currentTarget.getBoundingClientRect();return x.clientYP.id),T,x,A));return}const E=S.dataTransfer?.getData(Bf);E&&i("pinSessionAt",E,x,A)}function b(x){if(u.value===null&&!v(x))return;x.preventDefault(),x.dataTransfer&&(x.dataTransfer.dropEffect="move");const S=s.sessions[s.sessions.length-1];S!==void 0&&(c.value={id:S.id,position:"after"})}function _(x){const S=s.sessions.map(E=>E.id),T=u.value;if(c.value=null,u.value=null,T!==null){const E=S[S.length-1];E!==void 0&&T!==E&&i("reorder",[...S.filter(P=>P!==T),T]);return}const A=x.dataTransfer?.getData(Bf);A&&i("pinSessionAt",A,S[S.length-1]??null,"after")}function g(x){x.currentTarget.contains(x.relatedTarget)||(c.value=null)}return(x,S)=>(y(),M("div",{class:"pinned",onDragover:b,onDrop:_,onDragleave:g},[C("div",Fve,[C("span",Rve,N(p(o)("sidebar.pinned")),1),j(p(gn),{class:Re(["pinned-toggle",{"pinned-toggle--on":r.value}]),size:"sm",label:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),tooltip:r.value?p(o)("sidebar.expandPinned"):p(o)("sidebar.collapsePinned"),onClick:It(l,["stop"])},{default:me(()=>[r.value?(y(),he(p(Te),{key:0,name:"chevron-right"})):(y(),he(p(Te),{key:1,name:"chevron-down"}))]),_:1},8,["class","label","tooltip"])]),r.value?ee("",!0):(y(),M("div",Ove,[(y(!0),M(Pe,null,pt(e.sessions,T=>(y(),M("div",{key:T.id,class:Re(["pin-drop-target",{dragging:u.value===T.id,"drop-before":c.value?.id===T.id&&c.value.position==="before","drop-after":c.value?.id===T.id&&c.value.position==="after"}]),draggable:d.value!==T.id,onDragstart:A=>f(T.id,A),onDragend:h,onDragover:It(A=>k(A,T.id),["stop"]),onDrop:It(A=>w(T.id,A),["stop"])},[j(Z5,{session:T,active:T.id===e.activeId,"approval-count":e.pendingBySession[T.id]?.approvals??0,"question-count":e.pendingBySession[T.id]?.questions??0,unread:e.unreadBySession[T.id]??!1,onRenameStateChange:A=>d.value=A?T.id:null,onSelect:S[0]||(S[0]=A=>i("selectSession",A)),onRename:S[1]||(S[1]=(A,E)=>i("renameSession",A,E)),onArchive:S[2]||(S[2]=A=>i("archiveSession",A)),onFork:S[3]||(S[3]=A=>i("forkSession",A)),onExport:S[4]||(S[4]=A=>i("exportSession",A)),onPin:S[5]||(S[5]=A=>i("pinSession",A))},null,8,["session","active","approval-count","question-count","unread","onRenameStateChange"])],42,Pve))),128))]))],32))}}),Bve=ft(Dve,[["__scopeId","data-v-aec340eb"]]),Hve={class:"ch"},zve={class:"ch-brand"},Wve={class:"ch-tail"},Uve={class:"search-input"},jve={class:"side-section-label"},Vve={class:"side-section-title"},qve={class:"side-section-actions"},Kve={key:0,class:"empty"},Zve=["onDragover","onDrop"],Gve={key:0,class:"empty"},Yve={key:1,class:"show-more-row"},Xve=["disabled"],Jve={class:"show-more-label"},Qve={class:"folder-drop-card"},e9e={class:"view-menu-label"},t9e={class:"view-menu-check"},n9e={class:"view-menu-check"},o9e=!1,s9e=1e3,i9e=et({__name:"Sidebar",props:{activeWorkspace:{default:null},activeWorkspaceId:{default:null},sessions:{},groups:{},pinnedSessions:{default:()=>[]},flatSessions:{default:()=>[]},flatHasMore:{type:Boolean,default:!1},flatLoadingMore:{type:Boolean,default:!1},initialized:{type:Boolean,default:!1},activeId:{},attentionBySession:{default:()=>({})},pendingBySession:{default:()=>({})},unreadBySession:{default:()=>({})},colWidth:{default:220},collapsed:{type:Boolean,default:!1},dragging:{type:Boolean,default:!1}},emits:["select","create","createInWorkspace","selectWorkspace","addWorkspace","addWorkspacePaths","rename","archive","fork","export","pin","reorderPinned","pinAt","unpin","renameWorkspace","deleteWorkspace","reorderWorkspaces","loadMoreSessions","loadAllSessions","ensureFlatSessions","loadMoreFlatSessions","openSettings","login","collapse"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!1),r=c()?["⌘","K"]:["Ctrl","K"],l=c()?["⌃","⇧","O"]:["Ctrl","Shift","O"];function a(){s("loadAllSessions"),i.value=!0}function u(Qe){(Qe.metaKey||Qe.ctrlKey)&&(Qe.key.toLowerCase()==="k"?(Qe.preventDefault(),a()):!Qe.metaKey&&Qe.ctrlKey&&Qe.shiftKey&&Qe.key.toLowerCase()==="o"&&(Qe.preventDefault(),s("create")))}dn(()=>window.addEventListener("keydown",u)),Vn(()=>window.removeEventListener("keydown",u));function c(){if(typeof navigator>"u")return!1;if(/Mac|iPod|iPhone|iPad/.test(navigator.platform))return!0;const Qe=navigator.userAgentData;return Qe?.platform==="macOS"||Qe?.platform==="iOS"}const d=Z(null),f=Z(!1),h=Z(!1),m=Z(!1);let v=null;function k(Qe=d.value){Qe&&(f.value=Qe.scrollTop>0,h.value=Qe.scrollTop+Qe.clientHeight{m.value=!1,v=null},900)}let b=null;dn(()=>{yt(()=>{k(),typeof ResizeObserver=="function"&&d.value&&(b=new ResizeObserver(()=>k()),b.observe(d.value))})}),Dp(()=>k()),Vn(()=>{b?.disconnect(),v&&clearTimeout(v)});const _=Z(new Set(yQ()));function g(Qe){return _.value.has(Qe)}function x(Qe){const st=new Set(_.value);st.has(Qe)?st.delete(Qe):st.add(Qe),_.value=st,p9(st)}function S(){const Qe=new Set(o.groups.map(st=>st.workspace.id));_.value=Qe,p9(Qe)}function T(){const Qe=new Set;_.value=Qe,p9(Qe)}const A=R(()=>o.groups.length>0&&o.groups.every(Qe=>_.value.has(Qe.workspace.id))),E=Z(new Map);function P(Qe){return E.value.get(Qe)}function D(Qe){const st=o.groups.find(kn=>kn.workspace.id===Qe);if(!st)return;const Ct=(E.value.get(Qe)??st.initialCount)+O5,Qt=new Map(E.value);Qt.set(Qe,Ct),E.value=Qt,st.sessions.lengthkn.workspace.id),st,Qe,Ct);s("reorderWorkspaces",Qt)}const W=Z(null);function K(Qe,st){W.value={id:Qe,workspaceId:st}}function V(){W.value=null}function ie(Qe){W.value=null,s("unpin",Qe)}const ne=Z(bQ());function X(Qe){ne.value!==Qe&&(ne.value=Qe,CQ(Qe),Qe==="flat"&&s("ensureFlatSessions"))}Je(()=>o.initialized,Qe=>{Qe&&ne.value==="flat"&&s("ensureFlatSessions")},{immediate:!0});const le=Z(!1),Ie=Z({}),de=Z(null);function pe(Qe){const st=Qe.target;st.closest(".view-menu")||st.closest(".side-section-view")||oe()}async function ve(Qe){if(le.value){oe();return}const st=Qe.currentTarget;le.value=!0,document.addEventListener("mousedown",pe),window.addEventListener("resize",oe),await yt();const Ct=de.value?.el,Qt=st.getBoundingClientRect(),kn=4,Ko=8,Eo=Ct?.offsetHeight??0,bo=Ct?.offsetWidth??0;let Ns=Qt.bottom+kn,Do=!1;Ns+Eo>window.innerHeight-Ko&&(Ns=Math.max(Ko,Qt.top-Eo-kn),Do=!0);let Io=Qt.right-bo;IoSn.value?.focus())}function Cn(){const Qe=Tt.value,st=Bt.value.trim();Qe&&st&&st!==Yt.value&&s("renameWorkspace",Qe,st),Tt.value=null}function Mn(){Tt.value=null}function We(Qe){Bt.value=Qe}const tt=Z(!1),Ue=Z(null),Lt=Z({}),gt=Z(null);function wn(Qe){gt.value?.el&&!gt.value.el.contains(Qe.target)&&go()}function yn(Qe,st){st.preventDefault(),st.stopPropagation(),Ue.value=Qe,Lt.value={top:`${st.clientY}px`,left:`${st.clientX}px`,transformOrigin:"top left","--menu-pop-shift":"-2px"},tt.value=!0,document.addEventListener("mousedown",wn,!0)}function go(){tt.value=!1,document.removeEventListener("mousedown",wn,!0),Ue.value=null}function qt(){Ue.value&&Zs(Ue.value.root),go()}function ps(){Ue.value&&en(Ue.value.id,Ue.value.name),go()}function xs(){const Qe=Ue.value;Qe&&(go(),s("deleteWorkspace",Qe.id))}const _n=Z(null),In=Z(null),To=Z({}),lo=Z(null);function St(Qe){const st=Qe.target;st.closest(".gh-more")||st.closest(".ws-menu")||Jo()}async function hs(Qe,st){if(_n.value===Qe.id){Jo();return}const Ct=st.currentTarget;In.value=Qe,_n.value=Qe.id,document.addEventListener("mousedown",St),window.addEventListener("resize",Jo),await yt();const Qt=lo.value?.el,kn=Ct.getBoundingClientRect(),Ko=4,Eo=8,bo=Qt?.offsetHeight??0,Ns=Qt?.offsetWidth??0;let Do=kn.bottom+Ko,Io=!1;Do+bo>window.innerHeight-Eo&&(Do=Math.max(Eo,kn.top-bo-Ko),Io=!0);let Qo=kn.right-Ns;Qo{document.removeEventListener("mousedown",wn,!0),document.removeEventListener("mousedown",St),document.removeEventListener("mousedown",pe),window.removeEventListener("resize",Jo),window.removeEventListener("resize",oe)});const no=Z(null);let $s;function Xs(){const Qe=no.value;Qe&&(Qe.classList.remove("blink-now"),Qe.getBoundingClientRect(),Qe.classList.add("blink-now"),clearTimeout($s),$s=setTimeout(()=>Qe.classList.remove("blink-now"),300))}const ci=zr(()=>jo(()=>import("./DesignSystemView-xF63Uyfo.js"),__vite__mapDeps([8,9]))),Oo=Z(!1);let vo,Po=!1;function co(Qe){Po=!1,clearTimeout(vo),Qe.currentTarget.setPointerCapture?.(Qe.pointerId),vo=setTimeout(()=>{Po=!0,Oo.value=!0},s9e)}function Tn(Qe){clearTimeout(vo);const st=Qe.currentTarget;st.hasPointerCapture?.(Qe.pointerId)&&st.releasePointerCapture(Qe.pointerId)}function fo(){if(Po){Po=!1;return}Xs()}return Vn(()=>{clearTimeout(vo)}),(Qe,st)=>(y(),M("aside",{class:Re(["side",{"macos-desktop":p(rc),collapsed:e.collapsed,"no-anim":e.dragging}]),style:Zt({width:e.collapsed?"0px":e.colWidth+"px"})},[C("div",{class:"col",style:Zt({width:e.colWidth+"px"}),onDragenter:Fe,onDragover:Oe,onDragleave:Ge,onDrop:at},[C("div",Hve,[C("div",zve,[p(rc)?ee("",!0):(y(),M(Pe,{key:0},[(y(),M("svg",{ref_key:"logoRef",ref:no,class:"ch-logo",viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:fo,onPointerdown:co,onPointerup:Tn,onPointercancel:Tn},[...st[31]||(st[31]=[iu('',2)])],544)),st[32]||(st[32]=C("span",{class:"ch-name"},"Kimi Code",-1))],64))]),C("div",Wve,[p(rc)?ee("",!0):(y(),he(p(gn),{key:0,class:"ch-collapse",size:"sm",label:p(n)("sidebar.collapseSidebar"),tooltip:p(n)("sidebar.collapseSidebar"),onClick:st[0]||(st[0]=It(Ct=>s("collapse"),["stop"]))},{default:me(()=>[j(p(Te),{name:"panel-collapse"})]),_:1},8,["label","tooltip"])),j(b0e)])]),C("div",{class:Re(["sidebar-actions",{"sidebar-actions--has-workspace-action":o9e}])},[C("button",{class:"btn-new-chat",type:"button",onClick:st[1]||(st[1]=It(Ct=>s("create"),["stop"]))},[j(p(Te),{name:"chat-new"}),C("span",null,N(p(n)("sidebar.newChat")),1),j(p(oa),{keys:p(l)},null,8,["keys"])]),ee("",!0),C("button",{class:"search",type:"button",onClick:a},[j(p(Te),{class:"search-icon",name:"search"}),C("span",Uve,N(p(n)("sidebar.search")),1),j(p(oa),{keys:p(r)},null,8,["keys"])])],2),ne.value==="flat"||e.groups.length>0?(y(),M("div",{key:0,class:Re(["sessions-head",{"sessions-head--scrolled":f.value}])},[e.pinnedSessions.length>0?(y(),he(Bve,{key:0,ref_key:"pinnedListRef",ref:ue,sessions:e.pinnedSessions,"active-id":e.activeId,"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,onSelectSession:ce,onRenameSession:st[3]||(st[3]=(Ct,Qt)=>s("rename",Ct,Qt)),onArchiveSession:st[4]||(st[4]=Ct=>s("archive",Ct)),onForkSession:st[5]||(st[5]=Ct=>s("fork",Ct)),onExportSession:st[6]||(st[6]=Ct=>s("export",Ct)),onPinSession:Se,onPinSessionAt:ze,onSessionDragStart:K,onSessionDragEnd:V,onReorder:st[7]||(st[7]=Ct=>s("reorderPinned",Ct))},null,8,["sessions","active-id","pending-by-session","unread-by-session"])):ee("",!0),C("div",jve,[C("span",Vve,N(p(n)("sidebar.sessionsHeader")),1),C("div",qve,[ne.value==="grouped"?(y(),he(p(gn),{key:0,class:"side-section-toggle",size:"sm",label:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),tooltip:A.value?p(n)("sidebar.expandAll"):p(n)("sidebar.collapseAll"),onClick:st[8]||(st[8]=It(Ct=>A.value?T():S(),["stop"]))},{default:me(()=>[A.value?(y(),he(p(Te),{key:0,name:"expand"})):(y(),he(p(Te),{key:1,name:"collapse"}))]),_:1},8,["label","tooltip"])):ee("",!0),j(p(pn),{text:p(n)("sidebar.viewSwitcher")},{default:me(()=>[j(p(gn),{class:"side-section-toggle side-section-view",size:"sm",label:p(n)("sidebar.viewSwitcher"),onClick:It(ve,["stop"])},{default:me(()=>[j(p(Te),{name:"list-settings"})]),_:1},8,["label"])]),_:1},8,["text"])])])],2)):ee("",!0),C("div",{ref_key:"sessionsEl",ref:d,class:Re(["sessions",{scrolling:m.value,"pinned-drag-active":ne.value==="flat"&&W.value!==null,"flat-pinned-drop-hover":fe.value}]),onScroll:w,onDragover:we,onDrop:ge,onDragleave:Q},[ne.value==="grouped"?(y(),M(Pe,{key:0},[e.groups.length===0?(y(),M("div",Kve,N(p(n)("workspace.noWorkspace")),1)):(y(!0),M(Pe,{key:1},pt(e.groups,Ct=>(y(),M("div",{key:Ct.workspace.id,class:Re(["ws-drop-target",{"drop-before":B.value?.id===Ct.workspace.id&&B.value.position==="before","drop-after":B.value?.id===Ct.workspace.id&&B.value.position==="after"}]),onDragover:Qt=>U(Qt,Ct.workspace.id),onDrop:Qt=>z(Ct.workspace.id)},[j(Nve,{group:Ct,"active-workspace-id":e.activeWorkspaceId,"active-id":e.activeId,"renaming-id":Tt.value,"rename-value":Bt.value,"rename-input-ref":on(),"pending-by-session":e.pendingBySession,"unread-by-session":e.unreadBySession,"ws-menu-open-id":_n.value,dragging:$.value===Ct.workspace.id,"is-collapsed":g,"visible-limit":P,"pinned-drag-session":W.value,onGroupClick:te,onGroupContextmenu:yn,onToggleWsMenu:hs,onCreateInWorkspace:st[9]||(st[9]=Qt=>s("createInWorkspace",Qt)),onSelectSession:ce,onRenameSession:st[10]||(st[10]=(Qt,kn)=>s("rename",Qt,kn)),onArchiveSession:st[11]||(st[11]=Qt=>s("archive",Qt)),onForkSession:st[12]||(st[12]=Qt=>s("fork",Qt)),onExportSession:st[13]||(st[13]=Qt=>s("export",Qt)),onPinSession:Se,onDropPinnedSession:ie,onExpand:D,onCollapse:I,onConfirmRename:Cn,onCancelRename:Mn,onUpdateRenameValue:We,onWsDragstart:H,onWsDragend:O},null,8,["group","active-workspace-id","active-id","renaming-id","rename-value","rename-input-ref","pending-by-session","unread-by-session","ws-menu-open-id","dragging","pinned-drag-session"])],42,Zve))),128))],64)):(y(),M(Pe,{key:1},[(y(!0),M(Pe,null,pt(e.flatSessions,Ct=>(y(),he(Z5,{key:Ct.id,session:Ct,active:Ct.id===e.activeId,"approval-count":e.pendingBySession[Ct.id]?.approvals??0,"question-count":e.pendingBySession[Ct.id]?.questions??0,unread:e.unreadBySession[Ct.id]??!1,draggable:G.value!==Ct.id,onDragstart:Qt=>Y(Ct.id,Qt),onRenameStateChange:Qt=>G.value=Qt?Ct.id:null,onSelect:ce,onRename:st[14]||(st[14]=(Qt,kn)=>s("rename",Qt,kn)),onArchive:st[15]||(st[15]=Qt=>s("archive",Qt)),onFork:st[16]||(st[16]=Qt=>s("fork",Qt)),onExport:st[17]||(st[17]=Qt=>s("export",Qt)),onPin:Se},null,8,["session","active","approval-count","question-count","unread","draggable","onDragstart","onRenameStateChange"]))),128)),e.flatSessions.length===0&&!e.flatHasMore&&e.pinnedSessions.length===0?(y(),M("div",Gve,N(p(n)("sidebar.noSessions")),1)):ee("",!0),e.flatHasMore?(y(),M("div",Yve,[C("button",{class:"show-more",disabled:e.flatLoadingMore,onClick:st[18]||(st[18]=It(Ct=>s("loadMoreFlatSessions"),["stop"]))},[C("span",Jve,N(e.flatLoadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.loadMore")),1),j(p(Te),{name:"chevron-down",size:"sm"})],8,Xve)])):ee("",!0)],64))],34),C("div",{class:Re(["side-footer",{"side-footer--shadowed":h.value}])},[j(V2e,{onLogin:st[19]||(st[19]=Ct=>s("login")),onOpenSettings:st[20]||(st[20]=Ct=>s("openSettings"))})],2),C("div",{class:Re(["folder-drop-overlay",{show:Ee.value}]),"aria-hidden":"true"},[C("div",Qve,[j(p(Te),{name:"folder",size:"lg"}),C("span",null,N(p(n)("sidebar.dropToAddWorkspace")),1)])],2)],36),j(as,{name:"menu-pop"},{default:me(()=>[tt.value?(y(),he(p(Cl),{key:0,ref_key:"ghMenuRef",ref:gt,class:"gh-menu",style:Zt(Lt.value),onClick:st[21]||(st[21]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:qt},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:ps},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:xs},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[_n.value!==null&&In.value?(y(),he(p(Cl),{key:0,ref_key:"wsMenuRef",ref:lo,class:"ws-menu",style:Zt(To.value),onClick:st[25]||(st[25]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{onClick:st[22]||(st[22]=Ct=>uo(In.value))},{default:me(()=>[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("sidebar.copyPath")),1)]),_:1}),j(p(hn),{class:"workspace-rename-item",onClick:st[23]||(st[23]=Ct=>Ys(In.value))},{default:me(()=>[j(p(Te),{name:"pencil",size:"sm"}),qe(" "+N(p(n)("sidebar.rename")),1)]),_:1}),j(p(hn),{danger:"",onClick:st[24]||(st[24]=Ct=>Nn(In.value))},{default:me(()=>[j(p(Te),{name:"close",size:"sm"}),qe(" "+N(p(n)("sidebar.removeWorkspace")),1)]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),j(as,{name:"menu-pop"},{default:me(()=>[le.value?(y(),he(p(Cl),{key:0,ref_key:"viewMenuRef",ref:de,class:"view-menu",style:Zt(Ie.value),onClick:st[28]||(st[28]=It(()=>{},["stop"]))},{default:me(()=>[C("div",e9e,N(p(n)("sidebar.viewGroup")),1),j(p(hn),{onClick:st[26]||(st[26]=Ct=>ye("flat"))},{default:me(()=>[j(p(Te),{name:"list",size:"sm"}),qe(" "+N(p(n)("sidebar.viewFlat"))+" ",1),C("span",t9e,[ne.value==="flat"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1}),j(p(hn),{onClick:st[27]||(st[27]=Ct=>ye("grouped"))},{default:me(()=>[j(p(Te),{name:"tree-view",size:"sm"}),qe(" "+N(p(n)("sidebar.viewGrouped"))+" ",1),C("span",n9e,[ne.value==="grouped"?(y(),he(p(Te),{key:0,name:"check",size:"sm"})):ee("",!0)])]),_:1})]),_:1},8,["style"])):ee("",!0)]),_:1}),i.value?(y(),he(uee,{key:0,sessions:e.sessions,"active-id":e.activeId,onSelect:ce,onClose:st[29]||(st[29]=Ct=>i.value=!1)},null,8,["sessions","active-id"])):ee("",!0),(y(),he(Zr,{to:"body"},[Oo.value?(y(),he(p(ci),{key:0,onClose:st[30]||(st[30]=Ct=>Oo.value=!1)})):ee("",!0)]))],6))}}),r9e=ft(i9e,[["__scopeId","data-v-a80a4ba6"]]),l9e=["aria-label"],a9e=et({__name:"ResizeHandle",props:{storageKey:{},defaultWidth:{},min:{},max:{},reverse:{type:Boolean},ariaLabel:{},applyLive:{}},emits:["update:width","update:dragging"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),{width:i,dragging:r,cursor:l,onPointerDown:a}=She({storageKey:n.storageKey,defaultWidth:n.defaultWidth,min:n.min,max:()=>n.max,reverse:n.reverse,applyLive:n.applyLive});return o("update:width",i.value),Je(i,u=>o("update:width",u)),Je(r,u=>o("update:dragging",u)),(u,c)=>(y(),M("div",{class:Re(["rh",{dragging:p(r)}]),style:Zt({cursor:p(l)}),role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel??p(s)("layout.resizeHandleAria"),onPointerdown:c[0]||(c[0]=(...d)=>p(a)&&p(a)(...d))},[...c[1]||(c[1]=[C("span",{class:"rh-bar","aria-hidden":"true"},null,-1)])],46,l9e))}}),Zx=ft(a9e,[["__scopeId","data-v-1c6dfdc5"]]),u9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c9e(e,t){return y(),M("svg",u9e,[...t[0]||(t[0]=[C("path",{d:"M12.0684 2.03418C12.5654 2.03421 12.9687 2.43755 12.9688 2.93457V11.0996H21.0654C21.5625 11.0996 21.9658 11.503 21.9658 12C21.9658 12.497 21.5625 12.9004 21.0654 12.9004H12.9688V21.0654C12.9687 21.5624 12.5654 21.9658 12.0684 21.9658C11.5713 21.9658 11.168 21.5625 11.168 21.0654V12.9004H2.93457C2.43751 12.9004 2.03418 12.4971 2.03418 12C2.03418 11.5029 2.43751 11.0996 2.93457 11.0996H11.168V2.93457C11.168 2.43753 11.5713 2.03418 12.0684 2.03418Z",fill:"currentColor"},null,-1)])])}const d9e=kt({name:"kimi-add",render:c9e}),f9e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function p9e(e,t){return y(),M("svg",f9e,[...t[0]||(t[0]=[C("path",{id:"p0",d:"M 0 -9.9 C -5.468 -9.9 -9.9 -5.468 -9.9 0 C -9.9 1.923 -9.351 3.719 -8.402 5.239 C -8.402 5.239 -9.483 7.821 -9.483 7.821 C -9.896 8.809 -9.171 9.9 -8.099 9.9 C -8.099 9.9 0 9.9 0 9.9 C 5.468 9.9 9.9 5.468 9.9 0 C 9.9 -5.468 5.468 -9.9 0 -9.9 Z M -8.1 0 C -8.1 -4.474 -4.474 -8.1 0 -8.1 C 4.473 -8.1 8.1 -4.474 8.1 0 C 8.1 4.473 4.473 8.1 -0.001 8.1 C -0.001 8.1 -7.648 8.1 -7.648 8.1 L -6.365 5.035 C -6.365 5.035 -6.648 4.629 -6.648 4.629 C -7.563 3.317 -8.1 1.723 -8.1 0 Z",transform:"matrix(1 0 0 1 12 12)",fill:"currentColor","fill-rule":"evenodd"},null,-1),C("path",{id:"p1",d:"M 3.6 0.5 L -2.6 0.5 M 0.5 -2.573 L 0.5 3.573",transform:"translate(11.5 11.5)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"},null,-1)])])}const h9e=kt({name:"kimi-add-conversation",render:p9e}),m9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g9e(e,t){return y(),M("svg",m9e,[...t[0]||(t[0]=[C("path",{d:"M15.0996 12C15.5967 12 16 12.4033 16 12.9004C15.9998 13.3973 15.5965 13.7998 15.0996 13.7998H8.90039C8.40346 13.7998 8.00021 13.3973 8 12.9004C8 12.4033 8.40333 12 8.90039 12H15.0996Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M19 3.2002C20.5464 3.2002 21.7998 4.4536 21.7998 6V7C21.7998 8.03565 21.2363 8.93754 20.4004 9.42188V17C20.4004 19.1539 18.6539 20.9004 16.5 20.9004H7.5C5.34609 20.9004 3.59961 19.1539 3.59961 17V9.42188C2.76374 8.93754 2.2002 8.03565 2.2002 7V6C2.2002 4.4536 3.4536 3.2002 5 3.2002H19ZM5.40039 17C5.40039 18.1598 6.3402 19.0996 7.5 19.0996H16.5C17.6598 19.0996 18.5996 18.1598 18.5996 17V9.7998H5.40039V17ZM4.89746 5.00488C4.39333 5.05621 4 5.48232 4 6V7L4.00488 7.10254C4.05278 7.57297 4.42703 7.94722 4.89746 7.99512L5 8H19C19.5523 8 20 7.55228 20 7V6C20 5.44772 19.5523 5 19 5H5L4.89746 5.00488Z",fill:"currentColor"},null,-1)])])}const v9e=kt({name:"kimi-archive",render:g9e}),y9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function k9e(e,t){return y(),M("svg",y9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 21.6387C11.7378 21.988 12.3059 21.987 12.6565 21.6364L18.1949 16.098C18.5464 15.7465 18.5464 15.1766 18.1949 14.8252C17.8434 14.4737 17.2736 14.4737 16.9221 14.8252L12.9201 18.8272V3.00002C12.9201 2.50297 12.5171 2.10003 12.0201 2.10003C11.523 2.10003 11.1201 2.50297 11.1201 3.00002V18.8383L7.07554 14.8229C6.7228 14.4727 6.15295 14.4747 5.80275 14.8275C5.45255 15.1802 5.45461 15.7501 5.80735 16.1003L11.386 21.6387Z",fill:"currentColor"},null,-1)])])}const b9e=kt({name:"kimi-arrow-down",render:k9e}),C9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function w9e(e,t){return y(),M("svg",C9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.16127 12.814C1.81197 12.4622 1.81299 11.8941 2.16357 11.5435L7.70203 6.00506C8.0535 5.65359 8.62335 5.65359 8.97482 6.00506C9.32629 6.35653 9.32629 6.92638 8.97482 7.27785L4.97276 11.2799H20.8C21.297 11.2799 21.7 11.6829 21.7 12.1799C21.7 12.677 21.297 13.0799 20.8 13.0799H4.96171L8.97712 17.1244C9.32732 17.4772 9.32526 18.047 8.97252 18.3972C8.61978 18.7474 8.04993 18.7454 7.69973 18.3926L2.16127 12.814Z",fill:"currentColor"},null,-1)])])}const _9e=kt({name:"kimi-arrow-left",render:w9e}),x9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function S9e(e,t){return y(),M("svg",x9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.4387 12.814C21.788 12.4622 21.787 11.8941 21.4364 11.5436L15.8979 6.0051C15.5464 5.65363 14.9766 5.65363 14.6251 6.0051C14.2737 6.35657 14.2737 6.92642 14.6251 7.27789L18.6272 11.28H2.79998C2.30293 11.28 1.89998 11.6829 1.89998 12.18C1.89998 12.677 2.30293 13.08 2.79998 13.08H18.6382L14.6228 17.1245C14.2726 17.4772 14.2747 18.0471 14.6274 18.3973C14.9802 18.7475 15.55 18.7454 15.9002 18.3927L21.4387 12.814Z",fill:"currentColor"},null,-1)])])}const A9e=kt({name:"kimi-arrow-right",render:S9e}),M9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function T9e(e,t){return y(),M("svg",M9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.386 2.36129C11.7378 2.01198 12.3059 2.013 12.6565 2.36358L18.1949 7.90204C18.5464 8.25351 18.5464 8.82336 18.1949 9.17483C17.8434 9.52631 17.2736 9.52631 16.9221 9.17483L12.9201 5.17277V21C12.9201 21.497 12.5171 21.9 12.0201 21.9C11.523 21.9 11.1201 21.497 11.1201 21V5.16172L7.07554 9.17713C6.7228 9.52733 6.15295 9.52527 5.80275 9.17253C5.45255 8.81979 5.45461 8.24995 5.80735 7.89975L11.386 2.36129Z",fill:"currentColor"},null,-1)])])}const E9e=kt({name:"kimi-arrow-up",render:T9e}),I9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function L9e(e,t){return y(),M("svg",I9e,[...t[0]||(t[0]=[C("path",{d:"M19.3027 5.9053C19.6542 5.55397 20.2247 5.55388 20.5761 5.9053C20.9273 6.25675 20.9273 6.82734 20.5761 7.17874L9.65911 18.0948C9.30773 18.4461 8.73814 18.446 8.38665 18.0948L3.42376 13.1328C3.0726 12.7814 3.07263 12.2118 3.42376 11.8604C3.77524 11.509 4.34575 11.5089 4.6972 11.8604L9.02239 16.1856L19.3027 5.9053Z",fill:"currentColor"},null,-1)])])}const $9e=kt({name:"kimi-check",render:L9e}),N9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function F9e(e,t){return y(),M("svg",N9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 16.7134C11.743 17.0627 12.3111 17.0617 12.6617 16.7111L19.6364 9.73641C19.9878 9.38494 19.9878 8.81509 19.6364 8.46362C19.2849 8.11215 18.7151 8.11215 18.3636 8.46362L12.023 14.8042L5.63407 8.46132C5.28133 8.11112 4.71149 8.11318 4.36129 8.46592C4.01109 8.81866 4.01314 9.3885 4.36588 9.73871L11.3912 16.7134Z",fill:"currentColor"},null,-1)])])}const R9e=kt({name:"kimi-chevron-down",render:F9e}),O9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function P9e(e,t){return y(),M("svg",O9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M16.1261 12.6088C16.4754 12.257 16.4743 11.6889 16.1238 11.3383L9.14904 4.36363C8.79757 4.01216 8.22772 4.01216 7.87625 4.36363C7.52477 4.7151 7.52477 5.28495 7.87625 5.63642L14.2169 11.977L7.87395 18.3659C7.52375 18.7187 7.52581 19.2885 7.87855 19.6387C8.23129 19.9889 8.80113 19.9869 9.15133 19.6341L16.1261 12.6088Z",fill:"currentColor"},null,-1)])])}const D9e=kt({name:"kimi-chevron-right",render:P9e}),B9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function H9e(e,t){return y(),M("svg",B9e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.3912 8.46132C11.743 8.11202 12.3111 8.11304 12.6617 8.46362L19.6364 15.4383C19.9878 15.7898 19.9878 16.3597 19.6364 16.7111C19.2849 17.0626 18.7151 17.0626 18.3636 16.7111L12.023 10.3705L5.63407 16.7134C5.28133 17.0636 4.71149 17.0616 4.36129 16.7088C4.01109 16.3561 4.01314 15.7862 4.36588 15.436L11.3912 8.46132Z",fill:"currentColor"},null,-1)])])}const z9e=kt({name:"kimi-chevron-up",render:H9e}),W9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function U9e(e,t){return y(),M("svg",W9e,[...t[0]||(t[0]=[C("path",{d:"M11.8999 6.79965C12.397 6.79965 12.7997 7.20235 12.7997 7.69941V11.7266L14.7359 13.6629C15.0873 14.0143 15.0879 14.584 14.7366 14.9355C14.3852 15.287 13.8148 15.287 13.4633 14.9355L11.2632 12.7355C11.0947 12.5668 11.0002 12.338 11.0001 12.0995V7.69941C11.0001 7.20238 11.4029 6.7997 11.8999 6.79965Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 1.89893C17.4677 1.89893 21.9001 6.33147 21.9002 11.7991C21.9002 17.2669 17.4678 21.6993 12 21.6993C6.53228 21.6993 2.09985 17.2669 2.09985 11.7991C2.09998 6.33147 6.53236 1.89893 12 1.89893ZM20.1 11.7998C20.1 7.32616 16.4737 3.69984 12 3.69984C7.5264 3.69984 3.90008 7.32616 3.90008 11.7998C3.90032 16.2732 7.52655 19.8998 12 19.8998C16.4735 19.8998 20.0998 16.2732 20.1 11.7998Z",fill:"currentColor"},null,-1)])])}const j9e=kt({name:"kimi-clock",render:U9e}),V9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function q9e(e,t){return y(),M("svg",V9e,[...t[0]||(t[0]=[C("path",{d:"M17.9542 4.77253C18.3056 4.42106 18.8761 4.42106 19.2276 4.77253C19.579 5.12401 19.579 5.69452 19.2276 6.04597L13.2735 12.0001L19.2276 17.9542C19.5791 18.3056 19.5791 18.8761 19.2276 19.2276C18.8761 19.5791 18.3056 19.5791 17.9542 19.2276L12.0001 13.2735L6.04595 19.2276C5.69451 19.5791 5.12399 19.579 4.77252 19.2276C4.42104 18.8761 4.42104 18.3056 4.77252 17.9542L10.7266 12.0001L4.77252 6.04597C4.42104 5.6945 4.42104 5.124 4.77252 4.77253C5.12399 4.42107 5.69448 4.42106 6.04595 4.77253L12.0001 10.7266L17.9542 4.77253Z",fill:"currentColor"},null,-1)])])}const K9e=kt({name:"kimi-close",render:q9e}),Z9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function G9e(e,t){return y(),M("svg",Z9e,[...t[0]||(t[0]=[C("path",{d:"M9.85815 11.957C10.9074 11.957 11.7583 12.8083 11.7585 13.8574V19.8574C11.7585 20.3545 11.3552 20.7578 10.8582 20.7578C10.3611 20.7578 9.95776 20.3545 9.95776 19.8574V13.8574C9.95755 13.8024 9.91325 13.7578 9.85815 13.7578H3.85815C3.3611 13.7578 2.95776 13.3545 2.95776 12.8574C2.95798 12.3605 3.36123 11.957 3.85815 11.957H9.85815Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8582 2.95703C13.3551 2.95703 13.7583 3.36054 13.7585 3.85742V9.85742C13.7585 9.91265 13.8029 9.95703 13.8582 9.95703H19.8582C20.3551 9.95703 20.7583 10.3605 20.7585 10.8574C20.7585 11.3545 20.3552 11.7578 19.8582 11.7578H13.8582C12.8088 11.7578 11.9578 10.9068 11.9578 9.85742V3.85742C11.958 3.36054 12.3612 2.95703 12.8582 2.95703Z",fill:"currentColor"},null,-1)])])}const Y9e=kt({name:"kimi-collapse",render:G9e}),X9e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J9e(e,t){return y(),M("svg",X9e,[...t[0]||(t[0]=[C("path",{d:"M11.9004 2.19995C17.3678 2.20016 21.7998 6.63285 21.7998 12.1003C21.7996 17.5677 17.3677 21.9995 11.9004 21.9998H3.80078C2.72946 21.9996 2.00334 20.9089 2.41699 19.9207L3.49805 17.3386C2.54871 15.8189 2.00007 14.0226 2 12.1003C2 6.63272 6.43277 2.19995 11.9004 2.19995ZM11.9004 3.99976C7.42688 3.99976 3.7998 7.62684 3.7998 12.1003C3.79989 13.8228 4.33669 15.4175 5.25195 16.7292L5.53516 17.1345L4.25195 20.2H11.8994C16.3727 20.1999 19.9998 16.5736 20 12.1003C20 7.62697 16.3737 3.99997 11.9004 3.99976ZM8.9541 10.8005C9.75473 10.8006 10.4041 11.4491 10.4043 12.2498C10.4043 13.0505 9.75482 13.6998 8.9541 13.7C8.15329 13.7 7.50391 13.0506 7.50391 12.2498C7.50406 11.4491 8.15339 10.8005 8.9541 10.8005ZM15.1533 10.8005C15.9539 10.8006 16.6034 11.4491 16.6035 12.2498C16.6035 13.0505 15.954 13.6998 15.1533 13.7C14.3525 13.7 13.7031 13.0506 13.7031 12.2498C13.7033 11.4491 14.3526 10.8005 15.1533 10.8005Z",fill:"currentColor"},null,-1)])])}const Q9e=kt({name:"kimi-comment",render:J9e}),e4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function t4e(e,t){return y(),M("svg",e4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 7.09961C19.1539 7.09961 20.9004 8.84609 20.9004 11V17C20.9004 19.1539 19.1539 20.9004 17 20.9004H11C8.84609 20.9004 7.09961 19.1539 7.09961 17V11C7.09961 8.84609 8.84609 7.09961 11 7.09961H17ZM11 8.90039C9.8402 8.90039 8.90039 9.8402 8.90039 11V17C8.90039 18.1598 9.8402 19.0996 11 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V11C19.0996 9.8402 18.1598 8.90039 17 8.90039H11Z",fill:"currentColor"},null,-1),C("path",{d:"M13 3.09961C14.4447 3.09961 15.705 3.88644 16.3779 5.0498C16.6265 5.47999 16.4789 6.03049 16.0488 6.2793C15.6186 6.52781 15.0681 6.38029 14.8193 5.9502C14.4548 5.32041 13.776 4.90039 13 4.90039H7C5.8402 4.90039 4.90039 5.8402 4.90039 7V13C4.90039 13.776 5.32041 14.4548 5.9502 14.8193C6.38029 15.0681 6.52781 15.6186 6.2793 16.0488C6.03049 16.4789 5.47999 16.6265 5.0498 16.3779C3.88644 15.705 3.09961 14.4447 3.09961 13V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H13Z",fill:"currentColor"},null,-1)])])}const n4e=kt({name:"kimi-copy",render:t4e}),o4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function s4e(e,t){return y(),M("svg",o4e,[...t[0]||(t[0]=[C("path",{d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 10.2797 2.43414 8.66074 3.19922 7.24707C3.20172 7.24246 3.20453 7.23801 3.20703 7.2334C3.33385 6.99995 3.47181 6.77351 3.61621 6.55176C3.73214 6.37355 3.85079 6.19744 3.97754 6.02734C5.35905 4.17471 7.36856 2.81959 9.68945 2.27051C9.69952 2.26813 9.70965 2.26602 9.71973 2.26367C9.85224 2.23276 9.98563 2.2043 10.1201 2.17871C10.1542 2.17221 10.1884 2.16631 10.2227 2.16016C10.3466 2.13791 10.4712 2.11724 10.5967 2.09961C10.6301 2.09489 10.6637 2.0913 10.6973 2.08691C10.8216 2.07073 10.9465 2.05552 11.0723 2.04395C11.1125 2.04022 11.153 2.0384 11.1934 2.03516C11.4595 2.0139 11.7284 2 12 2ZM11.9941 3.7998C11.9968 3.86623 12 3.93292 12 4C12 6.76142 9.76142 9 7 9C6.14209 9 5.33517 8.78324 4.62988 8.40234C4.09862 9.48861 3.7998 10.7093 3.7998 12C3.7998 12.4438 3.83644 12.8791 3.9043 13.3037C4.52807 12.5673 5.45945 12.0996 6.5 12.0996C8.37777 12.0996 9.90039 13.6222 9.90039 15.5C9.90039 17.0702 8.83532 18.3903 7.38867 18.7812C8.70267 19.6765 10.2901 20.2002 12 20.2002C12.468 20.2002 12.9264 20.1583 13.373 20.083C13.1323 19.4342 13 18.7327 13 18C13 14.6863 15.6863 12 19 12C19.4098 12 19.8098 12.0416 20.1963 12.1201C20.1969 12.0801 20.2002 12.0401 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998H11.9941ZM19 13.7998C16.6804 13.7998 14.7998 15.6804 14.7998 18C14.7998 18.5617 14.9112 19.0972 15.1113 19.5869C17.5225 18.597 19.3558 16.4929 19.9727 13.9141C19.6605 13.8399 19.3349 13.7998 19 13.7998ZM6.5 13.9004C5.61634 13.9004 4.90039 14.6163 4.90039 15.5C4.90039 16.3837 5.61634 17.0996 6.5 17.0996C7.38366 17.0996 8.09961 16.3837 8.09961 15.5C8.09961 14.6163 7.38366 13.9004 6.5 13.9004ZM15.5 6.09961C16.8255 6.09961 17.9004 7.17452 17.9004 8.5C17.9004 9.82548 16.8255 10.9004 15.5 10.9004C14.1745 10.9004 13.0996 9.82548 13.0996 8.5C13.0996 7.17452 14.1745 6.09961 15.5 6.09961ZM15.5 7.90039C15.1686 7.90039 14.9004 8.16863 14.9004 8.5C14.9004 8.83137 15.1686 9.09961 15.5 9.09961C15.8314 9.09961 16.0996 8.83137 16.0996 8.5C16.0996 8.16863 15.8314 7.90039 15.5 7.90039ZM10.1992 4C8.35326 4.41375 6.74333 5.44923 5.59961 6.87598C6.02235 7.08306 6.49716 7.2002 7 7.2002C8.76731 7.2002 10.1992 5.76731 10.1992 4Z",fill:"currentColor"},null,-1)])])}const i4e=kt({name:"kimi-dark-mode",render:s4e}),r4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function l4e(e,t){return y(),M("svg",r4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2.90002C12.4971 2.90002 12.9 3.30297 12.9 3.80002V12.2939L15.8081 9.38585C16.1595 9.03438 16.7294 9.03438 17.0808 9.38585C17.4323 9.73732 17.4323 10.3072 17.0808 10.6586L12.6364 15.1031C12.4676 15.2719 12.2387 15.3667 12 15.3667C11.7613 15.3667 11.5324 15.2719 11.3636 15.1031L6.91917 10.6586C6.5677 10.3072 6.5677 9.73732 6.91917 9.38585C7.27064 9.03438 7.84049 9.03438 8.19196 9.38585L11.1 12.2939V3.80002C11.1 3.30297 11.503 2.90002 12 2.90002ZM4.00001 13.5874C4.49706 13.5874 4.90001 13.9903 4.90001 14.4874V18.043C4.90001 18.2758 4.99249 18.499 5.1571 18.6636C5.32172 18.8282 5.54498 18.9207 5.77778 18.9207H18.2222C18.455 18.9207 18.6783 18.8283 18.8429 18.6636C19.0075 18.499 19.1 18.2758 19.1 18.043V14.4874C19.1 13.9903 19.5029 13.5874 20 13.5874C20.4971 13.5874 20.9 13.9903 20.9 14.4874V18.043C20.9 18.7531 20.6179 19.4342 20.1157 19.9364C19.6135 20.4386 18.9324 20.7207 18.2222 20.7207H5.77778C5.06759 20.7207 4.38649 20.4386 3.88431 19.9364C3.38213 19.4342 3.10001 18.7531 3.10001 18.043V14.4874C3.10001 13.9903 3.50295 13.5874 4.00001 13.5874Z",fill:"currentColor"},null,-1)])])}const a4e=kt({name:"kimi-download",render:l4e}),u4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function c4e(e,t){return y(),M("svg",u4e,[...t[0]||(t[0]=[C("path",{d:"M18.0179 3.09998C18.3963 3.10003 18.7709 3.17491 19.1205 3.31971C19.4701 3.46454 19.7884 3.67614 20.056 3.94373C20.3237 4.21144 20.5362 4.52965 20.681 4.87928C20.8258 5.22887 20.8997 5.60423 20.8997 5.9828C20.8997 6.36118 20.8257 6.73591 20.681 7.08533C20.5362 7.43497 20.3237 7.75317 20.056 8.02088L17.639 10.4379L9.15756 18.9183C8.5296 19.5463 7.74274 19.992 6.8812 20.2074L4.21811 20.8734C3.91148 20.95 3.5871 20.8596 3.36362 20.6361C3.14017 20.4126 3.05063 20.0883 3.12729 19.7816L3.79233 17.1185C4.00771 16.257 4.45344 15.4701 5.08139 14.8422L15.9798 3.94373C16.5203 3.40346 17.2536 3.09998 18.0179 3.09998ZM19.0003 19.1C19.4972 19.1002 19.8997 19.5034 19.8997 20.0004C19.8995 20.4971 19.4971 20.8996 19.0003 20.8998H12.0003C11.5034 20.8998 11.1001 20.4973 11.0999 20.0004C11.0999 19.5033 11.5033 19.1 12.0003 19.1H19.0003ZM18.0179 4.89979C17.7309 4.89979 17.4553 5.01417 17.2523 5.21717L6.35385 16.1146C5.95661 16.5119 5.67469 17.01 5.53842 17.5551L5.23666 18.7631L6.44467 18.4613C6.98971 18.3251 7.48782 18.0431 7.8851 17.6459L18.7826 6.74744C18.883 6.64702 18.9635 6.52821 19.0179 6.39686C19.0723 6.26558 19.0999 6.1247 19.0999 5.9828C19.0999 5.84075 19.0723 5.69916 19.0179 5.56776C18.9635 5.43645 18.883 5.31757 18.7826 5.21717C18.6821 5.11678 18.5631 5.03716 18.432 4.9828C18.3008 4.92845 18.16 4.89983 18.0179 4.89979Z",fill:"currentColor"},null,-1)])])}const d4e=kt({name:"kimi-edit",render:c4e}),f4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function p4e(e,t){return y(),M("svg",f4e,[...t[0]||(t[0]=[C("path",{d:"M5 11.0996C5.49693 11.0996 5.90018 11.5031 5.90039 12V18C5.90039 18.0552 5.94477 18.0996 6 18.0996H12C12.4969 18.0996 12.9002 18.5031 12.9004 19C12.9004 19.4971 12.4971 19.9004 12 19.9004H6C4.95066 19.9004 4.09961 19.0493 4.09961 18V12C4.09982 11.5031 4.50307 11.0996 5 11.0996ZM18 4.09961C19.0492 4.09961 19.9002 4.95084 19.9004 6V12C19.9004 12.4971 19.4971 12.9004 19 12.9004C18.5029 12.9004 18.0996 12.4971 18.0996 12V6C18.0994 5.94495 18.0551 5.90039 18 5.90039H12C11.5029 5.90039 11.0996 5.49706 11.0996 5C11.0998 4.50312 11.5031 4.09961 12 4.09961H18Z",fill:"currentColor"},null,-1)])])}const h4e=kt({name:"kimi-expand",render:p4e}),m4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function g4e(e,t){return y(),M("svg",m4e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1723 2.1001C13.9413 2.10018 14.6793 2.40592 15.2231 2.94971L19.0512 6.77783C19.595 7.32162 19.9007 8.0596 19.9008 8.82861V18.0005C19.9008 20.1544 18.1543 21.9009 16.0004 21.9009H8.0004C5.84649 21.9009 4.10001 20.1544 4.10001 18.0005V6.00049C4.10001 3.84658 5.84649 2.1001 8.0004 2.1001H13.1723ZM8.0004 3.90088C6.8406 3.90088 5.90079 4.84069 5.90079 6.00049V18.0005C5.90079 19.1603 6.8406 20.1001 8.0004 20.1001H16.0004C17.1602 20.1001 18.1 19.1603 18.1 18.0005V9.90088H15.0004C13.3988 9.90088 12.1 8.60211 12.1 7.00049V3.90088H8.0004ZM13.9008 7.00049C13.9008 7.608 14.3929 8.1001 15.0004 8.1001H17.8217C17.8072 8.08375 17.7933 8.06681 17.7777 8.05127L13.9496 4.22314C13.9339 4.20745 13.9173 4.19286 13.9008 4.17822V7.00049Z",fill:"currentColor"})],-1)])])}const Gx=kt({name:"kimi-file",render:g4e}),v4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y4e(e,t){return y(),M("svg",v4e,[...t[0]||(t[0]=[C("path",{d:"M15.4795 15.4971C15.9765 15.4971 16.3799 15.9004 16.3799 16.3975C16.3799 16.8945 15.9765 17.2978 15.4795 17.2979H8.52051C8.02345 17.2979 7.62012 16.8945 7.62012 16.3975C7.62012 15.9004 8.02345 15.4971 8.52051 15.4971H15.4795Z",fill:"currentColor"},null,-1),C("path",{d:"M12.3359 11.0996C12.8329 11.0997 13.2354 11.503 13.2354 12C13.2354 12.497 12.8329 12.9003 12.3359 12.9004H8.52051C8.02345 12.9004 7.62012 12.4971 7.62012 12C7.62012 11.5029 8.02345 11.0996 8.52051 11.0996H12.3359Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M13.1719 2.09961C13.9408 2.09969 14.6789 2.40555 15.2227 2.94922L19.0508 6.77734C19.5946 7.32113 19.9003 8.05911 19.9004 8.82812V18C19.9004 20.1539 18.1539 21.9004 16 21.9004H8C5.84626 21.9002 4.09961 20.1538 4.09961 18V6C4.09961 3.84621 5.84626 2.09981 8 2.09961H13.1719ZM8 3.90039C6.84037 3.90059 5.90039 4.84032 5.90039 6V18C5.90039 19.1597 6.84037 20.0994 8 20.0996H16C17.1598 20.0996 18.0996 19.1598 18.0996 18V9.90039H15C13.3985 9.90019 12.0996 8.6015 12.0996 7V3.90039H8ZM13.9004 7C13.9004 7.60739 14.3927 8.09941 15 8.09961H17.8213C17.8068 8.08333 17.7928 8.06626 17.7773 8.05078L13.9492 4.22266C13.9335 4.20696 13.9169 4.19237 13.9004 4.17773V7Z",fill:"currentColor"},null,-1)])])}const k4e=kt({name:"kimi-file-text",render:y4e}),b4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C4e(e,t){return y(),M("svg",b4e,[...t[0]||(t[0]=[C("path",{d:"M9.2373 3.7002C10.4169 3.7002 11.5297 4.24779 12.249 5.18262L12.4424 5.43359H18C20.0987 5.43359 21.7998 7.13472 21.7998 9.2334V16.5C21.7998 18.5987 20.0987 20.2998 18 20.2998H6C3.90132 20.2998 2.2002 18.5987 2.2002 16.5V7.5C2.2002 5.40132 3.90132 3.7002 6 3.7002H9.2373ZM6 5.5C4.89543 5.5 4 6.39543 4 7.5V16.5C4 17.6046 4.89543 18.5 6 18.5H18C19.0357 18.5 19.887 17.7128 19.9893 16.7041L20 16.5V9.2334C20 8.19775 19.2128 7.34641 18.2041 7.24414L18 7.2334H12.0479L11.9326 7.22656C11.666 7.19561 11.4205 7.05812 11.2549 6.84277L10.8223 6.28027C10.4437 5.78834 9.85808 5.5 9.2373 5.5H6ZM16 9.59961C16.4971 9.59961 16.9004 10.0029 16.9004 10.5C16.9004 10.9971 16.4971 11.4004 16 11.4004H8C7.50294 11.4004 7.09961 10.9971 7.09961 10.5C7.09961 10.0029 7.50294 9.59961 8 9.59961H16Z",fill:"currentColor"},null,-1)])])}const w4e=kt({name:"kimi-folder",render:C4e}),_4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x4e(e,t){return y(),M("svg",_4e,[...t[0]||(t[0]=[C("g",null,[C("path",{d:"M18.3623 9.99976L18.209 8.48999C18.2031 8.43161 18.2004 8.37289 18.2002 8.31421C18.1988 8.31196 18.1956 8.30842 18.1904 8.30347C18.1718 8.28559 18.1302 8.26245 18.0713 8.26245H11C10.261 8.26245 9.59753 7.81016 9.32617 7.1228L8.9082 6.06421C8.88101 5.9953 8.85737 5.92501 8.83887 5.85327C8.83778 5.85099 8.833 5.84268 8.81836 5.83179C8.79454 5.81475 8.7549 5.79939 8.70605 5.80054H3.92871C3.86986 5.80054 3.82825 5.82368 3.80957 5.84155C3.80816 5.8429 3.80675 5.84428 3.80566 5.84546L4.47559 14.0955L3.62109 17.5154L5.12109 11.5154C5.34367 10.6251 6.1438 9.99977 7.06152 9.99976H18.3623ZM7.06152 11.7996C6.96976 11.7996 6.88944 11.8629 6.86719 11.9519L5.36719 17.9519C5.33598 18.078 5.43158 18.1999 5.56152 18.2H19.4385C19.5302 18.1999 19.6106 18.1376 19.6328 18.0486L21.1328 12.0486C21.1644 11.9224 21.0686 11.7996 20.9385 11.7996H7.06152ZM20.9385 9.99976C22.2396 9.99977 23.1945 11.2228 22.8789 12.4851L21.3789 18.4851C21.1563 19.3754 20.3562 19.9997 19.4385 19.9998H4.92871C4.41722 19.9998 3.92613 19.8059 3.56445 19.4597C3.20281 19.1135 3.00004 18.6436 3 18.1541L2 5.84644C2.00006 5.35711 2.20311 4.88786 2.56445 4.54175C2.92613 4.19554 3.41722 4.00073 3.92871 4.00073H8.66406C9.10133 3.99051 9.5296 4.1225 9.87793 4.37573C10.2285 4.63118 10.4767 4.99457 10.582 5.40405L11 6.46167H18.0713C18.5828 6.46167 19.0739 6.65648 19.4355 7.00269C19.7971 7.34888 20 7.81883 20 8.30835L20.1719 9.99976H20.9385Z",fill:"currentColor"})],-1)])])}const S4e=kt({name:"kimi-folder-open",render:x4e}),A4e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function M4e(e,t){return y(),M("svg",A4e,[...t[0]||(t[0]=[C("path",{id:"af-p0",d:"M -2.619 -8.3 C -1.815 -8.3 -1.048 -7.97 -0.499 -7.39 C -0.499 -7.39 0.141 -6.712 0.141 -6.712 C 0.141 -6.712 5.75 -6.712 5.75 -6.712 C 7.904 -6.712 9.65 -4.986 9.65 -2.858 C 9.65 -2.858 9.65 -1.71 9.65 -1.71 C 9.65 -1.219 9.247 -0.821 8.75 -0.821 C 8.253 -0.821 7.85 -1.219 7.85 -1.71 C 7.85 -1.71 7.85 -2.858 7.85 -2.858 C 7.849 -4.004 6.91 -4.934 5.75 -4.934 C 5.75 -4.934 -0.207 -4.934 -0.207 -4.934 C -0.484 -4.934 -0.749 -5.047 -0.938 -5.247 C -0.938 -5.247 -1.815 -6.177 -1.815 -6.177 C -2.023 -6.397 -2.315 -6.521 -2.619 -6.521 C -2.619 -6.521 -6.25 -6.521 -6.25 -6.521 C -7.41 -6.521 -8.35 -5.592 -8.35 -4.446 C -8.35 -4.446 -8.35 4.446 -8.35 4.446 C -8.35 5.592 -7.41 6.521 -6.25 6.521 C -6.25 6.521 1.25 6.521 1.25 6.521 C 1.747 6.521 2.15 6.919 2.15 7.41 C 2.15 7.901 1.747 8.3 1.25 8.3 C 1.25 8.3 -6.25 8.3 -6.25 8.3 C -8.404 8.3 -10.15 6.574 -10.15 4.446 C -10.15 4.446 -10.15 -4.446 -10.15 -4.446 C -10.15 -6.574 -8.404 -8.3 -6.25 -8.3 C -6.25 -8.3 -2.619 -8.3 -2.619 -8.3 Z M 3.75 -2.5 C 4.247 -2.5 4.65 -2.097 4.65 -1.6 C 4.65 -1.103 4.247 -0.699 3.75 -0.699 C 3.75 -0.699 -4.25 -0.699 -4.25 -0.699 C -4.747 -0.699 -5.15 -1.103 -5.15 -1.6 C -5.15 -2.097 -4.747 -2.5 -4.25 -2.5 C -4.25 -2.5 3.75 -2.5 3.75 -2.5 Z",transform:"matrix(1 0 0 1 11.75 12)",fill:"currentColor"},null,-1),C("g",{id:"af-p1"},[C("path",{d:"M 2.635 0 L -2.635 0 M 0 -2.635 L 0 2.635",transform:"matrix(1 0 0 1 18.4 16.3)",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"})],-1)])])}const T4e=kt({name:"kimi-folder-plus",render:M4e}),E4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I4e(e,t){return y(),M("svg",E4e,[...t[0]||(t[0]=[C("path",{d:"M12 3C16.9706 3 21 7.02944 21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3ZM12 19.2002C15.9764 19.2002 19.2002 15.9764 19.2002 12C19.2002 8.02355 15.9764 4.7998 12 4.7998V19.2002Z",fill:"currentColor"},null,-1)])])}const L4e=kt({name:"kimi-follow-system",render:I4e}),$4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N4e(e,t){return y(),M("svg",$4e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7ZM12 15.6992C12.4968 15.6992 12.8994 16.1028 12.8994 16.5996C12.8994 17.0964 12.4968 17.5 12 17.5C11.5024 17.5 11.0996 17.0964 11.0996 16.5996C11.0996 16.1028 11.5024 15.6992 12 15.6992ZM12 6.49902C12.4969 6.49922 12.8994 6.86908 12.8994 7.3252V13.6729C12.8994 14.129 12.4969 14.4988 12 14.499C11.5029 14.499 11.0996 14.1291 11.0996 13.6729V7.3252C11.0996 6.86896 11.5029 6.49902 12 6.49902Z",fill:"currentColor"},null,-1)])])}const F4e=kt({name:"kimi-full-access",render:N4e}),R4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O4e(e,t){return y(),M("svg",R4e,[...t[0]||(t[0]=[C("path",{d:"M12.5092 2.11279C17.7402 2.37781 21.8998 6.70364 21.8998 12.0005C21.8996 17.4153 17.5524 21.8108 12.1576 21.895C12.1056 21.898 12.0532 21.8999 12.0004 21.8999C11.948 21.8999 11.8954 21.8968 11.8432 21.896L11.8422 21.895C6.44751 21.8107 2.10022 17.4152 2.10001 12.0005C2.10001 6.53287 6.53278 2.1001 12.0004 2.1001L12.5092 2.11279ZM8.92715 13.0005C9.02896 14.9787 9.42581 16.721 9.99356 17.9985C10.3249 18.7441 10.6971 19.292 11.0639 19.6411C11.4259 19.9855 11.741 20.1001 12.0004 20.1001C12.2598 20.1 12.5749 19.9856 12.9369 19.6411C13.3037 19.292 13.6749 18.7441 14.0063 17.9985C14.574 16.721 14.9718 14.9788 15.0736 13.0005H8.92715ZM3.96329 13.0005C4.31462 15.8522 6.14714 18.2427 8.66837 19.3823C8.55544 19.1733 8.44916 18.9552 8.34903 18.73C7.66574 17.1926 7.22657 15.1926 7.12344 13.0005H3.96329ZM16.8764 13.0005C16.7732 15.1926 16.3341 17.1926 15.6508 18.73C15.5506 18.9554 15.4435 19.1732 15.3305 19.3823C17.8522 18.2429 19.6851 15.8525 20.0365 13.0005H16.8764ZM8.66934 4.6167C6.08869 5.78266 4.22826 8.25964 3.93985 11.1997H7.11661C7.20176 8.92954 7.64512 6.85497 8.34903 5.271C8.4494 5.04516 8.5561 4.82619 8.66934 4.6167ZM12.0004 3.8999C11.7411 3.8999 11.4259 4.01454 11.0639 4.35889C10.6971 4.70797 10.3249 5.25587 9.99356 6.00146C9.40671 7.32188 9.00186 9.13885 8.91739 11.1997H15.0834C14.9989 9.13884 14.5931 7.32189 14.0063 6.00146C13.6749 5.2559 13.3037 4.70796 12.9369 4.35889C12.5749 4.0144 12.2598 3.90002 12.0004 3.8999ZM15.3295 4.61572C15.443 4.82559 15.5502 5.04471 15.6508 5.271C16.3547 6.85498 16.799 8.92949 16.8842 11.1997H20.06C19.7715 8.25914 17.9108 5.78143 15.3295 4.61572Z",fill:"currentColor"},null,-1)])])}const P4e=kt({name:"kimi-globe",render:O4e}),D4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B4e(e,t){return y(),M("svg",D4e,[...t[0]||(t[0]=[C("path",{d:"M8 17C8.82834 17 9.5 17.6717 9.5 18.5C9.5 19.3283 8.82834 20 8 20C7.17166 20 6.5 19.3283 6.5 18.5C6.5 17.6717 7.17166 17 8 17ZM16 17C16.8283 17 17.5 17.6717 17.5 18.5C17.5 19.3283 16.8283 20 16 20C15.1717 20 14.5 19.3283 14.5 18.5C14.5 17.6717 15.1717 17 16 17ZM8 10.5C8.82834 10.5 9.5 11.1717 9.5 12C9.5 12.8283 8.82834 13.5 8 13.5C7.17166 13.5 6.5 12.8283 6.5 12C6.5 11.1717 7.17166 10.5 8 10.5ZM16 10.5C16.8283 10.5 17.5 11.1717 17.5 12C17.5 12.8283 16.8283 13.5 16 13.5C15.1717 13.5 14.5 12.8283 14.5 12C14.5 11.1717 15.1717 10.5 16 10.5ZM8 4C8.82834 4 9.5 4.67166 9.5 5.5C9.5 6.32834 8.82834 7 8 7C7.17166 7 6.5 6.32834 6.5 5.5C6.5 4.67166 7.17166 4 8 4ZM16 4C16.8283 4 17.5 4.67166 17.5 5.5C17.5 6.32834 16.8283 7 16 7C15.1717 7 14.5 6.32834 14.5 5.5C14.5 4.67166 15.1717 4 16 4Z",fill:"currentColor"},null,-1)])])}const H4e=kt({name:"kimi-grip",render:B4e}),z4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W4e(e,t){return y(),M("svg",z4e,[...t[0]||(t[0]=[C("path",{d:"M7.22264 6.10352C7.22264 5.5078 7.48259 4.95449 7.91405 4.56055C8.34271 4.16918 8.90831 3.96198 9.48241 3.96191C9.64155 3.96191 9.80001 3.97936 9.95507 4.01074C10.0127 3.5042 10.2586 3.04178 10.6338 2.69922C11.0625 2.30778 11.6279 2.09961 12.2021 2.09961C12.7763 2.09966 13.3418 2.30783 13.7705 2.69922C13.9947 2.90401 14.1709 3.15244 14.29 3.42676C14.4947 3.37044 14.7071 3.34182 14.9209 3.3418C15.4951 3.3418 16.0605 3.549 16.4892 3.94043C16.8644 4.28293 17.1093 4.74548 17.167 5.25195C17.3223 5.22045 17.4812 5.20312 17.6406 5.20312C18.2147 5.20318 18.7803 5.41135 19.209 5.80273C19.6402 6.19663 19.9004 6.74922 19.9004 7.34473V14.6543C19.9004 17.413 19.2914 19.0434 18.0137 20.21C16.82 21.2998 15.2175 21.9004 13.5615 21.9004C11.7538 21.9004 10.2315 21.5696 8.95702 20.8535C7.67664 20.1341 6.71683 19.0652 5.97362 17.708L3.3496 12.916C3.18848 12.6213 3.10112 12.2914 3.0996 11.9531C3.09812 11.6147 3.18309 11.2835 3.34179 10.9873C3.5001 10.692 3.72639 10.4416 3.99706 10.251C4.26771 10.0604 4.57776 9.93235 4.90136 9.87305C5.56617 9.75102 6.25934 9.84517 6.86425 10.1445C6.9942 10.2088 7.11461 10.2788 7.22264 10.3477V6.10352ZM9.02343 12.7969C9.02336 13.1912 8.76624 13.5395 8.38964 13.6562C8.0129 13.773 7.60387 13.6309 7.38085 13.3057L6.53514 12.0723C6.51218 12.0529 6.48411 12.0282 6.45018 12.002C6.34595 11.9213 6.20986 11.8289 6.06639 11.7578C5.81525 11.6335 5.51637 11.5904 5.22655 11.6436H5.22557C5.15055 11.6573 5.08558 11.6865 5.03417 11.7227C4.98289 11.7588 4.94815 11.7998 4.92772 11.8379C4.90762 11.8755 4.90023 11.9122 4.90038 11.9453C4.90057 11.9782 4.9084 12.0144 4.9287 12.0518L7.55272 16.8438C8.16912 17.9693 8.90989 18.7622 9.83886 19.2842C10.7737 19.8094 11.9704 20.0996 13.5615 20.0996C14.7902 20.0996 15.9536 19.6533 16.7998 18.8809C17.5619 18.185 18.0996 17.1383 18.0996 14.6543V7.34473C18.0996 7.28204 18.0734 7.20342 17.9951 7.13184C17.9139 7.05771 17.7875 7.00396 17.6406 7.00391C17.4937 7.00391 17.3674 7.05771 17.2861 7.13184C17.2077 7.20347 17.1807 7.28199 17.1807 7.34473V11.0693C17.1805 11.5661 16.778 11.9685 16.2812 11.9688C15.7843 11.9688 15.381 11.5662 15.3808 11.0693V5.48242C15.3808 5.41973 15.3537 5.34107 15.2754 5.26953C15.1941 5.19547 15.0677 5.1416 14.9209 5.1416C14.774 5.14166 14.6476 5.19541 14.5664 5.26953C14.4881 5.34105 14.462 5.41974 14.4619 5.48242V11.0693C14.4617 11.5662 14.0584 11.9688 13.5615 11.9688C13.0646 11.9687 12.6613 11.5662 12.6611 11.0693V4.24121C12.6611 4.17852 12.635 4.09989 12.5566 4.02832C12.4754 3.95419 12.349 3.90045 12.2021 3.90039C12.0552 3.90039 11.9289 3.95421 11.8476 4.02832C11.7692 4.09992 11.7422 4.17849 11.7422 4.24121V11.0693C11.742 11.5661 11.3395 11.9685 10.8428 11.9688C10.3458 11.9688 9.94257 11.5662 9.94237 11.0693V6.10352L9.93651 6.05371C9.92534 6.00177 9.89573 5.94433 9.8369 5.89062C9.75567 5.81647 9.62938 5.76172 9.48241 5.76172C9.33554 5.76179 9.2091 5.81651 9.12792 5.89062C9.04964 5.96222 9.02343 6.04084 9.02343 6.10352V12.7969Z",fill:"currentColor"},null,-1)])])}const U4e=kt({name:"kimi-hand",render:W4e}),j4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V4e(e,t){return y(),M("svg",j4e,[...t[0]||(t[0]=[C("path",{d:"M4 3.33203C4.55224 3.33203 4.99993 3.7798 5 4.33203V18.0908H20.0674C20.6195 18.0908 21.0671 18.5388 21.0674 19.0908C21.0674 19.6431 20.6197 20.0908 20.0674 20.0908H5C3.89543 20.0908 3 19.1954 3 18.0908V4.33203C3.00007 3.7798 3.44776 3.33203 4 3.33203ZM8.19922 9.28418C8.7515 9.28418 9.19922 9.73189 9.19922 10.2842V15.6045C9.19908 16.1567 8.75142 16.6045 8.19922 16.6045C7.64719 16.6043 7.19936 16.1565 7.19922 15.6045V10.2842C7.19922 9.73202 7.6471 9.28438 8.19922 9.28418ZM17.2227 6.85645C17.7748 6.85658 18.2226 7.3043 18.2227 7.85645V15.6045C18.2225 16.1566 17.7747 16.6044 17.2227 16.6045C16.6705 16.6045 16.2228 16.1566 16.2227 15.6045V7.85645C16.2227 7.30422 16.6704 6.85645 17.2227 6.85645ZM12.7109 3.96387C13.2631 3.96387 13.7107 4.41175 13.7109 4.96387V15.6035C13.7109 16.1558 13.2632 16.6035 12.7109 16.6035C12.1587 16.6035 11.7109 16.1558 11.7109 15.6035V4.96387C11.7111 4.41175 12.1588 3.96387 12.7109 3.96387Z",fill:"currentColor"},null,-1)])])}const q4e=kt({name:"kimi-histogram",render:V4e}),K4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z4e(e,t){return y(),M("svg",K4e,[...t[0]||(t[0]=[C("path",{d:"M8.00916 7.50488C8.47326 7.50488 8.91828 7.68943 9.24646 8.01758C9.57465 8.34577 9.75916 8.79075 9.75916 9.25488C9.75916 9.71901 9.57465 10.164 9.24646 10.4922C8.91828 10.8203 8.47326 11.0049 8.00916 11.0049C7.54507 11.0049 7.10001 10.8203 6.77185 10.4922C6.4437 10.164 6.25916 9.71898 6.25916 9.25488C6.25916 8.79078 6.4437 8.34576 6.77185 8.01758C7.10001 7.68942 7.54507 7.50492 8.00916 7.50488Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17.8998 4.09961C20.0537 4.09961 21.8002 5.84609 21.8002 8V16C21.8002 18.1539 20.0537 19.9004 17.8998 19.9004H5.89978C3.74598 19.9003 1.99939 18.1538 1.99939 16V8C1.99939 5.84617 3.74598 4.09974 5.89978 4.09961H17.8998ZM15.4867 12.2539C15.448 12.2184 15.3885 12.2192 15.351 12.2559L11.7338 15.8027C11.0146 16.5079 9.87305 16.5222 9.13708 15.835L6.98669 13.8262C6.95049 13.7924 6.89516 13.791 6.85681 13.8223L3.82361 16.2988C3.96873 17.3168 4.84165 18.0995 5.89978 18.0996H17.8998C18.9375 18.0996 19.7964 17.3466 19.9662 16.3574L15.4867 12.2539ZM5.89978 5.90039C4.74009 5.90052 3.80017 6.84028 3.80017 8V14.002L5.73181 12.4238C6.46046 11.8286 7.51253 11.8634 8.20056 12.5059L10.351 14.5146C10.3897 14.5508 10.4498 14.5497 10.4877 14.5127L14.1049 10.9658C14.819 10.2656 15.9506 10.2466 16.6879 10.9219L19.9994 13.9551V8C19.9994 6.8402 19.0596 5.90039 17.8998 5.90039H5.89978Z",fill:"currentColor"},null,-1)])])}const G4e=kt({name:"kimi-image",render:Z4e}),Y4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X4e(e,t){return y(),M("svg",Y4e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.09375 2.81174C5.4825 2.50796 6.04376 2.56488 6.34766 2.93869L20.1855 19.9602C20.4895 20.3341 20.421 20.8836 20.0322 21.1877C19.6435 21.4917 19.0823 21.4355 18.7783 21.0617L17.9971 20.1008H5.99609C3.84224 20.1008 2.0958 18.3552 2.0957 16.2014V8.13889C2.09589 6.26755 3.41429 4.70428 5.17285 4.32639L4.93945 4.03928C4.63577 3.66536 4.7051 3.11573 5.09375 2.81174ZM7.13184 14.1096C7.09416 14.0738 7.03659 14.0713 6.99609 14.1037L3.92871 16.5569C4.09761 17.5472 4.95753 18.301 5.99609 18.301H16.5342L13.373 14.4133L11.9072 15.9455C11.1531 16.7324 9.92202 16.7621 9.13281 16.0119L7.13184 14.1096ZM5.99609 6.03928C4.83643 6.03928 3.89669 6.97927 3.89648 8.13889V14.1408L5.83496 12.5901C6.60469 11.9742 7.69929 12.022 8.41504 12.7024L10.416 14.6037C10.4575 14.6431 10.5218 14.642 10.5615 14.6008L12.1641 12.926L9.78906 10.0051C9.70282 10.2646 9.55682 10.5038 9.35645 10.7004C9.02202 11.0285 8.56767 11.2131 8.09473 11.2131C7.62195 11.213 7.1683 11.0284 6.83398 10.7004C6.49961 10.3724 6.31152 9.92701 6.31152 9.46311C6.3116 8.99941 6.49981 8.55474 6.83398 8.22678C7.12986 7.93654 7.51931 7.75901 7.93262 7.7219L6.56543 6.03928H5.99609Z",fill:"currentColor"},null,-1),C("path",{d:"M18.0049 4.31272C20.1587 4.31288 21.9043 6.0593 21.9043 8.21311V13.718C21.9039 15.4743 19.7248 16.2906 18.5713 14.966L14.9141 10.7658C14.5882 10.3912 14.6278 9.82271 15.002 9.49631C15.3768 9.16994 15.9451 9.20948 16.2715 9.5842L19.9287 13.7844C19.9528 13.812 19.9696 13.8167 19.9775 13.8186C19.9908 13.8216 20.0141 13.8213 20.04 13.8117C20.0655 13.8021 20.0826 13.7875 20.0908 13.7766C20.0955 13.7702 20.1044 13.7552 20.1045 13.718V8.21311C20.1045 7.05341 19.1645 6.11366 18.0049 6.1135H10.6328C10.1361 6.11327 9.73267 5.70981 9.73242 5.21311C9.73242 4.71619 10.136 4.31295 10.6328 4.31272H18.0049Z",fill:"currentColor"},null,-1)])])}const J4e=kt({name:"kimi-image-failed",render:X4e}),Q4e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e3e(e,t){return y(),M("svg",Q4e,[...t[0]||(t[0]=[C("path",{d:"M12 2.1001C17.4676 2.10031 21.8994 6.53286 21.8994 12.0005C21.8992 17.4679 17.4674 21.8997 12 21.8999C6.53237 21.8999 2.09982 17.4681 2.09961 12.0005C2.09961 6.53273 6.53224 2.1001 12 2.1001ZM12 3.8999C7.52636 3.8999 3.89941 7.52684 3.89941 12.0005C3.89963 16.474 7.52649 20.1001 12 20.1001C16.4733 20.0999 20.0994 16.4738 20.0996 12.0005C20.0996 7.52697 16.4735 3.90011 12 3.8999ZM12 9.50049C12.4969 9.50068 12.8994 9.87055 12.8994 10.3267V16.6743C12.8992 17.1303 12.4968 17.5003 12 17.5005C11.503 17.5005 11.0998 17.1304 11.0996 16.6743V10.3267C11.0996 9.87043 11.5029 9.50049 12 9.50049ZM12 6.49951C12.4968 6.49951 12.8994 6.90313 12.8994 7.3999C12.8992 7.8965 12.4966 8.30029 12 8.30029C11.5025 8.30028 11.0998 7.8965 11.0996 7.3999C11.0996 6.90313 11.5024 6.49952 12 6.49951Z",fill:"currentColor"},null,-1)])])}const t3e=kt({name:"kimi-info",render:e3e}),n3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o3e(e,t){return y(),M("svg",n3e,[...t[0]||(t[0]=[iu('',10)])])}const s3e=kt({name:"kimi-keyboard",render:o3e}),i3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function r3e(e,t){return y(),M("svg",i3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const l3e=kt({name:"kimi-left-panel",render:r3e}),a3e={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24"};function u3e(e,t){return y(),M("svg",a3e,[...t[0]||(t[0]=[C("path",{id:"bar-divider",d:"M 9.3 18.951 L 9.3 4.3",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1),C("path",{id:"bar-box",d:"M -7.9 -4.8 C -7.9 -6.512 -6.512 -7.9 -4.8 -7.9 L 4.8 -7.9 C 6.512 -7.9 7.9 -6.512 7.9 -4.8 L 7.9 4.8 C 7.9 6.512 6.512 7.9 4.8 7.9 L -4.8 7.9 C -6.512 7.9 -7.9 6.512 -7.9 4.8 L -7.9 -4.8 Z",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"butt","stroke-linejoin":"miter",transform:"matrix(1 0 0 1 11.8 11.8)"},null,-1),C("path",{id:"bar-arrow-expand",d:"M -1.25 -2.5 L 1.25 0 L -1.25 2.5",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])}const c3e=kt({name:"kimi-left-panel-expand",render:u3e}),d3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f3e(e,t){return y(),M("svg",d3e,[...t[0]||(t[0]=[iu('',1)])])}const p3e=kt({name:"kimi-light-mode",render:f3e}),h3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m3e(e,t){return y(),M("svg",h3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.97427 8.06961C4.99348 7.33581 6.18946 7.1 7.00001 7.1H9.00001C9.49706 7.1 9.90001 7.50294 9.90001 8C9.90001 8.49706 9.49706 8.9 9.00001 8.9H7.00001C6.47755 8.9 5.67353 9.06419 5.02599 9.53039C4.42434 9.96356 3.90001 10.6934 3.90001 12C3.90001 13.3066 4.42434 14.0364 5.02599 14.4696C5.67353 14.9358 6.47755 15.1 7.00001 15.1H9.00001C9.49706 15.1 9.90001 15.5029 9.90001 16C9.90001 16.4971 9.49706 16.9 9.00001 16.9H7.00001C6.18946 16.9 4.99348 16.6642 3.97427 15.9304C2.90917 15.1636 2.10001 13.8934 2.10001 12C2.10001 10.1066 2.90917 8.83644 3.97427 8.06961ZM14.1 8C14.1 7.50294 14.5029 7.1 15 7.1H17C17.8105 7.1 19.0065 7.33581 20.0257 8.06961C21.0908 8.83644 21.9 10.1066 21.9 12C21.9 13.8934 21.0908 15.1636 20.0257 15.9304C19.0065 16.6642 17.8105 16.9 17 16.9H15C14.5029 16.9 14.1 16.4971 14.1 16C14.1 15.5029 14.5029 15.1 15 15.1H17C17.5225 15.1 18.3265 14.9358 18.974 14.4696C19.5757 14.0364 20.1 13.3066 20.1 12C20.1 10.6934 19.5757 9.96356 18.974 9.53039C18.3265 9.06419 17.5225 8.9 17 8.9H15C14.5029 8.9 14.1 8.49706 14.1 8ZM7.10001 12C7.10001 11.5029 7.50295 11.1 8.00001 11.1H16C16.4971 11.1 16.9 11.5029 16.9 12C16.9 12.4971 16.4971 12.9 16 12.9H8.00001C7.50295 12.9 7.10001 12.4971 7.10001 12Z",fill:"currentColor"},null,-1)])])}const g3e=kt({name:"kimi-link",render:m3e}),v3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y3e(e,t){return y(),M("svg",v3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.10001 5.99998C4.10001 5.50292 4.50295 5.09998 5.00001 5.09998H19C19.4971 5.09998 19.9 5.50292 19.9 5.99998C19.9 6.49703 19.4971 6.89998 19 6.89998H5.00001C4.50295 6.89998 4.10001 6.49703 4.10001 5.99998ZM4.10001 12C4.10001 11.5029 4.50295 11.1 5.00001 11.1H19C19.4971 11.1 19.9 11.5029 19.9 12C19.9 12.497 19.4971 12.9 19 12.9H5.00001C4.50295 12.9 4.10001 12.497 4.10001 12ZM4.10001 18C4.10001 17.5029 4.50295 17.1 5.00001 17.1H19C19.4971 17.1 19.9 17.5029 19.9 18C19.9 18.497 19.4971 18.9 19 18.9H5.00001C4.50295 18.9 4.10001 18.497 4.10001 18Z",fill:"currentColor"},null,-1)])])}const k3e=kt({name:"kimi-list",render:y3e}),b3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C3e(e,t){return y(),M("svg",b3e,[...t[0]||(t[0]=[C("g",null,[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18 4.09961C20.1539 4.09961 21.9004 5.84609 21.9004 8V16C21.9004 18.1539 20.1539 19.9004 18 19.9004H6C3.84609 19.9004 2.09961 18.1539 2.09961 16V8C2.09961 5.84609 3.84609 4.09961 6 4.09961H18ZM3.90039 16C3.90039 17.1598 4.8402 18.0996 6 18.0996H18C19.1598 18.0996 20.0996 17.1598 20.0996 16V9.49805L13.5361 13.5361C12.5955 14.1147 11.4075 14.1084 10.4727 13.5205L3.90039 9.38672V16ZM6 5.90039C5.0746 5.90039 4.29039 6.49909 4.01074 7.33008L11.4316 11.9971C11.7861 12.2199 12.2361 12.2222 12.5928 12.0029L20.0195 7.43457C19.7725 6.54993 18.9636 5.90039 18 5.90039H6Z",fill:"currentColor"})],-1)])])}const w3e=kt({name:"kimi-mail",render:C3e}),_3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x3e(e,t){return y(),M("svg",_3e,[...t[0]||(t[0]=[C("path",{d:"M17 11.0996C17.4971 11.0996 17.9004 11.5029 17.9004 12C17.9004 12.4971 17.4971 12.9004 17 12.9004H7C6.50294 12.9004 6.09961 12.4971 6.09961 12C6.09961 11.5029 6.50294 11.0996 7 11.0996H17Z",fill:"currentColor"},null,-1)])])}const S3e=kt({name:"kimi-minus",render:x3e}),A3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M3e(e,t){return y(),M("svg",A3e,[...t[0]||(t[0]=[C("path",{d:"M15.182 3.32802C15.9304 2.72235 17.0309 2.76978 17.724 3.46767L18.5424 4.29189L18.6722 4.43642C19.2377 5.13495 19.234 6.1404 18.6635 6.83486L18.5326 6.97841L18.0248 7.48232C17.9549 7.55172 17.8793 7.61254 17.8021 7.66884C17.9794 8.18027 17.9316 8.7498 17.6595 9.22841C17.6847 9.24522 17.7091 9.2635 17.7328 9.2831L17.8002 9.3456L17.9847 9.53798C19.8515 11.5442 20.4549 14.0022 19.6224 16.2196C19.1921 17.3657 18.4025 18.3827 17.2992 19.203H19.0873L19.1801 19.2079C19.6337 19.2542 19.9877 19.6375 19.9877 20.1034C19.9876 20.5692 19.6337 20.9527 19.1801 20.9989L19.0873 21.0028H13.0385C13.0244 21.0033 13.0104 21.0031 12.9965 21.0028H4.9115C4.41448 21.0028 4.01117 20.6004 4.01111 20.1034C4.01111 19.6064 4.41444 19.203 4.9115 19.203H12.9047C15.7614 18.5471 17.3679 17.1023 17.9369 15.5868C18.4678 14.1726 18.179 12.4782 16.807 10.9188L16.5189 10.6093L16.4574 10.5399C16.4549 10.5368 16.453 10.5333 16.4506 10.5302L12.3011 14.6522C11.6031 15.3454 10.5023 15.3845 9.75818 14.7733L9.61365 14.6425L7.31091 12.3231C6.5717 11.5786 6.57617 10.376 7.32068 9.63662L12.3676 4.62392L12.5121 4.49404C13.0358 4.06988 13.7318 3.96755 14.3402 4.18251C14.3969 4.10597 14.4591 4.03197 14.5287 3.96279L15.0365 3.45791L15.182 3.32802ZM4.83044 12.9335C5.16112 12.6052 5.68305 12.5863 6.03552 12.8759L6.10291 12.9384L9.07361 15.9286L9.13513 15.997C9.42218 16.3514 9.3992 16.8727 9.06873 17.2011C8.7381 17.5294 8.21712 17.5482 7.86462 17.2587L7.79626 17.1972L4.82654 14.2069L4.76501 14.1376C4.47792 13.7831 4.49979 13.2619 4.83044 12.9335ZM13.6693 5.87978L13.6361 5.90126L8.58826 10.914C8.54935 10.9529 8.54943 11.0165 8.58826 11.0556L10.891 13.3739L10.9242 13.3964C10.9602 13.4111 11.0032 13.404 11.0326 13.3749L16.0795 8.3622L16.1019 8.329C16.1117 8.3049 16.1117 8.2779 16.1019 8.2538L16.0804 8.2206L13.7777 5.90224C13.7486 5.87289 13.7054 5.86535 13.6693 5.87978ZM16.3383 4.71376L16.3051 4.73525L15.7972 5.24013C15.7584 5.27904 15.7585 5.34166 15.7972 5.38076L16.6146 6.20498L16.6478 6.22744C16.6838 6.24221 16.7268 6.23487 16.7562 6.20595L17.264 5.70107L17.2865 5.66787C17.2962 5.64382 17.2963 5.61672 17.2865 5.59267L17.265 5.55947L16.4467 4.73623C16.4174 4.70681 16.3744 4.6992 16.3383 4.71376Z",fill:"currentColor"},null,-1)])])}const T3e=kt({name:"kimi-microscope",render:M3e}),E3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I3e(e,t){return y(),M("svg",E3e,[...t[0]||(t[0]=[C("path",{d:"M6 12C6 12.8283 5.32834 13.5 4.5 13.5C3.67166 13.5 3 12.8283 3 12C3 11.1717 3.67166 10.5 4.5 10.5C5.32834 10.5 6 11.1717 6 12Z",fill:"currentColor"},null,-1),C("path",{d:"M13.5 12C13.5 12.8283 12.8283 13.5 12 13.5C11.1717 13.5 10.5 12.8283 10.5 12C10.5 11.1717 11.1717 10.5 12 10.5C12.8283 10.5 13.5 11.1717 13.5 12Z",fill:"currentColor"},null,-1),C("path",{d:"M19.5002 13.5C20.3287 13.5 21 12.8287 21 12.0002C21 11.1718 20.3287 10.5 19.5002 10.5C18.6718 10.5 18 11.1718 18 12.0002C18 12.8287 18.6718 13.5 19.5002 13.5Z",fill:"currentColor"},null,-1)])])}const L3e=kt({name:"kimi-more",render:I3e}),$3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N3e(e,t){return y(),M("svg",$3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 12.0993C8.49691 12.0993 8.90016 12.5028 8.90039 12.9997V17.9997C8.90039 19.6013 7.60163 20.9001 6 20.9001C4.39837 20.9001 3.09961 19.6013 3.09961 17.9997C3.09984 16.3982 4.39852 15.0993 6 15.0993C6.38939 15.0993 6.76033 15.1778 7.09961 15.317V12.9997C7.09984 12.5028 7.50309 12.0993 8 12.0993ZM6 16.9001C5.39263 16.9001 4.90062 17.3923 4.90039 17.9997C4.90039 18.6072 5.39249 19.0993 6 19.0993C6.60751 19.0993 7.09961 18.6072 7.09961 17.9997C7.09938 17.3923 6.60737 16.9001 6 16.9001Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.627 3.35611C19.8025 3.12106 20.9001 4.02068 20.9004 5.21939V15.9997C20.9004 17.6013 19.6016 18.9001 18 18.9001C16.3984 18.9001 15.0996 17.6013 15.0996 15.9997C15.0998 14.3982 16.3985 13.0993 18 13.0993C18.3894 13.0993 18.7603 13.1778 19.0996 13.317V9.21939C19.0993 9.15657 19.0421 9.10946 18.9805 9.12173L12.6768 10.3825C12.1894 10.4799 11.7148 10.1637 11.6172 9.67642C11.52 9.18922 11.8361 8.71439 12.3232 8.61685L18.627 7.35611C18.7868 7.32415 18.9452 7.31502 19.0996 7.32291V5.21939C19.0993 5.15657 19.0421 5.10946 18.9805 5.12173L12.6768 6.38248C12.1894 6.47994 11.7148 6.16372 11.6172 5.67642C11.52 5.18922 11.8361 4.71439 12.3232 4.61685L18.627 3.35611ZM18 14.9001C17.3926 14.9001 16.9006 15.3923 16.9004 15.9997C16.9004 16.6072 17.3925 17.0993 18 17.0993C18.6075 17.0993 19.0996 16.6072 19.0996 15.9997C19.0994 15.3923 18.6074 14.9001 18 14.9001Z",fill:"currentColor"},null,-1),C("path",{d:"M7.32422 5.38931C7.61669 4.87032 8.38346 4.87015 8.67578 5.38931L8.73047 5.50845L8.89551 5.95376L8.97949 6.1481C9.19937 6.58817 9.57968 6.93145 10.0459 7.10415L10.4912 7.26919C11.127 7.50461 11.1666 8.36217 10.6104 8.67544L10.4912 8.73013L10.0459 8.89517C9.5799 9.06783 9.19939 9.41141 8.97949 9.85123L8.89551 10.0456L8.73047 10.4909C8.49495 11.1267 7.63737 11.1665 7.32422 10.61L7.26953 10.4909L7.10449 10.0456C6.93172 9.57931 6.58767 9.19898 6.14746 8.97916L5.9541 8.89517L5.50879 8.73013C4.83054 8.47903 4.83061 7.52037 5.50879 7.26919L5.9541 7.10415L6.14746 7.02017C6.58757 6.80032 6.93176 6.41995 7.10449 5.95376L7.26953 5.50845L7.32422 5.38931Z",fill:"currentColor"},null,-1)])])}const F3e=kt({name:"kimi-music",render:N3e}),R3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O3e(e,t){return y(),M("svg",R3e,[...t[0]||(t[0]=[C("path",{d:"M17.9551 6.32648C17.955 5.82951 17.5517 5.42706 17.0547 5.42706H15.4844C14.9875 5.42717 14.5851 5.82958 14.585 6.32648V17.6732C14.585 18.1701 14.9874 18.5734 15.4844 18.5735H17.0547C17.5518 18.5735 17.9551 18.1702 17.9551 17.6732V6.32648ZM19.7549 17.6732C19.7549 19.1643 18.5459 20.3734 17.0547 20.3734H15.4844C13.9933 20.3732 12.7842 19.1643 12.7842 17.6732V6.32648C12.7843 4.83546 13.9934 3.62639 15.4844 3.62628H17.0547C18.5458 3.62628 19.7548 4.8354 19.7549 6.32648V17.6732Z",fill:"currentColor"},null,-1),C("path",{d:"M9.41571 6.32648C9.41561 5.82951 9.01231 5.42706 8.51532 5.42706H6.94501C6.44811 5.42717 6.0457 5.82958 6.04559 6.32648V17.6732C6.04559 18.1701 6.44804 18.5734 6.94501 18.5735H8.51532C9.01238 18.5735 9.41571 18.1702 9.41571 17.6732V6.32648ZM11.2155 17.6732C11.2155 19.1643 10.0065 20.3734 8.51532 20.3734H6.94501C5.45393 20.3732 4.24481 19.1643 4.24481 17.6732V6.32648C4.24492 4.83546 5.45399 3.62639 6.94501 3.62628H8.51532C10.0064 3.62628 11.2154 4.8354 11.2155 6.32648V17.6732Z",fill:"currentColor"},null,-1)])])}const P3e=kt({name:"kimi-pause",render:O3e}),D3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B3e(e,t){return y(),M("svg",D3e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.0176 4.89998C17.7305 4.89998 17.4552 5.014 17.2522 5.217L6.35429 16.1149C5.957 16.5122 5.67517 17.01 5.53889 17.5551L5.23691 18.763L6.44486 18.4611C6.98994 18.3248 7.48773 18.0429 7.88502 17.6456L18.783 6.74773C18.8834 6.64728 18.9631 6.52797 19.0176 6.39658C19.072 6.26517 19.1 6.12441 19.1 5.98236C19.1 5.84031 19.072 5.69956 19.0176 5.56815C18.9631 5.43676 18.8834 5.31745 18.783 5.217C18.6825 5.11649 18.5631 5.03676 18.4318 4.98237C18.3005 4.92798 18.1597 4.89998 18.0176 4.89998ZM15.9794 3.94421C16.52 3.40366 17.2531 3.09998 18.0176 3.09998C18.3961 3.09998 18.7709 3.17452 19.1207 3.31938C19.4704 3.46424 19.7881 3.67656 20.0558 3.94421C20.3235 4.21192 20.5357 4.52969 20.6805 4.87932C20.8254 5.22895 20.9 5.60375 20.9 5.98236C20.9 6.36098 20.8254 6.73578 20.6805 7.08541C20.5357 7.43504 20.3235 7.75281 20.0558 8.02052L17.6385 10.4378L9.15781 18.9184C8.52984 19.5464 7.74301 19.9919 6.88142 20.2073L4.21828 20.8731C3.91158 20.9498 3.58714 20.8599 3.3636 20.6364C3.14006 20.4128 3.05019 20.0884 3.12686 19.7817L3.79264 17.1185C4.00803 16.257 4.45351 15.4701 5.0815 14.8421L15.9794 3.94421Z",fill:"currentColor"},null,-1)])])}const H3e=kt({name:"kimi-pencil",render:B3e}),z3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W3e(e,t){return y(),M("svg",z3e,[...t[0]||(t[0]=[C("path",{d:"M7.76251 3.10547C8.25776 3.10552 8.74422 3.23849 9.17072 3.49023L19.533 9.60742C20.8536 10.3869 21.2922 12.0901 20.5174 13.4121C20.2785 13.8195 19.9398 14.1604 19.533 14.4004L9.16974 20.5156C7.84721 21.2958 6.14595 20.8511 5.36993 19.5273C5.1196 19.1003 4.98719 18.6142 4.98712 18.1191V5.88672C4.98716 4.3537 6.2273 3.10547 7.76251 3.10547ZM6.7879 18.1191C6.78797 18.2945 6.8343 18.4664 6.92267 18.6172C7.19638 19.0841 7.79336 19.2377 8.25568 18.9648L18.618 12.8496C18.7607 12.7654 18.8803 12.6458 18.9647 12.502C19.2393 12.0334 19.082 11.4311 18.618 11.1572L8.25568 5.04102C8.1061 4.95273 7.93562 4.9063 7.76251 4.90625C7.22703 4.90625 6.78794 5.34218 6.7879 5.88672V18.1191Z",fill:"currentColor"},null,-1)])])}const U3e=kt({name:"kimi-play",render:W3e}),j3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V3e(e,t){return y(),M("svg",j3e,[...t[0]||(t[0]=[C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2ZM12 3.7998C7.47126 3.7998 3.7998 7.47126 3.7998 12C3.7998 16.5287 7.47126 20.2002 12 20.2002C16.5287 20.2002 20.2002 16.5287 20.2002 12C20.2002 7.47126 16.5287 3.7998 12 3.7998Z",fill:"currentColor"},null,-1)])])}const q3e=kt({name:"kimi-question",render:V3e}),K3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z3e(e,t){return y(),M("svg",K3e,[...t[0]||(t[0]=[C("path",{d:"M12 2C13.1046 2 14 2.89543 14 4C14 4.78019 13.552 5.45353 12.9004 5.7832V7H16.5C18.1569 7 19.5 8.34315 19.5 10V17C19.5 18.6051 18.2394 19.9158 16.6543 19.9961L16.5 20H7.5L7.3457 19.9961C5.81166 19.9184 4.58163 18.6883 4.50391 17.1543L4.5 17V10C4.5 8.34315 5.84315 7 7.5 7H11.0996V5.7832C10.448 5.45353 10 4.78019 10 4C10 2.89543 10.8954 2 12 2ZM7.5 8.7998C6.83726 8.7998 6.2998 9.33726 6.2998 10V17C6.2998 17.6627 6.83726 18.2002 7.5 18.2002H16.5C17.1627 18.2002 17.7002 17.6627 17.7002 17V10C17.7002 9.33726 17.1627 8.7998 16.5 8.7998H7.5ZM3 10.7666C3.49706 10.7666 3.90039 11.1699 3.90039 11.667V15C3.90039 15.4971 3.49706 15.9004 3 15.9004C2.50294 15.9004 2.09961 15.4971 2.09961 15V11.667C2.09961 11.1699 2.50294 10.7666 3 10.7666ZM21 10.7666C21.4971 10.7666 21.9004 11.1699 21.9004 11.667V15C21.9004 15.4971 21.4971 15.9004 21 15.9004C20.5029 15.9004 20.0996 15.4971 20.0996 15V11.667C20.0996 11.1699 20.5029 10.7666 21 10.7666ZM9.5 11.0996C9.99706 11.0996 10.4004 11.5029 10.4004 12V14.5C10.4004 14.9971 9.99706 15.4004 9.5 15.4004C9.00294 15.4004 8.59961 14.9971 8.59961 14.5V12C8.59961 11.5029 9.00294 11.0996 9.5 11.0996ZM14.5 11.0996C14.9971 11.0996 15.4004 11.5029 15.4004 12V14.5C15.4004 14.9971 14.9971 15.4004 14.5 15.4004C14.0029 15.4004 13.5996 14.9971 13.5996 14.5V12C13.5996 11.5029 14.0029 11.0996 14.5 11.0996ZM12 3.5C11.7239 3.5 11.5 3.72386 11.5 4C11.5 4.27614 11.7239 4.5 12 4.5C12.2761 4.5 12.5 4.27614 12.5 4C12.5 3.72386 12.2761 3.5 12 3.5Z",fill:"currentColor"},null,-1)])])}const G3e=kt({name:"kimi-robot",render:Z3e}),Y3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function X3e(e,t){return y(),M("svg",Y3e,[...t[0]||(t[0]=[C("path",{d:"M11.5 3C16.1944 3 20 6.80558 20 11.5C20 13.523 19.2933 15.381 18.1132 16.8404L21.1364 19.8636C21.4879 20.2151 21.4879 20.7849 21.1364 21.1364C20.7849 21.4879 20.2151 21.4879 19.8636 21.1364L16.8404 18.1132C15.381 19.2933 13.523 20 11.5 20C6.80558 20 3 16.1944 3 11.5C3 6.80558 6.80558 3 11.5 3ZM11.5 18.2C15.2003 18.2 18.2 15.2003 18.2 11.5C18.2 7.79969 15.2003 4.8 11.5 4.8C7.79969 4.8 4.8 7.79969 4.8 11.5C4.8 15.2003 7.79969 18.2 11.5 18.2Z",fill:"currentColor"},null,-1)])])}const J3e=kt({name:"kimi-search",render:X3e}),Q3e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function e8e(e,t){return y(),M("svg",Q3e,[...t[0]||(t[0]=[C("path",{d:"M16.5364 10.1636C16.8879 10.5151 16.8879 11.0849 16.5364 11.4364C16.1849 11.7879 15.6151 11.7879 15.2636 11.4364L12.9 9.07281V17.1C12.9 17.597 12.4971 18 12 18C11.503 18 11.1 17.597 11.1 17.1V9.07281L8.73641 11.4364C8.38494 11.7879 7.81509 11.7879 7.46362 11.4364C7.11214 11.0849 7.11214 10.5151 7.46362 10.1636L11.3636 6.2636C11.7151 5.91211 12.2849 5.91211 12.6364 6.2636L16.5364 10.1636Z",fill:"currentColor"},null,-1)])])}const t8e=kt({name:"kimi-send",render:e8e}),n8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function o8e(e,t){return y(),M("svg",n8e,[...t[0]||(t[0]=[C("path",{d:"M16.0404 12C16.0404 9.76874 14.2313 7.9596 12.0001 7.9596C9.76883 7.9596 7.95972 9.76874 7.95972 12C7.95972 14.2313 9.76883 16.0404 12.0001 16.0404C14.2313 16.0404 16.0404 14.2313 16.0404 12ZM14.2222 12C14.2222 13.2271 13.2271 14.2222 12 14.2222C10.7729 14.2222 9.77783 13.2271 9.77783 12C9.77783 10.7729 10.7729 9.77778 12 9.77778C13.2271 9.77778 14.2222 10.7729 14.2222 12Z",fill:"currentColor"},null,-1),C("path",{d:"M9.91145 21.8009C9.29001 21.6797 8.76914 21.2612 8.50632 20.6922L8.07372 19.7556C7.88838 19.3544 7.43553 19.1048 6.95371 19.1549L5.89572 19.2647C5.2733 19.3293 4.64823 19.114 4.22298 18.6611C3.74343 18.1504 3.32454 17.6037 2.97033 17.0181C2.61571 16.4318 2.32839 15.8106 2.10407 15.1566C1.89769 14.5549 2.02148 13.8954 2.4089 13.3902L3.0376 12.5704C3.30043 12.2277 3.30042 11.7722 3.03758 11.4295L2.40413 10.6035C2.01474 10.0958 1.891 9.43198 2.10208 8.82826C2.55037 7.54612 3.27017 6.35997 4.22 5.34259C4.64518 4.8872 5.27275 4.67067 5.89701 4.73544L6.95383 4.84514C7.43561 4.89515 7.88844 4.6456 8.07377 4.24441L8.50266 3.31593C8.76494 2.74818 9.28448 2.33019 9.90423 2.20761C11.2916 1.9332 12.7148 1.93127 14.0885 2.19913C14.7099 2.32029 15.2308 2.73881 15.4937 3.3078L15.9263 4.24441C16.1116 4.6456 16.5644 4.89514 17.0462 4.84514L18.1043 4.73532C18.7267 4.67072 19.3518 4.88603 19.777 5.33886C20.2566 5.84953 20.6755 6.3963 21.0297 6.98193C21.3843 7.56823 21.6716 8.18942 21.8959 8.84339C22.1023 9.44509 21.9785 10.1046 21.5911 10.6098L20.9624 11.4295C20.6996 11.7722 20.6996 12.2278 20.9624 12.5705L21.5959 13.3964C21.9853 13.9042 22.109 14.568 21.8979 15.1717C21.4497 16.4538 20.7299 17.6399 19.7801 18.6573C19.3549 19.1128 18.7273 19.3294 18.103 19.2646L17.0462 19.1549C16.5645 19.1049 16.1116 19.3544 15.9263 19.7556L15.4974 20.6841C15.2351 21.2518 14.7156 21.6698 14.0958 21.7924C12.7083 22.0668 11.2852 22.0687 9.91145 21.8009ZM13.7432 20.0088C13.7844 20.0006 13.8259 19.9673 13.847 19.9216L14.2758 18.9931C14.7915 17.8768 15.9886 17.2171 17.2341 17.3464L18.2909 17.4561C18.3649 17.4638 18.4272 17.4423 18.4512 17.4166C19.2296 16.5828 19.8171 15.6146 20.1817 14.5716C20.1845 14.5636 20.1796 14.5373 20.1532 14.5029L19.5198 13.677C18.7564 12.6815 18.7564 11.3185 19.5198 10.323L20.1485 9.5033C20.1746 9.46927 20.1795 9.4429 20.1762 9.43327C19.9932 8.89965 19.7603 8.39623 19.4741 7.92293C19.1873 7.4489 18.846 7.00333 18.4517 6.58351C18.4272 6.55739 18.3656 6.53616 18.2921 6.54378L17.234 6.65361C15.9886 6.78287 14.7915 6.12317 14.2758 5.00689L13.8432 4.07027C13.822 4.02448 13.7811 3.9916 13.7406 3.98371C12.5983 3.76097 11.4132 3.76258 10.2571 3.99124C10.2158 3.99941 10.1744 4.03271 10.1533 4.07842L9.72441 5.00689C9.20875 6.12317 8.01164 6.7829 6.76619 6.6536L5.70942 6.54391C5.63535 6.53623 5.573 6.55774 5.54905 6.5834C4.77067 7.41713 4.18312 8.38534 3.81845 9.42835C3.81564 9.43637 3.82054 9.46265 3.84693 9.49706L4.48038 10.323C5.24381 11.3185 5.24383 12.6815 4.48041 13.6769L3.85171 14.4967C3.82561 14.5307 3.82066 14.5571 3.82396 14.5667C4.00701 15.1004 4.23986 15.6038 4.52613 16.0771C4.81284 16.5511 5.15421 16.9967 5.54845 17.4165C5.57298 17.4426 5.63461 17.4638 5.70811 17.4562L6.76608 17.3464C8.01157 17.2171 9.20871 17.8768 9.72438 18.9932L10.157 19.9297C10.1781 19.9755 10.2191 20.0084 10.2595 20.0163C11.4018 20.239 12.587 20.2374 13.7432 20.0088Z",fill:"currentColor"},null,-1)])])}const s8e=kt({name:"kimi-setting",render:o8e}),i8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function r8e(e,t){return y(),M("svg",i8e,[...t[0]||(t[0]=[C("path",{d:"M17 2C19.2091 2 21 3.79086 21 6V15.7646C21 17.2361 20.192 18.5884 18.8965 19.2861L13.8965 21.9785C12.7126 22.616 11.2874 22.616 10.1035 21.9785L5.10352 19.2861C3.80802 18.5884 3 17.2361 3 15.7646V6C3 3.79086 4.79086 2 7 2H17ZM7 3.7998C5.78498 3.7998 4.79981 4.78497 4.7998 6V15.7646C4.7998 16.574 5.24443 17.3184 5.95703 17.7021L10.957 20.3936C11.6082 20.7442 12.3918 20.7442 13.043 20.3936L18.043 17.7021C18.7556 17.3184 19.2002 16.574 19.2002 15.7646V6C19.2002 4.78497 18.215 3.7998 17 3.7998H7Z",fill:"currentColor"},null,-1),C("path",{d:"M10.1611 7.37109C10.9017 6.79576 11.8605 6.60385 12.7881 6.8457C13.808 7.10861 14.6385 7.93756 14.9014 8.95898C15.2694 10.3845 14.5793 11.8629 13.2598 12.4736C13.0803 12.557 12.75 12.9552 12.75 13.3525V13.502C12.75 13.9172 12.4142 14.2527 11.999 14.2529C11.5837 14.2529 11.248 13.9173 11.248 13.502V13.3525C11.248 12.313 11.9587 11.4215 12.6279 11.1113C13.1777 10.8567 13.6681 10.192 13.4473 9.33496C13.3195 8.84253 12.9038 8.42684 12.4121 8.2998C11.9292 8.17289 11.4573 8.26727 11.0811 8.55859C10.71 8.84626 10.4971 9.28012 10.4971 9.74805C10.4968 10.1632 10.1613 10.499 9.74609 10.499C9.33092 10.499 8.99536 10.1632 8.99512 9.74805C8.99512 8.81152 9.41918 7.94493 10.1611 7.37109Z",fill:"currentColor"},null,-1),C("path",{d:"M11.999 15.0049C12.6208 15.0049 13.1259 15.5091 13.126 16.1309C13.126 16.7528 12.6209 17.2578 11.999 17.2578C11.3773 17.2576 10.873 16.7526 10.873 16.1309C10.8732 15.5092 11.3774 15.0051 11.999 15.0049Z",fill:"currentColor"},null,-1)])])}const l8e=kt({name:"kimi-shield-question",render:r8e}),a8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function u8e(e,t){return y(),M("svg",a8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.90005 12C2.90005 11.503 3.303 11.1 3.80005 11.1H12.2939L9.38588 8.19197C9.03441 7.8405 9.03441 7.27065 9.38588 6.91918C9.73735 6.56771 10.3072 6.56771 10.6587 6.91918L15.1031 11.3636C15.2719 11.5324 15.3667 11.7613 15.3667 12C15.3667 12.2387 15.2719 12.4676 15.1031 12.6364L10.6587 17.0809C10.3072 17.4323 9.73735 17.4323 9.38588 17.0809C9.03441 16.7294 9.03441 16.1595 9.38588 15.8081L12.2939 12.9H3.80005C3.303 12.9 2.90005 12.4971 2.90005 12ZM13.5874 20C13.5874 19.503 13.9904 19.1 14.4874 19.1H18.043C18.2758 19.1 18.4991 19.0075 18.6637 18.8429C18.8283 18.6783 18.9208 18.455 18.9208 18.2222V5.7778C18.9208 5.545 18.8283 5.32174 18.6637 5.15712C18.499 4.9925 18.2758 4.90002 18.043 4.90002H14.4874C13.9904 4.90002 13.5874 4.49708 13.5874 4.00002C13.5874 3.50297 13.9904 3.10003 14.4874 3.10003H18.043C18.7532 3.10003 19.4343 3.38215 19.9365 3.88433C20.4386 4.38651 20.7208 5.06761 20.7208 5.7778V18.2222C20.7208 18.9324 20.4386 19.6135 19.9365 20.1157C19.4343 20.6179 18.7532 20.9 18.043 20.9H14.4874C13.9904 20.9 13.5874 20.4971 13.5874 20Z",fill:"currentColor"},null,-1)])])}const c8e=kt({name:"kimi-sign-in",render:u8e}),d8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function f8e(e,t){return y(),M("svg",d8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M20.6364 11.3636C20.9879 11.7151 20.9879 12.2849 20.6364 12.6364L16.1919 17.0808C15.8405 17.4323 15.2706 17.4323 14.9192 17.0808C14.5677 16.7293 14.5677 16.1595 14.9192 15.808L17.8272 12.9H9.33333C8.83627 12.9 8.43333 12.497 8.43333 12C8.43333 11.5029 8.83627 11.1 9.33333 11.1H17.8272L14.9192 8.19193C14.5677 7.84046 14.5677 7.27061 14.9192 6.91914C15.2706 6.56766 15.8405 6.56766 16.1919 6.91914L20.6364 11.3636ZM10.2333 3.99998C10.2333 4.49703 9.83038 4.89998 9.33333 4.89998H5.77777C5.54497 4.89998 5.3217 4.99246 5.15709 5.15707C4.99247 5.32169 4.89999 5.54495 4.89999 5.77775V18.2222C4.89999 18.455 4.99247 18.6783 5.15709 18.8429C5.32171 19.0075 5.54497 19.1 5.77777 19.1H9.33333C9.83038 19.1 10.2333 19.5029 10.2333 20C10.2333 20.497 9.83038 20.9 9.33333 20.9H5.77777C5.06758 20.9 4.38648 20.6179 3.8843 20.1157C3.38212 19.6135 3.09999 18.9324 3.09999 18.2222V5.77775C3.09999 5.06756 3.38212 4.38646 3.8843 3.88428C4.38648 3.3821 5.06758 3.09998 5.77777 3.09998H9.33333C9.83038 3.09998 10.2333 3.50292 10.2333 3.99998Z",fill:"currentColor"},null,-1)])])}const p8e=kt({name:"kimi-sign-out",render:f8e}),h8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function m8e(e,t){return y(),M("svg",h8e,[...t[0]||(t[0]=[iu('',9)])])}const g8e=kt({name:"kimi-sliders",render:m8e}),v8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function y8e(e,t){return y(),M("svg",v8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M7.78027 8.90405C7.5 9.45411 7.5 10.1742 7.5 11.6144V12.3856C7.5 13.8258 7.5 14.5459 7.78027 15.096C8.02681 15.5798 8.42019 15.9732 8.90405 16.2197C9.45411 16.5 10.1742 16.5 11.6144 16.5H12.3856C13.8258 16.5 14.5459 16.5 15.096 16.2197C15.5798 15.9732 15.9732 15.5798 16.2197 15.096C16.5 14.5459 16.5 13.8258 16.5 12.3856V11.6144C16.5 10.1742 16.5 9.45411 16.2197 8.90405C15.9732 8.42019 15.5798 8.02681 15.096 7.78027C14.5459 7.5 13.8258 7.5 12.3856 7.5H11.6144C10.1742 7.5 9.45411 7.5 8.90405 7.78027C8.42019 8.02681 8.02681 8.42019 7.78027 8.90405Z",fill:"currentColor"},null,-1)])])}const k8e=kt({name:"kimi-stop",render:y8e}),b8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function C8e(e,t){return y(),M("svg",b8e,[...t[0]||(t[0]=[C("path",{d:"M7.01562 3.41459C7.4446 3.16449 7.9954 3.30924 8.24609 3.73784C8.49645 4.167 8.35189 4.71868 7.92285 4.96928C5.51497 6.37506 3.90054 8.98498 3.90039 11.9703C3.90076 16.4435 7.52672 20.0699 12 20.0699C16.4733 20.0699 20.0992 16.4435 20.0996 11.9703C20.0996 11.2291 20 10.5116 19.8145 9.83159C19.6838 9.35222 19.967 8.85702 20.4463 8.72612C20.9256 8.59541 21.4207 8.87778 21.5518 9.35698C21.7792 10.1901 21.9004 11.0674 21.9004 11.9703C21.9 17.4376 17.4674 21.8697 12 21.8697C6.53261 21.8697 2.09998 17.4376 2.09961 11.9703C2.09976 8.31904 4.07782 5.12972 7.01562 3.41459ZM8.39258 8.24077C8.75015 7.89591 9.3199 7.90591 9.66504 8.26323C10.01 8.62076 9.99985 9.19051 9.64258 9.53569C9.00203 10.1541 8.60558 11.02 8.60547 11.979C8.60584 13.8536 10.1253 15.3736 12 15.3736C13.8746 15.3735 15.3942 13.8536 15.3945 11.979C15.3945 11.6847 15.3577 11.3989 15.2881 11.1285C15.1646 10.6474 15.4536 10.1568 15.9346 10.0328C16.4158 9.9089 16.9071 10.1991 17.0312 10.6802C17.1383 11.096 17.1943 11.5321 17.1943 11.979C17.194 14.8477 14.8688 17.1733 12 17.1734C9.1312 17.1734 6.80506 14.8478 6.80469 11.979C6.8048 10.5117 7.41519 9.18431 8.39258 8.24077ZM11.5459 1.12651C11.8216 0.965605 12.1631 0.963306 12.4414 1.11967L19.1953 4.91752C19.4859 5.08108 19.662 5.39277 19.6533 5.72612C19.6443 6.05972 19.4515 6.36154 19.1523 6.50932L12.9004 9.5933V12.2583C12.9004 12.7554 12.4971 13.1587 12 13.1587C11.5029 13.1587 11.0996 12.7554 11.0996 12.2583V1.90385C11.0999 1.58444 11.2702 1.2878 11.5459 1.12651ZM12.9004 7.58549L16.8252 5.64897L12.9004 3.44194V7.58549Z",fill:"currentColor"},null,-1)])])}const w8e=kt({name:"kimi-target",render:C8e}),_8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function x8e(e,t){return y(),M("svg",_8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.9893 6.60743C20.5897 6.60757 21.8877 7.8926 21.8877 9.47736C21.8877 10.7416 21.0607 11.8129 19.9141 12.1955V14.257C19.914 15.8428 18.6152 17.1288 17.0137 17.1289H12.8438V20.1381C12.8437 20.6301 12.4412 21.0293 11.9443 21.0296C11.4473 21.0296 11.044 20.6302 11.0439 20.1381V16.4356C11.0441 15.8343 11.5363 15.3461 12.1436 15.3458H17.0137C17.6211 15.3457 18.1133 14.8585 18.1133 14.257V12.2129C16.9408 11.8451 16.0909 10.7598 16.0908 9.47736C16.0908 7.89251 17.3887 6.60743 18.9893 6.60743ZM18.9893 8.38953C18.3828 8.38953 17.8906 8.87684 17.8906 9.47736C17.8907 10.0778 18.3828 10.5642 18.9893 10.5642C19.5956 10.5641 20.0869 10.0777 20.0869 9.47736C20.0869 8.87693 19.5956 8.38967 18.9893 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4.89844 6.60743C6.49899 6.60747 7.79688 7.89254 7.79688 9.47736C7.79684 10.7388 6.97371 11.8078 5.83105 12.1926V14.4021C5.83105 15.0036 6.32315 15.4918 6.93066 15.4918H8.37109C8.86789 15.492 9.27038 15.8905 9.27051 16.3824C9.27051 16.8744 8.86797 17.2737 8.37109 17.2739H6.93066C5.32904 17.2739 4.03027 15.9879 4.03027 14.4021V12.2158C2.85382 11.8504 2.00004 10.7627 2 9.47736C2 7.89251 3.29784 6.60743 4.89844 6.60743ZM4.89844 8.38953C4.29196 8.38953 3.7998 8.87684 3.7998 9.47736C3.79985 10.0778 4.29198 10.5642 4.89844 10.5642C5.50485 10.5642 5.99605 10.0778 5.99609 9.47736C5.99609 8.87687 5.50488 8.38958 4.89844 8.38953Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.9434 2.9707C13.5439 2.97075 14.8418 4.25581 14.8418 5.84063C14.8418 7.11413 14.0035 8.1923 12.8438 8.56745V13.0135C12.8436 13.5056 12.4403 13.9041 11.9434 13.9041C11.4466 13.9039 11.0431 13.5055 11.043 13.0135V8.56745C9.8836 8.19209 9.04496 7.11387 9.04492 5.84063C9.04492 4.25592 10.343 2.97093 11.9434 2.9707ZM11.9434 4.75281C11.3371 4.75303 10.8447 5.24026 10.8447 5.84063C10.8448 6.44097 11.3371 6.92726 11.9434 6.92749C12.5498 6.92745 13.041 6.44108 13.041 5.84063C13.041 5.24014 12.5498 4.75285 11.9434 4.75281Z",fill:"currentColor"},null,-1)])])}const S8e=kt({name:"kimi-task",render:x8e}),A8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function M8e(e,t){return y(),M("svg",A8e,[...t[0]||(t[0]=[C("path",{d:"M16.5293 15.0596C16.9496 15.1021 17.2772 15.4572 17.2773 15.8887C17.2773 16.3202 16.9497 16.6753 16.5293 16.7178L16.4443 16.7217H12C11.5399 16.7216 11.167 16.3488 11.167 15.8887C11.1671 15.4286 11.54 15.0558 12 15.0557H16.4443L16.5293 15.0596Z",fill:"currentColor"},null,-1),C("path",{d:"M6.96582 7.52246C7.27077 7.21751 7.75375 7.1983 8.08105 7.46484L8.14453 7.52246L10.8232 10.2002C11.5102 10.8872 11.5102 12.0014 10.8232 12.6885L8.14453 15.3672L8.08105 15.4248C7.75377 15.6913 7.27075 15.6721 6.96582 15.3672C6.66114 15.0621 6.64234 14.5791 6.90918 14.252L6.96582 14.1885L9.64453 11.5098C9.68057 11.4736 9.68062 11.415 9.64453 11.3789L6.96582 8.7002C6.64116 8.37488 6.6411 7.84774 6.96582 7.52246Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M17 3.09961C19.1539 3.09966 20.9004 4.84612 20.9004 7V17C20.9004 19.1539 19.1539 20.9003 17 20.9004H7C4.84609 20.9004 3.09961 19.1539 3.09961 17V7C3.09961 4.84609 4.84609 3.09961 7 3.09961H17ZM7 4.90039C5.8402 4.90039 4.90039 5.8402 4.90039 7V17C4.90039 18.1598 5.8402 19.0996 7 19.0996H17C18.1598 19.0996 19.0996 18.1598 19.0996 17V7C19.0996 5.84024 18.1598 4.90044 17 4.90039H7Z",fill:"currentColor"},null,-1)])])}const T8e=kt({name:"kimi-terminal",render:M8e}),E8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function I8e(e,t){return y(),M("svg",E8e,[...t[0]||(t[0]=[C("path",{d:"M16.9971 3.90597C15.9799 2.99725 14.7342 2.38312 13.394 2.12966C12.0538 1.8762 10.6699 1.99301 9.39111 2.46751C8.11236 2.94202 6.98721 3.75626 6.13676 4.82261C5.2863 5.88896 4.74274 7.16703 4.56457 8.5193C4.40455 9.70501 4.53253 10.9118 4.93767 12.0376C5.34281 13.1634 6.01318 14.175 6.89207 14.9868C7.43557 15.4634 7.87413 16.0477 8.17997 16.7027C8.48581 17.3577 8.65224 18.0691 8.66873 18.7918V18.926C8.66962 19.7412 8.99387 20.5229 9.57035 21.0993C10.1468 21.6758 10.9285 22.0001 11.7437 22.001H12.2604C13.0757 22.0001 13.8573 21.6758 14.4338 21.0993C15.0103 20.5229 15.3345 19.7412 15.3354 18.926V18.4685C15.3479 17.8297 15.4982 17.2011 15.7761 16.6258C16.0539 16.0505 16.4528 15.542 16.9454 15.1351C17.7442 14.4355 18.3853 13.5741 18.826 12.608C19.2668 11.642 19.4973 10.5932 19.5022 9.53136C19.5071 8.46948 19.2863 7.41869 18.8544 6.4486C18.4225 5.4785 17.7894 4.61125 16.9971 3.9043V3.90597ZM12.2604 20.3343H11.7437C11.3704 20.3339 11.0124 20.1853 10.7484 19.9213C10.4844 19.6573 10.3358 19.2993 10.3354 18.926C10.3354 18.926 10.3296 18.7093 10.3287 18.6676H13.6687V18.926C13.6683 19.2993 13.5198 19.6573 13.2558 19.9213C12.9917 20.1853 12.6338 20.3339 12.2604 20.3343ZM15.8437 13.8835C14.8949 14.7064 14.2097 15.7908 13.8737 17.001H12.8354V11.0143C13.3212 10.8426 13.742 10.5249 14.0403 10.1049C14.3387 9.68482 14.4999 9.18285 14.5021 8.66763C14.5021 8.44662 14.4143 8.23466 14.258 8.07838C14.1017 7.9221 13.8897 7.8343 13.6687 7.8343C13.4477 7.8343 13.2358 7.9221 13.0795 8.07838C12.9232 8.23466 12.8354 8.44662 12.8354 8.66763C12.8354 8.88865 12.7476 9.10061 12.5913 9.25689C12.435 9.41317 12.2231 9.50097 12.0021 9.50097C11.7811 9.50097 11.5691 9.41317 11.4128 9.25689C11.2565 9.10061 11.1687 8.88865 11.1687 8.66763C11.1687 8.44662 11.0809 8.23466 10.9247 8.07838C10.7684 7.9221 10.5564 7.8343 10.3354 7.8343C10.1144 7.8343 9.90242 7.9221 9.74614 8.07838C9.58986 8.23466 9.50207 8.44662 9.50207 8.66763C9.5042 9.18285 9.66547 9.68482 9.96381 10.1049C10.2621 10.5249 10.683 10.8426 11.1687 11.0143V17.001H10.0671C9.69123 15.7586 8.98633 14.6411 8.02707 13.7668C7.21286 13.0081 6.63267 12.0324 6.35496 10.9547C6.07725 9.87703 6.1136 8.7424 6.45974 7.68471C6.80588 6.62702 7.44735 5.69042 8.30846 4.98543C9.16956 4.28045 10.2144 3.83649 11.3196 3.70597C11.5487 3.68039 11.779 3.66759 12.0096 3.66763C13.4409 3.66338 14.8226 4.19149 15.8862 5.1493C16.5026 5.69896 16.9952 6.37337 17.3312 7.12782C17.6672 7.88227 17.839 8.69952 17.8352 9.5254C17.8314 10.3513 17.6522 11.1669 17.3092 11.9183C16.9663 12.6696 16.4677 13.3395 15.8462 13.8835H15.8437Z",fill:"currentColor"},null,-1)])])}const L8e=kt({name:"kimi-thinking",render:I8e}),$8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function N8e(e,t){return y(),M("svg",$8e,[...t[0]||(t[0]=[iu('',6)])])}const F8e=kt({name:"kimi-todo",render:N8e}),R8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function O8e(e,t){return y(),M("svg",R8e,[...t[0]||(t[0]=[C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8.09752 2.19507C8.5421 1.97278 9.08271 2.15298 9.305 2.59756L10.0562 4.10005H13.5C13.9971 4.10005 14.4 4.50299 14.4 5.00005C14.4 5.49711 13.9971 5.90005 13.5 5.90005H12.3106C12.2556 6.2319 12.1667 6.64073 12.0226 7.0987C11.7254 8.04355 11.191 9.20402 10.2334 10.3239C11.4166 11.196 12.5606 11.7524 13.4512 12.0987C13.978 12.3036 14.4136 12.434 14.7124 12.5122L14.7348 12.5181L15.695 10.5976C15.8475 10.2927 16.1591 10.1 16.5 10.1C16.8409 10.1 17.1525 10.2927 17.305 10.5976L20.7969 17.5814L20.8044 17.5959L20.8137 17.615L21.805 19.5976C22.0273 20.0421 21.8471 20.5827 21.4025 20.805C20.9579 21.0273 20.4173 20.8471 20.195 20.4025L19.4438 18.9H13.5562L12.805 20.4025C12.5827 20.8471 12.0421 21.0273 11.5975 20.805C11.1529 20.5827 10.9727 20.0421 11.195 19.5976L12.1863 17.615C12.1917 17.6036 12.1973 17.5924 12.2031 17.5814L13.9146 14.1583C13.6034 14.0667 13.2256 13.9423 12.7988 13.7764C11.7294 13.3605 10.3442 12.6802 8.92538 11.5924C7.79753 12.5167 6.69473 13.0764 5.83285 13.4112C5.33899 13.603 4.92286 13.7216 4.62401 13.7931C4.47449 13.8288 4.35399 13.8529 4.26741 13.8684C4.2241 13.8762 4.18924 13.8818 4.16343 13.8858L4.13156 13.8904L4.12084 13.8919L4.11682 13.8924L4.11514 13.8927C4.11514 13.8927 4.11368 13.8928 4.00001 13L4.11368 13.8928C3.62061 13.9556 3.17 13.6068 3.10722 13.1137C3.0446 12.6219 3.39148 12.1723 3.88256 12.1077L3.94947 12.0967C4.00428 12.0869 4.09114 12.0698 4.20543 12.0424C4.43422 11.9877 4.77156 11.8924 5.18106 11.7334C5.84103 11.477 6.68484 11.0564 7.56458 10.3753C7.15054 9.93496 6.78945 9.48388 6.50421 9.10102C6.26672 8.78224 6.07517 8.50172 5.94227 8.29973C5.87571 8.19858 5.82359 8.11671 5.78748 8.05909C5.76942 8.03027 5.75535 8.00749 5.74545 7.99135L5.73377 7.9722L5.73032 7.96651L5.72864 7.96371C5.71133 7.9349 5.69582 7.9055 5.68208 7.87566C5.49265 7.46416 5.6393 6.96717 6.03659 6.72853C6.09037 6.69623 6.14617 6.6702 6.20315 6.65023C6.59739 6.51205 7.04758 6.66421 7.27129 7.03623L7.27266 7.0385L7.28001 7.05054C7.28695 7.06186 7.29793 7.07964 7.31274 7.10328C7.34239 7.15059 7.38731 7.2212 7.44595 7.31032C7.56343 7.48886 7.73484 7.73997 7.94765 8.02562C8.21085 8.37889 8.52772 8.77187 8.8756 9.14201C9.64226 8.24147 10.0681 7.3133 10.3056 6.55854C10.381 6.3186 10.4372 6.09683 10.4791 5.90005H9.51951C9.50696 5.90031 9.49442 5.90031 9.48191 5.90005H4.00001C3.50296 5.90005 3.10001 5.49711 3.10001 5.00005C3.10001 4.50299 3.50296 4.10005 4.00001 4.10005H8.04378L7.69503 3.40254C7.67314 3.35877 7.65516 3.31407 7.64094 3.26883C7.51078 2.8546 7.69671 2.39547 8.09752 2.19507ZM16.5 13.0125L18.5438 17.1H14.4562L16.5 13.0125Z",fill:"currentColor"},null,-1),C("path",{d:"M15.1 4.00007C15.1 3.50301 15.5029 3.10007 16 3.10007H18C19.6016 3.10007 20.9 4.39844 20.9 6.00007V8.00007C20.9 8.49712 20.497 8.90007 20 8.90007C19.5029 8.90007 19.1 8.49712 19.1 8.00007V6.00007C19.1 5.39255 18.6075 4.90007 18 4.90007H16C15.5029 4.90007 15.1 4.49712 15.1 4.00007Z",fill:"currentColor"},null,-1),C("path",{d:"M3.99998 15.1001C4.49703 15.1001 4.89998 15.503 4.89998 16.0001V18.0001C4.89998 18.6076 5.39246 19.1001 5.99998 19.1001H7.99998C8.49703 19.1001 8.89998 19.503 8.89998 20.0001C8.89998 20.4971 8.49703 20.9001 7.99998 20.9001H5.99998C4.39835 20.9001 3.09998 19.6017 3.09998 18.0001V16.0001C3.09998 15.503 3.50292 15.1001 3.99998 15.1001Z",fill:"currentColor"},null,-1)])])}const P8e=kt({name:"kimi-translate",render:O8e}),D8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function B8e(e,t){return y(),M("svg",D8e,[...t[0]||(t[0]=[C("path",{d:"M8.10001 3C8.10001 2.50294 8.50295 2.1 9.00001 2.1H15C15.4971 2.1 15.9 2.50294 15.9 3C15.9 3.49706 15.4971 3.9 15 3.9H9.00001C8.50295 3.9 8.10001 3.49706 8.10001 3Z",fill:"currentColor"},null,-1),C("path",{d:"M10 15.9C9.50295 15.9 9.10001 15.4971 9.10001 15L9.10001 10C9.10001 9.50294 9.50295 9.1 10 9.1C10.4971 9.1 10.9 9.50294 10.9 10L10.9 15C10.9 15.4971 10.4971 15.9 10 15.9Z",fill:"currentColor"},null,-1),C("path",{d:"M13.1 15C13.1 15.4971 13.5029 15.9 14 15.9C14.4971 15.9 14.9 15.4971 14.9 15L14.9 10C14.9 9.50294 14.4971 9.1 14 9.1C13.5029 9.1 13.1 9.50294 13.1 10V15Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.10001 6C2.10001 5.50294 2.50295 5.1 3.00001 5.1H4.99152C4.99785 5.09993 5.00417 5.09993 5.01048 5.1H18.9895C18.9958 5.09993 19.0021 5.09993 19.0085 5.1H21C21.4971 5.1 21.9 5.50294 21.9 6C21.9 6.49706 21.4971 6.9 21 6.9H19.8281L18.8448 18.6993C18.7412 19.9432 17.7013 20.9 16.4531 20.9H7.54686C6.29865 20.9 5.25881 19.9432 5.15515 18.6993L4.17188 6.9H3.00001C2.50295 6.9 2.10001 6.49706 2.10001 6ZM5.97811 6.9L18.0219 6.9L17.0511 18.5498C17.0251 18.8608 16.7652 19.1 16.4531 19.1H7.54686C7.23481 19.1 6.97485 18.8608 6.94893 18.5498L5.97811 6.9Z",fill:"currentColor"},null,-1)])])}const H8e=kt({name:"kimi-trash",render:B8e}),z8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function W8e(e,t){return y(),M("svg",z8e,[...t[0]||(t[0]=[C("path",{d:"M7.36336 3.3634C7.71483 3.01192 8.28533 3.01192 8.6368 3.3634C8.98817 3.71488 8.98824 4.2854 8.6368 4.63683L6.17391 7.09972H15.0001C18.2585 7.09977 20.9005 9.74166 20.9005 13.0001C20.9004 16.2585 18.2585 18.9005 15.0001 18.9005H7.00008C6.50307 18.9005 6.09976 18.4971 6.09969 18.0001C6.09969 17.5031 6.50302 17.0997 7.00008 17.0997H15.0001C17.2644 17.0997 19.0996 15.2644 19.0997 13.0001C19.0997 10.7358 17.2644 8.90055 15.0001 8.90051H6.17391L8.6368 11.3634L8.69832 11.4318C8.98668 11.7853 8.96632 12.3073 8.6368 12.6368C8.30728 12.9663 7.78521 12.9867 7.43172 12.6984L7.36336 12.6368L3.36336 8.63683C3.33098 8.60445 3.30286 8.56908 3.27645 8.53332C3.25597 8.50559 3.23607 8.47741 3.21883 8.44738C3.20492 8.42311 3.19221 8.39837 3.18074 8.37316C3.1764 8.36365 3.17109 8.35453 3.16707 8.34484C3.1627 8.33427 3.1593 8.32331 3.15535 8.31261C3.12946 8.24274 3.11237 8.16872 3.10457 8.09191C3.09258 7.97426 3.10262 7.85446 3.1368 7.74035C3.14281 7.72035 3.15094 7.70114 3.15828 7.68176C3.16165 7.67283 3.16341 7.66325 3.16707 7.65441C3.17216 7.64216 3.17806 7.63025 3.18367 7.61828C3.19055 7.60356 3.19744 7.58874 3.20516 7.57433C3.24709 7.49624 3.3012 7.42556 3.36336 7.3634L7.36336 3.3634Z",fill:"currentColor"},null,-1)])])}const U8e=kt({name:"kimi-undo",render:W8e}),j8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function V8e(e,t){return y(),M("svg",j8e,[...t[0]||(t[0]=[C("path",{d:"M11.9997 12.8779C16.0197 12.878 19.4393 15.3848 20.7048 18.8828C21.0812 19.9234 20.2782 20.8962 19.2038 21.0137L18.9861 21.0264H5.0134L4.79562 21.0137C3.7213 20.8961 2.91743 19.9233 3.29367 18.8828C4.55905 15.3847 7.9797 12.8781 11.9997 12.8779ZM11.9997 14.6777C8.84467 14.6779 6.17462 16.5794 5.09152 19.2256H18.9079C17.8248 16.5793 15.1549 14.6778 11.9997 14.6777ZM12.2312 3.00586C14.6088 3.1264 16.4997 5.09239 16.4997 7.5L16.4939 7.73145C16.3734 10.1091 14.4073 11.9999 11.9997 12C9.59225 11.9998 7.62604 10.109 7.50558 7.73145L7.49973 7.5C7.49973 5.01485 9.51462 3.00021 11.9997 3L12.2312 3.00586ZM11.9997 4.7998C10.5087 4.80001 9.29953 6.00896 9.29953 7.5C9.29953 8.99104 10.5087 10.2 11.9997 10.2002C13.4908 10.2001 14.6999 8.99112 14.6999 7.5C14.6999 6.00888 13.4908 4.79989 11.9997 4.7998Z",fill:"currentColor"},null,-1)])])}const q8e=kt({name:"kimi-user",render:V8e}),K8e={width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Z8e(e,t){return y(),M("svg",K8e,[...t[0]||(t[0]=[C("path",{d:"M11.9996 7C11.5026 7 11.0996 7.36985 11.0996 7.82609V14.1739C11.0996 14.6301 11.5026 15 11.9996 15C12.4967 15 12.8996 14.6301 12.8996 14.1739V7.82609C12.8996 7.36985 12.4967 7 11.9996 7Z",fill:"currentColor"},null,-1),C("path",{d:"M12.8996 17.1006C12.8996 17.5974 12.4968 18.001 11.9992 18.001C11.5024 18.001 11.0996 17.5974 11.0996 17.1006C11.0996 16.6038 11.5024 16.2002 11.9992 16.2002C12.4968 16.2002 12.8996 16.6038 12.8996 17.1006Z",fill:"currentColor"},null,-1),C("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M14.5108 3.5501C13.3946 1.61676 10.6041 1.61676 9.48786 3.5501L1.69363 17.0501C0.577423 18.9834 1.97269 21.4001 4.20511 21.4001H19.7936C22.026 21.4001 23.4212 18.9834 22.305 17.0501L14.5108 3.5501ZM11.0467 4.4501C11.4701 3.71676 12.5286 3.71676 12.952 4.4501L20.7462 17.9501C21.1696 18.6834 20.6403 19.6001 19.7936 19.6001H4.20511C3.35833 19.6001 2.82909 18.6834 3.25248 17.9501L11.0467 4.4501Z",fill:"currentColor"},null,-1)])])}const G8e=kt({name:"kimi-warning",render:Z8e}),Y8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function X8e(e,t){return y(),M("svg",Y8e,[...t[0]||(t[0]=[C("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[C("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2zm11-2v16"}),C("path",{d:"m9 10l2 2l-2 2"})],-1)])])}const J8e=kt({name:"tabler-layout-sidebar-right-collapse",render:X8e}),Q8e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function eye(e,t){return y(),M("svg",Q8e,[...t[0]||(t[0]=[C("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m15 7l-6.5 6.5a1.5 1.5 0 0 0 3 3L18 10a3 3 0 0 0-6-6l-6.5 6.5a4.5 4.5 0 0 0 9 9L21 13"},null,-1)])])}const tye=kt({name:"tabler-paperclip",render:eye}),nye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function oye(e,t){return y(),M("svg",nye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M4 18v-3.7a1.5 1.5 0 0 0-1.5-1.5H2v-1.6h.5A1.5 1.5 0 0 0 4 9.7V6a3 3 0 0 1 3-3h1v2H7a1 1 0 0 0-1 1v4.1A2 2 0 0 1 4.626 12A2 2 0 0 1 6 13.9V18a1 1 0 0 0 1 1h1v2H7a3 3 0 0 1-3-3m16-3.7V18a3 3 0 0 1-3 3h-1v-2h1a1 1 0 0 0 1-1v-4.1a2 2 0 0 1 1.374-1.9A2 2 0 0 1 18 10.1V6a1 1 0 0 0-1-1h-1V3h1a3 3 0 0 1 3 3v3.7a1.5 1.5 0 0 0 1.5 1.5h.5v1.6h-.5a1.5 1.5 0 0 0-1.5 1.5"},null,-1)])])}const sye=kt({name:"ri-braces-line",render:oye}),iye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function rye(e,t){return y(),M("svg",iye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 3V1H7v2H3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h18a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1h-4V1h-2v2zm-5 7h16v9H4zm0-5h3v1h2V5h6v1h2V5h3v3H4zm5.879 5.964L12 13.086l2.121-2.122l1.415 1.415l-2.122 2.121l2.121 2.121l-1.414 1.414L12 15.915l-2.121 2.12l-1.415-1.414l2.122-2.12l-2.122-2.122z"},null,-1)])])}const lye=kt({name:"ri-calendar-close-line",render:rye}),aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function uye(e,t){return y(),M("svg",aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M7 3V1h2v2h6V1h2v2h4a1 1 0 0 1 1 1v5h-2V5h-3v2h-2V5H9v2H7V5H4v14h6v2H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zm10 9a4 4 0 1 0 0 8a4 4 0 0 0 0-8m-6 4a6 6 0 1 1 12 0a6 6 0 0 1-12 0m5-3v3.414l2.293 2.293l1.414-1.414L18 15.586V13z"},null,-1)])])}const cye=kt({name:"ri-calendar-schedule-line",render:uye}),dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function fye(e,t){return y(),M("svg",dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M9 1v2h6V1h2v2h4a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h4V1zm11 10H4v8h16zM8 14v2H6v-2zm10 0v2h-8v-2zM7 5H4v4h16V5h-3v2h-2V5H9v2H7z"},null,-1)])])}const pye=kt({name:"ri-calendar-todo-line",render:fye}),hye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function mye(e,t){return y(),M("svg",hye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m23 12l-7.071 7.071l-1.414-1.414L20.172 12l-5.657-5.657l1.414-1.414zM3.828 12l5.657 5.657l-1.414 1.414L1 12l7.071-7.071l1.414 1.414z"},null,-1)])])}const gye=kt({name:"ri-code-line",render:mye}),vye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function yye(e,t){return y(),M("svg",vye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10s-4.477 10-10 10m0-2a8 8 0 1 0 0-16a8 8 0 0 0 0 16m-4-7h8a4 4 0 0 1-8 0m0-2a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3m8 0a1.5 1.5 0 1 1 0-3a1.5 1.5 0 0 1 0 3"},null,-1)])])}const kye=kt({name:"ri-emotion-line",render:yye}),bye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Cye(e,t){return y(),M("svg",bye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 6v2H5v11h11v-5h2v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1zm11-3v8h-2V6.413l-7.793 7.794l-1.414-1.414L17.585 5H13V3z"},null,-1)])])}const wye=kt({name:"ri-external-link-line",render:Cye}),_ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function xye(e,t){return y(),M("svg",_ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12 3c5.392 0 9.878 3.88 10.819 9c-.94 5.12-5.427 9-10.819 9s-9.878-3.88-10.818-9C2.122 6.88 6.608 3 12 3m0 16a9.005 9.005 0 0 0 8.778-7a9.005 9.005 0 0 0-17.555 0A9.005 9.005 0 0 0 12 19m0-2.5a4.5 4.5 0 1 1 0-9a4.5 4.5 0 0 1 0 9m0-2a2.5 2.5 0 1 0 0-5a2.5 2.5 0 0 0 0 5"},null,-1)])])}const Sye=kt({name:"ri-eye-line",render:xye}),Aye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Mye(e,t){return y(),M("svg",Aye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M17.883 19.297A10.95 10.95 0 0 1 12 21c-5.392 0-9.878-3.88-10.818-9A11 11 0 0 1 4.52 5.935L1.394 2.808l1.414-1.414l19.799 19.798l-1.414 1.415zM5.936 7.35A8.97 8.97 0 0 0 3.223 12a9.005 9.005 0 0 0 13.201 5.838l-2.028-2.028A4.5 4.5 0 0 1 8.19 9.604zm6.978 6.978l-3.242-3.241a2.5 2.5 0 0 0 3.241 3.241m7.893 2.265l-1.431-1.431A8.9 8.9 0 0 0 20.778 12A9.005 9.005 0 0 0 9.552 5.338L7.974 3.76C9.221 3.27 10.58 3 12 3c5.392 0 9.878 3.88 10.819 9a10.95 10.95 0 0 1-2.012 4.593m-9.084-9.084Q11.86 7.5 12 7.5a4.5 4.5 0 0 1 4.492 4.778z"},null,-1)])])}const Tye=kt({name:"ri-eye-off-line",render:Mye}),Eye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Iye(e,t){return y(),M("svg",Eye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 4H5v16h14V8h-4zM3 2.992C3 2.444 3.447 2 3.999 2H16l5 5v13.993A1 1 0 0 1 20.007 22H3.993A1 1 0 0 1 3 21.008zM11 11V8h2v3h3v2h-3v3h-2v-3H8v-2z"},null,-1)])])}const Lye=kt({name:"ri-file-add-line",render:Iye}),$ye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Nye(e,t){return y(),M("svg",$ye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M13 9h8L11 24v-9H4l9-15zm-2 2V7.22L7.532 13H13v4.394L17.263 11z"},null,-1)])])}const Fye=kt({name:"ri-flashlight-line",render:Nye}),Rye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Oye(e,t){return y(),M("svg",Rye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M12.414 5H21a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h7.414z"},null,-1)])])}const Pye=kt({name:"ri-folder-fill",render:Oye}),Dye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Bye(e,t){return y(),M("svg",Dye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M6 5a1 1 0 1 0 0 2a1 1 0 0 0 0-2M3 6a3 3 0 1 1 4 2.83V9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-.17a3.001 3.001 0 1 1 2 0V9a4 4 0 0 1-4 4h-2v2.17a3.001 3.001 0 1 1-2 0V13H9a4 4 0 0 1-4-4v-.17A3 3 0 0 1 3 6m15-1a1 1 0 1 0 0 2a1 1 0 0 0 0-2m-6 12a1 1 0 1 0 0 2a1 1 0 0 0 0-2"},null,-1)])])}const Hye=kt({name:"ri-git-fork-line",render:Bye}),zye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Wye(e,t){return y(),M("svg",zye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M15 5h2a2 2 0 0 1 2 2v8.17a3.001 3.001 0 1 1-2 0V7h-2v3l-4.5-4L15 2zM5 8.83a3.001 3.001 0 1 1 2 0v6.34a3.001 3.001 0 1 1-2 0zM6 7a1 1 0 1 0 0-2a1 1 0 0 0 0 2m0 12a1 1 0 1 0 0-2a1 1 0 0 0 0 2m12 0a1 1 0 1 0 0-2a1 1 0 0 0 0 2"},null,-1)])])}const Uye=kt({name:"ri-git-pull-request-line",render:Wye}),jye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Vye(e,t){return y(),M("svg",jye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M2 18h7v2H2zm0-7h9v2H2zm0-7h20v2H2zm18.674 9.025l1.156-.391l1 1.732l-.916.805a4 4 0 0 1 0 1.658l.916.805l-1 1.732l-1.156-.391a4 4 0 0 1-1.435.83L19 21h-2l-.24-1.196a4 4 0 0 1-1.434-.83l-1.156.392l-1-1.732l.916-.805a4 4 0 0 1 0-1.658l-.916-.805l1-1.732l1.156.391c.41-.37.898-.655 1.435-.83L17 11h2l.24 1.196a4 4 0 0 1 1.434.83M18 18a2 2 0 1 0 0-4a2 2 0 0 0 0 4"},null,-1)])])}const qye=kt({name:"ri-list-settings-line",render:Vye}),Kye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Zye(e,t){return y(),M("svg",Kye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M10 2a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H8v2h5V9a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H8v6h5v-1a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-6a1 1 0 0 1-1-1v-1H7a1 1 0 0 1-1-1V8H4a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zm9 16h-4v2h4zm0-8h-4v2h4zM9 4H5v2h4z"},null,-1)])])}const Gye=kt({name:"ri-node-tree",render:Zye}),Yye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function Xye(e,t){return y(),M("svg",Yye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m13.827 1.69l8.486 8.485l-1.415 1.414l-.707-.707l-4.242 4.243l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243l1.414-1.414l3.536-.707l4.242-4.243l-.707-.707zm.707 3.536l-4.67 4.67l-2.822.565l6.5 6.5l.564-2.822l4.671-4.67z"},null,-1)])])}const Jye=kt({name:"ri-pushpin-line",render:Xye}),Qye={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function e5e(e,t){return y(),M("svg",Qye,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M20 4v12h3l-4 5l-4-5h3V4zm-8 14v2H3v-2zm2-7v2H3v-2zm0-7v2H3V4z"},null,-1)])])}const t5e=kt({name:"ri-sort-desc",render:e5e}),n5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function o5e(e,t){return y(),M("svg",n5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928z"},null,-1)])])}const s5e=kt({name:"ri-star-fill",render:o5e}),i5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function r5e(e,t){return y(),M("svg",i5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m12 18.26l-7.053 3.948l1.575-7.928L.588 8.792l8.027-.952L12 .5l3.385 7.34l8.027.952l-5.934 5.488l1.575 7.928zm0-2.292l4.247 2.377l-.948-4.773l3.573-3.305l-4.833-.573l-2.038-4.419l-2.039 4.42l-4.833.572l3.573 3.305l-.948 4.773z"},null,-1)])])}const l5e=kt({name:"ri-star-line",render:r5e}),a5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function u5e(e,t){return y(),M("svg",a5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"M5.33 3.272a3.5 3.5 0 0 1 4.254 4.962l10.709 10.71l-1.414 1.414l-10.71-10.71a3.502 3.502 0 0 1-4.962-4.255L5.444 7.63a1.5 1.5 0 0 0 2.121-2.121zm10.367 1.883l3.182-1.768l1.414 1.415l-1.768 3.182l-1.768.353l-2.12 2.121l-1.415-1.414l2.121-2.121zm-6.718 8.132l1.415 1.414l-5.304 5.303a1 1 0 0 1-1.492-1.327l.078-.087z"},null,-1)])])}const c5e=kt({name:"ri-tools-line",render:u5e}),d5e={viewBox:"0 0 24 24",width:"1.2em",height:"1.2em"};function f5e(e,t){return y(),M("svg",d5e,[...t[0]||(t[0]=[C("path",{fill:"currentColor",d:"m20.97 17.172l-1.414 1.414l-3.535-3.535l-.073.074l-.707 3.536l-1.415 1.414l-4.242-4.243l-4.95 4.95l-1.414-1.414l4.95-4.95l-4.243-4.243L5.34 8.761l3.536-.707l.073-.074l-3.536-3.536L6.828 3.03zM10.365 9.394l-.502.502l-2.822.565l6.5 6.5l.564-2.822l.502-.502zm8.411.074l-1.34 1.34l1.414 1.415l1.34-1.34l.707.707l1.415-1.415l-8.486-8.485l-1.414 1.414l.707.707l-1.34 1.34l1.414 1.415l1.34-1.34z"},null,-1)])])}const p5e=kt({name:"ri-unpin-line",render:f5e}),h5e=` `,m5e=` @@ -598,7 +598,7 @@ ${_}`);c+=T}else c+=S;c+=w,d=h?f+1:e.length}return c}function Yue(e,t){if(!e||!t `,M6e='',T6e='',E6e='',I6e='',L6e='',$6e='',N6e='',F6e='',R6e='',O6e='',P6e='',D6e='',B6e='',H6e='',z6e='',W6e='',U6e='',j6e='',V6e='',q6e='',K6e='',Z6e='',G6e='',Y6e='',X6e={sm:14,md:16,lg:20};function xt(e,t){return{component:e,svg:t}}const BN={plus:xt(d9e,h5e),"chat-new":xt(h9e,m5e),"calendar-close":xt(lye,I6e),"calendar-schedule":xt(cye,L6e),"calendar-todo":xt(pye,$6e),close:xt(K9e,A5e),check:xt($9e,C5e),archive:xt(v9e,g5e),search:xt(J3e,u6e),copy:xt(n4e,E5e),link:xt(g3e,X5e),"external-link":xt(wye,R6e),download:xt(a4e,L5e),undo:xt(U8e,x6e),send:xt(t8e,c6e),image:xt(G4e,j5e),settings:xt(s8e,d6e),sliders:xt(g8e,m6e),"light-mode":xt(p3e,Y5e),"dark-mode":xt(i4e,I5e),"follow-system":xt(L4e,D5e),"log-in":xt(c8e,p6e),"log-out":xt(p8e,h6e),hand:xt(U4e,W5e),"full-access":xt(F4e,B5e),"shield-question":xt(l8e,f6e),"chevron-down":xt(R9e,w5e),"chevron-right":xt(D9e,_5e),"chevron-up":xt(z9e,x5e),"arrow-up":xt(E9e,b5e),"arrow-down":xt(b9e,v5e),"arrow-right":xt(A9e,k5e),"arrow-left":xt(_9e,y5e),minus:xt(S3e,e6e),microscope:xt(T3e,t6e),"panel-collapse":xt(l3e,Z5e),"panel-collapse-right":xt(J8e,M6e),"panel-expand":xt(c3e,G5e),expand:xt(h4e,N5e),collapse:xt(Y9e,M5e),list:xt(k3e,J5e),"list-settings":xt(qye,U6e),"tree-view":xt(Gye,j6e),sort:xt(t5e,q6e),grip:xt(H4e,z5e),folder:xt(S4e,O5e),"folder-closed":xt(w4e,R5e),"folder-plus":xt(T4e,P5e),"folder-solid":xt(Pye,H6e),file:xt(Gx,Yx),"file-text":xt(k4e,F5e),"file-edit":xt(d4e,$5e),"file-plus":xt(Lye,D6e),"file-off":xt(Gx,Yx),attachment:xt(tye,T6e),"image-off":xt(J4e,V5e),eye:xt(Sye,O6e),"eye-off":xt(Tye,P6e),code:xt(gye,N6e),terminal:xt(T8e,k6e),pencil:xt(H3e,i6e),tool:xt(c5e,G6e),glob:xt(sye,E6e),globe:xt(P4e,H5e),translate:xt(P8e,w6e),"check-list":xt(F8e,C6e),bolt:xt(Fye,B6e),keyboard:xt(s3e,K5e),trash:xt(H8e,_6e),"git-fork":xt(Hye,z6e),"git-pull-request":xt(Uye,W6e),message:xt(Q9e,T5e),mail:xt(w3e,Q5e),user:xt(q8e,S6e),info:xt(t3e,q5e),"help-circle":xt(q3e,l6e),"alert-triangle":xt(G8e,A6e),clock:xt(j9e,S5e),robot:xt(G3e,a6e),sparkles:xt(S8e,y6e),histogram:xt(q4e,U5e),music:xt(F3e,o6e),emoji:xt(kye,F6e),target:xt(w8e,v6e),pause:xt(P3e,s6e),play:xt(U3e,r6e),pin:xt(Jye,V6e),stop:xt(k8e,g6e),star:xt(s5e,K6e),"star-outline":xt(l5e,Z6e),unpin:xt(p5e,Y6e),"dots-horizontal":xt(L3e,n6e),thinking:xt(L8e,b6e)};function J6e(e){return BN[e]}function Q6e(e,t){return e.replace(/]*>/,n=>n.replace(/\s(?:width|height)="[^"]*"/g,"")).replace(/^',``,v.value].join(""):"");function X(de){const pe=[];let ve="",oe=!1;for(let ye=0;yew.value.slice(0,200).map(X));function Ie(de,pe=55){return!de||de.length<=pe?de:"…"+de.slice(de.length-pe+1)}return(de,pe)=>(y(),M("div",{ref_key:"rootRef",ref:f,class:"file-preview"},[e.error&&!e.loading?(y(),M("div",O$e,[C("span",null,N(e.error),1),e.closable?(y(),he(p(Rt),{key:0,variant:"secondary",size:"sm",onClick:pe[0]||(pe[0]=ve=>c("close"))},{default:me(()=>[qe(N(p(n)("filePreview.close")),1)]),_:1})):ee("",!0)])):!e.file&&!e.loading?(y(),M("div",P$e,N(p(n)("filePreview.empty")),1)):e.loading?(y(),M("div",D$e,[pe[7]||(pe[7]=C("span",{class:"spinner"},null,-1)),C("span",null,N(p(n)("filePreview.loading")),1)])):e.file?(y(),M(Pe,{key:3},[j(p(pc),{wrap:"",title:p(n)("common.preview"),closable:e.closable,"close-label":p(n)("filePreview.close"),onClose:pe[6]||(pe[6]=ve=>c("close"))},{default:me(()=>[j(p(pn),{text:e.file.path},{default:me(()=>[C("span",B$e,N(Ie(e.file.path)),1)]),_:1},8,["text"]),C("span",H$e,[e.file.lineCount?(y(),M("span",z$e,N(p(n)("filePreview.lineCount",{count:e.file.lineCount})),1)):ee("",!0),C("span",W$e,N(D(e.file.size)),1)]),h.value==="html"?(y(),he(p(wi),{key:0,"model-value":O.value,size:"sm",options:[{value:"preview",label:p(n)("filePreview.preview")},{value:"source",label:p(n)("filePreview.source")}],"onUpdate:modelValue":z},null,8,["model-value","options"])):ee("",!0),h.value==="markdown"?(y(),he(p(wi),{key:1,"model-value":F.value,size:"sm",options:[{value:"preview",label:p(n)("filePreview.preview")},{value:"source",label:p(n)("filePreview.source")}],"onUpdate:modelValue":W},null,8,["model-value","options"])):ee("",!0),h.value==="image"?(y(),he(p(wi),{key:2,"model-value":U.value,size:"sm",options:[{value:"fit",label:p(n)("filePreview.fit")},{value:"actual",label:p(n)("filePreview.actual")}],"onUpdate:modelValue":K},null,8,["model-value","options"])):ee("",!0),h.value==="text"||h.value==="json"||h.value==="html"||h.value==="csv"?(y(),M("div",U$e,[Bn(C("input",{"onUpdate:modelValue":pe[1]||(pe[1]=ve=>x.value=ve),class:"fp-search-input",type:"search",placeholder:p(n)("filePreview.search")},null,8,j$e),[[ai,x.value]]),x.value.trim()?(y(),M("span",V$e,N(T.value.length),1)):ee("",!0),j(p(gn),{size:"sm",disabled:T.value.length===0,label:p(n)("filePreview.prevMatch"),tooltip:p(n)("filePreview.prevMatch"),onClick:pe[2]||(pe[2]=ve=>E(-1))},{default:me(()=>[j(p(Te),{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label","tooltip"]),j(p(gn),{size:"sm",disabled:T.value.length===0,label:p(n)("filePreview.nextMatch"),tooltip:p(n)("filePreview.nextMatch"),onClick:pe[3]||(pe[3]=ve=>E(1))},{default:me(()=>[j(p(Te),{name:"arrow-down",size:"md"})]),_:1},8,["disabled","label","tooltip"])])):ee("",!0),j(p(gn),{size:"sm",class:Re({copied:$.value}),label:$.value?p(n)("filePreview.copied"):p(n)("filePreview.copyPath"),tooltip:$.value?p(n)("filePreview.copied"):p(n)("filePreview.copyPath"),onClick:H},{default:me(()=>[$.value?(y(),he(p(Te),{key:1,class:"fp-check",name:"check",size:"md"})):(y(),he(p(Te),{key:0,name:"link",size:"md"}))]),_:1},8,["class","label","tooltip"]),e.externalActions?(y(),he(p(gn),{key:4,size:"sm",label:p(n)("filePreview.openInEditor"),tooltip:p(n)("filePreview.openInEditor"),onClick:pe[4]||(pe[4]=ve=>c("openExternal"))},{default:me(()=>[j(p(Te),{name:"external-link",size:"md"})]),_:1},8,["label","tooltip"])):ee("",!0),e.externalActions?(y(),he(p(gn),{key:5,size:"sm",label:p(n)("filePreview.reveal"),tooltip:p(n)("filePreview.reveal"),onClick:pe[5]||(pe[5]=ve=>c("reveal"))},{default:me(()=>[j(p(Te),{name:"folder",size:"md"})]),_:1},8,["label","tooltip"])):ee("",!0),e.downloadUrl?(y(),he(p(pn),{key:6,text:p(n)("filePreview.download")},{default:me(()=>[C("a",{class:"fp-download",href:e.downloadUrl,target:"_blank",rel:"noreferrer",download:"","aria-label":p(n)("filePreview.download")},[j(p(Te),{name:"download",size:"md"})],8,q$e)]),_:1},8,["text"])):ee("",!0),!e.file.isBinary&&h.value!=="image"?(y(),he(p(gn),{key:7,size:"sm",class:Re({copied:I.value}),label:I.value?p(n)("filePreview.copied"):p(n)("filePreview.copy"),tooltip:I.value?p(n)("filePreview.copied"):p(n)("filePreview.copy"),onClick:B},{default:me(()=>[I.value?(y(),he(p(Te),{key:1,class:"fp-check",name:"check",size:"md"})):(y(),he(p(Te),{key:0,name:"copy",size:"md"}))]),_:1},8,["class","label","tooltip"])):ee("",!0)]),_:1},8,["title","closable","close-label"]),h.value==="markdown"?(y(),M("div",{key:0,class:Re(["fp-body",{"fp-markdown":F.value==="preview"}])},[F.value==="preview"?(y(),he(p(Ic),{key:0,text:v.value,"open-file":u.openFile?d:void 0},null,8,["text","open-file"])):(y(),M("div",K$e,[j(Ur,{code:w.value,path:g.value,"line-numbers":_.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])]))],2)):h.value==="json"?(y(),M("div",Z$e,[j(Ur,{code:w.value,path:g.value,"line-numbers":_.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])])):h.value==="html"?(y(),M("div",G$e,[O.value==="preview"?(y(),M("iframe",{key:0,class:"fp-html-frame",sandbox:"",srcdoc:ne.value,title:e.file.path},null,8,Y$e)):(y(),M("div",X$e,[j(Ur,{code:w.value,path:g.value,"line-numbers":_.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])]))])):h.value==="pdf"?(y(),M("div",J$e,[ie.value?(y(),M("iframe",{key:0,class:"fp-pdf-frame",src:ie.value,title:e.file.path},null,8,Q$e)):(y(),M("div",eNe,[C("span",tNe,N(p(n)("filePreview.pdfNoPreview")),1)]))])):h.value==="csv"?(y(),M("div",nNe,[C("table",oNe,[C("tbody",null,[(y(!0),M(Pe,null,pt(le.value,(ve,oe)=>(y(),M("tr",{key:oe,class:Re(P(oe+1)),"data-line":oe+1},[C("th",null,N(oe+1),1),(y(!0),M(Pe,null,pt(ve,(ye,G)=>(y(),M("td",{key:G},N(ye),1))),128))],10,sNe))),128))])])])):h.value==="image"?(y(),M("div",iNe,[V.value?(y(),M("img",{key:0,src:V.value,alt:e.file.path,class:Re(["fp-image",{actual:U.value==="actual"}])},null,10,rNe)):(y(),M("div",lNe,[C("span",aNe,[j(p(Te),{name:"image-off",size:"lg"})]),C("span",uNe,N(p(n)("filePreview.imageNoPreview",{mime:e.file.mime,size:D(e.file.size)})),1)]))])):h.value==="text"?(y(),M("div",cNe,[j(Ur,{code:w.value,path:g.value,"line-numbers":_.value,framed:!1,"line-class":P},null,8,["code","path","line-numbers"])])):(y(),M("div",dNe,[C("div",fNe,[C("span",pNe,[j(p(Te),{name:"file-off",size:"lg"})]),C("span",hNe,N(p(n)("filePreview.binaryNoPreview",{mime:e.file.mime||p(n)("filePreview.unknownType"),size:D(e.file.size)})),1)])]))],64)):ee("",!0)],512))}}),gNe=ft(mNe,[["__scopeId","data-v-4c55a361"]]),vNe={class:"tp"},yNe=et({__name:"ThinkingPanel",props:{text:{},subtitle:{}},emits:["close"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=Z(null);return Je(()=>n.text,()=>{const r=i.value;!r||!(r.scrollHeight-r.scrollTop-r.clientHeight<24)||yt(()=>{i.value&&(i.value.scrollTop=i.value.scrollHeight)})},{immediate:!0}),(r,l)=>(y(),M("div",vNe,[j(p(pc),{title:p(s)("common.preview"),subtitle:e.subtitle??p(s)("thinking.panelTitle"),"close-label":p(s)("thinking.close"),onClose:l[0]||(l[0]=a=>o("close"))},null,8,["title","subtitle","close-label"]),C("pre",{ref_key:"bodyEl",ref:i,class:"tp-body"},N(e.text),513)]))}}),kNe=ft(yNe,[["__scopeId","data-v-afb1f46f"]]),bNe={class:"agent-panel"},CNe={key:0,class:"agent-fallback"},wNe={key:0,class:"agent-error"},_Ne=et({__name:"AgentDetailPanel",props:{member:{},turns:{},running:{type:Boolean},loading:{type:Boolean},loadError:{type:Boolean},hasMore:{type:Boolean},loadingMore:{type:Boolean},loadMoreError:{type:Boolean}},emits:["close","loadOlderMessages","openAgent","openFile","openMedia","openTurnDiff"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=R(()=>n.member.id),{scroller:r,following:l,onScroll:a,pinScroll:u}=_he(i),c=Z(!1);let d=null,f=null;function h(){d!==null&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(d),f!==null&&clearTimeout(f),d=null,f=null}Je(i,()=>{c.value=!1,h();const _=()=>{h(),c.value=!0};typeof requestAnimationFrame=="function"?d=requestAnimationFrame(()=>{d=requestAnimationFrame(_)}):f=setTimeout(_,32)},{immediate:!0}),Vn(h);const m=R(()=>{const _=new Set,g=[];for(const x of[n.member.suspendedReason,n.member.text,n.member.outputLines?.join(` -`),n.member.summary]){const S=x?.trim();!S||_.has(S)||(_.add(S),g.push(S))}return g});Ln("pinScroll",()=>{r.value&&u()});function v(_){switch(_){case"queued":return s("tools.swarm.phaseQueued");case"working":return s("tools.swarm.phaseWorking");case"suspended":return s("tools.swarm.phaseSuspended");case"completed":return s("tools.swarm.phaseCompleted");case"failed":return s("tools.swarm.phaseFailed")}}const k=nn("modelDisplay"),w=nn("subagentEffort"),b=R(()=>{const _=[n.member.subagentType,k?.(n.member.model),w?.(n.member.thinkingEffort)].filter(g=>!!g);return _.length>0?_.join(" · "):void 0});return(_,g)=>(y(),M("div",bNe,[j(p(pc),{title:e.member.name,subtitle:b.value,"close-label":p(s)("thinking.close"),onClose:g[0]||(g[0]=x=>o("close"))},{default:me(()=>[j(p(Vr),{variant:"neutral",size:"sm"},{default:me(()=>[qe(N(v(e.member.phase)),1)]),_:1})]),_:1},8,["title","subtitle","close-label"]),C("div",{ref_key:"scroller",ref:r,class:"agent-transcript",onScrollPassive:g[6]||(g[6]=(...x)=>p(a)&&p(a)(...x))},[c.value?(y(),M(Pe,{key:0},[e.turns.length===0&&!e.loading&&(e.loadError||m.value.length>0)?(y(),M("div",CNe,[e.loadError?(y(),M("div",wNe,N(p(s)("tasks.transcriptLoadError")),1)):ee("",!0),m.value.length>0?(y(),he(dr,{key:1,lines:m.value},null,8,["lines"])):ee("",!0)])):(y(),he(e6,{key:1,turns:e.turns,"turn-active":e.running,"session-loading":e.loading&&e.turns.length===0,"has-more-messages":e.hasMore,"loading-more":e.loadingMore,"loading-more-error":e.loadMoreError,"is-following":p(l),"read-only":"",onLoadOlderMessages:g[1]||(g[1]=x=>o("loadOlderMessages")),onOpenAgent:g[2]||(g[2]=x=>o("openAgent",x)),onOpenFile:g[3]||(g[3]=x=>o("openFile",x)),onOpenMedia:g[4]||(g[4]=x=>o("openMedia",x)),onOpenTurnDiff:g[5]||(g[5]=x=>o("openTurnDiff",x))},null,8,["turns","turn-active","session-loading","has-more-messages","loading-more","loading-more-error","is-following"]))],64)):ee("",!0)],544)]))}}),xNe=ft(_Ne,[["__scopeId","data-v-95fdb6f0"]]),SNe={class:"sc"},ANe={key:0,class:"sc-empty"},MNe={key:2,class:"sc-loading"},TNe={class:"sc-composer"},ENe=["placeholder"],INe=["disabled"],LNe=et({__name:"SideChatPanel",props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:["send","close","openMedia"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=R(()=>n.turns.find(x=>x.role==="user")?.text?.trim()??""),r=R(()=>n.title?.trim()||s("sideChat.title")),l=R(()=>n.subtitle?.trim()?n.subtitle.trim():i.value||s("sideChat.subtitle")),a=Z(""),u=Z(null),c=Z(null);function d(){const g=a.value.trim();g&&(o("send",g),a.value="",yt(()=>{u.value&&(u.value.style.height="auto"),f()}))}function f(){const g=c.value;g&&(g.scrollTop=g.scrollHeight)}Ln("pinScroll",g=>{const x=c.value;if(!x)return;const S=g.getBoundingClientRect().top;requestAnimationFrame(()=>{x.scrollTop+=g.getBoundingClientRect().top-S})});const h=R(()=>{const g=n.turns;if(g.length===0)return"0";const x=g.at(-1),S=x.thinking?.length??0,T=x.tools?.reduce((A,E)=>A+E.name.length+(E.arg?.length??0)+(E.output?.join("").length??0),0)??0;return`${g.length}:${x.text.length}:${S}:${T}`});Je(h,async()=>{!n.running&&!n.sending||(await yt(),f())});const m=R(()=>n.sending?n.turns.at(-1)?.role==="user":!1),{handleCompositionStart:v,handleCompositionEnd:k,isComposingKeyEvent:w}=Ar();function b(g){g.key==="Enter"&&!g.shiftKey&&!w(g)&&(g.preventDefault(),d())}function _(){const g=u.value;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,160)}px`)}return(g,x)=>(y(),M("div",SNe,[j(p(pc),{title:r.value,subtitle:l.value,"close-label":p(s)("thinking.close"),onClose:x[0]||(x[0]=S=>o("close"))},null,8,["title","subtitle","close-label"]),C("div",{ref_key:"bodyRef",ref:c,class:"sc-body"},[e.turns.length===0?(y(),M("div",ANe,N(p(s)("sideChat.empty")),1)):(y(),he(e6,{key:1,turns:e.turns,approvals:[],"turn-active":e.running,working:e.sending||e.running,"turn-files-interactive":!1,onOpenMedia:x[1]||(x[1]=S=>o("openMedia",S))},null,8,["turns","turn-active","working"])),m.value?(y(),M("div",MNe,[j(aF,{label:p(s)("conversation.requesting")},null,8,["label"])])):ee("",!0)],512),C("div",TNe,[Bn(C("textarea",{ref_key:"inputRef",ref:u,"onUpdate:modelValue":x[2]||(x[2]=S=>a.value=S),class:"sc-input",rows:"1",placeholder:p(s)("sideChat.placeholder"),onInput:_,onKeydown:b,onCompositionstart:x[3]||(x[3]=(...S)=>p(v)&&p(v)(...S)),onCompositionend:x[4]||(x[4]=(...S)=>p(k)&&p(k)(...S))},null,40,ENe),[[ai,a.value]]),j(p(pn),{text:p(s)("sideChat.send")},{default:me(()=>[C("button",{type:"button",class:"sc-send",disabled:!a.value.trim(),onClick:d},[j(p(Te),{name:"arrow-right",size:"sm"})],8,INe)]),_:1},8,["text"])])]))}}),$Ne=ft(LNe,[["__scopeId","data-v-753d11f0"]]),NNe={class:"changes-pane"},FNe={class:"dv-path"},RNe={class:"diff-head"},ONe={class:"back-label"},PNe={key:"loading",class:"empty-state diff-loading"},DNe={key:"lines",class:"dv-lines-wrap"},BNe={key:"empty",class:"empty-state"},HNe={class:"dv-change-count"},zNe={class:"ch-head"},WNe={class:"br-heading"},UNe={class:"br-label"},jNe={class:"br-name"},VNe={key:0,class:"sync-info"},qNe={key:0,class:"ahead"},KNe={key:0,class:"behind"},ZNe={key:1,class:"empty-head"},GNe={class:"ch-list-content"},YNe=["onClick"],XNe={class:"fpath"},JNe=["onClick"],QNe={class:"tree-name"},eFe=["onClick"],tFe={class:"tree-name"},nFe={key:2,class:"empty-state"},oFe={class:"empty-state-icon","aria-hidden":"true"},sFe={key:3,class:"empty-state"},iFe=et({__name:"DiffView",props:{changes:{},gitInfo:{},fileDiff:{},fullTexts:{},emptyFile:{type:Boolean},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:"full"},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:["open","back","close"],setup(e,{emit:t}){const{t:n}=Nt();function o($){return n($===1?"diff.fileCountOne":"diff.fileCountOther",{number:$})}const s=e,i=t;function r($){const B=$.toLowerCase();return B==="modified"?"modified":B==="added"?"added":B==="deleted"?"deleted":B==="renamed"?"renamed":B==="untracked"?"untracked":B==="conflicted"?"conflicted":B==="ignored"?"ignored":B==="clean"?"clean":"unknown"}const l={modified:"M",added:"+",deleted:"−",renamed:"→",untracked:"+",conflicted:"C",ignored:"I",clean:"·",unknown:"?"};function a($){return l[r($)]??"?"}function u($,B=60){return $.length<=B?$:"…"+$.slice($.length-B+1)}const c=R(()=>s.gitInfo!==null),d=R(()=>s.changes.length>0),f=R(()=>(s.selectedDiffPath??null)!==null),h=R(()=>s.mode==="detail"||s.mode==="full"&&f.value),m=R(()=>s.fileDiff??[]),v=R(()=>s.fileDiffLoading===!0);function k($){i("open",$)}function w(){i("back")}function b(){i("close")}const _=Z("list");function g($){_.value=$}function x($){const B={children:[]},H=[...$].sort((O,F)=>O.path.localeCompare(F.path));for(const O of H){const F=O.path.endsWith("/"),U=O.path.split("/").filter(Boolean);if(U.length===0)continue;let z=B;for(let W=0;WX.name===K&&X.kind===(V?"file":"folder"));ne||(ne={name:K,path:ie,kind:V?"file":"folder",status:V?O.status:void 0,children:[]},z.children.push(ne)),z=ne}}return B.children}const S=R(()=>x(s.changes)),T=Z(new Set);function A($){return!T.value.has($)}const E=R(()=>{const $=[];function B(H,O){for(const F of H)$.push({node:F,depth:O}),F.kind==="folder"&&A(F.path)&&B(F.children,O+1)}return B(S.value,0),$});function P($){const B=new Set(T.value);B.has($.path)?B.delete($.path):B.add($.path),T.value=B}function D($){return`calc(var(--tree-base-indent) + ${$} * var(--tree-indent-step))`}function I($){return{paddingLeft:D($),"--tree-depth":String($)}}return($,B)=>(y(),M("div",NNe,[h.value?(y(),M(Pe,{key:0},[j(p(pc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:b},{default:me(()=>[j(p(pn),{text:e.selectedDiffPath??""},{default:me(()=>[C("span",FNe,N(u(e.selectedDiffPath??"",50)),1)]),_:1},8,["text"])]),_:1},8,["title","closable","close-label"]),C("div",RNe,[e.hideBack?ee("",!0):(y(),he(p(Rt),{key:0,variant:"ghost",size:"sm",onClick:w},{default:me(()=>[j(p(Te),{name:"arrow-left",size:"sm"}),C("span",ONe,N(p(n)("diff.back")),1)]),_:1}))]),j(as,{name:"diff-content",mode:"out-in"},{default:me(()=>[v.value?(y(),M("div",PNe,[j(p(Ao),{size:"md"}),C("span",null,N(p(n)("diff.loading")),1)])):m.value.length>0?(y(),M("div",DNe,[j(Ur,{lines:m.value,path:e.selectedDiffPath??void 0,"line-numbers":"",framed:!1,"full-texts":e.fullTexts??null},null,8,["lines","path","full-texts"])])):(y(),M("div",BNe,N(e.emptyFile?p(n)("diff.emptyFile"):p(n)("diff.noDiff")),1))]),_:1})],64)):(y(),M(Pe,{key:1},[j(p(pc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:b},{default:me(()=>[C("span",HNe,N(o(e.changes.length)),1),j(p(wi),{"model-value":_.value,size:"sm",options:[{value:"list",label:p(n)("diff.list"),icon:"list"},{value:"tree",label:p(n)("diff.tree"),icon:"tree-view"}],"onUpdate:modelValue":g},null,8,["model-value","options"])]),_:1},8,["title","closable","close-label"]),C("div",zNe,[c.value?(y(),M(Pe,{key:0},[C("span",WNe,[j(p(Te),{class:"br-icon",name:"git-fork",size:"sm"}),C("span",UNe,N(p(n)("diff.branch")),1)]),C("span",jNe,N(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(y(),M("span",VNe,[j(p(pn),{text:p(n)("diff.aheadTitle")},{default:me(()=>[e.gitInfo.ahead>0?(y(),M("span",qNe,"↑"+N(e.gitInfo.ahead),1)):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(n)("diff.behindTitle")},{default:me(()=>[e.gitInfo.behind>0?(y(),M("span",KNe,"↓"+N(e.gitInfo.behind),1)):ee("",!0)]),_:1},8,["text"])])):ee("",!0)],64)):(y(),M("span",ZNe,N(p(n)("diff.empty")),1))]),d.value&&_.value==="list"?(y(),he(p(Pk),{key:0,class:"ch-list"},{default:me(()=>[C("div",GNe,[(y(!0),M(Pe,null,pt(e.changes,H=>(y(),he(p(pn),{key:H.path,text:H.path},{default:me(()=>[C("button",{type:"button",class:"ch-row",onClick:O=>k(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",XNe,N(u(H.path)),1)],8,YNe)]),_:2},1032,["text"]))),128))])]),_:1})):d.value&&_.value==="tree"?(y(),he(p(Pk),{key:1,class:"ch-list ch-tree"},{default:me(()=>[j(YA,{name:"tree-collapse",tag:"ul",class:"tree-list ch-list-content"},{default:me(()=>[(y(!0),M(Pe,null,pt(E.value,({node:H,depth:O})=>(y(),M("li",{key:H.path,class:"tree-node"},[H.kind==="folder"?(y(),M("button",{key:0,type:"button",class:"tree-row tree-folder",style:Zt(I(O)),onClick:F=>P(H)},[j(p(Te),{class:"tree-icon",name:"folder-solid",size:"sm"}),C("span",QNe,N(H.name),1)],12,JNe)):(y(),he(p(pn),{key:1,text:H.path},{default:me(()=>[C("button",{type:"button",class:"tree-row tree-file",style:Zt(I(O)),onClick:F=>k(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",tFe,N(H.name),1)],12,eFe)]),_:2},1032,["text"]))]))),128))]),_:1})]),_:1})):c.value?(y(),M("div",nFe,[C("span",oFe,[j(p(Te),{name:"check",size:"lg"})]),qe(" "+N(p(n)("diff.clean")),1)])):(y(),M("div",sFe,N(p(n)("diff.empty")),1))],64))]))}}),rFe=ft(iFe,[["__scopeId","data-v-7d5ab9c7"]]),lFe={class:"td"},aFe={class:"td-path"},uFe={class:"td-body"},cFe={key:1,class:"td-empty"},dFe=et({__name:"TurnDiffPanel",props:{change:{},cwd:{},closable:{type:Boolean}},emits:["close","openFile"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=R(()=>{const a=n.cwd?h2(n.change.path,n.cwd):null;return r(a??n.change.path)});function r(a,u=48){return!a||a.length<=u?a:"…"+a.slice(a.length-u+1)}const l=R(()=>n.change.diff!==null&&n.change.diff.length>0);return(a,u)=>(y(),M("div",lFe,[j(p(pc),{title:p(s)("conversation.turnFiles.diffTitle"),closable:e.closable,"close-label":p(s)("filePreview.close"),onClose:u[1]||(u[1]=c=>o("close"))},{default:me(()=>[j(p(pn),{text:e.change.path},{default:me(()=>[C("span",aFe,N(i.value),1)]),_:1},8,["text"]),j(p(gn),{size:"sm",label:p(s)("conversation.turnFiles.openFile"),tooltip:p(s)("conversation.turnFiles.openFile"),onClick:u[0]||(u[0]=c=>o("openFile",e.change.path))},{default:me(()=>[j(p(Te),{name:"external-link",size:"md"})]),_:1},8,["label","tooltip"])]),_:1},8,["title","closable","close-label"]),C("div",uFe,[l.value?(y(),he(Ur,{key:0,lines:e.change.diff,path:e.change.path,framed:!1},null,8,["lines","path"])):(y(),M("div",cFe,[C("p",null,N(p(s)("conversation.turnFiles.diffUnavailable")),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:u[2]||(u[2]=c=>o("openFile",e.change.path))},{default:me(()=>[qe(N(p(s)("conversation.turnFiles.openFile")),1)]),_:1})]))])]))}}),fFe=ft(dFe,[["__scopeId","data-v-fdd0bc05"]]);function gF(e,t){let n=null;dn(()=>{n=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,yt(()=>{const o=t?.value??e.value;try{o?.focus()}catch{}})}),Vn(()=>{const o=n;if(n=null,!(!o||typeof document>"u"||!document.contains(o)))try{o.focus()}catch{}})}const pFe={class:"search-wrap"},hFe=["aria-label"],mFe=["aria-label"],gFe=["aria-pressed","onClick"],vFe={key:1,class:"state-row"},yFe={key:2,class:"state-row unavail"},kFe=["aria-label"],bFe=["aria-selected","onClick","onMouseenter"],CFe={class:"model-main"},wFe={class:"model-name"},_Fe={class:"model-meta"},xFe={class:"model-side"},SFe={key:0,class:"empty"},AFe={class:"footer-hint","aria-hidden":"true"},MFe=et({__name:"ModelPicker",props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["select","toggle-star","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R(()=>new Set(o.starredIds??[]));function r(D){return i.value.has(D)}const l=Z(""),a=Z(null),u=Z(null),c=Z(null),d=Z("all"),f={image_in:"model.capabilityImageInput",video_in:"model.capabilityVideoInput",tool_use:"model.capabilityToolUse",thinking:"model.capabilityThinking",always_thinking:"model.capabilityAlwaysThinking"};function h(D){const I=f[D];return I?n(I):D.replaceAll("_"," ")}function m(D){const I=[D.provider,n("model.contextSuffix",{size:Al(D.maxContextSize)})];for(const $ of D.capabilities??[])I.push(h($));return I.join(" · ")}gF(u,a);const v=R(()=>{const D=new Set,I=[{id:"all",label:n("model.allTab")}];for(const $ of o.models)D.has($.provider)||(D.add($.provider),I.push({id:$.provider,label:$.provider}));return I}),k=R(()=>{const D=l.value.toLowerCase().trim(),I=o.models.filter($=>{if(d.value!=="all"&&$.provider!==d.value)return!1;const B=($.displayName??$.model).toLowerCase().includes(D),H=$.provider.toLowerCase().includes(D),O=$.id.toLowerCase().includes(D);return!D||B||H||O});return d.value!=="all"?I:I.sort(($,B)=>{const H=r($.id)?1:0;return(r(B.id)?1:0)-H})}),w=R(()=>k.value),b=Z(0);Je([l,d],()=>{b.value=0}),Je(v,D=>{D.some(I=>I.id===d.value)||(d.value="all")}),Je(w,D=>{b.value=Math.min(b.value,Math.max(D.length-1,0))}),Je(b,async()=>{await yt(),c.value?.querySelector(".model-row.is-selected")?.scrollIntoView({block:"nearest"})});const{handleCompositionStart:_,handleCompositionEnd:g,isComposingKeyEvent:x}=Ar();function S(D){if(!x(D)){if(D.key==="Escape"){s("close");return}if(D.key==="ArrowDown")D.preventDefault(),b.value=Math.min(b.value+1,w.value.length-1);else if(D.key==="ArrowUp")D.preventDefault(),b.value=Math.max(b.value-1,0);else if(D.key==="Enter"){const I=w.value[b.value];I&&s("select",I.id)}}}dn(()=>{document.addEventListener("keydown",S)}),bn(()=>{document.removeEventListener("keydown",S)});function T(D){s("select",D)}function A(){l.value="",a.value?.focus()}function E(D){return w.value.indexOf(D)}function P(D){d.value=D}return(D,I)=>(y(),he(p(ua),{open:!0,"close-on-esc":!1,title:p(n)("model.title"),size:"lg",height:"fixed",padded:!1,onClose:I[1]||(I[1]=$=>s("close"))},{default:me(()=>[C("div",{ref_key:"dialogRef",ref:u,class:"mp"},[C("div",pFe,[j(p(js),{ref_key:"searchRef",ref:a,modelValue:l.value,"onUpdate:modelValue":I[0]||(I[0]=$=>l.value=$),placeholder:p(n)("model.searchPlaceholder"),autocomplete:"off",spellcheck:"false",autofocus:"",onCompositionstart:p(_),onCompositionend:p(g)},null,8,["modelValue","placeholder","onCompositionstart","onCompositionend"]),j(p(pn),{text:p(n)("model.clearSearch")},{default:me(()=>[C("button",{type:"button",class:Re(["search-clear",{"is-on":l.value.length>0}]),tabindex:"-1","aria-label":p(n)("model.clearSearch"),onClick:A},[j(p(Te),{name:"close",size:"sm"})],10,hFe)]),_:1},8,["text"])]),v.value.length>1?(y(),M("div",{key:0,class:"chip-strip","aria-label":p(n)("model.providerTabs")},[(y(!0),M(Pe,null,pt(v.value,$=>(y(),M("button",{key:$.id,type:"button",class:Re(["chip",{"is-active":$.id===d.value}]),"aria-pressed":$.id===d.value,onClick:B=>P($.id)},N($.label),11,gFe))),128))],8,mFe)):ee("",!0),e.loading?(y(),M("div",vFe,[j(p(Ao),{size:"sm"}),C("span",null,N(p(n)("model.loading")),1)])):e.unavailable?(y(),M("div",yFe,[j(p(Te),{name:"alert-triangle",size:"lg"}),C("span",null,N(p(n)("model.unavailable")),1)])):(y(),M("div",{key:3,ref_key:"listRef",ref:c,class:"model-list",role:"listbox","aria-label":p(n)("model.title")},[(y(!0),M(Pe,null,pt(w.value,$=>(y(),M("div",{key:$.id,class:Re(["model-row",{"is-current":$.id===e.current,"is-selected":E($)===b.value}]),role:"option","aria-selected":$.id===e.current,onClick:B=>T($.id),onMouseenter:B=>b.value=E($)},[C("span",CFe,[C("span",wFe,N($.displayName??$.model),1),C("span",_Fe,N(m($)),1)]),C("span",xFe,[$.id===e.current?(y(),he(p(Te),{key:0,class:"model-check",name:"check",size:"sm"})):ee("",!0),j(p(gn),{class:Re(["model-star",{"is-starred":r($.id)}]),size:"sm",label:r($.id)?p(n)("model.unstarTitle"):p(n)("model.starTitle"),tooltip:r($.id)?p(n)("model.unstarTitle"):p(n)("model.starTitle"),onClick:It(B=>s("toggle-star",$.id),["stop"])},{default:me(()=>[r($.id)?(y(),he(p(Te),{key:0,name:"star",size:"md"})):(y(),he(p(Te),{key:1,name:"star-outline",size:"md"}))]),_:2},1032,["class","label","tooltip","onClick"])])],42,bFe))),128)),w.value.length===0?(y(),M("div",SFe,N(o.models.length===0?p(n)("model.emptyNoModels"):p(n)("model.emptyNoMatch")),1)):ee("",!0)],8,kFe)),C("div",AFe,[j(p(oa),{keys:["↑","↓"]}),C("span",null,N(p(n)("model.hintNavigate")),1),I[2]||(I[2]=C("span",{class:"hint-dot"},"·",-1)),j(p(oa),{keys:["Enter"]}),C("span",null,N(p(n)("model.hintSelect")),1),I[3]||(I[3]=C("span",{class:"hint-dot"},"·",-1)),j(p(oa),{keys:["Esc"]}),C("span",null,N(p(n)("model.hintClose")),1)])],512)]),_:1},8,["title"]))}}),TFe=ft(MFe,[["__scopeId","data-v-3ba22330"]]),EFe=3;function vF(e){const t=Z("starting"),n=Z(!1),o=Z(null),s=Z(0);let i=null,r=null,l=null,a=0,u=!1,c=!1;function d(){i&&(clearTimeout(i),i=null),r&&(clearInterval(r),r=null),l&&(clearTimeout(l),l=null)}function f(w){d(),t.value="success",l=setTimeout(()=>{l=null,e.onSuccess?.()},w)}function h(){r&&clearInterval(r),r=setInterval(()=>{s.value>0?s.value--:(r&&clearInterval(r),r=null)},1e3)}function m(w){i&&clearTimeout(i),i=setTimeout(async()=>{const b=await e.onPollOAuthLogin();if(!c){if(b===null){if(a+=1,a>=EFe){d(),n.value=!0,t.value="error";return}m(w);return}a=0,b.status==="authenticated"?f(1200):b.status==="expired"||b.status==="cancelled"?(d(),t.value="expired"):m(w)}},w*1e3)}async function v(){d(),o.value=null,n.value=!1,a=0,u=!1,t.value="starting";const w=await e.onStartOAuthLogin();if(c){w!==null&&w.status!=="authenticated"&&e.onCancelOAuthLogin();return}if(!w){t.value="error";return}if(w.status==="authenticated"){f(800);return}o.value={flowId:w.flowId,verificationUri:w.verificationUri,verificationUriComplete:w.verificationUriComplete,userCode:w.userCode,expiresIn:w.expiresIn,interval:w.interval},s.value=w.expiresIn,t.value="device-code",h(),m(w.interval)}function k(){t.value!=="success"&&(d(),t.value==="device-code"&&!u&&(u=!0,e.onCancelOAuthLogin()))}return Kg()&&d1(()=>{c=!0,k()}),{step:t,pollError:n,flow:o,secondsLeft:s,startFlow:v,cancelFlow:k}}const IFe={key:0,class:"center-body"},LFe={class:"center-text"},$Fe={key:1,class:"nb"},NFe={class:"nb-lead"},FFe=["href"],RFe={class:"nb-code-row"},OFe=["title"],PFe={class:"nb-status"},DFe={class:"nb-status-text"},BFe={class:"nb-countdown"},HFe={key:2,class:"center-body"},zFe={class:"center-text success-text"},WFe={class:"center-hint"},UFe={class:"center-body"},jFe={class:"center-text err-text"},VFe={class:"center-hint"},qFe={class:"actions"},KFe={class:"center-body"},ZFe={class:"center-text warn-text"},GFe={class:"center-hint"},YFe={class:"actions"},XFe=et({__name:"LoginDialog",props:{onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=Z(!0),s=t,i=e,{step:r,pollError:l,flow:a,secondsLeft:u,startFlow:c,cancelFlow:d}=vF({onStartOAuthLogin:i.onStartOAuthLogin,onPollOAuthLogin:i.onPollOAuthLogin,onCancelOAuthLogin:i.onCancelOAuthLogin,onSuccess:()=>{s("success"),s("close")}}),f=Z(!1);dn(async()=>{await c()});async function h(){!a.value||!await Zs(a.value.verificationUriComplete)||(f.value=!0,setTimeout(()=>{f.value=!1},2e3))}async function m(){d(),s("close")}function v(k){const w=Math.floor(k/60),b=k%60;return`${w}:${String(b).padStart(2,"0")}`}return(k,w)=>(y(),he(p(ua),{open:o.value,"onUpdate:open":w[0]||(w[0]=b=>o.value=b),title:p(n)("login.title"),"close-on-overlay":!1,onClose:m},{default:me(()=>[p(r)==="starting"?(y(),M("div",IFe,[j(p(Ao),{size:"md"}),C("span",LFe,N(p(n)("login.starting")),1)])):p(r)==="device-code"&&p(a)?(y(),M("div",$Fe,[C("div",NFe,N(p(n)("login.lead")),1),C("a",{class:"nb-primary",href:p(a).verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[qe(N(p(n)("login.authorizeInBrowser"))+" ",1),j(p(Te),{name:"external-link",size:"sm"})],8,FFe),C("div",RFe,[C("span",{class:"nb-link",title:p(a).verificationUriComplete},N(p(a).verificationUriComplete),9,OFe),j(p(Rt),{class:Re(["nb-copy",{"is-copied":f.value}]),variant:"secondary",size:"sm",onClick:h},{default:me(()=>[f.value?(y(),M(Pe,{key:0},[j(p(Te),{name:"check",size:"sm"}),qe(" "+N(p(n)("login.copied")),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("login.copyLink")),1)],64))]),_:1},8,["class"])]),C("div",PFe,[j(p(Ao),{size:"sm",label:p(n)("login.waitingAuth")},null,8,["label"]),C("span",DFe,N(p(n)("login.waitingAutoClose")),1),C("span",BFe,N(v(p(u))),1)])])):p(r)==="success"?(y(),M("div",HFe,[j(p(Dd),{kind:"success"}),C("span",zFe,N(p(n)("login.success")),1),C("span",WFe,N(p(n)("login.successHint")),1)])):p(r)==="expired"?(y(),M(Pe,{key:3},[C("div",UFe,[j(p(Dd),{kind:"expired"}),C("span",jFe,N(p(n)("login.expiredTitle")),1),C("span",VFe,N(p(n)("login.expiredHint")),1)]),C("div",qFe,[j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):p(r)==="error"?(y(),M(Pe,{key:4},[C("div",KFe,[j(p(Dd),{kind:"error"}),C("span",ZFe,N(p(l)?p(n)("login.pollErrorTitle"):p(n)("login.errorTitle")),1),C("span",GFe,N(p(l)?p(n)("login.pollErrorHint"):p(n)("login.errorHint")),1)]),C("div",YFe,[j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):ee("",!0)]),_:1},8,["open","title"]))}}),JFe=ft(XFe,[["__scopeId","data-v-c798a107"]]),yF=et({__name:"LanguageSwitcher",props:{size:{default:"md"}},setup(e){const{locale:t}=Nt(),n=yg.map(s=>({value:s.code,label:s.label}));function o(s){t.value!==s&&E5(s)}return(s,i)=>(y(),he(p(wi),{"model-value":p(t),options:p(n),size:e.size,"onUpdate:modelValue":o},null,8,["model-value","options","size"]))}}),QFe={class:"msg"},eRe={class:"pf-field"},tRe={class:"pf-field-label"},nRe={class:"pf-field"},oRe={class:"pf-field-label"},sRe={class:"pf-field"},iRe={class:"pf-field-label"},rRe={class:"pf-key-wrap"},lRe={class:"pf-field"},aRe={class:"pf-field-label"},uRe={class:"pf-field"},cRe={class:"pf-field-label"},dRe={class:"pf-models"},fRe={key:0,class:"pf-models-empty"},pRe={class:"pf-model-grid pf-model-head"},hRe={key:1},mRe={key:0},gRe={class:"pf-foot"},vRe={key:0,class:"pf-managed-note"},yRe={class:"pf-confirm-msg"},kRe=et({__name:"ProviderForm",props:{mode:{},provider:{},guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","saved","deleting","deleted","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=mu(),r=Go({id:"",type:"openai",apiKey:"",baseUrl:"",models:[rh()]}),l=Z(""),a=Z(!1),u=Z(!1),c=Z(!1),d=R(()=>n.mode==="add"),f=R(()=>n.provider!==void 0&&mE(n.provider)),h=R(()=>{const $=n.provider;return $===void 0?0:w3($,i.config.value?.models).length}),m=R(()=>f.value&&h.value===0),v=R(()=>DJ.map($=>({value:$,label:s(`providers.types.${$}`)}))),k=R(()=>f.value?s("providers.apiKeyManaged"):!d.value&&n.provider?.hasApiKey===!0?s("providers.apiKeySet"):"sk-…");function w(){l.value="",u.value=!1;const $=n.provider;if(d.value||$===void 0){r.id="",r.type="openai",r.apiKey="",r.baseUrl="",r.models=[rh()];return}r.id=$.id,r.type=$.type,r.apiKey="",r.baseUrl=$.baseUrl??"";const B=w3($,i.config.value?.models);r.models=B.length>0?B:[rh()]}dn(()=>{w(),g()});const b=Z(!1),_=Z(!1);async function g(){const $=n.provider;if(!(d.value||$===void 0||f.value||$.hasApiKey!==!0))try{const B=await i.getProvider($.id);if(_.value)return;B.apiKey!==void 0&&B.apiKey!==""&&(r.apiKey=B.apiKey,b.value=!0)}catch{}}function x(){o("dirtyChange",!0)}const S=Z(!1),T=Z();function A($){l.value=$,yt(()=>T.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function E(){if(a.value)return;const $=BJ(r,{requireApiKey:d.value,requireBaseUrl:d.value});if($!==null){A(s(`providers.error.${$}`));return}l.value="",a.value=!0;try{if(d.value){const B=await i.addProvider(HJ(r));if(B!==null){A(B);return}o("dirtyChange",!1),i.notify({severity:"success",title:s("providers.added")}),o("added",r.id.trim())}else{const B=n.provider;if(B===void 0)return;const H=i.config.value?.providers?.[B.id]?.defaultModel,O=await i.updateProvider(B.id,zJ(r,B,{includeBlankApiKey:b.value,existingDefaultModel:H}));if(O!==null){A(O);return}await i.checkAuth(),i.notify({severity:"success",title:s("providers.saved")}),o("dirtyChange",!1),o("saved",r.id.trim())}}finally{a.value=!1}}async function P(){const $=n.provider;if(!($===void 0||c.value)){c.value=!0,o("deleting"),await new Promise(B=>setTimeout(B,300));try{if(await i.deleteProvider($.id)===null){u.value=!1;return}o("dirtyChange",!1),o("deleted",$.id)}finally{c.value=!1}}}function D(){r.models.push(rh()),x()}function I($){r.models.length<=1||(r.models.splice($,1),x())}return($,B)=>(y(),M("div",{class:"pf-form",onInput:x},[e.guard?(y(),he(p(qu),{key:0,variant:"warning",class:"pf-guard"},{default:me(()=>[C("span",QFe,N(p(s)("providers.unsavedGuard")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:B[0]||(B[0]=H=>o("guardStay"))},{default:me(()=>[qe(N(p(s)("providers.guardStay")),1)]),_:1}),j(p(Rt),{variant:"danger",size:"sm",onClick:B[1]||(B[1]=H=>o("guardDiscard"))},{default:me(()=>[qe(N(p(s)("providers.guardDiscard")),1)]),_:1})]),_:1})):ee("",!0),l.value?(y(),M("div",{key:1,ref_key:"errorBox",ref:T},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(l.value),1)]),_:1})],512)):ee("",!0),C("div",eRe,[C("label",tRe,[qe(N(p(s)("providers.fieldId")),1),B[11]||(B[11]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:r.id,"onUpdate:modelValue":B[2]||(B[2]=H=>r.id=H),placeholder:"my-openai",disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","disabled"])]),C("div",nRe,[C("label",oRe,[qe(N(p(s)("providers.fieldType")),1),B[12]||(B[12]=C("span",{class:"req"}," *",-1))]),j(p(n3),{"model-value":r.type,options:v.value,disabled:f.value,"onUpdate:modelValue":B[3]||(B[3]=H=>{r.type=H,x()})},null,8,["model-value","options","disabled"])]),C("div",sRe,[C("label",iRe,[qe(N(p(s)("providers.fieldApiKey")),1),B[13]||(B[13]=C("span",{class:"req"}," *",-1))]),C("div",rRe,[j(p(js),{modelValue:r.apiKey,"onUpdate:modelValue":B[4]||(B[4]=H=>r.apiKey=H),type:S.value?"text":"password",placeholder:k.value,disabled:f.value,autocomplete:"off",spellcheck:"false",onInput:B[5]||(B[5]=H=>_.value=!0)},null,8,["modelValue","type","placeholder","disabled"]),f.value?ee("",!0):(y(),he(p(gn),{key:0,class:"pf-key-eye",size:"sm",label:p(s)(S.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(s)(S.value?"providers.hideApiKey":"providers.showApiKey"),onClick:B[6]||(B[6]=H=>S.value=!S.value)},{default:me(()=>[j(p(Te),{name:S.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"]))])]),C("div",lRe,[C("label",aRe,[qe(N(p(s)("providers.fieldBaseUrl")),1),B[14]||(B[14]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:r.baseUrl,"onUpdate:modelValue":B[7]||(B[7]=H=>r.baseUrl=H),placeholder:p(s)("providers.baseUrlPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder","disabled"])]),C("div",uRe,[C("label",cRe,[qe(N(p(s)("providers.fieldModels")),1),B[15]||(B[15]=C("span",{class:"req"}," *",-1))]),C("div",dRe,[m.value?(y(),M("div",fRe,N(p(s)("providers.noModels")),1)):(y(),M(Pe,{key:1},[C("div",pRe,[C("span",null,[qe(N(p(s)("providers.colModelId")),1),B[16]||(B[16]=C("span",{class:"req"}," *",-1))]),C("span",null,[qe(N(p(s)("providers.colContext")),1),B[17]||(B[17]=C("span",{class:"req"}," *",-1))]),C("span",null,N(p(s)("providers.colDisplayName")),1),B[18]||(B[18]=C("span",null,null,-1))]),(y(!0),M(Pe,null,pt(r.models,(H,O)=>(y(),M("div",{key:O,class:"pf-model-grid"},[j(p(js),{modelValue:H.model,"onUpdate:modelValue":F=>H.model=F,placeholder:p(s)("providers.modelIdPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),j(p(js),{modelValue:H.maxContextSize,"onUpdate:modelValue":F=>H.maxContextSize=F,inputmode:"numeric",placeholder:p(s)("providers.modelContextPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),j(p(js),{modelValue:H.displayName,"onUpdate:modelValue":F=>H.displayName=F,placeholder:p(s)("providers.modelNamePlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),f.value?(y(),M("span",hRe)):(y(),he(p(gn),{key:0,size:"sm",label:p(s)("providers.removeModel"),tooltip:p(s)("providers.removeModel"),disabled:r.models.length<=1,onClick:F=>I(O)},{default:me(()=>[j(p(Te),{name:"trash",size:"sm"})]),_:1},8,["label","tooltip","disabled","onClick"]))]))),128)),f.value?ee("",!0):(y(),M("div",mRe,[j(p(Rt),{variant:"ghost",size:"sm",onClick:D},{default:me(()=>[j(p(Te),{name:"plus",size:"sm"}),qe(" "+N(p(s)("providers.addModel")),1)]),_:1})]))],64))])]),C("div",gRe,[f.value?(y(),M("span",vRe,N(p(s)("providers.managedHint")),1)):d.value?(y(),M(Pe,{key:1},[j(p(Rt),{variant:"secondary",size:"sm",onClick:B[8]||(B[8]=H=>o("cancel"))},{default:me(()=>[qe(N(p(s)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:a.value,onClick:E},{default:me(()=>[qe(N(p(s)("providers.addProvider")),1)]),_:1},8,["disabled"])],64)):u.value&&n.provider!==void 0?(y(),M(Pe,{key:2},[C("span",yRe,N(p(s)("providers.deleteConfirm",{id:n.provider.id,count:h.value})),1),B[19]||(B[19]=C("span",{class:"spacer"},null,-1)),j(p(Rt),{variant:"secondary",size:"sm",disabled:c.value,onClick:B[9]||(B[9]=H=>u.value=!1)},{default:me(()=>[qe(N(p(s)("common.cancel")),1)]),_:1},8,["disabled"]),j(p(Rt),{variant:"danger",size:"sm",disabled:c.value,onClick:P},{default:me(()=>[qe(N(p(s)("providers.deleteConfirmYes")),1)]),_:1},8,["disabled"])],64)):(y(),M(Pe,{key:3},[j(p(Rt),{variant:"danger-soft",size:"sm",onClick:B[10]||(B[10]=H=>u.value=!0)},{default:me(()=>[qe(N(p(s)("providers.deleteProvider")),1)]),_:1}),B[20]||(B[20]=C("span",{class:"spacer"},null,-1)),j(p(Rt),{variant:"primary",size:"sm",disabled:a.value,onClick:E},{default:me(()=>[qe(N(p(s)("providers.save")),1)]),_:1},8,["disabled"])],64))])],32))}}),kF=ft(kRe,[["__scopeId","data-v-ac0597e3"]]),bRe={class:"af"},CRe={class:"msg"},wRe={key:2,class:"af-catalog"},_Re={key:0,class:"af-center"},xRe={key:1,class:"af-error"},SRe={class:"af-list"},ARe=["disabled","onClick"],MRe={class:"af-entry-name"},TRe={key:1,class:"af-entry-reason"},ERe={key:2,class:"af-entry-count"},IRe={key:0,class:"af-empty"},LRe={class:"af-field"},$Re={class:"af-label"},NRe={class:"af-field"},FRe={class:"af-label"},RRe={class:"af-key-wrap"},ORe={key:0,class:"af-field"},PRe={class:"af-label"},DRe={class:"af-note"},BRe={class:"af-foot"},HRe={class:"af-hint"},zRe={class:"af-field"},WRe={class:"af-label"},URe={class:"af-field"},jRe={class:"af-label"},VRe={class:"af-key-wrap"},qRe={class:"af-foot"},KRe={class:"af-manual"},ZRe=et({__name:"AddProviderFlow",props:{guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","cancel"],setup(e,{emit:t}){const n=t,{t:o,te:s}=Nt(),i=mu(),r=Z("catalog"),l=R(()=>[{value:"catalog",label:o("providers.catalog.sourceCatalog")},{value:"registry",label:o("providers.catalog.sourceRegistry")},{value:"manual",label:o("providers.catalog.sourceManual")}]),a=Z("loading"),u=Z([]);async function c(){a.value="loading";const U=await i.loadCatalogProviders();U.kind==="ok"?(u.value=U.items,a.value="ready"):U.kind==="unsupported"?(a.value="unsupported",r.value==="catalog"&&(r.value="manual")):a.value="error"}dn(c);const d=Z(""),f=R(()=>{const U=d.value.trim().toLowerCase();return U===""?u.value:u.value.filter(z=>z.name.toLowerCase().includes(U)||z.id.toLowerCase().includes(U))});function h(U){const z=U.rejectReason;return z!==null&&s(`providers.catalog.rejectReason.${z}`)?o(`providers.catalog.rejectReason.${z}`):o("providers.catalog.rejected")}const m=Z(null),v=Z({id:"",apiKey:"",baseUrl:""}),k=Z(!1),w=Z(!1),b=Z("");function _(U){m.value=U,v.value={id:U.id,apiKey:"",baseUrl:""},b.value="",k.value=!1}function g(){m.value=null,b.value="",n("dirtyChange",!1)}function x(){n("dirtyChange",!0)}const S=R(()=>{if(m.value===null)return!1;const z=v.value.id.trim();return z!==""&&i.providers.value.some(W=>W.id===z)}),T=Z();function A(U){b.value=U,yt(()=>T.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}function E(){const U=v.value,z=U.id.trim();return z===""?o("providers.error.idRequired"):pE.test(z)?U.apiKey.trim()===""?o("providers.error.apiKeyRequired"):m.value?.needsBaseUrl===!0&&U.baseUrl.trim()===""?o("providers.error.baseUrlRequired"):null:o("providers.error.idInvalid")}async function P(){const U=m.value;if(U===null||w.value)return;const z=E();if(z!==null){A(z);return}b.value="",w.value=!0;try{const W=v.value,K=W.id.trim(),V=W.baseUrl.trim(),ie=await i.importCatalogProvider({catalogId:U.id,apiKey:W.apiKey.trim(),...V===""?{}:{baseUrl:V},...K===U.id?{}:{id:K}});if(ie!==null){A(ie);return}i.notify({severity:"success",title:o("providers.added")}),n("dirtyChange",!1),n("added",K)}finally{w.value=!1}}const D=Z({url:"",apiKey:""}),I=Z(!1),$=Z(!1),B=Z(""),H=Z();function O(U){B.value=U,yt(()=>H.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function F(){if($.value)return;const U=D.value.url.trim();if(U===""){O(o("providers.error.registryUrlRequired"));return}B.value="",$.value=!0;try{const z=D.value.apiKey.trim(),W=await i.importCustomRegistry({url:U,...z===""?{}:{apiKey:z}});if(typeof W=="string"){O(W);return}i.notify({severity:"success",title:o("providers.catalog.registryImported",{count:W.providers.length})}),n("dirtyChange",!1);const K=W.providers[0];K!==void 0?n("added",K.id):n("cancel")}finally{$.value=!1}}return(U,z)=>(y(),M("div",bRe,[e.guard?(y(),he(p(qu),{key:0,variant:"warning",class:"af-guard"},{default:me(()=>[C("span",CRe,N(p(o)("providers.unsavedGuard")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:z[0]||(z[0]=W=>n("guardStay"))},{default:me(()=>[qe(N(p(o)("providers.guardStay")),1)]),_:1}),j(p(Rt),{variant:"danger",size:"sm",onClick:z[1]||(z[1]=W=>n("guardDiscard"))},{default:me(()=>[qe(N(p(o)("providers.guardDiscard")),1)]),_:1})]),_:1})):ee("",!0),a.value!=="unsupported"?(y(),he(p(wi),{key:1,modelValue:r.value,"onUpdate:modelValue":z[2]||(z[2]=W=>r.value=W),size:"sm",options:l.value},null,8,["modelValue","options"])):ee("",!0),a.value!=="unsupported"?Bn((y(),M("div",wRe,[a.value==="loading"?(y(),M("div",_Re,[j(p(Ao),{size:"sm"}),C("span",null,N(p(o)("providers.catalog.loading")),1)])):a.value==="error"?(y(),M("div",xRe,[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(p(o)("providers.catalog.loadError")),1)]),_:1}),C("div",null,[j(p(Rt),{variant:"secondary",size:"sm",onClick:c},{default:me(()=>[qe(N(p(o)("providers.catalog.retry")),1)]),_:1})])])):m.value===null?(y(),M(Pe,{key:2},[j(p(js),{modelValue:d.value,"onUpdate:modelValue":z[3]||(z[3]=W=>d.value=W),placeholder:p(o)("providers.catalog.searchPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"]),C("div",SRe,[(y(!0),M(Pe,null,pt(f.value,W=>(y(),M("button",{key:W.id,type:"button",class:"af-entry",disabled:W.rejected,onClick:K=>_(W)},[C("span",MRe,N(W.name),1),W.wireType!==null?(y(),he(p(Vr),{key:0,variant:"neutral",size:"sm"},{default:me(()=>[qe(N(W.wireType),1)]),_:2},1024)):ee("",!0),z[16]||(z[16]=C("span",{class:"grow"},null,-1)),W.rejected?(y(),M("span",TRe,N(h(W)),1)):(y(),M("span",ERe,N(p(o)("providers.modelCount",{count:W.models.length})),1))],8,ARe))),128)),f.value.length===0?(y(),M("div",IRe,N(p(o)("providers.catalog.empty")),1)):ee("",!0)])],64)):(y(),M("div",{key:3,class:"af-import",onInput:x},[C("button",{type:"button",class:"af-back",onClick:g},[j(p(Te),{name:"arrow-left",size:"sm"}),qe(" "+N(p(o)("providers.catalog.backToList")),1)]),C("div",LRe,[C("label",$Re,[qe(N(p(o)("providers.fieldId")),1),z[17]||(z[17]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:v.value.id,"onUpdate:modelValue":z[4]||(z[4]=W=>v.value.id=W),autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",NRe,[C("label",FRe,[qe(N(p(o)("providers.fieldApiKey")),1),z[18]||(z[18]=C("span",{class:"req"}," *",-1))]),C("div",RRe,[j(p(js),{modelValue:v.value.apiKey,"onUpdate:modelValue":z[5]||(z[5]=W=>v.value.apiKey=W),type:k.value?"text":"password",placeholder:"sk-…",autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type"]),j(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(k.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(o)(k.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[6]||(z[6]=W=>k.value=!k.value)},{default:me(()=>[j(p(Te),{name:k.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"])])]),m.value.needsBaseUrl?(y(),M("div",ORe,[C("label",PRe,[qe(N(p(o)("providers.fieldBaseUrl")),1),z[19]||(z[19]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:v.value.baseUrl,"onUpdate:modelValue":z[7]||(z[7]=W=>v.value.baseUrl=W),placeholder:p(o)("providers.baseUrlPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])])):ee("",!0),S.value?(y(),he(p(qu),{key:1,variant:"warning"},{default:me(()=>[qe(N(p(o)("providers.catalog.overwriteWarning")),1)]),_:1})):ee("",!0),C("div",DRe,N(p(o)("providers.catalog.willImport",{count:m.value.models.length})),1),b.value?(y(),M("div",{key:2,ref_key:"importErrorBox",ref:T},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(b.value),1)]),_:1})],512)):ee("",!0),C("div",BRe,[j(p(Rt),{variant:"secondary",size:"sm",onClick:z[8]||(z[8]=W=>n("cancel"))},{default:me(()=>[qe(N(p(o)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:w.value,onClick:P},{default:me(()=>[qe(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],32))],512)),[[qs,r.value==="catalog"]]):ee("",!0),Bn(C("div",{class:"af-registry",onInput:x},[C("div",HRe,N(p(o)("providers.catalog.registryHint")),1),C("div",zRe,[C("label",WRe,[qe(N(p(o)("providers.catalog.registryUrlLabel")),1),z[20]||(z[20]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:D.value.url,"onUpdate:modelValue":z[9]||(z[9]=W=>D.value.url=W),placeholder:"https://example.com/api.json",autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",URe,[C("label",jRe,N(p(o)("providers.fieldApiKey")),1),C("div",VRe,[j(p(js),{modelValue:D.value.apiKey,"onUpdate:modelValue":z[10]||(z[10]=W=>D.value.apiKey=W),type:I.value?"text":"password",placeholder:p(o)("providers.modelNamePlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type","placeholder"]),j(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(I.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(o)(I.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[11]||(z[11]=W=>I.value=!I.value)},{default:me(()=>[j(p(Te),{name:I.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"])])]),B.value?(y(),M("div",{key:0,ref_key:"registryErrorBox",ref:H},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(B.value),1)]),_:1})],512)):ee("",!0),C("div",qRe,[j(p(Rt),{variant:"secondary",size:"sm",onClick:z[12]||(z[12]=W=>n("cancel"))},{default:me(()=>[qe(N(p(o)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:$.value,onClick:F},{default:me(()=>[qe(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],544),[[qs,r.value==="registry"]]),Bn(C("div",KRe,[j(kF,{mode:"add",guard:!1,onDirtyChange:z[13]||(z[13]=W=>n("dirtyChange",W)),onAdded:z[14]||(z[14]=W=>n("added",W)),onCancel:z[15]||(z[15]=W=>n("cancel"))})],512),[[qs,r.value==="manual"]])]))}}),GRe=ft(ZRe,[["__scopeId","data-v-9e5ec0a8"]]),YRe={class:"pp"},XRe={class:"pp-head"},JRe={class:"pp-title"},QRe={key:0,class:"pp-loading"},eOe={key:1,class:"pp-group"},tOe={class:"pp-add-label"},nOe={class:"pp-chev"},oOe={class:"pp-acc"},sOe={class:"pp-acc-in"},iOe={key:1,class:"pp-empty"},rOe=["onClick"],lOe={class:"grow"},aOe={class:"pp-id"},uOe={class:"pp-count"},cOe={class:"pp-chev"},dOe={class:"pp-acc"},fOe={class:"pp-acc-in"},Wu="$add",pOe=et({__name:"ProvidersPanel",setup(e){const{t}=Nt(),n=mu(),o=Z(!0),s=Z(null),i=Z(null);let r=0;const l=Z(!1),a=Z(!1),u=Z(null),c=Z("");let d=0;const f=R(()=>[...n.providers.value].sort((S,T)=>S.id.localeCompare(T.id)));function h(S){return w3(S,n.config.value?.models).length}Je(s,(S,T)=>{T!==null&&T!==S&&(i.value=T,window.clearTimeout(r),r=window.setTimeout(()=>{i.value=null},300)),l.value=!1}),Je(l,S=>{S||(a.value=!1,u.value=null)}),bn(()=>{window.clearTimeout(r),window.clearTimeout(d)});const m=Z(!1);Je(s,S=>{S===Wu?(m.value=!1,yt(()=>requestAnimationFrame(()=>{m.value=!0}))):m.value=!1}),dn(async()=>{o.value=!0;try{await Promise.all([n.loadProviders(),n.loadModels(),n.loadConfig()])}finally{o.value=!1}});function v(S){const T=s.value===S?null:S;if(l.value){u.value=T,a.value=!0;return}s.value=T}function k(){a.value=!1,u.value=null}function w(){a.value=!1,s.value=u.value,u.value=null}function b(S){c.value=S,window.clearTimeout(d),d=window.setTimeout(()=>{c.value=""},1200)}function _(S){s.value=S}function g(S){s.value=S,b(S)}function x(){s.value=null}return(S,T)=>(y(),M("section",YRe,[C("div",XRe,[C("h3",JRe,N(p(t)("settings.tabs.providers")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:T[0]||(T[0]=A=>v(Wu))},{default:me(()=>[j(p(Te),{name:"plus",size:"sm"}),qe(" "+N(p(t)("providers.addProvider")),1)]),_:1})]),o.value?(y(),M("div",QRe,[j(p(Ao),{size:"sm"}),C("span",null,N(p(t)("providers.loading")),1)])):(y(),M("div",eOe,[s.value===Wu||i.value===Wu?(y(),M("div",{key:0,class:Re(["pp-item pp-add-item",{open:s.value===Wu&&m.value}])},[C("button",{type:"button",class:"pp-row pp-add-row",onClick:T[1]||(T[1]=A=>v(Wu))},[C("span",tOe,N(p(t)("providers.addProvider")),1),T[6]||(T[6]=C("span",{class:"grow"},null,-1)),C("span",nOe,[j(p(Te),{name:"chevron-right",size:"sm"})])]),C("div",oOe,[C("div",sOe,[j(GRe,{guard:a.value&&s.value===Wu,onDirtyChange:T[2]||(T[2]=A=>l.value=A),onGuardStay:k,onGuardDiscard:w,onAdded:g,onCancel:T[3]||(T[3]=A=>s.value=null)},null,8,["guard"])])])],2)):ee("",!0),f.value.length===0?(y(),M("div",iOe,N(p(t)("providers.empty")),1)):ee("",!0),(y(!0),M(Pe,null,pt(f.value,A=>(y(),M("div",{key:A.id,class:Re(["pp-item",{open:s.value===A.id,flash:c.value===A.id}])},[C("button",{type:"button",class:"pp-row",onClick:E=>v(A.id)},[C("div",lOe,[C("span",aOe,N(A.id),1),j(p(Vr),{variant:"neutral",size:"sm"},{default:me(()=>[qe(N(A.type),1)]),_:2},1024),p(mE)(A)?(y(),he(p(Vr),{key:0,variant:"info",size:"sm"},{default:me(()=>[qe(N(p(t)("providers.managedBadge")),1)]),_:1})):ee("",!0)]),C("span",uOe,N(p(t)("providers.modelCount",{count:h(A)})),1),C("span",cOe,[j(p(Te),{name:"chevron-right",size:"sm"})])],8,rOe),C("div",dOe,[C("div",fOe,[s.value===A.id||i.value===A.id?(y(),he(kF,{key:0,mode:"edit",provider:A,guard:a.value&&s.value===A.id,onDirtyChange:T[4]||(T[4]=E=>l.value=E),onGuardStay:k,onGuardDiscard:w,onSaved:_,onDeleting:T[5]||(T[5]=E=>s.value=null),onDeleted:x},null,8,["provider","guard"])):ee("",!0)])])],2))),128))]))]))}}),hOe=ft(pOe,[["__scopeId","data-v-9aa0e3a8"]]),mOe={class:"sec"},gOe={class:"sec-title"},vOe={class:"pu-group"},yOe={class:"pu-row"},kOe={class:"pu-main"},bOe={class:"pu-label"},COe={class:"pu-hint"},wOe=et({__name:"PlanUpgradeCard",setup(e){const{t}=Nt();return(n,o)=>(y(),M("section",mOe,[C("h3",gOe,N(p(t)("settings.planUsage.title")),1),C("div",vOe,[C("div",yOe,[C("span",kOe,[C("span",bOe,N(p(t)("settings.planUsage.freeTitle")),1),C("span",COe,N(p(t)("settings.planUsage.freeHint")),1)]),j(p(Rt),{variant:"primary",size:"sm",onClick:o[0]||(o[0]=s=>p(jp)())},{default:me(()=>[qe(N(p(t)("sidebar.upgrade")),1)]),_:1})])])]))}}),bF=ft(wOe,[["__scopeId","data-v-5711dff8"]]),_Oe={class:"sec"},xOe={class:"sec-title"},SOe={class:"pu-group"},AOe={key:0,class:"pu-row pu-state"},MOe={key:1,class:"pu-row pu-state"},TOe={class:"pu-error-text"},EOe={key:2,class:"pu-row pu-state pu-empty"},IOe={class:"pu-main"},LOe={class:"pu-label"},$Oe={key:0,class:"pu-hint"},NOe={class:"pu-value"},FOe=["aria-valuenow","aria-valuemax"],ROe={key:0,class:"sec"},OOe={class:"sec-title"},POe={class:"pu-group"},DOe={class:"pu-row"},BOe={class:"pu-main"},HOe={class:"pu-label"},zOe={class:"pu-value"},WOe={key:0,class:"pu-value-sub"},UOe={key:0,class:"pu-meter"},jOe={class:"pu-row"},VOe={class:"pu-main"},qOe={class:"pu-label"},KOe={class:"pu-value"},ZOe={class:"pu-row"},GOe={class:"pu-main"},YOe={class:"pu-label"},XOe={class:"pu-value"},JOe={class:"pu-value-sub"},QOe=et({__name:"PlanUsageCard",props:{onFetchUsage:{type:Function}},setup(e){const t=e,{t:n}=Nt(),o=Z(!0),s=Z(null);async function i(){o.value=!0;try{s.value=await t.onFetchUsage()}finally{o.value=!1}}dn(i);const r=R(()=>s.value?.kind==="ok"?s.value:null),l=R(()=>r.value?.extraUsage??null),a=R(()=>{const v=r.value;return v===null?[]:v.summary===null?v.limits:[v.summary,...v.limits]}),u=R(()=>a.value.length>0),c=R(()=>s.value?.kind==="error"?s.value.message:n("settings.planUsage.loadFailed")),d=R(()=>s.value?.kind==="error"&&(s.value.status===402||s.value.status===403)),f=R(()=>l.value!==null&&l.value.monthlyChargeLimitEnabled&&l.value.monthlyChargeLimitCents>0);function h(v,k){const w=PJ(v,k);return`${w.symbol}${w.number}`}function m(v){return v.resetAt===void 0?"":fE(v.resetAt,n)}return(v,k)=>d.value?(y(),he(bF,{key:0})):(y(),M(Pe,{key:1},[C("section",_Oe,[C("h3",xOe,N(p(n)("settings.planUsage.title")),1),C("div",SOe,[o.value?(y(),M("div",AOe,[j(p(Ao),{size:"sm"})])):r.value===null?(y(),M("div",MOe,[C("span",TOe,N(c.value),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:i},{default:me(()=>[qe(N(p(n)("settings.planUsage.retry")),1)]),_:1})])):u.value?(y(!0),M(Pe,{key:3},pt(a.value,(w,b)=>(y(),M("div",{key:b,class:"pu-row"},[C("span",IOe,[C("span",LOe,N(p(dE)(w,p(n))),1),m(w)?(y(),M("span",$Oe,N(m(w)),1)):ee("",!0)]),C("span",NOe,N(p(n)("settings.planUsage.usedPct",{pct:p(Wh)(w.used,w.limit)})),1),C("span",{class:"pu-meter",role:"progressbar","aria-valuenow":w.used,"aria-valuemax":w.limit},[C("i",{class:Re(`sev-${p(C3)(w.used,w.limit)}`),style:Zt({width:`${p(Wh)(w.used,w.limit)}%`})},null,6)],8,FOe)]))),128)):(y(),M("div",EOe,N(p(n)("settings.planUsage.empty")),1))])]),l.value!==null?(y(),M("section",ROe,[C("h3",OOe,N(p(n)("settings.planUsage.boosterTitle")),1),C("div",POe,[C("div",DOe,[C("span",BOe,[C("span",HOe,N(p(n)("settings.planUsage.monthlyUsed")),1)]),C("span",zOe,[qe(N(h(l.value.monthlyUsedCents,l.value.currency)),1),f.value?(y(),M("span",WOe," / "+N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)):ee("",!0)]),f.value?(y(),M("span",UOe,[C("i",{class:Re(`sev-${p(C3)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}`),style:Zt({width:`${p(Wh)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}%`})},null,6)])):ee("",!0)]),C("div",jOe,[C("span",VOe,[C("span",qOe,N(p(n)("settings.planUsage.monthlyLimit")),1)]),C("span",KOe,[f.value?(y(),M(Pe,{key:0},[qe(N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)],64)):(y(),M(Pe,{key:1},[qe(N(p(n)("settings.planUsage.unlimited")),1)],64))])]),C("div",ZOe,[C("span",GOe,[C("span",YOe,N(p(n)("settings.planUsage.boosterBalance")),1)]),C("span",XOe,[qe(N(h(l.value.balanceCents,l.value.currency)),1),C("span",JOe," / "+N(h(l.value.totalCents,l.value.currency)),1)])])])])):ee("",!0)],64))}}),ePe=ft(QOe,[["__scopeId","data-v-f39cdded"]]),tPe=["aria-expanded","aria-label"],nPe={class:"sm-picker__value-text"},oPe=["aria-label"],sPe=["aria-label"],iPe={class:"sm-picker__group"},rPe=["aria-selected","onMouseenter","onClick"],lPe={class:"sm-picker__option-label"},aPe=["aria-label"],uPe={class:"sm-picker__group"},cPe=["aria-selected","onMouseenter","onClick"],dPe={class:"sm-picker__option-label"},fPe=188,pPe=250,wS=8,hPe=et({__name:"SecondaryModelPicker",props:{modelValue:{},effort:{},groups:{},modelInfoById:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=Z(null),r=Z(null),l=Z(null),a=new Map,u=Z(!1),c=Z(!1),d=Z({}),f=`sm-picker-${Math.random().toString(36).slice(2,9)}`,h=Z(""),m=Z(null),v=Z("right"),k=Z(0),w=Z("models"),b=Z(0),_=Z(0);let g=null;const x=R(()=>n.groups.flatMap(ve=>ve.options)),S=R(()=>n.modelValue?x.value.find(ve=>ve.id===n.modelValue)?.label??n.modelValue:""),T=R(()=>n.modelValue?n.effort?`${S.value} · ${n.effort}`:S.value:s("settings.noSecondaryModel")),A=R(()=>{const ve=m.value;if(ve===null)return[];const oe=Up(n.modelInfoById[ve]),ye=n.effort===""?[null,...oe]:[...oe];return n.modelValue===ve&&n.effort!==""&&!oe.includes(n.effort)&&ye.push(n.effort),ye});function E(ve){return n.modelValue!==m.value?!1:ve===null?n.effort==="":n.effort===ve}function P(){const ve=A.value.findIndex(oe=>E(oe));return ve>=0?ve:0}function D(ve,oe){ve instanceof HTMLElement?a.set(oe,ve):a.delete(oe)}function I(){g!==null&&(clearTimeout(g),g=null)}function $(){I(),g=setTimeout(()=>{m.value=null,w.value==="efforts"&&(w.value="models")},pPe)}function B(ve){ve!==h.value&&(h.value=ve,b.value=Math.max(0,x.value.findIndex(oe=>oe.id===ve)))}function H(){const ve=r.value,oe=l.value;if(!ve||!oe)return;const ye=ve.getBoundingClientRect(),G=oe.offsetHeight,Y=window.innerHeight-ye.bottom;c.value=YG;const fe=Math.max(wS,window.innerWidth-ye.right);d.value=c.value?{right:`${fe}px`,bottom:`${window.innerHeight-ye.top+4}px`,top:"auto"}:{right:`${fe}px`,top:`${ye.bottom+4}px`,bottom:"auto"}}function O(){const ve=l.value,oe=m.value===null?void 0:a.get(m.value);if(!ve||!oe)return;const ye=ve.getBoundingClientRect(),G=oe.getBoundingClientRect();k.value=Math.max(0,Math.min(G.top-ye.top-4,ve.offsetHeight-40));const Y=window.innerWidth-ye.right,fe=ye.left;v.value=Y>=fPe||Y>=fe?"right":"left"}function F(ve,{moveFocus:oe=!1}={}){B(ve),I(),m.value=ve,oe&&(w.value="efforts",_.value=P()),yt(O)}function U(){m.value=null,w.value="models"}function z(){u.value||(u.value=!0,h.value=n.modelValue||(x.value[0]?.id??""),b.value=Math.max(0,x.value.findIndex(ve=>ve.id===h.value)),m.value=null,w.value="models",yt(H))}function W({restoreFocus:ve=!1}={}){u.value&&(I(),u.value=!1,m.value=null,ve&&yt(()=>r.value?.focus()))}function K(){u.value?W():z()}function V(ve){if(m.value===null)return;const oe={model:m.value,effort:ve??void 0};(oe.model!==n.modelValue||(oe.effort??"")!==n.effort)&&o("select",oe),W({restoreFocus:!0})}function ie(){yt(()=>{l.value?.querySelector(".sm-picker__option.is-kb-active")?.scrollIntoView({block:"nearest"})})}function ne(ve){const oe=x.value;if(oe.length===0)return;const ye=(b.value+ve+oe.length)%oe.length,G=oe[ye].id;B(G),m.value!==null&&F(G),ie()}function X(ve){const oe=A.value;oe.length!==0&&(_.value=(_.value+ve+oe.length)%oe.length,ie())}function le(ve){if(!u.value){(ve.key==="Enter"||ve.key===" "||ve.key==="ArrowDown")&&(ve.preventDefault(),z());return}if(ve.key==="ArrowDown")ve.preventDefault(),w.value==="models"?ne(1):X(1);else if(ve.key==="ArrowUp")ve.preventDefault(),w.value==="models"?ne(-1):X(-1);else if(ve.key==="ArrowRight")ve.preventDefault(),F(h.value,{moveFocus:!0});else if(ve.key==="ArrowLeft")ve.preventDefault(),m.value!==null&&U();else if(ve.key==="Enter"||ve.key===" ")ve.preventDefault(),w.value==="models"?F(h.value,{moveFocus:!0}):V(A.value[_.value]??null);else if(ve.key==="Home"||ve.key==="End"){ve.preventDefault();const oe=ve.key==="Home";if(w.value==="models"){const ye=x.value;if(ye.length===0)return;const G=(oe?ye[0]:ye.at(-1)).id;B(G),m.value!==null&&F(G)}else _.value=oe?0:A.value.length-1;ie()}else ve.key==="Escape"&&(ve.preventDefault(),W({restoreFocus:!0}))}function Ie(ve){const oe=ve.target;i.value?.contains(oe)||l.value?.contains(oe)||W()}function de(ve){if(u.value){if(l.value?.contains(ve.target)){O();return}H(),O()}}function pe(){W()}return dn(()=>{document.addEventListener("pointerdown",Ie),document.addEventListener("scroll",de,!0),window.addEventListener("resize",pe)}),bn(()=>{document.removeEventListener("pointerdown",Ie),document.removeEventListener("scroll",de,!0),window.removeEventListener("resize",pe),I()}),(ve,oe)=>(y(),M("div",{ref_key:"rootRef",ref:i,class:Re(["sm-picker",{"is-open":u.value}])},[C("button",{ref_key:"triggerRef",ref:r,class:"sm-picker__trigger",type:"button",role:"combobox","aria-controls":f,"aria-expanded":u.value,"aria-haspopup":"dialog","aria-label":p(s)("settings.secondaryModel"),onClick:K,onKeydown:le},[C("span",{class:Re(["sm-picker__value",{"is-placeholder":!e.modelValue}])},[C("span",nPe,N(T.value),1)],2),j(p(Te),{class:"sm-picker__chevron",name:"chevron-down",size:"sm"})],40,tPe),(y(),he(Zr,{to:"body"},[u.value?(y(),M("div",{key:0,id:f,ref_key:"menuRef",ref:l,class:Re(["sm-picker__menu",{"sm-picker__menu--up":c.value}]),style:Zt(d.value),role:"dialog","aria-label":p(s)("settings.secondaryModel")},[C("div",{class:"sm-picker__models",role:"listbox","aria-label":p(s)("settings.secondaryModel")},[(y(!0),M(Pe,null,pt(e.groups,ye=>(y(),M(Pe,{key:ye.provider},[C("div",iPe,N(ye.provider),1),(y(!0),M(Pe,null,pt(ye.options,G=>(y(),M("button",{key:G.id,ref_for:!0,ref:Y=>D(Y,G.id),class:Re(["sm-picker__option",{"is-selected":G.id===e.modelValue,"is-active":G.id===h.value,"is-kb-active":w.value==="models"&&G.id===h.value}]),type:"button",role:"option","aria-selected":G.id===e.modelValue,onMouseenter:Y=>F(G.id),onMouseleave:$,onClick:Y=>F(G.id,{moveFocus:!0})},[j(p(Te),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",lPe,N(G.label),1),j(p(Te),{class:"sm-picker__flyout-caret",name:"chevron-right",size:"sm"})],42,rPe))),128))],64))),128))],8,sPe),m.value!==null?(y(),M("div",{key:0,class:Re(["sm-picker__flyout",`sm-picker__flyout--${v.value}`]),style:Zt({top:`${k.value}px`}),role:"listbox","aria-label":p(s)("settings.secondaryModelEffort"),onMouseenter:I,onMouseleave:$},[C("div",uPe,N(p(s)("settings.secondaryModelEffort")),1),(y(!0),M(Pe,null,pt(A.value,(ye,G)=>(y(),M("button",{key:ye??"__default__",class:Re(["sm-picker__option",{"is-selected":E(ye),"is-active":w.value==="efforts"&&G===_.value,"is-kb-active":w.value==="efforts"&&G===_.value,"is-muted":ye===null}]),type:"button",role:"option","aria-selected":E(ye),onMouseenter:Y=>{w.value="efforts",_.value=G},onClick:Y=>V(ye)},[j(p(Te),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",dPe,N(ye??p(s)("settings.secondaryModelEffortAuto")),1)],42,cPe))),128))],46,aPe)):ee("",!0)],14,oPe)):ee("",!0)]))],2))}}),mPe=ft(hPe,[["__scopeId","data-v-f114c246"]]),gPe=["aria-label"],vPe={class:"settings-tabs-header"},yPe={class:"settings-dialog-title"},kPe={class:"settings-tab-list"},bPe=["aria-selected","onClick"],CPe={class:"settings-region"},wPe={class:"settings-region-header"},_Pe={class:"panel"},xPe={class:"sec"},SPe={class:"sec-title"},APe={class:"settings-group"},MPe={class:"row"},TPe={class:"rlabel"},EPe={class:"hint"},IPe={class:"row language-row"},LPe={class:"rlabel"},$Pe={class:"hint"},NPe={class:"row font-size-row"},FPe={class:"rlabel"},RPe={class:"hint"},OPe={class:"sec notification-settings"},PPe={class:"sec-title"},DPe={class:"settings-group"},BPe={class:"row"},HPe={class:"rlabel"},zPe={class:"hint"},WPe={key:0,class:"hint"},UPe={class:"row"},jPe={class:"rlabel"},VPe={class:"hint"},qPe={class:"panel"},KPe={class:"sec"},ZPe={class:"sec-title"},GPe={class:"settings-group"},YPe={class:"account-row"},XPe={class:"account-avatar","aria-hidden":"true"},JPe=["src"],QPe={class:"account-meta"},eDe={class:"account-name-row"},tDe={class:"account-name"},nDe={class:"account-sub"},oDe={key:0,class:"panel"},sDe={class:"panel"},iDe={class:"sec"},rDe={class:"sec-head"},lDe={class:"sec-title"},aDe={class:"settings-group"},uDe={class:"row"},cDe={class:"rlabel"},dDe={class:"hint"},fDe={key:0,class:"select-wrap"},pDe={key:1,class:"rvalue mono"},hDe={class:"row"},mDe={class:"rlabel"},gDe={class:"hint"},vDe={class:"row"},yDe={class:"rlabel"},kDe={class:"hint"},bDe={class:"row"},CDe={class:"rlabel"},wDe={class:"hint"},_De={key:1,class:"empty-config"},xDe={key:0,class:"sec"},SDe={class:"sec-head"},ADe={class:"sec-title"},MDe={class:"settings-group"},TDe={class:"row"},EDe={class:"rlabel"},IDe={class:"hint"},LDe={key:0,class:"select-wrap"},$De={key:1,class:"rvalue mono"},NDe={class:"panel"},FDe={class:"sec"},RDe={class:"sec-title"},ODe={class:"settings-group"},PDe={class:"row"},DDe={class:"rlabel"},BDe={class:"hint"},HDe={class:"rvalue"},zDe={class:"row"},WDe={class:"rlabel"},UDe={class:"hint"},jDe={class:"rvalue"},VDe={class:"row"},qDe={class:"rlabel"},KDe={class:"hint"},ZDe={class:"rvalue"},GDe={key:0,class:"row"},YDe={class:"rlabel"},XDe={key:0,class:"hint"},JDe={key:1,class:"hint"},QDe={key:1,class:"row"},eBe={class:"rlabel"},tBe={class:"hint"},nBe={key:0,class:"sec"},oBe={class:"sec-title"},sBe={class:"settings-group"},iBe={class:"row"},rBe={class:"rlabel"},lBe={class:"hint"},aBe={class:"hint"},uBe={class:"sec"},cBe={class:"sec-title"},dBe={class:"settings-group"},fBe={class:"row"},pBe={class:"rlabel"},hBe={class:"hint"},mBe={key:0,class:"hint"},gBe={class:"panel"},vBe={class:"panel-head"},yBe={class:"panel-title"},kBe={class:"panel-desc"},bBe={class:"archive-toolbar"},CBe={class:"archive-search"},wBe=["placeholder"],_Be={key:0,class:"archive-empty"},xBe={key:0,class:"archive-list"},SBe={class:"archive-workspace"},ABe={class:"path"},MBe={class:"count"},TBe={class:"setting-card"},EBe={class:"archive-meta"},IBe={class:"archive-name"},LBe={class:"archive-time"},$Be={key:1,class:"archive-empty"},NBe=100,FBe=et({__name:"SettingsDialog",props:{colorScheme:{},fontScale:{},initialTab:{},managedProviderStatus:{},managedUserInfo:{},onFetchUsage:{type:Function},notify:{type:Boolean},notifyPermission:{},notifySound:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},experimentalFlags:{}},emits:["setColorScheme","setFontScale","setNotify","setNotifySound","login","logout","updateConfig","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R(()=>o.managedProviderStatus==="authenticated"),r=R(()=>i.value?o.managedUserInfo?.nickname||n("sidebar.defaultUserName"):n("sidebar.notSignedIn")),l=R(()=>o.managedUserInfo?.userLevelName?.trim()??""),a=Z(!1);Je(()=>o.managedUserInfo?.avatar,()=>{a.value=!1});const u=R(()=>!!o.managedUserInfo?.avatar&&!a.value),c=R(()=>i.value?n("settings.signedIn"):n("settings.signedOutHint")),d=Z(o.initialTab??"general"),f=Z(!1);let h=null;function m(){f.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{f.value=!1,h=null},900)}const v=[{id:"general",labelKey:"settings.tabs.general",icon:"sliders"},{id:"agent",labelKey:"settings.tabs.agent",icon:"robot"},{id:"account",labelKey:"settings.tabs.account",icon:"user"},{id:"providers",labelKey:"settings.tabs.providers",icon:"bolt"},{id:"advanced",labelKey:"settings.tabs.advanced",icon:"microscope"},{id:"archived",labelKey:"settings.tabs.archived",icon:"archive"}],k=G0e(),w=["manual","yolo","auto"],b={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},_=Z(null);gF(_);const{isConfirmOpen:g}=hu();function x(Fe){Fe.key==="Escape"&&!Fe.defaultPrevented&&!g.value&&s("close")}dn(()=>document.addEventListener("keydown",x)),bn(()=>{document.removeEventListener("keydown",x),h&&clearTimeout(h)});function S(){G$()}const T=(()=>{const Fe="0.33.0".trim()?"0.33.0":"";let Oe="";if("2026-08-12T03:30:09.051Z".trim()){const at=new Date("2026-08-12T03:30:09.051Z");if(!Number.isNaN(at.getTime())){const Tt=Bt=>String(Bt).padStart(2,"0");Oe=`${at.getFullYear()}-${Tt(at.getMonth()+1)}-${Tt(at.getDate())} ${Tt(at.getHours())}:${Tt(at.getMinutes())}`}}const Ge=Oe===""?Fe:`${Fe} · ${Oe}`;return Ge===""?"-":Ge})(),A=K$(),E=Z(!1),P=Z(null);async function D(){if(!E.value){E.value=!0,P.value=null;try{P.value=await A.check()}finally{E.value=!1}}}const I=R(()=>{const Fe=P.value;if(Fe===null)return"";switch(Fe.outcome){case"available":return A.status.value.state==="downloaded"?n("settings.updateCheckDownloaded",{version:Fe.version??""}):A.autoDownload.value?n("settings.updateCheckAvailableAuto",{version:Fe.version??""}):n("settings.updateCheckAvailable",{version:Fe.version??""});case"latest":return n("settings.updateCheckLatest");case"unsupported":return n("settings.updateCheckUnsupported");case"error":return n("settings.updateCheckFailed")}}),$=R(()=>{const Fe=new Map;for(const Oe of o.models??[])Fe.set(Oe.id,{id:Oe.id,label:Oe.displayName??Oe.model??Oe.id,provider:Oe.provider});for(const[Oe,Ge]of Object.entries(o.config?.models??{})){if(Fe.has(Oe))continue;const at=F(Ge);Fe.set(Oe,{id:Oe,label:U(Oe,Ge,at),provider:at??Oe})}return Array.from(Fe.values())}),B=R(()=>{const Fe=new Map;for(const Oe of $.value){const Ge=Fe.get(Oe.provider)??[];Ge.push(Oe),Fe.set(Oe.provider,Ge)}for(const Oe of Fe.values())Oe.sort((Ge,at)=>Ge.label.localeCompare(at.label));return Array.from(Fe.entries()).toSorted(([Oe],[Ge])=>Oe.localeCompare(Ge)).map(([Oe,Ge])=>({provider:Oe,options:Ge}))}),H=R(()=>{const Fe=B.value.flatMap(Oe=>Oe.options.map(Ge=>({value:Ge.id,label:Ge.label,group:Oe.provider})));return o.config?.defaultModel||Fe.unshift({value:"",label:n("settings.noDefaultModel"),group:"",disabled:!0}),Fe}),O=R(()=>{const Fe=o.config?.defaultPermissionMode;return Fe==="auto"||Fe==="yolo"||Fe==="manual"?Fe:"manual"});function F(Fe){if(!Fe||typeof Fe!="object")return;const Oe=Fe;return typeof Oe.provider=="string"?Oe.provider:void 0}function U(Fe,Oe,Ge){if(!Oe||typeof Oe!="object")return Fe;const at=Oe,Tt=typeof at.model=="string"?at.model:void 0,Bt=Ge??F(Oe);return Tt&&Bt?`${Fe} (${Bt}/${Tt})`:Tt?`${Fe} (${Tt})`:Fe}function z(Fe){return Fe===!0}function W(Fe){!Fe||Fe===o.config?.defaultModel||s("updateConfig",{defaultModel:Fe})}function K(Fe){Fe!==O.value&&s("updateConfig",{defaultPermissionMode:Fe})}const V=R(()=>(o.experimentalFlags?.["secondary-model"]??o.config?.experimental?.["secondary-model"])===!0),ie=R(()=>o.config?.secondaryModel?.model??""),ne=R(()=>o.config?.secondaryModel?.defaultEffort??""),X=R(()=>Object.fromEntries((o.models??[]).map(Fe=>[Fe.id,Fe])));function le(Fe){Fe.model===ie.value&&(Fe.effort??"")===ne.value||s("updateConfig",{secondaryModel:Fe.effort?{model:Fe.model,defaultEffort:Fe.effort}:{model:Fe.model}})}function Ie(Fe){const Oe=o.config?.[Fe];s("updateConfig",{[Fe]:!z(Oe)})}function de(){const Fe=o.config?.thinking;return!Fe||typeof Fe!="object"?!0:Fe.enabled!==!1}function pe(){s("updateConfig",{thinking:{enabled:!de()}})}function ve(){const Fe=o.config?.telemetry!==!1;s("updateConfig",{telemetry:!Fe})}function oe(Fe){d.value=Fe}const ye=mu(),G=R(()=>i.value&&ye.managedMembership.value==="free"),Y=Z([]),fe=Z(!1),we=Z(!1),ge=Z(""),Q=Z("all"),te=Z("archived-desc");async function ce(){if(!(fe.value||we.value)){fe.value=!0;try{const Fe=[];let Oe;for(;;){const Ge=await ye.loadArchivedSessions({beforeId:Oe,pageSize:NBe});if(Fe.push(...Ge.items),!Ge.hasMore||Ge.items.length===0)break;const at=Ge.items.at(-1)?.id;if(at===void 0)break;Oe=at}Y.value=Fe,we.value=!0}catch(Fe){gl("loadAllArchived failed",Fe)}finally{fe.value=!1}}}Je(d,Fe=>{Fe==="archived"&&!we.value&&ce()},{immediate:!0});const ue=R(()=>{const Fe=new Set;for(const Oe of Y.value)Fe.add(Oe.cwd);return Array.from(Fe).sort((Oe,Ge)=>Oe.localeCompare(Ge))}),Se=R(()=>[{value:"all",label:n("settings.archivedAllWorkspaces")},...ue.value.map(Fe=>({value:Fe,label:Fe}))]),ze=R(()=>{const Fe=ge.value.trim().toLowerCase();let Oe=Y.value.filter(Ge=>Ge.archived===!0);return Q.value!=="all"&&(Oe=Oe.filter(Ge=>Ge.cwd===Q.value)),Fe&&(Oe=Oe.filter(Ge=>Ge.title.toLowerCase().includes(Fe))),Oe=Oe.slice(),te.value==="archived-desc"?Oe.sort((Ge,at)=>at.updatedAt.localeCompare(Ge.updatedAt)):te.value==="created-desc"?Oe.sort((Ge,at)=>at.createdAt.localeCompare(Ge.createdAt)):Oe.sort((Ge,at)=>Ge.title.localeCompare(at.title,"zh")),Oe}),_e=R(()=>{const Fe=new Map;for(const Oe of ze.value){const Ge=Fe.get(Oe.cwd)??[];Ge.push(Oe),Fe.set(Oe.cwd,Ge)}return Array.from(Fe.entries()).map(([Oe,Ge])=>({cwd:Oe,items:Ge}))});async function Ee(Fe){await ye.restoreSession(Fe)&&(Y.value=Y.value.filter(Ge=>Ge.id!==Fe))}function it(Fe){const Oe=new Date(Fe);if(Number.isNaN(Oe.getTime()))return Fe;const Ge=at=>String(at).padStart(2,"0");return`${Oe.getFullYear()}-${Ge(Oe.getMonth()+1)}-${Ge(Oe.getDate())} ${Ge(Oe.getHours())}:${Ge(Oe.getMinutes())}`}return(Fe,Oe)=>(y(),he(p(ua),{open:!0,"close-on-esc":!1,"aria-label":p(n)("settings.title"),size:"xl",height:"fixed",padded:!1,level:"grouped",onClose:Oe[16]||(Oe[16]=Ge=>s("close"))},{default:me(()=>[C("div",{ref_key:"dialogRef",ref:_,class:"sd"},[C("nav",{class:"settings-tabs",role:"tablist","aria-label":p(n)("settings.title")},[C("header",vPe,[C("h2",yPe,N(p(n)("settings.title")),1)]),C("div",kPe,[(y(),M(Pe,null,pt(v,Ge=>C("button",{key:Ge.id,type:"button",class:Re(["tab",{on:d.value===Ge.id}]),role:"tab","aria-selected":d.value===Ge.id,onClick:at=>oe(Ge.id)},[j(p(Te),{name:Ge.icon,size:"md"},null,8,["name"]),C("span",null,N(p(n)(Ge.labelKey)),1)],10,bPe)),64))])],8,gPe),C("section",CPe,[C("header",wPe,[j(p(gn),{size:"sm",label:p(n)("settings.close"),tooltip:p(n)("settings.close"),onClick:Oe[0]||(Oe[0]=Ge=>s("close"))},{default:me(()=>[j(p(Te),{name:"close",size:"md"})]),_:1},8,["label","tooltip"])]),C("div",{class:Re(["body",{scrolling:f.value}]),onScroll:m},[Bn(C("section",_Pe,[C("section",xPe,[C("h3",SPe,N(p(n)("settings.appearance")),1),C("div",APe,[C("div",MPe,[C("span",TPe,[qe(N(p(n)("theme.colorSchemeLabel"))+" ",1),C("span",EPe,N(p(n)("settings.colorSchemeHint")),1)]),j(p(wi),{"model-value":e.colorScheme,options:[{value:"light",label:p(n)("theme.light"),icon:"light-mode"},{value:"dark",label:p(n)("theme.dark"),icon:"dark-mode"},{value:"system",label:p(n)("theme.system")}],"onUpdate:modelValue":Oe[1]||(Oe[1]=Ge=>s("setColorScheme",Ge))},null,8,["model-value","options"])]),C("div",IPe,[C("span",LPe,[qe(N(p(n)("sidebar.language"))+" ",1),C("span",$Pe,N(p(n)("settings.languageHint")),1)]),j(yF)]),C("div",NPe,[C("span",FPe,[qe(N(p(n)("settings.uiFontSize"))+" ",1),C("span",RPe,N(p(n)("settings.uiFontSizeHint")),1)]),j(p(wi),{"model-value":e.fontScale,options:[{value:"small",label:"S"},{value:"medium",label:"M"},{value:"large",label:"L"},{value:"xlarge",label:"XL"}],"aria-label":p(n)("settings.uiFontSize"),"onUpdate:modelValue":Oe[2]||(Oe[2]=Ge=>s("setFontScale",Ge))},null,8,["model-value","aria-label"])])])]),C("section",OPe,[C("h3",PPe,N(p(n)("settings.notifications")),1),C("div",DPe,[C("div",BPe,[C("span",HPe,[qe(N(p(n)("settings.notifyEnabled"))+" ",1),C("span",zPe,N(p(n)("settings.notifyEnabledHint")),1),e.notifyPermission==="denied"?(y(),M("span",WPe,N(p(n)("settings.notifyDenied")),1)):ee("",!0)]),j(p(ed),{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:p(n)("settings.notifyEnabled"),"onUpdate:modelValue":Oe[3]||(Oe[3]=Ge=>s("setNotify",Ge))},null,8,["model-value","disabled","label"])]),C("div",UPe,[C("span",jPe,[qe(N(p(n)("settings.notifySound"))+" ",1),C("span",VPe,N(p(n)("settings.notifySoundHint")),1)]),j(p(ed),{"model-value":e.notifySound,label:p(n)("settings.notifySound"),"onUpdate:modelValue":Oe[4]||(Oe[4]=Ge=>s("setNotifySound",Ge))},null,8,["model-value","label"])])])])],512),[[qs,d.value==="general"]]),Bn(C("section",qPe,[C("section",KPe,[C("h3",ZPe,N(p(n)("settings.account")),1),C("div",GPe,[C("div",YPe,[C("span",XPe,[u.value?(y(),M("img",{key:0,src:o.managedUserInfo?.avatar,alt:"",onError:Oe[5]||(Oe[5]=Ge=>a.value=!0)},null,40,JPe)):(y(),he(p(Te),{key:1,name:"user",size:"md"}))]),C("span",QPe,[C("span",eDe,[C("span",tDe,N(r.value),1),l.value?(y(),he(p(Vr),{key:0,class:"account-level",variant:"neutral",size:"sm"},{default:me(()=>[qe(N(l.value),1)]),_:1})):ee("",!0)]),C("span",nDe,N(c.value),1)]),i.value?(y(),he(p(Rt),{key:0,variant:"danger-soft",size:"sm",onClick:Oe[6]||(Oe[6]=Ge=>s("logout"))},{default:me(()=>[qe(N(p(n)("sidebar.signOut")),1)]),_:1})):(y(),he(p(Rt),{key:1,variant:"primary",size:"sm",onClick:Oe[7]||(Oe[7]=Ge=>s("login"))},{default:me(()=>[qe(N(p(n)("sidebar.signIn")),1)]),_:1}))])])]),G.value?(y(),he(bF,{key:0})):i.value?(y(),he(ePe,{key:1,"on-fetch-usage":o.onFetchUsage},null,8,["on-fetch-usage"])):ee("",!0)],512),[[qs,d.value==="account"]]),d.value==="providers"?(y(),M("section",oDe,[j(hOe)])):ee("",!0),Bn(C("section",sDe,[C("section",iDe,[C("div",rDe,[C("h3",lDe,N(p(n)("settings.agentDefaults")),1)]),C("div",aDe,[e.config?(y(),M(Pe,{key:0},[C("div",uDe,[C("span",cDe,[qe(N(p(n)("settings.defaultModel"))+" ",1),C("span",dDe,N(p(n)("settings.defaultModelHint")),1)]),B.value.length>0?(y(),M("div",fDe,[j(p(n3),{"model-value":e.config.defaultModel??"",options:H.value,"aria-label":p(n)("settings.defaultModel"),"onUpdate:modelValue":W},null,8,["model-value","options","aria-label"])])):(y(),M("span",pDe,N(e.config.defaultModel??p(n)("settings.noDefaultModel")),1))]),C("div",hDe,[C("span",mDe,[qe(N(p(n)("settings.defaultPermission"))+" ",1),C("span",gDe,N(p(n)("settings.defaultPermissionHint")),1)]),j(p(wi),{"model-value":O.value,options:w.map(Ge=>({value:Ge,label:p(n)(b[Ge])})),"onUpdate:modelValue":Oe[8]||(Oe[8]=Ge=>K(Ge))},null,8,["model-value","options"])]),C("div",vDe,[C("span",yDe,[qe(N(p(n)("settings.defaultThinking"))+" ",1),C("span",kDe,N(p(n)("settings.defaultThinkingHint")),1)]),j(p(ed),{"model-value":de(),label:p(n)("settings.defaultThinking"),"onUpdate:modelValue":Oe[9]||(Oe[9]=Ge=>pe())},null,8,["model-value","label"])]),C("div",bDe,[C("span",CDe,[qe(N(p(n)("settings.defaultPlanMode"))+" ",1),C("span",wDe,N(p(n)("settings.defaultPlanModeHint")),1)]),j(p(ed),{"model-value":z(e.config.defaultPlanMode),label:p(n)("settings.defaultPlanMode"),"onUpdate:modelValue":Oe[10]||(Oe[10]=Ge=>Ie("defaultPlanMode"))},null,8,["model-value","label"])])],64)):(y(),M("div",_De,N(p(n)("settings.configUnavailable")),1))])]),e.config&&V.value?(y(),M("section",xDe,[C("div",SDe,[C("h3",ADe,N(p(n)("settings.secondaryModelSection")),1)]),C("div",MDe,[C("div",TDe,[C("span",EDe,[qe(N(p(n)("settings.secondaryModel"))+" ",1),C("span",IDe,N(p(n)("settings.secondaryModelHint")),1)]),B.value.length>0?(y(),M("div",LDe,[j(mPe,{"model-value":ie.value,effort:ne.value,groups:B.value,"model-info-by-id":X.value,onSelect:le},null,8,["model-value","effort","groups","model-info-by-id"])])):(y(),M("span",$De,N(ie.value||p(n)("settings.noSecondaryModel")),1))])])])):ee("",!0)],512),[[qs,d.value==="agent"]]),Bn(C("section",NDe,[C("section",FDe,[C("h3",RDe,N(p(n)("settings.versionAndUpdates")),1),C("div",ODe,[C("div",PDe,[C("span",DDe,[qe(N(p(n)("settings.appVersion"))+" ",1),C("span",BDe,N(p(n)("settings.appVersionHint")),1)]),C("span",HDe,N(p(T)),1)]),C("div",zDe,[C("span",WDe,[qe(N(p(n)("settings.serverVersion"))+" ",1),C("span",UDe,N(p(n)("settings.serverVersionHint")),1)]),C("span",jDe,N(e.serverVersion||"-"),1)]),C("div",VDe,[C("span",qDe,[qe(N(p(n)("settings.serverAddress"))+" ",1),C("span",KDe,N(p(n)("settings.serverAddressHint")),1)]),C("span",ZDe,N(p(k)),1)]),p(A).canCheck?(y(),M("div",GDe,[C("span",YDe,[qe(N(p(n)("settings.checkUpdate"))+" ",1),I.value?(y(),M("span",XDe,N(I.value),1)):(y(),M("span",JDe,N(p(n)("settings.checkUpdateHint")),1))]),j(p(Rt),{variant:"secondary",size:"sm",disabled:E.value,onClick:D},{default:me(()=>[qe(N(E.value?p(n)("settings.updateChecking"):p(n)("settings.checkUpdateBtn")),1)]),_:1},8,["disabled"])])):ee("",!0),p(A).canToggleAutoDownload?(y(),M("div",QDe,[C("span",eBe,[qe(N(p(n)("settings.autoDownloadUpdate"))+" ",1),C("span",tBe,N(p(n)("settings.autoDownloadUpdateHint")),1)]),j(p(ed),{"model-value":p(A).autoDownload.value,label:p(n)("settings.autoDownloadUpdate"),"onUpdate:modelValue":Oe[11]||(Oe[11]=Ge=>p(A).setAutoDownload(Ge))},null,8,["model-value","label"])])):ee("",!0)])]),e.config?(y(),M("section",nBe,[C("h3",oBe,N(p(n)("settings.privacy")),1),C("div",sBe,[C("div",iBe,[C("span",rBe,[qe(N(p(n)("settings.telemetry"))+" ",1),C("span",lBe,N(p(n)("settings.telemetryHint")),1),C("span",aBe,N(p(n)("settings.telemetryRestartHint")),1)]),j(p(ed),{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:p(n)("settings.telemetry"),"onUpdate:modelValue":Oe[12]||(Oe[12]=Ge=>ve())},null,8,["model-value","disabled","label"])])])])):ee("",!0),C("section",uBe,[C("h3",cBe,N(p(n)("settings.diagnostics")),1),C("div",dBe,[C("div",fBe,[C("span",pBe,[qe(N(p(n)("settings.exportLog"))+" ",1),C("span",hBe,N(p(n)("settings.exportLogHint")),1),p(Qr)()?ee("",!0):(y(),M("span",mBe,N(p(n)("settings.logHint")),1))]),j(p(Rt),{variant:"secondary",size:"sm",onClick:S},{default:me(()=>[qe(N(p(n)("settings.exportLogBtn")),1)]),_:1})])])])],512),[[qs,d.value==="advanced"]]),Bn(C("section",gBe,[C("div",vBe,[C("h4",yBe,N(p(n)("settings.archivedTitle")),1),C("p",kBe,N(p(n)("settings.archivedDesc")),1)]),C("div",bBe,[C("label",CBe,[Oe[17]||(Oe[17]=C("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[C("circle",{cx:"11",cy:"11",r:"7"}),C("path",{d:"m21 21-4.3-4.3"})],-1)),Bn(C("input",{"onUpdate:modelValue":Oe[13]||(Oe[13]=Ge=>ge.value=Ge),placeholder:p(n)("settings.archivedSearch")},null,8,wBe),[[ai,ge.value]])]),j(p(n3),{"model-value":Q.value,options:Se.value,size:"sm","aria-label":p(n)("settings.archivedAllWorkspaces"),"onUpdate:modelValue":Oe[14]||(Oe[14]=Ge=>Q.value=Ge)},null,8,["model-value","options","aria-label"]),j(p(wi),{size:"sm","model-value":te.value,options:[{value:"archived-desc",label:p(n)("settings.archivedSortArchived"),icon:"clock"},{value:"created-desc",label:p(n)("settings.archivedSortCreated"),icon:"calendar-schedule"},{value:"name-asc",label:p(n)("settings.archivedSortName"),icon:"sort"}],"onUpdate:modelValue":Oe[15]||(Oe[15]=Ge=>te.value=Ge)},null,8,["model-value","options"])]),fe.value?(y(),M("div",_Be,N(p(n)("settings.archivedLoadingAll")),1)):(y(),M(Pe,{key:1},[_e.value.length>0?(y(),M("div",xBe,[(y(!0),M(Pe,null,pt(_e.value,Ge=>(y(),M("section",{key:Ge.cwd,class:"archive-card"},[C("div",SBe,[j(p(Te),{name:"folder-closed",size:"md"}),C("span",ABe,N(Ge.cwd),1),C("span",MBe,N(p(n)("settings.archivedSessionsCount",{count:Ge.items.length})),1)]),C("div",TBe,[(y(!0),M(Pe,null,pt(Ge.items,at=>(y(),M("div",{key:at.id,class:"archive-row"},[C("div",EBe,[C("div",IBe,N(at.title),1),C("div",LBe,N(p(n)("settings.archivedAt",{time:it(at.updatedAt)})),1)]),j(p(Rt),{variant:"secondary",size:"sm",onClick:Tt=>Ee(at.id)},{default:me(()=>[j(p(Te),{name:"undo",size:"sm"}),C("span",null,N(p(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128))])]))),128))])):(y(),M("div",$Be,N(Y.value.length===0?p(n)("settings.archivedEmpty"):p(n)("settings.archivedNoMatch")),1))],64))],512),[[qs,d.value==="archived"]])],34)])],512)]),_:1},8,["aria-label"]))}}),RBe=ft(FBe,[["__scopeId","data-v-146a8c47"]]),OBe={class:"aw"},PBe={class:"crumbbar"},DBe={class:"crumbs"},BBe={key:0,class:"crumb-sep"},HBe=["onClick"],zBe={key:0,class:"filterbar"},WBe=["placeholder"],UBe={class:"folder-list"},jBe={key:0,class:"fl-loading"},VBe=["onClick"],qBe={class:"folder-name search-rel"},KBe={key:0,class:"fl-empty"},ZBe={key:1,class:"fl-loading"},GBe=["onClick"],YBe={class:"folder-name"},XBe={key:0,class:"fl-empty"},JBe={class:"paste-row"},QBe={class:"paste-input-wrap"},eHe={key:1,class:"add-error",role:"alert"},tHe={class:"actions"},nHe={class:"footer-hint"},oHe=600,sHe=6,_S=150,iHe=et({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!0),r=Z(!1),l=Z(!1),a=Z(""),u=Z(null),c=Z([]),d=Z(""),f=Z(!1),h=Z([]),m=R(()=>d.value.trim().length>0);let v=0,k=null;function w(U,z){const W=U.toLowerCase(),K=z.toLowerCase();let V=0;for(let ie=0;ie0&&ne=_S))break;X.depth+1{if(k&&clearTimeout(k),U.trim()===""){v++,h.value=[],f.value=!1;return}k=setTimeout(()=>void b(U),220)});const _=Z(!1),g=Z(""),x=R(()=>g.value.trim()),S=R(()=>{const U=a.value;if(!U)return[];const z=U.split("/").filter(Boolean),W=[{label:"/",path:"/"}];let K="";for(const V of z)K+=`/${V}`,W.push({label:V,path:K});return W}),T=R(()=>a.value.length>0);async function A(U){r.value=!0;try{const z=await o.browseFs(U);if(!z.path){l.value=!0;return}a.value=z.path,u.value=z.parent,c.value=z.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function E(U){U.isDir&&A(U.path)}function P(){u.value&&A(u.value)}function D(){T.value&&s("add",a.value)}function I(){x.value.length!==0&&s("add",x.value)}const{handleCompositionStart:$,handleCompositionEnd:B,isComposingKeyEvent:H}=Ar();function O(U){H(U)||I()}function F(U){U.key==="Escape"&&H(U)&&U.stopPropagation()}return dn(async()=>{r.value=!0;try{if(o.defaultPath&&(await A(o.defaultPath),!l.value))return;const U=await o.getFsHome();U.home?await A(U.home):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),bn(()=>{k&&clearTimeout(k)}),(U,z)=>(y(),he(p(ua),{open:i.value,"onUpdate:open":z[5]||(z[5]=W=>i.value=W),title:p(n)("workspace.addTitle"),size:"lg",height:"fixed",padded:!1,onClose:z[6]||(z[6]=W=>s("close"))},{default:me(()=>[C("div",OBe,[l.value?ee("",!0):(y(),M(Pe,{key:0},[C("div",PBe,[j(p(gn),{size:"sm",disabled:!u.value,label:p(n)("workspace.up"),tooltip:p(n)("workspace.up"),onClick:P},{default:me(()=>[j(p(Te),{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label","tooltip"]),C("div",DBe,[(y(!0),M(Pe,null,pt(S.value,(W,K)=>(y(),M(Pe,{key:W.path},[K>1?(y(),M("span",BBe,"/")):ee("",!0),C("button",{class:Re(["crumb",{last:K===S.value.length-1}]),onClick:V=>A(W.path)},N(W.label),11,HBe)],64))),128))])]),r.value?ee("",!0):(y(),M("div",zBe,[j(p(Te),{class:"filter-icon",name:"search",size:"md"}),Bn(C("input",{"onUpdate:modelValue":z[0]||(z[0]=W=>d.value=W),class:"filter-input",type:"text",placeholder:p(n)("workspace.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:z[1]||(z[1]=It(()=>{},["stop"]))},null,40,WBe),[[ai,d.value]]),f.value?(y(),he(p(Ao),{key:0,size:"sm"})):ee("",!0)])),C("div",UBe,[r.value?(y(),M("div",jBe,N(p(n)("workspace.browsing")),1)):m.value?(y(),M(Pe,{key:1},[(y(!0),M(Pe,null,pt(h.value,W=>(y(),M("button",{key:W.path,class:"folder-row",onClick:K=>A(W.path)},[j(p(Te),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",qBe,N(W.rel),1)],8,VBe))),128)),!f.value&&h.value.length===0?(y(),M("div",KBe,N(p(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):f.value&&h.value.length===0?(y(),M("div",ZBe,N(p(n)("workspace.searching")),1)):ee("",!0)],64)):(y(),M(Pe,{key:2},[(y(!0),M(Pe,null,pt(c.value,W=>(y(),M("button",{key:W.path,class:"folder-row",onClick:K=>E(W)},[j(p(Te),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",YBe,N(W.name),1)],8,GBe))),128)),c.value.length===0?(y(),M("div",XBe,N(p(n)("workspace.noSubfolders")),1)):ee("",!0)],64))])],64)),C("div",{class:Re(["paste-section",{"paste-only":l.value}])},[!l.value&&!_.value?(y(),he(p(Rt),{key:0,variant:"ghost",size:"sm",onClick:z[2]||(z[2]=W=>_.value=!0)},{default:me(()=>[qe(N(p(n)("workspace.pasteToggle")),1)]),_:1})):(y(),he(p(IW),{key:1,label:p(n)("workspace.pathLabel")},{default:me(()=>[C("div",JBe,[C("div",QBe,[j(p(js),{modelValue:g.value,"onUpdate:modelValue":z[3]||(z[3]=W=>g.value=W),placeholder:p(n)("workspace.pathPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:[xl(It(O,["stop"]),["enter"]),F],onCompositionstart:p($),onCompositionend:p(B)},null,8,["modelValue","placeholder","onKeydown","onCompositionstart","onCompositionend"])]),j(p(gn),{disabled:x.value.length===0,label:p(n)("workspace.add"),tooltip:p(n)("workspace.add"),onClick:I},{default:me(()=>[j(p(Te),{name:"plus",size:"md"})]),_:1},8,["disabled","label","tooltip"])])]),_:1},8,["label"]))],2),e.error?(y(),M("div",eHe,N(e.error),1)):ee("",!0),C("div",tHe,[j(p(pn),{text:a.value},{default:me(()=>[l.value?ee("",!0):(y(),he(p(Rt),{key:0,variant:"primary",disabled:!T.value,onClick:D},{default:me(()=>[qe(N(p(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),j(p(Rt),{variant:"secondary",onClick:z[4]||(z[4]=W=>s("close"))},{default:me(()=>[qe(N(p(n)("workspace.cancel")),1)]),_:1})]),C("div",nHe,N(p(n)("workspace.browseHint")),1)])]),_:1},8,["open","title"]))}}),rHe=ft(iHe,[["__scopeId","data-v-fea98be5"]]),lHe={key:0,class:"confirm-dialog__message"},aHe=et({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt();function i(){n.loading||(o("update:open",!1),o("cancel"))}function r(l){if(l.key!=="Enter"||!n.open||n.loading)return;const a=l.target;a instanceof HTMLButtonElement||a instanceof HTMLAnchorElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLInputElement||(l.preventDefault(),o("confirm"))}return typeof window<"u"&&window.addEventListener("keydown",r),Vn(()=>{typeof window<"u"&&window.removeEventListener("keydown",r)}),(l,a)=>(y(),he(p(ua),{open:e.open,title:e.title,height:"auto","initial-focus":".confirm-dialog__confirm","close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":a[1]||(a[1]=u=>o("update:open",u)),onClose:i},{foot:me(()=>[j(p(Rt),{variant:"secondary",disabled:e.loading,onClick:i},{default:me(()=>[qe(N(e.cancelLabel??p(s)("common.cancel")),1)]),_:1},8,["disabled"]),j(p(Rt),{class:"confirm-dialog__confirm",variant:e.variant,loading:e.loading,onClick:a[0]||(a[0]=u=>o("confirm"))},{default:me(()=>[qe(N(e.confirmLabel??p(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:me(()=>[e.message?(y(),M("p",lHe,N(e.message),1)):ee("",!0)]),_:1},8,["open","title","close-on-esc","close-on-overlay"]))}}),uHe=ft(aHe,[["__scopeId","data-v-aa5422da"]]),cHe=et({__name:"ConfirmDialogHost",setup(e){const{current:t,busy:n,settle:o,runAction:s}=hu();function i(){s()}return(r,l)=>p(t)!==null?(y(),he(uHe,{key:0,open:!0,title:p(t).title,message:p(t).message,"confirm-label":p(t).confirmLabel,"cancel-label":p(t).cancelLabel,variant:p(t).variant,loading:p(n),onConfirm:i,onCancel:l[0]||(l[0]=a=>p(o)(!1))},null,8,["title","message","confirm-label","cancel-label","variant","loading"])):ee("",!0)}}),dHe={class:"rows"},fHe={class:"row"},pHe={class:"row"},hHe={class:"row"},mHe={class:"row"},gHe={class:"row"},vHe={class:"row"},yHe={class:"ctx-text"},kHe={key:0,class:"bar"},bHe={class:"row"},CHe=et({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!0),r=R(()=>o.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100)))),l=R(()=>o.status.ctxMax>0?n("status.statusContextValue",{used:Al(o.status.ctxUsed),max:Al(o.status.ctxMax),pct:r.value}):n("status.statusNone"));function a(m){return n(m==="yolo"?"status.permissionYolo":m==="auto"?"status.permissionAuto":"status.permissionManual")}const u=R(()=>{const m=o.status.permission;return m==="auto"?"var(--color-danger)":m==="yolo"?"var(--color-warning)":"var(--color-text)"}),c=R(()=>o.planMode?n("status.planOn"):n("status.planOff")),d=R(()=>o.swarmMode?n("status.swarmOn"):n("status.swarmOff")),f=R(()=>typeof o.costUsd=="number"&&o.costUsd>0),h=R(()=>f.value?`$${o.costUsd.toFixed(4)}`:n("status.statusNone"));return(m,v)=>(y(),he(p(ua),{open:i.value,"onUpdate:open":v[0]||(v[0]=k=>i.value=k),title:p(n)("status.statusPanelTitle"),onClose:v[1]||(v[1]=k=>s("close"))},{default:me(()=>[C("dl",dHe,[C("div",fHe,[C("dt",null,N(p(n)("status.statusModel")),1),C("dd",null,N(e.status.model),1)]),C("div",pHe,[C("dt",null,N(p(n)("status.statusThinking")),1),C("dd",null,N(e.thinking),1)]),C("div",hHe,[C("dt",null,N(p(n)("status.statusPermission")),1),C("dd",{style:Zt({color:u.value})},N(a(e.status.permission)),5)]),C("div",mHe,[C("dt",null,N(p(n)("status.statusPlanMode")),1),C("dd",{class:Re({"plan-on":e.planMode})},N(c.value),3)]),C("div",gHe,[C("dt",null,N(p(n)("status.statusSwarmMode")),1),C("dd",{class:Re({"swarm-on":e.swarmMode})},N(d.value),3)]),C("div",vHe,[C("dt",null,N(p(n)("status.statusContext")),1),C("dd",null,[C("span",yHe,N(l.value),1),e.status.ctxMax>0?(y(),M("span",kHe,[C("i",{style:Zt({width:r.value+"%"})},null,4)])):ee("",!0)])]),C("div",bHe,[C("dt",null,N(p(n)("status.statusCost")),1),C("dd",null,N(h.value),1)])])]),_:1},8,["open","title"]))}}),wHe=ft(CHe,[["__scopeId","data-v-340d1b31"]]),_He={key:0,class:"actions"},xHe=["onClick"],SHe=["onClick"],AHe={key:1,class:"details"},MHe=et({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt();function i(E){return typeof E=="object"&&E!==null}function r(E){return i(E)?E.title:E}function l(E){return i(E)?E.message??"":""}function a(E){return i(E)?E.details:void 0}function u(E){return i(E)?E.severity==="error":E.startsWith(`${s("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(E)}function c(E){return i(E)?E.severity==="error"?"danger":E.severity==="success"?"success":E.severity==="info"?"info":"warning":u(E)?"danger":"warning"}function d(E){return i(E)?`notice:${E.severity}:${E.title}:${E.message??""}:${JSON.stringify(E.details??[])}`:`text:${E}`}function f(E){if(!i(E))return E;const P=[E.title];E.message&&P.push(E.message);const D=E.details??[];if(D.length>0){P.push("",`${s("warnings.diagnostics")}:`);for(const I of D)P.push(`${I.label}: ${I.value}`)}return P.join(` +`),n.member.summary]){const S=x?.trim();!S||_.has(S)||(_.add(S),g.push(S))}return g});Ln("pinScroll",()=>{r.value&&u()});function v(_){switch(_){case"queued":return s("tools.swarm.phaseQueued");case"working":return s("tools.swarm.phaseWorking");case"suspended":return s("tools.swarm.phaseSuspended");case"completed":return s("tools.swarm.phaseCompleted");case"failed":return s("tools.swarm.phaseFailed")}}const k=nn("modelDisplay"),w=nn("subagentEffort"),b=R(()=>{const _=[n.member.subagentType,k?.(n.member.model),w?.(n.member.thinkingEffort)].filter(g=>!!g);return _.length>0?_.join(" · "):void 0});return(_,g)=>(y(),M("div",bNe,[j(p(pc),{title:e.member.name,subtitle:b.value,"close-label":p(s)("thinking.close"),onClose:g[0]||(g[0]=x=>o("close"))},{default:me(()=>[j(p(Vr),{variant:"neutral",size:"sm"},{default:me(()=>[qe(N(v(e.member.phase)),1)]),_:1})]),_:1},8,["title","subtitle","close-label"]),C("div",{ref_key:"scroller",ref:r,class:"agent-transcript",onScrollPassive:g[6]||(g[6]=(...x)=>p(a)&&p(a)(...x))},[c.value?(y(),M(Pe,{key:0},[e.turns.length===0&&!e.loading&&(e.loadError||m.value.length>0)?(y(),M("div",CNe,[e.loadError?(y(),M("div",wNe,N(p(s)("tasks.transcriptLoadError")),1)):ee("",!0),m.value.length>0?(y(),he(dr,{key:1,lines:m.value},null,8,["lines"])):ee("",!0)])):(y(),he(e6,{key:1,turns:e.turns,"turn-active":e.running,"session-loading":e.loading&&e.turns.length===0,"has-more-messages":e.hasMore,"loading-more":e.loadingMore,"loading-more-error":e.loadMoreError,"is-following":p(l),"read-only":"",onLoadOlderMessages:g[1]||(g[1]=x=>o("loadOlderMessages")),onOpenAgent:g[2]||(g[2]=x=>o("openAgent",x)),onOpenFile:g[3]||(g[3]=x=>o("openFile",x)),onOpenMedia:g[4]||(g[4]=x=>o("openMedia",x)),onOpenTurnDiff:g[5]||(g[5]=x=>o("openTurnDiff",x))},null,8,["turns","turn-active","session-loading","has-more-messages","loading-more","loading-more-error","is-following"]))],64)):ee("",!0)],544)]))}}),xNe=ft(_Ne,[["__scopeId","data-v-95fdb6f0"]]),SNe={class:"sc"},ANe={key:0,class:"sc-empty"},MNe={key:2,class:"sc-loading"},TNe={class:"sc-composer"},ENe=["placeholder"],INe=["disabled"],LNe=et({__name:"SideChatPanel",props:{turns:{},running:{type:Boolean},sending:{type:Boolean},title:{},subtitle:{}},emits:["send","close","openMedia"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=R(()=>n.turns.find(x=>x.role==="user")?.text?.trim()??""),r=R(()=>n.title?.trim()||s("sideChat.title")),l=R(()=>n.subtitle?.trim()?n.subtitle.trim():i.value||s("sideChat.subtitle")),a=Z(""),u=Z(null),c=Z(null);function d(){const g=a.value.trim();g&&(o("send",g),a.value="",yt(()=>{u.value&&(u.value.style.height="auto"),f()}))}function f(){const g=c.value;g&&(g.scrollTop=g.scrollHeight)}Ln("pinScroll",g=>{const x=c.value;if(!x)return;const S=g.getBoundingClientRect().top;requestAnimationFrame(()=>{x.scrollTop+=g.getBoundingClientRect().top-S})});const h=R(()=>{const g=n.turns;if(g.length===0)return"0";const x=g.at(-1),S=x.thinking?.length??0,T=x.tools?.reduce((A,E)=>A+E.name.length+(E.arg?.length??0)+(E.output?.join("").length??0),0)??0;return`${g.length}:${x.text.length}:${S}:${T}`});Je(h,async()=>{!n.running&&!n.sending||(await yt(),f())});const m=R(()=>n.sending?n.turns.at(-1)?.role==="user":!1),{handleCompositionStart:v,handleCompositionEnd:k,isComposingKeyEvent:w}=Ar();function b(g){g.key==="Enter"&&!g.shiftKey&&!w(g)&&(g.preventDefault(),d())}function _(){const g=u.value;g&&(g.style.height="auto",g.style.height=`${Math.min(g.scrollHeight,160)}px`)}return(g,x)=>(y(),M("div",SNe,[j(p(pc),{title:r.value,subtitle:l.value,"close-label":p(s)("thinking.close"),onClose:x[0]||(x[0]=S=>o("close"))},null,8,["title","subtitle","close-label"]),C("div",{ref_key:"bodyRef",ref:c,class:"sc-body"},[e.turns.length===0?(y(),M("div",ANe,N(p(s)("sideChat.empty")),1)):(y(),he(e6,{key:1,turns:e.turns,approvals:[],"turn-active":e.running,working:e.sending||e.running,"turn-files-interactive":!1,onOpenMedia:x[1]||(x[1]=S=>o("openMedia",S))},null,8,["turns","turn-active","working"])),m.value?(y(),M("div",MNe,[j(aF,{label:p(s)("conversation.requesting")},null,8,["label"])])):ee("",!0)],512),C("div",TNe,[Bn(C("textarea",{ref_key:"inputRef",ref:u,"onUpdate:modelValue":x[2]||(x[2]=S=>a.value=S),class:"sc-input",rows:"1",placeholder:p(s)("sideChat.placeholder"),onInput:_,onKeydown:b,onCompositionstart:x[3]||(x[3]=(...S)=>p(v)&&p(v)(...S)),onCompositionend:x[4]||(x[4]=(...S)=>p(k)&&p(k)(...S))},null,40,ENe),[[ai,a.value]]),j(p(pn),{text:p(s)("sideChat.send")},{default:me(()=>[C("button",{type:"button",class:"sc-send",disabled:!a.value.trim(),onClick:d},[j(p(Te),{name:"arrow-right",size:"sm"})],8,INe)]),_:1},8,["text"])])]))}}),$Ne=ft(LNe,[["__scopeId","data-v-753d11f0"]]),NNe={class:"changes-pane"},FNe={class:"dv-path"},RNe={class:"diff-head"},ONe={class:"back-label"},PNe={key:"loading",class:"empty-state diff-loading"},DNe={key:"lines",class:"dv-lines-wrap"},BNe={key:"empty",class:"empty-state"},HNe={class:"dv-change-count"},zNe={class:"ch-head"},WNe={class:"br-heading"},UNe={class:"br-label"},jNe={class:"br-name"},VNe={key:0,class:"sync-info"},qNe={key:0,class:"ahead"},KNe={key:0,class:"behind"},ZNe={key:1,class:"empty-head"},GNe={class:"ch-list-content"},YNe=["onClick"],XNe={class:"fpath"},JNe=["onClick"],QNe={class:"tree-name"},eFe=["onClick"],tFe={class:"tree-name"},nFe={key:2,class:"empty-state"},oFe={class:"empty-state-icon","aria-hidden":"true"},sFe={key:3,class:"empty-state"},iFe=et({__name:"DiffView",props:{changes:{},gitInfo:{},fileDiff:{},fullTexts:{},emptyFile:{type:Boolean},selectedDiffPath:{},fileDiffLoading:{type:Boolean},mode:{default:"full"},hideBack:{type:Boolean,default:!1},closable:{type:Boolean,default:!0}},emits:["open","back","close"],setup(e,{emit:t}){const{t:n}=Nt();function o($){return n($===1?"diff.fileCountOne":"diff.fileCountOther",{number:$})}const s=e,i=t;function r($){const B=$.toLowerCase();return B==="modified"?"modified":B==="added"?"added":B==="deleted"?"deleted":B==="renamed"?"renamed":B==="untracked"?"untracked":B==="conflicted"?"conflicted":B==="ignored"?"ignored":B==="clean"?"clean":"unknown"}const l={modified:"M",added:"+",deleted:"−",renamed:"→",untracked:"+",conflicted:"C",ignored:"I",clean:"·",unknown:"?"};function a($){return l[r($)]??"?"}function u($,B=60){return $.length<=B?$:"…"+$.slice($.length-B+1)}const c=R(()=>s.gitInfo!==null),d=R(()=>s.changes.length>0),f=R(()=>(s.selectedDiffPath??null)!==null),h=R(()=>s.mode==="detail"||s.mode==="full"&&f.value),m=R(()=>s.fileDiff??[]),v=R(()=>s.fileDiffLoading===!0);function k($){i("open",$)}function w(){i("back")}function b(){i("close")}const _=Z("list");function g($){_.value=$}function x($){const B={children:[]},H=[...$].sort((O,F)=>O.path.localeCompare(F.path));for(const O of H){const F=O.path.endsWith("/"),U=O.path.split("/").filter(Boolean);if(U.length===0)continue;let z=B;for(let W=0;WX.name===K&&X.kind===(V?"file":"folder"));ne||(ne={name:K,path:ie,kind:V?"file":"folder",status:V?O.status:void 0,children:[]},z.children.push(ne)),z=ne}}return B.children}const S=R(()=>x(s.changes)),T=Z(new Set);function A($){return!T.value.has($)}const E=R(()=>{const $=[];function B(H,O){for(const F of H)$.push({node:F,depth:O}),F.kind==="folder"&&A(F.path)&&B(F.children,O+1)}return B(S.value,0),$});function P($){const B=new Set(T.value);B.has($.path)?B.delete($.path):B.add($.path),T.value=B}function D($){return`calc(var(--tree-base-indent) + ${$} * var(--tree-indent-step))`}function I($){return{paddingLeft:D($),"--tree-depth":String($)}}return($,B)=>(y(),M("div",NNe,[h.value?(y(),M(Pe,{key:0},[j(p(pc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:b},{default:me(()=>[j(p(pn),{text:e.selectedDiffPath??""},{default:me(()=>[C("span",FNe,N(u(e.selectedDiffPath??"",50)),1)]),_:1},8,["text"])]),_:1},8,["title","closable","close-label"]),C("div",RNe,[e.hideBack?ee("",!0):(y(),he(p(Rt),{key:0,variant:"ghost",size:"sm",onClick:w},{default:me(()=>[j(p(Te),{name:"arrow-left",size:"sm"}),C("span",ONe,N(p(n)("diff.back")),1)]),_:1}))]),j(as,{name:"diff-content",mode:"out-in"},{default:me(()=>[v.value?(y(),M("div",PNe,[j(p(Ao),{size:"md"}),C("span",null,N(p(n)("diff.loading")),1)])):m.value.length>0?(y(),M("div",DNe,[j(Ur,{lines:m.value,path:e.selectedDiffPath??void 0,"line-numbers":"",framed:!1,"full-texts":e.fullTexts??null},null,8,["lines","path","full-texts"])])):(y(),M("div",BNe,N(e.emptyFile?p(n)("diff.emptyFile"):p(n)("diff.noDiff")),1))]),_:1})],64)):(y(),M(Pe,{key:1},[j(p(pc),{title:p(n)("diff.title"),closable:e.closable,"close-label":p(n)("diff.close"),onClose:b},{default:me(()=>[C("span",HNe,N(o(e.changes.length)),1),j(p(wi),{"model-value":_.value,size:"sm",options:[{value:"list",label:p(n)("diff.list"),icon:"list"},{value:"tree",label:p(n)("diff.tree"),icon:"tree-view"}],"onUpdate:modelValue":g},null,8,["model-value","options"])]),_:1},8,["title","closable","close-label"]),C("div",zNe,[c.value?(y(),M(Pe,{key:0},[C("span",WNe,[j(p(Te),{class:"br-icon",name:"git-fork",size:"sm"}),C("span",UNe,N(p(n)("diff.branch")),1)]),C("span",jNe,N(e.gitInfo.branch),1),e.gitInfo.ahead>0||e.gitInfo.behind>0?(y(),M("span",VNe,[j(p(pn),{text:p(n)("diff.aheadTitle")},{default:me(()=>[e.gitInfo.ahead>0?(y(),M("span",qNe,"↑"+N(e.gitInfo.ahead),1)):ee("",!0)]),_:1},8,["text"]),j(p(pn),{text:p(n)("diff.behindTitle")},{default:me(()=>[e.gitInfo.behind>0?(y(),M("span",KNe,"↓"+N(e.gitInfo.behind),1)):ee("",!0)]),_:1},8,["text"])])):ee("",!0)],64)):(y(),M("span",ZNe,N(p(n)("diff.empty")),1))]),d.value&&_.value==="list"?(y(),he(p(Pk),{key:0,class:"ch-list"},{default:me(()=>[C("div",GNe,[(y(!0),M(Pe,null,pt(e.changes,H=>(y(),he(p(pn),{key:H.path,text:H.path},{default:me(()=>[C("button",{type:"button",class:"ch-row",onClick:O=>k(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",XNe,N(u(H.path)),1)],8,YNe)]),_:2},1032,["text"]))),128))])]),_:1})):d.value&&_.value==="tree"?(y(),he(p(Pk),{key:1,class:"ch-list ch-tree"},{default:me(()=>[j(YA,{name:"tree-collapse",tag:"ul",class:"tree-list ch-list-content"},{default:me(()=>[(y(!0),M(Pe,null,pt(E.value,({node:H,depth:O})=>(y(),M("li",{key:H.path,class:"tree-node"},[H.kind==="folder"?(y(),M("button",{key:0,type:"button",class:"tree-row tree-folder",style:Zt(I(O)),onClick:F=>P(H)},[j(p(Te),{class:"tree-icon",name:"folder-solid",size:"sm"}),C("span",QNe,N(H.name),1)],12,JNe)):(y(),he(p(pn),{key:1,text:H.path},{default:me(()=>[C("button",{type:"button",class:"tree-row tree-file",style:Zt(I(O)),onClick:F=>k(H.path)},[C("span",{class:Re(["badge",r(H.status)])},N(a(H.status)),3),C("span",tFe,N(H.name),1)],12,eFe)]),_:2},1032,["text"]))]))),128))]),_:1})]),_:1})):c.value?(y(),M("div",nFe,[C("span",oFe,[j(p(Te),{name:"check",size:"lg"})]),qe(" "+N(p(n)("diff.clean")),1)])):(y(),M("div",sFe,N(p(n)("diff.empty")),1))],64))]))}}),rFe=ft(iFe,[["__scopeId","data-v-7d5ab9c7"]]),lFe={class:"td"},aFe={class:"td-path"},uFe={class:"td-body"},cFe={key:1,class:"td-empty"},dFe=et({__name:"TurnDiffPanel",props:{change:{},cwd:{},closable:{type:Boolean}},emits:["close","openFile"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=R(()=>{const a=n.cwd?h2(n.change.path,n.cwd):null;return r(a??n.change.path)});function r(a,u=48){return!a||a.length<=u?a:"…"+a.slice(a.length-u+1)}const l=R(()=>n.change.diff!==null&&n.change.diff.length>0);return(a,u)=>(y(),M("div",lFe,[j(p(pc),{title:p(s)("conversation.turnFiles.diffTitle"),closable:e.closable,"close-label":p(s)("filePreview.close"),onClose:u[1]||(u[1]=c=>o("close"))},{default:me(()=>[j(p(pn),{text:e.change.path},{default:me(()=>[C("span",aFe,N(i.value),1)]),_:1},8,["text"]),j(p(gn),{size:"sm",label:p(s)("conversation.turnFiles.openFile"),tooltip:p(s)("conversation.turnFiles.openFile"),onClick:u[0]||(u[0]=c=>o("openFile",e.change.path))},{default:me(()=>[j(p(Te),{name:"external-link",size:"md"})]),_:1},8,["label","tooltip"])]),_:1},8,["title","closable","close-label"]),C("div",uFe,[l.value?(y(),he(Ur,{key:0,lines:e.change.diff,path:e.change.path,framed:!1},null,8,["lines","path"])):(y(),M("div",cFe,[C("p",null,N(p(s)("conversation.turnFiles.diffUnavailable")),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:u[2]||(u[2]=c=>o("openFile",e.change.path))},{default:me(()=>[qe(N(p(s)("conversation.turnFiles.openFile")),1)]),_:1})]))])]))}}),fFe=ft(dFe,[["__scopeId","data-v-fdd0bc05"]]);function gF(e,t){let n=null;dn(()=>{n=typeof document<"u"&&document.activeElement instanceof HTMLElement?document.activeElement:null,yt(()=>{const o=t?.value??e.value;try{o?.focus()}catch{}})}),Vn(()=>{const o=n;if(n=null,!(!o||typeof document>"u"||!document.contains(o)))try{o.focus()}catch{}})}const pFe={class:"search-wrap"},hFe=["aria-label"],mFe=["aria-label"],gFe=["aria-pressed","onClick"],vFe={key:1,class:"state-row"},yFe={key:2,class:"state-row unavail"},kFe=["aria-label"],bFe=["aria-selected","onClick","onMouseenter"],CFe={class:"model-main"},wFe={class:"model-name"},_Fe={class:"model-meta"},xFe={class:"model-side"},SFe={key:0,class:"empty"},AFe={class:"footer-hint","aria-hidden":"true"},MFe=et({__name:"ModelPicker",props:{models:{},current:{},starredIds:{},loading:{type:Boolean},unavailable:{type:Boolean}},emits:["select","toggle-star","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R(()=>new Set(o.starredIds??[]));function r(D){return i.value.has(D)}const l=Z(""),a=Z(null),u=Z(null),c=Z(null),d=Z("all"),f={image_in:"model.capabilityImageInput",video_in:"model.capabilityVideoInput",tool_use:"model.capabilityToolUse",thinking:"model.capabilityThinking",always_thinking:"model.capabilityAlwaysThinking"};function h(D){const I=f[D];return I?n(I):D.replaceAll("_"," ")}function m(D){const I=[D.provider,n("model.contextSuffix",{size:Al(D.maxContextSize)})];for(const $ of D.capabilities??[])I.push(h($));return I.join(" · ")}gF(u,a);const v=R(()=>{const D=new Set,I=[{id:"all",label:n("model.allTab")}];for(const $ of o.models)D.has($.provider)||(D.add($.provider),I.push({id:$.provider,label:$.provider}));return I}),k=R(()=>{const D=l.value.toLowerCase().trim(),I=o.models.filter($=>{if(d.value!=="all"&&$.provider!==d.value)return!1;const B=($.displayName??$.model).toLowerCase().includes(D),H=$.provider.toLowerCase().includes(D),O=$.id.toLowerCase().includes(D);return!D||B||H||O});return d.value!=="all"?I:I.sort(($,B)=>{const H=r($.id)?1:0;return(r(B.id)?1:0)-H})}),w=R(()=>k.value),b=Z(0);Je([l,d],()=>{b.value=0}),Je(v,D=>{D.some(I=>I.id===d.value)||(d.value="all")}),Je(w,D=>{b.value=Math.min(b.value,Math.max(D.length-1,0))}),Je(b,async()=>{await yt(),c.value?.querySelector(".model-row.is-selected")?.scrollIntoView({block:"nearest"})});const{handleCompositionStart:_,handleCompositionEnd:g,isComposingKeyEvent:x}=Ar();function S(D){if(!x(D)){if(D.key==="Escape"){s("close");return}if(D.key==="ArrowDown")D.preventDefault(),b.value=Math.min(b.value+1,w.value.length-1);else if(D.key==="ArrowUp")D.preventDefault(),b.value=Math.max(b.value-1,0);else if(D.key==="Enter"){const I=w.value[b.value];I&&s("select",I.id)}}}dn(()=>{document.addEventListener("keydown",S)}),bn(()=>{document.removeEventListener("keydown",S)});function T(D){s("select",D)}function A(){l.value="",a.value?.focus()}function E(D){return w.value.indexOf(D)}function P(D){d.value=D}return(D,I)=>(y(),he(p(ua),{open:!0,"close-on-esc":!1,title:p(n)("model.title"),size:"lg",height:"fixed",padded:!1,onClose:I[1]||(I[1]=$=>s("close"))},{default:me(()=>[C("div",{ref_key:"dialogRef",ref:u,class:"mp"},[C("div",pFe,[j(p(js),{ref_key:"searchRef",ref:a,modelValue:l.value,"onUpdate:modelValue":I[0]||(I[0]=$=>l.value=$),placeholder:p(n)("model.searchPlaceholder"),autocomplete:"off",spellcheck:"false",autofocus:"",onCompositionstart:p(_),onCompositionend:p(g)},null,8,["modelValue","placeholder","onCompositionstart","onCompositionend"]),j(p(pn),{text:p(n)("model.clearSearch")},{default:me(()=>[C("button",{type:"button",class:Re(["search-clear",{"is-on":l.value.length>0}]),tabindex:"-1","aria-label":p(n)("model.clearSearch"),onClick:A},[j(p(Te),{name:"close",size:"sm"})],10,hFe)]),_:1},8,["text"])]),v.value.length>1?(y(),M("div",{key:0,class:"chip-strip","aria-label":p(n)("model.providerTabs")},[(y(!0),M(Pe,null,pt(v.value,$=>(y(),M("button",{key:$.id,type:"button",class:Re(["chip",{"is-active":$.id===d.value}]),"aria-pressed":$.id===d.value,onClick:B=>P($.id)},N($.label),11,gFe))),128))],8,mFe)):ee("",!0),e.loading?(y(),M("div",vFe,[j(p(Ao),{size:"sm"}),C("span",null,N(p(n)("model.loading")),1)])):e.unavailable?(y(),M("div",yFe,[j(p(Te),{name:"alert-triangle",size:"lg"}),C("span",null,N(p(n)("model.unavailable")),1)])):(y(),M("div",{key:3,ref_key:"listRef",ref:c,class:"model-list",role:"listbox","aria-label":p(n)("model.title")},[(y(!0),M(Pe,null,pt(w.value,$=>(y(),M("div",{key:$.id,class:Re(["model-row",{"is-current":$.id===e.current,"is-selected":E($)===b.value}]),role:"option","aria-selected":$.id===e.current,onClick:B=>T($.id),onMouseenter:B=>b.value=E($)},[C("span",CFe,[C("span",wFe,N($.displayName??$.model),1),C("span",_Fe,N(m($)),1)]),C("span",xFe,[$.id===e.current?(y(),he(p(Te),{key:0,class:"model-check",name:"check",size:"sm"})):ee("",!0),j(p(gn),{class:Re(["model-star",{"is-starred":r($.id)}]),size:"sm",label:r($.id)?p(n)("model.unstarTitle"):p(n)("model.starTitle"),tooltip:r($.id)?p(n)("model.unstarTitle"):p(n)("model.starTitle"),onClick:It(B=>s("toggle-star",$.id),["stop"])},{default:me(()=>[r($.id)?(y(),he(p(Te),{key:0,name:"star",size:"md"})):(y(),he(p(Te),{key:1,name:"star-outline",size:"md"}))]),_:2},1032,["class","label","tooltip","onClick"])])],42,bFe))),128)),w.value.length===0?(y(),M("div",SFe,N(o.models.length===0?p(n)("model.emptyNoModels"):p(n)("model.emptyNoMatch")),1)):ee("",!0)],8,kFe)),C("div",AFe,[j(p(oa),{keys:["↑","↓"]}),C("span",null,N(p(n)("model.hintNavigate")),1),I[2]||(I[2]=C("span",{class:"hint-dot"},"·",-1)),j(p(oa),{keys:["Enter"]}),C("span",null,N(p(n)("model.hintSelect")),1),I[3]||(I[3]=C("span",{class:"hint-dot"},"·",-1)),j(p(oa),{keys:["Esc"]}),C("span",null,N(p(n)("model.hintClose")),1)])],512)]),_:1},8,["title"]))}}),TFe=ft(MFe,[["__scopeId","data-v-3ba22330"]]),EFe=3;function vF(e){const t=Z("starting"),n=Z(!1),o=Z(null),s=Z(0);let i=null,r=null,l=null,a=0,u=!1,c=!1;function d(){i&&(clearTimeout(i),i=null),r&&(clearInterval(r),r=null),l&&(clearTimeout(l),l=null)}function f(w){d(),t.value="success",l=setTimeout(()=>{l=null,e.onSuccess?.()},w)}function h(){r&&clearInterval(r),r=setInterval(()=>{s.value>0?s.value--:(r&&clearInterval(r),r=null)},1e3)}function m(w){i&&clearTimeout(i),i=setTimeout(async()=>{const b=await e.onPollOAuthLogin();if(!c){if(b===null){if(a+=1,a>=EFe){d(),n.value=!0,t.value="error";return}m(w);return}a=0,b.status==="authenticated"?f(1200):b.status==="expired"||b.status==="cancelled"?(d(),t.value="expired"):m(w)}},w*1e3)}async function v(){d(),o.value=null,n.value=!1,a=0,u=!1,t.value="starting";const w=await e.onStartOAuthLogin();if(c){w!==null&&w.status!=="authenticated"&&e.onCancelOAuthLogin();return}if(!w){t.value="error";return}if(w.status==="authenticated"){f(800);return}o.value={flowId:w.flowId,verificationUri:w.verificationUri,verificationUriComplete:w.verificationUriComplete,userCode:w.userCode,expiresIn:w.expiresIn,interval:w.interval},s.value=w.expiresIn,t.value="device-code",h(),m(w.interval)}function k(){t.value!=="success"&&(d(),t.value==="device-code"&&!u&&(u=!0,e.onCancelOAuthLogin()))}return Kg()&&d1(()=>{c=!0,k()}),{step:t,pollError:n,flow:o,secondsLeft:s,startFlow:v,cancelFlow:k}}const IFe={key:0,class:"center-body"},LFe={class:"center-text"},$Fe={key:1,class:"nb"},NFe={class:"nb-lead"},FFe=["href"],RFe={class:"nb-code-row"},OFe=["title"],PFe={class:"nb-status"},DFe={class:"nb-status-text"},BFe={class:"nb-countdown"},HFe={key:2,class:"center-body"},zFe={class:"center-text success-text"},WFe={class:"center-hint"},UFe={class:"center-body"},jFe={class:"center-text err-text"},VFe={class:"center-hint"},qFe={class:"actions"},KFe={class:"center-body"},ZFe={class:"center-text warn-text"},GFe={class:"center-hint"},YFe={class:"actions"},XFe=et({__name:"LoginDialog",props:{onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=Z(!0),s=t,i=e,{step:r,pollError:l,flow:a,secondsLeft:u,startFlow:c,cancelFlow:d}=vF({onStartOAuthLogin:i.onStartOAuthLogin,onPollOAuthLogin:i.onPollOAuthLogin,onCancelOAuthLogin:i.onCancelOAuthLogin,onSuccess:()=>{s("success"),s("close")}}),f=Z(!1);dn(async()=>{await c()});async function h(){!a.value||!await Zs(a.value.verificationUriComplete)||(f.value=!0,setTimeout(()=>{f.value=!1},2e3))}async function m(){d(),s("close")}function v(k){const w=Math.floor(k/60),b=k%60;return`${w}:${String(b).padStart(2,"0")}`}return(k,w)=>(y(),he(p(ua),{open:o.value,"onUpdate:open":w[0]||(w[0]=b=>o.value=b),title:p(n)("login.title"),"close-on-overlay":!1,onClose:m},{default:me(()=>[p(r)==="starting"?(y(),M("div",IFe,[j(p(Ao),{size:"md"}),C("span",LFe,N(p(n)("login.starting")),1)])):p(r)==="device-code"&&p(a)?(y(),M("div",$Fe,[C("div",NFe,N(p(n)("login.lead")),1),C("a",{class:"nb-primary",href:p(a).verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[qe(N(p(n)("login.authorizeInBrowser"))+" ",1),j(p(Te),{name:"external-link",size:"sm"})],8,FFe),C("div",RFe,[C("span",{class:"nb-link",title:p(a).verificationUriComplete},N(p(a).verificationUriComplete),9,OFe),j(p(Rt),{class:Re(["nb-copy",{"is-copied":f.value}]),variant:"secondary",size:"sm",onClick:h},{default:me(()=>[f.value?(y(),M(Pe,{key:0},[j(p(Te),{name:"check",size:"sm"}),qe(" "+N(p(n)("login.copied")),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("login.copyLink")),1)],64))]),_:1},8,["class"])]),C("div",PFe,[j(p(Ao),{size:"sm",label:p(n)("login.waitingAuth")},null,8,["label"]),C("span",DFe,N(p(n)("login.waitingAutoClose")),1),C("span",BFe,N(v(p(u))),1)])])):p(r)==="success"?(y(),M("div",HFe,[j(p(Dd),{kind:"success"}),C("span",zFe,N(p(n)("login.success")),1),C("span",WFe,N(p(n)("login.successHint")),1)])):p(r)==="expired"?(y(),M(Pe,{key:3},[C("div",UFe,[j(p(Dd),{kind:"expired"}),C("span",jFe,N(p(n)("login.expiredTitle")),1),C("span",VFe,N(p(n)("login.expiredHint")),1)]),C("div",qFe,[j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):p(r)==="error"?(y(),M(Pe,{key:4},[C("div",KFe,[j(p(Dd),{kind:"error"}),C("span",ZFe,N(p(l)?p(n)("login.pollErrorTitle"):p(n)("login.errorTitle")),1),C("span",GFe,N(p(l)?p(n)("login.pollErrorHint"):p(n)("login.errorHint")),1)]),C("div",YFe,[j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"]),j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("login.closeBtn")),1)]),_:1})])],64)):ee("",!0)]),_:1},8,["open","title"]))}}),JFe=ft(XFe,[["__scopeId","data-v-c798a107"]]),yF=et({__name:"LanguageSwitcher",props:{size:{default:"md"}},setup(e){const{locale:t}=Nt(),n=yg.map(s=>({value:s.code,label:s.label}));function o(s){t.value!==s&&E5(s)}return(s,i)=>(y(),he(p(wi),{"model-value":p(t),options:p(n),size:e.size,"onUpdate:modelValue":o},null,8,["model-value","options","size"]))}}),QFe={class:"msg"},eRe={class:"pf-field"},tRe={class:"pf-field-label"},nRe={class:"pf-field"},oRe={class:"pf-field-label"},sRe={class:"pf-field"},iRe={class:"pf-field-label"},rRe={class:"pf-key-wrap"},lRe={class:"pf-field"},aRe={class:"pf-field-label"},uRe={class:"pf-field"},cRe={class:"pf-field-label"},dRe={class:"pf-models"},fRe={key:0,class:"pf-models-empty"},pRe={class:"pf-model-grid pf-model-head"},hRe={key:1},mRe={key:0},gRe={class:"pf-foot"},vRe={key:0,class:"pf-managed-note"},yRe={class:"pf-confirm-msg"},kRe=et({__name:"ProviderForm",props:{mode:{},provider:{},guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","saved","deleting","deleted","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=mu(),r=Go({id:"",type:"openai",apiKey:"",baseUrl:"",models:[rh()]}),l=Z(""),a=Z(!1),u=Z(!1),c=Z(!1),d=R(()=>n.mode==="add"),f=R(()=>n.provider!==void 0&&mE(n.provider)),h=R(()=>{const $=n.provider;return $===void 0?0:w3($,i.config.value?.models).length}),m=R(()=>f.value&&h.value===0),v=R(()=>DJ.map($=>({value:$,label:s(`providers.types.${$}`)}))),k=R(()=>f.value?s("providers.apiKeyManaged"):!d.value&&n.provider?.hasApiKey===!0?s("providers.apiKeySet"):"sk-…");function w(){l.value="",u.value=!1;const $=n.provider;if(d.value||$===void 0){r.id="",r.type="openai",r.apiKey="",r.baseUrl="",r.models=[rh()];return}r.id=$.id,r.type=$.type,r.apiKey="",r.baseUrl=$.baseUrl??"";const B=w3($,i.config.value?.models);r.models=B.length>0?B:[rh()]}dn(()=>{w(),g()});const b=Z(!1),_=Z(!1);async function g(){const $=n.provider;if(!(d.value||$===void 0||f.value||$.hasApiKey!==!0))try{const B=await i.getProvider($.id);if(_.value)return;B.apiKey!==void 0&&B.apiKey!==""&&(r.apiKey=B.apiKey,b.value=!0)}catch{}}function x(){o("dirtyChange",!0)}const S=Z(!1),T=Z();function A($){l.value=$,yt(()=>T.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function E(){if(a.value)return;const $=BJ(r,{requireApiKey:d.value,requireBaseUrl:d.value});if($!==null){A(s(`providers.error.${$}`));return}l.value="",a.value=!0;try{if(d.value){const B=await i.addProvider(HJ(r));if(B!==null){A(B);return}o("dirtyChange",!1),i.notify({severity:"success",title:s("providers.added")}),o("added",r.id.trim())}else{const B=n.provider;if(B===void 0)return;const H=i.config.value?.providers?.[B.id]?.defaultModel,O=await i.updateProvider(B.id,zJ(r,B,{includeBlankApiKey:b.value,existingDefaultModel:H}));if(O!==null){A(O);return}await i.checkAuth(),i.notify({severity:"success",title:s("providers.saved")}),o("dirtyChange",!1),o("saved",r.id.trim())}}finally{a.value=!1}}async function P(){const $=n.provider;if(!($===void 0||c.value)){c.value=!0,o("deleting"),await new Promise(B=>setTimeout(B,300));try{if(await i.deleteProvider($.id)===null){u.value=!1;return}o("dirtyChange",!1),o("deleted",$.id)}finally{c.value=!1}}}function D(){r.models.push(rh()),x()}function I($){r.models.length<=1||(r.models.splice($,1),x())}return($,B)=>(y(),M("div",{class:"pf-form",onInput:x},[e.guard?(y(),he(p(qu),{key:0,variant:"warning",class:"pf-guard"},{default:me(()=>[C("span",QFe,N(p(s)("providers.unsavedGuard")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:B[0]||(B[0]=H=>o("guardStay"))},{default:me(()=>[qe(N(p(s)("providers.guardStay")),1)]),_:1}),j(p(Rt),{variant:"danger",size:"sm",onClick:B[1]||(B[1]=H=>o("guardDiscard"))},{default:me(()=>[qe(N(p(s)("providers.guardDiscard")),1)]),_:1})]),_:1})):ee("",!0),l.value?(y(),M("div",{key:1,ref_key:"errorBox",ref:T},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(l.value),1)]),_:1})],512)):ee("",!0),C("div",eRe,[C("label",tRe,[qe(N(p(s)("providers.fieldId")),1),B[11]||(B[11]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:r.id,"onUpdate:modelValue":B[2]||(B[2]=H=>r.id=H),placeholder:"my-openai",disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","disabled"])]),C("div",nRe,[C("label",oRe,[qe(N(p(s)("providers.fieldType")),1),B[12]||(B[12]=C("span",{class:"req"}," *",-1))]),j(p(n3),{"model-value":r.type,options:v.value,disabled:f.value,"onUpdate:modelValue":B[3]||(B[3]=H=>{r.type=H,x()})},null,8,["model-value","options","disabled"])]),C("div",sRe,[C("label",iRe,[qe(N(p(s)("providers.fieldApiKey")),1),B[13]||(B[13]=C("span",{class:"req"}," *",-1))]),C("div",rRe,[j(p(js),{modelValue:r.apiKey,"onUpdate:modelValue":B[4]||(B[4]=H=>r.apiKey=H),type:S.value?"text":"password",placeholder:k.value,disabled:f.value,autocomplete:"off",spellcheck:"false",onInput:B[5]||(B[5]=H=>_.value=!0)},null,8,["modelValue","type","placeholder","disabled"]),f.value?ee("",!0):(y(),he(p(gn),{key:0,class:"pf-key-eye",size:"sm",label:p(s)(S.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(s)(S.value?"providers.hideApiKey":"providers.showApiKey"),onClick:B[6]||(B[6]=H=>S.value=!S.value)},{default:me(()=>[j(p(Te),{name:S.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"]))])]),C("div",lRe,[C("label",aRe,[qe(N(p(s)("providers.fieldBaseUrl")),1),B[14]||(B[14]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:r.baseUrl,"onUpdate:modelValue":B[7]||(B[7]=H=>r.baseUrl=H),placeholder:p(s)("providers.baseUrlPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder","disabled"])]),C("div",uRe,[C("label",cRe,[qe(N(p(s)("providers.fieldModels")),1),B[15]||(B[15]=C("span",{class:"req"}," *",-1))]),C("div",dRe,[m.value?(y(),M("div",fRe,N(p(s)("providers.noModels")),1)):(y(),M(Pe,{key:1},[C("div",pRe,[C("span",null,[qe(N(p(s)("providers.colModelId")),1),B[16]||(B[16]=C("span",{class:"req"}," *",-1))]),C("span",null,[qe(N(p(s)("providers.colContext")),1),B[17]||(B[17]=C("span",{class:"req"}," *",-1))]),C("span",null,N(p(s)("providers.colDisplayName")),1),B[18]||(B[18]=C("span",null,null,-1))]),(y(!0),M(Pe,null,pt(r.models,(H,O)=>(y(),M("div",{key:O,class:"pf-model-grid"},[j(p(js),{modelValue:H.model,"onUpdate:modelValue":F=>H.model=F,placeholder:p(s)("providers.modelIdPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),j(p(js),{modelValue:H.maxContextSize,"onUpdate:modelValue":F=>H.maxContextSize=F,inputmode:"numeric",placeholder:p(s)("providers.modelContextPlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),j(p(js),{modelValue:H.displayName,"onUpdate:modelValue":F=>H.displayName=F,placeholder:p(s)("providers.modelNamePlaceholder"),disabled:f.value,autocomplete:"off",spellcheck:"false"},null,8,["modelValue","onUpdate:modelValue","placeholder","disabled"]),f.value?(y(),M("span",hRe)):(y(),he(p(gn),{key:0,size:"sm",label:p(s)("providers.removeModel"),tooltip:p(s)("providers.removeModel"),disabled:r.models.length<=1,onClick:F=>I(O)},{default:me(()=>[j(p(Te),{name:"trash",size:"sm"})]),_:1},8,["label","tooltip","disabled","onClick"]))]))),128)),f.value?ee("",!0):(y(),M("div",mRe,[j(p(Rt),{variant:"ghost",size:"sm",onClick:D},{default:me(()=>[j(p(Te),{name:"plus",size:"sm"}),qe(" "+N(p(s)("providers.addModel")),1)]),_:1})]))],64))])]),C("div",gRe,[f.value?(y(),M("span",vRe,N(p(s)("providers.managedHint")),1)):d.value?(y(),M(Pe,{key:1},[j(p(Rt),{variant:"secondary",size:"sm",onClick:B[8]||(B[8]=H=>o("cancel"))},{default:me(()=>[qe(N(p(s)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:a.value,onClick:E},{default:me(()=>[qe(N(p(s)("providers.addProvider")),1)]),_:1},8,["disabled"])],64)):u.value&&n.provider!==void 0?(y(),M(Pe,{key:2},[C("span",yRe,N(p(s)("providers.deleteConfirm",{id:n.provider.id,count:h.value})),1),B[19]||(B[19]=C("span",{class:"spacer"},null,-1)),j(p(Rt),{variant:"secondary",size:"sm",disabled:c.value,onClick:B[9]||(B[9]=H=>u.value=!1)},{default:me(()=>[qe(N(p(s)("common.cancel")),1)]),_:1},8,["disabled"]),j(p(Rt),{variant:"danger",size:"sm",disabled:c.value,onClick:P},{default:me(()=>[qe(N(p(s)("providers.deleteConfirmYes")),1)]),_:1},8,["disabled"])],64)):(y(),M(Pe,{key:3},[j(p(Rt),{variant:"danger-soft",size:"sm",onClick:B[10]||(B[10]=H=>u.value=!0)},{default:me(()=>[qe(N(p(s)("providers.deleteProvider")),1)]),_:1}),B[20]||(B[20]=C("span",{class:"spacer"},null,-1)),j(p(Rt),{variant:"primary",size:"sm",disabled:a.value,onClick:E},{default:me(()=>[qe(N(p(s)("providers.save")),1)]),_:1},8,["disabled"])],64))])],32))}}),kF=ft(kRe,[["__scopeId","data-v-ac0597e3"]]),bRe={class:"af"},CRe={class:"msg"},wRe={key:2,class:"af-catalog"},_Re={key:0,class:"af-center"},xRe={key:1,class:"af-error"},SRe={class:"af-list"},ARe=["disabled","onClick"],MRe={class:"af-entry-name"},TRe={key:1,class:"af-entry-reason"},ERe={key:2,class:"af-entry-count"},IRe={key:0,class:"af-empty"},LRe={class:"af-field"},$Re={class:"af-label"},NRe={class:"af-field"},FRe={class:"af-label"},RRe={class:"af-key-wrap"},ORe={key:0,class:"af-field"},PRe={class:"af-label"},DRe={class:"af-note"},BRe={class:"af-foot"},HRe={class:"af-hint"},zRe={class:"af-field"},WRe={class:"af-label"},URe={class:"af-field"},jRe={class:"af-label"},VRe={class:"af-key-wrap"},qRe={class:"af-foot"},KRe={class:"af-manual"},ZRe=et({__name:"AddProviderFlow",props:{guard:{type:Boolean}},emits:["dirtyChange","guardStay","guardDiscard","added","cancel"],setup(e,{emit:t}){const n=t,{t:o,te:s}=Nt(),i=mu(),r=Z("catalog"),l=R(()=>[{value:"catalog",label:o("providers.catalog.sourceCatalog")},{value:"registry",label:o("providers.catalog.sourceRegistry")},{value:"manual",label:o("providers.catalog.sourceManual")}]),a=Z("loading"),u=Z([]);async function c(){a.value="loading";const U=await i.loadCatalogProviders();U.kind==="ok"?(u.value=U.items,a.value="ready"):U.kind==="unsupported"?(a.value="unsupported",r.value==="catalog"&&(r.value="manual")):a.value="error"}dn(c);const d=Z(""),f=R(()=>{const U=d.value.trim().toLowerCase();return U===""?u.value:u.value.filter(z=>z.name.toLowerCase().includes(U)||z.id.toLowerCase().includes(U))});function h(U){const z=U.rejectReason;return z!==null&&s(`providers.catalog.rejectReason.${z}`)?o(`providers.catalog.rejectReason.${z}`):o("providers.catalog.rejected")}const m=Z(null),v=Z({id:"",apiKey:"",baseUrl:""}),k=Z(!1),w=Z(!1),b=Z("");function _(U){m.value=U,v.value={id:U.id,apiKey:"",baseUrl:""},b.value="",k.value=!1}function g(){m.value=null,b.value="",n("dirtyChange",!1)}function x(){n("dirtyChange",!0)}const S=R(()=>{if(m.value===null)return!1;const z=v.value.id.trim();return z!==""&&i.providers.value.some(W=>W.id===z)}),T=Z();function A(U){b.value=U,yt(()=>T.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}function E(){const U=v.value,z=U.id.trim();return z===""?o("providers.error.idRequired"):pE.test(z)?U.apiKey.trim()===""?o("providers.error.apiKeyRequired"):m.value?.needsBaseUrl===!0&&U.baseUrl.trim()===""?o("providers.error.baseUrlRequired"):null:o("providers.error.idInvalid")}async function P(){const U=m.value;if(U===null||w.value)return;const z=E();if(z!==null){A(z);return}b.value="",w.value=!0;try{const W=v.value,K=W.id.trim(),V=W.baseUrl.trim(),ie=await i.importCatalogProvider({catalogId:U.id,apiKey:W.apiKey.trim(),...V===""?{}:{baseUrl:V},...K===U.id?{}:{id:K}});if(ie!==null){A(ie);return}i.notify({severity:"success",title:o("providers.added")}),n("dirtyChange",!1),n("added",K)}finally{w.value=!1}}const D=Z({url:"",apiKey:""}),I=Z(!1),$=Z(!1),B=Z(""),H=Z();function O(U){B.value=U,yt(()=>H.value?.scrollIntoView({block:"nearest",behavior:"smooth"}))}async function F(){if($.value)return;const U=D.value.url.trim();if(U===""){O(o("providers.error.registryUrlRequired"));return}B.value="",$.value=!0;try{const z=D.value.apiKey.trim(),W=await i.importCustomRegistry({url:U,...z===""?{}:{apiKey:z}});if(typeof W=="string"){O(W);return}i.notify({severity:"success",title:o("providers.catalog.registryImported",{count:W.providers.length})}),n("dirtyChange",!1);const K=W.providers[0];K!==void 0?n("added",K.id):n("cancel")}finally{$.value=!1}}return(U,z)=>(y(),M("div",bRe,[e.guard?(y(),he(p(qu),{key:0,variant:"warning",class:"af-guard"},{default:me(()=>[C("span",CRe,N(p(o)("providers.unsavedGuard")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:z[0]||(z[0]=W=>n("guardStay"))},{default:me(()=>[qe(N(p(o)("providers.guardStay")),1)]),_:1}),j(p(Rt),{variant:"danger",size:"sm",onClick:z[1]||(z[1]=W=>n("guardDiscard"))},{default:me(()=>[qe(N(p(o)("providers.guardDiscard")),1)]),_:1})]),_:1})):ee("",!0),a.value!=="unsupported"?(y(),he(p(wi),{key:1,modelValue:r.value,"onUpdate:modelValue":z[2]||(z[2]=W=>r.value=W),size:"sm",options:l.value},null,8,["modelValue","options"])):ee("",!0),a.value!=="unsupported"?Bn((y(),M("div",wRe,[a.value==="loading"?(y(),M("div",_Re,[j(p(Ao),{size:"sm"}),C("span",null,N(p(o)("providers.catalog.loading")),1)])):a.value==="error"?(y(),M("div",xRe,[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(p(o)("providers.catalog.loadError")),1)]),_:1}),C("div",null,[j(p(Rt),{variant:"secondary",size:"sm",onClick:c},{default:me(()=>[qe(N(p(o)("providers.catalog.retry")),1)]),_:1})])])):m.value===null?(y(),M(Pe,{key:2},[j(p(js),{modelValue:d.value,"onUpdate:modelValue":z[3]||(z[3]=W=>d.value=W),placeholder:p(o)("providers.catalog.searchPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"]),C("div",SRe,[(y(!0),M(Pe,null,pt(f.value,W=>(y(),M("button",{key:W.id,type:"button",class:"af-entry",disabled:W.rejected,onClick:K=>_(W)},[C("span",MRe,N(W.name),1),W.wireType!==null?(y(),he(p(Vr),{key:0,variant:"neutral",size:"sm"},{default:me(()=>[qe(N(W.wireType),1)]),_:2},1024)):ee("",!0),z[16]||(z[16]=C("span",{class:"grow"},null,-1)),W.rejected?(y(),M("span",TRe,N(h(W)),1)):(y(),M("span",ERe,N(p(o)("providers.modelCount",{count:W.models.length})),1))],8,ARe))),128)),f.value.length===0?(y(),M("div",IRe,N(p(o)("providers.catalog.empty")),1)):ee("",!0)])],64)):(y(),M("div",{key:3,class:"af-import",onInput:x},[C("button",{type:"button",class:"af-back",onClick:g},[j(p(Te),{name:"arrow-left",size:"sm"}),qe(" "+N(p(o)("providers.catalog.backToList")),1)]),C("div",LRe,[C("label",$Re,[qe(N(p(o)("providers.fieldId")),1),z[17]||(z[17]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:v.value.id,"onUpdate:modelValue":z[4]||(z[4]=W=>v.value.id=W),autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",NRe,[C("label",FRe,[qe(N(p(o)("providers.fieldApiKey")),1),z[18]||(z[18]=C("span",{class:"req"}," *",-1))]),C("div",RRe,[j(p(js),{modelValue:v.value.apiKey,"onUpdate:modelValue":z[5]||(z[5]=W=>v.value.apiKey=W),type:k.value?"text":"password",placeholder:"sk-…",autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type"]),j(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(k.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(o)(k.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[6]||(z[6]=W=>k.value=!k.value)},{default:me(()=>[j(p(Te),{name:k.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"])])]),m.value.needsBaseUrl?(y(),M("div",ORe,[C("label",PRe,[qe(N(p(o)("providers.fieldBaseUrl")),1),z[19]||(z[19]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:v.value.baseUrl,"onUpdate:modelValue":z[7]||(z[7]=W=>v.value.baseUrl=W),placeholder:p(o)("providers.baseUrlPlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","placeholder"])])):ee("",!0),S.value?(y(),he(p(qu),{key:1,variant:"warning"},{default:me(()=>[qe(N(p(o)("providers.catalog.overwriteWarning")),1)]),_:1})):ee("",!0),C("div",DRe,N(p(o)("providers.catalog.willImport",{count:m.value.models.length})),1),b.value?(y(),M("div",{key:2,ref_key:"importErrorBox",ref:T},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(b.value),1)]),_:1})],512)):ee("",!0),C("div",BRe,[j(p(Rt),{variant:"secondary",size:"sm",onClick:z[8]||(z[8]=W=>n("cancel"))},{default:me(()=>[qe(N(p(o)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:w.value,onClick:P},{default:me(()=>[qe(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],32))],512)),[[qs,r.value==="catalog"]]):ee("",!0),Bn(C("div",{class:"af-registry",onInput:x},[C("div",HRe,N(p(o)("providers.catalog.registryHint")),1),C("div",zRe,[C("label",WRe,[qe(N(p(o)("providers.catalog.registryUrlLabel")),1),z[20]||(z[20]=C("span",{class:"req"}," *",-1))]),j(p(js),{modelValue:D.value.url,"onUpdate:modelValue":z[9]||(z[9]=W=>D.value.url=W),placeholder:"https://example.com/api.json",autocomplete:"off",spellcheck:"false"},null,8,["modelValue"])]),C("div",URe,[C("label",jRe,N(p(o)("providers.fieldApiKey")),1),C("div",VRe,[j(p(js),{modelValue:D.value.apiKey,"onUpdate:modelValue":z[10]||(z[10]=W=>D.value.apiKey=W),type:I.value?"text":"password",placeholder:p(o)("providers.modelNamePlaceholder"),autocomplete:"off",spellcheck:"false"},null,8,["modelValue","type","placeholder"]),j(p(gn),{class:"af-key-eye",size:"sm",label:p(o)(I.value?"providers.hideApiKey":"providers.showApiKey"),tooltip:p(o)(I.value?"providers.hideApiKey":"providers.showApiKey"),onClick:z[11]||(z[11]=W=>I.value=!I.value)},{default:me(()=>[j(p(Te),{name:I.value?"eye-off":"eye",size:"sm"},null,8,["name"])]),_:1},8,["label","tooltip"])])]),B.value?(y(),M("div",{key:0,ref_key:"registryErrorBox",ref:H},[j(p(qu),{variant:"danger"},{default:me(()=>[qe(N(B.value),1)]),_:1})],512)):ee("",!0),C("div",qRe,[j(p(Rt),{variant:"secondary",size:"sm",onClick:z[12]||(z[12]=W=>n("cancel"))},{default:me(()=>[qe(N(p(o)("common.cancel")),1)]),_:1}),j(p(Rt),{variant:"primary",size:"sm",disabled:$.value,onClick:F},{default:me(()=>[qe(N(p(o)("providers.catalog.importAction")),1)]),_:1},8,["disabled"])])],544),[[qs,r.value==="registry"]]),Bn(C("div",KRe,[j(kF,{mode:"add",guard:!1,onDirtyChange:z[13]||(z[13]=W=>n("dirtyChange",W)),onAdded:z[14]||(z[14]=W=>n("added",W)),onCancel:z[15]||(z[15]=W=>n("cancel"))})],512),[[qs,r.value==="manual"]])]))}}),GRe=ft(ZRe,[["__scopeId","data-v-9e5ec0a8"]]),YRe={class:"pp"},XRe={class:"pp-head"},JRe={class:"pp-title"},QRe={key:0,class:"pp-loading"},eOe={key:1,class:"pp-group"},tOe={class:"pp-add-label"},nOe={class:"pp-chev"},oOe={class:"pp-acc"},sOe={class:"pp-acc-in"},iOe={key:1,class:"pp-empty"},rOe=["onClick"],lOe={class:"grow"},aOe={class:"pp-id"},uOe={class:"pp-count"},cOe={class:"pp-chev"},dOe={class:"pp-acc"},fOe={class:"pp-acc-in"},Wu="$add",pOe=et({__name:"ProvidersPanel",setup(e){const{t}=Nt(),n=mu(),o=Z(!0),s=Z(null),i=Z(null);let r=0;const l=Z(!1),a=Z(!1),u=Z(null),c=Z("");let d=0;const f=R(()=>[...n.providers.value].sort((S,T)=>S.id.localeCompare(T.id)));function h(S){return w3(S,n.config.value?.models).length}Je(s,(S,T)=>{T!==null&&T!==S&&(i.value=T,window.clearTimeout(r),r=window.setTimeout(()=>{i.value=null},300)),l.value=!1}),Je(l,S=>{S||(a.value=!1,u.value=null)}),bn(()=>{window.clearTimeout(r),window.clearTimeout(d)});const m=Z(!1);Je(s,S=>{S===Wu?(m.value=!1,yt(()=>requestAnimationFrame(()=>{m.value=!0}))):m.value=!1}),dn(async()=>{o.value=!0;try{await Promise.all([n.loadProviders(),n.loadModels(),n.loadConfig()])}finally{o.value=!1}});function v(S){const T=s.value===S?null:S;if(l.value){u.value=T,a.value=!0;return}s.value=T}function k(){a.value=!1,u.value=null}function w(){a.value=!1,s.value=u.value,u.value=null}function b(S){c.value=S,window.clearTimeout(d),d=window.setTimeout(()=>{c.value=""},1200)}function _(S){s.value=S}function g(S){s.value=S,b(S)}function x(){s.value=null}return(S,T)=>(y(),M("section",YRe,[C("div",XRe,[C("h3",JRe,N(p(t)("settings.tabs.providers")),1),j(p(Rt),{variant:"secondary",size:"sm",onClick:T[0]||(T[0]=A=>v(Wu))},{default:me(()=>[j(p(Te),{name:"plus",size:"sm"}),qe(" "+N(p(t)("providers.addProvider")),1)]),_:1})]),o.value?(y(),M("div",QRe,[j(p(Ao),{size:"sm"}),C("span",null,N(p(t)("providers.loading")),1)])):(y(),M("div",eOe,[s.value===Wu||i.value===Wu?(y(),M("div",{key:0,class:Re(["pp-item pp-add-item",{open:s.value===Wu&&m.value}])},[C("button",{type:"button",class:"pp-row pp-add-row",onClick:T[1]||(T[1]=A=>v(Wu))},[C("span",tOe,N(p(t)("providers.addProvider")),1),T[6]||(T[6]=C("span",{class:"grow"},null,-1)),C("span",nOe,[j(p(Te),{name:"chevron-right",size:"sm"})])]),C("div",oOe,[C("div",sOe,[j(GRe,{guard:a.value&&s.value===Wu,onDirtyChange:T[2]||(T[2]=A=>l.value=A),onGuardStay:k,onGuardDiscard:w,onAdded:g,onCancel:T[3]||(T[3]=A=>s.value=null)},null,8,["guard"])])])],2)):ee("",!0),f.value.length===0?(y(),M("div",iOe,N(p(t)("providers.empty")),1)):ee("",!0),(y(!0),M(Pe,null,pt(f.value,A=>(y(),M("div",{key:A.id,class:Re(["pp-item",{open:s.value===A.id,flash:c.value===A.id}])},[C("button",{type:"button",class:"pp-row",onClick:E=>v(A.id)},[C("div",lOe,[C("span",aOe,N(A.id),1),j(p(Vr),{variant:"neutral",size:"sm"},{default:me(()=>[qe(N(A.type),1)]),_:2},1024),p(mE)(A)?(y(),he(p(Vr),{key:0,variant:"info",size:"sm"},{default:me(()=>[qe(N(p(t)("providers.managedBadge")),1)]),_:1})):ee("",!0)]),C("span",uOe,N(p(t)("providers.modelCount",{count:h(A)})),1),C("span",cOe,[j(p(Te),{name:"chevron-right",size:"sm"})])],8,rOe),C("div",dOe,[C("div",fOe,[s.value===A.id||i.value===A.id?(y(),he(kF,{key:0,mode:"edit",provider:A,guard:a.value&&s.value===A.id,onDirtyChange:T[4]||(T[4]=E=>l.value=E),onGuardStay:k,onGuardDiscard:w,onSaved:_,onDeleting:T[5]||(T[5]=E=>s.value=null),onDeleted:x},null,8,["provider","guard"])):ee("",!0)])])],2))),128))]))]))}}),hOe=ft(pOe,[["__scopeId","data-v-9aa0e3a8"]]),mOe={class:"sec"},gOe={class:"sec-title"},vOe={class:"pu-group"},yOe={class:"pu-row"},kOe={class:"pu-main"},bOe={class:"pu-label"},COe={class:"pu-hint"},wOe=et({__name:"PlanUpgradeCard",setup(e){const{t}=Nt();return(n,o)=>(y(),M("section",mOe,[C("h3",gOe,N(p(t)("settings.planUsage.title")),1),C("div",vOe,[C("div",yOe,[C("span",kOe,[C("span",bOe,N(p(t)("settings.planUsage.freeTitle")),1),C("span",COe,N(p(t)("settings.planUsage.freeHint")),1)]),j(p(Rt),{variant:"primary",size:"sm",onClick:o[0]||(o[0]=s=>p(jp)())},{default:me(()=>[qe(N(p(t)("sidebar.upgrade")),1)]),_:1})])])]))}}),bF=ft(wOe,[["__scopeId","data-v-5711dff8"]]),_Oe={class:"sec"},xOe={class:"sec-title"},SOe={class:"pu-group"},AOe={key:0,class:"pu-row pu-state"},MOe={key:1,class:"pu-row pu-state"},TOe={class:"pu-error-text"},EOe={key:2,class:"pu-row pu-state pu-empty"},IOe={class:"pu-main"},LOe={class:"pu-label"},$Oe={key:0,class:"pu-hint"},NOe={class:"pu-value"},FOe=["aria-valuenow","aria-valuemax"],ROe={key:0,class:"sec"},OOe={class:"sec-title"},POe={class:"pu-group"},DOe={class:"pu-row"},BOe={class:"pu-main"},HOe={class:"pu-label"},zOe={class:"pu-value"},WOe={key:0,class:"pu-value-sub"},UOe={key:0,class:"pu-meter"},jOe={class:"pu-row"},VOe={class:"pu-main"},qOe={class:"pu-label"},KOe={class:"pu-value"},ZOe={class:"pu-row"},GOe={class:"pu-main"},YOe={class:"pu-label"},XOe={class:"pu-value"},JOe={class:"pu-value-sub"},QOe=et({__name:"PlanUsageCard",props:{onFetchUsage:{type:Function}},setup(e){const t=e,{t:n}=Nt(),o=Z(!0),s=Z(null);async function i(){o.value=!0;try{s.value=await t.onFetchUsage()}finally{o.value=!1}}dn(i);const r=R(()=>s.value?.kind==="ok"?s.value:null),l=R(()=>r.value?.extraUsage??null),a=R(()=>{const v=r.value;return v===null?[]:v.summary===null?v.limits:[v.summary,...v.limits]}),u=R(()=>a.value.length>0),c=R(()=>s.value?.kind==="error"?s.value.message:n("settings.planUsage.loadFailed")),d=R(()=>s.value?.kind==="error"&&(s.value.status===402||s.value.status===403)),f=R(()=>l.value!==null&&l.value.monthlyChargeLimitEnabled&&l.value.monthlyChargeLimitCents>0);function h(v,k){const w=PJ(v,k);return`${w.symbol}${w.number}`}function m(v){return v.resetAt===void 0?"":fE(v.resetAt,n)}return(v,k)=>d.value?(y(),he(bF,{key:0})):(y(),M(Pe,{key:1},[C("section",_Oe,[C("h3",xOe,N(p(n)("settings.planUsage.title")),1),C("div",SOe,[o.value?(y(),M("div",AOe,[j(p(Ao),{size:"sm"})])):r.value===null?(y(),M("div",MOe,[C("span",TOe,N(c.value),1),j(p(Rt),{variant:"ghost",size:"sm",onClick:i},{default:me(()=>[qe(N(p(n)("settings.planUsage.retry")),1)]),_:1})])):u.value?(y(!0),M(Pe,{key:3},pt(a.value,(w,b)=>(y(),M("div",{key:b,class:"pu-row"},[C("span",IOe,[C("span",LOe,N(p(dE)(w,p(n))),1),m(w)?(y(),M("span",$Oe,N(m(w)),1)):ee("",!0)]),C("span",NOe,N(p(n)("settings.planUsage.usedPct",{pct:p(Wh)(w.used,w.limit)})),1),C("span",{class:"pu-meter",role:"progressbar","aria-valuenow":w.used,"aria-valuemax":w.limit},[C("i",{class:Re(`sev-${p(C3)(w.used,w.limit)}`),style:Zt({width:`${p(Wh)(w.used,w.limit)}%`})},null,6)],8,FOe)]))),128)):(y(),M("div",EOe,N(p(n)("settings.planUsage.empty")),1))])]),l.value!==null?(y(),M("section",ROe,[C("h3",OOe,N(p(n)("settings.planUsage.boosterTitle")),1),C("div",POe,[C("div",DOe,[C("span",BOe,[C("span",HOe,N(p(n)("settings.planUsage.monthlyUsed")),1)]),C("span",zOe,[qe(N(h(l.value.monthlyUsedCents,l.value.currency)),1),f.value?(y(),M("span",WOe," / "+N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)):ee("",!0)]),f.value?(y(),M("span",UOe,[C("i",{class:Re(`sev-${p(C3)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}`),style:Zt({width:`${p(Wh)(l.value.monthlyUsedCents,l.value.monthlyChargeLimitCents)}%`})},null,6)])):ee("",!0)]),C("div",jOe,[C("span",VOe,[C("span",qOe,N(p(n)("settings.planUsage.monthlyLimit")),1)]),C("span",KOe,[f.value?(y(),M(Pe,{key:0},[qe(N(h(l.value.monthlyChargeLimitCents,l.value.currency)),1)],64)):(y(),M(Pe,{key:1},[qe(N(p(n)("settings.planUsage.unlimited")),1)],64))])]),C("div",ZOe,[C("span",GOe,[C("span",YOe,N(p(n)("settings.planUsage.boosterBalance")),1)]),C("span",XOe,[qe(N(h(l.value.balanceCents,l.value.currency)),1),C("span",JOe," / "+N(h(l.value.totalCents,l.value.currency)),1)])])])])):ee("",!0)],64))}}),ePe=ft(QOe,[["__scopeId","data-v-f39cdded"]]),tPe=["aria-expanded","aria-label"],nPe={class:"sm-picker__value-text"},oPe=["aria-label"],sPe=["aria-label"],iPe={class:"sm-picker__group"},rPe=["aria-selected","onMouseenter","onClick"],lPe={class:"sm-picker__option-label"},aPe=["aria-label"],uPe={class:"sm-picker__group"},cPe=["aria-selected","onMouseenter","onClick"],dPe={class:"sm-picker__option-label"},fPe=188,pPe=250,wS=8,hPe=et({__name:"SecondaryModelPicker",props:{modelValue:{},effort:{},groups:{},modelInfoById:{}},emits:["select"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt(),i=Z(null),r=Z(null),l=Z(null),a=new Map,u=Z(!1),c=Z(!1),d=Z({}),f=`sm-picker-${Math.random().toString(36).slice(2,9)}`,h=Z(""),m=Z(null),v=Z("right"),k=Z(0),w=Z("models"),b=Z(0),_=Z(0);let g=null;const x=R(()=>n.groups.flatMap(ve=>ve.options)),S=R(()=>n.modelValue?x.value.find(ve=>ve.id===n.modelValue)?.label??n.modelValue:""),T=R(()=>n.modelValue?n.effort?`${S.value} · ${n.effort}`:S.value:s("settings.noSecondaryModel")),A=R(()=>{const ve=m.value;if(ve===null)return[];const oe=Up(n.modelInfoById[ve]),ye=n.effort===""?[null,...oe]:[...oe];return n.modelValue===ve&&n.effort!==""&&!oe.includes(n.effort)&&ye.push(n.effort),ye});function E(ve){return n.modelValue!==m.value?!1:ve===null?n.effort==="":n.effort===ve}function P(){const ve=A.value.findIndex(oe=>E(oe));return ve>=0?ve:0}function D(ve,oe){ve instanceof HTMLElement?a.set(oe,ve):a.delete(oe)}function I(){g!==null&&(clearTimeout(g),g=null)}function $(){I(),g=setTimeout(()=>{m.value=null,w.value==="efforts"&&(w.value="models")},pPe)}function B(ve){ve!==h.value&&(h.value=ve,b.value=Math.max(0,x.value.findIndex(oe=>oe.id===ve)))}function H(){const ve=r.value,oe=l.value;if(!ve||!oe)return;const ye=ve.getBoundingClientRect(),G=oe.offsetHeight,Y=window.innerHeight-ye.bottom;c.value=YG;const fe=Math.max(wS,window.innerWidth-ye.right);d.value=c.value?{right:`${fe}px`,bottom:`${window.innerHeight-ye.top+4}px`,top:"auto"}:{right:`${fe}px`,top:`${ye.bottom+4}px`,bottom:"auto"}}function O(){const ve=l.value,oe=m.value===null?void 0:a.get(m.value);if(!ve||!oe)return;const ye=ve.getBoundingClientRect(),G=oe.getBoundingClientRect();k.value=Math.max(0,Math.min(G.top-ye.top-4,ve.offsetHeight-40));const Y=window.innerWidth-ye.right,fe=ye.left;v.value=Y>=fPe||Y>=fe?"right":"left"}function F(ve,{moveFocus:oe=!1}={}){B(ve),I(),m.value=ve,oe&&(w.value="efforts",_.value=P()),yt(O)}function U(){m.value=null,w.value="models"}function z(){u.value||(u.value=!0,h.value=n.modelValue||(x.value[0]?.id??""),b.value=Math.max(0,x.value.findIndex(ve=>ve.id===h.value)),m.value=null,w.value="models",yt(H))}function W({restoreFocus:ve=!1}={}){u.value&&(I(),u.value=!1,m.value=null,ve&&yt(()=>r.value?.focus()))}function K(){u.value?W():z()}function V(ve){if(m.value===null)return;const oe={model:m.value,effort:ve??void 0};(oe.model!==n.modelValue||(oe.effort??"")!==n.effort)&&o("select",oe),W({restoreFocus:!0})}function ie(){yt(()=>{l.value?.querySelector(".sm-picker__option.is-kb-active")?.scrollIntoView({block:"nearest"})})}function ne(ve){const oe=x.value;if(oe.length===0)return;const ye=(b.value+ve+oe.length)%oe.length,G=oe[ye].id;B(G),m.value!==null&&F(G),ie()}function X(ve){const oe=A.value;oe.length!==0&&(_.value=(_.value+ve+oe.length)%oe.length,ie())}function le(ve){if(!u.value){(ve.key==="Enter"||ve.key===" "||ve.key==="ArrowDown")&&(ve.preventDefault(),z());return}if(ve.key==="ArrowDown")ve.preventDefault(),w.value==="models"?ne(1):X(1);else if(ve.key==="ArrowUp")ve.preventDefault(),w.value==="models"?ne(-1):X(-1);else if(ve.key==="ArrowRight")ve.preventDefault(),F(h.value,{moveFocus:!0});else if(ve.key==="ArrowLeft")ve.preventDefault(),m.value!==null&&U();else if(ve.key==="Enter"||ve.key===" ")ve.preventDefault(),w.value==="models"?F(h.value,{moveFocus:!0}):V(A.value[_.value]??null);else if(ve.key==="Home"||ve.key==="End"){ve.preventDefault();const oe=ve.key==="Home";if(w.value==="models"){const ye=x.value;if(ye.length===0)return;const G=(oe?ye[0]:ye.at(-1)).id;B(G),m.value!==null&&F(G)}else _.value=oe?0:A.value.length-1;ie()}else ve.key==="Escape"&&(ve.preventDefault(),W({restoreFocus:!0}))}function Ie(ve){const oe=ve.target;i.value?.contains(oe)||l.value?.contains(oe)||W()}function de(ve){if(u.value){if(l.value?.contains(ve.target)){O();return}H(),O()}}function pe(){W()}return dn(()=>{document.addEventListener("pointerdown",Ie),document.addEventListener("scroll",de,!0),window.addEventListener("resize",pe)}),bn(()=>{document.removeEventListener("pointerdown",Ie),document.removeEventListener("scroll",de,!0),window.removeEventListener("resize",pe),I()}),(ve,oe)=>(y(),M("div",{ref_key:"rootRef",ref:i,class:Re(["sm-picker",{"is-open":u.value}])},[C("button",{ref_key:"triggerRef",ref:r,class:"sm-picker__trigger",type:"button",role:"combobox","aria-controls":f,"aria-expanded":u.value,"aria-haspopup":"dialog","aria-label":p(s)("settings.secondaryModel"),onClick:K,onKeydown:le},[C("span",{class:Re(["sm-picker__value",{"is-placeholder":!e.modelValue}])},[C("span",nPe,N(T.value),1)],2),j(p(Te),{class:"sm-picker__chevron",name:"chevron-down",size:"sm"})],40,tPe),(y(),he(Zr,{to:"body"},[u.value?(y(),M("div",{key:0,id:f,ref_key:"menuRef",ref:l,class:Re(["sm-picker__menu",{"sm-picker__menu--up":c.value}]),style:Zt(d.value),role:"dialog","aria-label":p(s)("settings.secondaryModel")},[C("div",{class:"sm-picker__models",role:"listbox","aria-label":p(s)("settings.secondaryModel")},[(y(!0),M(Pe,null,pt(e.groups,ye=>(y(),M(Pe,{key:ye.provider},[C("div",iPe,N(ye.provider),1),(y(!0),M(Pe,null,pt(ye.options,G=>(y(),M("button",{key:G.id,ref_for:!0,ref:Y=>D(Y,G.id),class:Re(["sm-picker__option",{"is-selected":G.id===e.modelValue,"is-active":G.id===h.value,"is-kb-active":w.value==="models"&&G.id===h.value}]),type:"button",role:"option","aria-selected":G.id===e.modelValue,onMouseenter:Y=>F(G.id),onMouseleave:$,onClick:Y=>F(G.id,{moveFocus:!0})},[j(p(Te),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",lPe,N(G.label),1),j(p(Te),{class:"sm-picker__flyout-caret",name:"chevron-right",size:"sm"})],42,rPe))),128))],64))),128))],8,sPe),m.value!==null?(y(),M("div",{key:0,class:Re(["sm-picker__flyout",`sm-picker__flyout--${v.value}`]),style:Zt({top:`${k.value}px`}),role:"listbox","aria-label":p(s)("settings.secondaryModelEffort"),onMouseenter:I,onMouseleave:$},[C("div",uPe,N(p(s)("settings.secondaryModelEffort")),1),(y(!0),M(Pe,null,pt(A.value,(ye,G)=>(y(),M("button",{key:ye??"__default__",class:Re(["sm-picker__option",{"is-selected":E(ye),"is-active":w.value==="efforts"&&G===_.value,"is-kb-active":w.value==="efforts"&&G===_.value,"is-muted":ye===null}]),type:"button",role:"option","aria-selected":E(ye),onMouseenter:Y=>{w.value="efforts",_.value=G},onClick:Y=>V(ye)},[j(p(Te),{class:"sm-picker__check",name:"check",size:"sm"}),C("span",dPe,N(ye??p(s)("settings.secondaryModelEffortAuto")),1)],42,cPe))),128))],46,aPe)):ee("",!0)],14,oPe)):ee("",!0)]))],2))}}),mPe=ft(hPe,[["__scopeId","data-v-f114c246"]]),gPe=["aria-label"],vPe={class:"settings-tabs-header"},yPe={class:"settings-dialog-title"},kPe={class:"settings-tab-list"},bPe=["aria-selected","onClick"],CPe={class:"settings-region"},wPe={class:"settings-region-header"},_Pe={class:"panel"},xPe={class:"sec"},SPe={class:"sec-title"},APe={class:"settings-group"},MPe={class:"row"},TPe={class:"rlabel"},EPe={class:"hint"},IPe={class:"row language-row"},LPe={class:"rlabel"},$Pe={class:"hint"},NPe={class:"row font-size-row"},FPe={class:"rlabel"},RPe={class:"hint"},OPe={class:"sec notification-settings"},PPe={class:"sec-title"},DPe={class:"settings-group"},BPe={class:"row"},HPe={class:"rlabel"},zPe={class:"hint"},WPe={key:0,class:"hint"},UPe={class:"row"},jPe={class:"rlabel"},VPe={class:"hint"},qPe={class:"panel"},KPe={class:"sec"},ZPe={class:"sec-title"},GPe={class:"settings-group"},YPe={class:"account-row"},XPe={class:"account-avatar","aria-hidden":"true"},JPe=["src"],QPe={class:"account-meta"},eDe={class:"account-name-row"},tDe={class:"account-name"},nDe={class:"account-sub"},oDe={key:0,class:"panel"},sDe={class:"panel"},iDe={class:"sec"},rDe={class:"sec-head"},lDe={class:"sec-title"},aDe={class:"settings-group"},uDe={class:"row"},cDe={class:"rlabel"},dDe={class:"hint"},fDe={key:0,class:"select-wrap"},pDe={key:1,class:"rvalue mono"},hDe={class:"row"},mDe={class:"rlabel"},gDe={class:"hint"},vDe={class:"row"},yDe={class:"rlabel"},kDe={class:"hint"},bDe={class:"row"},CDe={class:"rlabel"},wDe={class:"hint"},_De={key:1,class:"empty-config"},xDe={key:0,class:"sec"},SDe={class:"sec-head"},ADe={class:"sec-title"},MDe={class:"settings-group"},TDe={class:"row"},EDe={class:"rlabel"},IDe={class:"hint"},LDe={key:0,class:"select-wrap"},$De={key:1,class:"rvalue mono"},NDe={class:"panel"},FDe={class:"sec"},RDe={class:"sec-title"},ODe={class:"settings-group"},PDe={class:"row"},DDe={class:"rlabel"},BDe={class:"hint"},HDe={class:"rvalue"},zDe={class:"row"},WDe={class:"rlabel"},UDe={class:"hint"},jDe={class:"rvalue"},VDe={class:"row"},qDe={class:"rlabel"},KDe={class:"hint"},ZDe={class:"rvalue"},GDe={key:0,class:"row"},YDe={class:"rlabel"},XDe={key:0,class:"hint"},JDe={key:1,class:"hint"},QDe={key:1,class:"row"},eBe={class:"rlabel"},tBe={class:"hint"},nBe={key:0,class:"sec"},oBe={class:"sec-title"},sBe={class:"settings-group"},iBe={class:"row"},rBe={class:"rlabel"},lBe={class:"hint"},aBe={class:"hint"},uBe={class:"sec"},cBe={class:"sec-title"},dBe={class:"settings-group"},fBe={class:"row"},pBe={class:"rlabel"},hBe={class:"hint"},mBe={key:0,class:"hint"},gBe={class:"panel"},vBe={class:"panel-head"},yBe={class:"panel-title"},kBe={class:"panel-desc"},bBe={class:"archive-toolbar"},CBe={class:"archive-search"},wBe=["placeholder"],_Be={key:0,class:"archive-empty"},xBe={key:0,class:"archive-list"},SBe={class:"archive-workspace"},ABe={class:"path"},MBe={class:"count"},TBe={class:"setting-card"},EBe={class:"archive-meta"},IBe={class:"archive-name"},LBe={class:"archive-time"},$Be={key:1,class:"archive-empty"},NBe=100,FBe=et({__name:"SettingsDialog",props:{colorScheme:{},fontScale:{},initialTab:{},managedProviderStatus:{},managedUserInfo:{},onFetchUsage:{type:Function},notify:{type:Boolean},notifyPermission:{},notifySound:{type:Boolean},config:{},models:{},configSaving:{type:Boolean},serverVersion:{},experimentalFlags:{}},emits:["setColorScheme","setFontScale","setNotify","setNotifySound","login","logout","updateConfig","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R(()=>o.managedProviderStatus==="authenticated"),r=R(()=>i.value?o.managedUserInfo?.nickname||n("sidebar.defaultUserName"):n("sidebar.notSignedIn")),l=R(()=>o.managedUserInfo?.userLevelName?.trim()??""),a=Z(!1);Je(()=>o.managedUserInfo?.avatar,()=>{a.value=!1});const u=R(()=>!!o.managedUserInfo?.avatar&&!a.value),c=R(()=>i.value?n("settings.signedIn"):n("settings.signedOutHint")),d=Z(o.initialTab??"general"),f=Z(!1);let h=null;function m(){f.value=!0,h&&clearTimeout(h),h=setTimeout(()=>{f.value=!1,h=null},900)}const v=[{id:"general",labelKey:"settings.tabs.general",icon:"sliders"},{id:"agent",labelKey:"settings.tabs.agent",icon:"robot"},{id:"account",labelKey:"settings.tabs.account",icon:"user"},{id:"providers",labelKey:"settings.tabs.providers",icon:"bolt"},{id:"advanced",labelKey:"settings.tabs.advanced",icon:"microscope"},{id:"archived",labelKey:"settings.tabs.archived",icon:"archive"}],k=G0e(),w=["manual","yolo","auto"],b={manual:"status.permissionManual",auto:"status.permissionAuto",yolo:"status.permissionYolo"},_=Z(null);gF(_);const{isConfirmOpen:g}=hu();function x(Fe){Fe.key==="Escape"&&!Fe.defaultPrevented&&!g.value&&s("close")}dn(()=>document.addEventListener("keydown",x)),bn(()=>{document.removeEventListener("keydown",x),h&&clearTimeout(h)});function S(){G$()}const T=(()=>{const Fe="0.35.0".trim()?"0.35.0":"";let Oe="";if("2026-08-12T09:47:23.869Z".trim()){const at=new Date("2026-08-12T09:47:23.869Z");if(!Number.isNaN(at.getTime())){const Tt=Bt=>String(Bt).padStart(2,"0");Oe=`${at.getFullYear()}-${Tt(at.getMonth()+1)}-${Tt(at.getDate())} ${Tt(at.getHours())}:${Tt(at.getMinutes())}`}}const Ge=Oe===""?Fe:`${Fe} · ${Oe}`;return Ge===""?"-":Ge})(),A=K$(),E=Z(!1),P=Z(null);async function D(){if(!E.value){E.value=!0,P.value=null;try{P.value=await A.check()}finally{E.value=!1}}}const I=R(()=>{const Fe=P.value;if(Fe===null)return"";switch(Fe.outcome){case"available":return A.status.value.state==="downloaded"?n("settings.updateCheckDownloaded",{version:Fe.version??""}):A.autoDownload.value?n("settings.updateCheckAvailableAuto",{version:Fe.version??""}):n("settings.updateCheckAvailable",{version:Fe.version??""});case"latest":return n("settings.updateCheckLatest");case"unsupported":return n("settings.updateCheckUnsupported");case"error":return n("settings.updateCheckFailed")}}),$=R(()=>{const Fe=new Map;for(const Oe of o.models??[])Fe.set(Oe.id,{id:Oe.id,label:Oe.displayName??Oe.model??Oe.id,provider:Oe.provider});for(const[Oe,Ge]of Object.entries(o.config?.models??{})){if(Fe.has(Oe))continue;const at=F(Ge);Fe.set(Oe,{id:Oe,label:U(Oe,Ge,at),provider:at??Oe})}return Array.from(Fe.values())}),B=R(()=>{const Fe=new Map;for(const Oe of $.value){const Ge=Fe.get(Oe.provider)??[];Ge.push(Oe),Fe.set(Oe.provider,Ge)}for(const Oe of Fe.values())Oe.sort((Ge,at)=>Ge.label.localeCompare(at.label));return Array.from(Fe.entries()).toSorted(([Oe],[Ge])=>Oe.localeCompare(Ge)).map(([Oe,Ge])=>({provider:Oe,options:Ge}))}),H=R(()=>{const Fe=B.value.flatMap(Oe=>Oe.options.map(Ge=>({value:Ge.id,label:Ge.label,group:Oe.provider})));return o.config?.defaultModel||Fe.unshift({value:"",label:n("settings.noDefaultModel"),group:"",disabled:!0}),Fe}),O=R(()=>{const Fe=o.config?.defaultPermissionMode;return Fe==="auto"||Fe==="yolo"||Fe==="manual"?Fe:"manual"});function F(Fe){if(!Fe||typeof Fe!="object")return;const Oe=Fe;return typeof Oe.provider=="string"?Oe.provider:void 0}function U(Fe,Oe,Ge){if(!Oe||typeof Oe!="object")return Fe;const at=Oe,Tt=typeof at.model=="string"?at.model:void 0,Bt=Ge??F(Oe);return Tt&&Bt?`${Fe} (${Bt}/${Tt})`:Tt?`${Fe} (${Tt})`:Fe}function z(Fe){return Fe===!0}function W(Fe){!Fe||Fe===o.config?.defaultModel||s("updateConfig",{defaultModel:Fe})}function K(Fe){Fe!==O.value&&s("updateConfig",{defaultPermissionMode:Fe})}const V=R(()=>(o.experimentalFlags?.["secondary-model"]??o.config?.experimental?.["secondary-model"])===!0),ie=R(()=>o.config?.secondaryModel?.model??""),ne=R(()=>o.config?.secondaryModel?.defaultEffort??""),X=R(()=>Object.fromEntries((o.models??[]).map(Fe=>[Fe.id,Fe])));function le(Fe){Fe.model===ie.value&&(Fe.effort??"")===ne.value||s("updateConfig",{secondaryModel:Fe.effort?{model:Fe.model,defaultEffort:Fe.effort}:{model:Fe.model}})}function Ie(Fe){const Oe=o.config?.[Fe];s("updateConfig",{[Fe]:!z(Oe)})}function de(){const Fe=o.config?.thinking;return!Fe||typeof Fe!="object"?!0:Fe.enabled!==!1}function pe(){s("updateConfig",{thinking:{enabled:!de()}})}function ve(){const Fe=o.config?.telemetry!==!1;s("updateConfig",{telemetry:!Fe})}function oe(Fe){d.value=Fe}const ye=mu(),G=R(()=>i.value&&ye.managedMembership.value==="free"),Y=Z([]),fe=Z(!1),we=Z(!1),ge=Z(""),Q=Z("all"),te=Z("archived-desc");async function ce(){if(!(fe.value||we.value)){fe.value=!0;try{const Fe=[];let Oe;for(;;){const Ge=await ye.loadArchivedSessions({beforeId:Oe,pageSize:NBe});if(Fe.push(...Ge.items),!Ge.hasMore||Ge.items.length===0)break;const at=Ge.items.at(-1)?.id;if(at===void 0)break;Oe=at}Y.value=Fe,we.value=!0}catch(Fe){gl("loadAllArchived failed",Fe)}finally{fe.value=!1}}}Je(d,Fe=>{Fe==="archived"&&!we.value&&ce()},{immediate:!0});const ue=R(()=>{const Fe=new Set;for(const Oe of Y.value)Fe.add(Oe.cwd);return Array.from(Fe).sort((Oe,Ge)=>Oe.localeCompare(Ge))}),Se=R(()=>[{value:"all",label:n("settings.archivedAllWorkspaces")},...ue.value.map(Fe=>({value:Fe,label:Fe}))]),ze=R(()=>{const Fe=ge.value.trim().toLowerCase();let Oe=Y.value.filter(Ge=>Ge.archived===!0);return Q.value!=="all"&&(Oe=Oe.filter(Ge=>Ge.cwd===Q.value)),Fe&&(Oe=Oe.filter(Ge=>Ge.title.toLowerCase().includes(Fe))),Oe=Oe.slice(),te.value==="archived-desc"?Oe.sort((Ge,at)=>at.updatedAt.localeCompare(Ge.updatedAt)):te.value==="created-desc"?Oe.sort((Ge,at)=>at.createdAt.localeCompare(Ge.createdAt)):Oe.sort((Ge,at)=>Ge.title.localeCompare(at.title,"zh")),Oe}),_e=R(()=>{const Fe=new Map;for(const Oe of ze.value){const Ge=Fe.get(Oe.cwd)??[];Ge.push(Oe),Fe.set(Oe.cwd,Ge)}return Array.from(Fe.entries()).map(([Oe,Ge])=>({cwd:Oe,items:Ge}))});async function Ee(Fe){await ye.restoreSession(Fe)&&(Y.value=Y.value.filter(Ge=>Ge.id!==Fe))}function it(Fe){const Oe=new Date(Fe);if(Number.isNaN(Oe.getTime()))return Fe;const Ge=at=>String(at).padStart(2,"0");return`${Oe.getFullYear()}-${Ge(Oe.getMonth()+1)}-${Ge(Oe.getDate())} ${Ge(Oe.getHours())}:${Ge(Oe.getMinutes())}`}return(Fe,Oe)=>(y(),he(p(ua),{open:!0,"close-on-esc":!1,"aria-label":p(n)("settings.title"),size:"xl",height:"fixed",padded:!1,level:"grouped",onClose:Oe[16]||(Oe[16]=Ge=>s("close"))},{default:me(()=>[C("div",{ref_key:"dialogRef",ref:_,class:"sd"},[C("nav",{class:"settings-tabs",role:"tablist","aria-label":p(n)("settings.title")},[C("header",vPe,[C("h2",yPe,N(p(n)("settings.title")),1)]),C("div",kPe,[(y(),M(Pe,null,pt(v,Ge=>C("button",{key:Ge.id,type:"button",class:Re(["tab",{on:d.value===Ge.id}]),role:"tab","aria-selected":d.value===Ge.id,onClick:at=>oe(Ge.id)},[j(p(Te),{name:Ge.icon,size:"md"},null,8,["name"]),C("span",null,N(p(n)(Ge.labelKey)),1)],10,bPe)),64))])],8,gPe),C("section",CPe,[C("header",wPe,[j(p(gn),{size:"sm",label:p(n)("settings.close"),tooltip:p(n)("settings.close"),onClick:Oe[0]||(Oe[0]=Ge=>s("close"))},{default:me(()=>[j(p(Te),{name:"close",size:"md"})]),_:1},8,["label","tooltip"])]),C("div",{class:Re(["body",{scrolling:f.value}]),onScroll:m},[Bn(C("section",_Pe,[C("section",xPe,[C("h3",SPe,N(p(n)("settings.appearance")),1),C("div",APe,[C("div",MPe,[C("span",TPe,[qe(N(p(n)("theme.colorSchemeLabel"))+" ",1),C("span",EPe,N(p(n)("settings.colorSchemeHint")),1)]),j(p(wi),{"model-value":e.colorScheme,options:[{value:"light",label:p(n)("theme.light"),icon:"light-mode"},{value:"dark",label:p(n)("theme.dark"),icon:"dark-mode"},{value:"system",label:p(n)("theme.system")}],"onUpdate:modelValue":Oe[1]||(Oe[1]=Ge=>s("setColorScheme",Ge))},null,8,["model-value","options"])]),C("div",IPe,[C("span",LPe,[qe(N(p(n)("sidebar.language"))+" ",1),C("span",$Pe,N(p(n)("settings.languageHint")),1)]),j(yF)]),C("div",NPe,[C("span",FPe,[qe(N(p(n)("settings.uiFontSize"))+" ",1),C("span",RPe,N(p(n)("settings.uiFontSizeHint")),1)]),j(p(wi),{"model-value":e.fontScale,options:[{value:"small",label:"S"},{value:"medium",label:"M"},{value:"large",label:"L"},{value:"xlarge",label:"XL"}],"aria-label":p(n)("settings.uiFontSize"),"onUpdate:modelValue":Oe[2]||(Oe[2]=Ge=>s("setFontScale",Ge))},null,8,["model-value","aria-label"])])])]),C("section",OPe,[C("h3",PPe,N(p(n)("settings.notifications")),1),C("div",DPe,[C("div",BPe,[C("span",HPe,[qe(N(p(n)("settings.notifyEnabled"))+" ",1),C("span",zPe,N(p(n)("settings.notifyEnabledHint")),1),e.notifyPermission==="denied"?(y(),M("span",WPe,N(p(n)("settings.notifyDenied")),1)):ee("",!0)]),j(p(ed),{"model-value":e.notify,disabled:e.notifyPermission==="denied",label:p(n)("settings.notifyEnabled"),"onUpdate:modelValue":Oe[3]||(Oe[3]=Ge=>s("setNotify",Ge))},null,8,["model-value","disabled","label"])]),C("div",UPe,[C("span",jPe,[qe(N(p(n)("settings.notifySound"))+" ",1),C("span",VPe,N(p(n)("settings.notifySoundHint")),1)]),j(p(ed),{"model-value":e.notifySound,label:p(n)("settings.notifySound"),"onUpdate:modelValue":Oe[4]||(Oe[4]=Ge=>s("setNotifySound",Ge))},null,8,["model-value","label"])])])])],512),[[qs,d.value==="general"]]),Bn(C("section",qPe,[C("section",KPe,[C("h3",ZPe,N(p(n)("settings.account")),1),C("div",GPe,[C("div",YPe,[C("span",XPe,[u.value?(y(),M("img",{key:0,src:o.managedUserInfo?.avatar,alt:"",onError:Oe[5]||(Oe[5]=Ge=>a.value=!0)},null,40,JPe)):(y(),he(p(Te),{key:1,name:"user",size:"md"}))]),C("span",QPe,[C("span",eDe,[C("span",tDe,N(r.value),1),l.value?(y(),he(p(Vr),{key:0,class:"account-level",variant:"neutral",size:"sm"},{default:me(()=>[qe(N(l.value),1)]),_:1})):ee("",!0)]),C("span",nDe,N(c.value),1)]),i.value?(y(),he(p(Rt),{key:0,variant:"danger-soft",size:"sm",onClick:Oe[6]||(Oe[6]=Ge=>s("logout"))},{default:me(()=>[qe(N(p(n)("sidebar.signOut")),1)]),_:1})):(y(),he(p(Rt),{key:1,variant:"primary",size:"sm",onClick:Oe[7]||(Oe[7]=Ge=>s("login"))},{default:me(()=>[qe(N(p(n)("sidebar.signIn")),1)]),_:1}))])])]),G.value?(y(),he(bF,{key:0})):i.value?(y(),he(ePe,{key:1,"on-fetch-usage":o.onFetchUsage},null,8,["on-fetch-usage"])):ee("",!0)],512),[[qs,d.value==="account"]]),d.value==="providers"?(y(),M("section",oDe,[j(hOe)])):ee("",!0),Bn(C("section",sDe,[C("section",iDe,[C("div",rDe,[C("h3",lDe,N(p(n)("settings.agentDefaults")),1)]),C("div",aDe,[e.config?(y(),M(Pe,{key:0},[C("div",uDe,[C("span",cDe,[qe(N(p(n)("settings.defaultModel"))+" ",1),C("span",dDe,N(p(n)("settings.defaultModelHint")),1)]),B.value.length>0?(y(),M("div",fDe,[j(p(n3),{"model-value":e.config.defaultModel??"",options:H.value,"aria-label":p(n)("settings.defaultModel"),"onUpdate:modelValue":W},null,8,["model-value","options","aria-label"])])):(y(),M("span",pDe,N(e.config.defaultModel??p(n)("settings.noDefaultModel")),1))]),C("div",hDe,[C("span",mDe,[qe(N(p(n)("settings.defaultPermission"))+" ",1),C("span",gDe,N(p(n)("settings.defaultPermissionHint")),1)]),j(p(wi),{"model-value":O.value,options:w.map(Ge=>({value:Ge,label:p(n)(b[Ge])})),"onUpdate:modelValue":Oe[8]||(Oe[8]=Ge=>K(Ge))},null,8,["model-value","options"])]),C("div",vDe,[C("span",yDe,[qe(N(p(n)("settings.defaultThinking"))+" ",1),C("span",kDe,N(p(n)("settings.defaultThinkingHint")),1)]),j(p(ed),{"model-value":de(),label:p(n)("settings.defaultThinking"),"onUpdate:modelValue":Oe[9]||(Oe[9]=Ge=>pe())},null,8,["model-value","label"])]),C("div",bDe,[C("span",CDe,[qe(N(p(n)("settings.defaultPlanMode"))+" ",1),C("span",wDe,N(p(n)("settings.defaultPlanModeHint")),1)]),j(p(ed),{"model-value":z(e.config.defaultPlanMode),label:p(n)("settings.defaultPlanMode"),"onUpdate:modelValue":Oe[10]||(Oe[10]=Ge=>Ie("defaultPlanMode"))},null,8,["model-value","label"])])],64)):(y(),M("div",_De,N(p(n)("settings.configUnavailable")),1))])]),e.config&&V.value?(y(),M("section",xDe,[C("div",SDe,[C("h3",ADe,N(p(n)("settings.secondaryModelSection")),1)]),C("div",MDe,[C("div",TDe,[C("span",EDe,[qe(N(p(n)("settings.secondaryModel"))+" ",1),C("span",IDe,N(p(n)("settings.secondaryModelHint")),1)]),B.value.length>0?(y(),M("div",LDe,[j(mPe,{"model-value":ie.value,effort:ne.value,groups:B.value,"model-info-by-id":X.value,onSelect:le},null,8,["model-value","effort","groups","model-info-by-id"])])):(y(),M("span",$De,N(ie.value||p(n)("settings.noSecondaryModel")),1))])])])):ee("",!0)],512),[[qs,d.value==="agent"]]),Bn(C("section",NDe,[C("section",FDe,[C("h3",RDe,N(p(n)("settings.versionAndUpdates")),1),C("div",ODe,[C("div",PDe,[C("span",DDe,[qe(N(p(n)("settings.appVersion"))+" ",1),C("span",BDe,N(p(n)("settings.appVersionHint")),1)]),C("span",HDe,N(p(T)),1)]),C("div",zDe,[C("span",WDe,[qe(N(p(n)("settings.serverVersion"))+" ",1),C("span",UDe,N(p(n)("settings.serverVersionHint")),1)]),C("span",jDe,N(e.serverVersion||"-"),1)]),C("div",VDe,[C("span",qDe,[qe(N(p(n)("settings.serverAddress"))+" ",1),C("span",KDe,N(p(n)("settings.serverAddressHint")),1)]),C("span",ZDe,N(p(k)),1)]),p(A).canCheck?(y(),M("div",GDe,[C("span",YDe,[qe(N(p(n)("settings.checkUpdate"))+" ",1),I.value?(y(),M("span",XDe,N(I.value),1)):(y(),M("span",JDe,N(p(n)("settings.checkUpdateHint")),1))]),j(p(Rt),{variant:"secondary",size:"sm",disabled:E.value,onClick:D},{default:me(()=>[qe(N(E.value?p(n)("settings.updateChecking"):p(n)("settings.checkUpdateBtn")),1)]),_:1},8,["disabled"])])):ee("",!0),p(A).canToggleAutoDownload?(y(),M("div",QDe,[C("span",eBe,[qe(N(p(n)("settings.autoDownloadUpdate"))+" ",1),C("span",tBe,N(p(n)("settings.autoDownloadUpdateHint")),1)]),j(p(ed),{"model-value":p(A).autoDownload.value,label:p(n)("settings.autoDownloadUpdate"),"onUpdate:modelValue":Oe[11]||(Oe[11]=Ge=>p(A).setAutoDownload(Ge))},null,8,["model-value","label"])])):ee("",!0)])]),e.config?(y(),M("section",nBe,[C("h3",oBe,N(p(n)("settings.privacy")),1),C("div",sBe,[C("div",iBe,[C("span",rBe,[qe(N(p(n)("settings.telemetry"))+" ",1),C("span",lBe,N(p(n)("settings.telemetryHint")),1),C("span",aBe,N(p(n)("settings.telemetryRestartHint")),1)]),j(p(ed),{"model-value":e.config.telemetry!==!1,disabled:e.configSaving,label:p(n)("settings.telemetry"),"onUpdate:modelValue":Oe[12]||(Oe[12]=Ge=>ve())},null,8,["model-value","disabled","label"])])])])):ee("",!0),C("section",uBe,[C("h3",cBe,N(p(n)("settings.diagnostics")),1),C("div",dBe,[C("div",fBe,[C("span",pBe,[qe(N(p(n)("settings.exportLog"))+" ",1),C("span",hBe,N(p(n)("settings.exportLogHint")),1),p(Qr)()?ee("",!0):(y(),M("span",mBe,N(p(n)("settings.logHint")),1))]),j(p(Rt),{variant:"secondary",size:"sm",onClick:S},{default:me(()=>[qe(N(p(n)("settings.exportLogBtn")),1)]),_:1})])])])],512),[[qs,d.value==="advanced"]]),Bn(C("section",gBe,[C("div",vBe,[C("h4",yBe,N(p(n)("settings.archivedTitle")),1),C("p",kBe,N(p(n)("settings.archivedDesc")),1)]),C("div",bBe,[C("label",CBe,[Oe[17]||(Oe[17]=C("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round","stroke-linejoin":"round"},[C("circle",{cx:"11",cy:"11",r:"7"}),C("path",{d:"m21 21-4.3-4.3"})],-1)),Bn(C("input",{"onUpdate:modelValue":Oe[13]||(Oe[13]=Ge=>ge.value=Ge),placeholder:p(n)("settings.archivedSearch")},null,8,wBe),[[ai,ge.value]])]),j(p(n3),{"model-value":Q.value,options:Se.value,size:"sm","aria-label":p(n)("settings.archivedAllWorkspaces"),"onUpdate:modelValue":Oe[14]||(Oe[14]=Ge=>Q.value=Ge)},null,8,["model-value","options","aria-label"]),j(p(wi),{size:"sm","model-value":te.value,options:[{value:"archived-desc",label:p(n)("settings.archivedSortArchived"),icon:"clock"},{value:"created-desc",label:p(n)("settings.archivedSortCreated"),icon:"calendar-schedule"},{value:"name-asc",label:p(n)("settings.archivedSortName"),icon:"sort"}],"onUpdate:modelValue":Oe[15]||(Oe[15]=Ge=>te.value=Ge)},null,8,["model-value","options"])]),fe.value?(y(),M("div",_Be,N(p(n)("settings.archivedLoadingAll")),1)):(y(),M(Pe,{key:1},[_e.value.length>0?(y(),M("div",xBe,[(y(!0),M(Pe,null,pt(_e.value,Ge=>(y(),M("section",{key:Ge.cwd,class:"archive-card"},[C("div",SBe,[j(p(Te),{name:"folder-closed",size:"md"}),C("span",ABe,N(Ge.cwd),1),C("span",MBe,N(p(n)("settings.archivedSessionsCount",{count:Ge.items.length})),1)]),C("div",TBe,[(y(!0),M(Pe,null,pt(Ge.items,at=>(y(),M("div",{key:at.id,class:"archive-row"},[C("div",EBe,[C("div",IBe,N(at.title),1),C("div",LBe,N(p(n)("settings.archivedAt",{time:it(at.updatedAt)})),1)]),j(p(Rt),{variant:"secondary",size:"sm",onClick:Tt=>Ee(at.id)},{default:me(()=>[j(p(Te),{name:"undo",size:"sm"}),C("span",null,N(p(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128))])]))),128))])):(y(),M("div",$Be,N(Y.value.length===0?p(n)("settings.archivedEmpty"):p(n)("settings.archivedNoMatch")),1))],64))],512),[[qs,d.value==="archived"]])],34)])],512)]),_:1},8,["aria-label"]))}}),RBe=ft(FBe,[["__scopeId","data-v-146a8c47"]]),OBe={class:"aw"},PBe={class:"crumbbar"},DBe={class:"crumbs"},BBe={key:0,class:"crumb-sep"},HBe=["onClick"],zBe={key:0,class:"filterbar"},WBe=["placeholder"],UBe={class:"folder-list"},jBe={key:0,class:"fl-loading"},VBe=["onClick"],qBe={class:"folder-name search-rel"},KBe={key:0,class:"fl-empty"},ZBe={key:1,class:"fl-loading"},GBe=["onClick"],YBe={class:"folder-name"},XBe={key:0,class:"fl-empty"},JBe={class:"paste-row"},QBe={class:"paste-input-wrap"},eHe={key:1,class:"add-error",role:"alert"},tHe={class:"actions"},nHe={class:"footer-hint"},oHe=600,sHe=6,_S=150,iHe=et({__name:"AddWorkspaceDialog",props:{browseFs:{type:Function},getFsHome:{type:Function},defaultPath:{},error:{}},emits:["add","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!0),r=Z(!1),l=Z(!1),a=Z(""),u=Z(null),c=Z([]),d=Z(""),f=Z(!1),h=Z([]),m=R(()=>d.value.trim().length>0);let v=0,k=null;function w(U,z){const W=U.toLowerCase(),K=z.toLowerCase();let V=0;for(let ie=0;ie0&&ne=_S))break;X.depth+1{if(k&&clearTimeout(k),U.trim()===""){v++,h.value=[],f.value=!1;return}k=setTimeout(()=>void b(U),220)});const _=Z(!1),g=Z(""),x=R(()=>g.value.trim()),S=R(()=>{const U=a.value;if(!U)return[];const z=U.split("/").filter(Boolean),W=[{label:"/",path:"/"}];let K="";for(const V of z)K+=`/${V}`,W.push({label:V,path:K});return W}),T=R(()=>a.value.length>0);async function A(U){r.value=!0;try{const z=await o.browseFs(U);if(!z.path){l.value=!0;return}a.value=z.path,u.value=z.parent,c.value=z.entries,d.value="",l.value=!1}catch{l.value=!0}finally{r.value=!1}}function E(U){U.isDir&&A(U.path)}function P(){u.value&&A(u.value)}function D(){T.value&&s("add",a.value)}function I(){x.value.length!==0&&s("add",x.value)}const{handleCompositionStart:$,handleCompositionEnd:B,isComposingKeyEvent:H}=Ar();function O(U){H(U)||I()}function F(U){U.key==="Escape"&&H(U)&&U.stopPropagation()}return dn(async()=>{r.value=!0;try{if(o.defaultPath&&(await A(o.defaultPath),!l.value))return;const U=await o.getFsHome();U.home?await A(U.home):l.value=!0}catch{l.value=!0}finally{r.value=!1}}),bn(()=>{k&&clearTimeout(k)}),(U,z)=>(y(),he(p(ua),{open:i.value,"onUpdate:open":z[5]||(z[5]=W=>i.value=W),title:p(n)("workspace.addTitle"),size:"lg",height:"fixed",padded:!1,onClose:z[6]||(z[6]=W=>s("close"))},{default:me(()=>[C("div",OBe,[l.value?ee("",!0):(y(),M(Pe,{key:0},[C("div",PBe,[j(p(gn),{size:"sm",disabled:!u.value,label:p(n)("workspace.up"),tooltip:p(n)("workspace.up"),onClick:P},{default:me(()=>[j(p(Te),{name:"arrow-up",size:"md"})]),_:1},8,["disabled","label","tooltip"]),C("div",DBe,[(y(!0),M(Pe,null,pt(S.value,(W,K)=>(y(),M(Pe,{key:W.path},[K>1?(y(),M("span",BBe,"/")):ee("",!0),C("button",{class:Re(["crumb",{last:K===S.value.length-1}]),onClick:V=>A(W.path)},N(W.label),11,HBe)],64))),128))])]),r.value?ee("",!0):(y(),M("div",zBe,[j(p(Te),{class:"filter-icon",name:"search",size:"md"}),Bn(C("input",{"onUpdate:modelValue":z[0]||(z[0]=W=>d.value=W),class:"filter-input",type:"text",placeholder:p(n)("workspace.searchPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:z[1]||(z[1]=It(()=>{},["stop"]))},null,40,WBe),[[ai,d.value]]),f.value?(y(),he(p(Ao),{key:0,size:"sm"})):ee("",!0)])),C("div",UBe,[r.value?(y(),M("div",jBe,N(p(n)("workspace.browsing")),1)):m.value?(y(),M(Pe,{key:1},[(y(!0),M(Pe,null,pt(h.value,W=>(y(),M("button",{key:W.path,class:"folder-row",onClick:K=>A(W.path)},[j(p(Te),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",qBe,N(W.rel),1)],8,VBe))),128)),!f.value&&h.value.length===0?(y(),M("div",KBe,N(p(n)("workspace.noFilterMatch",{q:d.value.trim()})),1)):f.value&&h.value.length===0?(y(),M("div",ZBe,N(p(n)("workspace.searching")),1)):ee("",!0)],64)):(y(),M(Pe,{key:2},[(y(!0),M(Pe,null,pt(c.value,W=>(y(),M("button",{key:W.path,class:"folder-row",onClick:K=>E(W)},[j(p(Te),{class:"dir-icon",name:"folder-closed",size:"sm"}),C("span",YBe,N(W.name),1)],8,GBe))),128)),c.value.length===0?(y(),M("div",XBe,N(p(n)("workspace.noSubfolders")),1)):ee("",!0)],64))])],64)),C("div",{class:Re(["paste-section",{"paste-only":l.value}])},[!l.value&&!_.value?(y(),he(p(Rt),{key:0,variant:"ghost",size:"sm",onClick:z[2]||(z[2]=W=>_.value=!0)},{default:me(()=>[qe(N(p(n)("workspace.pasteToggle")),1)]),_:1})):(y(),he(p(IW),{key:1,label:p(n)("workspace.pathLabel")},{default:me(()=>[C("div",JBe,[C("div",QBe,[j(p(js),{modelValue:g.value,"onUpdate:modelValue":z[3]||(z[3]=W=>g.value=W),placeholder:p(n)("workspace.pathPlaceholder"),autocomplete:"off",spellcheck:"false",onKeydown:[xl(It(O,["stop"]),["enter"]),F],onCompositionstart:p($),onCompositionend:p(B)},null,8,["modelValue","placeholder","onKeydown","onCompositionstart","onCompositionend"])]),j(p(gn),{disabled:x.value.length===0,label:p(n)("workspace.add"),tooltip:p(n)("workspace.add"),onClick:I},{default:me(()=>[j(p(Te),{name:"plus",size:"md"})]),_:1},8,["disabled","label","tooltip"])])]),_:1},8,["label"]))],2),e.error?(y(),M("div",eHe,N(e.error),1)):ee("",!0),C("div",tHe,[j(p(pn),{text:a.value},{default:me(()=>[l.value?ee("",!0):(y(),he(p(Rt),{key:0,variant:"primary",disabled:!T.value,onClick:D},{default:me(()=>[qe(N(p(n)("workspace.openThisFolder")),1)]),_:1},8,["disabled"]))]),_:1},8,["text"]),j(p(Rt),{variant:"secondary",onClick:z[4]||(z[4]=W=>s("close"))},{default:me(()=>[qe(N(p(n)("workspace.cancel")),1)]),_:1})]),C("div",nHe,N(p(n)("workspace.browseHint")),1)])]),_:1},8,["open","title"]))}}),rHe=ft(iHe,[["__scopeId","data-v-fea98be5"]]),lHe={key:0,class:"confirm-dialog__message"},aHe=et({__name:"ConfirmDialog",props:{open:{type:Boolean},title:{},message:{},confirmLabel:{},cancelLabel:{},variant:{default:"danger"},loading:{type:Boolean}},emits:["update:open","confirm","cancel"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt();function i(){n.loading||(o("update:open",!1),o("cancel"))}function r(l){if(l.key!=="Enter"||!n.open||n.loading)return;const a=l.target;a instanceof HTMLButtonElement||a instanceof HTMLAnchorElement||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement||a instanceof HTMLInputElement||(l.preventDefault(),o("confirm"))}return typeof window<"u"&&window.addEventListener("keydown",r),Vn(()=>{typeof window<"u"&&window.removeEventListener("keydown",r)}),(l,a)=>(y(),he(p(ua),{open:e.open,title:e.title,height:"auto","initial-focus":".confirm-dialog__confirm","close-on-esc":!e.loading,"close-on-overlay":!e.loading,"onUpdate:open":a[1]||(a[1]=u=>o("update:open",u)),onClose:i},{foot:me(()=>[j(p(Rt),{variant:"secondary",disabled:e.loading,onClick:i},{default:me(()=>[qe(N(e.cancelLabel??p(s)("common.cancel")),1)]),_:1},8,["disabled"]),j(p(Rt),{class:"confirm-dialog__confirm",variant:e.variant,loading:e.loading,onClick:a[0]||(a[0]=u=>o("confirm"))},{default:me(()=>[qe(N(e.confirmLabel??p(s)("common.confirm")),1)]),_:1},8,["variant","loading"])]),default:me(()=>[e.message?(y(),M("p",lHe,N(e.message),1)):ee("",!0)]),_:1},8,["open","title","close-on-esc","close-on-overlay"]))}}),uHe=ft(aHe,[["__scopeId","data-v-aa5422da"]]),cHe=et({__name:"ConfirmDialogHost",setup(e){const{current:t,busy:n,settle:o,runAction:s}=hu();function i(){s()}return(r,l)=>p(t)!==null?(y(),he(uHe,{key:0,open:!0,title:p(t).title,message:p(t).message,"confirm-label":p(t).confirmLabel,"cancel-label":p(t).cancelLabel,variant:p(t).variant,loading:p(n),onConfirm:i,onCancel:l[0]||(l[0]=a=>p(o)(!1))},null,8,["title","message","confirm-label","cancel-label","variant","loading"])):ee("",!0)}}),dHe={class:"rows"},fHe={class:"row"},pHe={class:"row"},hHe={class:"row"},mHe={class:"row"},gHe={class:"row"},vHe={class:"row"},yHe={class:"ctx-text"},kHe={key:0,class:"bar"},bHe={class:"row"},CHe=et({__name:"StatusPanel",props:{status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},costUsd:{}},emits:["close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z(!0),r=R(()=>o.status.ctxMax<=0?0:Math.min(100,Math.max(0,Math.ceil(o.status.ctxUsed/o.status.ctxMax*100)))),l=R(()=>o.status.ctxMax>0?n("status.statusContextValue",{used:Al(o.status.ctxUsed),max:Al(o.status.ctxMax),pct:r.value}):n("status.statusNone"));function a(m){return n(m==="yolo"?"status.permissionYolo":m==="auto"?"status.permissionAuto":"status.permissionManual")}const u=R(()=>{const m=o.status.permission;return m==="auto"?"var(--color-danger)":m==="yolo"?"var(--color-warning)":"var(--color-text)"}),c=R(()=>o.planMode?n("status.planOn"):n("status.planOff")),d=R(()=>o.swarmMode?n("status.swarmOn"):n("status.swarmOff")),f=R(()=>typeof o.costUsd=="number"&&o.costUsd>0),h=R(()=>f.value?`$${o.costUsd.toFixed(4)}`:n("status.statusNone"));return(m,v)=>(y(),he(p(ua),{open:i.value,"onUpdate:open":v[0]||(v[0]=k=>i.value=k),title:p(n)("status.statusPanelTitle"),onClose:v[1]||(v[1]=k=>s("close"))},{default:me(()=>[C("dl",dHe,[C("div",fHe,[C("dt",null,N(p(n)("status.statusModel")),1),C("dd",null,N(e.status.model),1)]),C("div",pHe,[C("dt",null,N(p(n)("status.statusThinking")),1),C("dd",null,N(e.thinking),1)]),C("div",hHe,[C("dt",null,N(p(n)("status.statusPermission")),1),C("dd",{style:Zt({color:u.value})},N(a(e.status.permission)),5)]),C("div",mHe,[C("dt",null,N(p(n)("status.statusPlanMode")),1),C("dd",{class:Re({"plan-on":e.planMode})},N(c.value),3)]),C("div",gHe,[C("dt",null,N(p(n)("status.statusSwarmMode")),1),C("dd",{class:Re({"swarm-on":e.swarmMode})},N(d.value),3)]),C("div",vHe,[C("dt",null,N(p(n)("status.statusContext")),1),C("dd",null,[C("span",yHe,N(l.value),1),e.status.ctxMax>0?(y(),M("span",kHe,[C("i",{style:Zt({width:r.value+"%"})},null,4)])):ee("",!0)])]),C("div",bHe,[C("dt",null,N(p(n)("status.statusCost")),1),C("dd",null,N(h.value),1)])])]),_:1},8,["open","title"]))}}),wHe=ft(CHe,[["__scopeId","data-v-340d1b31"]]),_He={key:0,class:"actions"},xHe=["onClick"],SHe=["onClick"],AHe={key:1,class:"details"},MHe=et({__name:"WarningToasts",props:{warnings:{}},emits:["dismiss"],setup(e,{emit:t}){const n=e,o=t,{t:s}=Nt();function i(E){return typeof E=="object"&&E!==null}function r(E){return i(E)?E.title:E}function l(E){return i(E)?E.message??"":""}function a(E){return i(E)?E.details:void 0}function u(E){return i(E)?E.severity==="error":E.startsWith(`${s("warnings.errorLabel")}:`)||/\b4\d\d\b|error|失败|failed/i.test(E)}function c(E){return i(E)?E.severity==="error"?"danger":E.severity==="success"?"success":E.severity==="info"?"info":"warning":u(E)?"danger":"warning"}function d(E){return i(E)?`notice:${E.severity}:${E.title}:${E.message??""}:${JSON.stringify(E.details??[])}`:`text:${E}`}function f(E){if(!i(E))return E;const P=[E.title];E.message&&P.push(E.message);const D=E.details??[];if(D.length>0){P.push("",`${s("warnings.diagnostics")}:`);for(const I of D)P.push(`${I.label}: ${I.value}`)}return P.join(` `)}let h=1;const m=Z([]),v=new Map,k=new Map;function w(E){const P=u(E)?12e3:6e3;return typeof window<"u"&&window.matchMedia?.("(hover: none)").matches===!0?P+5e3:P}function b(E,P){const D=v.get(E)??{handle:null,deadline:0,remaining:0};D.handle=setTimeout(()=>A(E),P),D.deadline=Date.now()+P,v.set(E,D)}function _(E){const P=v.get(E);P&&P.handle!==null&&clearTimeout(P.handle),v.delete(E)}function g(E){const P=v.get(E);!P||P.handle===null||(clearTimeout(P.handle),P.handle=null,P.remaining=Math.max(0,P.deadline-Date.now()))}function x(E){if(m.value.find(I=>I.id===E)?.detailsOpen)return;const D=v.get(E);!D||D.handle!==null||b(E,D.remaining)}function S(E){E.detailsOpen=!E.detailsOpen,E.detailsOpen?g(E.id):x(E.id)}async function T(E){if(!await Zs(f(E.warning)))return;E.copied=!0;const D=k.get(E.id);D&&clearTimeout(D),k.set(E.id,setTimeout(()=>{E.copied=!1,k.delete(E.id)},1400))}function A(E){_(E);const P=k.get(E);P&&clearTimeout(P),k.delete(E);const D=m.value.findIndex(I=>I.id===E);D!==-1&&(m.value=m.value.filter(I=>I.id!==E),o("dismiss",D))}return Je(()=>n.warnings,E=>{const P=[...m.value];m.value=E.map(D=>{const I=d(D),$=P.findIndex(O=>O.key===I),B=$===-1?void 0:P.splice($,1)[0];if(B)return B.warning=D,B;const H={id:h++,key:I,warning:D,detailsOpen:!1,copied:!1};return b(H.id,w(D)),H});for(const D of P){_(D.id);const I=k.get(D.id);I&&clearTimeout(I),k.delete(D.id)}},{immediate:!0,flush:"post"}),bn(()=>{v.forEach(E=>{E.handle!==null&&clearTimeout(E.handle)}),v.clear(),k.forEach(E=>clearTimeout(E)),k.clear()}),(E,P)=>(y(),he(YA,{name:"toast",tag:"div",class:"toasts",role:"status","aria-live":"polite"},{default:me(()=>[(y(!0),M(Pe,null,pt(m.value,D=>(y(),he(p(cU),{key:D.id,variant:c(D.warning),title:r(D.warning),message:l(D.warning),"dismiss-label":p(s)("warnings.dismiss"),onDismiss:I=>A(D.id),onPointerenter:I=>g(D.id),onPointerleave:I=>x(D.id)},{default:me(()=>[a(D.warning)?.length?(y(),M("div",_He,[C("button",{class:"link",type:"button",onClick:I=>S(D)},N(D.detailsOpen?p(s)("warnings.hideDetails"):p(s)("warnings.showDetails")),9,xHe),C("button",{class:"link",type:"button",onClick:I=>T(D)},N(D.copied?p(s)("warnings.copied"):p(s)("warnings.copyDetails")),9,SHe)])):ee("",!0),D.detailsOpen&&a(D.warning)?.length?(y(),M("dl",AHe,[(y(!0),M(Pe,null,pt(a(D.warning),I=>(y(),M("div",{key:`${I.label}:${I.value}`,class:"detail-row"},[C("dt",null,N(I.label),1),C("dd",null,N(I.value),1)]))),128))])):ee("",!0)]),_:2},1032,["variant","title","message","dismiss-label","onDismiss","onPointerenter","onPointerleave"]))),128))]),_:1}))}}),THe=ft(MHe,[["__scopeId","data-v-ac44e9ef"]]),EHe={class:"topbar"},IHe={class:"wsq"},LHe=["aria-label"],$He={class:"tb-path"},NHe={class:"ws"},FHe={class:"se"},RHe={class:"tb-sub"},OHe=et({__name:"MobileTopBar",props:{workspace:{default:null},sessionTitle:{default:""},running:{type:Boolean,default:!1},branch:{default:""},sessionCount:{default:0}},emits:["openSwitcher","openSettings"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=R(()=>{const a=o.workspace,c=(a?.name||a?.root||"").trim().charAt(0);return c?c.toUpperCase():"K"}),r=R(()=>o.workspace?.name??n("workspace.noWorkspace")),l=R(()=>o.running?n("mobile.running"):n("mobile.idle"));return(a,u)=>(y(),M("div",EHe,[C("span",IHe,N(i.value),1),C("button",{type:"button",class:"tb-mid","aria-label":p(n)("mobile.openSwitcher"),onClick:u[0]||(u[0]=c=>s("openSwitcher"))},[C("span",$He,[C("span",NHe,N(r.value),1),e.sessionTitle?(y(),M(Pe,{key:0},[u[2]||(u[2]=C("span",{class:"sl"},"/",-1)),C("span",FHe,N(e.sessionTitle),1)],64)):ee("",!0),u[3]||(u[3]=C("span",{class:"cv"},"⌄",-1))]),C("span",RHe,[C("span",{class:Re(["rd",{on:e.running}])},null,2),C("span",null,N(l.value),1),e.branch?(y(),M(Pe,{key:0},[qe(" · "+N(e.branch),1)],64)):ee("",!0),e.sessionCount>0?(y(),M(Pe,{key:1},[qe(" · "+N(p(n)("mobile.sessionCount",{n:e.sessionCount})),1)],64)):ee("",!0)])],8,LHe),j(p(gn),{size:"lg",label:p(n)("mobile.openSettings"),onClick:u[1]||(u[1]=c=>s("openSettings"))},{default:me(()=>[j(p(Te),{name:"sliders",size:"lg"})]),_:1},8,["label"])]))}}),PHe=ft(OHe,[["__scopeId","data-v-7f357087"]]),DHe={key:0,class:"sheet-root"},BHe=["aria-label"],HHe=["aria-label"],zHe={key:0,class:"sheet-head"},WHe={class:"sheet-title"},UHe={class:"sheet-body"},jHe=et({__name:"BottomSheet",props:{modelValue:{type:Boolean},title:{default:""},closeOnEsc:{type:Boolean,default:!0}},emits:["update:modelValue","close"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t;function i(){s("update:modelValue",!1),s("close")}function r(l){l.key==="Escape"&&o.closeOnEsc&&i()}return Je(()=>o.modelValue,l=>{typeof document>"u"||(l?document.addEventListener("keydown",r):document.removeEventListener("keydown",r))},{immediate:!0}),bn(()=>{typeof document<"u"&&document.removeEventListener("keydown",r)}),(l,a)=>(y(),he(as,{name:"sheet"},{default:me(()=>[e.modelValue?(y(),M("div",DHe,[C("div",{class:"sheet-scrim",onClick:i}),C("div",{class:"sheet-panel",role:"dialog","aria-label":e.title||p(n)("mobile.sheetLabel")},[C("button",{type:"button",class:"sheet-grab","aria-label":p(n)("mobile.closeSheet"),onClick:i},null,8,HHe),e.title?(y(),M("div",zHe,[C("span",WHe,N(e.title),1)])):ee("",!0),C("div",UHe,[xn(l.$slots,"default",{},void 0,!0)])],8,BHe)])):ee("",!0)]),_:3}))}}),CF=ft(jHe,[["__scopeId","data-v-c3d5dadc"]]),VHe={class:"mlist"},qHe={key:0,class:"mempty"},KHe=["onClick"],ZHe={class:"mgh-main"},GHe={class:"mgh-name"},YHe={class:"mgh-path"},XHe={key:2,class:"att"},JHe={key:0,class:"mempty small"},QHe=["onClick"],eze={class:"m"},tze={class:"s"},nze={key:0,class:"att"},oze={key:1,class:"mshow-more-row"},sze=["disabled","onClick"],ize={key:1,class:"mshow-more-sep","aria-hidden":"true"},rze=["onClick"],lze=et({__name:"MobileSwitcherSheet",props:{modelValue:{type:Boolean},groups:{},activeWorkspaceId:{default:null},activeId:{},attentionBySession:{default:()=>({})},attentionByWorkspace:{default:()=>({})}},emits:["update:modelValue","select","create","createInWorkspace","addWorkspace","rename","archive","deleteWorkspace","loadMore"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t;function i(){s("update:modelValue",!1)}function r($){s("select",$),i()}function l($){s("createInWorkspace",$),i()}function a(){s("create"),i()}function u(){s("addWorkspace"),i()}const c=Z(new Set);function d($){return c.value.has($)}function f($){const B=new Set(c.value);B.has($)?B.delete($):B.add($),c.value=B,x.value=null,E.value=null}const h=Z(new Map);function m($){return h.value.get($.workspace.id)??$.initialCount}function v($){const B=$.sessions.slice(0,m($));if(o.activeId&&!B.some(H=>H.id===o.activeId)){const H=$.sessions.find(O=>O.id===o.activeId);if(H)return[...B,H]}return B}function k($){return $.sessions.length>m($)||$.hasMore||$.loadingMore}function w($){return m($)>$.initialCount}function b($){const B=o.groups.find(F=>F.workspace.id===$);if(!B)return;const H=m(B)+O5,O=new Map(h.value);O.set($,H),h.value=O,B.sessions.length(y(),he(CF,{"model-value":e.modelValue,"onUpdate:modelValue":B[2]||(B[2]=H=>s("update:modelValue",H))},{default:me(()=>[C("button",{type:"button",class:"newrow",onClick:a},[j(p(Te),{name:"message",size:"sm"}),qe(" "+N(p(n)("sidebar.newChat")),1)]),C("button",{type:"button",class:"newrow secondary",onClick:u},[j(p(Te),{name:"folder",size:"sm"}),qe(" "+N(p(n)("sidebar.newWorkspace")),1)]),C("div",VHe,[e.groups.length===0?(y(),M("div",qHe,N(p(n)("workspace.noWorkspace")),1)):ee("",!0),(y(!0),M(Pe,null,pt(e.groups,H=>(y(),M("div",{key:H.workspace.id,class:"mgroup"},[C("div",{class:Re(["mgh",{on:H.workspace.id===e.activeWorkspaceId}]),onClick:O=>f(H.workspace.id)},[d(H.workspace.id)?(y(),he(p(Te),{key:0,class:"mgh-folder",name:"folder-closed",size:"sm"})):(y(),he(p(Te),{key:1,class:"mgh-folder",name:"folder",size:"sm"})),C("div",ZHe,[C("span",GHe,N(H.workspace.name),1),j(p(pn),{text:H.workspace.root},{default:me(()=>[C("span",YHe,N(H.workspace.shortPath),1)]),_:2},1032,["text"])]),d(H.workspace.id)&&g(H.workspace.id)>0?(y(),M("span",XHe,N(g(H.workspace.id)),1)):ee("",!0),j(p(gn),{size:"lg",class:"mgh-more",label:p(n)("sidebar.options"),onClick:It(O=>P(H.workspace.id),["stop"])},{default:me(()=>[j(p(Te),{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),j(p(gn),{size:"lg",class:"mgh-add",label:p(n)("workspace.newInGroup"),onClick:It(O=>l(H.workspace.id),["stop"])},{default:me(()=>[j(p(Te),{name:"plus",size:"md"})]),_:1},8,["label","onClick"]),E.value===H.workspace.id?(y(),he(p(Cl),{key:3,class:"kmenu wsmenu",onClick:B[0]||(B[0]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{size:"lg",onClick:O=>D(H.workspace)},{default:me(()=>[qe(N(p(n)("sidebar.copyPath")),1)]),_:1},8,["onClick"]),j(p(hn),{size:"lg",danger:"",onClick:O=>I(H.workspace)},{default:me(()=>[qe(N(p(n)("sidebar.delete")),1)]),_:1},8,["onClick"])]),_:2},1024)):ee("",!0)],10,KHe),Bn(C("div",null,[H.sessions.length===0?(y(),M("div",JHe,N(p(n)("sidebar.noSessions")),1)):ee("",!0),(y(!0),M(Pe,null,pt(v(H),O=>(y(),M("div",{key:O.id,class:Re(["srow",{cur:O.id===e.activeId}]),onClick:F=>r(O.id)},[C("div",eze,[C("div",{class:Re(["t",{run:O.busy,aborted:!O.busy&&(e.attentionBySession[O.id]??0)===0&&O.lastTurnReason==="failed"}])},N(O.title),3),C("div",tze,N(O.time),1)]),(e.attentionBySession[O.id]??0)>0?(y(),M("span",nze,N(e.attentionBySession[O.id]),1)):ee("",!0),j(p(gn),{size:"lg",class:"kb",label:p(n)("sidebar.options"),onClick:It(F=>S(O.id),["stop"])},{default:me(()=>[j(p(Te),{name:"dots-horizontal",size:"md"})]),_:1},8,["label","onClick"]),x.value===O.id?(y(),he(p(Cl),{key:1,class:"kmenu",onClick:B[1]||(B[1]=It(()=>{},["stop"]))},{default:me(()=>[j(p(hn),{size:"lg",onClick:F=>T(O)},{default:me(()=>[qe(N(p(n)("sidebar.rename")),1)]),_:1},8,["onClick"]),j(p(hn),{size:"lg",onClick:F=>A(O.id)},{default:me(()=>[qe(N(p(n)("sidebar.archive")),1)]),_:1},8,["onClick"])]),_:2},1024)):ee("",!0)],10,QHe))),128)),k(H)||w(H)?(y(),M("div",oze,[k(H)?(y(),M("button",{key:0,type:"button",class:"mshow-more",disabled:H.loadingMore,onClick:It(O=>b(H.workspace.id),["stop"])},[j(p(Te),{name:"chevron-down",size:"sm"}),qe(" "+N(H.loadingMore?p(n)("sidebar.loadingMore"):p(n)("sidebar.showMore")),1)],8,sze)):ee("",!0),k(H)&&w(H)?(y(),M("span",ize,"·")):ee("",!0),w(H)?(y(),M("button",{key:2,type:"button",class:"mshow-more",onClick:It(O=>_(H.workspace.id),["stop"])},[j(p(Te),{name:"chevron-up",size:"sm"}),qe(" "+N(p(n)("sidebar.showLess")),1)],8,rze)):ee("",!0)])):ee("",!0)],512),[[qs,!d(H.workspace.id)]])]))),128))])]),_:1},8,["model-value"]))}}),aze=ft(lze,[["__scopeId","data-v-67278201"]]),uze={class:"group-title"},cze={class:"srow-main"},dze={class:"srow-label"},fze={class:"srow-sub"},pze={class:"srow read-only"},hze={class:"srow-main"},mze={class:"srow-label"},gze={key:0,class:"srow-sub"},vze={class:"cache-note"},yze={class:"srow-main"},kze={class:"srow-label"},bze={class:"srow-sub"},Cze=["aria-checked"],wze={class:"srow-main"},_ze={class:"srow-label"},xze={class:"srow-sub"},Sze=["aria-checked"],Aze={class:"srow-main"},Mze={class:"srow-label"},Tze={class:"srow read-only"},Eze={class:"srow-main"},Ize={class:"srow-label"},Lze={class:"srow-sub"},$ze=["aria-label"],Nze={class:"group-title"},Fze={class:"srow-main"},Rze={class:"srow-label"},Oze={class:"srow-sub"},Pze={class:"srow read-only pref"},Dze={class:"srow-main"},Bze={class:"srow-label"},Hze={class:"srow read-only pref"},zze={class:"srow-main"},Wze={class:"srow-label"},Uze={class:"srow read-only pref"},jze={class:"srow-main"},Vze={class:"srow-label"},qze={key:0,class:"srow read-only acct-profile"},Kze={class:"acct-avatar","aria-hidden":"true"},Zze=["src"],Gze={class:"srow-main"},Yze={class:"acct-name-row"},Xze={class:"srow-label"},Jze={class:"srow-sub"},Qze={class:"srow-main"},eWe={class:"srow-label"},tWe={class:"srow-main"},nWe={class:"srow-label"},oWe={key:3,class:"srow read-only"},sWe={class:"srow-main"},iWe={class:"srow-label"},rWe={class:"srow-val dim"},lWe={class:"arch-subhead"},aWe={class:"arch-count"},uWe={class:"arch-tools"},cWe={key:0,class:"arch-empty"},dWe={class:"arch-meta"},fWe={class:"arch-name"},pWe={class:"arch-time"},hWe={key:2,class:"arch-empty"},mWe=100,gWe=et({__name:"MobileSettingsSheet",props:{modelValue:{type:Boolean},initialView:{},status:{},thinking:{},planMode:{type:Boolean},swarmMode:{type:Boolean},colorScheme:{default:"system"},fontScale:{default:"medium"},managedProviderStatus:{default:null},managedUserInfo:{default:null},serverVersion:{default:""},models:{default:()=>[]}},emits:["update:modelValue","pickModel","setThinking","togglePlan","toggleSwarm","setPermission","setColorScheme","setFontScale","login","logout"],setup(e,{emit:t}){const{t:n}=Nt(),{isConfirmOpen:o}=hu(),s=e,i=t;function r(X){i("setColorScheme",X)}const l=["manual","yolo","auto"],a=R(()=>s.models?.find(X=>X.id===s.status?.modelId)),u=R(()=>p2(a.value)),c=R(()=>Up(a.value)),d=R(()=>Dm(a.value,s.thinking)),f=R(()=>c.value.includes(d.value)?d.value:""),h=R(()=>c.value.map(X=>({value:X,label:y3(X)}))),m=R(()=>s.planMode===!0),v=R(()=>s.swarmMode===!0),k=Z(!1);Je(()=>s.managedUserInfo?.avatar,()=>{k.value=!1});const w=R(()=>!!s.managedUserInfo?.avatar&&!k.value),b=R(()=>s.managedUserInfo?.userLevelName?.trim()??""),_=R(()=>{const X=s.status.permission;return X==="auto"?"var(--color-danger)":X==="yolo"?"var(--color-warning)":"var(--color-text-muted)"}),g=R(()=>{const X=s.status.permission,le=n(X==="yolo"?"mobile.permYoloSub":X==="auto"?"mobile.permAutoSub":"mobile.permManualSub");return`${X} · ${le}`}),x=R(()=>s.status.ctxMax>0?Math.min(100,Math.max(0,Math.ceil(s.status.ctxUsed/s.status.ctxMax*100))):0),S=R(()=>s.status.ctxMax>0?`${Al(s.status.ctxUsed)}/${Al(s.status.ctxMax)}`:n("status.statusNone"));function T(X){i("setThinking",My(a.value,X))}function A(){const X=l.indexOf(s.status.permission),le=l[(X+1)%l.length];i("setPermission",le)}function E(){i("pickModel"),i("update:modelValue",!1)}function P(){i("login"),i("update:modelValue",!1)}function D(){i("logout"),i("update:modelValue",!1)}const I=mu(),$=Z("main"),B=Z([]),H=Z(!1),O=Z(!1),F=Z(""),U=Z("archived-desc");async function z(){if(!H.value){H.value=!0,O.value=!1;try{const X=[];let le;for(;;){const Ie=await I.loadArchivedSessions({beforeId:le,pageSize:mWe});if(X.push(...Ie.items),!Ie.hasMore||Ie.items.length===0)break;const de=Ie.items.at(-1)?.id;if(de===void 0)break;le=de}B.value=X,O.value=!0}catch(X){gl("loadAllArchived failed",X)}finally{H.value=!1}}}function W(){$.value="archived",F.value="",z()}Je(()=>s.modelValue,X=>{X&&s.initialView==="archived"&&W()});function K(){$.value="main"}const V=R(()=>{const X=F.value.trim().toLowerCase();let le=B.value.filter(Ie=>Ie.archived===!0);return X&&(le=le.filter(Ie=>Ie.title.toLowerCase().includes(X))),le=le.slice(),U.value==="archived-desc"?le.sort((Ie,de)=>de.updatedAt.localeCompare(Ie.updatedAt)):U.value==="created-desc"?le.sort((Ie,de)=>de.createdAt.localeCompare(Ie.createdAt)):le.sort((Ie,de)=>Ie.title.localeCompare(de.title,"zh")),le});async function ie(X){await I.restoreSession(X)&&(B.value=B.value.filter(Ie=>Ie.id!==X))}function ne(X){const le=new Date(X);if(Number.isNaN(le.getTime()))return X;const Ie=de=>String(de).padStart(2,"0");return`${le.getFullYear()}-${Ie(le.getMonth()+1)}-${Ie(le.getDate())} ${Ie(le.getHours())}:${Ie(le.getMinutes())}`}return Je(()=>s.modelValue,X=>{X||($.value="main")}),(X,le)=>(y(),he(CF,{"model-value":e.modelValue,title:p(n)("mobile.settingsTitle"),"close-on-esc":!p(o),"onUpdate:modelValue":le[6]||(le[6]=Ie=>i("update:modelValue",Ie))},{default:me(()=>[$.value==="main"?(y(),M(Pe,{key:0},[C("div",uze,N(p(n)("mobile.groupSession")),1),C("button",{type:"button",class:"srow",onClick:E},[C("span",cze,[C("span",dze,N(p(n)("status.statusModel")),1),C("span",fze,N(e.status.model),1)]),le[7]||(le[7]=C("span",{class:"chev"},"›",-1))]),C("div",pze,[C("span",hze,[C("span",mze,N(p(n)("status.statusThinking")),1),u.value==="unsupported"?(y(),M("span",gze,N(p(n)("status.modeNotSupported")),1)):ee("",!0)]),c.value.length>1?(y(),he(p(wi),{key:0,"model-value":f.value,options:h.value,size:"sm","onUpdate:modelValue":T},null,8,["model-value","options"])):(y(),M("span",{key:1,class:Re(["srow-val",{dim:d.value==="off"}])},N(d.value==="off"?p(n)("status.planOff"):p(y3)(d.value)),3))]),C("div",vze,N(p(n)("status.cacheNote")),1),C("button",{type:"button",class:"srow",onClick:le[0]||(le[0]=Ie=>i("togglePlan"))},[C("span",yze,[C("span",kze,N(p(n)("status.statusPlanMode")),1),C("span",bze,N(p(n)("mobile.planModeSub")),1)]),C("span",{class:Re(["toggle",{on:m.value}]),role:"switch","aria-checked":m.value},null,10,Cze)]),C("button",{type:"button",class:"srow",onClick:le[1]||(le[1]=Ie=>i("toggleSwarm"))},[C("span",wze,[C("span",_ze,N(p(n)("status.statusSwarmMode")),1),C("span",xze,N(p(n)("mobile.swarmModeSub")),1)]),C("span",{class:Re(["toggle",{on:v.value}]),role:"switch","aria-checked":v.value},null,10,Sze)]),C("button",{type:"button",class:"srow",onClick:A},[C("span",Aze,[C("span",Mze,N(p(n)("status.statusPermission")),1),C("span",{class:"srow-sub",style:Zt({color:_.value})},N(g.value),5)]),le[8]||(le[8]=C("span",{class:"chev"},"›",-1))]),C("div",Tze,[C("span",Eze,[C("span",Ize,N(p(n)("status.statusContext")),1),C("span",Lze,N(S.value),1)]),C("span",{class:"ctx-meter","aria-label":S.value},[C("i",{style:Zt({width:x.value+"%"})},null,4)],8,$ze)]),C("div",Nze,N(p(n)("mobile.groupApp")),1),C("button",{type:"button",class:"srow",onClick:W},[C("span",Fze,[C("span",Rze,N(p(n)("mobile.archivedSessions")),1),C("span",Oze,N(p(n)("mobile.archivedSessionsSub")),1)]),le[9]||(le[9]=C("span",{class:"chev"},"›",-1))]),C("div",Pze,[C("span",Dze,[C("span",Bze,N(p(n)("theme.colorSchemeLabel")),1)]),j(p(wi),{"model-value":e.colorScheme??"system",options:[{value:"light",label:p(n)("theme.light"),icon:"light-mode"},{value:"dark",label:p(n)("theme.dark"),icon:"dark-mode"},{value:"system",label:p(n)("theme.system")}],"onUpdate:modelValue":r},null,8,["model-value","options"])]),C("div",Hze,[C("span",zze,[C("span",Wze,N(p(n)("sidebar.language")),1)]),j(yF)]),C("div",Uze,[C("span",jze,[C("span",Vze,N(p(n)("settings.uiFontSize")),1)]),j(p(wi),{"model-value":e.fontScale,options:[{value:"small",label:"S"},{value:"medium",label:"M"},{value:"large",label:"L"},{value:"xlarge",label:"XL"}],"aria-label":p(n)("settings.uiFontSize"),"onUpdate:modelValue":le[2]||(le[2]=Ie=>i("setFontScale",Ie))},null,8,["model-value","aria-label"])]),e.managedProviderStatus==="authenticated"?(y(),M("div",qze,[C("span",Kze,[w.value?(y(),M("img",{key:0,src:e.managedUserInfo?.avatar,alt:"",onError:le[3]||(le[3]=Ie=>k.value=!0)},null,40,Zze)):(y(),he(p(Te),{key:1,name:"user",size:"md"}))]),C("span",Gze,[C("span",Yze,[C("span",Xze,N(e.managedUserInfo?.nickname||p(n)("sidebar.defaultUserName")),1),b.value?(y(),he(p(Vr),{key:0,class:"acct-level",variant:"neutral",size:"sm"},{default:me(()=>[qe(N(b.value),1)]),_:1})):ee("",!0)]),C("span",Jze,N(p(n)("settings.signedIn")),1)])])):ee("",!0),e.managedProviderStatus==="authenticated"?(y(),M("button",{key:1,type:"button",class:"srow acct out",onClick:D},[C("span",Qze,[C("span",eWe,N(p(n)("sidebar.signOut")),1)])])):(y(),M("button",{key:2,type:"button",class:"srow acct in",onClick:P},[C("span",tWe,[C("span",nWe,N(p(n)("sidebar.signIn")),1)])])),e.serverVersion?(y(),M("div",oWe,[C("span",sWe,[C("span",iWe,N(p(n)("settings.serverVersion")),1)]),C("span",rWe,N(e.serverVersion),1)])):ee("",!0)],64)):(y(),M(Pe,{key:1},[C("div",lWe,[C("button",{type:"button",class:"arch-back",onClick:K},[le[10]||(le[10]=C("span",{class:"chev back"},"‹",-1)),qe(" "+N(p(n)("mobile.archivedBack")),1)]),C("span",aWe,N(p(n)("mobile.sessionCount",{n:V.value.length})),1)]),C("div",uWe,[j(p(js),{class:"arch-search-input","model-value":F.value,size:"sm",placeholder:p(n)("settings.archivedSearch"),"onUpdate:modelValue":le[4]||(le[4]=Ie=>F.value=Ie)},null,8,["model-value","placeholder"]),j(p(wi),{size:"sm","model-value":U.value,options:[{value:"archived-desc",label:p(n)("settings.archivedSortArchived")},{value:"created-desc",label:p(n)("settings.archivedSortCreated")},{value:"name-asc",label:p(n)("settings.archivedSortName")}],"onUpdate:modelValue":le[5]||(le[5]=Ie=>U.value=Ie)},null,8,["model-value","options"])]),H.value?(y(),M("div",cWe,N(p(n)("settings.archivedLoadingAll")),1)):V.value.length>0?(y(!0),M(Pe,{key:1},pt(V.value,Ie=>(y(),M("div",{key:Ie.id,class:"arch-row"},[C("div",dWe,[C("div",fWe,N(Ie.title),1),C("div",pWe,N(p(n)("settings.archivedAt",{time:ne(Ie.updatedAt)})),1)]),j(p(Rt),{variant:"secondary",size:"sm",onClick:de=>ie(Ie.id)},{default:me(()=>[qe(N(p(n)("settings.archivedRestore")),1)]),_:1},8,["onClick"])]))),128)):(y(),M("div",hWe,N(B.value.length===0?p(n)("settings.archivedEmpty"):p(n)("settings.archivedNoMatch")),1))],64))]),_:1},8,["model-value","title","close-on-esc"]))}}),vWe=ft(gWe,[["__scopeId","data-v-41a9e678"]]),yWe=["mask"],kWe=et({__name:"BrandLogo",props:{size:{default:64}},setup(e){const t=`bl-eyes-${kO()}`,n=Z(null);let o;function s(){const i=n.value;i&&(i.classList.remove("blink-now"),i.getBoundingClientRect(),i.classList.add("blink-now"),clearTimeout(o),o=setTimeout(()=>i.classList.remove("blink-now"),300))}return Vn(()=>clearTimeout(o)),(i,r)=>(y(),M("svg",{ref_key:"logoRef",ref:n,class:"brand-logo",style:Zt({width:`${e.size}px`,height:`${e.size*22/32}px`}),viewBox:"0 0 32 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-label":"Kimi Code",onClick:s},[C("defs",null,[C("mask",{id:t,maskUnits:"userSpaceOnUse"},[...r[0]||(r[0]=[C("rect",{x:"0",y:"0",width:"32",height:"22",fill:"#fff"},null,-1),C("g",{class:"ch-eyes",fill:"#000"},[C("rect",{class:"ch-eye",x:"11.8",y:"7",width:"2.8",height:"8",rx:"1.4"}),C("rect",{class:"ch-eye",x:"17.4",y:"7",width:"2.8",height:"8",rx:"1.4"})],-1)])])]),C("rect",{x:"1",y:"1",width:"30",height:"20",rx:"6",fill:"var(--logo)",mask:`url(#${t})`},null,8,yWe)],4))}}),E8=ft(kWe,[["__scopeId","data-v-f04205a8"]]),bWe={key:0,class:"ls-done-card"},CWe={class:"ls-done-badge"},wWe={class:"ls-card-text"},_We={class:"ls-card-title"},xWe={class:"ls-card-hint"},SWe={key:1,class:"ls-cards"},AWe={class:"ls-card-text"},MWe={class:"ls-card-title"},TWe={class:"ls-reco"},EWe={class:"ls-card-hint"},IWe={class:"ls-card-logo ls-card-icon"},LWe={class:"ls-card-text"},$We={class:"ls-card-title"},NWe={class:"ls-card-hint"},FWe={key:2,class:"ls-flow"},RWe={key:0,class:"ls-center"},OWe={class:"ls-center-text"},PWe={key:1,class:"ls-device"},DWe={class:"ls-lead"},BWe=["href"],HWe={class:"ls-code-row"},zWe=["title"],WWe={class:"ls-status"},UWe={class:"ls-status-text"},jWe={class:"ls-countdown"},VWe={key:2,class:"ls-center"},qWe={class:"ls-center-text ls-success-text"},KWe={class:"ls-center-hint"},ZWe={class:"ls-center"},GWe={class:"ls-center-text ls-err-text"},YWe={class:"ls-center-hint"},XWe={class:"ls-actions"},JWe={class:"ls-center"},QWe={class:"ls-center-text ls-warn-text"},eUe={class:"ls-center-hint"},tUe={class:"ls-actions"},nUe=et({__name:"OnboardingLoginStep",props:{authReady:{type:Boolean},onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["success","addProvider"],setup(e,{emit:t}){const{t:n}=Nt(),o=e,s=t,i=Z("choice"),{step:r,pollError:l,flow:a,secondsLeft:u,startFlow:c,cancelFlow:d}=vF({onStartOAuthLogin:o.onStartOAuthLogin,onPollOAuthLogin:o.onPollOAuthLogin,onCancelOAuthLogin:o.onCancelOAuthLogin,onSuccess:()=>s("success")}),f=Z(!1);function h(){i.value="flow",c()}function m(){d(),i.value="choice"}async function v(){!a.value||!await Zs(a.value.verificationUriComplete)||(f.value=!0,setTimeout(()=>{f.value=!1},2e3))}function k(w){const b=Math.floor(w/60),_=w%60;return`${b}:${String(_).padStart(2,"0")}`}return(w,b)=>e.authReady?(y(),M("div",bWe,[C("span",CWe,[j(p(Te),{name:"check",size:"sm"})]),C("div",wWe,[C("div",_We,N(p(n)("onboarding.login.loggedInTitle")),1),C("div",xWe,N(p(n)("onboarding.login.loggedInHint")),1)])])):i.value==="choice"?(y(),M("div",SWe,[C("button",{class:"ls-card",type:"button",onClick:h},[j(E8,{size:40,class:"ls-card-logo"}),C("div",AWe,[C("div",MWe,[qe(N(p(n)("onboarding.login.kimiTitle"))+" ",1),C("span",TWe,N(p(n)("onboarding.login.recommended")),1)]),C("div",EWe,N(p(n)("onboarding.login.kimiHint")),1)]),j(p(Te),{name:"chevron-right",size:"lg",class:"ls-card-chevron"})]),C("button",{class:"ls-card",type:"button",onClick:b[0]||(b[0]=_=>s("addProvider"))},[C("span",IWe,[j(p(Te),{name:"bolt",size:"lg"})]),C("div",LWe,[C("div",$We,N(p(n)("onboarding.login.customProviderTitle")),1),C("div",NWe,N(p(n)("onboarding.login.customProviderHint")),1)]),j(p(Te),{name:"chevron-right",size:"lg",class:"ls-card-chevron"})])])):(y(),M("div",FWe,[p(r)==="starting"?(y(),M("div",RWe,[j(p(Ao),{size:"md"}),C("span",OWe,N(p(n)("login.starting")),1)])):p(r)==="device-code"&&p(a)?(y(),M("div",PWe,[C("div",DWe,N(p(n)("login.lead")),1),C("a",{class:"ls-primary",href:p(a).verificationUriComplete,target:"_blank",rel:"noopener noreferrer"},[qe(N(p(n)("login.authorizeInBrowser"))+" ",1),j(p(Te),{name:"external-link",size:"sm"})],8,BWe),C("div",HWe,[C("span",{class:"ls-link",title:p(a).verificationUriComplete},N(p(a).verificationUriComplete),9,zWe),j(p(Rt),{class:Re(["ls-copy",{"is-copied":f.value}]),variant:"secondary",size:"sm",onClick:v},{default:me(()=>[f.value?(y(),M(Pe,{key:0},[j(p(Te),{name:"check",size:"sm"}),qe(" "+N(p(n)("login.copied")),1)],64)):(y(),M(Pe,{key:1},[j(p(Te),{name:"copy",size:"sm"}),qe(" "+N(p(n)("login.copyLink")),1)],64))]),_:1},8,["class"])]),C("div",WWe,[j(p(Ao),{size:"sm",label:p(n)("login.waitingAuth")},null,8,["label"]),C("span",UWe,N(p(n)("login.waitingAutoClose")),1),C("span",jWe,N(k(p(u))),1)])])):p(r)==="success"?(y(),M("div",VWe,[j(p(Dd),{kind:"success"}),C("span",qWe,N(p(n)("login.success")),1),C("span",KWe,N(p(n)("login.successHint")),1)])):p(r)==="expired"?(y(),M(Pe,{key:3},[C("div",ZWe,[j(p(Dd),{kind:"expired"}),C("span",GWe,N(p(n)("login.expiredTitle")),1),C("span",YWe,N(p(n)("login.expiredHint")),1)]),C("div",XWe,[j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("onboarding.back")),1)]),_:1}),j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"])])],64)):p(r)==="error"?(y(),M(Pe,{key:4},[C("div",JWe,[j(p(Dd),{kind:"error"}),C("span",QWe,N(p(l)?p(n)("login.pollErrorTitle"):p(n)("login.errorTitle")),1),C("span",eUe,N(p(l)?p(n)("login.pollErrorHint"):p(n)("login.errorHint")),1)]),C("div",tUe,[j(p(Rt),{variant:"secondary",onClick:m},{default:me(()=>[qe(N(p(n)("onboarding.back")),1)]),_:1}),j(p(Rt),{variant:"primary",onClick:p(c)},{default:me(()=>[qe(N(p(n)("login.retry")),1)]),_:1},8,["onClick"])])],64)):ee("",!0)]))}}),oUe=ft(nUe,[["__scopeId","data-v-0a67ec7e"]]),sUe=["aria-label"],iUe={class:"wiz-body"},rUe={key:0,class:"wiz-step"},lUe={class:"wiz-title"},aUe={class:"wiz-sub"},uUe={class:"pref-group"},cUe={class:"pref-label"},dUe={class:"lang-cards"},fUe=["onClick"],pUe={class:"opt-label"},hUe={class:"pref-group"},mUe={class:"pref-label"},gUe={class:"theme-cards"},vUe=["onClick"],yUe={class:"opt-label"},kUe={key:1,class:"wiz-step"},bUe={class:"wiz-title"},CUe={class:"wiz-sub"},wUe={class:"wiz-step-fill"},_Ue={class:"wiz-foot"},xUe={class:"wiz-foot-ghost"},SUe=et({__name:"OnboardingWizard",props:{authReady:{type:Boolean},onStartOAuthLogin:{type:Function},onPollOAuthLogin:{type:Function},onCancelOAuthLogin:{type:Function}},emits:["complete","loginSuccess","addProvider"],setup(e,{emit:t}){const{t:n,locale:o}=Nt(),s=e,i=t;function r(){i("addProvider")}const l=["preferences","login"],a=Z(0),u=R(()=>l[a.value]??"preferences");function c(){a.value0&&a.value--}function f(w){o.value!==w&&E5(w)}const{colorScheme:h,setColorScheme:m}=XT(),v=[{value:"system",labelKey:"theme.system"},{value:"light",labelKey:"theme.light"},{value:"dark",labelKey:"theme.dark"}];function k(){i("loginSuccess")}return(w,b)=>(y(),M("div",{class:"wizard",role:"dialog","aria-modal":"true","aria-label":p(n)("onboarding.welcome.title")},[C("div",iUe,[u.value==="preferences"?(y(),M("section",rUe,[j(E8,{size:72}),C("h1",lUe,N(p(n)("onboarding.welcome.title")),1),C("p",aUe,N(p(n)("onboarding.welcome.subtitle")),1),C("div",uUe,[C("div",cUe,N(p(n)("onboarding.welcome.languageLabel")),1),C("div",dUe,[(y(!0),M(Pe,null,pt(p(yg),_=>(y(),M("button",{key:_.code,class:Re(["opt-card lang-card",{selected:p(o)===_.code}]),type:"button",onClick:g=>f(_.code)},[C("span",{class:Re(["opt-radio",{on:p(o)===_.code}])},null,2),C("span",pUe,N(_.label),1)],10,fUe))),128))])]),C("div",hUe,[C("div",mUe,N(p(n)("onboarding.welcome.themeLabel")),1),C("div",gUe,[(y(),M(Pe,null,pt(v,_=>C("button",{key:_.value,class:Re(["opt-card theme-card",{selected:p(h)===_.value}]),type:"button",onClick:g=>p(m)(_.value)},[C("span",{class:Re(["tp",`tp-${_.value}`]),"aria-hidden":"true"},[_.value==="system"?(y(),M(Pe,{key:0},[b[2]||(b[2]=iu('',2))],64)):(y(),M(Pe,{key:1},[b[3]||(b[3]=C("span",{class:"tp-side"},null,-1)),b[4]||(b[4]=C("span",{class:"tp-lines"},[C("span"),C("span"),C("span")],-1))],64))],2),C("span",yUe,N(p(n)(_.labelKey)),1)],10,vUe)),64))])])])):(y(),M("section",kUe,[j(E8,{size:72}),C("h1",bUe,N(p(n)("onboarding.login.title")),1),C("p",CUe,N(p(n)("onboarding.login.subtitle")),1),C("div",wUe,[j(oUe,{"auth-ready":s.authReady,"on-start-o-auth-login":s.onStartOAuthLogin,"on-poll-o-auth-login":s.onPollOAuthLogin,"on-cancel-o-auth-login":s.onCancelOAuthLogin,onSuccess:k,onAddProvider:r},null,8,["auth-ready","on-start-o-auth-login","on-poll-o-auth-login","on-cancel-o-auth-login"])])])),C("div",_Ue,[u.value==="preferences"?(y(),he(p(Rt),{key:0,variant:"primary",size:"lg",class:"wiz-primary",onClick:c},{default:me(()=>[qe(N(p(n)("onboarding.continue")),1)]),_:1})):u.value==="login"&&s.authReady?(y(),he(p(Rt),{key:1,variant:"primary",size:"lg",class:"wiz-primary",onClick:b[0]||(b[0]=_=>i("complete"))},{default:me(()=>[qe(N(p(n)("onboarding.login.finish")),1)]),_:1})):ee("",!0),C("div",xUe,[a.value>0?(y(),he(p(Rt),{key:0,variant:"ghost",onClick:d},{default:me(()=>[qe(N(p(n)("onboarding.back")),1)]),_:1})):ee("",!0),u.value==="login"&&s.authReady?ee("",!0):(y(),he(p(Rt),{key:1,variant:"ghost",onClick:b[1]||(b[1]=_=>i("complete"))},{default:me(()=>[qe(N(u.value==="login"?p(n)("onboarding.login.skip"):p(n)("onboarding.skip")),1)]),_:1}))])])])],8,sUe))}}),AUe=ft(SUe,[["__scopeId","data-v-a665ca6b"]]),MUe=["aria-label"],TUe={class:"gload-box"},EUe={class:"gload-text"},IUe=et({__name:"GlobalLoading",setup(e){const{t}=Nt();return(n,o)=>(y(),M("div",{class:"gload",role:"status","aria-label":p(t)("app.connecting")},[C("div",TUe,[o[0]||(o[0]=iu('',1)),j(p(Ao),{size:"md",label:p(t)("app.connecting")},null,8,["label"]),C("div",EUe,N(p(t)("app.connecting")),1)])],8,MUe))}}),LUe=ft(IUe,[["__scopeId","data-v-ab85ede1"]]),$Ue={class:"kap-root"},NUe={class:"kap-head"},FUe={class:"kap-count"},RUe={class:"kap-head-actions"},OUe={class:"kap-filters"},PUe=["value"],DUe={class:"kap-check"},BUe={class:"kap-check"},HUe={class:"kap-view-toggle",role:"group"},zUe={key:0,class:"kap-empty"},WUe=["onClick"],UUe={class:"kap-ts"},jUe={class:"kap-label"},VUe={key:0,class:"kap-detail"},qUe={class:"kap-detail-actions"},KUe=["onClick"],ZUe={key:1,class:"kap-agg"},GUe={class:"mono"},YUe={class:"mono"},XUe={class:"num"},JUe={class:"num"},QUe={key:0},eje={class:"mono"},tje={class:"num"},nje={class:"num"},oje={key:0},sje=et({__name:"KapDebugView",emits:["close"],setup(e,{emit:t}){const n=t,o=Z("all"),s=Z(""),i=Z(""),r=Z(!1),l=Z("timeline"),a=R(()=>(I5.value,[...M0e()])),u=R(()=>{const E=new Set;for(const P of a.value)P.sessionId&&E.add(P.sessionId);return[...E].sort()});function c(E){return E.kind==="rest:error"||E.code!==void 0&&E.code!==0||E.eventType==="error"||E.eventType==="parse-error"}const d=R(()=>{const E=s.value.trim().toLowerCase();return a.value.filter(P=>!(o.value!=="all"&&P.source!==o.value||i.value&&P.sessionId!==i.value||r.value&&!c(P)||E&&!`${P.label} ${P.kind} ${P.eventType??""} ${P.sessionId??""} ${P.requestId??""}`.toLowerCase().includes(E)))}),f=R(()=>{const E=new Map;for(const P of d.value){if(P.kind!=="ws:in"&&P.kind!=="ws:out")continue;const D=P.kind==="ws:in"?"←":"→",I=`${D} ${P.eventType??"?"} @ ${P.sessionId??"-"}`,$=E.get(I)??{key:I,sessionId:P.sessionId??"-",eventType:P.eventType??"?",dir:D,count:0};$.count++,P.seq!==void 0&&($.lastSeq=P.seq),E.set(I,$)}return[...E.values()].sort((P,D)=>D.count-P.count)}),h=R(()=>{const E=new Map;for(const P of d.value){if(P.source!=="rest"||P.kind==="rest:request")continue;const D=`${P.method??"?"} ${P.path??"?"}`,I=E.get(D)??{count:0,errors:0,totalMs:0,timed:0};I.count++,c(P)&&I.errors++,P.durationMs!==void 0&&(I.totalMs+=P.durationMs,I.timed++),E.set(D,I)}return[...E.entries()].map(([P,D])=>({key:P,count:D.count,errors:D.errors,avgMs:D.timed>0?Math.round(D.totalMs/D.timed):0})).sort((P,D)=>D.count-P.count)}),m=Z(null),v=Z(!0),k=Z(null),w=Z(null);Je(()=>d.value.length,async()=>{if(!v.value||l.value!=="timeline")return;await yt();const E=k.value;E&&(E.scrollTop=E.scrollHeight)});function b(E){m.value=m.value===E?null:E}function _(E){const P=new Date(E),D=(I,$=2)=>String(I).padStart($,"0");return`${D(P.getHours())}:${D(P.getMinutes())}:${D(P.getSeconds())}.${D(P.getMilliseconds(),3)}`}function g(E){return JSON.stringify(E,null,2)}async function x(E){await Zs(g(E))&&(w.value=E.id,setTimeout(()=>{w.value===E.id&&(w.value=null)},1500))}function S(){G$(d.value)}function T(E){return c(E)||E.source==="client"?"b-err":E.source==="rest"?"b-rest":E.kind==="ws:lifecycle"?"b-life":E.kind==="ws:out"?"b-out":"b-in"}function A(E){return E.source==="rest"?"REST":E.source==="client"?"APP":"WS"}return(E,P)=>(y(),M("section",$Ue,[C("header",NUe,[P[11]||(P[11]=C("strong",null,"KAP debug",-1)),C("span",FUe,N(d.value.length)+"/"+N(a.value.length),1),C("div",RUe,[C("button",{type:"button",class:Re({on:p(Ef)}),onClick:P[0]||(P[0]=D=>Ef.value=!p(Ef))},N(p(Ef)?"resume":"pause"),3),C("button",{type:"button",onClick:P[1]||(P[1]=D=>p(T0e)())},"clear"),C("button",{type:"button",onClick:P[2]||(P[2]=D=>S())},"export jsonl"),j(p(pn),{text:"Close window"},{default:me(()=>[C("button",{type:"button",onClick:P[3]||(P[3]=D=>n("close"))},"✕")]),_:1})])]),C("div",OUe,[Bn(C("select",{"onUpdate:modelValue":P[4]||(P[4]=D=>o.value=D),"aria-label":"Source filter"},[...P[12]||(P[12]=[C("option",{value:"all"},"rest + ws + app",-1),C("option",{value:"rest"},"rest",-1),C("option",{value:"ws"},"ws",-1),C("option",{value:"client"},"app errors",-1)])],512),[[V4,o.value]]),Bn(C("select",{"onUpdate:modelValue":P[5]||(P[5]=D=>i.value=D),"aria-label":"Session filter"},[P[13]||(P[13]=C("option",{value:""},"all sessions",-1)),(y(!0),M(Pe,null,pt(u.value,D=>(y(),M("option",{key:D,value:D},N(D),9,PUe))),128))],512),[[V4,i.value]]),Bn(C("input",{"onUpdate:modelValue":P[6]||(P[6]=D=>s.value=D),type:"text",placeholder:"filter (type / path / id)","aria-label":"Text filter"},null,512),[[ai,s.value]]),C("label",DUe,[Bn(C("input",{"onUpdate:modelValue":P[7]||(P[7]=D=>r.value=D),type:"checkbox"},null,512),[[Em,r.value]]),P[14]||(P[14]=qe(" errors",-1))]),C("label",BUe,[Bn(C("input",{"onUpdate:modelValue":P[8]||(P[8]=D=>v.value=D),type:"checkbox"},null,512),[[Em,v.value]]),P[15]||(P[15]=qe(" follow",-1))]),C("div",HUe,[C("button",{type:"button",class:Re({on:l.value==="timeline"}),onClick:P[9]||(P[9]=D=>l.value="timeline")},"timeline",2),C("button",{type:"button",class:Re({on:l.value==="aggregate"}),onClick:P[10]||(P[10]=D=>l.value="aggregate")},"aggregate",2)])]),l.value==="timeline"?(y(),M("div",{key:0,ref_key:"listRef",ref:k,class:"kap-list"},[d.value.length===0?(y(),M("div",zUe," No trace entries yet. REST calls and WS frames will appear here. ")):ee("",!0),(y(!0),M(Pe,null,pt(d.value,D=>(y(),M("div",{key:D.id,class:"kap-row-wrap"},[C("button",{type:"button",class:Re(["kap-row",{expanded:m.value===D.id}]),onClick:I=>b(D.id)},[C("span",UUe,N(_(D.ts)),1),C("span",{class:Re(["kap-badge",T(D)])},N(A(D)),3),C("span",jUe,N(D.label),1)],10,WUe),m.value===D.id?(y(),M("div",VUe,[C("div",qUe,[C("button",{type:"button",onClick:I=>x(D)},N(w.value===D.id?"copied ✓":"copy json"),9,KUe)]),C("pre",null,N(g(D)),1)])):ee("",!0)]))),128))],512)):(y(),M("div",ZUe,[P[20]||(P[20]=C("h4",null,"WS frames by session / type",-1)),C("table",null,[P[17]||(P[17]=C("thead",null,[C("tr",null,[C("th",null,"dir"),C("th",null,"type"),C("th",null,"session"),C("th",null,"count"),C("th",null,"last seq")])],-1)),C("tbody",null,[(y(!0),M(Pe,null,pt(f.value,D=>(y(),M("tr",{key:D.key},[C("td",null,N(D.dir),1),C("td",GUe,N(D.eventType),1),C("td",YUe,N(D.sessionId),1),C("td",XUe,N(D.count),1),C("td",JUe,N(D.lastSeq??"—"),1)]))),128)),f.value.length===0?(y(),M("tr",QUe,[...P[16]||(P[16]=[C("td",{colspan:"5",class:"kap-empty"},"no ws frames",-1)])])):ee("",!0)])]),P[21]||(P[21]=C("h4",null,"REST by endpoint",-1)),C("table",null,[P[19]||(P[19]=C("thead",null,[C("tr",null,[C("th",null,"endpoint"),C("th",null,"count"),C("th",null,"errors"),C("th",null,"avg ms")])],-1)),C("tbody",null,[(y(!0),M(Pe,null,pt(h.value,D=>(y(),M("tr",{key:D.key},[C("td",eje,N(D.key),1),C("td",tje,N(D.count),1),C("td",{class:Re(["num",{err:D.errors>0}])},N(D.errors),3),C("td",nje,N(D.avgMs),1)]))),128)),h.value.length===0?(y(),M("tr",oje,[...P[18]||(P[18]=[C("td",{colspan:"4",class:"kap-empty"},"no rest calls",-1)])])):ee("",!0)])])]))]))}}),ije=ft(sje,[["__scopeId","data-v-2b13888e"]]),rje=et({__name:"DebugPanel",setup(e){const t=Z(!1);let n=null,o=null,s=null;const i=["data-color-scheme"];function r(c){const d=document.documentElement,f=c.documentElement;for(const h of i){const m=d.getAttribute(h);m!==null?f.setAttribute(h,m):f.removeAttribute(h)}}function l(c){const d=c.document;d.title="KAP debug";const f=d.createElement("base");f.href=location.href,d.head.appendChild(f);for(const m of Array.from(document.querySelectorAll('style, link[rel="stylesheet"]')))d.head.appendChild(m.cloneNode(!0));r(d),d.body.style.margin="0";const h=d.createElement("div");return h.style.height="100vh",d.body.appendChild(h),h}function a(){s?.disconnect(),s=null;try{o?.unmount()}catch{}o=null,n=null,t.value=!1}function u(){if(n&&!n.closed){n.focus();return}const c=window.open("","kap-debug","popup=yes,width=1040,height=760");if(!c)return;n=c;const d=l(c),f=Im(ije,{onClose:()=>c.close()});f.mount(d),o=f,t.value=!0,s=new MutationObserver(()=>{n&&!n.closed&&r(n.document)}),s.observe(document.documentElement,{attributes:!0,attributeFilter:[...i]}),c.addEventListener("pagehide",a),c.addEventListener("beforeunload",a)}return dn(()=>{u()}),Vn(()=>{n&&!n.closed&&n.close(),a()}),(c,d)=>(y(),he(p(pn),{text:t.value?"Focus KAP debug window":"Open KAP debug window"},{default:me(()=>[C("button",{class:"kap-fab",type:"button",onClick:u}," KAP ")]),_:1},8,["text"]))}}),lje=ft(rje,[["__scopeId","data-v-21de79fc"]]),aje=et({__name:"ServerAuthDialog",setup(e){const t=Z(""),n=Z(null),o=Z(!1);dn(()=>{yt(()=>n.value?.focus())});function s(){const r=t.value;!r||o.value||(o.value=!0,vE(r),window.location.reload())}function i(r){r.key==="Enter"&&(r.preventDefault(),s())}return(r,l)=>(y(),he(p(ua),{open:!0,title:"Server token required","hide-close":!0,"close-on-overlay":!1,"close-on-esc":!1},{foot:me(()=>[j(p(Rt),{variant:"primary",disabled:!t.value||o.value,loading:o.value,onClick:s},{default:me(()=>[qe(N(o.value?"Connecting…":"Connect"),1)]),_:1},8,["disabled","loading"])]),default:me(()=>[l[1]||(l[1]=C("p",{class:"server-auth-hint"},[qe(" This server is protected. Enter the bearer token printed when the server started (or the password set via "),C("code",null,"KIMI_CODE_PASSWORD"),qe("). ")],-1)),j(p(js),{ref_key:"inputRef",ref:n,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"password",autocomplete:"current-password",placeholder:"Token",disabled:o.value,onKeydown:i},null,8,["modelValue","disabled"])]),_:1}))}}),uje=ft(aje,[["__scopeId","data-v-331563ff"]]),cje=["aria-label"],dje=et({__name:"InternalBuildBanner",setup(e){const{t}=Nt(),n=Wp;return(o,s)=>p(n)?(y(),M("span",{key:0,class:"internal-build-tag",role:"note","aria-label":p(t)("app.internalBuildBanner")},[s[0]||(s[0]=C("svg",{viewBox:"0 0 16 16",width:"11",height:"11",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"},[C("path",{d:"M8 2 14 13H2L8 2Z"}),C("path",{d:"M8 6v3.5"}),C("path",{d:"M8 11.5h.01"})],-1)),C("span",null,N(p(t)("app.internalBuildBanner")),1)],8,cje)):ee("",!0)}}),fje=ft(dje,[["__scopeId","data-v-14c3d0e0"]]),pje={class:"app-shell"},hje=["inert"],mje=["aria-label","aria-hidden"],gje=et({__name:"App",setup(e){QJ();const t=Z(!1);let n=null;const o=mu(),s=R(()=>!o.dangerousBypassAuth.value&&t.value);Ln("resolveImage",o.resolveImageUrl),Ln("resolveSwarmMembers",ht=>o.swarmMembersByToolCallId.value.get(ht)??[]),Ln("modelDisplay",ht=>fJ(ht,o.models.value));const{t:i}=Nt();Ln("subagentEffort",ht=>pJ(ht));const{confirm:r}=hu(),l=Qr(),a=khe(),u=Z(!1),c=Z(!1),d=R(()=>{const ht=o.activeSessionId.value;return o.sessions.value.find(Le=>Le.id===ht)?.title??""}),f=R(()=>{const ht=o.activeSessionId.value;return o.sessions.value.find(Le=>Le.id===ht)?.lastTurnReason??null}),h=R(()=>o.visibleWorkspace.value?.sessionCount??0),m=R(()=>o.activity.value!=="idle");jhe({running:m,title:"Kimi Code Web"});function v(ht){const Le=o.models.value.find(di=>di.id===o.status.value.modelId),Ze=Up(Le),Xt=Ze.indexOf(Dm(Le,ht)),gs=Ze[(Xt+1)%Ze.length]??Ze[0]??"off";return My(Le,gs)}const k=R(()=>{const ht=o.models.value.find(Le=>Le.id===o.status.value.modelId);return Dm(ht,o.thinking.value)}),w=Z(!o.onboarded.value);function b(){o.setOnboarded(!0),w.value=!1}function _(){b(),st.value="providers",hs.value=!0}let g=0;function x(){const ht=window.visualViewport,Le=document.documentElement.style;Le.setProperty("--app-height",`${ht?.height??window.innerHeight}px`),Le.setProperty("--app-top",`${ht?.offsetTop??0}px`)}function S(){g||(g=requestAnimationFrame(()=>{g=0,x()}))}dn(()=>{n=oQ(()=>{t.value=!0,o.clearDangerousBypassAuth()}),o.load(),oe(),x(),window.visualViewport?.addEventListener("resize",S),window.visualViewport?.addEventListener("scroll",S),window.addEventListener("resize",S),document.addEventListener("keydown",T,!0)}),bn(()=>{document.removeEventListener("keydown",T,!0),window.visualViewport?.removeEventListener("resize",S),window.visualViewport?.removeEventListener("scroll",S),window.removeEventListener("resize",S),g&&(cancelAnimationFrame(g),g=0),document.documentElement.style.removeProperty("--app-height"),document.documentElement.style.removeProperty("--app-top"),n!==null&&(n(),n=null)});function T(ht){ht.key==="Escape"&&(Nn.value||qt()&&(ht.stopPropagation(),ht.preventDefault()))}const A=Z(null),{previewTarget:E,previewFile:P,previewLoading:D,previewError:I,previewDownloadUrl:$,previewExternalActions:B,openFilePreview:H,closeFilePreview:O,openPreviewInEditor:F,revealPreviewFile:U}=Uhe({client:o,detailTarget:A,t:(ht,Le)=>Le===void 0?i(ht):i(ht,Le)}),z=R(()=>A.value!==null),W=Z(null),K=Z(null);function V(ht){K.value=ht.originImg??null,W.value=ht.media}const{SIDEBAR_WIDTH_KEY:ie,SIDEBAR_DEFAULT:ne,SIDEBAR_MIN:X,sidebarMax:le,sessionColWidth:Ie,sidebarCollapsed:de,sidebarDragging:pe,sideWidth:ve,loadSidebarCollapsed:oe,toggleSidebarCollapse:ye}=zhe({previewOpen:z}),{PREVIEW_WIDTH_KEY:G,PREVIEW_MIN:Y,previewDefaultWidth:fe,previewMax:we,previewWidth:ge,previewPanelWidth:Q,compactionPanelText:te,compactionPanelVisible:ce,openCompactionPanel:ue,closeCompactionPanel:Se,agentPanelMember:ze,agentPanelTurns:_e,agentPanelLoading:Ee,agentPanelLoadError:it,agentPanelLoadingMore:Fe,agentPanelLoadMoreError:Oe,agentPanelHasMore:Ge,agentPanelRunning:at,openAgentPanel:Tt,closeAgentPanel:Bt,loadOlderAgentMessages:Yt,detailDiffMode:Sn,detailDiffPath:on,openDiffDetail:en,closeDiffDetail:Cn,selectDiffFile:Mn,turnDiffChange:We,openTurnDiff:tt,closeTurnDiff:Ue,btwVisible:Lt,openSideChatTab:gt,closeSideChat:wn,sidePanelVisible:yn,panelDragging:go,closeOpenSidePanel:qt}=Phe({client:o,sideWidth:ve,detailTarget:A,closeFilePreview:O}),ps=Z(null);function xs(ht){ps.value?.style.setProperty("--preview-w",`${ht}px`)}Je([ps,Q],([ht,Le])=>ht?.style.setProperty("--preview-w",`${Le}px`),{immediate:!0});const _n=Z(null),In=Z(!1),To=Z(!1),lo=Z(!1),St=Z(!1),hs=Z(!1);let Jo;dn(()=>{Jo=window.kimiDesktop?.onMenuAction?.(ht=>{ht==="open-settings"?hs.value=!0:ht==="new-chat"&&Fs()})}),bn(()=>{Jo?.()});const uo=Z(null),Ys=Z(null),Nn=R(()=>Ci.value>0||In.value||To.value||lo.value||St.value||hs.value||w.value||u.value||c.value),no=Z(!1),$s=Z(!1),Xs=Z(!1);async function ci(){no.value=!0,$s.value=!1,In.value=!0;try{await o.refreshAllProviders()}catch{$s.value=!0}finally{no.value=!1}}function Oo(){To.value=!0}async function vo(){await r({title:i("sidebar.logoutConfirmTitle"),message:i("sidebar.logoutConfirmMessage"),variant:"danger",action:()=>o.logout()})}async function Po(ht){In.value=!1,await co(ht)}async function co(ht){await o.setModel(ht)&&ht!==o.defaultModel.value&&o.updateConfig({defaultModel:ht})}const Tn=Z(null);async function fo(ht){await o.archiveSession(ht),!o.sessionsForView.value.some(Le=>Le.id===ht)&&(Tn.value={id:ht})}async function Qe(){const ht=Tn.value;ht&&await o.restoreSession(ht.id)&&(Tn.value=null)}const st=Z(void 0),Ct=Z(void 0);Je(c,ht=>{ht||(Ct.value=void 0)});function Qt(){Tn.value=null,a.value?(Ct.value="archived",c.value=!0):(st.value="archived",hs.value=!0)}async function kn(ht){const Le=o.workspacesView.value.find(Ze=>Ze.id===ht)?.name??ht;await r({title:i("sidebar.removeWorkspace"),message:i("workspace.removeWorkspaceConfirm",{name:Le}),variant:"danger",action:()=>o.deleteWorkspace(ht)})}async function Ko(ht){Xs.value=!0;try{await o.updateConfig(ht)&&await o.checkAuth()}finally{Xs.value=!1}}async function Eo(){return o.startOAuthLogin()}async function bo(){return o.pollOAuthLogin()}async function Ns(){return o.cancelOAuthLogin()}async function Do(){To.value=!1,await o.checkAuth(),await o.load()}async function Io(){b(),await o.checkAuth(),await o.load()}async function Qo(ht){await o.undo(1)!==null&&(await yt(),_n.value?.loadComposerForEdit(ht.text,ht.attachments),_n.value?.notifyUndone())}async function sn(){const ht=await o.abortCurrentPrompt();_n.value?.onAbortOutcome(ht)}function es(ht){const Le=_t();return ht.map(Ze=>({kind:Ze.kind,url:Le.getFileUrl(Ze.fileId),fileId:Ze.fileId,name:Ze.name}))}async function ms(ht,Le){if(o.authReady.value)return!0;const Ze=o.managedProviderStatus.value==="authenticated";Ze&&o.managedMembership.value===null&&await o.probeManagedMembership();const Xt=Ze&&o.managedMembership.value==="free",gs=await r(Xt?{title:i("login.upgradeRequiredTitle"),message:i("login.upgradeRequiredMessage"),confirmLabel:i("sidebar.upgrade"),variant:"primary"}:{title:i("login.requiredTitle"),message:i("login.requiredMessage"),confirmLabel:i("login.goToLogin"),variant:"primary"});return _n.value?.loadComposerForEdit(ht,es(Le)),gs&&(Xt?jp():Oo()),!1}async function Tr(ht,Le=[]){if(o.activeSessionId.value||o.activeWorkspaceId.value)return!0;const Ze=await r({title:i("workspace.requiredTitle"),message:i("workspace.requiredMessage"),confirmLabel:i("conversation.pickFolder"),variant:"primary"});return _n.value?.loadComposerForEdit(ht,es(Le)),Ze&&(lo.value=!0),!1}async function ts(ht,Le=[]){return await ms(ht,Le)?Tr(ht,Le):!1}async function Ki(ht){const{cmd:Le,attachments:Ze}=ht;if(Le==="/compact"||Le.startsWith("/compact ")){if(!await ts(Le))return;o.compact(Le.slice(8).trim()||void 0);return}if(Le==="/swarm"||Le.startsWith("/swarm ")){const Xt=Le.slice(6).trim();if(Xt==="on")o.setSwarmMode(!0);else if(Xt==="off")o.setSwarmMode(!1);else if(Xt){if(!await ts(Le))return;o.setSwarmMode(!0),o.sendPrompt(Xt)}else o.toggleSwarmMode();return}if(Le==="/goal"||Le.startsWith("/goal ")){const Xt=Le.slice(5).trim();if(Xt==="pause"||Xt==="resume"||Xt==="cancel")o.controlGoal(Xt);else if(Xt){if(!await ts(Le))return;o.createGoal(Xt)}else o.toggleGoalMode();return}if(Le==="/btw"||Le.startsWith("/btw ")){const Xt=Le.slice(4).trim();if(!Xt&&o.sideChatVisible.value)wn();else{if(Xt&&!await ts(Le))return;gt(Xt||void 0)}return}switch(Le){case"/new":case"/clear":Fs();break;case"/fork":o.forkSession();break;case"/export":o.exportSession();break;case"/undo":o.undo();break;case"/plan":o.togglePlanMode();break;case"/auto":o.setPermission("auto");break;case"/yolo":o.setPermission("yolo");break;case"/thinking":o.setThinking(v(o.thinking.value));break;case"/status":St.value=!0;break;case"/login":Oo();break;default:{const Xt=Le.indexOf(" "),gs=hQ((Xt===-1?Le:Le.slice(0,Xt)).slice(1)),di=Xt===-1?void 0:Le.slice(Xt+1).trim()||void 0;if(!gs)break;if(!await ts(Le,Ze))return;!o.activeSessionId.value&&o.activeWorkspaceId.value?o.startSessionAndActivateSkill(o.activeWorkspaceId.value,gs,di,Ze):o.activateSkill(gs,di,Ze);break}}}function Js(ht){o.unqueue(ht)}function Bo(ht){o.unqueue(ht)}function Zo(ht){o.reorderQueue(ht.from,ht.to)}async function Il(ht){if(!await ms(ht.text,ht.attachments))return;const Le=o.activeWorkspaceId.value;if(!o.activeSessionId.value&&Le){await o.startSessionAndSendPrompt(Le,ht.text,ht.attachments);return}if(!o.activeSessionId.value&&!Le){uo.value=ht,await r({title:i("workspace.requiredTitle"),message:i("workspace.requiredMessage"),confirmLabel:i("conversation.pickFolder"),variant:"primary"})?lo.value=!0:Zi();return}o.sendPrompt(ht.text,ht.attachments)}function Zi(){const ht=uo.value;uo.value=null,ht&&_n.value?.loadComposerForEdit(ht.text,es(ht.attachments))}async function tl(ht){if(Ys.value=null,!await o.addWorkspaceByPath(ht)){Ys.value=i("workspace.addFailed");return}lo.value=!1;const Ze=uo.value;uo.value=null;const Xt=o.activeWorkspaceId.value;Ze&&Xt&&await o.startSessionAndSendPrompt(Xt,Ze.text,Ze.attachments)}function Ho(){Zi(),Ys.value=null,lo.value=!1}function Co(){yt(()=>{_n.value?.focusComposer()})}function Fs(){const ht=o.activeWorkspaceId.value;ht?o.openWorkspaceDraft(ht):o.clearActiveSession(),Co()}function Rs(ht){o.openWorkspaceDraft(ht),Co()}function yo(ht){ht&&window.open(ht,"_blank","noopener")}return(ht,Le)=>(y(),M("div",pje,[s.value?(y(),he(uje,{key:0})):ee("",!0),C("div",{class:Re(["app",{mobile:p(a),"sidebar-collapsed":p(de)&&!p(a),"macos-desktop":p(rc)}]),inert:w.value},[p(a)?(y(),he(PHe,{key:1,workspace:p(o).visibleWorkspace.value,"session-title":d.value,running:m.value,branch:p(o).status.value.branch,"session-count":h.value,onOpenSwitcher:Le[22]||(Le[22]=Ze=>u.value=!0),onOpenSettings:Le[23]||(Le[23]=Ze=>c.value=!0)},null,8,["workspace","session-title","running","branch","session-count"])):(y(),M(Pe,{key:0},[j(r9e,{collapsed:p(de),dragging:p(pe),"col-width":p(ve),"active-workspace":p(o).visibleWorkspace.value,"active-workspace-id":p(o).activeWorkspaceId.value,sessions:p(o).sessionsForView.value,groups:p(o).workspaceGroups.value,"pinned-sessions":p(o).pinnedSessions.value,"flat-sessions":p(o).flatSessions.value,"flat-has-more":p(o).flatSessionsHasMore.value,"flat-loading-more":p(o).flatSessionsLoadingMore.value,initialized:p(o).initialized.value,"active-id":p(o).activeSessionId.value,"attention-by-session":p(o).attentionBySession.value,"pending-by-session":p(o).pendingBySession.value,"unread-by-session":p(o).unreadBySession.value,onSelect:Le[0]||(Le[0]=Ze=>p(o).selectSession(Ze)),onCreate:Fs,onCreateInWorkspace:Le[1]||(Le[1]=Ze=>Rs(Ze)),onSelectWorkspace:Le[2]||(Le[2]=Ze=>p(o).openWorkspace(Ze)),onAddWorkspace:Le[3]||(Le[3]=Ze=>lo.value=!0),onRename:Le[4]||(Le[4]=(Ze,Xt)=>p(o).renameSession(Ze,Xt)),onArchive:Le[5]||(Le[5]=Ze=>fo(Ze)),onFork:Le[6]||(Le[6]=Ze=>p(o).forkSession(Ze)),onExport:Le[7]||(Le[7]=Ze=>p(o).exportSession(Ze)),onPin:Le[8]||(Le[8]=Ze=>p(o).togglePinSession(Ze)),onUnpin:Le[9]||(Le[9]=Ze=>p(o).unpinSession(Ze)),onReorderPinned:Le[10]||(Le[10]=Ze=>p(o).reorderPinnedSessions(Ze)),onPinAt:Le[11]||(Le[11]=(Ze,Xt,gs)=>p(o).pinSessionAt(Ze,Xt,gs)),onRenameWorkspace:Le[12]||(Le[12]=(Ze,Xt)=>p(o).renameWorkspace(Ze,Xt)),onDeleteWorkspace:Le[13]||(Le[13]=Ze=>kn(Ze)),onReorderWorkspaces:Le[14]||(Le[14]=Ze=>p(o).reorderWorkspaces(Ze)),onLoadMoreSessions:Le[15]||(Le[15]=Ze=>void p(o).loadMoreSessions(Ze)),onLoadAllSessions:Le[16]||(Le[16]=Ze=>void p(o).loadAllSessions()),onEnsureFlatSessions:Le[17]||(Le[17]=Ze=>void p(o).ensureFlatSessions()),onLoadMoreFlatSessions:Le[18]||(Le[18]=Ze=>void p(o).loadMoreFlatSessions()),onOpenSettings:Le[19]||(Le[19]=Ze=>hs.value=!0),onLogin:Oo,onCollapse:p(ye)},null,8,["collapsed","dragging","col-width","active-workspace","active-workspace-id","sessions","groups","pinned-sessions","flat-sessions","flat-has-more","flat-loading-more","initialized","active-id","attention-by-session","pending-by-session","unread-by-session","onCollapse"]),Bn(j(Zx,{class:"side-handle","storage-key":p(ie),"default-width":p(ne),min:p(X),max:p(le),"onUpdate:width":Le[20]||(Le[20]=Ze=>Ie.value=Ze),"onUpdate:dragging":Le[21]||(Le[21]=Ze=>pe.value=Ze)},null,8,["storage-key","default-width","min","max"]),[[qs,!p(de)]])],64)),j(R$e,{ref_key:"conversationPaneRef",ref:_n,mobile:p(a),turns:p(o).turns.value,"session-id":p(o).activeSessionId.value,approvals:p(o).pendingApprovals.value,changes:p(o).changes.value,"git-info":p(o).gitInfo.value,tasks:p(o).tasks.value,todos:p(o).todos.value,goal:p(o).goal.value,"activation-badges":p(o).activationBadges.value,status:p(o).status.value,thinking:p(o).thinking.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"goal-mode":p(o).goalMode.value,models:p(o).models.value,"auth-ready":p(o).authReady.value,"managed-signed-in":p(o).managedProviderStatus.value==="authenticated","managed-membership":p(o).managedMembership.value,"starred-ids":p(o).starredModelIds.value,skills:p(o).skills.value,questions:p(o).questions.value,"pending-question-actions":p(o).pendingQuestionActions,"pending-approval-actions":p(o).pendingApprovalActions,running:m.value,"overlay-open":Nn.value,"turn-active":p(o).turnActive.value,queued:p(o).queued.value,"search-files":p(o).searchFiles,"upload-image":p(o).uploadImage,working:p(o).working.value,"last-turn-reason":f.value,"turn-error":p(o).activeTurnError.value??null,"turn-retry":p(o).activeTurnRetry.value??null,starting:p(o).isStartingFirstPrompt.value,"file-reload-key":p(o).activeSessionId.value,"session-loading":p(o).sessionLoading.value,compaction:p(o).compaction.value,"has-more-messages":p(o).hasMoreMessages.value,"loading-more":p(o).loadingMoreMessages.value,"loading-more-error":p(o).loadMoreMessagesError.value,"load-older-messages":p(o).loadOlderMessages,"workspace-name":p(o).visibleWorkspace.value?.name,"workspace-root":p(o).visibleWorkspace.value?.root??p(o).status.value.cwd,"git-diff-stats":p(o).gitDiffStats.value,workspaces:p(o).workspacesView.value,"active-workspace-id":p(o).activeWorkspaceId.value,"session-title":d.value,pr:p(o).activePullRequest.value,onOpenChanges:Le[24]||(Le[24]=Ze=>p(en)()),onSelectWorkspace:Le[25]||(Le[25]=Ze=>Rs(Ze)),onAddWorkspace:Le[26]||(Le[26]=Ze=>lo.value=!0),onOpenPr:yo,onSubmit:Le[27]||(Le[27]=Ze=>Il(Ze)),onLogin:Le[28]||(Le[28]=Ze=>Oo()),onSteer:Le[29]||(Le[29]=Ze=>p(o).steerPrompt(Ze.text,Ze.attachments)),onApproval:Le[30]||(Le[30]=(Ze,Xt)=>p(o).respondApproval(Ze,Xt)),onCancelTask:Le[31]||(Le[31]=Ze=>p(o).cancelTask(Ze)),onAnswer:Le[32]||(Le[32]=(Ze,Xt)=>p(o).respondQuestion(Ze,Xt)),onDismiss:Le[33]||(Le[33]=Ze=>p(o).dismissQuestion(Ze)),onCommand:Ki,onInterrupt:sn,onUnqueue:Js,onEditQueued:Bo,onReorderQueue:Zo,onSetPermission:Le[34]||(Le[34]=Ze=>p(o).setPermission(Ze)),onSetThinking:Le[35]||(Le[35]=Ze=>p(o).setThinking(Ze)),onTogglePlan:Le[36]||(Le[36]=Ze=>p(o).togglePlanMode()),onToggleSwarm:Le[37]||(Le[37]=Ze=>p(o).toggleSwarmMode()),onToggleGoal:Le[38]||(Le[38]=Ze=>p(o).toggleGoalMode()),onCreateGoal:Le[39]||(Le[39]=Ze=>p(o).createGoal(Ze)),onControlGoal:Le[40]||(Le[40]=Ze=>p(o).controlGoal(Ze)),onRefreshGitStatus:Le[41]||(Le[41]=Ze=>p(o).activeSessionId.value&&p(o).loadGitStatus(p(o).activeSessionId.value)),onRenameSession:Le[42]||(Le[42]=(Ze,Xt)=>p(o).renameSession(Ze,Xt)),onForkSession:Le[43]||(Le[43]=Ze=>p(o).forkSession(Ze)),onArchiveSession:Le[44]||(Le[44]=Ze=>fo(Ze)),onExportSession:Le[45]||(Le[45]=Ze=>p(o).exportSession(Ze)),onCompact:Le[46]||(Le[46]=Ze=>p(o).compact()),onPickModel:Le[47]||(Le[47]=Ze=>ci()),onSelectModel:Le[48]||(Le[48]=Ze=>co(Ze)),onOpenFile:Le[49]||(Le[49]=Ze=>p(H)(Ze)),onOpenMedia:V,onOpenTurnDiff:Le[50]||(Le[50]=Ze=>p(tt)(Ze)),onOpenCompaction:Le[51]||(Le[51]=Ze=>p(ue)(Ze)),onOpenAgent:Le[52]||(Le[52]=Ze=>p(Tt)(Ze)),onEditMessage:Qo},null,8,["mobile","turns","session-id","approvals","changes","git-info","tasks","todos","goal","activation-badges","status","thinking","plan-mode","swarm-mode","goal-mode","models","auth-ready","managed-signed-in","managed-membership","starred-ids","skills","questions","pending-question-actions","pending-approval-actions","running","overlay-open","turn-active","queued","search-files","upload-image","working","last-turn-reason","turn-error","turn-retry","starting","file-reload-key","session-loading","compaction","has-more-messages","loading-more","loading-more-error","load-older-messages","workspace-name","workspace-root","git-diff-stats","workspaces","active-workspace-id","session-title","pr"]),!p(a)&&(p(rc)||p(de))?(y(),he(p(gn),{key:2,class:"sidebar-toggle-btn",size:"sm",label:p(de)?p(i)("sidebar.expandSidebar"):p(i)("sidebar.collapseSidebar"),tooltip:p(de)?p(i)("sidebar.expandSidebar"):p(i)("sidebar.collapseSidebar"),onClick:p(ye)},{default:me(()=>[j(p(Te),{name:p(de)?"panel-expand":"panel-collapse"},null,8,["name"])]),_:1},8,["label","tooltip","onClick"])):ee("",!0),!p(a)&&p(de)?(y(),he(p(gn),{key:3,class:"new-chat-btn",size:"sm",label:p(i)("sidebar.newChat"),tooltip:p(i)("sidebar.newChat"),onClick:Fs},{default:me(()=>[j(p(Te),{name:"chat-new"})]),_:1},8,["label","tooltip"])):ee("",!0),p(yn)&&!p(a)?(y(),he(Zx,{key:4,class:"preview-handle","storage-key":p(G),"default-width":p(fe),min:p(Y),max:p(we),reverse:"","aria-label":p(i)("layout.resizePreviewAria"),"apply-live":xs,"onUpdate:width":Le[53]||(Le[53]=Ze=>ge.value=Ze),"onUpdate:dragging":Le[54]||(Le[54]=Ze=>go.value=Ze)},null,8,["storage-key","default-width","min","max","aria-label"])):ee("",!0),!p(a)||p(yn)?(y(),M("aside",{key:5,ref_key:"previewPanelEl",ref:ps,class:Re(["global-preview",{open:p(yn),mobile:p(a)}]),role:"complementary","aria-label":p(i)("layout.detailPanelAria"),"aria-hidden":!p(yn)},[A.value==="compaction"&&p(ce)?(y(),he(kNe,{key:0,text:p(te)??"",subtitle:p(i)("conversation.summaryTitle"),onClose:p(Se)},null,8,["text","subtitle","onClose"])):A.value==="agent"&&p(ze)?(y(),he(xNe,{key:1,member:p(ze),turns:p(_e),running:p(at),loading:p(Ee),"load-error":p(it),"has-more":p(Ge),"loading-more":p(Fe),"load-more-error":p(Oe),onClose:p(Bt),onLoadOlderMessages:p(Yt),onOpenAgent:p(Tt),onOpenFile:p(H),onOpenMedia:V,onOpenTurnDiff:Le[55]||(Le[55]=Ze=>p(tt)(Ze))},null,8,["member","turns","running","loading","load-error","has-more","loading-more","load-more-error","onClose","onLoadOlderMessages","onOpenAgent","onOpenFile"])):A.value==="btw"&&p(Lt)?(y(),he($Ne,{key:2,turns:p(o).sideChatTurns.value,running:p(o).sideChatRunning.value,sending:p(o).sideChatSending.value,onSend:Le[56]||(Le[56]=Ze=>p(o).sendSideChatPrompt(Ze)),onClose:p(wn),onOpenMedia:V},null,8,["turns","running","sending","onClose"])):A.value==="diff"?(y(),he(rFe,{key:3,mode:p(Sn),changes:p(o).changes.value,"git-info":p(o).gitInfo.value,"file-diff":p(o).fileDiff.value,"full-texts":p(o).fileDiffTexts.value,"empty-file":p(o).fileDiffEmptyFile.value,"selected-diff-path":p(o).selectedDiffPath.value,"file-diff-loading":p(o).fileDiffLoading.value,closable:"",onOpen:p(Mn),onBack:Le[57]||(Le[57]=Ze=>{Sn.value="list",on.value=null,p(o).clearFileDiff()}),onClose:p(Cn)},null,8,["mode","changes","git-info","file-diff","full-texts","empty-file","selected-diff-path","file-diff-loading","onOpen","onClose"])):A.value==="file"?(y(),he(gNe,{key:4,file:p(P),loading:p(D),error:p(I),line:p(E)?.line,"download-url":p($),closable:"","external-actions":p(B),"open-file":p(H),onClose:p(O),onOpenExternal:p(F),onReveal:p(U)},null,8,["file","loading","error","line","download-url","external-actions","open-file","onClose","onOpenExternal","onReveal"])):A.value==="turn-diff"&&p(We)?(y(),he(fFe,{key:5,change:p(We),cwd:p(o).status.value.cwd,closable:"",onClose:p(Ue),onOpenFile:Le[58]||(Le[58]=Ze=>p(H)({path:Ze}))},null,8,["change","cwd","onClose"])):ee("",!0)],10,mje)):ee("",!0),j(fje,{class:"internal-build-fab"}),In.value?(y(),he(TFe,{key:6,models:p(o).models.value,current:p(o).status.value.modelId,"starred-ids":p(o).starredModelIds.value,loading:no.value,unavailable:$s.value,onSelect:Le[59]||(Le[59]=Ze=>Po(Ze)),onToggleStar:Le[60]||(Le[60]=Ze=>p(o).toggleStarModel(Ze)),onClose:Le[61]||(Le[61]=Ze=>In.value=!1)},null,8,["models","current","starred-ids","loading","unavailable"])):ee("",!0),hs.value?(y(),he(RBe,{key:7,"color-scheme":p(o).colorScheme.value,"font-scale":p(o).fontScale.value,"managed-provider-status":p(o).managedProviderStatus.value,"managed-user-info":p(o).managedUserInfo.value,"on-fetch-usage":p(o).getUsage,notify:p(o).notifyEnabled.value,"notify-permission":p(o).notifyPermission.value,"notify-sound":p(o).notifySound.value,config:p(o).config.value,models:p(o).models.value,"config-saving":Xs.value,"server-version":p(o).serverVersion.value,backend:p(o).backend.value,"experimental-flags":p(o).experimentalFlags.value,"initial-tab":st.value,onSetColorScheme:Le[62]||(Le[62]=Ze=>p(o).setColorScheme(Ze)),onSetFontScale:Le[63]||(Le[63]=Ze=>p(o).setFontScale(Ze)),onSetNotify:Le[64]||(Le[64]=Ze=>p(o).setNotifyEnabled(Ze)),onSetNotifySound:Le[65]||(Le[65]=Ze=>p(o).setNotifySound(Ze)),onUpdateConfig:Le[66]||(Le[66]=Ze=>Ko(Ze)),onLogin:Le[67]||(Le[67]=()=>{hs.value=!1,Oo()}),onLogout:vo,onClose:Le[68]||(Le[68]=Ze=>{hs.value=!1,st.value=void 0})},null,8,["color-scheme","font-scale","managed-provider-status","managed-user-info","on-fetch-usage","notify","notify-permission","notify-sound","config","models","config-saving","server-version","backend","experimental-flags","initial-tab"])):ee("",!0),St.value?(y(),he(wHe,{key:8,status:p(o).status.value,thinking:k.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"cost-usd":p(o).sessionCost.value,onClose:Le[69]||(Le[69]=Ze=>St.value=!1)},null,8,["status","thinking","plan-mode","swarm-mode","cost-usd"])):ee("",!0),lo.value?(y(),he(rHe,{key:9,"browse-fs":p(o).browseFs,"get-fs-home":p(o).getFsHome,"default-path":p(o).visibleWorkspace.value?.root??p(o).status.value.cwd,error:Ys.value,onAdd:Le[70]||(Le[70]=Ze=>tl(Ze)),onClose:Ho},null,8,["browse-fs","get-fs-home","default-path","error"])):ee("",!0),j(as,{name:"gload-fade"},{default:me(()=>[p(o).initialized.value?ee("",!0):(y(),he(LUe,{key:0,issue:p(o).connectIssue.value},null,8,["issue"]))]),_:1}),j(THe,{warnings:p(o).warnings.value,onDismiss:p(o).dismissWarning},null,8,["warnings","onDismiss"]),(y(),he(Zr,{to:"body"},[j(as,{name:"action-toast"},{default:me(()=>[Tn.value?(y(),he(p(Pz),{key:Tn.value.id,onDismiss:Le[71]||(Le[71]=Ze=>Tn.value=null)},{default:me(()=>[C("button",{type:"button",onClick:Qe},N(p(i)("sidebar.archiveToastUndo")),1),qe(" "+N(p(i)("sidebar.archiveToastMid"))+" ",1),C("button",{type:"button",onClick:Qt},N(p(i)("sidebar.archiveToastSettings")),1),qe(" "+N(p(i)("sidebar.archiveToastTail")),1)]),_:1})):ee("",!0)]),_:1})])),p(l)?(y(),he(lje,{key:10})):ee("",!0),j(cHe),p(a)?(y(),he(aze,{key:11,modelValue:u.value,"onUpdate:modelValue":Le[72]||(Le[72]=Ze=>u.value=Ze),groups:p(o).mobileWorkspaceGroups.value,"active-workspace-id":p(o).activeWorkspaceId.value,"active-id":p(o).activeSessionId.value,"attention-by-session":p(o).attentionBySession.value,"attention-by-workspace":p(o).attentionByWorkspace.value,onSelect:Le[73]||(Le[73]=Ze=>p(o).selectSession(Ze)),onCreate:Fs,onCreateInWorkspace:Le[74]||(Le[74]=Ze=>Rs(Ze)),onAddWorkspace:Le[75]||(Le[75]=Ze=>lo.value=!0),onRename:Le[76]||(Le[76]=(Ze,Xt)=>p(o).renameSession(Ze,Xt)),onArchive:Le[77]||(Le[77]=Ze=>fo(Ze)),onDeleteWorkspace:Le[78]||(Le[78]=Ze=>kn(Ze)),onLoadMore:Le[79]||(Le[79]=Ze=>void p(o).loadMoreSessions(Ze))},null,8,["modelValue","groups","active-workspace-id","active-id","attention-by-session","attention-by-workspace"])):ee("",!0),p(a)?(y(),he(vWe,{key:12,modelValue:c.value,"onUpdate:modelValue":Le[80]||(Le[80]=Ze=>c.value=Ze),"initial-view":Ct.value,status:p(o).status.value,thinking:p(o).thinking.value,models:p(o).models.value,"plan-mode":p(o).planMode.value,"swarm-mode":p(o).swarmMode.value,"color-scheme":p(o).colorScheme.value,"font-scale":p(o).fontScale.value,"managed-provider-status":p(o).managedProviderStatus.value,"managed-user-info":p(o).managedUserInfo.value,"server-version":p(o).serverVersion.value,onPickModel:Le[81]||(Le[81]=Ze=>ci()),onSetThinking:Le[82]||(Le[82]=Ze=>p(o).setThinking(Ze)),onTogglePlan:Le[83]||(Le[83]=Ze=>p(o).togglePlanMode()),onToggleSwarm:Le[84]||(Le[84]=Ze=>p(o).toggleSwarmMode()),onSetPermission:Le[85]||(Le[85]=Ze=>p(o).setPermission(Ze)),onSetColorScheme:Le[86]||(Le[86]=Ze=>p(o).setColorScheme(Ze)),onSetFontScale:Le[87]||(Le[87]=Ze=>p(o).setFontScale(Ze)),onLogin:Le[88]||(Le[88]=()=>{c.value=!1,Oo()}),onLogout:vo},null,8,["modelValue","initial-view","status","thinking","models","plan-mode","swarm-mode","color-scheme","font-scale","managed-provider-status","managed-user-info","server-version"])):ee("",!0)],10,hje),p(o).initialized.value&&w.value?(y(),he(AUe,{key:1,"auth-ready":p(o).managedProviderStatus.value==="authenticated","on-start-o-auth-login":Eo,"on-poll-o-auth-login":bo,"on-cancel-o-auth-login":Ns,onComplete:b,onLoginSuccess:Io,onAddProvider:_},null,8,["auth-ready"])):ee("",!0),To.value?(y(),he(JFe,{key:2,"on-start-o-auth-login":Eo,"on-poll-o-auth-login":bo,"on-cancel-o-auth-login":Ns,onSuccess:Do,onClose:Le[89]||(Le[89]=Ze=>To.value=!1)})):ee("",!0),W.value?(y(),he(Q5,{key:3,media:W.value,"origin-img":K.value,onClose:Le[90]||(Le[90]=Ze=>{W.value=null,K.value=null})},null,8,["media","origin-img"])):ee("",!0)]))}}),vje=ft(gje,[["__scopeId","data-v-ac226647"]]);B0e();const W2=Im(vje).use(Hn),yje={t:(e,t)=>Hn.global.t(e,t)};W2.provide(NM,yje);W2.provide(RM,e=>J6e(e)?.component);W2.provide(VX,mu());W2.mount("#app");if(Wp){const e=window.kimiDesktop;if(e){const t=()=>{const n=document.documentElement.dataset.colorScheme;e.setTheme(n==="light"||n==="dark"?n:"system")};new MutationObserver(t).observe(document.documentElement,{attributes:!0,attributeFilter:["data-color-scheme"]}),t()}}export{ER as $,fA as A,yO as B,rs as C,hVe as D,IS as E,Pe as F,iu as G,qe as H,j as I,JR as J,Bje as K,zr as L,et as M,GP as N,Uje as O,jje as P,Kje as Q,dm as R,Od as S,Zr as T,Vje as U,K8 as V,Wje as W,gVe as X,qje as Y,uVe as Z,kje as _,iA as a,bs as a$,ds as a0,Kg as a1,Aje as a2,O8 as a3,OA as a4,tn as a5,f1 as a6,$je as a7,kVe as a8,Rje as a9,cA as aA,NO as aB,BO as aC,dn as aD,DO as aE,PO as aF,d1 as aG,OO as aH,bn as aI,Dp as aJ,oO as aK,y as aL,qP as aM,Ije as aN,Ln as aO,ZS as aP,Eje as aQ,mm as aR,Go as aS,E4 as aT,Z as aU,oVe as aV,cD as aW,pt as aX,xn as aY,zO as aZ,Hje as a_,Dje as aa,Pje as ab,Oje as ac,iVe as ad,bVe as ae,nn as af,_P as ag,Jg as ah,Wa as ai,ia as aj,Xo as ak,sVe as al,tr as am,Ga as an,kt as ao,Yje as ap,Xje as aq,zn as ar,yt as as,TP as at,Re as au,xR as av,Zt as aw,$O as ax,RO as ay,Vn as az,Tje as b,Lde as b$,fVe as b0,up as b1,wm as b2,cVe as b3,Za as b4,qS as b5,Cje as b6,Xr as b7,cO as b8,dVe as b9,ai as bA,qs as bB,xP as bC,lVe as bD,Je as bE,I4 as bF,Nje as bG,fO as bH,Qje as bI,me as bJ,Zje as bK,Bn as bL,xl as bM,rVe as bN,It as bO,Lje as bP,Gn as bQ,jo as bR,SVe as bS,AVe as bT,l$ as bU,MVe as bV,Yce as bW,r$ as bX,G3 as bY,LVe as bZ,Fde as b_,bje as ba,N as bb,Fh as bc,zje as bd,Pn as be,_je as bf,wje as bg,Rh as bh,nVe as bi,GR as bj,p as bk,p1 as bl,yVe as bm,mVe as bn,XP as bo,kO as bp,eVe as bq,dO as br,vVe as bs,Gje as bt,Fje as bu,sA as bv,Em as bw,iD as bx,JA as by,V4 as bz,aVe as c,g5 as c0,h5 as c1,m5 as c2,NVe as c3,ag as c4,Md as c5,rg as c6,Mde as c7,Tde as c8,FVe as c9,f_e as cA,ft as cB,$Ve as ca,wVe as cb,RVe as cc,T2 as cd,Pi as ce,jde as cf,Ude as cg,Uce as ch,xVe as ci,Bce as cj,Hce as ck,_Ve as cl,v5 as cm,Vde as cn,N_ as co,p_ as cp,Jce as cq,lg as cr,ig as cs,TVe as ct,IVe as cu,CVe as cv,EVe as cw,Te as cx,OVe as cy,aF as cz,tVe as d,Ua as e,xje as f,as as g,YA as h,Sje as i,Mje as j,xr as k,Rp as l,_s as m,Ug as n,ra as o,pVe as p,R as q,Im as r,he as s,ee as t,M as u,C as v,uP as w,Jje as x,aP as y,dD as z}; diff --git a/apps/kimi-code/dist-web/assets/index-DzfhniX8.js b/apps/kimi-code/dist-web/assets/index-DCogO9ha.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index-DzfhniX8.js rename to apps/kimi-code/dist-web/assets/index-DCogO9ha.js index 41ef0c27f86..248f0e3b2f2 100644 --- a/apps/kimi-code/dist-web/assets/index-DzfhniX8.js +++ b/apps/kimi-code/dist-web/assets/index-DCogO9ha.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-ZmzTmhry.js","assets/index-BZFTzQ6y.js","assets/index-D-7nOosq.js","assets/index-DGHD7Bg9.css"])))=>i.map(i=>d[i]); -import{bR as Q}from"./index-D-7nOosq.js";var Y=class{chunks=[];cached="";dirty=!1;length=0;append(e){e&&(this.chunks.push(e),this.length+=e.length,this.dirty=!0,this.chunks.length>256&&this.compact())}clear(e=""){this.chunks=e?[e]:[],this.cached=e,this.dirty=!1,this.length=e.length}toString(){return this.dirty&&(this.cached=this.chunks.join(""),this.dirty=!1),this.cached}compact(){this.chunks=[this.chunks.join("")]}};function $(e,i){e.replaceChildren();const t=document.createElement("div");t.className="stream-diffs-shell",t.style.overflow="auto",t.style.maxHeight=typeof i=="number"?`${i}px`:i??"none";const n=document.createElement("div");return n.className="stream-diffs-surface",t.appendChild(n),e.appendChild(t),{shell:t,surface:n}}function E(e,i,t){return{name:e,contents:i,lang:t}}var Z=class{input;container;surface;instance;diff;selectedLines=null;disposed=!1;renderListeners=new Set;visualRevision=0;visualReadyPromise=Promise.resolve(!1);resolveVisualReady;constructor(e){this.input=e}async mount(e){this.disposed=!1,this.container=e,this.surface=$(e).surface,await this.render()}async update(e){this.input=e,this.surface&&await this.render(!0)}updateFile(e,i){return this.update({kind:"file",file:e,annotations:i,options:this.input.kind==="file"?this.input.options:void 0,workerManager:this.input.kind==="file"?this.input.workerManager:void 0})}updateDiff(e,i,t){return this.update({kind:"diff",oldFile:e,newFile:i,annotations:t,options:z(this.input)?this.input.options:void 0,workerManager:z(this.input)?this.input.workerManager:void 0})}updateParsedDiff(e,i){return this.update({kind:"diff",fileDiff:e,annotations:i,options:z(this.input)?this.input.options:void 0,workerManager:z(this.input)?this.input.workerManager:void 0})}updatePatch(e,i=0,t,n=0){return this.update({kind:"patch",patch:e,patchIndex:n,fileIndex:i,annotations:t,options:this.input.kind==="patch"?this.input.options:void 0,workerManager:this.input.kind==="patch"?this.input.workerManager:void 0})}updateMergeConflict(e,i){return this.update({kind:"merge-conflict",file:e,annotations:i,options:this.input.kind==="merge-conflict"?this.input.options:void 0,workerManager:this.input.kind==="merge-conflict"?this.input.workerManager:void 0})}setSelectedLines(e){this.selectedLines=e,this.instance?.setSelectedLines(e)}setAnnotations(e){this.instance&&(this.input.kind==="file"?(this.input.annotations=e,this.instance.setLineAnnotations(this.input.annotations)):(this.input.annotations=e,this.instance.setLineAnnotations(this.input.annotations)),this.emitRender())}setThemeType(e){this.input.options?this.input.options={...this.input.options,themeType:e}:this.input.options={themeType:e},this.instance?.setThemeType(e)}async setTheme(e){this.input.options?this.input.options={...this.input.options,theme:e}:this.input.options={theme:e},this.surface&&await this.render(!1)}async setOptions(e){this.input.options=e,this.surface&&await this.render(!1)}acceptReject(e,i){if(!z(this.input)||!this.diff)throw new Error("acceptReject() requires a diff view");const{diffAcceptRejectHunk:t}=this.module;return this.diff=t(this.diff,e,i),this.instance.render({fileDiff:this.diff,containerWrapper:this.surface,lineAnnotations:this.input.annotations}),this.diff}resolveConflict(e,i){if(this.input.kind!=="merge-conflict")throw new Error("resolveConflict() requires a merge-conflict view");const t=this.instance.resolveConflict(e,i);return t&&(this.input.file=t.file,this.diff=t.fileDiff),t?.file}getResolvedFile(){if(!z(this.input)||!this.diff||this.diff.isPartial)return;const e="newFile"in this.input?this.input.newFile:void 0;return{name:e?.name??this.diff.name,contents:this.diff.additionLines.join(""),lang:e?.lang??this.diff.lang}}getDiff(){return this.diff}getInput(){return this.input}getNativeInstance(){return this.instance}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}async whenVisualReady(){let e=this.visualReadyPromise;for(;;){const i=await e;if(e===this.visualReadyPromise)return i;e=this.visualReadyPromise}}dispose(){this.disposed=!0,this.invalidateVisualReady(),this.instance?.cleanUp(),this.instance=void 0,this.surface=void 0,this.container?.replaceChildren(),this.container=void 0,this.renderListeners.clear()}module;async render(e=!0){const i=this.surface;if(!i||this.disposed)return;const t=this.beginVisualRender(),n=this.module??=await Q(()=>import("./index-ZmzTmhry.js"),__vite__mapDeps([0,1,2,3]));if(this.disposed||i!==this.surface)return;if(this.instance?.cleanUp(),i.replaceChildren(),this.input.kind==="file"){const o=new n.File(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);o.render({file:this.input.file,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=o,o.setSelectedLines(this.selectedLines),this.diff=void 0;return}if(z(this.input)){if(e||!this.diff)if(this.input.kind==="patch"){const a=n.parsePatchFiles(this.input.patch)[this.input.patchIndex??0];if(!a)throw new Error(`Patch does not contain patch index ${this.input.patchIndex??0}`);const d=a.files[this.input.fileIndex??0];if(!d)throw new Error(`Patch does not contain file index ${this.input.fileIndex??0}`);this.diff=d}else"fileDiff"in this.input?this.diff=this.input.fileDiff:this.diff=n.parseDiffFromFile(this.input.oldFile,this.input.newFile,this.input.options?.parseDiffOptions);const o=new n.FileDiff(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);o.render({fileDiff:this.diff,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=o,o.setSelectedLines(this.selectedLines);return}const r=new n.UnresolvedFile(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);r.render({file:this.input.file,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=r,r.setSelectedLines(this.selectedLines),this.diff=r.fileDiff}emitRender(){for(const e of this.renderListeners)e()}beginVisualRender(){this.resolveVisualReady?.(!1);const e=++this.visualRevision;return this.visualReadyPromise=new Promise(i=>{this.resolveVisualReady=i}),e}markVisualReady(e){this.disposed||e!==this.visualRevision||(this.resolveVisualReady?.(!0),this.resolveVisualReady=void 0,this.emitRender())}invalidateVisualReady(){this.visualRevision++,this.resolveVisualReady?.(!1),this.resolveVisualReady=void 0}};function x(e){return new Z(e)}function ee(e){return!e||e.useTokenTransformer===!0||!e.onTokenClick&&!e.onTokenEnter&&!e.onTokenLeave?e:{...e,useTokenTransformer:!0}}function b(e,i){const t=ee(e),n=t?.onPostRender;return{...t,onPostRender(...r){n?.(...r),i()}}}function z(e){return e.kind==="diff"||e.kind==="patch"}var K=class{options;state="idle";stats={characters:0,lines:0,writes:0,resets:0,renderMode:"plain-text",overflowed:!1};text=new Y;pending=[];scheduled;generation=0;container;shell;surface;finalizedSurface;plainText;finalizePromise;renderListeners=new Set;finalizedRenderSubscription;constructor(e={}){this.options=e}async mount(e){if(this.state==="disposed")throw new Error("Cannot mount a disposed code stream. Create a new controller instead.");++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.plainText=void 0,this.pending=[],this.setState("mounting"),this.container=e;const{shell:i,surface:t}=$(e,this.options.maxHeight);this.shell=i,this.surface=t,this.mountPlainText(t),this.stats.startedAt??=performance.now(),this.setState("streaming")}append(e){if(e){if(this.state==="finalized"||this.state==="finalizing"||this.state==="disposed")throw new Error(`Cannot append while stream is ${this.state}`);this.text.append(e),this.stats.characters=this.text.length,this.stats.lines+=ie(e)+(this.stats.lines===0?1:0),this.pending.push(e),this.scheduleFlush()}}updateSnapshot(e){const i=this.text.toString();if(e.startsWith(i)){this.append(e.slice(i.length));return}const t=this.options.nonAppendBehavior??"reset";if(t!=="ignore"){if(t==="throw")throw new Error("Snapshot violates the append-only stream contract");return this.reset(e)}}async consume(e){try{if(Symbol.asyncIterator in e)for await(const i of e)this.append(i);else{const i=e.getReader();try{for(;;){const{done:t,value:n}=await i.read();if(t)break;this.append(n)}}finally{i.releaseLock()}}}catch(i){throw this.fail(i),i}}async flush(){if(this.cancelScheduledFlush(),!this.pending.length)return;const e=this.shouldFollowViewport(),i=this.pending.join("");this.pending.length=0,this.plainText?.append(i),this.stats.writes++,this.followViewport(e),this.emitRender()}finalize(e={view:"stream"}){if(this.state==="finalized")return Promise.resolve();if(this.finalizePromise)return this.finalizePromise;const i=this.performFinalize(e).finally(()=>{this.finalizePromise===i&&(this.finalizePromise=void 0)});return this.finalizePromise=i,i}async performFinalize(e){if(this.state==="disposed")throw new Error("Cannot finalize a disposed code stream");const i=this.generation;if(this.setState("finalizing"),await this.flush(),i!==this.generation)return;if(this.stats.finalizedAt=performance.now(),!e.view||e.view==="stream"){this.setState("finalized");return}const t=this.surface;if(!t)throw new Error("Mount the stream before finalizing to a file or diff view");const n=this.options.fileName??`code.${this.options.language??"txt"}`,r=E(n,this.getText(),this.options.language);let o;if(e.view==="file"){const{annotations:c,workerManager:g,view:S,...T}=e;o=x({kind:"file",file:r,annotations:c,options:{theme:this.options.theme,themeType:this.options.themeType,...T},workerManager:g??this.options.workerManager})}else{const{annotations:c,original:g,workerManager:S,view:T,...L}=e;o=x({kind:"diff",oldFile:E(n,g,this.options.language),newFile:r,annotations:c,options:{theme:this.options.theme,themeType:this.options.themeType,...L},workerManager:S??this.options.workerManager})}const a=document.createElement("div");if(a.className="stream-diffs-finalized",await o.mount(a),i!==this.generation){o.dispose();return}const d=this.shell,p=d?.scrollTop??0,h=d?d.scrollHeight-d.scrollTop-d.clientHeight:0;t.replaceWith(a),this.surface=a,this.plainText=void 0,this.finalizedSurface=o,this.finalizedRenderSubscription=o.onDidRender(()=>this.emitRender()),d&&(this.options.autoScroll==="always"||this.options.autoScroll!=="never"&&h<=(this.options.autoScrollThresholdPx??32)?d.scrollTop=d.scrollHeight:d.scrollTop=p),this.setState("finalized"),this.emitRender()}async reset(e=""){const i=this.container;++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.plainText=void 0,this.pending=[],this.finalizePromise=void 0,this.text.clear(),this.stats.resets++,this.stats.characters=0,this.stats.lines=0,this.stats.renderMode="plain-text",this.stats.overflowed=!1,this.setState("idle"),e&&this.append(e),i&&await this.mount(i)}setThemeType(e){this.options.themeType=e,this.finalizedSurface?.setThemeType(e)}async setTheme(e){this.options.theme=e,this.finalizedSurface&&await this.finalizedSurface.setTheme(e)}async setLanguage(e){if(e===this.options.language||(this.options.language=e,!this.finalizedSurface))return;const i=this.finalizedSurface.getInput();i.kind==="file"?await this.finalizedSurface.updateFile({...i.file,lang:e},i.annotations):i.kind==="diff"&&"oldFile"in i&&await this.finalizedSurface.updateDiff({...i.oldFile,lang:e},{...i.newFile,lang:e},i.annotations)}getText(){return this.text.toString()}getState(){return this.state}getStats(){return{...this.stats}}getElement(){return this.shell}getFinalizedSurface(){return this.finalizedSurface}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}dispose(){++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.plainText=void 0,this.container=void 0,this.surface=void 0,this.shell=void 0,this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.finalizePromise=void 0,this.renderListeners.clear(),this.setState("disposed")}scheduleFlush(){if(this.scheduled!=null||!this.plainText)return;const e=this.options.flushStrategy??"raf";e==="raf"&&typeof requestAnimationFrame=="function"?this.scheduled=requestAnimationFrame(()=>void this.flush()):this.scheduled=globalThis.setTimeout(()=>void this.flush(),e==="raf"?0:e.intervalMs)}cancelScheduledFlush(){this.scheduled!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.scheduled),clearTimeout(this.scheduled),this.scheduled=void 0)}shouldFollowViewport(){const e=this.shell;return!e||this.options.autoScroll==="never"?!1:this.options.autoScroll==="always"?!0:e.scrollHeight-e.scrollTop-e.clientHeight<=(this.options.autoScrollThresholdPx??32)}followViewport(e=this.shouldFollowViewport()){this.shell&&e&&(this.shell.scrollTop=this.shell.scrollHeight)}mountPlainText(e){const i=document.createElement("pre");i.className="stream-diffs-plain-text",i.dataset.streamDiffsState="streaming",i.style.margin="0",i.style.whiteSpace=this.options.wrap?"pre-wrap":"pre",i.style.overflowWrap=this.options.wrap?"anywhere":"normal",i.textContent=this.getText(),e.replaceChildren(i),this.plainText=i}setState(e){this.state=e,this.options.onStateChange?.(e)}emitRender(){for(const e of this.renderListeners)e()}fail(e){this.state!=="disposed"&&(this.setState("error"),this.options.onError?.(e))}};function ie(e){let i=0;for(let t=0;t{this.finalizePromise===i&&(this.finalizePromise=void 0)});return this.finalizePromise=i,i}async performFinalize(e){if(this.state==="disposed")throw new Error("Cannot finalize a disposed diff stream");const i=this.surface;if(!i)throw new Error("Mount the diff stream before finalizing it");const t=this.generation;this.setState("finalizing");const n=x({kind:"diff",oldFile:this.asFile(this.original),newFile:this.asFile(this.modified),annotations:e,options:{...this.options,diffStyle:this.options.diffStyle??"unified"},workerManager:this.options.workerManager}),r=document.createElement("div");if(r.className="stream-diffs-finalized",await n.mount(r),t!==this.generation){n.dispose();return}const o=this.shell,a=o?.scrollTop??0;return i.replaceWith(r),this.surface=r,this.finalizedSurface=n,this.finalizedRenderSubscription=n.onDidRender(()=>this.emitRender()),o&&(o.scrollTop=a),this.setState("finalized"),this.emitRender(),n}setThemeType(e){this.options.themeType=e,this.finalizedSurface?.setThemeType(e)}async setTheme(e){this.options.theme=e,this.finalizedSurface&&await this.finalizedSurface.setTheme(e)}async setLanguage(e){if(e!==this.options.language){if(this.options.language=e,this.finalizedSurface){const i=this.finalizedSurface.getInput();i.kind==="diff"&&"oldFile"in i&&await this.finalizedSurface.updateDiff({...i.oldFile,lang:e},{...i.newFile,lang:e},i.annotations);return}this.renderPre()}}getOriginal(){return this.original}getModified(){return this.modified}getState(){return this.state}getElement(){return this.shell}getFinalizedSurface(){return this.finalizedSurface}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}dispose(){++this.generation,this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.container=void 0,this.shell=void 0,this.surface=void 0,this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.finalizePromise=void 0,this.renderListeners.clear(),this.setState("disposed")}renderPre(){const e=this.surface;if(!e||this.finalizedSurface)return;const i=document.createElement("div");i.className=`stream-diffs-diff-pre stream-diffs-diff-pre--${this.options.diffStyle??"unified"}`,i.dataset.streamDiffsState="streaming",i.style.minWidth="max-content",(this.options.diffStyle??"unified")==="split"?(i.style.display="grid",i.style.gridTemplateColumns="minmax(0, 1fr) minmax(0, 1fr)",i.append(this.createPre(this.original,"deletions"),this.createPre(this.modified,"additions"))):i.append(this.createPre(te(this.original,this.modified),"unified")),e.replaceChildren(i)}createPre(e,i){const t=document.createElement("pre");return t.className=`stream-diffs-diff-pre__pane stream-diffs-diff-pre__pane--${i}`,t.dataset.side=i,t.style.margin="0",t.style.whiteSpace=this.options.wrap?"pre-wrap":"pre",t.style.overflowWrap=this.options.wrap?"anywhere":"normal",t.textContent=e,t}asFile(e){return E(this.options.fileName??`code.${this.options.language??"txt"}`,e,this.options.language)}setState(e){this.state=e,this.options.onStateChange?.(e)}emitRender(){for(const e of this.renderListeners)e()}};function te(e,i){const t=e.split(` +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B1mxH1U6.js","assets/index-DyqF2DF6.js","assets/index-Bxn5yOTB.js","assets/index-DGHD7Bg9.css"])))=>i.map(i=>d[i]); +import{bR as Q}from"./index-Bxn5yOTB.js";var Y=class{chunks=[];cached="";dirty=!1;length=0;append(e){e&&(this.chunks.push(e),this.length+=e.length,this.dirty=!0,this.chunks.length>256&&this.compact())}clear(e=""){this.chunks=e?[e]:[],this.cached=e,this.dirty=!1,this.length=e.length}toString(){return this.dirty&&(this.cached=this.chunks.join(""),this.dirty=!1),this.cached}compact(){this.chunks=[this.chunks.join("")]}};function $(e,i){e.replaceChildren();const t=document.createElement("div");t.className="stream-diffs-shell",t.style.overflow="auto",t.style.maxHeight=typeof i=="number"?`${i}px`:i??"none";const n=document.createElement("div");return n.className="stream-diffs-surface",t.appendChild(n),e.appendChild(t),{shell:t,surface:n}}function E(e,i,t){return{name:e,contents:i,lang:t}}var Z=class{input;container;surface;instance;diff;selectedLines=null;disposed=!1;renderListeners=new Set;visualRevision=0;visualReadyPromise=Promise.resolve(!1);resolveVisualReady;constructor(e){this.input=e}async mount(e){this.disposed=!1,this.container=e,this.surface=$(e).surface,await this.render()}async update(e){this.input=e,this.surface&&await this.render(!0)}updateFile(e,i){return this.update({kind:"file",file:e,annotations:i,options:this.input.kind==="file"?this.input.options:void 0,workerManager:this.input.kind==="file"?this.input.workerManager:void 0})}updateDiff(e,i,t){return this.update({kind:"diff",oldFile:e,newFile:i,annotations:t,options:z(this.input)?this.input.options:void 0,workerManager:z(this.input)?this.input.workerManager:void 0})}updateParsedDiff(e,i){return this.update({kind:"diff",fileDiff:e,annotations:i,options:z(this.input)?this.input.options:void 0,workerManager:z(this.input)?this.input.workerManager:void 0})}updatePatch(e,i=0,t,n=0){return this.update({kind:"patch",patch:e,patchIndex:n,fileIndex:i,annotations:t,options:this.input.kind==="patch"?this.input.options:void 0,workerManager:this.input.kind==="patch"?this.input.workerManager:void 0})}updateMergeConflict(e,i){return this.update({kind:"merge-conflict",file:e,annotations:i,options:this.input.kind==="merge-conflict"?this.input.options:void 0,workerManager:this.input.kind==="merge-conflict"?this.input.workerManager:void 0})}setSelectedLines(e){this.selectedLines=e,this.instance?.setSelectedLines(e)}setAnnotations(e){this.instance&&(this.input.kind==="file"?(this.input.annotations=e,this.instance.setLineAnnotations(this.input.annotations)):(this.input.annotations=e,this.instance.setLineAnnotations(this.input.annotations)),this.emitRender())}setThemeType(e){this.input.options?this.input.options={...this.input.options,themeType:e}:this.input.options={themeType:e},this.instance?.setThemeType(e)}async setTheme(e){this.input.options?this.input.options={...this.input.options,theme:e}:this.input.options={theme:e},this.surface&&await this.render(!1)}async setOptions(e){this.input.options=e,this.surface&&await this.render(!1)}acceptReject(e,i){if(!z(this.input)||!this.diff)throw new Error("acceptReject() requires a diff view");const{diffAcceptRejectHunk:t}=this.module;return this.diff=t(this.diff,e,i),this.instance.render({fileDiff:this.diff,containerWrapper:this.surface,lineAnnotations:this.input.annotations}),this.diff}resolveConflict(e,i){if(this.input.kind!=="merge-conflict")throw new Error("resolveConflict() requires a merge-conflict view");const t=this.instance.resolveConflict(e,i);return t&&(this.input.file=t.file,this.diff=t.fileDiff),t?.file}getResolvedFile(){if(!z(this.input)||!this.diff||this.diff.isPartial)return;const e="newFile"in this.input?this.input.newFile:void 0;return{name:e?.name??this.diff.name,contents:this.diff.additionLines.join(""),lang:e?.lang??this.diff.lang}}getDiff(){return this.diff}getInput(){return this.input}getNativeInstance(){return this.instance}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}async whenVisualReady(){let e=this.visualReadyPromise;for(;;){const i=await e;if(e===this.visualReadyPromise)return i;e=this.visualReadyPromise}}dispose(){this.disposed=!0,this.invalidateVisualReady(),this.instance?.cleanUp(),this.instance=void 0,this.surface=void 0,this.container?.replaceChildren(),this.container=void 0,this.renderListeners.clear()}module;async render(e=!0){const i=this.surface;if(!i||this.disposed)return;const t=this.beginVisualRender(),n=this.module??=await Q(()=>import("./index-B1mxH1U6.js"),__vite__mapDeps([0,1,2,3]));if(this.disposed||i!==this.surface)return;if(this.instance?.cleanUp(),i.replaceChildren(),this.input.kind==="file"){const o=new n.File(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);o.render({file:this.input.file,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=o,o.setSelectedLines(this.selectedLines),this.diff=void 0;return}if(z(this.input)){if(e||!this.diff)if(this.input.kind==="patch"){const a=n.parsePatchFiles(this.input.patch)[this.input.patchIndex??0];if(!a)throw new Error(`Patch does not contain patch index ${this.input.patchIndex??0}`);const d=a.files[this.input.fileIndex??0];if(!d)throw new Error(`Patch does not contain file index ${this.input.fileIndex??0}`);this.diff=d}else"fileDiff"in this.input?this.diff=this.input.fileDiff:this.diff=n.parseDiffFromFile(this.input.oldFile,this.input.newFile,this.input.options?.parseDiffOptions);const o=new n.FileDiff(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);o.render({fileDiff:this.diff,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=o,o.setSelectedLines(this.selectedLines);return}const r=new n.UnresolvedFile(b(this.input.options,()=>this.markVisualReady(t)),this.input.workerManager);r.render({file:this.input.file,containerWrapper:i,lineAnnotations:this.input.annotations}),this.instance=r,r.setSelectedLines(this.selectedLines),this.diff=r.fileDiff}emitRender(){for(const e of this.renderListeners)e()}beginVisualRender(){this.resolveVisualReady?.(!1);const e=++this.visualRevision;return this.visualReadyPromise=new Promise(i=>{this.resolveVisualReady=i}),e}markVisualReady(e){this.disposed||e!==this.visualRevision||(this.resolveVisualReady?.(!0),this.resolveVisualReady=void 0,this.emitRender())}invalidateVisualReady(){this.visualRevision++,this.resolveVisualReady?.(!1),this.resolveVisualReady=void 0}};function x(e){return new Z(e)}function ee(e){return!e||e.useTokenTransformer===!0||!e.onTokenClick&&!e.onTokenEnter&&!e.onTokenLeave?e:{...e,useTokenTransformer:!0}}function b(e,i){const t=ee(e),n=t?.onPostRender;return{...t,onPostRender(...r){n?.(...r),i()}}}function z(e){return e.kind==="diff"||e.kind==="patch"}var K=class{options;state="idle";stats={characters:0,lines:0,writes:0,resets:0,renderMode:"plain-text",overflowed:!1};text=new Y;pending=[];scheduled;generation=0;container;shell;surface;finalizedSurface;plainText;finalizePromise;renderListeners=new Set;finalizedRenderSubscription;constructor(e={}){this.options=e}async mount(e){if(this.state==="disposed")throw new Error("Cannot mount a disposed code stream. Create a new controller instead.");++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.plainText=void 0,this.pending=[],this.setState("mounting"),this.container=e;const{shell:i,surface:t}=$(e,this.options.maxHeight);this.shell=i,this.surface=t,this.mountPlainText(t),this.stats.startedAt??=performance.now(),this.setState("streaming")}append(e){if(e){if(this.state==="finalized"||this.state==="finalizing"||this.state==="disposed")throw new Error(`Cannot append while stream is ${this.state}`);this.text.append(e),this.stats.characters=this.text.length,this.stats.lines+=ie(e)+(this.stats.lines===0?1:0),this.pending.push(e),this.scheduleFlush()}}updateSnapshot(e){const i=this.text.toString();if(e.startsWith(i)){this.append(e.slice(i.length));return}const t=this.options.nonAppendBehavior??"reset";if(t!=="ignore"){if(t==="throw")throw new Error("Snapshot violates the append-only stream contract");return this.reset(e)}}async consume(e){try{if(Symbol.asyncIterator in e)for await(const i of e)this.append(i);else{const i=e.getReader();try{for(;;){const{done:t,value:n}=await i.read();if(t)break;this.append(n)}}finally{i.releaseLock()}}}catch(i){throw this.fail(i),i}}async flush(){if(this.cancelScheduledFlush(),!this.pending.length)return;const e=this.shouldFollowViewport(),i=this.pending.join("");this.pending.length=0,this.plainText?.append(i),this.stats.writes++,this.followViewport(e),this.emitRender()}finalize(e={view:"stream"}){if(this.state==="finalized")return Promise.resolve();if(this.finalizePromise)return this.finalizePromise;const i=this.performFinalize(e).finally(()=>{this.finalizePromise===i&&(this.finalizePromise=void 0)});return this.finalizePromise=i,i}async performFinalize(e){if(this.state==="disposed")throw new Error("Cannot finalize a disposed code stream");const i=this.generation;if(this.setState("finalizing"),await this.flush(),i!==this.generation)return;if(this.stats.finalizedAt=performance.now(),!e.view||e.view==="stream"){this.setState("finalized");return}const t=this.surface;if(!t)throw new Error("Mount the stream before finalizing to a file or diff view");const n=this.options.fileName??`code.${this.options.language??"txt"}`,r=E(n,this.getText(),this.options.language);let o;if(e.view==="file"){const{annotations:c,workerManager:g,view:S,...T}=e;o=x({kind:"file",file:r,annotations:c,options:{theme:this.options.theme,themeType:this.options.themeType,...T},workerManager:g??this.options.workerManager})}else{const{annotations:c,original:g,workerManager:S,view:T,...L}=e;o=x({kind:"diff",oldFile:E(n,g,this.options.language),newFile:r,annotations:c,options:{theme:this.options.theme,themeType:this.options.themeType,...L},workerManager:S??this.options.workerManager})}const a=document.createElement("div");if(a.className="stream-diffs-finalized",await o.mount(a),i!==this.generation){o.dispose();return}const d=this.shell,p=d?.scrollTop??0,h=d?d.scrollHeight-d.scrollTop-d.clientHeight:0;t.replaceWith(a),this.surface=a,this.plainText=void 0,this.finalizedSurface=o,this.finalizedRenderSubscription=o.onDidRender(()=>this.emitRender()),d&&(this.options.autoScroll==="always"||this.options.autoScroll!=="never"&&h<=(this.options.autoScrollThresholdPx??32)?d.scrollTop=d.scrollHeight:d.scrollTop=p),this.setState("finalized"),this.emitRender()}async reset(e=""){const i=this.container;++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.plainText=void 0,this.pending=[],this.finalizePromise=void 0,this.text.clear(),this.stats.resets++,this.stats.characters=0,this.stats.lines=0,this.stats.renderMode="plain-text",this.stats.overflowed=!1,this.setState("idle"),e&&this.append(e),i&&await this.mount(i)}setThemeType(e){this.options.themeType=e,this.finalizedSurface?.setThemeType(e)}async setTheme(e){this.options.theme=e,this.finalizedSurface&&await this.finalizedSurface.setTheme(e)}async setLanguage(e){if(e===this.options.language||(this.options.language=e,!this.finalizedSurface))return;const i=this.finalizedSurface.getInput();i.kind==="file"?await this.finalizedSurface.updateFile({...i.file,lang:e},i.annotations):i.kind==="diff"&&"oldFile"in i&&await this.finalizedSurface.updateDiff({...i.oldFile,lang:e},{...i.newFile,lang:e},i.annotations)}getText(){return this.text.toString()}getState(){return this.state}getStats(){return{...this.stats}}getElement(){return this.shell}getFinalizedSurface(){return this.finalizedSurface}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}dispose(){++this.generation,this.cancelScheduledFlush(),this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.plainText=void 0,this.container=void 0,this.surface=void 0,this.shell=void 0,this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.finalizePromise=void 0,this.renderListeners.clear(),this.setState("disposed")}scheduleFlush(){if(this.scheduled!=null||!this.plainText)return;const e=this.options.flushStrategy??"raf";e==="raf"&&typeof requestAnimationFrame=="function"?this.scheduled=requestAnimationFrame(()=>void this.flush()):this.scheduled=globalThis.setTimeout(()=>void this.flush(),e==="raf"?0:e.intervalMs)}cancelScheduledFlush(){this.scheduled!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this.scheduled),clearTimeout(this.scheduled),this.scheduled=void 0)}shouldFollowViewport(){const e=this.shell;return!e||this.options.autoScroll==="never"?!1:this.options.autoScroll==="always"?!0:e.scrollHeight-e.scrollTop-e.clientHeight<=(this.options.autoScrollThresholdPx??32)}followViewport(e=this.shouldFollowViewport()){this.shell&&e&&(this.shell.scrollTop=this.shell.scrollHeight)}mountPlainText(e){const i=document.createElement("pre");i.className="stream-diffs-plain-text",i.dataset.streamDiffsState="streaming",i.style.margin="0",i.style.whiteSpace=this.options.wrap?"pre-wrap":"pre",i.style.overflowWrap=this.options.wrap?"anywhere":"normal",i.textContent=this.getText(),e.replaceChildren(i),this.plainText=i}setState(e){this.state=e,this.options.onStateChange?.(e)}emitRender(){for(const e of this.renderListeners)e()}fail(e){this.state!=="disposed"&&(this.setState("error"),this.options.onError?.(e))}};function ie(e){let i=0;for(let t=0;t{this.finalizePromise===i&&(this.finalizePromise=void 0)});return this.finalizePromise=i,i}async performFinalize(e){if(this.state==="disposed")throw new Error("Cannot finalize a disposed diff stream");const i=this.surface;if(!i)throw new Error("Mount the diff stream before finalizing it");const t=this.generation;this.setState("finalizing");const n=x({kind:"diff",oldFile:this.asFile(this.original),newFile:this.asFile(this.modified),annotations:e,options:{...this.options,diffStyle:this.options.diffStyle??"unified"},workerManager:this.options.workerManager}),r=document.createElement("div");if(r.className="stream-diffs-finalized",await n.mount(r),t!==this.generation){n.dispose();return}const o=this.shell,a=o?.scrollTop??0;return i.replaceWith(r),this.surface=r,this.finalizedSurface=n,this.finalizedRenderSubscription=n.onDidRender(()=>this.emitRender()),o&&(o.scrollTop=a),this.setState("finalized"),this.emitRender(),n}setThemeType(e){this.options.themeType=e,this.finalizedSurface?.setThemeType(e)}async setTheme(e){this.options.theme=e,this.finalizedSurface&&await this.finalizedSurface.setTheme(e)}async setLanguage(e){if(e!==this.options.language){if(this.options.language=e,this.finalizedSurface){const i=this.finalizedSurface.getInput();i.kind==="diff"&&"oldFile"in i&&await this.finalizedSurface.updateDiff({...i.oldFile,lang:e},{...i.newFile,lang:e},i.annotations);return}this.renderPre()}}getOriginal(){return this.original}getModified(){return this.modified}getState(){return this.state}getElement(){return this.shell}getFinalizedSurface(){return this.finalizedSurface}onDidRender(e){return this.renderListeners.add(e),{dispose:()=>this.renderListeners.delete(e)}}dispose(){++this.generation,this.finalizedSurface?.dispose(),this.finalizedRenderSubscription?.dispose(),this.container?.replaceChildren(),this.container=void 0,this.shell=void 0,this.surface=void 0,this.finalizedSurface=void 0,this.finalizedRenderSubscription=void 0,this.finalizePromise=void 0,this.renderListeners.clear(),this.setState("disposed")}renderPre(){const e=this.surface;if(!e||this.finalizedSurface)return;const i=document.createElement("div");i.className=`stream-diffs-diff-pre stream-diffs-diff-pre--${this.options.diffStyle??"unified"}`,i.dataset.streamDiffsState="streaming",i.style.minWidth="max-content",(this.options.diffStyle??"unified")==="split"?(i.style.display="grid",i.style.gridTemplateColumns="minmax(0, 1fr) minmax(0, 1fr)",i.append(this.createPre(this.original,"deletions"),this.createPre(this.modified,"additions"))):i.append(this.createPre(te(this.original,this.modified),"unified")),e.replaceChildren(i)}createPre(e,i){const t=document.createElement("pre");return t.className=`stream-diffs-diff-pre__pane stream-diffs-diff-pre__pane--${i}`,t.dataset.side=i,t.style.margin="0",t.style.whiteSpace=this.options.wrap?"pre-wrap":"pre",t.style.overflowWrap=this.options.wrap?"anywhere":"normal",t.textContent=e,t}asFile(e){return E(this.options.fileName??`code.${this.options.language??"txt"}`,e,this.options.language)}setState(e){this.state=e,this.options.onStateChange?.(e)}emitRender(){for(const e of this.renderListeners)e()}};function te(e,i){const t=e.split(` `),n=i.split(` `);let r=0;for(;r` ${a}`),...t.slice(r,t.length-o).map(a=>`- ${a}`),...n.slice(r,n.length-o).map(a=>`+ ${a}`),...t.slice(t.length-o).map(a=>` ${a}`)].join(` `)}function he(e){return new G(e)}function ue(e={}){let i,t,n,r,o,a="text",d="",p="",h,c=0,g="system",S=U(e),T=q(e);const L={disableLineNumbers:e.lineNumbers===!1,overflow:e.wordWrap==="on"?"wrap":"scroll",enableLineSelection:e.enableLineSelection},M=()=>({...L,theme:S,themeType:g});async function H(s,l,u){k();const w=c;if(N(s,e),h=s,a=R(u),_(l))return V(s,l,a);if(e.stream===!1)return O(s,l,a);const f=new K({...M(),...F(e),fileName:`code.${a}`,language:a,maxHeight:e.MAX_HEIGHT,autoScroll:e.autoScrollOnUpdate===!1?"never":"near-bottom",autoScrollThresholdPx:e.autoScrollThresholdPx,workerManager:e.workerManager});if(i=f,f.append(l),await f.mount(s),w!==c||i!==f||h!==s)throw f.dispose(),new Error("Editor creation was cancelled");return e.onController?.(f),r=C(()=>f.getText(),s,()=>f.getFinalizedSurface(),m=>f.onDidRender(m)),r}async function I(s,l,u,w){k();const f=c;N(s,e),h=s,a=R(w),d=l,p=u;let m,v;if(e.stream===!1){if(m=x({kind:"diff",oldFile:y(l),newFile:y(u),annotations:e.lineAnnotations,workerManager:e.workerManager,options:{...M(),diffStyle:e.diffStyle??(e.renderSideBySide===!1?"unified":"split"),...F(e)}}),n=m,await m.mount(s),f!==c||n!==m||h!==s)throw m.dispose(),new Error("Editor creation was cancelled");e.onController?.(m)}else{if(v=new G({...M(),...F(e),fileName:`code.${a}`,language:a,diffStyle:e.diffStyle??(e.renderSideBySide===!1?"unified":"split"),maxHeight:e.MAX_HEIGHT,wrap:e.wordWrap==="on",workerManager:e.workerManager}),t=v,await v.mount(s,l,u),f!==c||t!==v||h!==s)throw v.dispose(),new Error("Editor creation was cancelled");e.onController?.(v)}return o=oe(()=>d,()=>p,s,()=>m??v?.getFinalizedSurface()),o}async function X(s,l=a){const u=R(l);if(_(s)){n?.getInput().kind==="merge-conflict"?(a=u,await n.updateMergeConflict(y(s),e.lineAnnotations)):h&&await V(h,s,u);return}if(e.stream===!1){n?.getInput().kind==="file"?(a=u,await n.updateFile(y(s),e.lineAnnotations)):h&&await O(h,s,u);return}if(!i){h&&await H(h,s,u);return}if(i.getState()==="finalized"){s!==i.getText()&&await i.reset(s);return}if(u!==a){a=u,await i.setLanguage(u),s!==i.getText()&&await i.reset(s);return}const w=i.getText();s.startsWith(w)?i.append(s.slice(w.length)):await i.reset(s)}async function P(s,l,u=a){if(d=s,p=l,a=R(u),t){await t.update(s,l);return}if(!n){h&&await I(h,s,l,u);return}await n.updateDiff(y(s),y(l))}function k(){c++,i?.dispose(),t?.dispose(),t||n?.dispose(),i=void 0,t=void 0,n=void 0,r=void 0,o=void 0,h=void 0}async function O(s,l,u){k();const w=c;h=s,a=u;const f=x({kind:"file",file:y(l),annotations:e.lineAnnotations,workerManager:e.workerManager,options:{...M(),...F(e)}});if(n=f,await f.mount(s),w!==c||n!==f||h!==s)throw f.dispose(),new Error("Editor creation was cancelled");return e.onController?.(f),r=C(()=>B(f)??l,s,()=>f,m=>f.onDidRender(m)),r}async function V(s,l,u){k();const w=c;h=s,a=u;const f=x({kind:"merge-conflict",file:y(l),annotations:e.lineAnnotations,workerManager:e.workerManager,options:{...M(),...F(e)}});if(n=f,await f.mount(s),w!==c||n!==f||h!==s)throw f.dispose(),new Error("Editor creation was cancelled");return e.onController?.(f),r=C(()=>B(f)??l,s,()=>f,m=>f.onDidRender(m)),r}function _(s){return e.mergeConflict===!1?!1:/^<<<<<<< .+$/m.test(s)&&/^=======$/m.test(s)&&/^>>>>>>> .+$/m.test(s)}async function J(s){if(s){if(typeof s=="string"){const l=e.themes;if(l?.[0]===s){await W(),g="dark",i?.setThemeType("dark"),t?.setThemeType("dark"),n?.setThemeType("dark");return}if(l?.[1]===s){await W(),g="light",i?.setThemeType("light"),t?.setThemeType("light"),n?.setThemeType("light");return}}T=void 0,S=s,await j(s)}}async function W(){const s=q(e);!s||s===T||(T=s,S=U(e),await j(S))}async function j(s){await i?.setTheme(s),await t?.setTheme(s),await n?.setTheme(s)}function y(s){return E(`code.${a||"txt"}`,s,a)}return{runtimeKind:"stream-diffs",createEditor:H,createDiffEditor:I,updateCode:X,appendCode(s){i?.append(s)},async finalizeCode(){if(!i||i.getState()==="finalized")return i?.getFinalizedSurface();const s=F(e);return delete s.lineAnnotations,await i.finalize({view:"file",...s,theme:S,themeType:g,annotations:e.lineAnnotations,workerManager:e.workerManager}),i.getFinalizedSurface()},async finalizeDiff(){return t&&(n=await t.finalize(e.lineAnnotations)),n},updateDiff:P,updateOriginal(s,l=a){return P(s,p,l)},updateModified(s,l=a){return P(d,s,l)},appendOriginal(s,l=a){return P(d+s,p,l)},appendModified(s,l=a){return P(d,p+s,l)},cleanupEditor:k,safeClean:k,setTheme:J,async setLanguage(s){if(a=R(s),await i?.setLanguage(a),await t?.setLanguage(a),n&&!t){const l=n.getInput();l.kind==="file"||l.kind==="merge-conflict"?await n.update({...l,file:{...l.file,lang:a}}):l.kind==="diff"&&"oldFile"in l&&await n.update({...l,oldFile:{...l.oldFile,lang:a},newFile:{...l.newFile,lang:a}})}},getCurrentTheme:()=>S,getEditor:()=>le,getEditorView:()=>r??null,getDiffEditorView:()=>o??null,getDiffModels:()=>({original:D(()=>d),modified:D(()=>n?.getResolvedFile()?.contents??t?.getModified()??p)}),getCode:()=>{const s=n?.getInput();return s?.kind==="diff"||s?.kind==="patch"?{original:d,modified:n?.getResolvedFile()?.contents??p}:s?.kind==="file"||s?.kind==="merge-conflict"?s.file.contents:t?{original:t.getOriginal(),modified:t.getModified()}:i?.getText()??null},refreshDiffPresentation:()=>n?.update(n.getInput()),whenVisualReady:async()=>{const s=h,l=c,u=n??i?.getFinalizedSurface()??t?.getFinalizedSurface();return!u||!await u.whenVisualReady()?!1:ne(s,()=>l===c&&s===h&&u===(n??i?.getFinalizedSurface()??t?.getFinalizedSurface()),()=>se(n??i?.getFinalizedSurface()??t?.getFinalizedSurface()))}}}async function ne(e,i,t){if(!e||typeof window>"u")return!1;let n="",r,o=0;for(let a=0;a<120;a+=1){if(!i())return!1;const d=e.querySelector(".stream-diffs-shell"),p=d?.querySelector("diffs-container")?.shadowRoot?.querySelector("pre"),h=d?.getBoundingClientRect(),c=p?.textContent??"";if(h&&h.width>0&&h.height>0&&p&&t()){const g=`${Math.round(h.width)}:${Math.round(h.height)}:${p.scrollWidth}:${p.scrollHeight}:${c.length}`;if(o=p===r&&g===n?o+1:1,r=p,n=g,o>=2)return!0}else n="",r=void 0,o=0;await ae()}return!1}function se(e){if(!e)return!0;const i=e.getNativeInstance(),t=i?.fileRenderer??i?.hunksRenderer;if(!t)return!0;const n=t.renderCache;if(!n?.result)return!1;if(n.highlighted===!0)return!0;const r=e.getInput();if(R(r.kind==="file"||r.kind==="merge-conflict"?r.file.lang:"oldFile"in r?r.oldFile.lang??r.newFile.lang:e.getDiff()?.lang)==="text")return!0;const o=Number(t.getTokenizeMaxLength?.()??1e5);if(r.kind==="file"||r.kind==="merge-conflict")return re(r.file.contents)>o;const a=e.getDiff();return!!a&&Math.max(a.additionLines.length,a.deletionLines.length)>o}function R(e){return!e||/^(?:text|txt|plain|plaintext)$/i.test(e)?"text":e}function re(e){if(!e)return 0;let i=1;for(let t=0;t{let i=!1;const t=()=>{i||(i=!0,window.clearTimeout(r),window.cancelAnimationFrame(n),e())},n=window.requestAnimationFrame(t),r=window.setTimeout(t,50)})}function U(e){return e.themes?.length&&typeof e.themes[0]=="string"&&typeof e.themes[1]=="string"?{dark:e.themes[0],light:e.themes[1]}:e.theme??void 0}function q(e){if(!(typeof e.themes?.[0]!="string"||typeof e.themes?.[1]!="string"))return`${e.themes[0]} diff --git a/apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js b/apps/kimi-code/dist-web/assets/index-DyqF2DF6.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js rename to apps/kimi-code/dist-web/assets/index-DyqF2DF6.js index 2fcf7105af6..282bd616943 100644 --- a/apps/kimi-code/dist-web/assets/index-BZFTzQ6y.js +++ b/apps/kimi-code/dist-web/assets/index-DyqF2DF6.js @@ -1,5 +1,5 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-DA-rfuFy.js","assets/html-pp8916En.js","assets/javascript-wDzz0qaB.js","assets/css-CLj8gQPS.js","assets/angular-ts-BrjP3tb8.js","assets/scss-D5BDwBP9.js","assets/apl-CORt7UWP.js","assets/xml-sdJ4AIDG.js","assets/java-CylS5w8V.js","assets/json-Cp-IABpG.js","assets/astro-HNnZUWAn.js","assets/typescript-BPQ3VLAy.js","assets/postcss-CXtECtnM.js","assets/tsx-COt5Ahok.js","assets/blade-2xfisSek.js","assets/html-derivative-DlHx6ybY.js","assets/sql-CRqJ_cUM.js","assets/bsl-BO_Y6i37.js","assets/sdbl-DVxCFoDh.js","assets/cairo-KRGpt6FW.js","assets/python-B6aJPvgy.js","assets/cobol-nBiQ_Alo.js","assets/coffee-Ch7k5sss.js","assets/cpp-UfJy6YNI.js","assets/regexp-CDVJQ6XC.js","assets/glsl-DplSGwfg.js","assets/c-BIGW1oBm.js","assets/crystal-DGywbUpC.js","assets/shellscript-Yzrsuije.js","assets/edge-FbVlp4U3.js","assets/elixir-CkH2-t6x.js","assets/elm-DbKCFpqz.js","assets/erb-Dm6A9KJ5.js","assets/ruby-DyJCeAvU.js","assets/haml-D5jkg6IW.js","assets/graphql-ChdNCCLP.js","assets/jsx-g9-lgVsj.js","assets/lua-BaeVxFsk.js","assets/yaml-Buea-lGh.js","assets/erlang-DsQrWhSR.js","assets/markdown-Cvjx9yec.js","assets/fortran-fixed-form-CkoXwp7k.js","assets/fortran-free-form-BxgE0vQu.js","assets/fsharp-CXgrBDvD.js","assets/gdresource-BOOCDP_w.js","assets/gdshader-DkwncUOv.js","assets/gdscript-C5YyOfLZ.js","assets/git-commit-F4YmCXRG.js","assets/diff-D97Zzqfu.js","assets/git-rebase-r7XF79zn.js","assets/glimmer-js-ByusRIyA.js","assets/glimmer-ts-BfAWNZQY.js","assets/hack-DbPARsA_.js","assets/handlebars-BpdQsYii.js","assets/http-jrhK8wxY.js","assets/hurl-irOxFIW8.js","assets/csv-fuZLfV_i.js","assets/hxml-Bvhsp5Yf.js","assets/haxe-CzTSHFRz.js","assets/jinja-f2NsQr07.js","assets/jison-wvAkD_A8.js","assets/julia-D7OTSIA_.js","assets/r-Dspwwk_N.js","assets/just-CUsbIsdP.js","assets/perl-B9cMNwum.js","assets/latex-CaSxy8MP.js","assets/tex-idrVyKtj.js","assets/liquid-C0sCDyMI.js","assets/marko-DjSrsDqO.js","assets/less-B1dDrJ26.js","assets/mdc-DTYItulj.js","assets/nextflow-C-mBbutL.js","assets/nextflow-groovy-vE_lwT2v.js","assets/nginx-BpAMiNFr.js","assets/nim-BIad80T-.js","assets/php-Csjmro_R.js","assets/pug-DKIMFp6K.js","assets/qml-3beO22l8.js","assets/razor-BjBPvh-w.js","assets/csharp-DSvCPggb.js","assets/rst-CpCqk9r5.js","assets/cmake-D1j8_8rp.js","assets/sas-DEy46yEz.js","assets/shaderlab-Dg9Lc6iA.js","assets/hlsl-D3lLCCz7.js","assets/shellsession-BADoaaVG.js","assets/soy-8wufbnw4.js","assets/sparql-rVzFXLq3.js","assets/turtle-BsS91CYL.js","assets/stata-DI20mbqo.js","assets/surrealql-Bq5Q-fJD.js","assets/svelte-Cy7k_4gC.js","assets/templ-DhtptRzy.js","assets/go-C27-OAKa.js","assets/ts-tags-D351s5mN.js","assets/twig-CW1WmMYd.js","assets/vue-D2xRrEX4.js","assets/vue-html-AaS7Mt5G.js","assets/vue-vine-BoDAl6tE.js","assets/stylus-BEDo0Tqx.js","assets/xsl-CtQFsRM5.js"])))=>i.map(i=>d[i]); -import{bR as c}from"./index-D-7nOosq.js";var Ft=Object.defineProperty,eo=Object.getOwnPropertyDescriptor,to=Object.getOwnPropertyNames,no=Object.prototype.hasOwnProperty,an=(e,t)=>{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return Ft(n,Symbol.toStringTag,{value:"Module"}),n},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=to(t),o=0,s=i.length,a;ot[l]).bind(null,a),enumerable:!(r=eo(t,a))||r.enumerable});return e},Sr=(e,t,n)=>(ro(e,t,"default"),n);const Ne=[{id:"abap",name:"ABAP",import:(()=>c(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>c(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>c(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>c(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>c(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>c(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>c(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>c(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>c(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>c(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>c(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>c(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>c(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>c(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>c(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>c(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>c(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>c(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>c(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>c(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>c(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>c(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>c(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>c(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>c(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>c(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>c(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>c(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>c(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>c(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>c(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>c(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>c(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>c(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>c(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>c(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>c(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>c(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>c(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>c(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>c(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>c(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>c(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>c(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>c(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>c(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>c(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>c(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>c(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>c(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>c(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>c(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>c(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>c(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>c(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>c(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>c(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>c(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>c(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>c(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>c(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>c(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>c(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>c(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>c(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>c(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>c(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>c(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>c(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>c(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>c(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>c(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>c(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>c(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>c(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>c(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>c(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>c(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>c(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>c(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>c(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>c(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>c(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>c(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>c(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>c(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>c(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>c(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>c(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>c(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>c(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>c(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>c(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>c(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>c(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>c(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>c(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>c(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>c(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>c(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>c(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>c(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>c(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>c(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>c(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>c(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>c(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>c(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>c(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>c(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>c(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>c(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>c(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>c(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>c(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>c(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>c(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>c(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>c(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>c(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>c(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>c(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>c(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>c(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>c(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>c(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>c(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>c(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>c(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>c(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>c(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>c(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>c(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>c(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>c(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>c(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>c(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>c(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>c(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>c(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>c(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>c(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>c(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>c(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>c(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>c(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>c(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>c(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>c(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>c(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>c(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>c(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>c(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>c(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>c(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>c(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>c(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>c(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>c(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>c(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>c(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>c(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>c(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>c(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>c(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>c(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>c(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>c(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>c(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>c(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>c(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>c(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>c(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>c(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>c(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>c(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>c(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>c(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>c(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>c(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>c(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>c(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>c(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>c(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>c(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>c(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>c(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>c(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>c(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>c(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>c(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>c(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>c(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>c(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>c(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>c(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>c(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>c(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>c(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>c(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>c(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>c(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>c(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>c(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>c(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>c(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>c(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>c(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>c(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>c(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>c(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>c(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>c(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>c(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>c(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>c(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>c(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>c(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>c(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>c(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>c(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>c(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>c(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>c(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>c(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>c(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>c(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>c(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>c(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>c(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>c(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>c(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>c(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>c(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>c(()=>import("./zig-VOosw3JB.js"),[]))}],at=Object.fromEntries(Ne.map(e=>[e.id,e.import])),lt=Object.fromEntries(Ne.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ut={...at,...lt},ct=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>c(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>c(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>c(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>c(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>c(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>c(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>c(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>c(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>c(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>c(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>c(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>c(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>c(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>c(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>c(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>c(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>c(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>c(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>c(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>c(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>c(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>c(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>c(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>c(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>c(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>c(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>c(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>c(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>c(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>c(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>c(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>c(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>c(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>c(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>c(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>c(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>c(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>c(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>c(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>c(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>c(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>c(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>c(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>c(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>c(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>c(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>c(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>c(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>c(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>c(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>c(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>c(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>c(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>c(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>c(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>c(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>c(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>c(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>c(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>c(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>c(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>c(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],dt=Object.fromEntries(ct.map(e=>[e.id,e.import]));var ln=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function io(){return 2147483648}function oo(){return typeof performance<"u"?performance.now():Date.now()}const so=(e,t)=>e+(t-e%t)%t;async function ao(e){let t,n;const r={};function i(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,m,E){r.HEAPU8.copyWithin(h,m,m+E)}function s(h){try{return t.grow(h-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function a(h){const m=r.HEAPU8.length;h=h>>>0;const E=io();if(h>E)return!1;for(let b=1;b<=4;b*=2){let g=m*(1+.2/b);g=Math.min(g,h+100663296);const y=Math.min(E,so(Math.max(h,g),65536));if(s(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(h,m,E=1024){const b=m+E;let g=m;for(;h[g]&&!(g>=b);)++g;if(g-m>16&&h.buffer&&l)return l.decode(h.subarray(m,g));let y="";for(;m>10,56320|I&1023)}}return y}function p(h,m){return h?u(r.HEAPU8,h,m):""}const d={emscripten_get_now:oo,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const m=await e({env:d,wasi_snapshot_preview1:d});t=m.memory,i(t.buffer),Object.assign(r,m),r.UTF8ToString=p}return await f(),r}var lo=Object.defineProperty,uo=(e,t,n)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>uo(e,typeof t!="symbol"?t+"":t,n);let D=null;function co(e){throw new ln(e.UTF8ToString(e.getLastOnigError()))}class pt{constructor(t){P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16Value"),P(this,"utf8Value"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16");const n=t.length,r=pt._utf8ByteLength(t),i=r!==n,o=i?new Uint32Array(n+1):null;i&&(o[n]=r);const s=i?new Uint32Array(r+1):null;i&&(s[r]=n);const a=new Uint8Array(r);let l=0;for(let u=0;u=55296&&p<=56319&&u+1=56320&&h<=57343&&(d=(p-55296<<10)+65536|h-56320,f=!0)}i&&(o[u]=l,f&&(o[u+1]=l),d<=127?s[l+0]=u:d<=2047?(s[l+0]=u,s[l+1]=u):d<=65535?(s[l+0]=u,s[l+1]=u,s[l+2]=u):(s[l+0]=u,s[l+1]=u,s[l+2]=u,s[l+3]=u)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=s}static _utf8ByteLength(t){let n=0;for(let r=0,i=t.length;r=55296&&o<=56319&&r+1=56320&&l<=57343&&(s=(o-55296<<10)+65536|l-56320,a=!0)}s<=127?n+=1:s<=2047?n+=2:s<=65535?n+=3:n+=4,a&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ht=class X{constructor(t){if(P(this,"id",++X.LAST_ID),P(this,"_onigBinding"),P(this,"content"),P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16"),P(this,"ptr"),!D)throw new ln("Must invoke loadWasm first.");this._onigBinding=D,this.content=t;const n=new pt(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!X._sharedPtrInUse?(X._sharedPtr||(X._sharedPtr=D.omalloc(1e4)),X._sharedPtrInUse=!0,D.HEAPU8.set(n.utf8Value,X._sharedPtr),this.ptr=X._sharedPtr):this.ptr=n.createString(D)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===X._sharedPtr?X._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};P(ht,"LAST_ID",0);P(ht,"_sharedPtr",0);P(ht,"_sharedPtrInUse",!1);let Lr=ht;class po{constructor(t){if(P(this,"_onigBinding"),P(this,"_ptr"),!D)throw new ln("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),ho(r)?r=await r.instantiator(n):fo(r)?r=await r.default(n):(mo(r)&&(r=r.data),go(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await yo(r)(n):r=await Eo(r)(n):_o(r)?r=await Lt(r)(n):r instanceof WebAssembly.Module?r=await Lt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Lt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Fe=t(),Fe}function Lt(e){return t=>WebAssembly.instantiate(e,t)}function yo(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Eo(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Rr;function bo(e){Rr=e}function wo(){return Rr}async function un(e){return e&&await ft(e),{createScanner(t){return new po(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Lr(t)}}}const vo=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:un,getDefaultWasmLoader:wo,loadWasm:ft,setDefaultWasmLoader:bo},Symbol.toStringTag,{value:"Module"}));var Ir=an({});Sr(Ir,vo);var L=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Co(e){return cn(e)}function cn(e){return Array.isArray(e)?Ao(e):e instanceof RegExp?e:typeof e=="object"?ko(e):e}function Ao(e){let t=[];for(let n=0,r=e.length;n{for(let r in n)e[r]=n[r]}),e}function Pr(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Pr(e.substring(0,e.length-1)):e.substr(~t+1)}var Rt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Rt.lastIndex=0,Rt.test(e))}static replaceCaptures(e,t,n){return e.replace(Rt,(r,i,o,s)=>{let a=n[parseInt(i||o,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(s){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Or(e,t){return et?1:0}function xr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;ithis._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>So(e.parent,i.parentScopes));return r?new Vr(r.fontStyle,r.foreground,r.background):null}},It=class Ke{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ke(t,r);return t}static from(...t){let n=null;for(let r=0;r"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Lo(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Lo(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Vr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ro(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,o=t.length;i1&&(b=m.slice(0,m.length-1),b.reverse()),n[r++]=new Io(E,b,i,l,u,p)}}return n}var Io=class{constructor(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o}},$=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))($||{});function To(e,t){e.sort((l,u)=>{let p=Or(l.scope,u.scope);return p!==0||(p=xr(l.parentScopes,u.parentScopes),p!==0)?p:l.index-u.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let o=new Po(t),s=new Vr(n,o.getId(r),o.getId(i)),a=new xo(new jt(0,null,-1,0,0),[]);for(let l=0,u=e.length;lt?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},xo=class Ht{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const o=n.parentScopes[i].length-t.parentScopes[r].length;if(o!==0)return o;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,o;if(r===-1?(i=t,o=""):(i=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ht._cmpBySpecificity),n}insert(t,n,r,i,o,s){if(n===""){this._doInsertHere(t,r,i,o,s);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let p;this._children.hasOwnProperty(l)?p=this._children[l]:(p=new Ht(this._mainRule.clone(),jt.cloneArr(this._rulesWithParentScopes)),this._children[l]=p),p.insert(t+1,u,r,i,o,s)}_doInsertHere(t,n,r,i,o){if(n===null){this._mainRule.acceptOverwrite(t,r,i,o);return}for(let s=0,a=this._rulesWithParentScopes.length;s>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,o,s,a){let l=U.getLanguageId(t),u=U.getTokenType(t),p=U.containsBalancedBrackets(t)?1:0,d=U.getFontStyle(t),f=U.getForeground(t),h=U.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),i!==null&&(p=i?1:0),o!==-1&&(d=o),s!==0&&(f=s),a!==0&&(h=a),(l<<0|u<<8|p<<10|d<<11|f<<15|h<<24)>>>0}};function Ze(e,t){const n=[],r=Do(e);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let u=s();if(n.push({matcher:u,priority:l}),i!==",")break;i=r.next()}return n;function o(){if(i==="-"){i=r.next();const l=o();return u=>!!l&&!l(u)}if(i==="("){i=r.next();const l=a();return i===")"&&(i=r.next()),l}if(Mn(i)){const l=[];do l.push(i),i=r.next();while(Mn(i));return u=>t(l,u)}return null}function s(){const l=[];let u=o();for(;u;)l.push(u),u=o();return p=>l.every(d=>d(p))}function a(){const l=[];let u=s();for(;u&&(l.push(u),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");u=s()}return p=>l.some(d=>d(p))}}function Mn(e){return!!e&&!!e.match(/[\w\.:]+/)}function Do(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Mr(e){typeof e.dispose=="function"&&e.dispose()}var Se=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},No=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Vo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$o=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Se(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Vo;for(const n of e)Mo(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Se){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Mo(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Se?Qe({baseGrammar:o,selfGrammar:i},r):Wt(e.ruleName,{baseGrammar:o,selfGrammar:i,repository:i.repository},r);const s=n.injections(e.scopeName);if(s)for(const a of s)r.add(new Se(a))}function Wt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];et([r],t,n)}}function Qe(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&et(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&et(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function et(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Tr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&et(r.patterns,{...t,repository:i},n);const o=r.include;if(!o)continue;const s=Gr(o);switch(s.kind){case 0:Qe({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qe(t,n);break;case 2:Wt(s.ruleName,{...t,repository:i},n);break;case 3:case 4:const a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:i};s.kind===4?Wt(s.ruleName,l,n):Qe(l,n)}else s.kind===4?n.add(new No(s.scopeName,s.ruleName)):n.add(new Se(s.scopeName));break}}}var Go=class{kind=0},Bo=class{kind=1},Uo=class{constructor(e){this.ruleName=e}kind=2},Fo=class{constructor(e){this.scopeName=e}kind=3},jo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Gr(e){if(e==="$base")return new Go;if(e==="$self")return new Bo;const t=e.indexOf("#");if(t===-1)return new Fo(e);if(t===0)return new Uo(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new jo(n,r)}}var Ho=/\\(\d+)/,Gn=/\\(\d+)/g,Wo=-1,Br=-2;var Ve=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Pr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},zo=class extends Ve{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},qo=class extends Ve{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Le(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Bn=class extends Ve{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zt=class extends Ve{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,o,s,a,l,u){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this._end=new Le(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},tt=class extends Ve{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Le(s,Br),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Re,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Ur=class V{static createCaptureRule(t,n,r,i,o){return t.registerRule(s=>new zo(n,s,r,i,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new qo(t.$vscodeTextmateLocation,t.id,t.name,t.match,V._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Tr({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Bn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,V._compilePatterns(o,n,r))}return t.while?new tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,V._compileCaptures(t.whileCaptures||t.captures,n,r),V._compilePatterns(t.patterns,n,r)):new zt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,V._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,V._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let o=0;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);a>o&&(o=a)}for(let s=0;s<=o;s++)i[s]=null;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);let l=0;t[s].patterns&&(l=V.getCompiledRuleId(t[s],n,r)),i[a]=V.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,l)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let o=0,s=t.length;ot.substring(i.start,i.end));return Gn.lastIndex=0,this.source.replace(Gn,(i,o)=>Dr(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],o,s,a,l;for(o=0,s=this.source.length;on.source);this._cached=new Un(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new Un(e,r,this._items.map(i=>i.ruleId))}},Un=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t{let n={};for(var r in e)Ft(n,r,{get:e[r],enumerable:!0});return Ft(n,Symbol.toStringTag,{value:"Module"}),n},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(var i=to(t),o=0,s=i.length,a;ot[l]).bind(null,a),enumerable:!(r=eo(t,a))||r.enumerable});return e},Sr=(e,t,n)=>(ro(e,t,"default"),n);const Ne=[{id:"abap",name:"ABAP",import:(()=>c(()=>import("./abap-BdImnpbu.js"),[]))},{id:"actionscript-3",name:"ActionScript",import:(()=>c(()=>import("./actionscript-3-CoDkCxhg.js"),[]))},{id:"ada",name:"Ada",import:(()=>c(()=>import("./ada-bCR0ucgS.js"),[]))},{id:"angular-html",name:"Angular HTML",import:(()=>c(()=>import("./angular-html-DA-rfuFy.js").then(e=>e.f),__vite__mapDeps([0,1,2,3])))},{id:"angular-ts",name:"Angular TypeScript",import:(()=>c(()=>import("./angular-ts-BrjP3tb8.js"),__vite__mapDeps([4,0,1,2,3,5])))},{id:"apache",name:"Apache Conf",import:(()=>c(()=>import("./apache-Pmp26Uib.js"),[]))},{id:"apex",name:"Apex",import:(()=>c(()=>import("./apex-Dqspr-GT.js"),[]))},{id:"apl",name:"APL",import:(()=>c(()=>import("./apl-CORt7UWP.js"),__vite__mapDeps([6,1,2,3,7,8,9])))},{id:"applescript",name:"AppleScript",import:(()=>c(()=>import("./applescript-Co6uUVPk.js"),[]))},{id:"ara",name:"Ara",import:(()=>c(()=>import("./ara-BRHolxvo.js"),[]))},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:(()=>c(()=>import("./asciidoc-Ve4PFQV2.js"),[]))},{id:"asm",name:"Assembly",import:(()=>c(()=>import("./asm-D_Q5rh1f.js"),[]))},{id:"astro",name:"Astro",import:(()=>c(()=>import("./astro-HNnZUWAn.js"),__vite__mapDeps([10,9,2,11,3,12,13])))},{id:"awk",name:"AWK",import:(()=>c(()=>import("./awk-DMzUqQB5.js"),[]))},{id:"ballerina",name:"Ballerina",import:(()=>c(()=>import("./ballerina-BFfxhgS-.js"),[]))},{id:"bat",name:"Batch File",aliases:["batch"],import:(()=>c(()=>import("./bat-BkioyH1T.js"),[]))},{id:"beancount",name:"Beancount",import:(()=>c(()=>import("./beancount-k_qm7-4y.js"),[]))},{id:"berry",name:"Berry",aliases:["be"],import:(()=>c(()=>import("./berry-uYugtg8r.js"),[]))},{id:"bibtex",name:"BibTeX",import:(()=>c(()=>import("./bibtex-CHM0blh-.js"),[]))},{id:"bicep",name:"Bicep",import:(()=>c(()=>import("./bicep-Bmn6On1c.js"),[]))},{id:"bird2",name:"BIRD2 Configuration",aliases:["bird"],import:(()=>c(()=>import("./bird2-BIv1doCn.js"),[]))},{id:"blade",name:"Blade",import:(()=>c(()=>import("./blade-2xfisSek.js"),__vite__mapDeps([14,15,1,2,3,7,8,16,9])))},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:(()=>c(()=>import("./bsl-BO_Y6i37.js"),__vite__mapDeps([17,18])))},{id:"c",name:"C",import:(()=>c(()=>import("./c-BIGW1oBm.js"),[]))},{id:"c3",name:"C3",import:(()=>c(()=>import("./c3-MRO5bC_T.js"),[]))},{id:"cadence",name:"Cadence",aliases:["cdc"],import:(()=>c(()=>import("./cadence-Bv_4Rxtq.js"),[]))},{id:"cairo",name:"Cairo",import:(()=>c(()=>import("./cairo-KRGpt6FW.js"),__vite__mapDeps([19,20])))},{id:"clarity",name:"Clarity",import:(()=>c(()=>import("./clarity-D53aC0YG.js"),[]))},{id:"clojure",name:"Clojure",aliases:["clj"],import:(()=>c(()=>import("./clojure-P80f7IUj.js"),[]))},{id:"cmake",name:"CMake",import:(()=>c(()=>import("./cmake-D1j8_8rp.js"),[]))},{id:"cobol",name:"COBOL",import:(()=>c(()=>import("./cobol-nBiQ_Alo.js"),__vite__mapDeps([21,1,2,3,8])))},{id:"codeowners",name:"CODEOWNERS",import:(()=>c(()=>import("./codeowners-Bp6g37R7.js"),[]))},{id:"codeql",name:"CodeQL",aliases:["ql"],import:(()=>c(()=>import("./codeql-DsOJ9woJ.js"),[]))},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:(()=>c(()=>import("./coffee-Ch7k5sss.js"),__vite__mapDeps([22,2])))},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:(()=>c(()=>import("./common-lisp-Cg-RD9OK.js"),[]))},{id:"coq",name:"Coq",import:(()=>c(()=>import("./coq-DkFqJrB1.js"),[]))},{id:"cpp",name:"C++",aliases:["c++"],import:(()=>c(()=>import("./cpp-UfJy6YNI.js"),__vite__mapDeps([23,24,25,26,16])))},{id:"crystal",name:"Crystal",import:(()=>c(()=>import("./crystal-DGywbUpC.js"),__vite__mapDeps([27,1,2,3,16,26,28])))},{id:"csharp",name:"C#",aliases:["c#","cs"],import:(()=>c(()=>import("./csharp-DSvCPggb.js"),[]))},{id:"css",name:"CSS",import:(()=>c(()=>import("./css-CLj8gQPS.js"),[]))},{id:"csv",name:"CSV",import:(()=>c(()=>import("./csv-fuZLfV_i.js"),[]))},{id:"cue",name:"CUE",import:(()=>c(()=>import("./cue-D82EKSYY.js"),[]))},{id:"cypher",name:"Cypher",aliases:["cql"],import:(()=>c(()=>import("./cypher-COkxafJQ.js"),[]))},{id:"d",name:"D",import:(()=>c(()=>import("./d-85-TOEBH.js"),[]))},{id:"dart",name:"Dart",import:(()=>c(()=>import("./dart-bE4Kk8sk.js"),[]))},{id:"dax",name:"DAX",import:(()=>c(()=>import("./dax-CEL-wOlO.js"),[]))},{id:"desktop",name:"Desktop",import:(()=>c(()=>import("./desktop-BmXAJ9_W.js"),[]))},{id:"diff",name:"Diff",import:(()=>c(()=>import("./diff-D97Zzqfu.js"),[]))},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:(()=>c(()=>import("./docker-BcOcwvcX.js"),[]))},{id:"dotenv",name:"dotEnv",import:(()=>c(()=>import("./dotenv-Da5cRb03.js"),[]))},{id:"dream-maker",name:"Dream Maker",import:(()=>c(()=>import("./dream-maker-BtqSS_iP.js"),[]))},{id:"edge",name:"Edge",import:(()=>c(()=>import("./edge-FbVlp4U3.js"),__vite__mapDeps([29,11,1,2,3,15])))},{id:"elixir",name:"Elixir",import:(()=>c(()=>import("./elixir-CkH2-t6x.js"),__vite__mapDeps([30,1,2,3])))},{id:"elm",name:"Elm",import:(()=>c(()=>import("./elm-DbKCFpqz.js"),__vite__mapDeps([31,25,26])))},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:(()=>c(()=>import("./emacs-lisp-CXvaQtF9.js"),[]))},{id:"erb",name:"ERB",import:(()=>c(()=>import("./erb-Dm6A9KJ5.js"),__vite__mapDeps([32,1,2,3,33,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"erlang",name:"Erlang",aliases:["erl"],import:(()=>c(()=>import("./erlang-DsQrWhSR.js"),__vite__mapDeps([39,40])))},{id:"fennel",name:"Fennel",import:(()=>c(()=>import("./fennel-BYunw83y.js"),[]))},{id:"fish",name:"Fish",import:(()=>c(()=>import("./fish-BvzEVeQv.js"),[]))},{id:"fluent",name:"Fluent",aliases:["ftl"],import:(()=>c(()=>import("./fluent-C4IJs8-o.js"),[]))},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:(()=>c(()=>import("./fortran-fixed-form-CkoXwp7k.js"),__vite__mapDeps([41,42])))},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:(()=>c(()=>import("./fortran-free-form-BxgE0vQu.js"),[]))},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:(()=>c(()=>import("./fsharp-CXgrBDvD.js"),__vite__mapDeps([43,40])))},{id:"gdresource",name:"GDResource",aliases:["tscn","tres"],import:(()=>c(()=>import("./gdresource-BOOCDP_w.js"),__vite__mapDeps([44,45,46])))},{id:"gdscript",name:"GDScript",aliases:["gd"],import:(()=>c(()=>import("./gdscript-C5YyOfLZ.js"),[]))},{id:"gdshader",name:"GDShader",import:(()=>c(()=>import("./gdshader-DkwncUOv.js"),[]))},{id:"genie",name:"Genie",import:(()=>c(()=>import("./genie-D0YGMca9.js"),[]))},{id:"gherkin",name:"Gherkin",import:(()=>c(()=>import("./gherkin-DyxjwDmM.js"),[]))},{id:"git-commit",name:"Git Commit Message",import:(()=>c(()=>import("./git-commit-F4YmCXRG.js"),__vite__mapDeps([47,48])))},{id:"git-rebase",name:"Git Rebase Message",import:(()=>c(()=>import("./git-rebase-r7XF79zn.js"),__vite__mapDeps([49,28])))},{id:"gleam",name:"Gleam",import:(()=>c(()=>import("./gleam-BspZqrRM.js"),[]))},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:(()=>c(()=>import("./glimmer-js-ByusRIyA.js"),__vite__mapDeps([50,2,11,3,1])))},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:(()=>c(()=>import("./glimmer-ts-BfAWNZQY.js"),__vite__mapDeps([51,11,3,2,1])))},{id:"glsl",name:"GLSL",import:(()=>c(()=>import("./glsl-DplSGwfg.js"),__vite__mapDeps([25,26])))},{id:"gn",name:"GN",import:(()=>c(()=>import("./gn-n2N0HUVH.js"),[]))},{id:"gnuplot",name:"Gnuplot",import:(()=>c(()=>import("./gnuplot-DdkO51Og.js"),[]))},{id:"go",name:"Go",import:(()=>c(()=>import("./go-C27-OAKa.js"),[]))},{id:"graphql",name:"GraphQL",aliases:["gql"],import:(()=>c(()=>import("./graphql-ChdNCCLP.js"),__vite__mapDeps([35,2,11,36,13])))},{id:"groovy",name:"Groovy",import:(()=>c(()=>import("./groovy-gcz8RCvz.js"),[]))},{id:"hack",name:"Hack",import:(()=>c(()=>import("./hack-DbPARsA_.js"),__vite__mapDeps([52,1,2,3,16])))},{id:"haml",name:"Ruby Haml",import:(()=>c(()=>import("./haml-D5jkg6IW.js"),__vite__mapDeps([34,2,3])))},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:(()=>c(()=>import("./handlebars-BpdQsYii.js"),__vite__mapDeps([53,1,2,3,38])))},{id:"haskell",name:"Haskell",aliases:["hs"],import:(()=>c(()=>import("./haskell-Df6bDoY_.js"),[]))},{id:"haxe",name:"Haxe",import:(()=>c(()=>import("./haxe-CzTSHFRz.js"),[]))},{id:"hcl",name:"HashiCorp HCL",import:(()=>c(()=>import("./hcl-BWvSN4gD.js"),[]))},{id:"hjson",name:"Hjson",import:(()=>c(()=>import("./hjson-D5-asLiD.js"),[]))},{id:"hlsl",name:"HLSL",import:(()=>c(()=>import("./hlsl-D3lLCCz7.js"),[]))},{id:"html",name:"HTML",import:(()=>c(()=>import("./html-pp8916En.js"),__vite__mapDeps([1,2,3])))},{id:"html-derivative",name:"HTML (Derivative)",import:(()=>c(()=>import("./html-derivative-DlHx6ybY.js"),__vite__mapDeps([15,1,2,3])))},{id:"http",name:"HTTP",import:(()=>c(()=>import("./http-jrhK8wxY.js"),__vite__mapDeps([54,28,9,7,8,35,2,11,36,13])))},{id:"hurl",name:"Hurl",import:(()=>c(()=>import("./hurl-irOxFIW8.js"),__vite__mapDeps([55,35,2,11,36,13,7,8,56])))},{id:"hxml",name:"HXML",import:(()=>c(()=>import("./hxml-Bvhsp5Yf.js"),__vite__mapDeps([57,58])))},{id:"hy",name:"Hy",import:(()=>c(()=>import("./hy-DFXneXwc.js"),[]))},{id:"imba",name:"Imba",import:(()=>c(()=>import("./imba-DGztddWO.js"),[]))},{id:"ini",name:"INI",aliases:["properties"],import:(()=>c(()=>import("./ini-BEwlwnbL.js"),[]))},{id:"java",name:"Java",import:(()=>c(()=>import("./java-CylS5w8V.js"),[]))},{id:"javascript",name:"JavaScript",aliases:["js","cjs","mjs"],import:(()=>c(()=>import("./javascript-wDzz0qaB.js"),[]))},{id:"jinja",name:"Jinja",import:(()=>c(()=>import("./jinja-f2NsQr07.js"),__vite__mapDeps([59,1,2,3])))},{id:"jison",name:"Jison",import:(()=>c(()=>import("./jison-wvAkD_A8.js"),__vite__mapDeps([60,2])))},{id:"json",name:"JSON",import:(()=>c(()=>import("./json-Cp-IABpG.js"),[]))},{id:"json5",name:"JSON5",import:(()=>c(()=>import("./json5-C9tS-k6U.js"),[]))},{id:"jsonc",name:"JSON with Comments",import:(()=>c(()=>import("./jsonc-Des-eS-w.js"),[]))},{id:"jsonl",name:"JSON Lines",import:(()=>c(()=>import("./jsonl-DcaNXYhu.js"),[]))},{id:"jsonnet",name:"Jsonnet",import:(()=>c(()=>import("./jsonnet-DFQXde-d.js"),[]))},{id:"jssm",name:"JSSM",aliases:["fsl"],import:(()=>c(()=>import("./jssm-C2t-YnRu.js"),[]))},{id:"jsx",name:"JSX",import:(()=>c(()=>import("./jsx-g9-lgVsj.js"),[]))},{id:"julia",name:"Julia",aliases:["jl"],import:(()=>c(()=>import("./julia-D7OTSIA_.js"),__vite__mapDeps([61,23,24,25,26,16,20,2,62])))},{id:"just",name:"Just",import:(()=>c(()=>import("./just-CUsbIsdP.js"),__vite__mapDeps([63,28,2,11,64,1,3,7,8,16,20,33,34,35,36,13,23,24,25,26,37,38])))},{id:"kdl",name:"KDL",import:(()=>c(()=>import("./kdl-DV7GczEv.js"),[]))},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:(()=>c(()=>import("./kotlin-BdnUsdx6.js"),[]))},{id:"kusto",name:"Kusto",aliases:["kql"],import:(()=>c(()=>import("./kusto-wEQ09or8.js"),[]))},{id:"latex",name:"LaTeX",import:(()=>c(()=>import("./latex-CaSxy8MP.js"),__vite__mapDeps([65,66,62])))},{id:"lean",name:"Lean 4",aliases:["lean4"],import:(()=>c(()=>import("./lean-BZvkOJ9d.js"),[]))},{id:"less",name:"Less",import:(()=>c(()=>import("./less-B1dDrJ26.js"),[]))},{id:"liquid",name:"Liquid",import:(()=>c(()=>import("./liquid-C0sCDyMI.js"),__vite__mapDeps([67,1,2,3,9])))},{id:"llvm",name:"LLVM IR",import:(()=>c(()=>import("./llvm-DjAJT7YJ.js"),[]))},{id:"log",name:"Log file",import:(()=>c(()=>import("./log-2UxHyX5q.js"),[]))},{id:"logo",name:"Logo",import:(()=>c(()=>import("./logo-BtOb2qkB.js"),[]))},{id:"lua",name:"Lua",import:(()=>c(()=>import("./lua-BaeVxFsk.js"),__vite__mapDeps([37,26])))},{id:"luau",name:"Luau",import:(()=>c(()=>import("./luau-KW6xsasC.js"),[]))},{id:"make",name:"Makefile",aliases:["makefile"],import:(()=>c(()=>import("./make-CHLpvVh8.js"),[]))},{id:"markdown",name:"Markdown",aliases:["md"],import:(()=>c(()=>import("./markdown-Cvjx9yec.js"),[]))},{id:"marko",name:"Marko",import:(()=>c(()=>import("./marko-DjSrsDqO.js"),__vite__mapDeps([68,3,69,5,11])))},{id:"matlab",name:"MATLAB",import:(()=>c(()=>import("./matlab-D7o27uSR.js"),[]))},{id:"mdc",name:"MDC",import:(()=>c(()=>import("./mdc-DTYItulj.js"),__vite__mapDeps([70,40,38,15,1,2,3])))},{id:"mdx",name:"MDX",import:(()=>c(()=>import("./mdx-Cmh6b_Ma.js"),[]))},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:(()=>c(()=>import("./mermaid-mWjccvbQ.js"),[]))},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:(()=>c(()=>import("./mipsasm-CKIfxQSi.js"),[]))},{id:"mojo",name:"Mojo",import:(()=>c(()=>import("./mojo-rZm6bMo-.js"),[]))},{id:"moonbit",name:"MoonBit",aliases:["mbt","mbti"],import:(()=>c(()=>import("./moonbit-_H4v1dQx.js"),[]))},{id:"move",name:"Move",import:(()=>c(()=>import("./move-IF9eRakj.js"),[]))},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:(()=>c(()=>import("./narrat-DRg8JJMk.js"),[]))},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:(()=>c(()=>import("./nextflow-C-mBbutL.js"),__vite__mapDeps([71,72])))},{id:"nextflow-groovy",name:"Nextflow Groovy",import:(()=>c(()=>import("./nextflow-groovy-vE_lwT2v.js"),[]))},{id:"nginx",name:"Nginx",import:(()=>c(()=>import("./nginx-BpAMiNFr.js"),__vite__mapDeps([73,37,26])))},{id:"nim",name:"Nim",import:(()=>c(()=>import("./nim-BIad80T-.js"),__vite__mapDeps([74,26,1,2,3,7,8,25,40])))},{id:"nix",name:"Nix",import:(()=>c(()=>import("./nix-CwoSXNpI.js"),[]))},{id:"nushell",name:"nushell",aliases:["nu"],import:(()=>c(()=>import("./nushell-Cz2AlsmD.js"),[]))},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:(()=>c(()=>import("./objective-c-DXmwc3jG.js"),[]))},{id:"objective-cpp",name:"Objective-C++",import:(()=>c(()=>import("./objective-cpp-CLxacb5B.js"),[]))},{id:"ocaml",name:"OCaml",import:(()=>c(()=>import("./ocaml-C0hk2d4L.js"),[]))},{id:"odin",name:"Odin",import:(()=>c(()=>import("./odin-BBf5iR-q.js"),[]))},{id:"openscad",name:"OpenSCAD",aliases:["scad"],import:(()=>c(()=>import("./openscad-C4EeE6gA.js"),[]))},{id:"pascal",name:"Pascal",import:(()=>c(()=>import("./pascal-D93ZcfNL.js"),[]))},{id:"perl",name:"Perl",import:(()=>c(()=>import("./perl-B9cMNwum.js"),__vite__mapDeps([64,1,2,3,7,8,16])))},{id:"php",name:"PHP",import:(()=>c(()=>import("./php-Csjmro_R.js"),__vite__mapDeps([75,1,2,3,7,8,16,9])))},{id:"pkl",name:"Pkl",import:(()=>c(()=>import("./pkl-u5AG7uiY.js"),[]))},{id:"plsql",name:"PL/SQL",import:(()=>c(()=>import("./plsql-ChMvpjG-.js"),[]))},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:(()=>c(()=>import("./po-BTJTHyun.js"),[]))},{id:"polar",name:"Polar",import:(()=>c(()=>import("./polar-C0HS_06l.js"),[]))},{id:"postcss",name:"PostCSS",import:(()=>c(()=>import("./postcss-CXtECtnM.js"),[]))},{id:"powerquery",name:"PowerQuery",import:(()=>c(()=>import("./powerquery-CEu0bR-o.js"),[]))},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:(()=>c(()=>import("./powershell-Dpen1YoG.js"),[]))},{id:"prisma",name:"Prisma",import:(()=>c(()=>import("./prisma-Dd19v3D-.js"),[]))},{id:"prolog",name:"Prolog",import:(()=>c(()=>import("./prolog-CbFg5uaA.js"),[]))},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:(()=>c(()=>import("./proto-C7zT0LnQ.js"),[]))},{id:"pug",name:"Pug",aliases:["jade"],import:(()=>c(()=>import("./pug-DKIMFp6K.js"),__vite__mapDeps([76,2,3,1])))},{id:"puppet",name:"Puppet",import:(()=>c(()=>import("./puppet-BMWR74SV.js"),[]))},{id:"purescript",name:"PureScript",import:(()=>c(()=>import("./purescript-CklMAg4u.js"),[]))},{id:"python",name:"Python",aliases:["py"],import:(()=>c(()=>import("./python-B6aJPvgy.js"),[]))},{id:"qml",name:"QML",import:(()=>c(()=>import("./qml-3beO22l8.js"),__vite__mapDeps([77,2])))},{id:"qmldir",name:"QML Directory",import:(()=>c(()=>import("./qmldir-C8lEn-DE.js"),[]))},{id:"qss",name:"Qt Style Sheets",import:(()=>c(()=>import("./qss-IeuSbFQv.js"),[]))},{id:"r",name:"R",import:(()=>c(()=>import("./r-Dspwwk_N.js"),[]))},{id:"racket",name:"Racket",import:(()=>c(()=>import("./racket-BqYA7rlc.js"),[]))},{id:"raku",name:"Raku",aliases:["perl6"],import:(()=>c(()=>import("./raku-DXvB9xmW.js"),[]))},{id:"razor",name:"ASP.NET Razor",import:(()=>c(()=>import("./razor-BjBPvh-w.js"),__vite__mapDeps([78,1,2,3,79])))},{id:"reg",name:"Windows Registry Script",import:(()=>c(()=>import("./reg-C-SQnVFl.js"),[]))},{id:"regexp",name:"RegExp",aliases:["regex"],import:(()=>c(()=>import("./regexp-CDVJQ6XC.js"),[]))},{id:"rel",name:"Rel",import:(()=>c(()=>import("./rel-C3B-1QV4.js"),[]))},{id:"riscv",name:"RISC-V",import:(()=>c(()=>import("./riscv-BM1_JUlF.js"),[]))},{id:"ron",name:"RON",import:(()=>c(()=>import("./ron-D8l8udqQ.js"),[]))},{id:"rosmsg",name:"ROS Interface",import:(()=>c(()=>import("./rosmsg-BJDFO7_C.js"),[]))},{id:"rst",name:"reStructuredText",import:(()=>c(()=>import("./rst-CpCqk9r5.js"),__vite__mapDeps([80,15,1,2,3,23,24,25,26,16,20,28,38,81,33,34,7,8,35,11,36,13,37])))},{id:"ruby",name:"Ruby",aliases:["rb"],import:(()=>c(()=>import("./ruby-DyJCeAvU.js"),__vite__mapDeps([33,1,2,3,34,7,8,16,35,11,36,13,23,24,25,26,28,37,38])))},{id:"rust",name:"Rust",aliases:["rs"],import:(()=>c(()=>import("./rust-B1yitclQ.js"),[]))},{id:"sas",name:"SAS",import:(()=>c(()=>import("./sas-DEy46yEz.js"),__vite__mapDeps([82,16])))},{id:"sass",name:"Sass",import:(()=>c(()=>import("./sass-Cj5Yp3dK.js"),[]))},{id:"scala",name:"Scala",import:(()=>c(()=>import("./scala-C151Ov-r.js"),[]))},{id:"scheme",name:"Scheme",import:(()=>c(()=>import("./scheme-C98Dy4si.js"),[]))},{id:"scss",name:"SCSS",import:(()=>c(()=>import("./scss-D5BDwBP9.js"),__vite__mapDeps([5,3])))},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:(()=>c(()=>import("./sdbl-DVxCFoDh.js"),[]))},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:(()=>c(()=>import("./shaderlab-Dg9Lc6iA.js"),__vite__mapDeps([83,84])))},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:(()=>c(()=>import("./shellscript-Yzrsuije.js"),[]))},{id:"shellsession",name:"Shell Session",aliases:["console"],import:(()=>c(()=>import("./shellsession-BADoaaVG.js"),__vite__mapDeps([85,28])))},{id:"smalltalk",name:"Smalltalk",import:(()=>c(()=>import("./smalltalk-BERRCDM3.js"),[]))},{id:"solidity",name:"Solidity",import:(()=>c(()=>import("./solidity-rGO070M0.js"),[]))},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:(()=>c(()=>import("./soy-8wufbnw4.js"),__vite__mapDeps([86,1,2,3])))},{id:"sparql",name:"SPARQL",import:(()=>c(()=>import("./sparql-rVzFXLq3.js"),__vite__mapDeps([87,88])))},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:(()=>c(()=>import("./splunk-BtCnVYZw.js"),[]))},{id:"sql",name:"SQL",import:(()=>c(()=>import("./sql-CRqJ_cUM.js"),[]))},{id:"ssh-config",name:"SSH Config",import:(()=>c(()=>import("./ssh-config-_ykCGR6B.js"),[]))},{id:"stata",name:"Stata",import:(()=>c(()=>import("./stata-DI20mbqo.js"),__vite__mapDeps([89,16])))},{id:"stylus",name:"Stylus",aliases:["styl"],import:(()=>c(()=>import("./stylus-BEDo0Tqx.js"),[]))},{id:"surrealql",name:"SurrealQL",aliases:["surql"],import:(()=>c(()=>import("./surrealql-Bq5Q-fJD.js"),__vite__mapDeps([90,2])))},{id:"svelte",name:"Svelte",import:(()=>c(()=>import("./svelte-Cy7k_4gC.js"),__vite__mapDeps([91,2,11,3,12])))},{id:"swift",name:"Swift",import:(()=>c(()=>import("./swift-D82vCrfD.js"),[]))},{id:"system-verilog",name:"SystemVerilog",import:(()=>c(()=>import("./system-verilog-CnnmHF94.js"),[]))},{id:"systemd",name:"Systemd Units",import:(()=>c(()=>import("./systemd-4A_iFExJ.js"),[]))},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:(()=>c(()=>import("./talonscript-CkByrt1z.js"),[]))},{id:"tasl",name:"Tasl",import:(()=>c(()=>import("./tasl-QIJgUcNo.js"),[]))},{id:"tcl",name:"Tcl",import:(()=>c(()=>import("./tcl-dwOrl1Do.js"),[]))},{id:"templ",name:"Templ",import:(()=>c(()=>import("./templ-DhtptRzy.js"),__vite__mapDeps([92,93,2,3])))},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:(()=>c(()=>import("./terraform-BETggiCN.js"),[]))},{id:"tex",name:"TeX",import:(()=>c(()=>import("./tex-idrVyKtj.js"),__vite__mapDeps([66,62])))},{id:"toml",name:"TOML",import:(()=>c(()=>import("./toml-vGWfd6FD.js"),[]))},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:(()=>c(()=>import("./ts-tags-D351s5mN.js"),__vite__mapDeps([94,11,3,2,25,26,1,16,7,8])))},{id:"tsv",name:"TSV",import:(()=>c(()=>import("./tsv-B_m7g4N7.js"),[]))},{id:"tsx",name:"TSX",import:(()=>c(()=>import("./tsx-COt5Ahok.js"),[]))},{id:"turtle",name:"Turtle",import:(()=>c(()=>import("./turtle-BsS91CYL.js"),[]))},{id:"twig",name:"Twig",import:(()=>c(()=>import("./twig-CW1WmMYd.js"),__vite__mapDeps([95,3,2,5,75,1,7,8,16,9,20,33,34,35,11,36,13,23,24,25,26,28,37,38])))},{id:"typescript",name:"TypeScript",aliases:["ts","cts","mts"],import:(()=>c(()=>import("./typescript-BPQ3VLAy.js"),[]))},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:(()=>c(()=>import("./typespec-CAFt9gP4.js"),[]))},{id:"typst",name:"Typst",aliases:["typ"],import:(()=>c(()=>import("./typst-DHCkPAjA.js"),[]))},{id:"v",name:"V",import:(()=>c(()=>import("./v-BcVCzyr7.js"),[]))},{id:"vala",name:"Vala",import:(()=>c(()=>import("./vala-CsfeWuGM.js"),[]))},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:(()=>c(()=>import("./vb-D17OF-Vu.js"),[]))},{id:"verilog",name:"Verilog",import:(()=>c(()=>import("./verilog-BQ8w6xss.js"),[]))},{id:"vhdl",name:"VHDL",import:(()=>c(()=>import("./vhdl-CeAyd5Ju.js"),[]))},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:(()=>c(()=>import("./viml-CJc9bBzg.js"),[]))},{id:"vue",name:"Vue",import:(()=>c(()=>import("./vue-D2xRrEX4.js"),__vite__mapDeps([96,3,2,11,9,1,15])))},{id:"vue-html",name:"Vue HTML",import:(()=>c(()=>import("./vue-html-AaS7Mt5G.js"),__vite__mapDeps([97,2])))},{id:"vue-vine",name:"Vue Vine",import:(()=>c(()=>import("./vue-vine-BoDAl6tE.js"),__vite__mapDeps([98,3,5,69,99,12,2])))},{id:"vyper",name:"Vyper",aliases:["vy"],import:(()=>c(()=>import("./vyper-CDx5xZoG.js"),[]))},{id:"wasm",name:"WebAssembly",import:(()=>c(()=>import("./wasm-MzD3tlZU.js"),[]))},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:(()=>c(()=>import("./wenyan-BV7otONQ.js"),[]))},{id:"wgsl",name:"WGSL",import:(()=>c(()=>import("./wgsl-Dx-B1_4e.js"),[]))},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:(()=>c(()=>import("./wikitext-BhOHFoWU.js"),[]))},{id:"wit",name:"WebAssembly Interface Types",import:(()=>c(()=>import("./wit-5i3qLPDT.js"),[]))},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:(()=>c(()=>import("./wolfram-lXgVvXCa.js"),[]))},{id:"xml",name:"XML",import:(()=>c(()=>import("./xml-sdJ4AIDG.js"),__vite__mapDeps([7,8])))},{id:"xsl",name:"XSL",import:(()=>c(()=>import("./xsl-CtQFsRM5.js"),__vite__mapDeps([100,7,8])))},{id:"yaml",name:"YAML",aliases:["yml"],import:(()=>c(()=>import("./yaml-Buea-lGh.js"),[]))},{id:"zenscript",name:"ZenScript",import:(()=>c(()=>import("./zenscript-DVFEvuxE.js"),[]))},{id:"zig",name:"Zig",import:(()=>c(()=>import("./zig-VOosw3JB.js"),[]))}],at=Object.fromEntries(Ne.map(e=>[e.id,e.import])),lt=Object.fromEntries(Ne.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),ut={...at,...lt},ct=[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:(()=>c(()=>import("./andromeeda-C4gqWexZ.js"),[]))},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:(()=>c(()=>import("./aurora-x-D-2ljcwZ.js"),[]))},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:(()=>c(()=>import("./ayu-dark-DYE7WIF3.js"),[]))},{id:"ayu-light",displayName:"Ayu Light",type:"light",import:(()=>c(()=>import("./ayu-light-BA47KaF1.js"),[]))},{id:"ayu-mirage",displayName:"Ayu Mirage",type:"dark",import:(()=>c(()=>import("./ayu-mirage-32ctXXKs.js"),[]))},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:(()=>c(()=>import("./catppuccin-frappe-DFWUc33u.js"),[]))},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:(()=>c(()=>import("./catppuccin-latte-C9dUb6Cb.js"),[]))},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:(()=>c(()=>import("./catppuccin-macchiato-DQyhUUbL.js"),[]))},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:(()=>c(()=>import("./catppuccin-mocha-D87Tk5Gz.js"),[]))},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:(()=>c(()=>import("./dark-plus-C3mMm8J8.js"),[]))},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:(()=>c(()=>import("./dracula-BzJJZx-M.js"),[]))},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:(()=>c(()=>import("./dracula-soft-BXkSAIEj.js"),[]))},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:(()=>c(()=>import("./everforest-dark-BgDCqdQA.js"),[]))},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:(()=>c(()=>import("./everforest-light-C8M2exoo.js"),[]))},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:(()=>c(()=>import("./github-dark-DHJKELXO.js"),[]))},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:(()=>c(()=>import("./github-dark-default-Cuk6v7N8.js"),[]))},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:(()=>c(()=>import("./github-dark-dimmed-DH5Ifo-i.js"),[]))},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:(()=>c(()=>import("./github-dark-high-contrast-E3gJ1_iC.js"),[]))},{id:"github-light",displayName:"GitHub Light",type:"light",import:(()=>c(()=>import("./github-light-DAi9KRSo.js"),[]))},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:(()=>c(()=>import("./github-light-default-D7oLnXFd.js"),[]))},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:(()=>c(()=>import("./github-light-high-contrast-BfjtVDDH.js"),[]))},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-hard-CFHQjOhq.js"),[]))},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-medium-GsRaNv29.js"),[]))},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:(()=>c(()=>import("./gruvbox-dark-soft-CVdnzihN.js"),[]))},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:(()=>c(()=>import("./gruvbox-light-hard-CH1njM8p.js"),[]))},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:(()=>c(()=>import("./gruvbox-light-medium-DRw_LuNl.js"),[]))},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:(()=>c(()=>import("./gruvbox-light-soft-hJgmCMqR.js"),[]))},{id:"horizon",displayName:"Horizon",type:"dark",import:(()=>c(()=>import("./horizon-BUw7H-hv.js"),[]))},{id:"horizon-bright",displayName:"Horizon Bright",type:"light",import:(()=>c(()=>import("./horizon-bright-CUuTKBJd.js"),[]))},{id:"houston",displayName:"Houston",type:"dark",import:(()=>c(()=>import("./houston-DnULxvSX.js"),[]))},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:(()=>c(()=>import("./kanagawa-dragon-CkXjmgJE.js"),[]))},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:(()=>c(()=>import("./kanagawa-lotus-CfQXZHmo.js"),[]))},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:(()=>c(()=>import("./kanagawa-wave-DWedfzmr.js"),[]))},{id:"laserwave",displayName:"LaserWave",type:"dark",import:(()=>c(()=>import("./laserwave-DUszq2jm.js"),[]))},{id:"light-plus",displayName:"Light Plus",type:"light",import:(()=>c(()=>import("./light-plus-B7mTdjB0.js"),[]))},{id:"material-theme",displayName:"Material Theme",type:"dark",import:(()=>c(()=>import("./material-theme-D5KoaKCx.js"),[]))},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:(()=>c(()=>import("./material-theme-darker-BfHTSMKl.js"),[]))},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:(()=>c(()=>import("./material-theme-lighter-B0m2ddpp.js"),[]))},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:(()=>c(()=>import("./material-theme-ocean-CyktbL80.js"),[]))},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:(()=>c(()=>import("./material-theme-palenight-Csfq5Kiy.js"),[]))},{id:"min-dark",displayName:"Min Dark",type:"dark",import:(()=>c(()=>import("./min-dark-CafNBF8u.js"),[]))},{id:"min-light",displayName:"Min Light",type:"light",import:(()=>c(()=>import("./min-light-CTRr51gU.js"),[]))},{id:"monokai",displayName:"Monokai",type:"dark",import:(()=>c(()=>import("./monokai-D4h5O-jR.js"),[]))},{id:"night-owl",displayName:"Night Owl",type:"dark",import:(()=>c(()=>import("./night-owl-C39BiMTA.js"),[]))},{id:"night-owl-light",displayName:"Night Owl Light",type:"light",import:(()=>c(()=>import("./night-owl-light-CMTm3GFP.js"),[]))},{id:"nord",displayName:"Nord",type:"dark",import:(()=>c(()=>import("./nord-Ddv68eIx.js"),[]))},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:(()=>c(()=>import("./one-dark-pro-DVMEJ2y_.js"),[]))},{id:"one-light",displayName:"One Light",type:"light",import:(()=>c(()=>import("./one-light-C3Wv6jpd.js"),[]))},{id:"plastic",displayName:"Plastic",type:"dark",import:(()=>c(()=>import("./plastic-3e1v2bzS.js"),[]))},{id:"poimandres",displayName:"Poimandres",type:"dark",import:(()=>c(()=>import("./poimandres-CS3Unz2-.js"),[]))},{id:"red",displayName:"Red",type:"dark",import:(()=>c(()=>import("./red-bN70gL4F.js"),[]))},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:(()=>c(()=>import("./rose-pine-qdsjHGoJ.js"),[]))},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:(()=>c(()=>import("./rose-pine-dawn-DHQR4-dF.js"),[]))},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:(()=>c(()=>import("./rose-pine-moon-D4_iv3hh.js"),[]))},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:(()=>c(()=>import("./slack-dark-BthQWCQV.js"),[]))},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:(()=>c(()=>import("./slack-ochin-DqwNpetd.js"),[]))},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:(()=>c(()=>import("./snazzy-light-Bw305WKR.js"),[]))},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:(()=>c(()=>import("./solarized-dark-DXbdFlpD.js"),[]))},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:(()=>c(()=>import("./solarized-light-L9t79GZl.js"),[]))},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:(()=>c(()=>import("./synthwave-84-CbfX1IO0.js"),[]))},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:(()=>c(()=>import("./tokyo-night-hegEt444.js"),[]))},{id:"vesper",displayName:"Vesper",type:"dark",import:(()=>c(()=>import("./vesper-DRje8inN.js"),[]))},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:(()=>c(()=>import("./vitesse-black-Bkuqu6BP.js"),[]))},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:(()=>c(()=>import("./vitesse-dark-D0r3Knsf.js"),[]))},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:(()=>c(()=>import("./vitesse-light-CVO1_9PV.js"),[]))}],dt=Object.fromEntries(ct.map(e=>[e.id,e.import]));var ln=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function io(){return 2147483648}function oo(){return typeof performance<"u"?performance.now():Date.now()}const so=(e,t)=>e+(t-e%t)%t;async function ao(e){let t,n;const r={};function i(h){n=h,r.HEAPU8=new Uint8Array(h),r.HEAPU32=new Uint32Array(h)}function o(h,m,E){r.HEAPU8.copyWithin(h,m,m+E)}function s(h){try{return t.grow(h-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function a(h){const m=r.HEAPU8.length;h=h>>>0;const E=io();if(h>E)return!1;for(let b=1;b<=4;b*=2){let g=m*(1+.2/b);g=Math.min(g,h+100663296);const y=Math.min(E,so(Math.max(h,g),65536));if(s(y))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function u(h,m,E=1024){const b=m+E;let g=m;for(;h[g]&&!(g>=b);)++g;if(g-m>16&&h.buffer&&l)return l.decode(h.subarray(m,g));let y="";for(;m>10,56320|I&1023)}}return y}function p(h,m){return h?u(r.HEAPU8,h,m):""}const d={emscripten_get_now:oo,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function f(){const m=await e({env:d,wasi_snapshot_preview1:d});t=m.memory,i(t.buffer),Object.assign(r,m),r.UTF8ToString=p}return await f(),r}var lo=Object.defineProperty,uo=(e,t,n)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,P=(e,t,n)=>uo(e,typeof t!="symbol"?t+"":t,n);let D=null;function co(e){throw new ln(e.UTF8ToString(e.getLastOnigError()))}class pt{constructor(t){P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16Value"),P(this,"utf8Value"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16");const n=t.length,r=pt._utf8ByteLength(t),i=r!==n,o=i?new Uint32Array(n+1):null;i&&(o[n]=r);const s=i?new Uint32Array(r+1):null;i&&(s[r]=n);const a=new Uint8Array(r);let l=0;for(let u=0;u=55296&&p<=56319&&u+1=56320&&h<=57343&&(d=(p-55296<<10)+65536|h-56320,f=!0)}i&&(o[u]=l,f&&(o[u+1]=l),d<=127?s[l+0]=u:d<=2047?(s[l+0]=u,s[l+1]=u):d<=65535?(s[l+0]=u,s[l+1]=u,s[l+2]=u):(s[l+0]=u,s[l+1]=u,s[l+2]=u,s[l+3]=u)),d<=127?a[l++]=d:d<=2047?(a[l++]=192|(d&1984)>>>6,a[l++]=128|(d&63)>>>0):d<=65535?(a[l++]=224|(d&61440)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0):(a[l++]=240|(d&1835008)>>>18,a[l++]=128|(d&258048)>>>12,a[l++]=128|(d&4032)>>>6,a[l++]=128|(d&63)>>>0),f&&u++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=s}static _utf8ByteLength(t){let n=0;for(let r=0,i=t.length;r=55296&&o<=56319&&r+1=56320&&l<=57343&&(s=(o-55296<<10)+65536|l-56320,a=!0)}s<=127?n+=1:s<=2047?n+=2:s<=65535?n+=3:n+=4,a&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const ht=class X{constructor(t){if(P(this,"id",++X.LAST_ID),P(this,"_onigBinding"),P(this,"content"),P(this,"utf16Length"),P(this,"utf8Length"),P(this,"utf16OffsetToUtf8"),P(this,"utf8OffsetToUtf16"),P(this,"ptr"),!D)throw new ln("Must invoke loadWasm first.");this._onigBinding=D,this.content=t;const n=new pt(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!X._sharedPtrInUse?(X._sharedPtr||(X._sharedPtr=D.omalloc(1e4)),X._sharedPtrInUse=!0,D.HEAPU8.set(n.utf8Value,X._sharedPtr),this.ptr=X._sharedPtr):this.ptr=n.createString(D)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===X._sharedPtr?X._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};P(ht,"LAST_ID",0);P(ht,"_sharedPtr",0);P(ht,"_sharedPtrInUse",!1);let Lr=ht;class po{constructor(t){if(P(this,"_onigBinding"),P(this,"_ptr"),!D)throw new ln("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=t.length;a{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),ho(r)?r=await r.instantiator(n):fo(r)?r=await r.default(n):(mo(r)&&(r=r.data),go(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await yo(r)(n):r=await Eo(r)(n):_o(r)?r=await Lt(r)(n):r instanceof WebAssembly.Module?r=await Lt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Lt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Fe=t(),Fe}function Lt(e){return t=>WebAssembly.instantiate(e,t)}function yo(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Eo(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}let Rr;function bo(e){Rr=e}function wo(){return Rr}async function un(e){return e&&await ft(e),{createScanner(t){return new po(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Lr(t)}}}const vo=Object.freeze(Object.defineProperty({__proto__:null,createOnigurumaEngine:un,getDefaultWasmLoader:wo,loadWasm:ft,setDefaultWasmLoader:bo},Symbol.toStringTag,{value:"Module"}));var Ir=an({});Sr(Ir,vo);var L=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Co(e){return cn(e)}function cn(e){return Array.isArray(e)?Ao(e):e instanceof RegExp?e:typeof e=="object"?ko(e):e}function Ao(e){let t=[];for(let n=0,r=e.length;n{for(let r in n)e[r]=n[r]}),e}function Pr(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Pr(e.substring(0,e.length-1)):e.substr(~t+1)}var Rt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Rt.lastIndex=0,Rt.test(e))}static replaceCaptures(e,t,n){return e.replace(Rt,(r,i,o,s)=>{let a=n[parseInt(i||o,10)];if(a){let l=t.substring(a.start,a.end);for(;l[0]===".";)l=l.substring(1);switch(s){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return r})}};function Or(e,t){return et?1:0}function xr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let i=0;ithis._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(i=>So(e.parent,i.parentScopes));return r?new Vr(r.fontStyle,r.foreground,r.background):null}},It=class Ke{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ke(t,r);return t}static from(...t){let n=null;for(let r=0;r"){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Lo(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Lo(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Vr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Ro(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let i=0,o=t.length;i1&&(b=m.slice(0,m.length-1),b.reverse()),n[r++]=new Io(E,b,i,l,u,p)}}return n}var Io=class{constructor(e,t,n,r,i,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=o}},$=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))($||{});function To(e,t){e.sort((l,u)=>{let p=Or(l.scope,u.scope);return p!==0||(p=xr(l.parentScopes,u.parentScopes),p!==0)?p:l.index-u.index});let n=0,r="#000000",i="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(i=l.background)}let o=new Po(t),s=new Vr(n,o.getId(r),o.getId(i)),a=new xo(new jt(0,null,-1,0,0),[]);for(let l=0,u=e.length;lt?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),i!==0&&(this.background=i)}},xo=class Ht{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,i=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[i]===">"&&i++,!(r>=t.parentScopes.length||i>=n.parentScopes.length);){const o=n.parentScopes[i].length-t.parentScopes[r].length;if(o!==0)return o;r++,i++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),i,o;if(r===-1?(i=t,o=""):(i=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(i))return this._children[i].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ht._cmpBySpecificity),n}insert(t,n,r,i,o,s){if(n===""){this._doInsertHere(t,r,i,o,s);return}let a=n.indexOf("."),l,u;a===-1?(l=n,u=""):(l=n.substring(0,a),u=n.substring(a+1));let p;this._children.hasOwnProperty(l)?p=this._children[l]:(p=new Ht(this._mainRule.clone(),jt.cloneArr(this._rulesWithParentScopes)),this._children[l]=p),p.insert(t+1,u,r,i,o,s)}_doInsertHere(t,n,r,i,o){if(n===null){this._mainRule.acceptOverwrite(t,r,i,o);return}for(let s=0,a=this._rulesWithParentScopes.length;s>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,i,o,s,a){let l=U.getLanguageId(t),u=U.getTokenType(t),p=U.containsBalancedBrackets(t)?1:0,d=U.getFontStyle(t),f=U.getForeground(t),h=U.getBackground(t);return n!==0&&(l=n),r!==8&&(u=r),i!==null&&(p=i?1:0),o!==-1&&(d=o),s!==0&&(f=s),a!==0&&(h=a),(l<<0|u<<8|p<<10|d<<11|f<<15|h<<24)>>>0}};function Ze(e,t){const n=[],r=Do(e);let i=r.next();for(;i!==null;){let l=0;if(i.length===2&&i.charAt(1)===":"){switch(i.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let u=s();if(n.push({matcher:u,priority:l}),i!==",")break;i=r.next()}return n;function o(){if(i==="-"){i=r.next();const l=o();return u=>!!l&&!l(u)}if(i==="("){i=r.next();const l=a();return i===")"&&(i=r.next()),l}if(Mn(i)){const l=[];do l.push(i),i=r.next();while(Mn(i));return u=>t(l,u)}return null}function s(){const l=[];let u=o();for(;u;)l.push(u),u=o();return p=>l.every(d=>d(p))}function a(){const l=[];let u=s();for(;u&&(l.push(u),i==="|"||i===",");){do i=r.next();while(i==="|"||i===",");u=s()}return p=>l.some(d=>d(p))}}function Mn(e){return!!e&&!!e.match(/[\w\.:]+/)}function Do(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Mr(e){typeof e.dispose=="function"&&e.dispose()}var Se=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},No=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Vo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},$o=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Se(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Vo;for(const n of e)Mo(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Se){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Mo(e,t,n,r){const i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Se?Qe({baseGrammar:o,selfGrammar:i},r):Wt(e.ruleName,{baseGrammar:o,selfGrammar:i,repository:i.repository},r);const s=n.injections(e.scopeName);if(s)for(const a of s)r.add(new Se(a))}function Wt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];et([r],t,n)}}function Qe(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&et(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&et(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function et(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const i=r.repository?Tr({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&et(r.patterns,{...t,repository:i},n);const o=r.include;if(!o)continue;const s=Gr(o);switch(s.kind){case 0:Qe({...t,selfGrammar:t.baseGrammar},n);break;case 1:Qe(t,n);break;case 2:Wt(s.ruleName,{...t,repository:i},n);break;case 3:case 4:const a=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const l={baseGrammar:t.baseGrammar,selfGrammar:a,repository:i};s.kind===4?Wt(s.ruleName,l,n):Qe(l,n)}else s.kind===4?n.add(new No(s.scopeName,s.ruleName)):n.add(new Se(s.scopeName));break}}}var Go=class{kind=0},Bo=class{kind=1},Uo=class{constructor(e){this.ruleName=e}kind=2},Fo=class{constructor(e){this.scopeName=e}kind=3},jo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Gr(e){if(e==="$base")return new Go;if(e==="$self")return new Bo;const t=e.indexOf("#");if(t===-1)return new Fo(e);if(t===0)return new Uo(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new jo(n,r)}}var Ho=/\\(\d+)/,Gn=/\\(\d+)/g,Wo=-1,Br=-2;var Ve=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Pr(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},zo=class extends Ve{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},qo=class extends Ve{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new Le(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Bn=class extends Ve{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Re,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},zt=class extends Ve{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,o,s,a,l,u){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this._end=new Le(s||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},tt=class extends Ve{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,o,s,a,l){super(e,t,n,r),this._begin=new Le(i,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Le(s,Br),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Re;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Re,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Ur=class V{static createCaptureRule(t,n,r,i,o){return t.registerRule(s=>new zo(n,s,r,i,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new qo(t.$vscodeTextmateLocation,t.id,t.name,t.match,V._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Tr({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Bn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,V._compilePatterns(o,n,r))}return t.while?new tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,V._compileCaptures(t.whileCaptures||t.captures,n,r),V._compilePatterns(t.patterns,n,r)):new zt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,V._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,V._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,V._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let o=0;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);a>o&&(o=a)}for(let s=0;s<=o;s++)i[s]=null;for(const s in t){if(s==="$vscodeTextmateLocation")continue;const a=parseInt(s,10);let l=0;t[s].patterns&&(l=V.getCompiledRuleId(t[s],n,r)),i[a]=V.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,l)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let o=0,s=t.length;ot.substring(i.start,i.end));return Gn.lastIndex=0,this.source.replace(Gn,(i,o)=>Dr(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],i=[],o,s,a,l;for(o=0,s=this.source.length;on.source);this._cached=new Un(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(i=>i.resolveAnchors(t,n));return new Un(e,r,this._items.map(i=>i.ruleId))}},Un=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Tt(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(qt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Ko=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Dr(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Fn=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function jr(e,t,n,r,i,o,s,a){const l=t.content.length;let u=!1,p=-1;if(s){const h=Qo(e,t,n,r,i,o);i=h.stack,r=h.linePos,n=h.isFirstLine,p=h.anchorPosition}const d=Date.now();for(;!u;){if(a!==0&&Date.now()-d>a)return new Fn(i,!0);f()}return new Fn(i,!1);function f(){const h=Jo(e,t,n,r,i,p);if(!h){o.produce(i,l),u=!0;return}const m=h.captureIndices,E=h.matchedRuleId,b=m&&m.length>0?m[0].end>r:!1;if(E===Wo){const g=i.getRule(e);o.produce(i,m[0].start),i=i.withContentNameScopesList(i.nameScopesList),Ce(e,t,n,i,o,g.endCaptures,m),o.produce(i,m[0].end);const y=i;if(i=i.parent,p=y.getAnchorPos(),!b&&y.getEnterPos()===r){i=y,o.produce(i,l),u=!0;return}}else{const g=e.getRule(E);o.produce(i,m[0].start);const y=i,w=g.getName(t.content,m),A=i.contentNameScopesList.pushAttributed(w,e);if(i=i.push(E,r,p,m[0].end===l,null,A,A),g instanceof zt){const k=g;Ce(e,t,n,i,o,k.beginCaptures,m),o.produce(i,m[0].end),p=m[0].end;const I=k.getContentName(t.content,m),M=A.pushAttributed(I,e);if(i=i.withContentNameScopesList(M),k.endHasBackReferences&&(i=i.withEndRule(k.getEndWithResolvedBackReferences(t.content,m))),!b&&y.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),u=!0;return}}else if(g instanceof tt){const k=g;Ce(e,t,n,i,o,k.beginCaptures,m),o.produce(i,m[0].end),p=m[0].end;const I=k.getContentName(t.content,m),M=A.pushAttributed(I,e);if(i=i.withContentNameScopesList(M),k.whileHasBackReferences&&(i=i.withEndRule(k.getWhileWithResolvedBackReferences(t.content,m))),!b&&y.hasSameRuleAs(i)){i=i.pop(),o.produce(i,l),u=!0;return}}else if(Ce(e,t,n,i,o,g.captures,m),o.produce(i,m[0].end),i=i.pop(),!b){i=i.safePop(),o.produce(i,l),u=!0;return}}m[0].end>r&&(r=m[0].end,n=!1)}}function Qo(e,t,n,r,i,o){let s=i.beginRuleCapturedEOL?0:-1;const a=[];for(let l=i;l;l=l.pop()){const u=l.getRule(e);u instanceof tt&&a.push({rule:u,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:u,findOptions:p}=es(l.rule,e,l.stack.endRule,n,r===s),d=u.findNextMatchSync(t,r,p);if(d){if(d.ruleId!==Br){i=l.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(o.produce(l.stack,d.captureIndices[0].start),Ce(e,t,n,l.stack,o,l.rule.whileCaptures,d.captureIndices),o.produce(l.stack,d.captureIndices[0].end),s=d.captureIndices[0].end,d.captureIndices[0].end>r&&(r=d.captureIndices[0].end,n=!1))}else{i=l.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:s,isFirstLine:n}}function Jo(e,t,n,r,i,o){const s=Yo(e,t,n,r,i,o),a=e.getInjections();if(a.length===0)return s;const l=Zo(a,e,t,n,r,i,o);if(!l)return s;if(!s)return l;const u=s.captureIndices[0].start,p=l.captureIndices[0].start;return p=a)&&(a=w,l=y.captureIndices,u=y.ruleId,p=m.priority,a===i))break}return l?{priorityMatch:p===-1,captureIndices:l,matchedRuleId:u}:null}function Hr(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function es(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Ce(e,t,n,r,i,o,s){if(o.length===0)return;const a=t.content,l=Math.min(o.length,s.length),u=[],p=s[0].end;for(let d=0;dp)break;for(;u.length>0&&u[u.length-1].endPos<=h.start;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?i.produceFromScopes(u[u.length-1].scopes,h.start):i.produce(r,h.start),f.retokenizeCapturedWithRuleId){const E=f.getName(a,s),b=r.contentNameScopesList.pushAttributed(E,e),g=f.getContentName(a,s),y=b.pushAttributed(g,e),w=r.push(f.retokenizeCapturedWithRuleId,h.start,-1,!1,null,b,y),A=e.createOnigString(a.substring(0,h.end));jr(e,A,n&&h.start===0,h.start,w,i,!1,0),Mr(A);continue}const m=f.getName(a,s);if(m!==null){const b=(u.length>0?u[u.length-1].scopes:r.contentNameScopesList).pushAttributed(m,e);u.push(new ts(b,h.end))}}for(;u.length>0;)i.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var ts=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ns(e,t,n,r,i,o,s,a){return new is(e,t,n,r,i,o,s,a)}function jn(e,t,n,r,i){const o=Ze(t,nt),s=Ur.getCompiledRuleId(n,r,i.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:s,grammar:i,priority:a.priority})}function nt(e,t){if(t.length{for(let i=n;in&&e.substr(0,n)===t&&e[n]==="."}var is=class{constructor(e,t,n,r,i,o,s,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new Xo(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=s,this._grammar=Hn(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(const l of Object.keys(i)){const u=Ze(l,nt);for(const p of u)this._tokenTypeMatchers.push({matcher:p.matcher,type:i[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:i=>i===this._rootScopeName?this._grammar:this.getExternalGrammar(i),injections:i=>this._grammarRepository.injections(i)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const i=r.injections;if(i)for(let s in i)jn(t,s,i[s],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(s=>{const a=this.getExternalGrammar(s);if(a){const l=a.injectionSelector;l&&jn(t,l,a,this,a)}})}return t.sort((i,o)=>i.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Hn(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Ur.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===Xt.NULL){i=!0;const u=this._basicScopeAttributesProvider.getDefaultAttributes(),p=this.themeProvider.getDefaults(),d=le.set(0,u.languageId,u.tokenType,null,p.fontStyle,p.foregroundId,p.backgroundId),f=this.getRule(this._rootId).getName(null,null);let h;f?h=Ae.createRootAndLookUpScopeName(f,d,this):h=Ae.createRoot("unknown",d),t=new Xt(null,this._rootId,-1,-1,!1,null,h,h)}else i=!1,t.reset();e=e+` `;const o=this.createOnigString(e),s=o.content.length,a=new ss(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=jr(this,o,i,0,t,a,!0,r);return Mr(o),{lineLength:s,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Hn(e,t){return e=Co(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Ae=class K{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(const o of n)i=It.push(i,o.scopeNames),r=new K(r,i,o.encodedTokenAttributes);return r}static createRoot(t,n){return new K(null,new It(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const i=r.getMetadataForScope(t),o=new It(null,t),s=r.themeProvider.themeMatch(o),a=K.mergeAttributes(n,i,s);return new K(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return K.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let i=-1,o=0,s=0;return r!==null&&(i=r.fontStyle,o=r.foregroundId,s=r.backgroundId),le.set(t,n.languageId,n.tokenType,null,i,o,s)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return K._pushAttributed(this,t,n);const r=t.split(/ /g);let i=this;for(const o of r)i=K._pushAttributed(i,o,n);return i}static _pushAttributed(t,n,r){const i=r.getMetadataForScope(n),o=t.scopePath.push(n),s=r.themeProvider.themeMatch(o),a=K.mergeAttributes(t.tokenAttributes,i,s);return new K(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},Xt=class ie{constructor(t,n,r,i,o,s,a,l){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=i}_stackElementBrand=void 0;static NULL=new ie(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:ie._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Ae.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){ie._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,o,s,a){return new ie(this,t,n,r,i,o,s,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new ie(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=Ae.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new ie(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ae.fromExtension(r,n.contentNameScopesList))}},os=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Ze(n,nt).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Ze(n,nt).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},ss=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,i=!1;if(this.balancedBracketSelectors?.matchesAlways&&(i=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const s of this._tokenTypeOverrides)s.matcher(o)&&(r=le.set(r,0,s.type,null,-1,0,0));this.balancedBracketSelectors&&(i=this.balancedBracketSelectors.match(o))}if(i&&(r=le.set(r,0,8,i,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,i=this._binaryTokens.length;r0;)s.Q.map(a=>this._loadSingleGrammar(a.scopeName)),s.processQueue();return this._grammarForScopeName(t,n,r,i,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,i=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,i)}_grammarForScopeName(t,n=0,r=null,i=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,i,o)}},Kt=Xt.NULL;function Ie(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[i,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[i]=o:i===r&&Object.assign(n,o);return n}function ee(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Wr(e){return Array.isArray(e)?e:[e]}async function dn(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function $e(e){return!e||["plaintext","txt","text","plain"].includes(e)}function pn(e){return e==="ansi"||$e(e)}function Me(e){return e==="none"}function hn(e){return Me(e)}const us=/(\r?\n)/g;function Ge(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(us);let r=0;const i=[];for(let o=0;o!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?Wn.light:Wn.dark),n||(n=t.type==="light"?zn.light:zn.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0;const o=new Map;function s(a){if(o.has(a))return o.get(a);i+=1;const l=`#${i.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?s(a):(o.set(a,l),l)}t.settings=t.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),u=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!u)return a;const p={...a,settings:{...a.settings}};if(l){const d=s(a.settings.foreground);t.colorReplacements[d]=a.settings.foreground,p.settings.foreground=d}if(u){const d=s(a.settings.background);t.colorReplacements[d]=a.settings.background,p.settings.background=d}return p});for(const a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const l=s(t.colors[a]);t.colorReplacements[l]=t.colors[a],t.colors[a]=l}return Object.defineProperty(t,qn,{enumerable:!1,writable:!1,value:!0}),t}async function zr(e){return[...new Set((await Promise.all(e.filter(t=>!pn(t)).map(async t=>await dn(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function qr(e){return(await Promise.all(e.map(async t=>hn(t)?null:mt(await dn(t))))).filter(t=>!!t)}function Xr(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new L(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var cs=class extends ls{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(i=>this.loadTheme(i)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=mt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ye.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(i=>i.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(i=>{this._alias[i]=e.name}),this._loadedLanguagesCache=null,t.size)for(const i of t)this._resolvedGrammars.delete(i.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(i.scopeName),this._syncRegistry?._grammars?.delete(i.scopeName),this.loadLanguage(this._langMap.get(i.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,i])=>!i);if(n.length){const r=t.filter(([i,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(s=>n.map(([a])=>a).includes(s)):!1).filter(i=>!n.includes(i));throw new L(`Missing languages ${n.map(([i])=>`\`${i}\``).join(", ")}, required by ${r.map(([i])=>`\`${i}\``).join(", ")}`)}for(const[r,i]of t)this._resolver.addLanguage(i);for(const[r,i]of t)this.loadLanguage(i)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},ds=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let r=1;r<=t.length;r++){const i=t.slice(0,r).join(".");n=[...n,...this._injections.get(i)||[]]}return n}};let ve=0;function gt(e){ve+=1,e.warnings!==!1&&ve>=10&&ve%10===0&&console.warn(`[Shiki] ${ve} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new L("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(mt),i=new cs(new ds(e.engine,n),r,n,e.langAlias);let o;function s(y){return Xr(y,e.langAlias)}function a(y){b();const w=i.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new L(`Language \`${y}\` not found, you may need to load it first`);return w}function l(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};b();const w=i.getTheme(y);if(!w)throw new L(`Theme \`${y}\` not found, you may need to load it first`);return w}function u(y){b();const w=l(y);return o!==y&&(i.setTheme(w),o=y),{theme:w,colorMap:i.getColorMap()}}function p(){return b(),i.getLoadedThemes()}function d(){return b(),i.getLoadedLanguages()}function f(...y){b(),i.loadLanguages(y.flat(1))}async function h(...y){return f(await zr(y))}function m(...y){b();for(const w of y.flat(1))i.loadTheme(w)}async function E(...y){return b(),m(await qr(y))}function b(){if(t)throw new L("Shiki instance has been disposed")}function g(){t||(t=!0,i.dispose(),ve-=1)}return{setTheme:u,getTheme:l,getLanguage:a,getLoadedThemes:p,getLoadedLanguages:d,resolveLangAlias:s,loadLanguage:h,loadLanguageSync:f,loadTheme:E,loadThemeSync:m,dispose:g,[Symbol.dispose]:g}}const ps=gt;async function fn(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([qr(e.themes||[]),zr(e.langs||[]),e.engine]);return gt({...e,themes:t,langs:n,engine:r})}const hs=fn,Kr=new WeakMap;function _t(e,t){Kr.set(e,t)}function Te(e){return Kr.get(e)}var yt=class Qr{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Qr(Object.fromEntries(Wr(n).map(r=>[r,Kt])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,i]=t;this.lang=r,this._stacks={[i]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return fs(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function fs(e){const t=[],n=new Set;function r(i){if(n.has(i))return;n.add(i);const o=i?.nameScopesList?.scopeName;o&&t.push(o),i.parent&&r(i.parent)}return r(e),t}function ms(e,t){if(!(e instanceof yt))throw new L("Invalid grammar state");return e.getInternalStack(t)}const gs=/,/,_s=/ /;function Jr(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if($e(e.resolveLangAlias(n.lang||"text"))||Me(r))return Ge(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:i,colorMap:o}=e.setTheme(r),s=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==s.name)throw new L(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${s.name}"`);if(!n.grammarState.themes.includes(i.name))throw new L(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return Zr(t,s,i,o,n)}function Yr(...e){if(e.length===2)return Te(e[1]);const[t,n,r={}]=e,{lang:i="text",theme:o=t.getLoadedThemes()[0]}=r;if($e(i)||Me(o))throw new L("Plain language does not have grammar state");if(i==="ansi")throw new L("ANSI language does not have grammar state");const{theme:s,colorMap:a}=t.setTheme(o),l=t.getLanguage(i);return new yt(mn(n,l,s,a,r).stateStack,l.name,s.name)}function Zr(e,t,n,r,i){const o=mn(e,t,n,r,i),s=new yt(o.stateStack,t.name,n.name);return _t(o.tokens,s),o.tokens}function mn(e,t,n,r,i){const o=Ie(n,i),{tokenizeMaxLineLength:s=0,tokenizeTimeLimit:a=500,includeExplanation:l=!1}=i,u=Ge(e);let p=i.grammarState?ms(i.grammarState,n.name)??Kt:i.grammarContextCode!=null?mn(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:Kt,d=[];const f=[];for(let h=0,m=u.length;h0&&E.length>=s){d=[],f.push([{content:E,offset:b,color:"",fontStyle:0}]);continue}let g,y,w;l&&l!=="tokenType"&&(g=t.tokenizeLine(E,p,a),y=g.tokens,w=0);const A=t.tokenizeLine2(E,p,a),k=A.tokens.length/2;for(let I=0;ISt.trim());break;case"object":he=Q.scope;break;default:continue}Nn.push({settings:Q,selectors:he.map(St=>St.split(_s))})}q.explanation=[];let Vn=0;for(;M+Vn({scopeName:t}))}function Es(e,t){const n=[];for(let r=0,i=t.length;r=0&&i>=0;)Xn(e[r],n[i])&&(r-=1),i-=1;return r===-1}function ws(e,t,n){const r=[];for(const{selectors:i,settings:o}of e)for(const s of i)if(bs(s,t,n)){r.push(o);break}return r}function gn(e,t,n,r=Jr){const i=Object.entries(n.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})),o=i.map(u=>{const p=r(e,t,{...n,theme:u.theme});return{tokens:p,state:Te(p),theme:typeof u.theme=="string"?u.theme:u.theme.name}}),s=vs(...o.map(u=>u.tokens)),a=s[0].map((u,p)=>u.map((d,f)=>{const h={content:d.content,variants:{},offset:d.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=d.explanation),s.forEach((m,E)=>{const{content:b,explanation:g,offset:y,...w}=m[p][f];h.variants[i[E].color]=w}),h})),l=o[0].state?new yt(Object.fromEntries(o.map(u=>[u.theme,u.state?.getInternalStack(u.theme)])),o[0].state.lang):void 0;return l&&_t(a,l),a}function vs(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;rl[r]),o=t.map(()=>[]);t.forEach((l,u)=>l.push(o[u]));const s=i.map(()=>0),a=i.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(u=>u.content.length));for(let u=0;u4&&n.slice(0,4)==="data"&&Rs.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Qn,Ps);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Qn.test(o)){let s=o.replace(Ls,Ts);s.charAt(0)!=="-"&&(s="-"+s),t="data"+s}}i=_n}return new i(r,t)}function Ts(e){return"-"+e.toLowerCase()}function Ps(e){return e.charAt(1).toUpperCase()}const Os=ei([ti,ks,ii,oi,si],"html"),ai=ei([ti,Ss,ii,oi,si],"svg"),Jn={}.hasOwnProperty;function xs(e,t){const n=t||{};function r(i,...o){let s=r.invalid;const a=r.handlers;if(i&&Jn.call(i,e)){const l=String(i[e]);s=Jn.call(a,l)?a[l]:r.unknown}if(s)return s.call(this,i,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Ds=/["&'<>`]/g,Ns=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$s=/[|\\{}()[\]^$+*?.]/g,Yn=new WeakMap;function Ms(e,t){if(e=e.replace(t.subset?Gs(t.subset):Ds,r),t.subset||t.escapeOnly)return e;return e.replace(Ns,n).replace(Vs,r);function n(i,o,s){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,s.charCodeAt(o+2),t)}function r(i,o,s){return t.format(i.charCodeAt(0),s.charCodeAt(o+1),t)}}function Gs(e){let t=Yn.get(e);return t||(t=Bs(e),Yn.set(e,t)),t}function Bs(e){const t=[];let n=-1;for(;++n",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},zs=["cent","copy","divide","gt","lt","not","para","times"],li={}.hasOwnProperty,Zt={};let He;for(He in Ot)li.call(Ot,He)&&(Zt[Ot[He]]=He);const qs=/[^\dA-Za-z]/;function Xs(e,t,n,r){const i=String.fromCharCode(e);if(li.call(Zt,i)){const o=Zt[i],s="&"+o;return n&&Ws.includes(o)&&!zs.includes(o)&&(!r||t&&t!==61&&qs.test(String.fromCharCode(t)))?s:s+";"}return""}function Ks(e,t,n){let r=Fs(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=Xs(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const o=Hs(e,t,n.omitOptionalSemicolons);o.length|^->||--!>|"],Ys=["<",">"];function Zs(e,t,n,r){return r.settings.bogusComments?"":"";function i(o){return ye(o,Object.assign({},r.settings.characterReferences,{subset:Ys}))}}function ea(e,t,n,r){return""}function Zn(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function ta(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function na(e){return e.join(" ").trim()}const ra=/[ \t\n\f\r]/g;function yn(e){return typeof e=="object"?e.type==="text"?er(e.value):!1:er(e)}function er(e){return e.replace(ra,"")===""}const x=ci(1),ui=ci(-1),ia=[];function ci(e){return t;function t(n,r,i){const o=n?n.children:ia;let s=(r||0)+e,a=o[s];if(!i)for(;a&&yn(a);)s+=e,a=o[s];return a}}const oa={}.hasOwnProperty;function di(e){return t;function t(n,r,i){return oa.call(e,n.tagName)&&e[n.tagName](n,r,i)}}const En=di({body:aa,caption:xt,colgroup:xt,dd:da,dt:ca,head:xt,html:sa,li:ua,optgroup:pa,option:ha,p:la,rp:tr,rt:tr,tbody:ma,td:nr,tfoot:ga,th:nr,thead:fa,tr:_a});function xt(e,t,n){const r=x(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&yn(r.value.charAt(0)))}function sa(e,t,n){const r=x(n,t);return!r||r.type!=="comment"}function aa(e,t,n){const r=x(n,t);return!r||r.type!=="comment"}function la(e,t,n){const r=x(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ua(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="li"}function ca(e,t,n){const r=x(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function da(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function tr(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function pa(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function ha(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function fa(e,t,n){const r=x(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ma(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ga(e,t,n){return!x(n,t)}function _a(e,t,n){const r=x(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function nr(e,t,n){const r=x(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ya=di({body:wa,colgroup:va,head:ba,html:Ea,tbody:Ca});function Ea(e){const t=x(e,-1);return!t||t.type!=="comment"}function ba(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function wa(e){const t=x(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&yn(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function va(e,t,n){const r=ui(n,t),i=x(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&En(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Ca(e,t,n){const r=ui(n,t),i=x(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&En(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const We={name:[[` \f\r &/=>`.split(""),` diff --git a/apps/kimi-code/dist-web/assets/index10-BCo1_xRY.js b/apps/kimi-code/dist-web/assets/index10-DKtGUVwa.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index10-BCo1_xRY.js rename to apps/kimi-code/dist-web/assets/index10-DKtGUVwa.js index 194aae35173..9986cd49b54 100644 --- a/apps/kimi-code/dist-web/assets/index10-BCo1_xRY.js +++ b/apps/kimi-code/dist-web/assets/index10-DKtGUVwa.js @@ -1,2 +1,2 @@ -import{bQ as Re,M as Ae,b$ as Ge,c0 as qe,c1 as Je,c2 as Qe,aU as d,bl as Ke,af as We,bY as e1,bE as B,as as U,aD as n1,c3 as Ze,az as o1,aL as r,u,aY as ge,v as t,bk as s,bb as X,au as b,t as F,aw as Ce,bL as t1,bB as l1,s as a1,I as i1,bJ as r1,bO as s1,g as u1,T as c1,q as T,c4 as Ve,c5 as ie,c6 as d1,c7 as De,c8 as v1,c9 as m1,b_ as h1}from"./index-D-7nOosq.js";var re=(R,xe,l)=>new Promise((a,J)=>{var V=c=>{try{H(l.next(c))}catch($){J($)}},Q=c=>{try{H(l.throw(c))}catch($){J($)}},H=c=>c.done?a(c.value):Promise.resolve(c.value).then(V,Q);H((l=l.apply(R,xe)).next())});const p1=["data-markstream-mode"],f1={key:0,class:"infographic-block-header flex justify-between items-center border-b"},w1={key:0},g1={key:1,class:"flex items-center gap-x-2 overflow-hidden"},C1=["innerHTML"],k1={key:2},x1={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},y1=["disabled"],b1={class:"flex items-center gap-x-1"},M1={class:"flex items-center gap-x-1"},B1={key:4},F1={key:5,class:"infographic-header-actions flex items-center"},T1=["aria-pressed"],H1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},$1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},j1=["disabled"],L1=["disabled"],P1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},E1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},z1={key:0,class:"infographic-source"},S1={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},Z1={key:1,class:"relative"},V1={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},D1={class:"flex items-center gap-2 backdrop-blur rounded-lg"},N1={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},Y1={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},_1={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},se="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",ke=Re(Ae({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(R,{emit:xe}){const l=R,{t:a}=Ge(),J=qe(),V=Je(),Q=Qe(),H=d(!1),c=d(!1),$=d(),p=d(),k=d(!0),ye=d(!1),j=d(!1),D=d(),K=d(null),L=d(!1),S=d(!1),A=d(null),P=d(typeof window>"u"||!Q.value),Ne=Ke(),x=We(e1,null);let E="";const be=T(()=>h1(l,Ne));typeof window<"u"&&B([()=>$.value,Q],([n,e])=>{var o,i,C;if((o=A.value)==null||o.destroy(),A.value=null,!e||P.value)return void(P.value=!0);if(!n)return void(P.value=!1);const f=(C=(i=V?.value.heavyBlockMargin)!=null?i:V?.value.rootMargin)!=null?C:"160px",w=J(n,{rootMargin:f,allowIdle:!1});A.value=w,P.value=w.isVisible.value,w.whenVisible.then(()=>{P.value=!0})},{immediate:!0});const z=T(()=>l.node.code),ue=T(()=>{var n;return(function(e){if(l.maxHeight==="none")return Ve(e,void 0,null);const o=ie(l.maxHeight);return Ve(e,void 0,o)})((n=ie(l.estimatedPreviewHeightPx))!=null?n:d1(z.value))}),ce=d(`${ue.value}px`),Ye=T(()=>ie(l.estimatedPreviewHeightPx)!=null);function Me(){var n;if(!p.value||Ye.value)return;const e=p.value.scrollHeight;if(e>0){const o=(n=ie((function(i){if(l.maxHeight==="none")return`${i}px`;if(l.maxHeight!=null){const f=Number.parseFloat(String(l.maxHeight));if(Number.isFinite(f))return`${Math.min(i,f)}px`}const C=p.value;if(C){const f=getComputedStyle(C).getPropertyValue("--ms-size-code-max-height").trim(),w=Number.parseFloat(f);if(Number.isFinite(w))return`${Math.min(i,w)}px`}return`${Math.min(i,500)}px`})(e)))!=null?n:e;ce.value=`${Math.max(o,ue.value)}px`}}const M=d(1),N=d(0),Y=d(0),_=d(!1),W=d({x:0,y:0}),Be=T(()=>z.value);function Fe(n){return!n||n.disabled}function h(n,e,o="top"){if(Fe(n.currentTarget))return;const i=n,C=i?.clientX!=null&&i?.clientY!=null?{x:i.clientX,y:i.clientY}:void 0;De(n.currentTarget,e,o,!1,C,l.isDark)}function v(){v1()}function Te(n){if(Fe(n.currentTarget))return;const e=H.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=n,i=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;De(n.currentTarget,e,"top",!1,i,l.isDark)}function _e(){return re(this,null,function*(){try{const n=z.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(n)),H.value=!0,setTimeout(()=>{H.value=!1},1e3)}catch(n){console.error("Failed to copy:",n)}})}function He(n){(n!=="preview"||Ze())&&(ye.value=!0,k.value=n==="source")}function Ie(){var n;const e=(n=p.value)==null?void 0:n.querySelector("svg");e?(function(o){re(this,null,function*(){try{const i=new XMLSerializer().serializeToString(o),C=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(C);if(typeof document<"u"){const w=document.createElement("a");w.href=f,w.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(w),w.click(),document.body.removeChild(w)}catch{}URL.revokeObjectURL(f)}}catch(i){console.error("Failed to export SVG:",i)}})})(e):console.error("SVG element not found")}function de(n){n.key==="Escape"&&j.value&&ve()}function ve(){if(j.value=!1,D.value&&(D.value.innerHTML=""),K.value=null,typeof document<"u")try{document.body.style.overflow=""}catch{}if(typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}}function Oe(){(function(){if(j.value=!0,typeof document<"u")try{document.body.style.overflow="hidden"}catch{}if(typeof window<"u")try{window.addEventListener("keydown",de)}catch{}U(()=>{if(p.value&&D.value){D.value.innerHTML="";const n=document.createElement("div");n.style.transition="transform 0.1s ease",n.style.transformOrigin="center center",n.style.width="100%",n.style.height="100%",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center";const e=p.value.cloneNode(!0);e.classList.add("fullscreen"),e.style.height="auto",n.appendChild(e),D.value.appendChild(n),K.value=n,n.style.transform=`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}})})()}function $e(){M.value<3&&(M.value+=.1)}function je(){M.value>.5&&(M.value-=.1)}function Le(){M.value=1,N.value=0,Y.value=0}function ee(n){_.value=!0,n instanceof MouseEvent?W.value={x:n.clientX-N.value,y:n.clientY-Y.value}:W.value={x:n.touches[0].clientX-N.value,y:n.touches[0].clientY-Y.value}}function ne(n){if(!_.value)return;let e,o;n instanceof MouseEvent?(e=n.clientX,o=n.clientY):(e=n.touches[0].clientX,o=n.touches[0].clientY),N.value=e-W.value.x,Y.value=o-W.value.y}function I(){_.value=!1}let g=null,me=!1,oe=!1,G=!1,te="",q=!1,he=0;function le(n){return!q&&n===he}function Pe(n=!1){return re(this,null,function*(){var e,o;if(q||!P.value||!p.value)return;if(me)return oe=!0,void(G=G||n);const i=Be.value;if(!n&&i===te&&L.value)return;const C=l.loading===!1,f=++he;me=!0,(function(){const m=be.value;m&&E!==m&&(E&&x?.markSettled(E),E=m,x?.markPending(m))})();const w=p.value.innerHTML,pe=L.value,Xe=S.value;S.value=!1;try{const m=yield m1();if(!le(f))return;if(!m)return void console.warn("Infographic library failed to load.");const Z=p.value;if(!Z)return;g&&((e=g.destroy)==null||e.call(g),g=null),Z.innerHTML="",g=new m({container:Z,width:"100%",height:"100%"});let fe="";if((o=g.on)==null||o.call(g,"error",we=>{fe=(Array.isArray(we)?we:[we]).map(y=>{var Se;return y instanceof Error?y.message:typeof y=="string"?y:String(y&&typeof y=="object"&&"message"in y?(Se=y.message)!=null?Se:"":y??"")}).filter(Boolean).join("; ")}),g.render(z.value),fe)throw new Error(fe);if(!Z.childNodes.length)throw new Error("Infographic render returned empty output.");L.value=!0,S.value=!1,te=i,U(()=>{le(f)&&Me()})}catch(m){if(!le(f))return;C&&l.loading===!1&&i===Be.value?(console.error("Failed to render infographic:",m),L.value=!1,S.value=!0,te="",p.value&&(p.value.innerHTML=`
        Failed to render infographic: ${m instanceof Error?m.message:"Unknown error"}
        `)):(L.value=pe,S.value=Xe,pe&&p.value&&(p.value.innerHTML=w))}finally{if(me=!1,le(f))if(oe){const m=G;oe=!1,G=!1,U(()=>{Pe(m)})}else(function(){re(this,null,function*(){const m=E;m&&(E="",yield U(),(function(Z=be.value){Z&&$.value&&x?.reportHeight(Z,$.value.offsetHeight)})(m),x?.markSettled(m))})})()}})}function O(n=!1){q||!P.value||k.value||c.value||U(()=>{q||Pe(n)})}B(()=>z.value,()=>{O(!0)}),B(()=>l.loading,(n,e)=>{e&&!n&&O(!0)}),B(()=>k.value,n=>{n||O(!0)}),B(()=>c.value,n=>{n||O()}),B(()=>l.maxHeight,()=>{U(()=>{Me()})}),B([()=>l.estimatedPreviewHeightPx,()=>z.value],()=>{L.value||k.value||(ce.value=`${ue.value}px`)}),B(()=>P.value,n=>{!n||k.value||c.value||O()}),n1(()=>{!ye.value&&Ze(),O()}),o1(()=>{var n,e;if(q=!0,he+=1,oe=!1,G=!1,(n=A.value)==null||n.destroy(),A.value=null,(function(){const o=E;o&&(E="",x?.markSettled(o))})(),g&&((e=g.destroy)==null||e.call(g),g=null),te="",typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}});const Ee=T(()=>!0),ae=T(()=>k.value||c.value),Ue=T(()=>k.value?"fallback":S.value?"error":L.value?"preview":"pending"),ze=T(()=>({transform:`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}));return B(ze,n=>{j.value&&K.value&&(K.value.style.transform=n.transform)}),(n,e)=>(r(),u("div",{ref_key:"viewportTarget",ref:$,class:b(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":l.loading,dark:l.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Ue.value},[l.showHeader?(r(),u("div",f1,[n.$slots["header-left"]?(r(),u("div",w1,[ge(n.$slots,"header-left",{},void 0,!0)])):(r(),u("div",g1,[t("span",{class:"icon-slot action-icon shrink-0",innerHTML:s(` +import{bQ as Re,M as Ae,b$ as Ge,c0 as qe,c1 as Je,c2 as Qe,aU as d,bl as Ke,af as We,bY as e1,bE as B,as as U,aD as n1,c3 as Ze,az as o1,aL as r,u,aY as ge,v as t,bk as s,bb as X,au as b,t as F,aw as Ce,bL as t1,bB as l1,s as a1,I as i1,bJ as r1,bO as s1,g as u1,T as c1,q as T,c4 as Ve,c5 as ie,c6 as d1,c7 as De,c8 as v1,c9 as m1,b_ as h1}from"./index-Bxn5yOTB.js";var re=(R,xe,l)=>new Promise((a,J)=>{var V=c=>{try{H(l.next(c))}catch($){J($)}},Q=c=>{try{H(l.throw(c))}catch($){J($)}},H=c=>c.done?a(c.value):Promise.resolve(c.value).then(V,Q);H((l=l.apply(R,xe)).next())});const p1=["data-markstream-mode"],f1={key:0,class:"infographic-block-header flex justify-between items-center border-b"},w1={key:0},g1={key:1,class:"flex items-center gap-x-2 overflow-hidden"},C1=["innerHTML"],k1={key:2},x1={key:3,class:"infographic-mode-toggle flex items-center gap-0.5"},y1=["disabled"],b1={class:"flex items-center gap-x-1"},M1={class:"flex items-center gap-x-1"},B1={key:4},F1={key:5,class:"infographic-header-actions flex items-center"},T1=["aria-pressed"],H1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},$1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},j1=["disabled"],L1=["disabled"],P1={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},E1={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},z1={key:0,class:"infographic-source"},S1={class:"infographic-source-code text-sm font-mono whitespace-pre-wrap"},Z1={key:1,class:"relative"},V1={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},D1={class:"flex items-center gap-2 backdrop-blur rounded-lg"},N1={key:0,class:"infographic-pending-source text-sm font-mono whitespace-pre-wrap"},Y1={class:"dialog-panel infographic-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},_1={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},se="infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",ke=Re(Ae({__name:"InfographicBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0}},emits:["copy","export","openModal"],setup(R,{emit:xe}){const l=R,{t:a}=Ge(),J=qe(),V=Je(),Q=Qe(),H=d(!1),c=d(!1),$=d(),p=d(),k=d(!0),ye=d(!1),j=d(!1),D=d(),K=d(null),L=d(!1),S=d(!1),A=d(null),P=d(typeof window>"u"||!Q.value),Ne=Ke(),x=We(e1,null);let E="";const be=T(()=>h1(l,Ne));typeof window<"u"&&B([()=>$.value,Q],([n,e])=>{var o,i,C;if((o=A.value)==null||o.destroy(),A.value=null,!e||P.value)return void(P.value=!0);if(!n)return void(P.value=!1);const f=(C=(i=V?.value.heavyBlockMargin)!=null?i:V?.value.rootMargin)!=null?C:"160px",w=J(n,{rootMargin:f,allowIdle:!1});A.value=w,P.value=w.isVisible.value,w.whenVisible.then(()=>{P.value=!0})},{immediate:!0});const z=T(()=>l.node.code),ue=T(()=>{var n;return(function(e){if(l.maxHeight==="none")return Ve(e,void 0,null);const o=ie(l.maxHeight);return Ve(e,void 0,o)})((n=ie(l.estimatedPreviewHeightPx))!=null?n:d1(z.value))}),ce=d(`${ue.value}px`),Ye=T(()=>ie(l.estimatedPreviewHeightPx)!=null);function Me(){var n;if(!p.value||Ye.value)return;const e=p.value.scrollHeight;if(e>0){const o=(n=ie((function(i){if(l.maxHeight==="none")return`${i}px`;if(l.maxHeight!=null){const f=Number.parseFloat(String(l.maxHeight));if(Number.isFinite(f))return`${Math.min(i,f)}px`}const C=p.value;if(C){const f=getComputedStyle(C).getPropertyValue("--ms-size-code-max-height").trim(),w=Number.parseFloat(f);if(Number.isFinite(w))return`${Math.min(i,w)}px`}return`${Math.min(i,500)}px`})(e)))!=null?n:e;ce.value=`${Math.max(o,ue.value)}px`}}const M=d(1),N=d(0),Y=d(0),_=d(!1),W=d({x:0,y:0}),Be=T(()=>z.value);function Fe(n){return!n||n.disabled}function h(n,e,o="top"){if(Fe(n.currentTarget))return;const i=n,C=i?.clientX!=null&&i?.clientY!=null?{x:i.clientX,y:i.clientY}:void 0;De(n.currentTarget,e,o,!1,C,l.isDark)}function v(){v1()}function Te(n){if(Fe(n.currentTarget))return;const e=H.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=n,i=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;De(n.currentTarget,e,"top",!1,i,l.isDark)}function _e(){return re(this,null,function*(){try{const n=z.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(n)),H.value=!0,setTimeout(()=>{H.value=!1},1e3)}catch(n){console.error("Failed to copy:",n)}})}function He(n){(n!=="preview"||Ze())&&(ye.value=!0,k.value=n==="source")}function Ie(){var n;const e=(n=p.value)==null?void 0:n.querySelector("svg");e?(function(o){re(this,null,function*(){try{const i=new XMLSerializer().serializeToString(o),C=new Blob([i],{type:"image/svg+xml;charset=utf-8"}),f=URL.createObjectURL(C);if(typeof document<"u"){const w=document.createElement("a");w.href=f,w.download=`infographic-${Date.now()}.svg`;try{document.body.appendChild(w),w.click(),document.body.removeChild(w)}catch{}URL.revokeObjectURL(f)}}catch(i){console.error("Failed to export SVG:",i)}})})(e):console.error("SVG element not found")}function de(n){n.key==="Escape"&&j.value&&ve()}function ve(){if(j.value=!1,D.value&&(D.value.innerHTML=""),K.value=null,typeof document<"u")try{document.body.style.overflow=""}catch{}if(typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}}function Oe(){(function(){if(j.value=!0,typeof document<"u")try{document.body.style.overflow="hidden"}catch{}if(typeof window<"u")try{window.addEventListener("keydown",de)}catch{}U(()=>{if(p.value&&D.value){D.value.innerHTML="";const n=document.createElement("div");n.style.transition="transform 0.1s ease",n.style.transformOrigin="center center",n.style.width="100%",n.style.height="100%",n.style.display="flex",n.style.alignItems="center",n.style.justifyContent="center";const e=p.value.cloneNode(!0);e.classList.add("fullscreen"),e.style.height="auto",n.appendChild(e),D.value.appendChild(n),K.value=n,n.style.transform=`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}})})()}function $e(){M.value<3&&(M.value+=.1)}function je(){M.value>.5&&(M.value-=.1)}function Le(){M.value=1,N.value=0,Y.value=0}function ee(n){_.value=!0,n instanceof MouseEvent?W.value={x:n.clientX-N.value,y:n.clientY-Y.value}:W.value={x:n.touches[0].clientX-N.value,y:n.touches[0].clientY-Y.value}}function ne(n){if(!_.value)return;let e,o;n instanceof MouseEvent?(e=n.clientX,o=n.clientY):(e=n.touches[0].clientX,o=n.touches[0].clientY),N.value=e-W.value.x,Y.value=o-W.value.y}function I(){_.value=!1}let g=null,me=!1,oe=!1,G=!1,te="",q=!1,he=0;function le(n){return!q&&n===he}function Pe(n=!1){return re(this,null,function*(){var e,o;if(q||!P.value||!p.value)return;if(me)return oe=!0,void(G=G||n);const i=Be.value;if(!n&&i===te&&L.value)return;const C=l.loading===!1,f=++he;me=!0,(function(){const m=be.value;m&&E!==m&&(E&&x?.markSettled(E),E=m,x?.markPending(m))})();const w=p.value.innerHTML,pe=L.value,Xe=S.value;S.value=!1;try{const m=yield m1();if(!le(f))return;if(!m)return void console.warn("Infographic library failed to load.");const Z=p.value;if(!Z)return;g&&((e=g.destroy)==null||e.call(g),g=null),Z.innerHTML="",g=new m({container:Z,width:"100%",height:"100%"});let fe="";if((o=g.on)==null||o.call(g,"error",we=>{fe=(Array.isArray(we)?we:[we]).map(y=>{var Se;return y instanceof Error?y.message:typeof y=="string"?y:String(y&&typeof y=="object"&&"message"in y?(Se=y.message)!=null?Se:"":y??"")}).filter(Boolean).join("; ")}),g.render(z.value),fe)throw new Error(fe);if(!Z.childNodes.length)throw new Error("Infographic render returned empty output.");L.value=!0,S.value=!1,te=i,U(()=>{le(f)&&Me()})}catch(m){if(!le(f))return;C&&l.loading===!1&&i===Be.value?(console.error("Failed to render infographic:",m),L.value=!1,S.value=!0,te="",p.value&&(p.value.innerHTML=`
        Failed to render infographic: ${m instanceof Error?m.message:"Unknown error"}
        `)):(L.value=pe,S.value=Xe,pe&&p.value&&(p.value.innerHTML=w))}finally{if(me=!1,le(f))if(oe){const m=G;oe=!1,G=!1,U(()=>{Pe(m)})}else(function(){re(this,null,function*(){const m=E;m&&(E="",yield U(),(function(Z=be.value){Z&&$.value&&x?.reportHeight(Z,$.value.offsetHeight)})(m),x?.markSettled(m))})})()}})}function O(n=!1){q||!P.value||k.value||c.value||U(()=>{q||Pe(n)})}B(()=>z.value,()=>{O(!0)}),B(()=>l.loading,(n,e)=>{e&&!n&&O(!0)}),B(()=>k.value,n=>{n||O(!0)}),B(()=>c.value,n=>{n||O()}),B(()=>l.maxHeight,()=>{U(()=>{Me()})}),B([()=>l.estimatedPreviewHeightPx,()=>z.value],()=>{L.value||k.value||(ce.value=`${ue.value}px`)}),B(()=>P.value,n=>{!n||k.value||c.value||O()}),n1(()=>{!ye.value&&Ze(),O()}),o1(()=>{var n,e;if(q=!0,he+=1,oe=!1,G=!1,(n=A.value)==null||n.destroy(),A.value=null,(function(){const o=E;o&&(E="",x?.markSettled(o))})(),g&&((e=g.destroy)==null||e.call(g),g=null),te="",typeof window<"u")try{window.removeEventListener("keydown",de)}catch{}});const Ee=T(()=>!0),ae=T(()=>k.value||c.value),Ue=T(()=>k.value?"fallback":S.value?"error":L.value?"preview":"pending"),ze=T(()=>({transform:`translate(${N.value}px, ${Y.value}px) scale(${M.value})`}));return B(ze,n=>{j.value&&K.value&&(K.value.style.transform=n.transform)}),(n,e)=>(r(),u("div",{ref_key:"viewportTarget",ref:$,class:b(["infographic-block-container rounded-lg border overflow-hidden",[{"is-rendering":l.loading,dark:l.isDark}]]),"data-markstream-infographic":"1","data-markstream-mode":Ue.value},[l.showHeader?(r(),u("div",f1,[n.$slots["header-left"]?(r(),u("div",w1,[ge(n.$slots,"header-left",{},void 0,!0)])):(r(),u("div",g1,[t("span",{class:"icon-slot action-icon shrink-0",innerHTML:s(` `)},null,8,C1),e[21]||(e[21]=t("span",{class:"infographic-label font-medium font-mono truncate"},"Infographic",-1))])),n.$slots["header-center"]?(r(),u("div",k1,[ge(n.$slots,"header-center",{},void 0,!0)])):l.showModeToggle?(r(),u("div",x1,[t("button",{class:b(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[k.value?"":"is-active",Ee.value?"opacity-50 cursor-not-allowed":""]]),disabled:Ee.value,onClick:e[0]||(e[0]=()=>He("preview")),onMouseenter:e[1]||(e[1]=o=>h(o,s(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>h(o,s(a)("common.preview")||"Preview")),onMouseleave:v,onBlur:v},[t("div",b1,[e[22]||(e[22]=t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0"}),t("circle",{cx:"12",cy:"12",r:"3"})])],-1)),t("span",null,X(s(a)("common.preview")||"Preview"),1)])],42,y1),t("button",{class:b(["infographic-mode-btn px-2 py-0.5 rounded transition-colors",[k.value?"is-active":""]]),onClick:e[3]||(e[3]=()=>He("source")),onMouseenter:e[4]||(e[4]=o=>h(o,s(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>h(o,s(a)("common.source")||"Source")),onMouseleave:v,onBlur:v},[t("div",M1,[e[23]||(e[23]=t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m16 18l6-6l-6-6M8 6l-6 6l6 6"})],-1)),t("span",null,X(s(a)("common.source")||"Source"),1)])],34)])):F("",!0),n.$slots["header-right"]?(r(),u("div",B1,[ge(n.$slots,"header-right",{},void 0,!0)])):(r(),u("div",F1,[l.showCollapseButton?(r(),u("button",{key:0,class:b(se),"aria-pressed":c.value,onClick:e[6]||(e[6]=o=>c.value=!c.value),onMouseenter:e[7]||(e[7]=o=>h(o,c.value?s(a)("common.expand")||"Expand":s(a)("common.collapse")||"Collapse")),onFocus:e[8]||(e[8]=o=>h(o,c.value?s(a)("common.expand")||"Expand":s(a)("common.collapse")||"Collapse")),onMouseleave:v,onBlur:v},[(r(),u("svg",{style:Ce({rotate:c.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[24]||(e[24]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,T1)):F("",!0),l.showCopyButton?(r(),u("button",{key:1,class:b(se),onClick:_e,onMouseenter:e[9]||(e[9]=o=>Te(o)),onFocus:e[10]||(e[10]=o=>Te(o)),onMouseleave:v,onBlur:v},[H.value?(r(),u("svg",$1,[...e[26]||(e[26]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(r(),u("svg",H1,[...e[25]||(e[25]=[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),t("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],32)):F("",!0),l.showExportButton?(r(),u("button",{key:2,class:b(`${se} ${ae.value?"opacity-50 cursor-not-allowed":""}`),disabled:ae.value,onClick:Ie,onMouseenter:e[11]||(e[11]=o=>h(o,s(a)("common.export")||"Export")),onFocus:e[12]||(e[12]=o=>h(o,s(a)("common.export")||"Export")),onMouseleave:v,onBlur:v},[...e[27]||(e[27]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("path",{d:"M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),t("path",{d:"m7 10l5 5l5-5"})])],-1)])],42,j1)):F("",!0),l.showFullscreenButton?(r(),u("button",{key:3,class:b(`${se} ${ae.value?"opacity-50 cursor-not-allowed":""}`),disabled:ae.value,onClick:Oe,onMouseenter:e[13]||(e[13]=o=>h(o,j.value?s(a)("common.minimize")||"Minimize":s(a)("common.open")||"Open")),onFocus:e[14]||(e[14]=o=>h(o,j.value?s(a)("common.minimize")||"Minimize":s(a)("common.open")||"Open")),onMouseleave:v,onBlur:v},[j.value?(r(),u("svg",E1,[...e[29]||(e[29]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6"},null,-1)])])):(r(),u("svg",P1,[...e[28]||(e[28]=[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6"},null,-1)])]))],42,L1)):F("",!0)]))])):F("",!0),t1(t("div",null,[k.value?(r(),u("div",z1,[t("pre",S1,X(z.value),1)])):(r(),u("div",Z1,[l.showZoomControls?(r(),u("div",V1,[t("div",D1,[t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:$e,onMouseenter:e[15]||(e[15]=o=>h(o,s(a)("common.zoomIn")||"Zoom in")),onFocus:e[16]||(e[16]=o=>h(o,s(a)("common.zoomIn")||"Zoom in")),onMouseleave:v,onBlur:v},[...e[30]||(e[30]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])],32),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:je,onMouseenter:e[17]||(e[17]=o=>h(o,s(a)("common.zoomOut")||"Zoom out")),onFocus:e[18]||(e[18]=o=>h(o,s(a)("common.zoomOut")||"Zoom out")),onMouseleave:v,onBlur:v},[...e[31]||(e[31]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])],32),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:Le,onMouseenter:e[19]||(e[19]=o=>h(o,s(a)("common.resetZoom")||"Reset zoom")),onFocus:e[20]||(e[20]=o=>h(o,s(a)("common.resetZoom")||"Reset zoom")),onMouseleave:v,onBlur:v},X(Math.round(100*M.value))+"% ",33)])])):F("",!0),t("div",{class:"infographic-preview relative transition-all overflow-hidden block",style:Ce({height:ce.value}),onMousedown:ee,onMousemove:ne,onMouseup:I,onMouseleave:I,onTouchstartPassive:ee,onTouchmovePassive:ne,onTouchendPassive:I},[L.value||S.value?F("",!0):(r(),u("pre",N1,X(z.value),1)),t("div",{class:b(["absolute inset-0 cursor-grab",{"cursor-grabbing":_.value}]),style:Ce(ze.value)},[t("div",{ref_key:"infographicContainer",ref:p,class:"w-full text-center flex items-center justify-center min-h-full"},null,512)],6)],36)]))],512),[[l1,!c.value]]),(r(),a1(c1,{to:"body"},[t("div",{class:b(["markstream-vue",{dark:l.isDark}])},[i1(u1,{name:"infographic-dialog",appear:""},{default:r1(()=>[j.value?(r(),u("div",{key:0,class:"infographic-modal-overlay fixed inset-0 z-50 flex items-center justify-center p-4",onClick:s1(ve,["self"])},[t("div",Y1,[t("div",_1,[t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:$e},[...e[32]||(e[32]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M11 8v6m-3-3h6"})])],-1)])]),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:je},[...e[33]||(e[33]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[t("circle",{cx:"11",cy:"11",r:"8"}),t("path",{d:"m21 21l-4.35-4.35M8 11h6"})])],-1)])]),t("button",{class:"infographic-action-btn p-[var(--ms-action-btn-padding)] rounded",onClick:Le},X(Math.round(100*M.value))+"% ",1),t("button",{class:"infographic-action-btn inline-flex items-center justify-center p-[var(--ms-action-btn-padding)] rounded",onClick:ve},[...e[34]||(e[34]=[t("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[t("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18 6L6 18M6 6l12 12"})],-1)])])]),t("div",{ref_key:"modalContent",ref:D,class:b(["w-full h-full flex items-center justify-center p-4 overflow-hidden",{"cursor-grab":!_.value,"cursor-grabbing":_.value}]),onMousedown:ee,onMousemove:ne,onMouseup:I,onMouseleave:I,onTouchstartPassive:ee,onTouchmovePassive:ne,onTouchendPassive:I},null,34)])])):F("",!0)]),_:1})],2)]))],10,p1))}}),[["__scopeId","data-v-de34ec4b"]]);ke.install=R=>{R.component(ke.__name,ke)};export{ke as default}; diff --git a/apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js b/apps/kimi-code/dist-web/assets/index11-TEhD5dop.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js rename to apps/kimi-code/dist-web/assets/index11-TEhD5dop.js index 6e015695854..409dbe33b25 100644 --- a/apps/kimi-code/dist-web/assets/index11-Ci8_PlMN.js +++ b/apps/kimi-code/dist-web/assets/index11-TEhD5dop.js @@ -1,4 +1,4 @@ -import{cq as _t,bQ as _n,M as Hn,c2 as Nn,c1 as In,b$ as Yn,c0 as qn,aU as f,bl as Wn,af as Xn,bY as Vn,bE as I,az as Un,c8 as wn,aD as Zn,as as Y,aI as Kn,aL as M,u as C,aY as Rt,v as u,bk as w,bb as Ke,au as ae,t as pe,aw as Ft,bL as Gn,bB as Jn,ar as yn,bd as kn,s as Qn,I as el,bJ as tl,bO as nl,g as ll,T as rl,q as F,c7 as xn,c5 as zt,cr as ol,cs as al,ct as il,cu as ul,cv as sl,b_ as cl,cw as dl}from"./index-D-7nOosq.js";import{i as At}from"./safeRaf-DGuzXxDK.js";function vl(d,m){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(d.slice(Math.max(0,m-12),m))}function Cn(d){return d.includes("->")||d.includes("-->")||d.includes("->>")||d.includes("-->>")||d.includes("-x")||d.includes("--x")||d.includes("-)")||d.includes("--)")||d.includes("-+")||d.includes("--+")}function fl(d){const m=d.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(m)||(function(y){const z=y.split(";",1)[0],a=z.indexOf(":");return a>0&&Cn(z.slice(0,a))})(m)}function ml(d){if(!d.includes(";"))return d;const m=d.indexOf(":");if(m===-1||!(function($,Q){const k=$.slice(0,Q);return/^\s*Note\b/i.test(k)||Cn(k)})(d,m))return d;const y=d.slice(0,m+1),z=d.slice(m+1),a=(function($){let Q="",k=!1;for(let P=0;P<$.length;P++){const ee=$[P];ee!==";"||vl($,P)||fl($.slice(P+1))?Q+=ee:(Q+="#59;",k=!0)}return k?Q:$})(z);return a===z?d:`${y}${a}`}function Lt(d){if(_t(d)!=="sequencediagram")return d;const m=d.split(/(\r\n|\n|\r)/);let y=!1;for(let z=0;zm in d?hl(d,m,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[m]=y,Tn=(d,m)=>{for(var y in m||(m={}))wl.call(m,y)&&Mn(d,y,m[y]);if(bn)for(var y of bn(m))yl.call(m,y)&&Mn(d,y,m[y]);return d},T=(d,m,y)=>new Promise((z,a)=>{var $=P=>{try{k(y.next(P))}catch(ee){a(ee)}},Q=P=>{try{k(y.throw(P))}catch(ee){a(ee)}},k=P=>P.done?z(P.value):Promise.resolve(P.value).then($,Q);k((y=y.apply(d,m)).next())});const xl=["data-markstream-mode","data-markstream-pending"],bl={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},Ml={key:0},Tl={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Cl=["innerHTML"],Bl={key:2},El={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},Ol={class:"flex items-center gap-x-1"},Sl={class:"flex items-center gap-x-1"},$l={key:4},Pl={key:5,class:"mermaid-header-actions flex items-center"},Dl=["aria-pressed"],Rl={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Fl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zl=["aria-label","disabled"],Al=["aria-label","disabled"],Ll={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},jl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},_l={key:0,class:"mermaid-source-panel"},Hl={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Nl={key:1,class:"relative"},Il={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Yl={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ql={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Wl={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pt="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",jt=_n(Hn({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(d,{emit:m}){var y,z;const a=d,$=m,Q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},k=f(!1),P=f(typeof window>"u"),ee=Nn(),Ht=In(),Le=F(()=>a.isStrict?"strict":"loose"),Bn=F(()=>({startOnLoad:!1,securityLevel:Le.value,dompurifyConfig:Le.value==="strict"?Q:void 0,flowchart:Le.value==="strict"?{htmlLabels:!1}:void 0}));function we(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Ee(e,t,n={}){if(!e)return null;const l=(function(r,o){if(!r)return null;const c=sl(o);if(!c)return null;const h=(function(i,s){const p=Array.from(i.childNodes),E=document.createElement("div");return E.dataset.mermaidSvgLayer="1",E.style.zIndex="1",E.appendChild(s),i.insertBefore(E,i.firstChild),p.length>0&&(function(W){const j=()=>{var X;for(const J of W)(X=J.parentNode)==null||X.removeChild(J)};typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>{requestAnimationFrame(j)}):setTimeout(j,32)})(p),E})(r,c);return{svg:c.outerHTML,bindTarget:h}})(e,t);return l||n.keepPreviousOnFailure||we(e),l}let ie=null;function ye(e){if(a.enableMermaidInteractions&&e?.querySelector("svg"))try{ie?.(e)}catch{}}const{t:g}=Yn();let ue=!1,ke=0;function Ge(){return T(this,null,function*(){try{const e=yield il();return ue?null:(k.value=!!e,e)}catch(e){throw ue||(k.value=!1),e}finally{ue||(P.value=!0)}})}const Je=f(!1),V=f(!1),Qe=f(),Z=f(),v=f(),se=f(),et=f(null),En=qn(),je=f(null),xe=f(typeof window>"u"||!ee.value),On=Wn(),te=Xn(Vn,null);let ce="",be=0,tt=0;const Nt=F(()=>cl(a,On));function wt(){const e=Nt.value;e&&(ce&&ce!==e&&(te?.markSettled(ce),be=0),ce=e,be+=1,tt+=1,be===1&&te?.markPending(e))}function yt(){return T(this,null,function*(){const e=ce;if(!e||(be=Math.max(0,be-1),be>0))return;ce="";const t=++tt;yield Y(),t===tt&&((function(n=Nt.value){n&&Qe.value&&te?.reportHeight(n,Qe.value.offsetHeight)})(e),te?.markSettled(e))})}function It(){const e=ce;e&&(ce="",be=0,tt+=1,te?.markSettled(e))}const Yt=f(),D=F(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function Sn(e,t=D.value){const n=t,l={theme:e==="dark"?"dark":"default"};Le.value==="strict"&&(l.flowchart={htmlLabels:!1});const r=`%%{init: ${JSON.stringify(l)}}%% +import{cq as _t,bQ as _n,M as Hn,c2 as Nn,c1 as In,b$ as Yn,c0 as qn,aU as f,bl as Wn,af as Xn,bY as Vn,bE as I,az as Un,c8 as wn,aD as Zn,as as Y,aI as Kn,aL as M,u as C,aY as Rt,v as u,bk as w,bb as Ke,au as ae,t as pe,aw as Ft,bL as Gn,bB as Jn,ar as yn,bd as kn,s as Qn,I as el,bJ as tl,bO as nl,g as ll,T as rl,q as F,c7 as xn,c5 as zt,cr as ol,cs as al,ct as il,cu as ul,cv as sl,b_ as cl,cw as dl}from"./index-Bxn5yOTB.js";import{i as At}from"./safeRaf-DGuzXxDK.js";function vl(d,m){return/(?:&#\d+|#\d+|&[a-z]+)$/i.test(d.slice(Math.max(0,m-12),m))}function Cn(d){return d.includes("->")||d.includes("-->")||d.includes("->>")||d.includes("-->>")||d.includes("-x")||d.includes("--x")||d.includes("-)")||d.includes("--)")||d.includes("-+")||d.includes("--+")}function fl(d){const m=d.trimStart();return/^(?:accDescr|accTitle|activate|actor|and|alt|autonumber|box|break|critical|create\s+(?:actor|participant)|deactivate|destroy|else|end|link|links|loop|Note|opt|option|par|participant|properties|rect)\b/i.test(m)||(function(y){const z=y.split(";",1)[0],a=z.indexOf(":");return a>0&&Cn(z.slice(0,a))})(m)}function ml(d){if(!d.includes(";"))return d;const m=d.indexOf(":");if(m===-1||!(function($,Q){const k=$.slice(0,Q);return/^\s*Note\b/i.test(k)||Cn(k)})(d,m))return d;const y=d.slice(0,m+1),z=d.slice(m+1),a=(function($){let Q="",k=!1;for(let P=0;P<$.length;P++){const ee=$[P];ee!==";"||vl($,P)||fl($.slice(P+1))?Q+=ee:(Q+="#59;",k=!0)}return k?Q:$})(z);return a===z?d:`${y}${a}`}function Lt(d){if(_t(d)!=="sequencediagram")return d;const m=d.split(/(\r\n|\n|\r)/);let y=!1;for(let z=0;zm in d?hl(d,m,{enumerable:!0,configurable:!0,writable:!0,value:y}):d[m]=y,Tn=(d,m)=>{for(var y in m||(m={}))wl.call(m,y)&&Mn(d,y,m[y]);if(bn)for(var y of bn(m))yl.call(m,y)&&Mn(d,y,m[y]);return d},T=(d,m,y)=>new Promise((z,a)=>{var $=P=>{try{k(y.next(P))}catch(ee){a(ee)}},Q=P=>{try{k(y.throw(P))}catch(ee){a(ee)}},k=P=>P.done?z(P.value):Promise.resolve(P.value).then($,Q);k((y=y.apply(d,m)).next())});const xl=["data-markstream-mode","data-markstream-pending"],bl={key:0,class:"mermaid-block-header flex items-center justify-between border-b px-[var(--ms-inset-panel-x)] py-[var(--ms-inset-panel-y)]"},Ml={key:0},Tl={key:1,class:"flex items-center gap-x-2 overflow-hidden"},Cl=["innerHTML"],Bl={key:2},El={key:3,class:"mermaid-mode-toggle-group flex items-center gap-0.5"},Ol={class:"flex items-center gap-x-1"},Sl={class:"flex items-center gap-x-1"},$l={key:4},Pl={key:5,class:"mermaid-header-actions flex items-center"},Dl=["aria-pressed"],Rl={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Fl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},zl=["aria-label","disabled"],Al=["aria-label","disabled"],Ll={key:0,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},jl={key:1,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},_l={key:0,class:"mermaid-source-panel"},Hl={class:"mermaid-source-code text-sm font-mono whitespace-pre-wrap"},Nl={key:1,class:"relative"},Il={key:0,class:"absolute top-2 right-2 z-10 rounded-lg"},Yl={class:"flex items-center gap-2 backdrop-blur rounded-lg"},ql={class:"dialog-panel mermaid-modal-panel relative w-full h-full max-w-full max-h-full rounded overflow-hidden"},Wl={class:"absolute top-6 right-6 z-50 flex items-center gap-2"},pt="mermaid-action-btn p-[var(--ms-action-btn-padding)] rounded",jt=_n(Hn({__name:"MermaidBlockNode",props:{node:{},maxHeight:{default:void 0},estimatedPreviewHeightPx:{},loading:{type:Boolean,default:!0},isDark:{type:Boolean},workerTimeoutMs:{default:1400},parseTimeoutMs:{default:1800},renderTimeoutMs:{default:2500},fullRenderTimeoutMs:{default:4e3},renderDebounceMs:{default:300},contentStableDelayMs:{default:500},previewPollDelayMs:{default:800},previewPollMaxDelayMs:{default:4e3},previewPollMaxAttempts:{default:12},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showZoomControls:{type:Boolean,default:!0},enableWheelZoom:{type:Boolean,default:!1},isStrict:{type:Boolean,default:!0},enableMermaidInteractions:{type:Boolean,default:!1},showTooltips:{type:Boolean,default:!0},onRenderError:{}},emits:["copy","export","openModal","toggleMode"],setup(d,{emit:m}){var y,z;const a=d,$=m,Q={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},k=f(!1),P=f(typeof window>"u"),ee=Nn(),Ht=In(),Le=F(()=>a.isStrict?"strict":"loose"),Bn=F(()=>({startOnLoad:!1,securityLevel:Le.value,dompurifyConfig:Le.value==="strict"?Q:void 0,flowchart:Le.value==="strict"?{htmlLabels:!1}:void 0}));function we(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function Ee(e,t,n={}){if(!e)return null;const l=(function(r,o){if(!r)return null;const c=sl(o);if(!c)return null;const h=(function(i,s){const p=Array.from(i.childNodes),E=document.createElement("div");return E.dataset.mermaidSvgLayer="1",E.style.zIndex="1",E.appendChild(s),i.insertBefore(E,i.firstChild),p.length>0&&(function(W){const j=()=>{var X;for(const J of W)(X=J.parentNode)==null||X.removeChild(J)};typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>{requestAnimationFrame(j)}):setTimeout(j,32)})(p),E})(r,c);return{svg:c.outerHTML,bindTarget:h}})(e,t);return l||n.keepPreviousOnFailure||we(e),l}let ie=null;function ye(e){if(a.enableMermaidInteractions&&e?.querySelector("svg"))try{ie?.(e)}catch{}}const{t:g}=Yn();let ue=!1,ke=0;function Ge(){return T(this,null,function*(){try{const e=yield il();return ue?null:(k.value=!!e,e)}catch(e){throw ue||(k.value=!1),e}finally{ue||(P.value=!0)}})}const Je=f(!1),V=f(!1),Qe=f(),Z=f(),v=f(),se=f(),et=f(null),En=qn(),je=f(null),xe=f(typeof window>"u"||!ee.value),On=Wn(),te=Xn(Vn,null);let ce="",be=0,tt=0;const Nt=F(()=>cl(a,On));function wt(){const e=Nt.value;e&&(ce&&ce!==e&&(te?.markSettled(ce),be=0),ce=e,be+=1,tt+=1,be===1&&te?.markPending(e))}function yt(){return T(this,null,function*(){const e=ce;if(!e||(be=Math.max(0,be-1),be>0))return;ce="";const t=++tt;yield Y(),t===tt&&((function(n=Nt.value){n&&Qe.value&&te?.reportHeight(n,Qe.value.offsetHeight)})(e),te?.markSettled(e))})}function It(){const e=ce;e&&(ce="",be=0,tt+=1,te?.markSettled(e))}const Yt=f(),D=F(()=>a.node.code.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"));function Sn(e,t=D.value){const n=t,l={theme:e==="dark"?"dark":"default"};Le.value==="strict"&&(l.flowchart={htmlLabels:!1});const r=`%%{init: ${JSON.stringify(l)}}%% `;return n.trim().startsWith("%%{")?n:r+n}function qt(){var e;return(function(t){const n=(function(){var r;const o=Z.value?getComputedStyle(Z.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";return(r=zt(o))!=null?r:360})(),l=un();return ol(t,n,l)})((e=zt(a.estimatedPreviewHeightPx))!=null?e:al(D.value))}function Wt(){return`${qt()}px`}const _e=f(null);function kt(){var e;return!!((e=v.value)!=null&&e.querySelector("svg"))}function Xt(){return a.loading!==!1&&(kt()||!!_e.value)}const B=f(1),_=f(0),H=f(0),nt=f(!1),lt=f({x:0,y:0}),x=f(!0),rt=f(!1),re=f(!1),de=f(null);let xt="",bt=!1,ve="";const ot=f(0),Mt=f(!1),$n=F(()=>{var e;return Math.max(0,(e=a.renderDebounceMs)!=null?e:300)}),Pn=F(()=>{var e;return Math.max(0,(e=a.contentStableDelayMs)!=null?e:500)}),He=F(()=>{var e;return Math.max(120,(e=a.previewPollDelayMs)!=null?e:800)}),Dn=F(()=>{var e;return Math.max(He.value,(e=a.previewPollMaxDelayMs)!=null?e:4e3)}),Vt=F(()=>{var e;return Math.max(1,Math.trunc((e=a.previewPollMaxAttempts)!=null?e:12))}),fe=F(()=>a.loading!==!1);let Ne=null,Ie=null,Oe=null,Se=null,Ye=0;const Ut=(y=globalThis.requestIdleCallback)!=null?y:(e,t)=>setTimeout(()=>e({didTimeout:!0}),16),Zt=(z=globalThis.cancelIdleCallback)!=null?z:e=>clearTimeout(e);function b(e=ke){return!ue&&e===ke}function A(){return b()&&xe.value&&!V.value}function Tt(){Oe!=null&&(globalThis.clearTimeout(Oe),Oe=null),Se!=null&&(Zt(Se),Se=null)}function qe(){ue||Oe==null&&Se==null&&(Oe=globalThis.setTimeout(()=>{Oe=null,A()&&(Se=Ut(()=>{Se=null,A()&&gn()},{timeout:500}))},$n.value))}function We(){Ie!=null&&(globalThis.clearTimeout(Ie),Ie=null)}function Kt(e=600){if(typeof globalThis>"u"||ue)return;const t=Math.max(0,e);We(),Ie=globalThis.setTimeout(()=>{if(Ie=null,!ue){if(a.loading||re.value||!A())return void Kt(Math.min(1200,Math.max(300,1.2*t)));qe()}},t)}const q=f(Wt()),at=f(q.value);let $e=null;const O=f(!1),K=f(!1),me=f({}),he=f(0);let U=null,Pe=null;const N=f(!1),Rn=F(()=>{var e,t;return!(V.value||x.value||P.value&&!re.value&&!de.value&&(O.value||N.value&&((t=(e=v.value)==null?void 0:e.textContent)!=null&&t.trim())))}),Me=f({zoom:1,translateX:0,translateY:0,containerHeight:q.value}),Gt=F(()=>a.enableWheelZoom?{wheel:Fn}:{}),G=F(()=>{var e,t,n,l;return{worker:(e=a.workerTimeoutMs)!=null?e:1400,parse:(t=a.parseTimeoutMs)!=null?t:1800,render:(n=a.renderTimeoutMs)!=null?n:2500,fullRender:(l=a.fullRenderTimeoutMs)!=null?l:4e3}});let De=null,it=null,Re=!1,Te=He.value,ne=null,ut=0,Ct=!0,st=0;function Ce(e,t){const n=t?.timeoutMs,l=t?.signal;if(l?.aborted)return Promise.reject(new DOMException("Aborted","AbortError"));let r=null,o=!1,c=null;return new Promise((h,i)=>{const s=()=>{r!=null&&clearTimeout(r),c&&l&&l.removeEventListener("abort",c)};n&&n>0&&(r=globalThis.setTimeout(()=>{o||(o=!0,s(),i(new Error("Operation timed out")))},n)),l&&(c=()=>{o||(o=!0,s(),i(new DOMException("Aborted","AbortError")))},l.addEventListener("abort",c)),e().then(p=>{o||(o=!0,s(),h(p))}).catch(p=>{o||(o=!0,s(),i(p))})})}function Jt(e){if(typeof document>"u"||!v.value)return;if(typeof a.onRenderError=="function"&&a.onRenderError(e,D.value,v.value)===!0)return N.value=!0,void L();const t=document.createElement("div");t.style.padding="var(--ms-inset-panel-body)",t.style.color="hsl(var(--ms-destructive))",t.textContent="Failed to render diagram: ";const n=document.createElement("span");n.textContent=e instanceof Error?e.message:"Unknown error",t.appendChild(n),we(v.value),v.value.appendChild(t);const l=v.value?getComputedStyle(v.value).getPropertyValue("--ms-size-diagram-min-height").trim():"";q.value=l||"360px",at.value=q.value,N.value=!0,L()}function Qt(e){const t=typeof e=="string"?e:typeof e?.message=="string"?e.message:"";return typeof t=="string"&&/timed out/i.test(t)}function en(e){return e?.name==="AbortError"}function Bt(e){return!Qt(e)&&!en(e)}typeof window<"u"&&I([()=>Qe.value,ee],([e,t])=>{var n;if((n=je.value)==null||n.destroy(),je.value=null,!t||xe.value)return void(xe.value=!0);if(!e)return void(xe.value=!1);const l=En(e,{rootMargin:Ht?.value.heavyBlockMargin,allowIdle:!1});je.value=l,xe.value=l.isVisible.value,l.whenVisible.then(()=>{xe.value=!0})},{immediate:!0}),Un(()=>{var e;ue=!0,ke+=1,he.value+=1,(e=je.value)==null||e.destroy(),je.value=null,It(),Tt()});const ct=F(()=>a.showTooltips!==!1);function tn(e){return!e||e.disabled}function R(e,t,n="top"){if(!ct.value||tn(e.currentTarget))return;const l=e,r=l?.clientX!=null&&l?.clientY!=null?{x:l.clientX,y:l.clientY}:void 0;xn(e.currentTarget,t,n,!1,r,a.isDark)}function S(){ct.value&&wn()}function nn(e){if(!ct.value||tn(e.currentTarget))return;const t=Je.value?g("common.copied")||"Copied":g("common.copy")||"Copy",n=e,l=n?.clientX!=null&&n?.clientY!=null?{x:n.clientX,y:n.clientY}:void 0;xn(e.currentTarget,t,"top",!1,l,a.isDark)}function ln(e,t){const n={theme:t==="dark"?"dark":"default"};Le.value==="strict"&&(n.flowchart={htmlLabels:!1});const l=`%%{init: ${JSON.stringify(n)}}%% `;return e.trimStart().startsWith("%%{")?e:l+e}function dt(){return Ct&&!x.value&&!O.value&&!N.value}function rn(e){const t=e.trim();return!(!t||t.startsWith("%%"))&&!/^(?:gantt|title|dateformat|axisformat|tickinterval|excludes|section|todaymarker|topaxis|weekday|weekend|acctitle|accdescr|accdescrmultiline)\b/i.test(t)&&t.includes(":")}function Et(e){if(_t(e)==="gantt")return(function(n){var l;const r=n.split(/\r?\n/);for(!/\r?\n$/.test(n)&&r.length>0&&r.pop();r.length>0;){const o=(l=r[r.length-1])==null?void 0:l.trim();if(o&&!o.startsWith("%%")){if(rn(o))break;r.pop()}else r.pop()}return r.some(rn)?r.join(` `):""})(e);const t=e.split(/\r?\n/);for(;t.length>0;){const n=t[t.length-1].trimEnd();if(n!==""){if(!(/^[-=~>|<\s]+$/.test(n.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(n)||/[-|><]$/.test(n)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(n)))break;t.pop()}else t.pop()}return t.join(` diff --git a/apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js b/apps/kimi-code/dist-web/assets/index5-BZK7AFSJ.js similarity index 95% rename from apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js rename to apps/kimi-code/dist-web/assets/index5-BZK7AFSJ.js index 1e6ee74e9ed..5104fd724f9 100644 --- a/apps/kimi-code/dist-web/assets/index5-Cn2jfVMX.js +++ b/apps/kimi-code/dist-web/assets/index5-BZK7AFSJ.js @@ -1 +1 @@ -import c from"./CodeBlockNode-BAtAs_qm.js";import{M as v,bl as g,aL as P,s as C,A as b,bJ as i,aY as d,av as k,a4 as x,ar as S,bk as T,q as O}from"./index-D-7nOosq.js";import"./safeRaf-DGuzXxDK.js";var H=Object.defineProperty,z=Object.defineProperties,j=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,m=(o,s,e)=>s in o?H(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;const h=v({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:["previewCode","copy"],setup(o,{emit:s}){const e=o,p=s,w=c,f=g(),y=O(()=>{return t=((a,n)=>{for(var r in n||(n={}))F.call(n,r)&&m(a,r,n[r]);if(u)for(var r of u(n))W.call(n,r)&&m(a,r,n[r]);return a})({},f),l={node:e.node,loading:e.loading,stream:e.stream,darkTheme:e.darkTheme,lightTheme:e.lightTheme,isDark:e.isDark,isShowPreview:e.isShowPreview,enableFontSizeControl:e.enableFontSizeControl,minWidth:e.minWidth,maxWidth:e.maxWidth,themes:e.themes,showHeader:e.showHeader,showCopyButton:e.showCopyButton,showExpandButton:e.showExpandButton,showPreviewButton:e.showPreviewButton,showCollapseButton:e.showCollapseButton,showFontSizeButtons:e.showFontSizeButtons,showTooltips:e.showTooltips,estimatedHeightPx:e.estimatedHeightPx,estimatedContentHeightPx:e.estimatedContentHeightPx},z(t,j(l));var t,l});function B(t){p("previewCode",{type:t.artifactType,content:e.node.code,title:t.artifactTitle})}return(t,l)=>(P(),C(T(w),S(y.value,{onPreviewCode:B,onCopy:l[0]||(l[0]=a=>p("copy",a))}),b({_:2},[t.$slots["header-left"]?{name:"header-left",fn:i(()=>[d(t.$slots,"header-left")]),key:"0"}:void 0,t.$slots["header-right"]?{name:"header-right",fn:i(()=>[d(t.$slots,"header-right")]),key:"1"}:void 0,t.$slots.loading?{name:"loading",fn:i(a=>[d(t.$slots,"loading",k(x(a)))]),key:"2"}:void 0]),1040))}});h.install=o=>{o.component(h.__name,h)};export{h as default}; +import c from"./CodeBlockNode-Do73mQqg.js";import{M as v,bl as g,aL as P,s as C,A as b,bJ as i,aY as d,av as k,a4 as x,ar as S,bk as T,q as O}from"./index-Bxn5yOTB.js";import"./safeRaf-DGuzXxDK.js";var H=Object.defineProperty,z=Object.defineProperties,j=Object.getOwnPropertyDescriptors,u=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,m=(o,s,e)=>s in o?H(o,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[s]=e;const h=v({__name:"MarkdownCodeBlockNode",props:{node:{},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},darkTheme:{default:"vitesse-dark"},lightTheme:{default:"vitesse-light"},isDark:{type:Boolean,default:!1},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},autoScrollOnUpdate:{type:Boolean},autoScrollInitial:{type:Boolean},estimatedHeightPx:{},estimatedContentHeightPx:{},themes:{},langs:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0}},emits:["previewCode","copy"],setup(o,{emit:s}){const e=o,p=s,w=c,f=g(),y=O(()=>{return t=((a,n)=>{for(var r in n||(n={}))F.call(n,r)&&m(a,r,n[r]);if(u)for(var r of u(n))W.call(n,r)&&m(a,r,n[r]);return a})({},f),l={node:e.node,loading:e.loading,stream:e.stream,darkTheme:e.darkTheme,lightTheme:e.lightTheme,isDark:e.isDark,isShowPreview:e.isShowPreview,enableFontSizeControl:e.enableFontSizeControl,minWidth:e.minWidth,maxWidth:e.maxWidth,themes:e.themes,showHeader:e.showHeader,showCopyButton:e.showCopyButton,showExpandButton:e.showExpandButton,showPreviewButton:e.showPreviewButton,showCollapseButton:e.showCollapseButton,showFontSizeButtons:e.showFontSizeButtons,showTooltips:e.showTooltips,estimatedHeightPx:e.estimatedHeightPx,estimatedContentHeightPx:e.estimatedContentHeightPx},z(t,j(l));var t,l});function B(t){p("previewCode",{type:t.artifactType,content:e.node.code,title:t.artifactTitle})}return(t,l)=>(P(),C(T(w),S(y.value,{onPreviewCode:B,onCopy:l[0]||(l[0]=a=>p("copy",a))}),b({_:2},[t.$slots["header-left"]?{name:"header-left",fn:i(()=>[d(t.$slots,"header-left")]),key:"0"}:void 0,t.$slots["header-right"]?{name:"header-right",fn:i(()=>[d(t.$slots,"header-right")]),key:"1"}:void 0,t.$slots.loading?{name:"loading",fn:i(a=>[d(t.$slots,"loading",k(x(a)))]),key:"2"}:void 0]),1040))}});h.install=o=>{o.component(h.__name,h)};export{h as default}; diff --git a/apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js b/apps/kimi-code/dist-web/assets/index6-CXJ_z4n5.js similarity index 98% rename from apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js rename to apps/kimi-code/dist-web/assets/index6-CXJ_z4n5.js index 29f5d93ae07..f4b3f5b0be5 100644 --- a/apps/kimi-code/dist-web/assets/index6-D4fZsFMu.js +++ b/apps/kimi-code/dist-web/assets/index6-CXJ_z4n5.js @@ -1 +1 @@ -import{bQ as Q,M as Y,af as Z,bY as G,a0 as ee,bS as ne,bT as A,aU as _,bZ as te,bE as P,aD as ae,az as le,aL as I,u as O,I as oe,bJ as re,t as ie,v as ue,g as se,au as F,bb as ce,aw as de,q as X,bU as ve,as as j,bV as fe,bW as me,bX as he,b_ as ge}from"./index-D-7nOosq.js";var q=(S,B,b)=>new Promise((t,s)=>{var i=c=>{try{T(b.next(c))}catch(d){s(d)}},k=c=>{try{T(b.throw(c))}catch(d){s(d)}},T=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,k);T((b=b.apply(S,B)).next())});const pe=["data-markstream-mode","data-markstream-pending"],ye={key:0,class:"math-loading-overlay"},be=["innerHTML"],ke={key:1,class:"math-block__fallback text-left"},N=Q(Y({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(S){var B,b;const t=S,s=_(null),i=Z(G,null),k=X(()=>ve(t.node.content)),T=((b=(B=ee())==null?void 0:B.vnode.el)==null?void 0:b.nodeType)===1,c=X(()=>ge(t,{})),d=(function(){if(!t.node.content)return{html:"",text:t.node.raw,loading:!1};if(t.node.loading)return{html:"",text:"",loading:!0};const e=ne();if(!e){const n=typeof window>"u"||T;return{html:"",text:n?t.node.raw:"",loading:!n}}try{const n=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return A(k.value,!0,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:t.node.loading?"":t.node.raw,loading:t.node.loading}}})(),u=_(d.html),f=_(d.text);let E=!1,x=0,v=!1,$=null;const m=te();let R=null,h="";const g=_(d.loading),K=_(!1),p=_(D());function H(e){e!=null&&e!==x||(K.value=!1)}function W(){var e;if(t.indexKey==null)return"";const n=(e=t.cacheScope)!=null?e:m?.scope;return`${n!=null&&String(n).length>0?`${String(n)}:`:""}math-block:${String(t.indexKey)}`}function D(){var e;const n=W();return n&&(e=m?.cache.get(n))!=null?e:0}function M(){if(p.value===0)return;p.value=0;const e=W();e&&m?.cache.set(e,0)}function L(e){if(u.value)return void M();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(p.value,e);if(n===p.value)return;p.value=n;const a=W();a&&m?.cache.set(a,n)}function w(){j(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)})}function z(){const e=h;i&&e&&(h="",i.markSettled(e))}function U(){return q(this,null,function*(){if(v)return z(),void H();$&&($.abort(),$=null);const e=++x;if(!t.node.content)return z(),H(),g.value=!1,u.value="",f.value=t.node.raw,E=!1,void w();const n=new AbortController;$=n,K.value=!0,v||e!==x||n.signal.aborted?v||H(e):((function(){const a=c.value;i&&a&&h!==a&&(h&&i.markSettled(h),h=a,i.markPending(a))})(),fe(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(a=>{v||e!==x||(u.value=a,f.value="",E=!0,g.value=!1,M(),w())}).catch(a=>q(null,null,function*(){if(v||e!==x)return;const r=a?.code||a?.name,l=r==="KATEX_DISABLED";if(r==="WORKER_INIT_ERROR"||a?.fallbackToRenderer||(r===me||r==="WORKER_TIMEOUT")&&!t.node.loading){const o=yield he();if(v||e!==x)return;if(o){try{const y=o.renderToString(k.value,{throwOnError:t.node.loading,displayMode:!0});u.value=y,f.value="",E=!0,g.value=!1,M(),w(),A(k.value,!0,y)}catch{}return}}if(l||!t.node.loading)return g.value=!1,u.value="",f.value=t.node.raw,void w();E||(g.value=!0)})).finally(()=>{v||e!==x||(H(e),(function(){const a=h;i&&a&&(h="",j(()=>{var r,l;if(!v){const o=(l=(r=s.value)==null?void 0:r.offsetHeight)!=null?l:0;o>0&&i.reportHeight(a,o)}i.markSettled(a)}))})())}))})}d.html&&(E=!0),d.html&&M();const J=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function V(e,n){return(function(r){const l=String(r??"");for(const{family:o,open:y,close:C}of J)if((y!=="$"||!l.startsWith("$$")&&!l.endsWith("$$"))&&l.length>=y.length+C.length&&l.startsWith(y)&&l.endsWith(C))return{family:o,inner:l.slice(y.length,l.length-C.length),trusted:!0};return null})(e)||{family:"content",inner:String(n??""),trusted:!1}}return P(()=>[t.node.content,t.node.loading,t.node.raw],([e,,n],[a,,r])=>{var l,o;l=V(r,a),o=V(n,e),l.inner===""||l.family===o.family&&(l.trusted&&o.trusted?o.inner.startsWith(l.inner):o.inner===l.inner)||M(),U()},{flush:"post"}),P([()=>t.indexKey,()=>t.cacheScope],()=>{p.value=D(),w()}),ae(()=>{typeof ResizeObserver<"u"&&s.value&&(R=new ResizeObserver(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)}),R.observe(s.value)),w(),u.value||U()}),le(()=>{v=!0,z(),$&&($.abort(),$=null),R?.disconnect(),R=null}),(e,n)=>(I(),O("div",{ref_key:"containerEl",ref:s,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":u.value?"katex":f.value?"fallback":"loading","data-markstream-pending":K.value?"true":void 0,style:de(p.value?{minHeight:`${p.value}px`}:void 0)},[oe(se,{name:"math-fade"},{default:re(()=>[!g.value||u.value||f.value?ie("",!0):(I(),O("div",ye,[...n[0]||(n[0]=[ue("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),u.value?(I(),O("div",{key:0,class:F(["math-block__content",{"math-rendering":g.value}]),innerHTML:u.value},null,10,be)):f.value?(I(),O("pre",ke,ce(f.value),1)):(I(),O("div",{key:2,class:F(["math-block__content",{"math-rendering":g.value}])},null,2))],12,pe))}}),[["__scopeId","data-v-939191ad"]]);N.install=S=>{S.component(N.__name,N)};export{N as default}; +import{bQ as Q,M as Y,af as Z,bY as G,a0 as ee,bS as ne,bT as A,aU as _,bZ as te,bE as P,aD as ae,az as le,aL as I,u as O,I as oe,bJ as re,t as ie,v as ue,g as se,au as F,bb as ce,aw as de,q as X,bU as ve,as as j,bV as fe,bW as me,bX as he,b_ as ge}from"./index-Bxn5yOTB.js";var q=(S,B,b)=>new Promise((t,s)=>{var i=c=>{try{T(b.next(c))}catch(d){s(d)}},k=c=>{try{T(b.throw(c))}catch(d){s(d)}},T=c=>c.done?t(c.value):Promise.resolve(c.value).then(i,k);T((b=b.apply(S,B)).next())});const pe=["data-markstream-mode","data-markstream-pending"],ye={key:0,class:"math-loading-overlay"},be=["innerHTML"],ke={key:1,class:"math-block__fallback text-left"},N=Q(Y({__name:"MathBlockNode",props:{node:{},indexKey:{},cacheScope:{}},setup(S){var B,b;const t=S,s=_(null),i=Z(G,null),k=X(()=>ve(t.node.content)),T=((b=(B=ee())==null?void 0:B.vnode.el)==null?void 0:b.nodeType)===1,c=X(()=>ge(t,{})),d=(function(){if(!t.node.content)return{html:"",text:t.node.raw,loading:!1};if(t.node.loading)return{html:"",text:"",loading:!0};const e=ne();if(!e){const n=typeof window>"u"||T;return{html:"",text:n?t.node.raw:"",loading:!n}}try{const n=e.renderToString(k.value,{throwOnError:!1,displayMode:!0});return A(k.value,!0,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:t.node.loading?"":t.node.raw,loading:t.node.loading}}})(),u=_(d.html),f=_(d.text);let E=!1,x=0,v=!1,$=null;const m=te();let R=null,h="";const g=_(d.loading),K=_(!1),p=_(D());function H(e){e!=null&&e!==x||(K.value=!1)}function W(){var e;if(t.indexKey==null)return"";const n=(e=t.cacheScope)!=null?e:m?.scope;return`${n!=null&&String(n).length>0?`${String(n)}:`:""}math-block:${String(t.indexKey)}`}function D(){var e;const n=W();return n&&(e=m?.cache.get(n))!=null?e:0}function M(){if(p.value===0)return;p.value=0;const e=W();e&&m?.cache.set(e,0)}function L(e){if(u.value)return void M();if(!Number.isFinite(e)||e<=0)return;const n=Math.max(p.value,e);if(n===p.value)return;p.value=n;const a=W();a&&m?.cache.set(a,n)}function w(){j(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)})}function z(){const e=h;i&&e&&(h="",i.markSettled(e))}function U(){return q(this,null,function*(){if(v)return z(),void H();$&&($.abort(),$=null);const e=++x;if(!t.node.content)return z(),H(),g.value=!1,u.value="",f.value=t.node.raw,E=!1,void w();const n=new AbortController;$=n,K.value=!0,v||e!==x||n.signal.aborted?v||H(e):((function(){const a=c.value;i&&a&&h!==a&&(h&&i.markSettled(h),h=a,i.markPending(a))})(),fe(k.value,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:8,signal:n.signal}).then(a=>{v||e!==x||(u.value=a,f.value="",E=!0,g.value=!1,M(),w())}).catch(a=>q(null,null,function*(){if(v||e!==x)return;const r=a?.code||a?.name,l=r==="KATEX_DISABLED";if(r==="WORKER_INIT_ERROR"||a?.fallbackToRenderer||(r===me||r==="WORKER_TIMEOUT")&&!t.node.loading){const o=yield he();if(v||e!==x)return;if(o){try{const y=o.renderToString(k.value,{throwOnError:t.node.loading,displayMode:!0});u.value=y,f.value="",E=!0,g.value=!1,M(),w(),A(k.value,!0,y)}catch{}return}}if(l||!t.node.loading)return g.value=!1,u.value="",f.value=t.node.raw,void w();E||(g.value=!0)})).finally(()=>{v||e!==x||(H(e),(function(){const a=h;i&&a&&(h="",j(()=>{var r,l;if(!v){const o=(l=(r=s.value)==null?void 0:r.offsetHeight)!=null?l:0;o>0&&i.reportHeight(a,o)}i.markSettled(a)}))})())}))})}d.html&&(E=!0),d.html&&M();const J=[{family:"$$",open:"$$",close:"$$"},{family:"\\[]",open:"\\[",close:"\\]"},{family:"\\[]",open:"\\[",close:"]"},{family:"[]",open:"[",close:"\\]"},{family:"[]",open:"[",close:"]"},{family:"\\()",open:"\\(",close:"\\)"},{family:"$",open:"$",close:"$"}];function V(e,n){return(function(r){const l=String(r??"");for(const{family:o,open:y,close:C}of J)if((y!=="$"||!l.startsWith("$$")&&!l.endsWith("$$"))&&l.length>=y.length+C.length&&l.startsWith(y)&&l.endsWith(C))return{family:o,inner:l.slice(y.length,l.length-C.length),trusted:!0};return null})(e)||{family:"content",inner:String(n??""),trusted:!1}}return P(()=>[t.node.content,t.node.loading,t.node.raw],([e,,n],[a,,r])=>{var l,o;l=V(r,a),o=V(n,e),l.inner===""||l.family===o.family&&(l.trusted&&o.trusted?o.inner.startsWith(l.inner):o.inner===l.inner)||M(),U()},{flush:"post"}),P([()=>t.indexKey,()=>t.cacheScope],()=>{p.value=D(),w()}),ae(()=>{typeof ResizeObserver<"u"&&s.value&&(R=new ResizeObserver(()=>{var e,n;L((n=(e=s.value)==null?void 0:e.offsetHeight)!=null?n:0)}),R.observe(s.value)),w(),u.value||U()}),le(()=>{v=!0,z(),$&&($.abort(),$=null),R?.disconnect(),R=null}),(e,n)=>(I(),O("div",{ref_key:"containerEl",ref:s,class:"math-block text-center overflow-x-auto relative","data-markstream-math":"block","data-markstream-mode":u.value?"katex":f.value?"fallback":"loading","data-markstream-pending":K.value?"true":void 0,style:de(p.value?{minHeight:`${p.value}px`}:void 0)},[oe(se,{name:"math-fade"},{default:re(()=>[!g.value||u.value||f.value?ie("",!0):(I(),O("div",ye,[...n[0]||(n[0]=[ue("div",{class:"math-loading-spinner"},null,-1)])]))]),_:1}),u.value?(I(),O("div",{key:0,class:F(["math-block__content",{"math-rendering":g.value}]),innerHTML:u.value},null,10,be)):f.value?(I(),O("pre",ke,ce(f.value),1)):(I(),O("div",{key:2,class:F(["math-block__content",{"math-rendering":g.value}])},null,2))],12,pe))}}),[["__scopeId","data-v-939191ad"]]);N.install=S=>{S.component(N.__name,N)};export{N as default}; diff --git a/apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js b/apps/kimi-code/dist-web/assets/index7-CG7TPx8g.js similarity index 98% rename from apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js rename to apps/kimi-code/dist-web/assets/index7-CG7TPx8g.js index c35fdf6071a..1c55663b5da 100644 --- a/apps/kimi-code/dist-web/assets/index7-BT2SBznQ.js +++ b/apps/kimi-code/dist-web/assets/index7-CG7TPx8g.js @@ -1 +1 @@ -import{bQ as C,M as D,a0 as N,bS as U,bT as L,aU as h,bE as A,aD as K,az as W,aL as y,u as x,bb as z,s as H,bJ as P,v as M,aY as V,g as X,t as j,q as O,bU as q,bV as F,bW as J,bX as Q}from"./index-D-7nOosq.js";var S=(f,b,r)=>new Promise((e,k)=>{var i=l=>{try{p(r.next(l))}catch(t){k(t)}},d=l=>{try{p(r.throw(l))}catch(t){k(t)}},p=l=>l.done?e(l.value):Promise.resolve(l.value).then(i,d);p((r=r.apply(f,b)).next())});const Y=["data-markstream-mode","data-markstream-pending"],G=["innerHTML"],Z={key:1,class:"math-inline math-inline--fallback"},ee={class:"math-inline__loading",role:"status","aria-live":"polite"},R=C(D({__name:"MathInlineNode",props:{node:{}},setup(f){var b,r;const e=f,k=h(null),i=O(()=>e.node.markup==="$$"),d=O(()=>q(e.node.content)),p=((r=(b=N())==null?void 0:b.vnode.el)==null?void 0:r.nodeType)===1,l=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const a=U();if(!a){const n=typeof window>"u"||p;return{html:"",text:n?e.node.raw:"",loading:!n}}try{const n=a.renderToString(d.value,{throwOnError:!1,displayMode:i.value});return L(d.value,i.value,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),t=h(l.html),u=h(l.text);let g=!1,m=0,s=!1,c=null;const v=h(l.loading),_=h(!1);function T(a){a!=null&&a!==m||(_.value=!1)}function B(){return S(this,null,function*(){if(s)return;c&&(c.abort(),c=null);const a=++m;if(!e.node.content)return T(),t.value="",u.value=e.node.loading?"":e.node.raw,v.value=e.node.loading,void(g=!1);const n=new AbortController;c=n,_.value=!0,s||a!==m||n.signal.aborted?T(a):F(d.value,i.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(o=>{s||a!==m||(t.value=o,u.value="",v.value=!1,g=!0)}).catch(o=>S(null,null,function*(){if(s||a!==m)return;const w=o?.code||o?.name,$=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||(w===J||w==="WORKER_TIMEOUT")&&!e.node.loading){const I=yield Q();if(s||a!==m)return;if(I){try{const E=I.renderToString(d.value,{throwOnError:e.node.loading,displayMode:i.value});t.value=E,u.value="",v.value=!1,g=!0,L(d.value,i.value,E)}catch{}return}}if($||!e.node.loading)return v.value=!1,t.value="",void(u.value=e.node.raw);g||(v.value=!0)})).finally(()=>{s||T(a)})})}return l.html&&(g=!0),A(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{B()}),K(()=>{t.value||B()}),W(()=>{s=!0,c&&(c.abort(),c=null)}),(a,n)=>(y(),x("span",{ref_key:"containerEl",ref:k,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":u.value?"fallback":"loading","data-markstream-pending":_.value?"true":void 0},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,G)):u.value?(y(),x("span",Z,z(u.value),1)):v.value?(y(),H(X,{key:2,name:"table-node-fade"},{default:P(()=>[M("span",ee,[V(a.$slots,"loading",{isLoading:v.value},()=>[n[0]||(n[0]=M("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),n[1]||(n[1]=M("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):j("",!0)],8,Y))}}),[["__scopeId","data-v-6c556261"]]);R.install=f=>{f.component(R.__name,R)};export{R as default}; +import{bQ as C,M as D,a0 as N,bS as U,bT as L,aU as h,bE as A,aD as K,az as W,aL as y,u as x,bb as z,s as H,bJ as P,v as M,aY as V,g as X,t as j,q as O,bU as q,bV as F,bW as J,bX as Q}from"./index-Bxn5yOTB.js";var S=(f,b,r)=>new Promise((e,k)=>{var i=l=>{try{p(r.next(l))}catch(t){k(t)}},d=l=>{try{p(r.throw(l))}catch(t){k(t)}},p=l=>l.done?e(l.value):Promise.resolve(l.value).then(i,d);p((r=r.apply(f,b)).next())});const Y=["data-markstream-mode","data-markstream-pending"],G=["innerHTML"],Z={key:1,class:"math-inline math-inline--fallback"},ee={class:"math-inline__loading",role:"status","aria-live":"polite"},R=C(D({__name:"MathInlineNode",props:{node:{}},setup(f){var b,r;const e=f,k=h(null),i=O(()=>e.node.markup==="$$"),d=O(()=>q(e.node.content)),p=((r=(b=N())==null?void 0:b.vnode.el)==null?void 0:r.nodeType)===1,l=(function(){if(!e.node.content)return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading};if(e.node.loading)return{html:"",text:"",loading:!0};const a=U();if(!a){const n=typeof window>"u"||p;return{html:"",text:n?e.node.raw:"",loading:!n}}try{const n=a.renderToString(d.value,{throwOnError:!1,displayMode:i.value});return L(d.value,i.value,n),{html:n,text:"",loading:!1}}catch{return{html:"",text:e.node.loading?"":e.node.raw,loading:e.node.loading}}})(),t=h(l.html),u=h(l.text);let g=!1,m=0,s=!1,c=null;const v=h(l.loading),_=h(!1);function T(a){a!=null&&a!==m||(_.value=!1)}function B(){return S(this,null,function*(){if(s)return;c&&(c.abort(),c=null);const a=++m;if(!e.node.content)return T(),t.value="",u.value=e.node.loading?"":e.node.raw,v.value=e.node.loading,void(g=!1);const n=new AbortController;c=n,_.value=!0,s||a!==m||n.signal.aborted?T(a):F(d.value,i.value,{timeout:1500,waitTimeout:1500,maxRetries:8,signal:n.signal}).then(o=>{s||a!==m||(t.value=o,u.value="",v.value=!1,g=!0)}).catch(o=>S(null,null,function*(){if(s||a!==m)return;const w=o?.code||o?.name,$=w==="KATEX_DISABLED";if(w==="WORKER_INIT_ERROR"||o?.fallbackToRenderer||(w===J||w==="WORKER_TIMEOUT")&&!e.node.loading){const I=yield Q();if(s||a!==m)return;if(I){try{const E=I.renderToString(d.value,{throwOnError:e.node.loading,displayMode:i.value});t.value=E,u.value="",v.value=!1,g=!0,L(d.value,i.value,E)}catch{}return}}if($||!e.node.loading)return v.value=!1,t.value="",void(u.value=e.node.raw);g||(v.value=!0)})).finally(()=>{s||T(a)})})}return l.html&&(g=!0),A(()=>[e.node.content,e.node.loading,e.node.raw,e.node.markup],()=>{B()}),K(()=>{t.value||B()}),W(()=>{s=!0,c&&(c.abort(),c=null)}),(a,n)=>(y(),x("span",{ref_key:"containerEl",ref:k,class:"math-inline-wrapper","data-markstream-math":"inline","data-markstream-mode":t.value?"katex":u.value?"fallback":"loading","data-markstream-pending":_.value?"true":void 0},[t.value?(y(),x("span",{key:0,class:"math-inline",innerHTML:t.value},null,8,G)):u.value?(y(),x("span",Z,z(u.value),1)):v.value?(y(),H(X,{key:2,name:"table-node-fade"},{default:P(()=>[M("span",ee,[V(a.$slots,"loading",{isLoading:v.value},()=>[n[0]||(n[0]=M("span",{class:"math-inline__spinner animate-spin","aria-hidden":"true"},null,-1)),n[1]||(n[1]=M("span",{class:"sr-only"},"Loading",-1))],!0)])]),_:3})):j("",!0)],8,Y))}}),[["__scopeId","data-v-6c556261"]]);R.install=f=>{f.component(R.__name,R)};export{R as default}; diff --git a/apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js b/apps/kimi-code/dist-web/assets/index8-B9apTeKj.js similarity index 99% rename from apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js rename to apps/kimi-code/dist-web/assets/index8-B9apTeKj.js index 769f0e8ceec..c1e25c024eb 100644 --- a/apps/kimi-code/dist-web/assets/index8-BaK3y7fN.js +++ b/apps/kimi-code/dist-web/assets/index8-B9apTeKj.js @@ -1 +1 @@ -import{bQ as ot,M as lt,bl as at,af as rt,bY as ut,b$ as it,c0 as st,c1 as ct,c2 as dt,aU as d,bE as Z,as as fe,aD as vt,az as mt,aL as v,u as m,v as u,bk as f,au as pe,bb as N,t as T,aw as ge,bL as ft,bB as pt,q as D,c7 as Se,c8 as gt,ca as ht,b_ as yt}from"./index-D-7nOosq.js";var wt=Object.defineProperty,Le=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,Ne=(p,n,i)=>n in p?wt(p,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[n]=i,he=(p,n)=>{for(var i in n||(n={}))bt.call(n,i)&&Ne(p,i,n[i]);if(Le)for(var i of Le(n))kt.call(n,i)&&Ne(p,i,n[i]);return p},ye=(p,n,i)=>new Promise((w,a)=>{var A=h=>{try{g(i.next(h))}catch(s){a(s)}},k=h=>{try{g(i.throw(h))}catch(s){a(s)}},g=h=>h.done?w(h.value):Promise.resolve(h.value).then(A,k);g((i=i.apply(p,n)).next())});const xt=["data-markstream-mode","data-markstream-pending"],Bt={key:0,class:"d2-block-header flex justify-between items-center border-b"},Dt={class:"d2-header-actions flex items-center"},Ct={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},Mt=["aria-label"],Et={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tt={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},At=["aria-label"],jt=["aria-pressed"],Ot={key:0,class:"d2-source"},Ft={class:"d2-code"},It={key:0,class:"d2-error mt-2 text-xs"},Ht={key:1},St={key:0,class:"d2-source"},Lt={class:"d2-code"},Nt={key:0,class:"d2-error mt-2 text-xs"},Pt=["innerHTML"],Rt={key:0,class:"d2-error px-4 pb-3 text-xs"},we=ot(lt({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(p){const n=p,i=at(),w=rt(ut,null),{t:a}=it(),A=d(!1),k=d(!1),g=d(!1),h=d(!1),s=d(null),W=d(!1),j=d(""),ae=d(""),re=d(0),P=d(""),R=d(""),ee=d(null),ue=d(null),ie=d(null),Pe=st(),te=ct(),be=dt(),Y=d(null),ke=typeof window<"u",xe=d(!1),O=d(typeof window>"u"||!be.value),F=D(()=>{var t;return(t=n.node.code)!=null?t:""}),Re=D(()=>yt(n,i)),se=D(()=>{var t,e;return[n.isDark?"dark":"light",(t=n.themeId)!=null?t:"auto",(e=n.darkThemeId)!=null?e:"auto",F.value].join(":")}),ne=D(()=>!!j.value&&ae.value===se.value),Be=D(()=>{if(!xe.value||!F.value||g.value)return!1;const t=se.value;return!!W.value||P.value!==t&&(!s.value||R.value!==t)}),De=D(()=>ne.value||!!j.value&&Be.value),oe=D(()=>g.value||!h.value||!De.value),_e=D(()=>{if(oe.value&&ue.value)return{minHeight:`${ue.value}px`}}),Ue=D(()=>n.maxHeight==="none"?{maxHeight:"none"}:n.maxHeight!=null?{maxHeight:typeof n.maxHeight=="number"?`${n.maxHeight}px`:String(n.maxHeight)}:void 0);let x=null,ce=!1,_=!1,Ce=0,U=null,I=!1,$=null,C="";typeof window<"u"&&Z([()=>ie.value,be],([t,e])=>{var o,c,H;if((o=Y.value)==null||o.destroy(),Y.value=null,!e||O.value)return void(O.value=!0);if(!t)return void(O.value=!1);const S=(H=(c=te?.value.heavyBlockMargin)!=null?c:te?.value.rootMargin)!=null?H:"160px",V=Pe(t,{rootMargin:S,allowIdle:!1});Y.value=V,O.value=V.isVisible.value,V.whenVisible.then(()=>{O.value=!0})},{immediate:!0});const Ve={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Me(t){return!t||t.disabled}function M(t,e,o="top"){if(Me(t.currentTarget))return;const c=t,H=c?.clientX!=null&&c?.clientY!=null?{x:c.clientX,y:c.clientY}:void 0;Se(t.currentTarget,e,o,!1,H,n.isDark)}function b(){gt()}function Ee(t){if(Me(t.currentTarget))return;const e=A.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=t,c=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;Se(t.currentTarget,e,"top",!1,c,n.isDark)}function ze(){return ye(this,null,function*(){try{const t=F.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(t)),A.value=!0,setTimeout(()=>{A.value=!1},1e3)}catch(t){console.error("Copy failed:",t)}})}function Ye(){k.value=!k.value}function Te(t){g.value=t==="source"}const $e=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Xe(t){if(!t)return"";const e=t.trim();return qe.test(e)?e:""}function Ae(){j.value="",ae.value=""}function q(t){return _||t!==re.value}function Ge(){return ye(this,null,function*(){var t,e,o,c,H;if(!ke||_||!O.value||n.loading&&!n.progressiveRender)return;const S=se.value;if(S===P.value&&!s.value&&ne.value)return h.value=!0,void(n.loading&&(g.value=!1));const V=F.value;if(!V)return Ae(),s.value=null,P.value="",void(R.value="");const G=++re.value;W.value=!0,s.value=null,R.value="",(function(){const r=Re.value;w&&r&&C!==r&&(C&&w.markSettled(C),C=r,w.markPending(r))})();try{const r=yield(function(){return ye(this,null,function*(){if(x)return x;const l=yield ht();if(_||!l)return null;if(typeof l=="function"){const Q=new l;return Q&&typeof Q.compile=="function"?x=Q:typeof l.compile=="function"&&(x=l),x}return l?.D2&&typeof l.D2=="function"?(x=new l.D2,x):(typeof l.compile=="function"&&(x=l),x)})})();if(q(G))return;if(!r)return h.value=!1,g.value=!0,Ae(),s.value="D2 is not available.",void(R.value=S);if(typeof r.compile!="function"||typeof r.render!="function")throw new TypeError("D2 instance is missing compile/render methods.");h.value=!0;const y=yield r.compile(V);if(q(G))return;const le=(t=y?.diagram)!=null?t:y,B=(o=(e=y?.renderOptions)!=null?e:y?.options)!=null?o:{},Qe=(c=n.themeId)!=null?c:B.themeID,je=(H=n.darkThemeId)!=null?H:B.darkThemeID,J=he({},B);if(J.themeID=n.isDark&&je!=null?je:Qe,J.darkThemeID=null,J.darkThemeOverrides=null,n.isDark){const l=B.themeOverrides&&typeof B.themeOverrides=="object"?B.themeOverrides:null;J.themeOverrides=he(he({},Ve),l||{})}const Ke=yield r.render(le,J);if(q(G))return;const Oe=(function(l){return l?typeof l=="string"?l:typeof l.svg=="string"?l.svg:typeof l.data=="string"?l.data:"":""})(Ke);if(!Oe)throw new Error("D2 render returned empty output.");(function(l,Q){const Fe=(function(Ie){if(typeof window>"u"||typeof DOMParser>"u"||!Ie)return"";const Ze=Ie.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),ve=new DOMParser().parseFromString(Ze,"image/svg+xml").documentElement;if(!ve||ve.nodeName.toLowerCase()!=="svg")return"";const me=ve;return(function(He){const We=new Set(["script"]),et=[He,...Array.from(He.querySelectorAll("*"))];for(const L of et){if(We.has(L.tagName.toLowerCase())){L.remove();continue}const tt=Array.from(L.attributes);for(const z of tt){const E=z.name;if(/^on/i.test(E))L.removeAttribute(E);else{if(E==="style"&&z.value){const K=z.value;if($e.some(nt=>nt.test(K))){L.removeAttribute(E);continue}}if((E==="href"||E==="xlink:href")&&z.value){const K=Xe(z.value);if(!K){L.removeAttribute(E);continue}K!==z.value&&L.setAttribute(E,K)}}}}})(me),me.classList.add("markstream-d2-root-svg"),me.outerHTML})(l);j.value=Fe||"",ae.value=Fe?Q:""})(Oe,S),P.value=S,R.value="",n.loading&&(g.value=!1),s.value=null}catch(r){if(q(G))return;const y=r?.message?String(r.message):"D2 render failed.";n.loading||(s.value=y,R.value=S),P.value="",y.includes("@terrastruct/d2")&&(h.value=!1,g.value=!0)}finally{q(G)||(W.value=!1,I?(I=!1,X()):(function(){const r=C;w&&r&&(C="",fe(()=>{var y,le;if(!_){const B=(le=(y=ie.value)==null?void 0:y.offsetHeight)!=null?le:0;B>0&&w.reportHeight(r,B)}w.markSettled(r)}))})())}})}function X(t=!1){if(ce||!ke||_)return;if(W.value)return void(I=!0);const e=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-Ce;if(!t&&o{U=null,I&&(I=!1,X(!0))},Math.max(0,e-o))));ce=!0;const c=()=>{ce=!1,Ce=Date.now(),Ge()};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(c):setTimeout(c,0)}function Je(){if(ne.value)try{const t=new Blob([j.value],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t);if(typeof document<"u"){const o=document.createElement("a");o.href=e,o.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}URL.revokeObjectURL(e)}catch(t){console.error("Failed to export SVG:",t)}}function de(){const t=ee.value;if(!t)return;const e=t.getBoundingClientRect().height;e>0&&(ue.value=e)}return Z(()=>[n.node.code,n.loading,n.isDark,n.themeId,n.darkThemeId],()=>{X()},{immediate:!0}),Z(()=>n.loading,(t,e)=>{e&&!t&&X(!0)}),Z(()=>O.value,t=>{t&&X(!0)}),Z(()=>[oe.value,j.value,F.value],()=>{fe(()=>{de()})}),vt(()=>{xe.value=!0,fe(()=>{de()}),typeof ResizeObserver<"u"&&($=new ResizeObserver(()=>{de()}),ee.value&&$.observe(ee.value))}),mt(()=>{var t;_=!0,re.value+=1,I=!1,(function(){const e=C;w&&e&&(C="",w.markSettled(e))})(),P.value="",(t=Y.value)==null||t.destroy(),Y.value=null,U!=null&&(clearTimeout(U),U=null),$?.disconnect(),$=null}),(t,e)=>(v(),m("div",{ref_key:"viewportTarget",ref:ie,class:pe(["d2-block-container rounded-lg border overflow-hidden",{dark:n.isDark}]),"data-markstream-d2":"1","data-markstream-mode":oe.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[n.showHeader?(v(),m("div",Bt,[e[16]||(e[16]=u("div",{class:"flex items-center gap-x-2"},[u("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),u("div",Dt,[n.showModeToggle?(v(),m("div",Ct,[u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"":"is-active"]),onClick:e[0]||(e[0]=o=>Te("preview")),onMouseenter:e[1]||(e[1]=o=>M(o,f(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>M(o,f(a)("common.preview")||"Preview")),onMouseleave:b,onBlur:b},N(f(a)("common.preview")||"Preview"),35),u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"is-active":""]),onClick:e[3]||(e[3]=o=>Te("source")),onMouseenter:e[4]||(e[4]=o=>M(o,f(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>M(o,f(a)("common.source")||"Source")),onMouseleave:b,onBlur:b},N(f(a)("common.source")||"Source"),35)])):T("",!0),n.showCopyButton?(v(),m("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":A.value?f(a)("common.copied")||"Copied":f(a)("common.copy")||"Copy",onClick:ze,onMouseenter:e[6]||(e[6]=o=>Ee(o)),onFocus:e[7]||(e[7]=o=>Ee(o)),onMouseleave:b,onBlur:b},[A.value?(v(),m("svg",Tt,[...e[13]||(e[13]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),m("svg",Et,[...e[12]||(e[12]=[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),u("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Mt)):T("",!0),n.showExportButton&&ne.value?(v(),m("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":f(a)("common.export")||"Export",onClick:Je,onMouseenter:e[8]||(e[8]=o=>M(o,f(a)("common.export")||"Export")),onFocus:e[9]||(e[9]=o=>M(o,f(a)("common.export")||"Export")),onMouseleave:b,onBlur:b},[...e[14]||(e[14]=[u("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,At)):T("",!0),n.showCollapseButton?(v(),m("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":k.value,onClick:Ye,onMouseenter:e[10]||(e[10]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onFocus:e[11]||(e[11]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onMouseleave:b,onBlur:b},[(v(),m("svg",{style:ge({rotate:k.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[15]||(e[15]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,jt)):T("",!0)])])):T("",!0),ft(u("div",{ref_key:"bodyRef",ref:ee,class:"d2-block-body",style:ge(_e.value)},[n.loading&&!De.value?(v(),m("div",Ot,[u("pre",Ft,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",It,N(s.value),1)):T("",!0)])):(v(),m("div",Ht,[oe.value?(v(),m("div",St,[u("pre",Lt,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",Nt,N(s.value),1)):T("",!0)])):(v(),m("div",{key:1,class:"d2-render",style:ge(Ue.value)},[u("div",{class:"d2-svg",innerHTML:j.value},null,8,Pt),s.value?(v(),m("p",Rt,N(s.value),1)):T("",!0)],4))]))],4),[[pt,!k.value]])],10,xt))}}),[["__scopeId","data-v-3b434cf5"]]);we.install=p=>{p.component(we.__name,we)};export{we as default}; +import{bQ as ot,M as lt,bl as at,af as rt,bY as ut,b$ as it,c0 as st,c1 as ct,c2 as dt,aU as d,bE as Z,as as fe,aD as vt,az as mt,aL as v,u as m,v as u,bk as f,au as pe,bb as N,t as T,aw as ge,bL as ft,bB as pt,q as D,c7 as Se,c8 as gt,ca as ht,b_ as yt}from"./index-Bxn5yOTB.js";var wt=Object.defineProperty,Le=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable,Ne=(p,n,i)=>n in p?wt(p,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):p[n]=i,he=(p,n)=>{for(var i in n||(n={}))bt.call(n,i)&&Ne(p,i,n[i]);if(Le)for(var i of Le(n))kt.call(n,i)&&Ne(p,i,n[i]);return p},ye=(p,n,i)=>new Promise((w,a)=>{var A=h=>{try{g(i.next(h))}catch(s){a(s)}},k=h=>{try{g(i.throw(h))}catch(s){a(s)}},g=h=>h.done?w(h.value):Promise.resolve(h.value).then(A,k);g((i=i.apply(p,n)).next())});const xt=["data-markstream-mode","data-markstream-pending"],Bt={key:0,class:"d2-block-header flex justify-between items-center border-b"},Dt={class:"d2-header-actions flex items-center"},Ct={key:0,class:"d2-mode-toggle flex items-center gap-0.5"},Mt=["aria-label"],Et={key:0,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},Tt={key:1,xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},At=["aria-label"],jt=["aria-pressed"],Ot={key:0,class:"d2-source"},Ft={class:"d2-code"},It={key:0,class:"d2-error mt-2 text-xs"},Ht={key:1},St={key:0,class:"d2-source"},Lt={class:"d2-code"},Nt={key:0,class:"d2-error mt-2 text-xs"},Pt=["innerHTML"],Rt={key:0,class:"d2-error px-4 pb-3 text-xs"},we=ot(lt({__name:"D2BlockNode",props:{node:{},maxHeight:{default:void 0},loading:{type:Boolean,default:!0},isDark:{type:Boolean},progressiveRender:{type:Boolean,default:!0},progressiveIntervalMs:{default:700},themeId:{},darkThemeId:{},showHeader:{type:Boolean,default:!0},showModeToggle:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExportButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0}},setup(p){const n=p,i=at(),w=rt(ut,null),{t:a}=it(),A=d(!1),k=d(!1),g=d(!1),h=d(!1),s=d(null),W=d(!1),j=d(""),ae=d(""),re=d(0),P=d(""),R=d(""),ee=d(null),ue=d(null),ie=d(null),Pe=st(),te=ct(),be=dt(),Y=d(null),ke=typeof window<"u",xe=d(!1),O=d(typeof window>"u"||!be.value),F=D(()=>{var t;return(t=n.node.code)!=null?t:""}),Re=D(()=>yt(n,i)),se=D(()=>{var t,e;return[n.isDark?"dark":"light",(t=n.themeId)!=null?t:"auto",(e=n.darkThemeId)!=null?e:"auto",F.value].join(":")}),ne=D(()=>!!j.value&&ae.value===se.value),Be=D(()=>{if(!xe.value||!F.value||g.value)return!1;const t=se.value;return!!W.value||P.value!==t&&(!s.value||R.value!==t)}),De=D(()=>ne.value||!!j.value&&Be.value),oe=D(()=>g.value||!h.value||!De.value),_e=D(()=>{if(oe.value&&ue.value)return{minHeight:`${ue.value}px`}}),Ue=D(()=>n.maxHeight==="none"?{maxHeight:"none"}:n.maxHeight!=null?{maxHeight:typeof n.maxHeight=="number"?`${n.maxHeight}px`:String(n.maxHeight)}:void 0);let x=null,ce=!1,_=!1,Ce=0,U=null,I=!1,$=null,C="";typeof window<"u"&&Z([()=>ie.value,be],([t,e])=>{var o,c,H;if((o=Y.value)==null||o.destroy(),Y.value=null,!e||O.value)return void(O.value=!0);if(!t)return void(O.value=!1);const S=(H=(c=te?.value.heavyBlockMargin)!=null?c:te?.value.rootMargin)!=null?H:"160px",V=Pe(t,{rootMargin:S,allowIdle:!1});Y.value=V,O.value=V.isVisible.value,V.whenVisible.then(()=>{O.value=!0})},{immediate:!0});const Ve={N1:"#E5E7EB",N2:"#CBD5E1",N3:"#94A3B8",N4:"#64748B",N5:"#475569",N6:"#334155",N7:"#0B1220",B1:"#60A5FA",B2:"#3B82F6",B3:"#2563EB",B4:"#1D4ED8",B5:"#1E40AF",B6:"#111827",AA2:"#22D3EE",AA4:"#0EA5E9",AA5:"#0284C7",AB4:"#FBBF24",AB5:"#F59E0B"};function Me(t){return!t||t.disabled}function M(t,e,o="top"){if(Me(t.currentTarget))return;const c=t,H=c?.clientX!=null&&c?.clientY!=null?{x:c.clientX,y:c.clientY}:void 0;Se(t.currentTarget,e,o,!1,H,n.isDark)}function b(){gt()}function Ee(t){if(Me(t.currentTarget))return;const e=A.value?a("common.copied")||"Copied":a("common.copy")||"Copy",o=t,c=o?.clientX!=null&&o?.clientY!=null?{x:o.clientX,y:o.clientY}:void 0;Se(t.currentTarget,e,"top",!1,c,n.isDark)}function ze(){return ye(this,null,function*(){try{const t=F.value;typeof navigator<"u"&&navigator.clipboard&&typeof navigator.clipboard.writeText=="function"&&(yield navigator.clipboard.writeText(t)),A.value=!0,setTimeout(()=>{A.value=!1},1e3)}catch(t){console.error("Copy failed:",t)}})}function Ye(){k.value=!k.value}function Te(t){g.value=t==="source"}const $e=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],qe=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function Xe(t){if(!t)return"";const e=t.trim();return qe.test(e)?e:""}function Ae(){j.value="",ae.value=""}function q(t){return _||t!==re.value}function Ge(){return ye(this,null,function*(){var t,e,o,c,H;if(!ke||_||!O.value||n.loading&&!n.progressiveRender)return;const S=se.value;if(S===P.value&&!s.value&&ne.value)return h.value=!0,void(n.loading&&(g.value=!1));const V=F.value;if(!V)return Ae(),s.value=null,P.value="",void(R.value="");const G=++re.value;W.value=!0,s.value=null,R.value="",(function(){const r=Re.value;w&&r&&C!==r&&(C&&w.markSettled(C),C=r,w.markPending(r))})();try{const r=yield(function(){return ye(this,null,function*(){if(x)return x;const l=yield ht();if(_||!l)return null;if(typeof l=="function"){const Q=new l;return Q&&typeof Q.compile=="function"?x=Q:typeof l.compile=="function"&&(x=l),x}return l?.D2&&typeof l.D2=="function"?(x=new l.D2,x):(typeof l.compile=="function"&&(x=l),x)})})();if(q(G))return;if(!r)return h.value=!1,g.value=!0,Ae(),s.value="D2 is not available.",void(R.value=S);if(typeof r.compile!="function"||typeof r.render!="function")throw new TypeError("D2 instance is missing compile/render methods.");h.value=!0;const y=yield r.compile(V);if(q(G))return;const le=(t=y?.diagram)!=null?t:y,B=(o=(e=y?.renderOptions)!=null?e:y?.options)!=null?o:{},Qe=(c=n.themeId)!=null?c:B.themeID,je=(H=n.darkThemeId)!=null?H:B.darkThemeID,J=he({},B);if(J.themeID=n.isDark&&je!=null?je:Qe,J.darkThemeID=null,J.darkThemeOverrides=null,n.isDark){const l=B.themeOverrides&&typeof B.themeOverrides=="object"?B.themeOverrides:null;J.themeOverrides=he(he({},Ve),l||{})}const Ke=yield r.render(le,J);if(q(G))return;const Oe=(function(l){return l?typeof l=="string"?l:typeof l.svg=="string"?l.svg:typeof l.data=="string"?l.data:"":""})(Ke);if(!Oe)throw new Error("D2 render returned empty output.");(function(l,Q){const Fe=(function(Ie){if(typeof window>"u"||typeof DOMParser>"u"||!Ie)return"";const Ze=Ie.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),ve=new DOMParser().parseFromString(Ze,"image/svg+xml").documentElement;if(!ve||ve.nodeName.toLowerCase()!=="svg")return"";const me=ve;return(function(He){const We=new Set(["script"]),et=[He,...Array.from(He.querySelectorAll("*"))];for(const L of et){if(We.has(L.tagName.toLowerCase())){L.remove();continue}const tt=Array.from(L.attributes);for(const z of tt){const E=z.name;if(/^on/i.test(E))L.removeAttribute(E);else{if(E==="style"&&z.value){const K=z.value;if($e.some(nt=>nt.test(K))){L.removeAttribute(E);continue}}if((E==="href"||E==="xlink:href")&&z.value){const K=Xe(z.value);if(!K){L.removeAttribute(E);continue}K!==z.value&&L.setAttribute(E,K)}}}}})(me),me.classList.add("markstream-d2-root-svg"),me.outerHTML})(l);j.value=Fe||"",ae.value=Fe?Q:""})(Oe,S),P.value=S,R.value="",n.loading&&(g.value=!1),s.value=null}catch(r){if(q(G))return;const y=r?.message?String(r.message):"D2 render failed.";n.loading||(s.value=y,R.value=S),P.value="",y.includes("@terrastruct/d2")&&(h.value=!1,g.value=!0)}finally{q(G)||(W.value=!1,I?(I=!1,X()):(function(){const r=C;w&&r&&(C="",fe(()=>{var y,le;if(!_){const B=(le=(y=ie.value)==null?void 0:y.offsetHeight)!=null?le:0;B>0&&w.reportHeight(r,B)}w.markSettled(r)}))})())}})}function X(t=!1){if(ce||!ke||_)return;if(W.value)return void(I=!0);const e=Math.max(120,Number(n.progressiveIntervalMs)||0),o=Date.now()-Ce;if(!t&&o{U=null,I&&(I=!1,X(!0))},Math.max(0,e-o))));ce=!0;const c=()=>{ce=!1,Ce=Date.now(),Ge()};typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame(c):setTimeout(c,0)}function Je(){if(ne.value)try{const t=new Blob([j.value],{type:"image/svg+xml;charset=utf-8"}),e=URL.createObjectURL(t);if(typeof document<"u"){const o=document.createElement("a");o.href=e,o.download=`d2-diagram-${Date.now()}.svg`,document.body.appendChild(o),o.click(),document.body.removeChild(o)}URL.revokeObjectURL(e)}catch(t){console.error("Failed to export SVG:",t)}}function de(){const t=ee.value;if(!t)return;const e=t.getBoundingClientRect().height;e>0&&(ue.value=e)}return Z(()=>[n.node.code,n.loading,n.isDark,n.themeId,n.darkThemeId],()=>{X()},{immediate:!0}),Z(()=>n.loading,(t,e)=>{e&&!t&&X(!0)}),Z(()=>O.value,t=>{t&&X(!0)}),Z(()=>[oe.value,j.value,F.value],()=>{fe(()=>{de()})}),vt(()=>{xe.value=!0,fe(()=>{de()}),typeof ResizeObserver<"u"&&($=new ResizeObserver(()=>{de()}),ee.value&&$.observe(ee.value))}),mt(()=>{var t;_=!0,re.value+=1,I=!1,(function(){const e=C;w&&e&&(C="",w.markSettled(e))})(),P.value="",(t=Y.value)==null||t.destroy(),Y.value=null,U!=null&&(clearTimeout(U),U=null),$?.disconnect(),$=null}),(t,e)=>(v(),m("div",{ref_key:"viewportTarget",ref:ie,class:pe(["d2-block-container rounded-lg border overflow-hidden",{dark:n.isDark}]),"data-markstream-d2":"1","data-markstream-mode":oe.value?"fallback":"preview","data-markstream-pending":Be.value?"true":void 0},[n.showHeader?(v(),m("div",Bt,[e[16]||(e[16]=u("div",{class:"flex items-center gap-x-2"},[u("span",{class:"d2-label font-medium font-mono"},"D2")],-1)),u("div",Dt,[n.showModeToggle?(v(),m("div",Ct,[u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"":"is-active"]),onClick:e[0]||(e[0]=o=>Te("preview")),onMouseenter:e[1]||(e[1]=o=>M(o,f(a)("common.preview")||"Preview")),onFocus:e[2]||(e[2]=o=>M(o,f(a)("common.preview")||"Preview")),onMouseleave:b,onBlur:b},N(f(a)("common.preview")||"Preview"),35),u("button",{type:"button",class:pe(["mode-btn px-2 py-0.5 rounded",g.value?"is-active":""]),onClick:e[3]||(e[3]=o=>Te("source")),onMouseenter:e[4]||(e[4]=o=>M(o,f(a)("common.source")||"Source")),onFocus:e[5]||(e[5]=o=>M(o,f(a)("common.source")||"Source")),onMouseleave:b,onBlur:b},N(f(a)("common.source")||"Source"),35)])):T("",!0),n.showCopyButton?(v(),m("button",{key:1,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":A.value?f(a)("common.copied")||"Copied":f(a)("common.copy")||"Copy",onClick:ze,onMouseenter:e[6]||(e[6]=o=>Ee(o)),onFocus:e[7]||(e[7]=o=>Ee(o)),onMouseleave:b,onBlur:b},[A.value?(v(),m("svg",Tt,[...e[13]||(e[13]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M20 6L9 17l-5-5"},null,-1)])])):(v(),m("svg",Et,[...e[12]||(e[12]=[u("g",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},[u("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),u("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"})],-1)])]))],40,Mt)):T("",!0),n.showExportButton&&ne.value?(v(),m("button",{key:2,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-label":f(a)("common.export")||"Export",onClick:Je,onMouseenter:e[8]||(e[8]=o=>M(o,f(a)("common.export")||"Export")),onFocus:e[9]||(e[9]=o=>M(o,f(a)("common.export")||"Export")),onMouseleave:b,onBlur:b},[...e[14]||(e[14]=[u("svg",{xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v12m0-12l-4 4m4-4l4 4M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"})],-1)])],40,At)):T("",!0),n.showCollapseButton?(v(),m("button",{key:3,type:"button",class:"d2-action-btn p-[var(--ms-action-btn-padding)] rounded-md","aria-pressed":k.value,onClick:Ye,onMouseenter:e[10]||(e[10]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onFocus:e[11]||(e[11]=o=>M(o,k.value?f(a)("common.expand")||"Expand":f(a)("common.collapse")||"Collapse")),onMouseleave:b,onBlur:b},[(v(),m("svg",{style:ge({rotate:k.value?"0deg":"90deg"}),xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",role:"img",width:"1em",height:"1em",viewBox:"0 0 24 24",class:"action-icon"},[...e[15]||(e[15]=[u("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m9 18l6-6l-6-6"},null,-1)])],4))],40,jt)):T("",!0)])])):T("",!0),ft(u("div",{ref_key:"bodyRef",ref:ee,class:"d2-block-body",style:ge(_e.value)},[n.loading&&!De.value?(v(),m("div",Ot,[u("pre",Ft,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",It,N(s.value),1)):T("",!0)])):(v(),m("div",Ht,[oe.value?(v(),m("div",St,[u("pre",Lt,[u("code",null,N(F.value),1)]),s.value?(v(),m("p",Nt,N(s.value),1)):T("",!0)])):(v(),m("div",{key:1,class:"d2-render",style:ge(Ue.value)},[u("div",{class:"d2-svg",innerHTML:j.value},null,8,Pt),s.value?(v(),m("p",Rt,N(s.value),1)):T("",!0)],4))]))],4),[[pt,!k.value]])],10,xt))}}),[["__scopeId","data-v-3b434cf5"]]);we.install=p=>{p.component(we.__name,we)};export{we as default}; diff --git a/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js b/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-Dpbgmc1e.js similarity index 69% rename from apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js rename to apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-Dpbgmc1e.js index a37e1ec6400..1c557615624 100644 --- a/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-DASw56fH.js +++ b/apps/kimi-code/dist-web/assets/infoDiagram-FWYZ7A6U-Dpbgmc1e.js @@ -1,2 +1,2 @@ -import{_ as a,l as s,F as n,e as i}from"./mermaid.core-CJB1tAev.js";import{p}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var g={parse:a(async r=>{const e=await p("info",r);s.debug(e)},"parse")},v={version:"11.16.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,o)=>{s.debug(`rendering info diagram +import{_ as a,l as s,F as n,e as i}from"./mermaid.core-CsZwh_jB.js";import{p}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var g={parse:a(async r=>{const e=await p("info",r);s.debug(e)},"parse")},v={version:"11.16.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,o)=>{s.debug(`rendering info diagram `+r);const t=n(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${o}`)},"draw"),l={draw:c},w={parser:g,db:m,renderer:l};export{w as diagram}; diff --git a/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js b/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BA2yx5LI.js similarity index 99% rename from apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js rename to apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BA2yx5LI.js index 45e219b383b..1dfd25bab31 100644 --- a/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js +++ b/apps/kimi-code/dist-web/assets/ishikawaDiagram-FXEZZL3T-BA2yx5LI.js @@ -1,4 +1,4 @@ -import{_ as l,c as lt,a1 as ct,F as ut,al as dt,q as yt,k as ft,o as et,a as pt,b as gt,g as kt,s as mt,p as wt,e as _t}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var Q=(function(){var t=l(function(T,e,s,i){for(s=s||{},i=T.length;i--;s[T[i]]=e);return s},"o"),d=[1,4],n=[1,14],a=[1,12],o=[1,13],y=[6,7,8],p=[1,20],u=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],D={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:l(function(e,s,i,h,f,r,v){var w=r.length-1;switch(f){case 6:case 7:return h;case 15:h.addNode(r[w-1].length,r[w].trim());break;case 16:h.addNode(0,r[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:d},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:d},{6:n,7:[1,10],9:9,12:11,13:a,14:o},t(y,[2,3]),{1:[2,2]},t(y,[2,4]),t(y,[2,5]),{1:[2,6],6:n,12:15,13:a,14:o},{6:n,9:16,12:11,13:a,14:o},{6:p,7:u,10:17,11:m},t(c,[2,18],{14:[1,21]}),t(c,[2,16]),t(c,[2,17]),{6:p,7:u,10:22,11:m},{1:[2,7],6:n,12:15,13:a,14:o},t(k,[2,14],{7:g,11:_}),t(x,[2,8]),t(x,[2,9]),t(x,[2,10]),t(c,[2,15]),t(k,[2,13],{7:g,11:_}),t(x,[2,11]),t(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(e,s){if(s.recoverable)this.trace(e);else{var i=new Error(e);throw i.hash=s,i}},"parseError"),parse:l(function(e){var s=this,i=[0],h=[],f=[null],r=[],v=this.table,w="",I=0,$=0,L=2,A=1,C=r.slice.call(arguments,1),b=Object.create(this.lexer),S={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(S.yy[P]=this.yy[P]);b.setInput(e,S.yy),S.yy.lexer=b,S.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var R=b.yylloc;r.push(R);var H=b.options&&b.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(B){i.length=i.length-2*B,f.length=f.length-B,r.length=r.length-B}l(X,"popStack");function J(){var B;return B=h.pop()||b.lex()||A,typeof B!="number"&&(B instanceof Array&&(h=B,B=h.pop()),B=s.symbols_[B]||B),B}l(J,"lex");for(var M,F,N,Y,W={},G,V,tt,U;;){if(F=i[i.length-1],this.defaultActions[F]?N=this.defaultActions[F]:((M===null||typeof M>"u")&&(M=J()),N=v[F]&&v[F][M]),typeof N>"u"||!N.length||!N[0]){var q="";U=[];for(G in v[F])this.terminals_[G]&&G>L&&U.push("'"+this.terminals_[G]+"'");b.showPosition?q="Parse error on line "+(I+1)+`: +import{_ as l,c as lt,a1 as ct,F as ut,al as dt,q as yt,k as ft,o as et,a as pt,b as gt,g as kt,s as mt,p as wt,e as _t}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var Q=(function(){var t=l(function(T,e,s,i){for(s=s||{},i=T.length;i--;s[T[i]]=e);return s},"o"),d=[1,4],n=[1,14],a=[1,12],o=[1,13],y=[6,7,8],p=[1,20],u=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],D={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:l(function(e,s,i,h,f,r,v){var w=r.length-1;switch(f){case 6:case 7:return h;case 15:h.addNode(r[w-1].length,r[w].trim());break;case 16:h.addNode(0,r[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:d},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:d},{6:n,7:[1,10],9:9,12:11,13:a,14:o},t(y,[2,3]),{1:[2,2]},t(y,[2,4]),t(y,[2,5]),{1:[2,6],6:n,12:15,13:a,14:o},{6:n,9:16,12:11,13:a,14:o},{6:p,7:u,10:17,11:m},t(c,[2,18],{14:[1,21]}),t(c,[2,16]),t(c,[2,17]),{6:p,7:u,10:22,11:m},{1:[2,7],6:n,12:15,13:a,14:o},t(k,[2,14],{7:g,11:_}),t(x,[2,8]),t(x,[2,9]),t(x,[2,10]),t(c,[2,15]),t(k,[2,13],{7:g,11:_}),t(x,[2,11]),t(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(e,s){if(s.recoverable)this.trace(e);else{var i=new Error(e);throw i.hash=s,i}},"parseError"),parse:l(function(e){var s=this,i=[0],h=[],f=[null],r=[],v=this.table,w="",I=0,$=0,L=2,A=1,C=r.slice.call(arguments,1),b=Object.create(this.lexer),S={yy:{}};for(var P in this.yy)Object.prototype.hasOwnProperty.call(this.yy,P)&&(S.yy[P]=this.yy[P]);b.setInput(e,S.yy),S.yy.lexer=b,S.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var R=b.yylloc;r.push(R);var H=b.options&&b.options.ranges;typeof S.yy.parseError=="function"?this.parseError=S.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(B){i.length=i.length-2*B,f.length=f.length-B,r.length=r.length-B}l(X,"popStack");function J(){var B;return B=h.pop()||b.lex()||A,typeof B!="number"&&(B instanceof Array&&(h=B,B=h.pop()),B=s.symbols_[B]||B),B}l(J,"lex");for(var M,F,N,Y,W={},G,V,tt,U;;){if(F=i[i.length-1],this.defaultActions[F]?N=this.defaultActions[F]:((M===null||typeof M>"u")&&(M=J()),N=v[F]&&v[F][M]),typeof N>"u"||!N.length||!N[0]){var q="";U=[];for(G in v[F])this.terminals_[G]&&G>L&&U.push("'"+this.terminals_[G]+"'");b.showPosition?q="Parse error on line "+(I+1)+`: `+b.showPosition()+` Expecting `+U.join(", ")+", got '"+(this.terminals_[M]||M)+"'":q="Parse error on line "+(I+1)+": Unexpected "+(M==A?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(q,{text:b.match,token:this.terminals_[M]||M,line:b.yylineno,loc:R,expected:U})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+F+", token: "+M);switch(N[0]){case 1:i.push(M),f.push(b.yytext),r.push(b.yylloc),i.push(N[1]),M=null,$=b.yyleng,w=b.yytext,I=b.yylineno,R=b.yylloc;break;case 2:if(V=this.productions_[N[1]][1],W.$=f[f.length-V],W._$={first_line:r[r.length-(V||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(V||1)].first_column,last_column:r[r.length-1].last_column},H&&(W._$.range=[r[r.length-(V||1)].range[0],r[r.length-1].range[1]]),Y=this.performAction.apply(W,[w,$,I,S.yy,N[1],f,r].concat(C)),typeof Y<"u")return Y;V&&(i=i.slice(0,-1*V*2),f=f.slice(0,-1*V),r=r.slice(0,-1*V)),i.push(this.productions_[N[1]][0]),f.push(W.$),r.push(W._$),tt=v[i[i.length-2]][i[i.length-1]],i.push(tt);break;case 3:return!0}}return!0},"parse")},O=(function(){var T={EOF:1,parseError:l(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:l(function(e,s){return this.yy=s||this.yy||{},this._input=e,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var s=e.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},"input"),unput:l(function(e){var s=e.length,i=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var h=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===h.length?this.yylloc.first_column:0)+h[h.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(e){this.unput(this.match.slice(e))},"less"),pastInput:l(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var e=this.pastInput(),s=new Array(e.length+1).join("-");return e+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js b/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DCwR4Nt_.js similarity index 98% rename from apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js rename to apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DCwR4Nt_.js index 81454d20249..a645b4aca35 100644 --- a/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-BShuBRgf.js +++ b/apps/kimi-code/dist-web/assets/journeyDiagram-5HDEW3XC-DCwR4Nt_.js @@ -1,4 +1,4 @@ -import{g as gt}from"./chunk-5VM5RSS4-yyj9cAyF.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-32BRIVSS-DUDRPqmY.js";import{g as _t,s as vt,a as bt,b as wt,p as Tt,o as St,_ as s,c as R,d as X,e as $t,q as Mt}from"./mermaid.core-CJB1tAev.js";import{d as it}from"./arc-IkhU3FHH.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: +import{g as gt}from"./chunk-5VM5RSS4-CqIxm4fU.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-32BRIVSS-DNJ_Bmzz.js";import{g as _t,s as vt,a as bt,b as wt,p as Tt,o as St,_ as s,c as R,d as X,e as $t,q as Mt}from"./mermaid.core-CsZwh_jB.js";import{d as it}from"./arc-HTdwJ95y.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var U=(function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var H="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?H="Parse error on line "+(C+1)+`: `+_.showPosition()+` Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":H="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(H,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js b/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-CArc2b0u.js similarity index 99% rename from apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js rename to apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-CArc2b0u.js index a53d9abeab9..dbfb39933c1 100644 --- a/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-_UoHLqzR.js +++ b/apps/kimi-code/dist-web/assets/kanban-definition-HUTT4EX6-CArc2b0u.js @@ -1,4 +1,4 @@ -import{_ as o,l as te,c as H,F as fe,af as ye,ag as be,ah as me,ad as _e,D as Y,i as j,Y as ke,Z as Ee,aa as Se,ab as ce,ac as le}from"./mermaid.core-CJB1tAev.js";import{g as Ne}from"./chunk-5VM5RSS4-yyj9cAyF.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var $=(function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),h=[1,4],p=[1,13],s=[1,12],d=[1,15],_=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],k=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,u,t,U){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(k,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(k,[2,19]),e(k,[2,21],{15:30,24:G}),e(k,[2,22]),e(k,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(k,[2,16],{15:37,24:G}),e(k,[2,17]),e(k,[2,18]),e(k,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(k,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],u=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(i,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Z=b.yylloc;t.push(Z);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var E,P,x,q,F={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=ae()),x=U[P]&&U[P][E]),typeof x>"u"||!x.length||!x[0]){var Q="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Q="Parse error on line "+(W+1)+`: +import{_ as o,l as te,c as H,F as fe,af as ye,ag as be,ah as me,ad as _e,D as Y,i as j,Y as ke,Z as Ee,aa as Se,ab as ce,ac as le}from"./mermaid.core-CsZwh_jB.js";import{g as Ne}from"./chunk-5VM5RSS4-CqIxm4fU.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var $=(function(){var e=o(function(O,i,n,r){for(n=n||{},r=O.length;r--;n[O[r]]=i);return n},"o"),h=[1,4],p=[1,13],s=[1,12],d=[1,15],_=[1,16],m=[1,20],l=[1,19],D=[6,7,8],I=[1,26],g=[1,24],w=[1,25],k=[6,7,11],G=[1,31],N=[6,7,11,24],V=[1,6,13,16,17,20,23],f=[1,35],A=[1,36],L=[1,6,7,11,13,16,17,20,23],M=[1,38],T={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:o(function(i,n,r,a,u,t,U){var c=t.length-1;switch(u){case 6:case 7:return a;case 8:a.getLogger().trace("Stop NL ");break;case 9:a.getLogger().trace("Stop EOF ");break;case 11:a.getLogger().trace("Stop NL2 ");break;case 12:a.getLogger().trace("Stop EOF2 ");break;case 15:a.getLogger().info("Node: ",t[c-1].id),a.addNode(t[c-2].length,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 16:a.getLogger().info("Node: ",t[c].id),a.addNode(t[c-1].length,t[c].id,t[c].descr,t[c].type);break;case 17:a.getLogger().trace("Icon: ",t[c]),a.decorateNode({icon:t[c]});break;case 18:case 23:a.decorateNode({class:t[c]});break;case 19:a.getLogger().trace("SPACELIST");break;case 20:a.getLogger().trace("Node: ",t[c-1].id),a.addNode(0,t[c-1].id,t[c-1].descr,t[c-1].type,t[c]);break;case 21:a.getLogger().trace("Node: ",t[c].id),a.addNode(0,t[c].id,t[c].descr,t[c].type);break;case 22:a.decorateNode({icon:t[c]});break;case 27:a.getLogger().trace("node found ..",t[c-2]),this.$={id:t[c-1],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 28:this.$={id:t[c],descr:t[c],type:0};break;case 29:a.getLogger().trace("node found ..",t[c-3]),this.$={id:t[c-3],descr:t[c-1],type:a.getType(t[c-2],t[c])};break;case 30:this.$=t[c-1]+t[c];break;case 31:this.$=t[c];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:p,7:[1,10],9:9,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(D,[2,3]),{1:[2,2]},e(D,[2,4]),e(D,[2,5]),{1:[2,6],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:p,9:22,12:11,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},{6:I,7:g,10:23,11:w},e(k,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:m,23:l}),e(k,[2,19]),e(k,[2,21],{15:30,24:G}),e(k,[2,22]),e(k,[2,23]),e(N,[2,25]),e(N,[2,26]),e(N,[2,28],{20:[1,32]}),{21:[1,33]},{6:I,7:g,10:34,11:w},{1:[2,7],6:p,12:21,13:s,14:14,16:d,17:_,18:17,19:18,20:m,23:l},e(V,[2,14],{7:f,11:A}),e(L,[2,8]),e(L,[2,9]),e(L,[2,10]),e(k,[2,16],{15:37,24:G}),e(k,[2,17]),e(k,[2,18]),e(k,[2,20],{24:M}),e(N,[2,31]),{21:[1,39]},{22:[1,40]},e(V,[2,13],{7:f,11:A}),e(L,[2,11]),e(L,[2,12]),e(k,[2,15],{24:M}),e(N,[2,30]),{22:[1,41]},e(N,[2,27]),e(N,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(i,n){if(n.recoverable)this.trace(i);else{var r=new Error(i);throw r.hash=n,r}},"parseError"),parse:o(function(i){var n=this,r=[0],a=[],u=[null],t=[],U=this.table,c="",W=0,se=0,ue=2,re=1,ge=t.slice.call(arguments,1),b=Object.create(this.lexer),R={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(R.yy[J]=this.yy[J]);b.setInput(i,R.yy),R.yy.lexer=b,R.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var Z=b.yylloc;t.push(Z);var de=b.options&&b.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){r.length=r.length-2*S,u.length=u.length-S,t.length=t.length-S}o(pe,"popStack");function ae(){var S;return S=a.pop()||b.lex()||re,typeof S!="number"&&(S instanceof Array&&(a=S,S=a.pop()),S=n.symbols_[S]||S),S}o(ae,"lex");for(var E,P,x,q,F={},z,C,oe,X;;){if(P=r[r.length-1],this.defaultActions[P]?x=this.defaultActions[P]:((E===null||typeof E>"u")&&(E=ae()),x=U[P]&&U[P][E]),typeof x>"u"||!x.length||!x[0]){var Q="";X=[];for(z in U[P])this.terminals_[z]&&z>ue&&X.push("'"+this.terminals_[z]+"'");b.showPosition?Q="Parse error on line "+(W+1)+`: `+b.showPosition()+` Expecting `+X.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Q="Parse error on line "+(W+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[E]||E,line:b.yylineno,loc:Z,expected:X})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+E);switch(x[0]){case 1:r.push(E),u.push(b.yytext),t.push(b.yylloc),r.push(x[1]),E=null,se=b.yyleng,c=b.yytext,W=b.yylineno,Z=b.yylloc;break;case 2:if(C=this.productions_[x[1]][1],F.$=u[u.length-C],F._$={first_line:t[t.length-(C||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(C||1)].first_column,last_column:t[t.length-1].last_column},de&&(F._$.range=[t[t.length-(C||1)].range[0],t[t.length-1].range[1]]),q=this.performAction.apply(F,[c,se,W,R.yy,x[1],u,t].concat(ge)),typeof q<"u")return q;C&&(r=r.slice(0,-1*C*2),u=u.slice(0,-1*C),t=t.slice(0,-1*C)),r.push(this.productions_[x[1]][0]),u.push(F.$),t.push(F._$),oe=U[r[r.length-2]][r[r.length-1]],r.push(oe);break;case 3:return!0}}return!0},"parse")},K=(function(){var O={EOF:1,parseError:o(function(n,r){if(this.yy.parser)this.yy.parser.parseError(n,r);else throw new Error(n)},"parseError"),setInput:o(function(i,n){return this.yy=n||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var n=i.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:o(function(i){var n=i.length,r=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),r.length-1&&(this.yylineno-=r.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:r?(r.length===a.length?this.yylloc.first_column:0)+a[a.length-r.length].length-r[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(i){this.unput(this.match.slice(i))},"less"),pastInput:o(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var i=this.pastInput(),n=new Array(i.length+1).join("-");return i+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/linear-DH49UJnN.js b/apps/kimi-code/dist-web/assets/linear-CV4KY8w2.js similarity index 98% rename from apps/kimi-code/dist-web/assets/linear-DH49UJnN.js rename to apps/kimi-code/dist-web/assets/linear-CV4KY8w2.js index e3bd183a14b..6a0941b48f9 100644 --- a/apps/kimi-code/dist-web/assets/linear-DH49UJnN.js +++ b/apps/kimi-code/dist-web/assets/linear-CV4KY8w2.js @@ -1 +1 @@ -import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core-CJB1tAev.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; +import{b9 as j,ba as p,bb as w,bc as k,bd as q}from"./mermaid.core-CsZwh_jB.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:nr?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:rn?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i>>1;t(o[l],c)<0?i=l+1:h=l}while(i>>1;t(o[l],c)<=0?i=l+1:h=l}while(ii&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/ir&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*ir&&--c),c0))return[];if(n===r)return[n];const e=r=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;ir&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t}; diff --git a/apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js b/apps/kimi-code/dist-web/assets/mermaid.core-CsZwh_jB.js similarity index 99% rename from apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js rename to apps/kimi-code/dist-web/assets/mermaid.core-CsZwh_jB.js index 9cd1ef69115..a360de0425f 100644 --- a/apps/kimi-code/dist-web/assets/mermaid.core-CJB1tAev.js +++ b/apps/kimi-code/dist-web/assets/mermaid.core-CsZwh_jB.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dagre-VKFMJZFB-D8gdq5tS.js","assets/chunk-RYQCIY6F-Df2V79id.js","assets/graph-DOmOIIwC.js","assets/map-DxJ2ADlA.js","assets/layout-D-LzfAck.js","assets/index-D-7nOosq.js","assets/index-DGHD7Bg9.css","assets/_commonjsHelpers-CqkleIqs.js","assets/swimlanes-5IMT3BWC-D6xMtJ1E.js","assets/cose-bilkent-JH36ORCC-TWQPJk-P.js","assets/cytoscape.esm-OyMbaexL.js","assets/c4Diagram-LMCZKHZV-CUyKVoVi.js","assets/chunk-32BRIVSS-DUDRPqmY.js","assets/flowDiagram-23GEKE2U-CzI-GKO4.js","assets/chunk-5VM5RSS4-yyj9cAyF.js","assets/chunk-XXDRQBXY-5rh7CWvm.js","assets/chunk-VR4S4FIN-CEH7JYJn.js","assets/channel-xkK6nTGq.js","assets/swimlanesDiagram-G3AALYLV-DKIx012r.js","assets/erDiagram-Q63AITRT-DVzumNgk.js","assets/gitGraphDiagram-IHSO6WYX-D7UBC8np.js","assets/chunk-2Q5K7J3B-DsAC7dRk.js","assets/chunk-JWPE2WC7-Dsg3gA8l.js","assets/cynefin-VYW2F7L2-BIlq342y.js","assets/ganttDiagram-NO4QXBWP-B2lfrNfh.js","assets/linear-DH49UJnN.js","assets/init-Gi6I4Gst.js","assets/defaultLocale-DX6XiGOO.js","assets/infoDiagram-FWYZ7A6U-DASw56fH.js","assets/pieDiagram-ENE6RG2P-f3F4At6v.js","assets/arc-IkhU3FHH.js","assets/ordinal-Cboi1Yqb.js","assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js","assets/xychartDiagram-FW5EYKEG-yQImOWPy.js","assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js","assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js","assets/classDiagram-OUVF2IWQ-ClMG95L0.js","assets/chunk-V7JOEXUC-B4q9plWN.js","assets/classDiagram-v2-EOCWNBFH-ClMG95L0.js","assets/stateDiagram-2N3HPSRC-GIVsAB2M.js","assets/chunk-EX3LRPZG-BCWDroXJ.js","assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js","assets/journeyDiagram-5HDEW3XC-BShuBRgf.js","assets/timeline-definition-FHXFAJF6-5u0AN8o0.js","assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js","assets/kanban-definition-HUTT4EX6-_UoHLqzR.js","assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js","assets/diagram-NH7WQ7WH-DUn2m-AO.js","assets/diagram-WEI45ONY-CFwFRAWa.js","assets/blockDiagram-677ZJIJ3-BNXb88Fr.js","assets/diagram-OA4YK3LP-BOIp7TNe.js","assets/architectureDiagram-ZJ3FMSHR-CBluWNBt.js","assets/diagram-FQU43EPY-D2bRXH1a.js","assets/ishikawaDiagram-FXEZZL3T-CcPuml-k.js","assets/vennDiagram-L72KCM5P-ozNTLnJz.js","assets/diagram-G47NLZAW-BF9x_uf7.js","assets/wardleyDiagram-EHGQE667-BuQJYWm-.js","assets/cynefinDiagram-TSTJHNR4-zQaCQNIP.js","assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js","assets/chunk-MOJQB5TN-JQ2kJR9W.js","assets/ebnfDiagram-CCIWWBDH-B4NTctc_.js","assets/abnfDiagram-VRR7QNED-C0Afmuc1.js","assets/pegDiagram-2B236MQR-_6D7zUy-.js"])))=>i.map(i=>d[i]); -import{bR as nt}from"./index-D-7nOosq.js";import{g as gy}from"./_commonjsHelpers-CqkleIqs.js";var _c=Object.defineProperty,p=(e,t)=>_c(e,"name",{value:t,configurable:!0}),my=(e,t)=>{for(var r in t)_c(e,r,{get:t[r],enumerable:!0})},So={exports:{}},yy=So.exports,zl;function Cy(){return zl||(zl=1,(function(e,t){(function(r,i){e.exports=i()})(yy,(function(){var r=1e3,i=6e4,o=36e5,s="millisecond",a="second",n="minute",l="hour",c="day",h="week",d="month",f="quarter",u="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var A=["th","st","nd","rd"],F=$%100;return"["+$+(A[(F-20)%10]||A[F]||A[0])+"]"}},k=function($,A,F){var D=String($);return!D||D.length>=A?$:""+Array(A+1-D.length).join(F)+$},T={s:k,z:function($){var A=-$.utcOffset(),F=Math.abs(A),D=Math.floor(F/60),M=F%60;return(A<=0?"+":"-")+k(D,2,"0")+":"+k(M,2,"0")},m:function $(A,F){if(A.date()1)return $(Y[0])}else{var G=A.name;_[G]=A,M=G}return!D&&M&&(S=M),M||!D&&S},R=function($,A){if(v($))return $.clone();var F=typeof A=="object"?A:{};return F.date=$,F.args=arguments,new z(F)},P=T;P.l=N,P.i=v,P.w=function($,A){return R($,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var z=(function(){function $(F){this.$L=N(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[L]=!0}var A=$.prototype;return A.parse=function(F){this.$d=(function(D){var M=D.date,H=D.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(y);if(Y){var G=Y[2]-1||0,lt=(Y[7]||"0").substring(0,3);return H?new Date(Date.UTC(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)):new Date(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)}}return new Date(M)})(F),this.init()},A.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},A.$utils=function(){return P},A.isValid=function(){return this.$d.toString()!==m},A.isSame=function(F,D){var M=R(F);return this.startOf(D)<=M&&M<=this.endOf(D)},A.isAfter=function(F,D){return R(F){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Cn=p(function(e="fatal"){let t=Ne.fatal;typeof e=="string"?e.toLowerCase()in Ne&&(t=Ne[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=Ne.fatal&&(q.fatal=console.error?console.error.bind(console,he("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",he("FATAL"))),t<=Ne.error&&(q.error=console.error?console.error.bind(console,he("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",he("ERROR"))),t<=Ne.warn&&(q.warn=console.warn?console.warn.bind(console,he("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",he("WARN"))),t<=Ne.info&&(q.info=console.info?console.info.bind(console,he("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",he("INFO"))),t<=Ne.debug&&(q.debug=console.debug?console.debug.bind(console,he("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("DEBUG"))),t<=Ne.trace&&(q.trace=console.debug?console.debug.bind(console,he("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("TRACE")))},"setLogLevel"),he=p(e=>`%c${by().format("ss.SSS")} : ${e} : `,"format");const _o={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const o=r<.5?r*(1+t):r+t-r*t,s=2*r-o;switch(i){case"r":return _o.hue2rgb(s,o,e+1/3)*255;case"g":return _o.hue2rgb(s,o,e)*255;case"b":return _o.hue2rgb(s,o,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const o=Math.max(e,t,r),s=Math.min(e,t,r),a=(o+s)/2;if(i==="l")return a*100;if(o===s)return 0;const n=o-s,l=a>.5?n/(2-o-s):n/(o+s);if(i==="s")return l*100;switch(o){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},wy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},at={channel:_o,lang:ky,unit:wy},Je={};for(let e=0;e<=255;e++)Je[e]=at.unit.dec2hex(e);const Gt={ALL:0,RGB:1,HSL:2};class Ty{constructor(){this.type=Gt.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Gt.ALL}is(t){return this.type===t}}class Sy{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Ty}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Gt.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:o}=t;r===void 0&&(t.h=at.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=at.channel.rgb2hsl(t,"s")),o===void 0&&(t.l=at.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:o}=t;r===void 0&&(t.r=at.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=at.channel.hsl2rgb(t,"g")),o===void 0&&(t.b=at.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Gt.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Gt.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Gt.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Gt.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Gt.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Gt.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const gs=new Sy({r:0,g:0,b:0,a:0},"transparent"),Xr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Xr.re);if(!t)return;const r=t[1],i=parseInt(r,16),o=r.length,s=o%4===0,a=o>4,n=a?1:17,l=a?8:4,c=s?0:-1,h=a?255:15;return gs.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:s?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}${Je[Math.round(o*255)]}`:`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}`}},Cr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Cr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return at.channel.clamp.h(parseFloat(r)*.9);case"rad":return at.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return at.channel.clamp.h(parseFloat(r)*360)}}return at.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Cr.re);if(!r)return;const[,i,o,s,a,n]=r;return gs.set({h:Cr._hue2deg(i),s:at.channel.clamp.s(parseFloat(o)),l:at.channel.clamp.l(parseFloat(s)),a:a?at.channel.clamp.a(n?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:o}=e;return o<1?`hsla(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%, ${o})`:`hsl(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%)`}},Ei={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Ei.colors[e];if(t)return Xr.parse(t)},stringify:e=>{const t=Xr.stringify(e);for(const r in Ei.colors)if(Ei.colors[r]===t)return r}},wi={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(wi.re);if(!r)return;const[,i,o,s,a,n,l,c,h]=r;return gs.set({r:at.channel.clamp.r(o?parseFloat(i)*2.55:parseFloat(i)),g:at.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:at.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?at.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`rgba(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)}, ${at.lang.round(o)})`:`rgb(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)})`}},Ee={format:{keyword:Ei,hex:Xr,rgb:wi,rgba:wi,hsl:Cr,hsla:Cr},parse:e=>{if(typeof e!="string")return e;const t=Xr.parse(e)||wi.parse(e)||Cr.parse(e)||Ei.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Gt.HSL)||e.data.r===void 0?Cr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?wi.stringify(e):Xr.stringify(e)},Bc=(e,t)=>{const r=Ee.parse(e);for(const i in t)r[i]=at.channel.clamp[i](t[i]);return Ee.stringify(r)},or=(e,t,r=0,i=1)=>{if(typeof e!="number")return Bc(e,{a:t});const o=gs.set({r:at.channel.clamp.r(e),g:at.channel.clamp.g(t),b:at.channel.clamp.b(r),a:at.channel.clamp.a(i)});return Ee.stringify(o)},_y=e=>{const{r:t,g:r,b:i}=Ee.parse(e),o=.2126*at.channel.toLinear(t)+.7152*at.channel.toLinear(r)+.0722*at.channel.toLinear(i);return at.lang.round(o)},By=e=>_y(e)>=.5,ke=e=>!By(e),vc=(e,t,r)=>{const i=Ee.parse(e),o=i[t],s=at.channel.clamp[t](o+r);return o!==s&&(i[t]=s),Ee.stringify(i)},O=(e,t)=>vc(e,"l",t),I=(e,t)=>vc(e,"l",-t),x=(e,t)=>{const r=Ee.parse(e),i={};for(const o in t)t[o]&&(i[o]=r[o]+t[o]);return Bc(e,i)},vy=(e,t,r=50)=>{const{r:i,g:o,b:s,a}=Ee.parse(e),{r:n,g:l,b:c,a:h}=Ee.parse(t),d=r/100,f=d*2-1,u=a-h,m=((f*u===-1?f:(f+u)/(1+f*u))+1)/2,y=1-m,C=i*m+n*y,b=o*m+l*y,k=s*m+c*y,T=a*d+h*(1-d);return or(C,b,k,T)},B=(e,t=100)=>{const r=Ee.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,vy(r,e,t)};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Hl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);ri.map(i=>d[i]); +import{bR as nt}from"./index-Bxn5yOTB.js";import{g as gy}from"./_commonjsHelpers-CqkleIqs.js";var _c=Object.defineProperty,p=(e,t)=>_c(e,"name",{value:t,configurable:!0}),my=(e,t)=>{for(var r in t)_c(e,r,{get:t[r],enumerable:!0})},So={exports:{}},yy=So.exports,zl;function Cy(){return zl||(zl=1,(function(e,t){(function(r,i){e.exports=i()})(yy,(function(){var r=1e3,i=6e4,o=36e5,s="millisecond",a="second",n="minute",l="hour",c="day",h="week",d="month",f="quarter",u="year",g="date",m="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,C=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,b={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function($){var A=["th","st","nd","rd"],F=$%100;return"["+$+(A[(F-20)%10]||A[F]||A[0])+"]"}},k=function($,A,F){var D=String($);return!D||D.length>=A?$:""+Array(A+1-D.length).join(F)+$},T={s:k,z:function($){var A=-$.utcOffset(),F=Math.abs(A),D=Math.floor(F/60),M=F%60;return(A<=0?"+":"-")+k(D,2,"0")+":"+k(M,2,"0")},m:function $(A,F){if(A.date()1)return $(Y[0])}else{var G=A.name;_[G]=A,M=G}return!D&&M&&(S=M),M||!D&&S},R=function($,A){if(v($))return $.clone();var F=typeof A=="object"?A:{};return F.date=$,F.args=arguments,new z(F)},P=T;P.l=N,P.i=v,P.w=function($,A){return R($,{locale:A.$L,utc:A.$u,x:A.$x,$offset:A.$offset})};var z=(function(){function $(F){this.$L=N(F.locale,null,!0),this.parse(F),this.$x=this.$x||F.x||{},this[L]=!0}var A=$.prototype;return A.parse=function(F){this.$d=(function(D){var M=D.date,H=D.utc;if(M===null)return new Date(NaN);if(P.u(M))return new Date;if(M instanceof Date)return new Date(M);if(typeof M=="string"&&!/Z$/i.test(M)){var Y=M.match(y);if(Y){var G=Y[2]-1||0,lt=(Y[7]||"0").substring(0,3);return H?new Date(Date.UTC(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)):new Date(Y[1],G,Y[3]||1,Y[4]||0,Y[5]||0,Y[6]||0,lt)}}return new Date(M)})(F),this.init()},A.init=function(){var F=this.$d;this.$y=F.getFullYear(),this.$M=F.getMonth(),this.$D=F.getDate(),this.$W=F.getDay(),this.$H=F.getHours(),this.$m=F.getMinutes(),this.$s=F.getSeconds(),this.$ms=F.getMilliseconds()},A.$utils=function(){return P},A.isValid=function(){return this.$d.toString()!==m},A.isSame=function(F,D){var M=R(F);return this.startOf(D)<=M&&M<=this.endOf(D)},A.isAfter=function(F,D){return R(F){},"trace"),debug:p((...e)=>{},"debug"),info:p((...e)=>{},"info"),warn:p((...e)=>{},"warn"),error:p((...e)=>{},"error"),fatal:p((...e)=>{},"fatal")},Cn=p(function(e="fatal"){let t=Ne.fatal;typeof e=="string"?e.toLowerCase()in Ne&&(t=Ne[e]):typeof e=="number"&&(t=e),q.trace=()=>{},q.debug=()=>{},q.info=()=>{},q.warn=()=>{},q.error=()=>{},q.fatal=()=>{},t<=Ne.fatal&&(q.fatal=console.error?console.error.bind(console,he("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",he("FATAL"))),t<=Ne.error&&(q.error=console.error?console.error.bind(console,he("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",he("ERROR"))),t<=Ne.warn&&(q.warn=console.warn?console.warn.bind(console,he("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",he("WARN"))),t<=Ne.info&&(q.info=console.info?console.info.bind(console,he("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",he("INFO"))),t<=Ne.debug&&(q.debug=console.debug?console.debug.bind(console,he("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("DEBUG"))),t<=Ne.trace&&(q.trace=console.debug?console.debug.bind(console,he("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",he("TRACE")))},"setLogLevel"),he=p(e=>`%c${by().format("ss.SSS")} : ${e} : `,"format");const _o={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const t=e/255;return e>.03928?Math.pow((t+.055)/1.055,2.4):t/12.92},hue2rgb:(e,t,r)=>(r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e),hsl2rgb:({h:e,s:t,l:r},i)=>{if(!t)return r*2.55;e/=360,t/=100,r/=100;const o=r<.5?r*(1+t):r+t-r*t,s=2*r-o;switch(i){case"r":return _o.hue2rgb(s,o,e+1/3)*255;case"g":return _o.hue2rgb(s,o,e)*255;case"b":return _o.hue2rgb(s,o,e-1/3)*255}},rgb2hsl:({r:e,g:t,b:r},i)=>{e/=255,t/=255,r/=255;const o=Math.max(e,t,r),s=Math.min(e,t,r),a=(o+s)/2;if(i==="l")return a*100;if(o===s)return 0;const n=o-s,l=a>.5?n/(2-o-s):n/(o+s);if(i==="s")return l*100;switch(o){case e:return((t-r)/n+(tt>r?Math.min(t,Math.max(r,e)):Math.min(r,Math.max(t,e)),round:e=>Math.round(e*1e10)/1e10},wy={dec2hex:e=>{const t=Math.round(e).toString(16);return t.length>1?t:`0${t}`}},at={channel:_o,lang:ky,unit:wy},Je={};for(let e=0;e<=255;e++)Je[e]=at.unit.dec2hex(e);const Gt={ALL:0,RGB:1,HSL:2};class Ty{constructor(){this.type=Gt.ALL}get(){return this.type}set(t){if(this.type&&this.type!==t)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=t}reset(){this.type=Gt.ALL}is(t){return this.type===t}}class Sy{constructor(t,r){this.color=r,this.changed=!1,this.data=t,this.type=new Ty}set(t,r){return this.color=r,this.changed=!1,this.data=t,this.type.type=Gt.ALL,this}_ensureHSL(){const t=this.data,{h:r,s:i,l:o}=t;r===void 0&&(t.h=at.channel.rgb2hsl(t,"h")),i===void 0&&(t.s=at.channel.rgb2hsl(t,"s")),o===void 0&&(t.l=at.channel.rgb2hsl(t,"l"))}_ensureRGB(){const t=this.data,{r,g:i,b:o}=t;r===void 0&&(t.r=at.channel.hsl2rgb(t,"r")),i===void 0&&(t.g=at.channel.hsl2rgb(t,"g")),o===void 0&&(t.b=at.channel.hsl2rgb(t,"b"))}get r(){const t=this.data,r=t.r;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"r"))}get g(){const t=this.data,r=t.g;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"g"))}get b(){const t=this.data,r=t.b;return!this.type.is(Gt.HSL)&&r!==void 0?r:(this._ensureHSL(),at.channel.hsl2rgb(t,"b"))}get h(){const t=this.data,r=t.h;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"h"))}get s(){const t=this.data,r=t.s;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"s"))}get l(){const t=this.data,r=t.l;return!this.type.is(Gt.RGB)&&r!==void 0?r:(this._ensureRGB(),at.channel.rgb2hsl(t,"l"))}get a(){return this.data.a}set r(t){this.type.set(Gt.RGB),this.changed=!0,this.data.r=t}set g(t){this.type.set(Gt.RGB),this.changed=!0,this.data.g=t}set b(t){this.type.set(Gt.RGB),this.changed=!0,this.data.b=t}set h(t){this.type.set(Gt.HSL),this.changed=!0,this.data.h=t}set s(t){this.type.set(Gt.HSL),this.changed=!0,this.data.s=t}set l(t){this.type.set(Gt.HSL),this.changed=!0,this.data.l=t}set a(t){this.changed=!0,this.data.a=t}}const gs=new Sy({r:0,g:0,b:0,a:0},"transparent"),Xr={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const t=e.match(Xr.re);if(!t)return;const r=t[1],i=parseInt(r,16),o=r.length,s=o%4===0,a=o>4,n=a?1:17,l=a?8:4,c=s?0:-1,h=a?255:15;return gs.set({r:(i>>l*(c+3)&h)*n,g:(i>>l*(c+2)&h)*n,b:(i>>l*(c+1)&h)*n,a:s?(i&h)*n/255:1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}${Je[Math.round(o*255)]}`:`#${Je[Math.round(t)]}${Je[Math.round(r)]}${Je[Math.round(i)]}`}},Cr={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const t=e.match(Cr.hueRe);if(t){const[,r,i]=t;switch(i){case"grad":return at.channel.clamp.h(parseFloat(r)*.9);case"rad":return at.channel.clamp.h(parseFloat(r)*180/Math.PI);case"turn":return at.channel.clamp.h(parseFloat(r)*360)}}return at.channel.clamp.h(parseFloat(e))},parse:e=>{const t=e.charCodeAt(0);if(t!==104&&t!==72)return;const r=e.match(Cr.re);if(!r)return;const[,i,o,s,a,n]=r;return gs.set({h:Cr._hue2deg(i),s:at.channel.clamp.s(parseFloat(o)),l:at.channel.clamp.l(parseFloat(s)),a:a?at.channel.clamp.a(n?parseFloat(a)/100:parseFloat(a)):1},e)},stringify:e=>{const{h:t,s:r,l:i,a:o}=e;return o<1?`hsla(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%, ${o})`:`hsl(${at.lang.round(t)}, ${at.lang.round(r)}%, ${at.lang.round(i)}%)`}},Ei={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const t=Ei.colors[e];if(t)return Xr.parse(t)},stringify:e=>{const t=Xr.stringify(e);for(const r in Ei.colors)if(Ei.colors[r]===t)return r}},wi={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const t=e.charCodeAt(0);if(t!==114&&t!==82)return;const r=e.match(wi.re);if(!r)return;const[,i,o,s,a,n,l,c,h]=r;return gs.set({r:at.channel.clamp.r(o?parseFloat(i)*2.55:parseFloat(i)),g:at.channel.clamp.g(a?parseFloat(s)*2.55:parseFloat(s)),b:at.channel.clamp.b(l?parseFloat(n)*2.55:parseFloat(n)),a:c?at.channel.clamp.a(h?parseFloat(c)/100:parseFloat(c)):1},e)},stringify:e=>{const{r:t,g:r,b:i,a:o}=e;return o<1?`rgba(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)}, ${at.lang.round(o)})`:`rgb(${at.lang.round(t)}, ${at.lang.round(r)}, ${at.lang.round(i)})`}},Ee={format:{keyword:Ei,hex:Xr,rgb:wi,rgba:wi,hsl:Cr,hsla:Cr},parse:e=>{if(typeof e!="string")return e;const t=Xr.parse(e)||wi.parse(e)||Cr.parse(e)||Ei.parse(e);if(t)return t;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Gt.HSL)||e.data.r===void 0?Cr.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?wi.stringify(e):Xr.stringify(e)},Bc=(e,t)=>{const r=Ee.parse(e);for(const i in t)r[i]=at.channel.clamp[i](t[i]);return Ee.stringify(r)},or=(e,t,r=0,i=1)=>{if(typeof e!="number")return Bc(e,{a:t});const o=gs.set({r:at.channel.clamp.r(e),g:at.channel.clamp.g(t),b:at.channel.clamp.b(r),a:at.channel.clamp.a(i)});return Ee.stringify(o)},_y=e=>{const{r:t,g:r,b:i}=Ee.parse(e),o=.2126*at.channel.toLinear(t)+.7152*at.channel.toLinear(r)+.0722*at.channel.toLinear(i);return at.lang.round(o)},By=e=>_y(e)>=.5,ke=e=>!By(e),vc=(e,t,r)=>{const i=Ee.parse(e),o=i[t],s=at.channel.clamp[t](o+r);return o!==s&&(i[t]=s),Ee.stringify(i)},O=(e,t)=>vc(e,"l",t),I=(e,t)=>vc(e,"l",-t),x=(e,t)=>{const r=Ee.parse(e),i={};for(const o in t)t[o]&&(i[o]=r[o]+t[o]);return Bc(e,i)},vy=(e,t,r=50)=>{const{r:i,g:o,b:s,a}=Ee.parse(e),{r:n,g:l,b:c,a:h}=Ee.parse(t),d=r/100,f=d*2-1,u=a-h,m=((f*u===-1?f:(f+u)/(1+f*u))+1)/2,y=1-m,C=i*m+n*y,b=o*m+l*y,k=s*m+c*y,T=a*d+h*(1-d);return or(C,b,k,T)},B=(e,t=100)=>{const r=Ee.parse(e);return r.r=255-r.r,r.g=255-r.g,r.b=255-r.b,vy(r,e,t)};/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function Hl(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r2?i-2:0),s=2;s1?r-1:0),o=1;o"u"?null:Ot(BigInt.prototype.toString),Vl=typeof Symbol>"u"?null:Ot(Symbol.prototype.toString),Nt=Ot(Object.prototype.hasOwnProperty),pi=Ot(Object.prototype.toString),zt=Ot(RegExp.prototype.test),fr=Wy(TypeError);function Ot(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o2&&arguments[2]!==void 0?arguments[2]:Ti;if(Yl&&Yl(e,null),!er(t))return e;let i=t.length;for(;i--;){let o=t[i];if(typeof o=="string"){const s=r(o);s!==o&&($y(t)||(t[i]=s),o=s)}e[o]=!0}return e}function zy(e){for(let t=0;t/g),Vy=jt(/\${[\w\W]*/g),Zy=jt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ky=jt(/^aria-[\-\w]+$/),th=jt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Qy=jt(/^(?:\w+script|data):/i),Jy=jt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),t0=jt(/^html$/i),e0=jt(/^[a-z][.\w]*(-[.\w]+)+$/i),eh=jt(/<[/\w!]/g),r0=jt(/<[/\w]/g),i0=jt(/<\/no(script|embed|frames)/i),o0=jt(/\/>/i),_e={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},s0=function(){return typeof window>"u"?null:window},a0=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let i=null;const o="data-tt-policy-suffix";r&&r.hasAttribute(o)&&(i=r.getAttribute(o));const s="dompurify"+(i?"#"+i:"");try{return t.createPolicy(s,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}},rh=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Qe=function(t,r,i,o){return Nt(t,r)&&er(t[r])?mt(o.base?Qt(o.base):{},t[r],o.transform):i};function Ac(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:s0();const t=j=>Ac(j);if(t.version="3.4.11",t.removed=[],!e||!e.document||e.document.nodeType!==_e.document||!e.Element)return t.isSupported=!1,t;let r=e.document;const i=r,o=i.currentScript;e.DocumentFragment;const s=e.HTMLTemplateElement,a=e.Node,n=e.Element,l=e.NodeFilter,c=e.NamedNodeMap;c===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;const h=e.DOMParser,d=e.trustedTypes,f=n.prototype,u=Be(f,"cloneNode"),g=Be(f,"remove"),m=Be(f,"nextSibling"),y=Be(f,"childNodes"),C=Be(f,"parentNode"),b=Be(f,"shadowRoot"),k=Be(f,"attributes"),T=a&&a.prototype?Be(a.prototype,"nodeType"):null,S=a&&a.prototype?Be(a.prototype,"nodeName"):null;if(typeof s=="function"){const j=r.createElement("template");j.content&&j.content.ownerDocument&&(r=j.content.ownerDocument)}let _,L="",v,N=!1,R=0;const P=function(){if(R>0)throw fr('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},z=function(w){P(),R++;try{return _.createHTML(w)}finally{R--}},W=function(w){P(),R++;try{return _.createScriptURL(w)}finally{R--}},$=function(){return N||(v=a0(d,o),N=!0),v},A=r,F=A.implementation,D=A.createNodeIterator,M=A.createDocumentFragment,H=A.getElementsByTagName,Y=i.importNode;let G=rh();t.isSupported=typeof Lc=="function"&&typeof C=="function"&&F&&F.createHTMLDocument!==void 0;const lt=Gy,ht=Xy,dt=Vy,bt=Zy,et=Ky,ft=Qy,kt=Jy,Bt=e0;let St=th,ut=null;const de=mt({},[...Zl,...Qs,...Js,...ta,...Kl]);let Tt=null;const Mr=mt({},[...Ql,...ea,...Jl,...uo]);let Lt=Object.seal(zr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),li=null,bl=null;const Ve=Object.seal(zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let kl=!0,Os=!0,wl=!1,Tl=!0,Ze=!1,hi=!0,dr=!1,Is=!1,Ds=null,Ps=null,Rs=!1,$r=!1,oo=!1,so=!1,Sl=!0,_l=!1;const Bl="user-content-";let Ns=!0,qs=!1,Or={},Te=null;const Ws=mt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let vl=null;const Ll=mt({},["audio","video","img","source","image","track"]);let zs=null;const Fl=mt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ao="http://www.w3.org/1998/Math/MathML",no="http://www.w3.org/2000/svg",Se="http://www.w3.org/1999/xhtml";let Ir=Se,Hs=!1,Ys=null;const Jm=mt({},[ao,no,Se],Ks),Al=Ut(["mi","mo","mn","ms","mtext"]);let Us=mt({},Al);const El=Ut(["annotation-xml"]);let js=mt({},El);const ty=mt({},["title","style","font","a","script"]);let ci=null;const ey=["application/xhtml+xml","text/html"],ry="text/html";let Ft=null,Dr=null;const iy=r.createElement("form"),Ml=function(w){return w instanceof RegExp||w instanceof Function},Gs=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Dr&&Dr===w)return;(!w||typeof w!="object")&&(w={}),w=Qt(w),ci=ey.indexOf(w.PARSER_MEDIA_TYPE)===-1?ry:w.PARSER_MEDIA_TYPE,Ft=ci==="application/xhtml+xml"?Ks:Ti,ut=Qe(w,"ALLOWED_TAGS",de,{transform:Ft}),Tt=Qe(w,"ALLOWED_ATTR",Mr,{transform:Ft}),Ys=Qe(w,"ALLOWED_NAMESPACES",Jm,{transform:Ks}),zs=Qe(w,"ADD_URI_SAFE_ATTR",Fl,{transform:Ft,base:Fl}),vl=Qe(w,"ADD_DATA_URI_TAGS",Ll,{transform:Ft,base:Ll}),Te=Qe(w,"FORBID_CONTENTS",Ws,{transform:Ft}),li=Qe(w,"FORBID_TAGS",Qt({}),{transform:Ft}),bl=Qe(w,"FORBID_ATTR",Qt({}),{transform:Ft}),Or=Nt(w,"USE_PROFILES")?w.USE_PROFILES&&typeof w.USE_PROFILES=="object"?Qt(w.USE_PROFILES):w.USE_PROFILES:!1,kl=w.ALLOW_ARIA_ATTR!==!1,Os=w.ALLOW_DATA_ATTR!==!1,wl=w.ALLOW_UNKNOWN_PROTOCOLS||!1,Tl=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ze=w.SAFE_FOR_TEMPLATES||!1,hi=w.SAFE_FOR_XML!==!1,dr=w.WHOLE_DOCUMENT||!1,$r=w.RETURN_DOM||!1,oo=w.RETURN_DOM_FRAGMENT||!1,so=w.RETURN_TRUSTED_TYPE||!1,Rs=w.FORCE_BODY||!1,Sl=w.SANITIZE_DOM!==!1,_l=w.SANITIZE_NAMED_PROPS||!1,Ns=w.KEEP_CONTENT!==!1,qs=w.IN_PLACE||!1,St=Yy(w.ALLOWED_URI_REGEXP)?w.ALLOWED_URI_REGEXP:th,Ir=typeof w.NAMESPACE=="string"?w.NAMESPACE:Se,Us=Nt(w,"MATHML_TEXT_INTEGRATION_POINTS")&&w.MATHML_TEXT_INTEGRATION_POINTS&&typeof w.MATHML_TEXT_INTEGRATION_POINTS=="object"?Qt(w.MATHML_TEXT_INTEGRATION_POINTS):mt({},Al),js=Nt(w,"HTML_INTEGRATION_POINTS")&&w.HTML_INTEGRATION_POINTS&&typeof w.HTML_INTEGRATION_POINTS=="object"?Qt(w.HTML_INTEGRATION_POINTS):mt({},El);const E=Nt(w,"CUSTOM_ELEMENT_HANDLING")&&w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING=="object"?Qt(w.CUSTOM_ELEMENT_HANDLING):zr(null);if(Lt=zr(null),Nt(E,"tagNameCheck")&&Ml(E.tagNameCheck)&&(Lt.tagNameCheck=E.tagNameCheck),Nt(E,"attributeNameCheck")&&Ml(E.attributeNameCheck)&&(Lt.attributeNameCheck=E.attributeNameCheck),Nt(E,"allowCustomizedBuiltInElements")&&typeof E.allowCustomizedBuiltInElements=="boolean"&&(Lt.allowCustomizedBuiltInElements=E.allowCustomizedBuiltInElements),jt(Lt),Ze&&(Os=!1),oo&&($r=!0),Or&&(ut=mt({},Kl),Tt=zr(null),Or.html===!0&&(mt(ut,Zl),mt(Tt,Ql)),Or.svg===!0&&(mt(ut,Qs),mt(Tt,ea),mt(Tt,uo)),Or.svgFilters===!0&&(mt(ut,Js),mt(Tt,ea),mt(Tt,uo)),Or.mathMl===!0&&(mt(ut,ta),mt(Tt,Jl),mt(Tt,uo))),Ve.tagCheck=null,Ve.attributeCheck=null,Nt(w,"ADD_TAGS")&&(typeof w.ADD_TAGS=="function"?Ve.tagCheck=w.ADD_TAGS:er(w.ADD_TAGS)&&(ut===de&&(ut=Qt(ut)),mt(ut,w.ADD_TAGS,Ft))),Nt(w,"ADD_ATTR")&&(typeof w.ADD_ATTR=="function"?Ve.attributeCheck=w.ADD_ATTR:er(w.ADD_ATTR)&&(Tt===Mr&&(Tt=Qt(Tt)),mt(Tt,w.ADD_ATTR,Ft))),Nt(w,"ADD_URI_SAFE_ATTR")&&er(w.ADD_URI_SAFE_ATTR)&&mt(zs,w.ADD_URI_SAFE_ATTR,Ft),Nt(w,"FORBID_CONTENTS")&&er(w.FORBID_CONTENTS)&&(Te===Ws&&(Te=Qt(Te)),mt(Te,w.FORBID_CONTENTS,Ft)),Nt(w,"ADD_FORBID_CONTENTS")&&er(w.ADD_FORBID_CONTENTS)&&(Te===Ws&&(Te=Qt(Te)),mt(Te,w.ADD_FORBID_CONTENTS,Ft)),Ns&&(ut["#text"]=!0),dr&&mt(ut,["html","head","body"]),ut.table&&(mt(ut,["tbody"]),delete li.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw fr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw fr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const U=_;_=w.TRUSTED_TYPES_POLICY;try{L=z("")}catch(J){throw _=U,J}}else w.TRUSTED_TYPES_POLICY===null?(_=void 0,L=""):(_===void 0&&(_=$()),_&&typeof L=="string"&&(L=z("")));Ut&&Ut(w),Dr=w},$l=mt({},[...Qs,...Js,...Uy]),Ol=mt({},[...ta,...jy]),oy=function(w,E,U){return E.namespaceURI===Se?w==="svg":E.namespaceURI===ao?w==="svg"&&(U==="annotation-xml"||Us[U]):!!$l[w]},sy=function(w,E,U){return E.namespaceURI===Se?w==="math":E.namespaceURI===no?w==="math"&&js[U]:!!Ol[w]},ay=function(w,E,U){return E.namespaceURI===no&&!js[U]||E.namespaceURI===ao&&!Us[U]?!1:!Ol[w]&&(ty[w]||!$l[w])},ny=function(w){let E=C(w);(!E||!E.tagName)&&(E={namespaceURI:Ir,tagName:"template"});const U=Ti(w.tagName),J=Ti(E.tagName);return Ys[w.namespaceURI]?w.namespaceURI===no?oy(U,E,J):w.namespaceURI===ao?sy(U,E,J):w.namespaceURI===Se?ay(U,E,J):!!(ci==="application/xhtml+xml"&&Ys[w.namespaceURI]):!1},Ke=function(w){Rr(t.removed,{element:w});try{C(w).removeChild(w)}catch{if(g(w),!C(w))throw fr("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Il=function(w){const E=y(w);if(E){const J=[];ui(E,pt=>{Rr(J,pt)}),ui(J,pt=>{try{g(pt)}catch{}})}const U=k(w);if(U)for(let J=U.length-1;J>=0;--J){const pt=U[J],yt=pt&&pt.name;if(typeof yt=="string")try{w.removeAttribute(yt)}catch{}}},ur=function(w,E){try{Rr(t.removed,{attribute:E.getAttributeNode(w),from:E})}catch{Rr(t.removed,{attribute:null,from:E})}if(E.removeAttribute(w),w==="is")if($r||oo)try{Ke(E)}catch{}else try{E.setAttribute(w,"")}catch{}},ly=function(w){const E=k(w);if(E)for(let U=E.length-1;U>=0;--U){const J=E[U],pt=J&&J.name;if(!(typeof pt!="string"||Tt[Ft(pt)]))try{w.removeAttribute(pt)}catch{}}},hy=function(w){const E=[w];for(;E.length>0;){const U=E.pop();(T?T(U):U.nodeType)===_e.element&&ly(U);const pt=y(U);if(pt)for(let yt=pt.length-1;yt>=0;--yt)E.push(pt[yt])}},Dl=function(w){let E=null,U=null;if(Rs)w=""+w;else{const yt=jl(w,/^[\r\n\t ]+/);U=yt&&yt[0]}ci==="application/xhtml+xml"&&Ir===Se&&(w=''+w+"");const J=_?z(w):w;if(Ir===Se)try{E=new h().parseFromString(J,ci)}catch{}if(!E||!E.documentElement){E=F.createDocument(Ir,"template",null);try{E.documentElement.innerHTML=Hs?L:J}catch{}}const pt=E.body||E.documentElement;return w&&U&&pt.insertBefore(r.createTextNode(U),pt.childNodes[0]||null),Ir===Se?H.call(E,dr?"html":"body")[0]:dr?E.documentElement:pt},Pl=function(w){return D.call(w.ownerDocument||w,w,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},lo=function(w){return w=fi(w,lt," "),w=fi(w,ht," "),w=fi(w,dt," "),w},Xs=function(w){var E;w.normalize();const U=D.call(w.ownerDocument||w,w,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null);let J=U.nextNode();for(;J;)J.data=lo(J.data),J=U.nextNode();const pt=(E=w.querySelectorAll)===null||E===void 0?void 0:E.call(w,"template");pt&&ui(pt,yt=>{Pr(yt.content)&&Xs(yt.content)})},ho=function(w){const E=S?S(w):null;return typeof E!="string"||Ft(E)!=="form"?!1:typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||w.attributes!==k(w)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function"||w.nodeType!==T(w)||w.childNodes!==y(w)},Pr=function(w){if(!T||typeof w!="object"||w===null)return!1;try{return T(w)===_e.documentFragment}catch{return!1}},di=function(w){if(!T||typeof w!="object"||w===null)return!1;try{return typeof T(w)=="number"}catch{return!1}};function Re(j,w,E){j.length!==0&&ui(j,U=>{U.call(t,w,E,Dr)})}const cy=function(w,E){return!!(hi&&w.hasChildNodes()&&!di(w.firstElementChild)&&zt(eh,w.textContent)&&zt(eh,w.innerHTML)||hi&&w.namespaceURI===Se&&E==="style"&&di(w.firstElementChild)||w.nodeType===_e.processingInstruction||hi&&w.nodeType===_e.comment&&zt(r0,w.data))},dy=function(w,E){if(!li[E]&&ql(E)&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,E)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(E)))return!1;if(Ns&&!Te[E]){const U=C(w),J=y(w);if(J&&U){const pt=J.length;for(let yt=pt-1;yt>=0;--yt){const Rt=qs?J[yt]:u(J[yt],!0);U.insertBefore(Rt,m(w))}}}return Ke(w),!0},Rl=function(w){if(Re(G.beforeSanitizeElements,w,null),ho(w))return Ke(w),!0;const E=Ft(S?S(w):w.nodeName);if(Re(G.uponSanitizeElement,w,{tagName:E,allowedTags:ut}),cy(w,E))return Ke(w),!0;if(li[E]||!(Ve.tagCheck instanceof Function&&Ve.tagCheck(E))&&!ut[E])return dy(w,E);if((T?T(w):w.nodeType)===_e.element&&!ny(w)||(E==="noscript"||E==="noembed"||E==="noframes")&&zt(i0,w.innerHTML))return Ke(w),!0;if(Ze&&w.nodeType===_e.text){const J=lo(w.textContent);w.textContent!==J&&(Rr(t.removed,{element:w.cloneNode()}),w.textContent=J)}return Re(G.afterSanitizeElements,w,null),!1},Nl=function(w,E,U){if(bl[E]||Sl&&(E==="id"||E==="name")&&(U in r||U in iy))return!1;const J=Tt[E]||Ve.attributeCheck instanceof Function&&Ve.attributeCheck(E,w);if(!(Os&&zt(bt,E))){if(!(kl&&zt(et,E))){if(J){if(!zs[E]){if(!zt(St,fi(U,kt,""))){if(!((E==="src"||E==="xlink:href"||E==="href")&&w!=="script"&&Gl(U,"data:")===0&&vl[w])){if(!(wl&&!zt(ft,fi(U,kt,"")))){if(U)return!1}}}}}else if(!(ql(w)&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,w)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(w))&&(Lt.attributeNameCheck instanceof RegExp&&zt(Lt.attributeNameCheck,E)||Lt.attributeNameCheck instanceof Function&&Lt.attributeNameCheck(E,w))||E==="is"&&Lt.allowCustomizedBuiltInElements&&(Lt.tagNameCheck instanceof RegExp&&zt(Lt.tagNameCheck,U)||Lt.tagNameCheck instanceof Function&&Lt.tagNameCheck(U))))return!1}}return!0},uy=mt({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),ql=function(w){return!uy[Ti(w)]&&zt(Bt,w)},fy=function(w,E,U,J){if(_&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!U)switch(d.getAttributeType(w,E)){case"TrustedHTML":return z(J);case"TrustedScriptURL":return W(J)}return J},py=function(w,E,U,J){try{U?w.setAttributeNS(U,E,J):w.setAttribute(E,J),ho(w)?Ke(w):Ul(t.removed)}catch{ur(E,w)}},Wl=function(w){Re(G.beforeSanitizeAttributes,w,null);const E=w.attributes;if(!E||ho(w))return;const U={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Tt,forceKeepAttr:void 0};let J=E.length;const pt=Ft(w.nodeName);for(;J--;){const yt=E[J],Rt=yt.name,Mt=yt.namespaceURI,le=yt.value,ue=Ft(Rt),Zs=le;let Kt=Rt==="value"?Zs:Ry(Zs);if(U.attrName=ue,U.attrValue=Kt,U.keepAttr=!0,U.forceKeepAttr=void 0,Re(G.uponSanitizeAttribute,w,U),Kt=U.attrValue,_l&&(ue==="id"||ue==="name")&&Gl(Kt,Bl)!==0&&(ur(Rt,w),Kt=Bl+Kt),hi&&zt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Kt)){ur(Rt,w);continue}if(ue==="attributename"&&jl(Kt,"href")){ur(Rt,w);continue}if(!U.forceKeepAttr){if(!U.keepAttr){ur(Rt,w);continue}if(!Tl&&zt(o0,Kt)){ur(Rt,w);continue}if(Ze&&(Kt=lo(Kt)),!Nl(pt,ue,Kt)){ur(Rt,w);continue}Kt=fy(pt,ue,Mt,Kt),Kt!==Zs&&py(w,Rt,Mt,Kt)}}Re(G.afterSanitizeAttributes,w,null)},co=function(w){let E=null;const U=Pl(w);for(Re(G.beforeSanitizeShadowDOM,w,null);E=U.nextNode();)if(Re(G.uponSanitizeShadowNode,E,null),Rl(E),Wl(E),Pr(E.content)&&co(E.content),(T?T(E):E.nodeType)===_e.element){const pt=b(E);Pr(pt)&&(Vs(pt),co(pt))}Re(G.afterSanitizeShadowDOM,w,null)},Vs=function(w){const E=[{node:w,shadow:null}];for(;E.length>0;){const U=E.pop();if(U.shadow){co(U.shadow);continue}const J=U.node,yt=(T?T(J):J.nodeType)===_e.element,Rt=y(J);if(Rt)for(let Mt=Rt.length-1;Mt>=0;--Mt)E.push({node:Rt[Mt],shadow:null});if(yt){const Mt=S?S(J):null;if(typeof Mt=="string"&&Ft(Mt)==="template"){const le=J.content;Pr(le)&&E.push({node:le,shadow:null})}}if(yt){const Mt=b(J);Pr(Mt)&&E.push({node:null,shadow:Mt},{node:Mt,shadow:null})}}};return t.sanitize=function(j){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},E=null,U=null,J=null,pt=null;if(Hs=!j,Hs&&(j=""),typeof j!="string"&&!di(j)&&(j=Hy(j),typeof j!="string"))throw fr("dirty is not a string, aborting");if(!t.isSupported)return j;Is?(ut=Ds,Tt=Ps):Gs(w),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(ut=Qt(ut)),G.uponSanitizeAttribute.length>0&&(Tt=Qt(Tt)),t.removed=[];const yt=qs&&typeof j!="string"&&di(j);if(yt){const le=S?S(j):j.nodeName;if(typeof le=="string"){const ue=Ft(le);if(!ut[ue]||li[ue])throw fr("root node is forbidden and cannot be sanitized in-place")}if(ho(j))throw fr("root node is clobbered and cannot be sanitized in-place");try{Vs(j)}catch(ue){throw Il(j),ue}}else if(di(j))E=Dl(""),U=E.ownerDocument.importNode(j,!0),U.nodeType===_e.element&&U.nodeName==="BODY"||U.nodeName==="HTML"?E=U:E.appendChild(U),Vs(U);else{if(!$r&&!Ze&&!dr&&j.indexOf("<")===-1)return _&&so?z(j):j;if(E=Dl(j),!E)return $r?null:so?L:""}E&&Rs&&Ke(E.firstChild);const Rt=Pl(yt?j:E);try{for(;J=Rt.nextNode();)Rl(J),Wl(J),Pr(J.content)&&co(J.content)}catch(le){throw yt&&Il(j),le}if(yt)return ui(t.removed,le=>{le.element&&hy(le.element)}),Ze&&Xs(j),j;if($r){if(Ze&&Xs(E),oo)for(pt=M.call(E.ownerDocument);E.firstChild;)pt.appendChild(E.firstChild);else pt=E;return(Tt.shadowroot||Tt.shadowrootmode)&&(pt=Y.call(i,pt,!0)),pt}let Mt=dr?E.outerHTML:E.innerHTML;return dr&&ut["!doctype"]&&E.ownerDocument&&E.ownerDocument.doctype&&E.ownerDocument.doctype.name&&zt(t0,E.ownerDocument.doctype.name)&&(Mt=" `+Mt),Ze&&(Mt=lo(Mt)),_&&so?z(Mt):Mt},t.setConfig=function(){let j=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Gs(j),Is=!0,Ds=ut,Ps=Tt},t.clearConfig=function(){Dr=null,Is=!1,Ds=null,Ps=null,_=v,L=""},t.isValidAttribute=function(j,w,E){Dr||Gs({});const U=Ft(j),J=Ft(w);return Nl(U,J,E)},t.addHook=function(j,w){typeof w=="function"&&Nt(G,j)&&Rr(G[j],w)},t.removeHook=function(j,w){if(Nt(G,j)){if(w!==void 0){const E=Dy(G[j],w);return E===-1?void 0:Py(G[j],E,1)[0]}return Ul(G[j])}},t.removeHooks=function(j){Nt(G,j)&&(G[j]=[])},t.removeAllHooks=function(){G=rh()},t}var Kr=Ac(),xa=p((e,t,{depth:r=2,clobber:i=!1}={})=>{const o={depth:r,clobber:i};return Array.isArray(t)&&!Array.isArray(e)?(t.forEach(s=>xa(e,s,o)),e):Array.isArray(t)&&Array.isArray(e)?(t.forEach(s=>{e.includes(s)||e.push(s)}),e):e===void 0||r<=0?e!=null&&typeof e=="object"&&typeof t=="object"?Object.assign(e,t):t:(t!==void 0&&typeof e=="object"&&typeof t=="object"&&Object.keys(t).forEach(s=>{typeof t[s]=="object"&&t[s]!==null&&(e[s]===void 0||typeof e[s]=="object")?(e[s]===void 0&&(e[s]=Array.isArray(t[s])?[]:{}),e[s]=xa(e[s],t[s],{depth:r-1,clobber:i})):(i||typeof e[s]!="object"&&typeof t[s]!="object")&&(e[s]=t[s])}),e)},"assignWithDepth"),Dt=xa,$e="#ffffff",Oe="#f2f2f2",st=p((e,t)=>t?x(e,{s:-40,l:10}):x(e,{s:-40,l:-10}),"mkBorder"),n0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#fff4dd",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.useGradient=!0,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||"navy",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.darkMode?(this.rowOdd=this.rowOdd||I(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||I(this.mainBkg,10)):(this.rowOdd=this.rowOdd||O(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||O(this.mainBkg,5)),this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||this.tertiaryColor,this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},l0=p(e=>{const t=new n0;return t.calculate(e),t},"getThemeVariables"),h0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.mainBkg="#1f2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.lineColor="calculated",this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor="calculated",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#F9FFFE",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="calculated",this.activationBkgColor="calculated",this.sequenceNumberColor="black",this.clusterBkg="#302F3D",this.sectionBkgColor=I("#EAE8D9",30),this.altSectionBkgColor="calculated",this.sectionBkgColor2="#EAE8D9",this.excludeBkgColor=I(this.sectionBkgColor,10),this.taskBorderColor=or(255,255,255,70),this.taskBkgColor="calculated",this.taskTextColor="calculated",this.taskTextLightColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor=or(255,255,255,50),this.activeTaskBkgColor="#81B1DB",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="grey",this.critBorderColor="#E83737",this.critBkgColor="#E83737",this.taskTextDarkColor="calculated",this.todayLineColor="#DB5757",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd=this.rowOdd||O(this.mainBkg,5)||"#ffffff",this.rowEven=this.rowEven||I(this.mainBkg,10),this.labelColor="calculated",this.errorBkgColor="#a44141",this.errorTextColor="#ddd",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal"}updateColors(){this.secondBkg=O(this.mainBkg,16),this.lineColor=this.mainContrastColor,this.arrowheadColor=this.mainContrastColor,this.nodeBkg=this.mainBkg,this.nodeBorder=this.border1,this.clusterBkg=this.secondBkg,this.clusterBorder=this.border2,this.defaultLinkColor=this.lineColor,this.edgeLabelBackground=O(this.labelBackground,25),this.actorBorder=this.border1,this.actorBkg=this.mainBkg,this.actorTextColor=this.mainContrastColor,this.actorLineColor=this.actorBorder,this.signalColor=this.mainContrastColor,this.signalTextColor=this.mainContrastColor,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.mainContrastColor,this.loopTextColor=this.mainContrastColor,this.noteBorderColor=this.secondaryBorderColor,this.noteBkgColor=this.secondBkg,this.noteTextColor=this.secondaryTextColor,this.activationBorderColor=this.border1,this.activationBkgColor=this.secondBkg,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.background,this.taskBkgColor=O(this.mainBkg,23),this.taskTextColor=this.darkTextColor,this.taskTextLightColor=this.mainContrastColor,this.taskTextOutsideColor=this.taskTextLightColor,this.gridColor=this.mainContrastColor,this.doneTaskBkgColor=this.mainContrastColor,this.taskTextDarkColor=B(this.doneTaskBkgColor),this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#555",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.primaryBorderColor,this.specialStateColor="#f4f4f4",this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.fillType0=this.primaryColor,this.fillType1=this.secondaryColor,this.fillType2=x(this.primaryColor,{h:64}),this.fillType3=x(this.secondaryColor,{h:64}),this.fillType4=x(this.primaryColor,{h:-64}),this.fillType5=x(this.secondaryColor,{h:-64}),this.fillType6=x(this.primaryColor,{h:128}),this.fillType7=x(this.secondaryColor,{h:128}),this.cScale1=this.cScale1||"#0b0000",this.cScale2=this.cScale2||"#4d1037",this.cScale3=this.cScale3||"#3f5258",this.cScale4=this.cScale4||"#4f2f1b",this.cScale5=this.cScale5||"#6e0a0a",this.cScale6=this.cScale6||"#3b0048",this.cScale7=this.cScale7||"#995a01",this.cScale8=this.cScale8||"#154706",this.cScale9=this.cScale9||"#161722",this.cScale10=this.cScale10||"#00296f",this.cScale11=this.cScale11||"#01629c",this.cScale12=this.cScale12||"#010029",this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330});for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},c0=p(e=>{const t=new h0;return t.calculate(e),t},"getThemeVariables"),d0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#ECECFF",this.secondaryColor=x(this.primaryColor,{h:120}),this.secondaryColor="#ffffde",this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.background="white",this.mainBkg="#ECECFF",this.secondBkg="#ffffde",this.lineColor="#333333",this.border1="#9370DB",this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.border2="#aaaa33",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.labelBackground="rgba(232,232,232, 0.8)",this.textColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="calculated",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.clusterBkg="#FBFBFF",this.sectionBkgColor="calculated",this.altSectionBkgColor="calculated",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="calculated",this.taskTextColor=this.taskTextLightColor,this.taskTextDarkColor="calculated",this.taskTextOutsideColor=this.taskTextDarkColor,this.taskTextClickableColor="calculated",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBorderColor="calculated",this.critBkgColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.sectionBkgColor=or(102,102,255,.49),this.altSectionBkgColor="white",this.sectionBkgColor2="#fff400",this.taskBorderColor="#534fbc",this.taskBkgColor="#8a90dd",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="#534fbc",this.activeTaskBkgColor="#bfc7ff",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="navy",this.noteFontWeight=this.noteFontWeight||"normal",this.fontWeight=this.fontWeight||"normal",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.rowOdd="calculated",this.rowEven="calculated",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!1,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow(1px 2px 2px rgba(185, 185, 185, 1))",this.updateColors()}updateColors(){this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||I(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||I(this.tertiaryColor,40);for(let e=0;e{this[r]==="calculated"&&(this[r]=void 0)}),typeof e!="object"){this.updateColors();return}const t=Object.keys(e);t.forEach(r=>{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},u0=p(e=>{const t=new d0;return t.calculate(e),t},"getThemeVariables"),f0=class{static{p(this,"Theme")}constructor(){this.background="#f4f4f4",this.primaryColor="#cde498",this.secondaryColor="#cdffb2",this.background="white",this.mainBkg="#cde498",this.secondBkg="#cdffb2",this.lineColor="green",this.border1="#13540c",this.border2="#6eaa49",this.arrowheadColor="green",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.tertiaryColor=O("#cde498",10),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.primaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="#333",this.edgeLabelBackground="#e8e8e8",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="black",this.actorLineColor="calculated",this.signalColor="#333",this.signalTextColor="#333",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="#326932",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="#fff5ad",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="#6eaa49",this.altSectionBkgColor="white",this.sectionBkgColor2="#6eaa49",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="#487e3a",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="black",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="lightgrey",this.doneTaskBkgColor="lightgrey",this.doneTaskBorderColor="grey",this.critBorderColor="#ff8888",this.critBkgColor="red",this.todayLineColor="red",this.vertLineColor="#00BFFF",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.5))"}updateColors(){this.actorBorder=I(this.mainBkg,20),this.actorBkg=this.mainBkg,this.labelBoxBkgColor=this.actorBkg,this.labelTextColor=this.actorTextColor,this.loopTextColor=this.actorTextColor,this.noteBorderColor=this.border2,this.noteTextColor=this.actorTextColor,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.cScalePeer1=this.cScalePeer1||I(this.secondaryColor,45),this.cScalePeer2=this.cScalePeer2||I(this.tertiaryColor,40);for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},p0=p(e=>{const t=new f0;return t.calculate(e),t},"getThemeVariables"),g0=class{static{p(this,"Theme")}constructor(){this.primaryColor="#eee",this.contrast="#707070",this.secondaryColor=O(this.contrast,55),this.background="#ffffff",this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.lineColor=B(this.background),this.textColor=B(this.background),this.mainBkg="#eee",this.secondBkg="calculated",this.lineColor="#666",this.border1="#999",this.border2="calculated",this.note="#ffa",this.text="#333",this.critical="#d42",this.done="#bbb",this.arrowheadColor="#333333",this.fontFamily='"trebuchet ms", verdana, arial, sans-serif',this.fontSize="16px",this.THEME_COLOR_LIMIT=12,this.radius=5,this.strokeWidth=1,this.nodeBkg="calculated",this.nodeBorder="calculated",this.clusterBkg="calculated",this.clusterBorder="calculated",this.defaultLinkColor="calculated",this.titleColor="calculated",this.edgeLabelBackground="white",this.actorBorder="calculated",this.actorBkg="calculated",this.actorTextColor="calculated",this.actorLineColor=this.actorBorder,this.signalColor="calculated",this.signalTextColor="calculated",this.labelBoxBkgColor="calculated",this.labelBoxBorderColor="calculated",this.labelTextColor="calculated",this.loopTextColor="calculated",this.noteBorderColor="calculated",this.noteBkgColor="calculated",this.noteTextColor="calculated",this.activationBorderColor="#666",this.activationBkgColor="#f4f4f4",this.sequenceNumberColor="white",this.sectionBkgColor="calculated",this.altSectionBkgColor="white",this.sectionBkgColor2="calculated",this.excludeBkgColor="#eeeeee",this.taskBorderColor="calculated",this.taskBkgColor="calculated",this.taskTextLightColor="white",this.taskTextColor="calculated",this.taskTextDarkColor="calculated",this.taskTextOutsideColor="calculated",this.taskTextClickableColor="#003163",this.activeTaskBorderColor="calculated",this.activeTaskBkgColor="calculated",this.gridColor="calculated",this.doneTaskBkgColor="calculated",this.doneTaskBorderColor="calculated",this.critBkgColor="calculated",this.critBorderColor="calculated",this.todayLineColor="calculated",this.vertLineColor="calculated",this.personBorder=this.primaryBorderColor,this.personBkg=this.mainBkg,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal",this.rowOdd=this.rowOdd||O(this.mainBkg,75)||"#ffffff",this.rowEven=this.rowEven||"#f4f4f4",this.labelColor="black",this.errorBkgColor="#552222",this.errorTextColor="#552222",this.useGradient=!0,this.gradientStart=this.primaryBorderColor,this.gradientStop=this.secondaryBorderColor,this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,1))"}updateColors(){this.secondBkg=O(this.contrast,55),this.border2=this.contrast,this.actorBorder=O(this.border1,23),this.actorBkg=this.mainBkg,this.actorTextColor=this.text,this.actorLineColor=this.actorBorder,this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.signalColor=this.text,this.signalTextColor=this.text,this.labelBoxBkgColor=this.actorBkg,this.labelBoxBorderColor=this.actorBorder,this.labelTextColor=this.text,this.loopTextColor=this.text,this.noteBorderColor="#999",this.noteBkgColor="#666",this.noteTextColor="#fff",this.cScale0=this.cScale0||"#555",this.cScale1=this.cScale1||"#F4F4F4",this.cScale2=this.cScale2||"#555",this.cScale3=this.cScale3||"#BBB",this.cScale4=this.cScale4||"#777",this.cScale5=this.cScale5||"#999",this.cScale6=this.cScale6||"#DDD",this.cScale7=this.cScale7||"#FFF",this.cScale8=this.cScale8||"#DDD",this.cScale9=this.cScale9||"#BBB",this.cScale10=this.cScale10||"#999",this.cScale11=this.cScale11||"#777";for(let e=0;e{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},m0=p(e=>{const t=new g0;return t.calculate(e),t},"getThemeVariables"),y0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=2,this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.nodeBorder="#000000",this.stateBorder="#000000",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 0px 1px 2px rgba(0, 0, 0, 0.25));",this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});if(this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||e,this.cScale1=this.cScale1||t,this.cScale2=this.cScale2||r,this.cScale3=this.cScale3||x(e,{h:30}),this.cScale4=this.cScale4||x(e,{h:60}),this.cScale5=this.cScale5||x(e,{h:90}),this.cScale6=this.cScale6||x(e,{h:120}),this.cScale7=this.cScale7||x(e,{h:150}),this.cScale8=this.cScale8||x(e,{h:210,l:150}),this.cScale9=this.cScale9||x(e,{h:270}),this.cScale10=this.cScale10||x(e,{h:300}),this.cScale11=this.cScale11||x(e,{h:330}),this.darkMode)for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},C0=p(e=>{const t=new y0;return t.calculate(e),t},"getThemeVariables"),x0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#2a2020",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily="arial, sans-serif",this.fontSize="14px",this.labelBackground="#181818",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=3,this.strokeWidth=1,this.noteBkgColor="#fff5ad",this.noteTextColor="#333",this.THEME_COLOR_LIMIT=12,this.fontFamily="arial, sans-serif",this.fontSize="14px",this.useGradient=!0,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="drop-shadow( 1px 2px 2px rgba(185,185,185,0.2))",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.noteFontWeight="normal",this.fontWeight="normal"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#333"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#333",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},b0=p(e=>{const t=new x0;return t.calculate(e),t},"getThemeVariables"),k0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=st("#28253D",this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.clusterBkg="#F9F9FB",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#FEF9C3",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.noteFontWeight=600,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.compositeTitleBackground="#F9F9FB",this.altBackground="#F9F9FB",this.stateEdgeLabelBackground="#FFFFFF",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor;for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},w0=p(e=>{const t=new k0;return t.calculate(e),t},"getThemeVariables"),T0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.filterColor="#FFFFFF"}updateColors(){if(this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.compositeBackground="#16141F",this.altBackground="#16141F",this.compositeTitleBackground="#16141F",this.stateEdgeLabelBackground="#16141F",this.fontWeight=600,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||this.primaryColor,this.cScale1=this.cScale1||this.secondaryColor,this.cScale2=this.cScale2||this.tertiaryColor,this.cScale3=this.cScale3||x(this.primaryColor,{h:30}),this.cScale4=this.cScale4||x(this.primaryColor,{h:60}),this.cScale5=this.cScale5||x(this.primaryColor,{h:90}),this.cScale6=this.cScale6||x(this.primaryColor,{h:120}),this.cScale7=this.cScale7||x(this.primaryColor,{h:150}),this.cScale8=this.cScale8||x(this.primaryColor,{h:210,l:150}),this.cScale9=this.cScale9||x(this.primaryColor,{h:270}),this.cScale10=this.cScale10||x(this.primaryColor,{h:300}),this.cScale11=this.cScale11||x(this.primaryColor,{h:330}),this.darkMode)for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},S0=p(e=>{const t=new T0;return t.calculate(e),t},"getThemeVariables"),_0=class{static{p(this,"Theme")}constructor(){this.background="#ffffff",this.primaryColor="#cccccc",this.mainBkg="#ffffff",this.noteBkgColor="#fff5ad",this.noteTextColor="#28253D",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.primaryBorderColor=st(this.primaryColor,this.darkMode),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#28253D",this.stateBorder="#28253D",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.tertiaryColor="#ffffff",this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.actorBorder="#28253D",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=["#FDF4FF","#F0FDFA","#FFF7ED","#ECFEFF","#F0FDF4","#F5F3FF","#FEF2F2","#FEFCE8","#EEF2FF","#F7FEE7","#F0F9FF","#FFF1F2"],this.filterColor="#000000"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#28253D"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#28253D",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.primaryBorderColor,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor;const e="#ECECFE",t="#E9E9F1",r=x(e,{h:180,l:5});this.sectionBkgColor=this.sectionBkgColor||r,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||t,this.sectionBkgColor2=this.sectionBkgColor2||e,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||e,this.activeTaskBorderColor=this.activeTaskBorderColor||e,this.activeTaskBkgColor=this.activeTaskBkgColor||O(e,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let o=0;o{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},B0=p(e=>{const t=new _0;return t.calculate(e),t},"getThemeVariables"),v0=class{static{p(this,"Theme")}constructor(){this.background="#333",this.primaryColor="#1f2020",this.secondaryColor=O(this.primaryColor,16),this.tertiaryColor=x(this.primaryColor,{h:-160}),this.primaryBorderColor=B(this.background),this.secondaryBorderColor=st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=st(this.tertiaryColor,this.darkMode),this.primaryTextColor=B(this.primaryColor),this.secondaryTextColor=B(this.secondaryColor),this.tertiaryTextColor=B(this.tertiaryColor),this.mainBkg="#111113",this.secondBkg="calculated",this.mainContrastColor="lightgrey",this.darkTextColor=O(B("#323D47"),10),this.border1="#ccc",this.border2=or(255,255,255,.25),this.arrowheadColor=B(this.background),this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.labelBackground="#111113",this.textColor="#ccc",this.THEME_COLOR_LIMIT=12,this.radius=12,this.strokeWidth=2,this.noteBkgColor=this.noteBkgColor??"#FEF9C3",this.noteTextColor=this.noteTextColor??"#28253D",this.THEME_COLOR_LIMIT=12,this.fontFamily='"Recursive Variable", arial, sans-serif',this.fontSize="14px",this.nodeBorder="#FFFFFF",this.stateBorder="#FFFFFF",this.useGradient=!1,this.gradientStart="#0042eb",this.gradientStop="#eb0042",this.dropShadow="url(#drop-shadow)",this.nodeShadow=!0,this.archEdgeColor="calculated",this.archEdgeArrowColor="calculated",this.archEdgeWidth="3",this.archGroupBorderColor=this.primaryBorderColor,this.archGroupBorderWidth="2px",this.clusterBkg="#1E1A2E",this.clusterBorder="#BDBCCC",this.noteBorderColor="#FACC15",this.noteFontWeight=600,this.borderColorArray=["#E879F9","#2DD4BF","#FB923C","#22D3EE","#4ADE80","#A78BFA","#F87171","#FACC15","#818CF8","#A3E635 ","#38BDF8","#FB7185"],this.bkgColorArray=[],this.filterColor="#FFFFFF"}updateColors(){this.primaryTextColor=this.primaryTextColor||(this.darkMode?"#eee":"#FFFFFF"),this.secondaryColor=this.secondaryColor||x(this.primaryColor,{h:-120}),this.tertiaryColor=this.tertiaryColor||x(this.primaryColor,{h:180,l:5}),this.primaryBorderColor=this.primaryBorderColor||st(this.primaryColor,this.darkMode),this.secondaryBorderColor=this.secondaryBorderColor||st(this.secondaryColor,this.darkMode),this.tertiaryBorderColor=this.tertiaryBorderColor||st(this.tertiaryColor,this.darkMode),this.noteBorderColor=this.noteBorderColor||st(this.noteBkgColor,this.darkMode),this.noteBkgColor=this.noteBkgColor||"#fff5ad",this.noteTextColor=this.noteTextColor||"#FFFFFF",this.secondaryTextColor=this.secondaryTextColor||B(this.secondaryColor),this.tertiaryTextColor=this.tertiaryTextColor||B(this.tertiaryColor),this.lineColor=this.lineColor||B(this.background),this.arrowheadColor=this.arrowheadColor||B(this.background),this.textColor=this.textColor||this.primaryTextColor,this.border2=this.border2||this.tertiaryBorderColor,this.nodeBkg=this.nodeBkg||this.primaryColor,this.mainBkg=this.mainBkg||this.primaryColor,this.nodeBorder=this.nodeBorder||this.border1,this.clusterBkg=this.clusterBkg||this.tertiaryColor,this.clusterBorder=this.clusterBorder||this.tertiaryBorderColor,this.defaultLinkColor=this.defaultLinkColor||this.lineColor,this.titleColor=this.titleColor||this.tertiaryTextColor,this.edgeLabelBackground=this.edgeLabelBackground||(this.darkMode?I(this.secondaryColor,30):this.secondaryColor),this.nodeTextColor=this.nodeTextColor||this.primaryTextColor,this.actorBorder="#FFFFFF",this.signalColor="#FFFFFF",this.labelBoxBorderColor="#BDBCCC",this.actorBorder=this.actorBorder||this.primaryBorderColor,this.actorBkg=this.actorBkg||this.mainBkg,this.actorTextColor=this.actorTextColor||this.primaryTextColor,this.actorLineColor=this.actorLineColor||this.actorBorder,this.labelBoxBkgColor=this.labelBoxBkgColor||this.actorBkg,this.signalColor=this.signalColor||this.textColor,this.signalTextColor=this.signalTextColor||this.textColor,this.labelBoxBorderColor=this.labelBoxBorderColor||this.actorBorder,this.labelTextColor=this.labelTextColor||this.actorTextColor,this.loopTextColor=this.loopTextColor||this.actorTextColor,this.activationBorderColor=this.activationBorderColor||I(this.secondaryColor,10),this.activationBkgColor=this.activationBkgColor||this.secondaryColor,this.sequenceNumberColor=this.sequenceNumberColor||B(this.lineColor),this.rectBkgColor=this.rectBkgColor||this.tertiaryColor,this.rootLabelColor="#FFFFFF",this.sectionBkgColor=this.sectionBkgColor||this.tertiaryColor,this.altSectionBkgColor=this.altSectionBkgColor||"white",this.sectionBkgColor=this.sectionBkgColor||this.secondaryColor,this.sectionBkgColor2=this.sectionBkgColor2||this.primaryColor,this.excludeBkgColor=this.excludeBkgColor||"#eeeeee",this.taskBorderColor=this.taskBorderColor||this.primaryBorderColor,this.taskBkgColor=this.taskBkgColor||this.primaryColor,this.activeTaskBorderColor=this.activeTaskBorderColor||this.primaryColor,this.activeTaskBkgColor=this.activeTaskBkgColor||O(this.primaryColor,23),this.gridColor=this.gridColor||"lightgrey",this.doneTaskBkgColor=this.doneTaskBkgColor||"lightgrey",this.doneTaskBorderColor=this.doneTaskBorderColor||"grey",this.critBorderColor=this.critBorderColor||"#ff8888",this.critBkgColor=this.critBkgColor||"red",this.todayLineColor=this.todayLineColor||"red",this.taskTextColor=this.taskTextColor||this.textColor,this.vertLineColor=this.vertLineColor||this.primaryBorderColor,this.taskTextOutsideColor=this.taskTextOutsideColor||this.textColor,this.taskTextLightColor=this.taskTextLightColor||this.textColor,this.taskTextColor=this.taskTextColor||this.primaryTextColor,this.taskTextDarkColor=this.taskTextDarkColor||this.textColor,this.taskTextClickableColor=this.taskTextClickableColor||"#003163",this.archEdgeColor=this.lineColor,this.archEdgeArrowColor=this.lineColor,this.personBorder=this.personBorder||this.primaryBorderColor,this.personBkg=this.personBkg||this.mainBkg,this.transitionColor=this.transitionColor||this.lineColor,this.transitionLabelColor=this.transitionLabelColor||this.textColor,this.stateLabelColor=this.stateLabelColor||this.stateBkg||this.primaryTextColor,this.stateBkg=this.stateBkg||this.mainBkg,this.labelBackgroundColor=this.labelBackgroundColor||this.stateBkg,this.compositeBackground=this.compositeBackground||this.background||this.tertiaryColor,this.altBackground=this.altBackground||"#f0f0f0",this.compositeTitleBackground=this.compositeTitleBackground||this.mainBkg,this.compositeBorder=this.compositeBorder||this.nodeBorder,this.innerEndBackground=this.nodeBorder,this.errorBkgColor=this.errorBkgColor||this.tertiaryColor,this.errorTextColor=this.errorTextColor||this.tertiaryTextColor,this.transitionColor=this.transitionColor||this.lineColor,this.specialStateColor=this.lineColor,this.cScale0=this.cScale0||"#f4a8ff",this.cScale1=this.cScale1||"#46ecd5",this.cScale2=this.cScale2||"#ffb86a",this.cScale3=this.cScale3||"#dab2ff",this.cScale4=this.cScale4||"#7bf1a8",this.cScale5=this.cScale5||"#c4b4ff",this.cScale6=this.cScale6||"#ffa2a2",this.cScale7=this.cScale7||"#ffdf20",this.cScale8=this.cScale8||"#a3b3ff",this.cScale9=this.cScale9||"#bbf451",this.cScale10=this.cScale10||"#74d4ff",this.cScale11=this.cScale11||"#ffa1ad";for(let t=0;t{this[r]=e[r]}),this.updateColors(),t.forEach(r=>{this[r]=e[r]})}},L0=p(e=>{const t=new v0;return t.calculate(e),t},"getThemeVariables"),He={base:{getThemeVariables:l0},dark:{getThemeVariables:c0},default:{getThemeVariables:u0},forest:{getThemeVariables:p0},neutral:{getThemeVariables:m0},neo:{getThemeVariables:C0},"neo-dark":{getThemeVariables:b0},redux:{getThemeVariables:w0},"redux-dark":{getThemeVariables:S0},"redux-color":{getThemeVariables:B0},"redux-dark-color":{getThemeVariables:L0}},Wt={flowchart:{useMaxWidth:!0,titleTopMargin:25,subGraphTitleMargin:{top:0,bottom:0},diagramPadding:8,htmlLabels:null,nodeSpacing:50,rankSpacing:50,curve:"basis",padding:15,defaultRenderer:"dagre-wrapper",wrappingWidth:200,inheritDir:!1},swimlane:{useMaxWidth:!0,lineHops:"arc",ignoreCrossLaneEdges:!0,optimizeRanksByCrossings:!0,automaticLaneOrdering:!1},sequence:{useMaxWidth:!0,hideUnusedParticipants:!1,activationWidth:10,diagramMarginX:50,diagramMarginY:10,actorMargin:50,width:150,height:65,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",mirrorActors:!0,forceMenus:!1,bottomMarginAdj:1,rightAngles:!1,showSequenceNumbers:!1,actorFontSize:14,actorFontFamily:'"Open Sans", sans-serif',actorFontWeight:400,noteFontSize:14,noteFontFamily:'"trebuchet ms", verdana, arial, sans-serif',noteFontWeight:400,noteAlign:"center",messageFontSize:16,messageFontFamily:'"trebuchet ms", verdana, arial, sans-serif',messageFontWeight:400,wrap:!1,wrapPadding:10,labelBoxWidth:50,labelBoxHeight:20},gantt:{useMaxWidth:!0,titleTopMargin:25,barHeight:20,barGap:4,topPadding:50,rightPadding:75,leftPadding:75,gridLineStartPadding:35,fontSize:11,sectionFontSize:11,numberSectionStyles:4,axisFormat:"%Y-%m-%d",topAxis:!1,displayMode:"",weekday:"sunday"},journey:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,maxLabelWidth:360,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],titleColor:"",titleFontFamily:'"trebuchet ms", verdana, arial, sans-serif',titleFontSize:"4ex"},class:{useMaxWidth:!0,titleTopMargin:25,arrowMarkerAbsolute:!1,dividerMargin:10,padding:5,textHeight:10,defaultRenderer:"dagre-wrapper",htmlLabels:!1,hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},state:{useMaxWidth:!0,titleTopMargin:25,dividerMargin:10,sizeUnit:5,padding:8,textHeight:10,titleShift:-15,noteMargin:10,forkWidth:70,forkHeight:7,miniPadding:2,fontSizeFactor:5.02,fontSize:24,labelHeight:16,edgeLengthFactor:"20",compositTitleSize:35,radius:5,defaultRenderer:"dagre-wrapper"},er:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:20,layoutDirection:"TB",minEntityWidth:100,minEntityHeight:75,entityPadding:15,nodeSpacing:140,rankSpacing:80,stroke:"gray",fill:"honeydew",fontSize:12},pie:{useMaxWidth:!0,textPosition:.75,donutHole:0,legendPosition:"right",highlightSlice:""},quadrantChart:{useMaxWidth:!0,chartWidth:500,chartHeight:500,titleFontSize:20,titlePadding:10,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,xAxisPosition:"top",yAxisPosition:"left",quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2},xyChart:{useMaxWidth:!0,width:700,height:500,titleFontSize:20,titlePadding:10,showDataLabel:!1,showDataLabelOutsideBar:!1,showTitle:!0,xAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},yAxis:{$ref:"#/$defs/XYChartAxisConfig",showLabel:!0,labelFontSize:14,labelPadding:5,showTitle:!0,titleFontSize:16,titlePadding:5,showTick:!0,tickLength:5,tickWidth:2,showAxisLine:!0,axisLineWidth:2,labelRotation:0},chartOrientation:"vertical",plotReservedSpacePercent:50},requirement:{useMaxWidth:!0,rect_fill:"#f9f9f9",text_color:"#333",rect_border_size:"0.5px",rect_border_color:"#bbb",rect_min_width:200,rect_min_height:200,fontSize:14,rect_padding:10,line_height:20},mindmap:{useMaxWidth:!0,padding:10,maxNodeWidth:200,layoutAlgorithm:"cose-bilkent"},ishikawa:{useMaxWidth:!0,diagramPadding:20},kanban:{useMaxWidth:!0,padding:8,sectionWidth:200,ticketBaseUrl:""},timeline:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,leftMargin:150,width:150,height:50,boxMargin:10,boxTextMargin:5,noteMargin:10,messageMargin:35,messageAlign:"center",bottomMarginAdj:1,rightAngles:!1,taskFontSize:14,taskFontFamily:'"Open Sans", sans-serif',taskMargin:50,activationWidth:10,textPlacement:"fo",actorColours:["#8FBC8F","#7CFC00","#00FFFF","#20B2AA","#B0E0E6","#FFFFE0"],sectionFills:["#191970","#8B008B","#4B0082","#2F4F4F","#800000","#8B4513","#00008B"],sectionColours:["#fff"],disableMulticolor:!1},gitGraph:{useMaxWidth:!0,titleTopMargin:25,diagramPadding:8,nodeLabel:{width:75,height:100,x:-25,y:0},mainBranchName:"main",mainBranchOrder:0,showCommitLabel:!0,showBranches:!0,rotateCommitLabel:!0,parallelCommits:!1,arrowMarkerAbsolute:!1},c4:{useMaxWidth:!0,diagramMarginX:50,diagramMarginY:10,c4ShapeMargin:50,c4ShapePadding:20,width:216,height:60,boxMargin:10,c4ShapeInRow:4,nextLinePaddingX:0,c4BoundaryInRow:2,personFontSize:14,personFontFamily:'"Open Sans", sans-serif',personFontWeight:"normal",external_personFontSize:14,external_personFontFamily:'"Open Sans", sans-serif',external_personFontWeight:"normal",systemFontSize:14,systemFontFamily:'"Open Sans", sans-serif',systemFontWeight:"normal",external_systemFontSize:14,external_systemFontFamily:'"Open Sans", sans-serif',external_systemFontWeight:"normal",system_dbFontSize:14,system_dbFontFamily:'"Open Sans", sans-serif',system_dbFontWeight:"normal",external_system_dbFontSize:14,external_system_dbFontFamily:'"Open Sans", sans-serif',external_system_dbFontWeight:"normal",system_queueFontSize:14,system_queueFontFamily:'"Open Sans", sans-serif',system_queueFontWeight:"normal",external_system_queueFontSize:14,external_system_queueFontFamily:'"Open Sans", sans-serif',external_system_queueFontWeight:"normal",boundaryFontSize:14,boundaryFontFamily:'"Open Sans", sans-serif',boundaryFontWeight:"normal",messageFontSize:12,messageFontFamily:'"Open Sans", sans-serif',messageFontWeight:"normal",containerFontSize:14,containerFontFamily:'"Open Sans", sans-serif',containerFontWeight:"normal",external_containerFontSize:14,external_containerFontFamily:'"Open Sans", sans-serif',external_containerFontWeight:"normal",container_dbFontSize:14,container_dbFontFamily:'"Open Sans", sans-serif',container_dbFontWeight:"normal",external_container_dbFontSize:14,external_container_dbFontFamily:'"Open Sans", sans-serif',external_container_dbFontWeight:"normal",container_queueFontSize:14,container_queueFontFamily:'"Open Sans", sans-serif',container_queueFontWeight:"normal",external_container_queueFontSize:14,external_container_queueFontFamily:'"Open Sans", sans-serif',external_container_queueFontWeight:"normal",componentFontSize:14,componentFontFamily:'"Open Sans", sans-serif',componentFontWeight:"normal",external_componentFontSize:14,external_componentFontFamily:'"Open Sans", sans-serif',external_componentFontWeight:"normal",component_dbFontSize:14,component_dbFontFamily:'"Open Sans", sans-serif',component_dbFontWeight:"normal",external_component_dbFontSize:14,external_component_dbFontFamily:'"Open Sans", sans-serif',external_component_dbFontWeight:"normal",component_queueFontSize:14,component_queueFontFamily:'"Open Sans", sans-serif',component_queueFontWeight:"normal",external_component_queueFontSize:14,external_component_queueFontFamily:'"Open Sans", sans-serif',external_component_queueFontWeight:"normal",wrap:!0,wrapPadding:10,person_bg_color:"#08427B",person_border_color:"#073B6F",external_person_bg_color:"#686868",external_person_border_color:"#8A8A8A",system_bg_color:"#1168BD",system_border_color:"#3C7FC0",system_db_bg_color:"#1168BD",system_db_border_color:"#3C7FC0",system_queue_bg_color:"#1168BD",system_queue_border_color:"#3C7FC0",external_system_bg_color:"#999999",external_system_border_color:"#8A8A8A",external_system_db_bg_color:"#999999",external_system_db_border_color:"#8A8A8A",external_system_queue_bg_color:"#999999",external_system_queue_border_color:"#8A8A8A",container_bg_color:"#438DD5",container_border_color:"#3C7FC0",container_db_bg_color:"#438DD5",container_db_border_color:"#3C7FC0",container_queue_bg_color:"#438DD5",container_queue_border_color:"#3C7FC0",external_container_bg_color:"#B3B3B3",external_container_border_color:"#A6A6A6",external_container_db_bg_color:"#B3B3B3",external_container_db_border_color:"#A6A6A6",external_container_queue_bg_color:"#B3B3B3",external_container_queue_border_color:"#A6A6A6",component_bg_color:"#85BBF0",component_border_color:"#78A8D8",component_db_bg_color:"#85BBF0",component_db_border_color:"#78A8D8",component_queue_bg_color:"#85BBF0",component_queue_border_color:"#78A8D8",external_component_bg_color:"#CCCCCC",external_component_border_color:"#BFBFBF",external_component_db_bg_color:"#CCCCCC",external_component_db_border_color:"#BFBFBF",external_component_queue_bg_color:"#CCCCCC",external_component_queue_border_color:"#BFBFBF"},sankey:{useMaxWidth:!0,width:600,height:400,linkColor:"gradient",nodeAlignment:"justify",showValues:!0,prefix:"",suffix:"",nodeWidth:10,nodePadding:12,labelStyle:"legacy"},block:{useMaxWidth:!0,padding:8},packet:{useMaxWidth:!0,rowHeight:32,bitWidth:32,bitsPerRow:32,showBits:!0,paddingX:5,paddingY:5},treeView:{useMaxWidth:!0,rowIndent:10,paddingX:5,paddingY:5,lineThickness:1,showIcons:!1,defaultIconPack:"",filenameIcons:{},extensionIcons:{}},architecture:{useMaxWidth:!0,padding:40,iconSize:80,fontSize:16,randomize:!1,nodeSeparation:75,idealEdgeLengthMultiplier:1.5,edgeElasticity:.45,numIter:2500,seed:1},eventmodeling:{useMaxWidth:!0,padding:30,rowHeight:32},radar:{useMaxWidth:!0,width:600,height:600,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,axisScaleFactor:1,axisLabelFactor:1.05,curveTension:.17},venn:{useMaxWidth:!0,width:800,height:450,padding:8,useDebugLayout:!1},cynefin:{useMaxWidth:!0,width:800,height:600,padding:40,showDomainDescriptions:!0,boundaryAmplitude:8,seed:0},theme:"default",look:"classic",handDrawnSeed:0,layout:"dagre",maxTextSize:5e4,maxEdges:500,darkMode:!1,fontFamily:'"trebuchet ms", verdana, arial, sans-serif;',logLevel:5,securityLevel:"strict",startOnLoad:!0,arrowMarkerAbsolute:!1,secure:["secure","securityLevel","startOnLoad","maxTextSize","suppressErrorRendering","maxEdges"],legacyMathML:!1,forceLegacyMathML:!1,deterministicIds:!1,fontSize:16,markdownAutoWrap:!0,suppressErrorRendering:!1},Ec={...Wt,deterministicIDSeed:void 0,elk:{mergeEdges:!1,nodePlacementStrategy:"BRANDES_KOEPF",forceNodeModelOrder:!1,considerModelOrder:"NODES_AND_EDGES"},themeCSS:void 0,themeVariables:He.default.getThemeVariables(),sequence:{...Wt.sequence,messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont"),noteFont:p(function(){return{fontFamily:this.noteFontFamily,fontSize:this.noteFontSize,fontWeight:this.noteFontWeight}},"noteFont"),actorFont:p(function(){return{fontFamily:this.actorFontFamily,fontSize:this.actorFontSize,fontWeight:this.actorFontWeight}},"actorFont")},class:{hideEmptyMembersBox:!1,hierarchicalNamespaces:!0},gantt:{...Wt.gantt,tickInterval:void 0,useWidth:void 0},c4:{...Wt.c4,useWidth:void 0,personFont:p(function(){return{fontFamily:this.personFontFamily,fontSize:this.personFontSize,fontWeight:this.personFontWeight}},"personFont"),flowchart:{...Wt.flowchart,inheritDir:!1},external_personFont:p(function(){return{fontFamily:this.external_personFontFamily,fontSize:this.external_personFontSize,fontWeight:this.external_personFontWeight}},"external_personFont"),systemFont:p(function(){return{fontFamily:this.systemFontFamily,fontSize:this.systemFontSize,fontWeight:this.systemFontWeight}},"systemFont"),external_systemFont:p(function(){return{fontFamily:this.external_systemFontFamily,fontSize:this.external_systemFontSize,fontWeight:this.external_systemFontWeight}},"external_systemFont"),system_dbFont:p(function(){return{fontFamily:this.system_dbFontFamily,fontSize:this.system_dbFontSize,fontWeight:this.system_dbFontWeight}},"system_dbFont"),external_system_dbFont:p(function(){return{fontFamily:this.external_system_dbFontFamily,fontSize:this.external_system_dbFontSize,fontWeight:this.external_system_dbFontWeight}},"external_system_dbFont"),system_queueFont:p(function(){return{fontFamily:this.system_queueFontFamily,fontSize:this.system_queueFontSize,fontWeight:this.system_queueFontWeight}},"system_queueFont"),external_system_queueFont:p(function(){return{fontFamily:this.external_system_queueFontFamily,fontSize:this.external_system_queueFontSize,fontWeight:this.external_system_queueFontWeight}},"external_system_queueFont"),containerFont:p(function(){return{fontFamily:this.containerFontFamily,fontSize:this.containerFontSize,fontWeight:this.containerFontWeight}},"containerFont"),external_containerFont:p(function(){return{fontFamily:this.external_containerFontFamily,fontSize:this.external_containerFontSize,fontWeight:this.external_containerFontWeight}},"external_containerFont"),container_dbFont:p(function(){return{fontFamily:this.container_dbFontFamily,fontSize:this.container_dbFontSize,fontWeight:this.container_dbFontWeight}},"container_dbFont"),external_container_dbFont:p(function(){return{fontFamily:this.external_container_dbFontFamily,fontSize:this.external_container_dbFontSize,fontWeight:this.external_container_dbFontWeight}},"external_container_dbFont"),container_queueFont:p(function(){return{fontFamily:this.container_queueFontFamily,fontSize:this.container_queueFontSize,fontWeight:this.container_queueFontWeight}},"container_queueFont"),external_container_queueFont:p(function(){return{fontFamily:this.external_container_queueFontFamily,fontSize:this.external_container_queueFontSize,fontWeight:this.external_container_queueFontWeight}},"external_container_queueFont"),componentFont:p(function(){return{fontFamily:this.componentFontFamily,fontSize:this.componentFontSize,fontWeight:this.componentFontWeight}},"componentFont"),external_componentFont:p(function(){return{fontFamily:this.external_componentFontFamily,fontSize:this.external_componentFontSize,fontWeight:this.external_componentFontWeight}},"external_componentFont"),component_dbFont:p(function(){return{fontFamily:this.component_dbFontFamily,fontSize:this.component_dbFontSize,fontWeight:this.component_dbFontWeight}},"component_dbFont"),external_component_dbFont:p(function(){return{fontFamily:this.external_component_dbFontFamily,fontSize:this.external_component_dbFontSize,fontWeight:this.external_component_dbFontWeight}},"external_component_dbFont"),component_queueFont:p(function(){return{fontFamily:this.component_queueFontFamily,fontSize:this.component_queueFontSize,fontWeight:this.component_queueFontWeight}},"component_queueFont"),external_component_queueFont:p(function(){return{fontFamily:this.external_component_queueFontFamily,fontSize:this.external_component_queueFontSize,fontWeight:this.external_component_queueFontWeight}},"external_component_queueFont"),boundaryFont:p(function(){return{fontFamily:this.boundaryFontFamily,fontSize:this.boundaryFontSize,fontWeight:this.boundaryFontWeight}},"boundaryFont"),messageFont:p(function(){return{fontFamily:this.messageFontFamily,fontSize:this.messageFontSize,fontWeight:this.messageFontWeight}},"messageFont")},pie:{...Wt.pie,useWidth:984},xyChart:{...Wt.xyChart,useWidth:void 0},requirement:{...Wt.requirement,useWidth:void 0},packet:{...Wt.packet},eventmodeling:{...Wt.eventmodeling},treeView:{...Wt.treeView,useWidth:void 0},radar:{...Wt.radar},railroad:{...Wt.railroad,fontSize:void 0,fontFamily:void 0,terminalFill:void 0,terminalStroke:void 0,terminalTextColor:void 0,nonTerminalFill:void 0,nonTerminalStroke:void 0,nonTerminalTextColor:void 0,lineColor:void 0,markerFill:void 0,commentFill:void 0,commentStroke:void 0,commentTextColor:void 0,specialFill:void 0,specialStroke:void 0,ruleNameColor:void 0},ishikawa:{...Wt.ishikawa},sankey:{...Wt.sankey,nodeColors:void 0},treemap:{useMaxWidth:!0,padding:10,diagramPadding:8,showValues:!0,nodeWidth:100,nodeHeight:40,borderWidth:1,valueFontSize:12,labelFontSize:14,valueFormat:","},venn:{...Wt.venn},cynefin:{...Wt.cynefin}},Mc=p((e,t="")=>Object.keys(e).reduce((r,i)=>Array.isArray(e[i])?r:typeof e[i]=="object"&&e[i]!==null?[...r,t+i,...Mc(e[i],"")]:[...r,t+i],[]),"keyify"),F0=new Set(Mc(Ec,"")),$c=Ec,A0={nodeColors:/^#[\da-f]{3,8}$|^rgb\([\d\s%,.]+\)$|^hsl\([\d\s%,.]+\)$|^[a-z]+$/i,filenameIcons:/^[\w-]+(?::[\w-]+)?$/,extensionIcons:/^[\w-]+(?::[\w-]+)?$/},E0=p((e,t)=>{for(const r of Object.keys(e)){const i=e[r];(r.startsWith("__")||r.includes("proto")||r.includes("constr")||typeof i!="string"||!t.test(i))&&(q.debug("sanitize deleting dictionary entry:",r,i),delete e[r])}},"sanitizeDictionaryConfig"),Ro=p(e=>{if(q.debug("sanitizeDirective called with",e),!(typeof e!="object"||e==null)){if(Array.isArray(e)){e.forEach(t=>Ro(t));return}for(const t of Object.keys(e)){if(q.debug("Checking key",t),t.startsWith("__")||t.includes("proto")||t.includes("constr")||!F0.has(t)||e[t]==null){q.debug("sanitize deleting key: ",t),delete e[t];continue}if(typeof e[t]=="object"){const i=A0[t];i?E0(e[t],i):(q.debug("sanitizing object",t),Ro(e[t]));continue}const r=["themeCSS","fontFamily","altFontFamily"];for(const i of r)t.includes(i)&&(q.debug("sanitizing css option",t),e[t]=Oc(e[t]))}if(e.themeVariables)for(const t of Object.keys(e.themeVariables)){const r=e.themeVariables[t];r?.match&&!r.match(/^[\d "#%(),.;A-Za-z]+$/)&&(e.themeVariables[t]="")}q.debug("After sanitization",e)}},"sanitizeDirective"),Oc=p(e=>{let t=0,r=0;for(const i of e){if(t!(e===!1||["false","null","0"].includes(String(e).trim().toLowerCase())),"evaluate"),ie=Dt({},Qr),No,Tr=[],Mi=Dt({},Qr),ms=p((e,t)=>{let r=Dt({},e),i={};for(const o of t)Pc(o),i=Dt(i,o);if(r=Dt(r,i),i.theme&&i.theme in He){const o=Dt({},No),s=Dt(o.themeVariables||{},i.themeVariables);r.theme&&r.theme in He&&(r.themeVariables=He[r.theme].getThemeVariables(s))}return Mi=r,Nc(Mi),Mi},"updateCurrentConfig"),M0=p(e=>(ie=Dt({},Qr),ie=Dt(ie,e),e.theme&&He[e.theme]&&(ie.themeVariables=He[e.theme].getThemeVariables(e.themeVariables)),ms(ie,Tr),ie),"setSiteConfig"),$0=p(e=>{No=Dt({},e)},"saveConfigFromInitialize"),O0=p(e=>(ie=Dt(ie,e),ms(ie,Tr),ie),"updateSiteConfig"),Ic=p(()=>Dt({},ie),"getSiteConfig"),Dc=p(e=>(Nc(e),Dt(Mi,e),vt()),"setConfig"),vt=p(()=>Dt({},Mi),"getConfig"),Pc=p(e=>{e&&(["secure",...ie.secure??[]].forEach(t=>{Object.hasOwn(e,t)&&(q.debug(`Denied attempt to modify a secure key ${t}`,e[t]),delete e[t])}),Object.keys(e).forEach(t=>{t.startsWith("__")&&delete e[t]}),Object.keys(e).forEach(t=>{typeof e[t]=="string"&&(e[t].includes("<")||e[t].includes(">")||e[t].includes("url(data:"))&&delete e[t],typeof e[t]=="object"&&Pc(e[t])}))},"sanitize"),I0=p(e=>{Ro(e),e.fontFamily&&!e.themeVariables?.fontFamily&&(e.themeVariables={...e.themeVariables,fontFamily:e.fontFamily}),Tr.push(e),ms(ie,Tr)},"addDirective"),qo=p((e=ie)=>{Tr=[],ms(e,Tr)},"reset"),D0={LAZY_LOAD_DEPRECATED:"The configuration options lazyLoadedDiagrams and loadExternalDiagramsAtStartup are deprecated. Please use registerExternalDiagrams instead.",FLOWCHART_HTML_LABELS_DEPRECATED:"flowchart.htmlLabels is deprecated. Please use global htmlLabels instead."},ih={},Rc=p(e=>{ih[e]||(q.warn(D0[e]),ih[e]=!0)},"issueWarning"),Nc=p(e=>{e&&(e.lazyLoadedDiagrams||e.loadExternalDiagramsAtStartup)&&Rc("LAZY_LOAD_DEPRECATED")},"checkConfig"),kL=p(()=>{let e={};No&&(e=Dt(e,No));for(const t of Tr)e=Dt(e,t);return e},"getUserDefinedConfig"),ee=p(e=>(e.flowchart?.htmlLabels!=null&&Rc("FLOWCHART_HTML_LABELS_DEPRECATED"),Ie(e.htmlLabels??e.flowchart?.htmlLabels??!0)),"getEffectiveHtmlLabels"),qc=/^([^\S\n\r]*)-{3}\s*[\n\r](.*?)[\n\r]\1-{3}\s*[\n\r]+/s,$i=/%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi,P0=/\s*%%.*\n/gm,Wc=class extends Error{static{p(this,"UnknownDiagramError")}constructor(e){super(e),this.name="UnknownDiagramError"}},Sr={},xn=p(function(e,t){e=e.replace(qc,"").replace($i,"").replace(P0,` `);for(const[r,{detector:i}]of Object.entries(Sr))if(i(e,t))return r;throw new Wc(`No diagram type detected matching given configuration for text: ${e}`)},"detectType"),ba=p((...e)=>{for(const{id:t,detector:r,loader:i}of e)zc(t,r,i)},"registerLazyLoadedDiagrams"),zc=p((e,t,r)=>{Sr[e]&&q.warn(`Detector with key ${e} already exists. Overwriting.`),Sr[e]={detector:t,loader:r},q.debug(`Detector with key ${e} added${r?" with loader":""}`)},"addDetector"),R0=p(e=>Sr[e].loader,"getDiagramLoader"),Vi=//gi,N0=p(e=>e?Uc(e).replace(/\\n/g,"#br#").split("#br#"):[""],"getRows"),q0=(()=>{let e=!1;return()=>{e||(Hc(),e=!0)}})();function Hc(){const e="data-temp-href-target";Kr.addHook("beforeSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute("target")&&t.setAttribute(e,t.getAttribute("target")??"")}),Kr.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&t.hasAttribute(e)&&(t.setAttribute("target",t.getAttribute(e)??""),t.removeAttribute(e),t.getAttribute("target")==="_blank"&&t.setAttribute("rel","noopener"))})}p(Hc,"setupDompurifyHooks");var Yc=p(e=>(q0(),Kr.sanitize(e)),"removeScript"),oh=p((e,t)=>{if(ee(t)){const r=t.securityLevel;r==="antiscript"||r==="strict"||r==="sandbox"?e=Yc(e):r!=="loose"&&(e=Uc(e),e=e.replace(//g,">"),e=e.replace(/=/g,"="),e=Y0(e))}return e},"sanitizeMore"),be=p((e,t)=>e&&(t.dompurifyConfig?e=Kr.sanitize(oh(e,t),t.dompurifyConfig).toString():e=Kr.sanitize(oh(e,t),{FORBID_TAGS:["style"]}).toString(),e),"sanitizeText"),W0=p((e,t)=>typeof e=="string"?be(e,t):e.flat().map(r=>be(r,t)),"sanitizeTextOrArray"),z0=p(e=>Vi.test(e),"hasBreaks"),H0=p(e=>e.split(Vi),"splitBreaks"),Y0=p(e=>e.replace(/#br#/g,"
        "),"placeholderToBreak"),Uc=p(e=>e.replace(Vi,"#br#"),"breakToPlaceholder"),U0=p(e=>{let t="";return e&&(t=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,t=CSS.escape(t)),t},"getUrl"),j0=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.max(...t)},"getMax"),G0=p(function(...e){const t=e.filter(r=>!isNaN(r));return Math.min(...t)},"getMin"),sh=p(function(e){const t=e.split(/(,)/),r=[];for(let i=0;i0&&i+1Math.max(0,e.split(t).length-1),"countOccurrence"),X0=p((e,t)=>{const r=ka(e,"~"),i=ka(t,"~");return r===1&&i===1},"shouldCombineSets"),V0=p(e=>{const t=ka(e,"~");let r=!1;if(t<=1)return e;t%2!==0&&e.startsWith("~")&&(e=e.substring(1),r=!0);const i=[...e];let o=i.indexOf("~"),s=i.lastIndexOf("~");for(;o!==-1&&s!==-1&&o!==s;)i[o]="<",i[s]=">",o=i.indexOf("~"),s=i.lastIndexOf("~");return r&&i.unshift("~"),i.join("")},"processSet"),ah=p(()=>window.MathMLElement!==void 0,"isMathMLSupported"),wa=/\$\$(.*?)\$\$/g,Pi=p(e=>(e.match(wa)?.length??0)>0,"hasKatex"),wL=p(async(e,t)=>{const r=document.createElement("div");r.innerHTML=await jc(e,t),r.id="katex-temp",r.style.visibility="hidden",r.style.position="absolute",r.style.top="0",document.querySelector("body")?.insertAdjacentElement("beforeend",r);const o={width:r.clientWidth,height:r.clientHeight};return r.remove(),o},"calculateMathMLDimensions"),Z0=p(async(e,t)=>{if(!Pi(e))return e;if(!(ah()||t.legacyMathML||t.forceLegacyMathML))return e.replace(wa,"MathML is unsupported in this environment.");{const{default:r}=await nt(async()=>{const{default:o}=await import("./katex-HP8lGamR.js");return{default:o}},[]),i=t.forceLegacyMathML||!ah()&&t.legacyMathML?"htmlAndMathml":"mathml";return e.split(Vi).map(o=>Pi(o)?`
        ${o}
        `:`
        ${o}
        `).join("").replace(wa,(o,s)=>r.renderToString(s,{throwOnError:!0,displayMode:!0,output:i}).replace(/\n/g," ").replace(//g,""))}},"renderKatexUnsanitized"),jc=p(async(e,t)=>be(await Z0(e,t),t),"renderKatexSanitized"),Zi={getRows:N0,sanitizeText:be,sanitizeTextOrArray:W0,hasBreaks:z0,splitBreaks:H0,lineBreakRegex:Vi,removeScript:Yc,getUrl:U0,evaluate:Ie,getMax:j0,getMin:G0},K0=p(function(e,t){for(let r of t)e.attr(r[0],r[1])},"d3Attrs"),Q0=p(function(e,t,r){let i=new Map;return r?(i.set("width","100%"),i.set("style",`max-width: ${t}px;`)):(i.set("height",e),i.set("width",t)),i},"calculateSvgSizeAttrs"),Gc=p(function(e,t,r,i){const o=Q0(t,r,i);K0(e,o)},"configureSvgSize"),J0=p(function(e,t,r,i){const o=t.node().getBBox(),s=o.width,a=o.height;q.info(`SVG bounds: ${s}x${a}`,o);let n=0,l=0;q.info(`Graph bounds: ${n}x${l}`,e),n=s+r*2,l=a+r*2,q.info(`Calculated bounds: ${n}x${l}`),Gc(t,l,n,i);const c=`${o.x-r} ${o.y-r} ${o.width+2*r} ${o.height+2*r}`;t.attr("viewBox",c)},"setupGraphViewbox"),Bo={};function Ta(e){return[...e.cssRules].map(t=>t.cssText).join(` @@ -300,8 +300,8 @@ Please report this to https://github.com/markedjs/marked.`,t){let o="

        An error L0,20`)},"requirement_arrow"),LS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o;e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${s}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0 L20,10 M20,10 - L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),FS=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),AS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o,a=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");a.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),a.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),a.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),a.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),ES={extension:hS,composition:cS,aggregation:dS,dependency:uS,lollipop:fS,point:pS,circle:gS,cross:mS,barb:yS,barbNeo:CS,only_one:xS,zero_or_one:bS,one_or_more:kS,zero_or_more:wS,only_one_neo:TS,zero_or_one_neo:SS,one_or_more_neo:_S,zero_or_more_neo:BS,requirement_arrow:vS,requirement_contains:FS,requirement_arrow_neo:LS,requirement_contains_neo:AS},MS=lS,$S={common:Zi,getConfig:vt,insertCluster:LT,insertEdge:nS,insertEdgeLabel:tS,insertMarkers:MS,insertNode:Hg,interpolateToCurve:Vn,labelHelper:it,log:q,positionEdgeLabel:eS},Gi={},Gg=p(e=>{for(const t of e)Gi[t.name]=t},"registerLayoutLoaders"),OS=p(()=>{Gg([{name:"dagre",loader:p(async()=>await nt(()=>import("./dagre-VKFMJZFB-D8gdq5tS.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"swimlane",loader:p(async()=>await nt(()=>import("./swimlanes-5IMT3BWC-D6xMtJ1E.js"),__vite__mapDeps([8,5,6,1,2,3,7])),"loader")},{name:"cose-bilkent",loader:p(async()=>await nt(()=>import("./cose-bilkent-JH36ORCC-TWQPJk-P.js"),__vite__mapDeps([9,10,7,5,6])),"loader")}])},"registerDefaultLayoutLoaders");OS();var GL=p(async(e,t,r)=>{if(!(e.layoutAlgorithm in Gi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const i=Gi[e.layoutAlgorithm],o=await i.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),n){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return o.render(e,t,$S,{algorithm:i.algorithm},r)},"render"),XL=p((e="",{fallback:t="dagre"}={})=>{if(e in Gi)return e;if(t in Gi)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),ml="comm",Xg="rule",Vg="decl",IS="@media",DS="@import",PS="@supports",RS="@namespace",un="@keyframes",Zg="@layer",NS="@scope",qS=Math.abs,Di=String.fromCharCode;function Kg(e){return e.trim()}function fn(e,t,r){return e.replace(t,r)}function Zr(e,t){return e.charCodeAt(t)|0}function ii(e,t,r){return e.slice(t,r)}function Fe(e){return e.length}function Qg(e){return e.length}function To(e,t){return t.push(e),e}var Es=1,oi=1,Jg=0,ce=0,$t=0,ni="";function yl(e,t,r,i,o,s,a,n){return{value:e,root:t,parent:r,type:i,props:o,children:s,line:Es,column:oi,length:a,return:"",siblings:n}}function WS(){return $t}function zS(){return $t=ce>0?Zr(ni,--ce):0,oi--,$t===10&&(oi=1,Es--),$t}function xe(){return $t=ce2||Xi($t)>3?"":" "}function jS(e,t){for(;--t&&xe()&&!($t<48||$t>102||$t>57&&$t<65||$t>70&&$t<97););return Ms(e,Do()+(t<6&&ir()==32&&xe()==32))}function pn(e){for(;xe();)switch($t){case e:return ce;case 34:case 39:e!==34&&e!==39&&pn($t);break;case 40:e===41&&pn(e);break;case 92:xe();break}return ce}function GS(e,t){for(;xe()&&e+$t!==57;)if(e+$t===84&&ir()===47)break;return"/*"+Ms(t,ce-1)+"*"+Di(e===47?e:xe())}function XS(e){for(;!Xi(ir());)xe();return Ms(e,ce)}function VS(e){return YS(Po("",null,null,null,[""],e=HS(e),0,[0],e))}function Po(e,t,r,i,o,s,a,n,l){for(var c=0,h=0,d=a,f=0,u=0,g=0,m=1,y=1,C=1,b=0,k=0,T="",S=o,_=s,L=i,v=T;y;)switch(g=k,k=xe()){case 40:g!=108&&Zr(v,d-1)==58?(b++,v+="("):v+=ga(k);break;case 41:b--,v+=")";break;case 34:case 39:case 91:v+=ga(k);break;case 9:case 10:case 13:case 32:if(b>0){v+=Di(k);break}v+=US(g);break;case 92:v+=jS(Do()-1,7);continue;case 47:switch(ir()){case 42:case 47:To(ZS(GS(xe(),Do()),t,r,l),l),(Xi(g||1)==5||Xi(ir()||1)==5)&&Fe(v)&&ii(v,-1,void 0)!==" "&&(v+=" ");break;default:v+="/"}break;case 123*m:n[c++]=Fe(v)*C;case 125*m:case 59:case 0:if(b>0&&k){v+=Di(k);break}switch(k){case 0:case 125:y=0;case 59+h:C==-1&&(v=fn(v,/\f/g,"")),u>0&&(Fe(v)-d||m===0)&&To(u>32?bc(v+";",i,r,d-1,l):bc(fn(v," ","")+";",i,r,d-2,l),l);break;case 59:v+=";";default:if(To(L=xc(v,t,r,c,h,o,n,T,S=[],_=[],d,s),s),k===123)if(h===0)Po(v,t,L,L,S,s,d,n,_);else{switch(f){case 99:if(Zr(v,3)===110)break;case 108:if(Zr(v,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Po(e,L,L,i&&To(xc(e,L,L,0,0,o,n,T,o,S=[],d,_),_),o,_,d,n,i?S:_):Po(v,L,L,L,[""],_,0,n,_)}}c=h=u=0,m=C=1,T=v="",d=a;break;case 58:d=1+Fe(v),u=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&zS()==125)continue}switch(v+=Di(k),k*m){case 38:C=h>0?1:(v+="\f",-1);break;case 44:if(b>0)break;n[c++]=(Fe(v)-1)*C,C=1;break;case 64:ir()===45&&(v+=ga(xe())),f=ir(),h=d=Fe(T=v+=XS(Do())),k++;break;case 45:g===45&&Fe(v)==2&&(m=0)}}return s}function xc(e,t,r,i,o,s,a,n,l,c,h,d){for(var f=o-1,u=o===0?s:[""],g=Qg(u),m=0,y=0,C=0;m0?u[b]+" "+k:fn(k,/&\f/g,u[b])))&&(l[C++]=T);return yl(e,t,r,o===0?Xg:n,l,c,h,d)}function ZS(e,t,r,i){return yl(e,t,r,ml,Di(WS()),ii(e,2,-2),0,i)}function bc(e,t,r,i,o){return yl(e,t,r,Vg,ii(e,0,i),ii(e,i+1,-1),i,o)}function gn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),t_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-CUyKVoVi.js");return{diagram:t}},__vite__mapDeps([11,12,5,6,7]));return{id:tm,diagram:e}},"loader"),e_={id:tm,detector:JS,loader:t_},r_=e_,em="flowchart",i_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),o_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:em,diagram:e}},"loader"),s_={id:em,detector:i_,loader:o_},a_=s_,rm="flowchart-v2",n_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),l_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:rm,diagram:e}},"loader"),h_={id:rm,detector:n_,loader:l_},c_=h_,im="swimlane",d_=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),u_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-DKIx012r.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,16,12,17,5,6,7]));return{id:im,diagram:e}},"loader"),f_={id:im,detector:d_,loader:u_},p_=f_,om="er",g_=p(e=>/^\s*erDiagram/.test(e),"detector"),m_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-DVzumNgk.js");return{diagram:t}},__vite__mapDeps([19,15,16,17,5,6,7]));return{id:om,diagram:e}},"loader"),y_={id:om,detector:g_,loader:m_},C_=y_,sm="gitGraph",x_=p(e=>/^\s*gitGraph/.test(e),"detector"),b_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-D7UBC8np.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,5,6,7]));return{id:sm,diagram:e}},"loader"),k_={id:sm,detector:x_,loader:b_},w_=k_,am="gantt",T_=p(e=>/^\s*gantt/.test(e),"detector"),S_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-B2lfrNfh.js");return{diagram:t}},__vite__mapDeps([24,7,25,26,27,5,6]));return{id:am,diagram:e}},"loader"),__={id:am,detector:T_,loader:S_},B_=__,nm="info",v_=p(e=>/^\s*info/.test(e),"detector"),L_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-DASw56fH.js");return{diagram:t}},__vite__mapDeps([28,23,5,6,7]));return{id:nm,diagram:e}},"loader"),F_={id:nm,detector:v_,loader:L_},lm="pie",A_=p(e=>/^\s*pie/.test(e),"detector"),E_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-f3F4At6v.js");return{diagram:t}},__vite__mapDeps([29,22,23,5,6,30,31,26,7]));return{id:lm,diagram:e}},"loader"),M_={id:lm,detector:A_,loader:E_},hm="quadrantChart",$_=p(e=>/^\s*quadrantChart/.test(e),"detector"),O_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-3t7sFhfl.js");return{diagram:t}},__vite__mapDeps([32,25,26,27,5,6,7]));return{id:hm,diagram:e}},"loader"),I_={id:hm,detector:$_,loader:O_},D_=I_,cm="xychart",P_=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),R_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-yQImOWPy.js");return{diagram:t}},__vite__mapDeps([33,26,31,25,27,5,6,7]));return{id:cm,diagram:e}},"loader"),N_={id:cm,detector:P_,loader:R_},q_=N_,dm="requirement",W_=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-Bzvt0v7J.js");return{diagram:t}},__vite__mapDeps([34,15,16,5,6,7]));return{id:dm,diagram:e}},"loader"),H_={id:dm,detector:W_,loader:z_},Y_=H_,um="sequence",U_=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),j_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-CnV0H-kS.js");return{diagram:t}},__vite__mapDeps([35,21,12,5,6,7]));return{id:um,diagram:e}},"loader"),G_={id:um,detector:U_,loader:j_},X_=G_,fm="class",V_=p((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-ClMG95L0.js");return{diagram:t}},__vite__mapDeps([36,37,14,15,16,12,5,6,7]));return{id:fm,diagram:e}},"loader"),K_={id:fm,detector:V_,loader:Z_},Q_=K_,pm="classDiagram",J_=p((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),tB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-ClMG95L0.js");return{diagram:t}},__vite__mapDeps([38,37,14,15,16,12,5,6,7]));return{id:pm,diagram:e}},"loader"),eB={id:pm,detector:J_,loader:tB},rB=eB,gm="state",iB=p((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-GIVsAB2M.js");return{diagram:t}},__vite__mapDeps([39,40,15,16,12,2,4,3,5,6,7]));return{id:gm,diagram:e}},"loader"),sB={id:gm,detector:iB,loader:oB},aB=sB,mm="stateDiagram",nB=p((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),lB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB-0KuGlzV7.js");return{diagram:t}},__vite__mapDeps([41,40,15,16,12,5,6,7]));return{id:mm,diagram:e}},"loader"),hB={id:mm,detector:nB,loader:lB},cB=hB,ym="journey",dB=p(e=>/^\s*journey/.test(e),"detector"),uB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-BShuBRgf.js");return{diagram:t}},__vite__mapDeps([42,14,12,30,5,6,7]));return{id:ym,diagram:e}},"loader"),fB={id:ym,detector:dB,loader:uB},pB=fB,gB=p((e,t,r)=>{q.debug(`rendering svg for syntax error -`);const i=Yk(t),o=i.append("g");i.attr("viewBox","0 0 2412 512"),Gc(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Cm={draw:gB},mB=Cm,yB={db:{},renderer:Cm,parser:{parse:p(()=>{},"parse")}},CB=yB,xm="flowchart-elk",xB=p((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),bB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CzI-GKO4.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:xm,diagram:e}},"loader"),kB={id:xm,detector:xB,loader:bB},wB=kB,bm="timeline",TB=p(e=>/^\s*timeline/.test(e),"detector"),SB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-5u0AN8o0.js");return{diagram:t}},__vite__mapDeps([43,30,5,6,7]));return{id:bm,diagram:e}},"loader"),_B={id:bm,detector:TB,loader:SB},BB=_B,km="mindmap",vB=p(e=>/^\s*mindmap/.test(e),"detector"),LB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-HXhM1kRL.js");return{diagram:t}},__vite__mapDeps([44,15,16,5,6,7]));return{id:km,diagram:e}},"loader"),FB={id:km,detector:vB,loader:LB},AB=FB,wm="kanban",EB=p(e=>/^\s*kanban/.test(e),"detector"),MB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-_UoHLqzR.js");return{diagram:t}},__vite__mapDeps([45,14,5,6,7]));return{id:wm,diagram:e}},"loader"),$B={id:wm,detector:EB,loader:MB},OB=$B,Tm="sankey",IB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),DB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-B5WnWxzh.js");return{diagram:t}},__vite__mapDeps([46,31,26,5,6,7]));return{id:Tm,diagram:e}},"loader"),PB={id:Tm,detector:IB,loader:DB},RB=PB,Sm="packet",NB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),qB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-DUn2m-AO.js");return{diagram:t}},__vite__mapDeps([47,22,23,5,6,7]));return{id:Sm,diagram:e}},"loader"),WB={id:Sm,detector:NB,loader:qB},_m="radar",zB=p(e=>/^\s*radar-beta/.test(e),"detector"),HB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-CFwFRAWa.js");return{diagram:t}},__vite__mapDeps([48,22,23,5,6,7]));return{id:_m,diagram:e}},"loader"),YB={id:_m,detector:zB,loader:HB},Bm="block",UB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-BNXb88Fr.js");return{diagram:t}},__vite__mapDeps([49,14,2,17,5,6,7]));return{id:Bm,diagram:e}},"loader"),GB={id:Bm,detector:UB,loader:jB},XB=GB,vm="treeView",VB=p(e=>/^\s*treeView-beta/.test(e),"detector"),ZB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP-BOIp7TNe.js");return{diagram:t}},__vite__mapDeps([50,21,22,23,5,6,7]));return{id:vm,diagram:e}},"loader"),KB={id:vm,detector:VB,loader:ZB},QB=KB,Lm="architecture",JB=p(e=>/^\s*architecture/.test(e),"detector"),tv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-CBluWNBt.js");return{diagram:t}},__vite__mapDeps([51,22,23,5,6,10,7]));return{id:Lm,diagram:e}},"loader"),ev={id:Lm,detector:JB,loader:tv},rv=ev,Fm="eventmodeling",iv=p(e=>/^\s*eventmodeling/.test(e),"detector"),ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-D2bRXH1a.js");return{diagram:t}},__vite__mapDeps([52,22,23,5,6,7]));return{id:Fm,diagram:e}},"loader"),sv={id:Fm,detector:iv,loader:ov},av=sv,Am="ishikawa",nv=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-CcPuml-k.js");return{diagram:t}},__vite__mapDeps([53,5,6,7]));return{id:Am,diagram:e}},"loader"),hv={id:Am,detector:nv,loader:lv},Em="venn",cv=p(e=>/^\s*venn-beta/.test(e),"detector"),dv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-ozNTLnJz.js");return{diagram:t}},__vite__mapDeps([54,5,6,7]));return{id:Em,diagram:e}},"loader"),uv={id:Em,detector:cv,loader:dv},fv=uv,Mm="treemap",pv=p(e=>/^\s*treemap/.test(e),"detector"),gv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-BF9x_uf7.js");return{diagram:t}},__vite__mapDeps([55,22,16,23,5,6,27,31,26,7]));return{id:Mm,diagram:e}},"loader"),mv={id:Mm,detector:pv,loader:gv},$m="wardley",yv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),Cv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-BuQJYWm-.js");return{diagram:t}},__vite__mapDeps([56,22,23,5,6,7]));return{id:$m,diagram:e}},"loader"),xv={id:$m,detector:yv,loader:Cv},bv=xv,Om="cynefin",kv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),wv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-zQaCQNIP.js");return{diagram:t}},__vite__mapDeps([57,22,23,5,6,7]));return{id:Om,diagram:e}},"loader"),Tv={id:Om,detector:kv,loader:wv},Im="railroad",Sv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-W9nf8fYD.js");return{diagram:t}},__vite__mapDeps([58,59,22,23,5,6,7]));return{id:Im,diagram:e}},"loader"),Bv={id:Im,detector:Sv,loader:_v},Dm="railroadEbnf",vv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-B4NTctc_.js");return{diagram:t}},__vite__mapDeps([60,59,22,23,5,6,7]));return{id:Dm,diagram:e}},"loader"),Fv={id:Dm,detector:vv,loader:Lv},Pm="railroadAbnf",Av=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Ev=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-C0Afmuc1.js");return{diagram:t}},__vite__mapDeps([61,59,22,23,5,6,7]));return{id:Pm,diagram:e}},"loader"),Mv={id:Pm,detector:Av,loader:Ev},Rm="railroadPeg",$v=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),Ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-_6D7zUy-.js");return{diagram:t}},__vite__mapDeps([62,59,22,23,5,6,7]));return{id:Rm,diagram:e}},"loader"),Iv={id:Rm,detector:$v,loader:Ov},kc=!1,$s=p(()=>{kc||(kc=!0,zo("error",CB,e=>e.toLowerCase().trim()==="error"),zo("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ba(wB,AB,rv),ba(r_,OB,rB,Q_,C_,B_,F_,M_,Y_,X_,p_,c_,a_,BB,w_,cB,aB,pB,D_,RB,WB,q_,XB,av,QB,YB,hv,mv,Bv,Fv,Mv,Iv,fv,bv,Tv))},"addDiagrams"),Dv=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Sr).map(async([r,{detector:i,loader:o}])=>{if(o)try{Sa(r)}catch{try{const{diagram:s,id:a}=await o();zo(a,s,i)}catch(s){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Sr[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Pv="graphics-document document";function Nm(e,t){e.attr("role",Pv),t!==""&&e.attr("aria-roledescription",t)}p(Nm,"setA11yDiagramInfo");function qm(e,t,r,i){if(e.insert!==void 0){if(r){const o=`chart-desc-${i}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(r)}if(t){const o=`chart-title-${i}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(t)}}}p(qm,"addSVGa11yTitleDescription");var mn=class Wm{constructor(t,r,i,o,s){this.type=t,this.text=r,this.db=i,this.parser=o,this.renderer=s}static{p(this,"Diagram")}static async fromText(t,r={}){const i=vt(),o=xn(t,i);t=Z2(t)+` + L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),FS=p((e,t,r)=>{const i=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),AS=p((e,t,r)=>{const i=vt(),{themeVariables:o}=i,{strokeWidth:s}=o,a=e.append("defs").append("marker").attr("id",r+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");a.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),a.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),a.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),a.selectAll("*").attr("stroke-width",`${s}`)},"requirement_contains_neo"),ES={extension:hS,composition:cS,aggregation:dS,dependency:uS,lollipop:fS,point:pS,circle:gS,cross:mS,barb:yS,barbNeo:CS,only_one:xS,zero_or_one:bS,one_or_more:kS,zero_or_more:wS,only_one_neo:TS,zero_or_one_neo:SS,one_or_more_neo:_S,zero_or_more_neo:BS,requirement_arrow:vS,requirement_contains:FS,requirement_arrow_neo:LS,requirement_contains_neo:AS},MS=lS,$S={common:Zi,getConfig:vt,insertCluster:LT,insertEdge:nS,insertEdgeLabel:tS,insertMarkers:MS,insertNode:Hg,interpolateToCurve:Vn,labelHelper:it,log:q,positionEdgeLabel:eS},Gi={},Gg=p(e=>{for(const t of e)Gi[t.name]=t},"registerLayoutLoaders"),OS=p(()=>{Gg([{name:"dagre",loader:p(async()=>await nt(()=>import("./dagre-VKFMJZFB-CxsYi2pz.js"),__vite__mapDeps([0,1,2,3,4,5,6,7])),"loader")},{name:"swimlane",loader:p(async()=>await nt(()=>import("./swimlanes-5IMT3BWC-C7_SkVdK.js"),__vite__mapDeps([8,5,6,1,2,3,7])),"loader")},{name:"cose-bilkent",loader:p(async()=>await nt(()=>import("./cose-bilkent-JH36ORCC-kIdO2NbL.js"),__vite__mapDeps([9,10,7,5,6])),"loader")}])},"registerDefaultLayoutLoaders");OS();var GL=p(async(e,t,r)=>{if(!(e.layoutAlgorithm in Gi))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);if(e.diagramId)for(const d of e.nodes){const f=d.domId||d.id;d.domId=`${e.diagramId}-${f}`}const i=Gi[e.layoutAlgorithm],o=await i.loader(),{theme:s,themeVariables:a}=e.config,{useGradient:n,gradientStart:l,gradientStop:c}=a,h=t.attr("id");if(t.append("defs").append("filter").attr("id",`${h}-drop-shadow`).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),t.append("defs").append("filter").attr("id",`${h}-drop-shadow-small`).attr("height","150%").attr("width","150%").append("feDropShadow").attr("dx","2").attr("dy","2").attr("stdDeviation",0).attr("flood-opacity","0.06").attr("flood-color",`${s?.includes("dark")?"#FFFFFF":"#000000"}`),n){const d=t.append("linearGradient").attr("id",t.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");d.append("svg:stop").attr("offset","0%").attr("stop-color",l).attr("stop-opacity",1),d.append("svg:stop").attr("offset","100%").attr("stop-color",c).attr("stop-opacity",1)}return o.render(e,t,$S,{algorithm:i.algorithm},r)},"render"),XL=p((e="",{fallback:t="dagre"}={})=>{if(e in Gi)return e;if(t in Gi)return q.warn(`Layout algorithm ${e} is not registered. Using ${t} as fallback.`),t;throw new Error(`Both layout algorithms ${e} and ${t} are not registered.`)},"getRegisteredLayoutAlgorithm"),ml="comm",Xg="rule",Vg="decl",IS="@media",DS="@import",PS="@supports",RS="@namespace",un="@keyframes",Zg="@layer",NS="@scope",qS=Math.abs,Di=String.fromCharCode;function Kg(e){return e.trim()}function fn(e,t,r){return e.replace(t,r)}function Zr(e,t){return e.charCodeAt(t)|0}function ii(e,t,r){return e.slice(t,r)}function Fe(e){return e.length}function Qg(e){return e.length}function To(e,t){return t.push(e),e}var Es=1,oi=1,Jg=0,ce=0,$t=0,ni="";function yl(e,t,r,i,o,s,a,n){return{value:e,root:t,parent:r,type:i,props:o,children:s,line:Es,column:oi,length:a,return:"",siblings:n}}function WS(){return $t}function zS(){return $t=ce>0?Zr(ni,--ce):0,oi--,$t===10&&(oi=1,Es--),$t}function xe(){return $t=ce2||Xi($t)>3?"":" "}function jS(e,t){for(;--t&&xe()&&!($t<48||$t>102||$t>57&&$t<65||$t>70&&$t<97););return Ms(e,Do()+(t<6&&ir()==32&&xe()==32))}function pn(e){for(;xe();)switch($t){case e:return ce;case 34:case 39:e!==34&&e!==39&&pn($t);break;case 40:e===41&&pn(e);break;case 92:xe();break}return ce}function GS(e,t){for(;xe()&&e+$t!==57;)if(e+$t===84&&ir()===47)break;return"/*"+Ms(t,ce-1)+"*"+Di(e===47?e:xe())}function XS(e){for(;!Xi(ir());)xe();return Ms(e,ce)}function VS(e){return YS(Po("",null,null,null,[""],e=HS(e),0,[0],e))}function Po(e,t,r,i,o,s,a,n,l){for(var c=0,h=0,d=a,f=0,u=0,g=0,m=1,y=1,C=1,b=0,k=0,T="",S=o,_=s,L=i,v=T;y;)switch(g=k,k=xe()){case 40:g!=108&&Zr(v,d-1)==58?(b++,v+="("):v+=ga(k);break;case 41:b--,v+=")";break;case 34:case 39:case 91:v+=ga(k);break;case 9:case 10:case 13:case 32:if(b>0){v+=Di(k);break}v+=US(g);break;case 92:v+=jS(Do()-1,7);continue;case 47:switch(ir()){case 42:case 47:To(ZS(GS(xe(),Do()),t,r,l),l),(Xi(g||1)==5||Xi(ir()||1)==5)&&Fe(v)&&ii(v,-1,void 0)!==" "&&(v+=" ");break;default:v+="/"}break;case 123*m:n[c++]=Fe(v)*C;case 125*m:case 59:case 0:if(b>0&&k){v+=Di(k);break}switch(k){case 0:case 125:y=0;case 59+h:C==-1&&(v=fn(v,/\f/g,"")),u>0&&(Fe(v)-d||m===0)&&To(u>32?bc(v+";",i,r,d-1,l):bc(fn(v," ","")+";",i,r,d-2,l),l);break;case 59:v+=";";default:if(To(L=xc(v,t,r,c,h,o,n,T,S=[],_=[],d,s),s),k===123)if(h===0)Po(v,t,L,L,S,s,d,n,_);else{switch(f){case 99:if(Zr(v,3)===110)break;case 108:if(Zr(v,2)===97)break;default:h=0;case 100:case 109:case 115:}h?Po(e,L,L,i&&To(xc(e,L,L,0,0,o,n,T,o,S=[],d,_),_),o,_,d,n,i?S:_):Po(v,L,L,L,[""],_,0,n,_)}}c=h=u=0,m=C=1,T=v="",d=a;break;case 58:d=1+Fe(v),u=g;default:if(m<1){if(k==123)--m;else if(k==125&&m++==0&&zS()==125)continue}switch(v+=Di(k),k*m){case 38:C=h>0?1:(v+="\f",-1);break;case 44:if(b>0)break;n[c++]=(Fe(v)-1)*C,C=1;break;case 64:ir()===45&&(v+=ga(xe())),f=ir(),h=d=Fe(T=v+=XS(Do())),k++;break;case 45:g===45&&Fe(v)==2&&(m=0)}}return s}function xc(e,t,r,i,o,s,a,n,l,c,h,d){for(var f=o-1,u=o===0?s:[""],g=Qg(u),m=0,y=0,C=0;m0?u[b]+" "+k:fn(k,/&\f/g,u[b])))&&(l[C++]=T);return yl(e,t,r,o===0?Xg:n,l,c,h,d)}function ZS(e,t,r,i){return yl(e,t,r,ml,Di(WS()),ii(e,2,-2),0,i)}function bc(e,t,r,i,o){return yl(e,t,r,Vg,ii(e,0,i),ii(e,i+1,-1),i,o)}function gn(e,t){for(var r="",i=0;i/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),t_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./c4Diagram-LMCZKHZV-0GQGcOcv.js");return{diagram:t}},__vite__mapDeps([11,12,5,6,7]));return{id:tm,diagram:e}},"loader"),e_={id:tm,detector:JS,loader:t_},r_=e_,em="flowchart",i_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-wrapper"||t?.flowchart?.defaultRenderer==="elk"?!1:/^\s*graph/.test(e),"detector"),o_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CB0TxYKC.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:em,diagram:e}},"loader"),s_={id:em,detector:i_,loader:o_},a_=s_,rm="flowchart-v2",n_=p((e,t)=>t?.flowchart?.defaultRenderer==="dagre-d3"?!1:(t?.flowchart?.defaultRenderer==="elk"&&(t.layout="elk"),/^\s*graph/.test(e)&&t?.flowchart?.defaultRenderer==="dagre-wrapper"?!0:/^\s*flowchart/.test(e)),"detector"),l_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CB0TxYKC.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:rm,diagram:e}},"loader"),h_={id:rm,detector:n_,loader:l_},c_=h_,im="swimlane",d_=p(e=>/^\s*swimlane-beta\b/.test(e),"detector"),u_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./swimlanesDiagram-G3AALYLV-BWdA3bDm.js");return{diagram:t}},__vite__mapDeps([18,13,14,15,16,12,17,5,6,7]));return{id:im,diagram:e}},"loader"),f_={id:im,detector:d_,loader:u_},p_=f_,om="er",g_=p(e=>/^\s*erDiagram/.test(e),"detector"),m_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./erDiagram-Q63AITRT-CKt0tq4n.js");return{diagram:t}},__vite__mapDeps([19,15,16,17,5,6,7]));return{id:om,diagram:e}},"loader"),y_={id:om,detector:g_,loader:m_},C_=y_,sm="gitGraph",x_=p(e=>/^\s*gitGraph/.test(e),"detector"),b_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./gitGraphDiagram-IHSO6WYX-9OkgrWLV.js");return{diagram:t}},__vite__mapDeps([20,21,22,23,5,6,7]));return{id:sm,diagram:e}},"loader"),k_={id:sm,detector:x_,loader:b_},w_=k_,am="gantt",T_=p(e=>/^\s*gantt/.test(e),"detector"),S_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ganttDiagram-NO4QXBWP-BkswX2CL.js");return{diagram:t}},__vite__mapDeps([24,7,25,26,27,5,6]));return{id:am,diagram:e}},"loader"),__={id:am,detector:T_,loader:S_},B_=__,nm="info",v_=p(e=>/^\s*info/.test(e),"detector"),L_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./infoDiagram-FWYZ7A6U-Dpbgmc1e.js");return{diagram:t}},__vite__mapDeps([28,23,5,6,7]));return{id:nm,diagram:e}},"loader"),F_={id:nm,detector:v_,loader:L_},lm="pie",A_=p(e=>/^\s*pie/.test(e),"detector"),E_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pieDiagram-ENE6RG2P-8g8etfu6.js");return{diagram:t}},__vite__mapDeps([29,22,23,5,6,30,31,26,7]));return{id:lm,diagram:e}},"loader"),M_={id:lm,detector:A_,loader:E_},hm="quadrantChart",$_=p(e=>/^\s*quadrantChart/.test(e),"detector"),O_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./quadrantDiagram-ABIIQ3AL-BxCL4sof.js");return{diagram:t}},__vite__mapDeps([32,25,26,27,5,6,7]));return{id:hm,diagram:e}},"loader"),I_={id:hm,detector:$_,loader:O_},D_=I_,cm="xychart",P_=p(e=>/^\s*xychart(-beta)?/.test(e),"detector"),R_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./xychartDiagram-FW5EYKEG-BklSkO6g.js");return{diagram:t}},__vite__mapDeps([33,26,31,25,27,5,6,7]));return{id:cm,diagram:e}},"loader"),N_={id:cm,detector:P_,loader:R_},q_=N_,dm="requirement",W_=p(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./requirementDiagram-TGXJPOKE-Cgysyqsi.js");return{diagram:t}},__vite__mapDeps([34,15,16,5,6,7]));return{id:dm,diagram:e}},"loader"),H_={id:dm,detector:W_,loader:z_},Y_=H_,um="sequence",U_=p(e=>/^\s*sequenceDiagram/.test(e),"detector"),j_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sequenceDiagram-DBY2YBRQ-FwgGv3En.js");return{diagram:t}},__vite__mapDeps([35,21,12,5,6,7]));return{id:um,diagram:e}},"loader"),G_={id:um,detector:U_,loader:j_},X_=G_,fm="class",V_=p((e,t)=>t?.class?.defaultRenderer==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e),"detector"),Z_=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-OUVF2IWQ-DM4TZiKk.js");return{diagram:t}},__vite__mapDeps([36,37,14,15,16,12,5,6,7]));return{id:fm,diagram:e}},"loader"),K_={id:fm,detector:V_,loader:Z_},Q_=K_,pm="classDiagram",J_=p((e,t)=>/^\s*classDiagram/.test(e)&&t?.class?.defaultRenderer==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e),"detector"),tB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./classDiagram-v2-EOCWNBFH-DM4TZiKk.js");return{diagram:t}},__vite__mapDeps([38,37,14,15,16,12,5,6,7]));return{id:pm,diagram:e}},"loader"),eB={id:pm,detector:J_,loader:tB},rB=eB,gm="state",iB=p((e,t)=>t?.state?.defaultRenderer==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e),"detector"),oB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-2N3HPSRC-CR3yEYk8.js");return{diagram:t}},__vite__mapDeps([39,40,15,16,12,2,4,3,5,6,7]));return{id:gm,diagram:e}},"loader"),sB={id:gm,detector:iB,loader:oB},aB=sB,mm="stateDiagram",nB=p((e,t)=>!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&t?.state?.defaultRenderer==="dagre-wrapper"),"detector"),lB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./stateDiagram-v2-6OUMAXLB--VVJVX-W.js");return{diagram:t}},__vite__mapDeps([41,40,15,16,12,5,6,7]));return{id:mm,diagram:e}},"loader"),hB={id:mm,detector:nB,loader:lB},cB=hB,ym="journey",dB=p(e=>/^\s*journey/.test(e),"detector"),uB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./journeyDiagram-5HDEW3XC-DCwR4Nt_.js");return{diagram:t}},__vite__mapDeps([42,14,12,30,5,6,7]));return{id:ym,diagram:e}},"loader"),fB={id:ym,detector:dB,loader:uB},pB=fB,gB=p((e,t,r)=>{q.debug(`rendering svg for syntax error +`);const i=Yk(t),o=i.append("g");i.attr("viewBox","0 0 2412 512"),Gc(i,100,512,!0),o.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),o.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),o.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),o.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),o.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),o.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),o.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),o.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${r}`)},"draw"),Cm={draw:gB},mB=Cm,yB={db:{},renderer:Cm,parser:{parse:p(()=>{},"parse")}},CB=yB,xm="flowchart-elk",xB=p((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer==="elk"?(t.layout="elk",!0):!1,"detector"),bB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./flowDiagram-23GEKE2U-CB0TxYKC.js").then(r=>r.f);return{diagram:t}},__vite__mapDeps([13,14,15,16,12,17]));return{id:xm,diagram:e}},"loader"),kB={id:xm,detector:xB,loader:bB},wB=kB,bm="timeline",TB=p(e=>/^\s*timeline/.test(e),"detector"),SB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./timeline-definition-FHXFAJF6-DlAcudfE.js");return{diagram:t}},__vite__mapDeps([43,30,5,6,7]));return{id:bm,diagram:e}},"loader"),_B={id:bm,detector:TB,loader:SB},BB=_B,km="mindmap",vB=p(e=>/^\s*mindmap/.test(e),"detector"),LB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./mindmap-definition-LN4V7U3C-Cg1epIhw.js");return{diagram:t}},__vite__mapDeps([44,15,16,5,6,7]));return{id:km,diagram:e}},"loader"),FB={id:km,detector:vB,loader:LB},AB=FB,wm="kanban",EB=p(e=>/^\s*kanban/.test(e),"detector"),MB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./kanban-definition-HUTT4EX6-CArc2b0u.js");return{diagram:t}},__vite__mapDeps([45,14,5,6,7]));return{id:wm,diagram:e}},"loader"),$B={id:wm,detector:EB,loader:MB},OB=$B,Tm="sankey",IB=p(e=>/^\s*sankey(-beta)?/.test(e),"detector"),DB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./sankeyDiagram-HTMAVEWB-BqJCXBk-.js");return{diagram:t}},__vite__mapDeps([46,31,26,5,6,7]));return{id:Tm,diagram:e}},"loader"),PB={id:Tm,detector:IB,loader:DB},RB=PB,Sm="packet",NB=p(e=>/^\s*packet(-beta)?/.test(e),"detector"),qB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-NH7WQ7WH-Db_YtFB_.js");return{diagram:t}},__vite__mapDeps([47,22,23,5,6,7]));return{id:Sm,diagram:e}},"loader"),WB={id:Sm,detector:NB,loader:qB},_m="radar",zB=p(e=>/^\s*radar-beta/.test(e),"detector"),HB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-WEI45ONY-QxbY7aVv.js");return{diagram:t}},__vite__mapDeps([48,22,23,5,6,7]));return{id:_m,diagram:e}},"loader"),YB={id:_m,detector:zB,loader:HB},Bm="block",UB=p(e=>/^\s*block(-beta)?/.test(e),"detector"),jB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./blockDiagram-677ZJIJ3-CRh0VMzc.js");return{diagram:t}},__vite__mapDeps([49,14,2,17,5,6,7]));return{id:Bm,diagram:e}},"loader"),GB={id:Bm,detector:UB,loader:jB},XB=GB,vm="treeView",VB=p(e=>/^\s*treeView-beta/.test(e),"detector"),ZB=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-OA4YK3LP--Kd1fr8_.js");return{diagram:t}},__vite__mapDeps([50,21,22,23,5,6,7]));return{id:vm,diagram:e}},"loader"),KB={id:vm,detector:VB,loader:ZB},QB=KB,Lm="architecture",JB=p(e=>/^\s*architecture/.test(e),"detector"),tv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./architectureDiagram-ZJ3FMSHR-BJZpYPA7.js");return{diagram:t}},__vite__mapDeps([51,22,23,5,6,10,7]));return{id:Lm,diagram:e}},"loader"),ev={id:Lm,detector:JB,loader:tv},rv=ev,Fm="eventmodeling",iv=p(e=>/^\s*eventmodeling/.test(e),"detector"),ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-FQU43EPY-BxnsH35m.js");return{diagram:t}},__vite__mapDeps([52,22,23,5,6,7]));return{id:Fm,diagram:e}},"loader"),sv={id:Fm,detector:iv,loader:ov},av=sv,Am="ishikawa",nv=p(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ishikawaDiagram-FXEZZL3T-BA2yx5LI.js");return{diagram:t}},__vite__mapDeps([53,5,6,7]));return{id:Am,diagram:e}},"loader"),hv={id:Am,detector:nv,loader:lv},Em="venn",cv=p(e=>/^\s*venn-beta/.test(e),"detector"),dv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./vennDiagram-L72KCM5P-BV2kbjhg.js");return{diagram:t}},__vite__mapDeps([54,5,6,7]));return{id:Em,diagram:e}},"loader"),uv={id:Em,detector:cv,loader:dv},fv=uv,Mm="treemap",pv=p(e=>/^\s*treemap/.test(e),"detector"),gv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./diagram-G47NLZAW-CAmFU1Cj.js");return{diagram:t}},__vite__mapDeps([55,22,16,23,5,6,27,31,26,7]));return{id:Mm,diagram:e}},"loader"),mv={id:Mm,detector:pv,loader:gv},$m="wardley",yv=p(e=>/^\s*wardley-beta/i.test(e),"detector"),Cv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./wardleyDiagram-EHGQE667-BaiOQb6Q.js");return{diagram:t}},__vite__mapDeps([56,22,23,5,6,7]));return{id:$m,diagram:e}},"loader"),xv={id:$m,detector:yv,loader:Cv},bv=xv,Om="cynefin",kv=p(e=>/^\s*cynefin-beta(?:[\s:]|$)/.test(e),"detector"),wv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./cynefinDiagram-TSTJHNR4-CjIz9kB7.js");return{diagram:t}},__vite__mapDeps([57,22,23,5,6,7]));return{id:Om,diagram:e}},"loader"),Tv={id:Om,detector:kv,loader:wv},Im="railroad",Sv=p(e=>/^\s*railroad-beta/i.test(e),"detector"),_v=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./railroadDiagram-RFXS5EU6-DS6RTuPq.js");return{diagram:t}},__vite__mapDeps([58,59,22,23,5,6,7]));return{id:Im,diagram:e}},"loader"),Bv={id:Im,detector:Sv,loader:_v},Dm="railroadEbnf",vv=p(e=>/^\s*railroad-ebnf-beta/i.test(e),"detector"),Lv=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./ebnfDiagram-CCIWWBDH-DJR1FAj9.js");return{diagram:t}},__vite__mapDeps([60,59,22,23,5,6,7]));return{id:Dm,diagram:e}},"loader"),Fv={id:Dm,detector:vv,loader:Lv},Pm="railroadAbnf",Av=p(e=>/^\s*railroad-abnf-beta/i.test(e),"detector"),Ev=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./abnfDiagram-VRR7QNED-LUo2ybd4.js");return{diagram:t}},__vite__mapDeps([61,59,22,23,5,6,7]));return{id:Pm,diagram:e}},"loader"),Mv={id:Pm,detector:Av,loader:Ev},Rm="railroadPeg",$v=p(e=>/^\s*railroad-peg-beta/i.test(e),"detector"),Ov=p(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:t}=await import("./pegDiagram-2B236MQR-MoH4JZ6E.js");return{diagram:t}},__vite__mapDeps([62,59,22,23,5,6,7]));return{id:Rm,diagram:e}},"loader"),Iv={id:Rm,detector:$v,loader:Ov},kc=!1,$s=p(()=>{kc||(kc=!0,zo("error",CB,e=>e.toLowerCase().trim()==="error"),zo("---",{db:{clear:p(()=>{},"clear")},styles:{},renderer:{draw:p(()=>{},"draw")},parser:{parse:p(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:p(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),ba(wB,AB,rv),ba(r_,OB,rB,Q_,C_,B_,F_,M_,Y_,X_,p_,c_,a_,BB,w_,cB,aB,pB,D_,RB,WB,q_,XB,av,QB,YB,hv,mv,Bv,Fv,Mv,Iv,fv,bv,Tv))},"addDiagrams"),Dv=p(async()=>{q.debug("Loading registered diagrams");const t=(await Promise.allSettled(Object.entries(Sr).map(async([r,{detector:i,loader:o}])=>{if(o)try{Sa(r)}catch{try{const{diagram:s,id:a}=await o();zo(a,s,i)}catch(s){throw q.error(`Failed to load external diagram with key ${r}. Removing from detectors.`),delete Sr[r],s}}}))).filter(r=>r.status==="rejected");if(t.length>0){q.error(`Failed to load ${t.length} external diagrams`);for(const r of t)q.error(r);throw new Error(`Failed to load ${t.length} external diagrams`)}},"loadRegisteredDiagrams"),Pv="graphics-document document";function Nm(e,t){e.attr("role",Pv),t!==""&&e.attr("aria-roledescription",t)}p(Nm,"setA11yDiagramInfo");function qm(e,t,r,i){if(e.insert!==void 0){if(r){const o=`chart-desc-${i}`;e.attr("aria-describedby",o),e.insert("desc",":first-child").attr("id",o).text(r)}if(t){const o=`chart-title-${i}`;e.attr("aria-labelledby",o),e.insert("title",":first-child").attr("id",o).text(t)}}}p(qm,"addSVGa11yTitleDescription");var mn=class Wm{constructor(t,r,i,o,s){this.type=t,this.text=r,this.db=i,this.parser=o,this.renderer=s}static{p(this,"Diagram")}static async fromText(t,r={}){const i=vt(),o=xn(t,i);t=Z2(t)+` `;try{Sa(o)}catch{const c=R0(o);if(!c)throw new Wc(`Diagram ${o} not found.`);const{id:h,diagram:d}=await c();zo(h,d)}const{db:s,parser:a,renderer:n,init:l}=Sa(o);return a.parser&&(a.parser.yy=s),s.clear?.(),l?.(i),r.title&&s.setDiagramTitle?.(r.title),await a.parse(t),new Wm(o,t,s,a,n)}async render(t,r){await this.renderer.draw(this.text,t,r,this)}getParser(){return this.parser}getType(){return this.type}},wc=[],Rv=p(()=>{wc.forEach(e=>{e()}),wc=[]},"attachFunctions"),Nv=p(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function zm(e){const t=e.match(qc);if(!t)return{text:e,metadata:{}};const r=t[1],i=r?t[2].split(` `).map(a=>a.startsWith(r)?a.slice(r.length):a).join(` `):t[2];let o=K1(i,{schema:Z1})??{};o=typeof o=="object"&&!Array.isArray(o)?o:{};const s={};return o.displayMode&&(s.displayMode=o.displayMode.toString()),o.title&&(s.title=o.title.toString()),o.config&&(s.config=o.config),{text:e.slice(t[0].length),metadata:s}}p(zm,"extractFrontMatter");var qv=p(e=>e.replace(/\r\n?/g,` diff --git a/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js b/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-Cg1epIhw.js similarity index 98% rename from apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js rename to apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-Cg1epIhw.js index 75b39e1c16c..b46a461e4e6 100644 --- a/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-HXhM1kRL.js +++ b/apps/kimi-code/dist-web/assets/mindmap-definition-LN4V7U3C-Cg1epIhw.js @@ -1,4 +1,4 @@ -import{g as oe}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as ae}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as l,l as C,v as ce,x as le,z as he,D as G,c as B,i as F,b6 as de,aa as ge,ab as ue,ac as pe}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";const E=[];for(let e=0;e<256;++e)E.push((e+256).toString(16).slice(1));function fe(e,n=0){return(E[e[n+0]]+E[e[n+1]]+E[e[n+2]]+E[e[n+3]]+"-"+E[e[n+4]]+E[e[n+5]]+"-"+E[e[n+6]]+E[e[n+7]]+"-"+E[e[n+8]]+E[e[n+9]]+"-"+E[e[n+10]]+E[e[n+11]]+E[e[n+12]]+E[e[n+13]]+E[e[n+14]]+E[e[n+15]]).toLowerCase()}const me=new Uint8Array(16);function ye(){return crypto.getRandomValues(me)}function Ee(e,n,g){return crypto.randomUUID?crypto.randomUUID():_e(e)}function _e(e,n,g){e=e||{};const a=e.random??e.rng?.()??ye();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,fe(a)}var Y=(function(){var e=l(function(D,s,i,o){for(i=i||{},o=D.length;o--;i[D[o]]=s);return i},"o"),n=[1,4],g=[1,13],a=[1,12],t=[1,15],h=[1,16],f=[1,20],m=[1,19],_=[6,7,8],T=[1,26],I=[1,24],w=[1,25],d=[6,7,11],R=[1,6,13,15,16,19,22],q=[1,33],J=[1,34],A=[1,6,7,11,13,15,16,19,22],j={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,i,o,c,p,r,$){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:g,7:[1,10],9:9,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(_,[2,3]),{1:[2,2]},e(_,[2,4]),e(_,[2,5]),{1:[2,6],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:g,9:22,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:T,7:I,10:23,11:w},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:m}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:T,7:I,10:32,11:w},{1:[2,7],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(R,[2,14],{7:q,11:J}),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(R,[2,13],{7:q,11:J}),e(A,[2,11]),e(A,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:l(function(s){var i=this,o=[0],c=[],p=[null],r=[],$=this.table,u="",M=0,K=0,ne=2,Q=1,ie=r.slice.call(arguments,1),y=Object.create(this.lexer),L={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(L.yy[H]=this.yy[H]);y.setInput(s,L.yy),L.yy.lexer=y,L.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var z=y.yylloc;r.push(z);var se=y.options&&y.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(k){o.length=o.length-2*k,p.length=p.length-k,r.length=r.length-k}l(re,"popStack");function Z(){var k;return k=c.pop()||y.lex()||Q,typeof k!="number"&&(k instanceof Array&&(c=k,k=c.pop()),k=i.symbols_[k]||k),k}l(Z,"lex");for(var b,v,S,W,O={},U,x,ee,V;;){if(v=o[o.length-1],this.defaultActions[v]?S=this.defaultActions[v]:((b===null||typeof b>"u")&&(b=Z()),S=$[v]&&$[v][b]),typeof S>"u"||!S.length||!S[0]){var X="";V=[];for(U in $[v])this.terminals_[U]&&U>ne&&V.push("'"+this.terminals_[U]+"'");y.showPosition?X="Parse error on line "+(M+1)+`: +import{g as oe}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as ae}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as l,l as C,v as ce,x as le,z as he,D as G,c as B,i as F,b6 as de,aa as ge,ab as ue,ac as pe}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";const E=[];for(let e=0;e<256;++e)E.push((e+256).toString(16).slice(1));function fe(e,n=0){return(E[e[n+0]]+E[e[n+1]]+E[e[n+2]]+E[e[n+3]]+"-"+E[e[n+4]]+E[e[n+5]]+"-"+E[e[n+6]]+E[e[n+7]]+"-"+E[e[n+8]]+E[e[n+9]]+"-"+E[e[n+10]]+E[e[n+11]]+E[e[n+12]]+E[e[n+13]]+E[e[n+14]]+E[e[n+15]]).toLowerCase()}const me=new Uint8Array(16);function ye(){return crypto.getRandomValues(me)}function Ee(e,n,g){return crypto.randomUUID?crypto.randomUUID():_e(e)}function _e(e,n,g){e=e||{};const a=e.random??e.rng?.()??ye();if(a.length<16)throw new Error("Random bytes length must be >= 16");return a[6]=a[6]&15|64,a[8]=a[8]&63|128,fe(a)}var Y=(function(){var e=l(function(D,s,i,o){for(i=i||{},o=D.length;o--;i[D[o]]=s);return i},"o"),n=[1,4],g=[1,13],a=[1,12],t=[1,15],h=[1,16],f=[1,20],m=[1,19],_=[6,7,8],T=[1,26],I=[1,24],w=[1,25],d=[6,7,11],R=[1,6,13,15,16,19,22],q=[1,33],J=[1,34],A=[1,6,7,11,13,15,16,19,22],j={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,MINDMAP:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,ICON:15,CLASS:16,nodeWithId:17,nodeWithoutId:18,NODE_DSTART:19,NODE_DESCR:20,NODE_DEND:21,NODE_ID:22,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"MINDMAP",11:"EOF",13:"SPACELIST",15:"ICON",16:"CLASS",19:"NODE_DSTART",20:"NODE_DESCR",21:"NODE_DEND",22:"NODE_ID"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[18,3],[17,1],[17,4]],performAction:l(function(s,i,o,c,p,r,$){var u=r.length-1;switch(p){case 6:case 7:return c;case 8:c.getLogger().trace("Stop NL ");break;case 9:c.getLogger().trace("Stop EOF ");break;case 11:c.getLogger().trace("Stop NL2 ");break;case 12:c.getLogger().trace("Stop EOF2 ");break;case 15:c.getLogger().info("Node: ",r[u].id),c.addNode(r[u-1].length,r[u].id,r[u].descr,r[u].type);break;case 16:c.getLogger().trace("Icon: ",r[u]),c.decorateNode({icon:r[u]});break;case 17:case 21:c.decorateNode({class:r[u]});break;case 18:c.getLogger().trace("SPACELIST");break;case 19:c.getLogger().trace("Node: ",r[u].id),c.addNode(0,r[u].id,r[u].descr,r[u].type);break;case 20:c.decorateNode({icon:r[u]});break;case 25:c.getLogger().trace("node found ..",r[u-2]),this.$={id:r[u-1],descr:r[u-1],type:c.getType(r[u-2],r[u])};break;case 26:this.$={id:r[u],descr:r[u],type:c.nodeType.DEFAULT};break;case 27:c.getLogger().trace("node found ..",r[u-3]),this.$={id:r[u-3],descr:r[u-1],type:c.getType(r[u-2],r[u])};break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:n},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:n},{6:g,7:[1,10],9:9,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(_,[2,3]),{1:[2,2]},e(_,[2,4]),e(_,[2,5]),{1:[2,6],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:g,9:22,12:11,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},{6:T,7:I,10:23,11:w},e(d,[2,22],{17:17,18:18,14:27,15:[1,28],16:[1,29],19:f,22:m}),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),e(d,[2,21]),e(d,[2,23]),e(d,[2,24]),e(d,[2,26],{19:[1,30]}),{20:[1,31]},{6:T,7:I,10:32,11:w},{1:[2,7],6:g,12:21,13:a,14:14,15:t,16:h,17:17,18:18,19:f,22:m},e(R,[2,14],{7:q,11:J}),e(A,[2,8]),e(A,[2,9]),e(A,[2,10]),e(d,[2,15]),e(d,[2,16]),e(d,[2,17]),{20:[1,35]},{21:[1,36]},e(R,[2,13],{7:q,11:J}),e(A,[2,11]),e(A,[2,12]),{21:[1,37]},e(d,[2,25]),e(d,[2,27])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(s,i){if(i.recoverable)this.trace(s);else{var o=new Error(s);throw o.hash=i,o}},"parseError"),parse:l(function(s){var i=this,o=[0],c=[],p=[null],r=[],$=this.table,u="",M=0,K=0,ne=2,Q=1,ie=r.slice.call(arguments,1),y=Object.create(this.lexer),L={yy:{}};for(var H in this.yy)Object.prototype.hasOwnProperty.call(this.yy,H)&&(L.yy[H]=this.yy[H]);y.setInput(s,L.yy),L.yy.lexer=y,L.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var z=y.yylloc;r.push(z);var se=y.options&&y.options.ranges;typeof L.yy.parseError=="function"?this.parseError=L.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function re(k){o.length=o.length-2*k,p.length=p.length-k,r.length=r.length-k}l(re,"popStack");function Z(){var k;return k=c.pop()||y.lex()||Q,typeof k!="number"&&(k instanceof Array&&(c=k,k=c.pop()),k=i.symbols_[k]||k),k}l(Z,"lex");for(var b,v,S,W,O={},U,x,ee,V;;){if(v=o[o.length-1],this.defaultActions[v]?S=this.defaultActions[v]:((b===null||typeof b>"u")&&(b=Z()),S=$[v]&&$[v][b]),typeof S>"u"||!S.length||!S[0]){var X="";V=[];for(U in $[v])this.terminals_[U]&&U>ne&&V.push("'"+this.terminals_[U]+"'");y.showPosition?X="Parse error on line "+(M+1)+`: `+y.showPosition()+` Expecting `+V.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(M+1)+": Unexpected "+(b==Q?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:y.match,token:this.terminals_[b]||b,line:y.yylineno,loc:z,expected:V})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+v+", token: "+b);switch(S[0]){case 1:o.push(b),p.push(y.yytext),r.push(y.yylloc),o.push(S[1]),b=null,K=y.yyleng,u=y.yytext,M=y.yylineno,z=y.yylloc;break;case 2:if(x=this.productions_[S[1]][1],O.$=p[p.length-x],O._$={first_line:r[r.length-(x||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(x||1)].first_column,last_column:r[r.length-1].last_column},se&&(O._$.range=[r[r.length-(x||1)].range[0],r[r.length-1].range[1]]),W=this.performAction.apply(O,[u,K,M,L.yy,S[1],p,r].concat(ie)),typeof W<"u")return W;x&&(o=o.slice(0,-1*x*2),p=p.slice(0,-1*x),r=r.slice(0,-1*x)),o.push(this.productions_[S[1]][0]),p.push(O.$),r.push(O._$),ee=$[o[o.length-2]][o[o.length-1]],o.push(ee);break;case 3:return!0}}return!0},"parse")},te=(function(){var D={EOF:1,parseError:l(function(i,o){if(this.yy.parser)this.yy.parser.parseError(i,o);else throw new Error(i)},"parseError"),setInput:l(function(s,i){return this.yy=i||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:l(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var i=s.match(/(?:\r\n?|\n).*/g);return i?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var i=s.length,o=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var c=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===c.length?this.yylloc.first_column:0)+c[c.length-o.length].length-o[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),i=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js b/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-MoH4JZ6E.js similarity index 87% rename from apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js rename to apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-MoH4JZ6E.js index c2c272efd75..584400a84e7 100644 --- a/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-_6D7zUy-.js +++ b/apps/kimi-code/dist-web/assets/pegDiagram-2B236MQR-MoH4JZ6E.js @@ -1 +1 @@ -import{g as l,r as m,d as a}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as t,l as o}from"./mermaid.core-CJB1tAev.js";import{M as u,d as c}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; +import{g as l,r as m,d as a}from"./chunk-MOJQB5TN-CuHpGhX-.js";import{p}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as t,l as o}from"./mermaid.core-CsZwh_jB.js";import{M as u,d as c}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var f=c().RailroadPeg.parser.LangiumParser,i=t(e=>{const r=e.alternatives.map(d);return r.length===1?r[0]:{type:"choice",alternatives:r}},"transformOrderedChoice"),d=t(e=>{const r=e.elements.map(P);return r.length===1?r[0]:{type:"sequence",elements:r}},"transformSequence"),P=t(e=>{const r=g(e.suffix);return e.operator?{type:"special",text:e.operator==="&"?`&${s(r)}`:`!${s(r)}`}:r},"transformPrefix"),s=t(e=>{switch(e.type){case"terminal":return`"${e.value}"`;case"nonterminal":return e.name;case"special":return e.text;default:return"(...)"}},"nodeToLabel"),g=t(e=>{const r=v(e.primary);if(!e.operator)return r;switch(e.operator){case"?":return{type:"optional",element:r};case"*":return{type:"repetition",element:r,min:0,max:1/0};case"+":return{type:"repetition",element:r,min:1,max:1/0};default:throw new Error(`Unsupported PEG suffix operator: ${e.operator}`)}},"transformSuffix"),v=t(e=>{switch(e.$type){case"PegLiteral":return{type:"terminal",value:e.value};case"PegIdentifier":return{type:"nonterminal",name:e.name};case"PegGroup":return i(e.element);case"PegAny":return{type:"special",text:e.dot};default:throw new Error(`Unsupported PEG primary node: ${e.$type}`)}},"transformPrimary"),y=t(e=>({name:e.name,definition:i(e.definition)}),"transformRule"),h=t(e=>{p(e,a),e.title&&a.setTitle(e.title),e.rules.map(r=>a.addRule(y(r)))},"populateDb"),b={parse:t(e=>{a.clear(),o.debug("[PEG Parser] Starting Langium parse");const r=f.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new u(r);const n=r.value;o.debug("[PEG Parser] Parsed rules:",n.rules.length),h(n),o.debug("[PEG Parser] Parse complete")},"parse"),parser:{yy:a}},L={parser:b,db:a,renderer:m,styles:l};export{L as diagram}; diff --git a/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js b/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-8g8etfu6.js similarity index 94% rename from apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js rename to apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-8g8etfu6.js index b9b4f579b25..6866ea400f3 100644 --- a/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-f3F4At6v.js +++ b/apps/kimi-code/dist-web/assets/pieDiagram-ENE6RG2P-8g8etfu6.js @@ -1,4 +1,4 @@ -import{p as at}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{K as T,N as B,b5 as rt,g as nt,s as it,a as ot,b as st,p as lt,o as ct,_ as g,l as G,c as ut,B as dt,F as gt,a1 as pt,e as ht,q as ft,D as mt}from"./mermaid.core-CJB1tAev.js";import{p as vt}from"./cynefin-VYW2F7L2-BIlq342y.js";import{d as X}from"./arc-IkhU3FHH.js";import{o as xt}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function St(t,n){return nt?1:n>=t?0:NaN}function yt(t){return t}function wt(){var t=yt,n=St,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=rt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,F=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=F*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:F};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var At=mt.pie,I={sections:new Map,showData:!1},W=I.sections,V=I.showData,Ct=structuredClone(At),$t=g(()=>structuredClone(Ct),"getConfig"),Dt=g(()=>{W=new Map,V=I.showData,ft()},"clear"),Tt=g(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);W.has(t)||(W.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),bt=g(()=>W,"getSections"),kt=g(t=>{V=t},"setShowData"),zt=g(()=>V,"getShowData"),Z={getConfig:$t,clear:Dt,setDiagramTitle:ct,getDiagramTitle:lt,setAccTitle:st,getAccTitle:ot,setAccDescription:it,getAccDescription:nt,addSection:Tt,getSections:bt,setShowData:kt,getShowData:zt},Et=g((t,n)=>{at(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Mt={parse:g(async t=>{const n=await vt("pie",t);G.debug(n),Et(n,Z)},"parse")},Rt=g(t=>` +import{p as at}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{K as T,N as B,b5 as rt,g as nt,s as it,a as ot,b as st,p as lt,o as ct,_ as g,l as G,c as ut,B as dt,F as gt,a1 as pt,e as ht,q as ft,D as mt}from"./mermaid.core-CsZwh_jB.js";import{p as vt}from"./cynefin-VYW2F7L2-CD6doQLg.js";import{d as X}from"./arc-HTdwJ95y.js";import{o as xt}from"./ordinal-Cboi1Yqb.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function St(t,n){return nt?1:n>=t?0:NaN}function yt(t){return t}function wt(){var t=yt,n=St,y=null,b=T(0),l=T(B),p=T(0);function i(e){var r,s=(e=rt(e)).length,h,w,$=0,f=new Array(s),o=new Array(s),D=+b.apply(this,arguments),E=Math.min(B,Math.max(-B,l.apply(this,arguments)-D)),k,F=Math.min(Math.abs(E)/s,p.apply(this,arguments)),u=F*(E<0?-1:1),A;for(r=0;r0&&($+=A);for(n!=null?f.sort(function(M,m){return n(o[M],o[m])}):y!=null&&f.sort(function(M,m){return y(e[M],e[m])}),r=0,w=$?(E-s*u)/$:0;r0?A*w:0)+u,o[h]={data:e[h],index:r,value:A,startAngle:D,endAngle:k,padAngle:F};return o}return i.value=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),i):t},i.sortValues=function(e){return arguments.length?(n=e,y=null,i):n},i.sort=function(e){return arguments.length?(y=e,n=null,i):y},i.startAngle=function(e){return arguments.length?(b=typeof e=="function"?e:T(+e),i):b},i.endAngle=function(e){return arguments.length?(l=typeof e=="function"?e:T(+e),i):l},i.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),i):p},i}var At=mt.pie,I={sections:new Map,showData:!1},W=I.sections,V=I.showData,Ct=structuredClone(At),$t=g(()=>structuredClone(Ct),"getConfig"),Dt=g(()=>{W=new Map,V=I.showData,ft()},"clear"),Tt=g(({label:t,value:n})=>{if(n<0)throw new Error(`"${t}" has invalid value: ${n}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);W.has(t)||(W.set(t,n),G.debug(`added new section: ${t}, with value: ${n}`))},"addSection"),bt=g(()=>W,"getSections"),kt=g(t=>{V=t},"setShowData"),zt=g(()=>V,"getShowData"),Z={getConfig:$t,clear:Dt,setDiagramTitle:ct,getDiagramTitle:lt,setAccTitle:st,getAccTitle:ot,setAccDescription:it,getAccDescription:nt,addSection:Tt,getSections:bt,setShowData:kt,getShowData:zt},Et=g((t,n)=>{at(t,n),n.setShowData(t.showData),t.sections.map(n.addSection)},"populateDb"),Mt={parse:g(async t=>{const n=await vt("pie",t);G.debug(n),Et(n,Z)},"parse")},Rt=g(t=>` .pieCircle{ stroke: ${t.pieStrokeColor}; stroke-width : ${t.pieStrokeWidth}; diff --git a/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js b/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-BxCL4sof.js similarity index 99% rename from apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js rename to apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-BxCL4sof.js index 3f7c3054a53..375fa631a1e 100644 --- a/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-3t7sFhfl.js +++ b/apps/kimi-code/dist-web/assets/quadrantDiagram-ABIIQ3AL-BxCL4sof.js @@ -1,4 +1,4 @@ -import{s as Se,g as _e,p as ee,o as Ae,a as ke,b as Fe,_ as r,c as Et,l as qt,d as vt,e as Pe,q as ve,D as z,i as Ce,W as Le}from"./mermaid.core-CJB1tAev.js";import{l as te}from"./linear-DH49UJnN.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Ct=(function(){var t=r(function(Y,s,l,u){for(l=l||{},u=Y.length;u--;l[Y[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],k=[1,45],ct=[1,14],dt=[1,23],ut=[1,18],xt=[1,19],ot=[1,20],bt=[1,21],lt=[1,22],i=[1,24],Dt=[1,25],zt=[1,26],Vt=[1,27],It=[1,28],wt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],jt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],St=[1,103],Gt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(_,[2,34]),{27:46,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(c,[2,45]),t(c,[2,46]),{18:[1,51]},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:65,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,21:64},t(c,[2,53],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(c,[2,56],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(c,[2,57],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,58],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,59],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,60],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(c,[2,52],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,55],{58:31,43:85,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(c,[2,51],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,54],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(c,[2,29],{10:St}),t(Gt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(c,[2,50],{10:St}),t(Gt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Kt=0,Te=2,Zt=1,qe=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(j.yy[At]=this.yy[At]);D.setInput(s,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var kt=D.yylloc;e.push(kt);var me=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(R){u.length=u.length-2*R,A.length=A.length-R,e.length=e.length-R}r(be,"popStack");function Jt(){var R;return R=d.pop()||D.lex()||Zt,typeof R!="number"&&(R instanceof Array&&(d=R,R=d.pop()),R=l.symbols_[R]||R),R}r(Jt,"lex");for(var B,G,W,Ft,rt={},pt,M,$t,yt;;){if(G=u[u.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=Jt()),W=ht[G]&&ht[G][B]),typeof W>"u"||!W.length||!W[0]){var Pt="";yt=[];for(pt in ht[G])this.terminals_[pt]&&pt>Te&&yt.push("'"+this.terminals_[pt]+"'");D.showPosition?Pt="Parse error on line "+(gt+1)+`: +import{s as Se,g as _e,p as ee,o as Ae,a as ke,b as Fe,_ as r,c as Et,l as qt,d as vt,e as Pe,q as ve,D as z,i as Ce,W as Le}from"./mermaid.core-CsZwh_jB.js";import{l as te}from"./linear-CV4KY8w2.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";import"./defaultLocale-DX6XiGOO.js";var Ct=(function(){var t=r(function(Y,s,l,u){for(l=l||{},u=Y.length;u--;l[Y[u]]=s);return l},"o"),a=[1,3],p=[1,4],f=[1,5],o=[1,6],x=[1,7],_=[1,4,5,10,12,13,14,15,18,25,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],h=[1,4,5,10,12,13,14,15,18,25,28,35,37,39,41,42,48,50,51,52,53,54,55,56,57,60,61,63,64,65,66,67],c=[55,56,57],S=[2,36],m=[1,37],b=[1,36],y=[1,38],T=[1,35],q=[1,43],g=[1,41],k=[1,45],ct=[1,14],dt=[1,23],ut=[1,18],xt=[1,19],ot=[1,20],bt=[1,21],lt=[1,22],i=[1,24],Dt=[1,25],zt=[1,26],Vt=[1,27],It=[1,28],wt=[1,29],U=[1,32],Q=[1,33],F=[1,34],P=[1,39],v=[1,40],C=[1,42],L=[1,44],H=[1,63],X=[1,62],E=[4,5,8,10,12,13,14,15,18,44,47,49,55,56,57,63,64,65,66,67],Bt=[1,66],Rt=[1,67],Nt=[1,68],Wt=[1,69],Ut=[1,70],Qt=[1,71],Ot=[1,72],Ht=[1,73],Xt=[1,74],Mt=[1,75],Yt=[1,76],jt=[1,77],w=[4,5,6,7,8,9,10,11,12,13,14,15,18],K=[1,91],Z=[1,92],J=[1,93],$=[1,100],tt=[1,94],et=[1,97],it=[1,95],at=[1,96],nt=[1,98],st=[1,99],St=[1,103],Gt=[10,55,56,57],N=[4,5,6,8,10,11,13,17,18,19,20,55,56,57],_t={trace:r(function(){},"trace"),yy:{},symbols_:{error:2,idStringToken:3,ALPHA:4,NUM:5,NODE_STRING:6,DOWN:7,MINUS:8,DEFAULT:9,COMMA:10,COLON:11,AMP:12,BRKT:13,MULT:14,UNICODE_TEXT:15,styleComponent:16,UNIT:17,SPACE:18,STYLE:19,PCT:20,idString:21,style:22,stylesOpt:23,classDefStatement:24,CLASSDEF:25,start:26,eol:27,QUADRANT:28,document:29,line:30,statement:31,axisDetails:32,quadrantDetails:33,points:34,title:35,title_value:36,acc_title:37,acc_title_value:38,acc_descr:39,acc_descr_value:40,acc_descr_multiline_value:41,section:42,text:43,point_start:44,point_x:45,point_y:46,class_name:47,"X-AXIS":48,"AXIS-TEXT-DELIMITER":49,"Y-AXIS":50,QUADRANT_1:51,QUADRANT_2:52,QUADRANT_3:53,QUADRANT_4:54,NEWLINE:55,SEMI:56,EOF:57,alphaNumToken:58,textNoTagsToken:59,STR:60,MD_STR:61,alphaNum:62,PUNCTUATION:63,PLUS:64,EQUALS:65,DOT:66,UNDERSCORE:67,$accept:0,$end:1},terminals_:{2:"error",4:"ALPHA",5:"NUM",6:"NODE_STRING",7:"DOWN",8:"MINUS",9:"DEFAULT",10:"COMMA",11:"COLON",12:"AMP",13:"BRKT",14:"MULT",15:"UNICODE_TEXT",17:"UNIT",18:"SPACE",19:"STYLE",20:"PCT",25:"CLASSDEF",28:"QUADRANT",35:"title",36:"title_value",37:"acc_title",38:"acc_title_value",39:"acc_descr",40:"acc_descr_value",41:"acc_descr_multiline_value",42:"section",44:"point_start",45:"point_x",46:"point_y",47:"class_name",48:"X-AXIS",49:"AXIS-TEXT-DELIMITER",50:"Y-AXIS",51:"QUADRANT_1",52:"QUADRANT_2",53:"QUADRANT_3",54:"QUADRANT_4",55:"NEWLINE",56:"SEMI",57:"EOF",60:"STR",61:"MD_STR",63:"PUNCTUATION",64:"PLUS",65:"EQUALS",66:"DOT",67:"UNDERSCORE"},productions_:[0,[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[16,1],[21,1],[21,2],[22,1],[22,2],[23,1],[23,3],[24,5],[26,2],[26,2],[26,2],[29,0],[29,2],[30,2],[31,0],[31,1],[31,2],[31,1],[31,1],[31,1],[31,2],[31,2],[31,2],[31,1],[31,1],[34,4],[34,5],[34,5],[34,6],[32,4],[32,3],[32,2],[32,4],[32,3],[32,2],[33,2],[33,2],[33,2],[33,2],[27,1],[27,1],[27,1],[43,1],[43,2],[43,1],[43,1],[62,1],[62,2],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[58,1],[59,1],[59,1],[59,1]],performAction:r(function(s,l,u,d,A,e,ht){var n=e.length-1;switch(A){case 23:this.$=e[n];break;case 24:this.$=e[n-1]+""+e[n];break;case 26:this.$=e[n-1]+e[n];break;case 27:this.$=[e[n].trim()];break;case 28:e[n-2].push(e[n].trim()),this.$=e[n-2];break;case 29:this.$=e[n-4],d.addClass(e[n-2],e[n]);break;case 37:this.$=[];break;case 42:this.$=e[n].trim(),d.setDiagramTitle(this.$);break;case 43:this.$=e[n].trim(),d.setAccTitle(this.$);break;case 44:case 45:this.$=e[n].trim(),d.setAccDescription(this.$);break;case 46:d.addSection(e[n].substr(8)),this.$=e[n].substr(8);break;case 47:d.addPoint(e[n-3],"",e[n-1],e[n],[]);break;case 48:d.addPoint(e[n-4],e[n-3],e[n-1],e[n],[]);break;case 49:d.addPoint(e[n-4],"",e[n-2],e[n-1],e[n]);break;case 50:d.addPoint(e[n-5],e[n-4],e[n-2],e[n-1],e[n]);break;case 51:d.setXAxisLeftText(e[n-2]),d.setXAxisRightText(e[n]);break;case 52:e[n-1].text+=" ⟶ ",d.setXAxisLeftText(e[n-1]);break;case 53:d.setXAxisLeftText(e[n]);break;case 54:d.setYAxisBottomText(e[n-2]),d.setYAxisTopText(e[n]);break;case 55:e[n-1].text+=" ⟶ ",d.setYAxisBottomText(e[n-1]);break;case 56:d.setYAxisBottomText(e[n]);break;case 57:d.setQuadrant1Text(e[n]);break;case 58:d.setQuadrant2Text(e[n]);break;case 59:d.setQuadrant3Text(e[n]);break;case 60:d.setQuadrant4Text(e[n]);break;case 64:this.$={text:e[n],type:"text"};break;case 65:this.$={text:e[n-1].text+""+e[n],type:e[n-1].type};break;case 66:this.$={text:e[n],type:"text"};break;case 67:this.$={text:e[n],type:"markdown"};break;case 68:this.$=e[n];break;case 69:this.$=e[n-1]+""+e[n];break}},"anonymous"),table:[{18:a,26:1,27:2,28:p,55:f,56:o,57:x},{1:[3]},{18:a,26:8,27:2,28:p,55:f,56:o,57:x},{18:a,26:9,27:2,28:p,55:f,56:o,57:x},t(_,[2,33],{29:10}),t(h,[2,61]),t(h,[2,62]),t(h,[2,63]),{1:[2,30]},{1:[2,31]},t(c,S,{30:11,31:12,24:13,32:15,33:16,34:17,43:30,58:31,1:[2,32],4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(_,[2,34]),{27:46,55:f,56:o,57:x},t(c,[2,37]),t(c,S,{24:13,32:15,33:16,34:17,43:30,58:31,31:47,4:m,5:b,10:y,12:T,13:q,14:g,15:k,18:ct,25:dt,35:ut,37:xt,39:ot,41:bt,42:lt,48:i,50:Dt,51:zt,52:Vt,53:It,54:wt,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,39]),t(c,[2,40]),t(c,[2,41]),{36:[1,48]},{38:[1,49]},{40:[1,50]},t(c,[2,45]),t(c,[2,46]),{18:[1,51]},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:52,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:53,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:54,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:55,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:56,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,10:y,12:T,13:q,14:g,15:k,43:57,58:31,60:U,61:Q,63:F,64:P,65:v,66:C,67:L},{4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,44:[1,58],47:[1,59],58:61,59:60,63:F,64:P,65:v,66:C,67:L},t(E,[2,64]),t(E,[2,66]),t(E,[2,67]),t(E,[2,70]),t(E,[2,71]),t(E,[2,72]),t(E,[2,73]),t(E,[2,74]),t(E,[2,75]),t(E,[2,76]),t(E,[2,77]),t(E,[2,78]),t(E,[2,79]),t(E,[2,80]),t(E,[2,81]),t(_,[2,35]),t(c,[2,38]),t(c,[2,42]),t(c,[2,43]),t(c,[2,44]),{3:65,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,21:64},t(c,[2,53],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,78],63:F,64:P,65:v,66:C,67:L}),t(c,[2,56],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,49:[1,79],63:F,64:P,65:v,66:C,67:L}),t(c,[2,57],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,58],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,59],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,60],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),{45:[1,80]},{44:[1,81]},t(E,[2,65]),t(E,[2,82]),t(E,[2,83]),t(E,[2,84]),{3:83,4:Bt,5:Rt,6:Nt,7:Wt,8:Ut,9:Qt,10:Ot,11:Ht,12:Xt,13:Mt,14:Yt,15:jt,18:[1,82]},t(w,[2,23]),t(w,[2,1]),t(w,[2,2]),t(w,[2,3]),t(w,[2,4]),t(w,[2,5]),t(w,[2,6]),t(w,[2,7]),t(w,[2,8]),t(w,[2,9]),t(w,[2,10]),t(w,[2,11]),t(w,[2,12]),t(c,[2,52],{58:31,43:84,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),t(c,[2,55],{58:31,43:85,4:m,5:b,10:y,12:T,13:q,14:g,15:k,60:U,61:Q,63:F,64:P,65:v,66:C,67:L}),{46:[1,86]},{45:[1,87]},{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:89,23:88},t(w,[2,24]),t(c,[2,51],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,54],{59:60,58:61,4:m,5:b,8:H,10:y,12:T,13:q,14:g,15:k,18:X,63:F,64:P,65:v,66:C,67:L}),t(c,[2,47],{22:89,16:90,23:101,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{46:[1,102]},t(c,[2,29],{10:St}),t(Gt,[2,27],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),t(N,[2,25]),t(N,[2,13]),t(N,[2,14]),t(N,[2,15]),t(N,[2,16]),t(N,[2,17]),t(N,[2,18]),t(N,[2,19]),t(N,[2,20]),t(N,[2,21]),t(N,[2,22]),t(c,[2,49],{10:St}),t(c,[2,48],{22:89,16:90,23:105,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st}),{4:K,5:Z,6:J,8:$,11:tt,13:et,16:90,17:it,18:at,19:nt,20:st,22:106},t(N,[2,26]),t(c,[2,50],{10:St}),t(Gt,[2,28],{16:104,4:K,5:Z,6:J,8:$,11:tt,13:et,17:it,18:at,19:nt,20:st})],defaultActions:{8:[2,30],9:[2,31]},parseError:r(function(s,l){if(l.recoverable)this.trace(s);else{var u=new Error(s);throw u.hash=l,u}},"parseError"),parse:r(function(s){var l=this,u=[0],d=[],A=[null],e=[],ht=this.table,n="",gt=0,Kt=0,Te=2,Zt=1,qe=e.slice.call(arguments,1),D=Object.create(this.lexer),j={yy:{}};for(var At in this.yy)Object.prototype.hasOwnProperty.call(this.yy,At)&&(j.yy[At]=this.yy[At]);D.setInput(s,j.yy),j.yy.lexer=D,j.yy.parser=this,typeof D.yylloc>"u"&&(D.yylloc={});var kt=D.yylloc;e.push(kt);var me=D.options&&D.options.ranges;typeof j.yy.parseError=="function"?this.parseError=j.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function be(R){u.length=u.length-2*R,A.length=A.length-R,e.length=e.length-R}r(be,"popStack");function Jt(){var R;return R=d.pop()||D.lex()||Zt,typeof R!="number"&&(R instanceof Array&&(d=R,R=d.pop()),R=l.symbols_[R]||R),R}r(Jt,"lex");for(var B,G,W,Ft,rt={},pt,M,$t,yt;;){if(G=u[u.length-1],this.defaultActions[G]?W=this.defaultActions[G]:((B===null||typeof B>"u")&&(B=Jt()),W=ht[G]&&ht[G][B]),typeof W>"u"||!W.length||!W[0]){var Pt="";yt=[];for(pt in ht[G])this.terminals_[pt]&&pt>Te&&yt.push("'"+this.terminals_[pt]+"'");D.showPosition?Pt="Parse error on line "+(gt+1)+`: `+D.showPosition()+` Expecting `+yt.join(", ")+", got '"+(this.terminals_[B]||B)+"'":Pt="Parse error on line "+(gt+1)+": Unexpected "+(B==Zt?"end of input":"'"+(this.terminals_[B]||B)+"'"),this.parseError(Pt,{text:D.match,token:this.terminals_[B]||B,line:D.yylineno,loc:kt,expected:yt})}if(W[0]instanceof Array&&W.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+B);switch(W[0]){case 1:u.push(B),A.push(D.yytext),e.push(D.yylloc),u.push(W[1]),B=null,Kt=D.yyleng,n=D.yytext,gt=D.yylineno,kt=D.yylloc;break;case 2:if(M=this.productions_[W[1]][1],rt.$=A[A.length-M],rt._$={first_line:e[e.length-(M||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(M||1)].first_column,last_column:e[e.length-1].last_column},me&&(rt._$.range=[e[e.length-(M||1)].range[0],e[e.length-1].range[1]]),Ft=this.performAction.apply(rt,[n,Kt,gt,j.yy,W[1],A,e].concat(qe)),typeof Ft<"u")return Ft;M&&(u=u.slice(0,-1*M*2),A=A.slice(0,-1*M),e=e.slice(0,-1*M)),u.push(this.productions_[W[1]][0]),A.push(rt.$),e.push(rt._$),$t=ht[u[u.length-2]][u[u.length-1]],u.push($t);break;case 3:return!0}}return!0},"parse")},ye=(function(){var Y={EOF:1,parseError:r(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw new Error(l)},"parseError"),setInput:r(function(s,l){return this.yy=l||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:r(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var l=s.match(/(?:\r\n?|\n).*/g);return l?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:r(function(s){var l=s.length,u=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1&&(this.yylineno-=u.length-1);var A=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===d.length?this.yylloc.first_column:0)+d[d.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges&&(this.yylloc.range=[A[0],A[0]+this.yyleng-l]),this.yyleng=this.yytext.length,this},"unput"),more:r(function(){return this._more=!0,this},"more"),reject:r(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:r(function(s){this.unput(this.match.slice(s))},"less"),pastInput:r(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:r(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:r(function(){var s=this.pastInput(),l=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js b/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DS6RTuPq.js similarity index 84% rename from apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js rename to apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DS6RTuPq.js index 757f3d68334..1541fd0cae5 100644 --- a/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-W9nf8fYD.js +++ b/apps/kimi-code/dist-web/assets/railroadDiagram-RFXS5EU6-DS6RTuPq.js @@ -1 +1 @@ -import{g as s,r as l,d as t}from"./chunk-MOJQB5TN-JQ2kJR9W.js";import{p as m}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{_ as n,l as i}from"./mermaid.core-CJB1tAev.js";import{M as p,c as u}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; +import{g as s,r as l,d as t}from"./chunk-MOJQB5TN-CuHpGhX-.js";import{p as m}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{_ as n,l as i}from"./mermaid.core-CsZwh_jB.js";import{M as p,c as u}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var d=u().Railroad.parser.LangiumParser,a=n(e=>{switch(e.$type){case"RailroadTerminalExpr":return{type:"terminal",value:e.value};case"RailroadNonTerminalExpr":return{type:"nonterminal",name:e.name};case"RailroadSpecialExpr":return{type:"special",text:e.text};case"RailroadSequenceExpr":{const r=e.elements.map(a);return r.length===1?r[0]:{type:"sequence",elements:r}}case"RailroadChoiceExpr":{const r=e.alternatives.map(a);return r.length===1?r[0]:{type:"choice",alternatives:r}}case"RailroadOptionalExpr":return{type:"optional",element:a(e.element)};case"RailroadOneOrMoreExpr":return{type:"repetition",element:a(e.element),min:1,max:1/0};case"RailroadZeroOrMoreExpr":return{type:"repetition",element:a(e.element),min:0,max:1/0};default:throw new Error(`Unsupported railroad expression: ${e.$type}`)}},"transformExpression"),c=n(e=>({name:e.name,definition:a(e.definition)}),"transformRule"),g=n(e=>{m(e,t),e.title&&t.setTitle(e.title),e.rules.map(r=>t.addRule(c(r)))},"populateDb"),y={parse:n(e=>{t.clear(),i.debug("[Railroad Parser] Starting Langium parse");const r=d.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new p(r);const o=r.value;i.debug("[Railroad Parser] Parsed rules:",o.rules.length),g(o),i.debug("[Railroad Parser] Parse complete")},"parse"),parser:{yy:t}},P={parser:y,db:t,renderer:l,styles:s};export{P as diagram}; diff --git a/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js b/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Cgysyqsi.js similarity index 99% rename from apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js rename to apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Cgysyqsi.js index 7eb6523fe0b..bc6c8c6e4d2 100644 --- a/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Bzvt0v7J.js +++ b/apps/kimi-code/dist-web/assets/requirementDiagram-TGXJPOKE-Cgysyqsi.js @@ -1,4 +1,4 @@ -import{g as ze}from"./chunk-XXDRQBXY-5rh7CWvm.js";import{s as Ge}from"./chunk-VR4S4FIN-CEH7JYJn.js";import{_ as h,z as Ye,b as Xe,a as Je,s as Ze,g as et,o as tt,p as st,c as Te,l as Ne,q as it,u as rt,v as nt,x as at,y as lt}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var qe=(function(){var e=h(function($,r,a,c){for(a=a||{},c=$.length;c--;a[$[c]]=r);return a},"o"),u=[1,3],o=[1,4],n=[1,5],i=[1,6],f=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],_=[1,22],E=[2,7],g=[1,26],S=[1,27],k=[1,28],q=[1,29],C=[1,33],A=[1,34],V=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],p=[1,39],R=[1,40],d=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ce=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],de=[27,29],Ae=[1,70],Ve=[1,71],ve=[1,72],Le=[1,73],xe=[1,74],Oe=[1,75],we=[1,76],Z=[1,83],U=[1,80],ee=[1,84],te=[1,85],se=[1,86],ie=[1,87],re=[1,88],ne=[1,89],ae=[1,90],le=[1,91],ce=[1,92],Ee=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],De=[1,101],Me=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],oe=[1,116],he=[1,117],ue=[1,114],fe=[1,115],_e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:h(function(r,a,c,s,m,t,me){var l=t.length-1;switch(m){case 4:this.$=t[l].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[l].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[l-3],t[l-4]);break;case 22:s.addRequirement(t[l-5],t[l-6]),s.setClass([t[l-5]],t[l-3]);break;case 23:s.setNewReqId(t[l-2]);break;case 24:s.setNewReqText(t[l-2]);break;case 25:s.setNewReqRisk(t[l-2]);break;case 26:s.setNewReqVerifyMethod(t[l-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[l-3]);break;case 43:s.addElement(t[l-5]),s.setClass([t[l-5]],t[l-3]);break;case 44:s.setNewElementType(t[l-2]);break;case 45:s.setNewElementDocRef(t[l-2]);break;case 48:s.addRelationship(t[l-2],t[l],t[l-4]);break;case 49:s.addRelationship(t[l-2],t[l-4],t[l]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[l-2],s.defineClass(t[l-1],t[l]);break;case 58:s.setClass(t[l-1],t[l]);break;case 59:s.setClass([t[l-2]],t[l]);break;case 60:case 62:this.$=[t[l]];break;case 61:case 63:this.$=t[l-2].concat([t[l]]);break;case 64:this.$=t[l-2],s.setCssStyle(t[l-1],t[l]);break;case 65:this.$=[t[l]];break;case 66:t[l-2].push(t[l]),this.$=t[l-2];break;case 68:this.$=t[l-1]+t[l];break}},"anonymous"),table:[{3:1,4:2,6:u,9:o,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:u,9:o,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(f,[2,6]),{3:12,4:2,6:u,9:o,11:n,13:i},{1:[2,2]},{4:17,5:_,7:13,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},e(f,[2,4]),e(f,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:_,7:42,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:43,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:44,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:45,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:46,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:47,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:48,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:49,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:50,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(d,[2,17]),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),{30:60,33:62,75:P,89:p,90:R},{30:63,33:62,75:P,89:p,90:R},{30:64,33:62,75:P,89:p,90:R},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ce,[2,81]),e(Ce,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(de,[2,79]),e(de,[2,80]),{27:[1,67],29:[1,68]},e(de,[2,85]),e(de,[2,86]),{62:69,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{62:77,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{30:78,33:62,75:P,89:p,90:R},{73:79,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,60]),e(Ee,[2,62]),{73:93,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},{30:94,33:62,75:P,76:U,89:p,90:R},{5:[1,95]},{30:96,33:62,75:P,89:p,90:R},{5:[1,97]},{30:98,33:62,75:P,89:p,90:R},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(d,[2,59],{76:U}),e(d,[2,64],{76:De}),{33:103,75:[1,102],89:p,90:R},e(Me,[2,65],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),e(T,[2,67]),e(T,[2,69]),e(T,[2,70]),e(T,[2,71]),e(T,[2,72]),e(T,[2,73]),e(T,[2,74]),e(T,[2,75]),e(T,[2,76]),e(T,[2,77]),e(T,[2,78]),e(d,[2,57],{76:De}),e(d,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:oe,40:he,56:113,57:ue,59:fe},{27:[1,118],76:U},{33:119,89:p,90:R},{33:120,89:p,90:R},{75:Z,78:121,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,61]),e(Ee,[2,63]),e(T,[2,68]),e(d,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(d,[2,28]),{5:[1,127]},e(d,[2,42]),{32:[1,128]},{32:[1,129]},{5:oe,40:he,56:130,57:ue,59:fe},e(d,[2,47]),{5:[1,131]},e(d,[2,48]),e(d,[2,49]),e(Me,[2,66],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),{33:132,89:p,90:R},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(d,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(d,[2,46]),{5:oe,40:he,56:152,57:ue,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(d,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(d,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:oe,40:he,56:163,57:ue,59:fe},{5:oe,40:he,56:164,57:ue,59:fe},e(d,[2,23]),e(d,[2,24]),e(d,[2,25]),e(d,[2,26]),e(d,[2,44]),e(d,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:h(function(r,a){if(a.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=a,c}},"parseError"),parse:h(function(r){var a=this,c=[0],s=[],m=[null],t=[],me=this.table,l="",Re=0,Fe=0,He=2,$e=1,Ke=t.slice.call(arguments,1),y=Object.create(this.lexer),z={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(z.yy[Se]=this.yy[Se]);y.setInput(r,z.yy),z.yy.lexer=y,z.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var be=y.yylloc;t.push(be);var We=y.options&&y.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(I){c.length=c.length-2*I,m.length=m.length-I,t.length=t.length-I}h(je,"popStack");function Pe(){var I;return I=s.pop()||y.lex()||$e,typeof I!="number"&&(I instanceof Array&&(s=I,I=s.pop()),I=a.symbols_[I]||I),I}h(Pe,"lex");for(var b,G,N,Ie,J={},ge,F,Ue,ye;;){if(G=c[c.length-1],this.defaultActions[G]?N=this.defaultActions[G]:((b===null||typeof b>"u")&&(b=Pe()),N=me[G]&&me[G][b]),typeof N>"u"||!N.length||!N[0]){var ke="";ye=[];for(ge in me[G])this.terminals_[ge]&&ge>He&&ye.push("'"+this.terminals_[ge]+"'");y.showPosition?ke="Parse error on line "+(Re+1)+`: +import{g as ze}from"./chunk-XXDRQBXY-B7Une-L7.js";import{s as Ge}from"./chunk-VR4S4FIN-Crv01XIW.js";import{_ as h,z as Ye,b as Xe,a as Je,s as Ze,g as et,o as tt,p as st,c as Te,l as Ne,q as it,u as rt,v as nt,x as at,y as lt}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var qe=(function(){var e=h(function($,r,a,c){for(a=a||{},c=$.length;c--;a[$[c]]=r);return a},"o"),u=[1,3],o=[1,4],n=[1,5],i=[1,6],f=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],_=[1,22],E=[2,7],g=[1,26],S=[1,27],k=[1,28],q=[1,29],C=[1,33],A=[1,34],V=[1,35],v=[1,36],L=[1,37],x=[1,38],O=[1,24],w=[1,31],D=[1,32],M=[1,30],p=[1,39],R=[1,40],d=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],P=[1,61],X=[89,90],Ce=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],de=[27,29],Ae=[1,70],Ve=[1,71],ve=[1,72],Le=[1,73],xe=[1,74],Oe=[1,75],we=[1,76],Z=[1,83],U=[1,80],ee=[1,84],te=[1,85],se=[1,86],ie=[1,87],re=[1,88],ne=[1,89],ae=[1,90],le=[1,91],ce=[1,92],Ee=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Y=[63,64],De=[1,101],Me=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],T=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],B=[1,110],Q=[1,106],H=[1,107],K=[1,108],W=[1,109],j=[1,111],oe=[1,116],he=[1,117],ue=[1,114],fe=[1,115],_e={trace:h(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:h(function(r,a,c,s,m,t,me){var l=t.length-1;switch(m){case 4:this.$=t[l].trim(),s.setAccTitle(this.$);break;case 5:case 6:this.$=t[l].trim(),s.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:s.setDirection("TB");break;case 18:s.setDirection("BT");break;case 19:s.setDirection("RL");break;case 20:s.setDirection("LR");break;case 21:s.addRequirement(t[l-3],t[l-4]);break;case 22:s.addRequirement(t[l-5],t[l-6]),s.setClass([t[l-5]],t[l-3]);break;case 23:s.setNewReqId(t[l-2]);break;case 24:s.setNewReqText(t[l-2]);break;case 25:s.setNewReqRisk(t[l-2]);break;case 26:s.setNewReqVerifyMethod(t[l-2]);break;case 29:this.$=s.RequirementType.REQUIREMENT;break;case 30:this.$=s.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=s.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=s.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=s.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=s.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=s.RiskLevel.LOW_RISK;break;case 36:this.$=s.RiskLevel.MED_RISK;break;case 37:this.$=s.RiskLevel.HIGH_RISK;break;case 38:this.$=s.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=s.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=s.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=s.VerifyType.VERIFY_TEST;break;case 42:s.addElement(t[l-3]);break;case 43:s.addElement(t[l-5]),s.setClass([t[l-5]],t[l-3]);break;case 44:s.setNewElementType(t[l-2]);break;case 45:s.setNewElementDocRef(t[l-2]);break;case 48:s.addRelationship(t[l-2],t[l],t[l-4]);break;case 49:s.addRelationship(t[l-2],t[l-4],t[l]);break;case 50:this.$=s.Relationships.CONTAINS;break;case 51:this.$=s.Relationships.COPIES;break;case 52:this.$=s.Relationships.DERIVES;break;case 53:this.$=s.Relationships.SATISFIES;break;case 54:this.$=s.Relationships.VERIFIES;break;case 55:this.$=s.Relationships.REFINES;break;case 56:this.$=s.Relationships.TRACES;break;case 57:this.$=t[l-2],s.defineClass(t[l-1],t[l]);break;case 58:s.setClass(t[l-1],t[l]);break;case 59:s.setClass([t[l-2]],t[l]);break;case 60:case 62:this.$=[t[l]];break;case 61:case 63:this.$=t[l-2].concat([t[l]]);break;case 64:this.$=t[l-2],s.setCssStyle(t[l-1],t[l]);break;case 65:this.$=[t[l]];break;case 66:t[l-2].push(t[l]),this.$=t[l-2];break;case 68:this.$=t[l-1]+t[l];break}},"anonymous"),table:[{3:1,4:2,6:u,9:o,11:n,13:i},{1:[3]},{3:8,4:2,5:[1,7],6:u,9:o,11:n,13:i},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(f,[2,6]),{3:12,4:2,6:u,9:o,11:n,13:i},{1:[2,2]},{4:17,5:_,7:13,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},e(f,[2,4]),e(f,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:_,7:42,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:43,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:44,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:45,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:46,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:47,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:48,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:49,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{4:17,5:_,7:50,8:E,9:o,11:n,13:i,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:g,22:S,23:k,24:q,25:23,33:25,41:C,42:A,43:V,44:v,45:L,46:x,54:O,72:w,74:D,77:M,89:p,90:R},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(d,[2,17]),e(d,[2,18]),e(d,[2,19]),e(d,[2,20]),{30:60,33:62,75:P,89:p,90:R},{30:63,33:62,75:P,89:p,90:R},{30:64,33:62,75:P,89:p,90:R},e(X,[2,29]),e(X,[2,30]),e(X,[2,31]),e(X,[2,32]),e(X,[2,33]),e(X,[2,34]),e(Ce,[2,81]),e(Ce,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(de,[2,79]),e(de,[2,80]),{27:[1,67],29:[1,68]},e(de,[2,85]),e(de,[2,86]),{62:69,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{62:77,65:Ae,66:Ve,67:ve,68:Le,69:xe,70:Oe,71:we},{30:78,33:62,75:P,89:p,90:R},{73:79,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,60]),e(Ee,[2,62]),{73:93,75:Z,76:U,78:81,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},{30:94,33:62,75:P,76:U,89:p,90:R},{5:[1,95]},{30:96,33:62,75:P,89:p,90:R},{5:[1,97]},{30:98,33:62,75:P,89:p,90:R},{63:[1,99]},e(Y,[2,50]),e(Y,[2,51]),e(Y,[2,52]),e(Y,[2,53]),e(Y,[2,54]),e(Y,[2,55]),e(Y,[2,56]),{64:[1,100]},e(d,[2,59],{76:U}),e(d,[2,64],{76:De}),{33:103,75:[1,102],89:p,90:R},e(Me,[2,65],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),e(T,[2,67]),e(T,[2,69]),e(T,[2,70]),e(T,[2,71]),e(T,[2,72]),e(T,[2,73]),e(T,[2,74]),e(T,[2,75]),e(T,[2,76]),e(T,[2,77]),e(T,[2,78]),e(d,[2,57],{76:De}),e(d,[2,58],{76:U}),{5:B,28:105,31:Q,34:H,36:K,38:W,40:j},{27:[1,112],76:U},{5:oe,40:he,56:113,57:ue,59:fe},{27:[1,118],76:U},{33:119,89:p,90:R},{33:120,89:p,90:R},{75:Z,78:121,79:82,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce},e(Ee,[2,61]),e(Ee,[2,63]),e(T,[2,68]),e(d,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:B,28:126,31:Q,34:H,36:K,38:W,40:j},e(d,[2,28]),{5:[1,127]},e(d,[2,42]),{32:[1,128]},{32:[1,129]},{5:oe,40:he,56:130,57:ue,59:fe},e(d,[2,47]),{5:[1,131]},e(d,[2,48]),e(d,[2,49]),e(Me,[2,66],{79:104,75:Z,80:ee,81:te,82:se,83:ie,84:re,85:ne,86:ae,87:le,88:ce}),{33:132,89:p,90:R},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(d,[2,27]),{5:B,28:145,31:Q,34:H,36:K,38:W,40:j},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(d,[2,46]),{5:oe,40:he,56:152,57:ue,59:fe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(d,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(d,[2,43]),{5:B,28:159,31:Q,34:H,36:K,38:W,40:j},{5:B,28:160,31:Q,34:H,36:K,38:W,40:j},{5:B,28:161,31:Q,34:H,36:K,38:W,40:j},{5:B,28:162,31:Q,34:H,36:K,38:W,40:j},{5:oe,40:he,56:163,57:ue,59:fe},{5:oe,40:he,56:164,57:ue,59:fe},e(d,[2,23]),e(d,[2,24]),e(d,[2,25]),e(d,[2,26]),e(d,[2,44]),e(d,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:h(function(r,a){if(a.recoverable)this.trace(r);else{var c=new Error(r);throw c.hash=a,c}},"parseError"),parse:h(function(r){var a=this,c=[0],s=[],m=[null],t=[],me=this.table,l="",Re=0,Fe=0,He=2,$e=1,Ke=t.slice.call(arguments,1),y=Object.create(this.lexer),z={yy:{}};for(var Se in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Se)&&(z.yy[Se]=this.yy[Se]);y.setInput(r,z.yy),z.yy.lexer=y,z.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var be=y.yylloc;t.push(be);var We=y.options&&y.options.ranges;typeof z.yy.parseError=="function"?this.parseError=z.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(I){c.length=c.length-2*I,m.length=m.length-I,t.length=t.length-I}h(je,"popStack");function Pe(){var I;return I=s.pop()||y.lex()||$e,typeof I!="number"&&(I instanceof Array&&(s=I,I=s.pop()),I=a.symbols_[I]||I),I}h(Pe,"lex");for(var b,G,N,Ie,J={},ge,F,Ue,ye;;){if(G=c[c.length-1],this.defaultActions[G]?N=this.defaultActions[G]:((b===null||typeof b>"u")&&(b=Pe()),N=me[G]&&me[G][b]),typeof N>"u"||!N.length||!N[0]){var ke="";ye=[];for(ge in me[G])this.terminals_[ge]&&ge>He&&ye.push("'"+this.terminals_[ge]+"'");y.showPosition?ke="Parse error on line "+(Re+1)+`: `+y.showPosition()+` Expecting `+ye.join(", ")+", got '"+(this.terminals_[b]||b)+"'":ke="Parse error on line "+(Re+1)+": Unexpected "+(b==$e?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(ke,{text:y.match,token:this.terminals_[b]||b,line:y.yylineno,loc:be,expected:ye})}if(N[0]instanceof Array&&N.length>1)throw new Error("Parse Error: multiple actions possible at state: "+G+", token: "+b);switch(N[0]){case 1:c.push(b),m.push(y.yytext),t.push(y.yylloc),c.push(N[1]),b=null,Fe=y.yyleng,l=y.yytext,Re=y.yylineno,be=y.yylloc;break;case 2:if(F=this.productions_[N[1]][1],J.$=m[m.length-F],J._$={first_line:t[t.length-(F||1)].first_line,last_line:t[t.length-1].last_line,first_column:t[t.length-(F||1)].first_column,last_column:t[t.length-1].last_column},We&&(J._$.range=[t[t.length-(F||1)].range[0],t[t.length-1].range[1]]),Ie=this.performAction.apply(J,[l,Fe,Re,z.yy,N[1],m,t].concat(Ke)),typeof Ie<"u")return Ie;F&&(c=c.slice(0,-1*F*2),m=m.slice(0,-1*F),t=t.slice(0,-1*F)),c.push(this.productions_[N[1]][0]),m.push(J.$),t.push(J._$),Ue=me[c[c.length-2]][c[c.length-1]],c.push(Ue);break;case 3:return!0}}return!0},"parse")},Qe=(function(){var $={EOF:1,parseError:h(function(a,c){if(this.yy.parser)this.yy.parser.parseError(a,c);else throw new Error(a)},"parseError"),setInput:h(function(r,a){return this.yy=a||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:h(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var a=r.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:h(function(r){var a=r.length,c=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===s.length?this.yylloc.first_column:0)+s[s.length-c.length].length-c[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:h(function(){return this._more=!0,this},"more"),reject:h(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:h(function(r){this.unput(this.match.slice(r))},"less"),pastInput:h(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:h(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:h(function(){var r=this.pastInput(),a=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js b/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-BqJCXBk-.js similarity index 99% rename from apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js rename to apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-BqJCXBk-.js index 03db105c527..1b9b26dc004 100644 --- a/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-B5WnWxzh.js +++ b/apps/kimi-code/dist-web/assets/sankeyDiagram-HTMAVEWB-BqJCXBk-.js @@ -1,4 +1,4 @@ -import{o as kt,p as mt,s as xt,g as _t,b as vt,a as bt,_ as y,c as ot,b8 as St,d as G,ad as wt,q as Lt,k as Et}from"./mermaid.core-CJB1tAev.js";import{o as At}from"./ordinal-Cboi1Yqb.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Tt(t){for(var i=t.length/6|0,s=new Array(i),l=0;l=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s=u)&&(s=u)}return s}function dt(t,i){let s;if(i===void 0)for(const l of t)l!=null&&(s>l||s===void 0&&l>=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function J(t,i){let s=0;if(i===void 0)for(let l of t)(l=+l)&&(s+=l);else{let l=-1;for(let u of t)(u=+i(u,++l,t))&&(s+=u)}return s}function Nt(t){return t.target.depth}function Ct(t){return t.depth}function Pt(t,i){return i-1-t.height}function gt(t,i){return t.sourceLinks.length?t.depth:i-1}function It(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dt(t.sourceLinks,Nt)-1:0}function Y(t){return function(){return t}}function lt(t,i){return q(t.source,i.source)||t.index-i.index}function ct(t,i){return q(t.target,i.target)||t.index-i.index}function q(t,i){return t.y0-i.y0}function tt(t){return t.value}function Ot(t){return t.index}function $t(t){return t.nodes}function Dt(t){return t.links}function ut(t,i){const s=t.get(i);if(!s)throw new Error("missing: "+i);return s}function ht({nodes:t}){for(const i of t){let s=i.y0,l=s;for(const u of i.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of i.targetLinks)u.y1=l+u.width/2,l+=u.width}}function jt(){let t=0,i=0,s=1,l=1,u=24,x=8,g,k=Ot,o=gt,a,h,m=$t,_=Dt,d=6;function v(){const n={nodes:m.apply(null,arguments),links:_.apply(null,arguments)};return T(n),A(n),M(n),I(n),S(n),ht(n),n}v.update=function(n){return ht(n),n},v.nodeId=function(n){return arguments.length?(k=typeof n=="function"?n:Y(n),v):k},v.nodeAlign=function(n){return arguments.length?(o=typeof n=="function"?n:Y(n),v):o},v.nodeSort=function(n){return arguments.length?(a=n,v):a},v.nodeWidth=function(n){return arguments.length?(u=+n,v):u},v.nodePadding=function(n){return arguments.length?(x=g=+n,v):x},v.nodes=function(n){return arguments.length?(m=typeof n=="function"?n:Y(n),v):m},v.links=function(n){return arguments.length?(_=typeof n=="function"?n:Y(n),v):_},v.linkSort=function(n){return arguments.length?(h=n,v):h},v.size=function(n){return arguments.length?(t=i=0,s=+n[0],l=+n[1],v):[s-t,l-i]},v.extent=function(n){return arguments.length?(t=+n[0][0],s=+n[1][0],i=+n[0][1],l=+n[1][1],v):[[t,i],[s,l]]},v.iterations=function(n){return arguments.length?(d=+n,v):d};function T({nodes:n,links:f}){for(const[e,r]of n.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(n.map((e,r)=>[k(e,r,n),e]));for(const[e,r]of f.entries()){r.index=e;let{source:p,target:b}=r;typeof p!="object"&&(p=r.source=ut(c,p)),typeof b!="object"&&(b=r.target=ut(c,b)),p.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of n)e.sort(h),r.sort(h)}function A({nodes:n}){for(const f of n)f.value=f.fixedValue===void 0?Math.max(J(f.sourceLinks,tt),J(f.targetLinks,tt)):f.fixedValue}function M({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.depth=r;for(const{target:b}of p.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.height=r;for(const{source:b}of p.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:n}){const f=at(n,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of n){const p=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=p,r.x0=t+p*c,r.x1=r.x0+u,e[p]?e[p].push(r):e[p]=[r]}if(a)for(const r of e)r.sort(a);return e}function $(n){const f=dt(n,c=>(l-i-(c.length-1)*g)/J(c,tt));for(const c of n){let e=i;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+g;for(const p of r.sourceLinks)p.width=p.value*f}e=(l-e+g)/(c.length+1);for(let r=0;rc.length)-1)),$(f);for(let c=0;c0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function F(n,f,c){for(let e=n.length,r=e-2;r>=0;--r){const p=n[r];for(const b of p){let L=0,z=0;for(const{target:W,value:Z}of b.sourceLinks){let U=Z*(W.layer-b.layer);L+=E(b,W)*U,z+=U}if(!(z>0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function D(n,f){const c=n.length>>1,e=n[c];O(n,e.y0-g,c-1,f),R(n,e.y1+g,c+1,f),O(n,l,n.length-1,f),R(n,i,0,f)}function R(n,f,c,e){for(;c1e-6&&(r.y0+=p,r.y1+=p),f=r.y1+g}}function O(n,f,c,e){for(;c>=0;--c){const r=n[c],p=(r.y1-f)*e;p>1e-6&&(r.y0-=p,r.y1-=p),f=r.y0-g}}function j({sourceLinks:n,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ct);for(const{target:{targetLinks:c}}of n)c.sort(lt)}}function w(n){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of n)f.sort(ct),c.sort(lt)}function P(n,f){let c=n.y0-(n.sourceLinks.length-1)*g/2;for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c+=r+g}for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c-=r}return c}function E(n,f){let c=f.y0-(f.targetLinks.length-1)*g/2;for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c+=r+g}for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c-=r}return c}return v}var et=Math.PI,nt=2*et,B=1e-6,zt=nt-B;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function pt(){return new it}it.prototype=pt.prototype={constructor:it,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,l){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+l)},bezierCurveTo:function(t,i,s,l,u,x){this._+="C"+ +t+","+ +i+","+ +s+","+ +l+","+(this._x1=+u)+","+(this._y1=+x)},arcTo:function(t,i,s,l,u){t=+t,i=+i,s=+s,l=+l,u=+u;var x=this._x1,g=this._y1,k=s-t,o=l-i,a=x-t,h=g-i,m=a*a+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(m>B)if(!(Math.abs(h*k-o*a)>B)||!u)this._+="L"+(this._x1=t)+","+(this._y1=i);else{var _=s-x,d=l-g,v=k*k+o*o,T=_*_+d*d,A=Math.sqrt(v),M=Math.sqrt(m),I=u*Math.tan((et-Math.acos((v+m-T)/(2*A*M)))/2),N=I/M,$=I/A;Math.abs(N-1)>B&&(this._+="L"+(t+N*a)+","+(i+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>a*d)+","+(this._x1=t+$*k)+","+(this._y1=i+$*o)}},arc:function(t,i,s,l,u,x){t=+t,i=+i,s=+s,x=!!x;var g=s*Math.cos(l),k=s*Math.sin(l),o=t+g,a=i+k,h=1^x,m=x?l-u:u-l;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+a:(Math.abs(this._x1-o)>B||Math.abs(this._y1-a)>B)&&(this._+="L"+o+","+a),s&&(m<0&&(m=m%nt+nt),m>zt?this._+="A"+s+","+s+",0,1,"+h+","+(t-g)+","+(i-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=a):m>B&&(this._+="A"+s+","+s+",0,"+ +(m>=et)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=i+s*Math.sin(u))))},rect:function(t,i,s,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +l+"h"+-s+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Bt(t){return t[0]}function Ft(t){return t[1]}var Rt=Array.prototype.slice;function Vt(t){return t.source}function Wt(t){return t.target}function Ut(t){var i=Vt,s=Wt,l=Bt,u=Ft,x=null;function g(){var k,o=Rt.call(arguments),a=i.apply(this,o),h=s.apply(this,o);if(x||(x=k=pt()),t(x,+l.apply(this,(o[0]=a,o)),+u.apply(this,o),+l.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return x=null,k+""||null}return g.source=function(k){return arguments.length?(i=k,g):i},g.target=function(k){return arguments.length?(s=k,g):s},g.x=function(k){return arguments.length?(l=typeof k=="function"?k:ft(+k),g):l},g.y=function(k){return arguments.length?(u=typeof k=="function"?k:ft(+k),g):u},g.context=function(k){return arguments.length?(x=k??null,g):x},g}function Gt(t,i,s,l,u){t.moveTo(i,s),t.bezierCurveTo(i=(i+l)/2,s,i,u,l,u)}function Yt(){return Ut(Gt)}function qt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Yt().source(qt).target(Ht)}var rt=(function(){var t=y(function(k,o,a,h){for(a=a||{},h=k.length;h--;a[k[h]]=o);return a},"o"),i=[1,9],s=[1,10],l=[1,5,10,12],u={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:y(function(o,a,h,m,_,d,v){var T=d.length-1;switch(_){case 7:const A=m.findOrCreateNode(d[T-4].trim().replaceAll('""','"')),M=m.findOrCreateNode(d[T-2].trim().replaceAll('""','"')),I=parseFloat(d[T].trim());m.addLink(A,M,I);break;case 8:case 9:case 11:this.$=d[T];break;case 10:this.$=d[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:i,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:i,20:s},{15:18,16:7,17:8,18:i,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:i,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:y(function(o,a){if(a.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=a,h}},"parseError"),parse:y(function(o){var a=this,h=[0],m=[],_=[null],d=[],v=this.table,T="",A=0,M=0,I=2,N=1,$=d.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;d.push(D);var R=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,d.length=d.length-L}y(O,"popStack");function j(){var L;return L=m.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(m=L,L=m.pop()),L=a.symbols_[L]||L),L}y(j,"lex");for(var w,P,E,n,f={},c,e,r,p;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=j()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";p=[];for(c in v[P])this.terminals_[c]&&c>I&&p.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: +import{o as kt,p as mt,s as xt,g as _t,b as vt,a as bt,_ as y,c as ot,b8 as St,d as G,ad as wt,q as Lt,k as Et}from"./mermaid.core-CsZwh_jB.js";import{o as At}from"./ordinal-Cboi1Yqb.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./init-Gi6I4Gst.js";function Tt(t){for(var i=t.length/6|0,s=new Array(i),l=0;l=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s=u)&&(s=u)}return s}function dt(t,i){let s;if(i===void 0)for(const l of t)l!=null&&(s>l||s===void 0&&l>=l)&&(s=l);else{let l=-1;for(let u of t)(u=i(u,++l,t))!=null&&(s>u||s===void 0&&u>=u)&&(s=u)}return s}function J(t,i){let s=0;if(i===void 0)for(let l of t)(l=+l)&&(s+=l);else{let l=-1;for(let u of t)(u=+i(u,++l,t))&&(s+=u)}return s}function Nt(t){return t.target.depth}function Ct(t){return t.depth}function Pt(t,i){return i-1-t.height}function gt(t,i){return t.sourceLinks.length?t.depth:i-1}function It(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?dt(t.sourceLinks,Nt)-1:0}function Y(t){return function(){return t}}function lt(t,i){return q(t.source,i.source)||t.index-i.index}function ct(t,i){return q(t.target,i.target)||t.index-i.index}function q(t,i){return t.y0-i.y0}function tt(t){return t.value}function Ot(t){return t.index}function $t(t){return t.nodes}function Dt(t){return t.links}function ut(t,i){const s=t.get(i);if(!s)throw new Error("missing: "+i);return s}function ht({nodes:t}){for(const i of t){let s=i.y0,l=s;for(const u of i.sourceLinks)u.y0=s+u.width/2,s+=u.width;for(const u of i.targetLinks)u.y1=l+u.width/2,l+=u.width}}function jt(){let t=0,i=0,s=1,l=1,u=24,x=8,g,k=Ot,o=gt,a,h,m=$t,_=Dt,d=6;function v(){const n={nodes:m.apply(null,arguments),links:_.apply(null,arguments)};return T(n),A(n),M(n),I(n),S(n),ht(n),n}v.update=function(n){return ht(n),n},v.nodeId=function(n){return arguments.length?(k=typeof n=="function"?n:Y(n),v):k},v.nodeAlign=function(n){return arguments.length?(o=typeof n=="function"?n:Y(n),v):o},v.nodeSort=function(n){return arguments.length?(a=n,v):a},v.nodeWidth=function(n){return arguments.length?(u=+n,v):u},v.nodePadding=function(n){return arguments.length?(x=g=+n,v):x},v.nodes=function(n){return arguments.length?(m=typeof n=="function"?n:Y(n),v):m},v.links=function(n){return arguments.length?(_=typeof n=="function"?n:Y(n),v):_},v.linkSort=function(n){return arguments.length?(h=n,v):h},v.size=function(n){return arguments.length?(t=i=0,s=+n[0],l=+n[1],v):[s-t,l-i]},v.extent=function(n){return arguments.length?(t=+n[0][0],s=+n[1][0],i=+n[0][1],l=+n[1][1],v):[[t,i],[s,l]]},v.iterations=function(n){return arguments.length?(d=+n,v):d};function T({nodes:n,links:f}){for(const[e,r]of n.entries())r.index=e,r.sourceLinks=[],r.targetLinks=[];const c=new Map(n.map((e,r)=>[k(e,r,n),e]));for(const[e,r]of f.entries()){r.index=e;let{source:p,target:b}=r;typeof p!="object"&&(p=r.source=ut(c,p)),typeof b!="object"&&(b=r.target=ut(c,b)),p.sourceLinks.push(r),b.targetLinks.push(r)}if(h!=null)for(const{sourceLinks:e,targetLinks:r}of n)e.sort(h),r.sort(h)}function A({nodes:n}){for(const f of n)f.value=f.fixedValue===void 0?Math.max(J(f.sourceLinks,tt),J(f.targetLinks,tt)):f.fixedValue}function M({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.depth=r;for(const{target:b}of p.sourceLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function I({nodes:n}){const f=n.length;let c=new Set(n),e=new Set,r=0;for(;c.size;){for(const p of c){p.height=r;for(const{source:b}of p.targetLinks)e.add(b)}if(++r>f)throw new Error("circular link");c=e,e=new Set}}function N({nodes:n}){const f=at(n,r=>r.depth)+1,c=(s-t-u)/(f-1),e=new Array(f);for(const r of n){const p=Math.max(0,Math.min(f-1,Math.floor(o.call(null,r,f))));r.layer=p,r.x0=t+p*c,r.x1=r.x0+u,e[p]?e[p].push(r):e[p]=[r]}if(a)for(const r of e)r.sort(a);return e}function $(n){const f=dt(n,c=>(l-i-(c.length-1)*g)/J(c,tt));for(const c of n){let e=i;for(const r of c){r.y0=e,r.y1=e+r.value*f,e=r.y1+g;for(const p of r.sourceLinks)p.width=p.value*f}e=(l-e+g)/(c.length+1);for(let r=0;rc.length)-1)),$(f);for(let c=0;c0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function F(n,f,c){for(let e=n.length,r=e-2;r>=0;--r){const p=n[r];for(const b of p){let L=0,z=0;for(const{target:W,value:Z}of b.sourceLinks){let U=Z*(W.layer-b.layer);L+=E(b,W)*U,z+=U}if(!(z>0))continue;let V=(L/z-b.y0)*f;b.y0+=V,b.y1+=V,j(b)}a===void 0&&p.sort(q),D(p,c)}}function D(n,f){const c=n.length>>1,e=n[c];O(n,e.y0-g,c-1,f),R(n,e.y1+g,c+1,f),O(n,l,n.length-1,f),R(n,i,0,f)}function R(n,f,c,e){for(;c1e-6&&(r.y0+=p,r.y1+=p),f=r.y1+g}}function O(n,f,c,e){for(;c>=0;--c){const r=n[c],p=(r.y1-f)*e;p>1e-6&&(r.y0-=p,r.y1-=p),f=r.y0-g}}function j({sourceLinks:n,targetLinks:f}){if(h===void 0){for(const{source:{sourceLinks:c}}of f)c.sort(ct);for(const{target:{targetLinks:c}}of n)c.sort(lt)}}function w(n){if(h===void 0)for(const{sourceLinks:f,targetLinks:c}of n)f.sort(ct),c.sort(lt)}function P(n,f){let c=n.y0-(n.sourceLinks.length-1)*g/2;for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c+=r+g}for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c-=r}return c}function E(n,f){let c=f.y0-(f.targetLinks.length-1)*g/2;for(const{source:e,width:r}of f.targetLinks){if(e===n)break;c+=r+g}for(const{target:e,width:r}of n.sourceLinks){if(e===f)break;c-=r}return c}return v}var et=Math.PI,nt=2*et,B=1e-6,zt=nt-B;function it(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function pt(){return new it}it.prototype=pt.prototype={constructor:it,moveTo:function(t,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,i){this._+="L"+(this._x1=+t)+","+(this._y1=+i)},quadraticCurveTo:function(t,i,s,l){this._+="Q"+ +t+","+ +i+","+(this._x1=+s)+","+(this._y1=+l)},bezierCurveTo:function(t,i,s,l,u,x){this._+="C"+ +t+","+ +i+","+ +s+","+ +l+","+(this._x1=+u)+","+(this._y1=+x)},arcTo:function(t,i,s,l,u){t=+t,i=+i,s=+s,l=+l,u=+u;var x=this._x1,g=this._y1,k=s-t,o=l-i,a=x-t,h=g-i,m=a*a+h*h;if(u<0)throw new Error("negative radius: "+u);if(this._x1===null)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(m>B)if(!(Math.abs(h*k-o*a)>B)||!u)this._+="L"+(this._x1=t)+","+(this._y1=i);else{var _=s-x,d=l-g,v=k*k+o*o,T=_*_+d*d,A=Math.sqrt(v),M=Math.sqrt(m),I=u*Math.tan((et-Math.acos((v+m-T)/(2*A*M)))/2),N=I/M,$=I/A;Math.abs(N-1)>B&&(this._+="L"+(t+N*a)+","+(i+N*h)),this._+="A"+u+","+u+",0,0,"+ +(h*_>a*d)+","+(this._x1=t+$*k)+","+(this._y1=i+$*o)}},arc:function(t,i,s,l,u,x){t=+t,i=+i,s=+s,x=!!x;var g=s*Math.cos(l),k=s*Math.sin(l),o=t+g,a=i+k,h=1^x,m=x?l-u:u-l;if(s<0)throw new Error("negative radius: "+s);this._x1===null?this._+="M"+o+","+a:(Math.abs(this._x1-o)>B||Math.abs(this._y1-a)>B)&&(this._+="L"+o+","+a),s&&(m<0&&(m=m%nt+nt),m>zt?this._+="A"+s+","+s+",0,1,"+h+","+(t-g)+","+(i-k)+"A"+s+","+s+",0,1,"+h+","+(this._x1=o)+","+(this._y1=a):m>B&&(this._+="A"+s+","+s+",0,"+ +(m>=et)+","+h+","+(this._x1=t+s*Math.cos(u))+","+(this._y1=i+s*Math.sin(u))))},rect:function(t,i,s,l){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+i)+"h"+ +s+"v"+ +l+"h"+-s+"Z"},toString:function(){return this._}};function ft(t){return function(){return t}}function Bt(t){return t[0]}function Ft(t){return t[1]}var Rt=Array.prototype.slice;function Vt(t){return t.source}function Wt(t){return t.target}function Ut(t){var i=Vt,s=Wt,l=Bt,u=Ft,x=null;function g(){var k,o=Rt.call(arguments),a=i.apply(this,o),h=s.apply(this,o);if(x||(x=k=pt()),t(x,+l.apply(this,(o[0]=a,o)),+u.apply(this,o),+l.apply(this,(o[0]=h,o)),+u.apply(this,o)),k)return x=null,k+""||null}return g.source=function(k){return arguments.length?(i=k,g):i},g.target=function(k){return arguments.length?(s=k,g):s},g.x=function(k){return arguments.length?(l=typeof k=="function"?k:ft(+k),g):l},g.y=function(k){return arguments.length?(u=typeof k=="function"?k:ft(+k),g):u},g.context=function(k){return arguments.length?(x=k??null,g):x},g}function Gt(t,i,s,l,u){t.moveTo(i,s),t.bezierCurveTo(i=(i+l)/2,s,i,u,l,u)}function Yt(){return Ut(Gt)}function qt(t){return[t.source.x1,t.y0]}function Ht(t){return[t.target.x0,t.y1]}function Xt(){return Yt().source(qt).target(Ht)}var rt=(function(){var t=y(function(k,o,a,h){for(a=a||{},h=k.length;h--;a[k[h]]=o);return a},"o"),i=[1,9],s=[1,10],l=[1,5,10,12],u={trace:y(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SANKEY:4,NEWLINE:5,csv:6,opt_eof:7,record:8,csv_tail:9,EOF:10,"field[source]":11,COMMA:12,"field[target]":13,"field[value]":14,field:15,escaped:16,non_escaped:17,DQUOTE:18,ESCAPED_TEXT:19,NON_ESCAPED_TEXT:20,$accept:0,$end:1},terminals_:{2:"error",4:"SANKEY",5:"NEWLINE",10:"EOF",11:"field[source]",12:"COMMA",13:"field[target]",14:"field[value]",18:"DQUOTE",19:"ESCAPED_TEXT",20:"NON_ESCAPED_TEXT"},productions_:[0,[3,4],[6,2],[9,2],[9,0],[7,1],[7,0],[8,5],[15,1],[15,1],[16,3],[17,1]],performAction:y(function(o,a,h,m,_,d,v){var T=d.length-1;switch(_){case 7:const A=m.findOrCreateNode(d[T-4].trim().replaceAll('""','"')),M=m.findOrCreateNode(d[T-2].trim().replaceAll('""','"')),I=parseFloat(d[T].trim());m.addLink(A,M,I);break;case 8:case 9:case 11:this.$=d[T];break;case 10:this.$=d[T-1];break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},{5:[1,3]},{6:4,8:5,15:6,16:7,17:8,18:i,20:s},{1:[2,6],7:11,10:[1,12]},t(s,[2,4],{9:13,5:[1,14]}),{12:[1,15]},t(l,[2,8]),t(l,[2,9]),{19:[1,16]},t(l,[2,11]),{1:[2,1]},{1:[2,5]},t(s,[2,2]),{6:17,8:5,15:6,16:7,17:8,18:i,20:s},{15:18,16:7,17:8,18:i,20:s},{18:[1,19]},t(s,[2,3]),{12:[1,20]},t(l,[2,10]),{15:21,16:7,17:8,18:i,20:s},t([1,5,10],[2,7])],defaultActions:{11:[2,1],12:[2,5]},parseError:y(function(o,a){if(a.recoverable)this.trace(o);else{var h=new Error(o);throw h.hash=a,h}},"parseError"),parse:y(function(o){var a=this,h=[0],m=[],_=[null],d=[],v=this.table,T="",A=0,M=0,I=2,N=1,$=d.slice.call(arguments,1),S=Object.create(this.lexer),C={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(C.yy[F]=this.yy[F]);S.setInput(o,C.yy),C.yy.lexer=S,C.yy.parser=this,typeof S.yylloc>"u"&&(S.yylloc={});var D=S.yylloc;d.push(D);var R=S.options&&S.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function O(L){h.length=h.length-2*L,_.length=_.length-L,d.length=d.length-L}y(O,"popStack");function j(){var L;return L=m.pop()||S.lex()||N,typeof L!="number"&&(L instanceof Array&&(m=L,L=m.pop()),L=a.symbols_[L]||L),L}y(j,"lex");for(var w,P,E,n,f={},c,e,r,p;;){if(P=h[h.length-1],this.defaultActions[P]?E=this.defaultActions[P]:((w===null||typeof w>"u")&&(w=j()),E=v[P]&&v[P][w]),typeof E>"u"||!E.length||!E[0]){var b="";p=[];for(c in v[P])this.terminals_[c]&&c>I&&p.push("'"+this.terminals_[c]+"'");S.showPosition?b="Parse error on line "+(A+1)+`: `+S.showPosition()+` Expecting `+p.join(", ")+", got '"+(this.terminals_[w]||w)+"'":b="Parse error on line "+(A+1)+": Unexpected "+(w==N?"end of input":"'"+(this.terminals_[w]||w)+"'"),this.parseError(b,{text:S.match,token:this.terminals_[w]||w,line:S.yylineno,loc:D,expected:p})}if(E[0]instanceof Array&&E.length>1)throw new Error("Parse Error: multiple actions possible at state: "+P+", token: "+w);switch(E[0]){case 1:h.push(w),_.push(S.yytext),d.push(S.yylloc),h.push(E[1]),w=null,M=S.yyleng,T=S.yytext,A=S.yylineno,D=S.yylloc;break;case 2:if(e=this.productions_[E[1]][1],f.$=_[_.length-e],f._$={first_line:d[d.length-(e||1)].first_line,last_line:d[d.length-1].last_line,first_column:d[d.length-(e||1)].first_column,last_column:d[d.length-1].last_column},R&&(f._$.range=[d[d.length-(e||1)].range[0],d[d.length-1].range[1]]),n=this.performAction.apply(f,[T,M,A,C.yy,E[1],_,d].concat($)),typeof n<"u")return n;e&&(h=h.slice(0,-1*e*2),_=_.slice(0,-1*e),d=d.slice(0,-1*e)),h.push(this.productions_[E[1]][0]),_.push(f.$),d.push(f._$),r=v[h[h.length-2]][h[h.length-1]],h.push(r);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:y(function(a,h){if(this.yy.parser)this.yy.parser.parseError(a,h);else throw new Error(a)},"parseError"),setInput:y(function(o,a){return this.yy=a||this.yy||{},this._input=o,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:y(function(){var o=this._input[0];this.yytext+=o,this.yyleng++,this.offset++,this.match+=o,this.matched+=o;var a=o.match(/(?:\r\n?|\n).*/g);return a?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),o},"input"),unput:y(function(o){var a=o.length,h=o.split(/(?:\r\n?|\n)/g);this._input=o+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-a),this.offset-=a;var m=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),h.length-1&&(this.yylineno-=h.length-1);var _=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:h?(h.length===m.length?this.yylloc.first_column:0)+m[m.length-h.length].length-h[0].length:this.yylloc.first_column-a},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-a]),this.yyleng=this.yytext.length,this},"unput"),more:y(function(){return this._more=!0,this},"more"),reject:y(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:y(function(o){this.unput(this.match.slice(o))},"less"),pastInput:y(function(){var o=this.matched.substr(0,this.matched.length-this.match.length);return(o.length>20?"...":"")+o.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:y(function(){var o=this.match;return o.length<20&&(o+=this._input.substr(0,20-o.length)),(o.substr(0,20)+(o.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:y(function(){var o=this.pastInput(),a=new Array(o.length+1).join("-");return o+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js b/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-FwgGv3En.js similarity index 99% rename from apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js rename to apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-FwgGv3En.js index 4cd153b7788..0d067d0e771 100644 --- a/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-CnV0H-kS.js +++ b/apps/kimi-code/dist-web/assets/sequenceDiagram-DBY2YBRQ-FwgGv3En.js @@ -1,4 +1,4 @@ -import{I as tr}from"./chunk-2Q5K7J3B-DsAC7dRk.js";import{_ as x,X as er,c as $,d as Vt,l as at,j as Ce,e as rr,f as ar,k as N,b as ke,s as sr,o as ir,a as nr,g as or,p as cr,Y as lr,Z as hr,q as dr,i as Yt,y as Z,$ as Q,a0 as Pt,a1 as Me,a2 as Tr,z as Kt,a3 as pr,a4 as Be}from"./mermaid.core-CJB1tAev.js";import{a as Er,b as ae,g as dt,d as ur,c as se,e as ie}from"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var te=(function(){var e=x(function(ut,S,v,P){for(v=v||{},P=ut.length;P--;v[ut[P]]=S);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],u=[1,14],d=[1,15],p=[1,17],_=[1,18],E=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],w=[1,32],A=[1,33],D=[1,34],M=[1,35],V=[1,36],W=[1,37],U=[1,38],G=[1,39],X=[1,40],nt=[1,42],j=[1,43],H=[1,44],st=[1,45],tt=[1,46],Y=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],At=[1,74],kt=[1,80],m=[1,81],k=[1,82],lt=[1,83],et=[1,84],K=[1,85],Ot=[1,86],ne=[1,87],oe=[1,88],ce=[1,89],le=[1,90],he=[1,91],de=[1,92],Te=[1,93],pe=[1,94],Ee=[1,95],ue=[1,96],fe=[1,97],_e=[1,98],ge=[1,99],xe=[1,100],Ie=[1,101],ye=[1,102],Re=[1,103],Oe=[1,104],Le=[1,105],be=[2,78],St=[4,5,17,51,53,54],Dt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],me=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Ut=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Ae=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Gt=[5,52],F=[70,71,72,73],ot=[1,151],Xt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(S,v,P,y,z,c,wt){var h=c.length-1;switch(z){case 3:return y.apply(c[h]),c[h];case 4:case 10:this.$=[];break;case 5:case 11:c[h-1].push(c[h]),this.$=c[h-1];break;case 6:case 7:case 12:case 13:this.$=c[h];break;case 8:case 9:case 14:this.$=[];break;case 16:c[h].type="createParticipant",this.$=c[h];break;case 17:c[h-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[h-2])}),c[h-1].push({type:"boxEnd",boxText:c[h-2]}),this.$=c[h-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-2]),sequenceIndexStep:Number(c[h-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-1].actor};break;case 30:y.setDiagramTitle(c[h].substring(6)),this.$=c[h].substring(6);break;case 31:y.setDiagramTitle(c[h].substring(7)),this.$=c[h].substring(7);break;case 32:this.$=c[h].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[h].trim(),y.setAccDescription(this.$);break;case 35:c[h-1].unshift({type:"loopStart",loopText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.LOOP_START}),c[h-1].push({type:"loopEnd",loopText:c[h-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[h-1];break;case 36:c[h-1].unshift({type:"rectStart",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_START}),c[h-1].push({type:"rectEnd",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[h-1];break;case 37:c[h-1].unshift({type:"optStart",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_START}),c[h-1].push({type:"optEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[h-1];break;case 38:c[h-1].unshift({type:"altStart",altText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.ALT_START}),c[h-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[h-1];break;case 39:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 40:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 41:c[h-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.CRITICAL_START}),c[h-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[h-1];break;case 42:c[h-1].unshift({type:"breakStart",breakText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_START}),c[h-1].push({type:"breakEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[h-1];break;case 44:this.$=c[h-3].concat([{type:"option",optionText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[h]]);break;case 46:this.$=c[h-3].concat([{type:"and",parText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.PAR_AND},c[h]]);break;case 48:this.$=c[h-3].concat([{type:"else",altText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.ALT_ELSE},c[h]]);break;case 49:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 50:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 51:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 52:case 57:c[h-1].draw="actor",c[h-1].type="addParticipant",this.$=c[h-1];break;case 53:c[h-1].type="destroyParticipant",this.$=c[h-1];break;case 54:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 55:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 56:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 58:this.$=[c[h-1],{type:"addNote",placement:c[h-2],actor:c[h-1].actor,text:c[h]}];break;case 59:c[h-2]=[].concat(c[h-1],c[h-1]).slice(0,2),c[h-2][0]=c[h-2][0].actor,c[h-2][1]=c[h-2][1].actor,this.$=[c[h-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[h-2].slice(0,2),text:c[h]}];break;case 60:this.$=[c[h-1],{type:"addLinks",actor:c[h-1].actor,text:c[h]}];break;case 61:this.$=[c[h-1],{type:"addALink",actor:c[h-1].actor,text:c[h]}];break;case 62:this.$=[c[h-1],{type:"addProperties",actor:c[h-1].actor,text:c[h]}];break;case 63:this.$=[c[h-1],{type:"addDetails",actor:c[h-1].actor,text:c[h]}];break;case 66:this.$=[c[h-2],c[h]];break;case 67:this.$=c[h];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor}];break;case 71:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-4].actor}];break;case 72:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor}];break;case 73:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-4].actor}];break;case 74:this.$=[c[h-5],c[h-1],{type:"addMessage",from:c[h-5].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-5].actor}];break;case 75:this.$=[c[h-3],c[h-1],{type:"addMessage",from:c[h-3].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h]}];break;case 76:this.$={type:"addParticipant",actor:c[h-1],config:c[h]};break;case 77:this.$=c[h-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[h]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[h].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,5]),{9:48,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:U,53:G,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:Y},{23:56,73:Y},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:At},{23:75,55:76,73:At},{23:77,73:Y},{69:78,72:[1,79],78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:Y},{23:111,73:Y},{23:112,73:Y},{23:113,73:Y},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],be),e(C,[2,6]),e(C,[2,16]),e(St,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(Dt,i,{7:120}),e(Dt,i,{7:121}),e(Dt,i,{7:122}),e(me,i,{41:123,7:124}),e(Ut,i,{43:125,7:126}),e(Ut,i,{7:126,43:127}),e(Ae,i,{46:128,7:129}),e(Dt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Gt,be,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:Y},{69:146,78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},e(F,[2,79]),e(F,[2,80]),e(F,[2,81]),e(F,[2,82]),e(F,[2,83]),e(F,[2,84]),e(F,[2,85]),e(F,[2,86]),e(F,[2,87]),e(F,[2,88]),e(F,[2,89]),e(F,[2,90]),e(F,[2,91]),e(F,[2,92]),e(F,[2,93]),e(F,[2,94]),e(F,[2,95]),e(F,[2,96]),e(F,[2,97]),e(F,[2,98]),e(F,[2,99]),e(F,[2,100]),e(F,[2,101]),e(F,[2,102]),e(F,[2,103]),e(F,[2,104]),{23:147,73:Y},{23:149,60:148,73:Y},{73:[2,68]},{73:[2,69]},{58:150,104:ot},{58:152,104:ot},{58:153,104:ot},{58:154,104:ot},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:U,53:G,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,161],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,162],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,163],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,47],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,50:[1,165],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,45],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,49:[1,167],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,43],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,48:[1,170],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,171],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Gt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:Y},{23:178,73:Y},{23:179,73:Y},{58:180,104:ot},{23:181,72:[1,182],73:Y},{58:183,104:ot},{58:184,104:ot},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(St,[2,11]),{13:186,51:U,53:G,54:X},e(St,[2,13]),e(St,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ot},{58:196,104:ot},{58:197,104:ot},{5:[2,75]},{58:198,104:ot},{23:199,73:Y},{5:[2,58]},{5:[2,59]},{23:200,73:Y},e(St,[2,12]),e(me,i,{7:124,41:201}),e(Ut,i,{7:126,43:202}),e(Ae,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Gt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ot},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(S,v){if(v.recoverable)this.trace(S);else{var P=new Error(S);throw P.hash=v,P}},"parseError"),parse:x(function(S){var v=this,P=[0],y=[],z=[null],c=[],wt=this.table,h="",Ct=0,Se=0,Ze=2,we=1,Qe=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Jt)&&(gt.yy[Jt]=this.yy[Jt]);J.setInput(S,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Zt=J.yylloc;c.push(Zt);var $e=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(it){P.length=P.length-2*it,z.length=z.length-it,c.length=c.length-it}x(je,"popStack");function Ne(){var it;return it=y.pop()||J.lex()||we,typeof it!="number"&&(it instanceof Array&&(y=it,it=y.pop()),it=v.symbols_[it]||it),it}x(Ne,"lex");for(var rt,xt,ct,Qt,Lt={},Mt,Tt,Pe,Bt;;){if(xt=P[P.length-1],this.defaultActions[xt]?ct=this.defaultActions[xt]:((rt===null||typeof rt>"u")&&(rt=Ne()),ct=wt[xt]&&wt[xt][rt]),typeof ct>"u"||!ct.length||!ct[0]){var $t="";Bt=[];for(Mt in wt[xt])this.terminals_[Mt]&&Mt>Ze&&Bt.push("'"+this.terminals_[Mt]+"'");J.showPosition?$t="Parse error on line "+(Ct+1)+`: +import{I as tr}from"./chunk-2Q5K7J3B-Dntoz8YC.js";import{_ as x,X as er,c as $,d as Vt,l as at,j as Ce,e as rr,f as ar,k as N,b as ke,s as sr,o as ir,a as nr,g as or,p as cr,Y as lr,Z as hr,q as dr,i as Yt,y as Z,$ as Q,a0 as Pt,a1 as Me,a2 as Tr,z as Kt,a3 as pr,a4 as Be}from"./mermaid.core-CsZwh_jB.js";import{a as Er,b as ae,g as dt,d as ur,c as se,e as ie}from"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var te=(function(){var e=x(function(ut,S,v,P){for(v=v||{},P=ut.length;P--;v[ut[P]]=S);return v},"o"),t=[1,2],a=[1,3],r=[1,4],i=[2,4],n=[1,9],s=[1,11],o=[1,12],u=[1,14],d=[1,15],p=[1,17],_=[1,18],E=[1,19],O=[1,25],T=[1,26],g=[1,27],f=[1,28],I=[1,29],L=[1,30],b=[1,31],w=[1,32],A=[1,33],D=[1,34],M=[1,35],V=[1,36],W=[1,37],U=[1,38],G=[1,39],X=[1,40],nt=[1,42],j=[1,43],H=[1,44],st=[1,45],tt=[1,46],Y=[1,47],C=[1,4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,49,50,51,53,54,56,61,62,63,64,73],At=[1,74],kt=[1,80],m=[1,81],k=[1,82],lt=[1,83],et=[1,84],K=[1,85],Ot=[1,86],ne=[1,87],oe=[1,88],ce=[1,89],le=[1,90],he=[1,91],de=[1,92],Te=[1,93],pe=[1,94],Ee=[1,95],ue=[1,96],fe=[1,97],_e=[1,98],ge=[1,99],xe=[1,100],Ie=[1,101],ye=[1,102],Re=[1,103],Oe=[1,104],Le=[1,105],be=[2,78],St=[4,5,17,51,53,54],Dt=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],me=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,50,51,53,54,56,61,62,63,64,73],Ut=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,49,51,53,54,56,61,62,63,64,73],Ae=[4,5,10,14,15,17,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,48,51,53,54,56,61,62,63,64,73],Gt=[5,52],F=[70,71,72,73],ot=[1,151],Xt={trace:x(function(){},"trace"),yy:{},symbols_:{error:2,start:3,SPACE:4,NEWLINE:5,SD:6,document:7,line:8,statement:9,INVALID:10,box_section:11,box_line:12,participant_statement:13,create:14,box:15,restOfLine:16,end:17,signal:18,autonumber:19,NUM:20,off:21,activate:22,actor:23,deactivate:24,note_statement:25,links_statement:26,link_statement:27,properties_statement:28,details_statement:29,title:30,legacy_title:31,acc_title:32,acc_title_value:33,acc_descr:34,acc_descr_value:35,acc_descr_multiline_value:36,loop:37,rect:38,opt:39,alt:40,else_sections:41,par:42,par_sections:43,par_over:44,critical:45,option_sections:46,break:47,option:48,and:49,else:50,participant:51,AS:52,participant_actor:53,destroy:54,actor_with_config:55,note:56,placement:57,text2:58,over:59,actor_pair:60,links:61,link:62,properties:63,details:64,spaceList:65,",":66,left_of:67,right_of:68,signaltype:69,"+":70,"-":71,"()":72,ACTOR:73,config_object:74,CONFIG_START:75,CONFIG_CONTENT:76,CONFIG_END:77,SOLID_OPEN_ARROW:78,DOTTED_OPEN_ARROW:79,SOLID_ARROW:80,SOLID_ARROW_TOP:81,SOLID_ARROW_BOTTOM:82,STICK_ARROW_TOP:83,STICK_ARROW_BOTTOM:84,SOLID_ARROW_TOP_DOTTED:85,SOLID_ARROW_BOTTOM_DOTTED:86,STICK_ARROW_TOP_DOTTED:87,STICK_ARROW_BOTTOM_DOTTED:88,SOLID_ARROW_TOP_REVERSE:89,SOLID_ARROW_BOTTOM_REVERSE:90,STICK_ARROW_TOP_REVERSE:91,STICK_ARROW_BOTTOM_REVERSE:92,SOLID_ARROW_TOP_REVERSE_DOTTED:93,SOLID_ARROW_BOTTOM_REVERSE_DOTTED:94,STICK_ARROW_TOP_REVERSE_DOTTED:95,STICK_ARROW_BOTTOM_REVERSE_DOTTED:96,BIDIRECTIONAL_SOLID_ARROW:97,DOTTED_ARROW:98,BIDIRECTIONAL_DOTTED_ARROW:99,SOLID_CROSS:100,DOTTED_CROSS:101,SOLID_POINT:102,DOTTED_POINT:103,TXT:104,$accept:0,$end:1},terminals_:{2:"error",4:"SPACE",5:"NEWLINE",6:"SD",10:"INVALID",14:"create",15:"box",16:"restOfLine",17:"end",19:"autonumber",20:"NUM",21:"off",22:"activate",24:"deactivate",30:"title",31:"legacy_title",32:"acc_title",33:"acc_title_value",34:"acc_descr",35:"acc_descr_value",36:"acc_descr_multiline_value",37:"loop",38:"rect",39:"opt",40:"alt",42:"par",44:"par_over",45:"critical",47:"break",48:"option",49:"and",50:"else",51:"participant",52:"AS",53:"participant_actor",54:"destroy",56:"note",59:"over",61:"links",62:"link",63:"properties",64:"details",66:",",67:"left_of",68:"right_of",70:"+",71:"-",72:"()",73:"ACTOR",75:"CONFIG_START",76:"CONFIG_CONTENT",77:"CONFIG_END",78:"SOLID_OPEN_ARROW",79:"DOTTED_OPEN_ARROW",80:"SOLID_ARROW",81:"SOLID_ARROW_TOP",82:"SOLID_ARROW_BOTTOM",83:"STICK_ARROW_TOP",84:"STICK_ARROW_BOTTOM",85:"SOLID_ARROW_TOP_DOTTED",86:"SOLID_ARROW_BOTTOM_DOTTED",87:"STICK_ARROW_TOP_DOTTED",88:"STICK_ARROW_BOTTOM_DOTTED",89:"SOLID_ARROW_TOP_REVERSE",90:"SOLID_ARROW_BOTTOM_REVERSE",91:"STICK_ARROW_TOP_REVERSE",92:"STICK_ARROW_BOTTOM_REVERSE",93:"SOLID_ARROW_TOP_REVERSE_DOTTED",94:"SOLID_ARROW_BOTTOM_REVERSE_DOTTED",95:"STICK_ARROW_TOP_REVERSE_DOTTED",96:"STICK_ARROW_BOTTOM_REVERSE_DOTTED",97:"BIDIRECTIONAL_SOLID_ARROW",98:"DOTTED_ARROW",99:"BIDIRECTIONAL_DOTTED_ARROW",100:"SOLID_CROSS",101:"DOTTED_CROSS",102:"SOLID_POINT",103:"DOTTED_POINT",104:"TXT"},productions_:[0,[3,2],[3,2],[3,2],[7,0],[7,2],[8,2],[8,1],[8,1],[8,1],[11,0],[11,2],[12,2],[12,1],[12,1],[9,1],[9,2],[9,4],[9,2],[9,4],[9,3],[9,3],[9,2],[9,3],[9,3],[9,2],[9,2],[9,2],[9,2],[9,2],[9,1],[9,1],[9,2],[9,2],[9,1],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[9,4],[46,1],[46,4],[43,1],[43,4],[41,1],[41,4],[13,5],[13,3],[13,5],[13,3],[13,3],[13,5],[13,3],[13,5],[13,3],[25,4],[25,4],[26,3],[27,3],[28,3],[29,3],[65,2],[65,1],[60,3],[60,1],[57,1],[57,1],[18,5],[18,5],[18,5],[18,5],[18,6],[18,4],[55,2],[74,3],[23,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[69,1],[58,1]],performAction:x(function(S,v,P,y,z,c,wt){var h=c.length-1;switch(z){case 3:return y.apply(c[h]),c[h];case 4:case 10:this.$=[];break;case 5:case 11:c[h-1].push(c[h]),this.$=c[h-1];break;case 6:case 7:case 12:case 13:this.$=c[h];break;case 8:case 9:case 14:this.$=[];break;case 16:c[h].type="createParticipant",this.$=c[h];break;case 17:c[h-1].unshift({type:"boxStart",boxData:y.parseBoxData(c[h-2])}),c[h-1].push({type:"boxEnd",boxText:c[h-2]}),this.$=c[h-1];break;case 19:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-2]),sequenceIndexStep:Number(c[h-1]),sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 20:this.$={type:"sequenceIndex",sequenceIndex:Number(c[h-1]),sequenceIndexStep:1,sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 21:this.$={type:"sequenceIndex",sequenceVisible:!1,signalType:y.LINETYPE.AUTONUMBER};break;case 22:this.$={type:"sequenceIndex",sequenceVisible:!0,signalType:y.LINETYPE.AUTONUMBER};break;case 23:this.$={type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor};break;case 24:this.$={type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-1].actor};break;case 30:y.setDiagramTitle(c[h].substring(6)),this.$=c[h].substring(6);break;case 31:y.setDiagramTitle(c[h].substring(7)),this.$=c[h].substring(7);break;case 32:this.$=c[h].trim(),y.setAccTitle(this.$);break;case 33:case 34:this.$=c[h].trim(),y.setAccDescription(this.$);break;case 35:c[h-1].unshift({type:"loopStart",loopText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.LOOP_START}),c[h-1].push({type:"loopEnd",loopText:c[h-2],signalType:y.LINETYPE.LOOP_END}),this.$=c[h-1];break;case 36:c[h-1].unshift({type:"rectStart",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_START}),c[h-1].push({type:"rectEnd",color:y.parseMessage(c[h-2]),signalType:y.LINETYPE.RECT_END}),this.$=c[h-1];break;case 37:c[h-1].unshift({type:"optStart",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_START}),c[h-1].push({type:"optEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.OPT_END}),this.$=c[h-1];break;case 38:c[h-1].unshift({type:"altStart",altText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.ALT_START}),c[h-1].push({type:"altEnd",signalType:y.LINETYPE.ALT_END}),this.$=c[h-1];break;case 39:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 40:c[h-1].unshift({type:"parStart",parText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.PAR_OVER_START}),c[h-1].push({type:"parEnd",signalType:y.LINETYPE.PAR_END}),this.$=c[h-1];break;case 41:c[h-1].unshift({type:"criticalStart",criticalText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.CRITICAL_START}),c[h-1].push({type:"criticalEnd",signalType:y.LINETYPE.CRITICAL_END}),this.$=c[h-1];break;case 42:c[h-1].unshift({type:"breakStart",breakText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_START}),c[h-1].push({type:"breakEnd",optText:y.parseMessage(c[h-2]),signalType:y.LINETYPE.BREAK_END}),this.$=c[h-1];break;case 44:this.$=c[h-3].concat([{type:"option",optionText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.CRITICAL_OPTION},c[h]]);break;case 46:this.$=c[h-3].concat([{type:"and",parText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.PAR_AND},c[h]]);break;case 48:this.$=c[h-3].concat([{type:"else",altText:y.parseMessage(c[h-1]),signalType:y.LINETYPE.ALT_ELSE},c[h]]);break;case 49:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 50:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 51:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 52:case 57:c[h-1].draw="actor",c[h-1].type="addParticipant",this.$=c[h-1];break;case 53:c[h-1].type="destroyParticipant",this.$=c[h-1];break;case 54:c[h-3].draw="participant",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 55:c[h-1].draw="participant",c[h-1].type="addParticipant",this.$=c[h-1];break;case 56:c[h-3].draw="actor",c[h-3].type="addParticipant",c[h-3].description=y.parseMessage(c[h-1]),this.$=c[h-3];break;case 58:this.$=[c[h-1],{type:"addNote",placement:c[h-2],actor:c[h-1].actor,text:c[h]}];break;case 59:c[h-2]=[].concat(c[h-1],c[h-1]).slice(0,2),c[h-2][0]=c[h-2][0].actor,c[h-2][1]=c[h-2][1].actor,this.$=[c[h-1],{type:"addNote",placement:y.PLACEMENT.OVER,actor:c[h-2].slice(0,2),text:c[h]}];break;case 60:this.$=[c[h-1],{type:"addLinks",actor:c[h-1].actor,text:c[h]}];break;case 61:this.$=[c[h-1],{type:"addALink",actor:c[h-1].actor,text:c[h]}];break;case 62:this.$=[c[h-1],{type:"addProperties",actor:c[h-1].actor,text:c[h]}];break;case 63:this.$=[c[h-1],{type:"addDetails",actor:c[h-1].actor,text:c[h]}];break;case 66:this.$=[c[h-2],c[h]];break;case 67:this.$=c[h];break;case 68:this.$=y.PLACEMENT.LEFTOF;break;case 69:this.$=y.PLACEMENT.RIGHTOF;break;case 70:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0},{type:"activeStart",signalType:y.LINETYPE.ACTIVE_START,actor:c[h-1].actor}];break;case 71:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h]},{type:"activeEnd",signalType:y.LINETYPE.ACTIVE_END,actor:c[h-4].actor}];break;case 72:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor}];break;case 73:this.$=[c[h-4],c[h-1],{type:"addMessage",from:c[h-4].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h],activate:!1,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_REVERSE},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-4].actor}];break;case 74:this.$=[c[h-5],c[h-1],{type:"addMessage",from:c[h-5].actor,to:c[h-1].actor,signalType:c[h-3],msg:c[h],activate:!0,centralConnection:y.LINETYPE.CENTRAL_CONNECTION_DUAL},{type:"centralConnection",signalType:y.LINETYPE.CENTRAL_CONNECTION,actor:c[h-1].actor},{type:"centralConnectionReverse",signalType:y.LINETYPE.CENTRAL_CONNECTION_REVERSE,actor:c[h-5].actor}];break;case 75:this.$=[c[h-3],c[h-1],{type:"addMessage",from:c[h-3].actor,to:c[h-1].actor,signalType:c[h-2],msg:c[h]}];break;case 76:this.$={type:"addParticipant",actor:c[h-1],config:c[h]};break;case 77:this.$=c[h-1].trim();break;case 78:this.$={type:"addParticipant",actor:c[h]};break;case 79:this.$=y.LINETYPE.SOLID_OPEN;break;case 80:this.$=y.LINETYPE.DOTTED_OPEN;break;case 81:this.$=y.LINETYPE.SOLID;break;case 82:this.$=y.LINETYPE.SOLID_TOP;break;case 83:this.$=y.LINETYPE.SOLID_BOTTOM;break;case 84:this.$=y.LINETYPE.STICK_TOP;break;case 85:this.$=y.LINETYPE.STICK_BOTTOM;break;case 86:this.$=y.LINETYPE.SOLID_TOP_DOTTED;break;case 87:this.$=y.LINETYPE.SOLID_BOTTOM_DOTTED;break;case 88:this.$=y.LINETYPE.STICK_TOP_DOTTED;break;case 89:this.$=y.LINETYPE.STICK_BOTTOM_DOTTED;break;case 90:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE;break;case 91:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE;break;case 92:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE;break;case 93:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE;break;case 94:this.$=y.LINETYPE.SOLID_ARROW_TOP_REVERSE_DOTTED;break;case 95:this.$=y.LINETYPE.SOLID_ARROW_BOTTOM_REVERSE_DOTTED;break;case 96:this.$=y.LINETYPE.STICK_ARROW_TOP_REVERSE_DOTTED;break;case 97:this.$=y.LINETYPE.STICK_ARROW_BOTTOM_REVERSE_DOTTED;break;case 98:this.$=y.LINETYPE.BIDIRECTIONAL_SOLID;break;case 99:this.$=y.LINETYPE.DOTTED;break;case 100:this.$=y.LINETYPE.BIDIRECTIONAL_DOTTED;break;case 101:this.$=y.LINETYPE.SOLID_CROSS;break;case 102:this.$=y.LINETYPE.DOTTED_CROSS;break;case 103:this.$=y.LINETYPE.SOLID_POINT;break;case 104:this.$=y.LINETYPE.DOTTED_POINT;break;case 105:this.$=y.parseMessage(c[h].trim().substring(1));break}},"anonymous"),table:[{3:1,4:t,5:a,6:r},{1:[3]},{3:5,4:t,5:a,6:r},{3:6,4:t,5:a,6:r},e([1,4,5,10,14,15,19,22,24,30,31,32,34,36,37,38,39,40,42,44,45,47,51,53,54,56,61,62,63,64,73],i,{7:7}),{1:[2,1]},{1:[2,2]},{1:[2,3],4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,5]),{9:48,13:13,14:u,15:d,18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},e(C,[2,7]),e(C,[2,8]),e(C,[2,9]),e(C,[2,15]),{13:49,51:U,53:G,54:X},{16:[1,50]},{5:[1,51]},{5:[1,54],20:[1,52],21:[1,53]},{23:55,73:Y},{23:56,73:Y},{5:[1,57]},{5:[1,58]},{5:[1,59]},{5:[1,60]},{5:[1,61]},e(C,[2,30]),e(C,[2,31]),{33:[1,62]},{35:[1,63]},e(C,[2,34]),{16:[1,64]},{16:[1,65]},{16:[1,66]},{16:[1,67]},{16:[1,68]},{16:[1,69]},{16:[1,70]},{16:[1,71]},{23:72,55:73,73:At},{23:75,55:76,73:At},{23:77,73:Y},{69:78,72:[1,79],78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},{57:106,59:[1,107],67:[1,108],68:[1,109]},{23:110,73:Y},{23:111,73:Y},{23:112,73:Y},{23:113,73:Y},e([5,66,72,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104],be),e(C,[2,6]),e(C,[2,16]),e(St,[2,10],{11:114}),e(C,[2,18]),{5:[1,116],20:[1,115]},{5:[1,117]},e(C,[2,22]),{5:[1,118]},{5:[1,119]},e(C,[2,25]),e(C,[2,26]),e(C,[2,27]),e(C,[2,28]),e(C,[2,29]),e(C,[2,32]),e(C,[2,33]),e(Dt,i,{7:120}),e(Dt,i,{7:121}),e(Dt,i,{7:122}),e(me,i,{41:123,7:124}),e(Ut,i,{43:125,7:126}),e(Ut,i,{7:126,43:127}),e(Ae,i,{46:128,7:129}),e(Dt,i,{7:130}),{5:[1,132],52:[1,131]},{5:[1,134],52:[1,133]},e(Gt,be,{74:135,75:[1,136]}),{5:[1,138],52:[1,137]},{5:[1,140],52:[1,139]},{5:[1,141]},{23:145,70:[1,142],71:[1,143],72:[1,144],73:Y},{69:146,78:kt,79:m,80:k,81:lt,82:et,83:K,84:Ot,85:ne,86:oe,87:ce,88:le,89:he,90:de,91:Te,92:pe,93:Ee,94:ue,95:fe,96:_e,97:ge,98:xe,99:Ie,100:ye,101:Re,102:Oe,103:Le},e(F,[2,79]),e(F,[2,80]),e(F,[2,81]),e(F,[2,82]),e(F,[2,83]),e(F,[2,84]),e(F,[2,85]),e(F,[2,86]),e(F,[2,87]),e(F,[2,88]),e(F,[2,89]),e(F,[2,90]),e(F,[2,91]),e(F,[2,92]),e(F,[2,93]),e(F,[2,94]),e(F,[2,95]),e(F,[2,96]),e(F,[2,97]),e(F,[2,98]),e(F,[2,99]),e(F,[2,100]),e(F,[2,101]),e(F,[2,102]),e(F,[2,103]),e(F,[2,104]),{23:147,73:Y},{23:149,60:148,73:Y},{73:[2,68]},{73:[2,69]},{58:150,104:ot},{58:152,104:ot},{58:153,104:ot},{58:154,104:ot},{4:[1,157],5:[1,159],12:156,13:158,17:[1,155],51:U,53:G,54:X},{5:[1,160]},e(C,[2,20]),e(C,[2,21]),e(C,[2,23]),e(C,[2,24]),{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,161],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,162],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,163],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,164]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,47],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,50:[1,165],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,166]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,45],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,49:[1,167],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{17:[1,168]},{17:[1,169]},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[2,43],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,48:[1,170],51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{4:n,5:s,8:8,9:10,10:o,13:13,14:u,15:d,17:[1,171],18:16,19:p,22:_,23:41,24:E,25:20,26:21,27:22,28:23,29:24,30:O,31:T,32:g,34:f,36:I,37:L,38:b,39:w,40:A,42:D,44:M,45:V,47:W,51:U,53:G,54:X,56:nt,61:j,62:H,63:st,64:tt,73:Y},{16:[1,172]},e(C,[2,50]),{16:[1,173]},e(C,[2,55]),e(Gt,[2,76]),{76:[1,174]},{16:[1,175]},e(C,[2,52]),{16:[1,176]},e(C,[2,57]),e(C,[2,53]),{23:177,73:Y},{23:178,73:Y},{23:179,73:Y},{58:180,104:ot},{23:181,72:[1,182],73:Y},{58:183,104:ot},{58:184,104:ot},{66:[1,185],104:[2,67]},{5:[2,60]},{5:[2,105]},{5:[2,61]},{5:[2,62]},{5:[2,63]},e(C,[2,17]),e(St,[2,11]),{13:186,51:U,53:G,54:X},e(St,[2,13]),e(St,[2,14]),e(C,[2,19]),e(C,[2,35]),e(C,[2,36]),e(C,[2,37]),e(C,[2,38]),{16:[1,187]},e(C,[2,39]),{16:[1,188]},e(C,[2,40]),e(C,[2,41]),{16:[1,189]},e(C,[2,42]),{5:[1,190]},{5:[1,191]},{77:[1,192]},{5:[1,193]},{5:[1,194]},{58:195,104:ot},{58:196,104:ot},{58:197,104:ot},{5:[2,75]},{58:198,104:ot},{23:199,73:Y},{5:[2,58]},{5:[2,59]},{23:200,73:Y},e(St,[2,12]),e(me,i,{7:124,41:201}),e(Ut,i,{7:126,43:202}),e(Ae,i,{7:129,46:203}),e(C,[2,49]),e(C,[2,54]),e(Gt,[2,77]),e(C,[2,51]),e(C,[2,56]),{5:[2,70]},{5:[2,71]},{5:[2,72]},{5:[2,73]},{58:204,104:ot},{104:[2,66]},{17:[2,48]},{17:[2,46]},{17:[2,44]},{5:[2,74]}],defaultActions:{5:[2,1],6:[2,2],108:[2,68],109:[2,69],150:[2,60],151:[2,105],152:[2,61],153:[2,62],154:[2,63],180:[2,75],183:[2,58],184:[2,59],195:[2,70],196:[2,71],197:[2,72],198:[2,73],200:[2,66],201:[2,48],202:[2,46],203:[2,44],204:[2,74]},parseError:x(function(S,v){if(v.recoverable)this.trace(S);else{var P=new Error(S);throw P.hash=v,P}},"parseError"),parse:x(function(S){var v=this,P=[0],y=[],z=[null],c=[],wt=this.table,h="",Ct=0,Se=0,Ze=2,we=1,Qe=c.slice.call(arguments,1),J=Object.create(this.lexer),gt={yy:{}};for(var Jt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Jt)&&(gt.yy[Jt]=this.yy[Jt]);J.setInput(S,gt.yy),gt.yy.lexer=J,gt.yy.parser=this,typeof J.yylloc>"u"&&(J.yylloc={});var Zt=J.yylloc;c.push(Zt);var $e=J.options&&J.options.ranges;typeof gt.yy.parseError=="function"?this.parseError=gt.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function je(it){P.length=P.length-2*it,z.length=z.length-it,c.length=c.length-it}x(je,"popStack");function Ne(){var it;return it=y.pop()||J.lex()||we,typeof it!="number"&&(it instanceof Array&&(y=it,it=y.pop()),it=v.symbols_[it]||it),it}x(Ne,"lex");for(var rt,xt,ct,Qt,Lt={},Mt,Tt,Pe,Bt;;){if(xt=P[P.length-1],this.defaultActions[xt]?ct=this.defaultActions[xt]:((rt===null||typeof rt>"u")&&(rt=Ne()),ct=wt[xt]&&wt[xt][rt]),typeof ct>"u"||!ct.length||!ct[0]){var $t="";Bt=[];for(Mt in wt[xt])this.terminals_[Mt]&&Mt>Ze&&Bt.push("'"+this.terminals_[Mt]+"'");J.showPosition?$t="Parse error on line "+(Ct+1)+`: `+J.showPosition()+` Expecting `+Bt.join(", ")+", got '"+(this.terminals_[rt]||rt)+"'":$t="Parse error on line "+(Ct+1)+": Unexpected "+(rt==we?"end of input":"'"+(this.terminals_[rt]||rt)+"'"),this.parseError($t,{text:J.match,token:this.terminals_[rt]||rt,line:J.yylineno,loc:Zt,expected:Bt})}if(ct[0]instanceof Array&&ct.length>1)throw new Error("Parse Error: multiple actions possible at state: "+xt+", token: "+rt);switch(ct[0]){case 1:P.push(rt),z.push(J.yytext),c.push(J.yylloc),P.push(ct[1]),rt=null,Se=J.yyleng,h=J.yytext,Ct=J.yylineno,Zt=J.yylloc;break;case 2:if(Tt=this.productions_[ct[1]][1],Lt.$=z[z.length-Tt],Lt._$={first_line:c[c.length-(Tt||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(Tt||1)].first_column,last_column:c[c.length-1].last_column},$e&&(Lt._$.range=[c[c.length-(Tt||1)].range[0],c[c.length-1].range[1]]),Qt=this.performAction.apply(Lt,[h,Se,Ct,gt.yy,ct[1],z,c].concat(Qe)),typeof Qt<"u")return Qt;Tt&&(P=P.slice(0,-1*Tt*2),z=z.slice(0,-1*Tt),c=c.slice(0,-1*Tt)),P.push(this.productions_[ct[1]][0]),z.push(Lt.$),c.push(Lt._$),Pe=wt[P[P.length-2]][P[P.length-1]],P.push(Pe);break;case 3:return!0}}return!0},"parse")},Je=(function(){var ut={EOF:1,parseError:x(function(v,P){if(this.yy.parser)this.yy.parser.parseError(v,P);else throw new Error(v)},"parseError"),setInput:x(function(S,v){return this.yy=v||this.yy||{},this._input=S,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:x(function(){var S=this._input[0];this.yytext+=S,this.yyleng++,this.offset++,this.match+=S,this.matched+=S;var v=S.match(/(?:\r\n?|\n).*/g);return v?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),S},"input"),unput:x(function(S){var v=S.length,P=S.split(/(?:\r\n?|\n)/g);this._input=S+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-v),this.offset-=v;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),P.length-1&&(this.yylineno-=P.length-1);var z=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:P?(P.length===y.length?this.yylloc.first_column:0)+y[y.length-P.length].length-P[0].length:this.yylloc.first_column-v},this.options.ranges&&(this.yylloc.range=[z[0],z[0]+this.yyleng-v]),this.yyleng=this.yytext.length,this},"unput"),more:x(function(){return this._more=!0,this},"more"),reject:x(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:x(function(S){this.unput(this.match.slice(S))},"less"),pastInput:x(function(){var S=this.matched.substr(0,this.matched.length-this.match.length);return(S.length>20?"...":"")+S.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:x(function(){var S=this.match;return S.length<20&&(S+=this._input.substr(0,20-S.length)),(S.substr(0,20)+(S.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:x(function(){var S=this.pastInput(),v=new Array(S.length+1).join("-");return S+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js b/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CUFKXLd6.js similarity index 86% rename from apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js rename to apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CUFKXLd6.js index 93fea43c459..07aa884989e 100644 --- a/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js +++ b/apps/kimi-code/dist-web/assets/sizeCapture-X5ZJPWSS-CUFKXLd6.js @@ -1 +1 @@ -import{_ as o}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var p=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function c(){return!!i()?.mermaidCaptureSizes}o(c,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:p,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,c as shouldCaptureSizes}; +import{_ as o}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var p=1;function i(){if(!(typeof globalThis>"u"))return globalThis}o(i,"getCaptureGlobal");function c(){return!!i()?.mermaidCaptureSizes}o(c,"shouldCaptureSizes");function u(){return typeof location>"u"?"browser-dev":`${location.pathname}${location.search}`}o(u,"capturedFromLocation");function d(n,r){const t=i();if(!t)return;const e=r.node(),s=((e&&"ownerSVGElement"in e?e.ownerSVGElement:null)??e)?.id??"(unknown)";t.mermaidCapturedSizes??=[];const a={svgId:s,sizes:n};t.mermaidCapturedSizes.push(a),t.mermaidLastCapturedSizes=a}o(d,"emitCapturedSizes");function m(n,r){const t=[];for(const e of r.nodes)e.isGroup||t.push({id:e.id,width:e.width??0,height:e.height??0});t.length!==0&&d({metadata:{captureVersion:p,capturedAt:new Date().toISOString(),capturedFrom:u()},nodes:t},n)}o(m,"captureNodeSizes");export{m as captureNodeSizes,c as shouldCaptureSizes}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js b/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-CR3yEYk8.js similarity index 96% rename from apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js rename to apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-CR3yEYk8.js index e01e907e999..643be3d62b1 100644 --- a/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-GIVsAB2M.js +++ b/apps/kimi-code/dist-web/assets/stateDiagram-2N3HPSRC-CR3yEYk8.js @@ -1 +1 @@ -import{s as R,a as W,S as N}from"./chunk-EX3LRPZG-BCWDroXJ.js";import{_ as f,c as t,d as H,l as S,e as P,k as z,a7 as _,a8 as U,a3 as C,y as F}from"./mermaid.core-CJB1tAev.js";import{G as O}from"./graph-DOmOIIwC.js";import{l as J}from"./layout-D-LzfAck.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./map-DxJ2ADlA.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),Z=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),j=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
        ");p=p.replace(/\n/g,"
        ");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),K=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=j(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&Z(n,i),i.type==="note"&&K(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,Q=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=_().x(function(s){return s.x}).y(function(s){return s.y}).curve(U),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new O({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),Q(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; +import{s as R,a as W,S as N}from"./chunk-EX3LRPZG-6_hx8rcm.js";import{_ as f,c as t,d as H,l as S,e as P,k as z,a7 as _,a8 as U,a3 as C,y as F}from"./mermaid.core-CsZwh_jB.js";import{G as O}from"./graph-DOmOIIwC.js";import{l as J}from"./layout-D-LzfAck.js";import"./chunk-XXDRQBXY-B7Une-L7.js";import"./chunk-VR4S4FIN-Crv01XIW.js";import"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./map-DxJ2ADlA.js";var X=f(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),D=f(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),Y=f((e,i)=>{const d=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),c=d.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",c.width+2*t().state.padding).attr("height",c.height+2*t().state.padding).attr("rx",t().state.radius),d},"drawSimpleState"),I=f((e,i)=>{const d=f(function(o,B,y){const v=o.append("tspan").attr("x",2*t().state.padding).text(B);y||v.attr("dy",t().state.textHeight)},"addTspan"),n=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),l=n.height,p=e.append("text").attr("x",t().state.padding).attr("y",l+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let a=!0,s=!0;i.descriptions.forEach(function(o){a||(d(p,o,s),s=!1),a=!1});const m=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+l+t().state.dividerMargin/2).attr("y2",t().state.padding+l+t().state.dividerMargin/2).attr("class","descr-divider"),x=p.node().getBBox(),g=Math.max(x.width,n.width);return m.attr("x2",g+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",g+2*t().state.padding).attr("height",x.height+l+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=f((e,i,d)=>{const c=t().state.padding,n=2*t().state.padding,l=e.node().getBBox(),p=l.width,a=l.x,s=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=s.node().getBBox().width+n;let g=Math.max(x,p);g===p&&(g=g+n);let o;const B=e.node().getBBox();i.doc,o=a-c,x>p&&(o=(p-g)/2+c),Math.abs(a-B.x)p&&(o=a-(x-p)/2);const y=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",y).attr("class",d?"alt-composit":"composit").attr("width",g).attr("height",B.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),s.attr("x",o+c),x<=p&&s.attr("x",a+(g-n)/2-x/2+c),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",g).attr("height",B.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),q=f(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),Z=f((e,i)=>{let d=t().state.forkWidth,c=t().state.forkHeight;if(i.parentId){let n=d;d=c,c=n}return e.append("rect").style("stroke","black").style("fill","black").attr("width",d).attr("height",c).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),j=f((e,i,d,c)=>{let n=0;const l=c.append("text");l.style("text-anchor","start"),l.attr("class","noteText");let p=e.replace(/\r\n/g,"
        ");p=p.replace(/\n/g,"
        ");const a=p.split(z.lineBreakRegex);let s=1.25*t().state.noteMargin;for(const m of a){const x=m.trim();if(x.length>0){const g=l.append("tspan");if(g.text(x),s===0){const o=g.node().getBBox();s+=o.height}n+=s,g.attr("x",i+t().state.noteMargin),g.attr("y",d+n+1.25*t().state.noteMargin)}}return{textWidth:l.node().getBBox().width,textHeight:n}},"_drawLongText"),K=f((e,i)=>{i.attr("class","state-note");const d=i.append("rect").attr("x",0).attr("y",t().state.padding),c=i.append("g"),{textWidth:n,textHeight:l}=j(e,0,0,c);return d.attr("height",l+2*t().state.noteMargin),d.attr("width",n+t().state.noteMargin*2),d},"drawNote"),L=f(function(e,i){const d=i.id,c={id:d,label:i.id,width:0,height:0},n=e.append("g").attr("id",d).attr("class","stateGroup");i.type==="start"&&X(n),i.type==="end"&&q(n),(i.type==="fork"||i.type==="join")&&Z(n,i),i.type==="note"&&K(i.note.text,n),i.type==="divider"&&D(n),i.type==="default"&&i.descriptions.length===0&&Y(n,i),i.type==="default"&&i.descriptions.length>0&&I(n,i);const l=n.node().getBBox();return c.width=l.width+2*t().state.padding,c.height=l.height+2*t().state.padding,c},"drawState"),G=0,Q=f(function(e,i,d){const c=f(function(s){switch(s){case N.relationType.AGGREGATION:return"aggregation";case N.relationType.EXTENSION:return"extension";case N.relationType.COMPOSITION:return"composition";case N.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(s=>!Number.isNaN(s.y));const n=i.points,l=_().x(function(s){return s.x}).y(function(s){return s.y}).curve(U),p=e.append("path").attr("d",l(n)).attr("id","edge"+G).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=C(!0)),p.attr("marker-end","url("+a+"#"+c(N.relationType.DEPENDENCY)+"End)"),d.title!==void 0){const s=e.append("g").attr("class","stateLabel"),{x:m,y:x}=F.calcLabelPosition(i.points),g=z.getRows(d.title);let o=0;const B=[];let y=0,v=0;for(let u=0;u<=g.length;u++){const h=s.append("text").attr("text-anchor","middle").text(g[u]).attr("x",m).attr("y",x+o),w=h.node().getBBox();y=Math.max(y,w.width),v=Math.min(v,w.x),S.info(w.x,m,x+o),o===0&&(o=h.node().getBBox().height,S.info("Title height",o,x)),B.push(h)}let k=o*g.length;if(g.length>1){const u=(g.length-1)*o*.5;B.forEach((h,w)=>h.attr("y",x+w*o-u)),k=o*g.length}const r=s.node().getBBox();s.insert("rect",":first-child").attr("class","box").attr("x",m-y/2-t().state.padding/2).attr("y",x-k/2-t().state.padding/2-3.5).attr("width",y+t().state.padding).attr("height",k+t().state.padding),S.info(r)}G++},"drawEdge"),b,T={},V=f(function(){},"setConf"),tt=f(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),et=f(function(e,i,d,c){b=t().state;const n=t().securityLevel;let l;n==="sandbox"&&(l=H("#i"+i));const p=n==="sandbox"?H(l.nodes()[0].contentDocument.body):H("body"),a=n==="sandbox"?l.nodes()[0].contentDocument:document;S.debug("Rendering diagram "+e);const s=p.select(`[id='${i}']`);tt(s);const m=c.db.getRootDoc(),x=s.append("g").attr("id",i+"-root");A(m,x,void 0,!1,p,a,c);const g=b.padding,o=s.node().getBBox(),B=o.width+g*2,y=o.height+g*2,v=B*1.75;P(s,y,v,b.useMaxWidth),s.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+B+" "+y)},"draw"),at=f(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),A=f((e,i,d,c,n,l,p)=>{const a=new O({compound:!0,multigraph:!0});let s,m=!0;for(s=0;s{const w=h.parentElement;let E=0,M=0;w&&(w.parentElement&&(E=w.parentElement.getBBox().width),M=parseInt(w.getAttribute("data-x-shift"),10),Number.isNaN(M)&&(M=0)),h.setAttribute("x1",0-M+8),h.setAttribute("x2",E-M-8)})):S.debug("No Node "+r+": "+JSON.stringify(a.node(r)))});let v=y.getBBox();a.edges().forEach(function(r){r!==void 0&&a.edge(r)!==void 0&&(S.debug("Edge "+r.v+" -> "+r.w+": "+JSON.stringify(a.edge(r))),Q(i,a.edge(r),a.edge(r).relation))}),v=y.getBBox();const k={id:d||"root",label:d||"root",width:0,height:0};return k.width=v.width+2*b.padding,k.height=v.height+2*b.padding,S.debug("Doc rendered",k,a),k},"renderDoc"),it={setConf:V,draw:et},xt={parser:W,get db(){return new N(1)},renderer:it,styles:R,init:f(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{xt as diagram}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB--VVJVX-W.js b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB--VVJVX-W.js new file mode 100644 index 00000000000..e459c8ec17e --- /dev/null +++ b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB--VVJVX-W.js @@ -0,0 +1 @@ +import{s as r,b as e,a,S as s}from"./chunk-EX3LRPZG-6_hx8rcm.js";import{_ as i}from"./mermaid.core-CsZwh_jB.js";import"./chunk-XXDRQBXY-B7Une-L7.js";import"./chunk-VR4S4FIN-Crv01XIW.js";import"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js b/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js deleted file mode 100644 index cc6c7d04222..00000000000 --- a/apps/kimi-code/dist-web/assets/stateDiagram-v2-6OUMAXLB-0KuGlzV7.js +++ /dev/null @@ -1 +0,0 @@ -import{s as r,b as e,a,S as s}from"./chunk-EX3LRPZG-BCWDroXJ.js";import{_ as i}from"./mermaid.core-CJB1tAev.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var n={parser:a,get db(){return new s(2)},renderer:e,styles:r,init:i(t=>{t.state||(t.state={}),t.state.arrowMarkerAbsolute=t.arrowMarkerAbsolute},"init")};export{n as diagram}; diff --git a/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js b/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-C7_SkVdK.js similarity index 99% rename from apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js rename to apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-C7_SkVdK.js index f67834e7fd0..09af52949f8 100644 --- a/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-D6xMtJ1E.js +++ b/apps/kimi-code/dist-web/assets/swimlanes-5IMT3BWC-C7_SkVdK.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-D5GqjpM0.js","assets/mermaid.core-CJB1tAev.js","assets/index-D-7nOosq.js","assets/index-DGHD7Bg9.css","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); -import{bR as Er}from"./index-D-7nOosq.js";import{c as Tr}from"./chunk-RYQCIY6F-Df2V79id.js";import{am as wr,an as Ar,ao as Rr,ap as Nr,l as Ke,c as Or,ag as Pr,af as Br,ah as kr,at as _r,av as Fr,z as Dr,as as Hr,aw as Xr,y as Oe,ax as Ye,_ as d,ay as Ao}from"./mermaid.core-CJB1tAev.js";import{G as Yr}from"./graph-DOmOIIwC.js";import"./map-DxJ2ADlA.js";import"./_commonjsHelpers-CqkleIqs.js";async function _o(t,e){const n=new Yr({multigraph:!0,compound:!0}),o=[...e.edges],s=Or(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),c=r.insert("g").attr("class","edges edgePath"),a=r.insert("g").attr("class","edgeLabels"),l=r.insert("g").attr("class","nodes"),g=new Map,x=t.node()!=null;await Promise.all(e.nodes.map(async I=>{if(I.isGroup)n.setNode(I.id,{...I});else{if(x){const u=await Pr(l,I,{config:s,dir:I.dir}),p=u.node()?.getBBox()??{width:0,height:0};g.set(I.id,u),I.width=p.width,I.height=p.height}n.setNode(I.id,{...I})}}));for(const I of o)n.setEdge(I.start,I.end,{...I},I.id),e.edges.some(p=>p.id===I.id)||e.edges.push(I);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:I}=await Er(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-D5GqjpM0.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3,4]));I(t,e)}return{graph:n,groups:{clusters:i,edgePaths:c,edgeLabels:a,nodes:l,rootGroups:r},nodeElements:g}}d(_o,"createGraphWithElements");var Ro=5,Ge=1e-5,$e=1e-6;function qe(t){const e=[];for(let n=0;n=1-$e||I<=$e||I>=1-$e?null:{point:{x:t.x+x*s,y:t.y+x*r},tA:x,tB:I}}d(Fo,"segmentIntersection");function vn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(vn,"isHorizontalSeg");function Do(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Ho,"getArcSweepFlag");var Gr=.001;function Xo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Ao[e.arrowTypeStart];if(o){const r=t[0],i=t[1],c=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(c),n[0].y=r.y+o*Math.sin(c)}const s=e.arrowTypeEnd&&Ao[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],c=t[r-1],a=Math.atan2(c.y-i.y,c.x-i.x);n[r-1].x=c.x-s*Math.cos(a),n[r-1].y=c.y-s*Math.sin(a)}return n}d(Xo,"applyMarkerOffsets");function Yo(t,e,n,o,s){const r=t.point.x,i=t.point.y,c={x:r-e*t.r,y:i-n*t.r},a={x:r+e*t.r,y:i+n*t.r},l=[`L${we(c)}`];return s==="arc"?l.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${we(a)}`):l.push(`M${we(a)}`),l}d(Yo,"emitJump");function Ln(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,c=n.y-e.y,a=Math.hypot(s,r),l=Math.hypot(i,c);if(a0){const E=Ln(s[l-1],s[l],s[l+1]??s[l],Ro);E&&(f=E.cutLen)}let y=x,v=null;r&&lE.t-T.t);for(const E of M)E.r=Math.min(E.r,E.d-f,y-E.d);for(let E=0;ET){const m=T/2;M[E].r=Math.min(M[E].r,m),M[E+1].r=Math.min(M[E+1].r,m)}}for(const E of M)E.r=2?o:null}catch{return null}}d(Vo,"decodeDataPoints");function jo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const l of e)s.set(l.id,l);const r=[],i=new Map;for(const l of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(l.id):l.id,x=o.querySelector(`path[data-id="${g}"]`);if(!x)continue;i.set(l.id,x);const u=Vo(x.getAttribute("data-points"))??l.points;r.push({...l,points:u})}const c=Do(r);if(c.length===0)return;const a=new Map;for(const l of c){const g=a.get(l.jumpEdgeId)??[];g.push(l),a.set(l.jumpEdgeId,g)}for(const l of r){const g=a.get(l.id);if(!g||g.length===0)continue;const I=s.get(l.id)?.curve;if(I!==void 0&&!zo(I))continue;const u=i.get(l.id);if(!u)continue;if(I===void 0){const E=u.getAttribute("d")??"";if(!$o(E))continue}const p=u.getAttribute("style")??"",f=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),y=f?Number.parseFloat(f[1]):null,v=f?Number.parseFloat(f[2]):null,M=Go(l,g,n);if(u.setAttribute("d",M),y!==null&&v!==null&&typeof u.getTotalLength=="function"){const E=u.getTotalLength(),T=Math.max(0,E-y-v),m=`0 ${y} ${T} ${v}`,S=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${m};`).replace(/;\s*;+/g,";");u.setAttribute("style",S)}}}d(jo,"applyLineJumpsToSvg");async function Uo(t,e){for(const s of t.nodes)s.isGroup?await Br(e.clusters,s):kr(s);const n=new Map;for(const s of t.nodes)s?.id&&n.set(s.id,s);for(const s of t.edges){const r=s.start?n.get(s.start)??{}:{},i=s.end?n.get(s.end)??{}:{},c=_r(e.edgePaths,{...s},{},t.type,r,i,t.diagramId);s.label&&await Fr(e.rootGroups,s),s.label&&Wo(s,c)}const o=t.config?.swimlane?.lineHops;if(o!==!1){const s=o==="gap"?"gap":"arc",r=t.edges.filter(i=>Array.isArray(i.points)&&i.points.length>=2).map(i=>({id:i.id,points:i.points,curve:i.curve,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));jo(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}}d(Uo,"adjustLayout");function Wo(t,e){const n=e?.updatedPath??e?.originalPath,o=Dr(),{subGraphTitleTotalMargin:s}=Hr({flowchart:o.flowchart??{}});if(t.label){const r=Xr.get(t.id);let i=t.x,c=t.y;if(n){const a=Oe.calcLabelPosition(n);Ke.debug("Moving label "+t.label+" from (",i,",",c,") to (",a.x,",",a.y,") abc88"),e&&(i=a.x,c=a.y)}r.attr("transform",`translate(${i}, ${c+s/2})`)}if(t?.startLabelLeft){const r=Ye.get(t.id).startLeft;let i=t?.x,c=t?.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.startLabelRight){const r=Ye.get(t.id).startRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelLeft){const r=Ye.get(t.id).endLeft;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelRight){const r=Ye.get(t.id).endRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}}d(Wo,"positionEdgeLabel");var Mn="__swimlane_default__",$r=21,No=20;function En(t){return Math.max(t.padding??No,No)}d(En,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,c=Math.min(r,n+s/2),a=Math.min($r,Math.max(0,c-i)),l=i+a;if(l<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:l}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===Mn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:Mn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=Mn}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const a of t.nodes??[])e.set(a.id,a);const n=[];for(const a of t.edges??[]){const l=typeof a.start=="string"?a.start:void 0,g=typeof a.end=="string"?a.end:void 0;!l||!g||a.labelNodeId||n.push({id:a.id,src:l,dst:g,ref:a})}const o=t.nodes??[],s=o.filter(a=>a.isGroup),r=o.filter(a=>!a.isGroup);return{nodes:[...[...s].reverse(),...r].map(a=>a.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,c=o?.nodeGap??40;let a=0;for(const I of e.layers){let u=0;for(const p of I){const f=r.get(p);if(!f){u++;continue}f.layer=a,f.order=u;const y=n.x[p]??u*c,v=n.y[p]??a*i;f.x=y,f.y=v,u++}a++}const l=s.nodes??[],g=new Map,x=[];for(const I of l){if(!I?.isGroup)continue;I.parentId||x.push(I);const u=l.filter(M=>M.parentId===I.id);let p=1/0,f=-1/0,y=1/0,v=-1/0;for(const M of u){const E=M.x??n.x[M.id],T=M.y??n.y[M.id],m=M.width??0,S=M.height??0;E!=null&&T!=null&&(p=Math.min(p,E-m/2),f=Math.max(f,E+m/2),y=Math.min(y,T-S/2),v=Math.max(v,T+S/2))}if(p===1/0||y===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const M=I.padding??20,E=I.parentId?M:2*En(I),T=M,m=Math.max(0,f-p)+E,S=Math.max(0,v-y)+T,A=(p+f)/2,R=(y+v)/2;I.x=A,I.y=R,I.width=m,I.height=S,g.set(I.id,{minX:p,maxX:f,minY:y,maxY:v})}}if(x.length>0&&g.size>0){let I=1/0,u=-1/0,p=0;for(const f of x){const y=f.padding??20;y>p&&(p=y);const v=g.get(f.id);v&&(I=Math.min(I,v.minY),u=Math.max(u,v.maxY))}if(I!==1/0&&u!==-1/0){const f=Math.max(0,u-I),v=Math.max(p,36),M=f+2*v,E=(I+u)/2;for(const k of x)k.y=E,k.height=M,k.swimlaneContentTop=I;const T=[...x].sort((k,O)=>{const _=k.x??0,H=O.x??0;return _-H}),m=[],S=[],A=[];for(const k of T){const O=g.get(k.id);if(!O)continue;const _=Math.max(0,O.maxX-O.minX)+2*En(k),H=(O.minX+O.maxX)/2;m.push(k.id),S.push(H),A.push(_)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],A[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Ae(e,n,o,s)}:void 0}d(oo,"measuredNodeRect");function so(t){if(t.isGroup)return;const e=oo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(so,"nodeBoundsInfoFor");function oe(t,e,n=Ft){return Math.abs(t.x-e.x)n}d(Tt,"isHorizontalSegment");function wt(t,e,n=Ft){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}d(wt,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(zt,"overlapLength");function ce(t,e,n=Ft){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(ce,"sameAxisSegmentOverlapLength");function Re(t,e=Ft){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(pt,"dedupeConsecutivePoints");function ro(t,e=Ft){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Tt(n,o,e)&&wt(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:wt(n,o,e)&&Tt(o,s,e)&&wt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(ro,"classifyThreeSegmentRoute");function cn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),c=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&ie.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Je(t,e){return t.lefte.left&&t.tope.top}d(Je,"rectsOverlap");function Tn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Tn,"inflateRect");function Ae(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Ae,"rectFromCenterSize");function qt(t){return oo(t)?.rect}d(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Ie,"portForRectSide");function co(t,e,n,o,s,r=Ft){const i=e==="left"||e==="right",c=o==="left"||o==="right";if(i&&c){if(e==="right"&&o==="left"&&t.xn.x){if(ht(t,n,r))return[t,n];const x=(t.x+n.x)/2;return[t,{x,y:t.y},{x,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const x=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x,y:t.y},{x,y:n.y},n]}return}if(!i&&!c){if(e===o){if(ft(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(ft(t,n,r))return[t,n];const x=(t.y+n.y)/2;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(i&&!c){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&x?[t,{x:n.x,y:t.y},n]:void 0}const a=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return a&&l?[t,{x:t.x,y:n.y},n]:void 0}d(co,"buildOrthogonalPortPath");function ao(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ao,"buildSameSideTrackPath");function an(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=so(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(an,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=so(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,c=o.height??0;n.push({nodeId:o.id,...Ae(s,r,i,c)})}return n}d(es,"collectLayoutNodeRects");function lo(t,e,n=Ft){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)p||Iv)return!1;const M=Math.abs(f-g.a.x)s:r&&c&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Ze(t,e,n,o,{epsilon:s=Ft,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const c=i.points;if(!(!c||c.length<2))for(let a=0;aI+s&&pf+s&&xo+Ft&&t=2?e[e.length-2]:void 0,a=(i?ft(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(a)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}d(Qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ae,"simplifyPolyline");var nt=.001,Vr=.5,Oo=4;function uo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=rs(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(An,"clipEndpoint");function is(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=An(s,o.srcRect,!0)),o.dstRect&&(s=An(s,o.dstRect,!1)),s=ae(Qe(s)),s=ho(s,o.srcRect,o.dstRect),o.edge.points=ae(Qe(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function Rn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.yn.bottom+nt)return e;if(o){if(t.xn.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.xn.right+nt)return e;if(o){if(t.yn.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Rn,"snapEndpointToBoundary");function tn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function On(t,e){return e==="left"||e==="right"?en(t.top,t.bottom):en(t.left,t.right)}d(On,"clearanceRangeForSide");function nn(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function Pn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,c=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(c-i)({...c}));for(let c=e;c>=0&&c=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)o.bottom+nt;case"left":return ht(e,n,nt)&&n.xo.right+nt}}d(_n,"leavesOutward");function Fn(t,e,n){if(t.length<3)return t;if(n){const r=kn(t[0],t[1],e);return r&&_n(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=kn(t[o-1],t[o],e);return s&&_n(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Fn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=tn(o,0,1);if(r){const i=Rn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Fn(o,e,!0)}if(n){const r=o.length-1,i=tn(o,r,-1);if(i){const c=Rn(i,o[r],n,!0);c!==o[r]&&(o=[...o.slice(0,r),c])}o=Fn(o,n,!1)}const s=ho(o,e,n);return s!==o||o.length===2?s:(e&&(o=Bn(o,e,!0)),n&&(o=Bn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Dn(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;const s=pt(o.points,nt),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Dn,"prepareEdgeEndpointsForRenderer");function go(t){return new Map(t.map(e=>[e.id,e]))}d(go,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Hn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}d(Hn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,c=r.y;if(typeof i!="number"||typeof c!="number")continue;const a=r.width??0,l=r.height??0;e=Math.min(e,i-a/2),n=Math.max(n,i+a/2),o=Math.min(o,c-l/2),s=Math.max(s,c+l/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=go(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Hn(s,e)-Hn(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function on(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);let r=1/0,i=-1/0;for(const a of s){const l=a[e];typeof l=="number"&&(r=Math.min(r,l),i=Math.max(i,l))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const c=d(a=>r+i-a,"mirror");for(const a of n){const l=a[e];typeof l=="number"&&(a[e]=c(l));const g=a.groupTitleRect;g&&(a.groupTitleRect=e==="x"?{...g,left:c(g.right),right:c(g.left)}:{...g,top:c(g.bottom),bottom:c(g.top)})}for(const a of o)for(const l of a.points??[])l[e]=c(l[e]);return!0}d(on,"mirrorAxis");function ps(t){return(t.nodes??[]).some(n=>!n.isGroup)?on(t,"y"):!0}d(ps,"applyBtDirectionTransform");function ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/x):1;for(const P of s){const G=P.x??0,J=((P.y??0)-i)*I+c,dt=G-r;P.x=J,P.y=dt}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,dt=(G.y-i)*I+c,mt=j-r;G.x=dt,G.y=mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&on(t,"x"),!0;const p=go(n),f=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,p);if(!G)continue;const j=f.get(G)??[];j.push(P),f.set(G,j)}let y=0;for(const P of u){const G=P.padding??0;G>y&&(y=G)}const v=[];let M=1/0,E=-1/0;for(const P of u){const G=f.get(P.id)??[],j=po(G);j&&(M=Math.min(M,j.minX),E=Math.max(E,j.maxX),v.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(M===1/0||E===-1/0)return!0;const T=Math.max(0,E-M),m=Math.max(y,10),S=T+2*m,A=c+S,O=(M+E)/2-S/2-c,_=O+A/2,H=Math.max(y,c);v.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?v.bottom:v.top,H=I.cx+M;if(H<=v.left+se||H>=v.right-se)continue;E={x:H,y:_},T={x:H,y:c.y},m={x:c.x,y:c.y}}else{const _=u.cx>I.cx?v.right:v.left,H=I.cy+M;if(H<=v.top+se||H>=v.bottom-se)continue;E={x:_,y:H},T={x:c.x,y:H},m={x:c.x,y:c.y}}const S=oe(E,T,se),A=oe(T,m,se);if(S&&A||!S&&At(E,T,o,[g],1)||!A&&At(T,m,o,[x],1))continue;const R=!S&&Ze(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!A&&Ze(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){S?y=[T,m]:A?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}d(ys,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const c of t){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<4)continue;const l=pt(a,.001);if(l.length<4)continue;const g=l.length-1,x=l[g],I=l[g-1],u=l[g-2],p=x.x-I.x,f=x.y-I.y,y=Math.hypot(p,f);if(y>=10||y<.001)continue;const v=I.x-u.x,M=I.y-u.y;if(Math.hypot(v,M)<.001)continue;const T=Tt(I,x,.001),m=wt(I,x,.001),S=Tt(u,I,.001),A=wt(u,I,.001);if(!(T&&A||m&&S))continue;const R=c.end,k=c.start,O=R?e.get(R):void 0;if(!O)continue;const _=O.x??0,H=O.y??0,P=qt(O);if(!P)continue;let G,j;if(A){const W=M<0;G={x:_,y:u.y},j={x:_,y:W?P.bottom:P.top}}else{const W=v>0;G={x:u.x,y:H},j={x:W?P.right:P.left,y:H}}if(At(G,j,r,R?[R]:[],-2)||At(G,j,i,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&io(G,et,2))continue}const J=d((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W{for(const at of t){if(at===c||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt=0){const W=l[g-3],et=[k,R].filter(at=>!!at);if(At(W,G,r,et,-2)||mt(W,G))continue}const Pt=[...l.slice(0,g-2),G,j];c.points=Pt;const Q=c.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt=et+2||de&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}d(xs,"collapseShortTerminalStub");var Z=.001,_t=8,it=Re,In=d((t,e)=>ft(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function bs(t,e){const s=d((u,p)=>{const f=u.x??0,y=u.y??0,v=p.x-f,M=p.y-y;let E=(u.width??0)/2,T=(u.height??0)/2;return Math.abs(M)*E>Math.abs(v)*T?(M<0&&(T=-T),{x:f+(M===0?0:T*v/M),y:y+T}):(v<0&&(E=-E),{x:f+E,y:y+(v===0?0:E*M/v)})},"rectIntersect"),r=d((u,p)=>{const f=pt(u.points??[]);if(f.length<2)return;const y=p?u.start:u.end,v=y?e.get(y):void 0,M=v?qt(v):void 0;if(!v||!y||!M)return;const E=p?f[0]:f[f.length-1],T=p?f[1]:f[f.length-2],m=s(v,E);let S=E;if(In(T,m)&&(S=T),ft(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"V",coord:m.x,min:Math.min(m.y,S.y),max:Math.max(m.y,S.y),boundary:m,railEnd:S,rect:M};if(ht(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"H",coord:m.y,min:Math.min(m.x,S.x),max:Math.max(m.x,S.x),boundary:m,railEnd:S,rect:M}},"terminalLaneFor"),i=d((u,p)=>Math.max(0,Math.min(u.max,p.max)-Math.max(u.min,p.min)),"projectedOverlapLength"),c=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&ft(u.boundary,p.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ht(u.boundary,p.boundary,1),"sameTerminalFace"),a=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:i(u,p)>=_t&&Math.abs(u.coord-p.coord)<.5,"exactTerminalLaneConflict"),l=d((u,p)=>{if(u.nodeId!==p.nodeId||u.orientation!==p.orientation||u.orientation!=="H"||u.atStart===p.atStart)return!1;const f=i(u,p);if(f<_t)return!1;const y=u.rect.bottom-u.rect.top;return f2*y?!1:c(u,p)&&Math.abs(u.coord-p.coord)<16},"nearTerminalLaneConflict"),g=d((u,p)=>{const f=pt(u.edge.points??[]);if(f.length<2)return;const y=u.orientation==="V"?{x:u.boundary.x+p,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+p},v=u.orientation==="V"?{x:u.railEnd.x+p,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+p};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ht(y,u.boundary,Z)&&y.x>=u.rect.left+1&&y.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?ft(y,u.boundary,Z)&&y.y>=u.rect.top+1&&y.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const S=f.length>1&&oe(f[1],u.railEnd,Z),A=f.slice(S?2:1),R=A[0];return R&&!In(R,v)?void 0:[y,v,...A]}const E=f.length>1&&oe(f[f.length-2],u.railEnd,Z),T=f.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!In(m,v)))return[...T,v,y]},"shiftedCandidate"),x=d(u=>{const p=u.edge,f=pt(p.points??[]);if(f.length!==2)return!1;const y=p.start,v=p.end,M=y?e.get(y):void 0,E=v?e.get(v):void 0;if(!M||!E)return!1;const T=M.x??0,m=M.y??0,S=E.x??0,A=E.y??0,[R,k]=f;return ht(R,k,Z)&&Math.abs(m-A)<1&&Math.abs(T-S)>1||ft(R,k,Z)&&Math.abs(T-S)<1&&Math.abs(m-A)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const p=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let f=!1;for(let y=0;y{const R=x(S),k=x(A);return R!==k?Number(R)-Number(k):+!A.atStart-+!S.atStart});for(const S of m){for(const A of I){const R=g(S,A);if(!R)continue;const k=r({...S.edge,points:R},S.atStart);if(!(!k||p.some(O=>O.edge!==S.edge&&(a(k,O)||T&&l(k,O))))){S.edge.points=R,f=!0;break}}if(f)break}}if(!f)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=d((c,a)=>{const l=c.start,g=c.end,x=it(a);if(x.length!==a.length-1)return!1;const I=[l,g].filter(u=>!!u);for(const u of x)if(At(u.a,u.b,o,I,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===c||u.isLayoutOnly)continue;const p=u.points;if(!(!p||p.length<2)){for(const f of x)for(const y of it(pt(p)))if(ce(f,y,.5)>=_t||le(f.a,f.b,y.a,y.b,Z))return!1}}return!0},"candidateIsSafe"),i=d((c,a)=>{if(a+4>=c.length)return;const l=c[a],g=c[a+1],x=c[a+2],I=c[a+3],u=c[a+4],p=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&ft(l,I,Z)&&ft(l,u,Z)&&ft(g,x,Z)&&(g.x-l.x)*(I.x-x.x)<0,f=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&ht(l,I,Z)&&ht(l,u,Z)&&ht(g,x,Z)&&(g.y-l.y)*(I.y-x.y)<0;if(p||f)return pt([...c.slice(0,a+1),u,...c.slice(a+5)]);if(a+5>=c.length)return;const y=c[a+5],v=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&wt(u,y)&&ft(l,u,Z)&&ft(l,y,Z)&&ft(x,I,Z)&&(x.x-g.x)*(u.x-I.x)<0,M=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&Tt(u,y)&&ht(l,u,Z)&&ht(l,y,Z)&&ht(x,I,Z)&&(x.y-g.y)*(u.y-I.y)<0;if(!(!v&&!M))return pt([...c.slice(0,a+1),y,...c.slice(a+6)])},"withoutDogleg");for(let c=0;c<8;c++){let a=!1;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(let x=0;x<=g.length-5;x++){const I=i(g,x);if(!(!I||!r(l,I))){l.points=I,a=!0;break}}if(a)break}if(!a)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Xn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(p=>!p.isLayoutOnly),a=d((p,f,y)=>pt(p===f?y??[]:p.points??[]),"pointsFor"),l=d((p,f)=>{let y=0;for(let v=0;v{const f=it(p);if(f.length!==3)return;const y=f[1];if(!(f[0].horizontal===y.horizontal||f[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),x=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);return r.filter(v=>{if(y.includes(v.id))return!1;const M=v.rect;return f.horizontal?zt(f.a.x,f.b.x,M.left,M.right)>=_t&&f.a.y>=M.top-2&&f.a.y<=M.bottom+2:zt(f.a.y,f.b.y,M.top,M.bottom)>=_t&&f.a.x>=M.left-2&&f.a.x<=M.right+2})},"blockingRectsFor"),I=d((p,f,y)=>{const v=p.map(E=>({...E}));if(f.horizontal)v[f.index].y=y,v[f.index+1].y=y;else if(f.vertical)v[f.index].x=y,v[f.index+1].x=y;else return;const M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),u=d((p,f,y)=>{const v=[p.start,p.end].filter(E=>!!E),M=it(f);if(M.length!==f.length-1)return!1;for(const E of M)if(At(E.a,E.b,r,v,-2)||At(E.a,E.b,i,[],-2))return!1;for(const E of c)if(E!==p){for(const T of M)for(const m of it(a(E)))if(ce(T,m,.5)>=_t)return!1}return l(p,f)<=y},"candidateIsSafe");for(let p=0;p<8;p++){const f=l();let y=!1;for(const v of c){const M=a(v),E=g(M);if(!E)continue;const T=x(v,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(S=>S.rect.top))-20,Math.max(...T.map(S=>S.rect.bottom))+20]:[Math.min(...T.map(S=>S.rect.left))-20,Math.max(...T.map(S=>S.rect.right))+20];for(const S of m){const A=I(M,E.segment,S);if(!(!A||!u(v,A,f))){v.points=A,y=!0;break}}if(y)break}if(!y)return}}d(Xn,"liftObstacleHuggingSameSideRails");function Yn(t,e){const o=d(a=>{const l=a.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),s=d(a=>{if(!a.isGroup||a.parentId)return;const l=a.direction,g=typeof l=="string"?l.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const x=o(a),I=a.y,u=a.height;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(f<=0||p{if(!a.horizontal)return!1;const g=a.a.y;return g<=l.top+Z||g>=l.bottom-Z?!1:zt(a.a.x,a.b.x,l.left,l.right)>=_t},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(a=>!!a);if(i.length===0)return;let c=0;for(const a of t){if(a.isLayoutOnly)continue;const l=pt(a.points??[]);for(const g of it(l))for(const x of i)r(g,x.rect)&&(c=Math.max(c,x.rect.bottom-g.a.y+4))}if(!(c<=Z))for(const a of i){const l=a.node.y,g=a.node.height;typeof l!="number"||typeof g!="number"||!Number.isFinite(l)||!Number.isFinite(g)||g<=0||(a.node.y=l-c/2,a.node.height=g+c,a.node.groupTitleRect={...a.rect,top:a.rect.top-c,bottom:a.rect.bottom-c})}}d(Yn,"liftTopLaneTitleBandsAboveRails");function Gn(t,e){const o=d(l=>{const g=l.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId||l.direction!=="LR")return;const x=o(l),I=l.x,u=l.width;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(p<=0||f{if(!l.vertical)return!1;const x=l.a.x;return x<=g.left+Z||x>=g.right-Z?!1:zt(l.a.y,l.b.y,g.top,g.bottom)>=_t},"verticalSegmentIntersectsTitle"),i=d((l,g)=>{if(!l.horizontal)return!1;const x=l.a.y;return x<=g.top+Z||x>=g.bottom-Z?!1:zt(l.a.x,l.b.x,g.left,g.right)>=_t},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(l=>!!l);if(c.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(const x of it(g))for(const I of c)if(r(x,I.rect))a=Math.max(a,I.rect.right-x.a.x+4);else if(i(x,I.rect)){const u=Math.min(x.a.x,x.b.x);a=Math.max(a,I.rect.right-u+4)}}if(!(a<=Z))for(const l of c){const g=l.node.x,x=l.node.width;typeof g!="number"||typeof x!="number"||!Number.isFinite(g)||!Number.isFinite(x)||x<=0||(l.node.x=g-a/2,l.node.width=x+a,l.node.groupTitleRect={...l.rect,left:l.rect.left-a,right:l.rect.right-a})}}d(Gn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(p=>!p.isLayoutOnly),r=d((p,f=new Map)=>pt(f.get(p)??p.points??[]),"replacementPointsFor"),i=d((p=new Map)=>{let f=0;for(let y=0;ys.reduce((f,y)=>f+Qt(r(y,p)),0),"totalBends"),a=d(p=>{const f=r(p);if(f.length<4)return;const y=f[f.length-2],v=f[f.length-1];if(!(!Tt(y,v,Z)&&!wt(y,v,Z)))return{tailStart:y,terminal:v}},"terminalTailFor"),l=d((p,f)=>{const y=r(p);if(y.length<3)return;const v=y[0],M=y[1];let E;if(Tt(v,M,Z))E={x:M.x,y:f.tailStart.y};else if(wt(v,M,Z))E={x:f.tailStart.x,y:M.y};else return;const T=ae(pt([v,M,E,f.tailStart,f.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),g=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);for(const v of it(f))if(At(v.a,v.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),x=d((p,f,y)=>{for(const v of s)if(v!==p){for(const M of it(f))for(const E of it(r(v,y)))if(ce(M,E,.5)>=_t)return!0}return!1},"pathHasSharedTrack"),I=d((p,f,y)=>!g(p,f)&&!x(p,f,y),"candidateIsSafe"),u=d(()=>{const p=new Map;for(const f of s){const y=f.end;if(!y||!e.has(y)||r(f).length<4)continue;const M=p.get(y)??[];M.push(f),p.set(y,M)}return p},"edgesByDestination");for(let p=0;p<4;p++){const f=i();if(f===0)return;const y=c();let v,M=f,E=y;for(const T of u().values())for(let m=0;m=f||G>M||G===M&&j>=E||(v=P,M=G,E=j)}if(!v)return;for(const[T,m]of v)T.points=m}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(T=>!T.isLayoutOnly),a=d((T,m=new Map)=>pt(m.get(T)??T.points??[]),"replacementPointsFor"),l=d((T=new Map)=>{let m=0;for(let S=0;Sc.reduce((m,S)=>m+Qt(a(S,T)),0),"totalBends"),x=d(T=>{const m=T.start,S=T.end,A=m?e.get(m):void 0,R=S?e.get(S):void 0,k=A?qt(A):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),I=d((T,m,S)=>{if(S.index<=0||S.index+1>=m.length-1)return;const A=x(T);if(A){if(S.vertical){const R=S.a.x,k=Math.min(A.src.left,A.dst.left),O=Math.max(A.src.right,A.dst.right),_=RO+Z?"right":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"vertical",side:_,coord:R,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){const R=S.a.y,k=Math.min(A.src.top,A.dst.top),O=Math.max(A.src.bottom,A.dst.bottom),_=RO+Z?"bottom":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"horizontal",side:_,coord:R,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const T=[];for(const m of c){const S=a(m);for(const A of it(S)){const R=I(m,S,A);R&&T.push(R)}}return T},"collectExternalRails"),p=d((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&zt(T.min,T.max,m.min,m.max)>=_t,"railsInteract"),f=d(T=>{const m=[],S=new Set;for(const A of T){if(S.has(A))continue;const R=[A],k=[];for(S.add(A);R.length>0;){const O=R.pop();k.push(O);for(const _ of T)!S.has(_)&&p(O,_)&&(S.add(_),R.push(_))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=d(T=>{const m=[];for(const S of T)m.some(A=>Math.abs(A-S.coord){const m=T.map(R=>R.coord),S=y(T),A=[];if(T.length<=6){const R=new Array(S.length).fill(!1),k=[],O=d(()=>{if(k.length===T.length){k.some((_,H)=>Math.abs(_-m[H])>=Z)&&A.push([...k]);return}for(const[_,H]of S.entries())R[_]||(R[_]=!0,k.push(H),O(),k.pop(),R[_]=!1)},"visit");return O(),A}for(let R=0;R{const S=new Map;for(const[R,k]of T.entries()){const O=m[R],_=S.get(k.edge)??k.points.map(H=>({x:H.x,y:H.y}));k.axis==="vertical"?(_[k.segmentIndex].x=O,_[k.segmentIndex+1].x=O):(_[k.segmentIndex].y=O,_[k.segmentIndex+1].y=O),S.set(k.edge,_)}const A=new Map;for(const[R,k]of S){const O=ae(pt(k));if(it(O).length!==O.length-1)return;A.set(R,O)}return A},"replacementsForAssignment"),E=d(T=>{for(const[m,S]of T){const A=[m.start,m.end].filter(R=>!!R);for(const R of it(S))if(At(R.a,R.b,r,A,-2)||At(R.a,R.b,i,[],-2))return!1}for(let m=0;m=_t)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=l();if(m===0)return;let S,A=m,R=g(),k=Number.POSITIVE_INFINITY;for(const O of f(u()))for(const _ of v(O)){const H=M(O,_);if(!H||!E(H))continue;const P=l(H);if(P>=m)continue;const G=g(H),j=O.reduce((J,dt,mt)=>J+Math.abs(_[mt]-dt.coord),0);P>A||P===A&&(G>R||G===R&&j>=k)||(S=H,A=P,R=G,k=j)}if(!S)return;for(const[O,_]of S)O.points=_}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,p,f)=>pt(u===p?f??[]:u.points??[]),"pointsFor"),c=d(u=>it(u).reduce((p,f)=>{const y=f.a.x-f.b.x,v=f.a.y-f.b.y;return p+Math.hypot(y,v)},0),"pathLength"),a=d((u,p)=>{let f=0;for(let y=0;y{if(u.horizontal){const f=u.a.y;return(Math.abs(f-p.top)<1||Math.abs(f-p.bottom)<1)&&zt(u.a.x,u.b.x,p.left,p.right)>=_t}if(u.vertical){const f=u.a.x;return(Math.abs(f-p.left)<1||Math.abs(f-p.right)<1)&&zt(u.a.y,u.b.y,p.top,p.bottom)>=_t}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const p=[u.start,u.end].filter(y=>!!y),f=[];for(const y of p){const v=e.get(y),M=v?qt(v):void 0;M&&f.push(M)}return f},"endpointRectsFor"),x=d((u,p)=>{if(p+3>=u.length)return[];const f=u[p],y=u[p+1],v=u[p+2],M=u[p+3],E=Tt(f,y,Z)&&wt(y,v,Z)&&Tt(v,M,Z),T=wt(f,y,Z)&&Tt(y,v,Z)&&wt(v,M,Z);if(!E&&!T)return[];if(!(E?Math.sign(y.x-f.x)!==Math.sign(M.x-v.x):Math.sign(y.y-f.y)!==Math.sign(M.y-v.y)))return[];const S=ft(f,M,Z)||ht(f,M,Z)?[]:[{x:f.x,y:M.y},{x:M.x,y:f.y}],A=S.length===0?[[...u.slice(0,p+1),...u.slice(p+3)]]:S.map(k=>[...u.slice(0,p+1),k,...u.slice(p+3)]),R=new Set;return A.map(k=>ae(pt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(_=>oe(_,M,Z)))return!1;const O=k.map(_=>`${_.x.toFixed(3)},${_.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,p,f)=>{const y=[u.start,u.end].filter(M=>!!M),v=g(u);for(const M of it(p))if(At(M.a,M.b,o,y,-2)||At(M.a,M.b,s,[],-2)||v.some(E=>l(M,E)))return!1;for(const M of r)if(M!==u){for(const E of it(p))for(const T of it(i(M)))if(ce(E,T,.5)>=_t)return!1}return a(u,p)<=f},"candidateIsSafe");for(let u=0;u<8;u++){const p=a();let f,y,v=p,M=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=i(T),S=Qt(m,Z),A=c(m);for(let R=0;R<=m.length-4;R++)for(const k of x(m,R)){const O=Qt(k,Z),_=c(k);if(!(Ov||P===v&&(O>M||O===M&&_>=E)||(f=T,y=k,v=P,M=O,E=_)}}if(!f||!y)return;f.points=y}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const i=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const F=N.x??0,D=N.y??0,V=qt(N);V&&i.push({id:String(N.id??""),cx:F,cy:D,rect:V})}if(i.length===0)return;const c=new Map(i.map(N=>[N.id,N])),a=i.map(N=>({id:N.id,rect:N.rect})),l=["top","bottom","left","right"],g={top:Math.min(...i.map(N=>N.rect.top))-20,bottom:Math.max(...i.map(N=>N.rect.bottom))+20,left:Math.min(...i.map(N=>N.rect.left))-20,right:Math.max(...i.map(N=>N.rect.right))+20},x=t.filter(N=>!N.isLayoutOnly),I=new Map(x.map((N,F)=>[N,F])),u=d(N=>{const F=N==="left"||N==="top"?-1:1,D=[];for(let V=0;V<=2;V++)D.push(g[N]+F*20*V);return D},"outwardTracksForSide"),p=d((N,F=new Map)=>pt(F.get(N)??N.points??[]),"replacementPointsFor"),f=d((N,F)=>{let D=0;for(const V of N)for(const h of F)le(V.a,V.b,h.a,h.b,Z)&&D++;return D},"crossingCountBetweenSegments"),y=d((N,F)=>f(it(N),it(F)),"crossingCountBetweenPaths"),v=d((N=new Map)=>{let F=0;const D=[],V=new Set,h=[],b=d(C=>{V.has(C)||(V.add(C),h.push(C))},"addEdge");for(let C=0;C0&&(F+=q,D.push({first:L,second:U,count:q}),b(L),b(U))}}return h.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),{count:F,pairs:D,edgeSet:V,edges:h}},"crossingSnapshot"),M=d((N,F)=>{const D=new Set(F.keys());if(D.size===0)return N.count;let V=0;for(const b of N.pairs)(D.has(b.first)||D.has(b.second))&&(V+=b.count);let h=0;for(let b=0;b{const F=new Map;for(const h of N.pairs){const b=F.get(h.first)??new Set;b.add(h.second),F.set(h.first,b);const C=F.get(h.second)??new Set;C.add(h.first),F.set(h.second,C)}const D=[],V=new Set;for(const h of N.edges){if(V.has(h))continue;const b=[h],C=[];for(V.add(h);b.length>0;){const L=b.pop();C.push(L);for(const w of F.get(L)??[])V.has(w)||(V.add(w),b.push(w))}C.sort((L,w)=>(I.get(L)??0)-(I.get(w)??0)),C.length>1&&D.push(C)}return D},"crossingComponents"),T=d(N=>[N.start,N.end].filter(F=>!!F),"endpointIdsFor"),m=d(N=>{const F=[];for(const D of E(N)){const V=new Set(D),h=new Set(D.flatMap(C=>T(C))),b=[...D];for(const C of x)V.has(C)||T(C).some(L=>h.has(L))&&b.push(C);b.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),F.push(b)}return F},"pairSearchGroups"),S=d((N,F,D)=>M(N,new Map([[F,D]])),"crossingCountWithSingleReplacement"),A=d(N=>{const F=new Map;for(const D of N.pairs)F.set(D.first,(F.get(D.first)??0)+D.count),F.set(D.second,(F.get(D.second)??0)+D.count);return F},"currentCrossingsByEdge"),R=d(N=>N.slice(1).reduce((F,D,V)=>{const h=N[V];return F+Math.abs(D.x-h.x)+Math.abs(D.y-h.y)},0),"pathLength"),k=d((N=new Map)=>x.reduce((F,D)=>F+Qt(p(D,N)),0),"totalBends"),O=d((N=new Map)=>x.reduce((F,D)=>F+R(p(D,N)),0),"totalLength"),_=d((N,F,D=new Map)=>{const V=it(F);for(const h of x)if(h!==N){for(const b of V)for(const C of it(p(h,D)))if(ce(b,C,.5)>=_t)return!0}return!1},"pathHasSegmentConflict"),H=d((N,F)=>{const D=[N.start,N.end].filter(V=>!!V);for(const V of it(F))if(At(V.a,V.b,a,D,-2))return!0;return!1},"pathHitsNode"),P=d((N,F)=>{const D=ae(pt(F));it(D).length===D.length-1&&N.push(D)},"pushOrthogonalCandidate"),G=d(N=>N==="left"||N==="right","sideIsHorizontal"),j=d((N,F,D)=>{switch(F){case"left":return Math.min(N.x,D.x)-20;case"right":return Math.max(N.x,D.x)+20;case"top":return Math.min(N.y,D.y)-20;case"bottom":return Math.max(N.y,D.y)+20}},"localTrackForSameSide"),J=d((N,F,D,V)=>{const h=D==="left"||D==="top"?-1:1,b=[j(F,D,V),g[D]];for(const C of b)for(let L=0;L<=2;L++)P(N,ao(F,D,V,C+h*20*L))},"addSameSideCandidates"),dt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:b,y:F.y},{x:b,y:C},{x:V.x,y:C},V])},"addHorizontalToVerticalCandidates"),mt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:F.x,y:b},{x:C,y:b},{x:C,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=d((N,F,D,V,h)=>{const b=[...u("top"),...u("bottom")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:C,y:F.y},{x:C,y:w},{x:L,y:w},{x:L,y:V.y},V])},"addHorizontalPairCandidates"),Pt=d((N,F,D,V,h)=>{const b=[...u("left"),...u("right")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:F.x,y:C},{x:w,y:C},{x:w,y:L},{x:V.x,y:L},V])},"addVerticalPairCandidates"),Q=d(N=>{const F=new Set;return N.map(D=>pt(D)).filter(D=>{const V=D.map(h=>`${h.x.toFixed(3)},${h.y.toFixed(3)}`).join("|");return F.has(V)||D.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),W=d((N,F,D,V)=>{const h=[],b=co(N,F,D,V,20,Z);b&&P(h,b),F===V&&J(h,N,F,D);const C=G(F),L=G(V);return C&&!L?dt(h,N,F,D,V):!C&&L?mt(h,N,F,D,V):C?kt(h,N,F,D,V):Pt(h,N,F,D,V),Q(h)},"buildCandidatesForSides"),et=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="top"||C==="bottom"?u(C):b;for(const B of h){P(N,[F,D,{x:B,y:D.y},{x:B,y:L.y},L]);for(const U of w)P(N,[F,D,{x:B,y:D.y},{x:B,y:U},{x:L.x,y:U},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="left"||C==="right"?u(C):h;for(const B of b){P(N,[F,D,{x:D.x,y:B},{x:L.x,y:B},L]);for(const U of w)P(N,[F,D,{x:D.x,y:B},{x:U,y:B},{x:U,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=d(N=>{const F=N.start,D=N.end,V=D?c.get(D):void 0;if(!F||!V)return[];const h=pt(N.points??[]);if(h.length<4)return[];const b=h[0],C=h[1],L=[];return wt(b,C,Z)?et(L,b,C,V):Tt(b,C,Z)&&at(L,b,C,V),L},"terminalPreservingOuterTrackCandidates"),xt=d(N=>{const F=N.start,D=N.end,V=F?c.get(F):void 0,h=D?c.get(D):void 0;if(!V||!h)return[];const b=[];for(const C of l){const L=Ie(V,C);for(const w of l)b.push(...W(L,C,Ie(h,w),w))}return b.push(...gt(N)),b},"candidatePathsFor"),vt=d(()=>new Map(x.map(N=>[N,it(p(N))])),"currentSegmentsByEdge"),Vt=d((N,F,D)=>{const V=new Set;for(const h of x){if(h===N)continue;const b=D.get(h)??it(p(h));F.some(C=>b.some(L=>ce(C,L,.5)>=_t))&&V.add(h)}return V},"sharedTrackConflictsFor"),jt=d((N,F,D,V)=>{const h=new Set;return xt(N).map(C=>ae(pt(C))).filter(C=>{if(H(N,C))return!1;const L=C.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return h.has(L)||C.length<2?!1:(h.add(L),!0)}).map(C=>{const L=it(C);let w=0;for(const B of x)B!==N&&(w+=f(L,D.get(B)??it(p(B))));return{candidate:C,candidateSegments:L,crossings:F.count-(V.get(N)??0)+w,bends:Qt(C,Z),totalBends:Qt(C),length:R(C)}}).filter(({crossings:C})=>C<=F.count).sort((C,L)=>C.crossings-L.crossings||C.bends-L.bends||C.length-L.length).slice(0,48).map(C=>({path:C.candidate,segments:C.candidateSegments,sharedTrackConflicts:Vt(N,C.candidateSegments,D),totalBends:C.totalBends,length:C.length}))},"pairCandidatesFor"),Ut=d((N,F,D,V,h,b)=>{let C=0;for(const w of N.pairs)(w.first===F||w.second===F||w.first===V||w.second===V)&&(C+=w.count);let L=f(D.segments,h.segments);for(const w of x){if(w===F||w===V)continue;const B=b.get(w)??it(p(w));L+=f(D.segments,B)+f(h.segments,B)}return N.count-C+L},"pairCrossingCount"),te=d((N,F)=>{for(const D of N.sharedTrackConflicts)if(D!==F)return!1;return!0},"conflictsOnlyWith"),Se=d((N,F)=>N.segments.some(D=>F.segments.some(V=>ce(D,V,.5)>=_t)),"candidatesShareTrack"),de=d((N,F,D,V)=>te(F,D.edge)&&te(V,N.edge)&&!Se(F,V),"pairCandidatesAreCompatible"),Ce=d((N,F,D,V,h)=>{const b=Ut(N.current,F.edge,D,V.edge,h,N.baseSegments);if(!(b>=N.current.count))return{replacements:new Map([[F.edge,D.path],[V.edge,h.path]]),crossings:b,bends:N.currentBends-(N.baseBendsByEdge.get(F.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+D.totalBends+h.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(F.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+D.length+h.length}},"scorePairReplacement"),dn=d((N,F)=>N.crossings{let h=V;for(const b of F.candidates)for(const C of D.candidates){if(!de(F,b,D,C))continue;const L=Ce(N,F,b,D,C);L&&dn(L,h)&&(h=L)}return h},"bestScoreForOptionPair"),hn=d(N=>{const F=k(),D=O(),V=vt(),h=A(N),b=new Map(x.map(q=>[q,Qt(p(q))])),C=new Map(x.map(q=>[q,R(p(q))])),L=new Map,w=m(N);for(const q of w)for(const z of q){if(L.has(z))continue;const Y=jt(z,N,V,h);Y.length>0&&L.set(z,{edge:z,candidates:Y})}let B={replacements:new Map,crossings:N.count,bends:F,length:D};const U={current:N,currentBends:F,currentLength:D,baseBendsByEdge:b,baseLengthByEdge:C,baseSegments:V};for(const q of w){const z=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>L.get(ot)).filter(ot=>!!ot);for(let ot=0;ot0?B.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const F=v(),D=F.count;if(D===0)return;let V,h,b=D,C=Number.POSITIVE_INFINITY;for(const w of F.edges){const B=Qt(p(w),Z);for(const U of xt(w)){const q=H(w,U),z=!q&&_(w,U),Y=S(F,w,U),ot=Qt(U,Z);q||z||!(Yb||Y===b&&ot>=C||(V=w,h=U,b=Y,C=ot)}}if(V&&h){V.points=h;continue}const L=hn(F);if(!L)return;for(const[w,B]of L)w.points=B}}d(vs,"resolveRenderedOrthogonalCrossings");var pe=.001,Wr=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=an(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(f=>f.rect.top))-r,bottom:Math.max(...o.map(f=>f.rect.bottom))+r,left:Math.min(...o.map(f=>f.rect.left))-r,right:Math.max(...o.map(f=>f.rect.right))+r},c=d((f,y,v,M)=>{const E=[],T=co(f,y,v,M,r,pe);return T&&E.push(T),y===M&&E.push(ao(f,y,v,i[y])),E},"buildOrthogonalPathCandidates"),a=d((f,y)=>{for(let v=0;v{let M=0;const E=Re(f,pe),T=y.start,m=y.end;for(const S of t){if(S===y||S.isLayoutOnly)continue;const A=S.start,R=S.end;if(!v&&T&&m&&(A===T||A===m||R===T||R===m))continue;const k=S.points;if(!(!k||k.length<2))for(const O of E)for(const _ of Re(k,pe)){if(fo(O.a,O.b,_.a,_.b,pe,pe)){M++;continue}ce(O,_,pe)>=Wr&&M++}}return M},"pathConflictCount"),g=4,x=d((f,y)=>{const v=Math.abs(f.y-y.rect.top),M=Math.abs(f.y-y.rect.bottom),E=Math.abs(f.x-y.rect.left),T=Math.abs(f.x-y.rect.right);let m="top",S=v;return M{const M=I.get(f)??[];M.push({side:y,edgeId:v}),I.set(f,M)},"addFaceClaim");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points??[];if(y.length<1)continue;const v=f.id??"",M=f.start,E=f.end;if(M){const T=n.get(M);T&&u(M,x(y[0],T),v)}if(E){const T=n.get(E);T&&u(E,x(y[y.length-1],T),v)}}const p=d((f,y,v)=>I.get(f)?.some(M=>M.edgeId!==v&&M.side===y)??!1,"faceIsClaimed");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points;if(!y||y.length<2)continue;const v=Qt(y,pe);if(v0){const mt=l(J,f,!0);if(mt>O||mt===O&&dt>=_)continue;O=mt,_=dt,k=J;continue}l(J,f)>R||dt<_&&(_=dt,k=J)}}}if(k){f.points=k;const H=I.get(M);H&&I.set(M,H.filter(G=>G.edgeId!==S));const P=I.get(E);P&&I.set(E,P.filter(G=>G.edgeId!==S)),u(M,x(k[0],T),S),u(E,x(k[k.length-1],m),S)}}}d(Ls,"simplifyDetouredEdges");var Kt=.001,Po=10,Ve=7;function $n(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,c=r.y-s.y;if(!(Math.abs(i)+Math.abs(c)r&&Je(t,Es(r)))}d(zn,"labelOverlapsOwnMarker");function Ue(t,e){const n=[];for(const p of t){if(p.isLayoutOnly)continue;const f=p.points;if(!(!f||f.length<2))for(let y=0;y{const y=Tn(f,r);for(const{nodeId:v,rect:M}of o)if(v!==p&&Je(y,M))return!0;return!1},"labelOverlapsForeignNode"),l=d((p,f)=>{const y=Tn(f,r);for(const v of n)if(v.edgeId!==p&&cn(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),g=d((p,f,y)=>a(p,y)||l(f,y),"labelOverlapsAnything"),x=[],I=d(p=>{for(const{id:f,rect:y}of s)if(ts(y,p))return f},"findContainingLane"),u=d((p,f)=>x.some(y=>y.labelId!==p&&Je(f,y.rect)),"overlapsPlacedLabel");for(const p of t){if(p.isLayoutOnly)continue;const f=p.labelNodeId;if(!f)continue;const y=e.get(f);if(!y)continue;const v=p.points;if(!v||v.length<2)continue;const M=y.width??0,E=y.height??0;if(M<=0||E<=0)continue;const T=[];for(let Q=0;Q=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx0?m:T,A=M>=E?"horizontal":"vertical",R=d(Q=>[...Q].sort((W,et)=>{const at=W.orientation===A,gt=et.orientation===A;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?M:E)+2,vt=et.length>=(et.orientation==="horizontal"?M:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((Q,W)=>{const et=v[Q.idx],at=v[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),P=d((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=d((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=d(Q=>{const W=Ae(Q.midX,Q.midY,M,E),et=I(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+M/2+i,xt=at.rect.right-M/2-i,vt=at.rect.top+E/2+i,Vt=at.rect.bottom-E/2-i;if(gt>xt||vt>Vt)return;const jt={midX:P(Q.midX,gt,xt),midY:P(Q.midY,vt,Vt)},Ut=Ae(jt.midX,jt.midY,M,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),J=d((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=d((Q,W)=>{const at=(Q.orientation==="horizontal"?M/2:E/2)+c;if(Q===k){const gt=v[Q.idx];if(J(Q,W,gt)+Kt{const W=R(Q);for(const et of W)for(const at of _){const gt=H(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!zn(xt.rect,v)&&!u(f,xt.rect)&&!g(f,p.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=d((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!zn(vt.rect,v)&&!u(f,vt.rect)&&!a(f,vt.rect)&&(et||!l(p.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(S)??(S.lengthet.labelId===f);W>=0?x[W]={labelId:f,rect:Q}:x.push({labelId:f,rect:Q})}}}d(Ue,"anchorLabelsToPolyline");var Sn=1e-6,Kr=8,Bo=Kr/2,qr=3;function Vn(t,e){return t{const g=Vn(c,a);let x=0;const I=d(u=>{if(!u)return;const p=s.get(u);if(!p)return;const f=l==="x"?p.w/2:p.h/2;f>x&&(x=f)},"consider");I(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const p=u.start,f=u.end;!p||!f||Vn(p,f)===g&&I(u.labelNodeId)}return x>0?x+qr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const c=i.points;if(!ro(c,Sn))continue;const a=lo(i,n,Sn);if(!a)continue;const{srcId:l,dstId:g,srcInfo:x,dstInfo:I,collinearX:u,collinearY:p}=a;if(u===p)continue;let f,y;if(u){const m=I.cy>x.cy;f={x:x.cx,y:m?x.rect.bottom:x.rect.top},y={x:I.cx,y:m?I.rect.top:I.rect.bottom}}else{const m=I.cx>x.cx;f={x:m?x.rect.right:x.rect.left,y:x.cy},y={x:m?I.rect.left:I.rect.right,y:I.cy}}if(At(f,y,o,[l,g],1))continue;const M=r(i,l,g,u?"x":"y"),E=M>Bo?M:Bo,T=[0,E,-E];for(const m of T){const S={...f},A={...y};if(u){if(S.x+=m,A.x+=m,S.x<=x.rect.left||S.x>=x.rect.right||A.x<=I.rect.left||A.x>=I.rect.right)continue}else if(S.y+=m,A.y+=m,S.y<=x.rect.top||S.y>=x.rect.bottom||A.y<=I.rect.top||A.y>=I.rect.bottom)continue;if(!At(S,A,o,[l,g],1)&&!Ze(S,A,t,i,{epsilon:Sn})){i.points=[S,A];break}}}}d(Ts,"straightenCollinearSiblingDetours");function jn(t,e){const{realNodeRects:a,labelNodeRects:l}=me(e.values()),g=d((m,S)=>Re(S,.001).map(A=>({...A,edge:m,interior:A.index>=1&&A.index<=S.length-3})),"segmentsFor"),x=d(()=>{const m=[];for(const S of t){if(S.isLayoutOnly)continue;const A=S.points;!A||A.length<2||m.push(...g(S,pt(A)))}return m},"allSegments"),I=d((m,S)=>m.horizontal&&S.horizontal?zt(m.a.x,m.b.x,S.a.x,S.b.x)>=8&&Math.abs(m.a.y-S.a.y)<7:m.vertical&&S.vertical?zt(m.a.y,m.b.y,S.a.y,S.b.y)>=8&&Math.abs(m.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((m,S)=>{const A=m.start,R=m.end,k=g(m,S);if(k.length!==S.length-1)return!1;const O=[A,R].filter(H=>!!H),_=m.labelNodeId?[m.labelNodeId]:[];for(const H of k)if(At(H.a,H.b,a,O,-2)||At(H.a,H.b,l,_,-2))return!1;for(const H of t){if(H===m||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of k)for(const j of g(H,pt(P)))if(I(G,j)||le(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),p=d((m,S)=>{const A=pt(m.edge.points??[]);if(A.length<4||m.index>=A.length-1)return;const R=A.map(k=>({...k}));if(m.horizontal)R[m.index].y+=S,R[m.index+1].y+=S;else if(m.vertical)R[m.index].x+=S,R[m.index+1].x+=S;else return;return g(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),f=d((m,S)=>({x:m.x??(S.left+S.right)/2,y:m.y??(S.top+S.bottom)/2}),"nodeCenter"),y=d(m=>{const S=m.edge,A=pt(S.points??[]);if(A.length!==4||m.index!==1)return;const R=S.start?e.get(S.start):void 0,k=S.end?e.get(S.end):void 0,O=R?qt(R):void 0,_=k?qt(k):void 0,H=A.slice(m.index+2);if(!(!R||!k||!O||!_||H.length===0))return{sourceCenter:f(R,O),targetCenter:f(k,_),sourceRect:O,tail:H}},"sourceDetourContextFor"),v=d((m,S,A,R,k,O)=>{const _=R.y>=A.y,H=_?k.bottom:k.top,P=H+(_?20:-20);if(_&&m.b.y<=P+.001||!_&&m.b.y>=P-.001)return;const G=m.a.x+S;return pt([{x:A.x,y:H},{x:A.x,y:P},{x:G,y:P},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),M=d((m,S,A,R,k,O)=>{const _=R.x>=A.x,H=_?k.right:k.left,P=H+(_?20:-20);if(_&&m.b.x<=P+.001||!_&&m.b.x>=P-.001)return;const G=m.a.y+S;return pt([{x:H,y:A.y},{x:P,y:A.y},{x:P,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=d((m,S)=>{const A=y(m);if(A){if(m.vertical)return v(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(m.horizontal)return M(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const S=x();let A=!1;for(let R=0;RP.interior);for(const P of H){for(const G of T){const j=p(P,G);if(j&&u(P.edge,j)){P.edge.points=j,A=!0;break}const J=E(P,G);if(J&&u(P.edge,J)){P.edge.points=J,A=!0;break}}if(A)break}}if(!A)return}}d(jn,"nudgeSharedInteriorSubpaths");function ws(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,c=o.y-n.y,a=s*c-r*i;if(Math.abs(a)<1e-10)return!1;const l=n.x-t.x,g=n.y-t.y,x=(l*c-g*i)/a,I=(l*r-g*s)/a,u=.01;return x>u&&x<1-u&&I>u&&I<1-u}d(ws,"segmentsIntersect");function As(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const c of n){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<2)continue;const l=c.start,g=c.end,x=c.labelNodeId,I=c.id??`${l}->${g}`;for(const u of s)if(!(u.nodeId===l||u.nodeId===g)&&!(x&&u.nodeId===x)){for(let p=0;p0){const c=o.filter(l=>l.type==="edge-node-overlap").length,a=o.filter(l=>l.type==="edge-edge-crossing").length;Ke.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${a} edge crossing(s)`);for(const l of o)Ke.warn(`[SWIMLANE_VALIDATE] ${l.type}: ${l.detail}`)}return o}d(As,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ms(t,e)||e==="BT"&&s.length>0&&!ps(t))return;for(const c of o){if(c.isLayoutOnly)continue;const a=c.points;!a||a.length<2||(c.points=ae(Qe(a)))}Ls(o,n),Ts(o,n),ys(o,n);const r=new Map;for(const c of n)r.set(String(c.id),c);Ue(o,r),is(o,r),xs(o,r),jn(o,r),bs(o,r),Ms(o,r),Xn(o,r),Is(o,r);const i=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ue(o,r),Dn(o,r),Xn(o,r),Ue(o,r),Dn(o,r)},"finalizeRenderedEdges");i(),jn(o,r),i(),Yn(o,r),Gn(o,r),Yn(o,r),Gn(o,r)}d(Rs,"postProcessSwimlaneLayout");function ye(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(ye,"normalizeGraph");function mo(t,e){return t.edges.filter(n=>n.dst===e)}d(mo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function yo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(yo,"buildSortedSuccessorMap");function xo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(xo,"buildInDegreeMap");function bo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(bo,"sortedZeroInDegreeNodes");function ln(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(ln,"buildPredecessorSuccessorMaps");function Mo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}d(Mo,"buildLayersFromRanks");function Be(t){const e=xo(t),n=bo(e),o=[],s=yo(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let c=0;for(;c{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),c=o,a=r,l=o;for(;c=s||cx.dst===I.dst?x.id.localeCompare(I.id):x.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const x of n.get(g)??[]){const I=x.dst;o[I]===0?r(I):o[I]===1&&s.push(x)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,x)=>g.localeCompare(x));for(const g of i)o[g]===0&&r(g);const c=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),a=e.edges.map(g=>c.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:a,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const c=n(r)??r;return e.set(o,c),c},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function fe(t){const e=Ps(t);return n=>e.get(n)??null}d(fe,"createTopLaneResolver");function fn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(fn,"buildTopLaneOrder");function So(t,e){const n=fn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(So,"resolveTopLaneOrder");var Jr={EPSILON:1e-6},sn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},ko={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=ln(n);for(const m of r.values())m.sort((S,A)=>S.localeCompare(A));const i=Be(n)??[...n.nodes].sort((m,S)=>m.localeCompare(S)),c=new Map;for(const[m,S]of i.entries())c.set(S,m);const a=new Map,l=new Map;for(const m of n.nodes)l.set(m,[]);for(const m of i){const S=(r.get(m)??[]).filter(A=>a.has(A));if(S.length>0){const A=ks(m,S,{laneOf:o,rankHint:s,topoIndex:c});a.set(m,A),l.get(A).push(m)}else a.has(m)||a.set(m,null)}for(const m of n.nodes)a.has(m)||a.set(m,null);const g=new Set;for(const m of n.nodes)(a.get(m)??null)===null&&g.add(m);const x=[...g].sort((m,S)=>{const A=c.get(m)??0,R=c.get(S)??0;return A===R?m.localeCompare(S):A-R}),I=_s(n),u=new Map;for(const[m,S]of I.entries())u.set(m,[...S].sort((A,R)=>A.localeCompare(R)));const p=Fs(u),f=Ds(u),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of f)for(const S of m.nodes){const A=y.get(S);A?A.push(m.id):y.set(S,[m.id])}const v=[],M=[],E=new Set,T=d(m=>{if(!E.has(m)){E.add(m),v.push(m);for(const S of l.get(m)??[])T(S);M.push(m)}},"walk");for(const m of x)T(m);for(const m of i)T(m);return{parent:a,children:l,roots:x,componentOf:p,blocks:f,nodeBlocks:y,adjacency:u,preorder:v,postorder:M,topologicalOrder:i}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{const c=n.laneOf(r),a=n.laneOf(i),l=c!=null&&c===o,g=a!=null&&a===o;if(l!==g)return l?-1:1;const x=n.rankHint?.[r],I=n.rankHint?.[i];if(x!=null&&I!=null&&x!==I)return I-x;const u=n.topoIndex.get(r)??0,p=n.topoIndex.get(i)??0;return u!==p?u-p:r.localeCompare(i)})[0]}d(ks,"chooseParent");function _s(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(_s,"buildAdjacency");function Fs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Fs,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((c,a)=>{e.set(c,++r),n.set(c,r);for(const l of t.get(c)??[])l!==a&&(e.has(l)?(e.get(l)??0)<(e.get(c)??0)&&(o.push([c,l]),n.set(c,Math.min(n.get(c)??r,e.get(l)??r))):(o.push([c,l]),i(l,c),n.set(c,Math.min(n.get(c)??r,n.get(l)??r)),(n.get(l)??0)>=(e.get(c)??0)&&s.push(Hs(c,l,o,s.length))))},"visit");for(const c of t.keys())e.has(c)||i(c,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[M,E]of o.entries())s.set(E,M);const r=o.length,i=new Array(r).fill(-1),c=new Array(r).fill(0),a=[],l=new Set;for(const M of o){const E=n.parent.get(M)??null,T=s.get(M);T!=null&&E==null&&(i[T]=-1,c[T]=0,l.has(M)||(l.add(M),a.push(M)))}for(;a.length>0;){const M=a.shift(),E=s.get(M);if(E==null)continue;const T=n.children.get(M)??[];for(const m of T){if(l.has(m))continue;const S=s.get(m);S!=null&&(i[S]=E,c[S]=c[E]+1,l.add(m),a.push(m))}}for(const M of o){if(l.has(M))continue;const E=s.get(M);E!=null&&(i[E]=-1,c[E]=0,l.add(M))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),x=Array.from({length:g},()=>new Array(r).fill(-1));for(let M=0;M{if(M===-1||E===-1)return-1;c[M]>m&1&&(M=x[m][M],M===-1))return-1;if(M===E)return M;for(let m=g-1;m>=0;m--){const S=x[m][M],A=x[m][E];S===-1||A===-1||S!==A&&(M=S,E=A)}return x[0][M]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const M of t.edges){let E=M.src,T=M.dst,m=e[E],S=e[T];if(m==null||S==null||(m>S&&([E,T]=[T,E],[m,S]=[S,m]),m==null||S==null||m===S))continue;const A=s.get(E),R=s.get(T);if(A==null||R==null)continue;const k=I(A,R);if(k===-1)continue;const O=u[k];for(let _=m;_{if(E.size!==0)for(const[T,m]of E)M.set(T,(M.get(T)??0)+m)},"mergeInto"),y=new Set,v=d(M=>{const E=s.get(M);y.add(M);const T=E==null?void 0:u[E],m=T?new Map(T):new Map,S=n.children.get(M)??[];for(const A of S){const R=v(A),k=e[M];if(k!=null){let O=p.get(M);O||(O=new Map,p.set(M,O));let _=R.get(k)??0;const H=e[A];H!=null&&H>k&&(_+=1),O.set(A,_)}f(m,R)}return m},"dfs");for(const M of n.roots)y.has(M)||v(M);for(const M of o)y.has(M)||v(M);return p}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const c=[...e.get(r)??[]];c.sort(Co(n));for(const a of c){s(a);const l=o.get(a);l!=null&&(i=Math.min(i,l))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Co(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Co,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const a of e){const l=n[a]??0;l>s&&(s=l)}const r=Array.from({length:s+1},()=>[]),i=new Set,c=d(a=>{if(i.has(a))return;i.add(a);const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a);for(const g of o(a))c(g)},"emit");for(const a of t)c(a);for(const a of e)if(!i.has(a)){const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a),i.add(a)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,c=[],a=[],l=n.get(s);for(const g of r){const x=o.get(g)??i;x>i?c.push({child:g,min:x}):a.push(g)}return c.sort((g,x)=>g.min===x.min?g.child.localeCompare(x.child):g.min-x.min),a.sort((g,x)=>{const I=l?.get(g)??0,u=l?.get(x)??0;if(I!==u)return I-u;const p=o.get(g)??i,f=o.get(x)??i;return p!==f?p-f:g.localeCompare(x)}),[...c.map(g=>g.child),...a]}}d(zs,"createChildOrderer");function rn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const x of t.nodes)s.has(x)||s.set(x,[]);const i=Xs(t,e,o),c=[...r].sort(Co(e)),a=Ys(c,s,e),l=zs(s,e,i,a);let g=Gs(c,t.nodes,e,l);return g=$s(g),g}d(rn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(e),i=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&i.push(r.get(c.dst));return Io(i)}d(Vs,"countCrossingsBetweenAdjacent");function Un(t,e,n){const o=[];for(const r of e){const i=n[r.src],c=n[r.dst];if(i==null||c==null||i===c)continue;let a=r.src,l=r.dst,g=i,x=c;i>c&&(a=r.dst,l=r.src,g=c,x=i);for(let I=g;I(n[I]??0)-(n[x]??0));for(const x of g){const I=n[x]??0;if(I===0)continue;let u=0;for(const v of o.get(x)??[])u=Math.max(u,(n[v]??0)+1);if(u>=I)continue;const p=I;n[x]=u;const f=rn(t,n,s),y=Un(f,t.edges,n);y(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(f=>f.src===s);if(i.length===0)continue;let c=!1,a=0;for(const f of i){const y=n(f.dst);y==null||y===r?c=!0:a++}if(a===0||c)continue;let l=0,g=!1;for(const f of t.edges){if(f.dst!==s)continue;const y=n(f.src);y&&(y===r?g=!0:l++)}if(l>0||!g)continue;const x=e[s]??0,I=x+a;let u=0;for(const f of t.edges)f.dst===s&&(u=Math.max(u,(e[f.src]??0)+1));const p=Math.max(x,u,I);p!==x&&(e[s]=p)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=ye(t),o=Be(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n);let i=Object.create(null);for(const a of o){const l=mo(n,a),g=e?.ignoreCrossLaneEdges?l.filter(x=>{const I=r(x.src),u=r(a);return!I||!u?!0:I===u}):l;if(g.length===0)i[a]=0;else if(s&&g.length===1){const x=g[0].src,I=r(x),u=r(a);I!==u?i[a]=i[x]??0:i[a]=(i[x]??0)+1}else{let x=-1/0;for(const I of g)x=Math.max(x,(i[I.src]??0)+1);i[a]=x===-1/0?0:x}}return(e?.optimizeRanksByCrossings??!1)&&(i=js(n,i)),e?.ignoreCrossLaneEdges&&Us(n,i),{layers:rn(n,i,r),rankOf:i,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=ye(t),s={...Ws(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:c}=ln(n,p=>{if(e?.ignoreCrossLaneEdges){const f=r(p.src),y=r(p.dst);if(f&&y&&f!==y)return!1}return!0}),a=Be(n)??[...n.nodes],l=[...a].reverse(),g=d((p,f)=>{let y=0;for(const E of i.get(p)??[])y=Math.max(y,(s[E]??0)+1);let v=Number.POSITIVE_INFINITY;const M=c.get(p)??[];return M.length>0&&(v=Math.min(...M.map(E=>(s[E]??0)-1))),Number.isFinite(v)||(v=Math.max(y,f)),Math.min(Math.max(f,y),v)},"clampFeasible"),x=sn.GRAVITY_ITERATIONS,I=d(p=>{let f=!1;for(const y of p){const v=i.get(y)??[],M=c.get(y)??[];if(v.length===0&&M.length===0)continue;const E=v.length>0?v.reduce((A,R)=>A+(s[R]??0)+1,0)/v.length:s[y]??0,T=M.length>0?M.reduce((A,R)=>A+(s[R]??0)-1,0)/M.length:s[y]??0,m=Math.round((E+T)/2),S=g(y,m);S!==s[y]&&(s[y]=S,f=!0)}return f},"relaxOrder");for(let p=0;p0){const y=Math.min(...f.map(v=>(s[v]??0)-1));(s[p]??0)>y&&(s[p]=y)}}return{layers:Mo(n,a,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=xo(t),n=yo(t);let o=bo(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const c of n.get(i)??[])e.set(c,(e.get(c)??0)-1),(e.get(c)??0)===0&&r.push(c)}o=r.sort((i,c)=>i.localeCompare(c))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=ye(t),o=e?.direction==="LR"?qs(n)??[...n.nodes].sort():Be(n)??[...n.nodes].sort(),s=fe(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),c=new Map,a=d((g,x)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(x)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const I=mo(n,g);let u=0;if(I.length>0)for(const v of I){const M=v.src,E=i[M]??0;u=Math.max(u,E+a(M,g))}const p=r(g),f=c.get(p)??0,y=Math.max(u,f);i[g]=y,c.set(p,y+1)}return{layers:Mo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=ye(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const c=new Map(n.nodeById),a=d(u=>{const p=`placeholder-${i++}`,f={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(p,f),r.add(p);s.length<=u;)s.push([]);return s[u].push(p),o[p]=u,p},"addDummyAt"),l=[...n.edges].sort((u,p)=>u.id===p.id?u.src===p.src?u.dst.localeCompare(p.dst):u.src.localeCompare(p.src):u.id.localeCompare(p.id)),g=[];for(const u of l){const p=o[u.src]??0,f=o[u.dst]??0;if(f-p<=1){g.push(u);continue}let y=u.src;for(let M=p+1,E=0;M!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:c};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function Wn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Wn,"median");function Kn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Kn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function qn(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(t),i=Ne(e),c=[];for(const l of n)o.has(l.src)&&s.has(l.dst)&&c.push({u:r.get(l.src),v:i.get(l.dst)});c.sort((l,g)=>l.u===g.u?l.v-g.v:l.u-g.u);const a=c.map(l=>l.v);return Io(a)}d(qn,"countCrossingsBetweenAdjacent");function We(t,e,n){return[...t].sort((o,s)=>{const r=Wn(e.get(o)??[]),i=Wn(e.get(s)??[]);return r===i?tr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(We,"sortByHeuristic");function Jn(t,e,n,o,s,r){const i=Ne(t),c=Ne(e),a=Qs(e,i,n,o);if(!s||!r||r.length===0)return We(e,a,c);const l=new Map;for(const I of e){const u=s(I),p=l.get(u)??[];p.push(I),l.set(u,p)}const g=[];for(const I of r){const u=l.get(I);if(!u||u.length===0)continue;const p=We(u,a,c);g.push(...p)}const x=l.get(null);if(x&&x.length>0){const I=We(x,a,c);for(const u of I){const p=Kn(a.get(u)??[]);let f=g.length;if(isFinite(p))for(const[y,v]of g.entries()){const M=Kn(a.get(v)??[]);if(pi.has(f.src)&&c.has(f.dst)),g=a?n.filter(f=>c.has(f.src)&&a.has(f.dst)):void 0,x=d(f=>{let y=qn(t,f,l);return g&&o&&(y+=qn(f,o,g)),y},"crossingScore"),I=s?new Map:null;if(s&&I)for(const f of e)I.set(f,s(f));let u=!0,p=x(r);for(;u;){u=!1;for(let f=0;f+1[...c]),s=e.edges,r=fe(e),i=So(e,n?.laneOrder);for(let c=0;c<3;c++){for(let a=1;a=0;a--)o[a]=Jn(o[a+1],o[a],s,"up",r,i),o[a]=Zn(o[a+1],o[a],s,o[a-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=n?.layerGap??ko.DEFAULT_LAYER_GAP,s=n?.nodeGap??ko.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",c=i==="LR"||i==="RL",a=t.layers,l=Object.create(null),g=Object.create(null),x=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>x(O)?.width??0,"getWidth"),u=d(O=>x(O)?.height??0,"getHeight"),p=fe(e),f=So(e,n?.laneOrder),y=a.map(O=>O.reduce((_,H)=>Math.max(_,u(H)),0)),v=[];if(c)for(let O=0;O+1Math.max(mt,I(kt)),0),H=a[O+1].reduce((mt,kt)=>Math.max(mt,I(kt)),0),P=y[O],G=y[O+1],j=P/2+G/2,J=(_+H)/2,dt=Math.max(0,J-j-o);v.push(dt)}const M=new Set;for(const O of a)for(const _ of O)M.add(p(_));const E=M.has(null),T=f.filter(O=>M.has(O)),m=[...E?[null]:[],...T],S=Object.create(null);for(const O of T)S[O]=0;E&&(S.null=0);for(const O of a){const _=Object.create(null),H=[];for(const P of O){const G=p(P);G===null?H.push(P):(_[G]||=[]).push(P)}for(const[P,G]of Object.entries(_)){const j=G.reduce((J,dt)=>J+I(dt),0)+s*Math.max(0,G.length-1);S[P]=Math.max(S[P]??0,j)}if(E&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);S.null=Math.max(S.null??0,P)}}const A=new Map;{const O=m.map(P=>(P===null?S.null:S[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,m.length-1))/2;for(let P=0;PI(Q)),kt=mt.reduce((Q,W)=>Q+W,0)+s*(J.length-1);let Pt=dt-kt/2;for(const[Q,W]of J.entries()){const et=mt[Q];l[W]=Pt+et/2,g[W]=R+H/2,Pt+=et+s}}}const G=v[O]??0;R+=H+o+G}const k=new Map;for(const O of e.edges){const _=O.ref.id;k.has(_)||k.set(_,[]),k.get(_).push(O)}for(const[,O]of k){if(O.length===0)continue;const _=O[0].ref,H=_.start,P=_.end;if(H==null||P==null)continue;const G=Math.round(((l[H]??0)+(l[P]??0))/2),j=new Set;for(const J of O)j.add(J.src),j.add(J.dst);for(const J of j){if(J===H||J===P)continue;e.nodeById.get(J)?.isDummy&&(l[J]=G)}}return{x:l,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function Qn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const c=n.get(s),a=n.get(r);c==null||a==null||(o+=i*Math.abs(c-a))}return o}d(Qn,"laneArrangementCost");function ar(t){const e=fn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=fe(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,c=typeof r.end=="string"?r.end:void 0;if(!i||!c||!t.nodeById.has(i)||!t.nodeById.has(c))continue;const a=o(i),l=o(c);if(!a||!l||a===l)continue;const g=n.get(a),x=n.get(l);if(g==null||x==null)continue;const[I,u]=g<=x?[a,l]:[l,a],p=`${I}\0${u}`,f=s.get(p);f?f.weight++:s.set(p,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function to(t,e,n){const o=[...t];let s=Qn(o,e),r=!0,i=0;const c=Math.max(1,o.length);for(;r&&is.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=fn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((c,a)=>[c,a]));let r=to(n,o,s);const i=Math.max(0,e.restarts??or);for(let c=0;cct&&a*3>=c?i>0?"bottom":"top":c>ct?r>0?"right":"left":n}d(eo,"chooseOrthogonalSide");function no(t,e){return Math.abs(t.to-e.from)h.isGroup&&!h.parentId);for(const h of l){const b={id:h.id},C=d(L=>{i.set(L.id,b),n.filter(w=>w.parentId===L.id).forEach(C)},"assignLane");C(h)}const g=n.filter(h=>!h.isGroup&&!h.isEdgeLabel).map(h=>{const b=h.width??10,C=h.height??10,L=h.x??0,w=h.y??0,B=Zr;return{nodeId:h.id,minX:L-b/2-B,maxX:L+b/2+B,minY:w-C/2-B,maxY:w+C/2+B,visualXHalfExtent:a?C/2+B:b/2+B}}),x=d((h,b,C,L)=>{let w=c.find(B=>B.orientation===h&&Math.abs(B.coord-b)<1);return w||(w={id:`pipe-${h}-${b.toFixed(0)}`,orientation:h,coord:b,spanMin:C,spanMax:L,tracks:[]},c.push(w)),w.spanMin=Math.min(w.spanMin,C),w.spanMax=Math.max(w.spanMax,L),w},"getOrAddPipe"),I=d((h,b)=>{const C=h.width??10,L=h.height??10,w=h.x??0,B=h.y??0;switch(b){case"top":return{x:w,y:B-L/2};case"bottom":return{x:w,y:B+L/2};case"left":return{x:w-C/2,y:B};case"right":return{x:w+C/2,y:B}}},"portForSide"),u=d((h,b,C)=>I(h,eo(h,b,C?"bottom":"top")),"getOrthogonalPort"),p=[],f=[],y=new Set,v=1e3,M=d((h,b,C)=>{if(p.length===0)return 0;const L=Math.abs(b.y-C.y)z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}else if(w){const U=b.x,q=Math.min(b.y,C.y)-ct,z=Math.max(b.y,C.y)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===h||Y.orientation!=="horizontal"||Y.pipe.coordz||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}return B},"crossingPenalty"),E=s.map((h,b)=>{if(!h.start||!h.end)return{idx:b,crossLane:0,dx:0,dy:0};const C=r.get(h.start),L=r.get(h.end),w=i.get(h.start),B=i.get(h.end),U=w&&B&&w.id!==B.id?1:0,q=C&&L?Math.abs((L.x??0)-(C.x??0)):0,z=C&&L?Math.abs((L.y??0)-(C.y??0)):0;return{idx:b,crossLane:U,dx:q,dy:z}}).sort((h,b)=>{if(h.crossLane!==b.crossLane)return b.crossLane-h.crossLane;const C=h.dx+h.dy,L=b.dx+b.dy;return Math.abs(C-L)>1?C-L:h.idx-b.idx}).map(h=>h.idx),T=d((h,b,C,L)=>{const w=Math.min(h.x,b.x),B=Math.max(h.x,b.x),U=Math.min(h.y,b.y),q=Math.max(h.y,b.y);return!!g.find(Y=>C&&Y.nodeId===C||L&&Y.nodeId===L?!1:Math.abs(h.x-b.x)>ct?Y.minYh.y&&Y.maxX>w&&Y.minXh.x&&Y.maxY>U&&Y.minYeo(h,b,"bottom"),"determineSide"),R=new Map;for(const[h,b]of s.entries()){if(!b.start||!b.end||b.start===b.end||b.points&&b.points.length>0)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const w=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);R.set(h,{edgeIdx:h,srcId:b.start,dstId:b.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(w),absDy:Math.abs(B),dxSign:Math.sign(w),dySign:Math.sign(B)})}const k=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.absDx===0?1/0:h.absDy/h.absDx:h.absDy===0?1/0:h.absDx/h.absDy,"preferenceStrength"),O=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.dxSign>=0?"right":"left":h.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const h of R.values()){const b=`${h.srcId}:${h.srcSide}`;_.has(b)||_.set(b,[]),_.get(b).push(h)}const H=new Map,P=d((h,b)=>`${h}:${b}`,"loadKey");for(const h of R.values())H.set(P(h.srcId,h.srcSide),(H.get(P(h.srcId,h.srcSide))??0)+1),H.set(P(h.dstId,h.dstSide),(H.get(P(h.dstId,h.dstSide))??0)+1);for(const h of _.values())if(!(h.length<2)){h.sort((b,C)=>{const L=k(b),w=k(C);return Math.abs(L-w)>1e-9?w-L:b.edgeIdx-C.edgeIdx});for(let b=1;b=w||(H.set(P(C.srcId,C.srcSide),w-1),H.set(P(C.srcId,L),B+1),C.srcSide=L)}}const G=d(h=>{const b=h?.shape;return b==="question"||b==="diamond"},"isDiamondNode"),j=new Map;for(const h of R.values())j.has(h.dstId)||j.set(h.dstId,new Set),j.get(h.dstId).add(h.dstSide);for(const h of R.values()){if(!G(r.get(h.srcId)))continue;const b=j.get(h.srcId);if(!b?.has(h.srcSide))continue;const C=O(h);if(b.has(C)||(H.get(P(h.srcId,C))??0)>0)continue;const L=H.get(P(h.srcId,h.srcSide))??0;H.set(P(h.srcId,h.srcSide),Math.max(0,L-1)),H.set(P(h.srcId,C),1),h.srcSide=C}for(const h of R.values()){const{edgeIdx:b,srcId:C,dstId:L,srcSide:w,dstSide:B}=h,U=r.get(C),q=r.get(L),z=`${C}:${w}:src`,Y=w==="top"||w==="bottom"?q.x??0:q.y??0;m.has(z)||m.set(z,[]),m.get(z).push({edgeIdx:b,oppositeCoord:Y});const ot=`${L}:${B}:dst`,rt=B==="top"||B==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:b,oppositeCoord:rt})}const J=new Map,dt=8;for(const[h,b]of m){if(b.length<2)continue;b.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);const C=h.split(":"),L=C.slice(0,-2).join(":"),w=C[C.length-2],B=C[C.length-1],U=r.get(L);if(!U)continue;const z=w==="left"||w==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?z*.3:z,tt=Math.min(20,Math.max(dt,rt/(b.length+1))),Rt=-(tt*(b.length-1))/2;for(const[Lt,Dt]of b.entries()){const Jt=Rt+Lt*tt,gn=`${Dt.edgeIdx}:${B}`;J.set(gn,Jt)}}const mt=d(h=>!!s[h]?.labelNodeId,"edgeHasLabelNode"),kt=d((h,b)=>h?(m.get(`${h}:${b}:src`)??[]).some(({edgeIdx:C})=>mt(C))||(m.get(`${h}:${b}:dst`)??[]).some(({edgeIdx:C})=>mt(C)):!1,"faceHasLabelNode"),Pt=d((h,b,C)=>b==="top"||b==="bottom"?{x:h.x+C,y:h.y}:{x:h.x,y:h.y+C},"applyPortOffset"),Q=d((h,b,C)=>{const L=R.get(h),w={x:C.x??0,y:C.y??0},B={x:b.x??0,y:b.y??0},U=L?.srcSide??A(b,w),q=L?.dstSide??A(C,B);let z=L?I(b,L.srcSide):u(b,w,!0),Y=L?I(C,L.dstSide):u(C,B,!1);const ot=J.get(`${h}:src`),rt=J.get(`${h}:dst`);return ot!==void 0&&(z=Pt(z,U,ot)),rt!==void 0&&(Y=Pt(Y,q,rt)),{pSrcPort:z,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const h of E){const b=s[h];if(f[h]=[],!b.start||!b.end||b.points&&b.points.length>0||b.start===b.end)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const{pSrcPort:w,pDstPort:B,srcSide:U,dstSide:q}=Q(h,C,L),z={...w},Y={...B},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=w.y>(C.y??0);z.y=X?w.y+ne:w.y-ne}else{const X=w.x>(C.x??0);z.x=X?w.x+ne:w.x-ne}if(rt){const X=B.y>(L.y??0);Y.y=X?B.y+ne:B.y-ne}else{const X=B.x>(L.x??0);Y.x=X?B.x+ne:B.x-ne}const st=d((X,$)=>{for(const K of g)if(!$.includes(K.nodeId)&&X.x>K.minX&&X.xK.minY&&X.y{if(Ct){const Nt=X.y>($.y??0);return{x:(K.x??0)>=X.x?lt.maxX+be:lt.minX-be,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>($.x??0),Et=(K.y??0)>=X.y;return{x:bt?lt.maxX+be:lt.minX-be,y:Et?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[b.start,b.end],Lt=st(z,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const $=tt(w,C,L,X,!0);z.x=$.x,z.y=$.y;const K=$.leavesPositiveSide?Math.min(X.minY-2,w.y+ne):Math.max(X.maxY+2,w.y-ne);yt=[{x:w.x,y:K},{x:$.x,y:K},{x:$.x,y:$.y}]}else{const $=tt(w,C,L,X,!1),K=$.leavesPositiveSide?Math.min(X.minX-2,w.x+ne):Math.max(X.maxX+2,w.x-ne);z.x=$.x,z.y=$.y,yt=[{x:K,y:w.y},{x:K,y:$.y},{x:$.x,y:$.y}]}}let Dt=[];const Jt=st(Y,Rt);if(Jt.inside&&Jt.obstacle){const X=Jt.obstacle;if(rt){const $=tt(B,L,C,X,!0);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:B.x,y:$.y}]}else{const $=tt(B,L,C,X,!1);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:$.x,y:B.y}]}}if(yt.length===0&&Dt.length===0){const X=be,$=Math.abs(z.x-Y.x)1||bt>1,Nt=S.get(b.start??"")??0,ut=S.get(b.end??"")??0,Yt=Ct>1&&kt(b.start,U)||bt>1&&kt(b.end,q),ee=Ct<=1||Nt<=2,Bt=bt<=1||ut<=2;if(($||K)&&!lt&&(!Et||Et&&!Yt&&ee&&Bt)&&!T(w,B,b.start,b.end)){b.points=[{...w},{...z},{...Y},{...B}],y.add(h);const Mt=K?"horizontal":"vertical",$t=K?w.y:w.x,It=K?Math.min(w.x,B.x):Math.min(w.y,B.y),St=K?Math.max(w.x,B.x):Math.max(w.y,B.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${h}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};p.push({edgeIndex:h,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}const gn=x("vertical",z.x,z.y,z.y);z.x=gn.coord;const mr=x("vertical",Y.x,Y.y,Y.y);Y.x=mr.coord;let ue=Math.min(z.x,Y.x)-50,he=Math.max(z.x,Y.x)+50,ve=Math.min(z.y,Y.y)-50,Le=Math.max(z.y,Y.y)+50;for(const X of g){const $=Math.min(z.x,Y.x),K=Math.max(z.x,Y.x),lt=Math.min(z.y,Y.y),Ct=Math.max(z.y,Y.y);X.minX$&&X.minYlt&&(ue=Math.min(ue,X.minX-je),he=Math.max(he,X.maxX+je),ve=Math.min(ve,X.minY-je),Le=Math.max(Le,X.maxY+je))}for(const X of g){if(X.maxXhe||X.maxYLe)continue;const $=be;x("horizontal",X.minY-$,ue,he),x("horizontal",X.maxY+$,ue,he);const K=Te;x("vertical",X.minX-K,ve,Le),x("vertical",X.maxX+K,ve,Le)}x("horizontal",z.y,ue,he),x("horizontal",Y.y,ue,he);const yr=c.filter(X=>X.orientation==="horizontal"&&X.coord>=ve&&X.coord<=Le),xr=c.filter(X=>X.orientation==="vertical"&&X.coord>=ue&&X.coord<=he),ke=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),_e=ke(z.x,z.y),vo=ke(Y.x,Y.y),Fe=new Map,pn=new Map,mn=new Map,De=new Set,xe=[];Fe.set(_e,0),mn.set(_e,"n"),xe.push({key:_e,f:Math.hypot(Y.x-z.x,Y.y-z.y),pt:z}),De.add(_e);let Ht=[];const ge=d((X,$)=>T(X,$,b.start,b.end),"checkSegmentBlocked"),yn={x:Y.x,y:z.y},br=ge(z,yn),Mr=ge(yn,Y),Ir=br||Mr,xn={x:z.x,y:Y.y},Sr=ge(z,xn),Cr=ge(xn,Y);if(Ir?Sr||Cr||(Math.abs(z.x-Y.x)0;){xe.sort((ut,Yt)=>ut.f-Yt.f);const X=xe.shift();if(De.delete(X.key),X.key===vo){let ut=vo,Yt=Y;for(Ht=[Yt];pn.has(ut);){const ee=pn.get(ut);Ht.unshift(ee),Yt=ee,ut=ke(ee.x,ee.y)}break}const $=X.pt.x,K=X.pt.y,lt=xr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-$)<1),bt=yr.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct0&&Nt.push({x:$,y:bt[Et-1].coord}),Et>=0&&EtZt.nodeId===b.start||Zt.nodeId===b.end?!1:Yt!==ee?Zt.minYK&&Zt.maxX>Yt&&Zt.minX$&&Zt.maxY>Bt&&Zt.minY10&&bn<-5||Ee<-10&&bn>5)&&(St=Math.abs(bn)*100),(Wt>10&&He<-5||Wt<-10&&He>5)&&(St+=Math.abs(He)*50);let Lo=0;const Eo=mn.get(X.key)??"n",To=Math.abs(He)>ct?"h":"v";Eo!=="n"&&Eo!==To&&(Lo=50);const vr=$t+It+St+Lo,Xe=(Fe.get(X.key)??1/0)+vr,wo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(Xe<(Fe.get(Mt)??1/0))if(pn.set(Mt,X.pt),Fe.set(Mt,Xe),mn.set(Mt,To),!De.has(Mt))xe.push({key:Mt,f:Xe+wo,pt:ut}),De.add(Mt);else{const Zt=xe.findIndex(Lr=>Lr.key===Mt);Zt!==-1&&(xe[Zt].f=Xe+wo)}}}if(Ht.length===0&&(Ht=[z,{x:z.x,y:Y.y},Y]),Ht.length>4){const X=Ht[0],$=Ht[Ht.length-1];let K=Math.min(X.x,$.x),lt=Math.max(X.x,$.x),Ct=Math.min(X.y,$.y),bt=Math.max(X.y,$.y);for(const Bt of Ht)K=Math.min(K,Bt.x),lt=Math.max(lt,Bt.x),Ct=Math.min(Ct,Bt.y),bt=Math.max(bt,Bt.y);const Et=lt>Math.max(X.x,$.x),Nt=KIt.minXGt&&It.minYOt);if($t.length>0){let It=Math.max(X.x,$.x);for(const St of $t){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Ee=Wt+St.visualXHalfExtent+Bt;It=Math.max(It,Ee)}isNaN(It)||(lt=It)}}if(Nt){const Gt=g.filter(Ot=>Ot.minXMath.min(X.y,$.y));if(Gt.length>0){let Ot=Math.min(X.x,$.x);for(const Mt of Gt){const It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Bt;Ot=Math.min(Ot,It)}K=Ot}}}const ut=d(Bt=>{const Gt=$.y>X.y,Ot=g.filter(It=>{const St=Math.min(X.x,$.x)It.minX,Wt=Math.min(X.y,$.y)It.minY;return St&&Wt});let Mt=Ot;if(a&&Ot.length>0){const It=Ot.filter(St=>St.minXBt);It.length>0&&(Mt=It)}if(Mt.length===0)return $.y;const $t=be;if(Gt){const St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<$.y-ct)return St}else{const St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>$.y+ct)return St}return $.y},"findBestReturnY"),Yt=d(Bt=>{const Gt=ut(Bt),Ot={x:Bt,y:X.y},Mt={x:Bt,y:Gt},$t={x:$.x,y:Gt},It=ge(X,Ot),St=ge(Ot,Mt),Wt=ge(Mt,$t),Ee=Gt!==$.y?ge($t,$):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-$.y)=3){const X=Xt[Xt.length-1],$=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-$.y)Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign($.y-K.y),Et=Math.sign(X.y-K.y);bt!==0&&bt===Et&&Math.abs($.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const ie=[Xt[0]];for(let X=1;X$.x,bt=lt.x>K.x;if(Ct!==bt){ie.push(K);continue}continue}if(Math.abs($.x-K.x)$.y,bt=lt.y>K.y;if(Ct!==bt){ie.push(K);continue}continue}ie.push(K)}ie.push(Xt[Xt.length-1]);for(let X=0;Xh.from{const w=!L.segments.some(U=>(U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex)&&W(U,h)),B=!C.segments.some(U=>(U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex)&&W(U,b));return w&&B?(h.trackIndex=L.index,b.trackIndex=C.index,C.segments=[...C.segments.filter(U=>U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex),{edgeIndex:b.edgeIndex,segmentIndex:b.segmentIndex,from:b.from,to:b.to}],L.segments=[...L.segments.filter(U=>U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex),{edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=d(h=>{const b=h.tracks.length;return h.tracks[b]={index:b,coord:h.coord,segments:[]},b},"createNewTrack"),gt=d((h,b)=>{const C=h.pipe.tracks[h.trackIndex];C.segments=C.segments.filter(w=>w.edgeIndex!==h.edgeIndex||w.segmentIndex!==h.segmentIndex),h.trackIndex=b,h.pipe.tracks[b].segments.push({edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to})},"moveSegmentToTrack"),xt=d((h,b)=>{const C=f[h.edgeIndex];for(const L of C){const w=p[L];w.pipe===h.pipe&>(w,b)}},"moveSegmentChainToTrack"),vt=d(h=>{const b=f[h.edgeIndex],C=b.indexOf(p.indexOf(h)),L=[];return C>0&&L.push(p[b[C-1]]),C{if(h.orientation===b.orientation)return!1;const C=h.orientation==="horizontal"?h:b,L=h.orientation==="horizontal"?b:h;return L.pipe.coord>C.from&&L.pipe.coordL.from&&C.pipe.coord{for(const C of h.tracks)if(!C.segments.some(w=>(w.edgeIndex!==b.edgeIndex||w.segmentIndex!==b.segmentIndex)&&W(w,b)))return C.index;return-1},"findAvailableTrack"),Ut=d((h,b)=>{if(h.trackIndex===b.trackIndex)return W(h,b);const C=vt(h),L=vt(b);return C.some(w=>L.some(B=>Vt(w,B)))},"segmentsConflict"),te=d((h,b,C)=>{if(et(h,b,h.pipe.tracks[h.trackIndex],b.pipe.tracks[b.trackIndex]))return;const L=jt(h.pipe,b);C(b,L!==-1?L:at(h.pipe))},"resolveTrackConflict"),Se=d(h=>{let b=0;for(let C=0;C{if(de.has(h))return de.get(h);const b=f[h];if(b.length===0){const q={dest:0,deviation:0,base:0,delta:0};return de.set(h,q),q}const L=p[b[0]].pipe.coord;let w=L;for(let q=1;qMath.abs(ot-L)?Y:ot;break}}const B=Math.abs(w-L),U={dest:w,deviation:B,base:L,delta:w-L};return de.set(h,U),U},"getDestInfo"),dn=d(()=>{let h=0;const b=new Map;for(const[L,w]of s.entries())f[L].length!==0&&w.start&&(b.has(w.start)||b.set(w.start,[]),b.get(w.start).push(L));const C=d(L=>{const w=s[L];if(!w.start||!w.end)return 0;const B=r.get(w.start),U=r.get(w.end);if(!B||!U)return 0;const q=(U.x??0)-(B.x??0),z=(U.y??0)-(B.y??0);return Math.abs(q)+Math.abs(z)},"getEdgeDistance");for(const L of b.values()){L.sort((B,U)=>{const q=Ce(B),z=Ce(U);if(Math.abs(q.deviation-z.deviation)>1)return q.deviation-z.deviation;if(Math.abs(q.dest-z.dest)>1)return q.dest-z.dest;const Y=C(B),ot=C(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=f[B].length,st=f[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=f[B][0],yt=f[U][0];if(p[tt]&&p[yt]){const Rt=p[tt],Lt=p[yt],Dt=Math.abs(Rt.to-Rt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});const w=L.map(B=>p[f[B][0]]);h+=Se(w)}return h},"fixSourceHandleCrossings"),un=d(()=>{let h=0;const b=new Map;for(const[C,L]of s.entries())f[C].length!==0&&L.end&&(b.has(L.end)||b.set(L.end,[]),b.get(L.end).push(C));for(const C of b.values()){C.sort((w,B)=>{const U=d(Y=>{const ot=f[Y];if(ot.length<2)return 0;const rt=p[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(w),z=U(B);return Math.abs(q-z)>.1?q-z:w-B});const L=C.map(w=>p[f[w][f[w].length-1]]);h+=Se(L)}return h},"fixTargetHandleCrossings"),hn=d(()=>{let h=0;for(const b of c){const C=[];for(const L of b.tracks)for(const w of L.segments){const B=f[w.edgeIndex].find(U=>p[U].segmentIndex===w.segmentIndex);B!==void 0&&C.push(p[B])}C.sort((L,w)=>L.edgeIndex-w.edgeIndex||L.segmentIndex-w.segmentIndex);for(let L=0;L{L.segments.forEach(w=>{b.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:L.index,from:w.from,to:w.to})})}),b.sort((L,w)=>L.from-w.from);const C=[];if(b.length>0){let L=[b[0]],w=b[0].to;for(let B=1;Bw.add(tt.trackIndex));const B=new Map;L.forEach(tt=>{const yt=Ce(tt.edgeIndex);B.set(tt.trackIndex,(B.get(tt.trackIndex)??0)+yt.delta)});const U=[...w].filter(tt=>(B.get(tt)??0)<-1),q=[...w].filter(tt=>(B.get(tt)??0)>1),z=[...w].filter(tt=>Math.abs(B.get(tt)??0)<=1);U.sort((tt,yt)=>(B.get(yt)??0)-(B.get(tt)??0)),q.sort((tt,yt)=>(B.get(tt)??0)-(B.get(yt)??0));const Y=d((tt,yt)=>{L.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?h.coord:yt;D.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,h.coord-ot*Cn);if(z.length===0&&w.size>0){const tt=[...w].sort((Lt,Dt)=>Math.abs(B.get(Lt)??0)-Math.abs(B.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),z.push(tt)}let rt=0;for(const tt of z){if(rt===0)Y(tt,h.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,h.coord+yt*Rt*Cn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,h.coord+st*Cn)}}for(const[h,b]of s.entries()){const C=f[h]??[];if(C.length===0)continue;const L=[],w=r.get(b.start),B=r.get(b.end),{pSrcPort:U,pDstPort:q}=Q(h,w,B),z=C.map(rt=>{const st=p[rt],tt=D.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});L.push(U);for(let rt=0;rtct&&L.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Jt=st.orient==="vertical"?(yt+Lt.from)/2:no(st,Lt);L.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===z.length-2)&&L.push(Me(st,no(st,Lt)));else if(Dt)L.push(Me(st,Lt.coord));else{const Jt=Math.abs(st.from-yt)ct||Math.abs(Y.y-q.y)>ct)&&L.push(q);const ot=[];L.length>0&&ot.push(L[0]);for(let rt=1;rtct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}b.points=ot}for(const h of s){const b=h.__originalEdge;b&&h.points&&(b.points=h.points)}t.edges=(t.edges??[]).filter(h=>!h.isLayoutOnly);const V=d((h,b)=>{const C=b.x??0,L=b.y??0,w=b.width??0,B=b.height??0;if(w<=0||B<=0)return h;const U=C-w/2,q=C+w/2,z=L-B/2,Y=L+B/2;if(h.xq||h.yY)return h;const ot=h.x-U,rt=q-h.x,st=h.y-z,tt=Y-h.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:h.y}:yt===rt?{x:q,y:h.y}:yt===st?{x:h.x,y:z}:{x:h.x,y:Y}},"nodeBoundaryClamp");for(const h of t.edges){const b=h.points;if(!b||b.length<2)continue;const C=h.start,L=h.end,w=C?r.get(C):void 0,B=L?r.get(L):void 0;w&&(b[0]=V(b[0],w)),B&&(b[b.length-1]=V(b[b.length-1],B))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function pr(t){const e=Jo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,c=gr(t),{ordered:a,coordinates:l}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:c});Zo(e,a,l,{nodeGap:n,layerGap:o});for(const g of t.edges??[])delete g.points;hr(t,c);for(const g of t.edges??[])(!g.curve||g.curve==="basis")&&(g.curve="rounded");return Rs(t,c),As(t),c}d(pr,"runSwimlaneLayoutCore");async function Qr(t,e){const n=e.select("g");wr(n,t.markers,t.type,t.diagramId),Ar(),Rr(),Nr(),Tr(),qo(t);const o=Qo(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await _o(n,t);pr(t),await Uo(t,s)}d(Qr,"render");export{Qr as render}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/sizeCapture-X5ZJPWSS-CUFKXLd6.js","assets/mermaid.core-CsZwh_jB.js","assets/index-Bxn5yOTB.js","assets/index-DGHD7Bg9.css","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]); +import{bR as Er}from"./index-Bxn5yOTB.js";import{c as Tr}from"./chunk-RYQCIY6F-Dm138b37.js";import{am as wr,an as Ar,ao as Rr,ap as Nr,l as Ke,c as Or,ag as Pr,af as Br,ah as kr,at as _r,av as Fr,z as Dr,as as Hr,aw as Xr,y as Oe,ax as Ye,_ as d,ay as Ao}from"./mermaid.core-CsZwh_jB.js";import{G as Yr}from"./graph-DOmOIIwC.js";import"./map-DxJ2ADlA.js";import"./_commonjsHelpers-CqkleIqs.js";async function _o(t,e){const n=new Yr({multigraph:!0,compound:!0}),o=[...e.edges],s=Or(),r=t.insert("g").attr("class","root"),i=r.insert("g").attr("class","clusters"),c=r.insert("g").attr("class","edges edgePath"),a=r.insert("g").attr("class","edgeLabels"),l=r.insert("g").attr("class","nodes"),g=new Map,x=t.node()!=null;await Promise.all(e.nodes.map(async I=>{if(I.isGroup)n.setNode(I.id,{...I});else{if(x){const u=await Pr(l,I,{config:s,dir:I.dir}),p=u.node()?.getBBox()??{width:0,height:0};g.set(I.id,u),I.width=p.width,I.height=p.height}n.setNode(I.id,{...I})}}));for(const I of o)n.setEdge(I.start,I.end,{...I},I.id),e.edges.some(p=>p.id===I.id)||e.edges.push(I);if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:I}=await Er(async()=>{const{captureNodeSizes:u}=await import("./sizeCapture-X5ZJPWSS-CUFKXLd6.js");return{captureNodeSizes:u}},__vite__mapDeps([0,1,2,3,4]));I(t,e)}return{graph:n,groups:{clusters:i,edgePaths:c,edgeLabels:a,nodes:l,rootGroups:r},nodeElements:g}}d(_o,"createGraphWithElements");var Ro=5,Ge=1e-5,$e=1e-6;function qe(t){const e=[];for(let n=0;n=1-$e||I<=$e||I>=1-$e?null:{point:{x:t.x+x*s,y:t.y+x*r},tA:x,tB:I}}d(Fo,"segmentIntersection");function vn(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}d(vn,"isHorizontalSeg");function Do(t){const e=[];for(let n=0;n=Math.abs(n)?e>=0?1:0:n>=0?1:0}d(Ho,"getArcSweepFlag");var Gr=.001;function Xo(t,e){if(t.length<2)return t.map(r=>({...r}));const n=t.map(r=>({...r})),o=e.arrowTypeStart&&Ao[e.arrowTypeStart];if(o){const r=t[0],i=t[1],c=Math.atan2(i.y-r.y,i.x-r.x);n[0].x=r.x+o*Math.cos(c),n[0].y=r.y+o*Math.sin(c)}const s=e.arrowTypeEnd&&Ao[e.arrowTypeEnd];if(s){const r=t.length,i=t[r-2],c=t[r-1],a=Math.atan2(c.y-i.y,c.x-i.x);n[r-1].x=c.x-s*Math.cos(a),n[r-1].y=c.y-s*Math.sin(a)}return n}d(Xo,"applyMarkerOffsets");function Yo(t,e,n,o,s){const r=t.point.x,i=t.point.y,c={x:r-e*t.r,y:i-n*t.r},a={x:r+e*t.r,y:i+n*t.r},l=[`L${we(c)}`];return s==="arc"?l.push(`A${re(t.r)},${re(t.r)} 0 0 ${o} ${we(a)}`):l.push(`M${we(a)}`),l}d(Yo,"emitJump");function Ln(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=n.x-e.x,c=n.y-e.y,a=Math.hypot(s,r),l=Math.hypot(i,c);if(a0){const E=Ln(s[l-1],s[l],s[l+1]??s[l],Ro);E&&(f=E.cutLen)}let y=x,v=null;r&&lE.t-T.t);for(const E of M)E.r=Math.min(E.r,E.d-f,y-E.d);for(let E=0;ET){const m=T/2;M[E].r=Math.min(M[E].r,m),M[E+1].r=Math.min(M[E+1].r,m)}}for(const E of M)E.r=2?o:null}catch{return null}}d(Vo,"decodeDataPoints");function jo(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const s=new Map;for(const l of e)s.set(l.id,l);const r=[],i=new Map;for(const l of e){const g=typeof CSS<"u"&&CSS.escape?CSS.escape(l.id):l.id,x=o.querySelector(`path[data-id="${g}"]`);if(!x)continue;i.set(l.id,x);const u=Vo(x.getAttribute("data-points"))??l.points;r.push({...l,points:u})}const c=Do(r);if(c.length===0)return;const a=new Map;for(const l of c){const g=a.get(l.jumpEdgeId)??[];g.push(l),a.set(l.jumpEdgeId,g)}for(const l of r){const g=a.get(l.id);if(!g||g.length===0)continue;const I=s.get(l.id)?.curve;if(I!==void 0&&!zo(I))continue;const u=i.get(l.id);if(!u)continue;if(I===void 0){const E=u.getAttribute("d")??"";if(!$o(E))continue}const p=u.getAttribute("style")??"",f=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(p),y=f?Number.parseFloat(f[1]):null,v=f?Number.parseFloat(f[2]):null,M=Go(l,g,n);if(u.setAttribute("d",M),y!==null&&v!==null&&typeof u.getTotalLength=="function"){const E=u.getTotalLength(),T=Math.max(0,E-y-v),m=`0 ${y} ${T} ${v}`,S=p.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${m};`).replace(/;\s*;+/g,";");u.setAttribute("style",S)}}}d(jo,"applyLineJumpsToSvg");async function Uo(t,e){for(const s of t.nodes)s.isGroup?await Br(e.clusters,s):kr(s);const n=new Map;for(const s of t.nodes)s?.id&&n.set(s.id,s);for(const s of t.edges){const r=s.start?n.get(s.start)??{}:{},i=s.end?n.get(s.end)??{}:{},c=_r(e.edgePaths,{...s},{},t.type,r,i,t.diagramId);s.label&&await Fr(e.rootGroups,s),s.label&&Wo(s,c)}const o=t.config?.swimlane?.lineHops;if(o!==!1){const s=o==="gap"?"gap":"arc",r=t.edges.filter(i=>Array.isArray(i.points)&&i.points.length>=2).map(i=>({id:i.id,points:i.points,curve:i.curve,arrowTypeStart:i.arrowTypeStart,arrowTypeEnd:i.arrowTypeEnd}));jo(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:s})}}d(Uo,"adjustLayout");function Wo(t,e){const n=e?.updatedPath??e?.originalPath,o=Dr(),{subGraphTitleTotalMargin:s}=Hr({flowchart:o.flowchart??{}});if(t.label){const r=Xr.get(t.id);let i=t.x,c=t.y;if(n){const a=Oe.calcLabelPosition(n);Ke.debug("Moving label "+t.label+" from (",i,",",c,") to (",a.x,",",a.y,") abc88"),e&&(i=a.x,c=a.y)}r.attr("transform",`translate(${i}, ${c+s/2})`)}if(t?.startLabelLeft){const r=Ye.get(t.id).startLeft;let i=t?.x,c=t?.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.startLabelRight){const r=Ye.get(t.id).startRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelLeft){const r=Ye.get(t.id).endLeft;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}if(t.endLabelRight){const r=Ye.get(t.id).endRight;let i=t.x,c=t.y;if(n){const a=Oe.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);i=a.x,c=a.y}r.attr("transform",`translate(${i}, ${c})`)}}d(Wo,"positionEdgeLabel");var Mn="__swimlane_default__",$r=21,No=20;function En(t){return Math.max(t.padding??No,No)}d(En,"topLaneHorizontalPadding");function Ko(t){const{x:e,y:n,width:o,height:s}=t,r=t.swimlaneContentTop;if(typeof e!="number"||typeof n!="number"||typeof o!="number"||typeof s!="number"||typeof r!="number"||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(r)||o<=0||s<=0){delete t.groupTitleRect;return}const i=n-s/2,c=Math.min(r,n+s/2),a=Math.min($r,Math.max(0,c-i)),l=i+a;if(l<=i){delete t.groupTitleRect;return}t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:l}}d(Ko,"assignTopLaneTitleRect");function qo(t){const e=t.direction,n=t.nodes??=[];for(const r of t.nodes??[])r.isGroup&&!r.parentId&&(r.shape="swimlane",e&&(r.direction=e));const o=n.filter(r=>!r.isGroup&&!r.parentId);if(o.length===0)return;let s=n.find(r=>r.id===Mn);s?s.isGroup&&(s.shape="swimlane",e&&(s.direction=e)):(s={id:Mn,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(s));for(const r of o)r.parentId=Mn}d(qo,"prepareLayoutForSwimlanes");function Jo(t){const e=new Map;for(const a of t.nodes??[])e.set(a.id,a);const n=[];for(const a of t.edges??[]){const l=typeof a.start=="string"?a.start:void 0,g=typeof a.end=="string"?a.end:void 0;!l||!g||a.labelNodeId||n.push({id:a.id,src:l,dst:g,ref:a})}const o=t.nodes??[],s=o.filter(a=>a.isGroup),r=o.filter(a=>!a.isGroup);return{nodes:[...[...s].reverse(),...r].map(a=>a.id),edges:n,layout:t,nodeById:e}}d(Jo,"toGraphView");function Zo(t,e,n,o){const{layout:s}=t,r=t.nodeById,i=o?.layerGap??100,c=o?.nodeGap??40;let a=0;for(const I of e.layers){let u=0;for(const p of I){const f=r.get(p);if(!f){u++;continue}f.layer=a,f.order=u;const y=n.x[p]??u*c,v=n.y[p]??a*i;f.x=y,f.y=v,u++}a++}const l=s.nodes??[],g=new Map,x=[];for(const I of l){if(!I?.isGroup)continue;I.parentId||x.push(I);const u=l.filter(M=>M.parentId===I.id);let p=1/0,f=-1/0,y=1/0,v=-1/0;for(const M of u){const E=M.x??n.x[M.id],T=M.y??n.y[M.id],m=M.width??0,S=M.height??0;E!=null&&T!=null&&(p=Math.min(p,E-m/2),f=Math.max(f,E+m/2),y=Math.min(y,T-S/2),v=Math.max(v,T+S/2))}if(p===1/0||y===1/0)I.x=I.x??0,I.y=I.y??0,I.width=I.width??0,I.height=I.height??0;else{const M=I.padding??20,E=I.parentId?M:2*En(I),T=M,m=Math.max(0,f-p)+E,S=Math.max(0,v-y)+T,A=(p+f)/2,R=(y+v)/2;I.x=A,I.y=R,I.width=m,I.height=S,g.set(I.id,{minX:p,maxX:f,minY:y,maxY:v})}}if(x.length>0&&g.size>0){let I=1/0,u=-1/0,p=0;for(const f of x){const y=f.padding??20;y>p&&(p=y);const v=g.get(f.id);v&&(I=Math.min(I,v.minY),u=Math.max(u,v.maxY))}if(I!==1/0&&u!==-1/0){const f=Math.max(0,u-I),v=Math.max(p,36),M=f+2*v,E=(I+u)/2;for(const k of x)k.y=E,k.height=M,k.swimlaneContentTop=I;const T=[...x].sort((k,O)=>{const _=k.x??0,H=O.x??0;return _-H}),m=[],S=[],A=[];for(const k of T){const O=g.get(k.id);if(!O)continue;const _=Math.max(0,O.maxX-O.minX)+2*En(k),H=(O.minX+O.maxX)/2;m.push(k.id),S.push(H),A.push(_)}const R=m.length;if(R>0){const k=new Map;if(R===1)k.set(m[0],A[0]);else{const O=[];for(let j=0;j0&&s>0?{cx:e,cy:n,rect:Ae(e,n,o,s)}:void 0}d(oo,"measuredNodeRect");function so(t){if(t.isGroup)return;const e=oo(t);return e?{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}:void 0}d(so,"nodeBoundsInfoFor");function oe(t,e,n=Ft){return Math.abs(t.x-e.x)n}d(Tt,"isHorizontalSegment");function wt(t,e,n=Ft){return ft(t,e,n)&&Math.abs(t.y-e.y)>n}d(wt,"isVerticalSegment");function zt(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}d(zt,"overlapLength");function ce(t,e,n=Ft){return t.horizontal&&e.horizontal&&ht(t.a,e.a,n)?zt(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&ft(t.a,e.a,n)?zt(t.a.y,t.b.y,e.a.y,e.b.y):0}d(ce,"sameAxisSegmentOverlapLength");function Re(t,e=Ft){const n=[];for(let o=0;o0?n[n.length-1]:void 0;(!s||!oe(s,o,e))&&n.push({x:o.x,y:o.y})}return n}d(pt,"dedupeConsecutivePoints");function ro(t,e=Ft){if(!t||t.length!==4)return;const[n,o,s,r]=t;return Tt(n,o,e)&&wt(o,s,e)&&Tt(s,r,e)?{kind:"HVH",p0:n,p1:o,p2:s,p3:r}:wt(n,o,e)&&Tt(o,s,e)&&wt(s,r,e)?{kind:"VHV",p0:n,p1:o,p2:s,p3:r}:void 0}d(ro,"classifyThreeSegmentRoute");function cn(t,e,n,o=0){const s=Math.min(t.x,e.x),r=Math.max(t.x,e.x),i=Math.min(t.y,e.y),c=Math.max(t.y,e.y);return r>n.left-o&&sn.top-o&&ie.left+n&&t.xe.top+n&&t.y=e.right&&t.top<=e.top&&t.bottom>=e.bottom}d(ts,"rectContainsRect");function Je(t,e){return t.lefte.left&&t.tope.top}d(Je,"rectsOverlap");function Tn(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}d(Tn,"inflateRect");function Ae(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}d(Ae,"rectFromCenterSize");function qt(t){return oo(t)?.rect}d(qt,"rectOfNodeBounds");function Ie(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}d(Ie,"portForRectSide");function co(t,e,n,o,s,r=Ft){const i=e==="left"||e==="right",c=o==="left"||o==="right";if(i&&c){if(e==="right"&&o==="left"&&t.xn.x){if(ht(t,n,r))return[t,n];const x=(t.x+n.x)/2;return[t,{x,y:t.y},{x,y:n.y},n]}if(e===o){if(ht(t,n,r))return;const x=e==="left"?Math.min(t.x,n.x)-s:Math.max(t.x,n.x)+s;return[t,{x,y:t.y},{x,y:n.y},n]}return}if(!i&&!c){if(e===o){if(ft(t,n,r))return;const I=e==="top"?Math.min(t.y,n.y)-s:Math.max(t.y,n.y)+s;return[t,{x:t.x,y:I},{x:n.x,y:I},n]}if(!(e==="bottom"&&o==="top"&&t.yn.y))return;if(ft(t,n,r))return[t,n];const x=(t.y+n.y)/2;return[t,{x:t.x,y:x},{x:n.x,y:x},n]}if(i&&!c){const g=e==="right"&&n.x>t.x||e==="left"&&n.xn.y;return g&&x?[t,{x:n.x,y:t.y},n]:void 0}const a=e==="bottom"&&n.y>t.y||e==="top"&&n.yn.x;return a&&l?[t,{x:t.x,y:n.y},n]:void 0}d(co,"buildOrthogonalPortPath");function ao(t,e,n,o){return e==="left"||e==="right"?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}d(ao,"buildSameSideTrackPath");function an(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const s=so(o);s&&(e.set(s.id,s),n.push({id:s.id,rect:s.rect}))}return{nodeInfoById:e,realNodeRects:n}}d(an,"collectRealNodeBounds");function me(t){const e=[],n=[];for(const o of t){const s=so(o);if(!s)continue;const r={id:s.id,rect:s.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}d(me,"collectNodeRectEntries");function es(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const s=o.x??0,r=o.y??0,i=o.width??0,c=o.height??0;n.push({nodeId:o.id,...Ae(s,r,i,c)})}return n}d(es,"collectLayoutNodeRects");function lo(t,e,n=Ft){const o=t.start,s=t.end;if(!o||!s)return;const r=e.get(o),i=e.get(s);if(!(!r||!i))return{srcId:o,dstId:s,srcInfo:r,dstInfo:i,collinearX:Math.abs(r.cx-i.cx)p||Iv)return!1;const M=Math.abs(f-g.a.x)s:r&&c&&ht(t,n,s)?zt(t.x,e.x,n.x,o.x)>s:!1}d(ns,"sameAxisSegmentsOverlap");function Ze(t,e,n,o,{epsilon:s=Ft,skipDegenerateOther:r=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const c=i.points;if(!(!c||c.length<2))for(let a=0;aI+s&&pf+s&&xo+Ft&&t=2?e[e.length-2]:void 0,a=(i?ft(i,s):!1)?{x:s.x,y:r.y}:{x:r.x,y:s.y};e.push(a)}e.push(r)}const n=[];for(const o of e){const s=n[n.length-1];(!s||!oe(s,o))&&n.push(o)}return n}d(Qe,"orthogonalizePolyline");function ae(t){if(t.length<3)return t;let e=[...t];for(let n=0;n<32;n++){const o=ss(e);if(e=o.points,!o.changed)break}return e}d(ae,"simplifyPolyline");var nt=.001,Vr=.5,Oo=4;function uo(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length=0&&s=t.length)return t;const r=s-o;if(r<0||r>=t.length)return t;const i=rs(t[s],t[r],e);return n?[i,...t.slice(s)]:[...t.slice(0,s+1),i]}d(An,"clipEndpoint");function is(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;let s=[...o.points];o.srcRect&&(s=An(s,o.srcRect,!0)),o.dstRect&&(s=An(s,o.dstRect,!1)),s=ae(Qe(s)),s=ho(s,o.srcRect,o.dstRect),o.edge.points=ae(Qe(s))}}d(is,"clipEdgeEndpointsToNodeBoundaries");function Rn(t,e,n,o=!1){if(ht(t,e,nt)){if(e.yn.bottom+nt)return e;if(o){if(t.xn.right+nt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(ft(t,e,nt)){if(e.xn.right+nt)return e;if(o){if(t.yn.bottom+nt)return{x:t.x,y:n.bottom}}const s=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:s?n.top:n.bottom}}return e}d(Rn,"snapEndpointToBoundary");function tn(t,e,n){const o=t[e];for(let s=e+n;s>=0&&so.lo)),n=Math.min(...t.map(o=>o.hi));if(!(e>n))return{lo:e,hi:n}}d(cs,"intersectRanges");function On(t,e){return e==="left"||e==="right"?en(t.top,t.bottom):en(t.left,t.right)}d(On,"clearanceRangeForSide");function nn(t,e,n){const o=t.y>=n.top-nt&&t.y<=n.bottom+nt,s=t.x>=n.left-nt&&t.x<=n.right+nt;if(ht(t,e,nt)&&o){if(Math.abs(t.x-n.left)0?cs(r):void 0}d(as,"straightClearanceRange");function Pn(t,e,n,o,s){const r=as(t,e,n,o,s);if(!r)return;const i=s?t.y:t.x,c=Math.min(r.hi,Math.max(r.lo,i));if(!(Math.abs(c-i)({...c}));for(let c=e;c>=0&&c=n.left-nt&&Math.max(t.x,e.x)<=n.right+nt,s=Math.min(t.y,e.y)>=n.top-nt&&Math.max(t.y,e.y)<=n.bottom+nt;if(Math.abs(t.y-n.top)o.bottom+nt;case"left":return ht(e,n,nt)&&n.xo.right+nt}}d(_n,"leavesOutward");function Fn(t,e,n){if(t.length<3)return t;if(n){const r=kn(t[0],t[1],e);return r&&_n(r,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,s=kn(t[o-1],t[o],e);return s&&_n(s,t[o-1],t[o-2],e)?t.slice(0,o):t}d(Fn,"collapseOwnBorderStub");function ds(t,e,n){let o=t;if(e){const r=tn(o,0,1);if(r){const i=Rn(r,o[0],e);i!==o[0]&&(o=[i,...o.slice(1)])}o=Fn(o,e,!0)}if(n){const r=o.length-1,i=tn(o,r,-1);if(i){const c=Rn(i,o[r],n,!0);c!==o[r]&&(o=[...o.slice(0,r),c])}o=Fn(o,n,!1)}const s=ho(o,e,n);return s!==o||o.length===2?s:(e&&(o=Bn(o,e,!0)),n&&(o=Bn(o,n,!1)),o)}d(ds,"snapAndCollapseEndpoints");function Dn(t,e){for(const n of t){const o=uo(n,e,2);if(!o)continue;const s=pt(o.points,nt),r=ds(s,o.srcRect,o.dstRect);if(r.length<3){o.edge.points=r;continue}const i=[r[0],{...r[0]},...r.slice(1,-1),r[r.length-1],{...r[r.length-1]}];o.edge.points=i}}d(Dn,"prepareEdgeEndpointsForRenderer");function go(t){return new Map(t.map(e=>[e.id,e]))}d(go,"buildNodeMap");function us(t,e){let n=t.parentId,o=null;for(;n;){const s=e.get(n);if(!s?.isGroup)break;o=s.id,n=s.parentId}return o}d(us,"resolveTopLevelGroupId");function Hn(t,e){let n=0,o=t.parentId;for(;o;){const s=e.get(o);if(!s?.isGroup)break;n++,o=s.parentId}return n}d(Hn,"groupDepth");function po(t){let e=1/0,n=-1/0,o=1/0,s=-1/0;for(const r of t){const i=r.x,c=r.y;if(typeof i!="number"||typeof c!="number")continue;const a=r.width??0,l=r.height??0;e=Math.min(e,i-a/2),n=Math.max(n,i+a/2),o=Math.min(o,c-l/2),s=Math.max(s,c+l/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:s}}d(po,"boundsForChildren");function hs(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}d(hs,"applyGroupBounds");function gs(t){const e=go(t),n=t.filter(o=>o.isGroup&&o.parentId).sort((o,s)=>Hn(s,e)-Hn(o,e));for(const o of n){const s=t.filter(i=>i.parentId===o.id),r=po(s);r&&hs(o,r)}}d(gs,"recomputeNestedGroupBounds");function on(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(a=>!a.isGroup);let r=1/0,i=-1/0;for(const a of s){const l=a[e];typeof l=="number"&&(r=Math.min(r,l),i=Math.max(i,l))}if(!Number.isFinite(r)||!Number.isFinite(i))return!1;const c=d(a=>r+i-a,"mirror");for(const a of n){const l=a[e];typeof l=="number"&&(a[e]=c(l));const g=a.groupTitleRect;g&&(a.groupTitleRect=e==="x"?{...g,left:c(g.right),right:c(g.left)}:{...g,top:c(g.bottom),bottom:c(g.top)})}for(const a of o)for(const l of a.points??[])l[e]=c(l[e]);return!0}d(on,"mirrorAxis");function ps(t){return(t.nodes??[]).some(n=>!n.isGroup)?on(t,"y"):!0}d(ps,"applyBtDirectionTransform");function ms(t,e="LR"){const n=t.nodes??[],o=t.edges??[],s=n.filter(P=>!P.isGroup);let r=1/0,i=1/0;for(const P of s){const G=P.x??0,j=P.y??0;G0?Math.max(1,g/x):1;for(const P of s){const G=P.x??0,J=((P.y??0)-i)*I+c,dt=G-r;P.x=J,P.y=dt}for(const P of o)if(P.points)for(const G of P.points){const j=G.x,dt=(G.y-i)*I+c,mt=j-r;G.x=dt,G.y=mt}gs(n);const u=n.filter(P=>P.isGroup&&!P.parentId);if(u.length===0)return e==="RL"&&on(t,"x"),!0;const p=go(n),f=new Map;for(const P of n){if(P.isGroup)continue;const G=us(P,p);if(!G)continue;const j=f.get(G)??[];j.push(P),f.set(G,j)}let y=0;for(const P of u){const G=P.padding??0;G>y&&(y=G)}const v=[];let M=1/0,E=-1/0;for(const P of u){const G=f.get(P.id)??[],j=po(G);j&&(M=Math.min(M,j.minX),E=Math.max(E,j.maxX),v.push({lane:P,contentTop:j.minY,contentBottom:j.maxY,centerY:(j.minY+j.maxY)/2}))}if(M===1/0||E===-1/0)return!0;const T=Math.max(0,E-M),m=Math.max(y,10),S=T+2*m,A=c+S,O=(M+E)/2-S/2-c,_=O+A/2,H=Math.max(y,c);v.sort((P,G)=>P.centerY-G.centerY);for(let P=0;PI.cy?v.bottom:v.top,H=I.cx+M;if(H<=v.left+se||H>=v.right-se)continue;E={x:H,y:_},T={x:H,y:c.y},m={x:c.x,y:c.y}}else{const _=u.cx>I.cx?v.right:v.left,H=I.cy+M;if(H<=v.top+se||H>=v.bottom-se)continue;E={x:_,y:H},T={x:c.x,y:H},m={x:c.x,y:c.y}}const S=oe(E,T,se),A=oe(T,m,se);if(S&&A||!S&&At(E,T,o,[g],1)||!A&&At(T,m,o,[x],1))continue;const R=!S&&Ze(E,T,t,s,{epsilon:se,skipDegenerateOther:!0}),k=!A&&Ze(T,m,t,s,{epsilon:se,skipDegenerateOther:!0});if(!(R||k)){S?y=[T,m]:A?y=[E,T]:y=[E,T,m];break}}y&&(s.points=y)}}d(ys,"portSwapToLShape");function xs(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values());for(const c of t){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<4)continue;const l=pt(a,.001);if(l.length<4)continue;const g=l.length-1,x=l[g],I=l[g-1],u=l[g-2],p=x.x-I.x,f=x.y-I.y,y=Math.hypot(p,f);if(y>=10||y<.001)continue;const v=I.x-u.x,M=I.y-u.y;if(Math.hypot(v,M)<.001)continue;const T=Tt(I,x,.001),m=wt(I,x,.001),S=Tt(u,I,.001),A=wt(u,I,.001);if(!(T&&A||m&&S))continue;const R=c.end,k=c.start,O=R?e.get(R):void 0;if(!O)continue;const _=O.x??0,H=O.y??0,P=qt(O);if(!P)continue;let G,j;if(A){const W=M<0;G={x:_,y:u.y},j={x:_,y:W?P.bottom:P.top}}else{const W=v>0;G={x:u.x,y:H},j={x:W?P.right:P.left,y:H}}if(At(G,j,r,R?[R]:[],-2)||At(G,j,i,[],-2))continue;if(k){const W=e.get(k),et=W?qt(W):void 0;if(et&&io(G,et,2))continue}const J=d((W,et)=>`${W.x.toFixed(3)},${W.y.toFixed(3)}|${et.x.toFixed(3)},${et.y.toFixed(3)}`,"ownSegmentKey"),dt=new Set;for(let W=0;W{for(const at of t){if(at===c||at.isLayoutOnly)continue;const gt=at.points;if(!(!gt||gt.length<2))for(let xt=0;xt=0){const W=l[g-3],et=[k,R].filter(at=>!!at);if(At(W,G,r,et,-2)||mt(W,G))continue}const Pt=[...l.slice(0,g-2),G,j];c.points=Pt;const Q=c.labelNodeId;if(Q){const W=e.get(Q);if(W){const et=W.width??0,at=W.height??0;if(et>0&&at>0){let gt,xt,vt=-1;for(let Vt=0;Vt=et+2||de&&te>=at+2)&&te>vt&&(vt=te,gt=(jt.x+Ut.x)/2,xt=(jt.y+Ut.y)/2)}gt!==void 0&&xt!==void 0&&(W.x=gt,W.y=xt)}}}}}d(xs,"collapseShortTerminalStub");var Z=.001,_t=8,it=Re,In=d((t,e)=>ft(t,e,Z)||ht(t,e,Z),"orthogonallyAligned");function bs(t,e){const s=d((u,p)=>{const f=u.x??0,y=u.y??0,v=p.x-f,M=p.y-y;let E=(u.width??0)/2,T=(u.height??0)/2;return Math.abs(M)*E>Math.abs(v)*T?(M<0&&(T=-T),{x:f+(M===0?0:T*v/M),y:y+T}):(v<0&&(E=-E),{x:f+E,y:y+(v===0?0:E*M/v)})},"rectIntersect"),r=d((u,p)=>{const f=pt(u.points??[]);if(f.length<2)return;const y=p?u.start:u.end,v=y?e.get(y):void 0,M=v?qt(v):void 0;if(!v||!y||!M)return;const E=p?f[0]:f[f.length-1],T=p?f[1]:f[f.length-2],m=s(v,E);let S=E;if(In(T,m)&&(S=T),ft(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"V",coord:m.x,min:Math.min(m.y,S.y),max:Math.max(m.y,S.y),boundary:m,railEnd:S,rect:M};if(ht(m,S,Z))return{edge:u,edgeId:String(u.id??""),nodeId:y,atStart:p,orientation:"H",coord:m.y,min:Math.min(m.x,S.x),max:Math.max(m.x,S.x),boundary:m,railEnd:S,rect:M}},"terminalLaneFor"),i=d((u,p)=>Math.max(0,Math.min(u.max,p.max)-Math.max(u.min,p.min)),"projectedOverlapLength"),c=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:u.orientation==="H"?(Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1)&&ft(u.boundary,p.boundary,1):(Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1)&&ht(u.boundary,p.boundary,1),"sameTerminalFace"),a=d((u,p)=>u.nodeId!==p.nodeId||u.orientation!==p.orientation?!1:i(u,p)>=_t&&Math.abs(u.coord-p.coord)<.5,"exactTerminalLaneConflict"),l=d((u,p)=>{if(u.nodeId!==p.nodeId||u.orientation!==p.orientation||u.orientation!=="H"||u.atStart===p.atStart)return!1;const f=i(u,p);if(f<_t)return!1;const y=u.rect.bottom-u.rect.top;return f2*y?!1:c(u,p)&&Math.abs(u.coord-p.coord)<16},"nearTerminalLaneConflict"),g=d((u,p)=>{const f=pt(u.edge.points??[]);if(f.length<2)return;const y=u.orientation==="V"?{x:u.boundary.x+p,y:u.boundary.y}:{x:u.boundary.x,y:u.boundary.y+p},v=u.orientation==="V"?{x:u.railEnd.x+p,y:u.railEnd.y}:{x:u.railEnd.x,y:u.railEnd.y+p};if(!d(()=>Math.abs(u.boundary.y-u.rect.top)<1||Math.abs(u.boundary.y-u.rect.bottom)<1?ht(y,u.boundary,Z)&&y.x>=u.rect.left+1&&y.x<=u.rect.right-1:Math.abs(u.boundary.x-u.rect.left)<1||Math.abs(u.boundary.x-u.rect.right)<1?ft(y,u.boundary,Z)&&y.y>=u.rect.top+1&&y.y<=u.rect.bottom-1:!1,"boundaryStaysOnSameFace")())return;if(u.atStart){const S=f.length>1&&oe(f[1],u.railEnd,Z),A=f.slice(S?2:1),R=A[0];return R&&!In(R,v)?void 0:[y,v,...A]}const E=f.length>1&&oe(f[f.length-2],u.railEnd,Z),T=f.slice(0,E?-2:-1),m=T[T.length-1];if(!(m&&!In(m,v)))return[...T,v,y]},"shiftedCandidate"),x=d(u=>{const p=u.edge,f=pt(p.points??[]);if(f.length!==2)return!1;const y=p.start,v=p.end,M=y?e.get(y):void 0,E=v?e.get(v):void 0;if(!M||!E)return!1;const T=M.x??0,m=M.y??0,S=E.x??0,A=E.y??0,[R,k]=f;return ht(R,k,Z)&&Math.abs(m-A)<1&&Math.abs(T-S)>1||ft(R,k,Z)&&Math.abs(T-S)<1&&Math.abs(m-A)>1},"laneIsStraightCollinearConnector"),I=[-7,7,-14,14,-21,21];for(let u=0;u<8;u++){const p=t.filter(y=>!y.isLayoutOnly).flatMap(y=>[r(y,!0),r(y,!1)]).filter(y=>!!y);let f=!1;for(let y=0;y{const R=x(S),k=x(A);return R!==k?Number(R)-Number(k):+!A.atStart-+!S.atStart});for(const S of m){for(const A of I){const R=g(S,A);if(!R)continue;const k=r({...S.edge,points:R},S.atStart);if(!(!k||p.some(O=>O.edge!==S.edge&&(a(k,O)||T&&l(k,O))))){S.edge.points=R,f=!0;break}}if(f)break}}if(!f)return}}d(bs,"separateSharedRenderedTerminalLanes");function Ms(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=d((c,a)=>{const l=c.start,g=c.end,x=it(a);if(x.length!==a.length-1)return!1;const I=[l,g].filter(u=>!!u);for(const u of x)if(At(u.a,u.b,o,I,-2)||At(u.a,u.b,s,[],-2))return!1;for(const u of t){if(u===c||u.isLayoutOnly)continue;const p=u.points;if(!(!p||p.length<2)){for(const f of x)for(const y of it(pt(p)))if(ce(f,y,.5)>=_t||le(f.a,f.b,y.a,y.b,Z))return!1}}return!0},"candidateIsSafe"),i=d((c,a)=>{if(a+4>=c.length)return;const l=c[a],g=c[a+1],x=c[a+2],I=c[a+3],u=c[a+4],p=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&ft(l,I,Z)&&ft(l,u,Z)&&ft(g,x,Z)&&(g.x-l.x)*(I.x-x.x)<0,f=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&ht(l,I,Z)&&ht(l,u,Z)&&ht(g,x,Z)&&(g.y-l.y)*(I.y-x.y)<0;if(p||f)return pt([...c.slice(0,a+1),u,...c.slice(a+5)]);if(a+5>=c.length)return;const y=c[a+5],v=wt(l,g)&&Tt(g,x)&&wt(x,I)&&Tt(I,u)&&wt(u,y)&&ft(l,u,Z)&&ft(l,y,Z)&&ft(x,I,Z)&&(x.x-g.x)*(u.x-I.x)<0,M=Tt(l,g)&&wt(g,x)&&Tt(x,I)&&wt(I,u)&&Tt(u,y)&&ht(l,u,Z)&&ht(l,y,Z)&&ht(x,I,Z)&&(x.y-g.y)*(u.y-I.y)<0;if(!(!v&&!M))return pt([...c.slice(0,a+1),y,...c.slice(a+6)])},"withoutDogleg");for(let c=0;c<8;c++){let a=!1;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(let x=0;x<=g.length-5;x++){const I=i(g,x);if(!(!I||!r(l,I))){l.points=I,a=!0;break}}if(a)break}if(!a)return}}d(Ms,"collapseRedundantRectangularDoglegs");function Xn(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(p=>!p.isLayoutOnly),a=d((p,f,y)=>pt(p===f?y??[]:p.points??[]),"pointsFor"),l=d((p,f)=>{let y=0;for(let v=0;v{const f=it(p);if(f.length!==3)return;const y=f[1];if(!(f[0].horizontal===y.horizontal||f[2].horizontal===y.horizontal))return{index:y.index,horizontal:y.horizontal,vertical:y.vertical,segment:y}},"middleRail"),x=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);return r.filter(v=>{if(y.includes(v.id))return!1;const M=v.rect;return f.horizontal?zt(f.a.x,f.b.x,M.left,M.right)>=_t&&f.a.y>=M.top-2&&f.a.y<=M.bottom+2:zt(f.a.y,f.b.y,M.top,M.bottom)>=_t&&f.a.x>=M.left-2&&f.a.x<=M.right+2})},"blockingRectsFor"),I=d((p,f,y)=>{const v=p.map(E=>({...E}));if(f.horizontal)v[f.index].y=y,v[f.index+1].y=y;else if(f.vertical)v[f.index].x=y,v[f.index+1].x=y;else return;const M=ae(pt(v));return it(M).length===M.length-1?M:void 0},"candidateByMovingRail"),u=d((p,f,y)=>{const v=[p.start,p.end].filter(E=>!!E),M=it(f);if(M.length!==f.length-1)return!1;for(const E of M)if(At(E.a,E.b,r,v,-2)||At(E.a,E.b,i,[],-2))return!1;for(const E of c)if(E!==p){for(const T of M)for(const m of it(a(E)))if(ce(T,m,.5)>=_t)return!1}return l(p,f)<=y},"candidateIsSafe");for(let p=0;p<8;p++){const f=l();let y=!1;for(const v of c){const M=a(v),E=g(M);if(!E)continue;const T=x(v,E.segment);if(T.length===0)continue;const m=E.horizontal?[Math.min(...T.map(S=>S.rect.top))-20,Math.max(...T.map(S=>S.rect.bottom))+20]:[Math.min(...T.map(S=>S.rect.left))-20,Math.max(...T.map(S=>S.rect.right))+20];for(const S of m){const A=I(M,E.segment,S);if(!(!A||!u(v,A,f))){v.points=A,y=!0;break}}if(y)break}if(!y)return}}d(Xn,"liftObstacleHuggingSameSideRails");function Yn(t,e){const o=d(a=>{const l=a.groupTitleRect;if(!(!l||typeof l.left!="number"||typeof l.right!="number"||typeof l.top!="number"||typeof l.bottom!="number"||!Number.isFinite(l.left)||!Number.isFinite(l.right)||!Number.isFinite(l.top)||!Number.isFinite(l.bottom)||l.right<=l.left||l.bottom<=l.top))return{left:l.left,right:l.right,top:l.top,bottom:l.bottom}},"validTitleRect"),s=d(a=>{if(!a.isGroup||a.parentId)return;const l=a.direction,g=typeof l=="string"?l.toUpperCase():"";if(g==="LR"||g==="RL"||g==="BT")return;const x=o(a),I=a.y,u=a.height;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(f<=0||p{if(!a.horizontal)return!1;const g=a.a.y;return g<=l.top+Z||g>=l.bottom-Z?!1:zt(a.a.x,a.b.x,l.left,l.right)>=_t},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(s).filter(a=>!!a);if(i.length===0)return;let c=0;for(const a of t){if(a.isLayoutOnly)continue;const l=pt(a.points??[]);for(const g of it(l))for(const x of i)r(g,x.rect)&&(c=Math.max(c,x.rect.bottom-g.a.y+4))}if(!(c<=Z))for(const a of i){const l=a.node.y,g=a.node.height;typeof l!="number"||typeof g!="number"||!Number.isFinite(l)||!Number.isFinite(g)||g<=0||(a.node.y=l-c/2,a.node.height=g+c,a.node.groupTitleRect={...a.rect,top:a.rect.top-c,bottom:a.rect.bottom-c})}}d(Yn,"liftTopLaneTitleBandsAboveRails");function Gn(t,e){const o=d(l=>{const g=l.groupTitleRect;if(!(!g||typeof g.left!="number"||typeof g.right!="number"||typeof g.top!="number"||typeof g.bottom!="number"||!Number.isFinite(g.left)||!Number.isFinite(g.right)||!Number.isFinite(g.top)||!Number.isFinite(g.bottom)||g.right<=g.left||g.bottom<=g.top))return{left:g.left,right:g.right,top:g.top,bottom:g.bottom}},"validTitleRect"),s=d(l=>{if(!l.isGroup||l.parentId||l.direction!=="LR")return;const x=o(l),I=l.x,u=l.width;if(!x||typeof I!="number"||typeof u!="number"||!Number.isFinite(I)||!Number.isFinite(u)||u<=0)return;const p=x.right-x.left,f=x.bottom-x.top;if(!(p<=0||f{if(!l.vertical)return!1;const x=l.a.x;return x<=g.left+Z||x>=g.right-Z?!1:zt(l.a.y,l.b.y,g.top,g.bottom)>=_t},"verticalSegmentIntersectsTitle"),i=d((l,g)=>{if(!l.horizontal)return!1;const x=l.a.y;return x<=g.top+Z||x>=g.bottom-Z?!1:zt(l.a.x,l.b.x,g.left,g.right)>=_t},"horizontalSegmentIntersectsTitle"),c=[...e.values()].map(s).filter(l=>!!l);if(c.length===0)return;let a=0;for(const l of t){if(l.isLayoutOnly)continue;const g=pt(l.points??[]);for(const x of it(g))for(const I of c)if(r(x,I.rect))a=Math.max(a,I.rect.right-x.a.x+4);else if(i(x,I.rect)){const u=Math.min(x.a.x,x.b.x);a=Math.max(a,I.rect.right-u+4)}}if(!(a<=Z))for(const l of c){const g=l.node.x,x=l.node.width;typeof g!="number"||typeof x!="number"||!Number.isFinite(g)||!Number.isFinite(x)||x<=0||(l.node.x=g-a/2,l.node.width=x+a,l.node.groupTitleRect={...l.rect,left:l.rect.left-a,right:l.rect.right-a})}}d(Gn,"shiftLeftLaneTitleBandsLeftOfRails");function Is(t,e){const{realNodeRects:o}=me(e.values()),s=t.filter(p=>!p.isLayoutOnly),r=d((p,f=new Map)=>pt(f.get(p)??p.points??[]),"replacementPointsFor"),i=d((p=new Map)=>{let f=0;for(let y=0;ys.reduce((f,y)=>f+Qt(r(y,p)),0),"totalBends"),a=d(p=>{const f=r(p);if(f.length<4)return;const y=f[f.length-2],v=f[f.length-1];if(!(!Tt(y,v,Z)&&!wt(y,v,Z)))return{tailStart:y,terminal:v}},"terminalTailFor"),l=d((p,f)=>{const y=r(p);if(y.length<3)return;const v=y[0],M=y[1];let E;if(Tt(v,M,Z))E={x:M.x,y:f.tailStart.y};else if(wt(v,M,Z))E={x:f.tailStart.x,y:M.y};else return;const T=ae(pt([v,M,E,f.tailStart,f.terminal]));return it(T).length===T.length-1?T:void 0},"candidateWithDestinationTail"),g=d((p,f)=>{const y=[p.start,p.end].filter(v=>!!v);for(const v of it(f))if(At(v.a,v.b,o,y,-2))return!0;return!1},"pathHasNodeHit"),x=d((p,f,y)=>{for(const v of s)if(v!==p){for(const M of it(f))for(const E of it(r(v,y)))if(ce(M,E,.5)>=_t)return!0}return!1},"pathHasSharedTrack"),I=d((p,f,y)=>!g(p,f)&&!x(p,f,y),"candidateIsSafe"),u=d(()=>{const p=new Map;for(const f of s){const y=f.end;if(!y||!e.has(y)||r(f).length<4)continue;const M=p.get(y)??[];M.push(f),p.set(y,M)}return p},"edgesByDestination");for(let p=0;p<4;p++){const f=i();if(f===0)return;const y=c();let v,M=f,E=y;for(const T of u().values())for(let m=0;m=f||G>M||G===M&&j>=E||(v=P,M=G,E=j)}if(!v)return;for(const[T,m]of v)T.points=m}}d(Is,"swapDestinationTerminalTailsToReduceCrossings");function Ss(t,e){const{realNodeRects:r,labelNodeRects:i}=me(e.values()),c=t.filter(T=>!T.isLayoutOnly),a=d((T,m=new Map)=>pt(m.get(T)??T.points??[]),"replacementPointsFor"),l=d((T=new Map)=>{let m=0;for(let S=0;Sc.reduce((m,S)=>m+Qt(a(S,T)),0),"totalBends"),x=d(T=>{const m=T.start,S=T.end,A=m?e.get(m):void 0,R=S?e.get(S):void 0,k=A?qt(A):void 0,O=R?qt(R):void 0;return k&&O?{src:k,dst:O}:void 0},"endpointRectsFor"),I=d((T,m,S)=>{if(S.index<=0||S.index+1>=m.length-1)return;const A=x(T);if(A){if(S.vertical){const R=S.a.x,k=Math.min(A.src.left,A.dst.left),O=Math.max(A.src.right,A.dst.right),_=RO+Z?"right":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"vertical",side:_,coord:R,min:Math.min(S.a.y,S.b.y),max:Math.max(S.a.y,S.b.y)}:void 0}if(S.horizontal){const R=S.a.y,k=Math.min(A.src.top,A.dst.top),O=Math.max(A.src.bottom,A.dst.bottom),_=RO+Z?"bottom":void 0;return _?{edge:T,points:m,segmentIndex:S.index,axis:"horizontal",side:_,coord:R,min:Math.min(S.a.x,S.b.x),max:Math.max(S.a.x,S.b.x)}:void 0}}},"externalRailForSegment"),u=d(()=>{const T=[];for(const m of c){const S=a(m);for(const A of it(S)){const R=I(m,S,A);R&&T.push(R)}}return T},"collectExternalRails"),p=d((T,m)=>T.edge!==m.edge&&T.axis===m.axis&&T.side===m.side&&zt(T.min,T.max,m.min,m.max)>=_t,"railsInteract"),f=d(T=>{const m=[],S=new Set;for(const A of T){if(S.has(A))continue;const R=[A],k=[];for(S.add(A);R.length>0;){const O=R.pop();k.push(O);for(const _ of T)!S.has(_)&&p(O,_)&&(S.add(_),R.push(_))}k.length>1&&m.push(k)}return m},"connectedComponents"),y=d(T=>{const m=[];for(const S of T)m.some(A=>Math.abs(A-S.coord){const m=T.map(R=>R.coord),S=y(T),A=[];if(T.length<=6){const R=new Array(S.length).fill(!1),k=[],O=d(()=>{if(k.length===T.length){k.some((_,H)=>Math.abs(_-m[H])>=Z)&&A.push([...k]);return}for(const[_,H]of S.entries())R[_]||(R[_]=!0,k.push(H),O(),k.pop(),R[_]=!1)},"visit");return O(),A}for(let R=0;R{const S=new Map;for(const[R,k]of T.entries()){const O=m[R],_=S.get(k.edge)??k.points.map(H=>({x:H.x,y:H.y}));k.axis==="vertical"?(_[k.segmentIndex].x=O,_[k.segmentIndex+1].x=O):(_[k.segmentIndex].y=O,_[k.segmentIndex+1].y=O),S.set(k.edge,_)}const A=new Map;for(const[R,k]of S){const O=ae(pt(k));if(it(O).length!==O.length-1)return;A.set(R,O)}return A},"replacementsForAssignment"),E=d(T=>{for(const[m,S]of T){const A=[m.start,m.end].filter(R=>!!R);for(const R of it(S))if(At(R.a,R.b,r,A,-2)||At(R.a,R.b,i,[],-2))return!1}for(let m=0;m=_t)return!1}}return!0},"candidateIsSafe");for(let T=0;T<4;T++){const m=l();if(m===0)return;let S,A=m,R=g(),k=Number.POSITIVE_INFINITY;for(const O of f(u()))for(const _ of v(O)){const H=M(O,_);if(!H||!E(H))continue;const P=l(H);if(P>=m)continue;const G=g(H),j=O.reduce((J,dt,mt)=>J+Math.abs(_[mt]-dt.coord),0);P>A||P===A&&(G>R||G===R&&j>=k)||(S=H,A=P,R=G,k=j)}if(!S)return;for(const[O,_]of S)O.points=_}}d(Ss,"reassignCrossingExternalRailChannels");function Cs(t,e){const{realNodeRects:o,labelNodeRects:s}=me(e.values()),r=t.filter(u=>!u.isLayoutOnly),i=d((u,p,f)=>pt(u===p?f??[]:u.points??[]),"pointsFor"),c=d(u=>it(u).reduce((p,f)=>{const y=f.a.x-f.b.x,v=f.a.y-f.b.y;return p+Math.hypot(y,v)},0),"pathLength"),a=d((u,p)=>{let f=0;for(let y=0;y{if(u.horizontal){const f=u.a.y;return(Math.abs(f-p.top)<1||Math.abs(f-p.bottom)<1)&&zt(u.a.x,u.b.x,p.left,p.right)>=_t}if(u.vertical){const f=u.a.x;return(Math.abs(f-p.left)<1||Math.abs(f-p.right)<1)&&zt(u.a.y,u.b.y,p.top,p.bottom)>=_t}return!1},"segmentRunsAlongRectBorder"),g=d(u=>{const p=[u.start,u.end].filter(y=>!!y),f=[];for(const y of p){const v=e.get(y),M=v?qt(v):void 0;M&&f.push(M)}return f},"endpointRectsFor"),x=d((u,p)=>{if(p+3>=u.length)return[];const f=u[p],y=u[p+1],v=u[p+2],M=u[p+3],E=Tt(f,y,Z)&&wt(y,v,Z)&&Tt(v,M,Z),T=wt(f,y,Z)&&Tt(y,v,Z)&&wt(v,M,Z);if(!E&&!T)return[];if(!(E?Math.sign(y.x-f.x)!==Math.sign(M.x-v.x):Math.sign(y.y-f.y)!==Math.sign(M.y-v.y)))return[];const S=ft(f,M,Z)||ht(f,M,Z)?[]:[{x:f.x,y:M.y},{x:M.x,y:f.y}],A=S.length===0?[[...u.slice(0,p+1),...u.slice(p+3)]]:S.map(k=>[...u.slice(0,p+1),k,...u.slice(p+3)]),R=new Set;return A.map(k=>ae(pt(k))).filter(k=>{if(it(k).length!==k.length-1||!k.some(_=>oe(_,M,Z)))return!1;const O=k.map(_=>`${_.x.toFixed(3)},${_.y.toFixed(3)}`).join("|");return R.has(O)?!1:(R.add(O),!0)})},"shortcutCandidatesAt"),I=d((u,p,f)=>{const y=[u.start,u.end].filter(M=>!!M),v=g(u);for(const M of it(p))if(At(M.a,M.b,o,y,-2)||At(M.a,M.b,s,[],-2)||v.some(E=>l(M,E)))return!1;for(const M of r)if(M!==u){for(const E of it(p))for(const T of it(i(M)))if(ce(E,T,.5)>=_t)return!1}return a(u,p)<=f},"candidateIsSafe");for(let u=0;u<8;u++){const p=a();let f,y,v=p,M=Number.POSITIVE_INFINITY,E=Number.POSITIVE_INFINITY;for(const T of r){const m=i(T),S=Qt(m,Z),A=c(m);for(let R=0;R<=m.length-4;R++)for(const k of x(m,R)){const O=Qt(k,Z),_=c(k);if(!(Ov||P===v&&(O>M||O===M&&_>=E)||(f=T,y=k,v=P,M=O,E=_)}}if(!f||!y)return;f.points=y}}d(Cs,"shortcutRedundantOrthogonalJogs");function vs(t,e){const i=[];for(const N of e.values()){if(N.isGroup||N.isEdgeLabel)continue;const F=N.x??0,D=N.y??0,V=qt(N);V&&i.push({id:String(N.id??""),cx:F,cy:D,rect:V})}if(i.length===0)return;const c=new Map(i.map(N=>[N.id,N])),a=i.map(N=>({id:N.id,rect:N.rect})),l=["top","bottom","left","right"],g={top:Math.min(...i.map(N=>N.rect.top))-20,bottom:Math.max(...i.map(N=>N.rect.bottom))+20,left:Math.min(...i.map(N=>N.rect.left))-20,right:Math.max(...i.map(N=>N.rect.right))+20},x=t.filter(N=>!N.isLayoutOnly),I=new Map(x.map((N,F)=>[N,F])),u=d(N=>{const F=N==="left"||N==="top"?-1:1,D=[];for(let V=0;V<=2;V++)D.push(g[N]+F*20*V);return D},"outwardTracksForSide"),p=d((N,F=new Map)=>pt(F.get(N)??N.points??[]),"replacementPointsFor"),f=d((N,F)=>{let D=0;for(const V of N)for(const h of F)le(V.a,V.b,h.a,h.b,Z)&&D++;return D},"crossingCountBetweenSegments"),y=d((N,F)=>f(it(N),it(F)),"crossingCountBetweenPaths"),v=d((N=new Map)=>{let F=0;const D=[],V=new Set,h=[],b=d(C=>{V.has(C)||(V.add(C),h.push(C))},"addEdge");for(let C=0;C0&&(F+=q,D.push({first:L,second:U,count:q}),b(L),b(U))}}return h.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),{count:F,pairs:D,edgeSet:V,edges:h}},"crossingSnapshot"),M=d((N,F)=>{const D=new Set(F.keys());if(D.size===0)return N.count;let V=0;for(const b of N.pairs)(D.has(b.first)||D.has(b.second))&&(V+=b.count);let h=0;for(let b=0;b{const F=new Map;for(const h of N.pairs){const b=F.get(h.first)??new Set;b.add(h.second),F.set(h.first,b);const C=F.get(h.second)??new Set;C.add(h.first),F.set(h.second,C)}const D=[],V=new Set;for(const h of N.edges){if(V.has(h))continue;const b=[h],C=[];for(V.add(h);b.length>0;){const L=b.pop();C.push(L);for(const w of F.get(L)??[])V.has(w)||(V.add(w),b.push(w))}C.sort((L,w)=>(I.get(L)??0)-(I.get(w)??0)),C.length>1&&D.push(C)}return D},"crossingComponents"),T=d(N=>[N.start,N.end].filter(F=>!!F),"endpointIdsFor"),m=d(N=>{const F=[];for(const D of E(N)){const V=new Set(D),h=new Set(D.flatMap(C=>T(C))),b=[...D];for(const C of x)V.has(C)||T(C).some(L=>h.has(L))&&b.push(C);b.sort((C,L)=>(I.get(C)??0)-(I.get(L)??0)),F.push(b)}return F},"pairSearchGroups"),S=d((N,F,D)=>M(N,new Map([[F,D]])),"crossingCountWithSingleReplacement"),A=d(N=>{const F=new Map;for(const D of N.pairs)F.set(D.first,(F.get(D.first)??0)+D.count),F.set(D.second,(F.get(D.second)??0)+D.count);return F},"currentCrossingsByEdge"),R=d(N=>N.slice(1).reduce((F,D,V)=>{const h=N[V];return F+Math.abs(D.x-h.x)+Math.abs(D.y-h.y)},0),"pathLength"),k=d((N=new Map)=>x.reduce((F,D)=>F+Qt(p(D,N)),0),"totalBends"),O=d((N=new Map)=>x.reduce((F,D)=>F+R(p(D,N)),0),"totalLength"),_=d((N,F,D=new Map)=>{const V=it(F);for(const h of x)if(h!==N){for(const b of V)for(const C of it(p(h,D)))if(ce(b,C,.5)>=_t)return!0}return!1},"pathHasSegmentConflict"),H=d((N,F)=>{const D=[N.start,N.end].filter(V=>!!V);for(const V of it(F))if(At(V.a,V.b,a,D,-2))return!0;return!1},"pathHitsNode"),P=d((N,F)=>{const D=ae(pt(F));it(D).length===D.length-1&&N.push(D)},"pushOrthogonalCandidate"),G=d(N=>N==="left"||N==="right","sideIsHorizontal"),j=d((N,F,D)=>{switch(F){case"left":return Math.min(N.x,D.x)-20;case"right":return Math.max(N.x,D.x)+20;case"top":return Math.min(N.y,D.y)-20;case"bottom":return Math.max(N.y,D.y)+20}},"localTrackForSameSide"),J=d((N,F,D,V)=>{const h=D==="left"||D==="top"?-1:1,b=[j(F,D,V),g[D]];for(const C of b)for(let L=0;L<=2;L++)P(N,ao(F,D,V,C+h*20*L))},"addSameSideCandidates"),dt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:b,y:F.y},{x:b,y:C},{x:V.x,y:C},V])},"addHorizontalToVerticalCandidates"),mt=d((N,F,D,V,h)=>{for(const b of u(D))for(const C of u(h))P(N,[F,{x:F.x,y:b},{x:C,y:b},{x:C,y:V.y},V])},"addVerticalToHorizontalCandidates"),kt=d((N,F,D,V,h)=>{const b=[...u("top"),...u("bottom")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:C,y:F.y},{x:C,y:w},{x:L,y:w},{x:L,y:V.y},V])},"addHorizontalPairCandidates"),Pt=d((N,F,D,V,h)=>{const b=[...u("left"),...u("right")];for(const C of u(D))for(const L of u(h))for(const w of b)P(N,[F,{x:F.x,y:C},{x:w,y:C},{x:w,y:L},{x:V.x,y:L},V])},"addVerticalPairCandidates"),Q=d(N=>{const F=new Set;return N.map(D=>pt(D)).filter(D=>{const V=D.map(h=>`${h.x.toFixed(3)},${h.y.toFixed(3)}`).join("|");return F.has(V)||D.length<2?!1:(F.add(V),!0)})},"dedupeCandidatePaths"),W=d((N,F,D,V)=>{const h=[],b=co(N,F,D,V,20,Z);b&&P(h,b),F===V&&J(h,N,F,D);const C=G(F),L=G(V);return C&&!L?dt(h,N,F,D,V):!C&&L?mt(h,N,F,D,V):C?kt(h,N,F,D,V):Pt(h,N,F,D,V),Q(h)},"buildCandidatesForSides"),et=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="top"||C==="bottom"?u(C):b;for(const B of h){P(N,[F,D,{x:B,y:D.y},{x:B,y:L.y},L]);for(const U of w)P(N,[F,D,{x:B,y:D.y},{x:B,y:U},{x:L.x,y:U},L])}}},"addVerticalDepartureOuterTrackCandidates"),at=d((N,F,D,V)=>{const h=[...u("left"),...u("right")],b=[...u("top"),...u("bottom")];for(const C of l){const L=Ie(V,C),w=C==="left"||C==="right"?u(C):h;for(const B of b){P(N,[F,D,{x:D.x,y:B},{x:L.x,y:B},L]);for(const U of w)P(N,[F,D,{x:D.x,y:B},{x:U,y:B},{x:U,y:L.y},L])}}},"addHorizontalDepartureOuterTrackCandidates"),gt=d(N=>{const F=N.start,D=N.end,V=D?c.get(D):void 0;if(!F||!V)return[];const h=pt(N.points??[]);if(h.length<4)return[];const b=h[0],C=h[1],L=[];return wt(b,C,Z)?et(L,b,C,V):Tt(b,C,Z)&&at(L,b,C,V),L},"terminalPreservingOuterTrackCandidates"),xt=d(N=>{const F=N.start,D=N.end,V=F?c.get(F):void 0,h=D?c.get(D):void 0;if(!V||!h)return[];const b=[];for(const C of l){const L=Ie(V,C);for(const w of l)b.push(...W(L,C,Ie(h,w),w))}return b.push(...gt(N)),b},"candidatePathsFor"),vt=d(()=>new Map(x.map(N=>[N,it(p(N))])),"currentSegmentsByEdge"),Vt=d((N,F,D)=>{const V=new Set;for(const h of x){if(h===N)continue;const b=D.get(h)??it(p(h));F.some(C=>b.some(L=>ce(C,L,.5)>=_t))&&V.add(h)}return V},"sharedTrackConflictsFor"),jt=d((N,F,D,V)=>{const h=new Set;return xt(N).map(C=>ae(pt(C))).filter(C=>{if(H(N,C))return!1;const L=C.map(w=>`${w.x.toFixed(3)},${w.y.toFixed(3)}`).join("|");return h.has(L)||C.length<2?!1:(h.add(L),!0)}).map(C=>{const L=it(C);let w=0;for(const B of x)B!==N&&(w+=f(L,D.get(B)??it(p(B))));return{candidate:C,candidateSegments:L,crossings:F.count-(V.get(N)??0)+w,bends:Qt(C,Z),totalBends:Qt(C),length:R(C)}}).filter(({crossings:C})=>C<=F.count).sort((C,L)=>C.crossings-L.crossings||C.bends-L.bends||C.length-L.length).slice(0,48).map(C=>({path:C.candidate,segments:C.candidateSegments,sharedTrackConflicts:Vt(N,C.candidateSegments,D),totalBends:C.totalBends,length:C.length}))},"pairCandidatesFor"),Ut=d((N,F,D,V,h,b)=>{let C=0;for(const w of N.pairs)(w.first===F||w.second===F||w.first===V||w.second===V)&&(C+=w.count);let L=f(D.segments,h.segments);for(const w of x){if(w===F||w===V)continue;const B=b.get(w)??it(p(w));L+=f(D.segments,B)+f(h.segments,B)}return N.count-C+L},"pairCrossingCount"),te=d((N,F)=>{for(const D of N.sharedTrackConflicts)if(D!==F)return!1;return!0},"conflictsOnlyWith"),Se=d((N,F)=>N.segments.some(D=>F.segments.some(V=>ce(D,V,.5)>=_t)),"candidatesShareTrack"),de=d((N,F,D,V)=>te(F,D.edge)&&te(V,N.edge)&&!Se(F,V),"pairCandidatesAreCompatible"),Ce=d((N,F,D,V,h)=>{const b=Ut(N.current,F.edge,D,V.edge,h,N.baseSegments);if(!(b>=N.current.count))return{replacements:new Map([[F.edge,D.path],[V.edge,h.path]]),crossings:b,bends:N.currentBends-(N.baseBendsByEdge.get(F.edge)??0)-(N.baseBendsByEdge.get(V.edge)??0)+D.totalBends+h.totalBends,length:N.currentLength-(N.baseLengthByEdge.get(F.edge)??0)-(N.baseLengthByEdge.get(V.edge)??0)+D.length+h.length}},"scorePairReplacement"),dn=d((N,F)=>N.crossings{let h=V;for(const b of F.candidates)for(const C of D.candidates){if(!de(F,b,D,C))continue;const L=Ce(N,F,b,D,C);L&&dn(L,h)&&(h=L)}return h},"bestScoreForOptionPair"),hn=d(N=>{const F=k(),D=O(),V=vt(),h=A(N),b=new Map(x.map(q=>[q,Qt(p(q))])),C=new Map(x.map(q=>[q,R(p(q))])),L=new Map,w=m(N);for(const q of w)for(const z of q){if(L.has(z))continue;const Y=jt(z,N,V,h);Y.length>0&&L.set(z,{edge:z,candidates:Y})}let B={replacements:new Map,crossings:N.count,bends:F,length:D};const U={current:N,currentBends:F,currentLength:D,baseBendsByEdge:b,baseLengthByEdge:C,baseSegments:V};for(const q of w){const z=new Set(q.filter(ot=>N.edgeSet.has(ot))),Y=q.map(ot=>L.get(ot)).filter(ot=>!!ot);for(let ot=0;ot0?B.replacements:void 0},"bestPairedReplacement");for(let N=0;N<4;N++){const F=v(),D=F.count;if(D===0)return;let V,h,b=D,C=Number.POSITIVE_INFINITY;for(const w of F.edges){const B=Qt(p(w),Z);for(const U of xt(w)){const q=H(w,U),z=!q&&_(w,U),Y=S(F,w,U),ot=Qt(U,Z);q||z||!(Yb||Y===b&&ot>=C||(V=w,h=U,b=Y,C=ot)}}if(V&&h){V.points=h;continue}const L=hn(F);if(!L)return;for(const[w,B]of L)w.points=B}}d(vs,"resolveRenderedOrthogonalCrossings");var pe=.001,Wr=8;function Ls(t,e){const{nodeInfoById:n,realNodeRects:o}=an(e),s=["top","bottom","left","right"],r=20,i={top:Math.min(...o.map(f=>f.rect.top))-r,bottom:Math.max(...o.map(f=>f.rect.bottom))+r,left:Math.min(...o.map(f=>f.rect.left))-r,right:Math.max(...o.map(f=>f.rect.right))+r},c=d((f,y,v,M)=>{const E=[],T=co(f,y,v,M,r,pe);return T&&E.push(T),y===M&&E.push(ao(f,y,v,i[y])),E},"buildOrthogonalPathCandidates"),a=d((f,y)=>{for(let v=0;v{let M=0;const E=Re(f,pe),T=y.start,m=y.end;for(const S of t){if(S===y||S.isLayoutOnly)continue;const A=S.start,R=S.end;if(!v&&T&&m&&(A===T||A===m||R===T||R===m))continue;const k=S.points;if(!(!k||k.length<2))for(const O of E)for(const _ of Re(k,pe)){if(fo(O.a,O.b,_.a,_.b,pe,pe)){M++;continue}ce(O,_,pe)>=Wr&&M++}}return M},"pathConflictCount"),g=4,x=d((f,y)=>{const v=Math.abs(f.y-y.rect.top),M=Math.abs(f.y-y.rect.bottom),E=Math.abs(f.x-y.rect.left),T=Math.abs(f.x-y.rect.right);let m="top",S=v;return M{const M=I.get(f)??[];M.push({side:y,edgeId:v}),I.set(f,M)},"addFaceClaim");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points??[];if(y.length<1)continue;const v=f.id??"",M=f.start,E=f.end;if(M){const T=n.get(M);T&&u(M,x(y[0],T),v)}if(E){const T=n.get(E);T&&u(E,x(y[y.length-1],T),v)}}const p=d((f,y,v)=>I.get(f)?.some(M=>M.edgeId!==v&&M.side===y)??!1,"faceIsClaimed");for(const f of t){if(f.isLayoutOnly)continue;const y=f.points;if(!y||y.length<2)continue;const v=Qt(y,pe);if(v0){const mt=l(J,f,!0);if(mt>O||mt===O&&dt>=_)continue;O=mt,_=dt,k=J;continue}l(J,f)>R||dt<_&&(_=dt,k=J)}}}if(k){f.points=k;const H=I.get(M);H&&I.set(M,H.filter(G=>G.edgeId!==S));const P=I.get(E);P&&I.set(E,P.filter(G=>G.edgeId!==S)),u(M,x(k[0],T),S),u(E,x(k[k.length-1],m),S)}}}d(Ls,"simplifyDetouredEdges");var Kt=.001,Po=10,Ve=7;function $n(t,e){const n=e?0:t.length-1,o=e?1:-1,s=t[n],r=t[n+o];if(!s||!r)return;const i=r.x-s.x,c=r.y-s.y;if(!(Math.abs(i)+Math.abs(c)r&&Je(t,Es(r)))}d(zn,"labelOverlapsOwnMarker");function Ue(t,e){const n=[];for(const p of t){if(p.isLayoutOnly)continue;const f=p.points;if(!(!f||f.length<2))for(let y=0;y{const y=Tn(f,r);for(const{nodeId:v,rect:M}of o)if(v!==p&&Je(y,M))return!0;return!1},"labelOverlapsForeignNode"),l=d((p,f)=>{const y=Tn(f,r);for(const v of n)if(v.edgeId!==p&&cn(v.p1,v.p2,y))return!0;return!1},"labelOverlapsForeignEdge"),g=d((p,f,y)=>a(p,y)||l(f,y),"labelOverlapsAnything"),x=[],I=d(p=>{for(const{id:f,rect:y}of s)if(ts(y,p))return f},"findContainingLane"),u=d((p,f)=>x.some(y=>y.labelId!==p&&Je(f,y.rect)),"overlapsPlacedLabel");for(const p of t){if(p.isLayoutOnly)continue;const f=p.labelNodeId;if(!f)continue;const y=e.get(f);if(!y)continue;const v=p.points;if(!v||v.length<2)continue;const M=y.width??0,E=y.height??0;if(M<=0||E<=0)continue;const T=[];for(let Q=0;Q=Kt&>>=Kt||T.push({idx:Q,length:at+gt,orientation:at>=Kt?"horizontal":"vertical",midX:(W.x+et.x)/2,midY:(W.y+et.y)/2})}if(T.length===0)continue;const m=T.length>=3?T.filter(Q=>Q.idx>0&&Q.idx0?m:T,A=M>=E?"horizontal":"vertical",R=d(Q=>[...Q].sort((W,et)=>{const at=W.orientation===A,gt=et.orientation===A;if(at!==gt)return at?-1:1;const xt=W.length>=(W.orientation==="horizontal"?M:E)+2,vt=et.length>=(et.orientation==="horizontal"?M:E)+2;return xt!==vt?xt?-1:1:et.length-W.length}),"rankSegments"),k=T[0],O=T[T.length-1],_=[.5,.25,.75,.05,.95,.15,.85,.1,.9],H=d((Q,W)=>{const et=v[Q.idx],at=v[Q.idx+1];return{midX:et.x+(at.x-et.x)*W,midY:et.y+(at.y-et.y)*W}},"anchorAtT"),P=d((Q,W,et)=>Math.min(et,Math.max(W,Q)),"clamp"),G=d((Q,W)=>Q.midX>=W.left-Kt&&Q.midX<=W.right+Kt&&Q.midY>=W.top-Kt&&Q.midY<=W.bottom+Kt,"pointInsideRectInclusive"),j=d(Q=>{const W=Ae(Q.midX,Q.midY,M,E),et=I(W);if(et)return{laneId:et,anchor:Q,rect:W};const at=s.find(({rect:te})=>G(Q,te));if(!at)return;const gt=at.rect.left+M/2+i,xt=at.rect.right-M/2-i,vt=at.rect.top+E/2+i,Vt=at.rect.bottom-E/2-i;if(gt>xt||vt>Vt)return;const jt={midX:P(Q.midX,gt,xt),midY:P(Q.midY,vt,Vt)},Ut=Ae(jt.midX,jt.midY,M,E);return G(Q,Ut)?{laneId:at.id,anchor:jt,rect:Ut}:void 0},"placementForAnchor"),J=d((Q,W,et)=>Q.orientation==="horizontal"?Math.abs(W.midX-et.x):Math.abs(W.midY-et.y),"distanceAlongSegment"),dt=d((Q,W)=>{const at=(Q.orientation==="horizontal"?M/2:E/2)+c;if(Q===k){const gt=v[Q.idx];if(J(Q,W,gt)+Kt{const W=R(Q);for(const et of W)for(const at of _){const gt=H(et,at);if(!dt(et,gt))continue;const xt=j(gt);if(xt&&!zn(xt.rect,v)&&!u(f,xt.rect)&&!g(f,p.id,xt.rect))return{laneId:xt.laneId,anchor:xt.anchor}}},"tryPool"),kt=d((Q,W,et=!1)=>{const at=R(Q);for(const gt of at){const xt={midX:gt.midX,midY:gt.midY};if(W&&!dt(gt,xt))continue;const vt=j(xt);if(vt&&!zn(vt.rect,v)&&!u(f,vt.rect)&&!a(f,vt.rect)&&(et||!l(p.id,vt.rect)))return{laneId:vt.laneId,anchor:vt.anchor}}},"findLaneContainingFallback"),Pt=mt(S)??(S.lengthet.labelId===f);W>=0?x[W]={labelId:f,rect:Q}:x.push({labelId:f,rect:Q})}}}d(Ue,"anchorLabelsToPolyline");var Sn=1e-6,Kr=8,Bo=Kr/2,qr=3;function Vn(t,e){return t{const g=Vn(c,a);let x=0;const I=d(u=>{if(!u)return;const p=s.get(u);if(!p)return;const f=l==="x"?p.w/2:p.h/2;f>x&&(x=f)},"consider");I(i.labelNodeId);for(const u of t){if(u===i||u.isLayoutOnly)continue;const p=u.start,f=u.end;!p||!f||Vn(p,f)===g&&I(u.labelNodeId)}return x>0?x+qr:0},"labelClearanceFor");for(const i of t){if(i.isLayoutOnly)continue;const c=i.points;if(!ro(c,Sn))continue;const a=lo(i,n,Sn);if(!a)continue;const{srcId:l,dstId:g,srcInfo:x,dstInfo:I,collinearX:u,collinearY:p}=a;if(u===p)continue;let f,y;if(u){const m=I.cy>x.cy;f={x:x.cx,y:m?x.rect.bottom:x.rect.top},y={x:I.cx,y:m?I.rect.top:I.rect.bottom}}else{const m=I.cx>x.cx;f={x:m?x.rect.right:x.rect.left,y:x.cy},y={x:m?I.rect.left:I.rect.right,y:I.cy}}if(At(f,y,o,[l,g],1))continue;const M=r(i,l,g,u?"x":"y"),E=M>Bo?M:Bo,T=[0,E,-E];for(const m of T){const S={...f},A={...y};if(u){if(S.x+=m,A.x+=m,S.x<=x.rect.left||S.x>=x.rect.right||A.x<=I.rect.left||A.x>=I.rect.right)continue}else if(S.y+=m,A.y+=m,S.y<=x.rect.top||S.y>=x.rect.bottom||A.y<=I.rect.top||A.y>=I.rect.bottom)continue;if(!At(S,A,o,[l,g],1)&&!Ze(S,A,t,i,{epsilon:Sn})){i.points=[S,A];break}}}}d(Ts,"straightenCollinearSiblingDetours");function jn(t,e){const{realNodeRects:a,labelNodeRects:l}=me(e.values()),g=d((m,S)=>Re(S,.001).map(A=>({...A,edge:m,interior:A.index>=1&&A.index<=S.length-3})),"segmentsFor"),x=d(()=>{const m=[];for(const S of t){if(S.isLayoutOnly)continue;const A=S.points;!A||A.length<2||m.push(...g(S,pt(A)))}return m},"allSegments"),I=d((m,S)=>m.horizontal&&S.horizontal?zt(m.a.x,m.b.x,S.a.x,S.b.x)>=8&&Math.abs(m.a.y-S.a.y)<7:m.vertical&&S.vertical?zt(m.a.y,m.b.y,S.a.y,S.b.y)>=8&&Math.abs(m.a.x-S.a.x)<7:!1,"hasCrowdedParallelTrack"),u=d((m,S)=>{const A=m.start,R=m.end,k=g(m,S);if(k.length!==S.length-1)return!1;const O=[A,R].filter(H=>!!H),_=m.labelNodeId?[m.labelNodeId]:[];for(const H of k)if(At(H.a,H.b,a,O,-2)||At(H.a,H.b,l,_,-2))return!1;for(const H of t){if(H===m||H.isLayoutOnly)continue;const P=H.points;if(!(!P||P.length<2)){for(const G of k)for(const j of g(H,pt(P)))if(I(G,j)||le(G.a,G.b,j.a,j.b,.001))return!1}}return!0},"candidateIsSafe"),p=d((m,S)=>{const A=pt(m.edge.points??[]);if(A.length<4||m.index>=A.length-1)return;const R=A.map(k=>({...k}));if(m.horizontal)R[m.index].y+=S,R[m.index+1].y+=S;else if(m.vertical)R[m.index].x+=S,R[m.index+1].x+=S;else return;return g(m.edge,R).length===R.length-1?R:void 0},"shiftedCandidate"),f=d((m,S)=>({x:m.x??(S.left+S.right)/2,y:m.y??(S.top+S.bottom)/2}),"nodeCenter"),y=d(m=>{const S=m.edge,A=pt(S.points??[]);if(A.length!==4||m.index!==1)return;const R=S.start?e.get(S.start):void 0,k=S.end?e.get(S.end):void 0,O=R?qt(R):void 0,_=k?qt(k):void 0,H=A.slice(m.index+2);if(!(!R||!k||!O||!_||H.length===0))return{sourceCenter:f(R,O),targetCenter:f(k,_),sourceRect:O,tail:H}},"sourceDetourContextFor"),v=d((m,S,A,R,k,O)=>{const _=R.y>=A.y,H=_?k.bottom:k.top,P=H+(_?20:-20);if(_&&m.b.y<=P+.001||!_&&m.b.y>=P-.001)return;const G=m.a.x+S;return pt([{x:A.x,y:H},{x:A.x,y:P},{x:G,y:P},{x:G,y:m.b.y},...O],.001)},"verticalSourceDetour"),M=d((m,S,A,R,k,O)=>{const _=R.x>=A.x,H=_?k.right:k.left,P=H+(_?20:-20);if(_&&m.b.x<=P+.001||!_&&m.b.x>=P-.001)return;const G=m.a.y+S;return pt([{x:H,y:A.y},{x:P,y:A.y},{x:P,y:G},{x:m.b.x,y:G},...O],.001)},"horizontalSourceDetour"),E=d((m,S)=>{const A=y(m);if(A){if(m.vertical)return v(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail);if(m.horizontal)return M(m,S,A.sourceCenter,A.targetCenter,A.sourceRect,A.tail)}},"sourceDetourCandidate"),T=[-7,7,-14,14,-21,21];for(let m=0;m<12;m++){const S=x();let A=!1;for(let R=0;RP.interior);for(const P of H){for(const G of T){const j=p(P,G);if(j&&u(P.edge,j)){P.edge.points=j,A=!0;break}const J=E(P,G);if(J&&u(P.edge,J)){P.edge.points=J,A=!0;break}}if(A)break}}if(!A)return}}d(jn,"nudgeSharedInteriorSubpaths");function ws(t,e,n,o){const s=e.x-t.x,r=e.y-t.y,i=o.x-n.x,c=o.y-n.y,a=s*c-r*i;if(Math.abs(a)<1e-10)return!1;const l=n.x-t.x,g=n.y-t.y,x=(l*c-g*i)/a,I=(l*r-g*s)/a,u=.01;return x>u&&x<1-u&&I>u&&I<1-u}d(ws,"segmentsIntersect");function As(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const s=es(e),r=[];for(const c of n){if(c.isLayoutOnly)continue;const a=c.points;if(!a||a.length<2)continue;const l=c.start,g=c.end,x=c.labelNodeId,I=c.id??`${l}->${g}`;for(const u of s)if(!(u.nodeId===l||u.nodeId===g)&&!(x&&u.nodeId===x)){for(let p=0;p0){const c=o.filter(l=>l.type==="edge-node-overlap").length,a=o.filter(l=>l.type==="edge-edge-crossing").length;Ke.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${c} edge-node overlap(s), ${a} edge crossing(s)`);for(const l of o)Ke.warn(`[SWIMLANE_VALIDATE] ${l.type}: ${l.detail}`)}return o}d(As,"validateSwimlanesLayout");function Rs(t,e){const n=t.nodes??[],o=t.edges??[],s=n.filter(c=>!c.isGroup);if((e==="LR"||e==="RL")&&s.length>0&&!ms(t,e)||e==="BT"&&s.length>0&&!ps(t))return;for(const c of o){if(c.isLayoutOnly)continue;const a=c.points;!a||a.length<2||(c.points=ae(Qe(a)))}Ls(o,n),Ts(o,n),ys(o,n);const r=new Map;for(const c of n)r.set(String(c.id),c);Ue(o,r),is(o,r),xs(o,r),jn(o,r),bs(o,r),Ms(o,r),Xn(o,r),Is(o,r);const i=d(()=>{vs(o,r),Ss(o,r),Cs(o,r),Ue(o,r),Dn(o,r),Xn(o,r),Ue(o,r),Dn(o,r)},"finalizeRenderedEdges");i(),jn(o,r),i(),Yn(o,r),Gn(o,r),Yn(o,r),Gn(o,r)}d(Rs,"postProcessSwimlaneLayout");function ye(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const i=`${r.id}:${r.src}->${r.dst}`;n.has(i)||(n.add(i),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}d(ye,"normalizeGraph");function mo(t,e){return t.edges.filter(n=>n.dst===e)}d(mo,"incoming");function Ns(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}d(Ns,"buildSuccessorMap");function yo(t){const e=Ns(t);for(const n of e.values())n.sort((o,s)=>o.localeCompare(s));return e}d(yo,"buildSortedSuccessorMap");function xo(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}d(xo,"buildInDegreeMap");function bo(t){return[...t.entries()].filter(([,e])=>e===0).map(([e])=>e).sort((e,n)=>e.localeCompare(n))}d(bo,"sortedZeroInDegreeNodes");function ln(t,e=()=>!0){const n=new Map,o=new Map;for(const s of t.nodes)n.set(s,[]),o.set(s,[]);for(const s of t.edges)e(s)&&(o.get(s.src).push(s.dst),n.get(s.dst).push(s.src));return{preds:n,succs:o}}d(ln,"buildPredecessorSuccessorMaps");function Mo(t,e,n,o){let s=0;for(const i of t.nodes)o?.skipGroups&&t.nodeById.get(i)?.isGroup||(s=Math.max(s,n[i]??0));const r=Array.from({length:s+1},()=>[]);for(const i of e)o?.skipGroups&&t.nodeById.get(i)?.isGroup||r[Math.max(0,n[i]??0)].push(i);return r}d(Mo,"buildLayersFromRanks");function Be(t){const e=xo(t),n=bo(e),o=[],s=yo(t);for(;n.length;){const r=n.shift();o.push(r);for(const i of s.get(r)??[])if(e.set(i,(e.get(i)??0)-1),(e.get(i)??0)===0){let c=0;for(;c{if(s-o<=1)return 0;const r=o+s>>1;let i=n(o,r)+n(r,s),c=o,a=r,l=o;for(;c=s||cx.dst===I.dst?x.id.localeCompare(I.id):x.dst.localeCompare(I.dst));const o=Object.create(null);for(const g of e.nodes)o[g]=0;const s=[],r=d(g=>{o[g]=1;for(const x of n.get(g)??[]){const I=x.dst;o[I]===0?r(I):o[I]===1&&s.push(x)}o[g]=2},"dfs"),i=[...e.nodes].sort((g,x)=>g.localeCompare(x));for(const g of i)o[g]===0&&r(g);const c=new Set(s.map(g=>`${g.id}:${g.src}->${g.dst}`)),a=e.edges.map(g=>c.has(`${g.id}:${g.src}->${g.dst}`)?{id:g.id,src:g.dst,dst:g.src,weight:g.weight,ref:g.ref}:g);return{acyclic:{nodes:[...e.nodes],edges:a,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:s}}d(Os,"removeCycles_DFS");function Ps(t){const e=new Map,n=d(o=>{if(e.has(o))return e.get(o);const s=t.nodeById.get(o);if(!s)return e.set(o,null),null;const r=s.parentId;if(!r)return e.set(o,null),null;const c=n(r)??r;return e.set(o,c),c},"resolve");for(const o of t.nodes)n(o);return e}d(Ps,"buildTopLaneMap");function fe(t){const e=Ps(t);return n=>e.get(n)??null}d(fe,"createTopLaneResolver");function fn(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}d(fn,"buildTopLaneOrder");function So(t,e){const n=fn(t);if(!e||e.length===0)return n;const o=new Set(n),s=new Set,r=[];for(const i of e)!o.has(i)||s.has(i)||(s.add(i),r.push(i));for(const i of n)s.has(i)||r.push(i);return r}d(So,"resolveTopLaneOrder");var Jr={EPSILON:1e-6},sn={GRAVITY_ITERATIONS:8,MAX_CROSSING_OPTIMIZATION_PASSES:4,DEFAULT_COMPACT_SINGLE_INPUT:!0},ko={DEFAULT_LAYER_GAP:100,DEFAULT_NODE_GAP:40};function Bs(t,e){const n=ye(t),o=e?.laneOf??(()=>null),s=e?.rankHint,{preds:r}=ln(n);for(const m of r.values())m.sort((S,A)=>S.localeCompare(A));const i=Be(n)??[...n.nodes].sort((m,S)=>m.localeCompare(S)),c=new Map;for(const[m,S]of i.entries())c.set(S,m);const a=new Map,l=new Map;for(const m of n.nodes)l.set(m,[]);for(const m of i){const S=(r.get(m)??[]).filter(A=>a.has(A));if(S.length>0){const A=ks(m,S,{laneOf:o,rankHint:s,topoIndex:c});a.set(m,A),l.get(A).push(m)}else a.has(m)||a.set(m,null)}for(const m of n.nodes)a.has(m)||a.set(m,null);const g=new Set;for(const m of n.nodes)(a.get(m)??null)===null&&g.add(m);const x=[...g].sort((m,S)=>{const A=c.get(m)??0,R=c.get(S)??0;return A===R?m.localeCompare(S):A-R}),I=_s(n),u=new Map;for(const[m,S]of I.entries())u.set(m,[...S].sort((A,R)=>A.localeCompare(R)));const p=Fs(u),f=Ds(u),y=new Map;for(const m of n.nodes)y.set(m,[]);for(const m of f)for(const S of m.nodes){const A=y.get(S);A?A.push(m.id):y.set(S,[m.id])}const v=[],M=[],E=new Set,T=d(m=>{if(!E.has(m)){E.add(m),v.push(m);for(const S of l.get(m)??[])T(S);M.push(m)}},"walk");for(const m of x)T(m);for(const m of i)T(m);return{parent:a,children:l,roots:x,componentOf:p,blocks:f,nodeBlocks:y,adjacency:u,preorder:v,postorder:M,topologicalOrder:i}}d(Bs,"buildDrivingTree");function ks(t,e,n){const o=n.laneOf(t);return[...e].sort((r,i)=>{const c=n.laneOf(r),a=n.laneOf(i),l=c!=null&&c===o,g=a!=null&&a===o;if(l!==g)return l?-1:1;const x=n.rankHint?.[r],I=n.rankHint?.[i];if(x!=null&&I!=null&&x!==I)return I-x;const u=n.topoIndex.get(r)??0,p=n.topoIndex.get(i)??0;return u!==p?u-p:r.localeCompare(i)})[0]}d(ks,"chooseParent");function _s(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}d(_s,"buildAdjacency");function Fs(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const s=[o];for(;s.length>0;){const r=s.pop();if(!e.has(r)){e.set(r,n);for(const i of t.get(r)??[])e.has(i)||s.push(i)}}n++}return e}d(Fs,"assignComponents");function Ds(t){const e=new Map,n=new Map,o=[],s=[];let r=0;const i=d((c,a)=>{e.set(c,++r),n.set(c,r);for(const l of t.get(c)??[])l!==a&&(e.has(l)?(e.get(l)??0)<(e.get(c)??0)&&(o.push([c,l]),n.set(c,Math.min(n.get(c)??r,e.get(l)??r))):(o.push([c,l]),i(l,c),n.set(c,Math.min(n.get(c)??r,n.get(l)??r)),(n.get(l)??0)>=(e.get(c)??0)&&s.push(Hs(c,l,o,s.length))))},"visit");for(const c of t.keys())e.has(c)||i(c,null);return s}d(Ds,"computeBlocks");function Hs(t,e,n,o){const s=[],r=new Set;for(;n.length>0;){const i=n.pop();if(s.push(i),r.add(i[0]),r.add(i[1]),i[0]===t&&i[1]===e||i[0]===e&&i[1]===t)break}return{id:o,edges:s,nodes:[...r]}}d(Hs,"popBlock");function Xs(t,e,n){const o=[...t.nodes],s=new Map;for(const[M,E]of o.entries())s.set(E,M);const r=o.length,i=new Array(r).fill(-1),c=new Array(r).fill(0),a=[],l=new Set;for(const M of o){const E=n.parent.get(M)??null,T=s.get(M);T!=null&&E==null&&(i[T]=-1,c[T]=0,l.has(M)||(l.add(M),a.push(M)))}for(;a.length>0;){const M=a.shift(),E=s.get(M);if(E==null)continue;const T=n.children.get(M)??[];for(const m of T){if(l.has(m))continue;const S=s.get(m);S!=null&&(i[S]=E,c[S]=c[E]+1,l.add(m),a.push(m))}}for(const M of o){if(l.has(M))continue;const E=s.get(M);E!=null&&(i[E]=-1,c[E]=0,l.add(M))}const g=Math.max(1,Math.ceil(Math.log2(Math.max(1,r)))+1),x=Array.from({length:g},()=>new Array(r).fill(-1));for(let M=0;M{if(M===-1||E===-1)return-1;c[M]>m&1&&(M=x[m][M],M===-1))return-1;if(M===E)return M;for(let m=g-1;m>=0;m--){const S=x[m][M],A=x[m][E];S===-1||A===-1||S!==A&&(M=S,E=A)}return x[0][M]},"lcaIndex"),u=Array.from({length:r},()=>new Map);for(const M of t.edges){let E=M.src,T=M.dst,m=e[E],S=e[T];if(m==null||S==null||(m>S&&([E,T]=[T,E],[m,S]=[S,m]),m==null||S==null||m===S))continue;const A=s.get(E),R=s.get(T);if(A==null||R==null)continue;const k=I(A,R);if(k===-1)continue;const O=u[k];for(let _=m;_{if(E.size!==0)for(const[T,m]of E)M.set(T,(M.get(T)??0)+m)},"mergeInto"),y=new Set,v=d(M=>{const E=s.get(M);y.add(M);const T=E==null?void 0:u[E],m=T?new Map(T):new Map,S=n.children.get(M)??[];for(const A of S){const R=v(A),k=e[M];if(k!=null){let O=p.get(M);O||(O=new Map,p.set(M,O));let _=R.get(k)??0;const H=e[A];H!=null&&H>k&&(_+=1),O.set(A,_)}f(m,R)}return m},"dfs");for(const M of n.roots)y.has(M)||v(M);for(const M of o)y.has(M)||v(M);return p}d(Xs,"computeSubtreeCrossCounts");function Ys(t,e,n){const o=new Map,s=d(r=>{let i=n[r]??0;const c=[...e.get(r)??[]];c.sort(Co(n));for(const a of c){s(a);const l=o.get(a);l!=null&&(i=Math.min(i,l))}o.set(r,i)},"annotate");for(const r of t)s(r);return o}d(Ys,"annotateMinimumLayers");function Co(t){return(e,n)=>{const o=t[e]??0,s=t[n]??0;return o===s?e.localeCompare(n):o-s}}d(Co,"compareByRankThenId");function Gs(t,e,n,o){let s=0;for(const a of e){const l=n[a]??0;l>s&&(s=l)}const r=Array.from({length:s+1},()=>[]),i=new Set,c=d(a=>{if(i.has(a))return;i.add(a);const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a);for(const g of o(a))c(g)},"emit");for(const a of t)c(a);for(const a of e)if(!i.has(a)){const l=n[a]??0;r[l]||(r[l]=[]),r[l].push(a),i.add(a)}return r}d(Gs,"emitNodesInTreeOrder");function $s(t){const e=[];for(const n of t){const o=new Set,s=[];for(const r of n)o.has(r)||(o.add(r),s.push(r));e.push(s)}return e}d($s,"deduplicateLayers");function zs(t,e,n,o){return s=>{const r=t.get(s)??[];if(r.length===0)return[];const i=e[s]??0,c=[],a=[],l=n.get(s);for(const g of r){const x=o.get(g)??i;x>i?c.push({child:g,min:x}):a.push(g)}return c.sort((g,x)=>g.min===x.min?g.child.localeCompare(x.child):g.min-x.min),a.sort((g,x)=>{const I=l?.get(g)??0,u=l?.get(x)??0;if(I!==u)return I-u;const p=o.get(g)??i,f=o.get(x)??i;return p!==f?p-f:g.localeCompare(x)}),[...c.map(g=>g.child),...a]}}d(zs,"createChildOrderer");function rn(t,e,n){const o=Bs(t,{rankHint:e,laneOf:n}),{children:s,roots:r}=o;for(const x of t.nodes)s.has(x)||s.set(x,[]);const i=Xs(t,e,o),c=[...r].sort(Co(e)),a=Ys(c,s,e),l=zs(s,e,i,a);let g=Gs(c,t.nodes,e,l);return g=$s(g),g}d(rn,"buildMultitreeLayerOrder");function Vs(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(e),i=[];for(const c of n)o.has(c.src)&&s.has(c.dst)&&i.push(r.get(c.dst));return Io(i)}d(Vs,"countCrossingsBetweenAdjacent");function Un(t,e,n){const o=[];for(const r of e){const i=n[r.src],c=n[r.dst];if(i==null||c==null||i===c)continue;let a=r.src,l=r.dst,g=i,x=c;i>c&&(a=r.dst,l=r.src,g=c,x=i);for(let I=g;I(n[I]??0)-(n[x]??0));for(const x of g){const I=n[x]??0;if(I===0)continue;let u=0;for(const v of o.get(x)??[])u=Math.max(u,(n[v]??0)+1);if(u>=I)continue;const p=I;n[x]=u;const f=rn(t,n,s),y=Un(f,t.edges,n);y(e[s]??0)-(e[r]??0)||s.localeCompare(r));for(const s of o){const r=n(s);if(!r)continue;const i=t.edges.filter(f=>f.src===s);if(i.length===0)continue;let c=!1,a=0;for(const f of i){const y=n(f.dst);y==null||y===r?c=!0:a++}if(a===0||c)continue;let l=0,g=!1;for(const f of t.edges){if(f.dst!==s)continue;const y=n(f.src);y&&(y===r?g=!0:l++)}if(l>0||!g)continue;const x=e[s]??0,I=x+a;let u=0;for(const f of t.edges)f.dst===s&&(u=Math.max(u,(e[f.src]??0)+1));const p=Math.max(x,u,I);p!==x&&(e[s]=p)}}d(Us,"adjustCrossLaneSources");function Ws(t,e){const n=ye(t),o=Be(n)??[...n.nodes].sort(),s=e?.compactSingleInput??!1,r=fe(n);let i=Object.create(null);for(const a of o){const l=mo(n,a),g=e?.ignoreCrossLaneEdges?l.filter(x=>{const I=r(x.src),u=r(a);return!I||!u?!0:I===u}):l;if(g.length===0)i[a]=0;else if(s&&g.length===1){const x=g[0].src,I=r(x),u=r(a);I!==u?i[a]=i[x]??0:i[a]=(i[x]??0)+1}else{let x=-1/0;for(const I of g)x=Math.max(x,(i[I.src]??0)+1);i[a]=x===-1/0?0:x}}return(e?.optimizeRanksByCrossings??!1)&&(i=js(n,i)),e?.ignoreCrossLaneEdges&&Us(n,i),{layers:rn(n,i,r),rankOf:i,dummy:new Set}}d(Ws,"assignLayers_LongestPath");function Ks(t,e){const n=ye(t),s={...Ws(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=fe(n),{preds:i,succs:c}=ln(n,p=>{if(e?.ignoreCrossLaneEdges){const f=r(p.src),y=r(p.dst);if(f&&y&&f!==y)return!1}return!0}),a=Be(n)??[...n.nodes],l=[...a].reverse(),g=d((p,f)=>{let y=0;for(const E of i.get(p)??[])y=Math.max(y,(s[E]??0)+1);let v=Number.POSITIVE_INFINITY;const M=c.get(p)??[];return M.length>0&&(v=Math.min(...M.map(E=>(s[E]??0)-1))),Number.isFinite(v)||(v=Math.max(y,f)),Math.min(Math.max(f,y),v)},"clampFeasible"),x=sn.GRAVITY_ITERATIONS,I=d(p=>{let f=!1;for(const y of p){const v=i.get(y)??[],M=c.get(y)??[];if(v.length===0&&M.length===0)continue;const E=v.length>0?v.reduce((A,R)=>A+(s[R]??0)+1,0)/v.length:s[y]??0,T=M.length>0?M.reduce((A,R)=>A+(s[R]??0)-1,0)/M.length:s[y]??0,m=Math.round((E+T)/2),S=g(y,m);S!==s[y]&&(s[y]=S,f=!0)}return f},"relaxOrder");for(let p=0;p0){const y=Math.min(...f.map(v=>(s[v]??0)-1));(s[p]??0)>y&&(s[p]=y)}}return{layers:Mo(n,a,s),rankOf:s,dummy:new Set}}d(Ks,"assignLayers_Gravity");function qs(t){const e=xo(t),n=yo(t);let o=bo(e);const s=[];for(;o.length>0;){const r=[];for(const i of o){s.push(i);for(const c of n.get(i)??[])e.set(c,(e.get(c)??0)-1),(e.get(c)??0)===0&&r.push(c)}o=r.sort((i,c)=>i.localeCompare(c))}return s.length===t.nodes.length?s:null}d(qs,"topoSortByGenerationIfAcyclic");function Js(t,e){const n=ye(t),o=e?.direction==="LR"?qs(n)??[...n.nodes].sort():Be(n)??[...n.nodes].sort(),s=fe(n),r=d(g=>s(g)??g,"laneOf"),i=Object.create(null),c=new Map,a=d((g,x)=>e?.ignoreCrossLaneEdges??!0?r(g)===r(x)?1:0:1,"edgeWeight");for(const g of o){if(n.nodeById.get(g)?.isGroup)continue;const I=mo(n,g);let u=0;if(I.length>0)for(const v of I){const M=v.src,E=i[M]??0;u=Math.max(u,E+a(M,g))}const p=r(g),f=c.get(p)??0,y=Math.max(u,f);i[g]=y,c.set(p,y+1)}return{layers:Mo(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}d(Js,"assignLayers_LaneAwareCompact");function Zs(t,e){const n=ye(e),{rankOf:o}=t,s=t.layers.map(u=>[...u]),r=new Set(t.dummy?[...t.dummy]:[]);let i=0;const c=new Map(n.nodeById),a=d(u=>{const p=`placeholder-${i++}`,f={id:p,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(p,f),r.add(p);s.length<=u;)s.push([]);return s[u].push(p),o[p]=u,p},"addDummyAt"),l=[...n.edges].sort((u,p)=>u.id===p.id?u.src===p.src?u.dst.localeCompare(p.dst):u.src.localeCompare(p.src):u.id.localeCompare(p.id)),g=[];for(const u of l){const p=o[u.src]??0,f=o[u.dst]??0;if(f-p<=1){g.push(u);continue}let y=u.src;for(let M=p+1,E=0;M!n.nodes.includes(u))],edges:g,layout:n.layout,nodeById:c};return{layering:{layers:s,rankOf:o,dummy:r},graphWithDummies:I}}d(Zs,"makeProperLayering");function Wn(t){const e=t.length;if(e===0)return Number.POSITIVE_INFINITY;const n=[...t].sort((o,s)=>o-s);return e%2===1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}d(Wn,"median");function Kn(t){return t.length===0?Number.POSITIVE_INFINITY:t.reduce((n,o)=>n+o,0)/t.length}d(Kn,"barycenter");function Qs(t,e,n,o){const s=new Map;for(const r of t)s.set(r,[]);for(const r of n)o==="down"?e.has(r.src)&&s.has(r.dst)&&s.get(r.dst).push(e.get(r.src)):e.has(r.dst)&&s.has(r.src)&&s.get(r.src).push(e.get(r.dst));return s}d(Qs,"neighborPositionsFor");function tr(t,e,n){const o=n.get(t)??0,s=n.get(e)??0;return o!==s?o-s:t.localeCompare(e)}d(tr,"currentOrderTieBreak");function qn(t,e,n){const o=new Set(t),s=new Set(e),r=Ne(t),i=Ne(e),c=[];for(const l of n)o.has(l.src)&&s.has(l.dst)&&c.push({u:r.get(l.src),v:i.get(l.dst)});c.sort((l,g)=>l.u===g.u?l.v-g.v:l.u-g.u);const a=c.map(l=>l.v);return Io(a)}d(qn,"countCrossingsBetweenAdjacent");function We(t,e,n){return[...t].sort((o,s)=>{const r=Wn(e.get(o)??[]),i=Wn(e.get(s)??[]);return r===i?tr(o,s,n):isFinite(r)?isFinite(i)?r-i:-1:1})}d(We,"sortByHeuristic");function Jn(t,e,n,o,s,r){const i=Ne(t),c=Ne(e),a=Qs(e,i,n,o);if(!s||!r||r.length===0)return We(e,a,c);const l=new Map;for(const I of e){const u=s(I),p=l.get(u)??[];p.push(I),l.set(u,p)}const g=[];for(const I of r){const u=l.get(I);if(!u||u.length===0)continue;const p=We(u,a,c);g.push(...p)}const x=l.get(null);if(x&&x.length>0){const I=We(x,a,c);for(const u of I){const p=Kn(a.get(u)??[]);let f=g.length;if(isFinite(p))for(const[y,v]of g.entries()){const M=Kn(a.get(v)??[]);if(pi.has(f.src)&&c.has(f.dst)),g=a?n.filter(f=>c.has(f.src)&&a.has(f.dst)):void 0,x=d(f=>{let y=qn(t,f,l);return g&&o&&(y+=qn(f,o,g)),y},"crossingScore"),I=s?new Map:null;if(s&&I)for(const f of e)I.set(f,s(f));let u=!0,p=x(r);for(;u;){u=!1;for(let f=0;f+1[...c]),s=e.edges,r=fe(e),i=So(e,n?.laneOrder);for(let c=0;c<3;c++){for(let a=1;a=0;a--)o[a]=Jn(o[a+1],o[a],s,"up",r,i),o[a]=Zn(o[a+1],o[a],s,o[a-1],r)}return{layers:o}}d(er,"orderLayers");function nr(t,e,n){const o=n?.layerGap??ko.DEFAULT_LAYER_GAP,s=n?.nodeGap??ko.DEFAULT_NODE_GAP,r=n?.laneGap??s*2,i=n?.direction??"TB",c=i==="LR"||i==="RL",a=t.layers,l=Object.create(null),g=Object.create(null),x=d(O=>e.nodeById.get(O),"getNode"),I=d(O=>x(O)?.width??0,"getWidth"),u=d(O=>x(O)?.height??0,"getHeight"),p=fe(e),f=So(e,n?.laneOrder),y=a.map(O=>O.reduce((_,H)=>Math.max(_,u(H)),0)),v=[];if(c)for(let O=0;O+1Math.max(mt,I(kt)),0),H=a[O+1].reduce((mt,kt)=>Math.max(mt,I(kt)),0),P=y[O],G=y[O+1],j=P/2+G/2,J=(_+H)/2,dt=Math.max(0,J-j-o);v.push(dt)}const M=new Set;for(const O of a)for(const _ of O)M.add(p(_));const E=M.has(null),T=f.filter(O=>M.has(O)),m=[...E?[null]:[],...T],S=Object.create(null);for(const O of T)S[O]=0;E&&(S.null=0);for(const O of a){const _=Object.create(null),H=[];for(const P of O){const G=p(P);G===null?H.push(P):(_[G]||=[]).push(P)}for(const[P,G]of Object.entries(_)){const j=G.reduce((J,dt)=>J+I(dt),0)+s*Math.max(0,G.length-1);S[P]=Math.max(S[P]??0,j)}if(E&&H.length){const P=H.reduce((G,j)=>G+I(j),0)+s*Math.max(0,H.length-1);S.null=Math.max(S.null??0,P)}}const A=new Map;{const O=m.map(P=>(P===null?S.null:S[P])??0);let H=-(O.reduce((P,G)=>P+G,0)+r*Math.max(0,m.length-1))/2;for(let P=0;PI(Q)),kt=mt.reduce((Q,W)=>Q+W,0)+s*(J.length-1);let Pt=dt-kt/2;for(const[Q,W]of J.entries()){const et=mt[Q];l[W]=Pt+et/2,g[W]=R+H/2,Pt+=et+s}}}const G=v[O]??0;R+=H+o+G}const k=new Map;for(const O of e.edges){const _=O.ref.id;k.has(_)||k.set(_,[]),k.get(_).push(O)}for(const[,O]of k){if(O.length===0)continue;const _=O[0].ref,H=_.start,P=_.end;if(H==null||P==null)continue;const G=Math.round(((l[H]??0)+(l[P]??0))/2),j=new Set;for(const J of O)j.add(J.src),j.add(J.dst);for(const J of j){if(J===H||J===P)continue;e.nodeById.get(J)?.isDummy&&(l[J]=G)}}return{x:l,y:g}}d(nr,"assignCoordinates");var or=8;function sr(t){let e=2166136261;for(let n=0;n>>0}d(sr,"hashString");function rr(t){let e=t>>>0;return()=>{e+=1831565813;let n=e;return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}d(rr,"mulberry32");function ir(t,e){const n=[...t],o=rr(e);for(let s=n.length-1;s>0;s--){const r=Math.floor(o()*(s+1));[n[s],n[r]]=[n[r],n[s]]}return n}d(ir,"deterministicShuffle");function cr(t,e){let n=0;for(const[o,s]of t.entries())n+=Math.abs(o-(e.get(s)??o));return n}d(cr,"sourceDistance");function Qn(t,e){const n=new Map;for(const[s,r]of t.entries())n.set(r,s);let o=0;for(const{a:s,b:r,weight:i}of e){const c=n.get(s),a=n.get(r);c==null||a==null||(o+=i*Math.abs(c-a))}return o}d(Qn,"laneArrangementCost");function ar(t){const e=fn(t);if(e.length<2)return[];const n=new Map(e.map((r,i)=>[r,i])),o=fe(t),s=new Map;for(const r of t.layout.edges??[]){if(r.isLayoutOnly)continue;const i=typeof r.start=="string"?r.start:void 0,c=typeof r.end=="string"?r.end:void 0;if(!i||!c||!t.nodeById.has(i)||!t.nodeById.has(c))continue;const a=o(i),l=o(c);if(!a||!l||a===l)continue;const g=n.get(a),x=n.get(l);if(g==null||x==null)continue;const[I,u]=g<=x?[a,l]:[l,a],p=`${I}\0${u}`,f=s.get(p);f?f.weight++:s.set(p,{a:I,b:u,weight:1})}return[...s.values()]}d(ar,"buildWeightedLaneEdges");function to(t,e,n){const o=[...t];let s=Qn(o,e),r=!0,i=0;const c=Math.max(1,o.length);for(;r&&is.a===r.a?s.b.localeCompare(r.b):s.a.localeCompare(r.a)).map(({a:s,b:r,weight:i})=>`${s}:${r}:${i}`).join("|");return sr(`${t.join("|")}#${o}#${n}`)}d(fr,"seedForRestart");function dr(t,e={}){const n=fn(t);if(n.length<2)return n;const o=ar(t);if(o.length===0)return n;const s=new Map(n.map((c,a)=>[c,a]));let r=to(n,o,s);const i=Math.max(0,e.restarts??or);for(let c=0;cct&&a*3>=c?i>0?"bottom":"top":c>ct?r>0?"right":"left":n}d(eo,"chooseOrthogonalSide");function no(t,e){return Math.abs(t.to-e.from)h.isGroup&&!h.parentId);for(const h of l){const b={id:h.id},C=d(L=>{i.set(L.id,b),n.filter(w=>w.parentId===L.id).forEach(C)},"assignLane");C(h)}const g=n.filter(h=>!h.isGroup&&!h.isEdgeLabel).map(h=>{const b=h.width??10,C=h.height??10,L=h.x??0,w=h.y??0,B=Zr;return{nodeId:h.id,minX:L-b/2-B,maxX:L+b/2+B,minY:w-C/2-B,maxY:w+C/2+B,visualXHalfExtent:a?C/2+B:b/2+B}}),x=d((h,b,C,L)=>{let w=c.find(B=>B.orientation===h&&Math.abs(B.coord-b)<1);return w||(w={id:`pipe-${h}-${b.toFixed(0)}`,orientation:h,coord:b,spanMin:C,spanMax:L,tracks:[]},c.push(w)),w.spanMin=Math.min(w.spanMin,C),w.spanMax=Math.max(w.spanMax,L),w},"getOrAddPipe"),I=d((h,b)=>{const C=h.width??10,L=h.height??10,w=h.x??0,B=h.y??0;switch(b){case"top":return{x:w,y:B-L/2};case"bottom":return{x:w,y:B+L/2};case"left":return{x:w-C/2,y:B};case"right":return{x:w+C/2,y:B}}},"portForSide"),u=d((h,b,C)=>I(h,eo(h,b,C?"bottom":"top")),"getOrthogonalPort"),p=[],f=[],y=new Set,v=1e3,M=d((h,b,C)=>{if(p.length===0)return 0;const L=Math.abs(b.y-C.y)z||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}else if(w){const U=b.x,q=Math.min(b.y,C.y)-ct,z=Math.max(b.y,C.y)+ct;if(z<=q)return 0;for(const Y of p)Y.edgeIndex===h||Y.orientation!=="horizontal"||Y.pipe.coordz||Y.from-ct<=U&&Y.to+ct>=U&&(B+=v)}return B},"crossingPenalty"),E=s.map((h,b)=>{if(!h.start||!h.end)return{idx:b,crossLane:0,dx:0,dy:0};const C=r.get(h.start),L=r.get(h.end),w=i.get(h.start),B=i.get(h.end),U=w&&B&&w.id!==B.id?1:0,q=C&&L?Math.abs((L.x??0)-(C.x??0)):0,z=C&&L?Math.abs((L.y??0)-(C.y??0)):0;return{idx:b,crossLane:U,dx:q,dy:z}}).sort((h,b)=>{if(h.crossLane!==b.crossLane)return b.crossLane-h.crossLane;const C=h.dx+h.dy,L=b.dx+b.dy;return Math.abs(C-L)>1?C-L:h.idx-b.idx}).map(h=>h.idx),T=d((h,b,C,L)=>{const w=Math.min(h.x,b.x),B=Math.max(h.x,b.x),U=Math.min(h.y,b.y),q=Math.max(h.y,b.y);return!!g.find(Y=>C&&Y.nodeId===C||L&&Y.nodeId===L?!1:Math.abs(h.x-b.x)>ct?Y.minYh.y&&Y.maxX>w&&Y.minXh.x&&Y.maxY>U&&Y.minYeo(h,b,"bottom"),"determineSide"),R=new Map;for(const[h,b]of s.entries()){if(!b.start||!b.end||b.start===b.end||b.points&&b.points.length>0)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const w=(L.x??0)-(C.x??0),B=(L.y??0)-(C.y??0);R.set(h,{edgeIdx:h,srcId:b.start,dstId:b.end,srcSide:A(C,{x:L.x??0,y:L.y??0}),dstSide:A(L,{x:C.x??0,y:C.y??0}),absDx:Math.abs(w),absDy:Math.abs(B),dxSign:Math.sign(w),dySign:Math.sign(B)})}const k=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.absDx===0?1/0:h.absDy/h.absDx:h.absDy===0?1/0:h.absDx/h.absDy,"preferenceStrength"),O=d(h=>h.srcSide==="top"||h.srcSide==="bottom"?h.dxSign>=0?"right":"left":h.dySign>=0?"bottom":"top","secondarySide"),_=new Map;for(const h of R.values()){const b=`${h.srcId}:${h.srcSide}`;_.has(b)||_.set(b,[]),_.get(b).push(h)}const H=new Map,P=d((h,b)=>`${h}:${b}`,"loadKey");for(const h of R.values())H.set(P(h.srcId,h.srcSide),(H.get(P(h.srcId,h.srcSide))??0)+1),H.set(P(h.dstId,h.dstSide),(H.get(P(h.dstId,h.dstSide))??0)+1);for(const h of _.values())if(!(h.length<2)){h.sort((b,C)=>{const L=k(b),w=k(C);return Math.abs(L-w)>1e-9?w-L:b.edgeIdx-C.edgeIdx});for(let b=1;b=w||(H.set(P(C.srcId,C.srcSide),w-1),H.set(P(C.srcId,L),B+1),C.srcSide=L)}}const G=d(h=>{const b=h?.shape;return b==="question"||b==="diamond"},"isDiamondNode"),j=new Map;for(const h of R.values())j.has(h.dstId)||j.set(h.dstId,new Set),j.get(h.dstId).add(h.dstSide);for(const h of R.values()){if(!G(r.get(h.srcId)))continue;const b=j.get(h.srcId);if(!b?.has(h.srcSide))continue;const C=O(h);if(b.has(C)||(H.get(P(h.srcId,C))??0)>0)continue;const L=H.get(P(h.srcId,h.srcSide))??0;H.set(P(h.srcId,h.srcSide),Math.max(0,L-1)),H.set(P(h.srcId,C),1),h.srcSide=C}for(const h of R.values()){const{edgeIdx:b,srcId:C,dstId:L,srcSide:w,dstSide:B}=h,U=r.get(C),q=r.get(L),z=`${C}:${w}:src`,Y=w==="top"||w==="bottom"?q.x??0:q.y??0;m.has(z)||m.set(z,[]),m.get(z).push({edgeIdx:b,oppositeCoord:Y});const ot=`${L}:${B}:dst`,rt=B==="top"||B==="bottom"?U.x??0:U.y??0;m.has(ot)||m.set(ot,[]),m.get(ot).push({edgeIdx:b,oppositeCoord:rt})}const J=new Map,dt=8;for(const[h,b]of m){if(b.length<2)continue;b.sort((Lt,Dt)=>Lt.oppositeCoord-Dt.oppositeCoord);const C=h.split(":"),L=C.slice(0,-2).join(":"),w=C[C.length-2],B=C[C.length-1],U=r.get(L);if(!U)continue;const z=w==="left"||w==="right"?U.height??10:U.width??10,Y=U.shape,rt=Y==="question"||Y==="diamond"?z*.3:z,tt=Math.min(20,Math.max(dt,rt/(b.length+1))),Rt=-(tt*(b.length-1))/2;for(const[Lt,Dt]of b.entries()){const Jt=Rt+Lt*tt,gn=`${Dt.edgeIdx}:${B}`;J.set(gn,Jt)}}const mt=d(h=>!!s[h]?.labelNodeId,"edgeHasLabelNode"),kt=d((h,b)=>h?(m.get(`${h}:${b}:src`)??[]).some(({edgeIdx:C})=>mt(C))||(m.get(`${h}:${b}:dst`)??[]).some(({edgeIdx:C})=>mt(C)):!1,"faceHasLabelNode"),Pt=d((h,b,C)=>b==="top"||b==="bottom"?{x:h.x+C,y:h.y}:{x:h.x,y:h.y+C},"applyPortOffset"),Q=d((h,b,C)=>{const L=R.get(h),w={x:C.x??0,y:C.y??0},B={x:b.x??0,y:b.y??0},U=L?.srcSide??A(b,w),q=L?.dstSide??A(C,B);let z=L?I(b,L.srcSide):u(b,w,!0),Y=L?I(C,L.dstSide):u(C,B,!1);const ot=J.get(`${h}:src`),rt=J.get(`${h}:dst`);return ot!==void 0&&(z=Pt(z,U,ot)),rt!==void 0&&(Y=Pt(Y,q,rt)),{pSrcPort:z,pDstPort:Y,srcSide:U,dstSide:q}},"portsForEdge");for(const h of E){const b=s[h];if(f[h]=[],!b.start||!b.end||b.points&&b.points.length>0||b.start===b.end)continue;const C=r.get(b.start),L=r.get(b.end);if(!C||!L)continue;const{pSrcPort:w,pDstPort:B,srcSide:U,dstSide:q}=Q(h,C,L),z={...w},Y={...B},ot=U==="top"||U==="bottom",rt=q==="top"||q==="bottom";if(ot){const X=w.y>(C.y??0);z.y=X?w.y+ne:w.y-ne}else{const X=w.x>(C.x??0);z.x=X?w.x+ne:w.x-ne}if(rt){const X=B.y>(L.y??0);Y.y=X?B.y+ne:B.y-ne}else{const X=B.x>(L.x??0);Y.x=X?B.x+ne:B.x-ne}const st=d((X,$)=>{for(const K of g)if(!$.includes(K.nodeId)&&X.x>K.minX&&X.xK.minY&&X.y{if(Ct){const Nt=X.y>($.y??0);return{x:(K.x??0)>=X.x?lt.maxX+be:lt.minX-be,y:Nt?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:Nt}}const bt=X.x>($.x??0),Et=(K.y??0)>=X.y;return{x:bt?lt.maxX+be:lt.minX-be,y:Et?lt.maxY+Te:lt.minY-Te,leavesPositiveSide:bt}},"obstacleDetour");let yt=[];const Rt=[b.start,b.end],Lt=st(z,Rt);if(Lt.inside&&Lt.obstacle){const X=Lt.obstacle;if(ot){const $=tt(w,C,L,X,!0);z.x=$.x,z.y=$.y;const K=$.leavesPositiveSide?Math.min(X.minY-2,w.y+ne):Math.max(X.maxY+2,w.y-ne);yt=[{x:w.x,y:K},{x:$.x,y:K},{x:$.x,y:$.y}]}else{const $=tt(w,C,L,X,!1),K=$.leavesPositiveSide?Math.min(X.minX-2,w.x+ne):Math.max(X.maxX+2,w.x-ne);z.x=$.x,z.y=$.y,yt=[{x:K,y:w.y},{x:K,y:$.y},{x:$.x,y:$.y}]}}let Dt=[];const Jt=st(Y,Rt);if(Jt.inside&&Jt.obstacle){const X=Jt.obstacle;if(rt){const $=tt(B,L,C,X,!0);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:B.x,y:$.y}]}else{const $=tt(B,L,C,X,!1);Y.x=$.x,Y.y=$.y,Dt=[{x:$.x,y:$.y},{x:$.x,y:B.y}]}}if(yt.length===0&&Dt.length===0){const X=be,$=Math.abs(z.x-Y.x)1||bt>1,Nt=S.get(b.start??"")??0,ut=S.get(b.end??"")??0,Yt=Ct>1&&kt(b.start,U)||bt>1&&kt(b.end,q),ee=Ct<=1||Nt<=2,Bt=bt<=1||ut<=2;if(($||K)&&!lt&&(!Et||Et&&!Yt&&ee&&Bt)&&!T(w,B,b.start,b.end)){b.points=[{...w},{...z},{...Y},{...B}],y.add(h);const Mt=K?"horizontal":"vertical",$t=K?w.y:w.x,It=K?Math.min(w.x,B.x):Math.min(w.y,B.y),St=K?Math.max(w.x,B.x):Math.max(w.y,B.y),Wt={id:`fast-path-${Mt}-${$t.toFixed(0)}-${h}`,orientation:Mt,coord:$t,spanMin:It,spanMax:St,tracks:[]};p.push({edgeIndex:h,segmentIndex:0,orientation:Mt,pipe:Wt,trackIndex:0,from:It,to:St});continue}}const gn=x("vertical",z.x,z.y,z.y);z.x=gn.coord;const mr=x("vertical",Y.x,Y.y,Y.y);Y.x=mr.coord;let ue=Math.min(z.x,Y.x)-50,he=Math.max(z.x,Y.x)+50,ve=Math.min(z.y,Y.y)-50,Le=Math.max(z.y,Y.y)+50;for(const X of g){const $=Math.min(z.x,Y.x),K=Math.max(z.x,Y.x),lt=Math.min(z.y,Y.y),Ct=Math.max(z.y,Y.y);X.minX$&&X.minYlt&&(ue=Math.min(ue,X.minX-je),he=Math.max(he,X.maxX+je),ve=Math.min(ve,X.minY-je),Le=Math.max(Le,X.maxY+je))}for(const X of g){if(X.maxXhe||X.maxYLe)continue;const $=be;x("horizontal",X.minY-$,ue,he),x("horizontal",X.maxY+$,ue,he);const K=Te;x("vertical",X.minX-K,ve,Le),x("vertical",X.maxX+K,ve,Le)}x("horizontal",z.y,ue,he),x("horizontal",Y.y,ue,he);const yr=c.filter(X=>X.orientation==="horizontal"&&X.coord>=ve&&X.coord<=Le),xr=c.filter(X=>X.orientation==="vertical"&&X.coord>=ue&&X.coord<=he),ke=d((X,$)=>`${X.toFixed(1)},${$.toFixed(1)}`,"getKey"),_e=ke(z.x,z.y),vo=ke(Y.x,Y.y),Fe=new Map,pn=new Map,mn=new Map,De=new Set,xe=[];Fe.set(_e,0),mn.set(_e,"n"),xe.push({key:_e,f:Math.hypot(Y.x-z.x,Y.y-z.y),pt:z}),De.add(_e);let Ht=[];const ge=d((X,$)=>T(X,$,b.start,b.end),"checkSegmentBlocked"),yn={x:Y.x,y:z.y},br=ge(z,yn),Mr=ge(yn,Y),Ir=br||Mr,xn={x:z.x,y:Y.y},Sr=ge(z,xn),Cr=ge(xn,Y);if(Ir?Sr||Cr||(Math.abs(z.x-Y.x)0;){xe.sort((ut,Yt)=>ut.f-Yt.f);const X=xe.shift();if(De.delete(X.key),X.key===vo){let ut=vo,Yt=Y;for(Ht=[Yt];pn.has(ut);){const ee=pn.get(ut);Ht.unshift(ee),Yt=ee,ut=ke(ee.x,ee.y)}break}const $=X.pt.x,K=X.pt.y,lt=xr.sort((ut,Yt)=>ut.coord-Yt.coord),Ct=lt.findIndex(ut=>Math.abs(ut.coord-$)<1),bt=yr.sort((ut,Yt)=>ut.coord-Yt.coord),Et=bt.findIndex(ut=>Math.abs(ut.coord-K)<1),Nt=[];Ct>0&&Nt.push({x:lt[Ct-1].coord,y:K}),Ct>=0&&Ct0&&Nt.push({x:$,y:bt[Et-1].coord}),Et>=0&&EtZt.nodeId===b.start||Zt.nodeId===b.end?!1:Yt!==ee?Zt.minYK&&Zt.maxX>Yt&&Zt.minX$&&Zt.maxY>Bt&&Zt.minY10&&bn<-5||Ee<-10&&bn>5)&&(St=Math.abs(bn)*100),(Wt>10&&He<-5||Wt<-10&&He>5)&&(St+=Math.abs(He)*50);let Lo=0;const Eo=mn.get(X.key)??"n",To=Math.abs(He)>ct?"h":"v";Eo!=="n"&&Eo!==To&&(Lo=50);const vr=$t+It+St+Lo,Xe=(Fe.get(X.key)??1/0)+vr,wo=Math.abs(Y.x-ut.x)+Math.abs(Y.y-ut.y);if(Xe<(Fe.get(Mt)??1/0))if(pn.set(Mt,X.pt),Fe.set(Mt,Xe),mn.set(Mt,To),!De.has(Mt))xe.push({key:Mt,f:Xe+wo,pt:ut}),De.add(Mt);else{const Zt=xe.findIndex(Lr=>Lr.key===Mt);Zt!==-1&&(xe[Zt].f=Xe+wo)}}}if(Ht.length===0&&(Ht=[z,{x:z.x,y:Y.y},Y]),Ht.length>4){const X=Ht[0],$=Ht[Ht.length-1];let K=Math.min(X.x,$.x),lt=Math.max(X.x,$.x),Ct=Math.min(X.y,$.y),bt=Math.max(X.y,$.y);for(const Bt of Ht)K=Math.min(K,Bt.x),lt=Math.max(lt,Bt.x),Ct=Math.min(Ct,Bt.y),bt=Math.max(bt,Bt.y);const Et=lt>Math.max(X.x,$.x),Nt=KIt.minXGt&&It.minYOt);if($t.length>0){let It=Math.max(X.x,$.x);for(const St of $t){const Wt=(St.minX+St.maxX)/2;if(St.visualXHalfExtent===void 0||isNaN(St.visualXHalfExtent))continue;const Ee=Wt+St.visualXHalfExtent+Bt;It=Math.max(It,Ee)}isNaN(It)||(lt=It)}}if(Nt){const Gt=g.filter(Ot=>Ot.minXMath.min(X.y,$.y));if(Gt.length>0){let Ot=Math.min(X.x,$.x);for(const Mt of Gt){const It=(Mt.minX+Mt.maxX)/2-Mt.visualXHalfExtent-Bt;Ot=Math.min(Ot,It)}K=Ot}}}const ut=d(Bt=>{const Gt=$.y>X.y,Ot=g.filter(It=>{const St=Math.min(X.x,$.x)It.minX,Wt=Math.min(X.y,$.y)It.minY;return St&&Wt});let Mt=Ot;if(a&&Ot.length>0){const It=Ot.filter(St=>St.minXBt);It.length>0&&(Mt=It)}if(Mt.length===0)return $.y;const $t=be;if(Gt){const St=Math.max(...Mt.map(Wt=>Wt.maxY))+$t;if(St<$.y-ct)return St}else{const St=Math.min(...Mt.map(Wt=>Wt.minY))-$t;if(St>$.y+ct)return St}return $.y},"findBestReturnY"),Yt=d(Bt=>{const Gt=ut(Bt),Ot={x:Bt,y:X.y},Mt={x:Bt,y:Gt},$t={x:$.x,y:Gt},It=ge(X,Ot),St=ge(Ot,Mt),Wt=ge(Mt,$t),Ee=Gt!==$.y?ge($t,$):!1;return!It&&!St&&!Wt&&!Ee?Math.abs(Gt-$.y)=3){const X=Xt[Xt.length-1],$=Xt[Xt.length-2],K=Xt[Xt.length-3],lt=Math.abs(K.y-$.y)Math.abs(X.x-K.x)&&Xt.splice(-2,1)}else if(Ct){const bt=Math.sign($.y-K.y),Et=Math.sign(X.y-K.y);bt!==0&&bt===Et&&Math.abs($.y-K.y)>Math.abs(X.y-K.y)&&Xt.splice(-2,1)}}const ie=[Xt[0]];for(let X=1;X$.x,bt=lt.x>K.x;if(Ct!==bt){ie.push(K);continue}continue}if(Math.abs($.x-K.x)$.y,bt=lt.y>K.y;if(Ct!==bt){ie.push(K);continue}continue}ie.push(K)}ie.push(Xt[Xt.length-1]);for(let X=0;Xh.from{const w=!L.segments.some(U=>(U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex)&&W(U,h)),B=!C.segments.some(U=>(U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex)&&W(U,b));return w&&B?(h.trackIndex=L.index,b.trackIndex=C.index,C.segments=[...C.segments.filter(U=>U.edgeIndex!==h.edgeIndex||U.segmentIndex!==h.segmentIndex),{edgeIndex:b.edgeIndex,segmentIndex:b.segmentIndex,from:b.from,to:b.to}],L.segments=[...L.segments.filter(U=>U.edgeIndex!==b.edgeIndex||U.segmentIndex!==b.segmentIndex),{edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to}],!0):!1},"trySwapSegmentsAcrossTracks"),at=d(h=>{const b=h.tracks.length;return h.tracks[b]={index:b,coord:h.coord,segments:[]},b},"createNewTrack"),gt=d((h,b)=>{const C=h.pipe.tracks[h.trackIndex];C.segments=C.segments.filter(w=>w.edgeIndex!==h.edgeIndex||w.segmentIndex!==h.segmentIndex),h.trackIndex=b,h.pipe.tracks[b].segments.push({edgeIndex:h.edgeIndex,segmentIndex:h.segmentIndex,from:h.from,to:h.to})},"moveSegmentToTrack"),xt=d((h,b)=>{const C=f[h.edgeIndex];for(const L of C){const w=p[L];w.pipe===h.pipe&>(w,b)}},"moveSegmentChainToTrack"),vt=d(h=>{const b=f[h.edgeIndex],C=b.indexOf(p.indexOf(h)),L=[];return C>0&&L.push(p[b[C-1]]),C{if(h.orientation===b.orientation)return!1;const C=h.orientation==="horizontal"?h:b,L=h.orientation==="horizontal"?b:h;return L.pipe.coord>C.from&&L.pipe.coordL.from&&C.pipe.coord{for(const C of h.tracks)if(!C.segments.some(w=>(w.edgeIndex!==b.edgeIndex||w.segmentIndex!==b.segmentIndex)&&W(w,b)))return C.index;return-1},"findAvailableTrack"),Ut=d((h,b)=>{if(h.trackIndex===b.trackIndex)return W(h,b);const C=vt(h),L=vt(b);return C.some(w=>L.some(B=>Vt(w,B)))},"segmentsConflict"),te=d((h,b,C)=>{if(et(h,b,h.pipe.tracks[h.trackIndex],b.pipe.tracks[b.trackIndex]))return;const L=jt(h.pipe,b);C(b,L!==-1?L:at(h.pipe))},"resolveTrackConflict"),Se=d(h=>{let b=0;for(let C=0;C{if(de.has(h))return de.get(h);const b=f[h];if(b.length===0){const q={dest:0,deviation:0,base:0,delta:0};return de.set(h,q),q}const L=p[b[0]].pipe.coord;let w=L;for(let q=1;qMath.abs(ot-L)?Y:ot;break}}const B=Math.abs(w-L),U={dest:w,deviation:B,base:L,delta:w-L};return de.set(h,U),U},"getDestInfo"),dn=d(()=>{let h=0;const b=new Map;for(const[L,w]of s.entries())f[L].length!==0&&w.start&&(b.has(w.start)||b.set(w.start,[]),b.get(w.start).push(L));const C=d(L=>{const w=s[L];if(!w.start||!w.end)return 0;const B=r.get(w.start),U=r.get(w.end);if(!B||!U)return 0;const q=(U.x??0)-(B.x??0),z=(U.y??0)-(B.y??0);return Math.abs(q)+Math.abs(z)},"getEdgeDistance");for(const L of b.values()){L.sort((B,U)=>{const q=Ce(B),z=Ce(U);if(Math.abs(q.deviation-z.deviation)>1)return q.deviation-z.deviation;if(Math.abs(q.dest-z.dest)>1)return q.dest-z.dest;const Y=C(B),ot=C(U);if(Math.abs(Y-ot)>1)return ot-Y;const rt=f[B].length,st=f[U].length;if(rt!==st)return rt-st;if(rt===1){const tt=f[B][0],yt=f[U][0];if(p[tt]&&p[yt]){const Rt=p[tt],Lt=p[yt],Dt=Math.abs(Rt.to-Rt.from),Jt=Math.abs(Lt.to-Lt.from);if(Math.abs(Dt-Jt)>1)return Dt-Jt}}return 0});const w=L.map(B=>p[f[B][0]]);h+=Se(w)}return h},"fixSourceHandleCrossings"),un=d(()=>{let h=0;const b=new Map;for(const[C,L]of s.entries())f[C].length!==0&&L.end&&(b.has(L.end)||b.set(L.end,[]),b.get(L.end).push(C));for(const C of b.values()){C.sort((w,B)=>{const U=d(Y=>{const ot=f[Y];if(ot.length<2)return 0;const rt=p[ot[ot.length-2]];return Math.abs(rt.to-rt.from)},"getDist"),q=U(w),z=U(B);return Math.abs(q-z)>.1?q-z:w-B});const L=C.map(w=>p[f[w][f[w].length-1]]);h+=Se(L)}return h},"fixTargetHandleCrossings"),hn=d(()=>{let h=0;for(const b of c){const C=[];for(const L of b.tracks)for(const w of L.segments){const B=f[w.edgeIndex].find(U=>p[U].segmentIndex===w.segmentIndex);B!==void 0&&C.push(p[B])}C.sort((L,w)=>L.edgeIndex-w.edgeIndex||L.segmentIndex-w.segmentIndex);for(let L=0;L{L.segments.forEach(w=>{b.push({edgeIndex:w.edgeIndex,segmentIndex:w.segmentIndex,trackIndex:L.index,from:w.from,to:w.to})})}),b.sort((L,w)=>L.from-w.from);const C=[];if(b.length>0){let L=[b[0]],w=b[0].to;for(let B=1;Bw.add(tt.trackIndex));const B=new Map;L.forEach(tt=>{const yt=Ce(tt.edgeIndex);B.set(tt.trackIndex,(B.get(tt.trackIndex)??0)+yt.delta)});const U=[...w].filter(tt=>(B.get(tt)??0)<-1),q=[...w].filter(tt=>(B.get(tt)??0)>1),z=[...w].filter(tt=>Math.abs(B.get(tt)??0)<=1);U.sort((tt,yt)=>(B.get(yt)??0)-(B.get(tt)??0)),q.sort((tt,yt)=>(B.get(tt)??0)-(B.get(yt)??0));const Y=d((tt,yt)=>{L.filter(Rt=>Rt.trackIndex===tt).forEach(Rt=>{const Lt=y.has(Rt.edgeIndex)?h.coord:yt;D.set(`${Rt.edgeIndex}-${Rt.segmentIndex}`,Lt)})},"assignCoord");let ot=0;for(const tt of U)ot++,Y(tt,h.coord-ot*Cn);if(z.length===0&&w.size>0){const tt=[...w].sort((Lt,Dt)=>Math.abs(B.get(Lt)??0)-Math.abs(B.get(Dt)??0))[0],yt=U.indexOf(tt);yt!==-1&&U.splice(yt,1);const Rt=q.indexOf(tt);Rt!==-1&&q.splice(Rt,1),z.push(tt)}let rt=0;for(const tt of z){if(rt===0)Y(tt,h.coord);else{const yt=rt%2===1?1:-1,Rt=Math.ceil(rt/2);Y(tt,h.coord+yt*Rt*Cn*.5)}rt++}let st=0;for(const tt of q)st++,Y(tt,h.coord+st*Cn)}}for(const[h,b]of s.entries()){const C=f[h]??[];if(C.length===0)continue;const L=[],w=r.get(b.start),B=r.get(b.end),{pSrcPort:U,pDstPort:q}=Q(h,w,B),z=C.map(rt=>{const st=p[rt],tt=D.get(`${st.edgeIndex}-${st.segmentIndex}`)??st.pipe.coord;return{orient:st.orientation,coord:tt,from:st.from,to:st.to}});L.push(U);for(let rt=0;rtct&&L.push(Me(st,yt)),Dt&&Lt.orient===st.orient)if(Math.abs(st.coord-Lt.coord)>ct){const Jt=st.orient==="vertical"?(yt+Lt.from)/2:no(st,Lt);L.push(Me(st,Jt),Me(Lt,Jt))}else(rt===0||rt===z.length-2)&&L.push(Me(st,no(st,Lt)));else if(Dt)L.push(Me(st,Lt.coord));else{const Jt=Math.abs(st.from-yt)ct||Math.abs(Y.y-q.y)>ct)&&L.push(q);const ot=[];L.length>0&&ot.push(L[0]);for(let rt=1;rtct||Math.abs(st.y-tt.y)>ct)&&ot.push(st)}b.points=ot}for(const h of s){const b=h.__originalEdge;b&&h.points&&(b.points=h.points)}t.edges=(t.edges??[]).filter(h=>!h.isLayoutOnly);const V=d((h,b)=>{const C=b.x??0,L=b.y??0,w=b.width??0,B=b.height??0;if(w<=0||B<=0)return h;const U=C-w/2,q=C+w/2,z=L-B/2,Y=L+B/2;if(h.xq||h.yY)return h;const ot=h.x-U,rt=q-h.x,st=h.y-z,tt=Y-h.y,yt=Math.min(ot,rt,st,tt);return yt===ot?{x:U,y:h.y}:yt===rt?{x:q,y:h.y}:yt===st?{x:h.x,y:z}:{x:h.x,y:Y}},"nodeBoundaryClamp");for(const h of t.edges){const b=h.points;if(!b||b.length<2)continue;const C=h.start,L=h.end,w=C?r.get(C):void 0,B=L?r.get(L):void 0;w&&(b[0]=V(b[0],w)),B&&(b[b.length-1]=V(b[b.length-1],B))}return t}d(hr,"routeEdgesOrthogonal");function gr(t){return t.direction??"TB"}d(gr,"getSwimlaneDirection");function pr(t){const e=Jo(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,s=t.config.swimlane?.ignoreCrossLaneEdges??!0,r=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,c=gr(t),{ordered:a,coordinates:l}=ur(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:s,optimizeRanksByCrossings:r,automaticLaneOrdering:i,direction:c});Zo(e,a,l,{nodeGap:n,layerGap:o});for(const g of t.edges??[])delete g.points;hr(t,c);for(const g of t.edges??[])(!g.curve||g.curve==="basis")&&(g.curve="rounded");return Rs(t,c),As(t),c}d(pr,"runSwimlaneLayoutCore");async function Qr(t,e){const n=e.select("g");wr(n,t.markers,t.type,t.diagramId),Ar(),Rr(),Nr(),Tr(),qo(t);const o=Qo(t);t.nodes=o.nodes,t.edges=o.edges;const{groups:s}=await _o(n,t);pr(t),await Uo(t,s)}d(Qr,"render");export{Qr as render}; diff --git a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-BWdA3bDm.js b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-BWdA3bDm.js new file mode 100644 index 00000000000..dd9985e027a --- /dev/null +++ b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-BWdA3bDm.js @@ -0,0 +1,8 @@ +import{c as r,s as e}from"./flowDiagram-23GEKE2U-CB0TxYKC.js";import{_ as a}from"./mermaid.core-CsZwh_jB.js";import"./chunk-5VM5RSS4-CqIxm4fU.js";import"./chunk-XXDRQBXY-B7Une-L7.js";import"./chunk-VR4S4FIN-Crv01XIW.js";import"./chunk-32BRIVSS-DNJ_Bmzz.js";import"./channel-Dk_xUHM6.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var o=a(t=>`${e(t)} + .swimlane.cluster rect { + stroke: ${t.clusterBorder} !important; + } + [data-look="neo"].cluster rect { + filter: none; + } +`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js b/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js deleted file mode 100644 index 03ec388fe36..00000000000 --- a/apps/kimi-code/dist-web/assets/swimlanesDiagram-G3AALYLV-DKIx012r.js +++ /dev/null @@ -1,8 +0,0 @@ -import{c as r,s as e}from"./flowDiagram-23GEKE2U-CzI-GKO4.js";import{_ as a}from"./mermaid.core-CJB1tAev.js";import"./chunk-5VM5RSS4-yyj9cAyF.js";import"./chunk-XXDRQBXY-5rh7CWvm.js";import"./chunk-VR4S4FIN-CEH7JYJn.js";import"./chunk-32BRIVSS-DUDRPqmY.js";import"./channel-xkK6nTGq.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var o=a(t=>`${e(t)} - .swimlane.cluster rect { - stroke: ${t.clusterBorder} !important; - } - [data-look="neo"].cluster rect { - filter: none; - } -`,"getStyles"),m=o,y=r({defaultLayout:"swimlane",styles:m});export{y as diagram}; diff --git a/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js b/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DlAcudfE.js similarity index 99% rename from apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js rename to apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DlAcudfE.js index 6787e09bf0b..a14abda91c9 100644 --- a/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-5u0AN8o0.js +++ b/apps/kimi-code/dist-web/assets/timeline-definition-FHXFAJF6-DlAcudfE.js @@ -1,4 +1,4 @@ -import{_ as o,z as pt,aa as Rt,ab as Ct,ac as Wt,c as gt,l as E,F as Pt,a1 as Bt,ad as ft,d as U,u as Vt,ae as Ft,q as zt}from"./mermaid.core-CJB1tAev.js";import{d as ot}from"./arc-IkhU3FHH.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`: +import{_ as o,z as pt,aa as Rt,ab as Ct,ac as Wt,c as gt,l as E,F as Pt,a1 as Bt,ad as ft,d as U,u as Vt,ae as Ft,q as zt}from"./mermaid.core-CsZwh_jB.js";import{d as ot}from"./arc-HTdwJ95y.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var tt=(function(){var e=o(function(k,s,d,l){for(d=d||{},l=k.length;l--;d[k[l]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],h=[1,15],c=[1,16],a=[1,19],f=[1,20],g={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:o(function(s,d,l,p,x,u,S){var v=u.length-1;switch(x){case 1:return u[v-1];case 3:p.setDirection("LR");break;case 4:p.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:p.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),p.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),p.getCommonDb().setAccDescription(this.$);break;case 15:p.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:p.addTask(u[v],0,""),this.$=u[v];break;case 19:p.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:h,20:c,21:17,22:18,23:a,24:f},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:o(function(s,d){if(d.recoverable)this.trace(s);else{var l=new Error(s);throw l.hash=d,l}},"parseError"),parse:o(function(s){var d=this,l=[0],p=[],x=[null],u=[],S=this.table,v="",I=0,R=0,W=2,O=1,L=u.slice.call(arguments,1),w=Object.create(this.lexer),H={yy:{}};for(var V in this.yy)Object.prototype.hasOwnProperty.call(this.yy,V)&&(H.yy[V]=this.yy[V]);w.setInput(s,H.yy),H.yy.lexer=w,H.yy.parser=this,typeof w.yylloc>"u"&&(w.yylloc={});var F=w.yylloc;u.push(F);var K=w.options&&w.options.ranges;typeof H.yy.parseError=="function"?this.parseError=H.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function N(A){l.length=l.length-2*A,x.length=x.length-A,u.length=u.length-A}o(N,"popStack");function b(){var A;return A=p.pop()||w.lex()||O,typeof A!="number"&&(A instanceof Array&&(p=A,A=p.pop()),A=d.symbols_[A]||A),A}o(b,"lex");for(var _,$,T,P,C={},G,B,X,Z;;){if($=l[l.length-1],this.defaultActions[$]?T=this.defaultActions[$]:((_===null||typeof _>"u")&&(_=b()),T=S[$]&&S[$][_]),typeof T>"u"||!T.length||!T[0]){var Y="";Z=[];for(G in S[$])this.terminals_[G]&&G>W&&Z.push("'"+this.terminals_[G]+"'");w.showPosition?Y="Parse error on line "+(I+1)+`: `+w.showPosition()+` Expecting `+Z.join(", ")+", got '"+(this.terminals_[_]||_)+"'":Y="Parse error on line "+(I+1)+": Unexpected "+(_==O?"end of input":"'"+(this.terminals_[_]||_)+"'"),this.parseError(Y,{text:w.match,token:this.terminals_[_]||_,line:w.yylineno,loc:F,expected:Z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+_);switch(T[0]){case 1:l.push(_),x.push(w.yytext),u.push(w.yylloc),l.push(T[1]),_=null,R=w.yyleng,v=w.yytext,I=w.yylineno,F=w.yylloc;break;case 2:if(B=this.productions_[T[1]][1],C.$=x[x.length-B],C._$={first_line:u[u.length-(B||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(B||1)].first_column,last_column:u[u.length-1].last_column},K&&(C._$.range=[u[u.length-(B||1)].range[0],u[u.length-1].range[1]]),P=this.performAction.apply(C,[v,R,I,H.yy,T[1],x,u].concat(L)),typeof P<"u")return P;B&&(l=l.slice(0,-1*B*2),x=x.slice(0,-1*B),u=u.slice(0,-1*B)),l.push(this.productions_[T[1]][0]),x.push(C.$),u.push(C._$),X=S[l[l.length-2]][l[l.length-1]],l.push(X);break;case 3:return!0}}return!0},"parse")},m=(function(){var k={EOF:1,parseError:o(function(d,l){if(this.yy.parser)this.yy.parser.parseError(d,l);else throw new Error(d)},"parseError"),setInput:o(function(s,d){return this.yy=d||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:o(function(s){var d=s.length,l=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var p=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var x=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===p.length?this.yylloc.first_column:0)+p[p.length-l.length].length-l[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[x[0],x[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(s){this.unput(this.match.slice(s))},"less"),pastInput:o(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js b/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-BV2kbjhg.js similarity index 99% rename from apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js rename to apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-BV2kbjhg.js index 5780512f09f..207510a4466 100644 --- a/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-ozNTLnJz.js +++ b/apps/kimi-code/dist-web/assets/vennDiagram-L72KCM5P-BV2kbjhg.js @@ -1,4 +1,4 @@ -import{b4 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as w,z as wt,F as Qt,d as ot,al as $t,aa as te,ab as ee,ac as ne,e as se,q as ie,B as oe,D as re}from"./mermaid.core-CJB1tAev.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let f=e[e.length-1];for(let u=0;up.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(f)ct(n))}function $(t,n){let s=0;for(let e=0;ev.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx=1)break;for(let d=1;dl+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a{const y={};for(let h=0;hxt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;ul===f?0:lo.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;hy.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;bt[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(F=>D.has(F)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let T=!1;O.selectAll(".venn-area path").each(function(k){const F=this.getAttribute("d");k.sets.length==1&&F&&!b&&(T=!0,R[k.sets[0]]=Me(F))});function A(k){return F=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-F)+Z.x*F,y:Y.y*(1-F)+Z.y*F,radius:Y.radius*(1-F)+Z.radius*F}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(F=>I[F])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=K(G.exit()).remove();typeof G.transition=="function"&&j.selectAll("path").attrTween("d",A);const X=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` +import{b4 as Wt,s as Kt,g as Ht,p as Yt,o as Xt,a as Zt,b as Jt,_ as w,z as wt,F as Qt,d as ot,al as $t,aa as te,ab as ee,ac as ne,e as se,q as ie,B as oe,D as re}from"./mermaid.core-CsZwh_jB.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";const kt=(t,n)=>Wt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,o=0;const r=[];if(e.length>1){const l=Et(e);for(let u=0;ua.angle-u.angle);let f=e[e.length-1];for(let u=0;up.radius*2&&(g=p.radius*2),(h==null||h.width>g)&&(h={circle:p,width:g,p1:a,p2:f,large:g>p.radius,sweep:!0})}h!=null&&(r.push(h),i+=lt(h.circle.radius,h.width),f=a)}}else{let l=t[0];for(let u=1;uMath.abs(l.radius-t[u].radius)){f=!0;break}f?i=o=0:(i=l.radius*l.radius*Math.PI,r.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return o/=2,n&&(n.area=i+o,n.arcArea=i,n.polygonArea=o,n.arcs=r,n.innerPoints=e,n.intersectionPoints=s),i+o}function ae(t,n){return n.every(s=>q(t,s)=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const o=(e*e-i*i+s*s)/(2*s),r=Math.sqrt(e*e-o*o),l=t.x+o*(n.x-t.x)/s,f=t.y+o*(n.y-t.y)/s,u=-(n.y-t.y)*(r/s),a=-(n.x-t.x)*(r/s);return[{x:l+u,y:f-a},{x:l-u,y:f+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,o=e.tolerance||1e-10,r=t(n),l=t(s);let f=s-n;if(r*l>0)throw"Initial bisect points must have opposite signs";if(r===0)return n;if(l===0)return s;for(let u=0;u=0&&(n=a),Math.abs(f)ct(n))}function $(t,n){let s=0;for(let e=0;ev.fx-c.fx,_=n.slice(),S=n.slice(),g=n.slice(),m=n.slice();for(let v=0;v{const D=d.slice();return D.fx=d.fx,D.id=d.id,D});x.sort((d,D)=>d.id-D.id),s.history.push({x:p[0].slice(),fx:p[0].fx,simplex:x})}h=0;for(let x=0;x=p[b-1].fx){let x=!1;if(S.fx>c.fx?(J(g,1+a,_,-a,c),g.fx=t(g),g.fx=1)break;for(let d=1;dl+o*i*f||u>=E)M=i;else{if(Math.abs(y)<=-r*f)return i;y*(M-p)>=0&&(M=p),p=i,E=u}return 0}for(let p=0;p<10;++p){if(J(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),y=$(e.fxprime,n),u>l+o*i*f||p&&u>=a)return b(h,i,a);if(Math.abs(y)<=-r*f)return i;if(y>=0)return b(i,h,u);a=u,h=i,i*=2}return i}function fe(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const o=n.slice();let r,l,f=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),r=e.fxprime.slice(),ft(r,e.fxprime,-1);for(let a=0;a{const y={};for(let h=0;hxt(t,n,e)-s,0,t+n)}function he(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const f of e)for(let u=0;ul===f?0:lo.sets.length===2).forEach(o=>{const r=s[o.sets[0]],l=s[o.sets[1]],f=Math.sqrt(n[r].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ht(f,u,o.size);e[r][l]=e[l][r]=a;let y=0;o.size+1e-10>=Math.min(n[r].size,n[l].size)?y=1:o.size<=1e-10&&(y=-1),i[r][l]=i[l][r]=y}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let o=0;o0&&p<=y||h<0&&p>=y||(i+=2*M*M,n[2*o]+=4*M*(r-u),n[2*o+1]+=4*M*(l-a),n[2*f]+=4*M*(u-r),n[2*f+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||tt;if(t.length>=8){const i=ye(t,n),o=e(i,t),r=e(s,t);o+1e-8h.map(b=>b/l));const f=(h,b)=>ge(h,b,o,r);let u=null;for(let h=0;hy.sets.length===2);for(const y of t){let h=y.weight!=null?y.weight:1;const b=y.sets[0],p=y.sets[1];y.size+Rt>=Math.min(e[b].size,e[p].size)&&(h=0),i[b].push({set:p,size:y.size,weight:h}),i[p].push({set:b,size:y.size,weight:h})}const o=[];Object.keys(i).forEach(y=>{let h=0;for(let b=0;bt[r]));const o=e.weight!=null?e.weight:1;s+=o*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],f=t[e.sets[1]];i=xt(l.radius,f.radius,q(l,f))}else i=st(e.sets.map(l=>t[l]));const o=e.weight!=null?e.weight:1,r=Math.log((i+1)/(e.size+1));s+=o*r*r}return s}function me(t,n,s){if(s==null?t.sort((i,o)=>o.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,o=t[0].y;for(const r of t)r.x-=i,r.y-=o}if(t.length===2&&q(t[0],t[1])1){const i=Math.atan2(t[1].x,t[1].y)-n,o=Math.cos(i),r=Math.sin(i);for(const l of t){const f=l.x,u=l.y;l.x=o*f-r*u,l.y=r*f+o*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const o=t[1].y/(1e-10+t[1].x);for(const r of t){var e=(r.x+o*r.y)/(1+o*o);r.x=2*e-r.x,r.y=2*e*o-r.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,o){const r=n(i),l=n(o);r.parent=l}for(let i=0;i{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((o,r)=>Math.max(o,r[s]+r.radius),Number.NEGATIVE_INFINITY),i=t.reduce((o,r)=>Math.min(o,r[s]-r.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=Ft(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let o=e.bounds;const r=(o.xRange.max-o.xRange.min)/50;function l(u,a,y){if(!u)return;const h=u.bounds;let b,p;if(a)b=o.xRange.max-h.xRange.min+r;else{b=o.xRange.max-h.xRange.max;const M=(h.xRange.max-h.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;M<0&&(b+=M)}if(y)p=o.yRange.max-h.yRange.min+r;else{p=o.yRange.max-h.yRange.max;const M=(h.yRange.max-h.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;M<0&&(p+=M)}for(const M of u)M.x+=b,M.y+=p,e.push(M)}let f=1;for(;f({radius:a*b.radius,x:e+y+(b.x-r.min)*a,y:e+h+(b.y-l.min)*a,setid:b.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function Ft(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,o=1e3,r=Math.PI/2,l=!0,f=null,u=!0,a=!0,y=null,h=null,b=!1,p=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},_=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],S=0,g=function(x){if(x in E)return E[x];var d=E[x]=_[S];return S+=1,S>=_.length&&(S=0),d},m=At,v=tt;function c(x){let d=x.datum();const D=new Set;d.forEach(k=>{k.size==0&&k.sets.length==1&&D.add(k.sets[0])}),d=d.filter(k=>!k.sets.some(F=>D.has(F)));let I={},C={};if(d.length>0){let k=m(d,{lossFunction:v,distinct:b});l&&(k=Ct(k,r,h)),I=Nt(k,s,e,i,f),C=Lt(I,d,M)}const U={};d.forEach(k=>{k.label&&(U[k.sets]=k.label)});function V(k){if(k.sets in U)return U[k.sets];if(k.sets.length==1)return""+k.sets[0]}x.selectAll("svg").data([I]).enter().append("svg");const O=x.select("svg");n?O.attr("viewBox",`0 0 ${s} ${e}`):O.attr("width",s).attr("height",e);const R={};let T=!1;O.selectAll(".venn-area path").each(function(k){const F=this.getAttribute("d");k.sets.length==1&&F&&!b&&(T=!0,R[k.sets[0]]=Me(F))});function A(k){return F=>{const H=k.sets.map(et=>{let Y=R[et],Z=I[et];return Y||(Y={x:s/2,y:e/2,radius:1}),Z||(Z={x:s/2,y:e/2,radius:1}),{x:Y.x*(1-F)+Z.x*F,y:Y.y*(1-F)+Z.y*F,radius:Y.radius*(1-F)+Z.radius*F}});return St(H,p)}}const G=O.selectAll(".venn-area").data(d,k=>k.sets),P=G.enter().append("g").attr("class",k=>`venn-area venn-${k.sets.length==1?"circle":"intersection"}${k.colour||k.color?" venn-coloured":""}`).attr("data-venn-sets",k=>k.sets.join("_")),B=P.append("path"),L=P.append("text").attr("class","label").text(k=>V(k)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(B.style("fill-opacity","0").filter(k=>k.sets.length==1).style("fill",k=>k.colour?k.colour:k.color?k.color:g(k.sets)).style("fill-opacity",".25"),L.style("fill",k=>k.colour||k.color?"#FFF":t.textFill?t.textFill:k.sets.length==1?g(k.sets):"#444"));function K(k){return typeof k.transition=="function"?k.transition("venn").duration(o):k}let z=x;T&&typeof z.transition=="function"?(z=K(x),z.selectAll("path").attrTween("d",A)):z.selectAll("path").attr("d",k=>St(k.sets.map(F=>I[F])),p);const N=z.selectAll("text").filter(k=>k.sets in C).text(k=>V(k)).attr("x",k=>Math.floor(C[k.sets].x)).attr("y",k=>Math.floor(C[k.sets].y));u&&(T?"on"in N?N.on("end",rt(I,V)):N.each("end",rt(I,V)):N.each(rt(I,V)));const j=K(G.exit()).remove();typeof G.transition=="function"&&j.selectAll("path").attrTween("d",A);const X=j.selectAll("text").attr("x",s/2).attr("y",e/2);return y!==null&&(L.style("font-size","0px"),N.style("font-size",y),X.style("font-size","0px")),{circles:I,textCentres:C,nodes:G,enter:P,update:z,exit:j}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(b=x,c):b},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(y=x,c):y},c.round=function(x){return arguments.length?(p=x,c):p},c.duration=function(x){return arguments.length?(o=x,c):o},c.layoutFunction=function(x){return arguments.length?(m=x,c):m},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(f=x,c):f},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(r=x,c):r},c.orientationOrder=function(x){return arguments.length?(h=x,c):h},c.lossFunction=function(x){return arguments.length?(v=x==="default"?tt:x==="logRatio"?Dt:x,c):v},c}function rt(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,o=n(s)||"",r=o.split(/\s+/).reverse(),f=(o.length+r.length)/3;let u=r.pop(),a=[u],y=0;const h=1.1;e.textContent=null;const b=[];function p(g){const m=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return m.textContent=g,b.push(m),e.append(m),m}let M=p(u);for(;u=r.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>f&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=p(u),y++)}const E=.35-y*h/2,_=e.getAttribute("x"),S=e.getAttribute("y");b.forEach((g,m)=>{g.setAttribute("x",_),g.setAttribute("y",S),g.setAttribute("dy",`${E+m*h}em`)})}}function at(t,n,s){let e=n[0].radius-q(n[0],t);for(let i=1;i=o&&(i=e[a],o=y)}const r=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:r[0],y:r[1]};let f=!0;for(const a of t)if(q(l,a)>a.radius){f=!1;break}for(const a of n)if(q(l,a)a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e0&&console.log("WARNING: area "+r+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(` M`,t,n),e.push(` m`,-s,0),e.push(` a`,s,s,0,1,0,s*2,0),e.push(` diff --git a/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js b/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-D20WEMcO.js similarity index 98% rename from apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js rename to apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-D20WEMcO.js index 6f6ac377fa3..f0a8fc50d67 100644 --- a/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-J0WjtLlK.js +++ b/apps/kimi-code/dist-web/assets/vue.runtime.esm-bundler-D20WEMcO.js @@ -1,4 +1,4 @@ -import{B as t,a as o,C as r,D as n,E as i,b as c,c as l,F as d,K as p,R as b,S as m,d as f,T as u,e as h,f as S,g as y,h as R,i as v,V as C,j as g,k as w,l as T,m as E,n as x,o as M,p as k,q as D,r as P,s as V,t as A,u as B,v as H,w as N,x as O,y as I,z,A as F,G as U,H as K,I as W,J as j,L as q,M as G,N as L,O as J,P as Q,Q as X,U as Y,W as Z,X as _,Y as $,Z as aa,_ as ea,$ as sa,a0 as ta,a1 as oa,a2 as ra,a3 as na,a4 as ia,a5 as ca,a6 as la,a7 as da,a8 as pa,a9 as ba,aa as ma,ab as fa,ac as ua,ad as ha,ae as Sa,af as ya,ag as Ra,ah as va,ai as Ca,aj as ga,ak as wa,al as Ta,am as Ea,an as xa,ao as Ma,ap as ka,aq as Da,ar as Pa,as as Va,at as Aa,au as Ba,av as Ha,aw as Na,ax as Oa,ay as Ia,az as za,aA as Fa,aB as Ua,aC as Ka,aD as Wa,aE as ja,aF as qa,aG as Ga,aH as La,aI as Ja,aJ as Qa,aK as Xa,aL as Ya,aM as Za,aN as _a,aO as $a,aP as ae,aQ as ee,aR as se,aS as te,aT as oe,aU as re,aV as ne,aW as ie,aX as ce,aY as le,aZ as de,a_ as pe,a$ as be,b0 as me,b1 as fe,b2 as ue,b3 as he,b4 as Se,b5 as ye,b6 as Re,b7 as ve,b8 as Ce,b9 as ge,ba as we,bb as Te,bc as Ee,bd as xe,be as Me,bf as ke,bg as De,bh as Pe,bi as Ve,bj as Ae,bk as Be,bl as He,bm as Ne,bn as Oe,bo as Ie,bp as ze,bq as Fe,br as Ue,bs as Ke,bt as We,bu as je,bv as qe,bw as Ge,bx as Le,by as Je,bz as Qe,bA as Xe,bB as Ye,bC as Ze,bD as _e,bE as $e,bF as as,bG as es,bH as ss,bI as ts,bJ as os,bK as rs,bL as ns,bM as is,bN as cs,bO as ls,bP as ds}from"./index-D-7nOosq.js";/** +import{B as t,a as o,C as r,D as n,E as i,b as c,c as l,F as d,K as p,R as b,S as m,d as f,T as u,e as h,f as S,g as y,h as R,i as v,V as C,j as g,k as w,l as T,m as E,n as x,o as M,p as k,q as D,r as P,s as V,t as A,u as B,v as H,w as N,x as O,y as I,z,A as F,G as U,H as K,I as W,J as j,L as q,M as G,N as L,O as J,P as Q,Q as X,U as Y,W as Z,X as _,Y as $,Z as aa,_ as ea,$ as sa,a0 as ta,a1 as oa,a2 as ra,a3 as na,a4 as ia,a5 as ca,a6 as la,a7 as da,a8 as pa,a9 as ba,aa as ma,ab as fa,ac as ua,ad as ha,ae as Sa,af as ya,ag as Ra,ah as va,ai as Ca,aj as ga,ak as wa,al as Ta,am as Ea,an as xa,ao as Ma,ap as ka,aq as Da,ar as Pa,as as Va,at as Aa,au as Ba,av as Ha,aw as Na,ax as Oa,ay as Ia,az as za,aA as Fa,aB as Ua,aC as Ka,aD as Wa,aE as ja,aF as qa,aG as Ga,aH as La,aI as Ja,aJ as Qa,aK as Xa,aL as Ya,aM as Za,aN as _a,aO as $a,aP as ae,aQ as ee,aR as se,aS as te,aT as oe,aU as re,aV as ne,aW as ie,aX as ce,aY as le,aZ as de,a_ as pe,a$ as be,b0 as me,b1 as fe,b2 as ue,b3 as he,b4 as Se,b5 as ye,b6 as Re,b7 as ve,b8 as Ce,b9 as ge,ba as we,bb as Te,bc as Ee,bd as xe,be as Me,bf as ke,bg as De,bh as Pe,bi as Ve,bj as Ae,bk as Be,bl as He,bm as Ne,bn as Oe,bo as Ie,bp as ze,bq as Fe,br as Ue,bs as Ke,bt as We,bu as je,bv as qe,bw as Ge,bx as Le,by as Je,bz as Qe,bA as Xe,bB as Ye,bC as Ze,bD as _e,bE as $e,bF as as,bG as es,bH as ss,bI as ts,bJ as os,bK as rs,bL as ns,bM as is,bN as cs,bO as ls,bP as ds}from"./index-Bxn5yOTB.js";/** * vue v3.5.39 * (c) 2018-present Yuxi (Evan) You and Vue contributors * @license MIT diff --git a/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js b/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BaiOQb6Q.js similarity index 99% rename from apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js rename to apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BaiOQb6Q.js index 51ea343973f..072ba337b81 100644 --- a/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BuQJYWm-.js +++ b/apps/kimi-code/dist-web/assets/wardleyDiagram-EHGQE667-BaiOQb6Q.js @@ -1,4 +1,4 @@ -import{p as St}from"./chunk-JWPE2WC7-Dsg3gA8l.js";import{s as Mt,g as Nt,p as zt,o as Lt,a as Tt,b as At,_ as u,W as Xt,z as Et,B as U,l as K,F as Yt,e as It,q as Bt,c as j}from"./mermaid.core-CJB1tAev.js";import{p as Ft}from"./cynefin-VYW2F7L2-BIlq342y.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";var D=u((e,n)=>{const r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${n} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),A=u((e,n,r)=>({x:D(n,`${r} evolution`),y:D(e,`${r} visibility`)}),"toCoordinates"),J=u(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),Rt=u(e=>{if(!e?.startsWith("+"))return{};const r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),Ot=u((e,n)=>{if(St(e,n),e.size&&n.setSize(e.size.width,e.size.height),e.evolution){const r=e.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),x=e.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);n.updateAxes({stages:r,stageBoundaries:x})}if(e.anchors.forEach(r=>{const x=A(r.visibility,r.evolution,`Anchor "${r.name}"`);n.addNode(r.name,r.name,x.x,x.y,"anchor")}),e.components.forEach(r=>{const x=A(r.visibility,r.evolution,`Component "${r.name}"`),a=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,d=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,w=r.decorator?.strategy;n.addNode(r.name,r.name,x.x,x.y,"component",a,d,r.inertia,w)}),e.notes.forEach(r=>{const x=A(r.visibility,r.evolution,`Note "${r.text}"`);n.addNote(r.text,x.x,x.y)}),e.pipelines.forEach(r=>{const x=n.getNode(r.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);const a=x.y;n.startPipeline(r.parent),r.components.forEach(d=>{const w=`${r.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,F=D(d.evolution,`Pipeline component "${d.name}" evolution`);n.addNode(w,d.name,F,a,"pipeline-component",C,g),n.addPipelineComponent(r.parent,w)})}),e.links.forEach(r=>{const x=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-."));let a=J(r.fromPort)??J(r.toPort);const{flow:d,label:w}=Rt(r.arrow);!a&&d&&(a=d);const C=r.linkLabel,g=w??C;n.addLink(n.resolveNodeId(r.from),n.resolveNodeId(r.to),x,g,a)}),e.evolves.forEach(r=>{const x=n.getNode(r.component);if(x?.y!==void 0){const a=D(r.target,`Evolve target for "${r.component}"`);n.addTrend(r.component,a,x.y)}}),e.annotations.length>0){const r=e.annotations[0],x=A(r.x,r.y,"Annotations box");n.setAnnotationsBox(x.x,x.y)}e.annotation.forEach(r=>{const x=A(r.x,r.y,`Annotation ${r.number}`);n.addAnnotation(r.number,[{x:x.x,y:x.y}],r.text)}),e.accelerators.forEach(r=>{const x=A(r.x,r.y,`Accelerator "${r.name}"`);n.addAccelerator(r.name,x.x,x.y)}),e.deaccelerators.forEach(r=>{const x=A(r.x,r.y,`Deaccelerator "${r.name}"`);n.addDeaccelerator(r.name,x.x,x.y)})},"populateDb"),Q={parser:{yy:void 0},parse:u(async e=>{const n=await Ft("wardley",e);K.debug(n);const r=Q.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ot(n,r)},"parse")},Wt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{u(this,"WardleyBuilder")}addNode(e){const n=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...n,...e,className:e.className??n.className,labelOffsetX:e.labelOffsetX??n.labelOffsetX,labelOffsetY:e.labelOffsetY??n.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});const n=this.nodes.get(e);n&&(n.isPipelineParent=!0)}addPipelineComponent(e,n){const r=this.pipelines.get(e);r&&r.componentIds.push(n);const x=this.nodes.get(n);x&&(x.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,n){this.annotationsBox={x:e,y:n}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,n){this.size={width:e,height:n}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(const[n,r]of this.nodes)if(r.label===e)return n;return e}build(){const e=[];for(const n of this.nodes.values()){if(typeof n.x!="number"||typeof n.y!="number")throw new Error(`Node "${n.label}" is missing coordinates`);e.push(n)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},k=new Wt;function tt(){return j()["wardley-beta"]}u(tt,"getConfig");function et(e,n,r,x,a,d,w,C,g){k.addNode({id:e,label:n,x:r,y:x,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(et,"addNode");function at(e,n,r=!1,x,a){k.addLink({source:e,target:n,dashed:r,label:x,flow:a})}u(at,"addLink");function rt(e,n,r){k.addTrend({nodeId:e,targetX:n,targetY:r})}u(rt,"addTrend");function ot(e,n,r){k.addAnnotation({number:e,coordinates:n,text:r})}u(ot,"addAnnotation");function nt(e,n,r){k.addNote({text:e,x:n,y:r})}u(nt,"addNote");function st(e,n,r){k.addAccelerator({name:e,x:n,y:r})}u(st,"addAccelerator");function it(e,n,r){k.addDeaccelerator({name:e,x:n,y:r})}u(it,"addDeaccelerator");function dt(e,n){k.setAnnotationsBox(e,n)}u(dt,"setAnnotationsBox");function lt(e,n){k.setSize(e,n)}u(lt,"setSize");function ct(e){k.startPipeline(e)}u(ct,"startPipeline");function pt(e,n){k.addPipelineComponent(e,n)}u(pt,"addPipelineComponent");function ft(e){k.setAxes(e)}u(ft,"updateAxes");function ht(e){return k.getNode(e)}u(ht,"getNode");function xt(e){return k.resolveNodeId(e)}u(xt,"resolveNodeId");function gt(){return k.build()}u(gt,"getWardleyData");function yt(){k.clear(),Bt()}u(yt,"clear");var Dt={getConfig:tt,addNode:et,addLink:at,addTrend:rt,addAnnotation:ot,addNote:nt,addAccelerator:st,addDeaccelerator:it,setAnnotationsBox:dt,setSize:lt,startPipeline:ct,addPipelineComponent:pt,updateAxes:ft,getNode:ht,resolveNodeId:xt,getWardleyData:gt,clear:yt,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},Gt=["Genesis","Custom Built","Product","Commodity"],qt=u(()=>{const{themeVariables:e}=j();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),Ht=u(()=>{const e=j()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),jt=u((e,n,r,x)=>{K.debug(`Rendering Wardley map +import{p as St}from"./chunk-JWPE2WC7-R8L-LjRL.js";import{s as Mt,g as Nt,p as zt,o as Lt,a as Tt,b as At,_ as u,W as Xt,z as Et,B as U,l as K,F as Yt,e as It,q as Bt,c as j}from"./mermaid.core-CsZwh_jB.js";import{p as Ft}from"./cynefin-VYW2F7L2-CD6doQLg.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";var D=u((e,n)=>{const r=e<=1?e*100:e;if(r<0||r>100)throw new Error(`${n} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return r},"toPercent"),A=u((e,n,r)=>({x:D(n,`${r} evolution`),y:D(e,`${r} visibility`)}),"toCoordinates"),J=u(e=>{if(e){if(e==="+<>")return"bidirectional";if(e==="+<")return"backward";if(e==="+>")return"forward"}},"getFlowFromPort"),Rt=u(e=>{if(!e?.startsWith("+"))return{};const r=/^\+'([^']*)'/.exec(e)?.[1];return e.includes("<>")?{flow:"bidirectional",label:r}:e.includes("<")?{flow:"backward",label:r}:e.includes(">")?{flow:"forward",label:r}:{label:r}},"extractFlowFromArrow"),Ot=u((e,n)=>{if(St(e,n),e.size&&n.setSize(e.size.width,e.size.height),e.evolution){const r=e.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),x=e.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary);n.updateAxes({stages:r,stageBoundaries:x})}if(e.anchors.forEach(r=>{const x=A(r.visibility,r.evolution,`Anchor "${r.name}"`);n.addNode(r.name,r.name,x.x,x.y,"anchor")}),e.components.forEach(r=>{const x=A(r.visibility,r.evolution,`Component "${r.name}"`),a=r.label?(r.label.negX?-1:1)*r.label.offsetX:void 0,d=r.label?(r.label.negY?-1:1)*r.label.offsetY:void 0,w=r.decorator?.strategy;n.addNode(r.name,r.name,x.x,x.y,"component",a,d,r.inertia,w)}),e.notes.forEach(r=>{const x=A(r.visibility,r.evolution,`Note "${r.text}"`);n.addNote(r.text,x.x,x.y)}),e.pipelines.forEach(r=>{const x=n.getNode(r.parent);if(!x||typeof x.y!="number")throw new Error(`Pipeline "${r.parent}" must reference an existing component with coordinates.`);const a=x.y;n.startPipeline(r.parent),r.components.forEach(d=>{const w=`${r.parent}_${d.name}`,C=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,F=D(d.evolution,`Pipeline component "${d.name}" evolution`);n.addNode(w,d.name,F,a,"pipeline-component",C,g),n.addPipelineComponent(r.parent,w)})}),e.links.forEach(r=>{const x=!!r.arrow&&(r.arrow.includes("-.->")||r.arrow.includes(".-."));let a=J(r.fromPort)??J(r.toPort);const{flow:d,label:w}=Rt(r.arrow);!a&&d&&(a=d);const C=r.linkLabel,g=w??C;n.addLink(n.resolveNodeId(r.from),n.resolveNodeId(r.to),x,g,a)}),e.evolves.forEach(r=>{const x=n.getNode(r.component);if(x?.y!==void 0){const a=D(r.target,`Evolve target for "${r.component}"`);n.addTrend(r.component,a,x.y)}}),e.annotations.length>0){const r=e.annotations[0],x=A(r.x,r.y,"Annotations box");n.setAnnotationsBox(x.x,x.y)}e.annotation.forEach(r=>{const x=A(r.x,r.y,`Annotation ${r.number}`);n.addAnnotation(r.number,[{x:x.x,y:x.y}],r.text)}),e.accelerators.forEach(r=>{const x=A(r.x,r.y,`Accelerator "${r.name}"`);n.addAccelerator(r.name,x.x,x.y)}),e.deaccelerators.forEach(r=>{const x=A(r.x,r.y,`Deaccelerator "${r.name}"`);n.addDeaccelerator(r.name,x.x,x.y)})},"populateDb"),Q={parser:{yy:void 0},parse:u(async e=>{const n=await Ft("wardley",e);K.debug(n);const r=Q.parser?.yy;if(!r||typeof r.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Ot(n,r)},"parse")},Wt=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{u(this,"WardleyBuilder")}addNode(e){const n=this.nodes.get(e.id)??{id:e.id,label:e.label},r={...n,...e,className:e.className??n.className,labelOffsetX:e.labelOffsetX??n.labelOffsetX,labelOffsetY:e.labelOffsetY??n.labelOffsetY};this.nodes.set(e.id,r)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});const n=this.nodes.get(e);n&&(n.isPipelineParent=!0)}addPipelineComponent(e,n){const r=this.pipelines.get(e);r&&r.componentIds.push(n);const x=this.nodes.get(n);x&&(x.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,n){this.annotationsBox={x:e,y:n}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,n){this.size={width:e,height:n}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(const[n,r]of this.nodes)if(r.label===e)return n;return e}build(){const e=[];for(const n of this.nodes.values()){if(typeof n.x!="number"||typeof n.y!="number")throw new Error(`Node "${n.label}" is missing coordinates`);e.push(n)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},k=new Wt;function tt(){return j()["wardley-beta"]}u(tt,"getConfig");function et(e,n,r,x,a,d,w,C,g){k.addNode({id:e,label:n,x:r,y:x,className:a,labelOffsetX:d,labelOffsetY:w,inertia:C,sourceStrategy:g})}u(et,"addNode");function at(e,n,r=!1,x,a){k.addLink({source:e,target:n,dashed:r,label:x,flow:a})}u(at,"addLink");function rt(e,n,r){k.addTrend({nodeId:e,targetX:n,targetY:r})}u(rt,"addTrend");function ot(e,n,r){k.addAnnotation({number:e,coordinates:n,text:r})}u(ot,"addAnnotation");function nt(e,n,r){k.addNote({text:e,x:n,y:r})}u(nt,"addNote");function st(e,n,r){k.addAccelerator({name:e,x:n,y:r})}u(st,"addAccelerator");function it(e,n,r){k.addDeaccelerator({name:e,x:n,y:r})}u(it,"addDeaccelerator");function dt(e,n){k.setAnnotationsBox(e,n)}u(dt,"setAnnotationsBox");function lt(e,n){k.setSize(e,n)}u(lt,"setSize");function ct(e){k.startPipeline(e)}u(ct,"startPipeline");function pt(e,n){k.addPipelineComponent(e,n)}u(pt,"addPipelineComponent");function ft(e){k.setAxes(e)}u(ft,"updateAxes");function ht(e){return k.getNode(e)}u(ht,"getNode");function xt(e){return k.resolveNodeId(e)}u(xt,"resolveNodeId");function gt(){return k.build()}u(gt,"getWardleyData");function yt(){k.clear(),Bt()}u(yt,"clear");var Dt={getConfig:tt,addNode:et,addLink:at,addTrend:rt,addAnnotation:ot,addNote:nt,addAccelerator:st,addDeaccelerator:it,setAnnotationsBox:dt,setSize:lt,startPipeline:ct,addPipelineComponent:pt,updateAxes:ft,getNode:ht,resolveNodeId:xt,getWardleyData:gt,clear:yt,setAccTitle:At,getAccTitle:Tt,setDiagramTitle:Lt,getDiagramTitle:zt,getAccDescription:Nt,setAccDescription:Mt},Gt=["Genesis","Custom Built","Product","Commodity"],qt=u(()=>{const{themeVariables:e}=j();return{backgroundColor:e.wardley?.backgroundColor??e.background??"#fff",axisColor:e.wardley?.axisColor??"#000",axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??"#222",gridColor:e.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:e.wardley?.componentFill??"#fff",componentStroke:e.wardley?.componentStroke??"#000",componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??"#222",linkStroke:e.wardley?.linkStroke??"#000",evolutionStroke:e.wardley?.evolutionStroke??"#dc3545",annotationStroke:e.wardley?.annotationStroke??"#000",annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??"#222",annotationFill:e.wardley?.annotationFill??e.background??"#fff"}},"getTheme"),Ht=u(()=>{const e=j()["wardley-beta"];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},"getConfigValues"),jt=u((e,n,r,x)=>{K.debug(`Rendering Wardley map `+e);const a=Ht(),d=qt(),w=a.nodeRadius*1.6,C=x.db,g=C.getWardleyData(),F=C.getDiagramTitle(),S=g.size?.width??a.width,b=g.size?.height??a.height,E=Yt(n);E.selectAll("*").remove(),It(E,b,S,a.useMaxWidth),E.attr("viewBox",`0 0 ${S} ${b}`);const v=E.append("g").attr("class","wardley-map"),G=E.append("defs");G.append("marker").attr("id",`arrow-${n}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-end-${n}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),G.append("marker").attr("id",`link-arrow-start-${n}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),v.append("rect").attr("class","wardley-background").attr("width",S).attr("height",b).attr("fill",d.backgroundColor);const Y=S-a.padding*2,I=b-a.padding*2;F&&v.append("text").attr("class","wardley-title").attr("x",S/2).attr("y",a.padding/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(F);const z=u(t=>a.padding+t/100*Y,"projectX"),L=u(t=>b-a.padding-t/100*I,"projectY"),R=v.append("g").attr("class","wardley-axes");R.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1),R.append("line").attr("x1",a.padding).attr("x2",a.padding).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const ut=g.axes.xLabel??"Evolution",wt=g.axes.yLabel??"Visibility";R.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",a.padding+Y/2).attr("y",b-a.padding/4).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(ut),R.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",a.padding/3).attr("y",a.padding+I/2).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${a.padding/3} ${a.padding+I/2})`).text(wt);const B=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:Gt;if(B.length>0){const t=v.append("g").attr("class","wardley-stages"),s=g.axes.stageBoundaries,o=[];if(s&&s.length===B.length){let i=0;s.forEach(p=>{o.push({start:i,end:p}),i=p})}else{const i=1/B.length;B.forEach((p,l)=>{o.push({start:l*i,end:(l+1)*i})})}B.forEach((i,p)=>{const l=o[p],f=a.padding+l.start*Y,h=a.padding+l.end*Y,y=(f+h)/2;p>0&&t.append("line").attr("x1",f).attr("x2",f).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",y).attr("y",b-a.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",a.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(a.showGrid){const t=v.append("g").attr("class","wardley-grid");for(let s=1;s<4;s++){const o=s/4,i=a.padding+Y*o;t.append("line").attr("x1",i).attr("x2",i).attr("y1",a.padding).attr("y2",b-a.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",a.padding).attr("x2",S-a.padding).attr("y1",b-a.padding-I*o).attr("y2",b-a.padding-I*o).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:z(t.x),y:L(t.y),node:t})}),g.pipelines.length>0){const t=v.append("g").attr("class","wardley-pipelines"),s=v.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(o=>{if(o.componentIds.length===0)return;const i=o.componentIds.map(h=>({id:h,pos:c.get(h),node:g.nodes.find(y=>y.id===h)})).filter(h=>h.pos&&h.node).sort((h,y)=>h.node.x-y.node.x);for(let h=0;h{const y=c.get(h);y&&(p=Math.min(p,y.x),l=Math.max(l,y.x),f=y.y)}),p!==1/0&&l!==-1/0){const y=a.nodeRadius*4,m=f-y/2,P=c.get(o.nodeId);if(P){const N=(p+l)/2;P.x=N,P.y=m-w/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",p-15).attr("y",m).attr("width",l-p+30).attr("height",y).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const V=v.append("g").attr("class","wardley-links"),_=new Map;g.pipelines.forEach(t=>{_.set(t.nodeId,new Set(t.componentIds))});const Z=g.links.filter(t=>!(!c.has(t.source)||!c.has(t.target)||_.get(t.target)?.has(t.source)));V.selectAll("line").data(Z).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.x+l/h*p}).attr("y1",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.source).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f);return s.y+f/h*p}).attr("x2",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.x+l/h*p}).attr("y2",t=>{const s=c.get(t.source),o=c.get(t.target),p=g.nodes.find(y=>y.id===t.target).isPipelineParent?w/Math.sqrt(2):a.nodeRadius,l=s.x-o.x,f=s.y-o.y,h=Math.sqrt(l*l+f*f);return o.y+f/h*p}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${n})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${n})`:null),V.selectAll("text").data(Z.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=o.y-s.y,l=o.x-s.x,f=Math.sqrt(l*l+p*p),h=8,y=p/f;return i+y*h}).attr("y",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.y+o.y)/2,p=o.x-s.x,l=o.y-s.y,f=Math.sqrt(p*p+l*l),h=8,y=-p/f;return i+y*h}).attr("fill",d.axisTextColor).attr("font-size",a.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const s=c.get(t.source),o=c.get(t.target),i=(s.x+o.x)/2,p=(s.y+o.y)/2,l=o.x-s.x,f=o.y-s.y,h=Math.sqrt(l*l+f*f),y=8,m=f/h,P=-l/h,N=i+m*y,O=p+P*y;let X=Math.atan2(f,l)*180/Math.PI;return(X>90||X<-90)&&(X+=180),`rotate(${X} ${N} ${O})`}).text(t=>t.label);const mt=v.append("g").attr("class","wardley-trends"),kt=g.trends.map(t=>{const s=c.get(t.nodeId);if(!s)return null;const o=z(t.targetX),i=L(t.targetY),p=o-s.x,l=i-s.y,f=Math.sqrt(p*p+l*l),h=a.nodeRadius+2,y=f>h?o-p/f*h:o,m=f>h?i-l/f*h:i;return{origin:s,targetX:o,targetY:i,adjustedX2:y,adjustedY2:m}}).filter(t=>t!==null);mt.selectAll("line").data(kt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${n})`);const M=v.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));M.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const T=M.filter(t=>t.sourceStrategy==="market");T.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",a.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const q=a.nodeRadius*.7,$=a.nodeRadius*1.2;if(T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),T.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",q).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),M.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-w/2).attr("y",t=>c.get(t.id).y-w/2).attr("width",w).attr("height",w).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),M.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const s=c.get(t.id);let o=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y1",t=>{const s=c.get(t.id),o=t.isPipelineParent?w:a.nodeRadius*2;return s.y-o/2}).attr("x2",t=>{const s=c.get(t.id);let o=t.isPipelineParent?w/2+15:a.nodeRadius+15;return t.sourceStrategy&&(o+=a.nodeRadius+10),s.x+o}).attr("y2",t=>{const s=c.get(t.id),o=t.isPipelineParent?w:a.nodeRadius*2;return s.y+o/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),M.append("text").attr("x",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?s.x+t.labelOffsetX:s.x;let o=a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(o+=10);const i=t.labelOffsetX??o;return s.x+i}).attr("y",t=>{const s=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?s.y+t.labelOffsetY:s.y-3;let o=-a.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(o-=10);const i=t.labelOffsetY??o;return s.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",a.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=v.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(s=>{const o=s.coordinates.map(i=>({x:z(i.x),y:L(i.y)}));if(o.length>1)for(let i=0;i{const p=t.append("g").attr("class","wardley-annotation");p.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),p.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.number)})}),g.annotationsBox){let s=z(g.annotationsBox.x),o=L(g.annotationsBox.y);const i=10,p=16,l=11,f=t.append("g").attr("class","wardley-annotations-box"),h=[...g.annotations].filter(m=>m.text).sort((m,P)=>m.number-P.number),y=[];if(h.forEach((m,P)=>{const N=f.append("text").attr("x",s+i).attr("y",o+i+(P+1)*p).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${m.number}. ${m.text}`);y.push(N)}),y.length>0){let m=0,P=0;y.forEach(H=>{const W=H.node(),Pt=W.getComputedTextLength();m=Math.max(m,Pt);const Ct=W.getBBox();P=Math.max(P,Ct.height)});const N=m+i*2+105,O=h.length*p+i*2+P/2,X=a.padding,bt=S-a.padding-N,$t=a.padding,vt=b-a.padding-O;s=Math.max(X,Math.min(s,bt)),o=Math.max($t,Math.min(o,vt)),y.forEach((H,W)=>{H.attr("x",s+i).attr("y",o+i+(W+1)*p)}),f.insert("rect","text").attr("x",s).attr("y",o).attr("width",N).attr("height",O).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=v.append("g").attr("class","wardley-notes");g.notes.forEach(s=>{const o=z(s.x),i=L(s.y);t.append("text").attr("x",o).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(s.text)})}if(g.accelerators.length>0){const t=v.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(s=>{const o=z(s.x),i=L(s.y),p=60,l=30,f=20,h=` M ${o} ${i-l/2} L ${o+p-f} ${i-l/2} diff --git a/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js b/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-BklSkO6g.js similarity index 99% rename from apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js rename to apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-BklSkO6g.js index 71acb3f139a..52881fcf27f 100644 --- a/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-yQImOWPy.js +++ b/apps/kimi-code/dist-web/assets/xychartDiagram-FW5EYKEG-BklSkO6g.js @@ -1,4 +1,4 @@ -import{s as si,g as ai,p as Et,o as ni,a as oi,b as ri,_ as n,l as It,F as hi,e as li,q as ci,z as pt,i as ui,B as Mt,D as gi,W as xi,az as di,a7 as Dt}from"./mermaid.core-CJB1tAev.js";import{i as fi}from"./init-Gi6I4Gst.js";import{o as pi}from"./ordinal-Cboi1Yqb.js";import{l as vt}from"./linear-DH49UJnN.js";import"./index-D-7nOosq.js";import"./_commonjsHelpers-CqkleIqs.js";import"./defaultLocale-DX6XiGOO.js";function mi(t,i,e){t=+t,i=+i,e=(a=arguments.length)<2?(i=t,t=0,1):a<3?1:+e;for(var s=-1,a=Math.max(0,Math.ceil((i-t)/e))|0,c=new Array(a);++s"u"&&(D.yylloc={});var ht=D.yylloc;o.push(ht);var ii=D.options&&D.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ei(z){g.length=g.length-2*z,w.length=w.length-z,o.length=o.length-z}n(ei,"popStack");function kt(){var z;return z=x.pop()||D.lex()||_t,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=u.symbols_[z]||z),z}n(kt,"lex");for(var M,$,O,lt,G={},st,N,Tt,at;;){if($=g[g.length-1],this.defaultActions[$]?O=this.defaultActions[$]:((M===null||typeof M>"u")&&(M=kt()),O=K[$]&&K[$][M]),typeof O>"u"||!O.length||!O[0]){var ct="";at=[];for(st in K[$])this.terminals_[st]&&st>Jt&&at.push("'"+this.terminals_[st]+"'");D.showPosition?ct="Parse error on line "+(et+1)+`: +import{s as si,g as ai,p as Et,o as ni,a as oi,b as ri,_ as n,l as It,F as hi,e as li,q as ci,z as pt,i as ui,B as Mt,D as gi,W as xi,az as di,a7 as Dt}from"./mermaid.core-CsZwh_jB.js";import{i as fi}from"./init-Gi6I4Gst.js";import{o as pi}from"./ordinal-Cboi1Yqb.js";import{l as vt}from"./linear-CV4KY8w2.js";import"./index-Bxn5yOTB.js";import"./_commonjsHelpers-CqkleIqs.js";import"./defaultLocale-DX6XiGOO.js";function mi(t,i,e){t=+t,i=+i,e=(a=arguments.length)<2?(i=t,t=0,1):a<3?1:+e;for(var s=-1,a=Math.max(0,Math.ceil((i-t)/e))|0,c=new Array(a);++s"u"&&(D.yylloc={});var ht=D.yylloc;o.push(ht);var ii=D.options&&D.options.ranges;typeof U.yy.parseError=="function"?this.parseError=U.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ei(z){g.length=g.length-2*z,w.length=w.length-z,o.length=o.length-z}n(ei,"popStack");function kt(){var z;return z=x.pop()||D.lex()||_t,typeof z!="number"&&(z instanceof Array&&(x=z,z=x.pop()),z=u.symbols_[z]||z),z}n(kt,"lex");for(var M,$,O,lt,G={},st,N,Tt,at;;){if($=g[g.length-1],this.defaultActions[$]?O=this.defaultActions[$]:((M===null||typeof M>"u")&&(M=kt()),O=K[$]&&K[$][M]),typeof O>"u"||!O.length||!O[0]){var ct="";at=[];for(st in K[$])this.terminals_[st]&&st>Jt&&at.push("'"+this.terminals_[st]+"'");D.showPosition?ct="Parse error on line "+(et+1)+`: `+D.showPosition()+` Expecting `+at.join(", ")+", got '"+(this.terminals_[M]||M)+"'":ct="Parse error on line "+(et+1)+": Unexpected "+(M==_t?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(ct,{text:D.match,token:this.terminals_[M]||M,line:D.yylineno,loc:ht,expected:at})}if(O[0]instanceof Array&&O.length>1)throw new Error("Parse Error: multiple actions possible at state: "+$+", token: "+M);switch(O[0]){case 1:g.push(M),w.push(D.yytext),o.push(D.yylloc),g.push(O[1]),M=null,Rt=D.yyleng,d=D.yytext,et=D.yylineno,ht=D.yylloc;break;case 2:if(N=this.productions_[O[1]][1],G.$=w[w.length-N],G._$={first_line:o[o.length-(N||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(N||1)].first_column,last_column:o[o.length-1].last_column},ii&&(G._$.range=[o[o.length-(N||1)].range[0],o[o.length-1].range[1]]),lt=this.performAction.apply(G,[d,Rt,et,U.yy,O[1],w,o].concat(ti)),typeof lt<"u")return lt;N&&(g=g.slice(0,-1*N*2),w=w.slice(0,-1*N),o=o.slice(0,-1*N)),g.push(this.productions_[O[1]][0]),w.push(G.$),o.push(G._$),Tt=K[g[g.length-2]][g[g.length-1]],g.push(Tt);break;case 3:return!0}}return!0},"parse")},Q=(function(){var F={EOF:1,parseError:n(function(u,g){if(this.yy.parser)this.yy.parser.parseError(u,g);else throw new Error(u)},"parseError"),setInput:n(function(r,u){return this.yy=u||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:n(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var u=r.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:n(function(r){var u=r.length,g=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var x=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),g.length-1&&(this.yylineno-=g.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:g?(g.length===x.length?this.yylloc.first_column:0)+x[x.length-g.length].length-g[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:n(function(){return this._more=!0,this},"more"),reject:n(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:n(function(r){this.unput(this.match.slice(r))},"less"),pastInput:n(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:n(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:n(function(){var r=this.pastInput(),u=new Array(r.length+1).join("-");return r+this.upcomingInput()+` diff --git a/apps/kimi-code/dist-web/index.html b/apps/kimi-code/dist-web/index.html index f98318975c8..5fa7040609c 100644 --- a/apps/kimi-code/dist-web/index.html +++ b/apps/kimi-code/dist-web/index.html @@ -14,7 +14,7 @@ the server's Content-Security-Policy forbids inline scripts. --> Kimi Code Web - + From 23e68eee8bdfaded522dfabf2c9ad6996939a679 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 10:57:01 +0800 Subject: [PATCH 30/50] refactor(agent-core-v2): remove the agent RPC aggregation layer (#2871) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(agent-core-v2): remove the agent RPC aggregation layer - delete src/agent/rpc/ (AgentRPCService, IAgentRPCService, core-api, prompt-metadata, types) and sink each method's orchestration into its owning domain service - prompt: new submit/submitSteer composing disabledTools gating, MAIN-only session metadata, and engine-side {turn_id} settlement - skill: activate now returns PromptLaunchResult and writes session metadata internally (MAIN-only, unified across prompt/steer/skill/ pluginCommand); node-sdk and kap-server drop their edge-side writes - pluginCommand: new agent-scope domain owning command activation and the plugin_command.activated domain event - permissionMode/loop/fullCompaction: new setModeAndBroadcast / cancelFromUser / cancel; setMode and loop.cancel stay pure for internal callers - klient: agentRpcContract split into per-domain contracts; facade re-routes to domain channels with its public API unchanged - node-sdk, kap-server, kimi-inspect and the v2 test harness now call domain services directly; ctx.rpc keeps its name as a composed adapter - externally visible: the agentRPCService debug channel is gone and session metadata writes are now MAIN-agent-only (see changeset) * refactor(agent-core-v2): move disabledTools gating out of the prompt domain Prompt should not own session tool policy: submit no longer accepts or applies disabledTools. The klient facade keeps its prompt({ disabledTools }) API and composes it edge-side — applying agentToolPolicyService setSessionDisabledTools before calling agentPromptService.submit, the same way kap-server's prompt route already does. Over klient, a profile-less engine now surfaces the raw profile error instead of request.invalid. Also restores the RPC-removal changeset, which did not make it into the previous commit. * chore(agent-core-v2): drop the RPC-removal changeset * refactor(klient): drop disabledTools from the prompt entry entirely The prompt path no longer carries session tool gating on any surface: the klient facade prompt() loses the disabledTools field and calls agentPromptService.submit directly, and the node-sdk SessionPromptRpcInput stops accepting or forwarding it (v1 always ignored the field). Session tool gating remains available through IAgentToolPolicyService.setSessionDisabledTools, composed at the edge the way kap-server's prompt route does; the klient toolPolicy contract added for facade-side composition is removed as unused. --- .../skills/agent-core-dev/edge-exposure.md | 2 +- .agents/skills/agent-core-dev/server-align.md | 4 +- .../agent-core-dev/service-authoring.md | 2 +- apps/kimi-inspect/src/channel/channel.test.ts | 4 +- apps/kimi-inspect/src/channel/client.ts | 2 +- apps/kimi-inspect/src/components/ChatView.tsx | 12 +- apps/kimi-inspect/src/panels.ts | 14 - packages/agent-core-v2/AGENTS.md | 2 +- .../agent/fullCompaction/fullCompaction.ts | 1 + .../fullCompaction/fullCompactionService.ts | 11 + packages/agent-core-v2/src/agent/loop/loop.ts | 2 + .../src/agent/loop/loopService.ts | 11 + .../agent/permissionMode/permissionMode.ts | 1 + .../permissionMode/permissionModeService.ts | 33 +- .../src/agent/pluginCommand/pluginCommand.ts | 41 ++ .../pluginCommand/pluginCommandService.ts | 111 ++++++ .../agent-core-v2/src/agent/prompt/prompt.ts | 15 + .../src/agent/prompt/promptService.ts | 85 ++++- .../src/agent/replayBuilder/types.ts | 18 +- .../agent-core-v2/src/agent/rpc/core-api.ts | 357 ------------------ .../src/agent/rpc/prompt-metadata.ts | 84 ----- packages/agent-core-v2/src/agent/rpc/rpc.ts | 20 - .../agent-core-v2/src/agent/rpc/rpcService.ts | 281 -------------- packages/agent-core-v2/src/agent/rpc/types.ts | 11 - .../agent-core-v2/src/agent/skill/prompt.ts | 10 + .../agent-core-v2/src/agent/skill/skill.ts | 4 +- .../src/agent/skill/skillService.ts | 38 +- packages/agent-core-v2/src/index.ts | 11 +- .../session/sessionMetadata/promptMetadata.ts | 56 +++ .../agent-core-v2/test/agent/loop/stubs.ts | 1 + .../setModeAndBroadcast.test.ts} | 2 +- .../test/agent/permissionMode/stubs.ts | 1 + .../agent/pluginCommand/pluginCommand.test.ts | 120 ++++++ .../promptMetadataText.test.ts} | 38 +- .../test/agent/prompt/promptService.test.ts | 13 + .../test/agent/prompt/submit.test.ts | 82 ++++ .../test/agent/rpc/runShellCommand.test.ts | 35 -- .../test/agent/rpc/undoHistory.test.ts | 52 --- .../{rpc => skill}/activateSkill.test.ts | 15 +- .../test/agent/skill/skill.test.ts | 12 + .../toolSelect/toolSelectService.test.ts | 2 + .../test/app/gateway/gateway.test.ts | 2 + .../plan/tools/exit-plan-mode.test.ts | 1 + .../plan/tools/plan-tools-telemetry.test.ts | 1 + packages/agent-core-v2/test/harness/agent.ts | 122 ++++-- .../test/session/swarm/sessionSwarm.test.ts | 1 + .../kap-server/src/protocol/events-zod.ts | 2 +- packages/kap-server/src/routes/sessions.ts | 6 +- packages/kap-server/src/routes/skills.ts | 25 +- .../src/services/transcript/coreEventMap.ts | 2 +- packages/kap-server/test/rpc.test.ts | 96 +---- .../src/contract/agent/{rpc.ts => schemas.ts} | 44 +-- .../klient/src/contract/agent/services.ts | 54 ++- packages/klient/src/contract/global/events.ts | 2 +- packages/klient/src/contract/index.ts | 16 +- packages/klient/src/core/facade/agent.ts | 64 ++-- .../src/transports/memory/serviceRegistry.ts | 16 +- packages/klient/test/contract-parity.ts | 63 ++-- packages/klient/test/facade.test.ts | 64 +++- packages/node-sdk/src/rpc.ts | 7 - packages/node-sdk/src/sdk-rpc-client-v2.ts | 109 +++--- packages/node-sdk/test/v1-v2-parity.test.ts | 4 +- 62 files changed, 1079 insertions(+), 1238 deletions(-) create mode 100644 packages/agent-core-v2/src/agent/pluginCommand/pluginCommand.ts create mode 100644 packages/agent-core-v2/src/agent/pluginCommand/pluginCommandService.ts delete mode 100644 packages/agent-core-v2/src/agent/rpc/core-api.ts delete mode 100644 packages/agent-core-v2/src/agent/rpc/prompt-metadata.ts delete mode 100644 packages/agent-core-v2/src/agent/rpc/rpc.ts delete mode 100644 packages/agent-core-v2/src/agent/rpc/rpcService.ts delete mode 100644 packages/agent-core-v2/src/agent/rpc/types.ts create mode 100644 packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts rename packages/agent-core-v2/test/agent/{rpc/setPermission.test.ts => permissionMode/setModeAndBroadcast.test.ts} (97%) create mode 100644 packages/agent-core-v2/test/agent/pluginCommand/pluginCommand.test.ts rename packages/agent-core-v2/test/agent/{rpc/prompt-metadata.test.ts => prompt/promptMetadataText.test.ts} (58%) create mode 100644 packages/agent-core-v2/test/agent/prompt/submit.test.ts delete mode 100644 packages/agent-core-v2/test/agent/rpc/runShellCommand.test.ts delete mode 100644 packages/agent-core-v2/test/agent/rpc/undoHistory.test.ts rename packages/agent-core-v2/test/agent/{rpc => skill}/activateSkill.test.ts (75%) rename packages/klient/src/contract/agent/{rpc.ts => schemas.ts} (71%) diff --git a/.agents/skills/agent-core-dev/edge-exposure.md b/.agents/skills/agent-core-dev/edge-exposure.md index 5039201ac95..0c8e6652d38 100644 --- a/.agents/skills/agent-core-dev/edge-exposure.md +++ b/.agents/skills/agent-core-dev/edge-exposure.md @@ -45,7 +45,7 @@ A Service method is directly exposable iff **all** hold: 3. Errors are `KimiError` (coded). 4. It is a command/query, not a factory, stream, byte-store, or sink. -If any fail → wrap in a **facade** (a Service that takes ids, returns data, throws `KimiError`) and expose the facade. The repo already ships a wire-shaped facade in `rpc/core-api.ts` (`CoreAPI` / `SessionAPI` / `AgentAPI`) behind `IAgentRPCService` / `ISessionRPCService` — prefer building the HTTP edge on top of it rather than re-deriving a new one. +If any fail → add a wire-safe orchestration method to the owning domain Service (e.g. `IAgentPromptService.submit` settles `{turn_id}` instead of returning the live `PromptHandle`) or compose several domain Services at the edge — kap-server's `routes/prompts.ts` is the reference for edge-side composition. ## 3. Per-scope `resource:action` map diff --git a/.agents/skills/agent-core-dev/server-align.md b/.agents/skills/agent-core-dev/server-align.md index 6907a710a22..32a8948a4b7 100644 --- a/.agents/skills/agent-core-dev/server-align.md +++ b/.agents/skills/agent-core-dev/server-align.md @@ -165,7 +165,7 @@ const route = defineRoute( app.post(route.path, route.options, route.handler); ``` -**For `/api/v2` (native):** add a `resource:action` entry to `actionMap` ([edge-exposure.md](edge-exposure.md) §3). If the method fails the direct-exposure rules (returns a handle / stream / bytes, takes a live object), wrap it in a wire-shaped facade first (`IAgentRPCService` / `ISessionRPCService`) and map to the facade — as `prompts:*` does via `IAgentRPCService`. +**For `/api/v2` (native):** add a `resource:action` entry to `actionMap` ([edge-exposure.md](edge-exposure.md) §3). If the method fails the direct-exposure rules (returns a handle / stream / bytes, takes a live object), add a wire-safe orchestration method to the owning domain Service first — as `prompts:submit` maps to `IAgentPromptService.submit`, which settles `{turn_id}` engine-side instead of returning the live `PromptHandle`. ### 5. Map errors @@ -218,7 +218,7 @@ This is the reference alignment (commits `feat(server-v2): port v1 /sessions/:si **The split.** -- `/api/v2` keeps the native shape — `prompts:submit` / `steer` / `undo` / `clear` / `cancel` map to `IAgentRPCService` (a wire facade over the v2 turn driver) in `actionMap`. The native `IAgentPromptService` is untouched. +- `/api/v2` keeps the native shape — `prompts:submit` / `steer` / `undo` / `clear` / `cancel` map to the domain Services (`IAgentPromptService.submit` / `submitSteer`, `IAgentConversationUndoService.undo`, `IAgentLoopService.cancelFromUser`) in `actionMap`. - `/api/v1` gets an `AgentPromptLegacyService` (`prompt/`, `LifecycleScope.Agent`) that re-implements the v1 scheduler — queue, `prompt_id`, steer/abort, auto-start-next — **on top of** the native `IAgentPromptService`. The `/api/v1` routes consume the LegacyService. **The schema.** Both surfaces import `promptSubmissionSchema` / `promptSubmitResultSchema` / `promptListResponseSchema` / `promptSteerRequestSchema` / `promptSteerResultSchema` / `promptAbortResponseSchema` from the shared v1 wire schemas (see `packages/kap-server/src/protocol`). The `/api/v1` and `/api/v2` routes are therefore compatible with released clients by construction; the LegacyService projects v2 turn results back into those protocol shapes. diff --git a/.agents/skills/agent-core-dev/service-authoring.md b/.agents/skills/agent-core-dev/service-authoring.md index 5484f48edca..6aef868243a 100644 --- a/.agents/skills/agent-core-dev/service-authoring.md +++ b/.agents/skills/agent-core-dev/service-authoring.md @@ -51,7 +51,7 @@ File names derive from the interface / class names so that scope and role are vi | Shared-types file | `.types.ts` | `log.types.ts` | | Errors file | `.errors.ts` | `appendLogStore.errors.ts` | -Acronym-aware lowerCamelCase lowercases a leading acronym as a group: `ILLMRequester` → `llmRequester.ts`, `IWSGateway` → `wsGateway.ts`, `IOAuthToolkit` → `oauthToolkit.ts`, `IAgentRPCService` → `agentRpcService.ts`. +Acronym-aware lowerCamelCase lowercases a leading acronym as a group: `ILLMRequester` → `llmRequester.ts`, `IWSGateway` → `wsGateway.ts`, `IOAuthToolkit` → `oauthToolkit.ts`, `IMcpServerService` → `mcpServerService.ts`. Because the impl class always ends in `Service` and the interface file never does, the two files of one service never collide — even for `Store` / `Registry` / `Resolver` interfaces (`IAppendLogStore` → `appendLogStore.ts` + `appendLogStoreService.ts`). diff --git a/apps/kimi-inspect/src/channel/channel.test.ts b/apps/kimi-inspect/src/channel/channel.test.ts index 1064924feaf..ff3d6bfad6e 100644 --- a/apps/kimi-inspect/src/channel/channel.test.ts +++ b/apps/kimi-inspect/src/channel/channel.test.ts @@ -31,14 +31,14 @@ describe('ProxyChannel.call', () => { it('POSTs the command to the service base URL; no body and no header without args/token', async () => { const { calls, fetchImpl } = fakeFetch(ok({ id: 's1' })); const channel = new ProxyChannel({ - baseUrl: 'http://h:1/api/v1/debug/session/s%201/agent/main/agentRPCService', + baseUrl: 'http://h:1/api/v1/debug/session/s%201/agent/main/agentLoopService', fetch: fetchImpl, }); const result = await channel.call('getModel', []); expect(result).toEqual({ id: 's1' }); expect(calls).toHaveLength(1); expect(calls[0]!.url).toBe( - 'http://h:1/api/v1/debug/session/s%201/agent/main/agentRPCService/getModel', + 'http://h:1/api/v1/debug/session/s%201/agent/main/agentLoopService/getModel', ); expect(calls[0]!.init?.method).toBe('POST'); expect(calls[0]!.init?.body).toBeUndefined(); diff --git a/apps/kimi-inspect/src/channel/client.ts b/apps/kimi-inspect/src/channel/client.ts index f0149efb1a5..a500fdc57b0 100644 --- a/apps/kimi-inspect/src/channel/client.ts +++ b/apps/kimi-inspect/src/channel/client.ts @@ -8,7 +8,7 @@ * await client.core(ISessionIndex).listRecent({}); * await client.workspace('wd_1').service(ISessionLifecycleService).resume('s1'); * await client.session('s1').service(ISessionMetadata).read(); - * await client.session('s1').agent('main').service(IAgentRPCService).cancel({}); + * await client.session('s1').agent('main').service(IAgentLoopService).cancelFromUser(); * * The `agent-core-v2` service token is the whole key: its type parameter `T` * types the returned proxy, and its decorator id (`String(id)`) is the channel diff --git a/apps/kimi-inspect/src/components/ChatView.tsx b/apps/kimi-inspect/src/components/ChatView.tsx index 2ba937a2e3c..25d50369b11 100644 --- a/apps/kimi-inspect/src/components/ChatView.tsx +++ b/apps/kimi-inspect/src/components/ChatView.tsx @@ -14,12 +14,14 @@ * a full REST refresh; nothing is resynced from the socket itself. * * Rendering is turn-granular (turn → step → frame) and typed entirely by the - * transcript data model. Prompts/cancels go through the `IAgentRPCService` + * transcript data model. Prompts/cancels go through the `IAgentPromptService` + * / `IAgentLoopService` channels * over the debug RPC surface (`/api/v1/debug`); the running indicator * derives from transcript state (`meta.activity` / running turns). */ -import { IAgentRPCService } from '@moonshot-ai/agent-core-v2/agent/rpc/rpc'; +import { IAgentLoopService } from '@moonshot-ai/agent-core-v2/agent/loop/loop'; +import { IAgentPromptService } from '@moonshot-ai/agent-core-v2/agent/prompt/prompt'; import { ISessionApprovalService } from '@moonshot-ai/agent-core-v2/session/approval/approval'; import { ISessionQuestionService, @@ -561,8 +563,8 @@ export function ChatView({ await klient .session(sessionId) .agent(agentId) - .service(IAgentRPCService) - .prompt({ input: [{ type: 'text', text }] }); + .service(IAgentPromptService) + .submit({ input: [{ type: 'text', text }] }); trail?.recordEvent('prompt', text, state); } catch (error) { setSendError(error); @@ -572,7 +574,7 @@ export function ChatView({ const cancel = async () => { if (sessionId === null) return; try { - await klient.session(sessionId).agent(agentId).service(IAgentRPCService).cancel({}); + await klient.session(sessionId).agent(agentId).service(IAgentLoopService).cancelFromUser(); trail?.recordEvent('cancel', undefined, state); } catch (error) { setSendError(error); diff --git a/apps/kimi-inspect/src/panels.ts b/apps/kimi-inspect/src/panels.ts index 51e66304a4e..ae42e1afa0f 100644 --- a/apps/kimi-inspect/src/panels.ts +++ b/apps/kimi-inspect/src/panels.ts @@ -23,7 +23,6 @@ import { IAgentPermissionModeService } from '@moonshot-ai/agent-core-v2/agent/pe import { IAgentPermissionRulesService } from '@moonshot-ai/agent-core-v2/agent/permissionRules/permissionRules'; import { IAgentPlanService } from '@moonshot-ai/agent-core-v2/features/plan/plan'; import { IAgentProfileService } from '@moonshot-ai/agent-core-v2/agent/profile/profile'; -import { IAgentRPCService } from '@moonshot-ai/agent-core-v2/agent/rpc/rpc'; import { IAgentSwarmService } from '@moonshot-ai/agent-core-v2/agent/swarm/swarm'; import { IAgentTaskService } from '@moonshot-ai/agent-core-v2/agent/task/task'; import { IAgentTokenCountingService } from '@moonshot-ai/agent-core-v2/agent/tokenCounting/tokenCounting'; @@ -269,17 +268,4 @@ export const AGENT_PANELS: readonly ServicePanelDef[] = [ { label: 'exit', run: (svc) => call(svc, 'exit') }, ], }, - { - id: String(IAgentRPCService), - label: 'AgentRPCService', - scope: 'agent', - actions: [ - { label: 'cancel turn', run: (svc) => call(svc, 'cancel', {}) }, - { - label: 'undoHistory', - input: 'Steps', - run: (svc, n) => call(svc, 'undoHistory', { count: Number(n) }), - }, - ], - }, ]; diff --git a/packages/agent-core-v2/AGENTS.md b/packages/agent-core-v2/AGENTS.md index ea24ad4815b..98734917942 100644 --- a/packages/agent-core-v2/AGENTS.md +++ b/packages/agent-core-v2/AGENTS.md @@ -17,7 +17,7 @@ The DI kernel (`src/_base/di/`) owns the unit layer on top of the scoped registr - `instantiation.ts` — the `@ref(IX)` decorator factory (`LiveRef`: `current` live read + `onDidChange` availability event; observation creates no binding and no graph edge) and `ScopeActivation`. - `src/app/feature/` — `IFeatureManager` (App scope): runtime unit assembly (`provideUnit` / `unprovideUnit` / `updateUnit`) and introspection (`units()` / `onDidChangeUnits`); managed units hang on the manager's own book. External package management stays with `IPluginService`. The `features` assembly (`src/features/featureAssemblyService.ts`) drains the module-level feature table through it. -The four contribution seams (token → fold): config sections — `ConfigSectionContribution` → `ConfigRegistry` fold (`src/app/config/`; module-level `registerConfigSection` stays the static built-in channel drained at construction, a withdrawn runtime record unregisters the section while user TOML values survive); agent tools — `AgentToolContribution` → `AgentToolActivationService` fold (built-in records provided once at App scope by `builtinToolAssemblyService`; `registerAgentToolService` stays the static channel: Agent-scope DI `OnDemand` registration + module table); agent profiles — `AgentProfileContribution` → `IAgentProfileRegistry` fold (see Scopes); wire vocabulary — `WireModelContribution` → `WireService` fold (a record bundles `models` / `ops` / `crossReducers` / `checkpointedModels`; the built-in layer is the module tables drained at fold time — `defineOp` / `defineModel` / `defineCheckpointedModel` stay the static channel — and replaying a withdrawn domain's history lands on the unknown-op skip-and-count path). A fifth seam: executable commands — `CommandContribution` → `IAgentCommandService` fold (`src/agent/command/`; a contributed command runs engine-side — `run(ctx)` gets `ctx.get` resolving through the agent container, valid only during the synchronous part of `run`; name-level dedup, last record wins; surfaced over RPC as `agentRPCService.listCommands` / `runCommand`). +The four contribution seams (token → fold): config sections — `ConfigSectionContribution` → `ConfigRegistry` fold (`src/app/config/`; module-level `registerConfigSection` stays the static built-in channel drained at construction, a withdrawn runtime record unregisters the section while user TOML values survive); agent tools — `AgentToolContribution` → `AgentToolActivationService` fold (built-in records provided once at App scope by `builtinToolAssemblyService`; `registerAgentToolService` stays the static channel: Agent-scope DI `OnDemand` registration + module table); agent profiles — `AgentProfileContribution` → `IAgentProfileRegistry` fold (see Scopes); wire vocabulary — `WireModelContribution` → `WireService` fold (a record bundles `models` / `ops` / `crossReducers` / `checkpointedModels`; the built-in layer is the module tables drained at fold time — `defineOp` / `defineModel` / `defineCheckpointedModel` stay the static channel — and replaying a withdrawn domain's history lands on the unknown-op skip-and-count path). A fifth seam: executable commands — `CommandContribution` → `IAgentCommandService` fold (`src/agent/command/`; a contributed command runs engine-side — `run(ctx)` gets `ctx.get` resolving through the agent container, valid only during the synchronous part of `run`; name-level dedup, last record wins; surfaced over RPC as `agentCommandService.list` / `run`). `src/features/` — built-in capabilities authored as self-contained Feature units (`plan` is the first, extracted from `agent/plan` + `agent/tools/plan`). A `Feature` (`src/features/feature.ts`) is an App-scope unit recipe with a `static override readonly name` and `contribute*` helpers composing the seams: `contributeService(scope, id, ctor)` / `contributeAgentService` (per-scope materialization via `ScopeUnits` — provider death retracts everywhere, 连坐), `contributeTool` (per-agent `OnDemand` registration + the `AgentToolContribution` record), `contributeProfiles`, `contributeConfig`, `contributeCommand`, plus `onDispose`. Feature modules self-register at import (`registerFeature`, `src/features/featureRegistry.ts`); the App-scope `IFeatureAssemblyService` drains the table through `IFeatureManager.provideUnit`, so every feature is a named, introspectable, retractable managed unit. Built-in features keep user-facing static contracts — config sections, agent profiles, wire vocabulary — on the static import=register channels (the config/state manifest generators read static tables / call sites; wire records must stay replayable); the Feature unit carries the runtime capabilities (services, tools, commands). The string form of the unit `on(...)` capability (`this.on('turn.ended', …)`) is backed by the production `FiberEventResolver` registered in `src/app/event/fiberEventResolver.ts`, resolving against the scope's `IEventBus`. diff --git a/packages/agent-core-v2/src/agent/fullCompaction/fullCompaction.ts b/packages/agent-core-v2/src/agent/fullCompaction/fullCompaction.ts index 5a005ea2837..88c70d19440 100644 --- a/packages/agent-core-v2/src/agent/fullCompaction/fullCompaction.ts +++ b/packages/agent-core-v2/src/agent/fullCompaction/fullCompaction.ts @@ -24,6 +24,7 @@ export interface IAgentFullCompactionService { readonly compacting: FullCompactionTask | null; begin(input: FullCompactionInput): boolean; + cancel(): void; readonly hooks: Hooks<{ onWillCompact: FullCompactionTask; diff --git a/packages/agent-core-v2/src/agent/fullCompaction/fullCompactionService.ts b/packages/agent-core-v2/src/agent/fullCompaction/fullCompactionService.ts index 7994b1bb640..1f356cc19df 100644 --- a/packages/agent-core-v2/src/agent/fullCompaction/fullCompactionService.ts +++ b/packages/agent-core-v2/src/agent/fullCompaction/fullCompactionService.ts @@ -247,6 +247,17 @@ export class AgentFullCompactionService extends Service implements IAgentFullCom return this._compacting; } + cancel(): void { + const active = this._compacting; + if (active !== null) { + this.telemetry.track2('cancel', { + from: 'compacting', + trace_id: active.traceId, + }); + } + active?.abortController.abort(); + } + private getEffectiveMaxContextTokens(): number { const capability = this.profile.data().modelCapabilities; const configured = capability.max_input_tokens ?? capability.max_context_tokens; diff --git a/packages/agent-core-v2/src/agent/loop/loop.ts b/packages/agent-core-v2/src/agent/loop/loop.ts index 38853feb4bb..3fcc68993c9 100644 --- a/packages/agent-core-v2/src/agent/loop/loop.ts +++ b/packages/agent-core-v2/src/agent/loop/loop.ts @@ -147,6 +147,8 @@ export interface IAgentLoopService { cancel(turnId?: number, reason?: unknown): boolean; + cancelFromUser(turnId?: number): void; + tryAcquireQuiescence(): IDisposable | undefined; settled(): Promise; diff --git a/packages/agent-core-v2/src/agent/loop/loopService.ts b/packages/agent-core-v2/src/agent/loop/loopService.ts index 9e57491c093..68d3f4a700a 100644 --- a/packages/agent-core-v2/src/agent/loop/loopService.ts +++ b/packages/agent-core-v2/src/agent/loop/loopService.ts @@ -250,6 +250,17 @@ export class AgentLoopService extends Disposable implements IAgentLoopService { ); } + cancelFromUser(turnId?: number): void { + const status = this.status(); + if (status.state === 'running') { + this.telemetry.track2('cancel', { + from: 'streaming', + trace_id: status.activeTraceId, + }); + } + this.cancel(turnId); + } + tryAcquireQuiescence(): IDisposable | undefined { if (this.disposing) throw abortError('Agent loop disposed'); if ( diff --git a/packages/agent-core-v2/src/agent/permissionMode/permissionMode.ts b/packages/agent-core-v2/src/agent/permissionMode/permissionMode.ts index 1d04758748d..aaae863872b 100644 --- a/packages/agent-core-v2/src/agent/permissionMode/permissionMode.ts +++ b/packages/agent-core-v2/src/agent/permissionMode/permissionMode.ts @@ -12,6 +12,7 @@ export interface IAgentPermissionModeService { readonly mode: PermissionMode; setMode(mode: PermissionMode): void; + setModeAndBroadcast(mode: PermissionMode): void; readonly onDidChangeMode: Event; } diff --git a/packages/agent-core-v2/src/agent/permissionMode/permissionModeService.ts b/packages/agent-core-v2/src/agent/permissionMode/permissionModeService.ts index b556bfd9e49..a4c0bada6a2 100644 --- a/packages/agent-core-v2/src/agent/permissionMode/permissionModeService.ts +++ b/packages/agent-core-v2/src/agent/permissionMode/permissionModeService.ts @@ -5,8 +5,11 @@ * `PermissionModeModel`, mutating it only through the `permission.set_mode` Op * (`wire.dispatch(setMode({ mode }))`) and reading it through `wire.getModel`. * `setMode` emits `onDidChangeMode` after an actual change, and mode-aware - * reminders are registered through the permission-mode injection helper. Bound - * at Agent scope. + * reminders are registered through the permission-mode injection helper. + * `setModeAndBroadcast` is the user-facing entry: on top of `setMode` it + * broadcasts the mode to every agent of the session through `agentLifecycle` + * (main agent only) and tracks the `yolo_toggle` / `afk_toggle` transitions + * through `telemetry`. Bound at Agent scope. */ import type { PermissionMode } from '#/agent/permissionPolicy/types'; @@ -16,6 +19,12 @@ import { LifecycleScope } from '#/app/scopes'; import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { Emitter, type Event } from '#/_base/event'; import { PermissionModeInjection } from '#/agent/permissionMode/injection/permissionModeInjection'; +import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; +import { ITelemetryService } from '#/app/telemetry/telemetry'; +import { + IAgentLifecycleService, + MAIN_AGENT_ID, +} from '#/session/agentLifecycle/agentLifecycle'; import { IWireService } from '#/wire/wire'; import { IAgentPermissionModeService, type PermissionModeChangedContext } from './permissionMode'; import { @@ -33,6 +42,9 @@ export class AgentPermissionModeService extends Service implements IAgentPermiss constructor( @IWireService private readonly wire: IWireService, @IInstantiationService instantiation: IInstantiationService, + @IAgentScopeContext private readonly scopeContext: IAgentScopeContext, + @IAgentLifecycleService private readonly agentLifecycle: IAgentLifecycleService, + @ITelemetryService private readonly telemetry: ITelemetryService, ) { super(); this._register(instantiation.createInstance(PermissionModeInjection, this)); @@ -49,6 +61,23 @@ export class AgentPermissionModeService extends Service implements IAgentPermiss this.wire.dispatch(setMode({ mode })); if (changed) this._onDidChangeMode.fire({ mode, previousMode }); } + + setModeAndBroadcast(mode: PermissionMode): void { + const wasYolo = this.mode === 'yolo'; + const wasAuto = this.mode === 'auto'; + this.setMode(mode); + if (this.scopeContext.agentId === MAIN_AGENT_ID) { + this.agentLifecycle.broadcastPermissionMode(mode); + } + const yoloEnabled = this.mode === 'yolo'; + if (yoloEnabled !== wasYolo) { + this.telemetry.track2('yolo_toggle', { enabled: yoloEnabled }); + } + const afkEnabled = this.mode === 'auto'; + if (afkEnabled !== wasAuto) { + this.telemetry.track2('afk_toggle', { enabled: afkEnabled }); + } + } } registerScopedService( diff --git a/packages/agent-core-v2/src/agent/pluginCommand/pluginCommand.ts b/packages/agent-core-v2/src/agent/pluginCommand/pluginCommand.ts new file mode 100644 index 00000000000..4838da64fbf --- /dev/null +++ b/packages/agent-core-v2/src/agent/pluginCommand/pluginCommand.ts @@ -0,0 +1,41 @@ +/** + * `pluginCommand` domain — Agent-scoped plugin command activation contract. + * + * `IAgentPluginCommandService.activate` drives a user-slash plugin command + * into the agent's prompt pipeline: the command definition lives in the + * App-scope `plugin` domain, while activation (argument expansion, the + * `plugin_command.activated` domain event, prompt enqueue) must run inside the + * agent scope. Bound at Agent scope. + */ + +import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; + +export interface ActivatePluginCommandPayload { + readonly pluginId: string; + readonly commandName: string; + readonly args?: string | undefined; +} + +export interface PluginCommandActivatedEvent { + readonly type: 'plugin_command.activated'; + readonly activationId: string; + readonly pluginId: string; + readonly commandName: string; + readonly commandArgs?: string; + readonly trigger: 'user-slash'; +} + +declare module '#/app/event/eventBus' { + interface DomainEventMap { + 'plugin_command.activated': PluginCommandActivatedEvent; + } +} + +export interface IAgentPluginCommandService { + readonly _serviceBrand: undefined; + + activate(payload: ActivatePluginCommandPayload): Promise; +} + +export const IAgentPluginCommandService: ServiceIdentifier = + createDecorator('agentPluginCommandService'); diff --git a/packages/agent-core-v2/src/agent/pluginCommand/pluginCommandService.ts b/packages/agent-core-v2/src/agent/pluginCommand/pluginCommandService.ts new file mode 100644 index 00000000000..9690cd3746c --- /dev/null +++ b/packages/agent-core-v2/src/agent/pluginCommand/pluginCommandService.ts @@ -0,0 +1,111 @@ +/** + * `pluginCommand` domain — `IAgentPluginCommandService` implementation. + * + * Resolves the command definition through `plugin` (`IPluginService`), expands + * its arguments, publishes the `plugin_command.activated` domain event through + * `eventBus`, enqueues the expanded body as a user message through `prompt`, + * and — for the main agent only — persists the derived title/lastPrompt + * through `sessionMetadata`, publishing the live update through `event`. + * Bound at Agent scope. + */ + +import { randomUUID } from 'node:crypto'; + +import { LifecycleScope } from '#/app/scopes'; +import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; +import { IEventBus } from '#/app/event/eventBus'; +import { IEventService } from '#/app/event/event'; +import { ErrorCodes, Error2 } from '#/errors'; +import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; +import { MAIN_AGENT_ID } from '#/session/agentLifecycle/agentLifecycle'; +import { expandCommandArguments } from '#/app/plugin/commands'; +import { IPluginService } from '#/app/plugin/plugin'; +import { IAgentPromptService } from '#/agent/prompt/prompt'; +import { promptMetadataTextFromText } from '#/agent/prompt/promptMetadataText'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { applyPromptMetadataUpdate } from '#/session/sessionMetadata/promptMetadata'; + +import { + IAgentPluginCommandService, + type ActivatePluginCommandPayload, +} from './pluginCommand'; + +export class AgentPluginCommandService implements IAgentPluginCommandService { + declare readonly _serviceBrand: undefined; + + constructor( + @IPluginService private readonly plugins: IPluginService, + @IAgentPromptService private readonly promptService: IAgentPromptService, + @IEventBus private readonly eventBus: IEventBus, + @ISessionMetadata private readonly metadata: ISessionMetadata, + @IEventService private readonly eventService: IEventService, + @ISessionContext private readonly sessionContext: ISessionContext, + @IAgentScopeContext private readonly scopeContext: IAgentScopeContext, + ) { } + + async activate(payload: ActivatePluginCommandPayload): Promise { + const commands = await this.plugins.listPluginCommands(); + const def = commands.find( + (command) => command.pluginId === payload.pluginId && command.name === payload.commandName, + ); + if (def === undefined) { + throw new Error2( + ErrorCodes.REQUEST_INVALID, + `Plugin command "${payload.pluginId}:${payload.commandName}" was not found`, + ); + } + const commandArgs = payload.args ?? ''; + const expanded = expandCommandArguments(def.body, commandArgs); + const origin = { + kind: 'plugin_command' as const, + activationId: randomUUID(), + pluginId: payload.pluginId, + commandName: payload.commandName, + commandArgs: payload.args, + trigger: 'user-slash' as const, + }; + this.eventBus.publish({ + type: 'plugin_command.activated', + activationId: origin.activationId, + pluginId: origin.pluginId, + commandName: origin.commandName, + commandArgs: origin.commandArgs, + trigger: origin.trigger, + }); + await this.promptService.enqueue({ message: { + role: 'user', + content: [{ type: 'text', text: expanded }], + toolCalls: [], + origin, + } }); + if (this.scopeContext.agentId === MAIN_AGENT_ID) { + await applyPromptMetadataUpdate( + { + metadata: this.metadata, + eventService: this.eventService, + sessionId: this.sessionContext.sessionId, + }, + promptMetadataTextFromPluginCommand(payload), + ); + } + } +} + +function promptMetadataTextFromPluginCommand( + payload: ActivatePluginCommandPayload, +): string | undefined { + const args = payload.args?.trim(); + const command = `/${payload.pluginId}:${payload.commandName}`; + return promptMetadataTextFromText( + args === undefined || args.length === 0 ? command : `${command} ${args}`, + ); +} + +registerScopedService( + LifecycleScope.Agent, + IAgentPluginCommandService, + AgentPluginCommandService, + ScopeActivation.OnScopeCreated, + 'pluginCommand', +); diff --git a/packages/agent-core-v2/src/agent/prompt/prompt.ts b/packages/agent-core-v2/src/agent/prompt/prompt.ts index d5045dd0256..73f1b49e4dc 100644 --- a/packages/agent-core-v2/src/agent/prompt/prompt.ts +++ b/packages/agent-core-v2/src/agent/prompt/prompt.ts @@ -1,6 +1,7 @@ import { createDecorator } from '#/_base/di/instantiation'; import type { ContextMessage } from '#/agent/contextMemory/types'; import type { Turn, TurnResult } from '#/agent/loop/loop'; +import type { ContentPart } from '#/kosong/contract/message'; import type { Hooks } from '#/hooks'; export interface PromptSubmitContext { @@ -47,9 +48,23 @@ export interface PromptQueueSnapshot { readonly pending: readonly PromptSnapshot[]; } +export interface PromptPayload { + readonly input: readonly ContentPart[]; +} + +export interface SteerPayload { + readonly input: readonly ContentPart[]; +} + +export interface PromptLaunchResult { + readonly turn_id: number; +} + export interface IAgentPromptService { readonly _serviceBrand: undefined; enqueue(input: PromptInput): Promise; + submit(payload: PromptPayload): Promise; + submitSteer(payload: SteerPayload): Promise; list(): PromptQueueSnapshot; steer(promptIds: readonly string[]): Promise; abort(promptId: string, reason?: Error): boolean; diff --git a/packages/agent-core-v2/src/agent/prompt/promptService.ts b/packages/agent-core-v2/src/agent/prompt/promptService.ts index efd40bac1c6..f41ded27c77 100644 --- a/packages/agent-core-v2/src/agent/prompt/promptService.ts +++ b/packages/agent-core-v2/src/agent/prompt/promptService.ts @@ -4,7 +4,14 @@ * Assigns prompt and message identities, serializes user prompts through an * active slot and FIFO, converts selected pending prompts into active-turn * steers, settles lifecycle handles, and keeps system input outside the prompt - * resource model. The pure-data `launching` flag is registered into + * resource model. `submit` / `submitSteer` are the wire-facing user entry + * points: they track `input_steer` through `telemetry`, persist the derived + * title/lastPrompt through `sessionMetadata` for the main agent only + * (publishing the live update through `event`), enqueue, and settle + * `{turn_id}` from the launch handle. Session tool gating is an edge + * concern: callers apply `IAgentToolPolicyService.setSessionDisabledTools` + * before submitting, the way kap-server's prompt route composes it. + * The pure-data `launching` flag is registered into * `agentState` (`IAgentStateService`) and read/written through it; the * `active` / `pending` / `steered` records stay plain fields because their * `Record` values carry Deferred promise handles (the container only holds @@ -31,20 +38,31 @@ import type { ToolDidExecuteContext } from '#/agent/toolExecutor/toolHooks'; import { IAgentToolExecutorService } from '#/agent/toolExecutor/toolExecutor'; import type { ContentPart } from '#/kosong/contract/message'; import { IEventBus } from '#/app/event/eventBus'; -import { ErrorCodes, Error2 } from '#/errors'; +import { IEventService } from '#/app/event/event'; +import { ErrorCodes, Error2, isError2 } from '#/errors'; import { OrderedHookSlot } from '#/hooks'; import { IWireService } from '#/wire/wire'; +import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; +import { ITelemetryService } from '#/app/telemetry/telemetry'; +import { MAIN_AGENT_ID } from '#/session/agentLifecycle/agentLifecycle'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; +import { applyPromptMetadataUpdate } from '#/session/sessionMetadata/promptMetadata'; import { IAgentPromptService, type PromptCompletion, type PromptHandle, type PromptInput, + type PromptLaunchResult, + type PromptPayload, type PromptQueueSnapshot, type PromptSnapshot, type PromptState, type PromptSubmitContext, + type SteerPayload, } from './prompt'; +import { promptMetadataTextFromContentParts } from './promptMetadataText'; import { PromptStepRequest, RetryStepRequest, SteerStepRequest } from './promptStepRequests'; declare module '#/app/event/eventBus' { @@ -83,6 +101,11 @@ export class AgentPromptService implements IAgentPromptService { @IWireService private readonly wire: IWireService, @IEventBus private readonly eventBus: IEventBus, @IAgentStateService private readonly states: IAgentStateService, + @ITelemetryService private readonly telemetry: ITelemetryService, + @ISessionMetadata private readonly metadata: ISessionMetadata, + @IEventService private readonly eventService: IEventService, + @ISessionContext private readonly sessionContext: ISessionContext, + @IAgentScopeContext private readonly scopeContext: IAgentScopeContext, ) { this.states.register(promptLaunchingKey); toolExecutor.hooks.onDidExecuteTool.register('prompt-service-delivery', async (ctx, next) => { @@ -129,6 +152,64 @@ export class AgentPromptService implements IAgentPromptService { return record.handle; } + async submit(payload: PromptPayload): Promise { + await this.updatePromptMetadata(promptMetadataTextFromContentParts(payload.input)); + const handle = await this.enqueue({ message: { + role: 'user', + content: [...payload.input], + toolCalls: [], + origin: { kind: 'user' }, + } }); + if (handle.state === 'pending') return undefined; + const turn = await handle.launched; + return turn === undefined ? undefined : { turn_id: turn.id }; + } + + async submitSteer(payload: SteerPayload): Promise { + this.telemetry.track2('input_steer', { parts: payload.input.length }); + // A steer is user input like a prompt — and can even launch the session's + // first turn (e.g. goal mode) — so keep title/lastPrompt in sync the same + // way, matching v1. + await this.updatePromptMetadata(promptMetadataTextFromContentParts(payload.input)); + const queued = await this.enqueue({ message: { + role: 'user', + content: [...payload.input], + toolCalls: [], + } }); + if (queued.state !== 'pending') { + // No active prompt at enqueue time, so the enqueue itself already + // launched this input as its own turn (idle session, or a goal-turn + // boundary where the previous turn just ended) — v1's + // steer-degrades-to-launch end state. Return that turn instead of + // rejecting on a steer-by-id that can never find the record pending. + const turn = await queued.launched; + return turn === undefined ? undefined : { turn_id: turn.id }; + } + try { + const [steered] = await this.steer([queued.id]); + const turn = await steered?.launched; + return turn === undefined ? undefined : { turn_id: turn.id }; + } catch (error) { + // Pending but nothing active to steer into (a manual compaction holds + // the context): the message stays queued and launches once compaction + // finishes, so report it as queued rather than failing the steer. + if (isError2(error) && error.code === ErrorCodes.PROMPT_NOT_FOUND) return undefined; + throw error; + } + } + + private async updatePromptMetadata(text: string | undefined): Promise { + if (this.scopeContext.agentId !== MAIN_AGENT_ID) return; + await applyPromptMetadataUpdate( + { + metadata: this.metadata, + eventService: this.eventService, + sessionId: this.sessionContext.sessionId, + }, + text, + ); + } + list(): PromptQueueSnapshot { return { active: this.active === undefined ? undefined : snapshot(this.active), pending: this.pending.map(snapshot) }; } diff --git a/packages/agent-core-v2/src/agent/replayBuilder/types.ts b/packages/agent-core-v2/src/agent/replayBuilder/types.ts index 8d4b6b49a99..0f13665993d 100644 --- a/packages/agent-core-v2/src/agent/replayBuilder/types.ts +++ b/packages/agent-core-v2/src/agent/replayBuilder/types.ts @@ -7,10 +7,26 @@ import type { PermissionApprovalResultRecord } from '#/agent/permissionRules/per import type { PermissionData, PermissionMode } from '#/agent/permissionPolicy/types'; import type { PlanData } from '#/features/plan/plan'; import type { ToolInfo } from '#/tool/toolContract'; -import type { SessionSummary } from '#/agent/rpc/core-api'; import type { UsageStatus } from '#/agent/usage/usage'; import type { SessionMeta } from '#/session/sessionMetadata/sessionMetadata'; +export type JsonPrimitive = string | number | boolean | null; +export type JsonValue = JsonPrimitive | JsonValue[] | { readonly [key: string]: JsonValue }; +export type JsonObject = { readonly [key: string]: JsonValue }; + +export interface SessionSummary { + readonly id: string; + readonly title?: string | undefined; + readonly lastPrompt?: string; + readonly workDir: string; + readonly sessionDir: string; + readonly createdAt: number; + readonly updatedAt: number; + readonly archived?: boolean | undefined; + readonly metadata?: JsonObject | undefined; + readonly additionalDirs?: readonly string[]; +} + type AgentType = 'main' | 'sub'; export type AgentReplayRecordPayload = diff --git a/packages/agent-core-v2/src/agent/rpc/core-api.ts b/packages/agent-core-v2/src/agent/rpc/core-api.ts deleted file mode 100644 index f1c68603ccd..00000000000 --- a/packages/agent-core-v2/src/agent/rpc/core-api.ts +++ /dev/null @@ -1,357 +0,0 @@ -/** - * `rpc` domain — v2 native RPC contract. - * - * Request/response payloads and event types for the engine's native RPC - * surface. `PromptPayload.disabledTools` is the client-managed session - * denylist, applied before the prompt is enqueued: full-replace semantics, the profile's own - * `disallowedTools` always survive, omitting the field keeps the persisted - * value, and `[]` clears the client portion. It is ignored by engines without - * profile support. - */ - -import type { AgentContextData } from '#/agent/contextMemory/types'; -import type { AgentCommandInfo } from '#/agent/command/agentCommand'; -import type { - GoalBudgetLimits, - GoalBudgetReport, - GoalChange, - GoalChangeStats, - GoalSnapshot, - GoalStatus, - GoalToolResult, -} from '#/agent/goal/types'; -import type { PermissionMode } from '#/agent/permissionPolicy/types'; -import type { SwarmModeTrigger } from '#/agent/swarm/swarm'; -import type { ToolDisclosure, ToolInfo } from '#/tool/toolContract'; -import type { ResolvedConfig } from '#/app/config/config'; -import type { ExperimentalFeatureState } from '#/app/flag/flag'; -import type { ResumeSessionResult } from '#/agent/replayBuilder/types'; -import type { SessionMeta } from '#/session/sessionMetadata/sessionMetadata'; -import type { ContentPart } from '#/kosong/contract/message'; -import type { SessionWarning } from '#/app/sessionLegacy/sessionProtocol'; - -import type { ExportSessionPayload, ExportSessionResult } from '#/app/sessionExport/sessionExport'; -import type { PluginCommandDef, PluginInfo, PluginSummary, ReloadSummary } from '#/app/plugin/types'; -import type { WithAgentId, WithSessionId } from './types'; - -export type { ExportSessionManifest, ExportSessionPayload, ExportSessionResult, ShellEnvironment } from '#/app/sessionExport/sessionExport'; - -export type JsonPrimitive = string | number | boolean | null; -export type JsonValue = JsonPrimitive | JsonValue[] | { readonly [key: string]: JsonValue }; -export type JsonObject = { readonly [key: string]: JsonValue }; - -export type Unsubscribe = () => void; - -export type TextPromptPart = Extract; -export type PromptPart = Extract; - -export type PromptInput = readonly PromptPart[]; - -export type EmptyPayload = {}; -export type SessionMetadataPatch = Partial>; - -export interface ClientTelemetryInfo { - readonly id?: string | undefined; - readonly name?: string | undefined; - readonly version?: string | undefined; - readonly uiMode?: string | undefined; -} - -export interface CreateSessionPayload { - readonly id?: string | undefined; - readonly workDir: string; - readonly model?: string | undefined; - readonly thinking?: string | undefined; - readonly permission?: PermissionMode | undefined; - readonly metadata?: JsonObject | undefined; - readonly additionalDirs?: readonly string[]; - readonly client?: ClientTelemetryInfo | undefined; -} - -export interface CloseSessionPayload { - readonly sessionId: string; -} - -export interface ArchiveSessionPayload { - readonly sessionId: string; -} - -export interface ResumeSessionPayload { - readonly sessionId: string; - readonly additionalDirs?: readonly string[]; -} - -export interface ReloadSessionPayload { - readonly sessionId: string; - readonly forcePluginSessionStartReminder?: boolean | undefined; -} - -export interface ForkSessionPayload { - readonly sessionId: string; - readonly id?: string; - readonly title?: string; - readonly metadata?: JsonObject; -} - -export interface ListSessionsPayload { - readonly workDir?: string; - readonly sessionId?: string; - readonly includeArchive?: boolean; -} - -export interface CoreInfo { - readonly version: string; -} - -export interface SessionSummary { - readonly id: string; - readonly title?: string | undefined; - readonly lastPrompt?: string; - readonly workDir: string; - readonly sessionDir: string; - readonly createdAt: number; - readonly updatedAt: number; - readonly archived?: boolean | undefined; - readonly metadata?: JsonObject | undefined; - readonly additionalDirs?: readonly string[]; -} - -export interface PromptPayload { - readonly input: readonly ContentPart[]; - readonly disabledTools?: readonly string[]; -} -export interface RunShellCommandPayload { - readonly command: string; - readonly commandId?: string; -} -export interface ShellCommandResult { - readonly stdout: string; - readonly stderr: string; - readonly isError?: boolean; - readonly backgrounded?: boolean; -} -export interface CancelShellCommandPayload { - readonly commandId: string; -} -export interface SteerPayload { - readonly input: readonly ContentPart[]; -} -export interface CancelPayload { - readonly turnId?: number; -} -export interface SetThinkingPayload { - readonly level: string; -} -export interface SetPermissionPayload { - readonly mode: PermissionMode; -} -export interface SetModelPayload { - readonly model: string; -} -export interface SetModelResult { - readonly model: string; - readonly providerName?: string | undefined; -} -export interface CancelPlanPayload { - readonly id?: string; -} -export interface EnterSwarmPayload { - readonly trigger: SwarmModeTrigger; -} -export interface BeginCompactionPayload { - readonly instruction?: string; -} -export interface UndoHistoryPayload { - readonly count: number; -} -export interface RegisterToolPayload { - readonly name: string; - readonly description: string; - readonly parameters: Record; - readonly disclosure?: ToolDisclosure; -} -export interface UnregisterToolPayload { - readonly name: string; -} -export interface SetActiveToolsPayload { - readonly names: readonly string[]; -} -export interface StopTaskPayload { - readonly taskId: string; - readonly reason?: string; -} -export interface DetachTaskPayload { - readonly taskId: string; -} -export interface GetTaskOutputPayload { - readonly taskId: string; - readonly tail?: number; -} -export interface GetTasksPayload { - readonly activeOnly?: boolean; - readonly limit?: number; -} -export interface SkillSummary { - readonly name: string; - readonly description: string; - readonly path: string; - readonly source: 'builtin' | 'user' | 'extra' | 'project'; - readonly type?: string | undefined; - readonly disableModelInvocation?: boolean | undefined; - readonly isSubSkill?: boolean | undefined; -} - -export interface ActivateSkillPayload { - readonly name: string; - readonly args?: string | undefined; -} - -export interface ActivatePluginCommandPayload { - readonly pluginId: string; - readonly commandName: string; - readonly args?: string | undefined; -} - -export interface RunCommandPayload { - readonly name: string; - readonly args?: string | undefined; -} - -export interface McpServerInfo { - readonly name: string; - readonly transport: 'stdio' | 'http' | 'sse'; - readonly status: 'pending' | 'connected' | 'failed' | 'disabled' | 'needs-auth' | 'removed'; - readonly toolCount: number; - readonly error?: string; -} - -export interface McpStartupMetrics { - readonly durationMs: number; -} - -export interface ReconnectMcpServerPayload { - readonly name: string; -} - -export interface InstallPluginPayload { - readonly source: string; -} - -export interface SetPluginEnabledPayload { - readonly id: string; - readonly enabled: boolean; -} - -export interface SetPluginMcpServerEnabledPayload { - readonly id: string; - readonly server: string; - readonly enabled: boolean; -} - -export interface RemovePluginPayload { - readonly id: string; -} - -export interface GetPluginInfoPayload { - readonly id: string; -} - -export type ReloadPluginsResult = ReloadSummary; -export type { PluginSummary, PluginInfo }; - -export interface RenameSessionPayload { - readonly title: string; -} - -export interface UpdateSessionMetadataPayload { - readonly metadata: SessionMetadataPatch; -} - -export type { - GoalBudgetLimits, - GoalBudgetReport, - GoalChange, - GoalChangeStats, - GoalSnapshot, - GoalStatus, - GoalToolResult, -}; - -export interface CreateGoalPayload { - readonly objective: string; - readonly replace?: boolean; -} - -export interface GetKimiConfigPayload { - readonly reload?: boolean; -} - -export interface ConfigDiagnostics { - readonly warnings: readonly string[]; -} - -export type SetKimiConfigPayload = ResolvedConfig; - -export interface RemoveKimiProviderPayload { - readonly providerId: string; -} - -export interface PromptLaunchResult { - readonly turn_id: number; -} - -export interface AgentAPI { - prompt: (payload: PromptPayload) => PromptLaunchResult | undefined; - steer: (payload: SteerPayload) => PromptLaunchResult | undefined; - cancel: (payload: CancelPayload) => void; - undoHistory: (payload: UndoHistoryPayload) => Promise; - setPermission: (payload: SetPermissionPayload) => void; - cancelCompaction: (payload: EmptyPayload) => void; - activateSkill: (payload: ActivateSkillPayload) => PromptLaunchResult | undefined; - activatePluginCommand: (payload: ActivatePluginCommandPayload) => void; - listCommands: (payload: EmptyPayload) => readonly AgentCommandInfo[]; - runCommand: (payload: RunCommandPayload) => Promise; - getContext: (payload: EmptyPayload) => AgentContextData; - getTools: (payload: EmptyPayload) => readonly ToolInfo[]; -} - -type AgentAPIWithId = WithAgentId; - -export interface SessionAPI extends AgentAPIWithId { - renameSession: (payload: RenameSessionPayload) => void; - updateSessionMetadata: (payload: UpdateSessionMetadataPayload) => void; - getSessionMetadata: (payload: EmptyPayload) => SessionMeta; - listSkills: (payload: EmptyPayload) => readonly SkillSummary[]; - listPluginCommands: (payload: EmptyPayload) => readonly PluginCommandDef[]; - listMcpServers: (payload: EmptyPayload) => readonly McpServerInfo[]; - getMcpStartupMetrics: (payload: EmptyPayload) => McpStartupMetrics; - reconnectMcpServer: (payload: ReconnectMcpServerPayload) => void; - generateAgentsMd: (payload: EmptyPayload) => void; - getSessionWarnings: (payload: EmptyPayload) => readonly SessionWarning[]; -} - -type SessionAPIWithId = WithSessionId; - -export interface CoreAPI extends SessionAPIWithId { - getCoreInfo: (payload: EmptyPayload) => CoreInfo; - getExperimentalFeatures: (payload: EmptyPayload) => readonly ExperimentalFeatureState[]; - getKimiConfig: (payload: GetKimiConfigPayload) => ResolvedConfig; - getConfigDiagnostics: (payload: EmptyPayload) => ConfigDiagnostics; - setKimiConfig: (payload: SetKimiConfigPayload) => ResolvedConfig; - removeKimiProvider: (payload: RemoveKimiProviderPayload) => ResolvedConfig; - createSession: (payload: CreateSessionPayload) => SessionSummary; - closeSession: (payload: CloseSessionPayload) => void; - archiveSession: (payload: ArchiveSessionPayload) => void; - resumeSession: (payload: ResumeSessionPayload) => ResumeSessionResult; - reloadSession: (payload: ReloadSessionPayload) => ResumeSessionResult; - forkSession: (payload: ForkSessionPayload) => ResumeSessionResult; - listSessions: (payload: ListSessionsPayload) => readonly SessionSummary[]; - exportSession: (payload: ExportSessionPayload) => ExportSessionResult; - listPlugins: (payload: EmptyPayload) => readonly PluginSummary[]; - installPlugin: (payload: InstallPluginPayload) => PluginSummary; - setPluginEnabled: (payload: SetPluginEnabledPayload) => void; - setPluginMcpServerEnabled: (payload: SetPluginMcpServerEnabledPayload) => void; - removePlugin: (payload: RemovePluginPayload) => void; - reloadPlugins: (payload: EmptyPayload) => ReloadPluginsResult; - getPluginInfo: (payload: GetPluginInfoPayload) => PluginInfo; -} diff --git a/packages/agent-core-v2/src/agent/rpc/prompt-metadata.ts b/packages/agent-core-v2/src/agent/rpc/prompt-metadata.ts deleted file mode 100644 index 519e2a440f9..00000000000 --- a/packages/agent-core-v2/src/agent/rpc/prompt-metadata.ts +++ /dev/null @@ -1,84 +0,0 @@ -/** - * `rpc` domain (Agent) — v1-compatible prompt metadata helpers. - * - * Derives title and last-prompt text from native and legacy prompt payloads, - * persists metadata through `sessionMetadata`, and publishes live updates - * through `event`. - */ - -import type { IEventService } from '#/app/event/event'; -import type { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; - -import { - promptMetadataTextFromContentParts, - promptMetadataTextFromText, - titleFromPromptMetadataText, -} from '#/agent/prompt/promptMetadataText'; - -import type { - ActivatePluginCommandPayload, - ActivateSkillPayload, - PromptPayload, -} from './core-api'; - -export { promptMetadataTextFromContentParts, titleFromPromptMetadataText }; - -export function promptMetadataTextFromPayload(payload: PromptPayload): string | undefined { - return promptMetadataTextFromContentParts(payload.input); -} - -export function promptMetadataTextFromSkill(payload: ActivateSkillPayload): string | undefined { - const args = payload.args?.trim(); - return promptMetadataTextFromText( - args === undefined || args.length === 0 ? `/${payload.name}` : `/${payload.name} ${args}`, - ); -} - -export function promptMetadataTextFromPluginCommand( - payload: ActivatePluginCommandPayload, -): string | undefined { - const args = payload.args?.trim(); - const command = `/${payload.pluginId}:${payload.commandName}`; - return promptMetadataTextFromText( - args === undefined || args.length === 0 ? command : `${command} ${args}`, - ); -} - -export function isUntitled(title: string | undefined): boolean { - return title === undefined || title.trim().length === 0 || title === 'New Session'; -} - -export interface PromptMetadataUpdateTarget { - readonly metadata: ISessionMetadata; - readonly eventService: IEventService; - readonly sessionId: string; -} - -export async function applyPromptMetadataUpdate( - target: PromptMetadataUpdateTarget, - text: string | undefined, -): Promise { - if (text === undefined) return; - const current = await target.metadata.read(); - const patch: { lastPrompt: string; title?: string; isCustomTitle?: boolean } = { - lastPrompt: text, - }; - if (!current.isCustomTitle && isUntitled(current.title)) { - patch.title = titleFromPromptMetadataText(text); - patch.isCustomTitle = false; - } - await target.metadata.update(patch); - target.eventService.publish({ - type: 'session.meta.updated', - payload: { - agentId: 'main', - sessionId: target.sessionId, - title: patch.title, - patch: { - title: patch.title, - isCustomTitle: patch.isCustomTitle, - lastPrompt: text, - }, - }, - }); -} diff --git a/packages/agent-core-v2/src/agent/rpc/rpc.ts b/packages/agent-core-v2/src/agent/rpc/rpc.ts deleted file mode 100644 index 66115e90689..00000000000 --- a/packages/agent-core-v2/src/agent/rpc/rpc.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { createDecorator } from "#/_base/di/instantiation"; -import type { - AgentAPI, - SessionAPI, -} from './core-api'; -import type { PromisableMethods } from "#/_base/utils/types"; - -export interface IAgentRPCService extends PromisableMethods { - readonly _serviceBrand: undefined; -} - -export interface ISessionRPCService extends PromisableMethods { - readonly _serviceBrand: undefined; -} - -export const IAgentRPCService = - createDecorator('agentRPCService'); - -export const ISessionRPCService = - createDecorator('agentSessionRPCService'); diff --git a/packages/agent-core-v2/src/agent/rpc/rpcService.ts b/packages/agent-core-v2/src/agent/rpc/rpcService.ts deleted file mode 100644 index 87e8005acb0..00000000000 --- a/packages/agent-core-v2/src/agent/rpc/rpcService.ts +++ /dev/null @@ -1,281 +0,0 @@ -import { randomUUID } from 'node:crypto'; -import { LifecycleScope } from '#/app/scopes'; -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; -import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; -import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting'; -import { IAgentFullCompactionService } from '#/agent/fullCompaction/fullCompaction'; -import { IEventBus } from '#/app/event/eventBus'; -import { IEventService } from '#/app/event/event'; -import { ErrorCodes, Error2, isError2 } from '#/errors'; -import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; -import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; -import { - IAgentLifecycleService, - MAIN_AGENT_ID, -} from '#/session/agentLifecycle/agentLifecycle'; -import { IAgentCommandService } from '#/agent/command/agentCommand'; -import { expandCommandArguments } from '#/app/plugin/commands'; -import { IPluginService } from '#/app/plugin/plugin'; -import { ProfileError } from '#/agent/profile/profile'; -import { IAgentToolPolicyService } from '#/agent/toolPolicy/toolPolicy'; -import { IAgentPromptService } from '#/agent/prompt/prompt'; -import { IAgentConversationUndoService } from '#/agent/undo/undo'; -import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; -import { ISessionContext } from '#/session/sessionContext/sessionContext'; -import { IAgentSkillService } from '#/agent/skill/skill'; -import { ITelemetryService } from '#/app/telemetry/telemetry'; -import { IAgentToolRegistryService } from '#/agent/toolRegistry/toolRegistry'; -import { IAgentLoopService } from '#/agent/loop/loop'; -import type { - ActivatePluginCommandPayload, - ActivateSkillPayload, - CancelPayload, - EmptyPayload, - PromptLaunchResult, - PromptPayload, - RunCommandPayload, - SetPermissionPayload, - SteerPayload, - UndoHistoryPayload, -} from './core-api'; -import { IAgentRPCService } from './rpc'; -import { - applyPromptMetadataUpdate, - promptMetadataTextFromPayload, - promptMetadataTextFromPluginCommand, - promptMetadataTextFromSkill, -} from './prompt-metadata'; - -export interface PluginCommandActivatedEvent { - readonly type: 'plugin_command.activated'; - readonly activationId: string; - readonly pluginId: string; - readonly commandName: string; - readonly commandArgs?: string; - readonly trigger: 'user-slash'; -} - -declare module '#/app/event/eventBus' { - interface DomainEventMap { - 'plugin_command.activated': PluginCommandActivatedEvent; - } -} - -export class AgentRPCService implements IAgentRPCService { - declare readonly _serviceBrand: undefined; - - constructor( - @IAgentPromptService private readonly promptService: IAgentPromptService, - @IAgentConversationUndoService - private readonly conversationUndo: IAgentConversationUndoService, - @IAgentLoopService private readonly loop: IAgentLoopService, - @IAgentToolPolicyService private readonly toolPolicy: IAgentToolPolicyService, - @IAgentPermissionModeService private readonly permissionMode: IAgentPermissionModeService, - @IAgentFullCompactionService private readonly fullCompaction: IAgentFullCompactionService, - @IAgentToolRegistryService private readonly toolRegistry: IAgentToolRegistryService, - @IAgentContextMemoryService private readonly context: IAgentContextMemoryService, - @IAgentTokenCountingService private readonly tokenCounting: IAgentTokenCountingService, - @IAgentSkillService private readonly skills: IAgentSkillService, - @ITelemetryService private readonly telemetry: ITelemetryService, - @IEventBus private readonly eventBus: IEventBus, - @IEventService private readonly eventService: IEventService, - @IPluginService private readonly plugins: IPluginService, - @ISessionMetadata private readonly metadata: ISessionMetadata, - @ISessionContext private readonly sessionContext: ISessionContext, - @IAgentScopeContext private readonly scopeContext: IAgentScopeContext, - @IAgentLifecycleService private readonly agentLifecycle: IAgentLifecycleService, - @IAgentCommandService private readonly commands: IAgentCommandService, - ) { } - - async prompt(payload: PromptPayload): Promise { - if (payload.disabledTools !== undefined) { - try { - await this.toolPolicy.setSessionDisabledTools(payload.disabledTools); - } catch (error) { - if (error instanceof ProfileError) { - throw new Error2(ErrorCodes.REQUEST_INVALID, error.message); - } - throw error; - } - } - await this.updatePromptMetadata(promptMetadataTextFromPayload(payload)); - const handle = await this.promptService.enqueue({ message: { - role: 'user', - content: [...payload.input], - toolCalls: [], - origin: { kind: 'user' }, - } }); - if (handle.state === 'pending') return undefined; - const turn = await handle.launched; - return turn === undefined ? undefined : { turn_id: turn.id }; - } - - async steer(payload: SteerPayload): Promise { - this.telemetry.track2('input_steer', { parts: payload.input.length }); - if (this.scopeContext.agentId === MAIN_AGENT_ID) { - // A steer is user input like a prompt — and can even launch the - // session's first turn (e.g. goal mode) — so keep title/lastPrompt in - // sync the same way, matching v1. - await this.updatePromptMetadata(promptMetadataTextFromPayload(payload)); - } - const queued = await this.promptService.enqueue({ message: { - role: 'user', - content: [...payload.input], - toolCalls: [], - } }); - if (queued.state !== 'pending') { - // No active prompt at enqueue time, so the enqueue itself already - // launched this input as its own turn (idle session, or a goal-turn - // boundary where the previous turn just ended) — v1's - // steer-degrades-to-launch end state. Return that turn instead of - // rejecting on a steer-by-id that can never find the record pending. - const turn = await queued.launched; - return turn === undefined ? undefined : { turn_id: turn.id }; - } - try { - const [steered] = await this.promptService.steer([queued.id]); - const turn = await steered?.launched; - return turn === undefined ? undefined : { turn_id: turn.id }; - } catch (error) { - // Pending but nothing active to steer into (a manual compaction holds - // the context): the message stays queued and launches once compaction - // finishes, so report it as queued rather than failing the steer. - if (isError2(error) && error.code === ErrorCodes.PROMPT_NOT_FOUND) return undefined; - throw error; - } - } - - cancel({ turnId }: CancelPayload): void { - if (this.loop.status().state === 'running') { - this.telemetry.track2('cancel', { - from: 'streaming', - trace_id: this.loop.status().activeTraceId, - }); - } - this.loop.cancel(turnId); - } - - async undoHistory(payload: UndoHistoryPayload): Promise { - return this.conversationUndo.undo(payload.count); - } - - setPermission(payload: SetPermissionPayload): void { - const wasYolo = this.permissionMode.mode === 'yolo'; - const wasAuto = this.permissionMode.mode === 'auto'; - this.permissionMode.setMode(payload.mode); - if (this.scopeContext.agentId === MAIN_AGENT_ID) { - this.agentLifecycle.broadcastPermissionMode(payload.mode); - } - const enabled = this.permissionMode.mode === 'yolo'; - if (enabled !== wasYolo) { - this.telemetry.track2('yolo_toggle', { enabled }); - } - const afkEnabled = this.permissionMode.mode === 'auto'; - if (afkEnabled !== wasAuto) { - this.telemetry.track2('afk_toggle', { enabled: afkEnabled }); - } - } - - cancelCompaction(_payload: EmptyPayload): void { - const active = this.fullCompaction.compacting; - if (active !== null) { - this.telemetry.track2('cancel', { - from: 'compacting', - trace_id: active.traceId, - }); - } - active?.abortController.abort(); - } - - async activateSkill(payload: ActivateSkillPayload): Promise { - // Awaited (not fire-and-forget): the caller gets the launched turn id and - // activation failures (unknown skill, busy) surface instead of vanishing. - const turn = await this.skills.activate(payload); - await this.updatePromptMetadata(promptMetadataTextFromSkill(payload)); - return { turn_id: turn.id }; - } - - async activatePluginCommand(payload: ActivatePluginCommandPayload): Promise { - const commands = await this.plugins.listPluginCommands(); - const def = commands.find( - (command) => command.pluginId === payload.pluginId && command.name === payload.commandName, - ); - if (def === undefined) { - throw new Error2( - ErrorCodes.REQUEST_INVALID, - `Plugin command "${payload.pluginId}:${payload.commandName}" was not found`, - ); - } - const commandArgs = payload.args ?? ''; - const expanded = expandCommandArguments(def.body, commandArgs); - const origin = { - kind: 'plugin_command' as const, - activationId: randomUUID(), - pluginId: payload.pluginId, - commandName: payload.commandName, - commandArgs: payload.args, - trigger: 'user-slash' as const, - }; - this.eventBus.publish({ - type: 'plugin_command.activated', - activationId: origin.activationId, - pluginId: origin.pluginId, - commandName: origin.commandName, - commandArgs: origin.commandArgs, - trigger: origin.trigger, - }); - await this.promptService.enqueue({ message: { - role: 'user', - content: [{ type: 'text', text: expanded }], - toolCalls: [], - origin, - } }); - await this.updatePromptMetadata(promptMetadataTextFromPluginCommand(payload)); - } - - private async updatePromptMetadata(text: string | undefined): Promise { - await applyPromptMetadataUpdate( - { - metadata: this.metadata, - eventService: this.eventService, - sessionId: this.sessionContext.sessionId, - }, - text, - ); - } - - getContext(_payload: EmptyPayload) { - return { - history: this.context.get(), - // The externally reported context size, resolved by the - // `[token_counting]` strategy inside the service — matching the v1 - // `context.tokenCount` semantics. - tokenCount: this.tokenCounting.statusSize(), - }; - } - - listCommands(_payload: EmptyPayload) { - return this.commands.list(); - } - - async runCommand(payload: RunCommandPayload): Promise { - return this.commands.run(payload.name, payload.args); - } - - getTools(_payload: EmptyPayload) { - return this.toolRegistry.list().map((tool) => ({ - name: tool.name, - description: tool.description, - active: this.toolPolicy.isToolActive(tool.name, tool.source), - source: tool.source, - })); - } -} - -registerScopedService( - LifecycleScope.Agent, - IAgentRPCService, - AgentRPCService, - ScopeActivation.OnScopeCreated, - 'rpc', -); diff --git a/packages/agent-core-v2/src/agent/rpc/types.ts b/packages/agent-core-v2/src/agent/rpc/types.ts deleted file mode 100644 index fb661f597a7..00000000000 --- a/packages/agent-core-v2/src/agent/rpc/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * `rpc` domain (L8) — shared request wrapper types. - */ - -export type WithSessionId = T & { - readonly sessionId: string; -}; - -export type WithAgentId = T & { - readonly agentId: string; -}; diff --git a/packages/agent-core-v2/src/agent/skill/prompt.ts b/packages/agent-core-v2/src/agent/skill/prompt.ts index 1cbb50362d5..4cffd8522c6 100644 --- a/packages/agent-core-v2/src/agent/skill/prompt.ts +++ b/packages/agent-core-v2/src/agent/skill/prompt.ts @@ -1,6 +1,16 @@ import { escapeXml } from '#/_base/utils/xml-escape'; +import { promptMetadataTextFromText } from '#/agent/prompt/promptMetadataText'; import type { SkillSource } from '#/app/skillCatalog/types'; +import type { SkillActivationInput } from './skill'; + +export function promptMetadataTextFromSkill(input: SkillActivationInput): string | undefined { + const args = input.args?.trim(); + return promptMetadataTextFromText( + args === undefined || args.length === 0 ? `/${input.name}` : `/${input.name} ${args}`, + ); +} + export type SkillPromptTrigger = 'user-slash' | 'model-tool' | 'nested-skill'; export interface RenderSkillPromptInput { diff --git a/packages/agent-core-v2/src/agent/skill/skill.ts b/packages/agent-core-v2/src/agent/skill/skill.ts index ed4eb3e93e9..e512195a945 100644 --- a/packages/agent-core-v2/src/agent/skill/skill.ts +++ b/packages/agent-core-v2/src/agent/skill/skill.ts @@ -10,7 +10,7 @@ import { createDecorator } from "#/_base/di/instantiation"; import type { SkillActivationOrigin } from '#/agent/contextMemory/types'; -import type { Turn } from '#/agent/loop/loop'; +import type { PromptLaunchResult } from '#/agent/prompt/prompt'; import type { ContentPart } from '#/kosong/contract/message'; export interface SkillActivationInput { @@ -22,7 +22,7 @@ export interface SkillActivationInput { export interface IAgentSkillService { readonly _serviceBrand: undefined; - activate(input: SkillActivationInput): Promise; + activate(input: SkillActivationInput): Promise; recordModelToolActivation(origin: SkillActivationOrigin): void; } diff --git a/packages/agent-core-v2/src/agent/skill/skillService.ts b/packages/agent-core-v2/src/agent/skill/skillService.ts index aed7efba28e..6148e52268c 100644 --- a/packages/agent-core-v2/src/agent/skill/skillService.ts +++ b/packages/agent-core-v2/src/agent/skill/skillService.ts @@ -6,10 +6,12 @@ * (a stateless, identity-apply Op), derives the `skill.activated` event * through the Op's `toEvent`, drives user-slash activations into a new turn via * `prompt` (attachment parts from the caller ride the same user message after - * the rendered prompt), and reports `skill_invoked` / `flow_invoked` through - * `telemetry`. `wire.replay` reapplies the fact as a no-op, so neither the - * event nor telemetry fires on resume (matching the former `restoring` guard). - * Bound at Agent scope. + * the rendered prompt), settles `{turn_id}` for the caller, persists the + * derived title/lastPrompt through `sessionMetadata` for the main agent only + * (publishing the live update through `event`), and reports `skill_invoked` / + * `flow_invoked` through `telemetry`. `wire.replay` reapplies the fact as a + * no-op, so neither the event nor telemetry fires on resume (matching the + * former `restoring` guard). Bound at Agent scope. */ import { randomUUID } from 'node:crypto'; @@ -19,18 +21,23 @@ import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import type { ContentPart } from '#/kosong/contract/message'; import type { ContextMessage, SkillActivationOrigin } from '#/agent/contextMemory/types'; -import { renderUserSlashSkillPrompt } from './prompt'; +import { promptMetadataTextFromSkill, renderUserSlashSkillPrompt } from './prompt'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { Service } from '#/_base/di/service'; import { ErrorCodes, Error2 } from '#/errors'; import { isUserActivatableSkillType, type SkillDefinition } from '#/app/skillCatalog/types'; -import { IAgentPromptService } from '#/agent/prompt/prompt'; +import { IAgentPromptService, type PromptLaunchResult } from '#/agent/prompt/prompt'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import type { Turn } from '#/agent/loop/loop'; import { IWireService } from '#/wire/wire'; import { IAgentSkillService, type SkillActivationInput } from './skill'; import { skillActivate } from './skillOps'; import { ISessionSkillCatalog } from '#/session/sessionSkillCatalog/skillCatalog'; +import { IEventService } from '#/app/event/event'; +import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; +import { MAIN_AGENT_ID } from '#/session/agentLifecycle/agentLifecycle'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; +import { applyPromptMetadataUpdate } from '#/session/sessionMetadata/promptMetadata'; export class AgentSkillService extends Service implements IAgentSkillService { declare readonly _serviceBrand: undefined; @@ -41,11 +48,14 @@ export class AgentSkillService extends Service implements IAgentSkillService { @IWireService private readonly wire: IWireService, @ITelemetryService private readonly telemetry: ITelemetryService, @ISessionContext private readonly sessionContext: ISessionContext, + @ISessionMetadata private readonly metadata: ISessionMetadata, + @IEventService private readonly eventService: IEventService, + @IAgentScopeContext private readonly scopeContext: IAgentScopeContext, ) { super(); } - async activate(input: SkillActivationInput): Promise { + async activate(input: SkillActivationInput): Promise { await this.skillCatalog.ready; const skill = this.skillCatalog.catalog.getSkill(input.name); if (skill === undefined) { @@ -93,7 +103,19 @@ export class AgentSkillService extends Service implements IAgentSkillService { 'Cannot activate skill while another turn is active', ); } - return turn; + // Awaited (not fire-and-forget): the caller gets the launched turn id and + // activation failures (unknown skill, busy) surface instead of vanishing. + if (this.scopeContext.agentId === MAIN_AGENT_ID) { + await applyPromptMetadataUpdate( + { + metadata: this.metadata, + eventService: this.eventService, + sessionId: this.sessionContext.sessionId, + }, + promptMetadataTextFromSkill(input), + ); + } + return { turn_id: turn.id }; } recordModelToolActivation(origin: SkillActivationOrigin): void { diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 3af2678addb..6eaf2a0b9cf 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -124,6 +124,7 @@ export * from '#/app/sessionIndex/sessionIndexService'; export * from '#/app/sessionIndex/sessionIndexMirrorService'; export * from '#/session/sessionMetadata/sessionMetadata'; export * from '#/session/sessionMetadata/sessionMetadataService'; +export * from '#/session/sessionMetadata/promptMetadata'; export * from '#/session/sessionActivity/sessionActivity'; export * from '#/session/sessionActivity/sessionActivityService'; export * from '#/session/sessionActivity/sessionOutcomeMirror'; @@ -618,19 +619,23 @@ import '#/agent/permissionRules/configSection'; export * from '#/agent/permissionRules/permissionRules'; export * from '#/agent/permissionRules/matchesRule'; export * from '#/agent/permissionRules/permissionRulesService'; +export * from '#/agent/pluginCommand/pluginCommand'; +export * from '#/agent/pluginCommand/pluginCommandService'; export * from '#/agent/profile/profile'; export * from '#/agent/profile/profileService'; export * from '#/agent/profile/context'; export * from '#/agent/prompt/prompt'; export * from '#/agent/prompt/promptService'; +export * from '#/agent/prompt/promptMetadataText'; export * from '#/agent/replayBuilder/types'; +// `replayBuilder/types` inlines its own `SessionSummary`; keep the barrel's +// `SessionSummary` pinned to the session-index one (explicit re-export wins +// over the ambiguous `export *` pair). +export { type SessionSummary } from '#/app/sessionIndex/sessionIndex'; export * from '#/agent/undo/undo'; export * from '#/agent/undo/undoService'; export * from '#/agent/shellCommand/shellCommand'; export * from '#/agent/shellCommand/shellCommandService'; -export * from '#/agent/rpc/rpc'; -export * from '#/agent/rpc/rpcService'; -export * from '#/agent/rpc/prompt-metadata'; export * from '#/agent/scopeContext/scopeContext'; export * from '#/agent/stepRetry/stepRetry'; export * from '#/agent/stepRetry/stepRetryService'; diff --git a/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts b/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts new file mode 100644 index 00000000000..611a495bb3a --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts @@ -0,0 +1,56 @@ +/** + * `sessionMetadata` domain — prompt-derived title / lastPrompt updates. + * + * Applies the metadata text derived from a prompt-like entry (prompt, steer, + * skill or plugin-command activation) to the session's durable metadata: + * `lastPrompt` always follows the latest text, while `title` is only derived + * for an untitled session without a custom title. Persists through + * `sessionMetadata` and publishes the live `session.meta.updated` update + * through `event`. Session-scoped by target, called from Agent-scope domains + * (main agent only). + */ + +import type { IEventService } from '#/app/event/event'; + +import { titleFromPromptMetadataText } from '#/agent/prompt/promptMetadataText'; + +import type { ISessionMetadata } from './sessionMetadata'; + +export function isUntitled(title: string | undefined): boolean { + return title === undefined || title.trim().length === 0 || title === 'New Session'; +} + +export interface PromptMetadataUpdateTarget { + readonly metadata: ISessionMetadata; + readonly eventService: IEventService; + readonly sessionId: string; +} + +export async function applyPromptMetadataUpdate( + target: PromptMetadataUpdateTarget, + text: string | undefined, +): Promise { + if (text === undefined) return; + const current = await target.metadata.read(); + const patch: { lastPrompt: string; title?: string; isCustomTitle?: boolean } = { + lastPrompt: text, + }; + if (!current.isCustomTitle && isUntitled(current.title)) { + patch.title = titleFromPromptMetadataText(text); + patch.isCustomTitle = false; + } + await target.metadata.update(patch); + target.eventService.publish({ + type: 'session.meta.updated', + payload: { + agentId: 'main', + sessionId: target.sessionId, + title: patch.title, + patch: { + title: patch.title, + isCustomTitle: patch.isCustomTitle, + lastPrompt: text, + }, + }, + }); +} diff --git a/packages/agent-core-v2/test/agent/loop/stubs.ts b/packages/agent-core-v2/test/agent/loop/stubs.ts index 7f16a87ff03..59f3b59839b 100644 --- a/packages/agent-core-v2/test/agent/loop/stubs.ts +++ b/packages/agent-core-v2/test/agent/loop/stubs.ts @@ -72,6 +72,7 @@ export function stubLoopWithHooks(options: StubLoopOptions = {}): StubLoop { async run() { return { type: 'completed', steps: 0, truncated: false }; }, status() { return { state: active !== undefined ? 'running' : 'idle', activeTurnId: active?.id, pendingTurnIds: [], hasPendingRequests: queue.hasPendingRequests() }; }, cancel(turnId, reason) { cancels.push({ turnId, reason }); if (active === undefined || (turnId !== undefined && active.id !== turnId)) return false; active.cancel(reason); return true; }, + cancelFromUser(turnId) { stub.cancel(turnId); }, tryAcquireQuiescence: () => toDisposable(() => {}), hasPendingRequests: () => queue.hasPendingRequests(), registerLoopErrorHandler: errorHandlers.register, settled: () => Promise.resolve(), diff --git a/packages/agent-core-v2/test/agent/rpc/setPermission.test.ts b/packages/agent-core-v2/test/agent/permissionMode/setModeAndBroadcast.test.ts similarity index 97% rename from packages/agent-core-v2/test/agent/rpc/setPermission.test.ts rename to packages/agent-core-v2/test/agent/permissionMode/setModeAndBroadcast.test.ts index 87088976b4e..41a5b233695 100644 --- a/packages/agent-core-v2/test/agent/rpc/setPermission.test.ts +++ b/packages/agent-core-v2/test/agent/permissionMode/setModeAndBroadcast.test.ts @@ -5,7 +5,7 @@ import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMo import { recordingTelemetry, type TelemetryRecord } from '../../app/telemetry/stubs'; import { createTestAgent, telemetryServices, type TestAgentContext } from '../../harness'; -describe('setPermission RPC', () => { +describe('setModeAndBroadcast', () => { let ctx: TestAgentContext; let records: TelemetryRecord[]; diff --git a/packages/agent-core-v2/test/agent/permissionMode/stubs.ts b/packages/agent-core-v2/test/agent/permissionMode/stubs.ts index 9de1a7e43e7..a94f764306f 100644 --- a/packages/agent-core-v2/test/agent/permissionMode/stubs.ts +++ b/packages/agent-core-v2/test/agent/permissionMode/stubs.ts @@ -23,6 +23,7 @@ export function stubPermissionModeService( return mode(); }, setMode: () => {}, + setModeAndBroadcast: () => {}, onDidChangeMode: Event.None as Event, }; } diff --git a/packages/agent-core-v2/test/agent/pluginCommand/pluginCommand.test.ts b/packages/agent-core-v2/test/agent/pluginCommand/pluginCommand.test.ts new file mode 100644 index 00000000000..216c35ce42a --- /dev/null +++ b/packages/agent-core-v2/test/agent/pluginCommand/pluginCommand.test.ts @@ -0,0 +1,120 @@ +/** + * Scenario: `IAgentPluginCommandService.activate` drives a user-slash plugin + * command into the prompt pipeline. + * + * Pins the activation flow: definition lookup (unknown commands reject with + * `request.invalid`), argument expansion, the `plugin_command.activated` + * domain event, the enqueued user message, and the main-agent prompt-metadata + * update. Run: `pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run + * test/agent/pluginCommand/pluginCommand.test.ts`. + */ + +import { afterEach, describe, expect, it } from 'vitest'; + +import { IEventBus } from '#/app/event/eventBus'; +import { IPluginService } from '#/app/plugin/plugin'; +import type { PluginCommandDef } from '#/app/plugin/types'; +import { ErrorCodes } from '#/errors'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; + +import { + IAgentPluginCommandService, + type PluginCommandActivatedEvent, +} from '#/agent/pluginCommand/pluginCommand'; + +import { appService, createTestAgent, type TestAgentContext } from '../../harness'; + +const DEPLOY_COMMAND: PluginCommandDef = { + pluginId: 'demo', + name: 'deploy', + description: 'Deploy', + body: 'Deploy body', + path: '/plugins/demo/deploy.md', +}; + +function pluginServiceStub(commands: readonly PluginCommandDef[]): IPluginService { + return { + _serviceBrand: undefined, + onDidReload: () => ({ dispose: () => {} }), + onDidMutate: () => ({ dispose: () => {} }), + listPlugins: async () => [], + installPlugin: async () => ({ id: '' }) as never, + setPluginEnabled: async () => {}, + setPluginMcpServerEnabled: async () => {}, + removePlugin: async () => {}, + reloadPlugins: async () => ({ added: [], removed: [], errors: [] }), + getPluginInfo: async () => { + throw new Error('getPluginInfo is not used by these tests'); + }, + listPluginCommands: async () => commands, + checkUpdates: async () => [], + pluginSkillRoots: async () => [], + pluginAgentRoots: async () => [], + enabledSessionStarts: async () => [], + enabledSystemPrompts: async () => [], + enabledMcpServers: async () => ({}), + enabledHooks: async () => [], + hasLoadedSnapshot: () => true, + }; +} + +describe('AgentPluginCommandService', () => { + let ctx: TestAgentContext; + + afterEach(async () => { + try { + await ctx.expectResumeMatches(); + } finally { + await ctx.dispose(); + } + }); + + function agentWithDeployCommand(): TestAgentContext { + return createTestAgent( + appService(IPluginService, pluginServiceStub([DEPLOY_COMMAND])), + ); + } + + it('publishes the activation event, enqueues the expanded body, and updates metadata', async () => { + ctx = agentWithDeployCommand(); + ctx.mockNextResponse({ type: 'text', text: 'deployed' }); + + const events: PluginCommandActivatedEvent[] = []; + const sub = ctx + .get(IEventBus) + .subscribe('plugin_command.activated', (event) => events.push(event)); + + await ctx + .get(IAgentPluginCommandService) + .activate({ pluginId: 'demo', commandName: 'deploy', args: 'prod' }); + sub.dispose(); + + expect(events).toHaveLength(1); + expect(events[0]).toMatchObject({ + type: 'plugin_command.activated', + pluginId: 'demo', + commandName: 'deploy', + commandArgs: 'prod', + trigger: 'user-slash', + }); + + await ctx.untilTurnEnd(); + const llmInput = JSON.stringify(ctx.llmInputs()); + expect(llmInput).toContain('Deploy body'); + expect(llmInput).toContain('ARGUMENTS: prod'); + + const metadata = await ctx.get(ISessionMetadata).read(); + expect(metadata.title).toBe('/demo:deploy prod'); + expect(metadata.lastPrompt).toBe('/demo:deploy prod'); + }); + + it('rejects an unknown command with request.invalid', async () => { + ctx = agentWithDeployCommand(); + + await expect( + ctx + .get(IAgentPluginCommandService) + .activate({ pluginId: 'demo', commandName: 'missing' }), + ).rejects.toMatchObject({ code: ErrorCodes.REQUEST_INVALID }); + }); +}); diff --git a/packages/agent-core-v2/test/agent/rpc/prompt-metadata.test.ts b/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts similarity index 58% rename from packages/agent-core-v2/test/agent/rpc/prompt-metadata.test.ts rename to packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts index 7e1527c443e..629d1fa58a3 100644 --- a/packages/agent-core-v2/test/agent/rpc/prompt-metadata.test.ts +++ b/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts @@ -1,6 +1,6 @@ /** - * prompt-metadata — the session title / lastPrompt text derived from a - * prompt payload. + * promptMetadataText — the session title / lastPrompt text derived from + * prompt content parts. * * Tests pin: * - media parts render as `[image]` / `[video]` / `[audio]` placeholders @@ -11,7 +11,7 @@ import { describe, expect, it } from 'vitest'; -import { promptMetadataTextFromPayload } from '#/agent/rpc/prompt-metadata'; +import { promptMetadataTextFromContentParts } from '#/agent/prompt/promptMetadataText'; import { buildImageCompressionCaption } from '#/agent/media/image-compress'; const CAPTION = buildImageCompressionCaption({ @@ -20,34 +20,28 @@ const CAPTION = buildImageCompressionCaption({ originalPath: '/tmp/originals/shot.png', }); -describe('promptMetadataTextFromPayload', () => { +describe('promptMetadataTextFromContentParts', () => { it('renders text and media placeholders', () => { - const text = promptMetadataTextFromPayload({ - input: [ - { type: 'text', text: 'look at this' }, - { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, - ], - }); + const text = promptMetadataTextFromContentParts([ + { type: 'text', text: 'look at this' }, + { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, + ]); expect(text).toBe('look at this [image]'); }); it('keeps a standalone image-compression caption out of the metadata text', () => { - const text = promptMetadataTextFromPayload({ - input: [ - { type: 'text', text: CAPTION }, - { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, - ], - }); + const text = promptMetadataTextFromContentParts([ + { type: 'text', text: CAPTION }, + { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, + ]); expect(text).toBe('[image]'); }); it('strips a caption merged into the user text and keeps the rest', () => { - const text = promptMetadataTextFromPayload({ - input: [ - { type: 'text', text: `能展示但是没有快捷键提示${CAPTION}` }, - { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, - ], - }); + const text = promptMetadataTextFromContentParts([ + { type: 'text', text: `能展示但是没有快捷键提示${CAPTION}` }, + { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, + ]); expect(text).toBe('能展示但是没有快捷键提示 [image]'); expect(text).not.toContain(''); expect(text).not.toContain('Image compressed'); diff --git a/packages/agent-core-v2/test/agent/prompt/promptService.test.ts b/packages/agent-core-v2/test/agent/prompt/promptService.test.ts index c1f82551f7a..30e17a60232 100644 --- a/packages/agent-core-v2/test/agent/prompt/promptService.test.ts +++ b/packages/agent-core-v2/test/agent/prompt/promptService.test.ts @@ -17,13 +17,18 @@ import { IAgentFullCompactionService } from '#/agent/fullCompaction/fullCompacti import { IAgentLoopService } from '#/agent/loop/loop'; import { IAgentPromptService } from '#/agent/prompt/prompt'; import { AgentPromptService } from '#/agent/prompt/promptService'; +import { IAgentScopeContext, makeAgentScopeContext } from '#/agent/scopeContext/scopeContext'; import { IAgentSystemReminderService } from '#/agent/systemReminder/systemReminder'; import { AgentSystemReminderService } from '#/agent/systemReminder/systemReminderService'; import { IAgentToolExecutorService } from '#/agent/toolExecutor/toolExecutor'; import { IEventBus } from '#/app/event/eventBus'; +import { IEventService } from '#/app/event/event'; import { EventBusService } from '#/app/event/eventBusService'; +import { ITelemetryService } from '#/app/telemetry/telemetry'; import { ErrorCodes, Error2 } from '#/errors'; import { createHooks } from '#/hooks'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; import { IWireService } from '#/wire/wire'; import { stubContextMemory } from '../contextMemory/stubs'; @@ -57,6 +62,14 @@ function harness() { reg.define(IEventBus, EventBusService); reg.define(IAgentSystemReminderService, AgentSystemReminderService); reg.define(IAgentPromptService, AgentPromptService); + reg.definePartialInstance(ITelemetryService, { track: () => {}, track2: () => {} }); + reg.definePartialInstance(ISessionMetadata, { + read: async () => ({ id: 'test-session', createdAt: 0, updatedAt: 0, archived: false }), + update: async () => {}, + }); + reg.definePartialInstance(IEventService, { publish: () => {} }); + reg.definePartialInstance(ISessionContext, { sessionId: 'test-session' }); + reg.defineInstance(IAgentScopeContext, makeAgentScopeContext({ agentId: 'main', agentScope: '' })); } }); return { prompt: ix.get(IAgentPromptService), loop, context, fullCompaction, eventBus: ix.get(IEventBus) }; diff --git a/packages/agent-core-v2/test/agent/prompt/submit.test.ts b/packages/agent-core-v2/test/agent/prompt/submit.test.ts new file mode 100644 index 00000000000..e69df7c2d40 --- /dev/null +++ b/packages/agent-core-v2/test/agent/prompt/submit.test.ts @@ -0,0 +1,82 @@ +/** + * Scenario: `IAgentPromptService.submit` is the wire-facing prompt entry — + * prompt-metadata persistence and `{turn_id}` settlement. + * + * Migrated from the kap-server debug-RPC suite (`test/rpc.test.ts`) when the + * RPC aggregation layer was removed: the composition now lives in the prompt + * domain. Run: `pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run + * test/agent/prompt/submit.test.ts`. + */ + +import { afterEach, describe, expect, it } from 'vitest'; + +import { IEventService } from '#/app/event/event'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; + +import { createTestAgent, type TestAgentContext } from '../../harness'; + +describe('prompt submit', () => { + let ctx: TestAgentContext; + + afterEach(async () => { + try { + await ctx.expectResumeMatches(); + } finally { + await ctx.dispose(); + } + }); + + it('submits a prompt and returns the turn id', async () => { + ctx = createTestAgent(); + ctx.mockNextResponse({ type: 'text', text: 'hi' }); + + const launched = await ctx.rpc.prompt({ input: [{ type: 'text', text: 'hello' }] }); + // Turn ids are 0-based; the point is the launch result came back at all. + expect(launched?.turn_id).toBe(0); + await ctx.untilTurnEnd(); + }); + + it('derives the session title and lastPrompt from the first prompt', async () => { + ctx = createTestAgent(); + ctx.mockNextResponse({ type: 'text', text: 'hi' }); + + const events: { type: string; payload?: unknown }[] = []; + const sub = ctx.get(IEventService).subscribe((event) => events.push(event)); + + const launched = await ctx.rpc.prompt({ input: [{ type: 'text', text: 'hello title' }] }); + expect(launched?.turn_id).toBe(0); + sub.dispose(); + + const metadata = await ctx.get(ISessionMetadata).read(); + expect(metadata.title).toBe('hello title'); + expect(metadata.lastPrompt).toBe('hello title'); + + const updated = events.find((event) => event.type === 'session.meta.updated'); + expect(updated).toBeDefined(); + const payload = updated?.payload as + | { title?: string; patch?: { lastPrompt?: string } } + | undefined; + expect(payload?.title).toBe('hello title'); + expect(payload?.patch?.lastPrompt).toBe('hello title'); + + await ctx.untilTurnEnd(); + }); + + it('keeps a custom title and only refreshes lastPrompt on a later prompt', async () => { + ctx = createTestAgent(); + ctx.mockNextResponse({ type: 'text', text: 'hi' }); + + await ctx.get(ISessionMetadata).setTitle('keep-me'); + + const launched = await ctx.rpc.prompt({ + input: [{ type: 'text', text: 'should not become the title' }], + }); + expect(launched?.turn_id).toBe(0); + + const metadata = await ctx.get(ISessionMetadata).read(); + expect(metadata.title).toBe('keep-me'); + expect(metadata.lastPrompt).toBe('should not become the title'); + + await ctx.untilTurnEnd(); + }); +}); diff --git a/packages/agent-core-v2/test/agent/rpc/runShellCommand.test.ts b/packages/agent-core-v2/test/agent/rpc/runShellCommand.test.ts deleted file mode 100644 index afc735e9bf1..00000000000 --- a/packages/agent-core-v2/test/agent/rpc/runShellCommand.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { afterEach, describe, expect, it } from 'vitest'; - -import { IAgentContextMemoryService } from '#/index'; - -import { - createCommandRunner, - createTestAgent, - execEnvServices, - type TestAgentContext, -} from '../../harness'; - -describe('runShellCommand RPC', () => { - let ctx: TestAgentContext; - - afterEach(async () => { - try { - await ctx.expectResumeMatches(); - } finally { - await ctx.dispose(); - } - }); - - it('delegates to the shell command service', async () => { - ctx = createTestAgent(execEnvServices({ processRunner: createCommandRunner('ok\n', 0) })); - const context = ctx.get(IAgentContextMemoryService); - - const result = await ctx.rpc.runShellCommand({ command: 'echo ok' }); - - expect(result.isError).toBe(false); - expect(context.get().map(({ role, origin }) => ({ role, origin }))).toEqual([ - { role: 'user', origin: { kind: 'shell_command', phase: 'input' } }, - { role: 'user', origin: { kind: 'shell_command', phase: 'output' } }, - ]); - }); -}); diff --git a/packages/agent-core-v2/test/agent/rpc/undoHistory.test.ts b/packages/agent-core-v2/test/agent/rpc/undoHistory.test.ts deleted file mode 100644 index 3c586f7b2b3..00000000000 --- a/packages/agent-core-v2/test/agent/rpc/undoHistory.test.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { afterEach, describe, expect, it } from 'vitest'; - -import { ErrorCodes } from '#/errors'; - -import { - createTestAgent, - telemetryServices, - type TestAgentContext, -} from '../../harness'; -import { recordingTelemetry, type TelemetryRecord } from '../../app/telemetry/stubs'; - -describe('undoHistory RPC', () => { - let ctx: TestAgentContext; - let records: TelemetryRecord[]; - - afterEach(async () => { - try { - await ctx.expectResumeMatches(); - } finally { - await ctx.dispose(); - } - }); - - it('tracks conversation_undo after undoing history', async () => { - records = []; - ctx = createTestAgent(telemetryServices(recordingTelemetry(records))); - ctx.appendUserTurn('undo me'); - - const undone = await ctx.rpc.undoHistory({ count: 1 }); - - expect(undone).toBe(1); - expect(records).toContainEqual({ - event: 'conversation_undo', - properties: { agent_id: 'main', count: 1 }, - }); - }); - - it('rejects a fractional count without changing persisted history', async () => { - records = []; - ctx = createTestAgent(telemetryServices(recordingTelemetry(records))); - ctx.appendUserTurn('keep me'); - const history = ctx.context.get(); - - await expect(ctx.rpc.undoHistory({ count: 0.5 })).rejects.toMatchObject({ - code: ErrorCodes.REQUEST_INVALID, - details: { field: 'count' }, - }); - - expect(ctx.context.get()).toBe(history); - expect(records).not.toContainEqual(expect.objectContaining({ event: 'conversation_undo' })); - }); -}); diff --git a/packages/agent-core-v2/test/agent/rpc/activateSkill.test.ts b/packages/agent-core-v2/test/agent/skill/activateSkill.test.ts similarity index 75% rename from packages/agent-core-v2/test/agent/rpc/activateSkill.test.ts rename to packages/agent-core-v2/test/agent/skill/activateSkill.test.ts index 5fabb7c22e3..179ff4da459 100644 --- a/packages/agent-core-v2/test/agent/rpc/activateSkill.test.ts +++ b/packages/agent-core-v2/test/agent/skill/activateSkill.test.ts @@ -1,12 +1,11 @@ /** - * Scenario: `AgentRPCService.activateSkill` is the wire-facing skill - * activation entry — awaited, returning the launched turn id. + * Scenario: `IAgentSkillService.activate` is the wire-facing skill activation + * entry — awaited, returning the launched turn id. * - * Unlike `IAgentSkillService.activate` (in-process, returns the live `Turn` - * handle), the RPC variant must settle only once the turn has launched and - * must surface activation failures (unknown skill, busy agent) to the caller - * instead of fire-and-forget. Run: `pnpm --filter @moonshot-ai/agent-core-v2 - * exec vitest run test/agent/rpc/activateSkill.test.ts`. + * The activation settles only once the turn has launched, and activation + * failures (unknown skill, busy agent) surface to the caller instead of + * fire-and-forget. Run: `pnpm --filter @moonshot-ai/agent-core-v2 + * exec vitest run test/agent/skill/activateSkill.test.ts`. */ import { afterEach, describe, expect, it } from 'vitest'; @@ -16,7 +15,7 @@ import { InMemorySkillCatalog } from '#/app/skillCatalog/registry'; import { stubSkill } from '../../app/skillCatalog/stubs'; import { createTestAgent, skillServices, type TestAgentContext } from '../../harness'; -describe('activateSkill RPC', () => { +describe('activateSkill', () => { let ctx: TestAgentContext; afterEach(async () => { diff --git a/packages/agent-core-v2/test/agent/skill/skill.test.ts b/packages/agent-core-v2/test/agent/skill/skill.test.ts index 76210592342..0e8efa2a5ae 100644 --- a/packages/agent-core-v2/test/agent/skill/skill.test.ts +++ b/packages/agent-core-v2/test/agent/skill/skill.test.ts @@ -11,6 +11,8 @@ import { InMemorySkillCatalog } from '#/app/skillCatalog/registry'; import { summarizeSkill } from '#/app/skillCatalog/types'; import { ISessionSkillCatalog } from '#/session/sessionSkillCatalog/skillCatalog'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; +import { IEventService } from '#/app/event/event'; import { AgentSkillService } from '#/agent/skill/skillService'; import { MAX_SKILL_QUERY_DEPTH, @@ -77,6 +79,11 @@ describe('AgentSkillService', () => { reg.definePartialInstance(IAgentToolRegistryService, { register: () => ({ dispose: () => {} }), }); + reg.definePartialInstance(ISessionMetadata, { + read: async () => ({ id: 'test-session', createdAt: 0, updatedAt: 0, archived: false }), + update: async () => {}, + }); + reg.definePartialInstance(IEventService, { publish: () => {} }); reg.defineInstance(ISessionContext, stubSessionContext()); reg.defineInstance(IAgentScopeContext, makeAgentScopeContext({ agentId: 'main', agentScope: '' })); }, @@ -171,6 +178,11 @@ describe('SkillTool', () => { reg.definePartialInstance(IAgentToolRegistryService, { register: () => ({ dispose: () => {} }), }); + reg.definePartialInstance(ISessionMetadata, { + read: async () => ({ id: 'test-session', createdAt: 0, updatedAt: 0, archived: false }), + update: async () => {}, + }); + reg.definePartialInstance(IEventService, { publish: () => {} }); reg.defineInstance(ISessionContext, stubSessionContext()); reg.defineInstance(IAgentScopeContext, makeAgentScopeContext({ agentId: 'main', agentScope: '' })); }, diff --git a/packages/agent-core-v2/test/agent/toolSelect/toolSelectService.test.ts b/packages/agent-core-v2/test/agent/toolSelect/toolSelectService.test.ts index 33f3f01e7b4..8035ecb81ac 100644 --- a/packages/agent-core-v2/test/agent/toolSelect/toolSelectService.test.ts +++ b/packages/agent-core-v2/test/agent/toolSelect/toolSelectService.test.ts @@ -219,6 +219,8 @@ class FakeLoopService implements IAgentLoopService { onDidFinishStep: new OrderedHookSlot(), }; + cancelFromUser(): void {} + enqueue(_request: StepRequest, _options?: StepEnqueueOptions): EnqueueReceipt { throw new Error('unused in this suite'); } diff --git a/packages/agent-core-v2/test/app/gateway/gateway.test.ts b/packages/agent-core-v2/test/app/gateway/gateway.test.ts index 373beb8be5c..606fb18352e 100644 --- a/packages/agent-core-v2/test/app/gateway/gateway.test.ts +++ b/packages/agent-core-v2/test/app/gateway/gateway.test.ts @@ -53,6 +53,8 @@ describe('RestGateway', () => { const promptService: IAgentPromptService = { _serviceBrand: undefined, enqueue: ({ message }: { message: ContextMessage }) => { promptCalls.push(message); return Promise.resolve({ id: 'p', launched: Promise.resolve(undefined) } as never); }, + submit: () => Promise.resolve(undefined), + submitSteer: () => Promise.resolve(undefined), steer: () => Promise.resolve([]), list: () => ({ active: undefined, pending: [] }), abort: () => true, diff --git a/packages/agent-core-v2/test/features/plan/tools/exit-plan-mode.test.ts b/packages/agent-core-v2/test/features/plan/tools/exit-plan-mode.test.ts index 5f8497795d5..b80f0a30df6 100644 --- a/packages/agent-core-v2/test/features/plan/tools/exit-plan-mode.test.ts +++ b/packages/agent-core-v2/test/features/plan/tools/exit-plan-mode.test.ts @@ -58,6 +58,7 @@ function permissionMode(mode: PermissionMode = 'auto'): IAgentPermissionModeServ _serviceBrand: undefined, mode, setMode: () => {}, + setModeAndBroadcast: () => {}, onDidChangeMode: () => ({ dispose: () => {} }), }; } diff --git a/packages/agent-core-v2/test/features/plan/tools/plan-tools-telemetry.test.ts b/packages/agent-core-v2/test/features/plan/tools/plan-tools-telemetry.test.ts index 3c7741d7cf6..1e86aa435a8 100644 --- a/packages/agent-core-v2/test/features/plan/tools/plan-tools-telemetry.test.ts +++ b/packages/agent-core-v2/test/features/plan/tools/plan-tools-telemetry.test.ts @@ -64,6 +64,7 @@ function permissionMode(): IAgentPermissionModeService { _serviceBrand: undefined, mode: 'auto', setMode: () => {}, + setModeAndBroadcast: () => {}, onDidChangeMode: () => ({ dispose: () => {} }), }; } diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index 2e4fad5c4aa..0d02bd76b16 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -40,30 +40,51 @@ import { IAgentProfileService, type AgentConfigData } from '#/agent/profile/prof import { IAgentToolPolicyService } from '#/agent/toolPolicy/toolPolicy'; import { IAgentPromptService } from '#/agent/prompt/prompt'; import type { - AgentAPI, - BeginCompactionPayload, - CancelPlanPayload, - CancelShellCommandPayload, - CreateGoalPayload, - DetachTaskPayload, - EmptyPayload, - EnterSwarmPayload, - GetTaskOutputPayload, - GetTasksPayload, - GoalSnapshot, - GoalToolResult, - RegisterToolPayload, - RunShellCommandPayload, - SetActiveToolsPayload, - SetModelPayload, - SetModelResult, - SetThinkingPayload, - ShellCommandResult, - StopTaskPayload, - UnregisterToolPayload, -} from '#/agent/rpc/core-api'; + PromptLaunchResult, + PromptPayload, + SteerPayload, +} from '#/agent/prompt/prompt'; +import type { AgentCommandInfo } from '#/agent/command/agentCommand'; +import { IAgentCommandService } from '#/agent/command/agentCommand'; +import type { AgentContextData } from '#/agent/contextMemory/types'; +import type { CreateGoalInput, GoalSnapshot, GoalToolResult } from '#/agent/goal/types'; +import { IAgentConversationUndoService } from '#/agent/undo/undo'; +import { IAgentLoopService } from '#/agent/loop/loop'; +import type { RunShellCommandInput, RunShellCommandResult } from '#/agent/shellCommand/shellCommand'; +import type { ProfileSetModelResult } from '#/agent/profile/profile'; +import type { SwarmModeTrigger } from '#/agent/swarm/swarm'; +import type { UserToolRegistration } from '#/agent/userTool/userTool'; +import type { ActivatePluginCommandPayload } from '#/agent/pluginCommand/pluginCommand'; +import { IAgentPluginCommandService } from '#/agent/pluginCommand/pluginCommand'; +import type { ToolInfo } from '#/tool/toolContract'; + +// Test-facing wire vocabulary, formerly imported from the deleted RPC +// aggregation layer; payloads with an owner-domain type are aliased above, +// the rest are local to the harness. +type EmptyPayload = {}; +type CreateGoalPayload = CreateGoalInput; +type RegisterToolPayload = UserToolRegistration; +type RunShellCommandPayload = RunShellCommandInput; +type ShellCommandResult = RunShellCommandResult; +type SetModelResult = ProfileSetModelResult; +interface BeginCompactionPayload { readonly instruction?: string } +interface CancelPayload { readonly turnId?: number } +interface CancelPlanPayload { readonly id?: string } +interface CancelShellCommandPayload { readonly commandId: string } +interface DetachTaskPayload { readonly taskId: string } +interface EnterSwarmPayload { readonly trigger: SwarmModeTrigger } +interface GetTaskOutputPayload { readonly taskId: string; readonly tail?: number } +interface GetTasksPayload { readonly activeOnly?: boolean; readonly limit?: number } +interface RunCommandPayload { readonly name: string; readonly args?: string } +interface SetActiveToolsPayload { readonly names: readonly string[] } +interface SetModelPayload { readonly model: string } +interface SetPermissionPayload { readonly mode: PermissionMode } +interface SetThinkingPayload { readonly level: string } +interface StopTaskPayload { readonly taskId: string; readonly reason?: string } +interface UndoHistoryPayload { readonly count: number } +interface UnregisterToolPayload { readonly name: string } import { type UsageStatus } from '#/agent/usage/usage'; -import { IAgentSkillService } from '#/agent/skill/skill'; +import { IAgentSkillService, type SkillActivationInput } from '#/agent/skill/skill'; import { AgentSkillService } from '#/agent/skill/skillService'; import { IAgentToolDedupeService } from '#/agent/toolDedupe/toolDedupe'; import type { @@ -92,7 +113,6 @@ import { InMemoryStorageService, AgentFullCompactionService, IAgentActivityView, - IAgentRPCService, IAppendLogStore, IFileSystemStorageService, ISessionApprovalService, @@ -307,6 +327,18 @@ type RpcPromise = Promise & { }; interface AgentRpcPassthroughAPI { + prompt: (payload: PromptPayload) => Promisable; + steer: (payload: SteerPayload) => Promisable; + cancel: (payload: CancelPayload) => void; + undoHistory: (payload: UndoHistoryPayload) => Promisable; + setPermission: (payload: SetPermissionPayload) => void; + cancelCompaction: (payload: EmptyPayload) => void; + activateSkill: (payload: SkillActivationInput) => Promisable; + activatePluginCommand: (payload: ActivatePluginCommandPayload) => Promisable; + listCommands: (payload: EmptyPayload) => readonly AgentCommandInfo[]; + runCommand: (payload: RunCommandPayload) => Promisable; + getContext: (payload: EmptyPayload) => AgentContextData; + getTools: (payload: EmptyPayload) => readonly ToolInfo[]; runShellCommand: (payload: RunShellCommandPayload) => Promisable; cancelShellCommand: (payload: CancelShellCommandPayload) => void; setThinking: (payload: SetThinkingPayload) => void; @@ -339,7 +371,7 @@ interface AgentRpcPassthroughAPI { getTasks: (payload: GetTasksPayload) => readonly AgentTaskInfo[]; } -type PromiseAgentAPI = PromisifyMethods; +type PromiseAgentAPI = PromisifyMethods; type GenerateFn = typeof kosongGenerate; type TestToolResult = ExecutableToolResult & { @@ -1270,8 +1302,7 @@ export class AgentTestContext { }), ); - const rpcMethods = this.get(IAgentRPCService); - this.rpc = this.createPromiseAgentApi(rpcMethods); + this.rpc = this.createPromiseAgentApi(); if (options.autoConfigure !== false) { this.configure(); @@ -1472,8 +1503,7 @@ export class AgentTestContext { } async undoHistory(count: number): Promise { - const rpcMethods = this.get(IAgentRPCService); - return rpcMethods.undoHistory({ count }); + return this.get(IAgentConversationUndoService).undo(count); } newEvents(): EventSnapshot { @@ -1974,16 +2004,15 @@ export class AgentTestContext { this.recordWire(cloned); } - private createPromiseAgentApi(agent: IAgentRPCService): PromiseAgentAPI { - const passthrough = this.createRpcPassthroughAdapters(); - return new Proxy(agent, { + private createPromiseAgentApi(): PromiseAgentAPI { + const adapters = this.createRpcPassthroughAdapters(); + return new Proxy(adapters, { get(proxyTarget, property, receiver) { - const override = Reflect.get(passthrough, property) as unknown; - const value = override ?? Reflect.get(proxyTarget, property, receiver); + const value = Reflect.get(proxyTarget, property, receiver) as unknown; if (typeof value !== 'function') return value; return (payload: unknown) => { try { - return Promise.resolve(value.call(proxyTarget, payload)); + return Promise.resolve(value(payload)); } catch (error) { return Promise.reject(error); } @@ -1994,6 +2023,23 @@ export class AgentTestContext { private createRpcPassthroughAdapters(): AgentRpcPassthroughAPI { return { + prompt: (payload) => this.get(IAgentPromptService).submit(payload), + steer: (payload) => this.get(IAgentPromptService).submitSteer(payload), + cancel: (payload) => this.get(IAgentLoopService).cancelFromUser(payload.turnId), + undoHistory: (payload) => this.get(IAgentConversationUndoService).undo(payload.count), + setPermission: (payload) => + this.get(IAgentPermissionModeService).setModeAndBroadcast(payload.mode), + cancelCompaction: () => this.get(IAgentFullCompactionService).cancel(), + activateSkill: (payload) => this.get(IAgentSkillService).activate(payload), + activatePluginCommand: (payload) => + this.get(IAgentPluginCommandService).activate(payload), + listCommands: () => this.get(IAgentCommandService).list(), + runCommand: (payload) => this.get(IAgentCommandService).run(payload.name, payload.args), + getContext: () => ({ + history: this.get(IAgentContextMemoryService).get(), + tokenCount: this.get(IAgentTokenCountingService).statusSize(), + }), + getTools: () => this.toolsData(), runShellCommand: (payload) => this.get(IAgentShellCommandService).run(payload), cancelShellCommand: (payload) => this.get(IAgentShellCommandService).cancel(payload.commandId), @@ -2125,7 +2171,7 @@ function createWorkspaceContextStub( function createPermissionModeService(initialMode: PermissionMode): IAgentPermissionModeService { let mode = initialMode; - return { + const service: IAgentPermissionModeService = { _serviceBrand: undefined, get mode() { return mode; @@ -2133,8 +2179,12 @@ function createPermissionModeService(initialMode: PermissionMode): IAgentPermiss setMode: (nextMode) => { mode = nextMode; }, + setModeAndBroadcast: (nextMode) => { + service.setMode(nextMode); + }, onDidChangeMode: Event.None as IAgentPermissionModeService['onDidChangeMode'], }; + return service; } function createPermissionRulesStub( diff --git a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts b/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts index 1a28612dac2..539d47f84b7 100644 --- a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts +++ b/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts @@ -1429,6 +1429,7 @@ function agentHandle( _serviceBrand: undefined, mode: 'auto', setMode: () => {}, + setModeAndBroadcast: () => {}, onDidChangeMode: Event.None, } as IAgentPermissionModeService; return { diff --git a/packages/kap-server/src/protocol/events-zod.ts b/packages/kap-server/src/protocol/events-zod.ts index a99558cfb7e..5080dff69bd 100644 --- a/packages/kap-server/src/protocol/events-zod.ts +++ b/packages/kap-server/src/protocol/events-zod.ts @@ -62,7 +62,7 @@ import type { import type { McpOAuthAuthorizationUrlUpdateData } from '@moonshot-ai/agent-core-v2/agent/mcp/tools/auth'; import type { PermissionMode } from '@moonshot-ai/agent-core-v2/agent/permissionPolicy/types'; import type { WarningEvent } from '@moonshot-ai/agent-core-v2/agent/profile/profileService'; -import type { PluginCommandActivatedEvent } from '@moonshot-ai/agent-core-v2/agent/rpc/rpcService'; +import type { PluginCommandActivatedEvent } from '@moonshot-ai/agent-core-v2/agent/pluginCommand/pluginCommand'; import type { ShellCompletedEvent, ShellOutputEvent, diff --git a/packages/kap-server/src/routes/sessions.ts b/packages/kap-server/src/routes/sessions.ts index 5fc4235e2cd..1e30158e677 100644 --- a/packages/kap-server/src/routes/sessions.ts +++ b/packages/kap-server/src/routes/sessions.ts @@ -21,7 +21,7 @@ * the native v2 services directly (the workspace handler's * `ISessionLifecycleService.fork` / `archive` / `restore`, reached through the * `sessionIndex` → `IWorkspaceLifecycleService.handlerFor` composition, - * `IAgentFullCompactionService.begin`, `IAgentRPCService.cancel`); there is no + * `IAgentFullCompactionService.begin`, `IAgentLoopService.cancelFromUser`); there is no * v1-only projection to centralize, so no adapter is involved. `undo` likewise * calls `IAgentConversationUndoService.undo` directly (it throws * `session.undo_unavailable` with a structured reason) and only borrows @@ -81,7 +81,7 @@ import { IAgentProfileService, IAgentConversationUndoService, IAgentFullCompactionService, - IAgentRPCService, + IAgentLoopService, IAuthSummaryService, ISessionActivityView, ISessionBtwService, @@ -773,7 +773,7 @@ export function registerSessionsRoutes(app: SessionRouteHost, core: Scope): void const agent = await resolveMainAgent(core, parsed.id); // No turnId → cancel whatever turn is active; a safe no-op when idle. // v1 always reports success once the session exists. - await agent.accessor.get(IAgentRPCService).cancel({}); + agent.accessor.get(IAgentLoopService).cancelFromUser(); requestLog(req)?.info({ session_id: parsed.id, action: 'abort' }, 'session action completed'); reply.send(okEnvelope({ aborted: true }, req.id)); return; diff --git a/packages/kap-server/src/routes/skills.ts b/packages/kap-server/src/routes/skills.ts index f2f56de965e..987125ccde4 100644 --- a/packages/kap-server/src/routes/skills.ts +++ b/packages/kap-server/src/routes/skills.ts @@ -40,12 +40,12 @@ * for the root, then composes the skill scan at the edge (see above). * - activate → `IAgentSkillService` (Agent scope, on the `main` agent) — * renders the skill prompt and starts a turn with a - * `skill_activation` origin. The returned `Turn` handle is + * `skill_activation` origin. The returned `{turn_id}` is * discarded; clients follow progress via the `skill.activated` * + `turn.*` events emitted by the service on the WS stream. - * The edge then applies the prompt-metadata update - * (`applyPromptMetadataUpdate`) so a first `/` - * message titles the session, matching the native RPC path. + * The engine applies the prompt-metadata update itself + * (main agent only) so a first `/` + * message titles the session, matching the native prompt path. * Optional `attachments` (image/video/file parts, same wire * shape as prompt content) run through the shared prompt * media pipeline (`lib/promptMedia.ts`) and are appended to @@ -84,12 +84,10 @@ import { IAgentSkillService, IBootstrapService, IConfigService, - IEventService, IFileService, IPluginService, ISessionContext, ISessionIndex, - ISessionMetadata, ISessionSkillCatalog, ISkillDiscovery, ITelemetryService, @@ -100,10 +98,8 @@ import { resumeSessionById, MERGE_ALL_AVAILABLE_SKILLS_SECTION, SKILL_SOURCE_PRIORITY, - applyPromptMetadataUpdate, configuredRoots, projectRoots, - promptMetadataTextFromSkill, sessionMediaOriginalsDir, userRoots, type ContentPart, @@ -347,19 +343,12 @@ export function registerSkillsRoutes(app: SkillsRouteHost, core: Scope): void { attachmentParts.push(...contentToCoreParts(resolvedContent)); } const agent = await ensureMainAgent(resolved.handle); + // The engine applies the prompt-metadata update itself (main agent + // only), so a first `/` message titles the session (same as + // routes/prompts.ts). await agent.accessor .get(IAgentSkillService) .activate({ name: parsed.id, args: req.body.args, content: attachmentParts }); - // Keep the easy-title behavior of the native RPC / TUI path: a first - // `/` message titles the session (same as routes/prompts.ts). - await applyPromptMetadataUpdate( - { - metadata: resolved.handle.accessor.get(ISessionMetadata), - eventService: core.accessor.get(IEventService), - sessionId: session_id, - }, - promptMetadataTextFromSkill({ name: parsed.id, args: req.body.args }), - ); requestLog(req)?.info({ session_id, skill_name: parsed.id }, 'skill activated'); reply.send(okEnvelope({ activated: true, skill_name: parsed.id }, req.id)); } catch (err) { diff --git a/packages/kap-server/src/services/transcript/coreEventMap.ts b/packages/kap-server/src/services/transcript/coreEventMap.ts index a54b21b1581..9da48be8945 100644 --- a/packages/kap-server/src/services/transcript/coreEventMap.ts +++ b/packages/kap-server/src/services/transcript/coreEventMap.ts @@ -60,7 +60,7 @@ * `agent/task/taskOps.ts`, `agent/shellCommand/shellCommandService.ts`, * `session/agentLifecycle/mirrorAgentRun.ts`, `session/swarm/sessionSwarmService.ts`, * `agent/goal/goalOps.ts`, `agent/usage/usageOps.ts`, `agent/skill/skillOps.ts`, - * `agent/rpc/rpcService.ts`, `session/cron/cronOps.ts`, + * `agent/pluginCommand/pluginCommandService.ts`, `session/cron/cronOps.ts`, * `agent/fullCompaction/compactionOps.ts`, `agent/mcp/mcpService.ts`, * `agent/profile/profileService.ts`, `agent/contextMemory/contextMemoryService.ts`). */ diff --git a/packages/kap-server/test/rpc.test.ts b/packages/kap-server/test/rpc.test.ts index b0bbb7ab937..ce4b0398367 100644 --- a/packages/kap-server/test/rpc.test.ts +++ b/packages/kap-server/test/rpc.test.ts @@ -6,11 +6,11 @@ import { IAgentActivityView, IAgentGoalService, IAgentLifecycleService, - IAgentRPCService, + IAgentPluginCommandService, + IAgentPromptService, IAgentShellCommandService, IAppendLogStore, IDebugEventsService, - IEventService, IInstantiationService, IPluginService, ISessionIndex, @@ -169,7 +169,7 @@ describe('server-v2 /api/v1/debug RPC', () => { const byName = new Map(body.data.map((c) => [c.name, c])); expect(byName.get('sessionIndex')?.scope).toBe('app'); expect(byName.get('sessionMetadata')?.scope).toBe('session'); - expect(byName.get('agentRPCService')?.scope).toBe('agent'); + expect(byName.get('agentPromptService')?.scope).toBe('agent'); const meta = byName.get('sessionMetadata'); expect(meta?.methods.map((m) => m.name)).toEqual( @@ -339,92 +339,6 @@ describe('server-v2 /api/v1/debug RPC', () => { // --- Agent scope ---------------------------------------------------------- - it('submits a prompt and returns the turn id', async () => { - const id = await createSession(home as string); - await createMainAgent(id); - - const { body } = await call<{ turn_id: number }>( - 'POST', - rpc('agent', IAgentRPCService, 'prompt', { sid: id, aid: 'main' }), - { input: [{ type: 'text', text: 'hello' }] }, - ); - expect(body.code).toBe(0); - expect(body.data.turn_id).toBe(0); - }); - - it('rejects disabledTools before bind without mutating prompt metadata', async () => { - const id = await createSession(home as string); - await createMainAgent(id); - - const { body } = await call( - 'POST', - rpc('agent', IAgentRPCService, 'prompt', { sid: id, aid: 'main' }), - { - input: [{ type: 'text', text: 'must not become metadata' }], - disabledTools: ['Bash'], - }, - ); - expect(body.code).toBe(40001); - - const metadata = await call( - 'POST', - rpc('session', ISessionMetadata, 'read', { sid: id }), - ); - expect(metadata.body.data.title).toBeUndefined(); - expect(metadata.body.data.lastPrompt).toBeUndefined(); - }); - - it('derives the session title and lastPrompt from the first prompt', async () => { - const id = await createSession(home as string); - await createMainAgent(id); - - const events: { type: string; payload: unknown }[] = []; - const sub = (server as RunningServer).core.accessor - .get(IEventService) - .subscribe((event) => events.push(event)); - - const { body } = await call<{ turn_id: number }>( - 'POST', - rpc('agent', IAgentRPCService, 'prompt', { sid: id, aid: 'main' }), - { input: [{ type: 'text', text: 'hello title' }] }, - ); - expect(body.code).toBe(0); - sub.dispose(); - - const meta = await call('POST', rpc('session', ISessionMetadata, 'read', { sid: id })); - expect(meta.body.code).toBe(0); - expect(meta.body.data.title).toBe('hello title'); - expect(meta.body.data.lastPrompt).toBe('hello title'); - - const updated = events.find((e) => e.type === 'session.meta.updated'); - expect(updated).toBeDefined(); - const payload = updated?.payload as - | { title?: string; patch?: { lastPrompt?: string } } - | undefined; - expect(payload?.title).toBe('hello title'); - expect(payload?.patch?.lastPrompt).toBe('hello title'); - }); - - it('keeps a custom title and only refreshes lastPrompt on a later prompt', async () => { - const id = await createSession(home as string); - await createMainAgent(id); - - const renamed = await call('POST', rpc('session', ISessionMetadata, 'setTitle', { sid: id }), 'keep-me'); - expect(renamed.body.code).toBe(0); - - const { body } = await call<{ turn_id: number }>( - 'POST', - rpc('agent', IAgentRPCService, 'prompt', { sid: id, aid: 'main' }), - { input: [{ type: 'text', text: 'should not become the title' }] }, - ); - expect(body.code).toBe(0); - - const meta = await call('POST', rpc('session', ISessionMetadata, 'read', { sid: id })); - expect(meta.body.code).toBe(0); - expect(meta.body.data.title).toBe('keep-me'); - expect(meta.body.data.lastPrompt).toBe('should not become the title'); - }); - it('runs a shell command through the shell command service', async () => { const id = await createSession(home as string); await createMainAgent(id); @@ -562,7 +476,7 @@ describe('server-v2 /api/v1/debug RPC', () => { await createMainAgent(sessionId); const activated = await call( 'POST', - rpc('agent', IAgentRPCService, 'activatePluginCommand', { sid: sessionId, aid: 'main' }), + rpc('agent', IAgentPluginCommandService, 'activate', { sid: sessionId, aid: 'main' }), { pluginId: 'rpc-plugin', commandName: 'deploy', args: 'prod' }, ); expect(activated.body.code).toBe(0); @@ -575,7 +489,7 @@ describe('server-v2 /api/v1/debug RPC', () => { const id = await createSession(home as string); const { body } = await call( 'POST', - rpc('agent', IAgentRPCService, 'prompt', { sid: id, aid: 'does-not-exist' }), + rpc('agent', IAgentPromptService, 'submit', { sid: id, aid: 'does-not-exist' }), { input: [{ type: 'text', text: 'hello' }] }, ); expect(body.code).toBe(40401); diff --git a/packages/klient/src/contract/agent/rpc.ts b/packages/klient/src/contract/agent/schemas.ts similarity index 71% rename from packages/klient/src/contract/agent/rpc.ts rename to packages/klient/src/contract/agent/schemas.ts index 1186c694a44..cf1fc2be025 100644 --- a/packages/klient/src/contract/agent/rpc.ts +++ b/packages/klient/src/contract/agent/schemas.ts @@ -1,20 +1,14 @@ /** - * `agentRPCService` — the per-agent RPC surface. Mirrors the `AgentAPI` - * subset of `agent-core-v2/agent/rpc/core-api.ts`; every method takes one - * payload object. Only the methods still implemented by the engine's RPC - * facade live here — the domain services the facade calls directly - * (shellCommand / profile / usage / plan / task) have their own contracts in - * `agent/services.ts`, reusing the payload/result schemas below. - * `PromptPayload.input` mirrors the `PromptPart` subset of `ContentPart` - * (text / image_url / video_url) from `agent-core-v2/kosong/contract/message.ts`. - * Task wire shapes mirror the `TaskInfo` union in `protocol/src/events.ts`. + * Shared agent-scope wire schemas — the payload/result vocabulary reused by + * the per-domain contracts in `agent/services.ts` and pinned against the + * engine types by `test/contract-parity.ts`. `PromptPayload.input` mirrors the + * `PromptPart` subset of `ContentPart` (text / image_url / video_url) from + * `agent-core-v2/kosong/contract/message.ts`. Task wire shapes mirror the + * `TaskInfo` union in `protocol/src/events.ts`. */ import { z } from 'zod'; -import { maybe, noResult } from '../helpers.js'; -import type { ServiceContract } from '../types.js'; - // ── prompt parts ──────────────────────────────────────────────────────────── const textPartSchema = z.object({ @@ -45,9 +39,6 @@ export const emptyPayloadSchema = z.object({}); export const promptPayloadSchema = z.object({ input: z.array(promptPartSchema), - // Mirrors `PromptPayload.disabledTools` in the engine (client-managed - // session denylist, full-replace). - disabledTools: z.array(z.string()).optional(), }); /** Same shape as `SteerPayload` in the engine. */ @@ -55,7 +46,7 @@ export const steerPayloadSchema = z.object({ input: z.array(promptPartSchema), }); -/** Same shape as `ActivateSkillPayload` in the engine. */ +/** Same shape as `SkillActivationInput`'s wire subset in the engine. */ export const activateSkillPayloadSchema = z.object({ name: z.string(), args: z.string().optional(), @@ -129,7 +120,7 @@ export const agentCommandInfoSchema = z.object({ source: z.string(), }); -/** Same shape as `RunCommandPayload` in the engine. */ +/** The facade's `runCommand` input shape. */ export const runCommandPayloadSchema = z.object({ name: z.string(), args: z.string().optional(), @@ -209,22 +200,3 @@ export const getTaskOutputPayloadSchema = z.object({ taskId: z.string(), tail: z.number().optional(), }); - -// ── contract ──────────────────────────────────────────────────────────────── - -export const agentRpcContract = { - prompt: { input: z.tuple([promptPayloadSchema]), output: maybe(promptLaunchResultSchema) }, - steer: { input: z.tuple([steerPayloadSchema]), output: maybe(promptLaunchResultSchema) }, - activateSkill: { - input: z.tuple([activateSkillPayloadSchema]), - output: maybe(promptLaunchResultSchema), - }, - cancel: { input: z.tuple([cancelPayloadSchema]), output: noResult }, - setPermission: { input: z.tuple([setPermissionPayloadSchema]), output: noResult }, - getContext: { input: z.tuple([emptyPayloadSchema]), output: agentContextDataSchema }, - listCommands: { - input: z.tuple([emptyPayloadSchema]), - output: z.array(agentCommandInfoSchema), - }, - runCommand: { input: z.tuple([runCommandPayloadSchema]), output: noResult }, -} satisfies ServiceContract; diff --git a/packages/klient/src/contract/agent/services.ts b/packages/klient/src/contract/agent/services.ts index f7e6526c74d..26483306ed1 100644 --- a/packages/klient/src/contract/agent/services.ts +++ b/packages/klient/src/contract/agent/services.ts @@ -1,8 +1,9 @@ /** - * Agent-scope domain service contracts. These mirror the positional-arg - * signatures of the engine's domain Services (shellCommand / profile / usage / - * plan / task) that the agent facade calls directly; payload and result - * schemas are shared with `agent/rpc.ts` (they mirror the same wire shapes). + * Agent-scope domain service contracts. These mirror the signatures of the + * engine's domain Services (prompt / skill / loop / permissionMode / command / + * contextMemory / tokenCounting / shellCommand / profile / usage / plan / + * task) that the agent facade calls directly; payload and result schemas are + * shared in `agent/schemas.ts` (they mirror the same wire shapes). */ import { z } from 'zod'; @@ -10,13 +11,56 @@ import { z } from 'zod'; import { maybe, noResult } from '../helpers.js'; import type { ServiceContract } from '../types.js'; import { + activateSkillPayloadSchema, + agentCommandInfoSchema, agentTaskInfoSchema, + permissionModeSchema, planDataSchema, + promptLaunchResultSchema, + promptPayloadSchema, runShellCommandPayloadSchema, setModelResultSchema, shellCommandResultSchema, + steerPayloadSchema, usageStatusSchema, -} from './rpc.js'; +} from './schemas.js'; + +export const agentPromptContract = { + submit: { + input: z.tuple([promptPayloadSchema]), + output: maybe(promptLaunchResultSchema), + }, + submitSteer: { + input: z.tuple([steerPayloadSchema]), + output: maybe(promptLaunchResultSchema), + }, +} satisfies ServiceContract; + +export const agentSkillContract = { + activate: { input: z.tuple([activateSkillPayloadSchema]), output: promptLaunchResultSchema }, +} satisfies ServiceContract; + +export const agentLoopContract = { + cancelFromUser: { input: z.tuple([z.number().optional()]), output: noResult }, +} satisfies ServiceContract; + +export const agentPermissionModeContract = { + setModeAndBroadcast: { input: z.tuple([permissionModeSchema]), output: noResult }, +} satisfies ServiceContract; + +export const agentCommandContract = { + list: { input: z.tuple([]), output: z.array(agentCommandInfoSchema) }, + run: { input: z.tuple([z.string(), z.string().optional()]), output: noResult }, +} satisfies ServiceContract; + +/** `history` items are full `ContextMessage`s, mirrored as `unknown`. */ +export const agentContextMemoryContract = { + get: { input: z.tuple([]), output: z.array(z.unknown()) }, +} satisfies ServiceContract; + +export const agentTokenCountingContract = { + statusSize: { input: z.tuple([]), output: z.number() }, +} satisfies ServiceContract; export const agentShellCommandContract = { run: { diff --git a/packages/klient/src/contract/global/events.ts b/packages/klient/src/contract/global/events.ts index 599a9e96fd2..126d281ef87 100644 --- a/packages/klient/src/contract/global/events.ts +++ b/packages/klient/src/contract/global/events.ts @@ -22,7 +22,7 @@ export interface SessionArchivedPayload { readonly sessionId: string; } -/** Payload of `session.meta.updated` on the global bus (`agent/rpc/prompt-metadata.ts`). */ +/** Payload of `session.meta.updated` on the global bus (`session/sessionMetadata/promptMetadata.ts`). */ export interface SessionMetaUpdatedPayload { readonly agentId: string; readonly sessionId: string; diff --git a/packages/klient/src/contract/index.ts b/packages/klient/src/contract/index.ts index 6f9ef48efad..510f761c4ae 100644 --- a/packages/klient/src/contract/index.ts +++ b/packages/klient/src/contract/index.ts @@ -8,14 +8,20 @@ import type { KlientContract } from './types.js'; import { agentActivityViewContract } from './agent/activity.js'; -import { agentRpcContract } from './agent/rpc.js'; import { + agentCommandContract, + agentContextMemoryContract, agentFullCompactionContract, + agentLoopContract, agentMcpContract, + agentPermissionModeContract, agentPlanContract, agentProfileContract, + agentPromptContract, agentShellCommandContract, + agentSkillContract, agentTaskContract, + agentTokenCountingContract, agentUsageContract, } from './agent/services.js'; import { authContract, authSummaryContract } from './global/auth.js'; @@ -67,7 +73,13 @@ export const globalContract: KlientContract = { sessionQuestionService: sessionQuestionContract, sessionSkillCatalog: sessionSkillCatalogContract, // agent scope - agentRPCService: agentRpcContract, + agentPromptService: agentPromptContract, + agentSkillService: agentSkillContract, + agentLoopService: agentLoopContract, + agentPermissionModeService: agentPermissionModeContract, + agentCommandService: agentCommandContract, + agentContextMemoryService: agentContextMemoryContract, + agentTokenCountingService: agentTokenCountingContract, agentActivityView: agentActivityViewContract, agentShellCommandService: agentShellCommandContract, agentProfileService: agentProfileContract, diff --git a/packages/klient/src/core/facade/agent.ts b/packages/klient/src/core/facade/agent.ts index 145e5fbaf9f..44429353080 100644 --- a/packages/klient/src/core/facade/agent.ts +++ b/packages/klient/src/core/facade/agent.ts @@ -1,15 +1,18 @@ /** * The agent facade — one `session.agent(id)` handle over the agent-scope - * services the wire exposes. Turn-driving calls (prompt / steer / cancel) go - * through the `agentRPCService` channel; shell commands, model, usage, plan, - * and task calls go straight to their domain services. Prompt streaming is + * services the wire exposes. Turn-driving calls (prompt / steer / cancel), + * skill activation, permission mode, and commands go straight to their domain + * services, as do shell commands, model, usage, plan, and task calls; + * `getContext` merges two reads client-side. Prompt streaming is * NOT on this interface: it flows through the agent's `events` hub * (`turn.*`, `assistant.delta`, `tool.call.*`, `prompt.completed`, …). */ -import type { IAgentRPCService } from '@moonshot-ai/agent-core-v2/agent/rpc/rpc'; import type { IAgentCommandService } from '@moonshot-ai/agent-core-v2/agent/command/agentCommand'; +import type { IAgentContextMemoryService } from '@moonshot-ai/agent-core-v2/agent/contextMemory/contextMemory'; import type { IAgentMcpService } from '@moonshot-ai/agent-core-v2/agent/mcp/mcp'; +import type { IAgentPromptService } from '@moonshot-ai/agent-core-v2/agent/prompt/prompt'; +import type { IAgentTokenCountingService } from '@moonshot-ai/agent-core-v2/agent/tokenCounting/tokenCounting'; import type { IAgentPlanService } from '@moonshot-ai/agent-core-v2/features/plan/plan'; import type { IAgentProfileService } from '@moonshot-ai/agent-core-v2/agent/profile/profile'; import type { IAgentShellCommandService } from '@moonshot-ai/agent-core-v2/agent/shellCommand/shellCommand'; @@ -23,22 +26,22 @@ import type { ScopedCaller } from './session.js'; // Wire-type aliases derived through the engine service interfaces (keeps // klient free of protocol-package imports). -export type PromptLaunchResult = Awaited>; +export type PromptLaunchResult = Awaited>; export type ShellCommandResult = Awaited>; export type SetModelResult = Awaited>; export type ThinkingLevel = ReturnType; export type UsageStatus = Awaited>; -export type AgentContextData = Awaited>; +export type AgentContextData = { + history: ReturnType; + tokenCount: ReturnType; +}; export type AgentCommandInfo = Awaited>[number]; export type PlanData = Awaited>; export type AgentTaskInfo = Awaited>[number]; export type McpServerEntry = ReturnType[number]; export interface AgentFacade { - prompt(input: { - input: readonly ContentPart[]; - disabledTools?: readonly string[]; - }): Promise; + prompt(input: { input: readonly ContentPart[] }): Promise; steer(input: { input: readonly ContentPart[] }): Promise; /** * Activate a skill as a user-slash activation: the engine renders the skill @@ -81,14 +84,17 @@ export interface AgentFacade { } export function createAgentFacade(call: ScopedCaller, scope: ScopeRef): AgentFacade { - const rpc = (method: string, payload: unknown): Promise => - call(scope, 'agentRPCService', method, [payload]); - return { - prompt: (input) => rpc('prompt', input) as Promise, - steer: (input) => rpc('steer', input) as Promise, - activateSkill: (input) => rpc('activateSkill', input) as Promise, - cancel: (input) => rpc('cancel', input ?? {}) as Promise, + prompt: (input) => + call(scope, 'agentPromptService', 'submit', [input]) as Promise, + steer: (input) => + call(scope, 'agentPromptService', 'submitSteer', [input]) as Promise, + activateSkill: (input) => + call(scope, 'agentSkillService', 'activate', [input]) as Promise, + cancel: (input) => + // No turnId sends an empty arg list: `[undefined]` would cross the wire + // as `[null]`, and `cancelFromUser(null)` would not match the active turn. + call(scope, 'agentLoopService', 'cancelFromUser', input?.turnId === undefined ? [] : [input.turnId]) as Promise, runShellCommand: (input) => call(scope, 'agentShellCommandService', 'run', [input]) as Promise, cancelShellCommand: (input) => @@ -100,11 +106,27 @@ export function createAgentFacade(call: ScopedCaller, scope: ScopeRef): AgentFac call(scope, 'agentProfileService', 'getEffectiveThinkingLevel', []) as Promise, setThinking: (level) => call(scope, 'agentProfileService', 'setThinking', [level]) as Promise, - setPermission: (mode) => rpc('setPermission', { mode }) as Promise, + setPermission: (mode) => + call(scope, 'agentPermissionModeService', 'setModeAndBroadcast', [mode]) as Promise, getUsage: () => call(scope, 'agentUsageService', 'status', []) as Promise, - getContext: () => rpc('getContext', {}) as Promise, - listCommands: () => rpc('listCommands', {}) as Promise, - runCommand: (input) => rpc('runCommand', input) as Promise, + getContext: async () => { + const [history, tokenCount] = await Promise.all([ + call(scope, 'agentContextMemoryService', 'get', []), + call(scope, 'agentTokenCountingService', 'statusSize', []), + ]); + return { history, tokenCount } as AgentContextData; + }, + listCommands: () => + call(scope, 'agentCommandService', 'list', []) as Promise, + runCommand: (input) => + // Same `[undefined]` → `[null]` wire hazard as `cancel`: the engine's + // `args = ''` default only applies to a missing arg. + call( + scope, + 'agentCommandService', + 'run', + input.args === undefined ? [input.name] : [input.name, input.args], + ) as Promise, getPlan: () => call(scope, 'agentPlanService', 'status', []) as Promise, enterPlan: () => call(scope, 'agentPlanService', 'enter', []) as Promise, clearPlan: () => call(scope, 'agentPlanService', 'clear', []) as Promise, diff --git a/packages/klient/src/transports/memory/serviceRegistry.ts b/packages/klient/src/transports/memory/serviceRegistry.ts index 00f31551e27..adf87dad7b0 100644 --- a/packages/klient/src/transports/memory/serviceRegistry.ts +++ b/packages/klient/src/transports/memory/serviceRegistry.ts @@ -30,7 +30,13 @@ import { ISessionInteractionService } from '@moonshot-ai/agent-core-v2/session/i import { ISessionApprovalService } from '@moonshot-ai/agent-core-v2/session/approval/approval'; import { ISessionQuestionService } from '@moonshot-ai/agent-core-v2/session/question/question'; import { ISessionSkillCatalog } from '@moonshot-ai/agent-core-v2/session/sessionSkillCatalog/skillCatalog'; -import { IAgentRPCService } from '@moonshot-ai/agent-core-v2/agent/rpc/rpc'; +import { IAgentPromptService } from '@moonshot-ai/agent-core-v2/agent/prompt/prompt'; +import { IAgentSkillService } from '@moonshot-ai/agent-core-v2/agent/skill/skill'; +import { IAgentLoopService } from '@moonshot-ai/agent-core-v2/agent/loop/loop'; +import { IAgentPermissionModeService } from '@moonshot-ai/agent-core-v2/agent/permissionMode/permissionMode'; +import { IAgentCommandService } from '@moonshot-ai/agent-core-v2/agent/command/agentCommand'; +import { IAgentContextMemoryService } from '@moonshot-ai/agent-core-v2/agent/contextMemory/contextMemory'; +import { IAgentTokenCountingService } from '@moonshot-ai/agent-core-v2/agent/tokenCounting/tokenCounting'; import { IAgentActivityView } from '@moonshot-ai/agent-core-v2/agent/activityView/activityView'; import { IAgentPlanService } from '@moonshot-ai/agent-core-v2/features/plan/plan'; import { IAgentProfileService } from '@moonshot-ai/agent-core-v2/agent/profile/profile'; @@ -63,7 +69,13 @@ export const serviceTokens: Readonly>> sessionApprovalService: ISessionApprovalService, sessionQuestionService: ISessionQuestionService, sessionSkillCatalog: ISessionSkillCatalog, - agentRPCService: IAgentRPCService, + agentPromptService: IAgentPromptService, + agentSkillService: IAgentSkillService, + agentLoopService: IAgentLoopService, + agentPermissionModeService: IAgentPermissionModeService, + agentCommandService: IAgentCommandService, + agentContextMemoryService: IAgentContextMemoryService, + agentTokenCountingService: IAgentTokenCountingService, agentActivityView: IAgentActivityView, agentShellCommandService: IAgentShellCommandService, agentProfileService: IAgentProfileService, diff --git a/packages/klient/test/contract-parity.ts b/packages/klient/test/contract-parity.ts index fb6bdf032d1..83173652b46 100644 --- a/packages/klient/test/contract-parity.ts +++ b/packages/klient/test/contract-parity.ts @@ -22,23 +22,15 @@ import type { TurnPhase, } from '@moonshot-ai/agent-core-v2/agent/activityView/activityView'; import type { AgentContextData } from '@moonshot-ai/agent-core-v2/agent/contextMemory/types'; +import type { IAgentCommandService } from '@moonshot-ai/agent-core-v2/agent/command/agentCommand'; import type { TurnEndReason } from '@moonshot-ai/agent-core-v2/agent/loop/turnEvents'; +import type { PermissionMode } from '@moonshot-ai/agent-core-v2/agent/permissionPolicy/types'; +import type { IAgentProfileService } from '@moonshot-ai/agent-core-v2/agent/profile/profile'; +import type { IAgentPromptService } from '@moonshot-ai/agent-core-v2/agent/prompt/prompt'; +import type { IAgentShellCommandService } from '@moonshot-ai/agent-core-v2/agent/shellCommand/shellCommand'; +import type { IAgentSkillService } from '@moonshot-ai/agent-core-v2/agent/skill/skill'; +import type { ContentPart } from '@moonshot-ai/agent-core-v2/kosong/contract/message'; import type { PlanData } from '@moonshot-ai/agent-core-v2/features/plan/plan'; -import type { - ActivateSkillPayload, - AgentAPI, - CancelPlanPayload, - CancelShellCommandPayload, - EmptyPayload, - GetTaskOutputPayload, - GetTasksPayload, - PromptPart, - RunShellCommandPayload, - SetModelPayload, - SetModelResult, - ShellCommandResult, - StopTaskPayload, -} from '@moonshot-ai/agent-core-v2/agent/rpc/core-api'; import type { UsageStatus } from '@moonshot-ai/agent-core-v2/agent/usage/usage'; import type { SkillSummary } from '@moonshot-ai/agent-core-v2/app/skillCatalog/types'; import type { McpServerEntry } from '@moonshot-ai/agent-core-v2/mcpCore/connection-manager'; @@ -180,7 +172,7 @@ import { stopTaskPayloadSchema, tokenUsageSchema, usageStatusSchema, -} from '../src/contract/agent/rpc.js'; +} from '../src/contract/agent/schemas.js'; import { assistantDeltaEventSchema, compactionBlockedEventSchema, @@ -293,6 +285,7 @@ import { } from '../src/contract/global/workspaces.js'; import type { AssertWire, MutableDeep } from './helpers/typeAssert.js'; +import type { AgentFacade } from '../src/core/facade/agent.js'; /** One-directional: the engine type must be assignable TO the schema's infer. */ type AssertEngineToWire = [MutableDeep] extends [ @@ -521,20 +514,32 @@ const _activityViewLifecycle: AssertWire = true; -// ── agent scope (rpc.ts) ──────────────────────────────────────────────────── -// Payload/result types for the remaining `AgentAPI` methods are reached -// through the interface so the assertions track the exact methods the -// contract mirrors; payloads of the domain services the facade calls -// directly (shellCommand / profile / usage / plan / task) are imported from -// `core-api.ts` (they no longer have `AgentAPI` entries). -type PromptPayload = Parameters[0]; -type PromptLaunchResult = NonNullable>; -type SteerPayload = Parameters[0]; -type CancelPayload = Parameters[0]; -type SetPermissionPayload = Parameters[0]; -type AgentCommandInfo = Awaited>[number]; -type RunCommandPayload = Parameters[0]; +// ── agent scope (services.ts / schemas.ts) ────────────────────────────────── +// Payload/result types are derived from the domain service interfaces the +// facade calls, so the assertions track the exact methods the contract +// mirrors; facade-only payload shapes (cancel / setPermission / plan / task / +// command) derive from the `AgentFacade` input types. +type PromptPayload = Parameters[0]; +type PromptLaunchResult = NonNullable>>; +type SteerPayload = Parameters[0]; +type ActivateSkillPayload = Parameters[0]; +type AgentCommandInfo = ReturnType[number]; +type RunShellCommandPayload = Parameters[0]; +type ShellCommandResult = Awaited>; +type SetModelResult = Awaited>; type TokenUsage = NonNullable; +type PromptPart = Extract; + +type EmptyPayload = {}; +type CancelPayload = NonNullable[0]>; +type SetPermissionPayload = { mode: PermissionMode }; +type RunCommandPayload = Parameters[0]; +type CancelShellCommandPayload = Parameters[0]; +type SetModelPayload = { model: string }; +type CancelPlanPayload = NonNullable[0]>; +type GetTasksPayload = NonNullable[0]>; +type StopTaskPayload = Parameters[0]; +type GetTaskOutputPayload = Parameters[0]; const _emptyPayload: AssertWire = true; const _promptPart: AssertWire = true; diff --git a/packages/klient/test/facade.test.ts b/packages/klient/test/facade.test.ts index 8c76e8cf9a4..6c6093a33a4 100644 --- a/packages/klient/test/facade.test.ts +++ b/packages/klient/test/facade.test.ts @@ -222,7 +222,7 @@ describe('session skills routing', () => { expect(seen).toEqual(['workspace']); }); - it('activateSkill routes to agentRPCService with the agent scope', async () => { + it('activateSkill routes to agentSkillService with the agent scope', async () => { const channel = new FakeChannel(); const klient = createKlientFromChannel(channel); const agent = klient.session('s1').agent('main'); @@ -233,11 +233,69 @@ describe('session skills routing', () => { }); expect(channel.calls[0]).toEqual({ scope: { sessionId: 's1', agentId: 'main' }, - service: 'agentRPCService', - method: 'activateSkill', + service: 'agentSkillService', + method: 'activate', args: [{ name: 'review', args: 'src/app.ts' }], }); }); + + it('turn-driving calls route to their domain services with the agent scope', async () => { + const channel = new FakeChannel(); + const klient = createKlientFromChannel(channel); + const agent = klient.session('s1').agent('main'); + const scope = { sessionId: 's1', agentId: 'main' }; + + channel.results.set('agentPromptService.submit', { turn_id: 1 }); + channel.results.set('agentPromptService.submitSteer', { turn_id: 1 }); + channel.results.set('agentCommandService.list', []); + await agent.prompt({ input: [{ type: 'text', text: 'hi' }] }); + await agent.steer({ input: [{ type: 'text', text: 'steer' }] }); + await agent.cancel({ turnId: 2 }); + await agent.cancel(); + await agent.setPermission('yolo'); + await agent.listCommands(); + await agent.runCommand({ name: 'cmd', args: 'a b' }); + await agent.runCommand({ name: 'plain' }); + + expect(channel.calls).toEqual([ + { + scope, + service: 'agentPromptService', + method: 'submit', + args: [{ input: [{ type: 'text', text: 'hi' }] }], + }, + { + scope, + service: 'agentPromptService', + method: 'submitSteer', + args: [{ input: [{ type: 'text', text: 'steer' }] }], + }, + { scope, service: 'agentLoopService', method: 'cancelFromUser', args: [2] }, + { scope, service: 'agentLoopService', method: 'cancelFromUser', args: [] }, + { scope, service: 'agentPermissionModeService', method: 'setModeAndBroadcast', args: ['yolo'] }, + { scope, service: 'agentCommandService', method: 'list', args: [] }, + { scope, service: 'agentCommandService', method: 'run', args: ['cmd', 'a b'] }, + { scope, service: 'agentCommandService', method: 'run', args: ['plain'] }, + ]); + }); + + it('getContext merges the contextMemory and tokenCounting reads', async () => { + const channel = new FakeChannel(); + const klient = createKlientFromChannel(channel); + const agent = klient.session('s1').agent('main'); + const scope = { sessionId: 's1', agentId: 'main' }; + + channel.results.set('agentContextMemoryService.get', [{ role: 'user' }]); + channel.results.set('agentTokenCountingService.statusSize', 42); + await expect(agent.getContext()).resolves.toEqual({ + history: [{ role: 'user' }], + tokenCount: 42, + }); + expect(channel.calls).toEqual([ + { scope, service: 'agentContextMemoryService', method: 'get', args: [] }, + { scope, service: 'agentTokenCountingService', method: 'statusSize', args: [] }, + ]); + }); }); describe('agent mcp / compaction routing', () => { diff --git a/packages/node-sdk/src/rpc.ts b/packages/node-sdk/src/rpc.ts index b78f77c6b8d..a75f983d5a1 100644 --- a/packages/node-sdk/src/rpc.ts +++ b/packages/node-sdk/src/rpc.ts @@ -71,12 +71,6 @@ const MAIN_AGENT_ID = 'main'; export interface SessionPromptRpcInput { readonly sessionId: string; readonly input: PromptInput; - /** - * Client-managed session tool denylist (full-replace semantics), forwarded - * to engines with profile tool gating. Omit to keep the persisted value; - * `[]` clears the client portion. - */ - readonly disabledTools?: readonly string[]; } export interface SessionIdRpcInput { @@ -386,7 +380,6 @@ export abstract class SDKRpcClientBase { sessionId: input.sessionId, agentId, input: input.input, - disabledTools: input.disabledTools, }); } diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index 24c78e1ca28..fa88c176de2 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -57,10 +57,10 @@ * too (default-profile bind + permission mode). * - `prompt` / `steer` / `runShellCommand` / `cancelShellCommand` → the * `klient.session(id).agent(id)` facade; `activatePluginCommand` → - * `IAgentRPCService` through the agent scope; `activateSkill` → - * `IAgentSkillService` through the agent scope (the RPC service's - * fire-and-forget variant would swallow v1's synchronous rejections) plus - * v1's main-only metadata update; `generateAgentsMd` → + * `IAgentPluginCommandService` through the agent scope; `activateSkill` → + * `IAgentSkillService` through the agent scope (the engine settles + * `{turn_id}` and applies v1's main-only metadata update itself); + * `generateAgentsMd` → * `ISessionInitService` through the session scope; `getSessionWarnings` → * rebuilt over the profile's cached AGENTS.md warning plus the engine's * `prepareSystemPromptContext` (no v2 aggregate service exists). @@ -157,7 +157,6 @@ import { wrapSubagentModelError } from '@moonshot-ai/agent-core-v2/session/subag import { loadMcpServers } from '@moonshot-ai/agent-core-v2/workspace/workspaceMcpConfig/internal/config-loader'; import type { McpServerConfig as WorkspaceMcpServerConfig } from '@moonshot-ai/agent-core-v2/mcpCore/config-schema'; import { - applyPromptMetadataUpdate, bootstrap, DEFAULT_AGENT_PROFILE_NAME, drainQueryStoreDisposals, @@ -167,6 +166,7 @@ import { IAgentActivityView, IAgentContextInjectorService, IAgentContextMemoryService, + IAgentConversationUndoService, IAgentFullCompactionService, IAgentGoalService, IAgentPluginService, @@ -174,12 +174,14 @@ import { IAgentLoopService, IAgentPermissionModeService, IAgentPermissionRulesService, + IAgentPluginCommandService, IAgentProfileService, - IAgentRPCService, IAgentSkillService, IAgentSwarmService, IAgentTaskService, IAgentTokenCountingService, + IAgentToolPolicyService, + IAgentToolRegistryService, IBootstrapService, IConfigService, IEventService, @@ -223,7 +225,6 @@ import { PRINT_WAIT_CEILING_S_DEFAULT, ProfileError, ProfileErrors, - promptMetadataTextFromSkill, resolveAgentTaskConfig, resolveConfigPath, resolveKimiHome, @@ -965,6 +966,13 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { foldAgentWireReplay(join(ctx.sessionDir, 'agents', agent.id, 'wire.jsonl')), ]); const profile = agent.accessor.get(IAgentProfileService).data(); + const toolPolicy = agent.accessor.get(IAgentToolPolicyService); + const tools = agent.accessor.get(IAgentToolRegistryService).list().map((tool) => ({ + name: tool.name, + description: tool.description, + active: toolPolicy.isToolActive(tool.name, tool.source), + source: tool.source, + })); return { type, config: { @@ -985,7 +993,7 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { plan: plan as ResumedAgentState['plan'], swarmMode: agent.accessor.get(IAgentSwarmService).isActive, usage: usage as ResumedAgentState['usage'], - tools: agent.accessor.get(IAgentRPCService).getTools({}) as ResumedAgentState['tools'], + tools: tools as ResumedAgentState['tools'], toolStore: folded.toolStore, background: background as readonly BackgroundTaskInfo[], }; @@ -1525,20 +1533,21 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { return agent.clearPlan(); } - /** Facade (`agentRPCService.listCommands`) — the v2-only contributed-command seam. */ + /** Facade (`agentCommandService.list`) — the v2-only contributed-command seam. */ override async listCommands(input: SessionIdRpcInput): Promise { const agent = await this.agentFacade(input.sessionId); return agent.listCommands(); } - /** Facade (`agentRPCService.runCommand`) — runs the contribution engine-side. */ + /** Facade (`agentCommandService.run`) — runs the contribution engine-side. */ override async runCommand(input: RunCommandRpcInput): Promise { const agent = await this.agentFacade(input.sessionId); return agent.runCommand({ name: input.name, args: input.args }); } /** - * Facade (`agentRPCService.getContext`). The v2 `AgentContextData` is the + * Facade (`getContext`, merged client-side from `agentContextMemoryService.get` + * and `agentTokenCountingService.statusSize`). The v2 `AgentContextData` is the * same wire shape as v1's — the cast only bridges the two packages' type * declarations (v2's origin union carries kinds a v1 client never sees in * practice); the data itself crossed the same JSON boundary on both sides. @@ -1615,18 +1624,18 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } /** - * Through the agent scope (`IAgentRPCService.cancelCompaction`, the v2 RPC - * surface's own cancel) — no klient facade exists. Aborts the in-flight - * compaction; a no-op when idle, like v1. + * Through the agent scope (`IAgentFullCompactionService.cancel`) — no + * klient facade exists. Aborts the in-flight compaction; a no-op when idle, + * like v1. */ override async cancelCompaction(input: SessionIdRpcInput): Promise { const agent = await this.agentScope(input.sessionId); - await agent.accessor.get(IAgentRPCService).cancelCompaction({}); + agent.accessor.get(IAgentFullCompactionService).cancel(); } /** - * Through the agent scope (`IAgentRPCService.undoHistory`, the v2 RPC - * surface's own undo) — no klient facade exists; the returned count is + * Through the agent scope (`IAgentConversationUndoService.undo`) — no + * klient facade exists; the returned count is * dropped (v1 returns void). Failure semantics differ by design: v2 * prechecks and rejects atomically with `session.undo_unavailable`, while * v1 splices a partial suffix out of the live history and then throws @@ -1634,7 +1643,7 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { */ override async undoHistory(input: SessionIdRpcInput & { count: number }): Promise { const agent = await this.agentScope(input.sessionId); - await agent.accessor.get(IAgentRPCService).undoHistory({ count: input.count }); + await agent.accessor.get(IAgentConversationUndoService).undo(input.count); } /** @@ -1682,24 +1691,22 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } /** - * Facade (`agentRPCService.prompt`). The launch result (`{turn_id}`, or + * Facade (`agentPromptService.submit`). The launch result (`{turn_id}`, or * `undefined` when the prompt queued behind a running turn) is dropped — * v1's RPC returns void. The pre-provider surface matches v1: the metadata * update (title/lastPrompt) runs through the same shared helpers before the * turn launches, and a model-less turn fails asynchronously exactly like - * v1's. Two enqueue-semantics gaps vs v1, pinned in the migration tracker: + * v1's. One enqueue-semantics gap vs v1, pinned in the migration tracker: * v1 drops a prompt submitted while a turn is active (error event only) - * where v2 queues it FIFO, and v1 never consumes `disabledTools` (the - * payload field reaches the agent RPC but no code reads it) where v2 - * applies it as the session tool denylist. + * where v2 queues it FIFO. */ override async prompt(input: SessionPromptRpcInput): Promise { const agent = await this.agentFacade(input.sessionId); - await agent.prompt({ input: input.input, disabledTools: input.disabledTools }); + await agent.prompt({ input: input.input }); } /** - * Facade (`agentRPCService.steer`). Matches v1 on both paths: mid-turn + * Facade (`agentPromptService.submitSteer`). Matches v1 on both paths: mid-turn * steers join the running turn, and an idle-session steer degrades to * launching a fresh turn (the enqueue launches it directly) while * title/lastPrompt are updated like a prompt's. @@ -1738,40 +1745,32 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } /** - * Through the agent scope (`IAgentSkillService.activate`) — deliberately - * NOT `IAgentRPCService.activateSkill`, whose `void this.skills.activate(...)` - * fire-and-forget turns v1's synchronous rejections (`skill.not_found` / - * `skill.type_unsupported`) into unhandled rejections. The direct call keeps - * v1's semantics: validate first, then render the skill prompt and launch a - * turn with it. v1's session layer then updates title/lastPrompt for the - * MAIN agent only; replicated here over the engine's shared metadata - * helpers. Busy-turn gap vs v1, pinned in the migration tracker: v1 drops + * Through the agent scope (`IAgentSkillService.activate`) — the direct call + * keeps v1's semantics: validate first (`skill.not_found` / + * `skill.type_unsupported` reject synchronously), then render the skill + * prompt and launch a turn with it. The engine updates title/lastPrompt for + * the MAIN agent only, matching v1's session layer. Busy-turn gap vs v1, + * pinned in the migration tracker: v1 drops * the activation into an error event while a turn runs; v2's activate * awaits the queued prompt's launch. */ override async activateSkill(input: ActivateSkillRpcInput): Promise { const agent = await this.agentScope(input.sessionId); await agent.accessor.get(IAgentSkillService).activate({ name: input.name, args: input.args }); - if (this.interactiveAgentId === MAIN_AGENT_ID) { - await this.updatePromptMetadata(input.sessionId, promptMetadataTextFromSkill(input)); - } } /** - * Through the agent scope (`IAgentRPCService.activatePluginCommand`) — the - * v2 RPC surface's own implementation: the same `request.invalid` rejection - * text for an unknown command, the same argument expansion, the activation - * event, the prompt enqueue, and the metadata update. Two gaps vs v1, + * Through the agent scope (`IAgentPluginCommandService.activate`): the same + * `request.invalid` rejection text for an unknown command, the same + * argument expansion, the activation event, the prompt enqueue, and the + * main-agent-only metadata update. Two gaps vs v1, * pinned in the migration tracker: v1 resolves the command against the * session's creation-time snapshot (v2 uses the app-global live view), and - * v1 drops the activation while a turn runs where v2 queues it. v1 also - * updates title/lastPrompt for the main agent only, where the v2 RPC does - * it unconditionally — only observable through a non-main - * `interactiveAgentId`. + * v1 drops the activation while a turn runs where v2 queues it. */ override async activatePluginCommand(input: ActivatePluginCommandRpcInput): Promise { const agent = await this.agentScope(input.sessionId); - await agent.accessor.get(IAgentRPCService).activatePluginCommand({ + await agent.accessor.get(IAgentPluginCommandService).activate({ pluginId: input.pluginId, commandName: input.commandName, args: input.args, @@ -1796,8 +1795,7 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { } /** - * No v2 service implements the session-warnings aggregate (`ISessionRPCService` - * is an interface without an implementation), so the SDK rebuilds v1's + * No v2 service implements the session-warnings aggregate, so the SDK rebuilds v1's * `Session.getSessionWarnings` over v2 primitives: the profile's cached * `agentsMdWarning` (computed on every bind, v1's bootstrap-time cache), * recomputed through the engine's own `prepareSystemPromptContext` when the @@ -1842,23 +1840,6 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { return warnings; } - /** - * v1's session-layer prompt-metadata update (title/lastPrompt), rebuilt - * over the engine's shared helper so skill/plugin-command activations land - * on the same metadata the native v2 prompt path writes. - */ - private async updatePromptMetadata(sessionId: string, text: string | undefined): Promise { - const session = this.requireLiveSession(sessionId); - await applyPromptMetadataUpdate( - { - metadata: session.accessor.get(ISessionMetadata), - eventService: this.engineAccessor.get(IEventService), - sessionId, - }, - text, - ); - } - /** * Through the session scope (`ISessionBtwService`) — no klient facade * exists. The v2 service is the port of v1's btw fork: same inherited diff --git a/packages/node-sdk/test/v1-v2-parity.test.ts b/packages/node-sdk/test/v1-v2-parity.test.ts index ce5e333c0da..26f8dfa1248 100644 --- a/packages/node-sdk/test/v1-v2-parity.test.ts +++ b/packages/node-sdk/test/v1-v2-parity.test.ts @@ -2476,8 +2476,8 @@ describe('v1↔v2 agent interaction parity', () => { // Model-less on purpose: parity covers the pre-provider surface — the // call returns without throwing and the metadata update (same shared // helpers on both engines) lands before the turn fails asynchronously. - // The enqueue-semantics gaps (v1 drops a mid-turn prompt, v2 queues it; - // v1 ignores disabledTools, v2 applies it) are pinned in the tracker. + // The enqueue-semantics gap (v1 drops a mid-turn prompt, v2 queues it) is + // pinned in the tracker. const pair = await makeSessionParityPair(); try { await createOnBoth(pair, { id: 'session_parity_agent_prompt' }); From 504e6292ede448367d1341751f9f98b24cc2994f Mon Sep 17 00:00:00 2001 From: Liu Zhongnuo Date: Thu, 13 Aug 2026 12:00:04 +0800 Subject: [PATCH 31/50] feat(mcp): inspect effective authorization state in v1 (#2856) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(mcp): inspect effective authorization state * test(agent-core-v2): register MCP auth coordinator fixture * fix(mcp): validate runtime names against full catalog * fix(mcp): reconnect after pending auth updates * docs(mcp): describe auth coordinator collaborator * fix(mcp): ignore disabled runtime name collisions * fix(mcp): serialize OAuth token refresh * test(mcp): await OAuth credential writes * fix(mcp): queue trailing credential reconnect * fix(oauth): preserve access-only refresh winners * fix(mcp): preserve legacy offline auth state * fix(mcp): redact inspection credentials * refactor(mcp): keep app inspection on v1 * fix(mcp): guard legacy auth status mutations * fix(mcp): avoid deterministic legacy auth probes * fix(mcp): cover initialization credential updates --------- Co-authored-by: 刘仲诺 --- .changeset/sync-mcp-oauth-credentials.md | 5 + packages/agent-core/src/agent/tool/index.ts | 2 +- packages/agent-core/src/mcp/client-http.ts | 3 +- packages/agent-core/src/mcp/client-sse.ts | 3 +- .../agent-core/src/mcp/connection-manager.ts | 17 + .../agent-core/src/mcp/oauth/coordinator.ts | 40 ++ packages/agent-core/src/mcp/oauth/index.ts | 1 + packages/agent-core/src/mcp/oauth/provider.ts | 72 +++- packages/agent-core/src/mcp/oauth/service.ts | 22 +- packages/agent-core/src/plugin/manager.ts | 33 +- packages/agent-core/src/plugin/types.ts | 8 + packages/agent-core/src/rpc/core-api.ts | 50 +++ packages/agent-core/src/rpc/core-impl.ts | 341 ++++++++++++++++-- packages/agent-core/src/session/index.ts | 49 ++- .../test/mcp/connection-manager.test.ts | 53 ++- .../agent-core/test/mcp/oauth-store.test.ts | 65 +++- .../agent-core/test/plugin/manager.test.ts | 17 + .../agent-core/test/rpc/plugins-rpc.test.ts | 98 +++++ packages/agent-core/test/session/init.test.ts | 23 ++ .../node-sdk/test/mcp-auth-status-server.ts | 117 +++++- packages/node-sdk/test/mcp-config.test.ts | 51 ++- .../node-sdk/test/sdk-rpc-client-v2.test.ts | 8 +- packages/node-sdk/test/v1-v2-parity.test.ts | 4 +- packages/oauth/src/index.ts | 3 + packages/oauth/src/oauth-token-transaction.ts | 251 +++++++++++++ .../test/oauth-token-transaction.test.ts | 173 +++++++++ 26 files changed, 1403 insertions(+), 106 deletions(-) create mode 100644 .changeset/sync-mcp-oauth-credentials.md create mode 100644 packages/agent-core/src/mcp/oauth/coordinator.ts create mode 100644 packages/oauth/src/oauth-token-transaction.ts create mode 100644 packages/oauth/test/oauth-token-transaction.test.ts diff --git a/.changeset/sync-mcp-oauth-credentials.md b/.changeset/sync-mcp-oauth-credentials.md new file mode 100644 index 00000000000..4a106bf31cc --- /dev/null +++ b/.changeset/sync-mcp-oauth-credentials.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Refresh active MCP connections after OAuth credentials are added or reset. diff --git a/packages/agent-core/src/agent/tool/index.ts b/packages/agent-core/src/agent/tool/index.ts index 6431b873a04..ff737f1f68d 100644 --- a/packages/agent-core/src/agent/tool/index.ts +++ b/packages/agent-core/src/agent/tool/index.ts @@ -406,7 +406,7 @@ export class ToolManager { serverUrl, oauthService, reconnect: async () => { - await mcp.reconnect(entry.name); + await mcp.reconnectAndJoin(entry.name); }, }); this.mcpTools.set(tool.name, { tool, serverName: entry.name }); diff --git a/packages/agent-core/src/mcp/client-http.ts b/packages/agent-core/src/mcp/client-http.ts index f38b54a47d0..ba62c5f81b9 100644 --- a/packages/agent-core/src/mcp/client-http.ts +++ b/packages/agent-core/src/mcp/client-http.ts @@ -13,6 +13,7 @@ import { type UnexpectedCloseReason, } from './client-shared'; import { buildMcpRemoteHeaders } from './client-remote'; +import { createMcpOAuthFetch } from './oauth/provider'; import type { MCPClient, MCPToolDefinition, MCPToolResult } from './types'; export interface HttpMcpClientOptions { @@ -71,7 +72,7 @@ export class HttpMcpClient implements MCPClient { this.transport = new StreamableHTTPClientTransport(new URL(config.url), { requestInit: headers !== undefined ? { headers } : undefined, - fetch: options.fetch, + fetch: createMcpOAuthFetch(options.oauthProvider, options.fetch), authProvider: options.oauthProvider, }); this.client = new Client({ diff --git a/packages/agent-core/src/mcp/client-sse.ts b/packages/agent-core/src/mcp/client-sse.ts index 254c0786de8..87f95a728dc 100644 --- a/packages/agent-core/src/mcp/client-sse.ts +++ b/packages/agent-core/src/mcp/client-sse.ts @@ -13,6 +13,7 @@ import { type UnexpectedCloseReason, } from './client-shared'; import { buildMcpRemoteHeaders } from './client-remote'; +import { createMcpOAuthFetch } from './oauth/provider'; import type { MCPClient, MCPToolDefinition, MCPToolResult } from './types'; export interface SseMcpClientOptions { @@ -64,7 +65,7 @@ export class SseMcpClient implements MCPClient { this.transport = new SSEClientTransport(new URL(config.url), { requestInit: headers !== undefined ? { headers } : undefined, - fetch: options.fetch, + fetch: createMcpOAuthFetch(options.oauthProvider, options.fetch), authProvider: options.oauthProvider, }); this.client = new Client({ diff --git a/packages/agent-core/src/mcp/connection-manager.ts b/packages/agent-core/src/mcp/connection-manager.ts index 152d3a81318..7e46c1e3e47 100644 --- a/packages/agent-core/src/mcp/connection-manager.ts +++ b/packages/agent-core/src/mcp/connection-manager.ts @@ -129,6 +129,7 @@ export interface McpConnectionManagerOptions { export class McpConnectionManager { private readonly entries = new Map(); private readonly listeners = new Set(); + private readonly inFlightReconnects = new Map>(); private initialLoad: Promise = Promise.resolve(); private initialLoadAttemptId = 0; private initialLoadStartedAt: number | undefined; @@ -314,6 +315,22 @@ export class McpConnectionManager { await this.connectOne(entry, attemptId); } + reconnectAndJoin(name: string): Promise { + const existing = this.inFlightReconnects.get(name); + if (existing !== undefined) return existing; + const work = this.reconnect(name).finally(() => { + if (this.inFlightReconnects.get(name) === work) this.inFlightReconnects.delete(name); + }); + this.inFlightReconnects.set(name, work); + return work; + } + + async reconnectAfterCurrent(name: string): Promise { + const existing = this.inFlightReconnects.get(name); + if (existing !== undefined) await existing.catch(() => undefined); + await this.reconnectAndJoin(name); + } + async shutdown(): Promise { const entries = Array.from(this.entries.values()); this.entries.clear(); diff --git a/packages/agent-core/src/mcp/oauth/coordinator.ts b/packages/agent-core/src/mcp/oauth/coordinator.ts new file mode 100644 index 00000000000..0a35fef3fa5 --- /dev/null +++ b/packages/agent-core/src/mcp/oauth/coordinator.ts @@ -0,0 +1,40 @@ +import { canonicalMcpOAuthResource } from './store'; + +export interface McpOAuthCredentialsChangedEvent { + readonly serverName: string; + readonly serverUrl: string; + readonly kind: 'updated' | 'invalidated'; +} + +export interface McpOAuthCredentialsCoordinator { + notifyCredentialsChanged(serverName: string, serverUrl: string | URL): void; + notifyCredentialsInvalidated(serverName: string, serverUrl: string | URL): void; + onCredentialsChanged(listener: (event: McpOAuthCredentialsChangedEvent) => void): () => void; +} + +export class McpOAuthCoordinator implements McpOAuthCredentialsCoordinator { + private readonly listeners = new Set<(event: McpOAuthCredentialsChangedEvent) => void>(); + + notifyCredentialsChanged(serverName: string, serverUrl: string | URL): void { + const event = { + serverName, + serverUrl: canonicalMcpOAuthResource(serverUrl), + kind: 'updated' as const, + }; + for (const listener of this.listeners) listener(event); + } + + notifyCredentialsInvalidated(serverName: string, serverUrl: string | URL): void { + const event = { + serverName, + serverUrl: canonicalMcpOAuthResource(serverUrl), + kind: 'invalidated' as const, + }; + for (const listener of this.listeners) listener(event); + } + + onCredentialsChanged(listener: (event: McpOAuthCredentialsChangedEvent) => void): () => void { + this.listeners.add(listener); + return () => this.listeners.delete(listener); + } +} diff --git a/packages/agent-core/src/mcp/oauth/index.ts b/packages/agent-core/src/mcp/oauth/index.ts index 87c98552aca..462830a3cdd 100644 --- a/packages/agent-core/src/mcp/oauth/index.ts +++ b/packages/agent-core/src/mcp/oauth/index.ts @@ -1,4 +1,5 @@ export * from './callback-server'; +export * from './coordinator'; export * from './provider'; export * from './service'; export * from './store'; diff --git a/packages/agent-core/src/mcp/oauth/provider.ts b/packages/agent-core/src/mcp/oauth/provider.ts index 7dd3828ba48..baf41b7aba2 100644 --- a/packages/agent-core/src/mcp/oauth/provider.ts +++ b/packages/agent-core/src/mcp/oauth/provider.ts @@ -21,12 +21,14 @@ import type { OAuthClientProvider, OAuthDiscoveryState, } from '@modelcontextprotocol/sdk/client/auth.js'; -import type { - OAuthClientInformationFull, - OAuthClientInformationMixed, - OAuthClientMetadata, - OAuthTokens, +import { + OAuthTokensSchema, + type OAuthClientInformationFull, + type OAuthClientInformationMixed, + type OAuthClientMetadata, + type OAuthTokens, } from '@modelcontextprotocol/sdk/shared/auth.js'; +import { OAuthTokenTransaction } from '@moonshot-ai/kimi-code-oauth'; import { JsonFileStore, canonicalMcpOAuthResource, mcpOAuthStoreKey } from './store'; @@ -57,12 +59,25 @@ export class McpOAuthClientProvider implements OAuthClientProvider { private _codeVerifier: string | undefined; private _state: string | undefined; private _lastAuthorizationUrl: URL | undefined; + private readonly tokenTransaction: OAuthTokenTransaction; constructor(options: McpOAuthProviderOptions) { this.serverUrl = canonicalMcpOAuthResource(options.serverUrl); this.storeKey = mcpOAuthStoreKey(options.serverName, this.serverUrl); this.store = options.store; this.clientLabel = options.clientLabel ?? `kimi-code (${options.serverName})`; + const tokensFile = `${this.storeKey}${TOKENS_SUFFIX}`; + this.tokenTransaction = new OAuthTokenTransaction({ + key: this.storeKey, + read: async () => this.store.read(tokensFile), + write: async (tokens) => { + this.store.write(tokensFile, tokens); + }, + remove: async () => { + this.store.remove(tokensFile); + }, + parse: (value) => OAuthTokensSchema.safeParse(value).data, + }); } // ── flow-scoped state, set by McpOAuthService before invoking auth() ──── @@ -123,8 +138,17 @@ export class McpOAuthClientProvider implements OAuthClientProvider { return this.store.read(`${this.storeKey}${TOKENS_SUFFIX}`); } - saveTokens(tokens: OAuthTokens): void { - this.store.write(`${this.storeKey}${TOKENS_SUFFIX}`, tokens); + async saveTokens(tokens: OAuthTokens): Promise { + await this.tokenTransaction.save(tokens); + } + + /** + * Wrap the fetch used by the SDK's OAuth flow. Refresh-token grants for the + * same MCP identity are serialized, re-read from durable storage inside the + * lock, and committed before the lock is released. + */ + createOAuthFetch(fetchFn: typeof fetch = globalThis.fetch): typeof fetch { + return this.tokenTransaction.createFetch(fetchFn); } redirectToAuthorization(url: URL): void { @@ -166,23 +190,42 @@ export class McpOAuthClientProvider implements OAuthClientProvider { * never comes. Dropping the registration lets the next `auth()` call * re-register with the current callback URI. */ - invalidateStaleRegistration(redirectUri: string): boolean { + async invalidateStaleRegistration(redirectUri: string): Promise { const info = this.clientInformation(); if (info === undefined || !('redirect_uris' in info)) return false; const uris = info.redirect_uris; if (!Array.isArray(uris) || uris.length === 0) return false; if (uris.includes(redirectUri)) return false; - this.invalidateCredentials('client'); + await this.clearCredentials('client'); return true; } - invalidateCredentials(scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery'): void { + async invalidateCredentials( + scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery', + ): Promise { + if (scope !== 'tokens' && scope !== 'all') { + await this.clearCredentials(scope); + return; + } + const shouldClearRelatedCredentials = await this.tokenTransaction.invalidateFromSdk(scope); + if (!shouldClearRelatedCredentials) return; + if (scope === 'all') { + await this.clearCredentials('client'); + await this.clearCredentials('discovery'); + this._codeVerifier = undefined; + } + } + + /** Explicit user-driven reset; unlike the SDK invalidation hook, never preserves tokens. */ + async clearCredentials( + scope: 'all' | 'client' | 'tokens' | 'verifier' | 'discovery', + ): Promise { if (scope === 'verifier') { this._codeVerifier = undefined; return; } if (scope === 'tokens' || scope === 'all') { - this.store.remove(`${this.storeKey}${TOKENS_SUFFIX}`); + await this.tokenTransaction.clear(); } if (scope === 'client' || scope === 'all') { this.store.remove(`${this.storeKey}${CLIENT_SUFFIX}`); @@ -204,6 +247,13 @@ export class McpOAuthClientProvider implements OAuthClientProvider { } } +export function createMcpOAuthFetch( + provider: OAuthClientProvider | undefined, + fetchFn: typeof fetch | undefined, +): typeof fetch | undefined { + return provider instanceof McpOAuthClientProvider ? provider.createOAuthFetch(fetchFn) : fetchFn; +} + function registeredRedirectUri(info: OAuthClientInformationMixed | undefined): string | undefined { if (info === undefined || !('redirect_uris' in info)) return undefined; const [redirectUri] = info.redirect_uris; diff --git a/packages/agent-core/src/mcp/oauth/service.ts b/packages/agent-core/src/mcp/oauth/service.ts index ed7ba626c2e..04e94e41fee 100644 --- a/packages/agent-core/src/mcp/oauth/service.ts +++ b/packages/agent-core/src/mcp/oauth/service.ts @@ -25,6 +25,7 @@ import { auth, type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js'; import { startCallbackServer, type CallbackServer } from './callback-server'; +import type { McpOAuthCredentialsCoordinator } from './coordinator'; import { McpOAuthClientProvider } from './provider'; import { JsonFileStore, mcpCredentialsDir, mcpOAuthStoreKey } from './store'; @@ -35,6 +36,7 @@ export interface McpOAuthServiceOptions { readonly kimiHomeDir?: string; /** Override for the label embedded in DCR `client_name`. */ readonly clientLabel?: string; + readonly coordinator?: McpOAuthCredentialsCoordinator; } export interface BeginAuthorizationOptions { @@ -61,6 +63,7 @@ export interface BeginAuthorizationResult { export class McpOAuthService { private readonly store: JsonFileStore; private readonly clientLabel: string | undefined; + private readonly coordinator: McpOAuthCredentialsCoordinator | undefined; private readonly providers = new Map(); constructor(options: McpOAuthServiceOptions = {}) { @@ -70,6 +73,7 @@ export class McpOAuthService { options.kimiHomeDir === undefined ? undefined : mcpCredentialsDir(options.kimiHomeDir), ); this.clientLabel = options.clientLabel; + this.coordinator = options.coordinator; } /** Returns the cached provider for `serverName` + `serverUrl`, constructing it on first use. */ @@ -129,14 +133,18 @@ export class McpOAuthService { // See invalidateStaleRegistration: a reused registration whose redirect // URIs no longer cover this flow's random-port callback would be rejected // at the authorization endpoint with an error only the browser ever sees. - provider.invalidateStaleRegistration(callbackServer.redirectUri); + await provider.invalidateStaleRegistration(callbackServer.redirectUri); let authorizationUrl: URL | undefined; try { - const result = await auth(provider as OAuthClientProvider, { serverUrl }); + const result = await auth(provider as OAuthClientProvider, { + serverUrl, + fetchFn: provider.createOAuthFetch(), + }); if (result !== 'REDIRECT') { // Tokens already valid (e.g. unexpired refresh). Nothing to do. await callbackServer.close(); + this.coordinator?.notifyCredentialsChanged(serverName, serverUrl); throw new AlreadyAuthorizedError(serverName); } authorizationUrl = provider.takeAuthorizationUrl(); @@ -174,6 +182,7 @@ export class McpOAuthService { const finalResult = await auth(provider as OAuthClientProvider, { serverUrl, authorizationCode: code, + fetchFn: provider.createOAuthFetch(), }); if (finalResult !== 'AUTHORIZED') { throw new Error(`OAuth code exchange returned "${finalResult}" instead of AUTHORIZED`); @@ -185,6 +194,7 @@ export class McpOAuthService { settled = true; await callbackServer.close().catch(() => undefined); provider.resetFlow(); + this.coordinator?.notifyCredentialsChanged(serverName, serverUrl); }; return { authorizationUrl, complete, cancel }; @@ -199,8 +209,12 @@ export class McpOAuthService { serverName: string, serverUrl: string | URL, scope: 'all' | 'client' | 'tokens' | 'discovery' = 'all', - ): void { - this.getProvider(serverName, serverUrl).invalidateCredentials(scope); + ): Promise { + return this.getProvider(serverName, serverUrl).clearCredentials(scope); + } + + forgetProvider(serverName: string, serverUrl: string | URL): void { + this.providers.delete(mcpOAuthStoreKey(serverName, serverUrl)); } } diff --git a/packages/agent-core/src/plugin/manager.ts b/packages/agent-core/src/plugin/manager.ts index 27373277b42..aa63648dd67 100644 --- a/packages/agent-core/src/plugin/manager.ts +++ b/packages/agent-core/src/plugin/manager.ts @@ -20,6 +20,7 @@ import { type PluginGithubMetadata, type PluginInfo, type PluginMcpServerInfo, + type PluginMcpServerRuntimeConfig, type PluginRecord, type PluginSource, type PluginSummary, @@ -253,15 +254,31 @@ export class PluginManager { enabledMcpServers(): Record { const out: Record = {}; + for (const server of this.mcpServers()) { + if (!server.enabled) continue; + out[server.runtimeName] = server.config; + } + return out; + } + + mcpServers(): readonly PluginMcpServerRuntimeConfig[] { + const out: PluginMcpServerRuntimeConfig[] = []; for (const record of this.records.values()) { - if (!record.enabled || record.state !== 'ok' || record.manifest === undefined) continue; - for (const [name, config] of Object.entries(record.manifest.mcpServers ?? {})) { - if (!isMcpServerEnabled(record, name, config)) continue; - out[pluginMcpRuntimeName(record.id, name)] = withPluginMcpRuntime( - withMcpServerEnabled(config, true), - record.root, - this.kimiHomeDir, - ); + if (record.state !== 'ok' || record.manifest === undefined) continue; + for (const [serverName, config] of Object.entries(record.manifest.mcpServers ?? {})) { + const enabled = record.enabled && isMcpServerEnabled(record, serverName, config); + const runtimeName = pluginMcpRuntimeName(record.id, serverName); + out.push({ + pluginId: record.id, + serverName, + runtimeName, + enabled, + config: withPluginMcpRuntime( + withMcpServerEnabled(config, enabled), + record.root, + this.kimiHomeDir, + ), + }); } } return out; diff --git a/packages/agent-core/src/plugin/types.ts b/packages/agent-core/src/plugin/types.ts index 19e07770df8..96c0b3db332 100644 --- a/packages/agent-core/src/plugin/types.ts +++ b/packages/agent-core/src/plugin/types.ts @@ -71,6 +71,14 @@ export interface PluginMcpServerInfo { readonly headerKeys?: readonly string[]; } +export interface PluginMcpServerRuntimeConfig { + readonly pluginId: string; + readonly serverName: string; + readonly runtimeName: string; + readonly enabled: boolean; + readonly config: McpServerConfig; +} + export interface PluginCommandDef { readonly pluginId: string; readonly name: string; diff --git a/packages/agent-core/src/rpc/core-api.ts b/packages/agent-core/src/rpc/core-api.ts index fbcf50177f9..48cca77c959 100644 --- a/packages/agent-core/src/rpc/core-api.ts +++ b/packages/agent-core/src/rpc/core-api.ts @@ -352,6 +352,22 @@ export interface GlobalMcpServerNamePayload { readonly name: string; } +export type McpServerLocator = + | { readonly source: 'global'; readonly name: string } + | { + readonly source: 'plugin'; + readonly pluginId: string; + readonly serverName: string; + }; + +export interface McpServerLocatorPayload { + readonly locator: McpServerLocator; +} + +export interface InspectAppMcpServersPayload { + readonly targets?: readonly McpServerLocator[]; +} + export type GlobalMcpServerAuthState = | 'not-applicable' | 'bearer-token' @@ -363,6 +379,33 @@ export interface GlobalMcpServerAuthStatus { readonly authStatus: GlobalMcpServerAuthState; } +export type AppMcpServerAuthState = GlobalMcpServerAuthState | 'unavailable'; + +export type AppMcpServerConfig = + | (Omit, 'env'> & { + readonly envKeys?: readonly string[]; + }) + | (Omit, 'headers'> & { + readonly headerKeys?: readonly string[]; + }); + +export interface AppMcpServerDescriptor { + readonly serverId: string; + readonly locator: McpServerLocator; + readonly runtimeName: string; + readonly canonicalUrl: string | undefined; + readonly origin: McpServerLocator['source']; + readonly config: AppMcpServerConfig; + readonly enabled: boolean; + readonly editable: boolean; +} + +export interface AppMcpServerInspection extends AppMcpServerDescriptor { + readonly authStatus: AppMcpServerAuthState; + readonly checkedAt?: number; + readonly error?: string; +} + export type BeginGlobalMcpServerAuthResult = | { readonly status: 'already-authorized' } | { @@ -551,15 +594,22 @@ export interface CoreAPI extends SessionAPIWithId { listGlobalMcpServerAuthStatuses: ( payload: EmptyPayload, ) => readonly GlobalMcpServerAuthStatus[]; + inspectAppMcpServers: ( + payload: InspectAppMcpServersPayload, + ) => readonly AppMcpServerInspection[]; addGlobalMcpServer: (payload: PutGlobalMcpServerPayload) => readonly GlobalMcpServerConfig[]; updateGlobalMcpServer: (payload: PutGlobalMcpServerPayload) => readonly GlobalMcpServerConfig[]; removeGlobalMcpServer: (payload: GlobalMcpServerNamePayload) => readonly GlobalMcpServerConfig[]; beginGlobalMcpServerAuth: ( payload: GlobalMcpServerNamePayload, ) => BeginGlobalMcpServerAuthResult; + beginMcpServerAuth: (payload: McpServerLocatorPayload) => BeginGlobalMcpServerAuthResult; completeGlobalMcpServerAuth: (payload: CompleteGlobalMcpServerAuthPayload) => void; + completeMcpServerAuth: (payload: CompleteGlobalMcpServerAuthPayload) => void; cancelGlobalMcpServerAuth: (payload: CancelGlobalMcpServerAuthPayload) => void; + cancelMcpServerAuth: (payload: CancelGlobalMcpServerAuthPayload) => void; resetGlobalMcpServerAuth: (payload: GlobalMcpServerNamePayload) => void; + resetMcpServerAuth: (payload: McpServerLocatorPayload) => void; testGlobalMcpServer: (payload: TestGlobalMcpServerPayload) => GlobalMcpServerTestResult; createSession: (payload: CreateSessionPayload) => SessionSummary; closeSession: (payload: CloseSessionPayload) => void; diff --git a/packages/agent-core/src/rpc/core-impl.ts b/packages/agent-core/src/rpc/core-impl.ts index bd79a402e3d..158324e5175 100644 --- a/packages/agent-core/src/rpc/core-impl.ts +++ b/packages/agent-core/src/rpc/core-impl.ts @@ -39,8 +39,10 @@ import { import type { Logger } from '../logging/types'; import { AlreadyAuthorizedError, + canonicalMcpOAuthResource, GlobalMcpConfigStore, McpConnectionManager, + McpOAuthCoordinator, McpOAuthService, resolveMcpStartupTimeoutMs, resolveMcpToolTimeoutMs, @@ -79,6 +81,9 @@ import type { ActivatePluginCommandPayload, AddAdditionalDirPayload, AddAdditionalDirResult, + AppMcpServerConfig, + AppMcpServerDescriptor, + AppMcpServerInspection, ArchiveSessionPayload, BeginGlobalMcpServerAuthResult, BeginCompactionPayload, @@ -115,9 +120,12 @@ import type { GetPluginInfoPayload, InstallPluginPayload, ImportContextPayload, + InspectAppMcpServersPayload, ListSessionsPayload, ListWorkspaceSkillsPayload, McpServerInfo, + McpServerLocator, + McpServerLocatorPayload, McpStartupMetrics, PluginInfo, PluginSummary, @@ -220,6 +228,7 @@ export class KimiCore implements PromisableMethods { private readonly sessionStore: SessionStore; private readonly globalMcpConfig: GlobalMcpConfigStore; private readonly globalMcpOAuth: McpOAuthService; + private readonly mcpOAuthCoordinator: McpOAuthCoordinator; private readonly globalMcpOAuthFlows = new Map(); readonly plugins: PluginManager; private pluginsReady: Promise; @@ -276,7 +285,11 @@ export class KimiCore implements PromisableMethods { resolveWorkspaceId: options.resolveWorkspaceId, }); this.globalMcpConfig = new GlobalMcpConfigStore(this.homeDir); - this.globalMcpOAuth = new McpOAuthService({ kimiHomeDir: this.homeDir }); + this.mcpOAuthCoordinator = new McpOAuthCoordinator(); + this.globalMcpOAuth = new McpOAuthService({ + kimiHomeDir: this.homeDir, + coordinator: this.mcpOAuthCoordinator, + }); this.plugins = new PluginManager({ kimiHomeDir: this.homeDir }); // Capture the error rather than swallow it: mutators and explicit /plugins // reads rethrow so the user sees what's wrong; createSession/resumeSession @@ -415,6 +428,7 @@ export class KimiCore implements PromisableMethods { profileName: options.agentProfile, }, mcpConfig, + mcpOAuthCoordinator: this.mcpOAuthCoordinator, experimentalFlags: this.experimentalFlags, imageLimits: this.imageLimits, telemetry: sessionTelemetry, @@ -577,6 +591,7 @@ export class KimiCore implements PromisableMethods { refreshPluginAgents: overrides.refreshPluginAgents, }, mcpConfig, + mcpOAuthCoordinator: this.mcpOAuthCoordinator, experimentalFlags: this.experimentalFlags, imageLimits: this.imageLimits, telemetry: withTelemetryContext(this.telemetry, { sessionId: summary.id }), @@ -772,12 +787,43 @@ export class KimiCore implements PromisableMethods { _input?: EmptyPayload, ): Promise { const servers = await this.globalMcpConfig.list(); - return Promise.all( - servers.map(async (server) => ({ + const authStatuses = new Map(); + const targets: McpServerLocator[] = []; + for (const server of servers) { + const credentialPresent = + server.transport !== 'stdio' && + this.globalMcpOAuth.hasTokens(server.name, server.url); + const authStatus = legacyGlobalMcpAuthStateWithoutProbe(server, credentialPresent); + if (authStatus === undefined) targets.push({ source: 'global', name: server.name }); + else authStatuses.set(server.name, authStatus); + } + const inspections = await this.inspectAppMcpServers({ + targets, + }); + const inspectionsByName = new Map(inspections.map((server) => [server.runtimeName, server])); + return servers.map((server) => { + const knownAuthStatus = authStatuses.get(server.name); + if (knownAuthStatus !== undefined) return { name: server.name, authStatus: knownAuthStatus }; + const inspection = inspectionsByName.get(server.name)!; + return { name: server.name, - authStatus: await this.globalMcpServerAuthState(server), - })), - ); + authStatus: legacyGlobalMcpAuthState( + inspection, + inspection.authStatus === 'unavailable' && + inspection.config.transport !== 'stdio' && + this.globalMcpOAuth.hasTokens(inspection.runtimeName, inspection.config.url), + ), + }; + }); + } + + async inspectAppMcpServers({ + targets, + }: InspectAppMcpServersPayload): Promise { + const catalog = await this.appMcpServerDescriptors(); + const descriptors = selectAppMcpServerDescriptors(catalog, targets); + const inspections = await this.inspectAppMcpServerDescriptors(descriptors, catalog); + return inspections.map(sanitizeAppMcpServerInspection); } async addGlobalMcpServer( @@ -801,10 +847,16 @@ export class KimiCore implements PromisableMethods { async beginGlobalMcpServerAuth( { name }: GlobalMcpServerNamePayload, ): Promise { - const server = await this.globalMcpConfig.get(name); - const config = requireOAuthMcpServer(server); + return this.beginMcpServerAuth({ locator: { source: 'global', name } }); + } + + async beginMcpServerAuth({ + locator, + }: McpServerLocatorPayload): Promise { + const server = await this.resolveAppMcpServer(locator); + const config = requireOAuthMcpConfig(server.runtimeName, server.config); try { - const flow = await this.globalMcpOAuth.beginAuthorization(server.name, config.url); + const flow = await this.globalMcpOAuth.beginAuthorization(server.runtimeName, config.url); const flowId = randomUUID(); this.globalMcpOAuthFlows.set(flowId, { flow }); return { @@ -821,6 +873,13 @@ export class KimiCore implements PromisableMethods { } async completeGlobalMcpServerAuth( + payload: CompleteGlobalMcpServerAuthPayload, + options: { readonly signal?: AbortSignal } = {}, + ): Promise { + return this.completeMcpServerAuth(payload, options); + } + + async completeMcpServerAuth( { flowId, timeoutMs }: CompleteGlobalMcpServerAuthPayload, options: { readonly signal?: AbortSignal } = {}, ): Promise { @@ -839,8 +898,12 @@ export class KimiCore implements PromisableMethods { } async cancelGlobalMcpServerAuth( - { flowId }: CancelGlobalMcpServerAuthPayload, + payload: CancelGlobalMcpServerAuthPayload, ): Promise { + return this.cancelMcpServerAuth(payload); + } + + async cancelMcpServerAuth({ flowId }: CancelGlobalMcpServerAuthPayload): Promise { const active = this.globalMcpOAuthFlows.get(flowId); if (active === undefined) return; this.globalMcpOAuthFlows.delete(flowId); @@ -848,9 +911,14 @@ export class KimiCore implements PromisableMethods { } async resetGlobalMcpServerAuth({ name }: GlobalMcpServerNamePayload): Promise { - const server = await this.globalMcpConfig.get(name); - const config = requireRemoteMcpServer(server); - this.globalMcpOAuth.invalidate(server.name, config.url); + return this.resetMcpServerAuth({ locator: { source: 'global', name } }); + } + + async resetMcpServerAuth({ locator }: McpServerLocatorPayload): Promise { + const server = await this.resolveAppMcpServer(locator); + const config = requireRemoteMcpConfig(server.runtimeName, server.config); + await this.globalMcpOAuth.invalidate(server.runtimeName, config.url); + this.mcpOAuthCoordinator.notifyCredentialsInvalidated(server.runtimeName, config.url); } async testGlobalMcpServer( @@ -881,21 +949,140 @@ export class KimiCore implements PromisableMethods { } } - private async globalMcpServerAuthState( - server: GlobalMcpServerConfig, - ): Promise { - if (server.transport === 'stdio') return 'not-applicable'; - if (server.bearerTokenEnvVar !== undefined) return 'bearer-token'; - // Keep status classification aligned with the existing connection manager: - // unmarked static headers are not treated as OAuth credentials. - if (server.headers !== undefined && server.auth !== 'oauth') return 'not-applicable'; - if (server.transport !== 'http' && server.auth !== 'oauth') return 'not-applicable'; - if (this.globalMcpOAuth.hasTokens(server.name, server.url)) return 'oauth-authorized'; - if (server.auth === 'oauth') return 'oauth-required'; - - return this.withGlobalMcpServerProbe(server, undefined, (manager) => - manager.get(server.name)?.status === 'needs-auth' ? 'oauth-required' : 'not-applicable', + private async appMcpServerDescriptors(): Promise { + await this.pluginsReady; + const globals = (await this.globalMcpConfig.list()).map((server) => { + const locator = { source: 'global', name: server.name } as const; + const config = mcpConfigWithoutName(server); + return { + serverId: mcpServerId(locator), + locator, + runtimeName: server.name, + canonicalUrl: + config.transport === 'stdio' ? undefined : canonicalMcpOAuthResource(config.url), + origin: 'global' as const, + config, + enabled: config.enabled !== false, + editable: true, + }; + }); + const pluginRuntimeConfigs = this.plugins.mcpServers(); + const configuredPlugins = this.withManagedKimiPluginEnv( + Object.fromEntries( + pluginRuntimeConfigs.map((server) => [server.runtimeName, server.config]), + ), + ); + const plugins = pluginRuntimeConfigs.map((server) => { + const locator = { + source: 'plugin', + pluginId: server.pluginId, + serverName: server.serverName, + } as const; + return { + serverId: mcpServerId(locator), + locator, + runtimeName: server.runtimeName, + canonicalUrl: + server.config.transport === 'stdio' + ? undefined + : canonicalMcpOAuthResource(server.config.url), + origin: 'plugin' as const, + config: configuredPlugins[server.runtimeName]!, + enabled: server.enabled, + editable: false, + }; + }); + return [...globals, ...plugins]; + } + + private async resolveAppMcpServer( + locator: McpServerLocator, + ): Promise { + const catalog = await this.appMcpServerDescriptors(); + const server = selectAppMcpServerDescriptors(catalog, [locator])[0]!; + const conflict = catalog.find( + (candidate) => + candidate.serverId !== server.serverId && + candidate.enabled && + candidate.config.enabled !== false && + candidate.runtimeName === server.runtimeName, ); + if (conflict !== undefined) { + throw new KimiError( + ErrorCodes.REQUEST_INVALID, + `MCP runtime name "${server.runtimeName}" is shared by multiple enabled servers`, + ); + } + return server; + } + + private async inspectAppMcpServerDescriptors( + descriptors: readonly AppMcpServerRuntimeDescriptor[], + catalog: readonly AppMcpServerRuntimeDescriptor[], + ): Promise { + const oauth = new McpOAuthService({ kimiHomeDir: this.homeDir }); + const runtimeNameCounts = new Map(); + for (const server of new Map(catalog.map((item) => [item.serverId, item])).values()) { + if (!server.enabled || server.config.enabled === false) continue; + runtimeNameCounts.set(server.runtimeName, (runtimeNameCounts.get(server.runtimeName) ?? 0) + 1); + } + const credentialPresent = new Map(); + const probeConfigs = Object.create(null) as Record; + for (const server of descriptors) { + if (!isOAuthProbeCandidate(server)) continue; + if (runtimeNameCounts.get(server.runtimeName) !== 1) continue; + const config = requireRemoteMcpConfig(server.runtimeName, server.config); + credentialPresent.set( + server.serverId, + oauth.hasTokens(server.runtimeName, config.url), + ); + probeConfigs[server.runtimeName] = server.config; + } + let manager: McpConnectionManager | undefined; + try { + if (Object.keys(probeConfigs).length > 0) { + manager = new McpConnectionManager({ + oauthService: oauth, + defaultStartupTimeoutMs: resolveMcpStartupTimeoutMs(this.config.mcp?.startupTimeoutMs), + defaultToolTimeoutMs: resolveMcpToolTimeoutMs(this.config.mcp?.toolTimeoutMs), + }); + await manager.connectAll(probeConfigs); + } + const checkedAt = Date.now(); + return descriptors.map((server) => { + const configured = configuredMcpAuthState(server); + if (configured !== undefined) return { ...server, authStatus: configured }; + if (runtimeNameCounts.get(server.runtimeName) !== 1) { + return { + ...server, + authStatus: 'unavailable', + checkedAt, + error: `MCP runtime name "${server.runtimeName}" is not unique`, + }; + } + const entry = manager?.get(server.runtimeName); + if (entry?.status === 'connected') { + return { + ...server, + authStatus: credentialPresent.get(server.serverId) + ? 'oauth-authorized' + : 'not-applicable', + checkedAt, + }; + } + if (entry?.status === 'needs-auth') { + return { ...server, authStatus: 'oauth-required', checkedAt }; + } + return { + ...server, + authStatus: 'unavailable', + checkedAt, + error: entry?.error ?? `MCP server finished with status ${entry?.status ?? 'unknown'}`, + }; + }); + } finally { + await manager?.shutdown(); + } } prompt({ sessionId, ...payload }: SessionAgentPayload) { @@ -1461,32 +1648,118 @@ export class KimiCore implements PromisableMethods { } } -function requireRemoteMcpServer(server: GlobalMcpServerConfig): McpRemoteServerConfig { - const config = mcpConfigWithoutName(server); +function requireRemoteMcpConfig(name: string, config: McpServerConfig): McpRemoteServerConfig { if (config.transport !== 'stdio') return config; throw new KimiError( ErrorCodes.REQUEST_INVALID, - `MCP server "${server.name}" does not use a remote transport`, + `MCP server "${name}" does not use a remote transport`, ); } -function requireOAuthMcpServer(server: GlobalMcpServerConfig): McpRemoteServerConfig { - const config = requireRemoteMcpServer(server); +function requireOAuthMcpConfig(name: string, input: McpServerConfig): McpRemoteServerConfig { + const config = requireRemoteMcpConfig(name, input); if (config.bearerTokenEnvVar !== undefined) { throw new KimiError( ErrorCodes.REQUEST_INVALID, - `MCP server "${server.name}" uses a static bearer token`, + `MCP server "${name}" uses a static bearer token`, ); } if (config.headers !== undefined && config.auth !== 'oauth') { throw new KimiError( ErrorCodes.REQUEST_INVALID, - `MCP server "${server.name}" uses static headers and is not marked for OAuth`, + `MCP server "${name}" uses static headers and is not marked for OAuth`, ); } return config; } +function mcpServerId(locator: McpServerLocator): string { + if (locator.source === 'global') return `global:${encodeURIComponent(locator.name)}`; + return `plugin:${encodeURIComponent(locator.pluginId)}:${encodeURIComponent(locator.serverName)}`; +} + +function describeMcpServerLocator(locator: McpServerLocator): string { + if (locator.source === 'global') return locator.name; + return `${locator.pluginId}/${locator.serverName}`; +} + +function selectAppMcpServerDescriptors( + catalog: readonly AppMcpServerRuntimeDescriptor[], + targets?: readonly McpServerLocator[], +): readonly AppMcpServerRuntimeDescriptor[] { + if (targets === undefined) return catalog; + const byId = new Map(catalog.map((server) => [server.serverId, server])); + return targets.map((target) => { + const server = byId.get(mcpServerId(target)); + if (server !== undefined) return server; + throw new KimiError( + ErrorCodes.MCP_SERVER_NOT_FOUND, + `MCP server "${describeMcpServerLocator(target)}" was not found`, + ); + }); +} + +function configuredMcpAuthState( + server: AppMcpServerRuntimeDescriptor, +): GlobalMcpServerAuthState | undefined { + if (!server.enabled || server.config.enabled === false) return 'not-applicable'; + if (server.config.transport === 'stdio') return 'not-applicable'; + if (server.config.bearerTokenEnvVar !== undefined) return 'bearer-token'; + if (server.config.headers !== undefined && server.config.auth !== 'oauth') { + return 'not-applicable'; + } + return undefined; +} + +function legacyGlobalMcpAuthState( + server: AppMcpServerInspection, + credentialPresent: boolean, +): GlobalMcpServerAuthState { + if (server.authStatus !== 'unavailable') return server.authStatus; + if (credentialPresent) return 'oauth-authorized'; + return server.config.transport !== 'stdio' && server.config.auth === 'oauth' + ? 'oauth-required' + : 'not-applicable'; +} + +function legacyGlobalMcpAuthStateWithoutProbe( + server: GlobalMcpServerConfig, + credentialPresent: boolean, +): GlobalMcpServerAuthState | undefined { + if (server.enabled === false || server.transport === 'stdio') return 'not-applicable'; + if (server.bearerTokenEnvVar !== undefined) return 'bearer-token'; + if (server.headers !== undefined && server.auth !== 'oauth') return 'not-applicable'; + if (server.transport !== 'http' && server.auth !== 'oauth') return 'not-applicable'; + if (server.auth === 'oauth' && !credentialPresent) return 'oauth-required'; + return undefined; +} + +function isOAuthProbeCandidate(server: AppMcpServerRuntimeDescriptor): boolean { + return configuredMcpAuthState(server) === undefined; +} + +type AppMcpServerRuntimeDescriptor = Omit & { + readonly config: McpServerConfig; +}; + +type AppMcpServerRuntimeInspection = AppMcpServerRuntimeDescriptor & + Pick; + +function sanitizeAppMcpServerInspection( + server: AppMcpServerRuntimeInspection, +): AppMcpServerInspection { + return { ...server, config: sanitizeAppMcpServerConfig(server.config) }; +} + +function sanitizeAppMcpServerConfig(config: McpServerConfig): AppMcpServerConfig { + if (config.transport === 'stdio') { + const { env, ...safe } = config; + return env === undefined ? safe : { ...safe, envKeys: Object.keys(env).toSorted() }; + } + const { headers, ...safe } = config; + return headers === undefined ? safe : { ...safe, headerKeys: Object.keys(headers).toSorted() }; +} + function mcpConfigWithoutName(server: GlobalMcpServerConfig): McpServerConfig { const { name: _name, ...config } = server; return config; diff --git a/packages/agent-core/src/session/index.ts b/packages/agent-core/src/session/index.ts index 50762884f82..777206d246b 100644 --- a/packages/agent-core/src/session/index.ts +++ b/packages/agent-core/src/session/index.ts @@ -29,9 +29,12 @@ import { makeErrorPayload } from '../errors'; import { McpConnectionManager, McpOAuthService, + canonicalMcpOAuthResource, resolveMcpStartupTimeoutMs, resolveMcpToolTimeoutMs, type McpServerEntry, + type McpOAuthCredentialsChangedEvent, + type McpOAuthCredentialsCoordinator, type SessionMcpConfig, } from '../mcp'; import type { EnabledPluginSessionStart, EnabledPluginSystemPrompt, PluginCommandDef } from '../plugin'; @@ -89,6 +92,7 @@ export interface SessionOptions { readonly skills?: SessionSkillConfig; readonly agents?: SessionAgentCatalogConfig; readonly mcpConfig?: SessionMcpConfig; + readonly mcpOAuthCoordinator?: McpOAuthCredentialsCoordinator; readonly telemetry?: TelemetryClient | undefined; readonly pluginSessionStarts?: readonly EnabledPluginSessionStart[]; readonly pluginCommands?: readonly PluginCommandDef[]; @@ -218,6 +222,7 @@ export class Session { readonly mcp: McpConnectionManager; readonly log: Logger; private readonly logHandle: SessionLogHandle | undefined; + private readonly unsubscribeMcpOAuthCredentials: (() => void) | undefined; readonly hookEngine: HookEngine; readonly experimentalFlags: ExperimentalFlagResolver; readonly imageLimits: ImageLimits; @@ -288,7 +293,10 @@ export class Session { sessionId: options.id, }); this.mcp = new McpConnectionManager({ - oauthService: new McpOAuthService({ kimiHomeDir: options.kimiHomeDir }), + oauthService: new McpOAuthService({ + kimiHomeDir: options.kimiHomeDir, + coordinator: options.mcpOAuthCoordinator, + }), log: this.log, stdioCwd: options.kaos.getcwd(), defaultStartupTimeoutMs: resolveMcpStartupTimeoutMs(options.config?.mcp?.startupTimeoutMs), @@ -297,6 +305,16 @@ export class Session { this.mcp.onStatusChange((entry) => { this.onMcpServerStatusChange(entry); }); + this.unsubscribeMcpOAuthCredentials = options.mcpOAuthCoordinator?.onCredentialsChanged( + (event) => { + void this.reconnectMcpAfterCredentialsChanged(event).catch((error: unknown) => { + this.log.warn('mcp reconnect after credentials change failed', { + server: event.serverName, + error, + }); + }); + }, + ); this.agentCatalog = options.agents?.catalog ?? new SessionAgentProfileCatalog({ @@ -327,6 +345,33 @@ export class Session { }); } + async reconnectMcpAfterCredentialsChanged( + event: McpOAuthCredentialsChangedEvent, + ): Promise { + const entry = this.mcp.get(event.serverName); + if (entry === undefined) return; + const serverUrl = this.mcp.getRemoteServerUrl(event.serverName); + if (serverUrl === undefined || canonicalMcpOAuthResource(serverUrl) !== event.serverUrl) return; + this.mcp.oauthService?.forgetProvider(event.serverName, event.serverUrl); + if (entry.status === 'disabled') return; + if (entry.status === 'pending') { + await new Promise((resolve, reject) => { + const unsubscribe = this.mcp.onStatusChange((next) => { + if (next.name !== event.serverName || next.status === 'pending') return; + unsubscribe(); + if (next.status === 'disabled') { + resolve(); + return; + } + void this.mcp.reconnectAfterCurrent(event.serverName).then(resolve, reject); + }); + }); + return; + } + if (event.kind !== 'invalidated' && entry.status !== 'needs-auth') return; + await this.mcp.reconnectAndJoin(event.serverName); + } + setToolKaos(kaos: Kaos) { this.toolKaos = kaos; @@ -481,6 +526,7 @@ export class Session { } async close(): Promise { + this.unsubscribeMcpOAuthCredentials?.(); try { await Promise.allSettled( Array.from(this.readyAgents(), async (agent) => agent.cron?.stop()), @@ -499,6 +545,7 @@ export class Session { } async closeForReload(): Promise { + this.unsubscribeMcpOAuthCredentials?.(); try { await Promise.allSettled( Array.from(this.readyAgents(), async (agent) => agent.cron?.stop()), diff --git a/packages/agent-core/test/mcp/connection-manager.test.ts b/packages/agent-core/test/mcp/connection-manager.test.ts index dabd6660115..2c699a7348d 100644 --- a/packages/agent-core/test/mcp/connection-manager.test.ts +++ b/packages/agent-core/test/mcp/connection-manager.test.ts @@ -297,6 +297,55 @@ describe('McpConnectionManager', () => { } }); + it('reconnectAndJoin joins an in-flight reconnect instead of starting a second one', async () => { + const cm = new McpConnectionManager(); + const seen: Array<{ name: string; status: McpServerEntry['status'] }> = []; + cm.onStatusChange((entry) => { + seen.push({ name: entry.name, status: entry.status }); + }); + const delayedMockServer = `setTimeout(() => import(${JSON.stringify( + pathToFileURL(stdioFixture).href, + )}), 250)`; + + try { + await cm.connectAll({ + slow: { + transport: 'stdio', + command: process.execPath, + args: ['-e', delayedMockServer], + startupTimeoutMs: 5_000, + }, + }); + seen.length = 0; + + await Promise.all([cm.reconnectAndJoin('slow'), cm.reconnectAndJoin('slow')]); + + expect(cm.get('slow')?.status).toBe('connected'); + expect(seen.filter((event) => event.name === 'slow').map((event) => event.status)).toEqual([ + 'pending', + 'connected', + ]); + } finally { + await cm.shutdown(); + } + }, 20_000); + + it('reconnectAfterCurrent queues one reconnect after the in-flight attempt', async () => { + const cm = new McpConnectionManager(); + let finishCurrent!: () => void; + const current = new Promise((resolve) => { + finishCurrent = resolve; + }); + const reconnect = vi.spyOn(cm, 'reconnect').mockReturnValueOnce(current).mockResolvedValueOnce(); + + const first = cm.reconnectAndJoin('server'); + const trailing = cm.reconnectAfterCurrent('server'); + expect(reconnect).toHaveBeenCalledTimes(1); + finishCurrent(); + await Promise.all([first, trailing]); + expect(reconnect).toHaveBeenCalledTimes(2); + }); + it('shutdown clears entries and is idempotent', async () => { const cm = new McpConnectionManager(); await cm.connectAll({ alpha: stdioConfig() }); @@ -623,7 +672,7 @@ describe('McpConnectionManager', () => { grant_types: ['authorization_code', 'refresh_token'], response_types: ['code'], } satisfies OAuthClientInformationFull); - provider.saveTokens({ + await provider.saveTokens({ access_token: 'stale-access-token', refresh_token: 'stale-refresh-token', token_type: 'Bearer', @@ -883,7 +932,7 @@ describe('Session MCP startup', () => { throw new Error('Expected session MCP manager to own an OAuth service'); } const provider = oauthService.getProvider('gated', 'https://example.com/mcp'); - provider.saveTokens({ + await provider.saveTokens({ access_token: 'session-token', token_type: 'Bearer', } satisfies OAuthTokens); diff --git a/packages/agent-core/test/mcp/oauth-store.test.ts b/packages/agent-core/test/mcp/oauth-store.test.ts index def46df4dc5..f88a8eb1f09 100644 --- a/packages/agent-core/test/mcp/oauth-store.test.ts +++ b/packages/agent-core/test/mcp/oauth-store.test.ts @@ -5,7 +5,7 @@ import { join } from 'pathe'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import type { OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js'; -import { McpOAuthClientProvider, McpOAuthService } from '../../src/mcp/oauth'; +import { McpOAuthClientProvider, McpOAuthCoordinator, McpOAuthService } from '../../src/mcp/oauth'; import { JsonFileStore, sanitizeStoreKey } from '../../src/mcp/oauth/store'; describe('sanitizeStoreKey', () => { @@ -76,7 +76,7 @@ describe('MCP OAuth credential identity', () => { await rm(dir, { recursive: true, force: true }); }); - it('isolates tokens for the same server name on different URLs', () => { + it('isolates tokens for the same server name on different URLs', async () => { const store = new JsonFileStore(dir); const first = new McpOAuthClientProvider({ serverName: 'linear', @@ -89,15 +89,15 @@ describe('MCP OAuth credential identity', () => { store, }); - first.saveTokens(token('first-token')); - second.saveTokens(token('second-token')); + await first.saveTokens(token('first-token')); + await second.saveTokens(token('second-token')); expect(first.storeKey).not.toBe(second.storeKey); expect(first.tokens()?.access_token).toBe('first-token'); expect(second.tokens()?.access_token).toBe('second-token'); }); - it('isolates tokens when distinct server names sanitize to the same prefix', () => { + it('isolates tokens when distinct server names sanitize to the same prefix', async () => { const store = new JsonFileStore(dir); const first = new McpOAuthClientProvider({ serverName: 'team mcp', @@ -110,17 +110,17 @@ describe('MCP OAuth credential identity', () => { store, }); - first.saveTokens(token('space-token')); - second.saveTokens(token('bang-token')); + await first.saveTokens(token('space-token')); + await second.saveTokens(token('bang-token')); expect(first.storeKey).not.toBe(second.storeKey); expect(first.tokens()?.access_token).toBe('space-token'); expect(second.tokens()?.access_token).toBe('bang-token'); }); - it('scopes hasTokens to the server URL, not just the configured name', () => { + it('scopes hasTokens to the server URL, not just the configured name', async () => { const service = new McpOAuthService({ store: new JsonFileStore(dir) }); - service + await service .getProvider('linear', 'https://first.example.com/mcp') .saveTokens(token('first-token')); @@ -128,13 +128,13 @@ describe('MCP OAuth credential identity', () => { expect(service.hasTokens('linear', 'https://second.example.com/mcp')).toBe(false); }); - it('removes stored credentials when a server authorization is reset', () => { + it('removes stored credentials when a server authorization is reset', async () => { const service = new McpOAuthService({ store: new JsonFileStore(dir) }); - service + await service .getProvider('linear', 'https://mcp.example.com/mcp') .saveTokens(token('access-token')); - service.invalidate('linear', 'https://mcp.example.com/mcp'); + await service.invalidate('linear', 'https://mcp.example.com/mcp'); expect(service.hasTokens('linear', 'https://mcp.example.com/mcp')).toBe(false); }); @@ -158,6 +158,29 @@ describe('MCP OAuth credential identity', () => { }); }); +describe('McpOAuthCoordinator', () => { + it('broadcasts credential changes without owning OAuth flows', () => { + const coordinator = new McpOAuthCoordinator(); + const events: unknown[] = []; + coordinator.onCredentialsChanged((event) => events.push(event)); + + coordinator.notifyCredentialsChanged('notion', 'https://mcp.example.test/mcp#fragment'); + coordinator.notifyCredentialsInvalidated('notion', 'https://mcp.example.test/mcp'); + expect(events).toEqual([ + { + serverName: 'notion', + serverUrl: 'https://mcp.example.test/mcp', + kind: 'updated', + }, + { + serverName: 'notion', + serverUrl: 'https://mcp.example.test/mcp', + kind: 'invalidated', + }, + ]); + }); +}); + function token(accessToken: string): OAuthTokens { return { access_token: accessToken, @@ -183,28 +206,34 @@ describe('McpOAuthClientProvider.invalidateStaleRegistration', () => { }); } - it('drops a registration whose redirect_uris miss the current callback', () => { + it('drops a registration whose redirect_uris miss the current callback', async () => { const provider = makeProvider(); provider.saveClientInformation({ client_id: 'c1', redirect_uris: ['http://127.0.0.1:11111/callback'], }); - expect(provider.invalidateStaleRegistration('http://127.0.0.1:22222/callback')).toBe(true); + await expect( + provider.invalidateStaleRegistration('http://127.0.0.1:22222/callback'), + ).resolves.toBe(true); expect(provider.clientInformation()).toBeUndefined(); }); - it('keeps a registration that still covers the callback URI', () => { + it('keeps a registration that still covers the callback URI', async () => { const provider = makeProvider(); provider.saveClientInformation({ client_id: 'c1', redirect_uris: ['http://127.0.0.1:11111/callback'], }); - expect(provider.invalidateStaleRegistration('http://127.0.0.1:11111/callback')).toBe(false); + await expect( + provider.invalidateStaleRegistration('http://127.0.0.1:11111/callback'), + ).resolves.toBe(false); expect(provider.clientInformation()).toMatchObject({ client_id: 'c1' }); }); - it('is a no-op without a stored registration', () => { + it('is a no-op without a stored registration', async () => { const provider = makeProvider(); - expect(provider.invalidateStaleRegistration('http://127.0.0.1:11111/callback')).toBe(false); + await expect( + provider.invalidateStaleRegistration('http://127.0.0.1:11111/callback'), + ).resolves.toBe(false); }); }); diff --git a/packages/agent-core/test/plugin/manager.test.ts b/packages/agent-core/test/plugin/manager.test.ts index 517747cc2aa..958e88808df 100644 --- a/packages/agent-core/test/plugin/manager.test.ts +++ b/packages/agent-core/test/plugin/manager.test.ts @@ -473,6 +473,15 @@ describe('PluginManager', () => { await manager.setMcpServerEnabled('demo', 'finance', false); expect(manager.enabledMcpServers()).not.toHaveProperty('plugin-demo:finance'); + expect(manager.mcpServers()).toContainEqual( + expect.objectContaining({ + pluginId: 'demo', + serverName: 'finance', + runtimeName: 'plugin-demo:finance', + enabled: false, + config: expect.objectContaining({ command: 'finance-mcp' }), + }), + ); expect(manager.summaries()[0]).toEqual( expect.objectContaining({ mcpServerCount: 3, @@ -577,6 +586,14 @@ describe('PluginManager', () => { await manager.setEnabled('demo', false); expect(manager.enabledMcpServers()).toEqual({}); + expect(manager.mcpServers()).toContainEqual( + expect.objectContaining({ + pluginId: 'demo', + serverName: 'finance', + runtimeName: 'plugin-demo:finance', + enabled: false, + }), + ); }); it('setMcpServerEnabled() rejects unknown MCP servers', async () => { diff --git a/packages/agent-core/test/rpc/plugins-rpc.test.ts b/packages/agent-core/test/rpc/plugins-rpc.test.ts index fa7f9fd8434..896d4c17d9e 100644 --- a/packages/agent-core/test/rpc/plugins-rpc.test.ts +++ b/packages/agent-core/test/rpc/plugins-rpc.test.ts @@ -4,6 +4,7 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; +import { McpOAuthService } from '../../src/mcp/oauth/service'; import { KimiCore } from '../../src/rpc/core-impl'; describe('KimiCore plugin RPCs', () => { @@ -83,6 +84,103 @@ describe('KimiCore plugin RPCs', () => { ); }); + it('inspects global and plugin MCP servers through the v1 app catalog', async () => { + const home = await mkdtemp(path.join(tmpdir(), 'kimi-home-')); + const pluginRoot = await mkdtemp(path.join(tmpdir(), 'plugin-')); + await writeFile( + path.join(home, 'mcp.json'), + JSON.stringify({ + mcpServers: { + global: { command: 'global-mcp', env: { GLOBAL_SECRET: 'global-secret-value' } }, + }, + }), + 'utf8', + ); + await writeFile( + path.join(pluginRoot, 'kimi.plugin.json'), + JSON.stringify({ + name: 'demo', + mcpServers: { + local: { command: 'local-mcp', env: { PLUGIN_SECRET: 'plugin-secret-value' } }, + remote: { + transport: 'http', + url: 'https://mcp.example.test/service', + auth: 'oauth', + }, + }, + }), + 'utf8', + ); + + const core = new KimiCore(async () => ({}) as never, { homeDir: home }); + await core.installPlugin({ source: pluginRoot }); + await core.setPluginMcpServerEnabled({ id: 'demo', server: 'remote', enabled: false }); + + const inspections = await core.inspectAppMcpServers({}); + expect(inspections).toEqual([ + expect.objectContaining({ + serverId: 'global:global', + locator: { source: 'global', name: 'global' }, + runtimeName: 'global', + origin: 'global', + editable: true, + authStatus: 'not-applicable', + config: expect.objectContaining({ envKeys: ['GLOBAL_SECRET'] }), + }), + expect.objectContaining({ + serverId: 'plugin:demo:local', + locator: { source: 'plugin', pluginId: 'demo', serverName: 'local' }, + runtimeName: 'plugin-demo:local', + origin: 'plugin', + editable: false, + enabled: true, + authStatus: 'not-applicable', + config: expect.objectContaining({ envKeys: expect.arrayContaining(['PLUGIN_SECRET']) }), + }), + expect.objectContaining({ + serverId: 'plugin:demo:remote', + locator: { source: 'plugin', pluginId: 'demo', serverName: 'remote' }, + runtimeName: 'plugin-demo:remote', + origin: 'plugin', + editable: false, + enabled: false, + authStatus: 'not-applicable', + }), + ]); + expect(JSON.stringify(inspections)).not.toContain('global-secret-value'); + expect(JSON.stringify(inspections)).not.toContain('plugin-secret-value'); + + const oauth = new McpOAuthService({ kimiHomeDir: home }); + await oauth + .getProvider('plugin-demo:remote', 'https://mcp.example.test/service') + .saveTokens({ access_token: 'plugin-test-token', token_type: 'Bearer' }); + await core.resetMcpServerAuth({ + locator: { source: 'plugin', pluginId: 'demo', serverName: 'remote' }, + }); + expect(oauth.hasTokens('plugin-demo:remote', 'https://mcp.example.test/service')).toBe(false); + + await oauth + .getProvider('plugin-demo:remote', 'https://mcp.example.test/service') + .saveTokens({ access_token: 'plugin-test-token', token_type: 'Bearer' }); + await core.setPluginMcpServerEnabled({ id: 'demo', server: 'remote', enabled: true }); + await core.addGlobalMcpServer({ + server: { + name: 'plugin-demo:remote', + transport: 'http', + url: 'https://global.example.test/service', + auth: 'oauth', + }, + }); + const locator = { source: 'plugin', pluginId: 'demo', serverName: 'remote' } as const; + await expect(core.beginMcpServerAuth({ locator })).rejects.toThrow( + 'is shared by multiple enabled servers', + ); + await expect(core.resetMcpServerAuth({ locator })).rejects.toThrow( + 'is shared by multiple enabled servers', + ); + expect(oauth.hasTokens('plugin-demo:remote', 'https://mcp.example.test/service')).toBe(true); + }); + it('injects persisted managed Kimi Code environment into the datasource plugin MCP server', async () => { const previousBaseUrl = process.env['KIMI_CODE_BASE_URL']; const previousCodeOAuthHost = process.env['KIMI_CODE_OAUTH_HOST']; diff --git a/packages/agent-core/test/session/init.test.ts b/packages/agent-core/test/session/init.test.ts index b0a66e6e105..a3106e8df8a 100644 --- a/packages/agent-core/test/session/init.test.ts +++ b/packages/agent-core/test/session/init.test.ts @@ -11,6 +11,7 @@ import type { Agent, AgentOptions } from '../../src/agent'; import { trimTrailingOpenToolExchange } from '../../src/agent/context/projector'; import type { KimiConfig } from '../../src/config'; import { FlagResolver } from '../../src/flags'; +import { McpOAuthCoordinator } from '../../src/mcp'; import { ProviderManager } from '../../src/session/provider-manager'; import type { ResolvedAgentProfile } from '../../src/profile'; import type { SDKSessionRPC } from '../../src/rpc'; @@ -41,6 +42,28 @@ afterEach(async () => { }); describe('Session.init', () => { + it('subscribes to MCP credential changes before app-level registration', async () => { + const coordinator = new McpOAuthCoordinator(); + const session = new Session({ + id: 'test-mcp-credentials-during-init', + kaos: testKaos.withCwd(await makeTempDir()), + homedir: await makeTempDir(), + rpc: createSessionRpc([]), + providerManager: testProviderManager(), + mcpOAuthCoordinator: coordinator, + }); + const reconnect = vi + .spyOn(session, 'reconnectMcpAfterCredentialsChanged') + .mockResolvedValue(); + + coordinator.notifyCredentialsChanged('remote', 'https://mcp.example.test/service'); + expect(reconnect).toHaveBeenCalledOnce(); + + await session.close(); + coordinator.notifyCredentialsChanged('remote', 'https://mcp.example.test/service'); + expect(reconnect).toHaveBeenCalledOnce(); + }); + it('runs an isolated system-trigger turn and records the latest AGENTS as a system reminder', async () => { const workDir = await makeTempDir(); const sessionDir = await makeTempDir(); diff --git a/packages/node-sdk/test/mcp-auth-status-server.ts b/packages/node-sdk/test/mcp-auth-status-server.ts index 7f24c3945d4..2aa6369ed56 100644 --- a/packages/node-sdk/test/mcp-auth-status-server.ts +++ b/packages/node-sdk/test/mcp-auth-status-server.ts @@ -1,29 +1,43 @@ -import { createServer } from 'node:http'; +import { + createServer, + type IncomingMessage, + type ServerResponse, +} from 'node:http'; import type { AddressInfo } from 'node:net'; export interface McpAuthStatusServer { + readonly authToken: string; readonly plainUrl: string; readonly oauthUrl: string; + readonly unavailableUrl: string; + requestCount(pathname: string): number; close(): Promise; } export async function startMcpAuthStatusServer(): Promise { + const authToken = 'valid-test-access-token'; + let baseUrl = ''; + const requestCounts = new Map(); const server = createServer((request, response) => { - if (request.url === '/oauth') { - response.writeHead(401).end('Unauthorized'); - return; - } - response.writeHead(404).end('Not found'); + const pathname = new URL(request.url ?? '/', baseUrl).pathname; + requestCounts.set(pathname, (requestCounts.get(pathname) ?? 0) + 1); + void handleRequest(request, response, baseUrl, authToken).catch((error: unknown) => { + if (!response.headersSent) response.writeHead(500); + response.end(String(error)); + }); }); await new Promise((resolve, reject) => { server.once('error', reject); server.listen(0, '127.0.0.1', resolve); }); const { port } = server.address() as AddressInfo; - const baseUrl = `http://127.0.0.1:${port}`; + baseUrl = `http://127.0.0.1:${port}`; return { + authToken, plainUrl: `${baseUrl}/plain`, oauthUrl: `${baseUrl}/oauth`, + unavailableUrl: `${baseUrl}/unavailable`, + requestCount: (pathname) => requestCounts.get(pathname) ?? 0, close: () => new Promise((resolve, reject) => { server.close((error) => { @@ -33,3 +47,92 @@ export async function startMcpAuthStatusServer(): Promise { }), }; } + +async function handleRequest( + request: IncomingMessage, + response: ServerResponse, + baseUrl: string, + authToken: string, +): Promise { + const url = new URL(request.url ?? '/', baseUrl); + if (url.pathname === '/unavailable') { + response.writeHead(503).end('Temporarily unavailable'); + return; + } + if (url.pathname === '/.well-known/oauth-protected-resource') { + sendJson(response, { + resource: `${baseUrl}/oauth`, + authorization_servers: [baseUrl], + }); + return; + } + if ( + url.pathname === '/.well-known/oauth-authorization-server' || + url.pathname === '/.well-known/openid-configuration' + ) { + sendJson(response, { + issuer: baseUrl, + authorization_endpoint: `${baseUrl}/authorize`, + token_endpoint: `${baseUrl}/token`, + registration_endpoint: `${baseUrl}/register`, + response_types_supported: ['code'], + grant_types_supported: ['authorization_code', 'refresh_token'], + code_challenge_methods_supported: ['S256'], + token_endpoint_auth_methods_supported: ['none'], + }); + return; + } + if (url.pathname === '/register' && request.method === 'POST') { + const metadata = await readJson(request); + sendJson(response, { client_id: 'test-client', ...metadata }, 201); + return; + } + if (url.pathname === '/oauth' && request.headers.authorization !== `Bearer ${authToken}`) { + response.writeHead(401, { + 'content-type': 'application/json', + 'www-authenticate': `Bearer resource_metadata="${baseUrl}/.well-known/oauth-protected-resource"`, + }); + response.end(JSON.stringify({ error: 'unauthorized' })); + return; + } + if (request.method !== 'POST') { + response.writeHead(405).end('Method not allowed'); + return; + } + const message = (await readJson(request)) as { + readonly id?: string | number; + readonly method?: string; + }; + if (message.id === undefined) { + response.writeHead(202).end(); + return; + } + const result = + message.method === 'initialize' + ? { + protocolVersion: '2025-03-26', + capabilities: { tools: {} }, + serverInfo: { name: 'auth-status', version: '0.0.1' }, + } + : message.method === 'tools/list' + ? { tools: [] } + : {}; + sendJson(response, { jsonrpc: '2.0', id: message.id, result }); +} + +async function readJson(request: AsyncIterable): Promise> { + const chunks: Buffer[] = []; + for await (const chunk of request) { + chunks.push(typeof chunk === 'string' ? Buffer.from(chunk) : Buffer.from(chunk as Uint8Array)); + } + return JSON.parse(Buffer.concat(chunks).toString('utf8')) as Record; +} + +function sendJson( + response: ServerResponse, + body: unknown, + status = 200, +): void { + response.writeHead(status, { 'content-type': 'application/json' }); + response.end(JSON.stringify(body)); +} diff --git a/packages/node-sdk/test/mcp-config.test.ts b/packages/node-sdk/test/mcp-config.test.ts index 0294cc60309..99b4a9e01bb 100644 --- a/packages/node-sdk/test/mcp-config.test.ts +++ b/packages/node-sdk/test/mcp-config.test.ts @@ -44,6 +44,17 @@ async function writeMcpConfig(homeDir: string, value: unknown): Promise { await writeFile(join(homeDir, 'mcp.json'), JSON.stringify(value), 'utf-8'); } +function definePrototypeNamedMcpServer( + servers: Record, + url: string, +): Record { + Object.defineProperty(servers, '__proto__', { + value: { transport: 'http', url }, + enumerable: true, + }); + return servers; +} + async function readMcpConfig(homeDir: string): Promise> { return JSON.parse(await readFile(join(homeDir, 'mcp.json'), 'utf-8')) as Record< string, @@ -215,23 +226,30 @@ describe('standalone MCP check (connection result)', () => { }); describe('MCP OAuth facade (host-controlled browser flow)', () => { - it('reports persisted authorization without starting an OAuth flow', async () => { + it('reports authorization from real connections while preserving legacy status values', async () => { const homeDir = await makeTempDir(); const statusServer = await startMcpAuthStatusServer(); - const authorizedUrl = 'https://authorized.example.test/mcp'; const externalOAuth = new McpOAuthService({ kimiHomeDir: homeDir }); - externalOAuth - .getProvider('oauth-authorized', authorizedUrl) - .saveTokens({ access_token: 'test-access-token', token_type: 'Bearer' }); - externalOAuth - .getProvider('sse', statusServer.oauthUrl) + await externalOAuth + .getProvider('oauth-authorized', statusServer.oauthUrl) + .saveTokens({ access_token: statusServer.authToken, token_type: 'Bearer' }); + await externalOAuth + .getProvider('oauth-stale', statusServer.oauthUrl) + .saveTokens({ access_token: 'stale-test-access-token', token_type: 'Bearer' }); + await externalOAuth + .getProvider('sse', statusServer.unavailableUrl) .saveTokens({ access_token: 'stale-sse-token', token_type: 'Bearer' }); await writeMcpConfig(homeDir, { - mcpServers: { + mcpServers: definePrototypeNamedMcpServer({ stdio: { command: 'local-command' }, plain: { transport: 'http', url: statusServer.plainUrl }, detected: { transport: 'http', url: statusServer.oauthUrl }, - sse: { transport: 'sse', url: statusServer.oauthUrl }, + sse: { transport: 'sse', url: statusServer.unavailableUrl }, + 'sse-bearer': { + transport: 'sse', + url: statusServer.unavailableUrl, + bearerTokenEnvVar: 'EXAMPLE_SSE_TOKEN', + }, 'sse-oauth': { transport: 'sse', url: statusServer.oauthUrl, auth: 'oauth' }, bearer: { transport: 'http', @@ -240,15 +258,20 @@ describe('MCP OAuth facade (host-controlled browser flow)', () => { }, 'oauth-required': { transport: 'http', - url: 'https://required.example.test/mcp', + url: statusServer.unavailableUrl, auth: 'oauth', }, 'oauth-authorized': { transport: 'http', - url: authorizedUrl, + url: statusServer.oauthUrl, auth: 'oauth', }, - }, + 'oauth-stale': { + transport: 'http', + url: statusServer.oauthUrl, + auth: 'oauth', + }, + }, statusServer.oauthUrl), }); const harness = createKimiHarness({ homeDir }); @@ -258,11 +281,15 @@ describe('MCP OAuth facade (host-controlled browser flow)', () => { { name: 'plain', authStatus: 'not-applicable' }, { name: 'detected', authStatus: 'oauth-required' }, { name: 'sse', authStatus: 'not-applicable' }, + { name: 'sse-bearer', authStatus: 'bearer-token' }, { name: 'sse-oauth', authStatus: 'oauth-required' }, { name: 'bearer', authStatus: 'bearer-token' }, { name: 'oauth-required', authStatus: 'oauth-required' }, { name: 'oauth-authorized', authStatus: 'oauth-authorized' }, + { name: 'oauth-stale', authStatus: 'oauth-required' }, + { name: '__proto__', authStatus: 'oauth-required' }, ]); + expect(statusServer.requestCount('/unavailable')).toBe(0); } finally { await harness.close(); await statusServer.close(); diff --git a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts index 95e004e32d3..00fe40956fd 100644 --- a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts +++ b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts @@ -92,10 +92,10 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { const authorizedUrl = 'https://authorized.example.test/mcp'; const requiredUrl = 'https://required.example.test/mcp'; const externalOAuth = new McpOAuthService({ kimiHomeDir: homeDir }); - externalOAuth + await externalOAuth .getProvider('oauth-authorized', authorizedUrl) .saveTokens({ access_token: 'test-access-token', token_type: 'Bearer' }); - externalOAuth + await externalOAuth .getProvider('sse', statusServer.oauthUrl) .saveTokens({ access_token: 'stale-sse-token', token_type: 'Bearer' }); await writeFile( @@ -140,10 +140,10 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { { name: 'oauth-authorized', authStatus: 'oauth-authorized' }, ]); - externalOAuth + await externalOAuth .getProvider('oauth-required', requiredUrl) .saveTokens({ access_token: 'new-test-access-token', token_type: 'Bearer' }); - externalOAuth.invalidate('oauth-authorized', authorizedUrl, 'tokens'); + await externalOAuth.invalidate('oauth-authorized', authorizedUrl, 'tokens'); await expect(harness.listMcpServerAuthStatuses()).resolves.toEqual([ { name: 'stdio', authStatus: 'not-applicable' }, diff --git a/packages/node-sdk/test/v1-v2-parity.test.ts b/packages/node-sdk/test/v1-v2-parity.test.ts index 26f8dfa1248..24735ac17eb 100644 --- a/packages/node-sdk/test/v1-v2-parity.test.ts +++ b/packages/node-sdk/test/v1-v2-parity.test.ts @@ -3575,10 +3575,10 @@ describe('v1↔v2 global MCP parity', () => { }); for (const homeDir of [pair.v1HomeDir, pair.v2HomeDir]) { const externalOAuth = new McpOAuthService({ kimiHomeDir: homeDir }); - externalOAuth + await externalOAuth .getProvider('oauth-authorized', authorizedUrl) .saveTokens({ access_token: 'test-access-token', token_type: 'Bearer' }); - externalOAuth + await externalOAuth .getProvider('sse', statusServer.oauthUrl) .saveTokens({ access_token: 'stale-sse-token', token_type: 'Bearer' }); } diff --git a/packages/oauth/src/index.ts b/packages/oauth/src/index.ts index 9ad275b9f23..bcf502ecc73 100644 --- a/packages/oauth/src/index.ts +++ b/packages/oauth/src/index.ts @@ -190,3 +190,6 @@ export type { RefreshProviderScope, RefreshResult, } from './refreshProviderModels'; + +export type { OAuthTokenTransactionOptions } from './oauth-token-transaction'; +export { OAuthTokenTransaction } from './oauth-token-transaction'; diff --git a/packages/oauth/src/oauth-token-transaction.ts b/packages/oauth/src/oauth-token-transaction.ts new file mode 100644 index 00000000000..5062f4ec426 --- /dev/null +++ b/packages/oauth/src/oauth-token-transaction.ts @@ -0,0 +1,251 @@ +import { isDeepStrictEqual } from 'node:util'; + +const REQUEST_TIMEOUT_MS = 30_000; + +type GrantType = 'refresh_token' | 'authorization_code'; +type Effect = + | { readonly kind: 'save'; readonly tokens: T } + | { + readonly kind: 'invalidate'; + readonly grantType: GrantType; + readonly error: string; + readonly tokensAtFailure: T | undefined; + readonly alreadyRemoved: boolean; + readonly preserveCurrent: boolean; + }; + +export interface OAuthTokenTransactionOptions { + readonly key: string; + readonly read: () => Promise; + readonly write: (tokens: T) => Promise; + readonly remove: () => Promise; + readonly parse: (value: unknown) => T | undefined; + readonly adopt?: (tokens: T | undefined) => void; +} + +/** + * Serializes OAuth token grants for one credential identity in this process. + * + * The SDK performs its token-endpoint fetch before calling `saveTokens` or + * `invalidateCredentials`. This transaction joins those two phases so a late + * SDK callback cannot overwrite or delete a newer durable winner. + */ +export class OAuthTokenTransaction { + private readonly effects: Effect[] = []; + + constructor(private readonly options: OAuthTokenTransactionOptions) {} + + createFetch(fetchFn: typeof fetch = globalThis.fetch): typeof fetch { + return (async (input, init) => { + const params = init?.body instanceof URLSearchParams ? init.body : undefined; + const grantType = params?.get('grant_type'); + if ( + params === undefined || + (grantType !== 'refresh_token' && grantType !== 'authorization_code') + ) { + return fetchFn(input, init); + } + return transactionLock.runExclusive(this.options.key, () => + this.runTokenRequest(fetchFn, input, init, params, grantType), + ); + }) as typeof fetch; + } + + async save(tokens: T): Promise { + await transactionLock.runExclusive(this.options.key, async () => { + if (this.consumeSave(tokens)) { + this.adopt(await this.options.read()); + return; + } + await this.options.write(tokens); + this.adopt(tokens); + }); + } + + async invalidateFromSdk(scope: 'tokens' | 'all'): Promise { + return transactionLock.runExclusive(this.options.key, async () => { + const effect = this.takeInvalidate(scope); + if (effect === undefined) return false; + const current = await this.options.read(); + if (effect.preserveCurrent) { + this.adopt(current); + return false; + } + if (effect.grantType === 'authorization_code' && effect.error === 'invalid_grant') { + this.adopt(current); + return false; + } + if (effect.alreadyRemoved) return current === undefined; + if (!isDeepStrictEqual(current, effect.tokensAtFailure)) { + this.adopt(current); + return false; + } + await this.options.remove(); + this.adopt(undefined); + return true; + }); + } + + async clear(): Promise { + await transactionLock.runExclusive(this.options.key, async () => { + await this.options.remove(); + this.adopt(undefined); + }); + } + + private async runTokenRequest( + fetchFn: typeof fetch, + input: Parameters[0], + init: Parameters[1] | undefined, + params: URLSearchParams, + grantType: GrantType, + ): Promise { + const requestedRefreshToken = + grantType === 'refresh_token' ? (params.get('refresh_token') ?? undefined) : undefined; + if (grantType === 'refresh_token') { + const winner = await this.resolveRefreshWinner(requestedRefreshToken); + if (winner !== undefined) return winner; + } + + const response = await fetchFn(input, { + ...init, + signal: + init?.signal === undefined || init.signal === null + ? AbortSignal.timeout(REQUEST_TIMEOUT_MS) + : AbortSignal.any([init.signal, AbortSignal.timeout(REQUEST_TIMEOUT_MS)]), + }); + if (grantType === 'refresh_token') { + const winner = await this.resolveRefreshWinner(requestedRefreshToken); + if (winner !== undefined) return winner; + } + if (!response.ok) { + const error = await oauthErrorCode(response); + if ( + error === 'invalid_grant' || + error === 'invalid_client' || + error === 'unauthorized_client' + ) { + const current = await this.options.read(); + const alreadyRemoved = + grantType === 'refresh_token' && + error === 'invalid_grant' && + refreshToken(current) === requestedRefreshToken; + if (alreadyRemoved) { + await this.options.remove(); + this.adopt(undefined); + } + this.remember({ + kind: 'invalidate', + grantType, + error, + tokensAtFailure: current, + alreadyRemoved, + preserveCurrent: false, + }); + } + return response; + } + + const payload: unknown = await response.clone().json().catch(() => undefined); + const parsed = this.options.parse(payload); + if (parsed === undefined) return response; + const tokens = + grantType === 'refresh_token' && refreshToken(parsed) === undefined + ? (this.options.parse({ ...parsed, refresh_token: requestedRefreshToken }) ?? parsed) + : parsed; + await this.options.write(tokens); + this.adopt(tokens); + this.remember({ kind: 'save', tokens }); + return response; + } + + private async resolveRefreshWinner(requested: string | undefined): Promise { + const current = await this.options.read(); + this.adopt(current); + const currentRefreshToken = refreshToken(current); + if (currentRefreshToken === requested) return undefined; + if (current === undefined || currentRefreshToken === undefined) { + this.remember({ + kind: 'invalidate', + grantType: 'refresh_token', + error: 'invalid_grant', + tokensAtFailure: current, + alreadyRemoved: current === undefined, + preserveCurrent: current !== undefined, + }); + return jsonResponse({ error: 'invalid_grant' }, 400); + } + this.remember({ kind: 'save', tokens: current }); + return jsonResponse(current); + } + + private adopt(tokens: T | undefined): void { + this.options.adopt?.(tokens); + } + + private remember(effect: Effect): void { + this.effects.push(effect); + } + + private consumeSave(tokens: T): boolean { + const index = this.effects.findIndex( + (effect) => effect.kind === 'save' && isDeepStrictEqual(effect.tokens, tokens), + ); + if (index === -1) return false; + this.effects.splice(index, 1); + return true; + } + + private takeInvalidate(scope: 'tokens' | 'all'): Extract, { kind: 'invalidate' }> | undefined { + const index = this.effects.findIndex( + (effect) => + effect.kind === 'invalidate' && + (scope === 'tokens' + ? effect.error === 'invalid_grant' + : effect.error === 'invalid_client' || effect.error === 'unauthorized_client'), + ); + if (index === -1) return undefined; + return this.effects.splice(index, 1)[0] as Extract, { kind: 'invalidate' }>; + } +} + +function refreshToken(tokens: object | undefined): string | undefined { + if (tokens === undefined || !('refresh_token' in tokens)) return undefined; + return typeof tokens.refresh_token === 'string' ? tokens.refresh_token : undefined; +} + +async function oauthErrorCode(response: Response): Promise { + const payload: unknown = await response.clone().json().catch(() => undefined); + if (typeof payload !== 'object' || payload === null || !('error' in payload)) return undefined; + return typeof payload.error === 'string' ? payload.error : undefined; +} + +function jsonResponse(payload: unknown, status = 200): Response { + return new Response(JSON.stringify(payload), { + status, + headers: { 'content-type': 'application/json' }, + }); +} + +class TransactionLock { + private readonly tails = new Map>(); + + async runExclusive(key: string, operation: () => Promise): Promise { + const previous = this.tails.get(key) ?? Promise.resolve(); + let release!: () => void; + const current = new Promise((resolve) => { + release = resolve; + }); + const tail = previous.then(() => current); + this.tails.set(key, tail); + await previous; + try { + return await operation(); + } finally { + release(); + if (this.tails.get(key) === tail) this.tails.delete(key); + } + } +} + +const transactionLock = new TransactionLock(); diff --git a/packages/oauth/test/oauth-token-transaction.test.ts b/packages/oauth/test/oauth-token-transaction.test.ts new file mode 100644 index 00000000000..4adbc7bbb79 --- /dev/null +++ b/packages/oauth/test/oauth-token-transaction.test.ts @@ -0,0 +1,173 @@ +import { describe, expect, it, vi } from 'vitest'; + +import { OAuthTokenTransaction } from '../src/oauth-token-transaction'; + +interface TestTokens { + access_token: string; + refresh_token?: string; +} + +describe('OAuthTokenTransaction', () => { + it('coalesces concurrent rotating refresh-token grants', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const first = transaction('same-server', () => stored, (value) => (stored = value)); + const second = transaction('same-server', () => stored, (value) => (stored = value)); + const tokenEndpoint = vi.fn(async () => + json(tokens('access-1', 'refresh-1')), + ); + + const [firstResult, secondResult] = await Promise.all([ + sdkRefresh(first, tokenEndpoint, 'refresh-0'), + sdkRefresh(second, tokenEndpoint, 'refresh-0'), + ]); + + expect(tokenEndpoint).toHaveBeenCalledTimes(1); + expect(firstResult).toEqual(tokens('access-1', 'refresh-1')); + expect(secondResult).toEqual(tokens('access-1', 'refresh-1')); + expect(stored).toEqual(tokens('access-1', 'refresh-1')); + }); + + it('does not let a late invalidation delete a newer winner', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const rejected = transaction('same-server', () => stored, (value) => (stored = value)); + const peer = transaction('same-server', () => stored, (value) => (stored = value)); + const response = await rejected.createFetch(async () => + json({ error: 'invalid_grant' }, 400), + )('https://issuer.example.test/token', refreshRequest('refresh-0')); + + expect(response.status).toBe(400); + await peer.save(tokens('access-1', 'refresh-1')); + await rejected.invalidateFromSdk('tokens'); + expect(stored).toEqual(tokens('access-1', 'refresh-1')); + }); + + it('preserves an access-only winner when an older refresh is queued', async () => { + let stored: TestTokens | undefined = { access_token: 'access-from-login' }; + const stale = transaction('same-server', () => stored, (value) => (stored = value)); + const tokenEndpoint = vi.fn(); + + const response = await stale.createFetch(tokenEndpoint)( + 'https://issuer.example.test/token', + refreshRequest('stale-refresh'), + ); + + expect(response.status).toBe(400); + expect(tokenEndpoint).not.toHaveBeenCalled(); + await stale.invalidateFromSdk('tokens'); + expect(stored).toEqual({ access_token: 'access-from-login' }); + }); + + it('does not let a late save revive credentials after an explicit reset', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const subject = transaction('same-server', () => stored, (value) => (stored = value)); + const response = await subject.createFetch(async () => + json(tokens('access-1', 'refresh-1')), + )('https://issuer.example.test/token', refreshRequest('refresh-0')); + const refreshed = parseTokens(await response.json()); + if (refreshed === undefined) throw new Error('invalid test token response'); + + await subject.clear(); + await subject.save(refreshed); + expect(stored).toBeUndefined(); + }); + + it('does not delete durable tokens for an invalid authorization code', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const subject = transaction('same-server', () => stored, (value) => (stored = value)); + const response = await subject.createFetch(async () => + json({ error: 'invalid_grant' }, 400), + )('https://issuer.example.test/token', { + method: 'POST', + body: new URLSearchParams({ grant_type: 'authorization_code', code: 'expired-code' }), + }); + + expect(response.status).toBe(400); + await subject.invalidateFromSdk('tokens'); + expect(stored).toEqual(tokens('access-0', 'refresh-0')); + }); + + it('does not let a stale client error delete a newer authorization', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const rejected = transaction('same-server', () => stored, (value) => (stored = value)); + const peer = transaction('same-server', () => stored, (value) => (stored = value)); + await rejected.createFetch(async () => json({ error: 'invalid_client' }, 400))( + 'https://issuer.example.test/token', + { + method: 'POST', + body: new URLSearchParams({ grant_type: 'authorization_code', code: 'old-code' }), + }, + ); + + await peer.save(tokens('access-1', 'refresh-1')); + await expect(rejected.invalidateFromSdk('all')).resolves.toBe(false); + expect(stored).toEqual(tokens('access-1', 'refresh-1')); + }); + + it('ignores an SDK invalidation without a matching token request', async () => { + let stored: TestTokens | undefined = tokens('access-0', 'refresh-0'); + const subject = transaction('same-server', () => stored, (value) => (stored = value)); + + await expect(subject.invalidateFromSdk('tokens')).resolves.toBe(false); + expect(stored).toEqual(tokens('access-0', 'refresh-0')); + }); +}); + +function transaction( + key: string, + read: () => TestTokens | undefined, + write: (tokens: TestTokens | undefined) => void, +): OAuthTokenTransaction { + return new OAuthTokenTransaction({ + key, + read: async () => read(), + write: async (value) => { + write(value); + }, + remove: async () => { + write(undefined); + }, + parse: parseTokens, + }); +} + +async function sdkRefresh( + transaction: OAuthTokenTransaction, + fetchFn: typeof fetch, + refreshToken: string, +): Promise { + const response = await transaction.createFetch(fetchFn)( + 'https://issuer.example.test/token', + refreshRequest(refreshToken), + ); + const payload = parseTokens(await response.json()); + if (payload === undefined) throw new Error('invalid test token response'); + const result = { refresh_token: refreshToken, ...payload }; + await transaction.save(result); + return result; +} + +function refreshRequest(refreshToken: string): RequestInit { + return { + method: 'POST', + body: new URLSearchParams({ grant_type: 'refresh_token', refresh_token: refreshToken }), + }; +} + +function tokens(accessToken: string, refreshToken: string): TestTokens { + return { access_token: accessToken, refresh_token: refreshToken }; +} + +function parseTokens(value: unknown): TestTokens | undefined { + if (typeof value !== 'object' || value === null || !('access_token' in value)) return undefined; + if (typeof value.access_token !== 'string') return undefined; + const refreshToken = 'refresh_token' in value ? value.refresh_token : undefined; + if (refreshToken !== undefined && typeof refreshToken !== 'string') return undefined; + return { access_token: value.access_token, refresh_token: refreshToken }; +} + +function json(value: unknown, status = 200): Response { + return new Response(JSON.stringify(value), { + status, + headers: { 'content-type': 'application/json' }, + }); +} From c9bfe8b2c8314ba4ef8806fb3b92ac654c1d1860 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 12:29:03 +0800 Subject: [PATCH 32/50] feat: replace the secondary-model experiment with a declarative subagent model pool (#2700) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: replace secondary-model experiment with [subagent.models] pool Add a declarative subagent model pool to agent-core-v2: [subagent.models] maps [models] entry ids to selection hints rendered in the Agent/AgentSwarm tool descriptions, and [subagent].default_model picks the spawn model when the caller passes none. The tools' model parameter becomes a free-form alias string (stripped when no pool is configured), description rendering is caller-aware (primary (alias) [main model]), and a session-start validation service fails fast with CONFIG_INVALID on a missing/invalid default_model or an unresolvable pool alias. Remove the secondary-model experiment from the v2 engine, node-sdk, kap-server, and the TUI (the /secondary_model command), and drop the agent-profile modelPreference / model_preference frontmatter field on v2. The legacy v1 engine keeps the experiment unchanged; v2 ignores leftover [secondary_model] config silently. * fix(agent-core-v2): harden subagent model-pool validation and error/picker mapping Deep-review follow-ups to the [subagent.models] pool: - validate the pool before session materialization (after config.ready) and before the fork file copy, so a broken pool no longer leaves orphaned session dirs or leaked MCP overlay connections; the Session-scope validation service stays as a backstop - reject the reserved "primary" pool alias at startup, and again defensively in resolveSubagentBinding so a pool broken by a runtime config edit fails loudly at spawn instead of binding the wrong model - keep the [default] marker when the caller's own model is the pool default (primary (alias) [main model] [default]) - recompile the cached tool-args validator when a tool advertises a new schema object (mid-session pool edits no longer hit a stale validator) - map config.invalid to VALIDATION_FAILED in kap-server's session routes, the debug transport mapper, and the catch-all error handler - hide the v1-synthesized __secondary__ entry from the /model and /provider pickers again - fold per-export doc blocks into file headers per package comment conventions; add pre-flight/reserved-key/validator/mapping tests and document that create/resume/fork all fail on a broken pool * feat: re-add /secondary_model and accept a lone subagent default_model - v2 engine: a pool-less [subagent] default_model forms an implicit single-entry pool — validated at session create/resume/fork like an explicit pool, and advertised through the Agent/AgentSwarm model parameter. - Tool descriptions: the caller's own alias is a normal pool entry marked [main model]; the primary line stays distinct because only it inherits the caller's thinking level. - TUI: /secondary_model returns, persisting [subagent] default_model (merging into an existing pool with an empty description); the picker hides the no-op Thinking footer and rejects the reserved primary alias. - kap-server: /api/v1/config accepts and echoes subagent; the snake-to-camel patch conversion preserves user-defined map keys under providers/models/experimental/raw without leaking preserve mode into a colliding alias's own fields. - v1 config schema learns subagent.defaultModel/models so the shared config.toml round-trips; the v1 engine still ignores them at runtime. - Docs (en/zh) and changesets updated. * docs: use public model identifiers in the subagent model pool examples * refactor: rename /secondary_model to /secondary-model * test: cover the /secondary-model command name resolution * Revert "test: cover the /secondary-model command name resolution" This reverts commit 98a4a6d99925e45352a3d8ac6d0831a1024dbda8. * feat(agent-core-v2): move the subagent model pool to [secondary_model] The pool keys (default_model, [secondary_model.models]) now live in their own [secondary_model] config section instead of [subagent], which keeps only timeout_ms; legacy [subagent] pool keys are ignored with a deprecation warning. The SDK config contract carries the pool on the secondaryModel field, so the TUI /secondary-model command (now also aliased /subagent-model) and the kap-server /config wire read and write it directly with no translation layer. * docs: correct default engine guidance * feat(agent-core-v2): pin subagents to default_model with [secondary_model] force force = true removes the main agent's per-spawn model choice: the Agent and AgentSwarm tools stop advertising the model parameter and every spawn binds default_model; an explicit choice, "primary" included, is rejected. The setting requires default_model, rejects a [secondary_model.models] table, and is validated loudly at session create/resume/fork (lifecycle preflight plus the Session-scope backstop). The v1 engine declares the key for write round-trips and excludes it from the recipe patch. Also documents pool entries as per-alias thinking-level variants via default_effort overrides. * docs: use real managed model aliases in the secondary_model examples The pool examples invented aliases (kimi-hs, fable, codex) and referenced non-existent model IDs (model = "codex"); they now reference only the managed aliases provisioned by /login (kimi-code/k3, kimi-code/kimi-for-coding, kimi-code/kimi-for-coding-highspeed), with the effort variant derived as kimi-for-coding-highspeed-deep. Also replaces the versioned kimi-k2.5 alias with kimi-for-coding per the docs model-ID rule. * chore: simplify the subagent model pool changeset * feat(agent-core-v2): honor the legacy [secondary_model] model key as a fallback default * refactor(node-sdk): export the reserved model-alias constants from the SDK Restore the SECONDARY_DERIVED_MODEL_ALIAS re-export and add PRIMARY_SUBAGENT_MODEL_CHOICE so the TUI imports both from @moonshot-ai/kimi-code-sdk instead of vendoring local copies. * feat(agent-core-v2): keep the subagent model pool behind the secondary-model experiment Restore the secondary-model flag gating so this change only adds the pool: with the experiment off the [secondary_model] pool keys stay inert — the Agent/AgentSwarm tools strip the model parameter, spawns inherit the caller's model, and startup pool validation is skipped. The /secondary-model slash command is gated behind the experiment again, and the docs and changeset describe the flag. * fix(node-sdk): cascade provider removal into the subagent model pool Deleting a provider left [secondary_model] entries pointing at the removed model aliases; with the secondary-model experiment on, every subsequent session create/resume/fork then failed pool validation. planProviderRemoval now filters dangling pool entries, and drops the whole section when its effective default (defaultModel, or the legacy recipe's model fallback) dangles — folded into the same atomic multi-section replace. * fix(agent-core-v2): close two subagent model pool validation gaps Spawn-time resolveSubagentBinding now rejects force combined with a [secondary_model.models] table, matching the startup pre-flight — a live session could otherwise reach that invalid state through a deep-merged config patch and only fail on the next create/resume. The session lifecycle pre-flight also awaits the kosong model/provider registries' ready alongside config.ready, so a cold bootstrap no longer fails a valid pool with CONFIG_INVALID against an empty registry. * test(agent-core-v2): stub the model/provider registries in handler-chain tests SessionLifecycleService now awaits IModelService/IProviderService readiness in its pool pre-flight, so the tests that assemble the real service through a hand-built container must register the two tokens. * fix(kap-server): cascade REST provider deletion into the subagent model pool The DELETE /providers route rewrote only the providers and models sections, so a pool referencing one of the deleted provider's aliases was left dangling and the engine's create/resume/fork pool validation failed every subsequent session until the user repaired the TOML by hand. Filter dangling pool entries and drop the section when its effective default dangles, mirroring the SDK's planProviderRemoval semantics. * fix: keep the subagent pool consistent on provider replace and preserve legacy recipe fields PUT /providers rebuilds the provider's alias set and can drop or rename aliases referenced by [secondary_model]; the pool now cascades there too — renamed aliases are repointed (mirroring the global default-pointer migration), dropped aliases are filtered, and the section is cleared when its effective default dangles. The v2 [secondary_model] schema also declares the legacy recipe patch fields (default_effort, max_output_size, ...) so validation no longer strips them: pool resolution keeps ignoring them, but config reads/writes now round-trip losslessly instead of silently deleting them from config.toml on any pool write. * fix(agent-core-v2): cascade the subagent pool on catalog refresh writes A background provider/model refresh rewrites the [models] table without touching [secondary_model], so a dropped alias left the pool dangling and every subsequent session create/resume/fork failed validation until the user repaired the TOML by hand — the same gap the SDK and REST write paths already had, but triggered unattended. The cascade helper now lives in agent-core-v2 next to the section it protects (cascadeSubagentModelPool): the discovery service folds the pool into the same atomic replaceSections transition, and kap-server's provider write routes reuse the shared helper instead of a local copy. * fix: cover the last two model-table write paths for the subagent pool ModelsDevImportService's catalog and custom-registry imports rebuild the [models] table without the pool cascade, so an import that drops a pooled alias left a dangling pool behind; both final write passes now fold the pool through cascadeSubagentModelPool (the drop passes deliberately skip it). The StubConfigService test double now treats a null section value as a delete, matching the real ConfigService. The TUI's provider overwrite flow removes an existing provider before re-adding it, which ran the removal cascade against a model table where every alias of that provider was absent and silently dropped the pool; the flow now snapshots secondaryModel up front and restores the entries that survive the re-add, via the cascade helper re-exported from the SDK. --- .agents/skills/agent-core-dev/config.md | 2 +- .changeset/remove-secondary-model-sdk.md | 5 + .changeset/subagent-model-pool.md | 5 + apps/kimi-code/src/tui/commands/config.ts | 101 ++- apps/kimi-code/src/tui/commands/dispatch.ts | 2 +- apps/kimi-code/src/tui/commands/provider.ts | 25 +- apps/kimi-code/src/tui/commands/registry.ts | 4 +- .../tui/components/dialogs/model-selector.ts | 12 +- .../dialogs/tabbed-model-selector.ts | 11 +- .../tui/controllers/subagent-event-handler.ts | 6 +- .../test/tui/commands/registry.test.ts | 6 +- .../test/tui/commands/secondary-model.test.ts | 160 ++--- .../components/dialogs/model-selector.test.ts | 33 + .../dialogs/tabbed-model-selector.test.ts | 4 +- docs/en/configuration/config-files.md | 105 ++- docs/en/configuration/env-vars.md | 4 +- docs/en/customization/agents.md | 2 +- docs/en/reference/slash-commands.md | 2 +- docs/en/reference/tools.md | 4 +- docs/zh/configuration/config-files.md | 104 ++- docs/zh/configuration/env-vars.md | 6 +- docs/zh/customization/agents.md | 2 +- docs/zh/reference/slash-commands.md | 2 +- docs/zh/reference/tools.md | 4 +- .../agent-core-v2/docs/config-manifest.toml | 19 +- .../src/agent/profile/profileService.ts | 3 +- .../agent/toolExecutor/toolExecutorService.ts | 16 +- .../agent/tools/agent-swarm/agent-swarm.ts | 4 +- .../agent/tools/agent-swarm/agentSwarmTool.ts | 19 +- .../src/agent/tools/agent/agent.ts | 4 +- .../src/agent/tools/agent/agentTool.ts | 44 +- .../agentProfileCatalog.ts | 7 +- .../src/app/kosongConfig/configSection.ts | 34 +- .../src/app/kosongConfig/discoveryService.ts | 19 + .../kosongConfig/modelsDevImportService.ts | 26 +- .../app/kosongConfig/secondaryModelOverlay.ts | 102 --- .../app/skillCatalog/builtin/update-config.md | 2 +- packages/agent-core-v2/src/index.ts | 11 +- .../src/session/subagent/configSection.ts | 466 ++++++++++---- .../src/session/subagent/flag.ts | 4 +- .../src/session/subagent/mirrorAgentRun.ts | 3 +- .../session/subagent/secondaryModelWarning.ts | 32 - .../subagent/secondaryModelWarningService.ts | 160 ----- .../subagent/subagentModelsValidation.ts | 24 + .../subagentModelsValidationService.ts | 46 ++ .../src/session/swarm/sessionSwarmService.ts | 14 +- .../sessionLifecycleService.ts | 34 +- .../internal/agentFile.ts | 13 - .../internal/agentProfileFromFile.ts | 4 +- .../internal/types.ts | 2 - .../test/agent/profile/config-state.test.ts | 14 - .../test/agent/swarm/swarm.test.ts | 98 +-- .../agent/toolExecutor/toolExecutor.test.ts | 45 ++ .../test/app/config/config.test.ts | 423 +++++++----- .../test/app/kosongConfig/discovery.test.ts | 81 +++ .../app/kosongConfig/modelsDevImport.test.ts | 56 ++ .../secondaryModelOverlay.test.ts | 108 ---- .../workspaceLifecycle.test.ts | 13 + packages/agent-core-v2/test/harness/agent.ts | 7 +- packages/agent-core-v2/test/kosong/stubs.ts | 4 +- .../subagent/secondaryModelWarning.test.ts | 291 --------- .../subagent/subagentModelsValidation.test.ts | 248 ++++++++ .../test/session/swarm/sessionSwarm.test.ts | 44 +- packages/agent-core-v2/test/tool/tool.test.ts | 602 ++++++++++-------- .../sessionLifecycle/sessionLifecycle.test.ts | 196 +++++- .../agentFile.test.ts | 23 - .../workspaceDirs/workspaceDirs.test.ts | 13 + .../test/workspace/workspaceResources.test.ts | 13 + packages/agent-core/src/agent/index.ts | 2 +- packages/agent-core/src/config/schema.ts | 8 + .../agent-core/src/config/secondary-model.ts | 18 +- packages/agent-core/src/session/index.ts | 2 +- .../test/config/secondary-model.test.ts | 21 +- packages/kap-server/src/error-handler.ts | 14 +- .../kap-server/src/protocol/rest-config.ts | 6 +- packages/kap-server/src/routes/config.ts | 51 +- .../kap-server/src/routes/modelCatalog.ts | 48 +- packages/kap-server/src/routes/sessions.ts | 33 +- .../src/services/legacyStatus/legacyStatus.ts | 22 +- packages/kap-server/src/transport/errors.ts | 1 + packages/kap-server/test/config.test.ts | 84 ++- packages/kap-server/test/meta.test.ts | 24 +- packages/kap-server/test/modelCatalog.test.ts | 9 - .../test/modelCatalogProviderWrite.test.ts | 75 +++ .../test/sessionEventBroadcaster.test.ts | 44 -- .../kap-server/test/transport-errors.test.ts | 36 ++ packages/node-sdk/src/index.ts | 8 + packages/node-sdk/src/rpc.ts | 5 - packages/node-sdk/src/sdk-rpc-client-v2.ts | 95 +-- packages/node-sdk/src/session.ts | 12 - packages/node-sdk/src/v2/config-mapper.ts | 50 +- packages/node-sdk/src/v2/session-wiring.ts | 24 +- .../node-sdk/test/sdk-rpc-client-v2.test.ts | 129 +++- .../test/session-event-wiring.test.ts | 39 +- packages/node-sdk/test/v1-v2-parity.test.ts | 121 +--- 95 files changed, 2816 insertions(+), 2167 deletions(-) create mode 100644 .changeset/remove-secondary-model-sdk.md create mode 100644 .changeset/subagent-model-pool.md delete mode 100644 packages/agent-core-v2/src/app/kosongConfig/secondaryModelOverlay.ts delete mode 100644 packages/agent-core-v2/src/session/subagent/secondaryModelWarning.ts delete mode 100644 packages/agent-core-v2/src/session/subagent/secondaryModelWarningService.ts create mode 100644 packages/agent-core-v2/src/session/subagent/subagentModelsValidation.ts create mode 100644 packages/agent-core-v2/src/session/subagent/subagentModelsValidationService.ts delete mode 100644 packages/agent-core-v2/test/app/kosongConfig/secondaryModelOverlay.test.ts delete mode 100644 packages/agent-core-v2/test/session/subagent/secondaryModelWarning.test.ts create mode 100644 packages/agent-core-v2/test/session/subagent/subagentModelsValidation.test.ts diff --git a/.agents/skills/agent-core-dev/config.md b/.agents/skills/agent-core-dev/config.md index 90e1dc10242..d7d6b12fcef 100644 --- a/.agents/skills/agent-core-dev/config.md +++ b/.agents/skills/agent-core-dev/config.md @@ -101,7 +101,7 @@ pass `ConfigTarget.Memory` for a per-run override that is never written to disk. - `src/kosong/model/thinking.ts` (owner domain, not `config`) — the `resolveThinkingEffort` helper and the authoritative `ThinkingConfig` type (the `thinking` section itself registers from `src/app/kosongConfig/configSection.ts`). - `src/app/config/configPure.ts` — `isPlainObject`, `deepMerge`, `omitUndefined`, `describeUnknownError`. -A domain that owns a section keeps the schema in its own `configSection.ts` (e.g. `src/app/flag/flag.ts` for `experimental`, `src/agent/loop/configSection.ts` for `loopControl`). Exception: kosong-owned sections (`providers`, `models`, `thinking`) — kosong is a pure, persistence-free abstraction layer that defines only the types (`src/kosong/{provider,model}`); the section constants, the zod schemas (re-derived from those types and compile-time pinned via `AssertExact, Type>>`, see `_base/utils/typeEquality.ts`), the registrations, env bindings, and TOML transforms all live in the persistence wrapper `src/app/kosongConfig/configSection.ts`. (`modelCatalog` and `secondaryModel` have no kosong-side type at all — their sections are fully self-contained in `app/kosongConfig`, types derived from the schemas.) A cross-section env overlay (e.g. the `KIMI_MODEL_*` synthesis) lives in the wrapper too (`src/app/kosongConfig/envOverlay.ts`; the `[secondary_model]` derived-entry synthesis in `secondaryModelOverlay.ts`) and is registered via module-level `registerConfigOverlay`. The two-way sync between config sections and kosong's in-memory registries is owned by `IKosongConfigService` (`src/app/kosongConfig/kosongConfigService.ts`). +A domain that owns a section keeps the schema in its own `configSection.ts` (e.g. `src/app/flag/flag.ts` for `experimental`, `src/agent/loop/configSection.ts` for `loopControl`). Exception: kosong-owned sections (`providers`, `models`, `thinking`) — kosong is a pure, persistence-free abstraction layer that defines only the types (`src/kosong/{provider,model}`); the section constants, the zod schemas (re-derived from those types and compile-time pinned via `AssertExact, Type>>`, see `_base/utils/typeEquality.ts`), the registrations, env bindings, and TOML transforms all live in the persistence wrapper `src/app/kosongConfig/configSection.ts`. (`modelCatalog` has no kosong-side type at all — its section is fully self-contained in `app/kosongConfig`, types derived from the schema.) A cross-section env overlay (e.g. the `KIMI_MODEL_*` synthesis in `src/app/kosongConfig/envOverlay.ts`) lives in the wrapper too and is registered via module-level `registerConfigOverlay`. The session subagent domain owns two sections in `src/session/subagent/configSection.ts`: `[subagent]` (`timeout_ms` on disk) and `[secondary_model]` (`default_model` plus the `[secondary_model.models]` pool, with a lone legacy v1 `model` key honored as a fallback default below `default_model`), with the legacy `[subagent]` pool keys declared as deprecations; neither carries a cross-section overlay. Cross-field pool validation (default present / in-pool / every key resolvable) runs at session creation in `subagentModelsValidationService.ts`, not in the schema. The two-way sync between config sections and kosong's in-memory registries is owned by `IKosongConfigService` (`src/app/kosongConfig/kosongConfigService.ts`). ## Scope diff --git a/.changeset/remove-secondary-model-sdk.md b/.changeset/remove-secondary-model-sdk.md new file mode 100644 index 00000000000..837e4b81132 --- /dev/null +++ b/.changeset/remove-secondary-model-sdk.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code-sdk": minor +--- + +Remove the secondary-model session API `Session.applyPersistedSecondaryModel`; subagent model selection is configured via `[secondary_model]` in config.toml instead. The `SECONDARY_DERIVED_MODEL_ALIAS` export stays (the v1 engine still synthesizes the entry at runtime, so hosts keep filtering it out of model pickers), and the SDK now also exports `PRIMARY_SUBAGENT_MODEL_CHOICE`, the v2 subagent model pool's reserved `primary` key. diff --git a/.changeset/subagent-model-pool.md b/.changeset/subagent-model-pool.md new file mode 100644 index 00000000000..9a59ab9d563 --- /dev/null +++ b/.changeset/subagent-model-pool.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": minor +--- + +Add a configurable model pool for spawned subagents behind the `secondary-model` experiment (`KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master flag): with the experiment on, the `/secondary-model` command or the `[secondary_model]` section in config.toml sets a default model or a small named pool that the main agent picks from per spawn. A lone legacy `model` key in the same section keeps working as the fallback default. diff --git a/apps/kimi-code/src/tui/commands/config.ts b/apps/kimi-code/src/tui/commands/config.ts index fac34484e09..18f7edb5d8e 100644 --- a/apps/kimi-code/src/tui/commands/config.ts +++ b/apps/kimi-code/src/tui/commands/config.ts @@ -1,8 +1,8 @@ import { effectiveModelAlias, + PRIMARY_SUBAGENT_MODEL_CHOICE, SECONDARY_DERIVED_MODEL_ALIAS, type ExperimentalFeatureState, - type KimiConfig, type ModelAlias, type PermissionMode, type Session, @@ -270,6 +270,15 @@ export async function handleSecondaryModelCommand(host: SlashCommandHost, args: const alias = args.trim(); await refreshModelsForPicker(host); const models = pickerModelsForHost(host); + // The pool reserves `primary` as the symbolic "caller's own model" choice — + // a user alias with that name can never be the subagent default. + delete models[PRIMARY_SUBAGENT_MODEL_CHOICE]; + if (alias === PRIMARY_SUBAGENT_MODEL_CHOICE) { + host.showError( + `"${PRIMARY_SUBAGENT_MODEL_CHOICE}" is reserved by the subagent model pool (it always binds the caller's own model) — rename the [models] alias to use it here.`, + ); + return; + } if (Object.keys(models).length === 0) { host.showNotice( 'No models configured', @@ -282,7 +291,10 @@ export async function handleSecondaryModelCommand(host: SlashCommandHost, args: return; } const secondary = (await host.harness.getConfig()).secondaryModel; - showSecondaryModelPicker(host, models, secondary?.model ?? '', secondary?.defaultEffort, alias); + // The v2 engine honors a lone legacy `model` key as the fallback pool + // default — reflect it as the picker's current value. + const current = secondary?.defaultModel ?? secondary?.model ?? ''; + showSecondaryModelPicker(host, models, current, alias.length > 0 ? alias : undefined); } export async function handleEffortCommand(host: SlashCommandHost, args: string): Promise { @@ -428,8 +440,8 @@ async function applyEditorChoice(host: SlashCommandHost, value: string): Promise /** * The models a picker may offer: the user's configured aliases with * host-effective provider resolution applied, minus the synthesized - * `__secondary__` derived entry — a runtime artifact of the `[secondary_model]` - * recipe that must never be selectable as a primary or secondary model. + * `__secondary__` derived entry — a runtime artifact of the v1 engine's + * `[secondary_model]` recipe that must never be selectable as a model. */ function pickerModelsForHost(host: SlashCommandHost): Record { return Object.fromEntries( @@ -605,14 +617,13 @@ async function persistModelSelection( } // --------------------------------------------------------------------------- -// Secondary model (`/secondary_model`) +// Secondary model (`/secondary-model`) — persists `[secondary_model] default_model` // --------------------------------------------------------------------------- function showSecondaryModelPicker( host: SlashCommandHost, models: Record, currentValue: string, - currentEffort: string | undefined, selectedValue?: string, ): void { host.mountEditorReplacement( @@ -620,11 +631,14 @@ function showSecondaryModelPicker( models, currentValue, selectedValue, - currentThinkingEffort: currentEffort ?? 'off', + currentThinkingEffort: 'off', + // Subagent pool bindings carry no explicit thinking level, so the picker + // hides the Thinking footer instead of offering a no-op choice. + thinkingControl: false, title: ' Select a secondary model (subagents)', - onSelect: ({ alias, thinking }) => { + onSelect: ({ alias }) => { host.restoreEditor(); - void performSecondaryModelSwitch(host, alias, thinking); + void performSecondaryModelSave(host, alias); }, onCancel: () => { host.restoreEditor(); @@ -634,65 +648,32 @@ function showSecondaryModelPicker( } /** - * Persist-first, then live-apply: the synthesized derived entry only exists in - * the core config after a reload. No session-only variant — a session-local - * recipe with patch fields would bind a derived alias the core config cannot - * resolve. + * Persists `[secondary_model] default_model`. When a + * `[secondary_model.models]` pool exists and does not list the alias yet, the + * alias is added with an empty description — the engine requires the default + * to be a pool key. Without a pool the default alone forms an implicit + * single-entry pool, so nothing else is written. No live-apply step: the + * engine resolves the pool per spawn, so the next subagent dispatch picks the + * new value up on its own. */ -async function performSecondaryModelSwitch( - host: SlashCommandHost, - alias: string, - effort: ThinkingEffort, -): Promise { +async function performSecondaryModelSave(host: SlashCommandHost, alias: string): Promise { const displayName = modelDisplayName(alias, host.state.appState.availableModels[alias]); - let updatedConfig: KimiConfig; try { - updatedConfig = await host.harness.setConfig({ - secondaryModel: { model: alias, defaultEffort: effort }, - }); + const config = await host.harness.getConfig({ reload: true }); + const existing = config.secondaryModel?.models; + const patch: { defaultModel: string; models?: Record } = { + defaultModel: alias, + }; + if (existing !== undefined) { + patch.models = { ...existing, [alias]: existing[alias] ?? '' }; + } + await host.harness.setConfig({ secondaryModel: patch }); } catch (error) { host.showError(`Failed to save secondary model: ${formatErrorMessage(error)}`); return; } - if (host.session !== undefined) { - try { - await host.session.applyPersistedSecondaryModel(); - } catch (error) { - host.showError( - `Saved ${displayName} as the secondary model, but failed to apply it to this session: ${formatErrorMessage(error)}`, - ); - return; - } - } - host.setAppState({ availableModels: updatedConfig.models ?? {} }); - // Report the effective binding from the reloaded config, not the picked - // value: KIMI_SECONDARY_MODEL / KIMI_SECONDARY_EFFORT override the recipe at - // runtime, and the session binds the overlaid snapshot (mirrors how - // /model displays the effective alias read back from the session). - const effective = updatedConfig.secondaryModel; - const envOverrides: string[] = []; - if (effective?.model !== undefined && effective.model !== alias) { - envOverrides.push(`KIMI_SECONDARY_MODEL=${effective.model}`); - } - if (effective?.defaultEffort !== undefined && effective.defaultEffort !== effort) { - envOverrides.push(`KIMI_SECONDARY_EFFORT=${effective.defaultEffort}`); - } - if (envOverrides.length > 0 && effective?.model !== undefined) { - const effectiveName = modelDisplayName( - effective.model, - updatedConfig.models?.[effective.model], - ); - host.showStatus( - `Saved ${displayName} as the secondary model, but ${envOverrides.join(' and ')} ` + - `overrides it at runtime — subagents bind ${effectiveName} until the env var is unset.`, - 'warning', - ); - return; - } host.showStatus( - host.session === undefined - ? `Secondary model set to ${displayName} with thinking ${effort}; applies to new sessions.` - : `Secondary model set to ${displayName} with thinking ${effort}.`, + `Secondary model set to ${displayName}. Newly spawned subagents will use it by default.`, 'success', ); } diff --git a/apps/kimi-code/src/tui/commands/dispatch.ts b/apps/kimi-code/src/tui/commands/dispatch.ts index b36951c7847..3e1b1f0c657 100644 --- a/apps/kimi-code/src/tui/commands/dispatch.ts +++ b/apps/kimi-code/src/tui/commands/dispatch.ts @@ -440,7 +440,7 @@ async function handleBuiltInSlashCommand( case 'model': await handleModelCommand(host, args); return; - case 'secondary_model': + case 'secondary-model': await handleSecondaryModelCommand(host, args); return; case 'effort': diff --git a/apps/kimi-code/src/tui/commands/provider.ts b/apps/kimi-code/src/tui/commands/provider.ts index dbfbddfcb2b..61ec07b9119 100644 --- a/apps/kimi-code/src/tui/commands/provider.ts +++ b/apps/kimi-code/src/tui/commands/provider.ts @@ -6,10 +6,12 @@ import { } from '@moonshot-ai/kimi-code-oauth'; import { applyCatalogProvider, + cascadeSubagentModelPool, catalogProviderModels, CatalogFetchError, DEFAULT_CATALOG_URL, resolveCatalogImport, + SECONDARY_DERIVED_MODEL_ALIAS, type Catalog, type ThinkingEffort, } from '@moonshot-ai/kimi-code-sdk'; @@ -231,6 +233,10 @@ async function handleCatalogProviderAdd(host: SlashCommandHost): Promise { // entered. The model selector that follows is just a convenience to pick the // default model; ESC leaves the provider in place without a default selection. const existingConfig = await host.harness.getConfig(); + const poolSnapshot = + existingConfig.providers[providerId] !== undefined + ? existingConfig.secondaryModel + : undefined; if (existingConfig.providers[providerId] !== undefined) { await host.harness.removeProvider(providerId); } @@ -251,6 +257,16 @@ async function handleCatalogProviderAdd(host: SlashCommandHost): Promise { models: config.models, }); + // removeProvider cascaded the subagent pool against a model table where + // every `${providerId}/...` alias was absent; restore the entries that + // survived the re-add (aliases the catalog genuinely dropped stay dropped). + if (poolSnapshot !== undefined) { + const restored = cascadeSubagentModelPool(poolSnapshot, config.models ?? {}); + if (restored !== null) { + await host.harness.setConfig({ secondaryModel: restored ?? poolSnapshot }); + } + } + await host.authFlow.refreshConfigAfterLogin(); host.track('connect', { provider: providerId, method: 'catalog' }); host.showStatus(`Provider added: ${entry.name ?? providerId}`); @@ -263,8 +279,11 @@ async function handleCatalogProviderAdd(host: SlashCommandHost): Promise { // Build a merged model dictionary that includes existing models plus the // newly-persisted provider's models, so the tabbed selector shows every // provider's tab (the new provider's tab starts active via initialTabId). + // The v1 runtime may carry the synthesized `__secondary__` derived entry — + // never selectable in a picker. const stateModels = await host.harness.getConfig().then((c) => c.models ?? {}); const mergedModels = { ...stateModels }; + delete mergedModels[SECONDARY_DERIVED_MODEL_ALIAS]; const selector = new TabbedModelSelectorComponent({ models: mergedModels, @@ -356,8 +375,10 @@ async function handleCustomRegistryAddViaDialog(host: SlashCommandHost): Promise ); // Offer the model selector so the user can pick a default, just like the - // catalog (known-provider) flow. - const stateModels = await host.harness.getConfig().then((c) => c.models ?? {}); + // catalog (known-provider) flow. Copy without the v1-synthesized + // `__secondary__` derived entry — never selectable in a picker. + const stateModels = { ...(await host.harness.getConfig().then((c) => c.models ?? {})) }; + delete stateModels[SECONDARY_DERIVED_MODEL_ALIAS]; const firstNewAlias = Object.keys(stateModels).find((a) => addedProviderIds.some((pid) => a.startsWith(`${pid}/`)), ); diff --git a/apps/kimi-code/src/tui/commands/registry.ts b/apps/kimi-code/src/tui/commands/registry.ts index 48b57aa3f8c..d87e74b75dd 100644 --- a/apps/kimi-code/src/tui/commands/registry.ts +++ b/apps/kimi-code/src/tui/commands/registry.ts @@ -185,8 +185,8 @@ export const BUILTIN_SLASH_COMMANDS = [ availability: 'always', }, { - name: 'secondary_model', - aliases: [], + name: 'secondary-model', + aliases: ['subagent-model'], description: 'Configure the secondary model for subagents', priority: 90, availability: 'always', diff --git a/apps/kimi-code/src/tui/components/dialogs/model-selector.ts b/apps/kimi-code/src/tui/components/dialogs/model-selector.ts index 0299c6fde0b..2532f14a2d8 100644 --- a/apps/kimi-code/src/tui/components/dialogs/model-selector.ts +++ b/apps/kimi-code/src/tui/components/dialogs/model-selector.ts @@ -80,6 +80,9 @@ export interface ModelSelectorOptions { * line; wraps instead of truncating when it exceeds the width (e.g. the * mid-conversation switch cost notice). */ readonly warning?: string; + /** Set to false to hide the Thinking footer and disable ←/→ effort + * switching — for pickers whose selection carries no thinking level. */ + readonly thinkingControl?: boolean; readonly onSelect: (selection: ModelSelection) => void; /** When provided, Alt+S invokes this instead of onSelect — used to apply the * choice to the current session only, without persisting it as the default. */ @@ -225,7 +228,10 @@ export class ModelSelectorComponent extends Container implements Focusable { } // Left/Right move the active thinking effort within the model's segments. - if (matchesKey(data, Key.left) || matchesKey(data, Key.right)) { + if ( + this.opts.thinkingControl !== false && + (matchesKey(data, Key.left) || matchesKey(data, Key.right)) + ) { const selected = this.selectedChoice(); if (selected !== undefined) { const segments = segmentsFor(selected.model); @@ -352,13 +358,13 @@ export class ModelSelectorComponent extends Container implements Focusable { lines.push(''); const selected = this.selectedChoice(); - if (selected !== undefined) { + if (selected !== undefined && this.opts.thinkingControl !== false) { const canSwitch = segmentsFor(selected.model).length > 1; const thinkingHeader = canSwitch ? ' Thinking (←→ to switch)' : ' Thinking'; lines.push(currentTheme.fg('textMuted', thinkingHeader)); lines.push(this.renderThinkingControl(selected)); + lines.push(''); } - lines.push(''); lines.push(currentTheme.fg('primary', '─'.repeat(width))); return lines.map((line) => truncateToWidth(line, width)); } diff --git a/apps/kimi-code/src/tui/components/dialogs/tabbed-model-selector.ts b/apps/kimi-code/src/tui/components/dialogs/tabbed-model-selector.ts index d94de3b06dc..9726ad48324 100644 --- a/apps/kimi-code/src/tui/components/dialogs/tabbed-model-selector.ts +++ b/apps/kimi-code/src/tui/components/dialogs/tabbed-model-selector.ts @@ -41,15 +41,17 @@ export interface TabbedModelSelectorOptions { readonly selectedValue?: string; readonly currentThinkingEffort: string; /** Forwarded to each inner selector; overrides the default ' Select a model' - * title line (e.g. the secondary-model picker). */ + * title line. */ readonly title?: string; /** When set, the tab for this provider id is initially active instead of the * tab derived from `currentValue`. */ readonly initialTabId?: string; - /** Forwarded to each inner selector; when set, warning-colored lines are - * rendered directly below the key-hint line, wrapping as needed (e.g. the - * mid-conversation switch cost notice). */ + /** When set, warning-colored lines are rendered directly below the key-hint + * line, wrapping as needed (e.g. the mid-conversation switch cost notice). */ readonly warning?: string; + /** Forwarded to each inner selector; set to false to hide the Thinking + * footer and disable ←/→ effort switching. */ + readonly thinkingControl?: boolean; readonly onSelect: (selection: ModelSelection) => void; /** Forwarded to each inner selector; when set, Alt+S applies the choice to * the current session only without persisting it as the default. */ @@ -187,6 +189,7 @@ function makeSelector( searchable: true, providerSwitchHint: true, warning: opts.warning, + thinkingControl: opts.thinkingControl, onSelect: opts.onSelect, onSessionOnlySelect: opts.onSessionOnlySelect, onCancel: opts.onCancel, diff --git a/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts b/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts index 18dd573b980..80a62510250 100644 --- a/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts +++ b/apps/kimi-code/src/tui/controllers/subagent-event-handler.ts @@ -137,8 +137,7 @@ export class SubAgentEventHandler { usage: totalUsage, // The bound model alias rides every child status update (emitted right // after spawn); surface it on the subagent card. `modelDisplayName` - // falls back to the alias itself when the entry is unknown (e.g. the - // synthesized `__secondary__` derived entry is missing). + // falls back to the alias itself when the entry is unknown. modelDisplay: event.model === undefined ? undefined @@ -589,8 +588,7 @@ export class SubAgentEventHandler { // The bound model alias rides every child status update (emitted right // after spawn). Swarm members share one binding, so the panel shows it // once in the header instead of per cell. `modelDisplayName` falls back - // to the alias itself when the entry is unknown (e.g. the synthesized - // `__secondary__` derived entry is missing). + // to the alias itself when the entry is unknown. progress.setModelDisplay( modelDisplayName(event.model, this.host.state.appState.availableModels[event.model]), ); diff --git a/apps/kimi-code/test/tui/commands/registry.test.ts b/apps/kimi-code/test/tui/commands/registry.test.ts index a1964b5cbb4..3dbeb4b4c42 100644 --- a/apps/kimi-code/test/tui/commands/registry.test.ts +++ b/apps/kimi-code/test/tui/commands/registry.test.ts @@ -167,7 +167,7 @@ describe('built-in slash command registry', () => { 'plan', 'reload', 'reload-tui', - 'secondary_model', + 'secondary-model', 'sessions', 'settings', 'status', @@ -191,8 +191,8 @@ describe('built-in slash command registry', () => { expect(resolveSlashCommandAvailability(reloadTui!, '')).toBe('always'); }); - it('gates secondary_model behind the secondary-model experiment, always available', () => { - const command = findBuiltInSlashCommand('secondary_model'); + it('gates secondary-model behind the secondary-model experiment, always available', () => { + const command = findBuiltInSlashCommand('secondary-model'); expect(command).toBeDefined(); expect((command as KimiSlashCommand).experimentalFlag).toBe('secondary-model'); expect(resolveSlashCommandAvailability(command!, '')).toBe('always'); diff --git a/apps/kimi-code/test/tui/commands/secondary-model.test.ts b/apps/kimi-code/test/tui/commands/secondary-model.test.ts index 81b309ef013..9bce58d4c0f 100644 --- a/apps/kimi-code/test/tui/commands/secondary-model.test.ts +++ b/apps/kimi-code/test/tui/commands/secondary-model.test.ts @@ -1,10 +1,11 @@ /** - * Scenario: /secondary_model command behavior in the interactive TUI. - * Responsibilities: picker filtering, persistence, live apply, and effective-model state refresh. + * Scenario: /secondary-model command behavior in the interactive TUI. + * Responsibilities: picker filtering, persistence of `[secondary_model] default_model` + * (keeping existing pool descriptions), and error paths. * Wiring: real command and selector with the SDK/session boundaries stubbed by a small host rig. * Run: pnpm -C apps/kimi-code exec vitest run test/tui/commands/secondary-model.test.ts */ -import type { ModelAlias, ThinkingEffort } from '@moonshot-ai/kimi-code-sdk'; +import type { ModelAlias } from '@moonshot-ai/kimi-code-sdk'; import { describe, expect, it, vi } from 'vitest'; import type { SlashCommandHost } from '#/tui/commands'; @@ -14,9 +15,10 @@ import { TabbedModelSelectorComponent } from '#/tui/components/dialogs/tabbed-mo interface PickerOptions { readonly models: Record; readonly currentValue: string; - readonly currentThinkingEffort: string; + readonly selectedValue?: string; readonly title?: string; - readonly onSelect: (selection: { alias: string; thinking: ThinkingEffort }) => void; + readonly thinkingControl?: boolean; + readonly onSelect: (selection: { alias: string }) => void; } function model(name: string): ModelAlias { @@ -29,21 +31,16 @@ function model(name: string): ModelAlias { } function makeHost(options?: { - readonly withSession?: boolean; - readonly secondaryModel?: { model: string; defaultEffort?: string }; - readonly persistedModels?: Record; - /** The secondary model the reloaded config carries — env overlays win. */ - readonly effectiveSecondary?: { model: string; defaultEffort?: string }; + readonly secondaryModel?: { defaultModel?: string; models?: Record }; }) { - const session = options?.withSession === false - ? undefined - : { applyPersistedSecondaryModel: vi.fn(async () => {}) }; const appState = { availableModels: { k2: model('k2'), cheap: model('cheap'), - // The synthesized derived entry must never be selectable. + // The v1 derived entry must never be selectable. '__secondary__': model('cheap'), + // The pool's reserved symbolic choice must never be selectable either. + 'primary': model('primary'), } as Record, availableProviders: {}, transcriptEntries: [], @@ -61,13 +58,8 @@ function makeHost(options?: { providers: {}, secondaryModel: options?.secondaryModel, })), - setConfig: vi.fn(async () => ({ - providers: {}, - models: options?.persistedModels, - secondaryModel: options?.effectiveSecondary, - })), + setConfig: vi.fn(async () => ({})), }, - session, setAppState: vi.fn((patch) => Object.assign(appState, patch)), mountEditorReplacement: vi.fn(), restoreEditor: vi.fn(), @@ -85,7 +77,7 @@ function makeHost(options?: { showError: ReturnType; showNotice: ReturnType; }; - return { host, session }; + return { host }; } function mountedPicker(host: { mountEditorReplacement: ReturnType }): PickerOptions { @@ -96,108 +88,86 @@ function mountedPicker(host: { mountEditorReplacement: ReturnType } describe('handleSecondaryModelCommand', () => { - it('opens the picker filtered to user models, with the configured recipe as current', async () => { - const { host } = makeHost({ secondaryModel: { model: 'cheap', defaultEffort: 'high' } }); + it('opens the picker filtered to user models, with the configured default as current', async () => { + const { host } = makeHost({ secondaryModel: { defaultModel: 'cheap' } }); await handleSecondaryModelCommand(host, ''); const opts = mountedPicker(host); expect(Object.keys(opts.models)).toEqual(['k2', 'cheap']); expect(opts.currentValue).toBe('cheap'); - expect(opts.currentThinkingEffort).toBe('high'); expect(opts.title).toContain('secondary model'); + // Pool bindings carry no explicit thinking level — the picker hides the + // Thinking footer instead of offering a no-op choice. + expect(opts.thinkingControl).toBe(false); }); - it('persists first, then live-applies the selection to the session', async () => { - const { host, session } = makeHost(); + it('persists only default_model when no pool exists (implicit single-entry pool)', async () => { + const { host } = makeHost(); await handleSecondaryModelCommand(host, ''); - mountedPicker(host).onSelect({ alias: 'k2', thinking: 'high' }); + mountedPicker(host).onSelect({ alias: 'k2' }); await vi.waitFor(() => { expect(host.showStatus).toHaveBeenCalled(); }); expect(host.harness.setConfig).toHaveBeenCalledWith({ - secondaryModel: { model: 'k2', defaultEffort: 'high' }, + secondaryModel: { defaultModel: 'k2' }, }); - expect(session!.applyPersistedSecondaryModel).toHaveBeenCalledWith(); - expect(host.harness.setConfig.mock.invocationCallOrder[0]).toBeLessThan( - session!.applyPersistedSecondaryModel.mock.invocationCallOrder[0]!, - ); expect(host.showError).not.toHaveBeenCalled(); }); - it('refreshes the effective model map after a live secondary-model switch', async () => { + it('adds the picked alias to an existing pool with an empty description', async () => { const { host } = makeHost({ - persistedModels: { - k2: model('k2'), - cheap: model('cheap'), - '__secondary__': model('k2'), + secondaryModel: { + defaultModel: 'cheap', + models: { cheap: 'fast and cheap' }, }, }); await handleSecondaryModelCommand(host, ''); - mountedPicker(host).onSelect({ alias: 'k2', thinking: 'high' }); + mountedPicker(host).onSelect({ alias: 'k2' }); await vi.waitFor(() => { expect(host.showStatus).toHaveBeenCalled(); }); - expect(host.state.appState.availableModels['__secondary__']?.displayName).toBe('k2'); + expect(host.harness.setConfig).toHaveBeenCalledWith({ + secondaryModel: { + defaultModel: 'k2', + models: { cheap: 'fast and cheap', k2: '' }, + }, + }); }); - it('warns with the env-overridden effective binding instead of the picked model', async () => { - // KIMI_SECONDARY_MODEL / KIMI_SECONDARY_EFFORT win over the persisted - // recipe: the reloaded config carries the overlaid values, and the status - // message must name them rather than echo the pick. + it('keeps existing pool descriptions and other pool entries on save', async () => { const { host } = makeHost({ - effectiveSecondary: { model: 'cheap', defaultEffort: 'low' }, + secondaryModel: { + defaultModel: 'cheap', + models: { cheap: 'fast and cheap', k2: 'hard tasks' }, + }, }); await handleSecondaryModelCommand(host, ''); - mountedPicker(host).onSelect({ alias: 'k2', thinking: 'high' }); + mountedPicker(host).onSelect({ alias: 'k2' }); await vi.waitFor(() => { expect(host.showStatus).toHaveBeenCalled(); }); - const [message, color] = host.showStatus.mock.calls[0]!; - expect(message).toContain('KIMI_SECONDARY_MODEL=cheap'); - expect(message).toContain('KIMI_SECONDARY_EFFORT=low'); - expect(color).toBe('warning'); - expect(host.showError).not.toHaveBeenCalled(); - }); - - it('keeps the current effective model map when live apply fails', async () => { - const { host, session } = makeHost({ - persistedModels: { - k2: model('k2'), - cheap: model('cheap'), - '__secondary__': model('k2'), + expect(host.harness.setConfig).toHaveBeenCalledWith({ + secondaryModel: { + defaultModel: 'k2', + models: { cheap: 'fast and cheap', k2: 'hard tasks' }, }, }); - session!.applyPersistedSecondaryModel.mockRejectedValueOnce(new Error('apply failed')); - - await handleSecondaryModelCommand(host, ''); - mountedPicker(host).onSelect({ alias: 'k2', thinking: 'high' }); - - await vi.waitFor(() => { - expect(host.showError).toHaveBeenCalled(); - }); - expect(host.state.appState.availableModels['__secondary__']?.displayName).toBe('cheap'); }); - it('persists only when there is no session', async () => { - const { host } = makeHost({ withSession: false }); + it('pre-selects a valid alias argument instead of erroring', async () => { + const { host } = makeHost(); - await handleSecondaryModelCommand(host, ''); - mountedPicker(host).onSelect({ alias: 'k2', thinking: 'off' }); + await handleSecondaryModelCommand(host, 'cheap'); - await vi.waitFor(() => { - expect(host.showStatus).toHaveBeenCalled(); - }); - expect(host.harness.setConfig).toHaveBeenCalledWith({ - secondaryModel: { model: 'k2', defaultEffort: 'off' }, - }); - expect(host.showStatus.mock.calls[0]![0]).toContain('new sessions'); + const opts = mountedPicker(host); + expect(opts.selectedValue).toBe('cheap'); }); it('rejects an unknown alias argument without opening the picker', async () => { @@ -218,6 +188,26 @@ describe('handleSecondaryModelCommand', () => { expect(host.mountEditorReplacement).not.toHaveBeenCalled(); }); + it('rejects the reserved primary alias as an argument', async () => { + const { host } = makeHost(); + + await handleSecondaryModelCommand(host, 'primary'); + + expect(host.showError).toHaveBeenCalledWith(expect.stringContaining('reserved')); + expect(host.mountEditorReplacement).not.toHaveBeenCalled(); + }); + + it('reports the reserved error for primary even when it is the only configured model', async () => { + const { host } = makeHost(); + host.state.appState.availableModels = { primary: model('primary') }; + + await handleSecondaryModelCommand(host, 'primary'); + + expect(host.showError).toHaveBeenCalledWith(expect.stringContaining('reserved')); + expect(host.showNotice).not.toHaveBeenCalled(); + expect(host.mountEditorReplacement).not.toHaveBeenCalled(); + }); + it('shows a notice when no models are configured', async () => { const { host } = makeHost(); host.state.appState.availableModels = {}; @@ -227,4 +217,18 @@ describe('handleSecondaryModelCommand', () => { expect(host.showNotice).toHaveBeenCalled(); expect(host.mountEditorReplacement).not.toHaveBeenCalled(); }); + + it('reports a persistence failure without a status message', async () => { + const { host } = makeHost(); + host.harness.setConfig.mockRejectedValueOnce(new Error('disk full')); + + await handleSecondaryModelCommand(host, ''); + mountedPicker(host).onSelect({ alias: 'k2' }); + + await vi.waitFor(() => { + expect(host.showError).toHaveBeenCalled(); + }); + expect(host.showError.mock.calls[0]![0]).toContain('disk full'); + expect(host.showStatus).not.toHaveBeenCalled(); + }); }); diff --git a/apps/kimi-code/test/tui/components/dialogs/model-selector.test.ts b/apps/kimi-code/test/tui/components/dialogs/model-selector.test.ts index 8fced417684..e5159ec0d92 100644 --- a/apps/kimi-code/test/tui/components/dialogs/model-selector.test.ts +++ b/apps/kimi-code/test/tui/components/dialogs/model-selector.test.ts @@ -99,6 +99,39 @@ describe('ModelSelectorComponent', () => { expect(text(picker)).toContain('Thinking (←→ to switch)'); }); + it('hides the Thinking footer when thinkingControl is false', () => { + const picker = new ModelSelectorComponent({ + models: { kimi: model('Kimi K2', ['thinking']) }, + currentValue: 'kimi', + currentThinkingEffort: 'on', + thinkingControl: false, + onSelect: vi.fn(), + onCancel: vi.fn(), + }); + + expect(text(picker)).not.toContain('Thinking'); + }); + + it('ignores Left/Right when thinkingControl is false', () => { + const onSelect = vi.fn(); + const picker = new ModelSelectorComponent({ + models: { kimi: model('Kimi K2', ['thinking']) }, + currentValue: 'kimi', + currentThinkingEffort: 'on', + thinkingControl: false, + onSelect, + onCancel: vi.fn(), + }); + + // Same setup as the toggle test above: either arrow would flip 'on' to 'off'. + picker.handleInput(LEFT); + picker.handleInput('\r'); + expect(onSelect).toHaveBeenLastCalledWith({ alias: 'kimi', thinking: 'on' }); + picker.handleInput(RIGHT); + picker.handleInput('\r'); + expect(onSelect).toHaveBeenLastCalledWith({ alias: 'kimi', thinking: 'on' }); + }); + it('forces always-thinking models on and unsupported models off', () => { const onSelect = vi.fn(); const picker = new ModelSelectorComponent({ diff --git a/apps/kimi-code/test/tui/components/dialogs/tabbed-model-selector.test.ts b/apps/kimi-code/test/tui/components/dialogs/tabbed-model-selector.test.ts index f6ffc649613..c202e0bf857 100644 --- a/apps/kimi-code/test/tui/components/dialogs/tabbed-model-selector.test.ts +++ b/apps/kimi-code/test/tui/components/dialogs/tabbed-model-selector.test.ts @@ -139,12 +139,12 @@ describe('TabbedModelSelectorComponent', () => { models: { k2: model('Kimi K2', 'managed:kimi-code') }, currentValue: 'k2', currentThinkingEffort: 'off', - title: ' Select a secondary model (subagents)', + title: ' Choose a model for this task', onSelect: vi.fn(), onCancel: vi.fn(), }); const out = strip(titled.render(120).join('\n')); - expect(out).toContain('Select a secondary model (subagents)'); + expect(out).toContain('Choose a model for this task'); expect(out).not.toContain('Select a model '); }); diff --git a/docs/en/configuration/config-files.md b/docs/en/configuration/config-files.md index a3cce551a4c..cf62875b13c 100644 --- a/docs/en/configuration/config-files.md +++ b/docs/en/configuration/config-files.md @@ -192,7 +192,99 @@ You can also switch models temporarily without touching the config file — by s ## `secondary_model` -The secondary model is a second model configuration alongside the main model — typically a cheaper one, for features that do not need the main model's capability. Its consumer today is subagent spawning: when set, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model; when unset, subagents inherit the main agent's model. +The secondary model is a second model configuration alongside the main model — typically a cheaper one, for features that do not need the main model's capability. Its consumer today is subagent spawning. Both engines read this section, but different keys from it, and both gate the feature behind the secondary-model experiment: + +- The default `agent-core-v2` engine (`kimi`, `kimi -p`, and `kimi web`) reads the [subagent model pool](#subagent-model-pool): `default_model` and the `[secondary_model.models]` table, and also honors a lone recipe `model` key as a fallback default. +- The legacy `agent-core` engine, selected for `kimi` / `kimi -p` with `KIMI_CODE_LEGACY_FLAG=1`, reads the [recipe keys](#secondary-model-recipe) (`model`, `default_effort`, and the patch fields). + +### Subagent model pool + +This feature is experimental and disabled by default. Enable it with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master `KIMI_CODE_EXPERIMENTAL_FLAG=1`. It takes effect in every launch mode, including the interactive TUI. While the experiment is off, the pool keys stay inert: subagents inherit the caller's model and session startup skips the pool validation. + +The pool is read by the `agent-core-v2` engine only; the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1` ignores `default_model` and `[secondary_model.models]`, and resolves subagent models through the [recipe keys](#secondary-model-recipe) instead. + +To simply point every subagent at one model by default, no models table is needed — a single `default_model` line is a pool with a single entry: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +``` + +In the interactive TUI, the [`/secondary-model`](../reference/slash-commands.md) command (alias `/subagent-model`) opens a model selector for this: the choice is written to `default_model` (when a models table exists and the picked alias is not in it, an entry with an empty description is added), and newly spawned subagents pick up the new default immediately — no session restart needed. + +| Field | Type | Default | Description | +| --- | --- | --- | --- | +| `default_model` | `string` | — | Default subagent model. Required when `[secondary_model.models]` is configured, and must be one of its keys; written on its own (without a models table) it is equivalent to a pool containing only that entry | +| `models` | `table` | — | Subagent model pool. Each key is the alias of a configured [`[models]`](#models) entry; each value is the description the main agent sees when picking a subagent model (Chinese or English; an empty string lists the alias with no hint) | +| `force` | `boolean` | `false` | Pin every subagent to `default_model`: the `model` parameter is not advertised, so the main agent cannot pick another model or `"primary"`. Requires `default_model` (or a lone `model` key); cannot be combined with `[secondary_model.models]` | + +A configured pool — an explicit `[secondary_model.models]` table or a lone `default_model` — enables model selection: the `Agent` / `AgentSwarm` tools gain a `model` parameter, and the tool description lists the pool (the default marked `[default]`) so the main agent can choose per spawn (unless `force` is set — see below). The pool only references configured [`[models]`](#models) entries — the `kimi-code/*` aliases below are provisioned by `/login` — and attaches the selection hints: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +[secondary_model.models] +"kimi-code/k3" = "难题选它。擅长复杂推理、算法设计、深度调试、数学和系统性难题。" +"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" +"kimi-code/kimi-for-coding" = "均衡的编码主力。适合大多数功能开发和代码修改任务。" +``` + +A spawn resolves the subagent's model in this order: an explicit tool-call `model` → `default_model`. The `model` parameter accepts any pool alias, or `"primary"` — the model the caller itself is running, always valid even when that model is not in the pool. When neither `default_model` nor `[secondary_model.models]` is configured, the parameter is not advertised and subagents inherit the caller's model. Binding a pool alias carries no explicit thinking effort — the subagent resolves it naturally (global `[thinking]` config → the bound model's default effort) instead of inheriting the caller's level, while `"primary"` inherits both the model and the level from the caller. + +To take the choice away from the main agent entirely — every subagent runs on one fixed model — add `force = true`: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +force = true +``` + +With `force` set, the `model` parameter is not advertised (just like when nothing is configured) and every spawn binds `default_model`; an explicit `model` argument, `"primary"` included, is rejected with an error. `force` requires `default_model` (or a lone `model` key) and cannot be combined with a `[secondary_model.models]` table — the table exists to offer a choice, and force removes it. + +Because natural resolution lands on the bound model's default effort, different pool entries can carry different thinking levels: register a second `[models]` entry as a "variant" of the same underlying model, override only its `default_effort` via [`[models."".overrides]`](#model-overrides), and list both aliases in the pool — the main agent picks the thinking level together with the alias: + +```toml +# "kimi-code/kimi-for-coding-highspeed" is provisioned by /login; this +# registers a higher-effort variant of the same model +[models.kimi-for-coding-highspeed-deep] +provider = "managed:kimi-code" +model = "kimi-for-coding-highspeed" + +[models.kimi-for-coding-highspeed-deep.overrides] +default_effort = "high" + +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +[secondary_model.models] +"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" +kimi-for-coding-highspeed-deep = "同一模型的高 Thinking 档位。适合较难的子任务。" +``` + +Note that `default_effort` stays a model-level default: once a global `[thinking].effort` is set, it wins for the main agent and subagents alike, and the variant's default only applies when no global effort is set. Value and fallback rules follow the [`[models]` entry's `default_effort`](#models). + +Configuration errors fail loudly instead of falling back silently: session creation, resume, and fork all fail at startup when `default_model` is missing, is not a pool key, or a pool key does not resolve to a configured `[models]` entry — and likewise when `force` is set without `default_model` or combined with a `[secondary_model.models]` table. The alias `primary` is reserved — it always binds the caller's own model — and is rejected as a pool key. A spawn whose `model` is neither a pool alias nor `"primary"` fails with an error listing the available choices. + +The pool keys used to live under `[subagent]`; a leftover `[subagent] default_model` or `[subagent.models]` table no longer applies and is reported as a deprecation warning — move them into `[secondary_model]` as shown above. + +When only the recipe `model` key is set — no `default_model`, no `[secondary_model.models]` table — the v2 engine reads it compatibly as the pool default: an implicit single-entry pool ranked below `default_model`, so a recipe setup keeps working unchanged. The compatibility only takes the model alias, though: the recipe patch fields (`default_effort`, `max_output_size`, …) do not carry over — write those settings onto the `[models]` entry the alias points to, for example via [`[models."".overrides]`](#model-overrides). Once a `[secondary_model.models]` table is configured, `default_model` stays required and `model` does not substitute for it. + +To migrate explicitly, point the pool default at the same alias: + +```toml +# Before +[secondary_model] +model = "kimi-code/kimi-for-coding-highspeed" + +# After +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +``` + +The recipe keys can stay in the section: the legacy engine keeps reading them. + +### Secondary-model recipe + +This reading is used by the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`; the default v2 engine ignores the recipe keys. When set, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model; when unset, subagents inherit the main agent's model. This is a default binding, not a forced one. With the experiment enabled, the `Agent` / `AgentSwarm` tools gain a `model` parameter (accepting only the symbolic values `"secondary"` / `"primary"`), and the tool description lists the available models with the default marked. A spawn resolves the subagent's model in this order: an explicit tool-call `model` → the profile's [`model_preference`](../customization/agents.md#agent-file-format) → the configured secondary model (the default). Here `"primary"` means the model the main agent is currently running, not necessarily `default_model` — for example after a mid-session `/model` switch. @@ -200,11 +292,9 @@ Because overriding the default is the main agent's own decision (the tool descri This feature is experimental and disabled by default. Enable it with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master `KIMI_CODE_EXPERIMENTAL_FLAG=1`. It takes effect in every launch mode, including the interactive TUI. -In the interactive TUI, the [`/secondary_model`](../reference/slash-commands.md) command opens a model picker that writes this section and live-applies it to the current session, so newly spawned subagents bind the new secondary model right away. - | Field | Type | Default | Description | | --- | --- | --- | --- | -| `model` | `string` | — | The alias of a configured [`[models]`](#models) entry, e.g. `kimi-code/kimi-k2.5` (any provider, not limited to Kimi models) | +| `model` | `string` | — | The alias of a configured [`[models]`](#models) entry, e.g. `kimi-code/kimi-for-coding` (any provider, not limited to Kimi models) | | `default_effort` | `string` | — | Thinking effort applied when subagents bind to the secondary model. Unset, the effort resolves naturally (global `[thinking]` config → the bound model's default effort) instead of inheriting the main agent's effort. Follows the main model's thinking-effort semantics: models with strict effort validation (e.g. Kimi models) fall back to their default effort for unsupported values; other providers receive the value as-is | | Other fields | — | — | Accepts every field of [`[models."".overrides]`](#models) (`max_context_size`, `max_output_size`, `support_efforts`, …) as a model patch applied only to subagents | @@ -212,7 +302,7 @@ Every field besides `model` forms a patch: when at least one patch field is set, ```toml [secondary_model] -model = "kimi-code/kimi-k2.5" +model = "kimi-code/kimi-for-coding" default_effort = "low" max_output_size = 8192 ``` @@ -285,11 +375,16 @@ In print mode (`kimi -p ""`), Kimi Code stays alive after the main agent ## `subagent` +`subagent` controls how spawned subagents (`Agent` / `AgentSwarm`) run. + | Field | Type | Default | Description | | --- | --- | --- | --- | | `timeout_ms` | `integer` | `7200000` (2 hours) | Maximum wall-clock time (milliseconds) a single subagent (`Agent` / `AgentSwarm`) is allowed to run before it is settled as `timed_out`. `0` means no timeout — the subagent runs until it finishes or the model stops it. This is the background-task manager's per-task timeout for each subagent task, so it applies to both foreground and background subagents. In print mode (`kimi -p`) the default is `0` unless explicitly set. Note: any value above `2147483647` (about 24.8 days) is clamped to roughly 24.8 days by the runtime | + `timeout_ms` can be overridden by the `KIMI_SUBAGENT_TIMEOUT_MS` environment variable, which takes higher priority than `config.toml`. +The model pool that used to be configured here (`default_model`, `[subagent.models]`) moved to the [subagent model pool](#subagent-model-pool) under `[secondary_model]`; the old keys no longer apply and are reported as deprecation warnings. + ## `mcp` | Field | Type | Default | Description | diff --git a/docs/en/configuration/env-vars.md b/docs/en/configuration/env-vars.md index 67a6371f3dd..dfd3962a7c2 100644 --- a/docs/en/configuration/env-vars.md +++ b/docs/en/configuration/env-vars.md @@ -134,7 +134,7 @@ Switches that control the behavior of subsystems such as telemetry, background t | `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | Whether the built-in skills documenting Kimi Code itself are offered to the model; takes higher priority than `builtin_product_skills` in `config.toml` (default enabled) | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | | `KIMI_CODE_TUI_FULL_SCREEN` | Enable the experimental fullscreen alternate-screen UI: scrollable transcript viewport, mouse text selection, clickable links, and Ctrl-Shift-F transcript search | `1` enables it; anything else keeps the regular inline UI | | `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | Enable the experimental secondary-model feature in every launch mode, including the interactive TUI; the master `KIMI_CODE_EXPERIMENTAL_FLAG=1` also enables it | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | -| `KIMI_SECONDARY_MODEL` | Secondary model; takes higher priority than [`[secondary_model] model`](./config-files.md#secondary-model) in `config.toml`. When the secondary-model experiment is enabled, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model | The alias of a configured `[models]` entry, e.g. `kimi-code/kimi-k2.5`; blank values are ignored | +| `KIMI_SECONDARY_MODEL` | Secondary model; takes higher priority than [`[secondary_model] model`](./config-files.md#secondary-model) in `config.toml`. When the secondary-model experiment is enabled, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model | The alias of a configured `[models]` entry, e.g. `kimi-code/kimi-for-coding`; blank values are ignored | | `KIMI_SECONDARY_EFFORT` | Thinking effort for the secondary model; takes higher priority than `[secondary_model] default_effort` in `config.toml` and applies only when both the model and its experiment are enabled | An effort value, e.g. `low`; blank values are ignored | | `KIMI_MCP_STARTUP_TIMEOUT_MS` | Global default connection timeout (ms) for all MCP servers; takes higher priority than `[mcp] startup_timeout_ms` in `config.toml`, but a per-server `startupTimeoutMs` in `mcp.json` still wins (default `30000`) | Integer from `1` to `2147483647`; invalid values are ignored | | `KIMI_MCP_TOOL_TIMEOUT_MS` | Global default single tool-call timeout (ms) for all MCP servers; takes higher priority than `[mcp] tool_timeout_ms` in `config.toml`, but a per-server `toolTimeoutMs` in `mcp.json` still wins (default `60000`) | Integer from `1` to `2147483647`; invalid values are ignored | @@ -156,7 +156,7 @@ Switches that control the behavior of subsystems such as telemetry, background t | `KIMI_CODE_NO_AUTO_UPDATE` | Fully disable the update preflight — no check, background install, or prompt. Legacy alias `KIMI_CLI_NO_AUTO_UPDATE` is also honored | Truthy: `1`/`true`/`yes`/`on` | | `KIMI_DISABLE_CRON` | Disable the scheduled-task tool (`CronCreate` rejects new schedules; existing tasks do not fire) | `1` to disable | -The three `KIMI_CODE_IDENTITY_*` / `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` variables are read by the default `agent-core-v2` engine. The legacy `kimi` / `kimi -p` path selected with `KIMI_CODE_LEGACY_FLAG=1` ignores them. +The three `KIMI_CODE_IDENTITY_*` / `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` variables are read by the default `agent-core-v2` engine. The legacy `kimi` / `kimi -p` path selected with `KIMI_CODE_LEGACY_FLAG=1` ignores them. Conversely, `KIMI_SECONDARY_MODEL` and `KIMI_SECONDARY_EFFORT` are read by the legacy engine only, and the default engine ignores them; `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` is read by both engines (it gates the v2 [subagent model pool](./config-files.md#subagent-model-pool) and the legacy [secondary-model recipe](./config-files.md#secondary-model-recipe) alike). ## Diagnostic logs diff --git a/docs/en/customization/agents.md b/docs/en/customization/agents.md index 2b247a3a025..9cdb6e43d98 100644 --- a/docs/en/customization/agents.md +++ b/docs/en/customization/agents.md @@ -100,7 +100,7 @@ You are a strict code reviewer. Read the diff, then report findings grouped by s | `description` | yes | What the agent does. Shown to the main Agent when it picks a sub-agent, so write it to guide delegation decisions | | `whenToUse` | no | Extra hint describing when the agent should be used | | `override` | no | Whether this file may replace a same-name built-in Agent. Defaults to `false`; `--agent-file` is already explicit and does not require this field | -| `model_preference` | no | Symbolic default used when `Agent` or `AgentSwarm` spawns this profile: `primary` selects the model the caller is currently running, while `secondary` selects [`[secondary_model] model`](../configuration/config-files.md#secondary-model). An explicit tool-call `model` (which likewise accepts only `"primary"` / `"secondary"`) wins over this field; without either setting, the configured secondary model remains the default. If no secondary model is configured, the subagent inherits the caller's model | +| `model_preference` | no | Symbolic default used when `Agent` or `AgentSwarm` spawns this profile: `primary` selects the model the caller is currently running, while `secondary` selects [`[secondary_model] model`](../configuration/config-files.md#secondary-model). An explicit tool-call `model` (which likewise accepts only `"primary"` / `"secondary"`) wins over this field; without either setting, the configured secondary model remains the default. If no secondary model is configured, the subagent inherits the caller's model. Read only by the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`; the default v2 engine ignores this field | | `tools` | no | Allowlist of tool names such as `Read` or `Bash`; MCP tools are matched with globs such as `mcp__github__*`. Accepts a YAML list or a comma-separated string (`tools: Read, Grep`). Omit to allow all tools; a lone `*` also allows all tools; an empty list (`tools: []`) disables all tools | | `disallowedTools` | no | Denylist with the same syntax and matching rules, applied after `tools` | | `subagents` | no | Allowlist of sub-agent names this agent may delegate to, with the same syntax as `tools` (YAML list or comma-separated string). Omit to allow every type; a lone `*` also allows all types | diff --git a/docs/en/reference/slash-commands.md b/docs/en/reference/slash-commands.md index f4aa141714b..e8c112bcdda 100644 --- a/docs/en/reference/slash-commands.md +++ b/docs/en/reference/slash-commands.md @@ -16,7 +16,7 @@ Some commands are only available in the idle state. Executing these commands whi | `/logout` | — | Clear credentials for the currently selected account | No | | `/provider` | — | Open the interactive provider manager to view, add, and remove configured providers. See [Platforms & Models — `/provider` and provider management](../configuration/providers.md#provider-—-interactive-provider-management) | Yes | | `/model` | — | Switch the LLM model used in the current session | Yes | -| `/secondary_model` | — | Configure the secondary model that newly spawned subagents bind to by default (writes the [`[secondary_model]`](../configuration/config-files.md#secondary-model) section and applies to the current session immediately). Requires the `secondary-model` experiment | Yes | +| `/secondary-model` | `/subagent-model` | Pick the default model for subagents (writes `[secondary_model] default_model`; see the [subagent model pool](../configuration/config-files.md#subagent-model-pool)). Visible when the secondary-model experiment is enabled | Yes | | `/settings` | `/config` | Open the settings panel inside the TUI | Yes | | `/experiments` | `/experimental` | Open the experimental feature panel | Yes | | `/permission` | — | Select a permission mode | Yes | diff --git a/docs/en/reference/tools.md b/docs/en/reference/tools.md index 8b412b53667..c0ea9401086 100644 --- a/docs/en/reference/tools.md +++ b/docs/en/reference/tools.md @@ -89,9 +89,9 @@ Collaboration tools handle inter-Agent coordination, user interaction, and Skill | `AskUserQuestion` | Auto-allow | Ask the user a question to gather structured input | | `Skill` | Auto-allow | Invoke a registered inline Skill | -**`Agent`** delegates a subtask to a sub-Agent. Required parameters: `prompt` (complete task description) and `description` (a 3–5 word short summary). Optional parameters: `subagent_type` (defaults to `coder`), `resume` (ID of an existing Agent to resume; mutually exclusive with `subagent_type`), `run_in_background` (defaults to false), and `model` (`"secondary"` for the secondary model configured via `[secondary_model] model`, or `"primary"` for the main model; ignored when resuming; available when the secondary-model experiment is enabled). An explicit `model` overrides the selected [agent profile's `model_preference`](../customization/agents.md#agent-file-format); without either, the configured secondary model is the default, or the subagent inherits the caller's model when no secondary model is configured. Agent tasks time out after 2 hours by default; the limit is configurable via `[subagent] timeout_ms` in `config.toml` (`0` = no timeout, or the `KIMI_SUBAGENT_TIMEOUT_MS` env var), and defaults to no timeout in print mode (`kimi -p`). In foreground mode the parent Agent waits for the sub-Agent to complete before continuing; in background mode a task ID is returned immediately and the result is automatically delivered back to the main Agent via a synthetic User message when done. When several foreground `Agent` calls run in the same step, the TUI groups them and shows each subagent's running, waiting, completed, or failed status with elapsed time. See [Agent & Sub-Agents](../customization/agents.md) for details. +**`Agent`** delegates a subtask to a sub-Agent. Required parameters: `prompt` (complete task description) and `description` (a 3–5 word short summary). Optional parameters: `subagent_type` (defaults to `coder`), `resume` (ID of an existing Agent to resume; mutually exclusive with `subagent_type`), `run_in_background` (defaults to false), and `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`: a pool alias, or `"primary"` for the model the caller itself is running; ignored when resuming). Without it, the subagent binds the pool's `default_model`; without a configured pool, subagents always inherit the caller's model. That is the default v2 engine behavior; on the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`, `model` is available when the [secondary-model experiment](../configuration/config-files.md#secondary-model) is enabled instead, accepting only `"secondary"` / `"primary"` — an explicit choice overrides the profile's [`model_preference`](../customization/agents.md#agent-file-format), and the configured secondary model is the default. Agent tasks time out after 2 hours by default; the limit is configurable via `[subagent] timeout_ms` in `config.toml` (`0` = no timeout, or the `KIMI_SUBAGENT_TIMEOUT_MS` env var), and defaults to no timeout in print mode (`kimi -p`). In foreground mode the parent Agent waits for the sub-Agent to complete before continuing; in background mode a task ID is returned immediately and the result is automatically delivered back to the main Agent via a synthetic User message when done. When several foreground `Agent` calls run in the same step, the TUI groups them and shows each subagent's running, waiting, completed, or failed status with elapsed time. See [Agent & Sub-Agents](../customization/agents.md) for details. -**`AgentSwarm`** launches subagents from a shared `prompt_template` and an `items` array, resumes existing subagents through `resume_agent_ids`, or combines both in one call. The template must contain the `{{item}}` placeholder; each item replaces that placeholder and launches one new subagent. Pass `subagent_type` to choose the profile used by every spawned subagent in the swarm, or omit it to use `coder`. Pass `model` (available when the secondary-model experiment is enabled) to run item-spawned subagents on the secondary model configured via `[secondary_model] model` (`"secondary"`) or the main model (`"primary"`). This explicit choice overrides the selected [agent profile's `model_preference`](../customization/agents.md#agent-file-format); without either, the configured secondary model is the default, or the subagent inherits the caller's model when no secondary model is configured. Resumed subagents keep their own model. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all subagents to finish, and returns an aggregated report. In the TUI, foreground swarms show a live `Agent swarm` progress panel above the input box. If a model response calls `AgentSwarm`, that call must be the only tool call in the response; to run multiple swarms, call one `AgentSwarm`, wait for its result, then call the next, or combine the work into one swarm when a single template can cover it. In `manual` permission mode, `AgentSwarm` calls outside active swarm mode request approval unless a permission rule allows them; while swarm mode is active, `AgentSwarm` itself is auto-approved. Permission rules match `AgentSwarm` by tool name only — argument patterns such as `AgentSwarm(swarm)` are not supported. By default the tool ramps up concurrency without an upper limit (5 subagents start immediately, then 1 more every 700 ms); set `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` to a positive integer to cap how many subagents run at the same time during that ramp, or leave it unset for no cap. If it is set to a value that is not a positive integer, the AgentSwarm call fails fast. +**`AgentSwarm`** launches subagents from a shared `prompt_template` and an `items` array, resumes existing subagents through `resume_agent_ids`, or combines both in one call. The template must contain the `{{item}}` placeholder; each item replaces that placeholder and launches one new subagent. Pass `subagent_type` to choose the profile used by every spawned subagent in the swarm, or omit it to use `coder`. Pass `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`) to run item-spawned subagents on a pool alias or on the caller's own model (`"primary"`). Without it, item-spawned subagents bind the pool's `default_model`; without a configured pool, they inherit the caller's model. On the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`, `model` follows the [secondary-model experiment](../configuration/config-files.md#secondary-model) instead (`"secondary"` / `"primary"`, defaulting to the configured secondary model). Resumed subagents keep their own model. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all subagents to finish, and returns an aggregated report. In the TUI, foreground swarms show a live `Agent swarm` progress panel above the input box. If a model response calls `AgentSwarm`, that call must be the only tool call in the response; to run multiple swarms, call one `AgentSwarm`, wait for its result, then call the next, or combine the work into one swarm when a single template can cover it. In `manual` permission mode, `AgentSwarm` calls outside active swarm mode request approval unless a permission rule allows them; while swarm mode is active, `AgentSwarm` itself is auto-approved. Permission rules match `AgentSwarm` by tool name only — argument patterns such as `AgentSwarm(swarm)` are not supported. By default the tool ramps up concurrency without an upper limit (5 subagents start immediately, then 1 more every 700 ms); set `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` to a positive integer to cap how many subagents run at the same time during that ramp, or leave it unset for no cap. If it is set to a value that is not a positive integer, the AgentSwarm call fails fast. **`AskUserQuestion`** asks the user a structured multiple-choice question — useful for disambiguation or option selection. The `questions` parameter accepts 1–4 questions; each question requires `question` (ending with `?`), `options` (2–4 choices, each with a `label` and `description`), and optional `header` (max 12 characters) and `multi_select` (defaults to false). An "Other" option is appended automatically. Setting `background` to true starts a background question task and returns a task ID immediately. When the host does not support interactive questioning, a failure message is returned and the Agent should ask the user directly in a text reply instead. diff --git a/docs/zh/configuration/config-files.md b/docs/zh/configuration/config-files.md index 4c29a45e16f..cad6859698e 100644 --- a/docs/zh/configuration/config-files.md +++ b/docs/zh/configuration/config-files.md @@ -192,7 +192,98 @@ display_name = "Kimi for Coding (custom)" ## `secondary_model` -次主力模型是主模型之外的第二个模型配置——通常是一个更便宜的模型,供不需要主模型能力的功能绑定使用。它目前的消费者是子 Agent 派生:设置后,新派生的子 Agent(`Agent` / `AgentSwarm`)默认绑定该模型,而不再继承主 Agent 的模型;未设置时,子 Agent 继承主 Agent 的模型。 +次主力模型是主模型之外的第二个模型配置——通常是一个更便宜的模型,供不需要主模型能力的功能绑定使用。它目前的消费者是子 Agent 派生。两个引擎都会读取本节,但各取不同的键,且都以次主力模型实验功能为开关: + +- 默认的 `agent-core-v2` 引擎(`kimi`、`kimi -p` 和 `kimi web`)读取[子 Agent 模型池](#子-agent-模型池):`default_model` 与 `[secondary_model.models]` 表,并兼容读取单独的配方键 `model` 作为兜底。 +- 使用 `KIMI_CODE_LEGACY_FLAG=1` 为 `kimi` / `kimi -p` 选择旧版 `agent-core` 引擎后,该引擎读取[配方键](#次主力模型配方)(`model`、`default_effort` 及补丁字段)。 + +### 子 Agent 模型池 + +该功能目前是实验功能,默认关闭。通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用,或使用 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。实验功能关闭时,模型池配置不生效:子 Agent 继承调用方模型,会话启动也会跳过池校验。 + +模型池仅由 `agent-core-v2` 引擎读取;使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎会忽略 `default_model` 和 `[secondary_model.models]`,子 Agent 模型按[配方键](#次主力模型配方)解析。 + +只想让所有子 Agent 默认换用一个模型时不需要 models 表——一行 `default_model` 就是只含一个条目的模型池: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +``` + +在交互式 TUI 中,也可以用 [`/secondary-model`](../reference/slash-commands.md) 命令(别名 `/subagent-model`)打开模型选择器来设置:选择后写入 `default_model`(已有 models 表而所选别名不在其中时,会一并补一条空描述条目),之后派生的子 Agent 立即按新默认值绑定,无需重启会话。 + +| 字段 | 类型 | 默认值 | 说明 | +| --- | --- | --- | --- | +| `default_model` | `string` | — | 子 Agent 默认模型。配置 `[secondary_model.models]` 时必填,且必须是其中的 key;单独写下它(不写 models 表)则等价于只含它一个条目的模型池 | +| `models` | `table` | — | 子 Agent 模型池。key 是 [`[models]`](#models) 中已配置条目的别名,value 是主 Agent 挑选子 Agent 模型时看到的描述(中英文均可;空字符串表示只列出别名、不给提示) | +| `force` | `boolean` | `false` | 把所有子 Agent 固定到 `default_model`:不再提供 `model` 参数,主 Agent 无法改选其他模型或 `"primary"`。必须配置 `default_model`(或兼容读取的 `model` 键),且不能与 `[secondary_model.models]` 同时使用 | + +配置模型池(显式的 `[secondary_model.models]` 表,或仅一行 `default_model` 形成的隐式单条目池)即启用模型选择:`Agent` / `AgentSwarm` 工具会获得 `model` 参数,工具描述中会列出模型池(默认模型标注 `[default]`),主 Agent 可按次派生选择模型(除非设置了 `force`,见下文)。模型池只引用已配置的 [`[models]`](#models) 条目——下面的 `kimi-code/*` 别名由 `/login` 自动提供——并附上挑选提示: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +[secondary_model.models] +"kimi-code/k3" = "难题选它。擅长复杂推理、算法设计、深度调试、数学和系统性难题。" +"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" +"kimi-code/kimi-for-coding" = "均衡的编码主力。适合大多数功能开发和代码修改任务。" +``` + +派生时按以下顺序解析子 Agent 的模型:工具调用显式传入的 `model` → `default_model`。`model` 参数接受池中任意别名,或 `"primary"` ——调用方自己正在运行的模型,始终合法,即使它不在池中。`default_model` 与 `[secondary_model.models]` 都未配置时,该参数不会出现,子 Agent 继承调用方模型。绑定池中别名时不携带显式 Thinking 档位——子 Agent 按 "全局 `[thinking]` 配置 → 所绑定模型的默认 effort" 自然解析,不继承调用方的档位;`"primary"` 则连模型带档位一起继承调用方。 + +要彻底收回主 Agent 的选择权——让所有子 Agent 固定跑在同一个模型上——加上 `force = true`: + +```toml +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +force = true +``` + +设置 `force` 后不再提供 `model` 参数(与完全未配置时一样),每次派生都绑定 `default_model`;显式传入 `model`(包括 `"primary"`)会报错。`force` 必须搭配 `default_model`(或单独的 `model` 键),且不能与 `[secondary_model.models]` 表同时使用——表的意义在于提供选择,而 force 取消了选择。 + +利用自然解析会落到所绑定模型的默认 effort 这一点,可以给池中不同条目配不同的 Thinking 档位:为同一个底层模型再注册一个 `[models]` 条目作为「变体」,用 [`[models."".overrides]`](#模型覆盖项) 只覆盖 `default_effort`,再把两个别名都放进模型池——主 Agent 挑选别名时便同时选定了档位: + +```toml +# "kimi-code/kimi-for-coding-highspeed" 由 /login 提供;这里为同一模型注册一个高档位变体 +[models.kimi-for-coding-highspeed-deep] +provider = "managed:kimi-code" +model = "kimi-for-coding-highspeed" + +[models.kimi-for-coding-highspeed-deep.overrides] +default_effort = "high" + +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +[secondary_model.models] +"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" +kimi-for-coding-highspeed-deep = "同一模型的高 Thinking 档位。适合较难的子任务。" +``` + +注意 `default_effort` 是模型级默认值:一旦设置了全局 `[thinking].effort`,它对主 Agent 和子 Agent 都优先生效,变体的默认档位只在全局未设置时起作用。取值与回落规则同 [`[models]` 条目的 `default_effort`](#models)。 + +配置错误一律直接报错,不做静默回退:`default_model` 缺失、不是池中 key,或池中 key 无法解析到已配置的 `[models]` 条目时,会话的创建、恢复(resume)与 fork 都会在启动时直接失败;`force` 未搭配 `default_model` 或与 `[secondary_model.models]` 表同用时亦然。别名 `primary` 是保留字——它始终绑定调用方自己的模型——不能作为池中 key。工具调用传入的 `model` 既不是池中别名也不是 `"primary"` 时,本次派生报错并列出可选值。 + +模型池键之前位于 `[subagent]` 下;遗留的 `[subagent] default_model` 或 `[subagent.models]` 表不再生效,并会以弃用警告的形式报告——按上文示例移入 `[secondary_model]` 即可。 + +只写了配方键 `model`(没有 `default_model`,也没有 `[secondary_model.models]` 表)时,v2 引擎会兼容读取它,把该别名当作池的默认模型——等价于只含它一个条目的隐式模型池,优先级低于 `default_model`,所以从配方迁移过来不改配置也能工作。注意兼容只取模型别名:补丁字段(`default_effort`、`max_output_size` 等)不会随之生效——请把这些设置写到别名指向的 `[models]` 条目上,例如通过 [`[models."".overrides]`](#模型覆盖项)。一旦配置了 `[secondary_model.models]` 表,`default_model` 依旧必填,`model` 不能顶替。 + +要显式迁移,把模型别名改为池的默认模型即可: + +```toml +# 旧 +[secondary_model] +model = "kimi-code/kimi-for-coding-highspeed" + +# 新 +[secondary_model] +default_model = "kimi-code/kimi-for-coding-highspeed" +``` + +配方键可以继续留在本节中:旧版引擎会照常读取它们。 + +### 次主力模型配方 + +该读法由使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎使用;默认的 v2 引擎会忽略配方键。设置后,新派生的子 Agent(`Agent` / `AgentSwarm`)默认绑定该模型,而不再继承主 Agent 的模型;未设置时,子 Agent 继承主 Agent 的模型。 这是默认绑定而非强制。实验功能启用后,`Agent` / `AgentSwarm` 工具会获得 `model` 参数(仅接受 `"secondary"` / `"primary"` 两个符号值),工具描述中也会列出可选模型并标注默认值。派生时按以下顺序解析子 Agent 的模型:工具调用显式传入的 `model` → 子 Agent profile 的 [`model_preference`](../customization/agents.md#agent-文件格式) → 已配置的次主力模型(默认)。其中 `"primary"` 指主 Agent 当前正在运行的模型,不一定是 `default_model`——例如会话中途用 `/model` 切换过模型。 @@ -200,11 +291,9 @@ display_name = "Kimi for Coding (custom)" 该功能目前是实验功能,默认关闭。通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用,或使用 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。 -在交互式 TUI 中,可以使用 [`/secondary_model`](../reference/slash-commands.md) 命令打开模型选择器来设置该配置:选择后会写入本小节配置,并在当前会话立即生效——之后派生的子 Agent 会直接绑定新的次主力模型。 - | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | -| `model` | `string` | — | [`[models]`](#models) 中已配置条目的别名,如 `kimi-code/kimi-k2.5`(不限 kimi 模型,可用任意供应商) | +| `model` | `string` | — | [`[models]`](#models) 中已配置条目的别名,如 `kimi-code/kimi-for-coding`(不限 kimi 模型,可用任意供应商) | | `default_effort` | `string` | — | 子 Agent 绑定次主力模型时使用的 thinking effort。未设置时按"全局 `[thinking]` 配置 → 模型默认 effort"的链路解析,不再继承主 Agent 的 effort。与主模型的 thinking effort 语义一致:严格校验 effort 的模型(如 kimi 模型)在不支持该取值时回退到模型默认 effort,其他供应商的模型按原样发送给后端 | | 其他字段 | — | — | 接受 [`[models."".overrides]`](#models) 的全部字段(`max_context_size`、`max_output_size`、`support_efforts` 等),作为仅对子 Agent 生效的模型补丁 | @@ -212,7 +301,7 @@ display_name = "Kimi for Coding (custom)" ```toml [secondary_model] -model = "kimi-code/kimi-k2.5" +model = "kimi-code/kimi-for-coding" default_effort = "low" max_output_size = 8192 ``` @@ -285,11 +374,16 @@ max_output_size = 8192 ## `subagent` +`subagent` 控制派生子 Agent(`Agent` / `AgentSwarm`)的运行方式。 + | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | `timeout_ms` | `integer` | `7200000`(2 小时) | 单个子代理(`Agent` / `AgentSwarm`)允许运行的最长时间(毫秒)。超时后子代理以 `timed_out` 收尾。`0` 表示无超时——子代理一直运行到自行结束或被模型手动停止。该值是后台任务管理器对每个子代理任务的 per-task timeout,因此对前台与后台子代理同时生效。在 print 模式(`kimi -p`)下未显式设置时默认为 `0`。注意:超过 `2147483647`(约 24.8 天)的值会被运行时钳到约 24.8 天 | + `timeout_ms` 可被环境变量 `KIMI_SUBAGENT_TIMEOUT_MS` 覆盖,优先级高于配置文件。 +之前在此配置的模型池(`default_model`、`[subagent.models]`)已移至 `[secondary_model]` 下的[子 Agent 模型池](#子-agent-模型池);旧键不再生效,并会以弃用警告的形式报告。 + ## `mcp` | 字段 | 类型 | 默认值 | 说明 | diff --git a/docs/zh/configuration/env-vars.md b/docs/zh/configuration/env-vars.md index fef8e3867bc..5195767cf3d 100644 --- a/docs/zh/configuration/env-vars.md +++ b/docs/zh/configuration/env-vars.md @@ -134,8 +134,8 @@ kimi | `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | 是否向模型提供介绍 Kimi Code 自身的内置 Skills,优先级高于 `config.toml` 的 `builtin_product_skills`(默认开启) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_TUI_FULL_SCREEN` | 启用实验性的 fullscreen alternate-screen 界面:可滚动的 transcript 视口、鼠标选择文本、可点击链接、Ctrl-Shift-F 搜索 | `1` 开启;其他值保持常规内联界面 | | `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | 在包括交互式 TUI 在内的所有启动方式下启用实验性的次主力模型功能;master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 也会启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | -| `KIMI_SECONDARY_MODEL` | 次主力模型;优先级高于 `config.toml` 的 [`[secondary_model] model`](./config-files.md#secondary-model)。次主力模型实验功能启用后,新派生的子 Agent 默认绑定该模型,而不再继承主 Agent 的模型 | `[models]` 中已配置条目的别名,如 `kimi-code/kimi-k2.5`;空白值被忽略 | -| `KIMI_SECONDARY_EFFORT` | 次主力模型的 thinking effort;优先级高于 `config.toml` 的 `[secondary_model] default_effort`,仅在次主力模型及其实验功能均启用时生效 | effort 取值,如 `low`;空白值被忽略 | +| `KIMI_SECONDARY_MODEL` | 次主力模型;优先级高于 `config.toml` 的 [`[secondary_model] model`](./config-files.md#secondary-model)。次主力模型实验功能启用后,新派生的子 Agent 默认绑定该模型,而不再继承主 Agent 的模型 | `[models]` 中已配置条目的别名,如 `kimi-code/kimi-for-coding`;空白值被忽略 | +| `KIMI_SECONDARY_EFFORT` | 次主力模型的 thinking effort;优先级高于 `[secondary_model] default_effort`,仅在次主力模型及其实验功能均启用时生效 | effort 取值,如 `low`;空白值被忽略 | | `KIMI_MCP_STARTUP_TIMEOUT_MS` | 所有 MCP server 的全局默认连接超时(毫秒);优先级高于 `config.toml` 的 `[mcp] startup_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `startupTimeoutMs`(默认 `30000`) | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_MCP_TOOL_TIMEOUT_MS` | 所有 MCP server 的全局默认单次工具调用超时(毫秒);优先级高于 `config.toml` 的 `[mcp] tool_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `toolTimeoutMs`(默认 `60000`) | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_LOOP_MAX_STEPS_PER_TURN` | Agent 单轮最大步数;优先级高于 `config.toml` 的 `[loop_control] max_steps_per_turn`(不设或 `0` 表示无上限) | 非负整数;非法值被忽略 | @@ -156,7 +156,7 @@ kimi | `KIMI_CODE_NO_AUTO_UPDATE` | 完全禁用更新预检——不检查、不后台安装、不提示。同时兼容旧名 `KIMI_CLI_NO_AUTO_UPDATE` | 真值:`1`/`true`/`yes`/`on` | | `KIMI_DISABLE_CRON` | 禁用定时任务工具(`CronCreate` 拒绝新计划,已有任务不触发) | `1` 表示禁用 | -`KIMI_CODE_IDENTITY_*` 和 `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` 这三个变量由默认的 `agent-core-v2` 引擎读取。设置 `KIMI_CODE_LEGACY_FLAG=1` 后,旧版 `kimi` / `kimi -p` 路径会忽略它们。 +`KIMI_CODE_IDENTITY_*` 和 `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` 这三个变量由默认的 `agent-core-v2` 引擎读取。设置 `KIMI_CODE_LEGACY_FLAG=1` 后,旧版 `kimi` / `kimi -p` 路径会忽略它们。反过来,`KIMI_SECONDARY_MODEL` 和 `KIMI_SECONDARY_EFFORT` 仅由旧版引擎读取,默认引擎会忽略它们;`KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` 则由两个引擎共同读取(它同时门控 v2 的[子 Agent 模型池](./config-files.md#子-agent-模型池)和旧版的[次主力模型配方](./config-files.md#次主力模型配方))。 ## 诊断日志 diff --git a/docs/zh/customization/agents.md b/docs/zh/customization/agents.md index 97d98de3e22..0dffbe352be 100644 --- a/docs/zh/customization/agents.md +++ b/docs/zh/customization/agents.md @@ -100,7 +100,7 @@ disallowedTools: | `description` | 是 | Agent 的用途。主 Agent 挑选子 Agent 时会看到,请围绕委派决策来写 | | `whenToUse` | 否 | 补充说明何时应使用该 Agent | | `override` | 否 | 是否允许覆盖同名内置 Agent,默认 `false`。`--agent-file` 属于显式启动意图,无需设置此字段 | -| `model_preference` | 否 | `Agent` 或 `AgentSwarm` 启动该 profile 时的符号默认值:`primary` 选择调用方当前运行的模型,`secondary` 选择 [`[secondary_model] model`](../configuration/config-files.md#secondary-model)。工具调用显式传入的 `model`(同样只接受 `"primary"` / `"secondary"` 两个符号值)优先于该字段;两者均未设置时,已配置的次主力模型仍为默认值。未配置次主力模型时,子 Agent 继承调用方模型 | +| `model_preference` | 否 | `Agent` 或 `AgentSwarm` 启动该 profile 时的符号默认值:`primary` 选择调用方当前运行的模型,`secondary` 选择 [`[secondary_model] model`](../configuration/config-files.md#secondary-model)。工具调用显式传入的 `model`(同样只接受 `"primary"` / `"secondary"` 两个符号值)优先于该字段;两者均未设置时,已配置的次主力模型仍为默认值。未配置次主力模型时,子 Agent 继承调用方模型。仅使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎读取该字段;默认的 v2 引擎会忽略 | | `tools` | 否 | 工具名允许列表,如 `Read`、`Bash`;MCP 工具用 glob 匹配,如 `mcp__github__*`。支持 YAML 列表或逗号分隔字符串(`tools: Read, Grep`)两种写法。缺省表示允许全部工具;单独的 `*` 同样表示允许全部工具;空列表(`tools: []`)表示禁用全部工具 | | `disallowedTools` | 否 | 禁止列表,写法与匹配规则相同,在 `tools` 之后应用 | | `subagents` | 否 | 允许委派的子 Agent 名称列表,写法与 `tools` 相同(YAML 列表或逗号分隔字符串)。缺省表示可委派所有类型;单独的 `*` 同样表示全部 | diff --git a/docs/zh/reference/slash-commands.md b/docs/zh/reference/slash-commands.md index 4a8b24451f8..c5a76ce2f16 100644 --- a/docs/zh/reference/slash-commands.md +++ b/docs/zh/reference/slash-commands.md @@ -16,7 +16,7 @@ | `/logout` | — | 清除当前所选账号的凭据 | 否 | | `/provider` | — | 打开交互式供应商管理器,查看、添加和删除已配置的供应商。详见[平台与模型 — `/provider` 与供应商管理](../configuration/providers.md#provider-—-交互式供应商管理) | 是 | | `/model` | — | 切换当前会话使用的 LLM 模型 | 是 | -| `/secondary_model` | — | 配置子 Agent 默认绑定的次主力模型(写入 [`[secondary_model]`](../configuration/config-files.md#secondary-model) 配置并在当前会话立即生效)。需开启 `secondary-model` 实验功能 | 是 | +| `/secondary-model` | `/subagent-model` | 选择子 Agent 的默认模型(写入 `[secondary_model] default_model`,详见[子 Agent 模型池](../configuration/config-files.md#子-agent-模型池))。在次主力模型实验功能启用时可见 | 是 | | `/settings` | `/config` | 打开 TUI 内的设置面板 | 是 | | `/experiments` | `/experimental` | 打开实验功能面板 | 是 | | `/permission` | — | 选择权限模式 | 是 | diff --git a/docs/zh/reference/tools.md b/docs/zh/reference/tools.md index 009ff3d052d..1c2c3fc53cf 100644 --- a/docs/zh/reference/tools.md +++ b/docs/zh/reference/tools.md @@ -89,9 +89,9 @@ Plan 模式是一种受约束的工作状态:进入后 `Write` 与 `Edit` 只 | `AskUserQuestion` | 自动放行 | 向用户提问以获取结构化输入 | | `Skill` | 自动放行 | 调用已注册的 inline Skill | -**`Agent`** 将子任务委托给子 Agent 执行。必填参数:`prompt`(完整任务描述)和 `description`(3–5 个词的简短说明)。可选参数:`subagent_type`(默认 `coder`)、`resume`(恢复已有 Agent 的 ID,与 `subagent_type` 互斥)、`run_in_background`(默认 false)和 `model`(`"secondary"` 表示 `[secondary_model] model` 配置的次主力模型,`"primary"` 表示主模型;resume 时无效;次主力模型实验功能启用后可用)。显式 `model` 会覆盖所选 [Agent profile 的 `model_preference`](../customization/agents.md#agent-文件格式);两者均未设置时,已配置的次主力模型为默认值,未配置时则继承调用方模型。Agent 任务默认 2 小时超时,可通过 `config.toml` 的 `[subagent] timeout_ms`(`0` = 无超时,或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时。前台模式下父 Agent 等待子 Agent 完成再继续;后台模式立即返回任务 ID,完成时通过合成 User 消息自动回到主 Agent。多个前台 `Agent` 调用在同一步运行时,TUI 会合并展示,并为每个子 Agent 显示运行、等待、完成或失败状态以及已耗时长。子 Agent 体系细节见 [Agent 与子 Agent](../customization/agents.md)。 +**`Agent`** 将子任务委托给子 Agent 执行。必填参数:`prompt`(完整任务描述)和 `description`(3–5 个词的简短说明)。可选参数:`subagent_type`(默认 `coder`)、`resume`(恢复已有 Agent 的 ID,与 `subagent_type` 互斥)、`run_in_background`(默认 false)和 `model`(仅在启用 [子 Agent 模型池](../configuration/config-files.md#子-agent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`:池中别名,或 `"primary"` 表示调用方自己运行的模型;resume 时无效)。未传入时子 Agent 绑定池的 `default_model`;未配置模型池时,子 Agent 一律继承调用方模型。以上是默认 v2 引擎的行为;在使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎上,`model` 改为在启用[次主力模型实验功能](../configuration/config-files.md#secondary-model)后可用,仅接受 `"secondary"` / `"primary"`——显式传入会覆盖 profile 的 [`model_preference`](../customization/agents.md#agent-文件格式),默认绑定已配置的次主力模型。Agent 任务默认 2 小时超时,可通过 `config.toml` 的 `[subagent] timeout_ms`(`0` = 无超时,或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时。前台模式下父 Agent 等待子 Agent 完成再继续;后台模式立即返回任务 ID,完成时通过合成 User 消息自动回到主 Agent。多个前台 `Agent` 调用在同一步运行时,TUI 会合并展示,并为每个子 Agent 显示运行、等待、完成或失败状态以及已耗时长。子 Agent 体系细节见 [Agent 与子 Agent](../customization/agents.md)。 -**`AgentSwarm`** 可以从共享的 `prompt_template` 和 `items` 数组启动子 Agent,也可以通过 `resume_agent_ids` 恢复已有子 Agent,或在一次调用中同时使用两者。模板必须包含 `{{item}}` 占位符;每个 item 会替换该占位符,并启动一个新的子 Agent。传入 `subagent_type` 可以指定整个 swarm 中所有新启动的子 Agent 使用的 profile;省略时默认使用 `coder`。传入 `model`(次主力模型实验功能启用后可用)可以让新启动的子 Agent 运行在 `[secondary_model] model` 配置的次主力模型(`"secondary"`)或主模型(`"primary"`)上。这项显式选择会覆盖所选 [Agent profile 的 `model_preference`](../customization/agents.md#agent-文件格式);两者均未设置时,已配置的次主力模型为默认值,未配置时则继承调用方模型。恢复的子 Agent 保持其原有模型。不传 `resume_agent_ids` 时,本工具要求至少 2 个 item;传入 `resume_agent_ids` 时,可以恢复 1 个或多个已有子 Agent。本工具最多支持 128 个子 Agent,会等待全部子 Agent 完成,并返回聚合报告。在 TUI 中,前台 swarm 会在输入框上方显示实时 `Agent swarm` 进度面板。若一次模型响应调用 `AgentSwarm`,该调用必须是该响应中的唯一工具调用;如需运行多个 swarm,应先调用一个 `AgentSwarm` 并等待结果,再调用下一个,若单个模板可以覆盖这些工作,也可以合并为一个 swarm。在 `manual` 权限模式下,未处于 swarm mode 时调用 `AgentSwarm` 会触发审批,除非已有权限规则允许;swarm mode 已开启时,`AgentSwarm` 本身会自动放行。权限规则只能按工具名 `AgentSwarm` 匹配,不支持 `AgentSwarm(swarm)` 这类参数模式。默认情况下,本工具会逐步提升并发且不设上限(立即启动 5 个子 Agent,之后每 700 毫秒再启动 1 个);将 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 设为正整数可限制该阶段同时运行的子 Agent 数量,不设置则表示不限制。若设置为非正整数的值,本次 AgentSwarm 调用会立即失败。 +**`AgentSwarm`** 可以从共享的 `prompt_template` 和 `items` 数组启动子 Agent,也可以通过 `resume_agent_ids` 恢复已有子 Agent,或在一次调用中同时使用两者。模板必须包含 `{{item}}` 占位符;每个 item 会替换该占位符,并启动一个新的子 Agent。传入 `subagent_type` 可以指定整个 swarm 中所有新启动的子 Agent 使用的 profile;省略时默认使用 `coder`。传入 `model`(仅在启用 [子 Agent 模型池](../configuration/config-files.md#子-agent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`)可以让新启动的子 Agent 运行在池中别名指定的模型或调用方自己的模型(`"primary"`)上。未传入时新启动的子 Agent 绑定池的 `default_model`;未配置模型池时则继承调用方模型。在使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎上,`model` 按[次主力模型实验功能](../configuration/config-files.md#secondary-model)工作(`"secondary"` / `"primary"`,默认绑定已配置的次主力模型)。恢复的子 Agent 保持其原有模型。不传 `resume_agent_ids` 时,本工具要求至少 2 个 item;传入 `resume_agent_ids` 时,可以恢复 1 个或多个已有子 Agent。本工具最多支持 128 个子 Agent,会等待全部子 Agent 完成,并返回聚合报告。在 TUI 中,前台 swarm 会在输入框上方显示实时 `Agent swarm` 进度面板。若一次模型响应调用 `AgentSwarm`,该调用必须是该响应中的唯一工具调用;如需运行多个 swarm,应先调用一个 `AgentSwarm` 并等待结果,再调用下一个,若单个模板可以覆盖这些工作,也可以合并为一个 swarm。在 `manual` 权限模式下,未处于 swarm mode 时调用 `AgentSwarm` 会触发审批,除非已有权限规则允许;swarm mode 已开启时,`AgentSwarm` 本身会自动放行。权限规则只能按工具名 `AgentSwarm` 匹配,不支持 `AgentSwarm(swarm)` 这类参数模式。默认情况下,本工具会逐步提升并发且不设上限(立即启动 5 个子 Agent,之后每 700 毫秒再启动 1 个);将 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 设为正整数可限制该阶段同时运行的子 Agent 数量,不设置则表示不限制。若设置为非正整数的值,本次 AgentSwarm 调用会立即失败。 **`AskUserQuestion`** 以结构化多选题的形式向用户提问,适用于需要消歧或选择方案的场景。`questions` 参数接受 1–4 道题,每道题需提供 `question`(以 `?` 结尾)、`options`(2–4 个选项,每项含 `label` 和 `description`)以及可选的 `header`(最多 12 字符)和 `multi_select`(默认 false)。系统自动附加"其他"选项。`background` 为 true 时启动后台问题任务并立即返回任务 ID。宿主未实现交互式提问能力时返回失败提示,Agent 应改为在文本回复中直接提问。 diff --git a/packages/agent-core-v2/docs/config-manifest.toml b/packages/agent-core-v2/docs/config-manifest.toml index a6387283992..463356d4020 100644 --- a/packages/agent-core-v2/docs/config-manifest.toml +++ b/packages/agent-core-v2/docs/config-manifest.toml @@ -8,7 +8,7 @@ # commented "# field: type" lines describe the remaining schema fields. # Values resolve as: default -> config.toml -> env overlay -> memory. -# Index (25 sections · 3 overlay(s)) +# Index (25 sections · 2 overlay(s)) # background src/agent/task/configSection.ts # builtinProductSkills src/app/skillCatalog/configSection.ts # cron src/app/cron/configSection.ts @@ -27,7 +27,7 @@ # models src/app/kosongConfig/configSection.ts # permission src/agent/permissionRules/configSection.ts # providers src/app/kosongConfig/configSection.ts -# secondaryModel src/app/kosongConfig/configSection.ts +# secondaryModel src/session/subagent/configSection.ts # services src/app/auth/configSection.ts # subagent src/session/subagent/configSection.ts # task src/agent/task/configSection.ts @@ -36,7 +36,6 @@ # tools src/agent/toolPolicy/configSection.ts # (overlay) servicesCredentialEnvOverlay src/app/auth/configSection.ts # (overlay) kimiModelEnvOverlay src/app/kosongConfig/envOverlay.ts -# (overlay) secondaryModelOverlay src/app/kosongConfig/secondaryModelOverlay.ts # ########################################################################## # background @@ -318,15 +317,15 @@ merge_all_available_skills = true # ########################################################################## # secondaryModel (config.toml: secondary_model) -# owner: src/app/kosongConfig/configSection.ts +# owner: src/session/subagent/configSection.ts # scope: core -# hooks: stripEnv -# env: -# model <- KIMI_SECONDARY_MODEL (custom parse) -# default_effort <- KIMI_SECONDARY_EFFORT (custom parse) # ########################################################################## [secondary_model] +# default_model: string +# models: record +# force: boolean +# model: string # max_context_size: integer # max_input_size: integer # max_output_size: integer @@ -337,7 +336,6 @@ merge_all_available_skills = true # support_efforts: string[] # default_effort: string # off_effort: string -# model: string # ########################################################################## # services @@ -376,6 +374,9 @@ merge_all_available_skills = true # owner: src/session/subagent/configSection.ts # scope: core # hooks: stripEnv +# deprecations (old key is ignored + warns; rename manually): +# default_model -> secondary_model.default_model +# models -> secondary_model.models # env: # timeout_ms <- KIMI_SUBAGENT_TIMEOUT_MS (custom parse) # ########################################################################## diff --git a/packages/agent-core-v2/src/agent/profile/profileService.ts b/packages/agent-core-v2/src/agent/profile/profileService.ts index 5642e036e2b..08c2ca5f1ba 100644 --- a/packages/agent-core-v2/src/agent/profile/profileService.ts +++ b/packages/agent-core-v2/src/agent/profile/profileService.ts @@ -120,7 +120,6 @@ import { IHostFileSystem } from '#/os/interface/hostFileSystem'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; import type { ToolSource } from '#/tool/toolContract'; import { ISessionWorkspaceContext } from '#/session/workspaceContext/workspaceContext'; -import { subagentDisplayModel } from '#/session/subagent/configSection'; import { ISessionInstructionsProvider } from '#/session/sessionInstructions/instructionsProvider'; import { ISessionSkillCatalog } from '#/session/sessionSkillCatalog/skillCatalog'; import { BUILTIN_SKILL_SOURCE_ID } from '#/app/skillCatalog/skillSource'; @@ -756,7 +755,7 @@ export class AgentProfileService extends Disposable implements IAgentProfileServ const maxContextTokens = capabilities?.max_input_tokens ?? capabilities?.max_context_tokens; this.eventBus.publish({ type: 'agent.status.updated', - model: subagentDisplayModel(this.config, modelAlias), + model: modelAlias, thinkingEffort: includeThinkingEffort ? this.getEffectiveThinkingLevel() : undefined, diff --git a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts index 8f568065097..f5e68826ae3 100644 --- a/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts +++ b/packages/agent-core-v2/src/agent/toolExecutor/toolExecutorService.ts @@ -72,7 +72,10 @@ const ABORT_GRACE_MS = 2_000; const TOOL_OUTPUT_EMPTY = 'Tool output is empty.'; const TOOL_OUTPUT_NON_TEXT = 'Tool returned non-text content.'; -const validators = new WeakMap(); +const validators = new WeakMap< + ExecutableTool, + { schema: Record; validator: ToolArgsValidator } +>(); export interface ToolExecutionTask { readonly accesses: ToolAccesses; @@ -793,16 +796,17 @@ function preflightToolCall( } function validateExecutableToolArgs(tool: ExecutableTool, args: unknown): string | null { - let validator = validators.get(tool); - if (validator === undefined) { + const schema = tool.parameters; + let cached = validators.get(tool); + if (cached === undefined || cached.schema !== schema) { try { - validator = compileToolArgsValidator(tool.parameters); - validators.set(tool, validator); + cached = { schema, validator: compileToolArgsValidator(schema) }; + validators.set(tool, cached); } catch (error) { return error instanceof Error ? error.message : String(error); } } - return validateToolArgs(validator, args as JsonType); + return validateToolArgs(cached.validator, args as JsonType); } function toolCallDisplayFieldsFromExecution( diff --git a/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts b/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts index f1a7349ab2f..b936fa3bd7a 100644 --- a/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts +++ b/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts @@ -54,10 +54,10 @@ export const AgentSwarmToolInputSchema = z 'Map of existing subagent agent_id to the prompt used to resume that subagent. These resumed subagents are launched before new item-based subagents.', ), model: z - .enum(['secondary', 'primary']) + .string() .optional() .describe( - 'Which model to run the item-spawned subagents on: "secondary" = the configured secondary model; "primary" = the main model you are running on (for hard, quality-sensitive tasks). This explicit choice overrides the selected agent type\'s model_preference; without either, secondary is the default when configured. Only effective when a secondary model is configured; otherwise subagents inherit your model. Resumed subagents always keep their own model.', + 'Which model to run the item-spawned subagents on: one of the aliases listed under "Available models" in this tool description, or "primary" for the main model you are running on (for hard, quality-sensitive tasks). When omitted, the configured default model is used. Resumed subagents always keep their own model.', ), }) .strict(); diff --git a/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts b/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts index b7d1a0b586a..a7999260e55 100644 --- a/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts +++ b/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts @@ -7,14 +7,16 @@ * per-subagent XML result. Reads persisted swarm item labels through the * Session-scoped coordinator so later `resume_agent_ids` calls relabel * resumed subagents like v1. When the caller has a model bound, the tool - * resolves the explicit or target-profile model preference up front via + * resolves the explicit tool `model` choice up front via * `resolveSubagentBinding` (against `IConfigService`, `IFlagService`, * `ISessionAgentProfileCatalog`, and the caller's `IAgentProfileService`) and * threads it through the swarm tasks; otherwise binding is left to the * service, which keeps its own "no model bound" check and inherit-caller - * fallback. The advertised `model` parameter lists the secondary/primary - * pair via `buildSubagentModelDescriptions`, suffixing each line with the - * entry's capability flags resolved through `IModelCatalog`. Swarm mode is + * fallback. The advertised `model` parameter lists the configured + * `[secondary_model.models]` pool via `buildSubagentModelDescriptions`; the + * pool is gated behind the `secondary-model` experiment, so while it is off + * (or under `[secondary_model].force`) the parameter is not advertised at + * all. Swarm mode is * entered through `IAgentSwarmService`; the caller's agent id comes from * `IAgentScopeContext`. Pure tool — owns no scoped state. * @@ -34,7 +36,6 @@ import { registerAgentToolService } from '#/agent/toolRegistry/toolContribution' import { toInputJsonSchema } from '#/tool/input-schema'; import { IConfigService } from '#/app/config/config'; import { IFlagService } from '#/app/flag/flag'; -import { IModelCatalog } from '#/kosong/model/catalog'; import { ISessionSwarmService, type SessionSwarmTask } from '#/session/swarm/sessionSwarm'; import { ISessionAgentProfileCatalog } from '#/session/sessionAgentProfileCatalog/sessionAgentProfileCatalog'; import { IAgentProfileService } from '#/agent/profile/profile'; @@ -46,11 +47,11 @@ import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; import { IAgentSwarmService } from '#/agent/swarm/swarm'; import { buildSubagentModelDescriptions, + exposesSubagentModelChoice, resolveSubagentBinding, resolveSubagentTimeoutMs, stripSubagentModelParameter, } from '#/session/subagent/configSection'; -import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import { AgentSwarmToolInputSchema, IAgentSwarmTool, @@ -96,7 +97,7 @@ export class AgentSwarmTool implements IAgentSwarmTool { readonly name = 'AgentSwarm' as const; get parameters(): Record { - return this.flags.enabled(SECONDARY_MODEL_FLAG_ID) + return exposesSubagentModelChoice(this.config, this.flags) ? AGENT_SWARM_PARAMETERS : AGENT_SWARM_PARAMETERS_NO_MODEL; } @@ -111,7 +112,6 @@ export class AgentSwarmTool implements IAgentSwarmTool { @IFlagService private readonly flags: IFlagService, @ISessionAgentProfileCatalog private readonly catalog: ISessionAgentProfileCatalog, @IAgentProfileService private readonly profile: IAgentProfileService, - @IModelCatalog private readonly modelCatalog: IModelCatalog, ) { this.callerAgentId = scopeContext.agentId; } @@ -121,7 +121,6 @@ export class AgentSwarmTool implements IAgentSwarmTool { this.config, this.flags, this.profile.data().modelAlias, - this.modelCatalog, ); return modelLines === undefined ? AGENT_SWARM_DESCRIPTION @@ -190,7 +189,7 @@ export class AgentSwarmTool implements IAgentSwarmTool { this.config, this.flags, { modelAlias: own.modelAlias, thinkingLevel: own.thinkingLevel }, - args.model ?? targetProfile.modelPreference, + args.model, ); binding = { model: resolved.model, thinking: resolved.thinking }; } diff --git a/packages/agent-core-v2/src/agent/tools/agent/agent.ts b/packages/agent-core-v2/src/agent/tools/agent/agent.ts index 7bc0bda0f6f..d1025ff21c4 100644 --- a/packages/agent-core-v2/src/agent/tools/agent/agent.ts +++ b/packages/agent-core-v2/src/agent/tools/agent/agent.ts @@ -56,10 +56,10 @@ export const SubagentToolInputSchema = z.preprocess( 'If true, return immediately without waiting for completion. Prefer false unless the task can run independently and there is a clear benefit to not waiting.', ), model: z - .enum(['secondary', 'primary']) + .string() .optional() .describe( - 'Which model to run the subagent on: "secondary" = the configured secondary model; "primary" = the main model you are running on (for hard, quality-sensitive tasks). This explicit choice overrides the selected agent type\'s model_preference; without either, secondary is the default when configured. Only effective when a secondary model is configured; otherwise the subagent inherits your model. Ignored when resuming — resumed subagents keep their own model.', + 'Which model to run the subagent on: one of the aliases listed under "Available models" in this tool description, or "primary" for the main model you are running on (for hard, quality-sensitive tasks). When omitted, the configured default model is used. Ignored when resuming — resumed subagents keep their own model.', ), }), ); diff --git a/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts b/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts index 330549a1f5c..6abcde9f8ba 100644 --- a/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts +++ b/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts @@ -10,9 +10,14 @@ * under TaskList/TaskOutput/TaskStop when `run_in_background=true` or after * detach), and terminal text formatting. * - * Spawn bindings use an explicit tool choice first, then the target profile's - * symbolic model preference, before `resolveSubagentBinding` falls back to the - * configured secondary model or the caller's model. The selected alias is + * Spawn bindings use the explicit tool `model` choice first, before + * `resolveSubagentBinding` falls back to the configured `[secondary_model.models]` + * pool default or the caller's model; with `[secondary_model].force` set the + * `model` parameter is not advertised and every spawn binds `default_model`. + * The pool is gated behind the `secondary-model` experiment (via + * `IFlagService`): while it is off the `model` parameter is stripped and + * every spawn inherits the caller's model. + * The selected alias is * resolved through the model catalog before lifecycle allocation. A resumed * agent keeps the model recorded in its own wire journal — with per-subagent * models there is no "child follows the parent's current model" invariant to @@ -87,14 +92,13 @@ import { emitAgentRunSpawned, mirrorAgentRun } from '#/session/subagent/mirrorAg import { ISessionSubagentService } from '#/session/subagent/subagent'; import { buildSubagentModelDescriptions, + exposesSubagentModelChoice, formatSubagentTimeoutDescription, resolveSubagentBinding, resolveSubagentTimeoutMs, stripSubagentModelParameter, - subagentDisplayModel, wrapSubagentModelError, } from '#/session/subagent/configSection'; -import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import { BACKGROUND_AGENT_UNAVAILABLE, DEFAULT_PROFILE_NAME, @@ -120,7 +124,7 @@ export class SubagentTool implements ISubagentTool { readonly name: string = 'Agent'; get parameters(): Record { - return this.flags.enabled(SECONDARY_MODEL_FLAG_ID) + return exposesSubagentModelChoice(this.config, this.flags) ? SUBAGENT_TOOL_PARAMETERS : SUBAGENT_TOOL_PARAMETERS_NO_MODEL; } @@ -174,7 +178,6 @@ export class SubagentTool implements ISubagentTool { this.knownToolReferences(), (profile, name, source) => this.toolPolicy.isToolActiveForProfile(profile, name, source), - this.flags.enabled(SECONDARY_MODEL_FLAG_ID), ); if (typeLines) { description += `\n\nAvailable agent types (pass via subagent_type):\n${typeLines}`; @@ -183,7 +186,6 @@ export class SubagentTool implements ISubagentTool { this.config, this.flags, this.profile.data().modelAlias, - this.modelCatalog, ); if (modelLines !== undefined) { description += `\n\n${modelLines}`; @@ -284,10 +286,7 @@ export class SubagentTool implements ISubagentTool { agentId = target.id; const resumed = target.accessor.get(IAgentProfileService).data(); profileName = resumed.profileName ?? RESUMED_LABEL; - displayModel = - resumed.modelAlias === undefined - ? undefined - : subagentDisplayModel(this.config, resumed.modelAlias); + displayModel = resumed.modelAlias; } else { const requestedProfileName = args.subagent_type?.length ? args.subagent_type @@ -317,7 +316,7 @@ export class SubagentTool implements ISubagentTool { this.config, this.flags, { modelAlias: own.modelAlias, thinkingLevel: own.thinkingLevel }, - args.model ?? profile.modelPreference, + args.model, ); let created: IAgentScopeHandle; try { @@ -339,7 +338,7 @@ export class SubagentTool implements ISubagentTool { .inheritUserTools(requester.accessor.get(IAgentUserToolService)); agentId = created.id; profileName = profile.name; - displayModel = binding.displayModel; + displayModel = binding.model; promptText = await applyProfilePromptPrefix(profile, args.prompt, { cwd: this.workspace.workDir, runner: this.processRunner, @@ -535,7 +534,6 @@ function buildProfileDescriptions( name: string, source: ToolReference['source'], ) => boolean, - showModelPreferences: boolean, ): string { return profiles .map((profile) => { @@ -543,10 +541,6 @@ function buildProfileDescriptions( (part): part is string => part !== undefined && part.length > 0, ); const header = details.length === 0 ? `- ${profile.name}` : `- ${profile.name}: ${details.join(' ')}`; - const headerLines = - !showModelPreferences || profile.modelPreference === undefined - ? header - : `${header}\n Model preference: ${profile.modelPreference}`; const activeTools = resolveActiveToolNames(profile); const externallyRestricted = tools.some( (tool) => @@ -558,20 +552,20 @@ function buildProfileDescriptions( .filter((tool) => isToolActive(profile, tool.name, tool.source)) .map((tool) => tool.name); if (effectiveTools.length === 0) { - return `${headerLines}\n Tools: none`; + return `${header}\n Tools: none`; } - return `${headerLines}\n Tools: ${effectiveTools.join(', ')}`; + return `${header}\n Tools: ${effectiveTools.join(', ')}`; } if (activeTools === undefined) { if ((profile.disallowedTools?.length ?? 0) > 0) { - return `${headerLines}\n Tools: all except ${profile.disallowedTools!.join(', ')}`; + return `${header}\n Tools: all except ${profile.disallowedTools!.join(', ')}`; } - return `${headerLines}\n Tools: all`; + return `${header}\n Tools: all`; } if (activeTools.length === 0) { - return `${headerLines}\n Tools: none`; + return `${header}\n Tools: none`; } - return `${headerLines}\n Tools: ${activeTools.join(', ')}`; + return `${header}\n Tools: ${activeTools.join(', ')}`; }) .join('\n'); } diff --git a/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts b/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts index 9f20446527a..048cd5e94fc 100644 --- a/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts +++ b/packages/agent-core-v2/src/app/agentProfileCatalog/agentProfileCatalog.ts @@ -14,9 +14,7 @@ * `systemPrompt(context)` is the same render's text only — it is derived from * `renderSystemPrompt` at registration, so the two can never drift apart. * Profiles stay - * independent of concrete model aliases, but may declare - * a symbolic primary/secondary preference used as the default when spawned as - * a subagent. The builtin {@link DEFAULT_AGENT_PROFILE_NAME} (`agent`) is the + * independent of concrete model aliases. The builtin {@link DEFAULT_AGENT_PROFILE_NAME} (`agent`) is the * default profile used when an Agent is bound to a Model without naming a * profile. * @@ -43,8 +41,6 @@ import type { ISessionProcessRunner } from '#/session/process/processRunner'; export const DEFAULT_AGENT_PROFILE_NAME = 'agent'; -export type AgentModelPreference = 'primary' | 'secondary'; - export interface AgentProfilePromptPrefixContext { readonly cwd: string; readonly runner: ISessionProcessRunner; @@ -95,7 +91,6 @@ export interface AgentProfile { readonly tools?: readonly string[]; readonly disallowedTools?: readonly string[]; readonly subagents?: readonly string[]; - readonly modelPreference?: AgentModelPreference; readonly systemPrompt: (context: AgentProfileContext) => string; readonly renderSystemPrompt: (context: AgentProfileContext) => SystemPromptRenderResult; readonly promptPrefix?: (ctx: AgentProfilePromptPrefixContext) => Promise; diff --git a/packages/agent-core-v2/src/app/kosongConfig/configSection.ts b/packages/agent-core-v2/src/app/kosongConfig/configSection.ts index 7af26196b34..68382257d5b 100644 --- a/packages/agent-core-v2/src/app/kosongConfig/configSection.ts +++ b/packages/agent-core-v2/src/app/kosongConfig/configSection.ts @@ -2,13 +2,13 @@ * `kosongConfig` domain — config-section declarations for kosong. * * The persistence wrapper for kosong's provider/model registries and the - * thinking / model-catalog / secondary-model preferences: declares every + * thinking / model-catalog preferences: declares every * kosong-owned section constant and its zod schema, plus the env bindings / * write-path strips and the snake_case ↔ camelCase TOML transforms. Where * kosong owns a pure type (`providers` / `models` / `thinking`), the schema * is re-derived from it and pinned by an `AssertExact` assertion (schema ≡ - * type at compile time); `modelCatalog` and `secondaryModel` have no - * kosong-side type — theirs derive from the local schemas. Self-registered + * type at compile time); `modelCatalog` has no + * kosong-side type — its derives from the local schema. Self-registered * at module load via `registerConfigSection`. * * `ProviderTypeSchema` is deliberately free-form text: vendor identity is @@ -25,7 +25,6 @@ import { z } from 'zod'; import { type ConfigStripEnv, envBindings, - stripEnvBoundFields, } from '#/app/config/config'; import { registerConfigSection } from '#/app/config/configSectionContributions'; import { @@ -311,33 +310,6 @@ registerConfigSection(THINKING_SECTION, ThinkingConfigSchema, { stripEnv: stripThinkingEnv, }); -export const SECONDARY_MODEL_SECTION = 'secondaryModel'; - -export const SECONDARY_MODEL_ENV = 'KIMI_SECONDARY_MODEL'; -export const SECONDARY_MODEL_EFFORT_ENV = 'KIMI_SECONDARY_EFFORT'; - -export const SecondaryModelConfigSchema = ModelOverrideSchema.extend({ - model: z.string().min(1).optional(), -}); - -export type SecondaryModelConfig = z.infer; - -function parseNonEmptyEnv(raw: string): string | undefined { - const trimmed = raw.trim(); - return trimmed.length > 0 ? trimmed : undefined; -} - -export const secondaryModelEnvBindings = envBindings(SecondaryModelConfigSchema, { - model: { env: SECONDARY_MODEL_ENV, parse: parseNonEmptyEnv }, - defaultEffort: { env: SECONDARY_MODEL_EFFORT_ENV, parse: parseNonEmptyEnv }, -}); - -registerConfigSection(SECONDARY_MODEL_SECTION, SecondaryModelConfigSchema, { - env: secondaryModelEnvBindings, - stripEnv: stripEnvBoundFields(secondaryModelEnvBindings), -}); - - export const MODEL_CATALOG_SECTION = 'modelCatalog'; export const ModelCatalogConfigSchema = z.object({ diff --git a/packages/agent-core-v2/src/app/kosongConfig/discoveryService.ts b/packages/agent-core-v2/src/app/kosongConfig/discoveryService.ts index 76ffe7b5a40..390d49866f9 100644 --- a/packages/agent-core-v2/src/app/kosongConfig/discoveryService.ts +++ b/packages/agent-core-v2/src/app/kosongConfig/discoveryService.ts @@ -29,6 +29,10 @@ * registries therefore never pass through a halfway-removed state — that * intermediate state was the source of the "provider/model not * configured" startup race against profile binding. + * A write that replaces the models table also folds the + * `[secondary_model]` subagent pool through `cascadeSubagentModelPool` + * into the same transition, so a refresh that drops an alias can never + * leave a dangling pool for the session-start validation to trip on. * - The env-synthesized `__kimi_env__` slice is never written to config: * it lives in the effective overlay, and the bridge's event-driven sync * carries it into the registries on its own. `defaultModel` / `thinking` @@ -70,6 +74,11 @@ import { PROVIDERS_SECTION, THINKING_SECTION, } from './configSection'; +import { + SECONDARY_MODEL_SECTION, + cascadeSubagentModelPool, + type SecondaryModelConfig, +} from '#/session/subagent/configSection'; import { IProviderDiscoveryService, type RefreshProviderModelsOptions, @@ -254,6 +263,16 @@ export class ProviderDiscoveryService implements IProviderDiscoveryService { if ('thinking' in patch) { sections[THINKING_SECTION] = restoreDefault ? exclusion.thinking : patch.thinking; } + const nextModels = sections[MODELS_SECTION] as Record | undefined; + if (nextModels !== undefined) { + const cascadedPool = cascadeSubagentModelPool( + this.config.inspect(SECONDARY_MODEL_SECTION).userValue, + nextModels, + ); + if (cascadedPool !== undefined) { + sections[SECONDARY_MODEL_SECTION] = cascadedPool ?? undefined; + } + } await this.config.replaceSections(sections); return { providers: diff --git a/packages/agent-core-v2/src/app/kosongConfig/modelsDevImportService.ts b/packages/agent-core-v2/src/app/kosongConfig/modelsDevImportService.ts index bf56aac7710..bd1c6653991 100644 --- a/packages/agent-core-v2/src/app/kosongConfig/modelsDevImportService.ts +++ b/packages/agent-core-v2/src/app/kosongConfig/modelsDevImportService.ts @@ -24,7 +24,11 @@ * `setDefined` drops those), and the models.dev import swaps aliases in two * passes (drop, then re-add onto clean slots). The kosong persistence * bridge then pushes the change into the registries, which is also what - * invalidates the runtime model catalog. + * invalidates the runtime model catalog. Each FINAL models-table pass also + * folds the `[secondary_model]` subagent pool through + * `cascadeSubagentModelPool` (the drop passes deliberately skip it — the + * re-add pass is what the pool must agree with), so an import that drops a + * pooled alias never leaves a dangling pool for session-start validation. * * Both third-party fetches — the models.dev directory and the custom-registry * import — send the identity snapshot's `outboundUserAgent`, matching what @@ -53,6 +57,11 @@ import { modelsDevProviderModels, resolveModelsDevImport } from './modelsDev'; import { DEFAULT_MODEL_SECTION, MODELS_SECTION, PROVIDERS_SECTION } from './configSection'; import { ModelsDevImportErrors } from './errors'; import { IKosongConfigService } from './kosongConfig'; +import { + SECONDARY_MODEL_SECTION, + cascadeSubagentModelPool, + type SecondaryModelConfig, +} from '#/session/subagent/configSection'; import { IModelsDevImportService, PROVIDER_ID_PATTERN, @@ -133,6 +142,19 @@ export class ModelsDevImportService implements IModelsDevImportService { return this.config; } + private async cascadePool( + config: IConfigService, + nextModels: Record, + ): Promise { + const cascaded = cascadeSubagentModelPool( + config.inspect(SECONDARY_MODEL_SECTION).userValue, + nextModels, + ); + if (cascaded !== undefined) { + await config.replace(SECONDARY_MODEL_SECTION, cascaded); + } + } + private async doImportModelsDevProvider( options: ImportModelsDevProviderOptions, ): Promise { @@ -201,6 +223,7 @@ export class ModelsDevImportService implements IModelsDevImportService { nextModels[`${targetId}/${model.id}`] = modelsDevModelToRecord(targetId, model); } await config.replace(MODELS_SECTION, nextModels); + await this.cascadePool(config, nextModels); const firstModel = models[0]; if (firstModel !== undefined) { @@ -289,6 +312,7 @@ export class ModelsDevImportService implements IModelsDevImportService { } await config.replace(PROVIDERS_SECTION, applied.providers as ProvidersSection); await config.replace(MODELS_SECTION, (applied.models ?? {}) as ModelsSection); + await this.cascadePool(config, applied.models ?? {}); const firstEntry = Object.values(entries)[0]; const firstModelKey = firstEntry === undefined ? undefined : Object.keys(firstEntry.models)[0]; diff --git a/packages/agent-core-v2/src/app/kosongConfig/secondaryModelOverlay.ts b/packages/agent-core-v2/src/app/kosongConfig/secondaryModelOverlay.ts deleted file mode 100644 index 899fc387f01..00000000000 --- a/packages/agent-core-v2/src/app/kosongConfig/secondaryModelOverlay.ts +++ /dev/null @@ -1,102 +0,0 @@ -/** - * `kosongConfig` domain — `[secondary_model]` derived-entry overlay. - * - * When the secondary-model recipe carries patch fields, synthesizes the - * derived registry entry (`SECONDARY_DERIVED_MODEL_ID`) into the effective - * `models` view: a copy of the pointed entry with the patch merged into its - * `overrides` block (patch wins conflicts) and `aliases` dropped, so the - * derived entry never competes in name/alias routing. Subagent binding then - * resolves it by name through the standard catalog path, and the patch rides - * the same `effectiveModelConfig` merge as any `models.*.overrides` - * (including its supportEfforts/defaultEffort pruning and input clamping). - * - * Like the env overlay, the synthesized entry lives ONLY in the in-memory - * effective view: `strip` removes it from `models` writes so it never - * reaches `config.toml`, and the persistence bridge's deep-equal guards keep - * the two-way sync silent. `strip` also rolls back a `defaultModel` pointer - * set to the derived id (restoring the raw value, mirroring the env - * overlay's pinned-pointer handling) — the pointer can never dangle on disk - * after the recipe is removed. Nothing is synthesized when the recipe has no - * patch fields (subagents bind the pointed entry directly), when - * `secondary.model` is unset, or when the pointed entry does not exist (the - * warning service reports the dangling pointer; spawn fails with the wrapped - * error). The id is reserved: a user-configured entry under it is stripped - * on write all the same. - * - * Self-registered at module load via `registerConfigOverlay`; it is imported - * for side effects after the env overlay, so a `secondary.model` pointing at - * the env-synthesized entry sees the already-applied env view. - */ - -import type { ConfigEffectiveOverlay } from '#/app/config/config'; -import { registerConfigOverlay } from '#/app/config/configOverlayContributions'; -import { isPlainObject } from '#/app/config/toml'; -import type { ModelOverride } from '#/kosong/model/model'; - -import { - DEFAULT_MODEL_SECTION, - MODELS_SECTION, - SECONDARY_MODEL_SECTION, - type SecondaryModelConfig, -} from './configSection'; - -export const SECONDARY_DERIVED_MODEL_ID = '__secondary__'; - -export function secondaryModelPatch( - secondary: SecondaryModelConfig | undefined, -): ModelOverride | undefined { - if (secondary === undefined) return undefined; - const { model: _model, ...patch } = secondary; - return Object.keys(patch).length > 0 ? patch : undefined; -} - -function asRecord(value: unknown): Record { - return isPlainObject(value) ? value : {}; -} - -function withoutKey(value: unknown, key: string): unknown { - if (!isPlainObject(value) || !(key in value)) return value; - const out: Record = { ...value }; - delete out[key]; - return out; -} - -export const secondaryModelOverlay: ConfigEffectiveOverlay = { - apply(effective, _getEnv, validate) { - const secondary = effective[SECONDARY_MODEL_SECTION] as SecondaryModelConfig | undefined; - const patch = secondaryModelPatch(secondary); - const baseId = secondary?.model; - if (patch === undefined || baseId === undefined || baseId === SECONDARY_DERIVED_MODEL_ID) { - return []; - } - const models = asRecord(effective[MODELS_SECTION]); - const base = models[baseId]; - if (!isPlainObject(base)) return []; - const { overrides: baseOverrides, aliases: _aliases, ...baseFields } = base; - const derived: Record = { - ...baseFields, - overrides: { ...asRecord(baseOverrides), ...patch }, - }; - effective[MODELS_SECTION] = validate(MODELS_SECTION, { - ...models, - [SECONDARY_DERIVED_MODEL_ID]: derived, - }); - return [MODELS_SECTION]; - }, - - strip(domain, value, rawSnake) { - switch (domain) { - case MODELS_SECTION: - return withoutKey(value, SECONDARY_DERIVED_MODEL_ID); - case DEFAULT_MODEL_SECTION: - if (value !== SECONDARY_DERIVED_MODEL_ID) return value; - return typeof rawSnake['default_model'] === 'string' - ? rawSnake['default_model'] - : undefined; - default: - return value; - } - }, -}; - -registerConfigOverlay(secondaryModelOverlay); diff --git a/packages/agent-core-v2/src/app/skillCatalog/builtin/update-config.md b/packages/agent-core-v2/src/app/skillCatalog/builtin/update-config.md index 15583877486..9fcdddb4b4e 100644 --- a/packages/agent-core-v2/src/app/skillCatalog/builtin/update-config.md +++ b/packages/agent-core-v2/src/app/skillCatalog/builtin/update-config.md @@ -20,7 +20,7 @@ echo "$HOME/.kimi-code" Use the first line when it is non-empty; otherwise use the second line. In the rest of this skill, `` means that resolved root — **never assume `~/.kimi-code`**. -- **`config.toml`** — agent / runtime settings: `default_model`, `secondary_model` (subagent model), `providers`, `models`, `thinking`, `permission`, `hooks`, `loop_control`, etc. +- **`config.toml`** — agent / runtime settings: `default_model`, `[secondary_model]` (experimental `secondary-model` flag: `default_model` / `[secondary_model.models]` subagent model pool / `force` to pin subagents to `default_model`; a lone legacy v1 `model` key is honored as a fallback default), `[subagent]` (`timeout_ms`), `providers`, `models`, `thinking`, `permission`, `hooks`, `loop_control`, etc. - **`tui.toml`** — terminal-UI / client preferences: `theme`, `[editor].command`, `[notifications]`, `[upgrade].auto_install` (auto-update). These can usually also be changed with the interactive commands `/config`, `/theme`, `/editor`, which is easier — prefer pointing the user at those. The "read → copy → Edit → validate → back up → overwrite" flow below applies to both files; only **which reload command applies** differs (see Capability 4). diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 6eaf2a0b9cf..8c2399d9211 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -150,7 +150,6 @@ export * from '#/kosong/protocol/protocol'; export * from '#/kosong/protocol/protocolBase'; export * from '#/kosong/protocol/protocolTrait'; import '#/app/kosongConfig/envOverlay'; -import '#/app/kosongConfig/secondaryModelOverlay'; export * from '#/kosong/model/completionBudget'; export * from '#/kosong/model/hostRequestHeaders'; export * from '#/kosong/model/model'; @@ -166,12 +165,6 @@ export { ModelCatalogConfigSchema, type ModelCatalogConfig, } from '#/app/kosongConfig/configSection'; -export type { SecondaryModelConfig } from '#/app/kosongConfig/configSection'; -export { - SECONDARY_DERIVED_MODEL_ID, - secondaryModelOverlay, - secondaryModelPatch, -} from '#/app/kosongConfig/secondaryModelOverlay'; export * from '#/app/kosongConfig/kosongConfig'; export * from '#/app/kosongConfig/kosongConfigService'; export * from '#/kosong/model/modelOAuth'; @@ -399,8 +392,8 @@ export * from '#/workspace/workspaceMcp/workspaceMcpService'; export * from '#/session/subagent/subagent'; export * from '#/session/subagent/subagentService'; import '#/session/subagent/flag'; -export * from '#/session/subagent/secondaryModelWarning'; -export * from '#/session/subagent/secondaryModelWarningService'; +export * from '#/session/subagent/subagentModelsValidation'; +import '#/session/subagent/subagentModelsValidationService'; export * from '#/agent/tools/agent/subagent-task'; export { AGENT_RUN_PROMPT_ORIGIN } from '#/session/subagent/runAgentTurn'; export * from '#/session/subagent/mirrorAgentRun'; diff --git a/packages/agent-core-v2/src/session/subagent/configSection.ts b/packages/agent-core-v2/src/session/subagent/configSection.ts index 38c743ac3a3..5140f679393 100644 --- a/packages/agent-core-v2/src/session/subagent/configSection.ts +++ b/packages/agent-core-v2/src/session/subagent/configSection.ts @@ -1,57 +1,109 @@ /** - * `subagent` domain — subagent config-section schema, env binding, and + * `subagent` domain — subagent config-section schemas, env binding, and * timeout / model resolution. * - * Owns the `[subagent]` configuration section (`timeout_ms` on disk) together - * with the `KIMI_SUBAGENT_TIMEOUT_MS` env override (precedence: env > - * config.toml > 2h default). While - * the env var is set, `stripEnvBoundFields` restores the env-free raw value - * before persistence, so the override never leaks into `config.toml`. Per-run - * timeouts resolve through `resolveSubagentTimeoutMs`, and the timeout - * message renders with `formatSubagentTimeoutDescription`. + * Owns two on-disk sections: * - * The model half of the spawn binding is the secondary model (the - * `[secondary_model]` section on disk): when its - * experiment is enabled and the model is set, newly spawned subagents bind to - * it by default instead of inheriting the caller's model, and the - * `Agent`/`AgentSwarm` tools let the parent model pick per spawn via their - * `model` parameter. When unset, spawning behavior is unchanged (subagents - * inherit the caller's model). A recipe with patch fields binds the - * synthesized derived entry (`SECONDARY_DERIVED_MODEL_ID`); a pointer-only - * recipe binds the pointed entry directly. `default_effort` is passed as the - * explicit subagent thinking; without it the subagent resolves thinking + * - `[subagent]` — `timeout_ms`, together with the `KIMI_SUBAGENT_TIMEOUT_MS` + * env override (precedence: env > config.toml > 2h default). While the env + * var is set, `stripEnvBoundFields` restores the env-free raw value before + * persistence, so the override never leaks into `config.toml`. Per-run + * timeouts resolve through `resolveSubagentTimeoutMs`, and the timeout + * message renders with `formatSubagentTimeoutDescription`. The pool keys + * `default_model` / `models` are declared as deprecations on this section: + * they moved to `[secondary_model]` and their values here no longer apply. + * + * - `[secondary_model]` — the subagent model pool: `default_model` names the + * fallback model and the `[secondary_model.models]` table maps alias → + * description. A `default_model` without a `[secondary_model.models]` table + * stands on its own as an implicit single-entry pool (empty description) — + * the minimal "secondary model" configuration. As a compatibility fallback + * for the v1 engine's recipe, a lone legacy `model` key (likewise without a + * pool table) forms the same implicit single-entry pool, ranked below + * `default_model`; the recipe's patch fields (`default_effort`, ...) have + * no pool counterpart and are ignored by pool resolution — but the schema + * still declares them so validation never strips them and config + * reads/writes round-trip losslessly for the v1 engine, and `model` never + * substitutes for + * the pool table's required `default_model`. `force = true` instead + * removes the choice entirely: every spawn binds the resolved default + * (`default_model` ?? `model`), the tools hide the `model` parameter + * exactly like the no-pool case, and combining + * it with a `[secondary_model.models]` table is rejected — the table's only + * purpose is offering the main agent a choice. + * + * When a pool is configured (and not forced), newly spawned subagents + * bind to the pool's default model unless the parent model picks a pool alias + * — or `primary` (`PRIMARY_SUBAGENT_MODEL_CHOICE`), the always-available + * symbolic choice binding the caller's own model and thinking level — per + * spawn via the `Agent` / `AgentSwarm` tool `model` parameter. Pool bindings + * carry no explicit thinking level, so the subagent resolves thinking * naturally (global thinking config → the bound model's default effort) - * rather than inheriting the caller's level. Both tools resolve spawn - * bindings through `resolveSubagentBinding`, advertise the pair via - * `buildSubagentModelDescriptions` (each line suffixed with the entry's - * resolved capability flags, so the parent can route multimodal or - * thinking-heavy subagent tasks instead of guessing from the model id), - * and wrap spawn failures with - * `wrapSubagentModelError`; while the experiment is off they also strip the - * no-op `model` parameter from their advertised schemas via - * `stripSubagentModelParameter`. Spawn reporting reads the display-facing - * alias from `subagentDisplayModel`: the derived entry id means nothing to a - * user, so it resolves back to the recipe's base alias — flag-independent on - * purpose, since interpreting an already-persisted derived binding (resume) - * must keep working after the experiment is switched off. Self-registered - * at module load via `registerConfigSection`. + * rather than inheriting the caller's level. Without a pool, spawning + * behavior is unchanged (subagents inherit the caller's model) and the tools + * strip the no-op `model` parameter from their advertised schemas via + * `stripSubagentModelParameter`, so the concept never enters the prompt and a + * stray `model` argument is rejected instead of silently inheriting; the + * strip returns a shallow copy and never mutates the input, so callers can + * keep both schema variants as shared constants. `force = true` shares this + * hidden-parameter surface (see `exposesSubagentModelChoice`) while binding + * every spawn to the resolved default in `resolveSubagentBinding`. The whole + * pool is gated behind the `secondary-model` experimental flag (`flag.ts`): + * while the experiment is off the section is inert — the tools strip the + * `model` parameter, spawns bind the caller's model, and validation is + * skipped. + * + * Spawn bindings resolve through `resolveSubagentBinding`: a forced + * configuration short-circuits to the resolved default before anything else, and + * any explicit request — `primary` included — throws (defensive; the tools + * strip the parameter); `primary` + * short-circuits to the caller's own model+thinking; with no pool a stray + * non-`primary` request throws (defensive — the tools strip the parameter); + * with a pool the request must be a pool alias, an omitted request falls back + * to `default_model`, and anything else throws `CONFIG_INVALID` listing the + * available choices so the parent model can retry. The tools advertise the + * pool via `buildSubagentModelDescriptions`: the default model leads with a + * `[default]` marker, the remaining aliases follow in config order, and the + * caller's own alias is listed like any other pool entry (marked + * `[main model]`) — pool alias bindings carry no thinking, so the trailing + * `primary` line stays distinct from it: it binds the caller's model WITH the + * caller's current thinking level, and names the alias in parentheses when + * the caller is in the pool. An empty-string description renders a bare + * `- alias` line. Spawn failures are wrapped by `wrapSubagentModelError`: + * when the bound model is not the caller's own and the catalog failed on + * exactly that alias, the parent model gets guidance toward + * `[secondary_model.models]` instead of a bare resolution error. + * Cross-field validation is NOT part of the schema — it is enforced as + * `Error2(CONFIG_INVALID)` by `assertValidSubagentModelConfig` (run before + * session materialization by the session lifecycle, with the Session-scope + * validation service in `subagentModelsValidationService.ts` as backstop), + * which checks the `force` rules (a default — `default_model` or the legacy + * `model` fallback — required, a + * `[secondary_model.models]` table rejected) and delegates the pool checks to + * `assertValidSubagentModelPool`: the default must be present and name a + * pool key, every pool key must resolve through the model catalog, and the + * reserved `primary` alias is rejected outright — as a pool key it would be + * unreachable (explicit requests short-circuit to the caller's model) and + * would render a self-contradictory description. `resolveSubagentBinding` + * repeats the reserved-key and force-rule checks so a pool broken by a + * runtime config edit fails loudly at spawn instead of binding the wrong + * model; any other malformation the startup checks missed surfaces as the + * spawn-time errors above. Writes that rewrite the `[models]` table + * (provider removal/replace at the edge, background catalog refreshes) + * fold the pool through `cascadeSubagentModelPool` into the same atomic + * write — renamed aliases are repointed, dropped aliases filtered, and the + * whole section cleared when its effective default dangles (an emptied pool + * table folds into the implicit single-entry form — a default naming no + * pool key would fail validation) — so the startup + * validation never meets a pool orphaned by a write it did not see. + * Self-registered at module load via `registerConfigSection`. */ import { z } from 'zod'; import { Error2, ErrorCodes, isError2 } from '#/errors'; -import type { AgentModelPreference } from '#/app/agentProfileCatalog/agentProfileCatalog'; import { isPlainObject } from '#/app/config/toml'; import type { IFlagService } from '#/app/flag/flag'; -import { - SECONDARY_MODEL_ENV, - SECONDARY_MODEL_SECTION, -} from '#/app/kosongConfig/configSection'; -import { - SECONDARY_DERIVED_MODEL_ID, - secondaryModelPatch, -} from '#/app/kosongConfig/secondaryModelOverlay'; -import { type SecondaryModelConfig } from '#/app/kosongConfig/configSection'; import { type EnvBindings, envBindings, @@ -59,12 +111,12 @@ import { type IConfigService, } from '#/app/config/config'; import { registerConfigSection } from '#/app/config/configSectionContributions'; -import type { ModelCapability } from '#/kosong/contract/capability'; import type { IModelCatalog } from '#/kosong/model/catalog'; import { SECONDARY_MODEL_FLAG_ID } from './flag'; export const SUBAGENT_SECTION = 'subagent'; +export const SECONDARY_MODEL_SECTION = 'secondaryModel'; export const SubagentConfigSchema = z.object({ timeoutMs: z.number().int().min(0).optional(), @@ -72,6 +124,25 @@ export const SubagentConfigSchema = z.object({ export type SubagentConfig = z.infer; +export const SecondaryModelConfigSchema = z.object({ + defaultModel: z.string().min(1).optional(), + models: z.record(z.string(), z.string()).optional(), + force: z.boolean().optional(), + model: z.string().min(1).optional(), + maxContextSize: z.number().int().min(1).optional(), + maxInputSize: z.number().int().min(1).optional(), + maxOutputSize: z.number().int().min(1).optional(), + capabilities: z.array(z.string()).optional(), + displayName: z.string().optional(), + reasoningKey: z.string().optional(), + adaptiveThinking: z.boolean().optional(), + supportEfforts: z.array(z.string()).optional(), + defaultEffort: z.string().optional(), + offEffort: z.string().optional(), +}); + +export type SecondaryModelConfig = z.infer; + export const DEFAULT_SUBAGENT_TIMEOUT_MS = 2 * 60 * 60 * 1000; export const SUBAGENT_TIMEOUT_ENV = 'KIMI_SUBAGENT_TIMEOUT_MS'; @@ -94,8 +165,14 @@ registerConfigSection(SUBAGENT_SECTION, SubagentConfigSchema, { defaultValue: { timeoutMs: DEFAULT_SUBAGENT_TIMEOUT_MS }, env: subagentEnvBindings, stripEnv: stripSubagentEnv, + deprecations: [ + { key: 'default_model', replacement: 'secondary_model.default_model' }, + { key: 'models', replacement: 'secondary_model.models' }, + ], }); +registerConfigSection(SECONDARY_MODEL_SECTION, SecondaryModelConfigSchema); + export function resolveSubagentTimeoutMs(config: IConfigService): number { return ( config.get(SUBAGENT_SECTION)?.timeoutMs ?? @@ -103,91 +180,247 @@ export function resolveSubagentTimeoutMs(config: IConfigService): number { ); } -export type SubagentModelChoice = AgentModelPreference; +export const PRIMARY_SUBAGENT_MODEL_CHOICE = 'primary'; + +export interface SubagentModelPool { + readonly defaultModel?: string; + readonly models: Record; +} + +export function resolveSubagentModelPool(config: IConfigService): SubagentModelPool | undefined { + const section = config.get(SECONDARY_MODEL_SECTION); + if (section?.models !== undefined) { + return { defaultModel: section.defaultModel, models: section.models }; + } + if (section?.defaultModel !== undefined) { + return { defaultModel: section.defaultModel, models: { [section.defaultModel]: '' } }; + } + if (section?.model !== undefined) { + return { defaultModel: section.model, models: { [section.model]: '' } }; + } + return undefined; +} + +export const SECONDARY_MODEL_FORCE_REQUIRES_DEFAULT_MESSAGE = + '[secondary_model].default_model is required when [secondary_model].force is set'; + +export const SECONDARY_MODEL_FORCE_EXCLUDES_MODELS_MESSAGE = + '[secondary_model].force cannot be combined with [secondary_model.models]: the pool table only exists to offer the main agent a choice, and force removes that choice'; + +export function isSubagentModelForced(config: IConfigService): boolean { + return config.get(SECONDARY_MODEL_SECTION)?.force === true; +} + +export function exposesSubagentModelChoice(config: IConfigService, flags: IFlagService): boolean { + if (!flags.enabled(SECONDARY_MODEL_FLAG_ID)) return false; + if (isSubagentModelForced(config)) return false; + return resolveSubagentModelPool(config) !== undefined; +} + +export const SECONDARY_MODEL_DEFAULT_MODEL_REQUIRED_MESSAGE = + '[secondary_model].default_model is required when [secondary_model.models] is configured'; + +export const SECONDARY_MODEL_PRIMARY_MODEL_RESERVED_MESSAGE = `[secondary_model.models] key "${PRIMARY_SUBAGENT_MODEL_CHOICE}" is reserved: it always binds the caller's own model. Rename the pool entry.`; + +export function assertValidSubagentModelPool( + pool: SubagentModelPool, + modelCatalog: IModelCatalog, +): void { + if (Object.hasOwn(pool.models, PRIMARY_SUBAGENT_MODEL_CHOICE)) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_PRIMARY_MODEL_RESERVED_MESSAGE, { + details: { + section: SECONDARY_MODEL_SECTION, + field: 'models', + model: PRIMARY_SUBAGENT_MODEL_CHOICE, + }, + }); + } + const aliases = Object.keys(pool.models); + if (pool.defaultModel === undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_DEFAULT_MODEL_REQUIRED_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'defaultModel' }, + }); + } + if (!Object.hasOwn(pool.models, pool.defaultModel)) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `[secondary_model].default_model "${pool.defaultModel}" is not a [secondary_model.models] key. Available models: ${aliases.join(', ')}.`, + { details: { model: pool.defaultModel, availableModels: aliases } }, + ); + } + for (const alias of aliases) { + try { + modelCatalog.get(alias); + } catch (error) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `[secondary_model.models] entry "${alias}" could not be resolved: ${error instanceof Error ? error.message : String(error)}`, + { cause: error, details: { model: alias } }, + ); + } + } +} -export function resolveSecondaryModel( +export function assertValidSubagentModelConfig( config: IConfigService, flags: IFlagService, -): SecondaryModelConfig | undefined { - if (!flags.enabled(SECONDARY_MODEL_FLAG_ID)) return undefined; - return config.get(SECONDARY_MODEL_SECTION); + modelCatalog: IModelCatalog, +): void { + if (!flags.enabled(SECONDARY_MODEL_FLAG_ID)) return; + const section = config.get(SECONDARY_MODEL_SECTION); + if (section?.force === true) { + if (section.models !== undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_FORCE_EXCLUDES_MODELS_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'force' }, + }); + } + if (section.defaultModel === undefined && section.model === undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_FORCE_REQUIRES_DEFAULT_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'defaultModel' }, + }); + } + } + const pool = resolveSubagentModelPool(config); + if (pool !== undefined) assertValidSubagentModelPool(pool, modelCatalog); +} + +export function cascadeSubagentModelPool( + section: SecondaryModelConfig | undefined, + survivingModels: Record, + renamedAliases: ReadonlyMap = new Map(), +): SecondaryModelConfig | null | undefined { + if (section === undefined) return undefined; + const remap = (alias: string): string => renamedAliases.get(alias) ?? alias; + const nextDefault = section.defaultModel === undefined ? undefined : remap(section.defaultModel); + const nextLegacyDefault = section.model === undefined ? undefined : remap(section.model); + const effectiveDefault = nextDefault ?? nextLegacyDefault; + if (effectiveDefault !== undefined && !(effectiveDefault in survivingModels)) return null; + + let changed = nextDefault !== section.defaultModel || nextLegacyDefault !== section.model; + let nextPool: Record | undefined; + if (section.models !== undefined) { + nextPool = {}; + for (const [alias, description] of Object.entries(section.models)) { + const key = remap(alias); + if (!(key in survivingModels)) { + changed = true; + continue; + } + if (key !== alias) changed = true; + nextPool[key] = description; + } + if (Object.keys(nextPool).length === 0) { + nextPool = undefined; + changed = true; + } + } + if (!changed) return undefined; + return { ...section, defaultModel: nextDefault, model: nextLegacyDefault, models: nextPool }; } export function resolveSubagentBinding( config: IConfigService, flags: IFlagService, own: { modelAlias: string; thinkingLevel: string }, - requested?: SubagentModelChoice, -): { model: string; thinking?: string; displayModel: string } { - const secondary = resolveSecondaryModel(config, flags); - if (requested !== 'primary' && secondary?.model !== undefined) { - const model = - secondaryModelPatch(secondary) === undefined ? secondary.model : SECONDARY_DERIVED_MODEL_ID; - return { - model, - thinking: secondary.defaultEffort, - displayModel: subagentDisplayModel(config, model), - }; - } - return { - model: own.modelAlias, - thinking: own.thinkingLevel, - displayModel: subagentDisplayModel(config, own.modelAlias), - }; -} - -export function subagentDisplayModel( - config: IConfigService, - boundAlias: string, -): string { - if (boundAlias !== SECONDARY_DERIVED_MODEL_ID) return boundAlias; - return ( - config.get(SECONDARY_MODEL_SECTION)?.model ?? boundAlias - ); + requested?: string, +): { model: string; thinking?: string } { + const enabled = flags.enabled(SECONDARY_MODEL_FLAG_ID); + const section = config.get(SECONDARY_MODEL_SECTION); + if (enabled && section?.force === true) { + if (section.models !== undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_FORCE_EXCLUDES_MODELS_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'force' }, + }); + } + const forcedModel = section.defaultModel ?? section.model; + if (forcedModel === undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_FORCE_REQUIRES_DEFAULT_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'defaultModel' }, + }); + } + if (requested !== undefined) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Invalid model "${requested}": [secondary_model].force is set, so every subagent binds "${forcedModel}" (omit the model parameter).`, + { details: { model: requested } }, + ); + } + return { model: forcedModel }; + } + if (requested === PRIMARY_SUBAGENT_MODEL_CHOICE) { + return { model: own.modelAlias, thinking: own.thinkingLevel }; + } + const pool = enabled ? resolveSubagentModelPool(config) : undefined; + if (pool === undefined) { + if (requested !== undefined) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Invalid model "${requested}": no [secondary_model.models] pool is configured, so subagents inherit the caller's model (pass "primary" or omit the model parameter).`, + { details: { model: requested } }, + ); + } + return { model: own.modelAlias, thinking: own.thinkingLevel }; + } + if (Object.hasOwn(pool.models, PRIMARY_SUBAGENT_MODEL_CHOICE)) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_PRIMARY_MODEL_RESERVED_MESSAGE, { + details: { + section: SECONDARY_MODEL_SECTION, + field: 'models', + model: PRIMARY_SUBAGENT_MODEL_CHOICE, + }, + }); + } + const choice = requested ?? pool.defaultModel; + if (choice === undefined) { + throw new Error2(ErrorCodes.CONFIG_INVALID, SECONDARY_MODEL_DEFAULT_MODEL_REQUIRED_MESSAGE, { + details: { section: SECONDARY_MODEL_SECTION, field: 'defaultModel' }, + }); + } + if (!Object.hasOwn(pool.models, choice)) { + const available = [...Object.keys(pool.models), PRIMARY_SUBAGENT_MODEL_CHOICE]; + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Invalid model "${choice}". Available models: ${available.join(', ')}.`, + { details: { model: choice, availableModels: available } }, + ); + } + return { model: choice }; } export function buildSubagentModelDescriptions( config: IConfigService, flags: IFlagService, callerModelAlias: string | undefined, - modelCatalog: IModelCatalog, ): string | undefined { - const secondary = resolveSecondaryModel(config, flags); - const secondaryModel = secondary?.model; - if (secondaryModel === undefined || callerModelAlias === undefined) return undefined; - const boundSecondary = - secondaryModelPatch(secondary) === undefined ? secondaryModel : SECONDARY_DERIVED_MODEL_ID; - return [ - 'Available models (pass via model):', - `- secondary: ${secondaryModel} (default) — the configured secondary model; prefer it for routine subagent tasks${capabilitiesSuffix(resolvedCapabilities(modelCatalog, boundSecondary))}`, - `- primary: ${callerModelAlias} — the main model you are running on; use it for hard, quality-sensitive subagent tasks${capabilitiesSuffix(resolvedCapabilities(modelCatalog, callerModelAlias))}`, - ].join('\n'); -} - -const ADVERTISED_CAPABILITY_FLAGS = [ - 'image_in', - 'video_in', - 'audio_in', - 'thinking', - 'tool_use', - 'dynamically_loaded_tools', -] as const satisfies readonly (keyof ModelCapability)[]; - -function capabilitiesSuffix(capability: ModelCapability | undefined): string { - if (capability === undefined) return ''; - const names = ADVERTISED_CAPABILITY_FLAGS.filter((flag) => capability[flag] === true); - return `; capabilities: ${names.length === 0 ? 'none' : names.join(', ')}`; + if (!exposesSubagentModelChoice(config, flags)) return undefined; + const pool = resolveSubagentModelPool(config)!; + const lines = ['Available models (pass via model):']; + const defaultModel = pool.defaultModel; + const markersFor = (alias: string): string => { + const markers: string[] = []; + if (alias === defaultModel) markers.push('[default]'); + if (alias === callerModelAlias) markers.push('[main model]'); + return markers.length === 0 ? '' : ` ${markers.join(' ')}`; + }; + if (defaultModel !== undefined && Object.hasOwn(pool.models, defaultModel)) { + lines.push( + formatPoolLine(`${defaultModel}${markersFor(defaultModel)}`, pool.models[defaultModel]!), + ); + } + for (const [alias, description] of Object.entries(pool.models)) { + if (alias === defaultModel) continue; + lines.push(formatPoolLine(`${alias}${markersFor(alias)}`, description)); + } + const callerInPool = + callerModelAlias !== undefined && Object.hasOwn(pool.models, callerModelAlias); + lines.push( + `- ${PRIMARY_SUBAGENT_MODEL_CHOICE}${callerInPool ? ` (${callerModelAlias})` : ''}: the main model you are running on, bound with your current thinking level; use it for hard, quality-sensitive subagent tasks`, + ); + return lines.join('\n'); } -function resolvedCapabilities( - modelCatalog: IModelCatalog, - model: string, -): ModelCapability | undefined { - try { - return modelCatalog.get(model).capabilities; - } catch { - return undefined; - } +function formatPoolLine(label: string, description: string): string { + return description === '' ? `- ${label}` : `- ${label}: ${description}`; } export function stripSubagentModelParameter( @@ -213,22 +446,17 @@ export function wrapSubagentModelError( if (boundModel === callerModelAlias) return error; if (!isError2(error) || error.code !== ErrorCodes.CONFIG_INVALID) return error; if (error.details?.['model'] !== boundModel) return error; - const displayModel = - boundModel === SECONDARY_DERIVED_MODEL_ID - ? `the derived entry "${SECONDARY_DERIVED_MODEL_ID}"` - : `"${boundModel}"`; return new Error2( error.code, - `${error.message} (secondary model ${displayModel} comes from [secondary_model].model / ${SECONDARY_MODEL_ENV} — check that it names a valid [models] entry)`, + `${error.message} (subagent model "${boundModel}" comes from [secondary_model.models] — check that it names a valid [models] entry)`, { cause: error, name: error.name, details: { ...error.details, - secondaryModel: boundModel, - secondaryModelConfig: { - section: 'secondaryModel.model', - environment: SECONDARY_MODEL_ENV, + subagentModel: boundModel, + subagentModelConfig: { + section: 'secondary_model.models', }, }, }, diff --git a/packages/agent-core-v2/src/session/subagent/flag.ts b/packages/agent-core-v2/src/session/subagent/flag.ts index 67ec3795c08..9a0c7b3a5f3 100644 --- a/packages/agent-core-v2/src/session/subagent/flag.ts +++ b/packages/agent-core-v2/src/session/subagent/flag.ts @@ -2,8 +2,8 @@ * `subagent` domain — registers the `secondary-model` experimental flag * into `flag`. * - * Gates secondary-model selection for newly spawned subagents, including the - * agent-facing model choices and startup validation warning. Off by default; + * Gates the subagent model pool for newly spawned subagents, including the + * agent-facing model choices and startup pool validation. Off by default; * enable via `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL`, the master * `KIMI_CODE_EXPERIMENTAL_FLAG`, or the `[experimental]` config section. */ diff --git a/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts b/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts index 095a1cb7052..b5a6f605e2f 100644 --- a/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts +++ b/packages/agent-core-v2/src/session/subagent/mirrorAgentRun.ts @@ -16,8 +16,7 @@ * Wire shape note: the signals are still named `subagent.spawned / started / * completed / failed` and telemetry still tracks `subagent_created` so existing * session recordings and dashboards stay valid. The spawned signal also - * reports the child's display-normalized model alias (the derived secondary - * entry resolves to its base alias) and its effective thinking effort, so + * reports the child's bound model alias and its effective thinking effort, so * clients can render both at spawn instead of waiting for the first * `agent.status.updated` frame. */ diff --git a/packages/agent-core-v2/src/session/subagent/secondaryModelWarning.ts b/packages/agent-core-v2/src/session/subagent/secondaryModelWarning.ts deleted file mode 100644 index 31017de1404..00000000000 --- a/packages/agent-core-v2/src/session/subagent/secondaryModelWarning.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * `subagent` domain — `ISessionSecondaryModelWarningService` contract: - * early validation of the configured secondary model. - * - * The secondary-model pointer (`[secondary_model]` / `KIMI_SECONDARY_MODEL`) - * is otherwise validated lazily at spawn time, so a typo surfaces as a - * mid-conversation tool failure handed back to the parent model. This service - * front-loads the same resolution to session start (main-agent creation): an - * unresolvable model or an effort the model does not list becomes a `warning` - * event on the main agent's event bus, and stays cached for the edge to pull. - * A mid-session `[secondary_model]` change refreshes the cache through - * `recheckSecondaryModelWarning`. Session-scoped — one instance per session. - */ - -import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; - -export const SECONDARY_MODEL_INVALID_WARNING_CODE = 'secondary-model-invalid'; -export const SECONDARY_MODEL_EFFORT_WARNING_CODE = 'secondary-model-effort-not-listed'; - -export interface SecondaryModelWarning { - readonly code: string; - readonly message: string; -} - -export interface ISessionSecondaryModelWarningService { - readonly _serviceBrand: undefined; - getSecondaryModelWarning(): SecondaryModelWarning | undefined; - recheckSecondaryModelWarning(): SecondaryModelWarning | undefined; -} - -export const ISessionSecondaryModelWarningService: ServiceIdentifier = - createDecorator('sessionSecondaryModelWarningService'); diff --git a/packages/agent-core-v2/src/session/subagent/secondaryModelWarningService.ts b/packages/agent-core-v2/src/session/subagent/secondaryModelWarningService.ts deleted file mode 100644 index 16e8f4250fb..00000000000 --- a/packages/agent-core-v2/src/session/subagent/secondaryModelWarningService.ts +++ /dev/null @@ -1,160 +0,0 @@ -/** - * `subagent` domain — `ISessionSecondaryModelWarningService` implementation. - * - * When enabled through `flag`, runs the secondary-model check once per session - * when the main agent appears (`agentLifecycle` onDidCreate, or an - * already-present main at construction): - * resolves the pointed entry through the kosong `modelCatalog` and, when the - * recipe carries patch fields, checks `default_effort` against the patched - * `supportEfforts` (what the derived entry will carry) — on failure, caches a - * warning and publishes it as a `warning` event on the main agent's - * `eventBus`, and stays cached for the edge to pull. - * `recheckSecondaryModelWarning` recomputes - * the cache after a mid-session `[secondary_model]` change, re-publishing - * only when the warning actually changed. Never throws: a broken secondary - * model demotes to a notice here, with spawn-time resolution staying as the - * backstop. Bound at Session scope. - */ - -import { Disposable } from '#/_base/di/lifecycle'; -import { LifecycleScope } from '#/app/scopes'; -import { - type IAgentScopeHandle, - ScopeActivation, - registerScopedService, -} from '#/_base/di/scope'; -import { IConfigService } from '#/app/config/config'; -import { IEventBus } from '#/app/event/eventBus'; -import { IFlagService } from '#/app/flag/flag'; -import { - SECONDARY_MODEL_EFFORT_ENV, - SECONDARY_MODEL_ENV, -} from '#/app/kosongConfig/configSection'; -import { IModelCatalog, type Model } from '#/kosong/model/catalog'; -import { secondaryModelPatch } from '#/app/kosongConfig/secondaryModelOverlay'; -import { normalizeRequestedThinkingEffort } from '#/kosong/model/thinking'; -import { - IAgentLifecycleService, - MAIN_AGENT_ID, -} from '#/session/agentLifecycle/agentLifecycle'; - -import { resolveSecondaryModel } from './configSection'; -import { - ISessionSecondaryModelWarningService, - SECONDARY_MODEL_EFFORT_WARNING_CODE, - SECONDARY_MODEL_INVALID_WARNING_CODE, - type SecondaryModelWarning, -} from './secondaryModelWarning'; - -// NOTE: stays Disposable — its own 'config' collides with the Fiber -export class SessionSecondaryModelWarningService - extends Disposable - implements ISessionSecondaryModelWarningService -{ - declare readonly _serviceBrand: undefined; - - private warning: SecondaryModelWarning | undefined; - private checked = false; - - constructor( - @IAgentLifecycleService private readonly agentLifecycle: IAgentLifecycleService, - @IConfigService private readonly config: IConfigService, - @IFlagService private readonly flags: IFlagService, - @IModelCatalog private readonly modelCatalog: IModelCatalog, - ) { - super(); - this._register( - this.agentLifecycle.onDidCreate((handle) => { - if (handle.id === MAIN_AGENT_ID) this.check(handle); - }), - ); - const main = this.agentLifecycle.get(MAIN_AGENT_ID); - if (main !== undefined) this.check(main); - } - - getSecondaryModelWarning(): SecondaryModelWarning | undefined { - return this.warning; - } - - recheckSecondaryModelWarning(): SecondaryModelWarning | undefined { - const previous = this.warning; - this.warning = this.computeWarning(); - const changed = - previous?.code !== this.warning?.code || previous?.message !== this.warning?.message; - if (changed && this.warning !== undefined) { - this.agentLifecycle - .get(MAIN_AGENT_ID) - ?.accessor.get(IEventBus) - .publish({ - type: 'warning', - code: this.warning.code, - message: this.warning.message, - }); - } - return this.warning; - } - - private check(main: IAgentScopeHandle): void { - if (this.checked) return; - this.checked = true; - this.warning = this.computeWarning(); - if (this.warning !== undefined) { - main.accessor.get(IEventBus).publish({ - type: 'warning', - code: this.warning.code, - message: this.warning.message, - }); - } - } - - private computeWarning(): SecondaryModelWarning | undefined { - const secondary = resolveSecondaryModel(this.config, this.flags); - if (secondary?.model === undefined) return undefined; - let model: Model; - try { - model = this.modelCatalog.get(secondary.model); - } catch (error) { - return { - code: SECONDARY_MODEL_INVALID_WARNING_CODE, - message: - `Secondary model "${secondary.model}" (from [secondary_model].model / ${SECONDARY_MODEL_ENV}) ` + - `could not be resolved: ${error instanceof Error ? error.message : String(error)}. ` + - 'Subagent spawning will fail until this is fixed.', - }; - } - const patch = secondaryModelPatch(secondary); - return effortWarning( - secondary.model, - secondary.defaultEffort, - patch?.supportEfforts ?? model.supportEfforts, - ); - } -} - -function effortWarning( - alias: string, - effort: string | undefined, - supportEfforts: readonly string[] | undefined, -): SecondaryModelWarning | undefined { - const requested = normalizeRequestedThinkingEffort(effort); - if (requested === undefined || requested === 'off' || requested === 'on') return undefined; - const known = (supportEfforts ?? []) - .map((entry) => entry.trim()) - .filter((entry) => entry.length > 0); - if (known.length === 0 || known.includes(requested)) return undefined; - return { - code: SECONDARY_MODEL_EFFORT_WARNING_CODE, - message: - `Secondary model default effort "${requested}" (from [secondary_model].default_effort / ${SECONDARY_MODEL_EFFORT_ENV}) ` + - `is not listed for model "${alias}" (known: ${known.join(', ')}). ` + - 'Subagents may clamp or reject it.', - }; -} - -registerScopedService( - LifecycleScope.Session, - ISessionSecondaryModelWarningService, - SessionSecondaryModelWarningService, - ScopeActivation.OnScopeCreated, - 'subagent', -); diff --git a/packages/agent-core-v2/src/session/subagent/subagentModelsValidation.ts b/packages/agent-core-v2/src/session/subagent/subagentModelsValidation.ts new file mode 100644 index 00000000000..1e158d9a5ec --- /dev/null +++ b/packages/agent-core-v2/src/session/subagent/subagentModelsValidation.ts @@ -0,0 +1,24 @@ +/** + * `subagent` domain — `ISessionSubagentModelsValidationService` contract: + * startup validation of the configured subagent model pool. + * + * The pool is primarily validated before session materialization by the + * session lifecycle (see `workspace/sessionLifecycle`); this service repeats + * the same check at Session-scope activation as a backstop, so a pool with a + * missing/out-of-pool `default_model`, a reserved `primary` key, or an + * unresolvable alias fails the session with `Error2(CONFIG_INVALID)` instead + * of degrading into a mid-conversation tool failure handed back to the + * parent model. Session-scoped — one instance per session; the contract + * carries no methods because the validation is the construction side effect. + */ + +import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; + +export interface ISessionSubagentModelsValidationService { + readonly _serviceBrand: undefined; +} + +export const ISessionSubagentModelsValidationService: ServiceIdentifier = + createDecorator( + 'sessionSubagentModelsValidationService', + ); diff --git a/packages/agent-core-v2/src/session/subagent/subagentModelsValidationService.ts b/packages/agent-core-v2/src/session/subagent/subagentModelsValidationService.ts new file mode 100644 index 00000000000..6163ba92730 --- /dev/null +++ b/packages/agent-core-v2/src/session/subagent/subagentModelsValidationService.ts @@ -0,0 +1,46 @@ +/** + * `subagent` domain — `ISessionSubagentModelsValidationService` implementation. + * + * Backstop for the session lifecycle's pre-materialization check: validates + * the configured subagent model section (`[secondary_model.models]` + + * `[secondary_model].default_model`, plus the `force` rules) once per session + * at scope construction (`ScopeActivation.OnScopeCreated`), so a broken pool + * or forced model fails session creation with `Error2(CONFIG_INVALID)` even + * on paths that bypass the lifecycle service. Reads the section through + * `config` and resolves aliases through the model catalog — a lone + * `default_model` included, as the implicit single-entry pool; a session + * with neither pool nor force, or running with the `secondary-model` + * experiment off, is a no-op. The checks themselves live in + * `assertValidSubagentModelConfig` (configSection). Bound at Session scope. + */ + +import { LifecycleScope } from '#/app/scopes'; +import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; +import { IConfigService } from '#/app/config/config'; +import { IFlagService } from '#/app/flag/flag'; +import { IModelCatalog } from '#/kosong/model/catalog'; + +import { assertValidSubagentModelConfig } from './configSection'; +import { ISessionSubagentModelsValidationService } from './subagentModelsValidation'; + +export class SessionSubagentModelsValidationService + implements ISessionSubagentModelsValidationService +{ + declare readonly _serviceBrand: undefined; + + constructor( + @IConfigService config: IConfigService, + @IFlagService flags: IFlagService, + @IModelCatalog modelCatalog: IModelCatalog, + ) { + assertValidSubagentModelConfig(config, flags, modelCatalog); + } +} + +registerScopedService( + LifecycleScope.Session, + ISessionSubagentModelsValidationService, + SessionSubagentModelsValidationService, + ScopeActivation.OnScopeCreated, + 'subagent', +); diff --git a/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts b/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts index 811cb21ee77..651bbb7c382 100644 --- a/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts +++ b/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts @@ -30,7 +30,6 @@ import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMo import { IAgentLoopService } from '#/agent/loop/loop'; import { IAgentUserToolService } from '#/agent/userTool/userTool'; import { IEventBus } from '#/app/event/eventBus'; -import { IConfigService } from '#/app/config/config'; import { ISessionAgentProfileCatalog } from '#/session/sessionAgentProfileCatalog/sessionAgentProfileCatalog'; import { applyProfilePromptPrefix } from '#/app/agentProfileCatalog/promptPrefix'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; @@ -42,10 +41,7 @@ import { } from '#/session/agentLifecycle/subagentMetadata'; import { emitAgentRunSpawned, mirrorAgentRun } from '#/session/subagent/mirrorAgentRun'; import { ISessionSubagentService } from '#/session/subagent/subagent'; -import { - subagentDisplayModel, - wrapSubagentModelError, -} from '#/session/subagent/configSection'; +import { wrapSubagentModelError } from '#/session/subagent/configSection'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { ISessionMetadata, type AgentMeta } from '#/session/sessionMetadata/sessionMetadata'; import { ISessionProcessRunner } from '#/session/process/processRunner'; @@ -94,7 +90,6 @@ export class SessionSwarmService implements ISessionSwarmService { @ISessionProcessRunner private readonly processRunner: ISessionProcessRunner, @ILogService private readonly log: ILogService, @IModelCatalog private readonly modelCatalog: IModelCatalog, - @IConfigService private readonly config: IConfigService, ) {} async getSwarmItem(args: { @@ -192,7 +187,7 @@ export class SessionSwarmService implements ISessionSwarmService { description: options.description, swarmIndex: options.swarmIndex, runInBackground: options.runInBackground, - model: subagentDisplayModel(this.config, binding.model), + model: binding.model, }); const promptText = await applyProfilePromptPrefix(profile, options.prompt, { cwd: this.sessionContext.cwd, @@ -227,10 +222,7 @@ export class SessionSwarmService implements ISessionSwarmService { description: options.description, swarmIndex: options.swarmIndex, runInBackground: options.runInBackground, - model: - resumedModel === undefined - ? undefined - : subagentDisplayModel(this.config, resumedModel), + model: resumedModel, }); } const request = retryTurn diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts index 2d4f3222837..7942c9a2f04 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts @@ -67,7 +67,23 @@ * depends on MCP. * The session-level services whose subscriptions * must exist before the first agent / turn (external hooks, cron, the - * secondary-model startup warning) opt into `OnScopeCreated` activation. + * subagent model-pool startup validation) opt into `OnScopeCreated` activation. + * The subagent model pool itself is validated even earlier — at + * the top of `materializeSession`, before the MCP overlay, the session scope, + * and any persisted artifact come into existence, and again at the top of + * `fork` before the source session's files are copied — so a broken pool + * (or invalid `force` configuration) fails create/resume/fork without + * leaving orphaned session dirs or leaked + * overlay connections behind; the Session-scope validation service + * (`session/subagent/subagentModelsValidationService.ts`) repeats the same + * check at scope activation as a backstop for paths that bypass this service. + * That pre-flight awaits the kosong model/provider registries' `ready` + * alongside `config.ready` first: the catalog resolves aliases through those + * registries rather than the config document, so a cold bootstrap that + * creates a session before hydration completes must not fail a valid pool + * with `CONFIG_INVALID`. + * The pool is gated behind the `secondary-model` experiment, so with the + * experiment off these validations are no-ops and the section stays inert. */ import { randomUUID } from 'node:crypto'; @@ -129,6 +145,11 @@ import { createWireMetadataRecord, type WireRecord, } from '#/wire/record'; +import { IModelCatalog } from '#/kosong/model/catalog'; +import { IModelService } from '#/kosong/model/model'; +import { IProviderService } from '#/kosong/provider/provider'; +import { IFlagService } from '#/app/flag/flag'; +import { assertValidSubagentModelConfig } from '#/session/subagent/configSection'; import { IWorkspaceContext } from '#/workspace/workspaceContext/workspaceContext'; import { IUserAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoader/userAgentProfileLoader'; import { IPluginAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoader/pluginAgentProfileLoader'; @@ -207,6 +228,10 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec private readonly pluginAgentProfileLoader: IPluginAgentProfileLoader, @IWorkspaceDirs private readonly workspaceDirs: IWorkspaceDirs, @ISessionProcessRunner private readonly processRunner: ISessionProcessRunner, + @IModelCatalog private readonly modelCatalog: IModelCatalog, + @IModelService private readonly models: IModelService, + @IProviderService private readonly providers: IProviderService, + @IFlagService private readonly flags: IFlagService, ) { super(); } @@ -247,11 +272,17 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec return handle; } + private async assertSubagentModelPoolPreFlight(): Promise { + await Promise.all([this.config.ready, this.models.ready, this.providers.ready]); + assertValidSubagentModelConfig(this.config, this.flags, this.modelCatalog); + } + private async materializeSession(opts: MaterializeSessionOptions): Promise { const workspaceId = this.workspaceId; const sessionScope = sessionScopeOf(this.handlerScope, opts.sessionId); const sessionDir = sessionDirOf(this.bootstrap.homeDir, this.handlerScope, opts.sessionId); const metaScope = sessionScope; + await this.assertSubagentModelPoolPreFlight(); await this.workspaceDirs.ready; await this.workspaceDirs.mergeAdditionalDirs(opts.workDir, opts.additionalDirs ?? []); const ctx: ISessionContext = { @@ -488,6 +519,7 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec let target: ISessionScopeHandle | undefined; let targetSessionDir: string | undefined; try { + await this.assertSubagentModelPoolPreFlight(); // A turn that just ended may still have its outcome write queued; // settle pending metadata writes before reading the source for // inheritance, or the fork could copy a stale (or absent) outcome. diff --git a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentFile.ts b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentFile.ts index 6d5eaba3a0d..4b8a8871fd7 100644 --- a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentFile.ts +++ b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentFile.ts @@ -94,7 +94,6 @@ export function parseAgentFileText(options: ParseAgentFileOptions): AgentFileDef const rawSubagents = parseStringList(frontmatter['subagents'], 'subagents', options.path); const subagents = rawSubagents?.length === 1 && rawSubagents[0] === '*' ? undefined : rawSubagents; - const modelPreference = parseModelPreference(frontmatter['model_preference'], options.path); const prompt = parsed.body.trim(); if (prompt.length === 0) { @@ -109,24 +108,12 @@ export function parseAgentFileText(options: ParseAgentFileOptions): AgentFileDef tools, disallowedTools, subagents, - modelPreference, prompt, path: options.path, source: options.source, }; } -function parseModelPreference( - value: unknown, - filePath: string, -): AgentFileDefinition['modelPreference'] { - if (value === undefined || value === null) return undefined; - if (value === 'primary' || value === 'secondary') return value; - throw new AgentFileParseError( - `Frontmatter field "model_preference" in ${filePath} must be "primary" or "secondary"`, - ); -} - function parseBoolean(value: unknown, field: string, filePath: string): boolean { if (value === undefined || value === null) return false; if (typeof value === 'boolean') return value; diff --git a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentProfileFromFile.ts b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentProfileFromFile.ts index 66089adb5ca..1e9cc2d36d0 100644 --- a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentProfileFromFile.ts +++ b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentProfileFromFile.ts @@ -8,8 +8,7 @@ * marked as builtin overrides; directory files must opt in through frontmatter. * `tools` passes through as the allowlist (`undefined` = every tool active); * `disallowedTools` passes through as the tool denylist; `subagents` passes - * through as the delegation allowlist; `model_preference` becomes the - * symbolic default model used when the profile is delegated to. + * through as the delegation allowlist. * `profilesFromDiscovery` packs a whole discovery pass into an * `AgentProfileContribution`, binding each profile's `${base_prompt}` * placeholder lazily at render time so it always reflects the effective @@ -45,7 +44,6 @@ export function agentProfileFromFile( tools: definition.tools, disallowedTools: definition.disallowedTools, subagents: definition.subagents, - modelPreference: definition.modelPreference, renderSystemPrompt: (context) => renderPromptTemplateResult(definition.prompt, context, { skillActive }, basePrompt), }); diff --git a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/types.ts b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/types.ts index 729653f012c..f34c7dfec74 100644 --- a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/types.ts +++ b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/types.ts @@ -7,7 +7,6 @@ * Pure data; no scoped state. */ -import type { AgentModelPreference } from '#/app/agentProfileCatalog/agentProfileCatalog'; import type { SkippedAgentFile } from '#/app/agentProfileCatalog/agentProfileContribution'; export type { SkippedAgentFile } from '#/app/agentProfileCatalog/agentProfileContribution'; @@ -27,7 +26,6 @@ export interface AgentFileDefinition { readonly tools?: readonly string[]; readonly disallowedTools?: readonly string[]; readonly subagents?: readonly string[]; - readonly modelPreference?: AgentModelPreference; readonly prompt: string; readonly path: string; readonly source: AgentFileSource; diff --git a/packages/agent-core-v2/test/agent/profile/config-state.test.ts b/packages/agent-core-v2/test/agent/profile/config-state.test.ts index 0f198a4af57..870f7900f0d 100644 --- a/packages/agent-core-v2/test/agent/profile/config-state.test.ts +++ b/packages/agent-core-v2/test/agent/profile/config-state.test.ts @@ -3,7 +3,6 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { IAgentLLMRequesterService } from '#/agent/llmRequester/llmRequester'; import { IAgentProfileService } from '#/agent/profile/profile'; -import { SECONDARY_DERIVED_MODEL_ID } from '#/app/kosongConfig/secondaryModelOverlay'; import type { ModelRecord } from '#/kosong/model/model'; import { configServices, @@ -120,19 +119,6 @@ describe('ConfigState model capabilities', () => { }); }); - it('reports the recipe base alias when bound to the derived secondary entry', () => { - kimiConfig = { - providers: {}, - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, - } as TestKimiConfig; - - profile.update({ modelAlias: SECONDARY_DERIVED_MODEL_ID }); - - const statuses = ctx.allEvents.filter((entry) => entry.event === 'agent.status.updated'); - const last = statuses.at(-1)?.args as { model?: string }; - expect(last.model).toBe('provider/secondary'); - }); - it('omits maxContextTokens when the bound model no longer resolves', () => { // `update` accepts an alias without validating resolvability; a model entry // removed from config afterwards lands in the same state. The capabilities diff --git a/packages/agent-core-v2/test/agent/swarm/swarm.test.ts b/packages/agent-core-v2/test/agent/swarm/swarm.test.ts index 27f2aff6ab6..6e9fb081140 100644 --- a/packages/agent-core-v2/test/agent/swarm/swarm.test.ts +++ b/packages/agent-core-v2/test/agent/swarm/swarm.test.ts @@ -16,6 +16,7 @@ import { DisposableStore } from '#/_base/di/lifecycle'; import { TestInstantiationService } from '#/_base/di/test'; import { ILogService } from '#/_base/log/log'; import { stubLog } from '../../_base/log/stubs'; +import { stubFlag } from '../../app/flag/stubs'; import { IAgentContextInjectorService } from '#/agent/contextInjector/contextInjector'; import { AgentContextInjectorService } from '#/agent/contextInjector/contextInjectorService'; import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; @@ -36,7 +37,6 @@ import { IAgentSwarmService } from '#/agent/swarm/swarm'; import { AgentSwarmService } from '#/agent/swarm/swarmService'; import SWARM_MODE_ENTER_REMINDER from '../../../src/agent/swarm/enter-reminder.md?raw'; import { SwarmModel } from '#/agent/swarm/swarmOps'; -import { SECONDARY_DERIVED_MODEL_ID } from '#/app/kosongConfig/secondaryModelOverlay'; import { AgentSwarmToolInputSchema } from '#/agent/tools/agent-swarm/agent-swarm'; import { AgentSwarmTool } from '#/agent/tools/agent-swarm/agentSwarmTool'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; @@ -46,8 +46,6 @@ import type { ResolvedToolExecutionHookContext, } from '#/agent/toolExecutor/toolHooks'; import type { ToolCall } from '#/kosong/contract/message'; -import type { ModelCapability } from '#/kosong/contract/capability'; -import { IModelCatalog } from '#/kosong/model/catalog'; import type { ExecutableToolContext } from '#/tool/toolContract'; import { IAgentToolRegistryService } from '#/agent/toolRegistry/toolRegistry'; import { AgentToolRegistryService } from '#/agent/toolRegistry/toolRegistryService'; @@ -69,7 +67,6 @@ import { executeTool } from '../../tools/fixtures/execute-tool'; import { registerTestAgentWire, restoreTestAgentWire, testWireScope } from '../../wire/stubs'; import { stubLoopWithHooks } from '../loop/stubs'; import { stubToolExecutorEvents, type ToolExecutorEventStubs } from '../toolExecutor/stubs'; -import { stubFlag } from '../../app/flag/stubs'; import { createTestAgent } from '../../harness'; const signal = new AbortController().signal; @@ -139,8 +136,8 @@ function mockSwarmMode() { function stubConfig(section?: { timeoutMs?: number; - model?: string; - defaultEffort?: string; + defaultModel?: string; + models?: Record; }): IConfigService { return { _serviceBrand: undefined, @@ -194,19 +191,6 @@ function stubCallerProfile( } as unknown as IAgentProfileService; } -function stubModelCatalog( - capabilities: Readonly> = {}, -): IModelCatalog { - return { - _serviceBrand: undefined, - get: (id: string) => { - const capability = capabilities[id]; - if (capability === undefined) throw new Error(`Model "${id}" is not configured.`); - return { capabilities: capability }; - }, - } as unknown as IModelCatalog; -} - describe('AgentSwarmService', () => { let disposables: DisposableStore; let ix: TestInstantiationService; @@ -581,7 +565,7 @@ describe('AgentSwarmTool', () => { ]), }); const swarmMode = mockSwarmMode(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), swarmMode, stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), swarmMode, stubConfig({ defaultModel: 'provider/fast', models: { 'provider/fast': 'fast and cheap' } }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const input = { description: 'Review files', prompt_template: 'Review {{item}}', @@ -678,7 +662,7 @@ describe('AgentSwarmTool', () => { it('does not expose permission rule argument matching', () => { const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const execution = tool.resolveExecution({ description: 'Review files', prompt_template: 'Review {{item}}', @@ -693,7 +677,7 @@ describe('AgentSwarmTool', () => { it('description states the enforced input requirements', () => { const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); expect(tool.description).toContain('at least 2'); expect(tool.description).toContain('{{item}}'); expect(tool.description.toLowerCase()).toContain('distinct'); @@ -715,7 +699,6 @@ describe('AgentSwarmTool', () => { stubFlag(true), stubSwarmCatalog(caller), stubCallerProfile({ profileName: 'deleted-profile', subagents: ['explore'] }), - stubModelCatalog(), ); const result = await executeTool( @@ -779,7 +762,7 @@ describe('AgentSwarmTool', () => { for (const testCase of cases) { const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const result = await executeTool(tool, context(testCase.input)); @@ -812,7 +795,7 @@ describe('AgentSwarmTool', () => { async ({ agentId }: { readonly agentId: string }) => persistedItems[agentId], ); const host = mockSwarmHost({ run, getSwarmItem }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const input = { description: 'Finish review', subagent_type: 'explore', @@ -932,7 +915,7 @@ describe('AgentSwarmTool', () => { ); const getSwarmItem = vi.fn(async () => 'src/old-a.ts'); const host = mockSwarmHost({ run, getSwarmItem }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const input = { description: 'Resume review', resume_agent_ids: { @@ -995,7 +978,7 @@ describe('AgentSwarmTool', () => { }, ]), }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const result = await executeTool( tool, @@ -1021,7 +1004,7 @@ describe('AgentSwarmTool', () => { it('passes the configured subagent timeout to swarm tasks', async () => { const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ timeoutMs: 5_000 }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ timeoutMs: 5_000 }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); await executeTool( tool, @@ -1042,9 +1025,9 @@ describe('AgentSwarmTool', () => { ); }); - it('resolves spawn task bindings from the configured secondary model', async () => { + it('resolves spawn task bindings from the configured model pool default', async () => { const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ model: 'provider/secondary', defaultEffort: 'low' }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model', thinkingLevel: 'high' }), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ defaultModel: 'provider/fast', models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' } }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model', thinkingLevel: 'high' })); await executeTool( tool, @@ -1058,8 +1041,8 @@ describe('AgentSwarmTool', () => { expect(host.swarmService.run).toHaveBeenCalledWith( expect.objectContaining({ tasks: [ - expect.objectContaining({ binding: { model: SECONDARY_DERIVED_MODEL_ID, thinking: 'low' } }), - expect.objectContaining({ binding: { model: SECONDARY_DERIVED_MODEL_ID, thinking: 'low' } }), + expect.objectContaining({ binding: { model: 'provider/fast', thinking: undefined } }), + expect.objectContaining({ binding: { model: 'provider/fast', thinking: undefined } }), ], }), ); @@ -1067,13 +1050,7 @@ describe('AgentSwarmTool', () => { it('lets the tool call opt back into the primary model', async () => { const host = mockSwarmHost(); - const secondaryCoder: AgentProfile = normalizeAgentProfile({ - name: 'coder', - description: 'test coder', - modelPreference: 'secondary', - systemPrompt: () => 'coder', - }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ model: 'provider/secondary', defaultEffort: 'low' }), stubFlag(true), stubSwarmCatalog(DEFAULT_CALLER_PROFILE, [secondaryCoder]), stubCallerProfile({ modelAlias: 'main-model', thinkingLevel: 'high' }), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ defaultModel: 'provider/fast', models: { 'provider/fast': 'fast and cheap' } }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model', thinkingLevel: 'high' })); await executeTool( tool, @@ -1095,48 +1072,23 @@ describe('AgentSwarmTool', () => { ); }); - it('advertises both selectable models in the description only when configured', async () => { + it('advertises the configured pool in the description only when configured', async () => { const host = mockSwarmHost(); - const configured = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ model: 'provider/secondary' }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' }), stubModelCatalog({ - 'provider/secondary': { image_in: true, video_in: false, audio_in: false, thinking: true, tool_use: true, max_context_tokens: 262_144 }, - 'main-model': { image_in: false, video_in: false, audio_in: false, thinking: false, tool_use: true, max_context_tokens: 262_144 }, - })); + const configured = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ defaultModel: 'provider/fast', models: { 'provider/fast': 'fast and cheap', 'main-model': 'the main model' } }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' })); expect(configured.description).toContain('Available models (pass via model):'); + expect(configured.description).toContain('- provider/fast [default]: fast and cheap'); + // The caller's alias is a normal pool entry; the primary line stays distinct. + expect(configured.description).toContain('- main-model [main model]: the main model'); expect(configured.description).toContain( - '- secondary: provider/secondary (default) — the configured secondary model; prefer it for routine subagent tasks; capabilities: image_in, thinking, tool_use', - ); - expect(configured.description).toContain( - '- primary: main-model — the main model you are running on; use it for hard, quality-sensitive subagent tasks; capabilities: tool_use', + '- primary (main-model): the main model you are running on, bound with your current thinking level', ); - const unconfigured = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' }), stubModelCatalog()); + const unconfigured = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' })); expect(unconfigured.description).not.toContain('Available models'); }); - it('reads secondary capabilities from the derived entry when the recipe carries patch fields', async () => { - const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ model: 'provider/secondary', defaultEffort: 'low' }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' }), stubModelCatalog({ - [SECONDARY_DERIVED_MODEL_ID]: { image_in: false, video_in: false, audio_in: false, thinking: true, tool_use: true, max_context_tokens: 131_072 }, - 'main-model': { image_in: true, video_in: false, audio_in: false, thinking: false, tool_use: true, max_context_tokens: 262_144 }, - })); - - expect(tool.description).toContain( - '- secondary: provider/secondary (default) — the configured secondary model; prefer it for routine subagent tasks; capabilities: thinking, tool_use', - ); - expect(tool.description).toContain('capabilities: image_in, tool_use'); - }); - - it('omits the capabilities suffix for models the catalog cannot resolve', async () => { - const host = mockSwarmHost(); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig({ model: 'provider/secondary' }), stubFlag(true), stubSwarmCatalog(), stubCallerProfile({ modelAlias: 'main-model' }), stubModelCatalog()); - - expect(tool.description).toContain('- secondary: provider/secondary (default)'); - expect(tool.description).toContain('- primary: main-model'); - expect(tool.description).not.toContain('capabilities:'); - }); - it('omits resume hint when incomplete subagents have no agent ids', async () => { const host = mockSwarmHost({ run: vi.fn().mockImplementation(async ({ tasks }) => [ @@ -1152,7 +1104,7 @@ describe('AgentSwarmTool', () => { }, ]), }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const result = await executeTool( tool, @@ -1199,7 +1151,7 @@ describe('AgentSwarmTool', () => { }, ]), }); - const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile(), stubModelCatalog()); + const tool = new AgentSwarmTool(host.swarmService, makeAgentScopeContext({ agentId: host.callerAgentId, agentScope: '' }), mockSwarmMode(), stubConfig(), stubFlag(true), stubSwarmCatalog(), stubCallerProfile()); const result = await executeTool( tool, diff --git a/packages/agent-core-v2/test/agent/toolExecutor/toolExecutor.test.ts b/packages/agent-core-v2/test/agent/toolExecutor/toolExecutor.test.ts index 0f5d0a5bde0..20ba75fc9ed 100644 --- a/packages/agent-core-v2/test/agent/toolExecutor/toolExecutor.test.ts +++ b/packages/agent-core-v2/test/agent/toolExecutor/toolExecutor.test.ts @@ -306,6 +306,51 @@ describe('AgentToolExecutorService', () => { }); }); + it('recompiles the cached args validator when a tool advertises a different schema object', async () => { + const inner = new TestTool('dynamic'); + let currentSchema: Record = { + type: 'object', + properties: { value: { type: 'number' } }, + required: ['value'], + additionalProperties: false, + }; + const tool: ExecutableTool> = { + name: inner.name, + description: inner.description, + get parameters() { + return currentSchema; + }, + resolveExecution: (args) => inner.resolveExecution(args), + }; + registry.register(tool); + + const rejected = await execute([ + toolCall('call_strict', 'dynamic', { value: 1, model: 'fast' }), + ]); + + expect(rejected).toEqual([ + expect.objectContaining({ + output: expect.stringContaining('Invalid args for tool "dynamic"'), + isError: true, + }), + ]); + expect(inner.calls).toEqual([]); + + currentSchema = { + type: 'object', + properties: { value: { type: 'number' }, model: { type: 'string' } }, + required: ['value'], + additionalProperties: false, + }; + const accepted = await execute([ + toolCall('call_open', 'dynamic', { value: 1, model: 'fast' }), + ]); + + expect(accepted).toEqual([expect.objectContaining({ stopTurn: false })]); + expect(inner.calls).toHaveLength(1); + expect(inner.calls[0]?.args).toEqual({ value: 1, model: 'fast' }); + }); + it('routes malformed JSON args through schema validation', async () => { const tool = new TestTool('strict', { parameters: { diff --git a/packages/agent-core-v2/test/app/config/config.test.ts b/packages/agent-core-v2/test/app/config/config.test.ts index 4db3d17adfa..aa00d63d958 100644 --- a/packages/agent-core-v2/test/app/config/config.test.ts +++ b/packages/agent-core-v2/test/app/config/config.test.ts @@ -19,6 +19,7 @@ import { normalizeAgentProfile } from '#/app/agentProfileCatalog/agentProfileCat import { Error2, ErrorCodes, + isError2, resetUnexpectedErrorHandler, setUnexpectedErrorHandler, toErrorPayload, @@ -42,7 +43,6 @@ import { } from '#/app/config/config'; import { ConfigRegistry, ConfigService } from '#/app/config/configService'; import { ConfigSectionContribution } from '#/app/config/configSectionContributions'; -import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import '#/app/cron/configSection'; import type { CronConfig } from '#/app/cron/configSection'; import '#/app/skillCatalog/configSection'; @@ -73,9 +73,6 @@ import { DEFAULT_MODEL_SECTION, MODELS_SECTION, PROVIDERS_SECTION, - SECONDARY_MODEL_EFFORT_ENV, - SECONDARY_MODEL_ENV, - SECONDARY_MODEL_SECTION, THINKING_SECTION, } from '#/app/kosongConfig/configSection'; import { type ThinkingConfig } from '#/kosong/model/thinking'; @@ -90,15 +87,17 @@ import { applyPrintModeConfigDefaults } from '#/agent/task/printDefaults'; import '#/session/subagent/configSection'; import { DEFAULT_SUBAGENT_TIMEOUT_MS, - resolveSecondaryModel, resolveSubagentBinding, + resolveSubagentModelPool, resolveSubagentTimeoutMs, + SECONDARY_MODEL_SECTION, SUBAGENT_SECTION, SUBAGENT_TIMEOUT_ENV, - subagentDisplayModel, + type SecondaryModelConfig, type SubagentConfig, wrapSubagentModelError, } from '#/session/subagent/configSection'; +import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import { SERVICES_SECTION, WEB_FETCH_API_KEY_ENV, @@ -107,8 +106,6 @@ import { WEB_SEARCH_BASE_URL_ENV, type ServicesConfig, } from '#/app/auth/configSection'; -import { SECONDARY_DERIVED_MODEL_ID } from '#/app/kosongConfig/secondaryModelOverlay'; -import { type SecondaryModelConfig } from '#/app/kosongConfig/configSection'; import '#/app/mcpConfig/configSection'; import { MCP_SECTION, @@ -123,8 +120,12 @@ import { IFileSystemStorageService } from '#/persistence/interface/storage'; import { IAtomicTomlDocumentStore } from '#/persistence/interface/atomicDocumentStore'; import { TomlAtomicDocumentStore } from '#/persistence/backends/node-fs/atomicDocumentStore'; import { stubBootstrap } from '../bootstrap/stubs'; -import { stubFlag } from '../flag/stubs'; import { stubLog } from '../../_base/log/stubs'; +import { stubFlag } from '../flag/stubs'; + +function secondaryModelFlags(enabled = true) { + return stubFlag((id) => enabled && id === SECONDARY_MODEL_FLAG_ID); +} const TEST_OS_ENV = { osKind: 'Linux', @@ -134,10 +135,6 @@ const TEST_OS_ENV = { shellPath: '/bin/bash', } as const; -function secondaryModelFlags(enabled = true) { - return stubFlag((id) => enabled && id === SECONDARY_MODEL_FLAG_ID); -} - describe('Agent config', () => { let ctx: TestAgentContext; let profile: IAgentProfileService; @@ -1211,6 +1208,31 @@ describe('config deprecations', () => { disposables.dispose(); }); + it('warns and ignores the legacy [subagent] pool keys, which moved to [secondary_model]', async () => { + const { config, disposables } = await createConfig( + {}, + '[subagent]\ndefault_model = "provider/fast"\n\n[subagent.models]\n"provider/fast" = "fast and cheap"\n', + ); + + // The old values no longer apply — the pool only resolves from + // [secondary_model] now. + expect(resolveSubagentModelPool(config)).toBeUndefined(); + expect(config.diagnostics()).toContainEqual({ + domain: SUBAGENT_SECTION, + severity: 'warning', + message: + "[subagent] 'default_model' is deprecated and no longer used; rename it to 'secondary_model.default_model'. Run /update-config to fix it.", + }); + expect(config.diagnostics()).toContainEqual({ + domain: SUBAGENT_SECTION, + severity: 'warning', + message: + "[subagent] 'models' is deprecated and no longer used; rename it to 'secondary_model.models'. Run /update-config to fix it.", + }); + + disposables.dispose(); + }); + it('lets the replacement key win when both are present, still warning', async () => { const { config, disposables } = await createConfig( {}, @@ -1729,109 +1751,279 @@ describe('subagent config section', () => { disposables.dispose(); }); - it('resolves the spawn binding: secondary by default, primary on request, inherit otherwise', async () => { + it('reads default_model and [secondary_model.models] from config.toml', async () => { + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n"provider/smart" = ""\n', + ); + + expect(config.get(SECONDARY_MODEL_SECTION)).toEqual({ + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': '' }, + }); + + disposables.dispose(); + }); + + it('resolves the spawn binding: pool default, explicit alias, primary opt-in, inherit without pool', async () => { const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; - const noModel = await createConfig({}); - expect(resolveSubagentBinding(noModel.config, secondaryModelFlags(), own)).toEqual({ + const noPool = await createConfig({}); + expect(resolveSubagentBinding(noPool.config, secondaryModelFlags(), own)).toEqual({ model: 'provider/main', thinking: 'medium', - displayModel: 'provider/main', }); - expect(resolveSubagentBinding(noModel.config, secondaryModelFlags(), own, 'secondary')).toEqual({ + expect(resolveSubagentBinding(noPool.config, secondaryModelFlags(), own, 'primary')).toEqual({ model: 'provider/main', thinking: 'medium', - displayModel: 'provider/main', }); - noModel.disposables.dispose(); + noPool.disposables.dispose(); - const withModel = await createConfig({}, '[secondary_model]\nmodel = "provider/secondary"\n'); - expect(resolveSubagentBinding(withModel.config, secondaryModelFlags(), own)).toEqual({ - model: 'provider/secondary', + const pool = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n"provider/smart" = "hard tasks"\n', + ); + // An omitted model falls back to the pool default; pool bindings carry no + // explicit thinking (the subagent resolves thinking naturally). + expect(resolveSubagentBinding(pool.config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', + thinking: undefined, + }); + // A pool alias binds directly. + expect(resolveSubagentBinding(pool.config, secondaryModelFlags(), own, 'provider/smart')).toEqual({ + model: 'provider/smart', thinking: undefined, - displayModel: 'provider/secondary', }); - expect(resolveSubagentBinding(withModel.config, secondaryModelFlags(), own, 'primary')).toEqual({ + // "primary" always inherits the caller. + expect(resolveSubagentBinding(pool.config, secondaryModelFlags(), own, 'primary')).toEqual({ model: 'provider/main', thinking: 'medium', - displayModel: 'provider/main', }); - withModel.disposables.dispose(); + pool.disposables.dispose(); + }); - const withEffort = await createConfig( + it('keeps the pool inert while the secondary-model experiment is off', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( {}, - '[secondary_model]\nmodel = "provider/secondary"\ndefault_effort = "low"\n', + '[secondary_model]\ndefault_model = "provider/fast"\nforce = true\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n', ); - expect(resolveSubagentBinding(withEffort.config, secondaryModelFlags(), own)).toEqual({ - model: SECONDARY_DERIVED_MODEL_ID, - thinking: 'low', - displayModel: 'provider/secondary', + + // Flag off: the pool (and force) are ignored — spawns inherit the caller, + // and an explicit choice fails like the no-pool case. + expect(resolveSubagentBinding(config, secondaryModelFlags(false), own)).toEqual({ + model: 'provider/main', + thinking: 'medium', + }); + expect(() => + resolveSubagentBinding(config, secondaryModelFlags(false), own, 'provider/fast'), + ).toThrow(/no \[secondary_model\.models\] pool is configured/); + + disposables.dispose(); + }); + + it('treats a pool-less default_model as an implicit single-entry pool', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\n', + ); + + // An omitted model falls back to the default; pool bindings carry no + // explicit thinking. + expect(resolveSubagentBinding(config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', + thinking: undefined, }); - expect(resolveSubagentBinding(withEffort.config, secondaryModelFlags(), own, 'primary')).toEqual({ + // The only other choice is "primary". + expect(resolveSubagentBinding(config, secondaryModelFlags(), own, 'primary')).toEqual({ model: 'provider/main', thinking: 'medium', - displayModel: 'provider/main', }); - withEffort.disposables.dispose(); + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own, 'provider/smart')).toThrow( + /Invalid model "provider\/smart"\. Available models: provider\/fast, primary\./, + ); + + disposables.dispose(); + }); - const withFactPatch = await createConfig( + it('falls back to the legacy model key when no pool keys are set', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( {}, - '[secondary_model]\nmodel = "provider/secondary"\nmax_output_size = 8192\n', + '[secondary_model]\nmodel = "provider/fast"\ndefault_effort = "low"\n', ); - expect(resolveSubagentBinding(withFactPatch.config, secondaryModelFlags(), own)).toEqual({ - model: SECONDARY_DERIVED_MODEL_ID, + + // Recipe patch fields have no pool counterpart: the schema keeps them + // (so config writes round-trip losslessly for the v1 engine) but pool + // resolution ignores them; the lone legacy key forms the implicit + // single-entry pool. + expect(config.get(SECONDARY_MODEL_SECTION)).toEqual({ + model: 'provider/fast', + defaultEffort: 'low', + }); + expect(resolveSubagentModelPool(config)).toEqual({ + defaultModel: 'provider/fast', + models: { 'provider/fast': '' }, + }); + expect(resolveSubagentBinding(config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', thinking: undefined, - displayModel: 'provider/secondary', }); - withFactPatch.disposables.dispose(); + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own, 'provider/smart')).toThrow( + /Invalid model "provider\/smart"\. Available models: provider\/fast, primary\./, + ); + + disposables.dispose(); }); - it('inherits the caller binding when the secondary-model experiment is disabled', async () => { + it('lets default_model win over the legacy model key', async () => { const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; const { config, disposables } = await createConfig( {}, - '[secondary_model]\nmodel = "provider/secondary"\ndefault_effort = "low"\n', + '[secondary_model]\nmodel = "provider/slow"\ndefault_model = "provider/fast"\n', ); - expect(resolveSubagentBinding(config, secondaryModelFlags(false), own)).toEqual({ - model: 'provider/main', - thinking: 'medium', - displayModel: 'provider/main', + expect(resolveSubagentBinding(config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', + thinking: undefined, }); disposables.dispose(); }); - it('normalizes the derived entry to the recipe base alias regardless of the flag', async () => { - const withRecipe = await createConfig( + it('does not let the legacy model key substitute for a pool table default_model', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( {}, - '[secondary_model]\nmodel = "provider/secondary"\ndefault_effort = "low"\n', + '[secondary_model]\nmodel = "provider/fast"\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n', ); - expect(subagentDisplayModel(withRecipe.config, SECONDARY_DERIVED_MODEL_ID)).toBe( - 'provider/secondary', + + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own)).toThrow( + '[secondary_model].default_model is required when [secondary_model.models] is configured', + ); + + disposables.dispose(); + }); + + it('lets force pin the legacy model fallback when no default_model is set', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\nmodel = "provider/fast"\nforce = true\n', ); - expect(subagentDisplayModel(withRecipe.config, 'provider/main')).toBe('provider/main'); - withRecipe.disposables.dispose(); - const bare = await createConfig({}); - expect(subagentDisplayModel(bare.config, SECONDARY_DERIVED_MODEL_ID)).toBe( - SECONDARY_DERIVED_MODEL_ID, + expect(resolveSubagentBinding(config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', + thinking: undefined, + }); + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own, 'primary')).toThrow( + /Invalid model "primary": \[secondary_model\]\.force is set/, ); - bare.disposables.dispose(); + + disposables.dispose(); }); - it('normalizes an inherited derived alias on the caller-fallback branch', async () => { - const withRecipe = await createConfig({}, '[secondary_model]\nmodel = "provider/secondary"\n'); - const own = { modelAlias: SECONDARY_DERIVED_MODEL_ID, thinkingLevel: 'medium' }; - expect(resolveSubagentBinding(withRecipe.config, secondaryModelFlags(false), own)).toEqual({ - model: SECONDARY_DERIVED_MODEL_ID, - thinking: 'medium', - displayModel: 'provider/secondary', + it('round-trips legacy recipe patch fields the pool resolution ignores', async () => { + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\nmodel = "provider/fast"\ndefault_effort = "low"\nmax_output_size = 8192\n', + ); + + expect(config.get(SECONDARY_MODEL_SECTION)).toEqual({ + model: 'provider/fast', + defaultEffort: 'low', + maxOutputSize: 8192, }); - withRecipe.disposables.dispose(); + expect(resolveSubagentModelPool(config)).toEqual({ + defaultModel: 'provider/fast', + models: { 'provider/fast': '' }, + }); + + // A v2 write validates before persisting — the patch fields must survive. + await config.set(SECONDARY_MODEL_SECTION, { defaultModel: 'provider/fast' }); + const after = config.get(SECONDARY_MODEL_SECTION); + expect(after?.defaultEffort).toBe('low'); + expect(after?.maxOutputSize).toBe(8192); + + disposables.dispose(); + }); + + it('binds every spawn to the forced default_model, rejecting even "primary"', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\nforce = true\n', + ); + + expect(config.get(SECONDARY_MODEL_SECTION)).toEqual({ + defaultModel: 'provider/fast', + force: true, + }); + // An omitted model binds the forced default, with no thinking inheritance. + expect(resolveSubagentBinding(config, secondaryModelFlags(), own)).toEqual({ + model: 'provider/fast', + thinking: undefined, + }); + // Any explicit choice — "primary" included — is rejected. + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own, 'primary')).toThrow( + /Invalid model "primary": \[secondary_model\]\.force is set/, + ); + + disposables.dispose(); + }); + + it('rejects force combined with a models table at spawn resolution, matching startup validation', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\nforce = true\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n', + ); + + // A live session can reach this state through a deep-merged config patch + // that adds force without clearing the pool table; spawn resolution must + // fail the same way the startup pre-flight does. + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own)).toThrow( + /\[secondary_model\]\.force cannot be combined with \[secondary_model\.models\]/, + ); + + disposables.dispose(); + }); + + it('rejects an alias outside the pool, listing the available models', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig( + {}, + '[secondary_model]\ndefault_model = "provider/fast"\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n"provider/smart" = "hard tasks"\n', + ); + + let caught: unknown; + try { + resolveSubagentBinding(config, secondaryModelFlags(), own, 'provider/typo'); + } catch (error) { + caught = error; + } + expect(isError2(caught)).toBe(true); + expect((caught as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((caught as Error2).message).toBe( + 'Invalid model "provider/typo". Available models: provider/fast, provider/smart, primary.', + ); + + disposables.dispose(); + }); + + it('rejects a stray model choice when no pool is configured', async () => { + const own = { modelAlias: 'provider/main', thinkingLevel: 'medium' }; + const { config, disposables } = await createConfig({}); + + expect(() => resolveSubagentBinding(config, secondaryModelFlags(), own, 'provider/fast')).toThrow( + /Invalid model "provider\/fast": no \[secondary_model\.models\] pool is configured/, + ); + + disposables.dispose(); }); - it('preserves the coded error contract when adding secondary-model guidance', () => { + it('preserves the coded error contract when adding subagent-model guidance', () => { const cause = new Error2( ErrorCodes.CONFIG_INVALID, 'Model "provider/bad" is not configured in config.toml.', @@ -1842,13 +2034,12 @@ describe('subagent config section', () => { expect(toErrorPayload(result)).toMatchObject({ code: ErrorCodes.CONFIG_INVALID, - message: expect.stringContaining('comes from [secondary_model].model / KIMI_SECONDARY_MODEL'), + message: expect.stringContaining('comes from [secondary_model.models]'), details: { model: 'provider/bad', - secondaryModel: 'provider/bad', - secondaryModelConfig: { - section: 'secondaryModel.model', - environment: SECONDARY_MODEL_ENV, + subagentModel: 'provider/bad', + subagentModelConfig: { + section: 'secondary_model.models', }, }, cause: { @@ -1861,96 +2052,16 @@ describe('subagent config section', () => { it('passes through config-invalid failures that are not a missing bound alias', () => { const malformed = new Error2( ErrorCodes.CONFIG_INVALID, - 'Model "provider/secondary" must declare a wire protocol (config: models..protocol).', + 'Model "provider/pool" must declare a wire protocol (config: models..protocol).', ); - expect(wrapSubagentModelError(malformed, 'provider/secondary', 'provider/main')).toBe(malformed); + expect(wrapSubagentModelError(malformed, 'provider/pool', 'provider/main')).toBe(malformed); const unrelated = new Error2( ErrorCodes.CONFIG_INVALID, 'Model "provider/other" is not configured in config.toml.', { details: { model: 'provider/other' } }, ); - expect(wrapSubagentModelError(unrelated, 'provider/secondary', 'provider/main')).toBe(unrelated); - }); -}); - -describe('secondaryModel config section', () => { - async function createConfig(env: Record, toml?: string) { - const disposables = new DisposableStore(); - const ix = disposables.add(new TestInstantiationService()); - const storage = new InMemoryStorageService(); - if (toml !== undefined) { - await storage.write('', 'config.toml', new TextEncoder().encode(toml)); - } - ix.stub(ILogService, stubLog()); - ix.stub(IBootstrapService, stubBootstrap('/tmp/kimi-cfg', env)); - ix.stub(IFileSystemStorageService, storage); - ix.set(IAtomicTomlDocumentStore, new SyncDescriptor(TomlAtomicDocumentStore)); - ix.set(IConfigRegistry, new SyncDescriptor(ConfigRegistry)); - ix.set(IConfigService, new SyncDescriptor(ConfigService)); - const config = ix.get(IConfigService); - await config.ready; - return { config, disposables }; - } - - it('reads model/default_effort from config.toml and lets the env vars win', async () => { - const env: Record = {}; - const { config, disposables } = await createConfig( - env, - '[secondary_model]\nmodel = "provider/secondary"\ndefault_effort = "low"\n', - ); - expect(resolveSecondaryModel(config, secondaryModelFlags())?.model).toBe('provider/secondary'); - expect(resolveSecondaryModel(config, secondaryModelFlags())?.defaultEffort).toBe('low'); - - env[SECONDARY_MODEL_ENV] = 'provider/env-secondary'; - env[SECONDARY_MODEL_EFFORT_ENV] = 'high'; - expect(resolveSecondaryModel(config, secondaryModelFlags())?.model).toBe('provider/env-secondary'); - expect(resolveSecondaryModel(config, secondaryModelFlags())?.defaultEffort).toBe('high'); - - env[SECONDARY_MODEL_ENV] = ' '; - expect(resolveSecondaryModel(config, secondaryModelFlags())?.model).toBe('provider/secondary'); - - disposables.dispose(); - }); - - it('restores the env-owned model to the raw value on set() while the env var is set', async () => { - const env: Record = { [SECONDARY_MODEL_ENV]: 'provider/env-secondary' }; - const { config, disposables } = await createConfig( - env, - '[secondary_model]\nmodel = "provider/raw-secondary"\n', - ); - - await config.set(SECONDARY_MODEL_SECTION, { model: 'provider/env-secondary' }); - - expect(resolveSecondaryModel(config, secondaryModelFlags())?.model).toBe('provider/env-secondary'); - expect(config.inspect(SECONDARY_MODEL_SECTION).userValue).toEqual({ - model: 'provider/raw-secondary', - }); - - disposables.dispose(); - }); - - it('propagates overlay-induced models changes to section events on runtime set', async () => { - const { config, disposables } = await createConfig( - {}, - '[models.k2]\nprovider = "kimi"\nmodel = "kimi-k2"\n', - ); - const domains: string[] = []; - config.onDidSectionChange((e) => domains.push(e.domain)); - - await config.set(SECONDARY_MODEL_SECTION, { model: 'k2', maxOutputSize: 8192 }); - const models = config.get>(MODELS_SECTION) ?? {}; - expect(models[SECONDARY_DERIVED_MODEL_ID]).toBeDefined(); - expect(domains).toContain(SECONDARY_MODEL_SECTION); - expect(domains).toContain(MODELS_SECTION); - - domains.length = 0; - await config.replace(SECONDARY_MODEL_SECTION, { model: 'k2' }); - const after = config.get>(MODELS_SECTION) ?? {}; - expect(after[SECONDARY_DERIVED_MODEL_ID]).toBeUndefined(); - expect(domains).toContain(MODELS_SECTION); - - disposables.dispose(); + expect(wrapSubagentModelError(unrelated, 'provider/pool', 'provider/main')).toBe(unrelated); }); }); diff --git a/packages/agent-core-v2/test/app/kosongConfig/discovery.test.ts b/packages/agent-core-v2/test/app/kosongConfig/discovery.test.ts index 717a9d1ab16..a12c89dfa84 100644 --- a/packages/agent-core-v2/test/app/kosongConfig/discovery.test.ts +++ b/packages/agent-core-v2/test/app/kosongConfig/discovery.test.ts @@ -446,6 +446,87 @@ describe('refreshProviderModels write behavior', () => { } }); + it('clears the subagent model pool when a refresh drops its default alias', async () => { + const baseUrl = 'https://api.managed.example.test/coding/v1'; + vi.stubEnv('KIMI_CODE_BASE_URL', baseUrl); + const fetchMock = vi.fn( + async () => + new Response( + JSON.stringify({ + data: [{ id: 'kimi-k3', context_length: 1048576, supports_reasoning: true }], + }), + { status: 200, headers: { 'Content-Type': 'application/json' } }, + ), + ); + vi.stubGlobal('fetch', fetchMock); + + const { host, config, discovery } = await createHost({ + providers: { + 'my-kimi': { type: 'kimi', baseUrl, apiKey: 'sk-distributed-key' }, + }, + models: { + 'my-kimi/kimi-k2': { provider: 'my-kimi', model: 'kimi-k2', maxContextSize: 262144 }, + }, + secondaryModel: { + defaultModel: 'my-kimi/kimi-k2', + models: { 'my-kimi/kimi-k2': 'fast and cheap' }, + }, + }); + try { + const result = await discovery.refreshProviderModels({ scope: 'all' }); + + expect(result.changed).toEqual([ + { provider_id: 'my-kimi', provider_name: 'my-kimi', added: 1, removed: 1 }, + ]); + expect(config.get('secondaryModel')).toBeUndefined(); + } finally { + host.dispose(); + } + }); + + it('filters pool entries a refresh dropped while keeping a surviving default', async () => { + const baseUrl = 'https://api.managed.example.test/coding/v1'; + vi.stubEnv('KIMI_CODE_BASE_URL', baseUrl); + const fetchMock = vi.fn( + async () => + new Response( + JSON.stringify({ + data: [{ id: 'kimi-k3', context_length: 1048576, supports_reasoning: true }], + }), + { status: 200, headers: { 'Content-Type': 'application/json' } }, + ), + ); + vi.stubGlobal('fetch', fetchMock); + + const { host, config, discovery } = await createHost({ + providers: { + ...staticProviders, + 'my-kimi': { type: 'kimi', baseUrl, apiKey: 'sk-distributed-key' }, + }, + models: { + ...staticModels, + 'my-kimi/kimi-k2': { provider: 'my-kimi', model: 'kimi-k2', maxContextSize: 262144 }, + }, + secondaryModel: { + defaultModel: 's1', + models: { s1: 'static fallback', 'my-kimi/kimi-k2': 'managed' }, + }, + }); + try { + const result = await discovery.refreshProviderModels({ scope: 'all' }); + + expect(result.changed).toEqual([ + { provider_id: 'my-kimi', provider_name: 'my-kimi', added: 1, removed: 1 }, + ]); + expect(config.get('secondaryModel')).toEqual({ + defaultModel: 's1', + models: { s1: 'static fallback' }, + }); + } finally { + host.dispose(); + } + }); + it('never exposes a halfway-removed catalog: the registries stay untouched until the single atomic write', async () => { const fetchMock = vi.fn( async () => diff --git a/packages/agent-core-v2/test/app/kosongConfig/modelsDevImport.test.ts b/packages/agent-core-v2/test/app/kosongConfig/modelsDevImport.test.ts index 5f4dbaf8e90..5f6500f17f0 100644 --- a/packages/agent-core-v2/test/app/kosongConfig/modelsDevImport.test.ts +++ b/packages/agent-core-v2/test/app/kosongConfig/modelsDevImport.test.ts @@ -254,6 +254,62 @@ describe('IModelsDevImportService', () => { expect(config.get('defaultModel')).toBe('k2'); }); + it('filters pool entries a catalog import drops, keeping a surviving default', async () => { + setModelsDevUpstreamForTest({ fetchImpl: fetchJson(CATALOG) }); + const { config, imports } = createHost({ + providers: { openai: { type: 'openai', apiKey: 'sk-old' } }, + models: { + 'openai/gpt-4o': { provider: 'openai', model: 'gpt-4o', maxContextSize: 128000 }, + k2: { provider: 'kimi', model: 'kimi-k2', maxContextSize: 131072 }, + }, + secondaryModel: { + defaultModel: 'k2', + models: { k2: 'fast', 'openai/gpt-4o': 'smart' }, + }, + }); + + await imports.importModelsDevProvider({ catalogId: 'openai' }); + + // The import rebuilt openai's alias set (gpt-4o → gpt-4.1): the dropped + // alias leaves the pool, the surviving default stays. + expect(config.get('secondaryModel')).toEqual({ + defaultModel: 'k2', + models: { k2: 'fast' }, + }); + }); + + it('clears the pool when a catalog import orphans its default', async () => { + setModelsDevUpstreamForTest({ fetchImpl: fetchJson(CATALOG) }); + const { config, imports } = createHost({ + providers: { openai: { type: 'openai', apiKey: 'sk-old' } }, + models: { + 'openai/gpt-4o': { provider: 'openai', model: 'gpt-4o', maxContextSize: 128000 }, + }, + secondaryModel: { defaultModel: 'openai/gpt-4o' }, + }); + + await imports.importModelsDevProvider({ catalogId: 'openai' }); + + expect(config.get('secondaryModel')).toBeUndefined(); + }); + + it('cascades the pool on custom-registry imports too', async () => { + setModelsDevUpstreamForTest({ fetchImpl: fetchJson(REGISTRY_DOC) }); + const { config, imports } = createHost({ + providers: { 'acme-gpt': { type: 'openai', apiKey: 'sk-old' } }, + models: { + 'acme-gpt/gpt-old': { provider: 'acme-gpt', model: 'gpt-old', maxContextSize: 64000 }, + }, + secondaryModel: { defaultModel: 'acme-gpt/gpt-old' }, + }); + + await imports.importCustomRegistry({ url: REGISTRY_URL }); + + // The registry rebuild replaced acme-gpt's only alias (gpt-old → gpt-x), + // orphaning the pool default. + expect(config.get('secondaryModel')).toBeUndefined(); + }); + it('seeds default_model from the first imported model only when none is configured', async () => { setModelsDevUpstreamForTest({ fetchImpl: fetchJson(CATALOG) }); const { config, imports } = createHost({ providers: {}, models: {} }); diff --git a/packages/agent-core-v2/test/app/kosongConfig/secondaryModelOverlay.test.ts b/packages/agent-core-v2/test/app/kosongConfig/secondaryModelOverlay.test.ts deleted file mode 100644 index f575fa5f46c..00000000000 --- a/packages/agent-core-v2/test/app/kosongConfig/secondaryModelOverlay.test.ts +++ /dev/null @@ -1,108 +0,0 @@ -/** - * `app/kosongConfig` secondaryModelOverlay tests — the `[secondary_model]` - * derived-entry synthesis: - * - * - a recipe with patch fields synthesizes `SECONDARY_DERIVED_MODEL_ID` - * (base copy, patch merged into `overrides` with patch winning conflicts, - * `aliases` dropped); a pointer-only recipe, a missing pointer, and a - * dangling pointer synthesize nothing; - * - `strip` keeps the synthesized entry out of `config.toml`. - */ - -import { describe, expect, it } from 'vitest'; - -import { - MODELS_SECTION, - SECONDARY_MODEL_SECTION, -} from '#/app/kosongConfig/configSection'; -import { - SECONDARY_DERIVED_MODEL_ID, - secondaryModelOverlay, -} from '#/app/kosongConfig/secondaryModelOverlay'; - -function apply(effective: Record): readonly string[] { - return secondaryModelOverlay.apply(effective, () => undefined, (_domain, value) => value); -} - -const baseEntry = { - provider: 'kimi', - model: 'kimi-k2', - maxContextSize: 262144, - aliases: ['k2-latest'], - overrides: { defaultEffort: 'medium', supportEfforts: ['low', 'medium', 'high'] }, -}; - -describe('secondaryModelOverlay.apply', () => { - it('does nothing when no secondary model is configured', () => { - const effective: Record = { [MODELS_SECTION]: { k2: baseEntry } }; - expect(apply(effective)).toEqual([]); - expect(effective[MODELS_SECTION]).toEqual({ k2: baseEntry }); - }); - - it('does nothing for a pointer-only recipe (no patch fields)', () => { - const effective: Record = { - [MODELS_SECTION]: { k2: baseEntry }, - [SECONDARY_MODEL_SECTION]: { model: 'k2' }, - }; - expect(apply(effective)).toEqual([]); - expect(effective[MODELS_SECTION]).toEqual({ k2: baseEntry }); - }); - - it('synthesizes the derived entry: base copy, patch wins overrides conflicts, aliases dropped', () => { - const effective: Record = { - [MODELS_SECTION]: { k2: baseEntry }, - [SECONDARY_MODEL_SECTION]: { model: 'k2', defaultEffort: 'low', maxOutputSize: 8192 }, - }; - expect(apply(effective)).toEqual([MODELS_SECTION]); - const models = effective[MODELS_SECTION] as Record; - expect(models[SECONDARY_DERIVED_MODEL_ID]).toEqual({ - provider: 'kimi', - model: 'kimi-k2', - maxContextSize: 262144, - overrides: { - defaultEffort: 'low', - supportEfforts: ['low', 'medium', 'high'], - maxOutputSize: 8192, - }, - }); - expect(models['k2']).toEqual(baseEntry); - }); - - it('does nothing when the pointed entry does not exist', () => { - const effective: Record = { - [MODELS_SECTION]: { k2: baseEntry }, - [SECONDARY_MODEL_SECTION]: { model: 'nope', maxOutputSize: 8192 }, - }; - expect(apply(effective)).toEqual([]); - expect(effective[MODELS_SECTION]).toEqual({ k2: baseEntry }); - }); - - it('never derives from the derived id itself', () => { - const effective: Record = { - [MODELS_SECTION]: { [SECONDARY_DERIVED_MODEL_ID]: baseEntry }, - [SECONDARY_MODEL_SECTION]: { model: SECONDARY_DERIVED_MODEL_ID, maxOutputSize: 1 }, - }; - expect(apply(effective)).toEqual([]); - }); -}); - -describe('secondaryModelOverlay.strip', () => { - const strip = secondaryModelOverlay.strip!; - - it('removes the derived entry from models writes and leaves other domains alone', () => { - const models = { k2: baseEntry, [SECONDARY_DERIVED_MODEL_ID]: { ...baseEntry } }; - expect(strip(MODELS_SECTION, models, {})).toEqual({ k2: baseEntry }); - expect(strip('thinking', { effort: 'low' }, {})).toEqual({ effort: 'low' }); - }); - - it('leaves a models section without the derived entry untouched', () => { - const models = { k2: baseEntry }; - expect(strip(MODELS_SECTION, models, {})).toBe(models); - }); - - it('rolls back a defaultModel pointer set to the derived id', () => { - expect(strip('defaultModel', 'k2', {})).toBe('k2'); - expect(strip('defaultModel', SECONDARY_DERIVED_MODEL_ID, { default_model: 'k2' })).toBe('k2'); - expect(strip('defaultModel', SECONDARY_DERIVED_MODEL_ID, {})).toBeUndefined(); - }); -}); diff --git a/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts b/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts index d2bf1ce4527..d1b46fc822d 100644 --- a/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts +++ b/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts @@ -10,6 +10,11 @@ import { Event } from '#/_base/event'; import { ILogService } from '#/_base/log/log'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IConfigService } from '#/app/config/config'; +import { IModelCatalog } from '#/kosong/model/catalog'; +import { IModelService } from '#/kosong/model/model'; +import { IProviderService } from '#/kosong/provider/provider'; +import { stubProviderService } from '../provider/stubs'; +import { IFlagService } from '#/app/flag/flag'; import { ICronTaskPersistence } from '#/app/cron/cronTaskPersistence'; import { IEventService } from '#/app/event/event'; import { IHostEnvironment } from '#/os/interface/hostEnvironment'; @@ -50,6 +55,7 @@ import { IWorkspaceToolPolicy } from '#/workspace/workspaceToolPolicy/workspaceT import { WorkspaceToolPolicyService } from '#/workspace/workspaceToolPolicy/workspaceToolPolicyService'; import { recordingTelemetry, type TelemetryRecord } from '../telemetry/stubs'; import { stubLog } from '../../_base/log/stubs'; +import { stubFlag } from '../../app/flag/stubs'; import { IWorkspaceLifecycleService } from '#/app/workspaceLifecycle/workspaceLifecycle'; import { WorkspaceLifecycleService } from '#/app/workspaceLifecycle/workspaceLifecycleService'; @@ -326,6 +332,13 @@ describe('WorkspaceLifecycleService', () => { stubPair(ISessionIndex, sessionIndexStub()), stubPair(ISessionIndexMirror, sessionIndexMirrorStub()), stubPair(IConfigService, { get: () => undefined } as unknown as IConfigService), + stubPair(IModelCatalog, { _serviceBrand: undefined } as unknown as IModelCatalog), + stubPair(IModelService, { + _serviceBrand: undefined, + ready: Promise.resolve(), + } as unknown as IModelService), + stubPair(IProviderService, stubProviderService()), + stubPair(IFlagService, stubFlag(() => false)), stubPair(IAppendLogStore, { _serviceBrand: undefined, append: () => {}, diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index 0d02bd76b16..03edcf84d1e 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -186,7 +186,6 @@ import { MODELS_SECTION, PROVIDERS_SECTION, } from '#/app/kosongConfig/configSection'; -import { secondaryModelOverlay } from '#/app/kosongConfig/secondaryModelOverlay'; import { IModelCatalog, type Model } from '#/kosong/model/catalog'; import { ModelCatalog } from '#/kosong/model/catalogService'; import { IModelOAuthTokens } from '#/kosong/model/modelOAuth'; @@ -2375,11 +2374,7 @@ function applyTestAgentOptionsToConfig(config: KimiConfig, options: TestAgentOpt } function configService(readConfig: () => KimiConfig): IConfigService { - const effectiveConfig = () => { - const effective = { ...configWithEnvOverrides(readConfig()) } as Record; - secondaryModelOverlay.apply(effective, () => undefined, (_domain, value) => value); - return effective as unknown as KimiConfig; - }; + const effectiveConfig = () => configWithEnvOverrides(readConfig()); const memory = new Map(); const sectionEmitter = new Emitter<{ readonly domain: string; diff --git a/packages/agent-core-v2/test/kosong/stubs.ts b/packages/agent-core-v2/test/kosong/stubs.ts index 2bd232b363e..2840e96e5a4 100644 --- a/packages/agent-core-v2/test/kosong/stubs.ts +++ b/packages/agent-core-v2/test/kosong/stubs.ts @@ -63,7 +63,7 @@ export class StubConfigService implements IConfigService { replace(domain: string, value: unknown): Promise { const previousValue = this._values.get(domain); - if (value === undefined) { + if (value === undefined || value === null) { this._values.delete(domain); } else { this._values.set(domain, value); @@ -75,7 +75,7 @@ export class StubConfigService implements IConfigService { replaceSections(sections: Readonly>): Promise { for (const [domain, value] of Object.entries(sections)) { const previousValue = this._values.get(domain); - if (value === undefined) { + if (value === undefined || value === null) { this._values.delete(domain); } else { this._values.set(domain, value); diff --git a/packages/agent-core-v2/test/session/subagent/secondaryModelWarning.test.ts b/packages/agent-core-v2/test/session/subagent/secondaryModelWarning.test.ts deleted file mode 100644 index 8d840ac7a92..00000000000 --- a/packages/agent-core-v2/test/session/subagent/secondaryModelWarning.test.ts +++ /dev/null @@ -1,291 +0,0 @@ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; - -import { SyncDescriptor } from '#/_base/di/descriptors'; -import { DisposableStore } from '#/_base/di/lifecycle'; -import { LifecycleScope } from '#/app/scopes'; -import { type IAgentScopeHandle } from '#/_base/di/scope'; -import { TestInstantiationService } from '#/_base/di/test'; -import { Emitter } from '#/_base/event'; -import { IConfigService } from '#/app/config/config'; -import { IEventBus, type DomainEvent } from '#/app/event/eventBus'; -import { IFlagService } from '#/app/flag/flag'; -import { SECONDARY_MODEL_SECTION } from '#/app/kosongConfig/configSection'; -import { ErrorCodes, Error2 } from '#/errors'; -import { IModelCatalog, type Model } from '#/kosong/model/catalog'; -import { - IAgentLifecycleService, - MAIN_AGENT_ID, -} from '#/session/agentLifecycle/agentLifecycle'; -import { - ISessionSecondaryModelWarningService, - SECONDARY_MODEL_EFFORT_WARNING_CODE, - SECONDARY_MODEL_INVALID_WARNING_CODE, -} from '#/session/subagent/secondaryModelWarning'; -import { SessionSecondaryModelWarningService } from '#/session/subagent/secondaryModelWarningService'; -import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; - -import { stubFlag } from '../../app/flag/stubs'; -import { StubConfigService } from '../../kosong/stubs'; - -describe('SessionSecondaryModelWarningService', () => { - let disposables: DisposableStore; - let ix: TestInstantiationService; - let onDidCreate: Emitter; - let handles: Map; - let published: DomainEvent[]; - let modelIds: Record; - let config: StubConfigService; - - beforeEach(() => { - disposables = new DisposableStore(); - ix = disposables.add(new TestInstantiationService()); - onDidCreate = disposables.add(new Emitter()); - handles = new Map(); - published = []; - modelIds = {}; - }); - afterEach(() => { - disposables.dispose(); - }); - - function setup(configValues: Record, flagEnabled = true): void { - ix.stub(IAgentLifecycleService, { - _serviceBrand: undefined, - onDidCreate: onDidCreate.event, - get: (agentId: string) => handles.get(agentId), - } as unknown as IAgentLifecycleService); - config = new StubConfigService(configValues); - ix.stub(IConfigService, config); - ix.stub( - IFlagService, - stubFlag((id) => flagEnabled && id === SECONDARY_MODEL_FLAG_ID), - ); - ix.stub(IModelCatalog, { - _serviceBrand: undefined, - get: (id: string) => { - const model = modelIds[id]; - if (model === undefined) { - throw new Error2(ErrorCodes.CONFIG_INVALID, `Model "${id}" is not configured in config.toml.`, { - details: { model: id }, - }); - } - return model; - }, - } as unknown as IModelCatalog); - ix.set( - ISessionSecondaryModelWarningService, - new SyncDescriptor(SessionSecondaryModelWarningService), - ); - } - - function createMain(): IAgentScopeHandle { - const handle = agentHandle(MAIN_AGENT_ID, published); - handles.set(MAIN_AGENT_ID, handle); - onDidCreate.fire(handle); - return handle; - } - - it('stays silent when no secondary model is configured', () => { - setup({}); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('stays silent when the secondary-model experiment is disabled', () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }, false); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('warns when the configured secondary model does not resolve', () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - const warning = svc.getSecondaryModelWarning(); - expect(warning?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(warning?.message).toContain('"provider/typo"'); - expect(warning?.message).toContain('KIMI_SECONDARY_MODEL'); - expect(warning?.message).toContain('not configured'); - expect(published).toEqual([ - { type: 'warning', code: warning?.code, message: warning?.message }, - ]); - }); - - it('warns when the configured default effort is not listed by the resolved model', () => { - modelIds['provider/secondary'] = modelStub({ supportEfforts: ['low', 'high'] }); - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/secondary', defaultEffort: 'hihg' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - const warning = svc.getSecondaryModelWarning(); - expect(warning?.code).toBe(SECONDARY_MODEL_EFFORT_WARNING_CODE); - expect(warning?.message).toContain('"hihg"'); - expect(warning?.message).toContain('low, high'); - expect(warning?.message).toContain('KIMI_SECONDARY_EFFORT'); - }); - - it.each([ - { secondary: { model: 'provider/secondary', defaultEffort: 'high' }, label: 'a listed effort' }, - { secondary: { model: 'provider/secondary', defaultEffort: 'off' }, label: '"off"' }, - { secondary: { model: 'provider/secondary', defaultEffort: 'on' }, label: '"on"' }, - { secondary: { model: 'provider/secondary' }, label: 'no effort' }, - ])('stays silent for $label', ({ secondary }) => { - modelIds['provider/secondary'] = modelStub({ supportEfforts: ['low', 'high'] }); - setup({ [SECONDARY_MODEL_SECTION]: secondary }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('checks the effort against the patched supportEfforts of the derived entry', () => { - modelIds['provider/secondary'] = modelStub({ supportEfforts: ['low', 'high'] }); - setup({ - [SECONDARY_MODEL_SECTION]: { - model: 'provider/secondary', - supportEfforts: ['low'], - defaultEffort: 'high', - }, - }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - const warning = svc.getSecondaryModelWarning(); - expect(warning?.code).toBe(SECONDARY_MODEL_EFFORT_WARNING_CODE); - expect(warning?.message).toContain('"high"'); - expect(warning?.message).toContain('known: low'); - }); - - it('stays silent when the patched supportEfforts lists the default effort', () => { - modelIds['provider/secondary'] = modelStub({ supportEfforts: ['high'] }); - setup({ - [SECONDARY_MODEL_SECTION]: { - model: 'provider/secondary', - supportEfforts: ['low'], - defaultEffort: 'low', - }, - }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('stays silent for any effort when the model lists none', () => { - modelIds['provider/freeform'] = modelStub({}); - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/freeform', defaultEffort: 'whatever' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('ignores created agents that are not the main agent', () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - onDidCreate.fire(agentHandle('agent-1', published)); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(0); - }); - - it('checks a main agent that already exists at construction', () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - handles.set(MAIN_AGENT_ID, agentHandle(MAIN_AGENT_ID, published)); - const svc = ix.get(ISessionSecondaryModelWarningService); - expect(svc.getSecondaryModelWarning()?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(published).toHaveLength(1); - }); - - it('publishes at most once when both trigger paths fire', () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - handles.set(MAIN_AGENT_ID, agentHandle(MAIN_AGENT_ID, published)); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(published).toHaveLength(1); - }); - - it('recheck publishes a newly broken recipe once and stays quiet while it is unchanged', async () => { - modelIds['provider/secondary'] = modelStub({}); - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/secondary' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - - await config.replace(SECONDARY_MODEL_SECTION, { model: 'provider/typo' }); - const warning = svc.recheckSecondaryModelWarning(); - expect(warning?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(svc.getSecondaryModelWarning()).toEqual(warning); - expect(published).toEqual([{ type: 'warning', code: warning?.code, message: warning?.message }]); - - expect(svc.recheckSecondaryModelWarning()).toEqual(warning); - expect(published).toHaveLength(1); - }); - - it('recheck clears the cached warning when the recipe is fixed or removed', async () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - createMain(); - expect(svc.getSecondaryModelWarning()?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(published).toHaveLength(1); - - modelIds['provider/secondary'] = modelStub({}); - await config.replace(SECONDARY_MODEL_SECTION, { model: 'provider/secondary' }); - expect(svc.recheckSecondaryModelWarning()).toBeUndefined(); - expect(svc.getSecondaryModelWarning()).toBeUndefined(); - - await config.replace(SECONDARY_MODEL_SECTION, { model: 'provider/typo' }); - expect(svc.recheckSecondaryModelWarning()?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - await config.replace(SECONDARY_MODEL_SECTION, undefined); - expect(svc.recheckSecondaryModelWarning()).toBeUndefined(); - expect(published).toHaveLength(2); - }); - - it('recheck before the main agent exists caches silently; the initial check still publishes', async () => { - setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); - const svc = ix.get(ISessionSecondaryModelWarningService); - expect(svc.recheckSecondaryModelWarning()?.code).toBe(SECONDARY_MODEL_INVALID_WARNING_CODE); - expect(published).toHaveLength(0); - createMain(); - expect(published).toHaveLength(1); - }); -}); - -function agentHandle(id: string, published: DomainEvent[]): IAgentScopeHandle { - const bus: IEventBus = { - _serviceBrand: undefined, - publish: vi.fn((event: DomainEvent) => { - published.push(event); - }), - subscribe: vi.fn(() => ({ dispose: () => {} })) as IEventBus['subscribe'], - }; - return { - id, - kind: LifecycleScope.Agent, - accessor: { - get: ((serviceId: unknown) => { - if (serviceId === IEventBus) return bus; - throw new Error('unexpected service resolution'); - }) as IAgentScopeHandle['accessor']['get'], - }, - dispose: () => {}, - }; -} - -function modelStub(overrides: Partial): Model { - return { - id: 'provider/secondary', - name: 'secondary', - aliases: [], - protocol: 'openai', - headers: {}, - capabilities: {}, - maxContextSize: 100000, - alwaysThinking: false, - providerName: 'provider', - authProvider: { getAuth: () => Promise.resolve({}) }, - ...overrides, - } as unknown as Model; -} diff --git a/packages/agent-core-v2/test/session/subagent/subagentModelsValidation.test.ts b/packages/agent-core-v2/test/session/subagent/subagentModelsValidation.test.ts new file mode 100644 index 00000000000..b31a61a90af --- /dev/null +++ b/packages/agent-core-v2/test/session/subagent/subagentModelsValidation.test.ts @@ -0,0 +1,248 @@ +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; + +import { SyncDescriptor } from '#/_base/di/descriptors'; +import { DisposableStore } from '#/_base/di/lifecycle'; +import { TestInstantiationService } from '#/_base/di/test'; +import { IConfigService } from '#/app/config/config'; +import { IFlagService } from '#/app/flag/flag'; +import { ErrorCodes, Error2, isError2 } from '#/errors'; +import { IModelCatalog, type Model } from '#/kosong/model/catalog'; +import { + SECONDARY_MODEL_SECTION, + SUBAGENT_SECTION, +} from '#/session/subagent/configSection'; +import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; +import { ISessionSubagentModelsValidationService } from '#/session/subagent/subagentModelsValidation'; +import { SessionSubagentModelsValidationService } from '#/session/subagent/subagentModelsValidationService'; + +import { StubConfigService } from '../../kosong/stubs'; +import { stubFlag } from '../../app/flag/stubs'; + +describe('SessionSubagentModelsValidationService', () => { + let disposables: DisposableStore; + let ix: TestInstantiationService; + let modelIds: Set; + + beforeEach(() => { + disposables = new DisposableStore(); + ix = disposables.add(new TestInstantiationService()); + modelIds = new Set(); + }); + afterEach(() => { + disposables.dispose(); + }); + + function setup(configValues: Record, flagEnabled = true): void { + ix.stub(IConfigService, new StubConfigService(configValues)); + ix.stub(IFlagService, stubFlag((id) => flagEnabled && id === SECONDARY_MODEL_FLAG_ID)); + ix.stub(IModelCatalog, { + _serviceBrand: undefined, + get: (id: string) => { + if (!modelIds.has(id)) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Model "${id}" is not configured in config.toml.`, + { details: { model: id } }, + ); + } + return { id } as Model; + }, + } as unknown as IModelCatalog); + ix.set( + ISessionSubagentModelsValidationService, + new SyncDescriptor(SessionSubagentModelsValidationService), + ); + } + + function resolve(): unknown { + try { + ix.get(ISessionSubagentModelsValidationService); + return undefined; + } catch (error) { + return error; + } + } + + it('is a no-op when no secondary_model section is configured', () => { + setup({}); + expect(resolve()).toBeUndefined(); + }); + + it('is a no-op when only the [subagent] timeout is configured', () => { + setup({ [SUBAGENT_SECTION]: { timeoutMs: 5000 } }); + expect(resolve()).toBeUndefined(); + }); + + it('is a no-op for a broken pool while the secondary-model experiment is off', () => { + setup({ [SECONDARY_MODEL_SECTION]: { defaultModel: 'provider/typo' } }, false); + expect(resolve()).toBeUndefined(); + }); + + it('constructs fine when default_model alone forms an implicit single-entry pool', () => { + modelIds.add('provider/fast'); + setup({ [SECONDARY_MODEL_SECTION]: { defaultModel: 'provider/fast' } }); + expect(resolve()).toBeUndefined(); + }); + + it('constructs fine when the legacy model key alone forms the fallback pool', () => { + modelIds.add('provider/fast'); + setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/fast' } }); + expect(resolve()).toBeUndefined(); + }); + + it('fails session creation when the legacy model fallback does not resolve', () => { + setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/typo' } }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model.models] entry "provider/typo" could not be resolved', + ); + }); + + it('constructs fine when force pins the legacy model fallback', () => { + modelIds.add('provider/fast'); + setup({ [SECONDARY_MODEL_SECTION]: { model: 'provider/fast', force: true } }); + expect(resolve()).toBeUndefined(); + }); + + it('fails session creation when a pool table relies on the legacy model key for its default', () => { + modelIds.add('provider/fast'); + setup({ + [SECONDARY_MODEL_SECTION]: { + model: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model].default_model is required when [secondary_model.models] is configured', + ); + }); + + it('fails session creation when a pool-less default_model does not resolve', () => { + setup({ [SECONDARY_MODEL_SECTION]: { defaultModel: 'provider/typo' } }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model.models] entry "provider/typo" could not be resolved', + ); + }); + + it('constructs fine for a valid pool', () => { + modelIds.add('provider/fast').add('provider/smart'); + setup({ + [SECONDARY_MODEL_SECTION]: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, + }, + }); + expect(resolve()).toBeUndefined(); + }); + + it('fails session creation when the pool has no default_model', () => { + modelIds.add('provider/fast'); + setup({ [SECONDARY_MODEL_SECTION]: { models: { 'provider/fast': 'fast and cheap' } } }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model].default_model is required when [secondary_model.models] is configured', + ); + }); + + it('fails session creation when default_model is not a pool key, listing the pool', () => { + modelIds.add('provider/fast').add('provider/smart'); + setup({ + [SECONDARY_MODEL_SECTION]: { + defaultModel: 'provider/typo', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, + }, + }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain('"provider/typo"'); + expect((error as Error2).message).toContain( + 'Available models: provider/fast, provider/smart.', + ); + }); + + it('fails session creation when a pool key uses the reserved "primary" alias', () => { + modelIds.add('primary').add('provider/fast'); + setup({ + [SECONDARY_MODEL_SECTION]: { + defaultModel: 'provider/fast', + models: { primary: 'looks like a model', 'provider/fast': 'fast and cheap' }, + }, + }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model.models] key "primary" is reserved', + ); + }); + + it('fails session creation when a pool key does not resolve, naming the key', () => { + modelIds.add('provider/fast'); + setup({ + [SECONDARY_MODEL_SECTION]: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/typo': 'hard tasks' }, + }, + }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model.models] entry "provider/typo" could not be resolved', + ); + expect((error as Error2).message).toContain('"provider/typo" is not configured'); + expect(isError2((error as Error2).cause)).toBe(true); + }); + + it('constructs fine when force pins a resolvable default_model', () => { + modelIds.add('provider/fast'); + setup({ [SECONDARY_MODEL_SECTION]: { defaultModel: 'provider/fast', force: true } }); + expect(resolve()).toBeUndefined(); + }); + + it('fails session creation when force is set without default_model', () => { + setup({ [SECONDARY_MODEL_SECTION]: { force: true } }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model].default_model is required when [secondary_model].force is set', + ); + }); + + it('fails session creation when force is combined with a models table', () => { + modelIds.add('provider/fast'); + setup({ + [SECONDARY_MODEL_SECTION]: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + force: true, + }, + }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain( + '[secondary_model].force cannot be combined with [secondary_model.models]', + ); + }); + + it('fails session creation when the forced default_model does not resolve', () => { + setup({ [SECONDARY_MODEL_SECTION]: { defaultModel: 'provider/typo', force: true } }); + const error = resolve(); + expect(isError2(error)).toBe(true); + expect((error as Error2).code).toBe(ErrorCodes.CONFIG_INVALID); + expect((error as Error2).message).toContain('"provider/typo"'); + }); +}); diff --git a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts b/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts index 539d47f84b7..1c60d858540 100644 --- a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts +++ b/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts @@ -15,8 +15,6 @@ import { IAgentUserToolService } from '#/agent/userTool/userTool'; import { IEventBus, type DomainEvent } from '#/app/event/eventBus'; import { IConfigService } from '#/app/config/config'; import { IFlagService } from '#/app/flag/flag'; -import { SECONDARY_MODEL_SECTION } from '#/app/kosongConfig/configSection'; -import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import { normalizeAgentProfile } from '#/app/agentProfileCatalog/agentProfileCatalog'; import { ISessionAgentProfileCatalog } from '#/session/sessionAgentProfileCatalog/sessionAgentProfileCatalog'; import { APIProviderRateLimitError } from '#/kosong/contract/errors'; @@ -1153,7 +1151,7 @@ describe('SessionSwarmService metadata compatibility', () => { const spawnTask: SessionSwarmSpawnTask = { ...spawnSessionTask('src/a.ts'), kind: 'spawn', - binding: { model: 'provider/secondary', thinking: 'low' }, + binding: { model: 'provider/pool', thinking: 'low' }, }; await expect( @@ -1167,7 +1165,7 @@ describe('SessionSwarmService metadata compatibility', () => { expect.objectContaining({ binding: { profile: 'coder', - model: 'provider/secondary', + model: 'provider/pool', thinking: 'low', }, }), @@ -1176,45 +1174,13 @@ describe('SessionSwarmService metadata compatibility', () => { expect.objectContaining({ type: 'subagent.spawned', subagentId: 'agent-new', - model: 'provider/secondary', + model: 'provider/pool', thinkingEffort: 'low', }), ); }); - it('emits the recipe base alias (never the derived entry id) as the spawned display model', async () => { - ix.stub( - IConfigService, - new StubConfigService({ - [SECONDARY_MODEL_SECTION]: { model: 'provider/base', defaultEffort: 'low' }, - }), - ); - ix.stub(IFlagService, stubFlag((id) => id === SECONDARY_MODEL_FLAG_ID)); - const service = ix.get(ISessionSwarmService); - const spawnTask: SessionSwarmSpawnTask = { - ...spawnSessionTask('src/a.ts'), - kind: 'spawn', - binding: { model: '__secondary__', thinking: 'low' }, - }; - - await expect( - service.run({ - callerAgentId: 'main', - tasks: [spawnTask], - }), - ).resolves.toMatchObject([{ status: 'completed', agentId: 'agent-new' }]); - - expect(eventBus.publish).toHaveBeenCalledWith( - expect.objectContaining({ - type: 'subagent.spawned', - subagentId: 'agent-new', - model: 'provider/base', - thinkingEffort: 'low', - }), - ); - }); - - it('points at the secondary model config when a spawn task binding is invalid', async () => { + it('points at the [secondary_model.models] config when a spawn task binding is invalid', async () => { const service = ix.get(ISessionSwarmService); const spawnTask: SessionSwarmSpawnTask = { ...spawnSessionTask('src/a.ts'), @@ -1230,7 +1196,7 @@ describe('SessionSwarmService metadata compatibility', () => { ).resolves.toMatchObject([ { status: 'failed', - error: expect.stringContaining('comes from [secondary_model].model / KIMI_SECONDARY_MODEL'), + error: expect.stringContaining('comes from [secondary_model.models]'), }, ]); expect(createAgent).not.toHaveBeenCalled(); diff --git a/packages/agent-core-v2/test/tool/tool.test.ts b/packages/agent-core-v2/test/tool/tool.test.ts index 300b96ca1dd..930b13e96a7 100644 --- a/packages/agent-core-v2/test/tool/tool.test.ts +++ b/packages/agent-core-v2/test/tool/tool.test.ts @@ -6,19 +6,12 @@ import { LifecycleScope } from '#/app/scopes'; import { type IAgentScopeHandle } from '#/_base/di/scope'; import { Event, type Event as KimiEvent } from '#/_base/event'; import { ILogService } from '#/_base/log/log'; -import { IFlagService } from '#/app/flag/flag'; -import { MASTER_ENV } from '#/app/flag/flagService'; import { toInputJsonSchema } from '#/tool/input-schema'; import { userCancellationReason } from '#/_base/utils/abort'; import { createHooks } from '#/hooks'; import type { ToolCall } from '#/kosong/contract/message'; import type { TokenUsage } from '#/kosong/contract/usage'; import { IModelCatalog, type Model } from '#/kosong/model/catalog'; -import { SECONDARY_DERIVED_MODEL_ID } from '#/app/kosongConfig/secondaryModelOverlay'; -import { - SECONDARY_MODEL_FLAG_ENV, - SECONDARY_MODEL_FLAG_ID, -} from '#/session/subagent/flag'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { IAgentContextInjectorService } from '#/agent/contextInjector/contextInjector'; @@ -40,7 +33,8 @@ import { SubagentToolInputSchema, type SubagentToolInput, } from '#/agent/tools/agent/agent'; -import { DEFAULT_SUBAGENT_TIMEOUT_MS } from '#/session/subagent/configSection'; +import { DEFAULT_SUBAGENT_TIMEOUT_MS, SECONDARY_MODEL_SECTION, SUBAGENT_SECTION } from '#/session/subagent/configSection'; +import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; import { Error2, ErrorCodes } from '#/errors'; import { runAgentTurn } from '#/session/subagent/runAgentTurn'; import { emitAgentRunSpawned, mirrorAgentRun } from '#/session/subagent/mirrorAgentRun'; @@ -53,6 +47,8 @@ import { type RunAgentOptions, } from '#/session/subagent/subagent'; import { IEventBus, type DomainEvent } from '#/app/event/eventBus'; +import { IConfigService } from '#/app/config/config'; +import { IFlagService } from '#/app/flag/flag'; import { normalizeAgentProfile, type AgentProfile } from '#/app/agentProfileCatalog/agentProfileCatalog'; import { ITelemetryService, noopTelemetryService } from '#/app/telemetry/telemetry'; import { ISessionCronService } from '#/session/cron/sessionCronService'; @@ -66,11 +62,13 @@ import type { import type { IProcess, ISessionProcessRunner } from '#/session/process/processRunner'; import { IWireService } from '#/wire/wire'; import { createFakeProcessRunner } from '../tools/fixtures/fake-exec'; +import { StubConfigService } from '../kosong/stubs'; +import { stubFlag } from '../app/flag/stubs'; import { + appService, configServices, createCommandRunner, createTestAgent, - appService, execEnvServices, externalHookServices, homeDirServices, @@ -82,7 +80,6 @@ import { type TestAgentServiceOverride, } from '../harness'; import { executeTool } from '../tools/fixtures/execute-tool'; -import { stubFlag } from '../app/flag/stubs'; const signal = new AbortController().signal; @@ -108,6 +105,16 @@ function agentSwarmSchemaProperties(): Record { const BACKGROUND_AGENT_NEXT_STEP = 'next_step: The completion arrives automatically in a later turn — do NOT wait, poll, or call TaskOutput on it; continue with other work or hand back to the user. (If you have nothing to do until it finishes, run such tasks in the foreground next time.)'; +/** + * Model entries backing the `[secondary_model.models]` pools used below: the harness + * creates a real session scope, so the startup pool validation resolves every + * pool alias through the real catalog unless a stub catalog is injected. + */ +const POOL_MODEL_ENTRIES = { + 'provider/fast': { provider: 'test-provider', model: 'fast-model', maxContextSize: 262_144 }, + 'provider/smart': { provider: 'test-provider', model: 'smart-model', maxContextSize: 262_144 }, +}; + function deferred(): { readonly promise: Promise; resolve(value: T): void; @@ -164,34 +171,6 @@ function noopDisposable() { return { dispose: () => {} }; } -function profileCatalogWithPreference( - profileName: string, - modelPreference: 'primary' | 'secondary', -): ISessionAgentProfileCatalog { - const main: AgentProfile = normalizeAgentProfile({ - name: 'agent', - description: 'Main agent', - systemPrompt: () => 'main', - }); - const target: AgentProfile = normalizeAgentProfile({ - name: profileName, - description: `${profileName} agent`, - modelPreference, - systemPrompt: () => profileName, - }); - return { - _serviceBrand: undefined, - ready: Promise.resolve(), - onDidChange: Event.None as ISessionAgentProfileCatalog['onDidChange'], - get: (name) => [main, target].find((profile) => profile.name === name), - getDefault: () => main, - list: () => [target], - inspect: () => undefined, - load: async () => {}, - reload: async () => {}, - }; -} - function modelCatalogResolving(...aliases: readonly string[]): IModelCatalog { return { _serviceBrand: undefined, @@ -490,11 +469,12 @@ describe('SubagentToolInputSchema', () => { expect(properties).not.toHaveProperty('timeout'); }); - it('exposes the model choice parameter in the JSON schema', () => { - const properties = agentSchemaProperties<{ description?: string; enum?: string[] }>(); + it('exposes the model parameter as a free-form string in the JSON schema', () => { + const properties = agentSchemaProperties<{ description?: string; type?: string; enum?: string[] }>(); - expect(properties['model']?.enum).toEqual(['secondary', 'primary']); - expect(properties['model']?.description).toContain('secondary model'); + expect(properties['model']?.type).toBe('string'); + expect(properties['model']?.enum).toBeUndefined(); + expect(properties['model']?.description).toContain('Available models'); }); it('normalizes the default subagent type into tool args', () => { @@ -794,81 +774,96 @@ describe('Agent tool description', () => { ); }); - it('shows the model preference for an agent type when the experiment is enabled', () => { - ctx = createTestAgent( - secondaryModelFlags(), - sessionService( - ISessionAgentProfileCatalog, - profileCatalogWithPreference('coder', 'primary'), - ), - ); - - expect(agentDescription()).toContain('- coder: coder agent\n Model preference: primary'); - }); - - it('hides model preferences when the experiment is disabled', () => { - ctx = createTestAgent( - secondaryModelFlags(false), - sessionService( - ISessionAgentProfileCatalog, - profileCatalogWithPreference('coder', 'primary'), - ), - ); - - expect(agentDescription()).not.toContain('Model preference:'); - }); - - it('omits the models section when no secondary model is configured', () => { + it('omits the models section when no [secondary_model.models] pool is configured', () => { ctx = createTestAgent(); expect(agentDescription()).not.toContain('Available models'); }); - it('lists both selectable models when the secondary-model env flag is enabled', () => { - vi.stubEnv(MASTER_ENV, '0'); - vi.stubEnv(SECONDARY_MODEL_FLAG_ENV, '1'); - ctx = createTestAgent({ - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + it('renders the pool in config order with the default first and a generic primary line', () => { + ctx = createTestAgent(secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { + 'provider/fast': 'fast and cheap', + 'provider/smart': 'hard tasks', + }, + }, + models: POOL_MODEL_ENTRIES, + }, }); const description = agentDescription(); expect(description).toContain('Available models (pass via model):'); - expect(description).toContain('- secondary: provider/secondary (default)'); - expect(description).toContain('- primary: mock-model'); + // The caller's own model is not in the pool: generic primary hint last. + const defaultIndex = description.indexOf('- provider/fast [default]: fast and cheap'); + const smartIndex = description.indexOf('- provider/smart: hard tasks'); + const primaryIndex = description.indexOf( + '- primary: the main model you are running on, bound with your current thinking level; use it for hard, quality-sensitive subagent tasks', + ); + expect(defaultIndex).toBeGreaterThanOrEqual(0); + expect(smartIndex).toBeGreaterThan(defaultIndex); + expect(primaryIndex).toBeGreaterThan(smartIndex); }); - it('advertises the resolved capability flags for each selectable model', () => { + it('lists the caller-in-pool alias with a [main model] marker and renders empty descriptions bare', () => { ctx = createTestAgent(secondaryModelFlags(), { initialConfig: { - secondaryModel: { model: 'secondary-model' }, - models: { - 'secondary-model': { - provider: 'test-provider', - model: 'secondary-model', - maxContextSize: 262_144, - capabilities: ['image_in', 'thinking'], + secondaryModel: { + defaultModel: 'provider/fast', + models: { + 'provider/fast': 'fast and cheap', + 'mock-model': 'the main model, great at hard things', + 'provider/smart': '', }, }, + models: POOL_MODEL_ENTRIES, }, }); const description = agentDescription(); + expect(description).toContain('- provider/fast [default]: fast and cheap'); + // The caller's own alias is a normal pool entry: a pool binding carries no + // thinking, while the `primary` line below binds the same model WITH the + // caller's thinking level — both choices stay visible. + expect(description).toContain('- mock-model [main model]: the main model, great at hard things'); + // An empty-string description renders a bare alias line. + expect(description).toContain('- provider/smart\n'); expect(description).toContain( - '- secondary: secondary-model (default) — the configured secondary model; prefer it for routine subagent tasks; capabilities: image_in, thinking', - ); - expect(description).toContain( - '- primary: mock-model — the main model you are running on; use it for hard, quality-sensitive subagent tasks; capabilities: none', + '- primary (mock-model): the main model you are running on, bound with your current thinking level; use it for hard, quality-sensitive subagent tasks', ); }); - it('omits the models section when configured but the experiment is disabled', () => { - ctx = createTestAgent(secondaryModelFlags(false), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + it('marks the caller-as-default alias with both [default] and [main model]', () => { + ctx = createTestAgent(secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'mock-model', + models: { + 'mock-model': 'the main model, great at hard things', + 'provider/fast': 'fast and cheap', + }, + }, + models: POOL_MODEL_ENTRIES, + }, }); - expect(agentDescription()).not.toContain('Available models'); + const description = agentDescription(); + + // The caller IS the default: the marker pair sits on its pool line, which + // still leads the list. + const defaultIndex = description.indexOf( + '- mock-model [default] [main model]: the main model, great at hard things', + ); + const fastIndex = description.indexOf('- provider/fast: fast and cheap'); + expect(defaultIndex).toBeGreaterThanOrEqual(0); + expect(fastIndex).toBeGreaterThan(defaultIndex); + expect(description).toContain( + '- primary (mock-model): the main model you are running on, bound with your current thinking level', + ); }); function agentParameters(): Record { @@ -877,10 +872,8 @@ describe('Agent tool description', () => { return tool!.parameters!; } - it('strips the model parameter from the advertised schema when the experiment is disabled', () => { - ctx = createTestAgent(secondaryModelFlags(false), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, - }); + it('strips the model parameter from the advertised schema when no pool is configured', () => { + ctx = createTestAgent(); const properties = agentParameters()['properties'] as Record; @@ -888,14 +881,71 @@ describe('Agent tool description', () => { expect(properties).toHaveProperty('prompt'); }); - it('advertises the model parameter when the experiment is enabled', () => { + it('advertises the model parameter when a pool is configured', () => { + ctx = createTestAgent(secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + models: POOL_MODEL_ENTRIES, + }, + }); + + const properties = agentParameters()['properties'] as Record< + string, + { type?: string; enum?: unknown } + >; + + expect(properties['model']?.type).toBe('string'); + expect(properties['model']?.enum).toBeUndefined(); + }); + + it('strips the model parameter and pool description while the experiment is off', () => { + ctx = createTestAgent(secondaryModelFlags(false), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + models: POOL_MODEL_ENTRIES, + }, + }); + + const properties = agentParameters()['properties'] as Record; + expect(properties).not.toHaveProperty('model'); + expect(agentDescription()).not.toContain('Available models'); + }); + + it('treats a pool-less default_model as an implicit single-entry pool', () => { ctx = createTestAgent(secondaryModelFlags(), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + initialConfig: { + secondaryModel: { defaultModel: 'provider/fast' }, + models: POOL_MODEL_ENTRIES, + }, }); - const properties = agentParameters()['properties'] as Record; + const properties = agentParameters()['properties'] as Record; + expect(properties).toHaveProperty('model'); + + const description = agentDescription(); + expect(description).toContain('- provider/fast [default]\n'); + expect(description).toContain( + '- primary: the main model you are running on, bound with your current thinking level; use it for hard, quality-sensitive subagent tasks', + ); + }); + + it('hides the model parameter and the pool description when force is set', () => { + ctx = createTestAgent(secondaryModelFlags(), { + initialConfig: { + secondaryModel: { defaultModel: 'provider/fast', force: true }, + models: POOL_MODEL_ENTRIES, + }, + }); - expect(properties['model']?.enum).toEqual(['secondary', 'primary']); + const properties = agentParameters()['properties'] as Record; + expect(properties).not.toHaveProperty('model'); + expect(agentDescription()).not.toContain('Available models'); }); }); @@ -917,7 +967,7 @@ describe('Agent tool execution contract', () => { sessionService(ISessionSubagentService, lifecycle), sessionService(ISessionCronService, cronStub), modelProviderServices( - modelCatalogResolving('mock-model', 'provider/secondary', SECONDARY_DERIVED_MODEL_ID), + modelCatalogResolving('mock-model', 'provider/fast', 'provider/smart'), ), ...extra, ); @@ -1101,121 +1151,162 @@ describe('Agent tool execution contract', () => { expect(result.output).toContain('child result'); }); - it('spawns the subagent on the configured secondary model by default', async () => { + it('spawns the subagent on the pool default model when the tool call omits model', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext( - lifecycle, - secondaryModelFlags(), - { - initialConfig: { - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, }, }, - ); + }); await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', }); + // Pool bindings carry no explicit thinking: the subagent resolves thinking + // naturally instead of inheriting the caller's level. expect(lifecycle.create).toHaveBeenCalledWith( expect.objectContaining({ binding: expect.objectContaining({ - model: SECONDARY_DERIVED_MODEL_ID, - thinking: 'low', + model: 'provider/fast', + thinking: undefined, }), }), ); + expect(lifecycle.publishedEvents).toContainEqual( + expect.objectContaining({ + type: 'subagent.spawned', + subagentId: 'agent-child', + model: 'provider/fast', + }), + ); }); - it('reports the display-normalized model on the spawned signal', async () => { + it('spawns on the caller model when the tool call opts into "primary"', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext( - lifecycle, - secondaryModelFlags(), - { - initialConfig: { - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, }, }, - ); + }); await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', + model: 'primary', }); - expect(lifecycle.publishedEvents).toContainEqual( + expect(lifecycle.create).toHaveBeenCalledWith( expect.objectContaining({ - type: 'subagent.spawned', - subagentId: 'agent-child', - model: 'provider/secondary', + binding: expect.objectContaining({ + model: 'mock-model', + thinking: 'off', + }), }), ); }); - it('binds the pointed entry directly with natural thinking when the recipe has no patch', async () => { - const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); + it('binds the caller-in-pool alias without thinking, unlike "primary"', async () => { + const lifecycle = createAgentLifecycleStub({ + createAgentIds: ['agent-child', 'agent-child-2'], + }); const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'mock-model': 'the main model' }, + }, + }, }); + // Same model, two bindings: the pool alias resolves thinking naturally, + // "primary" inherits the caller's level. await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', + model: 'mock-model', + }); + await executeAgentTool(context, { + prompt: 'Investigate', + description: 'Find cause', + model: 'primary', }); - expect(lifecycle.create).toHaveBeenCalledWith( + expect(lifecycle.create).toHaveBeenNthCalledWith( + 1, expect.objectContaining({ - binding: expect.objectContaining({ - model: 'provider/secondary', - thinking: undefined, - }), + binding: expect.objectContaining({ model: 'mock-model', thinking: undefined }), + }), + ); + expect(lifecycle.create).toHaveBeenNthCalledWith( + 2, + expect.objectContaining({ + binding: expect.objectContaining({ model: 'mock-model', thinking: 'off' }), }), ); }); - it('spawns on the caller model when the tool call opts into "primary"', async () => { + it('spawns on the pool alias chosen via the model parameter', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext( - lifecycle, - secondaryModelFlags(), - { - initialConfig: { - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, }, }, - ); + }); await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', - model: 'primary', + model: 'provider/smart', }); expect(lifecycle.create).toHaveBeenCalledWith( expect.objectContaining({ binding: expect.objectContaining({ - model: 'mock-model', - thinking: 'off', + model: 'provider/smart', + thinking: undefined, }), }), ); }); - it('uses the target profile model preference when the tool call omits model', async () => { + it('rejects a model choice outside the pool, listing the available models', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext( - lifecycle, - sessionService( - ISessionAgentProfileCatalog, - profileCatalogWithPreference('coder', 'primary'), - ), - secondaryModelFlags(), - { - initialConfig: { secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' } }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, + }, }, + }); + + const result = await executeAgentTool(context, { + prompt: 'Investigate', + description: 'Find cause', + model: 'provider/typo', + }); + + expect(result.isError).toBe(true); + expect(result.output).toContain( + 'Invalid model "provider/typo". Available models: provider/fast, provider/smart, primary.', ); + expect(lifecycle.create).not.toHaveBeenCalled(); + }); + + it('inherits the caller model when no pool is configured', async () => { + const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); + const context = createAgentToolContext(lifecycle); await executeAgentTool(context, { prompt: 'Investigate', @@ -1232,61 +1323,82 @@ describe('Agent tool execution contract', () => { ); }); - it('lets an explicit model override the target profile preference', async () => { + it('binds the forced default_model and rejects any explicit choice, "primary" included', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext( - lifecycle, - sessionService( - ISessionAgentProfileCatalog, - profileCatalogWithPreference('coder', 'primary'), - ), - secondaryModelFlags(), - { - initialConfig: { secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' } }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { defaultModel: 'provider/fast', force: true }, }, - ); + }); - await executeAgentTool(context, { + // The model parameter is not advertised under force; a stray choice is + // rejected instead of binding anything. + const rejected = await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', - model: 'secondary', + model: 'primary', }); + expect(rejected.isError).toBe(true); + expect(rejected.output).toContain('[secondary_model].force is set'); + expect(lifecycle.create).not.toHaveBeenCalled(); + await executeAgentTool(context, { + prompt: 'Investigate', + description: 'Find cause', + }); expect(lifecycle.create).toHaveBeenCalledWith( expect.objectContaining({ - binding: expect.objectContaining({ - model: SECONDARY_DERIVED_MODEL_ID, - thinking: 'low', - }), + binding: expect.objectContaining({ model: 'provider/fast', thinking: undefined }), }), ); }); - it('inherits the caller model when no secondary model is configured', async () => { + it('rejects a pool that gained the reserved "primary" key through a runtime config edit', async () => { const lifecycle = createAgentLifecycleStub({ createAgentIds: ['agent-child'] }); - const context = createAgentToolContext(lifecycle); + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }, + }); + // The startup validation already passed; now the pool breaks at runtime. + await (context.get(IConfigService) as StubConfigService).replace(SECONDARY_MODEL_SECTION, { + defaultModel: 'primary', + models: { primary: 'reserved word' }, + }); - await executeAgentTool(context, { + const result = await executeAgentTool(context, { prompt: 'Investigate', description: 'Find cause', - model: 'secondary', }); - expect(lifecycle.create).toHaveBeenCalledWith( - expect.objectContaining({ - binding: expect.objectContaining({ - model: 'mock-model', - thinking: 'off', - }), - }), - ); + expect(result.isError).toBe(true); + expect(result.output).toContain('[secondary_model.models] key "primary" is reserved'); + expect(lifecycle.create).not.toHaveBeenCalled(); }); - it('points at the secondary model config when the configured alias is invalid', async () => { - const lifecycle = createAgentLifecycleStub(); - const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { - initialConfig: { secondaryModel: { model: 'provider/bad' } }, + it('points at the [secondary_model.models] config when the bound alias stops resolving', async () => { + // The pool validates at session creation, but a later config edit (or a + // catalog refresh) can still leave the bound alias dangling at spawn time. + const lifecycle = createAgentLifecycleStub({ + createError: new Error2( + ErrorCodes.CONFIG_INVALID, + 'Model "provider/bad" is not configured in config.toml.', + { details: { model: 'provider/bad' } }, + ), }); + const context = createAgentToolContext( + lifecycle, + modelProviderServices(modelCatalogResolving('mock-model', 'provider/bad')), + secondaryModelFlags(), + { + initialConfig: { + secondaryModel: { defaultModel: 'provider/bad', models: { 'provider/bad': 'broken' } }, + }, + }, + ); const result = await executeAgentTool(context, { prompt: 'Investigate', @@ -1295,16 +1407,17 @@ describe('Agent tool execution contract', () => { expect(result.isError).toBe(true); expect(result.output).toContain('Model "provider/bad" is not configured in config.toml.'); - expect(result.output).toContain('comes from [secondary_model].model / KIMI_SECONDARY_MODEL'); - expect(lifecycle.create).not.toHaveBeenCalled(); + expect(result.output).toContain('comes from [secondary_model.models]'); }); it('does not rewrite spawn failures unrelated to the model config', async () => { const lifecycle = createAgentLifecycleStub({ createError: new Error('MCP server failed to start'), }); - const context = createAgentToolContext(lifecycle, { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + const context = createAgentToolContext(lifecycle, secondaryModelFlags(), { + initialConfig: { + secondaryModel: { defaultModel: 'provider/fast', models: { 'provider/fast': 'fast and cheap' } }, + }, }); const result = await executeAgentTool(context, { @@ -1315,7 +1428,7 @@ describe('Agent tool execution contract', () => { expect(result.isError).toBe(true); expect(result.output).toContain('MCP server failed to start'); - expect(result.output).not.toContain('KIMI_SECONDARY_MODEL'); + expect(result.output).not.toContain('[secondary_model.models]'); }); it('mirrors v1-compatible subagent lifecycle event fields', async () => { @@ -2164,7 +2277,7 @@ describe('AgentSwarmToolInputSchema', () => { expect(properties['subagent_type']?.description).toContain('defaults to coder'); expect(properties['resume_agent_ids']?.description).toContain('Map of existing subagent'); - expect(properties['model']?.description).toContain('secondary model'); + expect(properties['model']?.description).toContain('Available models'); expect(properties).not.toHaveProperty('run_in_background'); expect(properties).not.toHaveProperty('timeout'); }); @@ -2202,22 +2315,31 @@ describe('AgentSwarm tool description', () => { ); }); - it('omits the models section when no secondary model is configured', () => { + it('omits the models section when no [secondary_model.models] pool is configured', () => { ctx = createTestAgent(); expect(agentSwarmDescription()).not.toContain('Available models'); }); - it('lists both selectable models when a secondary model is configured', () => { + it('renders the configured pool with the default marker and a generic primary line', () => { ctx = createTestAgent(secondaryModelFlags(), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, + }, + models: POOL_MODEL_ENTRIES, + }, }); const description = agentSwarmDescription(); expect(description).toContain('Available models (pass via model):'); - expect(description).toContain('- secondary: provider/secondary (default)'); - expect(description).toContain('- primary: mock-model'); + expect(description).toContain('- provider/fast [default]: fast and cheap'); + expect(description).toContain('- provider/smart: hard tasks'); + expect(description).toContain( + '- primary: the main model you are running on, bound with your current thinking level; use it for hard, quality-sensitive subagent tasks', + ); }); function agentSwarmParameters(): Record { @@ -2226,10 +2348,8 @@ describe('AgentSwarm tool description', () => { return tool!.parameters!; } - it('strips the model parameter from the advertised schema when the experiment is disabled', () => { - ctx = createTestAgent(secondaryModelFlags(false), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, - }); + it('strips the model parameter from the advertised schema when no pool is configured', () => { + ctx = createTestAgent(); const properties = agentSwarmParameters()['properties'] as Record; @@ -2237,14 +2357,24 @@ describe('AgentSwarm tool description', () => { expect(properties).toHaveProperty('prompt_template'); }); - it('advertises the model parameter when the experiment is enabled', () => { + it('advertises the model parameter when a pool is configured', () => { ctx = createTestAgent(secondaryModelFlags(), { - initialConfig: { secondaryModel: { model: 'provider/secondary' } }, + initialConfig: { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + models: POOL_MODEL_ENTRIES, + }, }); - const properties = agentSwarmParameters()['properties'] as Record; + const properties = agentSwarmParameters()['properties'] as Record< + string, + { type?: string; enum?: unknown } + >; - expect(properties['model']?.enum).toEqual(['secondary', 'primary']); + expect(properties['model']?.type).toBe('string'); + expect(properties['model']?.enum).toBeUndefined(); }); }); @@ -2331,7 +2461,7 @@ describe('AgentSwarm tool execution contract', () => { expect(result.isError).toBeUndefined(); }); - it('threads the configured secondary model into spawn task bindings', async () => { + it('threads the pool default model into spawn task bindings', async () => { const runSwarm = vi.fn( async ( args: SessionSwarmRunArgs, @@ -2355,7 +2485,11 @@ describe('AgentSwarm tool execution contract', () => { secondaryModelFlags(), { initialConfig: { - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap', 'provider/smart': 'hard tasks' }, + }, + models: POOL_MODEL_ENTRIES, }, }, ); @@ -2377,67 +2511,17 @@ describe('AgentSwarm tool execution contract', () => { tasks: [ expect.objectContaining({ kind: 'spawn', - binding: { model: SECONDARY_DERIVED_MODEL_ID, thinking: 'low' }, + binding: { model: 'provider/fast', thinking: undefined }, }), expect.objectContaining({ kind: 'spawn', - binding: { model: SECONDARY_DERIVED_MODEL_ID, thinking: 'low' }, + binding: { model: 'provider/fast', thinking: undefined }, }), ], }), ); }); - it('uses the target profile model preference for item-based spawns', async () => { - const runSwarm = vi.fn( - async (args: SessionSwarmRunArgs): Promise => - args.tasks.map((task, index) => ({ - task, - agentId: `agent-explore-${String(index + 1)}`, - status: 'completed' as const, - result: 'ok', - })), - ); - const swarmService: ISessionSwarmService = { - _serviceBrand: undefined, - getSwarmItem: async () => undefined, - run: runSwarm as ISessionSwarmService['run'], - cancel: () => {}, - }; - ctx = createTestAgent( - swarmServices(swarmService), - sessionService( - ISessionAgentProfileCatalog, - profileCatalogWithPreference('explore', 'primary'), - ), - secondaryModelFlags(), - { - initialConfig: { secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' } }, - }, - ); - - await executeTool(agentSwarmTool(ctx), { - turnId: 0, - toolCallId: 'call_swarm', - args: { - description: 'Review files', - prompt_template: 'Review {{item}}', - items: ['src/a.ts', 'src/b.ts'], - subagent_type: 'explore', - }, - signal, - }); - - expect(runSwarm).toHaveBeenCalledWith( - expect.objectContaining({ - tasks: [ - expect.objectContaining({ binding: { model: 'mock-model', thinking: 'off' } }), - expect.objectContaining({ binding: { model: 'mock-model', thinking: 'off' } }), - ], - }), - ); - }); - it('threads the caller model into spawn task bindings when the tool call opts into "primary"', async () => { const runSwarm = vi.fn( async ( @@ -2462,7 +2546,11 @@ describe('AgentSwarm tool execution contract', () => { secondaryModelFlags(), { initialConfig: { - secondaryModel: { model: 'provider/secondary', defaultEffort: 'low' }, + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + models: POOL_MODEL_ENTRIES, }, }, ); diff --git a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts index d8810934acf..b0da2dce2fd 100644 --- a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts +++ b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts @@ -18,6 +18,7 @@ import { ILogService } from '#/_base/log/log'; import type { Hooks } from '#/hooks'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IConfigService } from '#/app/config/config'; +import { IFlagService } from '#/app/flag/flag'; import { IHostEnvironment } from '#/os/interface/hostEnvironment'; import { IHostFileSystem } from '#/os/interface/hostFileSystem'; import { HostFileSystem } from '#/os/backends/node-local/hostFsService'; @@ -41,7 +42,12 @@ import { IWorkspaceInstructionsService } from '#/workspace/workspaceInstructions import { IWorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcp'; import { IAgentPlanService } from '#/features/plan/plan'; import { ISessionCronService } from '#/session/cron/sessionCronService'; -import { ISessionSecondaryModelWarningService } from '#/session/subagent/secondaryModelWarning'; +import { ISessionSubagentModelsValidationService } from '#/session/subagent/subagentModelsValidation'; +import { SECONDARY_MODEL_FLAG_ID } from '#/session/subagent/flag'; +import { IModelCatalog } from '#/kosong/model/catalog'; +import { IModelService } from '#/kosong/model/model'; +import { IProviderService } from '#/kosong/provider/provider'; +import { stubProviderService } from '../../app/provider/stubs'; import { ICronTaskPersistence } from '#/app/cron/cronTaskPersistence'; import { CRON_SESSION_TAG, type CronTask } from '#/app/cron/cronTask'; import { IWorkspaceLifecycleService } from '#/app/workspaceLifecycle/workspaceLifecycle'; @@ -81,6 +87,7 @@ import { ISessionMcpHandle } from '#/session/mcp/sessionMcpHandle'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import { Error2, ErrorCodes } from '#/errors'; import { recordingTelemetry, type TelemetryRecord } from '../../app/telemetry/stubs'; +import { stubFlag } from '../../app/flag/stubs'; import { stubLog } from '../../_base/log/stubs'; function bootstrapStub(): IBootstrapService { @@ -428,6 +435,33 @@ function configStub(values: Record = {}): IConfigService { } as unknown as IConfigService; } +function modelCatalogStub(knownIds: readonly string[] = []): IModelCatalog { + return { + _serviceBrand: undefined, + get: (id: string) => { + if (!knownIds.includes(id)) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Model "${id}" is not configured in config.toml.`, + { details: { model: id } }, + ); + } + return { id }; + }, + } as unknown as IModelCatalog; +} + +function modelServiceStub(ready: Promise = Promise.resolve()): IModelService { + return { + _serviceBrand: undefined, + ready, + } as unknown as IModelService; +} + +function secondaryModelFlagStub(enabled: boolean): IFlagService { + return stubFlag((id) => enabled && id === SECONDARY_MODEL_FLAG_ID); +} + function agentLifecycleCapturingPlanSpy(opts: { mainPreexists?: boolean } = {}): { lifecycle: IAgentLifecycleService; enter: ReturnType; @@ -599,11 +633,14 @@ describe('SessionLifecycleService', () => { stubPair(IAgentLifecycleService, agentLifecycleStub()), stubPair(IWorkspaceMcpService, workspaceMcpServiceStub()), stubPair(IConfigService, configStub()), + stubPair(IModelCatalog, modelCatalogStub()), + stubPair(IModelService, modelServiceStub()), + stubPair(IProviderService, stubProviderService()), + stubPair(IFlagService, secondaryModelFlagStub(false)), stubPair(ISessionCronService, { _serviceBrand: undefined } as unknown as ISessionCronService), - stubPair(ISessionSecondaryModelWarningService, { + stubPair(ISessionSubagentModelsValidationService, { _serviceBrand: undefined, - getSecondaryModelWarning: () => undefined, - } as ISessionSecondaryModelWarningService), + } as ISessionSubagentModelsValidationService), stubPair(IProjectLocalConfigService, projectLocalConfigStub()), stubPair(IHostFsWatchService, { _serviceBrand: undefined, @@ -667,6 +704,157 @@ describe('SessionLifecycleService', () => { expect(svc.get('s2')).toBeDefined(); }); + it('rejects create with CONFIG_INVALID for a broken subagent model pool before registering anything', async () => { + const svc = await build([ + stubPair( + IConfigService, + configStub({ secondaryModel: { models: { 'provider/fast': 'fast and cheap' } } }), + ), + stubPair(IModelCatalog, modelCatalogStub(['provider/fast'])), + stubPair(IFlagService, secondaryModelFlagStub(true)), + ]); + + await expect(svc.create({ sessionId: 's-broken', workDir: '/tmp/proj' })).rejects.toMatchObject( + { + code: ErrorCodes.CONFIG_INVALID, + message: expect.stringContaining('[secondary_model].default_model is required'), + }, + ); + expect(svc.get('s-broken')).toBeUndefined(); + }); + + it('creates a session when the subagent model pool is valid', async () => { + const svc = await build([ + stubPair( + IConfigService, + configStub({ + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }), + ), + stubPair(IModelCatalog, modelCatalogStub(['provider/fast'])), + stubPair(IFlagService, secondaryModelFlagStub(true)), + ]); + + const h = await svc.create({ sessionId: 's-pool', workDir: '/tmp/proj' }); + expect(svc.get('s-pool')).toBe(h); + }); + + it('waits for the model/provider registries before validating the subagent model pool', async () => { + let releaseRegistries!: () => void; + const registriesReady = new Promise((resolve) => { + releaseRegistries = resolve; + }); + let registriesReleased = false; + const coldRegistryCatalog = { + _serviceBrand: undefined, + get: (id: string) => { + if (!registriesReleased) { + throw new Error2( + ErrorCodes.CONFIG_INVALID, + `Model "${id}" is not configured in config.toml.`, + { details: { model: id } }, + ); + } + return { id }; + }, + } as unknown as IModelCatalog; + const svc = await build([ + stubPair( + IConfigService, + configStub({ + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }), + ), + stubPair(IModelCatalog, coldRegistryCatalog), + stubPair(IModelService, modelServiceStub(registriesReady)), + stubPair(IProviderService, stubProviderService({}, registriesReady)), + stubPair(IFlagService, secondaryModelFlagStub(true)), + ]); + + // A cold bootstrap can reach create before the kosong registries finish + // hydrating: the pre-flight must hold, not fail the valid pool against an + // empty registry. + let settled = false; + const pending = svc.create({ sessionId: 's-race', workDir: '/tmp/proj' }).then((created) => { + settled = true; + return created; + }); + await tick(); + expect(settled).toBe(false); + + registriesReleased = true; + releaseRegistries(); + const h = await pending; + expect(svc.get('s-race')).toBe(h); + }); + + it('rejects create with CONFIG_INVALID when force is set without default_model', async () => { + const svc = await build([ + stubPair(IConfigService, configStub({ secondaryModel: { force: true } })), + stubPair(IModelCatalog, modelCatalogStub(['provider/fast'])), + stubPair(IFlagService, secondaryModelFlagStub(true)), + ]); + + await expect(svc.create({ sessionId: 's-force', workDir: '/tmp/proj' })).rejects.toMatchObject( + { + code: ErrorCodes.CONFIG_INVALID, + message: expect.stringContaining('[secondary_model].default_model is required'), + }, + ); + expect(svc.get('s-force')).toBeUndefined(); + }); + + it('creates a session with a broken pool while the secondary-model experiment is off', async () => { + const svc = await build([ + stubPair( + IConfigService, + configStub({ secondaryModel: { models: { 'provider/fast': 'fast and cheap' } } }), + ), + stubPair(IModelCatalog, modelCatalogStub(['provider/fast'])), + ]); + + const h = await svc.create({ sessionId: 's-inert', workDir: '/tmp/proj' }); + expect(svc.get('s-inert')).toBe(h); + }); + + it('rejects fork with CONFIG_INVALID for a broken pool before copying any files', async () => { + const root = await makeTmpRoot(); + const sections: Record = { + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }; + const svc = await build([ + stubPair(IBootstrapService, tmpBootstrapStub(root)), + stubPair(IConfigService, { + get: (domain: string) => sections[domain], + getAll: () => ({ ...sections }), + onDidChangeConfiguration: () => ({ dispose: () => {} }), + onDidSectionChange: () => ({ dispose: () => {} }), + } as unknown as IConfigService), + stubPair(IModelCatalog, modelCatalogStub(['provider/fast'])), + stubPair(IFlagService, secondaryModelFlagStub(true)), + ]); + await svc.create({ sessionId: 'src', workDir: '/tmp/proj' }); + const srcDir = join(root, 'sessions', 'wd_stub', 'src'); + await mkdir(srcDir, { recursive: true }); + await writeFile(join(srcDir, 'marker'), 'src'); + sections['secondaryModel'] = { models: { 'provider/fast': 'fast and cheap' } }; + + await expect(svc.fork({ sourceSessionId: 'src', newSessionId: 'dst' })).rejects.toMatchObject({ + code: ErrorCodes.CONFIG_INVALID, + }); + expect(svc.get('dst')).toBeUndefined(); + await expect(stat(join(root, 'sessions', 'wd_stub', 'dst'))).rejects.toThrow(); + }); + it('create appends the session to the shared session_index.jsonl', async () => { const appended: unknown[] = []; const svc = await build([ diff --git a/packages/agent-core-v2/test/workspace/workspaceAgentProfileLoader/agentFile.test.ts b/packages/agent-core-v2/test/workspace/workspaceAgentProfileLoader/agentFile.test.ts index bafe8563120..b2d5457db2e 100644 --- a/packages/agent-core-v2/test/workspace/workspaceAgentProfileLoader/agentFile.test.ts +++ b/packages/agent-core-v2/test/workspace/workspaceAgentProfileLoader/agentFile.test.ts @@ -58,7 +58,6 @@ describe('parseAgentFileText', () => { const def = parse('---\nname: solo\ndescription: d\n---\n\nbody\n'); expect(def.override).toBe(false); - expect(def.modelPreference).toBeUndefined(); expect(def.tools).toBeUndefined(); expect(def.disallowedTools).toBeUndefined(); expect(def.subagents).toBeUndefined(); @@ -66,22 +65,6 @@ describe('parseAgentFileText', () => { expect(def.prompt).toBe('body'); }); - it('parses a symbolic model preference', () => { - const def = parse( - '---\nname: solo\ndescription: d\nmodel_preference: primary\n---\n\nbody\n', - ); - - expect(def.modelPreference).toBe('primary'); - }); - - it('rejects an unsupported model preference', () => { - expect(() => - parse( - '---\nname: solo\ndescription: d\nmodel_preference: provider/model\n---\n\nbody\n', - ), - ).toThrow(/"model_preference"/); - }); - it('rejects missing frontmatter', () => { expect(() => parse('no frontmatter here')).toThrow(AgentFileParseError); }); @@ -327,12 +310,6 @@ describe('agentProfileFromFile', () => { expect(profile.subagents).toEqual(['explore']); }); - it('passes the model preference through', () => { - const profile = agentProfileFromFile({ ...base, modelPreference: 'secondary' }, basePrompt); - - expect(profile.modelPreference).toBe('secondary'); - }); - it('treats an explicit file as an override intent', () => { const profile = agentProfileFromFile({ ...base, source: 'explicit' }, basePrompt); diff --git a/packages/agent-core-v2/test/workspace/workspaceDirs/workspaceDirs.test.ts b/packages/agent-core-v2/test/workspace/workspaceDirs/workspaceDirs.test.ts index e818bf63fb8..326ad9caf15 100644 --- a/packages/agent-core-v2/test/workspace/workspaceDirs/workspaceDirs.test.ts +++ b/packages/agent-core-v2/test/workspace/workspaceDirs/workspaceDirs.test.ts @@ -35,6 +35,11 @@ import { Event } from '#/_base/event'; import { ILogService } from '#/_base/log/log'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IConfigService } from '#/app/config/config'; +import { IModelCatalog } from '#/kosong/model/catalog'; +import { IModelService } from '#/kosong/model/model'; +import { IProviderService } from '#/kosong/provider/provider'; +import { stubProviderService } from '../../app/provider/stubs'; +import { IFlagService } from '#/app/flag/flag'; import { ICronTaskPersistence } from '#/app/cron/cronTaskPersistence'; import { IEventService } from '#/app/event/event'; import { @@ -86,6 +91,7 @@ import { IWorkspaceMcpService } from '#/workspace/workspaceMcp/workspaceMcp'; import { IWorkspaceSkillCatalog } from '#/workspace/workspaceSkillCatalog/workspaceSkillCatalog'; import { stubLog } from '../../_base/log/stubs'; +import { stubFlag } from '../../app/flag/stubs'; function workspaceCatalogStub(): IWorkspaceService { const workspaces = new Map(); @@ -296,6 +302,13 @@ describe('workspace add-dir (handler chain)', () => { get: () => undefined, onDidSectionChange: () => ({ dispose: () => {} }), } as unknown as IConfigService), + stubPair(IModelCatalog, { _serviceBrand: undefined } as unknown as IModelCatalog), + stubPair(IModelService, { + _serviceBrand: undefined, + ready: Promise.resolve(), + } as unknown as IModelService), + stubPair(IProviderService, stubProviderService()), + stubPair(IFlagService, stubFlag(() => false)), stubPair(ITelemetryService, noopTelemetryService), stubPair(IWorkspaceService, workspaceCatalogStub()), stubPair(ISessionIndex, { diff --git a/packages/agent-core-v2/test/workspace/workspaceResources.test.ts b/packages/agent-core-v2/test/workspace/workspaceResources.test.ts index ede234fc434..882cf2951b5 100644 --- a/packages/agent-core-v2/test/workspace/workspaceResources.test.ts +++ b/packages/agent-core-v2/test/workspace/workspaceResources.test.ts @@ -37,6 +37,11 @@ import { IPluginAgentProfileLoader } from '#/workspace/workspaceAgentProfileLoad import { PluginAgentProfileLoaderService } from '#/workspace/workspaceAgentProfileLoader/pluginAgentProfileLoaderService'; import { IBootstrapService, resolveHostArgs } from '#/app/bootstrap/bootstrap'; import { IConfigService } from '#/app/config/config'; +import { IModelCatalog } from '#/kosong/model/catalog'; +import { IModelService } from '#/kosong/model/model'; +import { IProviderService } from '#/kosong/provider/provider'; +import { stubProviderService } from '../app/provider/stubs'; +import { IFlagService } from '#/app/flag/flag'; import { ICronTaskPersistence } from '#/app/cron/cronTaskPersistence'; import { IEventService } from '#/app/event/event'; import { IPluginService } from '#/app/plugin/plugin'; @@ -103,6 +108,7 @@ import { IPluginSkillSource, PluginSkillSource } from '#/workspace/workspaceSkil import { IWorkspaceRootSkillSource, WorkspaceRootSkillSource } from '#/workspace/workspaceSkillCatalog/rootFileSkillSource'; import { stubLog } from '../_base/log/stubs'; +import { stubFlag } from '../app/flag/stubs'; import { stubSkill } from '../app/skillCatalog/stubs'; import { stdioFixture } from '../mcpCore/stubs'; @@ -296,6 +302,13 @@ describe('workspace resource sharing (handler chain)', () => { get: () => undefined, onDidSectionChange: () => ({ dispose: () => {} }), } as unknown as IConfigService), + stubPair(IModelCatalog, { _serviceBrand: undefined } as unknown as IModelCatalog), + stubPair(IModelService, { + _serviceBrand: undefined, + ready: Promise.resolve(), + } as unknown as IModelService), + stubPair(IProviderService, stubProviderService()), + stubPair(IFlagService, stubFlag(() => false)), stubPair(ITelemetryService, noopTelemetryService), stubPair(ISkillDiscovery, discovery), stubPair(IPluginService, pluginStub()), diff --git a/packages/agent-core/src/agent/index.ts b/packages/agent-core/src/agent/index.ts index 92033add575..c54bd0896b1 100644 --- a/packages/agent-core/src/agent/index.ts +++ b/packages/agent-core/src/agent/index.ts @@ -123,7 +123,7 @@ export class Agent { /** * The session config snapshot this agent reads (loop control, subagent * binding descriptions, ...). Mutable via {@link updateKimiConfig} so the - * session can push live config updates (e.g. a `/secondary_model` switch) + * session can push live config updates (e.g. a `/secondary-model` switch) * to already-instantiated agents. */ kimiConfig?: KimiConfig; diff --git a/packages/agent-core/src/config/schema.ts b/packages/agent-core/src/config/schema.ts index 0e4b7bcaa70..62770fde978 100644 --- a/packages/agent-core/src/config/schema.ts +++ b/packages/agent-core/src/config/schema.ts @@ -99,9 +99,17 @@ export type ModelAlias = z.infer; * materialized into a synthesized derived model entry at runtime (see * `config/secondary-model.ts`). `default_effort` doubles as the subagent * thinking effort. + * + * The section is shared with the v2 engine's subagent model pool, whose keys + * (`default_model`, `[secondary_model.models]`, `force`) are declared here so + * the config write path round-trips them; the default engine never consumes + * them, and `secondaryModelPatch` excludes them from the recipe patch. */ export const SecondaryModelConfigSchema = ModelAliasOverrideSchema.extend({ model: z.string().min(1).optional(), + defaultModel: z.string().min(1).optional(), + models: z.record(z.string(), z.string()).optional(), + force: z.boolean().optional(), }); export type SecondaryModelConfig = z.infer; diff --git a/packages/agent-core/src/config/secondary-model.ts b/packages/agent-core/src/config/secondary-model.ts index 507e36b71cd..e353fbcd0d9 100644 --- a/packages/agent-core/src/config/secondary-model.ts +++ b/packages/agent-core/src/config/secondary-model.ts @@ -37,15 +37,23 @@ function trimmed(value: string | undefined): string | undefined { } /** - * The patch half of the recipe: every field except `model`. Returns - * `undefined` when no patch field is set — the signal that subagents bind the - * pointed entry directly and no derived entry is synthesized. + * The patch half of the recipe: every field except `model` and the v2 pool + * keys (`defaultModel` / `models` / `force`, which live in the same section + * but are not model overrides). Returns `undefined` when no patch field is + * set — the signal that subagents bind the pointed entry directly and no + * derived entry is synthesized. */ export function secondaryModelPatch( secondary: SecondaryModelConfig | undefined, ): ModelAliasOverrides | undefined { if (secondary === undefined) return undefined; - const { model: _model, ...rawPatch } = secondary; + const { + model: _model, + defaultModel: _defaultModel, + models: _models, + force: _force, + ...rawPatch + } = secondary; const patch = Object.fromEntries( Object.entries(rawPatch).filter(([, value]) => value !== undefined), ) as ModelAliasOverrides; @@ -101,7 +109,7 @@ export function applySecondaryModelConfig(config: KimiConfig, env: Env = process * the env-injected recipe fields (restored from raw when the value being * written still equals the env value, so a `getConfig` -> `setConfig` * round-trip cannot persist shell overrides, while a genuinely new selection - * — e.g. a `/secondary_model` pick made under `KIMI_SECONDARY_MODEL` — does + * — e.g. a `/secondary-model` pick made under `KIMI_SECONDARY_MODEL` — does * reach the disk, mirroring the pointer check in `stripEnvModelConfig`). */ export function stripSecondaryModelConfig( diff --git a/packages/agent-core/src/session/index.ts b/packages/agent-core/src/session/index.ts index 777206d246b..13633712d48 100644 --- a/packages/agent-core/src/session/index.ts +++ b/packages/agent-core/src/session/index.ts @@ -857,7 +857,7 @@ export class Session { * `[secondary_model]` change: the spawn * binding (`subagent-host`), the startup-warning computation, and every live * agent's `kimiConfig` (tool descriptions, loop control) all read the - * session snapshot, so a mid-session `/secondary_model` switch takes effect + * session snapshot, so a mid-session `/secondary-model` switch takes effect * for the next subagent spawn without recreating the session. The core owns * config reload, environment overlays, and derived-model synthesis. Copying * that complete recipe and its model entries keeps spawn binding and provider diff --git a/packages/agent-core/test/config/secondary-model.test.ts b/packages/agent-core/test/config/secondary-model.test.ts index 723cc1d9dc7..424690559f9 100644 --- a/packages/agent-core/test/config/secondary-model.test.ts +++ b/packages/agent-core/test/config/secondary-model.test.ts @@ -53,6 +53,25 @@ describe('secondaryModelPatch', () => { secondaryModelPatch({ model: 'cheap', maxContextSize: 1024, defaultEffort: 'low' }), ).toEqual({ maxContextSize: 1024, defaultEffort: 'low' }); }); + + it('excludes the v2 pool keys (defaultModel / models / force) from the patch', () => { + expect( + secondaryModelPatch({ + model: 'cheap', + defaultModel: 'fast', + models: { fast: 'fast and cheap' }, + force: true, + }), + ).toBeUndefined(); + expect( + secondaryModelPatch({ + model: 'cheap', + defaultModel: 'fast', + force: true, + maxOutputSize: 8192, + }), + ).toEqual({ maxOutputSize: 8192 }); + }); }); describe('applySecondaryModelConfig', () => { @@ -155,7 +174,7 @@ describe('stripSecondaryModelConfig', () => { }); it('keeps a genuinely new selection that differs from the env values', () => { - // `/secondary_model` under KIMI_SECONDARY_MODEL: the picked recipe must + // `/secondary-model` under KIMI_SECONDARY_MODEL: the picked recipe must // reach the disk; only overlay round-trips are restored from raw. const onDisk = parseConfigString( ['[secondary_model]', 'model = "cheap"', 'default_effort = "low"'].join('\n'), diff --git a/packages/kap-server/src/error-handler.ts b/packages/kap-server/src/error-handler.ts index 010eb6a05d0..bea7c924673 100644 --- a/packages/kap-server/src/error-handler.ts +++ b/packages/kap-server/src/error-handler.ts @@ -9,7 +9,11 @@ * - `data: null`. * * Validation failures are handled by route-level middleware as 40001 - * `validation.failed`; this handler remains the catch-all unknown-exception path. + * `validation.failed`; this handler remains the catch-all unknown-exception + * path, with one coded exception: an `Error2(config.invalid)` escaping a + * route (e.g. a session resume that fails the subagent model-pool check + * outside any route-level mapper) maps to 40001 as well — a broken user + * config is a client error, not a server fault. * * The handler logs `err` + the resolved `request_id` so operators can * correlate log lines with the envelope returned to the client. This is the @@ -17,6 +21,8 @@ * we never bleed it into the JSON response. */ +import { ErrorCodes, isError2 } from '@moonshot-ai/agent-core-v2'; + import { errEnvelope } from './envelope'; import { ErrorCode } from './protocol/error-codes'; import type { FastifyError } from 'fastify'; @@ -40,6 +46,12 @@ interface ErrorHandlerHost { export function installErrorHandler(app: ErrorHandlerHost): void { app.setErrorHandler((err, req, reply) => { const requestId = req.id; + if (isError2(err) && err.code === ErrorCodes.CONFIG_INVALID) { + reply + .status(200) + .send(errEnvelope(ErrorCode.VALIDATION_FAILED, err.message, requestId, err.stack)); + return; + } req.log.error({ err, request_id: requestId }, 'unhandled error'); reply.status(200).send( errEnvelope( diff --git a/packages/kap-server/src/protocol/rest-config.ts b/packages/kap-server/src/protocol/rest-config.ts index ef2b478c433..f52b268d4df 100644 --- a/packages/kap-server/src/protocol/rest-config.ts +++ b/packages/kap-server/src/protocol/rest-config.ts @@ -13,7 +13,6 @@ export const configResponseSchema = z.object({ default_provider: z.string().optional(), default_model: z.string().optional(), models: z.record(z.string(), z.unknown()).optional(), - secondary_model: z.unknown().optional(), thinking: z.unknown().optional(), plan_mode: z.boolean().optional(), yolo: z.boolean().optional(), @@ -26,6 +25,8 @@ export const configResponseSchema = z.object({ extra_skill_dirs: z.array(z.string()).optional(), loop_control: z.unknown().optional(), background: z.unknown().optional(), + subagent: z.unknown().optional(), + secondary_model: z.unknown().optional(), experimental: z.record(z.string(), z.boolean()).optional(), telemetry: z.boolean().optional(), raw: z.record(z.string(), z.unknown()).optional(), @@ -37,7 +38,6 @@ export const patchConfigRequestSchema = z.object({ default_provider: z.string().optional(), default_model: z.string().optional(), models: z.record(z.string(), z.unknown()).optional(), - secondary_model: z.unknown().optional(), thinking: z.unknown().optional(), plan_mode: z.boolean().optional(), yolo: z.boolean().optional(), @@ -50,6 +50,8 @@ export const patchConfigRequestSchema = z.object({ extra_skill_dirs: z.array(z.string()).optional(), loop_control: z.unknown().optional(), background: z.unknown().optional(), + subagent: z.unknown().optional(), + secondary_model: z.unknown().optional(), experimental: z.record(z.string(), z.boolean()).optional(), telemetry: z.boolean().optional(), }); diff --git a/packages/kap-server/src/routes/config.ts b/packages/kap-server/src/routes/config.ts index caa94c6cdeb..52e321996d0 100644 --- a/packages/kap-server/src/routes/config.ts +++ b/packages/kap-server/src/routes/config.ts @@ -14,8 +14,7 @@ * that: * - projects `getAll()` (camelCase resolved config) into the snake_case * `ConfigResponse`, redacting provider credentials to `has_api_key` - * (mirrors v1 `toConfigResponse`) and hiding the synthesized - * `__secondary__` derived entry from `models` (mirrors `GET /models`); + * (mirrors v1 `toConfigResponse`); * - splits v1's flat multi-domain `POST /config` patch into per-domain * `IConfigService.set(domain, value)` calls (snake_case → camelCase); * - republishes the change as a v2 `DomainEvent` on `IEventService`. @@ -30,7 +29,6 @@ import { IConfigService, IEventService, - SECONDARY_DERIVED_MODEL_ID, type Scope, } from '@moonshot-ai/agent-core-v2'; @@ -132,20 +130,14 @@ export function registerConfigRoutes(app: ConfigRouteHost, core: Scope): void { // Edge facade — project the v2 resolved config into the v1 `ConfigResponse` // wire shape. Top-level domain keys are mapped camelCase→snake_case generically, // so this route does not enumerate the config domains; values pass through -// unchanged except `providers`, whose credentials are redacted to `has_api_key`, -// and `models`, which drops the internal `__secondary__` derived entry (the -// only domain-specific transforms). Pure projection: no service calls. +// unchanged except `providers`, whose credentials are redacted to `has_api_key` +// (the only domain-specific transform). Pure projection: no service calls. // --------------------------------------------------------------------------- function toConfigResponse(resolved: Record): ConfigResponse { const wire: Record = {}; for (const [domain, value] of Object.entries(resolved)) { - wire[camelToSnake(domain)] = - domain === 'providers' - ? toProviderResponses(value) - : domain === 'models' - ? withoutDerivedSecondaryEntry(value) - : value; + wire[camelToSnake(domain)] = domain === 'providers' ? toProviderResponses(value) : value; } // v1 wire echo: surface `yolo` as a derived boolean of the effective default // permission mode. `yolo` is not a config domain; it is computed here so the @@ -169,20 +161,6 @@ interface ProviderLike { readonly oauth?: unknown; } -/** - * The `models` effective view carries the synthesized `__secondary__` derived - * entry whenever `[secondary_model]` has patch fields. It is an internal - * routing artifact (hidden from the `GET /models` picker the same way) and - * can never persist — the overlay's `strip` removes it from `models` writes — - * so keep it off the wire here too. - */ -function withoutDerivedSecondaryEntry(value: unknown): unknown { - if (!isPlainObject(value) || !(SECONDARY_DERIVED_MODEL_ID in value)) return value; - const out: Record = { ...value }; - delete out[SECONDARY_DERIVED_MODEL_ID]; - return out; -} - function toProviderResponses(value: unknown): Record { const result: Record = {}; if (!isPlainObject(value)) return result; @@ -214,14 +192,29 @@ function isPlainObject(value: unknown): value is Record { return typeof value === 'object' && value !== null && !Array.isArray(value); } -function convertKeysSnakeToCamel(obj: unknown): unknown { +/** + * Config properties whose values are maps keyed by user-defined identifiers + * (provider ids, model aliases, subagent pool aliases, flag names). Those keys + * are data, not field names — snake→camel conversion must pass them through + * untouched (`fast_model` must not become `fastModel`), while the map *values* + * (e.g. a provider's `api_key`) still convert. Preserve mode therefore only + * engages from a normal field-name level: an entry key that happens to match + * the list (a provider literally named `models`) must not keep its own + * children preserved. + */ +const MAP_VALUED_CONFIG_KEYS = new Set(['providers', 'models', 'experimental', 'raw']); + +function convertKeysSnakeToCamel(obj: unknown, preserveKeys = false): unknown { if (Array.isArray(obj)) { - return obj.map(convertKeysSnakeToCamel); + return obj.map((item) => convertKeysSnakeToCamel(item)); } if (isPlainObject(obj)) { const result: Record = {}; for (const [key, value] of Object.entries(obj)) { - result[snakeToCamel(key)] = convertKeysSnakeToCamel(value); + result[preserveKeys ? key : snakeToCamel(key)] = convertKeysSnakeToCamel( + value, + !preserveKeys && MAP_VALUED_CONFIG_KEYS.has(key), + ); } return result; } diff --git a/packages/kap-server/src/routes/modelCatalog.ts b/packages/kap-server/src/routes/modelCatalog.ts index 73882331419..1be704ed635 100644 --- a/packages/kap-server/src/routes/modelCatalog.ts +++ b/packages/kap-server/src/routes/modelCatalog.ts @@ -42,7 +42,11 @@ * transform's `setDefined` drops those). The kosong * persistence bridge then pushes the change into the registries, which is * also what invalidates the catalog cache. Multi-step sequences are - * serialized through `enqueueProviderWrite`. + * serialized through `enqueueProviderWrite`. Replace and delete additionally + * cascade into the `[secondary_model]` subagent pool (repointing renamed + * aliases, filtering entries whose model alias disappeared, clearing the + * section when its default dangles) so the engine's create/resume pool + * validation never meets a dangling pool. */ import { @@ -54,7 +58,6 @@ import { IModelsDevImportService, isError2, ModelsDevImportErrors, - SECONDARY_DERIVED_MODEL_ID, type ModelRecord, type ModelsSection, type ProviderConfig, @@ -69,6 +72,11 @@ import { MODELS_SECTION, PROVIDERS_SECTION, } from '@moonshot-ai/agent-core-v2/app/kosongConfig/configSection'; +import { + SECONDARY_MODEL_SECTION, + cascadeSubagentModelPool, + type SecondaryModelConfig, +} from '@moonshot-ai/agent-core-v2/session/subagent/configSection'; import { z } from 'zod'; import { errEnvelope, okEnvelope } from '../envelope'; @@ -230,16 +238,7 @@ export function registerModelCatalogRoutes(app: ModelCatalogRouteHost, core: Sco }, async (req, reply) => { const items = await (await loadCatalog(core)).listModels(); - // Presentation filter: the secondary-model derived entry is synthesized - // runtime state, not a configured alias — keep it out of pickers (the - // catalog still resolves it by id, and the overlay's strip keeps any - // default-model pointer to it out of config.toml). - reply.send( - okEnvelope( - { items: items.filter((item) => item.model !== SECONDARY_DERIVED_MODEL_ID) }, - req.id, - ), - ); + reply.send(okEnvelope({ items }, req.id)); }, ); app.get( @@ -566,6 +565,24 @@ export function registerModelCatalogRoutes(app: ModelCatalogRouteHost, core: Sco } } + const renamedAliases = new Map(); + if (newId !== provider_id) { + for (const oldAlias of previousAliasIds) { + const bare = models[oldAlias]?.model; + const renamed = bare === undefined ? undefined : `${newId}/${bare}`; + if (renamed !== undefined && nextModels[renamed] !== undefined) { + renamedAliases.set(oldAlias, renamed); + } + } + } + const secondaryModel = config.inspect( + SECONDARY_MODEL_SECTION, + ).userValue; + const cascadedPool = cascadeSubagentModelPool(secondaryModel, nextModels, renamedAliases); + if (cascadedPool !== undefined) { + await config.replace(SECONDARY_MODEL_SECTION, cascadedPool); + } + const saved = await core.accessor.get(IModelCatalog).getProvider(newId); reply.send(okEnvelope({ provider: saved }, req.id)); }); @@ -775,6 +792,13 @@ export function registerModelCatalogRoutes(app: ModelCatalogRouteHost, core: Sco if (Object.keys(restModels).length !== Object.keys(models).length) { await config.replace(MODELS_SECTION, restModels); } + const secondaryModel = config.inspect( + SECONDARY_MODEL_SECTION, + ).userValue; + const cascadedPool = cascadeSubagentModelPool(secondaryModel, restModels); + if (cascadedPool !== undefined) { + await config.replace(SECONDARY_MODEL_SECTION, cascadedPool); + } (reply as unknown as StatusReply).code(204).send(); }); }, diff --git a/packages/kap-server/src/routes/sessions.ts b/packages/kap-server/src/routes/sessions.ts index 1e30158e677..c20f913d3bd 100644 --- a/packages/kap-server/src/routes/sessions.ts +++ b/packages/kap-server/src/routes/sessions.ts @@ -40,10 +40,7 @@ * `GET /sessions/{id}/warnings` surfaces session-level notices in the v1 * `{ code, message, severity }` wire shape: the `agents-md-oversized` warning * (projected from the main agent's `IAgentProfileService.getAgentsMdWarning()` - * — computed and cached when the agent binds a profile) and the - * secondary-model early-validation warning (projected from the Session-scope - * `ISessionSecondaryModelWarningService` — computed and cached when the main - * agent is created). An unbound main agent or a valid/unset secondary model + * — computed and cached when the agent binds a profile). An unbound main agent * yields an empty list, matching v1's "no warning" case. * * **Wire fidelity**: mirrors v1's `toProtocolSession` @@ -89,7 +86,6 @@ import { ISessionIndex, ISessionMetadata, ISessionLegacyService, - ISessionSecondaryModelWarningService, IEventService, IWorkspaceAliases, ISessionLifecycleService, @@ -1051,18 +1047,12 @@ export function registerSessionsRoutes(app: SessionRouteHost, core: Scope): void try { // Surface v2 notices in the v1 wire shape. The agents-md warning is // computed (and cached) by `IAgentProfileService` when the main agent - // binds a profile; the secondary-model warning is computed (and - // cached) by `ISessionSecondaryModelWarningService` when the main - // agent is created. An unbound main agent / unset secondary model - // yields `undefined` → that entry drops out, matching v1's "no - // warning" case. + // binds a profile; an unbound main agent yields `undefined` → the + // entry drops out, matching v1's "no warning" case. const agent = await ensureMainAgent(session); const agentsMdWarning = agent.accessor.get(IAgentProfileService).getAgentsMdWarning(); - const secondaryModelWarning = session.accessor - .get(ISessionSecondaryModelWarningService) - .getSecondaryModelWarning(); - const warnings = [ - ...(agentsMdWarning === undefined + const warnings = + agentsMdWarning === undefined ? [] : [ { @@ -1070,17 +1060,7 @@ export function registerSessionsRoutes(app: SessionRouteHost, core: Scope): void message: agentsMdWarning, severity: 'warning' as const, }, - ]), - ...(secondaryModelWarning === undefined - ? [] - : [ - { - code: secondaryModelWarning.code, - message: secondaryModelWarning.message, - severity: 'warning' as const, - }, - ]), - ]; + ]; reply.send(okEnvelope({ warnings }, req.id)); } catch (error) { sendMappedError(reply, req, error); @@ -1322,6 +1302,7 @@ function sendMappedError( return; case 'request.invalid': case 'validation.failed': + case ErrorCodes.CONFIG_INVALID: reply.send(errEnvelope(ErrorCode.VALIDATION_FAILED, err.message, requestId, err.stack)); return; } diff --git a/packages/kap-server/src/services/legacyStatus/legacyStatus.ts b/packages/kap-server/src/services/legacyStatus/legacyStatus.ts index 13c8684d9ef..e4e11845356 100644 --- a/packages/kap-server/src/services/legacyStatus/legacyStatus.ts +++ b/packages/kap-server/src/services/legacyStatus/legacyStatus.ts @@ -21,7 +21,6 @@ import { IAgentUsageService, IModelCatalog, IModelService, - SECONDARY_DERIVED_MODEL_ID, type IAgentScopeHandle, type UsageStatus, } from '@moonshot-ai/agent-core-v2'; @@ -132,7 +131,7 @@ export function readLegacyStatus(agent: IAgentScopeHandle): LegacyStatusSnapshot // (`ISessionLegacyService.status`), so the push and REST agree. maxContextTokens = defaultModelContextTokens(agent) ?? 0; } - const model = displayModelAlias(agent, profile.getModel()); + const model = profile.getModel(); return { usage, contextTokens, @@ -160,25 +159,6 @@ function defaultModelContextTokens(agent: IAgentScopeHandle): number | undefined } } -/** - * The wire `model` is normally the bound alias, which clients resolve against - * the model listing into a display name. The secondary-model derived entry is - * synthesized runtime state hidden from that listing, so resolve it here to - * the pointed entry's display string (the client's own - * `displayName ?? wireName` priority) instead of leaking the reserved id. - */ -function displayModelAlias(agent: IAgentScopeHandle, alias: string): string { - if (alias !== SECONDARY_DERIVED_MODEL_ID) return alias; - const catalog = agent.accessor.get(IModelCatalog) as IModelCatalog | undefined; - if (catalog === undefined) return alias; - try { - const model = catalog.get(alias); - return model.displayName ?? model.name; - } catch { - return alias; - } -} - /** * Map the native v2 `AgentActivityState` to the legacy v1 `AgentPhase` * (`agent.status.updated` payload). Pure function — kept at the kap-server diff --git a/packages/kap-server/src/transport/errors.ts b/packages/kap-server/src/transport/errors.ts index f20c63e97e9..5994cee19e2 100644 --- a/packages/kap-server/src/transport/errors.ts +++ b/packages/kap-server/src/transport/errors.ts @@ -35,6 +35,7 @@ const KIMI_TO_PROTOCOL: Record = { [ErrorCodes.AGENT_NOT_FOUND]: ErrorCode.SESSION_NOT_FOUND, [ErrorCodes.SESSION_UNDO_UNAVAILABLE]: ErrorCode.SESSION_UNDO_UNAVAILABLE, [ErrorCodes.REQUEST_INVALID]: ErrorCode.VALIDATION_FAILED, + [ErrorCodes.CONFIG_INVALID]: ErrorCode.VALIDATION_FAILED, [ErrorCodes.NOT_IMPLEMENTED]: ErrorCode.INTERNAL_ERROR, [ErrorCodes.PROMPT_NOT_FOUND]: ErrorCode.PROMPT_NOT_FOUND, [ErrorCodes.FS_PATH_NOT_FOUND]: ErrorCode.FS_PATH_NOT_FOUND, diff --git a/packages/kap-server/test/config.test.ts b/packages/kap-server/test/config.test.ts index 54b601ad530..bb9a07bc865 100644 --- a/packages/kap-server/test/config.test.ts +++ b/packages/kap-server/test/config.test.ts @@ -1,8 +1,9 @@ -import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises'; +import { mkdtemp, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; import { configResponseSchema, type ConfigResponse } from '../src/protocol/rest-config'; +import { ErrorCode } from '../src/protocol/error-codes'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { type RunningServer, startServer } from '../src/start'; @@ -99,36 +100,77 @@ describe('server-v2 /api/v1/config', () => { expect(after.yolo).toBe(false); }); - it('POST secondary_model persists [secondary_model] and echoes it on GET', async () => { + it('POST { secondary_model } persists the subagent model pool and GET echoes it', async () => { await boot(); const cfg = await patchConfig({ - secondary_model: { model: 'k2-test', default_effort: 'high' }, + secondary_model: { + default_model: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, }); - expect(cfg.secondary_model).toEqual({ model: 'k2-test', defaultEffort: 'high' }); + expect(cfg.secondary_model).toMatchObject({ defaultModel: 'provider/fast' }); const after = await getConfig(); - expect(after.secondary_model).toEqual({ model: 'k2-test', defaultEffort: 'high' }); + expect(after.secondary_model).toMatchObject({ + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }); + }); + + it('POST { secondary_model } preserves pool alias keys containing underscores', async () => { + await boot(); + await patchConfig({ + secondary_model: { default_model: 'provider/fast_model', models: { 'provider/fast_model': '' } }, + }); - const toml = await readFile(join(home as string, 'config.toml'), 'utf-8'); - expect(toml).toContain('[secondary_model]'); - expect(toml).toContain('model = "k2-test"'); - expect(toml).toContain('default_effort = "high"'); + const after = await getConfig(); + expect(after.secondary_model).toMatchObject({ + defaultModel: 'provider/fast_model', + models: { 'provider/fast_model': '' }, + }); + expect( + Object.keys((after.secondary_model as { models: Record }).models), + ).not.toContain('provider/fastModel'); }); - it('GET hides the synthesized __secondary__ derived entry from models', async () => { - await boot('[models.k2-test]\nprovider = "example"\nmodel = "example-model"\n'); - // `default_effort` is a patch field, so the overlay synthesizes the - // `__secondary__` derived entry into the effective `models` view. - const cfg = await patchConfig({ - secondary_model: { model: 'k2-test', default_effort: 'high' }, + it('POST { providers } converts fields of a provider id colliding with a map-valued key', async () => { + await boot(); + await patchConfig({ + providers: { + models: { type: 'openai', base_url: 'https://example.test', api_key: 'sk-test' }, + }, }); - const models = cfg.models as Record; - expect(models['k2-test']).toBeDefined(); - expect(models['__secondary__']).toBeUndefined(); const after = await getConfig(); - const afterModels = after.models as Record; - expect(afterModels['k2-test']).toBeDefined(); - expect(afterModels['__secondary__']).toBeUndefined(); + expect(after.providers['models']).toMatchObject({ + type: 'openai', + base_url: 'https://example.test', + has_api_key: true, + }); + }); + + it('session create with a broken subagent model pool fails with VALIDATION_FAILED', async () => { + await boot( + '[experimental]\n"secondary-model" = true\n\n[secondary_model.models]\n"provider/fast" = "fast and cheap"\n', + ); + const res = await authedFetch(server as RunningServer, base, '/api/v1/sessions', { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ metadata: { cwd: home as string } }), + }); + const body = (await res.json()) as Envelope; + expect(body.code).toBe(ErrorCode.VALIDATION_FAILED); + expect(body.msg).toContain('[secondary_model].default_model is required'); + }); + + it('session create with a broken subagent model pool succeeds while the experiment is off', async () => { + await boot('[secondary_model.models]\n"provider/fast" = "fast and cheap"\n'); + const res = await authedFetch(server as RunningServer, base, '/api/v1/sessions', { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ metadata: { cwd: home as string } }), + }); + const body = (await res.json()) as Envelope<{ id: string }>; + expect(body.code).toBe(0); }); }); diff --git a/packages/kap-server/test/meta.test.ts b/packages/kap-server/test/meta.test.ts index 95e5e619345..948ee16ab39 100644 --- a/packages/kap-server/test/meta.test.ts +++ b/packages/kap-server/test/meta.test.ts @@ -31,7 +31,7 @@ describe('/api/v1/meta experimental_flags', () => { // only forces ON), but the per-flag env must be fully ABSENT — an // explicit '0' is an env override that outranks the config section. vi.stubEnv('KIMI_CODE_EXPERIMENTAL_FLAG', '0'); - vi.stubEnv('KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL', undefined); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_TOOL_SELECT', undefined); }); afterEach(async () => { @@ -75,7 +75,7 @@ describe('/api/v1/meta experimental_flags', () => { it('reports registered flags as off by default', async () => { const base = await boot(); const flags = await getMetaFlags(base); - expect(flags['secondary-model']).toBe(false); + expect(flags['tool-select']).toBe(false); }); it('reports a config-enabled flag from the very first response', async () => { @@ -83,44 +83,44 @@ describe('/api/v1/meta experimental_flags', () => { // section from a config that loads asynchronously, so the handler awaits // IConfigService.ready before snapshotting — a persisted flag must be // visible even to the earliest request. - const base = await boot('[experimental]\nsecondary-model = true\n'); + const base = await boot('[experimental]\ntool-select = true\n'); const flags = await getMetaFlags(base); - expect(flags['secondary-model']).toBe(true); + expect(flags['tool-select']).toBe(true); }); it('reflects a flag enabled via its KIMI_CODE_EXPERIMENTAL_* env var', async () => { - vi.stubEnv('KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL', '1'); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_TOOL_SELECT', '1'); const base = await boot(); const flags = await getMetaFlags(base); - expect(flags['secondary-model']).toBe(true); + expect(flags['tool-select']).toBe(true); }); it('flips live when the [experimental] config section is written via POST /config', async () => { const base = await boot(); - expect((await getMetaFlags(base))['secondary-model']).toBe(false); + expect((await getMetaFlags(base))['tool-select']).toBe(false); const res = await authedFetch(server as RunningServer, base, '/api/v1/config', { method: 'POST', headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ experimental: { 'secondary-model': true } }), + body: JSON.stringify({ experimental: { 'tool-select': true } }), }); expect(res.status).toBe(200); - expect((await getMetaFlags(base))['secondary-model']).toBe(true); + expect((await getMetaFlags(base))['tool-select']).toBe(true); }); it('keeps an env-forced flag on when the config section disables it', async () => { - vi.stubEnv('KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL', '1'); + vi.stubEnv('KIMI_CODE_EXPERIMENTAL_TOOL_SELECT', '1'); const base = await boot(); const res = await authedFetch(server as RunningServer, base, '/api/v1/config', { method: 'POST', headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ experimental: { 'secondary-model': false } }), + body: JSON.stringify({ experimental: { 'tool-select': false } }), }); expect(res.status).toBe(200); // Env outranks the config section in FlagService resolution. - expect((await getMetaFlags(base))['secondary-model']).toBe(true); + expect((await getMetaFlags(base))['tool-select']).toBe(true); }); }); diff --git a/packages/kap-server/test/modelCatalog.test.ts b/packages/kap-server/test/modelCatalog.test.ts index e214f62339e..837351a154a 100644 --- a/packages/kap-server/test/modelCatalog.test.ts +++ b/packages/kap-server/test/modelCatalog.test.ts @@ -149,15 +149,6 @@ describe('server-v2 /api/v1 model/provider catalog', () => { ]); }); - it('hides the synthesized secondary-model derived entry from /models', async () => { - await boot( - `${CATALOG_TOML}\n[secondary_model]\nmodel = "turbo"\nmax_output_size = 8192\n`, - ); - const { status, body } = await getJson<{ items: { model: string }[] }>('/api/v1/models'); - expect(status).toBe(200); - expect(body.data.items.map((item) => item.model)).toEqual(['k2', 'turbo', 'gpt4o']); - }); - it('lists models without refreshing providers', async () => { const refreshProviderModels = vi.fn(async () => ({ changed: [], diff --git a/packages/kap-server/test/modelCatalogProviderWrite.test.ts b/packages/kap-server/test/modelCatalogProviderWrite.test.ts index 3ec70ae6eb3..2da210d229f 100644 --- a/packages/kap-server/test/modelCatalogProviderWrite.test.ts +++ b/packages/kap-server/test/modelCatalogProviderWrite.test.ts @@ -58,6 +58,21 @@ const DANGLING_DEFAULT_TOML = [ '', ].join('\n'); +/** Subagent pool whose default survives an openai deletion; one entry dangles. */ +const POOL_TOML = [ + DEFAULTED_TOML, + '[secondary_model]', + 'default_model = "k2"', + '', + '[secondary_model.models]', + 'k2 = "fast"', + 'gpt4o = "smart"', + '', +].join('\n'); + +/** Subagent pool whose effective default belongs to the deleted provider. */ +const POOL_DANGLING_DEFAULT_TOML = POOL_TOML.replace('default_model = "k2"', 'default_model = "gpt4o"'); + const MANAGED_TOML = [ '[providers."managed:kimi-code"]', 'type = "kimi"', @@ -453,6 +468,29 @@ describe('server-v2 /api/v1 provider write endpoints', () => { }); }); + it('filters secondary_model pool entries whose provider was deleted', async () => { + await boot(POOL_TOML); + const { status } = await deleteJson('/api/v1/providers/openai'); + expect(status).toBe(204); + + const onDisk = await readConfigToml(); + expect(onDisk['secondary_model']).toEqual({ + default_model: 'k2', + models: { k2: 'fast' }, + }); + }); + + it('drops the secondary_model section when its default dangles after deletion', async () => { + await boot(POOL_DANGLING_DEFAULT_TOML); + const { status } = await deleteJson('/api/v1/providers/openai'); + expect(status).toBe(204); + + // A leftover pool table without its default would fail the engine's pool + // validation on every session create — the whole section goes instead. + const onDisk = await readConfigToml(); + expect(onDisk['secondary_model']).toBeUndefined(); + }); + it('round-trips a created provider: delete removes every trace from config.toml', async () => { await boot(); const created = await postJson('/api/v1/providers', CREATE_BODY); @@ -715,6 +753,43 @@ describe('server-v2 /api/v1 provider write endpoints', () => { expect(onDisk['default_model']).toBe('gpt4o'); }); + it('repoints secondary_model pool entries on provider rename', async () => { + await boot(POOL_TOML); + const { status } = await putJson('/api/v1/providers/openai', { + type: 'openai', + new_id: 'my-openai', + models: [{ model: 'gpt-4o', max_context_size: 128000 }], + }); + expect(status).toBe(200); + + const onDisk = await readConfigToml(); + expect(onDisk['secondary_model']).toEqual({ + default_model: 'k2', + models: { k2: 'fast', 'my-openai/gpt-4o': 'smart' }, + }); + }); + + it('filters secondary_model pool entries dropped by a provider edit', async () => { + await boot(POOL_TOML); + const { status } = await putJson('/api/v1/providers/openai', REPLACE_BODY); + expect(status).toBe(200); + + const onDisk = await readConfigToml(); + expect(onDisk['secondary_model']).toEqual({ + default_model: 'k2', + models: { k2: 'fast' }, + }); + }); + + it('drops the secondary_model section when a provider edit orphans its default', async () => { + await boot(POOL_DANGLING_DEFAULT_TOML); + const { status } = await putJson('/api/v1/providers/openai', REPLACE_BODY); + expect(status).toBe(200); + + const onDisk = await readConfigToml(); + expect(onDisk['secondary_model']).toBeUndefined(); + }); + it('rejects a rename to an existing provider id with 40921', async () => { await boot(KEEP_DEFAULT_TOML); const { status, body } = await putJson('/api/v1/providers/openai', { diff --git a/packages/kap-server/test/sessionEventBroadcaster.test.ts b/packages/kap-server/test/sessionEventBroadcaster.test.ts index 9d5fd631d38..88408732d42 100644 --- a/packages/kap-server/test/sessionEventBroadcaster.test.ts +++ b/packages/kap-server/test/sessionEventBroadcaster.test.ts @@ -32,7 +32,6 @@ import { ISessionLifecycleService, IWorkspaceLifecycleService, MAIN_AGENT_ID, - SECONDARY_DERIVED_MODEL_ID, SessionInteractionService, StateRegistry, } from '@moonshot-ai/agent-core-v2'; @@ -597,49 +596,6 @@ describe('SessionEventBroadcaster', () => { }); }); - it('resolves the secondary derived model id to a display string in status events', async () => { - const lc = new FakeLifecycle(); - const main = lc.addAgent('main'); - main.set(IAgentTokenCountingService, { statusSize: () => 10 }); - main.set(IAgentProfileService, { - getModel: () => SECONDARY_DERIVED_MODEL_ID, - getModelCapabilities: () => ({ max_context_tokens: 128_000 }), - }); - main.set(IAgentUsageService, { status: () => ({}) }); - main.set(IModelCatalog, { - get: (id: string) => { - expect(id).toBe(SECONDARY_DERIVED_MODEL_ID); - return { id, name: 'kimi-k2-wire', displayName: 'Kimi K2' }; - }, - }); - sessions.set('s1', lc); - const { target, envelopes } = collectingTarget(); - await bc.subscribe('s1', target); - - main.bus.emit(agentEvent('agent.status.updated', {})); - // Without a displayName the pointed entry's wire name is shown. - main.set(IModelCatalog, { - get: (id: string) => ({ id, name: 'kimi-k2-wire' }), - }); - main.bus.emit(agentEvent('agent.status.updated', {})); - // A resolution failure falls back to the raw alias. - main.set(IModelCatalog, { - get: () => { - throw new Error('unknown model'); - }, - }); - main.bus.emit(agentEvent('agent.status.updated', {})); - await bc.getCursor('s1'); - - const statuses = envelopes.filter((envelope) => envelope.type === 'agent.status.updated'); - expect(statuses).toHaveLength(3); - expect(statuses.map((envelope) => envelope.payload)).toMatchObject([ - { model: 'Kimi K2' }, - { model: 'kimi-k2-wire' }, - { model: SECONDARY_DERIVED_MODEL_ID }, - ]); - }); - it('publishes the input cap as the status context limit when declared', async () => { const lc = new FakeLifecycle(); const main = lc.addAgent('main'); diff --git a/packages/kap-server/test/transport-errors.test.ts b/packages/kap-server/test/transport-errors.test.ts index 238a6963b0d..9eb6747c203 100644 --- a/packages/kap-server/test/transport-errors.test.ts +++ b/packages/kap-server/test/transport-errors.test.ts @@ -9,6 +9,7 @@ import { ErrorCode } from '../src/protocol/error-codes'; import { describe, expect, it } from 'vitest'; import { mapError } from '../src/transport/errors'; +import { installErrorHandler } from '../src/error-handler'; describe('/api/v1/debug transport mapError', () => { it.each([ @@ -19,6 +20,7 @@ describe('/api/v1/debug transport mapError', () => { [ErrorCodes.OS_FS_PERMISSION_DENIED, ErrorCode.FS_PERMISSION_DENIED], [ErrorCodes.STORAGE_IO_FAILED, ErrorCode.PERSISTENCE_FAILURE], [ErrorCodes.STORAGE_LOCKED, ErrorCode.PERSISTENCE_FAILURE], + [ErrorCodes.CONFIG_INVALID, ErrorCode.VALIDATION_FAILED], [ErrorCodes.GOAL_UNSUPPORTED_AGENT, ErrorCode.GOAL_UNSUPPORTED_AGENT], ])('maps domain code %s to its wire equivalent', (code, wire) => { const env = mapError(new Error2(code, 'boom'), 'req-1'); @@ -30,3 +32,37 @@ describe('/api/v1/debug transport mapError', () => { expect(env.code).toBe(ErrorCode.INTERNAL_ERROR); }); }); + +describe('installErrorHandler (catch-all)', () => { + function run(err: unknown): { code: number; msg: string } { + let installed: unknown; + installErrorHandler({ + setErrorHandler: (h) => { + installed = h; + return undefined; + }, + }); + const handler = installed as ( + e: unknown, + req: { id: string; log: { error: () => void } }, + reply: { status: (code: number) => { send: (p: unknown) => void } }, + ) => void; + let payload: { code: number; msg: string } | undefined; + handler( + err, + { id: 'req-1', log: { error: () => {} } }, + { status: () => ({ send: (p: unknown) => void (payload = p as typeof payload) }) }, + ); + return payload!; + } + + it('maps an escaped config.invalid to VALIDATION_FAILED', () => { + const env = run(new Error2(ErrorCodes.CONFIG_INVALID, 'broken pool')); + expect(env.code).toBe(ErrorCode.VALIDATION_FAILED); + expect(env.msg).toContain('broken pool'); + }); + + it('keeps unknown exceptions at INTERNAL_ERROR', () => { + expect(run(new Error('boom')).code).toBe(ErrorCode.INTERNAL_ERROR); + }); +}); diff --git a/packages/node-sdk/src/index.ts b/packages/node-sdk/src/index.ts index 19b0f08a574..a2e10b94174 100644 --- a/packages/node-sdk/src/index.ts +++ b/packages/node-sdk/src/index.ts @@ -78,6 +78,14 @@ export { parseAgentFileText, resolveAgentPath } from '@moonshot-ai/agent-core'; // The synthesized `[models]` alias a `[secondary_model]` recipe with patch // fields materializes at runtime — hosts filter it out of model pickers. export { SECONDARY_DERIVED_MODEL_ALIAS } from '@moonshot-ai/agent-core'; +// Reserved key of the v2 engine's subagent model pool: it always binds the +// caller's own model, so hosts must not offer a user alias named `primary` +// as the subagent default model. +export { PRIMARY_SUBAGENT_MODEL_CHOICE } from '@moonshot-ai/agent-core-v2/session/subagent/configSection'; +// Pool cascade for writes that rebuild the `[models]` table: hosts staging a +// provider overwrite (remove-then-re-add) use it to restore the still-valid +// pool entries against the final alias set. +export { cascadeSubagentModelPool } from '@moonshot-ai/agent-core-v2/session/subagent/configSection'; // Process-wide HTTP proxy bootstrap — installed once at CLI startup so all // outbound fetch honors HTTP_PROXY / HTTPS_PROXY / NO_PROXY. diff --git a/packages/node-sdk/src/rpc.ts b/packages/node-sdk/src/rpc.ts index a75f983d5a1..04f2e623e55 100644 --- a/packages/node-sdk/src/rpc.ts +++ b/packages/node-sdk/src/rpc.ts @@ -487,11 +487,6 @@ export abstract class SDKRpcClientBase { }); } - async applyPersistedSecondaryModel(input: SessionIdRpcInput): Promise { - const rpc = await this.getRpc(); - return rpc.applyPersistedSecondaryModel({ sessionId: input.sessionId }); - } - async setPermission(input: SetSessionPermissionRpcInput): Promise { const rpc = await this.getRpc(); return rpc.setPermission({ diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index fa88c176de2..93fffe65626 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -118,13 +118,6 @@ * injection point — see the session-lifecycle section header), and * `toolCall` keeps the base class's "not supported" answer, which the * interaction bridge already relies on. - * - `applyPersistedSecondaryModel` → the reload + loud validations + warning - * refresh of v1's contract, rebuilt over the live `IConfigService` recipe - * and `ISessionSecondaryModelWarningService.recheckSecondaryModelWarning` - * (the v2 spawn binding resolves the secondary model at spawn time, so - * there is no session snapshot to push). `getSessionWarnings` also - * surfaces the v2 secondary-model warning next to the AGENTS.md one, - * matching v1's aggregate. */ import { randomUUID } from 'node:crypto'; import { readdir } from 'node:fs/promises'; @@ -151,9 +144,7 @@ import { type BeginAuthorizationResult, } from '@moonshot-ai/agent-core-v2/mcpCore/oauth/service'; import { createMcpOAuthStore } from '@moonshot-ai/agent-core-v2/app/mcpConfig/oauthStore'; -import { SECONDARY_MODEL_SECTION } from '@moonshot-ai/agent-core-v2/app/kosongConfig/configSection'; import { IAtomicDocumentStore } from '@moonshot-ai/agent-core-v2/persistence/interface/atomicDocumentStore'; -import { wrapSubagentModelError } from '@moonshot-ai/agent-core-v2/session/subagent/configSection'; import { loadMcpServers } from '@moonshot-ai/agent-core-v2/workspace/workspaceMcpConfig/internal/config-loader'; import type { McpServerConfig as WorkspaceMcpServerConfig } from '@moonshot-ai/agent-core-v2/mcpCore/config-schema'; import { @@ -187,7 +178,6 @@ import { IEventService, IHostEnvironment, IHostFileSystem, - IModelCatalog, IModelService, IProviderService, ISessionBtwService, @@ -199,7 +189,6 @@ import { ISessionInitService, ISessionMcpHandle, ISessionMetadata, - ISessionSecondaryModelWarningService, ISessionSkillCatalog, ISessionWorkspaceContext, ITelemetryService, @@ -235,7 +224,6 @@ import { type IDisposable, type ISessionScopeHandle, type Scope, - type SecondaryModelConfig, type ServicesAccessor, type SessionSummary as V2SessionSummary, } from '@moonshot-ai/agent-core-v2'; @@ -662,26 +650,30 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { /** * v1's removal cascades: the provider entry, every model pointing at it, - * and the default pointers when they dangle. The engine's own - * `kosong.removeProvider` only clears the default-provider pointer, so the - * full v1 cascade is computed from the user-layer values (see - * `planProviderRemoval`) and persisted as ONE atomic multi-section replace — - * the same single-write shape as v1's `removeKimiProvider`, so a process - * exit can never leave the file in a halfway-cascaded state. + * the default pointers when they dangle, and the `[secondary_model]` + * subagent pool entries (the section itself when its default dangles). + * The engine's own `kosong.removeProvider` only clears the + * default-provider pointer, so the full v1 cascade is computed from the + * user-layer values (see `planProviderRemoval`) and persisted as ONE + * atomic multi-section replace — the same single-write shape as v1's + * `removeKimiProvider`, so a process exit can never leave the file in a + * halfway-cascaded state. */ override async removeProvider(providerId: string): Promise { await this.configReady; - const [providers, models, defaultModel, defaultProvider] = await Promise.all([ + const [providers, models, defaultModel, defaultProvider, secondaryModel] = await Promise.all([ this.klient.global.config.inspect>('providers'), this.klient.global.config.inspect>>('models'), this.klient.global.config.inspect('defaultModel'), this.klient.global.config.inspect('defaultProvider'), + this.klient.global.config.inspect>('secondaryModel'), ]); const plan = planProviderRemoval({ providers: providers.userValue, models: models.userValue, defaultModel: defaultModel.userValue, defaultProvider: defaultProvider.userValue, + secondaryModel: secondaryModel.userValue, providerId, }); const sections: Record = { @@ -694,6 +686,11 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { if (plan.clearDefaultProvider) { sections['defaultProvider'] = undefined; } + if (plan.secondaryModel !== undefined) { + // `null` clears the whole section; a replacement object folds the + // filtered pool into the same atomic write. + sections['secondaryModel'] = plan.secondaryModel ?? undefined; + } await this.klient.global.config.replaceSections({ sections }); return this.getConfig(); } @@ -1474,43 +1471,6 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { agent.accessor.get(IAgentProfileService).setThinking(input.effort); } - /** - * v1 reloads the core config and pushes the resolved snapshot into the - * session: the spawn binding, the tool descriptions, and the cached - * startup warning all read that snapshot. The v2 engine resolves the - * secondary model live against `IConfigService` at spawn time - * (`resolveSubagentBinding`) and rebuilds the tool description on every - * read, so the preceding `setConfig` write already took effect - * session-wide — what remains of v1's contract is the reload (the recipe - * may have been persisted through another channel), the same loud - * validations, and the warning-cache refresh. The recipe read is NOT - * flag-gated, mirroring v1's `setSecondaryModelConfig` (the experiment - * gate lives at the spawn binding on both engines). - */ - override async applyPersistedSecondaryModel(input: SessionIdRpcInput): Promise { - const session = this.requireLiveSession(input.sessionId); - await this.klient.global.config.reload(); - await this.configReady; - await this.modelReady; - const secondary = this.engineAccessor - .get(IConfigService) - .get(SECONDARY_MODEL_SECTION); - if (secondary?.model === undefined) { - throw new KimiError( - ErrorCodes.CONFIG_INVALID, - 'Cannot set the secondary model: persist its recipe before applying it to a session.', - ); - } - try { - this.engineAccessor.get(IModelCatalog).get(secondary.model); - } catch (error) { - throw wrapSubagentModelError(error, secondary.model, undefined); - } - session.accessor - .get(ISessionSecondaryModelWarningService) - .recheckSecondaryModelWarning(); - } - override async setPermission(input: SetSessionPermissionRpcInput): Promise { const agent = await this.agentFacade(input.sessionId); return agent.setPermission(input.mode); @@ -1802,14 +1762,7 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { * cache is empty — v1 recomputes on demand whenever no warning is cached, * so an AGENTS.md that outgrows the budget mid-session surfaces on both * engines. The single warning shape (`agents-md-oversized`, severity - * `warning`) mirrors v1's assembly. The secondary-model half comes from the - * session scope's `ISessionSecondaryModelWarningService` (v1's - * `computeSecondaryModelWarnings`): v1 computes it from the session's - * config snapshot while v2 caches the live-config check at main-agent - * creation, so the two agree on recipes applied through - * `applyPersistedSecondaryModel` (which refreshes the v2 cache) and on - * recipes present at session creation; a recipe persisted but never - * applied surfaces only on v2 (live config vs v1's snapshot). + * `warning`) mirrors v1's assembly. */ override async getSessionWarnings(input: SessionIdRpcInput) { const agent = await this.agentScope(input.sessionId); @@ -1827,17 +1780,9 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { ); warning = prepared.agentsMdWarning; } - const warnings: { code: string; message: string; severity: 'warning' }[] = - warning === undefined - ? [] - : [{ code: 'agents-md-oversized', message: warning, severity: 'warning' as const }]; - const secondary = this.requireLiveSession(input.sessionId) - .accessor.get(ISessionSecondaryModelWarningService) - .getSecondaryModelWarning(); - if (secondary !== undefined) { - warnings.push({ code: secondary.code, message: secondary.message, severity: 'warning' }); - } - return warnings; + return warning === undefined + ? [] + : [{ code: 'agents-md-oversized', message: warning, severity: 'warning' as const }]; } /** diff --git a/packages/node-sdk/src/session.ts b/packages/node-sdk/src/session.ts index 4a3325fdcc4..ae3ab30dedf 100644 --- a/packages/node-sdk/src/session.ts +++ b/packages/node-sdk/src/session.ts @@ -233,18 +233,6 @@ export class Session { await this.rpc.setThinking({ sessionId: this.id, effort: normalized }); } - /** - * Live-apply the persisted `[secondary_model]` recipe to this session - * (subagent model binding). Persist the recipe via `KimiHarness.setConfig` - * first; this reloads the complete recipe and its synthesized derived entry - * before updating the session snapshot — mirroring the `/secondary_model` - * flow. - */ - async applyPersistedSecondaryModel(): Promise { - this.ensureOpen(); - await this.rpc.applyPersistedSecondaryModel({ sessionId: this.id }); - } - async setPermission(mode: PermissionMode): Promise { this.ensureOpen(); if (!isPermissionMode(mode)) { diff --git a/packages/node-sdk/src/v2/config-mapper.ts b/packages/node-sdk/src/v2/config-mapper.ts index ba47f90846f..7d476a838f2 100644 --- a/packages/node-sdk/src/v2/config-mapper.ts +++ b/packages/node-sdk/src/v2/config-mapper.ts @@ -38,6 +38,7 @@ const KIMI_CONFIG_DOMAINS = [ 'loopControl', 'background', 'subagent', + 'secondaryModel', 'mcp', 'image', 'modelCatalog', @@ -49,7 +50,7 @@ const KIMI_CONFIG_DOMAINS = [ * Pick the v1-shaped fields out of the v2 engine's resolved config * (`config.getAll()` — the effective view: file values plus env overlays * plus registered section defaults). Domains v2 knows but v1 does not - * (`cron`, `tools`, `secondaryModel`, `extraAgentDirs`, ...) are dropped, + * (`cron`, `tools`, `extraAgentDirs`, ...) are dropped, * mirroring how v1's schema strips unknown top-level keys. */ export function resolvedConfigToKimiConfig(resolved: Record): KimiConfig { @@ -88,6 +89,14 @@ export interface ProviderRemovalPlan { readonly models: Record; readonly clearDefaultModel: boolean; readonly clearDefaultProvider: boolean; + /** + * Cascade for the `[secondary_model]` subagent pool / legacy recipe: + * `undefined` = unchanged, `null` = drop the whole section (its effective + * default dangles, so the section can no longer validate), otherwise the + * replacement section with pool entries pointing at removed models + * filtered out. + */ + readonly secondaryModel: Record | null | undefined; } /** @@ -97,12 +106,19 @@ export interface ProviderRemovalPlan { * only clears the default-provider pointer, so the SDK replays the full v1 * cascade through the config facade. Inputs are the USER-layer values * (`inspect().userValue`), matching v1's disk-config write base. + * + * The `[secondary_model]` section cascades too: pool entries that name a + * removed model alias are filtered out, and when the effective default + * (`defaultModel`, or the legacy recipe's `model` fallback) dangles the + * whole section is dropped — a surviving `[secondary_model.models]` table + * without its default would fail pool validation on every session create. */ export function planProviderRemoval(input: { readonly providers: Record | undefined; readonly models: Record> | undefined; readonly defaultModel: string | undefined; readonly defaultProvider: string | undefined; + readonly secondaryModel?: Record; readonly providerId: string; }): ProviderRemovalPlan { const providers = { ...input.providers }; @@ -123,9 +139,36 @@ export function planProviderRemoval(input: { models, clearDefaultModel: removedDefault, clearDefaultProvider: input.defaultProvider === input.providerId, + secondaryModel: planSecondaryModelCascade(input.secondaryModel, models), }; } +/** + * Cascade the provider removal into the `[secondary_model]` section against + * the surviving model-alias table. See `ProviderRemovalPlan.secondaryModel` + * for the tri-state result. + */ +function planSecondaryModelCascade( + secondaryModel: Record | undefined, + survivingModels: Record, +): Record | null | undefined { + if (secondaryModel === undefined) return undefined; + + const defaultAlias = secondaryModel['defaultModel'] ?? secondaryModel['model']; + if (typeof defaultAlias === 'string' && !(defaultAlias in survivingModels)) { + return null; + } + + const pool = secondaryModel['models']; + if (pool === undefined || typeof pool !== 'object' || pool === null) { + return undefined; + } + const entries = Object.entries(pool as Record); + const surviving = entries.filter(([alias]) => alias in survivingModels); + if (surviving.length === entries.length) return undefined; + return { ...secondaryModel, models: Object.fromEntries(surviving) }; +} + /** * Apply the v1 remove-provider cascade to a whole `KimiConfig` in memory (no * persistence): drop the provider entry, every model pointing at it, and the @@ -140,6 +183,7 @@ export function removeProviderFromConfig(config: KimiConfig, providerId: string) models: config.models as Record> | undefined, defaultModel: config.defaultModel, defaultProvider: config.defaultProvider, + secondaryModel: config.secondaryModel as Record | undefined, providerId, }); return { @@ -148,5 +192,9 @@ export function removeProviderFromConfig(config: KimiConfig, providerId: string) models: plan.models as KimiConfig['models'], defaultModel: plan.clearDefaultModel ? undefined : config.defaultModel, defaultProvider: plan.clearDefaultProvider ? undefined : config.defaultProvider, + secondaryModel: + plan.secondaryModel === null + ? undefined + : ((plan.secondaryModel ?? config.secondaryModel) as KimiConfig['secondaryModel']), }; } diff --git a/packages/node-sdk/src/v2/session-wiring.ts b/packages/node-sdk/src/v2/session-wiring.ts index 2924eb8b347..693a6142572 100644 --- a/packages/node-sdk/src/v2/session-wiring.ts +++ b/packages/node-sdk/src/v2/session-wiring.ts @@ -38,12 +38,10 @@ import { IAgentTokenCountingService, IAgentUsageService, IEventBus, - IModelCatalog, ISessionApprovalService, ISessionInteractionService, ISessionQuestionService, MAIN_AGENT_ID, - SECONDARY_DERIVED_MODEL_ID, type DomainEvent, type IAgentScopeHandle, type IDisposable, @@ -289,26 +287,6 @@ function withStatusSnapshot(agent: IAgentScopeHandle, event: DomainEvent): Domai usage: usageService.status(), contextTokens, maxContextTokens, - model: displayModelAlias(agent, profile.getModel()), + model: profile.getModel(), } as unknown as DomainEvent; } - -/** - * The wire `model` is normally the bound alias, which clients resolve against - * the model listing into a display name. The secondary-model derived entry is - * synthesized runtime state hidden from that listing, so resolve it here to - * the pointed entry's display string (the client's own - * `displayName ?? wireName` priority) instead of leaking the reserved id. - * Mirrors kap-server's `displayModelAlias`. - */ -function displayModelAlias(agent: IAgentScopeHandle, alias: string): string { - if (alias !== SECONDARY_DERIVED_MODEL_ID) return alias; - const catalog = agent.accessor.get(IModelCatalog) as IModelCatalog | undefined; - if (catalog === undefined) return alias; - try { - const model = catalog.get(alias); - return model.displayName ?? model.name; - } catch { - return alias; - } -} diff --git a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts index 00fe40956fd..13f74c5a821 100644 --- a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts +++ b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts @@ -7,7 +7,7 @@ * Wiring: real v2 engine bootstrapped on a temp KIMI_CODE_HOME; no provider calls. * Run: pnpm exec vitest run test/sdk-rpc-client-v2.test.ts */ -import { mkdir, mkdtemp, readdir, rm, writeFile } from 'node:fs/promises'; +import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; @@ -343,6 +343,47 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { } }); + it('cascades removeProvider into the secondary_model pool', async () => { + const { harness } = await makeHarness(); + try { + await harness.setConfig({ + providers: { + a: { type: 'openai', baseUrl: 'https://a.example.test/v1', apiKey: 'sk-a' }, + b: { type: 'openai', baseUrl: 'https://b.example.test/v1', apiKey: 'sk-b' }, + }, + models: { + 'a/m1': { provider: 'a', model: 'm1', maxContextSize: 100 }, + 'b/m1': { provider: 'b', model: 'm1', maxContextSize: 100 }, + }, + secondaryModel: { + defaultModel: 'a/m1', + models: { 'a/m1': 'fast', 'b/m1': 'smart' }, + }, + }); + + // Pool entries naming a removed model alias are filtered out; the + // surviving default keeps the section valid. + const filtered = await harness.removeProvider('b'); + expect(filtered.secondaryModel).toEqual({ + defaultModel: 'a/m1', + models: { 'a/m1': 'fast' }, + }); + + // When the pool's default dangles the whole section is dropped — a + // leftover models table without its default would fail pool validation + // on every session create. + await harness.setConfig({ + secondaryModel: { defaultModel: 'a/m1', models: { 'a/m1': 'fast' } }, + }); + const cleared = await harness.removeProvider('a'); + expect(cleared.secondaryModel).toBeUndefined(); + const reread = await harness.getConfig({ reload: true }); + expect(reread.secondaryModel).toBeUndefined(); + } finally { + await harness.close(); + } + }); + it('replaces config sections atomically and clears undefined sections', async () => { const { harness } = await makeHarness(); try { @@ -363,6 +404,32 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { } }); + it('round-trips the secondaryModel pool field to the [secondary_model] config section', async () => { + const { harness, homeDir } = await makeHarness(); + try { + await harness.setConfig({ + secondaryModel: { + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }, + }); + + const toml = await readFile(join(homeDir, 'config.toml'), 'utf-8'); + expect(toml).toContain('[secondary_model]'); + expect(toml).toContain('default_model'); + expect(toml).toContain('[secondary_model.models]'); + expect(toml).not.toContain('[subagent.models]'); + + const reread = await harness.getConfig({ reload: true }); + expect(reread.secondaryModel).toEqual({ + defaultModel: 'provider/fast', + models: { 'provider/fast': 'fast and cheap' }, + }); + } finally { + await harness.close(); + } + }); + it('fails loudly with not_implemented for methods not yet migrated', async () => { const { harness } = await makeHarness(); try { @@ -623,6 +690,66 @@ describe('removeProviderFromConfig', () => { expect(next.defaultModel).toBe('a/m1'); expect(next.defaultProvider).toBe('a'); }); + + it('filters secondary_model pool entries whose model alias was removed', () => { + const config = { + providers: { a: { type: 'openai' }, b: { type: 'openai' } }, + models: { + 'a/m1': { provider: 'a', model: 'm1', maxContextSize: 100 }, + 'b/m1': { provider: 'b', model: 'm1', maxContextSize: 100 }, + }, + secondaryModel: { + defaultModel: 'a/m1', + models: { 'a/m1': 'fast', 'b/m1': 'smart' }, + }, + } as unknown as KimiConfig; + + const next = removeProviderFromConfig(config, 'b'); + + expect(next.secondaryModel).toEqual({ + defaultModel: 'a/m1', + models: { 'a/m1': 'fast' }, + }); + }); + + it('drops the secondary_model section when its default model dangles', () => { + const config = { + providers: { a: { type: 'openai' }, b: { type: 'openai' } }, + models: { + 'a/m1': { provider: 'a', model: 'm1', maxContextSize: 100 }, + 'b/m1': { provider: 'b', model: 'm1', maxContextSize: 100 }, + }, + secondaryModel: { + defaultModel: 'b/m1', + models: { 'a/m1': 'fast', 'b/m1': 'smart' }, + }, + } as unknown as KimiConfig; + + expect(removeProviderFromConfig(config, 'b').secondaryModel).toBeUndefined(); + + // The legacy recipe's `model` key acts as the default fallback and + // cascades the same way. + const legacy = { + ...config, + secondaryModel: { model: 'b/m1', default_effort: 'low' }, + } as unknown as KimiConfig; + expect(removeProviderFromConfig(legacy, 'b').secondaryModel).toBeUndefined(); + }); + + it('leaves the secondary_model section untouched when nothing dangles', () => { + const config = { + providers: { a: { type: 'openai' }, b: { type: 'openai' } }, + models: { + 'a/m1': { provider: 'a', model: 'm1', maxContextSize: 100 }, + 'b/m1': { provider: 'b', model: 'm1', maxContextSize: 100 }, + }, + secondaryModel: { defaultModel: 'a/m1' }, + } as unknown as KimiConfig; + + const next = removeProviderFromConfig(config, 'b'); + + expect(next.secondaryModel).toEqual({ defaultModel: 'a/m1' }); + }); }); async function writeSkill(dir: string, name: string): Promise { await mkdir(dir, { recursive: true }); diff --git a/packages/node-sdk/test/session-event-wiring.test.ts b/packages/node-sdk/test/session-event-wiring.test.ts index cd4e3d9aee3..6f0fe206ae3 100644 --- a/packages/node-sdk/test/session-event-wiring.test.ts +++ b/packages/node-sdk/test/session-event-wiring.test.ts @@ -3,8 +3,7 @@ * bus. Covers the status-snapshot fold: v2 emits `agent.status.updated` in * slices and the model slice rides only the bind-time emission, so the * wiring merges a consistent usage + context + model snapshot into every - * status event (mirrors kap-server's broadcaster bridge), including the - * secondary-model derived id resolution. + * status event (mirrors kap-server's broadcaster bridge). * Run: pnpm exec vitest run test/session-event-wiring.test.ts */ import { describe, expect, it } from 'vitest'; @@ -16,9 +15,7 @@ import { IAgentTokenCountingService, IAgentUsageService, IEventBus, - IModelCatalog, ISessionInteractionService, - SECONDARY_DERIVED_MODEL_ID, type IAgentScopeHandle, type ISessionScopeHandle, } from '@moonshot-ai/agent-core-v2'; @@ -147,40 +144,6 @@ describe('SessionEventWiring status snapshot fold', () => { expect(events[1]).not.toHaveProperty('model'); }); - it('resolves the secondary derived model id to a display string', () => { - const sub = new FakeAgentHandle('agent-1'); - bindStatusServices(sub, SECONDARY_DERIVED_MODEL_ID); - const { sink, events } = collectingSink(); - const wiring = new SessionEventWiring(makeSession([sub]), sink); - try { - sub.set(IModelCatalog, { - get: (id: string) => { - expect(id).toBe(SECONDARY_DERIVED_MODEL_ID); - return { id, name: 'kimi-k2-wire', displayName: 'Kimi K2' }; - }, - }); - sub.bus.emit({ type: 'agent.status.updated', usage: USAGE }); - // Without a displayName the pointed entry's wire name is shown. - sub.set(IModelCatalog, { get: (id: string) => ({ id, name: 'kimi-k2-wire' }) }); - sub.bus.emit({ type: 'agent.status.updated', usage: USAGE }); - // A resolution failure falls back to the raw alias. - sub.set(IModelCatalog, { - get: () => { - throw new Error('unknown model'); - }, - }); - sub.bus.emit({ type: 'agent.status.updated', usage: USAGE }); - } finally { - wiring.dispose(); - } - - expect(events.map((event) => (event as { model?: string }).model)).toEqual([ - 'Kimi K2', - 'kimi-k2-wire', - SECONDARY_DERIVED_MODEL_ID, - ]); - }); - it('passes status events through unchanged when the agent services are incomplete', () => { const sub = new FakeAgentHandle('agent-1'); // No profile/usage/context/wire services bound — nothing to fold in. diff --git a/packages/node-sdk/test/v1-v2-parity.test.ts b/packages/node-sdk/test/v1-v2-parity.test.ts index 24735ac17eb..0c915fa7e2f 100644 --- a/packages/node-sdk/test/v1-v2-parity.test.ts +++ b/packages/node-sdk/test/v1-v2-parity.test.ts @@ -515,7 +515,7 @@ async function closeAll(...harnesses: readonly KimiHarness[]): Promise { * and skew the comparison; the original values are restored on cleanup. */ const CONFIG_ENV_PATTERN = - /^(KIMI_MODEL_|KIMI_LOOP_|KIMI_MCP_|KIMI_WEB_|KIMI_SECONDARY_|KIMI_IMAGE_|KIMI_CODE_BACKGROUND_|KIMI_CODE_MODEL_CATALOG_)/; + /^(KIMI_MODEL_|KIMI_LOOP_|KIMI_MCP_|KIMI_WEB_|KIMI_IMAGE_|KIMI_CODE_BACKGROUND_|KIMI_CODE_MODEL_CATALOG_)/; function scrubConfigEnv(): () => void { const saved: Record = {}; @@ -633,35 +633,6 @@ api_key = "fixture-api-key" enabled = "not-a-boolean" `; -/** - * Secondary-model parity fixture: one resolvable model and the experiment - * enabled, no `[secondary_model]` recipe — the apply cases persist the recipe - * through `setConfig` mid-test. - */ -const SECONDARY_MODEL_CONFIG_TOML = ` -default_provider = "fixture-provider" -default_model = "fixture-model" - -[providers.fixture-provider] -type = "kimi" -api_key = "fixture-api-key" -base_url = "https://example.com/v1" - -[models.fixture-model] -provider = "fixture-provider" -model = "kimi-for-coding" -max_context_size = 262144 - -[experimental] -secondary-model = true -`; - -/** Same fixture with a dangling `[secondary_model]` pointer baked in. */ -const SECONDARY_MODEL_BROKEN_CONFIG_TOML = `${SECONDARY_MODEL_CONFIG_TOML} -[secondary_model] -model = "missing-model" -`; - function expectConfigParity(v1Config: KimiConfig, v2Config: KimiConfig): void { const project = KNOWN_DIFFS.getConfig; expect(normalize(project(v2Config), '')).toEqual(normalize(project(v1Config), '')); @@ -2710,96 +2681,6 @@ describe('v1↔v2 agent interaction parity', () => { restoreEnv(); } }); - - it('applyPersistedSecondaryModel validates, applies, and refreshes warnings identically', async () => { - const restoreEnv = scrubConfigEnv(); - const pair = await makeSessionParityPair(SECONDARY_MODEL_CONFIG_TOML); - try { - await createOnBoth(pair, { id: 'session_parity_secondary_apply' }); - const input = { sessionId: 'session_parity_secondary_apply' } as const; - const applyError = (client: SDKRpcClient | SDKRpcClientV2) => - client.applyPersistedSecondaryModel(input).then( - () => undefined, - (error: unknown) => error as Error, - ); - - // No recipe persisted yet: both reject with v1's persist-first error. - const [v1NoRecipe, v2NoRecipe] = await Promise.all([ - applyError(pair.v1), - applyError(pair.v2), - ]); - expect(v1NoRecipe).toMatchObject({ code: ErrorCodes.CONFIG_INVALID }); - expect(v2NoRecipe).toMatchObject({ code: ErrorCodes.CONFIG_INVALID }); - expect(v2NoRecipe?.message).toBe(v1NoRecipe?.message); - - // A dangling recipe: both reject, pointing at [secondary_model]. - await Promise.all([ - pair.v1.setConfig({ secondaryModel: { model: 'missing-model' } }), - pair.v2.setConfig({ secondaryModel: { model: 'missing-model' } }), - ]); - const [v1Broken, v2Broken] = await Promise.all([ - applyError(pair.v1), - applyError(pair.v2), - ]); - expect(v1Broken).toMatchObject({ code: ErrorCodes.CONFIG_INVALID }); - expect(v2Broken).toMatchObject({ code: ErrorCodes.CONFIG_INVALID }); - expect(v1Broken?.message).toContain('[secondary_model].model'); - expect(v2Broken?.message).toContain('[secondary_model].model'); - - // A valid recipe: both apply cleanly. The warnings pull converges on - // empty — v1's snapshot never held the broken recipe (its apply - // validates before mutating), v2's live-config warning cache is - // refreshed by the successful apply. - await Promise.all([ - pair.v1.setConfig({ secondaryModel: { model: 'fixture-model' } }), - pair.v2.setConfig({ secondaryModel: { model: 'fixture-model' } }), - ]); - await Promise.all([ - pair.v1.applyPersistedSecondaryModel(input), - pair.v2.applyPersistedSecondaryModel(input), - ]); - const [v1Warnings, v2Warnings] = await Promise.all([ - pair.v1.getSessionWarnings(input), - pair.v2.getSessionWarnings(input), - ]); - expect(v2Warnings).toEqual(v1Warnings); - expect(v1Warnings).toEqual([]); - - await expect( - pair.v1.applyPersistedSecondaryModel({ sessionId: 'session_missing' }), - ).rejects.toMatchObject({ code: ErrorCodes.SESSION_NOT_FOUND }); - await expect( - pair.v2.applyPersistedSecondaryModel({ sessionId: 'session_missing' }), - ).rejects.toMatchObject({ code: ErrorCodes.SESSION_NOT_FOUND }); - } finally { - await closeSessionPair(pair); - restoreEnv(); - } - }); - - it('getSessionWarnings flags a creation-time broken secondary recipe on both engines', async () => { - const restoreEnv = scrubConfigEnv(); - const pair = await makeSessionParityPair(SECONDARY_MODEL_BROKEN_CONFIG_TOML); - try { - await createOnBoth(pair, { id: 'session_parity_secondary_broken' }); - const input = { sessionId: 'session_parity_secondary_broken' } as const; - const [v1Warnings, v2Warnings] = await Promise.all([ - pair.v1.getSessionWarnings(input), - pair.v2.getSessionWarnings(input), - ]); - // The message wording is engine-specific; the code + severity are the - // shared contract. - const codes = (warnings: readonly { code: string; severity: string }[]) => - warnings.map(({ code, severity }) => ({ code, severity })); - expect(codes(v2Warnings)).toEqual(codes(v1Warnings)); - expect(codes(v1Warnings)).toEqual([ - { code: 'secondary-model-invalid', severity: 'warning' }, - ]); - } finally { - await closeSessionPair(pair); - restoreEnv(); - } - }); }); // --------------------------------------------------------------------------- From 6e31722df127703ddbcfa6b9109894d7ed156b34 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 12:57:22 +0800 Subject: [PATCH 33/50] chore: drop deprecations for unreleased [subagent] pool keys (#2877) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The [subagent] default_model / models deprecations added in #2700 guard a migration path that has no users: the pool keys only existed in #2700's own intermediate commits and never shipped in any release, so no config written against a released version can contain them. Remove the two deprecation entries (the mechanism stays — the released loop_control renames still use it), the migration notes in the en/zh config docs, the agent-core-dev skill note, and the obsolete test; regenerate the config manifest. No changeset: #2700 is still unreleased, so no published version ever emitted these warnings — the removal is invisible to users. --- .agents/skills/agent-core-dev/config.md | 2 +- docs/en/configuration/config-files.md | 4 --- docs/zh/configuration/config-files.md | 4 --- .../agent-core-v2/docs/config-manifest.toml | 3 --- .../src/session/subagent/configSection.ts | 8 +----- .../test/app/config/config.test.ts | 25 ------------------- 6 files changed, 2 insertions(+), 44 deletions(-) diff --git a/.agents/skills/agent-core-dev/config.md b/.agents/skills/agent-core-dev/config.md index d7d6b12fcef..c84111259f1 100644 --- a/.agents/skills/agent-core-dev/config.md +++ b/.agents/skills/agent-core-dev/config.md @@ -101,7 +101,7 @@ pass `ConfigTarget.Memory` for a per-run override that is never written to disk. - `src/kosong/model/thinking.ts` (owner domain, not `config`) — the `resolveThinkingEffort` helper and the authoritative `ThinkingConfig` type (the `thinking` section itself registers from `src/app/kosongConfig/configSection.ts`). - `src/app/config/configPure.ts` — `isPlainObject`, `deepMerge`, `omitUndefined`, `describeUnknownError`. -A domain that owns a section keeps the schema in its own `configSection.ts` (e.g. `src/app/flag/flag.ts` for `experimental`, `src/agent/loop/configSection.ts` for `loopControl`). Exception: kosong-owned sections (`providers`, `models`, `thinking`) — kosong is a pure, persistence-free abstraction layer that defines only the types (`src/kosong/{provider,model}`); the section constants, the zod schemas (re-derived from those types and compile-time pinned via `AssertExact, Type>>`, see `_base/utils/typeEquality.ts`), the registrations, env bindings, and TOML transforms all live in the persistence wrapper `src/app/kosongConfig/configSection.ts`. (`modelCatalog` has no kosong-side type at all — its section is fully self-contained in `app/kosongConfig`, types derived from the schema.) A cross-section env overlay (e.g. the `KIMI_MODEL_*` synthesis in `src/app/kosongConfig/envOverlay.ts`) lives in the wrapper too and is registered via module-level `registerConfigOverlay`. The session subagent domain owns two sections in `src/session/subagent/configSection.ts`: `[subagent]` (`timeout_ms` on disk) and `[secondary_model]` (`default_model` plus the `[secondary_model.models]` pool, with a lone legacy v1 `model` key honored as a fallback default below `default_model`), with the legacy `[subagent]` pool keys declared as deprecations; neither carries a cross-section overlay. Cross-field pool validation (default present / in-pool / every key resolvable) runs at session creation in `subagentModelsValidationService.ts`, not in the schema. The two-way sync between config sections and kosong's in-memory registries is owned by `IKosongConfigService` (`src/app/kosongConfig/kosongConfigService.ts`). +A domain that owns a section keeps the schema in its own `configSection.ts` (e.g. `src/app/flag/flag.ts` for `experimental`, `src/agent/loop/configSection.ts` for `loopControl`). Exception: kosong-owned sections (`providers`, `models`, `thinking`) — kosong is a pure, persistence-free abstraction layer that defines only the types (`src/kosong/{provider,model}`); the section constants, the zod schemas (re-derived from those types and compile-time pinned via `AssertExact, Type>>`, see `_base/utils/typeEquality.ts`), the registrations, env bindings, and TOML transforms all live in the persistence wrapper `src/app/kosongConfig/configSection.ts`. (`modelCatalog` has no kosong-side type at all — its section is fully self-contained in `app/kosongConfig`, types derived from the schema.) A cross-section env overlay (e.g. the `KIMI_MODEL_*` synthesis in `src/app/kosongConfig/envOverlay.ts`) lives in the wrapper too and is registered via module-level `registerConfigOverlay`. The session subagent domain owns two sections in `src/session/subagent/configSection.ts`: `[subagent]` (`timeout_ms` on disk) and `[secondary_model]` (`default_model` plus the `[secondary_model.models]` pool, with a lone legacy v1 `model` key honored as a fallback default below `default_model`); neither carries a cross-section overlay. Cross-field pool validation (default present / in-pool / every key resolvable) runs at session creation in `subagentModelsValidationService.ts`, not in the schema. The two-way sync between config sections and kosong's in-memory registries is owned by `IKosongConfigService` (`src/app/kosongConfig/kosongConfigService.ts`). ## Scope diff --git a/docs/en/configuration/config-files.md b/docs/en/configuration/config-files.md index cf62875b13c..af7834b6a2d 100644 --- a/docs/en/configuration/config-files.md +++ b/docs/en/configuration/config-files.md @@ -264,8 +264,6 @@ Note that `default_effort` stays a model-level default: once a global `[thinking Configuration errors fail loudly instead of falling back silently: session creation, resume, and fork all fail at startup when `default_model` is missing, is not a pool key, or a pool key does not resolve to a configured `[models]` entry — and likewise when `force` is set without `default_model` or combined with a `[secondary_model.models]` table. The alias `primary` is reserved — it always binds the caller's own model — and is rejected as a pool key. A spawn whose `model` is neither a pool alias nor `"primary"` fails with an error listing the available choices. -The pool keys used to live under `[subagent]`; a leftover `[subagent] default_model` or `[subagent.models]` table no longer applies and is reported as a deprecation warning — move them into `[secondary_model]` as shown above. - When only the recipe `model` key is set — no `default_model`, no `[secondary_model.models]` table — the v2 engine reads it compatibly as the pool default: an implicit single-entry pool ranked below `default_model`, so a recipe setup keeps working unchanged. The compatibility only takes the model alias, though: the recipe patch fields (`default_effort`, `max_output_size`, …) do not carry over — write those settings onto the `[models]` entry the alias points to, for example via [`[models."".overrides]`](#model-overrides). Once a `[secondary_model.models]` table is configured, `default_model` stays required and `model` does not substitute for it. To migrate explicitly, point the pool default at the same alias: @@ -383,8 +381,6 @@ In print mode (`kimi -p ""`), Kimi Code stays alive after the main agent `timeout_ms` can be overridden by the `KIMI_SUBAGENT_TIMEOUT_MS` environment variable, which takes higher priority than `config.toml`. -The model pool that used to be configured here (`default_model`, `[subagent.models]`) moved to the [subagent model pool](#subagent-model-pool) under `[secondary_model]`; the old keys no longer apply and are reported as deprecation warnings. - ## `mcp` | Field | Type | Default | Description | diff --git a/docs/zh/configuration/config-files.md b/docs/zh/configuration/config-files.md index cad6859698e..c51a56d7e5f 100644 --- a/docs/zh/configuration/config-files.md +++ b/docs/zh/configuration/config-files.md @@ -263,8 +263,6 @@ kimi-for-coding-highspeed-deep = "同一模型的高 Thinking 档位。适合较 配置错误一律直接报错,不做静默回退:`default_model` 缺失、不是池中 key,或池中 key 无法解析到已配置的 `[models]` 条目时,会话的创建、恢复(resume)与 fork 都会在启动时直接失败;`force` 未搭配 `default_model` 或与 `[secondary_model.models]` 表同用时亦然。别名 `primary` 是保留字——它始终绑定调用方自己的模型——不能作为池中 key。工具调用传入的 `model` 既不是池中别名也不是 `"primary"` 时,本次派生报错并列出可选值。 -模型池键之前位于 `[subagent]` 下;遗留的 `[subagent] default_model` 或 `[subagent.models]` 表不再生效,并会以弃用警告的形式报告——按上文示例移入 `[secondary_model]` 即可。 - 只写了配方键 `model`(没有 `default_model`,也没有 `[secondary_model.models]` 表)时,v2 引擎会兼容读取它,把该别名当作池的默认模型——等价于只含它一个条目的隐式模型池,优先级低于 `default_model`,所以从配方迁移过来不改配置也能工作。注意兼容只取模型别名:补丁字段(`default_effort`、`max_output_size` 等)不会随之生效——请把这些设置写到别名指向的 `[models]` 条目上,例如通过 [`[models."".overrides]`](#模型覆盖项)。一旦配置了 `[secondary_model.models]` 表,`default_model` 依旧必填,`model` 不能顶替。 要显式迁移,把模型别名改为池的默认模型即可: @@ -382,8 +380,6 @@ max_output_size = 8192 `timeout_ms` 可被环境变量 `KIMI_SUBAGENT_TIMEOUT_MS` 覆盖,优先级高于配置文件。 -之前在此配置的模型池(`default_model`、`[subagent.models]`)已移至 `[secondary_model]` 下的[子 Agent 模型池](#子-agent-模型池);旧键不再生效,并会以弃用警告的形式报告。 - ## `mcp` | 字段 | 类型 | 默认值 | 说明 | diff --git a/packages/agent-core-v2/docs/config-manifest.toml b/packages/agent-core-v2/docs/config-manifest.toml index 463356d4020..99b6a14c4be 100644 --- a/packages/agent-core-v2/docs/config-manifest.toml +++ b/packages/agent-core-v2/docs/config-manifest.toml @@ -374,9 +374,6 @@ merge_all_available_skills = true # owner: src/session/subagent/configSection.ts # scope: core # hooks: stripEnv -# deprecations (old key is ignored + warns; rename manually): -# default_model -> secondary_model.default_model -# models -> secondary_model.models # env: # timeout_ms <- KIMI_SUBAGENT_TIMEOUT_MS (custom parse) # ########################################################################## diff --git a/packages/agent-core-v2/src/session/subagent/configSection.ts b/packages/agent-core-v2/src/session/subagent/configSection.ts index 5140f679393..c84b012b341 100644 --- a/packages/agent-core-v2/src/session/subagent/configSection.ts +++ b/packages/agent-core-v2/src/session/subagent/configSection.ts @@ -9,9 +9,7 @@ * var is set, `stripEnvBoundFields` restores the env-free raw value before * persistence, so the override never leaks into `config.toml`. Per-run * timeouts resolve through `resolveSubagentTimeoutMs`, and the timeout - * message renders with `formatSubagentTimeoutDescription`. The pool keys - * `default_model` / `models` are declared as deprecations on this section: - * they moved to `[secondary_model]` and their values here no longer apply. + * message renders with `formatSubagentTimeoutDescription`. * * - `[secondary_model]` — the subagent model pool: `default_model` names the * fallback model and the `[secondary_model.models]` table maps alias → @@ -165,10 +163,6 @@ registerConfigSection(SUBAGENT_SECTION, SubagentConfigSchema, { defaultValue: { timeoutMs: DEFAULT_SUBAGENT_TIMEOUT_MS }, env: subagentEnvBindings, stripEnv: stripSubagentEnv, - deprecations: [ - { key: 'default_model', replacement: 'secondary_model.default_model' }, - { key: 'models', replacement: 'secondary_model.models' }, - ], }); registerConfigSection(SECONDARY_MODEL_SECTION, SecondaryModelConfigSchema); diff --git a/packages/agent-core-v2/test/app/config/config.test.ts b/packages/agent-core-v2/test/app/config/config.test.ts index aa00d63d958..521da8377c6 100644 --- a/packages/agent-core-v2/test/app/config/config.test.ts +++ b/packages/agent-core-v2/test/app/config/config.test.ts @@ -1208,31 +1208,6 @@ describe('config deprecations', () => { disposables.dispose(); }); - it('warns and ignores the legacy [subagent] pool keys, which moved to [secondary_model]', async () => { - const { config, disposables } = await createConfig( - {}, - '[subagent]\ndefault_model = "provider/fast"\n\n[subagent.models]\n"provider/fast" = "fast and cheap"\n', - ); - - // The old values no longer apply — the pool only resolves from - // [secondary_model] now. - expect(resolveSubagentModelPool(config)).toBeUndefined(); - expect(config.diagnostics()).toContainEqual({ - domain: SUBAGENT_SECTION, - severity: 'warning', - message: - "[subagent] 'default_model' is deprecated and no longer used; rename it to 'secondary_model.default_model'. Run /update-config to fix it.", - }); - expect(config.diagnostics()).toContainEqual({ - domain: SUBAGENT_SECTION, - severity: 'warning', - message: - "[subagent] 'models' is deprecated and no longer used; rename it to 'secondary_model.models'. Run /update-config to fix it.", - }); - - disposables.dispose(); - }); - it('lets the replacement key win when both are present, still warning', async () => { const { config, disposables } = await createConfig( {}, From 314b39489e99cdde5f65ae97da39d40133af147a Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 13:35:49 +0800 Subject: [PATCH 34/50] refactor(agent-core-v2): extract swarm into a scope-organized feature (#2874) * refactor(agent-core-v2): extract swarm into a scope-organized feature - move src/agent/swarm, src/session/swarm, and src/agent/tools/agent-swarm into src/features/swarm/{agent,session,tools/agent-swarm}; swarmOps.ts stays a static import=register wire channel at the feature root - add SwarmFeature carrying the three runtime registrations (IAgentSwarmService, ISessionSwarmService, IAgentSwarmTool) with ScopeActivation.OnScopeCreated preserved - switch src/index.ts to precise leaf exports and update import sites, including the kap-server and kimi-inspect deep-path imports - move tests to test/features/swarm and re-assert service overrides in the test harness so stubs keep winning over feature contributions * fix(agent-core-v2): keep feature-contributed tools in Agent tool descriptions SubagentTool.knownToolReferences() now reads the full AgentToolContribution collection (static registrations and feature contributions alike) instead of the static contribution table. A caller profile that does not activate a feature-contributed tool (e.g. AgentSwarm) no longer drops it from the per-profile tool listings the description advertises for spawned profiles when a workspace/session restriction forces explicit enumeration. Add a regression test with a caller profile lacking AgentSwarm under a global tool restriction. * refactor(kap-server): lift session profile updates to the route edge - add sessionProfile.ts/sessionAgentConfig.ts route helpers that resume the session and dispatch title/metadata and the agent_config patch to the native v2 services directly - drop updateProfile from ISessionLegacyService, leaving only the status rollup and the goal read in the legacy adapter - wire shape and client-visible behavior unchanged --- apps/kimi-inspect/src/panels.ts | 2 +- packages/agent-core-v2/AGENTS.md | 2 +- .../agent-core-v2/docs/wire-manifest.d.ts | 8 +- .../src/agent/tools/agent/agentTool.ts | 13 ++- .../src/app/sessionLegacy/sessionLegacy.ts | 27 ++--- .../app/sessionLegacy/sessionLegacyService.ts | 110 ++---------------- .../swarm/agent}/enter-reminder.md | 0 .../swarm/agent}/exit-reminder.md | 0 .../swarm/agent}/injection/swarmInjection.ts | 0 .../swarm => features/swarm/agent}/swarm.ts | 0 .../swarm/agent}/swarmService.ts | 16 +-- .../swarm/session}/agentRunBatch.ts | 0 .../swarm/session}/sessionSwarm.ts | 0 .../swarm/session}/sessionSwarmService.ts | 13 +-- .../src/features/swarm/swarmFeature.ts | 44 +++++++ .../src/{agent => features}/swarm/swarmOps.ts | 2 +- .../swarm}/tools/agent-swarm/agent-swarm.md | 0 .../swarm}/tools/agent-swarm/agent-swarm.ts | 7 +- .../tools/agent-swarm/agentSwarmTool.ts | 16 +-- packages/agent-core-v2/src/index.ts | 13 ++- .../test/agent/goal/goal.test.ts | 2 +- .../goal/injection/goalInjection.test.ts | 2 +- .../agent-core-v2/test/agent/goal/stubs.ts | 2 +- .../test/agent/goal/tools/goal-tools.test.ts | 2 +- .../toolActivationService.test.ts | 3 +- .../app/sessionLegacy/sessionLegacy.test.ts | 49 +------- .../swarm/sessionSwarm.test.ts | 6 +- .../{agent => features}/swarm/swarm.test.ts | 20 ++-- packages/agent-core-v2/test/harness/agent.ts | 47 +++++++- packages/agent-core-v2/test/tool/tool.test.ts | 38 +++++- .../kap-server/src/protocol/events-zod.ts | 2 +- .../src/routes/sessionAgentConfig.ts | 84 +++++++++++++ .../kap-server/src/routes/sessionProfile.ts | 58 +++++++++ packages/kap-server/src/routes/sessions.ts | 24 ++-- .../src/services/transcript/coreEventMap.ts | 2 +- 35 files changed, 362 insertions(+), 252 deletions(-) rename packages/agent-core-v2/src/{agent/swarm => features/swarm/agent}/enter-reminder.md (100%) rename packages/agent-core-v2/src/{agent/swarm => features/swarm/agent}/exit-reminder.md (100%) rename packages/agent-core-v2/src/{agent/swarm => features/swarm/agent}/injection/swarmInjection.ts (100%) rename packages/agent-core-v2/src/{agent/swarm => features/swarm/agent}/swarm.ts (100%) rename packages/agent-core-v2/src/{agent/swarm => features/swarm/agent}/swarmService.ts (91%) rename packages/agent-core-v2/src/{session/swarm => features/swarm/session}/agentRunBatch.ts (100%) rename packages/agent-core-v2/src/{session/swarm => features/swarm/session}/sessionSwarm.ts (100%) rename packages/agent-core-v2/src/{session/swarm => features/swarm/session}/sessionSwarmService.ts (97%) create mode 100644 packages/agent-core-v2/src/features/swarm/swarmFeature.ts rename packages/agent-core-v2/src/{agent => features}/swarm/swarmOps.ts (95%) rename packages/agent-core-v2/src/{agent => features/swarm}/tools/agent-swarm/agent-swarm.md (100%) rename packages/agent-core-v2/src/{agent => features/swarm}/tools/agent-swarm/agent-swarm.ts (91%) rename packages/agent-core-v2/src/{agent => features/swarm}/tools/agent-swarm/agentSwarmTool.ts (95%) rename packages/agent-core-v2/test/{session => features}/swarm/sessionSwarm.test.ts (99%) rename packages/agent-core-v2/test/{agent => features}/swarm/swarm.test.ts (98%) create mode 100644 packages/kap-server/src/routes/sessionAgentConfig.ts create mode 100644 packages/kap-server/src/routes/sessionProfile.ts diff --git a/apps/kimi-inspect/src/panels.ts b/apps/kimi-inspect/src/panels.ts index ae42e1afa0f..55564701282 100644 --- a/apps/kimi-inspect/src/panels.ts +++ b/apps/kimi-inspect/src/panels.ts @@ -23,7 +23,7 @@ import { IAgentPermissionModeService } from '@moonshot-ai/agent-core-v2/agent/pe import { IAgentPermissionRulesService } from '@moonshot-ai/agent-core-v2/agent/permissionRules/permissionRules'; import { IAgentPlanService } from '@moonshot-ai/agent-core-v2/features/plan/plan'; import { IAgentProfileService } from '@moonshot-ai/agent-core-v2/agent/profile/profile'; -import { IAgentSwarmService } from '@moonshot-ai/agent-core-v2/agent/swarm/swarm'; +import { IAgentSwarmService } from '@moonshot-ai/agent-core-v2/features/swarm/agent/swarm'; import { IAgentTaskService } from '@moonshot-ai/agent-core-v2/agent/task/task'; import { IAgentTokenCountingService } from '@moonshot-ai/agent-core-v2/agent/tokenCounting/tokenCounting'; import { IAgentToolRegistryService } from '@moonshot-ai/agent-core-v2/agent/toolRegistry/toolRegistry'; diff --git a/packages/agent-core-v2/AGENTS.md b/packages/agent-core-v2/AGENTS.md index 98734917942..8d370cde789 100644 --- a/packages/agent-core-v2/AGENTS.md +++ b/packages/agent-core-v2/AGENTS.md @@ -19,7 +19,7 @@ The DI kernel (`src/_base/di/`) owns the unit layer on top of the scoped registr The four contribution seams (token → fold): config sections — `ConfigSectionContribution` → `ConfigRegistry` fold (`src/app/config/`; module-level `registerConfigSection` stays the static built-in channel drained at construction, a withdrawn runtime record unregisters the section while user TOML values survive); agent tools — `AgentToolContribution` → `AgentToolActivationService` fold (built-in records provided once at App scope by `builtinToolAssemblyService`; `registerAgentToolService` stays the static channel: Agent-scope DI `OnDemand` registration + module table); agent profiles — `AgentProfileContribution` → `IAgentProfileRegistry` fold (see Scopes); wire vocabulary — `WireModelContribution` → `WireService` fold (a record bundles `models` / `ops` / `crossReducers` / `checkpointedModels`; the built-in layer is the module tables drained at fold time — `defineOp` / `defineModel` / `defineCheckpointedModel` stay the static channel — and replaying a withdrawn domain's history lands on the unknown-op skip-and-count path). A fifth seam: executable commands — `CommandContribution` → `IAgentCommandService` fold (`src/agent/command/`; a contributed command runs engine-side — `run(ctx)` gets `ctx.get` resolving through the agent container, valid only during the synchronous part of `run`; name-level dedup, last record wins; surfaced over RPC as `agentCommandService.list` / `run`). -`src/features/` — built-in capabilities authored as self-contained Feature units (`plan` is the first, extracted from `agent/plan` + `agent/tools/plan`). A `Feature` (`src/features/feature.ts`) is an App-scope unit recipe with a `static override readonly name` and `contribute*` helpers composing the seams: `contributeService(scope, id, ctor)` / `contributeAgentService` (per-scope materialization via `ScopeUnits` — provider death retracts everywhere, 连坐), `contributeTool` (per-agent `OnDemand` registration + the `AgentToolContribution` record), `contributeProfiles`, `contributeConfig`, `contributeCommand`, plus `onDispose`. Feature modules self-register at import (`registerFeature`, `src/features/featureRegistry.ts`); the App-scope `IFeatureAssemblyService` drains the table through `IFeatureManager.provideUnit`, so every feature is a named, introspectable, retractable managed unit. Built-in features keep user-facing static contracts — config sections, agent profiles, wire vocabulary — on the static import=register channels (the config/state manifest generators read static tables / call sites; wire records must stay replayable); the Feature unit carries the runtime capabilities (services, tools, commands). The string form of the unit `on(...)` capability (`this.on('turn.ended', …)`) is backed by the production `FiberEventResolver` registered in `src/app/event/fiberEventResolver.ts`, resolving against the scope's `IEventBus`. +`src/features/` — built-in capabilities authored as self-contained Feature units (`plan` was the first, extracted from `agent/plan` + `agent/tools/plan`; `swarm` followed, extracted from `agent/swarm` + `session/swarm` + `agent/tools/agent-swarm` into a scope-organized `agent/` + `session/` + `tools/` layout). A `Feature` (`src/features/feature.ts`) is an App-scope unit recipe with a `static override readonly name` and `contribute*` helpers composing the seams: `contributeService(scope, id, ctor)` / `contributeAgentService` (per-scope materialization via `ScopeUnits` — provider death retracts everywhere, 连坐), `contributeTool` (per-agent `OnDemand` registration + the `AgentToolContribution` record), `contributeProfiles`, `contributeConfig`, `contributeCommand`, plus `onDispose`. Feature modules self-register at import (`registerFeature`, `src/features/featureRegistry.ts`); the App-scope `IFeatureAssemblyService` drains the table through `IFeatureManager.provideUnit`, so every feature is a named, introspectable, retractable managed unit. Built-in features keep user-facing static contracts — config sections, agent profiles, wire vocabulary — on the static import=register channels (the config/state manifest generators read static tables / call sites; wire records must stay replayable); the Feature unit carries the runtime capabilities (services, tools, commands). The string form of the unit `on(...)` capability (`this.on('turn.ended', …)`) is backed by the production `FiberEventResolver` registered in `src/app/event/fiberEventResolver.ts`, resolving against the scope's `IEventBus`. ## Ledger and cascade (L0/L2) diff --git a/packages/agent-core-v2/docs/wire-manifest.d.ts b/packages/agent-core-v2/docs/wire-manifest.d.ts index 1b3a0fed0a1..f01b5a55d58 100644 --- a/packages/agent-core-v2/docs/wire-manifest.d.ts +++ b/packages/agent-core-v2/docs/wire-manifest.d.ts @@ -54,8 +54,8 @@ // plugin.session_start pluginSessionStartSnapshot persisted src/agent/plugin/agentPluginOps.ts // profile.bind profile persisted src/agent/profile/profileOps.ts // skill.activate skill transient src/agent/skill/skillOps.ts -// swarm_mode.enter swarm persisted src/agent/swarm/swarmOps.ts -// swarm_mode.exit swarm persisted src/agent/swarm/swarmOps.ts +// swarm_mode.enter swarm persisted src/features/swarm/swarmOps.ts +// swarm_mode.exit swarm persisted src/features/swarm/swarmOps.ts // task.started task persisted src/agent/task/taskOps.ts // task.terminated task persisted src/agent/task/taskOps.ts // token_counting.measured tokenCounting transient src/agent/tokenCounting/tokenCountingOps.ts @@ -502,7 +502,7 @@ interface SkillActivatePayload { /** * model: swarm · persisted · toEvent - * owner: src/agent/swarm/swarmOps.ts + * owner: src/features/swarm/swarmOps.ts */ interface SwarmModeEnterPayload { _name: 'swarm_mode.enter'; @@ -512,7 +512,7 @@ interface SwarmModeEnterPayload { /** * model: swarm · persisted · toEvent · cross-reducers: contextMemory - * owner: src/agent/swarm/swarmOps.ts + * owner: src/features/swarm/swarmOps.ts */ interface SwarmModeExitPayload { _name: 'swarm_mode.exit'; diff --git a/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts b/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts index 6abcde9f8ba..7401a36283d 100644 --- a/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts +++ b/packages/agent-core-v2/src/agent/tools/agent/agentTool.ts @@ -26,9 +26,10 @@ * Registered via the module-level `registerAgentToolService(ISubagentTool, * SubagentTool)` at the bottom of this file — the same "import = register" * pattern used by every agent tool. The per-profile tool listings in the - * description read the full contribution table (not the runtime registry, - * which only holds tools the caller's own Profile activated), plus any - * dynamically registered tools. The description's catalog profile list is + * description read the full `AgentToolContribution` collection — static + * registrations and feature-contributed tools alike — not the runtime + * registry, which only holds tools the caller's own Profile activated, + * plus any dynamically registered tools. The description's catalog profile list is * snapshotted once the session catalog has loaded and frozen for the agent's * lifetime: plugin install / enable / disable / remove re-contributes * profiles mid-session, and a live read would rewrite the tools payload of @@ -37,6 +38,7 @@ * Bound at Agent scope. */ +import { type CollectionView } from '#/_base/di/collection'; import type { IAgentScopeHandle } from '#/_base/di/scope'; import { isAbortError, @@ -67,7 +69,7 @@ import { type ToolExecution, } from '#/tool/toolContract'; import { - getAgentToolContributions, + AgentToolContribution, registerAgentToolService, } from '#/agent/toolRegistry/toolContribution'; import { IAgentToolRegistryService, type ToolReference } from '#/agent/toolRegistry/toolRegistry'; @@ -151,6 +153,7 @@ export class SubagentTool implements ISubagentTool { @IConfigService private readonly config: IConfigService, @IFlagService private readonly flags: IFlagService, @IModelCatalog private readonly modelCatalog: IModelCatalog, + @AgentToolContribution private readonly contributions: CollectionView, ) { this.callerAgentId = scopeContext.agentId; this.canRunInBackground = () => @@ -204,7 +207,7 @@ export class SubagentTool implements ISubagentTool { private knownToolReferences(): ToolReference[] { const refs = new Map(); - for (const contribution of getAgentToolContributions()) { + for (const contribution of this.contributions.items) { refs.set(contribution.options.name, { name: contribution.options.name, source: contribution.options.source ?? 'builtin', diff --git a/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacy.ts b/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacy.ts index ecf83bfe2e8..9b5644763df 100644 --- a/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacy.ts +++ b/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacy.ts @@ -1,23 +1,25 @@ /** - * `sessionLegacy` domain (L7 edge adapter) — v1-compatible session actions. + * `sessionLegacy` domain (L7 edge adapter) — v1-compatible session reads. * - * Implements `POST /sessions/{id}/profile` (`updateProfile` — title rename, - * metadata merge, and the cross-domain `agent_config` patch), - * `GET /sessions/{id}/status` (`status`), and `GET /sessions/{id}/goal` - * (`goal`). The thin pass-through actions (`fork` / `compact` / `abort` / - * `archive`), the `:undo` action, and the `/sessions/{id}/children` endpoints - * are deliberately NOT wrapped here because none of them carries v1-only - * projection worth centralizing; only `updateProfile`, `status`, and `goal` - * stay in this adapter (the `agent_config` patch, the best-effort status - * rollup, and the current-goal read). Bound at App scope — it is a stateless - * dispatcher that resolves the target session/agent per call. + * Implements `GET /sessions/{id}/status` (`status` — the best-effort status + * rollup) and `GET /sessions/{id}/goal` (`goal` — the current-goal read), the + * two endpoints that hold real cross-domain adaptation. Everything else is + * deliberately NOT wrapped here: the thin pass-through actions (`fork` / + * `compact` / `abort` / `archive`), the `:undo` action, the + * `/sessions/{id}/children` endpoints, and `POST /sessions/{id}/profile` + * (title/metadata patch and `agent_config` dispatch) are plain wire-to-native + * translations composed by the kap-server routes directly. `SessionWireFields` + * stays exported here as the profile route's projection shape, consumed by the + * kap-server helper (`routes/sessionProfile.ts`) via deep-path import. Bound + * at App scope — it is a stateless dispatcher that resolves the target + * session/agent per call. */ import type { GoalSnapshot } from '#/agent/goal/types'; import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; -import type { SessionStatusResponse, UpdateSessionProfileRequest } from './sessionProtocol'; +import type { SessionStatusResponse } from './sessionProtocol'; export interface SessionWireFields { readonly id: string; @@ -35,7 +37,6 @@ export interface SessionWireFields { export interface ISessionLegacyService { readonly _serviceBrand: undefined; - updateProfile(sessionId: string, body: UpdateSessionProfileRequest): Promise; status(sessionId: string): Promise; goal(sessionId: string): Promise; } diff --git a/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacyService.ts b/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacyService.ts index b4353decfa1..2f08f42bdc1 100644 --- a/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacyService.ts +++ b/packages/agent-core-v2/src/app/sessionLegacy/sessionLegacyService.ts @@ -3,14 +3,15 @@ * * Stateless App-scope dispatcher: each method resolves the target session (and * its main agent) per call, delegates to the native v2 services, and projects - * the result into the v1 wire shape. Only `updateProfile` (the cross-domain - * `agent_config` patch), `status` (the best-effort status rollup), and `goal` - * (the current-goal read) live here. No business logic is duplicated here. + * the result into the v1 wire shape. Only `status` (the best-effort status + * rollup) and `goal` (the current-goal read) live here — the profile route's + * title/metadata patch and `agent_config` dispatch are composed by kap-server. + * No business logic is duplicated here. */ import type { GoalSnapshot } from '#/agent/goal/types'; -import type { SessionStatusResponse, UpdateSessionProfileRequest } from './sessionProtocol'; +import type { SessionStatusResponse } from './sessionProtocol'; import { LifecycleScope } from '#/app/scopes'; import { type IAgentScopeHandle, @@ -25,10 +26,9 @@ import { import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting'; import { IAgentGoalService } from '#/agent/goal/goal'; import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; -import type { PermissionMode } from '#/agent/permissionPolicy/types'; import { IAgentPlanService } from '#/features/plan/plan'; import { IAgentProfileService } from '#/agent/profile/profile'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { getLiveSessionById, resumeSessionById, @@ -39,10 +39,8 @@ import { ErrorCodes, Error2 } from '#/errors'; import { ensureMainAgent } from '#/session/agentLifecycle/mainAgent'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import { IAgentActivityView } from '#/agent/activityView/activityView'; -import { ISessionContext } from '#/session/sessionContext/sessionContext'; -import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; -import { ISessionLegacyService, type SessionWireFields } from './sessionLegacy'; +import { ISessionLegacyService } from './sessionLegacy'; export class SessionLegacyService implements ISessionLegacyService { declare readonly _serviceBrand: undefined; @@ -59,100 +57,6 @@ export class SessionLegacyService implements ISessionLegacyService { return resumeSessionById(this.services, sessionId); } - async updateProfile( - sessionId: string, - body: UpdateSessionProfileRequest, - ): Promise { - const session = await this.resume(sessionId); - if (session === undefined) { - throw new Error2(ErrorCodes.SESSION_NOT_FOUND, `session ${sessionId} does not exist`); - } - const metadata = session.accessor.get(ISessionMetadata); - - if (typeof body.title === 'string') { - await metadata.setTitle(body.title); - } - - const metadataPatch = body.metadata; - if (metadataPatch !== undefined && Object.keys(metadataPatch).length > 0) { - await metadata.update({ custom: { ...(metadataPatch as Record) } }); - } - - const agentConfig = body.agent_config; - if (agentConfig !== undefined) { - const agent = await this.resolveMainAgent(sessionId); - await this.applyAgentConfig(agent, agentConfig); - } - - const meta = await metadata.read(); - const ctx = session.accessor.get(ISessionContext); - return { - id: meta.id, - workspaceId: ctx.workspaceId, - root: ctx.cwd, - title: meta.title, - lastPrompt: meta.lastPrompt, - createdAt: meta.createdAt, - updatedAt: meta.updatedAt, - archived: meta.archived, - archivedAt: meta.archivedAt, - custom: meta.custom, - }; - } - - - private async applyAgentConfig( - agent: IAgentScopeHandle, - agentConfig: NonNullable, - ): Promise { - const profile = agent.accessor.get(IAgentProfileService); - if (agentConfig.model !== undefined && agentConfig.model !== '') { - await profile.setModel(agentConfig.model); - } - if (agentConfig.thinking !== undefined) { - profile.setThinking(agentConfig.thinking); - } - if (agentConfig.permission_mode !== undefined) { - agent.accessor - .get(IAgentLifecycleService) - .broadcastPermissionMode(agentConfig.permission_mode as PermissionMode); - } - if (agentConfig.plan_mode !== undefined) { - const plan = agent.accessor.get(IAgentPlanService); - const active = (await plan.status()) !== null; - if (active !== agentConfig.plan_mode) { - if (agentConfig.plan_mode) await plan.enter(); - else plan.exit(); - } - } - if (agentConfig.swarm_mode !== undefined) { - const swarm = agent.accessor.get(IAgentSwarmService); - if (swarm.isActive !== agentConfig.swarm_mode) { - if (agentConfig.swarm_mode) swarm.enter('manual'); - else swarm.exit(); - } - } - if (agentConfig.goal_objective !== undefined) { - await agent.accessor - .get(IAgentGoalService) - .createGoal({ objective: agentConfig.goal_objective }); - } - if (agentConfig.goal_control !== undefined) { - const goal = agent.accessor.get(IAgentGoalService); - switch (agentConfig.goal_control) { - case 'pause': - await goal.pauseGoal({}); - break; - case 'resume': - await goal.resumeGoal({ continueIfPaused: true, continueIfBlocked: true }); - break; - case 'cancel': - await goal.cancelGoal({}); - break; - } - } - } - private async resolveMainAgent(sessionId: string): Promise { const session = await this.resume(sessionId); if (session === undefined) { diff --git a/packages/agent-core-v2/src/agent/swarm/enter-reminder.md b/packages/agent-core-v2/src/features/swarm/agent/enter-reminder.md similarity index 100% rename from packages/agent-core-v2/src/agent/swarm/enter-reminder.md rename to packages/agent-core-v2/src/features/swarm/agent/enter-reminder.md diff --git a/packages/agent-core-v2/src/agent/swarm/exit-reminder.md b/packages/agent-core-v2/src/features/swarm/agent/exit-reminder.md similarity index 100% rename from packages/agent-core-v2/src/agent/swarm/exit-reminder.md rename to packages/agent-core-v2/src/features/swarm/agent/exit-reminder.md diff --git a/packages/agent-core-v2/src/agent/swarm/injection/swarmInjection.ts b/packages/agent-core-v2/src/features/swarm/agent/injection/swarmInjection.ts similarity index 100% rename from packages/agent-core-v2/src/agent/swarm/injection/swarmInjection.ts rename to packages/agent-core-v2/src/features/swarm/agent/injection/swarmInjection.ts diff --git a/packages/agent-core-v2/src/agent/swarm/swarm.ts b/packages/agent-core-v2/src/features/swarm/agent/swarm.ts similarity index 100% rename from packages/agent-core-v2/src/agent/swarm/swarm.ts rename to packages/agent-core-v2/src/features/swarm/agent/swarm.ts diff --git a/packages/agent-core-v2/src/agent/swarm/swarmService.ts b/packages/agent-core-v2/src/features/swarm/agent/swarmService.ts similarity index 91% rename from packages/agent-core-v2/src/agent/swarm/swarmService.ts rename to packages/agent-core-v2/src/features/swarm/agent/swarmService.ts index b27cdfe1d84..d7e42c9391f 100644 --- a/packages/agent-core-v2/src/agent/swarm/swarmService.ts +++ b/packages/agent-core-v2/src/features/swarm/agent/swarmService.ts @@ -6,7 +6,9 @@ * derives `agent.status.updated` from the Ops' `toEvent`, announces the mode * through the `swarm_mode` context-injection provider (`SwarmInjection`), * mirrors replayable trailing-enter removal through `contextMemory`, and - * auto-exits on turn end via `turn`. Bound at Agent scope. The service also + * auto-exits on turn end via `turn`. Bound at Agent scope — contributed into + * every Agent scope by `SwarmFeature` (`features/swarm/swarmFeature`). The + * service also * guards AgentSwarm batch exclusivity through an `onBeforeExecuteTool` veto * listener: an AgentSwarm call must be the only tool call in its batch; * anything else is vetoed with a `toolApproval.formatDenyMessage`-formatted @@ -15,8 +17,6 @@ import { Service } from '#/_base/di/service'; import { IInstantiationService } from '#/_base/di/instantiation'; -import { LifecycleScope } from '#/app/scopes'; -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; import { denyToolExecution } from '#/agent/toolExecutor/beforeToolExecuteEvent'; @@ -26,7 +26,7 @@ import { IWireService } from '#/wire/wire'; import { SwarmInjection } from './injection/swarmInjection'; import { IAgentSwarmService, type SwarmModeTrigger } from './swarm'; -import { swarmEnter, swarmExit, SwarmModel } from './swarmOps'; +import { swarmEnter, swarmExit, SwarmModel } from '../swarmOps'; export class AgentSwarmService extends Service implements IAgentSwarmService { declare readonly _serviceBrand: undefined; @@ -95,14 +95,6 @@ export class AgentSwarmService extends Service implements IAgentSwarmService { } } -registerScopedService( - LifecycleScope.Agent, - IAgentSwarmService, - AgentSwarmService, - ScopeActivation.OnScopeCreated, - 'swarm', -); - function multipleAgentSwarmDeniedMessage(hasOtherToolCalls: boolean): string { const suffix = hasOtherToolCalls ? ' AgentSwarm also must not be combined with other tools in the same response.' diff --git a/packages/agent-core-v2/src/session/swarm/agentRunBatch.ts b/packages/agent-core-v2/src/features/swarm/session/agentRunBatch.ts similarity index 100% rename from packages/agent-core-v2/src/session/swarm/agentRunBatch.ts rename to packages/agent-core-v2/src/features/swarm/session/agentRunBatch.ts diff --git a/packages/agent-core-v2/src/session/swarm/sessionSwarm.ts b/packages/agent-core-v2/src/features/swarm/session/sessionSwarm.ts similarity index 100% rename from packages/agent-core-v2/src/session/swarm/sessionSwarm.ts rename to packages/agent-core-v2/src/features/swarm/session/sessionSwarm.ts diff --git a/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts b/packages/agent-core-v2/src/features/swarm/session/sessionSwarmService.ts similarity index 97% rename from packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts rename to packages/agent-core-v2/src/features/swarm/session/sessionSwarmService.ts index 651bbb7c382..c4a682afda1 100644 --- a/packages/agent-core-v2/src/session/swarm/sessionSwarmService.ts +++ b/packages/agent-core-v2/src/features/swarm/session/sessionSwarmService.ts @@ -15,13 +15,12 @@ * bindings are resolved through the model catalog before lifecycle allocation. * Resumed agents keep the model recorded in their own wire journal — with * per-subagent models there is no "child follows the parent's current model" - * invariant to enforce. Bound at Session scope. + * invariant to enforce. Bound at Session scope — contributed into every + * Session scope by `SwarmFeature` (`features/swarm/swarmFeature`). */ import type { TokenUsage } from '#/kosong/contract/usage'; import { IModelCatalog } from '#/kosong/model/catalog'; -import { LifecycleScope } from '#/app/scopes'; -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { Error2, ErrorCodes } from '#/errors'; import { linkAbortSignal } from '#/_base/utils/abort'; import type { IAgentScopeHandle } from '#/_base/di/scope'; @@ -298,11 +297,3 @@ export class SessionSwarmService implements ISessionSwarmService { } export type _AgentRunUsage = TokenUsage; - -registerScopedService( - LifecycleScope.Session, - ISessionSwarmService, - SessionSwarmService, - ScopeActivation.OnScopeCreated, - 'sessionSwarm', -); diff --git a/packages/agent-core-v2/src/features/swarm/swarmFeature.ts b/packages/agent-core-v2/src/features/swarm/swarmFeature.ts new file mode 100644 index 00000000000..3d28b6dad79 --- /dev/null +++ b/packages/agent-core-v2/src/features/swarm/swarmFeature.ts @@ -0,0 +1,44 @@ +/** + * `swarm` domain — `SwarmFeature`: the agent-swarm capability assembled as + * one App-scope Feature unit. + * + * Contributes the per-Agent `IAgentSwarmService` (swarm mode), the + * per-Session `ISessionSwarmService` (batch scheduler), and the `AgentSwarm` + * agent tool through the `features` base-class seams; retracting the unit + * withdraws all of them across the scope tree. Both services keep + * `OnScopeCreated` activation — `AgentSwarmService` subscribes the + * `turn.ended` auto-exit and the AgentSwarm batch-exclusivity veto in its + * constructor. The `swarm` wire vocabulary (`features/swarm/swarmOps`) stays + * on its static import=register channel — wire records must remain + * replayable even when the feature unit is retracted. Registered into the + * feature table at import. + */ + +import { ScopeActivation } from '#/_base/di/instantiation'; +import { LifecycleScope } from '#/app/scopes'; +import { Feature } from '#/features/feature'; +import { registerFeature } from '#/features/featureRegistry'; + +import { IAgentSwarmService } from './agent/swarm'; +import { AgentSwarmService } from './agent/swarmService'; +import { ISessionSwarmService } from './session/sessionSwarm'; +import { SessionSwarmService } from './session/sessionSwarmService'; +import { IAgentSwarmTool } from './tools/agent-swarm/agent-swarm'; +import { AgentSwarmTool } from './tools/agent-swarm/agentSwarmTool'; + +export class SwarmFeature extends Feature { + static override readonly name = 'swarm'; + + constructor() { + super(); + this.contributeAgentService(IAgentSwarmService, AgentSwarmService, { + activation: ScopeActivation.OnScopeCreated, + }); + this.contributeService(LifecycleScope.Session, ISessionSwarmService, SessionSwarmService, { + activation: ScopeActivation.OnScopeCreated, + }); + this.contributeTool(IAgentSwarmTool, AgentSwarmTool, { name: 'AgentSwarm', domain: 'swarm' }); + } +} + +registerFeature(SwarmFeature); diff --git a/packages/agent-core-v2/src/agent/swarm/swarmOps.ts b/packages/agent-core-v2/src/features/swarm/swarmOps.ts similarity index 95% rename from packages/agent-core-v2/src/agent/swarm/swarmOps.ts rename to packages/agent-core-v2/src/features/swarm/swarmOps.ts index d222a575173..06ef2cec4ed 100644 --- a/packages/agent-core-v2/src/agent/swarm/swarmOps.ts +++ b/packages/agent-core-v2/src/features/swarm/swarmOps.ts @@ -13,7 +13,7 @@ import { z } from 'zod'; import { defineModel } from '#/wire/model'; -import type { SwarmModeTrigger } from './swarm'; +import type { SwarmModeTrigger } from './agent/swarm'; export const SwarmModel = defineModel('swarm', () => null); diff --git a/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.md b/packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agent-swarm.md similarity index 100% rename from packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.md rename to packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agent-swarm.md diff --git a/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts b/packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agent-swarm.ts similarity index 91% rename from packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts rename to packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agent-swarm.ts index b936fa3bd7a..8d8d9118519 100644 --- a/packages/agent-core-v2/src/agent/tools/agent-swarm/agent-swarm.ts +++ b/packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agent-swarm.ts @@ -1,12 +1,11 @@ /** - * `tools` domain — `IAgentSwarmTool` contract (the `AgentSwarm` tool). + * `swarm` domain — `IAgentSwarmTool` contract (the `AgentSwarm` tool). * * Public contract of the `AgentSwarm` collaboration tool: the input zod * schema the model-facing parameters are derived from, the tool-owned * constants the schema is built around (prompt template placeholder, maximum - * subagent count), and the `IAgentSwarmTool` DI decorator that the - * implementation registers against via `registerAgentToolService`. Bound at - * Agent scope. + * subagent count), and the `IAgentSwarmTool` DI decorator used to resolve the + * implementation through the container. Bound at Agent scope. */ import { z } from 'zod'; diff --git a/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts b/packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts similarity index 95% rename from packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts rename to packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts index a7999260e55..5c70dd474be 100644 --- a/packages/agent-core-v2/src/agent/tools/agent-swarm/agentSwarmTool.ts +++ b/packages/agent-core-v2/src/features/swarm/tools/agent-swarm/agentSwarmTool.ts @@ -1,5 +1,5 @@ /** - * `tools` domain — `AgentSwarmTool` implementation (the `AgentSwarm` + * `swarm` domain — `AgentSwarmTool` implementation (the `AgentSwarm` * tool). * * Launches a batch of child agents (an ordinary Agent scope each) through the @@ -18,11 +18,8 @@ * (or under `[secondary_model].force`) the parameter is not advertised at * all. Swarm mode is * entered through `IAgentSwarmService`; the caller's agent id comes from - * `IAgentScopeContext`. Pure tool — owns no scoped state. - * - * Registered via the module-level `registerAgentToolService(IAgentSwarmTool, - * AgentSwarmTool)` at the bottom of this file — the same "import = register" - * pattern used by every agent tool. Bound at Agent scope. + * `IAgentScopeContext`. Pure tool — owns no scoped state. Bound at Agent + * scope — contributed by `SwarmFeature` (`features/swarm/swarmFeature`). */ import { @@ -32,11 +29,10 @@ import { type ToolExecution, } from '#/tool/toolContract'; import { Error2, ErrorCodes } from '#/errors'; -import { registerAgentToolService } from '#/agent/toolRegistry/toolContribution'; import { toInputJsonSchema } from '#/tool/input-schema'; import { IConfigService } from '#/app/config/config'; import { IFlagService } from '#/app/flag/flag'; -import { ISessionSwarmService, type SessionSwarmTask } from '#/session/swarm/sessionSwarm'; +import { ISessionSwarmService, type SessionSwarmTask } from '#/features/swarm/session/sessionSwarm'; import { ISessionAgentProfileCatalog } from '#/session/sessionAgentProfileCatalog/sessionAgentProfileCatalog'; import { IAgentProfileService } from '#/agent/profile/profile'; import { @@ -44,7 +40,7 @@ import { subagentTypeNotAllowedMessage, } from '#/app/agentProfileCatalog/profile-shared'; import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { buildSubagentModelDescriptions, exposesSubagentModelChoice, @@ -235,8 +231,6 @@ export class AgentSwarmTool implements IAgentSwarmTool { } } -registerAgentToolService(IAgentSwarmTool, AgentSwarmTool, { name: 'AgentSwarm', domain: 'swarm' }); - async function createAgentSwarmSpecs( args: AgentSwarmToolInput, getResumeItem: (agentId: string) => Promise, diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 8c2399d9211..33e343ba406 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -299,6 +299,13 @@ import '#/features/plan/planFeature'; export * from '#/features/debugEvents/debugEvents'; export * from '#/features/debugEvents/debugEventsService'; import '#/features/debugEvents/debugEventsFeature'; +export * from '#/features/swarm/agent/swarm'; +export * from '#/features/swarm/agent/swarmService'; +export * from '#/features/swarm/session/sessionSwarm'; +export * from '#/features/swarm/session/sessionSwarmService'; +export * from '#/features/swarm/tools/agent-swarm/agent-swarm'; +import '#/features/swarm/tools/agent-swarm/agentSwarmTool'; +import '#/features/swarm/swarmFeature'; export * from '#/agent/tools/goal/create-goal/create-goal'; import '#/agent/tools/goal/create-goal/createGoalTool'; export * from '#/agent/tools/goal/get-goal/get-goal'; @@ -312,10 +319,6 @@ import '#/agent/goal/goalDeadlineSchedulerService'; export * from '#/agent/goal/goal'; export * from '#/agent/goal/goalService'; export * from '#/agent/goal/types'; -export * from '#/agent/tools/agent-swarm/agent-swarm'; -import '#/agent/tools/agent-swarm/agentSwarmTool'; -export * from '#/agent/swarm/swarm'; -export * from '#/agent/swarm/swarmService'; export * from '#/agent/usage/usage'; export * from '#/agent/usage/usageService'; export * from '#/agent/toolDedupe/toolDedupe'; @@ -635,8 +638,6 @@ export * from '#/agent/stepRetry/stepRetryService'; export * from '#/session/sessionInit/sessionInit'; export * from '#/session/sessionInit/sessionInitService'; export * from '#/session/sessionInit/profile/init'; -export * from '#/session/swarm/sessionSwarm'; -export * from '#/session/swarm/sessionSwarmService'; export * from '#/session/todo/todoItem'; export * from '#/session/todo/todoListReminder'; export * from '#/session/todo/sessionTodo'; diff --git a/packages/agent-core-v2/test/agent/goal/goal.test.ts b/packages/agent-core-v2/test/agent/goal/goal.test.ts index 722284b2431..b7ca8d0ec53 100644 --- a/packages/agent-core-v2/test/agent/goal/goal.test.ts +++ b/packages/agent-core-v2/test/agent/goal/goal.test.ts @@ -27,7 +27,7 @@ import { } from '#/agent/loop/loop'; import { MessageStepRequest } from '#/agent/loop/stepRequest'; import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; import type { PermissionMode, PermissionPolicyResult } from '#/agent/permissionPolicy/types'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; diff --git a/packages/agent-core-v2/test/agent/goal/injection/goalInjection.test.ts b/packages/agent-core-v2/test/agent/goal/injection/goalInjection.test.ts index 068d38727f5..f88ad343f80 100644 --- a/packages/agent-core-v2/test/agent/goal/injection/goalInjection.test.ts +++ b/packages/agent-core-v2/test/agent/goal/injection/goalInjection.test.ts @@ -6,7 +6,7 @@ import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory' import { IAgentGoalService } from '#/agent/goal/goal'; import { type AgentGoalService } from '#/agent/goal/goalService'; import { IAgentProfileService } from '#/agent/profile/profile'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { InMemoryWireRecordPersistence, agentService, diff --git a/packages/agent-core-v2/test/agent/goal/stubs.ts b/packages/agent-core-v2/test/agent/goal/stubs.ts index 4dd1e67808b..b4f463805fd 100644 --- a/packages/agent-core-v2/test/agent/goal/stubs.ts +++ b/packages/agent-core-v2/test/agent/goal/stubs.ts @@ -2,7 +2,7 @@ * Shared stubs for goal tests. */ -import type { IAgentSwarmService } from '#/agent/swarm/swarm'; +import type { IAgentSwarmService } from '#/features/swarm/agent/swarm'; export function stubAgentSwarm(): IAgentSwarmService { return { diff --git a/packages/agent-core-v2/test/agent/goal/tools/goal-tools.test.ts b/packages/agent-core-v2/test/agent/goal/tools/goal-tools.test.ts index 07f36943f62..d25250996ba 100644 --- a/packages/agent-core-v2/test/agent/goal/tools/goal-tools.test.ts +++ b/packages/agent-core-v2/test/agent/goal/tools/goal-tools.test.ts @@ -21,7 +21,7 @@ import { UpdateGoalToolInputSchema } from '#/agent/tools/goal/update-goal/update import { UpdateGoalTool } from '#/agent/tools/goal/update-goal/updateGoalTool'; import { IAgentLoopService } from '#/agent/loop/loop'; import { IAgentScopeContext } from '#/agent/scopeContext/scopeContext'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { IAgentToolExecutorService, type ToolExecutionResult, diff --git a/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts b/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts index 932b978ab97..d410dcb7310 100644 --- a/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts +++ b/packages/agent-core-v2/test/agent/toolActivation/toolActivationService.test.ts @@ -33,7 +33,6 @@ import { IAgentToolRegistryService } from '#/agent/toolRegistry/toolRegistry'; import { AgentToolRegistryService } from '#/agent/toolRegistry/toolRegistryService'; import { ISessionToolPolicyGate } from '#/session/sessionToolPolicyGate/sessionToolPolicyGate'; import type { AgentTool, ToolExecution } from '#/tool/toolContract'; -import '#/agent/tools/agent-swarm/agentSwarmTool'; import '#/agent/tools/agent/agentTool'; import '#/agent/tools/ask-user-question/askUserQuestionTool'; import '#/agent/tools/edit/editTool'; @@ -412,7 +411,7 @@ describe('AgentToolActivationService', () => { }); it('feeds every built-in contribution through the App-scope assembly unchanged', async () => { - expect(savedContributions).toHaveLength(21); + expect(savedContributions).toHaveLength(20); for (const contribution of savedContributions) { registerAgentToolService(contribution.id, contribution.ctor, contribution.options); } diff --git a/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts b/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts index 50760791448..3dc96892a94 100644 --- a/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts +++ b/packages/agent-core-v2/test/app/sessionLegacy/sessionLegacy.test.ts @@ -7,7 +7,7 @@ * current model catalog. */ -import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; import { SyncDescriptor } from '#/_base/di/descriptors'; import type { ServiceIdentifier, ServicesAccessor } from '#/_base/di/instantiation'; @@ -19,7 +19,7 @@ import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting' import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; import { IAgentPlanService } from '#/features/plan/plan'; import { IAgentProfileService } from '#/agent/profile/profile'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; import { UNKNOWN_CAPABILITY } from '#/kosong/contract/capability'; import { IModelCatalog } from '#/kosong/model/catalog'; import { IModelService } from '#/kosong/model/model'; @@ -30,9 +30,7 @@ import { IWorkspaceLifecycleService } from '#/app/workspaceLifecycle/workspaceLi import { ISessionLifecycleService } from '#/workspace/sessionLifecycle/sessionLifecycle'; import { IAgentActivityView } from '#/agent/activityView/activityView'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; -import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { ISessionCronService } from '#/session/cron/sessionCronService'; -import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; function accessor( entries: ReadonlyArray, unknown]>, @@ -365,47 +363,4 @@ describe('Session legacy status (best-effort runtime state)', () => { context_usage: 1, }); }); - - it('fans a permission_mode patch out through the session agent registry', async () => { - const broadcastPermissionMode = vi.fn(); - const agent: IAgentScopeHandle = { - id: 'main', - kind: LifecycleScope.Agent, - accessor: accessor([ - [IAgentProfileService, { _serviceBrand: undefined }], - [IAgentLifecycleService, { broadcastPermissionMode }], - ]), - dispose: () => {}, - }; - const agents = { - create: () => Promise.resolve(agent), - whenReady: () => Promise.resolve(agent), - list: () => [agent], - broadcastPermissionMode, - } as unknown as IAgentLifecycleService; - const session: ISessionScopeHandle = { - id: 'session-test', - kind: LifecycleScope.Session, - accessor: accessor([ - [IAgentLifecycleService, agents], - [ - ISessionMetadata, - { - read: () => - Promise.resolve({ id: 'session-test', createdAt: 0, updatedAt: 0, archived: false }), - }, - ], - [ISessionContext, { workspaceId: 'ws-test', cwd: '/workspace' }], - ]), - dispose: () => {}, - }; - stubSessionChain(ix, session); - ix.set(ISessionLegacyService, new SyncDescriptor(SessionLegacyService)); - - await ix.get(ISessionLegacyService).updateProfile('session-test', { - agent_config: { permission_mode: 'yolo' }, - }); - - expect(broadcastPermissionMode).toHaveBeenCalledWith('yolo'); - }); }); diff --git a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts b/packages/agent-core-v2/test/features/swarm/sessionSwarm.test.ts similarity index 99% rename from packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts rename to packages/agent-core-v2/test/features/swarm/sessionSwarm.test.ts index 1c60d858540..407f3203cf7 100644 --- a/packages/agent-core-v2/test/session/swarm/sessionSwarm.test.ts +++ b/packages/agent-core-v2/test/features/swarm/sessionSwarm.test.ts @@ -48,11 +48,11 @@ import { type AgentRunSuspendedEvent, type AgentSpawnAttemptOptions, type QueuedAgentRunTask, -} from '#/session/swarm/agentRunBatch'; -import { ISessionSwarmService, type SessionSwarmSpawnTask, type SessionSwarmTask } from '#/session/swarm/sessionSwarm'; +} from '#/features/swarm/session/agentRunBatch'; +import { ISessionSwarmService, type SessionSwarmSpawnTask, type SessionSwarmTask } from '#/features/swarm/session/sessionSwarm'; import { Error2 } from '#/_base/errors/errors'; import { ConfigErrors } from '#/app/config/errors'; -import { SessionSwarmService } from '#/session/swarm/sessionSwarmService'; +import { SessionSwarmService } from '#/features/swarm/session/sessionSwarmService'; import { stubLog } from '../../_base/log/stubs'; import { stubFlag } from '../../app/flag/stubs'; diff --git a/packages/agent-core-v2/test/agent/swarm/swarm.test.ts b/packages/agent-core-v2/test/features/swarm/swarm.test.ts similarity index 98% rename from packages/agent-core-v2/test/agent/swarm/swarm.test.ts rename to packages/agent-core-v2/test/features/swarm/swarm.test.ts index 6e9fb081140..a5274192ccd 100644 --- a/packages/agent-core-v2/test/agent/swarm/swarm.test.ts +++ b/packages/agent-core-v2/test/features/swarm/swarm.test.ts @@ -5,7 +5,7 @@ * Exercises the Agent-scoped service through DI and public loop boundaries, * with storage, session swarm execution, and approvals stubbed. Run: * `pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run - * test/agent/swarm/swarm.test.ts`. + * test/features/swarm/swarm.test.ts`. */ import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'; @@ -24,7 +24,7 @@ import { AgentContextMemoryService } from '#/agent/contextMemory/contextMemorySe import type { ContextMessage } from '#/agent/contextMemory/types'; import { DEFAULT_SUBAGENT_TIMEOUT_MS } from '#/session/subagent/configSection'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; -import { ISessionSwarmService, type SessionSwarmRunResult, type SessionSwarmTask } from '#/session/swarm/sessionSwarm'; +import { ISessionSwarmService, type SessionSwarmRunResult, type SessionSwarmTask } from '#/features/swarm/session/sessionSwarm'; import { IAgentStateService } from '#/agent/state/agentState'; import { AgentStateService } from '#/agent/state/agentStateService'; import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting'; @@ -33,12 +33,12 @@ import { wrapSystemReminder, } from '#/agent/systemReminder/systemReminder'; import { AgentSystemReminderService } from '#/agent/systemReminder/systemReminderService'; -import { IAgentSwarmService } from '#/agent/swarm/swarm'; -import { AgentSwarmService } from '#/agent/swarm/swarmService'; -import SWARM_MODE_ENTER_REMINDER from '../../../src/agent/swarm/enter-reminder.md?raw'; -import { SwarmModel } from '#/agent/swarm/swarmOps'; -import { AgentSwarmToolInputSchema } from '#/agent/tools/agent-swarm/agent-swarm'; -import { AgentSwarmTool } from '#/agent/tools/agent-swarm/agentSwarmTool'; +import { IAgentSwarmService } from '#/features/swarm/agent/swarm'; +import { AgentSwarmService } from '#/features/swarm/agent/swarmService'; +import SWARM_MODE_ENTER_REMINDER from '../../../src/features/swarm/agent/enter-reminder.md?raw'; +import { SwarmModel } from '#/features/swarm/swarmOps'; +import { AgentSwarmToolInputSchema } from '#/features/swarm/tools/agent-swarm/agent-swarm'; +import { AgentSwarmTool } from '#/features/swarm/tools/agent-swarm/agentSwarmTool'; import { IAgentToolApprovalService } from '#/agent/toolApproval/toolApproval'; import { IAgentToolExecutorService } from '#/agent/toolExecutor/toolExecutor'; import type { @@ -65,8 +65,8 @@ import { EventBusService } from '#/app/event/eventBusService'; import { executeTool } from '../../tools/fixtures/execute-tool'; import { registerTestAgentWire, restoreTestAgentWire, testWireScope } from '../../wire/stubs'; -import { stubLoopWithHooks } from '../loop/stubs'; -import { stubToolExecutorEvents, type ToolExecutorEventStubs } from '../toolExecutor/stubs'; +import { stubLoopWithHooks } from '../../agent/loop/stubs'; +import { stubToolExecutorEvents, type ToolExecutorEventStubs } from '../../agent/toolExecutor/stubs'; import { createTestAgent } from '../../harness'; const signal = new AbortController().signal; diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index 03edcf84d1e..4de0ba782eb 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -6,7 +6,9 @@ import { createControlledPromise } from '@antfu/utils'; import { expect, vi } from 'vitest'; import { toDisposable } from '#/_base/di/lifecycle'; +import type { IInstantiationService } from '#/_base/di/instantiation'; import type { IAgentScopeHandle } from '#/_base/di/scope'; +import { getContributedServices } from '#/features/featureRegistry'; import { Emitter, Event } from '#/_base/event'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import type { Promisable, PromisifyMethods } from '#/_base/utils/types'; @@ -52,7 +54,7 @@ import { IAgentConversationUndoService } from '#/agent/undo/undo'; import { IAgentLoopService } from '#/agent/loop/loop'; import type { RunShellCommandInput, RunShellCommandResult } from '#/agent/shellCommand/shellCommand'; import type { ProfileSetModelResult } from '#/agent/profile/profile'; -import type { SwarmModeTrigger } from '#/agent/swarm/swarm'; +import type { SwarmModeTrigger } from '#/features/swarm/agent/swarm'; import type { UserToolRegistration } from '#/agent/userTool/userTool'; import type { ActivatePluginCommandPayload } from '#/agent/pluginCommand/pluginCommand'; import { IAgentPluginCommandService } from '#/agent/pluginCommand/pluginCommand'; @@ -207,7 +209,7 @@ import { import type { IProcess } from '#/session/process/processRunner'; import { ISessionQuestionService, type QuestionResult } from '#/session/question/question'; import { ISessionSkillCatalog } from '#/session/sessionSkillCatalog/skillCatalog'; -import { ISessionSwarmService } from '#/session/swarm/sessionSwarm'; +import { ISessionSwarmService } from '#/features/swarm/session/sessionSwarm'; import type { PathAccessOperation } from '#/session/workspaceContext/workspaceContext'; import { stubAgentIdentity } from '../app/agentIdentity/stubs'; @@ -897,6 +899,45 @@ function collectScopeSeed( return seed; } +// Feature contributions (`ScopeUnits` fold) provide into a scope through the +// cascade and would replace a same-token seed instance installed at creation; +// re-asserting overrides of feature-contributed tokens through the live +// container right after scope creation keeps test stubs winning, as they did +// over static registrations (which `provideScopeServices` skips when seeded). +function reassertServiceOverrides( + overrides: readonly TestAgentScopedServiceOverride[], + scope: TestAgentServiceScope, + instantiation: IInstantiationService, +): void { + const contributed = new Set( + getContributedServices() + .filter((entry) => entry.scope === scope) + .map((entry) => entry.id), + ); + if (contributed.size === 0) { + return; + } + const reg: TestAgentServiceRegistration = { + define: (id, ctor) => { + if (contributed.has(id)) instantiation.provide(id, new SyncDescriptor(ctor)); + }, + defineDescriptor: (id, descriptor) => { + if (contributed.has(id)) instantiation.provide(id, descriptor); + }, + defineInstance: (id, instance) => { + if (contributed.has(id)) instantiation.provide(id, instance); + }, + definePartialInstance: (id, instance) => { + if (contributed.has(id)) instantiation.provide(id, instance as never); + }, + }; + for (const override of overrides) { + if (override.scope === scope) { + override.register(reg); + } + } +} + class PersistenceAppendLogStore implements IAppendLogStore { declare readonly _serviceBrand: undefined; private readonly history: WireRecord[] = []; @@ -1236,6 +1277,7 @@ export class AgentTestContext { 'session', ), }); + reassertServiceOverrides(this.serviceOverrides, 'session', this.session.instantiation); const workspace = this.session.accessor.get(ISessionWorkspaceContext); this.agent = this.session.createChild(LifecycleScope.Agent, agentId, { @@ -1289,6 +1331,7 @@ export class AgentTestContext { 'agent', ), }); + reassertServiceOverrides(this.serviceOverrides, 'agent', this.agent.instantiation); this.initializeRestorableServices(); this.get(IAgentActivityView); diff --git a/packages/agent-core-v2/test/tool/tool.test.ts b/packages/agent-core-v2/test/tool/tool.test.ts index 930b13e96a7..8424196090f 100644 --- a/packages/agent-core-v2/test/tool/tool.test.ts +++ b/packages/agent-core-v2/test/tool/tool.test.ts @@ -19,7 +19,7 @@ import { IAgentTaskService } from '#/agent/task/task'; import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; import { IAgentTokenCountingService } from '#/agent/tokenCounting/tokenCounting'; import { makeHookRunner } from '../agent/externalHooks/runner-stub'; -import { IAgentProfileService } from '#/agent/profile/profile'; +import { IAgentProfileService, type ProfileData } from '#/agent/profile/profile'; import { IAgentPermissionModeService } from '#/agent/permissionMode/permissionMode'; import { ToolAccesses, type ExecutableTool } from '#/tool/toolContract'; import { IAgentToolRegistryService } from '#/agent/toolRegistry/toolRegistry'; @@ -28,7 +28,7 @@ import { IAgentUserToolService, type UserToolRegistration } from '#/agent/userTo import { AgentSwarmToolInputSchema, type AgentSwarmToolInput, -} from '#/agent/tools/agent-swarm/agent-swarm'; +} from '#/features/swarm/tools/agent-swarm/agent-swarm'; import { SubagentToolInputSchema, type SubagentToolInput, @@ -58,13 +58,14 @@ import type { ISessionSwarmService, SessionSwarmRunArgs, SessionSwarmRunResult, -} from '#/session/swarm/sessionSwarm'; +} from '#/features/swarm/session/sessionSwarm'; import type { IProcess, ISessionProcessRunner } from '#/session/process/processRunner'; import { IWireService } from '#/wire/wire'; import { createFakeProcessRunner } from '../tools/fixtures/fake-exec'; import { StubConfigService } from '../kosong/stubs'; import { stubFlag } from '../app/flag/stubs'; import { + agentService, appService, configServices, createCommandRunner, @@ -552,6 +553,37 @@ describe('Agent tool description', () => { expect(coderTools).not.toContain('Bash'); }); + it('lists contributed tools the caller profile does not activate', () => { + // The caller binds a profile without AgentSwarm, so the runtime registry + // never holds it; a global restriction forces the explicit enumeration + // branch. The listing must still draw from the full contribution + // collection — spawned `agent` profiles can use AgentSwarm. + const callerData = { + profileName: 'orchestrator', + activeToolNames: ['Agent', 'Bash', 'Read'], + disallowedTools: [], + } as unknown as ProfileData; + ctx = createTestAgent( + { autoConfigure: false }, + agentService(IAgentProfileService, { + _serviceBrand: undefined, + data: () => callerData, + onDidChange: Event.None, + } as unknown as IAgentProfileService), + configServices(() => ({ + providers: {}, + tools: { disabled: ['Write'] }, + })), + ); + + const description = agentDescription(); + const agentTools = description.match(/- agent: [^\n]*\n Tools: ([^\n]*)/)?.[1]; + + expect(agentTools).toBeDefined(); + expect(agentTools).toContain('AgentSwarm'); + expect(agentTools).not.toContain('Write'); + }); + it('renders effective tools after applying disallowedTools', () => { const restricted: AgentProfile = normalizeAgentProfile({ name: 'restricted', diff --git a/packages/kap-server/src/protocol/events-zod.ts b/packages/kap-server/src/protocol/events-zod.ts index 5080dff69bd..35ddf7efeff 100644 --- a/packages/kap-server/src/protocol/events-zod.ts +++ b/packages/kap-server/src/protocol/events-zod.ts @@ -85,7 +85,7 @@ import type { SubagentSpawnedEvent, SubagentStartedEvent, } from '@moonshot-ai/agent-core-v2/session/subagent/mirrorAgentRun'; -import type { SubagentSuspendedEvent } from '@moonshot-ai/agent-core-v2/session/swarm/sessionSwarmService'; +import type { SubagentSuspendedEvent } from '@moonshot-ai/agent-core-v2/features/swarm/session/sessionSwarmService'; import type { ToolUpdate } from '@moonshot-ai/agent-core-v2/tool/toolContract'; import { ToolInputDisplaySchema } from './display'; diff --git a/packages/kap-server/src/routes/sessionAgentConfig.ts b/packages/kap-server/src/routes/sessionAgentConfig.ts new file mode 100644 index 00000000000..5129bf7f987 --- /dev/null +++ b/packages/kap-server/src/routes/sessionAgentConfig.ts @@ -0,0 +1,84 @@ +/** + * `agent_config` patch dispatch for `POST /sessions/{session_id}/profile`. + * + * The `agent_config` body field is a wire-to-native translation, not a v1-only + * projection, so it lives at the server edge alongside the other routes that + * call the native v2 services directly (`fork` / `compact` / `undo` / `abort`) + * instead of inside `ISessionLegacyService`. The helper resumes the session + * (cold-load if needed), resolves its main agent, and fans each present field + * out to the owning Agent-scope service, preserving the per-field + * apply-only-when-set semantics and the plan/swarm idempotency guards. + */ + +import { + ErrorCodes, + Error2, + IAgentGoalService, + IAgentLifecycleService, + IAgentPlanService, + IAgentProfileService, + IAgentSwarmService, + resumeSessionById, + type PermissionMode, + type Scope, +} from '@moonshot-ai/agent-core-v2'; +import type { SessionAgentConfigPartial } from '@moonshot-ai/agent-core-v2/app/sessionLegacy/sessionProtocol'; + +import { ensureMainAgent } from '../transport/mainAgent'; + +export async function applySessionAgentConfig( + core: Scope, + sessionId: string, + agentConfig: SessionAgentConfigPartial, +): Promise { + const session = await resumeSessionById(core.accessor, sessionId); + if (session === undefined) { + throw new Error2(ErrorCodes.SESSION_NOT_FOUND, `session ${sessionId} does not exist`); + } + const agent = await ensureMainAgent(session); + + const profile = agent.accessor.get(IAgentProfileService); + if (agentConfig.model !== undefined && agentConfig.model !== '') { + await profile.setModel(agentConfig.model); + } + if (agentConfig.thinking !== undefined) { + profile.setThinking(agentConfig.thinking); + } + if (agentConfig.permission_mode !== undefined) { + agent.accessor + .get(IAgentLifecycleService) + .broadcastPermissionMode(agentConfig.permission_mode as PermissionMode); + } + if (agentConfig.plan_mode !== undefined) { + const plan = agent.accessor.get(IAgentPlanService); + const active = (await plan.status()) !== null; + if (active !== agentConfig.plan_mode) { + if (agentConfig.plan_mode) await plan.enter(); + else plan.exit(); + } + } + if (agentConfig.swarm_mode !== undefined) { + const swarm = agent.accessor.get(IAgentSwarmService); + if (swarm.isActive !== agentConfig.swarm_mode) { + if (agentConfig.swarm_mode) swarm.enter('manual'); + else swarm.exit(); + } + } + if (agentConfig.goal_objective !== undefined) { + await agent.accessor.get(IAgentGoalService).createGoal({ objective: agentConfig.goal_objective }); + } + if (agentConfig.goal_control !== undefined) { + const goal = agent.accessor.get(IAgentGoalService); + switch (agentConfig.goal_control) { + case 'pause': + await goal.pauseGoal({}); + break; + case 'resume': + await goal.resumeGoal({ continueIfPaused: true, continueIfBlocked: true }); + break; + case 'cancel': + await goal.cancelGoal({}); + break; + } + } +} diff --git a/packages/kap-server/src/routes/sessionProfile.ts b/packages/kap-server/src/routes/sessionProfile.ts new file mode 100644 index 00000000000..1fbc144a83e --- /dev/null +++ b/packages/kap-server/src/routes/sessionProfile.ts @@ -0,0 +1,58 @@ +/** + * title/metadata patch for `POST /sessions/{session_id}/profile`. + * + * Like the `agent_config` dispatch (`sessionAgentConfig.ts`), the + * title/metadata update is a wire-to-native translation with no v1-only + * projection, so it lives at the server edge instead of inside + * `ISessionLegacyService`. The helper resumes the session (cold-load if + * needed), applies the patch through `ISessionMetadata`, and reads the + * metadata document back together with `ISessionContext` to assemble the + * `SessionWireFields` shape the route feeds to `toWireSession`. + */ + +import { + ErrorCodes, + Error2, + ISessionContext, + ISessionMetadata, + resumeSessionById, + type Scope, +} from '@moonshot-ai/agent-core-v2'; +import type { SessionWireFields } from '@moonshot-ai/agent-core-v2/app/sessionLegacy/sessionLegacy'; +import type { UpdateSessionProfileRequest } from '@moonshot-ai/agent-core-v2/app/sessionLegacy/sessionProtocol'; + +export async function updateSessionProfile( + core: Scope, + sessionId: string, + body: Pick, +): Promise { + const session = await resumeSessionById(core.accessor, sessionId); + if (session === undefined) { + throw new Error2(ErrorCodes.SESSION_NOT_FOUND, `session ${sessionId} does not exist`); + } + const metadata = session.accessor.get(ISessionMetadata); + + if (typeof body.title === 'string') { + await metadata.setTitle(body.title); + } + + const metadataPatch = body.metadata; + if (metadataPatch !== undefined && Object.keys(metadataPatch).length > 0) { + await metadata.update({ custom: { ...(metadataPatch as Record) } }); + } + + const meta = await metadata.read(); + const ctx = session.accessor.get(ISessionContext); + return { + id: meta.id, + workspaceId: ctx.workspaceId, + root: ctx.cwd, + title: meta.title, + lastPrompt: meta.lastPrompt, + createdAt: meta.createdAt, + updatedAt: meta.updatedAt, + archived: meta.archived, + archivedAt: meta.archivedAt, + custom: meta.custom, + }; +} diff --git a/packages/kap-server/src/routes/sessions.ts b/packages/kap-server/src/routes/sessions.ts index c20f913d3bd..6611ee1d356 100644 --- a/packages/kap-server/src/routes/sessions.ts +++ b/packages/kap-server/src/routes/sessions.ts @@ -29,10 +29,12 @@ * `/sessions/{id}/children` endpoints call `ISessionLifecycleService.createChild` * and `ISessionIndex.list({ childOf })` directly — the child markers and * parent-title default live in the lifecycle, and the child filter lives in the - * index. Only `POST /sessions/{id}/profile` (`updateProfile`), - * `GET /sessions/{id}/status`, and `GET /sessions/{id}/goal` go through - * `ISessionLegacyService` (the `agent_config` patch, the status rollup, and the - * current-goal read hold real cross-domain adaptation); + * index. `POST /sessions/{id}/profile` is composed at the edge too: both the + * title/metadata patch (`sessionProfile.ts`) and the `agent_config` dispatch + * (`sessionAgentConfig.ts`) are wire-to-native translations over the native v2 + * services. Only `GET /sessions/{id}/status` and `GET /sessions/{id}/goal` go + * through `ISessionLegacyService` (the status rollup and the current-goal read + * hold real cross-domain adaptation); * the route forwards each adapter result verbatim, mirroring v1's thin handler. * `create`, `fork`, and child creation publish `event.session.created` on the * core event bus, matching v1. @@ -135,6 +137,8 @@ import { requestLog } from '../lib/requestLog'; import { defineRoute } from '../middleware/defineRoute'; import { ensureMainAgent } from '../transport/mainAgent'; import { parseActionSuffix } from './action-suffix'; +import { applySessionAgentConfig } from './sessionAgentConfig'; +import { updateSessionProfile } from './sessionProfile'; interface SessionRouteHost { post( @@ -611,9 +615,15 @@ export function registerSessionsRoutes(app: SessionRouteHost, core: Scope): void async (req, reply) => { try { const { session_id } = req.params; - const fields = await core.accessor - .get(ISessionLegacyService) - .updateProfile(session_id, req.body); + const { agent_config, ...profileBody } = req.body; + // Both halves of the profile patch are wire-to-native translations + // dispatched to the native v2 services at the edge (same direct-call + // pattern as fork/compact/undo); title/metadata applies first, + // matching the original in-adapter ordering. + const fields = await updateSessionProfile(core, session_id, profileBody); + if (agent_config !== undefined) { + await applySessionAgentConfig(core, session_id, agent_config); + } const session = toWireSession(fields, fields.root, resolveSessionFacts(core, fields.id)); // Broadcast the title change to every connection (including clients not // subscribed to this session, and covering inactive sessions), so session diff --git a/packages/kap-server/src/services/transcript/coreEventMap.ts b/packages/kap-server/src/services/transcript/coreEventMap.ts index 9da48be8945..e2c2ae71c90 100644 --- a/packages/kap-server/src/services/transcript/coreEventMap.ts +++ b/packages/kap-server/src/services/transcript/coreEventMap.ts @@ -58,7 +58,7 @@ * `DomainEventMap` augmentations in `packages/agent-core-v2/src`, e.g. * `agent/loop/loopService.ts`, `agent/toolExecutor/toolExecutorService.ts`, * `agent/task/taskOps.ts`, `agent/shellCommand/shellCommandService.ts`, - * `session/agentLifecycle/mirrorAgentRun.ts`, `session/swarm/sessionSwarmService.ts`, + * `session/agentLifecycle/mirrorAgentRun.ts`, `features/swarm/session/sessionSwarmService.ts`, * `agent/goal/goalOps.ts`, `agent/usage/usageOps.ts`, `agent/skill/skillOps.ts`, * `agent/pluginCommand/pluginCommandService.ts`, `session/cron/cronOps.ts`, * `agent/fullCompaction/compactionOps.ts`, `agent/mcp/mcpService.ts`, From b6144f94ea6b22455a4e750d1750d220987e7bc2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 13:47:30 +0800 Subject: [PATCH 35/50] ci: release packages (#2846) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- .changeset/cli-markdown-latex.md | 5 ---- .changeset/cli-retry-cancel.md | 5 ---- .changeset/cli-tui-mode-fullscreen.md | 5 ---- .changeset/fix-thinking-only-assistant-400.md | 5 ---- .changeset/pi-tui-alt-screen-groundwork.md | 5 ---- .changeset/pi-tui-upstream-rebaseline.md | 5 ---- .changeset/plugin-root-skill-only.md | 5 ---- .changeset/remove-secondary-model-sdk.md | 5 ---- .changeset/secure-workspace-trust-prompt.md | 8 ------- .changeset/session-meta-updated-at.md | 5 ---- .changeset/subagent-model-pool.md | 5 ---- .changeset/sync-mcp-oauth-credentials.md | 5 ---- apps/kimi-code/CHANGELOG.md | 24 +++++++++++++++++++ apps/kimi-code/package.json | 2 +- apps/vscode/CHANGELOG.md | 7 ++++++ apps/vscode/package.json | 2 +- packages/acp-adapter/CHANGELOG.md | 7 ++++++ packages/acp-adapter/package.json | 2 +- packages/agent-core-v2/CHANGELOG.md | 6 +++++ packages/agent-core-v2/package.json | 2 +- packages/node-sdk/CHANGELOG.md | 12 ++++++++++ packages/node-sdk/package.json | 2 +- packages/pi-tui/CHANGELOG.md | 8 +++++++ packages/pi-tui/package.json | 2 +- 24 files changed, 70 insertions(+), 69 deletions(-) delete mode 100644 .changeset/cli-markdown-latex.md delete mode 100644 .changeset/cli-retry-cancel.md delete mode 100644 .changeset/cli-tui-mode-fullscreen.md delete mode 100644 .changeset/fix-thinking-only-assistant-400.md delete mode 100644 .changeset/pi-tui-alt-screen-groundwork.md delete mode 100644 .changeset/pi-tui-upstream-rebaseline.md delete mode 100644 .changeset/plugin-root-skill-only.md delete mode 100644 .changeset/remove-secondary-model-sdk.md delete mode 100644 .changeset/secure-workspace-trust-prompt.md delete mode 100644 .changeset/session-meta-updated-at.md delete mode 100644 .changeset/subagent-model-pool.md delete mode 100644 .changeset/sync-mcp-oauth-credentials.md diff --git a/.changeset/cli-markdown-latex.md b/.changeset/cli-markdown-latex.md deleted file mode 100644 index 2344678c1f8..00000000000 --- a/.changeset/cli-markdown-latex.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch ---- - -Render LaTeX math formulas (`$…$` / `$$…$$`) in messages as Unicode formulas. diff --git a/.changeset/cli-retry-cancel.md b/.changeset/cli-retry-cancel.md deleted file mode 100644 index 33003307303..00000000000 --- a/.changeset/cli-retry-cancel.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch ---- - -Fix Ctrl+C being ignored during automatic retries of failed API requests. diff --git a/.changeset/cli-tui-mode-fullscreen.md b/.changeset/cli-tui-mode-fullscreen.md deleted file mode 100644 index 9520216d7c2..00000000000 --- a/.changeset/cli-tui-mode-fullscreen.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": minor ---- - -Add an experimental fullscreen TUI mode. Set the `KIMI_CODE_TUI_FULL_SCREEN=1` environment variable to enable it. diff --git a/.changeset/fix-thinking-only-assistant-400.md b/.changeset/fix-thinking-only-assistant-400.md deleted file mode 100644 index 0ea2a008f02..00000000000 --- a/.changeset/fix-thinking-only-assistant-400.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch ---- - -Fix sessions failing with a provider 400 error on every follow-up request after a turn is interrupted while the model is still thinking, on strict OpenAI-compatible providers. diff --git a/.changeset/pi-tui-alt-screen-groundwork.md b/.changeset/pi-tui-alt-screen-groundwork.md deleted file mode 100644 index 2a98bff37d1..00000000000 --- a/.changeset/pi-tui-alt-screen-groundwork.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/pi-tui": patch ---- - -Add fullscreen groundwork to the alternate-screen renderer: `ScrollView.canScroll`, `TuiAltScreen.getLayoutRoot()`, and viewport navigation keys (PageUp/PageDown/Home/End and friends) now fall through to the focused component when the primary scroll view has nothing to scroll. Terminal focus in/out reports are no longer consumed by the viewport input handler, so app-level listeners (focus-aware notifications, clipboard-image hints) keep working in fullscreen. diff --git a/.changeset/pi-tui-upstream-rebaseline.md b/.changeset/pi-tui-upstream-rebaseline.md deleted file mode 100644 index 9be1036307a..00000000000 --- a/.changeset/pi-tui-upstream-rebaseline.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/pi-tui": patch ---- - -Re-baseline the fork on upstream pi-tui v0.84.1 plus upstream main up to `40a3d85` (2026-08-11), which adds the fullscreen transcript search (`ctrl+shift+f`), single-line scroll actions, the ~9-18x alternate-screen render-churn reduction, and an SSH-aware escape-timeout default. The upstream renderer is now split into main-screen and alternate-screen implementations (the `TUI` class is now an interface implemented by `TuiMainScreen` and `TuiAltScreen`), and the Markdown component gained opt-out LaTeX math rendering. All local patches are retained: narrow-terminal hardening, processed-line render caching, editor history hooks, the paste-burst fallback, and multi-root `@` completion. `Editor.setText` accepts a `preservePasteRegistry` option so subclasses can replace text without orphaning live paste markers (upstream resets the registry on every `setText`). diff --git a/.changeset/plugin-root-skill-only.md b/.changeset/plugin-root-skill-only.md deleted file mode 100644 index 78cff47edbc..00000000000 --- a/.changeset/plugin-root-skill-only.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch ---- - -Fix plain Markdown files (such as CHANGELOG.md) in an installed plugin's root directory being misidentified as skills when the plugin relies on the root SKILL.md fallback. diff --git a/.changeset/remove-secondary-model-sdk.md b/.changeset/remove-secondary-model-sdk.md deleted file mode 100644 index 837e4b81132..00000000000 --- a/.changeset/remove-secondary-model-sdk.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code-sdk": minor ---- - -Remove the secondary-model session API `Session.applyPersistedSecondaryModel`; subagent model selection is configured via `[secondary_model]` in config.toml instead. The `SECONDARY_DERIVED_MODEL_ALIAS` export stays (the v1 engine still synthesizes the entry at runtime, so hosts keep filtering it out of model pickers), and the SDK now also exports `PRIMARY_SUBAGENT_MODEL_CHOICE`, the v2 subagent model pool's reserved `primary` key. diff --git a/.changeset/secure-workspace-trust-prompt.md b/.changeset/secure-workspace-trust-prompt.md deleted file mode 100644 index 77549f47537..00000000000 --- a/.changeset/secure-workspace-trust-prompt.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch -"@moonshot-ai/kimi-code-sdk": patch ---- - -Show project MCP launch targets in the workspace trust prompt, default to declining trust, and resolve fd and stty binaries to absolute paths so untrusted workspaces cannot plant bare-name executables before confirmation. - -`@moonshot-ai/kimi-code-sdk` contract change: `WorkspaceTrustInfo.gatedMcpServers` now carries structured `WorkspaceTrustMcpServerInfo` records (`name`, `transport`, and `command`/`args`/`cwd` or `url`) instead of plain strings, so SDK consumers rendering a trust prompt can show the full launch target. diff --git a/.changeset/session-meta-updated-at.md b/.changeset/session-meta-updated-at.md deleted file mode 100644 index 2b5303cdfb6..00000000000 --- a/.changeset/session-meta-updated-at.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/agent-core-v2": patch ---- - -Keep session updatedAt stable across metadata management writes: rename and archive/restore no longer bump it, fork inherits the source session's recency, and agent registration is non-touching; add SessionMeta.archivedAt (set on archive, cleared on restore) and surface it as archived_at through the session index and the v1/v2 session routes. diff --git a/.changeset/subagent-model-pool.md b/.changeset/subagent-model-pool.md deleted file mode 100644 index 9a59ab9d563..00000000000 --- a/.changeset/subagent-model-pool.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": minor ---- - -Add a configurable model pool for spawned subagents behind the `secondary-model` experiment (`KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master flag): with the experiment on, the `/secondary-model` command or the `[secondary_model]` section in config.toml sets a default model or a small named pool that the main agent picks from per spawn. A lone legacy `model` key in the same section keeps working as the fallback default. diff --git a/.changeset/sync-mcp-oauth-credentials.md b/.changeset/sync-mcp-oauth-credentials.md deleted file mode 100644 index 4a106bf31cc..00000000000 --- a/.changeset/sync-mcp-oauth-credentials.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@moonshot-ai/kimi-code": patch ---- - -Refresh active MCP connections after OAuth credentials are added or reset. diff --git a/apps/kimi-code/CHANGELOG.md b/apps/kimi-code/CHANGELOG.md index bbea67d7378..7b651b83268 100644 --- a/apps/kimi-code/CHANGELOG.md +++ b/apps/kimi-code/CHANGELOG.md @@ -1,5 +1,29 @@ # @moonshot-ai/kimi-code +## 0.36.0 + +### Minor Changes + +- [#2830](https://github.com/MoonshotAI/kimi-code/pull/2830) [`ec84a6f`](https://github.com/MoonshotAI/kimi-code/commit/ec84a6f9a3eb35e1118f8a327f7a11b3978a899c) Thanks [@liruifengv](https://github.com/liruifengv)! - Add an experimental fullscreen TUI mode. Set the `KIMI_CODE_TUI_FULL_SCREEN=1` environment variable to enable it. + +- [#2700](https://github.com/MoonshotAI/kimi-code/pull/2700) [`c9bfe8b`](https://github.com/MoonshotAI/kimi-code/commit/c9bfe8b2c8314ba4ef8806fb3b92ac654c1d1860) Thanks [@7Sageer](https://github.com/7Sageer)! - Add a configurable model pool for spawned subagents behind the `secondary-model` experiment (`KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master flag): with the experiment on, the `/secondary-model` command or the `[secondary_model]` section in config.toml sets a default model or a small named pool that the main agent picks from per spawn. A lone legacy `model` key in the same section keeps working as the fallback default. + +### Patch Changes + +- [#2830](https://github.com/MoonshotAI/kimi-code/pull/2830) [`ec84a6f`](https://github.com/MoonshotAI/kimi-code/commit/ec84a6f9a3eb35e1118f8a327f7a11b3978a899c) Thanks [@liruifengv](https://github.com/liruifengv)! - Render LaTeX math formulas (`$…$` / `$$…$$`) in messages as Unicode formulas. + +- [#2855](https://github.com/MoonshotAI/kimi-code/pull/2855) [`30f56a2`](https://github.com/MoonshotAI/kimi-code/commit/30f56a2d2da332cbf0c36a13cbe01aac5d319c7b) Thanks [@liruifengv](https://github.com/liruifengv)! - Fix Ctrl+C being ignored during automatic retries of failed API requests. + +- [#2819](https://github.com/MoonshotAI/kimi-code/pull/2819) [`fe3cdae`](https://github.com/MoonshotAI/kimi-code/commit/fe3cdae5f8ab40be71b65eff32319eb94a53c17d) Thanks [@7Sageer](https://github.com/7Sageer)! - Fix sessions failing with a provider 400 error on every follow-up request after a turn is interrupted while the model is still thinking, on strict OpenAI-compatible providers. + +- [#2847](https://github.com/MoonshotAI/kimi-code/pull/2847) [`3b0936d`](https://github.com/MoonshotAI/kimi-code/commit/3b0936d8e025c5a944759c40593d5f21bfb3e621) Thanks [@sailist](https://github.com/sailist)! - Fix plain Markdown files (such as CHANGELOG.md) in an installed plugin's root directory being misidentified as skills when the plugin relies on the root SKILL.md fallback. + +- [#2843](https://github.com/MoonshotAI/kimi-code/pull/2843) [`c212ae9`](https://github.com/MoonshotAI/kimi-code/commit/c212ae9715371c0d7939c15e664acbe0d7cf7fc3) Thanks [@sailist](https://github.com/sailist)! - Show project MCP launch targets in the workspace trust prompt, default to declining trust, and resolve fd and stty binaries to absolute paths so untrusted workspaces cannot plant bare-name executables before confirmation. + + `@moonshot-ai/kimi-code-sdk` contract change: `WorkspaceTrustInfo.gatedMcpServers` now carries structured `WorkspaceTrustMcpServerInfo` records (`name`, `transport`, and `command`/`args`/`cwd` or `url`) instead of plain strings, so SDK consumers rendering a trust prompt can show the full launch target. + +- [#2856](https://github.com/MoonshotAI/kimi-code/pull/2856) [`504e629`](https://github.com/MoonshotAI/kimi-code/commit/504e6292ede448367d1341751f9f98b24cc2994f) Thanks [@pvzheroes125](https://github.com/pvzheroes125)! - Refresh active MCP connections after OAuth credentials are added or reset. + ## 0.35.0 ### Minor Changes diff --git a/apps/kimi-code/package.json b/apps/kimi-code/package.json index 08df2c2f1c2..9293788f7e1 100644 --- a/apps/kimi-code/package.json +++ b/apps/kimi-code/package.json @@ -1,6 +1,6 @@ { "name": "@moonshot-ai/kimi-code", - "version": "0.35.0", + "version": "0.36.0", "description": "The Starting Point for Next-Gen Agents", "license": "MIT", "author": "Moonshot AI", diff --git a/apps/vscode/CHANGELOG.md b/apps/vscode/CHANGELOG.md index 13326d0d246..a2ff988f7a8 100644 --- a/apps/vscode/CHANGELOG.md +++ b/apps/vscode/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 0.6.9 + +### Patch Changes + +- Updated dependencies [[`c9bfe8b`](https://github.com/MoonshotAI/kimi-code/commit/c9bfe8b2c8314ba4ef8806fb3b92ac654c1d1860), [`c212ae9`](https://github.com/MoonshotAI/kimi-code/commit/c212ae9715371c0d7939c15e664acbe0d7cf7fc3)]: + - @moonshot-ai/kimi-code-sdk@0.17.0 + ## 0.6.8 ### Patch Changes diff --git a/apps/vscode/package.json b/apps/vscode/package.json index ee249a0b38f..a474840e0a6 100644 --- a/apps/vscode/package.json +++ b/apps/vscode/package.json @@ -3,7 +3,7 @@ "publisher": "moonshot-ai", "displayName": "Kimi Code", "description": "Official Kimi Code plugin for VS Code", - "version": "0.6.8", + "version": "0.6.9", "private": true, "license": "Apache-2.0", "type": "module", diff --git a/packages/acp-adapter/CHANGELOG.md b/packages/acp-adapter/CHANGELOG.md index 956468657b6..82b80da4b55 100644 --- a/packages/acp-adapter/CHANGELOG.md +++ b/packages/acp-adapter/CHANGELOG.md @@ -1,5 +1,12 @@ # @moonshot-ai/acp-adapter +## 0.3.8 + +### Patch Changes + +- Updated dependencies [[`c9bfe8b`](https://github.com/MoonshotAI/kimi-code/commit/c9bfe8b2c8314ba4ef8806fb3b92ac654c1d1860), [`c212ae9`](https://github.com/MoonshotAI/kimi-code/commit/c212ae9715371c0d7939c15e664acbe0d7cf7fc3)]: + - @moonshot-ai/kimi-code-sdk@0.17.0 + ## 0.3.7 ### Patch Changes diff --git a/packages/acp-adapter/package.json b/packages/acp-adapter/package.json index 8820447f31b..ae373c656b9 100644 --- a/packages/acp-adapter/package.json +++ b/packages/acp-adapter/package.json @@ -1,6 +1,6 @@ { "name": "@moonshot-ai/acp-adapter", - "version": "0.3.7", + "version": "0.3.8", "private": true, "description": "Agent Client Protocol adapter for kimi-code", "license": "MIT", diff --git a/packages/agent-core-v2/CHANGELOG.md b/packages/agent-core-v2/CHANGELOG.md index 94e48650da8..bb6734cb8ff 100644 --- a/packages/agent-core-v2/CHANGELOG.md +++ b/packages/agent-core-v2/CHANGELOG.md @@ -1,5 +1,11 @@ # @moonshot-ai/agent-core-v2 +## 0.3.2 + +### Patch Changes + +- [#2815](https://github.com/MoonshotAI/kimi-code/pull/2815) [`43c68f5`](https://github.com/MoonshotAI/kimi-code/commit/43c68f58f578c88d9f503afb72f12d343c2aa5c7) Thanks [@liruifengv](https://github.com/liruifengv)! - Keep session updatedAt stable across metadata management writes: rename and archive/restore no longer bump it, fork inherits the source session's recency, and agent registration is non-touching; add SessionMeta.archivedAt (set on archive, cleared on restore) and surface it as archived_at through the session index and the v1/v2 session routes. + ## 0.3.1 ### Patch Changes diff --git a/packages/agent-core-v2/package.json b/packages/agent-core-v2/package.json index ea85c28ee2f..bfa1af3cee8 100644 --- a/packages/agent-core-v2/package.json +++ b/packages/agent-core-v2/package.json @@ -1,6 +1,6 @@ { "name": "@moonshot-ai/agent-core-v2", - "version": "0.3.1", + "version": "0.3.2", "private": true, "description": "The unified agent engine for Kimi (v2 — DI Scope architecture)", "license": "MIT", diff --git a/packages/node-sdk/CHANGELOG.md b/packages/node-sdk/CHANGELOG.md index 201cec819e5..66b0fe369d9 100644 --- a/packages/node-sdk/CHANGELOG.md +++ b/packages/node-sdk/CHANGELOG.md @@ -1,5 +1,17 @@ # @moonshot-ai/kimi-code-sdk +## 0.17.0 + +### Minor Changes + +- [#2700](https://github.com/MoonshotAI/kimi-code/pull/2700) [`c9bfe8b`](https://github.com/MoonshotAI/kimi-code/commit/c9bfe8b2c8314ba4ef8806fb3b92ac654c1d1860) Thanks [@7Sageer](https://github.com/7Sageer)! - Remove the secondary-model session API `Session.applyPersistedSecondaryModel`; subagent model selection is configured via `[secondary_model]` in config.toml instead. The `SECONDARY_DERIVED_MODEL_ALIAS` export stays (the v1 engine still synthesizes the entry at runtime, so hosts keep filtering it out of model pickers), and the SDK now also exports `PRIMARY_SUBAGENT_MODEL_CHOICE`, the v2 subagent model pool's reserved `primary` key. + +### Patch Changes + +- [#2843](https://github.com/MoonshotAI/kimi-code/pull/2843) [`c212ae9`](https://github.com/MoonshotAI/kimi-code/commit/c212ae9715371c0d7939c15e664acbe0d7cf7fc3) Thanks [@sailist](https://github.com/sailist)! - Show project MCP launch targets in the workspace trust prompt, default to declining trust, and resolve fd and stty binaries to absolute paths so untrusted workspaces cannot plant bare-name executables before confirmation. + + `@moonshot-ai/kimi-code-sdk` contract change: `WorkspaceTrustInfo.gatedMcpServers` now carries structured `WorkspaceTrustMcpServerInfo` records (`name`, `transport`, and `command`/`args`/`cwd` or `url`) instead of plain strings, so SDK consumers rendering a trust prompt can show the full launch target. + ## 0.16.0 ### Minor Changes diff --git a/packages/node-sdk/package.json b/packages/node-sdk/package.json index 9fc54d37394..17f40c0ec90 100644 --- a/packages/node-sdk/package.json +++ b/packages/node-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@moonshot-ai/kimi-code-sdk", - "version": "0.16.0", + "version": "0.17.0", "private": true, "description": "TypeScript SDK for the Kimi Code Agent", "license": "MIT", diff --git a/packages/pi-tui/CHANGELOG.md b/packages/pi-tui/CHANGELOG.md index dc057767b28..9fdbb673dd2 100644 --- a/packages/pi-tui/CHANGELOG.md +++ b/packages/pi-tui/CHANGELOG.md @@ -1,5 +1,13 @@ # @moonshot-ai/pi-tui +## 0.84.2 + +### Patch Changes + +- [#2830](https://github.com/MoonshotAI/kimi-code/pull/2830) [`ec84a6f`](https://github.com/MoonshotAI/kimi-code/commit/ec84a6f9a3eb35e1118f8a327f7a11b3978a899c) Thanks [@liruifengv](https://github.com/liruifengv)! - Add fullscreen groundwork to the alternate-screen renderer: `ScrollView.canScroll`, `TuiAltScreen.getLayoutRoot()`, and viewport navigation keys (PageUp/PageDown/Home/End and friends) now fall through to the focused component when the primary scroll view has nothing to scroll. Terminal focus in/out reports are no longer consumed by the viewport input handler, so app-level listeners (focus-aware notifications, clipboard-image hints) keep working in fullscreen. + +- [#2830](https://github.com/MoonshotAI/kimi-code/pull/2830) [`ec84a6f`](https://github.com/MoonshotAI/kimi-code/commit/ec84a6f9a3eb35e1118f8a327f7a11b3978a899c) Thanks [@liruifengv](https://github.com/liruifengv)! - Re-baseline the fork on upstream pi-tui v0.84.1 plus upstream main up to `40a3d85` (2026-08-11), which adds the fullscreen transcript search (`ctrl+shift+f`), single-line scroll actions, the ~9-18x alternate-screen render-churn reduction, and an SSH-aware escape-timeout default. The upstream renderer is now split into main-screen and alternate-screen implementations (the `TUI` class is now an interface implemented by `TuiMainScreen` and `TuiAltScreen`), and the Markdown component gained opt-out LaTeX math rendering. All local patches are retained: narrow-terminal hardening, processed-line render caching, editor history hooks, the paste-burst fallback, and multi-root `@` completion. `Editor.setText` accepts a `preservePasteRegistry` option so subclasses can replace text without orphaning live paste markers (upstream resets the registry on every `setText`). + ## 0.84.1 ### Patch Changes diff --git a/packages/pi-tui/package.json b/packages/pi-tui/package.json index 485117d9413..85648c79c2e 100644 --- a/packages/pi-tui/package.json +++ b/packages/pi-tui/package.json @@ -1,6 +1,6 @@ { "name": "@moonshot-ai/pi-tui", - "version": "0.84.1", + "version": "0.84.2", "private": true, "description": "Terminal User Interface library with differential rendering for efficient text-based applications", "license": "MIT", From f8a88c1bd90f4b0b39682c9bdeb16b40eaa4ad8a Mon Sep 17 00:00:00 2001 From: liruifengv Date: Thu, 13 Aug 2026 14:30:40 +0800 Subject: [PATCH 36/50] docs(changelog): sync 0.36.0 from apps/kimi-code/CHANGELOG.md (#2880) Also translate the Chinese pool-example descriptions in docs/en/configuration/config-files.md into English. --- docs/en/configuration/config-files.md | 10 ++++----- docs/en/release-notes/changelog.md | 32 +++++++++++++++++++++++++++ docs/zh/release-notes/changelog.md | 32 +++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/docs/en/configuration/config-files.md b/docs/en/configuration/config-files.md index af7834b6a2d..82d5c864859 100644 --- a/docs/en/configuration/config-files.md +++ b/docs/en/configuration/config-files.md @@ -224,9 +224,9 @@ A configured pool — an explicit `[secondary_model.models]` table or a lone `de [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" [secondary_model.models] -"kimi-code/k3" = "难题选它。擅长复杂推理、算法设计、深度调试、数学和系统性难题。" -"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" -"kimi-code/kimi-for-coding" = "均衡的编码主力。适合大多数功能开发和代码修改任务。" +"kimi-code/k3" = "Pick this for hard problems. Strong at complex reasoning, algorithm design, deep debugging, math, and systematic challenges." +"kimi-code/kimi-for-coding-highspeed" = "Fast and cheap. Good for daily refactoring, code explanation, small edits, summaries, and simple batch tasks." +"kimi-code/kimi-for-coding" = "A balanced coding workhorse. Good for most feature development and code-change tasks." ``` A spawn resolves the subagent's model in this order: an explicit tool-call `model` → `default_model`. The `model` parameter accepts any pool alias, or `"primary"` — the model the caller itself is running, always valid even when that model is not in the pool. When neither `default_model` nor `[secondary_model.models]` is configured, the parameter is not advertised and subagents inherit the caller's model. Binding a pool alias carries no explicit thinking effort — the subagent resolves it naturally (global `[thinking]` config → the bound model's default effort) instead of inheriting the caller's level, while `"primary"` inherits both the model and the level from the caller. @@ -256,8 +256,8 @@ default_effort = "high" [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" [secondary_model.models] -"kimi-code/kimi-for-coding-highspeed" = "又快又便宜。适合日常重构、代码解释、小改动、总结和批量简单任务。" -kimi-for-coding-highspeed-deep = "同一模型的高 Thinking 档位。适合较难的子任务。" +"kimi-code/kimi-for-coding-highspeed" = "Fast and cheap. Good for daily refactoring, code explanation, small edits, summaries, and simple batch tasks." +kimi-for-coding-highspeed-deep = "The same model at a high thinking level. Good for harder subtasks." ``` Note that `default_effort` stays a model-level default: once a global `[thinking].effort` is set, it wins for the main agent and subagents alike, and the variant's default only applies when no global effort is set. Value and fallback rules follow the [`[models]` entry's `default_effort`](#models). diff --git a/docs/en/release-notes/changelog.md b/docs/en/release-notes/changelog.md index a7ea313103d..4680f1c9e5c 100644 --- a/docs/en/release-notes/changelog.md +++ b/docs/en/release-notes/changelog.md @@ -6,6 +6,38 @@ outline: 2 This page documents the changes in each Kimi Code CLI release. +## 0.36.0 (2026-08-13) + +### Features + +- Upgrade the experimental subagent model setting to a model pool: the `[secondary_model]` section can now hold a set of candidate models with descriptions, and the main agent picks from them per spawn based on the task. + + Set `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` (or the master flag `KIMI_CODE_EXPERIMENTAL_FLAG=1`) before starting Kimi to enable it. + + Recommended setups: + + - Minimal: run `/secondary-model` in the TUI, or write a single `default_model` line in `config.toml`, to make every subagent run the same model by default; add `force = true` to pin that choice so the main agent cannot override it. + - Declare a named pool with a one-line scenario description for each alias — the descriptions are what the main agent sees when choosing: + + ```toml + [secondary_model] + default_model = "kimi-code/kimi-for-coding-highspeed" + [secondary_model.models] + "kimi-code/kimi-for-coding-highspeed" = "Fast and cheap — good for daily refactoring, code explanation, and small edits." + "kimi-code/k3" = "Strong at complex reasoning and deep debugging — pick it for hard problems." + ``` + + See the [subagent model pool docs](https://moonshotai.github.io/kimi-code/en/configuration/config-files.html#subagent-model-pool) for details. +- Add an experimental fullscreen TUI mode. Set the `KIMI_CODE_TUI_FULL_SCREEN=1` environment variable to enable it. +- Support rendering LaTeX math formulas (`$…$` / `$$…$$`) in TUI messages as Unicode formulas. + +### Bug Fixes + +- Show project MCP launch targets in the workspace trust prompt, default to declining trust, and resolve `fd` and `stty` binaries to absolute paths so untrusted workspaces cannot plant bare-name executables before confirmation. +- Fix sessions failing with a provider 400 error on every follow-up request after a turn is interrupted while the model is still thinking, on strict OpenAI-compatible providers (e.g. DeepSeek). +- Fix Ctrl+C being ignored during automatic retries of failed API requests. +- Fix several known issues and make various refinements. See the [changelog on GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md) for more technical entries. + ## 0.35.0 (2026-08-12) ### Features diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index b88eb3a606c..badf20c80e6 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -6,6 +6,38 @@ outline: 2 本页记录 Kimi Code CLI 每个版本的变更内容。 +## 0.36.0(2026-08-13) + +### 新功能 + +- 实验性的子 Agent 模型配置升级为模型池:现在可以在 `[secondary_model]` 中配置一组带描述的候选模型,由主 Agent 每次派生时按任务挑选。 + + 启动前设置 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`(或实验总开关 `KIMI_CODE_EXPERIMENTAL_FLAG=1`)即可启用。 + + 推荐用法: + + - 极简用法:在 TUI 中运行 `/secondary-model` 选择,或在 `config.toml` 中写一行 `default_model`,让所有子 Agent 默认跑同一个模型;再加 `force = true` 可彻底固定该选择,主 Agent 无法改选。 + - 配置命名模型池,并为每个别名写一句适用场景的描述——描述会展示给主 Agent 作为挑选依据: + + ```toml + [secondary_model] + default_model = "kimi-code/kimi-for-coding-highspeed" + [secondary_model.models] + "kimi-code/kimi-for-coding-highspeed" = "快速、便宜,适合日常重构、代码解释和小改动。" + "kimi-code/k3" = "擅长复杂推理与深度调试,难题选它。" + ``` + + 详见 [子 Agent 模型池文档](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#子-agent-模型池)。 +- 新增实验性全屏 TUI 模式,设置 `KIMI_CODE_TUI_FULL_SCREEN=1` 环境变量即可启用。 +- TUI 支持渲染 LaTeX 数学公式(`$…$` 与 `$$…$$`),消息中的公式会显示为 Unicode 公式。 + +### 修复 + +- 修复未信任工作区可在信任确认前植入同名 `fd`/`stty` 可执行文件的风险;信任提示现在展示项目 MCP 的启动目标,并默认拒绝信任。 +- 修复在严格的 OpenAI 兼容供应商(如 DeepSeek)下,模型思考阶段打断轮次后,后续每轮请求都报 400 错误的问题。 +- 修复 API 请求失败自动重试期间按 Ctrl+C 无反应的问题。 +- 修复了一些已知问题,并做了若干细节优化。更详细的变更记录见 [GitHub](https://github.com/MoonshotAI/kimi-code/blob/main/apps/kimi-code/CHANGELOG.md)。 + ## 0.35.0(2026-08-12) ### 新功能 From 5912d4c7d19d68975e85b007976b1bef59edae5c Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 14:35:23 +0800 Subject: [PATCH 37/50] fix: stop repeated file-watcher errors on Windows drive-root and UNC workspaces (#2876) --- .changeset/fix-windows-project-root-watch.md | 5 ++ .../agent-core-v2/src/_base/utils/paths.ts | 30 ++++++- .../src/app/skillCatalog/skillRoots.ts | 11 +-- .../internal/agentRoots.ts | 16 ++-- .../test/_base/utils/paths.test.ts | 80 ++++++++++++++++++- 5 files changed, 118 insertions(+), 24 deletions(-) create mode 100644 .changeset/fix-windows-project-root-watch.md diff --git a/.changeset/fix-windows-project-root-watch.md b/.changeset/fix-windows-project-root-watch.md new file mode 100644 index 00000000000..27fd36caab6 --- /dev/null +++ b/.changeset/fix-windows-project-root-watch.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix repeated file-watcher errors on Windows when the workspace is a drive root (such as `E:\`) or a UNC network share. diff --git a/packages/agent-core-v2/src/_base/utils/paths.ts b/packages/agent-core-v2/src/_base/utils/paths.ts index e6b230df739..34de452b174 100644 --- a/packages/agent-core-v2/src/_base/utils/paths.ts +++ b/packages/agent-core-v2/src/_base/utils/paths.ts @@ -1,14 +1,40 @@ /** - * `_base/utils/paths` (cross-cutting) — pure path-filter predicates. + * `_base/utils/paths` (cross-cutting) — pure path predicates and directory + * walks. * * Constrains filesystem watches to selected subtrees and scanner-visible - * entries. + * entries, and walks host directory chains with platform-native path + * semantics so drive-letter / UNC roots keep their host form. */ +import nodePath from 'node:path'; + function normalizeSlashes(p: string): string { return p.replaceAll('\\', '/'); } +export interface UpwardRootPathApi { + resolve(dir: string): string; + dirname(dir: string): string; + join(...segments: string[]): string; +} + +export async function findUpwardRoot( + workDir: string, + markerName: string, + hasMarker: (markerPath: string) => Promise, + pathApi: UpwardRootPathApi = nodePath, +): Promise { + const start = pathApi.resolve(workDir); + let current = start; + while (true) { + if (await hasMarker(pathApi.join(current, markerName))) return normalizeSlashes(current); + const parent = pathApi.dirname(current); + if (parent === current) return normalizeSlashes(start); + current = parent; + } +} + export interface SubtreeWatchFilterOptions { readonly maxDepth?: number; readonly skipEntry?: (entryName: string) => boolean; diff --git a/packages/agent-core-v2/src/app/skillCatalog/skillRoots.ts b/packages/agent-core-v2/src/app/skillCatalog/skillRoots.ts index 8c9d4a5f710..367a33a6066 100644 --- a/packages/agent-core-v2/src/app/skillCatalog/skillRoots.ts +++ b/packages/agent-core-v2/src/app/skillCatalog/skillRoots.ts @@ -11,6 +11,8 @@ import { promises as fs } from 'node:fs'; import path from 'pathe'; +import { findUpwardRoot } from '#/_base/utils/paths'; + import type { SkillRoot, SkillSource } from './types'; const USER_BRAND_DIRS = ['skills'] as const; @@ -78,14 +80,7 @@ export async function configuredRoots( } async function findProjectRoot(workDir: string): Promise { - const start = path.resolve(workDir); - let current = start; - while (true) { - if (await exists(path.join(current, '.git'))) return current; - const parent = path.dirname(current); - if (parent === current) return start; - current = parent; - } + return findUpwardRoot(workDir, '.git', exists); } async function pushFirstExisting( diff --git a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentRoots.ts b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentRoots.ts index 7d0a8ab48c2..c09df234c49 100644 --- a/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentRoots.ts +++ b/packages/agent-core-v2/src/workspace/workspaceAgentProfileLoader/internal/agentRoots.ts @@ -5,8 +5,9 @@ * filesystem boundary. Pure path probes; no scoped state. */ -import { dirname, join, resolve } from 'pathe'; +import { join } from 'pathe'; +import { findUpwardRoot } from '#/_base/utils/paths'; import type { IHostFileSystem } from '#/os/interface/hostFileSystem'; import { HostFsError, OsFsErrors } from '#/os/interface/hostFsErrors'; @@ -86,20 +87,15 @@ async function findProjectRoot( workDir: string, warn?: AgentRootWarn, ): Promise { - const start = resolve(workDir); - let current = start; - while (true) { - const marker = join(current, '.git'); + return findUpwardRoot(workDir, '.git', async (marker) => { try { - if (await pathExists(fs, marker)) return current; + return await pathExists(fs, marker); } catch (error) { if (isUnavailable(error)) throw error; warn?.(`Skipping unreadable project marker ${marker}: ${errorMessage(error)}`, error); + return false; } - const parent = dirname(current); - if (parent === current) return start; - current = parent; - } + }); } async function pushFirstExisting( diff --git a/packages/agent-core-v2/test/_base/utils/paths.test.ts b/packages/agent-core-v2/test/_base/utils/paths.test.ts index 1f73ebc59da..532c6d9f78e 100644 --- a/packages/agent-core-v2/test/_base/utils/paths.test.ts +++ b/packages/agent-core-v2/test/_base/utils/paths.test.ts @@ -1,14 +1,19 @@ /** * Scenario: recursive watches constrained to selected candidate subtrees. - * Responsibilities: candidate ancestry, scan-depth bounds, and excluded-entry - * probing. Wiring: pure path predicates with no external collaborators. + * Responsibilities: candidate ancestry, scan-depth bounds, excluded-entry + * probing, and the marker-based upward root walk. Wiring: pure path + * predicates and walks with no external collaborators. * Run: `pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run * test/_base/utils/paths.test.ts`. */ -import { describe, expect, it } from 'vitest'; +import { mkdtemp, mkdir, rm, stat } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import nodePath, { win32 } from 'node:path'; -import { subtreeWatchFilter } from '#/_base/utils/paths'; +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; + +import { findUpwardRoot, subtreeWatchFilter } from '#/_base/utils/paths'; describe('subtree watch filtering', () => { const root = '/repo'; @@ -105,3 +110,70 @@ describe('subtree watch filtering', () => { expect(ignored('/repo/.agents/skills/parent/child/runtime')).toBe(true); }); }); + +describe('findUpwardRoot', () => { + const noMarker = async () => false; + + describe('with host-default path semantics', () => { + let root: string; + + beforeEach(async () => { + root = await mkdtemp(nodePath.join(tmpdir(), 'upward-root-')); + }); + + afterEach(async () => { + await rm(root, { recursive: true, force: true }); + }); + + const hasMarker = async (markerPath: string): Promise => { + try { + await stat(markerPath); + return true; + } catch { + return false; + } + }; + + it('stops at the nearest ancestor holding the marker', async () => { + await mkdir(nodePath.join(root, '.git')); + const child = nodePath.join(root, 'src', 'pkg'); + await mkdir(child, { recursive: true }); + + const found = await findUpwardRoot(child, '.git', hasMarker); + + expect(found).toBe(root.replaceAll('\\', '/')); + }); + + it('falls back to the working directory when no ancestor holds the marker', async () => { + const child = nodePath.join(root, 'src', 'pkg'); + await mkdir(child, { recursive: true }); + + const found = await findUpwardRoot(child, '.git', hasMarker); + + expect(found).toBe(child.replaceAll('\\', '/')); + }); + }); + + it('keeps a Windows drive-root working directory in host form', async () => { + const found = await findUpwardRoot('E:\\', '.git', noMarker, win32); + + expect(found).toBe('E:/'); + }); + + it('keeps a Windows UNC working directory in host form', async () => { + const found = await findUpwardRoot('\\\\fs1\\share\\dir', '.git', noMarker, win32); + + expect(found).toBe('//fs1/share/dir'); + }); + + it('stops at the nearest Windows ancestor holding the marker', async () => { + const found = await findUpwardRoot( + 'E:\\repo\\src', + '.git', + async (markerPath) => markerPath === 'E:\\repo\\.git', + win32, + ); + + expect(found).toBe('E:/repo'); + }); +}); From 6be26978b123bacf1c5ebce52bbeb6f7b7ff0629 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 17:59:57 +0800 Subject: [PATCH 38/50] feat: auto-generate session titles via the managed chat_title tool (#2351) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: auto-generate session titles via the managed chat_title tool With the auto-title experimental flag on and a managed OAuth login, the session title is generated from the first prompt, replacing the truncated-prompt easy title. A custom title set by the user is never overwritten, and generation failures degrade silently to the easy title. - oauth: fetchChatTitle for the platform /tools chat_title method - agent-core (v1): fire-and-forget generation on the first prompt - agent-core-v2: sessionTitle domain watching the easy-title event - kap-server: POST /sessions/{id}/title/generate for manual regeneration * fix: harden auto-generated session titles * fix: preserve managed title request headers * Pair auto-title endpoint overrides with matching OAuth credentials * fix: preserve legacy custom session titles * fix: preserve automatic session title invariants * refactor: keep only the on-demand session title generation interface Drop the automatic wiring on both engines: the v1 (TUI) first-prompt trigger and the v2 easy-title event watcher. SessionTitleService's generateTitle() stays as the single on-demand entry point behind the auto-title flag, backing the kap-server title/generate route. The changeset goes away too: with no shipped consumer, the remaining surface is not user-perceivable. * feat: generate session title from the first recorded prompts Record up to three sanitized natural-language prompts in session metadata (skill / plugin activations excluded) and compose the chat_title input as order-labeled lines truncated to a 1000-char budget, falling back to lastPrompt for sessions without recorded prompts. * test: make session title race tests deterministic * Generate session titles from agent conversation history * fix: reject title generation without user prompts * fix: bound session title prompt history * feat: enable session title generation without an experimental flag * test: cover session title generation through the public REST path * feat: request session title generation from the TUI after each turn * Retry auto title generation for prompt-derived session titles * feat: record session title source and harden the generation lifecycle - persist titleSource (prompt/generated/custom); skip auto-generation over an already-generated title unless forced, and never over a custom one - plumb the force option from the core through klient and node-sdk to the REST title/generate endpoint - drop the title write-back when the session scope was superseded mid-flight, and retry once with a force-refreshed token on a 401 - stop closing sessions a concurrent public resume has handed out in the temporary resume paths (generateSessionTitle, renameSession) - accept session.meta.updated patches without lastPrompt in klient event validation, and emit exactly one metadata event per applied title - remove the retired prompts field heal and drop the changeset (the behavior is only perceivable on the experimental v2 engine) * chore: follow agent-core comment convention * fix: ignore stale session title callbacks * fix: preserve session title state invariants * refactor: seed session lifetime instead of querying the workspace handler The session title service must not depend on the Workspace-tier handler registry. The handler now seeds each session scope with an abort signal, fires it synchronously when a close begins, and the title service carries the signal on its request, drops the write-back once aborted, and drains an in-flight generation through the onWillCloseSession hook. * fix: honor the legacy custom title marker over a stale titleKind A v1 rename spreads the original state.json document, so an explicit isCustomTitle: true can travel with a stale titleKind. The explicit marker now wins on load, and every persist double-writes the derived isCustomTitle so released v1 builds keep recognizing the custom title. * fix: serialize session access and expose the session title state The temporary resume/rename/close paths and the public lifecycle operations now share a per-session queue, so a public resume can never receive a handle whose cleanup close is already in flight. Session summaries carry the canonical title state, letting the TUI skip title generation for sessions whose title was already generated or customized instead of re-asking after every turn. * chore: add session title changesets * fix: close the session lifecycle races around close and title generation A close/archive is now tracked in a closing registry from its first synchronous step until disposal: get/list hide the closing session and resume waits the close out instead of returning the doomed handle, and fork waits out an in-flight source close. The title service tracks the whole generateTitle call as the unit the close hook drains, and the generated-title write re-checks the lifetime signal inside the serialized metadata update so an abort landing while the update is queued still vetoes the write-back. * feat: project the session title state through the session index readSummary and the read-model mirror carry titleKind, so listSessions reports the same canonical title state as a resumed session's summary. * fix: serialize the remaining session access paths in the SDK forkSession and explicit-id createSession join the per-session queue, and the harness resume fast path skips a session whose close is in flight instead of returning the closing facade (which then failed every call with session.closed); its late onClose no longer evicts the fresh session either. The harness rename event now carries isCustomTitle so the TUI stops asking for a generated title after a local rename. * fix: detach the external abort listener once the chat title request settles * fix: harden the session close/archive and create/fork lifecycle The closing registry now records the operation kind: an archive arriving during a plain close waits it out and lands the archived flag on the persisted document instead of riding the close to success, and a failing close hook no longer strands a half-closed session — the teardown always completes while the hook error still reaches the caller. create and fork reserve their target id synchronously with the existence check, so a concurrent create/fork of the same id loses up front and can never tear down the winner's scope or directory. * fix: keep forced title regeneration independent and veto queued title writes atomically Plain generateTitle calls still coalesce onto one shared in-flight generation, but a forced regeneration always runs on its own so it is neither swallowed by a plain call's early exit nor shares its result; the close hook drains every active generation. The allowWhen veto now runs inside applyUpdate with no await between the check and the mutation, so an abort cannot slip into the gap. * fix: carry the title state through the session index and klient contract The klient session summary schema no longer strips titleKind, and the index readSummary honors a legacy isCustomTitle marker over a stale titleKind, so listSessions reports the same canonical title state as a resumed session. * fix: coalesce harness resumes, lock fork targets, and cover the title state end to end Concurrent public resumeSession calls now share one in-flight resume and one facade instead of building parallel facades over the same engine handle (a close on either would strand the other). forkSession takes the source and target queues in sorted order, so fork(A->X) is atomic against create(X) and fork(B->X) without an ABBA deadlock. The emitMetaUpdated patch type drops the redundant undefined union, and the SDK tests now cover facade coalescing and the title state across list and resume. * fix: serve the canonical title state from the session index and version the read-model cache readSummary now derives the title state with the same priority chain as the metadata document's canonical normalization (explicit custom marker, valid titleKind, legacy false marker, customTitle, plain title), so list and resume agree on legacy documents too. Read-model cache entries carry a summary version stamp and older-stamped entries are treated as cold misses, so an upgraded reader never serves a stale-shaped summary. * fix: let the newest title generation request win the write-back A forced regeneration could be followed on disk by an earlier plain call's slower backend response. Each generation now carries a monotonically increasing sequence (assigned only once a request actually proceeds to generation), and the serialized metadata write is vetoed unless the writer is still the newest request. * fix: fold archive into close and own the create/fork rollback An archive requested during a plain close is applied through the live metadata during the teardown (or lands on the persisted document when it arrives too late or the close fails), publishes the archived event, and works on cold sessions too. A resume waiting on a failed close retries instead of propagating the hook error, the teardown completes even when the agent drain fails, and the create/fork rollback only ever removes its own handle — a loser of the reservation race can no longer tear down the winner's live scope. * fix: key harness resume coalescing by the full input Concurrent resumes only share a facade when their inputs match — a caller passing different dirs, replay, profile, or kaos options gets its own resume instead of having its options silently dropped. * refactor(agent-core-v2): drop session close-awareness from title generation Auto title is best-effort: a generation racing session close no longer cancels its fetch or guards its write-back, so the per-session sessionLifetime AbortSignal seed, the onWillCloseSession drain, and the close-time invalidation go away. The newest-request-wins write-back predicate stays. * Delete .changeset/sdk-session-title-kind.md Signed-off-by: 7Sageer * refactor(session-title): drop the unused force regeneration path Nothing calls force: with it gone, plain calls always coalesce onto the shared in-flight generation, so the generation sequence and the caller-supplied allowWhen veto lose their only purpose and go with it. The title/generate REST route takes no body anymore. * refactor(agent-core-v2): drop the title state projection from the session index The listed-session titleKind had no consumer: the TUI's title-generation gate seeds from the resumed summary, which reads the live metadata document, and the kap-server REST wire never carried the field. Removing the projection also retires the read-model summary version stamp (the remaining shape is fully field-checkable) and the duplicate title-kind derivation that had to stay in lockstep with sessionMetadata. The klient list contract and the node-sdk list mapper drop the field with it; the resumed/live summary still reports the canonical title state. * refactor(agent-core-v2): inline the transcript live-tail merge into messageLegacy mergeContextTranscriptWithLive had a single caller; move the logic into messageLegacyService as the private mergeLiveTail and drop the export. * refactor(agent-core-v2): drop the closing registry from the session lifecycle Auto title no longer consumes close-awareness, so the machinery goes back to the simple forms: close/archive run straight through, resume no longer waits out an in-flight close, create/fork drop their target reservation, and a cold archive is a no-op again. Reverts the behavior of e7c397a7c and cd1cea0fd on top of the sessionLifecycle rename. * fix(agent-core-v2): complete the HostRequestHeaders migration in the title test The main merge reduced #/kosong/model/hostRequestHeaders to the pure port contract; define the test's headers as a plain value matching it and tidy the SDK test import grouping. * fix(node-sdk): mark resume telemetry field ignored * feat(tui): request the session title as soon as a prompt is accepted * fix(agent-core-v2): drop the numbered user prefixes from the title request input * refactor(tui): ask for the session title only once per session attach * refactor(tui): drop the automatic session title trigger Keep the capability only: the engine-side title generation service, the POST /sessions/{id}/title/generate route, and the SDK generateSessionTitle method stay; the TUI no longer requests a title on prompt accept or on session attach. The changeset now covers the SDK capability instead of a CLI-facing auto title. * Delete .changeset/session-title-generation.md Signed-off-by: 7Sageer * feat(agent-core-v2): add forced session title regeneration ISessionTitleService.generateTitle and the metadata write-back take an optional force flag that bypasses the custom/generated guards, so an explicit user request (the desktop/web rename field's Gen Title action) can overwrite any current title; the applied title is marked generated. Forced calls skip the in-flight coalescing, and a forced write is plain last-writer-wins. kap-server's POST /sessions/{id}/title/generate accepts an optional { "force": true } body; klient and the node-sdk plumb the option through (GenerateSessionTitleInput.force). Also renumber SESSION_TITLE_UNAVAILABLE to 40923: main assigned 40922 to PAGE_TOKEN_MISMATCH after this branch forked. * feat(agent-core-v2): selectable conversation excerpts for title generation generateTitle gains a source option alongside force: - user_prompts (default): the existing first-prompts window, unchanged. - first_turn: the opening user prompt paired with the first turn's final assistant text — strict, so a caller asking before the first reply lands simply gets unavailable and can retry at the next turn boundary. - digest: first prompt + latest prompt + the latest turn's final assistant text, tolerating a compacted window by using whatever segments survive; meant for explicit regeneration on multi-turn sessions. Assistant segments keep only natural-language text parts (tool calls, thinking, and media never contribute) and pass through the shared metadata sanitizer, which redacts secrets and long base64-looking runs; each segment is capped (user 300, assistant 600/400) so the composed chat_content stays within the 1000-char budget. The kap-server route, klient contract, and node-sdk plumb the option through. Excerpt extraction is covered against the real context memory (loop-event folding), and the REST surface gains a digest composition case. * feat(agent-core-v2): gate session title generation behind an experimental flag Registers the flag (off by default; env KIMI_CODE_EXPERIMENTAL_SESSION_TITLE, the master flag, or the [experimental] config section) and makes generateTitle report unavailable while it is off, so every entry point — the kap-server route, klient, node-sdk, and through them the clients' auto trigger and rename-field action — is inert unless the user opts in. * refactor(agent-core-v2): rename the title flag to auto_session_title Snake-case id matching search_worker / persistence_minidb_readmodel; env KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE. * fix(agent-core-v2): land the merge resolution leftovers The main-merge commit captured pre-fix snapshots of four files; the actual resolutions only lived in my working tree: the LifecycleScope import move to #/app/scopes, the titleKind port of applyPromptMetadataUpdate, the Promise pinning of the metadata update queue, and the reloadSession runSessionAccess closure. * test(node-sdk): enable the auto_session_title flag in the title suites Generation now reports unavailable with the flag off, so the two title-generation harnesses opt in through the written config's [experimental] section. * chore: changeset for the experimental web session titles * chore: scope the title changeset to the SDK package * chore: cover the internal packages in the title changesets --------- Signed-off-by: 7Sageer Co-authored-by: liruifengv --- .changeset/agent-core-v2-session-title.md | 5 + .changeset/auto-session-title.md | 5 + .changeset/kap-server-session-title-route.md | 5 + .changeset/klient-session-title.md | 5 + .changeset/oauth-chat-title.md | 5 + .../agent-core-v2/docs/state-manifest.d.ts | 2 +- packages/agent-core-v2/src/index.ts | 5 + .../session/sessionMetadata/promptMetadata.ts | 10 +- .../sessionMetadata/sessionMetadata.ts | 15 +- .../sessionMetadata/sessionMetadataService.ts | 151 ++++- .../sessionTitle/agentTitlePromptSource.ts | 44 ++ .../agentTitlePromptSourceService.ts | 136 +++++ .../src/session/sessionTitle/flag.ts | 25 + .../src/session/sessionTitle/sessionTitle.ts | 35 ++ .../sessionTitle/sessionTitleService.ts | 229 +++++++ .../sessionLifecycleService.ts | 2 +- .../agent/prompt/promptMetadataText.test.ts | 56 ++ .../app/sessionExport/sessionExport.test.ts | 1 + .../app/sessionIndex/sessionIndex.test.ts | 2 +- .../workspaceLifecycle.test.ts | 1 + .../sessionMetadata/sessionMetadata.test.ts | 277 ++++++++- .../agentTitlePromptSourceService.test.ts | 211 +++++++ .../sessionTitle/sessionTitleService.test.ts | 574 ++++++++++++++++++ .../titleExcerpt.integration.test.ts | 94 +++ packages/agent-core-v2/test/tool/tool.test.ts | 1 + .../sessionLifecycle/sessionLifecycle.test.ts | 53 +- .../kap-server/src/protocol/error-codes.ts | 2 + packages/kap-server/src/routes/sessions.ts | 62 ++ .../apiSurface.snapshot.test.ts.snap | 4 + packages/kap-server/test/prompts.test.ts | 20 + packages/kap-server/test/sessions.test.ts | 164 +++++ packages/klient/src/contract/global/events.ts | 6 +- packages/klient/src/contract/index.ts | 2 + .../klient/src/contract/session/metadata.ts | 6 +- packages/klient/src/contract/session/title.ts | 23 + packages/klient/src/core/facade/session.ts | 17 + .../src/transports/memory/serviceRegistry.ts | 2 + packages/klient/test/contract-parity.ts | 8 + packages/klient/test/facade.test.ts | 31 + packages/node-sdk/src/kimi-harness.ts | 73 ++- packages/node-sdk/src/rpc.ts | 13 + packages/node-sdk/src/sdk-rpc-client-v2.ts | 223 +++++-- packages/node-sdk/src/session.ts | 7 +- packages/node-sdk/src/types.ts | 19 + packages/node-sdk/src/v2/session-mapper.ts | 2 +- .../node-sdk/test/sdk-rpc-client-v2.test.ts | 367 ++++++++++- packages/node-sdk/test/v1-v2-parity.test.ts | 5 +- packages/oauth/src/index.ts | 7 + packages/oauth/src/managed-tools.ts | 99 +++ packages/oauth/test/managed-tools.test.ts | 272 +++++++++ 50 files changed, 3263 insertions(+), 120 deletions(-) create mode 100644 .changeset/agent-core-v2-session-title.md create mode 100644 .changeset/auto-session-title.md create mode 100644 .changeset/kap-server-session-title-route.md create mode 100644 .changeset/klient-session-title.md create mode 100644 .changeset/oauth-chat-title.md create mode 100644 packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSource.ts create mode 100644 packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSourceService.ts create mode 100644 packages/agent-core-v2/src/session/sessionTitle/flag.ts create mode 100644 packages/agent-core-v2/src/session/sessionTitle/sessionTitle.ts create mode 100644 packages/agent-core-v2/src/session/sessionTitle/sessionTitleService.ts create mode 100644 packages/agent-core-v2/test/session/sessionTitle/agentTitlePromptSourceService.test.ts create mode 100644 packages/agent-core-v2/test/session/sessionTitle/sessionTitleService.test.ts create mode 100644 packages/agent-core-v2/test/session/sessionTitle/titleExcerpt.integration.test.ts create mode 100644 packages/klient/src/contract/session/title.ts create mode 100644 packages/oauth/src/managed-tools.ts create mode 100644 packages/oauth/test/managed-tools.test.ts diff --git a/.changeset/agent-core-v2-session-title.md b/.changeset/agent-core-v2-session-title.md new file mode 100644 index 00000000000..17df2875d60 --- /dev/null +++ b/.changeset/agent-core-v2-session-title.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/agent-core-v2": minor +--- + +Add the Session-scoped `ISessionTitleService` for managed AI session titles: composes the excerpt sent to the platform chat_title tool from the main agent's conversation (the first user prompts, the strict `first_turn` pair, or the head+tail `digest` for multi-turn sessions; assistant segments keep only final text), persists the result with a `titleKind` (`replaceable` / `generated` / `custom`) that never overwrites a user-renamed title unless explicitly forced, and rebroadcasts `session.meta.updated`. Gated by the new experimental `auto_session_title` flag and a managed OAuth login. diff --git a/.changeset/auto-session-title.md b/.changeset/auto-session-title.md new file mode 100644 index 00000000000..253b97ff021 --- /dev/null +++ b/.changeset/auto-session-title.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code-sdk": minor +--- + +Add `generateSessionTitle` (v2 engine) for managed AI session titles: optional `force` regeneration over generated/custom titles and selectable conversation excerpts (`user_prompts` / `first_turn` / `digest`). Gated by the experimental `auto_session_title` flag and a managed OAuth login. diff --git a/.changeset/kap-server-session-title-route.md b/.changeset/kap-server-session-title-route.md new file mode 100644 index 00000000000..2c4ab910833 --- /dev/null +++ b/.changeset/kap-server-session-title-route.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kap-server": patch +--- + +Add `POST /api/v1/sessions/{session_id}/title/generate` with an optional `{ "force": true, "source": "user_prompts" | "first_turn" | "digest" }` body; unknown sessions return 40401 and unavailable generation (flag off, no managed login, no prompt yet, backend failure) returns the new 40923 SESSION_TITLE_UNAVAILABLE. diff --git a/.changeset/klient-session-title.md b/.changeset/klient-session-title.md new file mode 100644 index 00000000000..833b46b1cc5 --- /dev/null +++ b/.changeset/klient-session-title.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/klient": patch +--- + +Expose `session(id).generateTitle({ force, source })` on the session facade and the matching `sessionTitleService` wire contract. diff --git a/.changeset/oauth-chat-title.md b/.changeset/oauth-chat-title.md new file mode 100644 index 00000000000..329c6fe18f4 --- /dev/null +++ b/.changeset/oauth-chat-title.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code-oauth": patch +--- + +Add `fetchChatTitle` for the managed platform `/tools` `chat_title` method: protocol headers, an 8s timeout, response validation, and structured failures. diff --git a/packages/agent-core-v2/docs/state-manifest.d.ts b/packages/agent-core-v2/docs/state-manifest.d.ts index 6698b6bb76a..b8def9ff8fd 100644 --- a/packages/agent-core-v2/docs/state-manifest.d.ts +++ b/packages/agent-core-v2/docs/state-manifest.d.ts @@ -448,7 +448,7 @@ export interface SessionStateSnapshot { readonly id: string; readonly version?: number; readonly title?: string; - readonly isCustomTitle?: boolean; + readonly titleKind?: 'replaceable' | 'generated' | 'custom'; readonly lastPrompt?: string; readonly createdAt: number; readonly updatedAt: number; diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 33e343ba406..92bf9616535 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -129,6 +129,11 @@ export * from '#/session/sessionActivity/sessionActivity'; export * from '#/session/sessionActivity/sessionActivityService'; export * from '#/session/sessionActivity/sessionOutcomeMirror'; export * from '#/session/sessionActivity/sessionOutcomeMirrorService'; +export * from '#/session/sessionTitle/agentTitlePromptSource'; +import '#/session/sessionTitle/agentTitlePromptSourceService'; +export * from '#/session/sessionTitle/sessionTitle'; +export * from '#/session/sessionTitle/sessionTitleService'; +import '#/session/sessionTitle/flag'; export * from '#/session/sessionToolPolicy/sessionToolPolicy'; export * from '#/session/sessionToolPolicy/sessionToolPolicyService'; export * from '#/app/config/config'; diff --git a/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts b/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts index 611a495bb3a..a2d12da6d15 100644 --- a/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts +++ b/packages/agent-core-v2/src/session/sessionMetadata/promptMetadata.ts @@ -14,7 +14,7 @@ import type { IEventService } from '#/app/event/event'; import { titleFromPromptMetadataText } from '#/agent/prompt/promptMetadataText'; -import type { ISessionMetadata } from './sessionMetadata'; +import type { ISessionMetadata, SessionTitleKind } from './sessionMetadata'; export function isUntitled(title: string | undefined): boolean { return title === undefined || title.trim().length === 0 || title === 'New Session'; @@ -32,12 +32,12 @@ export async function applyPromptMetadataUpdate( ): Promise { if (text === undefined) return; const current = await target.metadata.read(); - const patch: { lastPrompt: string; title?: string; isCustomTitle?: boolean } = { + const patch: { lastPrompt: string; title?: string; titleKind?: SessionTitleKind } = { lastPrompt: text, }; - if (!current.isCustomTitle && isUntitled(current.title)) { + if (current.titleKind !== 'custom' && isUntitled(current.title)) { patch.title = titleFromPromptMetadataText(text); - patch.isCustomTitle = false; + patch.titleKind = 'replaceable'; } await target.metadata.update(patch); target.eventService.publish({ @@ -48,7 +48,7 @@ export async function applyPromptMetadataUpdate( title: patch.title, patch: { title: patch.title, - isCustomTitle: patch.isCustomTitle, + isCustomTitle: patch.titleKind === undefined ? undefined : false, lastPrompt: text, }, }, diff --git a/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadata.ts b/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadata.ts index e7af38ce33a..fbf7c13e938 100644 --- a/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadata.ts +++ b/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadata.ts @@ -25,11 +25,13 @@ export interface AgentMeta { export const SESSION_META_VERSION = 2; +export type SessionTitleKind = 'replaceable' | 'generated' | 'custom'; + export interface SessionMeta { readonly id: string; readonly version?: number; readonly title?: string; - readonly isCustomTitle?: boolean; + readonly titleKind?: SessionTitleKind; readonly lastPrompt?: string; readonly createdAt: number; readonly updatedAt: number; @@ -56,6 +58,17 @@ export interface ISessionMetadata { read(): Promise; update(patch: SessionMetaPatch, opts?: { readonly touchUpdatedAt?: boolean }): Promise; setTitle(title: string): Promise; + /** + * Applies a generated title unless the user customized theirs; the title + * kind is re-checked inside the serialized update, right before the write, + * so a custom title set while a generation was in flight still wins. + * `force` skips the kind check entirely (explicit user-requested + * regeneration — last writer wins). + */ + setGeneratedTitleIfUncustomized( + title: string, + opts?: { force?: boolean }, + ): Promise; setArchived(archived: boolean): Promise; registerAgent(agentId: string, meta: AgentMeta): Promise; } diff --git a/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadataService.ts b/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadataService.ts index 8cd2b79a99e..6de1a390fef 100644 --- a/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadataService.ts +++ b/packages/agent-core-v2/src/session/sessionMetadata/sessionMetadataService.ts @@ -11,13 +11,23 @@ * backfilled and persisted on load for documents written before the seeding * existed (without touching `updatedAt`, so a format heal never reorders * session listings). `updatedAt` tracks content activity only: management - * writes (rename via `setTitle`, archive/restore via `setArchived`) keep the - * persisted value through `touchUpdatedAt: false`, an explicit - * `patch.updatedAt` always wins (fork restores the source's recency), and - * agent registration is a structural write that never touches it — neither - * when resume materializes a cold session's agents, nor when a runtime - * subagent registers mid-turn (the turn's own submit/end moments carry - * recency). Bound at Session scope. + * writes (rename via `setTitle`, archive/restore via `setArchived`, the + * generated-title write-back) keep the persisted value through + * `touchUpdatedAt: false`, an explicit `patch.updatedAt` always wins (fork + * restores the source's recency), and agent registration is a structural + * write that never touches it — neither when resume materializes a cold + * session's agents, nor when a runtime subagent registers mid-turn (the + * turn's own submit/end moments carry recency). The canonical title state + * is `titleKind`; every persist additionally double-writes the v1-readable + * `isCustomTitle` marker derived from it, and on load an explicit + * `isCustomTitle: true` outranks a stale `titleKind` (a v1 rename spreads + * the original document, so the two can disagree) while a `false` marker + * never downgrades a modern generated/custom state. The generated-title + * write path (`setGeneratedTitleIfUncustomized`) serializes through the same + * update queue as everything else and re-checks the title kind inside the + * queued write, so a custom title set while a generation was in flight is + * never overwritten — unless the caller passes `force` (explicit + * regeneration, last writer wins). Bound at Session scope. * * Read-model mirroring (flag `persistence_minidb_readmodel`): after a metadata * update is persisted, the fresh summary is recorded into the App-scoped @@ -55,6 +65,7 @@ import { type SessionMeta, type SessionMetadataChangedEvent, type SessionMetaPatch, + type SessionTitleKind, } from './sessionMetadata'; const META_KEY = 'state.json'; @@ -119,28 +130,42 @@ export class SessionMetadata extends Service implements ISessionMetadata { patch: SessionMetaPatch, opts?: { readonly touchUpdatedAt?: boolean }, ): Promise { - return this.enqueueUpdate(() => this.applyUpdate(patch, opts)); + return this.enqueueUpdate(async () => { + await this.applyUpdate(patch, opts); + }); } private async applyUpdate( patch: SessionMetaPatch, opts?: { readonly touchUpdatedAt?: boolean }, - ): Promise { + ): Promise { await this.ready; - if (this.disposed) return; + if (this.disposed) return false; const updatedAt = patch.updatedAt ?? (opts?.touchUpdatedAt === false ? this.data.updatedAt : Date.now()); this.data = { ...this.data, ...patch, updatedAt }; - await this.store.set(this.scope, META_KEY, this.data); - if (this.disposed) return; + await this.store.set(this.scope, META_KEY, encodeSessionMeta(this.data)); + if (this.disposed) return false; this.mirrorToReadModel(); this._onDidChangeMetadata.fire({ changed: Object.keys(patch) as (keyof SessionMeta)[], }); + return true; } async setTitle(title: string): Promise { - await this.update({ title, isCustomTitle: true }, { touchUpdatedAt: false }); + await this.update({ title, titleKind: 'custom' }, { touchUpdatedAt: false }); + } + + async setGeneratedTitleIfUncustomized( + title: string, + opts?: { force?: boolean }, + ): Promise { + return this.enqueueUpdate(async () => { + await this.ready; + if (opts?.force !== true && this.data.titleKind === 'custom') return false; + return this.applyUpdate({ title, titleKind: 'generated' }, { touchUpdatedAt: false }); + }); } async setArchived(archived: boolean): Promise { @@ -160,9 +185,12 @@ export class SessionMetadata extends Service implements ISessionMetadata { }); } - private enqueueUpdate(work: () => Promise): Promise { + private enqueueUpdate(work: () => Promise): Promise { const run = this.updateQueue.then(work, work); - const tracked = run.catch(() => {}); + const tracked: Promise = run.then( + () => undefined, + () => undefined, + ); this.updateQueue = tracked; pendingWrites.add(tracked); void tracked.finally(() => pendingWrites.delete(tracked)); @@ -201,13 +229,17 @@ export class SessionMetadata extends Service implements ISessionMetadata { const existing = await this.store.get(this.scope, META_KEY); if (existing !== undefined) { this.data = normalizeSessionMeta(existing, this.ctx.sessionId); - if (this.data.agents === undefined || this.data.custom === undefined) { + if ( + this.data.agents === undefined || + this.data.custom === undefined || + sessionMetaTitleNeedsMigration(existing, this.data) + ) { this.data = { ...this.data, agents: this.data.agents ?? {}, custom: this.data.custom ?? {}, }; - await this.store.set(this.scope, META_KEY, this.data); + await this.store.set(this.scope, META_KEY, encodeSessionMeta(this.data)); } return; } @@ -222,7 +254,7 @@ export class SessionMetadata extends Service implements ISessionMetadata { agents: {}, custom: {}, }; - await this.store.set(this.scope, META_KEY, this.data); + await this.store.set(this.scope, META_KEY, encodeSessionMeta(this.data)); this.mirrorToReadModel(); this.log.debug('session metadata created', { sessionId: this.ctx.sessionId }); } @@ -248,28 +280,83 @@ function recordEquals(a: AgentMeta['labels'], b: AgentMeta['labels']): boolean { } export function normalizeSessionMeta(raw: SessionMeta, sessionId: string): SessionMeta { - const legacy = raw as unknown as { - createdAt?: unknown; - updatedAt?: unknown; - workDir?: unknown; - }; + const legacy = raw as unknown as LegacySessionMeta; + const normalizedTitle = normalizeSessionTitle(legacy); + const { + createdAt: legacyCreatedAt, + updatedAt: legacyUpdatedAt, + workDir: legacyWorkDir, + titleSource: _legacyTitleSource, + isCustomTitle: _legacyIsCustomTitle, + customTitle: _legacyCustomTitle, + ...clean + } = legacy; const cwd = - raw.cwd ?? (typeof legacy.workDir === 'string' && legacy.workDir.length > 0 - ? legacy.workDir + clean.cwd ?? (typeof legacyWorkDir === 'string' && legacyWorkDir.length > 0 + ? legacyWorkDir : undefined); - if (raw.version === SESSION_META_VERSION) { - return cwd === raw.cwd ? raw : { ...raw, cwd }; - } + const { title, titleKind } = normalizedTitle; return { - ...raw, - id: sessionId, + ...clean, + id: clean.version === SESSION_META_VERSION ? clean.id : sessionId, version: SESSION_META_VERSION, cwd, - createdAt: toEpochMs(legacy.createdAt), - updatedAt: toEpochMs(legacy.updatedAt), + title, + titleKind, + createdAt: toEpochMs(legacyCreatedAt), + updatedAt: toEpochMs(legacyUpdatedAt), }; } +type LegacySessionMeta = Omit & { + readonly createdAt?: unknown; + readonly updatedAt?: unknown; + readonly workDir?: unknown; + readonly titleSource?: unknown; + readonly isCustomTitle?: unknown; + readonly customTitle?: unknown; +}; + +function normalizeSessionTitle( + raw: LegacySessionMeta, +): Pick { + const title = typeof raw.title === 'string' ? raw.title : undefined; + if (title !== undefined && raw.isCustomTitle === true) { + return { title, titleKind: 'custom' }; + } + if (title !== undefined && isSessionTitleKind(raw.titleKind)) { + return { title, titleKind: raw.titleKind }; + } + if (title !== undefined && raw.isCustomTitle === false) { + return { title, titleKind: 'replaceable' }; + } + if (typeof raw.customTitle === 'string') { + return { title: raw.customTitle, titleKind: 'custom' }; + } + return title === undefined ? {} : { title, titleKind: 'replaceable' }; +} + +function isSessionTitleKind(value: unknown): value is SessionTitleKind { + return value === 'replaceable' || value === 'generated' || value === 'custom'; +} + +type PersistedSessionMeta = SessionMeta & { readonly isCustomTitle: boolean }; + +function encodeSessionMeta(meta: SessionMeta): PersistedSessionMeta { + return { ...meta, isCustomTitle: meta.titleKind === 'custom' }; +} + +function sessionMetaTitleNeedsMigration(raw: SessionMeta, normalized: SessionMeta): boolean { + const record = raw as unknown as Record; + return ( + raw.title !== normalized.title || + raw.titleKind !== normalized.titleKind || + record['isCustomTitle'] !== (normalized.titleKind === 'custom') || + Object.hasOwn(record, 'titleSource') || + Object.hasOwn(record, 'customTitle') + ); +} + export function toEpochMs(value: unknown): number { if (typeof value === 'number' && Number.isFinite(value)) return value; if (typeof value === 'string') { diff --git a/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSource.ts b/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSource.ts new file mode 100644 index 00000000000..98bb4f96f1d --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSource.ts @@ -0,0 +1,44 @@ +/** + * `sessionTitle` domain (L6) — title prompt projection contract. + * + * Defines the Agent-scoped `IAgentTitlePromptSource` used to read the first + * active natural-language prompts from the live conversation context, plus + * the turn excerpts behind the `first_turn` / `digest` title sources. + */ + +import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; + +/** + * The first turn's excerpt: the opening natural-language user prompt and the + * final assistant text of that turn. Either side is `undefined` when the + * live window does not (yet) hold it — `first_turn` generation stays strict + * and reports unavailability instead of degrading. + */ +export interface TitleTurnExcerpt { + readonly user?: string | undefined; + readonly assistant?: string | undefined; +} + +/** + * The whole-conversation digest excerpt: the first and last natural-language + * user prompts (collapsed into one when the conversation has a single + * prompt) and the final assistant text of the latest turn. + */ +export interface TitleDigestExcerpt { + readonly firstUser?: string | undefined; + readonly lastUser?: string | undefined; + readonly assistant?: string | undefined; +} + +export interface IAgentTitlePromptSource { + readonly _serviceBrand: undefined; + + firstUserPrompts(limit: number): Promise; + + firstTurnExcerpt(): Promise; + + digestExcerpt(): Promise; +} + +export const IAgentTitlePromptSource: ServiceIdentifier = + createDecorator('agentTitlePromptSource'); diff --git a/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSourceService.ts b/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSourceService.ts new file mode 100644 index 00000000000..45edbab576f --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/agentTitlePromptSourceService.ts @@ -0,0 +1,136 @@ +/** + * `sessionTitle` domain (L6) — `IAgentTitlePromptSource` implementation. + * + * Reads the first active natural-language prompts from the live `contextMemory` + * window, merging the `prompt` queue so submissions waiting behind an active + * turn are visible, and projects the turn excerpts behind the `first_turn` / + * `digest` title sources: assistant segments keep only the final natural + * language text of the turn (tool calls, thinking, and media parts never + * contribute; the shared metadata sanitizer redacts secrets and long + * base64-looking runs). The window may be post-compaction — acceptable for + * title generation: compaction keeps the head user messages, and a title + * derived from the surviving tail is a fine degradation. Bound at Agent + * scope. + */ + +import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; +import { LifecycleScope } from '#/app/scopes'; +import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; +import type { ContextMessage } from '#/agent/contextMemory/types'; +import { IAgentPromptService } from '#/agent/prompt/prompt'; +import { + promptMetadataTextFromContentParts, + promptMetadataTextFromText, +} from '#/agent/prompt/promptMetadataText'; +import type { ContentPart } from '#/kosong/contract/message'; + +import { + IAgentTitlePromptSource, + type TitleDigestExcerpt, + type TitleTurnExcerpt, +} from './agentTitlePromptSource'; + +export class AgentTitlePromptSourceService implements IAgentTitlePromptSource { + declare readonly _serviceBrand: undefined; + + constructor( + @IAgentContextMemoryService private readonly context: IAgentContextMemoryService, + @IAgentPromptService private readonly prompt: IAgentPromptService, + ) {} + + async firstUserPrompts(limit: number): Promise { + if (!Number.isSafeInteger(limit) || limit <= 0) return []; + + const result: string[] = []; + const seenMessageIds = new Set(); + + const add = (message: ContextMessage): void => { + if (result.length >= limit || !isNaturalLanguagePrompt(message)) return; + if (message.id !== undefined) { + if (seenMessageIds.has(message.id)) return; + seenMessageIds.add(message.id); + } + const text = promptMetadataTextFromContentParts(message.content); + if (text !== undefined) result.push(text); + }; + + for (const message of this.combinedMessages()) add(message); + return result; + } + + async firstTurnExcerpt(): Promise { + const all = this.combinedMessages(); + const firstUserIndex = all.findIndex(isNaturalLanguagePrompt); + if (firstUserIndex < 0) return {}; + const user = promptMetadataTextFromContentParts(all[firstUserIndex]!.content); + const span: ContextMessage[] = []; + for (const message of all.slice(firstUserIndex + 1)) { + if (isNaturalLanguagePrompt(message)) break; + span.push(message); + } + return { user, assistant: finalAssistantText(span) }; + } + + async digestExcerpt(): Promise { + const all = this.combinedMessages(); + const firstUserIndex = all.findIndex(isNaturalLanguagePrompt); + if (firstUserIndex < 0) return {}; + let lastUserIndex = -1; + for (let index = all.length - 1; index >= 0; index--) { + if (isNaturalLanguagePrompt(all[index]!)) { + lastUserIndex = index; + break; + } + } + const firstUser = promptMetadataTextFromContentParts(all[firstUserIndex]!.content); + const lastUser = + lastUserIndex > firstUserIndex + ? promptMetadataTextFromContentParts(all[lastUserIndex]!.content) + : undefined; + const assistant = + finalAssistantText(all.slice(lastUserIndex + 1)) ?? + finalAssistantText(all.slice(firstUserIndex + 1)); + return { firstUser, lastUser, assistant }; + } + + private combinedMessages(): ContextMessage[] { + const queue = this.prompt.list(); + const all = [...this.context.get()]; + if (queue.active !== undefined) all.push(queue.active.message); + for (const item of queue.pending) all.push(item.message); + return all; + } +} + +function isNaturalLanguagePrompt(message: ContextMessage): boolean { + if (message.role !== 'user') return false; + const origin = message.origin; + return origin === undefined || origin.kind === 'user'; +} + +function finalAssistantText(messages: readonly ContextMessage[]): string | undefined { + for (let index = messages.length - 1; index >= 0; index--) { + const message = messages[index]!; + if (message.role !== 'assistant') continue; + const text = assistantTextFromContentParts(message.content); + if (text !== undefined) return text; + } + return undefined; +} + +function assistantTextFromContentParts(parts: readonly ContentPart[]): string | undefined { + const texts: string[] = []; + for (const part of parts) { + if (part.type === 'text' && part.text.trim().length > 0) texts.push(part.text); + } + if (texts.length === 0) return undefined; + return promptMetadataTextFromText(texts.join('\n')); +} + +registerScopedService( + LifecycleScope.Agent, + IAgentTitlePromptSource, + AgentTitlePromptSourceService, + ScopeActivation.OnDemand, + 'sessionTitle', +); diff --git a/packages/agent-core-v2/src/session/sessionTitle/flag.ts b/packages/agent-core-v2/src/session/sessionTitle/flag.ts new file mode 100644 index 00000000000..0303878b291 --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/flag.ts @@ -0,0 +1,25 @@ +/** + * `sessionTitle` domain — experimental flag for AI session title generation. + * + * Gates every `generateTitle` entry point (the kap-server route, klient, and + * through them the desktop/web auto trigger and rename-field action). Off by + * default; enable via `KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE`, the master + * `KIMI_CODE_EXPERIMENTAL_FLAG`, or the `[experimental]` config section. + */ + +import { type FlagDefinitionInput, registerFlagDefinition } from '#/app/flag/flagRegistry'; + +export const AUTO_SESSION_TITLE_FLAG_ID = 'auto_session_title'; +export const AUTO_SESSION_TITLE_FLAG_ENV = 'KIMI_CODE_EXPERIMENTAL_AUTO_SESSION_TITLE'; + +export const sessionTitleFlag: FlagDefinitionInput = { + id: AUTO_SESSION_TITLE_FLAG_ID, + title: 'AI session titles', + description: + 'Generate concise session titles from the conversation through the managed chat_title tool: clients auto-generate once the first turn completes and offer on-demand regeneration in the rename field.', + env: AUTO_SESSION_TITLE_FLAG_ENV, + default: false, + surface: 'core', +}; + +registerFlagDefinition(sessionTitleFlag); diff --git a/packages/agent-core-v2/src/session/sessionTitle/sessionTitle.ts b/packages/agent-core-v2/src/session/sessionTitle/sessionTitle.ts new file mode 100644 index 00000000000..b5e36709388 --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/sessionTitle.ts @@ -0,0 +1,35 @@ +/** + * `sessionTitle` domain (L6) — session title generation contract. + * + * Defines the Session-scoped `ISessionTitleService` that generates a + * session title from the main Agent's conversation history. An + * already-generated title is not regenerated; a custom title is never + * overwritten — unless the caller passes `force` (an explicit + * user-requested regeneration). + */ + +import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; + +/** + * Which conversation excerpt a title generation draws from: + * - `user_prompts` (default): the first natural-language user prompts. + * - `first_turn`: the opening user prompt plus the first turn's final + * assistant text; strict — unavailable until the first turn has produced + * an assistant reply. + * - `digest`: first user prompt + latest user prompt + the latest turn's + * final assistant text, using whatever the (possibly compacted) window + * still holds; meant for explicit regeneration on multi-turn sessions. + */ +export type SessionTitleSource = 'user_prompts' | 'first_turn' | 'digest'; + +export interface ISessionTitleService { + readonly _serviceBrand: undefined; + + generateTitle(opts?: { + force?: boolean; + source?: SessionTitleSource; + }): Promise; +} + +export const ISessionTitleService: ServiceIdentifier = + createDecorator('sessionTitleService'); diff --git a/packages/agent-core-v2/src/session/sessionTitle/sessionTitleService.ts b/packages/agent-core-v2/src/session/sessionTitle/sessionTitleService.ts new file mode 100644 index 00000000000..1d45e9ea5f0 --- /dev/null +++ b/packages/agent-core-v2/src/session/sessionTitle/sessionTitleService.ts @@ -0,0 +1,229 @@ +/** + * `sessionTitle` domain (L6) — `ISessionTitleService` implementation. + * + * Generates the session's title from the first active prompts in the main + * Agent's live conversation context through the managed platform `/tools` + * `chat_title` endpoint, persists it through + * `sessionMetadata`, and rebroadcasts `session.meta.updated`. + * Generation is on demand only: `generateTitle()` is the single entry point + * (the kap-server route), gated by the experimental `auto_session_title` flag and + * a managed Kimi Code OAuth login; any + * failure degrades to keeping the current title, and a custom title set by + * the user is never overwritten. An already-generated title is not + * regenerated. Concurrent calls coalesce onto one shared in-flight + * generation. `force` requests an explicit user-driven regeneration: it + * bypasses the in-flight coalescing and both title-kind guards, and the + * applied title is marked `generated` (a previous custom marking is + * dropped). The `source` option picks the conversation excerpt sent to the + * backend (see `SessionTitleSource`): the default first-prompts window, the + * strict `first_turn` user+assistant pair, or the head+tail `digest` for + * multi-turn regeneration. + * Provider config comes + * from `provider`, the bearer token from `auth`, host identity headers from + * `model`, prompt history from `agentLifecycle`/`sessionTitle`, and logs + * through `log`. Bound at Session scope. + */ + +import { + KIMI_CODE_PROVIDER_NAME, + OAuthError, + fetchChatTitle, + kimiCodeToolsUrl, + parseKimiCodeCustomHeaders, + resolveKimiCodeRuntimeAuth, +} from '@moonshot-ai/kimi-code-oauth'; + +import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; +import { LifecycleScope } from '#/app/scopes'; +import { IFlagService } from '#/app/flag/flag'; +import { ILogService } from '#/_base/log/log'; +import { IOAuthService } from '#/app/auth/auth'; +import { IEventService } from '#/app/event/event'; +import { IAgentLifecycleService, MAIN_AGENT_ID } from '#/session/agentLifecycle/agentLifecycle'; +import { IHostRequestHeaders } from '#/kosong/model/hostRequestHeaders'; +import { IProviderService } from '#/kosong/provider/provider'; +import { isOAuthCatalogVendor } from '#/kosong/provider/providerDefinition'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; + +import { IAgentTitlePromptSource } from './agentTitlePromptSource'; +import { AUTO_SESSION_TITLE_FLAG_ID } from './flag'; +import { ISessionTitleService, type SessionTitleSource } from './sessionTitle'; + +const MAX_GENERATED_TITLE_LENGTH = 200; + +const MAX_TITLE_INPUT_LENGTH = 1000; + +const MAX_TITLE_PROMPTS = 3; + +/** Per-segment excerpt budgets inside the composed chat_content. */ +const MAX_TITLE_USER_SEGMENT = 300; + +const MAX_TITLE_FIRST_TURN_ASSISTANT = 600; + +const MAX_TITLE_DIGEST_ASSISTANT = 400; + +export class SessionTitleService implements ISessionTitleService { + declare readonly _serviceBrand: undefined; + + private _shared: Promise | undefined; + + constructor( + @ISessionContext private readonly ctx: ISessionContext, + @ISessionMetadata private readonly metadata: ISessionMetadata, + @IAgentLifecycleService private readonly agentLifecycle: IAgentLifecycleService, + @IEventService private readonly eventService: IEventService, + @IProviderService private readonly providers: IProviderService, + @IOAuthService private readonly oauth: IOAuthService, + @IHostRequestHeaders private readonly hostHeaders: IHostRequestHeaders, + @IFlagService private readonly flags: IFlagService, + @ILogService private readonly log: ILogService, + ) {} + + async generateTitle(opts?: { + force?: boolean; + source?: SessionTitleSource; + }): Promise { + const force = opts?.force === true; + const source = opts?.source ?? 'user_prompts'; + if (force) return this.generateTitleOnce(true, source); + if (this._shared !== undefined) return this._shared; + const tracked = this.generateTitleOnce(false, source).finally(() => { + if (this._shared === tracked) this._shared = undefined; + }); + this._shared = tracked; + return tracked; + } + + private async generateTitleOnce( + force: boolean, + source: SessionTitleSource, + ): Promise { + if (!this.flags.enabled(AUTO_SESSION_TITLE_FLAG_ID)) return undefined; + const current = await this.metadata.read(); + if (!force) { + if (current.titleKind === 'custom') return undefined; + if (current.titleKind === 'generated') return undefined; + } + const main = this.agentLifecycle.get(MAIN_AGENT_ID); + if (main === undefined) return undefined; + const promptSource = main.accessor.get(IAgentTitlePromptSource); + const input = await composeTitleInput(promptSource, source); + if (input === undefined) return undefined; + return this.generateAndApply(input, force); + } + + private async generateAndApply( + chatContent: string, + force: boolean, + ): Promise { + const current = await this.metadata.read(); + if (!force && current.titleKind === 'custom') return undefined; + const provider = this.providers.get(KIMI_CODE_PROVIDER_NAME); + if ( + provider === undefined || + !isOAuthCatalogVendor(provider.type) || + provider.oauth === undefined + ) { + return undefined; + } + const runtimeAuth = resolveKimiCodeRuntimeAuth({ + configuredBaseUrl: provider.baseUrl, + configuredOAuthRef: provider.oauth, + }); + const tokenProvider = this.oauth.resolveTokenProvider( + KIMI_CODE_PROVIDER_NAME, + runtimeAuth.oauthRef, + ); + if (tokenProvider === undefined) return undefined; + let token: string; + try { + token = await tokenProvider.getAccessToken(); + } catch (error) { + if (!(error instanceof OAuthError)) throw error; + this.log.debug(`chat_title request unavailable: ${error.message}`); + return undefined; + } + const requestTitle = (accessToken: string) => + fetchChatTitle(kimiCodeToolsUrl(runtimeAuth.baseUrl), accessToken, chatContent, { + headers: { + ...parseKimiCodeCustomHeaders(), + ...this.hostHeaders.headers, + ...provider.customHeaders, + }, + }); + let result = await requestTitle(token); + if (result.kind === 'error' && result.status === 401) { + try { + token = await tokenProvider.getAccessToken({ force: true }); + } catch (error) { + if (!(error instanceof OAuthError)) throw error; + this.log.debug(`chat_title request unavailable: ${error.message}`); + return undefined; + } + result = await requestTitle(token); + } + if (result.kind !== 'ok') { + this.log.debug(`chat_title request failed: ${result.message}`); + return undefined; + } + const title = result.title.slice(0, MAX_GENERATED_TITLE_LENGTH); + const applied = await this.metadata.setGeneratedTitleIfUncustomized(title, { force }); + if (!applied) return undefined; + this.eventService.publish({ + type: 'session.meta.updated', + payload: { + agentId: 'main', + sessionId: this.ctx.sessionId, + title, + patch: { title, isCustomTitle: false }, + }, + }); + return title; + } +} + +function titleInputFromPrompts(prompts: readonly string[]): string | undefined { + if (prompts.length === 0) return undefined; + return prompts + .map((prompt) => `user: ${prompt}`) + .join('\n') + .slice(0, MAX_TITLE_INPUT_LENGTH); +} + +async function composeTitleInput( + promptSource: IAgentTitlePromptSource, + source: SessionTitleSource, +): Promise { + if (source === 'first_turn') { + const excerpt = await promptSource.firstTurnExcerpt(); + if (excerpt.user === undefined || excerpt.assistant === undefined) return undefined; + return [ + `user: ${excerpt.user.slice(0, MAX_TITLE_USER_SEGMENT)}`, + `assistant: ${excerpt.assistant.slice(0, MAX_TITLE_FIRST_TURN_ASSISTANT)}`, + ].join('\n'); + } + if (source === 'digest') { + const excerpt = await promptSource.digestExcerpt(); + const lines: string[] = []; + if (excerpt.firstUser !== undefined) { + lines.push(`user: ${excerpt.firstUser.slice(0, MAX_TITLE_USER_SEGMENT)}`); + } + if (excerpt.lastUser !== undefined) { + lines.push(`user: ${excerpt.lastUser.slice(0, MAX_TITLE_USER_SEGMENT)}`); + } + if (excerpt.assistant !== undefined) { + lines.push(`assistant: ${excerpt.assistant.slice(0, MAX_TITLE_DIGEST_ASSISTANT)}`); + } + return lines.length === 0 ? undefined : lines.join('\n'); + } + return titleInputFromPrompts(await promptSource.firstUserPrompts(MAX_TITLE_PROMPTS)); +} + +registerScopedService( + LifecycleScope.Session, + ISessionTitleService, + SessionTitleService, + ScopeActivation.OnScopeCreated, + 'sessionTitle', +); diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts index 7942c9a2f04..22493e986c6 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts @@ -574,7 +574,7 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec await targetMeta.update({ title, - isCustomTitle: opts.title !== undefined ? true : sourceMeta?.isCustomTitle === true, + titleKind: opts.title !== undefined ? 'custom' : 'replaceable', forkedFrom: sourceId, archived: false, updatedAt: toEpochMs(sourceMeta?.updatedAt) || Date.now(), diff --git a/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts b/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts index 629d1fa58a3..e93d59ff9ba 100644 --- a/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts +++ b/packages/agent-core-v2/test/agent/prompt/promptMetadataText.test.ts @@ -7,12 +7,24 @@ * - an inline image-compression caption (harness metadata placed next to * the image by prompt ingestion) never leaks into titles/lastPrompt, * whether it is a standalone text part or merged into the user's text + * - prompt metadata updates retain the latest sanitized prompt and derive + * the easy title */ import { describe, expect, it } from 'vitest'; import { promptMetadataTextFromContentParts } from '#/agent/prompt/promptMetadataText'; +import { + applyPromptMetadataUpdate, + type PromptMetadataUpdateTarget, +} from '#/session/sessionMetadata/promptMetadata'; import { buildImageCompressionCaption } from '#/agent/media/image-compress'; +import type { IEventService } from '#/app/event/event'; +import { + type ISessionMetadata, + type SessionMeta, + type SessionMetaPatch, +} from '#/session/sessionMetadata/sessionMetadata'; const CAPTION = buildImageCompressionCaption({ original: { width: 3264, height: 666, byteLength: 344 * 1024, mimeType: 'image/png' }, @@ -47,3 +59,47 @@ describe('promptMetadataTextFromContentParts', () => { expect(text).not.toContain('Image compressed'); }); }); + +describe('applyPromptMetadataUpdate', () => { + function createTarget(initial: Partial = {}) { + let meta: SessionMeta = { + id: 'sess-1', + createdAt: 0, + updatedAt: 0, + archived: false, + ...initial, + }; + const target: PromptMetadataUpdateTarget = { + metadata: { + read: () => Promise.resolve(meta), + update: (patch: SessionMetaPatch) => { + meta = { ...meta, ...patch }; + return Promise.resolve(); + }, + } as unknown as ISessionMetadata, + eventService: { publish: () => undefined } as unknown as IEventService, + sessionId: 'sess-1', + }; + return { target, readMeta: () => meta }; + } + + it('updates the latest prompt and derives the easy title', async () => { + const { target, readMeta } = createTarget(); + + await applyPromptMetadataUpdate(target, '第一条'); + await applyPromptMetadataUpdate(target, '第二条'); + + expect(readMeta().lastPrompt).toBe('第二条'); + expect(readMeta().title).toBe('第一条'); + expect(readMeta().titleKind).toBe('replaceable'); + }); + + it('updates metadata for slash activations', async () => { + const { target, readMeta } = createTarget(); + + await applyPromptMetadataUpdate(target, '/compact'); + + expect(readMeta().lastPrompt).toBe('/compact'); + expect(readMeta().title).toBe('/compact'); + }); +}); diff --git a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts index 2e2c9fd03e6..64877659093 100644 --- a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts +++ b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts @@ -1021,6 +1021,7 @@ function stubSessionMetadata(meta: SessionMeta): ISessionMetadata { read: async () => meta, update: async () => {}, setTitle: async () => {}, + setGeneratedTitleIfUncustomized: async () => false, setArchived: async () => {}, registerAgent: async () => {}, }; diff --git a/packages/agent-core-v2/test/app/sessionIndex/sessionIndex.test.ts b/packages/agent-core-v2/test/app/sessionIndex/sessionIndex.test.ts index 85410d3da9c..aba48963990 100644 --- a/packages/agent-core-v2/test/app/sessionIndex/sessionIndex.test.ts +++ b/packages/agent-core-v2/test/app/sessionIndex/sessionIndex.test.ts @@ -371,7 +371,7 @@ describe('FileSessionIndex (read model)', () => { await fsp.writeFile(join(dir, 'state.json'), JSON.stringify(meta)); } - function summary(id: string, overrides: Partial = {}): SessionSummary { + function summary(id: string, overrides: Partial = {}) { return { id, workspaceId, diff --git a/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts b/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts index d1b46fc822d..77e5a5b6e30 100644 --- a/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts +++ b/packages/agent-core-v2/test/app/workspaceLifecycle/workspaceLifecycle.test.ts @@ -155,6 +155,7 @@ function sessionStubs(): ReturnType[] { read: () => Promise.resolve({} as never), update: () => Promise.resolve(), setTitle: () => Promise.resolve(), + setGeneratedTitleIfUncustomized: () => Promise.resolve(false), setArchived: () => Promise.resolve(), registerAgent: () => Promise.resolve(), } satisfies ISessionMetadata), diff --git a/packages/agent-core-v2/test/session/sessionMetadata/sessionMetadata.test.ts b/packages/agent-core-v2/test/session/sessionMetadata/sessionMetadata.test.ts index c4c199f1147..fe6b7b597e3 100644 --- a/packages/agent-core-v2/test/session/sessionMetadata/sessionMetadata.test.ts +++ b/packages/agent-core-v2/test/session/sessionMetadata/sessionMetadata.test.ts @@ -1,4 +1,4 @@ -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { SyncDescriptor } from '#/_base/di/descriptors'; import { DisposableStore } from '#/_base/di/lifecycle'; @@ -56,7 +56,10 @@ describe('SessionMetadata', () => { ix.set(ISessionMetadata, new SyncDescriptor(SessionMetadata)); }); - afterEach(() => { disposables.dispose(); }); + afterEach(() => { + disposables.dispose(); + vi.restoreAllMocks(); + }); it('creates an initial document on first read', async () => { const meta = ix.get(ISessionMetadata); @@ -94,7 +97,17 @@ describe('SessionMetadata', () => { const meta = ix.get(ISessionMetadata); await meta.setTitle('t'); await meta.setArchived(true); - expect(await meta.read()).toMatchObject({ title: 't', archived: true }); + expect(await meta.read()).toMatchObject({ title: 't', titleKind: 'custom', archived: true }); + }); + + it('sets a generated title while the metadata remains uncustomized', async () => { + const meta = ix.get(ISessionMetadata); + + await expect(meta.setGeneratedTitleIfUncustomized('generated title')).resolves.toBe(true); + await expect(meta.read()).resolves.toMatchObject({ + title: 'generated title', + titleKind: 'generated', + }); }); it('setTitle keeps updatedAt (rename must not reorder listings)', async () => { @@ -236,6 +249,264 @@ describe('SessionMetadata', () => { expect(healed.updatedAt).toBe(1700000000000); }); + it('normalizes the legacy customTitle field before callers read metadata', async () => { + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + customTitle: 'legacy title', + }); + + const meta = ix.get(ISessionMetadata); + await expect(meta.read()).resolves.toMatchObject({ + title: 'legacy title', + titleKind: 'custom', + }); + + const fresh = createFreshMetadata(ix); + await expect(fresh.read()).resolves.toMatchObject({ + title: 'legacy title', + titleKind: 'custom', + }); + }); + + it('trusts modern custom title state over a stale legacy customTitle', async () => { + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + title: 'renamed title', + isCustomTitle: true, + customTitle: 'legacy custom title', + }); + + const meta = ix.get(ISessionMetadata); + await expect(meta.read()).resolves.toMatchObject({ + title: 'renamed title', + titleKind: 'custom', + }); + + await meta.update({ archived: true }); + const fresh = createFreshMetadata(ix); + await expect(fresh.read()).resolves.toMatchObject({ + title: 'renamed title', + titleKind: 'custom', + archived: true, + }); + const persisted = await store.get>(META_SCOPE, 'state.json'); + // The v1-readable marker is double-written (derived from titleKind); + // only the pre-`isCustomTitle` legacy field is stripped. + expect(persisted).toMatchObject({ isCustomTitle: true }); + expect(persisted).not.toHaveProperty('customTitle'); + }); + + it('migrates a legacy non-custom title to replaceable title state', async () => { + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + title: 'prompt title', + isCustomTitle: false, + agents: {}, + custom: {}, + }); + + const meta = ix.get(ISessionMetadata); + + await expect(meta.read()).resolves.toMatchObject({ + title: 'prompt title', + titleKind: 'replaceable', + }); + const persisted = await store.get>(META_SCOPE, 'state.json'); + expect(persisted).toMatchObject({ + title: 'prompt title', + titleKind: 'replaceable', + isCustomTitle: false, + }); + }); + + it('honors a legacy writer custom marker over the stale titleKind it left behind', async () => { + // The mixed-version round trip: v2 persists a replaceable title, then a + // released v1 build renames the session — its writer spreads the original + // document, so `isCustomTitle: true` lands next to the stale + // `titleKind: 'replaceable'`. The explicit custom marker must win, or the + // next auto generation would overwrite the user's title. + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + title: '用户手工标题', + titleKind: 'replaceable', + isCustomTitle: true, + agents: {}, + custom: {}, + }); + + const meta = ix.get(ISessionMetadata); + await expect(meta.read()).resolves.toMatchObject({ + title: '用户手工标题', + titleKind: 'custom', + }); + + // The heal persists the upgraded state — v1 keeps reading it as custom. + const persisted = await store.get>(META_SCOPE, 'state.json'); + expect(persisted).toMatchObject({ titleKind: 'custom', isCustomTitle: true }); + + const fresh = createFreshMetadata(ix); + await expect(fresh.read()).resolves.toMatchObject({ + title: '用户手工标题', + titleKind: 'custom', + }); + // A generated title must not replace the upgraded custom title. + await expect(fresh.setGeneratedTitleIfUncustomized('generated title')).resolves.toBe(false); + }); + + it('double-writes the derived isCustomTitle marker for v1 readers', async () => { + const store = ix.get(IAtomicDocumentStore); + const meta = ix.get(ISessionMetadata); + + await meta.setGeneratedTitleIfUncustomized('generated title'); + await expect(store.get>(META_SCOPE, 'state.json')).resolves.toMatchObject( + { titleKind: 'generated', isCustomTitle: false }, + ); + + await meta.setTitle('user title'); + await expect(store.get>(META_SCOPE, 'state.json')).resolves.toMatchObject( + { titleKind: 'custom', isCustomTitle: true }, + ); + }); + + it('does not downgrade a modern titleKind on a legacy false marker', async () => { + // The double-written pair as this build persists it: the `false` marker + // is informational and must not demote the generated state. + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + title: 'generated title', + titleKind: 'generated', + isCustomTitle: false, + agents: {}, + custom: {}, + }); + + const meta = ix.get(ISessionMetadata); + await expect(meta.read()).resolves.toMatchObject({ + title: 'generated title', + titleKind: 'generated', + }); + }); + + it.each([ + // [document title fields, expected titleKind] — the mixed-version matrix. + [{ isCustomTitle: true, titleKind: 'generated' as const }, 'custom'], + [{ isCustomTitle: true, titleKind: 'replaceable' as const }, 'custom'], + [{ isCustomTitle: true }, 'custom'], + [{ isCustomTitle: false, titleKind: 'custom' as const }, 'custom'], + [{ isCustomTitle: false, titleKind: 'generated' as const }, 'generated'], + [{ isCustomTitle: false }, 'replaceable'], + [{ titleKind: 'generated' as const }, 'generated'], + [{ customTitle: 'legacy title' }, 'custom'], + [{}, 'replaceable'], + ])('normalizes title state %j to titleKind %s', async (fields, expectedKind) => { + const store = ix.get(IAtomicDocumentStore); + const title = 'customTitle' in fields ? undefined : 'some title'; + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + ...(title === undefined ? {} : { title }), + ...fields, + agents: {}, + custom: {}, + }); + + const meta = ix.get(ISessionMetadata); + expect((await meta.read()).titleKind).toBe(expectedKind); + }); + + it('migrates the title state once, not on every load', async () => { + const store = ix.get(IAtomicDocumentStore); + await store.set(META_SCOPE, 'state.json', { + id: 's1', + version: 2, + createdAt: 1700000000000, + updatedAt: 1700000000000, + archived: false, + title: '用户手工标题', + titleKind: 'replaceable', + isCustomTitle: true, + agents: {}, + custom: {}, + }); + + const first = ix.get(ISessionMetadata); + await first.ready; + const setSpy = vi.spyOn(store, 'set'); + const fresh = createFreshMetadata(ix); + await fresh.ready; + + // The first load already healed the document; the second load sees a + // consistent pair and must not write again. + expect(setSpy).not.toHaveBeenCalled(); + expect((await fresh.read()).titleKind).toBe('custom'); + }); + + it('keeps a queued custom title when a generated title is enqueued afterward', async () => { + const meta = ix.get(ISessionMetadata); + await meta.ready; + const store = ix.get(IAtomicDocumentStore); + const set = store.set.bind(store); + let releaseWrite: (() => void) | undefined; + let markWriteStarted: (() => void) | undefined; + const writeStarted = new Promise((resolve) => { + markWriteStarted = resolve; + }); + const writeReleased = new Promise((resolve) => { + releaseWrite = resolve; + }); + let shouldBlock = true; + vi.spyOn(store, 'set').mockImplementation(async (scope, key, value) => { + if (shouldBlock) { + shouldBlock = false; + markWriteStarted?.(); + await writeReleased; + } + await set(scope, key, value); + }); + + const priorWrite = meta.update({ lastPrompt: 'hello' }); + await writeStarted; + const rename = meta.setTitle('user title'); + const generated = meta.setGeneratedTitleIfUncustomized('generated title'); + releaseWrite?.(); + + await priorWrite; + await rename; + await expect(generated).resolves.toBe(false); + await expect(meta.read()).resolves.toMatchObject({ + title: 'user title', + titleKind: 'custom', + }); + }); + it('leaves existing agents/custom maps untouched', async () => { const store = ix.get(IAtomicDocumentStore); await store.set(META_SCOPE, 'state.json', { diff --git a/packages/agent-core-v2/test/session/sessionTitle/agentTitlePromptSourceService.test.ts b/packages/agent-core-v2/test/session/sessionTitle/agentTitlePromptSourceService.test.ts new file mode 100644 index 00000000000..41c8f63b212 --- /dev/null +++ b/packages/agent-core-v2/test/session/sessionTitle/agentTitlePromptSourceService.test.ts @@ -0,0 +1,211 @@ +/** + * Scenario: the Agent-scoped title prompt projection reads the live context + * window and includes prompts still waiting in the live prompt queue. Wiring: + * the real source with contract-level fakes for context and prompt queue. + */ + +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; + +import { DisposableStore } from '#/_base/di/lifecycle'; +import { createServices, type TestInstantiationService } from '#/_base/di/test'; +import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; +import type { ContextMessage } from '#/agent/contextMemory/types'; +import { IAgentPromptService } from '#/agent/prompt/prompt'; +import type { ContentPart } from '#/kosong/contract/message'; +import { IAgentTitlePromptSource } from '#/session/sessionTitle/agentTitlePromptSource'; +import { AgentTitlePromptSourceService } from '#/session/sessionTitle/agentTitlePromptSourceService'; + +const USER_ORIGIN: ContextMessage['origin'] = { kind: 'user' }; + +function userMessage( + id: string, + text: string, + origin: ContextMessage['origin'] = USER_ORIGIN, +): ContextMessage { + return { + id, + role: 'user', + content: [{ type: 'text', text }], + toolCalls: [], + origin, + }; +} + +function assistantMessage(id: string, parts: ContentPart[]): ContextMessage { + return { id, role: 'assistant', content: parts, toolCalls: [] }; +} + +function toolMessage(id: string, text: string): ContextMessage { + return { id, role: 'tool', content: [{ type: 'text', text }], toolCalls: [] }; +} + +describe('AgentTitlePromptSource', () => { + let disposables: DisposableStore; + let ix: TestInstantiationService; + let liveMessages: readonly ContextMessage[]; + let queue: ReturnType; + + beforeEach(() => { + liveMessages = []; + queue = { active: undefined, pending: [] }; + disposables = new DisposableStore(); + ix = createServices(disposables, { + additionalServices: (reg) => { + reg.definePartialInstance(IAgentContextMemoryService, { get: () => liveMessages }); + reg.definePartialInstance(IAgentPromptService, { list: () => queue }); + reg.define(IAgentTitlePromptSource, AgentTitlePromptSourceService); + }, + }); + }); + + afterEach(() => { + disposables.dispose(); + }); + + it('returns the first three prompts from the live context and queue in order', async () => { + liveMessages = [userMessage('one', '第一条')]; + queue = { + active: undefined, + pending: [ + { + id: 'two', + userMessageId: 'two', + createdAt: '2026-01-01T00:00:00.000Z', + state: 'pending', + message: userMessage('two', '第二条'), + }, + { + id: 'three', + userMessageId: 'three', + createdAt: '2026-01-01T00:00:01.000Z', + state: 'pending', + message: userMessage('three', '第三条'), + }, + ], + }; + + await expect(ix.get(IAgentTitlePromptSource).firstUserPrompts(3)).resolves.toEqual([ + '第一条', + '第二条', + '第三条', + ]); + }); + + it('keeps the head user messages of a compacted window, skipping elision and summary', async () => { + liveMessages = [ + userMessage('head', '开场提问'), + userMessage('elision', '... omitted ...', { kind: 'injection', variant: 'compaction_elision' }), + userMessage('tail', '最近的追问'), + userMessage('summary', ' compaction summary ', { kind: 'compaction_summary' }), + ]; + + await expect(ix.get(IAgentTitlePromptSource).firstUserPrompts(3)).resolves.toEqual([ + '开场提问', + '最近的追问', + ]); + }); + + it('returns no title prompts when history contains only slash activations', async () => { + liveMessages = [ + userMessage('skill', 'expanded skill instructions', { + kind: 'skill_activation', + activationId: 'skill-1', + skillName: 'compact', + trigger: 'user-slash', + }), + userMessage('plugin', 'expanded plugin instructions', { + kind: 'plugin_command', + activationId: 'plugin-1', + pluginId: 'example-plugin', + commandName: 'run', + trigger: 'user-slash', + }), + ]; + + await expect(ix.get(IAgentTitlePromptSource).firstUserPrompts(3)).resolves.toEqual([]); + }); + + it('counts a queued prompt already appended to the context only once', async () => { + liveMessages = [userMessage('one', '同一条')]; + queue = { + active: { + id: 'one', + userMessageId: 'one', + createdAt: '2026-01-01T00:00:00.000Z', + state: 'running', + message: userMessage('one', '同一条'), + }, + pending: [], + }; + + await expect(ix.get(IAgentTitlePromptSource).firstUserPrompts(3)).resolves.toEqual(['同一条']); + }); + + it('firstTurnExcerpt pairs the opening prompt with the turn’s final assistant text', async () => { + liveMessages = [ + userMessage('u1', '帮我写一个快排'), + assistantMessage('a1-think', [{ type: 'think', think: '让我想想' }]), + assistantMessage('a1-text', [{ type: 'text', text: '好的,先写一版' }]), + toolMessage('t1', 'tool output'), + assistantMessage('a2', [ + { type: 'text', text: '这是最终版实现' }, + { type: 'image_url', imageUrl: { url: 'data:image/png;base64,AAAA' } }, + ]), + userMessage('u2', '再加个单测'), + assistantMessage('a3', [{ type: 'text', text: '第二轮的回复' }]), + ]; + + await expect(ix.get(IAgentTitlePromptSource).firstTurnExcerpt()).resolves.toEqual({ + user: '帮我写一个快排', + assistant: '这是最终版实现', + }); + }); + + it('firstTurnExcerpt reports a missing assistant reply until the turn ends', async () => { + liveMessages = [userMessage('u1', '刚发的问题')]; + + await expect(ix.get(IAgentTitlePromptSource).firstTurnExcerpt()).resolves.toEqual({ + user: '刚发的问题', + assistant: undefined, + }); + }); + + it('digestExcerpt anchors the first prompt and lands on the latest turn', async () => { + liveMessages = [ + userMessage('u1', '最初的目标'), + assistantMessage('a1', [{ type: 'text', text: '第一轮回答' }]), + userMessage('u2', '中途追问'), + assistantMessage('a2', [{ type: 'text', text: '中间回答' }]), + userMessage('u3', '最近的要求'), + assistantMessage('a3', [{ type: 'think', think: '思考中' }]), + assistantMessage('a4', [{ type: 'text', text: '最新正文' }]), + ]; + + await expect(ix.get(IAgentTitlePromptSource).digestExcerpt()).resolves.toEqual({ + firstUser: '最初的目标', + lastUser: '最近的要求', + assistant: '最新正文', + }); + }); + + it('digestExcerpt collapses a single-prompt conversation and skips dangling questions', async () => { + liveMessages = [ + userMessage('u1', '唯一的问题'), + assistantMessage('a1', [{ type: 'text', text: '唯一的回答' }]), + userMessage('u2', '还没得到回复的新问题'), + ]; + + await expect(ix.get(IAgentTitlePromptSource).digestExcerpt()).resolves.toEqual({ + firstUser: '唯一的问题', + lastUser: '还没得到回复的新问题', + assistant: '唯一的回答', + }); + + liveMessages = [userMessage('u1', '唯一的问题')]; + await expect(ix.get(IAgentTitlePromptSource).digestExcerpt()).resolves.toEqual({ + firstUser: '唯一的问题', + lastUser: undefined, + assistant: undefined, + }); + }); +}); diff --git a/packages/agent-core-v2/test/session/sessionTitle/sessionTitleService.test.ts b/packages/agent-core-v2/test/session/sessionTitle/sessionTitleService.test.ts new file mode 100644 index 00000000000..7cd64dd3373 --- /dev/null +++ b/packages/agent-core-v2/test/session/sessionTitle/sessionTitleService.test.ts @@ -0,0 +1,574 @@ +/** + * Scenario: on-demand managed chat_title generation through the session-scoped + * service, including OAuth failures, title-state transitions, request headers, + * and races. + * Wiring: the real title service with contract fakes; only fetch crosses the + * external boundary. Run with `pnpm --filter @moonshot-ai/agent-core-v2 exec + * vitest run test/session/sessionTitle/sessionTitleService.test.ts`. + */ + +import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'; + +import { OAuthConnectionError, OAuthUnauthorizedError } from '@moonshot-ai/kimi-code-oauth'; + +import { DisposableStore, type IDisposable } from '#/_base/di/lifecycle'; +import { type IAgentScopeHandle } from '#/_base/di/scope'; +import { LifecycleScope } from '#/app/scopes'; +import { createServices, type TestInstantiationService } from '#/_base/di/test'; +import { Emitter } from '#/_base/event'; +import { IOAuthService } from '#/app/auth/auth'; +import { IFlagService } from '#/app/flag/flag'; +import { type DomainEvent, IEventService } from '#/app/event/event'; +import { IHostRequestHeaders } from '#/kosong/model/hostRequestHeaders'; +import { + IProviderService, + type OAuthRef, + type ProviderConfig, +} from '#/kosong/provider/provider'; +import { ISessionContext, makeSessionContext } from '#/session/sessionContext/sessionContext'; +import { + IAgentLifecycleService, + MAIN_AGENT_ID, +} from '#/session/agentLifecycle/agentLifecycle'; +import { + IAgentTitlePromptSource, + type TitleDigestExcerpt, + type TitleTurnExcerpt, +} from '#/session/sessionTitle/agentTitlePromptSource'; +import { ISessionTitleService } from '#/session/sessionTitle/sessionTitle'; +import { SessionTitleService } from '#/session/sessionTitle/sessionTitleService'; +import { + ISessionMetadata, + type SessionMeta, + type SessionMetaPatch, + type SessionMetadataChangedEvent, +} from '#/session/sessionMetadata/sessionMetadata'; +import '#/kosong/provider/providers/kimi/kimi.contrib'; + +import { registerLogServices } from '../../_base/log/stubs'; +import { stubProviderService } from '../../app/provider/stubs'; + +const SESSION_ID = 'sess-1'; +const MANAGED_PROVIDER: ProviderConfig = { + type: 'kimi', + baseUrl: 'https://api.example.test/coding/v1', + oauth: { storage: 'file', key: 'kimi-code' }, +}; + +class FakeEventService implements IEventService { + declare readonly _serviceBrand: undefined; + private readonly emitter = new Emitter(); + readonly onDidPublish = this.emitter.event; + readonly published: DomainEvent[] = []; + + publish(event: DomainEvent): void { + this.published.push(event); + this.emitter.fire(event); + } + + subscribe(handler: (event: DomainEvent) => void): IDisposable { + return this.emitter.event(handler); + } +} + +class FakeSessionMetadata implements ISessionMetadata { + declare readonly _serviceBrand: undefined; + readonly ready = Promise.resolve(); + private readonly emitter = new Emitter(); + readonly onDidChangeMetadata = this.emitter.event; + meta: SessionMeta; + + constructor() { + this.meta = { + id: SESSION_ID, + createdAt: 0, + updatedAt: 0, + archived: false, + }; + } + + read(): Promise { + return Promise.resolve(this.meta); + } + + update(patch: SessionMetaPatch): Promise { + this.meta = { ...this.meta, ...patch }; + this.emitter.fire({ changed: Object.keys(patch) as (keyof SessionMeta)[] }); + return Promise.resolve(); + } + + setTitle(title: string): Promise { + return this.update({ title, titleKind: 'custom' }); + } + + async setGeneratedTitleIfUncustomized( + title: string, + opts?: { force?: boolean }, + ): Promise { + if (opts?.force !== true && this.meta.titleKind === 'custom') return false; + await this.update({ title, titleKind: 'generated' }); + return true; + } + + setArchived(archived: boolean): Promise { + return this.update({ archived }); + } + + registerAgent(): Promise { + return Promise.resolve(); + } +} + +function createPendingFetch() { + let markStarted!: () => void; + let resolveResponse!: (response: Response) => void; + const started = new Promise((resolve) => { + markStarted = resolve; + }); + const response = new Promise((resolve) => { + resolveResponse = resolve; + }); + return { + fetch: async () => { + markStarted(); + return response; + }, + started, + resolve: resolveResponse, + }; +} + +describe('SessionTitleService', () => { + let disposables: DisposableStore; + let ix: TestInstantiationService; + let events: FakeEventService; + let metadata: FakeSessionMetadata; + let providers: Record; + let fetchMock: Mock<(url: string, init?: RequestInit) => Promise>; + let tokenError: Error | undefined; + let forceTokenError: Error | undefined; + let resolvedOAuthRefs: Array; + let titlePrompts: readonly string[]; + let promptSourceImpl: (limit: number) => Promise; + let turnExcerpt: TitleTurnExcerpt; + let digestExcerpt: TitleDigestExcerpt; + let tokenCalls: boolean[]; + let flagEnabled: boolean; + + beforeEach(() => { + tokenError = undefined; + forceTokenError = undefined; + resolvedOAuthRefs = []; + titlePrompts = []; + promptSourceImpl = async (limit) => titlePrompts.slice(0, limit); + turnExcerpt = {}; + digestExcerpt = {}; + tokenCalls = []; + flagEnabled = true; + providers = { 'managed:kimi-code': MANAGED_PROVIDER }; + metadata = new FakeSessionMetadata(); + events = new FakeEventService(); + fetchMock = vi.fn<(url: string, init?: RequestInit) => Promise>( + async () => + new Response(JSON.stringify({ title: '生成的标题' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + vi.stubGlobal('fetch', fetchMock); + + disposables = new DisposableStore(); + ix = createServices(disposables, { + base: [registerLogServices], + additionalServices: (reg) => { + reg.defineInstance( + ISessionContext, + makeSessionContext({ + sessionId: SESSION_ID, + workspaceId: 'ws-1', + sessionDir: '/tmp/sess-1', + sessionScope: 'sessions/sess-1', + cwd: '/tmp', + }), + ); + reg.defineInstance(ISessionMetadata, metadata); + const promptSource: IAgentTitlePromptSource = { + _serviceBrand: undefined, + firstUserPrompts: (limit) => promptSourceImpl(limit), + firstTurnExcerpt: async () => turnExcerpt, + digestExcerpt: async () => digestExcerpt, + }; + const mainAgent: IAgentScopeHandle = { + id: MAIN_AGENT_ID, + kind: LifecycleScope.Agent, + accessor: { get: () => promptSource as T }, + dispose: () => undefined, + }; + reg.definePartialInstance(IAgentLifecycleService, { + get: () => mainAgent, + }); + reg.defineInstance(IEventService, events); + reg.defineInstance(IProviderService, stubProviderService(providers)); + reg.definePartialInstance(IOAuthService, { + resolveTokenProvider: (_provider, oauthRef) => { + resolvedOAuthRefs.push(oauthRef); + return { + getAccessToken: async (options) => { + tokenCalls.push(options?.force === true); + if (tokenError !== undefined) throw tokenError; + if (options?.force === true && forceTokenError !== undefined) { + throw forceTokenError; + } + return 'test-token'; + }, + }; + }, + }); + reg.defineInstance(IHostRequestHeaders, { + headers: { 'User-Agent': 'test' }, + thirdPartyHeaders: {}, + }); + reg.definePartialInstance(IFlagService, { enabled: () => flagEnabled }); + reg.define(ISessionTitleService, SessionTitleService); + }, + }); + ix.get(ISessionTitleService); + }); + + afterEach(() => { + disposables.dispose(); + vi.unstubAllGlobals(); + vi.unstubAllEnvs(); + }); + + it('is unavailable while the experimental auto_session_title flag is off', async () => { + flagEnabled = false; + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + await expect( + ix.get(ISessionTitleService).generateTitle({ force: true, source: 'digest' }), + ).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('replaces the easy title with the generated one', async () => { + titlePrompts = ['帮我看一下这个 Go 的 nil pointer 报错']; + + const title = await ix.get(ISessionTitleService).generateTitle(); + + expect(title).toBe('生成的标题'); + expect(metadata.meta.title).toBe('生成的标题'); + expect(metadata.meta.titleKind).toBe('generated'); + + const [, init] = fetchMock.mock.calls[0]!; + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { chat_content: 'user: 帮我看一下这个 Go 的 nil pointer 报错' }, + }); + expect(new Headers(init?.headers as Record).get('authorization')).toBe( + 'Bearer test-token', + ); + + const rebroadcast = events.published.find( + (event) => + event.type === 'session.meta.updated' && + (event.payload as { patch?: { title?: string } }).patch?.title === '生成的标题', + ); + expect(rebroadcast).toBeDefined(); + }); + + it('composes the title input from the recorded prompts in order', async () => { + titlePrompts = ['先帮我搭一个 Vite 项目', '加上路由', '现在配一下 ESLint']; + + await ix.get(ISessionTitleService).generateTitle(); + + const [, init] = fetchMock.mock.calls[0]!; + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { + chat_content: 'user: 先帮我搭一个 Vite 项目\nuser: 加上路由\nuser: 现在配一下 ESLint', + }, + }); + }); + + it('truncates the composed title input to the total budget, keeping the head', async () => { + titlePrompts = ['很长的输入'.repeat(400), '第二条']; + + await ix.get(ISessionTitleService).generateTitle(); + + const [, init] = fetchMock.mock.calls[0]!; + const body = JSON.parse(init?.body as string) as { params: { chat_content: string } }; + expect(body.params.chat_content.startsWith('user: 很长的输入')).toBe(true); + expect(body.params.chat_content).toHaveLength(1000); + }); + + it('returns unavailable when only a slash activation updated lastPrompt', async () => { + await metadata.update({ lastPrompt: '/compact' }); + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('does nothing without a managed OAuth provider', async () => { + delete providers['managed:kimi-code']; + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('never overwrites a custom title set while generation is in flight', async () => { + const pendingFetch = createPendingFetch(); + fetchMock.mockImplementationOnce(pendingFetch.fetch); + + titlePrompts = ['hello']; + const generation = ix.get(ISessionTitleService).generateTitle(); + await pendingFetch.started; + await metadata.setTitle('user 取的标题'); + pendingFetch.resolve( + new Response(JSON.stringify({ title: '生成的标题' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + + await expect(generation).resolves.toBeUndefined(); + expect(metadata.meta.title).toBe('user 取的标题'); + expect(metadata.meta.titleKind).toBe('custom'); + }); + + it('skips generation when the current title was already generated', async () => { + await metadata.setGeneratedTitleIfUncustomized('已生成的标题'); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + expect(metadata.meta.title).toBe('已生成的标题'); + }); + + it('force regenerates an already-generated title', async () => { + await metadata.setGeneratedTitleIfUncustomized('已生成的标题'); + titlePrompts = ['hello']; + + await expect( + ix.get(ISessionTitleService).generateTitle({ force: true }), + ).resolves.toBe('生成的标题'); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(metadata.meta.title).toBe('生成的标题'); + expect(metadata.meta.titleKind).toBe('generated'); + }); + + it('force overwrites a custom title and drops its custom marking', async () => { + await metadata.setTitle('user 取的标题'); + titlePrompts = ['hello']; + + await expect( + ix.get(ISessionTitleService).generateTitle({ force: true }), + ).resolves.toBe('生成的标题'); + expect(metadata.meta.title).toBe('生成的标题'); + expect(metadata.meta.titleKind).toBe('generated'); + }); + + it('force still degrades when the backend request fails', async () => { + fetchMock.mockImplementationOnce(async () => new Response('', { status: 500 })); + await metadata.setTitle('user 取的标题'); + titlePrompts = ['hello']; + + await expect( + ix.get(ISessionTitleService).generateTitle({ force: true }), + ).resolves.toBeUndefined(); + expect(metadata.meta.title).toBe('user 取的标题'); + expect(metadata.meta.titleKind).toBe('custom'); + }); + + it('first_turn composes the opening prompt with the first reply, within budget', async () => { + turnExcerpt = { user: '最初的问题', assistant: '第一轮的回答' }; + + await expect( + ix.get(ISessionTitleService).generateTitle({ source: 'first_turn' }), + ).resolves.toBe('生成的标题'); + + const [, init] = fetchMock.mock.calls[0]!; + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { chat_content: 'user: 最初的问题\nassistant: 第一轮的回答' }, + }); + }); + + it('first_turn is strict: no assistant reply yet means unavailable', async () => { + turnExcerpt = { user: '只有问题' }; + + await expect( + ix.get(ISessionTitleService).generateTitle({ source: 'first_turn' }), + ).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('first_turn truncates each segment to its budget', async () => { + turnExcerpt = { user: '问'.repeat(500), assistant: '答'.repeat(1000) }; + + await expect( + ix.get(ISessionTitleService).generateTitle({ source: 'first_turn' }), + ).resolves.toBe('生成的标题'); + + const [, init] = fetchMock.mock.calls[0]!; + const content = (JSON.parse(init?.body as string) as { params: { chat_content: string } }) + .params.chat_content; + expect(content).toBe(`user: ${'问'.repeat(300)}\nassistant: ${'答'.repeat(600)}`); + }); + + it('digest composes head and tail segments, tolerating a missing reply', async () => { + digestExcerpt = { firstUser: '开场', lastUser: '最新追问', assistant: '当前进展' }; + + await expect( + ix.get(ISessionTitleService).generateTitle({ source: 'digest' }), + ).resolves.toBe('生成的标题'); + + let [, init] = fetchMock.mock.calls[0]!; + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { chat_content: 'user: 开场\nuser: 最新追问\nassistant: 当前进展' }, + }); + + fetchMock.mockClear(); + digestExcerpt = { firstUser: '开场' }; + await expect( + ix.get(ISessionTitleService).generateTitle({ force: true, source: 'digest' }), + ).resolves.toBe('生成的标题'); + [, init] = fetchMock.mock.calls[0]!; + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { chat_content: 'user: 开场' }, + }); + }); + + it('digest is unavailable when the window yields no segments at all', async () => { + digestExcerpt = {}; + + await expect( + ix.get(ISessionTitleService).generateTitle({ source: 'digest' }), + ).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('keeps the current title when the backend request fails', async () => { + fetchMock.mockImplementationOnce(async () => new Response('', { status: 500 })); + titlePrompts = ['hello']; + await metadata.update({ title: 'hello', titleKind: 'replaceable' }); + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(metadata.meta.title).toBe('hello'); + expect(tokenCalls).toEqual([false]); + }); + + it('retries once with a force-refreshed token on a 401', async () => { + fetchMock.mockImplementationOnce(async () => new Response('', { status: 401 })); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBe('生成的标题'); + expect(metadata.meta.title).toBe('生成的标题'); + expect(fetchMock).toHaveBeenCalledTimes(2); + expect(tokenCalls).toEqual([false, true]); + }); + + it('gives up when the 401 persists after the force refresh', async () => { + fetchMock.mockImplementation(async () => new Response('', { status: 401 })); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(metadata.meta.title).toBeUndefined(); + expect(fetchMock).toHaveBeenCalledTimes(2); + expect(tokenCalls).toEqual([false, true]); + }); + + it('degrades when the force refresh after a 401 fails', async () => { + fetchMock.mockImplementationOnce(async () => new Response('', { status: 401 })); + forceTokenError = new OAuthUnauthorizedError('refresh rejected'); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(metadata.meta.title).toBeUndefined(); + expect(fetchMock).toHaveBeenCalledTimes(1); + expect(tokenCalls).toEqual([false, true]); + }); + + it('returns unavailable when the OAuth token is missing or revoked', async () => { + tokenError = new OAuthUnauthorizedError('re-login required'); + titlePrompts = ['hello']; + + const svc = ix.get(ISessionTitleService); + await expect(svc.generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('returns unavailable when OAuth token retrieval has an operational failure', async () => { + tokenError = new OAuthConnectionError('connection failed'); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('propagates unexpected token provider failures', async () => { + tokenError = new Error('unexpected failure'); + titlePrompts = ['hello']; + + await expect(ix.get(ISessionTitleService).generateTitle()).rejects.toThrow( + 'unexpected failure', + ); + expect(fetchMock).not.toHaveBeenCalled(); + }); + + it('includes environment custom headers', async () => { + vi.stubEnv('KIMI_CODE_CUSTOM_HEADERS', 'X-Proxy-Header: from-env\n'); + titlePrompts = ['hello']; + + await ix.get(ISessionTitleService).generateTitle(); + + const [, init] = fetchMock.mock.calls[0]!; + const headers = new Headers(init?.headers as Record); + expect(headers.get('x-proxy-header')).toBe('from-env'); + expect(headers.get('user-agent')).toBe('test'); + }); + + it('pairs the environment endpoint with its credential slot when it overrides persisted config', async () => { + vi.stubEnv('KIMI_CODE_BASE_URL', 'https://api.env.example.test/coding/v1'); + vi.stubEnv('KIMI_CODE_OAUTH_HOST', 'https://auth.env.example.test'); + titlePrompts = ['hello']; + + await ix.get(ISessionTitleService).generateTitle(); + + expect(fetchMock.mock.calls[0]?.[0]).toBe('https://api.env.example.test/coding/v1/tools'); + expect(resolvedOAuthRefs[0]).toMatchObject({ + storage: 'file', + oauthHost: 'https://auth.env.example.test', + }); + expect(resolvedOAuthRefs[0]?.key).not.toBe(MANAGED_PROVIDER.oauth?.key); + }); + + it('shares an in-flight generation between concurrent requests', async () => { + const pendingFetch = createPendingFetch(); + fetchMock.mockImplementationOnce(pendingFetch.fetch); + + titlePrompts = ['hello']; + const first = ix.get(ISessionTitleService).generateTitle(); + const second = ix.get(ISessionTitleService).generateTitle(); + await pendingFetch.started; + + pendingFetch.resolve( + new Response(JSON.stringify({ title: '生成的标题' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + await expect(first).resolves.toBe('生成的标题'); + await expect(second).resolves.toBe('生成的标题'); + expect(fetchMock).toHaveBeenCalledTimes(1); + }); + + it('returns unavailable without calling the backend when no prompt was seen', async () => { + await expect(ix.get(ISessionTitleService).generateTitle()).resolves.toBeUndefined(); + expect(fetchMock).not.toHaveBeenCalled(); + }); +}); diff --git a/packages/agent-core-v2/test/session/sessionTitle/titleExcerpt.integration.test.ts b/packages/agent-core-v2/test/session/sessionTitle/titleExcerpt.integration.test.ts new file mode 100644 index 00000000000..bd64ba39984 --- /dev/null +++ b/packages/agent-core-v2/test/session/sessionTitle/titleExcerpt.integration.test.ts @@ -0,0 +1,94 @@ +/** + * Scenario: the title excerpts read through the REAL context memory — loop + * events fold into assistant messages, tool calls and thinking stay out of + * the excerpt, and the turn's final text wins. Wiring: harness agent (real + * contextMemory + prompt queue) with the real AgentTitlePromptSourceService. + * Run: pnpm --filter @moonshot-ai/agent-core-v2 exec vitest run + * test/session/sessionTitle/titleExcerpt.integration.test.ts + */ + +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; + +import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; +import { IAgentTitlePromptSource } from '#/session/sessionTitle/agentTitlePromptSource'; + +import { createTestAgent, type TestAgentContext } from '../../harness'; + +describe('title excerpts over the real context memory', () => { + let ctx: TestAgentContext; + + beforeEach(() => { + ctx = createTestAgent(); + }); + + afterEach(async () => { + await ctx.dispose(); + }); + + it('first_turn pairs the opening prompt with the folded assistant final text', async () => { + const context = ctx.get(IAgentContextMemoryService); + context.append({ + role: 'user', + content: [{ type: 'text', text: '帮我部署这个服务' }], + toolCalls: [], + origin: { kind: 'user' }, + }); + context.appendLoopEvent({ type: 'step.begin', uuid: 's1' }); + context.appendLoopEvent({ + type: 'content.part', + stepUuid: 's1', + part: { type: 'text', text: '先看一下配置' }, + }); + context.appendLoopEvent({ + type: 'tool.call', + stepUuid: 's1', + toolCallId: 'c1', + name: 'Read', + args: {}, + }); + context.appendLoopEvent({ + type: 'tool.result', + toolCallId: 'c1', + result: { output: 'file contents', isError: false }, + }); + context.appendLoopEvent({ type: 'step.end', uuid: 's1' }); + context.appendLoopEvent({ type: 'step.begin', uuid: 's2' }); + context.appendLoopEvent({ + type: 'content.part', + stepUuid: 's2', + part: { type: 'think', think: '收尾' }, + }); + context.appendLoopEvent({ + type: 'content.part', + stepUuid: 's2', + part: { type: 'text', text: '部署完成,服务在 8080 端口' }, + }); + context.appendLoopEvent({ type: 'step.end', uuid: 's2' }); + + const source = ctx.get(IAgentTitlePromptSource); + await expect(source.firstTurnExcerpt()).resolves.toEqual({ + user: '帮我部署这个服务', + assistant: '部署完成,服务在 8080 端口', + }); + await expect(source.digestExcerpt()).resolves.toEqual({ + firstUser: '帮我部署这个服务', + lastUser: undefined, + assistant: '部署完成,服务在 8080 端口', + }); + }); + + it('first_turn reports no assistant text while the turn has not produced any', async () => { + const context = ctx.get(IAgentContextMemoryService); + context.append({ + role: 'user', + content: [{ type: 'text', text: '刚发的问题' }], + toolCalls: [], + origin: { kind: 'user' }, + }); + + await expect(ctx.get(IAgentTitlePromptSource).firstTurnExcerpt()).resolves.toEqual({ + user: '刚发的问题', + assistant: undefined, + }); + }); +}); diff --git a/packages/agent-core-v2/test/tool/tool.test.ts b/packages/agent-core-v2/test/tool/tool.test.ts index 8424196090f..f4818fa624b 100644 --- a/packages/agent-core-v2/test/tool/tool.test.ts +++ b/packages/agent-core-v2/test/tool/tool.test.ts @@ -413,6 +413,7 @@ function sessionMetadataStub(agents: Readonly>): ISess }), update: async () => {}, setTitle: async () => {}, + setGeneratedTitleIfUncustomized: async () => false, setArchived: async () => {}, registerAgent: async () => {}, }; diff --git a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts index b0da2dce2fd..86bb82bdc5d 100644 --- a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts +++ b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts @@ -64,7 +64,10 @@ import { type SessionLifecycleHookSlots, } from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; import { ISessionIndexMirror } from '#/app/sessionIndex/sessionIndex'; -import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; +import { + ISessionMetadata, + type SessionMetaPatch, +} from '#/session/sessionMetadata/sessionMetadata'; import { ISessionToolPolicy } from '#/session/sessionToolPolicy/sessionToolPolicy'; import { ISessionProcessRunner } from '#/session/process/processRunner'; import { ISessionIndex, type SessionSummary } from '#/app/sessionIndex/sessionIndex'; @@ -132,6 +135,7 @@ function metadataStub(): ISessionMetadata { read: () => Promise.resolve({} as never), update: () => Promise.resolve(), setTitle: () => Promise.resolve(), + setGeneratedTitleIfUncustomized: () => Promise.resolve(false), setArchived: () => Promise.resolve(), registerAgent: () => Promise.resolve(), }; @@ -1730,6 +1734,53 @@ describe('SessionLifecycleService', () => { }); describe('fork session state', () => { + it('marks the default fork title as replaceable', async () => { + const updates: SessionMetaPatch[] = []; + const svc = await build([ + stubPair(ISessionMetadata, { + ...metadataStub(), + read: () => + Promise.resolve({ + title: 'generated source', + titleKind: 'generated', + agents: {}, + } as never), + update: (patch) => { + updates.push(patch); + return Promise.resolve(); + }, + }), + ]); + await svc.create({ sessionId: 'src', workDir: '/tmp/proj' }); + + await svc.fork({ sourceSessionId: 'src', newSessionId: 'dst' }); + + expect(updates).toContainEqual( + expect.objectContaining({ title: 'Fork: generated source', titleKind: 'replaceable' }), + ); + }); + + it('marks an explicit fork title as custom', async () => { + const updates: SessionMetaPatch[] = []; + const svc = await build([ + stubPair(ISessionMetadata, { + ...metadataStub(), + read: () => Promise.resolve({ title: 'source', agents: {} } as never), + update: (patch) => { + updates.push(patch); + return Promise.resolve(); + }, + }), + ]); + await svc.create({ sessionId: 'src', workDir: '/tmp/proj' }); + + await svc.fork({ sourceSessionId: 'src', newSessionId: 'dst', title: 'user title' }); + + expect(updates).toContainEqual( + expect.objectContaining({ title: 'user title', titleKind: 'custom' }), + ); + }); + it('fork inherits the source session\'s last turn outcome', async () => { const updates: { readonly lastTurnReason?: unknown }[] = []; const metaStub: ISessionMetadata = { diff --git a/packages/kap-server/src/protocol/error-codes.ts b/packages/kap-server/src/protocol/error-codes.ts index 2f05e68575c..2fadbc3dd33 100644 --- a/packages/kap-server/src/protocol/error-codes.ts +++ b/packages/kap-server/src/protocol/error-codes.ts @@ -118,6 +118,8 @@ export const ErrorCode = { PROVIDER_ALREADY_EXISTS: 40921, /** page_token 损坏 / 版本不符 / 与当前查询条件不匹配,需从首页重新拉取 */ PAGE_TOKEN_MISMATCH: 40922, + /** 会话标题生成不可用(flag 未开 / 无 managed OAuth 登录 / 还没有 prompt / 后端失败) */ + SESSION_TITLE_UNAVAILABLE: 40923, /** approval 60s 超时 */ APPROVAL_EXPIRED: 41001, diff --git a/packages/kap-server/src/routes/sessions.ts b/packages/kap-server/src/routes/sessions.ts index 6611ee1d356..f735ad6de8b 100644 --- a/packages/kap-server/src/routes/sessions.ts +++ b/packages/kap-server/src/routes/sessions.ts @@ -8,6 +8,8 @@ * GET /sessions/{session_id} get * GET /sessions/{session_id}/profile * POST /sessions/{session_id}/profile update title / metadata / agent_config + * POST /sessions/{session_id}/title/generate + * regenerate title via chat_title * POST /sessions/{tail} action: fork / compact / undo / * abort / btw / archive / restore * GET /sessions/{session_id}/children list child sessions @@ -88,6 +90,7 @@ import { ISessionIndex, ISessionMetadata, ISessionLegacyService, + ISessionTitleService, IEventService, IWorkspaceAliases, ISessionLifecycleService, @@ -651,6 +654,65 @@ export function registerSessionsRoutes(app: SessionRouteHost, core: Scope): void updateProfileRoute.handler as Parameters[2], ); + const generateTitleRoute = defineRoute( + { + method: 'POST', + path: '/sessions/{session_id}/title/generate', + params: sessionIdParamSchema, + // Optional body: `{ "force": true }` requests an explicit regeneration + // that overwrites an already-generated or user-customized title; + // `source` picks the conversation excerpt (`user_prompts` default, + // `first_turn`, `digest`). + body: z.preprocess( + (value) => (value === undefined ? {} : value), + z.object({ + force: z.boolean().optional(), + source: z.enum(['user_prompts', 'first_turn', 'digest']).optional(), + }), + ), + success: { data: z.object({ title: z.string() }) }, + errors: { + [ErrorCode.SESSION_NOT_FOUND]: {}, + [ErrorCode.SESSION_TITLE_UNAVAILABLE]: {}, + }, + description: 'Generate the session title via the managed chat_title tool', + tags: ['sessions'], + }, + async (req, reply) => { + try { + const { session_id } = req.params; + const handle = await resumeSessionById(core.accessor, session_id); + if (handle === undefined) { + reply.send( + errEnvelope(ErrorCode.SESSION_NOT_FOUND, `session ${session_id} not found`, req.id), + ); + return; + } + const title = await handle.accessor + .get(ISessionTitleService) + .generateTitle({ force: req.body.force === true, source: req.body.source }); + if (title === undefined) { + reply.send( + errEnvelope( + ErrorCode.SESSION_TITLE_UNAVAILABLE, + 'session title generation is unavailable (no managed OAuth login, no prompt yet, or the backend request failed)', + req.id, + ), + ); + return; + } + reply.send(okEnvelope({ title }, req.id)); + } catch (error) { + sendMappedError(reply, req, error); + } + }, + ); + app.post( + generateTitleRoute.path, + generateTitleRoute.options, + generateTitleRoute.handler as Parameters[2], + ); + const sessionActionRoute = defineRoute( { method: 'POST', diff --git a/packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap b/packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap index 3bc3a036e64..b03321c439f 100644 --- a/packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap +++ b/packages/kap-server/test/__snapshots__/apiSurface.snapshot.test.ts.snap @@ -392,6 +392,10 @@ exports[`API surface snapshot > matches the documented v2 route table and meta e "POST", "/api/v1/sessions/{session_id}/terminals/{tail}", ], + [ + "POST", + "/api/v1/sessions/{session_id}/title/generate", + ], [ "POST", "/api/v1/shutdown", diff --git a/packages/kap-server/test/prompts.test.ts b/packages/kap-server/test/prompts.test.ts index 859c66148ca..10ceb752a39 100644 --- a/packages/kap-server/test/prompts.test.ts +++ b/packages/kap-server/test/prompts.test.ts @@ -4,6 +4,7 @@ import { dirname, join } from 'node:path'; import { deflateSync } from 'node:zlib'; import { + IAgentTitlePromptSource, IAgentContextMemoryService, IAgentLifecycleService, IAgentProfileService, @@ -215,6 +216,25 @@ describe('server-v2 /api/v1 prompts', () => { expect(Array.isArray(list.body.data.queued)).toBe(true); }); + it('makes the first three REST prompts available to title generation', async () => { + const id = await createSession(home as string); + await createMainAgent(id); + + const prompts = ['先搭一个 Vite 项目', '加上路由', '现在配一下 ESLint']; + for (const text of prompts) { + const submitted = await call('POST', `/api/v1/sessions/${id}/prompts`, { + content: [{ type: 'text', text }], + }); + expect(submitted.body.code).toBe(0); + } + + const session = getLiveSessionById(server!.core.accessor, id); + const agent = session?.accessor.get(IAgentLifecycleService).get('main'); + const source = agent?.accessor.get(IAgentTitlePromptSource); + expect(source).toBeDefined(); + await expect(source!.firstUserPrompts(3)).resolves.toEqual(prompts); + }); + it('rejects a stale file reference without creating the agent or mutating the model', async () => { const id = await createSession(home as string); const session = getLiveSessionById(server!.core.accessor, id); diff --git a/packages/kap-server/test/sessions.test.ts b/packages/kap-server/test/sessions.test.ts index 3a3d6ede9ab..56d39545ab7 100644 --- a/packages/kap-server/test/sessions.test.ts +++ b/packages/kap-server/test/sessions.test.ts @@ -16,7 +16,9 @@ import { Error2, ErrorCodes, IBootstrapService, + IOAuthService, type DomainEvent, + type IOAuthService as IOAuthServiceType, IAgentConversationUndoService, IAgentGoalService, IAgentLifecycleService, @@ -27,6 +29,7 @@ import { getLiveSessionById, sessionDirOf, type ServiceIdentifier, + type ScopeSeed, } from '@moonshot-ai/agent-core-v2'; import { sessionWarningsResponseSchema } from '@moonshot-ai/agent-core-v2/app/sessionLegacy/sessionProtocol'; import { encodeWorkDirKey } from '@moonshot-ai/agent-core-v2/_base/utils/workdir-slug'; @@ -104,6 +107,8 @@ describe('server-v2 /api/v1/sessions', () => { }); afterEach(async () => { + vi.restoreAllMocks(); + vi.unstubAllEnvs(); if (server !== undefined) { await server.close(); server = undefined; @@ -513,6 +518,165 @@ describe('server-v2 /api/v1/sessions', () => { expect(got.body.data.title).toBe('renamed'); }); + it('returns title-unavailable when generation cannot run', async () => { + const created = await postJson('/api/v1/sessions', { + metadata: { cwd: home as string }, + }); + + const generated = await postJson( + `/api/v1/sessions/${created.body.data.id}/title/generate`, + ); + + expect(generated.body.code).toBe(40923); + }); + + it('generates and persists a title through the public REST path', async () => { + await server?.close(); + server = undefined; + await writeFile( + join(home as string, 'config.toml'), + [ + 'default_model = "stub"', + '', + '[providers.stub]', + 'type = "openai"', + 'base_url = "http://127.0.0.1:9999"', + 'api_key = "stub"', + '', + '[models.stub]', + 'provider = "stub"', + 'model = "stub"', + 'max_context_size = 1000', + '', + '[providers."managed:kimi-code"]', + 'type = "kimi"', + 'base_url = "https://api.example.test/coding/v1"', + '', + '[providers."managed:kimi-code".oauth]', + 'storage = "file"', + 'key = "kimi-code"', + '', + '[experimental]', + 'auto_session_title = true', + '', + ].join('\n'), + 'utf-8', + ); + + const oauth: IOAuthServiceType = { + _serviceBrand: undefined, + startLogin: async () => { + throw new Error('unused'); + }, + getFlow: () => undefined, + cancelLogin: async () => { + throw new Error('unused'); + }, + logout: async () => { + throw new Error('unused'); + }, + status: async () => ({ loggedIn: true, provider: 'managed:kimi-code' }), + refreshOAuthProviderModels: async () => ({ changed: [], unchanged: [], failed: [] }), + getManagedUsage: async () => ({ kind: 'error', message: 'unused' }), + getManagedUserInfo: async () => ({ kind: 'error', message: 'unused' }), + resolveTokenProvider: () => ({ getAccessToken: async () => 'test-token' }), + getCachedAccessToken: async () => 'test-token', + }; + server = await startServer({ + hostIdentity: TEST_HOST_IDENTITY, + host: '127.0.0.1', + port: 0, + homeDir: home, + logLevel: 'silent', + seeds: [[IOAuthService, oauth]] as ScopeSeed, + }); + base = `http://127.0.0.1:${server.port}`; + + let toolsRequest: { method: string; params: { chat_content: string } } | undefined; + const actualFetch = globalThis.fetch.bind(globalThis); + vi.spyOn(globalThis, 'fetch').mockImplementation(async (input, init) => { + const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url; + if (url === 'https://api.example.test/coding/v1/tools') { + const body = init?.body; + if (typeof body !== 'string') { + throw new TypeError('expected a string request body'); + } + toolsRequest = JSON.parse(body) as typeof toolsRequest; + return new Response(JSON.stringify({ title: 'generated from REST' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }); + } + return actualFetch(input, init); + }); + + const created = await postJson('/api/v1/sessions', { + metadata: { cwd: home as string }, + }); + const id = created.body.data.id; + for (const text of ['first REST prompt', 'second REST prompt', 'third REST prompt']) { + const submitted = await postJson<{ prompt_id: string }>( + `/api/v1/sessions/${id}/prompts`, + { content: [{ type: 'text', text }] }, + ); + expect(submitted.body.code).toBe(0); + } + + const generated = await postJson<{ title: string }>( + `/api/v1/sessions/${id}/title/generate`, + ); + expect(generated.body).toMatchObject({ code: 0, data: { title: 'generated from REST' } }); + expect(toolsRequest).toEqual({ + method: 'chat_title', + params: { + chat_content: + 'user: first REST prompt\nuser: second REST prompt\nuser: third REST prompt', + }, + }); + + const got = await getJson(`/api/v1/sessions/${id}`); + expect(got.body).toMatchObject({ code: 0, data: { title: 'generated from REST' } }); + + // A second non-force call refuses: the title is already generated. + const again = await postJson(`/api/v1/sessions/${id}/title/generate`); + expect(again.body.code).toBe(40923); + + // `force: true` regenerates an already-generated title … + const forced = await postJson<{ title: string }>(`/api/v1/sessions/${id}/title/generate`, { + force: true, + }); + expect(forced.body).toMatchObject({ code: 0, data: { title: 'generated from REST' } }); + + // … and overwrites a user-customized title. + await postJson(`/api/v1/sessions/${id}/profile`, { title: 'custom title' }); + const forcedCustom = await postJson<{ title: string }>( + `/api/v1/sessions/${id}/title/generate`, + { force: true }, + ); + expect(forcedCustom.body).toMatchObject({ code: 0, data: { title: 'generated from REST' } }); + const afterCustom = await getJson(`/api/v1/sessions/${id}`); + expect(afterCustom.body.data.title).toBe('generated from REST'); + + // `source: 'digest'` composes the head+tail user segments server-side + // (this session's turns produced no assistant reply to draw from). + const digested = await postJson<{ title: string }>(`/api/v1/sessions/${id}/title/generate`, { + force: true, + source: 'digest', + }); + expect(digested.body).toMatchObject({ code: 0, data: { title: 'generated from REST' } }); + expect(toolsRequest?.params.chat_content).toBe( + 'user: first REST prompt\nuser: third REST prompt', + ); + }); + + it('returns session-not-found when generating a title for a missing session', async () => { + const generated = await postJson( + '/api/v1/sessions/sess_missing_title/title/generate', + ); + + expect(generated.body.code).toBe(40401); + }); + it('returns best-effort status for a live session', async () => { const cwd = home as string; const created = await postJson('/api/v1/sessions', { metadata: { cwd } }); diff --git a/packages/klient/src/contract/global/events.ts b/packages/klient/src/contract/global/events.ts index 126d281ef87..905f965210c 100644 --- a/packages/klient/src/contract/global/events.ts +++ b/packages/klient/src/contract/global/events.ts @@ -30,7 +30,7 @@ export interface SessionMetaUpdatedPayload { readonly patch: { readonly title?: string; readonly isCustomTitle?: boolean; - readonly lastPrompt: string; + readonly lastPrompt?: string; }; } @@ -73,9 +73,9 @@ const sessionMetaUpdatedSchema = z.object({ patch: z.object({ title: z.string().optional(), isCustomTitle: z.boolean().optional(), - lastPrompt: z.string(), + lastPrompt: z.string().optional(), }), -}); +}) satisfies z.ZodType; export const catalogChangedSchema = z.object({ changed: z.array( diff --git a/packages/klient/src/contract/index.ts b/packages/klient/src/contract/index.ts index 510f761c4ae..ef665c32673 100644 --- a/packages/klient/src/contract/index.ts +++ b/packages/klient/src/contract/index.ts @@ -46,6 +46,7 @@ import { import { sessionMetadataContract } from './session/metadata.js'; import { sessionQuestionContract } from './session/question.js'; import { sessionSkillCatalogContract } from './session/skills.js'; +import { sessionTitleContract } from './session/title.js'; export const globalContract: KlientContract = { // core (app scope) @@ -72,6 +73,7 @@ export const globalContract: KlientContract = { sessionApprovalService: sessionApprovalContract, sessionQuestionService: sessionQuestionContract, sessionSkillCatalog: sessionSkillCatalogContract, + sessionTitleService: sessionTitleContract, // agent scope agentPromptService: agentPromptContract, agentSkillService: agentSkillContract, diff --git a/packages/klient/src/contract/session/metadata.ts b/packages/klient/src/contract/session/metadata.ts index e72d6642ce2..39f50e41035 100644 --- a/packages/klient/src/contract/session/metadata.ts +++ b/packages/klient/src/contract/session/metadata.ts @@ -22,7 +22,7 @@ export const sessionMetaSchema = z.object({ id: z.string(), version: z.number().optional(), title: z.string().optional(), - isCustomTitle: z.boolean().optional(), + titleKind: z.enum(['replaceable', 'generated', 'custom']).optional(), lastPrompt: z.string().optional(), createdAt: z.number(), updatedAt: z.number(), @@ -39,7 +39,7 @@ export const sessionMetaSchema = z.object({ export const sessionMetaPatchSchema = z.object({ version: z.number().optional(), title: z.string().optional(), - isCustomTitle: z.boolean().optional(), + titleKind: z.enum(['replaceable', 'generated', 'custom']).optional(), lastPrompt: z.string().optional(), updatedAt: z.number().optional(), archived: z.boolean().optional(), @@ -56,7 +56,7 @@ export const sessionMetaKeySchema = z.enum([ 'id', 'version', 'title', - 'isCustomTitle', + 'titleKind', 'lastPrompt', 'createdAt', 'updatedAt', diff --git a/packages/klient/src/contract/session/title.ts b/packages/klient/src/contract/session/title.ts new file mode 100644 index 00000000000..3777e8103bd --- /dev/null +++ b/packages/klient/src/contract/session/title.ts @@ -0,0 +1,23 @@ +/** + * `sessionTitleService` — on-demand session title generation. Mirrors + * `agent-core-v2/session/sessionTitle/sessionTitle.ts`. + */ + +import { z } from 'zod'; + +import { maybe } from '../helpers.js'; +import type { ServiceContract } from '../types.js'; + +export const sessionTitleContract = { + generateTitle: { + input: z.tuple([ + z + .object({ + force: z.boolean().optional(), + source: z.enum(['user_prompts', 'first_turn', 'digest']).optional(), + }) + .optional(), + ]), + output: maybe(z.string()), + }, +} satisfies ServiceContract; diff --git a/packages/klient/src/core/facade/session.ts b/packages/klient/src/core/facade/session.ts index e0fe3134fbf..77480cb7262 100644 --- a/packages/klient/src/core/facade/session.ts +++ b/packages/klient/src/core/facade/session.ts @@ -88,6 +88,19 @@ export type SessionStatus = 'running' | 'idle' | 'awaiting_approval' | 'awaiting export interface SessionFacade { get(): Promise; setTitle(title: string): Promise; + /** + * Generate and apply a title from the main agent's first prompts via the + * managed `chat_title` tool. `undefined` when generation is unavailable + * (no managed OAuth login, no prompt yet, or a custom title is set). + * `force` regenerates anyway, overwriting a generated or custom title. + * `source` picks the conversation excerpt: `user_prompts` (default), + * `first_turn` (opening prompt + first reply; strict), or `digest` + * (head+tail of a multi-turn conversation). + */ + generateTitle(opts?: { + force?: boolean; + source?: 'user_prompts' | 'first_turn' | 'digest'; + }): Promise; update(patch: SessionMetaPatch): Promise; setArchived(archived: boolean): Promise; status(): Promise; @@ -136,6 +149,10 @@ export function createSessionFacade(call: ScopedCaller, sessionId: string): Sess return { get: read, setTitle: (title) => call(scope, 'sessionMetadata', 'setTitle', [title]) as Promise, + generateTitle: (opts) => + call(scope, 'sessionTitleService', 'generateTitle', [opts]) as Promise< + string | undefined + >, update: (patch) => call(scope, 'sessionMetadata', 'update', [patch]) as Promise, setArchived: (archived) => call(scope, 'sessionMetadata', 'setArchived', [archived]) as Promise, diff --git a/packages/klient/src/transports/memory/serviceRegistry.ts b/packages/klient/src/transports/memory/serviceRegistry.ts index adf87dad7b0..b65e5adacd5 100644 --- a/packages/klient/src/transports/memory/serviceRegistry.ts +++ b/packages/klient/src/transports/memory/serviceRegistry.ts @@ -30,6 +30,7 @@ import { ISessionInteractionService } from '@moonshot-ai/agent-core-v2/session/i import { ISessionApprovalService } from '@moonshot-ai/agent-core-v2/session/approval/approval'; import { ISessionQuestionService } from '@moonshot-ai/agent-core-v2/session/question/question'; import { ISessionSkillCatalog } from '@moonshot-ai/agent-core-v2/session/sessionSkillCatalog/skillCatalog'; +import { ISessionTitleService } from '@moonshot-ai/agent-core-v2/session/sessionTitle/sessionTitle'; import { IAgentPromptService } from '@moonshot-ai/agent-core-v2/agent/prompt/prompt'; import { IAgentSkillService } from '@moonshot-ai/agent-core-v2/agent/skill/skill'; import { IAgentLoopService } from '@moonshot-ai/agent-core-v2/agent/loop/loop'; @@ -69,6 +70,7 @@ export const serviceTokens: Readonly>> sessionApprovalService: ISessionApprovalService, sessionQuestionService: ISessionQuestionService, sessionSkillCatalog: ISessionSkillCatalog, + sessionTitleService: ISessionTitleService, agentPromptService: IAgentPromptService, agentSkillService: IAgentSkillService, agentLoopService: IAgentLoopService, diff --git a/packages/klient/test/contract-parity.ts b/packages/klient/test/contract-parity.ts index 83173652b46..b285cc55b81 100644 --- a/packages/klient/test/contract-parity.ts +++ b/packages/klient/test/contract-parity.ts @@ -64,6 +64,7 @@ import type { SessionMetadataChangedEvent, SessionMetaPatch, } from '@moonshot-ai/agent-core-v2/session/sessionMetadata/sessionMetadata'; +import type { ISessionTitleService } from '@moonshot-ai/agent-core-v2/session/sessionTitle/sessionTitle'; import type { AuthStatus, IOAuthService, @@ -224,6 +225,7 @@ import { questionResultSchema, } from '../src/contract/session/question.js'; import { skillSummarySchema } from '../src/contract/session/skills.js'; +import { sessionTitleContract } from '../src/contract/session/title.js'; import { authStatusSchema, @@ -494,6 +496,12 @@ const _questionResult: AssertWire = // session/skills.ts const _skillSummary: AssertWire = true; +// session/title.ts +const _generateTitleOutput: AssertWire< + (typeof sessionTitleContract)['generateTitle']['output'], + Awaited> +> = true; + // agent/activity.ts const _turnPhase: AssertWire = true; const _approvalRef: AssertWire = true; diff --git a/packages/klient/test/facade.test.ts b/packages/klient/test/facade.test.ts index 6c6093a33a4..6999f9ff335 100644 --- a/packages/klient/test/facade.test.ts +++ b/packages/klient/test/facade.test.ts @@ -515,6 +515,37 @@ describe('event hub', () => { expect(channel.subscriptions[0]?.dispose).toHaveBeenCalledTimes(1); }); + it('delivers session.metaUpdated when the patch carries no lastPrompt', async () => { + const channel = new FakeChannel(); + const klient = createKlientFromChannel(channel); + const seen: unknown[] = []; + const errors: Error[] = []; + klient.events.onError((error) => { + errors.push(error); + }); + + klient.events.on('session.metaUpdated', (event) => seen.push(event)); + channel.emit(0, { + type: 'session.meta.updated', + payload: { + agentId: 'main', + sessionId: 's1', + title: 'generated title', + patch: { title: 'generated title', isCustomTitle: false }, + }, + }); + await tick(); + expect(seen).toEqual([ + { + agentId: 'main', + sessionId: 's1', + title: 'generated title', + patch: { title: 'generated title', isCustomTitle: false }, + }, + ]); + expect(errors).toHaveLength(0); + }); + it('disposes the emitter subscription when the last listener detaches', async () => { const channel = new FakeChannel(); const klient = createKlientFromChannel(channel); diff --git a/packages/node-sdk/src/kimi-harness.ts b/packages/node-sdk/src/kimi-harness.ts index 4ab32498a77..15f755ab9b6 100644 --- a/packages/node-sdk/src/kimi-harness.ts +++ b/packages/node-sdk/src/kimi-harness.ts @@ -18,6 +18,7 @@ import type { ExportSessionInput, ExportSessionResult, ForkSessionInput, + GenerateSessionTitleInput, GetConfigOptions, GlobalMcpServerAuthStatus, KimiConfig, @@ -72,6 +73,7 @@ export class KimiHarness { private readonly uiMode: string; private readonly telemetry: TelemetryClient; private readonly activeSessions = new Map(); + private readonly resumeInflight = new Map>(); private readonly ensureConfigFileImpl: () => Promise; private readonly closeImpl: () => void | Promise; private readonly sessionStartedProperties: TelemetryProperties; @@ -130,7 +132,9 @@ export class KimiHarness { summary, rpc: this.rpc, onClose: () => { - this.activeSessions.delete(summary.id); + if (this.activeSessions.get(summary.id) === session) { + this.activeSessions.delete(summary.id); + } }, }); this.activeSessions.set(session.id, session); @@ -145,8 +149,16 @@ export class KimiHarness { async resumeSession(input: ResumeSessionInput): Promise { const id = normalizeSessionId(input.id); const active = this.activeSessions.get(id); - const { kaos, persistenceKaos, sessionStartedProperties, ...resumeInput } = input; - if (active !== undefined) { + const { + kaos, + persistenceKaos, + sessionStartedProperties: _sessionStartedProperties, + ...resumeInput + } = input; + // A session whose close is in flight (`isClosed` but not yet unmapped) + // is not a valid resume target — fall through and re-resume fresh, which + // the engine serializes behind that close. + if (active !== undefined && !active.isClosed) { if (kaos !== undefined || persistenceKaos !== undefined) { await this.rpc.resumeSessionWithKaos({ ...resumeInput, id }, kaos ?? persistenceKaos as Kaos, persistenceKaos); } else if (input.agentProfile !== undefined) { @@ -155,6 +167,26 @@ export class KimiHarness { return active; } + // Coalesce concurrent resumes of the same id onto one facade, keyed by + // the full input so a caller with different options (dirs, replay, + // profile, kaos) never has them silently dropped; without this, + // parallel identical callers each build their own Session over the + // shared engine handle, and one facade's close kills the engine handle + // under the other. + const key = resumeCoalesceKey(id, input); + const inflight = this.resumeInflight.get(key); + if (inflight !== undefined) return inflight; + const run = this.doResumeSession(input, id); + this.resumeInflight.set(key, run); + try { + return await run; + } finally { + if (this.resumeInflight.get(key) === run) this.resumeInflight.delete(key); + } + } + + private async doResumeSession(input: ResumeSessionInput, id: string): Promise { + const { kaos, persistenceKaos, sessionStartedProperties, ...resumeInput } = input; const summary = kaos === undefined && persistenceKaos === undefined ? await this.rpc.resumeSession({ ...resumeInput, id }) @@ -165,7 +197,9 @@ export class KimiHarness { summary, rpc: this.rpc, onClose: () => { - this.activeSessions.delete(summary.id); + if (this.activeSessions.get(summary.id) === session) { + this.activeSessions.delete(summary.id); + } }, }); this.activeSessions.set(session.id, session); @@ -195,7 +229,9 @@ export class KimiHarness { summary, rpc: this.rpc, onClose: () => { - this.activeSessions.delete(summary.id); + if (this.activeSessions.get(summary.id) === session) { + this.activeSessions.delete(summary.id); + } }, }); this.activeSessions.set(session.id, session); @@ -218,7 +254,9 @@ export class KimiHarness { summary, rpc: this.rpc, onClose: () => { - this.activeSessions.delete(summary.id); + if (this.activeSessions.get(summary.id) === session) { + this.activeSessions.delete(summary.id); + } }, }); this.activeSessions.set(session.id, session); @@ -243,7 +281,18 @@ export class KimiHarness { async renameSession(input: RenameSessionInput): Promise { await this.rpc.renameSession(input); - this.activeSessions.get(input.id)?.emitMetaUpdated({ title: input.title }); + this.activeSessions + .get(input.id) + ?.emitMetaUpdated({ title: input.title, isCustomTitle: true }); + } + + /** + * Generate and apply a session title from the main agent's first prompts + * (v2 engine only). Resolves to `undefined` when generation is unavailable + * and the current title is kept. + */ + async generateSessionTitle(input: GenerateSessionTitleInput): Promise { + return this.rpc.generateSessionTitle(input); } async exportSession(input: ExportSessionInput): Promise { @@ -486,6 +535,16 @@ export class KimiHarness { const DEFAULT_SESSION_STARTED_UI_MODE = 'shell'; +function resumeCoalesceKey(id: string, input: ResumeSessionInput): string { + const { kaos, persistenceKaos, ...rest } = input; + return JSON.stringify({ + ...rest, + id, + kaos: kaos !== undefined, + persistenceKaos: persistenceKaos !== undefined, + }); +} + function normalizeSessionId(value: string): string { if (typeof value !== 'string') { throw new KimiError(ErrorCodes.SESSION_ID_REQUIRED, 'Session id is required.'); diff --git a/packages/node-sdk/src/rpc.ts b/packages/node-sdk/src/rpc.ts index 04f2e623e55..c535d2e92f7 100644 --- a/packages/node-sdk/src/rpc.ts +++ b/packages/node-sdk/src/rpc.ts @@ -34,6 +34,7 @@ import type { ExportSessionResult, CreateGoalInput, ForkSessionInput, + GenerateSessionTitleInput, GetConfigOptions, GlobalMcpServerAuthStatus, McpServerConfig, @@ -257,6 +258,18 @@ export abstract class SDKRpcClientBase { }); } + /** + * v2-only capability (`ISessionTitleService`); the v1 engine has no title + * generation, so the base fails loudly and `SDKRpcClientV2` overrides it. + */ + async generateSessionTitle(input: GenerateSessionTitleInput): Promise { + void input; + throw new KimiError( + ErrorCodes.NOT_IMPLEMENTED, + 'generateSessionTitle is only available on the agent-core-v2 engine.', + ); + } + async exportSession(input: ExportSessionInput): Promise { const rpc = await this.getRpc(); return rpc.exportSession({ diff --git a/packages/node-sdk/src/sdk-rpc-client-v2.ts b/packages/node-sdk/src/sdk-rpc-client-v2.ts index 93fffe65626..d32b6e0a7b5 100644 --- a/packages/node-sdk/src/sdk-rpc-client-v2.ts +++ b/packages/node-sdk/src/sdk-rpc-client-v2.ts @@ -264,6 +264,7 @@ import type { ExportSessionInput, ExportSessionResult, ForkSessionInput, + GenerateSessionTitleInput, GetConfigOptions, GetCronTasksResult, GlobalMcpServerAuthState, @@ -403,6 +404,17 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { * registered handlers. */ private readonly sessionWirings = new Map(); + /** + * Per-session serialization for the operations that change a session's + * live ownership: the temporary resume→act→close paths (`renameSession`, + * `generateSessionTitle`) and the public `resumeSession` / `closeSession` + * / `reloadSession`. Chaining them through one queue per session id makes + * the handoff atomic — a public resume either lands first (the temporary + * path then reuses the live handle and leaves it open) or waits for the + * temporary close to finish and materializes a fresh scope, so a caller + * can never receive a handle whose close is already in flight. + */ + private readonly sessionAccessQueues = new Map>(); /** App-scope subscriptions (global event forwarding, lifecycle tracking), disposed in {@link close}. */ private readonly appSubscriptions: IDisposable[] = []; @@ -817,6 +829,64 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { return getLiveSessionById(this.engineAccessor, sessionId); } + /** + * Runs `work` after every previously queued operation on the same session + * settles; different sessions still run in parallel. The map entry drops + * itself once the queue drains. + */ + private runSessionAccess(sessionId: string, work: () => Promise): Promise { + const previous = this.sessionAccessQueues.get(sessionId) ?? Promise.resolve(); + const run = previous.then(work, work); + const tail = run.then( + () => undefined, + () => undefined, + ); + this.sessionAccessQueues.set(sessionId, tail); + void tail.then(() => { + if (this.sessionAccessQueues.get(sessionId) === tail) { + this.sessionAccessQueues.delete(sessionId); + } + }); + return run; + } + + /** + * Multi-key variant of {@link runSessionAccess}: acquires the queues in + * sorted order so concurrent multi-key operations (fork A→B vs fork B→A) + * cannot deadlock. + */ + private runSessionAccessAll(sessionIds: readonly string[], work: () => Promise): Promise { + const keys = [...new Set(sessionIds)].sort(); + let chained: () => Promise = work; + for (const key of [...keys].reverse()) { + const inner = chained; + chained = () => this.runSessionAccess(key, inner); + } + return chained(); + } + + /** + * Runs `action` against the session without changing its live footprint: a + * session that is already live (publicly resumed or created through this + * client) is used in place and left open, while a cold session is resumed + * for the duration of the action and closed again. Only safe inside + * {@link runSessionAccess} — the queue is what makes the resume/close pair + * atomic against the public lifecycle operations. + */ + private async withTemporarySession( + sessionId: string, + action: () => Promise, + ): Promise { + if (this.liveSession(sessionId) !== undefined) return action(); + const handle = await resumeSessionById(this.engineAccessor, sessionId); + if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(sessionId); + try { + return await action(); + } finally { + await closeSessionById(this.engineAccessor, sessionId); + } + } + /** v1's `requireSession` / store lookup failure shape. */ private static sessionNotFound(sessionId: string): KimiError { return new KimiError(ErrorCodes.SESSION_NOT_FOUND, `Session "${sessionId}" was not found`, { @@ -867,6 +937,7 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { return { id: meta.id, title: meta.title, + titleKind: meta.titleKind, lastPrompt: meta.lastPrompt, workDir: ctx.cwd, sessionDir: ctx.sessionDir, @@ -1113,6 +1184,16 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { * default model → `model.not_configured`) are pinned in the parity tests. */ override async createSession(input: CreateSessionOptions): Promise { + // An explicit id takes the per-session queue so the check-then-create + // below is atomic against another create/close of the same id; a random + // id has no contenders and needs no serialization. + if (input.id !== undefined) { + return this.runSessionAccess(input.id, () => this.doCreateSession(input)); + } + return this.doCreateSession(input); + } + + private async doCreateSession(input: CreateSessionOptions): Promise { const workDir = normalizeRequiredWorkDir('createSession', input.workDir); if (input.id !== undefined) { const existing = @@ -1170,17 +1251,28 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { if (title.length === 0) { throw new KimiError(ErrorCodes.SESSION_TITLE_EMPTY, 'Session title cannot be empty'); } - if (this.liveSession(input.id) !== undefined) { - await this.klient.session(input.id).setTitle(title); - return; - } - const handle = await resumeSessionById(this.engineAccessor, input.id); - if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(input.id); - try { - await this.klient.session(input.id).setTitle(title); - } finally { - await closeSessionById(this.engineAccessor, input.id); - } + await this.runSessionAccess(input.id, () => + this.withTemporarySession(input.id, () => this.klient.session(input.id).setTitle(title)), + ); + } + + /** + * v2-only (`ISessionTitleService`, session scope). Like `renameSession`, a + * closed session is resumed, titled, and closed again so generation does + * not leak a live session. `undefined` means generation was unavailable + * (no managed OAuth login, no prompt yet, or a custom title is set) — the + * current title is kept. + */ + override async generateSessionTitle( + input: GenerateSessionTitleInput, + ): Promise { + return this.runSessionAccess(input.id, () => + this.withTemporarySession(input.id, () => + this.klient + .session(input.id) + .generateTitle({ force: input.force === true, source: input.source }), + ), + ); } /** @@ -1199,22 +1291,33 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { 'forkSession turnIndex truncation is not wired to agent-core-v2 yet.', ); } - const forkHandler = await handlerForSession(this.engineAccessor, input.id); - if (forkHandler === undefined) throw SDKRpcClientV2.sessionNotFound(input.id); - const handle = await forkHandler.accessor.get(ISessionLifecycleService).fork({ - sourceSessionId: input.id, - newSessionId: input.forkId, - title: input.title, - metadata: input.metadata, - }); - this.wireSession(handle); - return this.resumedSessionSummary(handle); + // The source session's reads (metadata, wire flush) stay atomic against + // its close/reload through the per-session queue; an explicit target id + // takes a second (sorted) queue so fork(A→X) is also atomic against + // create(X) / fork(B→X). + return this.runSessionAccessAll( + input.forkId === undefined ? [input.id] : [input.id, input.forkId], + async () => { + const forkHandler = await handlerForSession(this.engineAccessor, input.id); + if (forkHandler === undefined) throw SDKRpcClientV2.sessionNotFound(input.id); + const handle = await forkHandler.accessor.get(ISessionLifecycleService).fork({ + sourceSessionId: input.id, + newSessionId: input.forkId, + title: input.title, + metadata: input.metadata, + }); + this.wireSession(handle); + return this.resumedSessionSummary(handle); + }, + ); } override async closeSession(input: SessionIdRpcInput): Promise { // v1's print-steer counters die with the Session object; drop ours too. this.printSteerStates.delete(input.sessionId); - await this.klient.session(input.sessionId).close(); + await this.runSessionAccess(input.sessionId, () => + this.klient.session(input.sessionId).close(), + ); } /** @@ -1233,14 +1336,16 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { // scope is materialized. Unlike v1, the v2 // engine has no caller `mcpServers` channel on create/resume (caller // servers are an ACP-side concern to be designed separately). - const handle = await resumeSessionById(this.engineAccessor, input.id, { - additionalDirs: input.additionalDirs, - }); - if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(input.id); - this.wireSession(handle); - return this.resumedSessionSummary(handle, { - includeSubagents: input.includeSubagents, - replayTurnLimit: input.replayTurnLimit, + return this.runSessionAccess(input.id, async () => { + const handle = await resumeSessionById(this.engineAccessor, input.id, { + additionalDirs: input.additionalDirs, + }); + if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(input.id); + this.wireSession(handle); + return this.resumedSessionSummary(handle, { + includeSubagents: input.includeSubagents, + replayTurnLimit: input.replayTurnLimit, + }); }); } @@ -1254,36 +1359,38 @@ export class SDKRpcClientV2 extends SDKRpcClientBase { */ override async reloadSession(input: ReloadSessionRpcInput): Promise { const sessionId = input.sessionId; - const live = this.liveSession(sessionId); - if (live !== undefined) { - for (const agent of live.accessor.get(IAgentLifecycleService).list()) { - if (agent.accessor.get(IAgentActivityView).state().turn !== undefined) { - throw new KimiError( - ErrorCodes.TURN_AGENT_BUSY, - `Session "${sessionId}" cannot be reloaded while a turn is running`, - { details: { sessionId } }, - ); + return this.runSessionAccess(sessionId, async () => { + const live = this.liveSession(sessionId); + if (live !== undefined) { + for (const agent of live.accessor.get(IAgentLifecycleService).list()) { + if (agent.accessor.get(IAgentActivityView).state().turn !== undefined) { + throw new KimiError( + ErrorCodes.TURN_AGENT_BUSY, + `Session "${sessionId}" cannot be reloaded while a turn is running`, + { details: { sessionId } }, + ); + } } + } else if ((await this.engineAccessor.get(ISessionIndex).get(sessionId)) === undefined) { + throw SDKRpcClientV2.sessionNotFound(sessionId); } - } else if ((await this.engineAccessor.get(ISessionIndex).get(sessionId)) === undefined) { - throw SDKRpcClientV2.sessionNotFound(sessionId); - } - await this.configReady; - await this.klient.global.config.reload(); - await this.klient.global.plugins.reload(); - await this.refreshPluginSessionStarts(sessionId); - if (live !== undefined) { - await closeSessionById(this.engineAccessor, sessionId); - } - // Same print-steer reset as closeSession: v1's reload rebuilds the - // Session, and with it the counters. - this.printSteerStates.delete(sessionId); - const handle = await resumeSessionById(this.engineAccessor, sessionId); - if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(sessionId); - const main = handle.accessor.get(IAgentLifecycleService).get(MAIN_AGENT_ID); - await main?.accessor.get(IAgentPluginService).refreshSessionStart(); - this.wireSession(handle); - return this.resumedSessionSummary(handle); + await this.configReady; + await this.klient.global.config.reload(); + await this.klient.global.plugins.reload(); + await this.refreshPluginSessionStarts(sessionId); + if (live !== undefined) { + await closeSessionById(this.engineAccessor, sessionId); + } + // Same print-steer reset as closeSession: v1's reload rebuilds the + // Session, and with it the counters. + this.printSteerStates.delete(sessionId); + const handle = await resumeSessionById(this.engineAccessor, sessionId); + if (handle === undefined) throw SDKRpcClientV2.sessionNotFound(sessionId); + const main = handle.accessor.get(IAgentLifecycleService).get(MAIN_AGENT_ID); + await main?.accessor.get(IAgentPluginService).refreshSessionStart(); + this.wireSession(handle); + return this.resumedSessionSummary(handle); + }); } private async refreshPluginSessionStarts(excludedSessionId?: string): Promise { diff --git a/packages/node-sdk/src/session.ts b/packages/node-sdk/src/session.ts index ae3ab30dedf..7a18fdbb05e 100644 --- a/packages/node-sdk/src/session.ts +++ b/packages/node-sdk/src/session.ts @@ -94,6 +94,11 @@ export class Session { this.onClose = options.onClose; } + /** True once {@link close} began — the session may still be closing in the engine. */ + get isClosed(): boolean { + return this.closed; + } + getResumeState(): ResumedSessionState | undefined { this.ensureOpen(); return this.resumeState; @@ -660,7 +665,7 @@ export class Session { } /** @internal */ - emitMetaUpdated(patch: { readonly title?: string | undefined }): void { + emitMetaUpdated(patch: { readonly title?: string; readonly isCustomTitle?: boolean }): void { this.emit({ type: 'session.meta.updated', sessionId: this.id, diff --git a/packages/node-sdk/src/types.ts b/packages/node-sdk/src/types.ts index d87143c820f..6e444ce218e 100644 --- a/packages/node-sdk/src/types.ts +++ b/packages/node-sdk/src/types.ts @@ -160,6 +160,14 @@ export interface RenameSessionInput { readonly title: string; } +export interface GenerateSessionTitleInput { + readonly id: string; + /** Regenerate even when the session already has a generated/custom title. */ + readonly force?: boolean; + /** Conversation excerpt to generate from (default `user_prompts`). */ + readonly source?: 'user_prompts' | 'first_turn' | 'digest'; +} + export interface ResumeSessionInput { readonly id: string; readonly kaos?: Kaos | undefined; @@ -300,9 +308,20 @@ export interface SessionStatus { readonly usage?: SessionUsage; } +/** + * The engine's canonical title state: `replaceable` (a prompt-derived easy + * title auto generation may overwrite), `generated` (an auto-generated title + * already landed), `custom` (a user-set title that is never overwritten). + * Only populated by the v2 engine on live / resumed sessions (read off the + * metadata document); v1 backends leave it undefined, and the v2 list path + * does not project it. + */ +export type SessionTitleKind = 'replaceable' | 'generated' | 'custom'; + export interface SessionSummary { readonly id: string; readonly title?: string | undefined; + readonly titleKind?: SessionTitleKind; readonly lastPrompt?: string; readonly workDir: string; readonly sessionDir: string; diff --git a/packages/node-sdk/src/v2/session-mapper.ts b/packages/node-sdk/src/v2/session-mapper.ts index ba8918ba782..7ec6f113c94 100644 --- a/packages/node-sdk/src/v2/session-mapper.ts +++ b/packages/node-sdk/src/v2/session-mapper.ts @@ -70,7 +70,7 @@ export function v2MetaToSessionMeta(meta: V2SessionMeta): SessionMeta { createdAt: new Date(meta.createdAt).toISOString(), updatedAt: new Date(meta.updatedAt).toISOString(), title: meta.title ?? '', - isCustomTitle: meta.isCustomTitle ?? false, + isCustomTitle: meta.titleKind === 'custom', lastPrompt: meta.lastPrompt, forkedFrom: meta.forkedFrom, workDir: meta.cwd, diff --git a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts index 13f74c5a821..94bd1776e7f 100644 --- a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts +++ b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts @@ -4,13 +4,18 @@ * Responsibilities: `getExperimentalFeatures` is migrated end-to-end; every * not-yet-migrated method fails loudly with `not_implemented` instead of * silently hitting a v1 core. - * Wiring: real v2 engine bootstrapped on a temp KIMI_CODE_HOME; no provider calls. + * Wiring: real v2 engine bootstrapped on a temp KIMI_CODE_HOME; remote provider calls are stubbed. * Run: pnpm exec vitest run test/sdk-rpc-client-v2.test.ts */ import { mkdir, mkdtemp, readdir, readFile, rm, writeFile } from 'node:fs/promises'; import { tmpdir } from 'node:os'; import { join } from 'node:path'; +import { + FileTokenStorage, + resolveKimiCodeOAuthRef, + resolveKimiTokenStorageName, +} from '@moonshot-ai/kimi-code-oauth'; import { afterEach, describe, expect, it, vi } from 'vitest'; import { @@ -20,6 +25,7 @@ import { KimiHarness, removeProviderFromConfig, SDKRpcClientV2, + type Event, type KimiConfig, } from '#/index'; import { foldAgentWireReplay } from '#/v2/resume-replay'; @@ -28,6 +34,9 @@ import { drainSessionIndexMirror, HostProcessError, IHostRequestHeaders, + ISessionLifecycleHooks, + ISessionLifecycleService, + IWorkspaceLifecycleService, OsProcessErrors, } from '@moonshot-ai/agent-core-v2'; @@ -235,6 +244,362 @@ describe('SDKRpcClientV2 (agent-core-v2 wiring MVP)', () => { } }); + it('emits one complete metadata event when a generated title is applied', async () => { + const homeDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-')); + tempDirs.push(homeDir); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + const titleBaseUrl = 'https://api.example.test/coding/v1'; + const titleOAuthRef = resolveKimiCodeOAuthRef({ baseUrl: titleBaseUrl }); + // Storage names strip the `oauth/` prefix (FileTokenStorage rejects + // namespaced keys); the engine resolves the same name when reading. + await new FileTokenStorage(join(homeDir, 'credentials')).save( + resolveKimiTokenStorageName({ oauthKey: titleOAuthRef.key }), + { + accessToken: 'test-access-token', + refreshToken: 'test-refresh-token', + expiresAt: Math.floor(Date.now() / 1000) + 3600, + scope: '', + tokenType: 'Bearer', + expiresIn: 3600, + }, + ); + await writeFile( + join(homeDir, 'config.toml'), + ` +default_model = "stub" + +[experimental] +auto_session_title = true + +[providers.stub] +type = "openai" +base_url = "https://model.example.test/v1" +api_key = "stub" + +[models.stub] +provider = "stub" +model = "stub" +max_context_size = 1000 + +[providers."managed:kimi-code"] +type = "kimi" +base_url = "${titleBaseUrl}" + +[providers."managed:kimi-code".oauth] +storage = "file" +key = "${titleOAuthRef.key}" +`, + 'utf-8', + ); + const fetchSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => { + const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url; + if (url === 'https://api.example.test/coding/v1/tools') { + return new Response(JSON.stringify({ title: 'Generated title' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }); + } + throw new Error(`Unexpected fetch: ${url}`); + }); + const harness = createKimiHarnessV2({ homeDir, identity: TEST_IDENTITY }); + + try { + const session = await harness.createSession({ id: 'ses_generated_title_event', workDir }); + await session.importContext( + 'Generate a concise title for this session', + "session 'source-session'", + ); + await expect( + harness.auth.getCachedAccessToken('managed:kimi-code', { + storage: titleOAuthRef.storage, + key: titleOAuthRef.key, + }), + ).resolves.toBe('test-access-token'); + await expect(session.getContext()).resolves.toMatchObject({ + history: [ + expect.objectContaining({ + role: 'user', + origin: { kind: 'user' }, + }), + ], + }); + const events: Event[] = []; + const unsubscribe = session.onEvent((event) => { + if (event.type === 'session.meta.updated' && event.title === 'Generated title') { + events.push(event); + } + }); + + await expect(harness.generateSessionTitle({ id: session.id })).resolves.toBe( + 'Generated title', + ); + unsubscribe(); + + expect(events).toEqual([ + expect.objectContaining({ + type: 'session.meta.updated', + sessionId: session.id, + agentId: 'main', + title: 'Generated title', + patch: { title: 'Generated title', isCustomTitle: false }, + }), + ]); + } finally { + await harness.close(); + fetchSpy.mockRestore(); + } + }); + + it('serializes a temporary title-generation close against a public resume', async () => { + const homeDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-')); + tempDirs.push(homeDir); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + const titleBaseUrl = 'https://api.example.test/coding/v1'; + const titleOAuthRef = resolveKimiCodeOAuthRef({ baseUrl: titleBaseUrl }); + await new FileTokenStorage(join(homeDir, 'credentials')).save( + resolveKimiTokenStorageName({ oauthKey: titleOAuthRef.key }), + { + accessToken: 'test-access-token', + refreshToken: 'test-refresh-token', + expiresAt: Math.floor(Date.now() / 1000) + 3600, + scope: '', + tokenType: 'Bearer', + expiresIn: 3600, + }, + ); + await writeFile( + join(homeDir, 'config.toml'), + ` +default_model = "stub" + +[experimental] +auto_session_title = true + +[providers.stub] +type = "openai" +base_url = "https://model.example.test/v1" +api_key = "stub" + +[models.stub] +provider = "stub" +model = "stub" +max_context_size = 1000 + +[providers."managed:kimi-code"] +type = "kimi" +base_url = "${titleBaseUrl}" + +[providers."managed:kimi-code".oauth] +storage = "file" +key = "${titleOAuthRef.key}" +`, + 'utf-8', + ); + let markFetchStarted!: () => void; + let resolveFetch!: (response: Response) => void; + const fetchStarted = new Promise((resolve) => { + markFetchStarted = resolve; + }); + const fetchResponse = new Promise((resolve) => { + resolveFetch = resolve; + }); + const fetchSpy = vi.spyOn(globalThis, 'fetch').mockImplementation(async (input) => { + const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url; + if (url === 'https://api.example.test/coding/v1/tools') { + markFetchStarted(); + return fetchResponse; + } + throw new Error(`Unexpected fetch: ${url}`); + }); + const client = new SDKRpcClientV2({ homeDir, identity: TEST_IDENTITY }); + + try { + await client.createSession({ id: 'ses_title_race', workDir }); + await client.importContext({ + sessionId: 'ses_title_race', + content: 'Generate a concise title for this session', + source: "session 'source-session'", + }); + await client.closeSession({ sessionId: 'ses_title_race' }); + + // The cold session is temporarily resumed for generation; block its + // cleanup close inside the will-close hooks so the public resume below + // lands while the close is still in flight. + const titlePromise = client.generateSessionTitle({ id: 'ses_title_race' }); + await fetchStarted; + const handler = await client.engineAccessor + .get(IWorkspaceLifecycleService) + .handlerFor({ root: workDir }); + const tempHandle = handler.accessor.get(ISessionLifecycleService).get('ses_title_race'); + expect(tempHandle).toBeDefined(); + let markCloseStarted!: () => void; + let openCloseGate!: () => void; + const closeStarted = new Promise((resolve) => { + markCloseStarted = resolve; + }); + const closeGate = new Promise((resolve) => { + openCloseGate = resolve; + }); + tempHandle!.accessor + .get(ISessionLifecycleHooks) + .onWillCloseSession.register('test-block', async (_event, next) => { + markCloseStarted(); + await closeGate; + await next(); + }); + + resolveFetch( + new Response(JSON.stringify({ title: 'Generated title' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + await closeStarted; + + // The resume must queue behind the in-flight close instead of merging + // into the handle that is being torn down. + const order: string[] = []; + const resumePromise = client.resumeSession({ id: 'ses_title_race' }).then((summary) => { + order.push('resumed'); + return summary; + }); + await new Promise((resolve) => setTimeout(resolve, 0)); + expect(order).toEqual([]); + + openCloseGate(); + await expect(titlePromise).resolves.toBe('Generated title'); + const summary = await resumePromise; + expect(summary.id).toBe('ses_title_race'); + expect(order).toEqual(['resumed']); + + // The resumed session is a fresh, fully usable scope — not the handle + // the temporary path just tore down. + await client.renameSession({ id: 'ses_title_race', title: 'Resumed title' }); + const sessions = await client.listSessions({ workDir }); + expect(sessions.find((item) => item.id === 'ses_title_race')?.title).toBe('Resumed title'); + } finally { + await client.close(); + fetchSpy.mockRestore(); + } + }); + + it('re-resumes a fresh session facade while the public close is in flight', async () => { + const { harness } = await makeHarness(); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + + try { + const session = await harness.createSession({ id: 'ses_resume_race', workDir }); + // close() flips `isClosed` synchronously; the engine close settles + // asynchronously. The public resume must not hand back the closing + // facade — it queues behind the close and materializes a fresh one. + const closing = session.close(); + const resumed = await harness.resumeSession({ id: 'ses_resume_race' }); + await closing; + + expect(resumed).not.toBe(session); + expect(session.isClosed).toBe(true); + expect(resumed.isClosed).toBe(false); + expect(resumed.getResumeState()).toBeTruthy(); + // The stale facade's late onClose must not evict the live session. + expect(harness.getSession('ses_resume_race')).toBe(resumed); + } finally { + await harness.close(); + } + }); + + it('rejects one of two concurrent creates with the same explicit session id', async () => { + const { harness } = await makeHarness(); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + + try { + const [first, second] = await Promise.allSettled([ + harness.createSession({ id: 'ses_same_id', workDir }), + harness.createSession({ id: 'ses_same_id', workDir }), + ]); + + const outcomes = [first, second].map((result) => result.status); + expect(outcomes.sort()).toEqual(['fulfilled', 'rejected']); + const rejection = [first, second].find((result) => result.status === 'rejected'); + expect((rejection as PromiseRejectedResult).reason).toMatchObject({ + code: 'session.already_exists', + }); + await expect(harness.resumeSession({ id: 'ses_same_id' })).resolves.toMatchObject({ + id: 'ses_same_id', + }); + } finally { + await harness.close(); + } + }); + + it('coalesces concurrent public resumes onto one session facade', async () => { + const { harness } = await makeHarness(); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + + try { + const session = await harness.createSession({ id: 'ses_coalesce', workDir }); + await session.close(); + + const [first, second] = await Promise.all([ + harness.resumeSession({ id: 'ses_coalesce' }), + harness.resumeSession({ id: 'ses_coalesce' }), + ]); + + // One engine handle, one facade: a later close on either reference + // must not strand a second live facade over the same handle. + expect(first).toBe(second); + expect(harness.getSession('ses_coalesce')).toBe(first); + } finally { + await harness.close(); + } + }); + + it('does not coalesce resumes with different options onto one facade', async () => { + const { harness } = await makeHarness(); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + + try { + const session = await harness.createSession({ id: 'ses_no_coalesce', workDir }); + await session.close(); + + const [plain, withReplay] = await Promise.all([ + harness.resumeSession({ id: 'ses_no_coalesce' }), + harness.resumeSession({ id: 'ses_no_coalesce', replayTurnLimit: 3 }), + ]); + + // Different options must not be silently dropped onto the first + // caller's facade — each gets its own resume. + expect(plain).not.toBe(withReplay); + } finally { + await harness.close(); + } + }); + + it('reports the title state in the resumed summary', async () => { + const { harness } = await makeHarness(); + const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); + tempDirs.push(workDir); + + try { + const session = await harness.createSession({ id: 'ses_title_kind', workDir }); + await harness.renameSession({ id: session.id, title: '我的标题' }); + + // The resumed summary is read off the live metadata document, so it + // carries the canonical title state; the list path (index projection) + // intentionally does not. + await session.close(); + const resumed = await harness.resumeSession({ id: session.id }); + expect(resumed.summary?.titleKind).toBe('custom'); + } finally { + await harness.close(); + } + }); + it('serves listWorkspaceSkills through the engineAccessor escape hatch', async () => { const { harness, homeDir } = await makeHarness(); const workDir = await mkdtemp(join(tmpdir(), 'kimi-sdk-v2-work-')); diff --git a/packages/node-sdk/test/v1-v2-parity.test.ts b/packages/node-sdk/test/v1-v2-parity.test.ts index 0c915fa7e2f..d176b6e3a19 100644 --- a/packages/node-sdk/test/v1-v2-parity.test.ts +++ b/packages/node-sdk/test/v1-v2-parity.test.ts @@ -233,7 +233,9 @@ const KNOWN_DIFFS = { // default title 'New Session' into state.json and reports it for // never-titled sessions where v2 leaves the title unset; only that // materialized default is projected away (explicit titles compare in - // full). Per-home paths (sessionDir, agent homedirs) compare after the + // full). `titleKind` is v2-only (the v1 wire has no canonical title-state + // field, only the `isCustomTitle` boolean inside `sessionMetadata`) — + // deleted. Per-home paths (sessionDir, agent homedirs) compare after the // home-prefix scrub — both engines lay sessions out as // `/sessions//` with the same key derivation. listSessions: (summaries: readonly SessionSummary[], home: HomePair): unknown => @@ -362,6 +364,7 @@ function projectSessionSummary(summary: SessionSummary, home: HomePair): unknown const projected = scrubHomePrefixes(summary, home) as Record; delete projected['createdAt']; delete projected['updatedAt']; + delete projected['titleKind']; // `lastTurnReason` is v2-only: the v1 engine never records a turn outcome, // so the field cannot compare across engines. delete projected['lastTurnReason']; diff --git a/packages/oauth/src/index.ts b/packages/oauth/src/index.ts index bcf502ecc73..417876b66c9 100644 --- a/packages/oauth/src/index.ts +++ b/packages/oauth/src/index.ts @@ -111,6 +111,13 @@ export type { UsageWindow, } from './managed-usage'; +export { fetchChatTitle, kimiCodeToolsUrl } from './managed-tools'; +export type { + FetchChatTitleError, + FetchChatTitleOk, + FetchChatTitleResult, +} from './managed-tools'; + export { fetchSubmitFeedback, kimiCodeFeedbackUrl } from './managed-feedback'; export type { FetchSubmitFeedbackError, diff --git a/packages/oauth/src/managed-tools.ts b/packages/oauth/src/managed-tools.ts new file mode 100644 index 00000000000..46bf05f65a0 --- /dev/null +++ b/packages/oauth/src/managed-tools.ts @@ -0,0 +1,99 @@ +/** + * Managed-platform `/tools` dispatch: POSTs `{method, params}` to + * `{kimiCodeBaseUrl}/tools` with a Bearer access token, the same wire + * shape the backend tool surface expects (see `chat_title` below). + * + * `chat_title` generates a short session title from a chat excerpt: + * + * { "method": "chat_title", "params": { "chat_content": "user: ...\nassistant: ..." } } + * → { "title": "..." } + */ + +import { readApiErrorMessage } from './api-error'; +import { kimiCodeBaseUrl } from './managed-usage'; +import { isRecord } from './utils'; + +export interface FetchChatTitleOk { + readonly kind: 'ok'; + readonly title: string; +} + +export interface FetchChatTitleError { + readonly kind: 'error'; + readonly status?: number; + readonly message: string; +} + +export type FetchChatTitleResult = FetchChatTitleOk | FetchChatTitleError; + +export function kimiCodeToolsUrl(baseUrl?: string): string { + return `${(baseUrl ?? kimiCodeBaseUrl()).replace(/\/+$/, '')}/tools`; +} + +export async function fetchChatTitle( + url: string, + accessToken: string, + chatContent: string, + opts: { timeoutMs?: number; headers?: Record; signal?: AbortSignal } = {}, +): Promise { + const controller = new AbortController(); + const onExternalAbort = () => { + controller.abort(); + }; + if (opts.signal !== undefined) { + if (opts.signal.aborted) controller.abort(); + else opts.signal.addEventListener('abort', onExternalAbort, { once: true }); + } + const timer = setTimeout(() => { + controller.abort(); + }, opts.timeoutMs ?? 8000); + try { + const headers = new Headers(opts.headers); + headers.set('Authorization', `Bearer ${accessToken}`); + headers.set('Accept', 'application/json'); + headers.set('Content-Type', 'application/json'); + const res = await fetch(url, { + method: 'POST', + headers, + body: JSON.stringify({ + method: 'chat_title', + params: { chat_content: chatContent }, + }), + signal: controller.signal, + }); + if (!res.ok) { + return { + kind: 'error', + status: res.status, + message: await readApiErrorMessage( + res, + `Failed to generate session title: HTTP ${String(res.status)}`, + ), + }; + } + const title = parseChatTitle(await res.json()); + if (title === undefined) { + return { kind: 'error', message: 'Failed to generate session title: missing title.' }; + } + return { kind: 'ok', title }; + } catch (error) { + if (error instanceof Error && error.name === 'AbortError') { + const reason = + opts.signal?.aborted === true ? 'request aborted.' : 'request timed out.'; + return { kind: 'error', message: `Failed to generate session title: ${reason}` }; + } + const msg = error instanceof Error ? error.message : String(error); + return { kind: 'error', message: `Failed to generate session title: ${msg}` }; + } finally { + clearTimeout(timer); + opts.signal?.removeEventListener('abort', onExternalAbort); + } +} + +function parseChatTitle(payload: unknown): string | undefined { + if (!isRecord(payload)) return undefined; + const value = payload['title']; + if (typeof value !== 'string') return undefined; + const title = value.trim(); + return title.length > 0 ? title : undefined; +} diff --git a/packages/oauth/test/managed-tools.test.ts b/packages/oauth/test/managed-tools.test.ts new file mode 100644 index 00000000000..53de6cc6f4d --- /dev/null +++ b/packages/oauth/test/managed-tools.test.ts @@ -0,0 +1,272 @@ +/** + * Scenario: the managed `/tools` chat_title request contract, including + * response validation, API failures, timeouts, and transport errors. + * Wiring: the real request builder with only the external fetch boundary + * stubbed. Run with: + * `pnpm exec vitest run packages/oauth/test/managed-tools.test.ts`. + */ + +import { afterEach, describe, expect, it, vi } from 'vitest'; + +import { fetchChatTitle, kimiCodeToolsUrl } from '../src/managed-tools'; + +afterEach(() => { + vi.unstubAllGlobals(); + vi.unstubAllEnvs(); +}); + +describe('kimiCodeToolsUrl', () => { + it('appends /tools to the default base URL', () => { + expect(kimiCodeToolsUrl()).toBe('https://api.kimi.com/coding/v1/tools'); + }); + + it('honours KIMI_CODE_BASE_URL and trims trailing slashes', () => { + vi.stubEnv('KIMI_CODE_BASE_URL', 'https://example.test/v9///'); + expect(kimiCodeToolsUrl()).toBe('https://example.test/v9/tools'); + }); +}); + +describe('fetchChatTitle', () => { + it('POSTs the chat_title method with bearer auth and returns the title on 200', async () => { + const fetchMock = vi.fn( + async () => + new Response(JSON.stringify({ title: 'Go nil pointer 错误排查' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + vi.stubGlobal('fetch', fetchMock); + + const result = await fetchChatTitle( + 'https://api.example/tools', + 'access-token', + 'user: nil pointer 报错', + ); + + expect(result).toEqual({ kind: 'ok', title: 'Go nil pointer 错误排查' }); + + const calls = fetchMock.mock.calls as unknown as [string, RequestInit?][]; + const [calledUrl, init] = calls[0]!; + expect(calledUrl).toBe('https://api.example/tools'); + expect(init?.method).toBe('POST'); + + const headers = new Headers((init?.headers ?? {}) as Record); + expect(headers.get('authorization')).toBe('Bearer access-token'); + expect(headers.get('content-type')).toBe('application/json'); + + expect(JSON.parse(init?.body as string)).toEqual({ + method: 'chat_title', + params: { chat_content: 'user: nil pointer 报错' }, + }); + }); + + it('keeps protocol headers authoritative when custom header casing differs', async () => { + const fetchMock = vi.fn( + async () => + new Response(JSON.stringify({ title: '标题' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ); + vi.stubGlobal('fetch', fetchMock); + + await fetchChatTitle('https://api.example/tools', 'access-token', 'user: hi', { + headers: { + authorization: 'Bearer wrong-token', + aCcEpT: 'text/plain', + 'content-TYPE': 'text/plain', + 'X-Proxy-Header': 'present', + }, + }); + + const [, init] = (fetchMock.mock.calls as unknown as [string, RequestInit?][])[0]!; + const headers = new Headers(init?.headers as Record); + expect(headers.get('authorization')).toBe('Bearer access-token'); + expect(headers.get('accept')).toBe('application/json'); + expect(headers.get('content-type')).toBe('application/json'); + expect(headers.get('x-proxy-header')).toBe('present'); + }); + + it('trims surrounding whitespace from the title', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + async () => + new Response(JSON.stringify({ title: ' 标题 \n' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi'); + + expect(result).toEqual({ kind: 'ok', title: '标题' }); + }); + + it('returns an error when the server omits the title', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + async () => + new Response(JSON.stringify({ ok: true }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi'); + + expect(result).toEqual({ + kind: 'error', + message: 'Failed to generate session title: missing title.', + }); + }); + + it('returns an error with status when the server responds 401', async () => { + vi.stubGlobal( + 'fetch', + vi.fn(async () => new Response('', { status: 401 })), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi'); + + expect(result.kind).toBe('error'); + if (result.kind !== 'error') return; + expect(result.status).toBe(401); + expect(result.message).toMatch(/401/); + }); + + it('surfaces API error messages from failed generations', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + async () => + new Response(JSON.stringify({ error: { message: 'title rejected' } }), { + status: 400, + headers: { 'Content-Type': 'application/json' }, + }), + ), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi'); + + expect(result).toEqual({ kind: 'error', status: 400, message: 'title rejected' }); + }); + + it('returns a timeout error when the request aborts', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + (_url: string, init?: RequestInit) => + new Promise((_, reject) => { + init?.signal?.addEventListener('abort', () => { + const err = new Error('aborted'); + err.name = 'AbortError'; + reject(err); + }); + }), + ), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi', { + timeoutMs: 5, + }); + + expect(result.kind).toBe('error'); + if (result.kind !== 'error') return; + expect(result.status).toBeUndefined(); + expect(result.message).toMatch(/timed out/); + }); + + it('returns a generic error message on network failure', async () => { + vi.stubGlobal( + 'fetch', + vi.fn(async () => { + throw new TypeError('network down'); + }), + ); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi'); + + expect(result.kind).toBe('error'); + if (result.kind !== 'error') return; + expect(result.message).toMatch(/network down/); + }); + + it('reports an external abort as an abort, not a timeout', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + (_url: string, init?: RequestInit) => + new Promise((_, reject) => { + const rejectAbort = () => { + const err = new Error('aborted'); + err.name = 'AbortError'; + reject(err); + }; + if (init?.signal?.aborted === true) { + rejectAbort(); + return; + } + init?.signal?.addEventListener('abort', rejectAbort); + }), + ), + ); + const external = new AbortController(); + + const resultPromise = fetchChatTitle('https://api.example/tools', 'tok', 'user: hi', { + signal: external.signal, + timeoutMs: 60_000, + }); + external.abort(); + const result = await resultPromise; + + expect(result.kind).toBe('error'); + if (result.kind !== 'error') return; + expect(result.message).toMatch(/aborted/); + expect(result.message).not.toMatch(/timed out/); + }); + + it('fails fast on an already-aborted external signal', async () => { + const fetchMock = vi.fn(async () => { + throw new Error('fetch should not start when the signal is pre-aborted'); + }); + vi.stubGlobal('fetch', fetchMock); + const external = new AbortController(); + external.abort(); + + const result = await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi', { + signal: external.signal, + }); + + expect(result.kind).toBe('error'); + if (result.kind !== 'error') return; + expect(result.message).toMatch(/aborted/); + }); + + it('removes the external abort listener once the request settles', async () => { + vi.stubGlobal( + 'fetch', + vi.fn( + async () => + new Response(JSON.stringify({ title: '标题' }), { + status: 200, + headers: { 'Content-Type': 'application/json' }, + }), + ), + ); + const external = new AbortController(); + const addSpy = vi.spyOn(external.signal, 'addEventListener'); + const removeSpy = vi.spyOn(external.signal, 'removeEventListener'); + + await fetchChatTitle('https://api.example/tools', 'tok', 'user: hi', { + signal: external.signal, + }); + + expect(addSpy).toHaveBeenCalledTimes(1); + expect(removeSpy).toHaveBeenCalledTimes(1); + expect(removeSpy.mock.calls[0]?.[1]).toBe(addSpy.mock.calls[0]?.[1]); + }); +}); From 4739284fb90c30023ee425d69dc777e742a2dcc6 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 18:12:08 +0800 Subject: [PATCH 39/50] refactor(features): extract session init feature (#2887) - move the session init domain under features - contribute the session service through SessionInitFeature - cover feature withdrawal and restoration --- apps/kimi-inspect/src/panels.ts | 2 +- .../sessionInit/profile/init.md | 0 .../sessionInit/profile/init.ts | 0 .../sessionInit/sessionInit.ts | 0 .../sessionInit/sessionInitFeature.ts | 21 ++++++ .../sessionInit/sessionInitService.ts | 11 --- packages/agent-core-v2/src/index.ts | 7 +- .../sessionInit/sessionInit.test.ts | 4 +- .../sessionInit/sessionInitFeature.test.ts | 72 +++++++++++++++++++ 9 files changed, 100 insertions(+), 17 deletions(-) rename packages/agent-core-v2/src/{session => features}/sessionInit/profile/init.md (100%) rename packages/agent-core-v2/src/{session => features}/sessionInit/profile/init.ts (100%) rename packages/agent-core-v2/src/{session => features}/sessionInit/sessionInit.ts (100%) create mode 100644 packages/agent-core-v2/src/features/sessionInit/sessionInitFeature.ts rename packages/agent-core-v2/src/{session => features}/sessionInit/sessionInitService.ts (95%) rename packages/agent-core-v2/test/{session => features}/sessionInit/sessionInit.test.ts (98%) create mode 100644 packages/agent-core-v2/test/features/sessionInit/sessionInitFeature.test.ts diff --git a/apps/kimi-inspect/src/panels.ts b/apps/kimi-inspect/src/panels.ts index 55564701282..ce241fbbec1 100644 --- a/apps/kimi-inspect/src/panels.ts +++ b/apps/kimi-inspect/src/panels.ts @@ -35,7 +35,7 @@ import { IProviderService } from '@moonshot-ai/agent-core-v2/kosong/provider/pro import { ISessionApprovalService } from '@moonshot-ai/agent-core-v2/session/approval/approval'; import { ISessionInteractionService } from '@moonshot-ai/agent-core-v2/session/interaction/interaction'; import { ISessionQuestionService } from '@moonshot-ai/agent-core-v2/session/question/question'; -import { ISessionInitService } from '@moonshot-ai/agent-core-v2/session/sessionInit/sessionInit'; +import { ISessionInitService } from '@moonshot-ai/agent-core-v2/features/sessionInit/sessionInit'; import { ISessionMetadata } from '@moonshot-ai/agent-core-v2/session/sessionMetadata/sessionMetadata'; import { ISessionWorkspaceContext } from '@moonshot-ai/agent-core-v2/session/workspaceContext/workspaceContext'; diff --git a/packages/agent-core-v2/src/session/sessionInit/profile/init.md b/packages/agent-core-v2/src/features/sessionInit/profile/init.md similarity index 100% rename from packages/agent-core-v2/src/session/sessionInit/profile/init.md rename to packages/agent-core-v2/src/features/sessionInit/profile/init.md diff --git a/packages/agent-core-v2/src/session/sessionInit/profile/init.ts b/packages/agent-core-v2/src/features/sessionInit/profile/init.ts similarity index 100% rename from packages/agent-core-v2/src/session/sessionInit/profile/init.ts rename to packages/agent-core-v2/src/features/sessionInit/profile/init.ts diff --git a/packages/agent-core-v2/src/session/sessionInit/sessionInit.ts b/packages/agent-core-v2/src/features/sessionInit/sessionInit.ts similarity index 100% rename from packages/agent-core-v2/src/session/sessionInit/sessionInit.ts rename to packages/agent-core-v2/src/features/sessionInit/sessionInit.ts diff --git a/packages/agent-core-v2/src/features/sessionInit/sessionInitFeature.ts b/packages/agent-core-v2/src/features/sessionInit/sessionInitFeature.ts new file mode 100644 index 00000000000..30d9f7c7c68 --- /dev/null +++ b/packages/agent-core-v2/src/features/sessionInit/sessionInitFeature.ts @@ -0,0 +1,21 @@ +import { LifecycleScope } from '#/app/scopes'; +import { Feature } from '#/features/feature'; +import { registerFeature } from '#/features/featureRegistry'; + +import { ISessionInitService } from './sessionInit'; +import { SessionInitService } from './sessionInitService'; + +export class SessionInitFeature extends Feature { + static override readonly name = 'sessionInit'; + + constructor() { + super(); + this.contributeService( + LifecycleScope.Session, + ISessionInitService, + SessionInitService, + ); + } +} + +registerFeature(SessionInitFeature); diff --git a/packages/agent-core-v2/src/session/sessionInit/sessionInitService.ts b/packages/agent-core-v2/src/features/sessionInit/sessionInitService.ts similarity index 95% rename from packages/agent-core-v2/src/session/sessionInit/sessionInitService.ts rename to packages/agent-core-v2/src/features/sessionInit/sessionInitService.ts index 613a1d847c0..f0a4d7d5b46 100644 --- a/packages/agent-core-v2/src/session/sessionInit/sessionInitService.ts +++ b/packages/agent-core-v2/src/features/sessionInit/sessionInitService.ts @@ -22,9 +22,6 @@ * `SESSION_INIT_FAILED`) so callers can tell "aborted" from "failed". */ -import { LifecycleScope } from '#/app/scopes'; - -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { isAbortError, isUserCancellation, userCancellationReason } from '#/_base/utils/abort'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IHostEnvironment } from '#/os/interface/hostEnvironment'; @@ -144,11 +141,3 @@ export class SessionInitService implements ISessionInitService { } } } - -registerScopedService( - LifecycleScope.Session, - ISessionInitService, - SessionInitService, - ScopeActivation.OnScopeCreated, - 'session-init', -); diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 92bf9616535..3efa13e513c 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -640,9 +640,10 @@ export * from '#/agent/shellCommand/shellCommandService'; export * from '#/agent/scopeContext/scopeContext'; export * from '#/agent/stepRetry/stepRetry'; export * from '#/agent/stepRetry/stepRetryService'; -export * from '#/session/sessionInit/sessionInit'; -export * from '#/session/sessionInit/sessionInitService'; -export * from '#/session/sessionInit/profile/init'; +export * from '#/features/sessionInit/sessionInit'; +export * from '#/features/sessionInit/sessionInitService'; +export * from '#/features/sessionInit/profile/init'; +import '#/features/sessionInit/sessionInitFeature'; export * from '#/session/todo/todoItem'; export * from '#/session/todo/todoListReminder'; export * from '#/session/todo/sessionTodo'; diff --git a/packages/agent-core-v2/test/session/sessionInit/sessionInit.test.ts b/packages/agent-core-v2/test/features/sessionInit/sessionInit.test.ts similarity index 98% rename from packages/agent-core-v2/test/session/sessionInit/sessionInit.test.ts rename to packages/agent-core-v2/test/features/sessionInit/sessionInit.test.ts index 47da972bf3a..a42a70d0463 100644 --- a/packages/agent-core-v2/test/session/sessionInit/sessionInit.test.ts +++ b/packages/agent-core-v2/test/features/sessionInit/sessionInit.test.ts @@ -17,8 +17,8 @@ import { IWireService } from '#/wire/wire'; import { ErrorCodes, Error2 } from '#/errors'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; -import { ISessionInitService } from '#/session/sessionInit/sessionInit'; -import { SessionInitService } from '#/session/sessionInit/sessionInitService'; +import { ISessionInitService } from '#/features/sessionInit/sessionInit'; +import { SessionInitService } from '#/features/sessionInit/sessionInitService'; import { ISessionSubagentService } from '#/session/subagent/subagent'; const WORK_DIR = '/project'; diff --git a/packages/agent-core-v2/test/features/sessionInit/sessionInitFeature.test.ts b/packages/agent-core-v2/test/features/sessionInit/sessionInitFeature.test.ts new file mode 100644 index 00000000000..ac896b6c297 --- /dev/null +++ b/packages/agent-core-v2/test/features/sessionInit/sessionInitFeature.test.ts @@ -0,0 +1,72 @@ +import { beforeEach, describe, expect, it } from 'vitest'; + +import { ScopeActivation } from '#/_base/di/instantiation'; +import { + _clearScopedRegistryForTests, + registerScopedService, +} from '#/_base/di/scope'; +import { createScopedTestHost, stubPair } from '#/_base/di/test'; +import { IBootstrapService } from '#/app/bootstrap/bootstrap'; +import { IFeatureManager } from '#/app/feature/featureManager'; +import { FeatureManagerService } from '#/app/feature/featureManagerService'; +import { LifecycleScope } from '#/app/scopes'; +import { SessionInitFeature } from '#/features/sessionInit/sessionInitFeature'; +import { ISessionInitService } from '#/features/sessionInit/sessionInit'; +import { IHostEnvironment } from '#/os/interface/hostEnvironment'; +import { IHostFileSystem } from '#/os/interface/hostFileSystem'; +import { IFeatureAssemblyService } from '#/features/featureAssembly'; +import { FeatureAssemblyService } from '#/features/featureAssemblyService'; +import { + _clearFeatureRecipesForTests, + registerFeature, +} from '#/features/featureRegistry'; +import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; +import { ISessionContext } from '#/session/sessionContext/sessionContext'; +import { ISessionSubagentService } from '#/session/subagent/subagent'; + +describe('SessionInitFeature', () => { + beforeEach(() => { + _clearScopedRegistryForTests(); + _clearFeatureRecipesForTests(); + registerScopedService( + LifecycleScope.App, + IFeatureManager, + FeatureManagerService, + ScopeActivation.OnScopeCreated, + 'feature', + ); + registerScopedService( + LifecycleScope.App, + IFeatureAssemblyService, + FeatureAssemblyService, + ScopeActivation.OnScopeCreated, + 'features', + ); + registerFeature(SessionInitFeature); + }); + + it('withdraws and restores the Session service with the Feature', async () => { + const host = createScopedTestHost(); + const session = host.child(LifecycleScope.Session, 'session-1', [ + stubPair(IAgentLifecycleService, {} as IAgentLifecycleService), + stubPair(ISessionSubagentService, {} as ISessionSubagentService), + stubPair(IHostFileSystem, {} as IHostFileSystem), + stubPair(IHostEnvironment, {} as IHostEnvironment), + stubPair(IBootstrapService, {} as IBootstrapService), + stubPair(ISessionContext, {} as ISessionContext), + ]); + const manager = host.app.accessor.get(IFeatureManager); + + expect(session.accessor.get(ISessionInitService)).toBeDefined(); + + await manager.unprovideUnit('sessionInit'); + await host.app.instantiation.cascade.whenIdle(); + expect(() => session.accessor.get(ISessionInitService)).toThrow(); + + manager.provideUnit(SessionInitFeature); + await host.app.instantiation.cascade.whenIdle(); + expect(session.accessor.get(ISessionInitService)).toBeDefined(); + + host.dispose(); + }); +}); From 1811bd4baf5b75ba076e2a24825f9c4f82c13341 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Thu, 13 Aug 2026 18:12:46 +0800 Subject: [PATCH 40/50] fix(tui): keep banner main text readable with long tags on narrow terminals (#2884) * fix(tui): keep banner main text readable with long tags on narrow terminals The banner layout inlines the tag and wraps the main text into the remaining width. Remote banner configs can set a full-sentence tag (e.g. the 38-char K3 thinking-effort banner), which on narrow terminals leaves the main text only a few columns, so it wraps into a ragged, hard-broken column ("balan/ce", "capab/ility"). When the inline tag would leave the main text fewer than 16 columns, render the tag on its own line and give the main text and subtext the full width, aligned with the tag text. Short tags stay inline; tags wider than the terminal are still dropped as before. * chore: add changeset for banner narrow-terminal fix --------- Co-authored-by: Mira --- .../fix-banner-long-tag-narrow-terminal.md | 5 +++ .../src/tui/components/chrome/banner.ts | 31 ++++++++++--- .../test/tui/components/chrome/banner.test.ts | 44 +++++++++++++++++-- 3 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 .changeset/fix-banner-long-tag-narrow-terminal.md diff --git a/.changeset/fix-banner-long-tag-narrow-terminal.md b/.changeset/fix-banner-long-tag-narrow-terminal.md new file mode 100644 index 00000000000..24607f482e3 --- /dev/null +++ b/.changeset/fix-banner-long-tag-narrow-terminal.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix startup banner text wrapping on narrow terminals. diff --git a/apps/kimi-code/src/tui/components/chrome/banner.ts b/apps/kimi-code/src/tui/components/chrome/banner.ts index 58b6faa5838..1ecf4af2c28 100644 --- a/apps/kimi-code/src/tui/components/chrome/banner.ts +++ b/apps/kimi-code/src/tui/components/chrome/banner.ts @@ -6,6 +6,14 @@ import type { BannerState } from '#/tui/types'; const PREFIX_STAR = '✦'; const PADDING = ' '; +/** + * Minimum column count the main text gets next to an inline tag. A long tag + * (e.g. a full sentence from the remote banner config) can fit on the line + * yet leave only a sliver for the main text, which then wraps into a narrow, + * hard-broken column. When that would happen the tag moves onto its own line + * and the main text uses (nearly) the full width instead. + */ +const MIN_INLINE_MAIN_TEXT_WIDTH = 16; export class BannerComponent implements Component { constructor(private readonly state: BannerState) {} @@ -30,14 +38,22 @@ export class BannerComponent implements Component { const tagDisplay = tagStyled.length > 0 ? tagStyled + PADDING : ''; const tagWidth = visibleWidth(tagDisplay); const showTag = tagWidth > 0 && tagWidth < width; + // Hanging indent aligning with the tag text (right after "✦ "). + const hangingWidth = visibleWidth(PREFIX_STAR + PADDING); + // If the inline tag would squeeze the main text into too narrow a column, + // render the tag on its own line and give the main text the full width. + const tagOnOwnLine = showTag && width - tagWidth < MIN_INLINE_MAIN_TEXT_WIDTH; + const inlineTag = showTag && !tagOnOwnLine; // Body lines (continuations of the main text) indent to match the first - // line's main-text column, which starts right after the tag display. - const bodyIndent = showTag ? ' '.repeat(tagWidth) : ''; + // line's main-text column, which starts right after the tag display. When + // the tag is on its own line, the main text aligns with the tag text. + const bodyIndent = inlineTag ? ' '.repeat(tagWidth) : tagOnOwnLine ? ' '.repeat(hangingWidth) : ''; // Descriptive subtext lines (the second line in the design) start at the // column after the leading star + space, aligning with the tag text itself. - const descIndent = showTag ? ' '.repeat(visibleWidth(PREFIX_STAR + PADDING)) : ''; - const bodyContentWidth = width - (showTag ? tagWidth : 0); - const descContentWidth = width - (showTag ? visibleWidth(PREFIX_STAR + PADDING) : 0); + const descIndent = showTag ? ' '.repeat(hangingWidth) : ''; + const bodyContentWidth = + width - (inlineTag ? tagWidth : tagOnOwnLine ? hangingWidth : 0); + const descContentWidth = width - (showTag ? hangingWidth : 0); if (bodyContentWidth <= 0) { return ['']; @@ -47,11 +63,14 @@ export class BannerComponent implements Component { const subSegments = this.state.subText ? this.state.subText.split('\n') : []; const result: string[] = []; + if (tagOnOwnLine) { + result.push(tagStyled); + } for (let i = 0; i < mainSegments.length; i++) { const wrapped = wrapTextWithAnsi(mainSegments[i]!, bodyContentWidth); for (let j = 0; j < wrapped.length; j++) { const boldLine = main(wrapped[j]!); - if (i === 0 && j === 0 && showTag) { + if (i === 0 && j === 0 && inlineTag) { result.push(tagDisplay + boldLine); } else { result.push(bodyIndent + boldLine); diff --git a/apps/kimi-code/test/tui/components/chrome/banner.test.ts b/apps/kimi-code/test/tui/components/chrome/banner.test.ts index aecf815d98d..1d2d5034a2a 100644 --- a/apps/kimi-code/test/tui/components/chrome/banner.test.ts +++ b/apps/kimi-code/test/tui/components/chrome/banner.test.ts @@ -182,7 +182,7 @@ describe('BannerComponent', () => { }); it('keeps subsequent main lines indented to the main-text column and subtext aligned with the tag text', () => { - const width = 20; + const width = 24; const lines = new BannerComponent( makeBannerState({ tag: 'New:', @@ -196,9 +196,47 @@ describe('BannerComponent', () => { expect(lines[0]).toContain('✦ New:'); const firstLine = lines[0]!; const mainTextStart = visibleWidth(firstLine.slice(0, firstLine.indexOf('Line 1'))); - const continuationLine = lines.find((line) => line.includes('lot of'))!; - expect(visibleWidth(continuationLine.slice(0, continuationLine.indexOf('lot of')))).toBe(mainTextStart); + const continuationLine = lines.find((line) => line.includes('of content'))!; + expect(visibleWidth(continuationLine.slice(0, continuationLine.indexOf('of content')))).toBe(mainTextStart); const subLine = lines.find((line) => line.includes('Sub text'))!; expect(visibleWidth(subLine.slice(0, subLine.indexOf('Sub text')))).toBe(visibleWidth('✦ ')); }); + + it('moves a long tag onto its own line so the main text keeps a usable width', () => { + // Regression: remote banner configs can set a full-sentence tag. Inline it + // would leave the main text only a few columns, which hard-breaks words. + const width = 50; + const lines = new BannerComponent( + makeBannerState({ + tag: 'Use Kimi K3 with High thinking effort', + mainText: '- for the best balance between token spend and capability', + subText: 'Run /model to switch to K3 and set thinking effort to High', + }), + ).render(width); + for (const line of lines) { + expect(visibleWidth(line)).toBeLessThanOrEqual(width); + } + // The tag occupies the first line alone; no main text is squeezed next to it. + expect(lines[0]).toContain('✦ Use Kimi K3 with High thinking effort'); + expect(lines[0]).not.toContain('- for'); + // Words stay intact (no mid-word hard breaks like "balan"/"ce"). + const joined = lines.join('\n'); + for (const word of ['balance', 'between', 'capability', 'thinking', 'effort']) { + expect(joined).toContain(word); + } + // Main text and subtext align with the tag text (right after "✦ "). + const mainLine = lines.find((line) => line.includes('- for'))!; + expect(visibleWidth(mainLine.slice(0, mainLine.indexOf('- for')))).toBe(visibleWidth('✦ ')); + const subLine = lines.find((line) => line.includes('Run /model'))!; + expect(visibleWidth(subLine.slice(0, subLine.indexOf('Run /model')))).toBe(visibleWidth('✦ ')); + }); + + it('keeps a short tag inline when the remaining width is enough', () => { + const width = 40; + const lines = new BannerComponent( + makeBannerState({ tag: 'Tip:', mainText: 'Use /help to list commands.' }), + ).render(width); + expect(lines[0]).toContain('✦ Tip:'); + expect(lines[0]).toContain('Use /help'); + }); }); From 4a93f70aa2cf5f70a88b4f8eeb2e409aab2c8f59 Mon Sep 17 00:00:00 2001 From: liruifengv Date: Thu, 13 Aug 2026 18:26:10 +0800 Subject: [PATCH 41/50] feat(oauth): add browser-safe ./device subpath export (#2885) * feat(oauth): add browser-safe ./device subpath export * fix(oauth): guard env override lookup for browser consumers * chore(oauth): add changeset for ./device subpath export * fix(oauth): resolve env overrides via globalThis for DOM-only consumers --- .changeset/oauth-device-subpath-export.md | 5 ++++ packages/oauth/package.json | 4 +++ packages/oauth/src/constants.ts | 13 ++++++++-- packages/oauth/src/device.ts | 31 +++++++++++++++++++++++ packages/oauth/tsdown.config.ts | 2 +- 5 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 .changeset/oauth-device-subpath-export.md create mode 100644 packages/oauth/src/device.ts diff --git a/.changeset/oauth-device-subpath-export.md b/.changeset/oauth-device-subpath-export.md new file mode 100644 index 00000000000..8c43547c1f8 --- /dev/null +++ b/.changeset/oauth-device-subpath-export.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code-oauth": minor +--- + +Add a browser-safe `./device` subpath export exposing the device-code flow's pure-fetch HTTP wrappers and flow config, so browser bundles can run OAuth sign-in without pulling in Node-only modules. Import from `@moonshot-ai/kimi-code-oauth/device`. diff --git a/packages/oauth/package.json b/packages/oauth/package.json index f31acaf12be..4b9d4b82f3b 100644 --- a/packages/oauth/package.json +++ b/packages/oauth/package.json @@ -32,6 +32,10 @@ ".": { "types": "./src/index.ts", "default": "./src/index.ts" + }, + "./device": { + "types": "./src/device.ts", + "default": "./src/device.ts" } }, "scripts": { diff --git a/packages/oauth/src/constants.ts b/packages/oauth/src/constants.ts index 58ad3f25963..4c1cfcc7775 100644 --- a/packages/oauth/src/constants.ts +++ b/packages/oauth/src/constants.ts @@ -2,11 +2,20 @@ import type { OAuthFlowConfig } from './types'; export const DEFAULT_KIMI_CODE_OAUTH_HOST = 'https://auth.kimi.com'; +/** Node-side env override lookup, resolved through `globalThis` so the module + stays loadable — and typecheckable — in browser bundles that have no + `process` global (browser consumers of the ./device entry land on the + default host). */ +function envOverride(key: string): string | undefined { + const proc = (globalThis as { process?: { env?: Record } }).process; + return proc?.env?.[key]; +} + export const KIMI_CODE_FLOW_CONFIG: OAuthFlowConfig = { name: 'kimi-code', oauthHost: - process.env['KIMI_CODE_OAUTH_HOST'] ?? - process.env['KIMI_OAUTH_HOST'] ?? + envOverride('KIMI_CODE_OAUTH_HOST') ?? + envOverride('KIMI_OAUTH_HOST') ?? DEFAULT_KIMI_CODE_OAUTH_HOST, clientId: '17e5f671-d194-4dfb-9706-5516cb48c098', }; diff --git a/packages/oauth/src/device.ts b/packages/oauth/src/device.ts new file mode 100644 index 00000000000..888cf173654 --- /dev/null +++ b/packages/oauth/src/device.ts @@ -0,0 +1,31 @@ +/** + * Browser-safe entry for the device-code flow (`@moonshot-ai/kimi-code-oauth/device`). + * + * The package root re-exports `OAuthManager`, token storage, and the identity + * helpers, which pull in `node:fs` / `node:os` / `proper-lockfile` — fine for + * the CLI and desktop hosts, but unloadable in a browser bundle. This entry + * re-exports only the pure-`fetch` surface (every module in its import + * closure is Node-free): the three HTTP wrappers, the shared flow config, + * and the matching types/errors. Keep it that way — anything that needs a + * Node builtin belongs behind the root entry, not here. + * + * Browser callers drive the flow themselves (request → show the verification + * URI → poll → store the token); there is no manager here on purpose. + */ + +export { KIMI_CODE_FLOW_CONFIG } from './constants'; +export { + OAuthConnectionError, + OAuthError, + OAuthUnauthorizedError, + RetryableRefreshError, +} from './errors'; +export type { DevicePollResult, RefreshOptions } from './oauth'; +export { pollDeviceToken, refreshAccessToken, requestDeviceAuthorization } from './oauth'; +export type { + DeviceAuthorization, + DeviceHeaders, + OAuthFlowConfig, + OAuthRequestHeaders, + TokenInfo, +} from './types'; diff --git a/packages/oauth/tsdown.config.ts b/packages/oauth/tsdown.config.ts index cb99d9ffb8e..349cfef1550 100644 --- a/packages/oauth/tsdown.config.ts +++ b/packages/oauth/tsdown.config.ts @@ -1,7 +1,7 @@ import { defineConfig } from 'tsdown'; export default defineConfig({ - entry: ['./src/index.ts'], + entry: ['./src/index.ts', './src/device.ts'], format: ['esm'], dts: true, outDir: 'dist', From 4425409cea9bf5da15e7ceda81c2527b3d591470 Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 19:13:00 +0800 Subject: [PATCH 42/50] fix(features): retract contributed service metadata (#2886) * fix(features): retract contributed service metadata - tie contributed service discovery to feature disposal - reject duplicate providers for the same scope and service - cover feature unload and debug channel resolution * test(features): preserve contributed service registry - remove the global contributed-service test reset - keep provider cleanup local to each regression test * fix(features): scope service discovery to each app - store feature service metadata in the app-local collection tree - bind debug lookup and test overrides to the owning app root - keep duplicate provider activation atomic within one app --- .../agent-core-v2/src/_base/di/collection.ts | 19 ++++- .../src/app/feature/featureManager.ts | 2 + .../src/app/feature/featureManagerService.ts | 14 +++- .../app/feature/featureServiceContribution.ts | 21 +++++ .../agent-core-v2/src/features/feature.ts | 5 +- .../src/features/featureRegistry.ts | 21 ----- packages/agent-core-v2/src/index.ts | 1 + .../features/debugEvents/debugEvents.test.ts | 12 ++- .../test/features/feature.test.ts | 82 ++++++++++++++++++- packages/agent-core-v2/test/harness/agent.ts | 6 +- .../src/transport/channelRegistry.ts | 14 +++- .../kap-server/src/transport/dispatcher.ts | 4 +- .../src/transport/registerDebugRoutes.ts | 2 +- .../src/transport/serviceDispatcherRoutes.ts | 2 +- .../kap-server/test/channelRegistry.test.ts | 42 ++++++++++ 15 files changed, 206 insertions(+), 41 deletions(-) create mode 100644 packages/agent-core-v2/src/app/feature/featureServiceContribution.ts create mode 100644 packages/kap-server/test/channelRegistry.test.ts diff --git a/packages/agent-core-v2/src/_base/di/collection.ts b/packages/agent-core-v2/src/_base/di/collection.ts index 4f69dedbba9..75a96e6509e 100644 --- a/packages/agent-core-v2/src/_base/di/collection.ts +++ b/packages/agent-core-v2/src/_base/di/collection.ts @@ -36,8 +36,15 @@ export interface CollectionToken { const _collectionTokens = new Map>(); const _collectionTokenSet = new WeakSet(); +const _collectionValidators = new WeakMap< + object, + (value: unknown, existing: readonly unknown[]) => void +>(); -export function collection(name: string): CollectionToken { +export function collection( + name: string, + options: { readonly validate?: (value: T, existing: readonly T[]) => void } = {}, +): CollectionToken { const existing = _collectionTokens.get(name); if (existing !== undefined) { return existing as CollectionToken; @@ -61,6 +68,12 @@ export function collection(name: string): CollectionToken { Object.defineProperty(token, 'name', { value: name, enumerable: false, configurable: true }); _collectionTokens.set(name, token as CollectionToken); _collectionTokenSet.add(token); + if (options.validate !== undefined) { + _collectionValidators.set( + token, + options.validate as (value: unknown, existing: readonly unknown[]) => void, + ); + } return token; } @@ -119,6 +132,10 @@ export class CollectionStore { records = new Map(); this._records.set(token as CollectionToken, records); } + _collectionValidators.get(token)?.( + value, + [...records.values()].map((entry) => entry.value), + ); const record: StoredRecord = { id: ++this._nextId, value, diff --git a/packages/agent-core-v2/src/app/feature/featureManager.ts b/packages/agent-core-v2/src/app/feature/featureManager.ts index 6694d6bb3bc..be2314df857 100644 --- a/packages/agent-core-v2/src/app/feature/featureManager.ts +++ b/packages/agent-core-v2/src/app/feature/featureManager.ts @@ -26,6 +26,7 @@ import type { ServiceRecipe, } from '#/_base/di/fiber'; import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; +import type { ContributedFeatureService } from './featureServiceContribution'; export interface ManagedUnitInfo { readonly name: string; @@ -46,6 +47,7 @@ export interface IFeatureManager { updateUnit(name: string, config?: unknown): Promise; units(): readonly ManagedUnitInfo[]; + contributedServices(): readonly ContributedFeatureService[]; readonly onDidChangeUnits: Event; } diff --git a/packages/agent-core-v2/src/app/feature/featureManagerService.ts b/packages/agent-core-v2/src/app/feature/featureManagerService.ts index 7e521c72011..04e8e3e2d06 100644 --- a/packages/agent-core-v2/src/app/feature/featureManagerService.ts +++ b/packages/agent-core-v2/src/app/feature/featureManagerService.ts @@ -8,6 +8,7 @@ * the previous handle (retract-then-assemble is the caller's cascade). */ +import type { CollectionView } from '#/_base/di/collection'; import { Emitter, type Event } from '#/_base/event'; import type { FiberHandle, @@ -23,6 +24,10 @@ import { IFeatureManager, type ManagedUnitInfo, } from './featureManager'; +import { + FeatureServiceContribution, + type ContributedFeatureService, +} from './featureServiceContribution'; export class FeatureManagerService extends Service implements IFeatureManager { declare readonly _serviceBrand: undefined; @@ -31,7 +36,10 @@ export class FeatureManagerService extends Service implements IFeatureManager { private readonly _onDidChangeUnits = new Emitter(); readonly onDidChangeUnits: Event = this._onDidChangeUnits.event; - constructor() { + constructor( + @FeatureServiceContribution + private readonly _contributedServices: CollectionView, + ) { super(); this._register(this._onDidChangeUnits); } @@ -97,6 +105,10 @@ export class FeatureManagerService extends Service implements IFeatureManager { } return infos; } + + contributedServices(): readonly ContributedFeatureService[] { + return this._contributedServices.items; + } } registerScopedService( diff --git a/packages/agent-core-v2/src/app/feature/featureServiceContribution.ts b/packages/agent-core-v2/src/app/feature/featureServiceContribution.ts new file mode 100644 index 00000000000..635b152a4ee --- /dev/null +++ b/packages/agent-core-v2/src/app/feature/featureServiceContribution.ts @@ -0,0 +1,21 @@ +import { collection } from '#/_base/di/collection'; +import type { ServiceIdentifier } from '#/_base/di/instantiation'; +import type { LifecycleScope } from '#/app/scopes'; + +export interface ContributedFeatureService { + readonly scope: LifecycleScope; + readonly id: ServiceIdentifier; +} + +export const FeatureServiceContribution = collection( + 'feature-service', + { + validate(value, existing) { + if (existing.some((entry) => entry.scope === value.scope && entry.id === value.id)) { + throw new Error( + `Service ${String(value.id)} is already contributed at scope ${value.scope}`, + ); + } + }, + }, +); diff --git a/packages/agent-core-v2/src/features/feature.ts b/packages/agent-core-v2/src/features/feature.ts index b62a6666b03..0c5e7b91fb8 100644 --- a/packages/agent-core-v2/src/features/feature.ts +++ b/packages/agent-core-v2/src/features/feature.ts @@ -28,6 +28,7 @@ import { AgentProfileContribution, AGENT_PROFILE_SOURCE_PRIORITY, } from '#/app/agentProfileCatalog/agentProfileContribution'; +import { FeatureServiceContribution } from '#/app/feature/featureServiceContribution'; import type { AgentProfile } from '#/app/agentProfileCatalog/agentProfileCatalog'; import type { ConfigSchema, RegisterSectionOptions } from '#/app/config/config'; import { ConfigSectionContribution } from '#/app/config/configSectionContributions'; @@ -43,8 +44,6 @@ import { type AnyAgentTool, } from '#/agent/toolRegistry/toolContribution'; -import { recordContributedService } from './featureRegistry'; - export abstract class Feature extends Service { contribute(token: CollectionToken, value: T): FiberHandle { return this.provide(token, value); @@ -68,7 +67,7 @@ export abstract class Feature extends Service { ctor: ServiceClassRecipe, opts?: FiberProvideOptions, ): FiberHandle { - recordContributedService(scope, id); + this.provide(FeatureServiceContribution, { scope, id }); return this.provide(ScopeUnits(scope), { name: `${this.name}:${String(id)}`, apply(fiber: Fiber): void { diff --git a/packages/agent-core-v2/src/features/featureRegistry.ts b/packages/agent-core-v2/src/features/featureRegistry.ts index b268a473b80..b08b26412cb 100644 --- a/packages/agent-core-v2/src/features/featureRegistry.ts +++ b/packages/agent-core-v2/src/features/featureRegistry.ts @@ -11,7 +11,6 @@ */ import type { ServiceClassRecipe } from '#/_base/di/fiber'; -import type { ServiceIdentifier } from '#/_base/di/instantiation'; const _featureRecipes: ServiceClassRecipe[] = []; @@ -26,23 +25,3 @@ export function getFeatureRecipes(): readonly ServiceClassRecipe[] { export function _clearFeatureRecipesForTests(): void { _featureRecipes.length = 0; } - -const _contributedServices: { scope: string; id: ServiceIdentifier }[] = []; - -export function recordContributedService(scope: string, id: ServiceIdentifier): void { - if (_contributedServices.some((entry) => entry.scope === scope && entry.id === id)) { - return; - } - _contributedServices.push({ scope, id }); -} - -export function getContributedServices(): ReadonlyArray<{ - scope: string; - id: ServiceIdentifier; -}> { - return _contributedServices; -} - -export function _clearContributedServicesForTests(): void { - _contributedServices.length = 0; -} diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index 3efa13e513c..0628c3bda0a 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -220,6 +220,7 @@ export * from '#/app/capability/capabilityService'; export * from '#/app/capability/errors'; export * from '#/app/capability/types'; export * from '#/app/feature/featureManager'; +export * from '#/app/feature/featureServiceContribution'; import '#/app/feature/featureManagerService'; export * from '#/features/feature'; export * from '#/features/featureAssembly'; diff --git a/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts b/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts index 7d6457a3d61..38bee5b9f64 100644 --- a/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts +++ b/packages/agent-core-v2/test/features/debugEvents/debugEvents.test.ts @@ -14,7 +14,6 @@ import { IFeatureAssemblyService } from '#/features/featureAssembly'; import { FeatureAssemblyService } from '#/features/featureAssemblyService'; import { _clearFeatureRecipesForTests, - getContributedServices, registerFeature, } from '#/features/featureRegistry'; @@ -53,9 +52,9 @@ describe('DebugEventsFeature — App-scope introspection service', () => { const manager = host.app.accessor.get(IFeatureManager); expect(manager.units().map((unit) => unit.name)).toContain('debugEvents'); expect( - getContributedServices().some( - (entry) => entry.scope === LifecycleScope.App && entry.id === IDebugEventsService, - ), + manager + .contributedServices() + .some((entry) => entry.scope === LifecycleScope.App && entry.id === IDebugEventsService), ).toBe(true); const result = host.app.accessor.get(IDebugEventsService).subscriptions(); @@ -68,6 +67,11 @@ describe('DebugEventsFeature — App-scope introspection service', () => { await host.app.instantiation.cascade.whenIdle(); await new Promise((resolve) => setTimeout(resolve, 0)); expect(() => host.app.accessor.get(IDebugEventsService)).toThrow(); + expect( + manager + .contributedServices() + .some((entry) => entry.scope === LifecycleScope.App && entry.id === IDebugEventsService), + ).toBe(false); host.dispose(); }); }); diff --git a/packages/agent-core-v2/test/features/feature.test.ts b/packages/agent-core-v2/test/features/feature.test.ts index 13e25c09424..8211968d0ac 100644 --- a/packages/agent-core-v2/test/features/feature.test.ts +++ b/packages/agent-core-v2/test/features/feature.test.ts @@ -6,6 +6,7 @@ import { createDecorator, ScopeActivation } from '#/_base/di/instantiation'; import { type InstantiationService } from '#/_base/di/instantiationService'; import { _clearScopedRegistryForTests, + getScopedServiceDescriptors, registerScopedService, type Scope, } from '#/_base/di/scope'; @@ -20,7 +21,10 @@ import { AgentToolContribution } from '#/agent/toolRegistry/toolContribution'; import { Feature } from '#/features/feature'; import { IFeatureAssemblyService } from '#/features/featureAssembly'; import { FeatureAssemblyService } from '#/features/featureAssemblyService'; -import { _clearFeatureRecipesForTests, registerFeature } from '#/features/featureRegistry'; +import { + _clearFeatureRecipesForTests, + registerFeature, +} from '#/features/featureRegistry'; import type { AgentTool, ToolExecution } from '#/tool/toolContract'; interface IGreeter { @@ -138,6 +142,82 @@ describe('Feature — built-in capability assembly (src/features)', () => { host.dispose(); }); + it('rejects duplicate service contributions until the provider unloads', async () => { + class FirstFeature extends Feature { + static override readonly name = 'first-feature'; + + constructor() { + super(); + this.contributeAgentService(IGreeter, GreeterService); + } + } + class SecondFeature extends Feature { + static override readonly name = 'second-feature'; + + constructor() { + super(); + this.contributeAgentService(IGreeter, GreeterService); + } + } + registerFeature(FirstFeature); + + const host = createScopedTestHost(); + const manager = host.app.accessor.get(IFeatureManager); + const agent = host.child(LifecycleScope.Agent, 'agent-1'); + const original = agent.accessor.get(IGreeter); + expect(() => manager.provideUnit(SecondFeature)).toThrow( + /Service test-feature-greeter is already contributed at scope agent/, + ); + expect(manager.units().map((unit) => unit.name)).toEqual(['first-feature']); + expect( + manager + .contributedServices() + .filter((entry) => entry.scope === LifecycleScope.Agent && entry.id === IGreeter), + ).toHaveLength(1); + expect(collectionViewOf(host.app, ScopeUnits(LifecycleScope.Agent)).items).toHaveLength(1); + expect(agent.accessor.get(IGreeter)).toBe(original); + + await manager.unprovideUnit('first-feature'); + await host.app.instantiation.cascade.whenIdle(); + expect(() => manager.provideUnit(SecondFeature)).not.toThrow(); + expect(manager.units().map((unit) => unit.name)).toEqual(['second-feature']); + expect(agent.accessor.get(IGreeter).greet()).toBe('hi'); + + host.dispose(); + }); + + it('isolates equal service contributions between App roots', async () => { + class SharedFeature extends Feature { + static override readonly name = 'shared-feature'; + + constructor() { + super(); + this.contributeAgentService(IGreeter, GreeterService); + } + } + registerFeature(SharedFeature); + + const first = createScopedTestHost(); + const second = createScopedTestHost(); + const firstManager = first.app.accessor.get(IFeatureManager); + const secondManager = second.app.accessor.get(IFeatureManager); + const firstAgent = first.child(LifecycleScope.Agent, 'agent-1'); + const secondAgent = second.child(LifecycleScope.Agent, 'agent-1'); + expect(firstManager.contributedServices()).toHaveLength(1); + expect(secondManager.contributedServices()).toHaveLength(1); + expect(firstAgent.accessor.get(IGreeter)).not.toBe(secondAgent.accessor.get(IGreeter)); + + await firstManager.unprovideUnit('shared-feature'); + await first.app.instantiation.cascade.whenIdle(); + expect(firstManager.contributedServices()).toHaveLength(0); + expect(secondManager.contributedServices()).toHaveLength(1); + expect(() => firstAgent.accessor.get(IGreeter)).toThrow(); + expect(secondAgent.accessor.get(IGreeter).greet()).toBe('hi'); + + first.dispose(); + second.dispose(); + }); + it('materializes a per-scope class recipe contributed through contribute()', () => { class SoloAgentUnit extends Service { static override readonly name = 'solo-feature/agent'; diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index 4de0ba782eb..c75f46ffe04 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -8,7 +8,7 @@ import { expect, vi } from 'vitest'; import { toDisposable } from '#/_base/di/lifecycle'; import type { IInstantiationService } from '#/_base/di/instantiation'; import type { IAgentScopeHandle } from '#/_base/di/scope'; -import { getContributedServices } from '#/features/featureRegistry'; +import { IFeatureManager } from '#/app/feature/featureManager'; import { Emitter, Event } from '#/_base/event'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import type { Promisable, PromisifyMethods } from '#/_base/utils/types'; @@ -910,7 +910,9 @@ function reassertServiceOverrides( instantiation: IInstantiationService, ): void { const contributed = new Set( - getContributedServices() + instantiation + .invokeFunction((accessor) => accessor.get(IFeatureManager)) + .contributedServices() .filter((entry) => entry.scope === scope) .map((entry) => entry.id), ); diff --git a/packages/kap-server/src/transport/channelRegistry.ts b/packages/kap-server/src/transport/channelRegistry.ts index 58cd41e76d8..56c2268b510 100644 --- a/packages/kap-server/src/transport/channelRegistry.ts +++ b/packages/kap-server/src/transport/channelRegistry.ts @@ -15,12 +15,12 @@ import { Disposable, - getContributedServices, getScopedServiceDescriptors, + IFeatureManager, LifecycleScope, } from '@moonshot-ai/agent-core-v2'; -import type { ScopedEntry, ServiceIdentifier } from '@moonshot-ai/agent-core-v2'; +import type { Scope, ScopedEntry, ServiceIdentifier } from '@moonshot-ai/agent-core-v2'; export interface ChannelMethodDescriptor { readonly name: string; @@ -87,10 +87,16 @@ function scopedServiceNameIndex(): Map> { } /** Resolve a wire name to its `ServiceIdentifier` anywhere in the DI registry. */ -export function resolveAnyScopedServiceId(name: string): ServiceIdentifier | undefined { +export function resolveAnyScopedServiceId( + core: Scope, + name: string, +): ServiceIdentifier | undefined { return ( scopedServiceNameIndex().get(name) ?? - getContributedServices().find((entry) => entry.id.toString() === name)?.id + core.accessor + .get(IFeatureManager) + .contributedServices() + .find((entry) => entry.id.toString() === name)?.id ); } diff --git a/packages/kap-server/src/transport/dispatcher.ts b/packages/kap-server/src/transport/dispatcher.ts index e3b75dba499..94b6e3f8048 100644 --- a/packages/kap-server/src/transport/dispatcher.ts +++ b/packages/kap-server/src/transport/dispatcher.ts @@ -87,7 +87,7 @@ export async function resolveService( scopeKind: ScopeKind, params: Record, serviceName: string, - lookup: ChannelLookup = resolveAnyScopedServiceId, + lookup: ChannelLookup = (name) => resolveAnyScopedServiceId(core, name), ): Promise { const scope = await resolveScope(core, scopeKind, params); if (scope === undefined) { @@ -128,7 +128,7 @@ export async function dispatch( serviceName: string, method: string, arg: unknown, - lookup: ChannelLookup = resolveAnyScopedServiceId, + lookup: ChannelLookup = (name) => resolveAnyScopedServiceId(core, name), ): Promise { const service = await resolveService(core, scopeKind, params, serviceName, lookup); const member = (service as Record)[method]; diff --git a/packages/kap-server/src/transport/registerDebugRoutes.ts b/packages/kap-server/src/transport/registerDebugRoutes.ts index 11ec8e57ca4..6cdb3b9af2c 100644 --- a/packages/kap-server/src/transport/registerDebugRoutes.ts +++ b/packages/kap-server/src/transport/registerDebugRoutes.ts @@ -21,7 +21,7 @@ import { type RouteHost, registerServiceDispatcherRoutes } from './serviceDispat export function registerDebugRoutes(app: RouteHost, core: Scope): void { registerServiceDispatcherRoutes(app, core, '/debug', { - lookup: resolveAnyScopedServiceId, + lookup: (name) => resolveAnyScopedServiceId(core, name), describe: describeAllChannels, }); } diff --git a/packages/kap-server/src/transport/serviceDispatcherRoutes.ts b/packages/kap-server/src/transport/serviceDispatcherRoutes.ts index 59327f1c159..c325dec9c21 100644 --- a/packages/kap-server/src/transport/serviceDispatcherRoutes.ts +++ b/packages/kap-server/src/transport/serviceDispatcherRoutes.ts @@ -74,7 +74,7 @@ export function registerServiceDispatcherRoutes( basePath: string, opts: ServiceDispatcherRouteOptions = {}, ): void { - const lookup = opts.lookup ?? resolveAnyScopedServiceId; + const lookup = opts.lookup ?? ((name) => resolveAnyScopedServiceId(core, name)); const scopeRoutes: { path: string; scopeKind: ScopeKind }[] = [ { path: `${basePath}/:service/:method`, scopeKind: 'core' }, { path: `${basePath}/workspace/:workspace_id/:service/:method`, scopeKind: 'workspace' }, diff --git a/packages/kap-server/test/channelRegistry.test.ts b/packages/kap-server/test/channelRegistry.test.ts new file mode 100644 index 00000000000..d81126a3758 --- /dev/null +++ b/packages/kap-server/test/channelRegistry.test.ts @@ -0,0 +1,42 @@ +import { + createDecorator, + Feature, + IFeatureManager, + LifecycleScope, + Service, + createAppScope, +} from '@moonshot-ai/agent-core-v2'; +import { describe, expect, it } from 'vitest'; + +import { resolveAnyScopedServiceId } from '../src/transport/channelRegistry'; + +describe('channelRegistry', () => { + it('resolves contributed services from the current core only', async () => { + const id = createDecorator('test-contributed-service'); + class TestService extends Service {} + class TestFeature extends Feature { + constructor() { + super(); + this.contributeService(LifecycleScope.Agent, id, TestService); + } + } + const first = createAppScope(); + const second = createAppScope(); + const firstManager = first.accessor.get(IFeatureManager); + const secondManager = second.accessor.get(IFeatureManager); + firstManager.provideUnit(TestFeature); + secondManager.provideUnit(TestFeature); + + expect(resolveAnyScopedServiceId(first, String(id))).toBe(id); + expect(resolveAnyScopedServiceId(second, String(id))).toBe(id); + + await firstManager.unprovideUnit('TestFeature'); + expect(resolveAnyScopedServiceId(first, String(id))).toBeUndefined(); + expect(resolveAnyScopedServiceId(second, String(id))).toBe(id); + + await secondManager.unprovideUnit('TestFeature'); + expect(resolveAnyScopedServiceId(second, String(id))).toBeUndefined(); + first.dispose(); + second.dispose(); + }); +}); From c60e3e301d5720e28c381baab50b07c230007c56 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 19:57:46 +0800 Subject: [PATCH 43/50] docs: drop legacy secondary-model content and unify subagent terminology (#2891) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove the legacy-engine secondary-model recipe section, the KIMI_SECONDARY_MODEL / KIMI_SECONDARY_EFFORT env entries, and the model_preference agent-file field: the default engine never reads them and the legacy engine is deprecated. - Remove the backward-compat note for a lone [secondary_model] model key; the code still reads it, but the docs now only document the current pool scheme. - Reframe the secondary_model section around the subagent model pool instead of a singular secondary model. - Unify zh terminology: 子 Agent -> subagent, 主 Agent -> main agent, covering prose, headings, anchors, the sidebar label, and the docs/AGENTS.md term table. --- docs/.vitepress/config.ts | 2 +- docs/AGENTS.md | 4 +- docs/en/configuration/config-files.md | 56 +--------------- docs/en/configuration/env-vars.md | 6 +- docs/en/customization/agents.md | 4 -- docs/en/reference/slash-commands.md | 2 +- docs/en/reference/tools.md | 4 +- docs/zh/configuration/config-files.md | 86 ++++++------------------- docs/zh/configuration/data-locations.md | 4 +- docs/zh/configuration/env-vars.md | 10 ++- docs/zh/customization/agents.md | 66 +++++++++---------- docs/zh/customization/hooks.md | 6 +- docs/zh/customization/plugins.md | 8 +-- docs/zh/customization/skills.md | 2 +- docs/zh/guides/use-cases.md | 4 +- docs/zh/reference/kimi-command.md | 6 +- docs/zh/reference/server-api.md | 2 +- docs/zh/reference/slash-commands.md | 4 +- docs/zh/reference/tools.md | 10 +-- docs/zh/release-notes/changelog.md | 2 +- 20 files changed, 88 insertions(+), 200 deletions(-) diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 3b440716d9d..7d8ea8a71a4 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -67,7 +67,7 @@ const config = withMermaid(defineConfig({ { text: 'Model Context Protocol', link: '/zh/customization/mcp' }, { text: 'Agent Skills', link: '/zh/customization/skills' }, { text: 'Plugins', link: '/zh/customization/plugins' }, - { text: 'Agent 与子 Agent', link: '/zh/customization/agents' }, + { text: 'Agent 与 subagent', link: '/zh/customization/agents' }, { text: 'Hooks', link: '/zh/customization/hooks' }, { text: '自定义主题', link: '/zh/customization/themes' }, ], diff --git a/docs/AGENTS.md b/docs/AGENTS.md index 86f36083d3b..c03f4439110 100644 --- a/docs/AGENTS.md +++ b/docs/AGENTS.md @@ -67,8 +67,8 @@ Term mapping (Chinese <-> English, and proper noun handling): | Chinese | English | Proper noun (zh) | Proper noun (en) | | --- | --- | --- | --- | | Agent | agent | yes | no | -| 主 Agent | main agent | yes (Agent) | no | -| 子 Agent | subagent | yes (Agent) | no | +| main agent | main agent | no | no | +| subagent | subagent | no | no | | Shell | shell | yes | no | | Plan 模式 | Plan mode | yes | yes (Plan mode) | | YOLO 模式 | YOLO mode | yes | yes (YOLO mode) | diff --git a/docs/en/configuration/config-files.md b/docs/en/configuration/config-files.md index 82d5c864859..7551345b03c 100644 --- a/docs/en/configuration/config-files.md +++ b/docs/en/configuration/config-files.md @@ -192,17 +192,12 @@ You can also switch models temporarily without touching the config file — by s ## `secondary_model` -The secondary model is a second model configuration alongside the main model — typically a cheaper one, for features that do not need the main model's capability. Its consumer today is subagent spawning. Both engines read this section, but different keys from it, and both gate the feature behind the secondary-model experiment: - -- The default `agent-core-v2` engine (`kimi`, `kimi -p`, and `kimi web`) reads the [subagent model pool](#subagent-model-pool): `default_model` and the `[secondary_model.models]` table, and also honors a lone recipe `model` key as a fallback default. -- The legacy `agent-core` engine, selected for `kimi` / `kimi -p` with `KIMI_CODE_LEGACY_FLAG=1`, reads the [recipe keys](#secondary-model-recipe) (`model`, `default_effort`, and the patch fields). +Subagents inherit the model the main agent is running by default. The `[secondary_model]` section makes this configurable: it offers subagents a pool of candidate models plus a default binding — typically a cheaper model for subtasks that do not need the main model's capability. ### Subagent model pool This feature is experimental and disabled by default. Enable it with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master `KIMI_CODE_EXPERIMENTAL_FLAG=1`. It takes effect in every launch mode, including the interactive TUI. While the experiment is off, the pool keys stay inert: subagents inherit the caller's model and session startup skips the pool validation. -The pool is read by the `agent-core-v2` engine only; the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1` ignores `default_model` and `[secondary_model.models]`, and resolves subagent models through the [recipe keys](#secondary-model-recipe) instead. - To simply point every subagent at one model by default, no models table is needed — a single `default_model` line is a pool with a single entry: ```toml @@ -216,7 +211,7 @@ In the interactive TUI, the [`/secondary-model`](../reference/slash-commands.md) | --- | --- | --- | --- | | `default_model` | `string` | — | Default subagent model. Required when `[secondary_model.models]` is configured, and must be one of its keys; written on its own (without a models table) it is equivalent to a pool containing only that entry | | `models` | `table` | — | Subagent model pool. Each key is the alias of a configured [`[models]`](#models) entry; each value is the description the main agent sees when picking a subagent model (Chinese or English; an empty string lists the alias with no hint) | -| `force` | `boolean` | `false` | Pin every subagent to `default_model`: the `model` parameter is not advertised, so the main agent cannot pick another model or `"primary"`. Requires `default_model` (or a lone `model` key); cannot be combined with `[secondary_model.models]` | +| `force` | `boolean` | `false` | Pin every subagent to `default_model`: the `model` parameter is not advertised, so the main agent cannot pick another model or `"primary"`. Requires `default_model`; cannot be combined with `[secondary_model.models]` | A configured pool — an explicit `[secondary_model.models]` table or a lone `default_model` — enables model selection: the `Agent` / `AgentSwarm` tools gain a `model` parameter, and the tool description lists the pool (the default marked `[default]`) so the main agent can choose per spawn (unless `force` is set — see below). The pool only references configured [`[models]`](#models) entries — the `kimi-code/*` aliases below are provisioned by `/login` — and attaches the selection hints: @@ -239,7 +234,7 @@ default_model = "kimi-code/kimi-for-coding-highspeed" force = true ``` -With `force` set, the `model` parameter is not advertised (just like when nothing is configured) and every spawn binds `default_model`; an explicit `model` argument, `"primary"` included, is rejected with an error. `force` requires `default_model` (or a lone `model` key) and cannot be combined with a `[secondary_model.models]` table — the table exists to offer a choice, and force removes it. +With `force` set, the `model` parameter is not advertised (just like when nothing is configured) and every spawn binds `default_model`; an explicit `model` argument, `"primary"` included, is rejected with an error. `force` requires `default_model` and cannot be combined with a `[secondary_model.models]` table — the table exists to offer a choice, and force removes it. Because natural resolution lands on the bound model's default effort, different pool entries can carry different thinking levels: register a second `[models]` entry as a "variant" of the same underlying model, override only its `default_effort` via [`[models."".overrides]`](#model-overrides), and list both aliases in the pool — the main agent picks the thinking level together with the alias: @@ -264,51 +259,6 @@ Note that `default_effort` stays a model-level default: once a global `[thinking Configuration errors fail loudly instead of falling back silently: session creation, resume, and fork all fail at startup when `default_model` is missing, is not a pool key, or a pool key does not resolve to a configured `[models]` entry — and likewise when `force` is set without `default_model` or combined with a `[secondary_model.models]` table. The alias `primary` is reserved — it always binds the caller's own model — and is rejected as a pool key. A spawn whose `model` is neither a pool alias nor `"primary"` fails with an error listing the available choices. -When only the recipe `model` key is set — no `default_model`, no `[secondary_model.models]` table — the v2 engine reads it compatibly as the pool default: an implicit single-entry pool ranked below `default_model`, so a recipe setup keeps working unchanged. The compatibility only takes the model alias, though: the recipe patch fields (`default_effort`, `max_output_size`, …) do not carry over — write those settings onto the `[models]` entry the alias points to, for example via [`[models."".overrides]`](#model-overrides). Once a `[secondary_model.models]` table is configured, `default_model` stays required and `model` does not substitute for it. - -To migrate explicitly, point the pool default at the same alias: - -```toml -# Before -[secondary_model] -model = "kimi-code/kimi-for-coding-highspeed" - -# After -[secondary_model] -default_model = "kimi-code/kimi-for-coding-highspeed" -``` - -The recipe keys can stay in the section: the legacy engine keeps reading them. - -### Secondary-model recipe - -This reading is used by the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`; the default v2 engine ignores the recipe keys. When set, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model; when unset, subagents inherit the main agent's model. - -This is a default binding, not a forced one. With the experiment enabled, the `Agent` / `AgentSwarm` tools gain a `model` parameter (accepting only the symbolic values `"secondary"` / `"primary"`), and the tool description lists the available models with the default marked. A spawn resolves the subagent's model in this order: an explicit tool-call `model` → the profile's [`model_preference`](../customization/agents.md#agent-file-format) → the configured secondary model (the default). Here `"primary"` means the model the main agent is currently running, not necessarily `default_model` — for example after a mid-session `/model` switch. - -Because overriding the default is the main agent's own decision (the tool description merely suggests `"secondary"` for routine tasks and `"primary"` for hard, quality-sensitive ones), there is no per-spawn switch on the user side. To steer a specific subagent to the main model, ask the main agent in your prompt to pass `model: "primary"`, or set `model_preference: "primary"` in the corresponding profile. - -This feature is experimental and disabled by default. Enable it with `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master `KIMI_CODE_EXPERIMENTAL_FLAG=1`. It takes effect in every launch mode, including the interactive TUI. - -| Field | Type | Default | Description | -| --- | --- | --- | --- | -| `model` | `string` | — | The alias of a configured [`[models]`](#models) entry, e.g. `kimi-code/kimi-for-coding` (any provider, not limited to Kimi models) | -| `default_effort` | `string` | — | Thinking effort applied when subagents bind to the secondary model. Unset, the effort resolves naturally (global `[thinking]` config → the bound model's default effort) instead of inheriting the main agent's effort. Follows the main model's thinking-effort semantics: models with strict effort validation (e.g. Kimi models) fall back to their default effort for unsupported values; other providers receive the value as-is | -| Other fields | — | — | Accepts every field of [`[models."".overrides]`](#models) (`max_context_size`, `max_output_size`, `support_efforts`, …) as a model patch applied only to subagents | - -Every field besides `model` forms a patch: when at least one patch field is set, the runtime synthesizes a derived model entry in memory (a copy of the pointed entry with the patch merged into its overrides, patch winning conflicts) and subagents bind that derived entry; with no patch fields, subagents bind the pointed entry directly. The derived entry lives only in memory (never written back to `config.toml`) and is hidden from model-selection lists. - -```toml -[secondary_model] -model = "kimi-code/kimi-for-coding" -default_effort = "low" -max_output_size = 8192 -``` - -`model` / `default_effort` can be overridden by the `KIMI_SECONDARY_MODEL` / `KIMI_SECONDARY_EFFORT` environment variables, which take higher priority than `config.toml`. - -When the experiment is enabled, the configuration is validated as the session starts: an unresolvable `model`, or a `default_effort` not listed by the (patched) model, produces a startup warning (also returned by the session-warnings API). The check is advisory — a broken secondary model still fails at spawn time, with the same source hint attached to the spawn error. - ## `thinking` `thinking` sets the global default behavior for Thinking mode. diff --git a/docs/en/configuration/env-vars.md b/docs/en/configuration/env-vars.md index dfd3962a7c2..fb3fb86ee34 100644 --- a/docs/en/configuration/env-vars.md +++ b/docs/en/configuration/env-vars.md @@ -133,9 +133,7 @@ Switches that control the behavior of subsystems such as telemetry, background t | `KIMI_CODE_IDENTITY_SLUG` | Protocol identifier for the `User-Agent` product token sent to third-party providers and the MCP client name; takes higher priority than `[identity] slug`. Derived from the name when unset | Any non-empty string; normalized to lowercase with non-alphanumeric runs folded to `-` | | `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | Whether the built-in skills documenting Kimi Code itself are offered to the model; takes higher priority than `builtin_product_skills` in `config.toml` (default enabled) | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | | `KIMI_CODE_TUI_FULL_SCREEN` | Enable the experimental fullscreen alternate-screen UI: scrollable transcript viewport, mouse text selection, clickable links, and Ctrl-Shift-F transcript search | `1` enables it; anything else keeps the regular inline UI | -| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | Enable the experimental secondary-model feature in every launch mode, including the interactive TUI; the master `KIMI_CODE_EXPERIMENTAL_FLAG=1` also enables it | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | -| `KIMI_SECONDARY_MODEL` | Secondary model; takes higher priority than [`[secondary_model] model`](./config-files.md#secondary-model) in `config.toml`. When the secondary-model experiment is enabled, newly spawned subagents (`Agent` / `AgentSwarm`) bind to it by default instead of inheriting the main agent's model | The alias of a configured `[models]` entry, e.g. `kimi-code/kimi-for-coding`; blank values are ignored | -| `KIMI_SECONDARY_EFFORT` | Thinking effort for the secondary model; takes higher priority than `[secondary_model] default_effort` in `config.toml` and applies only when both the model and its experiment are enabled | An effort value, e.g. `low`; blank values are ignored | +| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | Enable the experimental [subagent model pool](./config-files.md#subagent-model-pool) in every launch mode, including the interactive TUI; the master `KIMI_CODE_EXPERIMENTAL_FLAG=1` also enables it | Truthy: `1`/`true`/`yes`/`on`; falsy: `0`/`false`/`no`/`off` | | `KIMI_MCP_STARTUP_TIMEOUT_MS` | Global default connection timeout (ms) for all MCP servers; takes higher priority than `[mcp] startup_timeout_ms` in `config.toml`, but a per-server `startupTimeoutMs` in `mcp.json` still wins (default `30000`) | Integer from `1` to `2147483647`; invalid values are ignored | | `KIMI_MCP_TOOL_TIMEOUT_MS` | Global default single tool-call timeout (ms) for all MCP servers; takes higher priority than `[mcp] tool_timeout_ms` in `config.toml`, but a per-server `toolTimeoutMs` in `mcp.json` still wins (default `60000`) | Integer from `1` to `2147483647`; invalid values are ignored | | `KIMI_LOOP_MAX_STEPS_PER_TURN` | Maximum Agent steps per turn; takes higher priority than `[loop_control] max_steps_per_turn` in `config.toml` (unset or `0` means unlimited) | Non-negative integer; invalid values are ignored | @@ -156,7 +154,7 @@ Switches that control the behavior of subsystems such as telemetry, background t | `KIMI_CODE_NO_AUTO_UPDATE` | Fully disable the update preflight — no check, background install, or prompt. Legacy alias `KIMI_CLI_NO_AUTO_UPDATE` is also honored | Truthy: `1`/`true`/`yes`/`on` | | `KIMI_DISABLE_CRON` | Disable the scheduled-task tool (`CronCreate` rejects new schedules; existing tasks do not fire) | `1` to disable | -The three `KIMI_CODE_IDENTITY_*` / `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` variables are read by the default `agent-core-v2` engine. The legacy `kimi` / `kimi -p` path selected with `KIMI_CODE_LEGACY_FLAG=1` ignores them. Conversely, `KIMI_SECONDARY_MODEL` and `KIMI_SECONDARY_EFFORT` are read by the legacy engine only, and the default engine ignores them; `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` is read by both engines (it gates the v2 [subagent model pool](./config-files.md#subagent-model-pool) and the legacy [secondary-model recipe](./config-files.md#secondary-model-recipe) alike). +The three `KIMI_CODE_IDENTITY_*` / `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` variables are read by the default `agent-core-v2` engine. The legacy `kimi` / `kimi -p` path selected with `KIMI_CODE_LEGACY_FLAG=1` ignores them. ## Diagnostic logs diff --git a/docs/en/customization/agents.md b/docs/en/customization/agents.md index 9cdb6e43d98..ae511883d5b 100644 --- a/docs/en/customization/agents.md +++ b/docs/en/customization/agents.md @@ -81,7 +81,6 @@ name: reviewer description: Strict code reviewer that reports severity-ranked findings whenToUse: Code reviews and PR checks override: false -model_preference: primary tools: - Read - Grep @@ -100,7 +99,6 @@ You are a strict code reviewer. Read the diff, then report findings grouped by s | `description` | yes | What the agent does. Shown to the main Agent when it picks a sub-agent, so write it to guide delegation decisions | | `whenToUse` | no | Extra hint describing when the agent should be used | | `override` | no | Whether this file may replace a same-name built-in Agent. Defaults to `false`; `--agent-file` is already explicit and does not require this field | -| `model_preference` | no | Symbolic default used when `Agent` or `AgentSwarm` spawns this profile: `primary` selects the model the caller is currently running, while `secondary` selects [`[secondary_model] model`](../configuration/config-files.md#secondary-model). An explicit tool-call `model` (which likewise accepts only `"primary"` / `"secondary"`) wins over this field; without either setting, the configured secondary model remains the default. If no secondary model is configured, the subagent inherits the caller's model. Read only by the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`; the default v2 engine ignores this field | | `tools` | no | Allowlist of tool names such as `Read` or `Bash`; MCP tools are matched with globs such as `mcp__github__*`. Accepts a YAML list or a comma-separated string (`tools: Read, Grep`). Omit to allow all tools; a lone `*` also allows all tools; an empty list (`tools: []`) disables all tools | | `disallowedTools` | no | Denylist with the same syntax and matching rules, applied after `tools` | | `subagents` | no | Allowlist of sub-agent names this agent may delegate to, with the same syntax as `tools` (YAML list or comma-separated string). Omit to allow every type; a lone `*` also allows all types | @@ -111,8 +109,6 @@ The body is the agent's system prompt, and it is rendered as a template each tim Unknown fields are ignored, so newer files stay readable by older versions. Fields from other agent tools (such as Claude Code's `model` or OpenCode's `mode`) are ignored the same way, the comma-separated `tools` form keeps Claude Code-style agent files loadable, and a missing `name` falls back to the file name so OpenCode-style files load too — a minimal file with `description` and a body works across tools. -`model_preference` applies only to newly spawned subagents when the secondary-model experiment is enabled — set `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`, or the master `KIMI_CODE_EXPERIMENTAL_FLAG=1`. It takes effect in every launch mode, including the interactive TUI. The field never names a concrete model alias, and resumed subagents keep their existing model. The selected preference is shown to the main agent alongside the profile description so it can still pass an explicit `model` when a task needs a different choice. - A file with invalid content discovered in a directory is skipped with a warning and does not affect other files. A file passed explicitly via `--agent-file` must be valid — otherwise the CLI reports the error and exits. ::: warning Note diff --git a/docs/en/reference/slash-commands.md b/docs/en/reference/slash-commands.md index e8c112bcdda..a9267ae90f2 100644 --- a/docs/en/reference/slash-commands.md +++ b/docs/en/reference/slash-commands.md @@ -16,7 +16,7 @@ Some commands are only available in the idle state. Executing these commands whi | `/logout` | — | Clear credentials for the currently selected account | No | | `/provider` | — | Open the interactive provider manager to view, add, and remove configured providers. See [Platforms & Models — `/provider` and provider management](../configuration/providers.md#provider-—-interactive-provider-management) | Yes | | `/model` | — | Switch the LLM model used in the current session | Yes | -| `/secondary-model` | `/subagent-model` | Pick the default model for subagents (writes `[secondary_model] default_model`; see the [subagent model pool](../configuration/config-files.md#subagent-model-pool)). Visible when the secondary-model experiment is enabled | Yes | +| `/secondary-model` | `/subagent-model` | Pick the default model for subagents (writes `[secondary_model] default_model`; see the [subagent model pool](../configuration/config-files.md#subagent-model-pool)). Visible when the subagent model pool experiment is enabled | Yes | | `/settings` | `/config` | Open the settings panel inside the TUI | Yes | | `/experiments` | `/experimental` | Open the experimental feature panel | Yes | | `/permission` | — | Select a permission mode | Yes | diff --git a/docs/en/reference/tools.md b/docs/en/reference/tools.md index c0ea9401086..cf16c9200f9 100644 --- a/docs/en/reference/tools.md +++ b/docs/en/reference/tools.md @@ -89,9 +89,9 @@ Collaboration tools handle inter-Agent coordination, user interaction, and Skill | `AskUserQuestion` | Auto-allow | Ask the user a question to gather structured input | | `Skill` | Auto-allow | Invoke a registered inline Skill | -**`Agent`** delegates a subtask to a sub-Agent. Required parameters: `prompt` (complete task description) and `description` (a 3–5 word short summary). Optional parameters: `subagent_type` (defaults to `coder`), `resume` (ID of an existing Agent to resume; mutually exclusive with `subagent_type`), `run_in_background` (defaults to false), and `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`: a pool alias, or `"primary"` for the model the caller itself is running; ignored when resuming). Without it, the subagent binds the pool's `default_model`; without a configured pool, subagents always inherit the caller's model. That is the default v2 engine behavior; on the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`, `model` is available when the [secondary-model experiment](../configuration/config-files.md#secondary-model) is enabled instead, accepting only `"secondary"` / `"primary"` — an explicit choice overrides the profile's [`model_preference`](../customization/agents.md#agent-file-format), and the configured secondary model is the default. Agent tasks time out after 2 hours by default; the limit is configurable via `[subagent] timeout_ms` in `config.toml` (`0` = no timeout, or the `KIMI_SUBAGENT_TIMEOUT_MS` env var), and defaults to no timeout in print mode (`kimi -p`). In foreground mode the parent Agent waits for the sub-Agent to complete before continuing; in background mode a task ID is returned immediately and the result is automatically delivered back to the main Agent via a synthetic User message when done. When several foreground `Agent` calls run in the same step, the TUI groups them and shows each subagent's running, waiting, completed, or failed status with elapsed time. See [Agent & Sub-Agents](../customization/agents.md) for details. +**`Agent`** delegates a subtask to a sub-Agent. Required parameters: `prompt` (complete task description) and `description` (a 3–5 word short summary). Optional parameters: `subagent_type` (defaults to `coder`), `resume` (ID of an existing Agent to resume; mutually exclusive with `subagent_type`), `run_in_background` (defaults to false), and `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`: a pool alias, or `"primary"` for the model the caller itself is running; ignored when resuming). Without it, the subagent binds the pool's `default_model`; without a configured pool, subagents always inherit the caller's model. Agent tasks time out after 2 hours by default; the limit is configurable via `[subagent] timeout_ms` in `config.toml` (`0` = no timeout, or the `KIMI_SUBAGENT_TIMEOUT_MS` env var), and defaults to no timeout in print mode (`kimi -p`). In foreground mode the parent Agent waits for the sub-Agent to complete before continuing; in background mode a task ID is returned immediately and the result is automatically delivered back to the main Agent via a synthetic User message when done. When several foreground `Agent` calls run in the same step, the TUI groups them and shows each subagent's running, waiting, completed, or failed status with elapsed time. See [Agent & Sub-Agents](../customization/agents.md) for details. -**`AgentSwarm`** launches subagents from a shared `prompt_template` and an `items` array, resumes existing subagents through `resume_agent_ids`, or combines both in one call. The template must contain the `{{item}}` placeholder; each item replaces that placeholder and launches one new subagent. Pass `subagent_type` to choose the profile used by every spawned subagent in the swarm, or omit it to use `coder`. Pass `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`) to run item-spawned subagents on a pool alias or on the caller's own model (`"primary"`). Without it, item-spawned subagents bind the pool's `default_model`; without a configured pool, they inherit the caller's model. On the legacy `agent-core` engine selected with `KIMI_CODE_LEGACY_FLAG=1`, `model` follows the [secondary-model experiment](../configuration/config-files.md#secondary-model) instead (`"secondary"` / `"primary"`, defaulting to the configured secondary model). Resumed subagents keep their own model. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all subagents to finish, and returns an aggregated report. In the TUI, foreground swarms show a live `Agent swarm` progress panel above the input box. If a model response calls `AgentSwarm`, that call must be the only tool call in the response; to run multiple swarms, call one `AgentSwarm`, wait for its result, then call the next, or combine the work into one swarm when a single template can cover it. In `manual` permission mode, `AgentSwarm` calls outside active swarm mode request approval unless a permission rule allows them; while swarm mode is active, `AgentSwarm` itself is auto-approved. Permission rules match `AgentSwarm` by tool name only — argument patterns such as `AgentSwarm(swarm)` are not supported. By default the tool ramps up concurrency without an upper limit (5 subagents start immediately, then 1 more every 700 ms); set `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` to a positive integer to cap how many subagents run at the same time during that ramp, or leave it unset for no cap. If it is set to a value that is not a positive integer, the AgentSwarm call fails fast. +**`AgentSwarm`** launches subagents from a shared `prompt_template` and an `items` array, resumes existing subagents through `resume_agent_ids`, or combines both in one call. The template must contain the `{{item}}` placeholder; each item replaces that placeholder and launches one new subagent. Pass `subagent_type` to choose the profile used by every spawned subagent in the swarm, or omit it to use `coder`. Pass `model` (available only when the [subagent model pool](../configuration/config-files.md#subagent-model-pool) experiment is enabled and a pool is configured — a `[secondary_model.models]` table or a lone `default_model`) to run item-spawned subagents on a pool alias or on the caller's own model (`"primary"`). Without it, item-spawned subagents bind the pool's `default_model`; without a configured pool, they inherit the caller's model. Resumed subagents keep their own model. Without `resume_agent_ids`, the tool requires at least 2 items; with `resume_agent_ids`, it can resume one or more existing subagents. The tool supports up to 128 total subagents, waits for all subagents to finish, and returns an aggregated report. In the TUI, foreground swarms show a live `Agent swarm` progress panel above the input box. If a model response calls `AgentSwarm`, that call must be the only tool call in the response; to run multiple swarms, call one `AgentSwarm`, wait for its result, then call the next, or combine the work into one swarm when a single template can cover it. In `manual` permission mode, `AgentSwarm` calls outside active swarm mode request approval unless a permission rule allows them; while swarm mode is active, `AgentSwarm` itself is auto-approved. Permission rules match `AgentSwarm` by tool name only — argument patterns such as `AgentSwarm(swarm)` are not supported. By default the tool ramps up concurrency without an upper limit (5 subagents start immediately, then 1 more every 700 ms); set `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` to a positive integer to cap how many subagents run at the same time during that ramp, or leave it unset for no cap. If it is set to a value that is not a positive integer, the AgentSwarm call fails fast. **`AskUserQuestion`** asks the user a structured multiple-choice question — useful for disambiguation or option selection. The `questions` parameter accepts 1–4 questions; each question requires `question` (ending with `?`), `options` (2–4 choices, each with a `label` and `description`), and optional `header` (max 12 characters) and `multi_select` (defaults to false). An "Other" option is appended automatically. Setting `background` to true starts a background question task and returns a task ID immediately. When the host does not support interactive questioning, a failure message is returned and the Agent should ask the user directly in a text reply instead. diff --git a/docs/zh/configuration/config-files.md b/docs/zh/configuration/config-files.md index c51a56d7e5f..d840b679532 100644 --- a/docs/zh/configuration/config-files.md +++ b/docs/zh/configuration/config-files.md @@ -192,33 +192,28 @@ display_name = "Kimi for Coding (custom)" ## `secondary_model` -次主力模型是主模型之外的第二个模型配置——通常是一个更便宜的模型,供不需要主模型能力的功能绑定使用。它目前的消费者是子 Agent 派生。两个引擎都会读取本节,但各取不同的键,且都以次主力模型实验功能为开关: +subagent 默认继承 main agent 正在运行的模型。`[secondary_model]` 节把这件事变成可配置的:为 subagent 准备一批候选模型(模型池)并指定默认绑定——通常是一个更便宜的模型,供不需要主模型能力的子任务使用。 -- 默认的 `agent-core-v2` 引擎(`kimi`、`kimi -p` 和 `kimi web`)读取[子 Agent 模型池](#子-agent-模型池):`default_model` 与 `[secondary_model.models]` 表,并兼容读取单独的配方键 `model` 作为兜底。 -- 使用 `KIMI_CODE_LEGACY_FLAG=1` 为 `kimi` / `kimi -p` 选择旧版 `agent-core` 引擎后,该引擎读取[配方键](#次主力模型配方)(`model`、`default_effort` 及补丁字段)。 +### subagent 模型池 -### 子 Agent 模型池 +该功能目前是实验功能,默认关闭。通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用,或使用 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。实验功能关闭时,模型池配置不生效:subagent 继承调用方模型,会话启动也会跳过池校验。 -该功能目前是实验功能,默认关闭。通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用,或使用 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。实验功能关闭时,模型池配置不生效:子 Agent 继承调用方模型,会话启动也会跳过池校验。 - -模型池仅由 `agent-core-v2` 引擎读取;使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎会忽略 `default_model` 和 `[secondary_model.models]`,子 Agent 模型按[配方键](#次主力模型配方)解析。 - -只想让所有子 Agent 默认换用一个模型时不需要 models 表——一行 `default_model` 就是只含一个条目的模型池: +只想让所有 subagent 默认换用一个模型时不需要 models 表——一行 `default_model` 就是只含一个条目的模型池: ```toml [secondary_model] default_model = "kimi-code/kimi-for-coding-highspeed" ``` -在交互式 TUI 中,也可以用 [`/secondary-model`](../reference/slash-commands.md) 命令(别名 `/subagent-model`)打开模型选择器来设置:选择后写入 `default_model`(已有 models 表而所选别名不在其中时,会一并补一条空描述条目),之后派生的子 Agent 立即按新默认值绑定,无需重启会话。 +在交互式 TUI 中,也可以用 [`/secondary-model`](../reference/slash-commands.md) 命令(别名 `/subagent-model`)打开模型选择器来设置:选择后写入 `default_model`(已有 models 表而所选别名不在其中时,会一并补一条空描述条目),之后派生的 subagent 立即按新默认值绑定,无需重启会话。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | -| `default_model` | `string` | — | 子 Agent 默认模型。配置 `[secondary_model.models]` 时必填,且必须是其中的 key;单独写下它(不写 models 表)则等价于只含它一个条目的模型池 | -| `models` | `table` | — | 子 Agent 模型池。key 是 [`[models]`](#models) 中已配置条目的别名,value 是主 Agent 挑选子 Agent 模型时看到的描述(中英文均可;空字符串表示只列出别名、不给提示) | -| `force` | `boolean` | `false` | 把所有子 Agent 固定到 `default_model`:不再提供 `model` 参数,主 Agent 无法改选其他模型或 `"primary"`。必须配置 `default_model`(或兼容读取的 `model` 键),且不能与 `[secondary_model.models]` 同时使用 | +| `default_model` | `string` | — | subagent 默认模型。配置 `[secondary_model.models]` 时必填,且必须是其中的 key;单独写下它(不写 models 表)则等价于只含它一个条目的模型池 | +| `models` | `table` | — | subagent 模型池。key 是 [`[models]`](#models) 中已配置条目的别名,value 是 main agent 挑选 subagent 模型时看到的描述(中英文均可;空字符串表示只列出别名、不给提示) | +| `force` | `boolean` | `false` | 把所有 subagent 固定到 `default_model`:不再提供 `model` 参数,main agent 无法改选其他模型或 `"primary"`。必须配置 `default_model`,且不能与 `[secondary_model.models]` 同时使用 | -配置模型池(显式的 `[secondary_model.models]` 表,或仅一行 `default_model` 形成的隐式单条目池)即启用模型选择:`Agent` / `AgentSwarm` 工具会获得 `model` 参数,工具描述中会列出模型池(默认模型标注 `[default]`),主 Agent 可按次派生选择模型(除非设置了 `force`,见下文)。模型池只引用已配置的 [`[models]`](#models) 条目——下面的 `kimi-code/*` 别名由 `/login` 自动提供——并附上挑选提示: +配置模型池(显式的 `[secondary_model.models]` 表,或仅一行 `default_model` 形成的隐式单条目池)即启用模型选择:`Agent` / `AgentSwarm` 工具会获得 `model` 参数,工具描述中会列出模型池(默认模型标注 `[default]`),main agent 可按次派生选择模型(除非设置了 `force`,见下文)。模型池只引用已配置的 [`[models]`](#models) 条目——下面的 `kimi-code/*` 别名由 `/login` 自动提供——并附上挑选提示: ```toml [secondary_model] @@ -229,9 +224,9 @@ default_model = "kimi-code/kimi-for-coding-highspeed" "kimi-code/kimi-for-coding" = "均衡的编码主力。适合大多数功能开发和代码修改任务。" ``` -派生时按以下顺序解析子 Agent 的模型:工具调用显式传入的 `model` → `default_model`。`model` 参数接受池中任意别名,或 `"primary"` ——调用方自己正在运行的模型,始终合法,即使它不在池中。`default_model` 与 `[secondary_model.models]` 都未配置时,该参数不会出现,子 Agent 继承调用方模型。绑定池中别名时不携带显式 Thinking 档位——子 Agent 按 "全局 `[thinking]` 配置 → 所绑定模型的默认 effort" 自然解析,不继承调用方的档位;`"primary"` 则连模型带档位一起继承调用方。 +派生时按以下顺序解析 subagent 的模型:工具调用显式传入的 `model` → `default_model`。`model` 参数接受池中任意别名,或 `"primary"` ——调用方自己正在运行的模型,始终合法,即使它不在池中。`default_model` 与 `[secondary_model.models]` 都未配置时,该参数不会出现,subagent 继承调用方模型。绑定池中别名时不携带显式 Thinking 档位——subagent 按 "全局 `[thinking]` 配置 → 所绑定模型的默认 effort" 自然解析,不继承调用方的档位;`"primary"` 则连模型带档位一起继承调用方。 -要彻底收回主 Agent 的选择权——让所有子 Agent 固定跑在同一个模型上——加上 `force = true`: +要彻底收回 main agent 的选择权——让所有 subagent 固定跑在同一个模型上——加上 `force = true`: ```toml [secondary_model] @@ -239,9 +234,9 @@ default_model = "kimi-code/kimi-for-coding-highspeed" force = true ``` -设置 `force` 后不再提供 `model` 参数(与完全未配置时一样),每次派生都绑定 `default_model`;显式传入 `model`(包括 `"primary"`)会报错。`force` 必须搭配 `default_model`(或单独的 `model` 键),且不能与 `[secondary_model.models]` 表同时使用——表的意义在于提供选择,而 force 取消了选择。 +设置 `force` 后不再提供 `model` 参数(与完全未配置时一样),每次派生都绑定 `default_model`;显式传入 `model`(包括 `"primary"`)会报错。`force` 必须搭配 `default_model`,且不能与 `[secondary_model.models]` 表同时使用——表的意义在于提供选择,而 force 取消了选择。 -利用自然解析会落到所绑定模型的默认 effort 这一点,可以给池中不同条目配不同的 Thinking 档位:为同一个底层模型再注册一个 `[models]` 条目作为「变体」,用 [`[models."".overrides]`](#模型覆盖项) 只覆盖 `default_effort`,再把两个别名都放进模型池——主 Agent 挑选别名时便同时选定了档位: +利用自然解析会落到所绑定模型的默认 effort 这一点,可以给池中不同条目配不同的 Thinking 档位:为同一个底层模型再注册一个 `[models]` 条目作为「变体」,用 [`[models."".overrides]`](#模型覆盖项) 只覆盖 `default_effort`,再把两个别名都放进模型池——main agent 挑选别名时便同时选定了档位: ```toml # "kimi-code/kimi-for-coding-highspeed" 由 /login 提供;这里为同一模型注册一个高档位变体 @@ -259,55 +254,10 @@ default_model = "kimi-code/kimi-for-coding-highspeed" kimi-for-coding-highspeed-deep = "同一模型的高 Thinking 档位。适合较难的子任务。" ``` -注意 `default_effort` 是模型级默认值:一旦设置了全局 `[thinking].effort`,它对主 Agent 和子 Agent 都优先生效,变体的默认档位只在全局未设置时起作用。取值与回落规则同 [`[models]` 条目的 `default_effort`](#models)。 +注意 `default_effort` 是模型级默认值:一旦设置了全局 `[thinking].effort`,它对 main agent 和 subagent 都优先生效,变体的默认档位只在全局未设置时起作用。取值与回落规则同 [`[models]` 条目的 `default_effort`](#models)。 配置错误一律直接报错,不做静默回退:`default_model` 缺失、不是池中 key,或池中 key 无法解析到已配置的 `[models]` 条目时,会话的创建、恢复(resume)与 fork 都会在启动时直接失败;`force` 未搭配 `default_model` 或与 `[secondary_model.models]` 表同用时亦然。别名 `primary` 是保留字——它始终绑定调用方自己的模型——不能作为池中 key。工具调用传入的 `model` 既不是池中别名也不是 `"primary"` 时,本次派生报错并列出可选值。 -只写了配方键 `model`(没有 `default_model`,也没有 `[secondary_model.models]` 表)时,v2 引擎会兼容读取它,把该别名当作池的默认模型——等价于只含它一个条目的隐式模型池,优先级低于 `default_model`,所以从配方迁移过来不改配置也能工作。注意兼容只取模型别名:补丁字段(`default_effort`、`max_output_size` 等)不会随之生效——请把这些设置写到别名指向的 `[models]` 条目上,例如通过 [`[models."".overrides]`](#模型覆盖项)。一旦配置了 `[secondary_model.models]` 表,`default_model` 依旧必填,`model` 不能顶替。 - -要显式迁移,把模型别名改为池的默认模型即可: - -```toml -# 旧 -[secondary_model] -model = "kimi-code/kimi-for-coding-highspeed" - -# 新 -[secondary_model] -default_model = "kimi-code/kimi-for-coding-highspeed" -``` - -配方键可以继续留在本节中:旧版引擎会照常读取它们。 - -### 次主力模型配方 - -该读法由使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎使用;默认的 v2 引擎会忽略配方键。设置后,新派生的子 Agent(`Agent` / `AgentSwarm`)默认绑定该模型,而不再继承主 Agent 的模型;未设置时,子 Agent 继承主 Agent 的模型。 - -这是默认绑定而非强制。实验功能启用后,`Agent` / `AgentSwarm` 工具会获得 `model` 参数(仅接受 `"secondary"` / `"primary"` 两个符号值),工具描述中也会列出可选模型并标注默认值。派生时按以下顺序解析子 Agent 的模型:工具调用显式传入的 `model` → 子 Agent profile 的 [`model_preference`](../customization/agents.md#agent-文件格式) → 已配置的次主力模型(默认)。其中 `"primary"` 指主 Agent 当前正在运行的模型,不一定是 `default_model`——例如会话中途用 `/model` 切换过模型。 - -由于是否覆盖默认值由主 Agent 自行决定(工具描述仅建议常规任务用 `"secondary"`、困难或质量敏感的任务用 `"primary"`,不构成强制),用户没有单次派生级别的直接开关。想让某个子 Agent 使用主模型,可以在提示词中要求主 Agent 传入 `model: "primary"`,或在对应 profile 中设置 `model_preference: "primary"`。 - -该功能目前是实验功能,默认关闭。通过 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1` 启用,或使用 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。 - -| 字段 | 类型 | 默认值 | 说明 | -| --- | --- | --- | --- | -| `model` | `string` | — | [`[models]`](#models) 中已配置条目的别名,如 `kimi-code/kimi-for-coding`(不限 kimi 模型,可用任意供应商) | -| `default_effort` | `string` | — | 子 Agent 绑定次主力模型时使用的 thinking effort。未设置时按"全局 `[thinking]` 配置 → 模型默认 effort"的链路解析,不再继承主 Agent 的 effort。与主模型的 thinking effort 语义一致:严格校验 effort 的模型(如 kimi 模型)在不支持该取值时回退到模型默认 effort,其他供应商的模型按原样发送给后端 | -| 其他字段 | — | — | 接受 [`[models."".overrides]`](#models) 的全部字段(`max_context_size`、`max_output_size`、`support_efforts` 等),作为仅对子 Agent 生效的模型补丁 | - -`model` 之外的字段构成补丁:存在补丁字段时,运行时会在内存中合成一个派生模型条目(被指向条目的拷贝,补丁并入其 overrides 且补丁优先),子 Agent 实际绑定该派生条目;没有补丁字段时,子 Agent 直接绑定 `model` 指向的条目。派生条目只存在于内存中(不写回 `config.toml`),也不会出现在模型选择列表里。 - -```toml -[secondary_model] -model = "kimi-code/kimi-for-coding" -default_effort = "low" -max_output_size = 8192 -``` - -`model` / `default_effort` 可被环境变量 `KIMI_SECONDARY_MODEL` / `KIMI_SECONDARY_EFFORT` 覆盖,优先级均高于配置文件。 - -实验功能启用后,会话启动时会校验该配置:`model` 无法解析,或 `default_effort` 不在(应用补丁后的)模型 effort 列表中时,会在启动时显示警告(并通过会话警告 API 返回)。该检查仅为提示——配置有误的次主力模型仍会在派生子 Agent 时失败,派生错误中同样附带配置来源提示。 - ## `thinking` `thinking` 设置 Thinking 模式的全局默认行为。 @@ -362,21 +312,21 @@ max_output_size = 8192 | `kill_grace_period_ms` | `integer` | `5000` | 会话关闭、手动停止或任务超时请求正常终止后,等待任务自行结束的宽限时间(毫秒)。超过该时间仍在运行时,Kimi Code 会尝试强制停止该任务 | | `bash_auto_background_on_timeout` | `boolean` | `true` | 前台 `Bash` 命令触及超时时间时,将其转为后台任务而不是直接终止:命令完成时 agent 会收到通知,转入后台的命令受 `bash_task_timeout_s` 默认后台超时约束。设为 `false` 则恢复超时即终止的行为 | | `bash_task_timeout_s` | `integer` | `600` | 后台 `Bash` 任务在调用未传 `timeout` 时的默认超时(秒);前台命令超时转后台后也按此值重新计时。`0` 表示无超时——任务一直运行到自行结束或被模型手动停止。显式传入的 `timeout` 不受影响。在 print 模式(`kimi -p`)下未显式设置时默认为 `0` | -| `print_background_mode` | `"exit" \| "drain" \| "steer"` | `"steer"` | 仅 print 模式(`kimi -p`)生效,决定主 agent 的 turn 结束后如何处理未返回的后台任务:`"exit"` 立即退出;`"drain"` 退出前等待所有后台任务进入终态(结果不回馈给主 agent);`"steer"` 不退出,让后台任务完成时像后台子代理一样以合成 user 消息 steer 主 agent 进入新 turn,直到某 turn 结束时无未决后台任务或触及上限。设置后优先级高于 `keep_alive_on_exit` 的 print 回退 | +| `print_background_mode` | `"exit" \| "drain" \| "steer"` | `"steer"` | 仅 print 模式(`kimi -p`)生效,决定 main agent 的 turn 结束后如何处理未返回的后台任务:`"exit"` 立即退出;`"drain"` 退出前等待所有后台任务进入终态(结果不回馈给 main agent);`"steer"` 不退出,让后台任务完成时像后台 subagent 一样以合成 user 消息 steer main agent 进入新 turn,直到某 turn 结束时无未决后台任务或触及上限。设置后优先级高于 `keep_alive_on_exit` 的 print 回退 | | `print_wait_ceiling_s` | `integer` | `2147483` | print 模式(`kimi -p`)下,`print_background_mode` 为 `"drain"` 或 `"steer"` 时,等待/steer 循环的墙钟上限(秒;默认约 24.8 天,近似不设限)。在非 print 模式或 `"exit"` 时无效 | | `print_max_turns` | `integer` | `100000` | print 模式(`kimi -p`)且 `print_background_mode = "steer"` 时,允许由后台任务完成触发的新 turn 的最大数量,防止 steer 循环失控(默认值近似不设限) | `keep_alive_on_exit` 可被环境变量 `KIMI_CODE_BACKGROUND_KEEP_ALIVE_ON_EXIT` 覆盖,`max_running_tasks` 可被 `KIMI_CODE_BACKGROUND_MAX_RUNNING_TASKS` 覆盖,优先级均高于配置文件。 -在 print 模式(`kimi -p ""`)下,只要还有未决的后台任务,Kimi Code 在主 agent 的 turn 结束后不会退出:每个任务完成都会以合成 user 消息回馈给主 agent,steer 出新的 turn(默认 `print_background_mode = "steer"`),直到某 turn 结束时没有任何未决任务才退出。该循环受 `print_wait_ceiling_s` 与 `print_max_turns` 约束,默认值都近似不设限。print 模式下后台工作也不会被墙钟超时杀掉:后台 `Bash` 任务默认无超时(`bash_task_timeout_s = 0`),子代理默认无超时(`[subagent] timeout_ms = 0`),只有模型自己能停止任务。将 `print_background_mode` 设为 `"drain"` 可等待任务结束但不回馈结果,设为 `"exit"` 则在主 agent 结束后立即退出。 +在 print 模式(`kimi -p ""`)下,只要还有未决的后台任务,Kimi Code 在 main agent 的 turn 结束后不会退出:每个任务完成都会以合成 user 消息回馈给 main agent,steer 出新的 turn(默认 `print_background_mode = "steer"`),直到某 turn 结束时没有任何未决任务才退出。该循环受 `print_wait_ceiling_s` 与 `print_max_turns` 约束,默认值都近似不设限。print 模式下后台工作也不会被墙钟超时杀掉:后台 `Bash` 任务默认无超时(`bash_task_timeout_s = 0`),subagent 默认无超时(`[subagent] timeout_ms = 0`),只有模型自己能停止任务。将 `print_background_mode` 设为 `"drain"` 可等待任务结束但不回馈结果,设为 `"exit"` 则在 main agent 结束后立即退出。 ## `subagent` -`subagent` 控制派生子 Agent(`Agent` / `AgentSwarm`)的运行方式。 +`subagent` 控制派生 subagent(`Agent` / `AgentSwarm`)的运行方式。 | 字段 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | -| `timeout_ms` | `integer` | `7200000`(2 小时) | 单个子代理(`Agent` / `AgentSwarm`)允许运行的最长时间(毫秒)。超时后子代理以 `timed_out` 收尾。`0` 表示无超时——子代理一直运行到自行结束或被模型手动停止。该值是后台任务管理器对每个子代理任务的 per-task timeout,因此对前台与后台子代理同时生效。在 print 模式(`kimi -p`)下未显式设置时默认为 `0`。注意:超过 `2147483647`(约 24.8 天)的值会被运行时钳到约 24.8 天 | +| `timeout_ms` | `integer` | `7200000`(2 小时) | 单个 subagent(`Agent` / `AgentSwarm`)允许运行的最长时间(毫秒)。超时后 subagent 以 `timed_out` 收尾。`0` 表示无超时——subagent 一直运行到自行结束或被模型手动停止。该值是后台任务管理器对每个 subagent 任务的 per-task timeout,因此对前台与后台 subagent 同时生效。在 print 模式(`kimi -p`)下未显式设置时默认为 `0`。注意:超过 `2147483647`(约 24.8 天)的值会被运行时钳到约 24.8 天 | `timeout_ms` 可被环境变量 `KIMI_SUBAGENT_TIMEOUT_MS` 覆盖,优先级高于配置文件。 diff --git a/docs/zh/configuration/data-locations.md b/docs/zh/configuration/data-locations.md index 5ab5aaa0277..302198278f8 100644 --- a/docs/zh/configuration/data-locations.md +++ b/docs/zh/configuration/data-locations.md @@ -76,9 +76,9 @@ $KIMI_CODE_HOME (默认 ~/.kimi-code) - **`state.json`**:会话标题、`lastPrompt`、创建/更新时间、`forkedFrom` 等元数据。 - **`upcoming-goals.json`**:由 `/goal next ` 创建的 TUI 专属队列。它不属于 Agent 对话;只有当前目标完成并提升后续目标后,才会进入 Agent 对话。 -- **`agents/main/wire.jsonl`**:主 Agent 的完整通信记录,用于会话恢复和回放。 +- **`agents/main/wire.jsonl`**:main agent 的完整通信记录,用于会话恢复和回放。 - **`agents/main/plans/`**:Plan 模式下写入的计划文件,按计划 id 命名(`.md`)。 -- **`agents/agent-0/` 等**:子 Agent 实例目录,各自含 `wire.jsonl`。 +- **`agents/agent-0/` 等**:subagent 实例目录,各自含 `wire.jsonl`。 - **`logs/kimi-code.log`**:该会话的诊断日志,只有发生诊断事件时才存在。 - **`tasks/`**:后台任务持久化——`tasks/.json` 保存状态/pid/退出码,`tasks//output.log` 保存输出。 - **`cron/`**:定时任务持久化,用 `kimi --session` 恢复会话时重新加载到调度器。详见[定时任务](../reference/tools.md#定时任务)。 diff --git a/docs/zh/configuration/env-vars.md b/docs/zh/configuration/env-vars.md index 5195767cf3d..a31507fe25d 100644 --- a/docs/zh/configuration/env-vars.md +++ b/docs/zh/configuration/env-vars.md @@ -127,15 +127,13 @@ kimi | `KIMI_IMAGE_MAX_EDGE_PX` | 图片压缩的最长边上限(像素),优先级高于 `config.toml` 的 `[image] max_edge_px`(默认 `2000`) | 正整数;非法值被忽略 | | `KIMI_IMAGE_READ_BYTE_BUDGET` | 模型自行读图(`ReadMediaFile` 默认读取)的单图字节预算,优先级高于 `config.toml` 的 `[image] read_byte_budget`(默认 `262144`,即 256 KB) | 正整数;非法值被忽略 | | `KIMI_CODE_PLUGIN_MARKETPLACE_URL` | 覆盖 `/plugins` 加载的 plugin marketplace JSON,适合 dev loopback server、测试 CDN 文件或替换 marketplace 目录 | `https://code.kimi.com/kimi-code/plugins/marketplace.json`;也接受 `http://`、`file://` URL 和本地路径 | -| `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` | 限制 AgentSwarm 初始提升并发阶段可同时运行的子 Agent 数量;不设置表示不限制 | 正整数;非法值会立即失败 | -| `KIMI_SUBAGENT_TIMEOUT_MS` | 单个子 Agent(`Agent` / `AgentSwarm`)可运行的最长时间(毫秒);优先级高于 `config.toml` 的 `[subagent] timeout_ms`(默认 `7200000`,即 2 小时) | 正整数;非法值回退到配置或默认值 | +| `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` | 限制 AgentSwarm 初始提升并发阶段可同时运行的 subagent 数量;不设置表示不限制 | 正整数;非法值会立即失败 | +| `KIMI_SUBAGENT_TIMEOUT_MS` | 单个 subagent(`Agent` / `AgentSwarm`)可运行的最长时间(毫秒);优先级高于 `config.toml` 的 `[subagent] timeout_ms`(默认 `7200000`,即 2 小时) | 正整数;非法值回退到配置或默认值 | | `KIMI_CODE_IDENTITY_NAME` | Agent 在系统提示词中的自称,优先级高于 `config.toml` 的 `[identity] name`,且不会被写回配置文件 | 任意非空字符串;空值视为未设置 | | `KIMI_CODE_IDENTITY_SLUG` | 协议标识,用于发给第三方 provider 的 `User-Agent` 产品名和 MCP 客户端名,优先级高于 `[identity] slug`。未设置时由名称派生 | 任意非空字符串;会转小写并将连续非字母数字字符折叠为 `-` | | `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` | 是否向模型提供介绍 Kimi Code 自身的内置 Skills,优先级高于 `config.toml` 的 `builtin_product_skills`(默认开启) | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_CODE_TUI_FULL_SCREEN` | 启用实验性的 fullscreen alternate-screen 界面:可滚动的 transcript 视口、鼠标选择文本、可点击链接、Ctrl-Shift-F 搜索 | `1` 开启;其他值保持常规内联界面 | -| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | 在包括交互式 TUI 在内的所有启动方式下启用实验性的次主力模型功能;master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 也会启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | -| `KIMI_SECONDARY_MODEL` | 次主力模型;优先级高于 `config.toml` 的 [`[secondary_model] model`](./config-files.md#secondary-model)。次主力模型实验功能启用后,新派生的子 Agent 默认绑定该模型,而不再继承主 Agent 的模型 | `[models]` 中已配置条目的别名,如 `kimi-code/kimi-for-coding`;空白值被忽略 | -| `KIMI_SECONDARY_EFFORT` | 次主力模型的 thinking effort;优先级高于 `[secondary_model] default_effort`,仅在次主力模型及其实验功能均启用时生效 | effort 取值,如 `low`;空白值被忽略 | +| `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` | 在包括交互式 TUI 在内的所有启动方式下启用实验性的[subagent 模型池](./config-files.md#subagent-模型池);master `KIMI_CODE_EXPERIMENTAL_FLAG=1` 也会启用本功能 | 真值:`1`/`true`/`yes`/`on`;假值:`0`/`false`/`no`/`off` | | `KIMI_MCP_STARTUP_TIMEOUT_MS` | 所有 MCP server 的全局默认连接超时(毫秒);优先级高于 `config.toml` 的 `[mcp] startup_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `startupTimeoutMs`(默认 `30000`) | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_MCP_TOOL_TIMEOUT_MS` | 所有 MCP server 的全局默认单次工具调用超时(毫秒);优先级高于 `config.toml` 的 `[mcp] tool_timeout_ms`,但低于 `mcp.json` 中单个 server 的 `toolTimeoutMs`(默认 `60000`) | `1` 到 `2147483647` 的整数;非法值被忽略 | | `KIMI_LOOP_MAX_STEPS_PER_TURN` | Agent 单轮最大步数;优先级高于 `config.toml` 的 `[loop_control] max_steps_per_turn`(不设或 `0` 表示无上限) | 非负整数;非法值被忽略 | @@ -156,7 +154,7 @@ kimi | `KIMI_CODE_NO_AUTO_UPDATE` | 完全禁用更新预检——不检查、不后台安装、不提示。同时兼容旧名 `KIMI_CLI_NO_AUTO_UPDATE` | 真值:`1`/`true`/`yes`/`on` | | `KIMI_DISABLE_CRON` | 禁用定时任务工具(`CronCreate` 拒绝新计划,已有任务不触发) | `1` 表示禁用 | -`KIMI_CODE_IDENTITY_*` 和 `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` 这三个变量由默认的 `agent-core-v2` 引擎读取。设置 `KIMI_CODE_LEGACY_FLAG=1` 后,旧版 `kimi` / `kimi -p` 路径会忽略它们。反过来,`KIMI_SECONDARY_MODEL` 和 `KIMI_SECONDARY_EFFORT` 仅由旧版引擎读取,默认引擎会忽略它们;`KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL` 则由两个引擎共同读取(它同时门控 v2 的[子 Agent 模型池](./config-files.md#子-agent-模型池)和旧版的[次主力模型配方](./config-files.md#次主力模型配方))。 +`KIMI_CODE_IDENTITY_*` 和 `KIMI_CODE_BUILTIN_PRODUCT_SKILLS` 这三个变量由默认的 `agent-core-v2` 引擎读取。设置 `KIMI_CODE_LEGACY_FLAG=1` 后,旧版 `kimi` / `kimi -p` 路径会忽略它们。 ## 诊断日志 diff --git a/docs/zh/customization/agents.md b/docs/zh/customization/agents.md index 0dffbe352be..d25ba177c67 100644 --- a/docs/zh/customization/agents.md +++ b/docs/zh/customization/agents.md @@ -1,47 +1,47 @@ -# Agent 与子 Agent +# Agent 与 subagent -Kimi Code CLI 中的每次会话都由一个**主 Agent** 驱动。主 Agent 理解用户意图、规划步骤、调用工具,并在需要时向外派发**子 Agent** 处理更聚焦的子任务——例如探索一个陌生代码库、并行审阅多处实现、或在不触碰主上下文的情况下规划一次大型重构。 +Kimi Code CLI 中的每次会话都由一个**main agent** 驱动。main agent 理解用户意图、规划步骤、调用工具,并在需要时向外派发**subagent** 处理更聚焦的子任务——例如探索一个陌生代码库、并行审阅多处实现、或在不触碰主上下文的情况下规划一次大型重构。 -子 Agent 接受主 Agent 给出的任务描述,在自己的独立上下文里工作,最后把结论返回。它不会与用户直接对话,中间的思考和工具调用记录也不会混入主 Agent 的历史。 +subagent 接受 main agent 给出的任务描述,在自己的独立上下文里工作,最后把结论返回。它不会与用户直接对话,中间的思考和工具调用记录也不会混入 main agent 的历史。 -## 内置子 Agent +## 内置 subagent -Kimi Code CLI 内置三种子 Agent,开箱即用,分别面向不同任务形态: +Kimi Code CLI 内置三种 subagent,开箱即用,分别面向不同任务形态: -- **`coder`**:默认子 Agent,通用软件工程助手,可以读写文件、执行命令、搜索代码并落地具体改动。 +- **`coder`**:默认 subagent,通用软件工程助手,可以读写文件、执行命令、搜索代码并落地具体改动。 - **`explore`**:代码库探索专用,只做只读操作,不修改任何文件。适合在不改动文件的前提下快速搜索、阅读和总结仓库。 - **`plan`**:实现规划与架构设计专用,连 Shell 命令都不提供,专注于"想清楚怎么做"而不是"动手做"。 -`coder` 子 Agent 与主 Agent 共享大部分工具集:可以在后台执行 Shell 命令、维护待办列表、进入 Plan 模式、调用 Agent Skills,也可以在任务自然拆解时继续派发自己的嵌套子 Agent。如果它结束自己的轮次时仍有后台任务在运行,那么只有在这些后台任务全部落定后,这次运行才会回报完成——主 Agent 拿到结果时,背后的工作也已经真正完成。 +`coder` subagent 与 main agent 共享大部分工具集:可以在后台执行 Shell 命令、维护待办列表、进入 Plan 模式、调用 Agent Skills,也可以在任务自然拆解时继续派发自己的嵌套 subagent。如果它结束自己的轮次时仍有后台任务在运行,那么只有在这些后台任务全部落定后,这次运行才会回报完成——main agent 拿到结果时,背后的工作也已经真正完成。 ## 调用方式 -子 Agent 由主 Agent 自动调度——根据任务复杂度、上下文消耗和子任务的独立性,在适当时机派发,无需用户手动指定。 +subagent 由 main agent 自动调度——根据任务复杂度、上下文消耗和子任务的独立性,在适当时机派发,无需用户手动指定。 -每次派发都会在终端以审批请求的形式呈现(除非命中 allow 规则或处于 YOLO 模式),方便你审视任务描述。你也可以在对话中直接指示主 Agent 使用特定子 Agent,例如"先用 explore 把相关文件梳理一遍再动手"。 +每次派发都会在终端以审批请求的形式呈现(除非命中 allow 规则或处于 YOLO 模式),方便你审视任务描述。你也可以在对话中直接指示 main agent 使用特定 subagent,例如"先用 explore 把相关文件梳理一遍再动手"。 -子 Agent 支持在后台运行:完成后结果自动回到主 Agent,无需手动轮询。也可以唤回已有的子 Agent 实例继续推进同一任务。 +subagent 支持在后台运行:完成后结果自动回到 main agent,无需手动轮询。也可以唤回已有的 subagent 实例继续推进同一任务。 ## 上下文隔离与资源开销 -每个子 Agent 拥有完全独立的上下文窗口,只能看到主 Agent 显式传入的任务描述,看不到主 Agent 的对话历史。子 Agent 自己的中间思考和工具调用记录不会回流,只有最终结果会出现在主 Agent 的上下文里。 +每个 subagent 拥有完全独立的上下文窗口,只能看到 main agent 显式传入的任务描述,看不到 main agent 的对话历史。subagent 自己的中间思考和工具调用记录不会回流,只有最终结果会出现在 main agent 的上下文里。 这种隔离带来两个好处: -- **主 Agent 上下文保持精炼**,长会话中不会被大量探索性日志撑满。 -- **多个子 Agent 可以并行运行**,互不干扰。 +- **main agent 上下文保持精炼**,长会话中不会被大量探索性日志撑满。 +- **多个 subagent 可以并行运行**,互不干扰。 -需要注意的是,每个子 Agent 都会独立消耗模型 token。简单任务没有必要派发子 Agent,主 Agent 直接处理更经济。 +需要注意的是,每个 subagent 都会独立消耗模型 token。简单任务没有必要派发 subagent,main agent 直接处理更经济。 ## 权限继承 -子 Agent 的权限规则继承自主 Agent:主 Agent 通过 `/permission` 或在审批中接受的"始终允许"规则,会自动覆盖到它派发出的所有子 Agent,子 Agent 不需要重新审批同类工具调用。`Agent` 工具本身默认放行,因此主 Agent 可以在不打断用户的前提下完成多次委派。 +subagent 的权限规则继承自 main agent:main agent 通过 `/permission` 或在审批中接受的"始终允许"规则,会自动覆盖到它派发出的所有 subagent,subagent 不需要重新审批同类工具调用。`Agent` 工具本身默认放行,因此 main agent 可以在不打断用户的前提下完成多次委派。 -如果需要某类工具在子 Agent 中始终不可用,应收紧主 Agent 的权限规则。 +如果需要某类工具在 subagent 中始终不可用,应收紧 main agent 的权限规则。 ## 自定义 Agent -除了三个内置子 Agent,你还可以用 Markdown 文件定义自己的 Agent。每个文件描述一个 Agent:文件顶部的 Frontmatter(YAML 元数据)声明名称、描述和工具权限,文件正文是它的系统提示词。自定义 Agent 可以作为子 Agent 被委派 —— 主 Agent 会自动发现它们,与内置子 Agent 并列 —— 也可以在启动时选为主 Agent。 +除了三个内置 subagent,你还可以用 Markdown 文件定义自己的 Agent。每个文件描述一个 Agent:文件顶部的 Frontmatter(YAML 元数据)声明名称、描述和工具权限,文件正文是它的系统提示词。自定义 Agent 可以作为 subagent 被委派 —— main agent 会自动发现它们,与内置 subagent 并列 —— 也可以在启动时选为 main agent。 ### Agent 目录 @@ -65,10 +65,10 @@ extra_agent_dirs = ["~/team-agents", ".agents/team-agents"] **Plugin 级**:已启用 plugin 在其 manifest 的 `agents` 字段中声明的目录(省略时自动采用 plugin 根下的 `agents/` 目录),见[插件 Agent](./plugins.md#插件-agent)。Plugin Agent 优先级仅高于内置 Agent。 -**内置 Agent** 随 CLI 分发,优先级最低。目录中发现的文件不会仅凭同名覆盖内置 Agent;如确需替换,必须在 Frontmatter 中声明 `override: true`。通过 `--agent-file` 加载的文件视为显式启动意图,可以覆盖同名内置 Agent,优先级高于所有目录作用域,且仅对本次启动生效。另外,`$KIMI_CODE_HOME/SYSTEM.md` 可永久覆盖默认主 Agent 的系统提示词(它不参与 Agent 文件发现),其优先级交互见下文 SYSTEM.md 小节。 +**内置 Agent** 随 CLI 分发,优先级最低。目录中发现的文件不会仅凭同名覆盖内置 Agent;如确需替换,必须在 Frontmatter 中声明 `override: true`。通过 `--agent-file` 加载的文件视为显式启动意图,可以覆盖同名内置 Agent,优先级高于所有目录作用域,且仅对本次启动生效。另外,`$KIMI_CODE_HOME/SYSTEM.md` 可永久覆盖默认 main agent 的系统提示词(它不参与 Agent 文件发现),其优先级交互见下文 SYSTEM.md 小节。 ::: warning 信任模型 -Agent 文件属于提示词配置,而项目级文件来自仓库本身 —— 包括你刚刚 clone、尚不可信的仓库。项目作用域的文件可以完全接管内置 Agent:命名为 `agent.md` 并声明 `override: true` 会替换**默认主 Agent 的整个系统提示词**,`coder.md` 加 `override: true` 则会替换默认子 Agent 类型。与 `AGENTS.md` 内容(作为参考资料注入提示词)不同,override 文件**就是**系统提示词本身,且不写 `tools` 的文件保留全部工具。在不熟悉的仓库中运行 Kimi Code 之前,请以对待脚本同样的谨慎检查其中的 `.kimi-code/agents/` 与 `.agents/agents/` 目录。 +Agent 文件属于提示词配置,而项目级文件来自仓库本身 —— 包括你刚刚 clone、尚不可信的仓库。项目作用域的文件可以完全接管内置 Agent:命名为 `agent.md` 并声明 `override: true` 会替换**默认 main agent 的整个系统提示词**,`coder.md` 加 `override: true` 则会替换默认 subagent 类型。与 `AGENTS.md` 内容(作为参考资料注入提示词)不同,override 文件**就是**系统提示词本身,且不写 `tools` 的文件保留全部工具。在不熟悉的仓库中运行 Kimi Code 之前,请以对待脚本同样的谨慎检查其中的 `.kimi-code/agents/` 与 `.agents/agents/` 目录。 ::: ### Agent 文件格式 @@ -81,7 +81,6 @@ name: reviewer description: 严格的代码审查 Agent,按严重度分级报告问题 whenToUse: 代码评审与 PR 检查 override: false -model_preference: primary tools: - Read - Grep @@ -97,13 +96,12 @@ disallowedTools: | 字段 | 必填 | 说明 | | --- | --- | --- | | `name` | 否 | kebab-case 唯一标识。缺省时取文件名(去掉扩展名,如 `review.md` → `review`);解析后名字缺失或不是 kebab-case 的文件会被跳过并告警 | -| `description` | 是 | Agent 的用途。主 Agent 挑选子 Agent 时会看到,请围绕委派决策来写 | +| `description` | 是 | Agent 的用途。main agent 挑选 subagent 时会看到,请围绕委派决策来写 | | `whenToUse` | 否 | 补充说明何时应使用该 Agent | | `override` | 否 | 是否允许覆盖同名内置 Agent,默认 `false`。`--agent-file` 属于显式启动意图,无需设置此字段 | -| `model_preference` | 否 | `Agent` 或 `AgentSwarm` 启动该 profile 时的符号默认值:`primary` 选择调用方当前运行的模型,`secondary` 选择 [`[secondary_model] model`](../configuration/config-files.md#secondary-model)。工具调用显式传入的 `model`(同样只接受 `"primary"` / `"secondary"` 两个符号值)优先于该字段;两者均未设置时,已配置的次主力模型仍为默认值。未配置次主力模型时,子 Agent 继承调用方模型。仅使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎读取该字段;默认的 v2 引擎会忽略 | | `tools` | 否 | 工具名允许列表,如 `Read`、`Bash`;MCP 工具用 glob 匹配,如 `mcp__github__*`。支持 YAML 列表或逗号分隔字符串(`tools: Read, Grep`)两种写法。缺省表示允许全部工具;单独的 `*` 同样表示允许全部工具;空列表(`tools: []`)表示禁用全部工具 | | `disallowedTools` | 否 | 禁止列表,写法与匹配规则相同,在 `tools` 之后应用 | -| `subagents` | 否 | 允许委派的子 Agent 名称列表,写法与 `tools` 相同(YAML 列表或逗号分隔字符串)。缺省表示可委派所有类型;单独的 `*` 同样表示全部 | +| `subagents` | 否 | 允许委派的 subagent 名称列表,写法与 `tools` 相同(YAML 列表或逗号分隔字符串)。缺省表示可委派所有类型;单独的 `*` 同样表示全部 | 内置工具与用户工具按名称精确匹配(区分大小写);以 `mcp__` 开头的条目按 glob 匹配 MCP 工具。有三种写法永远匹配不到任何工具,在 profile 生效时会给出警告:`mcp__` 模式之外使用通配符(`disallowedTools` 里单独的 `*` 什么也禁不掉);不是完整 `mcp__<服务器>__<工具>` 形式的 `mcp__` 字面量(`mcp__github` 匹配不到任何工具 —— 匹配整个服务器要用 `mcp__github__*`);以及任何已注册或内置工具都没有的名字(通常是笔误,如把 `Read` 写成 `read`)。 @@ -111,21 +109,19 @@ disallowedTools: 未知字段会被忽略,新版本写的文件在旧版本上仍可读取。其他 Agent 工具的字段(如 Claude Code 的 `model`、OpenCode 的 `mode`)同样会被忽略;加上 `tools` 的逗号分隔写法和 `name` 缺省回退到文件名,Claude Code 与 OpenCode 风格的 Agent 文件一般可直接加载 —— 只含 `description` 和正文的最小文件可跨工具通用。 -`model_preference` 仅在次主力模型实验功能启用时对新启动的子 Agent 生效——设置 `KIMI_CODE_EXPERIMENTAL_SECONDARY_MODEL=1`,或 master `KIMI_CODE_EXPERIMENTAL_FLAG=1`。它在包括交互式 TUI 在内的所有启动方式下生效。该字段不用于填写具体模型 alias,已恢复的子 Agent 也会保持原模型。主 Agent 会在 profile 描述中看到这项偏好,因此仍可在某项任务需要不同选择时显式传入 `model`。 - 目录中发现的非法文件会被跳过并告警,不影响其他文件。通过 `--agent-file` 显式传入的文件必须合法 —— 否则 CLI 会报错并退出。 ::: warning 注意 -`tools` 与 `disallowedTools` 不仅决定模型能"看到"哪些工具,还会在执行前再次强制检查。`subagents` 同样双重生效:`Agent` 工具的类型列表只包含允许委派的子 Agent,`Agent` 与 `AgentSwarm` 在实际派发前都会强制校验;唤回已有子 Agent 不受此限制。权限规则仍是独立的控制层,用于决定哪些操作需要审批。 +`tools` 与 `disallowedTools` 不仅决定模型能"看到"哪些工具,还会在执行前再次强制检查。`subagents` 同样双重生效:`Agent` 工具的类型列表只包含允许委派的 subagent,`Agent` 与 `AgentSwarm` 在实际派发前都会强制校验;唤回已有 subagent 不受此限制。权限规则仍是独立的控制层,用于决定哪些操作需要审批。 ::: -作为子 Agent 委派的自定义 Agent 不会携带内置子 Agent 的角色框架("你的最后一条消息就是完整交付")。如果编写的 Agent 用于委派,请在正文中说明:其最后一条消息应当是交付给调用方的完整、自包含的结果。 +作为 subagent 委派的自定义 Agent 不会携带内置 subagent 的角色框架("你的最后一条消息就是完整交付")。如果编写的 Agent 用于委派,请在正文中说明:其最后一条消息应当是交付给调用方的完整、自包含的结果。 -### 选择主 Agent +### 选择 main agent 两个 CLI flag 用于选择驱动新会话的 Agent,在 print 模式(`kimi -p`)和交互式 TUI 中均可使用: -- **`--agent `**:以指定 Agent 作为主 Agent 启动会话。名称可以指向内置 Agent 或任何已发现的文件;名称不存在时会报错,并列出可用的 Agent。 +- **`--agent `**:以指定 Agent 作为 main agent 启动会话。名称可以指向内置 Agent 或任何已发现的文件;名称不存在时会报错,并列出可用的 Agent。 - **`--agent-file `**:以最高优先级加载一个 Agent 文件(仅本次启动)并以其启动。该 flag 只接受一个文件:不可重复传入,也不能与 `--agent` 同时使用。 两个 flag 都仅在新建会话时有效——都不能与 `--session`/`--continue` 组合。Agent 在会话创建时绑定,恢复会话时会自动还原已绑定的 Agent,因此恢复时不需要(也不允许)携带这些 flag。 @@ -139,11 +135,11 @@ kimi -p --agent reviewer "审查这个分支上的改动" 绑定的 Agent 即会话的身份:在会话首次绑定后即固定,之后不可切换。在 TUI 中,这些 flag 只绑定启动时的会话;之后在同一进程内新建的会话(例如通过 `/new`)使用默认 Agent。 -定制主 Agent 时,在正文中引用 `${base_prompt}` 可保持有效默认提示词中已有的环境、工作区指令、Skill 和 plugin 注入生效。如果要替换默认提示词、但只保留 plugin 提供的指令,请改用 `${plugin_sections}`。正文同时不引用 `${base_prompt}` 和 `${plugin_sections}` 时,会完全拥有自己的提示词并排除 plugin 指令,适合自包含的子 Agent。 +定制 main agent 时,在正文中引用 `${base_prompt}` 可保持有效默认提示词中已有的环境、工作区指令、Skill 和 plugin 注入生效。如果要替换默认提示词、但只保留 plugin 提供的指令,请改用 `${plugin_sections}`。正文同时不引用 `${base_prompt}` 和 `${plugin_sections}` 时,会完全拥有自己的提示词并排除 plugin 指令,适合自包含的 subagent。 -### 用 SYSTEM.md 覆盖主 Agent 的系统提示词 +### 用 SYSTEM.md 覆盖 main agent 的系统提示词 -希望永久覆盖主 Agent 的系统提示词、而不必每次启动都传入 `--agent` 或 `--agent-file` 时,可以写一份 `$KIMI_CODE_HOME/SYSTEM.md`(默认:`~/.kimi-code/SYSTEM.md`,随 `KIMI_CODE_HOME` 移动)。文件存在且非空期间,它整体替换内置默认主 Agent 的系统提示词——但只替换提示词,描述、工具集与允许委派的子 Agent 列表仍沿用内置默认值。SYSTEM.md 在包括交互式 TUI 会话在内的所有启动方式下生效。 +希望永久覆盖 main agent 的系统提示词、而不必每次启动都传入 `--agent` 或 `--agent-file` 时,可以写一份 `$KIMI_CODE_HOME/SYSTEM.md`(默认:`~/.kimi-code/SYSTEM.md`,随 `KIMI_CODE_HOME` 移动)。文件存在且非空期间,它整体替换内置默认 main agent 的系统提示词——但只替换提示词,描述、工具集与允许委派的 subagent 列表仍沿用内置默认值。SYSTEM.md 在包括交互式 TUI 会话在内的所有启动方式下生效。 SYSTEM.md 是纯 Markdown 正文,不需要也不读取 Frontmatter。文件缺失或为空时不生效;读取失败时会告警并回退到内置提示词。优先级上,显式意图仍然胜出:项目作用域中声明了 `override: true` 的同名 Agent 文件、通过 `--agent-file` 传入的文件都排在 SYSTEM.md 之前,用 `--agent` 选择其他 Agent 时 SYSTEM.md 也不会生效;而在用户作用域内部,SYSTEM.md 优先于 `agents/` 目录中扫描到的同名文件。 @@ -180,7 +176,7 @@ ${plugin_sections} ## 会话目录中的存储位置 -子 Agent 的运行状态持久化到当前会话目录的 `agents/` 子目录下,每个子 Agent 实例对应一个独立目录,其中包含按时间顺序记录提示词、消息历史与最终状态的 `wire.jsonl` 文件。后台子 Agent 还会通过 `tasks/` 子目录暴露生命周期状态。 +subagent 的运行状态持久化到当前会话目录的 `agents/` 子目录下,每个 subagent 实例对应一个独立目录,其中包含按时间顺序记录提示词、消息历史与最终状态的 `wire.jsonl` 文件。后台 subagent 还会通过 `tasks/` 子目录暴露生命周期状态。 ::: warning 注意 会话目录、wire 文件和任务记录都属于本地调试材料,可能包含用户 prompt、命令输出、仓库路径、工具返回内容或凭证痕迹。不要把这些文件直接提交到公开仓库、issue 或聊天记录里;如确需分享,请先脱敏。 @@ -188,5 +184,5 @@ ${plugin_sections} ## 下一步 -- [Hooks](./hooks.md) — 在子 Agent 完成等关键节点触发本地脚本通知或拦截 -- [Agent Skills](./skills.md) — 给子 Agent 注入专业知识和工作流程 +- [Hooks](./hooks.md) — 在 subagent 完成等关键节点触发本地脚本通知或拦截 +- [Agent Skills](./skills.md) — 给 subagent 注入专业知识和工作流程 diff --git a/docs/zh/customization/hooks.md b/docs/zh/customization/hooks.md index 93c2206731b..b23ec914314 100644 --- a/docs/zh/customization/hooks.md +++ b/docs/zh/customization/hooks.md @@ -112,8 +112,8 @@ Hook 命令的工作目录是当前会话的项目目录。非 Windows 平台上 | `SessionStart` | `startup` 或 `resume` | — | 新会话启动或历史会话恢复后触发;payload 含 `source`、`model` 和 `profile` | | `SessionEnd` | `exit` 或 `archive` | — | 会话关闭后触发;`archive` 表示会话被归档而非退出 | | `SessionHeartbeat` | 空字符串 | — | 会话存活期间每 60 秒触发一次;仅当配置了本事件时计时器才会运行。payload 含 `uptime_ms`(观察用) | -| `SubagentStart` | 子 Agent 名称 | — | 子 Agent 开始运行前触发 | -| `SubagentStop` | 子 Agent 名称 | — | 子 Agent 成功完成后触发(观察用) | +| `SubagentStart` | subagent 名称 | — | subagent 开始运行前触发 | +| `SubagentStop` | subagent 名称 | — | subagent 成功完成后触发(观察用) | | `TaskStarted` | 任务类型(`agent`、`process` 或 `question`) | — | 后台任务启动时触发;payload 含 `task_id`、`description` 和 `detached`(观察用) | | `StopFailure` | 错误类型 | — | 本轮因错误失败后触发(观察用) | | `Interrupt` | 空字符串 | — | 用户中断本轮时触发(例如按下 Esc);超时或其他程序性中断不会触发。中断时 `Stop` 不会触发,由本事件替代。payload 含 `reason` 字段(观察用) | @@ -160,4 +160,4 @@ process.stdin.on('end', () => { ## 下一步 - [配置](#配置) — `[[hooks]]` 在 `config.toml` 中的完整字段声明 -- [Agent 与子 Agent](./agents.md) — 利用 `SubagentStop` 事件在子 Agent 完成后触发通知 +- [Agent 与 subagent](./agents.md) — 利用 `SubagentStop` 事件在 subagent 完成后触发通知 diff --git a/docs/zh/customization/plugins.md b/docs/zh/customization/plugins.md index aa46a04b49a..abf1ee6dea9 100644 --- a/docs/zh/customization/plugins.md +++ b/docs/zh/customization/plugins.md @@ -254,7 +254,7 @@ Plugin 是一个带 manifest 的目录或 zip 文件。Manifest 可以放在以 | `interface` | 在 `/plugins` 中展示的字段:`displayName`、`shortDescription`、`longDescription`、`developerName`、`websiteURL` | | `skills` | 一个或多个 `./` 路径,必须位于 plugin 根目录内。省略时根目录的 `SKILL.md` 被当作单个 Skill root | | `agents` | 一个或多个 `./` 路径,必须位于 plugin 根目录内,指向含有 [Agent 文件](./agents.md#自定义-agent)的目录。省略时根下的 `agents/` 目录(若存在)被自动采用 | -| `sessionStart.skill` | 在新会话或恢复会话开始时,把指定 plugin Skill 加载到主 Agent | +| `sessionStart.skill` | 在新会话或恢复会话开始时,把指定 plugin Skill 加载到 main agent | | `skillInstructions` | 每次加载此 plugin 的 Skill 时一并附带的额外说明 | | `systemPrompt` | plugin 启用期间提供给 Agent 系统提示词的内联指令 | | `systemPromptPath` | 指向 UTF-8 文本文件的 `./` 路径;同时设置 `systemPrompt` 时,文件内容拼接在内联指令之后 | @@ -281,7 +281,7 @@ Plugin 是一个带 manifest 的目录或 zip 文件。Manifest 可以放在以 新会话和新建 Agent 会读取当前已启用 plugin 的指令。正在进行的请求会继续使用已有的系统提示词。`/plugins reload` 会刷新 plugin Skill 列表,并请求重建活跃 Agent 的提示词;如果需要让变更在下一轮前明确收敛,请使用这个命令。在 v2 引擎中,安装、启用、禁用或移除 plugin 会立即更新 catalog,后续的提示词重建(例如压缩上下文或修改工具策略后)可能会读取新的指令。legacy 引擎会让每个活跃 session 保留自己的 plugin 快照,直到 `/plugins reload` 或创建新 session。从磁盘恢复的 session 会先使用持久化的提示词,后续重建再遵循对应引擎的行为。切换 plugin 的 MCP server 不会改变系统提示词指令。 -内置 Agent 提示词会自动包含已启用 plugin 的指令。自定义 `SYSTEM.md` 或 Agent 文件完全拥有自己的模板,因此应在希望出现 plugin 指令的位置加入 `${plugin_sections}`。如果自定义模板包含 `${base_prompt}`,且该有效默认提示词已经包含 plugin 块,就不要再重复加入 `${plugin_sections}`。完整变量表见 [自定义 Agent 与 SYSTEM.md](./agents.md#用-system-md-覆盖主-agent-的系统提示词)。 +内置 Agent 提示词会自动包含已启用 plugin 的指令。自定义 `SYSTEM.md` 或 Agent 文件完全拥有自己的模板,因此应在希望出现 plugin 指令的位置加入 `${plugin_sections}`。如果自定义模板包含 `${base_prompt}`,且该有效默认提示词已经包含 plugin 块,就不要再重复加入 `${plugin_sections}`。完整变量表见 [自定义 Agent 与 SYSTEM.md](./agents.md#用-system-md-覆盖-main-agent-的系统提示词)。 ## 插件斜杠命令 @@ -359,13 +359,13 @@ my-plugin/ SKILL.md ``` -`sessionStart.skill` 在会话启动时把一个 plugin Skill 加载到主 Agent,适合放置初始化说明、工作流规则,或把其他工具中的术语映射到 Kimi Code CLI。它只注入文本,不执行代码。 +`sessionStart.skill` 在会话启动时把一个 plugin Skill 加载到 main agent,适合放置初始化说明、工作流规则,或把其他工具中的术语映射到 Kimi Code CLI。它只注入文本,不执行代码。 无论 Skill 通过哪种方式加载(`sessionStart.skill`、`/skill:` 或模型自动调用),`skillInstructions` 都会随该 plugin 的 Skill 一起出现。 ## 插件 Agent -Plugin 可以携带自定义 Agent:在 manifest 的 `agents` 字段里声明一个或多个 `./` 目录(或直接在 plugin 根下放置 `agents/` 目录),其中的 Agent 文件与[自定义 Agent](./agents.md#自定义-agent) 格式相同,会在 plugin 启用期间作为子 Agent 被主 Agent 自动发现和委派。 +Plugin 可以携带自定义 Agent:在 manifest 的 `agents` 字段里声明一个或多个 `./` 目录(或直接在 plugin 根下放置 `agents/` 目录),其中的 Agent 文件与[自定义 Agent](./agents.md#自定义-agent) 格式相同,会在 plugin 启用期间作为 subagent 被 main agent 自动发现和委派。 ```text my-plugin/ diff --git a/docs/zh/customization/skills.md b/docs/zh/customization/skills.md index 8fd45fa1786..a6472210a1e 100644 --- a/docs/zh/customization/skills.md +++ b/docs/zh/customization/skills.md @@ -127,4 +127,4 @@ arguments: ## 下一步 - [Plugins](./plugins.md) — 把 Skills 打包成可安装单元,与团队共享 -- [Agent 与子 Agent](./agents.md) — Skills 如何影响子 Agent 的行为 +- [Agent 与 subagent](./agents.md) — Skills 如何影响 subagent 的行为 diff --git a/docs/zh/guides/use-cases.md b/docs/zh/guides/use-cases.md index bfd1a93bcac..9318b94fdee 100644 --- a/docs/zh/guides/use-cases.md +++ b/docs/zh/guides/use-cases.md @@ -24,7 +24,7 @@ src/runtime 下的 event loop 是怎么工作的?事件从哪里产生、又 这个项目里「权限审批」是怎么实现的?涉及哪些文件,关键类型是什么? ``` -大型调研可以让主 Agent 派发**子 Agent** 并行处理子任务,详见 [Agent 与子 Agent](../customization/agents.md)。 +大型调研可以让 main agent 派发**subagent** 并行处理子任务,详见 [Agent 与 subagent](../customization/agents.md)。 ## 实现新功能 @@ -143,6 +143,6 @@ src/api 下所有公开函数里,凡是没有 docstring 的都补上文档注 ## 下一步 -- [Agent 与子 Agent](../customization/agents.md) — 如何让 Agent 派发子任务并行处理 +- [Agent 与 subagent](../customization/agents.md) — 如何让 Agent 派发子任务并行处理 - [Hooks](../customization/hooks.md) — 在任务完成等节点触发本地脚本 - [内置工具](../reference/tools.md) — Agent 可调用的全部工具参考 diff --git a/docs/zh/reference/kimi-command.md b/docs/zh/reference/kimi-command.md index 48f5c80805e..345e74d10b8 100644 --- a/docs/zh/reference/kimi-command.md +++ b/docs/zh/reference/kimi-command.md @@ -24,7 +24,7 @@ kimi [options] | `--auto` | | 以 auto 权限模式启动;工具审批自动处理,Agent 不会向用户提问 | | `--plan` | | 以 Plan 模式启动新会话,AI 会优先使用只读工具进行探索和规划 | | `--skills-dir ` | | 从指定目录加载 Skills,替换自动发现的用户和项目目录。可重复传入 | -| `--agent ` | | 以指定 Agent 作为主 Agent 启动新会话。不能与 `--session`/`--continue` 同时使用 | +| `--agent ` | | 以指定 Agent 作为 main agent 启动新会话。不能与 `--session`/`--continue` 同时使用 | | `--agent-file ` | | 从 Markdown 文件加载自定义 Agent 并为新会话选中它。不可重复传入,也不能与 `--agent`、`--session` 或 `--continue` 同时使用 | | `--add-dir ` | | 为本次会话添加额外的工作目录。相对路径按当前工作目录解析。可重复传入 | @@ -105,7 +105,7 @@ kimi --agent reviewer kimi -p --agent reviewer "审查这个分支上的改动" ``` -`--agent-file` 以最高优先级注册单个 Agent 文件(仅本次启动)并选中它;该 flag 不可重复传入,`--agent` 与 `--agent-file` 互斥。两个 flag 都仅在新建会话时有效——都不能与 `--session`/`--continue` 组合,因为 Agent 在会话创建时绑定,恢复会话时会自动还原已绑定的 Agent。选择在会话首次绑定后即固定,之后不可切换;在 TUI 中,这些 flag 只绑定启动时的会话,之后在同一进程内新建的会话(例如通过 `/new`)使用默认 Agent。Agent 文件格式与发现目录详见 [Agent 与子 Agent](../customization/agents.md#自定义-agent)。 +`--agent-file` 以最高优先级注册单个 Agent 文件(仅本次启动)并选中它;该 flag 不可重复传入,`--agent` 与 `--agent-file` 互斥。两个 flag 都仅在新建会话时有效——都不能与 `--session`/`--continue` 组合,因为 Agent 在会话创建时绑定,恢复会话时会自动还原已绑定的 Agent。选择在会话首次绑定后即固定,之后不可切换;在 TUI 中,这些 flag 只绑定启动时的会话,之后在同一进程内新建的会话(例如通过 `/new`)使用默认 Agent。Agent 文件格式与发现目录详见 [Agent 与 subagent](../customization/agents.md#自定义-agent)。 ## 非交互执行 @@ -380,4 +380,4 @@ kimi provider catalog add anthropic --api-key sk-ant-... --default-model claude- - [斜杠命令](./slash-commands.md) — 交互式 TUI 内的控制命令速查 - [配置文件](../configuration/config-files.md) — `default_model`、权限模式等启动参数的持久化配置 - [Agent Skills](../customization/skills.md) — `--skills-dir` 加载的 Skill 文件格式 -- [Agent 与子 Agent](../customization/agents.md) — 内置子 Agent、自定义 Agent 文件与通过 `--agent` 选择主 Agent +- [Agent 与 subagent](../customization/agents.md) — 内置 subagent、自定义 Agent 文件与通过 `--agent` 选择 main agent diff --git a/docs/zh/reference/server-api.md b/docs/zh/reference/server-api.md index 80d7087937f..9ff6758e630 100644 --- a/docs/zh/reference/server-api.md +++ b/docs/zh/reference/server-api.md @@ -311,7 +311,7 @@ PTY 终端接口,仅 loopback 绑定时挂载。 | 流式文本 | `assistant.delta`、`thinking.delta`(带 `offset` 用于对齐) | | 工具调用 | `tool.call.started`、`tool.call.delta`、`tool.progress`、`tool.result` | | 交互 | `event.approval.requested` / `resolved`、`event.question.requested` / `answered` / `dismissed` | -| 子 Agent | `subagent.spawned` / `started` / `suspended` / `completed` / `failed` | +| subagent | `subagent.spawned` / `started` / `suspended` / `completed` / `failed` | | 后台 | `task.started` / `terminated`、`shell.started` / `output` / `completed` | | 其他 | `compaction.*`、`skill.activated`、`goal.updated`、`prompt.*`、`error`、`warning` | diff --git a/docs/zh/reference/slash-commands.md b/docs/zh/reference/slash-commands.md index c5a76ce2f16..ce981162369 100644 --- a/docs/zh/reference/slash-commands.md +++ b/docs/zh/reference/slash-commands.md @@ -16,7 +16,7 @@ | `/logout` | — | 清除当前所选账号的凭据 | 否 | | `/provider` | — | 打开交互式供应商管理器,查看、添加和删除已配置的供应商。详见[平台与模型 — `/provider` 与供应商管理](../configuration/providers.md#provider-—-交互式供应商管理) | 是 | | `/model` | — | 切换当前会话使用的 LLM 模型 | 是 | -| `/secondary-model` | `/subagent-model` | 选择子 Agent 的默认模型(写入 `[secondary_model] default_model`,详见[子 Agent 模型池](../configuration/config-files.md#子-agent-模型池))。在次主力模型实验功能启用时可见 | 是 | +| `/secondary-model` | `/subagent-model` | 选择 subagent 的默认模型(写入 `[secondary_model] default_model`,详见[subagent 模型池](../configuration/config-files.md#subagent-模型池))。在 subagent 模型池实验功能启用时可见 | 是 | | `/settings` | `/config` | 打开 TUI 内的设置面板 | 是 | | `/experiments` | `/experimental` | 打开实验功能面板 | 是 | | `/permission` | — | 选择权限模式 | 是 | @@ -100,7 +100,7 @@ Prompt 模式在目标完成时以退出码 `0` 退出,在目标阻塞时以 ` | 命令 | 别名 | 说明 | 随时可用 | | --- | --- | --- | --- | | `/help` | `/h`、`/?` | 显示快捷键和所有可用命令 | 是 | -| `/btw [问题]` | — | 在 fork 出的子 Agent 中打开旁路对话,不改变当前主 Agent 轮次;不带问题时会先打开面板等待输入 | 是 | +| `/btw [问题]` | — | 在 fork 出的 subagent 中打开旁路对话,不改变当前 main agent 轮次;不带问题时会先打开面板等待输入 | 是 | | `/usage` | — | 显示 token 用量、上下文占用以及配额信息 | 是 | | `/status` | — | 显示当前会话运行时状态:版本、模型、工作目录、权限模式等 | 是 | | `/mcp` | — | 列出当前会话中的 MCP server 及连接状态 | 是 | diff --git a/docs/zh/reference/tools.md b/docs/zh/reference/tools.md index 1c2c3fc53cf..83fbdb0948f 100644 --- a/docs/zh/reference/tools.md +++ b/docs/zh/reference/tools.md @@ -84,14 +84,14 @@ Plan 模式是一种受约束的工作状态:进入后 `Write` 与 `Edit` 只 | 工具 | 默认审批 | 说明 | | --- | --- | --- | -| `Agent` | 自动放行 | 派生子 Agent 执行子任务 | -| `AgentSwarm` | swarm mode 中自动放行,否则需审批 | 启动基于 item 的子 Agent,或恢复已有子 Agent | +| `Agent` | 自动放行 | 派生 subagent 执行子任务 | +| `AgentSwarm` | swarm mode 中自动放行,否则需审批 | 启动基于 item 的 subagent,或恢复已有 subagent | | `AskUserQuestion` | 自动放行 | 向用户提问以获取结构化输入 | | `Skill` | 自动放行 | 调用已注册的 inline Skill | -**`Agent`** 将子任务委托给子 Agent 执行。必填参数:`prompt`(完整任务描述)和 `description`(3–5 个词的简短说明)。可选参数:`subagent_type`(默认 `coder`)、`resume`(恢复已有 Agent 的 ID,与 `subagent_type` 互斥)、`run_in_background`(默认 false)和 `model`(仅在启用 [子 Agent 模型池](../configuration/config-files.md#子-agent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`:池中别名,或 `"primary"` 表示调用方自己运行的模型;resume 时无效)。未传入时子 Agent 绑定池的 `default_model`;未配置模型池时,子 Agent 一律继承调用方模型。以上是默认 v2 引擎的行为;在使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎上,`model` 改为在启用[次主力模型实验功能](../configuration/config-files.md#secondary-model)后可用,仅接受 `"secondary"` / `"primary"`——显式传入会覆盖 profile 的 [`model_preference`](../customization/agents.md#agent-文件格式),默认绑定已配置的次主力模型。Agent 任务默认 2 小时超时,可通过 `config.toml` 的 `[subagent] timeout_ms`(`0` = 无超时,或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时。前台模式下父 Agent 等待子 Agent 完成再继续;后台模式立即返回任务 ID,完成时通过合成 User 消息自动回到主 Agent。多个前台 `Agent` 调用在同一步运行时,TUI 会合并展示,并为每个子 Agent 显示运行、等待、完成或失败状态以及已耗时长。子 Agent 体系细节见 [Agent 与子 Agent](../customization/agents.md)。 +**`Agent`** 将子任务委托给 subagent 执行。必填参数:`prompt`(完整任务描述)和 `description`(3–5 个词的简短说明)。可选参数:`subagent_type`(默认 `coder`)、`resume`(恢复已有 Agent 的 ID,与 `subagent_type` 互斥)、`run_in_background`(默认 false)和 `model`(仅在启用 [subagent 模型池](../configuration/config-files.md#subagent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`:池中别名,或 `"primary"` 表示调用方自己运行的模型;resume 时无效)。未传入时 subagent 绑定池的 `default_model`;未配置模型池时,subagent 一律继承调用方模型。Agent 任务默认 2 小时超时,可通过 `config.toml` 的 `[subagent] timeout_ms`(`0` = 无超时,或 `KIMI_SUBAGENT_TIMEOUT_MS` 环境变量)配置,且在 print 模式(`kimi -p`)下默认无超时。前台模式下父 Agent 等待 subagent 完成再继续;后台模式立即返回任务 ID,完成时通过合成 User 消息自动回到 main agent。多个前台 `Agent` 调用在同一步运行时,TUI 会合并展示,并为每个 subagent 显示运行、等待、完成或失败状态以及已耗时长。subagent 体系细节见 [Agent 与 subagent](../customization/agents.md)。 -**`AgentSwarm`** 可以从共享的 `prompt_template` 和 `items` 数组启动子 Agent,也可以通过 `resume_agent_ids` 恢复已有子 Agent,或在一次调用中同时使用两者。模板必须包含 `{{item}}` 占位符;每个 item 会替换该占位符,并启动一个新的子 Agent。传入 `subagent_type` 可以指定整个 swarm 中所有新启动的子 Agent 使用的 profile;省略时默认使用 `coder`。传入 `model`(仅在启用 [子 Agent 模型池](../configuration/config-files.md#子-agent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`)可以让新启动的子 Agent 运行在池中别名指定的模型或调用方自己的模型(`"primary"`)上。未传入时新启动的子 Agent 绑定池的 `default_model`;未配置模型池时则继承调用方模型。在使用 `KIMI_CODE_LEGACY_FLAG=1` 选择的旧版 `agent-core` 引擎上,`model` 按[次主力模型实验功能](../configuration/config-files.md#secondary-model)工作(`"secondary"` / `"primary"`,默认绑定已配置的次主力模型)。恢复的子 Agent 保持其原有模型。不传 `resume_agent_ids` 时,本工具要求至少 2 个 item;传入 `resume_agent_ids` 时,可以恢复 1 个或多个已有子 Agent。本工具最多支持 128 个子 Agent,会等待全部子 Agent 完成,并返回聚合报告。在 TUI 中,前台 swarm 会在输入框上方显示实时 `Agent swarm` 进度面板。若一次模型响应调用 `AgentSwarm`,该调用必须是该响应中的唯一工具调用;如需运行多个 swarm,应先调用一个 `AgentSwarm` 并等待结果,再调用下一个,若单个模板可以覆盖这些工作,也可以合并为一个 swarm。在 `manual` 权限模式下,未处于 swarm mode 时调用 `AgentSwarm` 会触发审批,除非已有权限规则允许;swarm mode 已开启时,`AgentSwarm` 本身会自动放行。权限规则只能按工具名 `AgentSwarm` 匹配,不支持 `AgentSwarm(swarm)` 这类参数模式。默认情况下,本工具会逐步提升并发且不设上限(立即启动 5 个子 Agent,之后每 700 毫秒再启动 1 个);将 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 设为正整数可限制该阶段同时运行的子 Agent 数量,不设置则表示不限制。若设置为非正整数的值,本次 AgentSwarm 调用会立即失败。 +**`AgentSwarm`** 可以从共享的 `prompt_template` 和 `items` 数组启动 subagent,也可以通过 `resume_agent_ids` 恢复已有 subagent,或在一次调用中同时使用两者。模板必须包含 `{{item}}` 占位符;每个 item 会替换该占位符,并启动一个新的 subagent。传入 `subagent_type` 可以指定整个 swarm 中所有新启动的 subagent 使用的 profile;省略时默认使用 `coder`。传入 `model`(仅在启用 [subagent 模型池](../configuration/config-files.md#subagent-模型池) 实验功能并配置模型池后可用——`[secondary_model.models]` 表或仅一行 `default_model`)可以让新启动的 subagent 运行在池中别名指定的模型或调用方自己的模型(`"primary"`)上。未传入时新启动的 subagent 绑定池的 `default_model`;未配置模型池时则继承调用方模型。恢复的 subagent 保持其原有模型。不传 `resume_agent_ids` 时,本工具要求至少 2 个 item;传入 `resume_agent_ids` 时,可以恢复 1 个或多个已有 subagent。本工具最多支持 128 个 subagent,会等待全部 subagent 完成,并返回聚合报告。在 TUI 中,前台 swarm 会在输入框上方显示实时 `Agent swarm` 进度面板。若一次模型响应调用 `AgentSwarm`,该调用必须是该响应中的唯一工具调用;如需运行多个 swarm,应先调用一个 `AgentSwarm` 并等待结果,再调用下一个,若单个模板可以覆盖这些工作,也可以合并为一个 swarm。在 `manual` 权限模式下,未处于 swarm mode 时调用 `AgentSwarm` 会触发审批,除非已有权限规则允许;swarm mode 已开启时,`AgentSwarm` 本身会自动放行。权限规则只能按工具名 `AgentSwarm` 匹配,不支持 `AgentSwarm(swarm)` 这类参数模式。默认情况下,本工具会逐步提升并发且不设上限(立即启动 5 个 subagent,之后每 700 毫秒再启动 1 个);将 `KIMI_CODE_AGENT_SWARM_MAX_CONCURRENCY` 设为正整数可限制该阶段同时运行的 subagent 数量,不设置则表示不限制。若设置为非正整数的值,本次 AgentSwarm 调用会立即失败。 **`AskUserQuestion`** 以结构化多选题的形式向用户提问,适用于需要消歧或选择方案的场景。`questions` 参数接受 1–4 道题,每道题需提供 `question`(以 `?` 结尾)、`options`(2–4 个选项,每项含 `label` 和 `description`)以及可选的 `header`(最多 12 字符)和 `multi_select`(默认 false)。系统自动附加"其他"选项。`background` 为 true 时启动后台问题任务并立即返回任务 ID。宿主未实现交互式提问能力时返回失败提示,Agent 应改为在文本回复中直接提问。 @@ -133,6 +133,6 @@ Plan 模式是一种受约束的工作状态:进入后 `Write` 与 `Edit` 只 ## 下一步 -- [Agent 与子 Agent](../customization/agents.md) — `Agent` 工具的调度机制与上下文隔离 +- [Agent 与 subagent](../customization/agents.md) — `Agent` 工具的调度机制与上下文隔离 - [Hooks](../customization/hooks.md) — 在工具调用前后触发本地脚本 - [斜杠命令](./slash-commands.md) — TUI 内置控制命令速查 diff --git a/docs/zh/release-notes/changelog.md b/docs/zh/release-notes/changelog.md index badf20c80e6..ad4910a05db 100644 --- a/docs/zh/release-notes/changelog.md +++ b/docs/zh/release-notes/changelog.md @@ -27,7 +27,7 @@ outline: 2 "kimi-code/k3" = "擅长复杂推理与深度调试,难题选它。" ``` - 详见 [子 Agent 模型池文档](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#子-agent-模型池)。 + 详见 [子 Agent 模型池文档](https://moonshotai.github.io/kimi-code/zh/configuration/config-files.html#subagent-模型池)。 - 新增实验性全屏 TUI 模式,设置 `KIMI_CODE_TUI_FULL_SCREEN=1` 环境变量即可启用。 - TUI 支持渲染 LaTeX 数学公式(`$…$` 与 `$$…$$`),消息中的公式会显示为 Unicode 公式。 From 67e73f3e76acc995499ed34808f9a001689f0f1e Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 20:58:58 +0800 Subject: [PATCH 44/50] refactor(agent-core-v2): extract date change feature (#2895) Move date-change reminders behind the Feature lifecycle and make state registrations disposable so unloading removes the runtime seed. --- .../agent-core-v2/docs/state-manifest.d.ts | 14 +++--- .../src/_base/state/stateRegistry.ts | 16 +++++-- .../dateChange/dateChange.ts | 0 .../features/dateChange/dateChangeFeature.ts | 19 ++++++++ .../dateChange/dateChangeService.ts | 14 +----- .../dateChange}/disclosureBaseline.ts | 0 packages/agent-core-v2/src/index.ts | 5 +- .../test/_base/state/stateRegistry.test.ts | 46 +++++++++++++++++++ .../dateChange/dateChangeInjection.test.ts | 46 ++++++++++++++++++- 9 files changed, 135 insertions(+), 25 deletions(-) rename packages/agent-core-v2/src/{agent => features}/dateChange/dateChange.ts (100%) create mode 100644 packages/agent-core-v2/src/features/dateChange/dateChangeFeature.ts rename packages/agent-core-v2/src/{agent => features}/dateChange/dateChangeService.ts (92%) rename packages/agent-core-v2/src/{agent/contextInjector => features/dateChange}/disclosureBaseline.ts (100%) rename packages/agent-core-v2/test/{agent => features}/dateChange/dateChangeInjection.test.ts (86%) diff --git a/packages/agent-core-v2/docs/state-manifest.d.ts b/packages/agent-core-v2/docs/state-manifest.d.ts index b8def9ff8fd..c8924cd53cb 100644 --- a/packages/agent-core-v2/docs/state-manifest.d.ts +++ b/packages/agent-core-v2/docs/state-manifest.d.ts @@ -62,7 +62,7 @@ // agentsMdReminder.known src/agent/agentsMdReminder/agentsMdReminderService.ts // agentsMdReminder.seeded src/agent/agentsMdReminder/agentsMdReminderService.ts // contextProjector.lastRepairSignature src/agent/contextProjector/contextProjectorService.ts -// dateChange.seed src/agent/dateChange/dateChangeService.ts +// dateChange.seed src/features/dateChange/dateChangeService.ts // externalHooks.stopHookContinuationUsed src/agent/externalHooks/externalHooksService.ts // fullCompaction.activeTurnId src/agent/fullCompaction/fullCompactionService.ts // fullCompaction.compactionCountInTurn src/agent/fullCompaction/fullCompactionService.ts @@ -999,12 +999,6 @@ export interface AgentStateSnapshot { 'agentsMdReminder.seeded': boolean; // src/agent/contextProjector/contextProjectorService.ts 'contextProjector.lastRepairSignature': string | null; - // src/agent/dateChange/dateChangeService.ts - 'dateChange.seed': /* DateDisclosure — packages/agent-core-v2/src/agent/dateChange/dateChangeService.ts */ { - readonly localDate: string; - readonly timeZone: string; - readonly renderGeneration: number; - } | undefined; // src/agent/externalHooks/externalHooksService.ts 'externalHooks.stopHookContinuationUsed': boolean; // src/agent/fullCompaction/fullCompactionService.ts @@ -1192,6 +1186,12 @@ export interface AgentStateSnapshot { inputCacheCreation: number; } | undefined; 'usage.currentTurnId': number | undefined; + // src/features/dateChange/dateChangeService.ts + 'dateChange.seed': /* DateDisclosure — packages/agent-core-v2/src/features/dateChange/dateChangeService.ts */ { + readonly localDate: string; + readonly timeZone: string; + readonly renderGeneration: number; + } | undefined; // src/features/plan/injection/planModeInjection.ts 'plan.wasActive': boolean; } diff --git a/packages/agent-core-v2/src/_base/state/stateRegistry.ts b/packages/agent-core-v2/src/_base/state/stateRegistry.ts index 190e8f0b284..2801992dba7 100644 --- a/packages/agent-core-v2/src/_base/state/stateRegistry.ts +++ b/packages/agent-core-v2/src/_base/state/stateRegistry.ts @@ -30,7 +30,7 @@ * Persistence and replay are out of scope here. Scope-agnostic. */ -import { Disposable } from '../di/lifecycle'; +import { Disposable, type IDisposable, toDisposable } from '../di/lifecycle'; import { BugIndicatingError } from '../errors/errors'; import { Emitter, type Event } from '../event'; @@ -55,7 +55,7 @@ export interface StateInspection { } export interface IStateRegistry { - register(key: StateKey): void; + register(key: StateKey): IDisposable; has(key: StateKey): boolean; get(key: StateKey): T; set(key: StateKey, value: T): void; @@ -69,6 +69,7 @@ export interface IStateRegistry { // NOTE: stays Disposable — its own 'get' collides with the Fiber export class StateRegistry extends Disposable implements IStateRegistry { private readonly values = new Map(); + private readonly registrations = new Map(); private readonly keyEmitters = new Map>(); private readonly anyEmitter = this._register(new Emitter()); readonly onDidChangeAny: Event = this.anyEmitter.event; @@ -76,11 +77,20 @@ export class StateRegistry extends Disposable implements IStateRegistry { protected readonly inspectScope: string = 'unknown'; protected inspectParent?: IStateRegistry; - register(key: StateKey): void { + register(key: StateKey): IDisposable { if (this.values.has(key.name)) { throw new BugIndicatingError(`state key '${key.name}' is already registered`); } + const registration = {}; + this.registrations.set(key.name, registration); this.values.set(key.name, key.initial()); + return toDisposable(() => { + if (this.registrations.get(key.name) !== registration) return; + this.registrations.delete(key.name); + this.values.delete(key.name); + this.keyEmitters.get(key.name)?.dispose(); + this.keyEmitters.delete(key.name); + }); } has(key: StateKey): boolean { diff --git a/packages/agent-core-v2/src/agent/dateChange/dateChange.ts b/packages/agent-core-v2/src/features/dateChange/dateChange.ts similarity index 100% rename from packages/agent-core-v2/src/agent/dateChange/dateChange.ts rename to packages/agent-core-v2/src/features/dateChange/dateChange.ts diff --git a/packages/agent-core-v2/src/features/dateChange/dateChangeFeature.ts b/packages/agent-core-v2/src/features/dateChange/dateChangeFeature.ts new file mode 100644 index 00000000000..ea336a94723 --- /dev/null +++ b/packages/agent-core-v2/src/features/dateChange/dateChangeFeature.ts @@ -0,0 +1,19 @@ +import { ScopeActivation } from '#/_base/di/instantiation'; +import { Feature } from '#/features/feature'; +import { registerFeature } from '#/features/featureRegistry'; + +import { IAgentDateChangeService } from './dateChange'; +import { AgentDateChangeService } from './dateChangeService'; + +export class DateChangeFeature extends Feature { + static override readonly name = 'dateChange'; + + constructor() { + super(); + this.contributeAgentService(IAgentDateChangeService, AgentDateChangeService, { + activation: ScopeActivation.OnScopeCreated, + }); + } +} + +registerFeature(DateChangeFeature); diff --git a/packages/agent-core-v2/src/agent/dateChange/dateChangeService.ts b/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts similarity index 92% rename from packages/agent-core-v2/src/agent/dateChange/dateChangeService.ts rename to packages/agent-core-v2/src/features/dateChange/dateChangeService.ts index ac5e9a2cef4..f39b1734d93 100644 --- a/packages/agent-core-v2/src/agent/dateChange/dateChangeService.ts +++ b/packages/agent-core-v2/src/features/dateChange/dateChangeService.ts @@ -16,15 +16,13 @@ */ import { Disposable } from '#/_base/di/lifecycle'; -import { LifecycleScope } from '#/app/scopes'; -import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { defineState } from '#/_base/state/stateRegistry'; import { IAgentContextInjectorService, type ContextInjectionContext, type ContextInjectionResult, } from '#/agent/contextInjector/contextInjector'; -import { pickDisclosureBaseline } from '#/agent/contextInjector/disclosureBaseline'; +import { pickDisclosureBaseline } from './disclosureBaseline'; import { IAgentProfileService } from '#/agent/profile/profile'; import { IAgentStateService } from '#/agent/state/agentState'; import { IHostClock } from '#/os/interface/hostClock'; @@ -50,7 +48,7 @@ export class AgentDateChangeService extends Disposable implements IAgentDateChan @ISessionContext private readonly sessionContext: ISessionContext, ) { super(); - this.states.register(dateChangeSeedKey); + this._register(this.states.register(dateChangeSeedKey)); this._register( injector.register( DATE_CHANGE_INJECTION_VARIANT, @@ -135,11 +133,3 @@ function currentDateDisclosure(clock: IHostClock): Omit { expect(() => registry.register(countKey)).toThrow(BugIndicatingError); }); + it('removes the key and value when its registration is disposed', () => { + const registry = new StateRegistry(); + const registration = registry.register(countKey); + registry.set(countKey, 42); + + registration.dispose(); + + expect(registry.has(countKey)).toBe(false); + expect(registry.entries()).toEqual([]); + expect(() => registry.get(countKey)).toThrow(BugIndicatingError); + expect(() => registry.set(countKey, 1)).toThrow(BugIndicatingError); + }); + + it('re-registers with the initial value and ignores stale disposal', () => { + const registry = new StateRegistry(); + const first = registry.register(countKey); + registry.set(countKey, 42); + first.dispose(); + + const second = registry.register(countKey); + expect(registry.get(countKey)).toBe(0); + + first.dispose(); + expect(registry.has(countKey)).toBe(true); + second.dispose(); + expect(registry.has(countKey)).toBe(false); + }); + + it('isolates listeners between registrations', () => { + const registry = new StateRegistry(); + const first = registry.register(countKey); + const oldSeen: number[] = []; + registry.onDidChange(countKey)((value) => oldSeen.push(value)); + registry.set(countKey, 1); + first.dispose(); + + const second = registry.register(countKey); + const newSeen: number[] = []; + registry.onDidChange(countKey)((value) => newSeen.push(value)); + registry.set(countKey, 2); + + expect(oldSeen).toEqual([1]); + expect(newSeen).toEqual([2]); + second.dispose(); + }); + it('rejects get and set on an unregistered key', () => { const registry = new StateRegistry(); expect(() => registry.get(countKey)).toThrow(BugIndicatingError); diff --git a/packages/agent-core-v2/test/agent/dateChange/dateChangeInjection.test.ts b/packages/agent-core-v2/test/features/dateChange/dateChangeInjection.test.ts similarity index 86% rename from packages/agent-core-v2/test/agent/dateChange/dateChangeInjection.test.ts rename to packages/agent-core-v2/test/features/dateChange/dateChangeInjection.test.ts index ff52f3c7361..f9e06e8a7a0 100644 --- a/packages/agent-core-v2/test/agent/dateChange/dateChangeInjection.test.ts +++ b/packages/agent-core-v2/test/features/dateChange/dateChangeInjection.test.ts @@ -15,14 +15,20 @@ import { join } from 'pathe'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { FiberState } from '#/_base/di/fiber'; import { IAgentContextMemoryService } from '#/agent/contextMemory/contextMemory'; import type { ContextMessage } from '#/agent/contextMemory/types'; import { IAgentLoopService } from '#/agent/loop/loop'; import { IAgentProfileService } from '#/agent/profile/profile'; +import { IAgentStateService } from '#/agent/state/agentState'; import { DEFAULT_AGENT_PROFILE_NAME, type EnvironmentDisclosureSnapshot, } from '#/app/agentProfileCatalog/agentProfileCatalog'; +import { IFeatureManager } from '#/app/feature/featureManager'; +import { IAgentDateChangeService } from '#/features/dateChange/dateChange'; +import { DateChangeFeature } from '#/features/dateChange/dateChangeFeature'; +import { dateChangeSeedKey } from '#/features/dateChange/dateChangeService'; import { IHostClock } from '#/os/interface/hostClock'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; @@ -33,7 +39,7 @@ import { InMemoryWireRecordPersistence, type TestAgentContext, } from '../../harness'; -import { runWillBeginStepHooks } from '../loop/stubs'; +import { runWillBeginStepHooks } from '../../agent/loop/stubs'; const TEST_TIME_ZONE = 'Asia/Shanghai'; const INITIAL_INSTANT = '2026-07-29T04:00:00.000Z'; @@ -443,4 +449,42 @@ describe('AgentDateChangeService', () => { await runWillBeginStepHooks(loop); expect(dateReminders(context)).toHaveLength(0); }); + + it('withdraws and restores the eager service, provider, and seed with the Feature', async () => { + const manager = ctx.get(IFeatureManager); + const states = ctx.get(IAgentStateService); + updateSystemPromptWithoutDate(profile, ctx.get(ISessionContext).cwd); + + expect(manager.units().find((unit) => unit.name === 'dateChange')?.state).toBe( + FiberState.Active, + ); + expect(ctx.get(IAgentDateChangeService)).toBeDefined(); + expect(states.has(dateChangeSeedKey)).toBe(true); + await runWillBeginStepHooks(loop); + expect(states.get(dateChangeSeedKey)).toMatchObject({ localDate: '2026-07-29' }); + + await manager.unprovideUnit('dateChange'); + expect(() => ctx.get(IAgentDateChangeService)).toThrow(); + expect(states.has(dateChangeSeedKey)).toBe(false); + + clock.set('2026-07-30T04:00:00.000Z'); + await runWillBeginStepHooks(loop); + expect(dateReminders(context)).toHaveLength(0); + + manager.provideUnit(DateChangeFeature); + expect(ctx.get(IAgentDateChangeService)).toBeDefined(); + expect(states.has(dateChangeSeedKey)).toBe(true); + expect(states.get(dateChangeSeedKey)).toBeUndefined(); + + await runWillBeginStepHooks(loop); + expect(dateReminders(context)).toHaveLength(0); + expect(states.get(dateChangeSeedKey)).toMatchObject({ localDate: '2026-07-30' }); + + clock.set('2026-07-31T04:00:00.000Z'); + await runWillBeginStepHooks(loop); + expect(dateReminders(context)).toHaveLength(1); + expect(messageText(dateReminders(context)[0] as ContextMessage)).toContain( + "Today's date is now 2026-07-31", + ); + }); }); From 0473b3aac1af51c133f2ee1a0f2735d23363df09 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 21:00:56 +0800 Subject: [PATCH 45/50] test(minidb): deflake the evict-lru compaction-churn guard (#2892) The stress test asserted stats.compactions > 0 immediately after the write loop, but auto-compaction is fire-and-forget through the maintenance scheduler and the counter only increments once a run fully completes. On a loaded CI runner the loop can finish before the first compaction lands, failing the guard even though nothing is broken. Wait for the first completed compaction with the existing waitFor helper instead: the guard still proves the churn this scenario requires happened, and a genuinely broken auto-trigger now fails via the wait timeout. --- packages/minidb/test/e2e/stress.test.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/minidb/test/e2e/stress.test.ts b/packages/minidb/test/e2e/stress.test.ts index e9c4c05ff56..aad7f8d98b1 100644 --- a/packages/minidb/test/e2e/stress.test.ts +++ b/packages/minidb/test/e2e/stress.test.ts @@ -22,6 +22,7 @@ import { MiniDb } from '../../src/index.js'; import { startServer } from '../../src/server.js'; import { tmpDir, rmrf } from './helpers/tmp.js'; import { mulberry32 } from './helpers/prng.js'; +import { waitFor } from '../helpers.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -570,7 +571,11 @@ test( await db.set(`ek${i}`, { i, pad: 'e'.repeat(1100) }); if (i % 7 === 0) db.get(`ek${Math.max(0, i - 3)}`); } - expect(db.stats.compactions).toBeGreaterThan(0); + // Auto-compaction is fire-and-forget through the maintenance scheduler, + // so the write loop finishing does not imply a run has completed yet — + // wait for the churn this scenario requires instead of assuming the + // loop outlasted it (flakes on loaded CI runners). + await waitFor(() => db.stats.compactions > 0, 'auto compaction under churn'); expect(db.store.bytes).toBeLessThanOrEqual(Math.ceil(budget * 1.05)); expect(db.stats.evictions).toBeGreaterThan(0); } catch (err) { From 5857ba23b0decf1865d846262f4d9c8811decb18 Mon Sep 17 00:00:00 2001 From: 7Sageer Date: Thu, 13 Aug 2026 21:02:34 +0800 Subject: [PATCH 46/50] test(kap-server): deflake three timing-sensitive tests (#2894) * test(kap-server): poll the read-model immediate-read assertions The 'prepares the read model at boot and serves immediate reads' test sampled the session list / workspace session_count / paged read exactly once after creating a session. While a mirror flush is in flight its batch is only per-shard atomic and the pending-queue cleanup is not linearized with reads, so a single-sample read landing inside that window can transiently miss or double-count the new session (seen twice on main CI as 'expected false to be true' and 'expected 0 to be 1'). Poll with vi.waitFor instead; the transient lasts at most one in-flight flush (~100ms cadence). * test(kap-server): retry the transcript test temp-dir teardown rm The engine's file log writers flush synchronously on scope dispose but their trailing async close can still create a file under the test home after server.close() resolves, so the afterEach rm occasionally fails with ENOTEMPTY on a loaded CI runner. Retry the rm (maxRetries: 5), matching the existing pattern in questions.test.ts / fs.test.ts. * test(kap-server): drain the in-flight search sync before appending The 'serves the published generation without waiting for a blocked background sync' test appended the delta right after a warm-up search that had kicked a fire-and-forget background sync pass. On a starved CI worker thread that pass can read the file after the append and publish both documents early ('expected 2 to be 1'). settleSync before the append makes 'no pass can index the delta' structural. --- .../test/search/searchService.test.ts | 4 +++ packages/kap-server/test/sessions.test.ts | 34 +++++++++++++------ packages/kap-server/test/transcript.test.ts | 6 +++- 3 files changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/kap-server/test/search/searchService.test.ts b/packages/kap-server/test/search/searchService.test.ts index 8b1f90bc940..15c7c1b5290 100644 --- a/packages/kap-server/test/search/searchService.test.ts +++ b/packages/kap-server/test/search/searchService.test.ts @@ -1191,6 +1191,10 @@ describe('GlobalSearchService', () => { const service = track(makeService(home!, index)); await service.reindex(); expect((await service.search({ query: '苹果' })).items.length).toBe(1); + // The search above kicked a fire-and-forget background pass whose + // session enumeration already ran with block=false: drain it before the + // append, or a CI-slow pass reads the delta below and publishes it early. + await settleSync(service); // New bytes arrive, then the next background pass is blocked inside the // session enumeration. The search must return promptly with the OLD diff --git a/packages/kap-server/test/sessions.test.ts b/packages/kap-server/test/sessions.test.ts index 56d39545ab7..0df2ba71109 100644 --- a/packages/kap-server/test/sessions.test.ts +++ b/packages/kap-server/test/sessions.test.ts @@ -1595,24 +1595,38 @@ describe('server-v2 /api/v1/sessions (minidb read model)', () => { expect(status.body.code).toBe(0); expect(status.body.data.state).toBe('ready'); - // A freshly created session lists, counts, and pages immediately — the - // mutation path never waited for the read model, the read path folds the - // mirror queue back in. + // A freshly created session lists, counts, and pages without waiting for + // the read model — the mutation path never awaited the read model, the + // read path folds the mirror queue back in. That fold is best-effort + // while a mirror flush is in flight: the flush's batch is only per-shard + // atomic and its pending-queue cleanup is not linearized with reads, so a + // read landing exactly inside that window can transiently miss (or + // double-count) the session — poll instead of sampling once. const created = await postJson('/api/v1/sessions', { metadata: { cwd: home as string }, }); const id = created.body.data.id; - const listed = await getJson('/api/v1/sessions'); - expect(listed.body.data.items.some((s) => s.id === id)).toBe(true); + await vi.waitFor( + async () => { + const listed = await getJson('/api/v1/sessions'); + expect(listed.body.data.items.some((s) => s.id === id)).toBe(true); - const workspaces = await getJson<{ items: { session_count: number }[] }>('/api/v1/workspaces'); - expect(workspaces.body.data.items[0]?.session_count).toBe(1); + const workspaces = await getJson<{ items: { session_count: number }[] }>( + '/api/v1/workspaces', + ); + expect(workspaces.body.data.items[0]?.session_count).toBe(1); - const paged = await getJson(`/api/v1/sessions?page_size=1&before_id=${id}`); - expect(paged.body.data.items).toEqual([]); - expect(paged.body.data.has_more).toBe(false); + const paged = await getJson(`/api/v1/sessions?page_size=1&before_id=${id}`); + expect(paged.body.data.items).toEqual([]); + expect(paged.body.data.has_more).toBe(false); + }, + { timeout: 10_000 }, + ); + // Archiving drains the mirror queue before responding, and the restart's + // boot prepare re-projects (or reuses) a fully settled generation — both + // of these reads are deterministic again. await postJson<{ archived: boolean }>(`/api/v1/sessions/${id}:archive`); const archivedOnly = await getJson('/api/v1/sessions?archived_only=true'); expect(archivedOnly.body.data.items.map((s) => s.id)).toEqual([id]); diff --git a/packages/kap-server/test/transcript.test.ts b/packages/kap-server/test/transcript.test.ts index 2cec22368dc..e0041f2d189 100644 --- a/packages/kap-server/test/transcript.test.ts +++ b/packages/kap-server/test/transcript.test.ts @@ -175,7 +175,11 @@ describe('server-v2 /api/v1/sessions/{sid}/transcript', () => { server = undefined; } if (home !== undefined) { - await rm(home, { recursive: true, force: true }); + // maxRetries: the engine's file log writers flush synchronously on scope + // dispose but their trailing async close can still be creating a file + // under home after server.close() resolves (ENOTEMPTY on a loaded CI + // runner) — same retry pattern as questions.test.ts / fs.test.ts. + await rm(home, { recursive: true, force: true, maxRetries: 5, retryDelay: 50 }); home = undefined; } }); From 1414d4602898f406e540b23342cb18db23ff9efc Mon Sep 17 00:00:00 2001 From: Haozhe Date: Thu, 13 Aug 2026 21:03:51 +0800 Subject: [PATCH 47/50] refactor(agent-core-v2): fold session lifecycle hooks into sessionLifecycle events (#2896) --- packages/agent-core-v2/src/index.ts | 1 - .../externalHooks/externalHooksService.ts | 26 ++++---- .../sessionLifecycleHooks.ts | 36 ----------- .../sessionLifecycle/sessionLifecycle.ts | 13 ++-- .../sessionLifecycleService.ts | 36 +++++------ .../externalHooksRunner/integration.test.ts | 61 +++++++++++-------- .../test/app/gateway/gateway.test.ts | 1 + .../app/sessionExport/sessionExport.test.ts | 1 + packages/agent-core-v2/test/harness/agent.ts | 21 +++---- .../sessionLifecycle/sessionLifecycle.test.ts | 15 ++--- .../node-sdk/test/sdk-rpc-client-v2.test.ts | 13 ++-- 11 files changed, 91 insertions(+), 133 deletions(-) delete mode 100644 packages/agent-core-v2/src/session/sessionLifecycleHooks/sessionLifecycleHooks.ts diff --git a/packages/agent-core-v2/src/index.ts b/packages/agent-core-v2/src/index.ts index cfa9e2dbf53..942cc1f832f 100644 --- a/packages/agent-core-v2/src/index.ts +++ b/packages/agent-core-v2/src/index.ts @@ -416,7 +416,6 @@ export * from '#/workspace/workspaceContext/workspaceContext'; export * from '#/workspace/sessionLifecycle/sessionLifecycle'; export * from '#/workspace/sessionLifecycle/sessionLifecycleService'; export * from '#/workspace/sessionLifecycle/internal/addressing'; -export * from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; export * from '#/session/externalHooks/externalHooks'; export * from '#/session/externalHooks/externalHooksService'; import '#/app/sessionExport/errors'; diff --git a/packages/agent-core-v2/src/session/externalHooks/externalHooksService.ts b/packages/agent-core-v2/src/session/externalHooks/externalHooksService.ts index cd82ec7a672..c27fb375b4d 100644 --- a/packages/agent-core-v2/src/session/externalHooks/externalHooksService.ts +++ b/packages/agent-core-v2/src/session/externalHooks/externalHooksService.ts @@ -28,24 +28,22 @@ import { LifecycleScope } from '#/app/scopes'; import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; import { IntervalTimer } from '#/_base/utils/timer'; import { IExternalHooksRunnerService } from '#/app/externalHooksRunner/externalHooksRunner'; -import type { Hooks } from '#/hooks'; import { IModelService } from '#/kosong/model/model'; import { ISessionAgentProfileCatalog, } from '#/session/sessionAgentProfileCatalog/sessionAgentProfileCatalog'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; -import { - ISessionLifecycleHooks, - type SessionCloseReason, - type SessionCreateSource, - type SessionLifecycleHookSlots, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; import { ISessionMetadata } from '#/session/sessionMetadata/sessionMetadata'; import { type AgentTaskStartHookContext, type AgentTaskStopHookContext, ISessionSubagentService, } from '#/session/subagent/subagent'; +import { + ISessionLifecycleService, + type SessionCloseReason, + type SessionCreateSource, +} from '#/workspace/sessionLifecycle/sessionLifecycle'; import { ISessionExternalHooksService } from './externalHooks'; @@ -64,7 +62,7 @@ export class SessionExternalHooksService constructor( @ISessionContext private readonly context: ISessionContext, - @ISessionLifecycleHooks lifecycleHooks: Hooks, + @ISessionLifecycleService lifecycle: ISessionLifecycleService, @ISessionSubagentService subagents: ISessionSubagentService, @ISessionMetadata private readonly metadata: ISessionMetadata, @ISessionAgentProfileCatalog private readonly profiles: ISessionAgentProfileCatalog, @@ -90,17 +88,17 @@ export class SessionExternalHooksService }), ); this._register( - lifecycleHooks.onDidCreateSession.register('externalHooks', async (event, next) => { + lifecycle.onDidCreateSession((event) => { + if (event.sessionId !== this.context.sessionId) return; if (event.source !== 'fork') { - await this.triggerSessionStart(event.source); + event.waitUntil(this.triggerSessionStart(event.source)); } - await next(); }), ); this._register( - lifecycleHooks.onWillCloseSession.register('externalHooks', async (event, next) => { - await this.triggerSessionEnd(event.reason); - await next(); + lifecycle.onWillCloseSession((event) => { + if (event.sessionId !== this.context.sessionId) return; + event.waitUntil(this.triggerSessionEnd(event.reason)); }), ); this._register( diff --git a/packages/agent-core-v2/src/session/sessionLifecycleHooks/sessionLifecycleHooks.ts b/packages/agent-core-v2/src/session/sessionLifecycleHooks/sessionLifecycleHooks.ts deleted file mode 100644 index dabb8a0cf49..00000000000 --- a/packages/agent-core-v2/src/session/sessionLifecycleHooks/sessionLifecycleHooks.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * `sessionLifecycleHooks` domain — per-session lifecycle hook slots. - * - * Defines the `ISessionLifecycleHooks` seed: one ordered hook-slots instance - * per session, with slots around the session's create (`onDidCreateSession`) - * and close (`onWillCloseSession`). Also owns the shared - * `SessionCreateSource` / `SessionCloseReason` vocabulary. - */ - -import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; -import type { ScopeSeed } from '#/_base/di/scope'; -import type { Hooks } from '#/hooks'; - -export type SessionCreateSource = 'startup' | 'resume' | 'fork'; - -export type SessionCloseReason = 'exit' | 'archive'; - -export interface SessionStartHookEvent { - readonly source: SessionCreateSource; -} - -export interface SessionEndHookEvent { - readonly reason: SessionCloseReason; -} - -export type SessionLifecycleHookSlots = { - readonly onDidCreateSession: SessionStartHookEvent; - readonly onWillCloseSession: SessionEndHookEvent; -}; - -export const ISessionLifecycleHooks: ServiceIdentifier> = - createDecorator>('sessionLifecycleHooks'); - -export function sessionLifecycleHooksSeed(hooks: Hooks): ScopeSeed { - return [[ISessionLifecycleHooks as ServiceIdentifier, hooks]]; -} diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts index 6808b46786d..d3a332d9035 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycle.ts @@ -24,15 +24,13 @@ import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; import type { ISessionScopeHandle } from '#/_base/di/scope'; -import type { Event } from '#/_base/event'; +import { type Event, type IWaitUntil } from '#/_base/event'; import type { BindAgentInput } from '#/agent/profile/profile'; import type { McpServerConfig } from '#/mcpCore/config-schema'; -import type { - SessionCloseReason, - SessionCreateSource, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; -export type { SessionCloseReason, SessionCreateSource }; +export type SessionCreateSource = 'startup' | 'resume' | 'fork'; + +export type SessionCloseReason = 'exit' | 'archive'; export interface CreateSessionOptions { readonly sessionId?: string; @@ -124,7 +122,8 @@ export interface ISessionLifecycleService { readonly _serviceBrand: undefined; readonly onWillCreateSession: Event; - readonly onDidCreateSession: Event; + readonly onDidCreateSession: Event; + readonly onWillCloseSession: Event; readonly onDidCloseSession: Event; readonly onDidArchiveSession: Event; readonly onDidForkSession: Event; diff --git a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts index 22493e986c6..604e17807ea 100644 --- a/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts +++ b/packages/agent-core-v2/src/workspace/sessionLifecycle/sessionLifecycleService.ts @@ -101,7 +101,7 @@ import { registerScopedService, } from '#/_base/di/scope'; import { unwrapErrorCause } from '#/_base/errors/errors'; -import { Emitter, type Event } from '#/_base/event'; +import { AsyncEmitter, Emitter, type Event, type IWaitUntil } from '#/_base/event'; import { DEFAULT_PLAN_MODE_SECTION } from '#/features/plan/configSection'; import { IAgentPlanService } from '#/features/plan/plan'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; @@ -118,7 +118,6 @@ import { } from '#/app/sessionIndex/sessionIndex'; import { ITelemetryService } from '#/app/telemetry/telemetry'; import { ErrorCodes, Error2, isError2 } from '#/errors'; -import { createHooks } from '#/hooks'; import { IHostEnvironment } from '#/os/interface/hostEnvironment'; import { IHostFileSystem, type HostDirEntry } from '#/os/interface/hostFileSystem'; import { IAppendLogStore } from '#/persistence/interface/appendLogStore'; @@ -130,11 +129,6 @@ import { ISessionContext, sessionContextSeed } from '#/session/sessionContext/se import { sessionEphemeralMcpServersSeed } from '#/session/mcp/ephemeralMcpServers'; import { sessionAgentProfileCatalogSeed } from '#/session/sessionAgentProfileCatalog/agentProfileCatalogSeed'; import { installSessionSeedAdapters } from '#/session/sessionSeed/sessionSeedAdapters'; -import { - ISessionLifecycleHooks, - sessionLifecycleHooksSeed, - type SessionLifecycleHookSlots, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; import { ISessionMetadata, type SessionMeta } from '#/session/sessionMetadata/sessionMetadata'; import { drainSessionMetadataWrites, toEpochMs } from '#/session/sessionMetadata/sessionMetadataService'; import { ISessionProcessRunner } from '#/session/process/processRunner'; @@ -183,6 +177,8 @@ type MaterializeSessionOptions = Omit & { readonly sessionId: string; }; +const NO_ABORT = new AbortController().signal; + // NOTE: stays Disposable — its own 'get' and 'config' collide with the Fiber export class SessionLifecycleService extends Disposable implements ISessionLifecycleService { declare readonly _serviceBrand: undefined; @@ -192,8 +188,16 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec ); readonly onWillCreateSession: Event = this._onWillCreateSession.event; - private readonly _onDidCreateSession = this._register(new Emitter()); - readonly onDidCreateSession: Event = this._onDidCreateSession.event; + private readonly _onDidCreateSession = this._register( + new AsyncEmitter(), + ); + readonly onDidCreateSession: Event = + this._onDidCreateSession.event; + private readonly _onWillCloseSession = this._register( + new AsyncEmitter(), + ); + readonly onWillCloseSession: Event = + this._onWillCloseSession.event; private readonly _onDidCloseSession = this._register(new Emitter()); readonly onDidCloseSession: Event = this._onDidCloseSession.event; private readonly _onDidArchiveSession = this._register(new Emitter()); @@ -295,10 +299,6 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec scope: (subKey?: string): string => subKey === undefined || subKey === '' ? sessionScope : `${sessionScope}/${subKey}`, }; - const hooks = createHooks([ - 'onDidCreateSession', - 'onWillCloseSession', - ]); await this.hostEnv.ready; const handle = createScopedChildHandle( this.instantiation, @@ -307,7 +307,6 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec { seeds: [ ...sessionContextSeed(ctx), - ...sessionLifecycleHooksSeed(hooks), [ITelemetryService, this.telemetry.withContext({ sessionId: opts.sessionId })], ...sessionAgentProfileCatalogSeed({ _serviceBrand: undefined, @@ -364,10 +363,7 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec } private async announceCreated(event: SessionCreatedEvent): Promise { - await event.handle.accessor - .get(ISessionLifecycleHooks) - .onDidCreateSession.run({ source: event.source }); - this._onDidCreateSession.fire(event); + await this._onDidCreateSession.fireAsync(event, NO_ABORT); event.handle.accessor .get(ITelemetryService) .track2('session_started', { resumed: event.source === 'resume' }); @@ -491,9 +487,7 @@ export class SessionLifecycleService extends Disposable implements ISessionLifec } private async announceWillClose(event: SessionWillCloseEvent): Promise { - await event.handle.accessor - .get(ISessionLifecycleHooks) - .onWillCloseSession.run({ reason: event.reason }); + await this._onWillCloseSession.fireAsync(event, NO_ABORT); } private async drainAgents(handle: ISessionScopeHandle): Promise { diff --git a/packages/agent-core-v2/test/app/externalHooksRunner/integration.test.ts b/packages/agent-core-v2/test/app/externalHooksRunner/integration.test.ts index 934f2113450..468974256be 100644 --- a/packages/agent-core-v2/test/app/externalHooksRunner/integration.test.ts +++ b/packages/agent-core-v2/test/app/externalHooksRunner/integration.test.ts @@ -11,7 +11,7 @@ import { createServices, type TestInstantiationService, } from '#/_base/di/test'; -import { Emitter, Event } from '#/_base/event'; +import { AsyncEmitter, Emitter, Event, type IWaitUntil } from '#/_base/event'; import { emptyUsage } from '#/kosong/contract/usage'; import { buildContextCompactionShape } from '#/agent/contextMemory/compactionHandoff'; import { @@ -47,10 +47,13 @@ import { IPluginService } from '#/app/plugin/plugin'; import { IHostProcessService } from '#/os/interface/hostProcess'; import { HostProcessService } from '#/os/backends/node-local/hostProcessService'; import { - ISessionLifecycleHooks, - type SessionLifecycleHookSlots, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; -import { createHooks, type Hooks } from '#/hooks'; + ISessionLifecycleService, + type SessionCloseReason, + type SessionCreatedEvent, + type SessionCreateSource, + type SessionWillCloseEvent, +} from '#/workspace/sessionLifecycle/sessionLifecycle'; +import { createHooks } from '#/hooks'; import { ISessionContext } from '#/session/sessionContext/sessionContext'; import { type AgentTaskHooks, @@ -229,11 +232,21 @@ function stubSessionContext(): ISessionContext { }; } -function stubSessionLifecycleHooks(): Hooks { - return createHooks([ - 'onDidCreateSession', - 'onWillCloseSession', - ]); +function stubSessionLifecycle() { + const didCreate = new AsyncEmitter(); + const willClose = new AsyncEmitter(); + const noAbort = new AbortController().signal; + const handle = {} as ISessionScopeHandle; + return { + service: { + onDidCreateSession: didCreate.event, + onWillCloseSession: willClose.event, + }, + fireDidCreate: (source: SessionCreateSource): Promise => + didCreate.fireAsync({ sessionId: 'session-1', handle, source }, noAbort), + fireWillClose: (reason: SessionCloseReason): Promise => + willClose.fireAsync({ sessionId: 'session-1', handle, reason }, noAbort), + }; } describe('IExternalHooksRunnerService integration', () => { @@ -539,7 +552,7 @@ describe('IExternalHooksRunnerService integration', () => { ? 'sessions/workspace-1/session-1' : `sessions/workspace-1/session-1/${subKey}`, }); - reg.defineInstance(ISessionLifecycleHooks, stubSessionLifecycleHooks()); + reg.definePartialInstance(ISessionLifecycleService, stubSessionLifecycle().service); reg.defineInstance(ISessionMetadata, stubSessionMetadata()); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog()); reg.defineInstance(IModelService, stubModelService()); @@ -856,7 +869,7 @@ describe('IExternalHooksRunnerService integration', () => { const disposables = new DisposableStore(); let ix: TestInstantiationService | undefined; try { - const lifecycleHooks = stubSessionLifecycleHooks(); + const lifecycle = stubSessionLifecycle(); const path = hookLogPath(); const command = appendHookLogCommand(path); const cwd = mkdtempSync(join(tmpdir(), 'session-external-hooks-cwd-')); @@ -877,7 +890,7 @@ describe('IExternalHooksRunnerService integration', () => { ? 'sessions/workspace-1/session-1' : `sessions/workspace-1/session-1/${subKey}`, }); - reg.defineInstance(ISessionLifecycleHooks, lifecycleHooks); + reg.definePartialInstance(ISessionLifecycleService, lifecycle.service); reg.defineInstance(ISessionMetadata, stubSessionMetadata()); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog()); reg.defineInstance(IModelService, stubModelService()); @@ -907,11 +920,11 @@ describe('IExternalHooksRunnerService integration', () => { ix.set(ISessionExternalHooksService, new SyncDescriptor(SessionExternalHooksService)); ix.get(ISessionExternalHooksService); - await lifecycleHooks.onDidCreateSession.run({ source: 'startup' }); - await lifecycleHooks.onDidCreateSession.run({ source: 'resume' }); - await lifecycleHooks.onDidCreateSession.run({ source: 'fork' }); - await lifecycleHooks.onWillCloseSession.run({ reason: 'exit' }); - await lifecycleHooks.onWillCloseSession.run({ reason: 'archive' }); + await lifecycle.fireDidCreate('startup'); + await lifecycle.fireDidCreate('resume'); + await lifecycle.fireDidCreate('fork'); + await lifecycle.fireWillClose('exit'); + await lifecycle.fireWillClose('archive'); expect(readHookLog(path)).toEqual([ { @@ -1053,7 +1066,7 @@ describe('IExternalHooksRunnerService integration', () => { const disposables = new DisposableStore(); let ix: TestInstantiationService | undefined; try { - const lifecycleHooks = stubSessionLifecycleHooks(); + const lifecycle = stubSessionLifecycle(); const path = hookLogPath(); const command = stdinScript([ 'const fs = require("node:fs");', @@ -1074,7 +1087,7 @@ describe('IExternalHooksRunnerService integration', () => { additionalServices: (reg) => { registerStateServices(reg); reg.defineInstance(ISessionContext, stubSessionContext()); - reg.defineInstance(ISessionLifecycleHooks, lifecycleHooks); + reg.definePartialInstance(ISessionLifecycleService, lifecycle.service); reg.defineInstance(ISessionMetadata, stubSessionMetadata('My Session')); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog('coder')); reg.defineInstance(IModelService, stubModelService('kimi-k2')); @@ -1102,7 +1115,7 @@ describe('IExternalHooksRunnerService integration', () => { ix.get(ISessionExternalHooksService); await flushMicrotasks(); - await lifecycleHooks.onDidCreateSession.run({ source: 'startup' }); + await lifecycle.fireDidCreate('startup'); expect(readHookLog(path)).toEqual([ { @@ -1261,7 +1274,7 @@ describe('IExternalHooksRunnerService integration', () => { additionalServices: (reg) => { registerStateServices(reg); reg.defineInstance(ISessionContext, stubSessionContext()); - reg.defineInstance(ISessionLifecycleHooks, stubSessionLifecycleHooks()); + reg.definePartialInstance(ISessionLifecycleService, stubSessionLifecycle().service); reg.defineInstance(ISessionMetadata, stubSessionMetadata()); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog()); reg.defineInstance(IModelService, stubModelService()); @@ -1306,7 +1319,7 @@ describe('IExternalHooksRunnerService integration', () => { additionalServices: (reg) => { registerStateServices(reg); reg.defineInstance(ISessionContext, stubSessionContext()); - reg.defineInstance(ISessionLifecycleHooks, stubSessionLifecycleHooks()); + reg.definePartialInstance(ISessionLifecycleService, stubSessionLifecycle().service); reg.defineInstance(ISessionMetadata, stubSessionMetadata()); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog()); reg.defineInstance(IModelService, stubModelService()); @@ -1353,7 +1366,7 @@ describe('IExternalHooksRunnerService integration', () => { additionalServices: (reg) => { registerStateServices(reg); reg.defineInstance(ISessionContext, stubSessionContext()); - reg.defineInstance(ISessionLifecycleHooks, stubSessionLifecycleHooks()); + reg.definePartialInstance(ISessionLifecycleService, stubSessionLifecycle().service); reg.defineInstance(ISessionMetadata, stubSessionMetadata()); reg.defineInstance(ISessionAgentProfileCatalog, stubProfileCatalog()); reg.defineInstance(IModelService, stubModelService()); diff --git a/packages/agent-core-v2/test/app/gateway/gateway.test.ts b/packages/agent-core-v2/test/app/gateway/gateway.test.ts index 606fb18352e..b7471987016 100644 --- a/packages/agent-core-v2/test/app/gateway/gateway.test.ts +++ b/packages/agent-core-v2/test/app/gateway/gateway.test.ts @@ -95,6 +95,7 @@ describe('RestGateway', () => { _serviceBrand: undefined, onWillCreateSession: () => ({ dispose: () => {} }), onDidCreateSession: () => ({ dispose: () => {} }), + onWillCloseSession: () => ({ dispose: () => {} }), onDidCloseSession: () => ({ dispose: () => {} }), onDidArchiveSession: () => ({ dispose: () => {} }), onDidForkSession: () => ({ dispose: () => {} }), diff --git a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts index 64877659093..543c5c5bba5 100644 --- a/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts +++ b/packages/agent-core-v2/test/app/sessionExport/sessionExport.test.ts @@ -918,6 +918,7 @@ function registerSessionExportServices( _serviceBrand: undefined, onWillCreateSession: noopEvent, onDidCreateSession: noopEvent, + onWillCloseSession: noopEvent, onDidCloseSession: noopEvent, onDidArchiveSession: noopEvent, onDidForkSession: noopEvent, diff --git a/packages/agent-core-v2/test/harness/agent.ts b/packages/agent-core-v2/test/harness/agent.ts index c75f46ffe04..4b092f3e4b6 100644 --- a/packages/agent-core-v2/test/harness/agent.ts +++ b/packages/agent-core-v2/test/harness/agent.ts @@ -9,7 +9,7 @@ import { toDisposable } from '#/_base/di/lifecycle'; import type { IInstantiationService } from '#/_base/di/instantiation'; import type { IAgentScopeHandle } from '#/_base/di/scope'; import { IFeatureManager } from '#/app/feature/featureManager'; -import { Emitter, Event } from '#/_base/event'; +import { Emitter, Event, type IWaitUntil } from '#/_base/event'; import { IAgentLifecycleService } from '#/session/agentLifecycle/agentLifecycle'; import type { Promisable, PromisifyMethods } from '#/_base/utils/types'; import type { AgentTaskInfo } from '#/agent/task/task'; @@ -172,11 +172,11 @@ import { type ScopeSeed, type ServiceIdentifier, } from '#/index'; -import { createHooks } from '#/hooks'; import { - ISessionLifecycleHooks, - type SessionLifecycleHookSlots, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; + ISessionLifecycleService, + type SessionCreatedEvent, + type SessionWillCloseEvent, +} from '#/workspace/sessionLifecycle/sessionLifecycle'; import { IEventBus } from '#/app/event/eventBus'; import { IWireService } from '#/wire/wire'; import { WireService } from '#/wire/wireService'; @@ -1209,13 +1209,10 @@ export class AgentTestContext { scope: (subKey?: string): string => subKey === undefined || subKey === '' ? sessionScope : `${sessionScope}/${subKey}`, }); - reg.defineInstance( - ISessionLifecycleHooks, - createHooks([ - 'onDidCreateSession', - 'onWillCloseSession', - ]), - ); + reg.definePartialInstance(ISessionLifecycleService, { + onDidCreateSession: Event.None as Event, + onWillCloseSession: Event.None as Event, + }); reg.defineInstance(ISessionInteractionService, this.createInteractionService()); reg.defineInstance(ISessionApprovalService, this.createApprovalService()); reg.defineInstance(ISessionQuestionService, this.createQuestionService()); diff --git a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts index 86bb82bdc5d..17f0173118f 100644 --- a/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts +++ b/packages/agent-core-v2/test/workspace/sessionLifecycle/sessionLifecycle.test.ts @@ -15,7 +15,6 @@ import { import { type ScopedTestHost, createScopedTestHost, stubPair } from '#/_base/di/test'; import { Event } from '#/_base/event'; import { ILogService } from '#/_base/log/log'; -import type { Hooks } from '#/hooks'; import { IBootstrapService } from '#/app/bootstrap/bootstrap'; import { IConfigService } from '#/app/config/config'; import { IFlagService } from '#/app/flag/flag'; @@ -59,10 +58,6 @@ import { IWorkspaceToolPolicy } from '#/workspace/workspaceToolPolicy/workspaceT import { WorkspaceToolPolicyService } from '#/workspace/workspaceToolPolicy/workspaceToolPolicyService'; import { IAgentActivityView } from '#/agent/activityView/activityView'; import { ISessionExternalHooksService } from '#/session/externalHooks/externalHooks'; -import { - ISessionLifecycleHooks, - type SessionLifecycleHookSlots, -} from '#/session/sessionLifecycleHooks/sessionLifecycleHooks'; import { ISessionIndexMirror } from '#/app/sessionIndex/sessionIndex'; import { ISessionMetadata, @@ -521,19 +516,19 @@ class RecordingSessionExternalHooksService constructor( @ISessionContext private readonly context: ISessionContext, - @ISessionLifecycleHooks hooks: Hooks, + @ISessionLifecycleService lifecycle: ISessionLifecycleService, ) { super(); this._register( - hooks.onDidCreateSession.register('test', async (event, next) => { + lifecycle.onDidCreateSession((event) => { + if (event.sessionId !== this.context.sessionId) return; recordedSessionHookEvents.push(`create:${event.source}:${this.context.sessionId}`); - await next(); }), ); this._register( - hooks.onWillCloseSession.register('test', async (event, next) => { + lifecycle.onWillCloseSession((event) => { + if (event.sessionId !== this.context.sessionId) return; recordedSessionHookEvents.push(`close:${event.reason}:${this.context.sessionId}`); - await next(); }), ); } diff --git a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts index 94bd1776e7f..697385b6376 100644 --- a/packages/node-sdk/test/sdk-rpc-client-v2.test.ts +++ b/packages/node-sdk/test/sdk-rpc-client-v2.test.ts @@ -34,7 +34,6 @@ import { drainSessionIndexMirror, HostProcessError, IHostRequestHeaders, - ISessionLifecycleHooks, ISessionLifecycleService, IWorkspaceLifecycleService, OsProcessErrors, @@ -442,13 +441,11 @@ key = "${titleOAuthRef.key}" const closeGate = new Promise((resolve) => { openCloseGate = resolve; }); - tempHandle!.accessor - .get(ISessionLifecycleHooks) - .onWillCloseSession.register('test-block', async (_event, next) => { - markCloseStarted(); - await closeGate; - await next(); - }); + handler.accessor.get(ISessionLifecycleService).onWillCloseSession((event) => { + if (event.sessionId !== 'ses_title_race') return; + markCloseStarted(); + event.waitUntil(closeGate); + }); resolveFetch( new Response(JSON.stringify({ title: 'Generated title' }), { From 102984aa660d752ba8dd7d1aba155575f32affe2 Mon Sep 17 00:00:00 2001 From: oocz <37055139+oocz@users.noreply.github.com> Date: Thu, 13 Aug 2026 22:56:06 +0800 Subject: [PATCH 48/50] fix: settle cancelled MCP OAuth callbacks (#2899) Co-authored-by: yuchengzhen --- .changeset/fix-mcp-oauth-cancel.md | 5 + .../src/mcp/oauth/callback-server.ts | 98 ++++++++++++------- .../test/mcp/oauth-callback-server.test.ts | 87 ++++++++++++++++ 3 files changed, 156 insertions(+), 34 deletions(-) create mode 100644 .changeset/fix-mcp-oauth-cancel.md create mode 100644 packages/agent-core/test/mcp/oauth-callback-server.test.ts diff --git a/.changeset/fix-mcp-oauth-cancel.md b/.changeset/fix-mcp-oauth-cancel.md new file mode 100644 index 00000000000..07f295679db --- /dev/null +++ b/.changeset/fix-mcp-oauth-cancel.md @@ -0,0 +1,5 @@ +--- +"@moonshot-ai/kimi-code": patch +--- + +Fix MCP OAuth cancellation leaving an in-flight authorization waiting for its callback timeout. diff --git a/packages/agent-core/src/mcp/oauth/callback-server.ts b/packages/agent-core/src/mcp/oauth/callback-server.ts index a1c902e28e3..5b8a0c0cf73 100644 --- a/packages/agent-core/src/mcp/oauth/callback-server.ts +++ b/packages/agent-core/src/mcp/oauth/callback-server.ts @@ -24,11 +24,19 @@ export interface CallbackServer { * - `signal` aborts → AbortError * - `timeoutMs` elapses → Error('OAuth callback timed out') * - the user's authorization server returns an error → Error('OAuth error: ') + * - `close()` is called → OAuthCallbackClosedError */ waitForCode(opts: { signal?: AbortSignal; timeoutMs?: number }): Promise; close(): Promise; } +export class OAuthCallbackClosedError extends Error { + constructor() { + super('OAuth callback listener closed'); + this.name = 'OAuthCallbackClosedError'; + } +} + const SUCCESS_HTML = 'Authorized' + '' + @@ -46,12 +54,29 @@ const ERROR_HTML = export async function startCallbackServer(): Promise { let resolveCode: ((value: CallbackResult) => void) | undefined; let rejectCode: ((reason: Error) => void) | undefined; - let settled = false; + let cleanupWait: (() => void) | undefined; + let outcome: + | { readonly status: 'pending' } + | { readonly status: 'resolved'; readonly value: CallbackResult } + | { readonly status: 'rejected'; readonly reason: Error } = { status: 'pending' }; - const settle = (fn: () => void) => { - if (settled) return; - settled = true; - fn(); + const settle = ( + next: + | { readonly status: 'resolved'; readonly value: CallbackResult } + | { readonly status: 'rejected'; readonly reason: Error }, + ) => { + if (outcome.status !== 'pending') return; + outcome = next; + cleanupWait?.(); + cleanupWait = undefined; + if (next.status === 'resolved') { + resolveCode?.(next.value); + } else { + rejectCode?.(next.reason); + } + resolveCode = undefined; + rejectCode = undefined; + void closeServer(); }; const server: Server = createServer((req, res) => { @@ -78,26 +103,26 @@ export async function startCallbackServer(): Promise { if (errorParam !== null) { const description = url.searchParams.get('error_description') ?? ''; res.writeHead(400, { 'content-type': 'text/html; charset=utf-8' }).end(ERROR_HTML); - settle(() => { - rejectCode?.( - new Error(`OAuth error: ${errorParam}${description ? ` — ${description}` : ''}`), - ); + settle({ + status: 'rejected', + reason: new Error( + `OAuth error: ${errorParam}${description ? ` — ${description}` : ''}`, + ), }); return; } const code = url.searchParams.get('code'); if (code === null || code.length === 0) { res.writeHead(400, { 'content-type': 'text/html; charset=utf-8' }).end(ERROR_HTML); - settle(() => { - rejectCode?.(new Error('OAuth callback missing authorization code')); + settle({ + status: 'rejected', + reason: new Error('OAuth callback missing authorization code'), }); return; } const state = url.searchParams.get('state') ?? undefined; res.writeHead(200, { 'content-type': 'text/html; charset=utf-8' }).end(SUCCESS_HTML); - settle(() => { - resolveCode?.({ code, state }); - }); + settle({ status: 'resolved', value: { code, state } }); } await new Promise((resolve, reject) => { @@ -110,44 +135,49 @@ export async function startCallbackServer(): Promise { const port = (server.address() as AddressInfo).port; const redirectUri = `http://127.0.0.1:${port}/callback`; - let closed = false; - const close = async () => { - if (closed) return; - closed = true; - await new Promise((resolve) => { + let closeServerPromise: Promise | undefined; + const closeServer = (): Promise => { + closeServerPromise ??= new Promise((resolve) => { server.close(() => { resolve(); }); }); + return closeServerPromise; + }; + const close = async () => { + settle({ status: 'rejected', reason: new OAuthCallbackClosedError() }); + await closeServer(); }; const waitForCode: CallbackServer['waitForCode'] = ({ signal, timeoutMs } = {}) => { return new Promise((resolve, reject) => { + if (outcome.status === 'resolved') { + resolve(outcome.value); + return; + } + if (outcome.status === 'rejected') { + reject(outcome.reason); + return; + } + let timer: NodeJS.Timeout | undefined; const onAbort = () => { - settle(() => - rejectCode?.( + settle({ + status: 'rejected', + reason: signal?.reason instanceof Error ? signal.reason : new Error('OAuth flow aborted'), - ), - ); + }); }; const cleanup = () => { if (timer !== undefined) clearTimeout(timer); signal?.removeEventListener('abort', onAbort); }; - resolveCode = (value) => { - cleanup(); - void close(); - resolve(value); - }; - rejectCode = (reason) => { - cleanup(); - void close(); - reject(reason); - }; + cleanupWait = cleanup; + resolveCode = resolve; + rejectCode = reject; if (timeoutMs !== undefined) { timer = setTimeout(() => { - settle(() => rejectCode?.(new Error('OAuth callback timed out'))); + settle({ status: 'rejected', reason: new Error('OAuth callback timed out') }); }, timeoutMs); } if (signal !== undefined) { diff --git a/packages/agent-core/test/mcp/oauth-callback-server.test.ts b/packages/agent-core/test/mcp/oauth-callback-server.test.ts new file mode 100644 index 00000000000..19d6562d461 --- /dev/null +++ b/packages/agent-core/test/mcp/oauth-callback-server.test.ts @@ -0,0 +1,87 @@ +/** + * Scenario: lifecycle completion for the localhost MCP OAuth callback listener. + * Responsibilities: closing rejects pending waits, successful callbacks survive cleanup, and + * service cancellation settles in-flight completion. The listener and service are real; only the + * external MCP SDK authorization boundary is mocked. + * Run: pnpm --filter @moonshot-ai/agent-core exec vitest run test/mcp/oauth-callback-server.test.ts + */ + +import { mkdtemp, rm } from 'node:fs/promises'; +import { tmpdir } from 'node:os'; +import { join } from 'pathe'; + +import { auth } from '@modelcontextprotocol/sdk/client/auth.js'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; + +import { + type BeginAuthorizationResult, + type CallbackServer, + JsonFileStore, + McpOAuthService, + OAuthCallbackClosedError, + startCallbackServer, +} from '../../src/mcp/oauth'; + +vi.mock('@modelcontextprotocol/sdk/client/auth.js', async (importOriginal) => ({ + ...(await importOriginal()), + auth: vi.fn(), +})); + +describe('OAuth callback server', () => { + let server: CallbackServer | undefined; + + afterEach(async () => { + await server?.close(); + server = undefined; + }); + + it('rejects a pending callback wait with a closed error when explicitly closed', async () => { + server = await startCallbackServer(); + const pending = server.waitForCode({ timeoutMs: 60_000 }); + const rejection = expect(pending).rejects.toBeInstanceOf(OAuthCallbackClosedError); + + await server.close(); + + await rejection; + }); + + it('delivers the callback payload when success closes the listener', async () => { + server = await startCallbackServer(); + const pending = server.waitForCode({ timeoutMs: 60_000 }); + + await fetch(`${server.redirectUri}?code=code-1&state=state-1`); + + await expect(pending).resolves.toEqual({ code: 'code-1', state: 'state-1' }); + }); +}); + +describe('McpOAuthService cancellation', () => { + let dir: string; + let flow: BeginAuthorizationResult | undefined; + + beforeEach(async () => { + dir = await mkdtemp(join(tmpdir(), 'kimi-mcp-oauth-cancel-')); + vi.mocked(auth).mockImplementation(async (provider) => { + await provider.redirectToAuthorization(new URL('https://auth.example.test/authorize')); + return 'REDIRECT'; + }); + }); + + afterEach(async () => { + await flow?.cancel(); + flow = undefined; + await rm(dir, { recursive: true, force: true }); + vi.clearAllMocks(); + }); + + it('rejects an in-flight completion when the authorization flow is cancelled', async () => { + const service = new McpOAuthService({ store: new JsonFileStore(dir) }); + flow = await service.beginAuthorization('example', 'https://mcp.example.test/rpc'); + const completion = flow.complete({ timeoutMs: 60_000 }); + const rejection = expect(completion).rejects.toThrow('OAuth callback listener closed'); + + await flow.cancel(); + + await rejection; + }); +}); From 61cc1323182309c62a34bc2678394c5d685fbaca Mon Sep 17 00:00:00 2001 From: Mark Buckaway Date: Thu, 13 Aug 2026 14:49:30 -0700 Subject: [PATCH 49/50] test: align fork-identity and removed-API assertions with the 0.36 sync - preflight.test.ts: the upstream-added resolved-spawn test asserted @moonshot-ai/kimi-code; the fork installs @mbuckaway/kimi-code - node-sdk supermoon-mode.test.ts: SessionPromptRpcInput.disabledTools was removed upstream (#2871); drop the field from the expected prompt args and remove the disabled-tools forwarding test whose subject no longer exists --- .../test/cli/update/preflight.test.ts | 2 +- packages/node-sdk/test/supermoon-mode.test.ts | 21 ------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/apps/kimi-code/test/cli/update/preflight.test.ts b/apps/kimi-code/test/cli/update/preflight.test.ts index d7e5000779f..e49ec87f578 100644 --- a/apps/kimi-code/test/cli/update/preflight.test.ts +++ b/apps/kimi-code/test/cli/update/preflight.test.ts @@ -600,7 +600,7 @@ describe('runUpdatePreflight', () => { expect(mocks.resolveCommandPath).toHaveBeenCalledWith('npm'); expect(mocks.spawn).toHaveBeenCalledWith( '/usr/local/bin/npm', - ['install', '-g', '@moonshot-ai/kimi-code@0.5.0'], + ['install', '-g', '@mbuckaway/kimi-code@0.5.0'], { stdio: 'inherit' }, ); }); diff --git a/packages/node-sdk/test/supermoon-mode.test.ts b/packages/node-sdk/test/supermoon-mode.test.ts index a65690fe444..0eac70643f7 100644 --- a/packages/node-sdk/test/supermoon-mode.test.ts +++ b/packages/node-sdk/test/supermoon-mode.test.ts @@ -98,7 +98,6 @@ describe('Supermoon mode (SDKRpcClientBase)', () => { sessionId: 'session-1', agentId: 'main', input, - disabledTools: undefined, }); // One-shot semantics: the enter dispatch strictly precedes the prompt. expect(client.rpcEnterSupermoon.mock.invocationCallOrder[0] ?? -1).toBeLessThan( @@ -106,26 +105,6 @@ describe('Supermoon mode (SDKRpcClientBase)', () => { ); }); - it('supermoon_forwardsDisabledToolsToThePromptDispatch', async () => { - await client.supermoon({ - sessionId: 'session-1', - input: [{ type: 'text', text: 'refactor the module' }], - disabledTools: ['edit'], - }); - - expect(client.rpcEnterSupermoon).toHaveBeenCalledWith({ - sessionId: 'session-1', - agentId: 'main', - trigger: 'task', - }); - expect(client.rpcPrompt).toHaveBeenCalledWith({ - sessionId: 'session-1', - agentId: 'main', - input: [{ type: 'text', text: 'refactor the module' }], - disabledTools: ['edit'], - }); - }); - it('supermoon_rejectsAnUnknownTriggerAtCompileTime', () => { // SupermoonModeTrigger deliberately has no `tool` trigger (unlike // SwarmModeTrigger) — the discriminated input type below is the spec: From b4e8c908461207c32f8322c1955df19ac7b5f6f6 Mon Sep 17 00:00:00 2001 From: Mark Buckaway Date: Thu, 13 Aug 2026 15:01:13 -0700 Subject: [PATCH 50/50] test(tui): supply supermoonMode in the fullscreen-layout fixture The fork's AppState requires supermoonMode; the fixture predates the field. --- apps/kimi-code/test/tui/fullscreen-layout.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/kimi-code/test/tui/fullscreen-layout.test.ts b/apps/kimi-code/test/tui/fullscreen-layout.test.ts index f002a3a02ec..74caf3f7a56 100644 --- a/apps/kimi-code/test/tui/fullscreen-layout.test.ts +++ b/apps/kimi-code/test/tui/fullscreen-layout.test.ts @@ -33,6 +33,7 @@ function fakeInitialAppState(): AppState { planMode: false, inputMode: 'prompt', swarmMode: false, + supermoonMode: false, thinkingEffort: 'off', contextUsage: 0, contextTokens: 0,